Commit 2fb75019 authored by Anton Khirnov's avatar Anton Khirnov

lavf: remove disabled FF_API_FORMAT_PARAMETERS cruft

Also remove now unused AVFormatParameters struct and
AVOutputFormat.set_parameters().
parent 38233fc1
......@@ -277,25 +277,6 @@ typedef struct AVProbeData {
#define AVPROBE_SCORE_MAX 100 ///< maximum score, half of that is used for file-extension-based detection
#define AVPROBE_PADDING_SIZE 32 ///< extra allocated bytes at the end of the probe buffer
typedef struct AVFormatParameters {
#if FF_API_FORMAT_PARAMETERS
attribute_deprecated AVRational time_base;
attribute_deprecated int sample_rate;
attribute_deprecated int channels;
attribute_deprecated int width;
attribute_deprecated int height;
attribute_deprecated enum PixelFormat pix_fmt;
attribute_deprecated int channel; /**< Used to select DV channel. */
attribute_deprecated const char *standard; /**< deprecated, use demuxer-specific options instead. */
attribute_deprecated unsigned int mpeg2ts_raw:1; /**< deprecated, use mpegtsraw demuxer */
/**< deprecated, use mpegtsraw demuxer-specific options instead */
attribute_deprecated unsigned int mpeg2ts_compute_pcr:1;
attribute_deprecated unsigned int initial_pause:1; /**< Do not begin to play the stream
immediately (RTSP only). */
attribute_deprecated unsigned int prealloced_context:1;
#endif
} AVFormatParameters;
/// Demuxer will use avio_open, no opened file should be provided by the caller.
#define AVFMT_NOFILE 0x0001
#define AVFMT_NEEDNUMBER 0x0002 /**< Needs '%d' in filename. */
......@@ -354,7 +335,6 @@ typedef struct AVOutputFormat {
/**
* Currently only used to set pixel format if not YUV420P.
*/
int (*set_parameters)(struct AVFormatContext *, AVFormatParameters *);
int (*interleave_packet)(struct AVFormatContext *, AVPacket *out,
AVPacket *in, int flush);
......@@ -1272,36 +1252,6 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
const char *filename, void *logctx,
unsigned int offset, unsigned int max_probe_size);
#if FF_API_FORMAT_PARAMETERS
/**
* Allocate all the structures needed to read an input stream.
* This does not open the needed codecs for decoding the stream[s].
* @deprecated use avformat_open_input instead.
*/
attribute_deprecated int av_open_input_stream(AVFormatContext **ic_ptr,
AVIOContext *pb, const char *filename,
AVInputFormat *fmt, AVFormatParameters *ap);
/**
* Open a media file as input. The codecs are not opened. Only the file
* header (if present) is read.
*
* @param ic_ptr The opened media file handle is put here.
* @param filename filename to open
* @param fmt If non-NULL, force the file format to use.
* @param buf_size optional buffer size (zero if default is OK)
* @param ap Additional parameters needed when opening the file
* (NULL if default).
* @return 0 if OK, AVERROR_xxx otherwise
*
* @deprecated use avformat_open_input instead.
*/
attribute_deprecated int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
AVInputFormat *fmt,
int buf_size,
AVFormatParameters *ap);
#endif
/**
* Open an input stream and read the header. The codecs are not opened.
* The stream must be closed with av_close_input_file().
......@@ -1323,26 +1273,6 @@ attribute_deprecated int av_open_input_file(AVFormatContext **ic_ptr, const char
*/
int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options);
#if FF_API_FORMAT_PARAMETERS
/**
* Read packets of a media file to get stream information. This
* is useful for file formats with no headers such as MPEG. This
* function also computes the real framerate in case of MPEG-2 repeat
* frame mode.
* The logical file position is not changed by this function;
* examined packets may be buffered for later processing.
*
* @param ic media file handle
* @return >=0 if OK, AVERROR_xxx on error
* @todo Let the user decide somehow what information is needed so that
* we do not waste time getting stuff the user does not need.
*
* @deprecated use avformat_find_stream_info.
*/
attribute_deprecated
int av_find_stream_info(AVFormatContext *ic);
#endif
/**
* Read packets of a media file to get stream information. This
* is useful for file formats with no headers such as MPEG. This
......@@ -1490,16 +1420,6 @@ int av_read_play(AVFormatContext *s);
*/
int av_read_pause(AVFormatContext *s);
#if FF_API_FORMAT_PARAMETERS
/**
* Free a AVFormatContext allocated by av_open_input_stream.
* @param s context to free
* @deprecated use av_close_input_file()
*/
attribute_deprecated
void av_close_input_stream(AVFormatContext *s);
#endif
#if FF_API_CLOSE_INPUT_FILE
/**
* @deprecated use avformat_close_input()
......@@ -1564,13 +1484,6 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index,
int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t ));
#endif
#if FF_API_FORMAT_PARAMETERS
/**
* @deprecated pass the options to avformat_write_header directly.
*/
attribute_deprecated int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap);
#endif
/**
* @addtogroup lavf_encoding
* @{
......@@ -1592,21 +1505,6 @@ attribute_deprecated int av_set_parameters(AVFormatContext *s, AVFormatParameter
*/
int avformat_write_header(AVFormatContext *s, AVDictionary **options);
#if FF_API_FORMAT_PARAMETERS
/**
* Allocate the stream private data and write the stream header to an
* output media file.
* @note: this sets stream time-bases, if possible to stream->codec->time_base
* but for some formats it might also be some other time base
*
* @param s media file handle
* @return 0 if OK, AVERROR_xxx on error
*
* @deprecated use avformat_write_header.
*/
attribute_deprecated int av_write_header(AVFormatContext *s);
#endif
/**
* Write a packet to an output media file.
*
......
......@@ -400,93 +400,6 @@ static int set_codec_from_probe_data(AVFormatContext *s, AVStream *st, AVProbeDa
/************************************************************/
/* input media file */
#if FF_API_FORMAT_PARAMETERS
static AVDictionary *convert_format_parameters(AVFormatParameters *ap)
{
char buf[1024];
AVDictionary *opts = NULL;
if (!ap)
return NULL;
if (ap->time_base.num) {
snprintf(buf, sizeof(buf), "%d/%d", ap->time_base.den, ap->time_base.num);
av_dict_set(&opts, "framerate", buf, 0);
}
if (ap->sample_rate) {
snprintf(buf, sizeof(buf), "%d", ap->sample_rate);
av_dict_set(&opts, "sample_rate", buf, 0);
}
if (ap->channels) {
snprintf(buf, sizeof(buf), "%d", ap->channels);
av_dict_set(&opts, "channels", buf, 0);
}
if (ap->width || ap->height) {
snprintf(buf, sizeof(buf), "%dx%d", ap->width, ap->height);
av_dict_set(&opts, "video_size", buf, 0);
}
if (ap->pix_fmt != PIX_FMT_NONE) {
av_dict_set(&opts, "pixel_format", av_get_pix_fmt_name(ap->pix_fmt), 0);
}
if (ap->channel) {
snprintf(buf, sizeof(buf), "%d", ap->channel);
av_dict_set(&opts, "channel", buf, 0);
}
if (ap->standard) {
av_dict_set(&opts, "standard", ap->standard, 0);
}
if (ap->mpeg2ts_compute_pcr) {
av_dict_set(&opts, "mpeg2ts_compute_pcr", "1", 0);
}
if (ap->initial_pause) {
av_dict_set(&opts, "initial_pause", "1", 0);
}
return opts;
}
/**
* Open a media file from an IO stream. 'fmt' must be specified.
*/
int av_open_input_stream(AVFormatContext **ic_ptr,
AVIOContext *pb, const char *filename,
AVInputFormat *fmt, AVFormatParameters *ap)
{
int err;
AVDictionary *opts;
AVFormatContext *ic;
AVFormatParameters default_ap;
if(!ap){
ap=&default_ap;
memset(ap, 0, sizeof(default_ap));
}
opts = convert_format_parameters(ap);
if(!ap->prealloced_context)
ic = avformat_alloc_context();
else
ic = *ic_ptr;
if (!ic) {
err = AVERROR(ENOMEM);
goto fail;
}
if (pb && fmt && fmt->flags & AVFMT_NOFILE)
av_log(ic, AV_LOG_WARNING, "Custom AVIOContext makes no sense and "
"will be ignored with AVFMT_NOFILE format.\n");
else
ic->pb = pb;
if ((err = avformat_open_input(&ic, filename, fmt, &opts)) < 0)
goto fail;
ic->pb = ic->pb ? ic->pb : pb; // don't leak custom pb if it wasn't set above
fail:
*ic_ptr = ic;
av_dict_free(&opts);
return err;
}
#endif
/** size of probe buffer, for guessing file type from file contents */
#define PROBE_BUF_MIN 2048
#define PROBE_BUF_MAX (1<<20)
......@@ -558,25 +471,6 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
return ret;
}
#if FF_API_FORMAT_PARAMETERS
int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
AVInputFormat *fmt,
int buf_size,
AVFormatParameters *ap)
{
int err;
AVDictionary *opts = convert_format_parameters(ap);
if (!ap || !ap->prealloced_context)
*ic_ptr = NULL;
err = avformat_open_input(ic_ptr, filename, fmt, &opts);
av_dict_free(&opts);
return err;
}
#endif
/* open input file and probe the format if necessary */
static int init_input(AVFormatContext *s, const char *filename, AVDictionary **options)
{
......@@ -2273,13 +2167,6 @@ static int tb_unreliable(AVCodecContext *c){
return 0;
}
#if FF_API_FORMAT_PARAMETERS
int av_find_stream_info(AVFormatContext *ic)
{
return avformat_find_stream_info(ic, NULL);
}
#endif
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
{
int i, count, ret, read_size, j;
......@@ -2680,16 +2567,6 @@ int av_read_pause(AVFormatContext *s)
return AVERROR(ENOSYS);
}
#if FF_API_FORMAT_PARAMETERS
void av_close_input_stream(AVFormatContext *s)
{
flush_packet_queue(s);
if (s->iformat->read_close)
s->iformat->read_close(s);
avformat_free_context(s);
}
#endif
void avformat_free_context(AVFormatContext *s)
{
int i;
......@@ -2863,31 +2740,6 @@ AVChapter *avpriv_new_chapter(AVFormatContext *s, int id, AVRational time_base,
/************************************************************/
/* output media file */
#if FF_API_FORMAT_PARAMETERS
int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap)
{
int ret;
if (s->oformat->priv_data_size > 0) {
s->priv_data = av_mallocz(s->oformat->priv_data_size);
if (!s->priv_data)
return AVERROR(ENOMEM);
if (s->oformat->priv_class) {
*(const AVClass**)s->priv_data= s->oformat->priv_class;
av_opt_set_defaults(s->priv_data);
}
} else
s->priv_data = NULL;
if (s->oformat->set_parameters) {
ret = s->oformat->set_parameters(s, ap);
if (ret < 0)
return ret;
}
return 0;
}
#endif
static int validate_codec_tag(AVFormatContext *s, AVStream *st)
{
const AVCodecTag *avctag;
......@@ -2921,13 +2773,6 @@ static int validate_codec_tag(AVFormatContext *s, AVStream *st)
return 1;
}
#if FF_API_FORMAT_PARAMETERS
int av_write_header(AVFormatContext *s)
{
return avformat_write_header(s, NULL);
}
#endif
int avformat_write_header(AVFormatContext *s, AVDictionary **options)
{
int ret = 0, i;
......
......@@ -65,9 +65,6 @@
#ifndef FF_API_SDP_CREATE
#define FF_API_SDP_CREATE (LIBAVFORMAT_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_FORMAT_PARAMETERS
#define FF_API_FORMAT_PARAMETERS (LIBAVFORMAT_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_FLAG_RTP_HINT
#define FF_API_FLAG_RTP_HINT (LIBAVFORMAT_VERSION_MAJOR < 54)
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment