return timestamp;
}
-#if FF_API_FORMAT_GET_SET
-MAKE_ACCESSORS(AVStream, stream, AVRational, r_frame_rate)
-#if FF_API_LAVF_FFSERVER
-FF_DISABLE_DEPRECATION_WARNINGS
-MAKE_ACCESSORS(AVStream, stream, char *, recommended_encoder_configuration)
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-MAKE_ACCESSORS(AVFormatContext, format, AVCodec *, video_codec)
-MAKE_ACCESSORS(AVFormatContext, format, AVCodec *, audio_codec)
-MAKE_ACCESSORS(AVFormatContext, format, AVCodec *, subtitle_codec)
-MAKE_ACCESSORS(AVFormatContext, format, AVCodec *, data_codec)
-MAKE_ACCESSORS(AVFormatContext, format, int, metadata_header_padding)
-MAKE_ACCESSORS(AVFormatContext, format, void *, opaque)
-MAKE_ACCESSORS(AVFormatContext, format, av_format_control_message, control_message_cb)
-#if FF_API_OLD_OPEN_CALLBACKS
-FF_DISABLE_DEPRECATION_WARNINGS
-MAKE_ACCESSORS(AVFormatContext, format, AVOpenCallback, open_cb)
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-#endif
-
int64_t av_stream_get_end_pts(const AVStream *st)
{
if (st->internal->priv_pts) {
return codec;
}
-#if FF_API_FORMAT_GET_SET
-int av_format_get_probe_score(const AVFormatContext *s)
-{
- return s->probe_score;
-}
-#endif
-
/* an arbitrarily chosen "sane" max packet size -- 50M */
#define SANE_CHUNK_SIZE (50000000)
/************************************************************/
/* input media file */
-#if FF_API_DEMUXER_OPEN
-int av_demuxer_open(AVFormatContext *ic) {
- int err;
-
- if (ic->format_whitelist && av_match_list(ic->iformat->name, ic->format_whitelist, ',') <= 0) {
- av_log(ic, AV_LOG_ERROR, "Format not on whitelist \'%s\'\n", ic->format_whitelist);
- return AVERROR(EINVAL);
- }
-
- if (ic->iformat->read_header) {
- err = ic->iformat->read_header(ic);
- if (err < 0)
- return err;
- }
-
- if (ic->pb && !ic->internal->data_offset)
- ic->internal->data_offset = avio_tell(ic->pb);
-
- return 0;
-}
-#endif
/* Open input file and probe the format if necessary. */
static int init_input(AVFormatContext *s, const char *filename,
AVDictionary **options)
int avformat_open_input(AVFormatContext **ps, const char *filename,
- ff_const59 AVInputFormat *fmt, AVDictionary **options)
+ const AVInputFormat *fmt, AVDictionary **options)
{
AVFormatContext *s = *ps;
int i, ret = 0;
goto fail;
}
-#if FF_API_FORMAT_FILENAME
-FF_DISABLE_DEPRECATION_WARNINGS
- av_strlcpy(s->filename, filename ? filename : "", sizeof(s->filename));
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
if ((ret = init_input(s, filename, &tmp)) < 0)
goto fail;
s->probe_score = ret;
if (s->pb)
ff_id3v2_read_dict(s->pb, &s->internal->id3v2_meta, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta);
-#if FF_API_DEMUXER_OPEN
- if (!(s->flags&AVFMT_FLAG_PRIV_OPT) && s->iformat->read_header)
-#else
if (s->iformat->read_header)
-#endif
if ((ret = s->iformat->read_header(s)) < 0)
goto fail;
if ((ret = avformat_queue_attached_pictures(s)) < 0)
goto close;
-#if FF_API_DEMUXER_OPEN
- if (!(s->flags&AVFMT_FLAG_PRIV_OPT) && s->pb && !s->internal->data_offset)
-#else
if (s->pb && !s->internal->data_offset)
-#endif
s->internal->data_offset = avio_tell(s->pb);
s->internal->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;
/* update flags */
if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA || ff_is_intra_only(st->codecpar->codec_id))
pkt->flags |= AV_PKT_FLAG_KEY;
-#if FF_API_CONVERGENCE_DURATION
-FF_DISABLE_DEPRECATION_WARNINGS
- if (pc)
- pkt->convergence_duration = pc->convergence_duration;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
}
/**
if (ic->codec_whitelist)
av_dict_set(options ? &options[i] : &thread_opt, "codec_whitelist", ic->codec_whitelist, 0);
- /* Ensure that subtitle_header is properly set. */
- if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE
- && codec && !avctx->codec) {
- if (avcodec_open2(avctx, codec, options ? &options[i] : &thread_opt) < 0)
- av_log(ic, AV_LOG_WARNING,
- "Failed to open codec in %s\n",__FUNCTION__);
- }
-
// Try to just open decoders, in case this is enough to get parameters.
- if (!has_codec_parameters(st, NULL) && st->internal->request_probe <= 0) {
+ // Also ensure that subtitle_header is properly set.
+ if (!has_codec_parameters(st, NULL) && st->internal->request_probe <= 0 ||
+ st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) {
if (codec && !avctx->codec)
if (avcodec_open2(avctx, codec, options ? &options[i] : &thread_opt) < 0)
av_log(ic, AV_LOG_WARNING,
}
}
-#if FF_API_LAVF_FFSERVER
-FF_DISABLE_DEPRECATION_WARNINGS
- av_freep(&dst->recommended_encoder_configuration);
- if (src->recommended_encoder_configuration) {
- const char *conf_str = src->recommended_encoder_configuration;
- dst->recommended_encoder_configuration = av_strdup(conf_str);
- if (!dst->recommended_encoder_configuration)
- return AVERROR(ENOMEM);
- }
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
return 0;
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif
av_freep(&st->priv_data);
-#if FF_API_LAVF_FFSERVER
-FF_DISABLE_DEPRECATION_WARNINGS
- av_freep(&st->recommended_encoder_configuration);
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
av_freep(pst);
}
return 1;
}
-#if FF_API_OLD_BSF
-FF_DISABLE_DEPRECATION_WARNINGS
-int av_apply_bitstream_filters(AVCodecContext *codec, AVPacket *pkt,
- AVBitStreamFilterContext *bsfc)
-{
- int ret = 0;
- while (bsfc) {
- AVPacket new_pkt = *pkt;
- int a = av_bitstream_filter_filter(bsfc, codec, NULL,
- &new_pkt.data, &new_pkt.size,
- pkt->data, pkt->size,
- pkt->flags & AV_PKT_FLAG_KEY);
- if (a == 0 && new_pkt.size == 0 && new_pkt.side_data_elems == 0) {
- av_packet_unref(pkt);
- memset(pkt, 0, sizeof(*pkt));
- return 0;
- }
- if(a == 0 && new_pkt.data != pkt->data) {
- uint8_t *t = av_malloc(new_pkt.size + AV_INPUT_BUFFER_PADDING_SIZE); //the new should be a subset of the old so cannot overflow
- if (t) {
- memcpy(t, new_pkt.data, new_pkt.size);
- memset(t + new_pkt.size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
- new_pkt.data = t;
- new_pkt.buf = NULL;
- a = 1;
- } else {
- a = AVERROR(ENOMEM);
- }
- }
- if (a > 0) {
- new_pkt.buf = av_buffer_create(new_pkt.data, new_pkt.size,
- av_buffer_default_free, NULL, 0);
- if (new_pkt.buf) {
- pkt->side_data = NULL;
- pkt->side_data_elems = 0;
- av_packet_unref(pkt);
- } else {
- av_freep(&new_pkt.data);
- a = AVERROR(ENOMEM);
- }
- }
- if (a < 0) {
- av_log(codec, AV_LOG_ERROR,
- "Failed to open bitstream filter %s for stream %d with codec %s",
- bsfc->filter->name, pkt->stream_index,
- codec->codec ? codec->codec->name : "copy");
- ret = a;
- break;
- }
- *pkt = new_pkt;
-
- bsfc = bsfc->next;
- }
- return ret;
-}
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
int ff_format_output_open(AVFormatContext *s, const char *url, AVDictionary **options)
{
if (!s->oformat)
av_assert0(url);
av_freep(&s->url);
s->url = url;
-#if FF_API_FORMAT_FILENAME
-FF_DISABLE_DEPRECATION_WARNINGS
- av_strlcpy(s->filename, url, sizeof(s->filename));
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
}