Fix build error due to upgrade to ffmpeg 6.1 40/303040/3
authorhjkim <backto.kim@samsung.com>
Tue, 19 Dec 2023 08:15:09 +0000 (17:15 +0900)
committerhjkim <backto.kim@samsung.com>
Fri, 29 Dec 2023 06:04:28 +0000 (15:04 +0900)
Change-Id: If6cf9ed62da49b8c8749799b902a7bda09955963

formats/ffmpeg/mm_file_format_ffmpeg.c
formats/ffmpeg/mm_file_format_frame.c
packaging/libmm-fileinfo.spec

index 457a7f4..ea3f6c2 100644 (file)
@@ -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));
index 80c85d2..035ad53 100755 (executable)
@@ -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");
index 29c8bdb..cd1d2c6 100644 (file)
@@ -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