summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2018-03-03 11:57:41 -0800
committerKevin Mitchell <kevmitch@gmail.com>2018-03-04 16:28:24 -0800
commitf0223e1b835894a20989523555a0f4e19cd36619 (patch)
treef3f818ef6e9cf0588890a772f5944c6f237524b6
parent496b13227b7f4b47a660bbf4e314f9a55b7e8867 (diff)
downloadmpv-f0223e1b835894a20989523555a0f4e19cd36619.tar.bz2
mpv-f0223e1b835894a20989523555a0f4e19cd36619.tar.xz
tv: Recognise v4l2 'JPEG' fourcc
Naturally, there's more than one fourcc that indicates an mjpeg stream. I have a particular ancient webcam here (Logitech QuickCam Messanger) that only supports the single 'JPEG' format, but there are other devices out there which support both 'JPEG' and 'MJPG' with no visible differences, and others where the streams are slightly different. Regardless of those details, it remains correct to treat 'JPEG' the same as 'MJPG' from a stream consumption perspective.
-rw-r--r--demux/demux_tv.c2
-rw-r--r--stream/tv.h1
-rw-r--r--stream/tvi_def.h1
-rw-r--r--stream/tvi_v4l2.c7
4 files changed, 8 insertions, 3 deletions
diff --git a/demux/demux_tv.c b/demux/demux_tv.c
index e9ed2b48e7..0e9bee4317 100644
--- a/demux/demux_tv.c
+++ b/demux/demux_tv.c
@@ -85,7 +85,7 @@ static int demux_open_tv(demuxer_t *demuxer, enum demux_check check)
/* get IMAGE FORMAT */
int fourcc;
funcs->control(tvh->priv, TVI_CONTROL_VID_GET_FORMAT, &fourcc);
- if (fourcc == MP_FOURCC_MJPEG) {
+ if (fourcc == MP_FOURCC_MJPEG || fourcc == MP_FOURCC_JPEG) {
sh_v->codec->codec = "mjpeg";
} else {
sh_v->codec->codec = "rawvideo";
diff --git a/stream/tv.h b/stream/tv.h
index f37e715515..94b7f01887 100644
--- a/stream/tv.h
+++ b/stream/tv.h
@@ -280,5 +280,6 @@ extern const struct m_sub_options tv_params_conf;
#define MP_FOURCC_YUY2 MP_FOURCC('Y', 'U', 'Y', '2')
#define MP_FOURCC_MJPEG MP_FOURCC('M', 'J', 'P', 'G')
+#define MP_FOURCC_JPEG MP_FOURCC('J', 'P', 'E', 'G')
#endif /* MPLAYER_TV_H */
diff --git a/stream/tvi_def.h b/stream/tvi_def.h
index 97d0982c94..0794b7eb91 100644
--- a/stream/tvi_def.h
+++ b/stream/tvi_def.h
@@ -79,6 +79,7 @@ static inline void fill_blank_frame(char* buffer,int len,int fmt){
}
break;
case MP_FOURCC_MJPEG:
+ case MP_FOURCC_JPEG:
/*
This is compressed format. I don't know yet how to fill such frame with blue color.
Keeping frame unchanged.
diff --git a/stream/tvi_v4l2.c b/stream/tvi_v4l2.c
index 57bf6b875f..70595c6034 100644
--- a/stream/tvi_v4l2.c
+++ b/stream/tvi_v4l2.c
@@ -235,7 +235,8 @@ static int fcc_mp2vl(int fcc)
case MP_FOURCC_YUY2: return V4L2_PIX_FMT_YUYV;
case MP_FOURCC_YV12: return V4L2_PIX_FMT_YVU420;
case MP_FOURCC_UYVY: return V4L2_PIX_FMT_UYVY;
- case MP_FOURCC_MJPEG: return V4L2_PIX_FMT_MJPEG;
+ case MP_FOURCC_MJPEG: return V4L2_PIX_FMT_MJPEG;
+ case MP_FOURCC_JPEG: return V4L2_PIX_FMT_JPEG;
}
return fcc;
}
@@ -259,7 +260,8 @@ static int fcc_vl2mp(int fcc)
case V4L2_PIX_FMT_YVU420: return MP_FOURCC_YV12;
case V4L2_PIX_FMT_YUYV: return MP_FOURCC_YUY2;
case V4L2_PIX_FMT_UYVY: return MP_FOURCC_UYVY;
- case V4L2_PIX_FMT_MJPEG: return MP_FOURCC_MJPEG;
+ case V4L2_PIX_FMT_MJPEG: return MP_FOURCC_MJPEG;
+ case V4L2_PIX_FMT_JPEG: return MP_FOURCC_JPEG;
}
return fcc;
}
@@ -298,6 +300,7 @@ static const char *pixfmt2name(char *buf, int pixfmt)
case V4L2_PIX_FMT_HI240: return "HI240";
case V4L2_PIX_FMT_WNVA: return "WNVA";
case V4L2_PIX_FMT_MJPEG: return "MJPEG";
+ case V4L2_PIX_FMT_JPEG: return "JPEG";
}
sprintf(buf, "unknown (0x%x)", pixfmt);
return buf;