mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
dvbsrc + dvb api buffer property to overcome buffer under reads
This commit is contained in:
parent
c4ccca8795
commit
fe5cf525e1
2 changed files with 75 additions and 57 deletions
|
@ -90,6 +90,7 @@ enum
|
|||
ARG_DVBSRC_INVERSION,
|
||||
ARG_DVBSRC_STATS_REPORTING_INTERVAL,
|
||||
ARG_DVBSRC_TIMEOUT,
|
||||
ARG_DVBSRC_DVB_BUFFER_SIZE
|
||||
};
|
||||
|
||||
#define DEFAULT_ADAPTER 0
|
||||
|
@ -109,7 +110,7 @@ enum
|
|||
#define DEFAULT_INVERSION INVERSION_ON
|
||||
#define DEFAULT_STATS_REPORTING_INTERVAL 100
|
||||
#define DEFAULT_TIMEOUT 1000000 /* 1 second */
|
||||
|
||||
#define DEFAULT_DVB_BUFFER_SIZE (10*188*1024) /* Default is the same as the kernel default */
|
||||
#define DEFAULT_BUFFER_SIZE 8192 /* not a property */
|
||||
|
||||
static void gst_dvbsrc_output_frontend_stats (GstDvbSrc * src);
|
||||
|
@ -447,6 +448,13 @@ gst_dvbsrc_class_init (GstDvbSrcClass * klass)
|
|||
g_param_spec_uint64 ("timeout", "Timeout",
|
||||
"Post a message after timeout microseconds (0 = disabled)", 0,
|
||||
G_MAXUINT64, DEFAULT_TIMEOUT, G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
ARG_DVBSRC_DVB_BUFFER_SIZE,
|
||||
g_param_spec_uint ("dvb-buffer-size",
|
||||
"dvb-buffer-size",
|
||||
"The kernel buffer size used by the DVB api",
|
||||
0, G_MAXUINT, DEFAULT_DVB_BUFFER_SIZE, G_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
/* initialize the new element
|
||||
|
@ -475,7 +483,7 @@ gst_dvbsrc_init (GstDvbSrc * object)
|
|||
}
|
||||
/* Pid 8192 on DVB gets the whole transport stream */
|
||||
object->pids[0] = 8192;
|
||||
|
||||
object->dvb_buffer_size = DEFAULT_DVB_BUFFER_SIZE;
|
||||
object->adapter_number = DEFAULT_ADAPTER;
|
||||
object->frontend_number = DEFAULT_FRONTEND;
|
||||
object->diseqc_src = DEFAULT_DISEQC_SRC;
|
||||
|
@ -638,6 +646,9 @@ gst_dvbsrc_set_property (GObject * _object, guint prop_id,
|
|||
case ARG_DVBSRC_TIMEOUT:
|
||||
object->timeout = g_value_get_uint64 (value);
|
||||
break;
|
||||
case ARG_DVBSRC_DVB_BUFFER_SIZE:
|
||||
object->dvb_buffer_size = g_value_get_uint (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
|
@ -704,6 +715,9 @@ gst_dvbsrc_get_property (GObject * _object, guint prop_id,
|
|||
case ARG_DVBSRC_TIMEOUT:
|
||||
g_value_set_uint64 (value, object->timeout);
|
||||
break;
|
||||
case ARG_DVBSRC_DVB_BUFFER_SIZE:
|
||||
g_value_set_uint (value, object->dvb_buffer_size);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
|
@ -850,9 +864,11 @@ gst_dvbsrc_open_dvr (GstDvbSrc * object)
|
|||
return FALSE;
|
||||
}
|
||||
g_free (dvr_dev);
|
||||
GST_INFO_OBJECT (object, "Setting buffer size");
|
||||
if (ioctl (object->fd_dvr, DMX_SET_BUFFER_SIZE, 1024 * 1024) < 0) {
|
||||
GST_INFO_OBJECT (object, "DMX_SET_BUFFER_SIZE failed");
|
||||
|
||||
GST_INFO_OBJECT (object, "Setting DVB kernel buffer size to %d ",
|
||||
object->dvb_buffer_size);
|
||||
if (ioctl (object->fd_dvr, DMX_SET_BUFFER_SIZE, object->dvb_buffer_size) < 0) {
|
||||
GST_INFO_OBJECT (object, "ioctl DMX_SET_BUFFER_SIZE failed (%d)", errno);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
G_BEGIN_DECLS
|
||||
|
||||
typedef enum
|
||||
{
|
||||
{
|
||||
DVB_POL_H,
|
||||
DVB_POL_V,
|
||||
DVB_POL_ZERO
|
||||
} GstDvbSrcPol;
|
||||
} GstDvbSrcPol;
|
||||
|
||||
|
||||
#define IPACKS 2048
|
||||
|
@ -32,12 +32,12 @@ G_BEGIN_DECLS
|
|||
#define GST_IS_DVBSRC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DVBSRC))
|
||||
|
||||
typedef struct _GstDvbSrc GstDvbSrc;
|
||||
typedef struct _GstDvbSrcClass GstDvbSrcClass;
|
||||
typedef struct _GstDvbSrcParam GstDvbSrcParam;
|
||||
typedef struct _GstDvbSrc GstDvbSrc;
|
||||
typedef struct _GstDvbSrcClass GstDvbSrcClass;
|
||||
typedef struct _GstDvbSrcParam GstDvbSrcParam;
|
||||
|
||||
struct _GstDvbSrc
|
||||
{
|
||||
struct _GstDvbSrc
|
||||
{
|
||||
GstPushSrc element;
|
||||
GstPad *srcpad;
|
||||
|
||||
|
@ -75,20 +75,22 @@ G_BEGIN_DECLS
|
|||
GstDvbSrcPol pol;
|
||||
guint stats_interval;
|
||||
guint stats_counter;
|
||||
};
|
||||
gboolean need_unlock;
|
||||
|
||||
struct _GstDvbSrcClass
|
||||
{
|
||||
guint dvb_buffer_size;
|
||||
};
|
||||
|
||||
struct _GstDvbSrcClass
|
||||
{
|
||||
GstPushSrcClass parent_class;
|
||||
|
||||
void (*adapter_type) (GstElement * element, gint type);
|
||||
void (*signal_quality) (GstElement * element, gint strength, gint snr);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
GType gst_dvbsrc_get_type (void);
|
||||
gboolean gst_dvbsrc_plugin_init (GstPlugin *plugin);
|
||||
GType gst_dvbsrc_get_type (void);
|
||||
gboolean gst_dvbsrc_plugin_init (GstPlugin * plugin);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_DVBSRC_H__ */
|
||||
|
|
Loading…
Reference in a new issue