From 7bd5a94ca09d147298693d2310ea185f7b70f65a Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sat, 18 Oct 2014 16:11:22 +0000 Subject: [PATCH] image: add the skeleton for a Movie class. --- configure.ac | 13 +++++++ src/Makefile.am | 7 ++-- src/image/movie.cpp | 69 +++++++++++++++++++++++++++++++++++++ src/lol/image/all.h | 1 + src/lol/image/movie.h | 42 ++++++++++++++++++++++ src/lolcore.vcxproj | 2 ++ src/lolcore.vcxproj.filters | 6 ++++ 7 files changed, 137 insertions(+), 3 deletions(-) create mode 100644 src/image/movie.cpp create mode 100644 src/lol/image/movie.h diff --git a/configure.ac b/configure.ac index f9472dc3..28ab58bf 100644 --- a/configure.ac +++ b/configure.ac @@ -443,6 +443,19 @@ fi AM_CONDITIONAL(USE_IMLIB2, test "${ac_cv_my_have_imlib2}" = "yes") +# Use libavcodec? (required for movie encoding) +ac_cv_my_have_ffmpeg=yes +PKG_CHECK_MODULES([LIBAVCODEC], [libavcodec], [:], [ac_cv_my_have_ffmpeg=no]) +PKG_CHECK_MODULES([LIBAVFORMAT], [libavformat], [:], [ac_cv_my_have_ffmpeg=no]) +PKG_CHECK_MODULES([LIBSWSCALE], [libswscale], [:], [ac_cv_my_have_ffmpeg=no]) +if test "${ac_cv_my_have_ffmpeg}" != "no"; then + AC_DEFINE(USE_FFMPEG, 1, Define to 1 to use FFmpeg) + LOL_CFLAGS="${LOL_CFLAGS} ${LIBAVFORMAT_CFLAGS} ${LIBAVCODEC_CFLAGS} ${CFLAGSWSCALE_LIBS}" + LOL_LIBS="${LOL_LIBS} ${LIBAVFORMAT_LIBS} ${LIBAVCODEC_LIBS} ${LIBSWSCALE_LIBS}" +fi +AM_CONDITIONAL(USE_FFMPEG, test "${ac_cv_my_have_ffmpeg}" != "no") + + dnl Use GTK+? (required for the deushax editor) ac_cv_my_have_gtkgl="no" PKG_CHECK_MODULES(GTK, gtk+-2.0, [ac_cv_my_have_gtkgl="yes"], [:]) diff --git a/src/Makefile.am b/src/Makefile.am index 4c64511a..d74f27b3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -37,8 +37,8 @@ liblolcore_headers = \ \ lol/base/all.h \ lol/base/avl_tree.h lol/base/features.h lol/base/tuple.h lol/base/types.h \ - lol/base/array.h lol/base/assert.h lol/base/string.h lol/base/hash.h lol/base/map.h \ - lol/base/enum.h lol/base/log.h \ + lol/base/array.h lol/base/assert.h lol/base/string.h lol/base/hash.h \ + lol/base/map.h lol/base/enum.h lol/base/log.h \ \ lol/math/all.h \ lol/math/functions.h lol/math/vector.h lol/math/half.h lol/math/real.h \ @@ -53,7 +53,7 @@ liblolcore_headers = \ lol/sys/init.h lol/sys/file.h lol/sys/thread.h lol/sys/timer.h \ \ lol/image/all.h \ - lol/image/pixel.h lol/image/color.h lol/image/image.h \ + lol/image/pixel.h lol/image/color.h lol/image/image.h lol/image/movie.h \ \ lol/gpu/all.h \ lol/gpu/shader.h lol/gpu/indexbuffer.h lol/gpu/vertexbuffer.h \ @@ -122,6 +122,7 @@ liblolcore_sources = \ image/dither/ostromoukhov.cpp image/dither/ordered.cpp \ image/filter/convolution.cpp image/filter/color.cpp \ image/filter/dilate.cpp image/filter/median.cpp image/filter/yuv.cpp \ + image/movie.cpp \ \ loldebug.h \ debug/fps.cpp debug/fps.h debug/lines.cpp \ diff --git a/src/image/movie.cpp b/src/image/movie.cpp new file mode 100644 index 00000000..2f8f2658 --- /dev/null +++ b/src/image/movie.cpp @@ -0,0 +1,69 @@ +// +// Lol Engine +// +// Copyright: (c) 2010-2014 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://www.wtfpl.net/ for more details. +// + +#include + +#if USE_FFMPEG +extern "C" +{ +# include +} +#endif + +namespace lol +{ + +#if USE_FFMPEG +static bool g_ready = false; +#endif + +class MovieData +{ +#if USE_FFMPEG + +#endif + + friend class Movie; +}; + +/* + * Public Movie class + */ + +Movie::Movie(String const &name, ivec2 size, float fps) + : m_data(new MovieData()) +{ +#if USE_FFMPEG + if (!g_ready) + { + g_ready = true; + av_register_all(); + } +#endif +} + +Movie::~Movie() +{ +#if USE_FFMPEG + +#endif + + delete m_data; +} + +void Movie::Feed(Image const &image) +{ +#if USE_FFMPEG + +#endif +} + +} /* namespace lol */ + diff --git a/src/lol/image/all.h b/src/lol/image/all.h index b99567be..c0ea7071 100644 --- a/src/lol/image/all.h +++ b/src/lol/image/all.h @@ -13,4 +13,5 @@ #include #include #include +#include diff --git a/src/lol/image/movie.h b/src/lol/image/movie.h new file mode 100644 index 00000000..957ca408 --- /dev/null +++ b/src/lol/image/movie.h @@ -0,0 +1,42 @@ +// +// Lol Engine +// +// Copyright: (c) 2010-2014 Sam Hocevar +// This program is free software; you can redistribute it and/or +// modify it under the terms of the Do What The Fuck You Want To +// Public License, Version 2, as published by Sam Hocevar. See +// http://www.wtfpl.net/ for more details. +// + +#pragma once + +// +// The Movie class +// --------------- +// + +#include + +namespace lol +{ + +class Movie +{ +public: + Movie(String const &name, ivec2 size, float fps); + + /* TODO: Rule of three */ +#if 0 + Movie(Movie const &other); + Movie & operator =(Movie other); +#endif + ~Movie(); + + void Feed(Image const &image); + +private: + class MovieData *m_data; +}; + +} /* namespace lol */ + diff --git a/src/lolcore.vcxproj b/src/lolcore.vcxproj index b1263986..f6d9975e 100644 --- a/src/lolcore.vcxproj +++ b/src/lolcore.vcxproj @@ -164,6 +164,7 @@ + @@ -320,6 +321,7 @@ + diff --git a/src/lolcore.vcxproj.filters b/src/lolcore.vcxproj.filters index b56b56e5..1be7fbb9 100644 --- a/src/lolcore.vcxproj.filters +++ b/src/lolcore.vcxproj.filters @@ -105,6 +105,9 @@ debug + + image + debug @@ -735,6 +738,9 @@ lol\image + + lol\image + input