Commit c8168e2c authored by Ronald S. Bultje's avatar Ronald S. Bultje
Browse files

Add an ugly hack for the capsnego system - this should be removed asap, but at...

Add an ugly hack for the capsnego system - this should be removed asap, but at least everything works now

Original commit message from CVS:
Add an ugly hack for the capsnego system - this should be removed asap, but at least everything works now
parent b9b6b9fc
...@@ -325,7 +325,7 @@ gst_v4lsrc_srcconnect (GstPad *pad, ...@@ -325,7 +325,7 @@ gst_v4lsrc_srcconnect (GstPad *pad,
if (!gst_pad_try_set_caps(v4lsrc->srcpad, newcaps)) if (!gst_pad_try_set_caps(v4lsrc->srcpad, newcaps))
continue; continue;
else else
return GST_PAD_CONNECT_DONE; return GST_PAD_CONNECT_OK;
} }
/* still nothing - no good caps */ /* still nothing - no good caps */
...@@ -444,6 +444,9 @@ gst_v4lsrc_change_state (GstElement *element) ...@@ -444,6 +444,9 @@ gst_v4lsrc_change_state (GstElement *element)
GstV4lSrc *v4lsrc; GstV4lSrc *v4lsrc;
GstElementStateReturn parent_value; GstElementStateReturn parent_value;
gint transition = GST_STATE_TRANSITION (element); gint transition = GST_STATE_TRANSITION (element);
guint32 fourcc;
gint depth=0, bpp=0;
GstCaps *caps;
g_return_val_if_fail(GST_IS_V4LSRC(element), GST_STATE_FAILURE); g_return_val_if_fail(GST_IS_V4LSRC(element), GST_STATE_FAILURE);
...@@ -453,6 +456,63 @@ gst_v4lsrc_change_state (GstElement *element) ...@@ -453,6 +456,63 @@ gst_v4lsrc_change_state (GstElement *element)
case GST_STATE_NULL_TO_READY: case GST_STATE_NULL_TO_READY:
break; break;
case GST_STATE_READY_TO_PAUSED: case GST_STATE_READY_TO_PAUSED:
/* extremely ugly hack for a weird behaviour in the capsnego system - try capsnego again */
switch (v4lsrc->mmap.format)
{
case VIDEO_PALETTE_RGB555:
fourcc = GST_MAKE_FOURCC('R','G','B',' ');
bpp = 16;
depth = 15;
break;
case VIDEO_PALETTE_RGB565:
fourcc = GST_MAKE_FOURCC('R','G','B',' ');
bpp = 16;
depth = 16;
break;
case VIDEO_PALETTE_RGB24:
fourcc = GST_MAKE_FOURCC('R','G','B',' ');
bpp = 24;
depth = 24;
break;
case VIDEO_PALETTE_RGB32:
fourcc = GST_MAKE_FOURCC('R','G','B',' ');
bpp = 32;
depth = 32;
break;
case VIDEO_PALETTE_YUV411:
fourcc = GST_MAKE_FOURCC('Y','4','1','P');
break;
case VIDEO_PALETTE_YUV422:
fourcc = GST_MAKE_FOURCC('Y','U','Y','2');
break;
case VIDEO_PALETTE_YUV420P:
fourcc = GST_MAKE_FOURCC('I','4','2','0');
break;
case VIDEO_PALETTE_UYVY:
fourcc = GST_MAKE_FOURCC('U','Y','V','Y');
break;
}
if (bpp && depth)
caps = gst_caps_new("v4lsrc_caps",
"video/raw",
gst_props_new(
"format", GST_PROPS_FOURCC(fourcc),
"width", GST_PROPS_INT(v4lsrc->width),
"height", GST_PROPS_INT(v4lsrc->height),
"bpp", GST_PROPS_INT(bpp),
"depth", GST_PROPS_INT(depth),
NULL ) );
else
caps = gst_caps_new("v4lsrc_caps",
"video/raw",
gst_props_new(
"format", GST_PROPS_FOURCC(fourcc),
"width", GST_PROPS_INT(v4lsrc->width),
"height", GST_PROPS_INT(v4lsrc->height),
NULL ) );
if (!gst_pad_try_set_caps(v4lsrc->srcpad, caps))
return GST_STATE_FAILURE;
if (!gst_v4lsrc_capture_init(v4lsrc)) if (!gst_v4lsrc_capture_init(v4lsrc))
return GST_STATE_FAILURE; return GST_STATE_FAILURE;
break; break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment