sout_EncoderCreate: create an encoder module
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Mon, 19 Jan 2009 19:14:37 +0000 (21:14 +0200)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Mon, 19 Jan 2009 19:14:37 +0000 (21:14 +0200)
Perhaps we should turn it into ...New() and do more than just allocate
the object.

include/vlc_sout.h
modules/stream_out/transcode.c
src/misc/image.c
src/stream_output/stream_output.c

index d441a06..f74fe9f 100644 (file)
@@ -238,6 +238,13 @@ static inline int sout_StreamIdSend( sout_stream_t *s, sout_stream_id_t *id, blo
     return s->pf_send( s, id, b );
 }
 
+/****************************************************************************
+ * Encoder
+ ****************************************************************************/
+
+VLC_EXPORT( encoder_t *, sout_EncoderCreate, ( vlc_object_t *obj ) );
+#define sout_EncoderCreate(o) sout_EncoderCreate(VLC_OBJECT(o))
+
 /****************************************************************************
  * Announce handler
  ****************************************************************************/
index 90dc281..276e0d5 100644 (file)
@@ -711,7 +711,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
     id->p_decoder->b_pace_control = true;
 
     /* Create encoder object */
-    id->p_encoder = vlc_object_create( p_stream, VLC_OBJECT_ENCODER );
+    id->p_encoder = sout_EncoderCreate( p_stream );
     if( !id->p_encoder )
         goto error;
     vlc_object_attach( id->p_encoder, p_stream );
index acee3b8..2b45d25 100644 (file)
@@ -45,6 +45,7 @@
 #include <vlc_image.h>
 #include <vlc_stream.h>
 #include <vlc_charset.h>
+#include <vlc_sout.h>
 #include <libvlc.h>
 
 static picture_t *ImageRead( image_handler_t *, block_t *,
@@ -656,7 +657,7 @@ static encoder_t *CreateEncoder( vlc_object_t *p_this, video_format_t *fmt_in,
 {
     encoder_t *p_enc;
 
-    p_enc = vlc_object_create( p_this, VLC_OBJECT_ENCODER );
+    p_enc = sout_EncoderCreate( p_this );
     if( p_enc == NULL )
         return NULL;
 
index 3f81d26..5777fbd 100644 (file)
@@ -43,6 +43,7 @@
 
 #include <vlc_meta.h>
 #include <vlc_block.h>
+#include <vlc_codec.h>
 
 #include "input/input_interface.h"
 
@@ -874,3 +875,11 @@ rtp:
     mrl_Clean( &mrl );
     return psz_chain;
 }
+
+#undef sout_EncoderCreate
+encoder_t *sout_EncoderCreate( vlc_object_t *p_this )
+{
+    static const char type[] = "encoder";
+    return vlc_custom_create( p_this, sizeof( encoder_t ), VLC_OBJECT_GENERIC,
+                              type );
+}