static int mov_write_trak_tag(AVIOContext *pb, MOVMuxContext *mov,

                              MOVTrack *track, AVStream *st)

{

    int64_t pos = avio_tell(pb);

    avio_wb32(pb, 0); /* size */

    ffio_wfourcc(pb, "trak");

    mov_write_tkhd_tag(pb, mov, track, st);

    if (track->mode == MODE_PSP || track->flags & MOV_TRACK_CTTS ||

        (track->entry && track->cluster[0].dts) ||

        is_clcp_track(track)) {

        if (mov->use_editlist)

            mov_write_edts_tag(pb, mov, track);  // PSP Movies require edts box

        else if ((track->entry && track->cluster[0].dts) || track->mode == MODE_PSP || is_clcp_track(track))

            av_log(mov->fc, AV_LOG_WARNING,

                   "Not writing any edit list even though one would have been required\n");

    }

    if (track->tref_tag)

        mov_write_tref_tag(pb, track);

    mov_write_mdia_tag(pb, mov, track);

    if (track->mode == MODE_PSP)

        mov_write_uuid_tag_psp(pb, track); // PSP Movies require this uuid box

    if (track->tag == MKTAG('r','t','p',' '))

        mov_write_udta_sdp(pb, track);

    if (track->mode == MODE_MOV) {

        if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) {

            double sample_aspect_ratio = av_q2d(st->sample_aspect_ratio);

            if ((0.0 != sample_aspect_ratio && 1.0 != sample_aspect_ratio)) {

                mov_write_tapt_tag(pb, track);

            }

        }

        if (is_clcp_track(track)) {

            mov_write_tapt_tag(pb, track);

        }

    }

    mov_write_track_udta_tag(pb, mov, st);

    return update_size(pb, pos);

}

static int mov_write_trak_tag(AVIOContext *pb, MOVMuxContext *mov,

                              MOVTrack *track, AVStream *st)

{

    int64_t pos = avio_tell(pb);

    avio_wb32(pb, 0); 

    ffio_wfourcc(pb, "trak");

    mov_write_tkhd_tag(pb, mov, track, st);

    if (track->mode == MODE_PSP || track->flags & MOV_TRACK_CTTS ||

        (track->entry && track->cluster[0].dts) ||

        is_clcp_track(track)) {

        if (mov->use_editlist)

            mov_write_edts_tag(pb, mov, track);  

        else if ((track->entry && track->cluster[0].dts) || track->mode == MODE_PSP || is_clcp_track(track))

            av_log(mov->fc, AV_LOG_WARNING,

                   "Not writing any edit list even though one would have been required\n");

    }

    if (track->tref_tag)

        mov_write_tref_tag(pb, track);

    mov_write_mdia_tag(pb, mov, track);

    if (track->mode == MODE_PSP)

        mov_write_uuid_tag_psp(pb, track); 

    if (track->tag == MKTAG('r','t','p',' '))

        mov_write_udta_sdp(pb, track);

    if (track->mode == MODE_MOV) {

        if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) {

            double sample_aspect_ratio = av_q2d(st->sample_aspect_ratio);

            if ((0.0 != sample_aspect_ratio && 1.0 != sample_aspect_ratio)) {

                mov_write_tapt_tag(pb, track);

            }

        }

        if (is_clcp_track(track)) {

            mov_write_tapt_tag(pb, track);

        }

    }

    mov_write_track_udta_tag(pb, mov, st);

    return update_size(pb, pos);

}

    if (track->mode == MODE_PSP || track->flags & MOV_TRACK_CTTS ||         (track->entry && track->cluster[0].dts) ||         is_clcp_track(track)) {
static int FUNC_0(AVIOContext *VAR_0, MOVMuxContext *VAR_1,

                              MOVTrack *VAR_2, AVStream *VAR_3)

{

    int64_t pos = avio_tell(VAR_0);

    avio_wb32(VAR_0, 0); 

    ffio_wfourcc(VAR_0, "trak");

    mov_write_tkhd_tag(VAR_0, VAR_1, VAR_2, VAR_3);

    if (VAR_2->mode == MODE_PSP || VAR_2->flags & MOV_TRACK_CTTS ||

        (VAR_2->entry && VAR_2->cluster[0].dts) ||

        is_clcp_track(VAR_2)) {

        if (VAR_1->use_editlist)

            mov_write_edts_tag(VAR_0, VAR_1, VAR_2);  

        else if ((VAR_2->entry && VAR_2->cluster[0].dts) || VAR_2->mode == MODE_PSP || is_clcp_track(VAR_2))

            av_log(VAR_1->fc, AV_LOG_WARNING,

                   "Not writing any edit list even though one would have been required\n");

    }

    if (VAR_2->tref_tag)

        mov_write_tref_tag(VAR_0, VAR_2);

    mov_write_mdia_tag(VAR_0, VAR_1, VAR_2);

    if (VAR_2->mode == MODE_PSP)

        mov_write_uuid_tag_psp(VAR_0, VAR_2); 

    if (VAR_2->tag == MKTAG('r','t','p',' '))

        mov_write_udta_sdp(VAR_0, VAR_2);

    if (VAR_2->mode == MODE_MOV) {

        if (VAR_2->enc->codec_type == AVMEDIA_TYPE_VIDEO) {

            double VAR_4 = av_q2d(VAR_3->VAR_4);

            if ((0.0 != VAR_4 && 1.0 != VAR_4)) {

                mov_write_tapt_tag(VAR_0, VAR_2);

            }

        }

        if (is_clcp_track(VAR_2)) {

            mov_write_tapt_tag(VAR_0, VAR_2);

        }

    }

    mov_write_track_udta_tag(VAR_0, VAR_1, VAR_3);

    return update_size(VAR_0, pos);

}

static int FUNC_0(AVIOContext *VAR_0, MOVMuxContext *VAR_1,
MOVTrack *VAR_2, AVStream *VAR_3)
{ int64_t pos = avio_tell(VAR_0); avio_wb32(VAR_0, 0); ffio_wfourcc(VAR_0, "trak"); mov_write_tkhd_tag(VAR_0, VAR_1, VAR_2, VAR_3); if (VAR_2->mode == MODE_PSP || VAR_2->flags & MOV_TRACK_CTTS ||
(VAR_2->entry && VAR_2->cluster[0].dts) ||
is_clcp_track(VAR_2)) { if (VAR_1->use_editlist)
mov_write_edts_tag(VAR_0, VAR_1, VAR_2); else if ((VAR_2->entry && VAR_2->cluster[0].dts) || VAR_2->mode == MODE_PSP || is_clcp_track(VAR_2))
av_log(VAR_1->fc, AV_LOG_WARNING,
"Not writing any edit list even though one would have been required\n"); } if (VAR_2->tref_tag)
mov_write_tref_tag(VAR_0, VAR_2); mov_write_mdia_tag(VAR_0, VAR_1, VAR_2); if (VAR_2->mode == MODE_PSP)
mov_write_uuid_tag_psp(VAR_0, VAR_2); if (VAR_2->tag == MKTAG('r','t','p',' '))
mov_write_udta_sdp(VAR_0, VAR_2); if (VAR_2->mode == MODE_MOV) { if (VAR_2->enc->codec_type == AVMEDIA_TYPE_VIDEO) { double VAR_4 = av_q2d(VAR_3->VAR_4); if ((0.0 != VAR_4 && 1.0 != VAR_4)) { mov_write_tapt_tag(VAR_0, VAR_2); } } if (is_clcp_track(VAR_2)) { mov_write_tapt_tag(VAR_0, VAR_2); } } mov_write_track_udta_tag(VAR_0, VAR_1, VAR_3); return update_size(VAR_0, pos); }