diff mbox series

[FFmpeg-devel] avformat/dashenc: use av_match_ext()

Message ID 1623408115-16922-1-git-send-email-lance.lmwang@gmail.com
State Accepted
Commit f21626b67b157e5ae117d3e8ef0326776da42077
Headers show
Series [FFmpeg-devel] avformat/dashenc: use av_match_ext() | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Lance Wang June 11, 2021, 10:41 a.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavformat/dashenc.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

Comments

Jeyapal, Karthick June 14, 2021, 3:53 p.m. UTC | #1
From: Limin Wang <lance.lmwang@gmail.com>
>
>Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
>---
>libavformat/dashenc.c | 16 +++-------------
>1 file changed, 3 insertions(+), 13 deletions(-)
Pushed.

Thanks,
Karthick
>
>diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
>index 8a626c1..b7622bc 100644
>--- a/libavformat/dashenc.c
>+++ b/libavformat/dashenc.c
>@@ -330,16 +330,6 @@ static int init_segment_types(AVFormatContext *s)
>     return 0;
>}
>
>-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;
>@@ -1530,9 +1520,9 @@ static int dash_init(AVFormatContext *s)
>         }
>
>         if (os->segment_type == SEGMENT_TYPE_WEBM) {
>-            if ((!c->single_file && check_file_extension(os->init_seg_name, os->format_name) != >0) ||
>-                (!c->single_file && check_file_extension(os->media_seg_name, os->format_name) >!= 0) ||
>-                (c->single_file && check_file_extension(os->single_file_name, os->format_name) >!= 0)) {
>+            if ((!c->single_file && !av_match_ext(os->init_seg_name, os->format_name))  ||
>+                (!c->single_file && !av_match_ext(os->media_seg_name, os->format_name)) ||
>+                ( c->single_file && !av_match_ext(os->single_file_name, os->format_name))) {
>                 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 "
>-- 
>1.8.3.1
>
>_______________________________________________
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>
>To unsubscribe, visit link above, or email
>ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
diff mbox series

Patch

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 8a626c1..b7622bc 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -330,16 +330,6 @@  static int init_segment_types(AVFormatContext *s)
     return 0;
 }
 
-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;
@@ -1530,9 +1520,9 @@  static int dash_init(AVFormatContext *s)
         }
 
         if (os->segment_type == SEGMENT_TYPE_WEBM) {
-            if ((!c->single_file && check_file_extension(os->init_seg_name, os->format_name) != 0) ||
-                (!c->single_file && check_file_extension(os->media_seg_name, os->format_name) != 0) ||
-                (c->single_file && check_file_extension(os->single_file_name, os->format_name) != 0)) {
+            if ((!c->single_file && !av_match_ext(os->init_seg_name, os->format_name))  ||
+                (!c->single_file && !av_match_ext(os->media_seg_name, os->format_name)) ||
+                ( c->single_file && !av_match_ext(os->single_file_name, os->format_name))) {
                 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 "