Skip to content

Commit 85054c2

Browse files
author
Clement Champetier
committed
Merge branch 'master' into coverity_scan
2 parents f956a0c + d196115 commit 85054c2

File tree

79 files changed

+2121
-1007
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+2121
-1007
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ You can also use it in Java & Python for simpliest integration in projects.
1111
###### Drone.io
1212
[![Build Status](https://drone.io/github.com/avTranscoder/avTranscoder/status.png)](https://drone.io/github.com/avTranscoder/avTranscoder/latest)
1313

14+
###### Travis
15+
[![Build Status](https://travis-ci.org/avTranscoder/avTranscoder.svg?branch=master)](https://travis-ci.org/avTranscoder/avTranscoder)
16+
17+
###### Coverity Scan
18+
<a href="https://scan.coverity.com/projects/2626">
19+
<img alt="Coverity Scan Build Status"
20+
src="https://scan.coverity.com/projects/2626/badge.svg"/>
21+
</a>
22+
1423
#### Packaging
1524

1625
###### Build openSUSE

SConstruct

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ import os
44
import sys
55
import ConfigParser
66

7+
mymode = ARGUMENTS.get('mode', 'release')
8+
9+
if not (mymode in ['debug', 'release']):
10+
print "Error: expected 'debug' or 'release', found: " + mymode
11+
Exit(1)
12+
713
config = ConfigParser.RawConfigParser()
814

915
config.read( [
@@ -85,7 +91,7 @@ envJava.Replace(
8591
libavLibDir,
8692
"#src",
8793
],
88-
JARCHDIR = env.Dir('#build/src/AvTranscoder').get_abspath(),
94+
JARCHDIR = env.Dir('#build/'+mymode+'/src/AvTranscoder').get_abspath(),
8995
)
9096

9197
envJava.Append(
@@ -153,16 +159,25 @@ envPy.Append(
153159
CXXFLAGS = resampleLibraryFlag
154160
)
155161

162+
if mymode == "release":
163+
env.Append(CCFLAGS = ['-O3'])
164+
if mymode == "debug":
165+
env.Append(CCFLAGS = ['-pg', '-g'])
166+
156167
Export( "env" )
157168
Export( "envJava" )
158169
Export( "envPy" )
159170
Export( "installPrefix" )
160171
Export( "resampleLibraryName" )
161172

162-
VariantDir( 'build/src', 'src', duplicate = 0 )
163-
VariantDir( 'build/app', 'app', duplicate = 0 )
173+
VariantDir( 'build/'+mymode+'/src', 'src', duplicate = 0 )
174+
VariantDir( 'build/'+mymode+'/app', 'app', duplicate = 0 )
164175

165-
SConscript( [
176+
sconscripts = [
166177
'build/src/SConscript',
167178
'build/app/SConscript',
168-
] )
179+
]
180+
181+
SConscript('src/SConscript', variant_dir='build/'+mymode+'/src')
182+
SConscript('app/SConscript', variant_dir='build/'+mymode+'/app')
183+

app/avInfo/avInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ int main( int argc, char** argv )
1313
std::cout << std::left;
1414
std::cout << std::setw( 15 ) << (*library).getName();
1515
std::cout << std::setw( 10 ) << (*library).getStringVersion();
16-
std::cout << std::setw( 30 ) << (*library).getLicence();
16+
std::cout << std::setw( 30 ) << (*library).getLicense();
1717
std::cout << std::endl;
1818
}
1919

app/avMeta/avMeta.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ int main( int argc, char** argv )
1717
input.analyse( p, avtranscoder::InputFile::eAnalyseLevelFull );
1818

1919
// a simply metadata display
20-
displayMetadatas( input );
20+
std::cout << input;
2121
}

app/avTranscoder/avTranscoder.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ void transcodeVideo( const char* inputfilename, const char* outputFilename )
2626

2727
// init video decoders
2828
InputVideo inputVideo( input.getStream( 0 ) );
29-
ImageDesc imageDesc = input.getStream( 0 ).getVideoDesc().getImageDesc();
30-
Image sourceImage( imageDesc );
29+
VideoFrameDesc VideoFrameDesc = input.getStream( 0 ).getVideoDesc().getVideoFrameDesc();
30+
VideoFrame sourceImage( VideoFrameDesc );
3131

3232
// init video encoder
3333
OutputVideo outputVideo;
34-
outputVideo.setProfile( profile.getProfile( "xdcamhd422" ), imageDesc );
35-
Image imageToEncode( outputVideo.getVideoDesc().getImageDesc() );
34+
outputVideo.setProfile( profile.getProfile( "xdcamhd422" ), VideoFrameDesc );
35+
VideoFrame imageToEncode( outputVideo.getVideoDesc().getVideoFrameDesc() );
3636

3737
DataStream codedImage;
3838

app/avplay/AvReader.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class AvReader : public Reader
2929

3030
m_inputVideo->setup();
3131

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

3434
pixel.setBitsPerPixel( getComponents() * getBitDepth() );
3535
pixel.setComponents( getComponents() );
@@ -38,13 +38,13 @@ class AvReader : public Reader
3838
pixel.setAlpha( false );
3939
pixel.setPlanar( false );
4040

41-
imageDescToDisplay.setWidth( m_sourceImage->desc().getWidth() );
42-
imageDescToDisplay.setHeight( m_sourceImage->desc().getHeight() );
43-
imageDescToDisplay.setDar( m_sourceImage->desc().getDar() );
41+
VideoFrameDescToDisplay.setWidth( m_sourceImage->desc().getWidth() );
42+
VideoFrameDescToDisplay.setHeight( m_sourceImage->desc().getHeight() );
43+
VideoFrameDescToDisplay.setDar( m_sourceImage->desc().getDar() );
4444

45-
imageDescToDisplay.setPixel( pixel.findPixel() );
45+
VideoFrameDescToDisplay.setPixel( pixel.findPixel() );
4646

47-
m_imageToDisplay = new avtranscoder::Image( imageDescToDisplay );
47+
m_imageToDisplay = new avtranscoder::VideoFrame( VideoFrameDescToDisplay );
4848
}
4949

5050
~AvReader()
@@ -98,19 +98,19 @@ class AvReader : public Reader
9898

9999
void printMetadatas()
100100
{
101-
displayMetadatas( m_inputFile );
101+
std::cout << m_inputFile << std::endl;
102102
}
103103

104104
private:
105105
avtranscoder::InputFile m_inputFile;
106106

107107
avtranscoder::InputVideo* m_inputVideo;
108108

109-
avtranscoder::Image* m_sourceImage;
110-
avtranscoder::Image* m_imageToDisplay;
109+
avtranscoder::VideoFrame* m_sourceImage;
110+
avtranscoder::VideoFrame* m_imageToDisplay;
111111

112112
avtranscoder::Pixel pixel;
113-
avtranscoder::ImageDesc imageDescToDisplay;
113+
avtranscoder::VideoFrameDesc VideoFrameDescToDisplay;
114114

115115
avtranscoder::VideoEssenceTransform m_videoEssenceTransform;
116116
size_t m_videoStream;

app/genericProcessor/genericProcessor.cpp

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
#include <sstream>
99
#include <cstdlib>
1010

11+
static const size_t dummyWidth = 1920;
12+
static const size_t dummyHeight = 1080;
13+
static const std::string dummyPixelFormat = "yuv420p";
14+
static const std::string dummyVideoCodec = "mpeg2video";
15+
static const std::string dummyAudioCodec = "pcm_s16le";
16+
1117
// bool verbose = false;
1218
bool verbose = true;
1319

@@ -47,9 +53,27 @@ void parseConfigFile( const std::string& configFilename, avtranscoder::Transcode
4753
std::cout << ( transcodeProfile.length() ? transcodeProfile : "rewrap" );
4854
std::cout << std::endl;
4955
}
50-
51-
transcoder.add( filename, streamIndex, subStreamIndex, transcodeProfile );
52-
56+
57+
// dummy stream, need a CodedDesc (audio or video)
58+
if( ! filename.length() )
59+
{
60+
// video
61+
avtranscoder::VideoFrameDesc imageDesc;
62+
imageDesc.setWidth( dummyWidth );
63+
imageDesc.setHeight( dummyHeight );
64+
imageDesc.setDar( dummyWidth, dummyHeight );
65+
avtranscoder::Pixel inputPixel( dummyPixelFormat );
66+
imageDesc.setPixel( inputPixel );
67+
68+
avtranscoder::VideoDesc inputVideoDesc( dummyVideoCodec );
69+
inputVideoDesc.setImageParameters( imageDesc );
70+
71+
transcoder.add( filename, streamIndex, subStreamIndex, transcodeProfile, inputVideoDesc );
72+
}
73+
else
74+
{
75+
transcoder.add( filename, streamIndex, subStreamIndex, transcodeProfile );
76+
}
5377
}
5478
}
5579
}
@@ -84,12 +108,17 @@ int main( int argc, char** argv )
84108
avtranscoder::OutputFile outputFile( argv[2] );
85109

86110
avtranscoder::Transcoder transcoder( outputFile );
87-
transcoder.setVerbose( verbose );
88111

89112
if( verbose )
90113
std::cout << "parse config file" << std::endl;
91114
parseConfigFile( inputConfigFile, transcoder, profiles );
92115

116+
// set verbose of all stream
117+
transcoder.setVerbose( verbose );
118+
transcoder.setProcessMethod( avtranscoder::eProcessMethodInfinity );
119+
//transcoder.setOutputFps( 12 );
120+
transcoder.init();
121+
93122
if( verbose )
94123
std::cout << "start Transcode" << std::endl;
95124

app/presetChecker/presetChecker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ int main( int argc, char** argv )
2525
if( profile.find( avtranscoder::Profile::avProfileType )->second == avtranscoder::Profile::avProfileTypeVideo )
2626
{
2727
avtranscoder::OutputVideo outputVideo;
28-
outputVideo.setProfile( profile, outputVideo.getVideoDesc().getImageDesc() );
28+
outputVideo.setProfile( profile, outputVideo.getVideoDesc().getVideoFrameDesc() );
2929
}
3030

3131
if( profile.find( avtranscoder::Profile::avProfileType )->second == avtranscoder::Profile::avProfileTypeAudio )

src/AvTranscoder/CodedStream/AvInputStream.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ extern "C" {
99

1010
#include <libavcodec/avcodec.h>
1111
#include <libavformat/avformat.h>
12-
#include <libavutil/avutil.h>
13-
#include <libavutil/pixdesc.h>
14-
#include <libavutil/avstring.h>
1512
}
1613

1714
#include <stdexcept>
@@ -134,6 +131,12 @@ AudioDesc AvInputStream::getAudioDesc() const
134131
return desc;
135132
}
136133

134+
DataDesc AvInputStream::getDataDesc() const
135+
{
136+
DataDesc desc;
137+
return desc;
138+
}
139+
137140
AVMediaType AvInputStream::getStreamType() const
138141
{
139142
return _inputFile->getStreamType( _streamIndex );

src/AvTranscoder/CodedStream/AvInputStream.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#include "InputStream.hpp"
55

6+
#include <AvTranscoder/CodedStructures/DataStream.hpp>
7+
68
namespace avtranscoder
79
{
810

@@ -28,9 +30,10 @@ class AvExport AvInputStream : public InputStream
2830

2931
bool readNextPacket( DataStream& data );
3032

31-
// Stream propeerties
33+
// Stream properties
3234
VideoDesc getVideoDesc() const;
3335
AudioDesc getAudioDesc() const;
36+
DataDesc getDataDesc() const;
3437

3538
AVMediaType getStreamType() const;
3639

src/AvTranscoder/CodedStream/AvOutputStream.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include <AvTranscoder/File/OutputFile.hpp>
44

55
#include <cassert>
6-
#include <iostream>
76

87
namespace avtranscoder
98
{

src/AvTranscoder/CodedStream/InputStream.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#ifndef _AV_TRANSCODER_CODED_STREAM_INPUT_STREAM_HPP_
22
#define _AV_TRANSCODER_CODED_STREAM_INPUT_STREAM_HPP_
33

4-
#include <AvTranscoder/DatasStructures/DataStreamDesc.hpp>
5-
#include <AvTranscoder/DatasStructures/AudioDesc.hpp>
6-
#include <AvTranscoder/DatasStructures/VideoDesc.hpp>
4+
#include <AvTranscoder/CodedStructures/DataStream.hpp>
5+
#include <AvTranscoder/CodedStructures/AudioDesc.hpp>
6+
#include <AvTranscoder/CodedStructures/VideoDesc.hpp>
7+
#include <AvTranscoder/CodedStructures/DataDesc.hpp>
78

89
namespace avtranscoder
910
{
@@ -22,6 +23,7 @@ class InputStream
2223
// Stream properties
2324
virtual VideoDesc getVideoDesc() const = 0;
2425
virtual AudioDesc getAudioDesc() const = 0;
26+
virtual DataDesc getDataDesc() const = 0;
2527

2628
virtual AVMediaType getStreamType() const = 0;
2729

src/AvTranscoder/CodedStream/OutputStream.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#ifndef _AV_TRANSCODER_CODED_STREAM_OUTPUT_STREAM_HPP_
22
#define _AV_TRANSCODER_CODED_STREAM_OUTPUT_STREAM_HPP_
33

4-
#include <AvTranscoder/DatasStructures/DataStreamDesc.hpp>
5-
#include <AvTranscoder/DatasStructures/AudioDesc.hpp>
6-
#include <AvTranscoder/DatasStructures/VideoDesc.hpp>
4+
#include <AvTranscoder/CodedStructures/DataStream.hpp>
5+
#include <AvTranscoder/CodedStructures/AudioDesc.hpp>
6+
#include <AvTranscoder/CodedStructures/VideoDesc.hpp>
77

88
namespace avtranscoder
99
{

src/AvTranscoder/DatasStructures/AudioDesc.cpp renamed to src/AvTranscoder/CodedStructures/AudioDesc.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ namespace avtranscoder
66
{
77

88
AudioDesc::AudioDesc( const std::string& codecName )
9-
: EssenceDesc( codecName )
9+
: CodedDesc( codecName )
1010
{
1111
}
1212

1313
AudioDesc::AudioDesc( const AVCodecID codecId )
14-
: EssenceDesc( codecId )
14+
: CodedDesc( codecId )
1515
{
1616
}
1717

18-
AudioDesc::AudioDesc( const EssenceDesc& essenceDesc )
19-
: EssenceDesc( essenceDesc.getCodecId() )
18+
AudioDesc::AudioDesc( const CodedDesc& essenceDesc )
19+
: CodedDesc( essenceDesc.getCodecId() )
2020
{
2121
m_codec = essenceDesc.getCodec();
2222
m_codecContext = essenceDesc.getCodecContext();
@@ -53,6 +53,10 @@ const AVSampleFormat AudioDesc::getSampleFormat() const
5353
return m_codecContext->sample_fmt;
5454
}
5555

56+
void AudioDesc::setAudioParameters( const AudioFrameDesc& audioFrameDesc )
57+
{
58+
setAudioParameters( audioFrameDesc.getSampleRate(), audioFrameDesc.getChannels(), audioFrameDesc.getSampleFormat() );
59+
}
5660

5761
void AudioDesc::setAudioParameters( const size_t sampleRate, const size_t channels, const AVSampleFormat sampleFormat )
5862
{
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#ifndef _AV_TRANSCODER_CODED_STRUCTURES_AUDIO_DESC_HPP_
2+
#define _AV_TRANSCODER_CODED_STRUCTURES_AUDIO_DESC_HPP_
3+
4+
#include <AvTranscoder/EssenceStructures/AudioFrame.hpp>
5+
#include "CodedDesc.hpp"
6+
#include <AvTranscoder/common.hpp>
7+
8+
#include <string>
9+
10+
class AVCodec;
11+
12+
namespace avtranscoder
13+
{
14+
15+
class AvExport AudioDesc : public CodedDesc
16+
{
17+
public:
18+
AudioDesc( const std::string& codecName = "" );
19+
AudioDesc( const AVCodecID codecId );
20+
AudioDesc( const CodedDesc& essenceDesc );
21+
22+
AudioFrameDesc getFrameDesc() const;
23+
const size_t getSampleRate() const;
24+
const size_t getChannels() const;
25+
const AVSampleFormat getSampleFormat() const;
26+
27+
void setAudioParameters( const AudioFrameDesc& audioFrameDesc );
28+
void setAudioParameters( const size_t sampleRate, const size_t channels, const AVSampleFormat sampleFormat );
29+
};
30+
31+
}
32+
33+
#endif

0 commit comments

Comments
 (0)