From 92338e3d8046e8b7048b988731dc13f709aa0b24 Mon Sep 17 00:00:00 2001 From: Ludvig Rappe Date: Thu, 2 Sep 2021 11:55:09 +0200 Subject: [PATCH] pbutils: Add mjpg to MIME codecs Part-of: --- gst-libs/gst/pbutils/codec-utils.c | 4 ++++ tests/check/libs/pbutils.c | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/gst-libs/gst/pbutils/codec-utils.c b/gst-libs/gst/pbutils/codec-utils.c index 5d0f5655c2..8e06c4a489 100644 --- a/gst-libs/gst/pbutils/codec-utils.c +++ b/gst-libs/gst/pbutils/codec-utils.c @@ -2348,6 +2348,8 @@ done: * Useful for providing the 'codecs' field inside the 'Content-Type' HTTP * header for containerized formats, such as mp4 or matroska. * + * Registered codecs can be found at http://mp4ra.org/#/codecs + * * Returns: (transfer full): a RFC 6381 compatible codec string or %NULL * * Since: 1.20 @@ -2410,6 +2412,8 @@ gst_codec_utils_caps_get_mime_codec (GstCaps * caps) * available in the mime codec for vp9. This is documented in * https://www.webmproject.org/vp9/mp4/ */ mime_codec = g_strdup ("vp09"); + } else if (g_strcmp0 (media_type, "image/jpeg") == 0) { + mime_codec = g_strdup ("mjpg"); } else if (g_strcmp0 (media_type, "audio/mpeg") == 0) { guint8 audio_object_type = 0; if (aac_caps_structure_get_audio_object_type (caps_st, &audio_object_type)) { diff --git a/tests/check/libs/pbutils.c b/tests/check/libs/pbutils.c index e43c5b6799..e90f6b44d9 100644 --- a/tests/check/libs/pbutils.c +++ b/tests/check/libs/pbutils.c @@ -1406,6 +1406,13 @@ GST_START_TEST (test_pb_utils_caps_get_mime_codec) g_free (mime_codec); gst_caps_unref (caps); + /* mjpeg */ + caps = gst_caps_new_empty_simple ("image/jpeg"); + mime_codec = gst_codec_utils_caps_get_mime_codec (caps); + fail_unless_equals_string (mime_codec, "mjpg"); + g_free (mime_codec); + gst_caps_unref (caps); + /* aac without codec data */ caps = gst_caps_new_empty_simple ("audio/mpeg"); mime_codec = gst_codec_utils_caps_get_mime_codec (caps);