[FFmpeg-devel] [PATCH] all: s/Open/Allocate and initialize/ in comments

Andrew Sayers ffmpeg-devel at pileofstuff.org
Thu May 16 15:23:01 EEST 2024


Comments for a few prominent functions claim to "open" something, when they
actually "allocate and initialize" that thing.

Using a different word misleads users into thinking it's doing a different
thing, making the interface more time-consuming to learn.

Replace "open" with the more standard "allocate and initialize".
---
 libavformat/avformat.h | 4 ++--
 libavformat/avio.h     | 4 ++--
 libavutil/hwcontext.h  | 3 ++-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 8afdcd9fd0..2fb89807a1 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -2235,8 +2235,8 @@ int av_probe_input_buffer(AVIOContext *pb, const AVInputFormat **fmt,
                           unsigned int offset, unsigned int max_probe_size);
 
 /**
- * Open an input stream and read the header. The codecs are not opened.
- * The stream must be closed with avformat_close_input().
+ * Allocate and initialize an input stream, then read the header.
+ * The codecs are not opened. The stream must be closed with avformat_close_input().
  *
  * @param ps       Pointer to user-supplied AVFormatContext (allocated by
  *                 avformat_alloc_context). May be a pointer to NULL, in
diff --git a/libavformat/avio.h b/libavformat/avio.h
index ebf611187d..1f56c58f9a 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -330,7 +330,7 @@ const char *avio_find_protocol_name(const char *url);
 int avio_check(const char *url, int flags);
 
 /**
- * Open directory for reading.
+ * Allocate and initialize a directory for reading.
  *
  * @param s       directory read context. Pointer to a NULL pointer must be passed.
  * @param url     directory to be listed.
@@ -707,7 +707,7 @@ int avio_closep(AVIOContext **s);
 
 
 /**
- * Open a write only memory stream.
+ * Allocate and initialize a write only memory stream.
  *
  * @param s new IO context
  * @return zero if no error.
diff --git a/libavutil/hwcontext.h b/libavutil/hwcontext.h
index bac30debae..be03f565f2 100644
--- a/libavutil/hwcontext.h
+++ b/libavutil/hwcontext.h
@@ -264,7 +264,8 @@ AVBufferRef *av_hwdevice_ctx_alloc(enum AVHWDeviceType type);
 int av_hwdevice_ctx_init(AVBufferRef *ref);
 
 /**
- * Open a device of the specified type and create an AVHWDeviceContext for it.
+ * Allocate and initialize a device of the specified type,
+ * and create an AVHWDeviceContext for it.
  *
  * This is a convenience function intended to cover the simple cases. Callers
  * who need to fine-tune device creation/management should open the device
-- 
2.43.0



More information about the ffmpeg-devel mailing list