-
Notifications
You must be signed in to change notification settings - Fork 50
Add Options #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
MarcAntoine-Arnaud
merged 25 commits into
avTranscoder:master
from
cchampet:dev_audioProcessing
Jun 16, 2014
Merged
Add Options #7
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
917de8d
InputStream and InputStreamAudio: refactoring
c20f6e5
Add Option: wrap the AVOption of libav / ffmpeg
dc070ad
Merge branch 'master' of https://github.com/MarcAntoine-Arnaud/avTran…
806ee1e
Option: add OptionBoolean
df26c04
Option: add OptionBoolean
f27a034
Option: add comments
42799de
Option: add OptionGroup
4be2b69
Option: add OptionChoice
71cf631
OptionGroup: add array of OptionBoolean
db23f05
OptionChoice: refactoring
a4d8b3b
Option: update comment
6d0bde8
Option2D: refactoring
6c91f89
Option2D: refactoring
0c766a8
Add OptionLoader: manage a list of Option
307a9d0
OptionLoader: add flags to loadOptions
d3a8c58
Option: delete Option subclasses
d011d69
Description: put functions on avtranscoder namespace
6c91e7a
Option: update getters
6bc55f5
OptionChecker: update display
163210e
OptionLoader: add format and codec context attributes
3a558d6
Description: update getInputExtensions
01cc980
Description: update getInputExtensions
37d8ea1
Description: fix getInputExtensions
f754f90
Description: add getOutputExtensions
d2bbcf8
AVInfo: display input / output extensions
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,22 @@ | ||
#include <iostream> | ||
#include <iomanip> | ||
|
||
#include <AvTranscoder/Description.hpp> | ||
|
||
int main( int argc, char** argv ) | ||
{ | ||
// std::cout << "avinfo" << std::endl; | ||
std::vector<std::string> inputExtension = getInputExtensions(); | ||
std::vector<std::string> outputExtension = getOutputExtensions(); | ||
std::vector<std::string> inputExtension = avtranscoder::getInputExtensions(); | ||
std::vector<std::string> outputExtension = avtranscoder::getOutputExtensions(); | ||
|
||
std::cout << "----- inputExtension -----" << std::endl; | ||
std::cout << "nb inputExtension: " << inputExtension.size() << std::endl; | ||
for( std::vector<std::string>::iterator it = inputExtension.begin(); it != inputExtension.end(); ++it ) | ||
std::cout << *it << std::endl; | ||
|
||
std::cout << "----- outputExtension -----" << std::endl; | ||
std::cout << "nb outputExtension: " << outputExtension.size() << std::endl; | ||
for( std::vector<std::string>::iterator it = outputExtension.begin(); it != outputExtension.end(); ++it ) | ||
std::cout << *it << std::endl; | ||
|
||
return 0; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#include <AvTranscoder/OptionLoader.hpp> | ||
#include <AvTranscoder/Option.hpp> | ||
|
||
#include <string> | ||
#include <iostream> | ||
#include <utility> //pair | ||
|
||
int optionChecker( const std::string& inputfilename ) | ||
{ | ||
avtranscoder::OptionLoader optionLoader; | ||
optionLoader.loadOptions( 0, 0 ); | ||
|
||
// display Options | ||
for( auto option : optionLoader.getOptions() ) | ||
{ | ||
std::cout << std::left; | ||
std::cout << "****************************" << std::endl; | ||
std::cout << "Name: " << option.getName() << std::endl; | ||
std::cout << "Unit : " << option.getUnit() << std::endl; | ||
std::cout << "Help: " << option.getHelp() << std::endl; | ||
std::cout << "Type: " << option.getType() << std::endl; | ||
|
||
// get default value | ||
|
||
if( option.getType() == avtranscoder::TypeInt ) | ||
{ | ||
std::cout << "DefaultValue: " << option.getDefaultValueInt() << std::endl; | ||
} | ||
else if( option.getType() == avtranscoder::TypeBool ) | ||
{ | ||
std::cout << "DefaultValue: " << option.getDefaultValueBool() << std::endl; | ||
} | ||
else if( option.getType() == avtranscoder::TypeDouble ) | ||
{ | ||
std::cout << "DefaultValue: " << option.getDefaultValueDouble() << std::endl; | ||
} | ||
else if( option.getType() == avtranscoder::TypeRatio ) | ||
{ | ||
std::cout << "DefaultValue: " << option.getDefaultValueRatio().first << ", " << option.getDefaultValueRatio().second << std::endl; | ||
} | ||
else if( option.getType() == avtranscoder::TypeString ) | ||
{ | ||
std::cout << "DefaultValue: " << option.getDefaultValueString() << std::endl; | ||
} | ||
else if( option.getType() == avtranscoder::TypeChoice ) | ||
{ | ||
std::cout << "Nb choices: " << option.getNbChilds() << std::endl; | ||
std::cout << "Default choice index: " << option.getDefaultChildIndex() << std::endl; | ||
for(size_t i = 0; i < option.getNbChilds(); ++i ) | ||
std::cout << "Choice " << i << ": " << | ||
option.getChild( i ).getName() << " // " << | ||
option.getChild( i ).getHelp() << std::endl; | ||
} | ||
else if( option.getType() == avtranscoder::TypeGroup ) | ||
{ | ||
std::cout << "Nb choices: " << option.getNbChilds() << std::endl; | ||
for(size_t i = 0; i < option.getNbChilds(); ++i ) | ||
std::cout << "Element " << i << ": " << | ||
option.getChild( i ).getName() << " // " << | ||
option.getChild( i ).getDefaultValueBool() << std::endl; | ||
} | ||
} | ||
} | ||
|
||
int main( int argc, char** argv ) | ||
{ | ||
if( argc <= 1 ) | ||
{ | ||
std::cout << "audiorewrapper require a media filename" << std::endl; | ||
std::cout << "example: audioWrap file.ext" << std::endl; | ||
return( -1 ); | ||
} | ||
|
||
std::cout << "start ..." << std::endl; | ||
|
||
try | ||
{ | ||
optionChecker( argv[1] ); | ||
} | ||
catch( std::exception &e ) | ||
{ | ||
std::cout << "[ERROR] " << e.what() << std::endl; | ||
} | ||
|
||
std::cout << "end ..." << std::endl; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,9 +24,6 @@ class AvExport InputStreamAudio | |
AVFrame* m_frame; | ||
|
||
int m_selectedStream; | ||
|
||
private: | ||
|
||
}; | ||
|
||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#include "Option.hpp" | ||
|
||
namespace avtranscoder | ||
{ | ||
|
||
Option::Option( const AVOption& avOption, OptionType type ) | ||
: m_avOption( avOption ) | ||
, m_type( type ) | ||
, m_options() | ||
, m_defaultChildIndex( 0 ) | ||
{ | ||
|
||
} | ||
|
||
OptionType Option::getTypeFromAVOption( const char* unit, AVOptionType avType ) | ||
{ | ||
if( unit && avType == AV_OPT_TYPE_FLAGS ) | ||
return TypeGroup; | ||
else if( unit && avType == AV_OPT_TYPE_INT ) | ||
return TypeChoice; | ||
else if( unit && avType == AV_OPT_TYPE_CONST ) | ||
return TypeChild; | ||
|
||
switch( avType ) | ||
{ | ||
case AV_OPT_TYPE_FLAGS: | ||
{ | ||
return TypeBool; | ||
} | ||
case AV_OPT_TYPE_INT: | ||
case AV_OPT_TYPE_INT64: | ||
{ | ||
return TypeInt; | ||
} | ||
case AV_OPT_TYPE_DOUBLE: | ||
case AV_OPT_TYPE_FLOAT: | ||
{ | ||
return TypeDouble; | ||
} | ||
case AV_OPT_TYPE_STRING: | ||
case AV_OPT_TYPE_BINARY: | ||
{ | ||
return TypeString; | ||
} | ||
case AV_OPT_TYPE_RATIONAL: | ||
{ | ||
return TypeRatio; | ||
} | ||
default: | ||
{ | ||
return TypeUnknown; | ||
} | ||
} | ||
return TypeUnknown; | ||
} | ||
|
||
OptionType Option::getType() const | ||
{ | ||
return m_type; | ||
} | ||
|
||
bool Option::getDefaultValueBool() const | ||
{ | ||
return m_avOption.default_val.i64; | ||
} | ||
|
||
int Option::getDefaultValueInt() const | ||
{ | ||
return m_avOption.default_val.i64; | ||
} | ||
|
||
double Option::getDefaultValueDouble() const | ||
{ | ||
return m_avOption.default_val.dbl; | ||
} | ||
|
||
std::string Option::getDefaultValueString() const | ||
{ | ||
return std::string( m_avOption.default_val.str ? m_avOption.default_val.str : "" ); | ||
} | ||
|
||
std::pair<int, int> Option::getDefaultValueRatio() const | ||
{ | ||
return std::pair<int, int>( m_avOption.default_val.q.num, m_avOption.default_val.q.den ); | ||
} | ||
|
||
void Option::appendChild( const Option& child ) | ||
{ | ||
m_options.push_back( child ); | ||
} | ||
|
||
} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add new line at the end of the file ...