Skip to content

Commit 202c108

Browse files
committed
Add support for setting 1080p hdvideo tag
Taking a cue from DanDrusch@dbd235e thanks to @DanDrusch
1 parent 7770ff8 commit 202c108

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/main.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,10 @@ static const char *shortHelp_text =
184184
" --bpm (number) Set the tempo/bpm\n"
185185
" --albumArtist (string) Set the album artist tag\n"
186186
" --compilation (boolean) Set the compilation flag (true or false)\n"
187-
" --hdvideo (boolean) Set the hdvideo flag (true or false)\n"
187+
" --hdvideo (number) Set the hdvideo flag to one of:\n"
188+
" false or 0 for standard definition\n"
189+
" true or 1 for 720p\n"
190+
" 2 for 1080p\n"
188191
" --advisory (string*) Content advisory (*values: 'clean', "
189192
"'explicit')\n"
190193
" --stik (string*) Sets the iTunes \"stik\" atom (see "
@@ -2137,18 +2140,27 @@ int real_main(int argc, char *argv[]) {
21372140
break;
21382141
}
21392142

2140-
if (strcmp(optarg, "false") == 0 || strlen(optarg) == 0) {
2143+
if (strcmp(optarg, "false") == 0 || strlen(optarg) == 0 ||
2144+
strcmp(optarg, "0") == 0) {
21412145
APar_RemoveAtom("moov.udta.meta.ilst.hdvd.data", VERSIONED_ATOM, 0);
21422146
} else {
21432147
// compilation: [0, 0, 0, 0, boolean_value]; BUT that first uint32_t
21442148
// is already accounted for in APar_MetaData_atom_Init
21452149
AtomicInfo *hdvideoData_atom = APar_MetaData_atom_Init(
21462150
"moov.udta.meta.ilst.hdvd.data", optarg, AtomFlags_Data_UInt);
2151+
2152+
uint8_t hdvideo_value = 0;
2153+
if (strcmp(optarg, "true") == 0) {
2154+
hdvideo_value = 1;
2155+
} else {
2156+
sscanf(optarg, "%" SCNu8, &hdvideo_value);
2157+
}
2158+
21472159
APar_Unified_atom_Put(hdvideoData_atom,
21482160
NULL,
21492161
UTF8_iTunesStyle_256glyphLimited,
2150-
1,
2151-
8); // a hard coded uint8_t of: 1 is compilation
2162+
hdvideo_value,
2163+
8);
21522164
}
21532165
break;
21542166
}

0 commit comments

Comments
 (0)