summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@mplayer2.org>2012-07-28 18:00:33 +0200
committerwm4 <wm4@mplayer2.org>2012-07-28 20:44:58 +0200
commit6dc124962527556512b6b18fbf23f9b6af9f331c (patch)
tree9677196e5bbbaf3a8ee7e11bb78eb88c765a0e90
parent7d4576cf79bc578ce7c103e4df70695346c7eec7 (diff)
downloadmpv-6dc124962527556512b6b18fbf23f9b6af9f331c.tar.bz2
mpv-6dc124962527556512b6b18fbf23f9b6af9f331c.tar.xz
TOOLS: remove useless crap
Most of the scripts in TOOLS seem entirely useless. Remove them. There were about 3 types of scripts: - apparent developer tools (like file format dumpers, benchmarks) => I doubt any mplayer developer still alive even uses these - helpers for encoding or ripping stuff => mencoder is gone, at least from this version of mplayer - helpers meant for users (launching mplayer in weird ways, etc.) => just no, it will cause you more pain than gain So no, there is nothing useful. Under the scripts not deleted, these are needed for building mplayer: file2string.py matroska.py vdpau_functions.py These might have _some_ use (but still questionable): binary_codecs.sh checktree.sh
-rw-r--r--TOOLS/README477
-rw-r--r--TOOLS/alaw-gen.c68
-rw-r--r--TOOLS/asfinfo.c289
-rw-r--r--TOOLS/avi-fix.c158
-rw-r--r--TOOLS/avisubdump.c200
-rw-r--r--TOOLS/bmovl-test.c136
-rwxr-xr-xTOOLS/calcbpp.pl43
-rw-r--r--TOOLS/compare.c73
-rwxr-xr-xTOOLS/countquant.pl35
-rw-r--r--TOOLS/dump_mp4.c63
-rw-r--r--TOOLS/edgedetect.fp37
-rw-r--r--TOOLS/edgeenh.fp38
-rw-r--r--TOOLS/emboss.fp29
-rw-r--r--TOOLS/fastmemcpybench.c241
-rwxr-xr-xTOOLS/midentify.sh18
-rw-r--r--TOOLS/modify_reg.c182
-rw-r--r--TOOLS/movinfo.c356
-rwxr-xr-xTOOLS/mpconsole.sh12
-rwxr-xr-xTOOLS/mphelp_check.py66
-rwxr-xr-xTOOLS/mplmult.sh45
-rw-r--r--TOOLS/netstream.c366
-rwxr-xr-xTOOLS/plotpsnr.pl234
-rwxr-xr-xTOOLS/psnr-video.sh179
-rwxr-xr-xTOOLS/subedit.pl445
-rw-r--r--TOOLS/subrip.c237
-rwxr-xr-xTOOLS/subsearch.sh34
-rw-r--r--TOOLS/vfw2menc.c304
-rw-r--r--TOOLS/vivodump.c314
-rwxr-xr-xTOOLS/vobshift.py58
-rwxr-xr-xTOOLS/w32codec_dl.pl168
-rwxr-xr-xTOOLS/wma2ogg.pl340
31 files changed, 0 insertions, 5245 deletions
diff --git a/TOOLS/README b/TOOLS/README
deleted file mode 100644
index d1e3775684..0000000000
--- a/TOOLS/README
+++ /dev/null
@@ -1,477 +0,0 @@
-README for the TOOLS directory
-==============================
-
-Preamble
---------
-
-In this directory you can find some nice scripts and code that makes
-using MPlayer easier.
-
-FIXME: Document the following tools:
-
-bmovl-test
-
-
-MPlayer scripts in the TOOLS dir
---------------------------------
-
-edgedetect.fp, emboss.fp
-
-Author: Reimar Döffinger
-
-Description: Examples of custom fragment program for OpenGL video out driver
-
-Usage: mplayer -vo gl:yuv=4:customprog=edgedetect.fp
-
-
-midentify.sh
-
-Author: Tobias Diedrich
-
-Description: Runs 'mplayer -identify' for all arguments while preventing
- video window flashing.
-
-Usage: midentify.sh file1 [file2 ...]
-
-
-mpconsole.sh
-
-Author: Rich Felker
-
-Description: Script to run MPlayer on the console (fbdev/mga_vid/etc.) without
- the console text and/or flashing cursor getting in the way.
-
-Usage: mpconsole.sh [mplayer options]
-
-
-mplmult.sh
-
-Author: Reimar Döffinger
-
-Description: Example how to output video on multiple windows in sync. Might
- be even more useful in combination with -vo ggi to distribute
- the video arbitrarily.
-
-Usage: mplmult.sh <n> <options>
- n Number of MPlayer instances that display the video.
- options Any options you would pass to MPlayer, more than
- one file will usually not work.
-
-
-subsearch.sh
-
-Author: Alex Beregszaszi
-
-Description: Collects subtitle files from the directory given as argument
- ('.' if none is given) and its subdirectories and prints
- them as a comma separated list to stdout.
-
-Usage: subsearch.sh [directory]
- mplayer -sub `subsearch.sh` movie
-
-
-wma2ogg.pl
-
-Author: Peter Simon
-
-Description: Converts WMA files to Ogg or MP3.
-
-Usage: wma2ogg [options] <-f FILE1 | -f FILE2 ... | -a>
- -f, -file filename
- -a converts all WMA files in the current directory
- -t output filetype (ogg, mp3) [default=ogg]
- -lame I wanna use L.A.M.E. sure enough!
- -br bitrate (kb/s) [default=from the WMA]
- -del remove WMA file(s) after the transcoding
-
-
-Tech scripts in the TOOLS dir
------------------------------
-
-calcbpp.pl
-
-Author: Moritz Bunkus
-
-Description: A script that calculates the $bpp for a movie, mentioned in
- DOCS/tech/encoding-tips.txt, see that document for more info.
-
-Usage: calcbpp.pl <resolution> <aspect ratio> <bitrate> <fps>
- resolution: the cropped but unscaled resolution
- (use '-vf cropdetect')
- aspect ratio: the encoded aspect ratio. All DVDs come at
- 720x576 but contain a flag that tells the player
- wether it should display the DVD at an aspect
- ratio of 4/3 (1.333) or at 16/9 (1.777). Have a
- look at MPlayer's output - there's something
- about 'prescaling'. That's what you are looking
- for.
- bitrate: the video bitrate in kbit/s
- fps: the fps
-
- example: calcbpp.pl 720x440 16/9 896 25
-
-
-countquant.pl
-
-Author: Moritz Bunkus
-
-Description: Counts the quantizers used for the encoding, mentioned in
- DOCS/tech/encoding-tips.txt, see that document for more info.
-
-Usage: countquant.pl < divx2pass.log
- It will print out which quantizer was used how often. If you see
- that e.g. the lowest quantizer (vqmin=2) gets used for > 95% of
- the frames then you can safely increase your picture size.
-
-
-plotpsnr.pl
-
-Author: Jonas Jermann
-
-Description: Draw PSNR log graphs using gnuplot.
-
-Usage: plotpsnr.pl [options] <file>
- -h, --help Display this help message
- -quant Display quantizers
- -size Display size
- -psnr Display PSNR
- -iframes Display I-frames
- -pframes Display P-frames
- -bframes Display B-frames
- -aframes Display all frames in different colors
- -cmp <file2> Compare two files
- -qs <style> Quantizer style
- -ss <style> Size style
- -ps <style> PSNR style
-
- Default: -quant -size -psnr -qs "p" -ss "i" -ps "p"
-
-Note: Requires gnuplot. Comparison is based on file2. Comparison
- assumes that the frame numbers of both files fit.
-
-
-psnr-video.sh
-
-Author: Matthias Wieser
-
-Description: Calculates the PSNR between two existing video files.
- The PSNR is calculated frame by frame.
- Also prints the overall PSNR.
- The script can be used to:
- * Compare different softwarescalers (should I use
- -sws 1 or -sws 2 ?)
- * Compare different resolutions (is it better to scale
- down to 640x360 or to 560x320)
- * Compare different deinterlacers
- * Compare different video codecs
- * Compare video filters (is it better to use -vf hqdn3d
- or lavcopts:nr=400)
- * [...]
-
-Usage: psnr-video.sh <file1> <file2> [<frames>] [<options1>] [<options2>]
-
- <file1> and <file2> are the video files for which the PSNR
- should be calculated.
- [<frames>] is the number of frames to process, starting
- from frame 1.
- [<options1>] are additional MPlayer options for <file1>
- [<options2>] are additional MPlayer options for <file2>
-
- A file called ./psnr.dat will be created with the following
- content:
-
- File;Y;Cb;Cr
- 00000001.ppm;34.23;39.54;40.06;35.426
- 00000002.ppm;33.03;38.71;39.26;34.271
- 00000003.ppm;33.45;38.91;39.28;34.655
- 00000004.ppm;32.72;38.69;38.85;33.972
- [...]
- 00000247.ppm;35.55;40.84;42.15;36.785
- PSNR:;35.9887
-
-Note: This script relies on the the tool "pnmpsnr" for the
- frame-by-frame PSNR calculation.
- Be aware that psnr-video.sh needs a lot of temporary space
- in /tmp/.
-
-
-asfinfo
-
-Author: Arpi
-
-Description: a simple ASF header display program
-
-Usage: asfinfo <filename.asf>
-
-Note: Also see MPlayer's -identify option.
-
-
-avi-fix
-
-Author: Arpi
-
-Description: A simple tool to fix chunk sizes in RIFF AVI files.
-
-Usage: avi-fix [-fix] <badfile.avi>
-
-Note: It does not check or fix the index. You can try to fix it with
- ffmpeg -i ... -acodec copy -vcodec copy.
-
-
-checktree.sh
-
-Author: Ivo van Poorten
-
-Description: Check the source tree for anomalies.
-
-Usage: checktree.sh -help
-
-Note: This script is meant for developers to check the current
- source tree and/or the patches they are working on.
-
-
-mphelp_check.py
-
-Author: Uoti Urpala
-
-Description: Check console message translations for common errors.
-
-Usage: mphelp_check.py [--missing] <master file> <files to check>
-
-Note: Compares MPlayer translation files against a master file and
- reports conflicting arguments, extra strings not present in
- the base file and (optionally) missing strings.
-
-
-cpuinfo
-
-Author: Jürgen Keil
-
-Description: the prototype ../cpuinfo.c
-
-Note: Used by configure to emulate /proc/cpuinfo on non-Linux systems.
-
-
-dump_mp4
-
-Author: Arpi
-
-Description: MPEG4-ES stream inspector, dumps the stream startcodes.
-
-
-fastmemcpybench
-
-Author: Felix Bünemann
-
-Description: benchmark/testbed for fastmemcpy stuff
-
-Note: Also see fastmem.sh.
-
-
-movinfo
-
-Author: Arpi
-
-Description: Show QuickTime MOV file structure.
-
-Usage: movinfo <filename.mov>
-
-
-vivodump
-
-Author: Arpi
-
-Description: Dump H.263 frame headers from VIVO files.
-
-Usage: vivodump <input_file> <output_file>
-
-
-
-Miscellaneous scripts in the TOOLS dir
---------------------------------------
-
-subedit.pl
-
-Author: Michael Klepikov
-
-Description: A script for pipelined editing of subtitle files.
-
-Usage: subedit.pl [switches]
- -if,--input-format <fmt> input format; supported: SRT (default: SRT)
- -of,--output-format <fmt> output format; supported: SRT
- (default: input format)
- -s,--shift <time> shift all subtitles by <time>
- (format: [-]hh:mm:ss,fraction)
- -c,--scale <time> scale by adding <time> to overall duration
- -f,--split-from <time> drop subtitles that end before <time>
- -t,--split-to <time> drop subtitles that start after <time> (will
- truncate timing if it overlaps a boundary)
- -r,--renumber renumber SRT subtitles in output
- -d,--debug enable debug output
- -h,--help help message
-
-
-w32codec_dl.pl
-
-Author: Tom Lees
-
-Description: This script will use the Windows Media Player codec download
- infrastructure to aquire the codecs listed in codecs.conf and put
- them in a directory named "codecs/" below the current directory.
-
-Usage: w32codec_dl.pl <codecs.conf location>
-
-Note: You will need the libwww-perl stuff and the cabextract utility
- which can be found at http://www.kyz.uklinux.net/cabextract.php3.
-
-
-binary_codecs.sh
-
-Author: Andrea Menucci, thuglife
-
-Description: Downloads binary codecs from mplayerhq.hu and installs them
- on a Debian system.
-
-Usage: binary_codecs.sh install
- binary_codecs.sh uninstall
-
-
-vobshift.py
-
-Author: Gábor Farkas
-
-Description: Adjust the time-info in vobsub files
-
-Usage: vobshift.py in.idx out.idx +8.3
- Will shift the time by 8.3 seconds
-
-
-subrip.c
-
-Author: Kim Minh Kaplan
-
-Description: Transform VOBsub subtitles into Subrip text subtitles using
- GOCR/JOCR.
-
-Usage: subrip <vobsub basename> [subid [output filename] ]
-
-Note: Requires at least JOCR/GOCR 0.37.
- You will have to change the 'vobsub_id' value if you want a
- subtitle different from number 0. Hint: You can view the
- subtitle that is being decoded with "display subtitle-*.pgm".
-
-
-alaw-gen.c
-
-Author: Arpi
-
-Description: Generates alaw/ulaw tables.
-
-Note: Created to work around a past license issue, no longer useful.
-
-
-avisubdump.c
-
-Author: Tobias Diedrich
-
-Description: Dumps vobsub soft subtitles streams embedded in AVI files.
-
-Usage: avisubdump <movie.avi>
-
-
-vfw2menc.c
-
-Author: Gianluigi Tiesi
-
-Description: Creates a codec settings file from the Video for Windows codecs
- found in the mplayer codec packs.
-
-Usage: vfw2menc -f <fourcc> -d <codec.dll> -s <settingsfile.mcf>
- -h|--help - displays this help
- -d|--driver filename - dll or drv to load
- -f|--fourcc fourcc - fourcc of selected driver
- -s|--save filename - save settings to file
- -c|--check filename - load and show setting in filename
- -v|--view - displays the config dialog and do nothing
-
-Notes: Works on Windows/Linux x86 only.
-
-
-modify_reg.c
-
-Author: Alan Nisota
-
-Description: Modifies registry file (usually ~/.mplayer/registry)
-
-Usage: modify_reg -r <registry_file> -l
- modify_reg -r <registry_file> -k <key> [-d|-v <value>[-t <type>]]
- -r|--registry - path to registry file
- -l|--list - shows all keys and values
- -k|--key - registry key
- -d|--del - delete key
- -v|--value - new value for key
- -t|--type - key type: string (default) or dword
-
-Notes: Necessary to use CoreAVC with MPlayer
-
-
-compare.c
-
-Author: Michael Niedermayer
-
-Description: Simple file compare program that detects the number of rounding
- errors and dies if the error is too large.
-
-Usage: compare <file1> <file2>
-
-
-realcodecs/
-
-Author: miscellaneous
-
-Description: Wrappers for Linux Real binary codecs used to analyze, alter and
- dump the data flow between RealPlayer and its codecs.
-
-Usage: - Set the path to the RealPlayer codecs directory in the C files.
- - Run 'make realcodecs'.
- - Rename the original codecs to match the names expected in the
- wrapper sources. The default is to give them a "real" prefix,
- e.g. realcook.so.6.0.
- - Put the wrappers in the RealPlayer codecs directory.
-
-Notes: Known to work at least on Linux x86 with RealPlayer8.
-
-
-
-netstream - access remote streams
----------------------------------
-
-netstream allows you to access most MPlayer stream types from a remote host.
-The main purpose of this feature is to make it possible to directly use the
-CD or DVD drive of another computer on the network (provided you have the
-required bandwidth). On the downside some stream types (currently TV and MF)
-are not usable remotely because they are implemented at the demuxer level.
-
-Be aware that currently the server is not secure at all.
-
-Compile the server by running 'make TOOLS/netstream' ('make TOOLS/netstream.exe'
-on windows) from the root of mplayer source and then copy the netstream binary
-to the right place on your system (usually /usr/local/bin on Unix). Start the
-netstream server on the computer you intend to access remotely. There are no
-command line arguments.
-
-Play the second track of a VCD on the server with:
-
- mplayer -cache 5000 mpst://servername/vcd://2
-
-Access files on this server with:
-
- mplayer -cache 5000 mpst://servername//usr/local/movies/lol.avi
-
-Note that paths which do not start with a / will be interpreted as relative to
-the directory where the server is running. The '-cache' option is not needed
-but highly recommended.
-
-netstream will not take -dvd-device, so you must either symlink
-your drive to /dev/dvd/ or use the dvd:///path/to/dvd.
-for example: mpst://audioserver/dvd:////dev/optical/lg_black_dvd
diff --git a/TOOLS/alaw-gen.c b/TOOLS/alaw-gen.c
deleted file mode 100644
index 92769015d1..0000000000
--- a/TOOLS/alaw-gen.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-// sox -t raw -A -r 8000 -b alaw.alaw -t sw alaw.out
-
-int main(void){
-int i;
-FILE *f;
-
-f=fopen("alaw.dat","wb");
-for(i=0;i<256;i++) fwrite(&i,1,1,f);
-fclose(f);
-
-system("sox -t raw -A -r 8000 -b alaw.dat -t sw alaw.out");
-
-printf("// Generated by TOOLS/alaw-gen.c\n\n");
-
-printf("#ifndef MPLAYER_ALAW_H\n");
-printf("#define MPLAYER_ALAW_H\n");
-
-printf("\nconst short alaw2short[]={\n");
-
-f=fopen("alaw.out","rb");
-for(i=0;i<256;i++){
- signed short x;
- fread(&x,2,1,f);
- printf("%7d",x);
- if(i!=255) putchar(',');
- if((i&7)==7) printf("\n");
-}
-fclose(f);
-printf("};\n");
-
-system("sox -t raw -U -r 8000 -b alaw.dat -t sw alaw.out");
-
-printf("\nconst short ulaw2short[]={\n");
-
-f=fopen("alaw.out","rb");
-for(i=0;i<256;i++){
- signed short x;
- fread(&x,2,1,f);
- printf("%7d",x);
- if(i!=255) putchar(',');
- if((i&7)==7) printf("\n");
-}
-fclose(f);
-printf("};\n\n");
-
-printf("#endif /* MPLAYER_ALAW_H */\n");
-
-return 0;
-}
diff --git a/TOOLS/asfinfo.c b/TOOLS/asfinfo.c
deleted file mode 100644
index 739bbcc0c7..0000000000
--- a/TOOLS/asfinfo.c
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#define SAVE_STREAMS
-
-// simple ASF header display program by A'rpi/ESP-team
-// .asf fileformat docs from http://divx.euro.ru
-
-#include <stdio.h>
-#include <stdlib.h>
-
-typedef struct __attribute__((packed))
-{
- long biSize; // sizeof(BITMAPINFOHEADER)
- long biWidth;
- long biHeight;
- short biPlanes; // unused
- short biBitCount;
- long biCompression; // fourcc of image
- long biSizeImage; // size of image. For uncompressed images
- // ( biCompression 0 or 3 ) can be zero.
-
-
- long biXPelsPerMeter; // unused
- long biYPelsPerMeter; // unused
- long biClrUsed; // valid only for palettized images.
- // Number of colors in palette.
- long biClrImportant;
-} BITMAPINFOHEADER;
-
-typedef struct
-{
- short wFormatTag; // value that identifies compression format
- short nChannels;
- long nSamplesPerSec;
- long nAvgBytesPerSec;
- short nBlockAlign; // size of a data sample
- short wBitsPerSample;
- short cbSize; // size of format-specific data
-} WAVEFORMATEX;
-
-typedef struct __attribute__((packed)) {
- unsigned char guid[16];
- unsigned long long size;
-} ASF_obj_header_t;
-
-typedef struct __attribute__((packed)) {
- ASF_obj_header_t objh;
- unsigned int cno; // number of subchunks
- unsigned char v1; // unknown (0x01)
- unsigned char v2; // unknown (0x02)
-} ASF_header_t;
-
-typedef struct __attribute__((packed)) {
- unsigned char client[16]; // Client GUID
- unsigned long long file_size;
- unsigned long long creat_time; //File creation time FILETIME 8
- unsigned long long packets; //Number of packets UINT64 8
- unsigned long long end_timestamp; //Timestamp of the end position UINT64 8
- unsigned long long duration; //Duration of the playback UINT64 8
- unsigned long start_timestamp; //Timestamp of the start position UINT32 4
- unsigned long unk1; //Unknown, maybe reserved ( usually contains 0 ) UINT32 4
- unsigned long flags; //Unknown, maybe flags ( usually contains 2 ) UINT32 4
- unsigned long packetsize; //Size of packet, in bytes UINT32 4
- unsigned long packetsize2; //Size of packet ( confirm ) UINT32 4
- unsigned long frame_size; //Size of uncompressed video frame UINT32 4
-} ASF_file_header_t;
-
-typedef struct __attribute__((packed)) {
- unsigned char type[16]; // Stream type (audio/video) GUID 16
- unsigned char concealment[16]; // Audio error concealment type GUID 16
- unsigned long long unk1; // Unknown, maybe reserved ( usually contains 0 ) UINT64 8
- unsigned long type_size; //Total size of type-specific data UINT32 4
- unsigned long stream_size; //Size of stream-specific data UINT32 4
- unsigned short stream_no; //Stream number UINT16 2
- unsigned long unk2; //Unknown UINT32 4
-} ASF_stream_header_t;
-
-typedef struct __attribute__((packed)) {
- unsigned char streamno;
- unsigned char seq;
- unsigned long x;
- unsigned char flag;
-} ASF_segmhdr_t;
-
-
-ASF_header_t asfh;
-ASF_obj_header_t objh;
-ASF_file_header_t fileh;
-ASF_stream_header_t streamh;
-unsigned char buffer[8192];
-
-int i;
-
-static char* chunk_type(unsigned char* guid){
- switch(*((unsigned int*)guid)){
- case 0xF8699E40: return "guid_audio_stream";
- case 0xBC19EFC0: return "guid_video_stream";
- case 0x49f1a440: return "guid_audio_conceal_none";
- case 0xbfc3cd50: return "guid_audio_conceal_interleave";
- case 0x75B22630: return "guid_header";
- case 0x75b22636: return "guid_data_chunk";
- case 0x33000890: return "guid_index_chunk";
- case 0xB7DC0791: return "guid_stream_header";
- case 0xD6E229D1: return "guid_header_2_0";
- case 0x8CABDCA1: return "guid_file_header";
- }
- return NULL;
-}
-
-static void print_wave_header(WAVEFORMATEX *h){
- printf("======= WAVE Format =======\n");
-
- printf("Format Tag: %d (0x%X)\n", h->wFormatTag, h->wFormatTag);
- printf("Channels: %d\n", h->nChannels);
- printf("Samplerate: %ld\n", h->nSamplesPerSec);
- printf("avg byte/sec: %ld\n", h->nAvgBytesPerSec);
- printf("Block align: %d\n", h->nBlockAlign);
- printf("bits/sample: %d\n", h->wBitsPerSample);
- printf("cbSize: %d\n", h->cbSize);
-
- switch(h->wFormatTag){
- case 0x01: printf("Audio in PCM format\n"); break;
- case 0x50: printf("Audio in MPEG Layer 1/2 format\n"); break;
- case 0x55: printf("Audio in MPEG Layer-3 format\n"); break; // ACM
- case 0x02: printf("Audio in MS ADPCM format\n"); break; // ACM
- case 0x11: printf("Audio in IMA ADPCM format\n"); break; // ACM
- case 0x31:
- case 0x32: printf("Audio in MS GSM 6.10 format\n"); break; // ACM
- case 0x160:
- case 0x161: printf("Audio in DivX WMA format\n"); break; // ACM
- default: printf("Audio in UNKNOWN (id=0x%X) format\n", h->wFormatTag);
- }
-
- printf("===========================\n");
-}
-
-static void print_video_header(BITMAPINFOHEADER *h){
- printf("======= VIDEO Format ======\n");
- printf(" biSize %ld\n", h->biSize);
- printf(" biWidth %ld\n", h->biWidth);
- printf(" biHeight %ld\n", h->biHeight);
- printf(" biPlanes %d\n", h->biPlanes);
- printf(" biBitCount %d\n", h->biBitCount);
- printf(" biCompression %ld='%.4s'\n", h->biCompression, (const char*)&h->biCompression);
- printf(" biSizeImage %ld\n", h->biSizeImage);
- printf("===========================\n");
-}
-
-FILE* streams[128];
-
-int main(int argc, char* argv[]){
- FILE *f = fopen(argc > 1 ? argv[1] : "Alice Deejay - Back In My Life.asf", "rb");
-
- if(!f){
- printf("file not found\n");
- exit(1);
- }
-
- //printf("sizeof=%d\n", sizeof(objh));
- //printf("sizeof=%d\n", sizeof(asfh));
-
- fread(&asfh, sizeof(asfh), 1, f); // header obj
- //for(i = 0; i < 16; i++)
- // printf("%02X ", asfh.objh.guid[i]);
- printf("[%s] %d (subchunks: %d)\n", chunk_type(asfh.objh.guid),
- (int) asfh.objh.size, asfh.cno);
-
- while(fread(&objh, sizeof(objh), 1, f) > 0){
- int pos = ftell(f);
- //for(i = 0; i < 16; i++)
- // printf("%02X ", objh.guid[i]);
- printf("0x%08X [%s] %d\n", pos-sizeof(objh), chunk_type(objh.guid),
- (int) objh.size);
- switch(*((unsigned int*)&objh.guid)){
- case 0xB7DC0791: // guid_stream_header
- fread(&streamh, sizeof(streamh), 1, f);
- printf("stream type: %s\n", chunk_type(streamh.type));
- printf("stream concealment: %s\n", chunk_type(streamh.concealment));
- printf("type: %d bytes, stream: %d bytes ID: %d\n",
- (int)streamh.type_size, (int)streamh.stream_size,
- (int)streamh.stream_no);
- printf("FILEPOS=0x%lX\n", ftell(f));
- // type-specific data:
- fread(buffer,streamh.type_size,1,f);
- switch(*((unsigned int*)&streamh.type)){
- case 0xF8699E40: // guid_audio_stream
- print_wave_header((WAVEFORMATEX*)buffer);
- break;
- case 0xBC19EFC0: // guid_video_stream
- print_video_header((BITMAPINFOHEADER*)&buffer[4 + 4 + 1 + 2]);
- break;
- }
- // stream-specific data:
- fread(buffer, streamh.stream_size, 1, f);
- break;
- //case 0xD6E229D1:
- // return "guid_header_2_0";
- case 0x8CABDCA1: // guid_file_header
- fread(&fileh, sizeof(fileh), 1, f);
- printf("packets: %d flags: %d pack_size: %d frame_size: %d\n",
- (int)fileh.packets, (int)fileh.flags, (int)fileh.packetsize,
- (int)fileh.frame_size);
- break;
- case 0x75b22636: // guid_data_chunk
- { int endp = pos + objh.size - sizeof(objh);
- unsigned char* packet = malloc((int)fileh.packetsize);
- int fpos;
- fseek(f, 26, SEEK_CUR);
- while((fpos = ftell(f)) < endp){
- fread(packet, (int)fileh.packetsize, 1, f);
- if(packet[0] == 0x82){
- unsigned char flags = packet[3];
- unsigned char* p = &packet[5];
- unsigned long time;
- unsigned short duration;
- int segs = 1;
- int seg;
- int padding=0;
- if(flags & 8){
- padding = p[0];
- ++p;
- } else
- if(flags & 16){
- padding = p[0] | (p[1] << 8);
- p += 2;
- }
- time = *((unsigned long*)p);
- p += 4;
- duration = *((unsigned short*)p);
- p += 2;
- if(flags & 1){
- segs = p[0] - 0x80;
- ++p;
- }
- printf("%08X: flag=%02X segs=%d pad=%d time=%ld dur=%d\n",
- fpos, flags, segs, padding, time, duration);
- for(seg = 0; seg < segs; seg++){
-