Skip to content

Commit e6ec153

Browse files
Merge branch 'master' of github.com:MarcAntoine-Arnaud/avTranscoder
Conflicts: app/SConscript src/AvTranscoder/InputFile.cpp
2 parents a73fd30 + 2adf85c commit e6ec153

File tree

7 files changed

+42
-21
lines changed

7 files changed

+42
-21
lines changed

SConstruct

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ env.Append(
2929
LIBPATH = [
3030
libavLibDir,
3131
"#src",
32+
"#build/src"
3233
],
3334
)
3435

app/SConscript

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Import( 'AvTranscoder' )
2+
Import( 'sAvTranscoder' )
23
#Import( 'AvTranscoder_jar' )
34

45
env = Environment().Clone()
@@ -9,7 +10,7 @@ env.Program(
910
'avmeta',
1011
Glob( 'avMeta/*.cpp' ),
1112
LIBS = [
12-
AvTranscoder,
13+
sAvTranscoder,
1314
'avutil',
1415
'avformat',
1516
'avcodec',
@@ -21,7 +22,7 @@ env.Program(
2122
'av++',
2223
Glob( 'avTranscoder/*.cpp' ),
2324
LIBS = [
24-
AvTranscoder,
25+
sAvTranscoder,
2526
'avutil',
2627
'avformat',
2728
'avcodec',

src/AvTranscoder/ColorTransform.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ ColorTransform::ColorTransform()
2828
, dstLineSize ( MAX_SWS_PLANE, 0 )
2929
, srcOffsets ( MAX_SWS_PLANE, 0 )
3030
, dstOffsets ( MAX_SWS_PLANE, 0 )
31+
, m_isInit ( false )
3132
{
3233
}
3334

@@ -43,6 +44,11 @@ bool ColorTransform::init( const Image& src, const Image& dst )
4344
dst.desc().getWidth(), dst.desc().getHeight(), dst.desc().getPixelDesc().findPixel(),
4445
SWS_POINT, NULL, NULL, NULL);
4546

47+
if( !m_imageConvertContext )
48+
{
49+
throw std::runtime_error( "unable to create color convert context" );
50+
}
51+
4652
av_image_fill_linesizes( &srcLineSize[0], src.desc().getPixelDesc().findPixel(), src.desc().getWidth() );
4753
av_image_fill_linesizes( &dstLineSize[0], dst.desc().getPixelDesc().findPixel(), dst.desc().getWidth() );
4854

@@ -84,15 +90,15 @@ void ColorTransform::convert( const Image& src, Image& dst )
8490

8591
if( !m_imageConvertContext )
8692
{
87-
throw std::runtime_error( "unknown convert context" );
93+
throw std::runtime_error( "unknown color convert context" );
8894
}
8995

9096
int ret = sws_scale( m_imageConvertContext,
9197
&srcData[0], &srcLineSize[0], 0, src.desc().getHeight(),
9298
&dstData[0], &dstLineSize[0] );
9399

94-
if( ret != src.desc().getHeight() )
100+
if( ret != (int) src.desc().getHeight() )
95101
throw std::runtime_error( "error in color converter" );
96102
}
97103

98-
}
104+
}

src/AvTranscoder/DatasStructures/AudioDesc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ void AudioDesc::set( const std::string& key, const bool value )
113113

114114
void AudioDesc::set( const std::string& key, const int value )
115115
{
116-
const AVOption* flagOpt = av_opt_find( m_codecContext, key.c_str(), NULL, 0, AV_OPT_SEARCH_CHILDREN );
116+
//const AVOption* flagOpt = av_opt_find( m_codecContext, key.c_str(), NULL, 0, AV_OPT_SEARCH_CHILDREN );
117117

118118
int error = av_opt_set_int( m_codecContext, key.c_str(), value, AV_OPT_SEARCH_CHILDREN );
119119
if( error != 0 )

src/AvTranscoder/DatasStructures/VideoDesc.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ std::pair< size_t, size_t > VideoDesc::getTimeBase() const
8888
std::pair< size_t, size_t > timeBase;
8989
timeBase.first = m_codecContext->time_base.num;
9090
timeBase.second = m_codecContext->time_base.den;
91+
return timeBase;
9192
}
9293

9394
void VideoDesc::initCodecContext( )
@@ -154,7 +155,7 @@ void VideoDesc::set( const std::string& key, const bool value )
154155

155156
void VideoDesc::set( const std::string& key, const int value )
156157
{
157-
const AVOption* flagOpt = av_opt_find( m_codecContext, key.c_str(), NULL, 0, AV_OPT_SEARCH_CHILDREN );
158+
//const AVOption* flagOpt = av_opt_find( m_codecContext, key.c_str(), NULL, 0, AV_OPT_SEARCH_CHILDREN );
158159

159160
int error = av_opt_set_int( m_codecContext, key.c_str(), value, AV_OPT_SEARCH_CHILDREN );
160161
if( error != 0 )

src/AvTranscoder/OutputFile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ bool OutputFile::wrap( const DataStream& data, const size_t streamId )
118118
packet.dts = 0;
119119
packet.pts = packetCount;
120120

121-
if( av_interleaved_write_frame( formatContext, &packet ) != 0 )
121+
if( ( formatContext, &packet ) != 0 )
122122
{
123123
std::cout << "error when writting packet in stream" << std::endl;
124124
return false;

src/SConscript

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ Import( "env" )
55
Import( "envJava" )
66
Import( "envPy" )
77

8+
sAvTranscoder = env.StaticLibrary(
9+
'AvTranscoder',
10+
Glob( 'AvTranscoder/*.cpp' ) + Glob( 'AvTranscoder/DatasStructures/*.cpp' ) ,
11+
LIBS = [
12+
'libavutil',
13+
'libavcodec',
14+
'libavformat',
15+
'libswscale',
16+
'pthread',
17+
]
18+
)
19+
820
AvTranscoder = env.SharedLibrary(
921
'AvTranscoder',
1022
Glob( 'AvTranscoder/*.cpp' ) + Glob( 'AvTranscoder/DatasStructures/*.cpp' ) ,
@@ -21,31 +33,31 @@ jAvTranscoder = envJava.SharedLibrary(
2133
'jAvTranscoder',
2234
source=['AvTranscoder/avTranscoder.i'],
2335
LIBS=[
24-
AvTranscoder
36+
sAvTranscoder
2537
],
2638
)
2739

2840
pyAvTranscoder = envPy.SharedLibrary(
2941
'pyAvTranscoder',
3042
source='AvTranscoder/avTranscoder.i',
31-
LIBS=[ AvTranscoder ],
43+
LIBS=[ sAvTranscoder ],
3244
)
3345

34-
# envJava['JARCHDIR']=env.Dir('#build/src/').get_abspath()
46+
#envJava['JARCHDIR']=env.Dir('#build/src/').get_abspath()
3547

36-
# avTranscoder_class = env.Java(
37-
# target='AvTranscoderClass',
38-
# #source='AvTranscoder/avTranscoder.i' )
39-
# source= Glob( '#build/src/AvTranscoder' ) )
48+
avTranscoder_class = env.Java(
49+
target='AvTranscoderClass',
50+
source= Glob( '#build/src/AvTranscoder/src/AvTranscoder' ) )
4051

41-
# avTranscoder_jar = env.Jar(
42-
# target='jAvTranscoder.jar',
43-
# source=avTranscoder_class )
44-
# #source= Glob( '#build/src/AvTranscoderClass' ) )
52+
avTranscoder_jar = env.Jar(
53+
target='jAvTranscoder.jar',
54+
source=avTranscoder_class )
55+
#source= Glob( '#build/src/AvTranscoderClass' ) )
4556

4657

4758
# env.Depends( avTranscoder_class, jAvTranscoder )
4859
# env.Depends( avTranscoder_jar, avTranscoder_class )
4960

50-
Export( { 'AvTranscoder': AvTranscoder } )
51-
# Export( { 'AvTranscoder_jar': avTranscoder_class } )
61+
Export( { 'sAvTranscoder' : sAvTranscoder } )
62+
Export( { 'AvTranscoder' : AvTranscoder } )
63+
# Export( { 'AvTranscoder_jar': avTranscoder_class } )

0 commit comments

Comments
 (0)