Commit 8ba5bf5a authored by Aurelien Jacobs's avatar Aurelien Jacobs
Browse files

avidec: read some of the Nikon specific tags produced by Nikon cameras

Originally committed as revision 25821 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 459b0661
......@@ -301,6 +301,42 @@ static void avi_metadata_creation_time(AVMetadata **metadata, char *date)
}
}
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(AVFormatContext *s, AVFormatParameters *ap)
}
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'): {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment