diff --git a/doc/html/changelog.html b/doc/html/changelog.html
index 4c412232..9dde1476 100644
--- a/doc/html/changelog.html
+++ b/doc/html/changelog.html
@@ -68,6 +68,7 @@
diff --git a/man/metaflac.sgml b/man/metaflac.sgml
index 6a15b9a1..480ede73 100644
--- a/man/metaflac.sgml
+++ b/man/metaflac.sgml
@@ -300,6 +300,48 @@ manpage.1: manpage.sgml
+
+ --import-picture =SPECIFICATION
+
+ Import a picture and store it in a PICTURE metadata block. More than one --import-picture command can be specified. The SPECIFICATION is a string whose parts are separated by | (pipe) characters. Some parts may be left empty to invoke default values. The format of SPECIFICATION is
+ [TYPE]|MIME-TYPE|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COLORS]]|FILE
+ TYPE is optional; it is a number from one of:
+ 0: Other
+ 1: 32x32 pixels 'file icon' (PNG only)
+ 2: Other file icon
+ 3: Cover (front)
+ 4: Cover (back)
+ 5: Leaflet page
+ 6: Media (e.g. label side of CD)
+ 7: Lead artist/lead performer/soloist
+ 8: Artist/performer
+ 9: Conductor
+ 10: Band/Orchestra
+ 11: Composer
+ 12: Lyricist/text writer
+ 13: Recording Location
+ 14: During recording
+ 15: During performance
+ 16: Movie/video screen capture
+ 17: A bright coloured fish
+ 18: Illustration
+ 19: Band/artist logotype
+ 20: Publisher/Studio logotype
+ The default is 3 (front cover). There may only be one picture each of type 1 and 2 in a file.
+
+ MIME-TYPE is mandatory; for best compatibility with players, use pictures with MIME type image/jpeg or image/png. The MIME type can also be --> to mean that FILE is actually a URL to an image, though this use is discouraged.
+
+ DESCRIPTION is optional; the default is an empty string.
+
+ The next part specfies the resolution and color information. If the MIME-TYPE is image/jpeg, image/png, or image/gif, you can usually leave this empty and they can be detected from the file. Otherwise, you must specify the width in pixels, height in pixels, and color depth in bits-per-pixel. If the image has indexed colors you should also specify the number of colors used. When manually specified, it is not checked against the file for accuracy.
+
+ FILE is the path to the picture file to be imported, or the URL if MIME type is -->
+
+ For example, "|image/jpeg|||../cover.jpg" will embed the JPEG file at ../cover.jpg, defaulting to type 3 (front cover) and an empty description. The resolution and color info will be retrieved from the file itself.
+
+ The specification "4|-->|CD|320x300x24/173|http://blah.blah/backcover.tiff" will embed the given URL, with type 4 (back cover), description "CD", and a manually specified resolution of 320x300, 24 bits-per-pixel, and 173 colors. The file at the URL will not be fetched; the URL itself is stored in the PICTURE metadata block.
+
+
--add-replay-gain
diff --git a/src/metaflac/Makefile.am b/src/metaflac/Makefile.am
index 05a29309..2dc68162 100644
--- a/src/metaflac/Makefile.am
+++ b/src/metaflac/Makefile.am
@@ -25,6 +25,7 @@ metaflac_SOURCES = \
main.c \
operations.c \
operations_shorthand_cuesheet.c \
+ operations_shorthand_picture.c \
operations_shorthand_seektable.c \
operations_shorthand_streaminfo.c \
operations_shorthand_vorbiscomment.c \
diff --git a/src/metaflac/Makefile.lite b/src/metaflac/Makefile.lite
index 781637e2..d7328332 100644
--- a/src/metaflac/Makefile.lite
+++ b/src/metaflac/Makefile.lite
@@ -36,6 +36,7 @@ SRCS_C = \
main.c \
operations.c \
operations_shorthand_cuesheet.c \
+ operations_shorthand_picture.c \
operations_shorthand_seektable.c \
operations_shorthand_streaminfo.c \
operations_shorthand_vorbiscomment.c \
diff --git a/src/metaflac/metaflac.dsp b/src/metaflac/metaflac.dsp
index 4856426e..eb64f023 100644
--- a/src/metaflac/metaflac.dsp
+++ b/src/metaflac/metaflac.dsp
@@ -101,6 +101,10 @@ SOURCE=.\operations_shorthand_cuesheet.c
# End Source File
# Begin Source File
+SOURCE=.\operations_shorthand_picture.c
+# End Source File
+# Begin Source File
+
SOURCE=.\operations_shorthand_seektable.c
# End Source File
# Begin Source File
diff --git a/src/metaflac/operations.c b/src/metaflac/operations.c
index 2a684836..e5e7523e 100644
--- a/src/metaflac/operations.c
+++ b/src/metaflac/operations.c
@@ -58,6 +58,9 @@ extern FLAC__bool do_shorthand_operation__vorbis_comment(const char *filename, F
/* from operations_shorthand_cuesheet.c */
extern FLAC__bool do_shorthand_operation__cuesheet(const char *filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write);
+/* from operations_shorthand_picture.c */
+extern FLAC__bool do_shorthand_operation__picture(const char *filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write);
+
FLAC__bool do_operations(const CommandLineOptions *options)
{
@@ -356,6 +359,9 @@ FLAC__bool do_shorthand_operation(const char *filename, FLAC__bool prefix_with_f
case OP__EXPORT_CUESHEET_TO:
ok = do_shorthand_operation__cuesheet(filename, chain, operation, needs_write);
break;
+ case OP__IMPORT_PICTURE:
+ ok = do_shorthand_operation__picture(filename, chain, operation, needs_write);
+ break;
case OP__ADD_SEEKPOINT:
ok = do_shorthand_operation__add_seekpoints(filename, chain, operation->argument.add_seekpoint.specification, needs_write);
break;
diff --git a/src/metaflac/operations_shorthand_picture.c b/src/metaflac/operations_shorthand_picture.c
new file mode 100644
index 00000000..a472b939
--- /dev/null
+++ b/src/metaflac/operations_shorthand_picture.c
@@ -0,0 +1,119 @@
+/* metaflac - Command-line FLAC metadata editor
+ * Copyright (C) 2001,2002,2003,2004,2005,2006 Josh Coalson
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#if HAVE_CONFIG_H
+# include
+#endif
+
+#include
+#include /* for snprintf() */
+#include
+#include "options.h"
+#include "utils.h"
+#include "FLAC/assert.h"
+#include "share/grabbag.h" /* for grabbag__picture_parse_specification */
+
+static FLAC__bool import_pic_from(const char *filename, FLAC__StreamMetadata **picture, const char *specification, FLAC__bool *needs_write);
+
+FLAC__bool do_shorthand_operation__picture(const char *filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write)
+{
+ FLAC__bool ok = true, has_type1 = false, has_type2 = false;
+ FLAC__StreamMetadata *picture = 0;
+ FLAC__Metadata_Iterator *iterator = FLAC__metadata_iterator_new();
+
+ if(0 == iterator)
+ die("out of memory allocating iterator");
+
+ FLAC__metadata_iterator_init(iterator, chain);
+
+ switch(operation->type) {
+ case OP__IMPORT_PICTURE:
+ ok = import_pic_from(filename, &picture, operation->argument.specification.value, needs_write);
+ if(ok) {
+ /* append PICTURE block */
+ while(FLAC__metadata_iterator_next(iterator))
+ ;
+ if(!FLAC__metadata_iterator_insert_block_after(iterator, picture)) {
+ print_error_with_chain_status(chain, "%s: ERROR: adding new PICTURE block to metadata", filename);
+ FLAC__metadata_object_delete(picture);
+ ok = false;
+ }
+ }
+ break;
+ default:
+ ok = false;
+ FLAC__ASSERT(0);
+ break;
+ };
+
+ /* check global PICTURE constraints (max 1 block each of type=1 and type=2) */
+ while(FLAC__metadata_iterator_prev(iterator))
+ ;
+ do {
+ FLAC__StreamMetadata *block = FLAC__metadata_iterator_get_block(iterator);
+ if(block->type == FLAC__METADATA_TYPE_PICTURE) {
+ if(block->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD) {
+ if(has_type1) {
+ print_error_with_chain_status(chain, "%s: ERROR: FLAC stream can only have one 32x32 standard icon (type=1) PICTURE block", filename);
+ ok = false;
+ }
+ has_type1 = true;
+ }
+ else if(block->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON) {
+ if(has_type2) {
+ print_error_with_chain_status(chain, "%s: ERROR: FLAC stream can only have one icon (type=2) PICTURE block", filename);
+ ok = false;
+ }
+ has_type2 = true;
+ }
+ }
+ } while(FLAC__metadata_iterator_next(iterator));
+
+
+ FLAC__metadata_iterator_delete(iterator);
+ return ok;
+}
+
+/*
+ * local routines
+ */
+
+FLAC__bool import_pic_from(const char *filename, FLAC__StreamMetadata **picture, const char *specification, FLAC__bool *needs_write)
+{
+ const char *error_message;
+
+ if(0 == specification || strlen(specification) == 0) {
+ fprintf(stderr, "%s: ERROR: empty picture specification\n", filename);
+ return false;
+ }
+
+ *picture = grabbag__picture_parse_specification(specification, &error_message);
+
+ if(0 == *picture) {
+ fprintf(stderr, "%s: ERROR: while parsing picture specification \"%s\": %s\n", filename, specification, error_message);
+ return false;
+ }
+
+ if(!FLAC__format_picture_is_legal(&(*picture)->data.picture, &error_message)) {
+ fprintf(stderr, "%s: ERROR: new PICTURE block for \"%s\" is illegal: %s\n", filename, specification, error_message);
+ return false;
+ }
+
+ *needs_write = true;
+ return true;
+}
diff --git a/src/metaflac/operations_shorthand_vorbiscomment.c b/src/metaflac/operations_shorthand_vorbiscomment.c
index 700cdb44..e28b9b11 100644
--- a/src/metaflac/operations_shorthand_vorbiscomment.c
+++ b/src/metaflac/operations_shorthand_vorbiscomment.c
@@ -33,8 +33,8 @@ static FLAC__bool remove_vc_all(const char *filename, FLAC__StreamMetadata *bloc
static FLAC__bool remove_vc_field(const char *filename, FLAC__StreamMetadata *block, const char *field_name, FLAC__bool *needs_write);
static FLAC__bool remove_vc_firstfield(const char *filename, FLAC__StreamMetadata *block, const char *field_name, FLAC__bool *needs_write);
static FLAC__bool set_vc_field(const char *filename, FLAC__StreamMetadata *block, const Argument_VcField *field, FLAC__bool *needs_write, FLAC__bool raw);
-static FLAC__bool import_vc_from(const char *filename, FLAC__StreamMetadata *block, const Argument_Filename *vc_filename, FLAC__bool *needs_write, FLAC__bool raw);
-static FLAC__bool export_vc_to(const char *filename, FLAC__StreamMetadata *block, const Argument_Filename *vc_filename, FLAC__bool raw);
+static FLAC__bool import_vc_from(const char *filename, FLAC__StreamMetadata *block, const Argument_String *vc_filename, FLAC__bool *needs_write, FLAC__bool raw);
+static FLAC__bool export_vc_to(const char *filename, FLAC__StreamMetadata *block, const Argument_String *vc_filename, FLAC__bool raw);
FLAC__bool do_shorthand_operation__vorbis_comment(const char *filename, FLAC__bool prefix_with_filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write, FLAC__bool raw)
{
@@ -280,7 +280,7 @@ FLAC__bool set_vc_field(const char *filename, FLAC__StreamMetadata *block, const
}
}
-FLAC__bool import_vc_from(const char *filename, FLAC__StreamMetadata *block, const Argument_Filename *vc_filename, FLAC__bool *needs_write, FLAC__bool raw)
+FLAC__bool import_vc_from(const char *filename, FLAC__StreamMetadata *block, const Argument_String *vc_filename, FLAC__bool *needs_write, FLAC__bool raw)
{
FILE *f;
char line[65536];
@@ -338,7 +338,7 @@ FLAC__bool import_vc_from(const char *filename, FLAC__StreamMetadata *block, con
return ret;
}
-FLAC__bool export_vc_to(const char *filename, FLAC__StreamMetadata *block, const Argument_Filename *vc_filename, FLAC__bool raw)
+FLAC__bool export_vc_to(const char *filename, FLAC__StreamMetadata *block, const Argument_String *vc_filename, FLAC__bool raw)
{
FILE *f;
FLAC__bool ret;
diff --git a/src/metaflac/options.c b/src/metaflac/options.c
index 7673740e..d24fbecc 100644
--- a/src/metaflac/options.c
+++ b/src/metaflac/options.c
@@ -80,6 +80,7 @@ struct share__option long_options_[] = {
{ "export-vc-to", 1, 0, 0 }, /* deprecated */
{ "import-cuesheet-from", 1, 0, 0 },
{ "export-cuesheet-to", 1, 0, 0 },
+ { "import-picture", 1, 0, 0 },
{ "add-seekpoint", 1, 0, 0 },
{ "add-replay-gain", 0, 0, 0 },
{ "remove-replay-gain", 0, 0, 0 },
@@ -113,7 +114,7 @@ static Argument *append_argument(CommandLineOptions *options, ArgumentType type)
static FLAC__bool parse_md5(const char *src, FLAC__byte dest[16]);
static FLAC__bool parse_uint32(const char *src, FLAC__uint32 *dest);
static FLAC__bool parse_uint64(const char *src, FLAC__uint64 *dest);
-static FLAC__bool parse_filename(const char *src, char **dest);
+static FLAC__bool parse_string(const char *src, char **dest);
static FLAC__bool parse_vorbis_comment_field_name(const char *field_ref, char **name, const char **violation);
static FLAC__bool parse_add_seekpoint(const char *in, char **out, const char **violation);
static FLAC__bool parse_add_padding(const char *in, unsigned *out);
@@ -274,6 +275,10 @@ void free_options(CommandLineOptions *options)
if(0 != op->argument.import_cuesheet_from.filename)
free(op->argument.import_cuesheet_from.filename);
break;
+ case OP__IMPORT_PICTURE:
+ if(0 != op->argument.specification.value)
+ free(op->argument.specification.value);
+ break;
case OP__ADD_SEEKPOINT:
if(0 != op->argument.add_seekpoint.specification)
free(op->argument.add_seekpoint.specification);
@@ -531,7 +536,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
fprintf(stderr, "WARNING: --%s is deprecated, the new name is --import-tags-from\n", opt);
op = append_shorthand_operation(options, OP__IMPORT_VC_FROM);
FLAC__ASSERT(0 != option_argument);
- if(!parse_filename(option_argument, &(op->argument.filename.value))) {
+ if(!parse_string(option_argument, &(op->argument.filename.value))) {
fprintf(stderr, "ERROR (--%s): missing filename\n", opt);
ok = false;
}
@@ -541,7 +546,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
fprintf(stderr, "WARNING: --%s is deprecated, the new name is --export-tags-to\n", opt);
op = append_shorthand_operation(options, OP__EXPORT_VC_TO);
FLAC__ASSERT(0 != option_argument);
- if(!parse_filename(option_argument, &(op->argument.filename.value))) {
+ if(!parse_string(option_argument, &(op->argument.filename.value))) {
fprintf(stderr, "ERROR (--%s): missing filename\n", opt);
ok = false;
}
@@ -553,7 +558,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
}
op = append_shorthand_operation(options, OP__IMPORT_CUESHEET_FROM);
FLAC__ASSERT(0 != option_argument);
- if(!parse_filename(option_argument, &(op->argument.import_cuesheet_from.filename))) {
+ if(!parse_string(option_argument, &(op->argument.import_cuesheet_from.filename))) {
fprintf(stderr, "ERROR (--%s): missing filename\n", opt);
ok = false;
}
@@ -561,11 +566,19 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
else if(0 == strcmp(opt, "export-cuesheet-to")) {
op = append_shorthand_operation(options, OP__EXPORT_CUESHEET_TO);
FLAC__ASSERT(0 != option_argument);
- if(!parse_filename(option_argument, &(op->argument.filename.value))) {
+ if(!parse_string(option_argument, &(op->argument.filename.value))) {
fprintf(stderr, "ERROR (--%s): missing filename\n", opt);
ok = false;
}
}
+ else if(0 == strcmp(opt, "import-picture")) {
+ op = append_shorthand_operation(options, OP__IMPORT_PICTURE);
+ FLAC__ASSERT(0 != option_argument);
+ if(!parse_string(option_argument, &(op->argument.specification.value))) {
+ fprintf(stderr, "ERROR (--%s): missing specification\n", opt);
+ ok = false;
+ }
+ }
else if(0 == strcmp(opt, "add-seekpoint")) {
const char *violation;
char *spec;
@@ -829,7 +842,7 @@ FLAC__bool parse_uint64(const char *src, FLAC__uint64 *dest)
return true;
}
-FLAC__bool parse_filename(const char *src, char **dest)
+FLAC__bool parse_string(const char *src, char **dest)
{
if(0 == src || strlen(src) == 0)
return false;
@@ -1024,6 +1037,9 @@ FLAC__bool parse_block_type(const char *in, Argument_BlockType *out)
else if(0 == strcmp(q, "CUESHEET")) {
out->entries[entry++].type = FLAC__METADATA_TYPE_CUESHEET;
}
+ else if(0 == strcmp(q, "PICTURE")) {
+ out->entries[entry++].type = FLAC__METADATA_TYPE_PICTURE;
+ }
else {
free(s);
return false;
diff --git a/src/metaflac/options.h b/src/metaflac/options.h
index 4fc2b8c6..a410e624 100644
--- a/src/metaflac/options.h
+++ b/src/metaflac/options.h
@@ -60,6 +60,7 @@ typedef enum {
OP__EXPORT_VC_TO,
OP__IMPORT_CUESHEET_FROM,
OP__EXPORT_CUESHEET_TO,
+ OP__IMPORT_PICTURE,
OP__ADD_SEEKPOINT,
OP__ADD_REPLAY_GAIN,
OP__ADD_PADDING,
@@ -106,7 +107,7 @@ typedef struct {
typedef struct {
char *value;
-} Argument_Filename;
+} Argument_String;
typedef struct {
unsigned num_entries;
@@ -153,7 +154,8 @@ typedef struct {
Argument_StreaminfoUInt64 streaminfo_uint64;
Argument_VcFieldName vc_field_name;
Argument_VcField vc_field;
- Argument_Filename filename;
+ Argument_String filename;
+ Argument_String specification;
Argument_ImportCuesheetFrom import_cuesheet_from;
Argument_AddSeekpoint add_seekpoint;
Argument_AddPadding add_padding;
diff --git a/src/metaflac/usage.c b/src/metaflac/usage.c
index 2ee9a4d3..39694223 100644
--- a/src/metaflac/usage.c
+++ b/src/metaflac/usage.c
@@ -131,9 +131,9 @@ int long_usage(const char *message, ...)
fprintf(out, " Unless --no-utf8-convert is specified, the contents will\n");
fprintf(out, " be converted to UTF-8 from the local charset. This can\n");
fprintf(out, " be used to store a cuesheet in a tag (e.g.\n");
- fprintf(out, " --set-tag-from-file=\"CUESHEET=image.cue\"). Do not try to\n");
- fprintf(out, " store binary data in tag fields! Use APPLICATION blocks\n");
- fprintf(out, " for that.\n");
+ fprintf(out, " --set-tag-from-file=\"CUESHEET=image.cue\"). Do not try\n");
+ fprintf(out, " to store binary data in tag fields! Use APPLICATION\n");
+ fprintf(out, " blocks for that.\n");
fprintf(out, "--import-tags-from=FILE Import tags from a file. Use '-' for stdin. Each line\n");
fprintf(out, " should be of the form NAME=VALUE. Multi-line comments\n");
fprintf(out, " are currently not supported. Specify --remove-all-tags\n");
@@ -144,11 +144,53 @@ int long_usage(const char *message, ...)
fprintf(out, " --no-utf8-convert if necessary.\n");
fprintf(out, "--import-cuesheet-from=FILE Import a cuesheet from a file. Use '-' for stdin.\n");
fprintf(out, " Only one FLAC file may be specified. A seekpoint will be\n");
- fprintf(out, " added for each index point in the cuesheet to the SEEKTABLE\n");
- fprintf(out, " unless --no-cued-seekpoints is specified.\n");
+ fprintf(out, " added for each index point in the cuesheet to the\n");
+ fprintf(out, " SEEKTABLE unless --no-cued-seekpoints is specified.\n");
fprintf(out, "--export-cuesheet-to=FILE Export CUESHEET block to a cuesheet file, suitable\n");
fprintf(out, " for use by CD authoring software. Use '-' for stdout.\n");
fprintf(out, " Only one FLAC file may be specified on the command line.\n");
+ fprintf(out, "--import-picture=SPECIFICATION Import a picture and store it in a PICTURE block.\n");
+ fprintf(out, " The SPECIFICATION is a string whose parts are separated\n");
+ fprintf(out, " by | characters. Some parts may be left empty to invoke\n");
+ fprintf(out, " default values. The specification format is:\n");
+ fprintf(out, " [TYPE]|MIME-TYPE|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COLORS]]|FILE\n");
+ fprintf(out, " TYPE is optional; it is a number from one of:\n");
+ fprintf(out, " 0: Other\n");
+ fprintf(out, " 1: 32x32 pixels 'file icon' (PNG only)\n");
+ fprintf(out, " 2: Other file icon\n");
+ fprintf(out, " 3: Cover (front)\n");
+ fprintf(out, " 4: Cover (back)\n");
+ fprintf(out, " 5: Leaflet page\n");
+ fprintf(out, " 6: Media (e.g. label side of CD)\n");
+ fprintf(out, " 7: Lead artist/lead performer/soloist\n");
+ fprintf(out, " 8: Artist/performer\n");
+ fprintf(out, " 9: Conductor\n");
+ fprintf(out, " 10: Band/Orchestra\n");
+ fprintf(out, " 11: Composer\n");
+ fprintf(out, " 12: Lyricist/text writer\n");
+ fprintf(out, " 13: Recording Location\n");
+ fprintf(out, " 14: During recording\n");
+ fprintf(out, " 15: During performance\n");
+ fprintf(out, " 16: Movie/video screen capture\n");
+ fprintf(out, " 17: A bright coloured fish\n");
+ fprintf(out, " 18: Illustration\n");
+ fprintf(out, " 19: Band/artist logotype\n");
+ fprintf(out, " 20: Publisher/Studio logotype\n");
+ fprintf(out, " The default is 3 (front cover). There may only be one picture each\n");
+ fprintf(out, " of type 1 and 2 in a file.\n");
+ fprintf(out, " MIME-TYPE is mandatory; for best compatibility with players, use\n");
+ fprintf(out, " pictures with MIME type image/jpeg or image/png. The MIME type can\n");
+ fprintf(out, " also be --> to mean that FILE is actually a URL to an image, though\n");
+ fprintf(out, " this use is discouraged.\n");
+ fprintf(out, " DESCRIPTION is optional; the default is an empty string\n");
+ fprintf(out, " The next part specfies the resolution and color information. If\n");
+ fprintf(out, " the MIME-TYPE is image/jpeg, image/png, or image/gif, you can\n");
+ fprintf(out, " usually leave this empty and they can be detected from the file.\n");
+ fprintf(out, " Otherwise, you must specify the width in pixels, height in pixels,\n");
+ fprintf(out, " and color depth in bits-per-pixel. If the image has indexed colors\n");
+ fprintf(out, " you should also specify the number of colors used.\n");
+ fprintf(out, " FILE is the path to the picture file to be imported, or the URL if\n");
+ fprintf(out, " MIME type is -->\n");
fprintf(out, "--add-replay-gain Calculates the title and album gains/peaks of the given\n");
fprintf(out, " FLAC files as if all the files were part of one album,\n");
fprintf(out, " then stores them in the VORBIS_COMMENT block. The tags\n");
diff --git a/test/metaflac-test-files/case46-expect.meta b/test/metaflac-test-files/case46-expect.meta
new file mode 100644
index 00000000..855f1843
--- /dev/null
+++ b/test/metaflac-test-files/case46-expect.meta
@@ -0,0 +1,62 @@
+METADATA block #0
+ type: 0 (STREAMINFO)
+ is last: false
+ length: 34
+ sample_rate: 8000 Hz
+ channels: 1
+ bits-per-sample: 8
+ total samples: 80000
+ MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+ type: 3 (SEEKTABLE)
+ is last: false
+ length: 18
+ seek points: 1
+ point 0: sample_number=0
+METADATA block #2
+ type: 4 (VORBIS_COMMENT)
+ is last: false
+ length: 117
+ comments: 4
+ comment[0]: f=0123456789abcdefghij
+ comment[1]: TITLE=Tittle
+ comment[2]: artist=Fartist
+ comment[3]: artist=artits
+METADATA block #3
+ type: 5 (CUESHEET)
+ is last: false
+ length: 480
+ media catalog number: 1234567890123
+ lead-in: 0
+ is CD: false
+ number of tracks: 2
+ track[0]
+ offset: 0
+ number: 1
+ ISRC:
+ type: AUDIO
+ pre-emphasis: false
+ number of index points: 1
+ index[0]
+ offset: 0
+ number: 1
+ track[1]
+ offset: 80000
+ number: 1 (LEAD-OUT)
+METADATA block #4
+ type: 6 (PICTURE)
+ is last: false
+ length: 141
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 0.gif
+ width: 24
+ height: 24
+ depth: 24
+ colors: 2
+ data length: 95
+ data:
+METADATA block #5
+ type: 1 (PADDING)
+ is last: true
+ length: 43
diff --git a/test/metaflac-test-files/case47-expect.meta b/test/metaflac-test-files/case47-expect.meta
new file mode 100644
index 00000000..359c5a16
--- /dev/null
+++ b/test/metaflac-test-files/case47-expect.meta
@@ -0,0 +1,75 @@
+METADATA block #0
+ type: 0 (STREAMINFO)
+ is last: false
+ length: 34
+ sample_rate: 8000 Hz
+ channels: 1
+ bits-per-sample: 8
+ total samples: 80000
+ MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+ type: 3 (SEEKTABLE)
+ is last: false
+ length: 18
+ seek points: 1
+ point 0: sample_number=0
+METADATA block #2
+ type: 4 (VORBIS_COMMENT)
+ is last: false
+ length: 117
+ comments: 4
+ comment[0]: f=0123456789abcdefghij
+ comment[1]: TITLE=Tittle
+ comment[2]: artist=Fartist
+ comment[3]: artist=artits
+METADATA block #3
+ type: 5 (CUESHEET)
+ is last: false
+ length: 480
+ media catalog number: 1234567890123
+ lead-in: 0
+ is CD: false
+ number of tracks: 2
+ track[0]
+ offset: 0
+ number: 1
+ ISRC:
+ type: AUDIO
+ pre-emphasis: false
+ number of index points: 1
+ index[0]
+ offset: 0
+ number: 1
+ track[1]
+ offset: 80000
+ number: 1 (LEAD-OUT)
+METADATA block #4
+ type: 6 (PICTURE)
+ is last: false
+ length: 141
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 0.gif
+ width: 24
+ height: 24
+ depth: 24
+ colors: 2
+ data length: 95
+ data:
+METADATA block #5
+ type: 6 (PICTURE)
+ is last: false
+ length: 917
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 1.gif
+ width: 12
+ height: 8
+ depth: 24
+ colors: 256
+ data length: 871
+ data:
+METADATA block #6
+ type: 1 (PADDING)
+ is last: true
+ length: 43
diff --git a/test/metaflac-test-files/case48-expect.meta b/test/metaflac-test-files/case48-expect.meta
new file mode 100644
index 00000000..71f7e073
--- /dev/null
+++ b/test/metaflac-test-files/case48-expect.meta
@@ -0,0 +1,88 @@
+METADATA block #0
+ type: 0 (STREAMINFO)
+ is last: false
+ length: 34
+ sample_rate: 8000 Hz
+ channels: 1
+ bits-per-sample: 8
+ total samples: 80000
+ MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+ type: 3 (SEEKTABLE)
+ is last: false
+ length: 18
+ seek points: 1
+ point 0: sample_number=0
+METADATA block #2
+ type: 4 (VORBIS_COMMENT)
+ is last: false
+ length: 117
+ comments: 4
+ comment[0]: f=0123456789abcdefghij
+ comment[1]: TITLE=Tittle
+ comment[2]: artist=Fartist
+ comment[3]: artist=artits
+METADATA block #3
+ type: 5 (CUESHEET)
+ is last: false
+ length: 480
+ media catalog number: 1234567890123
+ lead-in: 0
+ is CD: false
+ number of tracks: 2
+ track[0]
+ offset: 0
+ number: 1
+ ISRC:
+ type: AUDIO
+ pre-emphasis: false
+ number of index points: 1
+ index[0]
+ offset: 0
+ number: 1
+ track[1]
+ offset: 80000
+ number: 1 (LEAD-OUT)
+METADATA block #4
+ type: 6 (PICTURE)
+ is last: false
+ length: 141
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 0.gif
+ width: 24
+ height: 24
+ depth: 24
+ colors: 2
+ data length: 95
+ data:
+METADATA block #5
+ type: 6 (PICTURE)
+ is last: false
+ length: 917
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 1.gif
+ width: 12
+ height: 8
+ depth: 24
+ colors: 256
+ data length: 871
+ data:
+METADATA block #6
+ type: 6 (PICTURE)
+ is last: false
+ length: 578
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 2.gif
+ width: 16
+ height: 14
+ depth: 24
+ colors: 128
+ data length: 532
+ data:
+METADATA block #7
+ type: 1 (PADDING)
+ is last: true
+ length: 43
diff --git a/test/metaflac-test-files/case49-expect.meta b/test/metaflac-test-files/case49-expect.meta
new file mode 100644
index 00000000..1da92843
--- /dev/null
+++ b/test/metaflac-test-files/case49-expect.meta
@@ -0,0 +1,101 @@
+METADATA block #0
+ type: 0 (STREAMINFO)
+ is last: false
+ length: 34
+ sample_rate: 8000 Hz
+ channels: 1
+ bits-per-sample: 8
+ total samples: 80000
+ MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+ type: 3 (SEEKTABLE)
+ is last: false
+ length: 18
+ seek points: 1
+ point 0: sample_number=0
+METADATA block #2
+ type: 4 (VORBIS_COMMENT)
+ is last: false
+ length: 117
+ comments: 4
+ comment[0]: f=0123456789abcdefghij
+ comment[1]: TITLE=Tittle
+ comment[2]: artist=Fartist
+ comment[3]: artist=artits
+METADATA block #3
+ type: 5 (CUESHEET)
+ is last: false
+ length: 480
+ media catalog number: 1234567890123
+ lead-in: 0
+ is CD: false
+ number of tracks: 2
+ track[0]
+ offset: 0
+ number: 1
+ ISRC:
+ type: AUDIO
+ pre-emphasis: false
+ number of index points: 1
+ index[0]
+ offset: 0
+ number: 1
+ track[1]
+ offset: 80000
+ number: 1 (LEAD-OUT)
+METADATA block #4
+ type: 6 (PICTURE)
+ is last: false
+ length: 141
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 0.gif
+ width: 24
+ height: 24
+ depth: 24
+ colors: 2
+ data length: 95
+ data:
+METADATA block #5
+ type: 6 (PICTURE)
+ is last: false
+ length: 917
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 1.gif
+ width: 12
+ height: 8
+ depth: 24
+ colors: 256
+ data length: 871
+ data:
+METADATA block #6
+ type: 6 (PICTURE)
+ is last: false
+ length: 578
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 2.gif
+ width: 16
+ height: 14
+ depth: 24
+ colors: 128
+ data length: 532
+ data:
+METADATA block #7
+ type: 6 (PICTURE)
+ is last: false
+ length: 377
+ type: 4 (Cover (back))
+ MIME type: image/jpeg
+ description: 0.jpg
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 330
+ data:
+METADATA block #8
+ type: 1 (PADDING)
+ is last: true
+ length: 43
diff --git a/test/metaflac-test-files/case50-expect.meta b/test/metaflac-test-files/case50-expect.meta
new file mode 100644
index 00000000..031cab41
--- /dev/null
+++ b/test/metaflac-test-files/case50-expect.meta
@@ -0,0 +1,114 @@
+METADATA block #0
+ type: 0 (STREAMINFO)
+ is last: false
+ length: 34
+ sample_rate: 8000 Hz
+ channels: 1
+ bits-per-sample: 8
+ total samples: 80000
+ MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+ type: 3 (SEEKTABLE)
+ is last: false
+ length: 18
+ seek points: 1
+ point 0: sample_number=0
+METADATA block #2
+ type: 4 (VORBIS_COMMENT)
+ is last: false
+ length: 117
+ comments: 4
+ comment[0]: f=0123456789abcdefghij
+ comment[1]: TITLE=Tittle
+ comment[2]: artist=Fartist
+ comment[3]: artist=artits
+METADATA block #3
+ type: 5 (CUESHEET)
+ is last: false
+ length: 480
+ media catalog number: 1234567890123
+ lead-in: 0
+ is CD: false
+ number of tracks: 2
+ track[0]
+ offset: 0
+ number: 1
+ ISRC:
+ type: AUDIO
+ pre-emphasis: false
+ number of index points: 1
+ index[0]
+ offset: 0
+ number: 1
+ track[1]
+ offset: 80000
+ number: 1 (LEAD-OUT)
+METADATA block #4
+ type: 6 (PICTURE)
+ is last: false
+ length: 141
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 0.gif
+ width: 24
+ height: 24
+ depth: 24
+ colors: 2
+ data length: 95
+ data:
+METADATA block #5
+ type: 6 (PICTURE)
+ is last: false
+ length: 917
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 1.gif
+ width: 12
+ height: 8
+ depth: 24
+ colors: 256
+ data length: 871
+ data:
+METADATA block #6
+ type: 6 (PICTURE)
+ is last: false
+ length: 578
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 2.gif
+ width: 16
+ height: 14
+ depth: 24
+ colors: 128
+ data length: 532
+ data:
+METADATA block #7
+ type: 6 (PICTURE)
+ is last: false
+ length: 377
+ type: 4 (Cover (back))
+ MIME type: image/jpeg
+ description: 0.jpg
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 330
+ data:
+METADATA block #8
+ type: 6 (PICTURE)
+ is last: false
+ length: 614
+ type: 4 (Cover (back))
+ MIME type: image/jpeg
+ description: 4.jpg
+ width: 31
+ height: 47
+ depth: 24
+ colors: 0 (unindexed)
+ data length: 567
+ data:
+METADATA block #9
+ type: 1 (PADDING)
+ is last: true
+ length: 43
diff --git a/test/metaflac-test-files/case51-expect.meta b/test/metaflac-test-files/case51-expect.meta
new file mode 100644
index 00000000..78959ed3
--- /dev/null
+++ b/test/metaflac-test-files/case51-expect.meta
@@ -0,0 +1,127 @@
+METADATA block #0
+ type: 0 (STREAMINFO)
+ is last: false
+ length: 34
+ sample_rate: 8000 Hz
+ channels: 1
+ bits-per-sample: 8
+ total samples: 80000
+ MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+ type: 3 (SEEKTABLE)
+ is last: false
+ length: 18
+ seek points: 1
+ point 0: sample_number=0
+METADATA block #2
+ type: 4 (VORBIS_COMMENT)
+ is last: false
+ length: 117
+ comments: 4
+ comment[0]: f=0123456789abcdefghij
+ comment[1]: TITLE=Tittle
+ comment[2]: artist=Fartist
+ comment[3]: artist=artits
+METADATA block #3
+ type: 5 (CUESHEET)
+ is last: false
+ length: 480
+ media catalog number: 1234567890123
+ lead-in: 0
+ is CD: false
+ number of tracks: 2
+ track[0]
+ offset: 0
+ number: 1
+ ISRC:
+ type: AUDIO
+ pre-emphasis: false
+ number of index points: 1
+ index[0]
+ offset: 0
+ number: 1
+ track[1]
+ offset: 80000
+ number: 1 (LEAD-OUT)
+METADATA block #4
+ type: 6 (PICTURE)
+ is last: false
+ length: 141
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 0.gif
+ width: 24
+ height: 24
+ depth: 24
+ colors: 2
+ data length: 95
+ data:
+METADATA block #5
+ type: 6 (PICTURE)
+ is last: false
+ length: 917
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 1.gif
+ width: 12
+ height: 8
+ depth: 24
+ colors: 256
+ data length: 871
+ data:
+METADATA block #6
+ type: 6 (PICTURE)
+ is last: false
+ length: 578
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 2.gif
+ width: 16
+ height: 14
+ depth: 24
+ colors: 128
+ data length: 532
+ data:
+METADATA block #7
+ type: 6 (PICTURE)
+ is last: false
+ length: 377
+ type: 4 (Cover (back))
+ MIME type: image/jpeg
+ description: 0.jpg
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 330
+ data:
+METADATA block #8
+ type: 6 (PICTURE)
+ is last: false
+ length: 614
+ type: 4 (Cover (back))
+ MIME type: image/jpeg
+ description: 4.jpg
+ width: 31
+ height: 47
+ depth: 24
+ colors: 0 (unindexed)
+ data length: 567
+ data:
+METADATA block #9
+ type: 6 (PICTURE)
+ is last: false
+ length: 492
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 0.png
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 446
+ data:
+METADATA block #10
+ type: 1 (PADDING)
+ is last: true
+ length: 43
diff --git a/test/metaflac-test-files/case52-expect.meta b/test/metaflac-test-files/case52-expect.meta
new file mode 100644
index 00000000..56f22341
--- /dev/null
+++ b/test/metaflac-test-files/case52-expect.meta
@@ -0,0 +1,140 @@
+METADATA block #0
+ type: 0 (STREAMINFO)
+ is last: false
+ length: 34
+ sample_rate: 8000 Hz
+ channels: 1
+ bits-per-sample: 8
+ total samples: 80000
+ MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+ type: 3 (SEEKTABLE)
+ is last: false
+ length: 18
+ seek points: 1
+ point 0: sample_number=0
+METADATA block #2
+ type: 4 (VORBIS_COMMENT)
+ is last: false
+ length: 117
+ comments: 4
+ comment[0]: f=0123456789abcdefghij
+ comment[1]: TITLE=Tittle
+ comment[2]: artist=Fartist
+ comment[3]: artist=artits
+METADATA block #3
+ type: 5 (CUESHEET)
+ is last: false
+ length: 480
+ media catalog number: 1234567890123
+ lead-in: 0
+ is CD: false
+ number of tracks: 2
+ track[0]
+ offset: 0
+ number: 1
+ ISRC:
+ type: AUDIO
+ pre-emphasis: false
+ number of index points: 1
+ index[0]
+ offset: 0
+ number: 1
+ track[1]
+ offset: 80000
+ number: 1 (LEAD-OUT)
+METADATA block #4
+ type: 6 (PICTURE)
+ is last: false
+ length: 141
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 0.gif
+ width: 24
+ height: 24
+ depth: 24
+ colors: 2
+ data length: 95
+ data:
+METADATA block #5
+ type: 6 (PICTURE)
+ is last: false
+ length: 917
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 1.gif
+ width: 12
+ height: 8
+ depth: 24
+ colors: 256
+ data length: 871
+ data:
+METADATA block #6
+ type: 6 (PICTURE)
+ is last: false
+ length: 578
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 2.gif
+ width: 16
+ height: 14
+ depth: 24
+ colors: 128
+ data length: 532
+ data:
+METADATA block #7
+ type: 6 (PICTURE)
+ is last: false
+ length: 377
+ type: 4 (Cover (back))
+ MIME type: image/jpeg
+ description: 0.jpg
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 330
+ data:
+METADATA block #8
+ type: 6 (PICTURE)
+ is last: false
+ length: 614
+ type: 4 (Cover (back))
+ MIME type: image/jpeg
+ description: 4.jpg
+ width: 31
+ height: 47
+ depth: 24
+ colors: 0 (unindexed)
+ data length: 567
+ data:
+METADATA block #9
+ type: 6 (PICTURE)
+ is last: false
+ length: 492
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 0.png
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 446
+ data:
+METADATA block #10
+ type: 6 (PICTURE)
+ is last: false
+ length: 508
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 1.png
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 462
+ data:
+METADATA block #11
+ type: 1 (PADDING)
+ is last: true
+ length: 43
diff --git a/test/metaflac-test-files/case53-expect.meta b/test/metaflac-test-files/case53-expect.meta
new file mode 100644
index 00000000..ec0f6036
--- /dev/null
+++ b/test/metaflac-test-files/case53-expect.meta
@@ -0,0 +1,153 @@
+METADATA block #0
+ type: 0 (STREAMINFO)
+ is last: false
+ length: 34
+ sample_rate: 8000 Hz
+ channels: 1
+ bits-per-sample: 8
+ total samples: 80000
+ MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+ type: 3 (SEEKTABLE)
+ is last: false
+ length: 18
+ seek points: 1
+ point 0: sample_number=0
+METADATA block #2
+ type: 4 (VORBIS_COMMENT)
+ is last: false
+ length: 117
+ comments: 4
+ comment[0]: f=0123456789abcdefghij
+ comment[1]: TITLE=Tittle
+ comment[2]: artist=Fartist
+ comment[3]: artist=artits
+METADATA block #3
+ type: 5 (CUESHEET)
+ is last: false
+ length: 480
+ media catalog number: 1234567890123
+ lead-in: 0
+ is CD: false
+ number of tracks: 2
+ track[0]
+ offset: 0
+ number: 1
+ ISRC:
+ type: AUDIO
+ pre-emphasis: false
+ number of index points: 1
+ index[0]
+ offset: 0
+ number: 1
+ track[1]
+ offset: 80000
+ number: 1 (LEAD-OUT)
+METADATA block #4
+ type: 6 (PICTURE)
+ is last: false
+ length: 141
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 0.gif
+ width: 24
+ height: 24
+ depth: 24
+ colors: 2
+ data length: 95
+ data:
+METADATA block #5
+ type: 6 (PICTURE)
+ is last: false
+ length: 917
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 1.gif
+ width: 12
+ height: 8
+ depth: 24
+ colors: 256
+ data length: 871
+ data:
+METADATA block #6
+ type: 6 (PICTURE)
+ is last: false
+ length: 578
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 2.gif
+ width: 16
+ height: 14
+ depth: 24
+ colors: 128
+ data length: 532
+ data:
+METADATA block #7
+ type: 6 (PICTURE)
+ is last: false
+ length: 377
+ type: 4 (Cover (back))
+ MIME type: image/jpeg
+ description: 0.jpg
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 330
+ data:
+METADATA block #8
+ type: 6 (PICTURE)
+ is last: false
+ length: 614
+ type: 4 (Cover (back))
+ MIME type: image/jpeg
+ description: 4.jpg
+ width: 31
+ height: 47
+ depth: 24
+ colors: 0 (unindexed)
+ data length: 567
+ data:
+METADATA block #9
+ type: 6 (PICTURE)
+ is last: false
+ length: 492
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 0.png
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 446
+ data:
+METADATA block #10
+ type: 6 (PICTURE)
+ is last: false
+ length: 508
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 1.png
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 462
+ data:
+METADATA block #11
+ type: 6 (PICTURE)
+ is last: false
+ length: 338
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 2.png
+ width: 30
+ height: 20
+ depth: 24
+ colors: 7
+ data length: 292
+ data:
+METADATA block #12
+ type: 1 (PADDING)
+ is last: true
+ length: 43
diff --git a/test/metaflac-test-files/case54-expect.meta b/test/metaflac-test-files/case54-expect.meta
new file mode 100644
index 00000000..789da8b8
--- /dev/null
+++ b/test/metaflac-test-files/case54-expect.meta
@@ -0,0 +1,166 @@
+METADATA block #0
+ type: 0 (STREAMINFO)
+ is last: false
+ length: 34
+ sample_rate: 8000 Hz
+ channels: 1
+ bits-per-sample: 8
+ total samples: 80000
+ MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+ type: 3 (SEEKTABLE)
+ is last: false
+ length: 18
+ seek points: 1
+ point 0: sample_number=0
+METADATA block #2
+ type: 4 (VORBIS_COMMENT)
+ is last: false
+ length: 117
+ comments: 4
+ comment[0]: f=0123456789abcdefghij
+ comment[1]: TITLE=Tittle
+ comment[2]: artist=Fartist
+ comment[3]: artist=artits
+METADATA block #3
+ type: 5 (CUESHEET)
+ is last: false
+ length: 480
+ media catalog number: 1234567890123
+ lead-in: 0
+ is CD: false
+ number of tracks: 2
+ track[0]
+ offset: 0
+ number: 1
+ ISRC:
+ type: AUDIO
+ pre-emphasis: false
+ number of index points: 1
+ index[0]
+ offset: 0
+ number: 1
+ track[1]
+ offset: 80000
+ number: 1 (LEAD-OUT)
+METADATA block #4
+ type: 6 (PICTURE)
+ is last: false
+ length: 141
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 0.gif
+ width: 24
+ height: 24
+ depth: 24
+ colors: 2
+ data length: 95
+ data:
+METADATA block #5
+ type: 6 (PICTURE)
+ is last: false
+ length: 917
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 1.gif
+ width: 12
+ height: 8
+ depth: 24
+ colors: 256
+ data length: 871
+ data:
+METADATA block #6
+ type: 6 (PICTURE)
+ is last: false
+ length: 578
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 2.gif
+ width: 16
+ height: 14
+ depth: 24
+ colors: 128
+ data length: 532
+ data:
+METADATA block #7
+ type: 6 (PICTURE)
+ is last: false
+ length: 377
+ type: 4 (Cover (back))
+ MIME type: image/jpeg
+ description: 0.jpg
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 330
+ data:
+METADATA block #8
+ type: 6 (PICTURE)
+ is last: false
+ length: 614
+ type: 4 (Cover (back))
+ MIME type: image/jpeg
+ description: 4.jpg
+ width: 31
+ height: 47
+ depth: 24
+ colors: 0 (unindexed)
+ data length: 567
+ data:
+METADATA block #9
+ type: 6 (PICTURE)
+ is last: false
+ length: 492
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 0.png
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 446
+ data:
+METADATA block #10
+ type: 6 (PICTURE)
+ is last: false
+ length: 508
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 1.png
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 462
+ data:
+METADATA block #11
+ type: 6 (PICTURE)
+ is last: false
+ length: 338
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 2.png
+ width: 30
+ height: 20
+ depth: 24
+ colors: 7
+ data length: 292
+ data:
+METADATA block #12
+ type: 6 (PICTURE)
+ is last: false
+ length: 354
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 3.png
+ width: 30
+ height: 20
+ depth: 24
+ colors: 7
+ data length: 308
+ data:
+METADATA block #13
+ type: 1 (PADDING)
+ is last: true
+ length: 43
diff --git a/test/metaflac-test-files/case55-expect.meta b/test/metaflac-test-files/case55-expect.meta
new file mode 100644
index 00000000..89dcffec
--- /dev/null
+++ b/test/metaflac-test-files/case55-expect.meta
@@ -0,0 +1,179 @@
+METADATA block #0
+ type: 0 (STREAMINFO)
+ is last: false
+ length: 34
+ sample_rate: 8000 Hz
+ channels: 1
+ bits-per-sample: 8
+ total samples: 80000
+ MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+ type: 3 (SEEKTABLE)
+ is last: false
+ length: 18
+ seek points: 1
+ point 0: sample_number=0
+METADATA block #2
+ type: 4 (VORBIS_COMMENT)
+ is last: false
+ length: 117
+ comments: 4
+ comment[0]: f=0123456789abcdefghij
+ comment[1]: TITLE=Tittle
+ comment[2]: artist=Fartist
+ comment[3]: artist=artits
+METADATA block #3
+ type: 5 (CUESHEET)
+ is last: false
+ length: 480
+ media catalog number: 1234567890123
+ lead-in: 0
+ is CD: false
+ number of tracks: 2
+ track[0]
+ offset: 0
+ number: 1
+ ISRC:
+ type: AUDIO
+ pre-emphasis: false
+ number of index points: 1
+ index[0]
+ offset: 0
+ number: 1
+ track[1]
+ offset: 80000
+ number: 1 (LEAD-OUT)
+METADATA block #4
+ type: 6 (PICTURE)
+ is last: false
+ length: 141
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 0.gif
+ width: 24
+ height: 24
+ depth: 24
+ colors: 2
+ data length: 95
+ data:
+METADATA block #5
+ type: 6 (PICTURE)
+ is last: false
+ length: 917
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 1.gif
+ width: 12
+ height: 8
+ depth: 24
+ colors: 256
+ data length: 871
+ data:
+METADATA block #6
+ type: 6 (PICTURE)
+ is last: false
+ length: 578
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 2.gif
+ width: 16
+ height: 14
+ depth: 24
+ colors: 128
+ data length: 532
+ data:
+METADATA block #7
+ type: 6 (PICTURE)
+ is last: false
+ length: 377
+ type: 4 (Cover (back))
+ MIME type: image/jpeg
+ description: 0.jpg
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 330
+ data:
+METADATA block #8
+ type: 6 (PICTURE)
+ is last: false
+ length: 614
+ type: 4 (Cover (back))
+ MIME type: image/jpeg
+ description: 4.jpg
+ width: 31
+ height: 47
+ depth: 24
+ colors: 0 (unindexed)
+ data length: 567
+ data:
+METADATA block #9
+ type: 6 (PICTURE)
+ is last: false
+ length: 492
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 0.png
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 446
+ data:
+METADATA block #10
+ type: 6 (PICTURE)
+ is last: false
+ length: 508
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 1.png
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 462
+ data:
+METADATA block #11
+ type: 6 (PICTURE)
+ is last: false
+ length: 338
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 2.png
+ width: 30
+ height: 20
+ depth: 24
+ colors: 7
+ data length: 292
+ data:
+METADATA block #12
+ type: 6 (PICTURE)
+ is last: false
+ length: 354
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 3.png
+ width: 30
+ height: 20
+ depth: 24
+ colors: 7
+ data length: 308
+ data:
+METADATA block #13
+ type: 6 (PICTURE)
+ is last: false
+ length: 1846
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 4.png
+ width: 31
+ height: 47
+ depth: 24
+ colors: 0 (unindexed)
+ data length: 1800
+ data:
+METADATA block #14
+ type: 1 (PADDING)
+ is last: true
+ length: 43
diff --git a/test/metaflac-test-files/case56-expect.meta b/test/metaflac-test-files/case56-expect.meta
new file mode 100644
index 00000000..935019ae
--- /dev/null
+++ b/test/metaflac-test-files/case56-expect.meta
@@ -0,0 +1,192 @@
+METADATA block #0
+ type: 0 (STREAMINFO)
+ is last: false
+ length: 34
+ sample_rate: 8000 Hz
+ channels: 1
+ bits-per-sample: 8
+ total samples: 80000
+ MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+ type: 3 (SEEKTABLE)
+ is last: false
+ length: 18
+ seek points: 1
+ point 0: sample_number=0
+METADATA block #2
+ type: 4 (VORBIS_COMMENT)
+ is last: false
+ length: 117
+ comments: 4
+ comment[0]: f=0123456789abcdefghij
+ comment[1]: TITLE=Tittle
+ comment[2]: artist=Fartist
+ comment[3]: artist=artits
+METADATA block #3
+ type: 5 (CUESHEET)
+ is last: false
+ length: 480
+ media catalog number: 1234567890123
+ lead-in: 0
+ is CD: false
+ number of tracks: 2
+ track[0]
+ offset: 0
+ number: 1
+ ISRC:
+ type: AUDIO
+ pre-emphasis: false
+ number of index points: 1
+ index[0]
+ offset: 0
+ number: 1
+ track[1]
+ offset: 80000
+ number: 1 (LEAD-OUT)
+METADATA block #4
+ type: 6 (PICTURE)
+ is last: false
+ length: 141
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 0.gif
+ width: 24
+ height: 24
+ depth: 24
+ colors: 2
+ data length: 95
+ data:
+METADATA block #5
+ type: 6 (PICTURE)
+ is last: false
+ length: 917
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 1.gif
+ width: 12
+ height: 8
+ depth: 24
+ colors: 256
+ data length: 871
+ data:
+METADATA block #6
+ type: 6 (PICTURE)
+ is last: false
+ length: 578
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 2.gif
+ width: 16
+ height: 14
+ depth: 24
+ colors: 128
+ data length: 532
+ data:
+METADATA block #7
+ type: 6 (PICTURE)
+ is last: false
+ length: 377
+ type: 4 (Cover (back))
+ MIME type: image/jpeg
+ description: 0.jpg
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 330
+ data:
+METADATA block #8
+ type: 6 (PICTURE)
+ is last: false
+ length: 614
+ type: 4 (Cover (back))
+ MIME type: image/jpeg
+ description: 4.jpg
+ width: 31
+ height: 47
+ depth: 24
+ colors: 0 (unindexed)
+ data length: 567
+ data:
+METADATA block #9
+ type: 6 (PICTURE)
+ is last: false
+ length: 492
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 0.png
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 446
+ data:
+METADATA block #10
+ type: 6 (PICTURE)
+ is last: false
+ length: 508
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 1.png
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 462
+ data:
+METADATA block #11
+ type: 6 (PICTURE)
+ is last: false
+ length: 338
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 2.png
+ width: 30
+ height: 20
+ depth: 24
+ colors: 7
+ data length: 292
+ data:
+METADATA block #12
+ type: 6 (PICTURE)
+ is last: false
+ length: 354
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 3.png
+ width: 30
+ height: 20
+ depth: 24
+ colors: 7
+ data length: 308
+ data:
+METADATA block #13
+ type: 6 (PICTURE)
+ is last: false
+ length: 1846
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 4.png
+ width: 31
+ height: 47
+ depth: 24
+ colors: 0 (unindexed)
+ data length: 1800
+ data:
+METADATA block #14
+ type: 6 (PICTURE)
+ is last: false
+ length: 1862
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 5.png
+ width: 31
+ height: 47
+ depth: 24
+ colors: 0 (unindexed)
+ data length: 1816
+ data:
+METADATA block #15
+ type: 1 (PADDING)
+ is last: true
+ length: 43
diff --git a/test/metaflac-test-files/case57-expect.meta b/test/metaflac-test-files/case57-expect.meta
new file mode 100644
index 00000000..973d1395
--- /dev/null
+++ b/test/metaflac-test-files/case57-expect.meta
@@ -0,0 +1,205 @@
+METADATA block #0
+ type: 0 (STREAMINFO)
+ is last: false
+ length: 34
+ sample_rate: 8000 Hz
+ channels: 1
+ bits-per-sample: 8
+ total samples: 80000
+ MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+ type: 3 (SEEKTABLE)
+ is last: false
+ length: 18
+ seek points: 1
+ point 0: sample_number=0
+METADATA block #2
+ type: 4 (VORBIS_COMMENT)
+ is last: false
+ length: 117
+ comments: 4
+ comment[0]: f=0123456789abcdefghij
+ comment[1]: TITLE=Tittle
+ comment[2]: artist=Fartist
+ comment[3]: artist=artits
+METADATA block #3
+ type: 5 (CUESHEET)
+ is last: false
+ length: 480
+ media catalog number: 1234567890123
+ lead-in: 0
+ is CD: false
+ number of tracks: 2
+ track[0]
+ offset: 0
+ number: 1
+ ISRC:
+ type: AUDIO
+ pre-emphasis: false
+ number of index points: 1
+ index[0]
+ offset: 0
+ number: 1
+ track[1]
+ offset: 80000
+ number: 1 (LEAD-OUT)
+METADATA block #4
+ type: 6 (PICTURE)
+ is last: false
+ length: 141
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 0.gif
+ width: 24
+ height: 24
+ depth: 24
+ colors: 2
+ data length: 95
+ data:
+METADATA block #5
+ type: 6 (PICTURE)
+ is last: false
+ length: 917
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 1.gif
+ width: 12
+ height: 8
+ depth: 24
+ colors: 256
+ data length: 871
+ data:
+METADATA block #6
+ type: 6 (PICTURE)
+ is last: false
+ length: 578
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 2.gif
+ width: 16
+ height: 14
+ depth: 24
+ colors: 128
+ data length: 532
+ data:
+METADATA block #7
+ type: 6 (PICTURE)
+ is last: false
+ length: 377
+ type: 4 (Cover (back))
+ MIME type: image/jpeg
+ description: 0.jpg
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 330
+ data:
+METADATA block #8
+ type: 6 (PICTURE)
+ is last: false
+ length: 614
+ type: 4 (Cover (back))
+ MIME type: image/jpeg
+ description: 4.jpg
+ width: 31
+ height: 47
+ depth: 24
+ colors: 0 (unindexed)
+ data length: 567
+ data:
+METADATA block #9
+ type: 6 (PICTURE)
+ is last: false
+ length: 492
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 0.png
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 446
+ data:
+METADATA block #10
+ type: 6 (PICTURE)
+ is last: false
+ length: 508
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 1.png
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 462
+ data:
+METADATA block #11
+ type: 6 (PICTURE)
+ is last: false
+ length: 338
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 2.png
+ width: 30
+ height: 20
+ depth: 24
+ colors: 7
+ data length: 292
+ data:
+METADATA block #12
+ type: 6 (PICTURE)
+ is last: false
+ length: 354
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 3.png
+ width: 30
+ height: 20
+ depth: 24
+ colors: 7
+ data length: 308
+ data:
+METADATA block #13
+ type: 6 (PICTURE)
+ is last: false
+ length: 1846
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 4.png
+ width: 31
+ height: 47
+ depth: 24
+ colors: 0 (unindexed)
+ data length: 1800
+ data:
+METADATA block #14
+ type: 6 (PICTURE)
+ is last: false
+ length: 1862
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 5.png
+ width: 31
+ height: 47
+ depth: 24
+ colors: 0 (unindexed)
+ data length: 1816
+ data:
+METADATA block #15
+ type: 6 (PICTURE)
+ is last: false
+ length: 589
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 6.png
+ width: 31
+ height: 47
+ depth: 24
+ colors: 23
+ data length: 543
+ data:
+METADATA block #16
+ type: 1 (PADDING)
+ is last: true
+ length: 43
diff --git a/test/metaflac-test-files/case58-expect.meta b/test/metaflac-test-files/case58-expect.meta
new file mode 100644
index 00000000..ba448262
--- /dev/null
+++ b/test/metaflac-test-files/case58-expect.meta
@@ -0,0 +1,218 @@
+METADATA block #0
+ type: 0 (STREAMINFO)
+ is last: false
+ length: 34
+ sample_rate: 8000 Hz
+ channels: 1
+ bits-per-sample: 8
+ total samples: 80000
+ MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+ type: 3 (SEEKTABLE)
+ is last: false
+ length: 18
+ seek points: 1
+ point 0: sample_number=0
+METADATA block #2
+ type: 4 (VORBIS_COMMENT)
+ is last: false
+ length: 117
+ comments: 4
+ comment[0]: f=0123456789abcdefghij
+ comment[1]: TITLE=Tittle
+ comment[2]: artist=Fartist
+ comment[3]: artist=artits
+METADATA block #3
+ type: 5 (CUESHEET)
+ is last: false
+ length: 480
+ media catalog number: 1234567890123
+ lead-in: 0
+ is CD: false
+ number of tracks: 2
+ track[0]
+ offset: 0
+ number: 1
+ ISRC:
+ type: AUDIO
+ pre-emphasis: false
+ number of index points: 1
+ index[0]
+ offset: 0
+ number: 1
+ track[1]
+ offset: 80000
+ number: 1 (LEAD-OUT)
+METADATA block #4
+ type: 6 (PICTURE)
+ is last: false
+ length: 141
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 0.gif
+ width: 24
+ height: 24
+ depth: 24
+ colors: 2
+ data length: 95
+ data:
+METADATA block #5
+ type: 6 (PICTURE)
+ is last: false
+ length: 917
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 1.gif
+ width: 12
+ height: 8
+ depth: 24
+ colors: 256
+ data length: 871
+ data:
+METADATA block #6
+ type: 6 (PICTURE)
+ is last: false
+ length: 578
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 2.gif
+ width: 16
+ height: 14
+ depth: 24
+ colors: 128
+ data length: 532
+ data:
+METADATA block #7
+ type: 6 (PICTURE)
+ is last: false
+ length: 377
+ type: 4 (Cover (back))
+ MIME type: image/jpeg
+ description: 0.jpg
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 330
+ data:
+METADATA block #8
+ type: 6 (PICTURE)
+ is last: false
+ length: 614
+ type: 4 (Cover (back))
+ MIME type: image/jpeg
+ description: 4.jpg
+ width: 31
+ height: 47
+ depth: 24
+ colors: 0 (unindexed)
+ data length: 567
+ data:
+METADATA block #9
+ type: 6 (PICTURE)
+ is last: false
+ length: 492
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 0.png
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 446
+ data:
+METADATA block #10
+ type: 6 (PICTURE)
+ is last: false
+ length: 508
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 1.png
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 462
+ data:
+METADATA block #11
+ type: 6 (PICTURE)
+ is last: false
+ length: 338
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 2.png
+ width: 30
+ height: 20
+ depth: 24
+ colors: 7
+ data length: 292
+ data:
+METADATA block #12
+ type: 6 (PICTURE)
+ is last: false
+ length: 354
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 3.png
+ width: 30
+ height: 20
+ depth: 24
+ colors: 7
+ data length: 308
+ data:
+METADATA block #13
+ type: 6 (PICTURE)
+ is last: false
+ length: 1846
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 4.png
+ width: 31
+ height: 47
+ depth: 24
+ colors: 0 (unindexed)
+ data length: 1800
+ data:
+METADATA block #14
+ type: 6 (PICTURE)
+ is last: false
+ length: 1862
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 5.png
+ width: 31
+ height: 47
+ depth: 24
+ colors: 0 (unindexed)
+ data length: 1816
+ data:
+METADATA block #15
+ type: 6 (PICTURE)
+ is last: false
+ length: 589
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 6.png
+ width: 31
+ height: 47
+ depth: 24
+ colors: 23
+ data length: 543
+ data:
+METADATA block #16
+ type: 6 (PICTURE)
+ is last: false
+ length: 605
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 7.png
+ width: 31
+ height: 47
+ depth: 24
+ colors: 23
+ data length: 559
+ data:
+METADATA block #17
+ type: 1 (PADDING)
+ is last: true
+ length: 43
diff --git a/test/metaflac-test-files/case59-expect.meta b/test/metaflac-test-files/case59-expect.meta
new file mode 100644
index 00000000..5ec846ea
--- /dev/null
+++ b/test/metaflac-test-files/case59-expect.meta
@@ -0,0 +1,231 @@
+METADATA block #0
+ type: 0 (STREAMINFO)
+ is last: false
+ length: 34
+ sample_rate: 8000 Hz
+ channels: 1
+ bits-per-sample: 8
+ total samples: 80000
+ MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+ type: 3 (SEEKTABLE)
+ is last: false
+ length: 18
+ seek points: 1
+ point 0: sample_number=0
+METADATA block #2
+ type: 4 (VORBIS_COMMENT)
+ is last: false
+ length: 117
+ comments: 4
+ comment[0]: f=0123456789abcdefghij
+ comment[1]: TITLE=Tittle
+ comment[2]: artist=Fartist
+ comment[3]: artist=artits
+METADATA block #3
+ type: 5 (CUESHEET)
+ is last: false
+ length: 480
+ media catalog number: 1234567890123
+ lead-in: 0
+ is CD: false
+ number of tracks: 2
+ track[0]
+ offset: 0
+ number: 1
+ ISRC:
+ type: AUDIO
+ pre-emphasis: false
+ number of index points: 1
+ index[0]
+ offset: 0
+ number: 1
+ track[1]
+ offset: 80000
+ number: 1 (LEAD-OUT)
+METADATA block #4
+ type: 6 (PICTURE)
+ is last: false
+ length: 141
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 0.gif
+ width: 24
+ height: 24
+ depth: 24
+ colors: 2
+ data length: 95
+ data:
+METADATA block #5
+ type: 6 (PICTURE)
+ is last: false
+ length: 917
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 1.gif
+ width: 12
+ height: 8
+ depth: 24
+ colors: 256
+ data length: 871
+ data:
+METADATA block #6
+ type: 6 (PICTURE)
+ is last: false
+ length: 578
+ type: 3 (Cover (front))
+ MIME type: image/gif
+ description: 2.gif
+ width: 16
+ height: 14
+ depth: 24
+ colors: 128
+ data length: 532
+ data:
+METADATA block #7
+ type: 6 (PICTURE)
+ is last: false
+ length: 377
+ type: 4 (Cover (back))
+ MIME type: image/jpeg
+ description: 0.jpg
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 330
+ data:
+METADATA block #8
+ type: 6 (PICTURE)
+ is last: false
+ length: 614
+ type: 4 (Cover (back))
+ MIME type: image/jpeg
+ description: 4.jpg
+ width: 31
+ height: 47
+ depth: 24
+ colors: 0 (unindexed)
+ data length: 567
+ data:
+METADATA block #9
+ type: 6 (PICTURE)
+ is last: false
+ length: 492
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 0.png
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 446
+ data:
+METADATA block #10
+ type: 6 (PICTURE)
+ is last: false
+ length: 508
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 1.png
+ width: 30
+ height: 20
+ depth: 8
+ colors: 0 (unindexed)
+ data length: 462
+ data:
+METADATA block #11
+ type: 6 (PICTURE)
+ is last: false
+ length: 338
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 2.png
+ width: 30
+ height: 20
+ depth: 24
+ colors: 7
+ data length: 292
+ data:
+METADATA block #12
+ type: 6 (PICTURE)
+ is last: false
+ length: 354
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 3.png
+ width: 30
+ height: 20
+ depth: 24
+ colors: 7
+ data length: 308
+ data:
+METADATA block #13
+ type: 6 (PICTURE)
+ is last: false
+ length: 1846
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 4.png
+ width: 31
+ height: 47
+ depth: 24
+ colors: 0 (unindexed)
+ data length: 1800
+ data:
+METADATA block #14
+ type: 6 (PICTURE)
+ is last: false
+ length: 1862
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 5.png
+ width: 31
+ height: 47
+ depth: 24
+ colors: 0 (unindexed)
+ data length: 1816
+ data:
+METADATA block #15
+ type: 6 (PICTURE)
+ is last: false
+ length: 589
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 6.png
+ width: 31
+ height: 47
+ depth: 24
+ colors: 23
+ data length: 543
+ data:
+METADATA block #16
+ type: 6 (PICTURE)
+ is last: false
+ length: 605
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 7.png
+ width: 31
+ height: 47
+ depth: 24
+ colors: 23
+ data length: 559
+ data:
+METADATA block #17
+ type: 6 (PICTURE)
+ is last: false
+ length: 290
+ type: 5 (Leaflet page)
+ MIME type: image/png
+ description: 8.png
+ width: 32
+ height: 32
+ depth: 32
+ colors: 0 (unindexed)
+ data length: 244
+ data:
+METADATA block #18
+ type: 1 (PADDING)
+ is last: true
+ length: 43
diff --git a/test/metaflac-test-files/case60-expect.meta b/test/metaflac-test-files/case60-expect.meta
new file mode 100644
index 00000000..756be2af
--- /dev/null
+++ b/test/metaflac-test-files/case60-expect.meta
@@ -0,0 +1,49 @@
+METADATA block #0
+ type: 0 (STREAMINFO)
+ is last: false
+ length: 34
+ sample_rate: 8000 Hz
+ channels: 1
+ bits-per-sample: 8
+ total samples: 80000
+ MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+ type: 3 (SEEKTABLE)
+ is last: false
+ length: 18
+ seek points: 1
+ point 0: sample_number=0
+METADATA block #2
+ type: 4 (VORBIS_COMMENT)
+ is last: false
+ length: 117
+ comments: 4
+ comment[0]: f=0123456789abcdefghij
+ comment[1]: TITLE=Tittle
+ comment[2]: artist=Fartist
+ comment[3]: artist=artits
+METADATA block #3
+ type: 5 (CUESHEET)
+ is last: false
+ length: 480
+ media catalog number: 1234567890123
+ lead-in: 0
+ is CD: false
+ number of tracks: 2
+ track[0]
+ offset: 0
+ number: 1
+ ISRC:
+ type: AUDIO
+ pre-emphasis: false
+ number of index points: 1
+ index[0]
+ offset: 0
+ number: 1
+ track[1]
+ offset: 80000
+ number: 1 (LEAD-OUT)
+METADATA block #4
+ type: 1 (PADDING)
+ is last: true
+ length: 9610
diff --git a/test/metaflac-test-files/case61-expect.meta b/test/metaflac-test-files/case61-expect.meta
new file mode 100644
index 00000000..10a10e68
--- /dev/null
+++ b/test/metaflac-test-files/case61-expect.meta
@@ -0,0 +1,62 @@
+METADATA block #0
+ type: 0 (STREAMINFO)
+ is last: false
+ length: 34
+ sample_rate: 8000 Hz
+ channels: 1
+ bits-per-sample: 8
+ total samples: 80000
+ MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+ type: 3 (SEEKTABLE)
+ is last: false
+ length: 18
+ seek points: 1
+ point 0: sample_number=0
+METADATA block #2
+ type: 4 (VORBIS_COMMENT)
+ is last: false
+ length: 117
+ comments: 4
+ comment[0]: f=0123456789abcdefghij
+ comment[1]: TITLE=Tittle
+ comment[2]: artist=Fartist
+ comment[3]: artist=artits
+METADATA block #3
+ type: 5 (CUESHEET)
+ is last: false
+ length: 480
+ media catalog number: 1234567890123
+ lead-in: 0
+ is CD: false
+ number of tracks: 2
+ track[0]
+ offset: 0
+ number: 1
+ ISRC:
+ type: AUDIO
+ pre-emphasis: false
+ number of index points: 1
+ index[0]
+ offset: 0
+ number: 1
+ track[1]
+ offset: 80000
+ number: 1 (LEAD-OUT)
+METADATA block #4
+ type: 6 (PICTURE)
+ is last: false
+ length: 500
+ type: 1 (32x32 pixels 'file icon' (PNG only))
+ MIME type: image/png
+ description: standard_icon
+ width: 32
+ height: 32
+ depth: 24
+ colors: 0 (unindexed)
+ data length: 446
+ data:
+METADATA block #5
+ type: 1 (PADDING)
+ is last: true
+ length: 9106
diff --git a/test/metaflac-test-files/case62-expect.meta b/test/metaflac-test-files/case62-expect.meta
new file mode 100644
index 00000000..e3fb0960
--- /dev/null
+++ b/test/metaflac-test-files/case62-expect.meta
@@ -0,0 +1,75 @@
+METADATA block #0
+ type: 0 (STREAMINFO)
+ is last: false
+ length: 34
+ sample_rate: 8000 Hz
+ channels: 1
+ bits-per-sample: 8
+ total samples: 80000
+ MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+ type: 3 (SEEKTABLE)
+ is last: false
+ length: 18
+ seek points: 1
+ point 0: sample_number=0
+METADATA block #2
+ type: 4 (VORBIS_COMMENT)
+ is last: false
+ length: 117
+ comments: 4
+ comment[0]: f=0123456789abcdefghij
+ comment[1]: TITLE=Tittle
+ comment[2]: artist=Fartist
+ comment[3]: artist=artits
+METADATA block #3
+ type: 5 (CUESHEET)
+ is last: false
+ length: 480
+ media catalog number: 1234567890123
+ lead-in: 0
+ is CD: false
+ number of tracks: 2
+ track[0]
+ offset: 0
+ number: 1
+ ISRC:
+ type: AUDIO
+ pre-emphasis: false
+ number of index points: 1
+ index[0]
+ offset: 0
+ number: 1
+ track[1]
+ offset: 80000
+ number: 1 (LEAD-OUT)
+METADATA block #4
+ type: 6 (PICTURE)
+ is last: false
+ length: 500
+ type: 1 (32x32 pixels 'file icon' (PNG only))
+ MIME type: image/png
+ description: standard_icon
+ width: 32
+ height: 32
+ depth: 24
+ colors: 0 (unindexed)
+ data length: 446
+ data:
+METADATA block #5
+ type: 6 (PICTURE)
+ is last: false
+ length: 507
+ type: 2 (Other file icon)
+ MIME type: image/png
+ description: icon
+ width: 64
+ height: 64
+ depth: 24
+ colors: 0 (unindexed)
+ data length: 462
+ data:
+METADATA block #6
+ type: 1 (PADDING)
+ is last: true
+ length: 8595
diff --git a/test/test_metaflac.sh b/test/test_metaflac.sh
index 13860f33..1151878d 100755
--- a/test/test_metaflac.sh
+++ b/test/test_metaflac.sh
@@ -110,7 +110,11 @@ filter ()
# minor danger, changing vendor strings will change the length of the
# VORBIS_COMMENT block, but if we add "^ length: " to the patterns,
# we lose info about PADDING size that we need
- grep -Ev '^ vendor string: |^ m..imum .....size: ' | sed -e 's/, stream_offset.*//'
+ # grep pattern 1: remove vendor string
+ # grep pattern 2: remove minimum/maximum frame and block size from STREAMINFO
+ # grep pattern 3: remove hexdump data from PICTURE metadata blocks
+ # sed pattern 1: remove stream offset values from SEEKTABLE points
+ grep -Ev '^ vendor string: |^ m..imum .....size: |^ 0000[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]: ' | sed -e 's/, stream_offset.*//'
}
metaflac_test ()
{
@@ -289,6 +293,7 @@ run_metaflac --remove-replay-gain $flacfile
check_flac
metaflac_test case42 "--remove-replay-gain" "--list"
+# CUESHEET blocks
cs_in=cuesheets/good.000.cue
cs_out=metaflac.cue
cs_out2=metaflac2.cue
@@ -309,6 +314,55 @@ echo identical
rm -f $cs_out $cs_out2
+# PICTURE blocks
+ncase=46
+for f in \
+ 0.gif \
+ 1.gif \
+ 2.gif \
+; do
+ run_metaflac --import-picture="|image/gif|$f||pictures/$f" $flacfile
+ check_flac
+ metaflac_test "case$ncase" "--import-picture" "--list"
+ ncase=`expr $ncase + 1`
+done
+for f in \
+ 0.jpg \
+ 4.jpg \
+; do
+ run_metaflac --import-picture="4|image/jpeg|$f||pictures/$f" $flacfile
+ check_flac
+ metaflac_test "case$ncase" "--import-picture" "--list"
+ ncase=`expr $ncase + 1`
+done
+for f in \
+ 0.png \
+ 1.png \
+ 2.png \
+ 3.png \
+ 4.png \
+ 5.png \
+ 6.png \
+ 7.png \
+ 8.png \
+; do
+ run_metaflac --import-picture="5|image/png|$f||pictures/$f" $flacfile
+ check_flac
+ metaflac_test "case$ncase" "--import-picture" "--list"
+ ncase=`expr $ncase + 1`
+done
+[ $ncase == 60 ] || die "expected case# to be 60"
+run_metaflac --remove --block-type=PICTURE $flacfile
+check_flac
+metaflac_test case60 "--remove --block-type=PICTURE" "--list"
+run_metaflac --import-picture="1|image/png|standard_icon|32x32x24|pictures/0.png" $flacfile
+check_flac
+metaflac_test case61 "--import-picture" "--list"
+run_metaflac --import-picture="2|image/png|icon|64x64x24|pictures/1.png" $flacfile
+check_flac
+metaflac_test case62 "--import-picture" "--list"
+
+# UNKNOWN blocks
echo -n "Testing FLAC file with unknown metadata... "
cp -p metaflac.flac.in $flacfile
# remove the VORBIS_COMMENT block so vendor string changes don't interfere with the comparison:
@@ -316,6 +370,6 @@ run_metaflac --remove --block-type=VORBIS_COMMENT --dont-use-padding $flacfile
cmp $flacfile metaflac.flac.ok || die "ERROR, $flacfile and metaflac.flac.ok differ"
echo OK
-rm -f out.flac out.meta
+rm -f $testdir/out.flac $testdir/out.meta
exit 0