*/
int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags);
+#if FF_API_OLD_ENCDEC
/**
* If non-zero, the decoded audio and video frames returned from
* avcodec_decode_video2() and avcodec_decode_audio4() are reference-counted
*/
attribute_deprecated
int refcounted_frames;
+#endif
/* - encoding parameters */
float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0)
*/
enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos);
+#if FF_API_OLD_ENCDEC
/**
* Decode the audio frame of size avpkt->size from avpkt->data into frame.
*
int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
int *got_picture_ptr,
const AVPacket *avpkt);
+#endif
/**
* Decode a subtitle message.
* @{
*/
+#if FF_API_OLD_ENCDEC
/**
* Encode a frame of audio.
*
attribute_deprecated
int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,
const AVFrame *frame, int *got_packet_ptr);
+#endif
int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
const AVSubtitle *sub);
if (ret < 0)
goto finish;
+#if FF_API_OLD_ENCDEC
if (avctx->codec->receive_frame)
avci->compat_decode_consumed += pkt->size;
+#endif
return 0;
finish:
}
}
+#if FF_API_OLD_ENCDEC
avci->compat_decode_consumed += ret;
+#endif
if (ret >= pkt->size || ret < 0) {
av_packet_unref(pkt);
return 0;
}
+#if FF_API_OLD_ENCDEC
+FF_DISABLE_DEPRECATION_WARNINGS
static int unrefcount_frame(AVCodecInternal *avci, AVFrame *frame)
{
int ret;
{
return compat_decode(avctx, frame, got_frame_ptr, avpkt);
}
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
static void get_subtitle_defaults(AVSubtitle *sub)
{
return 0;
}
+#if FF_API_OLD_ENCDEC
static int compat_encode(AVCodecContext *avctx, AVPacket *avpkt,
int *got_packet, const AVFrame *frame)
{
return ret;
}
+#endif
*/
int last_audio_frame;
+#if FF_API_OLD_ENCDEC
AVFrame *to_free;
+#endif
AVBufferRef *pool;
AVPacket *buffer_pkt;
AVFrame *buffer_frame;
int draining_done;
+
+#if FF_API_OLD_ENCDEC
int compat_decode_warned;
/* this variable is set by the decoder internals to signal to the old
* API compat wrappers the amount of data consumed from the last packet */
size_t compat_decode_partial_size;
AVFrame *compat_decode_frame;
AVPacket *compat_encode_packet;
+#endif
int showed_multi_packet_warning;
#if FF_API_ASS_TIMING
{"ass_with_timings", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS}, INT_MIN, INT_MAX, S|D, "sub_text_format"},
#endif
+#if FF_API_OLD_ENCDEC
{"refcounted_frames", NULL, OFFSET(refcounted_frames), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, A|V|D },
+#endif
#if FF_API_SIDEDATA_ONLY_PKT
{"side_data_only_packets", NULL, OFFSET(side_data_only_packets), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, A|V|E },
#endif
}
avctx->internal = avci;
+#if FF_API_OLD_ENCDEC
avci->to_free = av_frame_alloc();
avci->compat_decode_frame = av_frame_alloc();
avci->compat_encode_packet = av_packet_alloc();
+ if (!avci->to_free || !avci->compat_decode_frame || !avci->compat_encode_packet) {
+ ret = AVERROR(ENOMEM);
+ goto free_and_end;
+ }
+#endif
avci->buffer_frame = av_frame_alloc();
avci->buffer_pkt = av_packet_alloc();
avci->es.in_frame = av_frame_alloc();
avci->ds.in_pkt = av_packet_alloc();
avci->last_pkt_props = av_packet_alloc();
- if (!avci->compat_decode_frame || !avci->compat_encode_packet ||
- !avci->buffer_frame || !avci->buffer_pkt ||
+ if (!avci->buffer_frame || !avci->buffer_pkt ||
!avci->es.in_frame || !avci->ds.in_pkt ||
- !avci->to_free || !avci->last_pkt_props) {
+ !avci->last_pkt_props) {
ret = AVERROR(ENOMEM);
goto free_and_end;
}
av_freep(&avctx->priv_data);
av_freep(&avctx->subtitle_header);
+#if FF_API_OLD_ENCDEC
av_frame_free(&avci->to_free);
av_frame_free(&avci->compat_decode_frame);
- av_frame_free(&avci->buffer_frame);
av_packet_free(&avci->compat_encode_packet);
+#endif
+ av_frame_free(&avci->buffer_frame);
av_packet_free(&avci->buffer_pkt);
av_packet_free(&avci->last_pkt_props);
avci->draining_done = 0;
avci->nb_draining_errors = 0;
av_frame_unref(avci->buffer_frame);
+#if FF_API_OLD_ENCDEC
av_frame_unref(avci->compat_decode_frame);
av_packet_unref(avci->compat_encode_packet);
+#endif
av_packet_unref(avci->buffer_pkt);
av_packet_unref(avci->last_pkt_props);
if (av_codec_is_decoder(avctx->codec))
av_bsf_flush(avci->bsf);
+#if FF_API_OLD_ENCDEC
+FF_DISABLE_DEPRECATION_WARNINGS
if (!avctx->refcounted_frames)
av_frame_unref(avci->to_free);
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
}
void avsubtitle_free(AVSubtitle *sub)
avctx->codec->close(avctx);
avctx->internal->byte_buffer_size = 0;
av_freep(&avctx->internal->byte_buffer);
+#if FF_API_OLD_ENCDEC
av_frame_free(&avctx->internal->to_free);
av_frame_free(&avctx->internal->compat_decode_frame);
- av_frame_free(&avctx->internal->buffer_frame);
av_packet_free(&avctx->internal->compat_encode_packet);
+#endif
+ av_frame_free(&avctx->internal->buffer_frame);
av_packet_free(&avctx->internal->buffer_pkt);
av_packet_free(&avctx->internal->last_pkt_props);
avpriv_packet_list_free(&avctx->internal->pkt_props,
#ifndef FF_API_AVPRIV_PUT_BITS
#define FF_API_AVPRIV_PUT_BITS (LIBAVCODEC_VERSION_MAJOR < 59)
#endif
+#ifndef FF_API_OLD_ENCDEC
+#define FF_API_OLD_ENCDEC (LIBAVCODEC_VERSION_MAJOR < 59)
+#endif
#ifndef FF_API_THREAD_SAFE_CALLBACKS
#define FF_API_THREAD_SAFE_CALLBACKS (LIBAVCODEC_VERSION_MAJOR < 60)
#endif