shithub: opus-tools

Download patch

ref: 188a446e597de63b7320b11fcf2d09310149854e
parent: 4bc33cf6957e672678a4f231d800e0e73bebf846
author: Ralph Giles <giles@mozilla.com>
date: Tue Jan 15 09:32:22 EST 2013

Add more standard tag switches to opusenc.

This adds --album, --date, and --genre to opusenc, to simplify
adding these common tags. This now matches the subset oggenc
offers direct command line switches for.

--- a/man/opusenc.1
+++ b/man/opusenc.1
@@ -54,8 +54,17 @@
 .I author
 ] [
 .B --title
-.I track title
+.I 'track title'
 ] [
+.B --album
+.I 'album title'
+] [
+.B --date
+.I YYYY-MM-DD
+] [
+.B --genre
+.I genre
+] [
 .B --raw
 ] [
 .B --raw-bits
@@ -137,11 +146,20 @@
 See the vorbis-comment specification for well known tag names:
 http://www.xiph.org/vorbis/doc/v-comment.html
 .IP "--artist artist"
-Set the artist comment field in the comments to
+Set the artist comment field to
 .I artist
 .IP "--title title"
 Set the track title comment field to
 .I title
+.IP "--album album"
+Set the album or collection title field to
+.I album
+.IP "--date YYYY-MM-DD"
+Set the date comment field to
+.I YYYY-MM-DD
+.IP "--genre genre"
+Set the genre comment field to
+.I genre
 .IP "--raw"
 Raw (headerless) PCM input
 .IP "--raw-bits N"
--- a/src/opusenc.c
+++ b/src/opusenc.c
@@ -151,6 +151,9 @@
   printf("                      This may be used multiple times\n");
   printf(" --artist           Author of this track\n");
   printf(" --title            Title for this track\n");
+  printf(" --album            Album or collection this track belongs to\n");
+  printf(" --date             Date for this track\n");
+  printf(" --genre            Genre for this track\n");
   printf("\nInput options:\n");
   printf(" --raw              Raw input\n");
   printf(" --raw-bits n       Set bits/sample for raw input (default: 16)\n");
@@ -210,6 +213,9 @@
     {"comment", required_argument, NULL, 0},
     {"artist", required_argument, NULL, 0},
     {"title", required_argument, NULL, 0},
+    {"album", required_argument, NULL, 0},
+    {"date", required_argument, NULL, 0},
+    {"genre", required_argument, NULL, 0},
     {"discard-comments", no_argument, NULL, 0},
     {0, 0, 0, 0}
   };
@@ -472,6 +478,12 @@
         } else if(strcmp(long_options[option_index].name,"title")==0){
           save_cmd=0;
           comment_add(&inopt.comments, &inopt.comments_length, "title", optarg);
+        } else if(strcmp(long_options[option_index].name,"album")==0){
+          comment_add(&inopt.comments, &inopt.comments_length, "album", optarg);
+        } else if(strcmp(long_options[option_index].name,"date")==0){
+          comment_add(&inopt.comments, &inopt.comments_length, "date", optarg);
+        } else if(strcmp(long_options[option_index].name,"genre")==0){
+          comment_add(&inopt.comments, &inopt.comments_length, "genre", optarg);
         } else if(strcmp(long_options[option_index].name,"discard-comments")==0){
           inopt.copy_comments=0;
         }