Support for setting the output sampling frequency.

This commit is contained in:
Moritz Bunkus 2003-09-09 19:33:40 +00:00
parent cb94453aa5
commit a3fd7dff56
2 changed files with 15 additions and 4 deletions

View File

@ -127,6 +127,7 @@ generic_packetizer_c::generic_packetizer_c(generic_reader_c *nreader,
hcodec_private_length = 0;
haudio_sampling_freq = -1.0;
haudio_output_sampling_freq = -1.0;
haudio_channels = -1;
haudio_bit_depth = -1;
@ -275,6 +276,10 @@ void generic_packetizer_c::set_audio_sampling_freq(float freq) {
haudio_sampling_freq = freq;
}
void generic_packetizer_c::set_audio_output_sampling_freq(float freq) {
haudio_output_sampling_freq = freq;
}
void generic_packetizer_c::set_audio_channels(int channels) {
haudio_channels = channels;
}
@ -462,15 +467,20 @@ void generic_packetizer_c::set_headers() {
GetChild<KaxTrackAudio>(*track_entry);
if (haudio_sampling_freq != -1.0)
*(static_cast<EbmlFloat *> (&GetChild<KaxAudioSamplingFreq>(audio))) =
*(static_cast<EbmlFloat *>(&GetChild<KaxAudioSamplingFreq>(audio))) =
haudio_sampling_freq;
if (haudio_output_sampling_freq != -1.0)
*(static_cast<EbmlFloat *>
(&GetChild<KaxAudioOutputSamplingFreq>(audio))) =
haudio_output_sampling_freq;
if (haudio_channels != -1)
*(static_cast<EbmlUInteger *> (&GetChild<KaxAudioChannels>(audio))) =
*(static_cast<EbmlUInteger *>(&GetChild<KaxAudioChannels>(audio))) =
haudio_channels;
if (haudio_bit_depth != -1)
*(static_cast<EbmlUInteger *> (&GetChild<KaxAudioBitDepth>(audio))) =
*(static_cast<EbmlUInteger *>(&GetChild<KaxAudioBitDepth>(audio))) =
haudio_bit_depth;
}

View File

@ -136,7 +136,7 @@ protected:
unsigned char *hcodec_private;
int hcodec_private_length;
float haudio_sampling_freq;
float haudio_sampling_freq, haudio_output_sampling_freq;
int haudio_channels, haudio_bit_depth;
int hvideo_pixel_width, hvideo_pixel_height;
@ -193,6 +193,7 @@ public:
virtual int64_t get_track_default_duration_ns();
virtual void set_audio_sampling_freq(float freq);
virtual void set_audio_output_sampling_freq(float freq);
virtual void set_audio_channels(int channels);
virtual void set_audio_bit_depth(int bit_depth);