Skip to content

Commit 0c12ba6

Browse files
Merge branch 'develop' into dev_audioTranscoder
Conflicts: app/SConscript
2 parents b5641a6 + df00ae9 commit 0c12ba6

File tree

6 files changed

+103
-4
lines changed

6 files changed

+103
-4
lines changed

app/SConscript

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ env = Environment().Clone()
99

1010
Import( 'env' )
1111

12+
avinfo = env.Program(
13+
'avinfo',
14+
Glob( 'avInfo/*.cpp' ),
15+
LIBS = [
16+
sAvTranscoder,
17+
'avutil',
18+
'avformat',
19+
'avcodec',
20+
'swscale',
21+
]
22+
)
23+
1224
avmeta = env.Program(
1325
'avmeta',
1426
Glob( 'avMeta/*.cpp' ),
@@ -45,6 +57,7 @@ audioRewrapper = env.Program(
4557
]
4658
)
4759

60+
env.Depends( avinfo, sAvTranscoder )
4861
env.Depends( avmeta, sAvTranscoder )
4962
env.Depends( audioRewrapper, sAvTranscoder )
5063

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+
}

app/avMeta/avMeta.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,17 @@ void displayMetadatas( const char* filename )
6464
std::cout << std::setw( keyWidth ) << "height" << ": " << input.getProperties().videoStreams.at(videoStreamIndex).height << std::endl;
6565
std::cout << std::setw( keyWidth ) << "dtgActiveFormat" << ": " << input.getProperties().videoStreams.at(videoStreamIndex).dtgActiveFormat << std::endl;
6666

67+
68+
std::cout << std::setw( keyWidth ) << "start timecode" << ": " << input.getProperties().videoStreams.at(videoStreamIndex).startTimecode << std::endl;
6769
std::cout << std::setw( keyWidth ) << "timeBase" << ": " << input.getProperties().videoStreams.at(videoStreamIndex).timeBase.num << "/" <<
68-
input.getProperties().videoStreams.at(videoStreamIndex).timeBase.den << std::endl;
70+
input.getProperties().videoStreams.at(videoStreamIndex).timeBase.den << std::endl;
6971
std::cout << std::setw( keyWidth ) << "fps" << ": " << input.getProperties().videoStreams.at(videoStreamIndex).fps << std::endl;
7072
std::cout << std::setw( keyWidth ) << "ticksPerFrame" << ": " << input.getProperties().videoStreams.at(videoStreamIndex).ticksPerFrame << std::endl;
7173

7274
std::cout << std::setw( keyWidth ) << "pixel aspect ratio" << ": " << input.getProperties().videoStreams.at(videoStreamIndex).sar.num << "/" <<
73-
input.getProperties().videoStreams.at(videoStreamIndex).sar.den << std::endl;
75+
input.getProperties().videoStreams.at(videoStreamIndex).sar.den << std::endl;
7476
std::cout << std::setw( keyWidth ) << "display aspect ratio" << ": " << input.getProperties().videoStreams.at(videoStreamIndex).dar.num << "/" <<
75-
input.getProperties().videoStreams.at(videoStreamIndex).dar.den << std::endl;
77+
input.getProperties().videoStreams.at(videoStreamIndex).dar.den << std::endl;
7678
std::cout << std::setw( keyWidth ) << "pixel type" << ": " << input.getProperties().videoStreams.at(videoStreamIndex).pixelName << std::endl;
7779
std::cout << std::setw( keyWidth ) << "bit wise acked" << ": " << ( input.getProperties().videoStreams.at(videoStreamIndex).bitWisePacked ? "True" : "False" ) << std::endl;
7880
std::cout << std::setw( keyWidth ) << "rgb pixel" << ": " << ( input.getProperties().videoStreams.at(videoStreamIndex).rgbPixelData ? "True" : "False" ) << std::endl;
@@ -81,6 +83,7 @@ void displayMetadatas( const char* filename )
8183

8284
std::cout << std::setw( keyWidth ) << "bit rate" << ": " << input.getProperties().videoStreams.at(videoStreamIndex).bitRate << std::endl;
8385
std::cout << std::setw( keyWidth ) << "max bit rate" << ": " << input.getProperties().videoStreams.at(videoStreamIndex).maxBitRate << std::endl;
86+
std::cout << std::setw( keyWidth ) << "min bit rate" << ": " << input.getProperties().videoStreams.at(videoStreamIndex).minBitRate << std::endl;
8487

8588
std::cout << std::setw( keyWidth ) << "color transfert" << ": " << input.getProperties().videoStreams.at(videoStreamIndex).colorTransfert << std::endl;
8689
std::cout << std::setw( keyWidth ) << "colorspace" << ": " << input.getProperties().videoStreams.at(videoStreamIndex).colorspace << std::endl;

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+

src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ struct VideoProperties {
3131
std::string pixelName;
3232
std::string endianess;
3333

34+
std::string startTimecode;
35+
3436
Ratio timeBase;
3537
Ratio sar; // sample/pixel aspect ratio
3638
Ratio dar; // display aspect ratio
@@ -39,6 +41,7 @@ struct VideoProperties {
3941
size_t codecId;
4042
size_t bitRate;
4143
size_t maxBitRate;
44+
size_t minBitRate;
4245
size_t ticksPerFrame;
4346
size_t width;
4447
size_t height;

src/AvTranscoder/Metadatas/VideoStreamProperties.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ VideoProperties videoStreamInfo( AVFormatContext* formatContext, const size_t in
8787
vp.codecId = codec_context->codec_id;
8888
vp.bitRate = codec_context->bit_rate;
8989
vp.maxBitRate = codec_context->rc_max_rate;
90+
vp.minBitRate = codec_context->rc_min_rate;
9091
vp.isInterlaced = false;
9192

9293
vp.ticksPerFrame = codec_context->ticks_per_frame,
@@ -103,6 +104,12 @@ VideoProperties videoStreamInfo( AVFormatContext* formatContext, const size_t in
103104
vp.sar.num = codec_context->sample_aspect_ratio.num;
104105
vp.sar.den = codec_context->sample_aspect_ratio.den;
105106

107+
108+
//char tcbuf[AV_TIMECODE_STR_SIZE];
109+
//av_timecode_make_mpeg_tc_string( tcbuf, codec_context->timecode_frame_start );
110+
//std::string videoTimecode( tcbuf );
111+
//vp.startTimecode = videoTimecode;
112+
106113
int darNum, darDen;
107114
av_reduce( &darNum, &darDen,
108115
codec_context->width * codec_context->sample_aspect_ratio.num,
@@ -296,4 +303,4 @@ VideoProperties videoStreamInfo( AVFormatContext* formatContext, const size_t in
296303

297304
}
298305

299-
#endif
306+
#endif

0 commit comments

Comments
 (0)