From dff2195f0d3bc61011a94a4efa5ef707d03f35ce Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Mon, 8 Dec 2014 16:53:08 -0500 Subject: [PATCH] add initial files --- .gitignore | 1 + Makefile | 9 +++++++++ hello.c | 23 +++++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 hello.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e92569d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/hello diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7243bb4 --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +TARGET := hello +OBJS := hello.o +CFLAGS := $$(pkg-config --cflags libavformat) -Wall +LDFLAGS := $$(pkg-config --libs libavformat) + +all: $(TARGET) + +$(TARGET): $(OBJS) + $(CC) -o $@ $^ $(LDFLAGS) diff --git a/hello.c b/hello.c new file mode 100644 index 0000000..95d9c92 --- /dev/null +++ b/hello.c @@ -0,0 +1,23 @@ +#include +#include + +int main(int argc, char * argv[]) +{ + if (argc < 2) + { + fprintf(stderr, "Usage: %s \n", argv[0]); + return 1; + } + + AVFormatContext * context = NULL; + av_register_all(); + if (avformat_open_input(&context, argv[1], NULL, NULL) != 0) + { + fprintf(stderr, "Error opening input stream %s\n", argv[1]); + return 2; + } + + avformat_close_input(&context); + + return 0; +}