]> git.sesse.net Git - vlc/blobdiff - modules/demux/mpeg/mpga.c
Demuxers: do not load "meta reader" module if the input item has already been preparsed.
[vlc] / modules / demux / mpeg / mpga.c
index 6e0b565659b54381ade3bc6c4693c2bfed2b901f..2d2400ef12c1cae5555d7020955c959773b33364 100644 (file)
@@ -255,19 +255,31 @@ static int Open( vlc_object_t * p_this )
     p_sys->p_block_out = p_block_out;
 
     /* Parse possible id3 header */
-    p_demux->p_private = malloc( sizeof( demux_meta_t ) );
-    if( !p_demux->p_private )
-        return VLC_ENOMEM;
-    if( ( p_id3 = module_Need( p_demux, "meta reader", NULL, 0 ) ) )
+    input_thread_t *p_input = (input_thread_t *)
+            vlc_object_find( p_demux, VLC_OBJECT_INPUT, FIND_PARENT );
+    if( p_input )
     {
-        demux_meta_t *p_demux_meta = (demux_meta_t *)p_demux->p_private;
-        p_sys->meta = p_demux_meta->p_meta;
-        p_demux->p_private = NULL;
-        module_Unneed( p_demux, p_id3 );
-        p_sys->i_attachments = p_demux_meta->i_attachments;
-        p_sys->attachments = p_demux_meta->attachments;
+        if( !( input_GetItem( p_input )->p_meta->i_status & ITEM_PREPARSED ) )
+        {
+            p_demux->p_private = malloc( sizeof( demux_meta_t ) );
+            if( !p_demux->p_private )
+            {
+                vlc_object_release( p_input );
+                return VLC_ENOMEM;
+            }
+            if( ( p_id3 = module_Need( p_demux, "meta reader", NULL, 0 ) ) )
+            {
+                demux_meta_t *p_demux_meta = (demux_meta_t *)p_demux->p_private;
+                p_sys->meta = p_demux_meta->p_meta;
+                p_demux->p_private = NULL;
+                module_Unneed( p_demux, p_id3 );
+                p_sys->i_attachments = p_demux_meta->i_attachments;
+                p_sys->attachments = p_demux_meta->attachments;
+            }
+            free( p_demux->p_private );
+        }
+        vlc_object_release( p_input );
     }
-    free( p_demux->p_private );
 
     /* */
     p_sys->p_packetizer->fmt_out.b_packetized = VLC_TRUE;