本文整理汇总了C++中GST_VIDEO_SINK_HEIGHT函数的典型用法代码示例。如果您正苦于以下问题:C++ GST_VIDEO_SINK_HEIGHT函数的具体用法?C++ GST_VIDEO_SINK_HEIGHT怎么用?C++ GST_VIDEO_SINK_HEIGHT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GST_VIDEO_SINK_HEIGHT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: gst_gdk_pixbuf_sink_get_pixbuf_from_buffer
static GdkPixbuf *
gst_gdk_pixbuf_sink_get_pixbuf_from_buffer (GstGdkPixbufSink * sink,
GstBuffer * buf)
{
GdkPixbuf *pix = NULL;
GstVideoFrame *frame;
gint minsize, bytes_per_pixel;
g_return_val_if_fail (GST_VIDEO_SINK_WIDTH (sink) > 0, NULL);
g_return_val_if_fail (GST_VIDEO_SINK_HEIGHT (sink) > 0, NULL);
frame = g_slice_new0 (GstVideoFrame);
gst_video_frame_map (frame, &sink->info, buf, GST_MAP_READ);
bytes_per_pixel = (sink->has_alpha) ? 4 : 3;
/* last row needn't have row padding */
minsize = (GST_VIDEO_FRAME_COMP_STRIDE (frame, 0) *
(GST_VIDEO_SINK_HEIGHT (sink) - 1)) +
(bytes_per_pixel * GST_VIDEO_SINK_WIDTH (sink));
g_return_val_if_fail (gst_buffer_get_size (buf) >= minsize, NULL);
gst_buffer_ref (buf);
pix = gdk_pixbuf_new_from_data (GST_VIDEO_FRAME_COMP_DATA (frame, 0),
GDK_COLORSPACE_RGB, sink->has_alpha, 8, GST_VIDEO_SINK_WIDTH (sink),
GST_VIDEO_SINK_HEIGHT (sink), GST_VIDEO_FRAME_COMP_STRIDE (frame, 0),
(GdkPixbufDestroyNotify) gst_gdk_pixbuf_sink_pixbuf_destroy_notify,
frame);
return pix;
}
开发者ID:BigBrother-International,项目名称:gst-plugins-good,代码行数:32,代码来源:gstgdkpixbufsink.c
示例2: gst_gdk_pixbuf_sink_get_pixbuf_from_buffer
static GdkPixbuf *
gst_gdk_pixbuf_sink_get_pixbuf_from_buffer (GstGdkPixbufSink * sink,
GstBuffer * buf)
{
GdkPixbuf *pix = NULL;
gint minsize, bytes_per_pixel;
g_return_val_if_fail (GST_VIDEO_SINK_WIDTH (sink) > 0, NULL);
g_return_val_if_fail (GST_VIDEO_SINK_HEIGHT (sink) > 0, NULL);
bytes_per_pixel = (sink->has_alpha) ? 4 : 3;
/* last row needn't have row padding */
minsize = (sink->rowstride * (GST_VIDEO_SINK_HEIGHT (sink) - 1)) +
(bytes_per_pixel * GST_VIDEO_SINK_WIDTH (sink));
g_return_val_if_fail (GST_BUFFER_SIZE (buf) >= minsize, NULL);
pix = gdk_pixbuf_new_from_data (GST_BUFFER_DATA (buf),
GDK_COLORSPACE_RGB, sink->has_alpha, 8, GST_VIDEO_SINK_WIDTH (sink),
GST_VIDEO_SINK_HEIGHT (sink), sink->rowstride,
(GdkPixbufDestroyNotify) gst_gdk_pixbuf_sink_pixbuf_destroy_notify,
gst_buffer_ref (buf));
return pix;
}
开发者ID:dgerlach,项目名称:gst-plugins-good,代码行数:26,代码来源:gstgdkpixbufsink.c
示例3: gst_kms_sink_calculate_display_ratio
static gboolean
gst_kms_sink_calculate_display_ratio (GstKMSSink * self, GstVideoInfo * vinfo)
{
guint dar_n, dar_d;
guint video_width, video_height;
guint video_par_n, video_par_d;
guint dpy_par_n, dpy_par_d;
video_width = GST_VIDEO_INFO_WIDTH (vinfo);
video_height = GST_VIDEO_INFO_HEIGHT (vinfo);
video_par_n = GST_VIDEO_INFO_PAR_N (vinfo);
video_par_d = GST_VIDEO_INFO_PAR_D (vinfo);
gst_video_calculate_device_ratio (self->hdisplay, self->vdisplay,
self->mm_width, self->mm_height, &dpy_par_n, &dpy_par_d);
if (!gst_video_calculate_display_ratio (&dar_n, &dar_d, video_width,
video_height, video_par_n, video_par_d, dpy_par_n, dpy_par_d))
return FALSE;
GST_DEBUG_OBJECT (self, "video calculated display ratio: %d/%d", dar_n,
dar_d);
/* now find a width x height that respects this display ratio.
* prefer those that have one of w/h the same as the incoming video
* using wd / hd = dar_n / dar_d */
/* start with same height, because of interlaced video */
/* check hd / dar_d is an integer scale factor, and scale wd with the PAR */
if (video_height % dar_d == 0) {
GST_DEBUG_OBJECT (self, "keeping video height");
GST_VIDEO_SINK_WIDTH (self) = (guint)
gst_util_uint64_scale_int (video_height, dar_n, dar_d);
GST_VIDEO_SINK_HEIGHT (self) = video_height;
} else if (video_width % dar_n == 0) {
GST_DEBUG_OBJECT (self, "keeping video width");
GST_VIDEO_SINK_WIDTH (self) = video_width;
GST_VIDEO_SINK_HEIGHT (self) = (guint)
gst_util_uint64_scale_int (video_width, dar_d, dar_n);
} else {
GST_DEBUG_OBJECT (self, "approximating while keeping video height");
GST_VIDEO_SINK_WIDTH (self) = (guint)
gst_util_uint64_scale_int (video_height, dar_n, dar_d);
GST_VIDEO_SINK_HEIGHT (self) = video_height;
}
GST_DEBUG_OBJECT (self, "scaling to %dx%d", GST_VIDEO_SINK_WIDTH (self),
GST_VIDEO_SINK_HEIGHT (self));
return TRUE;
}
开发者ID:justinjoy,项目名称:gst-plugins-bad,代码行数:50,代码来源:gstkmssink.c
示例4: gst_sdlvideosink_navigation_send_event
static void
gst_sdlvideosink_navigation_send_event (GstNavigation * navigation,
GstStructure * structure)
{
GstSDLVideoSink *sdlvideosink = GST_SDLVIDEOSINK (navigation);
GstEvent *event;
GstVideoRectangle dst = { 0, };
GstVideoRectangle src = { 0, };
GstVideoRectangle result;
double x, y, old_x, old_y;
GstPad *pad = NULL;
src.w = GST_VIDEO_SINK_WIDTH (sdlvideosink);
src.h = GST_VIDEO_SINK_HEIGHT (sdlvideosink);
dst.w = sdlvideosink->width;
dst.h = sdlvideosink->height;
gst_video_sink_center_rect (src, dst, &result, FALSE);
event = gst_event_new_navigation (structure);
/* Our coordinates can be wrong here if we centered the video */
/* Converting pointer coordinates to the non scaled geometry */
if (gst_structure_get_double (structure, "pointer_x", &old_x)) {
x = old_x;
if (x >= result.x && x <= (result.x + result.w)) {
x -= result.x;
x *= sdlvideosink->width;
x /= result.w;
} else {
x = 0;
}
GST_DEBUG_OBJECT (sdlvideosink, "translated navigation event x "
"coordinate from %f to %f", old_x, x);
gst_structure_set (structure, "pointer_x", G_TYPE_DOUBLE, x, NULL);
}
if (gst_structure_get_double (structure, "pointer_y", &old_y)) {
y = old_y;
if (y >= result.y && y <= (result.y + result.h)) {
y -= result.y;
y *= sdlvideosink->height;
y /= result.h;
} else {
y = 0;
}
GST_DEBUG_OBJECT (sdlvideosink, "translated navigation event y "
"coordinate from %f to %f", old_y, y);
gst_structure_set (structure, "pointer_y", G_TYPE_DOUBLE, y, NULL);
}
pad = gst_pad_get_peer (GST_VIDEO_SINK_PAD (sdlvideosink));
if (GST_IS_PAD (pad) && GST_IS_EVENT (event)) {
gst_pad_send_event (pad, event);
gst_object_unref (pad);
}
}
开发者ID:asrashley,项目名称:gst-plugins-bad,代码行数:60,代码来源:sdlvideosink.c
示例5: gst_glimage_sink_redisplay
static gboolean
gst_glimage_sink_redisplay (GstGLImageSink * gl_sink)
{
GstGLWindow *window;
gboolean alive;
window = gst_gl_context_get_window (gl_sink->context);
if (window && gst_gl_window_is_running (window)) {
#if GST_GL_HAVE_GLES2
if (USING_GLES2 (gl_sink->context)) {
if (!gl_sink->redisplay_shader) {
gst_gl_window_send_message (window,
GST_GL_WINDOW_CB (gst_glimage_sink_thread_init_redisplay), gl_sink);
}
}
#endif
/* Drawing is asynchrone: gst_gl_window_draw is not blocking
* It means that it does not wait for stuff being executed in other threads
*/
gst_gl_window_draw (window, GST_VIDEO_SINK_WIDTH (gl_sink),
GST_VIDEO_SINK_HEIGHT (gl_sink));
}
alive = gst_gl_window_is_running (window);
gst_object_unref (window);
return alive;
}
开发者ID:freedesktop-unofficial-mirror,项目名称:gstreamer__attic__gst-plugins-gl,代码行数:30,代码来源:gstglimagesink.c
示例6: gst_v4l2sink_set_caps
static gboolean
gst_v4l2sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
{
GstV4l2Sink *v4l2sink = GST_V4L2SINK (bsink);
GstV4l2Object *obj = v4l2sink->v4l2object;
LOG_CAPS (v4l2sink, caps);
if (!GST_V4L2_IS_OPEN (v4l2sink->v4l2object)) {
GST_DEBUG_OBJECT (v4l2sink, "device is not open");
return FALSE;
}
/* make sure the caps changed before doing anything */
if (gst_v4l2_object_caps_equal (obj, caps))
return TRUE;
if (!gst_v4l2_object_stop (obj))
goto stop_failed;
if (!gst_v4l2_object_set_format (v4l2sink->v4l2object, caps))
goto invalid_format;
gst_v4l2sink_sync_overlay_fields (v4l2sink);
gst_v4l2sink_sync_crop_fields (v4l2sink);
#ifdef HAVE_XVIDEO
gst_v4l2_video_overlay_prepare_window_handle (v4l2sink->v4l2object, TRUE);
#endif
GST_INFO_OBJECT (v4l2sink, "outputting buffers via mmap()");
v4l2sink->video_width = GST_V4L2_WIDTH (v4l2sink->v4l2object);
v4l2sink->video_height = GST_V4L2_HEIGHT (v4l2sink->v4l2object);
/* TODO: videosink width/height should be scaled according to
* pixel-aspect-ratio
*/
GST_VIDEO_SINK_WIDTH (v4l2sink) = v4l2sink->video_width;
GST_VIDEO_SINK_HEIGHT (v4l2sink) = v4l2sink->video_height;
return TRUE;
/* ERRORS */
stop_failed:
{
GST_DEBUG_OBJECT (v4l2sink, "failed to stop streaming");
return FALSE;
}
invalid_format:
{
/* error already posted */
GST_DEBUG_OBJECT (v4l2sink, "can't set format");
return FALSE;
}
}
开发者ID:PeterXu,项目名称:gst-mobile,代码行数:56,代码来源:gstv4l2sink.c
示例7: gst_glimage_sink_navigation_send_event
static void
gst_glimage_sink_navigation_send_event (GstNavigation * navigation, GstStructure
* structure)
{
GstGLImageSink *sink = GST_GLIMAGE_SINK (navigation);
GstEvent *event = NULL;
GstPad *pad = NULL;
GstGLWindow *window = gst_gl_context_get_window (sink->context);
guint width, height;
gdouble x, y, xscale, yscale;
g_return_if_fail (GST_GL_IS_WINDOW (window));
width = GST_VIDEO_SINK_WIDTH (sink);
height = GST_VIDEO_SINK_HEIGHT (sink);
gst_gl_window_get_surface_dimensions (window, &width, &height);
event = gst_event_new_navigation (structure);
pad = gst_pad_get_peer (GST_VIDEO_SINK_PAD (sink));
/* Converting pointer coordinates to the non scaled geometry */
if (width != GST_VIDEO_SINK_WIDTH (sink) &&
width != 0 && gst_structure_get_double (structure, "pointer_x", &x)) {
xscale = (gdouble) GST_VIDEO_SINK_WIDTH (sink) / width;
gst_structure_set (structure, "pointer_x", G_TYPE_DOUBLE,
(gdouble) x * xscale, NULL);
}
if (height != GST_VIDEO_SINK_HEIGHT (sink) &&
height != 0 && gst_structure_get_double (structure, "pointer_y", &y)) {
yscale = (gdouble) GST_VIDEO_SINK_HEIGHT (sink) / height;
gst_structure_set (structure, "pointer_y", G_TYPE_DOUBLE,
(gdouble) y * yscale, NULL);
}
if (GST_IS_PAD (pad) && GST_IS_EVENT (event))
gst_pad_send_event (pad, event);
gst_object_unref (pad);
gst_object_unref (window);
}
开发者ID:asdlei00,项目名称:gst-plugins-bad,代码行数:41,代码来源:gstglimagesink.c
示例8: gst_glimage_sink_show_frame
static GstFlowReturn
gst_glimage_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
{
GstGLImageSink *glimage_sink;
GstBuffer *stored_buffer;
GST_TRACE ("rendering buffer:%p", buf);
glimage_sink = GST_GLIMAGE_SINK (vsink);
GST_TRACE ("redisplay texture:%u of size:%ux%u, window size:%ux%u",
glimage_sink->next_tex, GST_VIDEO_INFO_WIDTH (&glimage_sink->info),
GST_VIDEO_INFO_HEIGHT (&glimage_sink->info),
GST_VIDEO_SINK_WIDTH (glimage_sink),
GST_VIDEO_SINK_HEIGHT (glimage_sink));
/* Avoid to release the texture while drawing */
GST_GLIMAGE_SINK_LOCK (glimage_sink);
glimage_sink->redisplay_texture = glimage_sink->next_tex;
stored_buffer = glimage_sink->stored_buffer;
glimage_sink->stored_buffer = gst_buffer_ref (buf);
GST_GLIMAGE_SINK_UNLOCK (glimage_sink);
if (stored_buffer)
gst_buffer_unref (stored_buffer);
/* Ask the underlying window to redraw its content */
if (!gst_glimage_sink_redisplay (glimage_sink))
goto redisplay_failed;
GST_TRACE ("post redisplay");
if (g_atomic_int_get (&glimage_sink->to_quit) != 0) {
GST_ELEMENT_ERROR (glimage_sink, RESOURCE, NOT_FOUND,
("%s", gst_gl_context_get_error ()), (NULL));
gst_gl_upload_release_buffer (glimage_sink->upload);
return GST_FLOW_ERROR;
}
return GST_FLOW_OK;
/* ERRORS */
redisplay_failed:
{
gst_gl_upload_release_buffer (glimage_sink->upload);
GST_ELEMENT_ERROR (glimage_sink, RESOURCE, NOT_FOUND,
("%s", gst_gl_context_get_error ()), (NULL));
return GST_FLOW_ERROR;
}
}
开发者ID:asdlei00,项目名称:gst-plugins-bad,代码行数:49,代码来源:gstglimagesink.c
示例9: gst_glimage_sink_set_caps
static gboolean
gst_glimage_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
{
GstGLImageSink *glimage_sink;
gint width;
gint height;
gboolean ok;
gint fps_n, fps_d;
gint par_n, par_d;
GstVideoFormat format;
GstStructure *structure;
gboolean is_gl;
GST_DEBUG ("set caps with %" GST_PTR_FORMAT, caps);
glimage_sink = GST_GLIMAGE_SINK (bsink);
structure = gst_caps_get_structure (caps, 0);
if (gst_structure_has_name (structure, "video/x-raw-gl")) {
is_gl = TRUE;
format = GST_VIDEO_FORMAT_UNKNOWN;
ok = gst_structure_get_int (structure, "width", &width);
ok &= gst_structure_get_int (structure, "height", &height);
} else {
is_gl = FALSE;
ok = gst_video_format_parse_caps (caps, &format, &width, &height);
}
ok &= gst_video_parse_caps_framerate (caps, &fps_n, &fps_d);
ok &= gst_video_parse_caps_pixel_aspect_ratio (caps, &par_n, &par_d);
if (!ok)
return FALSE;
GST_VIDEO_SINK_WIDTH (glimage_sink) = width;
GST_VIDEO_SINK_HEIGHT (glimage_sink) = height;
glimage_sink->is_gl = is_gl;
glimage_sink->format = format;
glimage_sink->width = width;
glimage_sink->height = height;
glimage_sink->fps_n = fps_n;
glimage_sink->fps_d = fps_d;
glimage_sink->par_n = par_n;
glimage_sink->par_d = par_d;
if (!glimage_sink->window_id && !glimage_sink->new_window_id)
gst_x_overlay_prepare_xwindow_id (GST_X_OVERLAY (glimage_sink));
return TRUE;
}
开发者ID:zsx,项目名称:ossbuild,代码行数:49,代码来源:gstglimagesink.c
示例10: gst_pvrvideosink_change_state
static GstStateChangeReturn
gst_pvrvideosink_change_state (GstElement * element, GstStateChange transition)
{
GstPVRVideoSink *pvrvideosink;
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
GstDrawContext *dcontext;
pvrvideosink = GST_PVRVIDEOSINK (element);
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
if (pvrvideosink->dcontext == NULL) {
dcontext = gst_pvrvideosink_get_dcontext (pvrvideosink);
if (dcontext == NULL)
return GST_STATE_CHANGE_FAILURE;
GST_OBJECT_LOCK (pvrvideosink);
pvrvideosink->dcontext = dcontext;
GST_OBJECT_UNLOCK (pvrvideosink);
}
gst_pvrvideosink_manage_event_thread (pvrvideosink);
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break;
default:
break;
}
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
switch (transition) {
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
GST_VIDEO_SINK_WIDTH (pvrvideosink) = 0;
GST_VIDEO_SINK_HEIGHT (pvrvideosink) = 0;
break;
case GST_STATE_CHANGE_READY_TO_NULL:
gst_pvrvideosink_reset (pvrvideosink);
break;
default:
break;
}
return ret;
}
开发者ID:drothlis,项目名称:gst-plugins-bad,代码行数:49,代码来源:gstpvrvideosink.c
示例11: gst_vdp_sink_navigation_send_event
static void
gst_vdp_sink_navigation_send_event (GstNavigation * navigation,
GstStructure * structure)
{
VdpSink *vdp_sink = GST_VDP_SINK (navigation);
GstEvent *event;
gint x_offset, y_offset;
gdouble x, y;
GstPad *pad = NULL;
event = gst_event_new_navigation (structure);
/* We are not converting the pointer coordinates as there's no hardware
scaling done here. The only possible scaling is done by videoscale and
videoscale will have to catch those events and tranform the coordinates
to match the applied scaling. So here we just add the offset if the image
is centered in the window. */
/* We take the flow_lock while we look at the window */
g_mutex_lock (vdp_sink->flow_lock);
if (!vdp_sink->window) {
g_mutex_unlock (vdp_sink->flow_lock);
return;
}
x_offset = vdp_sink->window->width - GST_VIDEO_SINK_WIDTH (vdp_sink);
y_offset = vdp_sink->window->height - GST_VIDEO_SINK_HEIGHT (vdp_sink);
g_mutex_unlock (vdp_sink->flow_lock);
if (x_offset > 0 && gst_structure_get_double (structure, "pointer_x", &x)) {
x -= x_offset / 2;
gst_structure_set (structure, "pointer_x", G_TYPE_DOUBLE, x, NULL);
}
if (y_offset > 0 && gst_structure_get_double (structure, "pointer_y", &y)) {
y -= y_offset / 2;
gst_structure_set (structure, "pointer_y", G_TYPE_DOUBLE, y, NULL);
}
pad = gst_pad_get_peer (GST_VIDEO_SINK_PAD (vdp_sink));
if (GST_IS_PAD (pad) && GST_IS_EVENT (event)) {
gst_pad_send_event (pad, event);
gst_object_unref (pad);
}
}
开发者ID:spunktsch,项目名称:svtplayer,代码行数:48,代码来源:gstvdpsink.c
示例12: gst_glimage_sink_on_resize
static void
gst_glimage_sink_on_resize (GstGLImageSink * gl_sink, gint width, gint height)
{
/* Here gl_sink members (ex:gl_sink->info) have a life time of set_caps.
* It means that they cannot not change between two set_caps
*/
const GstGLFuncs *gl = gl_sink->context->gl_vtable;
gboolean do_reshape;
GST_TRACE ("GL Window resized to %ux%u", width, height);
/* check if a client reshape callback is registered */
g_signal_emit (gl_sink, gst_glimage_sink_signals[CLIENT_RESHAPE_SIGNAL], 0,
gl_sink->context, width, height, &do_reshape);
/* default reshape */
if (!do_reshape) {
if (gl_sink->keep_aspect_ratio) {
GstVideoRectangle src, dst, result;
src.x = 0;
src.y = 0;
src.w = GST_VIDEO_SINK_WIDTH (gl_sink);
src.h = GST_VIDEO_SINK_HEIGHT (gl_sink);
dst.x = 0;
dst.y = 0;
dst.w = width;
dst.h = height;
gst_video_sink_center_rect (src, dst, &result, TRUE);
gl->Viewport (result.x, result.y, result.w, result.h);
} else {
gl->Viewport (0, 0, width, height);
}
#if GST_GL_HAVE_OPENGL
if (USING_OPENGL (gl_sink->context)) {
gl->MatrixMode (GL_PROJECTION);
gl->LoadIdentity ();
gluOrtho2D (0, width, 0, height);
gl->MatrixMode (GL_MODELVIEW);
}
#endif
}
}
开发者ID:asdlei00,项目名称:gst-plugins-bad,代码行数:45,代码来源:gstglimagesink.c
示例13: gst_glimage_sink_change_state
static GstStateChangeReturn
gst_glimage_sink_change_state (GstElement * element, GstStateChange transition)
{
GstGLImageSink *glimage_sink;
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
GST_DEBUG ("change state");
glimage_sink = GST_GLIMAGE_SINK (element);
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break;
default:
break;
}
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
if (ret == GST_STATE_CHANGE_FAILURE)
return ret;
switch (transition) {
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
gst_glimage_sink_stop (GST_BASE_SINK (glimage_sink));
glimage_sink->fps_n = 0;
glimage_sink->fps_d = 1;
GST_VIDEO_SINK_WIDTH (glimage_sink) = 0;
GST_VIDEO_SINK_HEIGHT (glimage_sink) = 0;
break;
case GST_STATE_CHANGE_READY_TO_NULL:
break;
default:
break;
}
return ret;
}
开发者ID:zsx,项目名称:ossbuild,代码行数:43,代码来源:gstglimagesink.c
示例14: gst_gdk_pixbuf_sink_set_caps
static gboolean
gst_gdk_pixbuf_sink_set_caps (GstBaseSink * basesink, GstCaps * caps)
{
GstGdkPixbufSink *sink = GST_GDK_PIXBUF_SINK (basesink);
GstVideoInfo info;
GstVideoFormat fmt;
gint w, h, s, par_n, par_d;
GST_LOG_OBJECT (sink, "caps: %" GST_PTR_FORMAT, caps);
if (!gst_video_info_from_caps (&info, caps)) {
GST_WARNING_OBJECT (sink, "parse_caps failed");
return FALSE;
}
fmt = GST_VIDEO_INFO_FORMAT (&info);
w = GST_VIDEO_INFO_WIDTH (&info);
h = GST_VIDEO_INFO_HEIGHT (&info);
s = GST_VIDEO_INFO_COMP_PSTRIDE (&info, 0);
par_n = GST_VIDEO_INFO_PAR_N (&info);
par_d = GST_VIDEO_INFO_PAR_N (&info);
g_assert ((fmt == GST_VIDEO_FORMAT_RGB && s == 3) ||
(fmt == GST_VIDEO_FORMAT_RGBA && s == 4));
GST_VIDEO_SINK_WIDTH (sink) = w;
GST_VIDEO_SINK_HEIGHT (sink) = h;
sink->par_n = par_n;
sink->par_d = par_d;
sink->has_alpha = GST_VIDEO_INFO_HAS_ALPHA (&info);
GST_INFO_OBJECT (sink, "format : %d", fmt);
GST_INFO_OBJECT (sink, "width x height : %d x %d", w, h);
GST_INFO_OBJECT (sink, "pixel-aspect-ratio : %d/%d", par_n, par_d);
sink->info = info;
return TRUE;
}
开发者ID:BigBrother-International,项目名称:gst-plugins-good,代码行数:41,代码来源:gstgdkpixbufsink.c
示例15: gst_gdk_pixbuf_sink_stop
static gboolean
gst_gdk_pixbuf_sink_stop (GstBaseSink * basesink)
{
GstGdkPixbufSink *sink = GST_GDK_PIXBUF_SINK (basesink);
GST_VIDEO_SINK_WIDTH (sink) = 0;
GST_VIDEO_SINK_HEIGHT (sink) = 0;
sink->par_n = 0;
sink->par_d = 0;
sink->has_alpha = FALSE;
if (sink->last_pixbuf) {
g_object_unref (sink->last_pixbuf);
sink->last_pixbuf = NULL;
}
GST_LOG_OBJECT (sink, "stop");
return TRUE;
}
开发者ID:dgerlach,项目名称:gst-plugins-good,代码行数:21,代码来源:gstgdkpixbufsink.c
示例16: gst_slvideo_change_state
static GstStateChangeReturn
gst_slvideo_change_state(GstElement * element, GstStateChange transition)
{
GstSLVideo *slvideo;
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
slvideo = GST_SLVIDEO (element);
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break;
default:
break;
}
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
if (ret == GST_STATE_CHANGE_FAILURE)
return ret;
switch (transition) {
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
slvideo->fps_n = 0;
slvideo->fps_d = 1;
GST_VIDEO_SINK_WIDTH(slvideo) = 0;
GST_VIDEO_SINK_HEIGHT(slvideo) = 0;
break;
case GST_STATE_CHANGE_READY_TO_NULL:
break;
default:
break;
}
return ret;
}
开发者ID:Kitty-xx,项目名称:imprudence,代码行数:40,代码来源:llmediaimplgstreamervidplug.cpp
示例17: gst_gdk_pixbuf_sink_set_caps
static gboolean
gst_gdk_pixbuf_sink_set_caps (GstBaseSink * basesink, GstCaps * caps)
{
GstGdkPixbufSink *sink = GST_GDK_PIXBUF_SINK (basesink);
GstVideoFormat fmt;
gint w, h, par_n, par_d;
GST_LOG_OBJECT (sink, "caps: %" GST_PTR_FORMAT, caps);
if (!gst_video_format_parse_caps (caps, &fmt, &w, &h)) {
GST_WARNING_OBJECT (sink, "parse_caps failed");
return FALSE;
}
if (!gst_video_parse_caps_pixel_aspect_ratio (caps, &par_n, &par_d)) {
GST_LOG_OBJECT (sink, "no pixel aspect ratio");
return FALSE;
}
g_assert ((fmt == GST_VIDEO_FORMAT_RGB &&
gst_video_format_get_pixel_stride (fmt, 0) == 3) ||
(fmt == GST_VIDEO_FORMAT_RGBA &&
gst_video_format_get_pixel_stride (fmt, 0) == 4));
GST_VIDEO_SINK_WIDTH (sink) = w;
GST_VIDEO_SINK_HEIGHT (sink) = h;
sink->rowstride = gst_video_format_get_row_stride (fmt, 0, w);
sink->has_alpha = (fmt == GST_VIDEO_FORMAT_RGBA);
sink->par_n = par_n;
sink->par_d = par_d;
GST_INFO_OBJECT (sink, "format : %d", fmt);
GST_INFO_OBJECT (sink, "width x height : %d x %d", w, h);
GST_INFO_OBJECT (sink, "pixel-aspect-ratio : %d/%d", par_d, par_n);
return TRUE;
}
开发者ID:dgerlach,项目名称:gst-plugins-good,代码行数:39,代码来源:gstgdkpixbufsink.c
示例18: gst_glimage_sink_prepare
static GstFlowReturn
gst_glimage_sink_prepare (GstBaseSink * bsink, GstBuffer * buf)
{
GstGLImageSink *glimage_sink;
glimage_sink = GST_GLIMAGE_SINK (bsink);
GST_TRACE ("preparing buffer:%p", buf);
if (GST_VIDEO_SINK_WIDTH (glimage_sink) < 1 ||
GST_VIDEO_SINK_HEIGHT (glimage_sink) < 1) {
return GST_FLOW_NOT_NEGOTIATED;
}
if (!_ensure_gl_setup (glimage_sink))
return GST_FLOW_NOT_NEGOTIATED;
if (!gst_gl_upload_perform_with_buffer (glimage_sink->upload, buf,
&glimage_sink->next_tex))
goto upload_failed;
if (glimage_sink->window_id != glimage_sink->new_window_id) {
GstGLWindow *window = gst_gl_context_get_window (glimage_sink->context);
glimage_sink->window_id = glimage_sink->new_window_id;
gst_gl_window_set_window_handle (window, glimage_sink->window_id);
gst_object_unref (window);
}
return GST_FLOW_OK;
upload_failed:
{
GST_ELEMENT_ERROR (glimage_sink, RESOURCE, NOT_FOUND,
("%s", "Failed to upload buffer"), (NULL));
return GST_FLOW_ERROR;
}
}
开发者ID:asdlei00,项目名称:gst-plugins-bad,代码行数:39,代码来源:gstglimagesink.c
示例19: gst_glimage_sink_redisplay
static gboolean
gst_glimage_sink_redisplay (GstGLImageSink * gl_sink)
{
GstGLWindow *window;
gboolean alive;
window = gst_gl_context_get_window (gl_sink->context);
if (!window)
return FALSE;
if (gst_gl_window_is_running (window)) {
#if GST_GL_HAVE_GLES2
if (USING_GLES2 (gl_sink->context)) {
if (G_UNLIKELY (!gl_sink->redisplay_shader)) {
gst_gl_window_send_message (window,
GST_GL_WINDOW_CB (gst_glimage_sink_thread_init_redisplay), gl_sink);
/* if the shader is still null it means it failed to be useable */
if (G_UNLIKELY (!gl_sink->redisplay_shader)) {
gst_object_unref (window);
return FALSE;
}
}
}
#endif
/* Drawing is asynchronous: gst_gl_window_draw is not blocking
* It means that it does not wait for stuff to be executed in other threads
*/
gst_gl_window_draw (window, GST_VIDEO_SINK_WIDTH (gl_sink),
GST_VIDEO_SINK_HEIGHT (gl_sink));
}
alive = gst_gl_window_is_running (window);
gst_object_unref (window);
return alive;
}
开发者ID:asdlei00,项目名称:gst-plugins-bad,代码行数:38,代码来源:gstglimagesink.c
示例20: gst_glimage_sink_change_state
//.........这里部分代码省略.........
(glimage_sink));
if (glimage_sink->window_id != glimage_sink->new_window_id) {
glimage_sink->window_id = glimage_sink->new_window_id;
gst_gl_window_set_window_handle (window, glimage_sink->window_id);
}
if (!gst_gl_context_create (glimage_sink->context,
glimage_sink->other_context, &error)) {
GST_ELEMENT_ERROR (glimage_sink, RESOURCE, NOT_FOUND, ("%s",
error->message), (NULL));
if (glimage_sink->display) {
gst_object_unref (glimage_sink->display);
glimage_sink->display = NULL;
}
gst_object_unref (glimage_sink->context);
gst_object_unref (window);
return GST_STATE_CHANGE_FAILURE;
}
/* setup callbacks */
gst_gl_window_set_resize_callback (window,
GST_GL_WINDOW_RESIZE_CB (gst_glimage_sink_on_resize),
gst_object_ref (glimage_sink), (GDestroyNotify) gst_object_unref);
gst_gl_window_set_draw_callback (window,
GST_GL_WINDOW_CB (gst_glimage_sink_on_draw),
gst_object_ref (glimage_sink), (GDestroyNotify) gst_object_unref);
gst_gl_window_set_close_callback (window,
GST_GL_WINDOW_CB (gst_glimage_sink_on_close),
gst_object_ref (glimage_sink), (GDestroyNotify) gst_object_unref);
gst_object_unref (window);
}
break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break;
default:
break;
}
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
if (ret == GST_STATE_CHANGE_FAILURE)
return ret;
switch (transition) {
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
{
/* mark the redisplay_texture as unavailable (=0)
* to avoid drawing
*/
GST_GLIMAGE_SINK_LOCK (glimage_sink);
glimage_sink->redisplay_texture = 0;
GST_GLIMAGE_SINK_UNLOCK (glimage_sink);
if (glimage_sink->upload) {
gst_object_unref (glimage_sink->upload);
glimage_sink->upload = NULL;
}
glimage_sink->window_id = 0;
//but do not reset glimage_sink->new_window_id
if (glimage_sink->pool) {
gst_buffer_pool_set_active (glimage_sink->pool, FALSE);
gst_object_unref (glimage_sink->pool);
glimage_sink->pool = NULL;
}
GST_VIDEO_SINK_WIDTH (glimage_sink) = 1;
GST_VIDEO_SINK_HEIGHT (glimage_sink) = 1;
if (glimage_sink->context) {
GstGLWindow *window = gst_gl_context_get_window (glimage_sink->context);
gst_gl_window_send_message (window,
GST_GL_WINDOW_CB (gst_glimage_sink_cleanup_glthread), glimage_sink);
gst_gl_window_set_resize_callback (window, NULL, NULL, NULL);
gst_gl_window_set_draw_callback (window, NULL, NULL, NULL);
gst_gl_window_set_close_callback (window, NULL, NULL, NULL);
gst_object_unref (window);
gst_object_unref (glimage_sink->context);
glimage_sink->context = NULL;
gst_object_unref (glimage_sink->display);
glimage_sink->display = NULL;
}
break;
}
case GST_STATE_CHANGE_READY_TO_NULL:
break;
default:
break;
}
return ret;
}
开发者ID:freedesktop-unofficial-mirror,项目名称:gstreamer__attic__gst-plugins-gl,代码行数:101,代码来源:gstglimagesink.c
注:本文中的GST_VIDEO_SINK_HEIGHT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论