Commit 5e606a84 authored by Andy Wingo Wingo's avatar Andy Wingo Wingo

ext/theora/theoradec.c (theora_dec_src_getcaps): Implement a getcaps to do...

ext/theora/theoradec.c (theora_dec_src_getcaps): Implement a getcaps to do explicit caps. Needs to be done in all dec...

Original commit message from CVS:
2005-07-01  Andy Wingo  <wingo@pobox.com>

* ext/theora/theoradec.c (theora_dec_src_getcaps): Implement a
getcaps to do explicit caps. Needs to be done in all decoders,
possibly via a base class.

* configure.ac (GST_PLUGIN_LDFLAGS): Add videoscale.

* ext/ogg/gstoggdemux.c (gst_ogg_pad_typefind): No need to set
caps on the sink pad, just rely on the pad template. Also, setting
ANY caps on a pad is not valid because the caps are not fixed.

* sys/ximage/ximagesink.c (gst_ximagesink_buffer_alloc): Set the
caps on the buffer, and get the width from the desired_caps if
they're set.
(gst_ximagesink_renegotiate_size): Implement via setting the
desired_caps on the ximagesink.
(gst_ximagesink_setcaps): Only reset the width of the player if it
wasn't already set. Not sure if this is right.
(gst_ximagesink_show_frame): Memcpy only for normal buffers.

* sys/ximage/ximagesink.h (desired_caps): New field, is the caps
that the user wants. NULL unless the window has been resized.

* gst/volume/gstvolume.c (volume_transform): Adapt to
basetransform refcount changes.
parent 5f91e70f
2005-07-01 Andy Wingo <wingo@pobox.com>
* ext/theora/theoradec.c (theora_dec_src_getcaps): Implement a
getcaps to do explicit caps. Needs to be done in all decoders,
possibly via a base class.
* configure.ac (GST_PLUGIN_LDFLAGS): Add videoscale.
* ext/ogg/gstoggdemux.c (gst_ogg_pad_typefind): No need to set
caps on the sink pad, just rely on the pad template. Also, setting
ANY caps on a pad is not valid because the caps are not fixed.
* sys/ximage/ximagesink.c (gst_ximagesink_buffer_alloc): Set the
caps on the buffer, and get the width from the desired_caps if
they're set.
(gst_ximagesink_renegotiate_size): Implement via setting the
desired_caps on the ximagesink.
(gst_ximagesink_setcaps): Only reset the width of the player if it
wasn't already set. Not sure if this is right.
(gst_ximagesink_show_frame): Memcpy only for normal buffers.
* sys/ximage/ximagesink.h (desired_caps): New field, is the caps
that the user wants. NULL unless the window has been resized.
* gst/volume/gstvolume.c (volume_transform): Adapt to
basetransform refcount changes.
2005-07-01 Andy Wingo <wingo@pobox.com> 2005-07-01 Andy Wingo <wingo@pobox.com>
* gst/videoscale/gstvideoscale.c: * gst/videoscale/gstvideoscale.c:
......
...@@ -378,6 +378,7 @@ GST_PLUGINS_ALL="\ ...@@ -378,6 +378,7 @@ GST_PLUGINS_ALL="\
typefind \ typefind \
videotestsrc \ videotestsrc \
videorate \ videorate \
videoscale \
volume \ volume \
" "
...@@ -885,6 +886,7 @@ gst/subparse/Makefile ...@@ -885,6 +886,7 @@ gst/subparse/Makefile
gst/typefind/Makefile gst/typefind/Makefile
gst/videotestsrc/Makefile gst/videotestsrc/Makefile
gst/videorate/Makefile gst/videorate/Makefile
gst/videoscale/Makefile
gst/volume/Makefile gst/volume/Makefile
sys/Makefile sys/Makefile
sys/ximage/Makefile sys/ximage/Makefile
......
...@@ -20,6 +20,15 @@ interface for elements that provide color balance operations ...@@ -20,6 +20,15 @@ interface for elements that provide color balance operations
</para> </para>
<!-- ##### SIGNAL GstColorBalance::value-changed ##### -->
<para>
</para>
@gstcolorbalance: the object which received the signal.
@arg1:
@arg2:
<!-- ##### STRUCT GstColorBalanceClass ##### --> <!-- ##### STRUCT GstColorBalanceClass ##### -->
<para> <para>
......
...@@ -45,18 +45,12 @@ gstmixer ...@@ -45,18 +45,12 @@ gstmixer
</para> </para>
@parent:
@values:
@_gst_reserved:
<!-- ##### STRUCT GstMixerTrack ##### --> <!-- ##### STRUCT GstMixerTrack ##### -->
<para> <para>
</para> </para>
@parent:
@label:
@flags:
<!-- ##### FUNCTION gst_mixer_list_tracks ##### --> <!-- ##### FUNCTION gst_mixer_list_tracks ##### -->
<para> <para>
......
...@@ -557,8 +557,6 @@ gst_ogg_pad_typefind (GstOggPad * pad, ogg_packet * packet) ...@@ -557,8 +557,6 @@ gst_ogg_pad_typefind (GstOggPad * pad, ogg_packet * packet)
gst_element_factory_create (GST_ELEMENT_FACTORY (factories->data), gst_element_factory_create (GST_ELEMENT_FACTORY (factories->data),
NULL); NULL);
if (element) { if (element) {
GstCaps *any;
/* this is ours */ /* this is ours */
gst_object_ref (element); gst_object_ref (element);
gst_object_sink (GST_OBJECT (element)); gst_object_sink (GST_OBJECT (element));
...@@ -572,9 +570,6 @@ gst_ogg_pad_typefind (GstOggPad * pad, ogg_packet * packet) ...@@ -572,9 +570,6 @@ gst_ogg_pad_typefind (GstOggPad * pad, ogg_packet * packet)
gst_pad_set_chain_function (pad->elem_out, gst_pad_set_chain_function (pad->elem_out,
gst_ogg_pad_internal_chain); gst_ogg_pad_internal_chain);
gst_pad_set_element_private (pad->elem_out, pad); gst_pad_set_element_private (pad->elem_out, pad);
any = gst_caps_new_any ();
gst_pad_set_caps (pad->elem_out, any);
gst_caps_unref (any);
gst_pad_set_active (pad->elem_out, TRUE); gst_pad_set_active (pad->elem_out, TRUE);
/* and this pad may not be named src.. */ /* and this pad may not be named src.. */
......
...@@ -123,6 +123,7 @@ static gboolean theora_dec_sink_convert (GstPad * pad, ...@@ -123,6 +123,7 @@ static gboolean theora_dec_sink_convert (GstPad * pad,
GstFormat src_format, gint64 src_value, GstFormat src_format, gint64 src_value,
GstFormat * dest_format, gint64 * dest_value); GstFormat * dest_format, gint64 * dest_value);
static gboolean theora_dec_sink_query (GstPad * pad, GstQuery * query); static gboolean theora_dec_sink_query (GstPad * pad, GstQuery * query);
static GstCaps *theora_dec_src_getcaps (GstPad * pad);
#if 0 #if 0
static const GstFormat *theora_get_formats (GstPad * pad); static const GstFormat *theora_get_formats (GstPad * pad);
...@@ -178,6 +179,7 @@ gst_theora_dec_init (GstTheoraDec * dec) ...@@ -178,6 +179,7 @@ gst_theora_dec_init (GstTheoraDec * dec)
dec->srcpad = dec->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get gst_pad_new_from_template (gst_static_pad_template_get
(&theora_dec_src_factory), "src"); (&theora_dec_src_factory), "src");
gst_pad_set_getcaps_function (dec->srcpad, theora_dec_src_getcaps);
gst_pad_set_event_function (dec->srcpad, theora_dec_src_event); gst_pad_set_event_function (dec->srcpad, theora_dec_src_event);
gst_pad_set_query_type_function (dec->srcpad, theora_get_query_types); gst_pad_set_query_type_function (dec->srcpad, theora_get_query_types);
gst_pad_set_query_function (dec->srcpad, theora_dec_src_query); gst_pad_set_query_function (dec->srcpad, theora_dec_src_query);
...@@ -563,6 +565,21 @@ error: ...@@ -563,6 +565,21 @@ error:
return res; return res;
} }
static GstCaps *
theora_dec_src_getcaps (GstPad * pad)
{
GstCaps *caps;
GST_LOCK (pad);
caps = GST_PAD_CAPS (pad);
GST_UNLOCK (pad);
if (caps)
return gst_caps_ref (caps);
else
return gst_caps_ref (gst_pad_get_pad_template_caps (pad));
}
static gboolean static gboolean
theora_dec_sink_event (GstPad * pad, GstEvent * event) theora_dec_sink_event (GstPad * pad, GstEvent * event)
{ {
......
...@@ -346,7 +346,7 @@ volume_transform (GstBaseTransform * base, GstBuffer * inbuf, ...@@ -346,7 +346,7 @@ volume_transform (GstBaseTransform * base, GstBuffer * inbuf,
} }
} }
*outbuf = gst_buffer_make_writable (gst_buffer_ref (inbuf)); *outbuf = gst_buffer_make_writable (inbuf);
filter->process (filter, GST_BUFFER_TIMESTAMP (*outbuf), filter->process (filter, GST_BUFFER_TIMESTAMP (*outbuf),
GST_BUFFER_DATA (*outbuf), GST_BUFFER_SIZE (*outbuf)); GST_BUFFER_DATA (*outbuf), GST_BUFFER_SIZE (*outbuf));
......
...@@ -623,12 +623,6 @@ gst_ximagesink_renegotiate_size (GstXImageSink * ximagesink) ...@@ -623,12 +623,6 @@ gst_ximagesink_renegotiate_size (GstXImageSink * ximagesink)
if (ximagesink->xwindow->width <= 1 || ximagesink->xwindow->height <= 1) if (ximagesink->xwindow->width <= 1 || ximagesink->xwindow->height <= 1)
return; return;
/* FIXME */
#if 0
if (GST_PAD_IS_NEGOTIATING (GST_VIDEOSINK_PAD (ximagesink)) ||
!gst_pad_is_negotiated (GST_VIDEOSINK_PAD (ximagesink)))
return;
/* Window got resized or moved. We do caps negotiation again to get video /* Window got resized or moved. We do caps negotiation again to get video
scaler to fit that new size only if size of the window differs from our scaler to fit that new size only if size of the window differs from our
size. */ size. */
...@@ -658,27 +652,21 @@ gst_ximagesink_renegotiate_size (GstXImageSink * ximagesink) ...@@ -658,27 +652,21 @@ gst_ximagesink_renegotiate_size (GstXImageSink * ximagesink)
nom, den, NULL); nom, den, NULL);
} }
r = gst_pad_try_set_caps (GST_VIDEOSINK_PAD (ximagesink), caps); if (gst_pad_peer_accept_caps (GST_VIDEOSINK_PAD (ximagesink), caps)) {
gst_caps_replace (&ximagesink->desired_caps, caps);
if ((r == GST_PAD_LINK_OK) || (r == GST_PAD_LINK_DONE)) {
/* Renegotiation succeeded, we update our size and image */
GST_VIDEOSINK_WIDTH (ximagesink) = ximagesink->xwindow->width; GST_VIDEOSINK_WIDTH (ximagesink) = ximagesink->xwindow->width;
GST_VIDEOSINK_HEIGHT (ximagesink) = ximagesink->xwindow->height; GST_VIDEOSINK_HEIGHT (ximagesink) = ximagesink->xwindow->height;
if ((ximagesink->ximage) && if (ximagesink->ximage) {
((GST_VIDEOSINK_WIDTH (ximagesink) != ximagesink->ximage->width) ||
(GST_VIDEOSINK_HEIGHT (ximagesink) !=
ximagesink->ximage->height))) {
/* We renew our ximage only if size changed */
GST_DEBUG_OBJECT (ximagesink, "destroying and recreating our ximage"); GST_DEBUG_OBJECT (ximagesink, "destroying and recreating our ximage");
gst_ximagesink_ximage_destroy (ximagesink, ximagesink->ximage); gst_ximagesink_ximage_destroy (ximagesink, ximagesink->ximage);
ximagesink->ximage = NULL; ximagesink->ximage = NULL;
} }
} else { } else {
ximagesink->sw_scaling_failed = TRUE; ximagesink->sw_scaling_failed = TRUE;
gst_caps_unref (caps);
} }
} }
#endif
} }
/* This function handles XEvents that might be in the queue. It generates /* This function handles XEvents that might be in the queue. It generates
...@@ -1060,7 +1048,7 @@ static gboolean ...@@ -1060,7 +1048,7 @@ static gboolean
gst_ximagesink_setcaps (GstBaseSink * bsink, GstCaps * caps) gst_ximagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
{ {
GstXImageSink *ximagesink; GstXImageSink *ximagesink;
gboolean ret; gboolean ret = TRUE;
GstStructure *structure; GstStructure *structure;
const GValue *par; const GValue *par;
...@@ -1074,10 +1062,12 @@ gst_ximagesink_setcaps (GstBaseSink * bsink, GstCaps * caps) ...@@ -1074,10 +1062,12 @@ gst_ximagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
GST_PTR_FORMAT, ximagesink->xcontext->caps, caps); GST_PTR_FORMAT, ximagesink->xcontext->caps, caps);
structure = gst_caps_get_structure (caps, 0); structure = gst_caps_get_structure (caps, 0);
ret = gst_structure_get_int (structure, "width", if (GST_VIDEOSINK_WIDTH (ximagesink) == 0) {
&(GST_VIDEOSINK_WIDTH (ximagesink))); ret &= gst_structure_get_int (structure, "width",
ret &= gst_structure_get_int (structure, "height", &(GST_VIDEOSINK_WIDTH (ximagesink)));
&(GST_VIDEOSINK_HEIGHT (ximagesink))); ret &= gst_structure_get_int (structure, "height",
&(GST_VIDEOSINK_HEIGHT (ximagesink)));
}
ret &= gst_structure_get_double (structure, ret &= gst_structure_get_double (structure,
"framerate", &ximagesink->framerate); "framerate", &ximagesink->framerate);
if (!ret) if (!ret)
...@@ -1250,12 +1240,11 @@ gst_ximagesink_show_frame (GstBaseSink * bsink, GstBuffer * buf) ...@@ -1250,12 +1240,11 @@ gst_ximagesink_show_frame (GstBaseSink * bsink, GstBuffer * buf)
("Failed creating an XImage in ximagesink chain function.")); ("Failed creating an XImage in ximagesink chain function."));
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} }
memcpy (ximagesink->ximage->ximage->data,
GST_BUFFER_DATA (buf),
MIN (GST_BUFFER_SIZE (buf), ximagesink->ximage->size));
gst_ximagesink_ximage_put (ximagesink, ximagesink->ximage);
} }
memcpy (ximagesink->ximage->ximage->data,
GST_BUFFER_DATA (buf),
MIN (GST_BUFFER_SIZE (buf), ximagesink->ximage->size));
gst_ximagesink_ximage_put (ximagesink, ximagesink->ximage);
} }
gst_ximagesink_handle_xevents (ximagesink); gst_ximagesink_handle_xevents (ximagesink);
...@@ -1307,7 +1296,7 @@ gst_ximagesink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size, ...@@ -1307,7 +1296,7 @@ gst_ximagesink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
/* FIXME, we should just parse the caps, and provide a buffer in this format, /* FIXME, we should just parse the caps, and provide a buffer in this format,
* we should not just reconfigure ourselves yet */ * we should not just reconfigure ourselves yet */
if (caps && caps != GST_PAD_CAPS (GST_VIDEOSINK_PAD (ximagesink))) { if (caps && !GST_PAD_CAPS (GST_VIDEOSINK_PAD (ximagesink))) {
if (!gst_ximagesink_setcaps (bsink, caps)) { if (!gst_ximagesink_setcaps (bsink, caps)) {
return GST_FLOW_NOT_NEGOTIATED; return GST_FLOW_NOT_NEGOTIATED;
} }
...@@ -1341,9 +1330,25 @@ gst_ximagesink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size, ...@@ -1341,9 +1330,25 @@ gst_ximagesink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
if (!ximage) { if (!ximage) {
/* We found no suitable image in the pool. Creating... */ /* We found no suitable image in the pool. Creating... */
gint height, width;
if (ximagesink->desired_caps) {
GstStructure *s = gst_caps_get_structure (ximagesink->desired_caps, 0);
gst_structure_get_int (s, "width", &width);
gst_structure_get_int (s, "height", &height);
} else {
width = GST_VIDEOSINK_WIDTH (ximagesink);
height = GST_VIDEOSINK_HEIGHT (ximagesink);
}
GST_DEBUG_OBJECT (ximagesink, "no usable image in pool, creating ximage"); GST_DEBUG_OBJECT (ximagesink, "no usable image in pool, creating ximage");
ximage = gst_ximagesink_ximage_new (ximagesink, ximage = gst_ximagesink_ximage_new (ximagesink, width, height);
GST_VIDEOSINK_WIDTH (ximagesink), GST_VIDEOSINK_HEIGHT (ximagesink));
if (ximagesink->desired_caps)
gst_buffer_set_caps (GST_BUFFER (ximage), ximagesink->desired_caps);
else
gst_buffer_set_caps (GST_BUFFER (ximage), caps);
} }
*buf = GST_BUFFER (ximage); *buf = GST_BUFFER (ximage);
......
...@@ -121,6 +121,8 @@ struct _GstXImageSink { ...@@ -121,6 +121,8 @@ struct _GstXImageSink {
GstXImageBuffer *ximage; GstXImageBuffer *ximage;
GstXImageBuffer *cur_image; GstXImageBuffer *cur_image;
GstCaps *desired_caps;
gdouble framerate; gdouble framerate;
GMutex *x_lock; GMutex *x_lock;
GMutex *stream_lock; GMutex *stream_lock;
......
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