diff options
Diffstat (limited to 'src/v4l.cc')
-rw-r--r-- | src/v4l.cc | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -66,7 +66,7 @@ struct buffer { size_t length; }; -static const char *dev_name; +static char *dev_name; static enum io_method io = IO_METHOD_MMAP; static int fd = -1; struct buffer *buffers; @@ -788,14 +788,19 @@ int main(int argc, char **argv) } #endif/*0*/ -V4L::V4L() +V4L::V4L(QString device) { + dev_name = strdup(device.toStdString().c_str()); + v4l = this; // Set global V4L object pointer. + start(); } V4L::~V4L() { + free(dev_name); + v4l = NULL; // Unset global V4L object pointer. // TODO: Stop thread.... somehow. @@ -803,7 +808,6 @@ V4L::~V4L() void V4L::run() { - dev_name = "/dev/video0"; force_format = true; open_device(); |