mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
realmedia: Get codec name from pbutils instead of harcoding them
This commit is contained in:
parent
6f2db739ae
commit
fe3e26bee4
4 changed files with 10 additions and 20 deletions
|
@ -9,7 +9,7 @@ libgstrmdemux_la_SOURCES = rademux.c rmdemux.c \
|
||||||
|
|
||||||
libgstrmdemux_la_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS)
|
libgstrmdemux_la_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS)
|
||||||
libgstrmdemux_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS)\
|
libgstrmdemux_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS)\
|
||||||
-lgstrtsp-@GST_MAJORMINOR@ -lgstsdp-@GST_MAJORMINOR@
|
-lgstrtsp-@GST_MAJORMINOR@ -lgstsdp-@GST_MAJORMINOR@ -lgstpbutils-@GST_MAJORMINOR@
|
||||||
libgstrmdemux_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
libgstrmdemux_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||||
libgstrmdemux_la_LIBTOOLFLAGS = --tag=disable-static
|
libgstrmdemux_la_LIBTOOLFLAGS = --tag=disable-static
|
||||||
|
|
||||||
|
|
|
@ -301,8 +301,8 @@ gst_real_audio_demux_get_data_offset_from_header (GstRealAudioDemux * demux)
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_real_audio_demux_parse_header (GstRealAudioDemux * demux)
|
gst_real_audio_demux_parse_header (GstRealAudioDemux * demux)
|
||||||
{
|
{
|
||||||
const gchar *codec_name = NULL;
|
|
||||||
const guint8 *data;
|
const guint8 *data;
|
||||||
|
gchar *codec_name = NULL;
|
||||||
GstCaps *caps = NULL;
|
GstCaps *caps = NULL;
|
||||||
guint avail;
|
guint avail;
|
||||||
|
|
||||||
|
@ -378,7 +378,6 @@ gst_real_audio_demux_parse_header (GstRealAudioDemux * demux)
|
||||||
case GST_RM_AUD_14_4:
|
case GST_RM_AUD_14_4:
|
||||||
caps = gst_caps_new_simple ("audio/x-pn-realaudio", "raversion",
|
caps = gst_caps_new_simple ("audio/x-pn-realaudio", "raversion",
|
||||||
G_TYPE_INT, 1, NULL);
|
G_TYPE_INT, 1, NULL);
|
||||||
codec_name = "Real Audio 14.4kbps";
|
|
||||||
demux->byterate_num = 1000;
|
demux->byterate_num = 1000;
|
||||||
demux->byterate_denom = 1;
|
demux->byterate_denom = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -387,11 +386,9 @@ gst_real_audio_demux_parse_header (GstRealAudioDemux * demux)
|
||||||
/* FIXME: needs descrambling */
|
/* FIXME: needs descrambling */
|
||||||
caps = gst_caps_new_simple ("audio/x-pn-realaudio", "raversion",
|
caps = gst_caps_new_simple ("audio/x-pn-realaudio", "raversion",
|
||||||
G_TYPE_INT, 2, NULL);
|
G_TYPE_INT, 2, NULL);
|
||||||
codec_name = "Real Audio 28.8kbps";
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GST_RM_AUD_DNET:
|
case GST_RM_AUD_DNET:
|
||||||
codec_name = "AC-3 audio";
|
|
||||||
caps = gst_caps_new_simple ("audio/x-ac3", "rate", G_TYPE_INT,
|
caps = gst_caps_new_simple ("audio/x-ac3", "rate", G_TYPE_INT,
|
||||||
demux->sample_rate, NULL);
|
demux->sample_rate, NULL);
|
||||||
if (demux->packet_size == 0 || demux->sample_rate == 0)
|
if (demux->packet_size == 0 || demux->sample_rate == 0)
|
||||||
|
@ -402,7 +399,6 @@ gst_real_audio_demux_parse_header (GstRealAudioDemux * demux)
|
||||||
|
|
||||||
/* Sipro/ACELP.NET Voice Codec (MIME unknown) */
|
/* Sipro/ACELP.NET Voice Codec (MIME unknown) */
|
||||||
case GST_RM_AUD_SIPR:
|
case GST_RM_AUD_SIPR:
|
||||||
codec_name = "Sipro Voice";
|
|
||||||
caps = gst_caps_new_simple ("audio/x-sipro", NULL);
|
caps = gst_caps_new_simple ("audio/x-sipro", NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -427,6 +423,7 @@ gst_real_audio_demux_parse_header (GstRealAudioDemux * demux)
|
||||||
demux->srcpad = gst_pad_new_from_static_template (&src_template, "src");
|
demux->srcpad = gst_pad_new_from_static_template (&src_template, "src");
|
||||||
gst_pad_use_fixed_caps (demux->srcpad);
|
gst_pad_use_fixed_caps (demux->srcpad);
|
||||||
gst_pad_set_caps (demux->srcpad, caps);
|
gst_pad_set_caps (demux->srcpad, caps);
|
||||||
|
codec_name = gst_pb_utils_get_codec_description (caps);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
gst_pad_set_event_function (demux->srcpad,
|
gst_pad_set_event_function (demux->srcpad,
|
||||||
GST_DEBUG_FUNCPTR (gst_real_audio_demux_src_event));
|
GST_DEBUG_FUNCPTR (gst_real_audio_demux_src_event));
|
||||||
|
@ -462,6 +459,7 @@ gst_real_audio_demux_parse_header (GstRealAudioDemux * demux)
|
||||||
|
|
||||||
gst_tag_list_add (demux->pending_tags, GST_TAG_MERGE_REPLACE,
|
gst_tag_list_add (demux->pending_tags, GST_TAG_MERGE_REPLACE,
|
||||||
GST_TAG_AUDIO_CODEC, codec_name, NULL);
|
GST_TAG_AUDIO_CODEC, codec_name, NULL);
|
||||||
|
g_free (codec_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_adapter_flush (demux->adapter, demux->data_offset - 6);
|
gst_adapter_flush (demux->adapter, demux->data_offset - 6);
|
||||||
|
|
|
@ -1281,7 +1281,7 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
|
||||||
{
|
{
|
||||||
GstCaps *stream_caps = NULL;
|
GstCaps *stream_caps = NULL;
|
||||||
const gchar *codec_tag = NULL;
|
const gchar *codec_tag = NULL;
|
||||||
const gchar *codec_name = NULL;
|
gchar *codec_name = NULL;
|
||||||
int version = 0;
|
int version = 0;
|
||||||
|
|
||||||
if (stream->subtype == GST_RMDEMUX_STREAM_VIDEO) {
|
if (stream->subtype == GST_RMDEMUX_STREAM_VIDEO) {
|
||||||
|
@ -1295,19 +1295,15 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
|
||||||
|
|
||||||
switch (stream->fourcc) {
|
switch (stream->fourcc) {
|
||||||
case GST_RM_VDO_RV10:
|
case GST_RM_VDO_RV10:
|
||||||
codec_name = "Real Video 1.0";
|
|
||||||
version = 1;
|
version = 1;
|
||||||
break;
|
break;
|
||||||
case GST_RM_VDO_RV20:
|
case GST_RM_VDO_RV20:
|
||||||
codec_name = "Real Video 2.0";
|
|
||||||
version = 2;
|
version = 2;
|
||||||
break;
|
break;
|
||||||
case GST_RM_VDO_RV30:
|
case GST_RM_VDO_RV30:
|
||||||
codec_name = "Real Video 3.0";
|
|
||||||
version = 3;
|
version = 3;
|
||||||
break;
|
break;
|
||||||
case GST_RM_VDO_RV40:
|
case GST_RM_VDO_RV40:
|
||||||
codec_name = "Real Video 4.0";
|
|
||||||
version = 4;
|
version = 4;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1349,18 +1345,15 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
|
||||||
switch (stream->fourcc) {
|
switch (stream->fourcc) {
|
||||||
/* Older RealAudio Codecs */
|
/* Older RealAudio Codecs */
|
||||||
case GST_RM_AUD_14_4:
|
case GST_RM_AUD_14_4:
|
||||||
codec_name = "Real Audio 14.4kbps";
|
|
||||||
version = 1;
|
version = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GST_RM_AUD_28_8:
|
case GST_RM_AUD_28_8:
|
||||||
codec_name = "Real Audio 28.8kbps";
|
|
||||||
version = 2;
|
version = 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* DolbyNet (Dolby AC3, low bitrate) */
|
/* DolbyNet (Dolby AC3, low bitrate) */
|
||||||
case GST_RM_AUD_DNET:
|
case GST_RM_AUD_DNET:
|
||||||
codec_name = "AC-3 audio";
|
|
||||||
stream_caps =
|
stream_caps =
|
||||||
gst_caps_new_simple ("audio/x-ac3", "rate", G_TYPE_INT,
|
gst_caps_new_simple ("audio/x-ac3", "rate", G_TYPE_INT,
|
||||||
(int) stream->rate, NULL);
|
(int) stream->rate, NULL);
|
||||||
|
@ -1372,7 +1365,6 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
|
||||||
/* MPEG-4 based */
|
/* MPEG-4 based */
|
||||||
case GST_RM_AUD_RAAC:
|
case GST_RM_AUD_RAAC:
|
||||||
case GST_RM_AUD_RACP:
|
case GST_RM_AUD_RACP:
|
||||||
codec_name = "MPEG4 audio";
|
|
||||||
stream_caps =
|
stream_caps =
|
||||||
gst_caps_new_simple ("audio/mpeg", "mpegversion", G_TYPE_INT,
|
gst_caps_new_simple ("audio/mpeg", "mpegversion", G_TYPE_INT,
|
||||||
(int) 4, "framed", G_TYPE_BOOLEAN, TRUE, NULL);
|
(int) 4, "framed", G_TYPE_BOOLEAN, TRUE, NULL);
|
||||||
|
@ -1388,7 +1380,6 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
|
||||||
|
|
||||||
/* Sony ATRAC3 */
|
/* Sony ATRAC3 */
|
||||||
case GST_RM_AUD_ATRC:
|
case GST_RM_AUD_ATRC:
|
||||||
codec_name = "Sony ATRAC3";
|
|
||||||
stream_caps = gst_caps_new_simple ("audio/x-vnd.sony.atrac3", NULL);
|
stream_caps = gst_caps_new_simple ("audio/x-vnd.sony.atrac3", NULL);
|
||||||
stream->needs_descrambling = TRUE;
|
stream->needs_descrambling = TRUE;
|
||||||
stream->subpackets_needed = stream->height;
|
stream->subpackets_needed = stream->height;
|
||||||
|
@ -1397,7 +1388,6 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
|
||||||
|
|
||||||
/* RealAudio G2 audio */
|
/* RealAudio G2 audio */
|
||||||
case GST_RM_AUD_COOK:
|
case GST_RM_AUD_COOK:
|
||||||
codec_name = "Real Audio G2 (Cook)";
|
|
||||||
version = 8;
|
version = 8;
|
||||||
stream->needs_descrambling = TRUE;
|
stream->needs_descrambling = TRUE;
|
||||||
stream->subpackets_needed = stream->height;
|
stream->subpackets_needed = stream->height;
|
||||||
|
@ -1406,7 +1396,6 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
|
||||||
|
|
||||||
/* RALF is lossless */
|
/* RALF is lossless */
|
||||||
case GST_RM_AUD_RALF:
|
case GST_RM_AUD_RALF:
|
||||||
codec_name = "Real Audio Lossless (RALF)";
|
|
||||||
GST_DEBUG_OBJECT (rmdemux, "RALF");
|
GST_DEBUG_OBJECT (rmdemux, "RALF");
|
||||||
stream_caps = gst_caps_new_simple ("audio/x-ralf-mpeg4-generic", NULL);
|
stream_caps = gst_caps_new_simple ("audio/x-ralf-mpeg4-generic", NULL);
|
||||||
break;
|
break;
|
||||||
|
@ -1420,7 +1409,6 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
|
||||||
goto beach;
|
goto beach;
|
||||||
}
|
}
|
||||||
|
|
||||||
codec_name = "Sipro/ACELP.NET Voice";
|
|
||||||
GST_DEBUG_OBJECT (rmdemux, "SIPR");
|
GST_DEBUG_OBJECT (rmdemux, "SIPR");
|
||||||
stream_caps = gst_caps_new_simple ("audio/x-sipro", NULL);
|
stream_caps = gst_caps_new_simple ("audio/x-sipro", NULL);
|
||||||
stream->needs_descrambling = TRUE;
|
stream->needs_descrambling = TRUE;
|
||||||
|
@ -1506,12 +1494,15 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
|
||||||
gst_pad_set_active (stream->pad, TRUE);
|
gst_pad_set_active (stream->pad, TRUE);
|
||||||
gst_element_add_pad (GST_ELEMENT_CAST (rmdemux), stream->pad);
|
gst_element_add_pad (GST_ELEMENT_CAST (rmdemux), stream->pad);
|
||||||
|
|
||||||
|
codec_name = gst_pb_utils_get_codec_description (stream_caps);
|
||||||
|
|
||||||
/* save for later, we must send the tags after the newsegment event */
|
/* save for later, we must send the tags after the newsegment event */
|
||||||
if (codec_name != NULL && codec_tag != NULL) {
|
if (codec_tag != NULL && codec_name != NULL) {
|
||||||
if (stream->pending_tags == NULL)
|
if (stream->pending_tags == NULL)
|
||||||
stream->pending_tags = gst_tag_list_new ();
|
stream->pending_tags = gst_tag_list_new ();
|
||||||
gst_tag_list_add (stream->pending_tags, GST_TAG_MERGE_KEEP,
|
gst_tag_list_add (stream->pending_tags, GST_TAG_MERGE_KEEP,
|
||||||
codec_tag, codec_name, NULL);
|
codec_tag, codec_name, NULL);
|
||||||
|
g_free (codec_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gst/base/gstadapter.h>
|
#include <gst/base/gstadapter.h>
|
||||||
|
#include <gst/pbutils/descriptions.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue