2004-04-30 02:25:09 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2004 Benjamin Otte <otte@gnome.org>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
2005-09-06 22:29:00 +00:00
|
|
|
#include <gst/base/gstadapter.h>
|
2004-04-30 02:25:09 +00:00
|
|
|
#include <gst/video/video.h>
|
|
|
|
#include <gst/audio/audio.h>
|
|
|
|
#include <libvisual/libvisual.h>
|
|
|
|
|
|
|
|
#define GST_TYPE_VISUAL (gst_visual_get_type())
|
|
|
|
#define GST_IS_VISUAL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VISUAL))
|
|
|
|
#define GST_VISUAL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VISUAL,GstVisual))
|
2006-09-16 21:54:48 +00:00
|
|
|
#define GST_IS_VISUAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VISUAL))
|
2004-04-30 02:25:09 +00:00
|
|
|
#define GST_VISUAL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VISUAL,GstVisualClass))
|
|
|
|
#define GST_VISUAL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VISUAL, GstVisualClass))
|
|
|
|
|
|
|
|
typedef struct _GstVisual GstVisual;
|
|
|
|
typedef struct _GstVisualClass GstVisualClass;
|
|
|
|
|
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
Original commit message from CVS:
* configure.ac:
* ext/libvisual/visual.c: (gst_visual_get_type),
(libvisual_log_handler), (gst_visual_getcaps),
(gst_visual_srclink), (gst_visual_change_state), (make_valid_name),
(plugin_init):
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
* ext/smoothwave/Makefile.am:
* ext/smoothwave/demo-osssrc.c: (main):
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_class_init),
(gst_smoothwave_init), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain), (gst_sw_change_state),
(plugin_init):
* ext/smoothwave/gstsmoothwave.h:
Make gstsmoothwave a working element in the 20th century.
* gst/chart/gstchart.c: (gst_chart_init), (gst_chart_srcconnect):
Fix incorrect link function
2004-11-12 17:37:49 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (libvisual_debug);
|
|
|
|
#define GST_CAT_DEFAULT (libvisual_debug)
|
|
|
|
|
2010-10-05 10:00:28 +00:00
|
|
|
/* amounf of samples before we can feed libvisual */
|
|
|
|
#define VISUAL_SAMPLES 512
|
|
|
|
|
|
|
|
#define DEFAULT_WIDTH 320
|
|
|
|
#define DEFAULT_HEIGHT 240
|
|
|
|
#define DEFAULT_FPS_N 25
|
|
|
|
#define DEFAULT_FPS_D 1
|
|
|
|
|
2004-04-30 02:25:09 +00:00
|
|
|
struct _GstVisual
|
|
|
|
{
|
|
|
|
GstElement element;
|
|
|
|
|
|
|
|
/* pads */
|
|
|
|
GstPad *sinkpad;
|
|
|
|
GstPad *srcpad;
|
2006-05-31 16:21:48 +00:00
|
|
|
GstSegment segment;
|
2004-04-30 02:25:09 +00:00
|
|
|
|
|
|
|
/* libvisual stuff */
|
2006-09-27 11:58:17 +00:00
|
|
|
VisAudio *audio;
|
2004-04-30 02:25:09 +00:00
|
|
|
VisVideo *video;
|
|
|
|
VisActor *actor;
|
|
|
|
|
|
|
|
/* audio/video state */
|
2011-08-19 14:49:30 +00:00
|
|
|
GstAudioInfo info;
|
Convert elements to use fractions for their framerate.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_src_setcaps), (get_buffer),
(gst_visual_chain):
* ext/ogg/gstogmparse.c: (gst_ogm_parse_chain):
* ext/theora/theoradec.c: (theora_handle_type_packet):
* ext/theora/theoraenc.c: (theora_enc_sink_setcaps),
(theora_enc_chain):
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps):
* gst-libs/gst/video/video.c: (gst_video_frame_rate):
* gst-libs/gst/video/video.h:
* gst/ffmpegcolorspace/avcodec.h:
* gst/ffmpegcolorspace/gstffmpegcodecmap.c:
(gst_ffmpeg_caps_to_pixfmt):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_set_caps):
* gst/videorate/gstvideorate.c: (gst_videorate_transformcaps),
(gst_videorate_setcaps), (gst_videorate_blank_data),
(gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_src_fixate), (gst_videotestsrc_getcaps),
(gst_videotestsrc_parse_caps), (gst_videotestsrc_setcaps),
(gst_videotestsrc_event), (gst_videotestsrc_create):
* gst/videotestsrc/gstvideotestsrc.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_get_times), (gst_ximagesink_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_setcaps), (gst_xvimagesink_change_state),
(gst_xvimagesink_get_times), (gst_xvimagesink_init):
* sys/xvimage/xvimagesink.h:
Convert elements to use fractions for their framerate.
V4L elements to come later tonight.
2005-11-22 16:08:37 +00:00
|
|
|
|
|
|
|
/* framerate numerator & denominator */
|
|
|
|
gint fps_n;
|
|
|
|
gint fps_d;
|
2004-04-30 02:25:09 +00:00
|
|
|
gint width;
|
|
|
|
gint height;
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
GstClockTime duration;
|
|
|
|
guint outsize;
|
2011-04-29 16:23:25 +00:00
|
|
|
GstBufferPool *pool;
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
|
|
|
|
/* samples per frame based on caps */
|
|
|
|
guint spf;
|
2004-05-04 00:44:19 +00:00
|
|
|
|
|
|
|
/* state stuff */
|
|
|
|
GstAdapter *adapter;
|
|
|
|
guint count;
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
|
|
|
|
/* QoS stuff *//* with LOCK */
|
|
|
|
gdouble proportion;
|
|
|
|
GstClockTime earliest_time;
|
2004-04-30 02:25:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _GstVisualClass
|
|
|
|
{
|
|
|
|
GstElementClass parent_class;
|
|
|
|
|
|
|
|
VisPluginRef *plugin;
|
|
|
|
};
|
|
|
|
|
|
|
|
GType gst_visual_get_type (void);
|
|
|
|
|
|
|
|
|
|
|
|
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
2011-06-16 10:48:33 +00:00
|
|
|
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (" { "
|
2004-05-11 15:31:36 +00:00
|
|
|
#if G_BYTE_ORDER == G_BIG_ENDIAN
|
2011-06-16 10:48:33 +00:00
|
|
|
"\"xRGB\", " "\"RGB\", "
|
2004-05-11 15:31:36 +00:00
|
|
|
#else
|
2011-06-16 10:48:33 +00:00
|
|
|
"\"BGRx\", " "\"BGR\", "
|
2004-05-11 15:31:36 +00:00
|
|
|
#endif
|
2011-06-16 10:48:33 +00:00
|
|
|
"\"RGB16\" } "))
|
2004-04-30 02:25:09 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
2011-08-19 14:49:30 +00:00
|
|
|
GST_STATIC_CAPS ("audio/x-raw, "
|
|
|
|
"format = (string) " GST_AUDIO_NE (S16) ", "
|
|
|
|
"channels = (int) { 1, 2 }, "
|
2006-09-27 11:58:17 +00:00
|
|
|
#if defined(VISUAL_API_VERSION) && VISUAL_API_VERSION >= 4000 && VISUAL_API_VERSION < 5000
|
|
|
|
"rate = (int) { 8000, 11250, 22500, 32000, 44100, 48000, 96000 }"
|
|
|
|
#else
|
|
|
|
"rate = (int) [ 1000, MAX ]"
|
|
|
|
#endif
|
|
|
|
)
|
2004-04-30 02:25:09 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
static void gst_visual_class_init (gpointer g_class, gpointer class_data);
|
|
|
|
static void gst_visual_init (GstVisual * visual);
|
2011-04-29 16:23:25 +00:00
|
|
|
static void gst_visual_finalize (GObject * object);
|
2004-04-30 02:25:09 +00:00
|
|
|
|
2005-09-02 15:43:18 +00:00
|
|
|
static GstStateChangeReturn gst_visual_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
2005-09-06 22:29:00 +00:00
|
|
|
static GstFlowReturn gst_visual_chain (GstPad * pad, GstBuffer * buffer);
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
static gboolean gst_visual_sink_event (GstPad * pad, GstEvent * event);
|
|
|
|
static gboolean gst_visual_src_event (GstPad * pad, GstEvent * event);
|
2004-04-30 02:25:09 +00:00
|
|
|
|
2011-05-17 09:25:31 +00:00
|
|
|
static gboolean gst_visual_src_query (GstPad * pad, GstQuery * query);
|
2010-10-05 10:01:25 +00:00
|
|
|
|
2005-09-07 20:06:43 +00:00
|
|
|
static gboolean gst_visual_sink_setcaps (GstPad * pad, GstCaps * caps);
|
2011-05-16 10:18:03 +00:00
|
|
|
static GstCaps *gst_visual_getcaps (GstPad * pad, GstCaps * filter);
|
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
Original commit message from CVS:
* configure.ac:
* ext/libvisual/visual.c: (gst_visual_get_type),
(libvisual_log_handler), (gst_visual_getcaps),
(gst_visual_srclink), (gst_visual_change_state), (make_valid_name),
(plugin_init):
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
* ext/smoothwave/Makefile.am:
* ext/smoothwave/demo-osssrc.c: (main):
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_class_init),
(gst_smoothwave_init), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain), (gst_sw_change_state),
(plugin_init):
* ext/smoothwave/gstsmoothwave.h:
Make gstsmoothwave a working element in the 20th century.
* gst/chart/gstchart.c: (gst_chart_init), (gst_chart_srcconnect):
Fix incorrect link function
2004-11-12 17:37:49 +00:00
|
|
|
static void libvisual_log_handler (const char *message, const char *funcname,
|
|
|
|
void *priv);
|
2004-04-30 02:25:09 +00:00
|
|
|
|
|
|
|
static GstElementClass *parent_class = NULL;
|
|
|
|
|
|
|
|
GType
|
|
|
|
gst_visual_get_type (void)
|
|
|
|
{
|
|
|
|
static GType type = 0;
|
|
|
|
|
ext/libvisual/visual.c: Small cleanups.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_get_type),
(gst_visual_src_setcaps), (gst_vis_src_negotiate),
(gst_visual_chain):
Small cleanups.
* ext/theora/gsttheoradec.h:
* ext/theora/theoradec.c: (gst_theora_dec_init),
(gst_theora_dec_reset), (_theora_granule_time),
(theora_dec_src_convert), (theora_dec_sink_convert),
(theora_dec_src_query), (theora_dec_src_event),
(theora_dec_sink_event), (theora_handle_comment_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Add simple QoS.
2006-03-09 17:58:00 +00:00
|
|
|
if (G_UNLIKELY (type == 0)) {
|
2004-04-30 02:25:09 +00:00
|
|
|
static const GTypeInfo info = {
|
|
|
|
sizeof (GstVisualClass),
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
gst_visual_class_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
sizeof (GstVisual),
|
|
|
|
0,
|
|
|
|
(GInstanceInitFunc) gst_visual_init,
|
|
|
|
};
|
|
|
|
|
|
|
|
type = g_type_register_static (GST_TYPE_ELEMENT, "GstVisual", &info, 0);
|
|
|
|
}
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
Original commit message from CVS:
* configure.ac:
* ext/libvisual/visual.c: (gst_visual_get_type),
(libvisual_log_handler), (gst_visual_getcaps),
(gst_visual_srclink), (gst_visual_change_state), (make_valid_name),
(plugin_init):
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
* ext/smoothwave/Makefile.am:
* ext/smoothwave/demo-osssrc.c: (main):
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_class_init),
(gst_smoothwave_init), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain), (gst_sw_change_state),
(plugin_init):
* ext/smoothwave/gstsmoothwave.h:
Make gstsmoothwave a working element in the 20th century.
* gst/chart/gstchart.c: (gst_chart_init), (gst_chart_srcconnect):
Fix incorrect link function
2004-11-12 17:37:49 +00:00
|
|
|
static void
|
|
|
|
libvisual_log_handler (const char *message, const char *funcname, void *priv)
|
|
|
|
{
|
|
|
|
GST_CAT_LEVEL_LOG (libvisual_debug, (GstDebugLevel) (priv), NULL, "%s - %s",
|
|
|
|
funcname, message);
|
|
|
|
}
|
|
|
|
|
2004-04-30 02:25:09 +00:00
|
|
|
static void
|
|
|
|
gst_visual_class_init (gpointer g_class, gpointer class_data)
|
|
|
|
{
|
|
|
|
GstVisualClass *klass = GST_VISUAL_CLASS (g_class);
|
2004-05-04 00:44:19 +00:00
|
|
|
GstElementClass *element = GST_ELEMENT_CLASS (g_class);
|
|
|
|
GObjectClass *object = G_OBJECT_CLASS (g_class);
|
2004-04-30 02:25:09 +00:00
|
|
|
|
|
|
|
klass->plugin = class_data;
|
|
|
|
|
|
|
|
element->change_state = gst_visual_change_state;
|
|
|
|
|
|
|
|
if (class_data == NULL) {
|
|
|
|
parent_class = g_type_class_peek_parent (g_class);
|
|
|
|
} else {
|
2010-03-16 14:45:23 +00:00
|
|
|
char *longname = g_strdup_printf ("libvisual %s plugin v.%s",
|
2004-04-30 02:25:09 +00:00
|
|
|
klass->plugin->info->name, klass->plugin->info->version);
|
|
|
|
|
|
|
|
/* FIXME: improve to only register what plugin supports? */
|
|
|
|
gst_element_class_add_pad_template (element,
|
|
|
|
gst_static_pad_template_get (&src_template));
|
|
|
|
gst_element_class_add_pad_template (element,
|
|
|
|
gst_static_pad_template_get (&sink_template));
|
2011-04-29 16:23:25 +00:00
|
|
|
|
2010-03-16 14:45:23 +00:00
|
|
|
gst_element_class_set_details_simple (element,
|
|
|
|
longname, "Visualization",
|
|
|
|
klass->plugin->info->about, "Benjamin Otte <otte@gnome.org>");
|
|
|
|
|
|
|
|
g_free (longname);
|
2004-04-30 02:25:09 +00:00
|
|
|
}
|
|
|
|
|
2011-04-29 16:23:25 +00:00
|
|
|
object->finalize = gst_visual_finalize;
|
2004-04-30 02:25:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_visual_init (GstVisual * visual)
|
|
|
|
{
|
|
|
|
/* create the sink and src pads */
|
2005-11-16 18:21:46 +00:00
|
|
|
visual->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
|
2004-04-30 02:25:09 +00:00
|
|
|
gst_pad_set_chain_function (visual->sinkpad, gst_visual_chain);
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
gst_pad_set_event_function (visual->sinkpad, gst_visual_sink_event);
|
2004-04-30 02:25:09 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (visual), visual->sinkpad);
|
|
|
|
|
2005-11-16 18:21:46 +00:00
|
|
|
visual->srcpad = gst_pad_new_from_static_template (&src_template, "src");
|
2004-04-30 02:25:09 +00:00
|
|
|
gst_pad_set_getcaps_function (visual->srcpad, gst_visual_getcaps);
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
gst_pad_set_event_function (visual->srcpad, gst_visual_src_event);
|
2010-10-05 10:01:25 +00:00
|
|
|
gst_pad_set_query_function (visual->srcpad, gst_visual_src_query);
|
2004-04-30 02:25:09 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (visual), visual->srcpad);
|
|
|
|
|
2004-05-04 00:44:19 +00:00
|
|
|
visual->adapter = gst_adapter_new ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
gst_visual_clear_actors (GstVisual * visual)
|
2004-05-04 00:44:19 +00:00
|
|
|
{
|
2005-09-07 20:06:43 +00:00
|
|
|
if (visual->actor) {
|
|
|
|
visual_object_unref (VISUAL_OBJECT (visual->actor));
|
|
|
|
visual->actor = NULL;
|
|
|
|
}
|
|
|
|
if (visual->video) {
|
|
|
|
visual_object_unref (VISUAL_OBJECT (visual->video));
|
|
|
|
visual->video = NULL;
|
|
|
|
}
|
2006-09-27 11:58:17 +00:00
|
|
|
if (visual->audio) {
|
|
|
|
visual_object_unref (VISUAL_OBJECT (visual->audio));
|
|
|
|
visual->audio = NULL;
|
|
|
|
}
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-04-29 16:23:25 +00:00
|
|
|
gst_visual_finalize (GObject * object)
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
{
|
|
|
|
GstVisual *visual = GST_VISUAL (object);
|
|
|
|
|
2011-04-29 16:23:25 +00:00
|
|
|
g_object_unref (visual->adapter);
|
2011-05-06 09:31:43 +00:00
|
|
|
if (visual->pool)
|
|
|
|
gst_object_unref (visual->pool);
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
gst_visual_clear_actors (visual);
|
|
|
|
|
2011-04-29 16:23:25 +00:00
|
|
|
GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
|
2004-04-30 02:25:09 +00:00
|
|
|
}
|
|
|
|
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
static void
|
|
|
|
gst_visual_reset (GstVisual * visual)
|
|
|
|
{
|
|
|
|
gst_adapter_clear (visual->adapter);
|
2006-05-31 16:21:48 +00:00
|
|
|
gst_segment_init (&visual->segment, GST_FORMAT_UNDEFINED);
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
|
|
|
|
GST_OBJECT_LOCK (visual);
|
|
|
|
visual->proportion = 1.0;
|
|
|
|
visual->earliest_time = -1;
|
|
|
|
GST_OBJECT_UNLOCK (visual);
|
|
|
|
}
|
|
|
|
|
2004-04-30 02:25:09 +00:00
|
|
|
static GstCaps *
|
2011-05-16 10:18:03 +00:00
|
|
|
gst_visual_getcaps (GstPad * pad, GstCaps * filter)
|
2004-04-30 02:25:09 +00:00
|
|
|
{
|
|
|
|
GstCaps *ret;
|
|
|
|
GstVisual *visual = GST_VISUAL (gst_pad_get_parent (pad));
|
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
Original commit message from CVS:
* configure.ac:
* ext/libvisual/visual.c: (gst_visual_get_type),
(libvisual_log_handler), (gst_visual_getcaps),
(gst_visual_srclink), (gst_visual_change_state), (make_valid_name),
(plugin_init):
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
* ext/smoothwave/Makefile.am:
* ext/smoothwave/demo-osssrc.c: (main):
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_class_init),
(gst_smoothwave_init), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain), (gst_sw_change_state),
(plugin_init):
* ext/smoothwave/gstsmoothwave.h:
Make gstsmoothwave a working element in the 20th century.
* gst/chart/gstchart.c: (gst_chart_init), (gst_chart_srcconnect):
Fix incorrect link function
2004-11-12 17:37:49 +00:00
|
|
|
int depths;
|
2004-04-30 02:25:09 +00:00
|
|
|
|
2006-03-07 12:49:03 +00:00
|
|
|
if (!visual->actor) {
|
2011-05-17 11:01:39 +00:00
|
|
|
ret = gst_pad_get_pad_template_caps (visual->srcpad);
|
2006-03-07 12:49:03 +00:00
|
|
|
goto beach;
|
|
|
|
}
|
2004-04-30 02:25:09 +00:00
|
|
|
|
|
|
|
ret = gst_caps_new_empty ();
|
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
Original commit message from CVS:
* configure.ac:
* ext/libvisual/visual.c: (gst_visual_get_type),
(libvisual_log_handler), (gst_visual_getcaps),
(gst_visual_srclink), (gst_visual_change_state), (make_valid_name),
(plugin_init):
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
* ext/smoothwave/Makefile.am:
* ext/smoothwave/demo-osssrc.c: (main):
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_class_init),
(gst_smoothwave_init), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain), (gst_sw_change_state),
(plugin_init):
* ext/smoothwave/gstsmoothwave.h:
Make gstsmoothwave a working element in the 20th century.
* gst/chart/gstchart.c: (gst_chart_init), (gst_chart_srcconnect):
Fix incorrect link function
2004-11-12 17:37:49 +00:00
|
|
|
depths = visual_actor_get_supported_depth (visual->actor);
|
|
|
|
if (depths < 0) {
|
|
|
|
/* FIXME: set an error */
|
2006-03-07 12:49:03 +00:00
|
|
|
goto beach;
|
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
Original commit message from CVS:
* configure.ac:
* ext/libvisual/visual.c: (gst_visual_get_type),
(libvisual_log_handler), (gst_visual_getcaps),
(gst_visual_srclink), (gst_visual_change_state), (make_valid_name),
(plugin_init):
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
* ext/smoothwave/Makefile.am:
* ext/smoothwave/demo-osssrc.c: (main):
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_class_init),
(gst_smoothwave_init), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain), (gst_sw_change_state),
(plugin_init):
* ext/smoothwave/gstsmoothwave.h:
Make gstsmoothwave a working element in the 20th century.
* gst/chart/gstchart.c: (gst_chart_init), (gst_chart_srcconnect):
Fix incorrect link function
2004-11-12 17:37:49 +00:00
|
|
|
}
|
|
|
|
if (depths == VISUAL_VIDEO_DEPTH_GL) {
|
|
|
|
/* We can't handle GL only plugins */
|
2006-03-07 12:49:03 +00:00
|
|
|
goto beach;
|
2004-04-30 02:25:09 +00:00
|
|
|
}
|
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
Original commit message from CVS:
* configure.ac:
* ext/libvisual/visual.c: (gst_visual_get_type),
(libvisual_log_handler), (gst_visual_getcaps),
(gst_visual_srclink), (gst_visual_change_state), (make_valid_name),
(plugin_init):
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
* ext/smoothwave/Makefile.am:
* ext/smoothwave/demo-osssrc.c: (main):
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_class_init),
(gst_smoothwave_init), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain), (gst_sw_change_state),
(plugin_init):
* ext/smoothwave/gstsmoothwave.h:
Make gstsmoothwave a working element in the 20th century.
* gst/chart/gstchart.c: (gst_chart_init), (gst_chart_srcconnect):
Fix incorrect link function
2004-11-12 17:37:49 +00:00
|
|
|
|
2005-09-07 20:06:43 +00:00
|
|
|
GST_DEBUG_OBJECT (visual, "libvisual plugin supports depths %u (0x%04x)",
|
|
|
|
depths, depths);
|
|
|
|
/* if (depths & VISUAL_VIDEO_DEPTH_32BIT) Always supports 32bit output */
|
2011-06-16 10:48:33 +00:00
|
|
|
#if G_BYTE_ORDER == G_BIG_ENDIAN
|
|
|
|
gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("xRGB")));
|
|
|
|
#else
|
|
|
|
gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("BGRx")));
|
|
|
|
#endif
|
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
Original commit message from CVS:
* configure.ac:
* ext/libvisual/visual.c: (gst_visual_get_type),
(libvisual_log_handler), (gst_visual_getcaps),
(gst_visual_srclink), (gst_visual_change_state), (make_valid_name),
(plugin_init):
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
* ext/smoothwave/Makefile.am:
* ext/smoothwave/demo-osssrc.c: (main):
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_class_init),
(gst_smoothwave_init), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain), (gst_sw_change_state),
(plugin_init):
* ext/smoothwave/gstsmoothwave.h:
Make gstsmoothwave a working element in the 20th century.
* gst/chart/gstchart.c: (gst_chart_init), (gst_chart_srcconnect):
Fix incorrect link function
2004-11-12 17:37:49 +00:00
|
|
|
|
|
|
|
if (depths & VISUAL_VIDEO_DEPTH_24BIT) {
|
2004-05-11 15:31:36 +00:00
|
|
|
#if G_BYTE_ORDER == G_BIG_ENDIAN
|
2011-06-16 10:48:33 +00:00
|
|
|
gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("RGB")));
|
2004-05-11 15:31:36 +00:00
|
|
|
#else
|
2011-06-16 10:48:33 +00:00
|
|
|
gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("BGR")));
|
2004-05-11 15:31:36 +00:00
|
|
|
#endif
|
2004-04-30 02:25:09 +00:00
|
|
|
}
|
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
Original commit message from CVS:
* configure.ac:
* ext/libvisual/visual.c: (gst_visual_get_type),
(libvisual_log_handler), (gst_visual_getcaps),
(gst_visual_srclink), (gst_visual_change_state), (make_valid_name),
(plugin_init):
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
* ext/smoothwave/Makefile.am:
* ext/smoothwave/demo-osssrc.c: (main):
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_class_init),
(gst_smoothwave_init), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain), (gst_sw_change_state),
(plugin_init):
* ext/smoothwave/gstsmoothwave.h:
Make gstsmoothwave a working element in the 20th century.
* gst/chart/gstchart.c: (gst_chart_init), (gst_chart_srcconnect):
Fix incorrect link function
2004-11-12 17:37:49 +00:00
|
|
|
if (depths & VISUAL_VIDEO_DEPTH_16BIT) {
|
2011-06-16 10:48:33 +00:00
|
|
|
gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_MAKE ("RGB16")));
|
2004-04-30 02:25:09 +00:00
|
|
|
}
|
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
Original commit message from CVS:
* configure.ac:
* ext/libvisual/visual.c: (gst_visual_get_type),
(libvisual_log_handler), (gst_visual_getcaps),
(gst_visual_srclink), (gst_visual_change_state), (make_valid_name),
(plugin_init):
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
* ext/smoothwave/Makefile.am:
* ext/smoothwave/demo-osssrc.c: (main):
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_class_init),
(gst_smoothwave_init), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain), (gst_sw_change_state),
(plugin_init):
* ext/smoothwave/gstsmoothwave.h:
Make gstsmoothwave a working element in the 20th century.
* gst/chart/gstchart.c: (gst_chart_init), (gst_chart_srcconnect):
Fix incorrect link function
2004-11-12 17:37:49 +00:00
|
|
|
|
2006-03-07 12:49:03 +00:00
|
|
|
beach:
|
|
|
|
|
2011-05-16 10:18:03 +00:00
|
|
|
if (filter) {
|
|
|
|
GstCaps *intersection;
|
|
|
|
|
|
|
|
intersection =
|
|
|
|
gst_caps_intersect_full (filter, ret, GST_CAPS_INTERSECT_FIRST);
|
|
|
|
gst_caps_unref (ret);
|
|
|
|
ret = intersection;
|
|
|
|
}
|
|
|
|
|
2005-09-07 20:06:43 +00:00
|
|
|
GST_DEBUG_OBJECT (visual, "returning caps %" GST_PTR_FORMAT, ret);
|
2006-03-07 12:49:03 +00:00
|
|
|
gst_object_unref (visual);
|
2004-04-30 02:25:09 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-09-07 20:06:43 +00:00
|
|
|
static gboolean
|
2011-05-19 10:42:46 +00:00
|
|
|
gst_visual_src_setcaps (GstVisual * visual, GstCaps * caps)
|
2004-04-30 02:25:09 +00:00
|
|
|
{
|
2011-06-09 09:52:32 +00:00
|
|
|
gboolean res;
|
2004-04-30 02:25:09 +00:00
|
|
|
GstStructure *structure;
|
2011-08-19 14:49:30 +00:00
|
|
|
gint depth, pitch, rate;
|
2011-06-16 10:48:33 +00:00
|
|
|
const gchar *fmt;
|
2004-04-30 02:25:09 +00:00
|
|
|
|
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
|
|
|
|
2006-02-26 21:05:46 +00:00
|
|
|
GST_DEBUG_OBJECT (visual, "src pad got caps %" GST_PTR_FORMAT, caps);
|
|
|
|
|
2004-04-30 02:25:09 +00:00
|
|
|
if (!gst_structure_get_int (structure, "width", &visual->width))
|
2006-03-07 12:49:03 +00:00
|
|
|
goto error;
|
2004-04-30 02:25:09 +00:00
|
|
|
if (!gst_structure_get_int (structure, "height", &visual->height))
|
2006-03-07 12:49:03 +00:00
|
|
|
goto error;
|
2011-06-16 10:48:33 +00:00
|
|
|
if (!(fmt = gst_structure_get_string (structure, "format")))
|
2006-03-07 12:49:03 +00:00
|
|
|
goto error;
|
Updates for API changes
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_src_setcaps), (get_buffer),
(gst_visual_chain):
* ext/theora/theoraenc.c: (theora_enc_sink_setcaps):
* gst/videorate/gstvideorate.c: (gst_videorate_setcaps),
(gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_src_fixate), (gst_videotestsrc_create):
* sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_get_fps),
(gst_v4lmjpegsrc_src_convert), (gst_v4lmjpegsrc_src_query),
(gst_v4lmjpegsrc_get), (gst_v4lmjpegsrc_getcaps):
* sys/v4l/v4lsrc_calls.c: (gst_v4lsrc_get_fps),
(gst_v4lsrc_get_fps_list), (gst_v4lsrc_buffer_new):
Updates for API changes
2005-11-23 13:25:54 +00:00
|
|
|
if (!gst_structure_get_fraction (structure, "framerate", &visual->fps_n,
|
|
|
|
&visual->fps_d))
|
2006-03-07 12:49:03 +00:00
|
|
|
goto error;
|
Convert elements to use fractions for their framerate.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_src_setcaps), (get_buffer),
(gst_visual_chain):
* ext/ogg/gstogmparse.c: (gst_ogm_parse_chain):
* ext/theora/theoradec.c: (theora_handle_type_packet):
* ext/theora/theoraenc.c: (theora_enc_sink_setcaps),
(theora_enc_chain):
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps):
* gst-libs/gst/video/video.c: (gst_video_frame_rate):
* gst-libs/gst/video/video.h:
* gst/ffmpegcolorspace/avcodec.h:
* gst/ffmpegcolorspace/gstffmpegcodecmap.c:
(gst_ffmpeg_caps_to_pixfmt):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_set_caps):
* gst/videorate/gstvideorate.c: (gst_videorate_transformcaps),
(gst_videorate_setcaps), (gst_videorate_blank_data),
(gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_src_fixate), (gst_videotestsrc_getcaps),
(gst_videotestsrc_parse_caps), (gst_videotestsrc_setcaps),
(gst_videotestsrc_event), (gst_videotestsrc_create):
* gst/videotestsrc/gstvideotestsrc.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_setcaps), (gst_ximagesink_change_state),
(gst_ximagesink_get_times), (gst_ximagesink_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_setcaps), (gst_xvimagesink_change_state),
(gst_xvimagesink_get_times), (gst_xvimagesink_init):
* sys/xvimage/xvimagesink.h:
Convert elements to use fractions for their framerate.
V4L elements to come later tonight.
2005-11-22 16:08:37 +00:00
|
|
|
|
2011-06-16 10:48:33 +00:00
|
|
|
if (!strcmp (fmt, "BGR") || !strcmp (fmt, "RGB"))
|
|
|
|
depth = 24;
|
|
|
|
else if (!strcmp (fmt, "BGRx") || !strcmp (fmt, "xRGB"))
|
|
|
|
depth = 32;
|
|
|
|
else
|
|
|
|
depth = 16;
|
|
|
|
|
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
Original commit message from CVS:
* configure.ac:
* ext/libvisual/visual.c: (gst_visual_get_type),
(libvisual_log_handler), (gst_visual_getcaps),
(gst_visual_srclink), (gst_visual_change_state), (make_valid_name),
(plugin_init):
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
* ext/smoothwave/Makefile.am:
* ext/smoothwave/demo-osssrc.c: (main):
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_class_init),
(gst_smoothwave_init), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain), (gst_sw_change_state),
(plugin_init):
* ext/smoothwave/gstsmoothwave.h:
Make gstsmoothwave a working element in the 20th century.
* gst/chart/gstchart.c: (gst_chart_init), (gst_chart_srcconnect):
Fix incorrect link function
2004-11-12 17:37:49 +00:00
|
|
|
visual_video_set_depth (visual->video,
|
2004-04-30 02:25:09 +00:00
|
|
|
visual_video_depth_enum_from_value (depth));
|
|
|
|
visual_video_set_dimension (visual->video, visual->width, visual->height);
|
2007-01-29 10:25:11 +00:00
|
|
|
pitch = GST_ROUND_UP_4 (visual->width * visual->video->bpp);
|
|
|
|
visual_video_set_pitch (visual->video, pitch);
|
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
Original commit message from CVS:
* configure.ac:
* ext/libvisual/visual.c: (gst_visual_get_type),
(libvisual_log_handler), (gst_visual_getcaps),
(gst_visual_srclink), (gst_visual_change_state), (make_valid_name),
(plugin_init):
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
* ext/smoothwave/Makefile.am:
* ext/smoothwave/demo-osssrc.c: (main):
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_class_init),
(gst_smoothwave_init), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain), (gst_sw_change_state),
(plugin_init):
* ext/smoothwave/gstsmoothwave.h:
Make gstsmoothwave a working element in the 20th century.
* gst/chart/gstchart.c: (gst_chart_init), (gst_chart_srcconnect):
Fix incorrect link function
2004-11-12 17:37:49 +00:00
|
|
|
visual_actor_video_negotiate (visual->actor, 0, FALSE, FALSE);
|
2004-04-30 02:25:09 +00:00
|
|
|
|
2011-08-19 14:49:30 +00:00
|
|
|
rate = GST_AUDIO_INFO_RATE (&visual->info);
|
|
|
|
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
/* precalc some values */
|
2007-01-29 10:25:11 +00:00
|
|
|
visual->outsize = visual->video->height * pitch;
|
2011-08-19 14:49:30 +00:00
|
|
|
visual->spf = gst_util_uint64_scale_int (rate, visual->fps_d, visual->fps_n);
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
visual->duration =
|
|
|
|
gst_util_uint64_scale_int (GST_SECOND, visual->fps_d, visual->fps_n);
|
|
|
|
|
2011-06-09 09:52:32 +00:00
|
|
|
res = gst_pad_push_event (visual->srcpad, gst_event_new_caps (caps));
|
2011-05-19 10:42:46 +00:00
|
|
|
|
2011-06-09 09:52:32 +00:00
|
|
|
return res;
|
2006-03-07 12:49:03 +00:00
|
|
|
|
ext/libvisual/visual.c: Small cleanups.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_get_type),
(gst_visual_src_setcaps), (gst_vis_src_negotiate),
(gst_visual_chain):
Small cleanups.
* ext/theora/gsttheoradec.h:
* ext/theora/theoradec.c: (gst_theora_dec_init),
(gst_theora_dec_reset), (_theora_granule_time),
(theora_dec_src_convert), (theora_dec_sink_convert),
(theora_dec_src_query), (theora_dec_src_event),
(theora_dec_sink_event), (theora_handle_comment_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Add simple QoS.
2006-03-09 17:58:00 +00:00
|
|
|
/* ERRORS */
|
2006-03-07 12:49:03 +00:00
|
|
|
error:
|
|
|
|
{
|
ext/libvisual/visual.c: Small cleanups.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_get_type),
(gst_visual_src_setcaps), (gst_vis_src_negotiate),
(gst_visual_chain):
Small cleanups.
* ext/theora/gsttheoradec.h:
* ext/theora/theoradec.c: (gst_theora_dec_init),
(gst_theora_dec_reset), (_theora_granule_time),
(theora_dec_src_convert), (theora_dec_sink_convert),
(theora_dec_src_query), (theora_dec_src_event),
(theora_dec_sink_event), (theora_handle_comment_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Add simple QoS.
2006-03-09 17:58:00 +00:00
|
|
|
GST_DEBUG_OBJECT (visual, "error parsing caps");
|
2006-03-07 12:49:03 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2004-04-30 02:25:09 +00:00
|
|
|
}
|
|
|
|
|
2005-09-07 20:06:43 +00:00
|
|
|
static gboolean
|
2005-09-06 22:29:00 +00:00
|
|
|
gst_visual_sink_setcaps (GstPad * pad, GstCaps * caps)
|
2004-04-30 02:25:09 +00:00
|
|
|
{
|
|
|
|
GstVisual *visual = GST_VISUAL (gst_pad_get_parent (pad));
|
2011-08-19 14:49:30 +00:00
|
|
|
GstAudioInfo info;
|
|
|
|
gint rate;
|
2004-04-30 02:25:09 +00:00
|
|
|
|
2011-08-19 14:49:30 +00:00
|
|
|
if (!gst_audio_info_from_caps (&info, caps))
|
|
|
|
goto invalid_caps;
|
2004-04-30 02:25:09 +00:00
|
|
|
|
2011-08-19 14:49:30 +00:00
|
|
|
visual->info = info;
|
|
|
|
|
|
|
|
rate = GST_AUDIO_INFO_RATE (&info);
|
2004-04-30 02:25:09 +00:00
|
|
|
|
2007-03-09 16:46:35 +00:00
|
|
|
/* this is how many samples we need to fill one frame at the requested
|
|
|
|
* framerate. */
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
if (visual->fps_n != 0) {
|
|
|
|
visual->spf =
|
2011-08-19 14:49:30 +00:00
|
|
|
gst_util_uint64_scale_int (rate, visual->fps_d, visual->fps_n);
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
}
|
|
|
|
|
2006-03-07 12:49:03 +00:00
|
|
|
gst_object_unref (visual);
|
2011-08-19 14:49:30 +00:00
|
|
|
|
2005-09-07 20:06:43 +00:00
|
|
|
return TRUE;
|
2011-08-19 14:49:30 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
invalid_caps:
|
|
|
|
{
|
|
|
|
GST_ERROR_OBJECT (visual, "invalid caps received");
|
|
|
|
gst_object_unref (visual);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-09-07 20:06:43 +00:00
|
|
|
}
|
|
|
|
|
2006-02-27 12:08:22 +00:00
|
|
|
static gboolean
|
|
|
|
gst_vis_src_negotiate (GstVisual * visual)
|
2005-09-07 20:06:43 +00:00
|
|
|
{
|
2010-05-06 06:11:17 +00:00
|
|
|
GstCaps *othercaps, *target;
|
2006-02-27 12:08:22 +00:00
|
|
|
GstStructure *structure;
|
2008-02-29 14:52:02 +00:00
|
|
|
GstCaps *caps;
|
2011-04-29 16:23:25 +00:00
|
|
|
GstQuery *query;
|
2011-05-09 13:37:46 +00:00
|
|
|
GstBufferPool *pool = NULL;
|
2011-05-02 09:11:33 +00:00
|
|
|
guint size, min, max, prefix, alignment;
|
2005-09-07 20:06:43 +00:00
|
|
|
|
2011-05-16 10:18:03 +00:00
|
|
|
caps = gst_pad_get_caps (visual->srcpad, NULL);
|
2005-09-07 20:06:43 +00:00
|
|
|
|
2006-02-27 12:08:22 +00:00
|
|
|
/* see what the peer can do */
|
2011-05-16 10:18:03 +00:00
|
|
|
othercaps = gst_pad_peer_get_caps (visual->srcpad, caps);
|
2006-02-27 12:08:22 +00:00
|
|
|
if (othercaps) {
|
2011-05-16 10:18:03 +00:00
|
|
|
target = othercaps;
|
2008-02-29 14:52:02 +00:00
|
|
|
gst_caps_unref (caps);
|
2006-02-26 21:05:46 +00:00
|
|
|
|
2010-05-06 06:11:17 +00:00
|
|
|
if (gst_caps_is_empty (target))
|
2006-02-27 12:08:22 +00:00
|
|
|
goto no_format;
|
2005-09-07 20:06:43 +00:00
|
|
|
|
2011-05-16 10:18:03 +00:00
|
|
|
target = gst_caps_make_writable (target);
|
2010-05-06 06:11:17 +00:00
|
|
|
gst_caps_truncate (target);
|
2006-02-27 12:08:22 +00:00
|
|
|
} else {
|
2007-03-09 16:46:35 +00:00
|
|
|
/* need a copy, we'll be modifying it when fixating */
|
2008-02-29 14:52:02 +00:00
|
|
|
target = gst_caps_copy (caps);
|
|
|
|
gst_caps_unref (caps);
|
2006-02-27 12:08:22 +00:00
|
|
|
}
|
2011-06-16 10:48:33 +00:00
|
|
|
GST_DEBUG_OBJECT (visual, "before fixate caps %" GST_PTR_FORMAT, target);
|
2005-09-07 20:06:43 +00:00
|
|
|
|
2007-03-09 16:46:35 +00:00
|
|
|
/* fixate in case something is not fixed. This does nothing if the value is
|
|
|
|
* already fixed. For video we always try to fixate to something like
|
2010-10-05 10:00:28 +00:00
|
|
|
* 320x240x25 by convention. */
|
2006-02-27 12:08:22 +00:00
|
|
|
structure = gst_caps_get_structure (target, 0);
|
2010-10-05 10:00:28 +00:00
|
|
|
gst_structure_fixate_field_nearest_int (structure, "width", DEFAULT_WIDTH);
|
|
|
|
gst_structure_fixate_field_nearest_int (structure, "height", DEFAULT_HEIGHT);
|
|
|
|
gst_structure_fixate_field_nearest_fraction (structure, "framerate",
|
|
|
|
DEFAULT_FPS_N, DEFAULT_FPS_D);
|
2005-09-07 20:06:43 +00:00
|
|
|
|
2011-06-16 10:48:33 +00:00
|
|
|
gst_pad_fixate_caps (visual->srcpad, target);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (visual, "after fixate caps %" GST_PTR_FORMAT, target);
|
|
|
|
|
2011-05-19 10:42:46 +00:00
|
|
|
gst_visual_src_setcaps (visual, target);
|
2005-09-07 20:06:43 +00:00
|
|
|
|
2011-04-29 16:23:25 +00:00
|
|
|
/* try to get a bufferpool now */
|
|
|
|
/* find a pool for the negotiated caps now */
|
|
|
|
query = gst_query_new_allocation (target, TRUE);
|
|
|
|
|
2011-05-17 09:25:31 +00:00
|
|
|
if (gst_pad_peer_query (visual->srcpad, query)) {
|
2011-04-29 16:23:25 +00:00
|
|
|
/* we got configuration from our peer, parse them */
|
2011-05-02 09:11:33 +00:00
|
|
|
gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
|
|
|
|
&alignment, &pool);
|
2011-04-29 16:23:25 +00:00
|
|
|
} else {
|
|
|
|
size = visual->outsize;
|
2011-05-02 09:11:33 +00:00
|
|
|
min = max = 0;
|
|
|
|
prefix = 0;
|
2011-06-10 16:04:29 +00:00
|
|
|
alignment = 0;
|
2011-04-29 16:23:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pool == NULL) {
|
|
|
|
GstStructure *config;
|
|
|
|
|
|
|
|
/* we did not get a pool, make one ourselves then */
|
|
|
|
pool = gst_buffer_pool_new ();
|
|
|
|
|
|
|
|
config = gst_buffer_pool_get_config (pool);
|
2011-06-11 16:54:44 +00:00
|
|
|
gst_buffer_pool_config_set (config, target, size, min, max, prefix,
|
2011-05-02 09:11:33 +00:00
|
|
|
alignment);
|
2011-04-29 16:23:25 +00:00
|
|
|
gst_buffer_pool_set_config (pool, config);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (visual->pool)
|
|
|
|
gst_object_unref (visual->pool);
|
|
|
|
visual->pool = pool;
|
|
|
|
|
|
|
|
/* and activate */
|
|
|
|
gst_buffer_pool_set_active (pool, TRUE);
|
|
|
|
|
2011-05-19 11:38:55 +00:00
|
|
|
gst_caps_unref (target);
|
|
|
|
|
2006-02-27 12:08:22 +00:00
|
|
|
return TRUE;
|
2005-09-07 20:06:43 +00:00
|
|
|
|
ext/libvisual/visual.c: Small cleanups.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_get_type),
(gst_visual_src_setcaps), (gst_vis_src_negotiate),
(gst_visual_chain):
Small cleanups.
* ext/theora/gsttheoradec.h:
* ext/theora/theoradec.c: (gst_theora_dec_init),
(gst_theora_dec_reset), (_theora_granule_time),
(theora_dec_src_convert), (theora_dec_sink_convert),
(theora_dec_src_query), (theora_dec_src_event),
(theora_dec_sink_event), (theora_handle_comment_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Add simple QoS.
2006-03-09 17:58:00 +00:00
|
|
|
/* ERRORS */
|
2006-02-27 12:08:22 +00:00
|
|
|
no_format:
|
|
|
|
{
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
GST_ELEMENT_ERROR (visual, STREAM, FORMAT, (NULL),
|
|
|
|
("could not negotiate output format"));
|
2010-05-06 06:11:17 +00:00
|
|
|
gst_caps_unref (target);
|
2006-02-27 12:08:22 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
2006-02-26 21:05:46 +00:00
|
|
|
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
static gboolean
|
|
|
|
gst_visual_sink_event (GstPad * pad, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstVisual *visual;
|
|
|
|
gboolean res;
|
|
|
|
|
|
|
|
visual = GST_VISUAL (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_FLUSH_START:
|
|
|
|
res = gst_pad_push_event (visual->srcpad, event);
|
|
|
|
break;
|
|
|
|
case GST_EVENT_FLUSH_STOP:
|
|
|
|
/* reset QoS and adapter. */
|
|
|
|
gst_visual_reset (visual);
|
|
|
|
res = gst_pad_push_event (visual->srcpad, event);
|
|
|
|
break;
|
2011-05-09 13:37:46 +00:00
|
|
|
case GST_EVENT_CAPS:
|
|
|
|
{
|
|
|
|
GstCaps *caps;
|
|
|
|
|
|
|
|
gst_event_parse_caps (event, &caps);
|
|
|
|
res = gst_visual_sink_setcaps (pad, caps);
|
2011-06-07 10:06:22 +00:00
|
|
|
gst_event_unref (event);
|
2011-05-09 13:37:46 +00:00
|
|
|
break;
|
|
|
|
}
|
2011-05-16 11:48:11 +00:00
|
|
|
case GST_EVENT_SEGMENT:
|
2006-05-31 16:21:48 +00:00
|
|
|
{
|
|
|
|
/* the newsegment values are used to clip the input samples
|
|
|
|
* and to convert the incomming timestamps to running time so
|
|
|
|
* we can do QoS */
|
2011-05-18 15:23:18 +00:00
|
|
|
gst_event_copy_segment (event, &visual->segment);
|
2006-05-31 16:21:48 +00:00
|
|
|
|
|
|
|
/* and forward */
|
|
|
|
res = gst_pad_push_event (visual->srcpad, event);
|
|
|
|
break;
|
|
|
|
}
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
default:
|
2011-05-09 13:41:19 +00:00
|
|
|
res = gst_pad_event_default (pad, event);
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_object_unref (visual);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_visual_src_event (GstPad * pad, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstVisual *visual;
|
|
|
|
gboolean res;
|
|
|
|
|
|
|
|
visual = GST_VISUAL (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_QOS:
|
|
|
|
{
|
|
|
|
gdouble proportion;
|
|
|
|
GstClockTimeDiff diff;
|
|
|
|
GstClockTime timestamp;
|
|
|
|
|
2011-05-09 16:53:03 +00:00
|
|
|
gst_event_parse_qos (event, NULL, &proportion, &diff, ×tamp);
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
|
2006-05-31 16:21:48 +00:00
|
|
|
/* save stuff for the _chain function */
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
GST_OBJECT_LOCK (visual);
|
|
|
|
visual->proportion = proportion;
|
2006-05-31 16:21:48 +00:00
|
|
|
if (diff >= 0)
|
|
|
|
/* we're late, this is a good estimate for next displayable
|
|
|
|
* frame (see part-qos.txt) */
|
|
|
|
visual->earliest_time = timestamp + 2 * diff + visual->duration;
|
|
|
|
else
|
|
|
|
visual->earliest_time = timestamp + diff;
|
|
|
|
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
GST_OBJECT_UNLOCK (visual);
|
|
|
|
|
|
|
|
res = gst_pad_push_event (visual->sinkpad, event);
|
|
|
|
break;
|
|
|
|
}
|
2011-05-19 11:38:55 +00:00
|
|
|
case GST_EVENT_RECONFIGURE:
|
|
|
|
/* dont't forward */
|
|
|
|
gst_event_unref (event);
|
|
|
|
res = TRUE;
|
|
|
|
break;
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
default:
|
2011-05-09 13:41:19 +00:00
|
|
|
res = gst_pad_event_default (pad, event);
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_object_unref (visual);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2010-10-05 10:01:25 +00:00
|
|
|
static gboolean
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_visual_src_query (GstPad * pad, GstQuery * query)
|
2010-10-05 10:01:25 +00:00
|
|
|
{
|
|
|
|
gboolean res;
|
|
|
|
GstVisual *visual;
|
|
|
|
|
|
|
|
visual = GST_VISUAL (gst_pad_get_parent (pad));
|
|
|
|
|
2011-05-17 09:25:31 +00:00
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
2010-10-05 10:01:25 +00:00
|
|
|
case GST_QUERY_LATENCY:
|
|
|
|
{
|
|
|
|
/* We need to send the query upstream and add the returned latency to our
|
|
|
|
* own */
|
|
|
|
GstClockTime min_latency, max_latency;
|
|
|
|
gboolean us_live;
|
|
|
|
GstClockTime our_latency;
|
|
|
|
guint max_samples;
|
|
|
|
|
|
|
|
if ((res = gst_pad_peer_query (visual->sinkpad, query))) {
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_parse_latency (query, &us_live, &min_latency, &max_latency);
|
2010-10-05 10:01:25 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (visual, "Peer latency: min %"
|
|
|
|
GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (min_latency), GST_TIME_ARGS (max_latency));
|
|
|
|
|
|
|
|
/* the max samples we must buffer buffer */
|
|
|
|
max_samples = MAX (VISUAL_SAMPLES, visual->spf);
|
|
|
|
our_latency =
|
2011-08-19 14:49:30 +00:00
|
|
|
gst_util_uint64_scale_int (max_samples, GST_SECOND,
|
|
|
|
GST_AUDIO_INFO_RATE (&visual->info));
|
2010-10-05 10:01:25 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (visual, "Our latency: %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (our_latency));
|
|
|
|
|
|
|
|
/* we add some latency but only if we need to buffer more than what
|
|
|
|
* upstream gives us */
|
|
|
|
min_latency += our_latency;
|
|
|
|
if (max_latency != -1)
|
|
|
|
max_latency += our_latency;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (visual, "Calculated total latency : min %"
|
|
|
|
GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (min_latency), GST_TIME_ARGS (max_latency));
|
|
|
|
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_set_latency (query, TRUE, min_latency, max_latency);
|
2010-10-05 10:01:25 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
res = gst_pad_peer_query (visual->sinkpad, query);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_object_unref (visual);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2011-06-09 09:52:32 +00:00
|
|
|
/* Make sure we are negotiated */
|
2006-02-27 12:08:22 +00:00
|
|
|
static GstFlowReturn
|
2011-05-19 11:38:55 +00:00
|
|
|
ensure_negotiated (GstVisual * visual)
|
2006-02-27 12:08:22 +00:00
|
|
|
{
|
2011-05-19 11:38:55 +00:00
|
|
|
gboolean reconfigure;
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (visual->srcpad);
|
|
|
|
reconfigure = GST_PAD_NEEDS_RECONFIGURE (visual->srcpad);
|
|
|
|
GST_OBJECT_FLAG_UNSET (visual->srcpad, GST_PAD_NEED_RECONFIGURE);
|
|
|
|
GST_OBJECT_UNLOCK (visual->srcpad);
|
2011-04-29 16:23:25 +00:00
|
|
|
|
2006-05-31 16:21:48 +00:00
|
|
|
/* we don't know an output format yet, pick one */
|
2011-05-19 11:38:55 +00:00
|
|
|
if (reconfigure || !gst_pad_has_current_caps (visual->srcpad)) {
|
2006-02-27 12:08:22 +00:00
|
|
|
if (!gst_vis_src_negotiate (visual))
|
|
|
|
return GST_FLOW_NOT_NEGOTIATED;
|
|
|
|
}
|
2005-09-07 20:06:43 +00:00
|
|
|
return GST_FLOW_OK;
|
2004-04-30 02:25:09 +00:00
|
|
|
}
|
|
|
|
|
2005-09-06 22:29:00 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_visual_chain (GstPad * pad, GstBuffer * buffer)
|
2004-04-30 02:25:09 +00:00
|
|
|
{
|
2005-09-07 20:06:43 +00:00
|
|
|
GstBuffer *outbuf = NULL;
|
2004-05-04 00:44:19 +00:00
|
|
|
guint i;
|
2004-04-30 02:25:09 +00:00
|
|
|
GstVisual *visual = GST_VISUAL (gst_pad_get_parent (pad));
|
2005-09-07 20:06:43 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2006-05-31 16:21:48 +00:00
|
|
|
guint avail;
|
2011-08-19 14:49:30 +00:00
|
|
|
gint bpf, rate, channels;
|
2005-09-07 20:06:43 +00:00
|
|
|
|
2006-02-26 21:05:46 +00:00
|
|
|
GST_DEBUG_OBJECT (visual, "chain function called");
|
|
|
|
|
2011-05-19 11:38:55 +00:00
|
|
|
/* Make sure have an output format */
|
|
|
|
ret = ensure_negotiated (visual);
|
|
|
|
if (ret != GST_FLOW_OK) {
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
goto beach;
|
2005-09-07 20:06:43 +00:00
|
|
|
}
|
2004-04-30 02:25:09 +00:00
|
|
|
|
2006-05-31 16:21:48 +00:00
|
|
|
/* resync on DISCONT */
|
|
|
|
if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT)) {
|
|
|
|
gst_adapter_clear (visual->adapter);
|
|
|
|
}
|
|
|
|
|
2011-08-19 14:49:30 +00:00
|
|
|
rate = GST_AUDIO_INFO_RATE (&visual->info);
|
|
|
|
bpf = GST_AUDIO_INFO_BPF (&visual->info);
|
|
|
|
channels = GST_AUDIO_INFO_CHANNELS (&visual->info);
|
|
|
|
|
2006-05-31 16:21:48 +00:00
|
|
|
GST_DEBUG_OBJECT (visual,
|
|
|
|
"Input buffer has %d samples, time=%" G_GUINT64_FORMAT,
|
2011-08-19 14:49:30 +00:00
|
|
|
gst_buffer_get_size (buffer) / bpf, GST_BUFFER_TIMESTAMP (buffer));
|
2006-05-31 16:21:48 +00:00
|
|
|
|
2005-09-06 22:29:00 +00:00
|
|
|
gst_adapter_push (visual->adapter, buffer);
|
2005-09-07 20:06:43 +00:00
|
|
|
|
2007-03-09 16:46:35 +00:00
|
|
|
while (TRUE) {
|
2006-05-31 16:21:48 +00:00
|
|
|
gboolean need_skip;
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
const guint16 *data;
|
2009-05-13 17:24:15 +00:00
|
|
|
guint64 dist, timestamp;
|
2011-03-27 16:30:24 +00:00
|
|
|
guint8 *outdata;
|
|
|
|
gsize outsize;
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
|
2006-05-31 16:21:48 +00:00
|
|
|
GST_DEBUG_OBJECT (visual, "processing buffer");
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
|
2007-03-09 16:46:35 +00:00
|
|
|
avail = gst_adapter_available (visual->adapter);
|
|
|
|
GST_DEBUG_OBJECT (visual, "avail now %u", avail);
|
|
|
|
|
2010-10-05 10:00:28 +00:00
|
|
|
/* we need at least VISUAL_SAMPLES samples */
|
2011-08-19 14:49:30 +00:00
|
|
|
if (avail < VISUAL_SAMPLES * bpf)
|
2007-03-09 16:46:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
/* we need at least enough samples to make one frame */
|
2011-08-19 14:49:30 +00:00
|
|
|
if (avail < visual->spf * bpf)
|
2007-03-09 16:46:35 +00:00
|
|
|
break;
|
|
|
|
|
2009-05-13 17:24:15 +00:00
|
|
|
/* get timestamp of the current adapter byte */
|
|
|
|
timestamp = gst_adapter_prev_timestamp (visual->adapter, &dist);
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
|
|
|
|
/* convert bytes to time */
|
2011-08-19 14:49:30 +00:00
|
|
|
dist /= bpf;
|
|
|
|
timestamp += gst_util_uint64_scale_int (dist, GST_SECOND, rate);
|
2009-05-13 17:24:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (timestamp != -1) {
|
2006-05-31 16:21:48 +00:00
|
|
|
gint64 qostime;
|
|
|
|
|
|
|
|
/* QoS is done on running time */
|
|
|
|
qostime = gst_segment_to_running_time (&visual->segment, GST_FORMAT_TIME,
|
2009-05-13 17:24:15 +00:00
|
|
|
timestamp);
|
2010-10-05 10:05:38 +00:00
|
|
|
qostime += visual->duration;
|
2006-05-31 16:21:48 +00:00
|
|
|
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
GST_OBJECT_LOCK (visual);
|
ext/libvisual/visual.c: Small cleanups.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_get_type),
(gst_visual_src_setcaps), (gst_vis_src_negotiate),
(gst_visual_chain):
Small cleanups.
* ext/theora/gsttheoradec.h:
* ext/theora/theoradec.c: (gst_theora_dec_init),
(gst_theora_dec_reset), (_theora_granule_time),
(theora_dec_src_convert), (theora_dec_sink_convert),
(theora_dec_src_query), (theora_dec_src_event),
(theora_dec_sink_event), (theora_handle_comment_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Add simple QoS.
2006-03-09 17:58:00 +00:00
|
|
|
/* check for QoS, don't compute buffers that are known to be late */
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
need_skip = visual->earliest_time != -1 &&
|
2006-05-31 16:21:48 +00:00
|
|
|
qostime <= visual->earliest_time;
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
GST_OBJECT_UNLOCK (visual);
|
|
|
|
|
|
|
|
if (need_skip) {
|
2006-05-31 16:21:48 +00:00
|
|
|
GST_WARNING_OBJECT (visual,
|
|
|
|
"QoS: skip ts: %" GST_TIME_FORMAT ", earliest: %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (qostime), GST_TIME_ARGS (visual->earliest_time));
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
goto skip;
|
|
|
|
}
|
|
|
|
}
|
2005-09-06 22:29:00 +00:00
|
|
|
|
2010-10-05 10:00:28 +00:00
|
|
|
/* Read VISUAL_SAMPLES samples per channel */
|
2006-05-31 16:21:48 +00:00
|
|
|
data =
|
2011-03-27 16:30:24 +00:00
|
|
|
(const guint16 *) gst_adapter_map (visual->adapter,
|
2011-08-19 14:49:30 +00:00
|
|
|
VISUAL_SAMPLES * bpf);
|
2006-05-31 16:21:48 +00:00
|
|
|
|
2006-09-27 11:58:17 +00:00
|
|
|
#if defined(VISUAL_API_VERSION) && VISUAL_API_VERSION >= 4000 && VISUAL_API_VERSION < 5000
|
|
|
|
{
|
|
|
|
VisBuffer *lbuf, *rbuf;
|
2010-10-05 10:00:28 +00:00
|
|
|
guint16 ldata[VISUAL_SAMPLES], rdata[VISUAL_SAMPLES];
|
2011-08-19 14:49:30 +00:00
|
|
|
VisAudioSampleRateType vrate;
|
2006-09-27 11:58:17 +00:00
|
|
|
|
|
|
|
lbuf = visual_buffer_new_with_buffer (ldata, sizeof (ldata), NULL);
|
|
|
|
rbuf = visual_buffer_new_with_buffer (rdata, sizeof (rdata), NULL);
|
|
|
|
|
2011-08-19 14:49:30 +00:00
|
|
|
if (channels == 2) {
|
2010-10-05 10:00:28 +00:00
|
|
|
for (i = 0; i < VISUAL_SAMPLES; i++) {
|
2006-09-27 11:58:17 +00:00
|
|
|
ldata[i] = *data++;
|
|
|
|
rdata[i] = *data++;
|
|
|
|
}
|
|
|
|
} else {
|
2010-10-05 10:00:28 +00:00
|
|
|
for (i = 0; i < VISUAL_SAMPLES; i++) {
|
2006-09-27 11:58:17 +00:00
|
|
|
ldata[i] = *data;
|
|
|
|
rdata[i] = *data++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-19 14:49:30 +00:00
|
|
|
switch (rate) {
|
2006-09-27 11:58:17 +00:00
|
|
|
case 8000:
|
2011-08-19 14:49:30 +00:00
|
|
|
vrate = VISUAL_AUDIO_SAMPLE_RATE_8000;
|
2006-09-27 11:58:17 +00:00
|
|
|
break;
|
|
|
|
case 11250:
|
2011-08-19 14:49:30 +00:00
|
|
|
vrate = VISUAL_AUDIO_SAMPLE_RATE_11250;
|
2006-09-27 11:58:17 +00:00
|
|
|
break;
|
|
|
|
case 22500:
|
2011-08-19 14:49:30 +00:00
|
|
|
vrate = VISUAL_AUDIO_SAMPLE_RATE_22500;
|
2006-09-27 11:58:17 +00:00
|
|
|
break;
|
|
|
|
case 32000:
|
2011-08-19 14:49:30 +00:00
|
|
|
vrate = VISUAL_AUDIO_SAMPLE_RATE_32000;
|
2006-09-27 11:58:17 +00:00
|
|
|
break;
|
|
|
|
case 44100:
|
2011-08-19 14:49:30 +00:00
|
|
|
vrate = VISUAL_AUDIO_SAMPLE_RATE_44100;
|
2006-09-27 11:58:17 +00:00
|
|
|
break;
|
|
|
|
case 48000:
|
2011-08-19 14:49:30 +00:00
|
|
|
vrate = VISUAL_AUDIO_SAMPLE_RATE_48000;
|
2006-09-27 11:58:17 +00:00
|
|
|
break;
|
|
|
|
case 96000:
|
2011-08-19 14:49:30 +00:00
|
|
|
vrate = VISUAL_AUDIO_SAMPLE_RATE_96000;
|
2006-09-27 11:58:17 +00:00
|
|
|
break;
|
|
|
|
default:
|
2007-12-29 16:23:23 +00:00
|
|
|
visual_object_unref (VISUAL_OBJECT (lbuf));
|
|
|
|
visual_object_unref (VISUAL_OBJECT (rbuf));
|
2011-08-19 14:49:30 +00:00
|
|
|
GST_ERROR_OBJECT (visual, "unsupported rate %d", rate);
|
2007-12-29 16:23:23 +00:00
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
goto beach;
|
2006-09-27 11:58:17 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
visual_audio_samplepool_input_channel (visual->audio->samplepool,
|
|
|
|
lbuf,
|
2011-08-19 14:49:30 +00:00
|
|
|
vrate, VISUAL_AUDIO_SAMPLE_FORMAT_S16,
|
2010-03-15 21:49:53 +00:00
|
|
|
(char *) VISUAL_AUDIO_CHANNEL_LEFT);
|
|
|
|
visual_audio_samplepool_input_channel (visual->audio->samplepool, rbuf,
|
2011-08-19 14:49:30 +00:00
|
|
|
vrate, VISUAL_AUDIO_SAMPLE_FORMAT_S16,
|
2010-03-15 21:49:53 +00:00
|
|
|
(char *) VISUAL_AUDIO_CHANNEL_RIGHT);
|
2006-09-27 11:58:17 +00:00
|
|
|
|
|
|
|
visual_object_unref (VISUAL_OBJECT (lbuf));
|
|
|
|
visual_object_unref (VISUAL_OBJECT (rbuf));
|
|
|
|
|
|
|
|
}
|
|
|
|
#else
|
2006-05-31 16:21:48 +00:00
|
|
|
if (visual->channels == 2) {
|
2010-10-05 10:00:28 +00:00
|
|
|
for (i = 0; i < VISUAL_SAMPLES; i++) {
|
2006-09-27 11:58:17 +00:00
|
|
|
visual->audio->plugpcm[0][i] = *data++;
|
|
|
|
visual->audio->plugpcm[1][i] = *data++;
|
2006-05-31 16:21:48 +00:00
|
|
|
}
|
|
|
|
} else {
|
2010-10-05 10:00:28 +00:00
|
|
|
for (i = 0; i < VISUAL_SAMPLES; i++) {
|
2006-09-27 11:58:17 +00:00
|
|
|
visual->audio->plugpcm[0][i] = *data;
|
|
|
|
visual->audio->plugpcm[1][i] = *data++;
|
2006-05-31 16:21:48 +00:00
|
|
|
}
|
2004-05-04 00:44:19 +00:00
|
|
|
}
|
2006-09-27 11:58:17 +00:00
|
|
|
#endif
|
2005-09-07 20:06:43 +00:00
|
|
|
|
2006-05-31 16:21:48 +00:00
|
|
|
/* alloc a buffer if we don't have one yet, this happens
|
|
|
|
* when we pushed a buffer in this while loop before */
|
2005-09-07 20:06:43 +00:00
|
|
|
if (outbuf == NULL) {
|
2011-05-19 11:38:55 +00:00
|
|
|
GST_DEBUG_OBJECT (visual, "allocating output buffer");
|
|
|
|
ret = gst_buffer_pool_acquire_buffer (visual->pool, &outbuf, NULL);
|
2005-09-07 20:06:43 +00:00
|
|
|
if (ret != GST_FLOW_OK) {
|
2011-03-27 16:30:24 +00:00
|
|
|
gst_adapter_unmap (visual->adapter, 0);
|
2006-02-26 21:05:46 +00:00
|
|
|
goto beach;
|
2005-09-07 20:06:43 +00:00
|
|
|
}
|
|
|
|
}
|
2011-03-27 16:30:24 +00:00
|
|
|
outdata = gst_buffer_map (outbuf, &outsize, NULL, GST_MAP_WRITE);
|
|
|
|
visual_video_set_buffer (visual->video, outdata);
|
2006-09-27 11:58:17 +00:00
|
|
|
visual_audio_analyze (visual->audio);
|
|
|
|
visual_actor_run (visual->actor, visual->audio);
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
visual_video_set_buffer (visual->video, NULL);
|
2011-03-27 16:30:24 +00:00
|
|
|
gst_buffer_unmap (outbuf, outdata, outsize);
|
2006-09-18 11:40:14 +00:00
|
|
|
GST_DEBUG_OBJECT (visual, "rendered one frame");
|
2005-09-07 20:06:43 +00:00
|
|
|
|
2011-03-27 16:30:24 +00:00
|
|
|
gst_adapter_unmap (visual->adapter, 0);
|
|
|
|
|
2009-05-13 17:24:15 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (outbuf) = timestamp;
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
GST_BUFFER_DURATION (outbuf) = visual->duration;
|
|
|
|
|
|
|
|
ret = gst_pad_push (visual->srcpad, outbuf);
|
|
|
|
outbuf = NULL;
|
2005-09-07 20:06:43 +00:00
|
|
|
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
skip:
|
2007-03-09 16:46:35 +00:00
|
|
|
GST_DEBUG_OBJECT (visual, "finished frame, flushing %u samples from input",
|
|
|
|
visual->spf);
|
|
|
|
|
|
|
|
/* Flush out the number of samples per frame */
|
2011-08-19 14:49:30 +00:00
|
|
|
gst_adapter_flush (visual->adapter, visual->spf * bpf);
|
2006-05-31 16:21:48 +00:00
|
|
|
|
|
|
|
/* quit the loop if something was wrong */
|
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
break;
|
2004-04-30 02:25:09 +00:00
|
|
|
}
|
2005-09-07 20:06:43 +00:00
|
|
|
|
2007-12-29 16:23:23 +00:00
|
|
|
beach:
|
|
|
|
|
2005-09-07 20:06:43 +00:00
|
|
|
if (outbuf != NULL)
|
|
|
|
gst_buffer_unref (outbuf);
|
|
|
|
|
2006-02-26 21:05:46 +00:00
|
|
|
gst_object_unref (visual);
|
|
|
|
|
2005-09-07 20:06:43 +00:00
|
|
|
return ret;
|
2004-04-30 02:25:09 +00:00
|
|
|
}
|
|
|
|
|
2005-09-02 15:43:18 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_visual_change_state (GstElement * element, GstStateChange transition)
|
2004-04-30 02:25:09 +00:00
|
|
|
{
|
|
|
|
GstVisual *visual = GST_VISUAL (element);
|
check/: Add extra tests for basetransform based components.
Original commit message from CVS:
* check/Makefile.am:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (GST_START_TEST), (simple_launch_lines_suite):
Add extra tests for basetransform based components.
Comment out the test_element_negotiation test until we decide
if it's testing correct behaviour.
* ext/libvisual/visual.c: (gst_visual_init), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Slightly more correct but still bogus timestamping.
Fix state change function.
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init):
* gst/audioresample/gstaudioresample.c:
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_class_init):
* gst/videoscale/gstvideoscale.c: (gst_videoscale_class_init),
(gst_videoscale_prepare_size), (gst_videoscale_set_caps),
(gst_videoscale_prepare_image):
* gst/volume/gstvolume.c: (gst_volume_class_init),
(volume_transform_ip):
Basetransform updates. Enable passthrough modes.
* sys/ximage/ximagesink.c: (gst_ximage_buffer_init),
(gst_ximagesink_renegotiate_size), (gst_ximagesink_xcontext_get),
(gst_ximagesink_setcaps), (gst_ximagesink_buffer_alloc):
Negotiation fix that allows the window to return to the original
size and renegotiate passthrough upstream. Extra debug output.
2005-09-09 17:53:47 +00:00
|
|
|
GstStateChangeReturn ret;
|
2004-04-30 02:25:09 +00:00
|
|
|
|
2005-09-02 15:43:18 +00:00
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
2004-04-30 02:25:09 +00:00
|
|
|
visual->actor =
|
2011-08-19 14:49:30 +00:00
|
|
|
visual_actor_new (GST_VISUAL_GET_CLASS (visual)->plugin->info->
|
|
|
|
plugname);
|
2005-09-07 20:06:43 +00:00
|
|
|
visual->video = visual_video_new ();
|
2006-09-27 11:58:17 +00:00
|
|
|
visual->audio = visual_audio_new ();
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
/* can't have a play without actors */
|
2005-09-07 20:06:43 +00:00
|
|
|
if (!visual->actor || !visual->video)
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
goto no_actors;
|
|
|
|
|
|
|
|
if (visual_actor_realize (visual->actor) != 0)
|
|
|
|
goto no_realize;
|
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
Original commit message from CVS:
* configure.ac:
* ext/libvisual/visual.c: (gst_visual_get_type),
(libvisual_log_handler), (gst_visual_getcaps),
(gst_visual_srclink), (gst_visual_change_state), (make_valid_name),
(plugin_init):
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
* ext/smoothwave/Makefile.am:
* ext/smoothwave/demo-osssrc.c: (main):
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_class_init),
(gst_smoothwave_init), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain), (gst_sw_change_state),
(plugin_init):
* ext/smoothwave/gstsmoothwave.h:
Make gstsmoothwave a working element in the 20th century.
* gst/chart/gstchart.c: (gst_chart_init), (gst_chart_srcconnect):
Fix incorrect link function
2004-11-12 17:37:49 +00:00
|
|
|
|
2005-09-07 20:06:43 +00:00
|
|
|
visual_actor_set_video (visual->actor, visual->video);
|
2004-04-30 02:25:09 +00:00
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
gst_visual_reset (visual);
|
2004-04-30 02:25:09 +00:00
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
2004-04-30 02:25:09 +00:00
|
|
|
break;
|
check/: Add extra tests for basetransform based components.
Original commit message from CVS:
* check/Makefile.am:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (GST_START_TEST), (simple_launch_lines_suite):
Add extra tests for basetransform based components.
Comment out the test_element_negotiation test until we decide
if it's testing correct behaviour.
* ext/libvisual/visual.c: (gst_visual_init), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Slightly more correct but still bogus timestamping.
Fix state change function.
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init):
* gst/audioresample/gstaudioresample.c:
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_class_init):
* gst/videoscale/gstvideoscale.c: (gst_videoscale_class_init),
(gst_videoscale_prepare_size), (gst_videoscale_set_caps),
(gst_videoscale_prepare_image):
* gst/volume/gstvolume.c: (gst_volume_class_init),
(volume_transform_ip):
Basetransform updates. Enable passthrough modes.
* sys/ximage/ximagesink.c: (gst_ximage_buffer_init),
(gst_ximagesink_renegotiate_size), (gst_ximagesink_xcontext_get),
(gst_ximagesink_setcaps), (gst_ximagesink_buffer_alloc):
Negotiation fix that allows the window to return to the original
size and renegotiate passthrough upstream. Extra debug output.
2005-09-09 17:53:47 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
|
|
|
|
|
|
|
switch (transition) {
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
2004-04-30 02:25:09 +00:00
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2011-04-29 16:23:25 +00:00
|
|
|
if (visual->pool) {
|
|
|
|
gst_buffer_pool_set_active (visual->pool, FALSE);
|
|
|
|
gst_object_unref (visual->pool);
|
|
|
|
visual->pool = NULL;
|
|
|
|
}
|
2004-04-30 02:25:09 +00:00
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
gst_visual_clear_actors (visual);
|
2004-04-30 02:25:09 +00:00
|
|
|
break;
|
|
|
|
default:
|
2004-07-09 10:56:51 +00:00
|
|
|
break;
|
2004-04-30 02:25:09 +00:00
|
|
|
}
|
|
|
|
|
check/: Add extra tests for basetransform based components.
Original commit message from CVS:
* check/Makefile.am:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (GST_START_TEST), (simple_launch_lines_suite):
Add extra tests for basetransform based components.
Comment out the test_element_negotiation test until we decide
if it's testing correct behaviour.
* ext/libvisual/visual.c: (gst_visual_init), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Slightly more correct but still bogus timestamping.
Fix state change function.
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init):
* gst/audioresample/gstaudioresample.c:
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_class_init):
* gst/videoscale/gstvideoscale.c: (gst_videoscale_class_init),
(gst_videoscale_prepare_size), (gst_videoscale_set_caps),
(gst_videoscale_prepare_image):
* gst/volume/gstvolume.c: (gst_volume_class_init),
(volume_transform_ip):
Basetransform updates. Enable passthrough modes.
* sys/ximage/ximagesink.c: (gst_ximage_buffer_init),
(gst_ximagesink_renegotiate_size), (gst_ximagesink_xcontext_get),
(gst_ximagesink_setcaps), (gst_ximagesink_buffer_alloc):
Negotiation fix that allows the window to return to the original
size and renegotiate passthrough upstream. Extra debug output.
2005-09-09 17:53:47 +00:00
|
|
|
return ret;
|
ext/libvisual/visual.c: Cleanups, post nice errors.
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_init),
(gst_visual_clear_actors), (gst_visual_dispose),
(gst_visual_reset), (gst_visual_src_setcaps),
(gst_visual_sink_setcaps), (gst_vis_src_negotiate),
(gst_visual_sink_event), (gst_visual_src_event), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Cleanups, post nice errors.
Handle sink and src events.
Implement simple QoS.
* gst-libs/gst/video/gstvideosink.c: (gst_video_sink_init):
Use new basesink methods to configure max-lateness.
Small doc update.
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform_caps), (gst_ffmpegcsp_set_caps):
Debug statement cleanups.
* gst/volume/gstvolume.c: (gst_volume_class_init):
Simple cleanup.
2006-03-08 09:53:31 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
no_actors:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (visual, LIBRARY, INIT, (NULL),
|
|
|
|
("could not create actors"));
|
|
|
|
gst_visual_clear_actors (visual);
|
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
|
|
|
}
|
|
|
|
no_realize:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (visual, LIBRARY, INIT, (NULL),
|
|
|
|
("could not realize actor"));
|
|
|
|
gst_visual_clear_actors (visual);
|
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
|
|
|
}
|
2004-04-30 02:25:09 +00:00
|
|
|
}
|
|
|
|
|
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
Original commit message from CVS:
* configure.ac:
* ext/libvisual/visual.c: (gst_visual_get_type),
(libvisual_log_handler), (gst_visual_getcaps),
(gst_visual_srclink), (gst_visual_change_state), (make_valid_name),
(plugin_init):
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
* ext/smoothwave/Makefile.am:
* ext/smoothwave/demo-osssrc.c: (main):
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_class_init),
(gst_smoothwave_init), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain), (gst_sw_change_state),
(plugin_init):
* ext/smoothwave/gstsmoothwave.h:
Make gstsmoothwave a working element in the 20th century.
* gst/chart/gstchart.c: (gst_chart_init), (gst_chart_srcconnect):
Fix incorrect link function
2004-11-12 17:37:49 +00:00
|
|
|
static void
|
|
|
|
make_valid_name (char *name)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Replace invalid chars with _ in the type name
|
|
|
|
*/
|
2005-12-16 22:00:07 +00:00
|
|
|
static const gchar extra_chars[] = "-_+";
|
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
Original commit message from CVS:
* configure.ac:
* ext/libvisual/visual.c: (gst_visual_get_type),
(libvisual_log_handler), (gst_visual_getcaps),
(gst_visual_srclink), (gst_visual_change_state), (make_valid_name),
(plugin_init):
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
* ext/smoothwave/Makefile.am:
* ext/smoothwave/demo-osssrc.c: (main):
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_class_init),
(gst_smoothwave_init), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain), (gst_sw_change_state),
(plugin_init):
* ext/smoothwave/gstsmoothwave.h:
Make gstsmoothwave a working element in the 20th century.
* gst/chart/gstchart.c: (gst_chart_init), (gst_chart_srcconnect):
Fix incorrect link function
2004-11-12 17:37:49 +00:00
|
|
|
gchar *p = name;
|
|
|
|
|
|
|
|
for (; *p; p++) {
|
|
|
|
int valid = ((p[0] >= 'A' && p[0] <= 'Z') ||
|
|
|
|
(p[0] >= 'a' && p[0] <= 'z') ||
|
|
|
|
(p[0] >= '0' && p[0] <= '9') || strchr (extra_chars, p[0]));
|
|
|
|
if (!valid)
|
|
|
|
*p = '_';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-15 10:17:04 +00:00
|
|
|
static gboolean
|
|
|
|
gst_visual_actor_plugin_is_gl (VisObject * plugin, const gchar * name)
|
|
|
|
{
|
|
|
|
gboolean is_gl;
|
|
|
|
gint depth;
|
|
|
|
|
|
|
|
#if !defined(VISUAL_API_VERSION)
|
|
|
|
|
|
|
|
depth = VISUAL_PLUGIN_ACTOR (plugin)->depth;
|
|
|
|
is_gl = (depth == VISUAL_VIDEO_DEPTH_GL);
|
|
|
|
|
|
|
|
#elif VISUAL_API_VERSION >= 4000 && VISUAL_API_VERSION < 5000
|
|
|
|
|
|
|
|
depth = VISUAL_ACTOR_PLUGIN (plugin)->vidoptions.depth;
|
|
|
|
/* FIXME: how to figure this out correctly in 0.4? */
|
|
|
|
is_gl = (depth & VISUAL_VIDEO_DEPTH_GL) == VISUAL_VIDEO_DEPTH_GL;
|
|
|
|
|
|
|
|
#else
|
|
|
|
# error what libvisual version is this?
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (!is_gl) {
|
|
|
|
GST_DEBUG ("plugin %s is not a GL plugin (%d), registering", name, depth);
|
|
|
|
} else {
|
|
|
|
GST_DEBUG ("plugin %s is a GL plugin (%d), ignoring", name, depth);
|
|
|
|
}
|
|
|
|
|
|
|
|
return is_gl;
|
|
|
|
}
|
|
|
|
|
2004-04-30 02:25:09 +00:00
|
|
|
static gboolean
|
|
|
|
plugin_init (GstPlugin * plugin)
|
|
|
|
{
|
2006-05-15 10:17:04 +00:00
|
|
|
guint i, count;
|
2004-04-30 02:25:09 +00:00
|
|
|
VisList *list;
|
|
|
|
|
2005-09-15 06:59:36 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (libvisual_debug, "libvisual", 0,
|
|
|
|
"libvisual audio visualisations");
|
|
|
|
|
2009-01-06 18:03:51 +00:00
|
|
|
#ifdef LIBVISUAL_PLUGINSBASEDIR
|
|
|
|
gst_plugin_add_dependency_simple (plugin, "HOME/.libvisual/actor",
|
|
|
|
LIBVISUAL_PLUGINSBASEDIR "/actor", NULL, GST_PLUGIN_DEPENDENCY_FLAG_NONE);
|
|
|
|
#endif
|
|
|
|
|
2005-09-15 06:59:36 +00:00
|
|
|
visual_log_set_verboseness (VISUAL_LOG_VERBOSENESS_LOW);
|
|
|
|
visual_log_set_info_handler (libvisual_log_handler, (void *) GST_LEVEL_INFO);
|
|
|
|
visual_log_set_warning_handler (libvisual_log_handler,
|
|
|
|
(void *) GST_LEVEL_WARNING);
|
|
|
|
visual_log_set_critical_handler (libvisual_log_handler,
|
|
|
|
(void *) GST_LEVEL_ERROR);
|
|
|
|
visual_log_set_error_handler (libvisual_log_handler,
|
|
|
|
(void *) GST_LEVEL_ERROR);
|
|
|
|
|
2006-02-26 21:05:46 +00:00
|
|
|
if (!visual_is_initialized ())
|
|
|
|
if (visual_init (NULL, NULL) != 0)
|
|
|
|
return FALSE;
|
|
|
|
|
2004-04-30 02:25:09 +00:00
|
|
|
list = visual_actor_get_list ();
|
2006-05-15 10:17:04 +00:00
|
|
|
|
|
|
|
#if !defined(VISUAL_API_VERSION)
|
|
|
|
count = visual_list_count (list);
|
|
|
|
#elif VISUAL_API_VERSION >= 4000 && VISUAL_API_VERSION < 5000
|
|
|
|
count = visual_collection_size (VISUAL_COLLECTION (list));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
for (i = 0; i < count; i++) {
|
2004-04-30 02:25:09 +00:00
|
|
|
VisPluginRef *ref = visual_list_get (list, i);
|
2006-02-26 21:05:46 +00:00
|
|
|
VisPluginData *visplugin = NULL;
|
2006-05-15 10:17:04 +00:00
|
|
|
gboolean skip = FALSE;
|
2004-04-30 02:25:09 +00:00
|
|
|
GType type;
|
|
|
|
gchar *name;
|
|
|
|
GTypeInfo info = {
|
|
|
|
sizeof (GstVisualClass),
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
gst_visual_class_init,
|
|
|
|
NULL,
|
|
|
|
ref,
|
|
|
|
sizeof (GstVisual),
|
|
|
|
0,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2006-02-26 21:05:46 +00:00
|
|
|
visplugin = visual_plugin_load (ref);
|
|
|
|
|
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
Original commit message from CVS:
* configure.ac:
* ext/libvisual/visual.c: (gst_visual_get_type),
(libvisual_log_handler), (gst_visual_getcaps),
(gst_visual_srclink), (gst_visual_change_state), (make_valid_name),
(plugin_init):
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
* ext/smoothwave/Makefile.am:
* ext/smoothwave/demo-osssrc.c: (main):
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_class_init),
(gst_smoothwave_init), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain), (gst_sw_change_state),
(plugin_init):
* ext/smoothwave/gstsmoothwave.h:
Make gstsmoothwave a working element in the 20th century.
* gst/chart/gstchart.c: (gst_chart_init), (gst_chart_srcconnect):
Fix incorrect link function
2004-11-12 17:37:49 +00:00
|
|
|
if (ref->info->plugname == NULL)
|
2004-04-30 02:25:09 +00:00
|
|
|
continue;
|
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
Original commit message from CVS:
* configure.ac:
* ext/libvisual/visual.c: (gst_visual_get_type),
(libvisual_log_handler), (gst_visual_getcaps),
(gst_visual_srclink), (gst_visual_change_state), (make_valid_name),
(plugin_init):
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
* ext/smoothwave/Makefile.am:
* ext/smoothwave/demo-osssrc.c: (main):
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_class_init),
(gst_smoothwave_init), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain), (gst_sw_change_state),
(plugin_init):
* ext/smoothwave/gstsmoothwave.h:
Make gstsmoothwave a working element in the 20th century.
* gst/chart/gstchart.c: (gst_chart_init), (gst_chart_srcconnect):
Fix incorrect link function
2004-11-12 17:37:49 +00:00
|
|
|
|
2006-05-15 10:17:04 +00:00
|
|
|
/* Blacklist some plugins */
|
|
|
|
if (strcmp (ref->info->plugname, "gstreamer") == 0 ||
|
|
|
|
strcmp (ref->info->plugname, "gdkpixbuf") == 0) {
|
|
|
|
skip = TRUE;
|
2006-02-26 21:05:46 +00:00
|
|
|
} else {
|
2006-05-15 10:17:04 +00:00
|
|
|
/* Ignore plugins that only support GL output for now */
|
|
|
|
skip = gst_visual_actor_plugin_is_gl (visplugin->info->plugin,
|
|
|
|
visplugin->info->plugname);
|
2006-02-26 21:05:46 +00:00
|
|
|
}
|
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
Original commit message from CVS:
* configure.ac:
* ext/libvisual/visual.c: (gst_visual_get_type),
(libvisual_log_handler), (gst_visual_getcaps),
(gst_visual_srclink), (gst_visual_change_state), (make_valid_name),
(plugin_init):
Update libvisual to 0.1.7. Link in the debug handling to gstreamer
* ext/smoothwave/Makefile.am:
* ext/smoothwave/demo-osssrc.c: (main):
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_class_init),
(gst_smoothwave_init), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain), (gst_sw_change_state),
(plugin_init):
* ext/smoothwave/gstsmoothwave.h:
Make gstsmoothwave a working element in the 20th century.
* gst/chart/gstchart.c: (gst_chart_init), (gst_chart_srcconnect):
Fix incorrect link function
2004-11-12 17:37:49 +00:00
|
|
|
|
2006-02-26 21:05:46 +00:00
|
|
|
visual_plugin_unload (visplugin);
|
|
|
|
|
2006-05-15 10:17:04 +00:00
|
|
|
if (!skip) {
|
2006-02-26 21:05:46 +00:00
|
|
|
name = g_strdup_printf ("GstVisual%s", ref->info->plugname);
|
|
|
|
make_valid_name (name);
|
|
|
|
type = g_type_register_static (GST_TYPE_VISUAL, name, &info, 0);
|
|
|
|
g_free (name);
|
|
|
|
|
|
|
|
name = g_strdup_printf ("libvisual_%s", ref->info->plugname);
|
|
|
|
make_valid_name (name);
|
|
|
|
if (!gst_element_register (plugin, name, GST_RANK_NONE, type)) {
|
|
|
|
g_free (name);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2004-04-30 02:25:09 +00:00
|
|
|
g_free (name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
|
|
|
"libvisual",
|
|
|
|
"libvisual visualization plugins",
|
2005-10-16 13:54:44 +00:00
|
|
|
plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
|