Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
145a649d
Commit
145a649d
authored
Sep 23, 2007
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libvlc: Implement the _get_state function. Fix a leak. Fix a warning.
parent
723934d9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
23 deletions
+89
-23
include/vlc/libvlc.h
include/vlc/libvlc.h
+18
-1
include/vlc/libvlc_structures.h
include/vlc/libvlc_structures.h
+11
-0
src/control/media_instance.c
src/control/media_instance.c
+17
-3
src/control/media_list_player.c
src/control/media_list_player.c
+43
-19
No files found.
include/vlc/libvlc.h
View file @
145a649d
...
@@ -388,7 +388,7 @@ VLC_PUBLIC_API void libvlc_media_instance_set_position ( libvlc_media_i
...
@@ -388,7 +388,7 @@ VLC_PUBLIC_API void libvlc_media_instance_set_position ( libvlc_media_i
VLC_PUBLIC_API
vlc_bool_t
libvlc_media_instance_will_play
(
libvlc_media_instance_t
*
,
libvlc_exception_t
*
);
VLC_PUBLIC_API
vlc_bool_t
libvlc_media_instance_will_play
(
libvlc_media_instance_t
*
,
libvlc_exception_t
*
);
VLC_PUBLIC_API
float
libvlc_media_instance_get_rate
(
libvlc_media_instance_t
*
,
libvlc_exception_t
*
);
VLC_PUBLIC_API
float
libvlc_media_instance_get_rate
(
libvlc_media_instance_t
*
,
libvlc_exception_t
*
);
VLC_PUBLIC_API
void
libvlc_media_instance_set_rate
(
libvlc_media_instance_t
*
,
float
,
libvlc_exception_t
*
);
VLC_PUBLIC_API
void
libvlc_media_instance_set_rate
(
libvlc_media_instance_t
*
,
float
,
libvlc_exception_t
*
);
VLC_PUBLIC_API
int
libvlc_media_instance_get_state
(
libvlc_media_instance_t
*
,
libvlc_exception_t
*
);
VLC_PUBLIC_API
libvlc_state_t
libvlc_media_instance_get_state
(
libvlc_media_instance_t
*
,
libvlc_exception_t
*
);
/**
/**
* Does this input have a video output ?
* Does this input have a video output ?
...
@@ -529,6 +529,11 @@ VLC_PUBLIC_API void
...
@@ -529,6 +529,11 @@ VLC_PUBLIC_API void
int
index
,
int
index
,
libvlc_exception_t
*
p_e
);
libvlc_exception_t
*
p_e
);
VLC_PUBLIC_API
void
libvlc_media_list_view_remove_at_index
(
libvlc_media_list_view_t
*
p_mlv
,
int
index
,
libvlc_exception_t
*
p_e
);
VLC_PUBLIC_API
void
VLC_PUBLIC_API
void
libvlc_media_list_view_add_item
(
libvlc_media_list_view_t
*
p_mlv
,
libvlc_media_list_view_add_item
(
libvlc_media_list_view_t
*
p_mlv
,
libvlc_media_descriptor_t
*
p_md
,
libvlc_media_descriptor_t
*
p_md
,
...
@@ -623,6 +628,18 @@ VLC_PUBLIC_API void
...
@@ -623,6 +628,18 @@ VLC_PUBLIC_API void
libvlc_media_list_player_play
(
libvlc_media_list_player_t
*
p_mlp
,
libvlc_media_list_player_play
(
libvlc_media_list_player_t
*
p_mlp
,
libvlc_exception_t
*
p_e
);
libvlc_exception_t
*
p_e
);
VLC_PUBLIC_API
void
libvlc_media_list_player_pause
(
libvlc_media_list_player_t
*
p_mlp
,
libvlc_exception_t
*
p_e
);
VLC_PUBLIC_API
int
libvlc_media_list_player_is_playing
(
libvlc_media_list_player_t
*
p_mlp
,
libvlc_exception_t
*
p_e
);
VLC_PUBLIC_API
libvlc_state_t
libvlc_media_list_player_get_state
(
libvlc_media_list_player_t
*
p_mlp
,
libvlc_exception_t
*
p_e
);
VLC_PUBLIC_API
void
VLC_PUBLIC_API
void
libvlc_media_list_player_play_item_at_index
(
libvlc_media_list_player_play_item_at_index
(
libvlc_media_list_player_t
*
p_mlp
,
libvlc_media_list_player_t
*
p_mlp
,
...
...
include/vlc/libvlc_structures.h
View file @
145a649d
...
@@ -120,6 +120,17 @@ typedef struct libvlc_media_descriptor_t libvlc_media_descriptor_t;
...
@@ -120,6 +120,17 @@ typedef struct libvlc_media_descriptor_t libvlc_media_descriptor_t;
typedef
struct
libvlc_media_instance_t
libvlc_media_instance_t
;
typedef
struct
libvlc_media_instance_t
libvlc_media_instance_t
;
typedef
enum
libvlc_state_t
{
libvlc_Stopped
,
libvlc_Opening
,
libvlc_Buffering
,
libvlc_Ended
,
libvlc_Error
,
libvlc_Playing
,
libvlc_Paused
}
libvlc_state_t
;
/**@} */
/**@} */
/*****************************************************************************
/*****************************************************************************
...
...
src/control/media_instance.c
View file @
145a649d
...
@@ -676,7 +676,18 @@ float libvlc_media_instance_get_rate(
...
@@ -676,7 +676,18 @@ float libvlc_media_instance_get_rate(
return
(
float
)
1000
.
0
f
/
val
.
i_int
;
return
(
float
)
1000
.
0
f
/
val
.
i_int
;
}
}
int
libvlc_media_instance_get_state
(
static
libvlc_state_t
vlc_to_libvlc_state
[]
=
{
[
INIT_S
]
=
libvlc_Opening
,
[
OPENING_S
]
=
libvlc_Opening
,
[
BUFFERING_S
]
=
libvlc_Buffering
,
[
PLAYING_S
]
=
libvlc_Playing
,
[
PAUSE_S
]
=
libvlc_Paused
,
[
END_S
]
=
libvlc_Ended
,
[
ERROR_S
]
=
libvlc_Error
,
};
libvlc_state_t
libvlc_media_instance_get_state
(
libvlc_media_instance_t
*
p_mi
,
libvlc_media_instance_t
*
p_mi
,
libvlc_exception_t
*
p_e
)
libvlc_exception_t
*
p_e
)
{
{
...
@@ -685,10 +696,13 @@ int libvlc_media_instance_get_state(
...
@@ -685,10 +696,13 @@ int libvlc_media_instance_get_state(
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
p_e
);
p_input_thread
=
libvlc_get_input_thread
(
p_mi
,
p_e
);
if
(
!
p_input_thread
)
if
(
!
p_input_thread
)
return
0
;
return
libvlc_Stopped
;
var_Get
(
p_input_thread
,
"state"
,
&
val
);
var_Get
(
p_input_thread
,
"state"
,
&
val
);
vlc_object_release
(
p_input_thread
);
vlc_object_release
(
p_input_thread
);
return
val
.
i_int
;
if
(
val
.
i_int
<
0
||
val
.
i_int
>
6
)
return
libvlc_Stopped
;
return
vlc_to_libvlc_state
[
val
.
i_int
];
}
}
src/control/media_list_player.c
View file @
145a649d
...
@@ -175,17 +175,6 @@ uninstall_media_instance_observer( libvlc_media_list_player_t * p_mlp )
...
@@ -175,17 +175,6 @@ uninstall_media_instance_observer( libvlc_media_list_player_t * p_mlp )
media_instance_reached_end
,
p_mlp
,
NULL
);
media_instance_reached_end
,
p_mlp
,
NULL
);
}
}
/**************************************************************************
* Stop (Public)
**************************************************************************/
static
vlc_bool_t
libvlc_media_list_player_is_playing
(
libvlc_media_list_player_t
*
p_mlp
,
libvlc_exception_t
*
p_e
)
{
//libvlc_exception_raise( p_e, "Unimplemented" );
return
1
;
}
/**************************************************************************
/**************************************************************************
* set_current_playing_item (private)
* set_current_playing_item (private)
*
*
...
@@ -199,18 +188,17 @@ set_current_playing_item( libvlc_media_list_player_t * p_mlp,
...
@@ -199,18 +188,17 @@ set_current_playing_item( libvlc_media_list_player_t * p_mlp,
libvlc_media_descriptor_t
*
p_md
;
libvlc_media_descriptor_t
*
p_md
;
p_md
=
libvlc_media_list_item_at_path
(
p_mlp
->
p_mlist
,
path
);
p_md
=
libvlc_media_list_item_at_path
(
p_mlp
->
p_mlist
,
path
);
if
(
!
p_md
)
{
if
(
!
libvlc_exception_raised
(
p_e
)
)
libvlc_exception_raise
(
p_e
,
"Can't obtain a media"
);
return
;
}
vlc_mutex_lock
(
&
p_mlp
->
object_lock
);
vlc_mutex_lock
(
&
p_mlp
->
object_lock
);
free
(
p_mlp
->
current_playing_item_path
);
free
(
p_mlp
->
current_playing_item_path
);
p_mlp
->
current_playing_item_path
=
path
;
p_mlp
->
current_playing_item_path
=
path
;
if
(
!
p_md
)
{
vlc_mutex_unlock
(
&
p_mlp
->
object_lock
);
return
;
}
/* We are not interested in getting media_descriptor stop event now */
/* We are not interested in getting media_descriptor stop event now */
uninstall_media_instance_observer
(
p_mlp
);
uninstall_media_instance_observer
(
p_mlp
);
if
(
p_md
->
p_subitems
&&
libvlc_media_list_count
(
p_md
->
p_subitems
,
NULL
)
>
0
)
if
(
p_md
->
p_subitems
&&
libvlc_media_list_count
(
p_md
->
p_subitems
,
NULL
)
>
0
)
...
@@ -337,6 +325,41 @@ void libvlc_media_list_player_play( libvlc_media_list_player_t * p_mlp,
...
@@ -337,6 +325,41 @@ void libvlc_media_list_player_play( libvlc_media_list_player_t * p_mlp,
libvlc_media_instance_play
(
p_mlp
->
p_mi
,
p_e
);
libvlc_media_instance_play
(
p_mlp
->
p_mi
,
p_e
);
}
}
/**************************************************************************
* Pause (Public)
**************************************************************************/
void
libvlc_media_list_player_pause
(
libvlc_media_list_player_t
*
p_mlp
,
libvlc_exception_t
*
p_e
)
{
if
(
!
p_mlp
->
p_mi
)
return
;
libvlc_media_instance_pause
(
p_mlp
->
p_mi
,
p_e
);
}
/**************************************************************************
* is_playing (Public)
**************************************************************************/
int
libvlc_media_list_player_is_playing
(
libvlc_media_list_player_t
*
p_mlp
,
libvlc_exception_t
*
p_e
)
{
libvlc_state_t
state
=
libvlc_media_instance_get_state
(
p_mlp
->
p_mi
,
p_e
);
return
(
state
==
libvlc_Opening
)
||
(
state
==
libvlc_Buffering
)
||
(
state
==
libvlc_Playing
);
}
/**************************************************************************
* State (Public)
**************************************************************************/
libvlc_state_t
libvlc_media_list_player_get_state
(
libvlc_media_list_player_t
*
p_mlp
,
libvlc_exception_t
*
p_e
)
{
if
(
!
p_mlp
->
p_mi
)
return
libvlc_Stopped
;
return
libvlc_media_instance_get_state
(
p_mlp
->
p_mi
,
p_e
);
}
/**************************************************************************
/**************************************************************************
* Play item at index (Public)
* Play item at index (Public)
**************************************************************************/
**************************************************************************/
...
@@ -389,6 +412,7 @@ void libvlc_media_list_player_stop( libvlc_media_list_player_t * p_mlp,
...
@@ -389,6 +412,7 @@ void libvlc_media_list_player_stop( libvlc_media_list_player_t * p_mlp,
libvlc_media_instance_stop
(
p_mlp
->
p_mi
,
p_e
);
libvlc_media_instance_stop
(
p_mlp
->
p_mi
,
p_e
);
vlc_mutex_lock
(
&
p_mlp
->
object_lock
);
vlc_mutex_lock
(
&
p_mlp
->
object_lock
);
free
(
p_mlp
->
current_playing_item_path
);
p_mlp
->
current_playing_item_path
=
NULL
;
p_mlp
->
current_playing_item_path
=
NULL
;
vlc_mutex_unlock
(
&
p_mlp
->
object_lock
);
vlc_mutex_unlock
(
&
p_mlp
->
object_lock
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment