[PATCH 1/2] ffplay: use decoder avctx for decoded subtitle width/height
Fixes ticket #5873. Signed-off-by: Marton Balint <cus@passwd.hu> --- ffplay.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ffplay.c b/ffplay.c index e64909a..a7a6785 100644 --- a/ffplay.c +++ b/ffplay.c @@ -2224,7 +2224,6 @@ static int video_thread(void *arg) static int subtitle_thread(void *arg) { VideoState *is = arg; - AVCodecParameters *codecpar = is->subtitle_st->codecpar; Frame *sp; int got_subtitle; double pts; @@ -2243,8 +2242,8 @@ static int subtitle_thread(void *arg) pts = sp->sub.pts / (double)AV_TIME_BASE; sp->pts = pts; sp->serial = is->subdec.pkt_serial; - sp->width = codecpar->width; - sp->height = codecpar->height; + sp->width = is->subdec.avctx->width; + sp->height = is->subdec.avctx->height; sp->uploaded = 0; /* now we can update the picture count */ -- 2.6.6
Signed-off-by: Marton Balint <cus@passwd.hu> --- ffplay.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/ffplay.c b/ffplay.c index a7a6785..6d43191 100644 --- a/ffplay.c +++ b/ffplay.c @@ -230,9 +230,6 @@ typedef struct VideoState { Decoder viddec; Decoder subdec; - int viddec_width; - int viddec_height; - int audio_stream; int av_sync_type; @@ -1780,9 +1777,6 @@ static int get_video_frame(VideoState *is, AVFrame *frame) frame->sample_aspect_ratio = av_guess_sample_aspect_ratio(is->ic, is->video_st, frame); - is->viddec_width = frame->width; - is->viddec_height = frame->height; - if (framedrop>0 || (framedrop && get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER)) { if (frame->pts != AV_NOPTS_VALUE) { double diff = dpts - get_master_clock(is); @@ -2687,9 +2681,6 @@ static int stream_component_open(VideoState *is, int stream_index) is->video_stream = stream_index; is->video_st = ic->streams[stream_index]; - is->viddec_width = avctx->width; - is->viddec_height = avctx->height; - decoder_init(&is->viddec, avctx, &is->videoq, is->continue_read_thread); if ((ret = decoder_start(&is->viddec, video_thread, is)) < 0) goto out; -- 2.6.6
On 01/10/2016 17:17, Marton Balint wrote:
Signed-off-by: Marton Balint <cus@passwd.hu> --- ffplay.c | 9 --------- 1 file changed, 9 deletions(-)
diff --git a/ffplay.c b/ffplay.c index a7a6785..6d43191 100644 --- a/ffplay.c +++ b/ffplay.c @@ -230,9 +230,6 @@ typedef struct VideoState { Decoder viddec; Decoder subdec;
- int viddec_width; - int viddec_height; - int audio_stream;
int av_sync_type; @@ -1780,9 +1777,6 @@ static int get_video_frame(VideoState *is, AVFrame *frame)
frame->sample_aspect_ratio = av_guess_sample_aspect_ratio(is->ic, is->video_st, frame);
- is->viddec_width = frame->width; - is->viddec_height = frame->height; - if (framedrop>0 || (framedrop && get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER)) { if (frame->pts != AV_NOPTS_VALUE) { double diff = dpts - get_master_clock(is); @@ -2687,9 +2681,6 @@ static int stream_component_open(VideoState *is, int stream_index) is->video_stream = stream_index; is->video_st = ic->streams[stream_index];
- is->viddec_width = avctx->width; - is->viddec_height = avctx->height; - decoder_init(&is->viddec, avctx, &is->videoq, is->continue_read_thread); if ((ret = decoder_start(&is->viddec, video_thread, is)) < 0) goto out;
LGTM. -- Josh
On 01/10/2016 17:17, Marton Balint wrote:
Fixes ticket #5873.
Signed-off-by: Marton Balint <cus@passwd.hu> --- ffplay.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/ffplay.c b/ffplay.c index e64909a..a7a6785 100644 --- a/ffplay.c +++ b/ffplay.c @@ -2224,7 +2224,6 @@ static int video_thread(void *arg) static int subtitle_thread(void *arg) { VideoState *is = arg; - AVCodecParameters *codecpar = is->subtitle_st->codecpar; Frame *sp; int got_subtitle; double pts; @@ -2243,8 +2242,8 @@ static int subtitle_thread(void *arg) pts = sp->sub.pts / (double)AV_TIME_BASE; sp->pts = pts; sp->serial = is->subdec.pkt_serial; - sp->width = codecpar->width; - sp->height = codecpar->height; + sp->width = is->subdec.avctx->width; + sp->height = is->subdec.avctx->height; sp->uploaded = 0;
/* now we can update the picture count */
Feels backwards to go to a avctx from codecpar, but if it fixes 5873 then it's fine, it can always be changed back again in the future--so LGTM. -- Josh
On Sat, 1 Oct 2016, Josh de Kock wrote:
On 01/10/2016 17:17, Marton Balint wrote:
Fixes ticket #5873.
Signed-off-by: Marton Balint <cus@passwd.hu> --- ffplay.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/ffplay.c b/ffplay.c index e64909a..a7a6785 100644 --- a/ffplay.c +++ b/ffplay.c @@ -2224,7 +2224,6 @@ static int video_thread(void *arg) static int subtitle_thread(void *arg) { VideoState *is = arg; - AVCodecParameters *codecpar = is->subtitle_st->codecpar; Frame *sp; int got_subtitle; double pts; @@ -2243,8 +2242,8 @@ static int subtitle_thread(void *arg) pts = sp->sub.pts / (double)AV_TIME_BASE; sp->pts = pts; sp->serial = is->subdec.pkt_serial; - sp->width = codecpar->width; - sp->height = codecpar->height; + sp->width = is->subdec.avctx->width; + sp->height = is->subdec.avctx->height; sp->uploaded = 0;
/* now we can update the picture count */
Feels backwards to go to a avctx from codecpar, but if it fixes 5873 then it's fine, it can always be changed back again in the future--so LGTM.
Pushed both patches, thanks. Marton
participants (2)
-
Josh de Kock -
Marton Balint