]> git.sesse.net Git - vlc/commitdiff
* all: changed the prototype of sout_InputNew.
authorLaurent Aimar <fenrir@videolan.org>
Sun, 22 Feb 2004 16:08:47 +0000 (16:08 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Sun, 22 Feb 2004 16:08:47 +0000 (16:08 +0000)
include/stream_output.h
src/input/input_dec.c
src/stream_output/stream_output.c

index cfedad98452a8d1fccce0099abc3263e2d310008..dc0c894884316bca3469677d14dcadaa6d5eb42c 100644 (file)
@@ -2,7 +2,7 @@
  * stream_output.h : stream output module
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: stream_output.h,v 1.20 2004/01/25 18:17:08 zorglub Exp $
+ * $Id: stream_output.h,v 1.21 2004/02/22 16:08:47 fenrir Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Laurent Aimar <fenrir@via.ecp.fr>
@@ -282,8 +282,7 @@ VLC_EXPORT( sout_buffer_t *, sout_FifoGet,        ( sout_fifo_t * ) );
 VLC_EXPORT( sout_buffer_t *, sout_FifoShow,       ( sout_fifo_t * ) );
 
 
-#define sout_InputNew( a, b ) __sout_InputNew( VLC_OBJECT(a), b )
-VLC_EXPORT( sout_packetizer_input_t *, __sout_InputNew,       ( vlc_object_t *, es_format_t * ) );
+VLC_EXPORT( sout_packetizer_input_t *, sout_InputNew,( sout_instance_t *, es_format_t * ) );
 VLC_EXPORT( int,            sout_InputDelete,      ( sout_packetizer_input_t * ) );
 VLC_EXPORT( int,            sout_InputSendBuffer,  ( sout_packetizer_input_t *, sout_buffer_t* ) );
 
index c42053d9a3843acc7c0757812af18b873ca973d2..e6f42f03306842122d78595a3c5db386110b4f48 100644 (file)
@@ -2,7 +2,7 @@
  * input_dec.c: Functions for the management of decoders
  *****************************************************************************
  * Copyright (C) 1999-2004 VideoLAN
- * $Id: input_dec.c,v 1.89 2004/01/30 17:49:21 fenrir Exp $
+ * $Id: input_dec.c,v 1.90 2004/02/22 16:08:47 fenrir Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Gildas Bazin <gbazin@netcourrier.com>
@@ -66,7 +66,8 @@ struct decoder_owner_sys_t
 
     vout_thread_t   *p_vout;
 
-    sout_packetizer_input_t *p_sout;
+    sout_instance_t         *p_sout;
+    sout_packetizer_input_t *p_sout_input;
 
     /* Current format in use by the output */
     video_format_t video;
@@ -482,7 +483,8 @@ static decoder_t * CreateDecoder( input_thread_t * p_input,
     p_dec->p_owner->p_aout = NULL;
     p_dec->p_owner->p_aout_input = NULL;
     p_dec->p_owner->p_vout = NULL;
-    p_dec->p_owner->p_sout = NULL;
+    p_dec->p_owner->p_sout = p_input->stream.p_sout;
+    p_dec->p_owner->p_sout_input = NULL;
     p_dec->p_owner->p_es_descriptor = p_es;
     /* decoder fifo */
     if( ( p_dec->p_owner->p_fifo = block_FifoNew( p_dec ) ) == NULL )
@@ -573,7 +575,7 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
 
         while( (p_sout_block = p_dec->pf_packetize( p_dec, &p_block )) )
         {
-            if( !p_dec->p_owner->p_sout )
+            if( !p_dec->p_owner->p_sout_input )
             {
                 es_format_Copy( &p_dec->p_owner->sout, &p_dec->fmt_out );
                 if( p_dec->p_owner->p_es_descriptor->p_pgrm )
@@ -587,10 +589,10 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
                     p_dec->p_owner->sout.psz_language = strdup( p_dec->fmt_in.psz_language );
                 }
 
-                p_dec->p_owner->p_sout =
-                    sout_InputNew( p_dec, &p_dec->p_owner->sout );
+                p_dec->p_owner->p_sout_input =
+                    sout_InputNew( p_dec->p_owner->p_sout, &p_dec->p_owner->sout );
 
-                if( p_dec->p_owner->p_sout == NULL )
+                if( p_dec->p_owner->p_sout_input == NULL )
                 {
                     msg_Err( p_dec, "cannot create packetizer output" );
                     p_dec->b_error = VLC_TRUE;
@@ -611,7 +613,7 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
                 sout_buffer_t *p_sout_buffer;
 
                 p_sout_buffer =
-                    sout_BufferNew( p_dec->p_owner->p_sout->p_sout,
+                    sout_BufferNew( p_dec->p_owner->p_sout_input->p_sout,
                                     p_sout_block->i_buffer );
                 if( p_sout_buffer == NULL )
                 {
@@ -628,7 +630,7 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
 
                 block_Release( p_sout_block );
 
-                sout_InputSendBuffer( p_dec->p_owner->p_sout, p_sout_buffer );
+                sout_InputSendBuffer( p_dec->p_owner->p_sout_input, p_sout_buffer );
 
                 p_sout_block = p_next;
             }
@@ -710,9 +712,9 @@ static void DeleteDecoder( decoder_t * p_dec )
         vout_Request( p_dec, p_dec->p_owner->p_vout, 0, 0, 0, 0 );
     }
 
-    if( p_dec->p_owner->p_sout )
+    if( p_dec->p_owner->p_sout_input )
     {
-        sout_InputDelete( p_dec->p_owner->p_sout );
+        sout_InputDelete( p_dec->p_owner->p_sout_input );
         if( p_dec->p_owner->sout.i_extra ) free(p_dec->p_owner->sout.p_extra);
     }
 
index 82a2ae12939dcda5d2e50df07959df6dc30953cf..650764e839650ba3fc3ca59828b1bc38deda6f42 100644 (file)
@@ -2,7 +2,7 @@
  * stream_output.c : stream output module
  *****************************************************************************
  * Copyright (C) 2002-2004 VideoLAN
- * $Id: stream_output.c,v 1.39 2004/01/27 14:05:33 gbazin Exp $
+ * $Id: stream_output.c,v 1.40 2004/02/22 16:08:47 fenrir Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Laurent Aimar <fenrir@via.ecp.fr>
@@ -174,20 +174,11 @@ void sout_DeleteInstance( sout_instance_t * p_sout )
 /*****************************************************************************
  * Packetizer/Input
  *****************************************************************************/
-sout_packetizer_input_t *__sout_InputNew( vlc_object_t  *p_this,
-                                          es_format_t *p_fmt )
+sout_packetizer_input_t *sout_InputNew( sout_instance_t *p_sout,
+                                        es_format_t *p_fmt )
 {
-    sout_instance_t         *p_sout = NULL;
     sout_packetizer_input_t *p_input;
 
-    /* search an stream output */
-    if( !( p_sout = vlc_object_find( p_this, VLC_OBJECT_SOUT, FIND_ANYWHERE ) ) )
-    {
-        /* can't happen ... */
-        msg_Err( p_this, "cannot find any stream ouput" );
-        return NULL;
-    }
-
     msg_Dbg( p_sout, "adding a new input" );
 
     /* *** create a packetizer input *** */
@@ -203,16 +194,13 @@ sout_packetizer_input_t *__sout_InputNew( vlc_object_t  *p_this,
 
     /* *** add it to the stream chain */
     vlc_mutex_lock( &p_sout->lock );
-    p_input->id = p_sout->p_stream->pf_add( p_sout->p_stream,
-                                            p_fmt );
+    p_input->id = p_sout->p_stream->pf_add( p_sout->p_stream, p_fmt );
     vlc_mutex_unlock( &p_sout->lock );
 
-    vlc_object_release( p_sout );
-
     if( p_input->id == NULL )
     {
         free( p_input );
-        return( NULL );
+        return NULL;
     }
 
     return( p_input );