README++, --version, new build dir structure

This commit is contained in:
Mathias Panzenböck 2024-04-20 19:50:02 +02:00
parent 16c70d299d
commit 8110c3c845
6 changed files with 218 additions and 183 deletions

2
.gitignore vendored
View File

@ -1,5 +1,5 @@
.*
*~
*.o
build*
/build
/tmp

View File

@ -3,9 +3,12 @@ TARGET=$(shell uname|tr '[A-Z]' '[a-z]')$(shell getconf LONG_BIT)
INCLUDE=
LIBDIRS=
LIBS=
MANPAGE=mediaextract.1.gz
APPNAME=mediaextract
BINEXT=
MANPAGE=$(APPNAME).1.gz
PLATFORM=posix
BUILDDIR=build-$(TARGET)
BUILD_TYPE=debug
BUILDDIR=build/$(TARGET)/$(BUILD_TYPE)
OBJ=\
$(BUILDDIR)/mediaextract.o \
$(BUILDDIR)/mediaextract_$(PLATFORM).o \
@ -35,14 +38,12 @@ OBJ=\
$(BUILDDIR)/text.o
CC=gcc
LD=$(CC)
CFLAGS+= -Wall -Werror -Wextra -std=gnu99 -O2 -g $(INCLUDE) $(LIBDIRS) -D_FILE_OFFSET_BITS=64
CFLAGS+= -Wall -Werror -Wextra -std=gnu99 $(INCLUDE) $(LIBDIRS) -D_FILE_OFFSET_BITS=64
WINDOWS_LIBS=-lws2_32
APPNAME=mediaextract
BIN=$(BUILDDIR)/$(APPNAME)
RELEASE=0
BIN=$(BUILDDIR)/$(APPNAME)$(BINEXT)
ifeq ($(RELEASE),1)
CFLAGS+=-O3
ifeq ($(BUILD_TYPE),release)
CFLAGS+=-O2
else
CFLAGS+=-g
endif
@ -53,7 +54,7 @@ ifeq ($(TARGET),win32)
CFLAGS+=-DWINVER=0x500 -m32
LDFLAGS+=-m32
LIBS=$(WINDOWS_LIBS)
APPNAME=mediaextract.exe
BINEXT=.exe
else
ifeq ($(TARGET),win64)
PLATFORM=windows
@ -61,7 +62,7 @@ ifeq ($(TARGET),win64)
CFLAGS+=-DWINVER=0x500 -m64
LDFLAGS+=-m64
LIBS=$(WINDOWS_LIBS)
APPNAME=mediaextract.exe
BINEXT=.exe
else
ifeq ($(TARGET),linux32)
CFLAGS+=-pedantic -m32
@ -131,8 +132,8 @@ $(BUILDDIR)/%.o: src/%.c src/mediaextract.h src/riff.h
ifeq ($(PLATFORM),posix)
install: $(PREFIX)/bin/$(APPNAME) $(PREFIX)/share/man/man1/$(MANPAGE)
$(BUILDDIR)/$(MANPAGE): src/ManPageIncludeFile
help2man $(BIN) --no-discard-stderr --no-info -n "extracts media files that are embedded within other files" -S "Mathias Panzenböck" -i src/ManPageIncludeFile|sed '/the default set of formats/s/^/.TP\n/'|sed '/the default set of formats/{N;s/.TP//}'|sed -r '/([)]|files)$ /a .TP' >$(BUILDDIR)/$(APPNAME).1
$(BUILDDIR)/$(MANPAGE): src/ManPageIncludeFile $(BIN)
PATH=$(BUILDDIR):$(PATH) help2man $(APPNAME) --no-info -n "extracts media files that are embedded within other files" -S "Mathias Panzenböck" -i src/ManPageIncludeFile >$(BUILDDIR)/$(APPNAME).1
gzip -kf $(BUILDDIR)/$(APPNAME).1
$(PREFIX)/share/man/man1/$(MANPAGE): $(BUILDDIR)/$(APPNAME).1

227
README.md
View File

@ -6,19 +6,27 @@ Extract media files that are embedded within other files.
Setup
-----
make builddir
make
sudo make install PREFIX=/usr
```bash
make builddir
make BUILD_TYPE=release
sudo make install BUILD_TYPE=release PREFIX=/usr
```
The default `BUILD_TYPE` is `debug`.
Cross compile for Windows (uses `i686-w64-mingw32-gcc`):
make TARGET=win32 builddir
make TARGET=win32
```bash
make TARGET=win32 builddir
make TARGET=win32
```
Or (uses `x86_64-w64-mingw32-gcc`):
make TARGET=win64 builddir
make TARGET=win64
```bash
make TARGET=win64 builddir
make TARGET=win64
```
**Warning:** This program only works correctly on platforms that allow unaligned
memory access (e.g. x86 and ARM, although it might be quite slow on the latter).
@ -37,20 +45,26 @@ big enough. 64bit binaries can read up to 8 EB (8 Exabytes) at once.
Usage
-----
mediaextract [option...] <filename> [<filename> ...]
```plain
mediaextract [option...] <filename> [<filename> ...]
```
### Examples
Extract .wav, .aif and .ogg (might actually be .ogg, .opus or .ogm) files from
the file `data.bin` and store them in the `~/Music` directory.
mediaextract -f riff,aiff,ogg -o ~/Music data.bin
```bash
mediaextract -f riff,aiff,ogg -o ~/Music data.bin
```
This will then write files like such into `~/Music`:
data.bin_00000000.ogg
data.bin_00FFB2E3.wav
data.bin_01F3CD45.aif
```plain
data.bin_00000000.ogg
data.bin_00FFB2E3.wav
data.bin_01F3CD45.aif
```
The hexadecimal number in the written file names give the offset where in the
data file the audio file was found.
@ -61,109 +75,118 @@ unambigiously detect MPEG files. These false positives are however usually very
small, so using the `--min-size` option one can hopefully extract only real MPEG
files.
mediaextract -f id3v2,mpg123 --min-size=100k -o ~/Music data.bin
```bash
mediaextract -f id3v2,mpg123 --min-size=100k -o ~/Music data.bin
```
### Options
-h, --help Print this help message.
-q, --quiet Do not print status messages.
-s, --simulate Don't write any output files.
-o, --output=DIR Directory where extracted files should be written. (default: ".")
-a, --filename=FORMAT Format string for the file names.
(default: "{filename}_{offset}.{ext}")
```plain
-h, --help Print this help message.
-v, --version Print program version.
-q, --quiet Do not print status messages.
-s, --simulate Don't write any output files.
-o, --output=DIR Directory where extracted files should be written. (default: ".")
-a, --filename=FORMAT Format string for the file names.
(default: "{filename}_{offset}.{ext}")
Supported variables:
filename Filename of the extracted archive.
offset Offset within the archive in hexadecimal.
index 0-based index of the extracted file in decimal.
size Size of the extracted file in decimal.
ext Extension associated with the filetype of the
extracted file.
Supported variables:
-i, --offset=OFFSET Start processing at byte OFFSET. (default: 0)
-n, --length=LENGTH Only process LENGTH bytes.
(default and maximum: 8 EB)
-m, --min-size=SIZE Minumum size of extracted files (skip smaller). (default: 0)
-x, --max-size=SIZE Maximum size of extracted files (skip larger).
(default and maximum: 16 EB)
filename Filename of the extracted archive.
offset Offset within the archive in hexadecimal.
index 0-based index of the extracted file in decimal.
size Size of the extracted file in decimal.
ext Extension associated with the filetype of the
extracted file.
The last character of OFFSET, LENGTH and SIZE may be one of the
following:
B (or none) for Bytes
k for Kilobytes (units of 1024 Bytes)
M for Megabytes (units of 1024 Kilobytes)
G for Gigabytes (units of 1024 Megabytes)
T for Terabytes (units of 1024 Gigabytes)
P for Petabytes (units of 1024 Terabytes)
E for Exabytes (units of 1024 Petabytes)
-i, --offset=OFFSET Start processing at byte OFFSET. (default: 0)
-n, --length=LENGTH Only process LENGTH bytes.
(default and maximum: 8 EB)
-m, --min-size=SIZE Minumum size of extracted files (skip smaller). (default: 0)
-x, --max-size=SIZE Maximum size of extracted files (skip larger).
(default and maximum: 16 EB)
The special value "max" selects the maximum alowed value.
The last character of OFFSET, LENGTH and SIZE may be one of the
following:
B (or none) for Bytes
k for Kilobytes (units of 1024 Bytes)
M for Megabytes (units of 1024 Kilobytes)
G for Gigabytes (units of 1024 Megabytes)
T for Terabytes (units of 1024 Gigabytes)
P for Petabytes (units of 1024 Terabytes)
E for Exabytes (units of 1024 Petabytes)
-f, --formats=FORMATS Comma separated list of formats (file magics) to extract.
The special value "max" selects the maximum alowed value.
Supported formats:
all all supported formats
default the default set of formats (AIFF, ASF, AU, BINK, BMP,
GIF, ID3v2, IT, JPEG, MPEG 1, MPEG PS, MIDI, MP4, Ogg,
PNG, RIFF, S3M, SMK, XM, XMIDI)
audio all audio files (AIFF, ASF, AU, ID3v2, IT, MIDI, MP4,
Ogg, RIFF, S3M, XM, XMIDI)
text all text files (ASCII, UTF-8, UTF-16LE, UTF-16BE,
UTF-32LE, UTF-32BE)
image all image files (BMP, PNG, JPEG, GIF)
mpeg all safe mpeg files (MPEG 1, MPEG PS, ID3v2)
tracker all tracker files (MOD, S3M, IT, XM)
video all video files (ASF, BINK, MP4, RIFF, SMK)
-f, --formats=FORMATS Comma separated list of formats (file magics) to extract.
aiff big-endian (Apple) wave files
ascii 7-bit ASCII files (only printable characters)
asf Advanced Systems Format files (also WMA and WMV)
au Sun Microsystems audio file format (.au or .snd)
bink BINK files
bmp Windows Bitmap files
gif Graphics Interchange Format files
id3v2 MPEG layer 1/2/3 files with ID3v2 tags
it ImpulseTracker files
jpeg JPEG Interchange Format files
midi MIDI files
mod Noisetracker/Soundtracker/Protracker Module files
mpg123 MPEG layer 1/2/3 files (MP1, MP2, MP3)
mpeg1 MPEG 1 System Streams
mpegps MPEG 2 Program Streams
mpegts MPEG 2 Transport Streams
mp4 MP4 files (M4A, M4V, 3GPP etc.)
ogg Ogg files (Vorbis, Opus, Theora, etc.)
png Portable Network Graphics files
riff Resource Interchange File Format files (ANI, AVI, MMM,
PAL, RDI, RMI, SGT, STY, WAV, WEBP and more)
s3m ScreamTracker III files
smk Smaker files
utf-8 7-bit ASCII and UTF-8 files (only printable code points)
utf-16be big-endian UTF-16 files (only printable code points)
utf-16le little-endian UTF-16 files (only printable code points)
utf-32be big-endian UTF-32 files (only printable code points)
utf-32le little-endian UTF-32 files (only printable code points)
xm Extended Module files
xmidi XMIDI files
Supported formats:
WARNING: Because MP1/2/3 files do not have a nice file magic, using
the 'mpg123' format may cause *a lot* of false positives. Nowadays
MP3 files usually have an ID3v2 tag at the start, so using the
'id3v2' format is the better option anyway.
all all supported formats
default the default set of formats (AIFF, ASF, AU, AVIF, BINK,
BMP, GIF, HEIF, ID3v2, IT, JPEG, MPEG 1, MPEG PS,
MIDI, MP4, Ogg, PNG, RIFF, S3M, SMK, XM, XMIDI)
audio all audio files (AIFF, ASF, AU, ID3v2, IT, MIDI, MP4,
Ogg, RIFF, S3M, XM, XMIDI)
text all text files (ASCII, UTF-8, UTF-16LE, UTF-16BE,
UTF-32LE, UTF-32BE)
image all image files (BMP, PNG, JPEG, GIF, AVIF, HEIF)
mpeg all safe mpeg files (MPEG 1, MPEG PS, ID3v2)
tracker all tracker files (MOD, S3M, IT, XM)
video all video files (ASF, BINK, MP4, RIFF, SMK)
The detection accuracy of MOD files is not much better and of MPEG TS
it is even worse and thus the 'mpg123', 'mpegts' and 'mod' formats
are per default disabled.
avif AVIF image files
aiff big-endian (Apple) wave files
ascii 7-bit ASCII files (only printable characters)
asf Advanced Systems Format files (also WMA and WMV)
au Sun Microsystems audio file format (.au or .snd)
bink BINK files
bmp Windows Bitmap files
gif Graphics Interchange Format files
heif HEIF images files
id3v2 MPEG layer 1/2/3 files with ID3v2 tags
it ImpulseTracker files
jpeg JPEG Interchange Format files
midi MIDI files
mod Noisetracker/Soundtracker/Protracker Module files
mpg123 MPEG layer 1/2/3 files (MP1, MP2, MP3)
mpeg1 MPEG 1 System Streams
mpegps MPEG 2 Program Streams
mpegts MPEG 2 Transport Streams
mp4 MP4 files (M4A, M4V, 3GPP etc.)
ogg Ogg files (Vorbis, Opus, Theora, etc.)
png Portable Network Graphics files
riff Resource Interchange File Format files (ANI, AVI, MMM,
PAL, RDI, RMI, SGT, STY, WAV, WEBP and more)
s3m ScreamTracker III files
smk Smaker files
utf-8 7-bit ASCII and UTF-8 files (only printable code points)
utf-16be big-endian UTF-16 files (only printable code points)
utf-16le little-endian UTF-16 files (only printable code points)
utf-32be big-endian UTF-32 files (only printable code points)
utf-32le little-endian UTF-32 files (only printable code points)
xm Extended Module files
xmidi XMIDI files
NOTE: When using only the 'mpg123' format but not 'id3v2' any ID3v2
tag will be stripped. ID3v1 tags will still be kept.
WARNING: Because MP1/2/3 files do not have a nice file magic, using
the 'mpg123' format may cause *a lot* of false positives. Nowadays
MP3 files usually have an ID3v2 tag at the start, so using the
'id3v2' format is the better option anyway.
NOTE: The 'text' format might detect too much bogus text in UTF-16 or
UTF-32 encodings. I recommend to use 'utf-8' or 'ascii' instead, if
you can.
The detection accuracy of MOD files is not much better and of MPEG TS
it is even worse and thus the 'mpg123', 'mpegts' and 'mod' formats
are per default disabled.
If '-' is written before a format name the format will be
removed from the set of formats to extract. E.g. extract
everything except tracker files:
NOTE: When using only the 'mpg123' format but not 'id3v2' any ID3v2
tag will be stripped. ID3v1 tags will still be kept.
mediaextract --formats=all,-tracker data.bin
NOTE: The 'text' format might detect too much bogus text in UTF-16 or
UTF-32 encodings. I recommend to use 'utf-8' or 'ascii' instead, if
you can.
If '-' is written before a format name the format will be
removed from the set of formats to extract. E.g. extract
everything except tracker files:
mediaextract --formats=all,-tracker data.bin
```

View File

@ -9,8 +9,9 @@ git clone . "$pkg/source"
rm -rf "$pkg/source/.git" "$pkg/source/.gitignore"
mv "$pkg/source/README.md" "$pkg"
for target in linux32 linux64 win32 win64; do
builddir=build-$target
make TARGET=$target "-j$(nproc)"
builddir=build/$target/release
make TARGET=$target BUILD_TYPE=release builddir
make TARGET=$target BUILD_TYPE=release "-j$(nproc)"
if [[ -d "$builddir" ]]; then
mkdir "$pkg/$builddir"

View File

@ -90,7 +90,7 @@
#define ALL_FORMATS (TRACKER_FORMATS | AUDIO_FORMATS | VIDEO_FORMATS | MPEG_FORMATS | IMAGE_FORMATS | TEXT_FORMATS | ASCII)
#define DEFAULT_FORMATS (OGG | RIFF | AIFF | MP4 | ID3v2 | MIDI | XMIDI | S3M | IT | XM | ASF | BINK | AU | SMK | BMP | PNG | JPEG | GIF | MPEG1 | MPEGPS | MPEGVS | AVIF | HEIF)
static int usage(int argc, char **argv);
static int usage(FILE *stream, int argc, char **argv);
static const char *basename(const char *path);
static int parse_formats(const char *sformats, file_format *formats);
static int parse_size_p(const char *str, uint64_t *size);
@ -98,7 +98,7 @@ static int parse_size(const char *str, size_t *size);
static int parse_offset(const char *str, uint64_t *size);
static const char *format_size(uint64_t in, double *out);
static int usage(int argc, char **argv)
static int usage(FILE *stream, int argc, char **argv)
{
const char *progname = argc <= 0 ? "mediaextract" : argv[0];
double default_length = 0;
@ -106,7 +106,7 @@ static int usage(int argc, char **argv)
const char *length_unit = format_size((SIZE_MAX>>1), &default_length);
const char *size_unit = format_size(SIZE_MAX, &default_size);
fprintf(stderr,
fprintf(stream,
"mediaextract - extracts media files that are embedded within other files\n"
"\n"
"Usage:\n"
@ -114,6 +114,7 @@ static int usage(int argc, char **argv)
"\n"
"Options:\n"
" -h, --help Print this help message.\n"
" -v, --version Print program version.\n"
" -q, --quiet Do not print status messages.\n"
" -s, --simulate Don't write any output files.\n"
" -o, --output=DIR Directory where extracted files should be written. (default: \".\")\n"
@ -121,12 +122,13 @@ static int usage(int argc, char **argv)
" (default: \"{filename}_{offset}.{ext}\")\n"
"\n"
" Supported variables:\n"
" filename Filename of the extracted archive.\n"
" offset Offset within the archive in hexadecimal.\n"
" index 0-based index of the extracted file in decimal.\n"
" size Size of the extracted file in decimal.\n"
" ext Extension associated with the filetype of the\n"
" extracted file.\n"
"\n"
" filename Filename of the extracted archive.\n"
" offset Offset within the archive in hexadecimal.\n"
" index 0-based index of the extracted file in decimal.\n"
" size Size of the extracted file in decimal.\n"
" ext Extension associated with the filetype of the\n"
" extracted file.\n"
"\n"
" -i, --offset=OFFSET Start processing at byte OFFSET. (default: 0)\n"
" -n, --length=LENGTH Only process LENGTH bytes.\n"
@ -135,7 +137,7 @@ static int usage(int argc, char **argv)
#if !defined(__LP64__) && !defined(_WIN64)
fprintf(stderr,
fprintf(stream,
"\n"
" NOTE: This program is compiled as a 32bit binary. This means\n"
" the maximum amount of bytes that can be processed at once are\n"
@ -149,77 +151,78 @@ static int usage(int argc, char **argv)
#endif
fprintf(stderr,
fprintf(stream,
" -m, --min-size=SIZE Minumum size of extracted files (skip smaller). (default: 0)\n"
" -x, --max-size=SIZE Maximum size of extracted files (skip larger).\n"
" (default and maximum: %g %s)\n"
"\n"
" The last character of OFFSET, LENGTH and SIZE may be one of the\n"
" following:\n"
" B (or none) for Bytes\n"
" k for Kilobytes (units of 1024 Bytes)\n"
" M for Megabytes (units of 1024 Kilobytes)\n"
" G for Gigabytes (units of 1024 Megabytes)\n"
" T for Terabytes (units of 1024 Gigabytes)\n"
" P for Petabytes (units of 1024 Terabytes)\n"
" E for Exabytes (units of 1024 Petabytes)\n"
" B (or none) for Bytes\n"
" k for Kilobytes (units of 1024 Bytes)\n"
" M for Megabytes (units of 1024 Kilobytes)\n"
" G for Gigabytes (units of 1024 Megabytes)\n"
" T for Terabytes (units of 1024 Gigabytes)\n"
" P for Petabytes (units of 1024 Terabytes)\n"
" E for Exabytes (units of 1024 Petabytes)\n"
"\n"
" The special value \"max\" selects the maximum alowed value.\n"
"\n",
default_size, size_unit);
fprintf(stderr,
fprintf(stream,
" -f, --formats=FORMATS Comma separated list of formats (file magics) to extract.\n"
"\n"
" Supported formats:\n"
" all all supported formats\n"
" default the default set of formats (AIFF, ASF, AU, AVIF, BINK,\n"
" BMP, GIF, HEIF, ID3v2, IT, JPEG, MPEG 1, MPEG PS,\n"
" MIDI, MP4, Ogg, PNG, RIFF, S3M, SMK, XM, XMIDI)\n"
" audio all audio files (AIFF, ASF, AU, ID3v2, IT, MIDI, MP4,\n"
" Ogg, RIFF, S3M, XM, XMIDI)\n"
" text all text files (ASCII, UTF-8, UTF-16LE, UTF-16BE,\n"
" UTF-32LE, UTF-32BE)\n"
" image all image files (BMP, PNG, JPEG, GIF, AVIF, HEIF)\n"
" mpeg all safe mpeg files (MPEG 1, MPEG PS, ID3v2)\n"
" tracker all tracker files (MOD, S3M, IT, XM)\n"
" video all video files (ASF, BINK, MP4, RIFF, SMK)\n"
"\n"
" avif AVIF image files\n"
" aiff big-endian (Apple) wave files\n"
" ascii 7-bit ASCII files (only printable characters)\n"
" asf Advanced Systems Format files (also WMA and WMV)\n"
" au Sun Microsystems audio file format (.au or .snd)\n"
" bink BINK files\n"
" bmp Windows Bitmap files\n"
" gif Graphics Interchange Format files\n"
" heif HEIF images files\n"
" id3v2 MPEG layer 1/2/3 files with ID3v2 tags\n"
" it ImpulseTracker files\n"
" jpeg JPEG Interchange Format files\n"
" midi MIDI files\n"
" mod Noisetracker/Soundtracker/Protracker Module files\n"
" mpg123 MPEG layer 1/2/3 files (MP1, MP2, MP3)\n"
" mpeg1 MPEG 1 System Streams\n"
" mpegps MPEG 2 Program Streams\n"
" mpegts MPEG 2 Transport Streams\n"
" mp4 MP4 files (M4A, M4V, 3GPP etc.)\n"
" ogg Ogg files (Vorbis, Opus, Theora, etc.)\n"
" png Portable Network Graphics files\n"
" riff Resource Interchange File Format files (ANI, AVI, MMM,\n"
" PAL, RDI, RMI, SGT, STY, WAV, WEBP and more)\n"
" s3m ScreamTracker III files\n"
" smk Smaker files\n"
" utf-8 7-bit ASCII and UTF-8 files (only printable code points)\n"
" utf-16be big-endian UTF-16 files (only printable code points)\n"
" utf-16le little-endian UTF-16 files (only printable code points)\n"
" utf-32be big-endian UTF-32 files (only printable code points)\n"
" utf-32le little-endian UTF-32 files (only printable code points)\n"
" xm Extended Module files\n"
" xmidi XMIDI files\n"
" all all supported formats\n"
" default the default set of formats (AIFF, ASF, AU, AVIF, BINK,\n"
" BMP, GIF, HEIF, ID3v2, IT, JPEG, MPEG 1, MPEG PS,\n"
" MIDI, MP4, Ogg, PNG, RIFF, S3M, SMK, XM, XMIDI)\n"
" audio all audio files (AIFF, ASF, AU, ID3v2, IT, MIDI, MP4,\n"
" Ogg, RIFF, S3M, XM, XMIDI)\n"
" text all text files (ASCII, UTF-8, UTF-16LE, UTF-16BE,\n"
" UTF-32LE, UTF-32BE)\n"
" image all image files (BMP, PNG, JPEG, GIF, AVIF, HEIF)\n"
" mpeg all safe mpeg files (MPEG 1, MPEG PS, ID3v2)\n"
" tracker all tracker files (MOD, S3M, IT, XM)\n"
" video all video files (ASF, BINK, MP4, RIFF, SMK)\n"
"\n"
" avif AVIF image files\n"
" aiff big-endian (Apple) wave files\n"
" ascii 7-bit ASCII files (only printable characters)\n"
" asf Advanced Systems Format files (also WMA and WMV)\n"
" au Sun Microsystems audio file format (.au or .snd)\n"
" bink BINK files\n"
" bmp Windows Bitmap files\n"
" gif Graphics Interchange Format files\n"
" heif HEIF images files\n"
" id3v2 MPEG layer 1/2/3 files with ID3v2 tags\n"
" it ImpulseTracker files\n"
" jpeg JPEG Interchange Format files\n"
" midi MIDI files\n"
" mod Noisetracker/Soundtracker/Protracker Module files\n"
" mpg123 MPEG layer 1/2/3 files (MP1, MP2, MP3)\n"
" mpeg1 MPEG 1 System Streams\n"
" mpegps MPEG 2 Program Streams\n"
" mpegts MPEG 2 Transport Streams\n"
" mp4 MP4 files (M4A, M4V, 3GPP etc.)\n"
" ogg Ogg files (Vorbis, Opus, Theora, etc.)\n"
" png Portable Network Graphics files\n"
" riff Resource Interchange File Format files (ANI, AVI, MMM,\n"
" PAL, RDI, RMI, SGT, STY, WAV, WEBP and more)\n"
" s3m ScreamTracker III files\n"
" smk Smaker files\n"
" utf-8 7-bit ASCII and UTF-8 files (only printable code points)\n"
" utf-16be big-endian UTF-16 files (only printable code points)\n"
" utf-16le little-endian UTF-16 files (only printable code points)\n"
" utf-32be big-endian UTF-32 files (only printable code points)\n"
" utf-32le little-endian UTF-32 files (only printable code points)\n"
" xm Extended Module files\n"
" xmidi XMIDI files\n"
"\n");
fprintf(stderr,
fprintf(stream,
" WARNING: Because MP1/2/3 files do not have a nice file magic, using\n"
" the 'mpg123' format may cause *a lot* of false positives. Nowadays\n"
" MP3 files usually have an ID3v2 tag at the start, so using the\n"
@ -1066,6 +1069,7 @@ const struct option long_options[] = {
{"length", required_argument, 0, 'n' },
{"offset", required_argument, 0, 'i' },
{"simulate", no_argument, 0, 's' },
{"version", no_argument, 0, 'v' },
{0, 0, 0, 0 }
};
@ -1090,7 +1094,7 @@ int main(int argc, char **argv)
size_t sumsize = 0;
struct stat st;
while ((opt = getopt_long(argc, argv, "f:o:a:hqm:x:n:i:s", long_options, NULL)) != -1)
while ((opt = getopt_long(argc, argv, "f:o:a:hqm:x:n:i:sv", long_options, NULL)) != -1)
{
switch (opt)
{
@ -1113,7 +1117,7 @@ int main(int argc, char **argv)
break;
case 'h':
return usage(argc, argv);
return usage(stdout, argc, argv);
case 'q':
options.quiet = 1;
@ -1150,6 +1154,10 @@ int main(int argc, char **argv)
options.simulate = 1;
break;
case 'v':
printf("%s\n", MEDIAEXTRACT_VERSION);
return 0;
default:
fprintf(stderr, SEE_HELP);
return 255;

View File

@ -178,6 +178,8 @@
#endif
#define MEDIAEXTRACT_VERSION "1.2.0"
typedef uint64_t file_format;
#define NONE ((uint64_t) 0)