From cf60bb696eaf67c934af9f2424d95cc7d4d82285 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Fri, 7 Oct 2005 16:22:59 +0000 Subject: [PATCH] Post a message when the cable is unplugged. Original commit message from CVS: (gst_dv1394src_bus_reset): Post a message when the cable is unplugged. (gst_dv1394src_create, gst_dv1394src_unlock): Remove some prints. --- ChangeLog | 3 +++ ext/raw1394/gstdv1394src.c | 36 ++++++++++++++++++++++++------------ 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 62814192d7..825e3e2f8d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ * ext/raw1394/gstdv1394src.c: Make interruptible, so it won't block forever in a read(). + (gst_dv1394src_bus_reset): Post a message when the cable is + unplugged. + (gst_dv1394src_create, gst_dv1394src_unlock): Remove some prints. * ext/raw1394/gstdv1394src.c: Clean up for style before doing some hacking. The only change should be that the state change stuff was diff --git a/ext/raw1394/gstdv1394src.c b/ext/raw1394/gstdv1394src.c index c408357d20..8c1995deb3 100644 --- a/ext/raw1394/gstdv1394src.c +++ b/ext/raw1394/gstdv1394src.c @@ -73,13 +73,13 @@ enum LAST_SIGNAL }; -#define DEFAULT_PORT -1 -#define DEFAULT_CHANNEL 63 -#define DEFAULT_CONSECUTIVE 1 -#define DEFAULT_SKIP 0 -#define DEFAULT_DROP_INCOMPLETE TRUE -#define DEFAULT_USE_AVC TRUE -#define DEFAULT_GUID 0 +#define DEFAULT_PORT -1 +#define DEFAULT_CHANNEL 63 +#define DEFAULT_CONSECUTIVE 1 +#define DEFAULT_SKIP 0 +#define DEFAULT_DROP_INCOMPLETE TRUE +#define DEFAULT_USE_AVC TRUE +#define DEFAULT_GUID 0 enum { @@ -437,8 +437,23 @@ gst_dv1394src_iso_receive (raw1394handle_t handle, int channel, size_t len, static int gst_dv1394src_bus_reset (raw1394handle_t handle, unsigned int generation) { - GST_INFO_OBJECT (GST_DV1394SRC (raw1394_get_userdata (handle)), - "have bus reset"); + GstDV1394Src *src; + gint nodecount; + GstMessage *message; + GstStructure *structure; + + src = GST_DV1394SRC (raw1394_get_userdata (handle)); + + GST_INFO_OBJECT (src, "have bus reset"); + + nodecount = raw1394_get_nodecount (handle); + + structure = gst_structure_new ("ieee1394-bus-reset", "nodecount", G_TYPE_INT, + nodecount, NULL); + message = gst_message_new_element (GST_OBJECT (src), structure); + gst_element_post_message (GST_ELEMENT (src), message); + gst_message_unref (message); + return 0; } @@ -473,8 +488,6 @@ gst_dv1394src_create (GstPushSrc * psrc, GstBuffer ** buf) if (pollfds[1].revents) { char command; - g_print ("told to stop!\n"); - if (pollfds[1].revents & POLLIN) READ_COMMAND (dv1394src, command, res); @@ -694,7 +707,6 @@ gst_dv1394src_unlock (GstBaseSrc * bsrc) { GstDV1394Src *src = GST_DV1394SRC (bsrc); - g_print ("sending command!\n"); SEND_COMMAND (src, CONTROL_STOP); return TRUE;