shithub: aacenc

Download patch

ref: 63c7c06747fbfa3dae13610e5a449f2f17bea7f1
parent: ddc184c244169848a27e0bf3b0dbf7a1d3e8fcc4
author: knik <knik@users.sourceforge.net>
date: Fri Jul 21 10:42:57 EDT 2017

fixed --track and --disc options

--- a/frontend/main.c
+++ b/frontend/main.c
@@ -114,8 +114,8 @@
     "  --genre X\tSet genre to X\n"
     "  --album X\tSet album to X\n"
     "  --compilation\tSet compilation\n"
-    "  --track X\tSet track to X (number/total)\n"
-    "  --disc X\tSet disc to X (number/total)\n"
+    "  --track X\tSet track number to X\n"
+    "  --disc X\tSet disc number to X\n"
     "  --year X\tSet year to X\n"
     "  --cover-art X\tRead cover art from file X\n"
     "  --comment X\tSet comment to X\n"
@@ -177,8 +177,8 @@
     "  --genre X\tSet genre to X\n"
     "  --album X\tSet album/performer to X\n"
     "  --compilation\tMark as compilation\n"
-    "  --track X\tSet track to X (number/total)\n"
-    "  --disc X\tSet disc to X (number/total)\n"
+    "  --track X\tSet track number to X\n"
+    "  --disc X\tSet disc number to X\n"
     "  --year X\tSet year to X\n"
     "  --cover-art X\tRead cover art from file X\n"
     "\t\tSupported image formats are GIF, JPEG, and PNG.\n"
@@ -423,8 +423,8 @@
 
     FILE *outfile = NULL;
 
-    unsigned int ntracks = 0, trackno = 0;
-    unsigned int ndiscs = 0, discno = 0;
+    unsigned int trackno = 0;
+    unsigned int discno = 0;
     uint8_t compilation = 0;
     const char *artist = NULL, *title = NULL, *album = NULL, *year = NULL,
         *genre = NULL, *comment = NULL, *composer = NULL;
@@ -599,10 +599,10 @@
             album = optarg;
             break;
         case TRACK_FLAG:
-            sscanf(optarg, "%d/%d", &trackno, &ntracks);
+            trackno = atoi(optarg);
             break;
         case DISC_FLAG:
-            sscanf(optarg, "%d/%d", &discno, &ndiscs);
+            discno = atoi(optarg);
             break;
         case COMPILATION_FLAG:
             compilation = 0x1;
@@ -810,9 +810,9 @@
         return 1;
     }
 
-    if (container != MP4_CONTAINER && (ntracks || trackno || artist ||
+    if (container != MP4_CONTAINER && (trackno || artist ||
                                        title || album || year || art ||
-                                       genre || comment || discno || ndiscs ||
+                                       genre || comment || discno ||
                                        composer || compilation))
     {
         fprintf(stderr, "Metadata requires MP4 output!\n");
--- a/frontend/mp4write.c
+++ b/frontend/mp4write.c
@@ -595,13 +595,15 @@
     }
     if (mp4config.tag.trackno)
     {
-        size += tagu32("trkn", 1);
+        size += tagu32("trkn", 2);
         size += u32out(mp4config.tag.trackno);
+        size += u32out(0);
     }
     if (mp4config.tag.discno)
     {
-        size += tagu32("disk", 1);
+        size += tagu32("disk", 2);
         size += u32out(mp4config.tag.discno);
+        size += u32out(0);
     }
     if (mp4config.tag.year)
         size += tagtxt("\xa9" "day", mp4config.tag.year);