]> git.sesse.net Git - vlc/commitdiff
demux playlist: Move the usage of vlc_object_find behind one function.
authorPierre d'Herbemont <pdherbemont@free.fr>
Fri, 21 Aug 2009 00:58:46 +0000 (02:58 +0200)
committerPierre d'Herbemont <pdherbemont@free.fr>
Fri, 21 Aug 2009 00:58:46 +0000 (02:58 +0200)
18 files changed:
modules/demux/playlist/asx.c
modules/demux/playlist/b4s.c
modules/demux/playlist/dvb.c
modules/demux/playlist/gvp.c
modules/demux/playlist/ifo.c
modules/demux/playlist/itml.c
modules/demux/playlist/m3u.c
modules/demux/playlist/playlist.c
modules/demux/playlist/playlist.h
modules/demux/playlist/pls.c
modules/demux/playlist/podcast.c
modules/demux/playlist/qtl.c
modules/demux/playlist/ram.c
modules/demux/playlist/sgimb.c
modules/demux/playlist/shoutcast.c
modules/demux/playlist/wpl.c
modules/demux/playlist/xspf.c
modules/demux/playlist/zpl.c

index 56e9f07166b7eee772b2a3914fe8f1aa00b4e554..4c79604fe7ff469ce37152ec09de0a0166a85b93 100644 (file)
@@ -234,7 +234,7 @@ static int Demux( demux_t *p_demux )
     char        *psz_parse = NULL;
     char        *psz_backup = NULL;
     bool  b_entry = false;
-    INIT_PLAYLIST_STUFF;
+    input_item_t *p_current_input = GetCurrentItem(p_demux);
 
     /* init txt */
     if( p_sys->i_data_len < 0 )
@@ -710,7 +710,7 @@ static int Demux( demux_t *p_demux )
             STARTMARK
 #endif
     }
-    HANDLE_PLAY_AND_RELEASE;
+    vlc_gc_decref(p_current_input);
     return 0; /* Needed for correct operation of go back */
 }
 
index acf5d9be0e9bb4feeade774000039dc11c38d5ca..fdd69d2bb48331fde6c0fa80b6c8e8d74f2b10b0 100644 (file)
@@ -91,7 +91,7 @@ static int Demux( demux_t *p_demux )
     char *psz_mrl = NULL, *psz_name = NULL, *psz_genre = NULL;
     char *psz_now = NULL, *psz_listeners = NULL, *psz_bitrate = NULL;
 
-    INIT_PLAYLIST_STUFF;
+    input_item_t *p_current_input = GetCurrentItem(p_demux);
 
     p_xml = p_sys->p_xml = xml_Create( p_demux );
     if( !p_xml ) return -1;
@@ -295,7 +295,7 @@ static int Demux( demux_t *p_demux )
 
    free( psz_elname );
 
-    HANDLE_PLAY_AND_RELEASE;
+    vlc_gc_decref(p_current_input);
     return 0; /* Needed for correct operation of go back */
 }
 
index 7c36a796f23eace157e9f88c8fe280341f52562a..9698689507477b81113f3c23828828f292c0db4e 100644 (file)
@@ -101,7 +101,7 @@ static int Demux( demux_t *p_demux )
 {
     char       *psz_line;
     input_item_t *p_input;
-    INIT_PLAYLIST_STUFF;
+    input_item_t *p_current_input = GetCurrentItem(p_demux);
 
     while( (psz_line = stream_ReadLine( p_demux->s )) )
     {
@@ -131,7 +131,7 @@ static int Demux( demux_t *p_demux )
         free( psz_line );
     }
 
-    HANDLE_PLAY_AND_RELEASE;
+    vlc_gc_decref(p_current_input);
     return 0; /* Needed for correct operation of go back */
 }
 
index e06b3114ebe59e66259ae2661289eef20a5ad9b0..59299d738b6e755df94acf3cb8f02746791ff4a8 100644 (file)
@@ -129,7 +129,7 @@ static int Demux( demux_t *p_demux )
     char *psz_description = NULL;
     input_item_t *p_input;
 
-    INIT_PLAYLIST_STUFF;
+    input_item_t *p_current_input = GetCurrentItem(p_demux);
 
     p_sys->p_current_input = p_current_input;
 
@@ -212,7 +212,7 @@ static int Demux( demux_t *p_demux )
         vlc_gc_decref( p_input );
     }
 
-    HANDLE_PLAY_AND_RELEASE;
+    vlc_gc_decref(p_current_input);
 
     free( psz_version );
     free( psz_url );
index a4ede1f6d809d20d7fd1f37fc97246da9367330f..6923a523a2d4070ad0578a1ecd6bcae78fa67e16 100644 (file)
@@ -88,7 +88,7 @@ static int Demux( demux_t *p_demux )
     size_t len = 0;
     input_item_t *p_input;
 
-    INIT_PLAYLIST_STUFF;
+    input_item_t *p_current_input = GetCurrentItem(p_demux);
 
     len = strlen( "dvd://" ) + strlen( p_demux->psz_path )
           - strlen( "VIDEO_TS.IFO" );
@@ -99,7 +99,7 @@ static int Demux( demux_t *p_demux )
     input_item_AddSubItem( p_current_input, p_input );
     vlc_gc_decref( p_input );
 
-    HANDLE_PLAY_AND_RELEASE;
+    vlc_gc_decref(p_current_input);
 
     return 0; /* Needed for correct operation of go back */
 }
index 2d85d175fa08a32051f75a84c4316ec22606c5db..05c0fcefc6d532b22fdfd02e6f5a25880c172a42 100644 (file)
@@ -71,7 +71,7 @@ int Demux( demux_t *p_demux )
     xml_reader_t *p_xml_reader = NULL;
     char *psz_name = NULL;
 
-    INIT_PLAYLIST_STUFF;
+    input_item_t *p_current_input = GetCurrentItem(p_demux);
     p_demux->p_sys->i_ntracks = 0;
 
     /* create new xml parser from stream */
@@ -106,7 +106,7 @@ int Demux( demux_t *p_demux )
     parse_plist_node( p_demux, p_current_input, NULL, p_xml_reader, "plist",
                       pl_elements );
 
-    HANDLE_PLAY_AND_RELEASE;
+    vlc_gc_decref(p_current_input);
 
 end:
     free( psz_name );
index 9770b29a147e67ef207e9f6ee1d8bed577246727..c38d07659b27f8cd947fcc3c12076cad80b20e99 100644 (file)
@@ -148,7 +148,7 @@ static int Demux( demux_t *p_demux )
     bool b_cleanup = false;
     input_item_t *p_input;
 
-    INIT_PLAYLIST_STUFF;
+    input_item_t *p_current_input = GetCurrentItem(p_demux);
 
     psz_line = stream_ReadLine( p_demux->s );
     while( psz_line )
@@ -249,7 +249,7 @@ static int Demux( demux_t *p_demux )
             b_cleanup = false;
         }
     }
-    HANDLE_PLAY_AND_RELEASE;
+    vlc_gc_decref(p_current_input);
     var_Destroy( p_demux, "m3u-extvlcopt" );
     return 0; /* Needed for correct operation of go back */
 }
index b9731dae3b7e218074708994d36bc112d8bafcaf..45749be82df6bb2025d4e4107e946df0a54896ec 100644 (file)
@@ -165,6 +165,14 @@ vlc_module_begin ()
         set_callbacks( Import_ZPL, Close_ZPL )
 vlc_module_end ()
 
+input_item_t * GetCurrentItem(demux_t *p_demux)
+{
+    input_thread_t *p_input_thread = (input_thread_t *)vlc_object_find( p_demux, VLC_OBJECT_INPUT, FIND_PARENT );;
+    input_item_t *p_current_input = input_GetItem( p_input_thread );
+    vlc_gc_incref(p_current_input);
+    vlc_object_release(p_input_thread);
+    return p_current_input;
+}
 
 /**
  * Find directory part of the path to the playlist file, in case of
index f8eb377a12c2a81ddf7f432c82d66486f59a72f2..8b74778ac60b77b6187776146ac4ad53470ba622 100644 (file)
@@ -22,6 +22,7 @@
  *****************************************************************************/
 
 #include <vlc_input.h>
+#include <vlc_playlist.h>
 
 char *ProcessMRL( char *, char * );
 char *FindPrefix( demux_t * );
@@ -82,13 +83,7 @@ void Close_WPL ( vlc_object_t * );
 int Import_ZPL ( vlc_object_t * );
 void Close_ZPL ( vlc_object_t * );
 
-#define INIT_PLAYLIST_STUFF \
-    input_thread_t *p_input_thread = (input_thread_t *)vlc_object_find( p_demux, VLC_OBJECT_INPUT, FIND_PARENT ); \
-    input_item_t *p_current_input = input_GetItem( p_input_thread );
-
-#define HANDLE_PLAY_AND_RELEASE \
-    vlc_object_release( p_input_thread );
-
+extern input_item_t * GetCurrentItem(demux_t *p_demux);
 
 #define STANDARD_DEMUX_INIT_MSG( msg ) do { \
     DEMUX_INIT_COMMON();                    \
index 3c056b1b907eba970619e0febe7f8ef725dc76ae..c0427eb47ef4c3dad1ff601958cf5293a9ab080b 100644 (file)
@@ -91,7 +91,7 @@ static int Demux( demux_t *p_demux )
     int            i_key_length;
     input_item_t *p_input;
 
-    INIT_PLAYLIST_STUFF;
+    input_item_t *p_current_input = GetCurrentItem(p_demux);
 
     while( ( psz_line = stream_ReadLine( p_demux->s ) ) )
     {
@@ -228,7 +228,7 @@ static int Demux( demux_t *p_demux )
     free( psz_name );
     psz_name = NULL;
 
-    HANDLE_PLAY_AND_RELEASE;
+    vlc_gc_decref(p_current_input);
     return 0; /* Needed for correct operation of go back */
 }
 
index 774b3ef5a56278bacc4680f494d19fc7ace1dbc6..3c255e424af903b4fa1ba5799596af30ffb05b96 100644 (file)
@@ -91,7 +91,7 @@ static int Demux( demux_t *p_demux )
     int i_type;
     input_item_t *p_input;
 
-    INIT_PLAYLIST_STUFF;
+    input_item_t *p_current_input = GetCurrentItem(p_demux);
 
     p_xml = xml_Create( p_demux );
     if( !p_xml )
@@ -363,7 +363,7 @@ static int Demux( demux_t *p_demux )
     xml_ReaderDelete( p_xml, p_xml_reader );
     xml_Delete( p_xml );
 
-    HANDLE_PLAY_AND_RELEASE;
+    vlc_gc_decref(p_current_input);
     return 0; /* Needed for correct operation of go back */
 
 error:
@@ -386,7 +386,7 @@ error:
     if( p_xml )
         xml_Delete( p_xml );
 
-    HANDLE_PLAY_AND_RELEASE;
+    vlc_gc_decref(p_current_input);
     return -1;
 }
 
index cdd7becc8a3af92b1c1244372a71f768dfa378e6..51f5a5ebee72a0f67121de15894db16477b7dcf5 100644 (file)
@@ -124,7 +124,7 @@ static int Demux( demux_t *p_demux )
     char *psz_mimetype = NULL;
     int i_volume = 100;
 
-    INIT_PLAYLIST_STUFF;
+    input_item_t *p_current_input = GetCurrentItem(p_demux);
 
     p_xml = xml_Create( p_demux );
     if( !p_xml )
@@ -327,7 +327,7 @@ error:
     if( p_xml )
         xml_Delete( p_xml );
 
-    HANDLE_PLAY_AND_RELEASE;
+    vlc_gc_decref(p_current_input);
 
     free( psz_href );
     free( psz_moviename );
index fbcfe74f54ec66191ccdccdd105af28bc0448f69..9736b149327394ba5e517c4dcb8d545fb6cf1df4 100644 (file)
@@ -214,7 +214,7 @@ static int Demux( demux_t *p_demux )
     bool b_cleanup = false;
     input_item_t *p_input;
 
-    INIT_PLAYLIST_STUFF;
+    input_item_t *p_current_input = GetCurrentItem(p_demux);
 
     psz_line = stream_ReadLine( p_demux->s );
     while( psz_line )
@@ -360,7 +360,7 @@ static int Demux( demux_t *p_demux )
             b_cleanup = false;
         }
     }
-    HANDLE_PLAY_AND_RELEASE;
+    vlc_gc_decref(p_current_input);
     var_Destroy( p_demux, "m3u-extvlcopt" );
     return 0; /* Needed for correct operation of go back */
 }
index f2d83a3baa6f43bb039fc7aae1e8cb0e07a0ed2f..d0a32004857905aa14eb0c40e9d6b78dc2f387e4 100644 (file)
@@ -324,7 +324,7 @@ static int Demux ( demux_t *p_demux )
     input_item_t    *p_child = NULL;
     char            *psz_line;
 
-    INIT_PLAYLIST_STUFF;
+    input_item_t *p_current_input = GetCurrentItem(p_demux);
 
     while( ( psz_line = stream_ReadLine( p_demux->s ) ) )
     {
@@ -404,7 +404,7 @@ static int Demux ( demux_t *p_demux )
 
     input_item_AddSubItem( p_current_input, p_child );
     vlc_gc_decref( p_child );
-    HANDLE_PLAY_AND_RELEASE
+    vlc_gc_decref(p_current_input);
     return 0; /* Needed for correct operation of go back */
 }
 
index 484811584cf55bbf49193c807613bcab9fb1457e..01d004fba9ffb96caf91d1b647435c92c750e742 100644 (file)
@@ -83,7 +83,7 @@ static int Demux( demux_t *p_demux )
     xml_reader_t *p_xml_reader = NULL;
     char *psz_eltname = NULL;
     int i_ret = -1;
-    INIT_PLAYLIST_STUFF;
+    input_item_t *p_current_input = GetCurrentItem(p_demux);
 
     p_xml = xml_Create( p_demux );
     if( !p_xml )
@@ -132,7 +132,7 @@ error:
     if( p_xml )
         xml_Delete( p_xml );
     free( psz_eltname );
-    HANDLE_PLAY_AND_RELEASE;
+    vlc_gc_decref(p_current_input);
     return i_ret;
 }
 
index d2038cf6b752dc3910a056cf7fa7c2c14d214d7d..b84fdf4094626f7e75a668befba12dd77906d0bc 100644 (file)
@@ -93,7 +93,7 @@ static int Demux( demux_t *p_demux )
     char       *psz_parse;
     input_item_t *p_input;
 
-    INIT_PLAYLIST_STUFF;
+    input_item_t *p_current_input = GetCurrentItem(p_demux);
 
     psz_line = stream_ReadLine( p_demux->s );
     while( psz_line )
@@ -124,7 +124,7 @@ static int Demux( demux_t *p_demux )
         psz_line = stream_ReadLine( p_demux->s );
 
     }
-    HANDLE_PLAY_AND_RELEASE;
+    vlc_gc_decref(p_current_input);
     var_Destroy( p_demux, "wpl-extvlcopt" );
     return 0; /* Needed for correct operation of go back */
 }
index a35923e31cc06ca4ee82a879750c308d6d4861d3..9594c9d394f17edda8ebf7dc3195ee545c363035 100644 (file)
@@ -83,7 +83,7 @@ int Demux( demux_t *p_demux )
     xml_t *p_xml = NULL;
     xml_reader_t *p_xml_reader = NULL;
     char *psz_name = NULL;
-    INIT_PLAYLIST_STUFF;
+    input_item_t *p_current_input = GetCurrentItem(p_demux);
     p_demux->p_sys->pp_tracklist = NULL;
     p_demux->p_sys->i_tracklist_entries = 0;
     p_demux->p_sys->i_track_id = -1;
@@ -130,7 +130,7 @@ int Demux( demux_t *p_demux )
     }
 
 end:
-    HANDLE_PLAY_AND_RELEASE;
+    vlc_gc_decref(p_current_input);
     if( p_xml_reader )
         xml_ReaderDelete( p_xml, p_xml_reader );
     if( p_xml )
index 053d750dd732cb7b9837015fd704d8b39379aef7..6c843a7fca4f89bbcc811dc88e013ab70de4024f 100644 (file)
@@ -97,7 +97,7 @@ static int Demux( demux_t *p_demux )
          *psz_description = NULL, *psz_url = NULL,        *psz_copyright = NULL,
          *psz_mrl = NULL;
 
-    INIT_PLAYLIST_STUFF;
+    input_item_t *p_current_input = GetCurrentItem(p_demux);
 
     psz_line = stream_ReadLine( p_demux->s );
     char *psz_parse = psz_line;
@@ -212,7 +212,7 @@ static int Demux( demux_t *p_demux )
         psz_line = stream_ReadLine( p_demux->s );
     }
 
-    HANDLE_PLAY_AND_RELEASE;
+    vlc_gc_decref(p_current_input);
     var_Destroy( p_demux, "zpl-extvlcopt" );
     return 0; /* Needed for correct operation of go back */
 }