]> git.sesse.net Git - vlc/commitdiff
Restore loop
authorClément Stenac <zorglub@videolan.org>
Tue, 14 Dec 2004 19:29:50 +0000 (19:29 +0000)
committerClément Stenac <zorglub@videolan.org>
Tue, 14 Dec 2004 19:29:50 +0000 (19:29 +0000)
Fix command line parsing

src/misc/configuration.c
src/playlist/playlist.c

index 3c4787454aa384d116d1f5e24240edeb211dec7e..d87f2a23590c154babb8a2803599f5084a8bb58c 100644 (file)
@@ -212,6 +212,7 @@ char * __config_GetPsz( vlc_object_t *p_this, const char *psz_name )
         return NULL;
     }
 
+
     /* return a copy of the string */
     vlc_mutex_lock( p_config->p_lock );
     if( p_config->psz_value ) psz_value = strdup( p_config->psz_value );
@@ -235,6 +236,7 @@ void __config_PutPsz( vlc_object_t *p_this,
 
     p_config = config_FindConfig( p_this, psz_name );
 
+
     /* sanity checks */
     if( !p_config )
     {
@@ -245,6 +247,7 @@ void __config_PutPsz( vlc_object_t *p_this,
         (p_config->i_type!=CONFIG_ITEM_FILE) &&
         (p_config->i_type!=CONFIG_ITEM_DIRECTORY) &&
         (p_config->i_type!=CONFIG_ITEM_MODULE_LIST) &&
+        (p_config->i_type!=CONFIG_ITEM_MODULE_CAT) &&
         (p_config->i_type!=CONFIG_ITEM_MODULE_LIST_CAT) &&
         (p_config->i_type!=CONFIG_ITEM_MODULE) )
     {
@@ -1444,6 +1447,9 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[],
             case CONFIG_ITEM_FILE:
             case CONFIG_ITEM_DIRECTORY:
             case CONFIG_ITEM_MODULE:
+            case CONFIG_ITEM_MODULE_LIST:
+            case CONFIG_ITEM_MODULE_LIST_CAT:
+            case CONFIG_ITEM_MODULE_CAT:
                 config_PutPsz( p_this, psz_name, optarg );
                 break;
             case CONFIG_ITEM_INTEGER:
@@ -1472,6 +1478,9 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[],
             case CONFIG_ITEM_FILE:
             case CONFIG_ITEM_DIRECTORY:
             case CONFIG_ITEM_MODULE:
+            case CONFIG_ITEM_MODULE_CAT:
+            case CONFIG_ITEM_MODULE_LIST:
+            case CONFIG_ITEM_MODULE_LIST_CAT:
                 config_PutPsz( p_this, pp_shortopts[i_cmd]->psz_name, optarg );
                 break;
             case CONFIG_ITEM_INTEGER:
index 642f019517f7ba6fc0e28ac4aa1d21ec4cca8231..045b71652980681e47a2be90a72d1e8127373df3 100644 (file)
@@ -870,7 +870,22 @@ static playlist_item_t * NextItem( playlist_t *p_playlist )
                                     p_view->p_root,
                                     p_playlist->request.p_node,
                                     p_new );
-                    if( p_new == NULL ) break;
+                    if( p_new == NULL )
+                    {
+                        if( b_loop )
+                        {
+                            p_new = playlist_FindNextFromParent( p_playlist,
+                                      p_playlist->request.i_view,
+                                      p_view->p_root,
+                                      p_playlist->request.p_node,
+                                      NULL );
+                            if( p_new == NULL ) break;
+                        }
+                        else
+                        {
+                            break;
+                        }
+                    }
                 }
             }
             else if( i_skip < 0 )
@@ -909,7 +924,13 @@ static playlist_item_t * NextItem( playlist_t *p_playlist )
             else
             {
                 msg_Dbg( p_playlist,"finished" );
-                p_new = NULL;
+                if( b_loop && p_playlist->i_size > 0)
+                {
+                    p_playlist->i_index = 0;
+                    p_new = p_playlist->pp_items[0];
+                }
+                else
+                    p_new = NULL;
             }
         }
         /* We are playing with a view */
@@ -923,6 +944,14 @@ static playlist_item_t * NextItem( playlist_t *p_playlist )
                             p_view->p_root,
                             p_playlist->status.p_node,
                             p_playlist->status.p_item );
+            if( p_new == NULL && b_loop )
+            {
+                p_new = playlist_FindNextFromParent( p_playlist,
+                                   p_playlist->status.i_view,
+                                   p_view->p_root,
+                                   p_playlist->status.p_node,
+                                   NULL );
+            }
         }
     }
 
@@ -938,8 +967,10 @@ static playlist_item_t * NextItem( playlist_t *p_playlist )
     msg_Dbg(p_playlist,"next item found in "I64Fi " us", mdate()-start );
 #endif
 
-    if( p_new == NULL ) { msg_Info( p_playlist, "Nothing to play" ); }
-
+    if( p_new == NULL )
+    {
+        msg_Info( p_playlist, "Nothing to play" );
+    }
     return p_new;
 }