@@ -560,6 +560,17 @@ static FLAC__bool test_stream_decoder(Layer layer, FLAC__bool is_ogg, FLAC__bool
560560 return die_s_ (0 , decoder );
561561 printf ("OK\n" );
562562
563+ printf ("testing FLAC__stream_decoder_get_link_lengths()... " );
564+ if (is_chained_ogg ) {
565+ if (FLAC__stream_decoder_get_link_lengths (decoder , NULL ) != FLAC__STREAM_DECODER_GET_LINK_LENGTHS_NOT_INDEXED )
566+ return die_s_ ("returned incorrectly" , decoder );
567+ }
568+ else { /* not chained ogg */
569+ if (FLAC__stream_decoder_get_link_lengths (decoder , NULL ) != FLAC__STREAM_DECODER_GET_LINK_LENGTHS_INVALID )
570+ return die_s_ ("returned incorrectly" , decoder );
571+ }
572+ printf ("OK\n" );
573+
563574 printf ("testing FLAC__stream_decoder_find_total_samples... " );
564575 total_samples = FLAC__stream_decoder_find_total_samples (decoder );
565576 printf ("Number of samples returned is %" PRIu64 "... " ,total_samples );
@@ -569,6 +580,22 @@ static FLAC__bool test_stream_decoder(Layer layer, FLAC__bool is_ogg, FLAC__bool
569580 return die_s_ ("returned wrong number of samples" , decoder );
570581 printf ("OK\n" );
571582
583+ if (is_chained_ogg ) {
584+ printf ("testing FLAC__stream_decoder_get_link_lengths()... " );
585+ if (layer == LAYER_STREAM ) {
586+ if (FLAC__stream_decoder_get_link_lengths (decoder , NULL ) != FLAC__STREAM_DECODER_GET_LINK_LENGTHS_NOT_INDEXED )
587+ return die_s_ ("returned incorrectly" , decoder );
588+ }
589+ else {
590+ int32_t retval = FLAC__stream_decoder_get_link_lengths (decoder , NULL );
591+ printf ("Number of links returned is %d\n" ,retval );
592+ if (retval != 2 )
593+ return die_s_ ("returned incorrectly" , decoder );
594+
595+ }
596+ printf ("OK\n" );
597+ }
598+
572599 if (layer < LAYER_FILE ) /* for LAYER_FILE, FLAC__stream_decoder_finish() closes the file */
573600 fclose (decoder_client_data .file );
574601
@@ -722,6 +749,20 @@ static FLAC__bool test_stream_decoder(Layer layer, FLAC__bool is_ogg, FLAC__bool
722749 }
723750 printf ("returned state = %u (%s)... OK\n" , state , FLAC__StreamDecoderStateString [state ]);
724751
752+ printf ("testing FLAC__stream_decoder_get_link_lengths()... " );
753+ {
754+ FLAC__uint64 * link_lengths ;
755+ int32_t retval = FLAC__stream_decoder_get_link_lengths (decoder , & link_lengths );
756+ printf ("Number of links returned is %d\n" ,retval );
757+ printf ("Number of samples is %" PRIu64 " and %" PRIu64 "\n" ,link_lengths [0 ],link_lengths [1 ]);
758+ if (retval != 2 )
759+ return die_s_ ("returned incorrectly" , decoder );
760+ free (link_lengths );
761+
762+ }
763+ printf ("OK\n" );
764+
765+
725766 printf ("testing FLAC__stream_decoder_reset()... " );
726767 if (!FLAC__stream_decoder_reset (decoder )) {
727768 state = FLAC__stream_decoder_get_state (decoder );
0 commit comments