|
1 |
| -#include <AvTranscoder/option/OptionLoader.hpp> |
| 1 | +#include <AvTranscoder/util.hpp> |
| 2 | +#include <AvTranscoder/option/Context.hpp> |
2 | 3 | #include <AvTranscoder/option/Option.hpp>
|
3 | 4 |
|
| 5 | +extern "C" { |
| 6 | +#ifndef __STDC_CONSTANT_MACROS |
| 7 | + #define __STDC_CONSTANT_MACROS |
| 8 | +#endif |
| 9 | +#include <libavformat/avformat.h> |
| 10 | +} |
| 11 | + |
4 | 12 | #include <string>
|
5 | 13 | #include <iostream>
|
6 | 14 | #include <map>
|
7 | 15 | #include <vector>
|
8 |
| -#include <utility> //pair |
| 16 | +#include <utility> |
9 | 17 |
|
10 |
| -void displayOptions( avtranscoder::OptionLoader::OptionArray& options ) |
| 18 | +void displayOptions( std::vector<avtranscoder::Option>& options ) |
11 | 19 | {
|
12 | 20 | for( auto option : options )
|
13 | 21 | {
|
@@ -60,37 +68,39 @@ void displayOptions( avtranscoder::OptionLoader::OptionArray& options )
|
60 | 68 | }
|
61 | 69 | }
|
62 | 70 |
|
63 |
| -void optionChecker( const std::string& inputfilename ) |
64 |
| -{ |
65 |
| - avtranscoder::OptionLoader optionLoader; |
66 |
| - |
67 |
| - //avtranscoder::OptionLoader::OptionArray optionsArray = optionLoader.loadOptions( AV_OPT_FLAG_AUDIO_PARAM ); |
68 |
| - avtranscoder::OptionLoader::OptionMap optionsMap = optionLoader.loadOutputFormatOptions(); |
69 |
| - |
70 |
| - //displayOptions( optionsArray ); |
71 |
| - for( avtranscoder::OptionLoader::OptionMap::iterator it = optionsMap.begin(); |
72 |
| - it != optionsMap.end(); |
73 |
| - ++it ) |
74 |
| - { |
75 |
| - std::cout << "----- " << it->first << " -----" << std::endl; |
76 |
| - displayOptions( it->second ); |
77 |
| - } |
| 71 | +void optionChecker() |
| 72 | +{ |
| 73 | + // format options |
| 74 | + AVFormatContext* avFormatContext = avformat_alloc_context(); |
| 75 | + avtranscoder::Context formatContext( avFormatContext ); |
| 76 | + std::vector<avtranscoder::Option> formatOptions = formatContext.getOptions(); |
| 77 | + displayOptions( formatOptions ); |
| 78 | + |
| 79 | + // pixel formats |
| 80 | +// std::vector<std::string> pixelFormats = avtranscoder::getPixelFormats(); |
| 81 | +// for( size_t i = 0; i < pixelFormats.size(); ++i ) |
| 82 | +// { |
| 83 | +// std::cout << "----- " << pixelFormats[i] << " -----" << std::endl; |
| 84 | +// } |
| 85 | + |
| 86 | + // options per format |
| 87 | +// std::map< std::string, std::vector<avtranscoder::Option> > optionsPerFormat = avtranscoder::getOutputFormatOptions(); |
| 88 | +// for( std::map< std::string, std::vector<avtranscoder::Option> >::iterator it = optionsPerFormat.begin(); |
| 89 | +// it != optionsPerFormat.end(); |
| 90 | +// ++it ) |
| 91 | +// { |
| 92 | +// std::cout << "----- " << it->first << " -----" << std::endl; |
| 93 | +// displayOptions( it->second ); |
| 94 | +// } |
78 | 95 | }
|
79 | 96 |
|
80 | 97 | int main( int argc, char** argv )
|
81 | 98 | {
|
82 |
| - if( argc <= 1 ) |
83 |
| - { |
84 |
| - std::cout << "audiorewrapper require a media filename" << std::endl; |
85 |
| - std::cout << "example: audioWrap file.ext" << std::endl; |
86 |
| - return( -1 ); |
87 |
| - } |
88 |
| - |
89 | 99 | std::cout << "start ..." << std::endl;
|
90 | 100 |
|
91 | 101 | try
|
92 | 102 | {
|
93 |
| - optionChecker( argv[1] ); |
| 103 | + optionChecker(); |
94 | 104 | }
|
95 | 105 | catch( std::exception &e )
|
96 | 106 | {
|
|
0 commit comments