I am decoding Flac files in to wave files . After decoding file , I am getting stream info by this code
void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data)
{
(void)decoder, (void)client_data;
/* print some stats */
if(metadata->type == FLAC__METADATA_TYPE_STREAMINFO) {
/* save for later */
total_samples = metadata->data.stream_info.total_samples;
sample_rate = metadata->data.stream_info.sample_rate;
channels = metadata->data.stream_info.channels;
bps = metadata->data.stream_info.bits_per_sample;
fprintf(stderr, "sample rate : %u Hz\n", sample_rate);
fprintf(stderr, "channels : %u\n", channels);
fprintf(stderr, "bits per sample: %u\n", bps);
#ifdef _MSC_VER
fprintf(stderr, "total samples : %I64u\n", total_samples);
#else
fprintf(stderr, "total samples : %llu\n", total_samples);
#endif
}
Now I want to fetch metadata such as album name, picture ,artist name.
For this I tried this code
FLAC__StreamMetadata *tags;
FLAC__bool success = FLAC__metadata_get_tags(infilePath, &tags);
if (success) {
printf("Got stream information");
printf("metadata %u",tags->data.vorbis_comment.num_comments);
}else {
printf("Failed to get stream information");
}
But I am getting Zero i.e 0 on console. Please help .