static void do_subtitle_out(AVFormatContext *s,

                            AVOutputStream *ost,

                            AVInputStream *ist,

                            AVSubtitle *sub,

                            int64_t pts)

{

    static uint8_t *subtitle_out = NULL;

    int subtitle_out_max_size = 65536;

    int subtitle_out_size, nb, i;

    AVCodecContext *enc;

    AVPacket pkt;



    if (pts == AV_NOPTS_VALUE) {

        fprintf(stderr, "Subtitle packets must have a pts\n");

        if (exit_on_error)


        return;




    enc = ost->st->codec;



    if (!subtitle_out) {

        subtitle_out = av_malloc(subtitle_out_max_size);




    /* Note: DVB subtitle need one packet to draw them and one other

       packet to clear them */

    /* XXX: signal it in the codec context ? */

    if (enc->codec_id == CODEC_ID_DVB_SUBTITLE)

        nb = 2;

    else

        nb = 1;



    for(i = 0; i < nb; i++) {

        sub->pts = av_rescale_q(pts, ist->st->time_base, AV_TIME_BASE_Q);

        subtitle_out_size = avcodec_encode_subtitle(enc, subtitle_out,

                                                    subtitle_out_max_size, sub);







        av_init_packet(&pkt);

        pkt.stream_index = ost->index;

        pkt.data = subtitle_out;

        pkt.size = subtitle_out_size;

        pkt.pts = av_rescale_q(pts, ist->st->time_base, ost->st->time_base);

        if (enc->codec_id == CODEC_ID_DVB_SUBTITLE) {

            /* XXX: the pts correction is handled here. Maybe handling

               it in the codec would be better */

            if (i == 0)

                pkt.pts += 90 * sub->start_display_time;

            else

                pkt.pts += 90 * sub->end_display_time;


        write_frame(s, &pkt, ost->st->codec, bitstream_filters[ost->file_index][pkt.stream_index]);


static void do_subtitle_out(AVFormatContext *s,

                            AVOutputStream *ost,

                            AVInputStream *ist,

                            AVSubtitle *sub,

                            int64_t pts)

{

    static uint8_t *subtitle_out = NULL;

    int subtitle_out_max_size = 65536;

    int subtitle_out_size, nb, i;

    AVCodecContext *enc;

    AVPacket pkt;



    if (pts == AV_NOPTS_VALUE) {

        fprintf(stderr, "Subtitle packets must have a pts\n");

        if (exit_on_error)


        return;




    enc = ost->st->codec;



    if (!subtitle_out) {

        subtitle_out = av_malloc(subtitle_out_max_size);




    



    

    if (enc->codec_id == CODEC_ID_DVB_SUBTITLE)

        nb = 2;

    else

        nb = 1;



    for(i = 0; i < nb; i++) {

        sub->pts = av_rescale_q(pts, ist->st->time_base, AV_TIME_BASE_Q);

        subtitle_out_size = avcodec_encode_subtitle(enc, subtitle_out,

                                                    subtitle_out_max_size, sub);







        av_init_packet(&pkt);

        pkt.stream_index = ost->index;

        pkt.data = subtitle_out;

        pkt.size = subtitle_out_size;

        pkt.pts = av_rescale_q(pts, ist->st->time_base, ost->st->time_base);

        if (enc->codec_id == CODEC_ID_DVB_SUBTITLE) {

            



            if (i == 0)

                pkt.pts += 90 * sub->start_display_time;

            else

                pkt.pts += 90 * sub->end_display_time;


        write_frame(s, &pkt, ost->st->codec, bitstream_filters[ost->file_index][pkt.stream_index]);


static void FUNC_0(AVFormatContext *VAR_0,

                            AVOutputStream *VAR_1,

                            AVInputStream *VAR_2,

                            AVSubtitle *VAR_3,

                            int64_t VAR_4)

{

    static uint8_t *VAR_5 = NULL;

    int VAR_6 = 65536;

    int VAR_7, VAR_8, VAR_9;

    AVCodecContext *enc;

    AVPacket pkt;



    if (VAR_4 == AV_NOPTS_VALUE) {

        fprintf(stderr, "Subtitle packets must have a VAR_4\n");

        if (exit_on_error)


        return;




    enc = VAR_1->st->codec;



    if (!VAR_5) {

        VAR_5 = av_malloc(VAR_6);




    



    

    if (enc->codec_id == CODEC_ID_DVB_SUBTITLE)

        VAR_8 = 2;

    else

        VAR_8 = 1;



    for(VAR_9 = 0; VAR_9 < VAR_8; VAR_9++) {

        VAR_3->VAR_4 = av_rescale_q(VAR_4, VAR_2->st->time_base, AV_TIME_BASE_Q);

        VAR_7 = avcodec_encode_subtitle(enc, VAR_5,

                                                    VAR_6, VAR_3);







        av_init_packet(&pkt);

        pkt.stream_index = VAR_1->index;

        pkt.data = VAR_5;

        pkt.size = VAR_7;

        pkt.VAR_4 = av_rescale_q(VAR_4, VAR_2->st->time_base, VAR_1->st->time_base);

        if (enc->codec_id == CODEC_ID_DVB_SUBTITLE) {

            



            if (VAR_9 == 0)

                pkt.VAR_4 += 90 * VAR_3->start_display_time;

            else

                pkt.VAR_4 += 90 * VAR_3->end_display_time;


        write_frame(VAR_0, &pkt, VAR_1->st->codec, bitstream_filters[VAR_1->file_index][pkt.stream_index]);


static void FUNC_0(AVFormatContext *VAR_0,
AVOutputStream *VAR_1,
AVInputStream *VAR_2,
AVSubtitle *VAR_3,
int64_t VAR_4)
{ static uint8_t *VAR_5 = NULL; int VAR_6 = 65536; int VAR_7, VAR_8, VAR_9; AVCodecContext *enc; AVPacket pkt; if (VAR_4 == AV_NOPTS_VALUE) { fprintf(stderr, "Subtitle packets must have a VAR_4\n"); if (exit_on_error)
return; enc = VAR_1->st->codec; if (!VAR_5) { VAR_5 = av_malloc(VAR_6); if (enc->codec_id == CODEC_ID_DVB_SUBTITLE)
VAR_8 = 2; else
VAR_8 = 1; for(VAR_9 = 0; VAR_9 < VAR_8; VAR_9++) { VAR_3->VAR_4 = av_rescale_q(VAR_4, VAR_2->st->time_base, AV_TIME_BASE_Q); VAR_7 = avcodec_encode_subtitle(enc, VAR_5,
VAR_6, VAR_3); av_init_packet(&pkt); pkt.stream_index = VAR_1->index; pkt.data = VAR_5; pkt.size = VAR_7; pkt.VAR_4 = av_rescale_q(VAR_4, VAR_2->st->time_base, VAR_1->st->time_base); if (enc->codec_id == CODEC_ID_DVB_SUBTITLE) { if (VAR_9 == 0)
pkt.VAR_4 += 90 * VAR_3->start_display_time; else
pkt.VAR_4 += 90 * VAR_3->end_display_time; write_frame(VAR_0, &pkt, VAR_1->st->codec, bitstream_filters[VAR_1->file_index][pkt.stream_index]);