Skip to content

Commit 8edb8fa

Browse files
author
Clement Champetier
committed
FileProperties: added getFormatMimeType
1 parent 7ce08ae commit 8edb8fa

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/AvTranscoder/properties/FileProperties.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,22 @@ std::string FileProperties::getFormatLongName() const
145145
return _avFormatContext->iformat->long_name;
146146
}
147147

148+
std::string FileProperties::getFormatMimeType() const
149+
{
150+
#if LIBAVFORMAT_VERSION_MAJOR <= 55
151+
LOG_WARN("Cannot get mime type format of '" << getFilename()
152+
<< "' because your libavformat library has a major version <= 55.")
153+
return "not available";
154+
#else
155+
if(_avFormatContext->iformat->mime_type == NULL)
156+
{
157+
LOG_WARN("Unknown demuxer format mime type of '" << getFilename() << "'.")
158+
return "";
159+
}
160+
return std::string(_avFormatContext->iformat->mime_type);
161+
#endif
162+
}
163+
148164
size_t FileProperties::getProgramsCount() const
149165
{
150166
if(!_avFormatContext)

src/AvTranscoder/properties/FileProperties.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ class AvExport FileProperties
3939
void extractStreamProperties(IProgress& progress, const EAnalyseLevel level);
4040

4141
std::string getFilename() const;
42-
std::string getFormatName() const; ///< A comma separated list of short names for the format
43-
std::string getFormatLongName() const;
42+
std::string getFormatName() const; ///< A comma separated list of short names for the format, or empty if unknown.
43+
std::string getFormatLongName() const; ///< Descriptive name for the format, meant to be more human-readable than name, or empty if unknown.
44+
std::string getFormatMimeType() const; ///< Comma-separated list of mime types, or empty if unknown.
4445

4546
size_t getProgramsCount() const;
4647
double getStartTime() const;

0 commit comments

Comments
 (0)