hornetseye-ffmpeg 0.10.0 → 0.11.0
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 +1 -1
- data/ext/avinput.cc +31 -18
- data/ext/avinput.hh +2 -0
- data/lib/hornetseye-ffmpeg/avinput.rb +3 -1
- metadata +4 -25
data/Rakefile
CHANGED
data/ext/avinput.cc
CHANGED
@@ -52,20 +52,27 @@ AVInput::AVInput( const string &mrl, bool audio ) throw (Error):
|
|
52
52
|
cerr << "Video stream index is " << m_videoStream << endl;
|
53
53
|
cerr << "Audio stream index is " << m_audioStream << endl;
|
54
54
|
#endif
|
55
|
-
|
56
|
-
|
57
|
-
m_videoDec
|
55
|
+
if ( m_videoStream >= 0 )
|
56
|
+
m_videoDec = m_ic->streams[ m_videoStream ]->codec;
|
57
|
+
if ( m_videoDec != NULL ) {
|
58
|
+
m_videoCodec = avcodec_find_decoder( m_videoDec->codec_id );
|
59
|
+
ERRORMACRO( m_videoCodec != NULL, Error, , "Could not find video decoder for "
|
60
|
+
"file \"" << mrl << "\"" );
|
61
|
+
err = avcodec_open( m_videoDec, m_videoCodec );
|
62
|
+
if ( err < 0 ) {
|
63
|
+
m_videoCodec = NULL;
|
64
|
+
ERRORMACRO( false, Error, , "Error opening video codec for file \""
|
65
|
+
<< mrl << "\": " << strerror( errno ) );
|
66
|
+
};
|
67
|
+
m_swsContext = sws_getContext( m_videoDec->width, m_videoDec->height,
|
68
|
+
m_videoDec->pix_fmt,
|
69
|
+
m_videoDec->width, m_videoDec->height,
|
70
|
+
PIX_FMT_YUV420P, SWS_FAST_BILINEAR, 0, 0, 0 );
|
71
|
+
m_avFrame = avcodec_alloc_frame();
|
72
|
+
ERRORMACRO( m_avFrame, Error, , "Error allocating frame" );
|
73
|
+
};
|
58
74
|
if ( m_audioStream >= 0 )
|
59
75
|
m_audioDec = m_ic->streams[ m_audioStream ]->codec;
|
60
|
-
m_videoCodec = avcodec_find_decoder( m_videoDec->codec_id );
|
61
|
-
ERRORMACRO( m_videoCodec != NULL, Error, , "Could not find video decoder for "
|
62
|
-
"file \"" << mrl << "\"" );
|
63
|
-
err = avcodec_open( m_videoDec, m_videoCodec );
|
64
|
-
if ( err < 0 ) {
|
65
|
-
m_videoCodec = NULL;
|
66
|
-
ERRORMACRO( false, Error, , "Error opening video codec for file \""
|
67
|
-
<< mrl << "\": " << strerror( errno ) );
|
68
|
-
};
|
69
76
|
if ( m_audioDec != NULL ) {
|
70
77
|
m_audioCodec = avcodec_find_decoder( m_audioDec->codec_id );
|
71
78
|
ERRORMACRO( m_audioCodec != NULL, Error, , "Could not find audio decoder for "
|
@@ -77,12 +84,6 @@ AVInput::AVInput( const string &mrl, bool audio ) throw (Error):
|
|
77
84
|
<< mrl << "\": " << strerror( errno ) );
|
78
85
|
};
|
79
86
|
};
|
80
|
-
m_swsContext = sws_getContext( m_videoDec->width, m_videoDec->height,
|
81
|
-
m_videoDec->pix_fmt,
|
82
|
-
m_videoDec->width, m_videoDec->height,
|
83
|
-
PIX_FMT_YUV420P, SWS_FAST_BILINEAR, 0, 0, 0 );
|
84
|
-
m_avFrame = avcodec_alloc_frame();
|
85
|
-
ERRORMACRO( m_avFrame, Error, , "Error allocating frame" );
|
86
87
|
} catch ( Error &e ) {
|
87
88
|
close();
|
88
89
|
throw e;
|
@@ -228,6 +229,11 @@ int AVInput::height(void) const throw (Error)
|
|
228
229
|
return m_videoDec->height;
|
229
230
|
}
|
230
231
|
|
232
|
+
bool AVInput::hasVideo(void) const
|
233
|
+
{
|
234
|
+
return m_videoStream != -1;
|
235
|
+
}
|
236
|
+
|
231
237
|
bool AVInput::hasAudio(void) const
|
232
238
|
{
|
233
239
|
return m_audioStream != -1;
|
@@ -346,6 +352,7 @@ VALUE AVInput::registerRubyClass( VALUE rbModule )
|
|
346
352
|
rb_define_method( cRubyClass, "width", RUBY_METHOD_FUNC( wrapWidth ), 0 );
|
347
353
|
rb_define_method( cRubyClass, "height", RUBY_METHOD_FUNC( wrapHeight ), 0 );
|
348
354
|
rb_define_method( cRubyClass, "has_audio?", RUBY_METHOD_FUNC( wrapHasAudio ), 0 );
|
355
|
+
rb_define_method( cRubyClass, "has_video?", RUBY_METHOD_FUNC( wrapHasVideo ), 0 );
|
349
356
|
rb_define_method( cRubyClass, "seek", RUBY_METHOD_FUNC( wrapSeek ), 1 );
|
350
357
|
rb_define_method( cRubyClass, "video_pts", RUBY_METHOD_FUNC( wrapVideoPTS ), 0 );
|
351
358
|
rb_define_method( cRubyClass, "audio_pts", RUBY_METHOD_FUNC( wrapAudioPTS ), 0 );
|
@@ -546,6 +553,12 @@ VALUE AVInput::wrapHeight( VALUE rbSelf )
|
|
546
553
|
return retVal;
|
547
554
|
}
|
548
555
|
|
556
|
+
VALUE AVInput::wrapHasVideo( VALUE rbSelf )
|
557
|
+
{
|
558
|
+
AVInputPtr *self; Data_Get_Struct( rbSelf, AVInputPtr, self );
|
559
|
+
return (*self)->hasVideo() ? Qtrue : Qfalse;
|
560
|
+
}
|
561
|
+
|
549
562
|
VALUE AVInput::wrapHasAudio( VALUE rbSelf )
|
550
563
|
{
|
551
564
|
AVInputPtr *self; Data_Get_Struct( rbSelf, AVInputPtr, self );
|
data/ext/avinput.hh
CHANGED
@@ -48,6 +48,7 @@ public:
|
|
48
48
|
bool status(void) const;
|
49
49
|
int width(void) const throw (Error);
|
50
50
|
int height(void) const throw (Error);
|
51
|
+
bool hasVideo(void) const;
|
51
52
|
bool hasAudio(void) const;
|
52
53
|
AVRational videoTimeBase(void) throw (Error);
|
53
54
|
AVRational audioTimeBase(void) throw (Error);
|
@@ -80,6 +81,7 @@ public:
|
|
80
81
|
static VALUE wrapAudioStartTime( VALUE rbSelf );
|
81
82
|
static VALUE wrapWidth( VALUE rbSelf );
|
82
83
|
static VALUE wrapHeight( VALUE rbSelf );
|
84
|
+
static VALUE wrapHasVideo( VALUE rbSelf );
|
83
85
|
static VALUE wrapHasAudio( VALUE rbSelf );
|
84
86
|
static VALUE wrapSeek( VALUE rbSelf, VALUE rbPos );
|
85
87
|
static VALUE wrapVideoPTS( VALUE rbSelf );
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hornetseye-ffmpeg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 10
|
8
|
-
- 0
|
9
|
-
version: 0.10.0
|
4
|
+
prerelease:
|
5
|
+
version: 0.11.0
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Jan Wedekind
|
@@ -14,8 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date: 2011-
|
18
|
-
default_executable:
|
13
|
+
date: 2011-08-02 00:00:00 Z
|
19
14
|
dependencies:
|
20
15
|
- !ruby/object:Gem::Dependency
|
21
16
|
name: malloc
|
@@ -25,9 +20,6 @@ dependencies:
|
|
25
20
|
requirements:
|
26
21
|
- - ~>
|
27
22
|
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 1
|
30
|
-
- 2
|
31
23
|
version: "1.2"
|
32
24
|
type: :runtime
|
33
25
|
version_requirements: *id001
|
@@ -39,9 +31,6 @@ dependencies:
|
|
39
31
|
requirements:
|
40
32
|
- - ~>
|
41
33
|
- !ruby/object:Gem::Version
|
42
|
-
segments:
|
43
|
-
- 0
|
44
|
-
- 23
|
45
34
|
version: "0.23"
|
46
35
|
type: :runtime
|
47
36
|
version_requirements: *id002
|
@@ -53,9 +42,6 @@ dependencies:
|
|
53
42
|
requirements:
|
54
43
|
- - ~>
|
55
44
|
- !ruby/object:Gem::Version
|
56
|
-
segments:
|
57
|
-
- 0
|
58
|
-
- 11
|
59
45
|
version: "0.11"
|
60
46
|
type: :runtime
|
61
47
|
version_requirements: *id003
|
@@ -67,8 +53,6 @@ dependencies:
|
|
67
53
|
requirements:
|
68
54
|
- - ">="
|
69
55
|
- !ruby/object:Gem::Version
|
70
|
-
segments:
|
71
|
-
- 0
|
72
56
|
version: "0"
|
73
57
|
type: :development
|
74
58
|
version_requirements: *id004
|
@@ -99,7 +83,6 @@ files:
|
|
99
83
|
- ext/error.hh
|
100
84
|
- ext/rubyinc.hh
|
101
85
|
- ext/avoutput.hh
|
102
|
-
has_rdoc: yard
|
103
86
|
homepage: http://wedesoft.github.com/hornetseye-ffmpeg/
|
104
87
|
licenses: []
|
105
88
|
|
@@ -114,21 +97,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
114
97
|
requirements:
|
115
98
|
- - ">="
|
116
99
|
- !ruby/object:Gem::Version
|
117
|
-
segments:
|
118
|
-
- 0
|
119
100
|
version: "0"
|
120
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
102
|
none: false
|
122
103
|
requirements:
|
123
104
|
- - ">="
|
124
105
|
- !ruby/object:Gem::Version
|
125
|
-
segments:
|
126
|
-
- 0
|
127
106
|
version: "0"
|
128
107
|
requirements: []
|
129
108
|
|
130
109
|
rubyforge_project: hornetseye
|
131
|
-
rubygems_version: 1.
|
110
|
+
rubygems_version: 1.8.5
|
132
111
|
signing_key:
|
133
112
|
specification_version: 3
|
134
113
|
summary: Read/write video frames using libffmpeg
|