audioparams: cache channel_count
This commit is contained in:
@@ -141,7 +141,7 @@ rational AudioParams::bytes_to_time(const qint64 &bytes) const
|
||||
|
||||
int AudioParams::channel_count() const
|
||||
{
|
||||
return av_get_channel_layout_nb_channels(channel_layout());
|
||||
return channel_count_;
|
||||
}
|
||||
|
||||
int AudioParams::bytes_per_sample_per_channel() const
|
||||
|
||||
@@ -66,6 +66,9 @@ public:
|
||||
format_(kFormatInvalid)
|
||||
{
|
||||
set_default_footage_parameters();
|
||||
|
||||
// Cache channel count
|
||||
channel_count_ = av_get_channel_layout_nb_channels(channel_layout());
|
||||
}
|
||||
|
||||
AudioParams(const int& sample_rate, const uint64_t& channel_layout, const Format& format) :
|
||||
@@ -75,6 +78,9 @@ public:
|
||||
{
|
||||
set_default_footage_parameters();
|
||||
timebase_ = sample_rate_as_time_base();
|
||||
|
||||
// Cache channel count
|
||||
channel_count_ = av_get_channel_layout_nb_channels(this->channel_layout());
|
||||
}
|
||||
|
||||
int sample_rate() const
|
||||
@@ -201,6 +207,8 @@ private:
|
||||
|
||||
uint64_t channel_layout_;
|
||||
|
||||
int channel_count_;
|
||||
|
||||
Format format_;
|
||||
|
||||
// Footage-specific
|
||||
|
||||
Reference in New Issue
Block a user