diff mbox series

[FFmpeg-devel,06/15] avformat/matroskaenc: Hoist check out of loop

Message ID AS8P250MB0744C429A088A0095F6BAF6D8F0DA@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 43db0e5ecfb90264e49c5e7d7c60f0ecc62de1a9
Headers show
Series [FFmpeg-devel,1/5] avformat/matroskaenc: Support rotations | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt Aug. 8, 2023, 4:40 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/matroskaenc.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Andreas Rheinhardt Aug. 10, 2023, 7:48 a.m. UTC | #1
Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavformat/matroskaenc.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index be70e7a6f1..d9bc31daee 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -1877,9 +1877,13 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
>  
>          // look for a codec ID string specific to mkv to use,
>          // if none are found, use AVI codes
> -        if (par->codec_id != AV_CODEC_ID_RAWVIDEO || par->codec_tag) {
> +        if (par->codec_id == AV_CODEC_ID_FFV1) {
> +            /* FFV1 is actually supported natively in Matroska,
> +             * yet we use the VfW way to mux it for compatibility
> +             * with old demuxers. (FIXME: Are they really important?) */
> +        } else if (par->codec_id != AV_CODEC_ID_RAWVIDEO || par->codec_tag) {
>              for (j = 0; ff_mkv_codec_tags[j].id != AV_CODEC_ID_NONE; j++) {
> -                if (ff_mkv_codec_tags[j].id == par->codec_id && par->codec_id != AV_CODEC_ID_FFV1) {
> +                if (ff_mkv_codec_tags[j].id == par->codec_id) {
>                      put_ebml_string(pb, MATROSKA_ID_CODECID, ff_mkv_codec_tags[j].str);
>                      native_id = 1;
>                      break;

Will apply the rest of this patchset tomorrow unless there are objections.

- Andreas
diff mbox series

Patch

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index be70e7a6f1..d9bc31daee 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1877,9 +1877,13 @@  static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
 
         // look for a codec ID string specific to mkv to use,
         // if none are found, use AVI codes
-        if (par->codec_id != AV_CODEC_ID_RAWVIDEO || par->codec_tag) {
+        if (par->codec_id == AV_CODEC_ID_FFV1) {
+            /* FFV1 is actually supported natively in Matroska,
+             * yet we use the VfW way to mux it for compatibility
+             * with old demuxers. (FIXME: Are they really important?) */
+        } else if (par->codec_id != AV_CODEC_ID_RAWVIDEO || par->codec_tag) {
             for (j = 0; ff_mkv_codec_tags[j].id != AV_CODEC_ID_NONE; j++) {
-                if (ff_mkv_codec_tags[j].id == par->codec_id && par->codec_id != AV_CODEC_ID_FFV1) {
+                if (ff_mkv_codec_tags[j].id == par->codec_id) {
                     put_ebml_string(pb, MATROSKA_ID_CODECID, ff_mkv_codec_tags[j].str);
                     native_id = 1;
                     break;