[MPlayer-cvslog] r38371 - in trunk/libmpdemux: demux_lavf.c demuxer.c demuxer.h

reimar subversion at mplayerhq.hu
Sun Aug 7 21:20:46 EEST 2022


Author: reimar
Date: Sun Aug  7 21:20:46 2022
New Revision: 38371

Log:
demux_lavf: make bluray language display work with lavf.

We need the underlying MPEG-TS stream ID for that, which
is currently not passed on to MPlayer core.
As the least intrusive fix, add a demuxer ctrl to query them.

Modified:
   trunk/libmpdemux/demux_lavf.c
   trunk/libmpdemux/demuxer.c
   trunk/libmpdemux/demuxer.h

Modified: trunk/libmpdemux/demux_lavf.c
==============================================================================
--- trunk/libmpdemux/demux_lavf.c	Sun Aug  7 21:11:19 2022	(r38370)
+++ trunk/libmpdemux/demux_lavf.c	Sun Aug  7 21:20:46 2022	(r38371)
@@ -790,6 +790,13 @@ static int demux_lavf_control(demuxer_t
 
 	    *((int *)arg) = (int)((priv->last_pts - priv->avfc->start_time)*100 / priv->avfc->duration);
 	    return DEMUXER_CTRL_OK;
+	case DEMUXER_CTRL_REMAP_AUDIO_ID:
+	case DEMUXER_CTRL_REMAP_SUB_ID:
+	{
+	    int id = *((int*)arg);
+	    if (priv->avfc && id >= 0 && id < priv->avfc->nb_streams) *(int *)arg = priv->avfc->streams[id]->id;
+	    return DEMUXER_CTRL_OK;
+	}
 	case DEMUXER_CTRL_SWITCH_AUDIO:
 	case DEMUXER_CTRL_SWITCH_VIDEO:
 	{

Modified: trunk/libmpdemux/demuxer.c
==============================================================================
--- trunk/libmpdemux/demuxer.c	Sun Aug  7 21:11:19 2022	(r38370)
+++ trunk/libmpdemux/demuxer.c	Sun Aug  7 21:20:46 2022	(r38371)
@@ -1857,7 +1857,9 @@ int demuxer_audio_lang(demuxer_t *d, int
         return 0;
     }
     req.type = stream_ctrl_audio;
-    req.id = sh->aid;
+    req.id = id;
+    if (demux_control(d, DEMUXER_CTRL_REMAP_AUDIO_ID, &req.id) != DEMUXER_CTRL_OK)
+        req.id = sh->aid;
     if (stream_control(d->stream, STREAM_CTRL_GET_LANG, &req) == STREAM_OK) {
         av_strlcpy(buf, req.buf, buf_len);
         return 0;
@@ -1879,7 +1881,9 @@ int demuxer_sub_lang(demuxer_t *d, int i
     req.type = stream_ctrl_sub;
     // assume 1:1 mapping so we can show the language of
     // DVD subs even when we have not yet created the stream.
-    req.id = sh ? sh->sid : id;
+    req.id = id;
+    if (sh && demux_control(d, DEMUXER_CTRL_REMAP_SUB_ID, &req.id) != DEMUXER_CTRL_OK)
+        req.id = sh->sid;
     if (stream_control(d->stream, STREAM_CTRL_GET_LANG, &req) == STREAM_OK) {
         av_strlcpy(buf, req.buf, buf_len);
         return 0;

Modified: trunk/libmpdemux/demuxer.h
==============================================================================
--- trunk/libmpdemux/demuxer.h	Sun Aug  7 21:11:19 2022	(r38370)
+++ trunk/libmpdemux/demuxer.h	Sun Aug  7 21:20:46 2022	(r38371)
@@ -111,6 +111,9 @@
 #define DEMUXER_CTRL_IDENTIFY_PROGRAM 15
 #define DEMUXER_CTRL_CORRECT_PTS 16
 #define DEMUXER_CTRL_GET_REPLAY_GAIN 17    // returns 10x the adjustment
+// Query stream IDs that the underlying device/stream would recognize
+#define DEMUXER_CTRL_REMAP_AUDIO_ID 18
+#define DEMUXER_CTRL_REMAP_SUB_ID 19
 
 #define SEEK_ABSOLUTE (1 << 0)
 #define SEEK_FACTOR   (1 << 1)


More information about the MPlayer-cvslog mailing list