[vlc-devel] commit: sout_EncoderCreate: create an encoder module ( Rémi Denis-Courmont )

git version control git at videolan.org
Mon Jan 19 20:16:09 CET 2009


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Mon Jan 19 21:14:37 2009 +0200| [0d646a30d254f3583d624265fa2cc37589dfad15] | committer: Rémi Denis-Courmont 

sout_EncoderCreate: create an encoder module

Perhaps we should turn it into ...New() and do more than just allocate
the object.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0d646a30d254f3583d624265fa2cc37589dfad15
---

 include/vlc_sout.h                |    7 +++++++
 modules/stream_out/transcode.c    |    2 +-
 src/misc/image.c                  |    3 ++-
 src/stream_output/stream_output.c |    9 +++++++++
 4 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/include/vlc_sout.h b/include/vlc_sout.h
index d441a06..f74fe9f 100644
--- a/include/vlc_sout.h
+++ b/include/vlc_sout.h
@@ -239,6 +239,13 @@ static inline int sout_StreamIdSend( sout_stream_t *s, sout_stream_id_t *id, blo
 }
 
 /****************************************************************************
+ * Encoder
+ ****************************************************************************/
+
+VLC_EXPORT( encoder_t *, sout_EncoderCreate, ( vlc_object_t *obj ) );
+#define sout_EncoderCreate(o) sout_EncoderCreate(VLC_OBJECT(o))
+
+/****************************************************************************
  * Announce handler
  ****************************************************************************/
 VLC_EXPORT(session_descriptor_t*,sout_AnnounceRegisterSDP, ( vlc_object_t *, const char *, const char *, announce_method_t* ) );
diff --git a/modules/stream_out/transcode.c b/modules/stream_out/transcode.c
index 90dc281..276e0d5 100644
--- a/modules/stream_out/transcode.c
+++ b/modules/stream_out/transcode.c
@@ -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 );
diff --git a/src/misc/image.c b/src/misc/image.c
index acee3b8..2b45d25 100644
--- a/src/misc/image.c
+++ b/src/misc/image.c
@@ -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;
 
diff --git a/src/stream_output/stream_output.c b/src/stream_output/stream_output.c
index 3f81d26..5777fbd 100644
--- a/src/stream_output/stream_output.c
+++ b/src/stream_output/stream_output.c
@@ -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 );
+}




More information about the vlc-devel mailing list