Merge remote-tracking branch 'origin/main' into v2.17.x
authorCarl Hetherington <cth@carlh.net>
Fri, 29 Mar 2024 23:00:44 +0000 (00:00 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 29 Mar 2024 23:00:44 +0000 (00:00 +0100)
1  2 
src/lib/ffmpeg_examiner.cc

index f7d3f9df334b8d92f00c93adc456c08b587cec30,51ade8e89cb844336baa4dfac51ef56be3f4fbea..d173c6bb660cd12415285721bad4f068e68a982f
@@@ -181,12 -191,13 +181,14 @@@ FFmpegExaminer::FFmpegExaminer (shared_
                        }
                }
  
 -              if (displaymatrix && !_rotation) {
 -                      _rotation = - av_display_rotation_get ((int32_t*) displaymatrix);
 +              auto side_data = av_packet_side_data_get(stream->codecpar->coded_side_data, stream->codecpar->nb_coded_side_data, AV_PKT_DATA_DISPLAYMATRIX);
 +              if (side_data && !_rotation) {
 +                      _rotation = - av_display_rotation_get(reinterpret_cast<int32_t*>(side_data->data));
                }
  
-               _rotation = *_rotation - 360 * floor (*_rotation / 360 + 0.9 / 360);
+               if (_rotation) {
+                       _rotation = *_rotation - 360 * floor (*_rotation / 360 + 0.9 / 360);
+               }
        }
  
        LOG_GENERAL("Temporal reference was %1", temporal_reference);