diff mbox series

[FFmpeg-devel,v2,1/2] avdevice: deprecate opengl outdev

Message ID 20240221113356.203887-1-jdek@itanimul.li
State Accepted
Commit e4c0cdf8df96047ee195cc594a2a93443e2aa25d
Headers show
Series [FFmpeg-devel,v2,1/2] avdevice: deprecate opengl outdev | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

J. Dekker Feb. 21, 2024, 11:33 a.m. UTC
Signed-off-by: J. Dekker <jdek@itanimul.li>
---
 doc/outdevs.texi            |  2 +-
 libavdevice/opengl_enc.c    | 11 +++++++++++
 libavdevice/version_major.h |  2 ++
 3 files changed, 14 insertions(+), 1 deletion(-)

Comments

Lynne Feb. 21, 2024, 12:32 p.m. UTC | #1
Feb 21, 2024, 12:34 by jdek@itanimul.li:

> Signed-off-by: J. Dekker <jdek@itanimul.li>
> ---
>  doc/outdevs.texi            |  2 +-
>  libavdevice/opengl_enc.c    | 11 +++++++++++
>  libavdevice/version_major.h |  2 ++
>  3 files changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/doc/outdevs.texi b/doc/outdevs.texi
> index f0484bbf8f..941429a8c8 100644
> --- a/doc/outdevs.texi
> +++ b/doc/outdevs.texi
> @@ -302,7 +302,7 @@ ffmpeg -re -i INPUT -c:v rawvideo -pix_fmt bgra -f fbdev /dev/fb0
>  See also @url{http://linux-fbdev.sourceforge.net/}, and fbset(1).
>

We have removed demuxers and decoders before without a deprecation period.
I think we should do the same here, as it is just a muxer.
Anton Khirnov Feb. 26, 2024, 3:43 p.m. UTC | #2
Quoting Lynne (2024-02-21 13:32:19)
> Feb 21, 2024, 12:34 by jdek@itanimul.li:
> 
> > Signed-off-by: J. Dekker <jdek@itanimul.li>
> > ---
> >  doc/outdevs.texi            |  2 +-
> >  libavdevice/opengl_enc.c    | 11 +++++++++++
> >  libavdevice/version_major.h |  2 ++
> >  3 files changed, 14 insertions(+), 1 deletion(-)
> >
> > diff --git a/doc/outdevs.texi b/doc/outdevs.texi
> > index f0484bbf8f..941429a8c8 100644
> > --- a/doc/outdevs.texi
> > +++ b/doc/outdevs.texi
> > @@ -302,7 +302,7 @@ ffmpeg -re -i INPUT -c:v rawvideo -pix_fmt bgra -f fbdev /dev/fb0
> >  See also @url{http://linux-fbdev.sourceforge.net/}, and fbset(1).
> >
> 
> We have removed demuxers and decoders before without a deprecation period.
> I think we should do the same here, as it is just a muxer.

In the last thread some people really wanted to have it deprecated
first.

While I'd also prefer to remove it outright, I'd prefer even more to not
have this bikeshud to death.
Jan Ekström Feb. 26, 2024, 4:47 p.m. UTC | #3
On Wed, Feb 21, 2024 at 1:34 PM J. Dekker <jdek@itanimul.li> wrote:
>
> Signed-off-by: J. Dekker <jdek@itanimul.li>
> ---
>  doc/outdevs.texi            |  2 +-
>  libavdevice/opengl_enc.c    | 11 +++++++++++
>  libavdevice/version_major.h |  2 ++
>  3 files changed, 14 insertions(+), 1 deletion(-)

As during FOSDEM there seemed to be a consensus that we should move to
removing this, I agree with the idea behind this patch.

Additionally, both during FOSDEM as well as right now I successfully
built this module on Fedora 39 and tried `ffmpeg -v verbose -re -i
"https://megumin.fushizen.eu/videos/HidamariHoneycombED.mp4" -vf
scale=w=640:h=360,format=yuv420p -map 0:v -f sdl "SDL output"` and it
seems like while a 0x0 (?) window is created (without any decorations
- so you only notice it when you alt-tab), it does not seem to show up
on the desktop. So while it seemingly works with RGB input on Windows,
at least rgb24 didn't work on Fedora, either. yuyv422 and uyvy422
failed completely and the out device didn't take them in (which is
probably an SDL2 limitation?).

Regards,
Jan
Zhao Zhili Feb. 27, 2024, 1:42 a.m. UTC | #4
> 在 2024年2月27日,上午12:47,Jan Ekström <jeebjp@gmail.com> 写道:
> 
> On Wed, Feb 21, 2024 at 1:34 PM J. Dekker <jdek@itanimul.li> wrote:
>> 
>> Signed-off-by: J. Dekker <jdek@itanimul.li>
>> ---
>> doc/outdevs.texi            |  2 +-
>> libavdevice/opengl_enc.c    | 11 +++++++++++
>> libavdevice/version_major.h |  2 ++
>> 3 files changed, 14 insertions(+), 1 deletion(-)
> 
> As during FOSDEM there seemed to be a consensus that we should move to
> removing this, I agree with the idea behind this patch.
> 
> Additionally, both during FOSDEM as well as right now I successfully
> built this module on Fedora 39 and tried `ffmpeg -v verbose -re -i
> "https://megumin.fushizen.eu/videos/HidamariHoneycombED.mp4" -vf
> scale=w=640:h=360,format=yuv420p -map 0:v -f sdl "SDL output"` and it
> seems like while a 0x0 (?) window is created (without any decorations
> - so you only notice it when you alt-tab), it does not seem to show up
> on the desktop. So while it seemingly works with RGB input on Windows,
> at least rgb24 didn't work on Fedora, either. yuyv422 and uyvy422
> failed completely and the out device didn't take them in (which is
> probably an SDL2 limitation?).

There are at least two version of patches trying to fix the issue, two version of patches to depreciate/remove the module, and a dedicated thread try to resolve this issue. Please refer to those thread to figure out what’s working and what’s not.

> 
> Regards,
> Jan
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.
J. Dekker Feb. 28, 2024, 9:31 a.m. UTC | #5
Anton Khirnov <anton@khirnov.net> writes:

> Quoting Lynne (2024-02-21 13:32:19)
>> Feb 21, 2024, 12:34 by jdek@itanimul.li:
>> 
>> > Signed-off-by: J. Dekker <jdek@itanimul.li>
>> > ---
>> >  doc/outdevs.texi            |  2 +-
>> >  libavdevice/opengl_enc.c    | 11 +++++++++++
>> >  libavdevice/version_major.h |  2 ++
>> >  3 files changed, 14 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/doc/outdevs.texi b/doc/outdevs.texi
>> > index f0484bbf8f..941429a8c8 100644
>> > --- a/doc/outdevs.texi
>> > +++ b/doc/outdevs.texi
>> > @@ -302,7 +302,7 @@ ffmpeg -re -i INPUT -c:v rawvideo -pix_fmt bgra -f
>> > fbdev /dev/fb0
>> >  See also @url{http://linux-fbdev.sourceforge.net/}, and fbset(1).
>> >
>> 
>> We have removed demuxers and decoders before without a deprecation period.
>> I think we should do the same here, as it is just a muxer.
>
> In the last thread some people really wanted to have it deprecated
> first.
>
> While I'd also prefer to remove it outright, I'd prefer even more to not
> have this bikeshud to death.

No reason to delay this further. Pushed.
diff mbox series

Patch

diff --git a/doc/outdevs.texi b/doc/outdevs.texi
index f0484bbf8f..941429a8c8 100644
--- a/doc/outdevs.texi
+++ b/doc/outdevs.texi
@@ -302,7 +302,7 @@  ffmpeg -re -i INPUT -c:v rawvideo -pix_fmt bgra -f fbdev /dev/fb0
 See also @url{http://linux-fbdev.sourceforge.net/}, and fbset(1).
 
 @section opengl
-OpenGL output device.
+OpenGL output device. Deprecated and will be removed.
 
 To enable this output device you need to configure FFmpeg with @code{--enable-opengl}.
 
diff --git a/libavdevice/opengl_enc.c b/libavdevice/opengl_enc.c
index b2ac6eb16a..69de6fad03 100644
--- a/libavdevice/opengl_enc.c
+++ b/libavdevice/opengl_enc.c
@@ -224,6 +224,8 @@  typedef struct OpenGLContext {
     int picture_height;                ///< Rendered height
     int window_width;
     int window_height;
+
+    int warned;
 } OpenGLContext;
 
 static const struct OpenGLFormatDesc {
@@ -1060,6 +1062,15 @@  static av_cold int opengl_write_header(AVFormatContext *h)
     AVStream *st;
     int ret;
 
+    if (!opengl->warned) {
+        av_log(opengl, AV_LOG_WARNING,
+            "The opengl output device is deprecated due to being fundamentally incompatible with libavformat API. "
+            "For monitoring purposes in ffmpeg you can output to a file or use pipes and a video player.\n"
+            "Example: ffmpeg -i INPUT -f nut -c:v rawvideo - | ffplay -\n"
+        );
+        opengl->warned = 1;
+    }
+
     if (h->nb_streams != 1 ||
         par->codec_type != AVMEDIA_TYPE_VIDEO ||
         (par->codec_id != AV_CODEC_ID_WRAPPED_AVFRAME && par->codec_id != AV_CODEC_ID_RAWVIDEO)) {
diff --git a/libavdevice/version_major.h b/libavdevice/version_major.h
index 9f7b79b2ee..da5854ed4c 100644
--- a/libavdevice/version_major.h
+++ b/libavdevice/version_major.h
@@ -35,5 +35,7 @@ 
 
 // reminder to remove the bktr device on next major bump
 #define FF_API_BKTR_DEVICE (LIBAVDEVICE_VERSION_MAJOR < 62)
+// reminder to remove the opengl device on next major bump
+#define FF_API_OPENGL_DEVICE (LIBAVDEVICE_VERSION_MAJOR < 62)
 
 #endif /* AVDEVICE_VERSION_MAJOR_H */