[vlc-devel] commit: All decoders/encoders MUST set output format category (AUDIO/VIDEO/ SPU_ES) (Laurent Aimar )

git version control git at videolan.org
Sun Feb 15 00:44:15 CET 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Feb 14 19:57:15 2009 +0100| [7a0c49ac84488ca9c764e6f248a97958488804aa] | committer: Laurent Aimar 

All decoders/encoders MUST set output format category (AUDIO/VIDEO/SPU_ES)

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

 modules/codec/cc.c                |    3 +++
 modules/codec/cmml/cmml.c         |    3 +++
 modules/codec/csri.c              |    3 +++
 modules/codec/cvdsub.c            |    5 +++--
 modules/codec/dvbsub.c            |    3 ++-
 modules/codec/libass.c            |    3 +++
 modules/codec/libmpeg2.c          |    6 +++---
 modules/codec/quicktime.c         |    2 ++
 modules/codec/shine/shine_mod.c   |    4 ++--
 modules/codec/subtitles/subsdec.c |    5 +++--
 modules/codec/subtitles/subsusf.c |    2 ++
 modules/codec/subtitles/t140.c    |    1 +
 modules/codec/telx.c              |    6 +++---
 modules/codec/twolame.c           |    2 ++
 modules/codec/x264.c              |    1 +
 modules/codec/xvmc/xxmc.c         |    5 +++--
 16 files changed, 39 insertions(+), 15 deletions(-)

diff --git a/modules/codec/cc.c b/modules/codec/cc.c
index af47991..9895add 100644
--- a/modules/codec/cc.c
+++ b/modules/codec/cc.c
@@ -209,6 +209,9 @@ static int Open( vlc_object_t *p_this )
 
     Eia608Init( &p_sys->eia608 );
 
+    p_dec->fmt_out.i_cat = SPU_ES;
+    p_dec->fmt_out.i_codec = VLC_FOURCC('T','E','X','T');
+
     return VLC_SUCCESS;
 }
 
diff --git a/modules/codec/cmml/cmml.c b/modules/codec/cmml/cmml.c
index 36e3270..5be64f4 100644
--- a/modules/codec/cmml/cmml.c
+++ b/modules/codec/cmml/cmml.c
@@ -128,6 +128,9 @@ static int OpenDecoder( vlc_object_t *p_this )
     if( p_sys->p_intf )
         intf_RunThread( p_sys->p_intf );
 
+    p_dec->fmt_out.i_cat = SPU_ES;
+    p_dec->fmt_out.i_codec = 0;
+
     return VLC_SUCCESS;
 }
 
diff --git a/modules/codec/csri.c b/modules/codec/csri.c
index 8d3f9e3..3802f4a 100644
--- a/modules/codec/csri.c
+++ b/modules/codec/csri.c
@@ -130,6 +130,9 @@ static int Create( vlc_object_t *p_this )
                                                    p_dec->fmt_in.p_extra,
                                                    p_dec->fmt_in.p_extra ? strnlen( p_dec->fmt_in.p_extra, p_dec->fmt_in.i_extra ) : 0,
                                                    NULL);
+    p_dec->fmt_out.i_cat = SPU_ES;
+    p_dec->fmt_out.i_codec = VLC_FOURCC('R','G','B','A');
+
     return VLC_SUCCESS;
 }
 
diff --git a/modules/codec/cvdsub.c b/modules/codec/cvdsub.c
index b3e1456..dbd5916 100644
--- a/modules/codec/cvdsub.c
+++ b/modules/codec/cvdsub.c
@@ -125,11 +125,12 @@ static int DecoderOpen( vlc_object_t *p_this )
     p_sys->i_state = SUBTITLE_BLOCK_EMPTY;
     p_sys->p_spu   = NULL;
 
-    es_format_Init( &p_dec->fmt_out, SPU_ES, VLC_FOURCC( 'c','v','d',' ' ) );
-
     p_dec->pf_decode_sub = Decode;
     p_dec->pf_packetize  = Packetize;
 
+    p_dec->fmt_out.i_cat = SPU_ES;
+    p_dec->fmt_out.i_codec = VLC_FOURCC('Y','U','V','P');
+
     return VLC_SUCCESS;
 }
 
diff --git a/modules/codec/dvbsub.c b/modules/codec/dvbsub.c
index cc1fc4b..b102cd0 100644
--- a/modules/codec/dvbsub.c
+++ b/modules/codec/dvbsub.c
@@ -340,7 +340,8 @@ static int Open( vlc_object_t *p_this )
         p_sys->i_spu_y = i_posy;
     }
 
-    es_format_Init( &p_dec->fmt_out, SPU_ES, VLC_FOURCC( 'd','v','b','s' ) );
+    p_dec->fmt_out.i_cat = SPU_ES;
+    p_dec->fmt_out.i_codec = 0;
 
     default_clut_init( p_dec );
 
diff --git a/modules/codec/libass.c b/modules/codec/libass.c
index 4d1e35c..7e3cbf0 100644
--- a/modules/codec/libass.c
+++ b/modules/codec/libass.c
@@ -167,6 +167,9 @@ static int Create( vlc_object_t *p_this )
     ass_process_codec_private( p_track, p_dec->fmt_in.p_extra, p_dec->fmt_in.i_extra );
     vlc_mutex_unlock( &libass_lock );
 
+    p_dec->fmt_out.i_cat = SPU_ES;
+    p_dec->fmt_out.i_codec = VLC_FOURCC('R','G','B','A');
+
     return VLC_SUCCESS;
 }
 
diff --git a/modules/codec/libmpeg2.c b/modules/codec/libmpeg2.c
index 11dbb2f..4b6f282 100644
--- a/modules/codec/libmpeg2.c
+++ b/modules/codec/libmpeg2.c
@@ -129,12 +129,10 @@ static int OpenDecoder( vlc_object_t *p_this )
     }
 
     /* Allocate the memory needed to store the decoder's structure */
-    if( ( p_dec->p_sys = p_sys =
-          (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
+    if( ( p_dec->p_sys = p_sys = calloc( 1, sizeof(*p_sys)) ) == NULL )
         return VLC_ENOMEM;
 
     /* Initialize the thread properties */
-    memset( p_sys, 0, sizeof(decoder_sys_t) );
     p_sys->p_mpeg2dec = NULL;
     p_sys->p_synchro  = NULL;
     p_sys->p_info     = NULL;
@@ -200,6 +198,8 @@ static int OpenDecoder( vlc_object_t *p_this )
     p_sys->p_info = mpeg2_info( p_sys->p_mpeg2dec );
 
     p_dec->pf_decode_video = DecodeBlock;
+    p_dec->fmt_out.i_cat = VIDEO_ES;
+    p_dec->fmt_out.i_codec = 0;
 
     return VLC_SUCCESS;
 }
diff --git a/modules/codec/quicktime.c b/modules/codec/quicktime.c
index 9692208..fd75b64 100644
--- a/modules/codec/quicktime.c
+++ b/modules/codec/quicktime.c
@@ -265,6 +265,7 @@ static int Open( vlc_object_t *p_this )
 #ifdef LOADER
         p_dec->p_sys = NULL;
         p_dec->pf_decode_video = DecodeVideo;
+        p_dec->fmt_out.i_cat = VIDEO_ES;
         return VLC_SUCCESS;
 #else
         return OpenVideo( p_dec );
@@ -303,6 +304,7 @@ static int Open( vlc_object_t *p_this )
 #ifdef LOADER
         p_dec->p_sys = NULL;
         p_dec->pf_decode_audio = DecodeAudio;
+        p_dec->fmt_out.i_cat = AUDIO_ES;
         return VLC_SUCCESS;
 #else
 
diff --git a/modules/codec/shine/shine_mod.c b/modules/codec/shine/shine_mod.c
index 94de78e..ec460c5 100644
--- a/modules/codec/shine/shine_mod.c
+++ b/modules/codec/shine/shine_mod.c
@@ -96,10 +96,9 @@ static int OpenEncoder( vlc_object_t *p_this )
              p_enc->fmt_out.i_bitrate, p_enc->fmt_out.audio.i_rate,
              p_enc->fmt_out.audio.i_channels );
 
-    p_sys = p_enc->p_sys = malloc( sizeof( encoder_sys_t ) );
+    p_enc->p_sys = p_sys = calloc( 1, sizeof( *p_sys ) );
     if( !p_sys )
         return VLC_ENOMEM;
-    memset( p_sys, 0, sizeof( encoder_sys_t ) );
 
     if( !( p_sys->p_fifo = block_FifoNew() ) )
     {
@@ -111,6 +110,7 @@ static int OpenEncoder( vlc_object_t *p_this )
         p_enc->fmt_out.audio.i_channels, p_enc->fmt_out.i_bitrate / 1000 );
 
     p_enc->pf_encode_audio = EncodeFrame;
+    p_enc->fmt_out.i_cat = AUDIO_ES;
 
     return VLC_SUCCESS;
 }
diff --git a/modules/codec/subtitles/subsdec.c b/modules/codec/subtitles/subsdec.c
index 59c1f89..d7c6dd6 100644
--- a/modules/codec/subtitles/subsdec.c
+++ b/modules/codec/subtitles/subsdec.c
@@ -156,14 +156,15 @@ static int OpenDecoder( vlc_object_t *p_this )
     }
 
     p_dec->pf_decode_sub = DecodeBlock;
+    p_dec->fmt_out.i_cat = SPU_ES;
+    p_dec->fmt_out.i_codec = 0;
 
     /* Allocate the memory needed to store the decoder's structure */
-    p_dec->p_sys = p_sys = malloc( sizeof( *p_sys ) );
+    p_dec->p_sys = p_sys = calloc( 1, sizeof( *p_sys ) );
     if( p_sys == NULL )
         return VLC_ENOMEM;
 
     /* init of p_sys */
-    memset( p_sys, 0, sizeof( *p_sys ) );
     p_sys->i_align = 0;
     p_sys->iconv_handle = (vlc_iconv_t)-1;
     p_sys->b_autodetect_utf8 = false;
diff --git a/modules/codec/subtitles/subsusf.c b/modules/codec/subtitles/subsusf.c
index ab7756b..dfb0db2 100644
--- a/modules/codec/subtitles/subsusf.c
+++ b/modules/codec/subtitles/subsusf.c
@@ -76,6 +76,8 @@ static int OpenDecoder( vlc_object_t *p_this )
         return VLC_ENOMEM;
 
     p_dec->pf_decode_sub = DecodeBlock;
+    p_dec->fmt_out.i_cat = SPU_ES;
+    p_dec->fmt_out.i_codec = 0;
 
     /* Unused fields of p_sys - not needed for USF decoding */
     p_sys->b_ass = false;
diff --git a/modules/codec/subtitles/t140.c b/modules/codec/subtitles/t140.c
index 76ae1ef..5e0c25a 100644
--- a/modules/codec/subtitles/t140.c
+++ b/modules/codec/subtitles/t140.c
@@ -70,6 +70,7 @@ static int Open( vlc_object_t *p_this )
     p_enc->p_sys = NULL;
 
     p_enc->pf_encode_sub = Encode;
+    p_enc->fmt_out.i_cat = SPU_ES;
     return VLC_SUCCESS;
 }
 
diff --git a/modules/codec/telx.c b/modules/codec/telx.c
index 33b1fa3..07fd4cf 100644
--- a/modules/codec/telx.c
+++ b/modules/codec/telx.c
@@ -181,11 +181,11 @@ static int Open( vlc_object_t *p_this )
     }
 
     p_dec->pf_decode_sub = Decode;
-    p_sys = p_dec->p_sys = malloc( sizeof(decoder_sys_t) );
+    p_sys = p_dec->p_sys = calloc( 1, sizeof(*p_sys) );
     if( p_sys == NULL )
         return VLC_ENOMEM;
-
-    memset( p_sys, 0, sizeof(decoder_sys_t) );
+    p_dec->fmt_out.i_cat = SPU_ES;
+    p_dec->fmt_out.i_codec = 0;
 
     p_sys->i_align = 0;
     for ( i = 0; i < 9; i++ )
diff --git a/modules/codec/twolame.c b/modules/codec/twolame.c
index 8ce4fd2..787cbf8 100644
--- a/modules/codec/twolame.c
+++ b/modules/codec/twolame.c
@@ -165,6 +165,8 @@ static int OpenEncoder( vlc_object_t *p_this )
 
     p_enc->pf_encode_audio = Encode;
     p_enc->fmt_in.i_codec = AOUT_FMT_S16_NE;
+
+    p_enc->fmt_out.i_cat = AUDIO_ES;
     p_enc->fmt_out.i_codec = VLC_FOURCC('m','p','g','a');
 
     config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
diff --git a/modules/codec/x264.c b/modules/codec/x264.c
index 378fb79..b2ddf23 100644
--- a/modules/codec/x264.c
+++ b/modules/codec/x264.c
@@ -780,6 +780,7 @@ static int  Open ( vlc_object_t *p_this )
 
     config_ChainParse( p_enc, SOUT_CFG_PREFIX, ppsz_sout_options, p_enc->p_cfg );
 
+    p_enc->fmt_out.i_cat = VIDEO_ES;
     p_enc->fmt_out.i_codec = VLC_FOURCC( 'h', '2', '6', '4' );
     p_enc->fmt_in.i_codec = VLC_FOURCC('I','4','2','0');
 
diff --git a/modules/codec/xvmc/xxmc.c b/modules/codec/xvmc/xxmc.c
index e502780..efa6d5f 100644
--- a/modules/codec/xvmc/xxmc.c
+++ b/modules/codec/xvmc/xxmc.c
@@ -137,12 +137,11 @@ static int OpenDecoder( vlc_object_t *p_this )
     msg_Dbg(p_dec, "OpenDecoder Entering");
 
     /* Allocate the memory needed to store the decoder's structure */
-    p_dec->p_sys = p_sys = (decoder_sys_t *)malloc(sizeof(decoder_sys_t));
+    p_dec->p_sys = p_sys = calloc( 1, sizeof(*p_sys) );
     if( !p_sys )
         return VLC_ENOMEM;
 
     /* Initialize the thread properties */
-    memset( p_sys, 0, sizeof(decoder_sys_t) );
     p_sys->p_mpeg2dec = NULL;
     p_sys->p_synchro  = NULL;
     p_sys->p_info     = NULL;
@@ -199,6 +198,8 @@ static int OpenDecoder( vlc_object_t *p_this )
     p_sys->p_info = mpeg2_info( p_sys->p_mpeg2dec );
 
     p_dec->pf_decode_video = DecodeBlock;
+    p_dec->fmt_out.i_cat = VIDEO_ES;
+    p_dec->fmt_out.i_codec = 0;
 
     f_wd_dec = fopen("/vlc/dec_pid", "w");
     if (f_wd_dec != NULL)




More information about the vlc-devel mailing list