From 139f3ac42dcf24eb8c59af4aaab4e9afdccbc996 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 12:18:16 +0100 Subject: [PATCH 01/37] Bump major versions of all libraries. They've accumulated enough new APIs and corresponding deprecated cruft. This breaks API and ABI. --- libavcodec/version.h | 4 ++-- libavdevice/avdevice.h | 4 ++-- libavfilter/avfilter.h | 4 ++-- libavformat/version.h | 4 ++-- libavutil/avutil.h | 6 +++--- libpostproc/postprocess.h | 4 ++-- libswscale/swscale.h | 4 ++-- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/libavcodec/version.h b/libavcodec/version.h index 1a470a1e91..7e5347404d 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -20,8 +20,8 @@ #ifndef AVCODEC_VERSION_H #define AVCODEC_VERSION_H -#define LIBAVCODEC_VERSION_MAJOR 52 -#define LIBAVCODEC_VERSION_MINOR 120 +#define LIBAVCODEC_VERSION_MAJOR 53 +#define LIBAVCODEC_VERSION_MINOR 0 #define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ diff --git a/libavdevice/avdevice.h b/libavdevice/avdevice.h index 497683a11b..d1e321bf3a 100644 --- a/libavdevice/avdevice.h +++ b/libavdevice/avdevice.h @@ -21,8 +21,8 @@ #include "libavutil/avutil.h" -#define LIBAVDEVICE_VERSION_MAJOR 52 -#define LIBAVDEVICE_VERSION_MINOR 4 +#define LIBAVDEVICE_VERSION_MAJOR 53 +#define LIBAVDEVICE_VERSION_MINOR 0 #define LIBAVDEVICE_VERSION_MICRO 0 #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \ diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 74435813fa..7505c2eecd 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -25,8 +25,8 @@ #include "libavutil/avutil.h" #include "libavutil/samplefmt.h" -#define LIBAVFILTER_VERSION_MAJOR 1 -#define LIBAVFILTER_VERSION_MINOR 77 +#define LIBAVFILTER_VERSION_MAJOR 2 +#define LIBAVFILTER_VERSION_MINOR 0 #define LIBAVFILTER_VERSION_MICRO 0 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ diff --git a/libavformat/version.h b/libavformat/version.h index f777063178..b21938aaef 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -23,8 +23,8 @@ #include "libavutil/avutil.h" -#define LIBAVFORMAT_VERSION_MAJOR 52 -#define LIBAVFORMAT_VERSION_MINOR 108 +#define LIBAVFORMAT_VERSION_MAJOR 53 +#define LIBAVFORMAT_VERSION_MINOR 0 #define LIBAVFORMAT_VERSION_MICRO 0 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ diff --git a/libavutil/avutil.h b/libavutil/avutil.h index 4c86be1b86..6f2517c092 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -39,9 +39,9 @@ #define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) -#define LIBAVUTIL_VERSION_MAJOR 50 -#define LIBAVUTIL_VERSION_MINOR 40 -#define LIBAVUTIL_VERSION_MICRO 1 +#define LIBAVUTIL_VERSION_MAJOR 51 +#define LIBAVUTIL_VERSION_MINOR 0 +#define LIBAVUTIL_VERSION_MICRO 0 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ diff --git a/libpostproc/postprocess.h b/libpostproc/postprocess.h index 96a1dbea19..9e74589455 100644 --- a/libpostproc/postprocess.h +++ b/libpostproc/postprocess.h @@ -29,8 +29,8 @@ #include "libavutil/avutil.h" -#define LIBPOSTPROC_VERSION_MAJOR 51 -#define LIBPOSTPROC_VERSION_MINOR 2 +#define LIBPOSTPROC_VERSION_MAJOR 52 +#define LIBPOSTPROC_VERSION_MINOR 0 #define LIBPOSTPROC_VERSION_MICRO 0 #define LIBPOSTPROC_VERSION_INT AV_VERSION_INT(LIBPOSTPROC_VERSION_MAJOR, \ diff --git a/libswscale/swscale.h b/libswscale/swscale.h index aae1a6cc7e..5b0802c972 100644 --- a/libswscale/swscale.h +++ b/libswscale/swscale.h @@ -29,8 +29,8 @@ #include "libavutil/avutil.h" -#define LIBSWSCALE_VERSION_MAJOR 0 -#define LIBSWSCALE_VERSION_MINOR 12 +#define LIBSWSCALE_VERSION_MAJOR 1 +#define LIBSWSCALE_VERSION_MINOR 0 #define LIBSWSCALE_VERSION_MICRO 0 #define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \ From facc48f157a282e9d99a9bf65f5985bace4606b9 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Mon, 18 Apr 2011 22:12:50 +0200 Subject: [PATCH 02/37] libvo-aacenc,libvo-amrwbenc}: fix api usage Use the correct error codes and format identifier. --- libavcodec/libvo-aacenc.c | 8 ++++---- libavcodec/libvo-amrwbenc.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/libvo-aacenc.c b/libavcodec/libvo-aacenc.c index f2a19a1814..5a75bcbbb4 100644 --- a/libavcodec/libvo-aacenc.c +++ b/libavcodec/libvo-aacenc.c @@ -59,7 +59,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) if (s->codec_api.SetParam(s->handle, VO_PID_AAC_ENCPARAM, ¶ms) != VO_ERR_NONE) { av_log(avctx, AV_LOG_ERROR, "Unable to set encoding parameters\n"); - return AVERROR_UNKNOWN; + return AVERROR(EINVAL); } for (index = 0; index < 16; index++) @@ -68,7 +68,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) if (index == 16) { av_log(avctx, AV_LOG_ERROR, "Unsupported sample rate %d\n", avctx->sample_rate); - return AVERROR_NOTSUPP; + return AVERROR(ENOSYS); } if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) { avctx->extradata_size = 2; @@ -110,14 +110,14 @@ static int aac_encode_frame(AVCodecContext *avctx, if (s->codec_api.GetOutputData(s->handle, &output, &output_info) != VO_ERR_NONE) { av_log(avctx, AV_LOG_ERROR, "Unable to encode frame\n"); - return AVERROR_UNKNOWN; + return AVERROR(EINVAL); } return output.Length; } AVCodec ff_libvo_aacenc_encoder = { "libvo_aacenc", - CODEC_TYPE_AUDIO, + AVMEDIA_TYPE_AUDIO, CODEC_ID_AAC, sizeof(AACContext), aac_encode_init, diff --git a/libavcodec/libvo-amrwbenc.c b/libavcodec/libvo-amrwbenc.c index d8a6099561..b3615ede42 100644 --- a/libavcodec/libvo-amrwbenc.c +++ b/libavcodec/libvo-amrwbenc.c @@ -119,7 +119,7 @@ static int amr_wb_encode_frame(AVCodecContext *avctx, AVCodec ff_libvo_amrwbenc_encoder = { "libvo_amrwbenc", - CODEC_TYPE_AUDIO, + AVMEDIA_TYPE_AUDIO, CODEC_ID_AMR_WB, sizeof(AMRWBContext), amr_wb_encode_init, From d11818eff42681eec9b8106e317a95766506821a Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Mon, 18 Apr 2011 23:12:40 +0200 Subject: [PATCH 03/37] Remove now obsolete references to _g-suffixed binaries. Automatic stripping of binaries was removed in commit e0be794 and the _g binaries disappeared along with it. --- doc/faq.texi | 6 ------ tests/copycooker.sh | 4 ++-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/doc/faq.texi b/doc/faq.texi index 3daf44fe7a..a29af1e1ad 100644 --- a/doc/faq.texi +++ b/doc/faq.texi @@ -415,12 +415,6 @@ be rewritten in a formal object language. Further, many of the developers favor straight C; it works for them. For more arguments on this matter, read "Programming Religion" at (@url{http://www.tux.org/lkml/#s15}). -@section Why are the ffmpeg programs devoid of debugging symbols? - -The build process creates ffmpeg_g, ffplay_g, etc. which contain full debug -information. Those binaries are stripped to create ffmpeg, ffplay, etc. If -you need the debug information, use the *_g versions. - @section I do not like the LGPL, can I contribute code under the GPL instead? Yes, as long as the code is optional and can easily and cleanly be placed diff --git a/tests/copycooker.sh b/tests/copycooker.sh index 4b5811dcf6..3118e3f842 100755 --- a/tests/copycooker.sh +++ b/tests/copycooker.sh @@ -13,8 +13,8 @@ rm -f $logfile for i in $list ; do echo ---------------- >> $logfile echo $i >> $logfile - ./ffmpeg_g -flags +bitexact -i $i -acodec copy -vcodec copy -y first.nut - ./ffmpeg_g -flags +bitexact -i first.nut -acodec copy -vcodec copy -y second.nut + ./ffmpeg -flags +bitexact -i $i -acodec copy -vcodec copy -y first.nut + ./ffmpeg -flags +bitexact -i first.nut -acodec copy -vcodec copy -y second.nut cmp first.nut second.nut >> $logfile md5sum first.nut >> $logfile done From 151cd4f98225c0c5cab8fb29e1dbc0719f7f67e3 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Tue, 19 Apr 2011 08:47:59 +0200 Subject: [PATCH 04/37] pcm: Add const to cast in ENCODE macro. This fixes a lot of warnings of the sort: libavcodec/pcm.c:105: warning: cast discards qualifiers from pointer target type --- libavcodec/pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index e2a733495e..9100646179 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -71,7 +71,7 @@ static av_cold int pcm_encode_close(AVCodecContext *avctx) * @param offset Sample value offset */ #define ENCODE(type, endian, src, dst, n, shift, offset) \ - samples_##type = (type*)src; \ + samples_##type = (const type*) src; \ for(;n>0;n--) { \ register type v = (*samples_##type++ >> shift) + offset; \ bytestream_put_##endian(&dst, v); \ From aad2f2f477d6804f5f79ccce55b3d7f54b00f715 Mon Sep 17 00:00:00 2001 From: Kostya Date: Mon, 18 Apr 2011 05:32:14 +0000 Subject: [PATCH 05/37] document introduction of side data in APIchanges this should've been written earlier, sorry Signed-off-by: Anton Khirnov --- doc/APIchanges | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/APIchanges b/doc/APIchanges index 11a8b51b7e..2c0d58519e 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -12,6 +12,11 @@ libavutil: 2009-03-08 API changes, most recent first: +2011-04-15 - lavc 52.120.0 - avcodec.h + AVPacket structure got additional members for passing side information: + 4de339e introduce side information for AVPacket + 2d8591c make containers pass palette change in AVPacket + 2011-04-12 - lavf 52.107.0 - avio.h Avio cleanup, part II - deprecate the entire URLContext API: 175389c add avio_check as a replacement for url_exist From 761ad429680637411882552921a9d5acb6aff59e Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 12:25:54 +0100 Subject: [PATCH 06/37] lavf: remove FF_API_MAX_STREAMS cruft --- ffmpeg.c | 2 -- ffserver.c | 6 ------ libavformat/avformat.h | 8 -------- libavformat/mms.c | 4 ---- libavformat/mpegts.c | 5 ----- libavformat/nutdec.c | 4 ---- libavformat/utils.c | 8 -------- libavformat/version.h | 3 --- 8 files changed, 40 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index 80d2cca2b7..1ffb21102b 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -106,9 +106,7 @@ typedef struct AVChapterMap { static const OptionDef options[]; #define MAX_FILES 100 -#if !FF_API_MAX_STREAMS #define MAX_STREAMS 1024 /* arbitrary sanity check value */ -#endif #define FFM_PACKET_SIZE 4096 //XXX a duplicate of the line in ffm.h diff --git a/ffserver.c b/ffserver.c index 36cd9cedbc..079be03994 100644 --- a/ffserver.c +++ b/ffserver.c @@ -95,9 +95,7 @@ static const char *http_state[] = { "RTSP_SEND_PACKET", }; -#if !FF_API_MAX_STREAMS #define MAX_STREAMS 20 -#endif #define IOBUFFER_INIT_SIZE 8192 @@ -2944,11 +2942,9 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer, snprintf(avc->filename, 1024, "rtp://0.0.0.0"); } -#if !FF_API_MAX_STREAMS if (avc->nb_streams >= INT_MAX/sizeof(*avc->streams) || !(avc->streams = av_malloc(avc->nb_streams * sizeof(*avc->streams)))) goto sdp_done; -#endif if (avc->nb_streams >= INT_MAX/sizeof(*avs) || !(avs = av_malloc(avc->nb_streams * sizeof(*avs)))) goto sdp_done; @@ -2961,9 +2957,7 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer, av_sdp_create(&avc, 1, *pbuffer, 2048); sdp_done: -#if !FF_API_MAX_STREAMS av_free(avc->streams); -#endif av_metadata_free(&avc->metadata); av_free(avc); av_free(avs); diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 55808f13b8..6f7b6a5116 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -672,10 +672,6 @@ typedef struct AVChapter { AVMetadata *metadata; } AVChapter; -#if FF_API_MAX_STREAMS -#define MAX_STREAMS 20 -#endif - /** * Format I/O context. * New fields can be added to the end with minor version bumps. @@ -691,11 +687,7 @@ typedef struct AVFormatContext { void *priv_data; AVIOContext *pb; unsigned int nb_streams; -#if FF_API_MAX_STREAMS - AVStream *streams[MAX_STREAMS]; -#else AVStream **streams; -#endif char filename[1024]; /**< input or output filename */ /* stream info */ int64_t timestamp; diff --git a/libavformat/mms.c b/libavformat/mms.c index 5796663253..192e7039af 100644 --- a/libavformat/mms.c +++ b/libavformat/mms.c @@ -24,11 +24,7 @@ #include "asf.h" #include "libavutil/intreadwrite.h" -#if FF_API_MAX_STREAMS -#define MMS_MAX_STREAMS MAX_STREAMS -#else #define MMS_MAX_STREAMS 256 /**< arbitrary sanity check value */ -#endif int ff_mms_read_header(MMSContext *mms, uint8_t *buf, const int size) { diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 62e9dcbbd9..d7f2c0c957 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -675,11 +675,6 @@ static int mpegts_push_data(MpegTSFilter *filter, code == 0x1be) /* padding_stream */ goto skip; -#if FF_API_MAX_STREAMS - if (!pes->st && pes->stream->nb_streams == MAX_STREAMS) - goto skip; -#endif - /* stream not present in PMT */ if (!pes->st) { pes->st = av_new_stream(ts->stream, pes->pid); diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index d3804f2993..0a1ed554e3 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -30,11 +30,7 @@ #undef NDEBUG #include -#if FF_API_MAX_STREAMS -#define NUT_MAX_STREAMS MAX_STREAMS -#else #define NUT_MAX_STREAMS 256 /* arbitrary sanity check value */ -#endif static int get_str(AVIOContext *bc, char *string, unsigned int maxlen){ unsigned int len= ffio_read_varlen(bc); diff --git a/libavformat/utils.c b/libavformat/utils.c index 6b38e66bc5..a1336179f1 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2660,13 +2660,6 @@ AVStream *av_new_stream(AVFormatContext *s, int id) { AVStream *st; int i; - -#if FF_API_MAX_STREAMS - if (s->nb_streams >= MAX_STREAMS){ - av_log(s, AV_LOG_ERROR, "Too many streams\n"); - return NULL; - } -#else AVStream **streams; if (s->nb_streams >= INT_MAX/sizeof(*streams)) @@ -2675,7 +2668,6 @@ AVStream *av_new_stream(AVFormatContext *s, int id) if (!streams) return NULL; s->streams = streams; -#endif st = av_mallocz(sizeof(AVStream)); if (!st) diff --git a/libavformat/version.h b/libavformat/version.h index b21938aaef..bf1ae5bff8 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -41,9 +41,6 @@ * Those FF_API_* defines are not part of public API. * They may change, break or disappear at any time. */ -#ifndef FF_API_MAX_STREAMS -#define FF_API_MAX_STREAMS (LIBAVFORMAT_VERSION_MAJOR < 53) -#endif #ifndef FF_API_OLD_METADATA #define FF_API_OLD_METADATA (LIBAVFORMAT_VERSION_MAJOR < 53) #endif From 575c18da1b5053e244ccbfbcced176b5a63dbb25 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 12:30:16 +0100 Subject: [PATCH 07/37] lavf: remove FF_API_OLD_METADATA cruft --- libavformat/Makefile | 1 - libavformat/avformat.h | 39 --------- libavformat/metadata.c | 7 -- libavformat/metadata.h | 5 -- libavformat/metadata_compat.c | 148 ---------------------------------- libavformat/options.c | 4 - libavformat/utils.c | 21 ----- libavformat/version.h | 3 - 8 files changed, 228 deletions(-) delete mode 100644 libavformat/metadata_compat.c diff --git a/libavformat/Makefile b/libavformat/Makefile index 0bf2633d66..5e029ed96b 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -10,7 +10,6 @@ OBJS = allformats.o \ id3v1.o \ id3v2.o \ metadata.o \ - metadata_compat.o \ options.o \ os_support.o \ sdp.o \ diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 6f7b6a5116..f3e4fe4842 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -133,20 +133,6 @@ typedef struct AVMetadataConv AVMetadataConv; AVMetadataTag * av_metadata_get(AVMetadata *m, const char *key, const AVMetadataTag *prev, int flags); -#if FF_API_OLD_METADATA -/** - * Set the given tag in *pm, overwriting an existing tag. - * - * @param pm pointer to a pointer to a metadata struct. If *pm is NULL - * a metadata struct is allocated and put in *pm. - * @param key tag key to add to *pm (will be av_strduped) - * @param value tag value to add to *pm (will be av_strduped) - * @return >= 0 on success otherwise an error code <0 - * @deprecated Use av_metadata_set2() instead. - */ -attribute_deprecated int av_metadata_set(AVMetadata **pm, const char *key, const char *value); -#endif - /** * Set the given tag in *pm, overwriting an existing tag. * @@ -544,10 +530,6 @@ typedef struct AVStream { */ int64_t duration; -#if FF_API_OLD_METADATA - attribute_deprecated char language[4]; /**< ISO 639-2/B 3-letter language code (empty string if undefined) */ -#endif - /* av_read_frame() support */ enum AVStreamParseType need_parsing; struct AVCodecParserContext *parser; @@ -567,10 +549,6 @@ typedef struct AVStream { attribute_deprecated int64_t unused[4+1]; #endif -#if FF_API_OLD_METADATA - attribute_deprecated char *filename; /**< source filename of the stream */ -#endif - int disposition; /**< AV_DISPOSITION_* bit field */ AVProbeData probe_data; @@ -648,10 +626,6 @@ typedef struct AVStream { */ typedef struct AVProgram { int id; -#if FF_API_OLD_METADATA - attribute_deprecated char *provider_name; ///< network name for DVB streams - attribute_deprecated char *name; ///< service name for DVB streams -#endif int flags; enum AVDiscard discard; ///< selects which program to discard and which to feed to the caller unsigned int *stream_index; @@ -666,9 +640,6 @@ typedef struct AVChapter { int id; ///< unique ID to identify the chapter AVRational time_base; ///< time base in which the start/end timestamps are specified int64_t start, end; ///< chapter start/end time in time_base units -#if FF_API_OLD_METADATA - attribute_deprecated char *title; ///< chapter title -#endif AVMetadata *metadata; } AVChapter; @@ -691,16 +662,6 @@ typedef struct AVFormatContext { char filename[1024]; /**< input or output filename */ /* stream info */ int64_t timestamp; -#if FF_API_OLD_METADATA - attribute_deprecated char title[512]; - attribute_deprecated char author[512]; - attribute_deprecated char copyright[512]; - attribute_deprecated char comment[512]; - attribute_deprecated char album[512]; - attribute_deprecated int year; /**< ID3 year, 0 if none */ - attribute_deprecated int track; /**< track number, 0 if none */ - attribute_deprecated char genre[32]; /**< ID3 genre */ -#endif int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */ /* private data for pts handling (do not modify directly). */ diff --git a/libavformat/metadata.c b/libavformat/metadata.c index 36a9342882..f0275462fe 100644 --- a/libavformat/metadata.c +++ b/libavformat/metadata.c @@ -86,13 +86,6 @@ int av_metadata_set2(AVMetadata **pm, const char *key, const char *value, int fl return 0; } -#if FF_API_OLD_METADATA -int av_metadata_set(AVMetadata **pm, const char *key, const char *value) -{ - return av_metadata_set2(pm, key, value, 0); -} -#endif - #if FF_API_OLD_METADATA2 void av_metadata_conv(AVFormatContext *ctx, const AVMetadataConv *d_conv, const AVMetadataConv *s_conv) diff --git a/libavformat/metadata.h b/libavformat/metadata.h index 43eace8e39..09066b8c8d 100644 --- a/libavformat/metadata.h +++ b/libavformat/metadata.h @@ -43,11 +43,6 @@ struct AVMetadataConv{ typedef struct AVMetadataConv AVMetadataConv; #endif -#if FF_API_OLD_METADATA -void ff_metadata_demux_compat(AVFormatContext *s); -void ff_metadata_mux_compat(AVFormatContext *s); -#endif - void ff_metadata_conv(AVMetadata **pm, const AVMetadataConv *d_conv, const AVMetadataConv *s_conv); void ff_metadata_conv_ctx(AVFormatContext *ctx, const AVMetadataConv *d_conv, diff --git a/libavformat/metadata_compat.c b/libavformat/metadata_compat.c deleted file mode 100644 index bb73258707..0000000000 --- a/libavformat/metadata_compat.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2009 Aurelien Jacobs - * - * This file is part of Libav. - * - * Libav is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * Libav is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include "avformat.h" -#include "metadata.h" -#include "libavutil/avstring.h" - -#if FF_API_OLD_METADATA - -#define SIZE_OFFSET(x) sizeof(((AVFormatContext*)0)->x),offsetof(AVFormatContext,x) - -static const struct { - const char name[16]; - int size; - int offset; -} compat_tab[] = { - { "title", SIZE_OFFSET(title) }, - { "author", SIZE_OFFSET(author) }, - { "copyright", SIZE_OFFSET(copyright) }, - { "comment", SIZE_OFFSET(comment) }, - { "album", SIZE_OFFSET(album) }, - { "year", SIZE_OFFSET(year) }, - { "track", SIZE_OFFSET(track) }, - { "genre", SIZE_OFFSET(genre) }, - - { "artist", SIZE_OFFSET(author) }, - { "creator", SIZE_OFFSET(author) }, - { "written_by", SIZE_OFFSET(author) }, - { "lead_performer", SIZE_OFFSET(author) }, - { "composer", SIZE_OFFSET(author) }, - { "performer", SIZE_OFFSET(author) }, - { "description", SIZE_OFFSET(comment) }, - { "albumtitle", SIZE_OFFSET(album) }, - { "date", SIZE_OFFSET(year) }, - { "date_written", SIZE_OFFSET(year) }, - { "date_released", SIZE_OFFSET(year) }, - { "tracknumber", SIZE_OFFSET(track) }, - { "part_number", SIZE_OFFSET(track) }, -}; - -void ff_metadata_demux_compat(AVFormatContext *ctx) -{ - AVMetadata *m; - int i, j; - - if ((m = ctx->metadata)) - for (j=0; jcount; j++) - for (i=0; ielems[j].key, compat_tab[i].name)) { - int *ptr = (int *)((char *)ctx+compat_tab[i].offset); - if (*ptr) continue; - if (compat_tab[i].size > sizeof(int)) - av_strlcpy((char *)ptr, m->elems[j].value, compat_tab[i].size); - else - *ptr = atoi(m->elems[j].value); - } - - for (i=0; inb_chapters; i++) - if ((m = ctx->chapters[i]->metadata)) - for (j=0; jcount; j++) - if (!strcasecmp(m->elems[j].key, "title")) { - av_free(ctx->chapters[i]->title); - ctx->chapters[i]->title = av_strdup(m->elems[j].value); - } - - for (i=0; inb_programs; i++) - if ((m = ctx->programs[i]->metadata)) - for (j=0; jcount; j++) { - if (!strcasecmp(m->elems[j].key, "name")) { - av_free(ctx->programs[i]->name); - ctx->programs[i]->name = av_strdup(m->elems[j].value); - } - if (!strcasecmp(m->elems[j].key, "provider_name")) { - av_free(ctx->programs[i]->provider_name); - ctx->programs[i]->provider_name = av_strdup(m->elems[j].value); - } - } - - for (i=0; inb_streams; i++) - if ((m = ctx->streams[i]->metadata)) - for (j=0; jcount; j++) { - if (!strcasecmp(m->elems[j].key, "language")) - av_strlcpy(ctx->streams[i]->language, m->elems[j].value, 4); - if (!strcasecmp(m->elems[j].key, "filename")) { - av_free(ctx->streams[i]->filename); - ctx->streams[i]->filename= av_strdup(m->elems[j].value); - } - } -} - - -#define FILL_METADATA(s, key, value) { \ - if (!av_metadata_get(s->metadata, #key, NULL, 0)) \ - av_metadata_set2(&s->metadata, #key, value, 0); \ - } -#define FILL_METADATA_STR(s, key) { \ - if (s->key && *s->key) FILL_METADATA(s, key, s->key); } -#define FILL_METADATA_INT(s, key) { \ - char number[10]; \ - snprintf(number, sizeof(number), "%d", s->key); \ - if(s->key) FILL_METADATA(s, key, number) } - -void ff_metadata_mux_compat(AVFormatContext *ctx) -{ - int i; - - if (ctx->metadata && ctx->metadata->count > 0) - return; - - FILL_METADATA_STR(ctx, title); - FILL_METADATA_STR(ctx, author); - FILL_METADATA_STR(ctx, copyright); - FILL_METADATA_STR(ctx, comment); - FILL_METADATA_STR(ctx, album); - FILL_METADATA_INT(ctx, year); - FILL_METADATA_INT(ctx, track); - FILL_METADATA_STR(ctx, genre); - for (i=0; inb_chapters; i++) - FILL_METADATA_STR(ctx->chapters[i], title); - for (i=0; inb_programs; i++) { - FILL_METADATA_STR(ctx->programs[i], name); - FILL_METADATA_STR(ctx->programs[i], provider_name); - } - for (i=0; inb_streams; i++) { - FILL_METADATA_STR(ctx->streams[i], language); - FILL_METADATA_STR(ctx->streams[i], filename); - } -} - -#endif /* FF_API_OLD_METADATA */ diff --git a/libavformat/options.c b/libavformat/options.c index beaafd8ab3..40edcec762 100644 --- a/libavformat/options.c +++ b/libavformat/options.c @@ -50,10 +50,6 @@ static const AVOption options[]={ {"noparse", "disable AVParsers, this needs nofillin too", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_NOPARSE, INT_MIN, INT_MAX, D, "fflags"}, {"igndts", "ignore dts", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_IGNDTS, INT_MIN, INT_MAX, D, "fflags"}, {"rtphint", "add rtp hinting", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_RTP_HINT, INT_MIN, INT_MAX, E, "fflags"}, -#if FF_API_OLD_METADATA -{"track", " set the track number", OFFSET(track), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, E}, -{"year", "set the year", OFFSET(year), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, E}, -#endif {"analyzeduration", "how many microseconds are analyzed to estimate duration", OFFSET(max_analyze_duration), FF_OPT_TYPE_INT, 5*AV_TIME_BASE, 0, INT_MAX, D}, {"cryptokey", "decryption key", OFFSET(key), FF_OPT_TYPE_BINARY, 0, 0, 0, D}, {"indexmem", "max memory used for timestamp index (per stream)", OFFSET(max_index_size), FF_OPT_TYPE_INT, 1<<20, 0, INT_MAX, D}, diff --git a/libavformat/utils.c b/libavformat/utils.c index a1336179f1..cf8f9fae63 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -508,10 +508,6 @@ int av_open_input_stream(AVFormatContext **ic_ptr, if (pb && !ic->data_offset) ic->data_offset = avio_tell(ic->pb); -#if FF_API_OLD_METADATA - ff_metadata_demux_compat(ic); -#endif - ic->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE; *ic_ptr = ic; @@ -2617,18 +2613,11 @@ void avformat_free_context(AVFormatContext *s) av_free(st->codec->extradata); av_free(st->codec->subtitle_header); av_free(st->codec); -#if FF_API_OLD_METADATA - av_free(st->filename); -#endif av_free(st->priv_data); av_free(st->info); av_free(st); } for(i=s->nb_programs-1; i>=0; i--) { -#if FF_API_OLD_METADATA - av_freep(&s->programs[i]->provider_name); - av_freep(&s->programs[i]->name); -#endif av_metadata_free(&s->programs[i]->metadata); av_freep(&s->programs[i]->stream_index); av_freep(&s->programs[i]); @@ -2636,9 +2625,6 @@ void avformat_free_context(AVFormatContext *s) av_freep(&s->programs); av_freep(&s->priv_data); while(s->nb_chapters--) { -#if FF_API_OLD_METADATA - av_free(s->chapters[s->nb_chapters]->title); -#endif av_metadata_free(&s->chapters[s->nb_chapters]->metadata); av_free(s->chapters[s->nb_chapters]); } @@ -2747,9 +2733,6 @@ AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base, int6 return NULL; dynarray_add(&s->chapters, &s->nb_chapters, chapter); } -#if FF_API_OLD_METADATA - av_free(chapter->title); -#endif av_metadata_set2(&chapter->metadata, "title", title, 0); chapter->id = id; chapter->time_base= time_base; @@ -2887,10 +2870,6 @@ int av_write_header(AVFormatContext *s) return AVERROR(ENOMEM); } -#if FF_API_OLD_METADATA - ff_metadata_mux_compat(s); -#endif - /* set muxer identification string */ if (s->nb_streams && !(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) { av_metadata_set2(&s->metadata, "encoder", LIBAVFORMAT_IDENT, 0); diff --git a/libavformat/version.h b/libavformat/version.h index bf1ae5bff8..8f0316b05d 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -41,9 +41,6 @@ * Those FF_API_* defines are not part of public API. * They may change, break or disappear at any time. */ -#ifndef FF_API_OLD_METADATA -#define FF_API_OLD_METADATA (LIBAVFORMAT_VERSION_MAJOR < 53) -#endif #ifndef FF_API_OLD_METADATA2 #define FF_API_OLD_METADATA2 (LIBAVFORMAT_VERSION_MAJOR < 54) #endif From 468644f6c185c23affcb36939192b03cd166797f Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 12:32:59 +0100 Subject: [PATCH 08/37] lavf: remove FF_API_URL_RESETBUF cruft --- libavformat/avio.h | 8 -------- libavformat/aviobuf.c | 11 ----------- libavformat/version.h | 3 --- 3 files changed, 22 deletions(-) diff --git a/libavformat/avio.h b/libavformat/avio.h index f4674a43be..213baaab72 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -542,14 +542,6 @@ int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen); int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen); -#if FF_API_URL_RESETBUF -/** Reset the buffer for reading or writing. - * @note Will drop any data currently in the buffer without transmitting it. - * @param flags URL_RDONLY to set up the buffer for reading, or URL_WRONLY - * to set up the buffer for writing. */ -int url_resetbuf(AVIOContext *s, int flags); -#endif - /** * @defgroup open_modes URL open modes * The flags argument to avio_open must be one of the following diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index cde5f269b5..2bacedbaa7 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -38,9 +38,7 @@ #define SHORT_SEEK_THRESHOLD 4096 static void fill_buffer(AVIOContext *s); -#if !FF_API_URL_RESETBUF static int url_resetbuf(AVIOContext *s, int flags); -#endif int ffio_init_context(AVIOContext *s, unsigned char *buffer, @@ -878,18 +876,9 @@ int ffio_set_buf_size(AVIOContext *s, int buf_size) return 0; } -#if FF_API_URL_RESETBUF -int url_resetbuf(AVIOContext *s, int flags) -#else static int url_resetbuf(AVIOContext *s, int flags) -#endif { -#if FF_API_URL_RESETBUF - if (flags & AVIO_RDWR) - return AVERROR(EINVAL); -#else assert(flags == AVIO_WRONLY || flags == AVIO_RDONLY); -#endif if (flags & AVIO_WRONLY) { s->buf_end = s->buffer + s->buffer_size; diff --git a/libavformat/version.h b/libavformat/version.h index 8f0316b05d..aecc9618d1 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -47,9 +47,6 @@ #ifndef FF_API_URL_CLASS #define FF_API_URL_CLASS (LIBAVFORMAT_VERSION_MAJOR >= 53) #endif -#ifndef FF_API_URL_RESETBUF -#define FF_API_URL_RESETBUF (LIBAVFORMAT_VERSION_MAJOR < 53) -#endif #ifndef FF_API_REGISTER_PROTOCOL #define FF_API_REGISTER_PROTOCOL (LIBAVFORMAT_VERSION_MAJOR < 53) #endif From dcd4a7b62f16793c33fa459889e581286d6ccdd6 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 12:36:18 +0100 Subject: [PATCH 09/37] lavf: remove FF_API_REGISTER_PROTOCOL cruft --- libavformat/avio.c | 23 ----------------------- libavformat/avio.h | 16 ---------------- libavformat/version.h | 3 --- 3 files changed, 42 deletions(-) diff --git a/libavformat/avio.c b/libavformat/avio.c index cb923a726e..c1c2027d5d 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -84,29 +84,6 @@ int ffurl_register_protocol(URLProtocol *protocol, int size) return 0; } -#if FF_API_REGISTER_PROTOCOL -/* The layout of URLProtocol as of when major was bumped to 52 */ -struct URLProtocol_compat { - const char *name; - int (*url_open)(URLContext *h, const char *filename, int flags); - int (*url_read)(URLContext *h, unsigned char *buf, int size); - int (*url_write)(URLContext *h, unsigned char *buf, int size); - int64_t (*url_seek)(URLContext *h, int64_t pos, int whence); - int (*url_close)(URLContext *h); - struct URLProtocol *next; -}; - -int av_register_protocol(URLProtocol *protocol) -{ - return ffurl_register_protocol(protocol, sizeof(struct URLProtocol_compat)); -} - -int register_protocol(URLProtocol *protocol) -{ - return ffurl_register_protocol(protocol, sizeof(struct URLProtocol_compat)); -} -#endif - static int url_alloc_for_protocol (URLContext **puc, struct URLProtocol *up, const char *filename, int flags) { diff --git a/libavformat/avio.h b/libavformat/avio.h index 213baaab72..82c2cece07 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -373,22 +373,6 @@ int avio_check(const char *url, int flags); */ void avio_set_interrupt_cb(int (*interrupt_cb)(void)); -#if FF_API_REGISTER_PROTOCOL -extern URLProtocol *first_protocol; -#endif - -#if FF_API_REGISTER_PROTOCOL -/** - * @deprecated Use av_register_protocol() instead. - */ -attribute_deprecated int register_protocol(URLProtocol *protocol); - -/** - * @deprecated Use av_register_protocol2() instead. - */ -attribute_deprecated int av_register_protocol(URLProtocol *protocol); -#endif - /** * Allocate and initialize an AVIOContext for buffered I/O. It must be later * freed with av_free(). diff --git a/libavformat/version.h b/libavformat/version.h index aecc9618d1..ef253599e4 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -47,9 +47,6 @@ #ifndef FF_API_URL_CLASS #define FF_API_URL_CLASS (LIBAVFORMAT_VERSION_MAJOR >= 53) #endif -#ifndef FF_API_REGISTER_PROTOCOL -#define FF_API_REGISTER_PROTOCOL (LIBAVFORMAT_VERSION_MAJOR < 53) -#endif #ifndef FF_API_GUESS_FORMAT #define FF_API_GUESS_FORMAT (LIBAVFORMAT_VERSION_MAJOR < 53) #endif From 61573bf1ba50dc8828d0e87d913389fbcff48509 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 12:38:05 +0100 Subject: [PATCH 10/37] lavf: remove FF_API_GUESS_FORMAT cruft --- libavformat/avformat.h | 12 ------------ libavformat/utils.c | 29 ----------------------------- libavformat/version.h | 3 --- 3 files changed, 44 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index f3e4fe4842..dae56c6037 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -862,18 +862,6 @@ attribute_deprecated enum CodecID av_guess_image2_codec(const char *filename); /* utils.c */ void av_register_input_format(AVInputFormat *format); void av_register_output_format(AVOutputFormat *format); -#if FF_API_GUESS_FORMAT -attribute_deprecated AVOutputFormat *guess_stream_format(const char *short_name, - const char *filename, - const char *mime_type); - -/** - * @deprecated Use av_guess_format() instead. - */ -attribute_deprecated AVOutputFormat *guess_format(const char *short_name, - const char *filename, - const char *mime_type); -#endif /** * Return the output format in the list of registered output formats diff --git a/libavformat/utils.c b/libavformat/utils.c index cf8f9fae63..80700d4b2b 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -200,14 +200,6 @@ static int match_format(const char *name, const char *names) return !strcasecmp(name, names); } -#if FF_API_GUESS_FORMAT -AVOutputFormat *guess_format(const char *short_name, const char *filename, - const char *mime_type) -{ - return av_guess_format(short_name, filename, mime_type); -} -#endif - AVOutputFormat *av_guess_format(const char *short_name, const char *filename, const char *mime_type) { @@ -243,27 +235,6 @@ AVOutputFormat *av_guess_format(const char *short_name, const char *filename, return fmt_found; } -#if FF_API_GUESS_FORMAT -AVOutputFormat *guess_stream_format(const char *short_name, const char *filename, - const char *mime_type) -{ - AVOutputFormat *fmt = av_guess_format(short_name, filename, mime_type); - - if (fmt) { - AVOutputFormat *stream_fmt; - char stream_format_name[64]; - - snprintf(stream_format_name, sizeof(stream_format_name), "%s_stream", fmt->name); - stream_fmt = av_guess_format(stream_format_name, NULL, NULL); - - if (stream_fmt) - fmt = stream_fmt; - } - - return fmt; -} -#endif - enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, const char *filename, const char *mime_type, enum AVMediaType type){ if(type == AVMEDIA_TYPE_VIDEO){ diff --git a/libavformat/version.h b/libavformat/version.h index ef253599e4..182bfb7814 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -47,9 +47,6 @@ #ifndef FF_API_URL_CLASS #define FF_API_URL_CLASS (LIBAVFORMAT_VERSION_MAJOR >= 53) #endif -#ifndef FF_API_GUESS_FORMAT -#define FF_API_GUESS_FORMAT (LIBAVFORMAT_VERSION_MAJOR < 53) -#endif #ifndef FF_API_UDP_GET_FILE #define FF_API_UDP_GET_FILE (LIBAVFORMAT_VERSION_MAJOR < 53) #endif From c4efa7c22960588ff5163a1cfe026b48b8f6ec41 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 12:39:11 +0100 Subject: [PATCH 11/37] lavf: remove FF_API_UDP_GET_FILE cruft --- libavformat/avio.h | 4 ---- libavformat/udp.c | 5 +---- libavformat/version.h | 3 --- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/libavformat/avio.h b/libavformat/avio.h index 82c2cece07..2502711be5 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -605,10 +605,6 @@ int avio_open_dyn_buf(AVIOContext **s); */ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer); -#if FF_API_UDP_GET_FILE -int udp_get_file_handle(URLContext *h); -#endif - /** * Iterate through names of available protocols. * diff --git a/libavformat/udp.c b/libavformat/udp.c index b881ff95fd..e16dc4c7e0 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -292,10 +292,7 @@ int ff_udp_get_local_port(URLContext *h) * streams at the same time. * @param h media file context */ -#if !FF_API_UDP_GET_FILE -static -#endif -int udp_get_file_handle(URLContext *h) +static int udp_get_file_handle(URLContext *h) { UDPContext *s = h->priv_data; return s->udp_fd; diff --git a/libavformat/version.h b/libavformat/version.h index 182bfb7814..50421495bb 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -47,9 +47,6 @@ #ifndef FF_API_URL_CLASS #define FF_API_URL_CLASS (LIBAVFORMAT_VERSION_MAJOR >= 53) #endif -#ifndef FF_API_UDP_GET_FILE -#define FF_API_UDP_GET_FILE (LIBAVFORMAT_VERSION_MAJOR < 53) -#endif #ifndef FF_API_URL_SPLIT #define FF_API_URL_SPLIT (LIBAVFORMAT_VERSION_MAJOR < 53) #endif From 5048e36c994663f7f4977efc48c3eec601654e5a Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 12:40:25 +0100 Subject: [PATCH 12/37] lavf: remove FF_API_URL_SPLIT cruft --- libavformat/internal.h | 12 ------------ libavformat/utils.c | 18 ------------------ libavformat/version.h | 3 --- 3 files changed, 33 deletions(-) diff --git a/libavformat/internal.h b/libavformat/internal.h index 9bc23402a4..6f1305ce25 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -79,18 +79,6 @@ void ff_read_frame_flush(AVFormatContext *s); /** Get the current time since NTP epoch in microseconds. */ uint64_t ff_ntp_time(void); -#if FF_API_URL_SPLIT -/** - * @deprecated use av_url_split() instead - */ -void ff_url_split(char *proto, int proto_size, - char *authorization, int authorization_size, - char *hostname, int hostname_size, - int *port_ptr, - char *path, int path_size, - const char *url); -#endif - /** * Assemble a URL string from components. This is the reverse operation * of av_url_split. diff --git a/libavformat/utils.c b/libavformat/utils.c index 80700d4b2b..91e0ddca2d 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3517,24 +3517,6 @@ void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload, pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, st->time_base); } -#if FF_API_URL_SPLIT -attribute_deprecated -void ff_url_split(char *proto, int proto_size, - char *authorization, int authorization_size, - char *hostname, int hostname_size, - int *port_ptr, - char *path, int path_size, - const char *url) -{ - av_url_split(proto, proto_size, - authorization, authorization_size, - hostname, hostname_size, - port_ptr, - path, path_size, - url); -} -#endif - void av_url_split(char *proto, int proto_size, char *authorization, int authorization_size, char *hostname, int hostname_size, diff --git a/libavformat/version.h b/libavformat/version.h index 50421495bb..9b8192d96d 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -47,9 +47,6 @@ #ifndef FF_API_URL_CLASS #define FF_API_URL_CLASS (LIBAVFORMAT_VERSION_MAJOR >= 53) #endif -#ifndef FF_API_URL_SPLIT -#define FF_API_URL_SPLIT (LIBAVFORMAT_VERSION_MAJOR < 53) -#endif #ifndef FF_API_ALLOC_FORMAT_CONTEXT #define FF_API_ALLOC_FORMAT_CONTEXT (LIBAVFORMAT_VERSION_MAJOR < 53) #endif From 4df001d77f8f39d2914b21f14ca2236b0ffd6a48 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 12:42:38 +0100 Subject: [PATCH 13/37] lavf: remove FF_API_ALLOC_FORMAT_CONTEXT cruft --- libavformat/avformat.h | 7 ------- libavformat/options.c | 7 ------- libavformat/version.h | 3 --- 3 files changed, 17 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index dae56c6037..3e47285267 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1043,13 +1043,6 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, int buf_size, AVFormatParameters *ap); -#if FF_API_ALLOC_FORMAT_CONTEXT -/** - * @deprecated Use avformat_alloc_context() instead. - */ -attribute_deprecated AVFormatContext *av_alloc_format_context(void); -#endif - /** * Allocate an AVFormatContext. * avformat_free_context() can be used to free the context and everything diff --git a/libavformat/options.c b/libavformat/options.c index 40edcec762..2192ff6575 100644 --- a/libavformat/options.c +++ b/libavformat/options.c @@ -84,10 +84,3 @@ AVFormatContext *avformat_alloc_context(void) ic->av_class = &av_format_context_class; return ic; } - -#if FF_API_ALLOC_FORMAT_CONTEXT -AVFormatContext *av_alloc_format_context(void) -{ - return avformat_alloc_context(); -} -#endif diff --git a/libavformat/version.h b/libavformat/version.h index 9b8192d96d..f87665c205 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -47,9 +47,6 @@ #ifndef FF_API_URL_CLASS #define FF_API_URL_CLASS (LIBAVFORMAT_VERSION_MAJOR >= 53) #endif -#ifndef FF_API_ALLOC_FORMAT_CONTEXT -#define FF_API_ALLOC_FORMAT_CONTEXT (LIBAVFORMAT_VERSION_MAJOR < 53) -#endif #ifndef FF_API_PARSE_FRAME_PARAM #define FF_API_PARSE_FRAME_PARAM (LIBAVFORMAT_VERSION_MAJOR < 53) #endif From 58d5ff0abf657fe0ec3564433ebbde9fc8f71ffd Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 12:44:04 +0100 Subject: [PATCH 14/37] lavf: remove FF_API_PARSE_FRAME_PARAM cruft --- libavformat/avformat.h | 16 ---------------- libavformat/utils.c | 18 ------------------ libavformat/version.h | 3 --- 3 files changed, 37 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 3e47285267..289834627a 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1409,22 +1409,6 @@ void av_dump_format(AVFormatContext *ic, const char *url, int is_output); -#if FF_API_PARSE_FRAME_PARAM -/** - * Parse width and height out of string str. - * @deprecated Use av_parse_video_frame_size instead. - */ -attribute_deprecated int parse_image_size(int *width_ptr, int *height_ptr, - const char *str); - -/** - * Convert framerate from a string to a fraction. - * @deprecated Use av_parse_video_frame_rate instead. - */ -attribute_deprecated int parse_frame_rate(int *frame_rate, int *frame_rate_base, - const char *arg); -#endif - #if FF_API_PARSE_DATE /** * Parse datestr and return a corresponding number of microseconds. diff --git a/libavformat/utils.c b/libavformat/utils.c index 91e0ddca2d..d2f70e17e6 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3320,24 +3320,6 @@ void av_dump_format(AVFormatContext *ic, av_free(printed); } -#if FF_API_PARSE_FRAME_PARAM -#include "libavutil/parseutils.h" - -int parse_image_size(int *width_ptr, int *height_ptr, const char *str) -{ - return av_parse_video_size(width_ptr, height_ptr, str); -} - -int parse_frame_rate(int *frame_rate_num, int *frame_rate_den, const char *arg) -{ - AVRational frame_rate; - int ret = av_parse_video_rate(&frame_rate, arg); - *frame_rate_num= frame_rate.num; - *frame_rate_den= frame_rate.den; - return ret; -} -#endif - int64_t av_gettime(void) { struct timeval tv; diff --git a/libavformat/version.h b/libavformat/version.h index f87665c205..08dc566425 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -47,9 +47,6 @@ #ifndef FF_API_URL_CLASS #define FF_API_URL_CLASS (LIBAVFORMAT_VERSION_MAJOR >= 53) #endif -#ifndef FF_API_PARSE_FRAME_PARAM -#define FF_API_PARSE_FRAME_PARAM (LIBAVFORMAT_VERSION_MAJOR < 53) -#endif #ifndef FF_API_READ_SEEK #define FF_API_READ_SEEK (LIBAVFORMAT_VERSION_MAJOR < 54) #endif From fc2d3a19c54ad6b272eb7d5142148a01568a9b77 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 12:45:30 +0100 Subject: [PATCH 15/37] lavf: remove FF_API_LAVF_UNUSED cruft --- libavformat/avformat.h | 9 --------- libavformat/version.h | 3 --- 2 files changed, 12 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 289834627a..d507c2048b 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -545,10 +545,6 @@ typedef struct AVStream { int64_t nb_frames; ///< number of frames in this stream if known or 0 -#if FF_API_LAVF_UNUSED - attribute_deprecated int64_t unused[4+1]; -#endif - int disposition; /**< AV_DISPOSITION_* bit field */ AVProbeData probe_data; @@ -701,11 +697,6 @@ typedef struct AVFormatContext { /* av_read_frame() support */ AVStream *cur_st; -#if FF_API_LAVF_UNUSED - const uint8_t *cur_ptr_deprecated; - int cur_len_deprecated; - AVPacket cur_pkt_deprecated; -#endif /* av_seek_frame() support */ int64_t data_offset; /**< offset of the first packet */ diff --git a/libavformat/version.h b/libavformat/version.h index 08dc566425..484ebecb9c 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -50,9 +50,6 @@ #ifndef FF_API_READ_SEEK #define FF_API_READ_SEEK (LIBAVFORMAT_VERSION_MAJOR < 54) #endif -#ifndef FF_API_LAVF_UNUSED -#define FF_API_LAVF_UNUSED (LIBAVFORMAT_VERSION_MAJOR < 53) -#endif #ifndef FF_API_PARAMETERS_CODEC_ID #define FF_API_PARAMETERS_CODEC_ID (LIBAVFORMAT_VERSION_MAJOR < 53) #endif From 583f6c67b6edfb6a6202944b8ba98b483826a1ec Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 12:46:12 +0100 Subject: [PATCH 16/37] lavf: remove FF_API_PARAMETERS_CODEC_ID cruft --- libavformat/avformat.h | 4 ---- libavformat/version.h | 3 --- 2 files changed, 7 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index d507c2048b..4ed791b995 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -242,10 +242,6 @@ typedef struct AVFormatParameters { unsigned int initial_pause:1; /**< Do not begin to play the stream immediately (RTSP only). */ unsigned int prealloced_context:1; -#if FF_API_PARAMETERS_CODEC_ID - attribute_deprecated enum CodecID video_codec_id; - attribute_deprecated enum CodecID audio_codec_id; -#endif } AVFormatParameters; //! Demuxer will use avio_open, no opened file should be provided by the caller. diff --git a/libavformat/version.h b/libavformat/version.h index 484ebecb9c..11b8b0529f 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -50,9 +50,6 @@ #ifndef FF_API_READ_SEEK #define FF_API_READ_SEEK (LIBAVFORMAT_VERSION_MAJOR < 54) #endif -#ifndef FF_API_PARAMETERS_CODEC_ID -#define FF_API_PARAMETERS_CODEC_ID (LIBAVFORMAT_VERSION_MAJOR < 53) -#endif #ifndef FF_API_FIRST_FORMAT #define FF_API_FIRST_FORMAT (LIBAVFORMAT_VERSION_MAJOR < 53) #endif From b4c5acabb90cf8e69db2d9f3210d9fa8a7d55ec6 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 12:47:18 +0100 Subject: [PATCH 17/37] lavf: remove FF_API_FIRST_FORMAT cruft --- libavformat/avformat.h | 5 ----- libavformat/utils.c | 10 ++-------- libavformat/version.h | 3 --- 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 4ed791b995..568521311e 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -820,11 +820,6 @@ typedef struct AVPacketList { struct AVPacketList *next; } AVPacketList; -#if FF_API_FIRST_FORMAT -attribute_deprecated extern AVInputFormat *first_iformat; -attribute_deprecated extern AVOutputFormat *first_oformat; -#endif - /** * If f is NULL, returns the first registered input format, * if f is non-NULL, returns the next registered input format after f diff --git a/libavformat/utils.c b/libavformat/utils.c index d2f70e17e6..1359bd3d05 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -115,15 +115,9 @@ static void av_frac_add(AVFrac *f, int64_t incr) } /** head of registered input format linked list */ -#if !FF_API_FIRST_FORMAT -static -#endif -AVInputFormat *first_iformat = NULL; +static AVInputFormat *first_iformat = NULL; /** head of registered output format linked list */ -#if !FF_API_FIRST_FORMAT -static -#endif -AVOutputFormat *first_oformat = NULL; +static AVOutputFormat *first_oformat = NULL; AVInputFormat *av_iformat_next(AVInputFormat *f) { diff --git a/libavformat/version.h b/libavformat/version.h index 11b8b0529f..9499fd6e38 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -50,9 +50,6 @@ #ifndef FF_API_READ_SEEK #define FF_API_READ_SEEK (LIBAVFORMAT_VERSION_MAJOR < 54) #endif -#ifndef FF_API_FIRST_FORMAT -#define FF_API_FIRST_FORMAT (LIBAVFORMAT_VERSION_MAJOR < 53) -#endif #ifndef FF_API_SYMVER #define FF_API_SYMVER (LIBAVFORMAT_VERSION_MAJOR < 53) #endif From 5763e63913940f8d2d2eb8750931e5f12dd2a481 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 12:49:12 +0100 Subject: [PATCH 18/37] lavf: remove FF_API_SYMVER cruft --- libavformat/utils.c | 32 -------------------------------- libavformat/version.h | 3 --- 2 files changed, 35 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 1359bd3d05..1e70b4f592 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -260,38 +260,6 @@ AVInputFormat *av_find_input_format(const char *short_name) return NULL; } -#if FF_API_SYMVER && CONFIG_SHARED && HAVE_SYMVER -FF_SYMVER(void, av_destruct_packet_nofree, (AVPacket *pkt), "LIBAVFORMAT_52") -{ - av_destruct_packet_nofree(pkt); -} - -FF_SYMVER(void, av_destruct_packet, (AVPacket *pkt), "LIBAVFORMAT_52") -{ - av_destruct_packet(pkt); -} - -FF_SYMVER(int, av_new_packet, (AVPacket *pkt, int size), "LIBAVFORMAT_52") -{ - return av_new_packet(pkt, size); -} - -FF_SYMVER(int, av_dup_packet, (AVPacket *pkt), "LIBAVFORMAT_52") -{ - return av_dup_packet(pkt); -} - -FF_SYMVER(void, av_free_packet, (AVPacket *pkt), "LIBAVFORMAT_52") -{ - av_free_packet(pkt); -} - -FF_SYMVER(void, av_init_packet, (AVPacket *pkt), "LIBAVFORMAT_52") -{ - av_log(NULL, AV_LOG_WARNING, "Diverting av_*_packet function calls to libavcodec. Recompile to improve performance\n"); - av_init_packet(pkt); -} -#endif int av_get_packet(AVIOContext *s, AVPacket *pkt, int size) { diff --git a/libavformat/version.h b/libavformat/version.h index 9499fd6e38..735891a1eb 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -50,9 +50,6 @@ #ifndef FF_API_READ_SEEK #define FF_API_READ_SEEK (LIBAVFORMAT_VERSION_MAJOR < 54) #endif -#ifndef FF_API_SYMVER -#define FF_API_SYMVER (LIBAVFORMAT_VERSION_MAJOR < 53) -#endif #ifndef FF_API_OLD_AVIO #define FF_API_OLD_AVIO (LIBAVFORMAT_VERSION_MAJOR < 54) #endif From 7f804085f1be53fac1a28a962c1e34873981b131 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 12:53:28 +0100 Subject: [PATCH 19/37] lavf: remove FF_API_URL_CLASS cruft. --- libavformat/avio.c | 4 --- libavformat/avio.h | 2 -- libavformat/rtmpproto.c | 59 ++++++++++++++++++----------------------- libavformat/version.h | 3 --- 4 files changed, 26 insertions(+), 42 deletions(-) diff --git a/libavformat/avio.c b/libavformat/avio.c index c1c2027d5d..4f8acb01ff 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -31,7 +31,6 @@ #endif #include "url.h" -#if FF_API_URL_CLASS /** @name Logging context. */ /*@{*/ static const char *urlcontext_to_name(void *ptr) @@ -44,7 +43,6 @@ static const AVOption options[] = {{NULL}}; static const AVClass urlcontext_class = { "URLContext", urlcontext_to_name, options, LIBAVUTIL_VERSION_INT }; /*@}*/ -#endif static int default_interrupt_cb(void); @@ -99,9 +97,7 @@ static int url_alloc_for_protocol (URLContext **puc, struct URLProtocol *up, err = AVERROR(ENOMEM); goto fail; } -#if FF_API_URL_CLASS uc->av_class = &urlcontext_class; -#endif uc->filename = (char *) &uc[1]; strcpy(uc->filename, filename); uc->prot = up; diff --git a/libavformat/avio.h b/libavformat/avio.h index 2502711be5..62ea42ca96 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -101,9 +101,7 @@ typedef struct { * @deprecated This struct will be made private */ typedef struct URLContext { -#if FF_API_URL_CLASS const AVClass *av_class; ///< information for av_log(). Set by url_open(). -#endif struct URLProtocol *prot; int flags; int is_streamed; /**< true if streamed (no seek possible), default = false */ diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index 9fc5196b2c..3413b62c8b 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -38,13 +38,6 @@ #include "rtmppkt.h" #include "url.h" -/* we can't use av_log() with URLContext yet... */ -#if FF_API_URL_CLASS -#define LOG_CONTEXT s -#else -#define LOG_CONTEXT NULL -#endif - //#define DEBUG /** RTMP protocol handler state */ @@ -166,7 +159,7 @@ static void gen_release_stream(URLContext *s, RTMPContext *rt) ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0, 29 + strlen(rt->playpath)); - av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Releasing stream...\n"); + av_log(s, AV_LOG_DEBUG, "Releasing stream...\n"); p = pkt.data; ff_amf_write_string(&p, "releaseStream"); ff_amf_write_number(&p, 2.0); @@ -189,7 +182,7 @@ static void gen_fcpublish_stream(URLContext *s, RTMPContext *rt) ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0, 25 + strlen(rt->playpath)); - av_log(LOG_CONTEXT, AV_LOG_DEBUG, "FCPublish stream...\n"); + av_log(s, AV_LOG_DEBUG, "FCPublish stream...\n"); p = pkt.data; ff_amf_write_string(&p, "FCPublish"); ff_amf_write_number(&p, 3.0); @@ -212,7 +205,7 @@ static void gen_fcunpublish_stream(URLContext *s, RTMPContext *rt) ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0, 27 + strlen(rt->playpath)); - av_log(LOG_CONTEXT, AV_LOG_DEBUG, "UnPublishing stream...\n"); + av_log(s, AV_LOG_DEBUG, "UnPublishing stream...\n"); p = pkt.data; ff_amf_write_string(&p, "FCUnpublish"); ff_amf_write_number(&p, 5.0); @@ -232,7 +225,7 @@ static void gen_create_stream(URLContext *s, RTMPContext *rt) RTMPPacket pkt; uint8_t *p; - av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Creating stream...\n"); + av_log(s, AV_LOG_DEBUG, "Creating stream...\n"); ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0, 25); p = pkt.data; @@ -254,7 +247,7 @@ static void gen_delete_stream(URLContext *s, RTMPContext *rt) RTMPPacket pkt; uint8_t *p; - av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Deleting stream...\n"); + av_log(s, AV_LOG_DEBUG, "Deleting stream...\n"); ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0, 34); p = pkt.data; @@ -276,7 +269,7 @@ static void gen_play(URLContext *s, RTMPContext *rt) RTMPPacket pkt; uint8_t *p; - av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Sending play command for '%s'\n", rt->playpath); + av_log(s, AV_LOG_DEBUG, "Sending play command for '%s'\n", rt->playpath); ff_rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0, 20 + strlen(rt->playpath)); pkt.extra = rt->main_channel_id; @@ -310,7 +303,7 @@ static void gen_publish(URLContext *s, RTMPContext *rt) RTMPPacket pkt; uint8_t *p; - av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Sending publish command for '%s'\n", rt->playpath); + av_log(s, AV_LOG_DEBUG, "Sending publish command for '%s'\n", rt->playpath); ff_rtmp_packet_create(&pkt, RTMP_SOURCE_CHANNEL, RTMP_PT_INVOKE, 0, 30 + strlen(rt->playpath)); pkt.extra = rt->main_channel_id; @@ -478,7 +471,7 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt) int server_pos, client_pos; uint8_t digest[32]; - av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Handshaking...\n"); + av_log(s, AV_LOG_DEBUG, "Handshaking...\n"); av_lfg_init(&rnd, 0xDEADC0DE); // generate handshake packet - 1536 bytes of pseudorandom data @@ -489,16 +482,16 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt) ffurl_write(rt->stream, tosend, RTMP_HANDSHAKE_PACKET_SIZE + 1); i = ffurl_read_complete(rt->stream, serverdata, RTMP_HANDSHAKE_PACKET_SIZE + 1); if (i != RTMP_HANDSHAKE_PACKET_SIZE + 1) { - av_log(LOG_CONTEXT, AV_LOG_ERROR, "Cannot read RTMP handshake response\n"); + av_log(s, AV_LOG_ERROR, "Cannot read RTMP handshake response\n"); return -1; } i = ffurl_read_complete(rt->stream, clientdata, RTMP_HANDSHAKE_PACKET_SIZE); if (i != RTMP_HANDSHAKE_PACKET_SIZE) { - av_log(LOG_CONTEXT, AV_LOG_ERROR, "Cannot read RTMP handshake response\n"); + av_log(s, AV_LOG_ERROR, "Cannot read RTMP handshake response\n"); return -1; } - av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Server version %d.%d.%d.%d\n", + av_log(s, AV_LOG_DEBUG, "Server version %d.%d.%d.%d\n", serverdata[5], serverdata[6], serverdata[7], serverdata[8]); if (rt->is_input && serverdata[5] >= 3) { @@ -506,7 +499,7 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt) if (!server_pos) { server_pos = rtmp_validate_digest(serverdata + 1, 8); if (!server_pos) { - av_log(LOG_CONTEXT, AV_LOG_ERROR, "Server response validating failed\n"); + av_log(s, AV_LOG_ERROR, "Server response validating failed\n"); return -1; } } @@ -518,7 +511,7 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt) digest, 32, digest); if (memcmp(digest, clientdata + RTMP_HANDSHAKE_PACKET_SIZE - 32, 32)) { - av_log(LOG_CONTEXT, AV_LOG_ERROR, "Signature mismatch\n"); + av_log(s, AV_LOG_ERROR, "Signature mismatch\n"); return -1; } @@ -552,13 +545,13 @@ static int rtmp_parse_result(URLContext *s, RTMPContext *rt, RTMPPacket *pkt) const uint8_t *data_end = pkt->data + pkt->data_size; #ifdef DEBUG - ff_rtmp_packet_dump(LOG_CONTEXT, pkt); + ff_rtmp_packet_dump(s, pkt); #endif switch (pkt->type) { case RTMP_PT_CHUNK_SIZE: if (pkt->data_size != 4) { - av_log(LOG_CONTEXT, AV_LOG_ERROR, + av_log(s, AV_LOG_ERROR, "Chunk size change packet is not 4 bytes long (%d)\n", pkt->data_size); return -1; } @@ -566,10 +559,10 @@ static int rtmp_parse_result(URLContext *s, RTMPContext *rt, RTMPPacket *pkt) ff_rtmp_packet_write(rt->stream, pkt, rt->chunk_size, rt->prev_pkt[1]); rt->chunk_size = AV_RB32(pkt->data); if (rt->chunk_size <= 0) { - av_log(LOG_CONTEXT, AV_LOG_ERROR, "Incorrect chunk size %d\n", rt->chunk_size); + av_log(s, AV_LOG_ERROR, "Incorrect chunk size %d\n", rt->chunk_size); return -1; } - av_log(LOG_CONTEXT, AV_LOG_DEBUG, "New chunk size = %d\n", rt->chunk_size); + av_log(s, AV_LOG_DEBUG, "New chunk size = %d\n", rt->chunk_size); break; case RTMP_PT_PING: t = AV_RB16(pkt->data); @@ -578,12 +571,12 @@ static int rtmp_parse_result(URLContext *s, RTMPContext *rt, RTMPPacket *pkt) break; case RTMP_PT_CLIENT_BW: if (pkt->data_size < 4) { - av_log(LOG_CONTEXT, AV_LOG_ERROR, + av_log(s, AV_LOG_ERROR, "Client bandwidth report packet is less than 4 bytes long (%d)\n", pkt->data_size); return -1; } - av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Client bandwidth = %d\n", AV_RB32(pkt->data)); + av_log(s, AV_LOG_DEBUG, "Client bandwidth = %d\n", AV_RB32(pkt->data)); rt->client_report_size = AV_RB32(pkt->data) >> 1; break; case RTMP_PT_INVOKE: @@ -593,7 +586,7 @@ static int rtmp_parse_result(URLContext *s, RTMPContext *rt, RTMPPacket *pkt) if (!ff_amf_get_field_value(pkt->data + 9, data_end, "description", tmpstr, sizeof(tmpstr))) - av_log(LOG_CONTEXT, AV_LOG_ERROR, "Server error: %s\n",tmpstr); + av_log(s, AV_LOG_ERROR, "Server error: %s\n",tmpstr); return -1; } else if (!memcmp(pkt->data, "\002\000\007_result", 10)) { switch (rt->state) { @@ -624,7 +617,7 @@ static int rtmp_parse_result(URLContext *s, RTMPContext *rt, RTMPPacket *pkt) case STATE_CONNECTING: //extract a number from the result if (pkt->data[10] || pkt->data[19] != 5 || pkt->data[20]) { - av_log(LOG_CONTEXT, AV_LOG_WARNING, "Unexpected reply on connect()\n"); + av_log(s, AV_LOG_WARNING, "Unexpected reply on connect()\n"); } else { rt->main_channel_id = (int) av_int2dbl(AV_RB64(pkt->data + 21)); } @@ -651,7 +644,7 @@ static int rtmp_parse_result(URLContext *s, RTMPContext *rt, RTMPPacket *pkt) if (!t && !strcmp(tmpstr, "error")) { if (!ff_amf_get_field_value(ptr, data_end, "description", tmpstr, sizeof(tmpstr))) - av_log(LOG_CONTEXT, AV_LOG_ERROR, "Server error: %s\n",tmpstr); + av_log(s, AV_LOG_ERROR, "Server error: %s\n",tmpstr); return -1; } t = ff_amf_get_field_value(ptr, data_end, @@ -701,7 +694,7 @@ static int get_packet(URLContext *s, int for_header) } rt->bytes_read += ret; if (rt->bytes_read > rt->last_bytes_read + rt->client_report_size) { - av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Sending bytes read report\n"); + av_log(s, AV_LOG_DEBUG, "Sending bytes read report\n"); gen_bytes_read(s, rt, rpkt.timestamp + 1); rt->last_bytes_read = rt->bytes_read; } @@ -822,7 +815,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags) ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL); if (ffurl_open(&rt->stream, buf, AVIO_RDWR) < 0) { - av_log(LOG_CONTEXT, AV_LOG_ERROR, "Cannot open connection %s\n", buf); + av_log(s, AV_LOG_ERROR, "Cannot open connection %s\n", buf); goto fail; } @@ -866,7 +859,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags) rt->bytes_read = 0; rt->last_bytes_read = 0; - av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Proto = %s, path = %s, app = %s, fname = %s\n", + av_log(s, AV_LOG_DEBUG, "Proto = %s, path = %s, app = %s, fname = %s\n", proto, path, rt->app, rt->playpath); gen_connect(s, rt, proto, hostname, port); @@ -933,7 +926,7 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size) const uint8_t *buf_temp = buf; if (size < 11) { - av_log(LOG_CONTEXT, AV_LOG_DEBUG, "FLV packet too small %d\n", size); + av_log(s, AV_LOG_DEBUG, "FLV packet too small %d\n", size); return 0; } diff --git a/libavformat/version.h b/libavformat/version.h index 735891a1eb..6396164212 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -44,9 +44,6 @@ #ifndef FF_API_OLD_METADATA2 #define FF_API_OLD_METADATA2 (LIBAVFORMAT_VERSION_MAJOR < 54) #endif -#ifndef FF_API_URL_CLASS -#define FF_API_URL_CLASS (LIBAVFORMAT_VERSION_MAJOR >= 53) -#endif #ifndef FF_API_READ_SEEK #define FF_API_READ_SEEK (LIBAVFORMAT_VERSION_MAJOR < 54) #endif From df56d5833959cde9ce60ab43e2923eaaea3287b3 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 12 Apr 2011 20:10:10 +0200 Subject: [PATCH 20/37] lavf: remove FF_API_INDEX_BUILT cruft --- libavformat/avformat.h | 3 --- libavformat/version.h | 3 --- 2 files changed, 6 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 568521311e..2567aabd5a 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -696,9 +696,6 @@ typedef struct AVFormatContext { /* av_seek_frame() support */ int64_t data_offset; /**< offset of the first packet */ -#if FF_API_INDEX_BUILT - attribute_deprecated int index_built; -#endif int mux_rate; unsigned int packet_size; diff --git a/libavformat/version.h b/libavformat/version.h index 6396164212..01730183b2 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -50,9 +50,6 @@ #ifndef FF_API_OLD_AVIO #define FF_API_OLD_AVIO (LIBAVFORMAT_VERSION_MAJOR < 54) #endif -#ifndef FF_API_INDEX_BUILT -#define FF_API_INDEX_BUILT (LIBAVFORMAT_VERSION_MAJOR < 53) -#endif #ifndef FF_API_DUMP_FORMAT #define FF_API_DUMP_FORMAT (LIBAVFORMAT_VERSION_MAJOR < 54) #endif From 32b80696e0637ca7254c35e6195bdc9ebb2352e0 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 13 Apr 2011 08:01:49 +0200 Subject: [PATCH 21/37] lavf: remove misc disabled cruft. --- libavformat/avio.h | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/libavformat/avio.h b/libavformat/avio.h index 62ea42ca96..c63b545d33 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -357,9 +357,6 @@ attribute_deprecated int url_exist(const char *url); * one call to another. Thus you should not trust the returned value, * unless you are sure that no other processes are accessing the * checked resource. - * - * @note This function is slightly broken until next major bump - * because of AVIO_RDONLY == 0. Don't use it until then. */ int avio_check(const char *url, int flags); @@ -530,15 +527,9 @@ int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen); * constants, optionally ORed with other flags. * @{ */ -#if LIBAVFORMAT_VERSION_MAJOR < 53 -#define AVIO_RDONLY 0 /**< read-only */ -#define AVIO_WRONLY 1 /**< write-only */ -#define AVIO_RDWR 2 /**< read-write */ -#else #define AVIO_RDONLY 1 /**< read-only */ #define AVIO_WRONLY 2 /**< write-only */ #define AVIO_RDWR 4 /**< read-write */ -#endif /** * @} */ @@ -555,11 +546,7 @@ int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen); * Warning: non-blocking protocols is work-in-progress; this flag may be * silently ignored. */ -#if LIBAVFORMAT_VERSION_MAJOR < 53 -#define AVIO_FLAG_NONBLOCK 4 -#else #define AVIO_FLAG_NONBLOCK 8 -#endif /** * Create and initialize a AVIOContext for accessing the From 42420e7b946272bc1e4b2aa2a95512c86db02831 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 14:43:53 +0100 Subject: [PATCH 22/37] lavc: remove the FF_API_MM_FLAGS cruft. --- libavcodec/avcodec.h | 19 ------------------- libavcodec/version.h | 3 --- 2 files changed, 22 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index df4e61798e..5d85b4122f 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1740,25 +1740,6 @@ typedef struct AVCodecContext { */ unsigned dsp_mask; -#if FF_API_MM_FLAGS -#define FF_MM_FORCE AV_CPU_FLAG_FORCE -#define FF_MM_MMX AV_CPU_FLAG_MMX -#define FF_MM_3DNOW AV_CPU_FLAG_3DNOW -#define FF_MM_MMXEXT AV_CPU_FLAG_MMX2 -#define FF_MM_MMX2 AV_CPU_FLAG_MMX2 -#define FF_MM_SSE AV_CPU_FLAG_SSE -#define FF_MM_SSE2 AV_CPU_FLAG_SSE2 -#define FF_MM_SSE2SLOW AV_CPU_FLAG_SSE2SLOW -#define FF_MM_3DNOWEXT AV_CPU_FLAG_3DNOWEXT -#define FF_MM_SSE3 AV_CPU_FLAG_SSE3 -#define FF_MM_SSE3SLOW AV_CPU_FLAG_SSE3SLOW -#define FF_MM_SSSE3 AV_CPU_FLAG_SSSE3 -#define FF_MM_SSE4 AV_CPU_FLAG_SSE4 -#define FF_MM_SSE42 AV_CPU_FLAG_SSE42 -#define FF_MM_IWMMXT AV_CPU_FLAG_IWMMXT -#define FF_MM_ALTIVEC AV_CPU_FLAG_ALTIVEC -#endif - /** * bits per sample/pixel from the demuxer (needed for huffyuv). * - encoding: Set by libavcodec. diff --git a/libavcodec/version.h b/libavcodec/version.h index 7e5347404d..2b9856ce8b 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -41,9 +41,6 @@ #ifndef FF_API_PALETTE_CONTROL #define FF_API_PALETTE_CONTROL (LIBAVCODEC_VERSION_MAJOR < 54) #endif -#ifndef FF_API_MM_FLAGS -#define FF_API_MM_FLAGS (LIBAVCODEC_VERSION_MAJOR < 53) -#endif #ifndef FF_API_OPT_SHOW #define FF_API_OPT_SHOW (LIBAVCODEC_VERSION_MAJOR < 53) #endif From 20d33ee8b1d2cf5ba4b4d4a81db0ff7b4a125dd3 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 14:45:22 +0100 Subject: [PATCH 23/37] lavc: remove the FF_API_OPT_SHOW cruft. --- libavcodec/opt.c | 7 ------- libavcodec/opt.h | 6 ------ libavcodec/version.h | 3 --- 3 files changed, 16 deletions(-) diff --git a/libavcodec/opt.c b/libavcodec/opt.c index f41fae0ba1..3b89a3013c 100644 --- a/libavcodec/opt.c +++ b/libavcodec/opt.c @@ -80,10 +80,3 @@ const AVOption *av_set_string(void *obj, const char *name, const char *val){ return o; } #endif - -#if FF_API_OPT_SHOW -int av_opt_show(void *obj, void *av_log_obj){ - return av_opt_show2(obj, av_log_obj, - AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0); -} -#endif diff --git a/libavcodec/opt.h b/libavcodec/opt.h index cf54354096..ece54aad24 100644 --- a/libavcodec/opt.h +++ b/libavcodec/opt.h @@ -45,11 +45,5 @@ attribute_deprecated const AVOption *av_set_string(void *obj, const char *name, */ attribute_deprecated const AVOption *av_set_string2(void *obj, const char *name, const char *val, int alloc); #endif -#if FF_API_OPT_SHOW -/** - * @deprecated Use av_opt_show2() instead. - */ -attribute_deprecated int av_opt_show(void *obj, void *av_log_obj); -#endif #endif /* AVCODEC_OPT_H */ diff --git a/libavcodec/version.h b/libavcodec/version.h index 2b9856ce8b..08574f784b 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -41,9 +41,6 @@ #ifndef FF_API_PALETTE_CONTROL #define FF_API_PALETTE_CONTROL (LIBAVCODEC_VERSION_MAJOR < 54) #endif -#ifndef FF_API_OPT_SHOW -#define FF_API_OPT_SHOW (LIBAVCODEC_VERSION_MAJOR < 53) -#endif #ifndef FF_API_AUDIO_OLD #define FF_API_AUDIO_OLD (LIBAVCODEC_VERSION_MAJOR < 53) #endif From 9b4f1cdb6a7e838c0261109e8a6262e78657ee7b Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 14:48:00 +0100 Subject: [PATCH 24/37] lavc: remove the FF_API_AUDIO_OLD cruft. --- libavcodec/avcodec.h | 27 --------------------------- libavcodec/resample.c | 11 ----------- libavcodec/utils.c | 14 -------------- libavcodec/version.h | 3 --- 4 files changed, 55 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 5d85b4122f..cf3664a973 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3227,14 +3227,6 @@ struct AVResampleContext; typedef struct ReSampleContext ReSampleContext; -#if FF_API_AUDIO_OLD -/** - * @deprecated Use av_audio_resample_init() instead. - */ -attribute_deprecated ReSampleContext *audio_resample_init(int output_channels, int input_channels, - int output_rate, int input_rate); -#endif - /** * Initialize audio resampling context. * @@ -3706,25 +3698,6 @@ int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, */ int avcodec_open(AVCodecContext *avctx, AVCodec *codec); -#if FF_API_AUDIO_OLD -/** - * Decode an audio frame from buf into samples. - * Wrapper function which calls avcodec_decode_audio3. - * - * @deprecated Use avcodec_decode_audio3 instead. - * @param avctx the codec context - * @param[out] samples the output buffer - * @param[in,out] frame_size_ptr the output buffer size in bytes - * @param[in] buf the input buffer - * @param[in] buf_size the input buffer size in bytes - * @return On error a negative value is returned, otherwise the number of bytes - * used or zero if no frame could be decompressed. - */ -attribute_deprecated int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples, - int *frame_size_ptr, - const uint8_t *buf, int buf_size); -#endif - /** * Decode the audio frame of size avpkt->size from avpkt->data into samples. * Some decoders may support multiple frames in a single AVPacket, such diff --git a/libavcodec/resample.c b/libavcodec/resample.c index 8e666894ac..2185a11ad7 100644 --- a/libavcodec/resample.c +++ b/libavcodec/resample.c @@ -218,17 +218,6 @@ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels, return s; } -#if FF_API_AUDIO_OLD -ReSampleContext *audio_resample_init(int output_channels, int input_channels, - int output_rate, int input_rate) -{ - return av_audio_resample_init(output_channels, input_channels, - output_rate, input_rate, - AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16, - TAPS, 10, 0, 0.8); -} -#endif - /* resample audio. 'nb_samples' is the number of input samples */ /* XXX: optimize it ! */ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 6d31254afb..e90be4614d 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -679,20 +679,6 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi return ret; } -#if FF_API_AUDIO_OLD -int attribute_align_arg avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples, - int *frame_size_ptr, - const uint8_t *buf, int buf_size) -{ - AVPacket avpkt; - av_init_packet(&avpkt); - avpkt.data = buf; - avpkt.size = buf_size; - - return avcodec_decode_audio3(avctx, samples, frame_size_ptr, &avpkt); -} -#endif - int attribute_align_arg avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, AVPacket *avpkt) diff --git a/libavcodec/version.h b/libavcodec/version.h index 08574f784b..8c891e248e 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -41,9 +41,6 @@ #ifndef FF_API_PALETTE_CONTROL #define FF_API_PALETTE_CONTROL (LIBAVCODEC_VERSION_MAJOR < 54) #endif -#ifndef FF_API_AUDIO_OLD -#define FF_API_AUDIO_OLD (LIBAVCODEC_VERSION_MAJOR < 53) -#endif #ifndef FF_API_VIDEO_OLD #define FF_API_VIDEO_OLD (LIBAVCODEC_VERSION_MAJOR < 53) #endif From e89e5afdd04a0f081ecc38b528c1147f204027d7 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 14:48:39 +0100 Subject: [PATCH 25/37] lavc: remove the FF_API_VIDEO_OLD cruft. --- libavcodec/avcodec.h | 19 ------------------- libavcodec/utils.c | 16 ---------------- libavcodec/version.h | 3 --- 3 files changed, 38 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index cf3664a973..78dd20822a 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3741,25 +3741,6 @@ int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, AVPacket *avpkt); -#if FF_API_VIDEO_OLD -/** - * Decode a video frame from buf into picture. - * Wrapper function which calls avcodec_decode_video2. - * - * @deprecated Use avcodec_decode_video2 instead. - * @param avctx the codec context - * @param[out] picture The AVFrame in which the decoded video frame will be stored. - * @param[in] buf the input buffer - * @param[in] buf_size the size of the input buffer in bytes - * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero. - * @return On error a negative value is returned, otherwise the number of bytes - * used or zero if no frame could be decompressed. - */ -attribute_deprecated int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, - int *got_picture_ptr, - const uint8_t *buf, int buf_size); -#endif - /** * Decode the video frame of size avpkt->size from avpkt->data into picture. * Some decoders may support multiple frames in a single AVPacket, such diff --git a/libavcodec/utils.c b/libavcodec/utils.c index e90be4614d..89bd4a1f55 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -631,22 +631,6 @@ int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, return ret; } -#if FF_API_VIDEO_OLD -int attribute_align_arg avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, - int *got_picture_ptr, - const uint8_t *buf, int buf_size) -{ - AVPacket avpkt; - av_init_packet(&avpkt); - avpkt.data = buf; - avpkt.size = buf_size; - // HACK for CorePNG to decode as normal PNG by default - avpkt.flags = AV_PKT_FLAG_KEY; - - return avcodec_decode_video2(avctx, picture, got_picture_ptr, &avpkt); -} -#endif - int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt) diff --git a/libavcodec/version.h b/libavcodec/version.h index 8c891e248e..2d460b9744 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -41,9 +41,6 @@ #ifndef FF_API_PALETTE_CONTROL #define FF_API_PALETTE_CONTROL (LIBAVCODEC_VERSION_MAJOR < 54) #endif -#ifndef FF_API_VIDEO_OLD -#define FF_API_VIDEO_OLD (LIBAVCODEC_VERSION_MAJOR < 53) -#endif #ifndef FF_API_SUBTITLE_OLD #define FF_API_SUBTITLE_OLD (LIBAVCODEC_VERSION_MAJOR < 53) #endif From db4d3a7421ec70de0d5ccd8a9f99b46b5c780d23 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 14:50:06 +0100 Subject: [PATCH 26/37] lavc: remove the FF_API_SUBTITLE_OLD cruft. --- libavcodec/avcodec.h | 9 --------- libavcodec/utils.c | 14 -------------- libavcodec/version.h | 3 --- 3 files changed, 26 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 78dd20822a..c47b0065e7 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3785,15 +3785,6 @@ int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt); -#if FF_API_SUBTITLE_OLD -/* Decode a subtitle message. Return -1 if error, otherwise return the - * number of bytes used. If no subtitle could be decompressed, - * got_sub_ptr is zero. Otherwise, the subtitle is stored in *sub. */ -attribute_deprecated int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub, - int *got_sub_ptr, - const uint8_t *buf, int buf_size); -#endif - /** * Decode a subtitle message. * Return a negative value on error, otherwise return the number of bytes used. diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 89bd4a1f55..aa2e55693c 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -692,20 +692,6 @@ int attribute_align_arg avcodec_decode_audio3(AVCodecContext *avctx, int16_t *sa return ret; } -#if FF_API_SUBTITLE_OLD -int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub, - int *got_sub_ptr, - const uint8_t *buf, int buf_size) -{ - AVPacket avpkt; - av_init_packet(&avpkt); - avpkt.data = buf; - avpkt.size = buf_size; - - return avcodec_decode_subtitle2(avctx, sub, got_sub_ptr, &avpkt); -} -#endif - int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, AVPacket *avpkt) diff --git a/libavcodec/version.h b/libavcodec/version.h index 2d460b9744..d3dd04f169 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -41,9 +41,6 @@ #ifndef FF_API_PALETTE_CONTROL #define FF_API_PALETTE_CONTROL (LIBAVCODEC_VERSION_MAJOR < 54) #endif -#ifndef FF_API_SUBTITLE_OLD -#define FF_API_SUBTITLE_OLD (LIBAVCODEC_VERSION_MAJOR < 53) -#endif #ifndef FF_API_USE_LPC #define FF_API_USE_LPC (LIBAVCODEC_VERSION_MAJOR < 53) #endif From 01a4259b8db344586b371528973439109f3e2ace Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 14:51:50 +0100 Subject: [PATCH 27/37] lavc: remove the FF_API_USE_LPC cruft. --- libavcodec/avcodec.h | 10 ---------- libavcodec/flacenc.c | 11 ----------- libavcodec/options.c | 3 --- libavcodec/version.h | 3 --- 4 files changed, 27 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index c47b0065e7..3eac5672b1 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2531,16 +2531,6 @@ typedef struct AVCodecContext { int compression_level; #define FF_COMPRESSION_DEFAULT -1 -#if FF_API_USE_LPC - /** - * Sets whether to use LPC mode - used by FLAC encoder. - * - encoding: Set by user. - * - decoding: unused - * @deprecated Deprecated in favor of lpc_type and lpc_passes. - */ - int use_lpc; -#endif - /** * LPC coefficient precision - used by FLAC encoder * - encoding: Set by user. diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c index d93bfb5be4..f13d5801e2 100644 --- a/libavcodec/flacenc.c +++ b/libavcodec/flacenc.c @@ -285,17 +285,6 @@ static av_cold int flac_encode_init(AVCodecContext *avctx) s->options.max_partition_order = ((int[]){ 2, 2, 3, 3, 3, 8, 8, 8, 8, 8, 8, 8, 8})[level]; /* set compression option overrides from AVCodecContext */ -#if FF_API_USE_LPC - /* for compatibility with deprecated AVCodecContext.use_lpc */ - if (avctx->use_lpc == 0) { - s->options.lpc_type = AV_LPC_TYPE_FIXED; - } else if (avctx->use_lpc == 1) { - s->options.lpc_type = AV_LPC_TYPE_LEVINSON; - } else if (avctx->use_lpc > 1) { - s->options.lpc_type = AV_LPC_TYPE_CHOLESKY; - s->options.lpc_passes = avctx->use_lpc - 1; - } -#endif if (avctx->lpc_type > AV_LPC_TYPE_DEFAULT) { if (avctx->lpc_type > AV_LPC_TYPE_CHOLESKY) { av_log(avctx, AV_LOG_ERROR, "unknown lpc type: %d\n", avctx->lpc_type); diff --git a/libavcodec/options.c b/libavcodec/options.c index 5856f96754..2f9d7d93c7 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -396,9 +396,6 @@ static const AVOption options[]={ {"ivlc", "intra vlc table", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_INTRA_VLC, INT_MIN, INT_MAX, V|E, "flags2"}, {"b_sensitivity", "adjusts sensitivity of b_frame_strategy 1", OFFSET(b_sensitivity), FF_OPT_TYPE_INT, 40, 1, INT_MAX, V|E}, {"compression_level", NULL, OFFSET(compression_level), FF_OPT_TYPE_INT, FF_COMPRESSION_DEFAULT, INT_MIN, INT_MAX, V|A|E}, -#if FF_API_USE_LPC -{"use_lpc", "sets whether to use LPC mode (FLAC)", OFFSET(use_lpc), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E}, -#endif {"lpc_coeff_precision", "LPC coefficient precision (FLAC)", OFFSET(lpc_coeff_precision), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, A|E}, {"min_prediction_order", NULL, OFFSET(min_prediction_order), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E}, {"max_prediction_order", NULL, OFFSET(max_prediction_order), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E}, diff --git a/libavcodec/version.h b/libavcodec/version.h index d3dd04f169..5c81e3a671 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -41,9 +41,6 @@ #ifndef FF_API_PALETTE_CONTROL #define FF_API_PALETTE_CONTROL (LIBAVCODEC_VERSION_MAJOR < 54) #endif -#ifndef FF_API_USE_LPC -#define FF_API_USE_LPC (LIBAVCODEC_VERSION_MAJOR < 53) -#endif #ifndef FF_API_SET_STRING_OLD #define FF_API_SET_STRING_OLD (LIBAVCODEC_VERSION_MAJOR < 53) #endif From 41d0eb1c81c0d266824dfdbd040a54a6afeec81a Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 14:58:59 +0100 Subject: [PATCH 28/37] lavc: remove the FF_API_SET_STRING_OLD cruft. --- cmdutils.c | 2 +- ffmpeg.c | 2 +- ffplay.c | 2 +- ffprobe.c | 2 +- ffserver.c | 2 +- libavcodec/opt.c | 16 --------------- libavcodec/opt.h | 49 -------------------------------------------- libavcodec/version.h | 3 --- libswscale/options.c | 2 +- 9 files changed, 6 insertions(+), 74 deletions(-) delete mode 100644 libavcodec/opt.h diff --git a/cmdutils.c b/cmdutils.c index cc10b48e30..f1cbd55373 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -38,7 +38,7 @@ #include "libavutil/parseutils.h" #include "libavutil/pixdesc.h" #include "libavutil/eval.h" -#include "libavcodec/opt.h" +#include "libavutil/opt.h" #include "cmdutils.h" #include "version.h" #if CONFIG_NETWORK diff --git a/ffmpeg.c b/ffmpeg.c index 1ffb21102b..f5244d98fd 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -34,7 +34,7 @@ #include "libavformat/avformat.h" #include "libavdevice/avdevice.h" #include "libswscale/swscale.h" -#include "libavcodec/opt.h" +#include "libavutil/opt.h" #include "libavcodec/audioconvert.h" #include "libavutil/audioconvert.h" #include "libavutil/parseutils.h" diff --git a/ffplay.c b/ffplay.c index bd8a985eb5..766d5caf9c 100644 --- a/ffplay.c +++ b/ffplay.c @@ -35,7 +35,7 @@ #include "libavdevice/avdevice.h" #include "libswscale/swscale.h" #include "libavcodec/audioconvert.h" -#include "libavcodec/opt.h" +#include "libavutil/opt.h" #include "libavcodec/avfft.h" #if CONFIG_AVFILTER diff --git a/ffprobe.c b/ffprobe.c index 6c672e7623..cc3699bf9b 100644 --- a/ffprobe.c +++ b/ffprobe.c @@ -23,7 +23,7 @@ #include "libavformat/avformat.h" #include "libavcodec/avcodec.h" -#include "libavcodec/opt.h" +#include "libavutil/opt.h" #include "libavutil/pixdesc.h" #include "libavdevice/avdevice.h" #include "cmdutils.h" diff --git a/ffserver.c b/ffserver.c index 079be03994..ec8b773c26 100644 --- a/ffserver.c +++ b/ffserver.c @@ -40,7 +40,7 @@ #include "libavutil/lfg.h" #include "libavutil/random_seed.h" #include "libavutil/parseutils.h" -#include "libavcodec/opt.h" +#include "libavutil/opt.h" #include #include #include diff --git a/libavcodec/opt.c b/libavcodec/opt.c index 3b89a3013c..f2bff96380 100644 --- a/libavcodec/opt.c +++ b/libavcodec/opt.c @@ -64,19 +64,3 @@ FF_SYMVER(void, av_opt_set_defaults2, (void *s, int mask, int flags), "LIBAVCODE return av_opt_set_defaults2(s, mask, flags); } #endif - -#if FF_API_SET_STRING_OLD -const AVOption *av_set_string2(void *obj, const char *name, const char *val, int alloc){ - const AVOption *o; - if (av_set_string3(obj, name, val, alloc, &o) < 0) - return NULL; - return o; -} - -const AVOption *av_set_string(void *obj, const char *name, const char *val){ - const AVOption *o; - if (av_set_string3(obj, name, val, 0, &o) < 0) - return NULL; - return o; -} -#endif diff --git a/libavcodec/opt.h b/libavcodec/opt.h deleted file mode 100644 index ece54aad24..0000000000 --- a/libavcodec/opt.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * AVOptions - * copyright (c) 2005 Michael Niedermayer - * - * This file is part of Libav. - * - * Libav is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * Libav is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_OPT_H -#define AVCODEC_OPT_H - -/** - * @file - * AVOptions - */ - -#include "libavutil/rational.h" -#include "avcodec.h" -#include "libavutil/opt.h" - -#if FF_API_SET_STRING_OLD -/** - * @see av_set_string2() - */ -attribute_deprecated const AVOption *av_set_string(void *obj, const char *name, const char *val); - -/** - * @return a pointer to the AVOption corresponding to the field set or - * NULL if no matching AVOption exists, or if the value val is not - * valid - * @see av_set_string3() - */ -attribute_deprecated const AVOption *av_set_string2(void *obj, const char *name, const char *val, int alloc); -#endif - -#endif /* AVCODEC_OPT_H */ diff --git a/libavcodec/version.h b/libavcodec/version.h index 5c81e3a671..679a38e7e5 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -41,9 +41,6 @@ #ifndef FF_API_PALETTE_CONTROL #define FF_API_PALETTE_CONTROL (LIBAVCODEC_VERSION_MAJOR < 54) #endif -#ifndef FF_API_SET_STRING_OLD -#define FF_API_SET_STRING_OLD (LIBAVCODEC_VERSION_MAJOR < 53) -#endif #ifndef FF_API_INOFFICIAL #define FF_API_INOFFICIAL (LIBAVCODEC_VERSION_MAJOR < 53) #endif diff --git a/libswscale/options.c b/libswscale/options.c index 59b99943db..7cee46076f 100644 --- a/libswscale/options.c +++ b/libswscale/options.c @@ -20,7 +20,7 @@ #include "libavutil/avutil.h" #include "libavutil/pixfmt.h" -#include "libavcodec/opt.h" +#include "libavutil/opt.h" #include "swscale.h" #include "swscale_internal.h" From 251cf997cff7f3869bca043d20ba771e0588cae3 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 3 Feb 2011 15:00:50 +0100 Subject: [PATCH 29/37] lavc: remove the FF_API_INOFFICIAL cruft. --- libavcodec/avcodec.h | 3 --- libavcodec/options.c | 3 --- libavcodec/version.h | 3 --- 3 files changed, 9 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 3eac5672b1..f90aa81ab7 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1464,9 +1464,6 @@ typedef struct AVCodecContext { #define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software. #define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences. #define FF_COMPLIANCE_NORMAL 0 -#if FF_API_INOFFICIAL -#define FF_COMPLIANCE_INOFFICIAL -1 ///< Allow inofficial extensions (deprecated - use FF_COMPLIANCE_UNOFFICIAL instead). -#endif #define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions #define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things. diff --git a/libavcodec/options.c b/libavcodec/options.c index 2f9d7d93c7..3b92497770 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -164,9 +164,6 @@ static const AVOption options[]={ {"very", "strictly conform to a older more strict version of the spec or reference software", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_VERY_STRICT, INT_MIN, INT_MAX, V|D|E, "strict"}, {"strict", "strictly conform to all the things in the spec no matter what consequences", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_STRICT, INT_MIN, INT_MAX, V|D|E, "strict"}, {"normal", NULL, 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_NORMAL, INT_MIN, INT_MAX, V|D|E, "strict"}, -#if FF_API_INOFFICIAL -{"inofficial", "allow unofficial extensions (deprecated - use unofficial)", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_UNOFFICIAL, INT_MIN, INT_MAX, V|D|E, "strict"}, -#endif {"unofficial", "allow unofficial extensions", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_UNOFFICIAL, INT_MIN, INT_MAX, V|D|E, "strict"}, {"experimental", "allow non standardized experimental things", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_EXPERIMENTAL, INT_MIN, INT_MAX, V|D|E, "strict"}, {"b_qoffset", "qp offset between P and B frames", OFFSET(b_quant_offset), FF_OPT_TYPE_FLOAT, 1.25, -FLT_MAX, FLT_MAX, V|E}, diff --git a/libavcodec/version.h b/libavcodec/version.h index 679a38e7e5..3146f765ee 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -41,9 +41,6 @@ #ifndef FF_API_PALETTE_CONTROL #define FF_API_PALETTE_CONTROL (LIBAVCODEC_VERSION_MAJOR < 54) #endif -#ifndef FF_API_INOFFICIAL -#define FF_API_INOFFICIAL (LIBAVCODEC_VERSION_MAJOR < 53) -#endif #ifndef FF_API_OLD_SAMPLE_FMT #define FF_API_OLD_SAMPLE_FMT (LIBAVCODEC_VERSION_MAJOR < 54) #endif From 3453a231a6cebe5989c213be0f9fd6c71ec5ea23 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 12 Apr 2011 20:46:49 +0200 Subject: [PATCH 30/37] lavc: remove misc disabled cruft. --- libavcodec/Makefile | 1 - libavcodec/avcodec.h | 114 +--------------------------------------- libavcodec/dsputil.h | 8 --- libavcodec/imgconvert.c | 51 ------------------ libavcodec/opt.c | 66 ----------------------- libavcodec/options.c | 3 -- libavcodec/parser.c | 37 ------------- libavcodec/utils.c | 48 +---------------- libavcodec/xvmc.h | 21 -------- 9 files changed, 4 insertions(+), 345 deletions(-) delete mode 100644 libavcodec/opt.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 1cdae2c669..784226f7af 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -15,7 +15,6 @@ OBJS = allcodecs.o \ fmtconvert.o \ imgconvert.o \ jrevdct.o \ - opt.o \ options.o \ parser.o \ raw.o \ diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index f90aa81ab7..40d3b2245b 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -33,12 +33,6 @@ #include "libavcodec/version.h" -#if LIBAVCODEC_VERSION_MAJOR < 53 -# define FF_INTERNALC_MEM_TYPE unsigned int -#else -# define FF_INTERNALC_MEM_TYPE size_t -#endif - /** * Identify the syntax and semantics of the bitstream. * The principle is roughly: @@ -117,9 +111,6 @@ enum CodecID { CODEC_ID_QDRAW, CODEC_ID_VIXL, CODEC_ID_QPEG, -#if LIBAVCODEC_VERSION_MAJOR < 53 - CODEC_ID_XVID, -#endif CODEC_ID_PNG, CODEC_ID_PPM, CODEC_ID_PBM, @@ -364,18 +355,6 @@ enum CodecID { CODEC_ID_FFMETADATA=0x21000, ///< Dummy codec for streams containing only metadata information. }; -#if LIBAVCODEC_VERSION_MAJOR < 53 -#define CodecType AVMediaType - -#define CODEC_TYPE_UNKNOWN AVMEDIA_TYPE_UNKNOWN -#define CODEC_TYPE_VIDEO AVMEDIA_TYPE_VIDEO -#define CODEC_TYPE_AUDIO AVMEDIA_TYPE_AUDIO -#define CODEC_TYPE_DATA AVMEDIA_TYPE_DATA -#define CODEC_TYPE_SUBTITLE AVMEDIA_TYPE_SUBTITLE -#define CODEC_TYPE_ATTACHMENT AVMEDIA_TYPE_ATTACHMENT -#define CODEC_TYPE_NB AVMEDIA_TYPE_NB -#endif - #if FF_API_OLD_SAMPLE_FMT #define SampleFormat AVSampleFormat @@ -1100,9 +1079,6 @@ typedef struct AVPacket { int64_t convergence_duration; } AVPacket; #define AV_PKT_FLAG_KEY 0x0001 -#if LIBAVCODEC_VERSION_MAJOR < 53 -#define PKT_FLAG_KEY AV_PKT_FLAG_KEY -#endif /** * Audio Video Frame. @@ -1277,9 +1253,6 @@ typedef struct AVCodecContext { */ int frame_size; int frame_number; ///< audio or video frame number -#if LIBAVCODEC_VERSION_MAJOR < 53 - int real_pict_num; ///< Returns the real picture number of previous encoded frame. -#endif /** * Number of frames the decoded output will be delayed relative to @@ -3343,23 +3316,6 @@ void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int * const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt); void avcodec_set_dimensions(AVCodecContext *s, int width, int height); -#if LIBAVCODEC_VERSION_MAJOR < 53 -/** - * Return the pixel format corresponding to the name name. - * - * If there is no pixel format with name name, then look for a - * pixel format with the name corresponding to the native endian - * format of name. - * For example in a little-endian system, first look for "gray16", - * then for "gray16le". - * - * Finally if no pixel format has been found, return PIX_FMT_NONE. - * - * @deprecated Deprecated in favor of av_get_pix_fmt(). - */ -attribute_deprecated enum PixelFormat avcodec_get_pix_fmt(const char* name); -#endif - /** * Return a value representing the fourCC code associated to the * pixel format pix_fmt, or 0 if no associated fourCC code can be @@ -3428,14 +3384,6 @@ int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_ enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); -#if LIBAVCODEC_VERSION_MAJOR < 53 -/** - * @deprecated Use av_get_pix_fmt_string() instead. - */ -attribute_deprecated -void avcodec_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt); -#endif - #define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */ #define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */ @@ -3483,13 +3431,6 @@ const char *avcodec_license(void); */ void avcodec_init(void); -#if LIBAVCODEC_VERSION_MAJOR < 53 -/** - * @deprecated Deprecated in favor of avcodec_register(). - */ -attribute_deprecated void register_avcodec(AVCodec *codec); -#endif - /** * Register the codec codec and initialize libavcodec. * @@ -3634,24 +3575,8 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height); void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, int linesize_align[4]); -#if LIBAVCODEC_VERSION_MAJOR < 53 -/** - * @deprecated Deprecated in favor of av_check_image_size(). - */ -attribute_deprecated -int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h); -#endif - enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt); -#if LIBAVCODEC_VERSION_MAJOR < 53 -/** - * @deprecated Set s->thread_count before calling avcodec_open() instead of calling this. - */ -attribute_deprecated -int avcodec_thread_init(AVCodecContext *s, int thread_count); -void avcodec_thread_free(AVCodecContext *s); -#endif int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size); int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count); //FIXME func typedef @@ -4036,15 +3961,6 @@ AVCodecParser *av_parser_next(AVCodecParser *c); void av_register_codec_parser(AVCodecParser *parser); AVCodecParserContext *av_parser_init(int codec_id); -#if LIBAVCODEC_VERSION_MAJOR < 53 -attribute_deprecated -int av_parser_parse(AVCodecParserContext *s, - AVCodecContext *avctx, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, - int64_t pts, int64_t dts); -#endif - /** * Parse a packet. * @@ -4123,7 +4039,7 @@ AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f); * * @see av_realloc */ -void *av_fast_realloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE min_size); +void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size); /** * Allocate a buffer, reusing the given one if large enough. @@ -4137,17 +4053,7 @@ void *av_fast_realloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE min_s * @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and * *size 0 if an error occurred. */ -void av_fast_malloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE min_size); - -#if LIBAVCODEC_VERSION_MAJOR < 53 -/** - * @deprecated Deprecated in favor of av_image_copy(). - */ -attribute_deprecated -void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4], - uint8_t *src_data[4], int src_linesize[4], - enum PixelFormat pix_fmt, int width, int height); -#endif +void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size); /** * Copy image src to dst. Wraps av_picture_data_copy() above. @@ -4176,22 +4082,6 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, */ unsigned int av_xiphlacing(unsigned char *s, unsigned int v); -#if LIBAVCODEC_VERSION_MAJOR < 53 -/** - * Parse str and put in width_ptr and height_ptr the detected values. - * - * @deprecated Deprecated in favor of av_parse_video_size(). - */ -attribute_deprecated int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str); - -/** - * Parse str and store the detected values in *frame_rate. - * - * @deprecated Deprecated in favor of av_parse_video_rate(). - */ -attribute_deprecated int av_parse_video_frame_rate(AVRational *frame_rate, const char *str); -#endif - /** * Logs a generic warning message about a missing feature. This function is * intended to be used internally by Libav (libavcodec, libavformat, etc.) diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index 99b32831ec..8d8bc29dd5 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -104,14 +104,6 @@ void ff_bink_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block); void ff_ea_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block); /* 1/2^n downscaling functions from imgconvert.c */ -#if LIBAVCODEC_VERSION_MAJOR < 53 -/** - * @deprecated Use av_image_copy_plane() instead. - */ -attribute_deprecated -void ff_img_copy_plane(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height); -#endif - void ff_shrink22(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height); void ff_shrink44(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height); void ff_shrink88(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height); diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index 09ccdbc906..23e4318c71 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -425,40 +425,11 @@ const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt) return av_pix_fmt_descriptors[pix_fmt].name; } -#if LIBAVCODEC_VERSION_MAJOR < 53 -enum PixelFormat avcodec_get_pix_fmt(const char *name) -{ - return av_get_pix_fmt(name); -} - -void avcodec_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt) -{ - av_get_pix_fmt_string(buf, buf_size, pix_fmt); -} -#endif - int ff_is_hwaccel_pix_fmt(enum PixelFormat pix_fmt) { return av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_HWACCEL; } -#if LIBAVCODEC_VERSION_MAJOR < 53 -int ff_set_systematic_pal(uint32_t pal[256], enum PixelFormat pix_fmt){ - return ff_set_systematic_pal2(pal, pix_fmt); -} - -int ff_fill_linesize(AVPicture *picture, enum PixelFormat pix_fmt, int width) -{ - return av_image_fill_linesizes(picture->linesize, pix_fmt, width); -} - -int ff_fill_pointer(AVPicture *picture, uint8_t *ptr, enum PixelFormat pix_fmt, - int height) -{ - return av_image_fill_pointers(picture->data, pix_fmt, height, ptr, picture->linesize); -} -#endif - int avpicture_fill(AVPicture *picture, uint8_t *ptr, enum PixelFormat pix_fmt, int width, int height) { @@ -693,28 +664,6 @@ enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelForma return dst_pix_fmt; } -#if LIBAVCODEC_VERSION_MAJOR < 53 -void ff_img_copy_plane(uint8_t *dst, int dst_wrap, - const uint8_t *src, int src_wrap, - int width, int height) -{ - av_image_copy_plane(dst, dst_wrap, src, src_wrap, width, height); -} - -int ff_get_plane_bytewidth(enum PixelFormat pix_fmt, int width, int plane) -{ - return av_image_get_linesize(pix_fmt, width, plane); -} - -void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4], - uint8_t *src_data[4], int src_linesize[4], - enum PixelFormat pix_fmt, int width, int height) -{ - av_image_copy(dst_data, dst_linesize, src_data, src_linesize, - pix_fmt, width, height); -} -#endif - void av_picture_copy(AVPicture *dst, const AVPicture *src, enum PixelFormat pix_fmt, int width, int height) { diff --git a/libavcodec/opt.c b/libavcodec/opt.c deleted file mode 100644 index f2bff96380..0000000000 --- a/libavcodec/opt.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * AVOptions ABI compatibility wrapper - * Copyright (c) 2010 Michael Niedermayer - * - * This file is part of Libav. - * - * Libav is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * Libav is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "avcodec.h" -#include "opt.h" - -#if LIBAVCODEC_VERSION_MAJOR < 53 && CONFIG_SHARED && HAVE_SYMVER - -FF_SYMVER(const AVOption *, av_find_opt, (void *obj, const char *name, const char *unit, int mask, int flags), "LIBAVCODEC_52"){ - return av_find_opt(obj, name, unit, mask, flags); -} -FF_SYMVER(int, av_set_string3, (void *obj, const char *name, const char *val, int alloc, const AVOption **o_out), "LIBAVCODEC_52"){ - return av_set_string3(obj, name, val, alloc, o_out); -} -FF_SYMVER(const AVOption *, av_set_double, (void *obj, const char *name, double n), "LIBAVCODEC_52"){ - return av_set_double(obj, name, n); -} -FF_SYMVER(const AVOption *, av_set_q, (void *obj, const char *name, AVRational n), "LIBAVCODEC_52"){ - return av_set_q(obj, name, n); -} -FF_SYMVER(const AVOption *, av_set_int, (void *obj, const char *name, int64_t n), "LIBAVCODEC_52"){ - return av_set_int(obj, name, n); -} -FF_SYMVER(double, av_get_double, (void *obj, const char *name, const AVOption **o_out), "LIBAVCODEC_52"){ - return av_get_double(obj, name, o_out); -} -FF_SYMVER(AVRational, av_get_q, (void *obj, const char *name, const AVOption **o_out), "LIBAVCODEC_52"){ - return av_get_q(obj, name, o_out); -} -FF_SYMVER(int64_t, av_get_int, (void *obj, const char *name, const AVOption **o_out), "LIBAVCODEC_52"){ - return av_get_int(obj, name, o_out); -} -FF_SYMVER(const char *, av_get_string, (void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len), "LIBAVCODEC_52"){ - return av_get_string(obj, name, o_out, buf, buf_len); -} -FF_SYMVER(const AVOption *, av_next_option, (void *obj, const AVOption *last), "LIBAVCODEC_52"){ - return av_next_option(obj, last); -} -FF_SYMVER(int, av_opt_show2, (void *obj, void *av_log_obj, int req_flags, int rej_flags), "LIBAVCODEC_52"){ - return av_opt_show2(obj, av_log_obj, req_flags, rej_flags); -} -FF_SYMVER(void, av_opt_set_defaults, (void *s), "LIBAVCODEC_52"){ - return av_opt_set_defaults(s); -} -FF_SYMVER(void, av_opt_set_defaults2, (void *s, int mask, int flags), "LIBAVCODEC_52"){ - return av_opt_set_defaults2(s, mask, flags); -} -#endif diff --git a/libavcodec/options.c b/libavcodec/options.c index 3b92497770..9a9ed7bf34 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -113,9 +113,6 @@ static const AVOption options[]={ {"cutoff", "set cutoff bandwidth", OFFSET(cutoff), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, A|E}, {"frame_size", NULL, OFFSET(frame_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, A|E}, {"frame_number", NULL, OFFSET(frame_number), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, -#if LIBAVCODEC_VERSION_MAJOR < 53 -{"real_pict_num", NULL, OFFSET(real_pict_num), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, -#endif {"delay", NULL, OFFSET(delay), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"qcomp", "video quantizer scale compression (VBR)", OFFSET(qcompress), FF_OPT_TYPE_FLOAT, 0.5, -FLT_MAX, FLT_MAX, V|E}, {"qblur", "video quantizer scale blur (VBR)", OFFSET(qblur), FF_OPT_TYPE_FLOAT, 0.5, 0, FLT_MAX, V|E}, diff --git a/libavcodec/parser.c b/libavcodec/parser.c index 3ba3e9c4c7..d5b85c3e4e 100644 --- a/libavcodec/parser.c +++ b/libavcodec/parser.c @@ -105,43 +105,6 @@ void ff_fetch_timestamp(AVCodecParserContext *s, int off, int remove){ } } -#if LIBAVCODEC_VERSION_MAJOR < 53 -/** - * - * @param buf input - * @param buf_size input length, to signal EOF, this should be 0 (so that the last frame can be output) - * @param pts input presentation timestamp - * @param dts input decoding timestamp - * @param poutbuf will contain a pointer to the first byte of the output frame - * @param poutbuf_size will contain the length of the output frame - * @return the number of bytes of the input bitstream used - * - * Example: - * @code - * while(in_len){ - * len = av_parser_parse(myparser, AVCodecContext, &data, &size, - * in_data, in_len, - * pts, dts); - * in_data += len; - * in_len -= len; - * - * if(size) - * decode_frame(data, size); - * } - * @endcode - * - * @deprecated Use av_parser_parse2() instead. - */ -int av_parser_parse(AVCodecParserContext *s, - AVCodecContext *avctx, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, - int64_t pts, int64_t dts) -{ - return av_parser_parse2(s, avctx, poutbuf, poutbuf_size, buf, buf_size, pts, dts, AV_NOPTS_VALUE); -} -#endif - int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx, uint8_t **poutbuf, int *poutbuf_size, diff --git a/libavcodec/utils.c b/libavcodec/utils.c index aa2e55693c..a46dda7e9c 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -48,7 +48,7 @@ static int volatile entangled_thread_counter=0; static int (*ff_lockmgr_cb)(void **mutex, enum AVLockOp op); static void *codec_mutex; -void *av_fast_realloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE min_size) +void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size) { if(min_size < *size) return ptr; @@ -64,7 +64,7 @@ void *av_fast_realloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE min_s return ptr; } -void av_fast_malloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE min_size) +void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size) { void **p = ptr; if (min_size < *size) @@ -94,13 +94,6 @@ void avcodec_register(AVCodec *codec) codec->next = NULL; } -#if LIBAVCODEC_VERSION_MAJOR < 53 -void register_avcodec(AVCodec *codec) -{ - avcodec_register(codec); -} -#endif - unsigned avcodec_get_edge_width(void) { return EDGE_WIDTH; @@ -220,12 +213,6 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height){ *width=FFALIGN(*width, align); } -#if LIBAVCODEC_VERSION_MAJOR < 53 -int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h){ - return av_image_check_size(w, h, 0, av_log_ctx); -} -#endif - int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){ int i; int w= s->width; @@ -1123,20 +1110,6 @@ unsigned int av_xiphlacing(unsigned char *s, unsigned int v) return n; } -#if LIBAVCODEC_VERSION_MAJOR < 53 -#include "libavutil/parseutils.h" - -int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str) -{ - return av_parse_video_size(width_ptr, height_ptr, str); -} - -int av_parse_video_frame_rate(AVRational *frame_rate, const char *arg) -{ - return av_parse_video_rate(frame_rate, arg); -} -#endif - int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b){ int i; for(i=0; ithread_count = thread_count; - return ff_thread_init(s); -} - -void avcodec_thread_free(AVCodecContext *s) -{ -#if HAVE_THREADS - ff_thread_free(s); -#endif -} - -#endif diff --git a/libavcodec/xvmc.h b/libavcodec/xvmc.h index 6e18a88a16..1239015fcd 100644 --- a/libavcodec/xvmc.h +++ b/libavcodec/xvmc.h @@ -25,11 +25,6 @@ #include "avcodec.h" -#if LIBAVCODEC_VERSION_MAJOR < 53 -#define AV_XVMC_STATE_DISPLAY_PENDING 1 /** the surface should be shown, the video driver manipulates this */ -#define AV_XVMC_STATE_PREDICTION 2 /** the surface is needed for prediction, the codec manipulates this */ -#define AV_XVMC_STATE_OSD_SOURCE 4 /** the surface is needed for subpicture rendering */ -#endif #define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct the number is 1337 speak for the letters IDCT MCo (motion compensation) */ @@ -151,22 +146,6 @@ struct xvmc_pix_fmt { of coded blocks it contains. */ int next_free_data_block_num; - -/** extensions may be placed here */ -#if LIBAVCODEC_VERSION_MAJOR < 53 -//@{ - /** State flags used to work around limitations in the MPlayer video system. - 0 - Surface is not used. - 1 - Surface is still held in application to be displayed or is - still visible. - 2 - Surface is still held in libavcodec buffer for prediction. - */ - int state; - - /** pointer to the surface where the subpicture is rendered */ - void* p_osd_target_surface_render; -//}@ -#endif }; #endif /* AVCODEC_XVMC_H */ From 516fb5e40cf9d591914096be26ba56fc59294669 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 12 Apr 2011 20:57:07 +0200 Subject: [PATCH 31/37] lavu: remove FF_API_OLD_EVAL_NAMES cruft --- libavutil/avutil.h | 3 --- libavutil/eval.c | 32 -------------------------------- libavutil/eval.h | 33 --------------------------------- 3 files changed, 68 deletions(-) diff --git a/libavutil/avutil.h b/libavutil/avutil.h index 6f2517c092..edae38eb69 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -57,9 +57,6 @@ * Those FF_API_* defines are not part of public API. * They may change, break or disappear at any time. */ -#ifndef FF_API_OLD_EVAL_NAMES -#define FF_API_OLD_EVAL_NAMES (LIBAVUTIL_VERSION_MAJOR < 51) -#endif /** * Return the LIBAVUTIL_VERSION_INT constant. diff --git a/libavutil/eval.c b/libavutil/eval.c index 7488a310a7..a6a59a39ef 100644 --- a/libavutil/eval.c +++ b/libavutil/eval.c @@ -530,38 +530,6 @@ int av_expr_parse_and_eval(double *d, const char *s, return isnan(*d) ? AVERROR(EINVAL) : 0; } -#if FF_API_OLD_EVAL_NAMES -int av_parse_expr(AVExpr **expr, const char *s, - const char * const *const_names, - const char * const *func1_names, double (* const *funcs1)(void *, double), - const char * const *func2_names, double (* const *funcs2)(void *, double, double), - int log_offset, void *log_ctx) -{ - return av_expr_parse(expr, s, const_names, func1_names, funcs1, func2_names, funcs2, - log_offset, log_ctx); -} - -double av_eval_expr(AVExpr *e, const double *const_values, void *opaque) -{ - return av_expr_eval(e, const_values, opaque); -} - -int av_parse_and_eval_expr(double *res, const char *s, - const char * const *const_names, const double *const_values, - const char * const *func1_names, double (* const *funcs1)(void *, double), - const char * const *func2_names, double (* const *funcs2)(void *, double, double), - void *opaque, int log_offset, void *log_ctx) -{ - return av_expr_parse_and_eval(res, s, const_names, const_values, func1_names, funcs1, func2_names, funcs2, - opaque, log_offset, log_ctx); -} - -void av_free_expr(AVExpr *e) -{ - av_expr_free(e); -} -#endif /* FF_API_OLD_EVAL_NAMES */ - #ifdef TEST #undef printf static double const_values[] = { diff --git a/libavutil/eval.h b/libavutil/eval.h index a20a006ac8..c485c69fb1 100644 --- a/libavutil/eval.h +++ b/libavutil/eval.h @@ -91,39 +91,6 @@ double av_expr_eval(AVExpr *e, const double *const_values, void *opaque); */ void av_expr_free(AVExpr *e); -#if FF_API_OLD_EVAL_NAMES -/** - * @deprecated Deprecated in favor of av_expr_parse_and_eval(). - */ -attribute_deprecated -int av_parse_and_eval_expr(double *res, const char *s, - const char * const *const_names, const double *const_values, - const char * const *func1_names, double (* const *funcs1)(void *, double), - const char * const *func2_names, double (* const *funcs2)(void *, double, double), - void *opaque, int log_offset, void *log_ctx); - -/** - * @deprecated Deprecated in favor of av_expr_parse(). - */ -attribute_deprecated -int av_parse_expr(AVExpr **expr, const char *s, - const char * const *const_names, - const char * const *func1_names, double (* const *funcs1)(void *, double), - const char * const *func2_names, double (* const *funcs2)(void *, double, double), - int log_offset, void *log_ctx); -/** - * @deprecated Deprecated in favor of av_expr_eval(). - */ -attribute_deprecated -double av_eval_expr(AVExpr *e, const double *const_values, void *opaque); - -/** - * @deprecated Deprecated in favor of av_expr_free(). - */ -attribute_deprecated -void av_free_expr(AVExpr *e); -#endif /* FF_API_OLD_EVAL_NAMES */ - /** * Parse the string in numstr and return its value as a double. If * the string is empty, contains only whitespaces, or does not contain From 9e5c62c97fc0a6ee5764ec69cc6c237b5f70026b Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 12 Apr 2011 21:11:15 +0200 Subject: [PATCH 32/37] lavu: remove FF_API_OLD_IMAGE_NAMES cruft --- libavutil/avutil.h | 8 -------- libavutil/imgutils.c | 29 ----------------------------- libavutil/imgutils.h | 19 ------------------- 3 files changed, 56 deletions(-) diff --git a/libavutil/avutil.h b/libavutil/avutil.h index edae38eb69..abbdd0642a 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -94,14 +94,6 @@ enum AVMediaType { #define AV_TIME_BASE 1000000 #define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE} -/** - * Those FF_API_* defines are not part of public API. - * They may change, break or disappear at any time. - */ -#ifndef FF_API_OLD_IMAGE_NAMES -#define FF_API_OLD_IMAGE_NAMES (LIBAVUTIL_VERSION_MAJOR < 51) -#endif - #include "common.h" #include "error.h" #include "mathematics.h" diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c index 129fb9555d..544007f120 100644 --- a/libavutil/imgutils.c +++ b/libavutil/imgutils.c @@ -266,32 +266,3 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], } } } - -#if FF_API_OLD_IMAGE_NAMES -void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], - const AVPixFmtDescriptor *pixdesc) -{ - av_image_fill_max_pixsteps(max_pixsteps, max_pixstep_comps, pixdesc); -} - -int av_get_image_linesize(enum PixelFormat pix_fmt, int width, int plane) -{ - return av_image_get_linesize(pix_fmt, width, plane); -} - -int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width) -{ - return av_image_fill_linesizes(linesizes, pix_fmt, width); -} - -int av_fill_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height, - uint8_t *ptr, const int linesizes[4]) -{ - return av_image_fill_pointers(data, pix_fmt, height, ptr, linesizes); -} - -int av_check_image_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx) -{ - return av_image_check_size(w, h, log_offset, log_ctx); -} -#endif diff --git a/libavutil/imgutils.h b/libavutil/imgutils.h index 6ebb1b0a6c..7abeb657fb 100644 --- a/libavutil/imgutils.h +++ b/libavutil/imgutils.h @@ -127,23 +127,4 @@ int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *lo int ff_set_systematic_pal2(uint32_t pal[256], enum PixelFormat pix_fmt); -#if FF_API_OLD_IMAGE_NAMES -attribute_deprecated -void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], - const AVPixFmtDescriptor *pixdesc); - -attribute_deprecated -int av_get_image_linesize(enum PixelFormat pix_fmt, int width, int plane); - -attribute_deprecated -int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width); - -attribute_deprecated -int av_fill_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height, - uint8_t *ptr, const int linesizes[4]); - -attribute_deprecated -int av_check_image_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx); -#endif - #endif /* AVUTIL_IMGUTILS_H */ From 490a022d86ef1c506a79744c5a95368af356fc69 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 12 Apr 2011 21:17:26 +0200 Subject: [PATCH 33/37] lavu: remove misc disabled cruft --- libavutil/error.h | 13 ------------- libavutil/file.c | 3 +-- libavutil/log.c | 5 +---- libavutil/mem.c | 6 +++--- libavutil/mem.h | 14 +++----------- 5 files changed, 8 insertions(+), 33 deletions(-) diff --git a/libavutil/error.h b/libavutil/error.h index 8c83ecde77..33332b18c4 100644 --- a/libavutil/error.h +++ b/libavutil/error.h @@ -37,25 +37,12 @@ #define AVUNERROR(e) (e) #endif -#if LIBAVUTIL_VERSION_MAJOR < 51 -#define AVERROR_INVALIDDATA AVERROR(EINVAL) ///< Invalid data found when processing input -#define AVERROR_IO AVERROR(EIO) ///< I/O error -#define AVERROR_NOENT AVERROR(ENOENT) ///< No such file or directory -#define AVERROR_NOFMT AVERROR(EILSEQ) ///< Unknown format -#define AVERROR_NOMEM AVERROR(ENOMEM) ///< Not enough memory -#define AVERROR_NOTSUPP AVERROR(ENOSYS) ///< Operation not supported -#define AVERROR_NUMEXPECTED AVERROR(EDOM) ///< Number syntax expected in filename -#define AVERROR_UNKNOWN AVERROR(EINVAL) ///< Unknown error -#endif - #define AVERROR_EOF AVERROR(EPIPE) ///< End of file #define AVERROR_PATCHWELCOME (-MKTAG('P','A','W','E')) ///< Not yet implemented in Libav, patches welcome -#if LIBAVUTIL_VERSION_MAJOR > 50 #define AVERROR_INVALIDDATA (-MKTAG('I','N','D','A')) ///< Invalid data found when processing input #define AVERROR_NUMEXPECTED (-MKTAG('N','U','E','X')) ///< Number syntax expected in filename -#endif #define AVERROR_DEMUXER_NOT_FOUND (-MKTAG(0xF8,'D','E','M')) ///< Demuxer not found #define AVERROR_MUXER_NOT_FOUND (-MKTAG(0xF8,'M','U','X')) ///< Muxer not found diff --git a/libavutil/file.c b/libavutil/file.c index 757e73bafb..3dcce7c2f8 100644 --- a/libavutil/file.c +++ b/libavutil/file.c @@ -47,7 +47,6 @@ int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, av_unused void *ptr; off_t off_size; char errbuf[128]; - size_t max_size = HAVE_MMAP ? SIZE_MAX : FF_INTERNAL_MEM_TYPE_MAX_VALUE; *bufptr = NULL; if (fd < 0) { @@ -66,7 +65,7 @@ int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, } off_size = st.st_size; - if (off_size > max_size) { + if (off_size > SIZE_MAX) { av_log(&file_log_ctx, AV_LOG_ERROR, "File size for file '%s' is too big\n", filename); close(fd); diff --git a/libavutil/log.c b/libavutil/log.c index 3b8244889f..72d2b914bd 100644 --- a/libavutil/log.c +++ b/libavutil/log.c @@ -29,10 +29,7 @@ #include "avutil.h" #include "log.h" -#if LIBAVUTIL_VERSION_MAJOR > 50 -static -#endif -int av_log_level = AV_LOG_INFO; +static int av_log_level = AV_LOG_INFO; static int flags; #if defined(_WIN32) && !defined(__MINGW32CE__) diff --git a/libavutil/mem.c b/libavutil/mem.c index 7a54bd0f7e..2aef9b0a1b 100644 --- a/libavutil/mem.c +++ b/libavutil/mem.c @@ -61,7 +61,7 @@ void free(void *ptr); memory allocator. You do not need to suppress this file because the linker will do it automatically. */ -void *av_malloc(FF_INTERNAL_MEM_TYPE size) +void *av_malloc(size_t size) { void *ptr = NULL; #if CONFIG_MEMALIGN_HACK @@ -116,7 +116,7 @@ void *av_malloc(FF_INTERNAL_MEM_TYPE size) return ptr; } -void *av_realloc(void *ptr, FF_INTERNAL_MEM_TYPE size) +void *av_realloc(void *ptr, size_t size) { #if CONFIG_MEMALIGN_HACK int diff; @@ -153,7 +153,7 @@ void av_freep(void *arg) *ptr = NULL; } -void *av_mallocz(FF_INTERNAL_MEM_TYPE size) +void *av_mallocz(size_t size) { void *ptr = av_malloc(size); if (ptr) diff --git a/libavutil/mem.h b/libavutil/mem.h index f52777b071..5dea492021 100644 --- a/libavutil/mem.h +++ b/libavutil/mem.h @@ -62,14 +62,6 @@ #define av_alloc_size(n) #endif -#if LIBAVUTIL_VERSION_MAJOR < 51 -# define FF_INTERNAL_MEM_TYPE unsigned int -# define FF_INTERNAL_MEM_TYPE_MAX_VALUE UINT_MAX -#else -# define FF_INTERNAL_MEM_TYPE size_t -# define FF_INTERNAL_MEM_TYPE_MAX_VALUE SIZE_MAX -#endif - /** * Allocate a block of size bytes with alignment suitable for all * memory accesses (including vectors if available on the CPU). @@ -78,7 +70,7 @@ * be allocated. * @see av_mallocz() */ -void *av_malloc(FF_INTERNAL_MEM_TYPE size) av_malloc_attrib av_alloc_size(1); +void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1); /** * Allocate or reallocate a block of memory. @@ -92,7 +84,7 @@ void *av_malloc(FF_INTERNAL_MEM_TYPE size) av_malloc_attrib av_alloc_size(1); * cannot be reallocated or the function is used to free the memory block. * @see av_fast_realloc() */ -void *av_realloc(void *ptr, FF_INTERNAL_MEM_TYPE size) av_alloc_size(2); +void *av_realloc(void *ptr, size_t size) av_alloc_size(2); /** * Free a memory block which has been allocated with av_malloc(z)() or @@ -112,7 +104,7 @@ void av_free(void *ptr); * @return Pointer to the allocated block, NULL if it cannot be allocated. * @see av_malloc() */ -void *av_mallocz(FF_INTERNAL_MEM_TYPE size) av_malloc_attrib av_alloc_size(1); +void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1); /** * Duplicate the string s. From 59d96941f0285a501989d5f2c9b69be0a1393ed5 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Fri, 15 Apr 2011 16:42:09 +0200 Subject: [PATCH 34/37] avio: remove AVIO_* access symbols in favor of new AVIO_FLAG_* symbols Make AVIO_FLAG_ access constants work as flags, and in particular fix the behavior of functions (such as avio_check()) which expect them to be flags rather than modes. This breaks API. --- ffmpeg.c | 2 +- ffserver.c | 4 ++-- libavformat/applehttp.c | 4 ++-- libavformat/applehttpproto.c | 6 +++--- libavformat/avio.c | 10 +++++----- libavformat/avio.h | 8 ++++---- libavformat/aviobuf.c | 12 ++++++------ libavformat/file.c | 11 +++++------ libavformat/gopher.c | 2 +- libavformat/http.c | 6 +++--- libavformat/img2.c | 4 ++-- libavformat/librtmp.c | 2 +- libavformat/matroskadec.c | 2 +- libavformat/md5proto.c | 4 ++-- libavformat/mmsh.c | 4 ++-- libavformat/mmst.c | 2 +- libavformat/mov.c | 2 +- libavformat/output-example.c | 2 +- libavformat/rtmpproto.c | 6 +++--- libavformat/rtpproto.c | 2 +- libavformat/rtsp.c | 16 ++++++++-------- libavformat/sapdec.c | 2 +- libavformat/sapenc.c | 4 ++-- libavformat/udp.c | 12 ++++++------ libavformat/utils.c | 2 +- 25 files changed, 65 insertions(+), 66 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index f5244d98fd..5b6e3eae67 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -3750,7 +3750,7 @@ static void opt_output_file(const char *filename) } /* open the file */ - if ((err = avio_open(&oc->pb, filename, AVIO_WRONLY)) < 0) { + if ((err = avio_open(&oc->pb, filename, AVIO_FLAG_WRITE)) < 0) { print_error(filename, err); ffmpeg_exit(1); } diff --git a/ffserver.c b/ffserver.c index ec8b773c26..5defd40847 100644 --- a/ffserver.c +++ b/ffserver.c @@ -3422,7 +3422,7 @@ static int rtp_new_av_stream(HTTPContext *c, "rtp://%s:%d", ipaddr, ntohs(dest_addr->sin_port)); } - if (url_open(&h, ctx->filename, AVIO_WRONLY) < 0) + if (url_open(&h, ctx->filename, AVIO_FLAG_WRITE) < 0) goto fail; c->rtp_handles[stream_index] = h; max_packet_size = url_get_max_packet_size(h); @@ -3762,7 +3762,7 @@ static void build_feed_streams(void) } /* only write the header of the ffm file */ - if (avio_open(&s->pb, feed->feed_filename, AVIO_WRONLY) < 0) { + if (avio_open(&s->pb, feed->feed_filename, AVIO_FLAG_WRITE) < 0) { http_log("Could not open output feed file '%s'\n", feed->feed_filename); exit(1); diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c index 35759be3cb..df4494a785 100644 --- a/libavformat/applehttp.c +++ b/libavformat/applehttp.c @@ -170,7 +170,7 @@ static int parse_playlist(AppleHTTPContext *c, const char *url, if (!in) { close_in = 1; - if ((ret = avio_open(&in, url, AVIO_RDONLY)) < 0) + if ((ret = avio_open(&in, url, AVIO_FLAG_READ)) < 0) return ret; } @@ -293,7 +293,7 @@ reload: ret = ffurl_open(&v->input, v->segments[v->cur_seq_no - v->start_seq_no]->url, - AVIO_RDONLY); + AVIO_FLAG_READ); if (ret < 0) return ret; } diff --git a/libavformat/applehttpproto.c b/libavformat/applehttpproto.c index 8842bd4dcf..8a9bcb1ade 100644 --- a/libavformat/applehttpproto.c +++ b/libavformat/applehttpproto.c @@ -115,7 +115,7 @@ static int parse_playlist(URLContext *h, const char *url) char line[1024]; const char *ptr; - if ((ret = avio_open(&in, url, AVIO_RDONLY)) < 0) + if ((ret = avio_open(&in, url, AVIO_FLAG_READ)) < 0) return ret; read_chomp_line(in, line, sizeof(line)); @@ -180,7 +180,7 @@ static int applehttp_open(URLContext *h, const char *uri, int flags) int ret, i; const char *nested_url; - if (flags & (AVIO_WRONLY | AVIO_RDWR)) + if (flags & AVIO_FLAG_WRITE) return AVERROR(ENOSYS); s = av_mallocz(sizeof(AppleHTTPContext)); @@ -275,7 +275,7 @@ retry: } url = s->segments[s->cur_seq_no - s->start_seq_no]->url, av_log(NULL, AV_LOG_DEBUG, "opening %s\n", url); - ret = ffurl_open(&s->seg_hd, url, AVIO_RDONLY); + ret = ffurl_open(&s->seg_hd, url, AVIO_FLAG_READ); if (ret < 0) { if (url_interrupt_cb()) return AVERROR_EXIT; diff --git a/libavformat/avio.c b/libavformat/avio.c index 4f8acb01ff..074d3eeb86 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -129,7 +129,7 @@ int ffurl_connect(URLContext* uc) return err; uc->is_connected = 1; //We must be careful here as ffurl_seek() could be slow, for example for http - if( (uc->flags & (AVIO_WRONLY | AVIO_RDWR)) + if( (uc->flags & AVIO_FLAG_WRITE) || !strcmp(uc->prot->name, "file")) if(!uc->is_streamed && ffurl_seek(uc, 0, SEEK_SET) < 0) uc->is_streamed= 1; @@ -289,21 +289,21 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int int ffurl_read(URLContext *h, unsigned char *buf, int size) { - if (h->flags & AVIO_WRONLY) + if (h->flags & AVIO_FLAG_WRITE) return AVERROR(EIO); return retry_transfer_wrapper(h, buf, size, 1, h->prot->url_read); } int ffurl_read_complete(URLContext *h, unsigned char *buf, int size) { - if (h->flags & AVIO_WRONLY) + if (h->flags & AVIO_FLAG_WRITE) return AVERROR(EIO); return retry_transfer_wrapper(h, buf, size, size, h->prot->url_read); } int ffurl_write(URLContext *h, const unsigned char *buf, int size) { - if (!(h->flags & (AVIO_WRONLY | AVIO_RDWR))) + if (!(h->flags & AVIO_FLAG_WRITE)) return AVERROR(EIO); /* avoid sending too big packets */ if (h->max_packet_size && size > h->max_packet_size) @@ -342,7 +342,7 @@ int ffurl_close(URLContext *h) int url_exist(const char *filename) { URLContext *h; - if (ffurl_open(&h, filename, AVIO_RDONLY) < 0) + if (ffurl_open(&h, filename, AVIO_FLAG_READ) < 0) return 0; ffurl_close(h); return 1; diff --git a/libavformat/avio.h b/libavformat/avio.h index c63b545d33..a4ab5ae28c 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -347,7 +347,7 @@ attribute_deprecated int url_exist(const char *url); #endif // FF_API_OLD_AVIO /** - * Return AVIO_* access flags corresponding to the access permissions + * Return AVIO_FLAG_* access flags corresponding to the access permissions * of the resource in url, or a negative value corresponding to an * AVERROR code in case of failure. The returned access flags are * masked by the value in flags. @@ -527,9 +527,9 @@ int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen); * constants, optionally ORed with other flags. * @{ */ -#define AVIO_RDONLY 1 /**< read-only */ -#define AVIO_WRONLY 2 /**< write-only */ -#define AVIO_RDWR 4 /**< read-write */ +#define AVIO_FLAG_READ 1 /**< read-only */ +#define AVIO_FLAG_WRITE 2 /**< write-only */ +#define AVIO_FLAG_READ_WRITE (AVIO_FLAG_READ|AVIO_FLAG_WRITE) /**< read-write pseudo flag */ /** * @} */ diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 2bacedbaa7..2b14d48ff5 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -53,7 +53,7 @@ int ffio_init_context(AVIOContext *s, s->buffer_size = buffer_size; s->buf_ptr = buffer; s->opaque = opaque; - url_resetbuf(s, write_flag ? AVIO_WRONLY : AVIO_RDONLY); + url_resetbuf(s, write_flag ? AVIO_FLAG_WRITE : AVIO_FLAG_READ); s->write_packet = write_packet; s->read_packet = read_packet; s->seek = seek; @@ -843,7 +843,7 @@ int ffio_fdopen(AVIOContext **s, URLContext *h) } if (ffio_init_context(*s, buffer, buffer_size, - (h->flags & AVIO_WRONLY || h->flags & AVIO_RDWR), h, + h->flags & AVIO_FLAG_WRITE, h, ffurl_read, ffurl_write, ffurl_seek) < 0) { av_free(buffer); av_freep(s); @@ -872,15 +872,15 @@ int ffio_set_buf_size(AVIOContext *s, int buf_size) s->buffer = buffer; s->buffer_size = buf_size; s->buf_ptr = buffer; - url_resetbuf(s, s->write_flag ? AVIO_WRONLY : AVIO_RDONLY); + url_resetbuf(s, s->write_flag ? AVIO_FLAG_WRITE : AVIO_FLAG_READ); return 0; } static int url_resetbuf(AVIOContext *s, int flags) { - assert(flags == AVIO_WRONLY || flags == AVIO_RDONLY); + assert(flags == AVIO_FLAG_WRITE || flags == AVIO_FLAG_READ); - if (flags & AVIO_WRONLY) { + if (flags & AVIO_FLAG_WRITE) { s->buf_end = s->buffer + s->buffer_size; s->write_flag = 1; } else { @@ -1038,7 +1038,7 @@ int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags) if(!*s) return AVERROR(ENOMEM); ret = ffio_init_context(*s, buf, buf_size, - (flags & AVIO_WRONLY || flags & AVIO_RDWR), + flags & AVIO_FLAG_WRITE, NULL, NULL, NULL, NULL); if(ret != 0) av_freep(s); diff --git a/libavformat/file.c b/libavformat/file.c index 1dcb2c8ac5..6a3ed5acb0 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -60,9 +60,9 @@ static int file_open(URLContext *h, const char *filename, int flags) av_strstart(filename, "file:", &filename); - if (flags & AVIO_RDWR) { + if (flags & AVIO_FLAG_WRITE && flags & AVIO_FLAG_READ) { access = O_CREAT | O_TRUNC | O_RDWR; - } else if (flags & AVIO_WRONLY) { + } else if (flags & AVIO_FLAG_WRITE) { access = O_CREAT | O_TRUNC | O_WRONLY; } else { access = O_RDONLY; @@ -102,9 +102,8 @@ static int file_check(URLContext *h, int mask) if (ret < 0) return AVERROR(errno); - ret |= st.st_mode&S_IRUSR ? mask&AVIO_RDONLY : 0; - ret |= st.st_mode&S_IWUSR ? mask&AVIO_WRONLY : 0; - ret |= st.st_mode&S_IWUSR && st.st_mode&S_IRUSR ? mask&AVIO_RDWR : 0; + ret |= st.st_mode&S_IRUSR ? mask&AVIO_FLAG_READ : 0; + ret |= st.st_mode&S_IWUSR ? mask&AVIO_FLAG_WRITE : 0; return ret; } @@ -132,7 +131,7 @@ static int pipe_open(URLContext *h, const char *filename, int flags) fd = strtol(filename, &final, 10); if((filename == final) || *final ) {/* No digits found, or something like 10ab */ - if (flags & AVIO_WRONLY) { + if (flags & AVIO_FLAG_WRITE) { fd = 1; } else { fd = 0; diff --git a/libavformat/gopher.c b/libavformat/gopher.c index cfc07e79cf..1d38cd232f 100644 --- a/libavformat/gopher.c +++ b/libavformat/gopher.c @@ -100,7 +100,7 @@ static int gopher_open(URLContext *h, const char *uri, int flags) ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL); s->hd = NULL; - err = ffurl_open(&s->hd, buf, AVIO_RDWR); + err = ffurl_open(&s->hd, buf, AVIO_FLAG_READ_WRITE); if (err < 0) goto fail; diff --git a/libavformat/http.c b/libavformat/http.c index bcfce80bff..190f844ea1 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -124,7 +124,7 @@ static int http_open_cnx(URLContext *h) port = 80; ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL); - err = ffurl_open(&hd, buf, AVIO_RDWR); + err = ffurl_open(&hd, buf, AVIO_FLAG_READ_WRITE); if (err < 0) goto fail; @@ -296,7 +296,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr, /* send http header */ - post = h->flags & AVIO_WRONLY; + post = h->flags & AVIO_FLAG_WRITE; authstr = ff_http_auth_create_response(&s->auth_state, auth, path, post ? "POST" : "GET"); @@ -451,7 +451,7 @@ static int http_close(URLContext *h) HTTPContext *s = h->priv_data; /* signal end of chunked encoding if used */ - if ((h->flags & AVIO_WRONLY) && s->chunksize != -1) { + if ((h->flags & AVIO_FLAG_WRITE) && s->chunksize != -1) { ret = ffurl_write(s->hd, footer, sizeof(footer) - 1); ret = ret > 0 ? 0 : ret; } diff --git a/libavformat/img2.c b/libavformat/img2.c index 2b5d63b0bd..84d841f0ed 100644 --- a/libavformat/img2.c +++ b/libavformat/img2.c @@ -278,7 +278,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt) s->path, s->img_number)<0 && s->img_number > 1) return AVERROR(EIO); for(i=0; i<3; i++){ - if (avio_open(&f[i], filename, AVIO_RDONLY) < 0) { + if (avio_open(&f[i], filename, AVIO_FLAG_READ) < 0) { if(i==1) break; av_log(s1, AV_LOG_ERROR, "Could not open file : %s\n",filename); @@ -362,7 +362,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) return AVERROR(EIO); } for(i=0; i<3; i++){ - if (avio_open(&pb[i], filename, AVIO_WRONLY) < 0) { + if (avio_open(&pb[i], filename, AVIO_FLAG_WRITE) < 0) { av_log(s, AV_LOG_ERROR, "Could not open file : %s\n",filename); return AVERROR(EIO); } diff --git a/libavformat/librtmp.c b/libavformat/librtmp.c index db5cc9858b..30fe8a196b 100644 --- a/libavformat/librtmp.c +++ b/libavformat/librtmp.c @@ -94,7 +94,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags) goto fail; } - if (flags & AVIO_WRONLY) + if (flags & AVIO_FLAG_WRITE) RTMP_EnableWrite(r); if (!RTMP_Connect(r, NULL) || !RTMP_ConnectStream(r, 0)) { diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 19c7ca6384..0fa94a16d5 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1331,7 +1331,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) && track->codec_priv.data != NULL) { int ret; ffio_init_context(&b, track->codec_priv.data, track->codec_priv.size, - AVIO_RDONLY, NULL, NULL, NULL, NULL); + AVIO_FLAG_READ, NULL, NULL, NULL, NULL); ret = ff_get_wav_header(&b, st->codec, track->codec_priv.size); if (ret < 0) return ret; diff --git a/libavformat/md5proto.c b/libavformat/md5proto.c index 8b811ec3d6..4630c49f5c 100644 --- a/libavformat/md5proto.c +++ b/libavformat/md5proto.c @@ -36,7 +36,7 @@ static int md5_open(URLContext *h, const char *filename, int flags) return -1; } - if (flags != AVIO_WRONLY) + if (!flags & AVIO_FLAG_WRITE) return AVERROR(EINVAL); av_md5_init(h->priv_data); @@ -65,7 +65,7 @@ static int md5_close(URLContext *h) av_strstart(filename, "md5:", &filename); if (*filename) { - err = ffurl_open(&out, filename, AVIO_WRONLY); + err = ffurl_open(&out, filename, AVIO_FLAG_WRITE); if (err) return err; err = ffurl_write(out, buf, i*2+1); diff --git a/libavformat/mmsh.c b/libavformat/mmsh.c index 1b9b494f57..203691e2fc 100644 --- a/libavformat/mmsh.c +++ b/libavformat/mmsh.c @@ -233,7 +233,7 @@ static int mmsh_open(URLContext *h, const char *uri, int flags) port = 80; // default mmsh protocol port ff_url_join(httpname, sizeof(httpname), "http", NULL, host, port, path); - if (ffurl_alloc(&mms->mms_hd, httpname, AVIO_RDONLY) < 0) { + if (ffurl_alloc(&mms->mms_hd, httpname, AVIO_FLAG_READ) < 0) { return AVERROR(EIO); } @@ -261,7 +261,7 @@ static int mmsh_open(URLContext *h, const char *uri, int flags) // close the socket and then reopen it for sending the second play request. ffurl_close(mms->mms_hd); memset(headers, 0, sizeof(headers)); - if (ffurl_alloc(&mms->mms_hd, httpname, AVIO_RDONLY) < 0) { + if (ffurl_alloc(&mms->mms_hd, httpname, AVIO_FLAG_READ) < 0) { return AVERROR(EIO); } stream_selection = av_mallocz(mms->stream_num * 19 + 1); diff --git a/libavformat/mmst.c b/libavformat/mmst.c index a3f260939d..e1904de1e2 100644 --- a/libavformat/mmst.c +++ b/libavformat/mmst.c @@ -523,7 +523,7 @@ static int mms_open(URLContext *h, const char *uri, int flags) // establish tcp connection. ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, mmst->host, port, NULL); - err = ffurl_open(&mms->mms_hd, tcpname, AVIO_RDWR); + err = ffurl_open(&mms->mms_hd, tcpname, AVIO_FLAG_READ_WRITE); if (err) goto fail; diff --git a/libavformat/mov.c b/libavformat/mov.c index bd8cf031e0..76dc8a13af 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1721,7 +1721,7 @@ static int mov_open_dref(AVIOContext **pb, char *src, MOVDref *ref) av_strlcat(filename, ref->path + l + 1, 1024); - if (!avio_open(pb, filename, AVIO_RDONLY)) + if (!avio_open(pb, filename, AVIO_FLAG_READ)) return 0; } } diff --git a/libavformat/output-example.c b/libavformat/output-example.c index 27db78c658..ddd16f1eed 100644 --- a/libavformat/output-example.c +++ b/libavformat/output-example.c @@ -492,7 +492,7 @@ int main(int argc, char **argv) /* open the output file, if needed */ if (!(fmt->flags & AVFMT_NOFILE)) { - if (avio_open(&oc->pb, filename, AVIO_WRONLY) < 0) { + if (avio_open(&oc->pb, filename, AVIO_FLAG_WRITE) < 0) { fprintf(stderr, "Could not open '%s'\n", filename); exit(1); } diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index 3413b62c8b..70e4b142d6 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -805,7 +805,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags) if (!rt) return AVERROR(ENOMEM); s->priv_data = rt; - rt->is_input = !(flags & AVIO_WRONLY); + rt->is_input = !(flags & AVIO_FLAG_WRITE); av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), &port, path, sizeof(path), s->filename); @@ -814,8 +814,8 @@ static int rtmp_open(URLContext *s, const char *uri, int flags) port = RTMP_DEFAULT_PORT; ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL); - if (ffurl_open(&rt->stream, buf, AVIO_RDWR) < 0) { - av_log(s, AV_LOG_ERROR, "Cannot open connection %s\n", buf); + if (ffurl_open(&rt->stream, buf, AVIO_FLAG_READ_WRITE) < 0) { + av_log(s , AV_LOG_ERROR, "Cannot open connection %s\n", buf); goto fail; } diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c index b92b2e7ace..e1659ee02d 100644 --- a/libavformat/rtpproto.c +++ b/libavformat/rtpproto.c @@ -145,7 +145,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags) char path[1024]; const char *p; - is_output = (flags & AVIO_WRONLY); + is_output = (flags & AVIO_FLAG_WRITE); s = av_mallocz(sizeof(RTPContext)); if (!s) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 62c9d3543e..58f7ddc1a6 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1116,14 +1116,14 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, "?localport=%d", j); /* we will use two ports per rtp stream (rtp and rtcp) */ j += 2; - if (ffurl_open(&rtsp_st->rtp_handle, buf, AVIO_RDWR) == 0) + if (ffurl_open(&rtsp_st->rtp_handle, buf, AVIO_FLAG_READ_WRITE) == 0) goto rtp_opened; } } #if 0 /* then try on any port */ - if (ffurl_open(&rtsp_st->rtp_handle, "rtp://", AVIO_RDONLY) < 0) { + if (ffurl_open(&rtsp_st->rtp_handle, "rtp://", AVIO_FLAG_READ) < 0) { err = AVERROR_INVALIDDATA; goto fail; } @@ -1269,7 +1269,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST); ff_url_join(url, sizeof(url), "rtp", NULL, namebuf, port, "?ttl=%d", ttl); - if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_RDWR) < 0) { + if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE) < 0) { err = AVERROR_INVALIDDATA; goto fail; } @@ -1396,7 +1396,7 @@ redirect: av_get_random_seed(), av_get_random_seed()); /* GET requests */ - if (ffurl_alloc(&rt->rtsp_hd, httpname, AVIO_RDONLY) < 0) { + if (ffurl_alloc(&rt->rtsp_hd, httpname, AVIO_FLAG_READ) < 0) { err = AVERROR(EIO); goto fail; } @@ -1417,7 +1417,7 @@ redirect: } /* POST requests */ - if (ffurl_alloc(&rt->rtsp_hd_out, httpname, AVIO_WRONLY) < 0 ) { + if (ffurl_alloc(&rt->rtsp_hd_out, httpname, AVIO_FLAG_WRITE) < 0 ) { err = AVERROR(EIO); goto fail; } @@ -1460,7 +1460,7 @@ redirect: } else { /* open the tcp connection */ ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, host, port, NULL); - if (ffurl_open(&rt->rtsp_hd, tcpname, AVIO_RDWR) < 0) { + if (ffurl_open(&rt->rtsp_hd, tcpname, AVIO_FLAG_READ_WRITE) < 0) { err = AVERROR(EIO); goto fail; } @@ -1807,7 +1807,7 @@ static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap) namebuf, rtsp_st->sdp_port, "?localport=%d&ttl=%d", rtsp_st->sdp_port, rtsp_st->sdp_ttl); - if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_RDWR) < 0) { + if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE) < 0) { err = AVERROR_INVALIDDATA; goto fail; } @@ -1863,7 +1863,7 @@ static int rtp_read_header(AVFormatContext *s, if (!ff_network_init()) return AVERROR(EIO); - ret = ffurl_open(&in, s->filename, AVIO_RDONLY); + ret = ffurl_open(&in, s->filename, AVIO_FLAG_READ); if (ret) goto fail; diff --git a/libavformat/sapdec.c b/libavformat/sapdec.c index 1eb40b7ee5..88150fc772 100644 --- a/libavformat/sapdec.c +++ b/libavformat/sapdec.c @@ -85,7 +85,7 @@ static int sap_read_header(AVFormatContext *s, ff_url_join(url, sizeof(url), "udp", NULL, host, port, "?localport=%d", port); - ret = ffurl_open(&sap->ann_fd, url, AVIO_RDONLY); + ret = ffurl_open(&sap->ann_fd, url, AVIO_FLAG_READ); if (ret) goto fail; diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c index 455e65341f..3abd79e4e8 100644 --- a/libavformat/sapenc.c +++ b/libavformat/sapenc.c @@ -146,7 +146,7 @@ static int sap_write_header(AVFormatContext *s) "?ttl=%d", ttl); if (!same_port) base_port += 2; - ret = ffurl_open(&fd, url, AVIO_WRONLY); + ret = ffurl_open(&fd, url, AVIO_FLAG_WRITE); if (ret) { ret = AVERROR(EIO); goto fail; @@ -158,7 +158,7 @@ static int sap_write_header(AVFormatContext *s) ff_url_join(url, sizeof(url), "udp", NULL, announce_addr, port, "?ttl=%d&connect=1", ttl); - ret = ffurl_open(&sap->ann_fd, url, AVIO_WRONLY); + ret = ffurl_open(&sap->ann_fd, url, AVIO_FLAG_WRITE); if (ret) { ret = AVERROR(EIO); goto fail; diff --git a/libavformat/udp.c b/libavformat/udp.c index e16dc4c7e0..76e3f1a4a2 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -315,7 +315,7 @@ static int udp_open(URLContext *h, const char *uri, int flags) h->is_streamed = 1; h->max_packet_size = 1472; - is_output = (flags & AVIO_WRONLY); + is_output = (flags & AVIO_FLAG_WRITE); s = av_mallocz(sizeof(UDPContext)); if (!s) @@ -358,14 +358,14 @@ static int udp_open(URLContext *h, const char *uri, int flags) /* XXX: fix av_url_split */ if (hostname[0] == '\0' || hostname[0] == '?') { /* only accepts null hostname if input */ - if (flags & AVIO_WRONLY) + if (flags & AVIO_FLAG_WRITE) goto fail; } else { if (ff_udp_set_remote_url(h, uri) < 0) goto fail; } - if (s->is_multicast && !(h->flags & AVIO_WRONLY)) + if (s->is_multicast && !(h->flags & AVIO_FLAG_WRITE)) s->local_port = port; udp_fd = udp_socket_create(s, &my_addr, &len); if (udp_fd < 0) @@ -382,7 +382,7 @@ static int udp_open(URLContext *h, const char *uri, int flags) /* the bind is needed to give a port to the socket now */ /* if multicast, try the multicast address bind first */ - if (s->is_multicast && !(h->flags & AVIO_WRONLY)) { + if (s->is_multicast && !(h->flags & AVIO_FLAG_WRITE)) { bind_ret = bind(udp_fd,(struct sockaddr *)&s->dest_addr, len); } /* bind to the local address if not multicast or if the multicast @@ -395,7 +395,7 @@ static int udp_open(URLContext *h, const char *uri, int flags) s->local_port = udp_port(&my_addr, len); if (s->is_multicast) { - if (h->flags & AVIO_WRONLY) { + if (h->flags & AVIO_FLAG_WRITE) { /* output */ if (udp_set_multicast_ttl(udp_fd, s->ttl, (struct sockaddr *)&s->dest_addr) < 0) goto fail; @@ -478,7 +478,7 @@ static int udp_close(URLContext *h) { UDPContext *s = h->priv_data; - if (s->is_multicast && !(h->flags & AVIO_WRONLY)) + if (s->is_multicast && !(h->flags & AVIO_FLAG_WRITE)) udp_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr); closesocket(s->udp_fd); av_free(s); diff --git a/libavformat/utils.c b/libavformat/utils.c index 1e70b4f592..0c80ff618e 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -561,7 +561,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, hack needed to handle RTSP/TCP */ if (!fmt || !(fmt->flags & AVFMT_NOFILE)) { /* if no file needed do not try to open one */ - if ((err=avio_open(&pb, filename, AVIO_RDONLY)) < 0) { + if ((err=avio_open(&pb, filename, AVIO_FLAG_READ)) < 0) { goto fail; } if (buf_size > 0) { From 55815edca038997ec283569a192a3eca7f2143bc Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sat, 9 Apr 2011 01:32:37 +0200 Subject: [PATCH 35/37] prefer avio_check() over url_exist() The problem with url_exist() is that it tries to open a resource in RDONLY mode. If the file is a FIFO and there is already a reading client, the open() call will hang. By using avio_check() with access mode of 0, the second reading process will check if the file exists without attempting to open it, thus avoiding the lock. Fix issue #1663. Signed-off-by: Anton Khirnov --- ffmpeg.c | 2 +- ffserver.c | 4 ++-- libavformat/img2.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index 5b6e3eae67..6e620bf55e 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -3733,7 +3733,7 @@ static void opt_output_file(const char *filename) (strchr(filename, ':') == NULL || filename[1] == ':' || av_strstart(filename, "file:", NULL))) { - if (url_exist(filename)) { + if (avio_check(filename, 0) == 0) { if (!using_stdin) { fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename); fflush(stderr); diff --git a/ffserver.c b/ffserver.c index 5defd40847..d341182a4f 100644 --- a/ffserver.c +++ b/ffserver.c @@ -3679,7 +3679,7 @@ static void build_feed_streams(void) for(feed = first_feed; feed != NULL; feed = feed->next_feed) { int fd; - if (url_exist(feed->feed_filename)) { + if (avio_check(feed->feed_filename, AVIO_FLAG_READ) > 0) { /* See if it matches */ AVFormatContext *s; int matches = 0; @@ -3752,7 +3752,7 @@ static void build_feed_streams(void) unlink(feed->feed_filename); } } - if (!url_exist(feed->feed_filename)) { + if (avio_check(feed->feed_filename, AVIO_FLAG_WRITE) <= 0) { AVFormatContext s1 = {0}, *s = &s1; if (feed->readonly) { diff --git a/libavformat/img2.c b/libavformat/img2.c index 84d841f0ed..1d50fbf567 100644 --- a/libavformat/img2.c +++ b/libavformat/img2.c @@ -131,11 +131,11 @@ static int find_image_range(int *pfirst_index, int *plast_index, if (av_get_frame_filename(buf, sizeof(buf), path, first_index) < 0){ *pfirst_index = *plast_index = 1; - if(url_exist(buf)) + if (avio_check(buf, AVIO_FLAG_READ) > 0) return 0; return -1; } - if (url_exist(buf)) + if (avio_check(buf, AVIO_FLAG_READ) > 0) break; } if (first_index == 5) @@ -153,7 +153,7 @@ static int find_image_range(int *pfirst_index, int *plast_index, if (av_get_frame_filename(buf, sizeof(buf), path, last_index + range1) < 0) goto fail; - if (!url_exist(buf)) + if (avio_check(buf, AVIO_FLAG_READ) <= 0) break; range = range1; /* just in case... */ From cda7aa9eba79e113c8e46455b81e3f5a047a8d98 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 19 Apr 2011 19:50:23 +0200 Subject: [PATCH 36/37] lavc: remove reference to opt.h from Makefile. Fixes make install after 3453a231a6cebe5989c213be0f9fd6c71ec5ea23. --- libavcodec/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 784226f7af..f05244ed95 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -3,7 +3,7 @@ include $(SUBDIR)../config.mak NAME = avcodec FFLIBS = avutil -HEADERS = avcodec.h avfft.h dxva2.h opt.h vaapi.h vdpau.h version.h xvmc.h +HEADERS = avcodec.h avfft.h dxva2.h vaapi.h vdpau.h version.h xvmc.h OBJS = allcodecs.o \ audioconvert.o \ From 31d76ec2883c04d29d1f173ea99e605a6936613a Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Sun, 17 Apr 2011 16:57:55 -0400 Subject: [PATCH 37/37] In avcodec_open(), set return code to an error value only when an error occurs instead of unconditionally at the start of the function. This fixes a bug where a successful call to ff_thread_init() masks errors that occur after that point in the function. It also makes future bugs like this less likely since the error code is now set near to the point in the code where the error is found. --- libavcodec/utils.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index a46dda7e9c..0190e6652c 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -456,7 +456,7 @@ AVFrame *avcodec_alloc_frame(void){ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec) { - int ret= -1; + int ret = 0; /* If there is a user-supplied mutex locking routine, call it. */ if (ff_lockmgr_cb) { @@ -467,11 +467,14 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec) entangled_thread_counter++; if(entangled_thread_counter != 1){ av_log(avctx, AV_LOG_ERROR, "insufficient thread locking around avcodec_open/close()\n"); + ret = -1; goto end; } - if(avctx->codec || !codec) + if(avctx->codec || !codec) { + ret = AVERROR(EINVAL); goto end; + } if (codec->priv_data_size > 0) { if(!avctx->priv_data){ @@ -521,6 +524,7 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec) if (avctx->codec_id != codec->id || (avctx->codec_type != codec->type && avctx->codec_type != AVMEDIA_TYPE_ATTACHMENT)) { av_log(avctx, AV_LOG_ERROR, "codec type or id mismatches\n"); + ret = AVERROR(EINVAL); goto free_and_end; } avctx->frame_number = 0; @@ -535,6 +539,7 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec) if (avctx->codec->max_lowres < avctx->lowres) { av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres supported by the decoder is %d\n", avctx->codec->max_lowres); + ret = AVERROR(EINVAL); goto free_and_end; } if (avctx->codec->sample_fmts && avctx->codec->encode) { @@ -544,6 +549,7 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec) break; if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) { av_log(avctx, AV_LOG_ERROR, "Specified sample_fmt is not supported.\n"); + ret = AVERROR(EINVAL); goto free_and_end; } } @@ -554,7 +560,6 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec) goto free_and_end; } } - ret=0; end: entangled_thread_counter--;