diff mbox series

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

Message ID 20240213073426.47433-1-jdek@itanimul.li
State New
Headers show
Series [FFmpeg-devel,1/2] avdevice: deprecate opengl outdev | expand

Checks

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

Commit Message

J. Dekker Feb. 13, 2024, 7:34 a.m. UTC
Signed-off-by: J. Dekker <jdek@itanimul.li>
---

These devices are fundamentally broken and usecases should be switched
away from output devices in general. Discussion in the thread tended towards
deprecation rather than immediate removal to give time for users to figure out
the best alternatives for their usecase.

 libavdevice/opengl_enc.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Marton Balint Feb. 13, 2024, 10:15 a.m. UTC | #1
On Tue, 13 Feb 2024, J. Dekker wrote:

> Signed-off-by: J. Dekker <jdek@itanimul.li>
> ---
>
> These devices are fundamentally broken and usecases should be switched
> away from output devices in general. Discussion in the thread tended towards
> deprecation rather than immediate removal to give time for users to figure out
> the best alternatives for their usecase.
>
> libavdevice/opengl_enc.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/libavdevice/opengl_enc.c b/libavdevice/opengl_enc.c
> index b2ac6eb16a..0c81ccc1c4 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,14 @@ 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. For monitoring purposes in ffmpeg you can output to a file or use pipes and a video player.\n"
> +            "Example: ffmpeg -i input.mkv -f nut - | ffplay \n"

The example seems wrong. Let's try to provide one which is working and is 
more similar to the old use (does not reencode the video):

-f nut -c:v rawvideo - | ffplay -

Regards,
Marton
Anton Khirnov Feb. 15, 2024, 4:20 p.m. UTC | #2
Quoting J. Dekker (2024-02-13 08:34:25)
> Signed-off-by: J. Dekker <jdek@itanimul.li>
> ---
> 
> These devices are fundamentally broken and usecases should be switched
> away from output devices in general. Discussion in the thread tended towards
> deprecation rather than immediate removal to give time for users to figure out
> the best alternatives for their usecase.
> 
>  libavdevice/opengl_enc.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/libavdevice/opengl_enc.c b/libavdevice/opengl_enc.c
> index b2ac6eb16a..0c81ccc1c4 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,14 @@ 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. For monitoring purposes in ffmpeg you can output to a file or use pipes and a video player.\n"

Besides Marton's comment, this could also elaborate a little on why it
is deprecated, e.g. "...due to being fundamentally incompatible with
libavformat API".

Also, could add a removal remind to version_major.h, similar to
FF_CODEC_CRYSTAL_HD.

Other than those, looks good to me.
diff mbox series

Patch

diff --git a/libavdevice/opengl_enc.c b/libavdevice/opengl_enc.c
index b2ac6eb16a..0c81ccc1c4 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,14 @@  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. For monitoring purposes in ffmpeg you can output to a file or use pipes and a video player.\n"
+            "Example: ffmpeg -i input.mkv -f nut - | 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)) {