Skip to content

Commit d59701c

Browse files
author
Clement Champetier
committed
file: add file util.hpp
* util contains enum EAnalyseLevel. * Use level of analyse when create VideoProperties while input file analysis.
1 parent 0068948 commit d59701c

File tree

7 files changed

+30
-14
lines changed

7 files changed

+30
-14
lines changed

app/avMeta/avMeta.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ int main( int argc, char** argv )
1616
avtranscoder::NoDisplayProgress p;
1717

1818
avtranscoder::InputFile input( argv[1] );
19-
input.analyse( p, avtranscoder::InputFile::eAnalyseLevelFull );
19+
input.analyse( p, avtranscoder::eAnalyseLevelFull );
2020

2121
// a simply metadata display
2222
std::cout << input;

src/AvTranscoder/file/InputFile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ InputFile& InputFile::analyse( IProgress& progress, const EAnalyseLevel level )
7979
{
8080
case AVMEDIA_TYPE_VIDEO:
8181
{
82-
_properties.getVideoProperties().push_back( VideoProperties( _formatContext, streamId, progress ) );
82+
_properties.getVideoProperties().push_back( VideoProperties( _formatContext, streamId, progress, level ) );
8383
break;
8484
}
8585
case AVMEDIA_TYPE_AUDIO:

src/AvTranscoder/file/InputFile.hpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#include <AvTranscoder/common.hpp>
55

6+
#include <AvTranscoder/file/util.hpp>
7+
68
#include <AvTranscoder/codec/AudioCodec.hpp>
79
#include <AvTranscoder/codec/VideoCodec.hpp>
810

@@ -34,12 +36,6 @@ class AvExport InputFile
3436

3537
virtual ~InputFile();
3638

37-
enum EAnalyseLevel
38-
{
39-
eAnalyseLevelFast = 0,
40-
eAnalyseLevelFull = 0,
41-
};
42-
4339
/**
4440
* @return Return the resource to access
4541
**/

src/AvTranscoder/file/util.hpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#ifndef _AV_TRANSCODER_FILE_UTIL_HPP_
2+
#define _AV_TRANSCODER_FILE_UTIL_HPP_
3+
4+
namespace avtranscoder
5+
{
6+
7+
/**
8+
* @brief Level of file analysis.
9+
*/
10+
enum EAnalyseLevel
11+
{
12+
eAnalyseLevelFast = 0,
13+
eAnalyseLevelFull = 0,
14+
};
15+
16+
}
17+
18+
#endif
19+

src/AvTranscoder/mediaProperty/VideoProperties.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ VideoProperties::VideoProperties()
2929
, _gopStructure()
3030
{}
3131

32-
VideoProperties::VideoProperties( const AVFormatContext* formatContext, const size_t index, IProgress& progress )
32+
VideoProperties::VideoProperties( const AVFormatContext* formatContext, const size_t index, IProgress& progress, const EAnalyseLevel level )
3333
: _formatContext( formatContext )
3434
, _codecContext( formatContext->streams[index]->codec )
3535
, _pixFmt( NULL )
@@ -50,9 +50,8 @@ VideoProperties::VideoProperties( const AVFormatContext* formatContext, const si
5050
_pixFmt = &av_pix_fmt_descriptors[ _codecContext->pix_fmt ];
5151
#endif
5252

53-
// Analyse GOP
54-
//if( level == eAnalyseLevelFull )
55-
analyseGopStructure( progress );
53+
if( level == eAnalyseLevelFull )
54+
analyseGopStructure( progress );
5655
}
5756

5857
std::string VideoProperties::getCodecName() const

src/AvTranscoder/mediaProperty/VideoProperties.hpp

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

44
#include <AvTranscoder/common.hpp>
55
#include <AvTranscoder/mediaProperty/util.hpp>
6+
#include <AvTranscoder/file/util.hpp>
67
#include <AvTranscoder/progress/IProgress.hpp>
78

89
extern "C" {
@@ -29,7 +30,7 @@ class AvExport VideoProperties
2930
{
3031
public:
3132
VideoProperties();
32-
VideoProperties( const AVFormatContext* formatContext, const size_t index, IProgress& progress );
33+
VideoProperties( const AVFormatContext* formatContext, const size_t index, IProgress& progress, const EAnalyseLevel level = eAnalyseLevelFull );
3334

3435
std::string getCodecName() const;
3536
std::string getCodecLongName() const;

src/AvTranscoder/transcoder/Transcoder.cpp

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

3+
#include <AvTranscoder/file/util.hpp>
34
#include <AvTranscoder/progress/NoDisplayProgress.hpp>
45

56
#include <limits>
@@ -383,7 +384,7 @@ void Transcoder::addTranscodeStream( const std::string& filename, const size_t s
383384

384385
// Create profile as input configuration
385386
NoDisplayProgress progress;
386-
referenceFile->analyse( progress, InputFile::eAnalyseLevelFast );
387+
referenceFile->analyse( progress, eAnalyseLevelFast );
387388
AudioProperties audioProperties = referenceFile->getProperties().getAudioProperties().at( streamIndex );
388389

389390
ProfileLoader::Profile profile;

0 commit comments

Comments
 (0)