sys/dvb/gstdvbsrc.c: Post bus message about adapter type and it's capabilities, when...
authorZaheer Abbas Merali <zaheerabbas@merali.org>
Fri, 25 Jan 2008 12:48:40 +0000 (12:48 +0000)
committerZaheer Abbas Merali <zaheerabbas@merali.org>
Fri, 25 Jan 2008 12:48:40 +0000 (12:48 +0000)
Original commit message from CVS:
* sys/dvb/gstdvbsrc.c:
Post bus message about adapter type and it's capabilities,
when opening the frontend.
After failing to read from the dvr, post a bus message to
inform the app.

ChangeLog
sys/dvb/gstdvbsrc.c

index e5a1427e15ea59d88cf7e3a7581b8bf4e40d1daf..28ce804b7eded9c051726c77620f3b71c44c1331 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-01-25  Zaheer Abbas Merali  <zaheerabbas at merali dot org>
+
+       * sys/dvb/gstdvbsrc.c:
+       Post bus message about adapter type and it's capabilities,
+       when opening the frontend.
+       After failing to read from the dvr, post a bus message to
+       inform the app.
+
 2008-01-25  Zaheer Abbas Merali  <zaheerabbas at merali dot org>
 
        * gst/mpegtsparse/mpegtspacketizer.c:
index 003e229979cba09d2144c5a284aef1b9077ece77..032cbd2b181b5be754dbc444df2962549c2d8af6 100644 (file)
@@ -679,12 +679,14 @@ gst_dvbsrc_close_devices (GstDvbSrc * object)
   return TRUE;
 }
 
+/* TODO: should open the frontend at NULL to READY to inform app the caps */
 static gboolean
 gst_dvbsrc_open_frontend (GstDvbSrc * object)
 {
   struct dvb_frontend_info fe_info;
   char *adapter_desc = NULL;
   gchar *frontend_dev;
+  GstStructure *adapter_structure;
 
   frontend_dev = g_strdup_printf ("/dev/dvb/adapter%d/frontend%d",
       object->adapter_number, object->frontend_number);
@@ -723,21 +725,41 @@ gst_dvbsrc_open_frontend (GstDvbSrc * object)
   switch (object->adapter_type) {
     case FE_QPSK:
       adapter_desc = "DVB-S";
+      adapter_structure = gst_structure_new ("dvb-adapter",
+          "type", G_TYPE_STRING, adapter_desc,
+          "auto-fec", G_TYPE_BOOLEAN, fe_info.caps & FE_CAN_FEC_AUTO, NULL);
       break;
     case FE_QAM:
       adapter_desc = "DVB-C";
+      adapter_structure = gst_structure_new ("dvb-adapter",
+          "type", G_TYPE_STRING, adapter_desc,
+          "auto-inversion", G_TYPE_BOOLEAN,
+          fe_info.caps & FE_CAN_INVERSION_AUTO, "auto-qam", G_TYPE_BOOLEAN,
+          fe_info.caps & FE_CAN_QAM_AUTO, "auto-fec", G_TYPE_BOOLEAN,
+          fe_info.caps & FE_CAN_FEC_AUTO, NULL);
       break;
     case FE_OFDM:
       adapter_desc = "DVB-T";
+      adapter_structure = gst_structure_new ("dvb-adapter",
+          "type", G_TYPE_STRING, adapter_desc,
+          "auto-inversion", G_TYPE_BOOLEAN,
+          fe_info.caps & FE_CAN_INVERSION_AUTO, "auto-qam", G_TYPE_BOOLEAN,
+          fe_info.caps & FE_CAN_QAM_AUTO, "auto-transmission-mode",
+          G_TYPE_BOOLEAN, fe_info.caps & FE_CAN_TRANSMISSION_MODE_AUTO,
+          "auto-guard-interval", G_TYPE_BOOLEAN,
+          fe_info.caps & FE_CAN_GUARD_INTERVAL_AUTO, "auto-hierarchy",
+          G_TYPE_BOOLEAN, fe_info.caps % FE_CAN_HIERARCHY_AUTO, "auto-fec",
+          G_TYPE_BOOLEAN, fe_info.caps & FE_CAN_FEC_AUTO, NULL);
       break;
     default:
       g_error ("Unknown frontend type: %d", object->adapter_type);
+      adapter_structure = gst_structure_new ("dvb-adapter",
+          "type", G_TYPE_STRING, "unknown", NULL);
   }
 
-  /*g_signal_emit (G_OBJECT (object), gst_dvbsrc_signals[ADAPTER_TYPE_SIGNAL],
-     0, object->adapter_type); */
-
   GST_INFO_OBJECT (object, "DVB card: %s ", fe_info.name);
+  gst_element_post_message (GST_ELEMENT_CAST (object), gst_message_new_element
+      (GST_OBJECT (object), adapter_structure));
   g_free (frontend_dev);
   return TRUE;
 }
@@ -923,6 +945,9 @@ gst_dvbsrc_create (GstPushSrc * element, GstBuffer ** buf)
       gst_caps_unref (caps);
     } else {
       GST_DEBUG_OBJECT (object, "Failed to read from device");
+      gst_element_post_message (GST_ELEMENT_CAST (object),
+          gst_message_new_element (GST_OBJECT (object),
+              gst_structure_empty_new ("dvb-read-failure")));
     }
 
     if (object->stats_interval != 0 &&