From: yu.dongliang <18588496441@163.com> Date: Sat, 8 Apr 2023 15:00:47 +0000 (+0800) Subject: main.c X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=372f3d25d35a95123fb4cdde12cd2cf8064f5d09;p=simplay.git main.c --- diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..68f7255 --- /dev/null +++ b/Makefile @@ -0,0 +1,18 @@ +CFILES += main.c +CFILES += simp.c +CFILES += simp_ffmpeg_input.c +CFILES += simp_ffmpeg_output.c +CFILES += simp_filter.c + +CFLAGS += -g -O3 +#CFLAGS += -Wall +CFLAGS += -I./ +CFLAGS += `pkg-config --cflags gtk+-3.0` + +LDFLAGS += -lavformat -lavcodec -lavfilter -lavutil +LDFLAGS += -lGL +LDFLAGS += `pkg-config --libs gtk+-3.0` + +all: + gcc $(CFLAGS) $(CFILES) $(LDFLAGS) + diff --git a/main.c b/main.c new file mode 100644 index 0000000..fcc04e2 --- /dev/null +++ b/main.c @@ -0,0 +1,42 @@ +#include"simp.h" + +void usage() +{ + printf("./simp input output\n"); +} + +int main(int argc, char* argv[]) +{ + if (argc < 3) { + usage(); + return -1; + } + + simp_filter_t* f = NULL; + simp_avio_t* in = NULL; + simp_avio_t* out = NULL; + + if (simp_avio_open(&in, "ffmpeg_input", argv[1]) < 0) { + scf_loge("\n"); + return -1; + } + + if (simp_filter_open(&f) < 0) { + scf_loge("\n"); + return -1; + } + + simp_filter_add_input(f, in); + + if (simp_filter_run(f) < 0) { + scf_loge("\n"); + return -1; + } + + if (simp_avio_run(in) < 0) { + scf_loge("\n"); + return -1; + } + + return 0; +}