[MPlayer-cvslog] r38434 - trunk/libmpdemux/demux_lavf.c

reimar subversion at mplayerhq.hu
Sun Jul 16 23:18:00 EEST 2023


Author: reimar
Date: Sun Jul 16 23:17:59 2023
New Revision: 38434

Log:
demux_lavf.c: Make ID_VID_0_ROTATE work again.

FFmpeg API changed to use stream side data and a
display matrix.

Related to trac issue #2415.

Modified:
   trunk/libmpdemux/demux_lavf.c

Modified: trunk/libmpdemux/demux_lavf.c
==============================================================================
--- trunk/libmpdemux/demux_lavf.c	Sat Jul  1 15:05:09 2023	(r38433)
+++ trunk/libmpdemux/demux_lavf.c	Sun Jul 16 23:17:59 2023	(r38434)
@@ -40,6 +40,7 @@
 #include "libavformat/avio.h"
 #include "libavutil/avutil.h"
 #include "libavutil/avstring.h"
+#include "libavutil/display.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/opt.h"
 #include "libavutil/replaygain.h"
@@ -294,7 +295,6 @@ static void handle_stream(demuxer_t *dem
     int stream_id;
     AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
     AVDictionaryEntry *title= av_dict_get(st->metadata, "title",    NULL, 0);
-    AVDictionaryEntry *rot  = av_dict_get(st->metadata, "rotate",   NULL, 0);
     int g;
 
     switch(codec->codec_type){
@@ -377,6 +377,8 @@ static void handle_stream(demuxer_t *dem
             break;
         }
         case AVMEDIA_TYPE_VIDEO:{
+            AVDictionaryEntry *rot = av_dict_get(st->metadata, "rotate",   NULL, 0);
+            const int32_t *disp_matrix = av_stream_get_side_data(st, AV_PKT_DATA_DISPLAYMATRIX, NULL);
             sh_video_t* sh_video;
             BITMAPINFOHEADER *bih;
             sh_video=new_sh_video_vid(demuxer, i, priv->video_streams);
@@ -443,6 +445,8 @@ static void handle_stream(demuxer_t *dem
                 sh_video->default_track = 1;
             if (rot && rot->value)
                 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VID_%d_ROTATE=%s\n", priv->video_streams, rot->value);
+            else if (disp_matrix)
+                mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VID_%d_ROTATE=%f\n", priv->video_streams, (float)av_display_rotation_get(disp_matrix));
             mp_msg(MSGT_DEMUX,MSGL_DBG2,"stream aspect= %d*%d/(%d*%d)\n",
                 codec->width, st->sample_aspect_ratio.num,
                 codec->height, st->sample_aspect_ratio.den);


More information about the MPlayer-cvslog mailing list