mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 00:06:36 +00:00
dvbsrc: Only open device read/write when needed
Avoid starting up kernel thread when not needed
This commit is contained in:
parent
cca28a50a5
commit
2758cda0dc
1 changed files with 5 additions and 4 deletions
|
@ -718,7 +718,7 @@ gst_dvbsrc_close_devices (GstDvbSrc * object)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_dvbsrc_open_frontend (GstDvbSrc * object)
|
gst_dvbsrc_open_frontend (GstDvbSrc * object, gboolean writable)
|
||||||
{
|
{
|
||||||
struct dvb_frontend_info fe_info;
|
struct dvb_frontend_info fe_info;
|
||||||
const char *adapter_desc = NULL;
|
const char *adapter_desc = NULL;
|
||||||
|
@ -731,7 +731,8 @@ gst_dvbsrc_open_frontend (GstDvbSrc * object)
|
||||||
GST_INFO_OBJECT (object, "Using frontend device: %s", frontend_dev);
|
GST_INFO_OBJECT (object, "Using frontend device: %s", frontend_dev);
|
||||||
|
|
||||||
/* open frontend */
|
/* open frontend */
|
||||||
if ((object->fd_frontend = open (frontend_dev, O_RDWR)) < 0) {
|
if ((object->fd_frontend =
|
||||||
|
open (frontend_dev, writable ? O_RDWR : O_RDONLY)) < 0) {
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case ENOENT:
|
case ENOENT:
|
||||||
GST_ELEMENT_ERROR (object, RESOURCE, NOT_FOUND,
|
GST_ELEMENT_ERROR (object, RESOURCE, NOT_FOUND,
|
||||||
|
@ -1010,7 +1011,7 @@ gst_dvbsrc_change_state (GstElement * element, GstStateChange transition)
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
case GST_STATE_CHANGE_NULL_TO_READY:
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
||||||
/* open frontend then close it again, just so caps sent */
|
/* open frontend then close it again, just so caps sent */
|
||||||
gst_dvbsrc_open_frontend (src);
|
gst_dvbsrc_open_frontend (src, FALSE);
|
||||||
if (src->fd_frontend) {
|
if (src->fd_frontend) {
|
||||||
close (src->fd_frontend);
|
close (src->fd_frontend);
|
||||||
}
|
}
|
||||||
|
@ -1028,7 +1029,7 @@ gst_dvbsrc_start (GstBaseSrc * bsrc)
|
||||||
{
|
{
|
||||||
GstDvbSrc *src = GST_DVBSRC (bsrc);
|
GstDvbSrc *src = GST_DVBSRC (bsrc);
|
||||||
|
|
||||||
gst_dvbsrc_open_frontend (src);
|
gst_dvbsrc_open_frontend (src, TRUE);
|
||||||
if (!gst_dvbsrc_tune (src)) {
|
if (!gst_dvbsrc_tune (src)) {
|
||||||
GST_ERROR_OBJECT (src, "Not able to lock on to the dvb channel");
|
GST_ERROR_OBJECT (src, "Not able to lock on to the dvb channel");
|
||||||
close (src->fd_frontend);
|
close (src->fd_frontend);
|
||||||
|
|
Loading…
Reference in a new issue