mirror of https://git.ffmpeg.org/ffmpeg.git
avformat/dashenc: Simplify getting format string
A switch is simpler than a lookup over a table with three entries, only two of which can happen at all. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
e4ab1b8f70
commit
c95cdf871c
|
@ -217,16 +217,6 @@ static const struct codec_string {
|
||||||
{ AV_CODEC_ID_NONE, NULL }
|
{ AV_CODEC_ID_NONE, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct format_string {
|
|
||||||
SegmentType segment_type;
|
|
||||||
const char *str;
|
|
||||||
} formats[] = {
|
|
||||||
{ SEGMENT_TYPE_AUTO, "auto" },
|
|
||||||
{ SEGMENT_TYPE_MP4, "mp4" },
|
|
||||||
{ SEGMENT_TYPE_WEBM, "webm" },
|
|
||||||
{ 0, NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
static int dashenc_io_open(AVFormatContext *s, AVIOContext **pb, char *filename,
|
static int dashenc_io_open(AVFormatContext *s, AVIOContext **pb, char *filename,
|
||||||
AVDictionary **options) {
|
AVDictionary **options) {
|
||||||
DASHContext *c = s->priv_data;
|
DASHContext *c = s->priv_data;
|
||||||
|
@ -265,11 +255,12 @@ static void dashenc_io_close(AVFormatContext *s, AVIOContext **pb, char *filenam
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *get_format_str(SegmentType segment_type) {
|
static const char *get_format_str(SegmentType segment_type)
|
||||||
int i;
|
{
|
||||||
for (i = 0; i < SEGMENT_TYPE_NB; i++)
|
switch (segment_type) {
|
||||||
if (formats[i].segment_type == segment_type)
|
case SEGMENT_TYPE_MP4: return "mp4";
|
||||||
return formats[i].str;
|
case SEGMENT_TYPE_WEBM: return "webm";
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue