mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-08-26 23:12:44 +02:00
spark: make cVideo::openDevice ignorem ultiple calls
Origin commit data
------------------
Branch: master
Commit: 26d7f46280
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2012-02-25 (Sat, 25 Feb 2012)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -140,6 +140,7 @@ cVideo::cVideo(int, void *, void *)
|
||||
//outputformat = VID_OUTFMT_RGBC_SVIDEO;
|
||||
scartvoltage = -1;
|
||||
video_standby = 0;
|
||||
fd = -1;
|
||||
}
|
||||
|
||||
cVideo::~cVideo(void)
|
||||
@@ -151,6 +152,10 @@ cVideo::~cVideo(void)
|
||||
|
||||
void cVideo::openDevice(void)
|
||||
{
|
||||
lt_debug("%s\n", __func__);
|
||||
/* todo: this fd checking is racy, should be protected by a lock */
|
||||
if (fd != -1) /* already open */
|
||||
return;
|
||||
if ((fd = open(VIDEO_DEVICE, O_RDWR)) < 0)
|
||||
lt_info("%s cannot open %s: %m\n", __FUNCTION__, VIDEO_DEVICE);
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
@@ -159,6 +164,7 @@ void cVideo::openDevice(void)
|
||||
|
||||
void cVideo::closeDevice(void)
|
||||
{
|
||||
lt_debug("%s\n", __func__);
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
fd = -1;
|
||||
|
Reference in New Issue
Block a user