[FFmpeg-devel] [PATCH] Add support for spherical uuid in mov
Neil Birkbeck
neil.birkbeck at gmail.com
Thu Apr 21 04:46:05 CEST 2016
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