Skip to content

Commit efd9d77

Browse files
author
Clement Champetier
committed
Common: add matchFormat
Check match between a format name and a filename.
1 parent 99f660f commit efd9d77

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/AvTranscoder/common.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,4 +172,11 @@ std::string getFormat( const std::string& filename )
172172
return format;
173173
}
174174

175+
bool matchFormat( const std::string& format, const std::string& filename )
176+
{
177+
AVOutputFormat* avOutputFormat = av_guess_format( format.c_str(), filename.c_str(), NULL);
178+
return avOutputFormat != NULL;
179+
}
180+
181+
175182
}

src/AvTranscoder/common.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,13 @@ class ParamSet
8282
void* _objContext;
8383
};
8484

85-
void split( std::vector< std::string >& splitedString, const std::string& inputString, const std::string& splitChars = ";" );
8685

86+
void split( std::vector< std::string >& splitedString, const std::string& inputString, const std::string& splitChars = ";" );
8787
int getFilesInDir( const std::string& dir, std::vector< std::string >& files );
8888

8989

9090
std::string getFormat( const std::string& filename );
91+
bool matchFormat( const std::string& format, const std::string& filename );
9192

9293
}
9394

0 commit comments

Comments
 (0)