[FFmpeg-devel] [PATCH 3/3] Export metadata in the generic format.
Michael Niedermayer
michaelni
Mon Oct 11 22:33:21 CEST 2010
On Tue, Oct 05, 2010 at 07:57:06PM +0200, Anton Khirnov wrote:
> deprecate old conversion API.
> ---
> libavformat/asfdec.c | 3 +++
> libavformat/asfenc.c | 6 ++++++
> libavformat/avformat.h | 28 +++++++++++++++-------------
> libavformat/avidec.c | 4 ++++
> libavformat/avienc.c | 10 ++++------
> libavformat/flacdec.c | 2 ++
> libavformat/id3v2.c | 2 ++
> libavformat/matroskadec.c | 3 +++
> libavformat/matroskaenc.c | 10 ++++++++++
> libavformat/metadata.c | 11 +++--------
> libavformat/mp3.c | 7 +++++++
> libavformat/nutdec.c | 3 +++
> libavformat/nutenc.c | 3 +++
> libavformat/oggdec.c | 2 ++
> libavformat/oggparsevorbis.c | 3 +++
> libavformat/oma.c | 2 ++
> libavformat/vorbiscomment.c | 1 +
> 17 files changed, 73 insertions(+), 27 deletions(-)
>
> diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
> index 6741f8c..76cdfc6 100644
> --- a/libavformat/asfdec.c
> +++ b/libavformat/asfdec.c
> @@ -478,6 +478,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
> } else
> get_tag(s, name, value_type, value_len);
> }
> + metadata_conv(&s->metadata, NULL, ff_asf_metadata_conv);
> } else if (!guidcmp(&g, &ff_asf_metadata_header)) {
> int n, stream_num, name_len, value_len, value_type, value_num;
> n = get_le16(pb);
thats a strange place for it one would expect it at the end of the header
reading code
> @@ -1235,5 +1236,7 @@ AVInputFormat asf_demuxer = {
> asf_read_close,
> asf_read_seek,
> asf_read_pts,
> +#if FF_API_OLD_METADATA
> .metadata_conv = ff_asf_metadata_conv,
> +#endif
> };
> diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c
> index 9f8d69a..78cf9a4 100644
> --- a/libavformat/asfenc.c
> +++ b/libavformat/asfenc.c
> @@ -279,6 +279,8 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
> int bit_rate;
> int64_t duration;
>
> + metadata_conv(&s->metadata, ff_asf_metadata_conv, NULL);
> +
> tags[0] = av_metadata_get(s->metadata, "title" , NULL, 0);
> tags[1] = av_metadata_get(s->metadata, "author" , NULL, 0);
> tags[2] = av_metadata_get(s->metadata, "copyright", NULL, 0);
> @@ -870,7 +872,9 @@ AVOutputFormat asf_muxer = {
> asf_write_trailer,
> .flags = AVFMT_GLOBALHEADER,
> .codec_tag= (const AVCodecTag* const []){codec_asf_bmp_tags, ff_codec_bmp_tags, ff_codec_wav_tags, 0},
> +#if FF_API_OLD_METADATA
> .metadata_conv = ff_asf_metadata_conv,
> +#endif
> };
> #endif
>
> @@ -892,6 +896,8 @@ AVOutputFormat asf_stream_muxer = {
> asf_write_trailer,
> .flags = AVFMT_GLOBALHEADER,
> .codec_tag= (const AVCodecTag* const []){codec_asf_bmp_tags, ff_codec_bmp_tags, ff_codec_wav_tags, 0},
> +#if FF_API_OLD_METADATA
> .metadata_conv = ff_asf_metadata_conv,
> +#endif
> };
> #endif //CONFIG_ASF_STREAM_MUXER
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index 362a056..57afa53 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -22,7 +22,7 @@
> #define AVFORMAT_AVFORMAT_H
>
> #define LIBAVFORMAT_VERSION_MAJOR 52
> -#define LIBAVFORMAT_VERSION_MINOR 79
> +#define LIBAVFORMAT_VERSION_MINOR 80
> #define LIBAVFORMAT_VERSION_MICRO 0
>
> #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
> @@ -107,10 +107,9 @@ struct AVFormatContext;
> * sorting will have '-sort' appended. E.g. artist="The Beatles",
> * artist-sort="Beatles, The".
> *
> - * 4. Tag names are normally exported exactly as stored in the container to
> - * allow lossless remuxing to the same format. For container-independent
> - * handling of metadata, av_metadata_conv() can convert it to ffmpeg generic
> - * format. Follows a list of generic tag names:
> + * 4. Demuxers attempt to export metadata in a generic format, however tags
> + * with no generic equivalents are left as they are stored in the format.
> + * Follows a list of generic tag names:
> *
> * album -- name of the set this work belongs to
> * album_artist -- main creator of the set/album, if different from artist.
> @@ -147,7 +146,9 @@ typedef struct {
> }AVMetadataTag;
>
> typedef struct AVMetadata AVMetadata;
> +#if FF_API_OLD_METADATA
> typedef struct AVMetadataConv AVMetadataConv;
> +#endif
>
> /**
> * Get a metadata element with matching key.
> @@ -186,16 +187,13 @@ 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
> /**
> - * Convert all the metadata sets from ctx according to the source and
> - * destination conversion tables. If one of the tables is NULL, then
> - * tags are converted to/from ffmpeg generic tag names.
> - *
> - * @param d_conv destination tags format conversion table
> - * @param s_conv source tags format conversion table
> + * This function is provided for compatibility reason and currently does nothing.
> */
> -void av_metadata_conv(struct AVFormatContext *ctx, const AVMetadataConv *d_conv,
> - const AVMetadataConv *s_conv);
> +attribute_deprecated void av_metadata_conv(struct AVFormatContext *ctx, const AVMetadataConv *d_conv,
> + const AVMetadataConv *s_conv);
> +#endif
>
> /**
> * Free all the memory allocated for an AVMetadata struct.
> @@ -319,7 +317,9 @@ typedef struct AVOutputFormat {
>
> enum CodecID subtitle_codec; /**< default subtitle codec */
>
> +#if FF_API_OLD_METADATA
> const AVMetadataConv *metadata_conv;
> +#endif
>
> /* private fields */
> struct AVOutputFormat *next;
> @@ -434,7 +434,9 @@ 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;
> diff --git a/libavformat/avidec.c b/libavformat/avidec.c
> index 84ccaec..8aeff6b 100644
> --- a/libavformat/avidec.c
> +++ b/libavformat/avidec.c
> @@ -280,6 +280,7 @@ static void avi_read_info(AVFormatContext *s, uint64_t end)
> uint32_t size = get_le32(s->pb);
> avi_read_tag(s, NULL, tag, size);
> }
> + metadata_conv(&s->metadata, NULL, ff_avi_metadata_conv);
> }
>
same as asf odd place, there could be multipl info tags
and the same applies to other changes too
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101011/c955c9a8/attachment.pgp>
More information about the ffmpeg-devel
mailing list