Skip to content

Commit 9960f54

Browse files
author
Valentin Noel
committed
Merge remote-tracking branch 'avtranscoder/master' into fix_build_windows
Conflicts: src/AvTranscoder/essenceStream/AvOutputAudio.cpp src/AvTranscoder/essenceStream/AvOutputVideo.cpp src/AvTranscoder/option/OptionLoader.hpp
2 parents 7bf7eea + 59e7340 commit 9960f54

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

+1667
-1572
lines changed

app/avTranscoder/avTranscoder.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@
44

55
#include <AvTranscoder/file/InputFile.hpp>
66
#include <AvTranscoder/file/OutputFile.hpp>
7+
8+
#include <AvTranscoder/frame/Frame.hpp>
9+
710
#include <AvTranscoder/essenceStream/AvInputAudio.hpp>
811
#include <AvTranscoder/essenceStream/AvInputVideo.hpp>
912
#include <AvTranscoder/essenceStream/AvOutputAudio.hpp>
1013
#include <AvTranscoder/essenceStream/AvOutputVideo.hpp>
11-
#include <AvTranscoder/essenceTransform/VideoEssenceTransform.hpp>
14+
15+
#include <AvTranscoder/transform/VideoTransform.hpp>
1216

1317
#include <AvTranscoder/progress/ConsoleProgress.hpp>
1418

@@ -28,15 +32,15 @@ void transcodeVideo( const char* inputfilename, const char* outputFilename )
2832

2933
// init video decoders
3034
AvInputVideo inputVideo( input.getStream( 0 ) );
31-
VideoFrameDesc VideoFrameDesc = input.getStream( 0 ).getVideoDesc().getVideoFrameDesc();
35+
VideoFrameDesc VideoFrameDesc = input.getStream( 0 ).getVideoCodec().getVideoFrameDesc();
3236
VideoFrame sourceImage( VideoFrameDesc );
3337

3438
// init video encoder
3539
AvOutputVideo outputVideo;
3640
outputVideo.setProfile( profile.getProfile( "xdcamhd422" ), VideoFrameDesc );
37-
VideoFrame imageToEncode( outputVideo.getVideoDesc().getVideoFrameDesc() );
41+
VideoFrame imageToEncode( outputVideo.getVideoCodec().getVideoFrameDesc() );
3842

39-
DataStream codedImage;
43+
CodedData codedImage;
4044

4145
// setup wrapper
4246
//mxftkwrapper::MxftkOutputFile of( outputFilename );
@@ -49,11 +53,11 @@ void transcodeVideo( const char* inputfilename, const char* outputFilename )
4953
exit( -1 );
5054
}
5155

52-
of.addVideoStream( outputVideo.getVideoDesc() );
56+
of.addVideoStream( outputVideo.getVideoCodec() );
5357

5458
of.beginWrap();
5559

56-
VideoEssenceTransform ct;
60+
VideoTransform ct;
5761

5862

5963
// Encodage/transcodage

app/avplay/AvReader.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <AvTranscoder/file/InputFile.hpp>
55
#include <AvTranscoder/essenceStream/AvInputAudio.hpp>
66
#include <AvTranscoder/essenceStream/AvInputVideo.hpp>
7-
#include <AvTranscoder/essenceTransform/VideoEssenceTransform.hpp>
7+
#include <AvTranscoder/transform/VideoTransform.hpp>
88
#include <AvTranscoder/mediaProperty/printMediaProperty.hpp>
99

1010
#include <AvTranscoder/progress/ConsoleProgress.hpp>
@@ -31,7 +31,7 @@ class AvReader : public Reader
3131

3232
_inputVideo->setup();
3333

34-
_sourceImage = new avtranscoder::VideoFrame( _inputFile.getStream( _videoStream ).getVideoDesc().getVideoFrameDesc() );
34+
_sourceImage = new avtranscoder::VideoFrame( _inputFile.getStream( _videoStream ).getVideoCodec().getVideoFrameDesc() );
3535

3636
_pixel.setBitsPerPixel( getComponents() * getBitDepth() );
3737
_pixel.setComponents( getComponents() );
@@ -80,7 +80,7 @@ class AvReader : public Reader
8080
{
8181
++_currentFrame;
8282
_inputVideo->readNextFrame( *_sourceImage );
83-
_videoEssenceTransform.convert( *_sourceImage, *_imageToDisplay );
83+
_videoTransform.convert( *_sourceImage, *_imageToDisplay );
8484
return (const char*)_imageToDisplay->getPtr();
8585
}
8686

@@ -114,7 +114,7 @@ class AvReader : public Reader
114114
avtranscoder::Pixel _pixel;
115115
avtranscoder::VideoFrameDesc _videoFrameDescToDisplay;
116116

117-
avtranscoder::VideoEssenceTransform _videoEssenceTransform;
117+
avtranscoder::VideoTransform _videoTransform;
118118
size_t _videoStream;
119119
};
120120

app/genericProcessor/genericProcessor.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ static const std::string dummyPixelFormat = "yuv420p";
1515
static const std::string dummyVideoCodec = "mpeg2video";
1616
static const std::string dummyAudioCodec = "pcm_s16le";
1717

18-
// bool verbose = false;
19-
bool verbose = true;
18+
bool verbose = false;
2019

2120
void parseConfigFile( const std::string& configFilename, avtranscoder::Transcoder& transcoder, avtranscoder::Profile& profile )
2221
{
@@ -55,7 +54,7 @@ void parseConfigFile( const std::string& configFilename, avtranscoder::Transcode
5554
std::cout << std::endl;
5655
}
5756

58-
// dummy stream, need a CodedDesc (audio or video)
57+
// dummy stream, need a ICodec (audio or video)
5958
if( ! filename.length() )
6059
{
6160
// video
@@ -66,10 +65,10 @@ void parseConfigFile( const std::string& configFilename, avtranscoder::Transcode
6665
avtranscoder::Pixel inputPixel( dummyPixelFormat );
6766
imageDesc.setPixel( inputPixel );
6867

69-
avtranscoder::VideoDesc inputVideoDesc( dummyVideoCodec );
70-
inputVideoDesc.setImageParameters( imageDesc );
68+
avtranscoder::VideoCodec inputVideoCodec( avtranscoder::eCodecTypeEncoder, dummyVideoCodec );
69+
inputVideoCodec.setImageParameters( imageDesc );
7170

72-
transcoder.add( filename, streamIndex, subStreamIndex, transcodeProfile, inputVideoDesc );
71+
transcoder.add( filename, streamIndex, subStreamIndex, transcodeProfile, inputVideoCodec );
7372
}
7473
else
7574
{

app/optionChecker/optionChecker.cpp

Lines changed: 57 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
#include <AvTranscoder/option/OptionLoader.hpp>
1+
#include <AvTranscoder/util.hpp>
2+
#include <AvTranscoder/option/Context.hpp>
3+
#include <AvTranscoder/option/CodecContext.hpp>
24
#include <AvTranscoder/option/Option.hpp>
5+
#include <AvTranscoder/file/InputFile.hpp>
36

47
#include <string>
58
#include <iostream>
69
#include <map>
710
#include <vector>
8-
#include <utility> //pair
11+
#include <utility>
912

10-
void displayOptions( avtranscoder::OptionLoader::OptionArray& options )
13+
void displayOptions( const std::vector<avtranscoder::Option>& options )
1114
{
1215
for( auto option : options )
1316
{
@@ -20,74 +23,89 @@ void displayOptions( avtranscoder::OptionLoader::OptionArray& options )
2023

2124
// get default value
2225

23-
if( option.getType() == avtranscoder::TypeInt )
26+
if( option.getType() == avtranscoder::eOptionBaseTypeInt )
2427
{
25-
std::cout << "DefaultValue: " << option.getDefaultValueInt() << std::endl;
28+
std::cout << "DefaultValue: " << option.getDefaultInt() << std::endl;
2629
}
27-
else if( option.getType() == avtranscoder::TypeBool )
30+
else if( option.getType() == avtranscoder::eOptionBaseTypeBool )
2831
{
29-
std::cout << "DefaultValue: " << option.getDefaultValueBool() << std::endl;
32+
std::cout << "DefaultValue: " << option.getDefaultBool() << std::endl;
3033
}
31-
else if( option.getType() == avtranscoder::TypeDouble )
34+
else if( option.getType() == avtranscoder::eOptionBaseTypeDouble )
3235
{
33-
std::cout << "DefaultValue: " << option.getDefaultValueDouble() << std::endl;
36+
std::cout << "DefaultValue: " << option.getDefaultDouble() << std::endl;
3437
}
35-
else if( option.getType() == avtranscoder::TypeRatio )
38+
else if( option.getType() == avtranscoder::eOptionBaseTypeRatio )
3639
{
37-
std::cout << "DefaultValue: " << option.getDefaultValueRatio().first << ", " << option.getDefaultValueRatio().second << std::endl;
40+
std::cout << "DefaultValue: " << option.getDefaultRatio().first << ", " << option.getDefaultRatio().second << std::endl;
3841
}
39-
else if( option.getType() == avtranscoder::TypeString )
42+
else if( option.getType() == avtranscoder::eOptionBaseTypeString )
4043
{
41-
std::cout << "DefaultValue: " << option.getDefaultValueString() << std::endl;
44+
std::cout << "DefaultValue: " << option.getDefaultString() << std::endl;
4245
}
43-
else if( option.getType() == avtranscoder::TypeChoice )
46+
else if( option.getType() == avtranscoder::eOptionBaseTypeChoice )
4447
{
45-
std::cout << "Nb choices: " << option.getNbChilds() << std::endl;
48+
std::cout << "Nb choices: " << option.getChilds().size() << std::endl;
4649
std::cout << "Default choice index: " << option.getDefaultChildIndex() << std::endl;
47-
for(size_t i = 0; i < option.getNbChilds(); ++i )
50+
for(size_t i = 0; i < option.getChilds().size(); ++i )
4851
std::cout << "Choice " << i << ": " <<
49-
option.getChild( i ).getName() << " // " <<
50-
option.getChild( i ).getHelp() << std::endl;
52+
option.getChildAtIndex( i ).getName() << " // " <<
53+
option.getChildAtIndex( i ).getHelp() << std::endl;
5154
}
52-
else if( option.getType() == avtranscoder::TypeGroup )
55+
else if( option.getType() == avtranscoder::eOptionBaseTypeGroup )
5356
{
54-
std::cout << "Nb choices: " << option.getNbChilds() << std::endl;
55-
for(size_t i = 0; i < option.getNbChilds(); ++i )
57+
std::cout << "Nb choices: " << option.getChilds().size() << std::endl;
58+
for(size_t i = 0; i < option.getChilds().size(); ++i )
5659
std::cout << "Element " << i << ": " <<
57-
option.getChild( i ).getName() << " // " <<
58-
option.getChild( i ).getDefaultValueBool() << std::endl;
60+
option.getChildAtIndex( i ).getName() << " // " <<
61+
option.getChildAtIndex( i ).getDefaultBool() << std::endl;
5962
}
6063
}
6164
}
6265

6366
void optionChecker( const std::string& inputfilename )
64-
{
65-
avtranscoder::OptionLoader optionLoader;
66-
67-
//avtranscoder::OptionLoader::OptionArray optionsArray = optionLoader.loadOptions( AV_OPT_FLAG_AUDIO_PARAM );
68-
avtranscoder::OptionLoader::OptionMap optionsMap = optionLoader.loadOutputFormatOptions();
69-
70-
//displayOptions( optionsArray );
71-
for( avtranscoder::OptionLoader::OptionMap::iterator it = optionsMap.begin();
72-
it != optionsMap.end();
73-
++it )
74-
{
75-
std::cout << "----- " << it->first << " -----" << std::endl;
76-
displayOptions( it->second );
77-
}
67+
{
68+
avtranscoder::InputFile file( inputfilename );
69+
70+
// format options
71+
avtranscoder::Context formatContext( &file.getFormatContext() );
72+
std::vector<avtranscoder::Option> formatOptions = formatContext.getOptions();
73+
displayOptions( formatOptions );
74+
75+
// codec options
76+
avtranscoder::CodecContext codecContext( AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM );
77+
std::vector<avtranscoder::Option> codecOptions = codecContext.getOptions();
78+
displayOptions( codecOptions );
79+
80+
// pixel formats
81+
// std::vector<std::string> pixelFormats = avtranscoder::getPixelFormats();
82+
// for( size_t i = 0; i < pixelFormats.size(); ++i )
83+
// {
84+
// std::cout << "----- " << pixelFormats[i] << " -----" << std::endl;
85+
// }
86+
87+
// options per format
88+
// std::map< std::string, std::vector<avtranscoder::Option> > optionsPerFormat = avtranscoder::getOutputFormatOptions();
89+
// for( std::map< std::string, std::vector<avtranscoder::Option> >::iterator it = optionsPerFormat.begin();
90+
// it != optionsPerFormat.end();
91+
// ++it )
92+
// {
93+
// std::cout << "----- " << it->first << " -----" << std::endl;
94+
// displayOptions( it->second );
95+
// }
7896
}
7997

8098
int main( int argc, char** argv )
8199
{
100+
std::cout << "start ..." << std::endl;
101+
82102
if( argc <= 1 )
83103
{
84104
std::cout << "audiorewrapper require a media filename" << std::endl;
85105
std::cout << "example: audioWrap file.ext" << std::endl;
86106
return( -1 );
87107
}
88108

89-
std::cout << "start ..." << std::endl;
90-
91109
try
92110
{
93111
optionChecker( argv[1] );

app/presetChecker/presetChecker.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ int main( int argc, char** argv )
2828
if( profile.find( avtranscoder::constants::avProfileType )->second == avtranscoder::constants::avProfileTypeVideo )
2929
{
3030
avtranscoder::AvOutputVideo outputVideo;
31-
outputVideo.setProfile( profile, outputVideo.getVideoDesc().getVideoFrameDesc() );
31+
outputVideo.setProfile( profile, outputVideo.getVideoCodec().getVideoFrameDesc() );
3232
}
3333

3434
if( profile.find( avtranscoder::constants::avProfileType )->second == avtranscoder::constants::avProfileTypeAudio )
3535
{
3636
avtranscoder::AvOutputAudio outputAudio;
37-
outputAudio.setProfile( profile, outputAudio.getAudioDesc().getFrameDesc() );
37+
outputAudio.setProfile( profile, outputAudio.getAudioCodec().getFrameDesc() );
3838
}
3939
}
4040
catch( ... )

cmake/FindFFmpeg.cmake

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,12 @@ macro(find_component COMPONENT PKGCONFIG LIBRARY HEADER)
4949

5050
find_path(${COMPONENT}_INCLUDE_DIR
5151
${HEADER}
52-
PATH ${PC_LIB${COMPONENT}_INCLUDEDIR} ${PC_LIB${COMPONENT}_INCLUDE_DIR}
53-
PATH_SUFFIXES ffmpeg libav
52+
HINTS ${PC_${COMPONENT}_INCLUDEDIR} ${PC_${COMPONENT}_INCLUDE_DIR}
5453
)
5554

5655
find_library(${COMPONENT}_LIBRARIES
5756
NAMES ${LIBRARY}
58-
PATH ${PC_LIB${COMPONENT}_LIBDIR} ${PC_LIB${COMPONENT}_LIBRARY_DIRS}
57+
HINTS ${PC_${COMPONENT}_LIBDIR} ${PC_${COMPONENT}_LIBRARY_DIRS}
5958
)
6059

6160
set(${COMPONENT}_DEFINITIONS ${PC_${COMPONENT}_CFLAGS_OTHER} CACHE STRING "The ${COMPONENT} CFLAGS.")

src/AvTranscoder/Library.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
#include "Library.hpp"
22

33
extern "C" {
4-
#ifndef __STDC_CONSTANT_MACROS
5-
#define __STDC_CONSTANT_MACROS
6-
#endif
74
#include <libavutil/version.h>
85
#include <libavcodec/version.h>
96
#include <libswscale/version.h>

src/AvTranscoder/avTranscoder.i

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,15 @@
1313
%{
1414
#include <AvTranscoder/Profile.hpp>
1515

16-
#include <AvTranscoder/essenceStructures/Pixel.hpp>
17-
#include <AvTranscoder/essenceStructures/Frame.hpp>
18-
#include <AvTranscoder/essenceStructures/VideoFrame.hpp>
19-
#include <AvTranscoder/essenceStructures/AudioFrame.hpp>
16+
#include <AvTranscoder/frame/Pixel.hpp>
17+
#include <AvTranscoder/frame/Frame.hpp>
18+
#include <AvTranscoder/frame/VideoFrame.hpp>
19+
#include <AvTranscoder/frame/AudioFrame.hpp>
2020

21-
#include <AvTranscoder/codedStructures/CodedDesc.hpp>
22-
#include <AvTranscoder/codedStructures/VideoDesc.hpp>
23-
#include <AvTranscoder/codedStructures/AudioDesc.hpp>
24-
#include <AvTranscoder/codedStructures/DataDesc.hpp>
25-
#include <AvTranscoder/codedStructures/DataStream.hpp>
21+
#include <AvTranscoder/codec/ICodec.hpp>
22+
#include <AvTranscoder/codec/VideoCodec.hpp>
23+
#include <AvTranscoder/codec/AudioCodec.hpp>
24+
#include <AvTranscoder/codec/DataCodec.hpp>
2625

2726
#include <AvTranscoder/mediaProperty/mediaProperty.hpp>
2827

@@ -66,17 +65,15 @@ namespace std {
6665

6766
%include <AvTranscoder/Profile.hpp>
6867

69-
%include <AvTranscoder/essenceStructures/Pixel.hpp>
70-
%include <AvTranscoder/essenceStructures/Frame.hpp>
71-
%include <AvTranscoder/essenceStructures/VideoFrame.hpp>
72-
%include <AvTranscoder/essenceStructures/AudioFrame.hpp>
73-
74-
%include <AvTranscoder/codedStructures/CodedDesc.hpp>
75-
%include <AvTranscoder/codedStructures/VideoDesc.hpp>
76-
%include <AvTranscoder/codedStructures/AudioDesc.hpp>
77-
%include <AvTranscoder/codedStructures/DataDesc.hpp>
78-
%include <AvTranscoder/codedStructures/DataStream.hpp>
68+
%include <AvTranscoder/frame/Pixel.hpp>
69+
%include <AvTranscoder/frame/Frame.hpp>
70+
%include <AvTranscoder/frame/VideoFrame.hpp>
71+
%include <AvTranscoder/frame/AudioFrame.hpp>
7972

73+
%include <AvTranscoder/codec/ICodec.hpp>
74+
%include <AvTranscoder/codec/VideoCodec.hpp>
75+
%include <AvTranscoder/codec/AudioCodec.hpp>
76+
%include <AvTranscoder/codec/DataCodec.hpp>
8077

8178
%include <AvTranscoder/mediaProperty/mediaProperty.hpp>
8279

0 commit comments

Comments
 (0)