Skip to content

Commit a82a71c

Browse files
removing some build warnings and some pointer to references
1 parent 87322aa commit a82a71c

15 files changed

+32
-29
lines changed

app/audioRewrapper/audioRewrapper.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ void rewrapAudio( const char* inputfilename, const char* outputFilename )
2121

2222
outputFile.setup();
2323

24-
outputFile.addAudioStream( inputFile.getStream( 0 )->getAudioDesc() );
24+
outputFile.addAudioStream( inputFile.getStream( 0 ).getAudioDesc() );
2525

2626
DataStream data;
2727

@@ -30,7 +30,7 @@ void rewrapAudio( const char* inputfilename, const char* outputFilename )
3030

3131
size_t frame = 0;
3232

33-
while( inputFile.getStream( 0 )->readNextPacket( data ) )
33+
while( inputFile.getStream( 0 ).readNextPacket( data ) )
3434
{
3535
std::cout << "\rprocess frame " << (int)frame - 1 << std::flush;
3636

@@ -58,7 +58,7 @@ void transcodeAudio( const char* inputfilename, const char* outputFilename )
5858

5959
outputFile.setup();
6060

61-
outputFile.addAudioStream( inputFile.getStream( 0 )->getAudioDesc() );
61+
outputFile.addAudioStream( inputFile.getStream( 0 ).getAudioDesc() );
6262

6363
DataStream data;
6464

app/avTranscoder/avTranscoder.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <iostream>
22
#include <iomanip>
3+
#include <cstdlib>
34

45
#include <AvTranscoder/AvInputStream.hpp>
56
#include <AvTranscoder/InputStreamAudio.hpp>
@@ -91,7 +92,7 @@ void transcodeVideo( const char* inputfilename, const char* outputFilename )
9192
exit( -1 );
9293
}
9394

94-
of.addVideoStream( inputFile.getStream( 0 )->getVideoDesc() );
95+
of.addVideoStream( inputFile.getStream( 0 ).getVideoDesc() );
9596
/*of.addAudioStream();
9697
of.addAudioStream();
9798
of.addAudioStream();

app/avplay/AvReader.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class AvReader : public Reader
2929

3030
m_inputStreamVideo = new avtranscoder::InputStreamVideo( m_inputFile.getStream( m_videoStream ) );
3131

32-
m_sourceImage = new avtranscoder::Image( m_inputFile.getStream( m_videoStream )->getVideoDesc().getImageDesc() );
32+
m_sourceImage = new avtranscoder::Image( m_inputFile.getStream( m_videoStream ).getVideoDesc().getImageDesc() );
3333

3434
pixel.setBitsPerPixel( getComponents() * getBitDepth() );
3535
pixel.setComponents( getComponents() );

src/AvTranscoder/AvInputStream.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,14 @@ void AvInputStream::addPacket( AVPacket& packet )
8686

8787
VideoDesc AvInputStream::getVideoDesc() const
8888
{
89-
assert( m_inputFile->getFormatContext() != NULL );
90-
assert( m_streamIndex <= m_inputFile->getFormatContext()->nb_streams );
89+
assert( m_streamIndex <= m_inputFile->getFormatContext().nb_streams );
9190

92-
if( m_inputFile->getFormatContext()->streams[m_streamIndex]->codec->codec_type != AVMEDIA_TYPE_VIDEO )
91+
if( m_inputFile->getFormatContext().streams[m_streamIndex]->codec->codec_type != AVMEDIA_TYPE_VIDEO )
9392
{
9493
throw std::runtime_error( "unable to get video descriptor on non-video stream" );
9594
}
9695

97-
AVCodecContext* codecContext = m_inputFile->getFormatContext()->streams[m_streamIndex]->codec;
96+
AVCodecContext* codecContext = m_inputFile->getFormatContext().streams[m_streamIndex]->codec;
9897

9998
VideoDesc desc( codecContext->codec_id );
10099

@@ -106,15 +105,14 @@ VideoDesc AvInputStream::getVideoDesc() const
106105

107106
AudioDesc AvInputStream::getAudioDesc() const
108107
{
109-
assert( m_inputFile->getFormatContext() != NULL );
110-
assert( m_streamIndex <= m_inputFile->getFormatContext()->nb_streams );
108+
assert( m_streamIndex <= m_inputFile->getFormatContext().nb_streams );
111109

112-
if( m_inputFile->getFormatContext()->streams[m_streamIndex]->codec->codec_type != AVMEDIA_TYPE_AUDIO )
110+
if( m_inputFile->getFormatContext().streams[m_streamIndex]->codec->codec_type != AVMEDIA_TYPE_AUDIO )
113111
{
114112
throw std::runtime_error( "unable to get audio descriptor on non-audio stream" );
115113
}
116114

117-
AVCodecContext* codecContext = m_inputFile->getFormatContext()->streams[m_streamIndex]->codec;
115+
AVCodecContext* codecContext = m_inputFile->getFormatContext().streams[m_streamIndex]->codec;
118116

119117
AudioDesc desc( codecContext->codec_id );
120118

@@ -126,12 +124,12 @@ AudioDesc AvInputStream::getAudioDesc() const
126124

127125
double AvInputStream::getDuration() const
128126
{
129-
return 1.0 * m_inputFile->getFormatContext()->duration / AV_TIME_BASE;
127+
return 1.0 * m_inputFile->getFormatContext().duration / AV_TIME_BASE;
130128
}
131129

132130
double AvInputStream::getPacketDuration() const
133131
{
134-
return m_packetDuration * av_q2d( m_inputFile->getFormatContext()->streams[m_streamIndex]->time_base );
132+
return m_packetDuration * av_q2d( m_inputFile->getFormatContext().streams[m_streamIndex]->time_base );
135133
}
136134

137135
void AvInputStream::clearBuffering()

src/AvTranscoder/DummyInputStream.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "DummyInputStream.hpp"
22

33
#include <cassert>
4+
#include <cstring>
45

56
namespace avtranscoder
67
{
@@ -66,4 +67,4 @@ void DummyInputStream::clearBuffering()
6667
{
6768
}
6869

69-
}
70+
}

src/AvTranscoder/InputFile.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ AVMediaType InputFile::getStreamType( size_t index )
143143
return m_formatContext->streams[index]->codec->codec_type;
144144
}
145145

146-
AvInputStream* InputFile::getStream( size_t index )
146+
AvInputStream& InputFile::getStream( size_t index )
147147
{
148-
return m_inputStreams.at( index );
148+
return *m_inputStreams.at( index );
149149
}
150150

151151
bool InputFile::readNextPacket( const size_t streamIndex )

src/AvTranscoder/InputFile.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ class AvExport InputFile
3838

3939
AVMediaType getStreamType( size_t index );
4040

41-
::avtranscoder::AvInputStream* getStream( size_t index );
41+
::avtranscoder::AvInputStream& getStream( size_t index );
4242

43-
AVFormatContext* getFormatContext() const { return m_formatContext; }
43+
AVFormatContext& getFormatContext() const { return *m_formatContext; }
4444

4545
bool readNextPacket( const size_t streamIndex );
4646

src/AvTranscoder/InputStream.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ class InputStream
1414
InputStream( )
1515
{}
1616

17+
virtual ~InputStream(){};
18+
1719
virtual size_t getStreamIndex() const = 0;
1820

1921
virtual bool readNextPacket( DataStream& data ) = 0;

src/AvTranscoder/InputStreamAudio.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ extern "C" {
1717
namespace avtranscoder
1818
{
1919

20-
InputStreamAudio::InputStreamAudio( const InputStream* inputStream )
21-
: m_inputStream ( inputStream )
20+
InputStreamAudio::InputStreamAudio( const InputStream& inputStream )
21+
: m_inputStream ( &inputStream )
2222
, m_codec ( NULL )
2323
, m_codecContext ( NULL )
2424
, m_frame ( NULL )

src/AvTranscoder/InputStreamAudio.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace avtranscoder
1010
class AvExport InputStreamAudio
1111
{
1212
public:
13-
InputStreamAudio( const InputStream* inputStream );
13+
InputStreamAudio( const InputStream& inputStream );
1414
~InputStreamAudio();
1515

1616
bool readNextFrame( AudioFrame& audioFrameBuffer );

src/AvTranscoder/InputStreamVideo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ extern "C" {
1919
namespace avtranscoder
2020
{
2121

22-
InputStreamVideo::InputStreamVideo( AvInputStream* inputStream )
23-
: m_inputStream ( inputStream )
22+
InputStreamVideo::InputStreamVideo( AvInputStream& inputStream )
23+
: m_inputStream ( &inputStream )
2424
, m_codec ( NULL )
2525
, m_codecContext ( NULL )
2626
, m_frame ( NULL )

src/AvTranscoder/InputStreamVideo.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class AvInputStream;
1919
class AvExport InputStreamVideo
2020
{
2121
public:
22-
InputStreamVideo( AvInputStream* inputStream );
22+
InputStreamVideo( AvInputStream& inputStream );
2323
~InputStreamVideo();
2424

2525
bool readNextFrame( Image& frameBuffer );

src/AvTranscoder/OutputFile.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ class AvExport OutputFile
2323
public:
2424
OutputFile( const std::string& file = "" );
2525

26+
virtual ~OutputFile(){};
27+
2628
virtual bool setup();
2729

2830
virtual void addVideoStream( const VideoDesc& videoDesc );

src/AvTranscoder/Profile.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ Profile::ProfileDesc& Profile::getProfile( const std::string& searchProfile )
4848
{
4949
return (*it);
5050
}
51-
5251
}
5352
}
5453

src/AvTranscoder/Transcoder.tcc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ void Transcoder::add( const std::string& filename, const size_t streamIndex )
6666
{
6767
case AVMEDIA_TYPE_VIDEO:
6868
{
69-
_inputStreams.push_back( referenceFile->getStream( streamIndex ) );
69+
_inputStreams.push_back( &referenceFile->getStream( streamIndex ) );
7070
_outputFile.addVideoStream( _inputStreams.back()->getVideoDesc() );
7171
break;
7272
}
7373
case AVMEDIA_TYPE_AUDIO:
7474
{
75-
_inputStreams.push_back( referenceFile->getStream( streamIndex ) );
75+
_inputStreams.push_back( &referenceFile->getStream( streamIndex ) );
7676
_outputFile.addAudioStream( _inputStreams.back()->getAudioDesc() );
7777
break;
7878
}

0 commit comments

Comments
 (0)