Commit dcee738b authored by Clément Stenac's avatar Clément Stenac

Fix loop in mozilla plugin (closes #138)

parent 452a1389
...@@ -330,6 +330,20 @@ NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ...@@ -330,6 +330,20 @@ NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
#endif /* XP_MACOSX */ #endif /* XP_MACOSX */
/* HACK: special case for loop, to have it set before playlist startup
*/
for( i = 0; i < argc ; i++ )
{
if( !strcmp( argn[i], "loop" ) )
{
if( !strcmp( argv[i], "yes" ) )
{
value.b_bool = VLC_TRUE;
VLC_VariableSet( p_plugin->i_vlc, "conf::loop", value );
}
}
}
i_ret = VLC_Init( p_plugin->i_vlc, sizeof(ppsz_argv)/sizeof(char*), i_ret = VLC_Init( p_plugin->i_vlc, sizeof(ppsz_argv)/sizeof(char*),
ppsz_argv ); ppsz_argv );
...@@ -395,14 +409,6 @@ NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ...@@ -395,14 +409,6 @@ NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
} }
#if USE_LIBVLC #if USE_LIBVLC
else if( !strcmp( argn[i], "loop" ) )
{
if( !strcmp( argv[i], "yes" ) )
{
value.b_bool = VLC_TRUE;
VLC_VariableSet( p_plugin->i_vlc, "conf::loop", value );
}
}
else if( !strcmp( argn[i], "fullscreen" ) ) else if( !strcmp( argn[i], "fullscreen" ) )
{ {
if( !strcmp( argv[i], "yes" ) ) if( !strcmp( argv[i], "yes" ) )
...@@ -448,7 +454,6 @@ static void HackStopVout( VlcPlugin* p_plugin ) ...@@ -448,7 +454,6 @@ static void HackStopVout( VlcPlugin* p_plugin )
do do
{ {
fprintf( stderr, "FindWindow: %p\n", hwnd );
while( PeekMessage( &msg, (HWND)value.i_int, 0, 0, PM_REMOVE ) ) while( PeekMessage( &msg, (HWND)value.i_int, 0, 0, PM_REMOVE ) )
{ {
TranslateMessage(&msg); TranslateMessage(&msg);
...@@ -676,7 +681,7 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window ) ...@@ -676,7 +681,7 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
{ {
#if USE_LIBVLC #if USE_LIBVLC
VLC_AddTarget( p_plugin->i_vlc, p_plugin->psz_target, VLC_AddTarget( p_plugin->i_vlc, p_plugin->psz_target,
0, 0, i_mode, PLAYLIST_END ); 0, 0, PLAYLIST_INSERT, 0 );
#endif #endif
p_plugin->b_stream = VLC_TRUE; p_plugin->b_stream = VLC_TRUE;
} }
......
...@@ -761,7 +761,7 @@ static playlist_item_t * NextItem( playlist_t *p_playlist ) ...@@ -761,7 +761,7 @@ static playlist_item_t * NextItem( playlist_t *p_playlist )
int i_skip,i_goto,i, i_new, i_count ; int i_skip,i_goto,i, i_new, i_count ;
playlist_view_t *p_view; playlist_view_t *p_view;
vlc_bool_t b_loop = var_GetBool( p_playlist, "loop"); vlc_bool_t b_loop = var_GetBool( p_playlist, "loop" );
vlc_bool_t b_random = var_GetBool( p_playlist, "random" ); vlc_bool_t b_random = var_GetBool( p_playlist, "random" );
vlc_bool_t b_repeat = var_GetBool( p_playlist, "repeat" ); vlc_bool_t b_repeat = var_GetBool( p_playlist, "repeat" );
vlc_bool_t b_playstop = var_GetBool( p_playlist, "play-and-stop" ); vlc_bool_t b_playstop = var_GetBool( p_playlist, "play-and-stop" );
...@@ -771,7 +771,6 @@ static playlist_item_t * NextItem( playlist_t *p_playlist ) ...@@ -771,7 +771,6 @@ static playlist_item_t * NextItem( playlist_t *p_playlist )
int64_t start = mdate(); int64_t start = mdate();
#endif #endif
/* Handle quickly a few special cases */ /* Handle quickly a few special cases */
/* No items to play */ /* No items to play */
...@@ -830,7 +829,7 @@ static playlist_item_t * NextItem( playlist_t *p_playlist ) ...@@ -830,7 +829,7 @@ static playlist_item_t * NextItem( playlist_t *p_playlist )
{ {
p_playlist->pp_items[--i_count]->i_nb_played = 0; p_playlist->pp_items[--i_count]->i_nb_played = 0;
} }
if( !b_loop ) if( !b_loop )
{ {
return NULL; return NULL;
} }
...@@ -838,7 +837,7 @@ static playlist_item_t * NextItem( playlist_t *p_playlist ) ...@@ -838,7 +837,7 @@ static playlist_item_t * NextItem( playlist_t *p_playlist )
p_playlist->request.i_skip = 0; p_playlist->request.i_skip = 0;
p_playlist->request.b_request = VLC_FALSE; p_playlist->request.b_request = VLC_FALSE;
return p_playlist->pp_items[i_new]; return p_playlist->pp_items[i_new];
} }
/* Start the real work */ /* Start the real work */
if( p_playlist->request.b_request ) if( p_playlist->request.b_request )
...@@ -911,6 +910,9 @@ static playlist_item_t * NextItem( playlist_t *p_playlist ) ...@@ -911,6 +910,9 @@ static playlist_item_t * NextItem( playlist_t *p_playlist )
{ {
if( b_loop ) if( b_loop )
{ {
#ifdef PLAYLIST_DEBUG
msg_Dbg( p_playlist, "looping" );
#endif
p_new = playlist_FindNextFromParent( p_playlist, p_new = playlist_FindNextFromParent( p_playlist,
p_playlist->request.i_view, p_playlist->request.i_view,
p_view->p_root, p_view->p_root,
...@@ -949,6 +951,9 @@ static playlist_item_t * NextItem( playlist_t *p_playlist ) ...@@ -949,6 +951,9 @@ static playlist_item_t * NextItem( playlist_t *p_playlist )
if( p_playlist->status.i_view == -1 ) if( p_playlist->status.i_view == -1 )
{ {
#ifdef PLAYLIST_DEBUG
msg_Dbg( p_playlist,"no request - old mode" );
#endif
if( p_playlist->i_index + 1 < p_playlist->i_size ) if( p_playlist->i_index + 1 < p_playlist->i_size )
{ {
p_playlist->i_index++; p_playlist->i_index++;
...@@ -972,6 +977,9 @@ static playlist_item_t * NextItem( playlist_t *p_playlist ) ...@@ -972,6 +977,9 @@ static playlist_item_t * NextItem( playlist_t *p_playlist )
/* We are playing with a view */ /* We are playing with a view */
else else
{ {
#ifdef PLAYLIST_DEBUG
msg_Dbg( p_playlist,"no request - from a view" );
#endif
playlist_view_t *p_view = playlist_view_t *p_view =
playlist_ViewFind( p_playlist, playlist_ViewFind( p_playlist,
p_playlist->status.i_view ); p_playlist->status.i_view );
...@@ -988,6 +996,9 @@ static playlist_item_t * NextItem( playlist_t *p_playlist ) ...@@ -988,6 +996,9 @@ static playlist_item_t * NextItem( playlist_t *p_playlist )
p_playlist->status.p_item ); p_playlist->status.p_item );
if( p_new == NULL && b_loop ) if( p_new == NULL && b_loop )
{ {
#ifdef PLAYLIST_DEBUG
msg_Dbg( p_playlist, "looping" );
#endif
p_new = playlist_FindNextFromParent( p_playlist, p_new = playlist_FindNextFromParent( p_playlist,
p_playlist->status.i_view, p_playlist->status.i_view,
p_view->p_root, p_view->p_root,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment