static int mov_write_stbl_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track)

{

    int64_t pos = avio_tell(pb);

    int ret;



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

    ffio_wfourcc(pb, "stbl");

    mov_write_stsd_tag(s, pb, mov, track);

    mov_write_stts_tag(pb, track);

    if ((track->par->codec_type == AVMEDIA_TYPE_VIDEO ||

         track->par->codec_tag == MKTAG('r','t','p',' ')) &&

        track->has_keyframes && track->has_keyframes < track->entry)

        mov_write_stss_tag(pb, track, MOV_SYNC_SAMPLE);

    if (track->mode == MODE_MOV && track->flags & MOV_TRACK_STPS)

        mov_write_stss_tag(pb, track, MOV_PARTIAL_SYNC_SAMPLE);

    if (track->par->codec_type == AVMEDIA_TYPE_VIDEO &&

        track->flags & MOV_TRACK_CTTS && track->entry) {



        if ((ret = mov_write_ctts_tag(pb, track)) < 0)

            return ret;

    }

    mov_write_stsc_tag(pb, track);

    mov_write_stsz_tag(pb, track);

    mov_write_stco_tag(pb, track);

    if (mov->encryption_scheme == MOV_ENC_CENC_AES_CTR) {

        ff_mov_cenc_write_stbl_atoms(&track->cenc, pb);

    }

    if (track->par->codec_id == AV_CODEC_ID_OPUS) {

        mov_preroll_write_stbl_atoms(pb, track);

    }

    return update_size(pb, pos);

}

static int mov_write_stbl_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track)

{

    int64_t pos = avio_tell(pb);

    int ret;



    avio_wb32(pb, 0); 

    ffio_wfourcc(pb, "stbl");

    mov_write_stsd_tag(s, pb, mov, track);

    mov_write_stts_tag(pb, track);

    if ((track->par->codec_type == AVMEDIA_TYPE_VIDEO ||

         track->par->codec_tag == MKTAG('r','t','p',' ')) &&

        track->has_keyframes && track->has_keyframes < track->entry)

        mov_write_stss_tag(pb, track, MOV_SYNC_SAMPLE);

    if (track->mode == MODE_MOV && track->flags & MOV_TRACK_STPS)

        mov_write_stss_tag(pb, track, MOV_PARTIAL_SYNC_SAMPLE);

    if (track->par->codec_type == AVMEDIA_TYPE_VIDEO &&

        track->flags & MOV_TRACK_CTTS && track->entry) {



        if ((ret = mov_write_ctts_tag(pb, track)) < 0)

            return ret;

    }

    mov_write_stsc_tag(pb, track);

    mov_write_stsz_tag(pb, track);

    mov_write_stco_tag(pb, track);

    if (mov->encryption_scheme == MOV_ENC_CENC_AES_CTR) {

        ff_mov_cenc_write_stbl_atoms(&track->cenc, pb);

    }

    if (track->par->codec_id == AV_CODEC_ID_OPUS) {

        mov_preroll_write_stbl_atoms(pb, track);

    }

    return update_size(pb, pos);

}

static int FUNC_0(AVFormatContext *VAR_0, AVIOContext *VAR_1, MOVMuxContext *VAR_2, MOVTrack *VAR_3)

{

    int64_t pos = avio_tell(VAR_1);

    int VAR_4;



    avio_wb32(VAR_1, 0); 

    ffio_wfourcc(VAR_1, "stbl");

    mov_write_stsd_tag(VAR_0, VAR_1, VAR_2, VAR_3);

    mov_write_stts_tag(VAR_1, VAR_3);

    if ((VAR_3->par->codec_type == AVMEDIA_TYPE_VIDEO ||

         VAR_3->par->codec_tag == MKTAG('r','t','p',' ')) &&

        VAR_3->has_keyframes && VAR_3->has_keyframes < VAR_3->entry)

        mov_write_stss_tag(VAR_1, VAR_3, MOV_SYNC_SAMPLE);

    if (VAR_3->mode == MODE_MOV && VAR_3->flags & MOV_TRACK_STPS)

        mov_write_stss_tag(VAR_1, VAR_3, MOV_PARTIAL_SYNC_SAMPLE);

    if (VAR_3->par->codec_type == AVMEDIA_TYPE_VIDEO &&

        VAR_3->flags & MOV_TRACK_CTTS && VAR_3->entry) {



        if ((VAR_4 = mov_write_ctts_tag(VAR_1, VAR_3)) < 0)

            return VAR_4;

    }

    mov_write_stsc_tag(VAR_1, VAR_3);

    mov_write_stsz_tag(VAR_1, VAR_3);

    mov_write_stco_tag(VAR_1, VAR_3);

    if (VAR_2->encryption_scheme == MOV_ENC_CENC_AES_CTR) {

        ff_mov_cenc_write_stbl_atoms(&VAR_3->cenc, VAR_1);

    }

    if (VAR_3->par->codec_id == AV_CODEC_ID_OPUS) {

        mov_preroll_write_stbl_atoms(VAR_1, VAR_3);

    }

    return update_size(VAR_1, pos);

}

static int FUNC_0(AVFormatContext *VAR_0, AVIOContext *VAR_1, MOVMuxContext *VAR_2, MOVTrack *VAR_3)
{ int64_t pos = avio_tell(VAR_1); int VAR_4; avio_wb32(VAR_1, 0); ffio_wfourcc(VAR_1, "stbl"); mov_write_stsd_tag(VAR_0, VAR_1, VAR_2, VAR_3); mov_write_stts_tag(VAR_1, VAR_3); if ((VAR_3->par->codec_type == AVMEDIA_TYPE_VIDEO ||
VAR_3->par->codec_tag == MKTAG('r','t','p',' ')) &&
VAR_3->has_keyframes && VAR_3->has_keyframes < VAR_3->entry)
mov_write_stss_tag(VAR_1, VAR_3, MOV_SYNC_SAMPLE); if (VAR_3->mode == MODE_MOV && VAR_3->flags & MOV_TRACK_STPS)
mov_write_stss_tag(VAR_1, VAR_3, MOV_PARTIAL_SYNC_SAMPLE); if (VAR_3->par->codec_type == AVMEDIA_TYPE_VIDEO &&
VAR_3->flags & MOV_TRACK_CTTS && VAR_3->entry) { if ((VAR_4 = mov_write_ctts_tag(VAR_1, VAR_3)) < 0)
return VAR_4; } mov_write_stsc_tag(VAR_1, VAR_3); mov_write_stsz_tag(VAR_1, VAR_3); mov_write_stco_tag(VAR_1, VAR_3); if (VAR_2->encryption_scheme == MOV_ENC_CENC_AES_CTR) { ff_mov_cenc_write_stbl_atoms(&VAR_3->cenc, VAR_1); } if (VAR_3->par->codec_id == AV_CODEC_ID_OPUS) { mov_preroll_write_stbl_atoms(VAR_1, VAR_3); } return update_size(VAR_1, pos); }