changeset 6384:2d51ca7714c3 libavformat

add LAVF_API_OLD_METADATA define to disable the deprecated metadata API
author aurel
date Tue, 17 Aug 2010 20:23:19 +0000
parents 65745776af68
children ea409874020e
files avformat.h metadata.c metadata.h metadata_compat.c options.c utils.c
diffstat 6 files changed, 21 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/avformat.h	Tue Aug 17 19:30:21 2010 +0000
+++ b/avformat.h	Tue Aug 17 20:23:19 2010 +0000
@@ -38,6 +38,9 @@
 #ifndef LAVF_API_MAX_STREAMS
 #define LAVF_API_MAX_STREAMS  (LIBAVFORMAT_VERSION_MAJOR < 53)
 #endif
+#ifndef LAVF_API_OLD_METADATA
+#define LAVF_API_OLD_METADATA (LIBAVFORMAT_VERSION_MAJOR < 53)
+#endif
 
 /**
  * I return the LIBAVFORMAT_VERSION_INT constant.  You got
@@ -144,7 +147,7 @@
 AVMetadataTag *
 av_metadata_get(AVMetadata *m, const char *key, const AVMetadataTag *prev, int flags);
 
-#if LIBAVFORMAT_VERSION_MAJOR == 52
+#if LAVF_API_OLD_METADATA
 /**
  * Set the given tag in *pm, overwriting an existing tag.
  *
@@ -520,7 +523,7 @@
      */
     int64_t duration;
 
-#if LIBAVFORMAT_VERSION_INT < (53<<16)
+#if LAVF_API_OLD_METADATA
     char language[4]; /**< ISO 639-2/B 3-letter language code (empty string if undefined) */
 #endif
 
@@ -541,7 +544,9 @@
 
 #if LIBAVFORMAT_VERSION_INT < (53<<16)
     int64_t unused[4+1];
+#endif
 
+#if LAVF_API_OLD_METADATA
     char *filename; /**< source filename of the stream */
 #endif
 
@@ -610,7 +615,7 @@
  */
 typedef struct AVProgram {
     int            id;
-#if LIBAVFORMAT_VERSION_INT < (53<<16)
+#if LAVF_API_OLD_METADATA
     char           *provider_name; ///< network name for DVB streams
     char           *name;          ///< service name for DVB streams
 #endif
@@ -628,7 +633,7 @@
     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 LIBAVFORMAT_VERSION_INT < (53<<16)
+#if LAVF_API_OLD_METADATA
     char *title;            ///< chapter title
 #endif
     AVMetadata *metadata;
@@ -657,7 +662,7 @@
     char filename[1024]; /**< input or output filename */
     /* stream info */
     int64_t timestamp;
-#if LIBAVFORMAT_VERSION_INT < (53<<16)
+#if LAVF_API_OLD_METADATA
     char title[512];
     char author[512];
     char copyright[512];
--- a/metadata.c	Tue Aug 17 19:30:21 2010 +0000
+++ b/metadata.c	Tue Aug 17 20:23:19 2010 +0000
@@ -86,7 +86,7 @@
     return 0;
 }
 
-#if LIBAVFORMAT_VERSION_MAJOR == 52
+#if LAVF_API_OLD_METADATA
 int av_metadata_set(AVMetadata **pm, const char *key, const char *value)
 {
     return av_metadata_set2(pm, key, value, 0);
--- a/metadata.h	Tue Aug 17 19:30:21 2010 +0000
+++ b/metadata.h	Tue Aug 17 20:23:19 2010 +0000
@@ -40,7 +40,7 @@
     const char *generic;
 };
 
-#if LIBAVFORMAT_VERSION_MAJOR < 53
+#if LAVF_API_OLD_METADATA
 void ff_metadata_demux_compat(AVFormatContext *s);
 void ff_metadata_mux_compat(AVFormatContext *s);
 #endif
--- a/metadata_compat.c	Tue Aug 17 19:30:21 2010 +0000
+++ b/metadata_compat.c	Tue Aug 17 20:23:19 2010 +0000
@@ -23,7 +23,7 @@
 #include "metadata.h"
 #include "libavutil/avstring.h"
 
-#if LIBAVFORMAT_VERSION_MAJOR < 53
+#if LAVF_API_OLD_METADATA
 
 #define SIZE_OFFSET(x) sizeof(((AVFormatContext*)0)->x),offsetof(AVFormatContext,x)
 
@@ -145,4 +145,4 @@
     }
 }
 
-#endif /* LIBAVFORMAT_VERSION_MAJOR < 53 */
+#endif /* LAVF_API_OLD_METADATA */
--- a/options.c	Tue Aug 17 19:30:21 2010 +0000
+++ b/options.c	Tue Aug 17 20:23:19 2010 +0000
@@ -50,7 +50,7 @@
 {"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 LIBAVFORMAT_VERSION_INT < (53<<16)
+#if LAVF_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
--- a/utils.c	Tue Aug 17 19:30:21 2010 +0000
+++ b/utils.c	Tue Aug 17 20:23:19 2010 +0000
@@ -457,7 +457,7 @@
     if (pb && !ic->data_offset)
         ic->data_offset = url_ftell(ic->pb);
 
-#if LIBAVFORMAT_VERSION_MAJOR < 53
+#if LAVF_API_OLD_METADATA
     ff_metadata_demux_compat(ic);
 #endif
 
@@ -2460,14 +2460,14 @@
         av_free(st->index_entries);
         av_free(st->codec->extradata);
         av_free(st->codec);
-#if LIBAVFORMAT_VERSION_INT < (53<<16)
+#if LAVF_API_OLD_METADATA
         av_free(st->filename);
 #endif
         av_free(st->priv_data);
         av_free(st);
     }
     for(i=s->nb_programs-1; i>=0; i--) {
-#if LIBAVFORMAT_VERSION_INT < (53<<16)
+#if LAVF_API_OLD_METADATA
         av_freep(&s->programs[i]->provider_name);
         av_freep(&s->programs[i]->name);
 #endif
@@ -2479,7 +2479,7 @@
     flush_packet_queue(s);
     av_freep(&s->priv_data);
     while(s->nb_chapters--) {
-#if LIBAVFORMAT_VERSION_INT < (53<<16)
+#if LAVF_API_OLD_METADATA
         av_free(s->chapters[s->nb_chapters]->title);
 #endif
         av_metadata_free(&s->chapters[s->nb_chapters]->metadata);
@@ -2582,7 +2582,7 @@
             return NULL;
         dynarray_add(&s->chapters, &s->nb_chapters, chapter);
     }
-#if LIBAVFORMAT_VERSION_INT < (53<<16)
+#if LAVF_API_OLD_METADATA
     av_free(chapter->title);
 #endif
     av_metadata_set2(&chapter->metadata, "title", title, 0);
@@ -2718,7 +2718,7 @@
             return AVERROR(ENOMEM);
     }
 
-#if LIBAVFORMAT_VERSION_MAJOR < 53
+#if LAVF_API_OLD_METADATA
     ff_metadata_mux_compat(s);
 #endif