[FFmpeg-cvslog] r25821 - trunk/libavformat/avidec.c
aurel
subversion
Wed Nov 24 21:53:28 CET 2010
Author: aurel
Date: Wed Nov 24 21:53:27 2010
New Revision: 25821
Log:
avidec: read some of the Nikon specific tags produced by Nikon cameras
Modified:
trunk/libavformat/avidec.c
Modified: trunk/libavformat/avidec.c
==============================================================================
--- trunk/libavformat/avidec.c Wed Nov 24 19:07:39 2010 (r25820)
+++ trunk/libavformat/avidec.c Wed Nov 24 21:53:27 2010 (r25821)
@@ -301,6 +301,42 @@ static void avi_metadata_creation_time(A
}
}
+static void avi_read_nikon(AVFormatContext *s, uint64_t end)
+{
+ while (url_ftell(s->pb) < end) {
+ uint32_t tag = get_le32(s->pb);
+ uint32_t size = get_le32(s->pb);
+ switch (tag) {
+ case MKTAG('n', 'c', 't', 'g'): { /* Nikon Tags */
+ uint64_t tag_end = url_ftell(s->pb) + size;
+ while (url_ftell(s->pb) < tag_end) {
+ uint16_t tag = get_le16(s->pb);
+ uint16_t size = get_le16(s->pb);
+ const char *name = NULL;
+ char buffer[64] = {0};
+ size -= get_buffer(s->pb, buffer,
+ FFMIN(size, sizeof(buffer)-1));
+ switch (tag) {
+ case 0x03: name = "maker"; break;
+ case 0x04: name = "model"; break;
+ case 0x13: name = "creation_time";
+ if (buffer[4] == ':' && buffer[7] == ':')
+ buffer[4] = buffer[7] = '-';
+ break;
+ }
+ if (name)
+ av_metadata_set2(&s->metadata, name, buffer, 0);
+ url_fskip(s->pb, size);
+ }
+ break;
+ }
+ default:
+ url_fskip(s->pb, size);
+ break;
+ }
+ }
+}
+
static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
AVIContext *avi = s->priv_data;
@@ -354,6 +390,8 @@ static int avi_read_header(AVFormatConte
}
else if (tag1 == MKTAG('I', 'N', 'F', 'O'))
avi_read_info(s, list_end);
+ else if (tag1 == MKTAG('n', 'c', 'd', 't'))
+ avi_read_nikon(s, list_end);
break;
case MKTAG('I', 'D', 'I', 'T'): {
More information about the ffmpeg-cvslog
mailing list