CVS Root: /cvs/gstreamer
Module: gst-openmax
Changes by: felipec
Date: Thu Nov 20 2008 17:09:12 UTC
Log message:
Improve G711 caps negotiation.
Modified files:
omx : gstomx_g711enc.c
Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-openmax/omx/gstomx_g711enc.c.diff?r1=1.7&r2=1.8
====Begin Diffs====
Index: gstomx_g711enc.c
===================================================================
RCS file: /cvs/gstreamer/gst-openmax/omx/gstomx_g711enc.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- gstomx_g711enc.c 20 Nov 2008 16:29:29 -0000 1.7
+++ gstomx_g711enc.c 20 Nov 2008 17:08:57 -0000 1.8
@@ -126,23 +126,29 @@
sink_setcaps (GstPad *pad,
GstCaps *caps)
{
+ GstCaps *peer_caps;
GstStructure *structure;
GstOmxBaseFilter *omx_base;
GOmxCore *gomx;
const gchar *mode;
+ gboolean ret = TRUE;
omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad));
gomx = (GOmxCore *) omx_base->gomx;
GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps);
- g_return_val_if_fail (gst_caps_get_size (caps) == 1, FALSE);
+ peer_caps = gst_pad_peer_get_caps (omx_base->srcpad);
- structure = gst_caps_get_structure (caps, 0);
+ g_return_val_if_fail (peer_caps, FALSE);
+
+ GST_INFO_OBJECT (omx_base, "setcaps (sink): peercaps: %" GST_PTR_FORMAT, peer_caps);
+ structure = gst_caps_get_structure (peer_caps, 0);
mode = gst_structure_get_name (structure);
- /* Input port configuration. */
+ /* Output port configuration. */
{
OMX_AUDIO_PARAM_PCMMODETYPE *param;
@@ -151,24 +157,43 @@
param->nVersion.s.nVersionMajor = 1;
param->nVersion.s.nVersionMinor = 1;
- param->nPortIndex = 0;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, param);
+ param->nPortIndex = 1;
+ OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, param);
if (strcmp (mode, "audio/x-alaw") == 0)
- {
param->ePCMMode = OMX_AUDIO_PCMModeALaw;
- }
- else
+ else if (strcmp (mode, "audio/x-mulaw") == 0)
param->ePCMMode = OMX_AUDIO_PCMModeMULaw;
- OMX_SetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, param);
+ OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, param);
free (param);
}
- return gst_pad_set_caps (pad, caps);
+ /* set caps on the srcpad */
+ {
+ GstCaps *tmp_caps;
+ tmp_caps = gst_pad_get_allowed_caps (omx_base->srcpad);
+ tmp_caps = gst_caps_make_writable (tmp_caps);
+ gst_caps_truncate (tmp_caps);
+ gst_pad_fixate_caps (omx_base->srcpad, tmp_caps);
+ if (gst_caps_is_fixed (tmp_caps))
+ {
+ GST_INFO_OBJECT (omx_base, "fixated to: %" GST_PTR_FORMAT, tmp_caps);
+ gst_pad_set_caps (omx_base->srcpad, tmp_caps);
+ }
+ gst_caps_unref (tmp_caps);
+ }
+ ret = gst_pad_set_caps (pad, caps);
+ gst_caps_unref (peer_caps);
+ return ret;
}
static void
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.