diff --git a/src/test_libFLAC/metadata_manip.c b/src/test_libFLAC/metadata_manip.c index 0e5c45f2ca..7d6eb52cdd 100644 --- a/src/test_libFLAC/metadata_manip.c +++ b/src/test_libFLAC/metadata_manip.c @@ -1503,14 +1503,14 @@ static FLAC__bool test_level_2_(FLAC__bool filename_based, FLAC__bool is_ogg, FL if(!test_file_(is_ogg, decoder_metadata_callback_compare_, false)) return false; - if(is_ogg) - goto end; - printf("switch file to read-write\n"); if(!change_stats_(flacfilename(is_ogg, false), /*read-only=*/false)) return false; + if(is_ogg) + goto end; + printf("create iterator\n"); if(0 == (iterator = FLAC__metadata_iterator_new())) return die_("allocating memory for iterator"); @@ -1966,13 +1966,29 @@ static FLAC__bool test_level_2_(FLAC__bool filename_based, FLAC__bool is_ogg, FL return false; end: - printf("delete chain\n"); - FLAC__metadata_chain_delete(chain); + if(is_ogg) { + /* Check whether opening a chained file fails */ + printf("create chained Ogg FLAC file\n"); + + if(0 != flac_rename(flacfilename(is_ogg, false),flacfilename(is_ogg, true))) + return false; + file_utils__ogg_serial_number++; + if(!generate_file_(/*include_extras=*/false, is_ogg)) + return false; + if(!file_utils__append_file(flacfilename(is_ogg, false), flacfilename(is_ogg, true))) + return false; + if(read_chain_(chain, flacfilename(is_ogg, false), filename_based, is_ogg)) + return die_c_("read chained Ogg instead of throwing error", FLAC__metadata_chain_status(chain)); + } if(!remove_file_(flacfilename(is_ogg, false))) return false; + printf("delete chain\n"); + + FLAC__metadata_chain_delete(chain); + return true; } diff --git a/test/test_metaflac.sh b/test/test_metaflac.sh index d9dfc1877e..44b5a4e1da 100755 --- a/test/test_metaflac.sh +++ b/test/test_metaflac.sh @@ -544,3 +544,27 @@ check_flac metaflac_test_nofilter case67 "-o --append --block-number=0" "--list" rm -f metaflac-test-files/out.meta metaflac-test-files/out1.meta + +echo $ECHO_N "Checking for --ogg support in flac ... " $ECHO_C +if flac${EXE} --ogg --no-error-on-compression-fail --silent --force-raw-format --endian=little --sign=signed --channels=1 --bps=8 --sample-rate=44100 -c $0 1>/dev/null 2>&1 ; then + has_ogg=yes; +else + has_ogg=no; +fi +echo ${has_ogg} + +if [ $has_ogg = "yes" ] ; then + if command -v oggz > /dev/null ; then + if command -v oggenc > /dev/null ; then + echo $ECHO_N "Creating merged and chained-merged files" $ECHO_C + run_flac --ogg metaflac1.flac -o small.oga + run_flac --ogg metaflac1.flac -o small2.oga + oggenc -Q --skeleton -o small-vorbis.oga metaflac1.flac + oggenc -Q --skeleton -o small2-vorbis.oga metaflac1.flac + oggz merge -o small-merged.oga small-vorbis.oga small.oga + oggz merge -o small2-merged.oga small2-vorbis.oga small2.oga + cat small2-merged.oga small-merged.oga > chained-merged.oga + + fi + fi +fi