Commit 3618d7b9 authored by Linshizhi's avatar Linshizhi

Add ffmpeg library.

parent cbb2e83a
......@@ -7,3 +7,6 @@
[submodule "external/skia"]
path = external/skia
url = https://skia.googlesource.com/skia.git
[submodule "external/ffmpeg"]
path = external/ffmpeg
url = https://github.com/FFmpeg/FFmpeg.git
cc_import(
name = "avcodec",
hdrs = glob(["include/**/*.h"]),
static_library = "lib/libavcodec.a",
visibility = ["//visibility:public"]
)
cc_import(
name = "avdevice",
hdrs = glob(["include/**/*.h"]),
static_library = "lib/libavdevice.a",
visibility = ["//visibility:public"]
)
cc_import(
name = "avfilter",
hdrs = glob(["include/**/*.h"]),
static_library = "lib/libavfilter.a",
visibility = ["//visibility:public"]
)
cc_import(
name = "avformat",
hdrs = glob(["include/**/*.h"]),
static_library = "lib/libavformat.a",
visibility = ["//visibility:public"]
)
cc_import(
name = "avutil",
hdrs = glob(["include/**/*.h"]),
static_library = "lib/libavutil.a",
visibility = ["//visibility:public"]
)
cc_import(
name = "swresample",
hdrs = glob(["include/**/*.h"]),
static_library = "lib/libswresample.a",
visibility = ["//visibility:public"]
)
cc_import(
name = "swscale",
hdrs = glob(["include/**/*.h"]),
static_library = "lib/libswscale.a",
visibility = ["//visibility:public"]
)
......@@ -2,6 +2,5 @@ cc_library(
name = "theft",
srcs = glob(["src/*.c"]),
hdrs = glob(["inc/*.h", "src/*.h"]),
copts = ["-Iexternal/theft/inc", "-ltheft"],
visibility = ["//visibility:public"],
)
......@@ -19,3 +19,10 @@ new_local_repository(
path = "./external/build/skia",
build_file = "BUILDS/BUILD.skia"
)
# FFmpeg
new_local_repository(
name = "ffmpeg",
path = "./external/build/ffmpeg",
build_file = "BUILDS/BUILD.ffmpeg"
)
Subproject commit 81ebf40efa47b7d11be060c551411dd5efd11a05
......@@ -39,3 +39,20 @@ builds=$(find . | grep bazel | xargs)
if [ ! -z "$builds" ]; then
rm $builds
fi
# Build ffmpeg
FFMPEG_BUILD_DIR=${EXTERNAL_BUILD_DIR}/ffmpeg
FFMPEG_DIR=${EXTERNAL_DIR}/ffmpeg
cd $FFMPEG_DIR
./configure --disable-programs --enable-shared
make -j install prefix=${FFMPEG_BUILD_DIR}/dist
if [ ! -d "${FFMPEG_BUILD_DIR}" ]; then
mkdir ${FFMPEG_BUILD_DIR}
else
rm -rf ${FFMPEG_BUILD_DIR}/*
fi
cp -r ${FFMPEG_DIR}/dist/include ${FFMPEG_BUILD_DIR}/
cp -r ${FFMPEG_DIR}/dist/lib ${FFMPEG_BUILD_DIR}/
......@@ -3,8 +3,21 @@ cc_library(
name = "render",
srcs = ["canvas.cc"],
hdrs = ["canvas.h"],
deps = ["@skia//:skia_public"],
copts = ["-I./external/build/skia/", "-std=c++2a"],
deps = [
"@ffmpeg//:avformat",
"@skia//:skia_public",
"@ffmpeg//:avcodec",
"@ffmpeg//:avdevice",
"@ffmpeg//:avfilter",
"@ffmpeg//:avutil",
"@ffmpeg//:swresample",
"@ffmpeg//:swscale",
],
copts = [
"-I./external/ffmpeg/include",
"-I./external/skia/include",
"-std=c++2a"
],
visibility = [
"//app:__pkg__",
"//tests:__pkg__"
......
#include <stdio.h>
#include "include/core/SkCanvas.h"
#include "core/SkCanvas.h"
extern "C" {
#include "libavformat/avformat.h"
}
int say(void) {
SkCanvas canvas = SkCanvas();
AVFormatContext *ctx = avformat_alloc_context();
return 0;
}
......@@ -6,6 +6,7 @@ cc_test(
srcs = ["check.cc"],
args = ["/home"],
copts = ["-I./src"],
linkopts = ["-lz", "-llzma"],
deps = [
"//src:render",
"@theft//:theft",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment