@@ -160,7 +160,7 @@ int main(int argc, argv_t* argv[]) {
160
160
int referer = 0 ;
161
161
int insecure = 0 ;
162
162
int debug = 0 ;
163
- int disable_autoselect = 0 ;
163
+ int disable_autoselection = 0 ;
164
164
165
165
int select_all_medias = 0 ;
166
166
int exists = 0 ;
@@ -603,6 +603,13 @@ int main(int argc, argv_t* argv[]) {
603
603
}
604
604
605
605
debug = 1 ;
606
+ } else if (strcmp (argument -> key , "disable-autoselection" ) == 0 ) {
607
+ if (disable_autoselection ) {
608
+ err = M3U8ERR_CLI_DUPLICATE_ARGUMENT ;
609
+ goto end ;
610
+ }
611
+
612
+ disable_autoselection = 1 ;
606
613
} else {
607
614
err = M3U8ERR_CLI_ARGUMENT_INVALID ;
608
615
goto end ;
@@ -718,28 +725,30 @@ int main(int argc, argv_t* argv[]) {
718
725
goto end ;
719
726
}
720
727
} else {
721
- fprintf (stderr , "+ warning: you did not explicitly select a variant stream; auto selecting the best available\n" );
722
-
723
- for (index = stream .offset ; index -- > 0 ;) {
724
- struct M3U8StreamItem * const item = & stream .items [index ];
725
- struct M3U8VariantStream * const variant_stream = item -> item ;
728
+ if (!disable_autoselection ) {
729
+ fprintf (stderr , "+ warning: you did not explicitly select a variant stream; autoselecting the best available\n" );
726
730
727
- if (item -> type != M3U8_STREAM_VARIANT_STREAM ) {
728
- continue ;
731
+ for (index = stream .offset ; index -- > 0 ;) {
732
+ struct M3U8StreamItem * const item = & stream .items [index ];
733
+ struct M3U8VariantStream * const variant_stream = item -> item ;
734
+
735
+ if (item -> type != M3U8_STREAM_VARIANT_STREAM ) {
736
+ continue ;
737
+ }
738
+
739
+ if (variant_stream -> tag -> type != M3U8_TAG_EXT_X_STREAM_INF ) {
740
+ continue ;
741
+ }
742
+
743
+ selected_streams .items [selected_streams .offset ++ ] = & variant_stream -> stream ;
744
+
745
+ break ;
729
746
}
730
747
731
- if (variant_stream -> tag -> type != M3U8_TAG_EXT_X_STREAM_INF ) {
732
- continue ;
748
+ if (selected_streams .offset == 0 ) {
749
+ err = M3U8ERR_CLI_SELECT_STREAM_NO_AVAILABLE_STREAMS ;
750
+ goto end ;
733
751
}
734
-
735
- selected_streams .items [selected_streams .offset ++ ] = & variant_stream -> stream ;
736
-
737
- break ;
738
- }
739
-
740
- if (selected_streams .offset == 0 ) {
741
- err = M3U8ERR_CLI_SELECT_STREAM_NO_AVAILABLE_STREAMS ;
742
- goto end ;
743
752
}
744
753
}
745
754
@@ -794,7 +803,7 @@ int main(int argc, argv_t* argv[]) {
794
803
No media have been explicitly selected; let's select the ones attached to
795
804
that variant stream.
796
805
*/
797
- if (selected_medias .offset == 0 && !disable_autoselect ) {
806
+ if (selected_medias .offset == 0 && !disable_autoselection ) {
798
807
const size_t offset = selected_streams .offset ;
799
808
800
809
for (index = 0 ; index < offset ; index ++ ) {
0 commit comments