From 2b79deda60e6250868ce2ae93cf9905a9610e45c Mon Sep 17 00:00:00 2001 From: hjkim Date: Tue, 19 Dec 2023 17:15:09 +0900 Subject: [PATCH] Fix build error due to upgrade to ffmpeg 6.1 Change-Id: If6cf9ed62da49b8c8749799b902a7bda09955963 --- formats/ffmpeg/mm_file_format_ffmpeg.c | 24 +++++++++++++----------- formats/ffmpeg/mm_file_format_frame.c | 2 +- packaging/libmm-fileinfo.spec | 2 +- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/formats/ffmpeg/mm_file_format_ffmpeg.c b/formats/ffmpeg/mm_file_format_ffmpeg.c index 457a7f4..ea3f6c2 100644 --- a/formats/ffmpeg/mm_file_format_ffmpeg.c +++ b/formats/ffmpeg/mm_file_format_ffmpeg.c @@ -670,17 +670,22 @@ static void __fill_artwork_in_context(AVStream *st, MMFileFormatContext *formatC static void __fill_rotate_in_context(AVStream *st, MMFileFormatContext *formatContext) { - uint8_t *matrix = NULL; + int i; double rotate = 0.0; + bool found = false; - matrix = av_stream_get_side_data(st, AV_PKT_DATA_DISPLAYMATRIX, NULL); - if (!matrix) { - debug_log(DEBUG, "matrix is empty"); - return; + for (i = 0; i < st->codecpar->nb_coded_side_data; i++) { + const AVPacketSideData *sd = &st->codecpar->coded_side_data[i]; + if (sd->type == AV_PKT_DATA_DISPLAYMATRIX) { + found = true; + rotate = av_display_rotation_get((const int32_t *)sd->data); + break; + } } - // from ffmpeg's code - rotate = av_display_rotation_get((int32_t *)matrix); + if (!found) + return; + rotate = -rotate; if (rotate < 0) // for backward compatibility rotate += 360; @@ -849,9 +854,6 @@ int mmfile_format_read_frame_ffmpg(MMFileFormatContext *formatContext, unsigned /* debug_msg(RELEASE, " SMALL_LAST_FRAME: %d", pVideoCodec->capabilities & CODEC_CAP_SMALL_LAST_FRAME ? 1 : 0); */ /* debug_msg(RELEASE, " HWACCEL_VDPAU : %d", pVideoCodec->capabilities & CODEC_CAP_HWACCEL_VDPAU ? 1 : 0); */ - if (pVideoCodec->capabilities & AV_CODEC_CAP_TRUNCATED) - pVideoCodecCtx->flags |= AV_CODEC_FLAG_TRUNCATED; - /*set workaround bug flag*/ pVideoCodecCtx->workaround_bugs = FF_BUG_AUTODETECT; @@ -1140,7 +1142,7 @@ static int _get_first_good_video_frame(AVFormatContext *pFormatCtx, AVCodecConte goto NEXT; } - if (!frame->key_frame) { + if (!(frame->flags & AV_FRAME_FLAG_KEY)) { debug_msg(RELEASE, "skip (not key frame)."); #ifdef MMFILE_FORMAT_DEBUG_DUMP memset(pgm_name, 0x00, sizeof(pgm_name)); diff --git a/formats/ffmpeg/mm_file_format_frame.c b/formats/ffmpeg/mm_file_format_frame.c index 80c85d2..035ad53 100755 --- a/formats/ffmpeg/mm_file_format_frame.c +++ b/formats/ffmpeg/mm_file_format_frame.c @@ -344,7 +344,7 @@ static bool __mmfile_find_proper_frame(AVFormatContext *pFormatCtx, first_seek is used when accurate mode and when time stamp's frame is not key frame. Go back to previousto Key frame and decode frame until time stamp's frame*/ - if (pFrame->key_frame) { + if (pFrame->flags & AV_FRAME_FLAG_KEY) { debug_msg(RELEASE, "find Video Stream+++++++Find key frame"); } else { debug_msg(RELEASE, "find Video Stream+++++++ not key frame"); diff --git a/packaging/libmm-fileinfo.spec b/packaging/libmm-fileinfo.spec index 29c8bdb..cd1d2c6 100644 --- a/packaging/libmm-fileinfo.spec +++ b/packaging/libmm-fileinfo.spec @@ -1,6 +1,6 @@ Name: libmm-fileinfo Summary: Media Fileinfo -Version: 1.0.20 +Version: 1.0.21 Release: 0 Group: System/Libraries License: Apache-2.0 -- 2.34.1