static const AVCodec *find_decoder(AVFormatContext *s, const AVStream *st, enum AVCodecID codec_id)
{
-#if FF_API_LAVF_AVCTX
-FF_DISABLE_DEPRECATION_WARNINGS
- if (st->codec->codec)
- return st->codec->codec;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
switch (st->codecpar->codec_type) {
case AVMEDIA_TYPE_VIDEO:
if (s->video_codec) return s->video_codec;
st->codecpar->codec_id = fmt_id_type[i].id;
st->codecpar->codec_type = fmt_id_type[i].type;
st->internal->need_context_update = 1;
-#if FF_API_LAVF_AVCTX
-FF_DISABLE_DEPRECATION_WARNINGS
- st->codec->codec_type = st->codecpar->codec_type;
- st->codec->codec_id = st->codecpar->codec_id;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
return score;
}
}
if (ret < 0)
return ret;
-#if FF_API_LAVF_AVCTX
-FF_DISABLE_DEPRECATION_WARNINGS
- /* update deprecated public codec context */
- ret = avcodec_parameters_to_context(st->codec, st->codecpar);
- if (ret < 0)
- return ret;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
st->internal->need_context_update = 0;
}
return 0;
av_mul_q(av_inv_q(st->internal->avctx->time_base), (AVRational){1, st->internal->avctx->ticks_per_frame});
int frame_size, sample_rate;
-#if FF_API_LAVF_AVCTX
-FF_DISABLE_DEPRECATION_WARNINGS
- if ((!codec_framerate.den || !codec_framerate.num) && st->codec->time_base.den && st->codec->time_base.num)
- codec_framerate = av_mul_q(av_inv_q(st->codec->time_base), (AVRational){1, st->codec->ticks_per_frame});
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
*pnum = 0;
*pden = 0;
switch (st->codecpar->codec_type) {
return ret;
}
-#if FF_API_LAVF_AVCTX
-FF_DISABLE_DEPRECATION_WARNINGS
- /* update deprecated public codec context */
- ret = avcodec_parameters_to_context(st->codec, st->codecpar);
- if (ret < 0) {
- av_packet_unref(pkt);
- return ret;
- }
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
st->internal->need_context_update = 0;
}
av_opt_set_dict_val(s, "metadata", NULL, AV_OPT_SEARCH_CHILDREN);
}
-#if FF_API_LAVF_AVCTX
- update_stream_avctx(s);
-#endif
-
if (s->debug & FF_FDEBUG_TS)
av_log(s, AV_LOG_DEBUG,
"read_frame_internal stream=%d, pts=%s, dts=%s, "
}
/* check if the caller has overridden the codec id */
-#if FF_API_LAVF_AVCTX
-FF_DISABLE_DEPRECATION_WARNINGS
- if (st->codec->codec_id != st->internal->orig_codec_id) {
- st->codecpar->codec_id = st->codec->codec_id;
- st->codecpar->codec_type = st->codec->codec_type;
- st->internal->orig_codec_id = st->codec->codec_id;
- }
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
// only for the split stuff
if (!st->parser && !(ic->flags & AVFMT_FLAG_NOPARSE) && st->internal->request_probe <= 0) {
st->parser = av_parser_init(st->codecpar->codec_id);
goto find_stream_info_err;
}
-#if FF_API_LAVF_AVCTX
-FF_DISABLE_DEPRECATION_WARNINGS
- ret = avcodec_parameters_to_context(st->codec, st->codecpar);
- if (ret < 0)
- goto find_stream_info_err;
-
- // The old API (AVStream.codec) "requires" the resolution to be adjusted
- // by the lowres factor.
- if (st->internal->avctx->lowres && st->internal->avctx->width) {
- st->codec->lowres = st->internal->avctx->lowres;
- st->codec->width = st->internal->avctx->width;
- st->codec->height = st->internal->avctx->height;
- }
-
- if (st->codec->codec_tag != MKTAG('t','m','c','d')) {
- st->codec->time_base = st->internal->avctx->time_base;
- st->codec->ticks_per_frame = st->internal->avctx->ticks_per_frame;
- }
- st->codec->framerate = st->avg_frame_rate;
-
- if (st->internal->avctx->subtitle_header) {
- st->codec->subtitle_header = av_malloc(st->internal->avctx->subtitle_header_size);
- if (!st->codec->subtitle_header)
- goto find_stream_info_err;
- st->codec->subtitle_header_size = st->internal->avctx->subtitle_header_size;
- memcpy(st->codec->subtitle_header, st->internal->avctx->subtitle_header,
- st->codec->subtitle_header_size);
- }
-
- // Fields unavailable in AVCodecParameters
- st->codec->coded_width = st->internal->avctx->coded_width;
- st->codec->coded_height = st->internal->avctx->coded_height;
- st->codec->properties = st->internal->avctx->properties;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
st->internal->avctx_inited = 0;
}
int av_find_best_stream(AVFormatContext *ic, enum AVMediaType type,
int wanted_stream_nb, int related_stream,
- AVCodec **decoder_ret, int flags)
+ const AVCodec **decoder_ret, int flags)
{
int i, nb_streams = ic->nb_streams;
int ret = AVERROR_STREAM_NOT_FOUND;
}
}
if (decoder_ret)
- *decoder_ret = (AVCodec*)best_decoder;
+ *decoder_ret = best_decoder;
return ret;
}
av_dict_free(&st->metadata);
avcodec_parameters_free(&st->codecpar);
-#if FF_API_LAVF_AVCTX
-FF_DISABLE_DEPRECATION_WARNINGS
- avcodec_free_context(&st->codec);
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
av_freep(&st->priv_data);
av_freep(pst);
if (!st)
return NULL;
-#if FF_API_LAVF_AVCTX
-FF_DISABLE_DEPRECATION_WARNINGS
- st->codec = avcodec_alloc_context3(c);
- if (!st->codec) {
- av_free(st);
- return NULL;
- }
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
st->internal = av_mallocz(sizeof(*st->internal));
if (!st->internal)
goto fail;
goto fail;
if (s->iformat) {
-#if FF_API_LAVF_AVCTX
-FF_DISABLE_DEPRECATION_WARNINGS
- /* no default bitrate if decoding */
- st->codec->bit_rate = 0;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
/* default pts setting is MPEG-like */
avpriv_set_pts_info(st, 33, 1, 90000);
/* we set the current DTS to 0 so that formats without any timestamps
return program;
}
-#if FF_API_CHAPTER_ID_INT
-AVChapter *avpriv_new_chapter(AVFormatContext *s, int id, AVRational time_base,
-#else
AVChapter *avpriv_new_chapter(AVFormatContext *s, int64_t id, AVRational time_base,
-#endif
int64_t start, int64_t end, const char *title)
{
AVChapter *chapter = NULL;
return;
}
s->time_base = new_tb;
-#if FF_API_LAVF_AVCTX
-FF_DISABLE_DEPRECATION_WARNINGS
- s->codec->pkt_timebase = new_tb;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
s->internal->avctx->pkt_timebase = new_tb;
s->pts_wrap_bits = pts_wrap_bits;
}
if (*spec && *spec++ != ':') /* If we are not at the end, then another specifier must follow. */
return AVERROR(EINVAL);
-#if FF_API_LAVF_AVCTX
-FF_DISABLE_DEPRECATION_WARNINGS
- if (type != st->codecpar->codec_type
- && (st->codecpar->codec_type != AVMEDIA_TYPE_UNKNOWN || st->codec->codec_type != type))
- match = 0;
- FF_ENABLE_DEPRECATION_WARNINGS
-#else
if (type != st->codecpar->codec_type)
match = 0;
-#endif
if (nopic && (st->disposition & AV_DISPOSITION_ATTACHED_PIC))
match = 0;
} else if (*spec == 'p' && *(spec + 1) == ':') {
return match && ret;
} else if (*spec == 'u' && *(spec + 1) == '\0') {
AVCodecParameters *par = st->codecpar;
-#if FF_API_LAVF_AVCTX
-FF_DISABLE_DEPRECATION_WARNINGS
- AVCodecContext *codec = st->codec;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
int val;
switch (par->codec_type) {
case AVMEDIA_TYPE_AUDIO:
val = par->sample_rate && par->channels;
-#if FF_API_LAVF_AVCTX
- val = val || (codec->sample_rate && codec->channels);
-#endif
- if (par->format == AV_SAMPLE_FMT_NONE
-#if FF_API_LAVF_AVCTX
- && codec->sample_fmt == AV_SAMPLE_FMT_NONE
-#endif
- )
+ if (par->format == AV_SAMPLE_FMT_NONE)
return 0;
break;
case AVMEDIA_TYPE_VIDEO:
val = par->width && par->height;
-#if FF_API_LAVF_AVCTX
- val = val || (codec->width && codec->height);
-#endif
- if (par->format == AV_PIX_FMT_NONE
-#if FF_API_LAVF_AVCTX
- && codec->pix_fmt == AV_PIX_FMT_NONE
-#endif
- )
+ if (par->format == AV_PIX_FMT_NONE)
return 0;
break;
case AVMEDIA_TYPE_UNKNOWN:
val = 1;
break;
}
-#if FF_API_LAVF_AVCTX
- return match && ((par->codec_id != AV_CODEC_ID_NONE || codec->codec_id != AV_CODEC_ID_NONE) && val != 0);
-#else
return match && (par->codec_id != AV_CODEC_ID_NONE && val != 0);
-#endif
} else {
return AVERROR(EINVAL);
}
}
uint8_t *av_stream_get_side_data(const AVStream *st,
- enum AVPacketSideDataType type, buffer_size_t *size)
+ enum AVPacketSideDataType type, size_t *size)
{
int i;
}
uint8_t *av_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type,
- buffer_size_t size)
+ size_t size)
{
int ret;
uint8_t *data = av_malloc(size);
int ff_get_packet_palette(AVFormatContext *s, AVPacket *pkt, int ret, uint32_t *palette)
{
uint8_t *side_data;
- buffer_size_t size;
+ size_t size;
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_PALETTE, &size);
if (side_data) {
const AVCodecContext *dec_ctx;
AVCodecContext *enc_ctx;
-#if FF_API_LAVF_AVCTX
-FF_DISABLE_DEPRECATION_WARNINGS
- dec_ctx = ist->codec;
- enc_ctx = ost->codec;
-FF_ENABLE_DEPRECATION_WARNINGS
-#else
dec_ctx = ist->internal->avctx;
enc_ctx = ost->internal->avctx;
-#endif
enc_ctx->time_base = ist->time_base;
/*
AVRational av_stream_get_codec_timebase(const AVStream *st)
{
// See avformat_transfer_internal_stream_timing_info() TODO.
-#if FF_API_LAVF_AVCTX
-FF_DISABLE_DEPRECATION_WARNINGS
- return st->codec->time_base;
-FF_ENABLE_DEPRECATION_WARNINGS
-#else
return st->internal->avctx->time_base;
-#endif
}
void ff_format_set_url(AVFormatContext *s, char *url)