[FFmpeg-cvslog] avformat/rtmppkt: add ff_amf_write_array for write

Steven Liu git at videolan.org
Tue Sep 5 04:13:20 EEST 2023


ffmpeg | branch: master | Steven Liu <lq at chinaffmpeg.org> | Fri Aug 25 11:35:34 2023 +0800| [c946e8d92153515e045f82c2ca722c73b419eeef] | committer: Steven Liu

avformat/rtmppkt: add ff_amf_write_array for write

Signed-off-by: Steven Liu <lq at chinaffmpeg.org>

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

 libavformat/rtmppkt.c | 6 ++++++
 libavformat/rtmppkt.h | 8 ++++++++
 2 files changed, 14 insertions(+)

diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c
index 4b97c0833f..a602bf6a96 100644
--- a/libavformat/rtmppkt.c
+++ b/libavformat/rtmppkt.c
@@ -40,6 +40,12 @@ void ff_amf_write_number(uint8_t **dst, double val)
     bytestream_put_be64(dst, av_double2int(val));
 }
 
+void ff_amf_write_array_start(uint8_t **dst, uint32_t length)
+{
+    bytestream_put_byte(dst, AMF_DATA_TYPE_ARRAY);
+    bytestream_put_be32(dst, length);
+}
+
 void ff_amf_write_string(uint8_t **dst, const char *str)
 {
     bytestream_put_byte(dst, AMF_DATA_TYPE_STRING);
diff --git a/libavformat/rtmppkt.h b/libavformat/rtmppkt.h
index a15d2a5773..7c580f2224 100644
--- a/libavformat/rtmppkt.h
+++ b/libavformat/rtmppkt.h
@@ -244,6 +244,14 @@ void ff_amf_write_null(uint8_t **dst);
  */
 void ff_amf_write_object_start(uint8_t **dst);
 
+/**
+ * Write marker and length for AMF array to buffer.
+ *
+ * @param dst pointer to the input buffer (will be modified)
+ * @param length value to write
+ */
+void ff_amf_write_array_start(uint8_t **dst, uint32_t length);
+
 /**
  * Write string used as field name in AMF object to buffer.
  *



More information about the ffmpeg-cvslog mailing list