mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
dvbsrc: dvbbasebin: add 'tune' signal
It works the same as the 'tune' property that is used only to signal the element that it should tune, but it is more natural to be used as a signal rather than a property. It is also proxied at the dvbbasebin element
This commit is contained in:
parent
16201cec34
commit
23fccad1fd
4 changed files with 60 additions and 10 deletions
|
@ -54,6 +54,7 @@ enum
|
|||
SIGNAL_TUNING_START,
|
||||
SIGNAL_TUNING_DONE,
|
||||
SIGNAL_TUNING_FAIL,
|
||||
SIGNAL_TUNE,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
|
@ -160,6 +161,8 @@ static void tuning_start_signal_cb (GObject * object, DvbBaseBin * dvbbasebin);
|
|||
static void tuning_done_signal_cb (GObject * object, DvbBaseBin * dvbbasebin);
|
||||
static void tuning_fail_signal_cb (GObject * object, DvbBaseBin * dvbbasebin);
|
||||
|
||||
static void dvb_base_bin_do_tune (DvbBaseBin * dvbbasebin);
|
||||
|
||||
#define dvb_base_bin_parent_class parent_class
|
||||
G_DEFINE_TYPE_EXTENDED (DvbBaseBin, dvb_base_bin, GST_TYPE_BIN,
|
||||
0,
|
||||
|
@ -252,6 +255,11 @@ tuning_fail_signal_cb (GObject * object, DvbBaseBin * dvbbasebin)
|
|||
g_signal_emit (dvbbasebin, dvb_base_bin_signals[SIGNAL_TUNING_FAIL], 0);
|
||||
}
|
||||
|
||||
static void
|
||||
dvb_base_bin_do_tune (DvbBaseBin * dvbbasebin)
|
||||
{
|
||||
g_signal_emit_by_name (dvbbasebin->dvbsrc, "tune", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
dvb_base_bin_class_init (DvbBaseBinClass * klass)
|
||||
|
@ -259,6 +267,7 @@ dvb_base_bin_class_init (DvbBaseBinClass * klass)
|
|||
GObjectClass *gobject_class;
|
||||
GstElementClass *element_class;
|
||||
GstBinClass *bin_class;
|
||||
DvbBaseBinClass *dvbbasebin_class;
|
||||
GstElementFactory *dvbsrc_factory;
|
||||
GObjectClass *dvbsrc_class;
|
||||
typedef struct
|
||||
|
@ -339,6 +348,9 @@ dvb_base_bin_class_init (DvbBaseBinClass * klass)
|
|||
gobject_class->dispose = dvb_base_bin_dispose;
|
||||
gobject_class->finalize = dvb_base_bin_finalize;
|
||||
|
||||
dvbbasebin_class = (DvbBaseBinClass *) klass;
|
||||
dvbbasebin_class->do_tune = dvb_base_bin_do_tune;
|
||||
|
||||
/* install dvbsrc properties */
|
||||
dvbsrc_factory = gst_element_factory_find ("dvbsrc");
|
||||
dvbsrc_class =
|
||||
|
@ -434,6 +446,18 @@ dvb_base_bin_class_init (DvbBaseBinClass * klass)
|
|||
g_signal_new ("tuning-fail", G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 0);
|
||||
|
||||
/**
|
||||
* DvbBaseBin::tune:
|
||||
* @dvbbasesink: the element on which the signal is emitted
|
||||
*
|
||||
* Signal emited from the application to the element, instructing it
|
||||
* to tune.
|
||||
*/
|
||||
dvb_base_bin_signals[SIGNAL_TUNE] =
|
||||
g_signal_new ("tune", G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
||||
G_STRUCT_OFFSET (DvbBaseBinClass, do_tune),
|
||||
NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -71,6 +71,7 @@ struct _DvbBaseBinClass {
|
|||
GstBinClass parent_class;
|
||||
|
||||
/* signals */
|
||||
void (*do_tune) (DvbBaseBin * dvbbasebin);
|
||||
};
|
||||
|
||||
GType dvb_base_bin_get_type(void);
|
||||
|
|
|
@ -160,6 +160,7 @@ enum
|
|||
SIGNAL_TUNING_START,
|
||||
SIGNAL_TUNING_DONE,
|
||||
SIGNAL_TUNING_FAIL,
|
||||
SIGNAL_TUNE,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
|
@ -512,6 +513,7 @@ static gboolean gst_dvbsrc_unlock_stop (GstBaseSrc * bsrc);
|
|||
static gboolean gst_dvbsrc_is_seekable (GstBaseSrc * bsrc);
|
||||
static gboolean gst_dvbsrc_get_size (GstBaseSrc * src, guint64 * size);
|
||||
|
||||
static void gst_dvbsrc_do_tune (GstDvbSrc * src);
|
||||
static gboolean gst_dvbsrc_tune (GstDvbSrc * object);
|
||||
static gboolean gst_dvbsrc_set_fe_params (GstDvbSrc * object,
|
||||
struct dtv_properties *props);
|
||||
|
@ -551,11 +553,13 @@ gst_dvbsrc_class_init (GstDvbSrcClass * klass)
|
|||
GstElementClass *gstelement_class;
|
||||
GstBaseSrcClass *gstbasesrc_class;
|
||||
GstPushSrcClass *gstpushsrc_class;
|
||||
GstDvbSrcClass *gstdvbsrc_class;
|
||||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
gstelement_class = (GstElementClass *) klass;
|
||||
gstbasesrc_class = (GstBaseSrcClass *) klass;
|
||||
gstpushsrc_class = (GstPushSrcClass *) klass;
|
||||
gstdvbsrc_class = (GstDvbSrcClass *) klass;
|
||||
|
||||
gobject_class->set_property = gst_dvbsrc_set_property;
|
||||
gobject_class->get_property = gst_dvbsrc_get_property;
|
||||
|
@ -582,6 +586,8 @@ gst_dvbsrc_class_init (GstDvbSrcClass * klass)
|
|||
|
||||
gstpushsrc_class->create = GST_DEBUG_FUNCPTR (gst_dvbsrc_create);
|
||||
|
||||
gstdvbsrc_class->do_tune = GST_DEBUG_FUNCPTR (gst_dvbsrc_do_tune);
|
||||
|
||||
g_object_class_install_property (gobject_class, ARG_DVBSRC_ADAPTER,
|
||||
g_param_spec_int ("adapter", "The adapter device number",
|
||||
"The DVB adapter device number (eg. 0 for adapter0)",
|
||||
|
@ -895,6 +901,19 @@ gst_dvbsrc_class_init (GstDvbSrcClass * klass)
|
|||
g_signal_new ("tuning-fail", G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 0);
|
||||
|
||||
/**
|
||||
* GstDvbSrc::tune:
|
||||
* @gstdvbsrc: the element on which the signal is emitted
|
||||
*
|
||||
* Signal emited from the application to the element, instructing it
|
||||
* to tune.
|
||||
*/
|
||||
gst_dvbsrc_signals[SIGNAL_TUNING_FAIL] =
|
||||
g_signal_new ("tune", G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
||||
G_STRUCT_OFFSET (GstDvbSrcClass, do_tune),
|
||||
NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
||||
|
||||
}
|
||||
|
||||
/* initialize the new element
|
||||
|
@ -1147,18 +1166,10 @@ gst_dvbsrc_set_property (GObject * _object, guint prop_id,
|
|||
case ARG_DVBSRC_INVERSION:
|
||||
object->inversion = g_value_get_enum (value);
|
||||
break;
|
||||
case ARG_DVBSRC_TUNE:{
|
||||
case ARG_DVBSRC_TUNE:
|
||||
GST_INFO_OBJECT (object, "Set Property: ARG_DVBSRC_TUNE");
|
||||
|
||||
/* if we are in paused/playing state tune now, otherwise in ready
|
||||
* to paused state change */
|
||||
if (GST_STATE (object) > GST_STATE_READY) {
|
||||
g_mutex_lock (&object->tune_mutex);
|
||||
gst_dvbsrc_tune (object);
|
||||
g_mutex_unlock (&object->tune_mutex);
|
||||
}
|
||||
gst_dvbsrc_do_tune (object);
|
||||
break;
|
||||
}
|
||||
case ARG_DVBSRC_STATS_REPORTING_INTERVAL:
|
||||
object->stats_interval = g_value_get_uint (value);
|
||||
object->stats_counter = 0;
|
||||
|
@ -1961,6 +1972,18 @@ gst_dvbsrc_get_size (GstBaseSrc * src, guint64 * size)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_dvbsrc_do_tune (GstDvbSrc * src)
|
||||
{
|
||||
/* if we are in paused/playing state tune now, otherwise in ready
|
||||
* to paused state change */
|
||||
if (GST_STATE (src) > GST_STATE_READY) {
|
||||
g_mutex_lock (&src->tune_mutex);
|
||||
gst_dvbsrc_tune (src);
|
||||
g_mutex_unlock (&src->tune_mutex);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_dvbsrc_output_frontend_stats (GstDvbSrc * src)
|
||||
{
|
||||
|
|
|
@ -135,6 +135,8 @@ struct _GstDvbSrcClass
|
|||
|
||||
void (*adapter_type) (GstElement * element, gint type);
|
||||
void (*signal_quality) (GstElement * element, gint strength, gint snr);
|
||||
|
||||
void (*do_tune) (GstDvbSrc * self);
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue