[FFmpeg-devel] [PATCH 2/2] ffmpeg: simplify do_subtitle_out() by using AVSubtitle.pts
Aurelien Jacobs
aurel at gnuage.org
Mon Apr 11 23:57:41 CEST 2011
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);
sub->end_display_time -= sub->start_display_time;
@@ -1704,8 +1702,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
do_video_stats(os, ost, frame_size);
break;
case AVMEDIA_TYPE_SUBTITLE:
- do_subtitle_out(os, ost, ist, &subtitle,
- pkt->pts);
+ do_subtitle_out(os, ost, ist, &subtitle);
break;
default:
abort();
--
1.7.4.1
More information about the ffmpeg-devel
mailing list