From 7ce08ae9a2e5c59d1e0ee1b79cdd88a43a3c6b0c Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Tue, 16 Feb 2016 15:59:16 +0100 Subject: [PATCH 1/2] InputFile: removed getFormatName/LonName/MimeType Will be found from getProperties method. --- src/AvTranscoder/file/InputFile.cpp | 38 +---------------------------- src/AvTranscoder/file/InputFile.hpp | 15 ------------ 2 files changed, 1 insertion(+), 52 deletions(-) diff --git a/src/AvTranscoder/file/InputFile.cpp b/src/AvTranscoder/file/InputFile.cpp index 433a7baa..439a8ced 100644 --- a/src/AvTranscoder/file/InputFile.cpp +++ b/src/AvTranscoder/file/InputFile.cpp @@ -126,42 +126,6 @@ InputStream& InputFile::getStream(size_t index) } } -std::string InputFile::getFormatName() const -{ - if(_formatContext.getAVInputFormat().name == NULL) - { - LOG_WARN("Unknown demuxer format name of '" << _filename << "'.") - return ""; - } - return std::string(_formatContext.getAVInputFormat().name); -} - -std::string InputFile::getFormatLongName() const -{ - if(_formatContext.getAVInputFormat().long_name == NULL) - { - LOG_WARN("Unknown demuxer format long name of '" << _filename << "'.") - return ""; - } - return std::string(_formatContext.getAVInputFormat().long_name); -} - -std::string InputFile::getFormatMimeType() const -{ -#if LIBAVFORMAT_VERSION_MAJOR <= 55 - LOG_WARN("Cannot get mime type format of '" << _filename - << "' because your libavformat library has a major version <= 55.") - return "not available"; -#else - if(_formatContext.getAVInputFormat().mime_type == NULL) - { - LOG_WARN("Unknown demuxer format mime type of '" << _filename << "'.") - return ""; - } - return std::string(_formatContext.getAVInputFormat().mime_type); -#endif -} - double InputFile::getFps() { double fps = 1; @@ -250,4 +214,4 @@ std::ostream& operator<<(std::ostream& flux, const InputFile& input) return flux; } -} \ No newline at end of file +} diff --git a/src/AvTranscoder/file/InputFile.hpp b/src/AvTranscoder/file/InputFile.hpp index 396ebfff..50f7b970 100644 --- a/src/AvTranscoder/file/InputFile.hpp +++ b/src/AvTranscoder/file/InputFile.hpp @@ -79,21 +79,6 @@ class AvExport InputFile std::string getFilename() const { return _filename; } - /** - * @brief A comma separated list of short names for the format, or empty if unknown. - */ - std::string getFormatName() const; - - /** - * @brief Descriptive name for the format, meant to be more human-readable than name, or empty if unknown. - */ - std::string getFormatLongName() const; - - /** - * @brief Comma-separated list of mime types, or empty if unknown. - */ - std::string getFormatMimeType() const; - FormatContext& getFormatContext() { return _formatContext; } /** From 8edb8fab09b560dc26ff08f0136e12b909d2488c Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Tue, 16 Feb 2016 15:59:33 +0100 Subject: [PATCH 2/2] FileProperties: added getFormatMimeType --- src/AvTranscoder/properties/FileProperties.cpp | 16 ++++++++++++++++ src/AvTranscoder/properties/FileProperties.hpp | 5 +++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/AvTranscoder/properties/FileProperties.cpp b/src/AvTranscoder/properties/FileProperties.cpp index a59f51ce..c18083fe 100644 --- a/src/AvTranscoder/properties/FileProperties.cpp +++ b/src/AvTranscoder/properties/FileProperties.cpp @@ -145,6 +145,22 @@ std::string FileProperties::getFormatLongName() const return _avFormatContext->iformat->long_name; } +std::string FileProperties::getFormatMimeType() const +{ +#if LIBAVFORMAT_VERSION_MAJOR <= 55 + LOG_WARN("Cannot get mime type format of '" << getFilename() + << "' because your libavformat library has a major version <= 55.") + return "not available"; +#else + if(_avFormatContext->iformat->mime_type == NULL) + { + LOG_WARN("Unknown demuxer format mime type of '" << getFilename() << "'.") + return ""; + } + return std::string(_avFormatContext->iformat->mime_type); +#endif +} + size_t FileProperties::getProgramsCount() const { if(!_avFormatContext) diff --git a/src/AvTranscoder/properties/FileProperties.hpp b/src/AvTranscoder/properties/FileProperties.hpp index 264e7708..f311cb0b 100644 --- a/src/AvTranscoder/properties/FileProperties.hpp +++ b/src/AvTranscoder/properties/FileProperties.hpp @@ -39,8 +39,9 @@ class AvExport FileProperties void extractStreamProperties(IProgress& progress, const EAnalyseLevel level); std::string getFilename() const; - std::string getFormatName() const; ///< A comma separated list of short names for the format - std::string getFormatLongName() const; + std::string getFormatName() const; ///< A comma separated list of short names for the format, or empty if unknown. + std::string getFormatLongName() const; ///< Descriptive name for the format, meant to be more human-readable than name, or empty if unknown. + std::string getFormatMimeType() const; ///< Comma-separated list of mime types, or empty if unknown. size_t getProgramsCount() const; double getStartTime() const;