changeset 31925:616375aefdda

Print subtitle type also for internally-supported types with a libavcodec decoder.
author reimar
date Sat, 21 Aug 2010 16:04:18 +0000
parents 8d7f15885b64
children 45966266392b
files libmpdemux/demux_lavf.c libmpdemux/demuxer.c libmpdemux/stheader.h
diffstat 3 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_lavf.c	Sat Aug 21 11:54:04 2010 +0000
+++ b/libmpdemux/demux_lavf.c	Sat Aug 21 16:04:18 2010 +0000
@@ -461,7 +461,10 @@
     }
     if (stream_type) {
         AVCodec *avc = avcodec_find_decoder(codec->codec_id);
-        mp_msg(MSGT_DEMUX, MSGL_INFO, "[lavf] stream %d: %s (%s), -%cid %d", i, stream_type, avc ? avc->name : "unknown", *stream_type, stream_id);
+        const char *codec_name = avc ? avc->name : "unknown";
+        if (!avc && *stream_type == 's' && demuxer->s_streams[stream_id])
+            codec_name = sh_sub_type2str(((sh_sub_t *)demuxer->s_streams[stream_id])->type);
+        mp_msg(MSGT_DEMUX, MSGL_INFO, "[lavf] stream %d: %s (%s), -%cid %d", i, stream_type, codec_name, *stream_type, stream_id);
         if (lang && lang->value && *stream_type != 'v')
             mp_msg(MSGT_DEMUX, MSGL_INFO, ", -%clang %s", *stream_type, lang->value);
         if (title && title->value)
--- a/libmpdemux/demuxer.c	Sat Aug 21 11:54:04 2010 +0000
+++ b/libmpdemux/demuxer.c	Sat Aug 21 16:04:18 2010 +0000
@@ -254,6 +254,21 @@
     return d;
 }
 
+const char *sh_sub_type2str(int type)
+{
+    switch (type) {
+    case 't': return "text";
+    case 'm': return "movtext";
+    case 'a': return "ass";
+    case 'v': return "vobsub";
+    case 'x': return "xsub";
+    case 'b': return "dvb";
+    case 'd': return "dvb-teletext";
+    case 'p': return "hdmv pgs";
+    }
+    return "unknown";
+}
+
 sh_sub_t *new_sh_sub_sid(demuxer_t *demuxer, int id, int sid, const char *lang)
 {
     if (id > MAX_S_STREAMS - 1 || id < 0) {
--- a/libmpdemux/stheader.h	Sat Aug 21 11:54:04 2010 +0000
+++ b/libmpdemux/stheader.h	Sat Aug 21 16:04:18 2010 +0000
@@ -140,6 +140,8 @@
 void free_sh_audio(demuxer_t *demuxer, int id);
 void free_sh_video(sh_video_t *sh);
 
+const char *sh_sub_type2str(int type);
+
 // video.c:
 int video_read_properties(sh_video_t *sh_video);
 int video_read_frame(sh_video_t* sh_video,float* frame_time_ptr,unsigned char** start,int force_fps);