[libav-devel] [PATCH 1/7] avconv: eliminate a goto in output_packet().

Janne Grunau janne-libav at jannau.net
Tue Nov 22 10:08:49 CET 2011


On Tue, Nov 22, 2011 at 07:19:52AM +0100, Anton Khirnov wrote:
> ---
>  avconv.c |   13 +++++--------
>  1 files changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/avconv.c b/avconv.c
> index a87f852..3ba8534 100644
> --- a/avconv.c
> +++ b/avconv.c
> @@ -1845,7 +1845,7 @@ static int output_packet(InputStream *ist, int ist_index,
>  {
>      OutputStream *ost;
>      int ret = 0, i;
> -    int got_output;
> +    int got_output = 1;
>      int64_t pkt_pts = AV_NOPTS_VALUE;
>  
>      AVPacket avpkt;
> @@ -1858,19 +1858,16 @@ static int output_packet(InputStream *ist, int ist_index,
>          av_init_packet(&avpkt);
>          avpkt.data = NULL;
>          avpkt.size = 0;
> -        goto handle_eof;
>      } else {
>          avpkt = *pkt;
> +        if (pkt->dts != AV_NOPTS_VALUE)
> +            ist->next_pts = ist->pts = av_rescale_q(pkt->dts, ist->st->time_base, AV_TIME_BASE_Q);
> +        if (pkt->pts != AV_NOPTS_VALUE)
> +            pkt_pts = av_rescale_q(pkt->pts, ist->st->time_base, AV_TIME_BASE_Q);
>      }
>  
> -    if(pkt->dts != AV_NOPTS_VALUE)
> -        ist->next_pts = ist->pts = av_rescale_q(pkt->dts, ist->st->time_base, AV_TIME_BASE_Q);
> -    if(pkt->pts != AV_NOPTS_VALUE)
> -        pkt_pts = av_rescale_q(pkt->pts, ist->st->time_base, AV_TIME_BASE_Q);
> -
>      //while we have more to decode or while the decoder did output something on EOF
>      while (ist->decoding_needed && (avpkt.size > 0 || (!pkt && got_output))) {
> -    handle_eof:
>          ist->pts= ist->next_pts;
>  
>          if(avpkt.size && avpkt.size != pkt->size)

ok

Janne


More information about the libav-devel mailing list