Skip to content

Commit c202c51

Browse files
adding more informations about versions
1 parent 265083c commit c202c51

File tree

3 files changed

+81
-9
lines changed

3 files changed

+81
-9
lines changed

app/avInfo/avInfo.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
11
#include <iostream>
2+
#include <iomanip>
3+
#include <sstream>
24

35
#include <AvTranscoder/Description.hpp>
46

57
int main( int argc, char** argv )
68
{
9+
avtranscoder::AvVersions versions( avtranscoder::getVersion() );
10+
11+
for( avtranscoder::AvVersions::iterator libVersion = versions.begin(); libVersion != versions.end(); ++libVersion )
12+
{
13+
std::cout << std::left << std::setw( 15 ) << (*libVersion).first;
14+
std::cout << std::left << std::setw( 30 ) << avtranscoder::getLicence();
15+
16+
std::stringstream completeVersion;
17+
for( std::vector<size_t>::iterator version = (*libVersion).second.begin(); version != (*libVersion).second.end(); ++version )
18+
{
19+
completeVersion << *version << ".";
20+
}
21+
std::cout << completeVersion.str() << std::endl;
22+
}
23+
724
// std::cout << "avinfo" << std::endl;
825
std::vector<std::string> inputExtension = avtranscoder::getInputExtensions();
926
std::vector<std::string> outputExtension = avtranscoder::getOutputExtensions();

src/AvTranscoder/Description.cpp

Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,15 @@ extern "C" {
44
#ifndef __STDC_CONSTANT_MACROS
55
#define __STDC_CONSTANT_MACROS
66
#endif
7+
#include <libavutil/version.h>
8+
#include <libavcodec/version.h>
9+
#include <libswscale/version.h>
10+
#ifdef AV_RESAMPLE_LIBRARY
11+
#include <libavresample/version.h>
12+
#else
13+
#include <libswresample/version.h>
14+
#endif
715
#include <libavformat/avformat.h>
8-
#include <libavutil/avstring.h>
916
}
1017

1118
#include <cstring>
@@ -14,17 +21,61 @@ extern "C" {
1421
namespace avtranscoder
1522
{
1623

17-
std::vector<size_t> getVersion()
24+
std::map< std::string, std::vector<size_t> > getVersion()
1825
{
19-
std::vector<size_t> version;
20-
version.push_back( 0 );
21-
version.push_back( 0 );
22-
version.push_back( 0 );
23-
// avutil_version
24-
// avutil_license
26+
std::map< std::string, std::vector<size_t> > version;
27+
28+
std::vector<size_t> avutilVersion;
29+
avutilVersion.push_back( LIBAVUTIL_VERSION_MAJOR );
30+
avutilVersion.push_back( LIBAVUTIL_VERSION_MINOR );
31+
avutilVersion.push_back( LIBAVUTIL_VERSION_MICRO );
32+
33+
std::vector<size_t> avformatVersion;
34+
avformatVersion.push_back( LIBAVFORMAT_VERSION_MAJOR );
35+
avformatVersion.push_back( LIBAVFORMAT_VERSION_MINOR );
36+
avformatVersion.push_back( LIBAVFORMAT_VERSION_MICRO );
37+
38+
std::vector<size_t> avcodecVersion;
39+
avcodecVersion.push_back( LIBAVCODEC_VERSION_MAJOR );
40+
avcodecVersion.push_back( LIBAVCODEC_VERSION_MINOR );
41+
avcodecVersion.push_back( LIBAVCODEC_VERSION_MICRO );
42+
43+
std::vector<size_t> swscaleVersion;
44+
swscaleVersion.push_back( LIBSWSCALE_VERSION_MAJOR );
45+
swscaleVersion.push_back( LIBSWSCALE_VERSION_MINOR );
46+
swscaleVersion.push_back( LIBSWSCALE_VERSION_MICRO );
47+
48+
#ifdef AV_RESAMPLE_LIBRARY
49+
std::vector<size_t> avresampleVersion;
50+
avresampleVersion.push_back( LIBAVRESAMPLE_VERSION_MAJOR );
51+
avresampleVersion.push_back( LIBAVRESAMPLE_VERSION_MINOR );
52+
avresampleVersion.push_back( LIBAVRESAMPLE_VERSION_MICRO );
53+
#else
54+
std::vector<size_t> swresampleVersion;
55+
swresampleVersion.push_back( LIBSWRESAMPLE_VERSION_MAJOR );
56+
swresampleVersion.push_back( LIBRESAMPLE_VERSION_MINOR );
57+
swresampleVersion.push_back( LIBRESAMPLE_VERSION_MICRO );
58+
#endif
59+
60+
version[ "avutil" ] = avutilVersion;
61+
version[ "avformat" ] = avformatVersion;
62+
version[ "avcodec" ] = avcodecVersion;
63+
version[ "swscale" ] = swscaleVersion;
64+
#ifdef AV_RESAMPLE_LIBRARY
65+
version[ "avresample" ] = avresampleVersion;
66+
#else
67+
version[ "swresample" ] = swresampleVersion;
68+
#endif
69+
2570
return version;
2671
}
2772

73+
std::string getLicence()
74+
{
75+
std::string licence( avutil_license() );
76+
return licence;
77+
}
78+
2879
std::vector<std::string> getInputExtensions()
2980
{
3081
av_register_all();

src/AvTranscoder/Description.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@
33

44
#include <vector>
55
#include <string>
6+
#include <map>
67

78
#include "common.hpp"
89

910
namespace avtranscoder
1011
{
1112

12-
std::vector<size_t> getVersion();
13+
typedef std::map< std::string, std::vector<size_t> > AvVersions;
14+
15+
AvVersions getVersion();
16+
std::string getLicence();
1317

1418
std::vector<std::string> getInputExtensions();
1519

0 commit comments

Comments
 (0)