read or update metadata in a media file
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
static int usage(char *exe) {
fprintf(stderr, "Usage: %s <file> [--update key value] [--delete key]\n"
"Repeat --update and --delete as many times as you need to.\n", exe);
return 1;
}
int main(int argc, char * argv[]) {
char *exe = argv[0];
char *filename;
int i;
char *arg;
char *key;
char *value;
struct GrooveTag *tag;
if (argc < 2)
return usage(exe);
filename = argv[1];
if (!file) {
fprintf(stderr, "error opening file\n");
return 1;
}
for (i = 2; i < argc; i += 1) {
arg = argv[i];
if (strcmp("--update", arg) == 0) {
if (i + 2 >= argc) {
fprintf(stderr, "--update requires 2 arguments");
return usage(exe);
}
key = argv[++i];
value = argv[++i];
} else if (strcmp("--delete", arg) == 0) {
if (i + 1 >= argc) {
fprintf(stderr, "--delete requires 1 argument");
return usage(exe);
}
key = argv[++i];
} else {
return usage(exe);
}
}
printf("channels=%d\n", audio_format.layout.channel_count);
tag = NULL;
fprintf(stderr, "error saving file\n");
return 0;
}