7 #include "packager/media/base/audio_stream_info.h"
11 #include "packager/base/logging.h"
12 #include "packager/base/strings/string_number_conversions.h"
13 #include "packager/base/strings/stringprintf.h"
14 #include "packager/media/base/limits.h"
20 std::string AudioCodecToString(AudioCodec audio_codec) {
21 switch (audio_codec) {
45 NOTIMPLEMENTED() <<
"Unknown Audio Codec: " << audio_codec;
46 return "UnknownAudioCodec";
55 const std::string& codec_string,
56 const std::string& language,
59 uint32_t sampling_frequency,
60 uint64_t seek_preroll_ns,
61 uint64_t codec_delay_ns,
64 const uint8_t* extra_data,
65 size_t extra_data_size,
77 sample_bits_(sample_bits),
78 num_channels_(num_channels),
79 sampling_frequency_(sampling_frequency),
80 seek_preroll_ns_(seek_preroll_ns),
81 codec_delay_ns_(codec_delay_ns),
82 max_bitrate_(max_bitrate),
83 avg_bitrate_(avg_bitrate) {}
85 AudioStreamInfo::~AudioStreamInfo() {}
88 return codec_ != kUnknownAudioCodec && num_channels_ != 0 &&
89 num_channels_ <= limits::kMaxChannels && sample_bits_ > 0 &&
90 sample_bits_ <= limits::kMaxBitsPerSample &&
91 sampling_frequency_ > 0 &&
92 sampling_frequency_ <= limits::kMaxSampleRate;
96 std::string str = base::StringPrintf(
97 "%s codec: %s\n sample_bits: %d\n num_channels: %d\n "
98 "sampling_frequency: %d\n language: %s\n",
100 sample_bits_, num_channels_, sampling_frequency_, language().c_str());
101 if (seek_preroll_ns_ != 0) {
102 base::StringAppendF(&str,
" seek_preroll_ns: %" PRIu64
"d\n",
105 if (codec_delay_ns_ != 0) {
106 base::StringAppendF(&str,
" codec_delay_ns: %" PRIu64
"d\n",
113 uint8_t audio_object_type) {
120 return "mp4a.40." + base::UintToString(audio_object_type);
138 NOTIMPLEMENTED() <<
"Codec: " << codec;