Skip to content

Commit 6f87bdf

Browse files
author
Clement Champetier
committed
AudioFrameDesc: remove fps attribute
1 parent 4286a81 commit 6f87bdf

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

src/AvTranscoder/decoder/AudioGenerator.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ AudioGenerator::AudioGenerator()
1212
void AudioGenerator::setAudioFrameDesc( const AudioFrameDesc& frameDesc )
1313
{
1414
_frameDesc = frameDesc;
15-
_frameDesc.setFps( 25. );
1615
}
1716

1817
void AudioGenerator::setFrame( Frame& inputFrame )
@@ -25,7 +24,7 @@ bool AudioGenerator::decodeNextFrame( Frame& frameBuffer )
2524
if( ! _inputFrame )
2625
{
2726
AudioFrame& audioFrameBuffer = static_cast<AudioFrame&>( frameBuffer );
28-
audioFrameBuffer.setNbSamples( 1.0 * _frameDesc.getSampleRate() / _frameDesc.getFps() );
27+
audioFrameBuffer.setNbSamples( 1.0 * _frameDesc.getSampleRate() / 25. );
2928

3029
//av_samples_set_silence( data.getPtr(), offset, nb_samples, nb_channels, sample_fmt );
3130
int fill_char = (

src/AvTranscoder/frame/AudioFrame.hpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,16 @@ class AvExport AudioFrameDesc
1919
AudioFrameDesc( const size_t sampleRate = 0, const size_t channels = 0, const AVSampleFormat sampleFormat = AV_SAMPLE_FMT_NONE )
2020
: _sampleRate( sampleRate )
2121
, _channels( channels )
22-
, _fps( 1.0 )
2322
, _sampleFormat( sampleFormat )
2423
{}
2524
AudioFrameDesc( const size_t sampleRate, const size_t channels, const std::string& sampleFormat )
2625
: _sampleRate( sampleRate )
2726
, _channels( channels )
28-
, _fps( 1.0 )
2927
, _sampleFormat( av_get_sample_fmt( sampleFormat.c_str() ) )
3028
{}
3129

3230
size_t getSampleRate() const { return _sampleRate; }
3331
size_t getChannels() const { return _channels; }
34-
double getFps() const { return _fps; }
3532
AVSampleFormat getSampleFormat() const { return _sampleFormat; }
3633
std::string getSampleFormatName() const
3734
{
@@ -44,7 +41,7 @@ class AvExport AudioFrameDesc
4441
if( _sampleFormat == AV_SAMPLE_FMT_NONE )
4542
throw std::runtime_error( "incorrect sample format" );
4643

47-
size_t size = ( _sampleRate / _fps ) * _channels * av_get_bytes_per_sample( _sampleFormat );
44+
size_t size = _sampleRate * _channels * av_get_bytes_per_sample( _sampleFormat );
4845
if( size == 0 )
4946
throw std::runtime_error( "unable to determine audio buffer size" );
5047

@@ -53,7 +50,6 @@ class AvExport AudioFrameDesc
5350

5451
void setSampleRate( const size_t sampleRate ) { _sampleRate = sampleRate; }
5552
void setChannels( const size_t channels ) { _channels = channels; }
56-
void setFps( const double fps ) { _fps = fps; }
5753
void setSampleFormat( const std::string& sampleFormatName ) { _sampleFormat = av_get_sample_fmt( sampleFormatName.c_str() ); }
5854
void setSampleFormat( const AVSampleFormat sampleFormat ) { _sampleFormat = sampleFormat; }
5955

@@ -66,8 +62,6 @@ class AvExport AudioFrameDesc
6662
private:
6763
size_t _sampleRate;
6864
size_t _channels;
69-
double _fps;
70-
7165
AVSampleFormat _sampleFormat;
7266
};
7367

test/pyTest/testTranscoderDummy.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,8 @@ def testTranscodeDummyAudio():
8080
transcoder = av.Transcoder( ouputFile )
8181

8282
# add a dummy video stream
83-
audioDesc = av.AudioFrameDesc( 48000, 1, "s16" )
84-
audioDesc.setFps( 25 )
85-
8683
audioCodec = av.AudioCodec( av.eCodecTypeEncoder, "pcm_s16le" )
84+
audioDesc = av.AudioFrameDesc( 48000, 1, "s16" )
8785
audioCodec.setAudioParameters( audioDesc )
8886
transcoder.add( "", 0, "wave24b48kmono", audioCodec )
8987

0 commit comments

Comments
 (0)