File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
src/AvTranscoder/data/decoded Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,11 @@ AudioFrame::~AudioFrame()
69
69
freeData ();
70
70
}
71
71
72
+ size_t AudioFrame::getBytesPerSample () const
73
+ {
74
+ return av_get_bytes_per_sample (getSampleFormat ());
75
+ }
76
+
72
77
size_t AudioFrame::getSize () const
73
78
{
74
79
if (getSampleFormat () == AV_SAMPLE_FMT_NONE)
@@ -77,14 +82,14 @@ size_t AudioFrame::getSize() const
77
82
return 0 ;
78
83
}
79
84
80
- const size_t size = getNbSamplesPerChannel () * getNbChannels () * av_get_bytes_per_sample ( getSampleFormat () );
85
+ const size_t size = getNbSamplesPerChannel () * getNbChannels () * getBytesPerSample ( );
81
86
if (size == 0 )
82
87
{
83
88
std::stringstream msg;
84
89
msg << " Unable to determine audio buffer size:" << std::endl;
85
90
msg << " nb sample per channel = " << getNbSamplesPerChannel () << std::endl;
86
91
msg << " channels = " << getNbChannels () << std::endl;
87
- msg << " bytes per sample = " << av_get_bytes_per_sample ( getSampleFormat () ) << std::endl;
92
+ msg << " bytes per sample = " << getBytesPerSample ( ) << std::endl;
88
93
throw std::runtime_error (msg.str ());
89
94
}
90
95
return size;
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ class AvExport AudioFrame : public IFrame
52
52
size_t getChannelLayout () const { return av_frame_get_channel_layout (_frame); }
53
53
std::string getChannelLayoutDesc () const ; // /< Get a description of a channel layout (example: '5.1').
54
54
AVSampleFormat getSampleFormat () const { return static_cast <AVSampleFormat>(_frame->format ); }
55
+ size_t getBytesPerSample () const ; // /< 0 if unknown sample format
55
56
size_t getNbSamplesPerChannel () const { return _frame->nb_samples ; }
56
57
57
58
size_t getSize () const ;
You can’t perform that action at this time.
0 commit comments