On Wed, Nov 02, 2016 at 02:15:07PM -0400, Vittorio Giovara wrote:
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -3154,6 +3155,242 @@ static int mov_read_elst(MOVContext *c, AVIOContext 
> *pb, MOVAtom atom)
>  
> +static int mov_read_st3d(MOVContext *c, AVIOContext *pb, MOVAtom atom)
> +{
> +    mode = avio_r8(pb);
> +    switch(mode) {

switch (

> +static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, MOVAtom atom)
> +{
> +    switch(tag) {
> +    case MKTAG('c','b','m','p'):

same

> +            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 = sizeof(*sc->spherical);
> +                sd->data = (uint8_t *)sc->spherical;
> +                sc->spherical = 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;
> +            }

The code duplication here should be refactored IMO.

Diego
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to