Commit e97a9666 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '81ef4602'

* commit '81ef4602':
  bktr: Use av_strerror and propagate error codes

Conflicts:
	libavdevice/bktr.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 815daf16 81ef4602
...@@ -104,6 +104,8 @@ static av_cold int bktr_init(const char *video_device, int width, int height, ...@@ -104,6 +104,8 @@ static av_cold int bktr_init(const char *video_device, int width, int height,
char *arg; char *arg;
int c; int c;
struct sigaction act = { {0} }, old; struct sigaction act = { {0} }, old;
int ret;
char errbuf[128];
if (idev < 0 || idev > 4) if (idev < 0 || idev > 4)
{ {
...@@ -142,8 +144,10 @@ static av_cold int bktr_init(const char *video_device, int width, int height, ...@@ -142,8 +144,10 @@ static av_cold int bktr_init(const char *video_device, int width, int height,
*video_fd = avpriv_open(video_device, O_RDONLY); *video_fd = avpriv_open(video_device, O_RDONLY);
if (*video_fd < 0) { if (*video_fd < 0) {
av_log(NULL, AV_LOG_ERROR, "%s: %s\n", video_device, strerror(errno)); ret = AVERROR(errno);
return -1; av_strerror(ret, errbuf, sizeof(errbuf));
av_log(NULL, AV_LOG_ERROR, "%s: %s\n", video_device, errbuf);
return ret;
} }
geo.rows = height; geo.rows = height;
...@@ -165,19 +169,25 @@ static av_cold int bktr_init(const char *video_device, int width, int height, ...@@ -165,19 +169,25 @@ static av_cold int bktr_init(const char *video_device, int width, int height,
geo.oformat |= METEOR_GEO_EVEN_ONLY; geo.oformat |= METEOR_GEO_EVEN_ONLY;
if (ioctl(*video_fd, METEORSETGEO, &geo) < 0) { if (ioctl(*video_fd, METEORSETGEO, &geo) < 0) {
av_log(NULL, AV_LOG_ERROR, "METEORSETGEO: %s\n", strerror(errno)); ret = AVERROR(errno);
return -1; av_strerror(ret, errbuf, sizeof(errbuf));
av_log(NULL, AV_LOG_ERROR, "METEORSETGEO: %s\n", errbuf);
return ret;
} }
if (ioctl(*video_fd, BT848SFMT, &c) < 0) { if (ioctl(*video_fd, BT848SFMT, &c) < 0) {
av_log(NULL, AV_LOG_ERROR, "BT848SFMT: %s\n", strerror(errno)); ret = AVERROR(errno);
return -1; av_strerror(ret, errbuf, sizeof(errbuf));
av_log(NULL, AV_LOG_ERROR, "BT848SFMT: %s\n", errbuf);
return ret;
} }
c = bktr_dev[idev]; c = bktr_dev[idev];
if (ioctl(*video_fd, METEORSINPUT, &c) < 0) { if (ioctl(*video_fd, METEORSINPUT, &c) < 0) {
av_log(NULL, AV_LOG_ERROR, "METEORSINPUT: %s\n", strerror(errno)); ret = AVERROR(errno);
return -1; av_strerror(ret, errbuf, sizeof(errbuf));
av_log(NULL, AV_LOG_ERROR, "METEORSINPUT: %s\n", errbuf);
return ret;
} }
video_buf_size = width * height * 12 / 8; video_buf_size = width * height * 12 / 8;
...@@ -185,8 +195,10 @@ static av_cold int bktr_init(const char *video_device, int width, int height, ...@@ -185,8 +195,10 @@ static av_cold int bktr_init(const char *video_device, int width, int height,
video_buf = (uint8_t *)mmap((caddr_t)0, video_buf_size, video_buf = (uint8_t *)mmap((caddr_t)0, video_buf_size,
PROT_READ, MAP_SHARED, *video_fd, (off_t)0); PROT_READ, MAP_SHARED, *video_fd, (off_t)0);
if (video_buf == MAP_FAILED) { if (video_buf == MAP_FAILED) {
av_log(NULL, AV_LOG_ERROR, "mmap: %s\n", strerror(errno)); ret = AVERROR(errno);
return -1; av_strerror(ret, errbuf, sizeof(errbuf));
av_log(NULL, AV_LOG_ERROR, "mmap: %s\n", errbuf);
return ret;
} }
if (frequency != 0.0) { if (frequency != 0.0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment