dashsink: Use gst_codec_utils_caps_get_mime_codec()

Use gst_codec_utils_caps_get_mime_codec() in pbutils for codec
strings. That function gives more elaborate RFC 6381 compatible
strings than the helper functions in gstmdphelper.c, such as
"avc1.F4000D".

Remove the helper functions, as they were only used from dashsink.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5404>
This commit is contained in:
David Svensson Fors 2023-09-20 09:53:41 +02:00 committed by GStreamer Marge Bot
parent 3901984621
commit 82a06a36cc
3 changed files with 3 additions and 63 deletions

View file

@ -723,23 +723,20 @@ gst_dash_sink_get_stream_metadata (GstDashSink * sink,
GST_DEBUG_OBJECT (sink, "stream caps %s", gst_caps_to_string (caps));
s = gst_caps_get_structure (caps, 0);
g_free (stream->codec);
stream->codec = gst_codec_utils_caps_get_mime_codec (caps);
switch (stream->type) {
case DASH_SINK_STREAM_TYPE_VIDEO:
{
gst_structure_get_int (s, "width", &stream->info.video.width);
gst_structure_get_int (s, "height", &stream->info.video.height);
g_free (stream->codec);
stream->codec =
g_strdup (gst_mpd_helper_get_video_codec_from_mime (caps));
break;
}
case DASH_SINK_STREAM_TYPE_AUDIO:
{
gst_structure_get_int (s, "channels", &stream->info.audio.channels);
gst_structure_get_int (s, "rate", &stream->info.audio.rate);
g_free (stream->codec);
stream->codec =
g_strdup (gst_mpd_helper_get_audio_codec_from_mime (caps));
break;
}
case DASH_SINK_STREAM_TYPE_SUBTITLE:

View file

@ -78,61 +78,6 @@ gst_mpd_helper_get_SAP_type (xmlNode * a_node,
return exists;
}
const gchar *
gst_mpd_helper_get_audio_codec_from_mime (GstCaps * caps)
{
GstStructure *s;
const gchar *name = "";
const gchar *codec_name = NULL;
if (!caps)
return NULL;
s = gst_caps_get_structure (caps, 0);
if (!s)
goto done;
name = gst_structure_get_name (s);
if (!g_strcmp0 (name, "audio/mpeg")) {
gint mpeg_version;
if (gst_structure_get_int (s, "mpegversion", &mpeg_version)) {
if (mpeg_version == 4)
return "mp4a";
}
} else {
GST_DEBUG ("No codecs for this caps name %s", name);
}
done:
return codec_name;
}
const gchar *
gst_mpd_helper_get_video_codec_from_mime (GstCaps * caps)
{
GstStructure *s;
const gchar *name = "";
const gchar *codec_name = NULL;
if (!caps)
return NULL;
s = gst_caps_get_structure (caps, 0);
if (!s)
goto done;
name = gst_structure_get_name (s);
if (!g_strcmp0 (name, "video/x-h264")) {
return "avc1";
} else if (!g_strcmp0 (name, "video/x-h265")) {
return "hvc1";
} else {
GST_DEBUG ("No codecs for this caps name %s", name);
}
done:
return codec_name;
}
const gchar *
gst_mpd_helper_mimetype_to_caps (const gchar * mimeType)
{

View file

@ -61,8 +61,6 @@ gboolean gst_mpd_helper_get_mpd_type (xmlNode * a_node, const gchar * property_n
gboolean gst_mpd_helper_get_SAP_type (xmlNode * a_node, const gchar * property_name, GstMPDSAPType * property_value);
const gchar * gst_mpd_helper_mimetype_to_caps (const gchar * mimeType);
const gchar * gst_mpd_helper_get_video_codec_from_mime (GstCaps * caps);
const gchar * gst_mpd_helper_get_audio_codec_from_mime (GstCaps * caps);
GstUri *gst_mpd_helper_combine_urls (GstUri * base, GList * list, gchar ** query, guint idx);
int gst_mpd_helper_strncmp_ext (const char *s1, const char *s2);