diff --git a/README.md b/README.md index 751c8e8..63dbee2 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,9 @@ Setting iTunes-style metadata tags --encodedBy (string) Set the name of the Person/company who encoded the file --apID (string) Set the Account Name --cnID (number) Set the iTunes Catalog ID (see --longhelp) + --atID (number) Set the iTunes Artist ID (see --longhelp) + --plID (number) Set the iTunes Playlist ID (see --longhelp) + --cmID (number) Set the iTunes Composer ID (see --longhelp) --geID (number) Set the iTunes Genre ID (see --longhelp) --xID (string) Set the vendor-supplied iTunes xID (see --longhelp) --gapless (boolean) Set the gapless playback flag diff --git a/src/main.cpp b/src/main.cpp index 6ef3d05..7eb755e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -83,6 +83,9 @@ #define Meta_apID 'Y' #define Meta_cnID 0xC0 #define Meta_geID 0xC2 +#define Meta_atID 0xCC +#define Meta_plID 0xCD +#define Meta_cmID 0xCE #define Meta_xID 0xC3 #define Meta_storedescription 0xC4 #define Meta_EncodingTool 0xB7 @@ -217,6 +220,9 @@ static const char *shortHelp_text = "encoded the file\n" " --apID (string) Set the Account Name\n" " --cnID (number) Set the iTunes Catalog ID (see --longhelp)\n" + " --atID (number) Set the iTunes Artist ID (see --longhelp)\n" + " --plID (number) Set the iTunes Playlist ID (see --longhelp)\n" + " --cmID (number) Set the iTunes Composer ID (see --longhelp)\n" " --geID (number) Set the iTunes Genre ID (see --longhelp)\n" " --xID (string) Set the vendor-supplied iTunes xID (see " "--longhelp)\n" @@ -396,6 +402,9 @@ static const char *longHelp_text = " Alternatively you can use iMDB " "numbers, however these will not match the iTunes catalog.\n" "\n" + " --atID , (num) Set iTunes Artist ID.\n" + " --plID , (num) Set iTunes Playlist.\n" + " --cmID , (num) Set iTunes Composer ID.\n" " --geID , (num) Set iTunes Genre ID. This does not " "necessarily have to match genre.\n" " See --genre-movie-id-list and " @@ -1536,6 +1545,9 @@ int real_main(int argc, char *argv[]) { {"encodedBy", required_argument, NULL, Meta_EncodedBy}, {"apID", required_argument, NULL, Meta_apID}, {"cnID", required_argument, NULL, Meta_cnID}, + {"atID", required_argument, NULL, Meta_atID}, + {"plID", required_argument, NULL, Meta_plID}, + {"cmID", required_argument, NULL, Meta_cmID}, {"geID", required_argument, NULL, Meta_geID}, {"xID", required_argument, NULL, Meta_xID}, {"gapless", required_argument, NULL, Meta_PlayGapless}, @@ -2480,6 +2492,66 @@ int real_main(int argc, char *argv[]) { break; } + case Meta_atID: { // the iTunes Artist ID + APar_ScanAtoms(ISObasemediafile); + if (!APar_assert( + metadata_style == ITUNES_STYLE, 1, "iTunes Artist ID")) { + break; + } + + uint32_t data_value = 0; + sscanf(optarg, "%" SCNu32, &data_value); + + AtomicInfo *atIDData_atom = APar_MetaData_atom_Init( + "moov.udta.meta.ilst.atID.data", optarg, AtomFlags_Data_UInt); + APar_Unified_atom_Put(atIDData_atom, + NULL, + 0, + data_value, + 32); + break; + } + + case Meta_plID: { // the iTunes Playlist ID + APar_ScanAtoms(ISObasemediafile); + if (!APar_assert( + metadata_style == ITUNES_STYLE, 1, "iTunes Playlist ID")) { + break; + } + + uint32_t data_value = 0; + sscanf(optarg, "%" SCNu32, &data_value); + + AtomicInfo *plIDData_atom = APar_MetaData_atom_Init( + "moov.udta.meta.ilst.plID.data", optarg, AtomFlags_Data_UInt); + APar_Unified_atom_Put(plIDData_atom, + NULL, + 0, + data_value, + 64); + break; + } + + case Meta_cmID: { // the iTunes Composer ID + APar_ScanAtoms(ISObasemediafile); + if (!APar_assert( + metadata_style == ITUNES_STYLE, 1, "iTunes Composer ID")) { + break; + } + + uint32_t data_value = 0; + sscanf(optarg, "%" SCNu32, &data_value); + + AtomicInfo *cmIDData_atom = APar_MetaData_atom_Init( + "moov.udta.meta.ilst.cmID.data", optarg, AtomFlags_Data_UInt); + APar_Unified_atom_Put(cmIDData_atom, + NULL, + 0, + data_value, + 32); + break; + } + case Meta_geID: { // the iTunes Genre ID APar_ScanAtoms(ISObasemediafile); if (!APar_assert(metadata_style == ITUNES_STYLE, 1, "iTunes Genre ID")) { diff --git a/src/parsley.cpp b/src/parsley.cpp index 25dc96a..5680069 100644 --- a/src/parsley.cpp +++ b/src/parsley.cpp @@ -2545,6 +2545,26 @@ void APar_Unified_atom_Put(AtomicInfo *target_atom, break; } + case 64: { // somehow used for plID, but not cnID + target_atom->AtomicData[atom_data_pos] = + (ancillary_data & 0xff00000000000000) >> 24; + target_atom->AtomicData[atom_data_pos + 1] = + (ancillary_data & 0xff000000000000) >> 16; + target_atom->AtomicData[atom_data_pos + 2] = + (ancillary_data & 0xff0000000000) >> 8; + target_atom->AtomicData[atom_data_pos + 3] = + (ancillary_data & 0xff00000000) << 0; + target_atom->AtomicData[atom_data_pos + 4] = + (ancillary_data & 0xff000000) >> 24; + target_atom->AtomicData[atom_data_pos + 5] = + (ancillary_data & 0xff0000) >> 16; + target_atom->AtomicData[atom_data_pos + 6] = (ancillary_data & 0xff00) >> 8; + target_atom->AtomicData[atom_data_pos + 7] = (ancillary_data & 0xff) >> 0; + target_atom->AtomicLength += 8; + atom_data_pos += 8; + break; + } + default: { break; }