Skip to content

Commit 234d96a

Browse files
committed
Merge pull request #227 from cchampet/dev_simplifyInputFileAPI
Simplify InputFile API
2 parents 0c33927 + 8edb8fa commit 234d96a

File tree

4 files changed

+20
-54
lines changed

4 files changed

+20
-54
lines changed

src/AvTranscoder/file/InputFile.cpp

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -126,42 +126,6 @@ InputStream& InputFile::getStream(size_t index)
126126
}
127127
}
128128

129-
std::string InputFile::getFormatName() const
130-
{
131-
if(_formatContext.getAVInputFormat().name == NULL)
132-
{
133-
LOG_WARN("Unknown demuxer format name of '" << _filename << "'.")
134-
return "";
135-
}
136-
return std::string(_formatContext.getAVInputFormat().name);
137-
}
138-
139-
std::string InputFile::getFormatLongName() const
140-
{
141-
if(_formatContext.getAVInputFormat().long_name == NULL)
142-
{
143-
LOG_WARN("Unknown demuxer format long name of '" << _filename << "'.")
144-
return "";
145-
}
146-
return std::string(_formatContext.getAVInputFormat().long_name);
147-
}
148-
149-
std::string InputFile::getFormatMimeType() const
150-
{
151-
#if LIBAVFORMAT_VERSION_MAJOR <= 55
152-
LOG_WARN("Cannot get mime type format of '" << _filename
153-
<< "' because your libavformat library has a major version <= 55.")
154-
return "not available";
155-
#else
156-
if(_formatContext.getAVInputFormat().mime_type == NULL)
157-
{
158-
LOG_WARN("Unknown demuxer format mime type of '" << _filename << "'.")
159-
return "";
160-
}
161-
return std::string(_formatContext.getAVInputFormat().mime_type);
162-
#endif
163-
}
164-
165129
double InputFile::getFps()
166130
{
167131
double fps = 1;
@@ -250,4 +214,4 @@ std::ostream& operator<<(std::ostream& flux, const InputFile& input)
250214

251215
return flux;
252216
}
253-
}
217+
}

src/AvTranscoder/file/InputFile.hpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -79,21 +79,6 @@ class AvExport InputFile
7979

8080
std::string getFilename() const { return _filename; }
8181

82-
/**
83-
* @brief A comma separated list of short names for the format, or empty if unknown.
84-
*/
85-
std::string getFormatName() const;
86-
87-
/**
88-
* @brief Descriptive name for the format, meant to be more human-readable than name, or empty if unknown.
89-
*/
90-
std::string getFormatLongName() const;
91-
92-
/**
93-
* @brief Comma-separated list of mime types, or empty if unknown.
94-
*/
95-
std::string getFormatMimeType() const;
96-
9782
FormatContext& getFormatContext() { return _formatContext; }
9883

9984
/**

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)