diff mbox

[FFmpeg-devel,1/1] libavdevice/v4l2enc: support additional v4l2 output formats

Message ID 1548298528-6337-1-git-send-email-james.hilliard1@gmail.com
State Superseded
Headers show

Commit Message

james.hilliard1@gmail.com Jan. 24, 2019, 2:55 a.m. UTC
From: James Hilliard <james.hilliard1@gmail.com>

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
 libavdevice/v4l2enc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Carl Eugen Hoyos Jan. 24, 2019, 12:28 p.m. UTC | #1
2019-01-24 3:55 GMT+01:00, james.hilliard1@gmail.com
<james.hilliard1@gmail.com>:
> From: James Hilliard <james.hilliard1@gmail.com>
>
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> ---
>  libavdevice/v4l2enc.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/libavdevice/v4l2enc.c b/libavdevice/v4l2enc.c
> index faf6e07..f778208 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,7 @@ static av_cold int write_header(AVFormatContext *s1)
>
>      par = s1->streams[0]->codecpar;
>
> -    v4l2_pixfmt = ff_fmt_ff2v4l(par->format, AV_CODEC_ID_RAWVIDEO);
> +    v4l2_pixfmt = ff_fmt_ff2v4l(AV_PIX_FMT_NONE,
> s1->streams[0]->codecpar->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));

Please explain what this patch fixes.

Carl Eugen
james.hilliard1@gmail.com Jan. 27, 2019, 6:52 a.m. UTC | #2
The purpose of this patch is to fix a bug where ffmpeg would only
output rawvideo to a v4l2loopback device even though v4l2loopback
accepts other formats such as mjpeg.

On Wed, Jan 23, 2019 at 7:55 PM <james.hilliard1@gmail.com> wrote:
>
> From: James Hilliard <james.hilliard1@gmail.com>
>
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> ---
>  libavdevice/v4l2enc.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/libavdevice/v4l2enc.c b/libavdevice/v4l2enc.c
> index faf6e07..f778208 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,7 @@ static av_cold int write_header(AVFormatContext *s1)
>
>      par = s1->streams[0]->codecpar;
>
> -    v4l2_pixfmt = ff_fmt_ff2v4l(par->format, AV_CODEC_ID_RAWVIDEO);
> +    v4l2_pixfmt = ff_fmt_ff2v4l(AV_PIX_FMT_NONE, s1->streams[0]->codecpar->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));
> --
> 2.7.4
>
Carl Eugen Hoyos Jan. 27, 2019, 12:25 p.m. UTC | #3
2019-01-27 7:52 GMT+01:00, James Hilliard <james.hilliard1@gmail.com>:
> The purpose of this patch is to fix a bug where ffmpeg would only
> output rawvideo to a v4l2loopback device even though v4l2loopback
> accepts other formats such as mjpeg.

I believe this (or a short variant) should be part of the commit message.

Carl Eugen
diff mbox

Patch

diff --git a/libavdevice/v4l2enc.c b/libavdevice/v4l2enc.c
index faf6e07..f778208 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,7 @@  static av_cold int write_header(AVFormatContext *s1)
 
     par = s1->streams[0]->codecpar;
 
-    v4l2_pixfmt = ff_fmt_ff2v4l(par->format, AV_CODEC_ID_RAWVIDEO);
+    v4l2_pixfmt = ff_fmt_ff2v4l(AV_PIX_FMT_NONE, s1->streams[0]->codecpar->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));