static int mov_read_aclr(MOVContext *c, AVIOContext *pb, MOVAtom atom)

{

    int ret = 0;

    int length = 0;

    uint64_t original_size;

    if (c->fc->nb_streams >= 1) {

        AVCodecContext *codec = c->fc->streams[c->fc->nb_streams-1]->codec;

        if (codec->codec_id == AV_CODEC_ID_H264)

            return 0;

        if (atom.size == 16) {

            original_size = codec->extradata_size;

            ret = mov_realloc_extradata(codec, atom);

            if (!ret) {

                length =  mov_read_atom_into_extradata(c, pb, atom, codec, codec->extradata + original_size);

                if (length == atom.size) {

                    const uint8_t range_value = codec->extradata[original_size + 19];

                    switch (range_value) {

                    case 1:

                        codec->color_range = AVCOL_RANGE_MPEG;

                        break;

                    case 2:

                        codec->color_range = AVCOL_RANGE_JPEG;

                        break;

                    default:

                        av_log(c, AV_LOG_WARNING, "ignored unknown aclr value (%d)\n", range_value);

                        break;

                    }

                    av_dlog(c, "color_range: %d\n", codec->color_range);

                } else {

                  /* For some reason the whole atom was not added to the extradata */

                  av_log(c, AV_LOG_ERROR, "aclr not decoded - incomplete atom\n");

                }

            } else {

                av_log(c, AV_LOG_ERROR, "aclr not decoded - unable to add atom to extradata\n");

            }

        } else {

            av_log(c, AV_LOG_WARNING, "aclr not decoded - unexpected size %"PRId64"\n", atom.size);

        }

    }



    return ret;

}

static int mov_read_aclr(MOVContext *c, AVIOContext *pb, MOVAtom atom)

{

    int ret = 0;

    int length = 0;

    uint64_t original_size;

    if (c->fc->nb_streams >= 1) {

        AVCodecContext *codec = c->fc->streams[c->fc->nb_streams-1]->codec;

        if (codec->codec_id == AV_CODEC_ID_H264)

            return 0;

        if (atom.size == 16) {

            original_size = codec->extradata_size;

            ret = mov_realloc_extradata(codec, atom);

            if (!ret) {

                length =  mov_read_atom_into_extradata(c, pb, atom, codec, codec->extradata + original_size);

                if (length == atom.size) {

                    const uint8_t range_value = codec->extradata[original_size + 19];

                    switch (range_value) {

                    case 1:

                        codec->color_range = AVCOL_RANGE_MPEG;

                        break;

                    case 2:

                        codec->color_range = AVCOL_RANGE_JPEG;

                        break;

                    default:

                        av_log(c, AV_LOG_WARNING, "ignored unknown aclr value (%d)\n", range_value);

                        break;

                    }

                    av_dlog(c, "color_range: %d\n", codec->color_range);

                } else {

                  

                  av_log(c, AV_LOG_ERROR, "aclr not decoded - incomplete atom\n");

                }

            } else {

                av_log(c, AV_LOG_ERROR, "aclr not decoded - unable to add atom to extradata\n");

            }

        } else {

            av_log(c, AV_LOG_WARNING, "aclr not decoded - unexpected size %"PRId64"\n", atom.size);

        }

    }



    return ret;

}

static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2)

{

    int VAR_3 = 0;

    int VAR_4 = 0;

    uint64_t original_size;

    if (VAR_0->fc->nb_streams >= 1) {

        AVCodecContext *codec = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]->codec;

        if (codec->codec_id == AV_CODEC_ID_H264)

            return 0;

        if (VAR_2.size == 16) {

            original_size = codec->extradata_size;

            VAR_3 = mov_realloc_extradata(codec, VAR_2);

            if (!VAR_3) {

                VAR_4 =  mov_read_atom_into_extradata(VAR_0, VAR_1, VAR_2, codec, codec->extradata + original_size);

                if (VAR_4 == VAR_2.size) {

                    const uint8_t VAR_5 = codec->extradata[original_size + 19];

                    switch (VAR_5) {

                    case 1:

                        codec->color_range = AVCOL_RANGE_MPEG;

                        break;

                    case 2:

                        codec->color_range = AVCOL_RANGE_JPEG;

                        break;

                    default:

                        av_log(VAR_0, AV_LOG_WARNING, "ignored unknown aclr value (%d)\n", VAR_5);

                        break;

                    }

                    av_dlog(VAR_0, "color_range: %d\n", codec->color_range);

                } else {

                  

                  av_log(VAR_0, AV_LOG_ERROR, "aclr not decoded - incomplete VAR_2\n");

                }

            } else {

                av_log(VAR_0, AV_LOG_ERROR, "aclr not decoded - unable to add VAR_2 to extradata\n");

            }

        } else {

            av_log(VAR_0, AV_LOG_WARNING, "aclr not decoded - unexpected size %"PRId64"\n", VAR_2.size);

        }

    }



    return VAR_3;

}

static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2)
{ int VAR_3 = 0; int VAR_4 = 0; uint64_t original_size; if (VAR_0->fc->nb_streams >= 1) { AVCodecContext *codec = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]->codec; if (codec->codec_id == AV_CODEC_ID_H264)
return 0; if (VAR_2.size == 16) { original_size = codec->extradata_size; VAR_3 = mov_realloc_extradata(codec, VAR_2); if (!VAR_3) { VAR_4 =  mov_read_atom_into_extradata(VAR_0, VAR_1, VAR_2, codec, codec->extradata + original_size); if (VAR_4 == VAR_2.size) { const uint8_t VAR_5 = codec->extradata[original_size + 19]; switch (VAR_5) { case 1:
codec->color_range = AVCOL_RANGE_MPEG; break; case 2:
codec->color_range = AVCOL_RANGE_JPEG; break; default:
av_log(VAR_0, AV_LOG_WARNING, "ignored unknown aclr value (%d)\n", VAR_5); break; } av_dlog(VAR_0, "color_range: %d\n", codec->color_range); } else { av_log(VAR_0, AV_LOG_ERROR, "aclr not decoded - incomplete VAR_2\n"); } } else { av_log(VAR_0, AV_LOG_ERROR, "aclr not decoded - unable to add VAR_2 to extradata\n"); } } else { av_log(VAR_0, AV_LOG_WARNING, "aclr not decoded - unexpected size %"PRId64"\n", VAR_2.size); } } return VAR_3; }