1
- #include < iostream>
2
- #include < iomanip>
3
-
4
- #include < AvTranscoder/InputStream.hpp>
5
- #include < AvTranscoder/InputStreamAudio.hpp>
6
- #include < AvTranscoder/InputStreamVideo.hpp>
7
- #include < AvTranscoder/OutputStream.hpp>
8
- #include < AvTranscoder/OutputStreamAudio.hpp>
9
- #include < AvTranscoder/OutputStreamVideo.hpp>
10
1
#include < AvTranscoder/InputFile.hpp>
11
- #include < AvTranscoder/OutputFile.hpp>
12
-
13
- #include < AvTranscoder/ColorTransform.hpp>
14
-
15
- #include < AvTranscoder/DatasStructures/VideoDesc.hpp>
16
- #include < AvTranscoder/DatasStructures/Image.hpp>
17
-
18
- void displayMetadatas ( const char * filename )
19
- {
20
- using namespace avtranscoder ;
21
-
22
- std::string separator ( " ====================" );
23
- size_t keyWidth = 32 ;
24
-
25
-
26
- InputFile input ( filename );
27
- input.analyse ();
28
- std::cout << std::left;
29
- std::cout << separator << " Wrapper " << separator << std::endl;
30
- std::cout << std::setw ( keyWidth ) << " filename" << " : " << input.getProperties ().filename << std::endl;
31
- std::cout << std::setw ( keyWidth ) << " format name" << " : " << input.getProperties ().formatName << std::endl;
32
- std::cout << std::setw ( keyWidth ) << " format long name" << " : " << input.getProperties ().formatLongName << std::endl;
33
- std::cout << std::setw ( keyWidth ) << " start time" << " : " << input.getProperties ().startTime << std::endl;
34
- std::cout << std::setw ( keyWidth ) << " duration" << " : " << input.getProperties ().duration << std::endl;
35
- std::cout << std::setw ( keyWidth ) << " bitrate" << " : " << input.getProperties ().bitRate << std::endl;
36
- std::cout << std::setw ( keyWidth ) << " number of streams" << " : " << input.getProperties ().streamsCount << std::endl;
37
- std::cout << std::setw ( keyWidth ) << " number of programs" << " : " << input.getProperties ().programsCount << std::endl;
38
- std::cout << std::setw ( keyWidth ) << " number of video streams" << " : " << input.getProperties ().videoStreams .size () << std::endl;
39
- std::cout << std::setw ( keyWidth ) << " number of audio streams" << " : " << input.getProperties ().audioStreams .size () << std::endl;
40
- std::cout << std::setw ( keyWidth ) << " number of data streams" << " : " << input.getProperties ().dataStreams .size () << std::endl;
41
- std::cout << std::setw ( keyWidth ) << " number of subtitle streams" << " : " << input.getProperties ().subtitleStreams .size () << std::endl;
42
- std::cout << std::setw ( keyWidth ) << " number of attachement streams" << " : " << input.getProperties ().attachementStreams .size () << std::endl;
43
- std::cout << std::setw ( keyWidth ) << " number of unknown streams" << " : " << input.getProperties ().unknownStreams .size () << std::endl;
44
-
45
-
46
- // std::vector< std::pair< std::string, std::string > > metadatas
47
- std::cout << separator << " Metadatas " << separator << std::endl;
48
- for ( size_t metadataIndex = 0 ; metadataIndex < input.getProperties ().metadatas .size (); ++metadataIndex )
49
- {
50
- std::cout << std::setw ( keyWidth ) << input.getProperties ().metadatas .at (metadataIndex).first << " : " << input.getProperties ().metadatas .at (metadataIndex).second << std::endl;
51
- }
2
+ #include < AvTranscoder/Metadatas/Print.hpp>
52
3
53
- for ( size_t videoStreamIndex = 0 ; videoStreamIndex < input.getProperties ().videoStreams .size (); ++videoStreamIndex )
54
- {
55
- std::cout << separator << " Video stream " << videoStreamIndex << " " << separator << std::endl;
56
- std::cout << std::setw ( keyWidth ) << " codec name" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).codecName << std::endl;
57
- std::cout << std::setw ( keyWidth ) << " codec long name" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).codecLongName << std::endl;
58
- std::cout << std::setw ( keyWidth ) << " codec id" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).codecId << std::endl;
59
- std::cout << std::setw ( keyWidth ) << " stream id" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).streamId << std::endl;
60
- std::cout << std::setw ( keyWidth ) << " profile name" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).profileName << std::endl;
61
- std::cout << std::setw ( keyWidth ) << " profile" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).profile << std::endl;
62
- std::cout << std::setw ( keyWidth ) << " level" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).level << std::endl;
63
- std::cout << std::setw ( keyWidth ) << " width" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).width << std::endl;
64
- std::cout << std::setw ( keyWidth ) << " height" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).height << std::endl;
65
- std::cout << std::setw ( keyWidth ) << " dtgActiveFormat" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).dtgActiveFormat << std::endl;
66
-
67
-
68
- std::cout << std::setw ( keyWidth ) << " start timecode" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).startTimecode << std::endl;
69
- std::cout << std::setw ( keyWidth ) << " timeBase" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).timeBase .num << " /" <<
70
- input.getProperties ().videoStreams .at (videoStreamIndex).timeBase .den << std::endl;
71
- std::cout << std::setw ( keyWidth ) << " fps" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).fps << std::endl;
72
- std::cout << std::setw ( keyWidth ) << " ticksPerFrame" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).ticksPerFrame << std::endl;
73
-
74
- std::cout << std::setw ( keyWidth ) << " pixel aspect ratio" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).sar .num << " /" <<
75
- input.getProperties ().videoStreams .at (videoStreamIndex).sar .den << std::endl;
76
- std::cout << std::setw ( keyWidth ) << " display aspect ratio" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).dar .num << " /" <<
77
- input.getProperties ().videoStreams .at (videoStreamIndex).dar .den << std::endl;
78
- std::cout << std::setw ( keyWidth ) << " pixel type" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).pixelName << std::endl;
79
- std::cout << std::setw ( keyWidth ) << " bit wise acked" << " : " << ( input.getProperties ().videoStreams .at (videoStreamIndex).bitWisePacked ? " True" : " False" ) << std::endl;
80
- std::cout << std::setw ( keyWidth ) << " rgb pixel" << " : " << ( input.getProperties ().videoStreams .at (videoStreamIndex).rgbPixelData ? " True" : " False" ) << std::endl;
81
- std::cout << std::setw ( keyWidth ) << " as alpha" << " : " << ( input.getProperties ().videoStreams .at (videoStreamIndex).asAlpha ? " True" : " False" ) << std::endl;
82
- std::cout << std::setw ( keyWidth ) << " endianess" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).endianess << std::endl;
83
-
84
- std::cout << std::setw ( keyWidth ) << " bit rate" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).bitRate << std::endl;
85
- 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;
87
-
88
- std::cout << std::setw ( keyWidth ) << " color transfert" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).colorTransfert << std::endl;
89
- std::cout << std::setw ( keyWidth ) << " colorspace" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).colorspace << std::endl;
90
- std::cout << std::setw ( keyWidth ) << " color range" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).colorRange << std::endl;
91
- std::cout << std::setw ( keyWidth ) << " color primaries" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).colorPrimaries << std::endl;
92
- std::cout << std::setw ( keyWidth ) << " indexed colors" << " : " << ( input.getProperties ().videoStreams .at (videoStreamIndex).indexedColors ? " True" : " False" ) << std::endl;
93
- std::cout << std::setw ( keyWidth ) << " pseudo paletted" << " : " << ( input.getProperties ().videoStreams .at (videoStreamIndex).pseudoPaletted ? " True" : " False" ) << std::endl;
94
- std::cout << std::setw ( keyWidth ) << " components count" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).componentsCount << std::endl;
95
- std::cout << std::setw ( keyWidth ) << " chroma width" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).chromaWidth << std::endl;
96
- std::cout << std::setw ( keyWidth ) << " chroma height" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).chromaHeight << std::endl;
97
- std::cout << std::setw ( keyWidth ) << " chroma sample location" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).chromaSampleLocation << std::endl;
98
- std::cout << std::setw ( keyWidth ) << " interlaced " << " : " << ( input.getProperties ().videoStreams .at (videoStreamIndex).isInterlaced ? " True" : " False" ) << std::endl;
99
- std::cout << std::setw ( keyWidth ) << " top field first" << " : " << ( input.getProperties ().videoStreams .at (videoStreamIndex).topFieldFirst ? " True" : " False" ) << std::endl;
100
- std::cout << std::setw ( keyWidth ) << " field order" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).fieldOrder << std::endl;
101
- std::cout << std::setw ( keyWidth ) << " gop size" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).gopSize << std::endl;
102
- std::cout << std::setw ( keyWidth ) << " has B frames" << " : " << ( input.getProperties ().videoStreams .at (videoStreamIndex).hasBFrames ? " True" : " False" ) << std::endl;
103
-
104
- std::cout << std::setw ( keyWidth ) << " gop" << " : " ;
105
- for ( size_t frameIndex = 0 ; frameIndex < input.getProperties ().videoStreams .at (videoStreamIndex).gopStructure .size (); ++frameIndex )
106
- {
107
- std::cout << input.getProperties ().videoStreams .at (videoStreamIndex).gopStructure .at ( frameIndex ).first ;
108
- std::cout << ( input.getProperties ().videoStreams .at (videoStreamIndex).gopStructure .at ( frameIndex ).second ? " *" : " " );
109
- }
110
- std::cout << std::endl;
111
- std::cout << std::setw ( keyWidth ) << " references frames" << " : " << input.getProperties ().videoStreams .at (videoStreamIndex).referencesFrames << std::endl;
112
-
113
- }
114
- for ( size_t audioStreamIndex = 0 ; audioStreamIndex < input.getProperties ().audioStreams .size (); ++audioStreamIndex )
115
- {
116
- std::cout << separator << " Audio stream " << audioStreamIndex << " " << separator << std::endl;
117
- std::cout << std::setw ( keyWidth ) << " codec name" << " : " << input.getProperties ().audioStreams .at (audioStreamIndex).codecName << std::endl;
118
- std::cout << std::setw ( keyWidth ) << " codec long name" << " : " << input.getProperties ().audioStreams .at (audioStreamIndex).codecLongName << std::endl;
119
- std::cout << std::setw ( keyWidth ) << " sample format" << " : " << input.getProperties ().audioStreams .at (audioStreamIndex).sampleFormat << std::endl;
120
- std::cout << std::setw ( keyWidth ) << " codec id" << " : " << input.getProperties ().audioStreams .at (audioStreamIndex).codecId << std::endl;
121
- std::cout << std::setw ( keyWidth ) << " stream id" << " : " << input.getProperties ().audioStreams .at (audioStreamIndex).streamId << std::endl;
122
- std::cout << std::setw ( keyWidth ) << " sample rate" << " : " << input.getProperties ().audioStreams .at (audioStreamIndex).sampleRate << std::endl;
123
- std::cout << std::setw ( keyWidth ) << " channels" << " : " << input.getProperties ().audioStreams .at (audioStreamIndex).channels << std::endl;
124
- std::cout << std::setw ( keyWidth ) << " bit rate" << " : " << input.getProperties ().audioStreams .at (audioStreamIndex).bit_rate << std::endl;
125
- }
126
- for ( size_t dataStreamIndex = 0 ; dataStreamIndex < input.getProperties ().dataStreams .size (); ++dataStreamIndex )
127
- {
128
- std::cout << separator << " Data stream " << dataStreamIndex << " " << separator << std::endl;
129
- std::cout << std::setw ( keyWidth ) << " stream id" << " : " << input.getProperties ().dataStreams .at (dataStreamIndex).streamId << std::endl;
130
- }
131
- }
4
+ #include < iostream>
132
5
133
6
int main ( int argc, char ** argv )
134
7
{
@@ -138,6 +11,9 @@ int main( int argc, char** argv )
138
11
return ( -1 );
139
12
}
140
13
141
- // a simply metadata getter
142
- displayMetadatas ( argv[1 ] );
14
+ avtranscoder::InputFile input ( argv[1 ] );
15
+ input.analyse ();
16
+
17
+ // a simply metadata display
18
+ displayMetadatas ( input );
143
19
}
0 commit comments