ext/divx/gstdivxdec.c: Downgrade priority. We prefer ffdec_mpeg4.

Original commit message from CVS:
* ext/divx/gstdivxdec.c:
Downgrade priority. We prefer ffdec_mpeg4.
* ext/faad/gstfaad.c: (gst_faad_srcgetcaps), (gst_faad_srcconnect),
(gst_faad_chain), (gst_faad_change_state):
Fix capsnego. Doesn't work for some sounds because we don't have
a 5:1 to stereo element.
* ext/xvid/gstxvid.c: (plugin_init):
Add priority.
* sys/oss/gstosssink.c: (gst_osssink_init), (gst_osssink_chain),
(gst_osssink_change_state):
Add discont handling.
This commit is contained in:
Ronald S. Bultje 2004-03-10 05:45:23 +00:00
parent 281ca93053
commit 10ce18a162
4 changed files with 92 additions and 67 deletions

View file

@ -1,3 +1,17 @@
2004-03-10 Ronald Bultje <rbultje@ronald.bitfreak.net>
* ext/divx/gstdivxdec.c:
Downgrade priority. We prefer ffdec_mpeg4.
* ext/faad/gstfaad.c: (gst_faad_srcgetcaps), (gst_faad_srcconnect),
(gst_faad_chain), (gst_faad_change_state):
Fix capsnego. Doesn't work for some sounds because we don't have
a 5:1 to stereo element.
* ext/xvid/gstxvid.c: (plugin_init):
Add priority.
* sys/oss/gstosssink.c: (gst_osssink_init), (gst_osssink_chain),
(gst_osssink_change_state):
Add discont handling.
2004-03-09 Colin Walters <walters@verbum.org> 2004-03-09 Colin Walters <walters@verbum.org>
* gst/audioconvert/gstaudioconvert.c: Fix typo in width 8 * gst/audioconvert/gstaudioconvert.c: Fix typo in width 8

View file

@ -471,7 +471,7 @@ plugin_init (GstPlugin *plugin)
/* create an elementfactory for the v4lmjpegsrcparse element */ /* create an elementfactory for the v4lmjpegsrcparse element */
return gst_element_register(plugin, "divxdec", return gst_element_register(plugin, "divxdec",
GST_RANK_PRIMARY, GST_TYPE_DIVXDEC); GST_RANK_SECONDARY, GST_TYPE_DIVXDEC);
} }

View file

@ -167,74 +167,82 @@ gst_faad_srcgetcaps (GstPad *pad)
if (faad->handle != NULL && if (faad->handle != NULL &&
faad->channels != -1 && faad->samplerate != -1) { faad->channels != -1 && faad->samplerate != -1) {
faacDecConfiguration *conf; GstCaps *caps = gst_caps_new_empty ();
GstCaps *caps; GstStructure *str;
gint fmt[] = {
FAAD_FMT_16BIT,
FAAD_FMT_24BIT,
FAAD_FMT_32BIT,
FAAD_FMT_FLOAT,
FAAD_FMT_DOUBLE,
-1
}, n;
conf = faacDecGetCurrentConfiguration (faad->handle); for (n = 0; fmt[n] != -1; n++) {
switch (n) {
switch (conf->outputFormat) {
case FAAD_FMT_16BIT: case FAAD_FMT_16BIT:
caps = gst_caps_new_simple ("audio/x-raw-int", str = gst_structure_new ("audio/x-raw-int",
"signed", G_TYPE_BOOLEAN, TRUE, "signed", G_TYPE_BOOLEAN, TRUE,
"width", G_TYPE_INT, 16, "width", G_TYPE_INT, 16,
"depth", G_TYPE_INT, 16, "depth", G_TYPE_INT, 16,
NULL); NULL);
break; break;
case FAAD_FMT_24BIT: case FAAD_FMT_24BIT:
caps = gst_caps_new_simple ("audio/x-raw-int", str = gst_structure_new ("audio/x-raw-int",
"signed", G_TYPE_BOOLEAN, TRUE, "signed", G_TYPE_BOOLEAN, TRUE,
"width", G_TYPE_INT, 24, "width", G_TYPE_INT, 24,
"depth", G_TYPE_INT, 24, "depth", G_TYPE_INT, 24,
NULL); NULL);
break; break;
case FAAD_FMT_32BIT: case FAAD_FMT_32BIT:
caps = gst_caps_new_simple ("audio/x-raw-int", str = gst_structure_new ("audio/x-raw-int",
"signed", G_TYPE_BOOLEAN, TRUE, "signed", G_TYPE_BOOLEAN, TRUE,
"width", G_TYPE_INT, 32, "width", G_TYPE_INT, 32,
"depth", G_TYPE_INT, 32, "depth", G_TYPE_INT, 32,
NULL); NULL);
break; break;
case FAAD_FMT_FLOAT: case FAAD_FMT_FLOAT:
caps = gst_caps_new_simple ("audio/x-raw-float", str = gst_structure_new ("audio/x-raw-float",
"depth", G_TYPE_INT, 32, "depth", G_TYPE_INT, 32,
NULL); NULL);
break; break;
case FAAD_FMT_DOUBLE: case FAAD_FMT_DOUBLE:
caps = gst_caps_new_simple ("audio/x-raw-float", str = gst_structure_new ("audio/x-raw-float",
"depth", G_TYPE_INT, 64, "depth", G_TYPE_INT, 64,
NULL); NULL);
break; break;
default: default:
caps = gst_caps_new_empty (); str = NULL;
break; break;
} }
if (!str)
if (!gst_caps_is_empty (caps)) { continue;
GstStructure *structure = gst_caps_get_structure (caps, 0);
if (faad->samplerate != -1) { if (faad->samplerate != -1) {
gst_structure_set (structure, gst_structure_set (str,
"rate", G_TYPE_INT, faad->samplerate, "rate", G_TYPE_INT, faad->samplerate,
NULL); NULL);
} else { } else {
gst_structure_set (structure, gst_structure_set (str,
"rate", GST_TYPE_INT_RANGE, 8000, 96000, "rate", GST_TYPE_INT_RANGE, 8000, 96000,
NULL); NULL);
} }
if (faad->channels != -1) { if (faad->channels != -1) {
gst_structure_set (structure, gst_structure_set (str,
"channels", G_TYPE_INT, faad->channels, "channels", G_TYPE_INT, faad->channels,
NULL); NULL);
} else { } else {
gst_structure_set (structure, gst_structure_set (str,
"channels", GST_TYPE_INT_RANGE, 1, 6, "channels", GST_TYPE_INT_RANGE, 1, 6,
NULL); NULL);
} }
gst_structure_set (structure, gst_structure_set (str,
"endianness", G_TYPE_INT, G_BYTE_ORDER, "endianness", G_TYPE_INT, G_BYTE_ORDER,
NULL); NULL);
gst_caps_append_structure (caps, str);
} }
return caps; return caps;
@ -250,7 +258,7 @@ gst_faad_srcconnect (GstPad *pad,
GstStructure *structure; GstStructure *structure;
const gchar *mimetype; const gchar *mimetype;
gint fmt = 0; gint fmt = 0;
gint depth; gint depth, rate, channels;
GstFaad *faad = GST_FAAD (gst_pad_get_parent (pad)); GstFaad *faad = GST_FAAD (gst_pad_get_parent (pad));
if (!faad->handle || if (!faad->handle ||
@ -261,6 +269,14 @@ gst_faad_srcconnect (GstPad *pad,
structure = gst_caps_get_structure (caps, 0); structure = gst_caps_get_structure (caps, 0);
mimetype = gst_structure_get_name (structure); mimetype = gst_structure_get_name (structure);
/* Samplerate and channels are normally provided through
* the getcaps function */
if (!gst_structure_get_int (structure, "channels", &channels) ||
!gst_structure_get_int (structure, "rate", &rate) ||
rate != faad->samplerate || channels != faad->channels) {
return GST_PAD_LINK_REFUSED;
}
if (!strcmp (mimetype, "audio/x-raw-int")) { if (!strcmp (mimetype, "audio/x-raw-int")) {
gint width; gint width;
@ -296,25 +312,16 @@ gst_faad_srcconnect (GstPad *pad,
} }
if (fmt) { if (fmt) {
GstCaps *newcaps, *intersect;
faacDecConfiguration *conf; faacDecConfiguration *conf;
conf = faacDecGetCurrentConfiguration (faad->handle); conf = faacDecGetCurrentConfiguration (faad->handle);
conf->outputFormat = fmt; conf->outputFormat = fmt;
faacDecSetConfiguration (faad->handle, conf); faacDecSetConfiguration (faad->handle, conf);
/* FIXME: handle return value, how? */ /* FIXME: handle return value, how? */
newcaps = gst_faad_srcgetcaps (pad);
g_assert (gst_caps_is_fixed (newcaps));
intersect = gst_caps_intersect (newcaps, caps);
gst_caps_free (newcaps);
if (!gst_caps_is_empty (intersect)) {
gst_caps_free (intersect);
faad->bps = depth / 8; faad->bps = depth / 8;
return GST_PAD_LINK_OK; return GST_PAD_LINK_OK;
} }
gst_caps_free (intersect);
}
return GST_PAD_LINK_REFUSED; return GST_PAD_LINK_REFUSED;
} }
@ -345,6 +352,7 @@ gst_faad_chain (GstPad *pad,
buf = GST_BUFFER (data); buf = GST_BUFFER (data);
if (faad->samplerate == -1 || faad->channels == -1) { if (faad->samplerate == -1 || faad->channels == -1) {
GstPadLinkReturn ret;
gulong samplerate; gulong samplerate;
guchar channels; guchar channels;
@ -353,16 +361,12 @@ gst_faad_chain (GstPad *pad,
&samplerate, &channels); &samplerate, &channels);
faad->samplerate = samplerate; faad->samplerate = samplerate;
faad->channels = channels; faad->channels = channels;
ret = gst_pad_renegotiate (faad->srcpad);
gst_pad_renegotiate (faad->srcpad); if (GST_PAD_LINK_FAILED (ret)) {
#if 0
if (gst_faad_srcconnect (faad->srcpad,
gst_pad_get_allowed_caps (faad->srcpad)) <= 0) {
GST_ELEMENT_ERROR (faad, CORE, NEGOTIATION, (NULL), (NULL)); GST_ELEMENT_ERROR (faad, CORE, NEGOTIATION, (NULL), (NULL));
gst_buffer_unref (buf); gst_buffer_unref (buf);
return; return;
} }
#endif
} }
out = faacDecDecode (faad->handle, &info, out = faacDecDecode (faad->handle, &info,
@ -377,20 +381,20 @@ gst_faad_chain (GstPad *pad,
if (info.samplerate != faad->samplerate || if (info.samplerate != faad->samplerate ||
info.channels != faad->channels) { info.channels != faad->channels) {
GstPadLinkReturn ret;
faad->samplerate = info.samplerate; faad->samplerate = info.samplerate;
faad->channels = info.channels; faad->channels = info.channels;
gst_pad_renegotiate (faad->srcpad); ret = gst_pad_renegotiate (faad->srcpad);
#if 0 if (GST_PAD_LINK_FAILED (ret)) {
if (gst_faad_srcconnect (faad->srcpad,
gst_pad_get_allowed_caps (faad->srcpad)) <= 0) {
GST_ELEMENT_ERROR (faad, CORE, NEGOTIATION, (NULL), (NULL)); GST_ELEMENT_ERROR (faad, CORE, NEGOTIATION, (NULL), (NULL));
gst_buffer_unref (buf); gst_buffer_unref (buf);
return; return;
} }
#endif
} }
if (info.samples == 0) { if (info.samples == 0) {
gst_buffer_unref (buf);
return; return;
} }
@ -414,6 +418,13 @@ gst_faad_change_state (GstElement *element)
case GST_STATE_NULL_TO_READY: case GST_STATE_NULL_TO_READY:
if (!(faad->handle = faacDecOpen ())) if (!(faad->handle = faacDecOpen ()))
return GST_STATE_FAILURE; return GST_STATE_FAILURE;
else {
faacDecConfiguration *conf;
conf = faacDecGetCurrentConfiguration (faad->handle);
conf->defObjectType = LC;
faacDecSetConfiguration (faad->handle, conf);
}
break; break;
case GST_STATE_PAUSED_TO_READY: case GST_STATE_PAUSED_TO_READY:
faad->samplerate = -1; faad->samplerate = -1;

View file

@ -290,7 +290,7 @@ plugin_init (GstPlugin *plugin)
return (gst_element_register (plugin, "xvidenc", return (gst_element_register (plugin, "xvidenc",
GST_RANK_NONE, GST_TYPE_XVIDENC) && GST_RANK_NONE, GST_TYPE_XVIDENC) &&
gst_element_register (plugin, "xviddec", gst_element_register (plugin, "xviddec",
GST_RANK_NONE, GST_TYPE_XVIDDEC)); GST_RANK_SECONDARY, GST_TYPE_XVIDDEC));
} }
GST_PLUGIN_DEFINE ( GST_PLUGIN_DEFINE (