summaryrefslogtreecommitdiff
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-03-07 09:29:44 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-03-07 09:29:44 +0000
commit29301573aff1f13d20ac2d1108cb5302a1a95473 (patch)
tree310e865b5fc6916562412618bb5789e086554eb9 /libavcodec/utils.c
parent2d0aefd62608e1cc9a804bbd4eee68e0f10c5626 (diff)
add avcodec_get_context_defaults2() / avcodec_alloc_context2() which take CodecType as an additional parameter
also mark them as NOT part of the public API yet, so we can change their argument to CodecID if we decide to do so Originally committed as revision 8283 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 50ac861854..0e6efbde6e 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -731,12 +731,19 @@ static const AVOption options[]={
static AVClass av_codec_context_class = { "AVCodecContext", context_to_name, options };
-void avcodec_get_context_defaults(AVCodecContext *s){
+void avcodec_get_context_defaults2(AVCodecContext *s, enum CodecType codec_type){
+ int flags=0;
memset(s, 0, sizeof(AVCodecContext));
s->av_class= &av_codec_context_class;
- av_opt_set_defaults(s);
+ if(codec_type == CODEC_TYPE_AUDIO)
+ flags= AV_OPT_FLAG_AUDIO_PARAM;
+ else if(codec_type == CODEC_TYPE_VIDEO)
+ flags= AV_OPT_FLAG_VIDEO_PARAM;
+ else if(codec_type == CODEC_TYPE_SUBTITLE)
+ flags= AV_OPT_FLAG_SUBTITLE_PARAM;
+ av_opt_set_defaults2(s, flags, flags);
s->rc_eq= "tex^qComp";
s->time_base= (AVRational){0,1};
@@ -752,16 +759,24 @@ void avcodec_get_context_defaults(AVCodecContext *s){
s->reget_buffer= avcodec_default_reget_buffer;
}
-AVCodecContext *avcodec_alloc_context(void){
+AVCodecContext *avcodec_alloc_context2(enum CodecType codec_type){
AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
if(avctx==NULL) return NULL;
- avcodec_get_context_defaults(avctx);
+ avcodec_get_context_defaults2(avctx, codec_type);
return avctx;
}
+void avcodec_get_context_defaults(AVCodecContext *s){
+ avcodec_get_context_defaults2(s, CODEC_TYPE_UNKNOWN);
+}
+
+AVCodecContext *avcodec_alloc_context(void){
+ return avcodec_alloc_context2(CODEC_TYPE_UNKNOWN);
+}
+
void avcodec_get_frame_defaults(AVFrame *pic){
memset(pic, 0, sizeof(AVFrame));