[FFmpeg-devel] [PATCH 8/8] asf: truncate date to year when muxing.
Anton Khirnov
wyskas
Wed Jun 2 15:16:05 CEST 2010
---
libavformat/asf.c | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/libavformat/asf.c b/libavformat/asf.c
index 8f940f5..288ccc9 100644
--- a/libavformat/asf.c
+++ b/libavformat/asf.c
@@ -132,6 +132,20 @@ const ff_asf_guid ff_asf_digital_signature = {
0xfc, 0xb3, 0x11, 0x22, 0x23, 0xbd, 0xd2, 0x11, 0xb4, 0xb7, 0x00, 0xa0, 0xc9, 0x55, 0xfc, 0x6e
};
+static void conv2native(AVMetadata **src, AVMetadata **dst)
+{
+ AVMetadataTag *t;
+ char year[5];
+
+ if (!(t = av_metadata_get(*src, "date", NULL, 0)))
+ return;
+
+ snprintf(year, sizeof(year), "%04d", atoi(t->value));
+ av_metadata_set2(dst, "WM/Year", year, 0);
+ av_metadata_set2(dst, t->key, t->value, 0);
+ av_metadata_remove(src, &t);
+}
+
/* List of official tags at http://msdn.microsoft.com/en-us/library/dd743066(VS.85).aspx */
static const AVMetadataConvTable asf_conv_table[] = {
{ "WM/AlbumArtist" , "album_artist"},
@@ -149,12 +163,13 @@ static const AVMetadataConvTable asf_conv_table[] = {
{ "WM/Tool" , "encoder" },
{ "WM/TrackNumber" , "track" },
{ "WM/Track" , "track" },
-// { "Year" , "date" }, TODO: conversion year<->date
+ { "WM/Year" , "date" },
{ 0 }
};
const AVMetadataConv ff_asf_metadata_conv = {
asf_conv_table,
+ .conv2native = conv2native,
};
int ff_put_str16_nolen(ByteIOContext *s, const char *tag)
--
1.7.1
More information about the ffmpeg-devel
mailing list