hornetseye-qt4 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +56 -17
- data/ext/xvwidget.cc +32 -32
- metadata +3 -3
data/Rakefile
CHANGED
@@ -7,15 +7,15 @@ require 'rake/loaders/makefile'
|
|
7
7
|
require 'rbconfig'
|
8
8
|
|
9
9
|
PKG_NAME = 'hornetseye-qt4'
|
10
|
-
PKG_VERSION = '0.1.
|
10
|
+
PKG_VERSION = '0.1.1'
|
11
|
+
CFG = RbConfig::CONFIG
|
11
12
|
CXX = ENV[ 'CXX' ] || 'g++'
|
12
|
-
STRIP = ENV[ 'STRIP' ] || 'strip'
|
13
13
|
RB_FILES = FileList[ 'lib/**/*.rb' ]
|
14
14
|
CC_FILES = FileList[ 'ext/*.cc' ]
|
15
15
|
HH_FILES = FileList[ 'ext/*.hh' ] + FileList[ 'ext/*.tcc' ]
|
16
16
|
TC_FILES = FileList[ 'test/tc_*.rb' ]
|
17
17
|
TS_FILES = FileList[ 'test/ts_*.rb' ]
|
18
|
-
SO_FILE = "ext/#{PKG_NAME.tr '\-', '_'}
|
18
|
+
SO_FILE = "ext/#{PKG_NAME.tr '\-', '_'}.#{CFG[ 'DLEXT' ]}"
|
19
19
|
PKG_FILES = [ 'Rakefile', 'README.md', 'COPYING', '.document' ] +
|
20
20
|
RB_FILES + CC_FILES + HH_FILES + TS_FILES + TC_FILES
|
21
21
|
BIN_FILES = [ 'README.md', 'COPYING', '.document', SO_FILE ] +
|
@@ -27,17 +27,18 @@ EMAIL = %q{jan@wedesoft.de}
|
|
27
27
|
HOMEPAGE = %q{http://wedesoft.github.com/hornetseye-qt4/}
|
28
28
|
|
29
29
|
OBJ = CC_FILES.ext 'o'
|
30
|
-
$CXXFLAGS =
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
"-I#{RbConfig::CONFIG[ 'rubyhdrdir' ]}/#{RbConfig::CONFIG[ 'arch' ]}"
|
30
|
+
$CXXFLAGS = "-DNDEBUG -DHAVE_CONFIG_H -D__STDC_CONSTANT_MACROS #{CFG[ 'CPPFLAGS' ]} #{CFG[ 'CFLAGS' ]} -I/usr/include/qt4"
|
31
|
+
if CFG[ 'rubyhdrdir' ]
|
32
|
+
$CXXFLAGS = "#{$CXXFLAGS} -I#{CFG[ 'rubyhdrdir' ]} " +
|
33
|
+
"-I#{CFG[ 'rubyhdrdir' ]}/#{CFG[ 'arch' ]}"
|
35
34
|
else
|
36
|
-
$CXXFLAGS
|
35
|
+
$CXXFLAGS = "#{$CXXFLAGS} -I#{CFG[ 'archdir' ]}"
|
37
36
|
end
|
38
|
-
$LIBRUBYARG =
|
39
|
-
|
40
|
-
$
|
37
|
+
$LIBRUBYARG = "-L#{CFG[ 'libdir' ]} #{CFG[ 'LIBRUBYARG' ]} #{CFG[ 'LDFLAGS' ]} " +
|
38
|
+
"#{CFG[ 'SOLIBS' ]} #{CFG[ 'DLDLIBS' ]}"
|
39
|
+
$SITELIBDIR = CFG[ 'sitelibdir' ]
|
40
|
+
$SITEARCHDIR = CFG[ 'sitearchdir' ]
|
41
|
+
$LDSHARED = CFG[ 'LDSHARED' ][ CFG[ 'LDSHARED' ].index( ' ' ) .. -1 ]
|
41
42
|
|
42
43
|
task :default => :all
|
43
44
|
|
@@ -45,8 +46,7 @@ desc 'Compile Ruby extension (default)'
|
|
45
46
|
task :all => [ SO_FILE ]
|
46
47
|
|
47
48
|
file SO_FILE => OBJ do |t|
|
48
|
-
sh "#{CXX} -shared -o #{t.name} #{OBJ} -lX11 -lXv -lQtGui -lQtCore #{$LIBRUBYARG}"
|
49
|
-
sh "#{STRIP} --strip-all #{t.name}"
|
49
|
+
sh "#{CXX} -shared -o #{t.name} #{OBJ} -lswscale -lX11 -lXv -lQtGui -lQtCore #{$LIBRUBYARG}"
|
50
50
|
end
|
51
51
|
|
52
52
|
task :test => [ SO_FILE ]
|
@@ -73,6 +73,45 @@ task :uninstall do
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
+
desc 'Create config.h'
|
77
|
+
task :config_h => 'ext/config.h'
|
78
|
+
|
79
|
+
def check_program
|
80
|
+
f_base_name = 'rakeconf'
|
81
|
+
begin
|
82
|
+
File.open( "#{f_base_name}.cc", 'w' ) { |f| yield f }
|
83
|
+
`#{CXX} -S #{$CXXFLAGS} -c -o #{f_base_name}.o #{f_base_name}.cc 2>&1 >> rake.log`
|
84
|
+
$?.exitstatus == 0
|
85
|
+
ensure
|
86
|
+
File.delete *Dir.glob( "#{f_base_name}.*" )
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def check_c_header( name )
|
91
|
+
check_program do |c|
|
92
|
+
c.puts <<EOS
|
93
|
+
extern "C" {
|
94
|
+
#include <#{name}>
|
95
|
+
}
|
96
|
+
int main(void) { return 0; }
|
97
|
+
EOS
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
file 'ext/config.h' do |t|
|
102
|
+
s = "/* config.h. Generated from Rakefile by rake. */\n"
|
103
|
+
# need to compile with -D__STDC_CONSTANT_MACROS
|
104
|
+
if check_c_header 'libswscale/swscale.h'
|
105
|
+
s << "#define HAVE_LIBSWSCALE_INCDIR 1\n"
|
106
|
+
else
|
107
|
+
unless check_c_header 'ffmpeg/swscale.h'
|
108
|
+
raise 'Cannot find swscale.h header file'
|
109
|
+
end
|
110
|
+
s << "#undef HAVE_LIBSWSCALE_INCDIR\n"
|
111
|
+
end
|
112
|
+
File.open( t.name, 'w' ) { |f| f.puts s }
|
113
|
+
end
|
114
|
+
|
76
115
|
Rake::TestTask.new do |t|
|
77
116
|
t.libs << 'ext'
|
78
117
|
t.test_files = TC_FILES
|
@@ -172,8 +211,8 @@ rule '.o' => '.cc' do |t|
|
|
172
211
|
sh "#{CXX} #{$CXXFLAGS} -c -o #{t.name} #{t.source}"
|
173
212
|
end
|
174
213
|
|
175
|
-
file ".depends.mf" do |t|
|
176
|
-
sh "g++ -MM #{
|
214
|
+
file ".depends.mf" => :config_h do |t|
|
215
|
+
sh "g++ -MM #{CC_FILES.join ' '} | " +
|
177
216
|
"sed -e :a -e N -e 's/\\n/\\$/g' -e ta | " +
|
178
217
|
"sed -e 's/ *\\\\\\$ */ /g' -e 's/\\$/\\n/g' | sed -e 's/^/ext\\//' > #{t.name}"
|
179
218
|
end
|
@@ -183,5 +222,5 @@ end
|
|
183
222
|
import ".depends.mf"
|
184
223
|
|
185
224
|
CLEAN.include 'ext/*.o'
|
186
|
-
CLOBBER.include SO_FILE, 'doc', '.yardoc', '.depends.mf'
|
225
|
+
CLOBBER.include SO_FILE, 'doc', '.yardoc', '.depends.mf', 'ext/config.h'
|
187
226
|
|
data/ext/xvwidget.cc
CHANGED
@@ -13,6 +13,16 @@
|
|
13
13
|
|
14
14
|
You should have received a copy of the GNU General Public License
|
15
15
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
16
|
+
#ifdef HAVE_CONFIG_H
|
17
|
+
#include "config.h"
|
18
|
+
#endif
|
19
|
+
extern "C" {
|
20
|
+
#ifndef HAVE_LIBSWSCALE_INCDIR
|
21
|
+
#include <ffmpeg/swscale.h>
|
22
|
+
#else
|
23
|
+
#include <libswscale/swscale.h>
|
24
|
+
#endif
|
25
|
+
}
|
16
26
|
#ifndef NDEBUG
|
17
27
|
#include <iostream>
|
18
28
|
#include <iomanip>
|
@@ -325,38 +335,28 @@ FramePtr XvManager::alignYV12( FramePtr frame )
|
|
325
335
|
#endif
|
326
336
|
FramePtr dest( new Frame( "YV12",
|
327
337
|
m_xvImage->width, m_xvImage->height ) );
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
dest_u++;
|
351
|
-
dest_v++;
|
352
|
-
};
|
353
|
-
src_y += 2 * widtha - width;
|
354
|
-
src_v += width2a - width2;
|
355
|
-
src_u += width2a - width2;
|
356
|
-
dest_y += 2 * m_xvImage->pitches[0] - width;
|
357
|
-
dest_v += m_xvImage->pitches[1] - width2;
|
358
|
-
dest_u += m_xvImage->pitches[2] - width2;
|
359
|
-
};
|
338
|
+
uint8_t *sourceData[4];
|
339
|
+
int sourceLineSize[4];
|
340
|
+
sourceData[0] = (uint8_t *)frame->data();
|
341
|
+
sourceData[2] = (uint8_t *)frame->data() + widtha * height;
|
342
|
+
sourceData[1] = (uint8_t *)sourceData[2] + width2a * height2;
|
343
|
+
sourceLineSize[0] = widtha;
|
344
|
+
sourceLineSize[1] = width2a;
|
345
|
+
sourceLineSize[2] = width2a;
|
346
|
+
uint8_t *destData[4];
|
347
|
+
int destLineSize[4];
|
348
|
+
destData[0] = (uint8_t *)dest->data();
|
349
|
+
destData[2] = (uint8_t *)dest->data() + m_xvImage->offsets[1];
|
350
|
+
destData[1] = (uint8_t *)dest->data() + m_xvImage->offsets[2];
|
351
|
+
destLineSize[0] = m_xvImage->pitches[0];
|
352
|
+
destLineSize[1] = m_xvImage->pitches[2];
|
353
|
+
destLineSize[2] = m_xvImage->pitches[1];
|
354
|
+
SwsContext *swsContext = sws_getContext( width, height, PIX_FMT_YUV420P,
|
355
|
+
width, height, PIX_FMT_YUV420P,
|
356
|
+
SWS_FAST_BILINEAR, 0, 0, 0 );
|
357
|
+
sws_scale( swsContext, sourceData, sourceLineSize, 0,
|
358
|
+
height, destData, destLineSize );
|
359
|
+
sws_freeContext( swsContext );
|
360
360
|
retVal = dest;
|
361
361
|
} else
|
362
362
|
retVal = frame;
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jan Wedekind
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-12-21 00:00:00 +00:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|