mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-24 07:50:11 +01:00
lavc: deprecate avcodec_get_context_defaults3()
This function is supposed to "reset" a codec context to a clean state so that it can be opened again. The only reason it exists is to allow using AVStream.codec as a decoding context (after it was already opened/used/closed by avformat_find_stream_info()). Since that behaviour is now deprecated, there is no reason for this function to exist anymore.
This commit is contained in:
@@ -80,7 +80,7 @@ static const AVClass av_codec_context_class = {
|
||||
.child_class_next = codec_child_class_next,
|
||||
};
|
||||
|
||||
int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec)
|
||||
static int init_context_defaults(AVCodecContext *s, const AVCodec *codec)
|
||||
{
|
||||
memset(s, 0, sizeof(AVCodecContext));
|
||||
|
||||
@@ -125,6 +125,13 @@ int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if FF_API_GET_CONTEXT_DEFAULTS
|
||||
int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec)
|
||||
{
|
||||
return init_context_defaults(s, codec);
|
||||
}
|
||||
#endif
|
||||
|
||||
AVCodecContext *avcodec_alloc_context3(const AVCodec *codec)
|
||||
{
|
||||
AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
|
||||
@@ -132,7 +139,7 @@ AVCodecContext *avcodec_alloc_context3(const AVCodec *codec)
|
||||
if (!avctx)
|
||||
return NULL;
|
||||
|
||||
if(avcodec_get_context_defaults3(avctx, codec) < 0){
|
||||
if (init_context_defaults(avctx, codec) < 0) {
|
||||
av_free(avctx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user