Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
a4bb6352
Commit
a4bb6352
authored
Jun 14, 2008
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unify libvlc_state_t, input_state_e, mediacontrol_PlayerStatus and libvlc_event_type_t.
parent
0a54676f
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
106 additions
and
40 deletions
+106
-40
include/vlc/libvlc_events.h
include/vlc/libvlc_events.h
+6
-2
include/vlc/libvlc_structures.h
include/vlc/libvlc_structures.h
+14
-5
include/vlc/mediacontrol_structures.h
include/vlc/mediacontrol_structures.h
+7
-4
include/vlc_input.h
include/vlc_input.h
+3
-1
projects/mozilla/vlcplugin.cpp
projects/mozilla/vlcplugin.cpp
+0
-1
src/control/event.c
src/control/event.c
+8
-2
src/control/media_list_player.c
src/control/media_list_player.c
+2
-1
src/control/media_player.c
src/control/media_player.c
+46
-15
src/control/mediacontrol_core.c
src/control/mediacontrol_core.c
+20
-8
test/libvlc/events.c
test/libvlc/events.c
+0
-1
No files found.
include/vlc/libvlc_events.h
View file @
a4bb6352
...
...
@@ -47,10 +47,14 @@ typedef enum libvlc_event_type_t {
libvlc_MediaFreed
,
libvlc_MediaStateChanged
,
libvlc_MediaPlayerPlayed
,
libvlc_MediaPlayerNothingSpecial
,
libvlc_MediaPlayerOpening
,
libvlc_MediaPlayerBuffering
,
libvlc_MediaPlayerPlaying
,
libvlc_MediaPlayerPaused
,
libvlc_MediaPlayerEndReached
,
libvlc_MediaPlayerStopped
,
libvlc_MediaPlayerForward
,
libvlc_MediaPlayerBackward
,
libvlc_MediaPlayerEncounteredError
,
libvlc_MediaPlayerTimeChanged
,
libvlc_MediaPlayerPositionChanged
,
...
...
include/vlc/libvlc_structures.h
View file @
a4bb6352
...
...
@@ -119,16 +119,25 @@ typedef struct libvlc_media_t libvlc_media_t;
typedef
struct
libvlc_media_player_t
libvlc_media_player_t
;
/**
* Note the order of libvlc_state_t enum must match exactly the order of
* @see mediacontrol_PlayerStatus and @see input_state_e enums.
*
* Expected states by web plugins are:
* IDLE/CLOSE=0, OPENING=1, BUFFERING=2, PLAYING=3, PAUSED=4,
* STOPPING=5, FORWARD=6, BACKWARD=7, ERROR=8
*/
typedef
enum
libvlc_state_t
{
libvlc_NothingSpecial
,
libvlc_Stopped
,
libvlc_NothingSpecial
=
0
,
libvlc_Opening
,
libvlc_Buffering
,
libvlc_Ended
,
libvlc_Error
,
libvlc_Playing
,
libvlc_Paused
libvlc_Paused
,
libvlc_Ended
,
libvlc_Forward
,
libvlc_Backward
,
libvlc_Error
}
libvlc_state_t
;
/**@} */
...
...
include/vlc/mediacontrol_structures.h
View file @
a4bb6352
...
...
@@ -62,12 +62,15 @@ typedef enum {
/**
* Possible player status
* Note the order of these enums must match exactly the order of
* libvlc_state_t and input_state_e enums.
*/
typedef
enum
{
mediacontrol_PlayingStatus
,
mediacontrol_PauseStatus
,
mediacontrol_ForwardStatus
,
mediacontrol_BackwardStatus
,
mediacontrol_InitStatus
,
mediacontrol_EndStatus
,
mediacontrol_UndefinedStatus
mediacontrol_UndefinedStatus
=
0
,
mediacontrol_InitStatus
,
mediacontrol_BufferingStatus
,
mediacontrol_PlayingStatus
,
mediacontrol_PauseStatus
,
mediacontrol_EndStatus
,
mediacontrol_ForwardStatus
,
mediacontrol_BackwardStatus
,
mediacontrol_ErrorStatus
,
}
mediacontrol_PlayerStatus
;
/**
...
...
include/vlc_input.h
View file @
a4bb6352
...
...
@@ -527,12 +527,14 @@ static inline void vlc_input_attachment_Delete( input_attachment_t *a )
/* "state" value */
enum
input_state_e
{
INIT_S
,
INIT_S
=
0
,
OPENING_S
,
BUFFERING_S
,
PLAYING_S
,
PAUSE_S
,
END_S
,
FORWARD_S
,
BACKWARD_S
,
ERROR_S
};
...
...
projects/mozilla/vlcplugin.cpp
View file @
a4bb6352
...
...
@@ -172,7 +172,6 @@ NPError VlcPlugin::init(int argc, char* const argn[], char* const argv[])
}
}
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
...
...
src/control/event.c
View file @
a4bb6352
...
...
@@ -239,12 +239,18 @@ static const char event_type_to_name[][35] =
EVENT
(
libvlc_MediaFreed
),
EVENT
(
libvlc_MediaStateChanged
),
EVENT
(
libvlc_MediaPlayerPlayed
),
EVENT
(
libvlc_MediaPlayerNothingSpecial
),
EVENT
(
libvlc_MediaPlayerOpening
),
EVENT
(
libvlc_MediaPlayerBuffering
),
EVENT
(
libvlc_MediaPlayerPlaying
),
EVENT
(
libvlc_MediaPlayerPaused
),
EVENT
(
libvlc_MediaPlayerEndReached
),
EVENT
(
libvlc_MediaPlayerStopped
),
EVENT
(
libvlc_MediaPlayerForward
),
EVENT
(
libvlc_MediaPlayerBackward
),
EVENT
(
libvlc_MediaPlayerTimeChanged
),
EVENT
(
libvlc_MediaPlayerPositionChanged
),
EVENT
(
libvlc_MediaPlayerSeekableChanged
),
EVENT
(
libvlc_MediaPlayerPausableChanged
),
EVENT
(
libvlc_MediaListItemAdded
),
EVENT
(
libvlc_MediaListWillAddItem
),
...
...
src/control/media_list_player.c
View file @
a4bb6352
...
...
@@ -368,6 +368,7 @@ libvlc_media_list_player_is_playing( libvlc_media_list_player_t * p_mlp,
{
libvlc_state_t
state
=
libvlc_media_player_get_state
(
p_mlp
->
p_mi
,
p_e
);
return
(
state
==
libvlc_Opening
)
||
(
state
==
libvlc_Buffering
)
||
(
state
==
libvlc_Forward
)
||
(
state
==
libvlc_Backward
)
||
(
state
==
libvlc_Playing
);
}
...
...
@@ -379,7 +380,7 @@ 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_
Stopp
ed
;
return
libvlc_
End
ed
;
return
libvlc_media_player_get_state
(
p_mlp
->
p_mi
,
p_e
);
}
...
...
src/control/media_player.c
View file @
a4bb6352
...
...
@@ -51,19 +51,21 @@ input_time_changed( vlc_object_t * p_this, char const * psz_cmd,
static
const
libvlc_state_t
vlc_to_libvlc_state_array
[]
=
{
[
INIT_S
]
=
libvlc_
Opening
,
[
INIT_S
]
=
libvlc_
NothingSpecial
,
[
OPENING_S
]
=
libvlc_Opening
,
[
BUFFERING_S
]
=
libvlc_Buffering
,
[
PLAYING_S
]
=
libvlc_Playing
,
[
PAUSE_S
]
=
libvlc_Paused
,
[
END_S
]
=
libvlc_Ended
,
[
FORWARD_S
]
=
libvlc_Forward
,
[
BACKWARD_S
]
=
libvlc_Backward
,
[
ERROR_S
]
=
libvlc_Error
,
};
static
inline
libvlc_state_t
vlc_to_libvlc_state
(
int
vlc_state
)
{
if
(
vlc_state
<
0
||
vlc_state
>
6
)
return
libvlc_
Stopp
ed
;
return
libvlc_
End
ed
;
return
vlc_to_libvlc_state_array
[
vlc_state
];
}
...
...
@@ -144,22 +146,43 @@ input_state_changed( const vlc_event_t * event, void * p_userdata )
switch
(
type
)
{
case
END
_S
:
case
INIT
_S
:
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_NothingSpecial
,
NULL
);
forwarded_event
.
type
=
libvlc_MediaPlayer
EndReached
;
forwarded_event
.
type
=
libvlc_MediaPlayer
NothingSpecial
;
break
;
case
PAUSE_S
:
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_Playing
,
NULL
);
forwarded_event
.
type
=
libvlc_MediaPlayerPaused
;
case
OPENING_S
:
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_Opening
,
NULL
);
forwarded_event
.
type
=
libvlc_MediaPlayerOpening
;
break
;
case
BUFFERING_S
:
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_Buffering
,
NULL
);
forwarded_event
.
type
=
libvlc_MediaPlayerBuffering
;
break
;
case
PLAYING_S
:
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_Playing
,
NULL
);
forwarded_event
.
type
=
libvlc_MediaPlayerPlayed
;
break
;
case
PAUSE_S
:
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_Paused
,
NULL
);
forwarded_event
.
type
=
libvlc_MediaPlayerPaused
;
break
;
case
END_S
:
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_Ended
,
NULL
);
forwarded_event
.
type
=
libvlc_MediaPlayerEndReached
;
break
;
case
FORWARD_S
:
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_Forward
,
NULL
);
forwarded_event
.
type
=
libvlc_MediaPlayerForward
;
break
;
case
BACKWARD_S
:
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_Backward
,
NULL
);
forwarded_event
.
type
=
libvlc_MediaPlayerBackward
;
break
;
case
ERROR_S
:
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_Error
,
NULL
);
forwarded_event
.
type
=
libvlc_MediaPlayerEncounteredError
;
break
;
default:
return
;
}
...
...
@@ -317,15 +340,24 @@ libvlc_media_player_new( libvlc_instance_t * p_libvlc_instance,
}
libvlc_event_manager_register_event_type
(
p_mi
->
p_event_manager
,
libvlc_MediaPlayer
EndReached
,
p_e
);
libvlc_MediaPlayer
NothingSpecial
,
p_e
);
libvlc_event_manager_register_event_type
(
p_mi
->
p_event_manager
,
libvlc_MediaPlayer
Stopped
,
p_e
);
libvlc_MediaPlayer
Opening
,
p_e
);
libvlc_event_manager_register_event_type
(
p_mi
->
p_event_manager
,
libvlc_MediaPlayerEncounteredError
,
p_e
);
libvlc_MediaPlayerBuffering
,
p_e
);
libvlc_event_manager_register_event_type
(
p_mi
->
p_event_manager
,
libvlc_MediaPlayerPlaying
,
p_e
);
libvlc_event_manager_register_event_type
(
p_mi
->
p_event_manager
,
libvlc_MediaPlayerPaused
,
p_e
);
libvlc_event_manager_register_event_type
(
p_mi
->
p_event_manager
,
libvlc_MediaPlayerPlayed
,
p_e
);
libvlc_MediaPlayerEndReached
,
p_e
);
libvlc_event_manager_register_event_type
(
p_mi
->
p_event_manager
,
libvlc_MediaPlayerForward
,
p_e
);
libvlc_event_manager_register_event_type
(
p_mi
->
p_event_manager
,
libvlc_MediaPlayerBackward
,
p_e
);
libvlc_event_manager_register_event_type
(
p_mi
->
p_event_manager
,
libvlc_MediaPlayerEncounteredError
,
p_e
);
libvlc_event_manager_register_event_type
(
p_mi
->
p_event_manager
,
libvlc_MediaPlayerPositionChanged
,
p_e
);
libvlc_event_manager_register_event_type
(
p_mi
->
p_event_manager
,
...
...
@@ -636,12 +668,11 @@ void libvlc_media_player_stop( libvlc_media_player_t *p_mi,
if
(
state
==
libvlc_Playing
||
state
==
libvlc_Paused
)
{
/* Send a stop notification event only of we are in playing or paused states */
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_Stopped
,
p_e
);
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_Ended
,
p_e
);
/* Construct and send the event */
libvlc_event_t
event
;
event
.
type
=
libvlc_MediaPlayer
Stopp
ed
;
event
.
type
=
libvlc_MediaPlayer
EndReach
ed
;
libvlc_event_send
(
p_mi
->
p_event_manager
,
&
event
);
}
...
...
@@ -925,7 +956,7 @@ libvlc_state_t libvlc_media_player_get_state(
/* We do return the right value, no need to throw an exception */
if
(
libvlc_exception_raised
(
p_e
)
)
libvlc_exception_clear
(
p_e
);
return
libvlc_
Stopp
ed
;
return
libvlc_
End
ed
;
}
var_Get
(
p_input_thread
,
"state"
,
&
val
);
...
...
src/control/mediacontrol_core.c
View file @
a4bb6352
...
...
@@ -357,25 +357,37 @@ mediacontrol_get_stream_information( mediacontrol_Instance *self,
else
{
libvlc_state_t
state
;
state
=
libvlc_media_player_get_state
(
self
->
p_media_player
,
&
ex
);
HANDLE_LIBVLC_EXCEPTION_NULL
(
&
ex
);
switch
(
state
)
{
case
libvlc_Playing
:
retval
->
streamstatus
=
mediacontrol_PlayingStatus
;
break
;
case
libvlc_Paused
:
retval
->
streamstatus
=
mediacontrol_PauseStatus
;
case
libvlc_NothingSpecial
:
retval
->
streamstatus
=
mediacontrol_UndefinedStatus
;
break
;
case
libvlc_Opening
:
case
libvlc_Buffering
:
retval
->
streamstatus
=
mediacontrol_InitStatus
;
break
;
case
libvlc_Stopped
:
case
libvlc_Buffering
:
retval
->
streamstatus
=
mediacontrol_BufferingStatus
;
break
;
case
libvlc_Playing
:
retval
->
streamstatus
=
mediacontrol_PlayingStatus
;
break
;
case
libvlc_Paused
:
retval
->
streamstatus
=
mediacontrol_PauseStatus
;
break
;
case
libvlc_Ended
:
retval
->
streamstatus
=
mediacontrol_EndStatus
;
break
;
case
libvlc_Forward
:
retval
->
streamstatus
=
mediacontrol_ForwardStatus
;
break
;
case
libvlc_Backward
:
retval
->
streamstatus
=
mediacontrol_BackwardStatus
;
break
;
case
libvlc_Error
:
retval
->
streamstatus
=
mediacontrol_ErrorStatus
;
break
;
default
:
retval
->
streamstatus
=
mediacontrol_UndefinedStatus
;
break
;
...
...
test/libvlc/events.c
View file @
a4bb6352
...
...
@@ -67,7 +67,6 @@ static void test_events (const char ** argv, int argc)
libvlc_MediaPlayerPlayed
,
libvlc_MediaPlayerPaused
,
libvlc_MediaPlayerEndReached
,
libvlc_MediaPlayerStopped
,
libvlc_MediaPlayerEncounteredError
,
libvlc_MediaPlayerTimeChanged
,
libvlc_MediaPlayerPositionChanged
,
...
...
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