Deprecate avcodec_get_context_defaults/avcodec_get_context_defaults2
| ... | ... |
@@ -4234,8 +4234,8 @@ static int parse_ffconfig(const char *filename) |
| 4234 | 4234 |
} |
| 4235 | 4235 |
|
| 4236 | 4236 |
stream->fmt = avserver_guess_format(NULL, stream->filename, NULL); |
| 4237 |
- avcodec_get_context_defaults2(&video_enc, AVMEDIA_TYPE_VIDEO); |
|
| 4238 |
- avcodec_get_context_defaults2(&audio_enc, AVMEDIA_TYPE_AUDIO); |
|
| 4237 |
+ avcodec_get_context_defaults3(&video_enc, NULL); |
|
| 4238 |
+ avcodec_get_context_defaults3(&audio_enc, NULL); |
|
| 4239 | 4239 |
audio_id = CODEC_ID_NONE; |
| 4240 | 4240 |
video_id = CODEC_ID_NONE; |
| 4241 | 4241 |
if (stream->fmt) {
|
| ... | ... |
@@ -3592,19 +3592,31 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); |
| 3592 | 3592 |
*/ |
| 3593 | 3593 |
const char *av_get_profile_name(const AVCodec *codec, int profile); |
| 3594 | 3594 |
|
| 3595 |
+#if FF_API_ALLOC_CONTEXT |
|
| 3595 | 3596 |
/** |
| 3596 | 3597 |
* Set the fields of the given AVCodecContext to default values. |
| 3597 | 3598 |
* |
| 3598 | 3599 |
* @param s The AVCodecContext of which the fields should be set to default values. |
| 3600 |
+ * @deprecated use avcodec_get_context_defaults3 |
|
| 3599 | 3601 |
*/ |
| 3602 |
+attribute_deprecated |
|
| 3600 | 3603 |
void avcodec_get_context_defaults(AVCodecContext *s); |
| 3601 | 3604 |
|
| 3602 | 3605 |
/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API! |
| 3603 | 3606 |
* we WILL change its arguments and name a few times! */ |
| 3607 |
+attribute_deprecated |
|
| 3604 | 3608 |
void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType); |
| 3609 |
+#endif |
|
| 3605 | 3610 |
|
| 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 |
+ */ |
|
| 3608 | 3620 |
int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec); |
| 3609 | 3621 |
|
| 3610 | 3622 |
#if FF_API_ALLOC_CONTEXT |
| ... | ... |
@@ -531,30 +531,32 @@ static const AVClass av_codec_context_class = {
|
| 531 | 531 |
.child_class_next = codec_child_class_next, |
| 532 | 532 |
}; |
| 533 | 533 |
|
| 534 |
+#if FF_API_ALLOC_CONTEXT |
|
| 534 | 535 |
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){
|
|
| 535 | 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 | 546 |
av_opt_set_defaults(s); |
| 541 | 547 |
|
| 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; |
|
| 558 | 560 |
if(codec && codec->priv_data_size){
|
| 559 | 561 |
if(!s->priv_data){
|
| 560 | 562 |
s->priv_data= av_mallocz(codec->priv_data_size); |
| ... | ... |
@@ -602,13 +604,11 @@ AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){
|
| 602 | 602 |
|
| 603 | 603 |
return avctx; |
| 604 | 604 |
} |
| 605 |
-#endif |
|
| 606 | 605 |
|
| 607 | 606 |
void avcodec_get_context_defaults(AVCodecContext *s){
|
| 608 | 607 |
avcodec_get_context_defaults2(s, AVMEDIA_TYPE_UNKNOWN); |
| 609 | 608 |
} |
| 610 | 609 |
|
| 611 |
-#if FF_API_ALLOC_CONTEXT |
|
| 612 | 610 |
AVCodecContext *avcodec_alloc_context(void){
|
| 613 | 611 |
return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN); |
| 614 | 612 |
} |