diff options
author | Alessandro Decina <alessandro@nnva.org> | 2007-11-23 17:53:37 +0000 |
---|---|---|
committer | Zaheer Abbas Merali <zaheerabbas@merali.org> | 2007-11-23 17:53:37 +0000 |
commit | 50841996be64a7b4697d3e30a45ca68db459762e (patch) | |
tree | 6a3b09a46b1cbe30ac009743bb50799077502871 /sys/dvb | |
parent | 1cb35c75741314f40f098250108b1b0e7db643cc (diff) | |
download | gst-plugins-bad-50841996be64a7b4697d3e30a45ca68db459762e.tar.gz gst-plugins-bad-50841996be64a7b4697d3e30a45ca68db459762e.tar.bz2 gst-plugins-bad-50841996be64a7b4697d3e30a45ca68db459762e.zip |
gst/mpegtsparse/: pat-info is now a signal not a GObject property that gets notified.
Original commit message from CVS:
patch by: Alessandro Decina
* gst/mpegtsparse/mpegtspacketizer.c:
* gst/mpegtsparse/mpegtspacketizer.h:
* gst/mpegtsparse/mpegtsparse.c:
* gst/mpegtsparse/mpegtsparse.h:
pat-info is now a signal not a GObject property that
gets notified.
pat-info, pmt-info now instead of passing a GObject as
a parameter, pass a GstStructure.
New signals: nit-info, sdt-info, eit-info for DVB SI information
* sys/dvb/camconditionalaccess.c:
* sys/dvb/camconditionalaccess.h:
* sys/dvb/camdevice.c:
* sys/dvb/camdevice.h:
* sys/dvb/camswclient.c:
* sys/dvb/camswclient.h:
* sys/dvb/camutils.c:
* sys/dvb/camutils.h:
Cam code now uses the pmt GstStructure passed from mpegtsparse
signals rather than the GObject.
* sys/dvb/dvbbasebin.c:
Use new signals in mpegtsparse and use GstStructures as per
mpegtsparse's modified API.
Diffstat (limited to 'sys/dvb')
-rw-r--r-- | sys/dvb/camconditionalaccess.c | 4 | ||||
-rw-r--r-- | sys/dvb/camconditionalaccess.h | 2 | ||||
-rw-r--r-- | sys/dvb/camdevice.c | 2 | ||||
-rw-r--r-- | sys/dvb/camdevice.h | 2 | ||||
-rw-r--r-- | sys/dvb/camswclient.c | 6 | ||||
-rw-r--r-- | sys/dvb/camswclient.h | 4 | ||||
-rw-r--r-- | sys/dvb/camutils.c | 68 | ||||
-rw-r--r-- | sys/dvb/camutils.h | 2 | ||||
-rw-r--r-- | sys/dvb/dvbbasebin.c | 102 |
9 files changed, 85 insertions, 107 deletions
diff --git a/sys/dvb/camconditionalaccess.c b/sys/dvb/camconditionalaccess.c index 985ce293..c667b97e 100644 --- a/sys/dvb/camconditionalaccess.c +++ b/sys/dvb/camconditionalaccess.c @@ -69,7 +69,7 @@ cam_conditional_access_destroy (CamConditionalAccess * cas) } static CamReturn -send_ca_pmt (CamConditionalAccess * cas, GObject * pmt, +send_ca_pmt (CamConditionalAccess * cas, GstStructure * pmt, guint8 list_management, guint8 cmd_id) { CamReturn ret; @@ -107,7 +107,7 @@ send_ca_pmt (CamConditionalAccess * cas, GObject * pmt, CamReturn cam_conditional_access_set_pmt (CamConditionalAccess * cas, - GObject * pmt, CamConditionalAccessPmtFlag flag) + GstStructure * pmt, CamConditionalAccessPmtFlag flag) { return send_ca_pmt (cas, pmt, flag, 0x01 /* ok_descrambling */ ); } diff --git a/sys/dvb/camconditionalaccess.h b/sys/dvb/camconditionalaccess.h index 82c54d17..43334c50 100644 --- a/sys/dvb/camconditionalaccess.h +++ b/sys/dvb/camconditionalaccess.h @@ -50,6 +50,6 @@ CamConditionalAccess *cam_conditional_access_new (); void cam_conditional_access_destroy (CamConditionalAccess *cas); CamReturn cam_conditional_access_set_pmt (CamConditionalAccess *cas, - GObject *pmt, CamConditionalAccessPmtFlag flag); + GstStructure *pmt, CamConditionalAccessPmtFlag flag); #endif /* CAM_CONDITIONAL_ACCESS_H */ diff --git a/sys/dvb/camdevice.c b/sys/dvb/camdevice.c index 174edca4..f72f47ca 100644 --- a/sys/dvb/camdevice.c +++ b/sys/dvb/camdevice.c @@ -202,7 +202,7 @@ cam_device_ready (CamDevice * device) void cam_device_set_pmt (CamDevice * device, - GObject * pmt, CamConditionalAccessPmtFlag flag) + GstStructure * pmt, CamConditionalAccessPmtFlag flag) { g_return_if_fail (device != NULL); g_return_if_fail (device->state == CAM_DEVICE_STATE_OPEN); diff --git a/sys/dvb/camdevice.h b/sys/dvb/camdevice.h index 2dbc79df..b1fe1186 100644 --- a/sys/dvb/camdevice.h +++ b/sys/dvb/camdevice.h @@ -64,6 +64,6 @@ void cam_device_close (CamDevice *device); gboolean cam_device_ready (CamDevice *device); void cam_device_poll (CamDevice *device); void cam_device_set_pmt (CamDevice *device, - GObject *pmt, CamConditionalAccessPmtFlag flag); + GstStructure *pmt, CamConditionalAccessPmtFlag flag); #endif /* CAM_DEVICE_H */ diff --git a/sys/dvb/camswclient.c b/sys/dvb/camswclient.c index b0747a15..d9d0af2c 100644 --- a/sys/dvb/camswclient.c +++ b/sys/dvb/camswclient.c @@ -109,7 +109,7 @@ cam_sw_client_close (CamSwClient * client) } static void -send_ca_pmt (CamSwClient * client, GObject * pmt, +send_ca_pmt (CamSwClient * client, GstStructure * pmt, guint8 list_management, guint8 cmd_id) { guint8 *buffer; @@ -144,7 +144,7 @@ send_ca_pmt (CamSwClient * client, GObject * pmt, } void -cam_sw_client_set_pmt (CamSwClient * client, GObject * pmt) +cam_sw_client_set_pmt (CamSwClient * client, GstStructure * pmt) { g_return_if_fail (client != NULL); g_return_if_fail (pmt != NULL); @@ -154,7 +154,7 @@ cam_sw_client_set_pmt (CamSwClient * client, GObject * pmt) } void -cam_sw_client_update_pmt (CamSwClient * client, GObject * pmt) +cam_sw_client_update_pmt (CamSwClient * client, GstStructure * pmt) { g_return_if_fail (client != NULL); g_return_if_fail (pmt != NULL); diff --git a/sys/dvb/camswclient.h b/sys/dvb/camswclient.h index 5471e96a..5b1a4a25 100644 --- a/sys/dvb/camswclient.h +++ b/sys/dvb/camswclient.h @@ -47,7 +47,7 @@ void cam_sw_client_free (CamSwClient *sw_client); gboolean cam_sw_client_open (CamSwClient *sw_client, const char *sock_path); void cam_sw_client_close (CamSwClient *sw_client); -void cam_sw_client_set_pmt (CamSwClient *sw_client, GObject *pmt); -void cam_sw_client_update_pmt (CamSwClient *sw_client, GObject *pmt); +void cam_sw_client_set_pmt (CamSwClient *sw_client, GstStructure *pmt); +void cam_sw_client_update_pmt (CamSwClient *sw_client, GstStructure *pmt); #endif /* CAM_SW_CLIENT_H */ diff --git a/sys/dvb/camutils.c b/sys/dvb/camutils.c index 7ca621b4..f52412d7 100644 --- a/sys/dvb/camutils.c +++ b/sys/dvb/camutils.c @@ -210,7 +210,7 @@ write_ca_descriptors (guint8 * body, GValueArray * descriptors) } guint8 * -cam_build_ca_pmt (GObject * pmt, guint8 list_management, guint8 cmd_id, +cam_build_ca_pmt (GstStructure * pmt, guint8 list_management, guint8 cmd_id, guint * size) { guint body_size = 0; @@ -218,20 +218,20 @@ cam_build_ca_pmt (GObject * pmt, guint8 list_management, guint8 cmd_id, guint8 *body; GList *lengths = NULL; guint len = 0; - GValueArray *streams = NULL; - gint program_number; + const GValue *streams; + guint program_number; guint version_number; guint i; - GValue *value; - GObject *stream; + const GValue *value; + GstStructure *stream; GValueArray *program_descriptors = NULL; GValueArray *stream_descriptors = NULL; - g_object_get (pmt, - "program-number", &program_number, - "version-number", &version_number, - "stream-info", &streams, "descriptors", &program_descriptors, NULL); - + gst_structure_get_uint (pmt, "program-number", &program_number); + gst_structure_get_uint (pmt, "version-number", &version_number); + streams = gst_structure_get_value (pmt, "streams"); + value = gst_structure_get_value (pmt, "descriptors"); + program_descriptors = g_value_get_boxed (value); /* get the length of program level CA_descriptor()s */ len = get_ca_descriptors_length (program_descriptors); if (len > 0) @@ -243,11 +243,12 @@ cam_build_ca_pmt (GObject * pmt, guint8 list_management, guint8 cmd_id, /* get the length of stream level CA_descriptor()s */ if (streams != NULL) { - for (i = 0; i < streams->n_values; ++i) { - value = g_value_array_get_nth (streams, i); - stream = g_value_get_object (value); + for (i = 0; i < gst_value_list_get_size (streams); ++i) { + value = gst_value_list_get_value (streams, i); + stream = g_value_get_boxed (value); - g_object_get (stream, "descriptors", &stream_descriptors, NULL); + value = gst_structure_get_value (stream, "descriptors"); + stream_descriptors = g_value_get_boxed (value); len = get_ca_descriptors_length (stream_descriptors); if (len > 0) @@ -257,30 +258,12 @@ cam_build_ca_pmt (GObject * pmt, guint8 list_management, guint8 cmd_id, lengths = g_list_append (lengths, GINT_TO_POINTER (len)); body_size += 5 + len; - if (stream_descriptors) { - g_value_array_free (stream_descriptors); - stream_descriptors = NULL; - } } } buffer = g_malloc0 (body_size); body = buffer; - /* - guint length_field_len = cam_calc_length_field_size (body_size); - guint apdu_header_length = 3 + length_field_len; - guint8 *apdu = (buffer + buffer_size) - body_size - apdu_header_length; - apdu [0] = 0x9F; - apdu [1] = 0x80; - apdu [2] = 0x32; - - g_print ("LEN %d %d", length_field_len, body_size); - - cam_write_length_field (&apdu [3], body_size); - body += 4; - */ - *body++ = list_management; GST_WRITE_UINT16_BE (body, program_number); @@ -302,16 +285,17 @@ cam_build_ca_pmt (GObject * pmt, guint8 list_management, guint8 cmd_id, if (program_descriptors) g_value_array_free (program_descriptors); - for (i = 0; i < streams->n_values; ++i) { + for (i = 0; i < gst_value_list_get_size (streams); ++i) { guint stream_type; guint stream_pid; - value = g_value_array_get_nth (streams, i); - stream = g_value_get_object (value); + value = gst_value_list_get_value (streams, i); + stream = g_value_get_boxed (value); - g_object_get (stream, - "stream-type", &stream_type, - "pid", &stream_pid, "descriptors", &stream_descriptors, NULL); + gst_structure_get_uint (stream, "stream-type", &stream_type); + gst_structure_get_uint (stream, "pid", &stream_pid); + value = gst_structure_get_value (stream, "descriptors"); + stream_descriptors = g_value_get_boxed (value); *body++ = stream_type; GST_WRITE_UINT16_BE (body, stream_pid); @@ -325,16 +309,8 @@ cam_build_ca_pmt (GObject * pmt, guint8 list_management, guint8 cmd_id, *body++ = cmd_id; body = write_ca_descriptors (body, stream_descriptors); } - - if (stream_descriptors) { - g_value_array_free (stream_descriptors); - stream_descriptors = NULL; - } } - if (streams) - g_value_array_free (streams); - *size = body_size; return buffer; } diff --git a/sys/dvb/camutils.h b/sys/dvb/camutils.h index c63ba947..f2d485ee 100644 --- a/sys/dvb/camutils.h +++ b/sys/dvb/camutils.h @@ -54,6 +54,6 @@ typedef enum guint8 cam_calc_length_field_size (guint length); guint8 cam_write_length_field (guint8 *buff, guint length); guint8 cam_read_length_field (guint8 *buff, guint *length); -guint8 *cam_build_ca_pmt (GObject *pmt, guint8 list_management, guint8 cmd_id, guint *size); +guint8 *cam_build_ca_pmt (GstStructure *pmt, guint8 list_management, guint8 cmd_id, guint *size); #endif /* CAM_UTILS_H */ diff --git a/sys/dvb/dvbbasebin.c b/sys/dvb/dvbbasebin.c index c812064a..7851e49e 100644 --- a/sys/dvb/dvbbasebin.c +++ b/sys/dvb/dvbbasebin.c @@ -88,8 +88,8 @@ typedef struct gint program_number; guint16 pmt_pid; guint16 pcr_pid; - GObject *pmt; - GObject *old_pmt; + GstStructure *pmt; + GstStructure *old_pmt; gboolean selected; gboolean pmt_active; gboolean active; @@ -107,10 +107,10 @@ static gboolean dvb_base_bin_ts_pad_probe_cb (GstPad * pad, GstBuffer * buf, gpointer user_data); static GstStateChangeReturn dvb_base_bin_change_state (GstElement * element, GstStateChange transition); -static void dvb_base_bin_pat_info_changed_cb (GstElement * mpegtsparse, - GParamSpec * pspec, DvbBaseBin * dvbbasebin); +static void dvb_base_bin_pat_info_cb (GstElement * mpegtsparse, + GstStructure * pat, DvbBaseBin * dvbbasebin); static void dvb_base_bin_pmt_info_cb (GstElement * mpegtsparse, - guint program_number, GObject * pmt, DvbBaseBin * dvbbasebin); + GstStructure * pmt, DvbBaseBin * dvbbasebin); static void dvb_base_bin_pad_added_cb (GstElement * mpegtsparse, GstPad * pad, DvbBaseBin * dvbbasebin); static void dvb_base_bin_pad_removed_cb (GstElement * mpegtsparse, @@ -310,7 +310,7 @@ dvb_base_bin_init (DvbBaseBin * dvbbasebin, DvbBaseBinClass * klass) dvbbasebin->buffer_queue = gst_element_factory_make ("queue", NULL); dvbbasebin->mpegtsparse = gst_element_factory_make ("mpegtsparse", NULL); g_object_connect (dvbbasebin->mpegtsparse, - "signal::notify::pat-info", dvb_base_bin_pat_info_changed_cb, dvbbasebin, + "signal::pat-info", dvb_base_bin_pat_info_cb, dvbbasebin, "signal::pmt-info", dvb_base_bin_pmt_info_cb, dvbbasebin, "signal::pad-added", dvb_base_bin_pad_added_cb, dvbbasebin, "signal::pad-removed", dvb_base_bin_pad_removed_cb, dvbbasebin, NULL); @@ -478,7 +478,7 @@ dvb_base_bin_reset_pmtlist (DvbBaseBin * dvbbasebin) { CamConditionalAccessPmtFlag flag; GList *walk; - GObject *pmt; + GstStructure *pmt; walk = dvbbasebin->pmtlist; while (walk) { @@ -494,7 +494,7 @@ dvb_base_bin_reset_pmtlist (DvbBaseBin * dvbbasebin) flag = CAM_CONDITIONAL_ACCESS_PMT_FLAG_MORE; } - pmt = G_OBJECT (walk->data); + pmt = GST_STRUCTURE (walk->data); cam_device_set_pmt (dvbbasebin->hwcam, pmt, flag); walk = walk->next; @@ -615,25 +615,26 @@ dvb_base_bin_rebuild_filter (DvbBaseBin * dvbbasebin) } static void -dvb_base_bin_remove_pmt_streams (DvbBaseBin * dvbbasebin, GObject * pmt) +dvb_base_bin_remove_pmt_streams (DvbBaseBin * dvbbasebin, GstStructure * pmt) { - GValueArray *streams; - gint program_number; + const GValue *streams; + guint program_number; gint i; - GValue *value; - GObject *streamobj; + const GValue *value; + GstStructure *stream_info; DvbBaseBinStream *stream; guint pid; guint stream_type; - g_object_get (pmt, "program-number", &program_number, - "stream-info", &streams, NULL); + gst_structure_get_uint (pmt, "program-number", &program_number); + streams = gst_structure_get_value (pmt, "streams"); - for (i = 0; i < streams->n_values; ++i) { - value = g_value_array_get_nth (streams, i); - streamobj = g_value_get_object (value); + for (i = 0; i < gst_value_list_get_size (streams); ++i) { + value = gst_value_list_get_value (streams, i); + stream_info = g_value_get_boxed (value); - g_object_get (streamobj, "pid", &pid, "stream-type", &stream_type, NULL); + gst_structure_get_uint (stream_info, "pid", &pid); + gst_structure_get_uint (stream_info, "stream-type", &stream_type); stream = dvb_base_bin_get_stream (dvbbasebin, (guint16) pid); if (stream == NULL) { @@ -646,25 +647,26 @@ dvb_base_bin_remove_pmt_streams (DvbBaseBin * dvbbasebin, GObject * pmt) } static void -dvb_base_bin_add_pmt_streams (DvbBaseBin * dvbbasebin, GObject * pmt) +dvb_base_bin_add_pmt_streams (DvbBaseBin * dvbbasebin, GstStructure * pmt) { DvbBaseBinStream *stream; - GValueArray *streams; - gint program_number; + const GValue *streams; + guint program_number; gint i; - GValue *value; - GObject *streamobj; + const GValue *value; + GstStructure *stream_info; guint pid; guint stream_type; - g_object_get (pmt, "program-number", &program_number, - "stream-info", &streams, NULL); + gst_structure_get_uint (pmt, "program-number", &program_number); + streams = gst_structure_get_value (pmt, "streams"); - for (i = 0; i < streams->n_values; ++i) { - value = g_value_array_get_nth (streams, i); - streamobj = g_value_get_object (value); + for (i = 0; i < gst_value_list_get_size (streams); ++i) { + value = gst_value_list_get_value (streams, i); + stream_info = g_value_get_boxed (value); - g_object_get (streamobj, "pid", &pid, "stream-type", &stream_type, NULL); + gst_structure_get_uint (stream_info, "pid", &pid); + gst_structure_get_uint (stream_info, "stream-type", &stream_type); GST_DEBUG ("filtering stream %d stream_type %d", pid, stream_type); stream = dvb_base_bin_get_stream (dvbbasebin, (guint16) pid); @@ -702,7 +704,7 @@ dvb_base_bin_activate_program (DvbBaseBin * dvbbasebin, guint16 old_pcr_pid; old_pcr_pid = program->pcr_pid; - g_object_get (program->pmt, "pcr-pid", &pid, NULL); + gst_structure_get_uint (program->pmt, "pcr-pid", &pid); program->pcr_pid = pid; if (old_pcr_pid != G_MAXUINT16 && old_pcr_pid != program->pcr_pid) dvb_base_bin_get_stream (dvbbasebin, old_pcr_pid)->usecount--; @@ -747,28 +749,27 @@ dvb_base_bin_deactivate_program (DvbBaseBin * dvbbasebin, } static void -dvb_base_bin_pat_info_changed_cb (GstElement * mpegtsparse, - GParamSpec * pspec, DvbBaseBin * dvbbasebin) +dvb_base_bin_pat_info_cb (GstElement * mpegtsparse, + GstStructure * pat_info, DvbBaseBin * dvbbasebin) { DvbBaseBinProgram *program; DvbBaseBinStream *stream; - GValueArray *pat_info; - GValue *value; - GObject *program_info; - gint program_number; + const GValue *value; + GstStructure *program_info; + guint program_number; guint pid; - guint16 old_pmt_pid; + guint old_pmt_pid; gint i; gboolean rebuild_filter = FALSE; + const GValue *programs; - g_object_get (mpegtsparse, "pat-info", &pat_info, NULL); + programs = gst_structure_get_value (pat_info, "programs"); + for (i = 0; i < gst_value_list_get_size (programs); ++i) { + value = gst_value_list_get_value (programs, i); + program_info = g_value_get_boxed (value); - for (i = 0; i < pat_info->n_values; ++i) { - value = g_value_array_get_nth (pat_info, i); - program_info = g_value_get_object (value); - - g_object_get (program_info, "program-number", &program_number, - "pid", &pid, NULL); + gst_structure_get_uint (program_info, "program-number", &program_number); + gst_structure_get_uint (program_info, "pid", &pid); program = dvb_base_bin_get_program (dvbbasebin, program_number); if (program == NULL) @@ -792,17 +793,18 @@ dvb_base_bin_pat_info_changed_cb (GstElement * mpegtsparse, } } - g_value_array_free (pat_info); - if (rebuild_filter) dvb_base_bin_rebuild_filter (dvbbasebin); } static void dvb_base_bin_pmt_info_cb (GstElement * mpegtsparse, - guint program_number, GObject * pmt, DvbBaseBin * dvbbasebin) + GstStructure * pmt, DvbBaseBin * dvbbasebin) { DvbBaseBinProgram *program; + guint program_number; + + gst_structure_get_uint (pmt, "program-number", &program_number); program = dvb_base_bin_get_program (dvbbasebin, program_number); if (program == NULL) { @@ -812,7 +814,7 @@ dvb_base_bin_pmt_info_cb (GstElement * mpegtsparse, } program->old_pmt = program->pmt; - program->pmt = g_object_ref (pmt); + program->pmt = gst_structure_copy (pmt); /* activate the program if it's selected and either it's not active or its pmt * changed */ @@ -820,7 +822,7 @@ dvb_base_bin_pmt_info_cb (GstElement * mpegtsparse, dvb_base_bin_activate_program (dvbbasebin, program); if (program->old_pmt) { - g_object_unref (program->old_pmt); + gst_structure_free (program->old_pmt); program->old_pmt = NULL; } } |