Support for moving the bits per sample from the CodecID to KaxAudioBitDepth.

This commit is contained in:
Moritz Bunkus 2003-04-29 16:23:12 +00:00
parent d732f2e826
commit b29c9d619f
5 changed files with 20 additions and 13 deletions

View File

@ -13,7 +13,7 @@
/*!
\file
\version \$Id: matroska.h,v 1.7 2003/04/24 20:36:45 mosu Exp $
\version \$Id: matroska.h,v 1.8 2003/04/29 16:23:12 mosu Exp $
\brief Definitions for the various Codec IDs
\author Moritz Bunkus <moritz @ bunkus.org>
*/
@ -25,7 +25,7 @@
#define MKV_A_MP3 "A_MPEGLAYER3"
#define MKV_A_AC3 "A_AC3"
#define MKV_A_PCM16 "A_PCMLIN16"
#define MKV_A_PCM "A_PCMLIN"
#define MKV_A_VORBIS "A_VORBIS"
#define MKV_A_ACM "A_MS/ACM"

View File

@ -13,7 +13,7 @@
/*!
\file
\version \$Id: p_pcm.cpp,v 1.15 2003/04/21 08:29:50 mosu Exp $
\version \$Id: p_pcm.cpp,v 1.16 2003/04/29 16:23:12 mosu Exp $
\brief PCM output module
\author Moritz Bunkus <moritz @ bunkus.org>
*/
@ -49,10 +49,6 @@ pcm_packetizer_c::pcm_packetizer_c(unsigned long nsamples_per_sec,
bytes_output = 0;
remaining_sync = 0;
if (bits_per_sample != 16)
throw error_c("Error: pcm_packetizer: Only files with 16bits per sample "
"are supported at the moment.\n");
set_header();
}
@ -66,9 +62,10 @@ void pcm_packetizer_c::set_header() {
set_serial(-1);
set_track_type(track_audio);
set_codec_id(MKV_A_PCM16);
set_codec_id(MKV_A_PCM);
set_audio_sampling_freq((float)samples_per_sec);
set_audio_channels(channels);
set_audio_bit_depth(bits_per_sample);
if (ti->default_track)
set_as_default_track('a');

View File

@ -13,7 +13,7 @@
/*!
\file
\version \$Id: pr_generic.cpp,v 1.26 2003/04/27 09:14:47 mosu Exp $
\version \$Id: pr_generic.cpp,v 1.27 2003/04/29 16:23:12 mosu Exp $
\brief functions common for all readers/packetizers
\author Moritz Bunkus <moritz @ bunkus.org>
*/
@ -49,6 +49,7 @@ generic_packetizer_c::generic_packetizer_c(track_info_t *nti) throw(error_c):
haudio_sampling_freq = -1.0;
haudio_channels = -1;
haudio_bit_depth = -1;
hvideo_pixel_width = -1;
hvideo_pixel_height = -1;
@ -137,6 +138,10 @@ void generic_packetizer_c::set_audio_channels(int channels) {
haudio_channels = channels;
}
void generic_packetizer_c::set_audio_bit_depth(int bit_depth) {
haudio_bit_depth = bit_depth;
}
void generic_packetizer_c::set_video_pixel_width(int width) {
hvideo_pixel_width = width;
}
@ -256,6 +261,10 @@ void generic_packetizer_c::set_header() {
*(static_cast<EbmlUInteger *> (&GetChild<KaxAudioChannels>(audio))) =
haudio_channels;
if (haudio_bit_depth != -1)
*(static_cast<EbmlUInteger *> (&GetChild<KaxAudioBitDepth>(audio))) =
haudio_bit_depth;
}
}

View File

@ -13,7 +13,7 @@
/*!
\file
\version \$Id: pr_generic.h,v 1.27 2003/04/24 20:36:45 mosu Exp $
\version \$Id: pr_generic.h,v 1.28 2003/04/29 16:23:12 mosu Exp $
\brief class definition for the generic reader and packetizer
\author Moritz Bunkus <moritz @ bunkus.org>
*/
@ -74,7 +74,7 @@ protected:
int hcodec_private_length;
float haudio_sampling_freq;
int haudio_channels;
int haudio_channels, haudio_bit_depth;
int hvideo_pixel_width, hvideo_pixel_height;
float hvideo_frame_rate;
@ -108,6 +108,7 @@ public:
virtual void set_audio_sampling_freq(float freq);
virtual void set_audio_channels(int channels);
virtual void set_audio_bit_depth(int bit_depth);
virtual void set_video_pixel_width(int width);
virtual void set_video_pixel_height(int height);

View File

@ -13,7 +13,7 @@
/*!
\file
\version \$Id: r_matroska.cpp,v 1.13 2003/04/28 07:27:27 mosu Exp $
\version \$Id: r_matroska.cpp,v 1.14 2003/04/29 16:23:12 mosu Exp $
\brief Matroska reader
\author Moritz Bunkus <moritz @ bunkus.org>
*/
@ -326,7 +326,7 @@ void mkv_reader_c::verify_tracks() {
t->a_formattag = 0x0055;
else if (!strcmp(t->codec_id, MKV_A_AC3))
t->a_formattag = 0x2000;
else if (!strcmp(t->codec_id, MKV_A_PCM16))
else if (!strcmp(t->codec_id, MKV_A_PCM))
t->a_formattag = 0x0001;
else if (!strcmp(t->codec_id, MKV_A_VORBIS)) {
if (t->private_data == NULL) {