[FFmpeg-cvslog] avdevice: deprecate sdl outdev

J. Dekker git at videolan.org
Wed Feb 28 11:29:49 EET 2024


ffmpeg | branch: master | J. Dekker <jdek at itanimul.li> | Tue Feb 13 08:34:26 2024 +0100| [2b17a74df5fbbc87cdf7a0a784e2e088ab4afd3c] | committer: J. Dekker

avdevice: deprecate sdl outdev

Signed-off-by: J. Dekker <jdek at itanimul.li>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2b17a74df5fbbc87cdf7a0a784e2e088ab4afd3c
---

 doc/outdevs.texi            |  8 +++++++-
 libavdevice/sdl2.c          | 10 ++++++++++
 libavdevice/version_major.h |  2 ++
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/doc/outdevs.texi b/doc/outdevs.texi
index 941429a8c8..9ee857528e 100644
--- a/doc/outdevs.texi
+++ b/doc/outdevs.texi
@@ -408,7 +408,13 @@ ffmpeg  -i INPUT -f pulse "stream name"
 
 @section sdl
 
-SDL (Simple DirectMedia Layer) output device.
+SDL (Simple DirectMedia Layer) output device. Deprecated and will be removed.
+
+For monitoring purposes in FFmpeg, pipes and a video player such as ffplay can be used:
+
+ at example
+ffmpeg -i INPUT -f nut -c:v rawvideo - | ffplay -
+ at end example
 
 "sdl2" can be used as alias for "sdl".
 
diff --git a/libavdevice/sdl2.c b/libavdevice/sdl2.c
index 342a253dc0..ec3c3d19b5 100644
--- a/libavdevice/sdl2.c
+++ b/libavdevice/sdl2.c
@@ -51,6 +51,7 @@ typedef struct {
     SDL_Rect texture_rect;
 
     int inited;
+    int warned;
 } SDLContext;
 
 static const struct sdl_texture_format_entry {
@@ -165,6 +166,15 @@ static int sdl2_write_header(AVFormatContext *s)
     int i, ret = 0;
     int flags  = 0;
 
+    if (!sdl->warned) {
+        av_log(sdl, AV_LOG_WARNING,
+            "The sdl 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"
+        );
+        sdl->warned = 1;
+    }
+
     if (!sdl->window_title)
         sdl->window_title = av_strdup(s->url);
 
diff --git a/libavdevice/version_major.h b/libavdevice/version_major.h
index da5854ed4c..6e04e0939d 100644
--- a/libavdevice/version_major.h
+++ b/libavdevice/version_major.h
@@ -37,5 +37,7 @@
 #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)
+// reminder to remove the sdl2 device on next major bump
+#define FF_API_SDL2_DEVICE (LIBAVDEVICE_VERSION_MAJOR < 62)
 
 #endif /* AVDEVICE_VERSION_MAJOR_H */



More information about the ffmpeg-cvslog mailing list