mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
Merge commit 'e7d6d0bf3c5cc1bc048b0ddbc169a91862568e0c'
* commit 'e7d6d0bf3c5cc1bc048b0ddbc169a91862568e0c': mov: Export geotag metadata fields Conflicts: libavformat/mov.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
a083543da0
@ -222,6 +222,44 @@ static int mov_metadata_raw(MOVContext *c, AVIOContext *pb,
|
||||
return av_dict_set(&c->fc->metadata, key, value, AV_DICT_DONT_STRDUP_VAL);
|
||||
}
|
||||
|
||||
static int mov_metadata_loci(MOVContext *c, AVIOContext *pb, unsigned len)
|
||||
{
|
||||
char language[4] = { 0 };
|
||||
char buf[100];
|
||||
uint16_t langcode = 0;
|
||||
double longitude, latitude, altitude;
|
||||
const char *key = "location";
|
||||
|
||||
if (len < 4 + 2 + 1 + 1 + 4 + 4 + 4)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
avio_skip(pb, 4); // version+flags
|
||||
langcode = avio_rb16(pb);
|
||||
ff_mov_lang_to_iso639(langcode, language);
|
||||
len -= 6;
|
||||
|
||||
len -= avio_get_str(pb, len, buf, sizeof(buf)); // place name
|
||||
if (len < 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
avio_skip(pb, 1); // role
|
||||
len -= 1;
|
||||
|
||||
if (len < 14)
|
||||
return AVERROR_INVALIDDATA;
|
||||
longitude = ((int32_t) avio_rb32(pb)) / (float) (1 << 16);
|
||||
latitude = ((int32_t) avio_rb32(pb)) / (float) (1 << 16);
|
||||
altitude = ((int32_t) avio_rb32(pb)) / (float) (1 << 16);
|
||||
|
||||
// Try to output in the same format as the ?xyz field
|
||||
snprintf(buf, sizeof(buf), "%+08.4f%+09.4f/", latitude, longitude);
|
||||
if (*language && strcmp(language, "und")) {
|
||||
char key2[16];
|
||||
snprintf(key2, sizeof(key2), "%s-%s", key, language);
|
||||
av_dict_set(&c->fc->metadata, key2, buf, 0);
|
||||
}
|
||||
return av_dict_set(&c->fc->metadata, key, buf, 0);
|
||||
}
|
||||
|
||||
static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
{
|
||||
#ifdef MOV_EXPORT_ALL_METADATA
|
||||
@ -281,6 +319,8 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
return mov_metadata_raw(c, pb, atom.size, "premiere_version");
|
||||
case MKTAG( '@','P','R','Q'):
|
||||
return mov_metadata_raw(c, pb, atom.size, "quicktime_version");
|
||||
case MKTAG( 'l','o','c','i'):
|
||||
return mov_metadata_loci(c, pb, atom.size);
|
||||
}
|
||||
|
||||
if (c->itunes_metadata && atom.size > 8) {
|
||||
|
Loading…
Reference in New Issue
Block a user