summaryrefslogtreecommitdiff
path: root/libavformat/dashenc.c
diff options
context:
space:
mode:
authorAlfred E. Heggestad <alfred.heggestad@gmail.com>2019-06-24 12:50:34 +0200
committerKarthick J <kjeyapal@akamai.com>2019-06-25 15:07:44 +0530
commit2b634e7c23f9e51a5e457985cd116cba5962f552 (patch)
treead418a5e74436adb3d1a27e3d99d8ccdac24b1c6 /libavformat/dashenc.c
parentdd662bbdd26e09957b3e67d3cde07b9468931e15 (diff)
avformat/dashenc: split extension for MP4 into .mp4 or .m4s
Diffstat (limited to 'libavformat/dashenc.c')
-rw-r--r--libavformat/dashenc.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 3fd7e78166..b25afb40aa 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -89,6 +89,7 @@ typedef struct OutputStream {
int bit_rate;
SegmentType segment_type; /* segment type selected for this particular stream */
const char *format_name;
+ const char *extension_name;
const char *single_file_name; /* file names selected for this particular stream */
const char *init_seg_name;
const char *media_seg_name;
@@ -217,6 +218,16 @@ static const char *get_format_str(SegmentType segment_type) {
return NULL;
}
+static const char *get_extension_str(SegmentType type, int single_file)
+{
+ switch (type) {
+
+ case SEGMENT_TYPE_MP4: return single_file ? "mp4" : "m4s";
+ case SEGMENT_TYPE_WEBM: return "webm";
+ default: return NULL;
+ }
+}
+
static int handle_io_open_error(AVFormatContext *s, int err, char *url) {
DASHContext *c = s->priv_data;
char errbuf[AV_ERROR_MAX_STRING_SIZE];
@@ -254,6 +265,12 @@ static int init_segment_types(AVFormatContext *s)
av_log(s, AV_LOG_ERROR, "Could not select DASH segment type for stream %d\n", i);
return AVERROR_MUXER_NOT_FOUND;
}
+ os->extension_name = get_extension_str(segment_type, c->single_file);
+ if (!os->extension_name) {
+ av_log(s, AV_LOG_ERROR, "Could not get extension type for stream %d\n", i);
+ return AVERROR_MUXER_NOT_FOUND;
+ }
+
has_mp4_streams |= segment_type == SEGMENT_TYPE_MP4;
}
@@ -1179,17 +1196,17 @@ static int dash_init(AVFormatContext *s)
return AVERROR(ENOMEM);
if (c->init_seg_name) {
- os->init_seg_name = av_strireplace(c->init_seg_name, "$ext$", os->format_name);
+ os->init_seg_name = av_strireplace(c->init_seg_name, "$ext$", os->extension_name);
if (!os->init_seg_name)
return AVERROR(ENOMEM);
}
if (c->media_seg_name) {
- os->media_seg_name = av_strireplace(c->media_seg_name, "$ext$", os->format_name);
+ os->media_seg_name = av_strireplace(c->media_seg_name, "$ext$", os->extension_name);
if (!os->media_seg_name)
return AVERROR(ENOMEM);
}
if (c->single_file_name) {
- os->single_file_name = av_strireplace(c->single_file_name, "$ext$", os->format_name);
+ os->single_file_name = av_strireplace(c->single_file_name, "$ext$", os->extension_name);
if (!os->single_file_name)
return AVERROR(ENOMEM);
}