mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
Fixes to make ext/libcaca compile.
Original commit message from CVS: * configure.ac: * ext/Makefile.am: Fixes to make ext/libcaca compile. * ext/divx/gstdivxdec.c: * ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link), (gst_gdk_pixbuf_init), (gst_gdk_pixbuf_chain): Make gdkpixbufdec handle images that span multiple buffers. Now work with both filesrc ! gdkpixbufdec and qtdemux ! gdkpixbufdec. * ext/gdk_pixbuf/gstgdkpixbuf.h: * ext/libcaca/gstcacasink.h: Fixes needed due to recent video/video.h changes * ext/xvid/gstxvid.c: (gst_xvid_csp_to_caps): same * sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_get), (gst_v4lmjpegsrc_buffer_free): Use buffer free function instead of GstData free function. * sys/v4l/gstv4lsrc.c: (gst_v4lsrc_get), (gst_v4lsrc_buffer_free): same.
This commit is contained in:
parent
409384e0d8
commit
733fcc4629
5 changed files with 124 additions and 42 deletions
19
ChangeLog
19
ChangeLog
|
@ -1,3 +1,22 @@
|
|||
2004-01-11 David Schleef <ds@schleef.org>
|
||||
|
||||
* configure.ac:
|
||||
* ext/Makefile.am: Fixes to make ext/libcaca compile.
|
||||
* ext/divx/gstdivxdec.c:
|
||||
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
|
||||
(gst_gdk_pixbuf_init), (gst_gdk_pixbuf_chain): Make gdkpixbufdec
|
||||
handle images that span multiple buffers. Now work with both
|
||||
filesrc ! gdkpixbufdec and qtdemux ! gdkpixbufdec.
|
||||
* ext/gdk_pixbuf/gstgdkpixbuf.h:
|
||||
* ext/libcaca/gstcacasink.h: Fixes needed due to recent
|
||||
video/video.h changes
|
||||
* ext/xvid/gstxvid.c: (gst_xvid_csp_to_caps): same
|
||||
* sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_get),
|
||||
(gst_v4lmjpegsrc_buffer_free): Use buffer free function instead
|
||||
of GstData free function.
|
||||
* sys/v4l/gstv4lsrc.c: (gst_v4lsrc_get), (gst_v4lsrc_buffer_free):
|
||||
same.
|
||||
|
||||
2004-01-12 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
||||
|
||||
* sys/v4l2/gstv4l2element.c: (gst_v4l2element_class_init),
|
||||
|
|
|
@ -154,6 +154,12 @@ else
|
|||
LCS_DIR=
|
||||
endif
|
||||
|
||||
if USE_LIBCACA
|
||||
LIBCACA_DIR=libcaca
|
||||
else
|
||||
LIBCACA_DIR=
|
||||
endif
|
||||
|
||||
if USE_LIBDV
|
||||
LIBDV_DIR=dv
|
||||
else
|
||||
|
@ -323,6 +329,7 @@ SUBDIRS=\
|
|||
$(LADSPA_DIR) \
|
||||
$(LAME_DIR) \
|
||||
$(LCS_DIR) \
|
||||
$(LIBCACA_DIR) \
|
||||
$(LIBDV_DIR) \
|
||||
$(LIBFAME_DIR) \
|
||||
$(LIBPNG_DIR) \
|
||||
|
@ -376,6 +383,7 @@ DIST_SUBDIRS=\
|
|||
ladspa \
|
||||
lame \
|
||||
lcs \
|
||||
libcaca \
|
||||
libfame \
|
||||
libpng \
|
||||
librfb \
|
||||
|
|
|
@ -109,7 +109,7 @@ gst_gdk_pixbuf_sink_link (GstPad *pad, const GstCaps *caps)
|
|||
g_return_val_if_fail (GST_IS_GDK_PIXBUF (filter),
|
||||
GST_PAD_LINK_REFUSED);
|
||||
|
||||
return GST_PAD_LINK_DELAYED;
|
||||
return GST_PAD_LINK_OK;
|
||||
}
|
||||
|
||||
#if GDK_PIXBUF_MAJOR == 2 && GDK_PIXBUF_MINOR < 2
|
||||
|
@ -226,6 +226,7 @@ gst_gdk_pixbuf_init (GstGdkPixbuf *filter)
|
|||
gst_static_pad_template_get( &gst_gdk_pixbuf_sink_template), "sink");
|
||||
gst_pad_set_link_function (filter->sinkpad, gst_gdk_pixbuf_sink_link);
|
||||
gst_pad_set_getcaps_function (filter->sinkpad, gst_gdk_pixbuf_sink_getcaps);
|
||||
|
||||
filter->srcpad = gst_pad_new_from_template (
|
||||
gst_static_pad_template_get( &gst_gdk_pixbuf_src_template), "src");
|
||||
gst_pad_use_explicit_caps (filter->srcpad);
|
||||
|
@ -234,6 +235,7 @@ gst_gdk_pixbuf_init (GstGdkPixbuf *filter)
|
|||
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
|
||||
gst_pad_set_chain_function (filter->sinkpad, gst_gdk_pixbuf_chain);
|
||||
|
||||
GST_FLAG_SET (GST_ELEMENT (filter), GST_ELEMENT_EVENT_AWARE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -241,10 +243,10 @@ gst_gdk_pixbuf_chain (GstPad *pad, GstData *_data)
|
|||
{
|
||||
GstBuffer *buf = GST_BUFFER (_data);
|
||||
GstGdkPixbuf *filter;
|
||||
GdkPixbufLoader *pixbuf_loader;
|
||||
GdkPixbuf *pixbuf;
|
||||
GstBuffer *outbuf;
|
||||
GError *error = NULL;
|
||||
gboolean push_buffer = FALSE;
|
||||
gboolean dump_buffer = FALSE;
|
||||
gboolean got_eos = FALSE;
|
||||
|
||||
GST_DEBUG ("gst_gdk_pixbuf_chain");
|
||||
|
||||
|
@ -254,47 +256,97 @@ gst_gdk_pixbuf_chain (GstPad *pad, GstData *_data)
|
|||
filter = GST_GDK_PIXBUF (GST_OBJECT_PARENT (pad));
|
||||
g_return_if_fail (GST_IS_GDK_PIXBUF (filter));
|
||||
|
||||
pixbuf_loader = gdk_pixbuf_loader_new();
|
||||
//pixbuf_loader = gdk_pixbuf_loader_new_with_type("gif");
|
||||
|
||||
gdk_pixbuf_loader_write(pixbuf_loader, GST_BUFFER_DATA(buf),
|
||||
GST_BUFFER_SIZE(buf), &error);
|
||||
gdk_pixbuf_loader_close(pixbuf_loader, &error);
|
||||
pixbuf = gdk_pixbuf_loader_get_pixbuf(pixbuf_loader);
|
||||
if (GST_IS_EVENT (_data)) {
|
||||
GstEvent *event = GST_EVENT (buf);
|
||||
|
||||
g_print("width=%d height=%d\n", gdk_pixbuf_get_width(pixbuf),
|
||||
gdk_pixbuf_get_height(pixbuf));
|
||||
|
||||
if(filter->image_size == 0){
|
||||
GstCaps *caps;
|
||||
|
||||
filter->width = gdk_pixbuf_get_width(pixbuf);
|
||||
filter->height = gdk_pixbuf_get_height(pixbuf);
|
||||
filter->rowstride = gdk_pixbuf_get_rowstride(pixbuf);
|
||||
filter->image_size = filter->rowstride * filter->height;
|
||||
|
||||
caps = gst_pad_get_caps(filter->srcpad);
|
||||
gst_caps_set_simple (caps,
|
||||
"width", G_TYPE_INT, filter->width,
|
||||
"height", G_TYPE_INT, filter->height,
|
||||
"framerate", G_TYPE_DOUBLE, 0., NULL);
|
||||
|
||||
gst_pad_set_explicit_caps (filter->srcpad, caps);
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_EOS:
|
||||
push_buffer = TRUE;
|
||||
got_eos = TRUE;
|
||||
break;
|
||||
case GST_EVENT_DISCONTINUOUS:
|
||||
dump_buffer = TRUE;
|
||||
break;
|
||||
default:
|
||||
gst_pad_event_default (pad, event);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
outbuf = gst_buffer_new();
|
||||
GST_BUFFER_TIMESTAMP(outbuf) = GST_BUFFER_TIMESTAMP(buf);
|
||||
GST_BUFFER_DURATION(outbuf) = GST_BUFFER_DURATION(buf);
|
||||
|
||||
GST_BUFFER_SIZE(outbuf) = filter->image_size;
|
||||
GST_BUFFER_DATA(outbuf) = g_malloc(filter->image_size);
|
||||
if (filter->last_timestamp != GST_BUFFER_TIMESTAMP (buf)) {
|
||||
push_buffer = TRUE;
|
||||
}
|
||||
|
||||
memcpy(GST_BUFFER_DATA(outbuf), gdk_pixbuf_get_pixels(pixbuf),
|
||||
filter->image_size);
|
||||
if (push_buffer) {
|
||||
if (filter->pixbuf_loader != NULL) {
|
||||
GstBuffer *outbuf;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
g_object_unref(G_OBJECT(pixbuf_loader));
|
||||
gdk_pixbuf_loader_close (filter->pixbuf_loader, NULL);
|
||||
#if 0
|
||||
if (gdk_pixbuf_loader_close (filter->pixbuf_loader, NULL)) {
|
||||
gst_element_error (GST_ELEMENT(filter), "error");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
gst_pad_push (filter->srcpad, GST_DATA (outbuf));
|
||||
pixbuf = gdk_pixbuf_loader_get_pixbuf (filter->pixbuf_loader);
|
||||
|
||||
if(filter->image_size == 0){
|
||||
GstCaps *caps;
|
||||
|
||||
filter->width = gdk_pixbuf_get_width(pixbuf);
|
||||
filter->height = gdk_pixbuf_get_height(pixbuf);
|
||||
filter->rowstride = gdk_pixbuf_get_rowstride(pixbuf);
|
||||
filter->image_size = filter->rowstride * filter->height;
|
||||
|
||||
caps = gst_pad_get_caps(filter->srcpad);
|
||||
gst_caps_set_simple (caps,
|
||||
"width", G_TYPE_INT, filter->width,
|
||||
"height", G_TYPE_INT, filter->height,
|
||||
"framerate", G_TYPE_DOUBLE, 0., NULL);
|
||||
|
||||
gst_pad_set_explicit_caps (filter->srcpad, caps);
|
||||
}
|
||||
|
||||
outbuf = gst_pad_alloc_buffer (filter->srcpad, GST_BUFFER_OFFSET_NONE,
|
||||
filter->image_size);
|
||||
GST_BUFFER_TIMESTAMP(outbuf) = GST_BUFFER_TIMESTAMP(buf);
|
||||
GST_BUFFER_DURATION(outbuf) = GST_BUFFER_DURATION(buf);
|
||||
|
||||
memcpy(GST_BUFFER_DATA(outbuf), gdk_pixbuf_get_pixels(pixbuf),
|
||||
filter->image_size);
|
||||
|
||||
gst_pad_push (filter->srcpad, GST_DATA (outbuf));
|
||||
|
||||
g_object_unref(G_OBJECT(filter->pixbuf_loader));
|
||||
filter->pixbuf_loader = NULL;
|
||||
dump_buffer = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (dump_buffer) {
|
||||
if (filter->pixbuf_loader != NULL) {
|
||||
gdk_pixbuf_loader_close (filter->pixbuf_loader, NULL);
|
||||
g_object_unref(G_OBJECT(filter->pixbuf_loader));
|
||||
filter->pixbuf_loader = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (GST_IS_BUFFER (_data)) {
|
||||
if (filter->pixbuf_loader == NULL) {
|
||||
filter->pixbuf_loader = gdk_pixbuf_loader_new();
|
||||
filter->last_timestamp = GST_BUFFER_TIMESTAMP (buf);
|
||||
}
|
||||
|
||||
gdk_pixbuf_loader_write(filter->pixbuf_loader, GST_BUFFER_DATA(buf),
|
||||
GST_BUFFER_SIZE(buf), &error);
|
||||
gst_buffer_unref (buf);
|
||||
}
|
||||
|
||||
if (got_eos) {
|
||||
gst_pad_event_default (pad, GST_EVENT (_data));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -48,6 +48,9 @@ struct _GstGdkPixbuf
|
|||
|
||||
GstPad *sinkpad, *srcpad;
|
||||
|
||||
GstClockTime last_timestamp;
|
||||
GdkPixbufLoader *pixbuf_loader;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
int rowstride;
|
||||
|
|
|
@ -34,9 +34,9 @@ extern "C" {
|
|||
#define GST_CACA_DEFAULT_SCREEN_WIDTH 80
|
||||
#define GST_CACA_DEFAULT_SCREEN_HEIGHT 25
|
||||
#define GST_CACA_DEFAULT_BPP 24
|
||||
#define GST_CACA_DEFAULT_RED_MASK R_MASK_32_INT
|
||||
#define GST_CACA_DEFAULT_GREEN_MASK G_MASK_32_INT
|
||||
#define GST_CACA_DEFAULT_BLUE_MASK B_MASK_32_INT
|
||||
#define GST_CACA_DEFAULT_RED_MASK GST_VIDEO_BYTE1_MASK_32_INT
|
||||
#define GST_CACA_DEFAULT_GREEN_MASK GST_VIDEO_BYTE2_MASK_32_INT
|
||||
#define GST_CACA_DEFAULT_BLUE_MASK GST_VIDEO_BYTE3_MASK_32_INT
|
||||
|
||||
//#define GST_CACA_DEFAULT_RED_MASK R_MASK_32_REVERSE_INT
|
||||
//#define GST_CACA_DEFAULT_GREEN_MASK G_MASK_32_REVERSE_INT
|
||||
|
|
Loading…
Reference in a new issue