Пример #1
0
	void get_info(file_info & p_info,abort_callback & p_abort) {
		t_filesize size = m_file->get_size(p_abort);
		if (size != filesize_invalid) {
			//file size is known, let's set length
			p_info.set_length(audio_math::samples_to_time( size / raw_total_sample_width, raw_sample_rate));
		}
		//note that the values below should be based on contents of the file itself, NOT on user-configurable variables for an example. To report info that changes independently from file contents, use get_dynamic_info/get_dynamic_info_track instead.
		p_info.info_set_int("samplerate",raw_sample_rate);
		p_info.info_set_int("channels",raw_channels);
		p_info.info_set_int("bitspersample",raw_bits_per_sample);
		p_info.info_set("encoding","lossless");
		p_info.info_set_bitrate((raw_bits_per_sample * raw_channels * raw_sample_rate + 500 /* rounding for bps to kbps*/ ) / 1000 /* bps to kbps */);
		
	}
Пример #2
0
 void get_info(file_info &info, abort_callback &abort)
 {
     m_demuxer->get_metadata(info);
     auto asbd = m_demuxer->format().asbd;
     info.set_length(m_demuxer->duration() / asbd.mSampleRate);
     info.info_set_bitrate(m_demuxer->bitrate());
     info.info_set_int("samplerate", asbd.mSampleRate);
     uint32_t channel_mask = m_demuxer->format().channel_mask;
     std::string channels;
     if (channel_mask) {
         channels = Helpers::describe_channels(channel_mask);
         info.info_set("channels", channels.c_str());
     } else {
         info.info_set_int("channels", asbd.mChannelsPerFrame);
     }
     m_decoder->get_info(info);
 }