Skip to content

Commit df00ae9

Browse files
adding LibAV/FFMpeg dynamic version getter
1 parent 1aa162d commit df00ae9

File tree

3 files changed

+86
-0
lines changed

3 files changed

+86
-0
lines changed

app/SConscript

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,20 @@ avtransform = env.Program(
3333
]
3434
)
3535

36+
avinfo = env.Program(
37+
'avinfo',
38+
Glob( 'avInfo/*.cpp' ),
39+
LIBS = [
40+
sAvTranscoder,
41+
'avutil',
42+
'avformat',
43+
'avcodec',
44+
'swscale',
45+
]
46+
)
47+
3648
env.Depends( avmeta, sAvTranscoder )
49+
env.Depends( avinfo, sAvTranscoder )
3750

3851
env.Alias( "install", env.Install(os.path.join( installPrefix, "bin" ), avmeta ) )
3952
env.Alias( "install", env.Install(os.path.join( installPrefix, "bin" ), avtransform ) )

app/avInfo/avInfo.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include <iostream>
2+
#include <iomanip>
3+
4+
#include <AvTranscoder/Description.hpp>
5+
6+
int main( int argc, char** argv )
7+
{
8+
// std::cout << "avinfo" << std::endl;
9+
std::vector<std::string> inputExtension = getInputExtensions();
10+
std::vector<std::string> outputExtension = getOutputExtensions();
11+
return 0;
12+
}

src/AvTranscoder/Description.hpp

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#ifndef _AV_TRANSCODER_DESCRIPTION_HPP_
2+
#define _AV_TRANSCODER_DESCRIPTION_HPP_
3+
4+
extern "C" {
5+
#ifndef __STDC_CONSTANT_MACROS
6+
#define __STDC_CONSTANT_MACROS
7+
#endif
8+
#include <libavformat/avformat.h>
9+
#include <libavutil/avstring.h>
10+
}
11+
12+
#include <vector>
13+
14+
std::vector<size_t> getVersion()
15+
{
16+
std::vector<size_t> version;
17+
version.push_back( 0 );
18+
version.push_back( 0 );
19+
version.push_back( 0 );
20+
// avutil_version
21+
// avutil_license
22+
return version;
23+
}
24+
25+
std::vector<std::string> getInputExtensions()
26+
{
27+
av_register_all(); // Warning: should be called only once
28+
std::vector<std::string> extensions;
29+
AVInputFormat* iFormat = av_iformat_next( NULL );
30+
while( iFormat != NULL )
31+
{
32+
if( iFormat->extensions != NULL )
33+
{
34+
const char* exts = iFormat->extensions;
35+
while( 1 )
36+
{
37+
char* saveptr = NULL;
38+
char* ext = av_strtok( const_cast<char*>( exts ), ",", &saveptr );
39+
if( ! ext || ! saveptr )
40+
{
41+
break;
42+
}
43+
extensions.push_back( std::string( ext ) );
44+
}
45+
}
46+
iFormat = av_iformat_next( iFormat );
47+
}
48+
return extensions;
49+
}
50+
51+
std::vector<std::string> getOutputExtensions()
52+
{
53+
std::vector<std::string> extensions;
54+
55+
return extensions;
56+
}
57+
58+
59+
60+
#endif
61+

0 commit comments

Comments
 (0)