diff mbox series

[FFmpeg-devel,2/2] avformat/isom: move some condition checks outside of loop

Message ID 20200627032308.14A5168B1AF@ffbox0-bg.mplayerhq.hu
State New
Headers show
Series [FFmpeg-devel,1/2] avformat/isom: update mov_mdhd_language_map | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Zhao Zhili June 27, 2020, 3:22 a.m. UTC
---
 libavformat/isom.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/isom.c b/libavformat/isom.c
index e34d3f2195..bddcd6364f 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -430,9 +430,11 @@  int ff_mov_iso639_to_lang(const char lang[4], int mp4)
     int i, code = 0;
 
     /* old way, only for QT? */
-    for (i = 0; lang[0] && !mp4 && i < FF_ARRAY_ELEMS(mov_mdhd_language_map); i++) {
-        if (!strcmp(lang, mov_mdhd_language_map[i]))
-            return i;
+    if (lang[0] && !mp4) {
+        for (i = 0; i < FF_ARRAY_ELEMS(mov_mdhd_language_map); i++) {
+            if (!strcmp(lang, mov_mdhd_language_map[i]))
+                return i;
+        }
     }
     /* XXX:can we do that in mov too? */
     if (!mp4)