[FFmpeg-devel] [PATCH 03/16] lavf: remove FF_API_OLD_METADATA cruft
Anton Khirnov
anton
Thu Feb 3 16:36:30 CET 2011
---
libavformat/Makefile | 1 -
libavformat/avformat.h | 58 ----------------
libavformat/metadata.c | 13 ----
libavformat/metadata.h | 7 --
libavformat/metadata_compat.c | 148 -----------------------------------------
libavformat/options.c | 4 -
libavformat/utils.c | 21 ------
libavformat/version.h | 3 -
8 files changed, 0 insertions(+), 255 deletions(-)
delete mode 100644 libavformat/metadata_compat.c
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 8f583e0..5a7e77a 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 b177b6a..2f304de 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -117,9 +117,6 @@ typedef struct {
}AVMetadataTag;
typedef struct AVMetadata AVMetadata;
-#if FF_API_OLD_METADATA
-typedef struct AVMetadataConv AVMetadataConv;
-#endif
/**
* Get a metadata element with matching key.
@@ -132,20 +129,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.
*
@@ -158,14 +141,6 @@ attribute_deprecated int av_metadata_set(AVMetadata **pm, const char *key, const
*/
int av_metadata_set2(AVMetadata **pm, const char *key, const char *value, int flags);
-#if FF_API_OLD_METADATA
-/**
- * This function is provided for compatibility reason and currently does nothing.
- */
-attribute_deprecated void av_metadata_conv(struct AVFormatContext *ctx, const AVMetadataConv *d_conv,
- const AVMetadataConv *s_conv);
-#endif
-
/**
* Copy metadata from one AVMetadata struct into another.
* @param dst pointer to a pointer to a AVMetadata struct. If *dst is NULL,
@@ -314,10 +289,6 @@ typedef struct AVOutputFormat {
enum CodecID subtitle_codec; /**< default subtitle codec */
-#if FF_API_OLD_METADATA
- const AVMetadataConv *metadata_conv;
-#endif
-
const AVClass *priv_class; ///< AVClass for the private context
/* private fields */
@@ -434,10 +405,6 @@ typedef struct AVInputFormat {
*/
int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags);
-#if FF_API_OLD_METADATA
- const AVMetadataConv *metadata_conv;
-#endif
-
/* private fields */
struct AVInputFormat *next;
} AVInputFormat;
@@ -538,10 +505,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;
@@ -561,10 +524,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;
@@ -642,10 +601,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;
@@ -660,9 +615,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;
@@ -685,16 +637,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 7d9a864..bc0a51b 100644
--- a/libavformat/metadata.c
+++ b/libavformat/metadata.c
@@ -86,19 +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);
-}
-
-void av_metadata_conv(AVFormatContext *ctx, const AVMetadataConv *d_conv,
- const AVMetadataConv *s_conv)
-{
- return;
-}
-#endif
-
void av_metadata_free(AVMetadata **pm)
{
AVMetadata *m= *pm;
diff --git a/libavformat/metadata.h b/libavformat/metadata.h
index 9e86650..f3798de 100644
--- a/libavformat/metadata.h
+++ b/libavformat/metadata.h
@@ -39,14 +39,7 @@ struct AVMetadataConv{
const char *native;
const char *generic;
};
-#if !FF_API_OLD_METADATA
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);
diff --git a/libavformat/metadata_compat.c b/libavformat/metadata_compat.c
deleted file mode 100644
index 19b8f59..0000000
--- a/libavformat/metadata_compat.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2009 Aurelien Jacobs <aurel at gnuage.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <strings.h>
-#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; j<m->count; j++)
- for (i=0; i<FF_ARRAY_ELEMS(compat_tab); i++)
- if (!strcasecmp(m->elems[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; i<ctx->nb_chapters; i++)
- if ((m = ctx->chapters[i]->metadata))
- for (j=0; j<m->count; 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; i<ctx->nb_programs; i++)
- if ((m = ctx->programs[i]->metadata))
- for (j=0; j<m->count; 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; i<ctx->nb_streams; i++)
- if ((m = ctx->streams[i]->metadata))
- for (j=0; j<m->count; 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; i<ctx->nb_chapters; i++)
- FILL_METADATA_STR(ctx->chapters[i], title);
- for (i=0; i<ctx->nb_programs; i++) {
- FILL_METADATA_STR(ctx->programs[i], name);
- FILL_METADATA_STR(ctx->programs[i], provider_name);
- }
- for (i=0; i<ctx->nb_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 27eb8da..20fbca5 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 ba640cf..ab2067a 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -492,10 +492,6 @@ int av_open_input_stream(AVFormatContext **ic_ptr,
if (pb && !ic->data_offset)
ic->data_offset = url_ftell(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;
@@ -2559,18 +2555,11 @@ void av_close_input_stream(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]);
@@ -2578,9 +2567,6 @@ void av_close_input_stream(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]);
}
@@ -2689,9 +2675,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;
@@ -2829,10 +2812,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 d6c4b25..73cae55 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_URL_CLASS
#define FF_API_URL_CLASS (LIBAVFORMAT_VERSION_MAJOR >= 53)
#endif
--
1.7.2.3
More information about the ffmpeg-devel
mailing list