]> git.sesse.net Git - vlc/commitdiff
* luaplaylist.c, README.txt: add .duration option for playlist items. Should now...
authorAntoine Cellerier <dionoea@videolan.org>
Sat, 19 May 2007 14:57:16 +0000 (14:57 +0000)
committerAntoine Cellerier <dionoea@videolan.org>
Sat, 19 May 2007 14:57:16 +0000 (14:57 +0000)
* m3u.c: indentation fix.

modules/demux/playlist/luaplaylist.c
modules/demux/playlist/m3u.c
share/luaplaylist/README.txt

index d59f696f80c2a3d9449d37e8e9536c4a796dcf6d..ace088dfd24634b96de6f353c070c41bf5b7b301 100644 (file)
@@ -479,6 +479,7 @@ static int Demux( demux_t *p_demux )
                         const char  *psz_name     = NULL;
                         char       **ppsz_options = NULL;
                         int          i_options    = 0;
+                        mtime_t      i_duration   = -1;
 
                         /* Read path and name */
                         psz_path = lua_tostring( p_state, t+3 );
@@ -494,6 +495,15 @@ static int Demux( demux_t *p_demux )
                             psz_name = psz_path;
                         }
 
+                        /* Read duration */
+                        lua_getfield( p_state, t+2, "duration" );
+                        if( lua_isnumber( p_state, t+5 ) )
+                        {
+                            i_duration = (mtime_t)lua_tointeger( p_state, t+5 );
+                            i_duration *= 1000000;
+                        }
+                        lua_pop( p_state, 1 ); /* pop "duration" */
+
                         /* Read options */
                         lua_getfield( p_state, t+2, "options" );
                         if( lua_istable( p_state, t+5 ) )
@@ -524,7 +534,7 @@ static int Demux( demux_t *p_demux )
                         p_input = input_ItemNewExt( p_playlist, psz_path,
                                                     psz_name, i_options,
                                                     (const char **)ppsz_options,
-                                                    -1 );
+                                                    i_duration );
                         lua_pop( p_state, 1 ); /* pop "name" */
 
                         /* Read meta data */
index e5da243e312dbb15af1bd0a80480ce9e37b38770..354e1992c6e6f25983646c740b3fb669913e9439 100644 (file)
@@ -184,7 +184,7 @@ static int Demux( demux_t *p_demux )
                                         i_options, ppsz_options, i_duration );
             if ( psz_artist && *psz_artist )
                 input_ItemAddInfo( p_input, _(VLC_META_INFO_CAT),
-                                        _(VLC_META_ARTIST), "%s", psz_artist );
+                                   _(VLC_META_ARTIST), "%s", psz_artist );
             playlist_BothAddInput( p_playlist, p_input, p_item_in_category,
                                    PLAYLIST_APPEND | PLAYLIST_SPREPARSE,
                                    PLAYLIST_END, NULL, NULL, VLC_FALSE );
index 79e4b069ffd5837aa01d7533d61c015dd5e5ff8b..6156f2cb70fb74cb871ffb0abcf82c2b6b4e9c54 100644 (file)
@@ -30,6 +30,7 @@ VLC Lua playlist modules should define two functions:
                 .trackid: the item's TrackID (OPTIONAL, meta data)
                 .options: a list of VLC options (OPTIONAL)
                           example: .options = { "fullscreen" }
+                .duration: stream duration in seconds (OPTIONAL)
             Invalid playlist items will be discarded by VLC.
 
 VLC defines a global vlc object with the following members: