[MPlayer-dev-eng] Re: [RFC][PATCH] New option -identify
Tobias Diedrich
td at sim.uni-hannover.de
Sun Oct 20 18:00:52 CEST 2002
Here is the improved version.
If no one complains I'll go and commit it :-)
Now prints something along the lines of:
ID_FILENAME=foo.avi
ID_VIDEO_FORMAT=DIV3
ID_VIDEO_BITRATE=1132600
ID_VIDEO_WIDTH=640
ID_VIDEO_HEIGHT=480
ID_VIDEO_FPS=23.98
ID_VIDEO_ASPECT=0.00
ID_AUDIO_CODEC=mp3
ID_AUDIO_FORMAT=85
ID_AUDIO_BITRATE=96000
ID_AUDIO_RATE=44100
ID_AUDIO_NCH=2
I've put the midentify script into the TOOLS subdirectory.
--
Tobias PGP: 0x9AC7E0BC
This mail is made of 100% recycled bits
Now playing: iwasuinoriyuki (IWADARE Noriyuki): Lunar 2 Soundtrack 10 - Wine, Women, and Song [Ronf
-------------- next part --------------
Index: main/cfg-mplayer.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-mplayer.h,v
retrieving revision 1.173
diff -u -r1.173 cfg-mplayer.h
--- main/cfg-mplayer.h 9 Oct 2002 01:13:40 -0000 1.173
+++ main/cfg-mplayer.h 20 Oct 2002 16:08:37 -0000
@@ -378,6 +378,7 @@
#include "cfg-common.h"
#undef MAIN_CONF
+ {"identify", &identify, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
{"quiet", &quiet, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
{"noquiet", &quiet, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL},
{"verbose", &verbose, CONF_TYPE_INT, CONF_RANGE|CONF_GLOBAL, 0, 100, NULL},
Index: main/DOCS/mplayer.1
===================================================================
RCS file: /cvsroot/mplayer/main/DOCS/mplayer.1,v
retrieving revision 1.252
diff -u -r1.252 mplayer.1
--- main/DOCS/mplayer.1 20 Oct 2002 12:20:39 -0000 1.252
+++ main/DOCS/mplayer.1 20 Oct 2002 16:08:45 -0000
@@ -217,6 +217,11 @@
More intense frame dropping (breaks decoding).
Leads to image distortion!
.TP
+.B \-identify
+Show file parameters in easy parsable format. The wrapper script
+TOOLS/midentify suppresses the other mplayer output and (hopefully)
+shellescapes the filenames.
+.TP
.B \-input <commands>
This option can be used to configure certain parts of the input system.
Paths are relative to ~/\:.mplayer/.
Index: main/DOCS/German/mplayer.1
===================================================================
RCS file: /cvsroot/mplayer/main/DOCS/German/mplayer.1,v
retrieving revision 1.17
diff -u -r1.17 mplayer.1
--- main/DOCS/German/mplayer.1 24 Aug 2002 14:22:46 -0000 1.17
+++ main/DOCS/German/mplayer.1 20 Oct 2002 16:08:50 -0000
@@ -937,6 +937,11 @@
.B \-hardframedrop (siehe auch \-framedrop Option)
Intensiveres Framedropping (unterbricht die Dekodierung). F?hrt zu Bildverzerrungen!
.TP
+.B \-identify
+Zeigt die Dateiparameter in einem leicht weiter zu verarbeitendem Format an.
+Das Script TOOLS/midentify unterdr?ckt andere Ausgaben von MPlayer und f?hrt ein
+Shellescaping der Dateinamen durch.
+.TP
.B \-include <Konfigurationsdatei>
Gibt eine Konfigurationsdatei an, welche nach der normalen ausgewertet werden soll.
.TP
--- main/TOOLS/midentify 1970-01-01 01:00:00.000000000 +0100
+++ main/TOOLS/midentify 2002-10-20 16:17:26.000000000 +0200
@@ -0,0 +1,5 @@
+#!/bin/sh
+mplayer -identify "$@" 2>/dev/null |
+ grep "^ID" |
+ sed -e 's/[`\\!$"]/\\&/g' |
+ sed -e '/^ID_FILENAME/ { s/^ID_FILENAME=\(.*\)/ID_FILENAME="\1"/g; }'
Index: main/mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.598
diff -u -r1.598 mplayer.c
--- main/mplayer.c 19 Oct 2002 20:26:02 -0000 1.598
+++ main/mplayer.c 20 Oct 2002 16:28:50 -0000
@@ -67,6 +67,7 @@
int slave_mode=0;
int verbose=0;
+int identify=0;
static int quiet=0;
#define ABS(x) (((x)>=0)?(x):(-(x)))
@@ -1146,6 +1147,35 @@
} else
inited_flags|=INITED_ACODEC;
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=%d\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.2f\n", sh_video->fps);
+ mp_msg(MSGT_GLOBAL,MSGL_INFO,"ID_VIDEO_ASPECT=%1.2f\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);
+ }
+ goto goto_next_file;
}
if(!sh_video) goto main; // audio-only
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20021020/38fa9754/attachment.pgp>
More information about the MPlayer-dev-eng
mailing list