2016-07-07 09:30:18 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <sched.h>
|
|
|
|
|
#include <errno.h>
|
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
|
#include <sys/mman.h>
|
|
|
|
|
#include <poll.h>
|
|
|
|
|
|
|
|
|
|
#define CLEAR(x) memset(&(x), 0, sizeof(x))
|
|
|
|
|
|
|
|
|
|
static int
|
2017-05-25 13:28:15 +02:00
|
|
|
spa_xv_open (struct impl *this)
|
2016-07-07 09:30:18 +02:00
|
|
|
{
|
2017-05-25 13:28:15 +02:00
|
|
|
struct port *port = &this->in_ports[0];
|
2016-07-07 09:30:18 +02:00
|
|
|
|
2017-05-25 13:28:15 +02:00
|
|
|
if (port->opened)
|
2016-07-07 09:30:18 +02:00
|
|
|
return 0;
|
|
|
|
|
|
2017-05-25 13:28:15 +02:00
|
|
|
port->opened = true;
|
2016-07-07 09:30:18 +02:00
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
2017-05-25 13:28:15 +02:00
|
|
|
spa_xv_set_format (struct impl *this, struct spa_video_info *info, bool try_only)
|
2016-07-07 09:30:18 +02:00
|
|
|
{
|
|
|
|
|
if (spa_xv_open (this) < 0)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
2017-05-25 13:28:15 +02:00
|
|
|
spa_xv_close (struct impl *this)
|
2016-07-07 09:30:18 +02:00
|
|
|
{
|
2017-05-25 13:28:15 +02:00
|
|
|
struct port *port = &this->in_ports[0];
|
2016-07-07 09:30:18 +02:00
|
|
|
|
2017-05-25 13:28:15 +02:00
|
|
|
if (!port->opened)
|
2016-07-07 09:30:18 +02:00
|
|
|
return 0;
|
|
|
|
|
|
2017-05-25 13:28:15 +02:00
|
|
|
port->opened = false;
|
2016-07-07 09:30:18 +02:00
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
2017-05-25 13:28:15 +02:00
|
|
|
spa_xv_start (struct impl *this)
|
2016-07-07 09:30:18 +02:00
|
|
|
{
|
|
|
|
|
if (spa_xv_open (this) < 0)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
2017-05-25 13:28:15 +02:00
|
|
|
spa_xv_stop (struct impl *this)
|
2016-07-07 09:30:18 +02:00
|
|
|
{
|
|
|
|
|
spa_xv_close (this);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|