static int remove_decoded_packets(AVFormatContext *ctx, int64_t scr){

//    MpegMuxContext *s = ctx->priv_data;

    int i;



    for(i=0; i<ctx->nb_streams; i++){

        AVStream *st = ctx->streams[i];

        StreamInfo *stream = st->priv_data;

        PacketDesc *pkt_desc;



        while((pkt_desc= stream->predecode_packet)

              && scr > pkt_desc->dts){ //FIXME > vs >=

            if(stream->buffer_index < pkt_desc->size ||

               stream->predecode_packet == stream->premux_packet){

                av_log(ctx, AV_LOG_ERROR,

                       "buffer underflow i=%d bufi=%d size=%d\n",

                       i, stream->buffer_index, pkt_desc->size);

                break;

            }

            stream->buffer_index -= pkt_desc->size;



            stream->predecode_packet= pkt_desc->next;

            av_freep(&pkt_desc);

        }

    }



    return 0;

}

static int remove_decoded_packets(AVFormatContext *ctx, int64_t scr){



    int i;



    for(i=0; i<ctx->nb_streams; i++){

        AVStream *st = ctx->streams[i];

        StreamInfo *stream = st->priv_data;

        PacketDesc *pkt_desc;



        while((pkt_desc= stream->predecode_packet)

              && scr > pkt_desc->dts){ 

            if(stream->buffer_index < pkt_desc->size ||

               stream->predecode_packet == stream->premux_packet){

                av_log(ctx, AV_LOG_ERROR,

                       "buffer underflow i=%d bufi=%d size=%d\n",

                       i, stream->buffer_index, pkt_desc->size);

                break;

            }

            stream->buffer_index -= pkt_desc->size;



            stream->predecode_packet= pkt_desc->next;

            av_freep(&pkt_desc);

        }

    }



    return 0;

}

                       "buffer underflow i=%d bufi=%d size=%d\n",
static int FUNC_0(AVFormatContext *VAR_0, int64_t VAR_1){



    int VAR_2;



    for(VAR_2=0; VAR_2<VAR_0->nb_streams; VAR_2++){

        AVStream *st = VAR_0->streams[VAR_2];

        StreamInfo *stream = st->priv_data;

        PacketDesc *pkt_desc;



        while((pkt_desc= stream->predecode_packet)

              && VAR_1 > pkt_desc->dts){ 

            if(stream->buffer_index < pkt_desc->size ||

               stream->predecode_packet == stream->premux_packet){

                av_log(VAR_0, AV_LOG_ERROR,

                       "buffer underflow VAR_2=%d bufi=%d size=%d\n",

                       VAR_2, stream->buffer_index, pkt_desc->size);

                break;

            }

            stream->buffer_index -= pkt_desc->size;



            stream->predecode_packet= pkt_desc->next;

            av_freep(&pkt_desc);

        }

    }



    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0, int64_t VAR_1){ int VAR_2; for(VAR_2=0; VAR_2<VAR_0->nb_streams; VAR_2++){ AVStream *st = VAR_0->streams[VAR_2]; StreamInfo *stream = st->priv_data; PacketDesc *pkt_desc; while((pkt_desc= stream->predecode_packet)
&& VAR_1 > pkt_desc->dts){ if(stream->buffer_index < pkt_desc->size ||
stream->predecode_packet == stream->premux_packet){ av_log(VAR_0, AV_LOG_ERROR,
"buffer underflow VAR_2=%d bufi=%d size=%d\n",
VAR_2, stream->buffer_index, pkt_desc->size); break; } stream->buffer_index -= pkt_desc->size; stream->predecode_packet= pkt_desc->next; av_freep(&pkt_desc); } } return 0; }