Commit be0d6baa authored by Tim-Philipp Müller's avatar Tim-Philipp Müller

Merge remote-tracking branch 'origin/master' into 0.11

Conflicts:
	ext/pulse/pulseaudiosink.c
	ext/pulse/pulsesrc.c
	gst/audioparsers/gstaacparse.c
	gst/audioparsers/gstamrparse.c
	gst/audioparsers/gstdcaparse.c
	gst/audioparsers/gstflacparse.c
	gst/effectv/gstradioac.c
	gst/effectv/gstradioac.h
	gst/effectv/gstripple.c

Some possible FIXMEs remaining in the audio parser getcaps functions.
parents a806ae2e a3bc4319
......@@ -535,7 +535,7 @@ dbin_event_probe (GstPad * pad, GstPadProbeInfo * info, gpointer data)
static void
pad_added_cb (GstElement * dbin, GstPad * pad, gpointer * data)
{
GstPulseAudioSink *pbin = GST_PULSE_AUDIO_SINK (data);
GstPulseAudioSink *pbin;
GstPad *sinkpad = NULL;
pbin = GST_PULSE_AUDIO_SINK (data);
......@@ -584,11 +584,13 @@ gst_pulse_audio_sink_add_dbin (GstPulseAudioSink * pbin)
/* Trap the newsegment events that we feed the decodebin and discard them */
sinkpad = gst_element_get_static_pad (GST_ELEMENT (pbin->psink), "sink");
if (pbin->event_probe_id == 0)
pbin->event_probe_id =
gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
dbin_event_probe, gst_object_ref (pbin),
(GDestroyNotify) gst_object_unref);
gst_object_unref (sinkpad);
sinkpad = NULL;
......
This diff is collapsed.
......@@ -72,6 +72,15 @@ struct _GstPulseSrc
GstPulseMixerCtrl *mixer;
GstPulseProbe *probe;
#ifdef HAVE_PULSE_1_0
gdouble volume;
gboolean volume_set:1;
gboolean mute:1;
gboolean mute_set:1;
gint notify; /* atomic */
#endif
gboolean corked:1;
gboolean stream_connected:1;
gboolean operation_success:1;
......
......@@ -69,16 +69,18 @@ GST_DEBUG_CATEGORY_STATIC (aacparse_debug);
#define AAC_FRAME_DURATION(parse) (GST_SECOND/parse->frames_per_sec)
gboolean gst_aac_parse_start (GstBaseParse * parse);
gboolean gst_aac_parse_stop (GstBaseParse * parse);
static gboolean gst_aac_parse_start (GstBaseParse * parse);
static gboolean gst_aac_parse_stop (GstBaseParse * parse);
static gboolean gst_aac_parse_sink_setcaps (GstBaseParse * parse,
GstCaps * caps);
static GstCaps *gst_aac_parse_sink_getcaps (GstBaseParse * parse,
GstCaps * filter);
gboolean gst_aac_parse_check_valid_frame (GstBaseParse * parse,
static gboolean gst_aac_parse_check_valid_frame (GstBaseParse * parse,
GstBaseParseFrame * frame, guint * size, gint * skipsize);
GstFlowReturn gst_aac_parse_parse_frame (GstBaseParse * parse,
static GstFlowReturn gst_aac_parse_parse_frame (GstBaseParse * parse,
GstBaseParseFrame * frame);
gboolean gst_aac_parse_convert (GstBaseParse * parse,
......@@ -131,6 +133,7 @@ gst_aac_parse_class_init (GstAacParseClass * klass)
parse_class->start = GST_DEBUG_FUNCPTR (gst_aac_parse_start);
parse_class->stop = GST_DEBUG_FUNCPTR (gst_aac_parse_stop);
parse_class->set_sink_caps = GST_DEBUG_FUNCPTR (gst_aac_parse_sink_setcaps);
parse_class->get_sink_caps = GST_DEBUG_FUNCPTR (gst_aac_parse_sink_getcaps);
parse_class->parse_frame = GST_DEBUG_FUNCPTR (gst_aac_parse_parse_frame);
parse_class->check_valid_frame =
GST_DEBUG_FUNCPTR (gst_aac_parse_check_valid_frame);
......@@ -568,7 +571,7 @@ gst_aac_parse_detect_stream (GstAacParse * aacparse,
*
* Returns: TRUE if buffer contains a valid frame.
*/
gboolean
static gboolean
gst_aac_parse_check_valid_frame (GstBaseParse * parse,
GstBaseParseFrame * frame, guint * framesize, gint * skipsize)
{
......@@ -643,7 +646,7 @@ gst_aac_parse_check_valid_frame (GstBaseParse * parse,
* Returns: GST_FLOW_OK if frame was successfully parsed and can be pushed
* forward. Otherwise appropriate error is returned.
*/
GstFlowReturn
static GstFlowReturn
gst_aac_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
{
GstAacParse *aacparse;
......@@ -700,7 +703,7 @@ gst_aac_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
*
* Returns: TRUE if startup succeeded.
*/
gboolean
static gboolean
gst_aac_parse_start (GstBaseParse * parse)
{
GstAacParse *aacparse;
......@@ -721,9 +724,44 @@ gst_aac_parse_start (GstBaseParse * parse)
*
* Returns: TRUE is stopping succeeded.
*/
gboolean
static gboolean
gst_aac_parse_stop (GstBaseParse * parse)
{
GST_DEBUG ("stop");
return TRUE;
}
static GstCaps *
gst_aac_parse_sink_getcaps (GstBaseParse * parse, GstCaps * filter)
{
GstCaps *peercaps;
GstCaps *res;
/* FIXME: handle filter caps */
peercaps = gst_pad_get_allowed_caps (GST_BASE_PARSE_SRC_PAD (parse));
if (peercaps) {
guint i, n;
/* Remove the framed field */
peercaps = gst_caps_make_writable (peercaps);
n = gst_caps_get_size (peercaps);
for (i = 0; i < n; i++) {
GstStructure *s = gst_caps_get_structure (peercaps, i);
gst_structure_remove_field (s, "framed");
}
res =
gst_caps_intersect_full (peercaps,
gst_pad_get_pad_template_caps (GST_BASE_PARSE_SRC_PAD (parse)),
GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (peercaps);
} else {
res =
gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_PARSE_SINK_PAD
(parse)));
}
return res;
}
......@@ -165,6 +165,8 @@ static GstFlowReturn gst_ac3_parse_parse_frame (GstBaseParse * parse,
GstBaseParseFrame * frame);
static gboolean gst_ac3_parse_src_event (GstBaseParse * parse,
GstEvent * event);
static GstCaps *gst_ac3_parse_get_sink_caps (GstBaseParse * parse,
GstCaps * filter);
#define gst_ac3_parse_parent_class parent_class
G_DEFINE_TYPE (GstAc3Parse, gst_ac3_parse, GST_TYPE_BASE_PARSE);
......@@ -195,8 +197,8 @@ gst_ac3_parse_class_init (GstAc3ParseClass * klass)
parse_class->check_valid_frame =
GST_DEBUG_FUNCPTR (gst_ac3_parse_check_valid_frame);
parse_class->parse_frame = GST_DEBUG_FUNCPTR (gst_ac3_parse_parse_frame);
parse_class->src_event = GST_DEBUG_FUNCPTR (gst_ac3_parse_src_event);
parse_class->get_sink_caps = GST_DEBUG_FUNCPTR (gst_ac3_parse_get_sink_caps);
}
static void
......@@ -702,3 +704,40 @@ gst_ac3_parse_src_event (GstBaseParse * parse, GstEvent * event)
return GST_BASE_PARSE_CLASS (parent_class)->src_event (parse, event);
}
static GstCaps *
gst_ac3_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter)
{
GstCaps *peercaps;
GstCaps *res;
/* FIXME: handle filter */
peercaps = gst_pad_get_allowed_caps (GST_BASE_PARSE_SRC_PAD (parse));
if (peercaps) {
guint i, n;
/* Remove the framed and alignment field. We can convert
* between different alignments. */
peercaps = gst_caps_make_writable (peercaps);
n = gst_caps_get_size (peercaps);
for (i = 0; i < n; i++) {
GstStructure *s = gst_caps_get_structure (peercaps, i);
gst_structure_remove_field (s, "framed");
gst_structure_remove_field (s, "alignment");
}
res =
gst_caps_intersect_full (peercaps,
gst_pad_get_pad_template_caps (GST_BASE_PARSE_SRC_PAD (parse)),
GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (peercaps);
} else {
res =
gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_PARSE_SINK_PAD
(parse)));
}
return res;
}
......@@ -71,16 +71,18 @@ static const gint block_size_wb[16] =
#define AMR_FRAME_DURATION (GST_SECOND/AMR_FRAMES_PER_SECOND)
#define AMR_MIME_HEADER_SIZE 9
gboolean gst_amr_parse_start (GstBaseParse * parse);
gboolean gst_amr_parse_stop (GstBaseParse * parse);
static gboolean gst_amr_parse_start (GstBaseParse * parse);
static gboolean gst_amr_parse_stop (GstBaseParse * parse);
static gboolean gst_amr_parse_sink_setcaps (GstBaseParse * parse,
GstCaps * caps);
static GstCaps *gst_amr_parse_sink_getcaps (GstBaseParse * parse,
GstCaps * filter);
gboolean gst_amr_parse_check_valid_frame (GstBaseParse * parse,
static gboolean gst_amr_parse_check_valid_frame (GstBaseParse * parse,
GstBaseParseFrame * frame, guint * framesize, gint * skipsize);
GstFlowReturn gst_amr_parse_parse_frame (GstBaseParse * parse,
static GstFlowReturn gst_amr_parse_parse_frame (GstBaseParse * parse,
GstBaseParseFrame * frame);
G_DEFINE_TYPE (GstAmrParse, gst_amr_parse, GST_TYPE_BASE_PARSE);
......@@ -112,6 +114,7 @@ gst_amr_parse_class_init (GstAmrParseClass * klass)
parse_class->start = GST_DEBUG_FUNCPTR (gst_amr_parse_start);
parse_class->stop = GST_DEBUG_FUNCPTR (gst_amr_parse_stop);
parse_class->set_sink_caps = GST_DEBUG_FUNCPTR (gst_amr_parse_sink_setcaps);
parse_class->get_sink_caps = GST_DEBUG_FUNCPTR (gst_amr_parse_sink_getcaps);
parse_class->parse_frame = GST_DEBUG_FUNCPTR (gst_amr_parse_parse_frame);
parse_class->check_valid_frame =
GST_DEBUG_FUNCPTR (gst_amr_parse_check_valid_frame);
......@@ -251,7 +254,7 @@ gst_amr_parse_parse_header (GstAmrParse * amrparse,
*
* Returns: TRUE if the given data contains valid frame.
*/
gboolean
static gboolean
gst_amr_parse_check_valid_frame (GstBaseParse * parse,
GstBaseParseFrame * frame, guint * framesize, gint * skipsize)
{
......@@ -338,7 +341,7 @@ done:
*
* Returns: #GstFlowReturn defining the parsing status.
*/
GstFlowReturn
static GstFlowReturn
gst_amr_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
{
return GST_FLOW_OK;
......@@ -353,7 +356,7 @@ gst_amr_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
*
* Returns: TRUE on success.
*/
gboolean
static gboolean
gst_amr_parse_start (GstBaseParse * parse)
{
GstAmrParse *amrparse;
......@@ -374,7 +377,7 @@ gst_amr_parse_start (GstBaseParse * parse)
*
* Returns: TRUE on success.
*/
gboolean
static gboolean
gst_amr_parse_stop (GstBaseParse * parse)
{
GstAmrParse *amrparse;
......@@ -385,3 +388,41 @@ gst_amr_parse_stop (GstBaseParse * parse)
amrparse->header = 0;
return TRUE;
}
static GstCaps *
gst_amr_parse_sink_getcaps (GstBaseParse * parse, GstCaps * filter)
{
GstCaps *peercaps;
GstCaps *res;
/* FIXME: handle filter caps */
peercaps = gst_pad_get_allowed_caps (GST_BASE_PARSE_SRC_PAD (parse));
if (peercaps) {
guint i, n;
/* Rename structure names */
peercaps = gst_caps_make_writable (peercaps);
n = gst_caps_get_size (peercaps);
for (i = 0; i < n; i++) {
GstStructure *s = gst_caps_get_structure (peercaps, i);
if (gst_structure_has_name (s, "audio/AMR"))
gst_structure_set_name (s, "audio/x-amr-nb-sh");
else
gst_structure_set_name (s, "audio/x-amr-wb-sh");
}
res =
gst_caps_intersect_full (peercaps,
gst_pad_get_pad_template_caps (GST_BASE_PARSE_SRC_PAD (parse)),
GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (peercaps);
} else {
res =
gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_PARSE_SINK_PAD
(parse)));
}
return res;
}
......@@ -78,6 +78,8 @@ static gboolean gst_dca_parse_check_valid_frame (GstBaseParse * parse,
GstBaseParseFrame * frame, guint * size, gint * skipsize);
static GstFlowReturn gst_dca_parse_parse_frame (GstBaseParse * parse,
GstBaseParseFrame * frame);
static GstCaps *gst_dca_parse_get_sink_caps (GstBaseParse * parse,
GstCaps * filter);
#define gst_dca_parse_parent_class parent_class
G_DEFINE_TYPE (GstDcaParse, gst_dca_parse, GST_TYPE_BASE_PARSE);
......@@ -99,6 +101,7 @@ gst_dca_parse_class_init (GstDcaParseClass * klass)
parse_class->check_valid_frame =
GST_DEBUG_FUNCPTR (gst_dca_parse_check_valid_frame);
parse_class->parse_frame = GST_DEBUG_FUNCPTR (gst_dca_parse_parse_frame);
parse_class->get_sink_caps = GST_DEBUG_FUNCPTR (gst_dca_parse_get_sink_caps);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_template));
......@@ -464,3 +467,38 @@ broken_header:
return GST_FLOW_ERROR;
}
}
static GstCaps *
gst_dca_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter)
{
GstCaps *peercaps;
GstCaps *res;
/* FIXME: handle filter caps */
peercaps = gst_pad_get_allowed_caps (GST_BASE_PARSE_SRC_PAD (parse));
if (peercaps) {
guint i, n;
/* Remove the framed field */
peercaps = gst_caps_make_writable (peercaps);
n = gst_caps_get_size (peercaps);
for (i = 0; i < n; i++) {
GstStructure *s = gst_caps_get_structure (peercaps, i);
gst_structure_remove_field (s, "framed");
}
res =
gst_caps_intersect_full (peercaps,
gst_pad_get_pad_template_caps (GST_BASE_PARSE_SRC_PAD (parse)),
GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (peercaps);
} else {
res =
gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_PARSE_SINK_PAD
(parse)));
}
return res;
}
......@@ -201,6 +201,8 @@ static GstFlowReturn gst_flac_parse_pre_push_frame (GstBaseParse * parse,
static gboolean gst_flac_parse_convert (GstBaseParse * parse,
GstFormat src_format, gint64 src_value, GstFormat dest_format,
gint64 * dest_value);
static GstCaps *gst_flac_parse_get_sink_caps (GstBaseParse * parse,
GstCaps * filter);
#define gst_flac_parse_parent_class parent_class
G_DEFINE_TYPE (GstFlacParse, gst_flac_parse, GST_TYPE_BASE_PARSE);
......@@ -233,6 +235,8 @@ gst_flac_parse_class_init (GstFlacParseClass * klass)
baseparse_class->pre_push_frame =
GST_DEBUG_FUNCPTR (gst_flac_parse_pre_push_frame);
baseparse_class->convert = GST_DEBUG_FUNCPTR (gst_flac_parse_convert);
baseparse_class->get_sink_caps =
GST_DEBUG_FUNCPTR (gst_flac_parse_get_sink_caps);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_factory));
......@@ -1502,3 +1506,38 @@ gst_flac_parse_convert (GstBaseParse * parse,
return GST_BASE_PARSE_CLASS (parent_class)->convert (parse, src_format,
src_value, dest_format, dest_value);
}
static GstCaps *
gst_flac_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter)
{
GstCaps *peercaps;
GstCaps *res;
/* FIXME: handle filter caps */
peercaps = gst_pad_get_allowed_caps (GST_BASE_PARSE_SRC_PAD (parse));
if (peercaps) {
guint i, n;
/* Remove the framed field */
peercaps = gst_caps_make_writable (peercaps);
n = gst_caps_get_size (peercaps);
for (i = 0; i < n; i++) {
GstStructure *s = gst_caps_get_structure (peercaps, i);
gst_structure_remove_field (s, "framed");
}
res =
gst_caps_intersect_full (peercaps,
gst_pad_get_pad_template_caps (GST_BASE_PARSE_SRC_PAD (parse)),
GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (peercaps);
} else {
res =
gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_PARSE_SINK_PAD
(parse)));
}
return res;
}
......@@ -100,6 +100,8 @@ static GstFlowReturn gst_mpeg_audio_parse_pre_push_frame (GstBaseParse * parse,
static gboolean gst_mpeg_audio_parse_convert (GstBaseParse * parse,
GstFormat src_format, gint64 src_value,
GstFormat dest_format, gint64 * dest_value);
static GstCaps *gst_mpeg_audio_parse_get_sink_caps (GstBaseParse * parse,
GstCaps * filter);
#define gst_mpeg_audio_parse_parent_class parent_class
G_DEFINE_TYPE (GstMpegAudioParse, gst_mpeg_audio_parse, GST_TYPE_BASE_PARSE);
......@@ -161,6 +163,8 @@ gst_mpeg_audio_parse_class_init (GstMpegAudioParseClass * klass)
parse_class->pre_push_frame =
GST_DEBUG_FUNCPTR (gst_mpeg_audio_parse_pre_push_frame);
parse_class->convert = GST_DEBUG_FUNCPTR (gst_mpeg_audio_parse_convert);
parse_class->get_sink_caps =
GST_DEBUG_FUNCPTR (gst_mpeg_audio_parse_get_sink_caps);
/* register tags */
#define GST_TAG_CRC "has-crc"
......@@ -1288,3 +1292,38 @@ gst_mpeg_audio_parse_pre_push_frame (GstBaseParse * parse,
return GST_FLOW_OK;
}
static GstCaps *
gst_mpeg_audio_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter)
{
GstCaps *peercaps;
GstCaps *res;
/* FIXME: handle filter caps */
peercaps = gst_pad_get_allowed_caps (GST_BASE_PARSE_SRC_PAD (parse));
if (peercaps) {
guint i, n;
/* Remove the parsed field */
peercaps = gst_caps_make_writable (peercaps);
n = gst_caps_get_size (peercaps);
for (i = 0; i < n; i++) {
GstStructure *s = gst_caps_get_structure (peercaps, i);
gst_structure_remove_field (s, "parsed");
}
res =
gst_caps_intersect_full (peercaps,
gst_pad_get_pad_template_caps (GST_BASE_PARSE_SRC_PAD (parse)),
GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (peercaps);
} else {
res =
gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_PARSE_SINK_PAD
(parse)));
}
return res;
}
......@@ -140,7 +140,7 @@ gst_edgetv_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out)
p = *src;
q = *(src - 4);
/* difference between the current pixel and right neighbor. */
/* difference between the current pixel and left neighbor. */
r = ((p & 0xff0000) - (q & 0xff0000)) >> 16;
g = ((p & 0xff00) - (q & 0xff00)) >> 8;
b = (p & 0xff) - (q & 0xff);
......@@ -199,8 +199,12 @@ gst_edgetv_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out)
dest[width + 3] = v3;
dest[width * 2] = v2;
dest[width * 2 + 1] = v2;
dest[width * 2 + 2] = 0;
dest[width * 2 + 3] = 0;
dest[width * 3] = v2;
dest[width * 3 + 1] = v2;
dest[width * 3 + 2] = 0;
dest[width * 3 + 3] = 0;
src += 4;
dest += 4;
......
......@@ -328,7 +328,4 @@ gst_quarktv_init (GstQuarkTV * filter)
{
filter->planes = PLANES;
filter->current_plane = filter->planes - 1;
gst_pad_use_fixed_caps (GST_BASE_TRANSFORM_SRC_PAD (filter));
gst_pad_use_fixed_caps (GST_BASE_TRANSFORM_SINK_PAD (filter));
}
......@@ -131,14 +131,15 @@ enum
#define RATIO 0.95
static guint32 palettes[COLORS * PATTERN];
static gint swap_tab[] = { 2, 1, 0, 3 };
#define gst_radioactv_parent_class parent_class
G_DEFINE_TYPE (GstRadioacTV, gst_radioactv, GST_TYPE_VIDEO_FILTER);
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
#define CAPS_STR GST_VIDEO_CAPS_MAKE ("RGBx")
#define CAPS_STR GST_VIDEO_CAPS_MAKE ("{ RGBx, BGRx }")
#else
#define CAPS_STR GST_VIDEO_CAPS_MAKE ("xBGR")
#define CAPS_STR GST_VIDEO_CAPS_MAKE ("{ xBGR, xRGB }")
#endif
static GstStaticPadTemplate gst_radioactv_src_template =
......@@ -162,18 +163,20 @@ makePalette (void)
#define DELTA (255/(COLORS/2-1))
/* red, gree, blue */
for (i = 0; i < COLORS / 2; i++) {
palettes[i] = i * DELTA;
palettes[COLORS + i] = (i * DELTA) << 8;
palettes[COLORS * 2 + i] = (i * DELTA) << 16;
}
for (i = 0; i < COLORS / 2; i++) {
palettes[+i + COLORS / 2] = 255 | (i * DELTA) << 16 | (i * DELTA) << 8;
palettes[i + COLORS / 2] = 255 | (i * DELTA) << 16 | (i * DELTA) << 8;
palettes[COLORS + i + COLORS / 2] =
(255 << 8) | (i * DELTA) << 16 | i * DELTA;
palettes[COLORS * 2 + i + COLORS / 2] =
(255 << 16) | (i * DELTA) << 8 | i * DELTA;
}
/* white */
for (i = 0; i < COLORS; i++) {
palettes[COLORS * 3 + i] = (255 * i / COLORS) * 0x10101;
}
......@@ -347,7 +350,19 @@ gst_radioactv_transform (GstBaseTransform * trans, GstBuffer * in,
height = GST_VIDEO_FRAME_HEIGHT (&in_frame);
GST_OBJECT_LOCK (filter);
palette = &palettes[COLORS * filter->color];
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
if (GST_VIDEO_FRAME_FORMAT (&in_frame) == GST_VIDEO_FORMAT_RGBx) {
palette = &palettes[COLORS * filter->color];
} else {
palette = &palettes[COLORS * swap_tab[filter->color]];
}
#else
if (GST_VIDEO_FRAME_FORMAT (&in_frame) == GST_VIDEO_FORMAT_xBGR) {
palette = &palettes[COLORS * filter->color];
} else {
palette = &palettes[COLORS * swap_tab[filter->color]];
}
#endif
diff = filter->diff;
if (filter->mode == 3 && filter->trigger)
......@@ -643,7 +658,4 @@ gst_radioactv_init (GstRadioacTV * filter)
filter->color = DEFAULT_COLOR;
filter->interval = DEFAULT_INTERVAL;
filter->trigger = DEFAULT_TRIGGER;
gst_pad_use_fixed_caps (GST_BASE_TRANSFORM_SRC_PAD (filter));
gst_pad_use_fixed_caps (GST_BASE_TRANSFORM_SINK_PAD (filter));
}
......@@ -311,9 +311,9 @@ gst_rippletv_transform (GstBaseTransform * trans, GstBuffer * in,
guint32 *src, *dest;
GstVideoFrame in_frame, out_frame;
gint x, y, i;
gint dx, dy;
gint dx, dy, o_dx;
gint h, v;
gint width, height;
gint m_w, m_h, v_w, v_h;
gint *p, *q, *r;
gint8 *vp;
GstClockTime timestamp, stream_time;
......@@ -344,22 +344,24 @@ gst_rippletv_transform (GstBaseTransform * trans, GstBuffer * in,
else
motiondetect (filter, src);
m_w = filter->map_w;
m_h = filter->map_h;
v_w = GST_VIDEO_FRAME_WIDTH (&in_frame);
v_h = GST_VIDEO_FRAME_HEIGHT (&in_frame);
/* simulate surface wave */
width = filter->map_w;
height = filter->map_h;
/* This function is called only 30 times per second. To increase a speed
* of wave, iterates this loop several times. */
for (i = loopnum; i > 0; i--) {
/* wave simulation */
p = filter->map1 + width + 1;
q = filter->map2 + width + 1;
r = filter->map3 + width + 1;
for (y = height - 2; y > 0; y--) {
for (x = width - 2; x > 0; x--) {
h = *(p - width - 1) + *(p - width + 1) + *(p + width - 1) + *(p +
width + 1)
+ *(p - width) + *(p - 1) + *(p + 1) + *(p + width) - (*p) * 9;
p = filter->map1 + m_w + 1;
q = filter->map2 + m_w + 1;
r = filter->map3 + m_w + 1;
for (y = m_h - 2; y > 0; y--) {
for (x = m_w - 2; x > 0; x--) {
h = *(p - m_w - 1) + *(p - m_w + 1) + *(p + m_w - 1) + *(p + m_w + 1)
+ *(p - m_w) + *(p - 1) + *(p + 1) + *(p + m_w) - (*p) * 9;
h = h >> 3;
v = *p - *q;
v += h - (v >> decay);
......@@ -374,11 +376,11 @@ gst_rippletv_transform (GstBaseTransform * trans, GstBuffer * in,
}
/* low pass filter */
p = filter->map3 + width + 1;
q = filter->map2 + width + 1;
for (y = height - 2; y > 0; y--) {
for (x = width - 2; x > 0; x--) {
h = *(p - width) + *(p - 1) + *(p + 1) + *(p + width) + (*p) * 60;
p = filter->map3 + m_w + 1;
q = filter->map2 + m_w + 1;
for (y = m_h - 2; y > 0; y--) {
for (x = m_w - 2; x > 0; x--) {
h = *(p - m_w) + *(p - 1) + *(p + 1) + *(p + m_w) + (*p) * 60;
*q = h >> 6;
p++;
q++;
......@@ -394,12 +396,12 @@ gst_rippletv_transform (GstBaseTransform * trans, GstBuffer * in,
vp = filter->vtable;
p = filter->map1;
for (y = height - 1; y > 0; y--) {
for (x = width - 1; x > 0; x--) {
for (y = m_h - 1; y > 0; y--) {
for (x = m_w - 1; x > 0; x--) {
/* difference of the height between two voxel. They are twiced to
* emphasise the wave. */
vp[0] = sqrtable[((p[0] - p[1]) >> (point - 1)) & 0xff];
vp[1] = sqrtable[((p[0] - p[width]) >> (point - 1)) & 0xff];
vp[1] = sqrtable[((p[0] - p[m_w]) >> (point - 1)) & 0xff];
p++;
vp += 2;
}
......@@ -407,48 +409,34 @@ gst_rippletv_transform (GstBaseTransform * trans, GstBuffer * in,
vp += 2;
}
width = GST_VIDEO_FRAME_WIDTH (&in_frame);
height = GST_VIDEO_FRAME_HEIGHT (&in_frame);
vp = filter->vtable;
/* draw refracted image. The vector table is stretched. */
for (y = 0; y < height; y += 2) {
for (x = 0; x < width; x += 2) {
for (y = 0; y < v_h; y += 2) {
for (x = 0; x < v_w; x += 2) {
h = (gint) vp[0];
v = (gint) vp[1];
dx = x + h;
dy = y + v;
if (dx < 0)
dx = 0;
if (dy < 0)
dy = 0;
if (dx >= width)
dx = width - 1;
if (dy >= height)
dy = height - 1;
dest[0] = src[dy * width + dx];
i = dx;
dx = CLAMP (dx, 0, (v_w - 1));
dy = CLAMP (dy, 0, (v_h - 1));
dest[0] = src[dy * v_w + dx];
o_dx = dx;
dx = x + 1 + (h + (gint) vp[2]) / 2;
if (dx < 0)
dx = 0;
if (dx >= width)
dx = width - 1;
dest[1] = src[dy * width + dx];
dy = y + 1 + (v + (gint) vp[filter->map_w * 2 + 1]) / 2;
if (dy < 0)
dy = 0;
if (dy >= height)
dy = height - 1;
dest[width] = src[dy * width + i];
dest[width + 1] = src[dy * width + dx];
dx = CLAMP (dx, 0, (v_w - 1));
dest[1] = src[dy * v_w + dx];
dy = y + 1 + (v + (gint) vp[m_w * 2 + 1]) / 2;
dy = CLAMP (dy, 0, (v_h - 1));
dest[v_w] = src[dy * v_w + o_dx];
dest[v_w + 1] = src[dy * v_w + dx];
dest += 2;
vp += 2;
}
dest += width;
dest += v_w;