mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-02-17 19:19:16 +01:00
Add text/playlist tags in test
This commit is contained in:
parent
55bff5984f
commit
151ea81128
@ -1,6 +1,7 @@
|
|||||||
#define POSIXLY_CORRECT
|
#define POSIXLY_CORRECT
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include "../src/vgmstream.h"
|
#include "../src/vgmstream.h"
|
||||||
|
#include "../src/plugins.h"
|
||||||
#include "../src/util.h"
|
#include "../src/util.h"
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
@ -52,6 +53,7 @@ static void usage(const char * name) {
|
|||||||
" -g: decode and print oggenc command line to encode as OGG\n"
|
" -g: decode and print oggenc command line to encode as OGG\n"
|
||||||
" -b: decode and print batch variable commands\n"
|
" -b: decode and print batch variable commands\n"
|
||||||
" -r: output a second file after resetting (for testing)\n"
|
" -r: output a second file after resetting (for testing)\n"
|
||||||
|
" -t file: print if tags are found in file\n"
|
||||||
, name);
|
, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,6 +61,7 @@ static void usage(const char * name) {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
char * infilename;
|
char * infilename;
|
||||||
char * outfilename;
|
char * outfilename;
|
||||||
|
char * tag_filename;
|
||||||
int ignore_loop;
|
int ignore_loop;
|
||||||
int force_loop;
|
int force_loop;
|
||||||
int really_force_loop;
|
int really_force_loop;
|
||||||
@ -96,7 +99,7 @@ static int parse_config(cli_config *cfg, int argc, char ** argv) {
|
|||||||
opterr = 0;
|
opterr = 0;
|
||||||
|
|
||||||
/* read config */
|
/* read config */
|
||||||
while ((opt = getopt(argc, argv, "o:l:f:d:ipPcmxeLEFrgb2:s:")) != -1) {
|
while ((opt = getopt(argc, argv, "o:l:f:d:ipPcmxeLEFrgb2:s:t:")) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'o':
|
case 'o':
|
||||||
cfg->outfilename = optarg;
|
cfg->outfilename = optarg;
|
||||||
@ -156,6 +159,9 @@ static int parse_config(cli_config *cfg, int argc, char ** argv) {
|
|||||||
case 's':
|
case 's':
|
||||||
cfg->stream_index = atoi(optarg);
|
cfg->stream_index = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 't':
|
||||||
|
cfg->tag_filename= optarg;
|
||||||
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
fprintf(stderr, "Unknown option -%c found\n", optopt);
|
fprintf(stderr, "Unknown option -%c found\n", optopt);
|
||||||
goto fail;
|
goto fail;
|
||||||
@ -323,6 +329,8 @@ void apply_fade(sample * buf, VGMSTREAM * vgmstream, int to_get, int i, int len_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ************************************************************ */
|
||||||
|
|
||||||
int main(int argc, char ** argv) {
|
int main(int argc, char ** argv) {
|
||||||
VGMSTREAM * vgmstream = NULL;
|
VGMSTREAM * vgmstream = NULL;
|
||||||
FILE * outfile = NULL;
|
FILE * outfile = NULL;
|
||||||
@ -403,6 +411,27 @@ int main(int argc, char ** argv) {
|
|||||||
|
|
||||||
/* print file info (or batch commands, depending on config) */
|
/* print file info (or batch commands, depending on config) */
|
||||||
print_info(vgmstream, &cfg);
|
print_info(vgmstream, &cfg);
|
||||||
|
|
||||||
|
/* print tags info */
|
||||||
|
if (cfg.tag_filename) {
|
||||||
|
VGMSTREAM_TAGS tag;
|
||||||
|
|
||||||
|
STREAMFILE *tagFile = open_stdio_streamfile(cfg.tag_filename);
|
||||||
|
if (!tagFile) {
|
||||||
|
fprintf(stderr,"tag file %s not found\n",cfg.tag_filename);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("tags:\n");
|
||||||
|
vgmstream_tags_reset(&tag, cfg.infilename);
|
||||||
|
while ( vgmstream_tags_next_tag(&tag, tagFile)) {
|
||||||
|
printf("- '%s'='%s'\n", tag.key, tag.val);
|
||||||
|
}
|
||||||
|
|
||||||
|
close_streamfile(tagFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* prints done */
|
||||||
if (cfg.print_metaonly) {
|
if (cfg.print_metaonly) {
|
||||||
if (!cfg.play_sdtout)
|
if (!cfg.play_sdtout)
|
||||||
fclose(outfile);
|
fclose(outfile);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user