static void do_audio_out(AVFormatContext *s, OutputStream *ost,

                         AVFrame *frame)

{

    AVCodecContext *enc = ost->enc_ctx;

    AVPacket pkt;

    int got_packet = 0;



    av_init_packet(&pkt);

    pkt.data = NULL;

    pkt.size = 0;



    if (!check_recording_time(ost))

        return;



    if (frame->pts == AV_NOPTS_VALUE || audio_sync_method < 0)

        frame->pts = ost->sync_opts;

    ost->sync_opts = frame->pts + frame->nb_samples;

    ost->samples_encoded += frame->nb_samples;

    ost->frames_encoded++;



    av_assert0(pkt.size || !pkt.data);

    update_benchmark(NULL);

    if (debug_ts) {

        av_log(NULL, AV_LOG_INFO, "encoder <- type:audio "

               "frame_pts:%s frame_pts_time:%s time_base:%d/%d\n",

               av_ts2str(frame->pts), av_ts2timestr(frame->pts, &enc->time_base),

               enc->time_base.num, enc->time_base.den);

    }



    if (avcodec_encode_audio2(enc, &pkt, frame, &got_packet) < 0) {

        av_log(NULL, AV_LOG_FATAL, "Audio encoding failed (avcodec_encode_audio2)\n");

        exit_program(1);

    }

    update_benchmark("encode_audio %d.%d", ost->file_index, ost->index);



    if (got_packet) {

        av_packet_rescale_ts(&pkt, enc->time_base, ost->st->time_base);



        if (debug_ts) {

            av_log(NULL, AV_LOG_INFO, "encoder -> type:audio "

                   "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n",

                   av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ost->st->time_base),

                   av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ost->st->time_base));

        }



        write_frame(s, &pkt, ost);

    }

}

static void do_audio_out(AVFormatContext *s, OutputStream *ost,

                         AVFrame *frame)

{

    AVCodecContext *enc = ost->enc_ctx;

    AVPacket pkt;

    int got_packet = 0;



    av_init_packet(&pkt);

    pkt.data = NULL;

    pkt.size = 0;



    if (!check_recording_time(ost))

        return;



    if (frame->pts == AV_NOPTS_VALUE || audio_sync_method < 0)

        frame->pts = ost->sync_opts;

    ost->sync_opts = frame->pts + frame->nb_samples;

    ost->samples_encoded += frame->nb_samples;

    ost->frames_encoded++;



    av_assert0(pkt.size || !pkt.data);

    update_benchmark(NULL);

    if (debug_ts) {

        av_log(NULL, AV_LOG_INFO, "encoder <- type:audio "

               "frame_pts:%s frame_pts_time:%s time_base:%d/%d\n",

               av_ts2str(frame->pts), av_ts2timestr(frame->pts, &enc->time_base),

               enc->time_base.num, enc->time_base.den);

    }



    if (avcodec_encode_audio2(enc, &pkt, frame, &got_packet) < 0) {

        av_log(NULL, AV_LOG_FATAL, "Audio encoding failed (avcodec_encode_audio2)\n");

        exit_program(1);

    }

    update_benchmark("encode_audio %d.%d", ost->file_index, ost->index);



    if (got_packet) {

        av_packet_rescale_ts(&pkt, enc->time_base, ost->st->time_base);



        if (debug_ts) {

            av_log(NULL, AV_LOG_INFO, "encoder -> type:audio "

                   "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n",

                   av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ost->st->time_base),

                   av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ost->st->time_base));

        }



        write_frame(s, &pkt, ost);

    }

}

        write_frame(s, &pkt, ost);         write_frame(s, &pkt, ost);         write_frame(s, &pkt, ost);
static void FUNC_0(AVFormatContext *VAR_0, OutputStream *VAR_1,

                         AVFrame *VAR_2)

{

    AVCodecContext *enc = VAR_1->enc_ctx;

    AVPacket pkt;

    int VAR_3 = 0;



    av_init_packet(&pkt);

    pkt.data = NULL;

    pkt.size = 0;



    if (!check_recording_time(VAR_1))

        return;



    if (VAR_2->pts == AV_NOPTS_VALUE || audio_sync_method < 0)

        VAR_2->pts = VAR_1->sync_opts;

    VAR_1->sync_opts = VAR_2->pts + VAR_2->nb_samples;

    VAR_1->samples_encoded += VAR_2->nb_samples;

    VAR_1->frames_encoded++;



    av_assert0(pkt.size || !pkt.data);

    update_benchmark(NULL);

    if (debug_ts) {

        av_log(NULL, AV_LOG_INFO, "encoder <- type:audio "

               "frame_pts:%VAR_0 frame_pts_time:%VAR_0 time_base:%d/%d\n",

               av_ts2str(VAR_2->pts), av_ts2timestr(VAR_2->pts, &enc->time_base),

               enc->time_base.num, enc->time_base.den);

    }



    if (avcodec_encode_audio2(enc, &pkt, VAR_2, &VAR_3) < 0) {

        av_log(NULL, AV_LOG_FATAL, "Audio encoding failed (avcodec_encode_audio2)\n");

        exit_program(1);

    }

    update_benchmark("encode_audio %d.%d", VAR_1->file_index, VAR_1->index);



    if (VAR_3) {

        av_packet_rescale_ts(&pkt, enc->time_base, VAR_1->st->time_base);



        if (debug_ts) {

            av_log(NULL, AV_LOG_INFO, "encoder -> type:audio "

                   "pkt_pts:%VAR_0 pkt_pts_time:%VAR_0 pkt_dts:%VAR_0 pkt_dts_time:%VAR_0\n",

                   av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &VAR_1->st->time_base),

                   av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &VAR_1->st->time_base));

        }



        write_frame(VAR_0, &pkt, VAR_1);

    }

}

static void FUNC_0(AVFormatContext *VAR_0, OutputStream *VAR_1,
AVFrame *VAR_2)
{ AVCodecContext *enc = VAR_1->enc_ctx; AVPacket pkt; int VAR_3 = 0; av_init_packet(&pkt); pkt.data = NULL; pkt.size = 0; if (!check_recording_time(VAR_1))
return; if (VAR_2->pts == AV_NOPTS_VALUE || audio_sync_method < 0)
VAR_2->pts = VAR_1->sync_opts; VAR_1->sync_opts = VAR_2->pts + VAR_2->nb_samples; VAR_1->samples_encoded += VAR_2->nb_samples; VAR_1->frames_encoded++; av_assert0(pkt.size || !pkt.data); update_benchmark(NULL); if (debug_ts) { av_log(NULL, AV_LOG_INFO, "encoder <- type:audio "
"frame_pts:%VAR_0 frame_pts_time:%VAR_0 time_base:%d/%d\n",
av_ts2str(VAR_2->pts), av_ts2timestr(VAR_2->pts, &enc->time_base),
enc->time_base.num, enc->time_base.den); } if (avcodec_encode_audio2(enc, &pkt, VAR_2, &VAR_3) < 0) { av_log(NULL, AV_LOG_FATAL, "Audio encoding failed (avcodec_encode_audio2)\n"); exit_program(1); } update_benchmark("encode_audio %d.%d", VAR_1->file_index, VAR_1->index); if (VAR_3) { av_packet_rescale_ts(&pkt, enc->time_base, VAR_1->st->time_base); if (debug_ts) { av_log(NULL, AV_LOG_INFO, "encoder -> type:audio "
"pkt_pts:%VAR_0 pkt_pts_time:%VAR_0 pkt_dts:%VAR_0 pkt_dts_time:%VAR_0\n",
av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &VAR_1->st->time_base),
av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &VAR_1->st->time_base)); } write_frame(VAR_0, &pkt, VAR_1); } }