summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Manouchehri <david.manouchehri@riseup.net>2017-11-04 16:32:41 -0400
committerMark Thompson <sw@jkqxz.net>2020-05-09 15:44:43 +0100
commitd0705ecb2bca2a72df13435251ce05c08d8142cc (patch)
tree4909fa92e0c7c4e2a6eb59379c685aced190447c
parentd0bd00c8ebdc4a482db553b2ca8c1e14fe105d72 (diff)
avdevice/v4l2enc: Allow writing non-rawvideos to v4l2.
Signed-off-by: David Manouchehri <david.manouchehri@riseup.net>
-rw-r--r--libavdevice/v4l2enc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libavdevice/v4l2enc.c b/libavdevice/v4l2enc.c
index 1c36f81f90..6e5cb88491 100644
--- a/libavdevice/v4l2enc.c
+++ b/libavdevice/v4l2enc.c
@@ -47,8 +47,7 @@ static av_cold int write_header(AVFormatContext *s1)
}
if (s1->nb_streams != 1 ||
- s1->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO ||
- s1->streams[0]->codecpar->codec_id != AV_CODEC_ID_RAWVIDEO) {
+ s1->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO) {
av_log(s1, AV_LOG_ERROR,
"V4L2 output device supports only a single raw video stream\n");
return AVERROR(EINVAL);
@@ -56,7 +55,12 @@ static av_cold int write_header(AVFormatContext *s1)
par = s1->streams[0]->codecpar;
- v4l2_pixfmt = ff_fmt_ff2v4l(par->format, AV_CODEC_ID_RAWVIDEO);
+ if(par->codec_id == AV_CODEC_ID_RAWVIDEO) {
+ v4l2_pixfmt = ff_fmt_ff2v4l(par->format, AV_CODEC_ID_RAWVIDEO);
+ } else {
+ v4l2_pixfmt = ff_fmt_ff2v4l(AV_PIX_FMT_NONE, par->codec_id);
+ }
+
if (!v4l2_pixfmt) { // XXX: try to force them one by one?
av_log(s1, AV_LOG_ERROR, "Unknown V4L2 pixel format equivalent for %s\n",
av_get_pix_fmt_name(par->format));