[PATCH 18/18] libmpdemux/demux_lavf: replace av_stream_get_side_data() with new API

Nicolas George <[email protected]> Tue, 28 Jul 2026 20:15:14 +0200
Newsgroups gmane.comp.video.mplayer.devel
Message-ID <[email protected]>
---
 libmpdemux/demux_lavf.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c
index 60b15f0f6..bd946b166 100644
--- a/libmpdemux/demux_lavf.c
+++ b/libmpdemux/demux_lavf.c
@@ -366,10 +366,12 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) {
             if (demuxer->audio->id != i)
                 st->discard= AVDISCARD_ALL;
             if (priv->audio_streams == 0) {
-                size_t rg_size;
-                AVReplayGain *rg = (AVReplayGain*)av_stream_get_side_data(st, AV_PKT_DATA_REPLAYGAIN, &rg_size);
-                if (rg && rg_size >= sizeof(*rg)) {
-                    priv->r_gain = rg->track_gain / 10000;
+                const AVPacketSideData *rg = av_packet_side_data_get(
+                    st->codecpar->coded_side_data,
+                    st->codecpar->nb_coded_side_data,
+                    AV_PKT_DATA_REPLAYGAIN);
+                if (rg && rg->size >= sizeof(AVReplayGain)) {
+                    priv->r_gain = ((AVReplayGain *)rg)->track_gain / 10000;
                 }
             } else
                 priv->r_gain = INT32_MIN;
@@ -378,7 +380,10 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) {
         }
         case AVMEDIA_TYPE_VIDEO:{
             AVDictionaryEntry *rot = av_dict_get(st->metadata, "rotate",   NULL, 0);
-            const int32_t *disp_matrix = (const int32_t *)av_stream_get_side_data(st, AV_PKT_DATA_DISPLAYMATRIX, NULL);
+            const AVPacketSideData *dm = av_packet_side_data_get(
+                st->codecpar->coded_side_data,
+                st->codecpar->nb_coded_side_data, AV_PKT_DATA_DISPLAYMATRIX);
+            const int32_t *disp_matrix = dm ? (const int32_t *)dm->data : NULL;
             sh_video_t* sh_video;
             BITMAPINFOHEADER *bih;
             sh_video=new_sh_video_vid(demuxer, i, priv->video_streams);
-- 
2.53.0

_______________________________________________
MPlayer-dev-eng mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo/%(_internal_name)s