[FFmpeg-devel] [PATCH] Add support for spherical uuid in mov

Colin McFadden cmcfadden at gmail.com
Thu Apr 21 05:14:33 CEST 2016


That makes sense.  I’ve attached a revised patch which will store a “spherical-video” tag in stream metadata, assuming we have a stream (moov level uuid atoms shouldn’t have spherical metadata according to the RFC).

This is my first time submitting an ffmpeg patch, so please clue me in if I’m off the rails.  Thanks!

-Colin


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-support-for-spherical-metadata-from-uuid-atom-st.patch
Type: application/octet-stream
Size: 2296 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160420/f021bb32/attachment.obj>
-------------- next part --------------


> On Apr 20, 2016, at 9:46 PM, Neil Birkbeck <neil.birkbeck at gmail.com> wrote:
> 
> If you use "spherical-video" and put it in the stream's metadata, it
> will more naturally agree with location in stream-level tag in mkv:
> https://github.com/google/spatial-media/blob/master/docs/spherical-video-rfc.md
> 
> On Wed, Apr 20, 2016 at 6:24 PM, Colin McFadden <cmcfadden at gmail.com> wrote:
>> ---
>> libavformat/mov.c | 26 ++++++++++++++++++++++++++
>> 1 file changed, 26 insertions(+)
>> 
>> diff --git a/libavformat/mov.c b/libavformat/mov.c
>> index 47af98c..2223c81 100644
>> --- a/libavformat/mov.c
>> +++ b/libavformat/mov.c
>> @@ -3912,6 +3912,11 @@ static int mov_read_uuid(MOVContext *c, AVIOContext *pb, MOVAtom atom)
>>         0xbe, 0x7a, 0xcf, 0xcb, 0x97, 0xa9, 0x42, 0xe8,
>>         0x9c, 0x71, 0x99, 0x94, 0x91, 0xe3, 0xaf, 0xac
>>     };
>> +     static const uint8_t uuid_spherical[] = {
>> +        0xFF, 0xCC, 0x82, 0x63, 0xF8, 0x55, 0x4A, 0x93,
>> +        0x88, 0x14, 0x58, 0x7A, 0x02, 0x52, 0x1F, 0xDD
>> +    };
>> +
>> 
>>     if (atom.size < sizeof(uuid) || atom.size == INT64_MAX)
>>         return AVERROR_INVALIDDATA;
>> @@ -3987,6 +3992,27 @@ static int mov_read_uuid(MOVContext *c, AVIOContext *pb, MOVAtom atom)
>>             av_dict_set(&c->fc->metadata, "xmp", buffer, 0);
>>         }
>>         av_free(buffer);
>> +    } else if (!memcmp(uuid, uuid_spherical, sizeof(uuid))) {
>> +        uint8_t *buffer;
>> +        size_t len = atom.size - sizeof(uuid);
>> +
>> +        buffer = av_mallocz(len + 1);
>> +        if (!buffer) {
>> +            return AVERROR(ENOMEM);
>> +        }
>> +        ret = avio_read(pb, buffer, len);
>> +        if (ret < 0) {
>> +            av_free(buffer);
>> +            return ret;
>> +        } else if (ret != len) {
>> +            av_free(buffer);
>> +            return AVERROR_INVALIDDATA;
>> +        }
>> +        if (c->export_all) {
>> +            buffer[len] = '\0';
>> +            av_dict_set(&c->fc->metadata, "spherical", buffer, 0);
>> +        }
>> +        av_free(buffer);
>>     }
>>     return 0;
>> }
>> --
>> 2.6.3
>> 
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



More information about the ffmpeg-devel mailing list