[svn r814] Added x error handling to playbin maemo trunk
authorleo_sobral
Thu Aug 16 15:24:01 2007 +0100 (2007-08-16)
branchtrunk
changeset 808215c45290ce3
parent 807 add4025ca678
child 809 ec0a31edf362
[svn r814] Added x error handling to playbin maemo
gst-gmyth/playbinmaemo/gstplaybinmaemo.c
     1.1 --- a/gst-gmyth/playbinmaemo/gstplaybinmaemo.c	Thu Aug 16 14:46:11 2007 +0100
     1.2 +++ b/gst-gmyth/playbinmaemo/gstplaybinmaemo.c	Thu Aug 16 15:24:01 2007 +0100
     1.3 @@ -89,6 +89,8 @@
     1.4  static gboolean add_element                         (GstPlayBinMaemo *pbm,
     1.5                                                       GstElement *child);
     1.6  static void     clear_elements                      (GstPlayBinMaemo *pbm);
     1.7 +static int      x_error_handler                     (Display *display,
     1.8 +                                                     XErrorEvent *event);
     1.9  
    1.10  GST_BOILERPLATE(GstPlayBinMaemo, gst_play_bin_maemo, GstPipeline, GST_TYPE_PIPELINE)
    1.11  
    1.12 @@ -874,12 +876,12 @@
    1.13    if ((pbm->video_sink != NULL) &&
    1.14      (pbm->xid != -1) &&
    1.15      (GST_IS_X_OVERLAY (pbm->video_sink))) {
    1.16 -
    1.17      Display *display;
    1.18      g_object_set (G_OBJECT (pbm->video_sink),
    1.19                    "force-aspect-ratio", TRUE, NULL);
    1.20      display = XOpenDisplay(NULL);
    1.21      XMapRaised(display, pbm->xid);
    1.22 +    XSetErrorHandler(x_error_handler);
    1.23      XSync (display, FALSE);
    1.24  
    1.25      gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (pbm->video_sink),
    1.26 @@ -887,6 +889,28 @@
    1.27    }
    1.28  }
    1.29  
    1.30 +static int
    1.31 +x_error_handler(Display *display, XErrorEvent *event)
    1.32 +{
    1.33 +    g_debug ("In x error handler:");
    1.34 +
    1.35 +    switch (event->error_code) {
    1.36 +        case BadWindow:
    1.37 +            g_debug ("got bad window");
    1.38 +            break;
    1.39 +        case BadDrawable:
    1.40 +            g_debug ("got bad drawable");
    1.41 +            break;
    1.42 +        case BadGC:
    1.43 +            g_debug ("got bad gc");
    1.44 +            break;
    1.45 +        default:
    1.46 +            g_debug ("unhandled x error = %d", event->error_code);
    1.47 +    }
    1.48 +
    1.49 +    return 0;
    1.50 +}
    1.51 +
    1.52  static gboolean
    1.53  add_element (GstPlayBinMaemo *pbm,
    1.54               GstElement *child)