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

Vittorio Giovara vittorio.giovara at gmail.com
Sat Nov 12 19:32:00 EET 2016


On Fri, Nov 11, 2016 at 6:23 PM, James Almer <jamrial at gmail.com> wrote:
> On 11/11/2016 7:49 PM, Vittorio Giovara wrote:
>> This implements Spherical Video V1 and V2, as described in the
>> spatial-media collection by Google.
>>
>> Signed-off-by: Vittorio Giovara <vittorio.giovara at gmail.com>
>> ---
>> Please CC.
>> Vittorio
>>
>>  libavformat/isom.h |   7 ++
>>  libavformat/mov.c  | 281 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
>>  2 files changed, 287 insertions(+), 1 deletion(-)
>
> [...]
>
>> @@ -5682,6 +5927,40 @@ static int mov_read_header(AVFormatContext *s)
>>                  sd->data = (uint8_t*)sc->display_matrix;
>>                  sc->display_matrix = NULL;
>>              }
>> +            if (sc->stereo3d) {
>> +                AVPacketSideData *sd, *tmp;
>> +
>> +                tmp = av_realloc_array(st->side_data,
>> +                                       st->nb_side_data + 1, sizeof(*tmp));
>> +                if (!tmp)
>> +                    return AVERROR(ENOMEM);
>> +
>> +                st->side_data = tmp;
>> +                st->nb_side_data++;
>> +
>> +                sd = &st->side_data[st->nb_side_data - 1];
>> +                sd->type = AV_PKT_DATA_STEREO3D;
>> +                sd->size = sizeof(*sc->stereo3d);
>> +                sd->data = (uint8_t *)sc->stereo3d;
>> +                sc->stereo3d = NULL;
>> +            }
>> +            if (sc->spherical) {
>> +                AVPacketSideData *sd, *tmp;
>> +
>> +                tmp = av_realloc_array(st->side_data,
>> +                                       st->nb_side_data + 1, sizeof(*tmp));
>> +                if (!tmp)
>> +                    return AVERROR(ENOMEM);
>> +
>> +                st->side_data = tmp;
>> +                st->nb_side_data++;
>> +
>> +                sd = &st->side_data[st->nb_side_data - 1];
>> +                sd->type = AV_PKT_DATA_SPHERICAL;
>> +                sd->size = sc->spherical_size;
>> +                sd->data = (uint8_t *)sc->spherical;
>> +                sc->spherical = NULL;
>> +            }
>
> Why isn't this using av_stream_new_side_data()?

I didn't want to mix refactors and new code in a single patch,
coalescing that portion of code may be done later.
-- 
Vittorio


More information about the ffmpeg-devel mailing list