ffi-libav 0.1.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.
@@ -0,0 +1,27 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+ .*.sw[a-z]
15
+ Gemfile.lock
16
+
17
+ # YARD artifacts
18
+ .yardoc
19
+ _yardoc
20
+ doc/
21
+
22
+ # ffi-swig-generator intermediate XML files
23
+ lib/ffi/*.xml
24
+
25
+ # OSX artifacts
26
+ .AppleDouble
27
+ .DS_Store
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ffi-libav.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem 'pry'
8
+ gem 'ffi-swig-generator',
9
+ :git => 'https://github.com/ffi/ffi-swig-generator.git'
10
+ end
data/LICENSE ADDED
@@ -0,0 +1,27 @@
1
+ Copyright (c) 2014, David M. Lary
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+
10
+ * Redistributions in binary form must reproduce the above copyright notice, this
11
+ list of conditions and the following disclaimer in the documentation and/or
12
+ other materials provided with the distribution.
13
+
14
+ * Neither the name of the {organization} nor the names of its
15
+ contributors may be used to endorse or promote products derived from
16
+ this software without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
22
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,47 @@
1
+ # FFI::Libav
2
+
3
+ Ruby FFI bindings and wrappers for Libav libraries, version 0.8.6.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'ffi-libav'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install ffi-libav
18
+
19
+ ## Usage
20
+
21
+ ```ruby
22
+ require 'ffi-ffmpeg'
23
+
24
+ # Allocate a reader for our video file
25
+ reader = FFmpeg::Reader.new(ARGV[0])
26
+
27
+ # Dump the format information for the file
28
+ reader.dump_format
29
+
30
+ # Grab the first video stream in the file
31
+ stream = reader.streams.select { |s| s.type == :video }.first
32
+
33
+ # Loop through the key frames for the first video stream
34
+ stream.each_frame do |frame|
35
+ # Do something interesting with the frame...
36
+ # pixel data is in frame.data, linesizes are in frame.linesize
37
+ end
38
+ ```
39
+
40
+ ## Contributing
41
+
42
+ 1. Fork it ( http://github.com/<my-github-username>/ffi-libav/fork )
43
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
44
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
45
+ 4. Push to the branch (`git push origin my-new-feature`)
46
+ 5. Create new Pull Request
47
+
@@ -0,0 +1,9 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ rule ".rb" => ".xml" do |t|
4
+ sh "../ffi-swig-generator/bin/ffi-gen #{t.prerequisites.first} #{t.name}"
5
+ end
6
+
7
+ rule ".xml" => ".i" do |t|
8
+ sh "swig -I/usr/include -xml -o #{t.source.sub(/\.i$/, ".xml")} #{t.source}"
9
+ end
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $: << File.join(File.dirname(__FILE__), "..", "lib")
4
+ require 'ffi-libav'
5
+
6
+ def write_frame(filename, frame)
7
+ file = File.new(filename, "w")
8
+ file.write "P6\n%d %d\n255\n" % [frame.width, frame.height]
9
+
10
+ data = frame.av_frame[:data][0]
11
+ linesize = frame.av_frame[:linesize][0]
12
+ bytes_per_row = 3 * frame.width
13
+
14
+ frame.height.times do |row|
15
+ file.write data.slice(row * linesize, bytes_per_row)\
16
+ .read_string_length(bytes_per_row)
17
+ end
18
+ file.close
19
+ end
20
+
21
+ # Open our video file
22
+ reader = Libav::Reader.new(ARGV[0], :pixel_format => :rgb24)
23
+
24
+ reader.dump_format
25
+ # Find the first video stream
26
+ stream = reader.streams.select { |s| s.discard = :all; s.type == :video } .first
27
+
28
+ # Tell the library to discard all non-key frames
29
+ stream.discard = :nonkey
30
+
31
+ # Write the first five key frames to disk
32
+ 5.times do |i|
33
+ frame = stream.next_frame
34
+ write_frame("image-%d.ppm" % i, frame)
35
+ puts "wrote frame %d" % frame.number
36
+ end
37
+
38
+ stream.pixel_format = :gray8
39
+
40
+ # Write the first five key frames to disk
41
+ 5.times do |i|
42
+ frame = stream.next_frame
43
+ scaled = frame.scale(:width => 100, :height => 100, :pixel_format => :rgb24)
44
+ write_frame("small-%d.ppm" % i, scaled)
45
+ puts "wrote small frame %d" % scaled.number
46
+ end
47
+
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $: << File.join(File.dirname(__FILE__), "..", "lib")
4
+ require 'ffi-libav'
5
+ require 'pp'
6
+
7
+ def format_seconds(s)
8
+ s = s.to_i
9
+ h = s/3600
10
+ s -= h * 3600
11
+ m = s/60
12
+ s -= m * 60
13
+ "%02d:%02d:%02d" % [ h, m, s ]
14
+ end
15
+
16
+ GLYPHS = %w{ | / - \\ }
17
+ @first = nil
18
+ @last = nil
19
+ @calls = 0
20
+ def spin(frame)
21
+ now = Time.now()
22
+ @first ||= now
23
+ @last ||= now
24
+
25
+ @calls += 1
26
+
27
+ if (@last + 0.25 < now)
28
+ fps = @calls.to_f / (now - @first)
29
+ pos = frame.number / frame.stream.fps.to_f
30
+ printf("\r[%s] %0.03f fps, frame: %d, pts %d, pos: %s",
31
+ format_seconds(now - @first), fps, frame.number, frame.pts,
32
+ format_seconds(pos))
33
+ @last = now
34
+ end
35
+ end
36
+
37
+ # open our video file
38
+ reader = Libav::Reader.new(ARGV[0])
39
+ reader.dump_format
40
+
41
+ # Find the first video stream
42
+ reader.streams.each { |s| s.discard == :all }
43
+ stream = reader.default_stream
44
+ stream.discard = :default
45
+ # stream.buffer_size = 2
46
+ stream.each_frame { |frame| spin frame}
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pp'
4
+ $: << File.join(File.dirname(__FILE__), "..", "lib")
5
+ require 'ffi-libav'
6
+
7
+ def write_frame(filename, frame)
8
+ file = File.new(filename, "w")
9
+ file.write "P6\n%d %d\n255\n" % [frame.width, frame.height]
10
+
11
+ data = frame.data[0]
12
+ linesize = frame.linesize[0]
13
+ bytes_per_row = 3 * frame.width
14
+
15
+ frame.height.times do |row|
16
+ file.write data.slice(row * linesize, bytes_per_row)\
17
+ .read_string_length(bytes_per_row)
18
+ end
19
+ file.close
20
+ end
21
+
22
+ # Open our video file
23
+ reader = Libav::Reader.new(ARGV[0], :pixel_format => :rgb24)
24
+ stream = reader.default_stream
25
+
26
+ # Find the first video stream
27
+ reader.streams.each { |s| s.discard = :all unless s == stream }
28
+ stream.discard = :nonkey
29
+
30
+ count = ARGV[1] ? ARGV[1].to_i : 10
31
+ step = File.size(ARGV[0]) / (count + 2)
32
+
33
+ count.times do |i|
34
+ i += 1
35
+ puts "Seeking to %d" % (i * step)
36
+ stream.seek(:pos => i * step)
37
+
38
+ frame = stream.next_frame
39
+ pp :frame => frame.pts
40
+
41
+ # For some reason, when working on MPEG-TS files, following the seek,
42
+ # the packet DTS of the next packet read is -1 * AV_NOPTS_VALUE. When
43
+ # we save that frame it looks like a stale buffer. So we want to skip
44
+ # the frame if the pts is this value. Also only accept key frames.
45
+ until frame.key_frame? # and frame.pts == 0
46
+ frame = stream.next_frame
47
+ end
48
+ puts "Saving frame %d, pts %d" % [ frame.number, frame.pts ]
49
+ write_frame("seek-%02d.ppm" % i, frame)
50
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'libav/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ffi-libav"
8
+ spec.version = Libav::VERSION
9
+ spec.authors = ["David M. Lary"]
10
+ spec.email = ["dmlary@gmail.com"]
11
+ spec.summary = %q{Ruby FFI bindings and wrapper for Libav}
12
+ spec.homepage = "https://github.com/dmlary/ffi-libav"
13
+ spec.license = "BSD 3-Clause"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.5"
21
+ spec.add_development_dependency "rake"
22
+ spec.add_dependency "ffi"
23
+ end
@@ -0,0 +1,47 @@
1
+ require 'ffi/libav'
2
+ require 'libav/version'
3
+ require 'libav/frame'
4
+ require 'libav/stream'
5
+ require 'libav/reader'
6
+
7
+ module Libav
8
+
9
+ private
10
+
11
+ @@registered_all = false
12
+ def self.register_all
13
+ return if @@registered_all
14
+ FFI::Libav.av_register_all
15
+ @@registered_all = true
16
+ end
17
+ end
18
+
19
+ class String
20
+ def hexdump
21
+ buf = ""
22
+ offset = 0
23
+ words = self.unpack("N%d" % (self.length/4.0).ceil)
24
+ until words.empty?
25
+ line = words.shift(4).compact
26
+ buf += sprintf("[%04x] " + ("%08x " * line.size) + "|%s|\n",
27
+ offset * 16, *line,
28
+ line.pack("N%d" % line.size).tr("^\040-\176","."))
29
+ offset += 1
30
+ end
31
+ buf
32
+ end unless String.instance_methods.include? :hexdump
33
+ end
34
+
35
+ class FFI::Struct
36
+ def to_hash
37
+ return {} if pointer.null?
38
+
39
+ members.inject({}) { |h,k| h[k] = send(:[], k); h }
40
+ end unless FFI::Struct.instance_methods.include? :to_hash
41
+
42
+ def to_hexdump
43
+ self.pointer.read_bytes(self.size).hexdump
44
+ end
45
+ end
46
+
47
+
@@ -0,0 +1,55 @@
1
+ %module avcodec
2
+ %{
3
+ require 'ffi'
4
+
5
+ module FFI::Libav
6
+ extend FFI::Library
7
+
8
+ ffi_lib [ "libavutil.so.51", "libavutil.51.dylib" ]
9
+
10
+ %}
11
+
12
+ #define INT64_C(v) v
13
+ #define av_const
14
+ %include "libavutil/avutil.h"
15
+ %include "libavutil/pixfmt.h"
16
+ %include "libavutil/rational.h"
17
+ %include "libavutil/mem.h"
18
+ %include "libavutil/attributes.h"
19
+
20
+ %{
21
+
22
+ ffi_lib [ "libavcodec.so.53", "libavcodec.53.dylib" ]
23
+
24
+ %}
25
+
26
+ /*
27
+ #define attribute_deprecated
28
+ #define av_printf_format(a,b)
29
+ #define INT64_C(v) v
30
+ */
31
+ %include "libavcodec/version.h"
32
+ %include "libavcodec/avcodec.h"
33
+
34
+ %{
35
+
36
+ ffi_lib [ "libavformat.so.53", "libavformat.53.dylib" ]
37
+
38
+ %}
39
+
40
+ #define av_always_inline inline
41
+ %include "libavformat/avio.h"
42
+ %include "libavformat/version.h"
43
+ %include "libavformat/avformat.h"
44
+
45
+ %{
46
+
47
+ ffi_lib [ "libswscale.so.2", "libswscale.2.dylib" ]
48
+
49
+ %}
50
+
51
+ %include "libswscale/swscale.h"
52
+
53
+ %{
54
+ end
55
+ %}
@@ -0,0 +1,3034 @@
1
+
2
+ require 'ffi'
3
+
4
+ module FFI::Libav
5
+ extend FFI::Library
6
+
7
+ ffi_lib [ "libavutil.so.51", "libavutil.51.dylib" ]
8
+
9
+ LIBAVUTIL_VERSION_MAJOR = 51
10
+ LIBAVUTIL_VERSION_MINOR = 22
11
+ LIBAVUTIL_VERSION_MICRO = 1
12
+ LIBAVUTIL_VERSION_INT = (51 << 16|22 << 8|1)
13
+ LIBAVUTIL_BUILD = (51 << 16|22 << 8|1)
14
+ LIBAVUTIL_IDENT = 'Lavu51.22.1'
15
+ attach_function :avutil_version, :avutil_version, [ ], :uint
16
+ attach_function :avutil_configuration, :avutil_configuration, [ ], :string
17
+ attach_function :avutil_license, :avutil_license, [ ], :string
18
+ AVMEDIA_TYPE_UNKNOWN = -1
19
+ AVMEDIA_TYPE_VIDEO = AVMEDIA_TYPE_UNKNOWN + 1
20
+ AVMEDIA_TYPE_AUDIO = AVMEDIA_TYPE_VIDEO + 1
21
+ AVMEDIA_TYPE_DATA = AVMEDIA_TYPE_AUDIO + 1
22
+ AVMEDIA_TYPE_SUBTITLE = AVMEDIA_TYPE_DATA + 1
23
+ AVMEDIA_TYPE_ATTACHMENT = AVMEDIA_TYPE_SUBTITLE + 1
24
+ AVMEDIA_TYPE_NB = AVMEDIA_TYPE_ATTACHMENT + 1
25
+ AVMediaType = enum :AVMediaType, [
26
+ :unknown, -1,
27
+ :video,
28
+ :audio,
29
+ :data,
30
+ :subtitle,
31
+ :attachment,
32
+ :nb,
33
+ ]
34
+
35
+ FF_LAMBDA_SHIFT = 7
36
+ FF_LAMBDA_SCALE = (1 << 7)
37
+ FF_QP2LAMBDA = 118
38
+ FF_LAMBDA_MAX = (256*128-1)
39
+ FF_QUALITY_SCALE = (1 << 7)
40
+ AV_NOPTS_VALUE = 0x8000000000000000
41
+ AV_TIME_BASE = 1000000
42
+ AV_PICTURE_TYPE_I = 1
43
+ AV_PICTURE_TYPE_P = AV_PICTURE_TYPE_I + 1
44
+ AV_PICTURE_TYPE_B = AV_PICTURE_TYPE_P + 1
45
+ AV_PICTURE_TYPE_S = AV_PICTURE_TYPE_B + 1
46
+ AV_PICTURE_TYPE_SI = AV_PICTURE_TYPE_S + 1
47
+ AV_PICTURE_TYPE_SP = AV_PICTURE_TYPE_SI + 1
48
+ AV_PICTURE_TYPE_BI = AV_PICTURE_TYPE_SP + 1
49
+ AVPictureType = enum :AVPictureType, [
50
+ :i, 1,
51
+ :p,
52
+ :b,
53
+ :s,
54
+ :si,
55
+ :sp,
56
+ :bi,
57
+ ]
58
+
59
+ attach_function :av_get_picture_type_char, :av_get_picture_type_char, [ AVPictureType ], :char
60
+ PIX_FMT_NONE = -1
61
+ PIX_FMT_YUV420P = PIX_FMT_NONE + 1
62
+ PIX_FMT_YUYV422 = PIX_FMT_YUV420P + 1
63
+ PIX_FMT_RGB24 = PIX_FMT_YUYV422 + 1
64
+ PIX_FMT_BGR24 = PIX_FMT_RGB24 + 1
65
+ PIX_FMT_YUV422P = PIX_FMT_BGR24 + 1
66
+ PIX_FMT_YUV444P = PIX_FMT_YUV422P + 1
67
+ PIX_FMT_YUV410P = PIX_FMT_YUV444P + 1
68
+ PIX_FMT_YUV411P = PIX_FMT_YUV410P + 1
69
+ PIX_FMT_GRAY8 = PIX_FMT_YUV411P + 1
70
+ PIX_FMT_MONOWHITE = PIX_FMT_GRAY8 + 1
71
+ PIX_FMT_MONOBLACK = PIX_FMT_MONOWHITE + 1
72
+ PIX_FMT_PAL8 = PIX_FMT_MONOBLACK + 1
73
+ PIX_FMT_YUVJ420P = PIX_FMT_PAL8 + 1
74
+ PIX_FMT_YUVJ422P = PIX_FMT_YUVJ420P + 1
75
+ PIX_FMT_YUVJ444P = PIX_FMT_YUVJ422P + 1
76
+ PIX_FMT_XVMC_MPEG2_MC = PIX_FMT_YUVJ444P + 1
77
+ PIX_FMT_XVMC_MPEG2_IDCT = PIX_FMT_XVMC_MPEG2_MC + 1
78
+ PIX_FMT_UYVY422 = PIX_FMT_XVMC_MPEG2_IDCT + 1
79
+ PIX_FMT_UYYVYY411 = PIX_FMT_UYVY422 + 1
80
+ PIX_FMT_BGR8 = PIX_FMT_UYYVYY411 + 1
81
+ PIX_FMT_BGR4 = PIX_FMT_BGR8 + 1
82
+ PIX_FMT_BGR4_BYTE = PIX_FMT_BGR4 + 1
83
+ PIX_FMT_RGB8 = PIX_FMT_BGR4_BYTE + 1
84
+ PIX_FMT_RGB4 = PIX_FMT_RGB8 + 1
85
+ PIX_FMT_RGB4_BYTE = PIX_FMT_RGB4 + 1
86
+ PIX_FMT_NV12 = PIX_FMT_RGB4_BYTE + 1
87
+ PIX_FMT_NV21 = PIX_FMT_NV12 + 1
88
+ PIX_FMT_ARGB = PIX_FMT_NV21 + 1
89
+ PIX_FMT_RGBA = PIX_FMT_ARGB + 1
90
+ PIX_FMT_ABGR = PIX_FMT_RGBA + 1
91
+ PIX_FMT_BGRA = PIX_FMT_ABGR + 1
92
+ PIX_FMT_GRAY16BE = PIX_FMT_BGRA + 1
93
+ PIX_FMT_GRAY16LE = PIX_FMT_GRAY16BE + 1
94
+ PIX_FMT_YUV440P = PIX_FMT_GRAY16LE + 1
95
+ PIX_FMT_YUVJ440P = PIX_FMT_YUV440P + 1
96
+ PIX_FMT_YUVA420P = PIX_FMT_YUVJ440P + 1
97
+ PIX_FMT_VDPAU_H264 = PIX_FMT_YUVA420P + 1
98
+ PIX_FMT_VDPAU_MPEG1 = PIX_FMT_VDPAU_H264 + 1
99
+ PIX_FMT_VDPAU_MPEG2 = PIX_FMT_VDPAU_MPEG1 + 1
100
+ PIX_FMT_VDPAU_WMV3 = PIX_FMT_VDPAU_MPEG2 + 1
101
+ PIX_FMT_VDPAU_VC1 = PIX_FMT_VDPAU_WMV3 + 1
102
+ PIX_FMT_RGB48BE = PIX_FMT_VDPAU_VC1 + 1
103
+ PIX_FMT_RGB48LE = PIX_FMT_RGB48BE + 1
104
+ PIX_FMT_RGB565BE = PIX_FMT_RGB48LE + 1
105
+ PIX_FMT_RGB565LE = PIX_FMT_RGB565BE + 1
106
+ PIX_FMT_RGB555BE = PIX_FMT_RGB565LE + 1
107
+ PIX_FMT_RGB555LE = PIX_FMT_RGB555BE + 1
108
+ PIX_FMT_BGR565BE = PIX_FMT_RGB555LE + 1
109
+ PIX_FMT_BGR565LE = PIX_FMT_BGR565BE + 1
110
+ PIX_FMT_BGR555BE = PIX_FMT_BGR565LE + 1
111
+ PIX_FMT_BGR555LE = PIX_FMT_BGR555BE + 1
112
+ PIX_FMT_VAAPI_MOCO = PIX_FMT_BGR555LE + 1
113
+ PIX_FMT_VAAPI_IDCT = PIX_FMT_VAAPI_MOCO + 1
114
+ PIX_FMT_VAAPI_VLD = PIX_FMT_VAAPI_IDCT + 1
115
+ PIX_FMT_YUV420P16LE = PIX_FMT_VAAPI_VLD + 1
116
+ PIX_FMT_YUV420P16BE = PIX_FMT_YUV420P16LE + 1
117
+ PIX_FMT_YUV422P16LE = PIX_FMT_YUV420P16BE + 1
118
+ PIX_FMT_YUV422P16BE = PIX_FMT_YUV422P16LE + 1
119
+ PIX_FMT_YUV444P16LE = PIX_FMT_YUV422P16BE + 1
120
+ PIX_FMT_YUV444P16BE = PIX_FMT_YUV444P16LE + 1
121
+ PIX_FMT_VDPAU_MPEG4 = PIX_FMT_YUV444P16BE + 1
122
+ PIX_FMT_DXVA2_VLD = PIX_FMT_VDPAU_MPEG4 + 1
123
+ PIX_FMT_RGB444LE = PIX_FMT_DXVA2_VLD + 1
124
+ PIX_FMT_RGB444BE = PIX_FMT_RGB444LE + 1
125
+ PIX_FMT_BGR444LE = PIX_FMT_RGB444BE + 1
126
+ PIX_FMT_BGR444BE = PIX_FMT_BGR444LE + 1
127
+ PIX_FMT_Y400A = PIX_FMT_BGR444BE + 1
128
+ PIX_FMT_BGR48BE = PIX_FMT_Y400A + 1
129
+ PIX_FMT_BGR48LE = PIX_FMT_BGR48BE + 1
130
+ PIX_FMT_YUV420P9BE = PIX_FMT_BGR48LE + 1
131
+ PIX_FMT_YUV420P9LE = PIX_FMT_YUV420P9BE + 1
132
+ PIX_FMT_YUV420P10BE = PIX_FMT_YUV420P9LE + 1
133
+ PIX_FMT_YUV420P10LE = PIX_FMT_YUV420P10BE + 1
134
+ PIX_FMT_YUV422P10BE = PIX_FMT_YUV420P10LE + 1
135
+ PIX_FMT_YUV422P10LE = PIX_FMT_YUV422P10BE + 1
136
+ PIX_FMT_YUV444P9BE = PIX_FMT_YUV422P10LE + 1
137
+ PIX_FMT_YUV444P9LE = PIX_FMT_YUV444P9BE + 1
138
+ PIX_FMT_YUV444P10BE = PIX_FMT_YUV444P9LE + 1
139
+ PIX_FMT_YUV444P10LE = PIX_FMT_YUV444P10BE + 1
140
+ PIX_FMT_YUV422P9BE = PIX_FMT_YUV444P10LE + 1
141
+ PIX_FMT_YUV422P9LE = PIX_FMT_YUV422P9BE + 1
142
+ PIX_FMT_VDA_VLD = PIX_FMT_YUV422P9LE + 1
143
+ PIX_FMT_GBRP = PIX_FMT_VDA_VLD + 1
144
+ PIX_FMT_GBRP9BE = PIX_FMT_GBRP + 1
145
+ PIX_FMT_GBRP9LE = PIX_FMT_GBRP9BE + 1
146
+ PIX_FMT_GBRP10BE = PIX_FMT_GBRP9LE + 1
147
+ PIX_FMT_GBRP10LE = PIX_FMT_GBRP10BE + 1
148
+ PIX_FMT_GBRP16BE = PIX_FMT_GBRP10LE + 1
149
+ PIX_FMT_GBRP16LE = PIX_FMT_GBRP16BE + 1
150
+ PIX_FMT_NB = PIX_FMT_GBRP16LE + 1
151
+ PixelFormat = enum :PixelFormat, [
152
+ :none, -1,
153
+ :yuv420p,
154
+ :yuyv422,
155
+ :rgb24,
156
+ :bgr24,
157
+ :yuv422p,
158
+ :yuv444p,
159
+ :yuv410p,
160
+ :yuv411p,
161
+ :gray8,
162
+ :monowhite,
163
+ :monoblack,
164
+ :pal8,
165
+ :yuvj420p,
166
+ :yuvj422p,
167
+ :yuvj444p,
168
+ :xvmc_mpeg2_mc,
169
+ :xvmc_mpeg2_idct,
170
+ :uyvy422,
171
+ :uyyvyy411,
172
+ :bgr8,
173
+ :bgr4,
174
+ :bgr4_byte,
175
+ :rgb8,
176
+ :rgb4,
177
+ :rgb4_byte,
178
+ :nv12,
179
+ :nv21,
180
+ :argb,
181
+ :rgba,
182
+ :abgr,
183
+ :bgra,
184
+ :gray16be,
185
+ :gray16le,
186
+ :yuv440p,
187
+ :yuvj440p,
188
+ :yuva420p,
189
+ :vdpau_h264,
190
+ :vdpau_mpeg1,
191
+ :vdpau_mpeg2,
192
+ :vdpau_wmv3,
193
+ :vdpau_vc1,
194
+ :rgb48be,
195
+ :rgb48le,
196
+ :rgb565be,
197
+ :rgb565le,
198
+ :rgb555be,
199
+ :rgb555le,
200
+ :bgr565be,
201
+ :bgr565le,
202
+ :bgr555be,
203
+ :bgr555le,
204
+ :vaapi_moco,
205
+ :vaapi_idct,
206
+ :vaapi_vld,
207
+ :yuv420p16le,
208
+ :yuv420p16be,
209
+ :yuv422p16le,
210
+ :yuv422p16be,
211
+ :yuv444p16le,
212
+ :yuv444p16be,
213
+ :vdpau_mpeg4,
214
+ :dxva2_vld,
215
+ :rgb444le,
216
+ :rgb444be,
217
+ :bgr444le,
218
+ :bgr444be,
219
+ :y400a,
220
+ :bgr48be,
221
+ :bgr48le,
222
+ :yuv420p9be,
223
+ :yuv420p9le,
224
+ :yuv420p10be,
225
+ :yuv420p10le,
226
+ :yuv422p10be,
227
+ :yuv422p10le,
228
+ :yuv444p9be,
229
+ :yuv444p9le,
230
+ :yuv444p10be,
231
+ :yuv444p10le,
232
+ :yuv422p9be,
233
+ :yuv422p9le,
234
+ :vda_vld,
235
+ :gbrp,
236
+ :gbrp9be,
237
+ :gbrp9le,
238
+ :gbrp10be,
239
+ :gbrp10le,
240
+ :gbrp16be,
241
+ :gbrp16le,
242
+ :nb,
243
+ ]
244
+
245
+ class AVRational < FFI::Struct
246
+ layout(
247
+ :num, :int,
248
+ :den, :int
249
+ )
250
+ def to_f
251
+ self[:num].to_f / self[:den]
252
+ end
253
+ end
254
+ # inline function av_cmp_q
255
+ # inline function av_q2d
256
+ attach_function :av_reduce, :av_reduce, [ :pointer, :pointer, :int64, :int64, :int64 ], :int
257
+ attach_function :av_mul_q, :av_mul_q, [ AVRational.by_value, AVRational.by_value ], AVRational.by_value
258
+ attach_function :av_div_q, :av_div_q, [ AVRational.by_value, AVRational.by_value ], AVRational.by_value
259
+ attach_function :av_add_q, :av_add_q, [ AVRational.by_value, AVRational.by_value ], AVRational.by_value
260
+ attach_function :av_sub_q, :av_sub_q, [ AVRational.by_value, AVRational.by_value ], AVRational.by_value
261
+ attach_function :av_d2q, :av_d2q, [ :double, :int ], AVRational.by_value
262
+ attach_function :av_nearer_q, :av_nearer_q, [ AVRational.by_value, AVRational.by_value, AVRational.by_value ], :int
263
+ attach_function :av_find_nearest_q_idx, :av_find_nearest_q_idx, [ AVRational.by_value, :pointer ], :int
264
+ attach_function :av_malloc, :av_malloc, [ :uint ], :pointer
265
+ attach_function :av_realloc, :av_realloc, [ :pointer, :uint ], :pointer
266
+ attach_function :av_free, :av_free, [ :pointer ], :void
267
+ attach_function :av_mallocz, :av_mallocz, [ :uint ], :pointer
268
+ attach_function :av_strdup, :av_strdup, [ :string ], :string
269
+ attach_function :av_freep, :av_freep, [ :pointer ], :void
270
+
271
+
272
+ ffi_lib [ "libavcodec.so.53", "libavcodec.53.dylib" ]
273
+
274
+ class AVPacket < FFI::Struct; end
275
+ class AVPacketSideData < FFI::Struct; end
276
+ class AVPanScan < FFI::Struct; end
277
+ class AVCodecContext < FFI::Struct; end
278
+ class AVCodec < FFI::Struct; end
279
+ class AVFrame < FFI::Struct; end
280
+ class RcOverride < FFI::Struct; end
281
+ class AVPaletteControl < FFI::Struct; end
282
+ class AVHWAccel < FFI::Struct; end
283
+ class AVPicture < FFI::Struct; end
284
+ class AVSubtitle < FFI::Struct; end
285
+ class AVCodecParser < FFI::Struct; end
286
+ class AVCodecParserContext < FFI::Struct; end
287
+ class AVBitStreamFilter < FFI::Struct; end
288
+ class AVBitStreamFilterContext < FFI::Struct; end
289
+ LIBAVCODEC_VERSION_MAJOR = 53
290
+ LIBAVCODEC_VERSION_MINOR = 35
291
+ LIBAVCODEC_VERSION_MICRO = 0
292
+ LIBAVCODEC_VERSION_INT = (53 << 16|35 << 8|0)
293
+ LIBAVCODEC_BUILD = (53 << 16|35 << 8|0)
294
+ LIBAVCODEC_IDENT = 'Lavc53.35.0'
295
+ CODEC_ID_NONE = 0
296
+ CODEC_ID_MPEG1VIDEO = CODEC_ID_NONE + 1
297
+ CODEC_ID_MPEG2VIDEO = CODEC_ID_MPEG1VIDEO + 1
298
+ CODEC_ID_MPEG2VIDEO_XVMC = CODEC_ID_MPEG2VIDEO + 1
299
+ CODEC_ID_H261 = CODEC_ID_MPEG2VIDEO_XVMC + 1
300
+ CODEC_ID_H263 = CODEC_ID_H261 + 1
301
+ CODEC_ID_RV10 = CODEC_ID_H263 + 1
302
+ CODEC_ID_RV20 = CODEC_ID_RV10 + 1
303
+ CODEC_ID_MJPEG = CODEC_ID_RV20 + 1
304
+ CODEC_ID_MJPEGB = CODEC_ID_MJPEG + 1
305
+ CODEC_ID_LJPEG = CODEC_ID_MJPEGB + 1
306
+ CODEC_ID_SP5X = CODEC_ID_LJPEG + 1
307
+ CODEC_ID_JPEGLS = CODEC_ID_SP5X + 1
308
+ CODEC_ID_MPEG4 = CODEC_ID_JPEGLS + 1
309
+ CODEC_ID_RAWVIDEO = CODEC_ID_MPEG4 + 1
310
+ CODEC_ID_MSMPEG4V1 = CODEC_ID_RAWVIDEO + 1
311
+ CODEC_ID_MSMPEG4V2 = CODEC_ID_MSMPEG4V1 + 1
312
+ CODEC_ID_MSMPEG4V3 = CODEC_ID_MSMPEG4V2 + 1
313
+ CODEC_ID_WMV1 = CODEC_ID_MSMPEG4V3 + 1
314
+ CODEC_ID_WMV2 = CODEC_ID_WMV1 + 1
315
+ CODEC_ID_H263P = CODEC_ID_WMV2 + 1
316
+ CODEC_ID_H263I = CODEC_ID_H263P + 1
317
+ CODEC_ID_FLV1 = CODEC_ID_H263I + 1
318
+ CODEC_ID_SVQ1 = CODEC_ID_FLV1 + 1
319
+ CODEC_ID_SVQ3 = CODEC_ID_SVQ1 + 1
320
+ CODEC_ID_DVVIDEO = CODEC_ID_SVQ3 + 1
321
+ CODEC_ID_HUFFYUV = CODEC_ID_DVVIDEO + 1
322
+ CODEC_ID_CYUV = CODEC_ID_HUFFYUV + 1
323
+ CODEC_ID_H264 = CODEC_ID_CYUV + 1
324
+ CODEC_ID_INDEO3 = CODEC_ID_H264 + 1
325
+ CODEC_ID_VP3 = CODEC_ID_INDEO3 + 1
326
+ CODEC_ID_THEORA = CODEC_ID_VP3 + 1
327
+ CODEC_ID_ASV1 = CODEC_ID_THEORA + 1
328
+ CODEC_ID_ASV2 = CODEC_ID_ASV1 + 1
329
+ CODEC_ID_FFV1 = CODEC_ID_ASV2 + 1
330
+ CODEC_ID_4XM = CODEC_ID_FFV1 + 1
331
+ CODEC_ID_VCR1 = CODEC_ID_4XM + 1
332
+ CODEC_ID_CLJR = CODEC_ID_VCR1 + 1
333
+ CODEC_ID_MDEC = CODEC_ID_CLJR + 1
334
+ CODEC_ID_ROQ = CODEC_ID_MDEC + 1
335
+ CODEC_ID_INTERPLAY_VIDEO = CODEC_ID_ROQ + 1
336
+ CODEC_ID_XAN_WC3 = CODEC_ID_INTERPLAY_VIDEO + 1
337
+ CODEC_ID_XAN_WC4 = CODEC_ID_XAN_WC3 + 1
338
+ CODEC_ID_RPZA = CODEC_ID_XAN_WC4 + 1
339
+ CODEC_ID_CINEPAK = CODEC_ID_RPZA + 1
340
+ CODEC_ID_WS_VQA = CODEC_ID_CINEPAK + 1
341
+ CODEC_ID_MSRLE = CODEC_ID_WS_VQA + 1
342
+ CODEC_ID_MSVIDEO1 = CODEC_ID_MSRLE + 1
343
+ CODEC_ID_IDCIN = CODEC_ID_MSVIDEO1 + 1
344
+ CODEC_ID_8BPS = CODEC_ID_IDCIN + 1
345
+ CODEC_ID_SMC = CODEC_ID_8BPS + 1
346
+ CODEC_ID_FLIC = CODEC_ID_SMC + 1
347
+ CODEC_ID_TRUEMOTION1 = CODEC_ID_FLIC + 1
348
+ CODEC_ID_VMDVIDEO = CODEC_ID_TRUEMOTION1 + 1
349
+ CODEC_ID_MSZH = CODEC_ID_VMDVIDEO + 1
350
+ CODEC_ID_ZLIB = CODEC_ID_MSZH + 1
351
+ CODEC_ID_QTRLE = CODEC_ID_ZLIB + 1
352
+ CODEC_ID_SNOW = CODEC_ID_QTRLE + 1
353
+ CODEC_ID_TSCC = CODEC_ID_SNOW + 1
354
+ CODEC_ID_ULTI = CODEC_ID_TSCC + 1
355
+ CODEC_ID_QDRAW = CODEC_ID_ULTI + 1
356
+ CODEC_ID_VIXL = CODEC_ID_QDRAW + 1
357
+ CODEC_ID_QPEG = CODEC_ID_VIXL + 1
358
+ CODEC_ID_PNG = CODEC_ID_QPEG + 1
359
+ CODEC_ID_PPM = CODEC_ID_PNG + 1
360
+ CODEC_ID_PBM = CODEC_ID_PPM + 1
361
+ CODEC_ID_PGM = CODEC_ID_PBM + 1
362
+ CODEC_ID_PGMYUV = CODEC_ID_PGM + 1
363
+ CODEC_ID_PAM = CODEC_ID_PGMYUV + 1
364
+ CODEC_ID_FFVHUFF = CODEC_ID_PAM + 1
365
+ CODEC_ID_RV30 = CODEC_ID_FFVHUFF + 1
366
+ CODEC_ID_RV40 = CODEC_ID_RV30 + 1
367
+ CODEC_ID_VC1 = CODEC_ID_RV40 + 1
368
+ CODEC_ID_WMV3 = CODEC_ID_VC1 + 1
369
+ CODEC_ID_LOCO = CODEC_ID_WMV3 + 1
370
+ CODEC_ID_WNV1 = CODEC_ID_LOCO + 1
371
+ CODEC_ID_AASC = CODEC_ID_WNV1 + 1
372
+ CODEC_ID_INDEO2 = CODEC_ID_AASC + 1
373
+ CODEC_ID_FRAPS = CODEC_ID_INDEO2 + 1
374
+ CODEC_ID_TRUEMOTION2 = CODEC_ID_FRAPS + 1
375
+ CODEC_ID_BMP = CODEC_ID_TRUEMOTION2 + 1
376
+ CODEC_ID_CSCD = CODEC_ID_BMP + 1
377
+ CODEC_ID_MMVIDEO = CODEC_ID_CSCD + 1
378
+ CODEC_ID_ZMBV = CODEC_ID_MMVIDEO + 1
379
+ CODEC_ID_AVS = CODEC_ID_ZMBV + 1
380
+ CODEC_ID_SMACKVIDEO = CODEC_ID_AVS + 1
381
+ CODEC_ID_NUV = CODEC_ID_SMACKVIDEO + 1
382
+ CODEC_ID_KMVC = CODEC_ID_NUV + 1
383
+ CODEC_ID_FLASHSV = CODEC_ID_KMVC + 1
384
+ CODEC_ID_CAVS = CODEC_ID_FLASHSV + 1
385
+ CODEC_ID_JPEG2000 = CODEC_ID_CAVS + 1
386
+ CODEC_ID_VMNC = CODEC_ID_JPEG2000 + 1
387
+ CODEC_ID_VP5 = CODEC_ID_VMNC + 1
388
+ CODEC_ID_VP6 = CODEC_ID_VP5 + 1
389
+ CODEC_ID_VP6F = CODEC_ID_VP6 + 1
390
+ CODEC_ID_TARGA = CODEC_ID_VP6F + 1
391
+ CODEC_ID_DSICINVIDEO = CODEC_ID_TARGA + 1
392
+ CODEC_ID_TIERTEXSEQVIDEO = CODEC_ID_DSICINVIDEO + 1
393
+ CODEC_ID_TIFF = CODEC_ID_TIERTEXSEQVIDEO + 1
394
+ CODEC_ID_GIF = CODEC_ID_TIFF + 1
395
+ CODEC_ID_FFH264 = CODEC_ID_GIF + 1
396
+ CODEC_ID_DXA = CODEC_ID_FFH264 + 1
397
+ CODEC_ID_DNXHD = CODEC_ID_DXA + 1
398
+ CODEC_ID_THP = CODEC_ID_DNXHD + 1
399
+ CODEC_ID_SGI = CODEC_ID_THP + 1
400
+ CODEC_ID_C93 = CODEC_ID_SGI + 1
401
+ CODEC_ID_BETHSOFTVID = CODEC_ID_C93 + 1
402
+ CODEC_ID_PTX = CODEC_ID_BETHSOFTVID + 1
403
+ CODEC_ID_TXD = CODEC_ID_PTX + 1
404
+ CODEC_ID_VP6A = CODEC_ID_TXD + 1
405
+ CODEC_ID_AMV = CODEC_ID_VP6A + 1
406
+ CODEC_ID_VB = CODEC_ID_AMV + 1
407
+ CODEC_ID_PCX = CODEC_ID_VB + 1
408
+ CODEC_ID_SUNRAST = CODEC_ID_PCX + 1
409
+ CODEC_ID_INDEO4 = CODEC_ID_SUNRAST + 1
410
+ CODEC_ID_INDEO5 = CODEC_ID_INDEO4 + 1
411
+ CODEC_ID_MIMIC = CODEC_ID_INDEO5 + 1
412
+ CODEC_ID_RL2 = CODEC_ID_MIMIC + 1
413
+ CODEC_ID_8SVX_EXP = CODEC_ID_RL2 + 1
414
+ CODEC_ID_8SVX_FIB = CODEC_ID_8SVX_EXP + 1
415
+ CODEC_ID_ESCAPE124 = CODEC_ID_8SVX_FIB + 1
416
+ CODEC_ID_DIRAC = CODEC_ID_ESCAPE124 + 1
417
+ CODEC_ID_BFI = CODEC_ID_DIRAC + 1
418
+ CODEC_ID_CMV = CODEC_ID_BFI + 1
419
+ CODEC_ID_MOTIONPIXELS = CODEC_ID_CMV + 1
420
+ CODEC_ID_TGV = CODEC_ID_MOTIONPIXELS + 1
421
+ CODEC_ID_TGQ = CODEC_ID_TGV + 1
422
+ CODEC_ID_TQI = CODEC_ID_TGQ + 1
423
+ CODEC_ID_AURA = CODEC_ID_TQI + 1
424
+ CODEC_ID_AURA2 = CODEC_ID_AURA + 1
425
+ CODEC_ID_V210X = CODEC_ID_AURA2 + 1
426
+ CODEC_ID_TMV = CODEC_ID_V210X + 1
427
+ CODEC_ID_V210 = CODEC_ID_TMV + 1
428
+ CODEC_ID_DPX = CODEC_ID_V210 + 1
429
+ CODEC_ID_MAD = CODEC_ID_DPX + 1
430
+ CODEC_ID_FRWU = CODEC_ID_MAD + 1
431
+ CODEC_ID_FLASHSV2 = CODEC_ID_FRWU + 1
432
+ CODEC_ID_CDGRAPHICS = CODEC_ID_FLASHSV2 + 1
433
+ CODEC_ID_R210 = CODEC_ID_CDGRAPHICS + 1
434
+ CODEC_ID_ANM = CODEC_ID_R210 + 1
435
+ CODEC_ID_BINKVIDEO = CODEC_ID_ANM + 1
436
+ CODEC_ID_IFF_ILBM = CODEC_ID_BINKVIDEO + 1
437
+ CODEC_ID_IFF_BYTERUN1 = CODEC_ID_IFF_ILBM + 1
438
+ CODEC_ID_KGV1 = CODEC_ID_IFF_BYTERUN1 + 1
439
+ CODEC_ID_YOP = CODEC_ID_KGV1 + 1
440
+ CODEC_ID_VP8 = CODEC_ID_YOP + 1
441
+ CODEC_ID_PICTOR = CODEC_ID_VP8 + 1
442
+ CODEC_ID_ANSI = CODEC_ID_PICTOR + 1
443
+ CODEC_ID_A64_MULTI = CODEC_ID_ANSI + 1
444
+ CODEC_ID_A64_MULTI5 = CODEC_ID_A64_MULTI + 1
445
+ CODEC_ID_R10K = CODEC_ID_A64_MULTI5 + 1
446
+ CODEC_ID_MXPEG = CODEC_ID_R10K + 1
447
+ CODEC_ID_LAGARITH = CODEC_ID_MXPEG + 1
448
+ CODEC_ID_PRORES = CODEC_ID_LAGARITH + 1
449
+ CODEC_ID_JV = CODEC_ID_PRORES + 1
450
+ CODEC_ID_DFA = CODEC_ID_JV + 1
451
+ CODEC_ID_WMV3IMAGE = CODEC_ID_DFA + 1
452
+ CODEC_ID_VC1IMAGE = CODEC_ID_WMV3IMAGE + 1
453
+ CODEC_ID_G723_1 = CODEC_ID_VC1IMAGE + 1
454
+ CODEC_ID_G729 = CODEC_ID_G723_1 + 1
455
+ CODEC_ID_UTVIDEO = CODEC_ID_G729 + 1
456
+ CODEC_ID_BMV_VIDEO = CODEC_ID_UTVIDEO + 1
457
+ CODEC_ID_VBLE = CODEC_ID_BMV_VIDEO + 1
458
+ CODEC_ID_DXTORY = CODEC_ID_VBLE + 1
459
+ CODEC_ID_V410 = CODEC_ID_DXTORY + 1
460
+ CODEC_ID_FIRST_AUDIO = 0x10000
461
+ CODEC_ID_PCM_S16LE = 0x10000
462
+ CODEC_ID_PCM_S16BE = CODEC_ID_PCM_S16LE + 1
463
+ CODEC_ID_PCM_U16LE = CODEC_ID_PCM_S16BE + 1
464
+ CODEC_ID_PCM_U16BE = CODEC_ID_PCM_U16LE + 1
465
+ CODEC_ID_PCM_S8 = CODEC_ID_PCM_U16BE + 1
466
+ CODEC_ID_PCM_U8 = CODEC_ID_PCM_S8 + 1
467
+ CODEC_ID_PCM_MULAW = CODEC_ID_PCM_U8 + 1
468
+ CODEC_ID_PCM_ALAW = CODEC_ID_PCM_MULAW + 1
469
+ CODEC_ID_PCM_S32LE = CODEC_ID_PCM_ALAW + 1
470
+ CODEC_ID_PCM_S32BE = CODEC_ID_PCM_S32LE + 1
471
+ CODEC_ID_PCM_U32LE = CODEC_ID_PCM_S32BE + 1
472
+ CODEC_ID_PCM_U32BE = CODEC_ID_PCM_U32LE + 1
473
+ CODEC_ID_PCM_S24LE = CODEC_ID_PCM_U32BE + 1
474
+ CODEC_ID_PCM_S24BE = CODEC_ID_PCM_S24LE + 1
475
+ CODEC_ID_PCM_U24LE = CODEC_ID_PCM_S24BE + 1
476
+ CODEC_ID_PCM_U24BE = CODEC_ID_PCM_U24LE + 1
477
+ CODEC_ID_PCM_S24DAUD = CODEC_ID_PCM_U24BE + 1
478
+ CODEC_ID_PCM_ZORK = CODEC_ID_PCM_S24DAUD + 1
479
+ CODEC_ID_PCM_S16LE_PLANAR = CODEC_ID_PCM_ZORK + 1
480
+ CODEC_ID_PCM_DVD = CODEC_ID_PCM_S16LE_PLANAR + 1
481
+ CODEC_ID_PCM_F32BE = CODEC_ID_PCM_DVD + 1
482
+ CODEC_ID_PCM_F32LE = CODEC_ID_PCM_F32BE + 1
483
+ CODEC_ID_PCM_F64BE = CODEC_ID_PCM_F32LE + 1
484
+ CODEC_ID_PCM_F64LE = CODEC_ID_PCM_F64BE + 1
485
+ CODEC_ID_PCM_BLURAY = CODEC_ID_PCM_F64LE + 1
486
+ CODEC_ID_PCM_LXF = CODEC_ID_PCM_BLURAY + 1
487
+ CODEC_ID_S302M = CODEC_ID_PCM_LXF + 1
488
+ CODEC_ID_PCM_S8_PLANAR = CODEC_ID_S302M + 1
489
+ CODEC_ID_ADPCM_IMA_QT = 0x11000
490
+ CODEC_ID_ADPCM_IMA_WAV = CODEC_ID_ADPCM_IMA_QT + 1
491
+ CODEC_ID_ADPCM_IMA_DK3 = CODEC_ID_ADPCM_IMA_WAV + 1
492
+ CODEC_ID_ADPCM_IMA_DK4 = CODEC_ID_ADPCM_IMA_DK3 + 1
493
+ CODEC_ID_ADPCM_IMA_WS = CODEC_ID_ADPCM_IMA_DK4 + 1
494
+ CODEC_ID_ADPCM_IMA_SMJPEG = CODEC_ID_ADPCM_IMA_WS + 1
495
+ CODEC_ID_ADPCM_MS = CODEC_ID_ADPCM_IMA_SMJPEG + 1
496
+ CODEC_ID_ADPCM_4XM = CODEC_ID_ADPCM_MS + 1
497
+ CODEC_ID_ADPCM_XA = CODEC_ID_ADPCM_4XM + 1
498
+ CODEC_ID_ADPCM_ADX = CODEC_ID_ADPCM_XA + 1
499
+ CODEC_ID_ADPCM_EA = CODEC_ID_ADPCM_ADX + 1
500
+ CODEC_ID_ADPCM_G726 = CODEC_ID_ADPCM_EA + 1
501
+ CODEC_ID_ADPCM_CT = CODEC_ID_ADPCM_G726 + 1
502
+ CODEC_ID_ADPCM_SWF = CODEC_ID_ADPCM_CT + 1
503
+ CODEC_ID_ADPCM_YAMAHA = CODEC_ID_ADPCM_SWF + 1
504
+ CODEC_ID_ADPCM_SBPRO_4 = CODEC_ID_ADPCM_YAMAHA + 1
505
+ CODEC_ID_ADPCM_SBPRO_3 = CODEC_ID_ADPCM_SBPRO_4 + 1
506
+ CODEC_ID_ADPCM_SBPRO_2 = CODEC_ID_ADPCM_SBPRO_3 + 1
507
+ CODEC_ID_ADPCM_THP = CODEC_ID_ADPCM_SBPRO_2 + 1
508
+ CODEC_ID_ADPCM_IMA_AMV = CODEC_ID_ADPCM_THP + 1
509
+ CODEC_ID_ADPCM_EA_R1 = CODEC_ID_ADPCM_IMA_AMV + 1
510
+ CODEC_ID_ADPCM_EA_R3 = CODEC_ID_ADPCM_EA_R1 + 1
511
+ CODEC_ID_ADPCM_EA_R2 = CODEC_ID_ADPCM_EA_R3 + 1
512
+ CODEC_ID_ADPCM_IMA_EA_SEAD = CODEC_ID_ADPCM_EA_R2 + 1
513
+ CODEC_ID_ADPCM_IMA_EA_EACS = CODEC_ID_ADPCM_IMA_EA_SEAD + 1
514
+ CODEC_ID_ADPCM_EA_XAS = CODEC_ID_ADPCM_IMA_EA_EACS + 1
515
+ CODEC_ID_ADPCM_EA_MAXIS_XA = CODEC_ID_ADPCM_EA_XAS + 1
516
+ CODEC_ID_ADPCM_IMA_ISS = CODEC_ID_ADPCM_EA_MAXIS_XA + 1
517
+ CODEC_ID_ADPCM_G722 = CODEC_ID_ADPCM_IMA_ISS + 1
518
+ CODEC_ID_AMR_NB = 0x12000
519
+ CODEC_ID_AMR_WB = CODEC_ID_AMR_NB + 1
520
+ CODEC_ID_RA_144 = 0x13000
521
+ CODEC_ID_RA_288 = CODEC_ID_RA_144 + 1
522
+ CODEC_ID_ROQ_DPCM = 0x14000
523
+ CODEC_ID_INTERPLAY_DPCM = CODEC_ID_ROQ_DPCM + 1
524
+ CODEC_ID_XAN_DPCM = CODEC_ID_INTERPLAY_DPCM + 1
525
+ CODEC_ID_SOL_DPCM = CODEC_ID_XAN_DPCM + 1
526
+ CODEC_ID_MP2 = 0x15000
527
+ CODEC_ID_MP3 = CODEC_ID_MP2 + 1
528
+ CODEC_ID_AAC = CODEC_ID_MP3 + 1
529
+ CODEC_ID_AC3 = CODEC_ID_AAC + 1
530
+ CODEC_ID_DTS = CODEC_ID_AC3 + 1
531
+ CODEC_ID_VORBIS = CODEC_ID_DTS + 1
532
+ CODEC_ID_DVAUDIO = CODEC_ID_VORBIS + 1
533
+ CODEC_ID_WMAV1 = CODEC_ID_DVAUDIO + 1
534
+ CODEC_ID_WMAV2 = CODEC_ID_WMAV1 + 1
535
+ CODEC_ID_MACE3 = CODEC_ID_WMAV2 + 1
536
+ CODEC_ID_MACE6 = CODEC_ID_MACE3 + 1
537
+ CODEC_ID_VMDAUDIO = CODEC_ID_MACE6 + 1
538
+ CODEC_ID_SONIC = CODEC_ID_VMDAUDIO + 1
539
+ CODEC_ID_SONIC_LS = CODEC_ID_SONIC + 1
540
+ CODEC_ID_FLAC = CODEC_ID_SONIC_LS + 1
541
+ CODEC_ID_MP3ADU = CODEC_ID_FLAC + 1
542
+ CODEC_ID_MP3ON4 = CODEC_ID_MP3ADU + 1
543
+ CODEC_ID_SHORTEN = CODEC_ID_MP3ON4 + 1
544
+ CODEC_ID_ALAC = CODEC_ID_SHORTEN + 1
545
+ CODEC_ID_WESTWOOD_SND1 = CODEC_ID_ALAC + 1
546
+ CODEC_ID_GSM = CODEC_ID_WESTWOOD_SND1 + 1
547
+ CODEC_ID_QDM2 = CODEC_ID_GSM + 1
548
+ CODEC_ID_COOK = CODEC_ID_QDM2 + 1
549
+ CODEC_ID_TRUESPEECH = CODEC_ID_COOK + 1
550
+ CODEC_ID_TTA = CODEC_ID_TRUESPEECH + 1
551
+ CODEC_ID_SMACKAUDIO = CODEC_ID_TTA + 1
552
+ CODEC_ID_QCELP = CODEC_ID_SMACKAUDIO + 1
553
+ CODEC_ID_WAVPACK = CODEC_ID_QCELP + 1
554
+ CODEC_ID_DSICINAUDIO = CODEC_ID_WAVPACK + 1
555
+ CODEC_ID_IMC = CODEC_ID_DSICINAUDIO + 1
556
+ CODEC_ID_MUSEPACK7 = CODEC_ID_IMC + 1
557
+ CODEC_ID_MLP = CODEC_ID_MUSEPACK7 + 1
558
+ CODEC_ID_GSM_MS = CODEC_ID_MLP + 1
559
+ CODEC_ID_ATRAC3 = CODEC_ID_GSM_MS + 1
560
+ CODEC_ID_VOXWARE = CODEC_ID_ATRAC3 + 1
561
+ CODEC_ID_APE = CODEC_ID_VOXWARE + 1
562
+ CODEC_ID_NELLYMOSER = CODEC_ID_APE + 1
563
+ CODEC_ID_MUSEPACK8 = CODEC_ID_NELLYMOSER + 1
564
+ CODEC_ID_SPEEX = CODEC_ID_MUSEPACK8 + 1
565
+ CODEC_ID_WMAVOICE = CODEC_ID_SPEEX + 1
566
+ CODEC_ID_WMAPRO = CODEC_ID_WMAVOICE + 1
567
+ CODEC_ID_WMALOSSLESS = CODEC_ID_WMAPRO + 1
568
+ CODEC_ID_ATRAC3P = CODEC_ID_WMALOSSLESS + 1
569
+ CODEC_ID_EAC3 = CODEC_ID_ATRAC3P + 1
570
+ CODEC_ID_SIPR = CODEC_ID_EAC3 + 1
571
+ CODEC_ID_MP1 = CODEC_ID_SIPR + 1
572
+ CODEC_ID_TWINVQ = CODEC_ID_MP1 + 1
573
+ CODEC_ID_TRUEHD = CODEC_ID_TWINVQ + 1
574
+ CODEC_ID_MP4ALS = CODEC_ID_TRUEHD + 1
575
+ CODEC_ID_ATRAC1 = CODEC_ID_MP4ALS + 1
576
+ CODEC_ID_BINKAUDIO_RDFT = CODEC_ID_ATRAC1 + 1
577
+ CODEC_ID_BINKAUDIO_DCT = CODEC_ID_BINKAUDIO_RDFT + 1
578
+ CODEC_ID_AAC_LATM = CODEC_ID_BINKAUDIO_DCT + 1
579
+ CODEC_ID_QDMC = CODEC_ID_AAC_LATM + 1
580
+ CODEC_ID_CELT = CODEC_ID_QDMC + 1
581
+ CODEC_ID_BMV_AUDIO = CODEC_ID_CELT + 1
582
+ CODEC_ID_FIRST_SUBTITLE = 0x17000
583
+ CODEC_ID_DVD_SUBTITLE = 0x17000
584
+ CODEC_ID_DVB_SUBTITLE = CODEC_ID_DVD_SUBTITLE + 1
585
+ CODEC_ID_TEXT = CODEC_ID_DVB_SUBTITLE + 1
586
+ CODEC_ID_XSUB = CODEC_ID_TEXT + 1
587
+ CODEC_ID_SSA = CODEC_ID_XSUB + 1
588
+ CODEC_ID_MOV_TEXT = CODEC_ID_SSA + 1
589
+ CODEC_ID_HDMV_PGS_SUBTITLE = CODEC_ID_MOV_TEXT + 1
590
+ CODEC_ID_DVB_TELETEXT = CODEC_ID_HDMV_PGS_SUBTITLE + 1
591
+ CODEC_ID_SRT = CODEC_ID_DVB_TELETEXT + 1
592
+ CODEC_ID_FIRST_UNKNOWN = 0x18000
593
+ CODEC_ID_TTF = 0x18000
594
+ CODEC_ID_PROBE = 0x19000
595
+ CODEC_ID_MPEG2TS = 0x20000
596
+ CODEC_ID_MPEG4SYSTEMS = 0x20001
597
+ CODEC_ID_FFMETADATA = 0x21000
598
+ CodecID = enum :CodecID, [
599
+ :none,
600
+ :mpeg1video,
601
+ :mpeg2video,
602
+ :mpeg2video_xvmc,
603
+ :h261,
604
+ :h263,
605
+ :rv10,
606
+ :rv20,
607
+ :mjpeg,
608
+ :mjpegb,
609
+ :ljpeg,
610
+ :sp5x,
611
+ :jpegls,
612
+ :mpeg4,
613
+ :rawvideo,
614
+ :msmpeg4v1,
615
+ :msmpeg4v2,
616
+ :msmpeg4v3,
617
+ :wmv1,
618
+ :wmv2,
619
+ :h263p,
620
+ :h263i,
621
+ :flv1,
622
+ :svq1,
623
+ :svq3,
624
+ :dvvideo,
625
+ :huffyuv,
626
+ :cyuv,
627
+ :h264,
628
+ :indeo3,
629
+ :vp3,
630
+ :theora,
631
+ :asv1,
632
+ :asv2,
633
+ :ffv1,
634
+ :'4xm',
635
+ :vcr1,
636
+ :cljr,
637
+ :mdec,
638
+ :roq,
639
+ :interplay_video,
640
+ :xan_wc3,
641
+ :xan_wc4,
642
+ :rpza,
643
+ :cinepak,
644
+ :ws_vqa,
645
+ :msrle,
646
+ :msvideo1,
647
+ :idcin,
648
+ :'8bps',
649
+ :smc,
650
+ :flic,
651
+ :truemotion1,
652
+ :vmdvideo,
653
+ :mszh,
654
+ :zlib,
655
+ :qtrle,
656
+ :snow,
657
+ :tscc,
658
+ :ulti,
659
+ :qdraw,
660
+ :vixl,
661
+ :qpeg,
662
+ :png,
663
+ :ppm,
664
+ :pbm,
665
+ :pgm,
666
+ :pgmyuv,
667
+ :pam,
668
+ :ffvhuff,
669
+ :rv30,
670
+ :rv40,
671
+ :vc1,
672
+ :wmv3,
673
+ :loco,
674
+ :wnv1,
675
+ :aasc,
676
+ :indeo2,
677
+ :fraps,
678
+ :truemotion2,
679
+ :bmp,
680
+ :cscd,
681
+ :mmvideo,
682
+ :zmbv,
683
+ :avs,
684
+ :smackvideo,
685
+ :nuv,
686
+ :kmvc,
687
+ :flashsv,
688
+ :cavs,
689
+ :jpeg2000,
690
+ :vmnc,
691
+ :vp5,
692
+ :vp6,
693
+ :vp6f,
694
+ :targa,
695
+ :dsicinvideo,
696
+ :tiertexseqvideo,
697
+ :tiff,
698
+ :gif,
699
+ :ffh264,
700
+ :dxa,
701
+ :dnxhd,
702
+ :thp,
703
+ :sgi,
704
+ :c93,
705
+ :bethsoftvid,
706
+ :ptx,
707
+ :txd,
708
+ :vp6a,
709
+ :amv,
710
+ :vb,
711
+ :pcx,
712
+ :sunrast,
713
+ :indeo4,
714
+ :indeo5,
715
+ :mimic,
716
+ :rl2,
717
+ :'8svx_exp',
718
+ :'8svx_fib',
719
+ :escape124,
720
+ :dirac,
721
+ :bfi,
722
+ :cmv,
723
+ :motionpixels,
724
+ :tgv,
725
+ :tgq,
726
+ :tqi,
727
+ :aura,
728
+ :aura2,
729
+ :v210x,
730
+ :tmv,
731
+ :v210,
732
+ :dpx,
733
+ :mad,
734
+ :frwu,
735
+ :flashsv2,
736
+ :cdgraphics,
737
+ :r210,
738
+ :anm,
739
+ :binkvideo,
740
+ :iff_ilbm,
741
+ :iff_byterun1,
742
+ :kgv1,
743
+ :yop,
744
+ :vp8,
745
+ :pictor,
746
+ :ansi,
747
+ :a64_multi,
748
+ :a64_multi5,
749
+ :r10k,
750
+ :mxpeg,
751
+ :lagarith,
752
+ :prores,
753
+ :jv,
754
+ :dfa,
755
+ :wmv3image,
756
+ :vc1image,
757
+ :g723_1,
758
+ :g729,
759
+ :utvideo,
760
+ :bmv_video,
761
+ :vble,
762
+ :dxtory,
763
+ :v410,
764
+ :first_audio, 0x10000,
765
+ :pcm_s16le, 0x10000,
766
+ :pcm_s16be,
767
+ :pcm_u16le,
768
+ :pcm_u16be,
769
+ :pcm_s8,
770
+ :pcm_u8,
771
+ :pcm_mulaw,
772
+ :pcm_alaw,
773
+ :pcm_s32le,
774
+ :pcm_s32be,
775
+ :pcm_u32le,
776
+ :pcm_u32be,
777
+ :pcm_s24le,
778
+ :pcm_s24be,
779
+ :pcm_u24le,
780
+ :pcm_u24be,
781
+ :pcm_s24daud,
782
+ :pcm_zork,
783
+ :pcm_s16le_planar,
784
+ :pcm_dvd,
785
+ :pcm_f32be,
786
+ :pcm_f32le,
787
+ :pcm_f64be,
788
+ :pcm_f64le,
789
+ :pcm_bluray,
790
+ :pcm_lxf,
791
+ :s302m,
792
+ :pcm_s8_planar,
793
+ :adpcm_ima_qt, 0x11000,
794
+ :adpcm_ima_wav,
795
+ :adpcm_ima_dk3,
796
+ :adpcm_ima_dk4,
797
+ :adpcm_ima_ws,
798
+ :adpcm_ima_smjpeg,
799
+ :adpcm_ms,
800
+ :adpcm_4xm,
801
+ :adpcm_xa,
802
+ :adpcm_adx,
803
+ :adpcm_ea,
804
+ :adpcm_g726,
805
+ :adpcm_ct,
806
+ :adpcm_swf,
807
+ :adpcm_yamaha,
808
+ :adpcm_sbpro_4,
809
+ :adpcm_sbpro_3,
810
+ :adpcm_sbpro_2,
811
+ :adpcm_thp,
812
+ :adpcm_ima_amv,
813
+ :adpcm_ea_r1,
814
+ :adpcm_ea_r3,
815
+ :adpcm_ea_r2,
816
+ :adpcm_ima_ea_sead,
817
+ :adpcm_ima_ea_eacs,
818
+ :adpcm_ea_xas,
819
+ :adpcm_ea_maxis_xa,
820
+ :adpcm_ima_iss,
821
+ :adpcm_g722,
822
+ :amr_nb, 0x12000,
823
+ :amr_wb,
824
+ :ra_144, 0x13000,
825
+ :ra_288,
826
+ :roq_dpcm, 0x14000,
827
+ :interplay_dpcm,
828
+ :xan_dpcm,
829
+ :sol_dpcm,
830
+ :mp2, 0x15000,
831
+ :mp3,
832
+ :aac,
833
+ :ac3,
834
+ :dts,
835
+ :vorbis,
836
+ :dvaudio,
837
+ :wmav1,
838
+ :wmav2,
839
+ :mace3,
840
+ :mace6,
841
+ :vmdaudio,
842
+ :sonic,
843
+ :sonic_ls,
844
+ :flac,
845
+ :mp3adu,
846
+ :mp3on4,
847
+ :shorten,
848
+ :alac,
849
+ :westwood_snd1,
850
+ :gsm,
851
+ :qdm2,
852
+ :cook,
853
+ :truespeech,
854
+ :tta,
855
+ :smackaudio,
856
+ :qcelp,
857
+ :wavpack,
858
+ :dsicinaudio,
859
+ :imc,
860
+ :musepack7,
861
+ :mlp,
862
+ :gsm_ms,
863
+ :atrac3,
864
+ :voxware,
865
+ :ape,
866
+ :nellymoser,
867
+ :musepack8,
868
+ :speex,
869
+ :wmavoice,
870
+ :wmapro,
871
+ :wmalossless,
872
+ :atrac3p,
873
+ :eac3,
874
+ :sipr,
875
+ :mp1,
876
+ :twinvq,
877
+ :truehd,
878
+ :mp4als,
879
+ :atrac1,
880
+ :binkaudio_rdft,
881
+ :binkaudio_dct,
882
+ :aac_latm,
883
+ :qdmc,
884
+ :celt,
885
+ :bmv_audio,
886
+ :first_subtitle, 0x17000,
887
+ :dvd_subtitle, 0x17000,
888
+ :dvb_subtitle,
889
+ :text,
890
+ :xsub,
891
+ :ssa,
892
+ :mov_text,
893
+ :hdmv_pgs_subtitle,
894
+ :dvb_teletext,
895
+ :srt,
896
+ :first_unknown, 0x18000,
897
+ :ttf, 0x18000,
898
+ :probe, 0x19000,
899
+ :mpeg2ts, 0x20000,
900
+ :mpeg4systems, 0x20001,
901
+ :ffmetadata, 0x21000,
902
+ ]
903
+
904
+ AVCODEC_MAX_AUDIO_FRAME_SIZE = 192000
905
+ FF_INPUT_BUFFER_PADDING_SIZE = 8
906
+ FF_MIN_BUFFER_SIZE = 16384
907
+ ME_ZERO = 1
908
+ ME_FULL = ME_ZERO + 1
909
+ ME_LOG = ME_FULL + 1
910
+ ME_PHODS = ME_LOG + 1
911
+ ME_EPZS = ME_PHODS + 1
912
+ ME_X1 = ME_EPZS + 1
913
+ ME_HEX = ME_X1 + 1
914
+ ME_UMH = ME_HEX + 1
915
+ ME_ITER = ME_UMH + 1
916
+ ME_TESA = ME_ITER + 1
917
+ Motion_Est_ID = enum :Motion_Est_ID, [
918
+ :zero, 1,
919
+ :full,
920
+ :log,
921
+ :phods,
922
+ :epzs,
923
+ :x1,
924
+ :hex,
925
+ :umh,
926
+ :iter,
927
+ :tesa,
928
+ ]
929
+
930
+ AVDISCARD_NONE = -16
931
+ AVDISCARD_DEFAULT = 0
932
+ AVDISCARD_NONREF = 8
933
+ AVDISCARD_BIDIR = 16
934
+ AVDISCARD_NONKEY = 32
935
+ AVDISCARD_ALL = 48
936
+ AVDiscard = enum :AVDiscard, [
937
+ :none, -16,
938
+ :default, 0,
939
+ :nonref, 8,
940
+ :bidir, 16,
941
+ :nonkey, 32,
942
+ :all, 48,
943
+ ]
944
+
945
+ AVCOL_PRI_BT709 = 1
946
+ AVCOL_PRI_UNSPECIFIED = 2
947
+ AVCOL_PRI_BT470M = 4
948
+ AVCOL_PRI_BT470BG = 5
949
+ AVCOL_PRI_SMPTE170M = 6
950
+ AVCOL_PRI_SMPTE240M = 7
951
+ AVCOL_PRI_FILM = 8
952
+ AVCOL_PRI_NB = AVCOL_PRI_FILM + 1
953
+ AVColorPrimaries = enum :AVColorPrimaries, [
954
+ :bt709, 1,
955
+ :unspecified, 2,
956
+ :bt470m, 4,
957
+ :bt470bg, 5,
958
+ :smpte170m, 6,
959
+ :smpte240m, 7,
960
+ :film, 8,
961
+ :nb,
962
+ ]
963
+
964
+ AVCOL_TRC_BT709 = 1
965
+ AVCOL_TRC_UNSPECIFIED = 2
966
+ AVCOL_TRC_GAMMA22 = 4
967
+ AVCOL_TRC_GAMMA28 = 5
968
+ AVCOL_TRC_NB = AVCOL_TRC_GAMMA28 + 1
969
+ AVColorTransferCharacteristic = enum :AVColorTransferCharacteristic, [
970
+ :bt709, 1,
971
+ :unspecified, 2,
972
+ :gamma22, 4,
973
+ :gamma28, 5,
974
+ :nb,
975
+ ]
976
+
977
+ AVCOL_SPC_RGB = 0
978
+ AVCOL_SPC_BT709 = 1
979
+ AVCOL_SPC_UNSPECIFIED = 2
980
+ AVCOL_SPC_FCC = 4
981
+ AVCOL_SPC_BT470BG = 5
982
+ AVCOL_SPC_SMPTE170M = 6
983
+ AVCOL_SPC_SMPTE240M = 7
984
+ AVCOL_SPC_NB = AVCOL_SPC_SMPTE240M + 1
985
+ AVColorSpace = enum :AVColorSpace, [
986
+ :rgb, 0,
987
+ :bt709, 1,
988
+ :unspecified, 2,
989
+ :fcc, 4,
990
+ :bt470bg, 5,
991
+ :smpte170m, 6,
992
+ :smpte240m, 7,
993
+ :nb,
994
+ ]
995
+
996
+ AVCOL_RANGE_UNSPECIFIED = 0
997
+ AVCOL_RANGE_MPEG = 1
998
+ AVCOL_RANGE_JPEG = 2
999
+ AVCOL_RANGE_NB = AVCOL_RANGE_JPEG + 1
1000
+ AVColorRange = enum :AVColorRange, [
1001
+ :unspecified, 0,
1002
+ :mpeg, 1,
1003
+ :jpeg, 2,
1004
+ :nb,
1005
+ ]
1006
+
1007
+ AVCHROMA_LOC_UNSPECIFIED = 0
1008
+ AVCHROMA_LOC_LEFT = 1
1009
+ AVCHROMA_LOC_CENTER = 2
1010
+ AVCHROMA_LOC_TOPLEFT = 3
1011
+ AVCHROMA_LOC_TOP = 4
1012
+ AVCHROMA_LOC_BOTTOMLEFT = 5
1013
+ AVCHROMA_LOC_BOTTOM = 6
1014
+ AVCHROMA_LOC_NB = AVCHROMA_LOC_BOTTOM + 1
1015
+ AVChromaLocation = enum :AVChromaLocation, [
1016
+ :unspecified, 0,
1017
+ :left, 1,
1018
+ :center, 2,
1019
+ :topleft, 3,
1020
+ :top, 4,
1021
+ :bottomleft, 5,
1022
+ :bottom, 6,
1023
+ :nb,
1024
+ ]
1025
+
1026
+ AV_LPC_TYPE_DEFAULT = -1
1027
+ AV_LPC_TYPE_NONE = 0
1028
+ AV_LPC_TYPE_FIXED = 1
1029
+ AV_LPC_TYPE_LEVINSON = 2
1030
+ AV_LPC_TYPE_CHOLESKY = 3
1031
+ AV_LPC_TYPE_NB = AV_LPC_TYPE_CHOLESKY + 1
1032
+ AVLPCType = enum :AVLPCType, [
1033
+ :default, -1,
1034
+ :none, 0,
1035
+ :fixed, 1,
1036
+ :levinson, 2,
1037
+ :cholesky, 3,
1038
+ :nb,
1039
+ ]
1040
+
1041
+ AV_AUDIO_SERVICE_TYPE_MAIN = 0
1042
+ AV_AUDIO_SERVICE_TYPE_EFFECTS = 1
1043
+ AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2
1044
+ AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3
1045
+ AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4
1046
+ AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5
1047
+ AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6
1048
+ AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7
1049
+ AV_AUDIO_SERVICE_TYPE_KARAOKE = 8
1050
+ AV_AUDIO_SERVICE_TYPE_NB = AV_AUDIO_SERVICE_TYPE_KARAOKE + 1
1051
+ AVAudioServiceType = enum :AVAudioServiceType, [
1052
+ :main, 0,
1053
+ :effects, 1,
1054
+ :visually_impaired, 2,
1055
+ :hearing_impaired, 3,
1056
+ :dialogue, 4,
1057
+ :commentary, 5,
1058
+ :emergency, 6,
1059
+ :voice_over, 7,
1060
+ :karaoke, 8,
1061
+ :nb,
1062
+ ]
1063
+
1064
+ class RcOverride < FFI::Struct
1065
+ layout(
1066
+ :start_frame, :int,
1067
+ :end_frame, :int,
1068
+ :qscale, :int,
1069
+ :quality_factor, :float
1070
+ )
1071
+ end
1072
+ FF_MAX_B_FRAMES = 16
1073
+ CODEC_FLAG_QSCALE = 0x0002
1074
+ CODEC_FLAG_4MV = 0x0004
1075
+ CODEC_FLAG_QPEL = 0x0010
1076
+ CODEC_FLAG_GMC = 0x0020
1077
+ CODEC_FLAG_MV0 = 0x0040
1078
+ CODEC_FLAG_INPUT_PRESERVED = 0x0100
1079
+ CODEC_FLAG_PASS1 = 0x0200
1080
+ CODEC_FLAG_PASS2 = 0x0400
1081
+ CODEC_FLAG_GRAY = 0x2000
1082
+ CODEC_FLAG_EMU_EDGE = 0x4000
1083
+ CODEC_FLAG_PSNR = 0x8000
1084
+ CODEC_FLAG_TRUNCATED = 0x00010000
1085
+ CODEC_FLAG_NORMALIZE_AQP = 0x00020000
1086
+ CODEC_FLAG_INTERLACED_DCT = 0x00040000
1087
+ CODEC_FLAG_LOW_DELAY = 0x00080000
1088
+ CODEC_FLAG_GLOBAL_HEADER = 0x00400000
1089
+ CODEC_FLAG_BITEXACT = 0x00800000
1090
+ CODEC_FLAG_AC_PRED = 0x01000000
1091
+ CODEC_FLAG_CBP_RD = 0x04000000
1092
+ CODEC_FLAG_QP_RD = 0x08000000
1093
+ CODEC_FLAG_LOOP_FILTER = 0x00000800
1094
+ CODEC_FLAG_INTERLACED_ME = 0x20000000
1095
+ CODEC_FLAG_CLOSED_GOP = 0x80000000
1096
+ CODEC_FLAG2_FAST = 0x00000001
1097
+ CODEC_FLAG2_STRICT_GOP = 0x00000002
1098
+ CODEC_FLAG2_NO_OUTPUT = 0x00000004
1099
+ CODEC_FLAG2_LOCAL_HEADER = 0x00000008
1100
+ CODEC_FLAG2_SKIP_RD = 0x00004000
1101
+ CODEC_FLAG2_CHUNKS = 0x00008000
1102
+ CODEC_FLAG_OBMC = 0x00000001
1103
+ CODEC_FLAG_H263P_AIV = 0x00000008
1104
+ CODEC_FLAG_PART = 0x0080
1105
+ CODEC_FLAG_ALT_SCAN = 0x00100000
1106
+ CODEC_FLAG_H263P_UMV = 0x02000000
1107
+ CODEC_FLAG_H263P_SLICE_STRUCT = 0x10000000
1108
+ CODEC_FLAG_SVCD_SCAN_OFFSET = 0x40000000
1109
+ CODEC_FLAG2_INTRA_VLC = 0x00000800
1110
+ CODEC_FLAG2_DROP_FRAME_TIMECODE = 0x00002000
1111
+ CODEC_FLAG2_NON_LINEAR_QUANT = 0x00010000
1112
+ CODEC_FLAG_EXTERN_HUFF = 0x1000
1113
+ CODEC_FLAG2_BPYRAMID = 0x00000010
1114
+ CODEC_FLAG2_WPRED = 0x00000020
1115
+ CODEC_FLAG2_MIXED_REFS = 0x00000040
1116
+ CODEC_FLAG2_8X8DCT = 0x00000080
1117
+ CODEC_FLAG2_FASTPSKIP = 0x00000100
1118
+ CODEC_FLAG2_AUD = 0x00000200
1119
+ CODEC_FLAG2_BRDO = 0x00000400
1120
+ CODEC_FLAG2_MBTREE = 0x00040000
1121
+ CODEC_FLAG2_PSY = 0x00080000
1122
+ CODEC_FLAG2_SSIM = 0x00100000
1123
+ CODEC_FLAG2_INTRA_REFRESH = 0x00200000
1124
+ CODEC_FLAG2_MEMC_ONLY = 0x00001000
1125
+ CODEC_FLAG2_BIT_RESERVOIR = 0x00020000
1126
+ CODEC_CAP_DRAW_HORIZ_BAND = 0x0001
1127
+ CODEC_CAP_DR1 = 0x0002
1128
+ CODEC_CAP_PARSE_ONLY = 0x0004
1129
+ CODEC_CAP_TRUNCATED = 0x0008
1130
+ CODEC_CAP_HWACCEL = 0x0010
1131
+ CODEC_CAP_DELAY = 0x0020
1132
+ CODEC_CAP_SMALL_LAST_FRAME = 0x0040
1133
+ CODEC_CAP_HWACCEL_VDPAU = 0x0080
1134
+ CODEC_CAP_SUBFRAMES = 0x0100
1135
+ CODEC_CAP_EXPERIMENTAL = 0x0200
1136
+ CODEC_CAP_CHANNEL_CONF = 0x0400
1137
+ CODEC_CAP_NEG_LINESIZES = 0x0800
1138
+ CODEC_CAP_FRAME_THREADS = 0x1000
1139
+ CODEC_CAP_SLICE_THREADS = 0x2000
1140
+ CODEC_CAP_PARAM_CHANGE = 0x4000
1141
+ CODEC_CAP_AUTO_THREADS = 0x8000
1142
+ CODEC_CAP_VARIABLE_FRAME_SIZE = 0x10000
1143
+ MB_TYPE_INTRA4x4 = 0x0001
1144
+ MB_TYPE_INTRA16x16 = 0x0002
1145
+ MB_TYPE_INTRA_PCM = 0x0004
1146
+ MB_TYPE_16x16 = 0x0008
1147
+ MB_TYPE_16x8 = 0x0010
1148
+ MB_TYPE_8x16 = 0x0020
1149
+ MB_TYPE_8x8 = 0x0040
1150
+ MB_TYPE_INTERLACED = 0x0080
1151
+ MB_TYPE_DIRECT2 = 0x0100
1152
+ MB_TYPE_ACPRED = 0x0200
1153
+ MB_TYPE_GMC = 0x0400
1154
+ MB_TYPE_SKIP = 0x0800
1155
+ MB_TYPE_P0L0 = 0x1000
1156
+ MB_TYPE_P1L0 = 0x2000
1157
+ MB_TYPE_P0L1 = 0x4000
1158
+ MB_TYPE_P1L1 = 0x8000
1159
+ MB_TYPE_L0 = (0x1000|0x2000)
1160
+ MB_TYPE_L1 = (0x4000|0x8000)
1161
+ MB_TYPE_L0L1 = ((0x1000|0x2000)|(0x4000|0x8000))
1162
+ MB_TYPE_QUANT = 0x00010000
1163
+ MB_TYPE_CBP = 0x00020000
1164
+ class AVPanScan < FFI::Struct
1165
+ layout(
1166
+ :id, :int,
1167
+ :width, :int,
1168
+ :height, :int,
1169
+ :position, [[:int16, 2], 3]
1170
+ )
1171
+ end
1172
+ FF_QSCALE_TYPE_MPEG1 = 0
1173
+ FF_QSCALE_TYPE_MPEG2 = 1
1174
+ FF_QSCALE_TYPE_H264 = 2
1175
+ FF_QSCALE_TYPE_VP56 = 3
1176
+ FF_BUFFER_TYPE_INTERNAL = 1
1177
+ FF_BUFFER_TYPE_USER = 2
1178
+ FF_BUFFER_TYPE_SHARED = 4
1179
+ FF_BUFFER_TYPE_COPY = 8
1180
+ FF_BUFFER_HINTS_VALID = 0x01
1181
+ FF_BUFFER_HINTS_READABLE = 0x02
1182
+ FF_BUFFER_HINTS_PRESERVE = 0x04
1183
+ FF_BUFFER_HINTS_REUSABLE = 0x08
1184
+ AV_PKT_DATA_PALETTE = 0
1185
+ AV_PKT_DATA_NEW_EXTRADATA = AV_PKT_DATA_PALETTE + 1
1186
+ AV_PKT_DATA_PARAM_CHANGE = AV_PKT_DATA_NEW_EXTRADATA + 1
1187
+ AVPacketSideDataType = enum :AVPacketSideDataType, [
1188
+ :palette,
1189
+ :new_extradata,
1190
+ :param_change,
1191
+ ]
1192
+
1193
+ class AVPacketSideData < FFI::Struct
1194
+ layout(
1195
+ :data, :pointer,
1196
+ :size, :int,
1197
+ :type, AVPacketSideDataType
1198
+ )
1199
+ end
1200
+ class AVPacket < FFI::Struct
1201
+ layout(
1202
+ :pts, :int64,
1203
+ :dts, :int64,
1204
+ :data, :pointer,
1205
+ :size, :int,
1206
+ :stream_index, :int,
1207
+ :flags, :int,
1208
+ :side_data, AVPacketSideData.ptr,
1209
+ :side_data_elems, :int,
1210
+ :duration, :int,
1211
+ :destruct, callback([ AVPacket.ptr ], :void),
1212
+ :priv, :pointer,
1213
+ :pos, :int64,
1214
+ :convergence_duration, :int64,
1215
+ )
1216
+ def destruct=(cb)
1217
+ @destruct = cb
1218
+ self[:destruct] = @destruct
1219
+ end
1220
+ def destruct
1221
+ @destruct
1222
+ end
1223
+
1224
+ end
1225
+ AV_PKT_FLAG_KEY = 0x0001
1226
+ AV_PKT_FLAG_CORRUPT = 0x0002
1227
+ AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001
1228
+ AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002
1229
+ AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004
1230
+ AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008
1231
+ AVSideDataParamChangeFlags = enum :AVSideDataParamChangeFlags, [
1232
+ :channel_count, 0x0001,
1233
+ :channel_layout, 0x0002,
1234
+ :sample_rate, 0x0004,
1235
+ :dimensions, 0x0008,
1236
+ ]
1237
+
1238
+ AV_NUM_DATA_POINTERS = 4
1239
+ class AVFrame < FFI::Struct
1240
+ layout(
1241
+ :data, [:pointer, 4],
1242
+ :linesize, [:int, 4],
1243
+ :base, [:pointer, 4],
1244
+ :key_frame, :int,
1245
+ :pict_type, AVPictureType,
1246
+ :pts, :int64,
1247
+ :coded_picture_number, :int,
1248
+ :display_picture_number, :int,
1249
+ :quality, :int,
1250
+ :age, :int,
1251
+ :reference, :int,
1252
+ :qscale_table, :pointer,
1253
+ :qstride, :int,
1254
+ :mbskip_table, :pointer,
1255
+ :motion_val, [:pointer, 2],
1256
+ :mb_type, :pointer,
1257
+ :motion_subsample_log2, :uint8,
1258
+ :opaque, :pointer,
1259
+ :error, [:uint64, 4],
1260
+ :type, :int,
1261
+ :repeat_pict, :int,
1262
+ :qscale_type, :int,
1263
+ :interlaced_frame, :int,
1264
+ :top_field_first, :int,
1265
+ :pan_scan, AVPanScan.ptr,
1266
+ :palette_has_changed, :int,
1267
+ :buffer_hints, :int,
1268
+ :dct_coeff, :pointer,
1269
+ :ref_index, [:pointer, 2],
1270
+ :reordered_opaque, :int64,
1271
+ :hwaccel_picture_private, :pointer,
1272
+ :pkt_pts, :int64,
1273
+ :pkt_dts, :int64,
1274
+ :owner, AVCodecContext.ptr,
1275
+ :thread_opaque, :pointer,
1276
+ :nb_samples, :int,
1277
+ :extended_data, :pointer,
1278
+ :sample_aspect_ratio, AVRational.by_value,
1279
+ :width, :int,
1280
+ :height, :int,
1281
+ :format, PixelFormat,
1282
+ )
1283
+ end
1284
+ AV_FIELD_UNKNOWN = 0
1285
+ AV_FIELD_PROGRESSIVE = AV_FIELD_UNKNOWN + 1
1286
+ AV_FIELD_TT = AV_FIELD_PROGRESSIVE + 1
1287
+ AV_FIELD_BB = AV_FIELD_TT + 1
1288
+ AV_FIELD_TB = AV_FIELD_BB + 1
1289
+ AV_FIELD_BT = AV_FIELD_TB + 1
1290
+ AVFieldOrder = enum :AVFieldOrder, [
1291
+ :unknown,
1292
+ :progressive,
1293
+ :tt,
1294
+ :bb,
1295
+ :tb,
1296
+ :bt,
1297
+ ]
1298
+
1299
+ FF_ASPECT_EXTENDED = 15
1300
+ FF_RC_STRATEGY_XVID = 1
1301
+ FF_BUG_AUTODETECT = 1
1302
+ FF_BUG_OLD_MSMPEG4 = 2
1303
+ FF_BUG_XVID_ILACE = 4
1304
+ FF_BUG_UMP4 = 8
1305
+ FF_BUG_NO_PADDING = 16
1306
+ FF_BUG_AMV = 32
1307
+ FF_BUG_AC_VLC = 0
1308
+ FF_BUG_QPEL_CHROMA = 64
1309
+ FF_BUG_STD_QPEL = 128
1310
+ FF_BUG_QPEL_CHROMA2 = 256
1311
+ FF_BUG_DIRECT_BLOCKSIZE = 512
1312
+ FF_BUG_EDGE = 1024
1313
+ FF_BUG_HPEL_CHROMA = 2048
1314
+ FF_BUG_DC_CLIP = 4096
1315
+ FF_BUG_MS = 8192
1316
+ FF_BUG_TRUNCATED = 16384
1317
+ FF_COMPLIANCE_VERY_STRICT = 2
1318
+ FF_COMPLIANCE_STRICT = 1
1319
+ FF_COMPLIANCE_NORMAL = 0
1320
+ FF_COMPLIANCE_UNOFFICIAL = -1
1321
+ FF_COMPLIANCE_EXPERIMENTAL = -2
1322
+ FF_ER_CAREFUL = 1
1323
+ FF_ER_COMPLIANT = 2
1324
+ FF_ER_AGGRESSIVE = 3
1325
+ FF_ER_VERY_AGGRESSIVE = 4
1326
+ FF_ER_EXPLODE = 5
1327
+ FF_DCT_AUTO = 0
1328
+ FF_DCT_FASTINT = 1
1329
+ FF_DCT_INT = 2
1330
+ FF_DCT_MMX = 3
1331
+ FF_DCT_MLIB = 4
1332
+ FF_DCT_ALTIVEC = 5
1333
+ FF_DCT_FAAN = 6
1334
+ FF_IDCT_AUTO = 0
1335
+ FF_IDCT_INT = 1
1336
+ FF_IDCT_SIMPLE = 2
1337
+ FF_IDCT_SIMPLEMMX = 3
1338
+ FF_IDCT_LIBMPEG2MMX = 4
1339
+ FF_IDCT_PS2 = 5
1340
+ FF_IDCT_MLIB = 6
1341
+ FF_IDCT_ARM = 7
1342
+ FF_IDCT_ALTIVEC = 8
1343
+ FF_IDCT_SH4 = 9
1344
+ FF_IDCT_SIMPLEARM = 10
1345
+ FF_IDCT_H264 = 11
1346
+ FF_IDCT_VP3 = 12
1347
+ FF_IDCT_IPP = 13
1348
+ FF_IDCT_XVIDMMX = 14
1349
+ FF_IDCT_CAVS = 15
1350
+ FF_IDCT_SIMPLEARMV5TE = 16
1351
+ FF_IDCT_SIMPLEARMV6 = 17
1352
+ FF_IDCT_SIMPLEVIS = 18
1353
+ FF_IDCT_WMV2 = 19
1354
+ FF_IDCT_FAAN = 20
1355
+ FF_IDCT_EA = 21
1356
+ FF_IDCT_SIMPLENEON = 22
1357
+ FF_IDCT_SIMPLEALPHA = 23
1358
+ FF_IDCT_BINK = 24
1359
+ FF_EC_GUESS_MVS = 1
1360
+ FF_EC_DEBLOCK = 2
1361
+ FF_PRED_LEFT = 0
1362
+ FF_PRED_PLANE = 1
1363
+ FF_PRED_MEDIAN = 2
1364
+ FF_DEBUG_PICT_INFO = 1
1365
+ FF_DEBUG_RC = 2
1366
+ FF_DEBUG_BITSTREAM = 4
1367
+ FF_DEBUG_MB_TYPE = 8
1368
+ FF_DEBUG_QP = 16
1369
+ FF_DEBUG_MV = 32
1370
+ FF_DEBUG_DCT_COEFF = 0x00000040
1371
+ FF_DEBUG_SKIP = 0x00000080
1372
+ FF_DEBUG_STARTCODE = 0x00000100
1373
+ FF_DEBUG_PTS = 0x00000200
1374
+ FF_DEBUG_ER = 0x00000400
1375
+ FF_DEBUG_MMCO = 0x00000800
1376
+ FF_DEBUG_BUGS = 0x00001000
1377
+ FF_DEBUG_VIS_QP = 0x00002000
1378
+ FF_DEBUG_VIS_MB_TYPE = 0x00004000
1379
+ FF_DEBUG_BUFFERS = 0x00008000
1380
+ FF_DEBUG_THREADS = 0x00010000
1381
+ FF_DEBUG_VIS_MV_P_FOR = 0x00000001
1382
+ FF_DEBUG_VIS_MV_B_FOR = 0x00000002
1383
+ FF_DEBUG_VIS_MV_B_BACK = 0x00000004
1384
+ FF_CMP_SAD = 0
1385
+ FF_CMP_SSE = 1
1386
+ FF_CMP_SATD = 2
1387
+ FF_CMP_DCT = 3
1388
+ FF_CMP_PSNR = 4
1389
+ FF_CMP_BIT = 5
1390
+ FF_CMP_RD = 6
1391
+ FF_CMP_ZERO = 7
1392
+ FF_CMP_VSAD = 8
1393
+ FF_CMP_VSSE = 9
1394
+ FF_CMP_NSSE = 10
1395
+ FF_CMP_W53 = 11
1396
+ FF_CMP_W97 = 12
1397
+ FF_CMP_DCTMAX = 13
1398
+ FF_CMP_DCT264 = 14
1399
+ FF_CMP_CHROMA = 256
1400
+ FF_DTG_AFD_SAME = 8
1401
+ FF_DTG_AFD_4_3 = 9
1402
+ FF_DTG_AFD_16_9 = 10
1403
+ FF_DTG_AFD_14_9 = 11
1404
+ FF_DTG_AFD_4_3_SP_14_9 = 13
1405
+ FF_DTG_AFD_16_9_SP_14_9 = 14
1406
+ FF_DTG_AFD_SP_4_3 = 15
1407
+ FF_DEFAULT_QUANT_BIAS = 999999
1408
+ FF_CODER_TYPE_VLC = 0
1409
+ FF_CODER_TYPE_AC = 1
1410
+ FF_CODER_TYPE_RAW = 2
1411
+ FF_CODER_TYPE_RLE = 3
1412
+ FF_CODER_TYPE_DEFLATE = 4
1413
+ SLICE_FLAG_CODED_ORDER = 0x0001
1414
+ SLICE_FLAG_ALLOW_FIELD = 0x0002
1415
+ SLICE_FLAG_ALLOW_PLANE = 0x0004
1416
+ FF_MB_DECISION_SIMPLE = 0
1417
+ FF_MB_DECISION_BITS = 1
1418
+ FF_MB_DECISION_RD = 2
1419
+ FF_AA_AUTO = 0
1420
+ FF_AA_FASTINT = 1
1421
+ FF_AA_INT = 2
1422
+ FF_AA_FLOAT = 3
1423
+ FF_PROFILE_UNKNOWN = -99
1424
+ FF_PROFILE_RESERVED = -100
1425
+ FF_PROFILE_AAC_MAIN = 0
1426
+ FF_PROFILE_AAC_LOW = 1
1427
+ FF_PROFILE_AAC_SSR = 2
1428
+ FF_PROFILE_AAC_LTP = 3
1429
+ FF_PROFILE_DTS = 20
1430
+ FF_PROFILE_DTS_ES = 30
1431
+ FF_PROFILE_DTS_96_24 = 40
1432
+ FF_PROFILE_DTS_HD_HRA = 50
1433
+ FF_PROFILE_DTS_HD_MA = 60
1434
+ FF_PROFILE_MPEG2_422 = 0
1435
+ FF_PROFILE_MPEG2_HIGH = 1
1436
+ FF_PROFILE_MPEG2_SS = 2
1437
+ FF_PROFILE_MPEG2_SNR_SCALABLE = 3
1438
+ FF_PROFILE_MPEG2_MAIN = 4
1439
+ FF_PROFILE_MPEG2_SIMPLE = 5
1440
+ FF_PROFILE_H264_CONSTRAINED = (1 << 9)
1441
+ FF_PROFILE_H264_INTRA = (1 << 11)
1442
+ FF_PROFILE_H264_BASELINE = 66
1443
+ FF_PROFILE_H264_CONSTRAINED_BASELINE = (66|(1 << 9))
1444
+ FF_PROFILE_H264_MAIN = 77
1445
+ FF_PROFILE_H264_EXTENDED = 88
1446
+ FF_PROFILE_H264_HIGH = 100
1447
+ FF_PROFILE_H264_HIGH_10 = 110
1448
+ FF_PROFILE_H264_HIGH_10_INTRA = (110|(1 << 11))
1449
+ FF_PROFILE_H264_HIGH_422 = 122
1450
+ FF_PROFILE_H264_HIGH_422_INTRA = (122|(1 << 11))
1451
+ FF_PROFILE_H264_HIGH_444 = 144
1452
+ FF_PROFILE_H264_HIGH_444_PREDICTIVE = 244
1453
+ FF_PROFILE_H264_HIGH_444_INTRA = (244|(1 << 11))
1454
+ FF_PROFILE_H264_CAVLC_444 = 44
1455
+ FF_PROFILE_VC1_SIMPLE = 0
1456
+ FF_PROFILE_VC1_MAIN = 1
1457
+ FF_PROFILE_VC1_COMPLEX = 2
1458
+ FF_PROFILE_VC1_ADVANCED = 3
1459
+ FF_PROFILE_MPEG4_SIMPLE = 0
1460
+ FF_PROFILE_MPEG4_SIMPLE_SCALABLE = 1
1461
+ FF_PROFILE_MPEG4_CORE = 2
1462
+ FF_PROFILE_MPEG4_MAIN = 3
1463
+ FF_PROFILE_MPEG4_N_BIT = 4
1464
+ FF_PROFILE_MPEG4_SCALABLE_TEXTURE = 5
1465
+ FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION = 6
1466
+ FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE = 7
1467
+ FF_PROFILE_MPEG4_HYBRID = 8
1468
+ FF_PROFILE_MPEG4_ADVANCED_REAL_TIME = 9
1469
+ FF_PROFILE_MPEG4_CORE_SCALABLE = 10
1470
+ FF_PROFILE_MPEG4_ADVANCED_CODING = 11
1471
+ FF_PROFILE_MPEG4_ADVANCED_CORE = 12
1472
+ FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE = 13
1473
+ FF_PROFILE_MPEG4_SIMPLE_STUDIO = 14
1474
+ FF_PROFILE_MPEG4_ADVANCED_SIMPLE = 15
1475
+ FF_LEVEL_UNKNOWN = -99
1476
+ X264_PART_I4X4 = 0x001
1477
+ X264_PART_I8X8 = 0x002
1478
+ X264_PART_P8X8 = 0x010
1479
+ X264_PART_P4X4 = 0x020
1480
+ X264_PART_B8X8 = 0x100
1481
+ FF_COMPRESSION_DEFAULT = -1
1482
+ FF_THREAD_FRAME = 1
1483
+ FF_THREAD_SLICE = 2
1484
+ AV_EF_CRCCHECK = (1 << 0)
1485
+ AV_EF_BITSTREAM = (1 << 1)
1486
+ AV_EF_BUFFER = (1 << 2)
1487
+ AV_EF_EXPLODE = (1 << 3)
1488
+ class AVCodecContext < FFI::Struct
1489
+ layout(
1490
+ :av_class, :pointer,
1491
+ :bit_rate, :int,
1492
+ :bit_rate_tolerance, :int,
1493
+ :flags, :int,
1494
+ :sub_id, :int,
1495
+ :me_method, :int,
1496
+ :extradata, :pointer,
1497
+ :extradata_size, :int,
1498
+ :time_base, AVRational.by_value,
1499
+ :width, :int,
1500
+ :height, :int,
1501
+ :gop_size, :int,
1502
+ :pix_fmt, PixelFormat,
1503
+ :draw_horiz_band, callback([ AVCodecContext.ptr, :pointer, :pointer, :int, :int, :int ], :void),
1504
+ :sample_rate, :int,
1505
+ :channels, :int,
1506
+ :sample_fmt, :int,
1507
+ :frame_size, :int,
1508
+ :frame_number, :int,
1509
+ :delay, :int,
1510
+ :qcompress, :float,
1511
+ :qblur, :float,
1512
+ :qmin, :int,
1513
+ :qmax, :int,
1514
+ :max_qdiff, :int,
1515
+ :max_b_frames, :int,
1516
+ :b_quant_factor, :float,
1517
+ :rc_strategy, :int,
1518
+ :b_frame_strategy, :int,
1519
+ :codec, AVCodec.ptr,
1520
+ :priv_data, :pointer,
1521
+ :rtp_payload_size, :int,
1522
+ :rtp_callback, callback([ AVCodecContext.ptr, :pointer, :int, :int ], :void),
1523
+ :mv_bits, :int,
1524
+ :header_bits, :int,
1525
+ :i_tex_bits, :int,
1526
+ :p_tex_bits, :int,
1527
+ :i_count, :int,
1528
+ :p_count, :int,
1529
+ :skip_count, :int,
1530
+ :misc_bits, :int,
1531
+ :frame_bits, :int,
1532
+ :opaque, :pointer,
1533
+ :codec_name, [:char, 32],
1534
+ :codec_type, AVMediaType,
1535
+ :codec_id, CodecID,
1536
+ :codec_tag, :uint,
1537
+ :workaround_bugs, :int,
1538
+ :luma_elim_threshold, :int,
1539
+ :chroma_elim_threshold, :int,
1540
+ :strict_std_compliance, :int,
1541
+ :b_quant_offset, :float,
1542
+ :error_recognition, :int,
1543
+ :get_buffer, callback([ AVCodecContext.ptr, AVFrame.ptr ], :int),
1544
+ :release_buffer, callback([ AVCodecContext.ptr, AVFrame.ptr ], :void),
1545
+ :has_b_frames, :int,
1546
+ :block_align, :int,
1547
+ :parse_only, :int,
1548
+ :mpeg_quant, :int,
1549
+ :stats_out, :pointer,
1550
+ :stats_in, :pointer,
1551
+ :rc_qsquish, :float,
1552
+ :rc_qmod_amp, :float,
1553
+ :rc_qmod_freq, :int,
1554
+ :rc_override, RcOverride.ptr,
1555
+ :rc_override_count, :int,
1556
+ :rc_eq, :pointer,
1557
+ :rc_max_rate, :int,
1558
+ :rc_min_rate, :int,
1559
+ :rc_buffer_size, :int,
1560
+ :rc_buffer_aggressivity, :float,
1561
+ :i_quant_factor, :float,
1562
+ :i_quant_offset, :float,
1563
+ :rc_initial_cplx, :float,
1564
+ :dct_algo, :int,
1565
+ :lumi_masking, :float,
1566
+ :temporal_cplx_masking, :float,
1567
+ :spatial_cplx_masking, :float,
1568
+ :p_masking, :float,
1569
+ :dark_masking, :float,
1570
+ :idct_algo, :int,
1571
+ :slice_count, :int,
1572
+ :slice_offset, :pointer,
1573
+ :error_concealment, :int,
1574
+ :dsp_mask, :uint,
1575
+ :bits_per_coded_sample, :int,
1576
+ :prediction_method, :int,
1577
+ :sample_aspect_ratio, AVRational.by_value,
1578
+ :coded_frame, AVFrame.ptr,
1579
+ :debug, :int,
1580
+ :debug_mv, :int,
1581
+ :error, [:uint64, 4],
1582
+ :me_cmp, :int,
1583
+ :me_sub_cmp, :int,
1584
+ :mb_cmp, :int,
1585
+ :ildct_cmp, :int,
1586
+ :dia_size, :int,
1587
+ :last_predictor_count, :int,
1588
+ :pre_me, :int,
1589
+ :me_pre_cmp, :int,
1590
+ :pre_dia_size, :int,
1591
+ :me_subpel_quality, :int,
1592
+ :get_format, callback([ AVCodecContext.ptr, :pointer ], PixelFormat),
1593
+ :dtg_active_format, :int,
1594
+ :me_range, :int,
1595
+ :intra_quant_bias, :int,
1596
+ :inter_quant_bias, :int,
1597
+ :color_table_id, :int,
1598
+ :internal_buffer_count, :int,
1599
+ :internal_buffer, :pointer,
1600
+ :global_quality, :int,
1601
+ :coder_type, :int,
1602
+ :context_model, :int,
1603
+ :slice_flags, :int,
1604
+ :xvmc_acceleration, :int,
1605
+ :mb_decision, :int,
1606
+ :intra_matrix, :pointer,
1607
+ :inter_matrix, :pointer,
1608
+ :stream_codec_tag, :uint,
1609
+ :scenechange_threshold, :int,
1610
+ :lmin, :int,
1611
+ :lmax, :int,
1612
+ :palctrl, AVPaletteControl.ptr,
1613
+ :noise_reduction, :int,
1614
+ :reget_buffer, callback([ AVCodecContext.ptr, AVFrame.ptr ], :int),
1615
+ :rc_initial_buffer_occupancy, :int,
1616
+ :inter_threshold, :int,
1617
+ :flags2, :int,
1618
+ :error_rate, :int,
1619
+ :antialias_algo, :int,
1620
+ :quantizer_noise_shaping, :int,
1621
+ :thread_count, :int,
1622
+ :execute, callback([ AVCodecContext.ptr, callback([ AVCodecContext.ptr, :pointer ], :int), :pointer, :pointer, :int, :int ], :int),
1623
+ :thread_opaque, :pointer,
1624
+ :me_threshold, :int,
1625
+ :mb_threshold, :int,
1626
+ :intra_dc_precision, :int,
1627
+ :nsse_weight, :int,
1628
+ :skip_top, :int,
1629
+ :skip_bottom, :int,
1630
+ :profile, :int,
1631
+ :level, :int,
1632
+ :lowres, :int,
1633
+ :coded_width, :int,
1634
+ :coded_height, :int,
1635
+ :frame_skip_threshold, :int,
1636
+ :frame_skip_factor, :int,
1637
+ :frame_skip_exp, :int,
1638
+ :frame_skip_cmp, :int,
1639
+ :border_masking, :float,
1640
+ :mb_lmin, :int,
1641
+ :mb_lmax, :int,
1642
+ :me_penalty_compensation, :int,
1643
+ :skip_loop_filter, AVDiscard,
1644
+ :skip_idct, AVDiscard,
1645
+ :skip_frame, AVDiscard,
1646
+ :bidir_refine, :int,
1647
+ :brd_scale, :int,
1648
+ :crf, :float,
1649
+ :cqp, :int,
1650
+ :keyint_min, :int,
1651
+ :refs, :int,
1652
+ :chromaoffset, :int,
1653
+ :bframebias, :int,
1654
+ :trellis, :int,
1655
+ :complexityblur, :float,
1656
+ :deblockalpha, :int,
1657
+ :deblockbeta, :int,
1658
+ :partitions, :int,
1659
+ :directpred, :int,
1660
+ :cutoff, :int,
1661
+ :scenechange_factor, :int,
1662
+ :mv0_threshold, :int,
1663
+ :b_sensitivity, :int,
1664
+ :compression_level, :int,
1665
+ :min_prediction_order, :int,
1666
+ :max_prediction_order, :int,
1667
+ :lpc_coeff_precision, :int,
1668
+ :prediction_order_method, :int,
1669
+ :min_partition_order, :int,
1670
+ :max_partition_order, :int,
1671
+ :timecode_frame_start, :int64,
1672
+ :request_channels, :int,
1673
+ :drc_scale, :float,
1674
+ :reordered_opaque, :int64,
1675
+ :bits_per_raw_sample, :int,
1676
+ :channel_layout, :uint64,
1677
+ :request_channel_layout, :uint64,
1678
+ :rc_max_available_vbv_use, :float,
1679
+ :rc_min_vbv_overflow_use, :float,
1680
+ :hwaccel, AVHWAccel.ptr,
1681
+ :ticks_per_frame, :int,
1682
+ :hwaccel_context, :pointer,
1683
+ :color_primaries, AVColorPrimaries,
1684
+ :color_trc, AVColorTransferCharacteristic,
1685
+ :colorspace, AVColorSpace,
1686
+ :color_range, AVColorRange,
1687
+ :chroma_sample_location, AVChromaLocation,
1688
+ :execute2, callback([ AVCodecContext.ptr, callback([ AVCodecContext.ptr, :pointer, :int, :int ], :int), :pointer, :pointer, :int ], :int),
1689
+ :weighted_p_pred, :int,
1690
+ :aq_mode, :int,
1691
+ :aq_strength, :float,
1692
+ :psy_rd, :float,
1693
+ :psy_trellis, :float,
1694
+ :rc_lookahead, :int,
1695
+ :crf_max, :float,
1696
+ :log_level_offset, :int,
1697
+ :lpc_type, AVLPCType,
1698
+ :lpc_passes, :int,
1699
+ :slices, :int,
1700
+ :subtitle_header, :pointer,
1701
+ :subtitle_header_size, :int,
1702
+ :pkt, AVPacket.ptr,
1703
+ :is_copy, :int,
1704
+ :thread_type, :int,
1705
+ :active_thread_type, :int,
1706
+ :thread_safe_callbacks, :int,
1707
+ :vbv_delay, :uint64,
1708
+ :audio_service_type, AVAudioServiceType,
1709
+ :request_sample_fmt, :int,
1710
+ :err_recognition, :int,
1711
+ :internal, :pointer,
1712
+ :field_order, AVFieldOrder
1713
+ )
1714
+ def draw_horiz_band=(cb)
1715
+ @draw_horiz_band = cb
1716
+ self[:draw_horiz_band] = @draw_horiz_band
1717
+ end
1718
+ def draw_horiz_band
1719
+ @draw_horiz_band
1720
+ end
1721
+ def rtp_callback=(cb)
1722
+ @rtp_callback = cb
1723
+ self[:rtp_callback] = @rtp_callback
1724
+ end
1725
+ def rtp_callback
1726
+ @rtp_callback
1727
+ end
1728
+ def get_buffer=(cb)
1729
+ @get_buffer = cb
1730
+ self[:get_buffer] = @get_buffer
1731
+ end
1732
+ def get_buffer
1733
+ @get_buffer
1734
+ end
1735
+ def release_buffer=(cb)
1736
+ @release_buffer = cb
1737
+ self[:release_buffer] = @release_buffer
1738
+ end
1739
+ def release_buffer
1740
+ @release_buffer
1741
+ end
1742
+ def stats_out=(str)
1743
+ @stats_out = FFI::MemoryPointer.from_string(str)
1744
+ self[:stats_out] = @stats_out
1745
+ end
1746
+ def stats_out
1747
+ @stats_out.get_string(0)
1748
+ end
1749
+ def stats_in=(str)
1750
+ @stats_in = FFI::MemoryPointer.from_string(str)
1751
+ self[:stats_in] = @stats_in
1752
+ end
1753
+ def stats_in
1754
+ @stats_in.get_string(0)
1755
+ end
1756
+ def rc_eq=(str)
1757
+ @rc_eq = FFI::MemoryPointer.from_string(str)
1758
+ self[:rc_eq] = @rc_eq
1759
+ end
1760
+ def rc_eq
1761
+ @rc_eq.get_string(0)
1762
+ end
1763
+ def get_format=(cb)
1764
+ @get_format = cb
1765
+ self[:get_format] = @get_format
1766
+ end
1767
+ def get_format
1768
+ @get_format
1769
+ end
1770
+ def reget_buffer=(cb)
1771
+ @reget_buffer = cb
1772
+ self[:reget_buffer] = @reget_buffer
1773
+ end
1774
+ def reget_buffer
1775
+ @reget_buffer
1776
+ end
1777
+ def execute=(cb)
1778
+ @execute = cb
1779
+ self[:execute] = @execute
1780
+ end
1781
+ def execute
1782
+ @execute
1783
+ end
1784
+ def execute2=(cb)
1785
+ @execute2 = cb
1786
+ self[:execute2] = @execute2
1787
+ end
1788
+ def execute2
1789
+ @execute2
1790
+ end
1791
+
1792
+ end
1793
+ class AVProfile < FFI::Struct
1794
+ layout(
1795
+ :profile, :int,
1796
+ :name, :pointer
1797
+ )
1798
+ def name=(str)
1799
+ @name = FFI::MemoryPointer.from_string(str)
1800
+ self[:name] = @name
1801
+ end
1802
+ def name
1803
+ @name.get_string(0)
1804
+ end
1805
+
1806
+ end
1807
+ class AVCodec < FFI::Struct
1808
+ layout(
1809
+ :name, :pointer,
1810
+ :type, AVMediaType,
1811
+ :id, CodecID,
1812
+ :priv_data_size, :int,
1813
+ :init, callback([ AVCodecContext.ptr ], :int),
1814
+ :encode, callback([ AVCodecContext.ptr, :pointer, :int, :pointer ], :int),
1815
+ :close, callback([ AVCodecContext.ptr ], :int),
1816
+ :decode, callback([ AVCodecContext.ptr, :pointer, :pointer, AVPacket.ptr ], :int),
1817
+ :capabilities, :int,
1818
+ :next, AVCodec.ptr,
1819
+ :flush, callback([ AVCodecContext.ptr ], :void),
1820
+ :supported_framerates, :pointer,
1821
+ :pix_fmts, :pointer,
1822
+ :long_name, :pointer,
1823
+ :supported_samplerates, :pointer,
1824
+ :sample_fmts, :pointer,
1825
+ :channel_layouts, :pointer,
1826
+ :max_lowres, :uint8,
1827
+ :priv_class, :pointer,
1828
+ :profiles, :pointer,
1829
+ :init_thread_copy, callback([ AVCodecContext.ptr ], :int),
1830
+ :update_thread_context, callback([ AVCodecContext.ptr, :pointer ], :int),
1831
+ :defaults, :pointer,
1832
+ :init_static_data, callback([ AVCodec.ptr ], :void),
1833
+ :encode2, callback([ AVCodecContext.ptr, AVPacket.ptr, :pointer, :pointer ], :int)
1834
+ )
1835
+ def name=(str)
1836
+ @name = FFI::MemoryPointer.from_string(str)
1837
+ self[:name] = @name
1838
+ end
1839
+ def name
1840
+ @name.get_string(0)
1841
+ end
1842
+ def init=(cb)
1843
+ @init = cb
1844
+ self[:init] = @init
1845
+ end
1846
+ def init
1847
+ @init
1848
+ end
1849
+ def encode=(cb)
1850
+ @encode = cb
1851
+ self[:encode] = @encode
1852
+ end
1853
+ def encode
1854
+ @encode
1855
+ end
1856
+ def close=(cb)
1857
+ @close = cb
1858
+ self[:close] = @close
1859
+ end
1860
+ def close
1861
+ @close
1862
+ end
1863
+ def decode=(cb)
1864
+ @decode = cb
1865
+ self[:decode] = @decode
1866
+ end
1867
+ def decode
1868
+ @decode
1869
+ end
1870
+ def flush=(cb)
1871
+ @flush = cb
1872
+ self[:flush] = @flush
1873
+ end
1874
+ def flush
1875
+ @flush
1876
+ end
1877
+ def long_name=(str)
1878
+ @long_name = FFI::MemoryPointer.from_string(str)
1879
+ self[:long_name] = @long_name
1880
+ end
1881
+ def long_name
1882
+ @long_name.get_string(0)
1883
+ end
1884
+ def init_thread_copy=(cb)
1885
+ @init_thread_copy = cb
1886
+ self[:init_thread_copy] = @init_thread_copy
1887
+ end
1888
+ def init_thread_copy
1889
+ @init_thread_copy
1890
+ end
1891
+ def update_thread_context=(cb)
1892
+ @update_thread_context = cb
1893
+ self[:update_thread_context] = @update_thread_context
1894
+ end
1895
+ def update_thread_context
1896
+ @update_thread_context
1897
+ end
1898
+ def init_static_data=(cb)
1899
+ @init_static_data = cb
1900
+ self[:init_static_data] = @init_static_data
1901
+ end
1902
+ def init_static_data
1903
+ @init_static_data
1904
+ end
1905
+ def encode2=(cb)
1906
+ @encode2 = cb
1907
+ self[:encode2] = @encode2
1908
+ end
1909
+ def encode2
1910
+ @encode2
1911
+ end
1912
+
1913
+ end
1914
+ class AVHWAccel < FFI::Struct
1915
+ layout(
1916
+ :name, :pointer,
1917
+ :type, AVMediaType,
1918
+ :id, CodecID,
1919
+ :pix_fmt, PixelFormat,
1920
+ :capabilities, :int,
1921
+ :next, AVHWAccel.ptr,
1922
+ :start_frame, callback([ AVCodecContext.ptr, :pointer, :uint32 ], :int),
1923
+ :decode_slice, callback([ AVCodecContext.ptr, :pointer, :uint32 ], :int),
1924
+ :end_frame, callback([ AVCodecContext.ptr ], :int),
1925
+ :priv_data_size, :int
1926
+ )
1927
+ def name=(str)
1928
+ @name = FFI::MemoryPointer.from_string(str)
1929
+ self[:name] = @name
1930
+ end
1931
+ def name
1932
+ @name.get_string(0)
1933
+ end
1934
+ def start_frame=(cb)
1935
+ @start_frame = cb
1936
+ self[:start_frame] = @start_frame
1937
+ end
1938
+ def start_frame
1939
+ @start_frame
1940
+ end
1941
+ def decode_slice=(cb)
1942
+ @decode_slice = cb
1943
+ self[:decode_slice] = @decode_slice
1944
+ end
1945
+ def decode_slice
1946
+ @decode_slice
1947
+ end
1948
+ def end_frame=(cb)
1949
+ @end_frame = cb
1950
+ self[:end_frame] = @end_frame
1951
+ end
1952
+ def end_frame
1953
+ @end_frame
1954
+ end
1955
+
1956
+ end
1957
+ class AVPicture < FFI::Struct
1958
+ layout(
1959
+ :data, [:pointer, 4],
1960
+ :linesize, [:int, 4]
1961
+ )
1962
+ end
1963
+ AVPALETTE_SIZE = 1024
1964
+ AVPALETTE_COUNT = 256
1965
+ class AVPaletteControl < FFI::Struct
1966
+ layout(
1967
+ :palette_changed, :int,
1968
+ :palette, [:uint, 256]
1969
+ )
1970
+ end
1971
+ SUBTITLE_NONE = 0
1972
+ SUBTITLE_BITMAP = SUBTITLE_NONE + 1
1973
+ SUBTITLE_TEXT = SUBTITLE_BITMAP + 1
1974
+ SUBTITLE_ASS = SUBTITLE_TEXT + 1
1975
+ AVSubtitleType = enum :AVSubtitleType, [
1976
+ :none,
1977
+ :bitmap,
1978
+ :text,
1979
+ :ass,
1980
+ ]
1981
+
1982
+ class AVSubtitleRect < FFI::Struct
1983
+ layout(
1984
+ :x, :int,
1985
+ :y, :int,
1986
+ :w, :int,
1987
+ :h, :int,
1988
+ :nb_colors, :int,
1989
+ :pict, AVPicture.by_value,
1990
+ :type, AVSubtitleType,
1991
+ :text, :pointer,
1992
+ :ass, :pointer
1993
+ )
1994
+ def text=(str)
1995
+ @text = FFI::MemoryPointer.from_string(str)
1996
+ self[:text] = @text
1997
+ end
1998
+ def text
1999
+ @text.get_string(0)
2000
+ end
2001
+ def ass=(str)
2002
+ @ass = FFI::MemoryPointer.from_string(str)
2003
+ self[:ass] = @ass
2004
+ end
2005
+ def ass
2006
+ @ass.get_string(0)
2007
+ end
2008
+
2009
+ end
2010
+ class AVSubtitle < FFI::Struct
2011
+ layout(
2012
+ :format, :uint16,
2013
+ :start_display_time, :uint32,
2014
+ :end_display_time, :uint32,
2015
+ :num_rects, :uint,
2016
+ :rects, :pointer,
2017
+ :pts, :int64
2018
+ )
2019
+ end
2020
+ attach_function :av_destruct_packet_nofree, :av_destruct_packet_nofree, [ AVPacket.ptr ], :void
2021
+ attach_function :av_destruct_packet, :av_destruct_packet, [ AVPacket.ptr ], :void
2022
+ attach_function :av_init_packet, :av_init_packet, [ AVPacket.ptr ], :void
2023
+ attach_function :av_new_packet, :av_new_packet, [ AVPacket.ptr, :int ], :int
2024
+ attach_function :av_shrink_packet, :av_shrink_packet, [ AVPacket.ptr, :int ], :void
2025
+ attach_function :av_grow_packet, :av_grow_packet, [ AVPacket.ptr, :int ], :int
2026
+ attach_function :av_dup_packet, :av_dup_packet, [ AVPacket.ptr ], :int
2027
+ attach_function :av_free_packet, :av_free_packet, [ AVPacket.ptr ], :void
2028
+ attach_function :av_packet_new_side_data, :av_packet_new_side_data, [ AVPacket.ptr, AVPacketSideDataType, :int ], :pointer
2029
+ attach_function :av_packet_get_side_data, :av_packet_get_side_data, [ AVPacket.ptr, AVPacketSideDataType, :pointer ], :pointer
2030
+ attach_function :av_audio_resample_init, :av_audio_resample_init, [ :int, :int, :int, :int, :int, :int, :int, :int, :int, :double ], :pointer
2031
+ attach_function :audio_resample, :audio_resample, [ :pointer, :pointer, :pointer, :int ], :int
2032
+ attach_function :audio_resample_close, :audio_resample_close, [ :pointer ], :void
2033
+ attach_function :av_resample_init, :av_resample_init, [ :int, :int, :int, :int, :int, :double ], :pointer
2034
+ attach_function :av_resample, :av_resample, [ :pointer, :pointer, :pointer, :pointer, :int, :int, :int ], :int
2035
+ attach_function :av_resample_compensate, :av_resample_compensate, [ :pointer, :int, :int ], :void
2036
+ attach_function :av_resample_close, :av_resample_close, [ :pointer ], :void
2037
+ attach_function :avpicture_alloc, :avpicture_alloc, [ AVPicture.ptr, PixelFormat, :int, :int ], :int
2038
+ attach_function :avpicture_free, :avpicture_free, [ AVPicture.ptr ], :void
2039
+ attach_function :avpicture_fill, :avpicture_fill, [ AVPicture.ptr, :pointer, PixelFormat, :int, :int ], :int
2040
+ attach_function :avpicture_layout, :avpicture_layout, [ :pointer, PixelFormat, :int, :int, :pointer, :int ], :int
2041
+ attach_function :avpicture_get_size, :avpicture_get_size, [ PixelFormat, :int, :int ], :int
2042
+ attach_function :avcodec_get_chroma_sub_sample, :avcodec_get_chroma_sub_sample, [ PixelFormat, :pointer, :pointer ], :void
2043
+ attach_function :avcodec_get_pix_fmt_name, :avcodec_get_pix_fmt_name, [ PixelFormat ], :string
2044
+ attach_function :avcodec_set_dimensions, :avcodec_set_dimensions, [ AVCodecContext.ptr, :int, :int ], :void
2045
+ attach_function :avcodec_pix_fmt_to_codec_tag, :avcodec_pix_fmt_to_codec_tag, [ PixelFormat ], :uint
2046
+ attach_function :av_get_codec_tag_string, :av_get_codec_tag_string, [ :string, :uint, :uint ], :uint
2047
+ FF_LOSS_RESOLUTION = 0x0001
2048
+ FF_LOSS_DEPTH = 0x0002
2049
+ FF_LOSS_COLORSPACE = 0x0004
2050
+ FF_LOSS_ALPHA = 0x0008
2051
+ FF_LOSS_COLORQUANT = 0x0010
2052
+ FF_LOSS_CHROMA = 0x0020
2053
+ attach_function :avcodec_get_pix_fmt_loss, :avcodec_get_pix_fmt_loss, [ PixelFormat, PixelFormat, :int ], :int
2054
+ attach_function :avcodec_find_best_pix_fmt, :avcodec_find_best_pix_fmt, [ :int64, PixelFormat, :int, :pointer ], PixelFormat
2055
+ FF_ALPHA_TRANSP = 0x0001
2056
+ FF_ALPHA_SEMI_TRANSP = 0x0002
2057
+ attach_function :img_get_alpha_info, :img_get_alpha_info, [ :pointer, PixelFormat, :int, :int ], :int
2058
+ attach_function :avpicture_deinterlace, :avpicture_deinterlace, [ AVPicture.ptr, :pointer, PixelFormat, :int, :int ], :int
2059
+ attach_function :av_codec_next, :av_codec_next, [ AVCodec.ptr ], AVCodec.ptr
2060
+ attach_function :avcodec_version, :avcodec_version, [ ], :uint
2061
+ attach_function :avcodec_configuration, :avcodec_configuration, [ ], :string
2062
+ attach_function :avcodec_license, :avcodec_license, [ ], :string
2063
+ attach_function :avcodec_init, :avcodec_init, [ ], :void
2064
+ attach_function :avcodec_register, :avcodec_register, [ AVCodec.ptr ], :void
2065
+ attach_function :avcodec_find_encoder, :avcodec_find_encoder, [ CodecID ], AVCodec.ptr
2066
+ attach_function :avcodec_find_encoder_by_name, :avcodec_find_encoder_by_name, [ :string ], AVCodec.ptr
2067
+ attach_function :avcodec_find_decoder, :avcodec_find_decoder, [ CodecID ], AVCodec.ptr
2068
+ attach_function :avcodec_find_decoder_by_name, :avcodec_find_decoder_by_name, [ :string ], AVCodec.ptr
2069
+ attach_function :avcodec_string, :avcodec_string, [ :string, :int, AVCodecContext.ptr, :int ], :void
2070
+ attach_function :av_get_profile_name, :av_get_profile_name, [ :pointer, :int ], :string
2071
+ attach_function :avcodec_get_context_defaults, :avcodec_get_context_defaults, [ AVCodecContext.ptr ], :void
2072
+ attach_function :avcodec_get_context_defaults2, :avcodec_get_context_defaults2, [ AVCodecContext.ptr, AVMediaType ], :void
2073
+ attach_function :avcodec_get_context_defaults3, :avcodec_get_context_defaults3, [ AVCodecContext.ptr, AVCodec.ptr ], :int
2074
+ attach_function :avcodec_alloc_context, :avcodec_alloc_context, [ ], AVCodecContext.ptr
2075
+ attach_function :avcodec_alloc_context2, :avcodec_alloc_context2, [ AVMediaType ], AVCodecContext.ptr
2076
+ attach_function :avcodec_alloc_context3, :avcodec_alloc_context3, [ AVCodec.ptr ], AVCodecContext.ptr
2077
+ attach_function :avcodec_copy_context, :avcodec_copy_context, [ AVCodecContext.ptr, :pointer ], :int
2078
+ attach_function :avcodec_get_frame_defaults, :avcodec_get_frame_defaults, [ AVFrame.ptr ], :void
2079
+ attach_function :avcodec_alloc_frame, :avcodec_alloc_frame, [ ], AVFrame.ptr
2080
+ attach_function :avcodec_default_get_buffer, :avcodec_default_get_buffer, [ AVCodecContext.ptr, AVFrame.ptr ], :int
2081
+ attach_function :avcodec_default_release_buffer, :avcodec_default_release_buffer, [ AVCodecContext.ptr, AVFrame.ptr ], :void
2082
+ attach_function :avcodec_default_reget_buffer, :avcodec_default_reget_buffer, [ AVCodecContext.ptr, AVFrame.ptr ], :int
2083
+ attach_function :avcodec_get_edge_width, :avcodec_get_edge_width, [ ], :uint
2084
+ attach_function :avcodec_align_dimensions, :avcodec_align_dimensions, [ AVCodecContext.ptr, :pointer, :pointer ], :void
2085
+ attach_function :avcodec_align_dimensions2, :avcodec_align_dimensions2, [ AVCodecContext.ptr, :pointer, :pointer, :pointer ], :void
2086
+ attach_function :avcodec_default_get_format, :avcodec_default_get_format, [ AVCodecContext.ptr, :pointer ], PixelFormat
2087
+ attach_function :avcodec_thread_init, :avcodec_thread_init, [ AVCodecContext.ptr, :int ], :int
2088
+ attach_function :avcodec_default_execute, :avcodec_default_execute, [ AVCodecContext.ptr, callback([ AVCodecContext.ptr, :pointer ], :int), :pointer, :pointer, :int, :int ], :int
2089
+ attach_function :avcodec_default_execute2, :avcodec_default_execute2, [ AVCodecContext.ptr, callback([ AVCodecContext.ptr, :pointer, :int, :int ], :int), :pointer, :pointer, :int ], :int
2090
+ attach_function :avcodec_open, :avcodec_open, [ AVCodecContext.ptr, AVCodec.ptr ], :int
2091
+ attach_function :avcodec_open2, :avcodec_open2, [ AVCodecContext.ptr, AVCodec.ptr, :pointer ], :int
2092
+ attach_function :avcodec_decode_audio3, :avcodec_decode_audio3, [ AVCodecContext.ptr, :pointer, :pointer, AVPacket.ptr ], :int
2093
+ attach_function :avcodec_decode_audio4, :avcodec_decode_audio4, [ AVCodecContext.ptr, AVFrame.ptr, :pointer, AVPacket.ptr ], :int
2094
+ attach_function :avcodec_decode_video2, :avcodec_decode_video2, [ AVCodecContext.ptr, AVFrame.ptr, :pointer, AVPacket.ptr ], :int, { :blocking => true }
2095
+ attach_function :avcodec_decode_subtitle2, :avcodec_decode_subtitle2, [ AVCodecContext.ptr, AVSubtitle.ptr, :pointer, AVPacket.ptr ], :int
2096
+ attach_function :avsubtitle_free, :avsubtitle_free, [ AVSubtitle.ptr ], :void
2097
+ attach_function :avcodec_encode_audio, :avcodec_encode_audio, [ AVCodecContext.ptr, :pointer, :int, :pointer ], :int
2098
+ attach_function :avcodec_encode_audio2, :avcodec_encode_audio2, [ AVCodecContext.ptr, AVPacket.ptr, :pointer, :pointer ], :int
2099
+ attach_function :avcodec_fill_audio_frame, :avcodec_fill_audio_frame, [ AVFrame.ptr, :int, :int, :pointer, :int, :int ], :int
2100
+ attach_function :avcodec_encode_video, :avcodec_encode_video, [ AVCodecContext.ptr, :pointer, :int, :pointer ], :int
2101
+ attach_function :avcodec_encode_subtitle, :avcodec_encode_subtitle, [ AVCodecContext.ptr, :pointer, :int, :pointer ], :int
2102
+ attach_function :avcodec_close, :avcodec_close, [ AVCodecContext.ptr ], :int
2103
+ attach_function :avcodec_register_all, :avcodec_register_all, [ ], :void
2104
+ attach_function :avcodec_flush_buffers, :avcodec_flush_buffers, [ AVCodecContext.ptr ], :void
2105
+ attach_function :avcodec_default_free_buffers, :avcodec_default_free_buffers, [ AVCodecContext.ptr ], :void
2106
+ attach_function :av_get_pict_type_char, :av_get_pict_type_char, [ :int ], :char
2107
+ attach_function :av_get_bits_per_sample, :av_get_bits_per_sample, [ CodecID ], :int
2108
+ attach_function :av_get_bits_per_sample_format, :av_get_bits_per_sample_format, [ :int ], :int
2109
+ AV_PARSER_PTS_NB = 4
2110
+ PARSER_FLAG_COMPLETE_FRAMES = 0x0001
2111
+ PARSER_FLAG_ONCE = 0x0002
2112
+ PARSER_FLAG_FETCHED_OFFSET = 0x0004
2113
+ class AVCodecParserContext < FFI::Struct
2114
+ layout(
2115
+ :priv_data, :pointer,
2116
+ :parser, AVCodecParser.ptr,
2117
+ :frame_offset, :int64,
2118
+ :cur_offset, :int64,
2119
+ :next_frame_offset, :int64,
2120
+ :pict_type, :int,
2121
+ :repeat_pict, :int,
2122
+ :pts, :int64,
2123
+ :dts, :int64,
2124
+ :last_pts, :int64,
2125
+ :last_dts, :int64,
2126
+ :fetch_timestamp, :int,
2127
+ :cur_frame_start_index, :int,
2128
+ :cur_frame_offset, [:int64, 4],
2129
+ :cur_frame_pts, [:int64, 4],
2130
+ :cur_frame_dts, [:int64, 4],
2131
+ :flags, :int,
2132
+ :offset, :int64,
2133
+ :cur_frame_end, [:int64, 4],
2134
+ :key_frame, :int,
2135
+ :convergence_duration, :int64,
2136
+ :dts_sync_point, :int,
2137
+ :dts_ref_dts_delta, :int,
2138
+ :pts_dts_delta, :int,
2139
+ :cur_frame_pos, [:int64, 4],
2140
+ :pos, :int64,
2141
+ :last_pos, :int64
2142
+ )
2143
+ end
2144
+ class AVCodecParser < FFI::Struct
2145
+ layout(
2146
+ :codec_ids, [:int, 5],
2147
+ :priv_data_size, :int,
2148
+ :parser_init, callback([ AVCodecParserContext.ptr ], :int),
2149
+ :parser_parse, callback([ AVCodecParserContext.ptr, AVCodecContext.ptr, :pointer, :pointer, :pointer, :int ], :int),
2150
+ :parser_close, callback([ AVCodecParserContext.ptr ], :void),
2151
+ :split, callback([ AVCodecContext.ptr, :pointer, :int ], :int),
2152
+ :next, AVCodecParser.ptr
2153
+ )
2154
+ def parser_init=(cb)
2155
+ @parser_init = cb
2156
+ self[:parser_init] = @parser_init
2157
+ end
2158
+ def parser_init
2159
+ @parser_init
2160
+ end
2161
+ def parser_parse=(cb)
2162
+ @parser_parse = cb
2163
+ self[:parser_parse] = @parser_parse
2164
+ end
2165
+ def parser_parse
2166
+ @parser_parse
2167
+ end
2168
+ def parser_close=(cb)
2169
+ @parser_close = cb
2170
+ self[:parser_close] = @parser_close
2171
+ end
2172
+ def parser_close
2173
+ @parser_close
2174
+ end
2175
+ def split=(cb)
2176
+ @split = cb
2177
+ self[:split] = @split
2178
+ end
2179
+ def split
2180
+ @split
2181
+ end
2182
+
2183
+ end
2184
+ attach_function :av_parser_next, :av_parser_next, [ AVCodecParser.ptr ], AVCodecParser.ptr
2185
+ attach_function :av_register_codec_parser, :av_register_codec_parser, [ AVCodecParser.ptr ], :void
2186
+ attach_function :av_parser_init, :av_parser_init, [ :int ], AVCodecParserContext.ptr
2187
+ attach_function :av_parser_parse2, :av_parser_parse2, [ AVCodecParserContext.ptr, AVCodecContext.ptr, :pointer, :pointer, :pointer, :int, :int64, :int64, :int64 ], :int
2188
+ attach_function :av_parser_change, :av_parser_change, [ AVCodecParserContext.ptr, AVCodecContext.ptr, :pointer, :pointer, :pointer, :int, :int ], :int
2189
+ attach_function :av_parser_close, :av_parser_close, [ AVCodecParserContext.ptr ], :void
2190
+ class AVBitStreamFilterContext < FFI::Struct
2191
+ layout(
2192
+ :priv_data, :pointer,
2193
+ :filter, AVBitStreamFilter.ptr,
2194
+ :parser, AVCodecParserContext.ptr,
2195
+ :next, AVBitStreamFilterContext.ptr
2196
+ )
2197
+ end
2198
+ class AVBitStreamFilter < FFI::Struct
2199
+ layout(
2200
+ :name, :pointer,
2201
+ :priv_data_size, :int,
2202
+ :filter, callback([ AVBitStreamFilterContext.ptr, AVCodecContext.ptr, :string, :pointer, :pointer, :pointer, :int, :int ], :int),
2203
+ :close, callback([ AVBitStreamFilterContext.ptr ], :void),
2204
+ :next, AVBitStreamFilter.ptr
2205
+ )
2206
+ def name=(str)
2207
+ @name = FFI::MemoryPointer.from_string(str)
2208
+ self[:name] = @name
2209
+ end
2210
+ def name
2211
+ @name.get_string(0)
2212
+ end
2213
+ def filter=(cb)
2214
+ @filter = cb
2215
+ self[:filter] = @filter
2216
+ end
2217
+ def filter
2218
+ @filter
2219
+ end
2220
+ def close=(cb)
2221
+ @close = cb
2222
+ self[:close] = @close
2223
+ end
2224
+ def close
2225
+ @close
2226
+ end
2227
+
2228
+ end
2229
+ attach_function :av_register_bitstream_filter, :av_register_bitstream_filter, [ AVBitStreamFilter.ptr ], :void
2230
+ attach_function :av_bitstream_filter_init, :av_bitstream_filter_init, [ :string ], AVBitStreamFilterContext.ptr
2231
+ attach_function :av_bitstream_filter_filter, :av_bitstream_filter_filter, [ AVBitStreamFilterContext.ptr, AVCodecContext.ptr, :string, :pointer, :pointer, :pointer, :int, :int ], :int
2232
+ attach_function :av_bitstream_filter_close, :av_bitstream_filter_close, [ AVBitStreamFilterContext.ptr ], :void
2233
+ attach_function :av_bitstream_filter_next, :av_bitstream_filter_next, [ AVBitStreamFilter.ptr ], AVBitStreamFilter.ptr
2234
+ attach_function :av_fast_realloc, :av_fast_realloc, [ :pointer, :pointer, :uint ], :pointer
2235
+ attach_function :av_fast_malloc, :av_fast_malloc, [ :pointer, :pointer, :uint ], :void
2236
+ attach_function :av_picture_copy, :av_picture_copy, [ AVPicture.ptr, :pointer, PixelFormat, :int, :int ], :void
2237
+ attach_function :av_picture_crop, :av_picture_crop, [ AVPicture.ptr, :pointer, PixelFormat, :int, :int ], :int
2238
+ attach_function :av_picture_pad, :av_picture_pad, [ AVPicture.ptr, :pointer, :int, :int, PixelFormat, :int, :int, :int, :int, :pointer ], :int
2239
+ attach_function :av_xiphlacing, :av_xiphlacing, [ :pointer, :uint ], :uint
2240
+ attach_function :av_log_missing_feature, :av_log_missing_feature, [ :pointer, :string, :int ], :void
2241
+ attach_function :av_log_ask_for_sample, :av_log_ask_for_sample, [ :pointer, :string, :varargs ], :void
2242
+ attach_function :av_register_hwaccel, :av_register_hwaccel, [ AVHWAccel.ptr ], :void
2243
+ attach_function :av_hwaccel_next, :av_hwaccel_next, [ AVHWAccel.ptr ], AVHWAccel.ptr
2244
+ AV_LOCK_CREATE = 0
2245
+ AV_LOCK_OBTAIN = AV_LOCK_CREATE + 1
2246
+ AV_LOCK_RELEASE = AV_LOCK_OBTAIN + 1
2247
+ AV_LOCK_DESTROY = AV_LOCK_RELEASE + 1
2248
+ AVLockOp = enum :AVLockOp, [
2249
+ :create,
2250
+ :obtain,
2251
+ :release,
2252
+ :destroy,
2253
+ ]
2254
+
2255
+ attach_function :av_lockmgr_register, :av_lockmgr_register, [ callback([ :pointer, AVLockOp ], :int) ], :int
2256
+ attach_function :avcodec_get_type, :avcodec_get_type, [ CodecID ], AVMediaType
2257
+ attach_function :avcodec_get_class, :avcodec_get_class, [ ], :pointer
2258
+ attach_function :avcodec_is_open, :avcodec_is_open, [ AVCodecContext.ptr ], :int
2259
+
2260
+
2261
+ ffi_lib [ "libavformat.so.53", "libavformat.53.dylib" ]
2262
+
2263
+ class AVIOContext < FFI::Struct; end
2264
+ class AVFormatContext < FFI::Struct; end
2265
+ class AVPacket < FFI::Struct; end
2266
+ class AVFormatParameters < FFI::Struct; end
2267
+ class AVOutputFormat < FFI::Struct; end
2268
+ class AVProbeData < FFI::Struct; end
2269
+ class AVInputFormat < FFI::Struct; end
2270
+ class AVCodecContext < FFI::Struct; end
2271
+ class AVCodecParserContext < FFI::Struct; end
2272
+ class AVIndexEntry < FFI::Struct; end
2273
+ class AVPacketList < FFI::Struct; end
2274
+ class AVStreamInfo < FFI::Struct; end
2275
+ class AVStream < FFI::Struct; end
2276
+ class AVCodec < FFI::Struct; end
2277
+ class AVProgram < FFI::Struct; end
2278
+ AVIO_SEEKABLE_NORMAL = 0x0001
2279
+ class AVIOInterruptCB < FFI::Struct
2280
+ layout(
2281
+ :callback, callback([ :pointer ], :int),
2282
+ :opaque, :pointer
2283
+ )
2284
+ def callback=(cb)
2285
+ @callback = cb
2286
+ self[:callback] = @callback
2287
+ end
2288
+ def callback
2289
+ @callback
2290
+ end
2291
+
2292
+ end
2293
+ class AVIOContext < FFI::Struct
2294
+ layout(
2295
+ :av_class, :pointer,
2296
+ :buffer, :pointer,
2297
+ :buffer_size, :int,
2298
+ :buf_ptr, :pointer,
2299
+ :buf_end, :pointer,
2300
+ :opaque, :pointer,
2301
+ :read_packet, callback([ :pointer, :pointer, :int ], :int),
2302
+ :write_packet, callback([ :pointer, :pointer, :int ], :int),
2303
+ :seek, callback([ :pointer, :int64, :int ], :int64),
2304
+ :pos, :int64,
2305
+ :must_flush, :int,
2306
+ :eof_reached, :int,
2307
+ :write_flag, :int,
2308
+ :max_packet_size, :int,
2309
+ :checksum, :ulong,
2310
+ :checksum_ptr, :pointer,
2311
+ :update_checksum, callback([ :ulong, :pointer, :uint ], :ulong),
2312
+ :error, :int,
2313
+ :read_pause, callback([ :pointer, :int ], :int),
2314
+ :read_seek, callback([ :pointer, :int, :int64, :int ], :int64),
2315
+ :seekable, :int
2316
+ )
2317
+ def read_packet=(cb)
2318
+ @read_packet = cb
2319
+ self[:read_packet] = @read_packet
2320
+ end
2321
+ def read_packet
2322
+ @read_packet
2323
+ end
2324
+ def write_packet=(cb)
2325
+ @write_packet = cb
2326
+ self[:write_packet] = @write_packet
2327
+ end
2328
+ def write_packet
2329
+ @write_packet
2330
+ end
2331
+ def seek=(cb)
2332
+ @seek = cb
2333
+ self[:seek] = @seek
2334
+ end
2335
+ def seek
2336
+ @seek
2337
+ end
2338
+ def update_checksum=(cb)
2339
+ @update_checksum = cb
2340
+ self[:update_checksum] = @update_checksum
2341
+ end
2342
+ def update_checksum
2343
+ @update_checksum
2344
+ end
2345
+ def read_pause=(cb)
2346
+ @read_pause = cb
2347
+ self[:read_pause] = @read_pause
2348
+ end
2349
+ def read_pause
2350
+ @read_pause
2351
+ end
2352
+ def read_seek=(cb)
2353
+ @read_seek = cb
2354
+ self[:read_seek] = @read_seek
2355
+ end
2356
+ def read_seek
2357
+ @read_seek
2358
+ end
2359
+
2360
+ end
2361
+ attach_function :avio_check, :avio_check, [ :string, :int ], :int
2362
+ attach_function :avio_alloc_context, :avio_alloc_context, [ :pointer, :int, :int, :pointer, callback([ :pointer, :pointer, :int ], :int), callback([ :pointer, :pointer, :int ], :int), callback([ :pointer, :int64, :int ], :int64) ], AVIOContext.ptr
2363
+ attach_function :avio_w8, :avio_w8, [ AVIOContext.ptr, :int ], :void
2364
+ attach_function :avio_write, :avio_write, [ AVIOContext.ptr, :pointer, :int ], :void
2365
+ attach_function :avio_wl64, :avio_wl64, [ AVIOContext.ptr, :uint64 ], :void
2366
+ attach_function :avio_wb64, :avio_wb64, [ AVIOContext.ptr, :uint64 ], :void
2367
+ attach_function :avio_wl32, :avio_wl32, [ AVIOContext.ptr, :uint ], :void
2368
+ attach_function :avio_wb32, :avio_wb32, [ AVIOContext.ptr, :uint ], :void
2369
+ attach_function :avio_wl24, :avio_wl24, [ AVIOContext.ptr, :uint ], :void
2370
+ attach_function :avio_wb24, :avio_wb24, [ AVIOContext.ptr, :uint ], :void
2371
+ attach_function :avio_wl16, :avio_wl16, [ AVIOContext.ptr, :uint ], :void
2372
+ attach_function :avio_wb16, :avio_wb16, [ AVIOContext.ptr, :uint ], :void
2373
+ attach_function :avio_put_str, :avio_put_str, [ AVIOContext.ptr, :string ], :int
2374
+ attach_function :avio_put_str16le, :avio_put_str16le, [ AVIOContext.ptr, :string ], :int
2375
+ AVSEEK_SIZE = 0x10000
2376
+ AVSEEK_FORCE = 0x20000
2377
+ attach_function :avio_seek, :avio_seek, [ AVIOContext.ptr, :int64, :int ], :int64
2378
+ # inline function avio_skip
2379
+ # inline function avio_tell
2380
+ attach_function :avio_size, :avio_size, [ AVIOContext.ptr ], :int64
2381
+ attach_function :avio_printf, :avio_printf, [ AVIOContext.ptr, :string, :varargs ], :int
2382
+ attach_function :avio_flush, :avio_flush, [ AVIOContext.ptr ], :void
2383
+ attach_function :avio_read, :avio_read, [ AVIOContext.ptr, :pointer, :int ], :int
2384
+ attach_function :avio_r8, :avio_r8, [ AVIOContext.ptr ], :int
2385
+ attach_function :avio_rl16, :avio_rl16, [ AVIOContext.ptr ], :uint
2386
+ attach_function :avio_rl24, :avio_rl24, [ AVIOContext.ptr ], :uint
2387
+ attach_function :avio_rl32, :avio_rl32, [ AVIOContext.ptr ], :uint
2388
+ attach_function :avio_rl64, :avio_rl64, [ AVIOContext.ptr ], :uint64
2389
+ attach_function :avio_rb16, :avio_rb16, [ AVIOContext.ptr ], :uint
2390
+ attach_function :avio_rb24, :avio_rb24, [ AVIOContext.ptr ], :uint
2391
+ attach_function :avio_rb32, :avio_rb32, [ AVIOContext.ptr ], :uint
2392
+ attach_function :avio_rb64, :avio_rb64, [ AVIOContext.ptr ], :uint64
2393
+ attach_function :avio_get_str, :avio_get_str, [ AVIOContext.ptr, :int, :string, :int ], :int
2394
+ attach_function :avio_get_str16le, :avio_get_str16le, [ AVIOContext.ptr, :int, :string, :int ], :int
2395
+ attach_function :avio_get_str16be, :avio_get_str16be, [ AVIOContext.ptr, :int, :string, :int ], :int
2396
+ AVIO_FLAG_READ = 1
2397
+ AVIO_FLAG_WRITE = 2
2398
+ AVIO_FLAG_READ_WRITE = (1|2)
2399
+ AVIO_FLAG_NONBLOCK = 8
2400
+ attach_function :avio_open, :avio_open, [ :pointer, :string, :int ], :int
2401
+ attach_function :avio_open2, :avio_open2, [ :pointer, :string, :int, :pointer, :pointer ], :int
2402
+ attach_function :avio_close, :avio_close, [ AVIOContext.ptr ], :int
2403
+ attach_function :avio_open_dyn_buf, :avio_open_dyn_buf, [ :pointer ], :int
2404
+ attach_function :avio_close_dyn_buf, :avio_close_dyn_buf, [ AVIOContext.ptr, :pointer ], :int
2405
+ attach_function :avio_enum_protocols, :avio_enum_protocols, [ :pointer, :int ], :string
2406
+ attach_function :avio_pause, :avio_pause, [ AVIOContext.ptr, :int ], :int
2407
+ attach_function :avio_seek_time, :avio_seek_time, [ AVIOContext.ptr, :int, :int64, :int ], :int64
2408
+ LIBAVFORMAT_VERSION_MAJOR = 53
2409
+ LIBAVFORMAT_VERSION_MINOR = 21
2410
+ LIBAVFORMAT_VERSION_MICRO = 1
2411
+ LIBAVFORMAT_VERSION_INT = (53 << 16|21 << 8|1)
2412
+ LIBAVFORMAT_BUILD = (53 << 16|21 << 8|1)
2413
+ LIBAVFORMAT_IDENT = 'Lavf53.21.1'
2414
+ attach_function :av_metadata_get, :av_metadata_get, [ :pointer, :string, :pointer, :int ], :pointer
2415
+ attach_function :av_metadata_set2, :av_metadata_set2, [ :pointer, :string, :string, :int ], :int
2416
+ attach_function :av_metadata_conv, :av_metadata_conv, [ AVFormatContext.ptr, :pointer, :pointer ], :void
2417
+ attach_function :av_metadata_copy, :av_metadata_copy, [ :pointer, :pointer, :int ], :void
2418
+ attach_function :av_metadata_free, :av_metadata_free, [ :pointer ], :void
2419
+ attach_function :av_get_packet, :av_get_packet, [ AVIOContext.ptr, AVPacket.ptr, :int ], :int
2420
+ attach_function :av_append_packet, :av_append_packet, [ AVIOContext.ptr, AVPacket.ptr, :int ], :int
2421
+ class AVFrac < FFI::Struct
2422
+ layout(
2423
+ :val, :int64,
2424
+ :num, :int64,
2425
+ :den, :int64
2426
+ )
2427
+ end
2428
+ class AVProbeData < FFI::Struct
2429
+ layout(
2430
+ :filename, :pointer,
2431
+ :buf, :pointer,
2432
+ :buf_size, :int
2433
+ )
2434
+ def filename=(str)
2435
+ @filename = FFI::MemoryPointer.from_string(str)
2436
+ self[:filename] = @filename
2437
+ end
2438
+ def filename
2439
+ @filename.get_string(0)
2440
+ end
2441
+
2442
+ end
2443
+ AVPROBE_SCORE_MAX = 100
2444
+ AVPROBE_PADDING_SIZE = 32
2445
+ class AVFormatParameters < FFI::Struct
2446
+ layout(
2447
+ :time_base, AVRational.by_value,
2448
+ :sample_rate, :int,
2449
+ :channels, :int,
2450
+ :width, :int,
2451
+ :height, :int,
2452
+ :pix_fmt, PixelFormat,
2453
+ :channel, :int,
2454
+ :standard, :pointer,
2455
+ :mpeg2ts_raw, :uint,
2456
+ :mpeg2ts_compute_pcr, :uint,
2457
+ :initial_pause, :uint,
2458
+ :prealloced_context, :uint
2459
+ )
2460
+ def standard=(str)
2461
+ @standard = FFI::MemoryPointer.from_string(str)
2462
+ self[:standard] = @standard
2463
+ end
2464
+ def standard
2465
+ @standard.get_string(0)
2466
+ end
2467
+
2468
+ end
2469
+ AVFMT_NOFILE = 0x0001
2470
+ AVFMT_NEEDNUMBER = 0x0002
2471
+ AVFMT_SHOW_IDS = 0x0008
2472
+ AVFMT_RAWPICTURE = 0x0020
2473
+ AVFMT_GLOBALHEADER = 0x0040
2474
+ AVFMT_NOTIMESTAMPS = 0x0080
2475
+ AVFMT_GENERIC_INDEX = 0x0100
2476
+ AVFMT_TS_DISCONT = 0x0200
2477
+ AVFMT_VARIABLE_FPS = 0x0400
2478
+ AVFMT_NODIMENSIONS = 0x0800
2479
+ AVFMT_NOSTREAMS = 0x1000
2480
+ AVFMT_NOBINSEARCH = 0x2000
2481
+ AVFMT_NOGENSEARCH = 0x4000
2482
+ AVFMT_NO_BYTE_SEEK = 0x8000
2483
+ class AVOutputFormat < FFI::Struct
2484
+ layout(
2485
+ :name, :pointer,
2486
+ :long_name, :pointer,
2487
+ :mime_type, :pointer,
2488
+ :extensions, :pointer,
2489
+ :priv_data_size, :int,
2490
+ :audio_codec, CodecID,
2491
+ :video_codec, CodecID,
2492
+ :write_header, callback([ AVFormatContext.ptr ], :int),
2493
+ :write_packet, callback([ AVFormatContext.ptr, AVPacket.ptr ], :int),
2494
+ :write_trailer, callback([ AVFormatContext.ptr ], :int),
2495
+ :flags, :int,
2496
+ :set_parameters, callback([ AVFormatContext.ptr, AVFormatParameters.ptr ], :int),
2497
+ :interleave_packet, callback([ AVFormatContext.ptr, AVPacket.ptr, AVPacket.ptr, :int ], :int),
2498
+ :codec_tag, :pointer,
2499
+ :subtitle_codec, CodecID,
2500
+ :metadata_conv, :pointer,
2501
+ :priv_class, :pointer,
2502
+ :query_codec, callback([ CodecID, :int ], :int),
2503
+ :next, AVOutputFormat.ptr
2504
+ )
2505
+ def name=(str)
2506
+ @name = FFI::MemoryPointer.from_string(str)
2507
+ self[:name] = @name
2508
+ end
2509
+ def name
2510
+ @name.get_string(0)
2511
+ end
2512
+ def long_name=(str)
2513
+ @long_name = FFI::MemoryPointer.from_string(str)
2514
+ self[:long_name] = @long_name
2515
+ end
2516
+ def long_name
2517
+ @long_name.get_string(0)
2518
+ end
2519
+ def mime_type=(str)
2520
+ @mime_type = FFI::MemoryPointer.from_string(str)
2521
+ self[:mime_type] = @mime_type
2522
+ end
2523
+ def mime_type
2524
+ @mime_type.get_string(0)
2525
+ end
2526
+ def extensions=(str)
2527
+ @extensions = FFI::MemoryPointer.from_string(str)
2528
+ self[:extensions] = @extensions
2529
+ end
2530
+ def extensions
2531
+ @extensions.get_string(0)
2532
+ end
2533
+ def write_header=(cb)
2534
+ @write_header = cb
2535
+ self[:write_header] = @write_header
2536
+ end
2537
+ def write_header
2538
+ @write_header
2539
+ end
2540
+ def write_packet=(cb)
2541
+ @write_packet = cb
2542
+ self[:write_packet] = @write_packet
2543
+ end
2544
+ def write_packet
2545
+ @write_packet
2546
+ end
2547
+ def write_trailer=(cb)
2548
+ @write_trailer = cb
2549
+ self[:write_trailer] = @write_trailer
2550
+ end
2551
+ def write_trailer
2552
+ @write_trailer
2553
+ end
2554
+ def set_parameters=(cb)
2555
+ @set_parameters = cb
2556
+ self[:set_parameters] = @set_parameters
2557
+ end
2558
+ def set_parameters
2559
+ @set_parameters
2560
+ end
2561
+ def interleave_packet=(cb)
2562
+ @interleave_packet = cb
2563
+ self[:interleave_packet] = @interleave_packet
2564
+ end
2565
+ def interleave_packet
2566
+ @interleave_packet
2567
+ end
2568
+ def query_codec=(cb)
2569
+ @query_codec = cb
2570
+ self[:query_codec] = @query_codec
2571
+ end
2572
+ def query_codec
2573
+ @query_codec
2574
+ end
2575
+
2576
+ end
2577
+ class AVInputFormat < FFI::Struct
2578
+ layout(
2579
+ :name, :pointer,
2580
+ :long_name, :pointer,
2581
+ :priv_data_size, :int,
2582
+ :read_probe, callback([ AVProbeData.ptr ], :int),
2583
+ :read_header, callback([ AVFormatContext.ptr, AVFormatParameters.ptr ], :int),
2584
+ :read_packet, callback([ AVFormatContext.ptr, AVPacket.ptr ], :int),
2585
+ :read_close, callback([ AVFormatContext.ptr ], :int),
2586
+ :read_seek, callback([ AVFormatContext.ptr, :int, :int64, :int ], :int),
2587
+ :read_timestamp, callback([ AVFormatContext.ptr, :int, :pointer, :int64 ], :int64),
2588
+ :flags, :int,
2589
+ :extensions, :pointer,
2590
+ :value, :int,
2591
+ :read_play, callback([ AVFormatContext.ptr ], :int),
2592
+ :read_pause, callback([ AVFormatContext.ptr ], :int),
2593
+ :codec_tag, :pointer,
2594
+ :read_seek2, callback([ AVFormatContext.ptr, :int, :int64, :int64, :int64, :int ], :int),
2595
+ :metadata_conv, :pointer,
2596
+ :priv_class, :pointer,
2597
+ :next, AVInputFormat.ptr
2598
+ )
2599
+ def name=(str)
2600
+ @name = FFI::MemoryPointer.from_string(str)
2601
+ self[:name] = @name
2602
+ end
2603
+ def name
2604
+ @name.get_string(0)
2605
+ end
2606
+ def long_name=(str)
2607
+ @long_name = FFI::MemoryPointer.from_string(str)
2608
+ self[:long_name] = @long_name
2609
+ end
2610
+ def long_name
2611
+ @long_name.get_string(0)
2612
+ end
2613
+ def read_probe=(cb)
2614
+ @read_probe = cb
2615
+ self[:read_probe] = @read_probe
2616
+ end
2617
+ def read_probe
2618
+ @read_probe
2619
+ end
2620
+ def read_header=(cb)
2621
+ @read_header = cb
2622
+ self[:read_header] = @read_header
2623
+ end
2624
+ def read_header
2625
+ @read_header
2626
+ end
2627
+ def read_packet=(cb)
2628
+ @read_packet = cb
2629
+ self[:read_packet] = @read_packet
2630
+ end
2631
+ def read_packet
2632
+ @read_packet
2633
+ end
2634
+ def read_close=(cb)
2635
+ @read_close = cb
2636
+ self[:read_close] = @read_close
2637
+ end
2638
+ def read_close
2639
+ @read_close
2640
+ end
2641
+ def read_seek=(cb)
2642
+ @read_seek = cb
2643
+ self[:read_seek] = @read_seek
2644
+ end
2645
+ def read_seek
2646
+ @read_seek
2647
+ end
2648
+ def read_timestamp=(cb)
2649
+ @read_timestamp = cb
2650
+ self[:read_timestamp] = @read_timestamp
2651
+ end
2652
+ def read_timestamp
2653
+ @read_timestamp
2654
+ end
2655
+ def extensions=(str)
2656
+ @extensions = FFI::MemoryPointer.from_string(str)
2657
+ self[:extensions] = @extensions
2658
+ end
2659
+ def extensions
2660
+ @extensions.get_string(0)
2661
+ end
2662
+ def read_play=(cb)
2663
+ @read_play = cb
2664
+ self[:read_play] = @read_play
2665
+ end
2666
+ def read_play
2667
+ @read_play
2668
+ end
2669
+ def read_pause=(cb)
2670
+ @read_pause = cb
2671
+ self[:read_pause] = @read_pause
2672
+ end
2673
+ def read_pause
2674
+ @read_pause
2675
+ end
2676
+ def read_seek2=(cb)
2677
+ @read_seek2 = cb
2678
+ self[:read_seek2] = @read_seek2
2679
+ end
2680
+ def read_seek2
2681
+ @read_seek2
2682
+ end
2683
+
2684
+ end
2685
+ AVSTREAM_PARSE_NONE = 0
2686
+ AVSTREAM_PARSE_FULL = AVSTREAM_PARSE_NONE + 1
2687
+ AVSTREAM_PARSE_HEADERS = AVSTREAM_PARSE_FULL + 1
2688
+ AVSTREAM_PARSE_TIMESTAMPS = AVSTREAM_PARSE_HEADERS + 1
2689
+ AVSTREAM_PARSE_FULL_ONCE = AVSTREAM_PARSE_TIMESTAMPS + 1
2690
+ AVStreamParseType = enum :AVStreamParseType, [
2691
+ :none,
2692
+ :full,
2693
+ :headers,
2694
+ :timestamps,
2695
+ :full_once,
2696
+ ]
2697
+
2698
+ AVINDEX_KEYFRAME = 0x0001
2699
+ class AVIndexEntry < FFI::Struct
2700
+ layout(
2701
+ :pos, :int64,
2702
+ :timestamp, :int64,
2703
+ :flags, :int,
2704
+ :size, :int,
2705
+ :min_distance, :int
2706
+ )
2707
+ end
2708
+ AV_DISPOSITION_DEFAULT = 0x0001
2709
+ AV_DISPOSITION_DUB = 0x0002
2710
+ AV_DISPOSITION_ORIGINAL = 0x0004
2711
+ AV_DISPOSITION_COMMENT = 0x0008
2712
+ AV_DISPOSITION_LYRICS = 0x0010
2713
+ AV_DISPOSITION_KARAOKE = 0x0020
2714
+ AV_DISPOSITION_FORCED = 0x0040
2715
+ AV_DISPOSITION_HEARING_IMPAIRED = 0x0080
2716
+ AV_DISPOSITION_VISUAL_IMPAIRED = 0x0100
2717
+ AV_DISPOSITION_CLEAN_EFFECTS = 0x0200
2718
+ MAX_REORDER_DELAY = 16
2719
+ MAX_PROBE_PACKETS = 2500
2720
+ MAX_STD_TIMEBASES = (60*12+5)
2721
+ class AVStreamInfo < FFI::Struct
2722
+ layout(
2723
+ :last_dts, :int64,
2724
+ :duration_gcd, :int64,
2725
+ :duration_count, :int,
2726
+ :duration_error, [:double, (60*12+5)],
2727
+ :codec_info_duration, :int64,
2728
+ :nb_decoded_frames, :int
2729
+ )
2730
+ end
2731
+ class AVStream < FFI::Struct
2732
+ layout(
2733
+ :index, :int,
2734
+ :id, :int,
2735
+ :codec, AVCodecContext.ptr,
2736
+ :r_frame_rate, AVRational.by_value,
2737
+ :priv_data, :pointer,
2738
+ :first_dts, :int64,
2739
+ :pts, AVFrac.by_value,
2740
+ :time_base, AVRational.by_value,
2741
+ :pts_wrap_bits, :int,
2742
+ :stream_copy, :int,
2743
+ :discard, AVDiscard,
2744
+ :quality, :float,
2745
+ :start_time, :int64,
2746
+ :duration, :int64,
2747
+ :need_parsing, AVStreamParseType,
2748
+ :parser, AVCodecParserContext.ptr,
2749
+ :cur_dts, :int64,
2750
+ :last_IP_duration, :int,
2751
+ :last_IP_pts, :int64,
2752
+ :index_entries, AVIndexEntry.ptr,
2753
+ :nb_index_entries, :int,
2754
+ :index_entries_allocated_size, :uint,
2755
+ :nb_frames, :int64,
2756
+ :disposition, :int,
2757
+ :probe_data, AVProbeData.by_value,
2758
+ :pts_buffer, [:int64, 16+1],
2759
+ :sample_aspect_ratio, AVRational.by_value,
2760
+ :metadata, :pointer,
2761
+ :info, AVStreamInfo.ptr,
2762
+ :cur_ptr, :pointer,
2763
+ :cur_len, :int,
2764
+ :cur_pkt, AVPacket.by_value,
2765
+ :reference_dts, :int64,
2766
+ :probe_packets, :int,
2767
+ :last_in_packet_buffer, AVPacketList.ptr,
2768
+ :avg_frame_rate, AVRational.by_value,
2769
+ :codec_info_nb_frames, :int,
2770
+ )
2771
+ end
2772
+ AV_PROGRAM_RUNNING = 1
2773
+ class AVProgram < FFI::Struct
2774
+ layout(
2775
+ :id, :int,
2776
+ :flags, :int,
2777
+ :discard, AVDiscard,
2778
+ :stream_index, :pointer,
2779
+ :nb_stream_indexes, :uint,
2780
+ :metadata, :pointer
2781
+ )
2782
+ end
2783
+ AVFMTCTX_NOHEADER = 0x0001
2784
+ class AVChapter < FFI::Struct
2785
+ layout(
2786
+ :id, :int,
2787
+ :time_base, AVRational.by_value,
2788
+ :start, :int64,
2789
+ :end, :int64,
2790
+ :metadata, :pointer
2791
+ )
2792
+ end
2793
+ AVFMT_NOOUTPUTLOOP = -1
2794
+ AVFMT_INFINITEOUTPUTLOOP = 0
2795
+ AVFMT_FLAG_GENPTS = 0x0001
2796
+ AVFMT_FLAG_IGNIDX = 0x0002
2797
+ AVFMT_FLAG_NONBLOCK = 0x0004
2798
+ AVFMT_FLAG_IGNDTS = 0x0008
2799
+ AVFMT_FLAG_NOFILLIN = 0x0010
2800
+ AVFMT_FLAG_NOPARSE = 0x0020
2801
+ AVFMT_FLAG_RTP_HINT = 0x0040
2802
+ AVFMT_FLAG_CUSTOM_IO = 0x0080
2803
+ AVFMT_FLAG_DISCARD_CORRUPT = 0x0100
2804
+ FF_FDEBUG_TS = 0x0001
2805
+ RAW_PACKET_BUFFER_SIZE = 2500000
2806
+ class AVFormatContext < FFI::Struct
2807
+ layout(
2808
+ :av_class, :pointer,
2809
+ :iformat, AVInputFormat.ptr,
2810
+ :oformat, AVOutputFormat.ptr,
2811
+ :priv_data, :pointer,
2812
+ :pb, AVIOContext.ptr,
2813
+ :nb_streams, :uint,
2814
+ :streams, :pointer,
2815
+ :filename, [:char, 1024],
2816
+ :timestamp, :int64,
2817
+ :ctx_flags, :int,
2818
+ :packet_buffer, AVPacketList.ptr,
2819
+ :start_time, :int64,
2820
+ :duration, :int64,
2821
+ :file_size, :int64,
2822
+ :bit_rate, :int,
2823
+ :cur_st, AVStream.ptr,
2824
+ :data_offset, :int64,
2825
+ :mux_rate, :int,
2826
+ :packet_size, :uint,
2827
+ :preload, :int,
2828
+ :max_delay, :int,
2829
+ :loop_output, :int,
2830
+ :flags, :int,
2831
+ :loop_input, :int,
2832
+ :probesize, :uint,
2833
+ :max_analyze_duration, :int,
2834
+ :key, :pointer,
2835
+ :keylen, :int,
2836
+ :nb_programs, :uint,
2837
+ :programs, :pointer,
2838
+ :video_codec_id, CodecID,
2839
+ :audio_codec_id, CodecID,
2840
+ :subtitle_codec_id, CodecID,
2841
+ :max_index_size, :uint,
2842
+ :max_picture_buffer, :uint,
2843
+ :nb_chapters, :uint,
2844
+ :chapters, :pointer,
2845
+ :debug, :int,
2846
+ :raw_packet_buffer, AVPacketList.ptr,
2847
+ :raw_packet_buffer_end, AVPacketList.ptr,
2848
+ :packet_buffer_end, AVPacketList.ptr,
2849
+ :metadata, :pointer,
2850
+ :raw_packet_buffer_remaining_size, :int,
2851
+ :start_time_realtime, :int64,
2852
+ :fps_probe_size, :int,
2853
+ :error_recognition, :int,
2854
+ :interrupt_callback, AVIOInterruptCB.by_value
2855
+ )
2856
+ end
2857
+ class AVPacketList < FFI::Struct
2858
+ layout(
2859
+ :pkt, AVPacket.by_value,
2860
+ :next, AVPacketList.ptr
2861
+ )
2862
+ end
2863
+ attach_function :avformat_version, :avformat_version, [ ], :uint
2864
+ attach_function :avformat_configuration, :avformat_configuration, [ ], :string
2865
+ attach_function :avformat_license, :avformat_license, [ ], :string
2866
+ attach_function :av_register_all, :av_register_all, [ ], :void
2867
+ attach_function :av_register_input_format, :av_register_input_format, [ AVInputFormat.ptr ], :void
2868
+ attach_function :av_register_output_format, :av_register_output_format, [ AVOutputFormat.ptr ], :void
2869
+ attach_function :avformat_network_init, :avformat_network_init, [ ], :int
2870
+ attach_function :avformat_network_deinit, :avformat_network_deinit, [ ], :int
2871
+ attach_function :av_iformat_next, :av_iformat_next, [ AVInputFormat.ptr ], AVInputFormat.ptr
2872
+ attach_function :av_oformat_next, :av_oformat_next, [ AVOutputFormat.ptr ], AVOutputFormat.ptr
2873
+ attach_function :avformat_alloc_context, :avformat_alloc_context, [ ], AVFormatContext.ptr
2874
+ attach_function :avformat_free_context, :avformat_free_context, [ AVFormatContext.ptr ], :void
2875
+ attach_function :avformat_get_class, :avformat_get_class, [ ], :pointer
2876
+ attach_function :avformat_new_stream, :avformat_new_stream, [ AVFormatContext.ptr, AVCodec.ptr ], AVStream.ptr
2877
+ attach_function :av_new_program, :av_new_program, [ AVFormatContext.ptr, :int ], AVProgram.ptr
2878
+ attach_function :av_guess_image2_codec, :av_guess_image2_codec, [ :string ], CodecID
2879
+ attach_function :av_pkt_dump, :av_pkt_dump, [ :pointer, AVPacket.ptr, :int ], :void
2880
+ attach_function :av_pkt_dump_log, :av_pkt_dump_log, [ :pointer, :int, AVPacket.ptr, :int ], :void
2881
+ attach_function :av_find_input_format, :av_find_input_format, [ :string ], AVInputFormat.ptr
2882
+ attach_function :av_probe_input_format, :av_probe_input_format, [ AVProbeData.ptr, :int ], AVInputFormat.ptr
2883
+ attach_function :av_probe_input_format2, :av_probe_input_format2, [ AVProbeData.ptr, :int, :pointer ], AVInputFormat.ptr
2884
+ attach_function :av_probe_input_buffer, :av_probe_input_buffer, [ AVIOContext.ptr, :pointer, :string, :pointer, :uint, :uint ], :int
2885
+ attach_function :av_open_input_stream, :av_open_input_stream, [ :pointer, AVIOContext.ptr, :string, AVInputFormat.ptr, AVFormatParameters.ptr ], :int
2886
+ attach_function :av_open_input_file, :av_open_input_file, [ :pointer, :string, AVInputFormat.ptr, :int, AVFormatParameters.ptr ], :int
2887
+ attach_function :avformat_open_input, :avformat_open_input, [ :pointer, :string, AVInputFormat.ptr, :pointer ], :int
2888
+ attach_function :av_find_stream_info, :av_find_stream_info, [ AVFormatContext.ptr ], :int
2889
+ attach_function :avformat_find_stream_info, :avformat_find_stream_info, [ AVFormatContext.ptr, :pointer ], :int
2890
+ attach_function :av_find_best_stream, :av_find_best_stream, [ AVFormatContext.ptr, AVMediaType, :int, :int, :pointer, :int ], :int
2891
+ attach_function :av_read_packet, :av_read_packet, [ AVFormatContext.ptr, AVPacket.ptr ], :int
2892
+ attach_function :av_read_frame, :av_read_frame, [ AVFormatContext.ptr, AVPacket.ptr ], :int
2893
+ attach_function :av_seek_frame, :av_seek_frame, [ AVFormatContext.ptr, :int, :int64, :int ], :int
2894
+ attach_function :avformat_seek_file, :avformat_seek_file, [ AVFormatContext.ptr, :int, :int64, :int64, :int64, :int ], :int
2895
+ attach_function :av_read_play, :av_read_play, [ AVFormatContext.ptr ], :int
2896
+ attach_function :av_read_pause, :av_read_pause, [ AVFormatContext.ptr ], :int
2897
+ attach_function :av_close_input_stream, :av_close_input_stream, [ AVFormatContext.ptr ], :void
2898
+ attach_function :av_close_input_file, :av_close_input_file, [ AVFormatContext.ptr ], :void
2899
+ attach_function :avformat_close_input, :avformat_close_input, [ :pointer ], :void
2900
+ attach_function :av_new_stream, :av_new_stream, [ AVFormatContext.ptr, :int ], AVStream.ptr
2901
+ attach_function :av_set_pts_info, :av_set_pts_info, [ AVStream.ptr, :int, :uint, :uint ], :void
2902
+ AVSEEK_FLAG_BACKWARD = 1
2903
+ AVSEEK_FLAG_BYTE = 2
2904
+ AVSEEK_FLAG_ANY = 4
2905
+ AVSEEK_FLAG_FRAME = 8
2906
+ attach_function :av_seek_frame_binary, :av_seek_frame_binary, [ AVFormatContext.ptr, :int, :int64, :int ], :int
2907
+ attach_function :av_update_cur_dts, :av_update_cur_dts, [ AVFormatContext.ptr, AVStream.ptr, :int64 ], :void
2908
+ attach_function :av_gen_search, :av_gen_search, [ AVFormatContext.ptr, :int, :int64, :int64, :int64, :int64, :int64, :int64, :int, :pointer, callback([ AVFormatContext.ptr, :int, :pointer, :int64 ], :int64) ], :int64
2909
+ attach_function :av_set_parameters, :av_set_parameters, [ AVFormatContext.ptr, AVFormatParameters.ptr ], :int
2910
+ attach_function :avformat_write_header, :avformat_write_header, [ AVFormatContext.ptr, :pointer ], :int
2911
+ attach_function :av_write_header, :av_write_header, [ AVFormatContext.ptr ], :int
2912
+ attach_function :av_write_frame, :av_write_frame, [ AVFormatContext.ptr, AVPacket.ptr ], :int
2913
+ attach_function :av_interleaved_write_frame, :av_interleaved_write_frame, [ AVFormatContext.ptr, AVPacket.ptr ], :int
2914
+ attach_function :av_interleave_packet_per_dts, :av_interleave_packet_per_dts, [ AVFormatContext.ptr, AVPacket.ptr, AVPacket.ptr, :int ], :int
2915
+ attach_function :av_write_trailer, :av_write_trailer, [ AVFormatContext.ptr ], :int
2916
+ attach_function :av_guess_format, :av_guess_format, [ :string, :string, :string ], AVOutputFormat.ptr
2917
+ attach_function :av_guess_codec, :av_guess_codec, [ AVOutputFormat.ptr, :string, :string, :string, AVMediaType ], CodecID
2918
+ attach_function :av_hex_dump, :av_hex_dump, [ :pointer, :pointer, :int ], :void
2919
+ attach_function :av_hex_dump_log, :av_hex_dump_log, [ :pointer, :int, :pointer, :int ], :void
2920
+ attach_function :av_pkt_dump2, :av_pkt_dump2, [ :pointer, AVPacket.ptr, :int, AVStream.ptr ], :void
2921
+ attach_function :av_pkt_dump_log2, :av_pkt_dump_log2, [ :pointer, :int, AVPacket.ptr, :int, AVStream.ptr ], :void
2922
+ attach_function :av_codec_get_id, :av_codec_get_id, [ :pointer, :uint ], :pointer
2923
+ attach_function :av_codec_get_tag, :av_codec_get_tag, [ :pointer, CodecID ], :pointer
2924
+ attach_function :av_find_default_stream_index, :av_find_default_stream_index, [ AVFormatContext.ptr ], :int
2925
+ attach_function :av_index_search_timestamp, :av_index_search_timestamp, [ AVStream.ptr, :int64, :int ], :int
2926
+ attach_function :av_add_index_entry, :av_add_index_entry, [ AVStream.ptr, :int64, :int64, :int, :int, :int ], :int
2927
+ attach_function :av_url_split, :av_url_split, [ :string, :int, :string, :int, :string, :int, :pointer, :string, :int, :string ], :void
2928
+ attach_function :dump_format, :dump_format, [ AVFormatContext.ptr, :int, :string, :int ], :void
2929
+ attach_function :av_dump_format, :av_dump_format, [ AVFormatContext.ptr, :int, :string, :int ], :void
2930
+ attach_function :parse_date, :parse_date, [ :string, :int ], :int64
2931
+ attach_function :av_gettime, :av_gettime, [ ], :int64
2932
+ attach_function :find_info_tag, :find_info_tag, [ :string, :int, :string, :string ], :int
2933
+ attach_function :av_get_frame_filename, :av_get_frame_filename, [ :string, :int, :string, :int ], :int
2934
+ attach_function :av_filename_number_test, :av_filename_number_test, [ :string ], :int
2935
+ attach_function :av_sdp_create, :av_sdp_create, [ :pointer, :int, :string, :int ], :pointer
2936
+ attach_function :avf_sdp_create, :avf_sdp_create, [ :pointer, :int, :string, :int ], :pointer
2937
+ attach_function :av_match_ext, :av_match_ext, [ :string, :string ], :int
2938
+ attach_function :avformat_query_codec, :avformat_query_codec, [ AVOutputFormat.ptr, CodecID, :int ], :int
2939
+ attach_function :avformat_get_riff_video_tags, :avformat_get_riff_video_tags, [ ], :pointer
2940
+ attach_function :avformat_get_riff_audio_tags, :avformat_get_riff_audio_tags, [ ], :pointer
2941
+
2942
+
2943
+ ffi_lib [ "libswscale.so.2", "libswscale.2.dylib" ]
2944
+
2945
+ class SwsVector < FFI::Struct; end
2946
+ class SwsFilter < FFI::Struct; end
2947
+ LIBSWSCALE_VERSION_MAJOR = 2
2948
+ LIBSWSCALE_VERSION_MINOR = 1
2949
+ LIBSWSCALE_VERSION_MICRO = 0
2950
+ LIBSWSCALE_VERSION_INT = (2 << 16|1 << 8|0)
2951
+ LIBSWSCALE_BUILD = (2 << 16|1 << 8|0)
2952
+ LIBSWSCALE_IDENT = 'SwS2.1.0'
2953
+ attach_function :swscale_version, :swscale_version, [ ], :uint
2954
+ attach_function :swscale_configuration, :swscale_configuration, [ ], :string
2955
+ attach_function :swscale_license, :swscale_license, [ ], :string
2956
+ SWS_FAST_BILINEAR = 1
2957
+ SWS_BILINEAR = 2
2958
+ SWS_BICUBIC = 4
2959
+ SWS_X = 8
2960
+ SWS_POINT = 0x10
2961
+ SWS_AREA = 0x20
2962
+ SWS_BICUBLIN = 0x40
2963
+ SWS_GAUSS = 0x80
2964
+ SWS_SINC = 0x100
2965
+ SWS_LANCZOS = 0x200
2966
+ SWS_SPLINE = 0x400
2967
+ SWS_SRC_V_CHR_DROP_MASK = 0x30000
2968
+ SWS_SRC_V_CHR_DROP_SHIFT = 16
2969
+ SWS_PARAM_DEFAULT = 123456
2970
+ SWS_PRINT_INFO = 0x1000
2971
+ SWS_FULL_CHR_H_INT = 0x2000
2972
+ SWS_FULL_CHR_H_INP = 0x4000
2973
+ SWS_DIRECT_BGR = 0x8000
2974
+ SWS_ACCURATE_RND = 0x40000
2975
+ SWS_BITEXACT = 0x80000
2976
+ SWS_CPU_CAPS_MMX = 0x80000000
2977
+ SWS_CPU_CAPS_MMX2 = 0x20000000
2978
+ SWS_CPU_CAPS_3DNOW = 0x40000000
2979
+ SWS_CPU_CAPS_ALTIVEC = 0x10000000
2980
+ SWS_CPU_CAPS_BFIN = 0x01000000
2981
+ SWS_CPU_CAPS_SSE2 = 0x02000000
2982
+ SWS_MAX_REDUCE_CUTOFF = 0.002
2983
+ SWS_CS_ITU709 = 1
2984
+ SWS_CS_FCC = 4
2985
+ SWS_CS_ITU601 = 5
2986
+ SWS_CS_ITU624 = 5
2987
+ SWS_CS_SMPTE170M = 5
2988
+ SWS_CS_SMPTE240M = 7
2989
+ SWS_CS_DEFAULT = 5
2990
+ attach_function :sws_getCoefficients, :sws_getCoefficients, [ :int ], :pointer
2991
+ class SwsVector < FFI::Struct
2992
+ layout(
2993
+ :coeff, :pointer,
2994
+ :length, :int
2995
+ )
2996
+ end
2997
+ class SwsFilter < FFI::Struct
2998
+ layout(
2999
+ :lumH, SwsVector.ptr,
3000
+ :lumV, SwsVector.ptr,
3001
+ :chrH, SwsVector.ptr,
3002
+ :chrV, SwsVector.ptr
3003
+ )
3004
+ end
3005
+ attach_function :sws_isSupportedInput, :sws_isSupportedInput, [ PixelFormat ], :int
3006
+ attach_function :sws_isSupportedOutput, :sws_isSupportedOutput, [ PixelFormat ], :int
3007
+ attach_function :sws_alloc_context, :sws_alloc_context, [ ], :pointer
3008
+ attach_function :sws_init_context, :sws_init_context, [ :pointer, SwsFilter.ptr, SwsFilter.ptr ], :int
3009
+ attach_function :sws_freeContext, :sws_freeContext, [ :pointer ], :void
3010
+ attach_function :sws_getContext, :sws_getContext, [ :int, :int, PixelFormat, :int, :int, PixelFormat, :int, SwsFilter.ptr, SwsFilter.ptr, :pointer ], :pointer
3011
+ attach_function :sws_scale, :sws_scale, [ :pointer, :pointer, :pointer, :int, :int, :pointer, :pointer ], :pointer
3012
+ attach_function :sws_setColorspaceDetails, :sws_setColorspaceDetails, [ :pointer, :pointer, :int, :pointer, :int, :int, :int, :int ], :int
3013
+ attach_function :sws_getColorspaceDetails, :sws_getColorspaceDetails, [ :pointer, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer ], :int
3014
+ attach_function :sws_allocVec, :sws_allocVec, [ :int ], SwsVector.ptr
3015
+ attach_function :sws_getGaussianVec, :sws_getGaussianVec, [ :double, :double ], SwsVector.ptr
3016
+ attach_function :sws_getConstVec, :sws_getConstVec, [ :double, :int ], SwsVector.ptr
3017
+ attach_function :sws_getIdentityVec, :sws_getIdentityVec, [ ], SwsVector.ptr
3018
+ attach_function :sws_scaleVec, :sws_scaleVec, [ SwsVector.ptr, :double ], :void
3019
+ attach_function :sws_normalizeVec, :sws_normalizeVec, [ SwsVector.ptr, :double ], :void
3020
+ attach_function :sws_convVec, :sws_convVec, [ SwsVector.ptr, SwsVector.ptr ], :void
3021
+ attach_function :sws_addVec, :sws_addVec, [ SwsVector.ptr, SwsVector.ptr ], :void
3022
+ attach_function :sws_subVec, :sws_subVec, [ SwsVector.ptr, SwsVector.ptr ], :void
3023
+ attach_function :sws_shiftVec, :sws_shiftVec, [ SwsVector.ptr, :int ], :void
3024
+ attach_function :sws_cloneVec, :sws_cloneVec, [ SwsVector.ptr ], SwsVector.ptr
3025
+ attach_function :sws_printVec2, :sws_printVec2, [ SwsVector.ptr, :pointer, :int ], :void
3026
+ attach_function :sws_freeVec, :sws_freeVec, [ SwsVector.ptr ], :void
3027
+ attach_function :sws_getDefaultFilter, :sws_getDefaultFilter, [ :float, :float, :float, :float, :float, :float, :int ], SwsFilter.ptr
3028
+ attach_function :sws_freeFilter, :sws_freeFilter, [ SwsFilter.ptr ], :void
3029
+ attach_function :sws_getCachedContext, :sws_getCachedContext, [ :pointer, :int, :int, PixelFormat, :int, :int, PixelFormat, :int, SwsFilter.ptr, SwsFilter.ptr, :pointer ], :pointer
3030
+ attach_function :sws_convertPalette8ToPacked32, :sws_convertPalette8ToPacked32, [ :pointer, :pointer, :int, :pointer ], :void
3031
+ attach_function :sws_convertPalette8ToPacked24, :sws_convertPalette8ToPacked24, [ :pointer, :pointer, :int, :pointer ], :void
3032
+ attach_function :sws_get_class, :sws_get_class, [ ], :pointer
3033
+
3034
+ end