[vlc-devel] commit: avcodec: set codec_id and codec_type in context also ( Ilkka Ollakka )

git version control git at videolan.org
Wed Sep 23 16:12:27 CEST 2009


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Wed Sep 23 14:34:32 2009 +0300| [2186305af6486e7fe074ce0b88af04738b2495ba] | committer: Ilkka Ollakka 

avcodec: set codec_id and codec_type in context also

it's checked to match from r19973 on libavcodec

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

 modules/codec/avcodec/audio.c   |    3 +++
 modules/codec/avcodec/encoder.c |    4 ++++
 modules/codec/avcodec/video.c   |    3 +++
 3 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
index 5e316b0..f1c52ed 100644
--- a/modules/codec/avcodec/audio.c
+++ b/modules/codec/avcodec/audio.c
@@ -96,6 +96,9 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
         return VLC_ENOMEM;
     }
 
+    p_codec->type = CODEC_TYPE_AUDIO;
+    p_context->codec_type = CODEC_TYPE_AUDIO;
+    p_context->codec_id = i_codec_id;
     p_sys->p_context = p_context;
     p_sys->p_codec = p_codec;
     p_sys->i_codec_id = i_codec_id;
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index 42c1e9d..ca98cc3 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -279,6 +279,7 @@ int OpenEncoder( vlc_object_t *p_this )
     p_sys->i_buffer_out = 0;
 
     p_sys->p_context = p_context = avcodec_alloc_context();
+    p_sys->p_context->codec_id = p_sys->p_codec->id;
     p_context->debug = config_GetInt( p_enc, "ffmpeg-debug" );
     p_context->opaque = (void *)p_this;
 
@@ -426,6 +427,8 @@ int OpenEncoder( vlc_object_t *p_this )
             return VLC_EGENERIC;
         }
 
+        p_context->codec_type = CODEC_TYPE_VIDEO;
+
         p_context->width = p_enc->fmt_in.video.i_width;
         p_context->height = p_enc->fmt_in.video.i_height;
 
@@ -584,6 +587,7 @@ int OpenEncoder( vlc_object_t *p_this )
         if( i_codec_id == CODEC_ID_MP3 && p_enc->fmt_in.audio.i_channels > 2 )
             p_enc->fmt_in.audio.i_channels = 2;
 
+        p_context->codec_type = CODEC_TYPE_AUDIO;
         p_enc->fmt_in.i_codec  = VLC_CODEC_S16N;
         p_context->sample_rate = p_enc->fmt_out.audio.i_rate;
         p_context->channels    = p_enc->fmt_out.audio.i_channels;
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 69d8f90..ea37291 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -196,6 +196,9 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
     if( ( p_dec->p_sys = p_sys = calloc( 1, sizeof(decoder_sys_t) ) ) == NULL )
         return VLC_ENOMEM;
 
+    p_codec->type = CODEC_TYPE_VIDEO;
+    p_context->codec_type = CODEC_TYPE_VIDEO;
+    p_context->codec_id = i_codec_id;
     p_sys->p_context = p_context;
     p_sys->p_codec = p_codec;
     p_sys->i_codec_id = i_codec_id;




More information about the vlc-devel mailing list