Skip to content

Commit 0bb6856

Browse files
committed
OpenVG subtitles
1 parent 6331274 commit 0bb6856

16 files changed

Lines changed: 1725 additions & 98 deletions

Enforce.h

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#pragma once
2+
3+
// Author: Torarin Hals Bakke (2012)
4+
5+
// Boost Software License - Version 1.0 - August 17th, 2003
6+
7+
// Permission is hereby granted, free of charge, to any person or organization
8+
// obtaining a copy of the software and accompanying documentation covered by
9+
// this license (the "Software") to use, reproduce, display, distribute,
10+
// execute, and transmit the Software, and to prepare derivative works of the
11+
// Software, and to permit third-parties to whom the Software is furnished to
12+
// do so, all subject to the following:
13+
14+
// The copyright notices in the Software and this entire statement, including
15+
// the above license grant, this restriction and the following disclaimer,
16+
// must be included in all copies of the Software, in whole or in part, and
17+
// all derivative works of the Software, unless such copies or derivative
18+
// works are solely in the form of machine-executable object code generated by
19+
// a source language processor.
20+
21+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23+
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
24+
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
25+
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
26+
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27+
// DEALINGS IN THE SOFTWARE.
28+
29+
#include <boost/config.hpp>
30+
#include <string>
31+
#include <utility>
32+
#include <type_traits>
33+
#include <exception>
34+
35+
class Enforce_error : public std::exception {
36+
std::string what_;
37+
std::string user_friendly_what_;
38+
public:
39+
template<typename T, typename U>
40+
explicit Enforce_error(T&& what_arg, U&& user_friendly_what_arg)
41+
: what_(std::forward<T>(what_arg)),
42+
user_friendly_what_(std::forward<U>(user_friendly_what_arg))
43+
{}
44+
45+
#if __GNUC__ == 4 && __GNUC_MINOR__ == 6
46+
~Enforce_error() throw() {}
47+
#endif
48+
49+
const char* what() const BOOST_NOEXCEPT {
50+
return what_.c_str();
51+
}
52+
53+
const std::string& user_friendly_what() const BOOST_NOEXCEPT {
54+
return user_friendly_what_;
55+
}
56+
};
57+
58+
template <typename T, typename U>
59+
void enforce(bool condition, T&& msg, U&& user_friendly_msg) {
60+
static_assert(std::is_convertible<T, std::string>::value,
61+
"msg must be convertible to std::string");
62+
static_assert(std::is_convertible<U, std::string>::value,
63+
"user_friendly_msg must be convertible to std::string");
64+
if (!condition)
65+
throw Enforce_error(std::forward<T>(msg), std::forward<U>(user_friendly_msg));
66+
}
67+
68+
#define ENFORCE_MESSAGE "Enforcement failed in " __FILE__ "(" BOOST_STRINGIZE(__LINE__) ")"
69+
70+
#define ENFORCE(condition) enforce(condition, ENFORCE_MESSAGE, "")
71+
#define ENFORCE2(condition, user_friendly_msg) enforce(condition, ENFORCE_MESSAGE, user_friendly_msg)

LockBlock.h

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#pragma once
2+
3+
// Author: Torarin Hals Bakke (2012)
4+
5+
// Usage:
6+
// LOCK_BLOCK(mutex) {
7+
// ...
8+
// }
9+
// or
10+
// LOCK_BLOCK(mutex)
11+
// ...;
12+
13+
// Boost Software License - Version 1.0 - August 17th, 2003
14+
15+
// Permission is hereby granted, free of charge, to any person or organization
16+
// obtaining a copy of the software and accompanying documentation covered by
17+
// this license (the "Software") to use, reproduce, display, distribute,
18+
// execute, and transmit the Software, and to prepare derivative works of the
19+
// Software, and to permit third-parties to whom the Software is furnished to
20+
// do so, all subject to the following:
21+
22+
// The copyright notices in the Software and this entire statement, including
23+
// the above license grant, this restriction and the following disclaimer,
24+
// must be included in all copies of the Software, in whole or in part, and
25+
// all derivative works of the Software, unless such copies or derivative
26+
// works are solely in the form of machine-executable object code generated by
27+
// a source language processor.
28+
29+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31+
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
32+
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
33+
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
34+
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
35+
// DEALINGS IN THE SOFTWARE.
36+
37+
#include <mutex>
38+
39+
template <typename T>
40+
struct Lock_block {
41+
Lock_block(T& mutex): lock(mutex) {}
42+
operator bool() {return true;}
43+
std::lock_guard<T> lock;
44+
};
45+
46+
#define LOCK_BLOCK(mutex) \
47+
if (Lock_block<decltype(mutex)> LOCK_BLOCK_cond{mutex})

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
include Makefile.include
22

3-
CFLAGS+=-DSTANDALONE -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -D_LINUX -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CMAKE_CONFIG -D__VIDEOCORE4__ -U_FORTIFY_SOURCE -Wall -DHAVE_OMXLIB -DUSE_EXTERNAL_FFMPEG -DHAVE_LIBAVCODEC_AVCODEC_H -DHAVE_LIBAVUTIL_OPT_H -DHAVE_LIBAVUTIL_MEM_H -DHAVE_LIBAVUTIL_AVUTIL_H -DHAVE_LIBAVFORMAT_AVFORMAT_H -DHAVE_LIBAVFILTER_AVFILTER_H -DOMX -DOMX_SKIP64BIT -ftree-vectorize -pipe -DUSE_EXTERNAL_OMX -DTARGET_RASPBERRY_PI -DUSE_EXTERNAL_LIBBCM_HOST -Wno-psabi -I$(SDKSTAGE)/opt/vc/include/
3+
CFLAGS+=-std=c++0x -DSTANDALONE -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -D_LINUX -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CMAKE_CONFIG -D__VIDEOCORE4__ -U_FORTIFY_SOURCE -Wall -DHAVE_OMXLIB -DUSE_EXTERNAL_FFMPEG -DHAVE_LIBAVCODEC_AVCODEC_H -DHAVE_LIBAVUTIL_OPT_H -DHAVE_LIBAVUTIL_MEM_H -DHAVE_LIBAVUTIL_AVUTIL_H -DHAVE_LIBAVFORMAT_AVFORMAT_H -DHAVE_LIBAVFILTER_AVFILTER_H -DOMX -DOMX_SKIP64BIT -ftree-vectorize -DUSE_EXTERNAL_OMX -DTARGET_RASPBERRY_PI -DUSE_EXTERNAL_LIBBCM_HOST
44

5-
LDFLAGS+=-L./ -lc -lWFC -lGLESv2 -lEGL -lbcm_host -lopenmaxil -Lffmpeg_compiled/usr/local/lib/
5+
LDFLAGS+=-L./ -lc -lWFC -lGLESv2 -lEGL -lbcm_host -lopenmaxil -lfreetype -lz -Lffmpeg_compiled/usr/local/lib/
66
INCLUDES+=-I./ -Ilinux -Iffmpeg_compiled/usr/local/include/
77

88
SRC=linux/XMemUtils.cpp \
@@ -25,6 +25,9 @@ SRC=linux/XMemUtils.cpp \
2525
File.cpp \
2626
OMXPlayerVideo.cpp \
2727
OMXPlayerAudio.cpp \
28+
OMXPlayerSubtitles.cpp \
29+
SubtitleRenderer.cpp \
30+
Unicode.cpp \
2831
omxplayer.cpp \
2932

3033
OBJS+=$(filter %.o,$(SRC:.cpp=.o))

Makefile.include

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ PATH := $(PREFIX)/bin:$(BUILDROOT)/output/host/usr/bin:$(PATH)
3535

3636
CFLAGS += -pipe -mfloat-abi=$(FLOAT) -mcpu=arm1176jzf-s -fomit-frame-pointer -mabi=aapcs-linux -mtune=arm1176jzf-s -mfpu=vfp -Wno-psabi -mno-apcs-stack-check -O3 -mstructure-size-boundary=32 -mno-sched-prolog
3737
LDFLAGS += -L$(SDKSTAGE)/lib -L$(SDKSTAGE)/usr/lib -L$(SDKSTAGE)/opt/vc/lib/
38-
INCLUDES += -isystem$(SDKSTAGE)/staging/usr/include -isystem$(SDKSTAGE)/staging/opt/vc/include -isystem$(SYSROOT)/usr/include -isystem$(SDKSTAGE)/opt/vc/include/interface/vcos/pthreads
38+
INCLUDES += -isystem$(SDKSTAGE)/staging/usr/include -isystem$(SDKSTAGE)/staging/opt/vc/include -isystem$(SYSROOT)/usr/include -isystem$(SDKSTAGE)/opt/vc/include/interface/vcos/pthreads -isystem$(SDKSTAGE)/usr/include/freetype2

0 commit comments

Comments
 (0)