Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
72 changes: 72 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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 "
Expand Down Expand Up @@ -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},
Expand Down Expand Up @@ -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")) {
Expand Down
20 changes: 20 additions & 0 deletions src/parsley.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down