}
static gboolean
-gst_play_sink_audio_convert_sink_event (GstPad * pad, GstEvent * event)
+gst_play_sink_audio_convert_sink_setcaps (GstPlaySinkAudioConvert * self,
+ GstCaps * caps)
{
- GstPlaySinkAudioConvert *self =
- GST_PLAY_SINK_AUDIO_CONVERT (gst_pad_get_parent (pad));
- gboolean ret;
-
- ret = gst_proxy_pad_event_default (pad, gst_event_ref (event));
-
- if (GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT) {
- GST_PLAY_SINK_AUDIO_CONVERT_LOCK (self);
- GST_DEBUG_OBJECT (self, "Segment before %" GST_SEGMENT_FORMAT,
- &self->segment);
- gst_event_copy_segment (event, &self->segment);
- GST_DEBUG_OBJECT (self, "Segment after %" GST_SEGMENT_FORMAT,
- &self->segment);
- GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
- } else if (GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_STOP) {
- GST_PLAY_SINK_AUDIO_CONVERT_LOCK (self);
- GST_DEBUG_OBJECT (self, "Resetting segment");
- gst_segment_init (&self->segment, GST_FORMAT_UNDEFINED);
- GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
- }
-
- gst_event_unref (event);
- gst_object_unref (self);
-
- return ret;
-}
-
-static gboolean
-gst_play_sink_audio_convert_sink_setcaps (GstPad * pad, GstCaps * caps)
-{
- GstPlaySinkAudioConvert *self =
- GST_PLAY_SINK_AUDIO_CONVERT (gst_pad_get_parent (pad));
- gboolean ret;
GstStructure *s;
const gchar *name;
gboolean reconfigure = FALSE;
}
GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
- ret = gst_ghost_pad_setcaps_default (pad, caps);
- GST_DEBUG_OBJECT (self, "Setting sink caps %" GST_PTR_FORMAT ": %d", caps,
- ret);
+ GST_DEBUG_OBJECT (self, "Setting sink caps %" GST_PTR_FORMAT, caps);
+
+ return TRUE;
+}
+static gboolean
+gst_play_sink_audio_convert_sink_event (GstPad * pad, GstEvent * event)
+{
+ GstPlaySinkAudioConvert *self =
+ GST_PLAY_SINK_AUDIO_CONVERT (gst_pad_get_parent (pad));
+ gboolean ret;
+
+ switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_CAPS:
+ {
+ GstCaps *caps;
+
+ gst_event_parse_caps (event, &caps);
+ ret = gst_play_sink_audio_convert_sink_setcaps (self, caps);
+ break;
+ }
+ default:
+ break;
+ }
+
+ ret = gst_proxy_pad_event_default (pad, gst_event_ref (event));
+
+ switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_SEGMENT:
+ GST_PLAY_SINK_AUDIO_CONVERT_LOCK (self);
+ GST_DEBUG_OBJECT (self, "Segment before %" GST_SEGMENT_FORMAT,
+ &self->segment);
+ gst_event_copy_segment (event, &self->segment);
+ GST_DEBUG_OBJECT (self, "Segment after %" GST_SEGMENT_FORMAT,
+ &self->segment);
+ GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
+ break;
+ case GST_EVENT_FLUSH_STOP:
+ GST_PLAY_SINK_AUDIO_CONVERT_LOCK (self);
+ GST_DEBUG_OBJECT (self, "Resetting segment");
+ gst_segment_init (&self->segment, GST_FORMAT_UNDEFINED);
+ GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
+ break;
+ default:
+ break;
+ }
+
+ gst_event_unref (event);
gst_object_unref (self);
return ret;
self->sinkpad = gst_ghost_pad_new_no_target_from_template ("sink", templ);
gst_pad_set_event_function (self->sinkpad,
GST_DEBUG_FUNCPTR (gst_play_sink_audio_convert_sink_event));
- gst_pad_set_setcaps_function (self->sinkpad,
- GST_DEBUG_FUNCPTR (gst_play_sink_audio_convert_sink_setcaps));
gst_pad_set_getcaps_function (self->sinkpad,
GST_DEBUG_FUNCPTR (gst_play_sink_audio_convert_getcaps));
}
static gboolean
-gst_play_sink_video_convert_sink_event (GstPad * pad, GstEvent * event)
+gst_play_sink_video_convert_sink_setcaps (GstPlaySinkVideoConvert * self,
+ GstCaps * caps)
{
- GstPlaySinkVideoConvert *self =
- GST_PLAY_SINK_VIDEO_CONVERT (gst_pad_get_parent (pad));
- gboolean ret;
-
- ret = gst_proxy_pad_event_default (pad, gst_event_ref (event));
-
- if (GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT) {
-
- GST_PLAY_SINK_VIDEO_CONVERT_LOCK (self);
- GST_DEBUG_OBJECT (self, "Segment before %" GST_SEGMENT_FORMAT,
- &self->segment);
- gst_event_copy_segment (event, &self->segment);
- GST_DEBUG_OBJECT (self, "Segment after %" GST_SEGMENT_FORMAT,
- &self->segment);
- GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
- } else if (GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_STOP) {
- GST_PLAY_SINK_VIDEO_CONVERT_LOCK (self);
- GST_DEBUG_OBJECT (self, "Resetting segment");
- gst_segment_init (&self->segment, GST_FORMAT_UNDEFINED);
- GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
- }
-
- gst_event_unref (event);
- gst_object_unref (self);
-
- return ret;
-}
-
-static gboolean
-gst_play_sink_video_convert_sink_setcaps (GstPad * pad, GstCaps * caps)
-{
- GstPlaySinkVideoConvert *self =
- GST_PLAY_SINK_VIDEO_CONVERT (gst_pad_get_parent (pad));
- gboolean ret;
GstStructure *s;
const gchar *name;
gboolean reconfigure = FALSE;
}
GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
- ret = gst_ghost_pad_setcaps_default (pad, caps);
+ GST_DEBUG_OBJECT (self, "Setting sink caps %" GST_PTR_FORMAT, caps);
- GST_DEBUG_OBJECT (self, "Setting sink caps %" GST_PTR_FORMAT ": %d", caps,
- ret);
+ return TRUE;
+}
+static gboolean
+gst_play_sink_video_convert_sink_event (GstPad * pad, GstEvent * event)
+{
+ GstPlaySinkVideoConvert *self =
+ GST_PLAY_SINK_VIDEO_CONVERT (gst_pad_get_parent (pad));
+ gboolean ret;
+
+ switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_CAPS:
+ {
+ GstCaps *caps;
+
+ gst_event_parse_caps (event, &caps);
+ ret = gst_play_sink_video_convert_sink_setcaps (self, caps);
+ break;
+ }
+ default:
+ break;
+ }
+
+ ret = gst_proxy_pad_event_default (pad, gst_event_ref (event));
+
+ switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_SEGMENT:
+ GST_PLAY_SINK_VIDEO_CONVERT_LOCK (self);
+ GST_DEBUG_OBJECT (self, "Segment before %" GST_SEGMENT_FORMAT,
+ &self->segment);
+ gst_event_copy_segment (event, &self->segment);
+ GST_DEBUG_OBJECT (self, "Segment after %" GST_SEGMENT_FORMAT,
+ &self->segment);
+ GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
+ break;
+ case GST_EVENT_FLUSH_STOP:
+ GST_PLAY_SINK_VIDEO_CONVERT_LOCK (self);
+ GST_DEBUG_OBJECT (self, "Resetting segment");
+ gst_segment_init (&self->segment, GST_FORMAT_UNDEFINED);
+ GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
+ break;
+ default:
+ break;
+ }
+
+ gst_event_unref (event);
gst_object_unref (self);
return ret;
self->sinkpad = gst_ghost_pad_new_no_target_from_template ("sink", templ);
gst_pad_set_event_function (self->sinkpad,
GST_DEBUG_FUNCPTR (gst_play_sink_video_convert_sink_event));
- gst_pad_set_setcaps_function (self->sinkpad,
- GST_DEBUG_FUNCPTR (gst_play_sink_video_convert_sink_setcaps));
gst_pad_set_getcaps_function (self->sinkpad,
GST_DEBUG_FUNCPTR (gst_play_sink_video_convert_getcaps));
}
static gboolean
-gst_subtitle_overlay_video_sink_setcaps (GstPad * pad, GstCaps * caps)
+gst_subtitle_overlay_video_sink_setcaps (GstSubtitleOverlay * self,
+ GstCaps * caps)
{
- GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY (gst_pad_get_parent (pad));
gboolean ret = TRUE;
gint fps_n, fps_d;
- GST_DEBUG_OBJECT (pad, "Setting caps: %" GST_PTR_FORMAT, caps);
+ GST_DEBUG_OBJECT (self, "Setting caps: %" GST_PTR_FORMAT, caps);
if (!gst_video_parse_caps_framerate (caps, &fps_n, &fps_d)) {
- GST_ERROR_OBJECT (pad, "Failed to parse framerate from caps");
+ GST_ERROR_OBJECT (self, "Failed to parse framerate from caps");
ret = FALSE;
goto out;
}
}
GST_SUBTITLE_OVERLAY_UNLOCK (self);
- ret = gst_ghost_pad_setcaps_default (pad, caps);
-
out:
- gst_object_unref (self);
return ret;
}
GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY (gst_pad_get_parent (pad));
gboolean ret;
- if (GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_STOP) {
- GST_DEBUG_OBJECT (pad,
- "Resetting video segment because of flush-stop event");
- gst_segment_init (&self->video_segment, GST_FORMAT_UNDEFINED);
- self->fps_n = self->fps_d = 0;
+ switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_FLUSH_STOP:
+ {
+ GST_DEBUG_OBJECT (pad,
+ "Resetting video segment because of flush-stop event");
+ gst_segment_init (&self->video_segment, GST_FORMAT_UNDEFINED);
+ self->fps_n = self->fps_d = 0;
+ break;
+ }
+ case GST_EVENT_CAPS:
+ {
+ GstCaps *caps;
+
+ gst_event_parse_caps (event, &caps);
+ ret = gst_subtitle_overlay_video_sink_setcaps (self, caps);
+ if (!ret)
+ goto done;
+ break;
+ }
+ default:
+ break;
}
ret = gst_proxy_pad_event_default (pad, gst_event_ref (event));
if (GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT) {
-
GST_DEBUG_OBJECT (pad, "segment event: %" GST_PTR_FORMAT, event);
gst_event_copy_segment (event, &self->video_segment);
- if (self->video_segment.format != GST_FORMAT_TIME) {
- GST_ERROR_OBJECT (pad, "Newsegment event in non-time format: %s",
- gst_format_get_name (self->video_segment.format));
- gst_object_unref (event);
- gst_object_unref (self);
- return FALSE;
- }
+ if (self->video_segment.format != GST_FORMAT_TIME)
+ goto invalid_format;
}
+done:
gst_event_unref (event);
gst_object_unref (self);
+
return ret;
+
+ /* ERRORS */
+invalid_format:
+ {
+ GST_ERROR_OBJECT (pad, "Newsegment event in non-time format: %s",
+ gst_format_get_name (self->video_segment.format));
+ ret = FALSE;
+ goto done;
+ }
}
static GstFlowReturn
}
static gboolean
-gst_subtitle_overlay_subtitle_sink_setcaps (GstPad * pad, GstCaps * caps)
+gst_subtitle_overlay_subtitle_sink_setcaps (GstSubtitleOverlay * self,
+ GstCaps * caps)
{
- GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY (gst_pad_get_parent (pad));
gboolean ret = TRUE;
GstPad *target = NULL;;
- GST_DEBUG_OBJECT (pad, "Setting caps: %" GST_PTR_FORMAT, caps);
+ GST_DEBUG_OBJECT (self, "Setting caps: %" GST_PTR_FORMAT, caps);
target =
gst_ghost_pad_get_target (GST_GHOST_PAD_CAST (self->subtitle_sinkpad));
gst_caps_replace (&self->subcaps, caps);
if (target && gst_pad_accept_caps (target, caps)) {
- GST_DEBUG_OBJECT (pad, "Target accepts caps");
- ret = gst_ghost_pad_setcaps_default (pad, caps);
+ GST_DEBUG_OBJECT (self, "Target accepts caps");
GST_SUBTITLE_OVERLAY_UNLOCK (self);
goto out;
}
- GST_DEBUG_OBJECT (pad, "Target did not accept caps");
+ GST_DEBUG_OBJECT (self, "Target did not accept caps");
self->subtitle_error = FALSE;
block_subtitle (self);
out:
if (target)
gst_object_unref (target);
- gst_object_unref (self);
+
return ret;
}
}
switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_CAPS:
+ {
+ GstCaps *caps;
+
+ gst_event_parse_caps (event, &caps);
+ ret = gst_subtitle_overlay_subtitle_sink_setcaps (self, caps);
+ if (!ret)
+ goto out;
+ break;
+ }
case GST_EVENT_FLUSH_STOP:
GST_DEBUG_OBJECT (pad,
"Resetting subtitle segment because of flush-stop");
gst_ghost_pad_new_no_target_from_template ("video_sink", templ);
gst_pad_set_event_function (self->video_sinkpad,
GST_DEBUG_FUNCPTR (gst_subtitle_overlay_video_sink_event));
- gst_pad_set_setcaps_function (self->video_sinkpad,
- GST_DEBUG_FUNCPTR (gst_subtitle_overlay_video_sink_setcaps));
gst_pad_set_chain_function (self->video_sinkpad,
GST_DEBUG_FUNCPTR (gst_subtitle_overlay_video_sink_chain));
GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_unlink));
gst_pad_set_event_function (self->subtitle_sinkpad,
GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_event));
- gst_pad_set_setcaps_function (self->subtitle_sinkpad,
- GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_setcaps));
gst_pad_set_chain_function (self->subtitle_sinkpad,
GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_chain));
gst_pad_set_getcaps_function (self->subtitle_sinkpad,