mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
Merge remote-tracking branch 'origin/master' into 0.11
Conflicts: gst-libs/gst/audio/Makefile.am gst-libs/gst/audio/audio.h tests/examples/seek/jsseek.c tests/examples/seek/seek.c tests/icles/test-colorkey.c
This commit is contained in:
commit
4b0dce5148
7 changed files with 61 additions and 152 deletions
19
configure.ac
19
configure.ac
|
@ -276,24 +276,11 @@ AC_SUBST(GST_PREFIX)
|
|||
dnl GTK is optional and only used in examples
|
||||
HAVE_GTK=no
|
||||
HAVE_GTK_X11=no
|
||||
GTK2_REQ=2.14.0
|
||||
GTK3_REQ=2.91.3
|
||||
GTK_REQ=3.0.0
|
||||
if test "x$BUILD_EXAMPLES" = "xyes"; then
|
||||
AC_MSG_CHECKING([which gtk+ version to compile examples against (optional)])
|
||||
AC_ARG_WITH([gtk],
|
||||
AC_HELP_STRING([--with-gtk=3.0|2.0],
|
||||
[which gtk+ version to compile against (default: 2.0)]),
|
||||
[case "$with_gtk" in
|
||||
2.0) GTK_REQ=$GTK2_REQ ;;
|
||||
3.0) GTK_REQ=$GTK3_REQ ;;
|
||||
*) AC_MSG_ERROR([invalid gtk+ version specified]);;
|
||||
esac],
|
||||
[with_gtk=2.0
|
||||
GTK_REQ=$GTK2_REQ])
|
||||
AC_MSG_RESULT([$with_gtk (>= $GTK_REQ)])
|
||||
PKG_CHECK_MODULES(GTK, gtk+-$with_gtk >= $GTK_REQ, HAVE_GTK=yes, HAVE_GTK=no)
|
||||
PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQ, HAVE_GTK=yes, HAVE_GTK=no)
|
||||
dnl some examples need gtk+-x11
|
||||
PKG_CHECK_MODULES(GTK_X11, gtk+-x11-$with_gtk >= $GTK_REQ, HAVE_GTK_X11=yes, HAVE_GTK_X11=no)
|
||||
PKG_CHECK_MODULES(GTK_X11, gtk+-x11-3.0 >= $GTK_REQ, HAVE_GTK_X11=yes, HAVE_GTK_X11=no)
|
||||
AC_SUBST(GTK_LIBS)
|
||||
AC_SUBST(GTK_CFLAGS)
|
||||
fi
|
||||
|
|
|
@ -294,6 +294,8 @@ struct _GstAudioInfo {
|
|||
|
||||
GType gst_audio_info_get_type (void);
|
||||
|
||||
#define GST_AUDIO_INFO_IS_VALID(i) ((i)->finfo != NULL && (i)->rate > 0 && (i)->channels > 0 && (i)->bpf > 0)
|
||||
|
||||
#define GST_AUDIO_INFO_FORMAT(i) (GST_AUDIO_FORMAT_INFO_FORMAT((i)->finfo))
|
||||
#define GST_AUDIO_INFO_NAME(i) (GST_AUDIO_FORMAT_INFO_NAME((i)->finfo))
|
||||
#define GST_AUDIO_INFO_WIDTH(i) (GST_AUDIO_FORMAT_INFO_WIDTH((i)->finfo))
|
||||
|
|
|
@ -744,6 +744,9 @@ gst_audio_decoder_finish_frame (GstAudioDecoder * dec, GstBuffer * buf,
|
|||
ctx = &dec->priv->ctx;
|
||||
size = buf ? gst_buffer_get_size (buf) : 0;
|
||||
|
||||
/* must know the output format by now */
|
||||
g_return_val_if_fail (GST_AUDIO_INFO_IS_VALID (&ctx->info), GST_FLOW_ERROR);
|
||||
|
||||
GST_LOG_OBJECT (dec, "accepting %d bytes == %d samples for %d frames",
|
||||
buf ? size : -1, buf ? size / ctx->info.bpf : -1, frames);
|
||||
|
||||
|
|
|
@ -50,21 +50,6 @@
|
|||
GST_DEBUG_CATEGORY_STATIC (seek_debug);
|
||||
#define GST_CAT_DEFAULT (seek_debug)
|
||||
|
||||
#if (!GTK_CHECK_VERSION(2, 23, 0) || GTK_CHECK_VERSION(2, 90, 0)) && !GTK_CHECK_VERSION(2, 91, 1)
|
||||
#define gtk_combo_box_text_new gtk_combo_box_new_text
|
||||
#define gtk_combo_box_text_append_text gtk_combo_box_append_text
|
||||
#define gtk_combo_box_text_remove gtk_combo_box_remove_text
|
||||
#define GTK_COMBO_BOX_TEXT GTK_COMBO_BOX
|
||||
#endif
|
||||
|
||||
#if !GTK_CHECK_VERSION (2, 17, 7)
|
||||
static void
|
||||
gtk_widget_get_allocation (GtkWidget * w, GtkAllocation * a)
|
||||
{
|
||||
*a = w->allocation;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* configuration */
|
||||
#define SOURCE "filesrc"
|
||||
|
||||
|
@ -1565,6 +1550,7 @@ stop_cb (GtkButton * button, gpointer data)
|
|||
|
||||
state = STOP_STATE;
|
||||
gtk_statusbar_push (GTK_STATUSBAR (statusbar), status_id, "Stopped");
|
||||
gtk_widget_queue_draw (video_window);
|
||||
|
||||
is_live = FALSE;
|
||||
buffering = FALSE;
|
||||
|
@ -2473,19 +2459,17 @@ bus_sync_handler (GstBus * bus, GstMessage * message, GstPipeline * data)
|
|||
#endif
|
||||
|
||||
static gboolean
|
||||
handle_expose_cb (GtkWidget * widget, GdkEventExpose * event, gpointer data)
|
||||
draw_cb (GtkWidget * widget, cairo_t * cr, gpointer data)
|
||||
{
|
||||
if (state < GST_STATE_PAUSED) {
|
||||
GtkAllocation allocation;
|
||||
GdkWindow *window = gtk_widget_get_window (widget);
|
||||
cairo_t *cr;
|
||||
int width, height;
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
cr = gdk_cairo_create (window);
|
||||
width = gtk_widget_get_allocated_width (widget);
|
||||
height = gtk_widget_get_allocated_height (widget);
|
||||
cairo_set_source_rgb (cr, 0, 0, 0);
|
||||
cairo_rectangle (cr, 0, 0, allocation.width, allocation.height);
|
||||
cairo_rectangle (cr, 0, 0, width, height);
|
||||
cairo_fill (cr);
|
||||
cairo_destroy (cr);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -2493,24 +2477,16 @@ handle_expose_cb (GtkWidget * widget, GdkEventExpose * event, gpointer data)
|
|||
static void
|
||||
realize_cb (GtkWidget * widget, gpointer data)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2,18,0)
|
||||
{
|
||||
GdkWindow *window = gtk_widget_get_window (widget);
|
||||
GdkWindow *window = gtk_widget_get_window (widget);
|
||||
|
||||
/* This is here just for pedagogical purposes, GDK_WINDOW_XID will call it
|
||||
* as well */
|
||||
if (!gdk_window_ensure_native (window))
|
||||
g_error ("Couldn't create native window needed for GstVideoOverlay!");
|
||||
}
|
||||
#endif
|
||||
/* This is here just for pedagogical purposes, GDK_WINDOW_XID will call it
|
||||
* as well */
|
||||
if (!gdk_window_ensure_native (window))
|
||||
g_error ("Couldn't create native window needed for GstXOverlay!");
|
||||
|
||||
#ifdef HAVE_X
|
||||
{
|
||||
GdkWindow *window = gtk_widget_get_window (video_window);
|
||||
|
||||
embed_xid = GDK_WINDOW_XID (window);
|
||||
g_print ("Window realize: video window XID = %lu\n", embed_xid);
|
||||
}
|
||||
embed_xid = GDK_WINDOW_XID (window);
|
||||
g_print ("Window realize: video window XID = %lu\n", embed_xid);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -2758,8 +2734,7 @@ main (int argc, char **argv)
|
|||
/* initialize gui elements ... */
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
video_window = gtk_drawing_area_new ();
|
||||
g_signal_connect (video_window, "expose-event",
|
||||
G_CALLBACK (handle_expose_cb), NULL);
|
||||
g_signal_connect (video_window, "draw", G_CALLBACK (draw_cb), NULL);
|
||||
g_signal_connect (video_window, "realize", G_CALLBACK (realize_cb), NULL);
|
||||
gtk_widget_set_double_buffered (video_window, FALSE);
|
||||
|
||||
|
|
|
@ -41,24 +41,9 @@
|
|||
|
||||
#include <gst/interfaces/videooverlay.h>
|
||||
|
||||
#if (!GTK_CHECK_VERSION(2, 23, 0) || GTK_CHECK_VERSION(2, 90, 0)) && !GTK_CHECK_VERSION(2, 91, 1)
|
||||
#define gtk_combo_box_text_new gtk_combo_box_new_text
|
||||
#define gtk_combo_box_text_append_text gtk_combo_box_append_text
|
||||
#define gtk_combo_box_text_remove gtk_combo_box_remove_text
|
||||
#define GTK_COMBO_BOX_TEXT GTK_COMBO_BOX
|
||||
#endif
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (seek_debug);
|
||||
#define GST_CAT_DEFAULT (seek_debug)
|
||||
|
||||
#if !GTK_CHECK_VERSION (2, 17, 7)
|
||||
static void
|
||||
gtk_widget_get_allocation (GtkWidget * w, GtkAllocation * a)
|
||||
{
|
||||
*a = w->allocation;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* configuration */
|
||||
|
||||
#define SOURCE "filesrc"
|
||||
|
@ -714,6 +699,7 @@ stop_cb (GtkButton * button, gpointer data)
|
|||
|
||||
state = STOP_STATE;
|
||||
gtk_statusbar_push (GTK_STATUSBAR (statusbar), status_id, "Stopped");
|
||||
gtk_widget_queue_draw (video_window);
|
||||
|
||||
is_live = FALSE;
|
||||
buffering = FALSE;
|
||||
|
@ -1646,19 +1632,17 @@ bus_sync_handler (GstBus * bus, GstMessage * message, GstPipeline * data)
|
|||
#endif
|
||||
|
||||
static gboolean
|
||||
handle_expose_cb (GtkWidget * widget, GdkEventExpose * event, gpointer data)
|
||||
draw_cb (GtkWidget * widget, cairo_t * cr, gpointer data)
|
||||
{
|
||||
if (state < GST_STATE_PAUSED) {
|
||||
GtkAllocation allocation;
|
||||
GdkWindow *window = gtk_widget_get_window (widget);
|
||||
cairo_t *cr;
|
||||
int width, height;
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
cr = gdk_cairo_create (window);
|
||||
width = gtk_widget_get_allocated_width (widget);
|
||||
height = gtk_widget_get_allocated_height (widget);
|
||||
cairo_set_source_rgb (cr, 0, 0, 0);
|
||||
cairo_rectangle (cr, 0, 0, allocation.width, allocation.height);
|
||||
cairo_rectangle (cr, 0, 0, width, height);
|
||||
cairo_fill (cr);
|
||||
cairo_destroy (cr);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1666,28 +1650,19 @@ handle_expose_cb (GtkWidget * widget, GdkEventExpose * event, gpointer data)
|
|||
static void
|
||||
realize_cb (GtkWidget * widget, gpointer data)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2,18,0)
|
||||
{
|
||||
GdkWindow *window = gtk_widget_get_window (widget);
|
||||
GdkWindow *window = gtk_widget_get_window (widget);
|
||||
|
||||
/* This is here just for pedagogical purposes, GDK_WINDOW_XID will call it
|
||||
* as well */
|
||||
if (!gdk_window_ensure_native (window))
|
||||
g_error ("Couldn't create native window needed for GstVideoOverlay!");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (GDK_WINDOWING_X11) || defined (GDK_WINDOWING_WIN32)
|
||||
{
|
||||
GdkWindow *window = gtk_widget_get_window (video_window);
|
||||
/* This is here just for pedagogical purposes, GDK_WINDOW_XID will call it
|
||||
* as well */
|
||||
if (!gdk_window_ensure_native (window))
|
||||
g_error ("Couldn't create native window needed for GstXOverlay!");
|
||||
|
||||
#if defined (GDK_WINDOWING_WIN32)
|
||||
embed_xid = GDK_WINDOW_HWND (window);
|
||||
embed_xid = GDK_WINDOW_HWND (window);
|
||||
g_print ("Window realize: video window HWND = %lu\n", embed_xid);
|
||||
#else
|
||||
embed_xid = GDK_WINDOW_XID (window);
|
||||
#endif
|
||||
g_print ("Window realize: video window XID = %lu\n", embed_xid);
|
||||
}
|
||||
embed_xid = GDK_WINDOW_XID (window);
|
||||
g_print ("Window realize: video window XID = %lu\n", embed_xid);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1895,8 +1870,7 @@ main (int argc, char **argv)
|
|||
/* initialize gui elements ... */
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
video_window = gtk_drawing_area_new ();
|
||||
g_signal_connect (video_window, "expose-event",
|
||||
G_CALLBACK (handle_expose_cb), NULL);
|
||||
g_signal_connect (video_window, "draw", G_CALLBACK (draw_cb), NULL);
|
||||
g_signal_connect (video_window, "realize", G_CALLBACK (realize_cb), NULL);
|
||||
gtk_widget_set_double_buffered (video_window, FALSE);
|
||||
|
||||
|
|
|
@ -34,14 +34,6 @@
|
|||
#include <gst/interfaces/videooverlay.h>
|
||||
#include <gst/interfaces/propertyprobe.h>
|
||||
|
||||
#if !GTK_CHECK_VERSION (2, 17, 7)
|
||||
static void
|
||||
gtk_widget_get_allocation (GtkWidget * w, GtkAllocation * a)
|
||||
{
|
||||
*a = w->allocation;
|
||||
}
|
||||
#endif
|
||||
|
||||
static GtkWidget *video_window = NULL;
|
||||
static GstElement *sink = NULL;
|
||||
static gulong embed_xid = 0;
|
||||
|
@ -89,7 +81,7 @@ handle_resize_cb (GtkWidget * widget, GdkEventConfigure * event, gpointer data)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
handle_expose_cb (GtkWidget * widget, GdkEventExpose * event, gpointer data)
|
||||
draw_cb (GtkWidget * widget, cairo_t * cr, gpointer data)
|
||||
{
|
||||
redraw_overlay (widget);
|
||||
return FALSE;
|
||||
|
@ -98,23 +90,15 @@ handle_expose_cb (GtkWidget * widget, GdkEventExpose * event, gpointer data)
|
|||
static void
|
||||
realize_cb (GtkWidget * widget, gpointer data)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(2,18,0)
|
||||
{
|
||||
GdkWindow *window = gtk_widget_get_window (widget);
|
||||
GdkWindow *window = gtk_widget_get_window (widget);
|
||||
|
||||
/* This is here just for pedagogical purposes, GDK_WINDOW_XID will call it
|
||||
* as well */
|
||||
if (!gdk_window_ensure_native (window))
|
||||
g_error ("Couldn't create native window needed for GstVideoOverlay!");
|
||||
}
|
||||
#endif
|
||||
/* This is here just for pedagogical purposes, GDK_WINDOW_XID will call it
|
||||
* as well */
|
||||
if (!gdk_window_ensure_native (window))
|
||||
g_error ("Couldn't create native window needed for GstXOverlay!");
|
||||
|
||||
{
|
||||
GdkWindow *window = gtk_widget_get_window (video_window);
|
||||
|
||||
embed_xid = GDK_WINDOW_XID (window);
|
||||
g_print ("Window realize: video window XID = %lu\n", embed_xid);
|
||||
}
|
||||
embed_xid = GDK_WINDOW_XID (window);
|
||||
g_print ("Window realize: video window XID = %lu\n", embed_xid);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -251,8 +235,8 @@ main (int argc, char **argv)
|
|||
video_window = gtk_drawing_area_new ();
|
||||
g_signal_connect (G_OBJECT (video_window), "configure-event",
|
||||
G_CALLBACK (handle_resize_cb), NULL);
|
||||
g_signal_connect (G_OBJECT (video_window), "expose-event",
|
||||
G_CALLBACK (handle_expose_cb), NULL);
|
||||
g_signal_connect (G_OBJECT (video_window), "draw",
|
||||
G_CALLBACK (draw_cb), NULL);
|
||||
g_signal_connect (video_window, "realize", G_CALLBACK (realize_cb), NULL);
|
||||
gtk_widget_set_double_buffered (video_window, FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (window), video_window);
|
||||
|
|
|
@ -35,14 +35,6 @@
|
|||
#include <gst/interfaces/videooverlay.h>
|
||||
#include <gst/video/gstvideosink.h>
|
||||
|
||||
#if !GTK_CHECK_VERSION (2, 17, 7)
|
||||
static void
|
||||
gtk_widget_get_allocation (GtkWidget * w, GtkAllocation * a)
|
||||
{
|
||||
*a = w->allocation;
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct
|
||||
{
|
||||
gint w, h;
|
||||
|
@ -99,37 +91,30 @@ handle_resize_cb (GtkWidget * widget, GdkEventConfigure * event,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
handle_expose_cb (GtkWidget * widget, GdkEventExpose * event,
|
||||
gpointer user_data)
|
||||
handle_draw_cb (GtkWidget * widget, cairo_t * cr, gpointer user_data)
|
||||
{
|
||||
GstVideoRectangle *r = &anim_state.rect;
|
||||
GtkAllocation allocation;
|
||||
GdkWindow *window;
|
||||
GtkStyle *style;
|
||||
cairo_t *cr;
|
||||
int width, height;
|
||||
|
||||
width = gtk_widget_get_allocated_width (widget);
|
||||
height = gtk_widget_get_allocated_height (widget);
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
window = gtk_widget_get_window (widget);
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
cr = gdk_cairo_create (window);
|
||||
|
||||
gdk_cairo_set_source_color (cr, &style->bg[GTK_STATE_NORMAL]);
|
||||
|
||||
/* we should only redraw outside of the video rect! */
|
||||
cairo_rectangle (cr, 0, event->area.y, r->x, event->area.height);
|
||||
cairo_rectangle (cr, r->x + r->w, event->area.y,
|
||||
allocation.width - (r->x + r->w), event->area.height);
|
||||
cairo_rectangle (cr, 0, 0, r->x, height);
|
||||
cairo_rectangle (cr, r->x + r->w, 0, width - (r->x + r->w), height);
|
||||
|
||||
cairo_rectangle (cr, event->area.x, 0, event->area.width, r->y);
|
||||
cairo_rectangle (cr, event->area.x, r->y + r->h,
|
||||
event->area.width, allocation.height - (r->y + r->h));
|
||||
cairo_rectangle (cr, 0, 0, width, r->y);
|
||||
cairo_rectangle (cr, 0, r->y + r->h, width, height - (r->y + r->h));
|
||||
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
|
||||
if (verbose) {
|
||||
g_print ("expose(%p)\n", widget);
|
||||
g_print ("draw(%p)\n", widget);
|
||||
}
|
||||
gst_video_overlay_expose (anim_state.overlay);
|
||||
return FALSE;
|
||||
|
@ -229,8 +214,7 @@ main (gint argc, gchar ** argv)
|
|||
handle_resize_cb (video_window, NULL, sink);
|
||||
g_signal_connect (video_window, "configure-event",
|
||||
G_CALLBACK (handle_resize_cb), NULL);
|
||||
g_signal_connect (video_window, "expose-event",
|
||||
G_CALLBACK (handle_expose_cb), NULL);
|
||||
g_signal_connect (video_window, "draw", G_CALLBACK (handle_draw_cb), NULL);
|
||||
|
||||
g_timeout_add (50, (GSourceFunc) animate_render_rect, NULL);
|
||||
|
||||
|
|
Loading…
Reference in a new issue