gst/rtp/README: Update README
Original commit message from CVS: * gst/rtp/README: Update README * gst/rtp/gstrtpamrdec.c: (gst_rtpamrdec_sink_setcaps): Make extra params as strings. * gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_set_state), (gst_rtspsrc_parse_rtpmap), (gst_rtspsrc_media_to_caps), (gst_rtspsrc_stream_setup_rtp), (gst_rtspsrc_send): Make state change return NO_PREROLL as this is a live source. * gst/udp/gstudpsrc.c: (gst_udpsrc_set_property): Don't unref old caps when NULL.
This commit is contained in:
parent
eb20f045f8
commit
9dd3929730
17
ChangeLog
17
ChangeLog
@ -1,3 +1,20 @@
|
|||||||
|
2005-09-21 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* gst/rtp/README:
|
||||||
|
Update README
|
||||||
|
|
||||||
|
* gst/rtp/gstrtpamrdec.c: (gst_rtpamrdec_sink_setcaps):
|
||||||
|
Make extra params as strings.
|
||||||
|
|
||||||
|
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_set_state),
|
||||||
|
(gst_rtspsrc_parse_rtpmap), (gst_rtspsrc_media_to_caps),
|
||||||
|
(gst_rtspsrc_stream_setup_rtp), (gst_rtspsrc_send):
|
||||||
|
Make state change return NO_PREROLL as this is a live
|
||||||
|
source.
|
||||||
|
|
||||||
|
* gst/udp/gstudpsrc.c: (gst_udpsrc_set_property):
|
||||||
|
Don't unref old caps when NULL.
|
||||||
|
|
||||||
2005-09-20 Wim Taymans <wim@fluendo.com>
|
2005-09-20 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_get_type),
|
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_get_type),
|
||||||
|
@ -35,7 +35,8 @@ The following fields can or must (*) be specified in the structure:
|
|||||||
extra encoding parameters (as in the SDP a=rtpmap: field). only required
|
extra encoding parameters (as in the SDP a=rtpmap: field). only required
|
||||||
if different from the default of the encoding-name.
|
if different from the default of the encoding-name.
|
||||||
|
|
||||||
Optional parameters as key/value pairs, media type specific.
|
Optional parameters as key/value pairs, media type specific. The value type
|
||||||
|
should be of type G_TYPE_STRING.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
@ -45,10 +46,10 @@ The following fields can or must (*) be specified in the structure:
|
|||||||
"clock-rate", G_TYPE_INT, 8000, -]
|
"clock-rate", G_TYPE_INT, 8000, -]
|
||||||
"encoding-name", G_TYPE_STRING, "AMR", -] - required since payload >= 96
|
"encoding-name", G_TYPE_STRING, "AMR", -] - required since payload >= 96
|
||||||
"encoding-params", G_TYPE_STRING, "1", -] - optional param for AMR
|
"encoding-params", G_TYPE_STRING, "1", -] - optional param for AMR
|
||||||
"octet-align", G_TYPE_BOOLEAN, TRUE, -]
|
"octet-align", G_TYPE_STRING, "1", -]
|
||||||
"crc", G_TYPE_BOOLEAN, FALSE, ]
|
"crc", G_TYPE_STRING, "0", ]
|
||||||
"robust-sorting", G_TYPE_BOOLEAN, FALSE, ] AMR specific params.
|
"robust-sorting", G_TYPE_STRING, "0", ] AMR specific params.
|
||||||
"interleaving", G_TYPE_BOOLEAN, FALSE, -]
|
"interleaving", G_TYPE_STRING, "0", -]
|
||||||
|
|
||||||
Mapping of caps to and from SDP fields:
|
Mapping of caps to and from SDP fields:
|
||||||
|
|
||||||
|
@ -63,10 +63,10 @@ GST_STATIC_PAD_TEMPLATE ("sink",
|
|||||||
"clock-rate = (int) 8000, "
|
"clock-rate = (int) 8000, "
|
||||||
"encoding-name = (string) \"AMR\", "
|
"encoding-name = (string) \"AMR\", "
|
||||||
"encoding-params = (string) \"1\", "
|
"encoding-params = (string) \"1\", "
|
||||||
"octet-align = (boolean) TRUE, "
|
"octet-align = (string) 1, "
|
||||||
"crc = (boolean) FALSE, "
|
"crc = (string) 0, "
|
||||||
"robust-sorting = (boolean) FALSE, " "interleaving = (boolean) FALSE"
|
"robust-sorting = (string) 0, " "interleaving = (string) 0"
|
||||||
/* following options are not needed for a decoder
|
/* following options are not needed for a decoder
|
||||||
*
|
*
|
||||||
"mode-set = (int) [ 0, 7 ], "
|
"mode-set = (int) [ 0, 7 ], "
|
||||||
"mode-change-period = (int) [ 1, MAX ], "
|
"mode-change-period = (int) [ 1, MAX ], "
|
||||||
@ -180,35 +180,41 @@ gst_rtpamrdec_sink_setcaps (GstPad * pad, GstCaps * caps)
|
|||||||
GstCaps *srccaps;
|
GstCaps *srccaps;
|
||||||
GstRtpAMRDec *rtpamrdec;
|
GstRtpAMRDec *rtpamrdec;
|
||||||
const gchar *params;
|
const gchar *params;
|
||||||
|
const gchar *str;
|
||||||
|
|
||||||
rtpamrdec = GST_RTP_AMR_DEC (GST_OBJECT_PARENT (pad));
|
rtpamrdec = GST_RTP_AMR_DEC (GST_OBJECT_PARENT (pad));
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
structure = gst_caps_get_structure (caps, 0);
|
||||||
|
|
||||||
if (!gst_structure_get_boolean (structure, "octet-align",
|
if (!(str = gst_structure_get_string (structure, "octet-align")))
|
||||||
&rtpamrdec->octet_align))
|
|
||||||
rtpamrdec->octet_align = FALSE;
|
rtpamrdec->octet_align = FALSE;
|
||||||
|
else
|
||||||
|
rtpamrdec->octet_align = (atoi (str) == 1);
|
||||||
|
|
||||||
if (!gst_structure_get_boolean (structure, "crc", &rtpamrdec->crc))
|
if (!(str = gst_structure_get_string (structure, "crc")))
|
||||||
rtpamrdec->crc = FALSE;
|
rtpamrdec->crc = FALSE;
|
||||||
|
else
|
||||||
|
rtpamrdec->crc = (atoi (str) == 1);
|
||||||
|
|
||||||
if (rtpamrdec->crc) {
|
if (rtpamrdec->crc) {
|
||||||
/* crc mode implies octet aligned mode */
|
/* crc mode implies octet aligned mode */
|
||||||
rtpamrdec->octet_align = TRUE;
|
rtpamrdec->octet_align = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gst_structure_get_boolean (structure, "robust-sorting",
|
if (!(str = gst_structure_get_string (structure, "robust-sorting")))
|
||||||
&rtpamrdec->robust_sorting))
|
|
||||||
rtpamrdec->robust_sorting = FALSE;
|
rtpamrdec->robust_sorting = FALSE;
|
||||||
|
else
|
||||||
|
rtpamrdec->robust_sorting = (atoi (str) == 1);
|
||||||
|
|
||||||
if (rtpamrdec->robust_sorting) {
|
if (rtpamrdec->robust_sorting) {
|
||||||
/* robust_sorting mode implies octet aligned mode */
|
/* robust_sorting mode implies octet aligned mode */
|
||||||
rtpamrdec->octet_align = TRUE;
|
rtpamrdec->octet_align = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gst_structure_get_boolean (structure, "interleaving",
|
if (!(str = gst_structure_get_string (structure, "interleaving")))
|
||||||
&rtpamrdec->interleaving))
|
|
||||||
rtpamrdec->interleaving = FALSE;
|
rtpamrdec->interleaving = FALSE;
|
||||||
|
else
|
||||||
|
rtpamrdec->interleaving = (atoi (str) == 1);
|
||||||
|
|
||||||
if (rtpamrdec->interleaving) {
|
if (rtpamrdec->interleaving) {
|
||||||
/* interleaving mode implies octet aligned mode */
|
/* interleaving mode implies octet aligned mode */
|
||||||
|
@ -63,10 +63,10 @@ GST_STATIC_PAD_TEMPLATE ("sink",
|
|||||||
"clock-rate = (int) 8000, "
|
"clock-rate = (int) 8000, "
|
||||||
"encoding-name = (string) \"AMR\", "
|
"encoding-name = (string) \"AMR\", "
|
||||||
"encoding-params = (string) \"1\", "
|
"encoding-params = (string) \"1\", "
|
||||||
"octet-align = (boolean) TRUE, "
|
"octet-align = (string) 1, "
|
||||||
"crc = (boolean) FALSE, "
|
"crc = (string) 0, "
|
||||||
"robust-sorting = (boolean) FALSE, " "interleaving = (boolean) FALSE"
|
"robust-sorting = (string) 0, " "interleaving = (string) 0"
|
||||||
/* following options are not needed for a decoder
|
/* following options are not needed for a decoder
|
||||||
*
|
*
|
||||||
"mode-set = (int) [ 0, 7 ], "
|
"mode-set = (int) [ 0, 7 ], "
|
||||||
"mode-change-period = (int) [ 1, MAX ], "
|
"mode-change-period = (int) [ 1, MAX ], "
|
||||||
@ -180,35 +180,41 @@ gst_rtpamrdec_sink_setcaps (GstPad * pad, GstCaps * caps)
|
|||||||
GstCaps *srccaps;
|
GstCaps *srccaps;
|
||||||
GstRtpAMRDec *rtpamrdec;
|
GstRtpAMRDec *rtpamrdec;
|
||||||
const gchar *params;
|
const gchar *params;
|
||||||
|
const gchar *str;
|
||||||
|
|
||||||
rtpamrdec = GST_RTP_AMR_DEC (GST_OBJECT_PARENT (pad));
|
rtpamrdec = GST_RTP_AMR_DEC (GST_OBJECT_PARENT (pad));
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
structure = gst_caps_get_structure (caps, 0);
|
||||||
|
|
||||||
if (!gst_structure_get_boolean (structure, "octet-align",
|
if (!(str = gst_structure_get_string (structure, "octet-align")))
|
||||||
&rtpamrdec->octet_align))
|
|
||||||
rtpamrdec->octet_align = FALSE;
|
rtpamrdec->octet_align = FALSE;
|
||||||
|
else
|
||||||
|
rtpamrdec->octet_align = (atoi (str) == 1);
|
||||||
|
|
||||||
if (!gst_structure_get_boolean (structure, "crc", &rtpamrdec->crc))
|
if (!(str = gst_structure_get_string (structure, "crc")))
|
||||||
rtpamrdec->crc = FALSE;
|
rtpamrdec->crc = FALSE;
|
||||||
|
else
|
||||||
|
rtpamrdec->crc = (atoi (str) == 1);
|
||||||
|
|
||||||
if (rtpamrdec->crc) {
|
if (rtpamrdec->crc) {
|
||||||
/* crc mode implies octet aligned mode */
|
/* crc mode implies octet aligned mode */
|
||||||
rtpamrdec->octet_align = TRUE;
|
rtpamrdec->octet_align = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gst_structure_get_boolean (structure, "robust-sorting",
|
if (!(str = gst_structure_get_string (structure, "robust-sorting")))
|
||||||
&rtpamrdec->robust_sorting))
|
|
||||||
rtpamrdec->robust_sorting = FALSE;
|
rtpamrdec->robust_sorting = FALSE;
|
||||||
|
else
|
||||||
|
rtpamrdec->robust_sorting = (atoi (str) == 1);
|
||||||
|
|
||||||
if (rtpamrdec->robust_sorting) {
|
if (rtpamrdec->robust_sorting) {
|
||||||
/* robust_sorting mode implies octet aligned mode */
|
/* robust_sorting mode implies octet aligned mode */
|
||||||
rtpamrdec->octet_align = TRUE;
|
rtpamrdec->octet_align = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gst_structure_get_boolean (structure, "interleaving",
|
if (!(str = gst_structure_get_string (structure, "interleaving")))
|
||||||
&rtpamrdec->interleaving))
|
|
||||||
rtpamrdec->interleaving = FALSE;
|
rtpamrdec->interleaving = FALSE;
|
||||||
|
else
|
||||||
|
rtpamrdec->interleaving = (atoi (str) == 1);
|
||||||
|
|
||||||
if (rtpamrdec->interleaving) {
|
if (rtpamrdec->interleaving) {
|
||||||
/* interleaving mode implies octet aligned mode */
|
/* interleaving mode implies octet aligned mode */
|
||||||
|
@ -287,6 +287,7 @@ gst_rtspsrc_set_state (GstRTSPSrc * src, GstState state)
|
|||||||
state)) == GST_STATE_CHANGE_FAILURE)
|
state)) == GST_STATE_CHANGE_FAILURE)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream->rtcpsrc) {
|
if (stream->rtcpsrc) {
|
||||||
if ((ret =
|
if ((ret =
|
||||||
gst_element_set_state (stream->rtcpsrc,
|
gst_element_set_state (stream->rtcpsrc,
|
||||||
@ -299,6 +300,36 @@ done:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define PARSE_INT(p, del, res) \
|
||||||
|
G_STMT_START { \
|
||||||
|
gchar *t = p; \
|
||||||
|
p = strstr (p, del); \
|
||||||
|
if (p == NULL) \
|
||||||
|
res = -1; \
|
||||||
|
else { \
|
||||||
|
*p = '\0'; \
|
||||||
|
p++; \
|
||||||
|
res = atoi (t); \
|
||||||
|
} \
|
||||||
|
} G_STMT_END
|
||||||
|
|
||||||
|
#define PARSE_STRING(p, del, res) \
|
||||||
|
G_STMT_START { \
|
||||||
|
gchar *t = p; \
|
||||||
|
p = strstr (p, del); \
|
||||||
|
if (p == NULL) \
|
||||||
|
res = NULL; \
|
||||||
|
else { \
|
||||||
|
*p = '\0'; \
|
||||||
|
p++; \
|
||||||
|
res = t; \
|
||||||
|
} \
|
||||||
|
} G_STMT_END
|
||||||
|
|
||||||
|
#define SKIP_SPACES(p) \
|
||||||
|
while (*p && g_ascii_isspace (*p)) \
|
||||||
|
p++;
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_rtspsrc_parse_rtpmap (gchar * rtpmap, gint * payload, gchar ** name,
|
gst_rtspsrc_parse_rtpmap (gchar * rtpmap, gint * payload, gchar ** name,
|
||||||
gint * rate, gchar ** params)
|
gint * rate, gchar ** params)
|
||||||
@ -307,27 +338,17 @@ gst_rtspsrc_parse_rtpmap (gchar * rtpmap, gint * payload, gchar ** name,
|
|||||||
|
|
||||||
t = p = rtpmap;
|
t = p = rtpmap;
|
||||||
|
|
||||||
p = strstr (p, " ");
|
PARSE_INT (p, " ", *payload);
|
||||||
if (p == NULL)
|
if (*payload == -1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
*p = '\0';
|
|
||||||
p++;
|
|
||||||
|
|
||||||
*payload = atoi (t);
|
|
||||||
|
|
||||||
while (*p && g_ascii_isspace (*p))
|
|
||||||
p++;
|
|
||||||
|
|
||||||
|
SKIP_SPACES (p);
|
||||||
if (*p == '\0')
|
if (*p == '\0')
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
t = p;
|
PARSE_STRING (p, "/", *name);
|
||||||
p = strstr (p, "/");
|
if (*name == NULL)
|
||||||
if (p == NULL)
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
*p = '\0';
|
|
||||||
p++;
|
|
||||||
*name = t;
|
|
||||||
|
|
||||||
t = p;
|
t = p;
|
||||||
p = strstr (p, "/");
|
p = strstr (p, "/");
|
||||||
@ -360,8 +381,7 @@ gst_rtspsrc_media_to_caps (SDPMedia * media)
|
|||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gchar *payload;
|
gchar *payload;
|
||||||
gchar *rtpmap;
|
gchar *rtpmap;
|
||||||
|
gchar *fmtp;
|
||||||
//gchar *fmtp;
|
|
||||||
gint pt;
|
gint pt;
|
||||||
gchar *name = NULL;
|
gchar *name = NULL;
|
||||||
gint rate = -1;
|
gint rate = -1;
|
||||||
@ -379,21 +399,23 @@ gst_rtspsrc_media_to_caps (SDPMedia * media)
|
|||||||
gint payload = 0;
|
gint payload = 0;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
rtpmap = sdp_media_get_attribute_val (media, "rtpmap");
|
if ((rtpmap = sdp_media_get_attribute_val (media, "rtpmap"))) {
|
||||||
if (rtpmap == NULL) {
|
if ((ret =
|
||||||
g_warning ("rtpmap type not given");
|
gst_rtspsrc_parse_rtpmap (rtpmap, &payload, &name, &rate,
|
||||||
|
¶ms))) {
|
||||||
|
if (payload != pt) {
|
||||||
|
g_warning ("rtpmap of wrong payload type");
|
||||||
|
name = NULL;
|
||||||
|
rate = -1;
|
||||||
|
params = NULL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
g_warning ("error parsing rtpmap");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
g_warning ("rtpmap type not given fot dynamic payload %d", pt);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
ret = gst_rtspsrc_parse_rtpmap (rtpmap, &payload, &name, &rate, ¶ms);
|
|
||||||
if (!ret) {
|
|
||||||
g_warning ("error parsing rtpmap");
|
|
||||||
}
|
|
||||||
if (payload != pt) {
|
|
||||||
g_warning ("rtpmap of wrong payload type");
|
|
||||||
name = NULL;
|
|
||||||
rate = -1;
|
|
||||||
params = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
caps = gst_caps_new_simple ("application/x-rtp",
|
caps = gst_caps_new_simple ("application/x-rtp",
|
||||||
@ -409,6 +431,32 @@ gst_rtspsrc_media_to_caps (SDPMedia * media)
|
|||||||
if (params != NULL)
|
if (params != NULL)
|
||||||
gst_structure_set (s, "encoding-params", G_TYPE_STRING, params, NULL);
|
gst_structure_set (s, "encoding-params", G_TYPE_STRING, params, NULL);
|
||||||
|
|
||||||
|
/* parse optional fmtp: field */
|
||||||
|
if ((fmtp = sdp_media_get_attribute_val (media, "fmtp"))) {
|
||||||
|
gchar *p;
|
||||||
|
gint payload = 0;
|
||||||
|
|
||||||
|
p = fmtp;
|
||||||
|
|
||||||
|
PARSE_INT (p, " ", payload);
|
||||||
|
if (payload != -1 && payload == pt) {
|
||||||
|
gchar **pairs;
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
pairs = g_strsplit (p, ";", 0);
|
||||||
|
for (i = 0; pairs[i]; i++) {
|
||||||
|
gchar **keyval;
|
||||||
|
|
||||||
|
keyval = g_strsplit (pairs[i], "=", 0);
|
||||||
|
if (keyval[0] && keyval[1]) {
|
||||||
|
gst_structure_set (s, keyval[0], G_TYPE_STRING, keyval[1], NULL);
|
||||||
|
}
|
||||||
|
g_strfreev (keyval);
|
||||||
|
}
|
||||||
|
g_strfreev (pairs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return caps;
|
return caps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,6 +499,9 @@ gst_rtspsrc_stream_setup_rtp (GstRTSPStream * stream, SDPMedia * media,
|
|||||||
g_object_get (G_OBJECT (stream->rtpsrc), "port", rtpport, NULL);
|
g_object_get (G_OBJECT (stream->rtpsrc), "port", rtpport, NULL);
|
||||||
g_object_get (G_OBJECT (stream->rtcpsrc), "port", rtcpport, NULL);
|
g_object_get (G_OBJECT (stream->rtcpsrc), "port", rtcpport, NULL);
|
||||||
|
|
||||||
|
gst_element_set_state (stream->rtpsrc, GST_STATE_READY);
|
||||||
|
gst_element_set_state (stream->rtcpsrc, GST_STATE_READY);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* ERRORS, FIXME, cleanup */
|
/* ERRORS, FIXME, cleanup */
|
||||||
|
@ -407,7 +407,8 @@ gst_udpsrc_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||||||
|
|
||||||
old_caps = udpsrc->caps;
|
old_caps = udpsrc->caps;
|
||||||
udpsrc->caps = new_caps;
|
udpsrc->caps = new_caps;
|
||||||
gst_caps_unref (old_caps);
|
if (old_caps)
|
||||||
|
gst_caps_unref (old_caps);
|
||||||
gst_pad_set_caps (GST_BASE_SRC (udpsrc)->srcpad, new_caps);
|
gst_pad_set_caps (GST_BASE_SRC (udpsrc)->srcpad, new_caps);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user