[MPlayer-users] external name of MPEG streams

Matthew W. Miller mwmiller at columbus.rr.com
Thu Feb 26 03:23:27 CET 2004


On Wed, Feb 25, 2004 at 03:14:24PM +0000, Chris Phillips wrote:
>Hi, I've found that mpeg1 and mpeg2 video streams get -identify'd as
>0x100000001 and 0x100000002. is it possible to make these actually
>report readable names instead?

This is something I've wished -identify would do for some time, and this
message was the impetus for me to have a whack at it.  Looking a bit
over the relevant code in mplayer.c, I see that the ID_* block, if any,
is printed before mplayer has a chance to check for a match of format
number to codec.  So the hard part is moving the -identify logic after
that check; having done that, adding a bit to actually print the video
codec is fairly simple.
	Anyone who's interested, apply the enclosed patch, and please
stress-test it to make sure it works well and consistently.
-- 
Matthew W. Miller <mwmiller at columbus.rr.com>      MPlayer does not suck.
-------------- next part --------------
--- MPlayer-20040217/mplayer.c	2004-02-09 15:20:24.000000000 -0500
+++ MPlayer-20040217.mwm/mplayer.c	2004-02-25 20:48:10.000000000 -0500
@@ -1670,35 +1670,6 @@
   mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n");
 }
 
-if(identify) {
-  mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_FILENAME=%s\n", filename);
-  if (sh_video) {
-    /* Assume FOURCC if all bytes >= 0x20 (' ') */
-    if (sh_video->format >= 0x20202020)
-	mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_VIDEO_FORMAT=%.4s\n", &sh_video->format);
-    else
-	mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_VIDEO_FORMAT=0x%08X\n", sh_video->format);
-    mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_VIDEO_BITRATE=%d\n", sh_video->i_bps*8);
-    mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_VIDEO_WIDTH=%d\n", sh_video->disp_w);
-    mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_VIDEO_HEIGHT=%d\n", sh_video->disp_h);
-    mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_VIDEO_FPS=%5.3f\n", sh_video->fps);
-    mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_VIDEO_ASPECT=%1.4f\n", sh_video->aspect);
-  }
-  if (sh_audio) {
-    if (sh_audio->codec)
-      mp_msg(MSGT_GLOBAL,MSGL_INFO, "ID_AUDIO_CODEC=%s\n", sh_audio->codec->name);
-    /* Assume FOURCC if all bytes >= 0x20 (' ') */
-    if (sh_audio->format >= 0x20202020)
-      mp_msg(MSGT_GLOBAL,MSGL_INFO, "ID_AUDIO_FORMAT=%.4s\n", &sh_audio->format);
-    else
-      mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_AUDIO_FORMAT=%d\n", sh_audio->format);
-    mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_AUDIO_BITRATE=%d\n", sh_audio->i_bps*8);
-    mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_AUDIO_RATE=%d\n", sh_audio->samplerate);
-    mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_AUDIO_NCH=%d\n", sh_audio->channels);
-  }
-  mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_LENGTH=%ld\n", demuxer_get_time_length(demuxer));
-}
-
 if(!sh_video) goto main; // audio-only
 
 //================== Init VIDEO (codec & libvo) ==========================
@@ -1785,6 +1756,38 @@
 
 //================== MAIN: ==========================
 main:
+
+if(identify) {
+  mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_FILENAME=%s\n", filename);
+  if (sh_video) {
+    /* Assume FOURCC if all bytes >= 0x20 (' ') */
+    if (sh_video->codec)
+        mp_msg(MSGT_GLOBAL,MSGL_INFO, "ID_VIDEO_CODEC=%s\n", sh_video->codec->name);
+    if (sh_video->format >= 0x20202020)
+	mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_VIDEO_FORMAT=%.4s\n", &sh_video->format);
+    else
+	mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_VIDEO_FORMAT=0x%08X\n", sh_video->format);
+    mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_VIDEO_BITRATE=%d\n", sh_video->i_bps*8);
+    mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_VIDEO_WIDTH=%d\n", sh_video->disp_w);
+    mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_VIDEO_HEIGHT=%d\n", sh_video->disp_h);
+    mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_VIDEO_FPS=%5.3f\n", sh_video->fps);
+    mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_VIDEO_ASPECT=%1.4f\n", sh_video->aspect);
+  }
+  if (sh_audio) {
+    if (sh_audio->codec)
+      mp_msg(MSGT_GLOBAL,MSGL_INFO, "ID_AUDIO_CODEC=%s\n", sh_audio->codec->name);
+    /* Assume FOURCC if all bytes >= 0x20 (' ') */
+    if (sh_audio->format >= 0x20202020)
+      mp_msg(MSGT_GLOBAL,MSGL_INFO, "ID_AUDIO_FORMAT=%.4s\n", &sh_audio->format);
+    else
+      mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_AUDIO_FORMAT=%d\n", sh_audio->format);
+    mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_AUDIO_BITRATE=%d\n", sh_audio->i_bps*8);
+    mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_AUDIO_RATE=%d\n", sh_audio->samplerate);
+    mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_AUDIO_NCH=%d\n", sh_audio->channels);
+  }
+  mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_LENGTH=%ld\n", demuxer_get_time_length(demuxer));
+}
+
 current_module="main";
 
 // If there is no video OSD has to be disabled.


More information about the MPlayer-users mailing list