[FFmpeg-devel,4/4] mjpeg: Use profile names in the encoder and decoder

Submitted by Vittorio Giovara on Nov. 2, 2018, 7:35 p.m.

Details

Message ID 20181102193540.64694-4-vittorio.giovara@gmail.com
State New
Headers show

Commit Message

Vittorio Giovara Nov. 2, 2018, 7:35 p.m.
---
 libavcodec/codec_desc.c | 1 +
 libavcodec/mjpegdec.c   | 2 ++
 libavcodec/profiles.c   | 9 +++++++++
 libavcodec/profiles.h   | 1 +
 libavcodec/version.h    | 2 +-
 5 files changed, 14 insertions(+), 1 deletion(-)

Comments

Carl Eugen Hoyos Nov. 2, 2018, 9:28 p.m.
2018-11-02 20:35 GMT+01:00, Vittorio Giovara <vittorio.giovara@gmail.com>:
> ---
>  libavcodec/codec_desc.c | 1 +
>  libavcodec/mjpegdec.c   | 2 ++
>  libavcodec/profiles.c   | 9 +++++++++
>  libavcodec/profiles.h   | 1 +
>  libavcodec/version.h    | 2 +-
>  5 files changed, 14 insertions(+), 1 deletion(-)

How does this patch affect the encoder?

Carl Eugen

Patch hide | download patch | download mbox

diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index ce6d265d13..7bf39862d2 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -81,6 +81,7 @@  static const AVCodecDescriptor codec_descriptors[] = {
         .long_name = NULL_IF_CONFIG_SMALL("Motion JPEG"),
         .props     = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
         .mime_types= MT("image/jpeg"),
+        .profiles  = NULL_IF_CONFIG_SMALL(ff_mjpeg_profiles),
     },
     {
         .id        = AV_CODEC_ID_MJPEGB,
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index b0cb3ffc83..96c425515a 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -43,6 +43,7 @@ 
 #include "mjpeg.h"
 #include "mjpegdec.h"
 #include "jpeglsdec.h"
+#include "profiles.h"
 #include "put_bits.h"
 #include "tiff.h"
 #include "exif.h"
@@ -2796,6 +2797,7 @@  AVCodec ff_mjpeg_decoder = {
     .capabilities   = AV_CODEC_CAP_DR1,
     .max_lowres     = 3,
     .priv_class     = &mjpegdec_class,
+    .profiles       = NULL_IF_CONFIG_SMALL(ff_mjpeg_profiles),
     .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE |
                       FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
     .hw_configs     = (const AVCodecHWConfigInternal*[]) {
diff --git a/libavcodec/profiles.c b/libavcodec/profiles.c
index 8a4447e438..e6f937fdb4 100644
--- a/libavcodec/profiles.c
+++ b/libavcodec/profiles.c
@@ -161,4 +161,13 @@  const AVProfile ff_prores_profiles[] = {
     { FF_PROFILE_UNKNOWN }
 };
 
+const AVProfile ff_mjpeg_profiles[] = {
+    { FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT,            "Baseline"    },
+    { FF_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT, "Sequential"  },
+    { FF_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT,         "Progressive" },
+    { FF_PROFILE_MJPEG_HUFFMAN_LOSSLESS,                "Lossless"    },
+    { FF_PROFILE_MJPEG_JPEG_LS,                         "JPEG LS"     },
+    { FF_PROFILE_UNKNOWN }
+};
+
 #endif /* !CONFIG_SMALL */
diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h
index 4669dad8d5..ab61e03e15 100644
--- a/libavcodec/profiles.h
+++ b/libavcodec/profiles.h
@@ -34,5 +34,6 @@  extern const AVProfile ff_vp9_profiles[];
 extern const AVProfile ff_av1_profiles[];
 extern const AVProfile ff_sbc_profiles[];
 extern const AVProfile ff_prores_profiles[];
+extern const AVProfile ff_mjpeg_profiles[];
 
 #endif /* AVCODEC_PROFILES_H */
diff --git a/libavcodec/version.h b/libavcodec/version.h
index d2ac30d4a8..068004ac9d 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@ 
 
 #define LIBAVCODEC_VERSION_MAJOR  58
 #define LIBAVCODEC_VERSION_MINOR  34
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MICRO 102
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \