aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/dashenc.c
diff options
context:
space:
mode:
authorKarthick Jeyapal <kjeyapal@akamai.com>2018-05-14 11:21:46 +0530
committerKarthick Jeyapal <kjeyapal@akamai.com>2018-05-28 10:52:07 +0530
commitebf85d319087025585d31198ed691035267221b6 (patch)
tree92126625e002233e5d173408e5af8ff215e05e8b /libavformat/dashenc.c
parent2efdbf7367989cf9d296c25fa3d2aff8d6e25fdd (diff)
downloadffmpeg-ebf85d319087025585d31198ed691035267221b6.tar.gz
avformat/dashenc: Added a warning for incorrect segment name extension
Applicable only to webm output format. By default all the segment filenames end with .m4s extension. When someone chooses webm output format, we recommend they also override the relevant segment name options to end with .webm extension. This patch will issue a warning for he same
Diffstat (limited to 'libavformat/dashenc.c')
-rw-r--r--libavformat/dashenc.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 56af916555..a9b8b1d4f6 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -196,6 +196,16 @@ static const char *get_format_str(SegmentType segment_type) {
return NULL;
}
+static int check_file_extension(const char *filename, const char *extension) {
+ char *dot;
+ if (!filename || !extension)
+ return -1;
+ dot = strrchr(filename, '.');
+ if (dot && !strcmp(dot + 1, extension))
+ return 0;
+ return -1;
+}
+
static void set_vp9_codec_str(AVFormatContext *s, AVCodecParameters *par,
AVRational *frame_rate, char *str, int size) {
VPCC vpcc;
@@ -987,6 +997,17 @@ static int dash_init(AVFormatContext *s)
c->format_name = get_format_str(c->segment_type);
if (!c->format_name)
return AVERROR_MUXER_NOT_FOUND;
+ if (c->segment_type == SEGMENT_TYPE_WEBM) {
+ if ((!c->single_file && check_file_extension(c->init_seg_name, c->format_name) != 0) ||
+ (!c->single_file && check_file_extension(c->media_seg_name, c->format_name) != 0) ||
+ (c->single_file && check_file_extension(c->single_file_name, c->format_name) != 0)) {
+ av_log(s, AV_LOG_WARNING,
+ "One or many segment file names doesn't end with .webm. "
+ "Override -init_seg_name and/or -media_seg_name and/or "
+ "-single_file_name to end with the extension .webm\n");
+ }
+ }
+
ctx->oformat = av_guess_format(c->format_name, NULL, NULL);
if (!ctx->oformat)
return AVERROR_MUXER_NOT_FOUND;