Skip to content

Commit d532d17

Browse files
author
Clement Champetier
committed
ICodec: rename getCodec / getCodecContext to getAVCodec / getAVCodecContext
1 parent 133aff7 commit d532d17

File tree

8 files changed

+35
-35
lines changed

8 files changed

+35
-35
lines changed

src/AvTranscoder/codec/AudioCodec.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ AudioCodec::AudioCodec( const AVCodecID codecId )
1818
AudioCodec::AudioCodec( const ICodec& essenceDesc )
1919
: ICodec( essenceDesc.getCodecId() )
2020
{
21-
_codec = essenceDesc.getCodec();
22-
_codecContext = essenceDesc.getCodecContext();
21+
_codec = essenceDesc.getAVCodec();
22+
_codecContext = essenceDesc.getAVCodecContext();
2323
}
2424

2525
AudioFrameDesc AudioCodec::getFrameDesc() const

src/AvTranscoder/codec/ICodec.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ class AvExport ICodec
2929
void setCodec( const AVCodecID codecId );
3030

3131
#ifndef SWIG
32-
AVCodec* getCodec() const { return _codec; }
33-
AVCodecContext* getCodecContext() const { return _codecContext; }
32+
AVCodec* getAVCodec() const { return _codec; }
33+
AVCodecContext* getAVCodecContext() const { return _codecContext; }
3434
#endif
3535

3636
private:

src/AvTranscoder/codec/VideoCodec.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ VideoCodec::VideoCodec( const AVCodecID codecId )
1818
VideoCodec::VideoCodec( const ICodec& essenceDesc )
1919
: ICodec( essenceDesc.getCodecId() )
2020
{
21-
_codec = essenceDesc.getCodec();
22-
_codecContext = essenceDesc.getCodecContext();
21+
_codec = essenceDesc.getAVCodec();
22+
_codecContext = essenceDesc.getAVCodecContext();
2323
}
2424

2525
VideoFrameDesc VideoCodec::getVideoFrameDesc() const

src/AvTranscoder/essenceStream/AvOutputAudio.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ void AvOutputAudio::setup()
2626
{
2727
av_register_all(); // Warning: should be called only once
2828

29-
AVCodecContext* codecContext( _codedDesc.getCodecContext() );
29+
AVCodecContext* codecContext( _codedDesc.getAVCodecContext() );
3030

3131
if( codecContext == NULL )
3232
{
3333
throw std::runtime_error( "could not allocate audio codec context" );
3434
}
3535

3636
// try to open encoder with parameters.
37-
int ret = avcodec_open2( codecContext, _codedDesc.getCodec(), NULL );
37+
int ret = avcodec_open2( codecContext, _codedDesc.getAVCodec(), NULL );
3838
if( ret < 0 )
3939
{
4040
char err[250];
@@ -53,7 +53,7 @@ bool AvOutputAudio::encodeFrame( const Frame& sourceFrame, DataStream& codedFram
5353
AVFrame* frame = avcodec_alloc_frame();
5454
#endif
5555

56-
AVCodecContext* codecContext = _codedDesc.getCodecContext();
56+
AVCodecContext* codecContext = _codedDesc.getAVCodecContext();
5757

5858
// Set default frame parameters
5959
#if LIBAVCODEC_VERSION_MAJOR > 54
@@ -141,7 +141,7 @@ bool AvOutputAudio::encodeFrame( const Frame& sourceFrame, DataStream& codedFram
141141

142142
bool AvOutputAudio::encodeFrame( DataStream& codedFrame )
143143
{
144-
AVCodecContext* codecContext = _codedDesc.getCodecContext();
144+
AVCodecContext* codecContext = _codedDesc.getAVCodecContext();
145145

146146
AVPacket packet;
147147
av_init_packet( &packet );
@@ -186,7 +186,7 @@ void AvOutputAudio::setProfile( const Profile::ProfileDesc& desc, const AudioFra
186186

187187
static_cast<AudioCodec>( _codedDesc ).setAudioParameters( frameDesc );
188188

189-
Context codecContext( _codedDesc.getCodecContext() );
189+
Context codecContext( _codedDesc.getAVCodecContext() );
190190

191191
for( Profile::ProfileDesc::const_iterator it = desc.begin(); it != desc.end(); ++it )
192192
{

src/AvTranscoder/essenceStream/AvOutputVideo.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ void AvOutputVideo::setup( )
2727
{
2828
av_register_all(); // Warning: should be called only once
2929

30-
AVCodecContext* codecContext( _codedDesc.getCodecContext() );
30+
AVCodecContext* codecContext( _codedDesc.getAVCodecContext() );
3131

3232
if( codecContext == NULL )
3333
{
3434
throw std::runtime_error( "could not allocate video codec context" );
3535
}
3636

3737
// try to open encoder with parameters
38-
int ret = avcodec_open2( codecContext, _codedDesc.getCodec(), NULL );
38+
int ret = avcodec_open2( codecContext, _codedDesc.getAVCodec(), NULL );
3939
if( ret < 0 )
4040
{
4141
char err[250];
@@ -55,7 +55,7 @@ bool AvOutputVideo::encodeFrame( const Frame& sourceFrame, DataStream& codedFram
5555
AVFrame* frame = avcodec_alloc_frame();
5656
#endif
5757

58-
AVCodecContext* codecContext = this->_codedDesc.getCodecContext();
58+
AVCodecContext* codecContext = this->_codedDesc.getAVCodecContext();
5959

6060
// Set default frame parameters
6161
#if LIBAVCODEC_VERSION_MAJOR > 54
@@ -142,7 +142,7 @@ bool AvOutputVideo::encodeFrame( const Frame& sourceFrame, DataStream& codedFram
142142

143143
bool AvOutputVideo::encodeFrame( DataStream& codedFrame )
144144
{
145-
AVCodecContext* codecContext = _codedDesc.getCodecContext();
145+
AVCodecContext* codecContext = _codedDesc.getAVCodecContext();
146146

147147
AVPacket packet;
148148
av_init_packet( &packet );
@@ -191,7 +191,7 @@ void AvOutputVideo::setProfile( const Profile::ProfileDesc& desc, const avtransc
191191

192192
static_cast<VideoCodec>( _codedDesc ).setImageParameters( frameDesc );
193193

194-
Context codecContext( _codedDesc.getCodecContext() );
194+
Context codecContext( _codedDesc.getAVCodecContext() );
195195

196196
for( Profile::ProfileDesc::const_iterator it = desc.begin(); it != desc.end(); ++it )
197197
{

src/AvTranscoder/essenceStream/GeneratorAudio.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ void GeneratorAudio::setAudioDesc( const AudioCodec& audioDesc )
1717
{
1818
_audioDesc = audioDesc;
1919

20-
_frameDesc.setSampleRate ( _audioDesc.getCodecContext()->sample_rate );
21-
_frameDesc.setChannels ( _audioDesc.getCodecContext()->channels );
20+
_frameDesc.setSampleRate ( _audioDesc.getAVCodecContext()->sample_rate );
21+
_frameDesc.setChannels ( _audioDesc.getAVCodecContext()->channels );
2222
_frameDesc.setFps ( 25.0 );
23-
_frameDesc.setSampleFormat( _audioDesc.getCodecContext()->sample_fmt );
23+
_frameDesc.setSampleFormat( _audioDesc.getAVCodecContext()->sample_fmt );
2424
}
2525

2626
AudioCodec GeneratorAudio::getAudioCodec() const

src/AvTranscoder/file/OutputFile.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,25 +63,25 @@ IOutputStream& OutputFile::addVideoStream( const VideoCodec& videoDesc )
6363
{
6464
assert( _formatContext != NULL );
6565

66-
if( ( _stream = avformat_new_stream( _formatContext, videoDesc.getCodec() ) ) == NULL )
66+
if( ( _stream = avformat_new_stream( _formatContext, videoDesc.getAVCodec() ) ) == NULL )
6767
{
6868
throw std::runtime_error( "unable to add new video stream" );
6969
}
7070

71-
_stream->codec->width = videoDesc.getCodecContext()->width;
72-
_stream->codec->height = videoDesc.getCodecContext()->height;
73-
_stream->codec->bit_rate = videoDesc.getCodecContext()->bit_rate;
74-
_stream->codec->ticks_per_frame = videoDesc.getCodecContext()->ticks_per_frame;
75-
_stream->codec->pix_fmt = videoDesc.getCodecContext()->pix_fmt;
76-
_stream->codec->profile = videoDesc.getCodecContext()->profile;
77-
_stream->codec->level = videoDesc.getCodecContext()->level;
71+
_stream->codec->width = videoDesc.getAVCodecContext()->width;
72+
_stream->codec->height = videoDesc.getAVCodecContext()->height;
73+
_stream->codec->bit_rate = videoDesc.getAVCodecContext()->bit_rate;
74+
_stream->codec->ticks_per_frame = videoDesc.getAVCodecContext()->ticks_per_frame;
75+
_stream->codec->pix_fmt = videoDesc.getAVCodecContext()->pix_fmt;
76+
_stream->codec->profile = videoDesc.getAVCodecContext()->profile;
77+
_stream->codec->level = videoDesc.getAVCodecContext()->level;
7878

7979
// need to set the time_base on the AVCodecContext and the AVStream...
8080
av_reduce(
8181
&_stream->codec->time_base.num,
8282
&_stream->codec->time_base.den,
83-
videoDesc.getCodecContext()->time_base.num * videoDesc.getCodecContext()->ticks_per_frame,
84-
videoDesc.getCodecContext()->time_base.den,
83+
videoDesc.getAVCodecContext()->time_base.num * videoDesc.getAVCodecContext()->ticks_per_frame,
84+
videoDesc.getAVCodecContext()->time_base.den,
8585
INT_MAX );
8686

8787
_stream->time_base = _stream->codec->time_base;
@@ -97,14 +97,14 @@ IOutputStream& OutputFile::addAudioStream( const AudioCodec& audioDesc )
9797
{
9898
assert( _formatContext != NULL );
9999

100-
if( ( _stream = avformat_new_stream( _formatContext, audioDesc.getCodec() ) ) == NULL )
100+
if( ( _stream = avformat_new_stream( _formatContext, audioDesc.getAVCodec() ) ) == NULL )
101101
{
102102
throw std::runtime_error( "unable to add new audio stream" );
103103
}
104104

105-
_stream->codec->sample_rate = audioDesc.getCodecContext()->sample_rate;
106-
_stream->codec->channels = audioDesc.getCodecContext()->channels;
107-
_stream->codec->sample_fmt = audioDesc.getCodecContext()->sample_fmt;
105+
_stream->codec->sample_rate = audioDesc.getAVCodecContext()->sample_rate;
106+
_stream->codec->channels = audioDesc.getAVCodecContext()->channels;
107+
_stream->codec->sample_fmt = audioDesc.getAVCodecContext()->sample_fmt;
108108

109109
AvOutputStream* avOutputStream = new AvOutputStream( *this, _formatContext->nb_streams - 1 );
110110
_outputStreams.push_back( avOutputStream );
@@ -116,7 +116,7 @@ IOutputStream& OutputFile::addDataStream( const DataCodec& dataDesc )
116116
{
117117
assert( _formatContext != NULL );
118118

119-
if( ( _stream = avformat_new_stream( _formatContext, dataDesc.getCodec() ) ) == NULL )
119+
if( ( _stream = avformat_new_stream( _formatContext, dataDesc.getAVCodec() ) ) == NULL )
120120
{
121121
throw std::runtime_error( "unable to add new data stream" );
122122
}

src/AvTranscoder/transcoder/StreamTranscoder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ void StreamTranscoder::init()
262262
std::cout << "latency of stream: " << latency << std::endl;
263263

264264
if( ! latency ||
265-
latency < _outputEssence->getCodedDesc().getCodecContext()->frame_number )
265+
latency < _outputEssence->getCodedDesc().getAVCodecContext()->frame_number )
266266
return;
267267

268268
while( ( --latency ) > 0 )

0 commit comments

Comments
 (0)