Message ID | tencent_4BE40C958547BAA76D2330572A3E95A1E607@qq.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,v2] fftools/ffplay: fix rotation incorrect when frame contains the displaymatrix | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
yinshiyou/make_loongarch64 | warning | New warnings during build |
andriy/make_fate_x86 | success | Make fate finished |
andriy/make_x86 | warning | New warnings during build |
> On Sep 1, 2022, at 12:53 PM, 1035567130@qq.com wrote: > > From: Wang Yaqiang <wangyaqiang03@kuaishou.com> > > For example, if the jpeg contains exif information > and the rotation direction is included in the exif, > the displaymatrix will be set on the side_data of the frame when decoding. > However, when ffplay is used to play the image, > only the side data in the stream will be determined. > It does not check whether the frame also contains rotation information, > causing it to play in the wrong direction > I’m OK with this strategy. > Signed-off-by: Wang Yaqiang <wangyaqiang03@kuaishou.com> > --- > fftools/ffplay.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/fftools/ffplay.c b/fftools/ffplay.c > index 9242047f5c..5bda29169d 100644 > --- a/fftools/ffplay.c > +++ b/fftools/ffplay.c > @@ -1915,7 +1915,12 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c > } while (0) > > if (autorotate) { > - int32_t *displaymatrix = (int32_t *)av_stream_get_side_data(is->video_st, AV_PKT_DATA_DISPLAYMATRIX, NULL); > + int32_t *displaymatrix = NULL; > + AVFrameSideData *sd = av_frame_get_side_data(frame,AV_FRAME_DATA_DISPLAYMATRIX); Coding style: missing a space after comma. > + if (sd) > + displaymatrix = (int32_t *)sd->data; > + if (!displaymatrix) > + displaymatrix = (int32_t *)av_stream_get_side_data(is->video_st, AV_PKT_DATA_DISPLAYMATRIX, NULL); > double theta = get_rotation(displaymatrix); > > if (fabs(theta - 90) < 1.0) { Mixed declaration and code. > -- > 2.33.0 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff --git a/fftools/ffplay.c b/fftools/ffplay.c index 9242047f5c..5bda29169d 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -1915,7 +1915,12 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c } while (0) if (autorotate) { - int32_t *displaymatrix = (int32_t *)av_stream_get_side_data(is->video_st, AV_PKT_DATA_DISPLAYMATRIX, NULL); + int32_t *displaymatrix = NULL; + AVFrameSideData *sd = av_frame_get_side_data(frame,AV_FRAME_DATA_DISPLAYMATRIX); + if (sd) + displaymatrix = (int32_t *)sd->data; + if (!displaymatrix) + displaymatrix = (int32_t *)av_stream_get_side_data(is->video_st, AV_PKT_DATA_DISPLAYMATRIX, NULL); double theta = get_rotation(displaymatrix); if (fabs(theta - 90) < 1.0) {