Skip to content

Commit 7c4a9d0

Browse files
author
Clement Champetier
committed
Merge branch 'develop' of https://github.com/mikrosimage/avTranscoder into dev_videoProfile_with_no_frameRate
2 parents 70c5695 + 09244f7 commit 7c4a9d0

File tree

11 files changed

+21
-11
lines changed

11 files changed

+21
-11
lines changed

src/AvTranscoder/Library.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ Libraries getLibraries()
9191

9292
std::vector<std::string> getInputExtensions()
9393
{
94-
av_register_all();
9594
std::vector<std::string> extensions;
9695
AVInputFormat* iFormat = NULL;
9796

@@ -130,7 +129,6 @@ std::vector<std::string> getInputExtensions()
130129

131130
std::vector<std::string> getOutputExtensions()
132131
{
133-
av_register_all();
134132
std::vector<std::string> extensions;
135133
AVOutputFormat* oFormat = NULL;
136134

src/AvTranscoder/codec/ICodec.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ ICodec::ICodec( const ECodecType type, const std::string& codecName )
1616
, _isCodecContextAllocated( true )
1717
, _type( type )
1818
{
19-
avcodec_register_all(); // TODO: call only once
20-
2119
setCodec( type, codecName );
2220
allocateContext();
2321
loadCodecOptions();
@@ -29,8 +27,6 @@ ICodec::ICodec( const ECodecType type, const AVCodecID codecId )
2927
, _isCodecContextAllocated( true )
3028
, _type( type )
3129
{
32-
avcodec_register_all(); // TODO: call only once
33-
3430
setCodec( type, codecId );
3531
allocateContext();
3632
loadCodecOptions();

src/AvTranscoder/common.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ extern "C" {
1212
namespace avtranscoder
1313
{
1414

15+
void preloadCodecsAndFormats()
16+
{
17+
av_register_all();
18+
}
19+
1520
void split( std::vector< std::string >& splitedString, const std::string& inputString, const std::string& splitChars )
1621
{
1722
char* part = strtok( const_cast<char*>( inputString.c_str() ), splitChars.c_str() );
@@ -47,7 +52,6 @@ std::string getFormat( const std::string& filename )
4752
{
4853
std::string format( "" );
4954

50-
av_register_all();
5155
AVOutputFormat* avOutputFormat = av_guess_format( NULL, filename.c_str(), NULL);
5256
if( avOutputFormat )
5357
{

src/AvTranscoder/common.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ namespace avtranscoder
5656

5757
typedef AVRational Rational;
5858

59+
/// Register all the codecs and formats which are enabled at configuration time.
60+
void preloadCodecsAndFormats();
61+
5962
#ifndef SWIG
6063
void split( std::vector< std::string >& splitedString, const std::string& inputString, const std::string& splitChars = ";" );
6164
int getFilesInDir( const std::string& dir, std::vector< std::string >& files );

src/AvTranscoder/file/FormatContext.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ FormatContext::FormatContext( const std::string& filename, int req_flags )
1212
, _options()
1313
, _isOpen( true )
1414
{
15-
av_register_all(); // TODO: call it once
16-
1715
int ret = avformat_open_input( &_avFormatContext, filename.c_str(), NULL, NULL );
1816
if( ret < 0 )
1917
{
@@ -33,8 +31,6 @@ FormatContext::FormatContext( int req_flags )
3331
, _options()
3432
, _isOpen( false )
3533
{
36-
av_register_all(); // TODO: call it once
37-
3834
_avFormatContext = avformat_alloc_context();
3935
loadOptions( _options, _avFormatContext, req_flags );
4036
}

test/pyTest/testProperties.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
from pyAvTranscoder import avtranscoder as av
66

7+
av.preloadCodecsAndFormats()
8+
79

810
def testAddMetadataDate():
911
"""

test/pyTest/testSetFrame.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
from pyAvTranscoder import avtranscoder as av
66

7+
av.preloadCodecsAndFormats()
8+
79

810
def testSetVideoFrame():
911
"""

test/pyTest/testTranscoderAdd.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
from pyAvTranscoder import avtranscoder as av
66

7+
av.preloadCodecsAndFormats()
8+
79

810
def testAddStreamTranscoder():
911
"""

test/pyTest/testTranscoderDummy.py

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

33
from pyAvTranscoder import avtranscoder as av
44

5+
av.preloadCodecsAndFormats()
6+
57

68
@raises(RuntimeError)
79
def testTranscodeNoStream():

test/pyTest/testTranscoderRewrap.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
from pyAvTranscoder import avtranscoder as av
66

7+
av.preloadCodecsAndFormats()
8+
9+
710
def testRewrapAudioStream():
811
"""
912
Rewrap one audio stream.

0 commit comments

Comments
 (0)