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
35923592 */
35933593 const char *av_get_profile_name(const AVCodec *codec, int profile);
35943594
3595+#if FF_API_ALLOC_CONTEXT
35953596 /**
35963597 * Set the fields of the given AVCodecContext to default values.
35973598 *
35983599 * @param s The AVCodecContext of which the fields should be set to default values.
3600+ * @deprecated use avcodec_get_context_defaults3
35993601 */
3602+attribute_deprecated
36003603 void avcodec_get_context_defaults(AVCodecContext *s);
36013604
36023605 /** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!
36033606 * we WILL change its arguments and name a few times! */
3607+attribute_deprecated
36043608 void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType);
3609+#endif
36053610
3606−/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!
3607− * we WILL change its arguments and name a few times! */
3611+/**
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+ */
36083620 int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec);
36093621
36103622 #if FF_API_ALLOC_CONTEXT
libavcodec/options.c+20−20
@@ -531,30 +531,32 @@ static const AVClass av_codec_context_class = { · 530 unmodified lines
531531 .child_class_next = codec_child_class_next,
532532 };
533533
534+#if FF_API_ALLOC_CONTEXT
534535 void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType codec_type){
536+ avcodec_get_context_defaults3(s, NULL);
537+}
538+#endif
539+
540+int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec){
535541 memset(s, 0, sizeof(AVCodecContext));
536542
537− s->av_class= &av_codec_context_class;
543+ s->av_class = &av_codec_context_class;
538544
539− s->codec_type = codec_type;
545+ s->codec_type = codec ? codec->type : AVMEDIA_TYPE_UNKNOWN;
540546 av_opt_set_defaults(s);
541547
542− s->time_base= (AVRational){0,1};
543− s->get_buffer= avcodec_default_get_buffer;
544− s->release_buffer= avcodec_default_release_buffer;
545− s->get_format= avcodec_default_get_format;
546− s->execute= avcodec_default_execute;
547− s->execute2= avcodec_default_execute2;
548− s->sample_aspect_ratio= (AVRational){0,1};
549− s->pix_fmt= PIX_FMT_NONE;
550− s->sample_fmt= AV_SAMPLE_FMT_NONE;
551−
552− s->reget_buffer= avcodec_default_reget_buffer;
553− s->reordered_opaque= AV_NOPTS_VALUE;
554−}
555−
556−int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec){
557− avcodec_get_context_defaults2(s, codec ? codec->type : AVMEDIA_TYPE_UNKNOWN);
548+ s->time_base = (AVRational){0,1};
549+ s->get_buffer = avcodec_default_get_buffer;
550+ s->release_buffer = avcodec_default_release_buffer;
551+ s->get_format = avcodec_default_get_format;
552+ s->execute = avcodec_default_execute;
553+ s->execute2 = avcodec_default_execute2;
554+ s->sample_aspect_ratio = (AVRational){0,1};
555+ s->pix_fmt = PIX_FMT_NONE;
556+ s->sample_fmt = AV_SAMPLE_FMT_NONE;
557+
558+ s->reget_buffer = avcodec_default_reget_buffer;
559+ s->reordered_opaque = AV_NOPTS_VALUE;
558560 if(codec && codec->priv_data_size){
559561 if(!s->priv_data){
560562 s->priv_data= av_mallocz(codec->priv_data_size);
@@ -602,13 +604,11 @@ AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){ · 41 unmodified lines
602604
603605 return avctx;
604606 }
605−#endif
606607
607608 void avcodec_get_context_defaults(AVCodecContext *s){
608609 avcodec_get_context_defaults2(s, AVMEDIA_TYPE_UNKNOWN);
609610 }
610611
611−#if FF_API_ALLOC_CONTEXT
612612 AVCodecContext *avcodec_alloc_context(void){
613613 return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN);
614614 }

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