[FFmpeg-devel] [PATCH 3/3 v2] mov: Export spherical information

Vittorio Giovara vittorio.giovara at gmail.com
Wed Nov 16 17:33:19 EET 2016


On Tue, Nov 15, 2016 at 10:09 PM, James Almer <jamrial at gmail.com> wrote:
> On 11/15/2016 1:56 PM, Vittorio Giovara wrote:
>> +static int mov_read_st3d(MOVContext *c, AVIOContext *pb, MOVAtom atom)
>> +{
>> +    AVStream *st;
>> +    MOVStreamContext *sc;
>> +    enum AVStereo3DType type;
>> +    int mode;
>> +
>> +    if (c->fc->nb_streams < 1)
>> +        return 0;
>> +
>> +    st = c->fc->streams[c->fc->nb_streams - 1];
>> +    sc = st->priv_data;
>> +
>> +    if (atom.size < 1) {
>> +        av_log(c->fc, AV_LOG_ERROR, "Empty stereoscopic video box\n");
>> +        return AVERROR_INVALIDDATA;
>> +    }
>> +
>> +    mode = avio_r8(pb);
>
> If i'm reading the spec right, st3d is a FullBox so before the data you'll
> have the box's version and flags (1 byte and 3 bytes respectively).

Oh I see, so I should check for version == 0 and read three bytes only
instead of 4.

>> +        av_log(c->fc, AV_LOG_ERROR, "Missing projection header box\n");
>> +        return 0;
>> +    }
>> +
>> +    /* 16.16 fixed point */
>> +    yaw   = avio_rb32(pb);
>> +    pitch = avio_rb32(pb);
>> +    roll  = avio_rb32(pb);
>> +
>> +    avio_skip(pb, size - 20);
>> +
>> +    size = avio_rb32(pb);
>> +    if (size > atom.size)
>> +        return AVERROR_INVALIDDATA;
>> +
>> +    tag = avio_rl32(pb);
>
> And all the possible cases for this one, except in here it seems to be 4 bytes for
> version and four for flags.
>
> Does Google offer samples to confirm this?

Yep.

https://transfer.sh/WOegj/motherboard-cube-v2-metadata.mp4
https://transfer.sh/31Zvg/motherboard-equirect-v1-metadata.mp4
https://transfer.sh/tn1xe/motherboard-equirect-v2-metadata.mp4

Thanks
-- 
Vittorio


More information about the ffmpeg-devel mailing list