On 2012-01-01 21:52:38 +0100, Anton Khirnov wrote:
> ---
>  avconv.c |   21 +++++++++++----------
>  1 files changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/avconv.c b/avconv.c
> index e961630..45f9feb 100644
> --- a/avconv.c
> +++ b/avconv.c
> @@ -846,8 +846,10 @@ get_sync_ipts(const OutputStream *ost)
>      return (double)(ist->pts - of->start_time) / AV_TIME_BASE;
>  }
>  
> -static void write_frame(AVFormatContext *s, AVPacket *pkt, AVCodecContext 
> *avctx, AVBitStreamFilterContext *bsfc)
> +static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost)
>  {
> +    AVBitStreamFilterContext *bsfc = ost->bitstream_filters;
> +    AVCodecContext          *avctx = ost->st->codec;
>      int ret;
>  
>      while (bsfc) {
> @@ -877,6 +879,7 @@ static void write_frame(AVFormatContext *s, AVPacket 
> *pkt, AVCodecContext *avctx
>          print_error("av_interleaved_write_frame()", ret);
>          exit_program(1);
>      }
> +    ost->frame_number++;
>  }
>  
>  static void generate_silence(uint8_t* buf, enum AVSampleFormat sample_fmt, 
> size_t size)
> @@ -1091,7 +1094,7 @@ need_realloc:
>              if (enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE)
>                  pkt.pts = av_rescale_q(enc->coded_frame->pts, 
> enc->time_base, ost->st->time_base);
>              pkt.flags |= AV_PKT_FLAG_KEY;
> -            write_frame(s, &pkt, enc, ost->bitstream_filters);
> +            write_frame(s, &pkt, ost);
>  
>              ost->sync_opts += enc->frame_size;
>          }
> @@ -1126,7 +1129,7 @@ need_realloc:
>          if (enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE)
>              pkt.pts = av_rescale_q(enc->coded_frame->pts, enc->time_base, 
> ost->st->time_base);
>          pkt.flags |= AV_PKT_FLAG_KEY;
> -        write_frame(s, &pkt, enc, ost->bitstream_filters);
> +        write_frame(s, &pkt, ost);
>      }
>  }
>  
> @@ -1228,7 +1231,7 @@ static void do_subtitle_out(AVFormatContext *s,
>              else
>                  pkt.pts += 90 * sub->end_display_time;
>          }
> -        write_frame(s, &pkt, ost->st->codec, ost->bitstream_filters);
> +        write_frame(s, &pkt, ost);
>      }
>  }
>  
> @@ -1369,7 +1372,7 @@ static void do_video_out(AVFormatContext *s,
>              pkt.pts    = av_rescale_q(ost->sync_opts, enc->time_base, 
> ost->st->time_base);
>              pkt.flags |= AV_PKT_FLAG_KEY;
>  
> -            write_frame(s, &pkt, ost->st->codec, ost->bitstream_filters);
> +            write_frame(s, &pkt, ost);
>          } else {
>              AVFrame big_picture;
>  
> @@ -1417,7 +1420,7 @@ static void do_video_out(AVFormatContext *s,
>  
>                  if (enc->coded_frame->key_frame)
>                      pkt.flags |= AV_PKT_FLAG_KEY;
> -                write_frame(s, &pkt, ost->st->codec, ost->bitstream_filters);
> +                write_frame(s, &pkt, ost);
>                  *frame_size = ret;
>                  video_size += ret;
>                  // fprintf(stderr,"\nFrame: %3d size: %5d type: %d",
> @@ -1429,7 +1432,6 @@ static void do_video_out(AVFormatContext *s,
>              }
>          }
>          ost->sync_opts++;
> -        ost->frame_number++;
>      }
>  }
>  
> @@ -1678,7 +1680,7 @@ static void flush_encoders(OutputStream *ost_table, int 
> nb_ostreams)
>              pkt.size = ret;
>              if (enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE)
>                  pkt.pts = av_rescale_q(enc->coded_frame->pts, 
> enc->time_base, ost->st->time_base);
> -            write_frame(os, &pkt, ost->st->codec, ost->bitstream_filters);
> +            write_frame(os, &pkt, ost);
>          }
>      }
>  }
> @@ -1754,9 +1756,8 @@ static void do_streamcopy(InputStream *ist, 
> OutputStream *ost, const AVPacket *p
>          opkt.size = pkt->size;
>      }
>  
> -    write_frame(of->ctx, &opkt, ost->st->codec, ost->bitstream_filters);
> +    write_frame(of->ctx, &opkt, ost);
>      ost->st->codec->frame_number++;
> -    ost->frame_number++;
>      av_free_packet(&opkt);
>  }
>  

ok

Janne
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to