comparison options.c @ 11560:8a4984c5cacc libavcodec

Define AVMediaType enum, and use it instead of enum CodecType, which is deprecated and will be dropped at the next major bump.
author stefano
date Tue, 30 Mar 2010 23:30:55 +0000
parents afe2ac7b175c
children 2baae9246958
comparison
equal deleted inserted replaced
11559:444f4b594fdb 11560:8a4984c5cacc
421 #undef D 421 #undef D
422 #undef DEFAULT 422 #undef DEFAULT
423 423
424 static const AVClass av_codec_context_class = { "AVCodecContext", context_to_name, options }; 424 static const AVClass av_codec_context_class = { "AVCodecContext", context_to_name, options };
425 425
426 void avcodec_get_context_defaults2(AVCodecContext *s, enum CodecType codec_type){ 426 void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType codec_type){
427 int flags=0; 427 int flags=0;
428 memset(s, 0, sizeof(AVCodecContext)); 428 memset(s, 0, sizeof(AVCodecContext));
429 429
430 s->av_class= &av_codec_context_class; 430 s->av_class= &av_codec_context_class;
431 431
432 s->codec_type = codec_type; 432 s->codec_type = codec_type;
433 if(codec_type == CODEC_TYPE_AUDIO) 433 if(codec_type == AVMEDIA_TYPE_AUDIO)
434 flags= AV_OPT_FLAG_AUDIO_PARAM; 434 flags= AV_OPT_FLAG_AUDIO_PARAM;
435 else if(codec_type == CODEC_TYPE_VIDEO) 435 else if(codec_type == AVMEDIA_TYPE_VIDEO)
436 flags= AV_OPT_FLAG_VIDEO_PARAM; 436 flags= AV_OPT_FLAG_VIDEO_PARAM;
437 else if(codec_type == CODEC_TYPE_SUBTITLE) 437 else if(codec_type == AVMEDIA_TYPE_SUBTITLE)
438 flags= AV_OPT_FLAG_SUBTITLE_PARAM; 438 flags= AV_OPT_FLAG_SUBTITLE_PARAM;
439 av_opt_set_defaults2(s, flags, flags); 439 av_opt_set_defaults2(s, flags, flags);
440 440
441 s->time_base= (AVRational){0,1}; 441 s->time_base= (AVRational){0,1};
442 s->get_buffer= avcodec_default_get_buffer; 442 s->get_buffer= avcodec_default_get_buffer;
451 s->palctrl = NULL; 451 s->palctrl = NULL;
452 s->reget_buffer= avcodec_default_reget_buffer; 452 s->reget_buffer= avcodec_default_reget_buffer;
453 s->reordered_opaque= AV_NOPTS_VALUE; 453 s->reordered_opaque= AV_NOPTS_VALUE;
454 } 454 }
455 455
456 AVCodecContext *avcodec_alloc_context2(enum CodecType codec_type){ 456 AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){
457 AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); 457 AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
458 458
459 if(avctx==NULL) return NULL; 459 if(avctx==NULL) return NULL;
460 460
461 avcodec_get_context_defaults2(avctx, codec_type); 461 avcodec_get_context_defaults2(avctx, codec_type);
462 462
463 return avctx; 463 return avctx;
464 } 464 }
465 465
466 void avcodec_get_context_defaults(AVCodecContext *s){ 466 void avcodec_get_context_defaults(AVCodecContext *s){
467 avcodec_get_context_defaults2(s, CODEC_TYPE_UNKNOWN); 467 avcodec_get_context_defaults2(s, AVMEDIA_TYPE_UNKNOWN);
468 } 468 }
469 469
470 AVCodecContext *avcodec_alloc_context(void){ 470 AVCodecContext *avcodec_alloc_context(void){
471 return avcodec_alloc_context2(CODEC_TYPE_UNKNOWN); 471 return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN);
472 } 472 }
473 473