[FFmpeg-devel] [PATCH 2/2] ffmpeg: simplify do_subtitle_out() by using AVSubtitle.pts

Michael Niedermayer michaelni at gmx.at
Tue Apr 12 04:07:54 CEST 2011


On Mon, Apr 11, 2011 at 11:57:41PM +0200, Aurelien Jacobs wrote:
> Signed-off-by: Aurelien Jacobs <aurel at gnuage.org>
> ---
>  ffmpeg.c |    9 +++------
>  1 files changed, 3 insertions(+), 6 deletions(-)



> 
> diff --git a/ffmpeg.c b/ffmpeg.c
> index 8e44895..3b6f668 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -1066,8 +1066,7 @@ static void pre_process_video_frame(AVInputStream *ist, AVPicture *picture, void
>  static void do_subtitle_out(AVFormatContext *s,
>                              AVOutputStream *ost,
>                              AVInputStream *ist,
> -                            AVSubtitle *sub,
> -                            int64_t pts)
> +                            AVSubtitle *sub)
>  {
>      static uint8_t *subtitle_out = NULL;
>      int subtitle_out_max_size = 1024 * 1024;
> @@ -1075,7 +1074,7 @@ static void do_subtitle_out(AVFormatContext *s,
>      AVCodecContext *enc;
>      AVPacket pkt;
>  
> -    if (pts == AV_NOPTS_VALUE) {
> +    if (sub->pts == AV_NOPTS_VALUE) {
>          fprintf(stderr, "Subtitle packets must have a pts\n");
>          if (exit_on_error)
>              ffmpeg_exit(1);

> @@ -1097,7 +1096,6 @@ static void do_subtitle_out(AVFormatContext *s,
>          nb = 1;
>  
>      for(i = 0; i < nb; i++) {
> -        sub->pts = av_rescale_q(pts, ist->st->time_base, AV_TIME_BASE_Q);
>          // start_display_time is required to be 0
>          sub->pts              += av_rescale_q(sub->start_display_time, (AVRational){1, 1000}, AV_TIME_BASE_Q);

this looks a bit like sub->pts could change if nb>1

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110412/d01d9cb8/attachment.asc>


More information about the ffmpeg-devel mailing list