Skip to content

Commit 1b0f75f

Browse files
author
Clement Champetier
committed
InputFile/OutputFile: add log and return empty if format parameters are unknown
1 parent f18ebae commit 1b0f75f

File tree

4 files changed

+30
-12
lines changed

4 files changed

+30
-12
lines changed

src/AvTranscoder/file/InputFile.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,20 @@ InputStream& InputFile::getStream( size_t index )
120120
std::string InputFile::getFormatName() const
121121
{
122122
if( _formatContext.getAVInputFormat().name == NULL )
123-
return "unknown";
123+
{
124+
LOG_WARN("Unknown demuxer format name of '" << _filename << "'.")
125+
return "";
126+
}
124127
return std::string(_formatContext.getAVInputFormat().name);
125128
}
126129

127130
std::string InputFile::getFormatLongName() const
128131
{
129132
if( _formatContext.getAVInputFormat().long_name == NULL )
130-
return "unknown";
133+
{
134+
LOG_WARN("Unknown demuxer format long name of '" << _filename << "'.")
135+
return "";
136+
}
131137
return std::string(_formatContext.getAVInputFormat().long_name);
132138
}
133139

@@ -138,7 +144,10 @@ std::string InputFile::getFormatMimeType() const
138144
return "not available";
139145
#else
140146
if( _formatContext.getAVInputFormat().mime_type == NULL )
141-
return "unknown";
147+
{
148+
LOG_WARN("Unknown demuxer format mime type of '" << _filename << "'.")
149+
return "";
150+
}
142151
return std::string(_formatContext.getAVInputFormat().mime_type);
143152
#endif
144153
}

src/AvTranscoder/file/InputFile.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,17 @@ class AvExport InputFile
7878
std::string getFilename() const { return _filename; }
7979

8080
/**
81-
* @brief A comma separated list of short names for the format, or unknown.
81+
* @brief A comma separated list of short names for the format, or empty if unknown.
8282
*/
8383
std::string getFormatName() const;
8484

8585
/**
86-
* @brief Descriptive name for the format, meant to be more human-readable than name, or unknown.
86+
* @brief Descriptive name for the format, meant to be more human-readable than name, or empty if unknown.
8787
*/
8888
std::string getFormatLongName() const;
8989

9090
/**
91-
* @brief Comma-separated list of mime types, or unknown.
91+
* @brief Comma-separated list of mime types, or empty if unknown.
9292
*/
9393
std::string getFormatMimeType() const;
9494

src/AvTranscoder/file/OutputFile.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,21 +88,30 @@ IOutputStream& OutputFile::getStream( const size_t streamId )
8888
std::string OutputFile::getFormatName() const
8989
{
9090
if( _formatContext.getAVOutputFormat().name == NULL )
91-
return "unknown";
91+
{
92+
LOG_WARN("Unknown muxer format name of '" << _filename << "'.")
93+
return "";
94+
}
9295
return std::string(_formatContext.getAVOutputFormat().name);
9396
}
9497

9598
std::string OutputFile::getFormatLongName() const
9699
{
97100
if( _formatContext.getAVOutputFormat().long_name == NULL )
98-
return "unknown";
101+
{
102+
LOG_WARN("Unknown muxer format long name of '" << _filename << "'.")
103+
return "";
104+
}
99105
return std::string(_formatContext.getAVOutputFormat().long_name);
100106
}
101107

102108
std::string OutputFile::getFormatMimeType() const
103109
{
104110
if( _formatContext.getAVOutputFormat().mime_type == NULL )
105-
return "unknown";
111+
{
112+
LOG_WARN("Unknown muxer format mime type of '" << _filename << "'.")
113+
return "";
114+
}
106115
return std::string(_formatContext.getAVOutputFormat().mime_type);
107116
}
108117

src/AvTranscoder/file/OutputFile.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,17 @@ class AvExport OutputFile : public IOutputFile
5757
std::string getFilename() const { return _filename; }
5858

5959
/**
60-
* @brief A comma separated list of short names for the format, or unknown.
60+
* @brief A comma separated list of short names for the format, or empty if unknown.
6161
*/
6262
std::string getFormatName() const;
6363

6464
/**
65-
* @brief Descriptive name for the format, meant to be more human-readable than name, or unknown.
65+
* @brief Descriptive name for the format, meant to be more human-readable than name, or empty if unknown.
6666
*/
6767
std::string getFormatLongName() const;
6868

6969
/**
70-
* @brief Comma-separated list of mime types, or unknown.
70+
* @brief Comma-separated list of mime types, or empty if unknown.
7171
*/
7272
std::string getFormatMimeType() const;
7373

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy