changeset 1560:f59b66f9d679 libavformat

amf_get_string() by Allan Hsu allan aat counterpop doot net
author michael
date Sun, 10 Dec 2006 17:31:17 +0000
parents 515e80ef01e6
children a21addc40d10
files flvdec.c
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flvdec.c	Sun Dec 10 17:25:30 2006 +0000
+++ b/flvdec.c	Sun Dec 10 17:31:17 2006 +0000
@@ -40,6 +40,22 @@
     return 0;
 }
 
+static int amf_get_string(ByteIOContext *ioc, char *buffer, int buffsize) {
+    int length;
+
+    length = get_be16(ioc);
+    if(length >= buffsize) {
+        url_fskip(ioc, length);
+        return -1; //string will not fit in buffer
+    }
+
+    get_buffer(ioc, buffer, length);
+
+    buffer[length] = '\0';
+
+    return length;
+}
+
 static int flv_read_header(AVFormatContext *s,
                            AVFormatParameters *ap)
 {