History

lavc: make avcodec_get_context_defaults3 "officially" public

Deprecate avcodec_get_context_defaults/avcodec_get_context_defaults2

Anton Khirnov committed 15 years ago

Commit f0eeff71 parent 84ad31f3 files · +36 −24Browse files

Showing the changes to libavcodec (2 of 3 files). Show all

Unified · Split

2 files
  1. libavcodec/avcodec.h +14 −2
  2. libavcodec/options.c +20 −20
libavcodec/avcodec.h+14−2
@@ -3592,19 +3592,31 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); · 3591 unmodified lines
3592 */3592 */
3593const char *av_get_profile_name(const AVCodec *codec, int profile);3593const char *av_get_profile_name(const AVCodec *codec, int profile);
3594 3594
3595#if FF_API_ALLOC_CONTEXT
3595/**3596/**
3596 * Set the fields of the given AVCodecContext to default values.3597 * Set the fields of the given AVCodecContext to default values.
3597 *3598 *
3598 * @param s The AVCodecContext of which the fields should be set to default values.3599 * @param s The AVCodecContext of which the fields should be set to default values.
3600 * @deprecated use avcodec_get_context_defaults3
3599 */3601 */
3602attribute_deprecated
3600void avcodec_get_context_defaults(AVCodecContext *s);3603void avcodec_get_context_defaults(AVCodecContext *s);
3601 3604
3602/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!3605/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!
3603 * we WILL change its arguments and name a few times! */3606 * we WILL change its arguments and name a few times! */
3607attribute_deprecated
3604void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType);3608void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType);
3609#endif
3605 3610
3606/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!3611/**
3607 * we WILL change its arguments and name a few times! */3612 * Set the fields of the given AVCodecContext to default values corresponding
3613 * to the given codec (defaults may be codec-dependent).
3614 *
3615 * Do not call this function if a non-NULL codec has been passed
3616 * to avcodec_alloc_context3() that allocated this AVCodecContext.
3617 * If codec is non-NULL, it is illegal to call avcodec_open2() with a
3618 * different codec on this AVCodecContext.
3619 */
3608int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec);3620int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec);
3609 3621
3610#if FF_API_ALLOC_CONTEXT3622#if FF_API_ALLOC_CONTEXT
libavcodec/options.c+20−20
@@ -531,30 +531,32 @@ static const AVClass av_codec_context_class = { · 530 unmodified lines
531 .child_class_next = codec_child_class_next,531 .child_class_next = codec_child_class_next,
532};532};
533 533
534#if FF_API_ALLOC_CONTEXT
534void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType codec_type){535void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType codec_type){
536 avcodec_get_context_defaults3(s, NULL);
537}
538#endif
539
540int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec){
535 memset(s, 0, sizeof(AVCodecContext));541 memset(s, 0, sizeof(AVCodecContext));
536 542
537 s->av_class= &av_codec_context_class;543 s->av_class = &av_codec_context_class;
538 544
539 s->codec_type = codec_type;545 s->codec_type = codec ? codec->type : AVMEDIA_TYPE_UNKNOWN;
540 av_opt_set_defaults(s);546 av_opt_set_defaults(s);
541 547
542 s->time_base= (AVRational){0,1};548 s->time_base = (AVRational){0,1};
543 s->get_buffer= avcodec_default_get_buffer;549 s->get_buffer = avcodec_default_get_buffer;
544 s->release_buffer= avcodec_default_release_buffer;550 s->release_buffer = avcodec_default_release_buffer;
545 s->get_format= avcodec_default_get_format;551 s->get_format = avcodec_default_get_format;
546 s->execute= avcodec_default_execute;552 s->execute = avcodec_default_execute;
547 s->execute2= avcodec_default_execute2;553 s->execute2 = avcodec_default_execute2;
548 s->sample_aspect_ratio= (AVRational){0,1};554 s->sample_aspect_ratio = (AVRational){0,1};
549 s->pix_fmt= PIX_FMT_NONE;555 s->pix_fmt = PIX_FMT_NONE;
550 s->sample_fmt= AV_SAMPLE_FMT_NONE;556 s->sample_fmt = AV_SAMPLE_FMT_NONE;
551 557
552 s->reget_buffer= avcodec_default_reget_buffer;558 s->reget_buffer = avcodec_default_reget_buffer;
553 s->reordered_opaque= AV_NOPTS_VALUE;559 s->reordered_opaque = AV_NOPTS_VALUE;
554}
555
556int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec){
557 avcodec_get_context_defaults2(s, codec ? codec->type : AVMEDIA_TYPE_UNKNOWN);
558 if(codec && codec->priv_data_size){560 if(codec && codec->priv_data_size){
559 if(!s->priv_data){561 if(!s->priv_data){
560 s->priv_data= av_mallocz(codec->priv_data_size);562 s->priv_data= av_mallocz(codec->priv_data_size);
@@ -602,13 +604,11 @@ AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){ · 41 unmodified lines
602 604
603 return avctx;605 return avctx;
604}606}
605#endif
606 607
607void avcodec_get_context_defaults(AVCodecContext *s){608void avcodec_get_context_defaults(AVCodecContext *s){
608 avcodec_get_context_defaults2(s, AVMEDIA_TYPE_UNKNOWN);609 avcodec_get_context_defaults2(s, AVMEDIA_TYPE_UNKNOWN);
609}610}
610 611
611#if FF_API_ALLOC_CONTEXT
612AVCodecContext *avcodec_alloc_context(void){612AVCodecContext *avcodec_alloc_context(void){
613 return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN);613 return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN);
614}614}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t