On 12.06.2021 00:42, Timo Rothenpieler wrote:
+#include <unistd.h>
+#include <string.h>
+#include <stdio.h>
+
+int main(int argc, char **argv)
+{
+    const char *name = NULL;
+    unsigned int length = 0;
+    unsigned char data;
+
+    if (argc != 2) {
+        return 1;
+    } else {
+        int arglen = strlen(argv[1]);
+        name = argv[1];
+
+        for (int i = 0; i < arglen; i++) {
+            if (argv[1][i] == '.')
+                argv[1][i] = '_';
+            else if (argv[1][i] == '/')
+                name = &argv[1][i+1];
+        }
+    }
+
+    printf("const unsigned char ff_%s_data[] = { ", name);
+
+    while (read(STDIN_FILENO, &data, 1)) {
+        printf("0x%02x, ", data);
+        length++;
+    }
+
+    printf("0x00 };\n");
+    printf("const unsigned int ff_%s_len = %u;\n", name, length);
+
+    return 0;
+}

Just discovered that this doesn't work properly on MSVC.
Replaced locally with a variant based on freopen()/fread().

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to