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

2016-11-12 Thread Vittorio Giovara
On Fri, Nov 11, 2016 at 6:23 PM, James Almer  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 
>> ---
>> 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 = >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 = >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
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


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

2016-11-11 Thread James Almer
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 
> ---
> 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 = >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 = >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()?

The question also goes for the display_matrix case already in the tree.

>  break;
>  }
>  }
> 

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel