mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
playbin2: move convert_frame to playsink
Move the convert_frame function to playsink and make it part of the API. This is in preparation to add the convert_frame signal to playsink. See #620279
This commit is contained in:
parent
823089cf68
commit
afcf3a3517
3 changed files with 39 additions and 18 deletions
|
@ -233,7 +233,6 @@
|
||||||
#include "gstplaysink.h"
|
#include "gstplaysink.h"
|
||||||
#include "gstfactorylists.h"
|
#include "gstfactorylists.h"
|
||||||
#include "gstinputselector.h"
|
#include "gstinputselector.h"
|
||||||
#include "gstscreenshot.h"
|
|
||||||
#include "gstsubtitleoverlay.h"
|
#include "gstsubtitleoverlay.h"
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_STATIC (gst_play_bin_debug);
|
GST_DEBUG_CATEGORY_STATIC (gst_play_bin_debug);
|
||||||
|
@ -788,7 +787,7 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
|
||||||
* GstPlayBin2:frame:
|
* GstPlayBin2:frame:
|
||||||
* @playbin: a #GstPlayBin2
|
* @playbin: a #GstPlayBin2
|
||||||
*
|
*
|
||||||
* Get the currently rendered or prerolled frame in the sink.
|
* Get the currently rendered or prerolled frame in the video sink.
|
||||||
* The #GstCaps on the buffer will describe the format of the buffer.
|
* The #GstCaps on the buffer will describe the format of the buffer.
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (gobject_klass, PROP_FRAME,
|
g_object_class_install_property (gobject_klass, PROP_FRAME,
|
||||||
|
@ -1404,17 +1403,7 @@ gst_play_bin_get_text_tags (GstPlayBin * playbin, gint stream)
|
||||||
static GstBuffer *
|
static GstBuffer *
|
||||||
gst_play_bin_convert_frame (GstPlayBin * playbin, GstCaps * caps)
|
gst_play_bin_convert_frame (GstPlayBin * playbin, GstCaps * caps)
|
||||||
{
|
{
|
||||||
GstBuffer *result;
|
return gst_play_sink_convert_frame (playbin->playsink, caps);
|
||||||
|
|
||||||
result = gst_play_sink_get_last_frame (playbin->playsink);
|
|
||||||
if (result != NULL && caps != NULL) {
|
|
||||||
GstBuffer *temp;
|
|
||||||
|
|
||||||
temp = gst_play_frame_conv_convert (result, caps);
|
|
||||||
gst_buffer_unref (result);
|
|
||||||
result = temp;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns current stream number, or -1 if none has been selected yet */
|
/* Returns current stream number, or -1 if none has been selected yet */
|
||||||
|
@ -1965,7 +1954,8 @@ gst_play_bin_get_property (GObject * object, guint prop_id, GValue * value,
|
||||||
g_value_set_boolean (value, gst_play_sink_get_mute (playbin->playsink));
|
g_value_set_boolean (value, gst_play_sink_get_mute (playbin->playsink));
|
||||||
break;
|
break;
|
||||||
case PROP_FRAME:
|
case PROP_FRAME:
|
||||||
gst_value_take_buffer (value, gst_play_bin_convert_frame (playbin, NULL));
|
gst_value_take_buffer (value,
|
||||||
|
gst_play_sink_get_last_frame (playbin->playsink));
|
||||||
break;
|
break;
|
||||||
case PROP_FONT_DESC:
|
case PROP_FONT_DESC:
|
||||||
g_value_take_string (value,
|
g_value_take_string (value,
|
||||||
|
@ -2451,8 +2441,8 @@ _playsink_sink_event_probe_cb (GstPad * pad, GstEvent * event,
|
||||||
|
|
||||||
if (format != GST_FORMAT_TIME)
|
if (format != GST_FORMAT_TIME)
|
||||||
data->group->selector[data->type].group_start_accum = GST_CLOCK_TIME_NONE;
|
data->group->selector[data->type].group_start_accum = GST_CLOCK_TIME_NONE;
|
||||||
else if (!GST_CLOCK_TIME_IS_VALID (data->group->selector[data->
|
else if (!GST_CLOCK_TIME_IS_VALID (data->group->selector[data->type].
|
||||||
type].group_start_accum))
|
group_start_accum))
|
||||||
data->group->selector[data->type].group_start_accum = segment->accum;
|
data->group->selector[data->type].group_start_accum = segment->accum;
|
||||||
} else if (GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_STOP) {
|
} else if (GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_STOP) {
|
||||||
gst_segment_init (&data->playbin->segments[index], GST_FORMAT_UNDEFINED);
|
gst_segment_init (&data->playbin->segments[index], GST_FORMAT_UNDEFINED);
|
||||||
|
@ -2984,8 +2974,8 @@ autoplug_continue_cb (GstElement * element, GstPad * pad, GstCaps * caps,
|
||||||
GstPad *text_sinkpad = NULL;
|
GstPad *text_sinkpad = NULL;
|
||||||
|
|
||||||
text_sink =
|
text_sink =
|
||||||
(group->playbin->text_sink) ? gst_object_ref (group->
|
(group->playbin->text_sink) ? gst_object_ref (group->playbin->
|
||||||
playbin->text_sink) : NULL;
|
text_sink) : NULL;
|
||||||
if (text_sink)
|
if (text_sink)
|
||||||
text_sinkpad = gst_element_get_static_pad (text_sink, "sink");
|
text_sinkpad = gst_element_get_static_pad (text_sink, "sink");
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <gst/pbutils/pbutils.h>
|
#include <gst/pbutils/pbutils.h>
|
||||||
|
|
||||||
#include "gstplaysink.h"
|
#include "gstplaysink.h"
|
||||||
|
#include "gstscreenshot.h"
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_STATIC (gst_play_sink_debug);
|
GST_DEBUG_CATEGORY_STATIC (gst_play_sink_debug);
|
||||||
#define GST_CAT_DEFAULT gst_play_sink_debug
|
#define GST_CAT_DEFAULT gst_play_sink_debug
|
||||||
|
@ -2457,6 +2458,35 @@ gst_play_sink_get_last_frame (GstPlaySink * playsink)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_play_sink_convert_frame:
|
||||||
|
* @playsink: a #GstPlaySink
|
||||||
|
* @caps: a #GstCaps
|
||||||
|
*
|
||||||
|
* Get the last displayed frame from @playsink. If caps is %NULL, the video will
|
||||||
|
* be in the native format of the sink element and the caps on the buffer
|
||||||
|
* describe the format of the frame. If @caps is not %NULL, the video
|
||||||
|
* frame will be converted to the format of the caps.
|
||||||
|
*
|
||||||
|
* Returns: a #GstBuffer with the frame data or %NULL when no video frame is
|
||||||
|
* available or when the conversion failed.
|
||||||
|
*/
|
||||||
|
GstBuffer *
|
||||||
|
gst_play_sink_convert_frame (GstPlaySink * playsink, GstCaps * caps)
|
||||||
|
{
|
||||||
|
GstBuffer *result;
|
||||||
|
|
||||||
|
result = gst_play_sink_get_last_frame (playsink);
|
||||||
|
if (result != NULL && caps != NULL) {
|
||||||
|
GstBuffer *temp;
|
||||||
|
|
||||||
|
temp = gst_play_frame_conv_convert (result, caps);
|
||||||
|
gst_buffer_unref (result);
|
||||||
|
result = temp;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_play_sink_request_pad
|
* gst_play_sink_request_pad
|
||||||
* @playsink: a #GstPlaySink
|
* @playsink: a #GstPlaySink
|
||||||
|
|
|
@ -92,6 +92,7 @@ void gst_play_sink_set_subtitle_encoding (GstPlaySink *playsink, co
|
||||||
gchar * gst_play_sink_get_subtitle_encoding (GstPlaySink *playsink);
|
gchar * gst_play_sink_get_subtitle_encoding (GstPlaySink *playsink);
|
||||||
|
|
||||||
GstBuffer * gst_play_sink_get_last_frame (GstPlaySink * playsink);
|
GstBuffer * gst_play_sink_get_last_frame (GstPlaySink * playsink);
|
||||||
|
GstBuffer * gst_play_sink_convert_frame (GstPlaySink * playsink, GstCaps * caps);
|
||||||
|
|
||||||
gboolean gst_play_sink_reconfigure (GstPlaySink * playsink);
|
gboolean gst_play_sink_reconfigure (GstPlaySink * playsink);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue