FFmpeg to WASM build setup + Vue app.

This commit is contained in:
Alf
2020-09-23 19:06:40 -07:00
commit 711903032c
20 changed files with 12826 additions and 0 deletions

38
src/main.c Normal file
View File

@@ -0,0 +1,38 @@
#include <stdio.h>
#include <math.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/avutil.h>
void version() {
printf("%s\n", AV_STRINGIFY(LIBAVFORMAT_VERSION));
}
void openfile() {
FILE *file = fopen("testingfs", "rb");
if (!file) {
printf("cannot open file\n");
}
fclose(file);
AVFormatContext *pFormatContext = avformat_alloc_context();
if (!pFormatContext) {
printf("ERROR: could not allocate memory for Format Context\n");
}
printf("opening the input file: %s and loading format (container) header\n", "testingfs");
// Open the file and read header.
int ret;
if ((ret = avformat_open_input(&pFormatContext, "testingfs", NULL, NULL)) < 0) {
printf("ERROR: could not open the file. Error: %d\n", ret);
printf("%s", av_err2str(ret));
}
printf("format: %s, duration: %lld us, bit_rate: %lld\n",
pFormatContext->iformat->name,
pFormatContext->duration,
pFormatContext->bit_rate);
}