delete old bindings to change the license, switch from gotk4 back to go-glib and regenerate

now with fixed array conversion support
This commit is contained in:
RSWilli
2025-09-16 22:36:48 +02:00
parent 26bdedfadc
commit 017a0af634
225 changed files with 4366 additions and 35663 deletions

525
LICENSE
View File

@@ -1,504 +1,21 @@
GNU LESSER GENERAL PUBLIC LICENSE MIT License
Version 2.1, February 1999
Copyright (c) 2025 go-gst authors
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Permission is hereby granted, free of charge, to any person obtaining a copy
Everyone is permitted to copy and distribute verbatim copies of this software and associated documentation files (the "Software"), to deal
of this license document, but changing it is not allowed. in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
[This is the first released version of the Lesser GPL. It also counts copies of the Software, and to permit persons to whom the Software is
as the successor of the GNU Library Public License, version 2, hence furnished to do so, subject to the following conditions:
the version number 2.1.]
The above copyright notice and this permission notice shall be included in all
Preamble copies or substantial portions of the Software.
The licenses for most software are designed to take away your THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
freedom to share and change it. By contrast, the GNU General Public IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Licenses are intended to guarantee your freedom to share and change FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
free software--to make sure the software is free for all its users. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
This license, the Lesser General Public License, applies to some OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
specially designated software packages--typically libraries--of the SOFTWARE.
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random
Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@@ -0,0 +1,18 @@
package main
import (
"github.com/go-gst/go-gst/pkg/gst"
"github.com/go-gst/go-gst/pkg/gstaudio"
)
func main() {
// this example is mostly a test to check fixed size array conversions
gst.Init()
audioInfo := gstaudio.NewAudioInfo()
audioInfo.SetFormat(gstaudio.AudioFormatS16le, 44100, 2, [64]gstaudio.AudioChannelPosition{gstaudio.AudioChannelPositionFrontLeft, gstaudio.AudioChannelPositionFrontRight})
caps := audioInfo.ToCaps()
println(caps.String())
}

View File

@@ -1,7 +1,7 @@
package custombin package custombin
import ( import (
"github.com/diamondburned/gotk4/pkg/gobject/v2" "github.com/go-gst/go-glib/pkg/gobject/v2"
"github.com/go-gst/go-gst/pkg/gst" "github.com/go-gst/go-gst/pkg/gst"
) )

View File

@@ -6,7 +6,7 @@ import (
"math" "math"
"time" "time"
"github.com/diamondburned/gotk4/pkg/gobject/v2" "github.com/go-gst/go-glib/pkg/gobject/v2"
"github.com/go-gst/go-gst/pkg/gst" "github.com/go-gst/go-gst/pkg/gst"
) )

View File

@@ -1,7 +1,7 @@
package customsrc package customsrc
import ( import (
"github.com/diamondburned/gotk4/pkg/gobject/v2" "github.com/go-gst/go-glib/pkg/gobject/v2"
"github.com/go-gst/go-gst/pkg/gst" "github.com/go-gst/go-gst/pkg/gst"
) )

6
flake.lock generated
View File

@@ -95,11 +95,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1750506804, "lastModified": 1757745802,
"narHash": "sha256-VLFNc4egNjovYVxDGyBYTrvVCgDYgENp5bVi9fPTDYc=", "narHash": "sha256-hLEO2TPj55KcUFUU1vgtHE9UEIOjRcH/4QbmfHNF820=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "4206c4cb56751df534751b058295ea61357bbbaa", "rev": "c23193b943c6c689d70ee98ce3128239ed9e32d1",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -3,16 +3,11 @@
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
gotk4-nix.url = "github:diamondburned/gotk4-nix";
gotk4-nix.inputs = {
nixpkgs.follows = "nixpkgs";
};
}; };
outputs = { outputs = {
self, self,
nixpkgs, nixpkgs,
gotk4-nix,
... ...
}: let }: let
systems = ["x86_64-linux" "aarch64-darwin"]; systems = ["x86_64-linux" "aarch64-darwin"];
@@ -25,9 +20,8 @@
}; };
in { in {
default = pkgs.mkShell { default = pkgs.mkShell {
nativeBuildInputs = with pkgs; nativeBuildInputs = with pkgs; [
[ go_latest
go
go-tools # staticcheck & co. go-tools # staticcheck & co.
pkg-config pkg-config
@@ -41,8 +35,7 @@
gst_all_1.gst-plugins-ugly gst_all_1.gst-plugins-ugly
gst_all_1.gst-rtsp-server gst_all_1.gst-rtsp-server
# gst_all_1.gst-vaapi not available in darwin # gst_all_1.gst-vaapi not available in darwin
] ];
++ (gotk4-nix.lib.mkShell {inherit pkgs;}).baseDependencies;
GO111MODULE = "on"; GO111MODULE = "on";
CGO_ENABLED = "1"; CGO_ENABLED = "1";
@@ -54,7 +47,7 @@
# print the go version and gstreamer version on shell startup # print the go version and gstreamer version on shell startup
shellHook = '' shellHook = ''
${pkgs.go}/bin/go version ${pkgs.go_latest}/bin/go version
${pkgs.gst_all_1.gstreamer}/bin/gst-launch-1.0 --version ${pkgs.gst_all_1.gstreamer}/bin/gst-launch-1.0 --version
''; '';
}; };

View File

@@ -8,11 +8,11 @@ import (
"slices" "slices"
"strings" "strings"
"github.com/diamondburned/gotk4/gir" "github.com/go-gst/go-glib/gir"
"github.com/diamondburned/gotk4/gir/cmd/gir-generate/gendata" "github.com/go-gst/go-glib/gir/cmd/gir-generate/gendata"
"github.com/diamondburned/gotk4/gir/cmd/gir-generate/genmain" "github.com/go-gst/go-glib/gir/cmd/gir-generate/genmain"
"github.com/diamondburned/gotk4/gir/girgen/strcases" "github.com/go-gst/go-glib/gir/girgen/strcases"
"github.com/diamondburned/gotk4/gir/girgen/typesystem" "github.com/go-gst/go-glib/gir/girgen/typesystem"
girfiles_gst "github.com/go-gst/go-gst/girs" girfiles_gst "github.com/go-gst/go-gst/girs"
) )

View File

@@ -3,10 +3,10 @@ package girfiles_gst
import ( import (
"embed" "embed"
girfiles_gotk4 "github.com/diamondburned/gotk4/girs" girfiles "github.com/go-gst/go-glib/girs"
) )
//go:embed *.gir //go:embed *.gir
var girFiles embed.FS var girFiles embed.FS
var GirFiles = girfiles_gotk4.ReadGirFiles(girFiles) var GirFiles = girfiles.ReadGirFiles(girFiles)

15
go.mod
View File

@@ -1,16 +1,7 @@
module github.com/go-gst/go-gst module github.com/go-gst/go-gst
go 1.24.0 go 1.25.0
require ( require github.com/go-gst/go-glib v1.4.1-0.20250916203041-96c5e8f8aebe
github.com/diamondburned/gotk4 v0.3.1
github.com/go-gst/go-glib v1.4.1-0.20241209142714-f53cebf18559
github.com/go-gst/go-pointer v0.0.0-20241127163939-ba766f075b4c
)
require ( retract [v1.0.0, v1.4.0] // Handwritten bindings, not as stable as planned and not licensed open enough
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect
golang.org/x/sync v0.15.0 // indirect
)
replace github.com/diamondburned/gotk4 => github.com/rswilli/gotk4 v0.0.0-20250813123434-5660317ba8f5

12
go.sum
View File

@@ -1,10 +1,2 @@
github.com/go-gst/go-glib v1.4.1-0.20241209142714-f53cebf18559 h1:AK60n6W3FLZTp9H1KU5VOa8XefNO0w0R3pfszphwX14= github.com/go-gst/go-glib v1.4.1-0.20250916203041-96c5e8f8aebe h1:7X+m6MNrqr/rAQ11EpeWhZZu6ZTczYZ2uFJcFUhFvzo=
github.com/go-gst/go-glib v1.4.1-0.20241209142714-f53cebf18559/go.mod h1:ZWT4LXOO2PH8lSNu/dR5O2yoNQJKEgmijNa2d7nByK8= github.com/go-gst/go-glib v1.4.1-0.20250916203041-96c5e8f8aebe/go.mod h1:n9WnJ6bNPKRrc7aWKgrsRfNh3LPw5RSz6dfcB1bd0Qk=
github.com/go-gst/go-pointer v0.0.0-20241127163939-ba766f075b4c h1:x8kKRVDmz5BRlolmDZGcsuZ1l+js6TRL3QWBJjGVctM=
github.com/go-gst/go-pointer v0.0.0-20241127163939-ba766f075b4c/go.mod h1:qKw5ZZ0U58W6PU/7F/Lopv+14nKYmdXlOd7VnAZ17Mk=
github.com/rswilli/gotk4 v0.0.0-20250813123434-5660317ba8f5 h1:6ldPPGUGQ7kAVxKcs0cY+/qHxTh3BOAUxOXkceUj/Vs=
github.com/rswilli/gotk4 v0.0.0-20250813123434-5660317ba8f5/go.mod h1:alpfblIRIC6MejV4eBLjWx61VeJvfQ/6dHGQZUkzSYE=
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 h1:nDVHiLt8aIbd/VzvPWN6kSOPE7+F/fNFDSXLVYkE/Iw=
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394/go.mod h1:sIifuuw/Yco/y6yb6+bDNfyeQ/MdPUy/hKEMYQV17cM=
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=

View File

@@ -1,2 +0,0 @@
// Deprecated: use the autogenerated pkg/gst instead
package gst

View File

@@ -1,2 +0,0 @@
// Deprecated: use the autogenerated pkg/gstapp instead
package app

View File

@@ -1,169 +0,0 @@
package app
// #include "gst.go.h"
import "C"
import (
"unsafe"
"github.com/go-gst/go-glib/glib"
"github.com/go-gst/go-gst/gst"
gopointer "github.com/go-gst/go-pointer"
)
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func getSinkCbsFromPtr(userData C.gpointer) *SinkCallbacks {
ptr := gopointer.Restore(unsafe.Pointer(userData))
cbs, ok := ptr.(*SinkCallbacks)
if !ok {
gopointer.Unref(unsafe.Pointer(userData))
return nil
}
return cbs
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func getSrcCbsFromPtr(userData C.gpointer) *SourceCallbacks {
ptr := gopointer.Restore(unsafe.Pointer(userData))
cbs, ok := ptr.(*SourceCallbacks)
if !ok {
gopointer.Unref(unsafe.Pointer(userData))
return nil
}
return cbs
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func wrapCSink(sink *C.GstAppSink) *Sink {
return wrapAppSink(&gst.Element{
Object: &gst.Object{
InitiallyUnowned: &glib.InitiallyUnowned{
Object: &glib.Object{
GObject: glib.ToGObject(unsafe.Pointer(sink)),
},
},
},
})
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func wrapCSource(src *C.GstAppSrc) *Source {
return wrapAppSrc(&gst.Element{
Object: &gst.Object{
InitiallyUnowned: &glib.InitiallyUnowned{
Object: &glib.Object{
GObject: glib.ToGObject(unsafe.Pointer(src)),
},
},
},
})
}
//export goNeedDataCb
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goNeedDataCb(src *C.GstAppSrc, length C.guint, userData C.gpointer) {
cbs := getSrcCbsFromPtr(userData)
if cbs == nil {
return
}
if cbs.NeedDataFunc == nil {
return
}
gosrc := wrapCSource(src)
cbs.NeedDataFunc(gosrc, uint(length))
}
//export goEnoughDataDb
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goEnoughDataDb(src *C.GstAppSrc, userData C.gpointer) {
cbs := getSrcCbsFromPtr(userData)
if cbs == nil {
return
}
if cbs.EnoughDataFunc == nil {
return
}
gosrc := wrapCSource(src)
cbs.EnoughDataFunc(gosrc)
}
//export goSeekDataCb
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goSeekDataCb(src *C.GstAppSrc, offset C.guint64, userData C.gpointer) C.gboolean {
cbs := getSrcCbsFromPtr(userData)
if cbs == nil {
return gboolean(false)
}
if cbs.SeekDataFunc == nil {
return gboolean(true)
}
gosrc := wrapCSource(src)
return gboolean(cbs.SeekDataFunc(gosrc, uint64(offset)))
}
//export goSinkEOSCb
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goSinkEOSCb(sink *C.GstAppSink, userData C.gpointer) {
cbs := getSinkCbsFromPtr(userData)
if cbs == nil {
return
}
if cbs.EOSFunc == nil {
return
}
gosink := wrapCSink(sink)
cbs.EOSFunc(gosink)
}
//export goSinkNewPrerollCb
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goSinkNewPrerollCb(sink *C.GstAppSink, userData C.gpointer) C.GstFlowReturn {
cbs := getSinkCbsFromPtr(userData)
if cbs == nil {
return C.GstFlowReturn(gst.FlowError)
}
if cbs.NewPrerollFunc == nil {
return C.GstFlowReturn(gst.FlowOK)
}
gosink := wrapCSink(sink)
ret := C.GstFlowReturn(cbs.NewPrerollFunc(gosink))
return ret
}
//export goSinkNewSampleCb
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goSinkNewSampleCb(sink *C.GstAppSink, userData C.gpointer) C.GstFlowReturn {
cbs := getSinkCbsFromPtr(userData)
if cbs == nil {
return C.GstFlowReturn(gst.FlowError)
}
if cbs.NewSampleFunc == nil {
return C.GstFlowReturn(gst.FlowOK)
}
gosink := wrapCSink(sink)
ret := C.GstFlowReturn(cbs.NewSampleFunc(gosink))
return ret
}
//export goAppGDestroyNotifyFunc
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goAppGDestroyNotifyFunc(ptr C.gpointer) {
gopointer.Unref(unsafe.Pointer(ptr))
}

View File

@@ -1,10 +0,0 @@
/*
Package app contains bindings for the gstreamer-app C API. If you are trying
to build simple pipelines quickly (and optiionally readers/writers) see
the gstauto/app package.
The location of this library may be different depending on your OS. It is usually
either with the gst-plugins-base development headers or a separate package called
gstreamer-app.
*/
package app

View File

@@ -1,5 +0,0 @@
#include "gst.go.h"
GstAppSink * toGstAppSink (void *p) { return (GST_APP_SINK(p)); }
GstAppSrc * toGstAppSrc (void *p) { return (GST_APP_SRC(p)); }

View File

@@ -1,10 +0,0 @@
#ifndef __GST_APP_GO_H__
#define __GST_APP_GO_H__
#include <gst/app/gstappsink.h>
#include <gst/app/gstappsrc.h>
extern GstAppSink * toGstAppSink (void *p);
extern GstAppSrc * toGstAppSrc (void *p);
#endif

View File

@@ -1,274 +0,0 @@
package app
/*
#include "gst.go.h"
extern void goAppGDestroyNotifyFunc (gpointer user_data);
extern void goSinkEOSCb (GstAppSink * sink, gpointer user_data);
extern GstFlowReturn goSinkNewPrerollCb (GstAppSink * sink, gpointer user_data);
extern GstFlowReturn goSinkNewSampleCb (GstAppSink * sink, gpointer user_data);
void cgoSinkGDestroyNotifyFunc (gpointer user_data) { goAppGDestroyNotifyFunc(user_data); }
void cgoSinkEOSCb (GstAppSink * sink, gpointer user_data) { return goSinkEOSCb(sink, user_data); }
GstFlowReturn cgoSinkNewPrerollCb (GstAppSink * sink, gpointer user_data) { return goSinkNewPrerollCb(sink, user_data); }
GstFlowReturn cgoSinkNewSampleCb (GstAppSink * sink, gpointer user_data) { return goSinkNewSampleCb(sink, user_data); }
*/
import "C"
import (
"errors"
"unsafe"
gopointer "github.com/go-gst/go-pointer"
"github.com/go-gst/go-gst/gst"
"github.com/go-gst/go-gst/gst/base"
)
// SinkCallbacks represents callbacks that can be installed on an app sink when data is available.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type SinkCallbacks struct {
EOSFunc func(appSink *Sink)
NewPrerollFunc func(appSink *Sink) gst.FlowReturn
NewSampleFunc func(appSink *Sink) gst.FlowReturn
}
// ErrEOS represents that the stream has ended.
var ErrEOS = errors.New("pipeline has reached end-of-stream")
// Sink wraps an Element made with the appsink plugin with additional methods for pulling samples.
type Sink struct{ *base.GstBaseSink }
// NewAppSink returns a new appsink element.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewAppSink() (*Sink, error) {
elem, err := gst.NewElement("appsink")
if err != nil {
return nil, err
}
return wrapAppSink(elem), nil
}
// SinkFromElement checks if the given element is an appsink and if so returns
// a Sink interface.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func SinkFromElement(elem *gst.Element) *Sink {
if appSink := C.toGstAppSink(elem.Unsafe()); appSink != nil {
return wrapAppSink(elem)
}
return nil
}
// Instance returns the native GstAppSink instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Sink) Instance() *C.GstAppSink { return C.toGstAppSink(a.Unsafe()) }
// GetBufferListSupport checks if appsink supports buffer lists.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Sink) GetBufferListSupport() bool {
return gobool(C.gst_app_sink_get_buffer_list_support(a.Instance()))
}
// GetCaps gets the configured caps on appsink.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Sink) GetCaps() *gst.Caps {
caps := C.gst_app_sink_get_caps(a.Instance())
if caps == nil {
return nil
}
return gst.FromGstCapsUnsafeFull(unsafe.Pointer(caps))
}
// GetDrop checks if appsink will drop old buffers when the maximum amount of queued buffers is reached.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Sink) GetDrop() bool {
return gobool(C.gst_app_sink_get_drop(a.Instance()))
}
// GetEmitSignals checks if appsink will emit the "new-preroll" and "new-sample" signals.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Sink) GetEmitSignals() bool {
return gobool(C.gst_app_sink_get_emit_signals(a.Instance()))
}
// GetMaxBuffers gets the maximum amount of buffers that can be queued in appsink.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Sink) GetMaxBuffers() uint {
return uint(C.gst_app_sink_get_max_buffers(a.Instance()))
}
// GetWaitOnEOS checks if appsink will wait for all buffers to be consumed when an EOS is received.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Sink) GetWaitOnEOS() bool {
return gobool(C.gst_app_sink_get_wait_on_eos(a.Instance()))
}
// IsEOS returns true if this AppSink has reached the end-of-stream.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Sink) IsEOS() bool {
return gobool(C.gst_app_sink_is_eos((*C.GstAppSink)(a.Instance())))
}
// PullPreroll gets the last preroll sample in appsink. This was the sample that caused the appsink to preroll in the PAUSED state.
//
// This function is typically used when dealing with a pipeline in the PAUSED state. Calling this function after doing a seek will
// give the sample right after the seek position.
//
// Calling this function will clear the internal reference to the preroll buffer.
//
// Note that the preroll sample will also be returned as the first sample when calling gst_app_sink_pull_sample.
//
// If an EOS event was received before any buffers, this function returns NULL. Use gst_app_sink_is_eos () to check for the EOS condition.
//
// This function blocks until a preroll sample or EOS is received or the appsink element is set to the READY/NULL state.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Sink) PullPreroll() *gst.Sample {
smpl := C.gst_app_sink_pull_preroll(a.Instance())
if smpl == nil {
return nil
}
return gst.FromGstSampleUnsafeFull(unsafe.Pointer(smpl))
}
// PullSample blocks until a sample or EOS becomes available or the appsink element is set to the READY/NULL state.
//
// This function will only return samples when the appsink is in the PLAYING state. All rendered buffers will be put in a queue
// so that the application can pull samples at its own rate. Note that when the application does not pull samples fast enough, the queued
// buffers could consume a lot of memory, especially when dealing with raw video frames.
//
// If an EOS event was received before any buffers, this function returns NULL. Use IsEOS() to check for the EOS condition.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Sink) PullSample() *gst.Sample {
smpl := C.gst_app_sink_pull_sample(a.Instance())
if smpl == nil {
return nil
}
return gst.FromGstSampleUnsafeFull(unsafe.Pointer(smpl))
}
// SetBufferListSupport instructs appsink to enable or disable buffer list support.
//
// For backwards-compatibility reasons applications need to opt in to indicate that they will be able to handle buffer lists.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Sink) SetBufferListSupport(enabled bool) {
C.gst_app_sink_set_buffer_list_support(a.Instance(), gboolean(enabled))
}
// SetCallbacks sets callbacks which will be executed for each new preroll, new sample and eos. This is an alternative to using the signals,
// it has lower overhead and is thus less expensive, but also less flexible.
//
// If callbacks are installed, no signals will be emitted for performance reasons.
//
// Before 1.16.3 it was not possible to change the callbacks in a thread-safe way.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Sink) SetCallbacks(cbs *SinkCallbacks) {
ptr := gopointer.Save(cbs)
appSinkCallbacks := &C.GstAppSinkCallbacks{
eos: (*[0]byte)(unsafe.Pointer(C.cgoSinkEOSCb)),
new_preroll: (*[0]byte)(unsafe.Pointer(C.cgoSinkNewPrerollCb)),
new_sample: (*[0]byte)(unsafe.Pointer(C.cgoSinkNewSampleCb)),
}
C.gst_app_sink_set_callbacks(
a.Instance(),
appSinkCallbacks,
(C.gpointer)(unsafe.Pointer(ptr)),
C.GDestroyNotify(C.cgoSinkGDestroyNotifyFunc),
)
}
// SetCaps sets the capabilities on the appsink element. This function takes a copy of the caps structure. After calling this method,
// the sink will only accept caps that match caps. If caps is non-fixed, or incomplete, you must check the caps on the samples to get
// the actual used caps.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Sink) SetCaps(caps *gst.Caps) {
C.gst_app_sink_set_caps(a.Instance(), (*C.GstCaps)(unsafe.Pointer(caps.Instance())))
}
// SetDrop instructs appsink to drop old buffers when the maximum amount of queued buffers is reached.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Sink) SetDrop(drop bool) {
C.gst_app_sink_set_drop(a.Instance(), gboolean(drop))
}
// SetEmitSignals makes appsink emit the "new-preroll" and "new-sample" signals. This option is by default disabled because signal emission
// is expensive and unneeded when the application prefers to operate in pull mode.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Sink) SetEmitSignals(emit bool) {
C.gst_app_sink_set_emit_signals(a.Instance(), gboolean(emit))
}
// SetMaxBuffers sets the maximum amount of buffers that can be queued in appsink. After this amount of buffers are queued in appsink,
// any more buffers will block upstream elements until a sample is pulled from appsink.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Sink) SetMaxBuffers(max uint) {
C.gst_app_sink_set_max_buffers(a.Instance(), C.guint(max))
}
// SetWaitOnEOS instructs appsink to wait for all buffers to be consumed when an EOS is received.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Sink) SetWaitOnEOS(wait bool) {
C.gst_app_sink_set_wait_on_eos(a.Instance(), gboolean(wait))
}
// TryPullPreroll gets the last preroll sample in appsink. This was the sample that caused the appsink to preroll in the PAUSED state.
//
// This function is typically used when dealing with a pipeline in the PAUSED state. Calling this function after doing a seek will give
// the sample right after the seek position.
//
// Calling this function will clear the internal reference to the preroll buffer.
//
// Note that the preroll sample will also be returned as the first sample when calling PullSample.
//
// If an EOS event was received before any buffers or the timeout expires, this function returns NULL. Use IsEOS () to check for the EOS condition.
//
// This function blocks until a preroll sample or EOS is received, the appsink element is set to the READY/NULL state, or the timeout expires.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Sink) TryPullPreroll(timeout gst.ClockTime) *gst.Sample {
tm := C.GstClockTime(timeout)
smpl := C.gst_app_sink_try_pull_preroll(a.Instance(), tm)
if smpl == nil {
return nil
}
return gst.FromGstSampleUnsafeFull(unsafe.Pointer(smpl))
}
// TryPullSample blocks until a sample or EOS becomes available or the appsink element is set to the READY/NULL state or the timeout expires.
//
// This function will only return samples when the appsink is in the PLAYING state. All rendered buffers will be put in a queue so that the
// application can pull samples at its own rate. Note that when the application does not pull samples fast enough, the queued buffers could
// consume a lot of memory, especially when dealing with raw video frames.
//
// If an EOS event was received before any buffers or the timeout expires, this function returns NULL. Use IsEOS () to check for the EOS condition.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Sink) TryPullSample(timeout gst.ClockTime) *gst.Sample {
tm := C.GstClockTime(timeout)
smpl := C.gst_app_sink_try_pull_sample(a.Instance(), tm)
if smpl == nil {
return nil
}
return gst.FromGstSampleUnsafeFull(unsafe.Pointer(smpl))
}

View File

@@ -1,264 +0,0 @@
package app
/*
#include "gst.go.h"
extern void goAppGDestroyNotifyFunc (gpointer user_data);
extern void goNeedDataCb (GstAppSrc *src, guint length, gpointer user_data);
extern void goEnoughDataDb (GstAppSrc *src, gpointer user_data);
extern gboolean goSeekDataCb (GstAppSrc *src, guint64 offset, gpointer user_data);
void cgoSrcGDestroyNotifyFunc (gpointer user_data) { goAppGDestroyNotifyFunc(user_data); }
void cgoNeedDataCb (GstAppSrc *src, guint length, gpointer user_data) { goNeedDataCb(src, length, user_data); }
void cgoEnoughDataCb (GstAppSrc *src, gpointer user_data) { goEnoughDataDb(src, user_data); }
gboolean cgoSeekDataCb (GstAppSrc *src, guint64 offset, gpointer user_data) { return goSeekDataCb(src, offset, user_data); }
*/
import "C"
import (
"unsafe"
"github.com/go-gst/go-gst/gst"
"github.com/go-gst/go-gst/gst/base"
gopointer "github.com/go-gst/go-pointer"
)
// SourceCallbacks represents callbacks to configure on an AppSource.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type SourceCallbacks struct {
NeedDataFunc func(src *Source, length uint)
EnoughDataFunc func(src *Source)
SeekDataFunc func(src *Source, offset uint64) bool
}
// StreamType casts GstAppStreamType
type StreamType int
// Type castings
const (
AppStreamTypeStream StreamType = C.GST_APP_STREAM_TYPE_STREAM // (0) No seeking is supported in the stream, such as a live stream.
AppStreamTypeSeekable StreamType = C.GST_APP_STREAM_TYPE_SEEKABLE // (1) The stream is seekable but seeking might not be very fast, such as data from a webserver.
AppStreamTypeRandomAccess StreamType = C.GST_APP_STREAM_TYPE_RANDOM_ACCESS // (2) The stream is seekable and seeking is fast, such as in a local file.
)
// Source wraps an Element made with the appsrc plugin with additional methods for pushing samples.
type Source struct{ *base.GstBaseSrc }
// NewAppSrc returns a new AppSrc element.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewAppSrc() (*Source, error) {
elem, err := gst.NewElement("appsrc")
if err != nil {
return nil, err
}
return wrapAppSrc(elem), nil
}
// SrcFromElement checks if the given element is an appsrc and if so returns
// a Source interface.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func SrcFromElement(elem *gst.Element) *Source {
if appSrc := C.toGstAppSrc(elem.Unsafe()); appSrc != nil {
return wrapAppSrc(elem)
}
return nil
}
// Instance returns the native GstAppSink instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Source) Instance() *C.GstAppSrc { return C.toGstAppSrc(a.Unsafe()) }
// EndStream signals to the app source that the stream has ended after the last queued
// buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Source) EndStream() gst.FlowReturn {
ret := C.gst_app_src_end_of_stream((*C.GstAppSrc)(a.Instance()))
return gst.FlowReturn(ret)
}
// GetCaps gets the configures caps on the app src.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Source) GetCaps() *gst.Caps {
caps := C.gst_app_src_get_caps(a.Instance())
if caps == nil {
return nil
}
return gst.FromGstCapsUnsafeFull(unsafe.Pointer(caps))
}
// GetCurrentLevelBytes gets the number of currently queued bytes inside appsrc.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Source) GetCurrentLevelBytes() uint64 {
return uint64(C.gst_app_src_get_current_level_bytes(a.Instance()))
}
// GetDuration gets the duration of the stream in nanoseconds. A negative value means that the duration is not known.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Source) GetDuration() gst.ClockTime {
dur := C.gst_app_src_get_duration(a.Instance())
return gst.ClockTime(dur)
}
// GetEmitSignals checks if appsrc will emit the "new-preroll" and "new-buffer" signals.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Source) GetEmitSignals() bool {
return gobool(C.gst_app_src_get_emit_signals(a.Instance()))
}
// GetLatency retrieves the min and max latencies in min and max respectively.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Source) GetLatency() (min, max uint64) {
var gmin, gmax C.guint64
C.gst_app_src_get_latency(a.Instance(), &gmin, &gmax)
return uint64(gmin), uint64(gmax)
}
// GetMaxBytes gets the maximum amount of bytes that can be queued in appsrc.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Source) GetMaxBytes() uint64 {
return uint64(C.gst_app_src_get_max_bytes(a.Instance()))
}
// GetSize gets the size of the stream in bytes. A value of -1 means that the size is not known.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Source) GetSize() int64 {
return int64(C.gst_app_src_get_size(a.Instance()))
}
// GetStreamType gets the stream type. Control the stream type of appsrc with SetStreamType.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Source) GetStreamType() StreamType {
return StreamType(C.gst_app_src_get_stream_type(a.Instance()))
}
// PushBuffer pushes a buffer to the appsrc. Currently by default this will block
// until the source is ready to accept the buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Source) PushBuffer(buf *gst.Buffer) gst.FlowReturn {
ret := C.gst_app_src_push_buffer(
(*C.GstAppSrc)(a.Instance()),
(*C.GstBuffer)(unsafe.Pointer(buf.Ref().Instance())),
)
return gst.FlowReturn(ret)
}
// PushBufferList adds a buffer list to the queue of buffers and buffer lists that the appsrc element will push
// to its source pad. This function takes ownership of buffer_list.
//
// When the block property is TRUE, this function can block until free space becomes available in the queue.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Source) PushBufferList(bufList *gst.BufferList) gst.FlowReturn {
return gst.FlowReturn(C.gst_app_src_push_buffer_list(
a.Instance(), (*C.GstBufferList)(unsafe.Pointer(bufList.Ref().Instance())),
))
}
// PushSample Extract a buffer from the provided sample and adds it to the queue of buffers that the appsrc element will
// push to its source pad. Any previous caps that were set on appsrc will be replaced by the caps associated with the
// sample if not equal.
//
// When the block property is TRUE, this function can block until free space becomes available in the queue.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Source) PushSample(sample *gst.Sample) gst.FlowReturn {
return gst.FlowReturn(C.gst_app_src_push_sample(
a.Instance(), (*C.GstSample)(unsafe.Pointer(sample.Instance())),
))
}
// SetCallbacks sets callbacks which will be executed when data is needed, enough data has been collected or when a seek
// should be performed. This is an alternative to using the signals, it has lower overhead and is thus less expensive,
// but also less flexible.
//
// If callbacks are installed, no signals will be emitted for performance reasons.
//
// Before 1.16.3 it was not possible to change the callbacks in a thread-safe way.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Source) SetCallbacks(cbs *SourceCallbacks) {
ptr := gopointer.Save(cbs)
appSrcCallbacks := &C.GstAppSrcCallbacks{
need_data: (*[0]byte)(unsafe.Pointer(C.cgoNeedDataCb)),
enough_data: (*[0]byte)(unsafe.Pointer(C.cgoEnoughDataCb)),
seek_data: (*[0]byte)(unsafe.Pointer(C.cgoSeekDataCb)),
}
C.gst_app_src_set_callbacks(
a.Instance(),
appSrcCallbacks,
(C.gpointer)(unsafe.Pointer(ptr)),
C.GDestroyNotify(C.cgoSrcGDestroyNotifyFunc),
)
}
// SetCaps sets the capabilities on the appsrc element. This function takes a copy of the caps structure. After calling this method,
// the source will only produce caps that match caps. caps must be fixed and the caps on the buffers must match the caps or left NULL.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Source) SetCaps(caps *gst.Caps) {
C.gst_app_src_set_caps(a.Instance(), (*C.GstCaps)(unsafe.Pointer(caps.Instance())))
}
// SetDuration sets the duration of the source stream. You should call
// this if the value is known.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Source) SetDuration(dur gst.ClockTime) {
C.gst_app_src_set_duration((*C.GstAppSrc)(a.Instance()), C.GstClockTime(dur))
}
// SetEmitSignals makes appsrc emit the "new-preroll" and "new-buffer" signals. This option is by default disabled because signal emission
// is expensive and unneeded when the application prefers to operate in pull mode.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Source) SetEmitSignals(emit bool) {
C.gst_app_src_set_emit_signals(a.Instance(), gboolean(emit))
}
// SetLatency configures the min and max latency in src. If min is set to -1, the default latency calculations for pseudo-live sources
// will be used.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Source) SetLatency(min, max uint64) {
C.gst_app_src_set_latency(a.Instance(), C.guint64(min), C.guint64(max))
}
// SetMaxBytes sets the maximum amount of bytes that can be queued in appsrc. After the maximum amount of bytes are queued, appsrc will
// emit the "enough-data" signal.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Source) SetMaxBytes(max uint64) {
C.gst_app_src_set_max_bytes(a.Instance(), C.guint64(max))
}
// SetSize sets the size of the source stream in bytes. You should call this for
// streams of fixed length.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Source) SetSize(size int64) {
C.gst_app_src_set_size((*C.GstAppSrc)(a.Instance()), (C.gint64)(size))
}
// SetStreamType sets the stream type on appsrc. For seekable streams, the "seek" signal must be connected to.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Source) SetStreamType(streamType StreamType) {
C.gst_app_src_set_stream_type(a.Instance(), C.GstAppStreamType(streamType))
}

View File

@@ -1,7 +0,0 @@
package app
/*
#cgo pkg-config: gstreamer-1.0 gstreamer-app-1.0
#cgo CFLAGS: -Wno-deprecated-declarations -g -Wall
*/
import "C"

View File

@@ -1,35 +0,0 @@
package app
// #include <gst/gst.h>
import "C"
import (
"github.com/go-gst/go-gst/gst"
"github.com/go-gst/go-gst/gst/base"
)
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func wrapAppSink(elem *gst.Element) *Sink {
return &Sink{GstBaseSink: &base.GstBaseSink{Element: elem}}
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func wrapAppSrc(elem *gst.Element) *Source {
return &Source{GstBaseSrc: &base.GstBaseSrc{Element: elem}}
}
// gobool provides an easy type conversion between C.gboolean and a go bool.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func gobool(b C.gboolean) bool { return int(b) > 0 }
// gboolean converts a go bool to a C.gboolean.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func gboolean(b bool) C.gboolean {
if b {
return C.gboolean(1)
}
return C.gboolean(0)
}

View File

@@ -1,2 +0,0 @@
// Deprecated: use the autogenerated pkg/gstaudio instead
package audio

View File

@@ -1,56 +0,0 @@
package audio
/*
#include "gst.go.h"
GstClockTime
framesToClockTime (gint frames, gint rate) { return GST_FRAMES_TO_CLOCK_TIME(frames, rate); }
gint
clockTimeToFrames(GstClockTime ct, gint rate) { return GST_CLOCK_TIME_TO_FRAMES(ct, rate); }
*/
import "C"
import (
"unsafe"
"github.com/go-gst/go-gst/gst"
)
// FramesToClockTime calculates the Clocktime
// from the given frames and rate.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FramesToClockTime(frames, rate int) gst.ClockTime {
ct := C.framesToClockTime(C.gint(frames), C.gint(rate))
return gst.ClockTime(ct)
}
// DurationToFrames calculates the number of frames from the given duration and sample rate.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func DurationToFrames(dur gst.ClockTime, rate int) int {
return int(C.clockTimeToFrames(C.GstClockTime(dur), C.gint(rate)))
}
// gboolean converts a go bool to a C.gboolean.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func gboolean(b bool) C.gboolean {
if b {
return C.gboolean(1)
}
return C.gboolean(0)
}
// gobool provides an easy type conversion between C.gboolean and a go bool.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func gobool(b C.gboolean) bool {
return int(b) > 0
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func ptrToGVal(p unsafe.Pointer) *C.GValue {
return (*C.GValue)(p)
}

View File

@@ -1,2 +0,0 @@
// Package audio contains bindings for the gstaudio C API.
package audio

View File

@@ -1,6 +0,0 @@
#ifndef __GST_AUDIO_GO_H__
#define __GST_AUDIO_GO_H__
#include <gst/audio/audio.h>
#endif

View File

@@ -1,152 +0,0 @@
package audio
/*
#include "gst.go.h"
gpointer audioBufferPlaneData(GstAudioBuffer * buffer, gint plane)
{
return GST_AUDIO_BUFFER_PLANE_DATA(buffer, plane);
}
gint audioBufferPlaneSize(GstAudioBuffer * buffer)
{
return GST_AUDIO_BUFFER_PLANE_SIZE(buffer);
}
*/
import "C"
import (
"unsafe"
"github.com/go-gst/go-gst/gst"
)
// ClipBuffer will return a new buffer clipped to the given segment. The given buffer is no longer valid.
// The returned buffer may be nil if it is completely outside the configured segment.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func ClipBuffer(buffer *gst.Buffer, segment *gst.Segment, rate, bytesPerFrame int) *gst.Buffer {
buf := C.gst_audio_buffer_clip(
(*C.GstBuffer)(unsafe.Pointer(buffer.Ref().Instance())),
(*C.GstSegment)(unsafe.Pointer(segment.Instance())),
C.gint(rate),
C.gint(bytesPerFrame),
)
if buf == nil {
return nil
}
return gst.FromGstBufferUnsafeFull(unsafe.Pointer(buf))
}
// ReorderChannels reorders the buffer against the given positions. The number of channels in each slice
// must be identical.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func ReorderChannels(buffer *gst.Buffer, format Format, from []ChannelPosition, to []ChannelPosition) bool {
return gobool(C.gst_audio_buffer_reorder_channels(
(*C.GstBuffer)(unsafe.Pointer(buffer.Instance())),
C.GstAudioFormat(format),
C.gint(len(from)),
(*C.GstAudioChannelPosition)(unsafe.Pointer(&from[0])),
(*C.GstAudioChannelPosition)(unsafe.Pointer(&to[0])),
))
}
// TruncateBuffer truncates the buffer to finally have the given number of samples, removing the necessary
// amount of samples from the end and trim number of samples from the beginning. The original buffer is no
// longer valid. The returned buffer may be nil if the arguments were invalid.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func TruncateBuffer(buffer *gst.Buffer, bytesPerFrame int, trim, samples int64) *gst.Buffer {
buf := C.gst_audio_buffer_truncate(
(*C.GstBuffer)(unsafe.Pointer(buffer.Ref().Instance())),
C.gint(bytesPerFrame),
C.gsize(trim),
C.gsize(samples),
)
if buf == nil {
return nil
}
return gst.FromGstBufferUnsafeFull(unsafe.Pointer(buf))
}
// MapBuffer maps an audio gst.Buffer so that it can be read or written.
//
// This is especially useful when the gstbuffer is in non-interleaved (planar) layout, in which case this
// function will use the information in the gstbuffer's attached GstAudioMeta in order to map each channel
// in a separate "plane" in GstAudioBuffer. If a GstAudioMeta is not attached on the gstbuffer, then it must
// be in interleaved layout.
//
// If a GstAudioMeta is attached, then the GstAudioInfo on the meta is checked against info. Normally, they
// should be equal, but in case they are not, a g_critical will be printed and the GstAudioInfo from the meta
// will be used.
//
// In non-interleaved buffers, it is possible to have each channel on a separate GstMemory. In this case, each
// memory will be mapped separately to avoid copying their contents in a larger memory area. Do note though
// that it is not supported to have a single channel spanning over two or more different GstMemory objects.
// Although the map operation will likely succeed in this case, it will be highly sub-optimal and it is
// recommended to merge all the memories in the buffer before calling this function.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func MapBuffer(info *Info, buffer *gst.Buffer, flags gst.MapFlags) (*Buffer, bool) {
var audioBuffer C.GstAudioBuffer
ret := gobool(C.gst_audio_buffer_map(
&audioBuffer,
info.ptr,
(*C.GstBuffer)(unsafe.Pointer(buffer.Instance())),
C.GstMapFlags(flags)),
)
if !ret {
return nil, ret
}
return &Buffer{ptr: &audioBuffer}, ret
}
// Buffer is a structure containing the result of a MapBuffer operation. For non-interleaved (planar) buffers,
// the beginning of each channel in the buffer has its own pointer in the planes array. For interleaved
// buffers, the Planes slice only contains one item, which is the pointer to the beginning of the buffer,
// and NumPlanes equals 1.
//
// The different channels in planes are always in the GStreamer channel order.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type Buffer struct {
ptr *C.GstAudioBuffer
}
// NumSamples returns the size of the buffer in samples.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) NumSamples() int64 { return int64(b.ptr.n_samples) }
// NumPlanes returns the number of available planes.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) NumPlanes() int { return int(b.ptr.n_planes) }
// Planes returns the planes inside the mapped buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) Planes() [][]byte {
out := make([][]byte, b.NumPlanes())
for i := 0; i < b.NumPlanes(); i++ {
out[i] = C.GoBytes(
unsafe.Pointer(C.audioBufferPlaneData(b.ptr, C.gint(i))),
C.audioBufferPlaneSize(b.ptr),
)
}
return out
}
// WritePlane writes data to the plane at the given index.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) WritePlane(idx int, data []byte) {
bufdata := C.audioBufferPlaneData(b.ptr, C.gint(idx))
C.memcpy(unsafe.Pointer(bufdata), unsafe.Pointer(&data[0]), C.gsize(len(data)))
}
// Unmap will unmap the mapped buffer. Use this after calling MapBuffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) Unmap() { C.gst_audio_buffer_unmap(b.ptr) }

View File

@@ -1,55 +0,0 @@
package audio
// /*
// #include "gst.go.h"
// */
// import "C"
// import (
// "runtime"
// "unsafe"
// )
// // ChannelMixer is a structure for mixing audio channels.
// type ChannelMixer struct {
// ptr *C.GstAudioChannelMixer
// }
// // NewChannelMixer creates a new channel mixer with the given parameters.
// // It returns nil if the format is not supported.
// func NewChannelMixer(flags ChannelMixerFlags, format Format, inPositions, outPositions []ChannelPosition) *ChannelMixer {
// mixer := C.gst_audio_channel_mixer_new(
// C.GstAudioChannelMixerFlags(flags),
// C.GstAudioFormat(format),
// C.gint(len(inPositions)),
// (*C.GstAudioChannelPosition)(unsafe.Pointer(&inPositions[0])),
// C.gint(len(outPositions)),
// (*C.GstAudioChannelPosition)(unsafe.Pointer(&outPositions[0])),
// )
// if mixer == nil {
// return nil
// }
// wrapped := &ChannelMixer{mixer}
// runtime.SetFinalizer(wrapped, (*ChannelMixer).Free)
// return wrapped
// }
// // MixSamples will mix the given samples.
// //
// // In case the samples are interleaved, in must be a slice with a single element of interleaved samples.
// //
// // If non-interleaved samples are used, in must be a slice of data with an element for each channel
// // Free frees the channel mixer. The bindings will usually take care of this for you.
// func (c *ChannelMixer) Free() { C.gst_audio_channel_mixer_free(c.ptr) }
// // ChannelMixerFlags are flags used to configure a ChannelMixer
// type ChannelMixerFlags int
// // Castings for ChannelMixerFlags
// const (
// ChannelMixerFlagsNone ChannelMixerFlags = C.GST_AUDIO_CHANNEL_MIXER_FLAGS_NONE // (0) no flag
// ChannelMixerFlagsNonInterleavedIn ChannelMixerFlags = C.GST_AUDIO_CHANNEL_MIXER_FLAGS_NON_INTERLEAVED_IN // (1) input channels are not interleaved
// ChannelMixerFlagsNonInterleavedOut ChannelMixerFlags = C.GST_AUDIO_CHANNEL_MIXER_FLAGS_NON_INTERLEAVED_OUT // (2) output channels are not interleaved
// ChannelMixerFlagsUnpositionedIn ChannelMixerFlags = C.GST_AUDIO_CHANNEL_MIXER_FLAGS_UNPOSITIONED_IN // (4) input channels are explicitly unpositioned
// ChannelMixerFlagsUnpositionedOut ChannelMixerFlags = C.GST_AUDIO_CHANNEL_MIXER_FLAGS_UNPOSITIONED_OUT // (8) output channels are explicitly unpositioned
// )

View File

@@ -1,155 +0,0 @@
package audio
/*
#include "gst.go.h"
*/
import "C"
import (
"math"
"strings"
"unsafe"
)
// GetFallbackChannelMask gets the fallback channel-mask for the given number of channels.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func GetFallbackChannelMask(channels int) uint64 {
return uint64(C.gst_audio_channel_get_fallback_mask(C.gint(channels)))
}
// ChannelPositionsFromMask converts the channels present in mask to a position array (which
// should have at least channels entries ensured by caller). If mask is set to 0, it is considered
// as 'not present' for purpose of conversion. A partially valid mask with less bits set than the
// number of channels is considered valid. This function returns nil if the arguments are invalid.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func ChannelPositionsFromMask(channels int, mask uint64) []ChannelPosition {
var out C.GstAudioChannelPosition
ret := C.gst_audio_channel_positions_from_mask(C.gint(channels), C.guint64(mask), &out)
if !gobool(ret) {
return nil
}
outsl := make([]ChannelPosition, channels)
tmp := (*[(math.MaxInt32 - 1) / unsafe.Sizeof(C.GST_AUDIO_CHANNEL_POSITION_NONE)]C.GstAudioChannelPosition)(unsafe.Pointer(&out))[:channels:channels]
for i, s := range tmp {
outsl[i] = ChannelPosition(s)
}
return outsl
}
// ChannelPositionsToMask converts the given channel positions to a bitmask. If forceOrder is true
// it additionally checks the channels in the order required by GStreamer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func ChannelPositionsToMask(positions []ChannelPosition, forceOrder bool) (mask uint64, ok bool) {
var out C.guint64
ok = gobool(C.gst_audio_channel_positions_to_mask(
(*C.GstAudioChannelPosition)(unsafe.Pointer(&positions[0])),
C.gint(len(positions)),
gboolean(forceOrder),
&out,
))
if ok {
mask = uint64(out)
}
return
}
// ChannelPositionsToString converts the given positions into a human-readable string.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func ChannelPositionsToString(positions []ChannelPosition) string {
ret := C.gst_audio_channel_positions_to_string(
(*C.GstAudioChannelPosition)(unsafe.Pointer(&positions[0])),
C.gint(len(positions)),
)
defer C.g_free((C.gpointer)(unsafe.Pointer(ret)))
return C.GoString(ret)
}
// ChannelPositionsToValidOrder reorders the given positions from any order to the GStreamer order.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func ChannelPositionsToValidOrder(positions []ChannelPosition) (ok bool) {
ok = gobool(C.gst_audio_channel_positions_to_valid_order(
(*C.GstAudioChannelPosition)(unsafe.Pointer(&positions[0])),
C.gint(len(positions)),
))
return
}
// AreValidChannelPositions checks if the positions are all valid. If forceOrder is true, it also checks
// if they are in the order required by GStreamer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func AreValidChannelPositions(positions []ChannelPosition, forceOrder bool) bool {
return gobool(C.gst_audio_check_valid_channel_positions(
(*C.GstAudioChannelPosition)(unsafe.Pointer(&positions[0])),
C.gint(len(positions)),
gboolean(forceOrder),
))
}
// ChannelPosition represents audio channel positions.
//
// These are the channels defined in SMPTE 2036-2-2008 Table 1 for 22.2 audio systems with the
// Surround and Wide channels from DTS Coherent Acoustics (v.1.3.1) and 10.2 and 7.1 layouts.
// In the caps the actual channel layout is expressed with a channel count and a channel mask,
// which describes the existing channels. The positions in the bit mask correspond to the enum
// values. For negotiation it is allowed to have more bits set in the channel mask than the
// number of channels to specify the allowed channel positions but this is not allowed in negotiated
// caps. It is not allowed in any situation other than the one mentioned below to have less
// bits set in the channel mask than the number of channels.
//
// ChannelPositionMono can only be used with a single mono channel that has no direction information
// and would be mixed into all directional channels. This is expressed in caps by having a single
// channel and no channel mask.
//
// ChannelPositionNone can only be used if all channels have this position. This is expressed in caps
// by having a channel mask with no bits set.
//
// As another special case it is allowed to have two channels without a channel mask. This implicitly
// means that this is a stereo stream with a front left and front right channel.
type ChannelPosition int
// ChannelPosition castings
const (
ChannelPositionNone ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_NONE // (-3) used for position-less channels, e.g. from a sound card that records 1024 channels; mutually exclusive with any other channel position
ChannelPositionMono ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_MONO // (-2) Mono without direction; can only be used with 1 channel
ChannelPositionInvalid ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_INVALID // (-1) invalid position
ChannelPositionFrontLeft ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT // (0) Front left
ChannelPositionFrontRight ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT // (1) Front right
ChannelPositionFrontCenter ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER // (2) Front center
ChannelPositionLFE1 ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_LFE1 // (3) Low-frequency effects 1 (subwoofer)
ChannelPositionRearLeft ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_REAR_LEFT // (4) Rear left
ChannelPositionRearRight ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT // (5) Rear right
ChannelPositionFrontLeftOfCenter ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER // (6) Front left of center
ChannelPositionFrontRightOfCenter ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER // (7) Front right of center
ChannelPositionRearCenter ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_REAR_CENTER // (8) Rear center
ChannelPositionLFE2 ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_LFE2 // (9) Low-frequency effects 2 (subwoofer)
ChannelPositionSideLeft ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT // (10) Side left
ChannelPositionSideRight ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT // (11) Side right
ChannelPositionTopFrontLeft ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_LEFT // (12) Top front left
ChannelPositionTopFrontRight ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_RIGHT // (13) Top front right
ChannelPositionTopFrontCenter ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_CENTER // (14) Top front center
ChannelPositionTopCenter ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_TOP_CENTER // (15) Top center
ChannelPositionTopRearLeft ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_TOP_REAR_LEFT // (16) Top rear left
ChannelPositionTopRearRight ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_TOP_REAR_RIGHT // (17) Top rear right
ChannelPositionTopSideLeft ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_LEFT // (18) Top side right
ChannelPositionTopSideRight ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_RIGHT // (19) Top rear right
ChannelPositionTopRearCenter ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_TOP_REAR_CENTER // (20) Top rear center
ChannelPositionBottomFrontCenter ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_CENTER // (21) Bottom front center
ChannelPositionBottomFrontLeft ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_LEFT // (22) Bottom front left
ChannelPositionBottomFrontRight ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_RIGHT // (23) Bottom front right
ChannelPositionWideLeft ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_WIDE_LEFT // (24) Wide left (between front left and side left)
ChannelPositionWideRight ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_WIDE_RIGHT // (25) Wide right (between front right and side right)
ChannelPositionSurroundLeft ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_SURROUND_LEFT // (26) Surround left (between rear left and side left)
ChannelPositionSurroundRight ChannelPosition = C.GST_AUDIO_CHANNEL_POSITION_SURROUND_RIGHT // (27) Surround right (between rear right and side right)
)
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c ChannelPosition) String() string {
// ugly hack
return strings.TrimSuffix(strings.TrimPrefix(ChannelPositionsToString([]ChannelPosition{c}), "[ "), " ]")
}

View File

@@ -1,261 +0,0 @@
package audio
/*
#include <stdlib.h>
#include "gst.go.h"
*/
import "C"
import (
"math"
"unsafe"
"github.com/go-gst/go-glib/glib"
"github.com/go-gst/go-gst/gst"
)
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func init() {
glib.RegisterGValueMarshalers([]glib.TypeMarshaler{
{
T: glib.Type(C.gst_audio_format_get_type()),
F: func(p unsafe.Pointer) (interface{}, error) {
c := C.g_value_get_enum(ptrToGVal(p))
return Format(c), nil
},
},
})
}
// FormatInfo is a structure containing information about an audio format.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type FormatInfo struct {
ptr *C.GstAudioFormatInfo
}
// Format returns the format for this info.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (f *FormatInfo) Format() Format { return Format(f.ptr.format) }
// Name returns the name for this info.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (f *FormatInfo) Name() string { return C.GoString(f.ptr.name) }
// Description returns a user readable description for this info.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (f *FormatInfo) Description() string { return C.GoString(f.ptr.description) }
// Flags returns the flags on this info.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (f *FormatInfo) Flags() FormatFlags { return FormatFlags(f.ptr.flags) }
// Endianness returns the endianness for this info.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (f *FormatInfo) Endianness() int { return int(f.ptr.endianness) }
// Width returns the amount of bits used for one sample.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (f *FormatInfo) Width() int { return int(f.ptr.width) }
// Depth returns the amount of valid bits in width.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (f *FormatInfo) Depth() int { return int(f.ptr.depth) }
// Silence returns the data for a single silent sample.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (f *FormatInfo) Silence() []byte {
return C.GoBytes(unsafe.Pointer(&f.ptr.silence), C.gint(f.Width()/8))
}
// UnpackFormat is the format of unpacked samples.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (f *FormatInfo) UnpackFormat() Format { return Format(f.ptr.unpack_format) }
// Layout represents the layout of audio samples for different channels.
type Layout int
// Castings for Layouts
const (
LayoutInterleaved Layout = C.GST_AUDIO_LAYOUT_INTERLEAVED // (0) interleaved audio
LayoutNonInterleaved Layout = C.GST_AUDIO_LAYOUT_NON_INTERLEAVED // (1) non-interleaved audio
)
// FormatFlags are the different audio flags that a format can have.
type FormatFlags int
// Castings for FormatFlags
const (
FormatFlagInteger FormatFlags = C.GST_AUDIO_FORMAT_FLAG_INTEGER // (1) integer samples
FormatFlagFloat FormatFlags = C.GST_AUDIO_FORMAT_FLAG_FLOAT // (2) float samples
FormatFlagSigned FormatFlags = C.GST_AUDIO_FORMAT_FLAG_SIGNED // (4) signed samples
FormatFlagComplex FormatFlags = C.GST_AUDIO_FORMAT_FLAG_COMPLEX // (16) complex layout
FormatFlagUnpack FormatFlags = C.GST_AUDIO_FORMAT_FLAG_UNPACK // (32) the format can be used in GstAudioFormatUnpack and GstAudioFormatPack functions
)
// PackFlags are the different flags that can be used when packing and unpacking.
type PackFlags int
// Castings for PackFlags
const (
PackFlagNone PackFlags = C.GST_AUDIO_PACK_FLAG_NONE // (0) No flag
PackFlagTruncateRange PackFlags = C.GST_AUDIO_PACK_FLAG_TRUNCATE_RANGE // (1) When the source has a smaller depth than the target format, set the least significant bits of the target to 0. This is likely slightly faster but less accurate. When this flag is not specified, the most significant bits of the source are duplicated in the least significant bits of the destination.
)
// Format is an enum describing the most common audio formats
type Format int
// TypeFormat is the GType for a GstAudioFormat.
var TypeFormat = glib.Type(C.gst_audio_format_get_type())
// ToGValue implements a glib.ValueTransformer
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (f Format) ToGValue() (*glib.Value, error) {
val, err := glib.ValueInit(TypeFormat)
if err != nil {
return nil, err
}
val.SetEnum(int(f))
return val, nil
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (f Format) String() string {
return C.GoString(C.gst_audio_format_to_string(C.GstAudioFormat(f)))
}
// Info returns the info for this Format.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (f Format) Info() *FormatInfo {
return &FormatInfo{
ptr: C.gst_audio_format_get_info(C.GstAudioFormat(f)),
}
}
// FormatFromString returns the format for the given string representation.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FormatFromString(format string) Format {
f := C.CString(format)
defer C.free(unsafe.Pointer(f))
return Format(C.gst_audio_format_from_string((*C.gchar)(unsafe.Pointer(f))))
}
// LittleEndian represents little-endian format
const LittleEndian int = C.G_LITTLE_ENDIAN
// BigEndian represents big-endian format
const BigEndian int = C.G_BIG_ENDIAN
// FormatFromInteger returns a Format with the given parameters. Signed is whether signed or unsigned format.
// Endianness can be either LittleEndian or BigEndian. Width is the amount of bits used per sample, and depth
// is the amount of used bits in width.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FormatFromInteger(signed bool, endianness, width, depth int) Format {
return Format(C.gst_audio_format_build_integer(
gboolean(signed),
C.gint(endianness),
C.gint(width),
C.gint(depth),
))
}
// RawFormats returns all the raw formats supported by GStreamer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func RawFormats() []Format {
var l C.guint
formats := C.gst_audio_formats_raw(&l)
out := make([]Format, int(l))
tmpslice := (*[(math.MaxInt32 - 1) / unsafe.Sizeof(C.GST_AUDIO_FORMAT_UNKNOWN)]C.GstAudioFormat)(unsafe.Pointer(formats))[:l:l]
for i, s := range tmpslice {
out[i] = Format(s)
}
return out
}
// MakeRawCaps returns a generic raw audio caps for the formats defined. If formats is nil, all supported
// formats are used.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func MakeRawCaps(formats []Format, layout Layout) *gst.Caps {
var caps *C.GstCaps
if formats == nil {
caps = C.gst_audio_make_raw_caps(nil, C.guint(0), C.GstAudioLayout(layout))
} else {
caps = C.gst_audio_make_raw_caps((*C.GstAudioFormat)(unsafe.Pointer(&formats[0])), C.guint(len(formats)), C.GstAudioLayout(layout))
}
if caps == nil {
return nil
}
return gst.FromGstCapsUnsafeFull(unsafe.Pointer(caps))
}
// DefaultRate is the default sampling rate used in consumer audio
const DefaultRate = 44100
// Castings for Formats
const (
// DefaultFormat is the default format used in consumer audio
DefaultFormat Format = FormatS16LE
FormatUnknown Format = C.GST_AUDIO_FORMAT_UNKNOWN // (0) unknown or unset audio format
FormatEncoded Format = C.GST_AUDIO_FORMAT_ENCODED // (1) encoded audio format
FormatS8 Format = C.GST_AUDIO_FORMAT_S8 // (2) 8 bits in 8 bits, signed
FormatU8 Format = C.GST_AUDIO_FORMAT_U8 // (3) 8 bits in 8 bits, unsigned
FormatS16LE Format = C.GST_AUDIO_FORMAT_S16LE // (4) 16 bits in 16 bits, signed, little endian
FormatS16BE Format = C.GST_AUDIO_FORMAT_S16BE // (5) 16 bits in 16 bits, signed, big endian
FormatU16LE Format = C.GST_AUDIO_FORMAT_U16LE // (6) 16 bits in 16 bits, unsigned, little endian
FormatU16BE Format = C.GST_AUDIO_FORMAT_U16BE // (7) 16 bits in 16 bits, unsigned, big endian
FormatS2432LE Format = C.GST_AUDIO_FORMAT_S24_32LE // (8) 24 bits in 32 bits, signed, little endian
FormatS2332BE Format = C.GST_AUDIO_FORMAT_S24_32BE // (9) 24 bits in 32 bits, signed, big endian
FormatU2432LE Format = C.GST_AUDIO_FORMAT_U24_32LE // (10) 24 bits in 32 bits, unsigned, little endian
FormatU2432BE Format = C.GST_AUDIO_FORMAT_U24_32BE // (11) 24 bits in 32 bits, unsigned, big endian
FormatS32LE Format = C.GST_AUDIO_FORMAT_S32LE // (12) 32 bits in 32 bits, signed, little endian
FormatS32BE Format = C.GST_AUDIO_FORMAT_S32BE // (13) 32 bits in 32 bits, signed, big endian
FormatU32LE Format = C.GST_AUDIO_FORMAT_U32LE // (14) 32 bits in 32 bits, unsigned, little endian
FormatU32BE Format = C.GST_AUDIO_FORMAT_U32BE // (15) 32 bits in 32 bits, unsigned, big endian
FormatS24LE Format = C.GST_AUDIO_FORMAT_S24LE // (16) 24 bits in 24 bits, signed, little endian
FormatS24BE Format = C.GST_AUDIO_FORMAT_S24BE // (17) 24 bits in 24 bits, signed, big endian
FormatU24LE Format = C.GST_AUDIO_FORMAT_U24LE // (18) 24 bits in 24 bits, unsigned, little endian
FormatU24BE Format = C.GST_AUDIO_FORMAT_U24BE // (19) 24 bits in 24 bits, unsigned, big endian
FormatS20LE Format = C.GST_AUDIO_FORMAT_S20LE // (20) 20 bits in 24 bits, signed, little endian
FormatS20BE Format = C.GST_AUDIO_FORMAT_S20BE // (21) 20 bits in 24 bits, signed, big endian
FormatU20LE Format = C.GST_AUDIO_FORMAT_U20LE // (22) 20 bits in 24 bits, unsigned, little endian
FormatU20BE Format = C.GST_AUDIO_FORMAT_U20BE // (23) 20 bits in 24 bits, unsigned, big endian
FormatS18LE Format = C.GST_AUDIO_FORMAT_S18LE // (24) 18 bits in 24 bits, signed, little endian
FormatS18BE Format = C.GST_AUDIO_FORMAT_S18BE // (25) 18 bits in 24 bits, signed, big endian
FormatU18LE Format = C.GST_AUDIO_FORMAT_U18LE // (26) 18 bits in 24 bits, unsigned, little endian
FormatU18BE Format = C.GST_AUDIO_FORMAT_U18BE // (27) 18 bits in 24 bits, unsigned, big endian
FormatF32LE Format = C.GST_AUDIO_FORMAT_F32LE // (28) 32-bit floating point samples, little endian
FormatF32BE Format = C.GST_AUDIO_FORMAT_F32BE // (29) 32-bit floating point samples, big endian
FormatF64LE Format = C.GST_AUDIO_FORMAT_F64LE // (30) 64-bit floating point samples, little endian
FormatF64BE Format = C.GST_AUDIO_FORMAT_F64BE // (31) 64-bit floating point samples, big endian
FormatS16 Format = C.GST_AUDIO_FORMAT_S16 // (4) 16 bits in 16 bits, signed, native endianness
FormatU16 Format = C.GST_AUDIO_FORMAT_U16 // (6) 16 bits in 16 bits, unsigned, native endianness
FormatS2432 Format = C.GST_AUDIO_FORMAT_S24_32 // (8) 24 bits in 32 bits, signed, native endianness
FormatU2432 Format = C.GST_AUDIO_FORMAT_U24_32 // (10) 24 bits in 32 bits, unsigned, native endianness
FormatS32 Format = C.GST_AUDIO_FORMAT_S32 // (12) 32 bits in 32 bits, signed, native endianness
FormatU32 Format = C.GST_AUDIO_FORMAT_U32 // (14) 32 bits in 32 bits, unsigned, native endianness
FormatS24 Format = C.GST_AUDIO_FORMAT_S24 // (16) 24 bits in 24 bits, signed, native endianness
FormatU24 Format = C.GST_AUDIO_FORMAT_U24 // (18) 24 bits in 24 bits, unsigned, native endianness
FormatS20 Format = C.GST_AUDIO_FORMAT_S20 // (20) 20 bits in 24 bits, signed, native endianness
FormatU20 Format = C.GST_AUDIO_FORMAT_U20 // (22) 20 bits in 24 bits, unsigned, native endianness
FormatS18 Format = C.GST_AUDIO_FORMAT_S18 // (24) 18 bits in 24 bits, signed, native endianness
FormatU18 Format = C.GST_AUDIO_FORMAT_U18 // (26) 18 bits in 24 bits, unsigned, native endianness
FormatF32 Format = C.GST_AUDIO_FORMAT_F32 // (28) 32-bit floating point samples, native endianness
FormatF64 Format = C.GST_AUDIO_FORMAT_F64 // (30) 64-bit floating point samples, native endianness
)

View File

@@ -1,160 +0,0 @@
package audio
/*
#include "gst.go.h"
gint channels(GstAudioInfo * info)
{
return GST_AUDIO_INFO_CHANNELS(info);
}
*/
import "C"
import (
"math"
"runtime"
"unsafe"
"github.com/go-gst/go-gst/gst"
)
// Flags contains extra audio flags
type Flags int
// Flags castings
const (
FlagNone Flags = C.GST_AUDIO_FLAG_NONE // (0) - no valid flag
FlagUnpositioned Flags = C.GST_AUDIO_FLAG_UNPOSITIONED // (1) the position array explicitly contains unpositioned channels.
)
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func wrapInfoFull(ptr *C.GstAudioInfo) *Info {
info := &Info{ptr}
runtime.SetFinalizer(info, (*Info).Free)
return info
}
// Info is a structure used for describing audio properties. This can be filled in from caps
// or converted back to caps.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type Info struct {
ptr *C.GstAudioInfo
}
// NewInfo returns a new Info that is also initialized.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewInfo() *Info { return wrapInfoFull(C.gst_audio_info_new()) }
// InfoFromCaps parses the provided caps and creates an info. It returns true if the caps could be parsed.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func InfoFromCaps(caps *gst.Caps) (*Info, bool) {
info := NewInfo()
return info, gobool(C.gst_audio_info_from_caps(info.ptr, (*C.GstCaps)(unsafe.Pointer(caps.Instance()))))
}
// FormatInfo returns the format info for the audio.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (i *Info) FormatInfo() *FormatInfo { return &FormatInfo{i.ptr.finfo} }
// Flags returns additional flags for the audio.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (i *Info) Flags() Flags { return Flags(i.ptr.flags) }
// Layout returns the audio layout.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (i *Info) Layout() Layout { return Layout(i.ptr.layout) }
// Rate returns the audio sample rate.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (i *Info) Rate() int { return int(i.ptr.rate) }
// Channels returns the number of channels.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (i *Info) Channels() int { return int(C.channels(i.ptr)) }
// BPF returns the number of bytes for one frame. This is the size of one sample * Channels.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (i *Info) BPF() int { return int(i.ptr.bpf) }
// Positions returns the positions for each channel.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (i *Info) Positions() []ChannelPosition {
l := i.Channels()
out := make([]ChannelPosition, int(l))
tmpslice := (*[(math.MaxInt32 - 1) / unsafe.Sizeof(C.GST_AUDIO_CHANNEL_POSITION_NONE)]C.GstAudioChannelPosition)(unsafe.Pointer(&i.ptr.position))[:l:l]
for i, s := range tmpslice {
out[i] = ChannelPosition(s)
}
return out
}
// Init initializes the info with the default values.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (i *Info) Init() { C.gst_audio_info_init(i.ptr) }
// Free frees the AudioInfo structure. This is usually handled for you by the bindings.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (i *Info) Free() { C.gst_audio_info_free(i.ptr) }
// Convert converts among various gst.Format types. This function handles gst.FormatBytes, gst.FormatTime,
// and gst.FormatDefault. For raw audio, gst.FormatDefault corresponds to audio frames. This function can
// be used to handle pad queries of the type gst.QueryConvert.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (i *Info) Convert(srcFmt gst.Format, srcVal int64, destFmt gst.Format) (int64, bool) {
var out C.gint64
ret := C.gst_audio_info_convert(
i.ptr,
C.GstFormat(srcFmt),
C.gint64(srcVal),
C.GstFormat(destFmt),
&out,
)
return int64(out), gobool(ret)
}
// Copy creates a copy of this Info.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (i *Info) Copy() *Info {
return wrapInfoFull(C.gst_audio_info_copy(i.ptr))
}
// IsEqual checks if the two infos are equal.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (i *Info) IsEqual(info *Info) bool {
return gobool(C.gst_audio_info_is_equal(i.ptr, info.ptr))
}
// SetFormat sets the format for this info. This initializes info first and no values are preserved.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (i *Info) SetFormat(format Format, rate int, positions []ChannelPosition) {
C.gst_audio_info_set_format(
i.ptr,
C.GstAudioFormat(format),
C.gint(rate),
C.gint(len(positions)),
(*C.GstAudioChannelPosition)(unsafe.Pointer(&positions[0])),
)
}
// ToCaps returns the caps representation of this info.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (i *Info) ToCaps() *gst.Caps {
return gst.FromGstCapsUnsafeFull(unsafe.Pointer(C.gst_audio_info_to_caps(i.ptr)))
}

View File

@@ -1,43 +0,0 @@
package audio
/*
#include "gst.go.h"
*/
import "C"
import (
"unsafe"
"github.com/go-gst/go-glib/glib"
"github.com/go-gst/go-gst/gst"
)
// AudioMeta is a Go representation of a GstAudioMeta.
type AudioMeta struct{ *glib.Object }
// FromGstAudioMetaUnsafeNone wraps the given audioMeta with a ref and finalizer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstAudioMetaUnsafeNone(audioMeta unsafe.Pointer) *AudioMeta {
return &AudioMeta{glib.TransferNone(audioMeta)}
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func BufferAddAudioMeta(buffer *gst.Buffer, info *Info, samples int, offsets []int) *AudioMeta {
// offsets is not yet implemented, always pass `nil` or this will panic
if offsets != nil {
panic("offsets is not implemented")
}
// gSizeOffsets := C.gsize(unsafe.Sizeof(unsafe.Pointer(offsets)))
// if you pass in NULL as the last param then gstreamer assumes things are tightly packed...
// so that's what we currently assume until we inplement offsets
return FromGstAudioMetaUnsafeNone(unsafe.Pointer(C.gst_buffer_add_audio_meta(
(*C.GstBuffer)(unsafe.Pointer(buffer.Instance())),
info.ptr,
C.gsize(samples),
nil,
)))
}

View File

@@ -1,8 +0,0 @@
package audio
/*
#cgo pkg-config: gstreamer-plugins-base-1.0 gstreamer-audio-1.0
#cgo CFLAGS: -Wno-deprecated-declarations
#cgo LDFLAGS: -lgstaudio-1.0
*/
import "C"

View File

@@ -1,2 +0,0 @@
// Deprecated: use the autogenerated pkg/gstbase instead
package base

View File

@@ -1,5 +0,0 @@
// Package base contains bindings for extendable GStreamer base objects.
//
// The objects and methods provided by this package are mostly for use in building
// plugins using the go-gst bindings.
package base

View File

@@ -1,15 +0,0 @@
#include "gst.go.h"
GstBaseSink * toGstBaseSink (void *p) { return GST_BASE_SINK_CAST(p); }
GstBaseSrc * toGstBaseSrc (void *p) { return GST_BASE_SRC_CAST(p); }
GstBaseTransform * toGstBaseTransform (void *p) { return GST_BASE_TRANSFORM(p); }
GstCollectPads * toGstCollectPads (void *p) { return GST_COLLECT_PADS(p); }
GstPushSrc * toGstPushSrc (void *p) { return GST_PUSH_SRC(p); }
GstBaseSinkClass * toGstBaseSinkClass (void *p) { return (GstBaseSinkClass *)p; }
GstBaseSrcClass * toGstBaseSrcClass (void *p) { return (GstBaseSrcClass *)p; }
GstBaseTransformClass * toGstBaseTransformClass (void *p) { return (GstBaseTransformClass *)p; }
GstPushSrcClass * toGstPushSrcClass (void *p) { return (GstPushSrcClass *)p; }
gint64 gstCollectDataDTS (GstCollectData * gcd) { return GST_COLLECT_PADS_DTS(gcd); }

View File

@@ -1,20 +0,0 @@
#ifndef __GST_BASE_GO_H__
#define __GST_BASE_GO_H__
#include <gst/base/base.h>
#include <stddef.h>
extern GstBaseSink * toGstBaseSink (void *p);
extern GstBaseSrc * toGstBaseSrc (void *p);
extern GstBaseTransform * toGstBaseTransform (void *p);
extern GstCollectPads * toGstCollectPads (void *p);
extern GstPushSrc * toGstPushSrc (void *p);
extern GstBaseSinkClass * toGstBaseSinkClass (void *p);
extern GstBaseSrcClass * toGstBaseSrcClass (void *p);
extern GstBaseTransformClass * toGstBaseTransformClass (void *p);
extern GstPushSrcClass * toGstPushSrcClass (void *p);
extern gint64 gstCollectDataDTS (GstCollectData * gcd);
#endif

View File

@@ -1,394 +0,0 @@
package base
/*
#include "gst.go.h"
gboolean baseSinkParentEvent (GstBaseSink * sink, GstEvent * event)
{
GObjectClass * this_class = G_OBJECT_GET_CLASS(G_OBJECT(sink));
GstBaseSinkClass * parent = toGstBaseSinkClass(g_type_class_peek_parent(this_class));
return parent->event(sink, event);
}
*/
import "C"
import (
"unsafe"
"github.com/go-gst/go-glib/glib"
"github.com/go-gst/go-gst/gst"
)
// GstBaseSink represents a GstBaseSink.
type GstBaseSink struct{ *gst.Element }
// ToGstBaseSink returns a GstBaseSink object for the given object. It will work on either gst.Object
// or glib.Object interfaces.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func ToGstBaseSink(obj interface{}) *GstBaseSink {
switch obj := obj.(type) {
case *gst.Object:
return &GstBaseSink{&gst.Element{Object: obj}}
case *glib.Object:
return &GstBaseSink{&gst.Element{Object: &gst.Object{InitiallyUnowned: &glib.InitiallyUnowned{Object: obj}}}}
}
return nil
}
// Instance returns the underlying C GstBaseSrc instance
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) Instance() *C.GstBaseSink {
return C.toGstBaseSink(g.Unsafe())
}
// DoPreroll is for if the sink spawns its own thread for pulling buffers from upstream.
// It should call this method after it has pulled a buffer. If the element needed to preroll,
// this function will perform the preroll and will then block until the element state is changed.
//
// This function should be called with the PREROLL_LOCK held and the object that caused the preroll.
//
// Since the object will always be a gst.MiniObject (which is not implemented properly), this method will check
// against the provided types for structs known to be used in this context. The currently known options
// are events, messages, queries, structures, and buffers. If you come across a need to use this function with
// an unsupported type, feel free to raise an Issue or open a PR.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) DoPreroll(obj interface{}) gst.FlowReturn {
miniobj := getPrerollObj(obj)
if miniobj == nil {
return gst.FlowError
}
return gst.FlowReturn(C.gst_base_sink_do_preroll(g.Instance(), miniobj))
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func getPrerollObj(obj interface{}) *C.GstMiniObject {
switch obj := obj.(type) {
case *gst.Event:
return (*C.GstMiniObject)(unsafe.Pointer(obj.Instance()))
case *gst.Buffer:
return (*C.GstMiniObject)(unsafe.Pointer(obj.Instance()))
case *gst.Message:
return (*C.GstMiniObject)(unsafe.Pointer(obj.Instance()))
case *gst.Query:
return (*C.GstMiniObject)(unsafe.Pointer(obj.Instance()))
case *gst.Structure:
return (*C.GstMiniObject)(unsafe.Pointer(obj.Instance()))
default:
return nil
}
}
// GetBlocksize gets the number of bytes that the sink will pull when it is operating in pull mode.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) GetBlocksize() uint { return uint(C.gst_base_sink_get_blocksize(g.Instance())) }
// GetDropOutOfSegment checks if sink is currently configured to drop buffers which are outside the current segment
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) GetDropOutOfSegment() bool {
return gobool(C.gst_base_sink_get_drop_out_of_segment(g.Instance()))
}
// GetLastSample gets the last sample that arrived in the sink and was used for preroll or for rendering.
// This property can be used to generate thumbnails.
//
// The GstCaps on the sample can be used to determine the type of the buffer. Sample will
// be nil if no buffer has arrived yet.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) GetLastSample() *gst.Sample {
sample := C.gst_base_sink_get_last_sample(g.Instance())
if sample == nil {
return nil
}
return gst.FromGstSampleUnsafeFull(unsafe.Pointer(sample))
}
// GetLatency gets the currently configured latency.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) GetLatency() gst.ClockTime {
return gst.ClockTime(C.gst_base_sink_get_latency(g.Instance()))
}
// GetMaxBitrate gets the maximum amount of bits per second the sink will render.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) GetMaxBitrate() uint64 {
return uint64(C.gst_base_sink_get_max_bitrate(g.Instance()))
}
// GetMaxLateness gets the max lateness value.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) GetMaxLateness() int64 {
return int64(C.gst_base_sink_get_max_lateness(g.Instance()))
}
// GetProcessingDeadline gets the processing deadline of the sink.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) GetProcessingDeadline() gst.ClockTime {
return gst.ClockTime(C.gst_base_sink_get_processing_deadline(g.Instance()))
}
// GetRenderDelay gets the render delay for the sink.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) GetRenderDelay() gst.ClockTime {
return gst.ClockTime(C.gst_base_sink_get_render_delay(g.Instance()))
}
// SINCE 1.18
// // SinkStats represents the current statistics on a GstBaseSink.
// type SinkStats struct {
// AverageRate float64
// Dropped uint64
// Rendered uint64
// }
// // GetSinkStats returns various GstBaseSink statistics.
// func (g *GstBaseSink) GetSinkStats() *SinkStats {
// st := gst.FromGstStructureUnsafe(unsafe.Pointer(C.gst_base_sink_get_stats(g.Instance())))
// stats := &SinkStats{}
// if avgRate, err := st.GetValue("average-rate"); err == nil {
// stats.AverageRate = avgRate.(float64)
// }
// if dropped, err := st.GetValue("dropped"); err == nil {
// stats.Dropped = dropped.(uint64)
// }
// if rendered, err := st.GetValue("rendered"); err == nil {
// stats.Rendered = rendered.(uint64)
// }
// return stats
// }
// GetSync checks if the sink is currently configured to synchronize on the clock.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) GetSync() bool { return gobool(C.gst_base_sink_get_sync(g.Instance())) }
// GetThrottleTime gets the time that will be inserted between frames to control maximum buffers
// per second.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) GetThrottleTime() uint64 {
return uint64(C.gst_base_sink_get_throttle_time(g.Instance()))
}
// GetTsOffset gets the synchronization offset of sink.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) GetTsOffset() gst.ClockTime {
return gst.ClockTime(C.gst_base_sink_get_ts_offset(g.Instance()))
}
// IsAsyncEnabled checks if the sink is currently configured to perform asynchronous state changes to PAUSED.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) IsAsyncEnabled() bool {
return gobool(C.gst_base_sink_is_async_enabled(g.Instance()))
}
// IsLastSampleEnabled checks if the sink is currently configured to store the last received sample.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) IsLastSampleEnabled() bool {
return gobool(C.gst_base_sink_is_last_sample_enabled(g.Instance()))
}
// IsQoSEnabled checks if sink is currently configured to send QoS events upstream.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) IsQoSEnabled() bool {
return gobool(C.gst_base_sink_is_qos_enabled(g.Instance()))
}
// ParentEvent calls the parent class's event handler for the given event.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) ParentEvent(ev *gst.Event) bool {
return gobool(C.baseSinkParentEvent(
g.Instance(),
(*C.GstEvent)(unsafe.Pointer(ev.Instance())),
))
}
// QueryLatency queries the sink for the latency parameters. The latency will be queried from the
// upstream elements. live will be TRUE if sink is configured to synchronize against the clock.
// upstreamLive will be TRUE if an upstream element is live.
//
// If both live and upstreamLive are TRUE, the sink will want to compensate for the latency introduced
// by the upstream elements by setting the minLatency to a strictly positive value.
//
// This function is mostly used by subclasses.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) QueryLatency() (ok, live, upstreamLive bool, minLatency, maxLatency gst.ClockTime) {
var glive, gupLive C.gboolean
var gmin, gmax C.GstClockTime
ret := C.gst_base_sink_query_latency(g.Instance(), &glive, &gupLive, &gmin, &gmax)
return gobool(ret), gobool(glive), gobool(gupLive), gst.ClockTime(gmin), gst.ClockTime(gmax)
}
// SetAsyncEnabled configures sink to perform all state changes asynchronously. When async is disabled,
// the sink will immediately go to PAUSED instead of waiting for a preroll buffer. This feature is useful
// if the sink does not synchronize against the clock or when it is dealing with sparse streams.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) SetAsyncEnabled(enabled bool) {
C.gst_base_sink_set_async_enabled(g.Instance(), gboolean(enabled))
}
// SetBlocksize sets the number of bytes this sink will pull when operating in pull mode.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) SetBlocksize(blocksize uint) {
C.gst_base_sink_set_blocksize(g.Instance(), C.guint(blocksize))
}
// SetDropOutOfSegment configures sink to drop buffers which are outside the current segment.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) SetDropOutOfSegment(drop bool) {
C.gst_base_sink_set_drop_out_of_segment(g.Instance(), gboolean(drop))
}
// SetLastSampleEnabled configures the sink to store the last received sample.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) SetLastSampleEnabled(enabled bool) {
C.gst_base_sink_set_last_sample_enabled(g.Instance(), gboolean(enabled))
}
// SetMaxBitrate sets the maximum amount of bits per second the sink will render.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) SetMaxBitrate(bitrate uint64) {
C.gst_base_sink_set_max_bitrate(g.Instance(), C.guint64(bitrate))
}
// SetMaxLateness sets the new max lateness value to max_lateness. This value is used to decide if
// a buffer should be dropped or not based on the buffer timestamp and the current clock time. A
// value of -1 means an unlimited time.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) SetMaxLateness(maxLateness int64) {
C.gst_base_sink_set_max_lateness(g.Instance(), C.gint64(maxLateness))
}
// SetProcessingDeadline sets the maximum amount of time (in nanoseconds) that the pipeline can take
// for processing the buffer. This is added to the latency of live pipelines.
//
// This function is usually called by subclasses.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) SetProcessingDeadline(deadline gst.ClockTime) {
C.gst_base_sink_set_processing_deadline(g.Instance(), C.GstClockTime(deadline))
}
// SetQoSEnabled configures sink to send Quality-of-Service events upstream.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) SetQoSEnabled(enabled bool) {
C.gst_base_sink_set_qos_enabled(g.Instance(), gboolean(enabled))
}
// SetRenderDelay sets the render delay in sink to delay. The render delay is the time between actual
// rendering of a buffer and its synchronization time. Some devices might delay media rendering which
// can be compensated for with this function.
//
// After calling this function, this sink will report additional latency and other sinks will adjust
// their latency to delay the rendering of their media.
//
// This function is usually called by subclasses.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) SetRenderDelay(delay gst.ClockTime) {
C.gst_base_sink_set_render_delay(g.Instance(), C.GstClockTime(delay))
}
// SetSync configures sink to synchronize on the clock or not. When sync is FALSE, incoming samples will
// be played as fast as possible. If sync is TRUE, the timestamps of the incoming buffers will be used to
// schedule the exact render time of its contents.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) SetSync(sync bool) { C.gst_base_sink_set_sync(g.Instance(), gboolean(sync)) }
// SetThrottleTime sets the time that will be inserted between rendered buffers. This can be used to control
// the maximum buffers per second that the sink will render.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) SetThrottleTime(throttle uint64) {
C.gst_base_sink_set_throttle_time(g.Instance(), C.guint64(throttle))
}
// SetTsOffset adjusts the synchronization of sink with offset. A negative value will render buffers earlier
// than their timestamp. A positive value will delay rendering. This function can be used to fix playback of
// badly timestamped buffers.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) SetTsOffset(offset gst.ClockTimeDiff) {
C.gst_base_sink_set_ts_offset(g.Instance(), C.GstClockTimeDiff(offset))
}
// Wait will wait for preroll to complete and will then block until timeout is reached. It is usually called by
// subclasses that use their own internal synchronization but want to let some synchronization (like EOS) be
// handled by the base class.
//
// This function should only be called with the PREROLL_LOCK held (like when receiving an EOS event in the
// ::event vmethod or when handling buffers in ::render).
//
// The timeout argument should be the running_time of when the timeout should happen and will be adjusted with any
// latency and offset configured in the sink.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) Wait(timeout gst.ClockTime) (ret gst.FlowReturn, jitter gst.ClockTimeDiff) {
var jit C.GstClockTimeDiff
gret := C.gst_base_sink_wait(g.Instance(), C.GstClockTime(timeout), &jit)
return gst.FlowReturn(gret), gst.ClockTimeDiff(jit)
}
// WaitClock will block until timeout is reached. It is usually called by subclasses that use their own
// internal synchronization.
//
// If time is not valid, no synchronization is done and GST_CLOCK_BADTIME is returned. Likewise, if synchronization
// is disabled in the element or there is no clock, no synchronization is done and GST_CLOCK_BADTIME is returned.
//
// This function should only be called with the PREROLL_LOCK held, like when receiving an EOS event in the event()
// vmethod or when receiving a buffer in the render() vmethod.
//
// The timeout argument should be the running_time of when this method should return and is not adjusted with any
// latency or offset configured in the sink.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) WaitClock(timeout gst.ClockTime) (ret gst.ClockReturn, jitter gst.ClockTimeDiff) {
var jit C.GstClockTimeDiff
gret := C.gst_base_sink_wait_clock(g.Instance(), C.GstClockTime(timeout), &jit)
return gst.ClockReturn(gret), gst.ClockTimeDiff(jit)
}
// WaitPreroll will block until the preroll is complete.
//
// If the render() method performs its own synchronization against the clock it must unblock when going from
// PLAYING to the PAUSED state and call this method before continuing to render the remaining data.
//
// If the render() method can block on something else than the clock, it must also be ready to unblock immediately
// on the unlock() method and cause the render() method to immediately call this function. In this case, the
// subclass must be prepared to continue rendering where it left off if this function returns GST_FLOW_OK.
//
// This function will block until a state change to PLAYING happens (in which case this function returns
// GST_FLOW_OK) or the processing must be stopped due to a state change to READY or a FLUSH event (in which case
// this function returns GST_FLOW_FLUSHING).
//
// This function should only be called with the PREROLL_LOCK held, like in the render function.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSink) WaitPreroll() gst.FlowReturn {
return gst.FlowReturn(C.gst_base_sink_wait_preroll(g.Instance()))
}

View File

@@ -1,309 +0,0 @@
package base
/*
#include "gst.go.h"
*/
import "C"
import (
"time"
"unsafe"
"github.com/go-gst/go-glib/glib"
"github.com/go-gst/go-gst/gst"
)
//export goGstBaseSinkActivatePull
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSinkActivatePull(sink *C.GstBaseSink, active C.gboolean) C.gboolean {
var ret C.gboolean
goBaseSink := ToGstBaseSink(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(sink))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(sink))
iface := subclass.(interface {
ActivatePull(self *GstBaseSink, active bool) bool
})
ret = gboolean(iface.ActivatePull(goBaseSink, gobool(active)))
return ret
}
//export goGstBaseSinkEvent
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSinkEvent(sink *C.GstBaseSink, event *C.GstEvent) C.gboolean {
var ret C.gboolean
goBaseSink := ToGstBaseSink(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(sink))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(sink))
iface := subclass.(interface {
Event(self *GstBaseSink, event *gst.Event) bool
})
ret = gboolean(iface.Event(goBaseSink, gst.ToGstEvent(unsafe.Pointer(event))))
return ret
}
//export goGstBaseSinkFixate
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSinkFixate(sink *C.GstBaseSink, caps *C.GstCaps) *C.GstCaps {
var fixated *gst.Caps
goBaseSink := ToGstBaseSink(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(sink))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(sink))
iface := subclass.(interface {
Fixate(self *GstBaseSink, caps *gst.Caps) *gst.Caps
})
fixated = iface.Fixate(goBaseSink, gst.ToGstCaps(unsafe.Pointer(caps)))
if fixated == nil {
return nil
}
return (*C.GstCaps)(unsafe.Pointer(fixated.Instance()))
}
//export goGstBaseSinkGetCaps
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSinkGetCaps(sink *C.GstBaseSink, filter *C.GstCaps) *C.GstCaps {
var filtered *gst.Caps
goBaseSink := ToGstBaseSink(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(sink))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(sink))
iface := subclass.(interface {
GetCaps(self *GstBaseSink, filter *gst.Caps) *gst.Caps
})
filtered = iface.GetCaps(goBaseSink, gst.ToGstCaps(unsafe.Pointer(filter)))
if filtered == nil {
return nil
}
return (*C.GstCaps)(unsafe.Pointer(filtered.Instance()))
}
//export goGstBaseSinkGetTimes
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSinkGetTimes(sink *C.GstBaseSink, buf *C.GstBuffer, start, end *C.GstClockTime) {
var retStart, retEnd time.Duration
goBaseSink := ToGstBaseSink(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(sink))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(sink))
iface := subclass.(interface {
GetTimes(self *GstBaseSink, buffer *gst.Buffer) (start, end time.Duration) // should this be a ClockTime?
})
retStart, retEnd = iface.GetTimes(goBaseSink, gst.ToGstBuffer(unsafe.Pointer(buf)))
*start = C.GstClockTime(retStart.Nanoseconds())
*end = C.GstClockTime(retEnd.Nanoseconds())
}
//export goGstBaseSinkPrepare
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSinkPrepare(sink *C.GstBaseSink, buf *C.GstBuffer) C.GstFlowReturn {
var ret gst.FlowReturn
goBaseSink := ToGstBaseSink(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(sink))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(sink))
iface := subclass.(interface {
Prepare(self *GstBaseSink, buffer *gst.Buffer) gst.FlowReturn
})
ret = iface.Prepare(goBaseSink, gst.ToGstBuffer(unsafe.Pointer(buf)))
return C.GstFlowReturn(ret)
}
//export goGstBaseSinkPrepareList
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSinkPrepareList(sink *C.GstBaseSink, list *C.GstBufferList) C.GstFlowReturn {
var ret gst.FlowReturn
goBaseSink := ToGstBaseSink(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(sink))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(sink))
iface := subclass.(interface {
PrepareList(self *GstBaseSink, bufferList *gst.BufferList) gst.FlowReturn
})
ret = iface.PrepareList(goBaseSink, gst.ToGstBufferList(unsafe.Pointer(list)))
return C.GstFlowReturn(ret)
}
//export goGstBaseSinkPreroll
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSinkPreroll(sink *C.GstBaseSink, buf *C.GstBuffer) C.GstFlowReturn {
var ret gst.FlowReturn
goBaseSink := ToGstBaseSink(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(sink))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(sink))
iface := subclass.(interface {
Preroll(self *GstBaseSink, buffer *gst.Buffer) gst.FlowReturn
})
ret = iface.Preroll(goBaseSink, gst.ToGstBuffer(unsafe.Pointer(buf)))
return C.GstFlowReturn(ret)
}
//export goGstBaseSinkProposeAllocation
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSinkProposeAllocation(sink *C.GstBaseSink, query *C.GstQuery) C.gboolean {
var ret bool
goBaseSink := ToGstBaseSink(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(sink))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(sink))
iface := subclass.(interface {
ProposeAllocation(self *GstBaseSink, query *gst.Query) bool
})
ret = iface.ProposeAllocation(goBaseSink, gst.ToGstQuery(unsafe.Pointer(query)))
return gboolean(ret)
}
//export goGstBaseSinkQuery
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSinkQuery(sink *C.GstBaseSink, query *C.GstQuery) C.gboolean {
var ret bool
goBaseSink := ToGstBaseSink(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(sink))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(sink))
iface := subclass.(interface {
Query(self *GstBaseSink, query *gst.Query) bool
})
ret = iface.Query(goBaseSink, gst.ToGstQuery(unsafe.Pointer(query)))
return gboolean(ret)
}
//export goGstBaseSinkRender
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSinkRender(sink *C.GstBaseSink, buf *C.GstBuffer) C.GstFlowReturn {
var ret gst.FlowReturn
goBaseSink := ToGstBaseSink(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(sink))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(sink))
iface := subclass.(interface {
Render(self *GstBaseSink, buffer *gst.Buffer) gst.FlowReturn
})
ret = iface.Render(goBaseSink, gst.ToGstBuffer(unsafe.Pointer(buf)))
return C.GstFlowReturn(ret)
}
//export goGstBaseSinkRenderList
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSinkRenderList(sink *C.GstBaseSink, buf *C.GstBufferList) C.GstFlowReturn {
var ret gst.FlowReturn
goBaseSink := ToGstBaseSink(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(sink))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(sink))
iface := subclass.(interface {
RenderList(self *GstBaseSink, bufferList *gst.BufferList) gst.FlowReturn
})
ret = iface.RenderList(goBaseSink, gst.ToGstBufferList(unsafe.Pointer(buf)))
return C.GstFlowReturn(ret)
}
//export goGstBaseSinkSetCaps
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSinkSetCaps(sink *C.GstBaseSink, caps *C.GstCaps) C.gboolean {
var ret bool
goBaseSink := ToGstBaseSink(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(sink))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(sink))
iface := subclass.(interface {
SetCaps(self *GstBaseSink, caps *gst.Caps) bool
})
ret = iface.SetCaps(goBaseSink, gst.ToGstCaps(unsafe.Pointer(caps)))
return gboolean(ret)
}
//export goGstBaseSinkStart
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSinkStart(sink *C.GstBaseSink) C.gboolean {
var ret bool
goBaseSink := ToGstBaseSink(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(sink))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(sink))
iface := subclass.(interface {
Start(self *GstBaseSink) bool
})
ret = iface.Start(goBaseSink)
return gboolean(ret)
}
//export goGstBaseSinkStop
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSinkStop(sink *C.GstBaseSink) C.gboolean {
var ret bool
goBaseSink := ToGstBaseSink(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(sink))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(sink))
iface := subclass.(interface {
Stop(self *GstBaseSink) bool
})
ret = iface.Stop(goBaseSink)
return gboolean(ret)
}
//export goGstBaseSinkUnlock
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSinkUnlock(sink *C.GstBaseSink) C.gboolean {
var ret bool
goBaseSink := ToGstBaseSink(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(sink))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(sink))
iface := subclass.(interface {
Unlock(self *GstBaseSink) bool
})
ret = iface.Unlock(goBaseSink)
return gboolean(ret)
}
//export goGstBaseSinkUnlockStop
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSinkUnlockStop(sink *C.GstBaseSink) C.gboolean {
var ret bool
goBaseSink := ToGstBaseSink(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(sink))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(sink))
iface := subclass.(interface {
UnlockStop(self *GstBaseSink) bool
})
ret = iface.UnlockStop(goBaseSink)
return gboolean(ret)
}
//export goGstBaseSinkWaitEvent
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSinkWaitEvent(sink *C.GstBaseSink, event *C.GstEvent) C.GstFlowReturn {
var ret gst.FlowReturn
goBaseSink := ToGstBaseSink(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(sink))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(sink))
iface := subclass.(interface {
WaitEvent(self *GstBaseSink, event *gst.Event) gst.FlowReturn
})
ret = iface.WaitEvent(goBaseSink, gst.ToGstEvent(unsafe.Pointer(event)))
return C.GstFlowReturn(ret)
}

View File

@@ -1,251 +0,0 @@
package base
/*
#include "gst.go.h"
extern gboolean goGstBaseSinkActivatePull (GstBaseSink * sink, gboolean active);
extern gboolean goGstBaseSinkEvent (GstBaseSink * sink, GstEvent * event);
extern GstCaps * goGstBaseSinkFixate (GstBaseSink * sink, GstCaps * caps);
extern GstCaps * goGstBaseSinkGetCaps (GstBaseSink * sink, GstCaps * filter);
extern void goGstBaseSinkGetTimes (GstBaseSink * sink, GstBuffer * buffer, GstClockTime * start, GstClockTime * end);
extern GstFlowReturn goGstBaseSinkPrepare (GstBaseSink * sink, GstBuffer * buffer);
extern GstFlowReturn goGstBaseSinkPrepareList (GstBaseSink * sink, GstBufferList * buffer_list);
extern GstFlowReturn goGstBaseSinkPreroll (GstBaseSink * sink, GstBuffer * buffer);
extern gboolean goGstBaseSinkProposeAllocation (GstBaseSink * sink, GstQuery * query);
extern gboolean goGstBaseSinkQuery (GstBaseSink * sink, GstQuery * query);
extern GstFlowReturn goGstBaseSinkRender (GstBaseSink * sink, GstBuffer * buffer);
extern GstFlowReturn goGstBaseSinkRenderList (GstBaseSink * sink, GstBufferList * buffer_list);
extern gboolean goGstBaseSinkSetCaps (GstBaseSink * sink, GstCaps * caps);
extern gboolean goGstBaseSinkStart (GstBaseSink * sink);
extern gboolean goGstBaseSinkStop (GstBaseSink * sink);
extern gboolean goGstBaseSinkUnlock (GstBaseSink * sink);
extern gboolean goGstBaseSinkUnlockStop (GstBaseSink * sink);
extern GstFlowReturn goGstBaseSinkWaitEvent (GstBaseSink * sink, GstEvent * event);
GstFlowReturn do_wait_event (GstBaseSink * sink, GstEvent * event)
{
GObjectClass * this_class = G_OBJECT_GET_CLASS(G_OBJECT(sink));
GstBaseSinkClass * parent = toGstBaseSinkClass(g_type_class_peek_parent(this_class));
GstFlowReturn ret = parent->wait_event(sink, event);
if (ret == GST_FLOW_ERROR)
return ret;
return goGstBaseSinkWaitEvent(sink, event);
}
void setGstBaseSinkActivatePull (GstBaseSinkClass * klass) { klass->activate_pull = goGstBaseSinkActivatePull; }
void setGstBaseSinkEvent (GstBaseSinkClass * klass) { klass->event = goGstBaseSinkEvent; }
void setGstBaseSinkFixate (GstBaseSinkClass * klass) { klass->fixate = goGstBaseSinkFixate; }
void setGstBaseSinkGetCaps (GstBaseSinkClass * klass) { klass->get_caps = goGstBaseSinkGetCaps; }
void setGstBaseSinkGetTimes (GstBaseSinkClass * klass) { klass->get_times = goGstBaseSinkGetTimes; }
void setGstBaseSinkPrepare (GstBaseSinkClass * klass) { klass->prepare = goGstBaseSinkPrepare; }
void setGstBaseSinkPrepareList (GstBaseSinkClass * klass) { klass->prepare_list = goGstBaseSinkPrepareList; }
void setGstBaseSinkPreroll (GstBaseSinkClass * klass) { klass->preroll = goGstBaseSinkPreroll; }
void setGstBaseSinkProposeAllocation (GstBaseSinkClass * klass) { klass->propose_allocation = goGstBaseSinkProposeAllocation; }
void setGstBaseSinkQuery (GstBaseSinkClass * klass) { klass->query = goGstBaseSinkQuery; }
void setGstBaseSinkRender (GstBaseSinkClass * klass) { klass->render = goGstBaseSinkRender; }
void setGstBaseSinkRenderList (GstBaseSinkClass * klass) { klass->render_list = goGstBaseSinkRenderList; }
void setGstBaseSinkSetCaps (GstBaseSinkClass * klass) { klass->set_caps = goGstBaseSinkSetCaps; }
void setGstBaseSinkStart (GstBaseSinkClass * klass) { klass->start = goGstBaseSinkStart; }
void setGstBaseSinkStop (GstBaseSinkClass * klass) { klass->stop = goGstBaseSinkStop; }
void setGstBaseSinkUnlock (GstBaseSinkClass * klass) { klass->unlock = goGstBaseSinkUnlock; }
void setGstBaseSinkUnlockStop (GstBaseSinkClass * klass) { klass->unlock_stop = goGstBaseSinkUnlockStop; }
void setGstBaseSinkWaitEvent (GstBaseSinkClass * klass) { klass->wait_event = do_wait_event; }
*/
import "C"
import (
"time"
"unsafe"
"github.com/go-gst/go-glib/glib"
"github.com/go-gst/go-gst/gst"
)
var (
// ExtendsBaseSink is an Extendable for extending a GstBaseSink
ExtendsBaseSink glib.Extendable = &extendsBaseSink{parent: gst.ExtendsElement}
)
// GstBaseSinkImpl is the documented interface for extending a GstBaseSink. It does not have to
// be implemented in it's entirety. Each of the methods it declares will be checked for their presence
// in the initializing object, and if the object declares an override it will replace the default
// implementation in the virtual methods.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type GstBaseSinkImpl interface {
// Subclasses should override this when they can provide an alternate method of spawning a thread to
// drive the pipeline in pull mode. Should start or stop the pulling thread, depending on the value
// of the "active" argument. Called after actually activating the sink pad in pull mode. The default
// implementation starts a task on the sink pad.
ActivatePull(self *GstBaseSink, active bool) bool
// Override this to handle events arriving on the sink pad
Event(self *GstBaseSink, event *gst.Event) bool
// Only useful in pull mode. Implement if you have ideas about what should be the default values for
// the caps you support.
Fixate(self *GstBaseSink, caps *gst.Caps) *gst.Caps
// Called to get sink pad caps from the subclass
GetCaps(self *GstBaseSink, filter *gst.Caps) *gst.Caps
// Called to get the start and end times for synchronizing the passed buffer to the clock
GetTimes(self *GstBaseSink, buffer *gst.Buffer) (start, end time.Duration) // should this be a ClockTime?
// Called to prepare the buffer for render and preroll. This function is called before synchronization
// is performed.
Prepare(self *GstBaseSink, buffer *gst.Buffer) gst.FlowReturn
// Called to prepare the buffer list for render_list. This function is called before synchronization is
// performed.
PrepareList(self *GstBaseSink, bufferList *gst.BufferList) gst.FlowReturn
// Called to present the preroll buffer if desired.
Preroll(self *GstBaseSink, buffer *gst.Buffer) gst.FlowReturn
// Used to configure the allocation query
ProposeAllocation(self *GstBaseSink, query *gst.Query) bool
// Handle queries on the element
Query(self *GstBaseSink, query *gst.Query) bool
// Called when a buffer should be presented or output, at the correct moment if the GstBaseSink has been
// set to sync to the clock.
Render(self *GstBaseSink, buffer *gst.Buffer) gst.FlowReturn
// Same as render but used with buffer lists instead of buffers.
RenderList(self *GstBaseSink, bufferList *gst.BufferList) gst.FlowReturn
// Notify subclass of changed caps
SetCaps(self *GstBaseSink, caps *gst.Caps) bool
// Start processing. Ideal for opening resources in the subclass
Start(self *GstBaseSink) bool
// Stop processing. Subclasses should use this to close resources.
Stop(self *GstBaseSink) bool
// Unlock any pending access to the resource. Subclasses should unblock any blocked function ASAP and call
// WaitPreroll
Unlock(self *GstBaseSink) bool
// Clear the previous unlock request. Subclasses should clear any state they set during Unlock(), and be ready
// to continue where they left off after WaitPreroll, Wait or WaitClock return or Render() is called again.
UnlockStop(self *GstBaseSink) bool
// Override this to implement custom logic to wait for the event time (for events like EOS and GAP). The bindings
// take care of first chaining up to the parent class.
WaitEvent(self *GstBaseSink, event *gst.Event) gst.FlowReturn
}
type extendsBaseSink struct{ parent glib.Extendable }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *extendsBaseSink) Type() glib.Type { return glib.Type(C.gst_base_sink_get_type()) }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *extendsBaseSink) ClassSize() int64 { return int64(C.sizeof_GstBaseSinkClass) }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *extendsBaseSink) InstanceSize() int64 { return int64(C.sizeof_GstBaseSink) }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *extendsBaseSink) InitClass(klass unsafe.Pointer, elem glib.GoObjectSubclass) {
e.parent.InitClass(klass, elem)
sinkClass := C.toGstBaseSinkClass(klass)
if _, ok := elem.(interface {
ActivatePull(self *GstBaseSink, active bool) bool
}); ok {
C.setGstBaseSinkActivatePull(sinkClass)
}
if _, ok := elem.(interface {
Event(self *GstBaseSink, event *gst.Event) bool
}); ok {
C.setGstBaseSinkEvent(sinkClass)
}
if _, ok := elem.(interface {
Fixate(self *GstBaseSink, caps *gst.Caps) *gst.Caps
}); ok {
C.setGstBaseSinkFixate(sinkClass)
}
if _, ok := elem.(interface {
GetCaps(self *GstBaseSink, filter *gst.Caps) *gst.Caps
}); ok {
C.setGstBaseSinkGetCaps(sinkClass)
}
if _, ok := elem.(interface {
GetTimes(self *GstBaseSink, buffer *gst.Buffer) (start, end time.Duration) // should this be a ClockTime?
}); ok {
C.setGstBaseSinkGetTimes(sinkClass)
}
if _, ok := elem.(interface {
Prepare(self *GstBaseSink, buffer *gst.Buffer) gst.FlowReturn
}); ok {
C.setGstBaseSinkPrepare(sinkClass)
}
if _, ok := elem.(interface {
PrepareList(self *GstBaseSink, bufferList *gst.BufferList) gst.FlowReturn
}); ok {
C.setGstBaseSinkPrepareList(sinkClass)
}
if _, ok := elem.(interface {
Preroll(self *GstBaseSink, buffer *gst.Buffer) gst.FlowReturn
}); ok {
C.setGstBaseSinkPreroll(sinkClass)
}
if _, ok := elem.(interface {
ProposeAllocation(self *GstBaseSink, query *gst.Query) bool
}); ok {
C.setGstBaseSinkProposeAllocation(sinkClass)
}
if _, ok := elem.(interface {
Query(self *GstBaseSink, query *gst.Query) bool
}); ok {
C.setGstBaseSinkQuery(sinkClass)
}
if _, ok := elem.(interface {
Render(self *GstBaseSink, buffer *gst.Buffer) gst.FlowReturn
}); ok {
C.setGstBaseSinkRender(sinkClass)
}
if _, ok := elem.(interface {
RenderList(self *GstBaseSink, bufferList *gst.BufferList) gst.FlowReturn
}); ok {
C.setGstBaseSinkRenderList(sinkClass)
}
if _, ok := elem.(interface {
SetCaps(self *GstBaseSink, caps *gst.Caps) bool
}); ok {
C.setGstBaseSinkSetCaps(sinkClass)
}
if _, ok := elem.(interface {
Start(self *GstBaseSink) bool
}); ok {
C.setGstBaseSinkStart(sinkClass)
}
if _, ok := elem.(interface {
Stop(self *GstBaseSink) bool
}); ok {
C.setGstBaseSinkStop(sinkClass)
}
if _, ok := elem.(interface {
Unlock(self *GstBaseSink) bool
}); ok {
C.setGstBaseSinkUnlock(sinkClass)
}
if _, ok := elem.(interface {
UnlockStop(self *GstBaseSink) bool
}); ok {
C.setGstBaseSinkUnlockStop(sinkClass)
}
if _, ok := elem.(interface {
WaitEvent(self *GstBaseSink, event *gst.Event) gst.FlowReturn
}); ok {
C.setGstBaseSinkWaitEvent(sinkClass)
}
}

View File

@@ -1,242 +0,0 @@
package base
/*
#include "gst.go.h"
*/
import "C"
import (
"unsafe"
"github.com/go-gst/go-glib/glib"
"github.com/go-gst/go-gst/gst"
)
// GstBaseSrc represents a GstBaseSrc.
type GstBaseSrc struct{ *gst.Element }
// ToGstBaseSrc returns a GstBaseSrc object for the given object. It will work on either gst.Object
// or glib.Object interfaces.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func ToGstBaseSrc(obj interface{}) *GstBaseSrc {
switch obj := obj.(type) {
case *gst.Object:
return &GstBaseSrc{&gst.Element{Object: obj}}
case *glib.Object:
return &GstBaseSrc{&gst.Element{Object: &gst.Object{InitiallyUnowned: &glib.InitiallyUnowned{Object: obj}}}}
}
return nil
}
// Instance returns the underlying C GstBaseSrc instance
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSrc) Instance() *C.GstBaseSrc {
return C.toGstBaseSrc(g.Unsafe())
}
// GetAllocator retrieves the memory allocator used by this base src.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSrc) GetAllocator() (*gst.Allocator, *gst.AllocationParams) {
var allocParams C.GstAllocationParams
var allocator *C.GstAllocator
C.gst_base_src_get_allocator(g.Instance(), &allocator, &allocParams)
if allocator == nil {
return nil, nil
}
return gst.FromGstAllocatorUnsafeFull(unsafe.Pointer(allocator)), gst.FromGstAllocationParamsUnsafe(unsafe.Pointer(&allocParams))
}
// GetBlocksize returns the number of bytes that the source will push out with each buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSrc) GetBlocksize() uint { return uint(C.gst_base_src_get_blocksize(g.Instance())) }
// GetBufferPool returns the BufferPool used by this source.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSrc) GetBufferPool() *gst.BufferPool {
pool := C.gst_base_src_get_buffer_pool(g.Instance())
if pool == nil {
return nil
}
return gst.FromGstBufferPoolUnsafeFull(unsafe.Pointer(pool))
}
// DoTimestamp will query if the timestamps outgoing on this source's buffers are based on the current
// running time.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSrc) DoTimestamp() bool {
return gobool(C.gst_base_src_get_do_timestamp(g.Instance()))
}
// IsAsync retrieves the current async behavior of the source.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSrc) IsAsync() bool { return gobool(C.gst_base_src_is_async(g.Instance())) }
// IsLive checks if this source is in live mode.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSrc) IsLive() bool { return gobool(C.gst_base_src_is_live(g.Instance())) }
// SINCE 1.18
// // Negotiate negotiates this source's pad caps with downstream elements. Do not call this in the Fill()
// // vmethod. Call this in Create() or in Alloc(), before any buffer is allocated.
// func (g *GstBaseSrc) Negotiate() bool { return gobool(C.gst_base_src_negotiate(g.Instance())) }
// // NewSegment prepares a new segment for emission downstream. This function must only be called by derived
// // sub-classes, and only from the create function, as the stream-lock needs to be held.
// //
// // The format for the segment must be identical with the current format of the source, as configured with
// // SetFormat.
// //
// // The format of src must not be gst.FormatUndefined and the format should be configured via SetFormat before
// // calling this method.
// func (g *GstBaseSrc) NewSegment(segment *gst.Segment) bool {
// return gobool(C.gst_base_src_new_segment(g.Instance(), (*C.GstSegment)(unsafe.Pointer(segment.Instance()))))
// }
// QueryLatency queries the source for the latency parameters. live will be TRUE when src is configured as a
// live source. minLatency and maxLatency will be set to the difference between the running time and the timestamp
// of the first buffer.
//
// This function is mostly used by subclasses.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSrc) QueryLatency() (ok, live bool, minLatency, maxLatency gst.ClockTime) {
var glive C.gboolean
var gmin C.GstClockTime
var gmax C.GstClockTime
gok := C.gst_base_src_query_latency(g.Instance(), &glive, &gmin, &gmax)
return gobool(gok), gobool(glive), gst.ClockTime(gmin), gst.ClockTime(gmax)
}
// SetAsync configures async behavior in src, no state change will block. The open, close, start, stop, play and
// pause virtual methods will be executed in a different thread and are thus allowed to perform blocking operations.
// Any blocking operation should be unblocked with the unlock vmethod.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSrc) SetAsync(async bool) { C.gst_base_src_set_async(g.Instance(), gboolean(async)) }
// SetAutomaticEOS sets whether EOS should be automatically emitted.
//
// If automaticEOS is TRUE, src will automatically go EOS if a buffer after the total size is returned. By default
// this is TRUE but sources that can't return an authoritative size and only know that they're EOS when trying to
// read more should set this to FALSE.
//
// When src operates in gst.FormatTime, GstBaseSrc will send an EOS when a buffer outside of the currently configured
// segment is pushed if automaticEOS is TRUE. Since 1.16, if automatic_eos is FALSE an EOS will be pushed only when
// the Create() implementation returns gst.FlowEOS.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSrc) SetAutomaticEOS(automaticEOS bool) {
C.gst_base_src_set_automatic_eos(g.Instance(), gboolean(automaticEOS))
}
// SetBlocksize sets the number of bytes that src will push out with each buffer. When blocksize is set to -1, a
// default length will be used.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSrc) SetBlocksize(size uint) {
C.gst_base_src_set_blocksize(g.Instance(), C.guint(size))
}
// SetCaps sets new caps on the source pad.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSrc) SetCaps(caps *gst.Caps) bool {
return gobool(C.gst_base_src_set_caps(g.Instance(), (*C.GstCaps)(unsafe.Pointer(caps.Instance()))))
}
// SetDoTimestamp configures src to automatically timestamp outgoing buffers based on the current running_time of the pipeline.
// This property is mostly useful for live sources.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSrc) SetDoTimestamp(doTimestamp bool) {
C.gst_base_src_set_do_timestamp(g.Instance(), gboolean(doTimestamp))
}
// SetDynamicSize sets if the size is dynamic for this source.
//
// If not dynamic, size is only updated when needed, such as when trying to read past current tracked size. Otherwise, size is
// checked for upon each read.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSrc) SetDynamicSize(dynamic bool) {
C.gst_base_src_set_dynamic_size(g.Instance(), gboolean(dynamic))
}
// SetFormat sets the default format of the source. This will be the format used for sending
// SEGMENT events and for performing seeks.
//
// If a format of gst.FormatBytes is set, the element will be able to operate in pull mode if the
// IsSeekable returns TRUE.
//
// This function must only be called in when the element is paused.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSrc) SetFormat(format gst.Format) {
C.gst_base_src_set_format(g.Instance(), C.GstFormat(format))
}
// SetLive sets if the element listens to a live source.
//
// A live source will not produce data in the PAUSED state and will therefore not be able to participate in the
// PREROLL phase of a pipeline. To signal this fact to the application and the pipeline, the state change return
// value of the live source will be gst.StateChangeNoPreroll.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSrc) SetLive(live bool) { C.gst_base_src_set_live(g.Instance(), gboolean(live)) }
// StartComplete completes an asynchronous start operation. When the subclass overrides the start method,
// it should call StartComplete when the start operation completes either from the same thread or from an
// asynchronous helper thread.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSrc) StartComplete(ret gst.FlowReturn) {
C.gst_base_src_start_complete(g.Instance(), C.GstFlowReturn(ret))
}
// StartWait waits until the start operation is complete.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSrc) StartWait() gst.FlowReturn {
return gst.FlowReturn(C.gst_base_src_start_wait(g.Instance()))
}
// SubmitBufferList submits a list of buffers to the source.
//
// Subclasses can call this from their create virtual method implementation to submit a buffer list to be pushed out
// later. This is useful in cases where the create function wants to produce multiple buffers to be pushed out in one
// go in form of a GstBufferList, which can reduce overhead drastically, especially for packetised inputs (for data
// streams where the packetisation/chunking is not important it is usually more efficient to return larger buffers instead).
//
// Subclasses that use this function from their create function must return GST_FLOW_OK and no buffer from their create
// virtual method implementation. If a buffer is returned after a buffer list has also been submitted via this function the
// behavior is undefined.
//
// Subclasses must only call this function once per create function call and subclasses must only call this function when
// the source operates in push mode.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSrc) SubmitBufferList(bufferList *gst.BufferList) {
C.gst_base_src_submit_buffer_list(g.Instance(), (*C.GstBufferList)(unsafe.Pointer(bufferList.Instance())))
}
// WaitPlaying will block until a state change to PLAYING happens (in which case this function returns gst.FlowOK) or the
// processing must be stopped due to a state change to READY or a FLUSH event (in which case this function returns GST_FLOW_FLUSHING).
//
// If the Create() method performs its own synchronization against the clock it must unblock when going from PLAYING to the PAUSED
// state and call this method before continuing to produce the remaining data.
//
// gst.FlowOK will be returned if the source is PLAYING and processing can continue. Any other return value should be
// returned from the Create() vmethod.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseSrc) WaitPlaying() gst.FlowReturn {
return gst.FlowReturn(C.gst_base_src_wait_playing(g.Instance()))
}

View File

@@ -1,336 +0,0 @@
package base
//#include "gst.go.h"
import "C"
import (
"time"
"unsafe"
"github.com/go-gst/go-glib/glib"
"github.com/go-gst/go-gst/gst"
)
//export goGstBaseSrcGetCaps
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSrcGetCaps(src *C.GstBaseSrc, filter *C.GstCaps) *C.GstCaps {
var caps *gst.Caps
goBaseSrc := ToGstBaseSrc(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(src))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(src))
iface := subclass.(interface {
GetCaps(*GstBaseSrc, *gst.Caps) *gst.Caps
})
caps = iface.GetCaps(goBaseSrc, gst.ToGstCaps(unsafe.Pointer(filter)))
if caps == nil {
return nil
}
return (*C.GstCaps)(unsafe.Pointer(caps.Instance()))
}
//export goGstBaseSrcNegotiate
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSrcNegotiate(src *C.GstBaseSrc) C.gboolean {
var ret bool
goBaseSrc := ToGstBaseSrc(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(src))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(src))
iface := subclass.(interface {
Negotiate(*GstBaseSrc) bool
})
ret = iface.Negotiate(goBaseSrc)
return gboolean(ret)
}
//export goGstBaseSrcFixate
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSrcFixate(src *C.GstBaseSrc, filter *C.GstCaps) *C.GstCaps {
var caps *gst.Caps
goBaseSrc := ToGstBaseSrc(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(src))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(src))
iface := subclass.(interface {
Fixate(*GstBaseSrc, *gst.Caps) *gst.Caps
})
caps = iface.Fixate(goBaseSrc, gst.ToGstCaps(unsafe.Pointer(filter)))
if caps == nil {
return nil
}
return (*C.GstCaps)(unsafe.Pointer(caps.Instance()))
}
//export goGstBaseSrcSetCaps
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSrcSetCaps(src *C.GstBaseSrc, caps *C.GstCaps) C.gboolean {
var ret bool
goBaseSrc := ToGstBaseSrc(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(src))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(src))
iface := subclass.(interface {
SetCaps(*GstBaseSrc, *gst.Caps) bool
})
ret = iface.SetCaps(goBaseSrc, gst.ToGstCaps(unsafe.Pointer(caps)))
return gboolean(ret)
}
//export goGstBaseSrcDecideAllocation
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSrcDecideAllocation(src *C.GstBaseSrc, query *C.GstQuery) C.gboolean {
var ret bool
goBaseSrc := ToGstBaseSrc(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(src))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(src))
iface := subclass.(interface {
DecideAllocation(*GstBaseSrc, *gst.Query) bool
})
ret = iface.DecideAllocation(goBaseSrc, gst.ToGstQuery(unsafe.Pointer(query)))
return gboolean(ret)
}
//export goGstBaseSrcStart
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSrcStart(src *C.GstBaseSrc) C.gboolean {
var ret bool
goBaseSrc := ToGstBaseSrc(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(src))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(src))
iface := subclass.(interface {
Start(*GstBaseSrc) bool
})
ret = iface.Start(goBaseSrc)
return gboolean(ret)
}
//export goGstBaseSrcStop
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSrcStop(src *C.GstBaseSrc) C.gboolean {
var ret bool
goBaseSrc := ToGstBaseSrc(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(src))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(src))
iface := subclass.(interface {
Stop(*GstBaseSrc) bool
})
ret = iface.Stop(goBaseSrc)
return gboolean(ret)
}
//export goGstBaseSrcGetTimes
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSrcGetTimes(src *C.GstBaseSrc, buf *C.GstBuffer, start *C.GstClockTime, end *C.GstClockTime) {
var gostart, goend time.Duration
goBaseSrc := ToGstBaseSrc(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(src))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(src))
iface := subclass.(interface {
GetTimes(*GstBaseSrc, *gst.Buffer) (start, end time.Duration) // should this be a ClockTime?
})
gostart, goend = iface.GetTimes(goBaseSrc, gst.ToGstBuffer(unsafe.Pointer(buf)))
*start = C.GstClockTime(gostart.Nanoseconds())
*end = C.GstClockTime(goend.Nanoseconds())
}
//export goGstBaseSrcGetSize
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSrcGetSize(src *C.GstBaseSrc, size *C.guint64) C.gboolean {
var gosize int64
var ok bool
goBaseSrc := ToGstBaseSrc(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(src))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(src))
iface := subclass.(interface {
GetSize(*GstBaseSrc) (bool, int64)
})
ok, gosize = iface.GetSize(goBaseSrc)
if ok {
*size = C.guint64(gosize)
}
return gboolean(ok)
}
//export goGstBaseSrcIsSeekable
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSrcIsSeekable(src *C.GstBaseSrc) C.gboolean {
var ok bool
goBaseSrc := ToGstBaseSrc(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(src))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(src))
iface := subclass.(interface {
IsSeekable(*GstBaseSrc) bool
})
ok = iface.IsSeekable(goBaseSrc)
return gboolean(ok)
}
//export goGstBaseSrcPrepareSeekSegment
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSrcPrepareSeekSegment(src *C.GstBaseSrc, seek *C.GstEvent, segment *C.GstSegment) C.gboolean {
var ok bool
goBaseSrc := ToGstBaseSrc(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(src))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(src))
iface := subclass.(interface {
PrepareSeekSegment(*GstBaseSrc, *gst.Event, *gst.Segment) bool
})
ok = iface.PrepareSeekSegment(goBaseSrc, gst.ToGstEvent(unsafe.Pointer(seek)), gst.FromGstSegmentUnsafe(unsafe.Pointer(segment)))
return gboolean(ok)
}
//export goGstBaseSrcDoSeek
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSrcDoSeek(src *C.GstBaseSrc, segment *C.GstSegment) C.gboolean {
var ok bool
goBaseSrc := ToGstBaseSrc(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(src))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(src))
iface := subclass.(interface {
DoSeek(*GstBaseSrc, *gst.Segment) bool
})
ok = iface.DoSeek(goBaseSrc, gst.ToGstSegment(unsafe.Pointer(segment)))
return gboolean(ok)
}
//export goGstBaseSrcUnlock
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSrcUnlock(src *C.GstBaseSrc) C.gboolean {
var ok bool
goBaseSrc := ToGstBaseSrc(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(src))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(src))
iface := subclass.(interface {
Unlock(*GstBaseSrc) bool
})
ok = iface.Unlock(goBaseSrc)
return gboolean(ok)
}
//export goGstBaseSrcUnlockStop
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSrcUnlockStop(src *C.GstBaseSrc) C.gboolean {
var ok bool
goBaseSrc := ToGstBaseSrc(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(src))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(src))
iface := subclass.(interface {
UnlockStop(*GstBaseSrc) bool
})
ok = iface.UnlockStop(goBaseSrc)
return gboolean(ok)
}
//export goGstBaseSrcQuery
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSrcQuery(src *C.GstBaseSrc, query *C.GstQuery) C.gboolean {
var ok bool
goBaseSrc := ToGstBaseSrc(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(src))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(src))
iface := subclass.(interface {
Query(*GstBaseSrc, *gst.Query) bool
})
ok = iface.Query(goBaseSrc, gst.ToGstQuery(unsafe.Pointer(query)))
return gboolean(ok)
}
//export goGstBaseSrcEvent
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSrcEvent(src *C.GstBaseSrc, event *C.GstEvent) C.gboolean {
var ok bool
goBaseSrc := ToGstBaseSrc(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(src))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(src))
iface := subclass.(interface {
Event(*GstBaseSrc, *gst.Event) bool
})
ok = iface.Event(goBaseSrc, gst.ToGstEvent(unsafe.Pointer(event)))
return gboolean(ok)
}
//export goGstBaseSrcCreate
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSrcCreate(src *C.GstBaseSrc, offset C.guint64, size C.guint, buf **C.GstBuffer) C.GstFlowReturn {
var ret gst.FlowReturn
var gobuf *gst.Buffer
goBaseSrc := ToGstBaseSrc(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(src))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(src))
iface := subclass.(interface {
Create(*GstBaseSrc, uint64, uint) (gst.FlowReturn, *gst.Buffer)
})
ret, gobuf = iface.Create(goBaseSrc, uint64(offset), uint(size))
if ret == gst.FlowOK {
C.memcpy(unsafe.Pointer(*buf), unsafe.Pointer(gobuf.Instance()), C.sizeof_GstBuffer)
}
return C.GstFlowReturn(ret)
}
//export goGstBaseSrcAlloc
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSrcAlloc(src *C.GstBaseSrc, offset C.guint64, size C.guint, buf **C.GstBuffer) C.GstFlowReturn {
var ret gst.FlowReturn
var gobuf *gst.Buffer
goBaseSrc := ToGstBaseSrc(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(src))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(src))
iface := subclass.(interface {
Alloc(*GstBaseSrc, uint64, uint) (gst.FlowReturn, *gst.Buffer)
})
ret, gobuf = iface.Alloc(goBaseSrc, uint64(offset), uint(size))
if ret == gst.FlowOK {
C.memcpy(unsafe.Pointer(*buf), unsafe.Pointer(gobuf.Instance()), C.sizeof_GstBuffer)
}
return C.GstFlowReturn(ret)
}
//export goGstBaseSrcFill
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseSrcFill(src *C.GstBaseSrc, offset C.guint64, size C.guint, buf *C.GstBuffer) C.GstFlowReturn {
var ret gst.FlowReturn
goBaseSrc := ToGstBaseSrc(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(src))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(src))
iface := subclass.(interface {
Fill(*GstBaseSrc, uint64, uint, *gst.Buffer) gst.FlowReturn
})
ret = iface.Fill(goBaseSrc, uint64(offset), uint(size), gst.ToGstBuffer(unsafe.Pointer(buf)))
return C.GstFlowReturn(ret)
}

View File

@@ -1,249 +0,0 @@
package base
/*
#include "gst.go.h"
extern GstCaps * goGstBaseSrcGetCaps (GstBaseSrc * src, GstCaps * caps);
extern gboolean goGstBaseSrcNegotiate (GstBaseSrc * src);
extern GstCaps * goGstBaseSrcFixate (GstBaseSrc * src, GstCaps * caps);
extern gboolean goGstBaseSrcSetCaps (GstBaseSrc * src, GstCaps * filter);
extern gboolean goGstBaseSrcDecideAllocation (GstBaseSrc * src, GstQuery * query);
extern gboolean goGstBaseSrcStart (GstBaseSrc * src);
extern gboolean goGstBaseSrcStop (GstBaseSrc * src);
extern void goGstBaseSrcGetTimes (GstBaseSrc * src, GstBuffer * buffer, GstClockTime * start, GstClockTime * end);
extern gboolean goGstBaseSrcGetSize (GstBaseSrc * src, guint64 * size);
extern gboolean goGstBaseSrcIsSeekable (GstBaseSrc * src);
extern gboolean goGstBaseSrcPrepareSeekSegment (GstBaseSrc * src, GstEvent * seek, GstSegment * segment);
extern gboolean goGstBaseSrcDoSeek (GstBaseSrc * src, GstSegment * segment);
extern gboolean goGstBaseSrcUnlock (GstBaseSrc * src);
extern gboolean goGstBaseSrcUnlockStop (GstBaseSrc * src);
extern gboolean goGstBaseSrcQuery (GstBaseSrc * src, GstQuery * query);
extern gboolean goGstBaseSrcEvent (GstBaseSrc * src, GstEvent * event);
extern GstFlowReturn goGstBaseSrcCreate (GstBaseSrc * src, guint64 offset, guint size, GstBuffer ** buffer);
extern GstFlowReturn goGstBaseSrcAlloc (GstBaseSrc * src, guint64 offset, guint size, GstBuffer ** buffer);
extern GstFlowReturn goGstBaseSrcFill (GstBaseSrc * src, guint64 offset, guint size, GstBuffer * buffer);
void setGstBaseSrcGetCaps (GstBaseSrcClass * klass) { klass->get_caps = goGstBaseSrcGetCaps; }
void setGstBaseSrcNegotiate (GstBaseSrcClass * klass) { klass->negotiate = goGstBaseSrcNegotiate; }
void setGstBaseSrcFixate (GstBaseSrcClass * klass) { klass->fixate = goGstBaseSrcFixate; }
void setGstBaseSrcSetCaps (GstBaseSrcClass * klass) { klass->set_caps = goGstBaseSrcSetCaps; }
void setGstBaseSrcDecideAllocation (GstBaseSrcClass * klass) { klass->decide_allocation = goGstBaseSrcDecideAllocation; }
void setGstBaseSrcStart (GstBaseSrcClass * klass) { klass->start = goGstBaseSrcStart; }
void setGstBaseSrcStop (GstBaseSrcClass * klass) { klass->stop = goGstBaseSrcStop; }
void setGstBaseSrcGetTimes (GstBaseSrcClass * klass) { klass->get_times = goGstBaseSrcGetTimes; }
void setGstBaseSrcGetSize (GstBaseSrcClass * klass) { klass->get_size = goGstBaseSrcGetSize; }
void setGstBaseSrcIsSeekable (GstBaseSrcClass * klass) { klass->is_seekable = goGstBaseSrcIsSeekable; }
void setGstBaseSrcPrepareSeekSegment (GstBaseSrcClass * klass) { klass->prepare_seek_segment = goGstBaseSrcPrepareSeekSegment; }
void setGstBaseSrcDoSeek (GstBaseSrcClass * klass) { klass->do_seek = goGstBaseSrcDoSeek; }
void setGstBaseSrcUnlock (GstBaseSrcClass * klass) { klass->unlock = goGstBaseSrcUnlock; }
void setGstBaseSrcUnlockStop (GstBaseSrcClass * klass) { klass->unlock_stop = goGstBaseSrcUnlockStop; }
void setGstBaseSrcQuery (GstBaseSrcClass * klass) { klass->query = goGstBaseSrcQuery; }
void setGstBaseSrcEvent (GstBaseSrcClass * klass) { klass->event = goGstBaseSrcEvent; }
void setGstBaseSrcCreate (GstBaseSrcClass * klass) { klass->create = goGstBaseSrcCreate; }
void setGstBaseSrcAlloc (GstBaseSrcClass * klass) { klass->alloc = goGstBaseSrcAlloc; }
void setGstBaseSrcFill (GstBaseSrcClass * klass) { klass->fill = goGstBaseSrcFill; }
*/
import "C"
import (
"time"
"unsafe"
"github.com/go-gst/go-glib/glib"
"github.com/go-gst/go-gst/gst"
)
var (
// ExtendsBaseSrc is an Extendable for extending a GstBaseSrc
ExtendsBaseSrc glib.Extendable = &extendsBaseSrc{parent: gst.ExtendsElement}
)
// GstBaseSrcImpl is the documented interface for an element extending a GstBaseSrc. It does not have to
// be implemented in it's entirety. Each of the methods it declares will be checked for their presence
// in the initializing object, and if the object declares an override it will replace the default
// implementation in the virtual methods.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type GstBaseSrcImpl interface {
// GetCaps retrieves the caps for this class.
GetCaps(*GstBaseSrc, *gst.Caps) *gst.Caps
// Negotiate decides on the caps for this source.
Negotiate(*GstBaseSrc) bool
// Fixate is called if, during negotiation, caps need fixating.
Fixate(*GstBaseSrc, *gst.Caps) *gst.Caps
// SetCaps is used to notify this class of new caps.
SetCaps(*GstBaseSrc, *gst.Caps) bool
// DecideAllocation sets up an allocation query.
DecideAllocation(*GstBaseSrc, *gst.Query) bool
// Start the source, ideal for opening resources.
Start(*GstBaseSrc) bool
// Stop the source, ideal for closing resources.
Stop(*GstBaseSrc) bool
// GetTimes should, given a buffer, return start and stop time when it should be pushed.
// The base class will sync on the clock using these times.
GetTimes(*GstBaseSrc, *gst.Buffer) (start, end time.Duration) // should this be a ClockTime?
// GetSize should get the total size of the resource in bytes.
GetSize(*GstBaseSrc) (bool, int64)
// IsSeekable should check if the resource is seekable.
IsSeekable(*GstBaseSrc) bool
// PrepareSeekSegment prepares the segment on which to perform DoSeek, converting to the
// current basesrc format.
PrepareSeekSegment(*GstBaseSrc, *gst.Event, *gst.Segment) bool
// DoSeek is used to notify subclasses of a seek.
DoSeek(*GstBaseSrc, *gst.Segment) bool
// Unlock should unlock any pending access to the resource. Subclasses should perform the unlock
// ASAP.
Unlock(*GstBaseSrc) bool
// UnlockStop should clear any pending unlock request, as we succeeded in unlocking.
UnlockStop(*GstBaseSrc) bool
// Query is used to notify subclasses of a query.
Query(*GstBaseSrc, *gst.Query) bool
// Event is used to notify subclasses of an event.
Event(*GstBaseSrc, *gst.Event) bool
// Create asks the subclass to create a buffer with offset and size. The default implementation
// will call alloc and fill.
Create(self *GstBaseSrc, offset uint64, size uint) (gst.FlowReturn, *gst.Buffer)
// Alloc asks the subclass to allocate an output buffer. The default implementation will use the negotiated
// allocator.
Alloc(self *GstBaseSrc, offset uint64, size uint) (gst.FlowReturn, *gst.Buffer)
// Fill asks the subclass to fill the buffer with data from offset and size.
Fill(self *GstBaseSrc, offset uint64, size uint, buffer *gst.Buffer) gst.FlowReturn
}
type extendsBaseSrc struct{ parent glib.Extendable }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *extendsBaseSrc) Type() glib.Type { return glib.Type(C.gst_base_src_get_type()) }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *extendsBaseSrc) ClassSize() int64 { return int64(C.sizeof_GstBaseSrcClass) }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *extendsBaseSrc) InstanceSize() int64 { return int64(C.sizeof_GstBaseSrc) }
// InitClass iterates the methods provided by the element and overrides any provided
// in the virtual methods.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *extendsBaseSrc) InitClass(klass unsafe.Pointer, elem glib.GoObjectSubclass) {
e.parent.InitClass(klass, elem)
class := C.toGstBaseSrcClass(klass)
if _, ok := elem.(interface {
GetCaps(*GstBaseSrc, *gst.Caps) *gst.Caps
}); ok {
C.setGstBaseSrcGetCaps(class)
}
if _, ok := elem.(interface {
Negotiate(*GstBaseSrc) bool
}); ok {
C.setGstBaseSrcNegotiate(class)
}
if _, ok := elem.(interface {
Fixate(*GstBaseSrc, *gst.Caps) *gst.Caps
}); ok {
C.setGstBaseSrcFixate(class)
}
if _, ok := elem.(interface {
SetCaps(*GstBaseSrc, *gst.Caps) bool
}); ok {
C.setGstBaseSrcSetCaps(class)
}
if _, ok := elem.(interface {
DecideAllocation(*GstBaseSrc, *gst.Query) bool
}); ok {
C.setGstBaseSrcDecideAllocation(class)
}
if _, ok := elem.(interface {
Start(*GstBaseSrc) bool
}); ok {
C.setGstBaseSrcStart(class)
}
if _, ok := elem.(interface {
Stop(*GstBaseSrc) bool
}); ok {
C.setGstBaseSrcStop(class)
}
if _, ok := elem.(interface {
GetTimes(*GstBaseSrc, *gst.Buffer) (start, end time.Duration) // should this be a ClockTime?
}); ok {
C.setGstBaseSrcGetTimes(class)
}
if _, ok := elem.(interface {
GetSize(*GstBaseSrc) (bool, int64)
}); ok {
C.setGstBaseSrcGetSize(class)
}
if _, ok := elem.(interface {
IsSeekable(*GstBaseSrc) bool
}); ok {
C.setGstBaseSrcIsSeekable(class)
}
if _, ok := elem.(interface {
PrepareSeekSegment(*GstBaseSrc, *gst.Event, *gst.Segment) bool
}); ok {
C.setGstBaseSrcPrepareSeekSegment(class)
}
if _, ok := elem.(interface {
DoSeek(*GstBaseSrc, *gst.Segment) bool
}); ok {
C.setGstBaseSrcDoSeek(class)
}
if _, ok := elem.(interface {
Unlock(*GstBaseSrc) bool
}); ok {
C.setGstBaseSrcUnlock(class)
}
if _, ok := elem.(interface {
UnlockStop(*GstBaseSrc) bool
}); ok {
C.setGstBaseSrcUnlockStop(class)
}
if _, ok := elem.(interface {
Query(*GstBaseSrc, *gst.Query) bool
}); ok {
C.setGstBaseSrcQuery(class)
}
if _, ok := elem.(interface {
Event(*GstBaseSrc, *gst.Event) bool
}); ok {
C.setGstBaseSrcEvent(class)
}
if _, ok := elem.(interface {
Create(self *GstBaseSrc, offset uint64, size uint) (gst.FlowReturn, *gst.Buffer)
}); ok {
C.setGstBaseSrcCreate(class)
}
if _, ok := elem.(interface {
Alloc(self *GstBaseSrc, offset uint64, size uint) (gst.FlowReturn, *gst.Buffer)
}); ok {
C.setGstBaseSrcAlloc(class)
}
if _, ok := elem.(interface {
Fill(self *GstBaseSrc, offset uint64, size uint, buffer *gst.Buffer) gst.FlowReturn
}); ok {
C.setGstBaseSrcFill(class)
}
}

View File

@@ -1,390 +0,0 @@
package base
/*
#include "gst.go.h"
void
setGstBaseTransformPassthroughOnSameCaps (GstBaseTransform * obj, gboolean enabled)
{
GObjectClass * this_class = G_OBJECT_GET_CLASS(G_OBJECT(obj));
GstBaseTransformClass * klass = toGstBaseTransformClass(g_type_class_peek_parent(this_class));
klass->passthrough_on_same_caps = enabled;
}
void
setGstBaseTransformTransformIPOnPassthrough (GstBaseTransform * obj, gboolean enabled)
{
GObjectClass * this_class = G_OBJECT_GET_CLASS(G_OBJECT(obj));
GstBaseTransformClass * klass = toGstBaseTransformClass(g_type_class_peek_parent(this_class));
klass->transform_ip_on_passthrough = enabled;
}
gboolean
gstBaseTransformParentSrcEvent (GstBaseTransform * obj, GstEvent * event)
{
GObjectClass * this_class = G_OBJECT_GET_CLASS(G_OBJECT(obj));
GstBaseTransformClass * parent = toGstBaseTransformClass(g_type_class_peek_parent(this_class));
return parent->src_event(obj, event);
}
gboolean
gstBaseTransformParentSinkEvent (GstBaseTransform * obj, GstEvent * event)
{
GObjectClass * this_class = G_OBJECT_GET_CLASS(G_OBJECT(obj));
GstBaseTransformClass * parent = toGstBaseTransformClass(g_type_class_peek_parent(this_class));
return parent->sink_event(obj, event);
}
*/
import "C"
import (
"unsafe"
"github.com/go-gst/go-glib/glib"
"github.com/go-gst/go-gst/gst"
)
// GstBaseTransformFlowDropped is a GstFlowReturn that can be returned from Transform() and TransformIP()
// to indicate that no output buffer was generated.
const GstBaseTransformFlowDropped gst.FlowReturn = C.GST_BASE_TRANSFORM_FLOW_DROPPED
// GstBaseTransform represents a GstBaseTransform.
type GstBaseTransform struct{ *gst.Element }
// ToGstBaseTransform returns a GstBaseTransform object for the given object. It will work on either gst.Object
// or glib.Object interfaces.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func ToGstBaseTransform(obj interface{}) *GstBaseTransform {
switch obj := obj.(type) {
case *gst.Object:
return &GstBaseTransform{&gst.Element{Object: obj}}
case *glib.Object:
return &GstBaseTransform{&gst.Element{Object: &gst.Object{InitiallyUnowned: &glib.InitiallyUnowned{Object: obj}}}}
}
return nil
}
// Instance returns the underlying C GstBaseTransform instance
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) Instance() *C.GstBaseTransform {
return C.toGstBaseTransform(g.Unsafe())
}
// GetAllocator retrieves the memory allocator used by this base transform.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) GetAllocator() (*gst.Allocator, *gst.AllocationParams) {
var allocParams C.GstAllocationParams
var allocator *C.GstAllocator
C.gst_base_transform_get_allocator(g.Instance(), &allocator, &allocParams)
if allocator == nil {
return nil, nil
}
return gst.FromGstAllocatorUnsafeFull(unsafe.Pointer(allocator)), gst.FromGstAllocationParamsUnsafe(unsafe.Pointer(&allocParams))
}
// GetBufferPool returns the BufferPool used by this transform.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) GetBufferPool() *gst.BufferPool {
pool := C.gst_base_transform_get_buffer_pool(g.Instance())
if pool == nil {
return nil
}
return gst.FromGstBufferPoolUnsafeFull(unsafe.Pointer(pool))
}
// IsInPlace returns if the transform is configured to do in-place transform.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) IsInPlace() bool {
return gobool(C.gst_base_transform_is_in_place(g.Instance()))
}
// IsPassthrough returns if the transform is configured for passthrough.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) IsPassthrough() bool {
return gobool(C.gst_base_transform_is_passthrough(g.Instance()))
}
// IsQoSEnabled queries if the transform will handle QoS.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) IsQoSEnabled() bool {
return gobool(C.gst_base_transform_is_qos_enabled(g.Instance()))
}
// QueuedBuffer returns the currentl queued buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) QueuedBuffer() *gst.Buffer {
return gst.FromGstBufferUnsafeNone(unsafe.Pointer(g.Instance().queued_buf))
}
// SINCE 1.18
// // Reconfigure negotiates src pad caps with downstream elements if the source pad is marked as needing
// // reconfiguring. Unmarks GST_PAD_FLAG_NEED_RECONFIGURE in any case. But marks it again if negotiation fails.
// //
// // Do not call this in the Transform() or TransformIP() vmethod. Call this in SubmitInputBuffer(),
// // PrepareOutputBuffer() or in GenerateOutput() before any output buffer is allocated.
// //
// // It will by default be called when handling an ALLOCATION query or at the very beginning of the default
// // SubmitInputBuffer() implementation.
// func (g *GstBaseTransform) Reconfigure() bool {
// return gobool(C.gst_base_transform_reconfigure(g.Instance()))
// }
// ReconfigureSink instructs transform to request renegotiation upstream. This function is typically called
// after properties on the transform were set that influence the input format.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) ReconfigureSink() { C.gst_base_transform_reconfigure_sink(g.Instance()) }
// ReconfigureSrc instructs trans to renegotiate a new downstream transform on the next buffer. This function
// is typically called after properties on the transform were set that influence the output format.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) ReconfigureSrc() { C.gst_base_transform_reconfigure_src(g.Instance()) }
// SetGapAware configures how buffers are handled. If gapAware is FALSE (the default), output buffers will
// have the GST_BUFFER_FLAG_GAP flag unset.
//
// If set to TRUE, the element must handle output buffers with this flag set correctly, i.e. it can assume that
// the buffer contains neutral data but must unset the flag if the output is no neutral data.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) SetGapAware(gapAware bool) {
C.gst_base_transform_set_gap_aware(g.Instance(), gboolean(gapAware))
}
// SetInPlace determines whether a non-writable buffer will be copied before passing to the TransformIP function.
// This is always true if no Transform() function is implemented, and always false if ONLY a Transform() function
// is implemented.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) SetInPlace(inPlace bool) {
C.gst_base_transform_set_in_place(g.Instance(), gboolean(inPlace))
}
// SetPassthrough sets the default passthrough mode for this filter. The is mostly useful for filters that do not
// care about negotiation. This is always true for filters which don't implement either a Transform(), TransformIP(),
// or GenerateOutput() method.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) SetPassthrough(passthrough bool) {
C.gst_base_transform_set_passthrough(g.Instance(), gboolean(passthrough))
}
// SetPassthroughOnSameCaps when set to true will automatically enable passthrough if caps are the same.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) SetPassthroughOnSameCaps(passthrough bool) {
C.setGstBaseTransformPassthroughOnSameCaps(g.Instance(), gboolean(passthrough))
}
// SetPreferPassthrough sets whether passthrough is preferred. If preferPassthrough is TRUE (the default), trans
// will check and prefer passthrough caps from the list of caps returned by the TransformCaps() vmethod.
//
// If set to FALSE, the element must order the caps returned from the TransformCaps() function in such a way that
// the preferred format is first in the list. This can be interesting for transforms that can do passthrough
// transforms but prefer to do something else, like a capsfilter.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) SetPreferPassthrough(preferPassthrough bool) {
C.gst_base_transform_set_prefer_passthrough(g.Instance(), gboolean(preferPassthrough))
}
// SetQoSEnabled enables or disables QoS handling in the filter.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) SetQoSEnabled(enabled bool) {
C.gst_base_transform_set_qos_enabled(g.Instance(), gboolean(enabled))
}
// SetTransformIPOnPassthrough If set to TRUE, TransformIP() will be called in passthrough mode. The passed
// buffer might not be writable. When FALSE, neither Transform() nor TransformIP() will be called in passthrough
// mode. Set to TRUE by default.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) SetTransformIPOnPassthrough(enabled bool) {
C.setGstBaseTransformTransformIPOnPassthrough(g.Instance(), gboolean(enabled))
}
// SinkPad returns the sink pad object for this element.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) SinkPad() *gst.Pad {
return gst.FromGstPadUnsafeNone(unsafe.Pointer(g.Instance().sinkpad))
}
// SrcPad returns the src pad object for this element.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) SrcPad() *gst.Pad {
return gst.FromGstPadUnsafeNone(unsafe.Pointer(g.Instance().srcpad))
}
// UpdateQoS sets the QoS parameters in the transform. This function is called internally when a QOS event is received
// but subclasses can provide custom information when needed.
//
// proportion is the proportion, diff is the diff against the clock, and timestamp is the timestamp of the buffer
// generating the QoS expressed in running_time.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) UpdateQoS(proportion float64, diff, timestamp gst.ClockTime) {
C.gst_base_transform_update_qos(
g.Instance(),
C.gdouble(proportion),
C.GstClockTimeDiff(diff),
C.GstClockTime(timestamp),
)
}
// UpdateSrcCaps updates the srcpad caps and sends the caps downstream. This function can be used by subclasses
// when they have already negotiated their caps but found a change in them (or computed new information). This
// way, they can notify downstream about that change without losing any buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) UpdateSrcCaps(caps *gst.Caps) {
C.gst_base_transform_update_src_caps(
g.Instance(),
(*C.GstCaps)(unsafe.Pointer(caps.Instance())),
)
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) ParentAcceptCaps(direction gst.PadDirection, caps *gst.Caps) bool {
panic("not implemented")
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) ParentBeforeTransform(buffer *gst.Buffer) {
panic("not implemented")
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) ParentCopyMetadata(input, output *gst.Buffer) bool {
panic("not implemented")
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) ParentDecideAllocation(query *gst.Query) bool {
panic("not implemented")
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) ParentFilterMeta(query *gst.Query, api glib.Type, params *gst.Structure) bool {
panic("not implemented")
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) ParentFixateCaps(directon gst.PadDirection, caps *gst.Caps, othercaps *gst.Caps) *gst.Caps {
panic("not implemented")
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) ParentGenerateOutput(gst.FlowReturn, *gst.Buffer) {
panic("not implemented")
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) ParentGetUnitSize(caps *gst.Caps) (ok bool, size int64) {
panic("not implemented")
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) ParentPrepareOutputBuffer(input *gst.Buffer) (gst.FlowReturn, *gst.Buffer) {
panic("not implemented")
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) ParentProposeAllocation(decideQuery, query *gst.Query) bool {
panic("not implemented")
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) ParentQuery(direction gst.PadDirection, query *gst.Query) bool {
panic("not implemented")
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) ParentSetCaps(incaps, outcaps *gst.Caps) bool {
panic("not implemented")
}
// ParentSrcEvent chains the event up to the parent class
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) ParentSrcEvent(event *gst.Event) bool {
return gobool(C.gstBaseTransformParentSrcEvent(g.Instance(), (*C.GstEvent)(unsafe.Pointer(event.Instance()))))
}
// ParentSinkEvent chains the event up to the parent class
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) ParentSinkEvent(event *gst.Event) bool {
return gobool(C.gstBaseTransformParentSinkEvent(g.Instance(), (*C.GstEvent)(unsafe.Pointer(event.Instance()))))
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) ParentStart(bool) {
panic("not implemented")
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) ParentStop(bool) {
panic("not implemented")
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) ParentSubmitInputBuffer(isDiscont bool, input *gst.Buffer) gst.FlowReturn {
panic("not implemented")
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) ParentTransform(inbuf, outbuf *gst.Buffer) gst.FlowReturn {
panic("not implemented")
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) ParentTransformCaps(direction gst.PadDirection, caps, filter *gst.Caps) *gst.Caps {
panic("not implemented")
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) ParentTransformIP(buf *gst.Buffer) gst.FlowReturn {
panic("not implemented")
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) ParentTransformMeta(outbuf *gst.Buffer, meta *gst.Meta, inbuf *gst.Buffer) bool {
panic("not implemented")
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstBaseTransform) ParentTransformSize(direction gst.PadDirection, caps *gst.Caps, size int64, othercaps *gst.Caps) (ok bool, othersize int64) {
panic("not implemented")
}

View File

@@ -1,386 +0,0 @@
package base
/*
#include "gst.go.h"
*/
import "C"
import (
"unsafe"
"github.com/go-gst/go-glib/glib"
"github.com/go-gst/go-gst/gst"
)
//export goGstBaseTransformAcceptCaps
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseTransformAcceptCaps(self *C.GstBaseTransform, direction C.GstPadDirection, caps *C.GstCaps) C.gboolean {
var ret bool
goBaseT := ToGstBaseTransform(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(self))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(self))
iface := subclass.(interface {
AcceptCaps(*GstBaseTransform, gst.PadDirection, *gst.Caps) bool
})
ret = iface.AcceptCaps(goBaseT, gst.PadDirection(direction), gst.ToGstCaps(unsafe.Pointer(caps)))
return gboolean(ret)
}
//export goGstBaseTransformBeforeTransform
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseTransformBeforeTransform(self *C.GstBaseTransform, buffer *C.GstBuffer) {
goBaseT := ToGstBaseTransform(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(self))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(self))
iface := subclass.(interface {
BeforeTransform(*GstBaseTransform, *gst.Buffer)
})
iface.BeforeTransform(goBaseT, gst.ToGstBuffer(unsafe.Pointer(buffer)))
}
//export goGstBaseTransformCopyMetadata
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseTransformCopyMetadata(self *C.GstBaseTransform, input, output *C.GstBuffer) C.gboolean {
var ret bool
goBaseT := ToGstBaseTransform(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(self))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(self))
iface := subclass.(interface {
CopyMetadata(self *GstBaseTransform, input, output *gst.Buffer) bool
})
ret = iface.CopyMetadata(goBaseT, gst.ToGstBuffer(unsafe.Pointer(input)), gst.ToGstBuffer(unsafe.Pointer(output)))
return gboolean(ret)
}
//export goGstBaseTransformDecideAllocation
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseTransformDecideAllocation(self *C.GstBaseTransform, query *C.GstQuery) C.gboolean {
var ret bool
goBaseT := ToGstBaseTransform(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(self))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(self))
iface := subclass.(interface {
DecideAllocation(self *GstBaseTransform, query *gst.Query) bool
})
ret = iface.DecideAllocation(goBaseT, gst.ToGstQuery(unsafe.Pointer(query)))
return gboolean(ret)
}
//export goGstBaseTransformFilterMeta
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseTransformFilterMeta(self *C.GstBaseTransform, query *C.GstQuery, api C.GType, params *C.GstStructure) C.gboolean {
var ret bool
goBaseT := ToGstBaseTransform(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(self))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(self))
iface := subclass.(interface {
FilterMeta(self *GstBaseTransform, query *gst.Query, api glib.Type, params *gst.Structure) bool
})
ret = iface.FilterMeta(goBaseT, gst.ToGstQuery(unsafe.Pointer(query)), glib.Type(api), gst.FromGstStructureUnsafe(unsafe.Pointer(params)))
return gboolean(ret)
}
//export goGstBaseTransformFixateCaps
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseTransformFixateCaps(self *C.GstBaseTransform, direction C.GstPadDirection, caps, othercaps *C.GstCaps) *C.GstCaps {
var ret *gst.Caps
goBaseT := ToGstBaseTransform(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(self))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(self))
iface := subclass.(interface {
FixateCaps(self *GstBaseTransform, directon gst.PadDirection, caps *gst.Caps, othercaps *gst.Caps) *gst.Caps
})
ret = iface.FixateCaps(goBaseT, gst.PadDirection(direction), gst.ToGstCaps(unsafe.Pointer(caps)), gst.ToGstCaps(unsafe.Pointer(othercaps)))
if ret == nil {
return nil
}
return (*C.GstCaps)(unsafe.Pointer(ret.Instance()))
}
//export goGstBaseTransformGenerateOutput
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseTransformGenerateOutput(self *C.GstBaseTransform, buf **C.GstBuffer) C.GstFlowReturn {
var ret gst.FlowReturn
var out *gst.Buffer
goBaseT := ToGstBaseTransform(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(self))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(self))
iface := subclass.(interface {
GenerateOutput(self *GstBaseTransform) (gst.FlowReturn, *gst.Buffer)
})
ret, out = iface.GenerateOutput(goBaseT)
if out != nil {
C.memcpy(unsafe.Pointer(*buf), unsafe.Pointer(out.Instance()), C.sizeof_GstBuffer)
}
return C.GstFlowReturn(ret)
}
//export goGstBaseTransformGetUnitSize
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseTransformGetUnitSize(self *C.GstBaseTransform, caps *C.GstCaps, size *C.gsize) C.gboolean {
var ret bool
var out int64
goBaseT := ToGstBaseTransform(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(self))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(self))
iface := subclass.(interface {
GetUnitSize(self *GstBaseTransform, caps *gst.Caps) (ok bool, size int64)
})
ret, out = iface.GetUnitSize(goBaseT, gst.ToGstCaps(unsafe.Pointer(caps)))
if ret {
*size = C.gsize(out)
}
return gboolean(ret)
}
//export goGstBaseTransformPrepareOutputBuffer
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseTransformPrepareOutputBuffer(self *C.GstBaseTransform, input *C.GstBuffer, outbuf **C.GstBuffer) C.GstFlowReturn {
var ret gst.FlowReturn
var out *gst.Buffer
goBaseT := ToGstBaseTransform(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(self))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(self))
iface := subclass.(interface {
PrepareOutputBuffer(self *GstBaseTransform, input *gst.Buffer) (gst.FlowReturn, *gst.Buffer)
})
ret, out = iface.PrepareOutputBuffer(goBaseT, gst.ToGstBuffer(unsafe.Pointer(input)))
if out != nil {
C.memcpy(unsafe.Pointer(*outbuf), unsafe.Pointer(out.Instance()), C.sizeof_GstBuffer)
}
return C.GstFlowReturn(ret)
}
//export goGstBaseTransformProposeAllocation
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseTransformProposeAllocation(self *C.GstBaseTransform, decide, query *C.GstQuery) C.gboolean {
var ret bool
goBaseT := ToGstBaseTransform(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(self))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(self))
iface := subclass.(interface {
ProposeAllocation(self *GstBaseTransform, decideQuery, query *gst.Query) bool
})
ret = iface.ProposeAllocation(goBaseT, gst.ToGstQuery(unsafe.Pointer(decide)), gst.ToGstQuery(unsafe.Pointer(query)))
return gboolean(ret)
}
//export goGstBaseTransformQuery
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseTransformQuery(self *C.GstBaseTransform, direction C.GstPadDirection, query *C.GstQuery) C.gboolean {
var ret bool
goBaseT := ToGstBaseTransform(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(self))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(self))
iface := subclass.(interface {
Query(self *GstBaseTransform, direction gst.PadDirection, query *gst.Query) bool
})
ret = iface.Query(goBaseT, gst.PadDirection(direction), gst.ToGstQuery(unsafe.Pointer(query)))
return gboolean(ret)
}
//export goGstBaseTransformSetCaps
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseTransformSetCaps(self *C.GstBaseTransform, incaps, outcaps *C.GstCaps) C.gboolean {
var ret bool
goBaseT := ToGstBaseTransform(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(self))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(self))
iface := subclass.(interface {
SetCaps(self *GstBaseTransform, incaps, outcaps *gst.Caps) bool
})
ret = iface.SetCaps(goBaseT, gst.ToGstCaps(unsafe.Pointer(incaps)), gst.ToGstCaps(unsafe.Pointer(outcaps)))
return gboolean(ret)
}
//export goGstBaseTransformSinkEvent
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseTransformSinkEvent(self *C.GstBaseTransform, event *C.GstEvent) C.gboolean {
var ret bool
goBaseT := ToGstBaseTransform(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(self))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(self))
iface := subclass.(interface {
SinkEvent(self *GstBaseTransform, event *gst.Event) bool
})
ret = iface.SinkEvent(goBaseT, gst.ToGstEvent(unsafe.Pointer(event)))
return gboolean(ret)
}
//export goGstBaseTransformSrcEvent
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseTransformSrcEvent(self *C.GstBaseTransform, event *C.GstEvent) C.gboolean {
var ret bool
goBaseT := ToGstBaseTransform(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(self))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(self))
iface := subclass.(interface {
SrcEvent(self *GstBaseTransform, event *gst.Event) bool
})
ret = iface.SrcEvent(goBaseT, gst.ToGstEvent(unsafe.Pointer(event)))
return gboolean(ret)
}
//export goGstBaseTransformStart
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseTransformStart(self *C.GstBaseTransform) C.gboolean {
var ret bool
goBaseT := ToGstBaseTransform(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(self))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(self))
iface := subclass.(interface {
Start(self *GstBaseTransform) bool
})
ret = iface.Start(goBaseT)
return gboolean(ret)
}
//export goGstBaseTransformStop
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseTransformStop(self *C.GstBaseTransform) C.gboolean {
var ret bool
goBaseT := ToGstBaseTransform(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(self))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(self))
iface := subclass.(interface {
Stop(self *GstBaseTransform) bool
})
ret = iface.Stop(goBaseT)
return gboolean(ret)
}
//export goGstBaseTransformSubmitInputBuffer
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseTransformSubmitInputBuffer(self *C.GstBaseTransform, isDiscont C.gboolean, input *C.GstBuffer) C.GstFlowReturn {
var ret gst.FlowReturn
goBaseT := ToGstBaseTransform(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(self))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(self))
iface := subclass.(interface {
SubmitInputBuffer(self *GstBaseTransform, isDiscont bool, input *gst.Buffer) gst.FlowReturn
})
ret = iface.SubmitInputBuffer(goBaseT, gobool(isDiscont), gst.ToGstBuffer(unsafe.Pointer(input)))
return C.GstFlowReturn(ret)
}
//export goGstBaseTransformTransform
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseTransformTransform(self *C.GstBaseTransform, inbuf, outbuf *C.GstBuffer) C.GstFlowReturn {
var ret gst.FlowReturn
goBaseT := ToGstBaseTransform(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(self))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(self))
iface := subclass.(interface {
Transform(self *GstBaseTransform, inbuf, outbuf *gst.Buffer) gst.FlowReturn
})
ret = iface.Transform(goBaseT, gst.ToGstBuffer(unsafe.Pointer(inbuf)), gst.ToGstBuffer(unsafe.Pointer(outbuf)))
return C.GstFlowReturn(ret)
}
//export goGstBaseTransformTransformCaps
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseTransformTransformCaps(self *C.GstBaseTransform, direction C.GstPadDirection, caps, filter *C.GstCaps) *C.GstCaps {
var ret *gst.Caps
goBaseT := ToGstBaseTransform(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(self))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(self))
iface := subclass.(interface {
TransformCaps(self *GstBaseTransform, direction gst.PadDirection, caps, filter *gst.Caps) *gst.Caps
})
ret = iface.TransformCaps(goBaseT, gst.PadDirection(direction), gst.ToGstCaps(unsafe.Pointer(caps)), gst.ToGstCaps(unsafe.Pointer(filter)))
if ret == nil {
return nil
}
return (*C.GstCaps)(unsafe.Pointer(ret.Instance()))
}
//export goGstBaseTransformTransformIP
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseTransformTransformIP(self *C.GstBaseTransform, buf *C.GstBuffer) C.GstFlowReturn {
var ret gst.FlowReturn
goBaseT := ToGstBaseTransform(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(self))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(self))
iface := subclass.(interface {
TransformIP(self *GstBaseTransform, buf *gst.Buffer) gst.FlowReturn
})
ret = iface.TransformIP(goBaseT, gst.ToGstBuffer(unsafe.Pointer(buf)))
return C.GstFlowReturn(ret)
}
//export goGstBaseTransformTransformMeta
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseTransformTransformMeta(self *C.GstBaseTransform, outbuf *C.GstBuffer, meta *C.GstMeta, inbuf *C.GstBuffer) C.gboolean {
var ret bool
goBaseT := ToGstBaseTransform(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(self))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(self))
iface := subclass.(interface {
TransformMeta(self *GstBaseTransform, outbuf *gst.Buffer, meta *gst.Meta, inbuf *gst.Buffer) bool
})
ret = iface.TransformMeta(goBaseT, gst.ToGstBuffer(unsafe.Pointer(outbuf)), gst.FromGstMetaUnsafe(unsafe.Pointer(meta)), gst.ToGstBuffer(unsafe.Pointer(inbuf)))
return gboolean(ret)
}
//export goGstBaseTransformTransformSize
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBaseTransformTransformSize(self *C.GstBaseTransform, direction C.GstPadDirection, caps *C.GstCaps, size C.gsize, othercaps *C.GstCaps, outsize *C.gsize) C.gboolean {
var ret bool
var othersize int64
goBaseT := ToGstBaseTransform(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(self))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(self))
iface := subclass.(interface {
TransformSize(self *GstBaseTransform, direction gst.PadDirection, caps *gst.Caps, size int64, othercaps *gst.Caps) (ok bool, othersize int64)
})
ret, othersize = iface.TransformSize(goBaseT, gst.PadDirection(direction), gst.ToGstCaps(unsafe.Pointer(caps)), int64(size), gst.ToGstCaps(unsafe.Pointer(othercaps)))
if ret {
*outsize = C.gsize(othersize)
}
return gboolean(ret)
}

View File

@@ -1,307 +0,0 @@
package base
/*
#include "gst.go.h"
extern gboolean goGstBaseTransformAcceptCaps (GstBaseTransform * self, GstPadDirection direction, GstCaps * caps);
extern void goGstBaseTransformBeforeTransform (GstBaseTransform * self, GstBuffer * buffer);
extern gboolean goGstBaseTransformCopyMetadata (GstBaseTransform * self, GstBuffer * input, GstBuffer * output);
extern gboolean goGstBaseTransformDecideAllocation (GstBaseTransform * self, GstQuery * query);
extern gboolean goGstBaseTransformFilterMeta (GstBaseTransform * self, GstQuery * query, GType api, const GstStructure * params);
extern GstCaps * goGstBaseTransformFixateCaps (GstBaseTransform * self, GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
extern GstFlowReturn goGstBaseTransformGenerateOutput (GstBaseTransform * self, GstBuffer ** buf);
extern gboolean goGstBaseTransformGetUnitSize (GstBaseTransform * self, GstCaps * caps, gsize * size);
extern GstFlowReturn goGstBaseTransformPrepareOutputBuffer (GstBaseTransform * self, GstBuffer * input, GstBuffer ** output);
extern gboolean goGstBaseTransformProposeAllocation (GstBaseTransform * self, GstQuery * decide, GstQuery * query);
extern gboolean goGstBaseTransformQuery (GstBaseTransform * self, GstPadDirection direction, GstQuery * query);
extern gboolean goGstBaseTransformSetCaps (GstBaseTransform * self, GstCaps * incaps, GstCaps * outcaps);
extern gboolean goGstBaseTransformSinkEvent (GstBaseTransform * self, GstEvent * event);
extern gboolean goGstBaseTransformSrcEvent (GstBaseTransform * self, GstEvent * event);
extern gboolean goGstBaseTransformStart (GstBaseTransform * self);
extern gboolean goGstBaseTransformStop (GstBaseTransform * self);
extern GstFlowReturn goGstBaseTransformSubmitInputBuffer (GstBaseTransform * self, gboolean discont, GstBuffer * input);
extern GstFlowReturn goGstBaseTransformTransform (GstBaseTransform * self, GstBuffer * inbuf, GstBuffer * outbuf);
extern GstCaps * goGstBaseTransformTransformCaps (GstBaseTransform * self, GstPadDirection direction, GstCaps * caps, GstCaps * filter);
extern GstFlowReturn goGstBaseTransformTransformIP (GstBaseTransform * self, GstBuffer * buffer);
extern gboolean goGstBaseTransformTransformMeta (GstBaseTransform * self, GstBuffer * outbuf, GstMeta * meta, GstBuffer * inbuf);
extern gboolean goGstBaseTransformTransformSize (GstBaseTransform * self, GstPadDirection direction, GstCaps * caps, gsize size, GstCaps * othercaps, gsize * othersize);
void setGstBaseTransformAcceptCaps (GstBaseTransformClass * klass) { klass->accept_caps = goGstBaseTransformAcceptCaps; }
void setGstBaseTransformBeforeTransform (GstBaseTransformClass * klass) { klass->before_transform = goGstBaseTransformBeforeTransform; }
void setGstBaseTransformCopyMetadata (GstBaseTransformClass * klass) { klass->copy_metadata = goGstBaseTransformCopyMetadata; }
void setGstBaseTransformDecideAllocation (GstBaseTransformClass * klass) { klass->decide_allocation = goGstBaseTransformDecideAllocation; }
void setGstBaseTransformFilterMeta (GstBaseTransformClass * klass) { klass->filter_meta = goGstBaseTransformFilterMeta; }
void setGstBaseTransformFixateCaps (GstBaseTransformClass * klass) { klass->fixate_caps = goGstBaseTransformFixateCaps; }
void setGstBaseTransformGenerateOutput (GstBaseTransformClass * klass) { klass->generate_output = goGstBaseTransformGenerateOutput; }
void setGstBaseTransformGetUnitSize (GstBaseTransformClass * klass) { klass->get_unit_size = goGstBaseTransformGetUnitSize; }
void setGstBaseTransformPrepareOutputBuffer (GstBaseTransformClass * klass) { klass->prepare_output_buffer = goGstBaseTransformPrepareOutputBuffer; }
void setGstBaseTransformProposeAllocation (GstBaseTransformClass * klass) { klass->propose_allocation = goGstBaseTransformProposeAllocation; }
void setGstBaseTransformQuery (GstBaseTransformClass * klass) { klass->query = goGstBaseTransformQuery; }
void setGstBaseTransformSetCaps (GstBaseTransformClass * klass) { klass->set_caps = goGstBaseTransformSetCaps; }
void setGstBaseTransformSinkEvent (GstBaseTransformClass * klass) { klass->sink_event = goGstBaseTransformSinkEvent; }
void setGstBaseTransformSrcEvent (GstBaseTransformClass * klass) { klass->src_event = goGstBaseTransformSrcEvent; }
void setGstBaseTransformStart (GstBaseTransformClass * klass) { klass->start = goGstBaseTransformStart; }
void setGstBaseTransformStop (GstBaseTransformClass * klass) { klass->stop = goGstBaseTransformStop; }
void setGstBaseTransformSubmitInputBuffer (GstBaseTransformClass * klass) { klass->submit_input_buffer = goGstBaseTransformSubmitInputBuffer; }
void setGstBaseTransformTransform (GstBaseTransformClass * klass) { klass->transform = goGstBaseTransformTransform; }
void setGstBaseTransformTransformCaps (GstBaseTransformClass * klass) { klass->transform_caps = goGstBaseTransformTransformCaps; }
void setGstBaseTransformTransformIP (GstBaseTransformClass * klass) { klass->transform_ip = goGstBaseTransformTransformIP; }
void setGstBaseTransformTransformMeta (GstBaseTransformClass * klass) { klass->transform_meta = goGstBaseTransformTransformMeta; }
void setGstBaseTransformTransformSize (GstBaseTransformClass * klass) { klass->transform_size = goGstBaseTransformTransformSize; }
*/
import "C"
import (
"unsafe"
"github.com/go-gst/go-glib/glib"
"github.com/go-gst/go-gst/gst"
)
var (
// ExtendsBaseTransform is an Extendable for extending a GstBaseTransform
ExtendsBaseTransform glib.Extendable = &extendsBaseTransform{parent: gst.ExtendsElement}
)
// GstBaseTransformImpl is the interface for an element extending a GstBaseTransform.
// Subclasses can override any of the available virtual methods or not, as needed. At minimum either
// Transform or TransformIP need to be overridden. If the element can overwrite the input data with
// the results (data is of the same type and quantity) it should provide TransformIP.
//
// For more information:
// https://gstreamer.freedesktop.org/documentation/base/gstbasetransform.html?gi-language=c
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type GstBaseTransformImpl interface {
// Optional. Subclasses can override this method to check if caps can be handled by the element.
// The default implementation might not be the most optimal way to check this in all cases.
AcceptCaps(self *GstBaseTransform, direction gst.PadDirection, caps *gst.Caps) bool
// Optional. This method is called right before the base class will start processing. Dynamic
// properties or other delayed configuration could be performed in this method.
BeforeTransform(self *GstBaseTransform, buffer *gst.Buffer)
// Optional. Copy the metadata from the input buffer to the output buffer. The default implementation
// will copy the flags, timestamps and offsets of the buffer.
CopyMetadata(self *GstBaseTransform, input, output *gst.Buffer) bool
// Setup the allocation parameters for allocating output buffers. The passed in query contains the
// result of the downstream allocation query. This function is only called when not operating in
// passthrough mode. The default implementation will remove all memory dependent metadata. If there is
// a FilterMeta method implementation, it will be called for all metadata API in the downstream query,
// otherwise the metadata API is removed.
DecideAllocation(self *GstBaseTransform, query *gst.Query) bool
// Return TRUE if the metadata API should be proposed in the upstream allocation query. The default
// implementation is NULL and will cause all metadata to be removed.
FilterMeta(self *GstBaseTransform, query *gst.Query, api glib.Type, params *gst.Structure) bool
// Optional. Given the pad in this direction and the given caps, fixate the caps on the other pad.
// The function returns a fixated version of othercaps. othercaps itself is not guaranteed to be writable
// and the bindings will Unref them after the callback is complete. So if you want to return othercaps
// with small modifications, take a copy first with Caps.Copy(), otherwise return a Ref().
FixateCaps(self *GstBaseTransform, directon gst.PadDirection, caps *gst.Caps, othercaps *gst.Caps) *gst.Caps
// Called after each new input buffer is submitted repeatedly until it either generates an error or fails to
// generate an output buffer. The default implementation takes the contents of the queued_buf variable,
// generates an output buffer if needed by calling the class PrepareOutputBuffer, and then calls either
// Transform() or TransformIP(). Elements that don't do 1-to-1 transformations of input to output buffers can
// either return GstBaseTransformFlowDropped or simply not generate an output buffer until they are ready to do
// so. (Since: 1.6)
GenerateOutput(self *GstBaseTransform) (gst.FlowReturn, *gst.Buffer)
// Required if the transform is not in-place. Get the size in bytes of one unit for the given caps.
GetUnitSize(self *GstBaseTransform, caps *gst.Caps) (ok bool, size int64)
// Optional. Subclasses can override this to do their own allocation of output buffers. Elements that only
// do analysis can return a subbuffer or even just return a reference to the input buffer (if in passthrough
// mode). The default implementation will use the negotiated allocator or bufferpool and TransformSize to
// allocate an output buffer or it will return the input buffer in passthrough mode.
PrepareOutputBuffer(self *GstBaseTransform, input *gst.Buffer) (gst.FlowReturn, *gst.Buffer)
// Propose buffer allocation parameters for upstream elements. This function must be implemented if the element
// reads or writes the buffer content. The query that was passed to the DecideAllocation is passed in this
// method (or nil when the element is in passthrough mode). The default implementation will pass the query
// downstream when in passthrough mode and will copy all the filtered metadata API in non-passthrough mode.
ProposeAllocation(self *GstBaseTransform, decideQuery, query *gst.Query) bool
// Optional. Handle a requested query. Subclasses that implement this must chain up to the parent if they
// didn't handle the query
Query(self *GstBaseTransform, direction gst.PadDirection, query *gst.Query) bool
// Allows the subclass to be notified of the actual caps set.
SetCaps(self *GstBaseTransform, incaps, outcaps *gst.Caps) bool
// Optional. Event handler on the sink pad. The default implementation handles the event and forwards it
// downstream.
SinkEvent(self *GstBaseTransform, event *gst.Event) bool
// Optional. Event handler on the source pad. The default implementation handles the event and forwards it
// upstream.
SrcEvent(self *GstBaseTransform, event *gst.Event) bool
// Optional. Called when the element starts processing. Allows opening external resources.
Start(self *GstBaseTransform) bool
// Optional. Called when the element stops processing. Allows closing external resources.
Stop(self *GstBaseTransform) bool
// Function which accepts a new input buffer and pre-processes it. The default implementation performs caps
// (re)negotiation, then QoS if needed, and places the input buffer into the queued_buf member variable. If
// the buffer is dropped due to QoS, it returns GstBaseTransformFlowDropped. If this input buffer is not
// contiguous with any previous input buffer, then isDiscont is set to TRUE. (Since: 1.6)
SubmitInputBuffer(self *GstBaseTransform, isDiscont bool, input *gst.Buffer) gst.FlowReturn
// Required if the element does not operate in-place. Transforms one incoming buffer to one outgoing buffer.
// The function is allowed to change size/timestamp/duration of the outgoing buffer.
Transform(self *GstBaseTransform, inbuf, outbuf *gst.Buffer) gst.FlowReturn
// Optional. Given the pad in this direction and the given caps, what caps are allowed on the other pad in
// this element ?
TransformCaps(self *GstBaseTransform, direction gst.PadDirection, caps, filter *gst.Caps) *gst.Caps
// Required if the element operates in-place. Transform the incoming buffer in-place.
TransformIP(self *GstBaseTransform, buf *gst.Buffer) gst.FlowReturn
// Optional. Transform the metadata on the input buffer to the output buffer. By default this method copies
// all meta without tags. Subclasses can implement this method and return TRUE if the metadata is to be copied.
TransformMeta(self *GstBaseTransform, outbuf *gst.Buffer, meta *gst.Meta, inbuf *gst.Buffer) bool
// Optional. Given the size of a buffer in the given direction with the given caps, calculate the size in
// bytes of a buffer on the other pad with the given other caps. The default implementation uses GetUnitSize
// and keeps the number of units the same.
TransformSize(self *GstBaseTransform, direction gst.PadDirection, caps *gst.Caps, size int64, othercaps *gst.Caps) (ok bool, othersize int64)
}
type extendsBaseTransform struct{ parent glib.Extendable }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *extendsBaseTransform) Type() glib.Type { return glib.Type(C.gst_base_transform_get_type()) }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *extendsBaseTransform) ClassSize() int64 { return int64(C.sizeof_GstBaseTransformClass) }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *extendsBaseTransform) InstanceSize() int64 { return int64(C.sizeof_GstBaseTransform) }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *extendsBaseTransform) InitClass(klass unsafe.Pointer, elem glib.GoObjectSubclass) {
e.parent.InitClass(klass, elem)
class := C.toGstBaseTransformClass(klass)
if _, ok := elem.(interface {
AcceptCaps(self *GstBaseTransform, direction gst.PadDirection, caps *gst.Caps) bool
}); ok {
C.setGstBaseTransformAcceptCaps(class)
}
if _, ok := elem.(interface {
BeforeTransform(self *GstBaseTransform, buffer *gst.Buffer)
}); ok {
C.setGstBaseTransformBeforeTransform(class)
}
if _, ok := elem.(interface {
CopyMetadata(self *GstBaseTransform, input, output *gst.Buffer) bool
}); ok {
C.setGstBaseTransformCopyMetadata(class)
}
if _, ok := elem.(interface {
DecideAllocation(self *GstBaseTransform, query *gst.Query) bool
}); ok {
C.setGstBaseTransformDecideAllocation(class)
}
if _, ok := elem.(interface {
FilterMeta(self *GstBaseTransform, query *gst.Query, api glib.Type, params *gst.Structure) bool
}); ok {
C.setGstBaseTransformFilterMeta(class)
}
if _, ok := elem.(interface {
FixateCaps(self *GstBaseTransform, directon gst.PadDirection, caps *gst.Caps, othercaps *gst.Caps) *gst.Caps
}); ok {
C.setGstBaseTransformFixateCaps(class)
}
if _, ok := elem.(interface {
GenerateOutput(self *GstBaseTransform) (gst.FlowReturn, *gst.Buffer)
}); ok {
C.setGstBaseTransformGenerateOutput(class)
}
if _, ok := elem.(interface {
GetUnitSize(self *GstBaseTransform, caps *gst.Caps) (ok bool, size int64)
}); ok {
C.setGstBaseTransformGetUnitSize(class)
}
if _, ok := elem.(interface {
PrepareOutputBuffer(self *GstBaseTransform, input *gst.Buffer) (gst.FlowReturn, *gst.Buffer)
}); ok {
C.setGstBaseTransformPrepareOutputBuffer(class)
}
if _, ok := elem.(interface {
ProposeAllocation(self *GstBaseTransform, decideQuery, query *gst.Query) bool
}); ok {
C.setGstBaseTransformProposeAllocation(class)
}
if _, ok := elem.(interface {
Query(self *GstBaseTransform, direction gst.PadDirection, query *gst.Query) bool
}); ok {
C.setGstBaseTransformQuery(class)
}
if _, ok := elem.(interface {
SetCaps(self *GstBaseTransform, incaps, outcaps *gst.Caps) bool
}); ok {
C.setGstBaseTransformSetCaps(class)
}
if _, ok := elem.(interface {
SinkEvent(self *GstBaseTransform, event *gst.Event) bool
}); ok {
C.setGstBaseTransformSinkEvent(class)
}
if _, ok := elem.(interface {
SrcEvent(self *GstBaseTransform, event *gst.Event) bool
}); ok {
C.setGstBaseTransformSrcEvent(class)
}
if _, ok := elem.(interface {
Start(self *GstBaseTransform) bool
}); ok {
C.setGstBaseTransformStart(class)
}
if _, ok := elem.(interface {
Stop(self *GstBaseTransform) bool
}); ok {
C.setGstBaseTransformStop(class)
}
if _, ok := elem.(interface {
SubmitInputBuffer(self *GstBaseTransform, isDiscont bool, input *gst.Buffer) gst.FlowReturn
}); ok {
C.setGstBaseTransformSubmitInputBuffer(class)
}
if _, ok := elem.(interface {
Transform(self *GstBaseTransform, inbuf, outbuf *gst.Buffer) gst.FlowReturn
}); ok {
C.setGstBaseTransformTransform(class)
}
if _, ok := elem.(interface {
TransformCaps(self *GstBaseTransform, direction gst.PadDirection, caps, filter *gst.Caps) *gst.Caps
}); ok {
C.setGstBaseTransformTransformCaps(class)
}
if _, ok := elem.(interface {
TransformIP(self *GstBaseTransform, buf *gst.Buffer) gst.FlowReturn
}); ok {
C.setGstBaseTransformTransformIP(class)
}
if _, ok := elem.(interface {
TransformMeta(self *GstBaseTransform, outbuf *gst.Buffer, meta *gst.Meta, inbuf *gst.Buffer) bool
}); ok {
C.setGstBaseTransformTransformMeta(class)
}
if _, ok := elem.(interface {
TransformSize(self *GstBaseTransform, direction gst.PadDirection, caps *gst.Caps, size int64, othercaps *gst.Caps) (ok bool, othersize int64)
}); ok {
C.setGstBaseTransformTransformSize(class)
}
}

View File

@@ -1,517 +0,0 @@
package base
/*
#include "gst.go.h"
extern GstFlowReturn goGstCollectPadsBufferFunc (GstCollectPads * pads, GstCollectData * data, GstBuffer * buffer, gpointer user_data);
extern GstFlowReturn goGstCollectPadsClipFunc (GstCollectPads * pads, GstCollectData * data, GstBuffer * inbuffer, GstBuffer ** outbuffer, gpointer user_data);
extern gint goGstCollectPadsCompareFunc (GstCollectPads * pads, GstCollectData * data1, GstClockTime ts1, GstCollectData * data2, GstClockTime ts2, gpointer user_data);
extern gboolean goGstCollectPadsEventFunc (GstCollectPads * pads, GstCollectData * data, GstEvent * event, gpointer user_data);
extern void goGstCollectPadsFlushFunc (GstCollectPads * pads, gpointer user_data);
extern GstFlowReturn goGstCollectPadsFunc (GstCollectPads * pads, gpointer user_data);
extern gboolean goGstCollectPadsQueryFunc (GstCollectPads * pads, GstCollectData * data, GstQuery * query, gpointer user_data);
GstFlowReturn
cgoGstCollectPadsBufferFunc (GstCollectPads * pads, GstCollectData * data, GstBuffer * buffer, gpointer user_data)
{
return goGstCollectPadsBufferFunc(pads, data, buffer, user_data);
}
GstFlowReturn
cgoGstCollectPadsClipFunc (GstCollectPads * pads, GstCollectData * data, GstBuffer * inbuffer, GstBuffer ** outbuffer, gpointer user_data)
{
return goGstCollectPadsClipFunc(pads, data, inbuffer, outbuffer, user_data);
}
gint
cgoGstCollectPadsCompareFunc (GstCollectPads * pads, GstCollectData * data1, GstClockTime ts1, GstCollectData * data2, GstClockTime ts2, gpointer user_data)
{
return goGstCollectPadsCompareFunc(pads, data1, ts1, data2, ts2, user_data);
}
gboolean
cgoGstCollectPadsEventFunc (GstCollectPads * pads, GstCollectData * data, GstEvent * event, gpointer user_data)
{
return goGstCollectPadsEventFunc(pads, data, event, user_data);
}
void
cgoGstCollectPadsFlushFunc (GstCollectPads * pads, gpointer user_data)
{
goGstCollectPadsFlushFunc(pads, user_data);
}
GstFlowReturn
cgoGstCollectPadsFunc (GstCollectPads * pads, gpointer user_data)
{
return goGstCollectPadsFunc(pads, user_data);
}
gboolean
cgoGstCollectPadsQueryFunc (GstCollectPads * pads, GstCollectData * data, GstQuery * query, gpointer user_data)
{
return goGstCollectPadsQueryFunc(pads, data, query, user_data);
}
*/
import "C"
import (
"time"
"unsafe"
gopointer "github.com/go-gst/go-pointer"
"github.com/go-gst/go-gst/gst"
)
// CollectPadsBufferFunc is a function that will be called when a (considered oldest) buffer can be muxed.
// If all pads have reached EOS, this function is called with a nil data and buffer.
type CollectPadsBufferFunc func(self *CollectPads, data *CollectData, buf *gst.Buffer) gst.FlowReturn
// CollectPadsClipFunc is a function that will be called when a buffer is received on the pad managed by data
// in the collectpad object pads.
//
// The function should use the segment of data and the negotiated media type on the pad to perform clipping of
// the buffer.
//
// The function should return a nil buffer if it should be dropped. The bindings will take care of ownership
// of the in-buffer.
type CollectPadsClipFunc func(self *CollectPads, data *CollectData, inbuffer *gst.Buffer) (gst.FlowReturn, *gst.Buffer)
// CollectPadsCompareFunc is a function for comparing two timestamps of buffers or newsegments collected on
// one pad. The function should return an integer less than zero when first timestamp is deemed older than the
// second one. Zero if the timestamps are deemed equally old. Integer greater than zero when second timestamp
// is deemed older than the first one.
type CollectPadsCompareFunc func(self *CollectPads, data1 *CollectData, ts1 time.Duration, data2 *CollectData, ts2 time.Duration) int // should this be a ClockTime?
// CollectPadsEventFunc is a function that will be called while processing an event. It takes ownership of the
// event and is responsible for chaining up (to EventDefault) or dropping events (such typical cases being handled
// by the default handler). It should return true if the pad could handle the event.
type CollectPadsEventFunc func(self *CollectPads, data *CollectData, event *gst.Event) bool
// CollectPadsFlushFunc is a function that will be called while processing a flushing seek event.
//
// The function should flush any internal state of the element and the state of all the pads. It should clear
// only the state not directly managed by the pads object. It is therefore not necessary to call SetFlushing()
// nor Clear() from this function.
type CollectPadsFlushFunc func(self *CollectPads)
// CollectPadsFunc is a function that will be called when all pads have received data.
type CollectPadsFunc func(self *CollectPads) gst.FlowReturn
// CollectPadsQueryFunc is a function that will be called while processing a query. It takes ownership of the
// query and is responsible for chaining up (to events downstream (with EventDefault()).
//
// The function should return true if the pad could handle the event.
type CollectPadsQueryFunc func(self *CollectPads, data *CollectData, query *gst.Query) bool
// CollectData is a structure used by CollectPads.
type CollectData struct{ ptr *C.GstCollectData }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func wrapCollectData(ptr *C.GstCollectData) *CollectData { return &CollectData{ptr} }
// Instance returns the underly C object
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectData) Instance() *C.GstCollectData { return c.ptr }
// Collect returns the owner CollectPads
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectData) Collect() *CollectPads { return wrapCollectPadsNone(c.ptr.collect) }
// Pad returns the pad managed by this data.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectData) Pad() *gst.Pad { return gst.FromGstPadUnsafeNone(unsafe.Pointer(c.ptr.pad)) }
// Buffer returns the currently queued buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectData) Buffer() *gst.Buffer {
return gst.FromGstBufferUnsafeNone(unsafe.Pointer(c.ptr.buffer))
}
// Pos returns the position in the buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectData) Pos() uint { return uint(c.ptr.pos) }
// Segment returns the last segment received.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectData) Segment() *gst.Segment {
return gst.FromGstSegmentUnsafe(unsafe.Pointer(&c.ptr.segment))
}
// DTS returns the signed version of the DTS converted to running time.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectData) DTS() time.Duration { return time.Duration(C.gstCollectDataDTS(c.ptr)) }
// CollectPads manages a set of pads that operate in collect mode. This means that control is given to the
// manager of this object when all pads have data.
// For more information see:
// https://gstreamer.freedesktop.org/documentation/base/gstcollectpads.html?gi-language=c#gstcollectpads-page
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type CollectPads struct {
*gst.Object
funcMap *collectPadsFuncMap
selfPtr unsafe.Pointer
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type collectPadsFuncMap struct {
bufferFunc CollectPadsBufferFunc
clipFunc CollectPadsClipFunc
compareFunc CollectPadsCompareFunc
eventFunc CollectPadsEventFunc
flushFunc CollectPadsFlushFunc
funcFunc CollectPadsFunc
queryFunc CollectPadsQueryFunc
}
// NewCollectPads creates a new CollectPads instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewCollectPads() *CollectPads {
return wrapCollectPadsFull(C.gst_collect_pads_new())
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func wrapCollectPadsFull(ptr *C.GstCollectPads) *CollectPads {
collect := &CollectPads{
Object: gst.FromGstObjectUnsafeFull(unsafe.Pointer(ptr)),
funcMap: &collectPadsFuncMap{},
}
collect.selfPtr = gopointer.Save(collect)
return collect
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func wrapCollectPadsNone(ptr *C.GstCollectPads) *CollectPads {
collect := &CollectPads{
Object: gst.FromGstObjectUnsafeNone(unsafe.Pointer(ptr)),
funcMap: &collectPadsFuncMap{},
}
collect.selfPtr = gopointer.Save(collect)
return collect
}
// Instance returns the underlying C object.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectPads) Instance() *C.GstCollectPads { return C.toGstCollectPads(c.Unsafe()) }
// AddPad adds a pad to the collection of collect pads. The pad has to be a sinkpad. The refcount of the pad is
// incremented. Use RemovePad to remove the pad from the collection again.
//
// Keeping a pad locked in waiting state is only relevant when using the default collection algorithm
// (providing the oldest buffer). It ensures a buffer must be available on this pad for a collection to take
// place. This is of typical use to a muxer element where non-subtitle streams should always be in waiting
// state, e.g. to assure that caps information is available on all these streams when initial headers have
// to be written.
//
// The pad will be automatically activated in push mode when pads is started.
//
// This function can return nil if supplied with invalid arguments.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectPads) AddPad(pad *gst.Pad, lock bool) *CollectData {
data := C.gst_collect_pads_add_pad(
c.Instance(),
(*C.GstPad)(pad.Unsafe()),
C.guint(C.sizeof_GstCollectData),
nil,
gboolean(lock),
)
if data == nil {
return nil
}
return wrapCollectData(data)
}
// Available queries how much bytes can be read from each queued buffer. This means that the result of
// this call is the maximum number of bytes that can be read from each of the pads.
//
// This function should be called with pads STREAM_LOCK held, such as in the callback.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectPads) Available() uint { return uint(C.gst_collect_pads_available(c.Instance())) }
// InvalidRunningTime is a cast of C_MININT64 to signify a DTS that is invalid.
var InvalidRunningTime = time.Duration(C.G_MININT64)
// ClipRunningTime is a convenience clipping function that converts incoming buffer's timestamp to running
// time, or clips the buffer if outside configured segment.
//
// Since 1.6, this clipping function also sets the DTS parameter of the GstCollectData structure. This version
// of the running time DTS can be negative. InvalidRunningTime is used to indicate invalid value.
//
// data is the CollectData of the corresponding pad and buf is the buffer being clipped.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectPads) ClipRunningTime(data *CollectData, buf *gst.Buffer) (ret gst.FlowReturn, outbuf *gst.Buffer) {
var goutbuf *C.GstBuffer
ret = gst.FlowReturn(C.gst_collect_pads_clip_running_time(
c.Instance(),
data.Instance(),
(*C.GstBuffer)(unsafe.Pointer(buf.Instance())),
&goutbuf,
nil,
))
if goutbuf != nil {
outbuf = gst.FromGstBufferUnsafeFull(unsafe.Pointer(goutbuf))
}
return
}
// EventDefault is the default GstCollectPads event handling that elements should always chain up to to ensure
// proper operation. Element might however indicate event should not be forwarded downstream.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectPads) EventDefault(data *CollectData, event *gst.Event, discard bool) bool {
return gobool(C.gst_collect_pads_event_default(
c.Instance(),
data.Instance(),
(*C.GstEvent)(unsafe.Pointer(event.Instance())),
gboolean(discard),
))
}
// Flush size bytes from the pad data. Returns the number of bytes actually flushed.
//
// This function should be called with pads STREAM_LOCK held, such as in the callback.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectPads) Flush(data *CollectData, size uint) uint {
return uint(C.gst_collect_pads_flush(c.Instance(), data.Instance(), C.guint(size)))
}
// Free will free the C references to any go callbacks registered with the CollectPads. This is required
// due to the way the bindings are implemented around this object currently. While it's safe to assume this
// data will be collected whenever a program exits, in the context of a plugin that might get reused in
// a single application, NOT calling this function between starts and stops of your element could lead to
// memory leaks.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectPads) Free() { gopointer.Unref(c.selfPtr) }
// Peek at the buffer currently queued in data. This function should be called with the pads STREAM_LOCK held,
// such as in the callback handler.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectPads) Peek(data *CollectData) *gst.Buffer {
buf := C.gst_collect_pads_peek(c.Instance(), data.Instance())
if buf == nil {
return nil
}
return gst.FromGstBufferUnsafeFull(unsafe.Pointer(buf))
}
// Pop the buffer currently queued in data. This function should be called with the pads STREAM_LOCK held, such
// as in the callback handler.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectPads) Pop(data *CollectData) *gst.Buffer {
buf := C.gst_collect_pads_pop(c.Instance(), data.Instance())
if buf == nil {
return nil
}
return gst.FromGstBufferUnsafeFull(unsafe.Pointer(buf))
}
// QueryDefault is the Default GstCollectPads query handling that elements should always chain up to to ensure
// proper operation. Element might however indicate query should not be forwarded downstream.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectPads) QueryDefault(data *CollectData, query *gst.Query, discard bool) bool {
return gobool(C.gst_collect_pads_query_default(
c.Instance(), data.Instance(),
(*C.GstQuery)(unsafe.Pointer(query.Instance())),
gboolean(discard),
))
}
// ReadBuffer gets a subbuffer of size bytes from the given pad data.
//
// This function should be called with pads STREAM_LOCK held, such as in the callback.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectPads) ReadBuffer(data *CollectData, size uint) *gst.Buffer {
buf := C.gst_collect_pads_read_buffer(c.Instance(), data.Instance(), C.guint(size))
if buf == nil {
return nil
}
return gst.FromGstBufferUnsafeFull(unsafe.Pointer(buf))
}
// RemovePad removes a pad from the collection of collect pads. This function will also free the GstCollectData
// and all the resources that were allocated with AddPad.
//
// The pad will be deactivated automatically when CollectPads is stopped.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectPads) RemovePad(pad *gst.Pad) bool {
return gobool(C.gst_collect_pads_remove_pad(c.Instance(), (*C.GstPad)(unsafe.Pointer(pad.Instance()))))
}
// SetBufferFunction sets the callback that will be called with the oldest buffer when all pads have been collected,
// or nil on EOS.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectPads) SetBufferFunction(f CollectPadsBufferFunc) {
c.funcMap.bufferFunc = f
C.gst_collect_pads_set_buffer_function(
c.Instance(),
C.GstCollectPadsBufferFunction(C.cgoGstCollectPadsBufferFunc),
(C.gpointer)(c.selfPtr),
)
}
// SetClipFunction installs a clipping function that is called after buffers are received on managed pads.
// See CollectPadsClipFunc for more details.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectPads) SetClipFunction(f CollectPadsClipFunc) {
c.funcMap.clipFunc = f
C.gst_collect_pads_set_clip_function(
c.Instance(),
C.GstCollectPadsClipFunction(C.cgoGstCollectPadsClipFunc),
(C.gpointer)(c.selfPtr),
)
}
// SetCompareFunction sets the timestamp comparison function.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectPads) SetCompareFunction(f CollectPadsCompareFunc) {
c.funcMap.compareFunc = f
C.gst_collect_pads_set_compare_function(
c.Instance(),
C.GstCollectPadsCompareFunction(C.cgoGstCollectPadsCompareFunc),
(C.gpointer)(c.selfPtr),
)
}
// SetEventFunction sets the event callback function that will be called when collectpads has received an event
// originating from one of the collected pads. If the event being processed is a serialized one, this callback
// is called with pads STREAM_LOCK held, otherwise not. As this lock should be held when calling a number of
// CollectPads functions, it should be acquired if so (unusually) needed.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectPads) SetEventFunction(f CollectPadsEventFunc) {
c.funcMap.eventFunc = f
C.gst_collect_pads_set_event_function(
c.Instance(),
C.GstCollectPadsEventFunction(C.cgoGstCollectPadsEventFunc),
(C.gpointer)(c.selfPtr),
)
}
// SetFlushFunction installs a flush function that is called when the internal state of all pads should be
// flushed as part of flushing seek handling. See CollectPadsFlushFunc for more info.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectPads) SetFlushFunction(f CollectPadsFlushFunc) {
c.funcMap.flushFunc = f
C.gst_collect_pads_set_flush_function(
c.Instance(),
C.GstCollectPadsFlushFunction(C.cgoGstCollectPadsFlushFunc),
(C.gpointer)(c.selfPtr),
)
}
// SetFlushing changes the flushing state of all the pads in the collection. No pad is able to accept anymore
// data when flushing is TRUE. Calling this function with flushing FALSE makes pads accept data again. Caller
// must ensure that downstream streaming (thread) is not blocked, e.g. by sending a FLUSH_START downstream.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectPads) SetFlushing(flushing bool) {
C.gst_collect_pads_set_flushing(c.Instance(), gboolean(flushing))
}
// SetFunction sets a function that overrides the behavior around the BufferFunction.
//
// CollectPads provides a default collection algorithm that will determine the oldest buffer available on all
// of its pads, and then delegate to a configured callback. However, if circumstances are more complicated
// and/or more control is desired, this sets a callback that will be invoked instead when all the pads added
// to the collection have buffers queued. Evidently, this callback is not compatible with SetBufferFunction
// callback. If this callback is set, the former will be unset.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectPads) SetFunction(f CollectPadsFunc) {
c.funcMap.funcFunc = f
C.gst_collect_pads_set_function(
c.Instance(),
C.GstCollectPadsFunction(C.cgoGstCollectPadsFunc),
(C.gpointer)(c.selfPtr),
)
}
// SetQueryFunction sets the query callback function and user data that will be called after collectpads has
// received a query originating from one of the collected pads. If the query being processed is a serialized
// one, this callback is called with pads STREAM_LOCK held, otherwise not. As this lock should be held when
// calling a number of CollectPads functions, it should be acquired if so (unusually) needed.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectPads) SetQueryFunction(f CollectPadsQueryFunc) {
c.funcMap.queryFunc = f
C.gst_collect_pads_set_query_function(
c.Instance(),
C.GstCollectPadsQueryFunction(C.cgoGstCollectPadsQueryFunc),
(C.gpointer)(c.selfPtr),
)
}
// SetWaiting sets a pad to waiting or non-waiting mode, if at least this pad has not been created with locked
// waiting state, in which case nothing happens.
//
// This function should be called with pads STREAM_LOCK held, such as in the callback.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectPads) SetWaiting(data *CollectData, waiting bool) {
C.gst_collect_pads_set_waiting(c.Instance(), data.Instance(), gboolean(waiting))
}
// SrcEventDefault is the CollectPads event handling for the src pad of elements. Elements can chain up to this
// to let flushing seek event handling be done by CollectPads.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectPads) SrcEventDefault(pad *gst.Pad, event *gst.Event) bool {
return gobool(C.gst_collect_pads_src_event_default(
c.Instance(),
(*C.GstPad)(unsafe.Pointer(pad.Instance())),
(*C.GstEvent)(unsafe.Pointer(event.Instance())),
))
}
// Start starts the processing of data in the collectpads.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectPads) Start() { C.gst_collect_pads_start(c.Instance()) }
// Stop stops the processing of data in the collectpads. It also u nblocks any blocking operations.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectPads) Stop() { C.gst_collect_pads_stop(c.Instance()) }
// TakeBuffer gets a subbuffer of size bytes from the given pad data. Flushes the amount of read bytes.
//
// This function should be called with pads STREAM_LOCK held, such as in the callback.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CollectPads) TakeBuffer(data *CollectData, size uint) *gst.Buffer {
buf := C.gst_collect_pads_take_buffer(c.Instance(), data.Instance(), C.guint(size))
if buf == nil {
return nil
}
return gst.FromGstBufferUnsafeFull(unsafe.Pointer(buf))
}

View File

@@ -1,109 +0,0 @@
package base
/*
#include "gst.go.h"
*/
import "C"
import (
"time"
"unsafe"
gopointer "github.com/go-gst/go-pointer"
"github.com/go-gst/go-gst/gst"
)
//export goGstCollectPadsBufferFunc
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstCollectPadsBufferFunc(pads *C.GstCollectPads, data *C.GstCollectData, buf *C.GstBuffer, userData C.gpointer) C.GstFlowReturn {
iface := gopointer.Restore(unsafe.Pointer(userData))
collectPads := iface.(*CollectPads)
f := collectPads.funcMap.bufferFunc
var wrappedBuf *gst.Buffer
var wrappedData *CollectData
if buf != nil {
wrappedBuf = gst.FromGstBufferUnsafeNone(unsafe.Pointer(buf))
defer wrappedBuf.Unref()
}
if data != nil {
wrappedData = wrapCollectData(data)
}
return C.GstFlowReturn(f(collectPads, wrappedData, wrappedBuf))
}
//export goGstCollectPadsClipFunc
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstCollectPadsClipFunc(pads *C.GstCollectPads, data *C.GstCollectData, inbuf *C.GstBuffer, outbuf **C.GstBuffer, userData C.gpointer) C.GstFlowReturn {
iface := gopointer.Restore(unsafe.Pointer(userData))
collectPads := iface.(*CollectPads)
f := collectPads.funcMap.clipFunc
buf := gst.FromGstBufferUnsafeNone(unsafe.Pointer(inbuf))
defer buf.Unref()
ret, gooutbuf := f(collectPads, wrapCollectData(data), buf)
if gooutbuf != nil {
C.memcpy(unsafe.Pointer(*outbuf), unsafe.Pointer(gooutbuf.Instance()), C.sizeof_GstBuffer)
}
return C.GstFlowReturn(ret)
}
//export goGstCollectPadsCompareFunc
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstCollectPadsCompareFunc(pads *C.GstCollectPads, data1 *C.GstCollectData, ts1 C.GstClockTime, data2 *C.GstCollectData, ts2 C.GstClockTime, userData C.gpointer) C.gint {
iface := gopointer.Restore(unsafe.Pointer(userData))
collectPads := iface.(*CollectPads)
f := collectPads.funcMap.compareFunc
return C.gint(f(collectPads, wrapCollectData(data1), time.Duration(ts1), wrapCollectData(data2), time.Duration(ts2)))
}
//export goGstCollectPadsEventFunc
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstCollectPadsEventFunc(pads *C.GstCollectPads, data *C.GstCollectData, event *C.GstEvent, userData C.gpointer) C.gboolean {
iface := gopointer.Restore(unsafe.Pointer(userData))
collectPads := iface.(*CollectPads)
f := collectPads.funcMap.eventFunc
return gboolean(f(collectPads, wrapCollectData(data), gst.FromGstEventUnsafeNone(unsafe.Pointer(event))))
}
//export goGstCollectPadsFlushFunc
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstCollectPadsFlushFunc(pads *C.GstCollectPads, userData C.gpointer) {
iface := gopointer.Restore(unsafe.Pointer(userData))
collectPads := iface.(*CollectPads)
f := collectPads.funcMap.flushFunc
f(collectPads)
}
//export goGstCollectPadsFunc
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstCollectPadsFunc(pads *C.GstCollectPads, userData C.gpointer) C.GstFlowReturn {
iface := gopointer.Restore(unsafe.Pointer(userData))
collectPads := iface.(*CollectPads)
f := collectPads.funcMap.funcFunc
return C.GstFlowReturn(f(collectPads))
}
//export goGstCollectPadsQueryFunc
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstCollectPadsQueryFunc(pads *C.GstCollectPads, data *C.GstCollectData, query *C.GstQuery, userData C.gpointer) C.gboolean {
iface := gopointer.Restore(unsafe.Pointer(userData))
collectPads := iface.(*CollectPads)
f := collectPads.funcMap.queryFunc
return gboolean(f(collectPads, wrapCollectData(data), gst.FromGstQueryUnsafeNone(unsafe.Pointer(query))))
}

View File

@@ -1,103 +0,0 @@
package base
/*
#include "gst.go.h"
*/
import "C"
import (
"unsafe"
"github.com/go-gst/go-gst/gst"
)
// FlowCombiner is a helper structure for aggregating flow returns. This struct
// is not thread safe.
// For more information see https://gstreamer.freedesktop.org/documentation/base/gstflowcombiner.html?gi-language=c#GstFlowCombiner
type FlowCombiner struct{ ptr *C.GstFlowCombiner }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func wrapFlowCombiner(ptr *C.GstFlowCombiner) *FlowCombiner {
return &FlowCombiner{ptr}
}
// NewFlowCombiner creates a new flow combiner. Use Free() to free it.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewFlowCombiner() *FlowCombiner {
return wrapFlowCombiner(C.gst_flow_combiner_new())
}
// Instance returns the underlying GstFlowCombiner instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (f *FlowCombiner) Instance() *C.GstFlowCombiner { return f.ptr }
// AddPad adds a new pad to the FlowCombiner. A reference is taken on the pad.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (f *FlowCombiner) AddPad(pad *gst.Pad) {
C.gst_flow_combiner_add_pad(f.Instance(), (*C.GstPad)(unsafe.Pointer(pad.Instance())))
}
// Clear will remove all pads and reset the combiner to its initial state.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (f *FlowCombiner) Clear() { C.gst_flow_combiner_clear(f.Instance()) }
// Free will free a FlowCombiner and all its internal data.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (f *FlowCombiner) Free() { C.gst_flow_combiner_free(f.Instance()) }
// Ref will increment the reference count on the FlowCombiner.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (f *FlowCombiner) Ref() *FlowCombiner {
return wrapFlowCombiner(C.gst_flow_combiner_ref(f.Instance()))
}
// RemovePad will remove a pad from the FlowCombiner.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (f *FlowCombiner) RemovePad(pad *gst.Pad) {
C.gst_flow_combiner_remove_pad(f.Instance(), (*C.GstPad)(unsafe.Pointer(pad.Instance())))
}
// Reset flow combiner and all pads to their initial state without removing pads.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (f *FlowCombiner) Reset() { C.gst_flow_combiner_reset(f.Instance()) }
// Unref decrements the reference count on the Flow Combiner.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (f *FlowCombiner) Unref() { C.gst_flow_combiner_unref(f.Instance()) }
// UpdateFlow computes the combined flow return for the pads in it.
//
// The GstFlowReturn parameter should be the last flow return update for a pad in this GstFlowCombiner.
// It will use this value to be able to shortcut some combinations and avoid looking over all pads again.
// e.g. The last combined return is the same as the latest obtained GstFlowReturn.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (f *FlowCombiner) UpdateFlow(fret gst.FlowReturn) gst.FlowReturn {
return gst.FlowReturn(C.gst_flow_combiner_update_flow(f.Instance(), C.GstFlowReturn(fret)))
}
// UpdatePadFlow sets the provided pad's last flow return to provided value and computes the combined flow
// return for the pads in it.
//
// The GstFlowReturn parameter should be the last flow return update for a pad in this GstFlowCombiner. It
// will use this value to be able to shortcut some combinations and avoid looking over all pads again. e.g.
// The last combined return is the same as the latest obtained GstFlowReturn.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (f *FlowCombiner) UpdatePadFlow(pad *gst.Pad, fret gst.FlowReturn) gst.FlowReturn {
return gst.FlowReturn(C.gst_flow_combiner_update_pad_flow(
f.Instance(),
(*C.GstPad)(unsafe.Pointer(pad.Instance())),
C.GstFlowReturn(fret),
))
}

View File

@@ -1,34 +0,0 @@
package base
/*
#include "gst.go.h"
*/
import "C"
import (
"github.com/go-gst/go-glib/glib"
"github.com/go-gst/go-gst/gst"
)
// GstPushSrc represents a GstBaseSrc.
type GstPushSrc struct{ *GstBaseSrc }
// ToGstPushSrc returns a GstPushSrc object for the given object.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func ToGstPushSrc(obj interface{}) *GstPushSrc {
switch obj := obj.(type) {
case *gst.Object:
return &GstPushSrc{&GstBaseSrc{&gst.Element{Object: obj}}}
case *glib.Object:
return &GstPushSrc{&GstBaseSrc{&gst.Element{Object: &gst.Object{InitiallyUnowned: &glib.InitiallyUnowned{Object: obj}}}}}
}
return nil
}
// Instance returns the underlying C GstBaseSrc instance
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GstPushSrc) Instance() *C.GstPushSrc {
return C.toGstPushSrc(g.Unsafe())
}

View File

@@ -1,69 +0,0 @@
package base
/*
#include "gst.go.h"
*/
import "C"
import (
"unsafe"
"github.com/go-gst/go-glib/glib"
"github.com/go-gst/go-gst/gst"
)
//export goGstPushSrcAlloc
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstPushSrcAlloc(src *C.GstPushSrc, buf **C.GstBuffer) C.GstFlowReturn {
var ret gst.FlowReturn
var outbuf *gst.Buffer
goPushSrc := ToGstPushSrc(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(src))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(src))
iface := subclass.(interface {
Alloc(*GstPushSrc) (gst.FlowReturn, *gst.Buffer)
})
ret, outbuf = iface.Alloc(goPushSrc)
if outbuf != nil {
C.memcpy(unsafe.Pointer(*buf), unsafe.Pointer(outbuf.Instance()), C.sizeof_GstBuffer)
}
return C.GstFlowReturn(ret)
}
//export goGstPushSrcCreate
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstPushSrcCreate(src *C.GstPushSrc, buf **C.GstBuffer) C.GstFlowReturn {
var ret gst.FlowReturn
var outbuf *gst.Buffer
goPushSrc := ToGstPushSrc(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(src))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(src))
iface := subclass.(interface {
Create(*GstPushSrc) (gst.FlowReturn, *gst.Buffer)
})
ret, outbuf = iface.Create(goPushSrc)
if outbuf != nil {
C.memcpy(unsafe.Pointer(*buf), unsafe.Pointer(outbuf.Instance()), C.sizeof_GstBuffer)
}
return C.GstFlowReturn(ret)
}
//export goGstPushSrcFill
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstPushSrcFill(src *C.GstPushSrc, buf *C.GstBuffer) C.GstFlowReturn {
var ret gst.FlowReturn
goPushSrc := ToGstPushSrc(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(src))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(src))
iface := subclass.(interface {
Fill(*GstPushSrc, *gst.Buffer) gst.FlowReturn
})
ret = iface.Fill(goPushSrc, gst.ToGstBuffer(unsafe.Pointer(buf)))
return C.GstFlowReturn(ret)
}

View File

@@ -1,83 +0,0 @@
package base
/*
#include "gst.go.h"
extern GstFlowReturn goGstPushSrcAlloc (GstPushSrc * src, GstBuffer ** buf);
extern GstFlowReturn goGstPushSrcCreate (GstPushSrc * src, GstBuffer ** buf);
extern GstFlowReturn goGstPushSrcFill (GstPushSrc * src, GstBuffer * buf);
void setGstPushSrcAlloc (GstPushSrcClass * klass) { klass->alloc = goGstPushSrcAlloc; }
void setGstPushSrcCreate (GstPushSrcClass * klass) { klass->create = goGstPushSrcCreate; }
void setGstPushSrcFill (GstPushSrcClass * klass) { klass->fill = goGstPushSrcFill; }
*/
import "C"
import (
"unsafe"
"github.com/go-gst/go-glib/glib"
"github.com/go-gst/go-gst/gst"
)
var (
// ExtendsPushSrc is an Extendable for extending a GstPushSrc
ExtendsPushSrc glib.Extendable = &extendsPushSrc{parent: ExtendsBaseSrc}
)
// GstPushSrcImpl is the documented interface for an element extending a GstPushSrc. It does not have to
// be implemented in it's entirety. Each of the methods it declares will be checked for their presence
// in the initializing object, and if the object declares an override it will replace the default
// implementation in the virtual methods.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type GstPushSrcImpl interface {
// Asks the subclass to allocate a buffer. The subclass decides which size this buffer should be.
// The default implementation will create a new buffer from the negotiated allocator.
Alloc(*GstPushSrc) (gst.FlowReturn, *gst.Buffer)
// Asks the subclass to create a buffer. The subclass decides which size this buffer should be. Other
// then that, refer to GstBaseSrc.create for more details. If this method is not implemented, alloc
// followed by fill will be called.
Create(*GstPushSrc) (gst.FlowReturn, *gst.Buffer)
// Asks the subclass to fill the buffer with data.
Fill(*GstPushSrc, *gst.Buffer) gst.FlowReturn
}
type extendsPushSrc struct{ parent glib.Extendable }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *extendsPushSrc) Type() glib.Type { return glib.Type(C.gst_push_src_get_type()) }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *extendsPushSrc) ClassSize() int64 { return int64(C.sizeof_GstPushSrcClass) }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *extendsPushSrc) InstanceSize() int64 { return int64(C.sizeof_GstPushSrc) }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *extendsPushSrc) InitClass(klass unsafe.Pointer, elem glib.GoObjectSubclass) {
e.parent.InitClass(klass, elem)
srcClass := C.toGstPushSrcClass(klass)
if _, ok := elem.(interface {
Alloc(*GstPushSrc) (gst.FlowReturn, *gst.Buffer)
}); ok {
C.setGstPushSrcAlloc(srcClass)
}
if _, ok := elem.(interface {
Create(*GstPushSrc) (gst.FlowReturn, *gst.Buffer)
}); ok {
C.setGstPushSrcCreate(srcClass)
}
if _, ok := elem.(interface {
Fill(*GstPushSrc, *gst.Buffer) gst.FlowReturn
}); ok {
C.setGstPushSrcFill(srcClass)
}
}

View File

@@ -1,162 +0,0 @@
package base
/*
#include "gst.go.h"
#include <stdlib.h>
*/
import "C"
import (
"unsafe"
"github.com/go-gst/go-gst/gst"
)
// TypeFindHelper tries to find what type of data is flowing from the given source GstPad.
// Returns nil if no Caps matches the data stream.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func TypeFindHelper(pad *gst.Pad, size uint64) *gst.Caps {
caps := C.gst_type_find_helper((*C.GstPad)(unsafe.Pointer(pad.Instance())), C.guint64(size))
if caps == nil {
return nil
}
return gst.FromGstCapsUnsafeFull(unsafe.Pointer(caps))
}
// TypeFindHelperForBuffer tries to find what type of data is contained in the given GstBuffer,
// the assumption being that the buffer represents the beginning of the stream or file.
//
// All available typefinders will be called on the data in order of rank. If a typefinding function
// returns a probability of gst.TypeFindMaximum, typefinding is stopped immediately and the found
// caps will be returned right away. Otherwise, all available typefind functions will the tried, and
// the caps with the highest probability will be returned, or nil if the content of the buffer could
// not be identified.
//
// Object can either be nil or the object doing the typefinding (used for logging).
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func TypeFindHelperForBuffer(obj *gst.Object, buffer *gst.Buffer) (*gst.Caps, gst.TypeFindProbability) {
var prob C.GstTypeFindProbability
var cobj *C.GstObject
if obj != nil {
cobj = (*C.GstObject)(obj.Unsafe())
}
caps := C.gst_type_find_helper_for_buffer(cobj, (*C.GstBuffer)(unsafe.Pointer(buffer.Instance())), &prob)
if caps == nil {
return nil, gst.TypeFindProbability(prob)
}
return gst.FromGstCapsUnsafeFull(unsafe.Pointer(caps)), gst.TypeFindProbability(prob)
}
// TypeFindHelperForBufferWithExtension ries to find what type of data is contained in the given GstBuffer,
// the assumption being that the buffer represents the beginning of the stream or file.
//
// All available typefinders will be called on the data in order of rank. If a typefinding function returns
// a probability of gst.TypeFindMaximum, typefinding is stopped immediately and the found caps will be returned
// right away. Otherwise, all available typefind functions will the tried, and the caps with the highest
// probability will be returned, or nil if the content of the buffer could not be identified.
//
// When extension is not empty, this function will first try the typefind functions for the given extension,
// which might speed up the typefinding in many cases.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func TypeFindHelperForBufferWithExtension(obj *gst.Object, buffer *gst.Buffer, extension string) (*gst.Caps, gst.TypeFindProbability) {
var prob C.GstTypeFindProbability
var cobj *C.GstObject
var cext *C.gchar
if obj != nil {
cobj = (*C.GstObject)(obj.Unsafe())
}
if extension != "" {
cstr := C.CString(extension)
defer C.free(unsafe.Pointer(cstr))
cext = (*C.gchar)(unsafe.Pointer(cstr))
}
caps := C.gst_type_find_helper_for_buffer_with_extension(cobj, (*C.GstBuffer)(unsafe.Pointer(buffer.Instance())), cext, &prob)
if caps == nil {
return nil, gst.TypeFindProbability(prob)
}
return gst.FromGstCapsUnsafeFull(unsafe.Pointer(caps)), gst.TypeFindProbability(prob)
}
// TypeFindHelperForData tries to find what type of data is contained in the given data,
// the assumption being that the buffer represents the beginning of the stream or file.
//
// All available typefinders will be called on the data in order of rank. If a typefinding function
// returns a probability of gst.TypeFindMaximum, typefinding is stopped immediately and the found
// caps will be returned right away. Otherwise, all available typefind functions will the tried, and
// the caps with the highest probability will be returned, or nil if the content of the buffer could
// not be identified.
//
// Object can either be nil or the object doing the typefinding (used for logging).
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func TypeFindHelperForData(obj *gst.Object, data []byte) (*gst.Caps, gst.TypeFindProbability) {
var prob C.GstTypeFindProbability
var cobj *C.GstObject
if obj != nil {
cobj = (*C.GstObject)(obj.Unsafe())
}
caps := C.gst_type_find_helper_for_data(cobj, (*C.guint8)(unsafe.Pointer(&data[0])), C.gsize(len(data)), &prob)
if caps == nil {
return nil, gst.TypeFindProbability(prob)
}
return gst.FromGstCapsUnsafeFull(unsafe.Pointer(caps)), gst.TypeFindProbability(prob)
}
// TypeFindHelperForDataWithExtension ries to find what type of data is contained in the given data,
// the assumption being that the buffer represents the beginning of the stream or file.
//
// All available typefinders will be called on the data in order of rank. If a typefinding function returns
// a probability of gst.TypeFindMaximum, typefinding is stopped immediately and the found caps will be returned
// right away. Otherwise, all available typefind functions will the tried, and the caps with the highest
// probability will be returned, or nil if the content of the buffer could not be identified.
//
// When extension is not empty, this function will first try the typefind functions for the given extension,
// which might speed up the typefinding in many cases.
//
// Object can either be nil or the object doing the typefinding (used for logging).
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func TypeFindHelperForDataWithExtension(obj *gst.Object, data []byte, extension string) (*gst.Caps, gst.TypeFindProbability) {
var prob C.GstTypeFindProbability
var cobj *C.GstObject
var cext *C.gchar
if obj != nil {
cobj = (*C.GstObject)(obj.Unsafe())
}
if extension != "" {
cstr := C.CString(extension)
defer C.free(unsafe.Pointer(cstr))
cext = (*C.gchar)(unsafe.Pointer(cstr))
}
caps := C.gst_type_find_helper_for_data_with_extension(cobj, (*C.guint8)(unsafe.Pointer(&data[0])), C.gsize(len(data)), cext, &prob)
if caps == nil {
return nil, gst.TypeFindProbability(prob)
}
return gst.FromGstCapsUnsafeFull(unsafe.Pointer(caps)), gst.TypeFindProbability(prob)
}
// TypeFindHelperForExtension tries to find the best GstCaps associated with extension.
//
// All available typefinders will be checked against the extension in order of rank. The caps of the first typefinder
// that can handle extension will be returned.
//
// Object can either be nil or the object doing the typefinding (used for logging).
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func TypeFindHelperForExtension(obj *gst.Object, extension string) *gst.Caps {
var cobj *C.GstObject
if obj != nil {
cobj = (*C.GstObject)(obj.Unsafe())
}
cext := C.CString(extension)
defer C.free(unsafe.Pointer(cext))
caps := C.gst_type_find_helper_for_extension(cobj, (*C.gchar)(unsafe.Pointer(cext)))
if caps == nil {
return nil
}
return gst.FromGstCapsUnsafeFull(unsafe.Pointer(caps))
}

View File

@@ -1,7 +0,0 @@
package base
/*
#cgo pkg-config: gstreamer-1.0 gstreamer-base-1.0
#cgo CFLAGS: -Wno-deprecated-declarations -g -Wall
*/
import "C"

View File

@@ -1,21 +0,0 @@
package base
//#include "gst.go.h"
import "C"
// gboolean converts a go bool to a C.gboolean.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func gboolean(b bool) C.gboolean {
if b {
return C.gboolean(1)
}
return C.gboolean(0)
}
// gobool provides an easy type conversion between C.gboolean and a go bool.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func gobool(b C.gboolean) bool {
return int(b) > 0
}

View File

@@ -1,149 +0,0 @@
package gst
// #include "gst.go.h"
import "C"
import (
"fmt"
"math"
"time"
"unsafe"
"github.com/go-gst/go-glib/glib"
)
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func toGObject(data unsafe.Pointer) *glib.Object {
return &glib.Object{GObject: glib.ToGObject(data)}
}
// gobool provides an easy type conversion between C.gboolean and a go bool.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func gobool(b C.gboolean) bool {
return int(b) > 0
}
// gboolean converts a go bool to a C.gboolean.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func gboolean(b bool) C.gboolean {
if b {
return C.gboolean(1)
}
return C.gboolean(0)
}
// gdateToTime converts a GDate to a time object.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func gdateToTime(gdate *C.GDate) time.Time {
// should this really be local time?
return time.Date(int(C.g_date_get_year(gdate)), time.Month(C.g_date_get_month(gdate)), int(C.g_date_get_day(gdate)), 0, 0, 0, 0, time.Local)
}
// gstDateTimeToTime converts a GstDateTime to a time object. If the datetime object could not be parsed,
// an empty time object is returned.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func gstDateTimeToTime(gstdatetime *C.GstDateTime) time.Time {
dateStr := fmt.Sprintf(
"%s %s %d:%d:%d %s %d",
time.Weekday(C.gst_date_time_get_day(gstdatetime)).String(),
time.Month(C.gst_date_time_get_month(gstdatetime)).String(),
int(C.gst_date_time_get_hour(gstdatetime)),
int(C.gst_date_time_get_minute(gstdatetime)),
int(C.gst_date_time_get_second(gstdatetime)),
formatOffset(C.gst_date_time_get_time_zone_offset(gstdatetime)),
int(C.gst_date_time_get_year(gstdatetime)),
)
tm, _ := time.Parse("Mon Jan 2 15:04:05 -0700 2006", dateStr)
return tm
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func formatOffset(offset C.gfloat) string {
if offset < 0 {
return fmt.Sprintf("-0%d00", int(offset))
}
return fmt.Sprintf("+0%d00", int(offset))
}
// goStrings returns a string slice for an array of size argc starting at the address argv.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goStrings(argc C.int, argv **C.gchar) []string {
length := int(argc)
tmpslice := (*[(math.MaxInt32 - 1) / unsafe.Sizeof((*C.gchar)(nil))]*C.gchar)(unsafe.Pointer(argv))[:length:length]
gostrings := make([]string, length)
for i, s := range tmpslice {
gostrings[i] = C.GoString(s)
}
return gostrings
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func gcharStrings(strs []string) **C.gchar {
gcharSlc := make([]*C.gchar, len(strs))
for _, s := range strs {
cStr := C.CString(s)
defer C.free(unsafe.Pointer(cStr))
gcharSlc = append(gcharSlc, cStr)
}
return &gcharSlc[0]
}
// newQuarkFromString creates a new GQuark (or returns an existing one) for the given
// string
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func newQuarkFromString(str string) C.uint {
cstr := C.CString(str)
defer C.free(unsafe.Pointer(cstr))
quark := C.g_quark_from_string(cstr)
return quark
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func quarkToString(q C.GQuark) string {
return C.GoString(C.g_quark_to_string(q))
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func streamSliceToGlist(streams []*Stream) *C.GList {
var glist C.GList
wrapped := glib.WrapList(unsafe.Pointer(&glist))
for _, stream := range streams {
wrapped = wrapped.Append(stream.Unsafe())
}
return &glist
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func glistToStreamSlice(glist *C.GList) []*Stream {
l := glib.WrapList(unsafe.Pointer(&glist))
out := make([]*Stream, 0)
l.FreeFull(func(item interface{}) {
st := item.(*C.GstStream)
out = append(out, wrapStream(toGObject(unsafe.Pointer(st))))
})
return out
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func glistToPadTemplateSlice(glist *C.GList) []*PadTemplate {
l := glib.WrapList(unsafe.Pointer(&glist))
out := make([]*PadTemplate, 0)
l.FreeFull(func(item interface{}) {
tmpl := item.(*C.GstPadTemplate)
out = append(out, FromGstPadTemplateUnsafeNone(unsafe.Pointer(tmpl)))
})
return out
}

View File

@@ -1,334 +0,0 @@
package gst
// CGO exports have to be defined in a separate file from where they are used or else
// there will be double linkage issues.
/*
#include <stdlib.h>
#include <gst/gst.h>
*/
import "C"
import (
"unsafe"
"github.com/go-gst/go-glib/glib"
gopointer "github.com/go-gst/go-pointer"
)
//export goElementCallAsync
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goElementCallAsync(element *C.GstElement, userData C.gpointer) {
iface := gopointer.Restore(unsafe.Pointer(userData))
f := iface.(func())
f()
}
//export goPadStickyEventForEachFunc
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goPadStickyEventForEachFunc(gpad *C.GstPad, event **C.GstEvent, userData C.gpointer) C.gboolean {
cbIface := gopointer.Restore(unsafe.Pointer(userData))
cbFunc := cbIface.(StickyEventsForEachFunc)
pad := wrapPad(toGObject(unsafe.Pointer(gpad)))
ev := wrapEvent(*event)
return gboolean(cbFunc(pad, ev))
}
//export goPadProbeFunc
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goPadProbeFunc(gstPad *C.GstPad, info *C.GstPadProbeInfo, userData C.gpointer) C.GstPadProbeReturn {
cbIface := gopointer.Restore(unsafe.Pointer(userData))
cbFunc := cbIface.(PadProbeCallback)
pad := wrapPad(toGObject(unsafe.Pointer(gstPad)))
return C.GstPadProbeReturn(cbFunc(pad, &PadProbeInfo{info}))
}
//export goPadForwardFunc
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goPadForwardFunc(gstPad *C.GstPad, userData C.gpointer) C.gboolean {
cbIface := gopointer.Restore(unsafe.Pointer(userData))
cbFunc := cbIface.(PadForwardFunc)
pad := wrapPad(toGObject(unsafe.Pointer(gstPad)))
return gboolean(cbFunc(pad))
}
//export goTagForEachFunc
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goTagForEachFunc(tagList *C.GstTagList, tag *C.gchar, userData C.gpointer) {
cbIface := gopointer.Restore(unsafe.Pointer(userData))
cbFunc := cbIface.(TagListForEachFunc)
cbFunc(wrapTagList(tagList), Tag(C.GoString(tag)))
}
//export goBufferListForEachCb
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goBufferListForEachCb(buf **C.GstBuffer, idx C.guint, userData C.gpointer) C.gboolean {
cbIface := gopointer.Restore(unsafe.Pointer(userData))
cbFunc := cbIface.(func(*Buffer, uint) bool)
return gboolean(cbFunc(wrapBuffer(*buf), uint(idx)))
}
//export goBufferMetaForEachCb
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goBufferMetaForEachCb(buf *C.GstBuffer, meta **C.GstMeta, userData C.gpointer) C.gboolean {
cbIface := gopointer.Restore(unsafe.Pointer(userData))
cbFunc := cbIface.(func(*Meta) bool)
return gboolean(cbFunc(wrapMeta(*meta)))
}
//export structForEachCb
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func structForEachCb(fieldID C.GQuark, val *C.GValue, chPtr C.gpointer) C.gboolean {
ptr := gopointer.Restore(unsafe.Pointer(chPtr))
resCh := ptr.(chan interface{})
fieldName := C.GoString(C.g_quark_to_string(fieldID))
var resValue interface{}
gVal := glib.ValueFromNative(unsafe.Pointer(val))
if resValue, _ = gVal.GoValue(); resValue == nil {
// serialize the value if we can't do anything else with it
serialized := C.gst_value_serialize(val)
defer C.free(unsafe.Pointer(serialized))
resValue = C.GoString(serialized)
}
resCh <- fieldName
resCh <- resValue
return gboolean(true)
}
//export goBusSyncHandler
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goBusSyncHandler(bus *C.GstBus, cMsg *C.GstMessage, userData C.gpointer) C.GstBusSyncReply {
// wrap the message
msg := wrapMessage(cMsg)
// retrieve the ptr to the function
ptr := unsafe.Pointer(userData)
funcIface := gopointer.Restore(ptr)
busFunc, ok := funcIface.(BusSyncHandler)
if !ok {
return C.GstBusSyncReply(BusPass)
}
return C.GstBusSyncReply(busFunc(msg))
}
//export goBusFunc
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goBusFunc(bus *C.GstBus, cMsg *C.GstMessage, userData C.gpointer) C.gboolean {
// wrap the message
msg := wrapMessage(cMsg)
// retrieve the ptr to the function
ptr := unsafe.Pointer(userData)
funcIface := gopointer.Restore(ptr)
busFunc, ok := funcIface.(BusWatchFunc)
if !ok {
return gboolean(false)
}
// run the call back
if cont := busFunc(msg); !cont {
return gboolean(false)
}
return gboolean(true)
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func getMetaInfoCbFuncs(meta *C.GstMeta) *MetaInfoCallbackFuncs {
gapi := glib.Type(meta.info.api)
gtype := glib.Type(meta.info._type)
typeCbs := registeredMetas[gapi]
if typeCbs == nil {
return nil
}
return typeCbs[gtype.Name()]
}
//export goMetaFreeFunc
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goMetaFreeFunc(meta *C.GstMeta, buf *C.GstBuffer) {
cbFuncs := getMetaInfoCbFuncs(meta)
if cbFuncs != nil && cbFuncs.FreeFunc != nil {
cbFuncs.FreeFunc(wrapBuffer(buf))
}
}
//export goMetaInitFunc
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goMetaInitFunc(meta *C.GstMeta, params C.gpointer, buf *C.GstBuffer) C.gboolean {
cbFuncs := getMetaInfoCbFuncs(meta)
if cbFuncs != nil && cbFuncs.InitFunc != nil {
paramsIface := gopointer.Restore(unsafe.Pointer(params))
defer gopointer.Unref(unsafe.Pointer(params))
return gboolean(cbFuncs.InitFunc(paramsIface, wrapBuffer(buf)))
}
return gboolean(true)
}
//export goMetaTransformFunc
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goMetaTransformFunc(transBuf *C.GstBuffer, meta *C.GstMeta, buffer *C.GstBuffer, mType C.GQuark, data C.gpointer) C.gboolean {
cbFuncs := getMetaInfoCbFuncs(meta)
if cbFuncs != nil && cbFuncs.TransformFunc != nil {
transformData := (*C.GstMetaTransformCopy)(unsafe.Pointer(data))
return gboolean(cbFuncs.TransformFunc(
wrapBuffer(transBuf),
wrapBuffer(buffer),
quarkToString(mType),
&MetaTransformCopy{
Region: gobool(transformData.region),
Offset: int64(transformData.offset),
Size: int64(transformData.size),
},
))
}
return gboolean(true)
}
//export goGDestroyNotifyFunc
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGDestroyNotifyFunc(ptr C.gpointer) {
funcIface := gopointer.Restore(unsafe.Pointer(ptr))
defer gopointer.Unref(unsafe.Pointer(ptr))
f := funcIface.(func())
if f != nil {
f()
}
}
//export goGDestroyNotifyFuncNoRun
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGDestroyNotifyFuncNoRun(ptr C.gpointer) {
gopointer.Unref(unsafe.Pointer(ptr))
padprobesProfile.Remove(unsafe.Pointer(ptr)) // no-op if it wasn't a pad probe
}
//export goCapsMapFunc
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goCapsMapFunc(features *C.GstCapsFeatures, structure *C.GstStructure, userData C.gpointer) C.gboolean {
// retrieve the ptr to the function
ptr := unsafe.Pointer(userData)
funcIface := gopointer.Restore(ptr)
mapFunc, ok := funcIface.(CapsMapFunc)
if !ok {
return gboolean(false)
}
return gboolean(mapFunc(wrapCapsFeatures(features), wrapStructure(structure)))
}
//export goClockCb
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goClockCb(gclock *C.GstClock, clockTime C.GstClockTime, clockID C.GstClockID, userData C.gpointer) C.gboolean {
// retrieve the ptr to the function
ptr := unsafe.Pointer(userData)
funcIface := gopointer.Restore(ptr)
cb, ok := funcIface.(ClockCallback)
if !ok {
return gboolean(false)
}
clock := wrapClock(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(gclock))})
return gboolean(cb(clock, ClockTime(clockTime)))
}
//export goPluginInit
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goPluginInit(plugin *C.GstPlugin, userData C.gpointer) C.gboolean {
ptr := unsafe.Pointer(userData)
defer gopointer.Unref(ptr)
funcIface := gopointer.Restore(ptr)
cb, ok := funcIface.(PluginInitFunc)
if !ok {
return gboolean(false)
}
return gboolean(cb(wrapPlugin(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(plugin))})))
}
//export goGlobalPluginInit
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGlobalPluginInit(plugin *C.GstPlugin) C.gboolean {
return gboolean(globalPluginInit(wrapPlugin(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(plugin))})))
}
//export goLogFunction
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goLogFunction(
category *C.GstDebugCategory,
level C.GstDebugLevel,
file *C.gchar,
function *C.gchar,
line C.gint,
object *C.GObject,
message *C.GstDebugMessage,
userData C.gpointer,
) {
if category == nil {
return
}
logFnMu.RLock()
f := customLogFunction
logFnMu.RUnlock()
if f != nil {
f(
&DebugCategory{ptr: category},
DebugLevel(level),
C.GoString(file),
C.GoString(function),
int(line),
&LoggedObject{ptr: object},
&DebugMessage{ptr: message},
)
}
}
// goUnrefGopointerUserData is a GDestroyNotify used to unref the gopointer from the userdata, used for callback functions
//
//export goUnrefGopointerUserData
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goUnrefGopointerUserData(fPtr C.gpointer) {
gopointer.Unref(unsafe.Pointer(fPtr))
}
// goPromiseChangeFunc is the function the GstPromise calls when it changes state
//
//export goPromiseChangeFunc
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goPromiseChangeFunc(_ *C.GstPromise, fPtr C.gpointer) {
f := gopointer.Restore(unsafe.Pointer(fPtr)).(func())
f()
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,34 +0,0 @@
package gst
// #include "gst.go.h"
import "C"
import (
"unsafe"
"github.com/go-gst/go-glib/glib"
)
type ControlBinding struct{ *Object }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (cb *ControlBinding) Instance() *C.GstControlBinding {
return C.toGstControlBinding(cb.Unsafe())
}
type DirectControlBinding struct{ *ControlBinding }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewDirectControlBinding(obj *Object, prop string, csource *InterpolationControlSource) *DirectControlBinding {
cprop := C.CString(prop)
defer C.free(unsafe.Pointer(cprop))
cbinding := C.gst_direct_control_binding_new(obj.Instance(), cprop, csource.Instance())
return &DirectControlBinding{
ControlBinding: &ControlBinding{
Object: wrapObject(glib.TransferNone(unsafe.Pointer(cbinding))),
},
}
}

View File

@@ -1,59 +0,0 @@
package gst
// #include "gst.go.h"
import "C"
import (
"strconv"
"unsafe"
"github.com/go-gst/go-glib/glib"
)
type InterpolationControlSource struct{ *Object }
type InterpolationMode int
const (
//steps-like interpolation, default
InterpolationModeNone InterpolationMode = 0 // GST_INTERPOLATION_MODE_NONE
//linear interpolation
InterpolationModeLinear InterpolationMode = 1 // GST_INTERPOLATION_MODE_LINEAR
//cubic interpolation (natural), may overshoot the min or max values set by the control point, but is more 'curvy'
InterpolationModeCubic InterpolationMode = 2 // GST_INTERPOLATION_MODE_CUBIC
//monotonic cubic interpolation, will not produce any values outside of the min-max range set by the control points (Since: 1.8)
InterpolationModeCubicMonotonic InterpolationMode = 3 // GST_INTERPOLATION_MODE_CUBIC_MONOTONIC
)
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (cs *InterpolationControlSource) Instance() *C.GstControlSource {
return C.toGstControlSource(cs.Unsafe())
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewInterpolationControlSource() *InterpolationControlSource {
cCs := C.gst_interpolation_control_source_new()
return &InterpolationControlSource{
Object: wrapObject(glib.TransferFull(unsafe.Pointer(cCs))),
}
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (cs *InterpolationControlSource) SetInterpolationMode(mode InterpolationMode) {
cs.SetArg("mode", strconv.Itoa(int(mode)))
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (cs *InterpolationControlSource) SetTimedValue(time ClockTime, value float64) bool {
return gobool(C.gst_timed_value_control_source_set(C.toGstTimedValueControlSource(cs.Unsafe()), C.GstClockTime(time), C.double(value)))
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (cs *InterpolationControlSource) UnsetAll() {
C.gst_timed_value_control_source_unset_all(C.toGstTimedValueControlSource(cs.Unsafe()))
}

View File

@@ -1,12 +0,0 @@
#!/usr/bin/env bash
find . -type f -name "*.go" ! -name "*_deprecation.go" | while read file; do
awk '
/^[^ \t]/ { # Only consider global (non-indented) lines
if ($1 == "func" || ($1 == "type" && ($3 == "struct" || $3 == "interface"))) {
print "//\n// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead."
}
}
{ print }
' "$file" >"$file.tmp" && mv "$file.tmp" "$file"
done

View File

@@ -1,2 +0,0 @@
// Description: This package is superseeded by the autogenerated bindings.
package gst

View File

@@ -1,6 +0,0 @@
/*
Package gst contains bindings for the gstreamer C API. If you are trying
to build simple pipelines quickly (and optiionally readers/writers) see
the gstauto package.
*/
package gst

View File

@@ -1,183 +0,0 @@
#include "gst.go.h"
GType objectGType (GObject *obj) { return G_OBJECT_TYPE(obj); };
GstAllocator * toGstAllocator (void *p) { return (GST_ALLOCATOR_CAST(p)); }
GstBin * toGstBin (void *p) { return (GST_BIN(p)); }
GstBinClass * toGstBinClass (void *p) { return (GST_BIN_CLASS(p)); }
GstBufferList * toGstBufferList (void *p) { return (GST_BUFFER_LIST(p)); }
GstBufferPool * toGstBufferPool (void *p) { return (GST_BUFFER_POOL(p)); }
GstBuffer * toGstBuffer (void *p) { return (GST_BUFFER(p)); }
GstBus * toGstBus (void *p) { return (GST_BUS(p)); }
GstCapsFeatures * toGstCapsFeatures (void *p) { return (GST_CAPS_FEATURES(p)); }
GstCaps * toGstCaps (void *p) { return (GST_CAPS(p)); }
GstChildProxy * toGstChildProxy (void *p) { return (GST_CHILD_PROXY(p)); }
GstClock * toGstClock (void *p) { return (GST_CLOCK(p)); }
GstContext * toGstContext (void *p) { return (GST_CONTEXT_CAST(p)); }
GstDevice * toGstDevice (void *p) { return (GST_DEVICE_CAST(p)); }
GstDeviceProvider * toGstDeviceProvider (void *p) { return (GST_DEVICE_PROVIDER_CAST(p)); }
GstElementFactory * toGstElementFactory (void *p) { return (GST_ELEMENT_FACTORY(p)); }
GstElementClass * toGstElementClass (void *p) { return (GST_ELEMENT_CLASS(p)); }
GstElement * toGstElement (void *p) { return (GST_ELEMENT(p)); }
GstEvent * toGstEvent (void *p) { return (GST_EVENT(p)); }
GstGhostPad * toGstGhostPad (void *p) { return (GST_GHOST_PAD(p)); }
GstMemory * toGstMemory (void *p) { return (GST_MEMORY_CAST(p)); }
GstMessage * toGstMessage (void *p) { return (GST_MESSAGE(p)); }
GstMeta * toGstMeta (void *p) { return (GST_META_CAST(p)); }
GstMiniObject * toGstMiniObject (void *p) { return (GST_MINI_OBJECT(p)); }
GstObject * toGstObject (void *p) { return (GST_OBJECT(p)); }
GstPad * toGstPad (void *p) { return (GST_PAD(p)); }
GstPadTemplate * toGstPadTemplate (void *p) { return (GST_PAD_TEMPLATE(p)); }
GstPipeline * toGstPipeline (void *p) { return (GST_PIPELINE(p)); }
GstPluginFeature * toGstPluginFeature (void *p) { return (GST_PLUGIN_FEATURE(p)); }
GstPlugin * toGstPlugin (void *p) { return (GST_PLUGIN(p)); }
GstProxyPad * toGstProxyPad (void *p) { return (GST_PROXY_PAD(p)); }
GstQuery * toGstQuery (void *p) { return (GST_QUERY(p)); }
GstRegistry * toGstRegistry (void *p) { return (GST_REGISTRY(p)); }
GstSample * toGstSample (void *p) { return (GST_SAMPLE(p)); }
GstStreamCollection * toGstStreamCollection (void *p) { return (GST_STREAM_COLLECTION_CAST(p)); }
GstStream * toGstStream (void *p) { return (GST_STREAM_CAST(p)); }
GstStructure * toGstStructure (void *p) { return (GST_STRUCTURE(p)); }
GstTagList * toGstTagList (void *p) { return (GST_TAG_LIST(p)); }
GstTask * toGstTask (void *p) { return (GST_TASK_CAST(p)); }
GstTaskPool * toGstTaskPool (void *p) { return (GST_TASK_POOL_CAST(p)); }
GstURIHandler * toGstURIHandler (void *p) { return (GST_URI_HANDLER(p)); }
GstUri * toGstURI (void *p) { return (GST_URI(p)); }
GstControlBinding * toGstControlBinding (void *p) { return (GST_CONTROL_BINDING(p)); }
GstControlSource * toGstControlSource (void *p) { return (GST_CONTROL_SOURCE(p)); }
GstTimedValueControlSource * toGstTimedValueControlSource (void *p) { return (GST_TIMED_VALUE_CONTROL_SOURCE(p)); }
/* Buffer Utilities */
GstBuffer * getBufferValue (GValue * val)
{
return gst_value_get_buffer(val);
}
gboolean bufferIsWritable (GstBuffer * buf)
{
return (gst_buffer_is_writable(buf));
}
GstBuffer * makeBufferWritable (GstBuffer * buf)
{
return (gst_buffer_make_writable(buf));
}
GType bufferListType ()
{
return GST_TYPE_BUFFER_LIST;
}
/* BufferList Utilities */
gboolean bufferListIsWritable (GstBufferList * bufList)
{
return gst_buffer_list_is_writable(bufList);
}
GstBufferList * makeBufferListWritable (GstBufferList * bufList)
{
return gst_buffer_list_make_writable(bufList);
}
void addToBufferList (GstBufferList * bufList, GstBuffer * buf)
{
gst_buffer_list_add(bufList, buf);
}
/* BufferPool utilities */
gboolean bufferPoolIsFlushing (GstBufferPool * pool)
{
return GST_BUFFER_POOL_IS_FLUSHING(pool);
}
/* Caps utilties */
gboolean capsIsWritable (GstCaps * caps)
{
return gst_caps_is_writable(caps);
}
GstCaps * makeCapsWritable (GstCaps * caps)
{
return gst_caps_make_writable(caps);
}
/* Context utilities */
gboolean contextIsWritable (GstContext * ctx)
{
return gst_context_is_writable(ctx);
}
GstContext * makeContextWritable (GstContext * ctx)
{
return gst_context_make_writable(ctx);
}
/* Event Utilities */
gboolean eventIsWritable (GstEvent * event)
{
return gst_event_is_writable(event);
}
GstEvent * makeEventWritable (GstEvent * event)
{
return gst_event_make_writable(event);
}
/* TOC Utilities */
gboolean entryTypeIsAlternative (GstTocEntryType * type) { return GST_TOC_ENTRY_TYPE_IS_ALTERNATIVE(type); }
gboolean entryTypeIsSequence (GstTocEntryType * type) { return GST_TOC_ENTRY_TYPE_IS_SEQUENCE(type); }
GstTocEntry * copyTocEntry (GstTocEntry * entry) { return gst_toc_entry_copy(entry); }
GstTocEntry * makeTocEntryWritable (GstTocEntry * entry) { return gst_toc_entry_make_writable(entry); }
GstTocEntry * tocEntryRef (GstTocEntry * entry) { return gst_toc_entry_ref(entry); }
void tocEntryUnref (GstTocEntry * entry) { gst_toc_entry_unref(entry); }
GstToc * copyToc (GstToc * toc) { return gst_toc_copy(toc); }
GstToc * makeTocWritable (GstToc * toc) { return gst_toc_make_writable(toc); }
GstToc * tocRef (GstToc * toc) { return gst_toc_ref(toc); }
void tocUnref (GstToc * toc) { gst_toc_unref(toc); }
/* TagList utilities */
gboolean tagListIsWritable (GstTagList * tagList) { return gst_tag_list_is_writable(tagList); }
GstTagList * makeTagListWritable (GstTagList * tagList) { return gst_tag_list_make_writable(tagList); }
/* Object Utilities */
gboolean gstObjectFlagIsSet (GstObject * obj, guint32 flags) { return (GST_OBJECT_FLAG_IS_SET(obj, flags)); }
void gstObjectFlagSet (GstObject * obj, guint32 flags) { (GST_OBJECT_FLAG_SET(obj, flags)); }
void gstObjectFlagUnset (GstObject * obj, guint32 flags) { (GST_OBJECT_FLAG_UNSET(obj, flags)); }
/* Element utilities */
gboolean gstElementIsURIHandler (GstElement * elem) { return (GST_IS_URI_HANDLER(elem)); }
GstTocSetter * toTocSetter (GstElement * elem) { return GST_TOC_SETTER(elem); }
GstTagSetter * toTagSetter (GstElement *elem) { return GST_TAG_SETTER(elem); }
/* Sample Utilities */
GstSample * getSampleValue (GValue * val)
{
return gst_value_get_sample(val);
}
/* Misc */
gpointer glistNext (GList * list)
{
return g_list_next(list);
}
int sizeOfGCharArray (gchar ** arr)
{
int i;
for (i = 0 ; 1 ; i = i + 1) {
if (arr[i] == NULL) { return i; };
}
}

View File

@@ -1,147 +0,0 @@
#ifndef __GST_GO_H__
#define __GST_GO_H__
#include <stdlib.h>
#include <gst/gst.h>
#include <gst/base/base.h>
#include <gst/controller/gstinterpolationcontrolsource.h>
#include <gst/controller/gstdirectcontrolbinding.h>
typedef struct _PadDestroyNotifyInfo {
gpointer pad_ptr;
gpointer func_map_ptr;
} PadDestroyNotifyInfo;
/*
Type Castings
*/
extern GType objectGType (GObject *obj);
extern GstAllocator * toGstAllocator (void *p);
extern GstBin * toGstBin (void *p);
extern GstBinClass * toGstBinClass (void *p);
extern GstBufferList * toGstBufferList (void *p);
extern GstBufferPool * toGstBufferPool (void *p);
extern GstBuffer * toGstBuffer (void *p);
extern GstBus * toGstBus (void *p);
extern GstCapsFeatures * toGstCapsFeatures (void *p);
extern GstCaps * toGstCaps (void *p);
extern GstChildProxy * toGstChildProxy (void *p);
extern GstClock * toGstClock (void *p);
extern GstContext * toGstContext (void *p);
extern GstDevice * toGstDevice (void *p);
extern GstDeviceProvider * toGstDeviceProvider (void *p);
extern GstElementFactory * toGstElementFactory (void *p);
extern GstElementClass * toGstElementClass (void *p);
extern GstElement * toGstElement (void *p);
extern GstEvent * toGstEvent (void *p);
extern GstGhostPad * toGstGhostPad (void *p);
extern GstMemory * toGstMemory (void *p);
extern GstMessage * toGstMessage (void *p);
extern GstMeta * toGstMeta (void *p);
extern GstMiniObject * toGstMiniObject (void *p);
extern GstObject * toGstObject (void *p);
extern GstPad * toGstPad (void *p);
extern GstPadTemplate * toGstPadTemplate (void *p);
extern GstPipeline * toGstPipeline (void *p);
extern GstPluginFeature * toGstPluginFeature (void *p);
extern GstPlugin * toGstPlugin (void *p);
extern GstProxyPad * toGstProxyPad (void *p);
extern GstQuery * toGstQuery (void *p);
extern GstRegistry * toGstRegistry (void *p);
extern GstSample * toGstSample (void *p);
extern GstStreamCollection * toGstStreamCollection (void *p);
extern GstStream * toGstStream (void *p);
extern GstStructure * toGstStructure (void *p);
extern GstTagList * toGstTagList (void *p);
extern GstTask * toGstTask (void *p);
extern GstTaskPool * toGstTaskPool (void *p);
extern GstURIHandler * toGstURIHandler (void *p);
extern GstUri * toGstURI (void *p);
extern GstControlBinding * toGstControlBinding (void *p);
extern GstControlSource * toGstControlSource (void *p);
extern GstTimedValueControlSource * toGstTimedValueControlSource (void *p);
/* Buffer Utilities */
extern GstBuffer * getBufferValue (GValue * val);
extern gboolean bufferIsWritable (GstBuffer * buf);
extern GstBuffer * makeBufferWritable (GstBuffer * buf);
extern GType bufferListType ();
/* BufferList Utilities */
extern gboolean bufferListIsWritable (GstBufferList * bufList);
extern GstBufferList * makeBufferListWritable (GstBufferList * bufList);
extern void addToBufferList (GstBufferList * bufList, GstBuffer * buf);
/* BufferPool utilities */
extern gboolean bufferPoolIsFlushing (GstBufferPool * pool);
/* Caps utilties */
extern gboolean capsIsWritable (GstCaps * caps);
extern GstCaps * makeCapsWritable (GstCaps * caps);
/* Context utilities */
extern gboolean contextIsWritable (GstContext * ctx);
extern GstContext * makeContextWritable (GstContext * ctx);
/* Event Utilities */
extern gboolean eventIsWritable (GstEvent * event);
extern GstEvent * makeEventWritable (GstEvent * event);
/* TOC Utilities */
extern gboolean entryTypeIsAlternative (GstTocEntryType * type);
extern gboolean entryTypeIsSequence (GstTocEntryType * type);
extern GstTocEntry * copyTocEntry (GstTocEntry * entry);
extern GstTocEntry * makeTocEntryWritable (GstTocEntry * entry);
extern GstTocEntry * tocEntryRef (GstTocEntry * entry);
extern void tocEntryUnref (GstTocEntry * entry);
extern GstToc * copyToc (GstToc * toc);
extern GstToc * makeTocWritable (GstToc * toc);
extern GstToc * tocRef (GstToc * toc);
extern void tocUnref (GstToc * toc);
/* TagList utilities */
extern gboolean tagListIsWritable (GstTagList * tagList);
extern GstTagList * makeTagListWritable (GstTagList * tagList);
/* Object Utilities */
extern gboolean gstObjectFlagIsSet (GstObject * obj, guint32 flags);
extern void gstObjectFlagSet (GstObject * obj, guint32 flags);
extern void gstObjectFlagUnset (GstObject * obj, guint32 flags);
/* Element utilities */
extern gboolean gstElementIsURIHandler (GstElement * elem);
extern GstTocSetter * toTocSetter (GstElement * elem);
extern GstTagSetter * toTagSetter (GstElement *elem);
/* Misc */
extern gpointer glistNext (GList * list);
extern int sizeOfGCharArray (gchar ** arr);
/* Sample Utilities */
extern GstSample * getSampleValue (GValue * val);
#endif

View File

@@ -1,157 +0,0 @@
package gst
// #include "gst.go.h"
import "C"
import (
"runtime"
"unsafe"
"github.com/go-gst/go-glib/glib"
)
// AllocationParams wraps the GstAllocationParams.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type AllocationParams struct {
ptr *C.GstAllocationParams
}
// FromGstAllocationParamsUnsafe wraps the given unsafe.Pointer in an AllocationParams instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstAllocationParamsUnsafe(alloc unsafe.Pointer) *AllocationParams {
return &AllocationParams{ptr: (*C.GstAllocationParams)(alloc)}
}
// NewAllocationParams initializes a set of allocation params with the default
// values.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewAllocationParams() *AllocationParams {
params := &AllocationParams{
ptr: &C.GstAllocationParams{},
}
params.Init()
runtime.SetFinalizer(params, (*AllocationParams).Free)
return params
}
// Instance returns the underlying GstAllocationParams.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *AllocationParams) Instance() *C.GstAllocationParams { return a.ptr }
// Init initializes these AllocationParams to their original values.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *AllocationParams) Init() { C.gst_allocation_params_init(a.ptr) }
// Copy copies these AllocationParams.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *AllocationParams) Copy() *AllocationParams {
return wrapAllocationParams(C.gst_allocation_params_copy(a.ptr))
}
// Free frees the underlying AllocationParams
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *AllocationParams) Free() { C.gst_allocation_params_free(a.ptr) }
// GetFlags returns the flags on these AllocationParams.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *AllocationParams) GetFlags() MemoryFlags { return MemoryFlags(a.ptr.flags) }
// SetFlags changes the flags on these AllocationParams. this must be used
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *AllocationParams) SetFlags(flags MemoryFlags) { a.ptr.flags = C.GstMemoryFlags(flags) }
// GetAlignment returns the desired alignment of the memory.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *AllocationParams) GetAlignment() int64 { return int64(a.ptr.align) }
// SetAlignment sets the desired alignment of the memory.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *AllocationParams) SetAlignment(align int64) { a.ptr.align = C.gsize(align) }
// GetPrefix returns the desired prefix size.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *AllocationParams) GetPrefix() int64 { return int64(a.ptr.prefix) }
// SetPrefix sets the desired prefix size.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *AllocationParams) SetPrefix(prefix int64) { a.ptr.prefix = C.gsize(prefix) }
// GetPadding returns the desired padding size.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *AllocationParams) GetPadding() int64 { return int64(a.ptr.padding) }
// SetPadding sets the desired padding size.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *AllocationParams) SetPadding(padding int64) { a.ptr.padding = C.gsize(padding) }
// Allocator is a go representation of a GstAllocator
type Allocator struct{ *Object }
// FromGstAllocatorUnsafeNone wraps the given unsafe.Pointer in an Allocator instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstAllocatorUnsafeNone(alloc unsafe.Pointer) *Allocator {
return wrapAllocator(glib.TransferNone(alloc))
}
// FromGstAllocatorUnsafeFull wraps the given unsafe.Pointer in an Allocator instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstAllocatorUnsafeFull(alloc unsafe.Pointer) *Allocator {
return wrapAllocator(glib.TransferFull(alloc))
}
// DefaultAllocator returns the default GstAllocator.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func DefaultAllocator() *Allocator {
return wrapAllocator(glib.TransferFull(unsafe.Pointer(C.gst_allocator_find(nil))))
}
// Instance returns the underlying GstAllocator instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Allocator) Instance() *C.GstAllocator { return C.toGstAllocator(a.Unsafe()) }
// MemType returns the memory type for this allocator.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Allocator) MemType() string { return C.GoString(a.Instance().mem_type) }
// Alloc is used to allocate a new memory block with memory that is at least size big.
// The optional params can specify the prefix and padding for the memory. If nil is passed,
// no flags, no extra prefix/padding and a default alignment is used.
//
// The prefix/padding will be filled with 0 if flags contains MemoryFlagZeroPrefixed and
// MemoryFlagZeroPadded respectively.
//
// The alignment in params is given as a bitmask so that align + 1 equals the amount of bytes to
// align to. For example, to align to 8 bytes, use an alignment of 7.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Allocator) Alloc(size int64, params *AllocationParams) *Memory {
mem := C.gst_allocator_alloc(a.Instance(), C.gsize(size), params.ptr)
return FromGstMemoryUnsafeFull(unsafe.Pointer(mem))
}
// Free memory that was originally allocated with this allocator.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (a *Allocator) Free(mem *Memory) {
C.gst_allocator_free(a.Instance(), mem.Instance())
}

View File

@@ -1,454 +0,0 @@
package gst
/*
#include "gst.go.h"
gboolean
binParentAddElement (GstBin * bin, GstElement * element)
{
GObjectClass * this_class = G_OBJECT_GET_CLASS(G_OBJECT(bin));
GstBinClass * parent = toGstBinClass(g_type_class_peek_parent(this_class));
return parent->add_element(bin, element);
}
void
binParentDeepElementAdded (GstBin * bin, GstBin * subbin, GstElement * element)
{
GObjectClass * this_class = G_OBJECT_GET_CLASS(G_OBJECT(bin));
GstBinClass * parent = toGstBinClass(g_type_class_peek_parent(this_class));
parent->deep_element_added(bin, subbin, element);
}
void
binParentDeepElementRemoved (GstBin * bin, GstBin * subbin, GstElement * element)
{
GObjectClass * this_class = G_OBJECT_GET_CLASS(G_OBJECT(element));
GstBinClass * parent = toGstBinClass(g_type_class_peek_parent(this_class));
parent->deep_element_removed(bin, subbin, element);
}
gboolean
binParentDoLatency (GstBin * bin)
{
GObjectClass * this_class = G_OBJECT_GET_CLASS(G_OBJECT(bin));
GstBinClass * parent = toGstBinClass(g_type_class_peek_parent(this_class));
return parent->do_latency(bin);
}
void
binParentElementAdded (GstBin * bin, GstElement * element)
{
GObjectClass * this_class = G_OBJECT_GET_CLASS(G_OBJECT(bin));
GstBinClass * parent = toGstBinClass(g_type_class_peek_parent(this_class));
parent->element_added(bin, element);
}
void
binParentElementRemoved (GstBin * bin, GstElement * element)
{
GObjectClass * this_class = G_OBJECT_GET_CLASS(G_OBJECT(bin));
GstBinClass * parent = toGstBinClass(g_type_class_peek_parent(this_class));
parent->element_removed(bin, element);
}
void
binParentHandleMessage (GstBin * bin, GstMessage * message)
{
GObjectClass * this_class = G_OBJECT_GET_CLASS(G_OBJECT(bin));
GstBinClass * parent = toGstBinClass(g_type_class_peek_parent(this_class));
parent->handle_message(bin, message);
}
gboolean
binParentRemoveElement (GstBin * bin, GstElement * element)
{
GObjectClass * this_class = G_OBJECT_GET_CLASS(G_OBJECT(bin));
GstBinClass * parent = toGstBinClass(g_type_class_peek_parent(this_class));
return parent->remove_element(bin, element);
}
*/
import "C"
import (
"errors"
"fmt"
"unsafe"
"github.com/go-gst/go-glib/glib"
)
// Bin is a go wrapper arounds a GstBin.
type Bin struct{ *Element }
// NewBin returns a new Bin with the given name.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewBin(name string) *Bin {
cName := C.CString(name)
defer C.free(unsafe.Pointer(cName))
bin := C.gst_bin_new((*C.gchar)(unsafe.Pointer(cName)))
return wrapBin(glib.TransferNone(unsafe.Pointer(bin)))
}
// NewBinFromString constructs a bin from a string description.
// description - command line describing the bin
// ghostUnlinkedPads - whether to automatically create ghost pads for unlinked source or sink pads within the bin
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewBinFromString(description string, ghostUnlinkedPads bool) (*Bin, error) {
cDescription := C.CString(description)
defer C.free(unsafe.Pointer(cDescription))
var gerr *C.GError
bin := C.gst_parse_bin_from_description((*C.gchar)(cDescription), gboolean(ghostUnlinkedPads), (**C.GError)(&gerr))
if gerr != nil {
defer C.g_error_free((*C.GError)(gerr))
errMsg := C.GoString(gerr.message)
return nil, errors.New(errMsg)
}
return &Bin{&Element{wrapObject(glib.TransferNone(unsafe.Pointer(bin)))}}, nil
}
// ToGstBin wraps the given glib.Object, gst.Object, or gst.Element in a Bin instance. Only
// works for objects that implement their own Bin.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func ToGstBin(obj interface{}) *Bin {
switch obj := obj.(type) {
case *Object:
return &Bin{&Element{Object: obj}}
case *Element:
return &Bin{obj}
case *glib.Object:
return &Bin{&Element{Object: &Object{InitiallyUnowned: &glib.InitiallyUnowned{Object: obj}}}}
}
return nil
}
// Instance returns the underlying GstBin instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) Instance() *C.GstBin { return C.toGstBin(b.Unsafe()) }
// GetElementByName returns the element with the given name.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) GetElementByName(name string) (*Element, error) {
cName := C.CString(name)
defer C.free(unsafe.Pointer(cName))
elem := C.gst_bin_get_by_name((*C.GstBin)(b.Instance()), (*C.gchar)(cName))
if elem == nil {
return nil, fmt.Errorf("could not find element with name %s", name)
}
return wrapElement(glib.TransferFull(unsafe.Pointer(elem))), nil
}
// GetElementByNameRecursive returns the element with the given name. If it is not
// found in this Bin, parent Bins are searched recursively.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) GetElementByNameRecursive(name string) (*Element, error) {
cName := C.CString(name)
defer C.free(unsafe.Pointer(cName))
elem := C.gst_bin_get_by_name_recurse_up((*C.GstBin)(b.Instance()), (*C.gchar)(cName))
if elem == nil {
return nil, fmt.Errorf("could not find element with name %s", name)
}
return wrapElement(glib.TransferFull(unsafe.Pointer(elem))), nil
}
// GetElements returns a list of the elements added to this pipeline.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) GetElements() ([]*Element, error) {
iterator := C.gst_bin_iterate_elements((*C.GstBin)(b.Instance()))
return iteratorToElementSlice(iterator)
}
// GetElementsRecursive returns a list of the elements added to this Bin. It recurses
// children Bins.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) GetElementsRecursive() ([]*Element, error) {
iterator := C.gst_bin_iterate_recurse((*C.GstBin)(b.Instance()))
return iteratorToElementSlice(iterator)
}
// GetSourceElements returns a list of all the source elements in this Bin.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) GetSourceElements() ([]*Element, error) {
iterator := C.gst_bin_iterate_sources((*C.GstBin)(b.Instance()))
return iteratorToElementSlice(iterator)
}
// GetSinkElements returns a list of all the sink elements in this Bin.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) GetSinkElements() ([]*Element, error) {
iterator := C.gst_bin_iterate_sinks((*C.GstBin)(b.Instance()))
return iteratorToElementSlice(iterator)
}
// GetElementsSorted returns a list of the elements in this bin in topologically sorted order.
// This means that the elements are returned from the most downstream elements (sinks) to the sources.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) GetElementsSorted() ([]*Element, error) {
iterator := C.gst_bin_iterate_sorted((*C.GstBin)(b.Instance()))
return iteratorToElementSlice(iterator)
}
// GetByInterface looks for an element inside the bin that implements the given interface. If such an
// element is found, it returns the element. You can cast this element to the given interface afterwards.
// If you want all elements that implement the interface, use GetAllByInterface. This function recurses
// into child bins.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) GetByInterface(iface glib.Interface) (*Element, error) {
elem := C.gst_bin_get_by_interface(b.Instance(), C.GType(iface.Type()))
if elem == nil {
return nil, fmt.Errorf("could not find any elements implementing %s", iface.Type().Name())
}
return wrapElement(glib.TransferFull(unsafe.Pointer(elem))), nil
}
// GetAllByInterface looks for all elements inside the bin that implements the given interface. You can
// safely cast all returned elements to the given interface. The function recurses inside child bins.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) GetAllByInterface(iface glib.Interface) ([]*Element, error) {
iterator := C.gst_bin_iterate_all_by_interface(b.Instance(), C.GType(iface.Type()))
return iteratorToElementSlice(iterator)
}
// // GetElementsByFactoryName returns a list of the elements in this bin created from the given factory
// // name.
// func (b *Bin) GetElementsByFactoryName(name string) ([]*Element, error) {
// cname := C.CString(name)
// defer C.free(unsafe.Pointer(cname))
// iterator := C.gst_bin_iterate_all_by_element_factory_name(b.Instance(), (*C.gchar)(unsafe.Pointer(cname)))
// return iteratorToElementSlice(iterator)
// }
// Add adds an element to the bin.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) Add(elem *Element) error {
if ok := C.gst_bin_add((*C.GstBin)(b.Instance()), (*C.GstElement)(elem.Instance())); !gobool(ok) {
return fmt.Errorf("failed to add element to pipeline: %s", elem.GetName())
}
return nil
}
// AddMany is a go implementation of `gst_bin_add_many`.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) AddMany(elems ...*Element) error {
for _, elem := range elems {
if err := b.Add(elem); err != nil {
return err
}
}
return nil
}
// Remove removes an element from the Bin.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) Remove(elem *Element) error {
if ok := C.gst_bin_remove((*C.GstBin)(b.Instance()), (*C.GstElement)(elem.Instance())); !gobool(ok) {
return fmt.Errorf("failed to remove element from pipeline: %s", elem.GetName())
}
return nil
}
// RemoveMany is a go implementation of `gst_bin_remove_many`.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) RemoveMany(elems ...*Element) error {
for _, elem := range elems {
if err := b.Remove(elem); err != nil {
return err
}
}
return nil
}
// FindUnlinkedPad recursively looks for elements with an unlinked pad of the given direction
// within this bin and returns an unlinked pad if one is found, or NULL otherwise.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) FindUnlinkedPad(direction PadDirection) *Pad {
pad := C.gst_bin_find_unlinked_pad(b.Instance(), C.GstPadDirection(direction))
if pad == nil {
return nil
}
return wrapPad(glib.TransferFull(unsafe.Pointer(pad)))
}
// GetSuppressedFlags returns the suppressed flags of the bin.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) GetSuppressedFlags() ElementFlags {
return ElementFlags(C.gst_bin_get_suppressed_flags(b.Instance()))
}
// SetSuppressedFlags suppresses the given flags on the bin. ElementFlags of a child element are
// propagated when it is added to the bin. When suppressed flags are set, those specified flags
// will not be propagated to the bin.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) SetSuppressedFlags(flags ElementFlags) {
C.gst_bin_set_suppressed_flags(b.Instance(), C.GstElementFlags(flags))
}
// RecalculateLatency queries bin for the current latency and reconfigures this latency to all
// the elements with a LATENCY event.
//
// This method is typically called on the pipeline when a MessageLatency is posted on the bus.
//
// This function simply emits the 'do-latency' signal so any custom latency calculations will be performed.
// It returns true if the latency could be queried and reconfigured.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) RecalculateLatency() bool {
return gobool(C.gst_bin_recalculate_latency(b.Instance()))
}
// SyncChildrenStates synchronizes the state of every child with the state of this Bin.
// This function returns true if the operation was successful.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) SyncChildrenStates() bool {
return gobool(C.gst_bin_sync_children_states(b.Instance()))
}
// DEBUG OPERATIONS //
// DebugGraphDetails casts GstDebugGraphDetails
type DebugGraphDetails int
// Type castings
const (
DebugGraphShowMediaType DebugGraphDetails = C.GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE // (1) show caps-name on edges
DebugGraphShowCapsDetails DebugGraphDetails = C.GST_DEBUG_GRAPH_SHOW_CAPS_DETAILS // (2) show caps-details on edges
DebugGraphShowNonDefaultParams DebugGraphDetails = C.GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS // (4) show modified parameters on elements
DebugGraphShowStates DebugGraphDetails = C.GST_DEBUG_GRAPH_SHOW_STATES // (8) show element states
DebugGraphShowFullParams DebugGraphDetails = C.GST_DEBUG_GRAPH_SHOW_FULL_PARAMS // (16) show full element parameter values even if they are very long
DebugGraphShowAll DebugGraphDetails = C.GST_DEBUG_GRAPH_SHOW_ALL // (15) show all the typical details that one might want
DebugGraphShowVerbose DebugGraphDetails = C.GST_DEBUG_GRAPH_SHOW_VERBOSE // (4294967295) show all details regardless of how large or verbose they make the resulting output
// Deprecated: Use DebugGraphShowFullParams instead as this was just a typo.
DebugGraphShowPullParams = DebugGraphShowFullParams
)
// DebugBinToDotData will obtain the whole network of gstreamer elements that form the pipeline into a dot file.
// This data can be processed with graphviz to get an image.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) DebugBinToDotData(details DebugGraphDetails) string {
ret := C.gst_debug_bin_to_dot_data(b.Instance(), C.GstDebugGraphDetails(details))
defer C.g_free((C.gpointer)(unsafe.Pointer(ret)))
return C.GoString(ret)
}
// DebugBinToDotFile is like DebugBinToDotData except it will write the dot data to the filename
// specified.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) DebugBinToDotFile(details DebugGraphDetails, filename string) {
cname := C.CString(filename)
defer C.free(unsafe.Pointer(cname))
C.gst_debug_bin_to_dot_file(b.Instance(), C.GstDebugGraphDetails(details), (*C.gchar)(unsafe.Pointer(cname)))
}
// DebugBinToDotFileWithTs is like DebugBinToDotFile except it will write the dot data to the filename
// specified, except it will append the current timestamp to the filename.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) DebugBinToDotFileWithTs(details DebugGraphDetails, filename string) {
cname := C.CString(filename)
defer C.free(unsafe.Pointer(cname))
C.gst_debug_bin_to_dot_file_with_ts(b.Instance(), C.GstDebugGraphDetails(details), (*C.gchar)(unsafe.Pointer(cname)))
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func iteratorToElementSlice(iterator *C.GstIterator) ([]*Element, error) {
elems := make([]*Element, 0)
gval := new(C.GValue)
for {
switch C.gst_iterator_next((*C.GstIterator)(iterator), (*C.GValue)(unsafe.Pointer(gval))) {
case C.GST_ITERATOR_DONE:
C.gst_iterator_free((*C.GstIterator)(iterator))
return elems, nil
case C.GST_ITERATOR_RESYNC:
C.gst_iterator_resync((*C.GstIterator)(iterator))
case C.GST_ITERATOR_OK:
cElemVoid := C.g_value_get_object((*C.GValue)(gval))
cElem := (*C.GstElement)(cElemVoid)
elems = append(elems, wrapElement(glib.TransferNone(unsafe.Pointer(cElem))))
C.g_value_unset((*C.GValue)(gval))
default:
return nil, errors.New("element iterator failed")
}
}
}
// ParentAddElement chains up to the parent AddElement handler.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) ParentAddElement(element *Element) bool {
return gobool(C.binParentAddElement(b.Instance(), element.Instance()))
}
// ParentDeepElementAdded chains up to the parent DeepElementAdded handler.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) ParentDeepElementAdded(subbin *Bin, element *Element) {
C.binParentDeepElementAdded(b.Instance(), subbin.Instance(), element.Instance())
}
// ParentDeepElementRemoved chains up to the parent DeepElementRemoved handler.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) ParentDeepElementRemoved(subbin *Bin, element *Element) {
C.binParentDeepElementRemoved(b.Instance(), subbin.Instance(), element.Instance())
}
// ParentDoLatency chains up to the parent DoLatency handler.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) ParentDoLatency() bool {
return gobool(C.binParentDoLatency(b.Instance()))
}
// ParentElementAdded chains up to the parent ElementAdded handler.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) ParentElementAdded(element *Element) {
C.binParentElementAdded(b.Instance(), element.Instance())
}
// ParentElementRemoved chains up to the parent ElementRemoved handler.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) ParentElementRemoved(element *Element) {
C.binParentElementRemoved(b.Instance(), element.Instance())
}
// ParentHandleMessage chains up to the parent HandleMessage handler.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) ParentHandleMessage(message *Message) {
C.binParentHandleMessage(b.Instance(), message.Instance())
}
// ParentRemoveElement chains up to the parent RemoveElement handler.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bin) ParentRemoveElement(element *Element) bool {
return gobool(C.binParentRemoveElement(b.Instance(), element.Instance()))
}

View File

@@ -1,144 +0,0 @@
package gst
/*
#include "gst.go.h"
*/
import "C"
import (
"unsafe"
"github.com/go-gst/go-glib/glib"
)
//export goGstBinAddElement
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBinAddElement(bin *C.GstBin, child *C.GstElement) C.gboolean {
var ret bool
goBin := wrapBin(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(bin))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(bin))
gochild := wrapElement(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(child))})
caller := subclass.(interface {
AddElement(self *Bin, element *Element) bool
})
ret = caller.AddElement(goBin, gochild)
return gboolean(ret)
}
//export goGstBinDeepElementAdded
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBinDeepElementAdded(bin *C.GstBin, subbin *C.GstBin, child *C.GstElement) {
goBin := wrapBin(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(bin))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(bin))
gosubbin := wrapBin(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(subbin))})
gochild := wrapElement(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(child))})
caller := subclass.(interface {
DeepElementAdded(self *Bin, subbin *Bin, child *Element)
})
caller.DeepElementAdded(goBin, gosubbin, gochild)
}
//export goGstBinDeepElementRemoved
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBinDeepElementRemoved(bin *C.GstBin, subbin *C.GstBin, child *C.GstElement) {
goBin := wrapBin(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(bin))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(bin))
gosubbin := wrapBin(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(subbin))})
gochild := wrapElement(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(child))})
caller := subclass.(interface {
DeepElementRemoved(self *Bin, subbin *Bin, child *Element)
})
caller.DeepElementRemoved(goBin, gosubbin, gochild)
}
//export goGstBinDoLatency
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBinDoLatency(bin *C.GstBin) C.gboolean {
var ret bool
goBin := wrapBin(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(bin))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(bin))
caller := subclass.(interface {
DoLatency(self *Bin) bool
})
ret = caller.DoLatency(goBin)
return gboolean(ret)
}
//export goGstBinElementAdded
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBinElementAdded(bin *C.GstBin, child *C.GstElement) {
goBin := wrapBin(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(bin))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(bin))
gochild := wrapElement(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(child))})
caller := subclass.(interface {
ElementAdded(self *Bin, child *Element)
})
caller.ElementAdded(goBin, gochild)
}
//export goGstBinElementRemoved
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBinElementRemoved(bin *C.GstBin, child *C.GstElement) {
goBin := wrapBin(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(bin))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(bin))
gochild := wrapElement(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(child))})
caller := subclass.(interface {
ElementRemoved(self *Bin, child *Element)
})
caller.ElementRemoved(goBin, gochild)
}
//export goGstBinHandleMessage
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBinHandleMessage(bin *C.GstBin, message *C.GstMessage) {
goBin := wrapBin(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(bin))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(bin))
caller := subclass.(interface {
HandleMessage(self *Bin, msg *Message)
})
caller.HandleMessage(goBin, wrapMessage(message))
}
//export goGstBinRemoveElement
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstBinRemoveElement(bin *C.GstBin, child *C.GstElement) C.gboolean {
var ret bool
goBin := wrapBin(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(bin))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(bin))
gochild := wrapElement(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(child))})
caller := subclass.(interface {
RemoveElement(self *Bin, child *Element) bool
})
ret = caller.RemoveElement(goBin, gochild)
return gboolean(ret)
}

View File

@@ -1,116 +0,0 @@
package gst
/*
#include "gst.go.h"
extern gboolean goGstBinAddElement (GstBin * bin, GstElement * element);
extern void goGstBinDeepElementAdded (GstBin * bin, GstBin * subbin, GstElement * child);
extern void goGstBinDeepElementRemoved (GstBin * bin, GstBin * subbin, GstElement * child);
extern gboolean goGstBinDoLatency (GstBin * bin);
extern void goGstBinElementAdded (GstBin * bin, GstElement * child);
extern void goGstBinElementRemoved (GstBin * bin, GstElement * child);
extern void goGstBinHandleMessage (GstBin * bin, GstMessage * message);
extern gboolean goGstBinRemoveElement (GstBin * bin, GstElement * element);
void setGstBinAddElement (GstBinClass * klass) { klass->add_element = goGstBinAddElement; };
void setGstBinDeepElementAdded (GstBinClass * klass) { klass->deep_element_added = goGstBinDeepElementAdded; };
void setGstBinDeepElementRemoved (GstBinClass * klass) { klass->deep_element_removed = goGstBinDeepElementRemoved; };
void setGstBinDoLatency (GstBinClass * klass) { klass->do_latency = goGstBinDoLatency; };
void setGstBinElementAdded (GstBinClass * klass) { klass->element_added = goGstBinElementAdded; };
void setGstBinElementRemoved (GstBinClass * klass) { klass->element_removed = goGstBinElementRemoved; };
void setGstBinHandleMessage (GstBinClass * klass) { klass->handle_message = goGstBinHandleMessage; };
void setGstBinRemoveElement (GstBinClass * klass) { klass->remove_element = goGstBinRemoveElement; };
*/
import "C"
import (
"unsafe"
"github.com/go-gst/go-glib/glib"
)
// ExtendsBin implements an Extendable object based on a GstBin.
var ExtendsBin glib.Extendable = &extendsBin{parent: ExtendsElement}
// BinImpl is the reference interface for Go elements extending a Bin. You only need to
// implement the methods that interest you.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type BinImpl interface {
AddElement(self *Bin, element *Element) bool
DeepElementAdded(self *Bin, subbin *Bin, child *Element)
DeepElementRemoved(self *Bin, subbin *Bin, child *Element)
DoLatency(self *Bin) bool
ElementAdded(self *Bin, child *Element)
ElementRemoved(self *Bin, child *Element)
HandleMessage(self *Bin, msg *Message)
RemoveElement(self *Bin, element *Element) bool
}
type extendsBin struct{ parent glib.Extendable }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *extendsBin) Type() glib.Type { return glib.Type(C.gst_bin_get_type()) }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *extendsBin) ClassSize() int64 { return int64(C.sizeof_GstBinClass) }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *extendsBin) InstanceSize() int64 { return int64(C.sizeof_GstBin) }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *extendsBin) InitClass(klass unsafe.Pointer, elem glib.GoObjectSubclass) {
e.parent.InitClass(klass, elem)
class := C.toGstBinClass(klass)
if _, ok := elem.(interface {
AddElement(self *Bin, element *Element) bool
}); ok {
C.setGstBinAddElement(class)
}
if _, ok := elem.(interface {
DeepElementAdded(self *Bin, subbin *Bin, child *Element)
}); ok {
C.setGstBinDeepElementAdded(class)
}
if _, ok := elem.(interface {
DeepElementRemoved(self *Bin, subbin *Bin, child *Element)
}); ok {
C.setGstBinDeepElementRemoved(class)
}
if _, ok := elem.(interface {
DoLatency(self *Bin) bool
}); ok {
C.setGstBinDoLatency(class)
}
if _, ok := elem.(interface {
ElementAdded(self *Bin, child *Element)
}); ok {
C.setGstBinElementAdded(class)
}
if _, ok := elem.(interface {
ElementRemoved(self *Bin, child *Element)
}); ok {
C.setGstBinElementRemoved(class)
}
if _, ok := elem.(interface {
HandleMessage(self *Bin, msg *Message)
}); ok {
C.setGstBinHandleMessage(class)
}
if _, ok := elem.(interface {
RemoveElement(self *Bin, element *Element) bool
}); ok {
C.setGstBinRemoveElement(class)
}
}

View File

@@ -1,895 +0,0 @@
package gst
/*
#include "gst.go.h"
extern void goGDestroyNotifyFunc (gpointer data);
extern gboolean goBufferMetaForEachCb (GstBuffer * buffer, GstMeta ** meta, gpointer user_data);
void cgoDestroyNotifyFunc (gpointer data) {
goGDestroyNotifyFunc(data);
}
gboolean cgoBufferMetaForEachCb (GstBuffer * buffer, GstMeta ** meta, gpointer user_data)
{
return goBufferMetaForEachCb(buffer, meta, user_data);
}
gboolean isBuffer (GstBuffer * buffer) { return GST_IS_BUFFER(buffer); }
*/
import "C"
import (
"bytes"
"io"
"runtime"
"unsafe"
"github.com/go-gst/go-glib/glib"
gopointer "github.com/go-gst/go-pointer"
)
// GetMaxBufferMemory returns the maximum amount of memory a buffer can hold.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func GetMaxBufferMemory() uint64 { return uint64(C.gst_buffer_get_max_memory()) }
// Buffer is a go representation of a GstBuffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type Buffer struct {
ptr *C.GstBuffer
mapInfo *MapInfo
}
// FromGstBufferUnsafeNone wraps the given buffer, sinking any floating references, and places
// a finalizer on the wrapped Buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstBufferUnsafeNone(buf unsafe.Pointer) *Buffer {
if buf == nil {
return nil
}
wrapped := ToGstBuffer(buf)
wrapped.Ref()
runtime.SetFinalizer(wrapped, (*Buffer).Unref)
return wrapped
}
// FromGstBufferUnsafeFull wraps the given buffer without taking an additional reference.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstBufferUnsafeFull(buf unsafe.Pointer) *Buffer {
if buf == nil {
return nil
}
wrapped := ToGstBuffer(buf)
runtime.SetFinalizer(wrapped, (*Buffer).Unref)
return wrapped
}
// ToGstBuffer converts the given pointer into a Buffer without affecting the ref count or
// placing finalizers.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func ToGstBuffer(buf unsafe.Pointer) *Buffer {
return wrapBuffer((*C.GstBuffer)(buf))
}
// NewEmptyBuffer returns a new empty buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewEmptyBuffer() *Buffer {
return FromGstBufferUnsafeFull(unsafe.Pointer(C.gst_buffer_new()))
}
// NewBufferWithSize is a convenience wrapped for NewBufferrAllocate with the default allocator
// and parameters.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewBufferWithSize(size int64) *Buffer {
return NewBufferAllocate(nil, nil, size)
}
// NewBufferAllocate tries to create a newly allocated buffer with data of the given size
// and extra parameters from allocator. If the requested amount of memory can't be allocated,
// nil will be returned. The allocated buffer memory is not cleared.
//
// When allocator is nil, the default memory allocator will be used.
//
// Note that when size == 0, the buffer will not have memory associated with it.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewBufferAllocate(alloc *Allocator, params *AllocationParams, size int64) *Buffer {
var gstalloc *C.GstAllocator
if alloc != nil {
gstalloc = alloc.Instance()
}
var gstparams *C.GstAllocationParams
if params != nil {
gstparams = params.Instance()
}
buf := C.gst_buffer_new_allocate(gstalloc, C.gsize(size), gstparams)
if buf == nil {
return nil
}
return FromGstBufferUnsafeFull(unsafe.Pointer(buf))
}
// NewBufferFromBytes returns a new buffer from the given byte slice.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewBufferFromBytes(b []byte) *Buffer {
gbytes := C.g_bytes_new((C.gconstpointer)(unsafe.Pointer(&b[0])), C.gsize(len(b)))
defer C.g_bytes_unref(gbytes)
return FromGstBufferUnsafeFull(unsafe.Pointer(C.gst_buffer_new_wrapped_bytes(gbytes)))
}
// NewBufferFromReader returns a new buffer from the given io.Reader.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewBufferFromReader(rdr io.Reader) (*Buffer, error) {
out, err := io.ReadAll(rdr)
if err != nil {
return nil, err
}
return NewBufferFromBytes(out), nil
}
// NewBufferFull allocates a new buffer that wraps the given data. The wrapped buffer will
// have the region from offset and size visible. The maxsize must be at least the size of the
// data provided.
//
// When the buffer is destroyed, notifyFunc will be called if it is not nil.
//
// The prefix/padding must be filled with 0 if flags contains MemoryFlagZeroPrefixed and MemoryFlagZeroPadded respectively.
//
// // Example
//
// buf := gst.NewBufferFull(0, []byte("hello-world"), 1024, 0, 1024, func() {
// fmt.Println("buffer was destroyed")
// })
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewBufferFull(flags MemoryFlags, data []byte, maxSize, offset, size int64, notifyFunc func()) *Buffer {
var notifyData unsafe.Pointer
var gnotifyFunc C.GDestroyNotify
if notifyFunc != nil {
notifyData = gopointer.Save(notifyFunc)
gnotifyFunc = C.GDestroyNotify(C.cgoDestroyNotifyFunc)
}
dataStr := string(data)
dataPtr := unsafe.Pointer(C.CString(dataStr))
buf := C.gst_buffer_new_wrapped_full(
C.GstMemoryFlags(flags),
(C.gpointer)(dataPtr),
C.gsize(maxSize), C.gsize(offset), C.gsize(size),
(C.gpointer)(notifyData), gnotifyFunc,
)
if buf == nil {
return nil
}
return FromGstBufferUnsafeFull(unsafe.Pointer(buf))
}
// Instance returns the underlying GstBuffer instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) Instance() *C.GstBuffer { return C.toGstBuffer(unsafe.Pointer(b.ptr)) }
// Ref increases the ref count on the buffer by one.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) Ref() *Buffer { return wrapBuffer(C.gst_buffer_ref(b.Instance())) }
// Unref decreaes the ref count on the buffer by one. When the refcount reaches zero, the memory is freed.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) Unref() { C.gst_buffer_unref(b.Instance()) }
// Reader returns an io.Reader for this buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) Reader() io.Reader { return bytes.NewBuffer(b.Bytes()) }
// Bytes returns a byte slice of the data inside this buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) Bytes() []byte {
mapInfo := b.Map(MapRead)
if mapInfo == nil {
return nil
}
defer b.Unmap()
return mapInfo.Bytes()
}
// PresentationTimestamp returns the presentation timestamp of the buffer, or a negative duration
// if not known or relevant. This value contains the timestamp when the media should be
// presented to the user.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) PresentationTimestamp() ClockTime {
pts := b.Instance().pts
return ClockTime(pts)
}
// SetPresentationTimestamp sets the presentation timestamp on the buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) SetPresentationTimestamp(dur ClockTime) {
ins := b.Instance()
ins.pts = C.GstClockTime(dur)
}
// DecodingTimestamp returns the decoding timestamp of the buffer, or a negative duration if not known
// or relevant. This value contains the timestamp when the media should be processed.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) DecodingTimestamp() ClockTime {
dts := b.Instance().dts
return ClockTime(dts)
}
// Duration returns the length of the data inside this buffer, or a negative duration if not known
// or relevant.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) Duration() ClockTime {
dur := b.Instance().duration
return ClockTime(dur)
}
// SetDuration sets the duration on the buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) SetDuration(dur ClockTime) {
ins := b.Instance()
ins.duration = C.GstClockTime(dur)
}
// Offset returns a media specific offset for the buffer data. For video frames, this is the frame
// number of this buffer. For audio samples, this is the offset of the first sample in this buffer.
// For file data or compressed data this is the byte offset of the first byte in this buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) Offset() int64 { return int64(b.Instance().offset) }
// OffsetEnd returns the last offset contained in this buffer. It has the same format as Offset.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) OffsetEnd() int64 { return int64(b.Instance().offset_end) }
// AddMeta adds metadata for info to the buffer using the parameters in params. The given
// parameters are passed to the MetaInfo's init function, and as such will only work
// for MetaInfo objects created from the go runtime.
//
// // Example
//
// metaInfo := gst.RegisterMeta(glib.TypeFromName("MyObjectType"), "my-meta", 1024, &gst.MetaInfoCallbackFuncs{
// InitFunc: func(params interface{}, buffer *gst.Buffer) bool {
// paramStr := params.(string)
// fmt.Println("Buffer initialized with params:", paramStr)
// return true
// },
// FreeFunc: func(buffer *gst.Buffer) {
// fmt.Println("Buffer was destroyed")
// },
// })
//
// buf := gst.NewEmptyBuffer()
// buf.AddMeta(metaInfo, "hello world")
//
// // > Buffer initialized with params: hello world
// // > Buffer was destroyed
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) AddMeta(info *MetaInfo, params interface{}) *Meta {
meta := C.gst_buffer_add_meta(b.Instance(), info.Instance(), (C.gpointer)(gopointer.Save(params)))
if meta == nil {
return nil
}
return wrapMeta(meta)
}
// ParentBufferMeta is a go representation of a GstParentBufferMeta
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type ParentBufferMeta struct {
Parent *Meta
Buffer *Buffer
}
// AddParentMeta adds a ParentBufferMeta to this buffer that holds a parent reference
// on the given buffer until the it is freed.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) AddParentMeta(buf *Buffer) *ParentBufferMeta {
meta := C.gst_buffer_add_parent_buffer_meta(b.Instance(), buf.Instance())
return &ParentBufferMeta{
Parent: wrapMeta(&meta.parent),
Buffer: wrapBuffer(meta.buffer),
}
}
// AddProtectionMeta attaches ProtectionMeta to this buffer. The structure contains
// cryptographic information relating to the sample contained in the buffer. This
// function takes ownership of the structure.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) AddProtectionMeta(info *Structure) *ProtectionMeta {
meta := C.gst_buffer_add_protection_meta(b.Instance(), info.Instance())
return &ProtectionMeta{
Meta: wrapMeta(&meta.meta),
Info: wrapStructure(meta.info),
}
}
// ReferenceTimestampMeta is a go representation of a GstReferenceTimestampMeta.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type ReferenceTimestampMeta struct {
Parent *Meta
Reference *Caps
Timestamp, Duration ClockTime
}
// AddReferenceTimestampMeta adds a ReferenceTimestampMeta to this buffer that holds a
// timestamp and optional duration (specify -1 to omit) based on a specific timestamp reference.
//
// See the documentation of GstReferenceTimestampMeta for details.
// https://gstreamer.freedesktop.org/documentation/gstreamer/gstbuffer.html?gi-language=c#GstReferenceTimestampMeta
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) AddReferenceTimestampMeta(ref *Caps, timestamp, duration ClockTime) *ReferenceTimestampMeta {
meta := C.gst_buffer_add_reference_timestamp_meta(b.Instance(), ref.Instance(), C.GstClockTime(timestamp), C.GstClockTime(duration))
if meta == nil {
return nil
}
return &ReferenceTimestampMeta{
Parent: wrapMeta(&meta.parent),
Reference: wrapCaps(meta.reference),
Timestamp: ClockTime(meta.timestamp),
Duration: ClockTime(meta.duration),
}
}
// Append will append all the memory from the given buffer to this one. The result buffer will
// contain a concatenation of the memory of the two buffers.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) Append(buf *Buffer) *Buffer {
return FromGstBufferUnsafeFull(unsafe.Pointer(C.gst_buffer_append(b.Ref().Instance(), buf.Ref().Instance())))
}
// AppendMemory append the memory block to this buffer. This function takes ownership of
// the memory and thus doesn't increase its refcount.
//
// This function is identical to InsertMemory with an index of -1.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) AppendMemory(mem *Memory) {
C.gst_buffer_append_memory(b.Instance(), mem.Ref().Instance())
}
// AppendRegion will append size bytes at offset from the given buffer to this one. The result
// buffer will contain a concatenation of the memory of this buffer and the requested region of
// the one provided.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) AppendRegion(buf *Buffer, offset, size int64) *Buffer {
newbuf := C.gst_buffer_append_region(b.Ref().Instance(), buf.Ref().Instance(), C.gssize(offset), C.gssize(size))
return FromGstBufferUnsafeFull(unsafe.Pointer(newbuf))
}
// Copy creates a copy of this buffer. This will only copy the buffer's data to a newly allocated
// Memory if needed (if the type of memory requires it), otherwise the underlying data is just referenced.
// Check DeepCopy if you want to force the data to be copied to newly allocated Memory.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) Copy() *Buffer {
buf := C.gst_buffer_copy(b.Instance())
return FromGstBufferUnsafeFull(unsafe.Pointer(buf))
}
// DeepCopy creates a copy of the given buffer. This will make a newly allocated copy of the data
// the source buffer contains.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) DeepCopy() *Buffer {
buf := C.gst_buffer_copy_deep(b.Instance())
return FromGstBufferUnsafeFull(unsafe.Pointer(buf))
}
// CopyInto copies the information from this buffer into the given one. If the given buffer already
// contains memory and flags contains BufferCopyMemory, the memory from this one will be appended to
// that provided.
//
// Flags indicate which fields will be copied. Offset and size dictate from where and how much memory
// is copied. If size is -1 then all data is copied. The function returns true if the copy was successful.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) CopyInto(dest *Buffer, flags BufferCopyFlags, offset, size int64) bool {
ok := C.gst_buffer_copy_into(
dest.Instance(),
b.Instance(),
C.GstBufferCopyFlags(flags),
C.gsize(offset),
C.gsize(size),
)
return gobool(ok)
}
// CopyRegion creates a sub-buffer from this one at offset and size. This sub-buffer uses the actual memory
// space of the parent buffer. This function will copy the offset and timestamp fields when the offset is 0.
// If not, they will be set to ClockTimeNone.
//
// If offset equals 0 and size equals the total size of buffer, the duration and offset end fields are also
// copied. If not they will be set to ClockTimeNone.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) CopyRegion(flags BufferCopyFlags, offset, size int64) *Buffer {
newbuf := C.gst_buffer_copy_region(
b.Instance(),
C.GstBufferCopyFlags(flags),
C.gsize(offset),
C.gsize(size),
)
return wrapBuffer(newbuf)
}
// Extract extracts size bytes starting from offset in this buffer. The data extracted may be lower
// than the actual size if the buffer did not contain enough data.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) Extract(offset, size int64) []byte {
dest := C.malloc(C.sizeof_char * C.gsize(size))
defer C.free(dest)
C.gst_buffer_extract(b.Instance(), C.gsize(offset), (C.gpointer)(unsafe.Pointer(dest)), C.gsize(size))
return C.GoBytes(dest, C.int(size))
}
// FillBytes adds the given byte slice to the buffer at the given offset. The return value reflects the amount
// of data added to the buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) FillBytes(offset int64, data []byte) int64 {
gbytes := C.g_bytes_new((C.gconstpointer)(unsafe.Pointer(&data[0])), C.gsize(len(data)))
defer C.g_bytes_unref(gbytes)
var size C.gsize
gdata := C.g_bytes_get_data(gbytes, &size)
if gdata == nil {
return 0
}
return int64(C.gst_buffer_fill(b.Instance(), C.gsize(offset), gdata, size))
}
// FindMemory looks for the memory blocks that span size bytes starting from offset in buffer. Size can be -1
// to retrieve all the memory blocks.
//
// Index will contain the index of the first memory block where the byte for offset can be found and length
// contains the number of memory blocks containing the size remaining bytes. Skip contains the number of bytes
// to skip in the memory block at index to get to the byte for offset. All values will be 0 if the memory blocks
// could not be read.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) FindMemory(offset, size int64) (index, length uint, skip int64) {
var gindex, glength C.uint
var gskip C.gsize
ok := C.gst_buffer_find_memory(b.Instance(), C.gsize(offset), C.gsize(size), &gindex, &glength, &gskip)
if !gobool(ok) {
return
}
return uint(gindex), uint(glength), int64(gskip)
}
// ForEachMeta calls the given function for each Meta in this buffer.
//
// The function can modify the passed meta pointer or its contents. The return value defines if this function continues
// or if the remaining metadata items in the buffer should be skipped.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) ForEachMeta(f func(meta *Meta) bool) bool {
fPtr := gopointer.Save(f)
defer gopointer.Unref(fPtr)
return gobool(C.gst_buffer_foreach_meta(
b.Instance(),
C.GstBufferForeachMetaFunc(C.cgoBufferMetaForEachCb),
(C.gpointer)(unsafe.Pointer(fPtr)),
))
}
// GetAllMemory retrieves all the memory inside this buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) GetAllMemory() *Memory {
mem := C.gst_buffer_get_all_memory(b.Instance())
if mem == nil {
return nil
}
return FromGstMemoryUnsafeFull(unsafe.Pointer(mem))
}
// GetFlags returns the flags on this buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) GetFlags() BufferFlags {
return BufferFlags(C.gst_buffer_get_flags(b.Instance()))
}
// GetMemory retrieves the memory block at the given index in the buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) GetMemory(idx uint) *Memory {
mem := C.gst_buffer_get_memory(b.Instance(), C.guint(idx))
if mem == nil {
return nil
}
return FromGstMemoryUnsafeFull(unsafe.Pointer(mem))
}
// GetMemoryRange retrieves length memory blocks in buffer starting at idx. The memory blocks
// will be merged into one large Memory. If length is -1, all memory starting from idx is merged.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) GetMemoryRange(idx uint, length int) *Memory {
mem := C.gst_buffer_get_memory_range(b.Instance(), C.guint(idx), C.gint(length))
if mem == nil {
return nil
}
return FromGstMemoryUnsafeFull(unsafe.Pointer(mem))
}
// GetMeta retrieves the metadata for the given api on buffer. When there is no such metadata,
// nil is returned. If multiple metadata with the given api are attached to this buffer only the
// first one is returned. To handle multiple metadata with a given API use ForEachMeta instead
// and check the type.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) GetMeta(api glib.Type) *Meta {
meta := C.gst_buffer_get_meta(b.Instance(), C.GType(api))
if meta == nil {
return nil
}
return wrapMeta(meta)
}
// GetNumMetas returns the number of metas for the given api type on the buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) GetNumMetas(api glib.Type) uint {
return uint(C.gst_buffer_get_n_meta(b.Instance(), C.GType(api)))
}
// GetReferenceTimestampMeta finds the first ReferenceTimestampMeta on the buffer that conforms to
// reference. Conformance is tested by checking if the meta's reference is a subset of reference.
//
// Buffers can contain multiple ReferenceTimestampMeta metadata items.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) GetReferenceTimestampMeta(caps *Caps) *ReferenceTimestampMeta {
var meta *C.GstReferenceTimestampMeta
if caps == nil {
meta = C.gst_buffer_get_reference_timestamp_meta(b.Instance(), nil)
} else {
meta = C.gst_buffer_get_reference_timestamp_meta(b.Instance(), caps.Instance())
}
if meta == nil {
return nil
}
refMeta := &ReferenceTimestampMeta{
Parent: wrapMeta(&meta.parent),
Timestamp: ClockTime(meta.timestamp),
Duration: ClockTime(meta.duration),
}
if meta.reference != nil {
refMeta.Reference = wrapCaps(meta.reference)
}
return refMeta
}
// GetSize retrieves the number of Memory blocks in the bffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) GetSize() int64 {
return int64(C.gst_buffer_get_size(b.Instance()))
}
// GetSizes will retrieve the size of the buffer, the offset of the first memory block in the buffer,
// and the sum of the size of the buffer, the offset, and any padding. These values can be used to
// resize the buffer with Resize.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) GetSizes() (size, offset, maxsize int64) {
var goffset, gmaxsize C.gsize
gsize := C.gst_buffer_get_sizes(b.Instance(), &goffset, &gmaxsize)
return int64(gsize), int64(goffset), int64(gmaxsize)
}
// GetSizesRange will get the total size of length memory blocks stating from idx in buffer.
//
// Offset will contain the offset of the data in the memory block in buffer at idx and maxsize will
// contain the sum of the size and offset and the amount of extra padding on the memory block at
// idx + length -1. Offset and maxsize can be used to resize the buffer memory blocks with ResizeRange.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) GetSizesRange(idx uint, length int) (offset, maxsize int64) {
var goffset, gmaxsize C.gsize
C.gst_buffer_get_sizes_range(b.Instance(), C.guint(idx), C.gint(length), &goffset, &gmaxsize)
return int64(goffset), int64(gmaxsize)
}
// HasFlags returns true if this Buffer has the given BufferFlags.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) HasFlags(flags BufferFlags) bool {
return gobool(C.gst_buffer_has_flags(b.Instance(), C.GstBufferFlags(flags)))
}
// InsertMemory insert the memory block to the buffer at idx. This function takes ownership of the Memory
// and thus doesn't increase its refcount.
//
// Only the value from GetMaxBufferMemory can be added to a buffer. If more memory is added, existing memory
// blocks will automatically be merged to make room for the new memory.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) InsertMemory(mem *Memory, idx int) {
C.gst_buffer_insert_memory(b.Instance(), C.gint(idx), mem.Ref().Instance())
}
// IsAllMemoryWritable checks if all memory blocks in buffer are writable.
//
// Note that this function does not check if buffer is writable, use IsWritable to check that if needed.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) IsAllMemoryWritable() bool {
return gobool(C.gst_buffer_is_all_memory_writable(b.Instance()))
}
// IsMemoryRangeWritable checks if length memory blocks in the buffer starting from idx are writable.
//
// Length can be -1 to check all the memory blocks after idx.
//
// Note that this function does not check if buffer is writable, use IsWritable to check that if needed.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) IsMemoryRangeWritable(idx uint, length int) bool {
return gobool(C.gst_buffer_is_memory_range_writable(b.Instance(), C.guint(idx), C.gint(length)))
}
// IsWritable returns true if this buffer is writable.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) IsWritable() bool {
return gobool(C.bufferIsWritable(b.Instance()))
}
// MakeWritable returns a writable copy of this buffer. If the source buffer is already writable,
// this will simply return the same buffer.
//
// Use this function to ensure that a buffer can be safely modified before making changes to it,
// including changing the metadata such as PTS/DTS.
//
// If the reference count of the source buffer buf is exactly one, the caller is the sole owner and
// this function will return the buffer object unchanged.
//
// If there is more than one reference on the object, a copy will be made using gst_buffer_copy. The passed-in buf
// will be unreffed in that case, and the caller will now own a reference to the new returned buffer object. Note that
// this just copies the buffer structure itself, the underlying memory is not copied if it can be shared amongst
// multiple buffers.
//
// In short, this function unrefs the buf in the argument and refs the buffer that it returns. Don't access the argument
// after calling this function unless you have an additional reference to it.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) MakeWritable() *Buffer {
return wrapBuffer(C.makeBufferWritable(b.Instance()))
}
// IterateMeta retrieves the next Meta after the given one. If state points to nil, the first Meta is returned.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) IterateMeta(meta *Meta) *Meta {
ptr := unsafe.Pointer(meta.Instance())
return wrapMeta(C.gst_buffer_iterate_meta(b.Instance(), (*C.gpointer)(&ptr)))
}
// IterateMetaFiltered is similar to IterateMeta except it will filter on the api type.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) IterateMetaFiltered(meta *Meta, apiType glib.Type) *Meta {
ptr := unsafe.Pointer(meta.Instance())
return wrapMeta(C.gst_buffer_iterate_meta_filtered(b.Instance(), (*C.gpointer)(&ptr), C.GType(apiType)))
}
// Map will map the data inside this buffer. This function can return nil if the memory is not read or writable.
// It is safe to call this function multiple times on a single Buffer, however it will retain the flags
// used when mapping the first time. To change between read and write access first unmap and then remap the
// buffer with the appropriate flags, or map initially with both read/write access.
//
// Unmap the Buffer after usage.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) Map(flags MapFlags) *MapInfo {
if b.mapInfo != nil {
return b.mapInfo
}
var mapInfo C.GstMapInfo
C.gst_buffer_map(
(*C.GstBuffer)(b.Instance()),
(*C.GstMapInfo)(&mapInfo),
C.GstMapFlags(flags),
)
b.mapInfo = wrapMapInfo((*C.GstMapInfo)(&mapInfo))
return b.mapInfo
}
// Unmap will unmap the data inside this memory. Use this after calling Map on the buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) Unmap() {
if b.mapInfo == nil {
return
}
C.gst_buffer_unmap(b.Instance(), (*C.GstMapInfo)(b.mapInfo.Instance()))
b.mapInfo = nil
}
// MapRange maps the info of length merged memory blocks starting at idx in buffer.
// When length is -1, all memory blocks starting from idx are merged and mapped.
//
// Flags describe the desired access of the memory. When flags is MapWrite, buffer should be writable (as returned from IsWritable).
//
// When the buffer is writable but the memory isn't, a writable copy will automatically be
// created and returned. The readonly copy of the buffer memory will then also be replaced with this writable copy.
//
// Unmap the Buffer after usage.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) MapRange(idx uint, length int, flags MapFlags) *MapInfo {
if b.mapInfo != nil {
return b.mapInfo
}
var mapInfo C.GstMapInfo
C.gst_buffer_map_range(
(*C.GstBuffer)(b.Instance()),
C.guint(idx), C.gint(length),
(*C.GstMapInfo)(&mapInfo),
C.GstMapFlags(flags),
)
b.mapInfo = wrapMapInfo((*C.GstMapInfo)(&mapInfo))
return b.mapInfo
}
// Memset fills buf with size bytes with val starting from offset. It returns the
// size written to the buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) Memset(offset int64, val uint8, size int64) int64 {
return int64(C.gst_buffer_memset(b.Instance(), C.gsize(offset), C.guint8(val), C.gsize(size)))
}
// NumMemoryBlocks returns the number of memory blocks this buffer has.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) NumMemoryBlocks() uint { return uint(C.gst_buffer_n_memory(b.Instance())) }
// PeekMemory gets the memory block at idx in buffer. The memory block stays valid until the
// memory block is removed, replaced, or merged. Typically with any call that modifies the memory in buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) PeekMemory(idx uint) *Memory {
mem := C.gst_buffer_peek_memory(b.Instance(), C.guint(idx))
if mem == nil {
return nil
}
return FromGstMemoryUnsafeNone(unsafe.Pointer(mem))
}
// PrependMemory prepends the memory block mem to this buffer. This function takes ownership of
// mem and thus doesn't increase its refcount.
//
// This function is identical to InsertMemory with an index of 0.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) PrependMemory(mem *Memory) {
C.gst_buffer_prepend_memory(b.Instance(), mem.Ref().Instance())
}
// RemoveAllMemory removes all memory blocks in the buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) RemoveAllMemory() { C.gst_buffer_remove_all_memory(b.Instance()) }
// RemoveMemoryAt removes the memory block at the given index.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) RemoveMemoryAt(idx uint) { C.gst_buffer_remove_memory(b.Instance(), C.guint(idx)) }
// RemoveMemoryRange removes length memory blocks in buffer starting from idx.
//
// Length can be -1, in which case all memory starting from idx is removed.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) RemoveMemoryRange(idx uint, length int) {
C.gst_buffer_remove_memory_range(b.Instance(), C.guint(idx), C.gint(length))
}
// RemoveMeta removes the given metadata from the buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) RemoveMeta(meta *Meta) bool {
return gobool(C.gst_buffer_remove_meta(b.Instance(), meta.Instance()))
}
// ReplaceAllMemory replaces all the memory in this buffer with that provided.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) ReplaceAllMemory(mem *Memory) {
C.gst_buffer_replace_all_memory(b.Instance(), mem.Ref().Instance())
}
// ReplaceMemory replaces the memory at the given index with the given memory.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) ReplaceMemory(mem *Memory, idx uint) {
C.gst_buffer_replace_memory(b.Instance(), C.guint(idx), mem.Ref().Instance())
}
// ReplaceMemoryRange replaces length memory blocks in the buffer starting at idx with
// the given memory.
//
// If length is -1, all memory starting from idx will be removed and replaced.
//
// The buffer should be writable.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) ReplaceMemoryRange(idx uint, length int, mem *Memory) {
C.gst_buffer_replace_memory_range(b.Instance(), C.guint(idx), C.gint(length), mem.Ref().Instance())
}
// Resize sets the offset and total size of the memory blocks in this buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) Resize(offset, size int64) {
C.gst_buffer_resize(b.Instance(), C.gssize(offset), C.gssize(size))
}
// ResizeRange sets the total size of the length memory blocks starting at idx in this buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) ResizeRange(idx uint, length int, offset, size int64) bool {
return gobool(C.gst_buffer_resize_range(
b.Instance(),
C.guint(idx),
C.gint(length),
C.gssize(offset),
C.gssize(size),
))
}
// SetFlags sets one or more buffer flags on the buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) SetFlags(flags BufferFlags) bool {
return gobool(C.gst_buffer_set_flags(b.Instance(), C.GstBufferFlags(flags)))
}
// SetSize sets the total size of the memory blocks in buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) SetSize(size int64) {
C.gst_buffer_set_size(b.Instance(), C.gssize(size))
}
// UnsetFlags removes one or more flags from the buffer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Buffer) UnsetFlags(flags BufferFlags) bool {
return gobool(C.gst_buffer_unset_flags(b.Instance(), C.GstBufferFlags(flags)))
}

View File

@@ -1,196 +0,0 @@
package gst
/*
#include "gst.go.h"
extern gboolean goBufferListForEachCb (GstBuffer ** buffer, guint idx, gpointer user_data);
gboolean cgoBufferListForEachCb (GstBuffer ** buffer, guint idx, gpointer user_data)
{
return goBufferListForEachCb(buffer, idx, user_data);
}
*/
import "C"
import (
"runtime"
"unsafe"
gopointer "github.com/go-gst/go-pointer"
)
// BufferList is a go wrapper around a GstBufferList for grouping Buffers
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type BufferList struct {
ptr *C.GstBufferList
}
// NewBufferList returns a new BufferList. The given slice can be nil and the returned
// buffer list will be empty.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewBufferList(buffers []*Buffer) *BufferList {
bufList := FromGstBufferListUnsafeFull(unsafe.Pointer(C.gst_buffer_list_new()))
if buffers == nil {
return bufList
}
for idx, buf := range buffers {
bufList.Insert(idx, buf)
}
return bufList
}
// NewBufferListSized creates a new BufferList with the given size.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewBufferListSized(size uint) *BufferList {
return FromGstBufferListUnsafeFull(unsafe.Pointer(C.gst_buffer_list_new_sized(C.guint(size))))
}
// FromGstBufferListUnsafeNone is used for returns from transfer-none methods.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstBufferListUnsafeNone(buf unsafe.Pointer) *BufferList {
wrapped := wrapBufferList((*C.GstBufferList)(buf))
wrapped.Ref()
runtime.SetFinalizer(wrapped, (*BufferList).Unref)
return wrapped
}
// FromGstBufferListUnsafeFull wraps the given buffer without taking an additional reference.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstBufferListUnsafeFull(buf unsafe.Pointer) *BufferList {
wrapped := wrapBufferList((*C.GstBufferList)(buf))
runtime.SetFinalizer(wrapped, (*BufferList).Unref)
return wrapped
}
// ToGstBufferList converts the given pointer into a BufferList without affecting the ref count or
// placing finalizers.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func ToGstBufferList(buf unsafe.Pointer) *BufferList {
return wrapBufferList((*C.GstBufferList)(buf))
}
// Instance returns the underlying GstBufferList.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferList) Instance() *C.GstBufferList { return C.toGstBufferList(unsafe.Pointer(b.ptr)) }
// CalculateSize calculates the size of the data contained in this buffer list by adding the size of all buffers.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferList) CalculateSize() int64 {
return int64(C.gst_buffer_list_calculate_size(b.Instance()))
}
// Copy creates a shallow copy of the given buffer list. This will make a newly allocated copy of the
// source list with copies of buffer pointers. The refcount of buffers pointed to will be increased by one.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferList) Copy() *BufferList {
return FromGstBufferListUnsafeFull(unsafe.Pointer(C.gst_buffer_list_copy(b.Instance())))
}
// DeepCopy creates a copy of the given buffer list. This will make a newly allocated copy of each buffer
// that the source buffer list contains.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferList) DeepCopy() *BufferList {
return FromGstBufferListUnsafeFull(unsafe.Pointer(C.gst_buffer_list_copy_deep(b.Instance())))
}
// IsWritable returns true if this BufferList is writable.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferList) IsWritable() bool {
return gobool(C.bufferListIsWritable(b.Instance()))
}
// MakeWritable makes a writable buffer list from this one. If the source buffer list is already writable,
// this will simply return the same buffer list. A copy will otherwise be made using Copy.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferList) MakeWritable() *BufferList {
return FromGstBufferListUnsafeFull(unsafe.Pointer(C.makeBufferListWritable(b.Instance())))
}
// ForEach calls the given function for each buffer in list.
//
// The function can modify the passed buffer pointer or its contents. The return value defines if this
// function returns or if the remaining buffers in the list should be skipped.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferList) ForEach(f func(buf *Buffer, idx uint) bool) {
fPtr := gopointer.Save(f)
defer gopointer.Unref(fPtr)
C.gst_buffer_list_foreach(
b.Instance(),
C.GstBufferListFunc(C.cgoBufferListForEachCb),
(C.gpointer)(unsafe.Pointer(fPtr)),
)
}
// GetBufferAt gets the buffer at idx.
//
// You must make sure that idx does not exceed the number of buffers available.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferList) GetBufferAt(idx uint) *Buffer {
return FromGstBufferUnsafeNone(unsafe.Pointer(C.gst_buffer_list_get(b.Instance(), C.guint(idx))))
}
// GetWritableBufferAt gets the buffer at idx, ensuring it is a writable buffer.
//
// You must make sure that idx does not exceed the number of buffers available.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferList) GetWritableBufferAt(idx uint) *Buffer {
return FromGstBufferUnsafeNone(unsafe.Pointer(C.gst_buffer_list_get_writable(b.Instance(), C.guint(idx))))
}
// Insert inserts a buffer at idx in the list. Other buffers are moved to make room for this new buffer.
//
// A -1 value for idx will append the buffer at the end.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferList) Insert(idx int, buf *Buffer) {
C.gst_buffer_list_insert(b.Instance(), C.gint(idx), buf.Ref().Instance())
}
// Length returns the number of buffers in the list.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferList) Length() uint {
return uint(C.gst_buffer_list_length(b.Instance()))
}
// Ref increases the refcount of the given buffer list by one.
//
// Note that the refcount affects the writability of list and its data, see MakeWritable.
// It is important to note that keeping additional references to GstBufferList instances
// can potentially increase the number of memcpy operations in a pipeline.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferList) Ref() *BufferList {
C.gst_buffer_list_ref(b.Instance())
return b
}
// Remove removes length buffers from the list starting at index. All following buffers
// are moved to close the gap.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferList) Remove(idx, length uint) {
C.gst_buffer_list_remove(b.Instance(), C.guint(idx), C.guint(length))
}
// Unref decreases the refcount of the buffer list. If the refcount reaches 0, the buffer
// list will be freed.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferList) Unref() {
C.gst_buffer_list_unref(b.Instance())
}

View File

@@ -1,308 +0,0 @@
package gst
/*
#include "gst.go.h"
*/
import "C"
import (
"unsafe"
"github.com/go-gst/go-glib/glib"
)
// BufferPool is a go wrapper around a GstBufferPool.
//
// For more information refer to the official documentation:
// https://gstreamer.freedesktop.org/documentation/gstreamer/gstbufferpool.html?gi-language=c
type BufferPool struct{ *Object }
// NewBufferPool returns a new BufferPool instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewBufferPool() *BufferPool {
pool := C.gst_buffer_pool_new()
return FromGstBufferPoolUnsafeFull(unsafe.Pointer(pool))
}
// FromGstBufferPoolUnsafeNone wraps the given unsafe.Pointer in a BufferPool instance. It takes a
// ref and places a runtime finalizer on the resulting object.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstBufferPoolUnsafeNone(bufferPool unsafe.Pointer) *BufferPool {
pool := wrapBufferPool(glib.TransferNone(bufferPool))
return pool
}
// // FromGstBufferPoolUnsafe is an alias to FromGstBufferPoolUnsafeNone.
// func FromGstBufferPoolUnsafe(bufferPool unsafe.Pointer) *BufferPool {
// return FromGstBufferPoolUnsafeNone(bufferPool)
// }
// FromGstBufferPoolUnsafeFull wraps the given unsafe.Pointer in a BufferPool instance. It just
// places a runtime finalizer on the resulting object.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstBufferPoolUnsafeFull(bufferPool unsafe.Pointer) *BufferPool {
pool := wrapBufferPool(glib.TransferFull(bufferPool))
return pool
}
// Instance returns the underlying GstBufferPool instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferPool) Instance() *C.GstBufferPool { return C.toGstBufferPool(b.Unsafe()) }
// IsFlushing returns true if this BufferPool is currently flushing.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferPool) IsFlushing() bool { return gobool(C.bufferPoolIsFlushing(b.Instance())) }
// BufferPoolAcquireParams represents parameters to an AcquireBuffer call.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type BufferPoolAcquireParams struct {
Format Format // format (GstFormat) the format of start and stop
Start int64 // start (gint64) the start position
Stop int64 // stop (gint64) the stop position
Flags BufferPoolAcquireFlags // flags (GstBufferPoolAcquireFlags) additional flags
}
// AcquireBuffer acquires a buffer from this pool.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferPool) AcquireBuffer(params *BufferPoolAcquireParams) (*Buffer, FlowReturn) {
var buf *C.GstBuffer
if params != nil {
gparams := (*C.GstBufferPoolAcquireParams)(C.malloc(C.sizeof_GstBufferPoolAcquireParams))
defer C.free(unsafe.Pointer(gparams))
gparams.format = C.GstFormat(params.Format)
gparams.start = C.gint64(params.Start)
gparams.stop = C.gint64(params.Stop)
gparams.flags = C.GstBufferPoolAcquireFlags(params.Flags)
ret := C.gst_buffer_pool_acquire_buffer(b.Instance(), &buf, gparams)
if FlowReturn(ret) != FlowOK {
return nil, FlowReturn(ret)
}
return FromGstBufferUnsafeFull(unsafe.Pointer(buf)), FlowReturn(ret)
}
ret := C.gst_buffer_pool_acquire_buffer(b.Instance(), &buf, nil)
if FlowReturn(ret) != FlowOK {
return nil, FlowReturn(ret)
}
return FromGstBufferUnsafeFull(unsafe.Pointer(buf)), FlowReturn(ret)
}
// GetConfig retrieves a copy of the current configuration of the pool. This configuration can either
// be modified and used for the SetConfig call or it must be freed after usage with Free.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferPool) GetConfig() *BufferPoolConfig {
st := C.gst_buffer_pool_get_config(b.Instance())
if st == nil {
return nil
}
return &BufferPoolConfig{Structure: FromGstStructureUnsafe(unsafe.Pointer(st))}
}
// GetOptions retrieves a list of supported bufferpool options for the pool. An option would typically
// be enabled with AddOption.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferPool) GetOptions() []string {
opts := C.gst_buffer_pool_get_options(b.Instance())
defer C.g_free((C.gpointer)(unsafe.Pointer(opts)))
return goStrings(C.sizeOfGCharArray(opts), opts)
}
// HasOption returns true if this BufferPool supports the given option.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferPool) HasOption(opt string) bool {
gOpt := C.CString(opt)
defer C.free(unsafe.Pointer(gOpt))
return gobool(C.gst_buffer_pool_has_option(b.Instance(), (*C.gchar)(gOpt)))
}
// IsActive returns true if this BufferPool is active. A pool can be activated with SetActive.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferPool) IsActive() bool { return gobool(C.gst_buffer_pool_is_active(b.Instance())) }
// ReleaseBuffer releases the given buffer from the pool. The buffer should have previously been
// allocated from pool with AcquireBiffer.
//
// This function is usually called automatically when the last ref on buffer disappears.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferPool) ReleaseBuffer(buf *Buffer) {
C.gst_buffer_pool_release_buffer(b.Instance(), buf.Ref().Instance())
}
// SetActive can be used to control the active state of pool. When the pool is inactive, new calls to
// AcquireBuffer will return with FlowFlushing.
//
// Activating the bufferpool will preallocate all resources in the pool based on the configuration of the pool.
//
// Deactivating will free the resources again when there are no outstanding buffers. When there are outstanding buffers, they will be freed as soon as they are all returned to the pool.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferPool) SetActive(active bool) (ok bool) {
return gobool(C.gst_buffer_pool_set_active(b.Instance(), gboolean(active)))
}
// SetConfig sets the configuration of the pool. If the pool is already configured, and the configurations
// haven't changed, this function will return TRUE. If the pool is active, this method will return FALSE and
// active configurations will remain. Buffers allocated form this pool must be returned or else this function
// will do nothing and return FALSE.
//
// config is a GstStructure that contains the configuration parameters for the pool. A default and mandatory set
// of parameters can be configured with gst_buffer_pool_config_set_params, gst_buffer_pool_config_set_allocator
// and gst_buffer_pool_config_add_option.
//
// If the parameters in config can not be set exactly, this function returns FALSE and will try to update as much
// state as possible. The new state can then be retrieved and refined with GetConfig.
//
// This function takes ownership of the given structure.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferPool) SetConfig(cfg *BufferPoolConfig) bool {
return gobool(C.gst_buffer_pool_set_config(b.Instance(), cfg.Instance()))
}
// SetFlushing enables or disable the flushing state of a pool without freeing or allocating buffers.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferPool) SetFlushing(flushing bool) {
C.gst_buffer_pool_set_flushing(b.Instance(), gboolean(flushing))
}
// BufferPoolConfig wraps the Structure interface with extra methods for interacting with BufferPool
// configurations.
type BufferPoolConfig struct{ *Structure }
// AddOption enables the option in config. This will instruct the bufferpool to enable the specified option
// on the buffers that it allocates.
//
// The supported options by pool can be retrieved with GetOptions.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferPoolConfig) AddOption(opt string) {
cOpt := C.CString(opt)
defer C.free(unsafe.Pointer(cOpt))
C.gst_buffer_pool_config_add_option(b.Instance(), (*C.gchar)(unsafe.Pointer(cOpt)))
}
// GetAllocator retrieves the allocator and params from config.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferPoolConfig) GetAllocator() (*Allocator, *AllocationParams) {
var allocator *C.GstAllocator
var params C.GstAllocationParams
C.gst_buffer_pool_config_get_allocator(b.Instance(), &allocator, &params)
var allo *Allocator
if allocator != nil {
allo = wrapAllocator(glib.TransferNone(unsafe.Pointer(allocator)))
}
return allo, &AllocationParams{ptr: &params}
}
// GetOption retrieves the option at index of the options API array.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferPoolConfig) GetOption(index uint) string {
return C.GoString(C.gst_buffer_pool_config_get_option(b.Instance(), C.guint(index)))
}
// GetParams retrieves the values from this config. All params return 0 or nil if they could not be fetched.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferPoolConfig) GetParams() (caps *Caps, size, minBuffers, maxBuffers uint) {
var gcaps *C.GstCaps
var gsize, gminBuffers, gmaxBuffers C.guint
ret := gobool(C.gst_buffer_pool_config_get_params(
b.Instance(),
&gcaps,
&gsize,
&gminBuffers,
&gmaxBuffers,
))
if ret {
return wrapCaps(gcaps), uint(gsize), uint(gminBuffers), uint(gmaxBuffers)
}
return nil, 0, 0, 0
}
// HasOption returns true if this config has the given option.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferPoolConfig) HasOption(opt string) bool {
cOpt := C.CString(opt)
defer C.free(unsafe.Pointer(cOpt))
return gobool(C.gst_buffer_pool_config_has_option(b.Instance(), (*C.gchar)(unsafe.Pointer(cOpt))))
}
// NumOptions retrieves the number of values currently stored in the options array of the config structure.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferPoolConfig) NumOptions() uint {
return uint(C.gst_buffer_pool_config_n_options(b.Instance()))
}
// SetAllocator sets the allocator and params on config.
//
// One of allocator and params can be nil, but not both. When allocator is nil, the default allocator of
// the pool will use the values in param to perform its allocation. When param is nil, the pool will use
// the provided allocator with its default AllocationParams.
//
// A call to SetConfig on the BufferPool can update the allocator and params with the values that it is able to do.
// Some pools are, for example, not able to operate with different allocators or cannot allocate with the values
// specified in params. Use GetConfig on the pool to get the currently used values.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferPoolConfig) SetAllocator(allocator *Allocator, params *AllocationParams) {
if allocator == nil && params != nil {
C.gst_buffer_pool_config_set_allocator(b.Instance(), nil, params.Instance())
return
}
if allocator != nil && params == nil {
C.gst_buffer_pool_config_set_allocator(b.Instance(), allocator.Instance(), nil)
return
}
if allocator != nil && params != nil {
C.gst_buffer_pool_config_set_allocator(b.Instance(), allocator.Instance(), params.Instance())
}
}
// SetParams configures the config with the given parameters.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferPoolConfig) SetParams(caps *Caps, size, minBuffers, maxBuffers uint) {
if caps == nil {
C.gst_buffer_pool_config_set_params(
b.Instance(),
nil,
C.guint(size), C.guint(minBuffers), C.guint(maxBuffers),
)
return
}
C.gst_buffer_pool_config_set_params(
b.Instance(),
caps.Instance(),
C.guint(size), C.guint(minBuffers), C.guint(maxBuffers),
)
}
// Validate that changes made to config are still valid in the context of the expected parameters. This function is a
// helper that can be used to validate changes made by a pool to a config when SetConfig returns FALSE. This expects
// that caps haven't changed and that min_buffers aren't lower then what we initially expected. This does not check if
// options or allocator parameters are still valid, and won't check if size have changed, since changing the size is valid
// to adapt padding.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *BufferPoolConfig) Validate(caps *Caps, size, minBuffers, maxBuffers uint) bool {
return gobool(C.gst_buffer_pool_config_validate_params(
b.Instance(),
caps.Instance(),
C.guint(size), C.guint(minBuffers), C.guint(maxBuffers),
))
}

View File

@@ -1,387 +0,0 @@
package gst
/*
#include "gst.go.h"
extern GstBusSyncReply goBusSyncHandler (GstBus * bus, GstMessage * message, gpointer user_data);
extern gboolean goBusFunc (GstBus * bus, GstMessage * msg, gpointer user_data);
extern void goUnrefGopointerUserData (gpointer);
gboolean cgoBusFunc (GstBus * bus, GstMessage * msg, gpointer user_data)
{
return goBusFunc(bus, msg, user_data);
}
void cgoUnrefGopointerUserData (gpointer data)
{
goUnrefGopointerUserData(data);
}
GstBusSyncReply cgoBusSyncHandler (GstBus * bus, GstMessage * message, gpointer user_data)
{
return goBusSyncHandler(bus, message, user_data);
}
*/
import "C"
import (
"reflect"
"unsafe"
"github.com/go-gst/go-glib/glib"
gopointer "github.com/go-gst/go-pointer"
)
// Bus is a Go wrapper around a GstBus. It provides convenience methods for
// popping messages from the queue.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type Bus struct {
*Object
}
// NewBus returns a new Bus instance.
//
// // Example of using the bus instance
//
// package main
//
// import (
// "fmt"
//
// "github.com/go-gst/go-gst/gst"
// )
//
// func main() {
// gst.Init(nil)
//
// bus := gst.NewBus()
//
// elem, err := gst.NewElement("fakesrc")
// if err != nil {
// panic(err)
// }
//
// bus.Post(gst.NewAsyncStartMessage(elem))
//
// msg := bus.Pop()
//
// fmt.Println(msg)
// }
//
// // > [fakesrc0] ASYNC-START - Async task started
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewBus() *Bus {
return FromGstBusUnsafeFull(unsafe.Pointer(C.gst_bus_new()))
}
// FromGstBusUnsafeNone wraps the given unsafe.Pointer in a bus. It takes a ref on the bus and sets
// a runtime finalizer on it.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstBusUnsafeNone(bus unsafe.Pointer) *Bus { return wrapBus(glib.TransferNone(bus)) }
// FromGstBusUnsafeFull wraps the given unsafe.Pointer in a bus. It does not increase the ref count
// and places a runtime finalizer on the instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstBusUnsafeFull(bus unsafe.Pointer) *Bus { return wrapBus(glib.TransferFull(bus)) }
// Instance returns the underlying GstBus instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bus) Instance() *C.GstBus { return C.toGstBus(b.Unsafe()) }
// AddSignalWatch adds a bus signal watch to the default main context with the default priority (%G_PRIORITY_DEFAULT).
// It is also possible to use a non-default main context set up using g_main_context_push_thread_default (before one
// had to create a bus watch source and attach it to the desired main context 'manually').
//
// After calling this statement, the bus will emit the "message" signal for each message posted on the bus.
//
// This function may be called multiple times. To clean up, the caller is responsible for calling RemoveSignalWatch
// as many times as this function is called.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bus) AddSignalWatch() { C.gst_bus_add_signal_watch(b.Instance()) }
// PopMessage attempts to pop a message from the bus. It returns nil if none are available.
//
// It is much safer and easier to use the AddWatch or other polling functions. Only use this method if you
// are unable to also run a MainLoop, or for convenience sake.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bus) PopMessage(timeout ClockTime) *Message {
return b.TimedPop(timeout)
}
// BlockPopMessage blocks until a message is available on the bus and then returns it.
// This function can return nil if the bus is closed.
//
// It is much safer and easier to use the AddWatch or other polling functions. Only use this method if you
// are unable to also run a MainLoop, or for convenience sake.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bus) BlockPopMessage() *Message {
for {
if b.Instance() == nil {
return nil
}
msg := b.PopMessage(1)
if msg == nil {
continue
}
return msg
}
}
// BusWatchFunc is a go representation of a GstBusFunc. It takes a message as a single argument
// and returns a bool value for whether to continue processing messages or not.
type BusWatchFunc func(msg *Message) bool
// AddWatch adds a watch to the default MainContext for messages emitted on this bus.
// This function is used to receive asynchronous messages in the main loop. There can
// only be a single bus watch per bus, you must remove it before you can set a new one.
//
// The watch can be removed either by returning false from the function or by using RemoveWatch().
// A MainLoop must be running for bus watches to work.
//
// The return value reflects whether the watch was successfully added. False is returned if there
// is already a function registered.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bus) AddWatch(busFunc BusWatchFunc) bool {
fPtr := gopointer.Save(busFunc)
return gobool(
C.int(C.gst_bus_add_watch_full(
b.Instance(),
C.G_PRIORITY_DEFAULT,
C.GstBusFunc(C.cgoBusFunc),
(C.gpointer)(unsafe.Pointer(fPtr)),
C.GDestroyNotify(C.cgoUnrefGopointerUserData),
)),
)
}
// CreateWatch creates a watch and returns the GSource to be added to a main loop.
// TODO: the return values from this function should be type casted and the MainLoop
// should offer methods for using the return of this function.
// func (b *Bus) CreateWatch() *C.GSource {
// return C.gst_bus_create_watch(b.Instance())
// }
// RemoveWatch will remove any watches installed on the bus. This can also be accomplished
// by returning false from a previously installed function.
//
// The function returns false if there was no watch on the bus.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bus) RemoveWatch() bool {
return gobool(C.gst_bus_remove_watch(b.Instance()))
}
// RemoveSignalWatch removes a signal watch previously added with AddSignalWatch.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bus) RemoveSignalWatch() { C.gst_bus_remove_signal_watch(b.Instance()) }
// DisableSyncMessageEmission instructs GStreamer to stop emitting the "sync-message" signal for this bus.
// See EnableSyncMessageEmission for more information.
//
// In the event that multiple pieces of code have called EnableSyncMessageEmission, the sync-message emissions
// will only be stopped after all calls to EnableSyncMessageEmission were "canceled" by calling this function.
// In this way the semantics are exactly the same as Ref that which calls enable should also call disable.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bus) DisableSyncMessageEmission() { C.gst_bus_disable_sync_message_emission(b.Instance()) }
// EnableSyncMessageEmission instructs GStreamer to emit the "sync-message" signal after running the bus's sync handler.
// This function is here so that code can ensure that they can synchronously receive messages without having to affect
// what the bin's sync handler is.
//
// This function may be called multiple times. To clean up, the caller is responsible for calling DisableSyncMessageEmission
// as many times as this function is called.
//
// While this function looks similar to AddSignalWatch, it is not exactly the same -- this function enables *synchronous*
// emission of signals when messages arrive; AddSignalWatch adds an idle callback to pop messages off the bus asynchronously.
// The sync-message signal comes from the thread of whatever object posted the message; the "message" signal is marshaled
// to the main thread via the main loop.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bus) EnableSyncMessageEmission() { C.gst_bus_enable_sync_message_emission(b.Instance()) }
// PollFd represents the possible values returned from a GetPollFd. On Windows, there will not be
// a Fd.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type PollFd struct {
Fd int
Events, REvents uint
}
// GetPollFd gets the file descriptor from the bus which can be used to get notified about messages being available with
// functions like g_poll, and allows integration into other event loops based on file descriptors. Whenever a message is
// available, the POLLIN / G_IO_IN event is set.
//
// Warning: NEVER read or write anything to the returned fd but only use it for getting notifications via g_poll or similar
// and then use the normal GstBus API, e.g. PopMessage.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bus) GetPollFd() *PollFd {
var gpollFD C.GPollFD
C.gst_bus_get_pollfd(b.Instance(), &gpollFD)
pollFd := &PollFd{
Events: uint(gpollFD.events),
REvents: uint(gpollFD.revents),
}
if fd := reflect.ValueOf(&gpollFD).Elem().FieldByName("fd"); fd.IsValid() {
pollFd.Fd = int(fd.Interface().(C.gint))
}
return pollFd
}
// HavePending checks if there are pending messages on the bus that should be handled.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bus) HavePending() bool {
return gobool(C.gst_bus_have_pending(b.Instance()))
}
// Peek peeks the message on the top of the bus' queue. The message will remain on the bus'
// message queue.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bus) Peek() *Message {
msg := C.gst_bus_peek(b.Instance())
if msg == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(msg))
}
// Poll the bus for messages. Will block while waiting for messages to come. You can specify a maximum
// time to poll with the timeout parameter. If timeout is negative, this function will block indefinitely.
//
// All messages not in events will be popped off the bus and will be ignored. It is not possible to use message
// enums beyond MessageExtended in the events mask.
//
// Because poll is implemented using the "message" signal enabled by AddSignalWatch, calling Poll will cause the
// "message" signal to be emitted for every message that poll sees. Thus a "message" signal handler will see the
// same messages that this function sees -- neither will steal messages from the other.
//
// This function will run a main loop from the default main context when polling.
//
// You should never use this function, since it is pure evil. This is especially true for GUI applications based
// on Gtk+ or Qt, but also for any other non-trivial application that uses the GLib main loop. As this function
// runs a GLib main loop, any callback attached to the default GLib main context may be invoked. This could be
// timeouts, GUI events, I/O events etc.; even if Poll is called with a 0 timeout. Any of these callbacks
//
// may do things you do not expect, e.g. destroy the main application window or some other resource; change other
//
// application state; display a dialog and run another main loop until the user clicks it away. In short, using this
// function may add a lot of complexity to your code through unexpected re-entrancy and unexpected changes to your
// application's state.
//
// For 0 timeouts use gst_bus_pop_filtered instead of this function; for other short timeouts use TimedPopFiltered;
// everything else is better handled by setting up an asynchronous bus watch and doing things from there.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bus) Poll(msgTypes MessageType, timeout ClockTime) *Message {
cTime := C.GstClockTime(timeout)
mType := C.GstMessageType(msgTypes)
msg := C.gst_bus_poll(b.Instance(), mType, cTime)
if msg == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(msg))
}
// Pop pops a message from the bus, or returns nil if none are available.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bus) Pop() *Message {
msg := C.gst_bus_pop(b.Instance())
if msg == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(msg))
}
// PopFiltered gets a message matching type from the bus. Will discard all messages on the bus that do not match type
// and that have been posted before the first message that does match type. If there is no message matching type on the
// bus, all messages will be discarded. It is not possible to use message enums beyond MessageExtended in the events mask.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bus) PopFiltered(msgTypes MessageType) *Message {
mType := C.GstMessageType(msgTypes)
msg := C.gst_bus_pop_filtered(b.Instance(), mType)
if msg == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(msg))
}
// Post a new message on the bus. The bus takes ownership of the message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bus) Post(msg *Message) bool {
return gobool(C.gst_bus_post(b.Instance(), msg.Ref().Instance()))
}
// SetFlushing sets whether to flush out and unref any messages queued in the bus. Releases references to the message origin
// objects. Will flush future messages until SetFlushing sets flushing to FALSE.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bus) SetFlushing(flushing bool) { C.gst_bus_set_flushing(b.Instance(), gboolean(flushing)) }
// BusSyncHandler will be invoked synchronously, when a new message has been injected into the bus. This function is mostly
// used internally. Only one sync handler can be attached to a given bus.
//
// If the handler returns BusDrop, it should unref the message, else the message should not be unreffed by the sync handler.
type BusSyncHandler func(msg *Message) BusSyncReply
// SetSyncHandler sets the synchronous handler on the bus. The function will be called every time a new message is posted on the bus.
// Note that the function will be called in the same thread context as the posting object. This function is usually only called by the
// creator of the bus. Applications should handle messages asynchronously using the watch and poll functions.
//
// Currently, destroyNotify funcs are not supported.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bus) SetSyncHandler(f BusSyncHandler) {
ptr := gopointer.Save(f)
C.gst_bus_set_sync_handler(
b.Instance(),
C.GstBusSyncHandler(C.cgoBusSyncHandler),
(C.gpointer)(unsafe.Pointer(ptr)),
C.GDestroyNotify(C.cgoUnrefGopointerUserData),
)
}
// TimedPop gets a message from the bus, waiting up to the specified timeout.
//
// If timeout is 0, this function behaves like Pop. If timeout is ClockTimeNone, this function will block forever until a message was posted on the bus.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bus) TimedPop(dur ClockTime) *Message {
msg := C.gst_bus_timed_pop(b.Instance(), C.GstClockTime(dur))
if msg == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(msg))
}
// TimedPopFiltered gets a message from the bus whose type matches the message type mask types, waiting up to the specified timeout
// (and discarding any messages that do not match the mask provided).
//
// If timeout is 0, this function behaves like PopFiltered. If timeout is ClockTimeNone, this function will block forever until a matching message
// was posted on the bus.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (b *Bus) TimedPopFiltered(dur ClockTime, msgTypes MessageType) *Message {
msg := C.gst_bus_timed_pop_filtered(b.Instance(), C.GstClockTime(dur), C.GstMessageType(msgTypes))
if msg == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(msg))
}

View File

@@ -1,594 +0,0 @@
package gst
/*
#include "gst.go.h"
extern gboolean goCapsMapFunc (GstCapsFeatures * features, GstStructure * structure, gpointer user_data);
gboolean cgoCapsMapFunc (GstCapsFeatures * features, GstStructure * structure, gpointer user_data)
{
return goCapsMapFunc(features, structure, user_data);
}
*/
import "C"
import (
"runtime"
"unsafe"
"github.com/go-gst/go-glib/glib"
gopointer "github.com/go-gst/go-pointer"
)
// TypeCaps is the static Glib Type for a GstCaps.
var TypeCaps = glib.Type(C.gst_caps_get_type())
var _ glib.ValueTransformer = &Caps{}
// Caps is a go wrapper around GstCaps.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type Caps struct {
native *C.GstCaps
}
// FromGstCapsUnsafeNone wraps the pointer to the given C GstCaps with the go type.
// This is meant for internal usage and is exported for visibility to other packages.
// A ref is taken on the caps and finalizer placed on the object.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstCapsUnsafeNone(caps unsafe.Pointer) *Caps {
if caps == nil {
return nil
}
gocaps := ToGstCaps(caps)
gocaps.Ref()
runtime.SetFinalizer(gocaps, (*Caps).Unref)
return gocaps
}
// FromGstCapsUnsafeFull wraps the pointer to the given C GstCaps with the go type.
// This is meant for internal usage and is exported for visibility to other packages.
// A finalizer is placed on the object to Unref after leaving scope.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstCapsUnsafeFull(caps unsafe.Pointer) *Caps {
if caps == nil {
return nil
}
gocaps := ToGstCaps(caps)
runtime.SetFinalizer(gocaps, (*Caps).Unref)
return gocaps
}
// ToGstCaps converts the given pointer into a Caps without affecting the ref count or
// placing finalizers.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func ToGstCaps(caps unsafe.Pointer) *Caps {
return wrapCaps(C.toGstCaps(caps))
}
// CapsMapFunc represents a function passed to the Caps MapInPlace, ForEach, and FilterAndMapInPlace methods.
type CapsMapFunc func(features *CapsFeatures, structure *Structure) bool
// NewAnyCaps creates a new caps that indicate compatibility with any format.
//
// caps := gst.NewAnyCaps()
// fmt.Println(caps.IsAny())
// // true
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewAnyCaps() *Caps { return FromGstCapsUnsafeFull(unsafe.Pointer(C.gst_caps_new_any())) }
// NewEmptyCaps creates a new empty caps object. This is essentially the opposite of
// NewAnyCamps.
//
// caps := gst.NewEmptyCaps()
// fmt.Println(caps.IsEmpty())
// // true
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewEmptyCaps() *Caps { return FromGstCapsUnsafeFull(unsafe.Pointer(C.gst_caps_new_empty())) }
// NewEmptySimpleCaps returns a new empty caps object with the given media format.
//
// caps := gst.NewEmptySimpleCaps("audio/x-raw")
// fmt.Println(caps.String())
// // audio/x-raw
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewEmptySimpleCaps(mediaFormat string) *Caps {
cFormat := C.CString(mediaFormat)
defer C.free(unsafe.Pointer(cFormat))
caps := C.gst_caps_new_empty_simple(cFormat)
return FromGstCapsUnsafeFull(unsafe.Pointer(caps))
}
// NewFullCaps creates a new caps from the given structures.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewFullCaps(structures ...*Structure) *Caps {
caps := NewEmptyCaps()
for _, st := range structures {
caps.AppendStructure(st)
}
return caps
}
// NewCapsFromString creates a new Caps object from the given string.
//
// caps := gst.NewCapsFromString("audio/x-raw, channels=2")
// fmt.Println(caps.String())
// // audio/x-raw, channels=(int)2
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewCapsFromString(capsStr string) *Caps {
cStr := C.CString(capsStr)
defer C.free(unsafe.Pointer(cStr))
caps := C.gst_caps_from_string(cStr)
if caps == nil {
return nil
}
return FromGstCapsUnsafeFull(unsafe.Pointer(caps))
}
// Unsafe returns an unsafe.Pointer to the underlying GstCaps.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) Unsafe() unsafe.Pointer { return unsafe.Pointer(c.native) }
// ToGValue returns a GValue containing the given caps.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) ToGValue() (*glib.Value, error) {
val, err := glib.ValueInit(glib.Type(C.gst_caps_get_type()))
if err != nil {
return nil, err
}
C.gst_value_set_caps((*C.GValue)(unsafe.Pointer(val.GValue)), c.Instance())
return val, nil
}
// Ref increases the ref count on these caps by one.
//
// From this point on, until the caller calls Unref or MakeWritable, it is guaranteed that the caps object
// will not change. This means its structures won't change, etc. To use a Caps object, you must always have a
// refcount on it -- either the one made implicitly by e.g. NewSimpleCaps, or via taking one explicitly with
// this function. Note that when a function provided by these bindings returns caps, or they are converted
// through the FromGstCapsUnsafe methods, a ref is automatically taken if necessary and a runtime Finalizer
// is used to remove it.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) Ref() *Caps {
C.gst_caps_ref(c.Instance())
return c
}
// Unref decreases the ref count on these caps by one.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) Unref() { C.gst_caps_unref(c.Instance()) }
// Instance returns the native GstCaps instance
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) Instance() *C.GstCaps { return C.toGstCaps(c.Unsafe()) }
// MakeWritable returns a writable copy of caps.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) MakeWritable() *Caps {
return FromGstCapsUnsafeFull(unsafe.Pointer(C.makeCapsWritable(c.Instance())))
}
// String implements a stringer on a caps instance. This same string can be used for NewCapsFromString.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) String() string {
cStr := C.gst_caps_to_string(c.Instance())
defer C.g_free((C.gpointer)(unsafe.Pointer(cStr)))
return C.GoString(cStr)
}
// AppendStructure appends the given structure to this caps instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) AppendStructure(st *Structure) {
C.gst_caps_append_structure(c.Instance(), st.Instance())
}
// AppendStructureFull appends structure with features to caps. The structure is not copied;
// caps becomes the owner of structure.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) AppendStructureFull(st *Structure, features *CapsFeatures) {
C.gst_caps_append_structure_full(c.Instance(), st.Instance(), features.Instance())
}
// Append appends the given caps element to these caps. These caps take ownership
// over the given object. If either caps are ANY, the resulting caps will be ANY.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) Append(caps *Caps) {
C.gst_caps_append(c.Instance(), caps.Ref().Instance())
}
// CanIntersect tries intersecting these caps with those given and reports whether the result would not be empty.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) CanIntersect(caps *Caps) bool {
return gobool(C.gst_caps_can_intersect(c.Instance(), caps.Instance()))
}
// Copy creates a new Caps as a copy of these. The new caps will have a refcount of 1, owned by the caller.
// The structures are copied as well.
//
// Note that this function is the semantic equivalent of a Ref followed by a MakeWritable.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) Copy() *Caps {
return FromGstCapsUnsafeFull(unsafe.Pointer(C.gst_caps_copy(c.Instance())))
}
// CopyNth creates a new GstCaps and appends a copy of the nth structure contained in caps.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) CopyNth(n uint) *Caps {
return FromGstCapsUnsafeFull(unsafe.Pointer(C.gst_caps_copy_nth(c.Instance(), C.guint(n))))
}
// FilterAndMapInPlace calls the provided function once for each structure and caps feature in the Caps.
// In contrast to ForEach, the function may modify the structure and features. In contrast to MapInPlace,
// the structure and features are removed from the caps if FALSE is returned from the function. The caps must be mutable.
//
// caps := gst.NewCapsFromString("audio/x-raw")
//
// caps.FilterAndMapInPlace(func(features *gst.CapsFeatures, structure *gst.Structure) bool {
// if features.Contains(gst.CapsFeatureMemorySystemMemory) {
// fmt.Println("Removing system memory feature")
// return false
// }
// return true
// })
//
// fmt.Println(caps.IsEmpty())
//
// // Removing system memory feature
// // true
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) FilterAndMapInPlace(f CapsMapFunc) {
ptr := gopointer.Save(f)
defer gopointer.Unref(ptr)
C.gst_caps_filter_and_map_in_place(
c.Instance(),
C.GstCapsFilterMapFunc(C.cgoCapsMapFunc),
(C.gpointer)(ptr),
)
}
// Fixate modifies the given caps into a representation with only fixed values. First the caps will be truncated and
// then the first structure will be fixated with Structure's Fixate.
//
// This function takes ownership of caps and will call gst_caps_make_writable on it so you must not use caps afterwards
// unless you keep an additional reference to it with Ref.
//
// Note that it is not guaranteed that the returned caps have exactly one structure. If caps are empty caps then then
// returned caps will be the empty too and contain no structure at all.
//
// Calling this function with any caps is not allowed.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) Fixate() *Caps {
return FromGstCapsUnsafeFull(unsafe.Pointer(C.gst_caps_fixate(c.Ref().Instance())))
}
// ForEach calls the provided function once for each structure and caps feature in the GstCaps. The function must not
// modify the fields. There is an unresolved bug in this function currently and it is better to use MapInPlace instead.
//
// caps := gst.NewCapsFromString("audio/x-raw")
//
// caps.ForEach(func(features *gst.CapsFeatures, structure *gst.Structure) bool {
// fmt.Println(structure)
// return true
// })
//
// // audio/x-raw;
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) ForEach(f CapsMapFunc) bool {
ptr := gopointer.Save(f)
defer gopointer.Unref(ptr)
return gobool(C.gst_caps_foreach(
c.Instance(),
C.GstCapsForeachFunc(C.cgoCapsMapFunc),
(C.gpointer)(ptr),
))
}
// GetSize returns the number of structures inside this caps instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) GetSize() int { return int(C.gst_caps_get_size(c.Instance())) }
// GetStructureAt returns the structure at the given index, or nil if none exists.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) GetStructureAt(idx int) *Structure {
st := C.gst_caps_get_structure(c.Instance(), C.guint(idx))
if st == nil {
return nil
}
s := wrapStructure(st)
// we don't own the structure, so keep the caps alive until we
// don't need the structure anymore
runtime.SetFinalizer(s, func(_ *Structure) {
runtime.KeepAlive(c)
})
return s
}
// GetFeaturesAt returns the feature at the given index, or nil if none exists.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) GetFeaturesAt(idx int) *CapsFeatures {
feats := C.gst_caps_get_features(c.Instance(), C.guint(idx))
if feats == nil {
return nil
}
return wrapCapsFeatures(feats)
}
// CapsIntersectMode represents the modes of caps intersection.
// See the official documentation for more details:
// https://gstreamer.freedesktop.org/documentation/gstreamer/gstcaps.html?gi-language=c#GstCapsIntersectMode
type CapsIntersectMode int
// Type castings of intersect modes
const (
CapsIntersectZigZag CapsIntersectMode = C.GST_CAPS_INTERSECT_ZIG_ZAG
CapsIntersectFirst CapsIntersectMode = C.GST_CAPS_INTERSECT_FIRST
)
// Intersect creates a new Caps that contains all the formats that are common to both these caps and those given.
// Defaults to CapsIntersectZigZag mode.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) Intersect(caps *Caps) *Caps {
return FromGstCapsUnsafeFull(unsafe.Pointer(C.gst_caps_intersect(c.Instance(), caps.Instance())))
}
// IntersectFull creates a new Caps that contains all the formats that are common to both these caps those given.
// The order is defined by the CapsIntersectMode used.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) IntersectFull(caps *Caps, mode CapsIntersectMode) *Caps {
return FromGstCapsUnsafeFull(unsafe.Pointer(C.gst_caps_intersect_full(c.Instance(), caps.Instance(), C.GstCapsIntersectMode(mode))))
}
// IsAlwaysCompatible returns if this structure is always compatible with another if every media format that is in
// the first is also contained in the second. That is, these caps are a subset of those given.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) IsAlwaysCompatible(caps *Caps) bool {
return gobool(C.gst_caps_is_always_compatible(c.Instance(), caps.Instance()))
}
// IsAny returns true if these caps match any media format.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) IsAny() bool { return gobool(C.gst_caps_is_any(c.Instance())) }
// IsEmpty returns true if these caps are empty.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) IsEmpty() bool { return gobool(C.gst_caps_is_empty(c.Instance())) }
// IsEqual returns true if the caps given represent the same set as these.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) IsEqual(caps *Caps) bool {
return gobool(C.gst_caps_is_equal(c.Instance(), caps.Instance()))
}
// IsEqualFixed tests if the Caps are equal. This function only works on fixed Caps.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) IsEqualFixed(caps *Caps) bool {
return gobool(C.gst_caps_is_equal_fixed(c.Instance(), caps.Instance()))
}
// IsFixed returns true if these caps are fixed, that is, they describe exactly one format.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) IsFixed() bool { return gobool(C.gst_caps_is_fixed(c.Instance())) }
// IsStrictlyEqual checks if the given caps are exactly the same set of caps.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) IsStrictlyEqual(caps *Caps) bool {
return gobool(C.gst_caps_is_strictly_equal(c.Instance(), caps.Instance()))
}
// IsSubset checks if all caps represented by these are also represented by those given.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) IsSubset(caps *Caps) bool {
return gobool(C.gst_caps_is_subset(c.Instance(), caps.Instance()))
}
// IsSubsetStructure checks if the given structure is a subset of these caps.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) IsSubsetStructure(structure *Structure) bool {
return gobool(C.gst_caps_is_subset_structure(c.Instance(), structure.Instance()))
}
// IsSubsetStructureFull checks if the given structure is a subset of these caps with features.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) IsSubsetStructureFull(structure *Structure, features *CapsFeatures) bool {
if features == nil {
return gobool(C.gst_caps_is_subset_structure_full(
c.Instance(), structure.Instance(), nil,
))
}
return gobool(C.gst_caps_is_subset_structure_full(
c.Instance(), structure.Instance(), features.Instance(),
))
}
// IsWritable returns true if these caps are writable.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) IsWritable() bool {
return gobool(C.capsIsWritable(c.Instance()))
}
// MapInPlace calls the provided function once for each structure and caps feature in the Caps.
// In contrast to ForEach, the function may modify, but not delete, the structures and features.
// The caps must be mutable.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) MapInPlace(f CapsMapFunc) bool {
ptr := gopointer.Save(f)
defer gopointer.Unref(ptr)
return gobool(C.gst_caps_map_in_place(
c.Instance(),
C.GstCapsMapFunc(C.cgoCapsMapFunc),
(C.gpointer)(ptr),
))
}
// Merge appends the structures contained in the given caps if they are not yet expressed by these.
// The structures in the given caps are not copied -- they are transferred to a writable copy of these ones,
// and then those given are freed. If either caps are ANY, the resulting caps will be ANY.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) Merge(caps *Caps) *Caps {
return FromGstCapsUnsafeFull(unsafe.Pointer(C.gst_caps_merge(c.Ref().Instance(), caps.Ref().Instance())))
}
// MergeStructure appends structure to caps if its not already expressed by caps.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) MergeStructure(structure *Structure) *Caps {
return FromGstCapsUnsafeFull(unsafe.Pointer(C.gst_caps_merge_structure(c.Ref().Instance(), structure.Instance())))
}
// MergeStructureFull appends structure with features to the caps if its not already expressed.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) MergeStructureFull(structure *Structure, features *CapsFeatures) *Caps {
if features == nil {
return FromGstCapsUnsafeFull(unsafe.Pointer(C.gst_caps_merge_structure_full(
c.Ref().Instance(), structure.Instance(), nil,
)))
}
return FromGstCapsUnsafeFull(unsafe.Pointer(C.gst_caps_merge_structure_full(
c.Ref().Instance(), structure.Instance(), features.Instance(),
)))
}
// Normalize returns a Caps that represents the same set of formats as caps, but contains no lists.
// Each list is expanded into separate GstStructures.
//
// This function takes ownership of caps and will call MakeWritable on it so you must not
// use caps afterwards unless you keep an additional reference to it with Ref.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) Normalize() *Caps {
return wrapCaps(C.gst_caps_normalize(c.Instance()))
}
// RemoveStructureAt removes the structure with the given index from the list of structures.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) RemoveStructureAt(idx uint) {
C.gst_caps_remove_structure(c.Instance(), C.guint(idx))
}
// SetFeaturesAt sets the CapsFeatures features for the structure at index.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) SetFeaturesAt(idx uint, features *CapsFeatures) {
if features == nil {
C.gst_caps_set_features(c.Instance(), C.guint(idx), nil)
return
}
C.gst_caps_set_features(c.Instance(), C.guint(idx), features.Instance())
}
// SetFeaturesSimple sets the CapsFeatures for all the structures of these caps.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) SetFeaturesSimple(features *CapsFeatures) {
if features == nil {
C.gst_caps_set_features_simple(c.Instance(), nil)
return
}
C.gst_caps_set_features_simple(c.Instance(), features.Instance())
}
// SetValue sets the given field on all structures of caps to the given value. This is a convenience
// function for calling SetValue on all structures of caps. If the value cannot be coerced to a C type,
// then nothing will happen.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) SetValue(field string, val interface{}) {
gVal, err := glib.GValue(val)
if err != nil {
return
}
C.gst_caps_set_value(
c.Instance(),
(*C.gchar)(unsafe.Pointer(C.CString(field))),
(*C.GValue)(unsafe.Pointer(gVal.GValue)),
)
}
// Simplify converts the given caps into a representation that represents the same set of formats, but in a
// simpler form. Component structures that are identical are merged. Component structures that have values
// that can be merged are also merged.
//
// This function takes ownership of caps and will call MakeWritable on it if necessary, so you must not use
// caps afterwards unless you keep an additional reference to it with Ref.
//
// This method does not preserve the original order of caps.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) Simplify() *Caps {
return FromGstCapsUnsafeFull(unsafe.Pointer(C.gst_caps_simplify(c.Ref().Instance())))
}
// StealStructureAt retrieves the structure with the given index from the list of structures contained in caps.
// The caller becomes the owner of the returned structure.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) StealStructureAt(idx uint) *Structure {
return wrapStructure(C.gst_caps_steal_structure(c.Instance(), C.guint(idx)))
}
// Subtract subtracts the given caps from these.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) Subtract(caps *Caps) *Caps {
return FromGstCapsUnsafeFull(unsafe.Pointer(C.gst_caps_subtract(c.Instance(), caps.Instance())))
}
// Truncate discards all but the first structure from caps. Useful when fixating.
//
// This function takes ownership of caps and will call gst_caps_make_writable on it if necessary, so you must not
// use caps afterwards unless you keep an additional reference to it with Ref.
//
// Note that it is not guaranteed that the returned caps have exactly one structure. If caps is any or empty caps
// then then returned caps will be the same and contain no structure at all.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Caps) Truncate() *Caps {
return FromGstCapsUnsafeFull(unsafe.Pointer(C.gst_caps_truncate(c.Ref().Instance())))
}

View File

@@ -1,196 +0,0 @@
package gst
// #include "gst.go.h"
import "C"
import (
"unsafe"
"github.com/go-gst/go-glib/glib"
)
// Go casting of pre-baked caps features
var (
CapsFeatureMemorySystemMemory string = C.GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY
)
// CapsFeatures is a go representation of GstCapsFeatures.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type CapsFeatures struct {
native *C.GstCapsFeatures
}
// NewCapsFeaturesEmpty returns a new empty CapsFeatures.
//
// feats := gst.NewCapsFeaturesEmpty()
// fmt.Println(feats.GetSize())
// // 0
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewCapsFeaturesEmpty() *CapsFeatures { return wrapCapsFeatures(C.gst_caps_features_new_empty()) }
// NewCapsFeaturesAny returns a new ANY CapsFeatures.
//
// feats := gst.NewCapsFeaturesAny()
// fmt.Println(feats.IsAny())
// // true
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewCapsFeaturesAny() *CapsFeatures { return wrapCapsFeatures(C.gst_caps_features_new_any()) }
// NewCapsFeaturesFromString creates new CapsFeatures from the given string.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewCapsFeaturesFromString(features string) *CapsFeatures {
cStr := C.CString(features)
defer C.free(unsafe.Pointer(cStr))
capsFeatures := C.gst_caps_features_from_string(cStr)
if capsFeatures == nil {
return nil
}
return wrapCapsFeatures(capsFeatures)
}
// TypeCapsFeatures is the glib.Type for a CapsFeatures.
var TypeCapsFeatures = glib.Type(C.gst_caps_features_get_type())
var _ glib.ValueTransformer = &CapsFeatures{}
// ToGValue implements a glib.ValueTransformer
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CapsFeatures) ToGValue() (*glib.Value, error) {
val, err := glib.ValueInit(TypeCapsFeatures)
if err != nil {
return nil, err
}
C.gst_value_set_caps_features(
(*C.GValue)(unsafe.Pointer(val.GValue)),
c.Instance(),
)
return val, nil
}
// Instance returns the native underlying GstCapsFeatures instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CapsFeatures) Instance() *C.GstCapsFeatures {
return C.toGstCapsFeatures(unsafe.Pointer(c.native))
}
// String implements a stringer on caps features.
//
// feats := gst.NewCapsFeaturesAny()
// fmt.Println(feats.String())
// // ANY
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CapsFeatures) String() string {
return C.GoString(C.gst_caps_features_to_string(c.Instance()))
}
// Add adds the given feature to these.
//
// feats := gst.NewCapsFeaturesEmpty()
//
// fmt.Println(feats.GetSize())
//
// feats.Add(gst.CapsFeatureMemorySystemMemory)
//
// fmt.Println(feats.GetSize())
// fmt.Println(feats.Contains(gst.CapsFeatureMemorySystemMemory))
// fmt.Println(feats.GetNth(0))
//
// // 0
// // 1
// // true
// // memory:SystemMemory
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CapsFeatures) Add(feature string) {
cStr := C.CString(feature)
defer C.free(unsafe.Pointer(cStr))
C.gst_caps_features_add(
c.Instance(),
(*C.gchar)(unsafe.Pointer(cStr)),
)
}
// Contains returns true if the given feature is included in these.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CapsFeatures) Contains(feature string) bool {
cStr := C.CString(feature)
defer C.free(unsafe.Pointer(cStr))
return gobool(C.gst_caps_features_contains(
c.Instance(),
(*C.gchar)(unsafe.Pointer(cStr)),
))
}
// Copy duplicates these features and all of it's values.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CapsFeatures) Copy() *CapsFeatures {
return wrapCapsFeatures(C.gst_caps_features_copy(c.Instance()))
}
// Free frees the memory containing these features. Only call this if you
// do not intend to pass these features to other methods.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CapsFeatures) Free() { C.gst_caps_features_free(c.Instance()) }
// GetNth returns the feature at index.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CapsFeatures) GetNth(idx uint) string {
feat := C.gst_caps_features_get_nth(c.Instance(), C.guint(idx))
return C.GoString(feat)
}
// GetSize returns the number of features.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CapsFeatures) GetSize() uint {
return uint(C.gst_caps_features_get_size(c.Instance()))
}
// IsAny returns true if these features match any.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CapsFeatures) IsAny() bool { return gobool(C.gst_caps_features_is_any(c.Instance())) }
// IsEqual returns true if the given CapsFeatures are equal to the provided ones.
// If the provided structure is nil, this function immediately returns false.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CapsFeatures) IsEqual(feats *CapsFeatures) bool {
if feats == nil {
return false
}
return gobool(C.gst_caps_features_is_equal(c.Instance(), feats.Instance()))
}
// Remove removes the given feature.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CapsFeatures) Remove(feature string) {
cStr := C.CString(feature)
defer C.free(unsafe.Pointer(cStr))
C.gst_caps_features_remove(
c.Instance(),
(*C.gchar)(unsafe.Pointer(cStr)),
)
}
// SetParentRefCount sets the parent_refcount field of CapsFeatures. This field is used to determine
// whether a caps features is mutable or not. This function should only be called by code implementing
// parent objects of CapsFeatures, as described in the MT Refcounting section of the design documents.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *CapsFeatures) SetParentRefCount(refCount int) bool {
gcount := C.gint(refCount)
return gobool(C.gst_caps_features_set_parent_refcount(c.Instance(), &gcount))
}

View File

@@ -1,249 +0,0 @@
package gst
/*
#include "gst.go.h"
extern void goGstChildProxyChildAdded (GstChildProxy * parent, GObject * child, const gchar * name);
extern void goGstChildProxyChildRemoved (GstChildProxy * parent, GObject * child, const gchar * name);
extern GObject * goGstChildProxyGetChildByIndex (GstChildProxy * parent, guint idx);
extern GObject * goGstChildProxyGetChildByName (GstChildProxy * parent, const gchar * name);
extern guint goGstChildProxyGetChildrenCount (GstChildProxy * parent);
void setGstChildProxyChildAdded (gpointer iface) { ((GstChildProxyInterface*)iface)->child_added = goGstChildProxyChildAdded; }
void setGstChildProxyChildRemoved (gpointer iface) { ((GstChildProxyInterface*)iface)->child_removed = goGstChildProxyChildRemoved; }
void setGstChildProxyGetChildByIndex (gpointer iface) { ((GstChildProxyInterface*)iface)->get_child_by_index = goGstChildProxyGetChildByIndex; }
void setGstChildProxyGetChildByName (gpointer iface) { ((GstChildProxyInterface*)iface)->get_child_by_name = goGstChildProxyGetChildByName; }
void setGstChildProxyGetChildrenCount (gpointer iface) { ((GstChildProxyInterface*)iface)->get_children_count = goGstChildProxyGetChildrenCount; }
*/
import "C"
import (
"unsafe"
"github.com/go-gst/go-glib/glib"
)
// InterfaceChildProxy represents the GstChildProxy interface. Use this when querying bins
// for elements that implement GstChildProxy, or when signaling that a GoObjectSubclass
// provides this interface.
var InterfaceChildProxy glib.Interface = &interfaceChildProxy{}
type interfaceChildProxy struct{ glib.Interface }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (i *interfaceChildProxy) Type() glib.Type { return glib.Type(C.GST_TYPE_CHILD_PROXY) }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (i *interfaceChildProxy) Init(instance *glib.TypeInstance) {
goobj := instance.GoType
if _, ok := goobj.(interface {
ChildAdded(self *ChildProxy, child *glib.Object, name string)
}); ok {
C.setGstChildProxyChildAdded((C.gpointer)(instance.GTypeInstance))
}
if _, ok := goobj.(interface {
ChildRemoved(self *ChildProxy, child *glib.Object, name string)
}); ok {
C.setGstChildProxyChildRemoved((C.gpointer)(instance.GTypeInstance))
}
if _, ok := goobj.(interface {
GetChildByIndex(self *ChildProxy, idx uint) *glib.Object
}); ok {
C.setGstChildProxyGetChildByIndex((C.gpointer)(instance.GTypeInstance))
}
if _, ok := goobj.(interface {
GetChildByName(self *ChildProxy, name string) *glib.Object
}); ok {
C.setGstChildProxyGetChildByName((C.gpointer)(instance.GTypeInstance))
}
if _, ok := goobj.(interface {
GetChildrenCount(self *ChildProxy) uint
}); ok {
C.setGstChildProxyGetChildrenCount((C.gpointer)(instance.GTypeInstance))
}
}
// ChildProxyImpl is the reference implementation for a ChildProxy implemented by a Go object.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type ChildProxyImpl interface {
ChildAdded(self *ChildProxy, child *glib.Object, name string)
ChildRemoved(self *ChildProxy, child *glib.Object, name string)
GetChildByIndex(self *ChildProxy, idx uint) *glib.Object
GetChildByName(self *ChildProxy, name string) *glib.Object
GetChildrenCount(self *ChildProxy) uint
}
// ChildProxy is an interface that abstracts handling of property sets for
// elements with children. They all have multiple GstPad or some kind of voice
// objects. Another use case are container elements like GstBin. The element
// implementing the interface acts as a parent for those child objects.
//
// Property names are written as "child-name::property-name". The whole naming
// scheme is recursive. Thus "child1::child2::property" is valid too, if "child1"
// and "child2" implement the GstChildProxy interface.
type ChildProxy struct{ ptr *C.GstChildProxy }
// ToChildProxy returns a ChildProxy for the given element. If the element does not implement
// a ChildProxy it returns nil.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func ToChildProxy(elem *Element) *ChildProxy {
if proxy := C.toGstChildProxy(elem.Unsafe()); proxy != nil {
return &ChildProxy{proxy}
}
return nil
}
// Instance returns the underlying GstChildProxy instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *ChildProxy) Instance() *C.GstChildProxy {
return C.toGstChildProxy(unsafe.Pointer(c.ptr))
}
// ChildAdded emits the "child-added" signal.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *ChildProxy) ChildAdded(child *glib.Object, name string) {
cname := C.CString(name)
defer C.free(unsafe.Pointer(cname))
C.gst_child_proxy_child_added(
c.Instance(),
(*C.GObject)(child.Unsafe()),
(*C.gchar)(unsafe.Pointer(cname)),
)
}
// ChildRemoved emits the "child-removed" signal.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *ChildProxy) ChildRemoved(child *glib.Object, name string) {
cname := C.CString(name)
defer C.free(unsafe.Pointer(cname))
C.gst_child_proxy_child_removed(
c.Instance(),
(*C.GObject)(child.Unsafe()),
(*C.gchar)(unsafe.Pointer(cname)),
)
}
// Get gets properties of the parent object and its children. This is a direct alias to looping
// over GetProperty and returning the results in the order of the arguments. If any of the results
// returns nil from an allocation error, nil is returned for the entire slice.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *ChildProxy) Get(names ...string) []*glib.Value {
out := make([]*glib.Value, len(names))
for i, name := range names {
val := c.GetProperty(name)
if val == nil {
return nil
}
out[i] = val
}
return out
}
// GetChildByIndex fetches a child by its number. This function can return nil if the object is not
// found.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *ChildProxy) GetChildByIndex(idx uint) *glib.Object {
gobj := C.gst_child_proxy_get_child_by_index(c.Instance(), C.guint(idx))
if gobj == nil {
return nil
}
return glib.TransferFull(unsafe.Pointer(gobj))
}
// GetChildByName fetches a child by name. The virtual method's default implementation uses Object
// together with Object.GetName. If the interface is to be used with GObjects, this method needs
// to be overridden.
//
// This function can return nil if the object is not found.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *ChildProxy) GetChildByName(name string) *glib.Object {
cname := C.CString(name)
defer C.free(unsafe.Pointer(cname))
gobj := C.gst_child_proxy_get_child_by_name(c.Instance(), (*C.gchar)(unsafe.Pointer(cname)))
if gobj == nil {
return nil
}
return glib.TransferFull(unsafe.Pointer(gobj))
}
// GetChildrenCount returns the number of child objects the parent contains.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *ChildProxy) GetChildrenCount() uint {
return uint(C.gst_child_proxy_get_children_count(c.Instance()))
}
// GetProperty gets a single property using the ChildProxy mechanism. The bindings
// take care of freeing the value when it leaves the user's scope. This function
// can return nil if a failure happens trying to allocate GValues.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *ChildProxy) GetProperty(name string) *glib.Value {
value, err := glib.ValueAlloc()
if err != nil {
return nil
}
cname := C.CString(name)
defer C.free(unsafe.Pointer(cname))
C.gst_child_proxy_get_property(c.Instance(), (*C.gchar)(unsafe.Pointer(cname)), (*C.GValue)(unsafe.Pointer(value.GValue)))
return value
}
// Lookup looks up which object and and parameter would be affected by the given name.
// If ok is false, the targets could not be found and this function returned nil.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *ChildProxy) Lookup(name string) (ok bool, target *glib.Object, param *glib.ParamSpec) {
var gtarget *C.GObject
var gspec *C.GParamSpec
cname := C.CString(name)
defer C.free(unsafe.Pointer(cname))
ok = gobool(C.gst_child_proxy_lookup(
c.Instance(),
(*C.gchar)(unsafe.Pointer(cname)),
&gtarget, &gspec,
))
if !ok {
return
}
target = glib.TransferFull(unsafe.Pointer(gtarget))
param = glib.ToParamSpec(unsafe.Pointer(gspec))
return
}
// Set takes a map of names to values and applies them using the ChildProxy mechanism.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *ChildProxy) Set(values map[string]*glib.Value) {
for name, value := range values {
c.SetProperty(name, value)
}
}
// SetProperty sets a single property using the ChildProxy mechanism.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *ChildProxy) SetProperty(name string, value *glib.Value) {
cname := C.CString(name)
defer C.free(unsafe.Pointer(cname))
C.gst_child_proxy_set_property(
c.Instance(),
(*C.gchar)(unsafe.Pointer(cname)),
(*C.GValue)(unsafe.Pointer(value.GValue)),
)
}

View File

@@ -1,86 +0,0 @@
package gst
/*
#include "gst.go.h"
*/
import "C"
import (
"unsafe"
"github.com/go-gst/go-glib/glib"
)
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func wrapParent(parent *C.GstChildProxy) *ChildProxy { return &ChildProxy{ptr: parent} }
//export goGstChildProxyChildAdded
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstChildProxyChildAdded(parent *C.GstChildProxy, child *C.GObject, name *C.gchar) {
iface := glib.FromObjectUnsafePrivate(unsafe.Pointer(parent))
caller := iface.(interface {
ChildAdded(self *ChildProxy, child *glib.Object, name string)
})
caller.ChildAdded(
wrapParent(parent),
&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(child))},
C.GoString(name),
)
}
//export goGstChildProxyChildRemoved
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstChildProxyChildRemoved(parent *C.GstChildProxy, child *C.GObject, name *C.gchar) {
iface := glib.FromObjectUnsafePrivate(unsafe.Pointer(parent))
caller := iface.(interface {
ChildRemoved(self *ChildProxy, child *glib.Object, name string)
})
caller.ChildRemoved(
wrapParent(parent),
&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(child))},
C.GoString(name),
)
}
//export goGstChildProxyGetChildByIndex
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstChildProxyGetChildByIndex(parent *C.GstChildProxy, idx C.guint) *C.GObject {
iface := glib.FromObjectUnsafePrivate(unsafe.Pointer(parent))
caller := iface.(interface {
GetChildByIndex(self *ChildProxy, idx uint) *glib.Object
})
obj := caller.GetChildByIndex(wrapParent(parent), uint(idx))
if obj == nil {
return nil
}
return (*C.GObject)(unsafe.Pointer(obj.GObject))
}
//export goGstChildProxyGetChildByName
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstChildProxyGetChildByName(parent *C.GstChildProxy, name *C.gchar) *C.GObject {
iface := glib.FromObjectUnsafePrivate(unsafe.Pointer(parent))
caller := iface.(interface {
GetChildByName(self *ChildProxy, name string) *glib.Object
})
obj := caller.GetChildByName(wrapParent(parent), C.GoString(name))
if obj == nil {
return nil
}
return (*C.GObject)(unsafe.Pointer(obj.GObject))
}
//export goGstChildProxyGetChildrenCount
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstChildProxyGetChildrenCount(parent *C.GstChildProxy) C.guint {
iface := glib.FromObjectUnsafePrivate(unsafe.Pointer(parent))
caller := iface.(interface {
GetChildrenCount(self *ChildProxy) uint
})
return C.guint(caller.GetChildrenCount(wrapParent(parent)))
}

View File

@@ -1,491 +0,0 @@
package gst
/*
#include "gst.go.h"
extern gboolean goClockCb (GstClock * clock, GstClockTime time, GstClockID id, gpointer user_data);
extern void goGDestroyNotifyFuncNoRun (gpointer user_data);
gboolean cgoClockCb (GstClock * clock, GstClockTime time, GstClockID id, gpointer user_data)
{
return goClockCb(clock, time, id, user_data);
}
void clockDestroyNotify (gpointer user_data)
{
goGDestroyNotifyFuncNoRun(user_data);
}
*/
import "C"
import (
"fmt"
"runtime"
"time"
"unsafe"
"github.com/go-gst/go-glib/glib"
gopointer "github.com/go-gst/go-pointer"
)
type ClockTime C.GstClockTime
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (ct ClockTime) String() string {
if ct == ClockTimeNone {
return "ClockTimeNone"
}
return fmt.Sprint(uint64(ct))
}
// interpret the clocktime as a duration, returns nil on ClockTimeNone
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (ct ClockTime) AsDuration() *time.Duration {
if ct == ClockTimeNone {
return nil
}
dur := time.Duration(uint64(ct))
return &dur
}
// interpret the clocktime as a timestamp, returns nil on ClockTimeNone
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (ct ClockTime) AsTimestamp() *time.Time {
if ct == ClockTimeNone {
return nil
}
dur := time.Unix(0, int64(ct))
return &dur
}
// ClockCallback is the prototype of a clock callback function.
type ClockCallback func(clock *Clock, clockTime ClockTime) bool
// ClockID is a go wrapper around a GstClockID.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type ClockID struct {
ptr C.GstClockID // which is actually just a casted pointer
}
// Instance returns the underlying pointer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *ClockID) Instance() C.GstClockID { return c.ptr }
// GetClock returns the clock for this ClockID.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *ClockID) GetClock() *Clock {
clk := C.gst_clock_id_get_clock(c.Instance())
return FromGstClockUnsafeFull(unsafe.Pointer(clk))
}
// GetTime returns the time for this ClockID
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *ClockID) GetTime() ClockTime {
return ClockTime(C.gst_clock_id_get_time(c.Instance()))
}
// Unschedule cancels an outstanding request with id. This can either be an outstanding async notification or a pending sync notification.
// After this call, id cannot be used anymore to receive sync or async notifications, you need to create a new GstClockID.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *ClockID) Unschedule() {
C.gst_clock_id_unschedule(c.Instance())
}
// UsesClock returns whether id uses clock as the underlying clock. clock can be nil, in which case the return value indicates whether the
// underlying clock has been freed. If this is the case, the id is no longer usable and should be freed.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *ClockID) UsesClock(clock *Clock) bool {
return gobool(C.gst_clock_id_uses_clock(c.Instance(), clock.Instance()))
}
// Wait performs a blocking wait on id. id should have been created with NewSingleShotID or NewPeriodicID and should not have been unscheduled
// with a call to Unschedule.
//
// If the jitter argument is not 0 and this function returns ClockOK or ClockEarly, it will contain the difference against the clock and the
// time of id when this method was called. Positive values indicate how late id was relative to the clock (in which case this function will
// return ClockEarly). Negative values indicate how much time was spent waiting on the clock before this function returned.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *ClockID) Wait() (ret ClockReturn, jitter ClockTimeDiff) {
var gjitter C.GstClockTimeDiff
ret = ClockReturn(C.gst_clock_id_wait(c.Instance(), &gjitter))
jitter = ClockTimeDiff(gjitter)
return
}
// WaitAsync registers a callback on the given ClockID id with the given function and user_data. When passing a ClockID with an invalid time to
// this function, the callback will be called immediately with a time set to ClockTimeNone. The callback will be called when the time of id has been reached.
//
// The callback func can be invoked from any thread, either provided by the core or from a streaming thread. The application should be prepared for this.
//
// // Example
//
// pipeline, _ := gst.NewPipelineFromString("fakesrc ! fakesink")
//
// clock := pipeline.GetPipelineClock()
//
// id := clock.NewSingleShotID(gst.ClockTime(1000000000)) // 1 second
//
// id.WaitAsync(func(clock *gst.Clock, clockTime ClockTime) bool {
// fmt.Println("Single shot triggered at", clockTime.Nanoseconds())
// pipeline.SetState(gst.StateNull)
// return true
// })
//
// pipeline.SetState(gst.StatePlaying)
// gst.Wait(pipeline)
//
// // Single shot triggered at 1000000000
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *ClockID) WaitAsync(f ClockCallback) ClockReturn {
ptr := gopointer.Save(f)
return ClockReturn(C.gst_clock_id_wait_async(
c.Instance(),
C.GstClockCallback(C.cgoClockCb),
(C.gpointer)(unsafe.Pointer(ptr)),
C.GDestroyNotify(C.clockDestroyNotify),
))
}
// Ref increaes the ref count on ClockID.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *ClockID) Ref() *ClockID {
C.gst_clock_id_ref(c.Instance())
return c
}
// Unref unrefs a ClockID.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *ClockID) Unref() {
C.gst_clock_id_unref(c.Instance())
}
// Clock is a go wrapper around a GstClock.
type Clock struct{ *Object }
// FromGstClockUnsafeNone takes a pointer to a GstClock and wraps it in a Clock instance.
// A ref is taken on the clock and a finalizer applied.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstClockUnsafeNone(clock unsafe.Pointer) *Clock {
return wrapClock(glib.TransferNone(clock))
}
// FromGstClockUnsafeFull takes a pointer to a GstClock and wraps it in a Clock instance.
// A finalizer is set on the returned object.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstClockUnsafeFull(clock unsafe.Pointer) *Clock {
return wrapClock(glib.TransferFull(clock))
}
// ToGstClock wraps the given glib.Object or gst.Object in a Clock instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func ToGstClock(obj interface{}) *Clock {
switch obj := obj.(type) {
case *Object:
return &Clock{Object: obj}
case *glib.Object:
return wrapClock(obj)
}
return nil
}
// Instance returns the underlying GstClock instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Clock) Instance() *C.GstClock { return C.toGstClock(c.Unsafe()) }
// AddObservation adds the time master of the master clock and the time slave of the slave clock to the list of observations.
// If enough observations are available, a linear regression algorithm is run on the observations and clock is recalibrated.
//
// If this functions returns TRUE, the float will contain the correlation coefficient of the interpolation. A value of 1.0 means
// a perfect regression was performed. This value can be used to control the sampling frequency of the master and slave clocks.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Clock) AddObservation(slaveTime, masterTime ClockTime) (bool, float64) {
var out C.gdouble
ok := gobool(C.gst_clock_add_observation(
c.Instance(),
C.GstClockTime(slaveTime),
C.GstClockTime(masterTime),
&out,
))
return ok, float64(out)
}
// AddObservationUnapplied adds a clock observation to the internal slaving algorithm the same as AddObservation, and returns the
// result of the master clock estimation, without updating the internal calibration.
//
// The caller can then take the results and call SetCalibration with the values, or some modified version of them.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Clock) AddObservationUnapplied(slaveTime, masterTime ClockTime) (ok bool, rSquared float64, internalTime, externalTime, rateNum, rateDenom ClockTime) {
var ginternal, gexternal, grateNum, grateDenom C.GstClockTime
var grSquared C.gdouble
ok = gobool(C.gst_clock_add_observation_unapplied(
c.Instance(),
C.GstClockTime(slaveTime),
C.GstClockTime(masterTime),
&grSquared, &ginternal, &gexternal, &grateNum, &grateDenom,
))
return ok, float64(grSquared), ClockTime(ginternal), ClockTime(gexternal), ClockTime(grateNum), ClockTime(grateDenom)
}
// AdjustUnlocked converts the given internal clock time to the external time, adjusting for the rate and reference time set with
// SetCalibration and making sure that the returned time is increasing. This function should be called with the clock's OBJECT_LOCK
// held and is mainly used by clock subclasses.
//
// This function is the reverse of UnadjustUnlocked.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Clock) AdjustUnlocked(internal ClockTime) ClockTime {
return ClockTime(C.gst_clock_adjust_unlocked(c.Instance(), C.GstClockTime(internal)))
}
// AdjustWithCalibration converts the given internal_target clock time to the external time, using the passed calibration parameters.
// This function performs the same calculation as AdjustUnlocked when called using the current calibration parameters, but
// doesn't ensure a monotonically increasing result as AdjustUnlocked does.
//
// See: https://gstreamer.freedesktop.org/documentation/gstreamer/gstclock.html#gst_clock_adjust_with_calibration
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Clock) AdjustWithCalibration(internalTarget, cinternal, cexternal, cnum, cdenom ClockTime) ClockTime {
return ClockTime(C.gst_clock_adjust_with_calibration(
c.Instance(),
C.GstClockTime(internalTarget),
C.GstClockTime(cinternal),
C.GstClockTime(cexternal),
C.GstClockTime(cnum),
C.GstClockTime(cdenom),
))
}
// GetCalibration gets the internal rate and reference time of clock. See gst_clock_set_calibration for more information.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Clock) GetCalibration() (internal, external, rateNum, rateDenom ClockTime) {
var ginternal, gexternal, grateNum, grateDenom C.GstClockTime
C.gst_clock_get_calibration(c.Instance(), &ginternal, &gexternal, &grateNum, &grateDenom)
return ClockTime(ginternal), ClockTime(gexternal), ClockTime(grateNum), ClockTime(grateDenom)
}
// GetTime gets the current time of the given clock in nanoseconds or -1 if invalid.
// The time is always monotonically increasing and adjusted according to the current offset and rate.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Clock) GetTime() ClockTime {
res := C.gst_clock_get_time(c.Instance())
return ClockTime(res)
}
// GetInternalTime gets the current internal time of the given clock in nanoseconds
// or ClockTimeNone if invalid. The time is returned unadjusted for the offset and the rate.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Clock) GetInternalTime() ClockTime {
res := C.gst_clock_get_internal_time(c.Instance())
return ClockTime(res)
}
// GetMaster returns the master clock that this clock is slaved to or nil when the clock
// is not slaved to any master clock.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Clock) GetMaster() *Clock {
clock := C.gst_clock_get_master(c.Instance())
if clock == nil {
return nil
}
return FromGstClockUnsafeFull(unsafe.Pointer(clock))
}
// GetResolution gets the accuracy of the clock. The accuracy of the clock is the granularity
// of the values returned by GetTime.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Clock) GetResolution() ClockTime {
return ClockTime(C.gst_clock_get_resolution(c.Instance()))
}
// GetTimeout gets the amount of time that master and slave clocks are sampled.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Clock) GetTimeout() ClockTime {
return ClockTime(C.gst_clock_get_timeout(c.Instance()))
}
// IsSynced returns true if the clock is synced.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Clock) IsSynced() bool { return gobool(C.gst_clock_is_synced(c.Instance())) }
// NewPeriodicID gets an ID from clock to trigger a periodic notification. The periodic notifications
// will start at time start_time and will then be fired with the given interval.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Clock) NewPeriodicID(startTime, interval ClockTime) *ClockID {
id := C.gst_clock_new_periodic_id(
c.Instance(),
C.GstClockTime(startTime),
C.GstClockTime(interval),
)
clkid := &ClockID{id}
runtime.SetFinalizer(clkid, (*ClockID).Unref)
return clkid
}
// NewSingleShotID gets a ClockID from the clock to trigger a single shot notification at the requested time.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Clock) NewSingleShotID(at ClockTime) *ClockID {
id := C.gst_clock_new_single_shot_id(
c.Instance(),
C.GstClockTime(at),
)
clkid := &ClockID{id}
runtime.SetFinalizer(clkid, (*ClockID).Unref)
return clkid
}
// PeriodicIDReinit reinitializes the provided periodic id to the provided start time and interval. Does not
// / modify the reference count.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Clock) PeriodicIDReinit(clockID *ClockID, startTime, interval ClockTime) bool {
return gobool(C.gst_clock_periodic_id_reinit(
c.Instance(),
clockID.Instance(),
C.GstClockTime(startTime),
C.GstClockTime(interval),
))
}
// SetCalibration adjusts the rate and time of clock.
// See: https://gstreamer.freedesktop.org/documentation/gstreamer/gstclock.html#gst_clock_set_calibration.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Clock) SetCalibration(internal, external, rateNum, rateDenom ClockTime) {
C.gst_clock_set_calibration(
c.Instance(),
C.GstClockTime(internal),
C.GstClockTime(external),
C.GstClockTime(rateNum),
C.GstClockTime(rateDenom),
)
}
// SetMaster sets master as the master clock for clock. clock will be automatically calibrated so that
// GetTime reports the same time as the master clock.
//
// A clock provider that slaves its clock to a master can get the current calibration values with GetCalibration.
//
// Master can be nil in which case clock will not be slaved anymore. It will however keep reporting its time
// adjusted with the last configured rate and time offsets.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Clock) SetMaster(master *Clock) bool {
if master == nil {
return gobool(C.gst_clock_set_master(c.Instance(), nil))
}
return gobool(C.gst_clock_set_master(c.Instance(), master.Instance()))
}
// SetResolution sets the accuracy of the clock. Some clocks have the possibility to operate with different accuracy
// at the expense of more resource usage. There is normally no need to change the default resolution of a clock.
// The resolution of a clock can only be changed if the clock has the ClockFlagCanSetResolution flag set.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Clock) SetResolution(resolution ClockTime) ClockTime {
return ClockTime(C.gst_clock_set_resolution(c.Instance(), C.GstClockTime(resolution)))
}
// SetSynced sets clock to synced and emits the GstClock::synced signal, and wakes up any thread waiting in WaitForSync.
//
// This function must only be called if ClockFlagNeedsStartupSync is set on the clock, and is intended to be called by
// subclasses only.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Clock) SetSynced(synced bool) { C.gst_clock_set_synced(c.Instance(), gboolean(synced)) }
// SetTimeout sets the amount of time, in nanoseconds, to sample master and slave clocks
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Clock) SetTimeout(timeout ClockTime) {
C.gst_clock_set_timeout(c.Instance(), C.GstClockTime(timeout))
}
// SingleShotIDReinit reinitializes the provided single shot id to the provided time. Does not modify the reference count.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Clock) SingleShotIDReinit(clockID *ClockID, at ClockTime) bool {
return gobool(C.gst_clock_single_shot_id_reinit(c.Instance(), clockID.Instance(), C.GstClockTime(at)))
}
// UnadjustUnlocked converts the given external clock time to the internal time of clock, using the rate and reference time
// set with SetCalibration. This function should be called with the clock's OBJECT_LOCK held and is mainly used by clock subclasses.
//
// This function is the reverse of AdjustUnlocked.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Clock) UnadjustUnlocked(external ClockTime) ClockTime {
return ClockTime(C.gst_clock_unadjust_unlocked(c.Instance(), C.GstClockTime(external)))
}
// UnadjustWithCalibration converts the given external_target clock time to the internal time, using the passed calibration parameters.
// This function performs the same calculation as UnadjustUnlocked when called using the current calibration parameters.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Clock) UnadjustWithCalibration(externalTarget, cinternal, cexternal, cnum, cdenom ClockTime) ClockTime {
return ClockTime(C.gst_clock_unadjust_with_calibration(
c.Instance(),
C.GstClockTime(externalTarget),
C.GstClockTime(cinternal),
C.GstClockTime(cexternal),
C.GstClockTime(cnum),
C.GstClockTime(cdenom),
))
}
// WaitForSync waits until clock is synced for reporting the current time. If timeout is ClockTimeNone it will wait forever, otherwise it
// will time out after timeout nanoseconds.
//
// For asynchronous waiting, the GstClock::synced signal can be used.
//
// This returns immediately with TRUE if ClockFlagNeedsStartupSync is not set on the clock, or if the clock is already synced.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Clock) WaitForSync(timeout ClockTime) bool {
return gobool(C.gst_clock_wait_for_sync(c.Instance(), C.GstClockTime(timeout)))
}
// String returns the string representation of this clock value.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Clock) String() string { return fmt.Sprintf("%d", c.GetTime()) }
// InternalString returns the string representation of this clock's internal value.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Clock) InternalString() string { return fmt.Sprintf("%d", c.GetInternalTime()) }

View File

@@ -1,154 +0,0 @@
package gst
// #include "gst.go.h"
import "C"
import (
"runtime"
"unsafe"
)
// Context wraps a GstContext object.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type Context struct {
ptr *C.GstContext
}
// FromGstContextUnsafeFull wraps the given context and places a runtime finalizer on it.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstContextUnsafeFull(ctx unsafe.Pointer) *Context {
wrapped := wrapContext((*C.GstContext)(ctx))
runtime.SetFinalizer(wrapped, (*Context).Unref)
return wrapped
}
// FromGstContextUnsafeNone refs and wraps the given context and places a runtime finalizer on it.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstContextUnsafeNone(ctx unsafe.Pointer) *Context {
wrapped := wrapContext((*C.GstContext)(ctx))
wrapped.Ref()
runtime.SetFinalizer(wrapped, (*Context).Unref)
return wrapped
}
// NewContext creates a new context.
//
// // Example
//
// ctx := gst.NewContext("test-context", false)
// fmt.Println(ctx.IsPersistent())
//
// ctx = gst.NewContext("test-context", true)
// fmt.Println(ctx.IsPersistent())
//
// // false
// // true
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewContext(ctxType string, persistent bool) *Context {
cStr := C.CString(ctxType)
defer C.free(unsafe.Pointer(cStr))
ctx := C.gst_context_new((*C.gchar)(unsafe.Pointer(cStr)), gboolean(persistent))
if ctx == nil {
return nil
}
return FromGstContextUnsafeFull(unsafe.Pointer(ctx))
}
// Instance returns the underlying GstContext instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Context) Instance() *C.GstContext { return C.toGstContext(unsafe.Pointer(c.ptr)) }
// GetType returns the type of the context.
//
// // Example
//
// ctx := gst.NewContext("test-context", false)
// fmt.Println(ctx.GetType())
//
// // test-context
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Context) GetType() string {
return C.GoString(C.gst_context_get_context_type(c.Instance()))
}
// GetStructure returns the structure of the context. You should not modify or unref it.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Context) GetStructure() *Structure {
st := C.gst_context_get_structure(c.Instance())
if st == nil {
return nil
}
return wrapStructure(st)
}
// HasContextType checks if the context has the given type.
//
// // Example
//
// ctx := gst.NewContext("test-context", false)
// fmt.Println(ctx.HasContextType("test-context"))
// fmt.Println(ctx.HasContextType("another-context"))
//
// // true
// // false
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Context) HasContextType(ctxType string) bool {
cStr := C.CString(ctxType)
defer C.free(unsafe.Pointer(cStr))
return gobool(C.gst_context_has_context_type(
c.Instance(),
(*C.gchar)(unsafe.Pointer(cStr)),
))
}
// IsPersistent checks if the context is persistent.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Context) IsPersistent() bool {
return gobool(C.gst_context_is_persistent(c.Instance()))
}
// IsWritable returns true if the context is writable.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Context) IsWritable() bool {
return gobool(C.contextIsWritable(c.Instance()))
}
// MakeWritable returns a writable version of the context.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Context) MakeWritable() *Context {
return FromGstContextUnsafeFull(unsafe.Pointer(C.makeContextWritable(c.Instance())))
}
// WritableStructure returns a writable version of the structure. You should still not unref it.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Context) WritableStructure() *Structure {
st := C.gst_context_writable_structure(c.Instance())
if st == nil {
return nil
}
return wrapStructure(st)
}
// Ref increases the ref count on the Context.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Context) Ref() *Context {
ctx := C.gst_context_ref(c.Instance())
return &Context{ptr: ctx}
}
// Unref decreases the ref count on the Context.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (c *Context) Unref() { C.gst_context_unref(c.Instance()) }

View File

@@ -1,289 +0,0 @@
package gst
/*
#include "gst.go.h"
extern void goLogFunction(GstDebugCategory * category,
GstDebugLevel level,
const gchar * file,
const gchar * function,
gint line,
GObject * object,
GstDebugMessage * message,
gpointer user_data) G_GNUC_NO_INSTRUMENT;
void cgoDebugLog (GstDebugCategory * category,
GstDebugLevel level,
const gchar * file,
const gchar * function,
gint line,
GObject * object,
const gchar * msg)
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-security"
gst_debug_log(category, level, file, function, line, object, msg);
#pragma GCC diagnostic pop
}
void cgoSetLogFunction()
{
gst_debug_remove_log_function(gst_debug_log_default);
gst_debug_add_log_function(goLogFunction, NULL, NULL);
}
void cgoResetLogFunction()
{
gst_debug_remove_log_function(goLogFunction);
gst_debug_add_log_function(gst_debug_log_default, NULL, NULL);
}
*/
import "C"
import (
"path"
"runtime"
"sync"
"unsafe"
)
// DebugColorFlags are terminal style flags you can use when creating your debugging
// categories to make them stand out in debugging output.
type DebugColorFlags int
// Type castings of DebugColorFlags
const (
DebugColorNone DebugColorFlags = 0 // (0) - No color
DebugColorFgBlack DebugColorFlags = C.GST_DEBUG_FG_BLACK // (0) Use black as foreground color.
DebugColorFgRed DebugColorFlags = C.GST_DEBUG_FG_RED // (1) Use red as foreground color.
DebugColorFgGreen DebugColorFlags = C.GST_DEBUG_FG_GREEN // (2) Use green as foreground color.
DebugColorFgYellow DebugColorFlags = C.GST_DEBUG_FG_YELLOW // (3) Use yellow as foreground color.
DebugColorFgBlue DebugColorFlags = C.GST_DEBUG_FG_BLUE // (4) Use blue as foreground color.
DebugColorFgMagenta DebugColorFlags = C.GST_DEBUG_FG_MAGENTA // (5) Use magenta as foreground color.
DebugColorFgCyan DebugColorFlags = C.GST_DEBUG_FG_CYAN // (6) Use cyan as foreground color.
DebugColorFgWhite DebugColorFlags = C.GST_DEBUG_FG_WHITE // (7) Use white as foreground color.
DebugColorBgBlack DebugColorFlags = C.GST_DEBUG_BG_BLACK // (0) Use black as background color.
DebugColorBgRed DebugColorFlags = C.GST_DEBUG_BG_RED // (16) Use red as background color.
DebugColorBgGreen DebugColorFlags = C.GST_DEBUG_BG_GREEN // (32) Use green as background color.
DebugColorBgYellow DebugColorFlags = C.GST_DEBUG_BG_YELLOW // (48) Use yellow as background color.
DebugColorBgBlue DebugColorFlags = C.GST_DEBUG_BG_BLUE // (64) Use blue as background color.
DebugColorBgMagenta DebugColorFlags = C.GST_DEBUG_BG_MAGENTA // (80) Use magenta as background color.
DebugColorBgCyan DebugColorFlags = C.GST_DEBUG_BG_CYAN // (96) Use cyan as background color.
DebugColorBgWhite DebugColorFlags = C.GST_DEBUG_BG_WHITE // (112) Use white as background color.
DebugColorBold DebugColorFlags = C.GST_DEBUG_BOLD // (256) Make the output bold.
DebugColorUnderline DebugColorFlags = C.GST_DEBUG_UNDERLINE // (512) Underline the output.
)
// DebugColorMode represents how to display colors.
type DebugColorMode int
// Type castings of DebugColorModes
const (
DebugColorModeOff DebugColorMode = C.GST_DEBUG_COLOR_MODE_OFF // (0) Do not use colors in logs.
DebugColorModeOn DebugColorMode = C.GST_DEBUG_COLOR_MODE_ON // (1) Paint logs in a platform-specific way.
DebugColorModeUnix DebugColorMode = C.GST_DEBUG_COLOR_MODE_UNIX // (2) Paint logs with UNIX terminal color codes no matter what platform GStreamer is running on.
)
// DebugLevel defines the importance of a debugging message. The more important a message is, the
// greater the probability that the debugging system outputs it.
type DebugLevel int
// Type castings of DebugLevels
const (
LevelNone DebugLevel = C.GST_LEVEL_NONE // (0) No debugging level specified or desired. Used to deactivate debugging output.
LevelError DebugLevel = C.GST_LEVEL_ERROR // (1) Error messages are to be used only when an error occurred that stops the application from keeping working correctly. An examples is gst_element_error, which outputs a message with this priority. It does not mean that the application is terminating as with g_error.
LevelWarning DebugLevel = C.GST_LEVEL_WARNING // (2) Warning messages are to inform about abnormal behavior that could lead to problems or weird behavior later on. An example of this would be clocking issues ("your computer is pretty slow") or broken input data ("Can't synchronize to stream.")
LevelFixMe DebugLevel = C.GST_LEVEL_FIXME // (3) Fixme messages are messages that indicate that something in the executed code path is not fully implemented or handled yet. Note that this does not replace proper error handling in any way, the purpose of this message is to make it easier to spot incomplete/unfinished pieces of code when reading the debug log.
LevelInfo DebugLevel = C.GST_LEVEL_INFO // (4) Informational messages should be used to keep the developer updated about what is happening. Examples where this should be used are when a typefind function has successfully determined the type of the stream or when an mp3 plugin detects the format to be used. ("This file has mono sound.")
LevelDebug DebugLevel = C.GST_LEVEL_DEBUG // (5) Debugging messages should be used when something common happens that is not the expected default behavior, or something that's useful to know but doesn't happen all the time (ie. per loop iteration or buffer processed or event handled). An example would be notifications about state changes or receiving/sending of events.
LevelLog DebugLevel = C.GST_LEVEL_LOG // (6) Log messages are messages that are very common but might be useful to know. As a rule of thumb a pipeline that is running as expected should never output anything else but LOG messages whilst processing data. Use this log level to log recurring information in chain functions and loop functions, for example.
LevelTrace DebugLevel = C.GST_LEVEL_TRACE // (7) Tracing-related messages. Examples for this are referencing/dereferencing of objects.
LevelMemDump DebugLevel = C.GST_LEVEL_MEMDUMP // (9) memory dump messages are used to log (small) chunks of data as memory dumps in the log. They will be displayed as hexdump with ASCII characters.
)
// StackTraceFlags are flags for configuring stack traces
type StackTraceFlags int
// Type castings of StackTraceFlags
const (
StackTraceShowNone StackTraceFlags = 0 // (0) Try to retrieve the minimum information available, which may be none on some platforms (Since: 1.18)
StackTraceShowFull StackTraceFlags = C.GST_STACK_TRACE_SHOW_FULL // (1) Try to retrieve as much information as possible, including source information when getting the stack trace
)
// DebugCategory is a struct that describes a category of log messages.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type DebugCategory struct {
ptr *C.GstDebugCategory
}
// NewDebugCategory initializes a new DebugCategory with the given properties and set
// to the default threshold.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewDebugCategory(name string, color DebugColorFlags, description string) *DebugCategory {
cat := C._gst_debug_category_new(C.CString(name), C.guint(color), C.CString(description))
return &DebugCategory{ptr: cat}
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *DebugCategory) logDepth(level DebugLevel, message string, depth int, obj *C.GObject) {
function, file, line, _ := runtime.Caller(depth)
cFile := C.CString(path.Base(file))
cFunc := C.CString(runtime.FuncForPC(function).Name())
cMsg := C.CString(message)
defer C.free(unsafe.Pointer(cFile))
defer C.free(unsafe.Pointer(cFunc))
defer C.free(unsafe.Pointer(cMsg))
C.cgoDebugLog(
d.ptr,
C.GstDebugLevel(level),
(*C.gchar)(cFile),
(*C.gchar)(cFunc),
C.gint(line),
obj,
(*C.gchar)(cMsg),
)
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func getLogObj(obj ...*Object) *C.GObject {
if len(obj) > 0 {
return (*C.GObject)(obj[0].Unsafe())
}
return nil
}
// Log logs the given message using the currently registered debugging handlers. You can optionally
// provide a single object to log the message for. GStreamer will automatically add a newline to the
// end of the message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *DebugCategory) Log(level DebugLevel, message string, obj ...*Object) {
d.logDepth(level, message, 2, getLogObj(obj...))
}
// LogError is a convenience wrapper for logging an ERROR level message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *DebugCategory) LogError(message string, obj ...*Object) {
d.logDepth(LevelError, message, 2, getLogObj(obj...))
}
// LogWarning is a convenience wrapper for logging a WARNING level message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *DebugCategory) LogWarning(message string, obj ...*Object) {
d.logDepth(LevelWarning, message, 2, getLogObj(obj...))
}
// LogInfo is a convenience wrapper for logging an INFO level message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *DebugCategory) LogInfo(message string, obj ...*Object) {
d.logDepth(LevelInfo, message, 2, getLogObj(obj...))
}
// LogDebug is a convenience wrapper for logging a DEBUG level message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *DebugCategory) LogDebug(message string, obj ...*Object) {
d.logDepth(LevelDebug, message, 2, getLogObj(obj...))
}
// LogLog is a convenience wrapper for logging a LOG level message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *DebugCategory) LogLog(message string, obj ...*Object) {
d.logDepth(LevelLog, message, 2, getLogObj(obj...))
}
// LogTrace is a convenience wrapper for logging a TRACE level message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *DebugCategory) LogTrace(message string, obj ...*Object) {
d.logDepth(LevelTrace, message, 2, getLogObj(obj...))
}
// LogMemDump is a convenience wrapper for logging a MEMDUMP level message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *DebugCategory) LogMemDump(message string, obj ...*Object) {
d.logDepth(LevelMemDump, message, 2, getLogObj(obj...))
}
// GetName returns the name of a debug category.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *DebugCategory) GetName() string {
return C.GoString(C.gst_debug_category_get_name(d.ptr))
}
// C.GObject passed to logging callback might not be full constructed yet (logging before g_object_new() has returned),
// or they might have a refcount of 0 (logging in finalize), or they might be partially destructed (dispose).
//
// It is not safe for general use. For most needs, use DebugMessage.GetId() instead
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type LoggedObject struct {
ptr *C.GObject
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (l *LoggedObject) Get() unsafe.Pointer {
return unsafe.Pointer(l.ptr)
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type DebugMessage struct {
ptr *C.GstDebugMessage
}
// Get returns the string representation of a GstDebugMessage.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *DebugMessage) Get() string {
return C.GoString(C.gst_debug_message_get(d.ptr))
}
// GetId returns the id of the object that emitted this message. Can be empty.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *DebugMessage) GetId() string {
return C.GoString(C.gst_debug_message_get_id(d.ptr))
}
type LogFunction = func(
category *DebugCategory,
level DebugLevel,
file string,
function string,
line int,
object *LoggedObject,
message *DebugMessage,
)
var (
logFnMu sync.RWMutex
customLogFunction LogFunction
)
// SetLogFunction is used to replace gstreamer's default logging function.
// Setting to nil will revert to the default logging function.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func SetLogFunction(f LogFunction) {
logFnMu.Lock()
defer logFnMu.Unlock()
if f == nil {
C.cgoResetLogFunction()
} else if customLogFunction == nil {
C.cgoSetLogFunction()
}
customLogFunction = f
}

View File

@@ -1,117 +0,0 @@
package gst
// #include "gst.go.h"
import "C"
import (
"fmt"
"strings"
"unsafe"
"github.com/go-gst/go-glib/glib"
)
// Device is a Go representation of a GstDevice.
type Device struct{ *Object }
// FromGstDeviceUnsafeNone wraps the given device with a ref and finalizer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstDeviceUnsafeNone(device unsafe.Pointer) *Device {
return &Device{wrapObject(glib.TransferNone(device))}
}
// FromGstDeviceUnsafeFull wraps the given device with a finalizer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstDeviceUnsafeFull(device unsafe.Pointer) *Device {
return &Device{wrapObject(glib.TransferFull(device))}
}
// Instance returns the underlying GstDevice object.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *Device) Instance() *C.GstDevice { return C.toGstDevice(d.Unsafe()) }
// CreateElement creates a new element with all the required parameters set to use this device.
// If name is empty, one is automatically generated.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *Device) CreateElement(name string) *Element {
var cName *C.gchar
if name != "" {
cName = C.CString(name)
defer C.free(unsafe.Pointer(cName))
}
elem := C.gst_device_create_element(d.Instance(), cName)
if elem == nil {
return nil
}
return FromGstElementUnsafeNone(unsafe.Pointer(elem))
}
// GetCaps returns the caps that this device supports.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *Device) GetCaps() *Caps {
caps := C.gst_device_get_caps(d.Instance())
if caps == nil {
return nil
}
return FromGstCapsUnsafeNone(unsafe.Pointer(caps))
}
// GetDeviceClass gets the "class" of a device. This is a "/" separated list of classes that
// represent this device. They are a subset of the classes of the GstDeviceProvider that produced
// this device.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *Device) GetDeviceClass() string {
class := C.gst_device_get_device_class(d.Instance())
defer C.g_free((C.gpointer)(unsafe.Pointer(class)))
return C.GoString(class)
}
// GetDisplayName gets the user-friendly name of the device.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *Device) GetDisplayName() string {
name := C.gst_device_get_display_name(d.Instance())
defer C.g_free((C.gpointer)(unsafe.Pointer(name)))
return C.GoString(name)
}
// GetProperties gets the extra properties of the device.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *Device) GetProperties() *Structure {
st := C.gst_device_get_properties(d.Instance())
if st == nil {
return nil
}
return wrapStructure(st)
}
// HasClasses checks if device matches all of the given classes.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *Device) HasClasses(classes []string) bool {
cClasses := C.CString(strings.Join(classes, "/"))
defer C.free(unsafe.Pointer(cClasses))
return gobool(C.gst_device_has_classes(d.Instance(), cClasses))
}
// ReconfigureElement tries to reconfigure an existing element to use the device.
// If this function fails, then one must destroy the element and create a new one
// using Device.CreateElement().
//
// Note: This should only be implemented for elements that can change their device
// while in the PLAYING state.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *Device) ReconfigureElement(elem *Element) error {
if ok := gobool(C.gst_device_reconfigure_element(d.Instance(), elem.Instance())); !ok {
return fmt.Errorf("failed to reconfigure element %s", elem.GetName())
}
return nil
}

View File

@@ -1,102 +0,0 @@
package gst
// #include "gst.go.h"
import "C"
import (
"unsafe"
"github.com/go-gst/go-glib/glib"
)
// DeviceMonitor is a Go representation of a GstDeviceMonitor.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type DeviceMonitor struct {
ptr *C.GstDeviceMonitor
bus *Bus
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewDeviceMonitor() *DeviceMonitor {
monitor := C.gst_device_monitor_new()
if monitor == nil {
return nil
}
return &DeviceMonitor{ptr: monitor}
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *DeviceMonitor) AddFilter(classes string, caps *Caps) uint {
var cClasses *C.gchar
if classes != "" {
cClasses = C.CString(classes)
defer C.free(unsafe.Pointer(cClasses))
}
filterId := C.gst_device_monitor_add_filter(d.ptr, cClasses, caps.Instance())
return uint(filterId)
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *DeviceMonitor) RemoveFilter(filterId uint) bool {
return gobool(C.gst_device_monitor_remove_filter(d.ptr, C.guint(filterId)))
}
// GetBus returns the message bus for this pipeline.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *DeviceMonitor) GetBus() *Bus {
if d.bus == nil {
cBus := C.gst_device_monitor_get_bus(d.ptr)
d.bus = FromGstBusUnsafeFull(unsafe.Pointer(cBus))
}
return d.bus
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *DeviceMonitor) Start() bool {
return gobool(C.gst_device_monitor_start(d.ptr))
//should return if we were able to add the filter
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *DeviceMonitor) Stop() {
C.gst_device_monitor_stop(d.ptr)
//should return if we were able to add the filter
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *DeviceMonitor) GetDevices() []*Device {
glist := C.gst_device_monitor_get_devices(d.ptr)
if glist == nil {
return nil
}
goList := glib.WrapList(unsafe.Pointer(glist))
out := make([]*Device, 0)
goList.Foreach(func(item interface{}) {
pt := item.(unsafe.Pointer)
out = append(out, FromGstDeviceUnsafeFull(pt))
})
return out
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *DeviceMonitor) SetShowAllDevices(show bool) {
C.gst_device_monitor_set_show_all_devices(d.ptr, gboolean(show))
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *DeviceMonitor) GetShowAllDevices() bool {
return gobool(C.gst_device_monitor_get_show_all_devices(d.ptr))
}
//gst_device_monitor_get_providers

View File

@@ -1,69 +0,0 @@
package gst
// #include "gst.go.h"
import "C"
import (
"unsafe"
"github.com/go-gst/go-glib/glib"
)
// DeviceProvider is a Go representation of a GstDeviceProvider.
type DeviceProvider struct{ *Object }
// FromGstDeviceProviderUnsafeNone wraps the given device with a ref and finalizer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstDeviceProviderUnsafeNone(deviceProvider unsafe.Pointer) *DeviceProvider {
return &DeviceProvider{wrapObject(glib.TransferNone(deviceProvider))}
}
// FromGstDeviceProviderUnsafeFull wraps the given device with a finalizer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstDeviceProviderUnsafeFull(deviceProvider unsafe.Pointer) *DeviceProvider {
return &DeviceProvider{wrapObject(glib.TransferFull(deviceProvider))}
}
// Instance returns the underlying GstDevice object.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *DeviceProvider) Instance() *C.GstDeviceProvider { return C.toGstDeviceProvider(d.Unsafe()) }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *DeviceProvider) GetDevices() []*Device {
glist := C.gst_device_provider_get_devices((*C.GstDeviceProvider)(d.Instance()))
if glist == nil {
return nil
}
goList := glib.WrapList(unsafe.Pointer(glist))
out := make([]*Device, 0)
goList.Foreach(func(item interface{}) {
pt := item.(unsafe.Pointer)
out = append(out, FromGstDeviceUnsafeFull(pt))
})
return out
}
// GetBus returns the message bus for this pipeline.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *DeviceProvider) GetBus() *Bus {
cBus := C.gst_device_provider_get_bus((*C.GstDeviceProvider)(d.Instance()))
bus := FromGstBusUnsafeFull(unsafe.Pointer(cBus))
return bus
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *DeviceProvider) Start() bool {
return gobool(C.gst_device_provider_start((*C.GstDeviceProvider)(d.Instance())))
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d *DeviceProvider) Stop() {
C.gst_device_provider_stop((*C.GstDeviceProvider)(d.Instance()))
}

View File

@@ -1,20 +0,0 @@
package gst
// #include "gst.go.h"
import "C"
import (
"unsafe"
)
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FindDeviceProviderByName(factoryName string) *DeviceProvider {
cFactoryName := C.CString(factoryName)
defer C.free(unsafe.Pointer(cFactoryName))
provider := C.gst_device_provider_factory_get_by_name((*C.gchar)(unsafe.Pointer(cFactoryName)))
if provider == nil {
return nil
}
return FromGstDeviceProviderUnsafeFull(unsafe.Pointer(provider))
}

View File

@@ -1,809 +0,0 @@
package gst
/*
#include "gst.go.h"
extern void goGDestroyNotifyFuncNoRun (gpointer user_data);
extern void goElementCallAsync (GstElement * element, gpointer user_data);
void cgoElementAsyncDestroyNotify (gpointer user_data)
{
goGDestroyNotifyFuncNoRun(user_data);
}
void cgoElementCallAsync (GstElement * element, gpointer user_data)
{
goElementCallAsync(element, user_data);
}
gboolean elementParentPostMessage (GstElement * element, GstMessage * message) {
GObjectClass * this_class = G_OBJECT_GET_CLASS(G_OBJECT(element));
GstElementClass * parent = toGstElementClass(g_type_class_peek_parent(this_class));
return parent->post_message(element, message);
}
GstStateChangeReturn elementParentChangeState (GstElement * element, GstStateChange transition)
{
GObjectClass * this_class = G_OBJECT_GET_CLASS(G_OBJECT(element));
GstElementClass * parent = toGstElementClass(g_type_class_peek_parent(this_class));
return parent->change_state(element, transition);
}
gboolean elementParentSendEvent (GstElement * element, GstEvent * event)
{
GObjectClass * this_class = G_OBJECT_GET_CLASS(G_OBJECT(element));
GstElementClass * parent = toGstElementClass(g_type_class_peek_parent(this_class));
return parent->send_event(element, event);
}
*/
import "C"
import (
"fmt"
"path"
"runtime"
"time"
"unsafe"
"github.com/go-gst/go-glib/glib"
gopointer "github.com/go-gst/go-pointer"
)
// Element is a Go wrapper around a GstElement.
type Element struct{ *Object }
// FromGstElementUnsafeNone wraps the given element with a ref and a finalizer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstElementUnsafeNone(elem unsafe.Pointer) *Element {
if elem == nil {
return nil
}
return &Element{Object: &Object{InitiallyUnowned: &glib.InitiallyUnowned{Object: glib.TransferNone(elem)}}}
}
// FromGstElementUnsafeFull wraps the given element with a finalizer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstElementUnsafeFull(elem unsafe.Pointer) *Element {
if elem == nil {
return nil
}
return &Element{Object: &Object{InitiallyUnowned: &glib.InitiallyUnowned{Object: glib.TransferFull(elem)}}}
}
// ToElement returns an Element object for the given Object. It will work
// on either gst.Object or glib.Object interfaces.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func ToElement(obj interface{}) *Element {
switch obj := obj.(type) {
case *Object:
return &Element{Object: obj}
case *glib.Object:
return &Element{Object: &Object{InitiallyUnowned: &glib.InitiallyUnowned{Object: obj}}}
}
return nil
}
// ElementLinkMany is a go implementation of `gst_element_link_many` to compensate for
// no variadic functions in cgo.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func ElementLinkMany(elems ...*Element) error {
for idx, elem := range elems {
if idx == 0 {
// skip the first one as the loop always links previous to current
continue
}
if err := elems[idx-1].Link(elem); err != nil {
return err
}
}
return nil
}
// ElementUnlinkMany is a go implementation of `gst_element_unlink_many` to compensate for
// no variadic functions in cgo.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func ElementUnlinkMany(elems ...*Element) {
for idx, elem := range elems {
if idx == 0 {
// skip the first one as the loop always links previous to current
continue
}
elems[idx-1].Unlink(elem)
}
}
// RegisterElement creates a new elementfactory capable of instantiating objects of the given GoElement
// and adds the factory to the plugin. A higher rank means more importance when autoplugging.
//
// plugin can also be nil to register a static element
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func RegisterElement(plugin *Plugin, name string, rank Rank, elem glib.GoObjectSubclass, extends glib.Extendable, interfaces ...glib.Interface) bool {
var pluginref *C.GstPlugin
if plugin != nil {
pluginref = plugin.Instance()
}
return gobool(C.gst_element_register(
pluginref,
C.CString(name),
C.guint(rank),
C.GType(glib.RegisterGoType(name, elem, extends, interfaces...)),
))
}
// Instance returns the underlying GstElement instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) Instance() *C.GstElement { return C.toGstElement(e.Unsafe()) }
// AbortState aborts the state change of the element. This function is used by elements that do asynchronous state changes
// and find out something is wrong.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) AbortState() { C.gst_element_abort_state(e.Instance()) }
// AddPad adds a pad (link point) to element. pad's parent will be set to element
//
// Pads are automatically activated when added in the PAUSED or PLAYING state.
//
// The pad and the element should be unlocked when calling this function.
//
// This function will emit the pad-added signal on the element.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) AddPad(pad *Pad) bool {
return gobool(C.gst_element_add_pad(e.Instance(), pad.Instance()))
}
// BlockSetState is a convinience wrapper function for calling SetState and an infinitely blocking GetState
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) BlockSetState(state State) error {
if err := e.SetState(state); err != nil {
return err
}
status, _ := e.GetState(state, ClockTimeNone)
if status != StateChangeSuccess {
return fmt.Errorf("failed to change state to %s (got %s)", state, status)
}
return nil
}
// CallAsync calls f from another thread. This is to be used for cases when a state change has to be performed from a streaming
// thread, directly via SetState or indirectly e.g. via SEEK events.
//
// Calling those functions directly from the streaming thread will cause deadlocks in many situations, as they might involve waiting
// for the streaming thread to shut down from this very streaming thread.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) CallAsync(f func()) {
ptr := gopointer.Save(f)
C.gst_element_call_async(
e.Instance(),
C.GstElementCallAsyncFunc(C.cgoElementCallAsync),
(C.gpointer)(unsafe.Pointer(ptr)),
C.GDestroyNotify(C.cgoElementAsyncDestroyNotify),
)
}
// PostMessage posts a message on the element's bus
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) PostMessage(message *Message) bool {
// gst_element_post_message takes ownership of the message so need to ref it before feeding it forward
return gobool(C.gst_element_post_message(e.Instance(), message.Ref().Instance()))
}
// ChangeState performs the given transition on this element.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) ChangeState(transition StateChange) StateChangeReturn {
return StateChangeReturn(C.gst_element_change_state(e.Instance(), C.GstStateChange(transition)))
}
// Connect connects to the given signal on this element, and applies f as the callback. The callback must
// match the signature of the expected callback from the documentation. However, instead of specifying C types
// for arguments specify the go-gst equivalent (e.g. *gst.Element for almost all GstElement derivatives).
//
// This and the Emit() method may get moved down the hierarchy to the Object level at some point, since
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) Connect(signal string, f interface{}) (glib.SignalHandle, error) {
// Elements are sometimes their own type unique from TYPE_ELEMENT. So make sure a type marshaler
// is registered for whatever this type is. Use the built-in element marshaler.
if e.TypeFromInstance() != glib.Type(C.GST_TYPE_ELEMENT) {
glib.RegisterGValueMarshalers([]glib.TypeMarshaler{{T: e.TypeFromInstance(), F: marshalElement}})
}
return e.Object.Connect(signal, f, nil)
}
// ContinueState commits the state change of the element and proceed to the next pending state if any. This
// function is used by elements that do asynchronous state changes. The core will normally call this method
// automatically when an element returned GST_STATE_CHANGE_SUCCESS from the state change function.
//
// If after calling this method the element still has not reached the pending state, the next state change is performed.
//
// This method is used internally and should normally not be called by plugins or applications.
//
// This function must be called with STATE_LOCK held.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) ContinueState(ret StateChangeReturn) StateChangeReturn {
return StateChangeReturn(C.gst_element_continue_state(e.Instance(), C.GstStateChangeReturn(ret)))
}
// Emit is a wrapper around g_signal_emitv() and emits the signal
// specified by the string s to an Object. This means that it performs identically to
// g_signal_emit_by_name. Arguments to callback functions connected to this signal must
// be specified in args. Emit() returns an interface{} which contains the go equivalent of the C return value.
//
// Make sure that the Types are known to go-glib. Special types need to be registered with
// RegisterGValueMarshalers before calling Emit. Sub libraries of go-gst (sdp, rtp, webrtc, base, etc.)
// register their types when they are imported via init() functions.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) Emit(signal string, args ...interface{}) (interface{}, error) {
// We are wrapping this for the same reason as Connect.
if e.TypeFromInstance() != glib.Type(C.GST_TYPE_ELEMENT) {
glib.RegisterGValueMarshalers([]glib.TypeMarshaler{{T: e.TypeFromInstance(), F: marshalElement}})
}
return e.Object.Emit(signal, args...)
}
// InfoMessage is a convenience wrapper for posting an info message from inside an element. Only to be used from
// plugins.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) InfoMessage(domain Domain, text string) {
function, file, line, _ := runtime.Caller(1)
e.MessageFull(MessageInfo, domain, ErrorCode(0), "", text, path.Base(file), runtime.FuncForPC(function).Name(), line)
}
// WarningMessage is a convenience wrapper for posting a warning message from inside an element. Only to be used from
// plugins.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) WarningMessage(domain Domain, text string) {
function, file, line, _ := runtime.Caller(1)
e.MessageFull(MessageWarning, domain, ErrorCode(0), "", text, path.Base(file), runtime.FuncForPC(function).Name(), line)
}
// Error is a convenience wrapper around ErrorMessage to simply post the provided go error on the bus.
// The domain is assumed to be DomainLibrary and the code is assumed to be LibraryErrorFailed.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) Error(msg string, err error) {
function, file, line, _ := runtime.Caller(1)
debugMsg := fmt.Sprintf("%s: %s", msg, err.Error())
e.MessageFull(MessageError, DomainLibrary, LibraryErrorFailed, err.Error(), debugMsg, path.Base(file), runtime.FuncForPC(function).Name(), line)
}
// ErrorMessage is a convenience wrapper for posting an error message from inside an element. Only to be used from
// plugins.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) ErrorMessage(domain Domain, code ErrorCode, text, debug string) {
function, file, line, _ := runtime.Caller(1)
e.MessageFull(MessageError, domain, code, text, debug, path.Base(file), runtime.FuncForPC(function).Name(), line)
}
// MessageFull will post an error, warning, or info message on the bus from inside an element. Only to be used
// from plugins.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) MessageFull(msgType MessageType, domain Domain, code ErrorCode, text, debug, file, function string, line int) {
var cTxt, cDbg unsafe.Pointer = nil, nil
if text != "" {
ctxtstr := C.CString(debug)
defer C.free(unsafe.Pointer(ctxtstr))
cTxt = unsafe.Pointer(C.g_strdup((*C.gchar)(unsafe.Pointer(ctxtstr))))
}
if debug != "" {
cdbgstr := C.CString(debug)
defer C.free(unsafe.Pointer(cdbgstr))
cDbg = unsafe.Pointer(C.g_strdup((*C.gchar)(unsafe.Pointer(cdbgstr))))
}
C.gst_element_message_full(
e.Instance(),
C.GstMessageType(msgType),
domain.toQuark(),
C.gint(code),
(*C.gchar)(cTxt),
(*C.gchar)(cDbg),
C.CString(file),
C.CString(function),
C.gint(line),
)
}
// GetBus returns the GstBus for retrieving messages from this element. This function returns
// nil unless the element is a Pipeline.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) GetBus() *Bus {
bus := C.gst_element_get_bus((*C.GstElement)(e.Instance()))
if bus == nil {
return nil
}
return FromGstBusUnsafeFull(unsafe.Pointer(bus))
}
// GetClock returns the Clock for this element. This is the clock as was last set with gst_element_set_clock.
// Elements in a pipeline will only have their clock set when the pipeline is in the PLAYING state.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) GetClock() *Clock {
cClock := C.gst_element_get_clock((*C.GstElement)(e.Instance()))
if cClock == nil {
return nil
}
return FromGstClockUnsafeFull(unsafe.Pointer(cClock))
}
// GetFactory returns the factory that created this element. No refcounting is needed.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) GetFactory() *ElementFactory {
factory := C.gst_element_get_factory((*C.GstElement)(e.Instance()))
if factory == nil {
return nil
}
return wrapElementFactory(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(factory))})
}
// GetPads retrieves a list of pads associated with the element.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) GetPads() ([]*Pad, error) {
iter := C.gst_element_iterate_pads(e.Instance())
if iter == nil {
return nil, nil
}
return iteratorToPadSlice(iter)
}
// GetSinkPads retrieves a list of sink pads associated with the element.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) GetSinkPads() ([]*Pad, error) {
iter := C.gst_element_iterate_sink_pads(e.Instance())
if iter == nil {
return nil, nil
}
return iteratorToPadSlice(iter)
}
// GetSrcPads retrieves a list of src pads associated with the element.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) GetSrcPads() ([]*Pad, error) {
iter := C.gst_element_iterate_src_pads(e.Instance())
if iter == nil {
return nil, nil
}
return iteratorToPadSlice(iter)
}
// GetPadTemplates retrieves a list of the pad templates associated with this element.
// The list must not be modified by the calling code.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) GetPadTemplates() []*PadTemplate {
glist := C.gst_element_get_pad_template_list((*C.GstElement)(e.Instance()))
if glist == nil {
return nil
}
goList := glib.WrapList(unsafe.Pointer(glist))
out := make([]*PadTemplate, 0)
goList.Foreach(func(item interface{}) {
pt := item.(unsafe.Pointer)
out = append(out, wrapPadTemplate(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(pt))}))
})
return out
}
// Gets the state of the element.
//
// For elements that performed an ASYNC state change, as reported by gst_element_set_state, this function will block up
// to the specified timeout value for the state change to complete. If the element completes the state change or goes into
// an error, this function returns immediately with a return value of GST_STATE_CHANGE_SUCCESS or GST_STATE_CHANGE_FAILURE respectively.
//
// For elements that did not return GST_STATE_CHANGE_ASYNC, this function returns the current and pending state immediately.
//
// This function returns GST_STATE_CHANGE_NO_PREROLL if the element successfully changed its state but is not able to provide
// data yet. This mostly happens for live sources that only produce data in GST_STATE_PLAYING. While the state change return is
// equivalent to GST_STATE_CHANGE_SUCCESS, it is returned to the application to signal that some sink elements might not be able
// to complete their state change because an element is not producing data to complete the preroll. When setting the element to
// playing, the preroll will complete and playback will start.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) GetState(state State, timeout ClockTime) (StateChangeReturn, State) {
pending := C.GstState(state)
var curState C.GstState
stateChangeStatus := C.gst_element_get_state(
(*C.GstElement)(e.Instance()),
(*C.GstState)(unsafe.Pointer(&curState)),
(*C.GstState)(unsafe.Pointer(&pending)),
C.GstClockTime(timeout),
)
return StateChangeReturn(stateChangeStatus), State(curState)
}
// this returns the value of the `current_state` member of the element:
//
// the current state of an element
//
// see https://gstreamer.freedesktop.org/documentation/gstreamer/gstelement.html?gi-language=c#members
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) GetCurrentState() State {
return State(e.Instance().current_state)
}
// GetStaticPad retrieves a pad from element by name. This version only retrieves
// already-existing (i.e. 'static') pads.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) GetStaticPad(name string) *Pad {
cname := C.CString(name)
defer C.free(unsafe.Pointer(cname))
pad := C.gst_element_get_static_pad(e.Instance(), (*C.gchar)(unsafe.Pointer(cname)))
if pad == nil {
return nil
}
return FromGstPadUnsafeFull(unsafe.Pointer(pad))
}
// Has returns true if this element has the given flags.
// Non MT safe
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) Has(flags ElementFlags) bool {
return e.hasFlags(uint32(flags))
}
// Set element flags
// Non MT safe
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) SetFlags(flags ElementFlags) {
e.setFlags(uint32(flags))
}
// Unset element flags
// Non MT safe
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) UnsetFlags(flags ElementFlags) {
e.unsetFlags(uint32(flags))
}
// IsURIHandler returns true if this element can handle URIs.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) IsURIHandler() bool {
return gobool(C.gstElementIsURIHandler(e.Instance()))
}
// Link wraps gst_element_link and links this element to the given one.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) Link(elem *Element) error {
if ok := C.gst_element_link((*C.GstElement)(e.Instance()), (*C.GstElement)(elem.Instance())); !gobool(ok) {
return fmt.Errorf("failed to link %s to %s", e.GetName(), elem.GetName())
}
return nil
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) Unlink(elem *Element) {
C.gst_element_unlink((*C.GstElement)(e.Instance()), (*C.GstElement)(elem.Instance()))
}
// LinkFiltered wraps gst_element_link_filtered and link this element to the given one
// using the provided sink caps.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) LinkFiltered(elem *Element, filter *Caps) error {
if filter == nil {
if ok := C.gst_element_link_filtered(e.Instance(), elem.Instance(), nil); !gobool(ok) {
return fmt.Errorf("failed to link %s to %s with provided caps", e.GetName(), elem.GetName())
}
return nil
}
if ok := C.gst_element_link_filtered(e.Instance(), elem.Instance(), filter.Instance()); !gobool(ok) {
return fmt.Errorf("failed to link %s to %s with provided caps", e.GetName(), elem.GetName())
}
return nil
}
// ParentChangeState can be used when extending an element to chain up to the parents ChangeState
// handler.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) ParentChangeState(transition StateChange) StateChangeReturn {
return StateChangeReturn(C.elementParentChangeState(e.Instance(), C.GstStateChange(transition)))
}
// ParentSendEvent chains up to the parent SendEvent handler.
// send_event takes ownership of the incoming event pointer so we have to ref it beforehand
// in order not to mess up go's gc
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) ParentSendEvent(event *Event) bool {
return gobool(C.elementParentSendEvent(e.Instance(), event.Ref().Instance()))
}
// ParentPostMessage can be used when extending an element. During a PostMessage, use this method
// to have the message posted on the bus after processing.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) ParentPostMessage(msg *Message) bool {
return gobool(C.elementParentPostMessage(e.Instance(), msg.Instance()))
}
// Query performs a query on the given element.
//
// For elements that don't implement a query handler, this function forwards the query to a random srcpad or
// to the peer of a random linked sinkpad of this element.
//
// Please note that some queries might need a running pipeline to work.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) Query(q *Query) bool {
return gobool(C.gst_element_query(e.Instance(), q.Instance()))
}
// QueryConvert queries an element to convert src_val in src_format to dest_format.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) QueryConvert(srcFormat Format, srcValue int64, destFormat Format) (bool, int64) {
var out C.gint64
gok := C.gst_element_query_convert(e.Instance(), C.GstFormat(srcFormat), C.gint64(srcValue), C.GstFormat(destFormat), &out)
return gobool(gok), int64(out)
}
// QueryDuration queries an element (usually top-level pipeline or playbin element) for the total stream
// duration in nanoseconds. This query will only work once the pipeline is prerolled (i.e. reached PAUSED
// or PLAYING state). The application will receive an ASYNC_DONE message on the pipeline bus when that is
// the case.
//
// If the duration changes for some reason, you will get a DURATION_CHANGED message on the pipeline bus,
// in which case you should re-query the duration using this function.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) QueryDuration(format Format) (bool, int64) {
var out C.gint64
gok := C.gst_element_query_duration(e.Instance(), C.GstFormat(format), &out)
return gobool(gok), int64(out)
}
// QueryPosition queries an element (usually top-level pipeline or playbin element) for the stream position
// in nanoseconds. This will be a value between 0 and the stream duration (if the stream duration is known).
// This query will usually only work once the pipeline is prerolled (i.e. reached PAUSED or PLAYING state).
// The application will receive an ASYNC_DONE message on the pipeline bus when that is the case.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) QueryPosition(format Format) (bool, int64) {
var out C.gint64
gok := C.gst_element_query_position(e.Instance(), C.GstFormat(format), &out)
return gobool(gok), int64(out)
}
// SendEvent sends an event to an element. If the element doesn't implement an event handler, the event will
// be pushed on a random linked sink pad for downstream events or a random linked source pad for upstream events.
//
// This function takes ownership of the provided event so you should gst_event_ref it if you want to reuse the event
// after this call.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) SendEvent(ev *Event) bool {
return gobool(C.gst_element_send_event(e.Instance(), ev.Ref().Instance()))
}
// SetState sets the target state for this element.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) SetState(state State) error {
stateRet := C.gst_element_set_state((*C.GstElement)(e.Instance()), C.GstState(state))
if stateRet == C.GST_STATE_CHANGE_FAILURE {
return fmt.Errorf("failed to change state to %s", state.String())
}
return nil
}
// SetLockedState sets the locked state flag for this element.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) SetLockedState(lockedState bool) error {
ret := C.gst_element_set_locked_state((*C.GstElement)(e.Instance()), gboolean(lockedState))
if !gobool(ret) {
return fmt.Errorf("failed to set locked state")
}
return nil
}
// SyncStateWithParent tries to change the state of the element to the same as its parent. If this function returns
// FALSE, the state of element is undefined.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) SyncStateWithParent() bool {
return gobool(C.gst_element_sync_state_with_parent(e.Instance()))
}
// TOCSetter returns a TOCSetter interface if implemented by this element. Otherwise it
// returns nil. Currently this only supports elements built through this package, however,
// inner application elements could still use the interface as a reference implementation.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) TOCSetter() TOCSetter {
if C.toTocSetter(e.Instance()) == nil {
return nil
}
return &gstTOCSetter{ptr: e.Instance()}
}
// TagSetter returns a TagSetter interface if implemented by this element. Otherwise it returns nil.
// This currently only supports elements built through this package's bindings, however, inner application
// elements can still implement the interface themselves if they want.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) TagSetter() TagSetter {
if C.toTagSetter(e.Instance()) == nil {
return nil
}
return &gstTagSetter{ptr: e.Instance()}
}
// URIHandler returns a URIHandler interface if implemented by this element. Otherwise it
// returns nil. Currently this only supports elements built through this package, however,
// inner application elements could still use the interface as a reference implementation.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) URIHandler() URIHandler {
if C.toGstURIHandler(e.Unsafe()) == nil {
return nil
}
return &gstURIHandler{ptr: e.Instance()}
}
// RemovePad removes pad from element. pad will be destroyed if it has not been referenced elsewhere using gst_object_unparent.
//
// This function is used by plugin developers and should not be used by applications. Pads that were dynamically requested from
// elements with gst_element_request_pad should be released with the gst_element_release_request_pad function instead.
//
// Pads are not automatically deactivated so elements should perform the needed steps to deactivate the pad in case this pad is
// removed in the PAUSED or PLAYING state. See gst_pad_set_active for more information about deactivating pads.
//
// The pad and the element should be unlocked when calling this function.
//
// This function will emit the pad-removed signal on the element.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) RemovePad(pad *Pad) bool {
return gobool(C.gst_element_remove_pad(e.Instance(), pad.Instance()))
}
// GetRequestPad gets a request pad from the element based on the name of the pad template.
// Unlike static pads, request pads are not created automatically but are only created on demand
// For example, audiomixer has sink template, 'sink_%u', which is used for creating multiple sink pads on demand so that it performs mixing of audio streams by linking multiple upstream elements on it's sink pads created on demand.
// This returns the request pad created on demand. Otherwise, it returns null if failed to create.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) GetRequestPad(name string) *Pad {
cname := C.CString(name)
defer C.free(unsafe.Pointer(cname))
pad := C.gst_element_get_request_pad(e.Instance(), (*C.gchar)(unsafe.Pointer(cname)))
if pad == nil {
return nil
}
return FromGstPadUnsafeFull(unsafe.Pointer(pad))
}
// ReleaseRequestPad releases request pad
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) ReleaseRequestPad(pad *Pad) {
C.gst_element_release_request_pad(e.Instance(), pad.Instance())
}
// Set the start time of an element. The start time of the element is the running time of the element
// when it last went to the PAUSED state. In READY or after a flushing seek, it is set to 0.
//
// Toplevel elements like GstPipeline will manage the start_time and base_time on its children.
// Setting the start_time to GST_CLOCK_TIME_NONE on such a toplevel element will disable the distribution of the base_time
// to the children and can be useful if the application manages the base_time itself, for example if you want to synchronize
// capture from multiple pipelines, and you can also ensure that the pipelines have the same clock.
//
// MT safe.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) SetStartTime(startTime ClockTime) {
C.gst_element_set_start_time(e.Instance(), C.GstClockTime(startTime))
}
// Returns the start time of the element. The start time is the running time of the clock when this element was last put to PAUSED.
// Usually the start_time is managed by a toplevel element such as GstPipeline.
// MT safe.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) GetStartTime() ClockTime {
ctime := C.gst_element_get_start_time(e.Instance())
return ClockTime(ctime)
}
// Set the base time of an element. The base time is the absolute time of the clock
// when this element was last put to PLAYING. Subtracting the base time from the clock time gives the running time of the element.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) SetBaseTime(startTime ClockTime) {
C.gst_element_set_base_time(e.Instance(), C.GstClockTime(startTime))
}
// Returns the base time of the element. The base time is the absolute time of the clock
// when this element was last put to PLAYING. Subtracting the base time from the clock time gives the running time of the element.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) GetBaseTime() ClockTime {
ctime := C.gst_element_get_base_time(e.Instance())
return ClockTime(ctime)
}
// SeekSimple seeks to the given position in the stream. The element / pipeline should be in the PAUSED or PLAYING state and must be a seekable.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) SeekSimple(position int64, format Format, flag SeekFlags) bool {
result := C.gst_element_seek_simple(e.Instance(), C.GstFormat(format), C.GstSeekFlags(flag), C.gint64(position))
return gobool(result)
}
// SeekTime seeks to the given position time in the stream. The element / pipeline should be in the PAUSED or PLAYING state and must be a seekable.
//
// For example, to seek to 40th second of the stream, use:
//
// pos := int64(time.Duration(40 * time.Second))
// element.SeekTime(pos, gst.FormatTime, gst.SeekFlagFlush)
//
// to perform a flush seek to the nearest keyframe before the given position.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) SeekTime(position time.Duration, flag SeekFlags) bool {
return e.SeekSimple(position.Nanoseconds(), FormatTime, flag)
}
// SeekDefault seeks to the given position in the stream. The position is the frame number for video, or sample for audio.
// The element should be in the PAUSED or PLAYING state and must be a seekable.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) SeekDefault(position int64, flag SeekFlags) bool {
return e.SeekSimple(position, FormatDefault, flag)
}
// this prevents go pointers in cgo when setting a gst.Element to a property
// see (https://github.com/go-gst/go-gst/issues/65)
// ToGValue implements glib.ValueTransformer.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Element) ToGValue() (*glib.Value, error) {
val, err := glib.ValueInit(glib.Type(C.GST_TYPE_ELEMENT))
if err != nil {
return nil, err
}
val.SetInstance(unsafe.Pointer(e.Instance()))
return val, nil
}

View File

@@ -1,129 +0,0 @@
package gst
/*
#include "gst.go.h"
*/
import "C"
import (
"unsafe"
"github.com/go-gst/go-glib/glib"
)
// ElementClass represents the subclass of an element provided by a plugin.
type ElementClass struct{ *glib.ObjectClass }
// ToElementClass wraps the given ObjectClass in an ElementClass instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func ToElementClass(klass *glib.ObjectClass) *ElementClass {
return &ElementClass{klass}
}
// Instance returns the underlying GstElementClass instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *ElementClass) Instance() *C.GstElementClass {
return C.toGstElementClass(e.Unsafe())
}
// AddMetadata sets key with the given value in the metadata of the class.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *ElementClass) AddMetadata(key, value string) {
C.gst_element_class_add_static_metadata(
e.Instance(),
(*C.gchar)(C.CString(key)),
(*C.gchar)(C.CString(value)),
)
}
// AddPadTemplate adds a padtemplate to an element class. This is mainly used in the
// ClassInit functions of ObjectSubclasses. If a pad template with the same name as an
// already existing one is added the old one is replaced by the new one.
//
// templ's reference count will be incremented, and any floating reference will be removed
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *ElementClass) AddPadTemplate(templ *PadTemplate) {
C.gst_element_class_add_pad_template(
e.Instance(),
(*C.GstPadTemplate)(templ.Unsafe()),
)
}
// AddStaticPadTemplate adds a pad template to an element class based on the pad template templ. The template
// is first converted to a static pad template.
//
// This is mainly used in the ClassInit functions of element implementations. If a pad template with the
// same name already exists, the old one is replaced by the new one.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *ElementClass) AddStaticPadTemplate(templ *PadTemplate) {
staticTmpl := C.GstStaticPadTemplate{
name_template: templ.Instance().name_template,
direction: templ.Instance().direction,
presence: templ.Instance().presence,
static_caps: C.GstStaticCaps{
caps: templ.Caps().Ref().Instance(),
string: C.CString(templ.Name()),
},
}
C.gst_element_class_add_static_pad_template(
e.Instance(),
&staticTmpl,
)
}
// GetMetadata retrieves the metadata associated with key in the class.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *ElementClass) GetMetadata(key string) string {
ckey := C.CString(key)
defer C.free(unsafe.Pointer(ckey))
return C.GoString(C.gst_element_class_get_metadata(e.Instance(), (*C.gchar)(ckey)))
}
// GetPadTemplate retrieves the padtemplate with the given name.
// If no pad template exists with the given name, nil is returned.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *ElementClass) GetPadTemplate(name string) *PadTemplate {
cname := C.CString(name)
defer C.free(unsafe.Pointer(cname))
tmpl := C.gst_element_class_get_pad_template(e.Instance(), (*C.gchar)(cname))
if tmpl == nil {
return nil
}
return FromGstPadTemplateUnsafeNone(unsafe.Pointer(tmpl))
}
// GetAllPadTemplates retrieves a slice of all the pad templates associated with this class.
// The list must not be modified.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *ElementClass) GetAllPadTemplates() []*PadTemplate {
glist := C.gst_element_class_get_pad_template_list(e.Instance())
return glistToPadTemplateSlice(glist)
}
// SetMetadata sets the detailed information for this class.
//
// `longname` - The english long name of the element. E.g "File Sink"
//
// `classification` - A string describing the type of element, as an unordered list separated with slashes ('/'). E.g: "Sink/File"
//
// `description` - Sentence describing the purpose of the element. E.g: "Write stream to a file"
//
// `author` - Name and contact details of the author(s). Use \n to separate multiple author metadata. E.g: "Joe Bloggs <joe.blogs at foo.com>"
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *ElementClass) SetMetadata(longname, classification, description, author string) {
C.gst_element_class_set_static_metadata(
e.Instance(),
(*C.gchar)(C.CString(longname)),
(*C.gchar)(C.CString(classification)),
(*C.gchar)(C.CString(description)),
(*C.gchar)(C.CString(author)),
)
}

View File

@@ -1,119 +0,0 @@
package gst_test
import (
"errors"
"strings"
"testing"
"github.com/go-gst/go-glib/glib"
"github.com/go-gst/go-gst/gst"
)
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func TestSignalEmitSimpleReturnValue(t *testing.T) {
gst.Init(nil)
webrtcbin, err := gst.NewElement("webrtcbin")
if err != nil {
t.Fatal(err)
}
okI, err := webrtcbin.Emit("add-turn-server", "turn://user:password@host:1234")
if err != nil {
t.Fatal(err)
}
ok := okI.(bool)
if !ok {
t.Fatal("Failed to add turn server")
}
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func TestSignalEmitVoidReturnValue(t *testing.T) {
gst.Init(nil)
elem, err := gst.NewElement("splitmuxsink")
if err != nil {
t.Fatal(err)
}
result, err := elem.Emit("split-after")
if err != nil {
t.Fatal("Result must be nil due to void return type, unless splitmux api changed" +
err.Error())
}
if result != nil {
t.Fatal("Result must be nil due to void return type, unless splitmux api changed")
}
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func TestSignalEmitGObjectReturnValue(t *testing.T) {
gst.Init(nil)
elements := []string{
"rtpbin", "name=rtpbin",
"videotestsrc", "!", "videoconvert", "!", "queue", "!",
"x264enc", "bframes=0", "speed-preset=ultrafast", "tune=zerolatency", "name=encoder", "!", "queue", "!", "rtph264pay", "config-interval=1", "!", "rtpbin.send_rtp_sink_0", "rtpbin.send_rtp_src_0", "!",
"udpsink", "host=127.0.0.1", "port=5510", "sync=false", "async=false", "rtpbin.send_rtcp_src_0", "!",
"udpsink", "host=127.0.0.1", "port=5511", "sync=false", "async=false",
"udpsrc", "port=5511", "caps=\"application/x-rtcp\"", "!", "rtpbin.recv_rtcp_sink_0",
}
pipeline, err := gst.NewPipelineFromString(strings.Join(elements, " "))
if err != nil {
t.Fatal(err)
}
rtpbin, err := pipeline.GetElementByName("rtpbin")
if err != nil {
t.Fatal(err)
}
errchan := make(chan error)
rtpbin.Connect("on-new-ssrc", func(bin *gst.Element, sessionID uint, ssrc uint32) {
retI, err := rtpbin.Emit("get-internal-session", sessionID)
if err != nil {
errchan <- err
}
rtpSession, ok := retI.(*glib.Object)
if !ok {
errchan <- errors.New("could not cast return value to *glib.Object")
}
bw, err := rtpSession.GetProperty("bandwidth")
if err != nil {
errchan <- err
}
_ = bw
close(errchan)
})
pipeline.SetState(gst.StatePlaying)
err = <-errchan
if err != nil {
t.Fatal(err)
}
pipeline.SetState(gst.StateNull)
}

View File

@@ -1,248 +0,0 @@
package gst
/*
#include "gst.go.h"
*/
import "C"
import (
"time"
"unsafe"
"github.com/go-gst/go-glib/glib"
)
//export goGstElementClassChangeState
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstElementClassChangeState(elem *C.GstElement, change C.GstStateChange) C.GstStateChangeReturn {
var ret StateChangeReturn
goElem := wrapElement(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(elem))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(elem))
iface := subclass.(interface {
ChangeState(*Element, StateChange) StateChangeReturn
})
ret = iface.ChangeState(goElem, StateChange(change))
return C.GstStateChangeReturn(ret)
}
//export goGstElementClassGetState
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstElementClassGetState(elem *C.GstElement, state, pending *C.GstState, timeout C.GstClockTime) C.GstStateChangeReturn {
var ret StateChangeReturn
goElem := wrapElement(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(elem))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(elem))
iface := subclass.(interface {
GetState(*Element, time.Duration) (ret StateChangeReturn, current, pending State) // should this be a ClockTime?
})
var cur, pend State
ret, cur, pend = iface.GetState(goElem, time.Duration(timeout)*time.Nanosecond)
if ret != StateChangeFailure {
*state = C.GstState(cur)
*pending = C.GstState(pend)
}
return C.GstStateChangeReturn(ret)
}
//export goGstElementClassNoMorePads
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstElementClassNoMorePads(elem *C.GstElement) {
goElem := wrapElement(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(elem))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(elem))
iface := subclass.(interface{ NoMorePads(*Element) })
iface.NoMorePads(goElem)
}
//export goGstElementClassPadAdded
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstElementClassPadAdded(elem *C.GstElement, pad *C.GstPad) {
goElem := wrapElement(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(elem))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(elem))
iface := subclass.(interface{ PadAdded(*Element, *Pad) })
iface.PadAdded(goElem, wrapPad(toGObject(unsafe.Pointer(pad))))
}
//export goGstElementClassPadRemoved
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstElementClassPadRemoved(elem *C.GstElement, pad *C.GstPad) {
goElem := wrapElement(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(elem))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(elem))
iface := subclass.(interface{ PadRemoved(*Element, *Pad) })
iface.PadRemoved(goElem, wrapPad(toGObject(unsafe.Pointer(pad))))
}
//export goGstElementClassPostMessage
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstElementClassPostMessage(elem *C.GstElement, msg *C.GstMessage) C.gboolean {
var ret C.gboolean
goElem := wrapElement(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(elem))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(elem))
iface := subclass.(interface{ PostMessage(*Element, *Message) bool })
ret = gboolean(iface.PostMessage(goElem, wrapMessage(msg)))
return ret
}
//export goGstElementClassProvideClock
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstElementClassProvideClock(elem *C.GstElement) *C.GstClock {
var clock *Clock
goElem := wrapElement(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(elem))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(elem))
iface := subclass.(interface{ ProvideClock(*Element) *Clock })
clock = iface.ProvideClock(goElem)
if clock == nil {
return nil
}
return clock.Instance()
}
//export goGstElementClassQuery
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstElementClassQuery(elem *C.GstElement, query *C.GstQuery) C.gboolean {
var ret C.gboolean
goElem := wrapElement(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(elem))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(elem))
iface := subclass.(interface{ Query(*Element, *Query) bool })
ret = gboolean(iface.Query(goElem, wrapQuery(query)))
return ret
}
//export goGstElementClassReleasePad
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstElementClassReleasePad(elem *C.GstElement, pad *C.GstPad) {
goElem := wrapElement(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(elem))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(elem))
iface := subclass.(interface{ ReleasePad(*Element, *Pad) })
iface.ReleasePad(goElem, wrapPad(toGObject(unsafe.Pointer(pad))))
}
//export goGstElementClassRequestNewPad
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstElementClassRequestNewPad(elem *C.GstElement, templ *C.GstPadTemplate, name *C.gchar, caps *C.GstCaps) *C.GstPad {
var pad *Pad
goElem := wrapElement(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(elem))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(elem))
iface := subclass.(interface {
RequestNewPad(self *Element, templ *PadTemplate, name string, caps *Caps) *Pad
})
pad = iface.RequestNewPad(
goElem,
wrapPadTemplate(toGObject(unsafe.Pointer(templ))),
C.GoString(name),
wrapCaps(caps),
)
if pad == nil {
return nil
}
return pad.Instance()
}
//export goGstElementClassSendEvent
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstElementClassSendEvent(elem *C.GstElement, event *C.GstEvent) C.gboolean {
var ret C.gboolean
goElem := wrapElement(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(elem))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(elem))
iface := subclass.(interface{ SendEvent(*Element, *Event) bool })
ret = gboolean(iface.SendEvent(goElem, wrapEvent(event)))
return ret
}
//export goGstElementClassSetBus
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstElementClassSetBus(elem *C.GstElement, bus *C.GstBus) {
goElem := wrapElement(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(elem))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(elem))
iface := subclass.(interface{ SetBus(*Element, *Bus) })
iface.SetBus(goElem, wrapBus(toGObject(unsafe.Pointer(bus))))
}
//export goGstElementClassSetClock
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstElementClassSetClock(elem *C.GstElement, clock *C.GstClock) C.gboolean {
var ret C.gboolean
goElem := wrapElement(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(elem))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(elem))
iface := subclass.(interface{ SetClock(*Element, *Clock) bool })
ret = gboolean(iface.SetClock(goElem, wrapClock(toGObject(unsafe.Pointer(clock)))))
return ret
}
//export goGstElementClassSetContext
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstElementClassSetContext(elem *C.GstElement, ctx *C.GstContext) {
goElem := wrapElement(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(elem))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(elem))
iface := subclass.(interface{ SetContext(*Element, *Context) })
iface.SetContext(goElem, wrapContext(ctx))
}
//export goGstElementClassSetState
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstElementClassSetState(elem *C.GstElement, state C.GstState) C.GstStateChangeReturn {
var ret C.GstStateChangeReturn
goElem := wrapElement(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(elem))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(elem))
iface := subclass.(interface {
SetState(*Element, State) StateChangeReturn
})
ret = C.GstStateChangeReturn(iface.SetState(goElem, State(state)))
return ret
}
//export goGstElementClassStateChanged
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func goGstElementClassStateChanged(elem *C.GstElement, old, new, pending C.GstState) {
goElem := wrapElement(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(elem))})
subclass := glib.FromObjectUnsafePrivate(unsafe.Pointer(elem))
iface := subclass.(interface {
StateChanged(self *Element, old, new, pending State)
})
iface.StateChanged(goElem, State(old), State(new), State(pending))
}

View File

@@ -1,172 +0,0 @@
package gst
// #include "gst.go.h"
import "C"
import (
"fmt"
"runtime"
"unsafe"
"github.com/go-gst/go-glib/glib"
)
// NewElement creates a new element using the factory of the given name.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewElement(factory string) (*Element, error) {
return NewElementWithName(factory, "")
}
// NewElementWithName creates a new element and sets it's name to the given value.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewElementWithName(factory string, name string) (*Element, error) {
elemName := C.CString(factory)
defer C.free(unsafe.Pointer(elemName))
var elem *C.GstElement
if name == "" {
elem = C.gst_element_factory_make((*C.gchar)(elemName), nil)
} else {
cname := C.CString(name)
defer C.free(unsafe.Pointer(cname))
elem = C.gst_element_factory_make((*C.gchar)(elemName), (*C.gchar)(cname))
}
if elem == nil {
return nil, fmt.Errorf("could not create element: %s", factory)
}
return wrapElement(glib.TransferNone(unsafe.Pointer(elem))), nil
}
// Create a new element of the type defined by the given elementfactory. The supplied list of properties, will be passed at object construction.
//
// this function is needed for gstreamer props that have the "Construct Only" flag, e.g.:
// https://gstreamer.freedesktop.org/documentation/audio/gstaudioaggregator.html?gi-language=c#GstAudioAggregator:force-live
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewElementWithProperties(factory string, properties map[string]interface{}) (*Element, error) {
props := make([]*C.char, 0)
values := make([]C.GValue, 0)
for p, v := range properties {
cpropName := C.CString(p)
defer C.free(unsafe.Pointer(cpropName))
props = append(props, cpropName)
value, err := glib.GValue(v)
if err != nil {
return nil, err
}
// value goes out of scope, but the finalizer must not run until the cgo call is finished
defer runtime.KeepAlive(value)
values = append(values, *(*C.GValue)(value.Unsafe()))
}
cfactory := C.CString(factory)
defer C.free(unsafe.Pointer(cfactory))
n := C.uint(len(properties))
p := unsafe.SliceData(props)
v := unsafe.SliceData(values)
elem := C.gst_element_factory_make_with_properties(cfactory, n, p, v)
if elem == nil {
return nil, fmt.Errorf("could not create element: %s", factory)
}
return wrapElement(glib.TransferNone(unsafe.Pointer(elem))), nil
}
// NewElementMany is a convenience wrapper around building many GstElements in a
// single function call. It returns an error if the creation of any element fails. A
// slice in the order the names were given is returned.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewElementMany(elemNames ...string) ([]*Element, error) {
elems := make([]*Element, len(elemNames))
for idx, name := range elemNames {
elem, err := NewElement(name)
if err != nil {
return nil, err
}
elems[idx] = elem
}
return elems, nil
}
// ElementFactory wraps the GstElementFactory
type ElementFactory struct{ *PluginFeature }
// Find returns the factory for the given plugin, or nil if it doesn't exist.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func Find(name string) *ElementFactory {
cName := C.CString(name)
defer C.free(unsafe.Pointer(cName))
factory := C.gst_element_factory_find((*C.gchar)(cName))
if factory == nil {
return nil
}
return wrapElementFactory(glib.TransferFull(unsafe.Pointer(factory)))
}
// Instance returns the C GstFactory instance
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *ElementFactory) Instance() *C.GstElementFactory { return C.toGstElementFactory(e.Unsafe()) }
// CanSinkAllCaps checks if the factory can sink all possible capabilities.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *ElementFactory) CanSinkAllCaps(caps *Caps) bool {
return gobool(C.gst_element_factory_can_sink_all_caps((*C.GstElementFactory)(e.Instance()), (*C.GstCaps)(caps.Instance())))
}
// CanSinkAnyCaps checks if the factory can sink any possible capability.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *ElementFactory) CanSinkAnyCaps(caps *Caps) bool {
return gobool(C.gst_element_factory_can_sink_any_caps((*C.GstElementFactory)(e.Instance()), (*C.GstCaps)(caps.Instance())))
}
// CanSourceAllCaps checks if the factory can src all possible capabilities.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *ElementFactory) CanSourceAllCaps(caps *Caps) bool {
return gobool(C.gst_element_factory_can_src_all_caps((*C.GstElementFactory)(e.Instance()), (*C.GstCaps)(caps.Instance())))
}
// CanSourceAnyCaps checks if the factory can src any possible capability.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *ElementFactory) CanSourceAnyCaps(caps *Caps) bool {
return gobool(C.gst_element_factory_can_src_any_caps((*C.GstElementFactory)(e.Instance()), (*C.GstCaps)(caps.Instance())))
}
// GetMetadata gets the metadata on this factory with key.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *ElementFactory) GetMetadata(key string) string {
ckey := C.CString(key)
defer C.free(unsafe.Pointer(ckey))
res := C.gst_element_factory_get_metadata((*C.GstElementFactory)(e.Instance()), (*C.gchar)(ckey))
defer C.free(unsafe.Pointer(res))
return C.GoString(res)
}
// GetMetadataKeys gets the available keys for the metadata on this factory.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *ElementFactory) GetMetadataKeys() []string {
keys := C.gst_element_factory_get_metadata_keys((*C.GstElementFactory)(e.Instance()))
if keys == nil {
return nil
}
defer C.g_strfreev(keys)
size := C.sizeOfGCharArray(keys)
return goStrings(size, keys)
}

View File

@@ -1,206 +0,0 @@
package gst
/*
#include "gst.go.h"
extern GstStateChangeReturn goGstElementClassChangeState (GstElement * element, GstStateChange change);
extern GstStateChangeReturn goGstElementClassGetState (GstElement * element, GstState * state, GstState * pending, GstClockTime timeout);
extern void goGstElementClassNoMorePads (GstElement * element);
extern void goGstElementClassPadAdded (GstElement * element, GstPad * pad);
extern void goGstElementClassPadRemoved (GstElement * element, GstPad * pad);
extern gboolean goGstElementClassPostMessage (GstElement * element, GstMessage * msg);
extern GstClock * goGstElementClassProvideClock (GstElement * element);
extern gboolean goGstElementClassQuery (GstElement * element, GstQuery * query);
extern void goGstElementClassReleasePad (GstElement * element, GstPad * pad);
extern GstPad * goGstElementClassRequestNewPad (GstElement * element, GstPadTemplate * templ, const gchar * name, const GstCaps * caps);
extern gboolean goGstElementClassSendEvent (GstElement * element, GstEvent * event);
extern void goGstElementClassSetBus (GstElement * element, GstBus * bus);
extern gboolean goGstElementClassSetClock (GstElement * element, GstClock * clock);
extern void goGstElementClassSetContext (GstElement * element, GstContext * ctx);
extern GstStateChangeReturn goGstElementClassSetState (GstElement * element, GstState state);
extern void goGstElementClassStateChanged (GstElement * element, GstState old, GstState new, GstState pending);
void setGstElementClassChangeState (GstElementClass * klass) { klass->change_state = goGstElementClassChangeState; }
void setGstElementClassGetState (GstElementClass * klass) { klass->get_state = goGstElementClassGetState; }
void setGstElementClassNoMorePads (GstElementClass * klass) { klass->no_more_pads = goGstElementClassNoMorePads; }
void setGstElementClassPadAdded (GstElementClass * klass) { klass->pad_added = goGstElementClassPadAdded; }
void setGstElementClassPadRemoved (GstElementClass * klass) { klass->pad_removed = goGstElementClassPadRemoved; }
void setGstElementClassPostMessage (GstElementClass * klass) { klass->post_message = goGstElementClassPostMessage; }
void setGstElementClassProvideClock (GstElementClass * klass) { klass->provide_clock = goGstElementClassProvideClock; }
void setGstElementClassQuery (GstElementClass * klass) { klass->query = goGstElementClassQuery; }
void setGstElementClassReleasePad (GstElementClass * klass) { klass->release_pad = goGstElementClassReleasePad; }
void setGstElementClassRequestNewPad (GstElementClass * klass) { klass->request_new_pad = goGstElementClassRequestNewPad; }
void setGstElementClassSendEvent (GstElementClass * klass) { klass->send_event = goGstElementClassSendEvent; }
void setGstElementClassSetBus (GstElementClass * klass) { klass->set_bus = goGstElementClassSetBus; }
void setGstElementClassSetClock (GstElementClass * klass) { klass->set_clock = goGstElementClassSetClock; }
void setGstElementClassSetContext (GstElementClass * klass) { klass->set_context = goGstElementClassSetContext; }
void setGstElementClassSetState (GstElementClass * klass) { klass->set_state = goGstElementClassSetState; }
void setGstElementClassStateChanged (GstElementClass * klass) { klass->state_changed = goGstElementClassStateChanged; }
*/
import "C"
import (
"time"
"unsafe"
"github.com/go-gst/go-glib/glib"
)
// ExtendsElement implements an Extendable object based on a GstElement.
var ExtendsElement glib.Extendable = &extendElement{parent: glib.ExtendsObject}
// ElementImpl is an interface containing go equivalents of the virtual methods that can be
// overridden by a plugin extending an Element.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type ElementImpl interface {
// ChangeState is called by SetState to perform an incremental state change.
ChangeState(*Element, StateChange) StateChangeReturn
// GetState should return the states of the element
GetState(self *Element, timeout time.Duration) (ret StateChangeReturn, current, pending State) // should this also be a ClockTime?
// NoMorePads is called when there are no more pads on the element.
NoMorePads(*Element)
// PadAdded is called to add a pad to the element.
PadAdded(*Element, *Pad)
// PadRemoved is called to remove a pad from the element.
PadRemoved(*Element, *Pad)
// PostMessage is called when a message is posted to the element. Call Element.ParentPostMessage
// to have it posted on the bus after processing.
PostMessage(*Element, *Message) bool
// ProvideClock is called to retrieve the clock provided by the element.
ProvideClock(*Element) *Clock
// Query is called to perform a query on the element.
Query(*Element, *Query) bool
// ReleasePad is called when a request pad is to be released.
ReleasePad(*Element, *Pad)
// RequestNewPad is called when a new pad is requested from the element.
RequestNewPad(self *Element, templ *PadTemplate, name string, caps *Caps) *Pad
// SendEvent is called to send an event to the element.
SendEvent(*Element, *Event) bool
// SetBus is called to set the Bus on the element.
SetBus(*Element, *Bus)
// SetClock is called to set the clock on the element.
SetClock(*Element, *Clock) bool
// SetContext is called to set the Context on the element.
SetContext(*Element, *Context)
// SetState is called to set a new state on the element.
SetState(*Element, State) StateChangeReturn
// StateChanged is called immediately after a new state was set.
StateChanged(self *Element, old, new, pending State)
}
type extendElement struct{ parent glib.Extendable }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *extendElement) Type() glib.Type { return glib.Type(C.gst_element_get_type()) }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *extendElement) ClassSize() int64 { return int64(C.sizeof_GstElementClass) }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *extendElement) InstanceSize() int64 { return int64(C.sizeof_GstElement) }
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *extendElement) InitClass(klass unsafe.Pointer, elem glib.GoObjectSubclass) {
e.parent.InitClass(klass, elem)
elemClass := C.toGstElementClass(klass)
if _, ok := elem.(interface {
ChangeState(*Element, StateChange) StateChangeReturn
}); ok {
C.setGstElementClassChangeState(elemClass)
}
if _, ok := elem.(interface {
GetState(self *Element, timeout time.Duration) (ret StateChangeReturn, current, pending State)
}); ok {
C.setGstElementClassGetState(elemClass)
}
if _, ok := elem.(interface {
NoMorePads(*Element)
}); ok {
C.setGstElementClassNoMorePads(elemClass)
}
if _, ok := elem.(interface {
PadAdded(*Element, *Pad)
}); ok {
C.setGstElementClassPadAdded(elemClass)
}
if _, ok := elem.(interface {
PadRemoved(*Element, *Pad)
}); ok {
C.setGstElementClassPadRemoved(elemClass)
}
if _, ok := elem.(interface {
PostMessage(*Element, *Message) bool
}); ok {
C.setGstElementClassPostMessage(elemClass)
}
if _, ok := elem.(interface {
ProvideClock(*Element) *Clock
}); ok {
C.setGstElementClassProvideClock(elemClass)
}
if _, ok := elem.(interface {
Query(*Element, *Query) bool
}); ok {
C.setGstElementClassQuery(elemClass)
}
if _, ok := elem.(interface {
ReleasePad(*Element, *Pad)
}); ok {
C.setGstElementClassReleasePad(elemClass)
}
if _, ok := elem.(interface {
RequestNewPad(self *Element, templ *PadTemplate, name string, caps *Caps) *Pad
}); ok {
C.setGstElementClassRequestNewPad(elemClass)
}
if _, ok := elem.(interface {
SendEvent(*Element, *Event) bool
}); ok {
C.setGstElementClassSendEvent(elemClass)
}
if _, ok := elem.(interface {
SetBus(*Element, *Bus)
}); ok {
C.setGstElementClassSetBus(elemClass)
}
if _, ok := elem.(interface {
SetClock(*Element, *Clock) bool
}); ok {
C.setGstElementClassSetClock(elemClass)
}
if _, ok := elem.(interface {
SetContext(*Element, *Context)
}); ok {
C.setGstElementClassSetContext(elemClass)
}
if _, ok := elem.(interface {
SetState(*Element, State) StateChangeReturn
}); ok {
C.setGstElementClassSetState(elemClass)
}
if _, ok := elem.(interface {
StateChanged(self *Element, old, new, pending State)
}); ok {
C.setGstElementClassStateChanged(elemClass)
}
}

View File

@@ -1,149 +0,0 @@
package gst
/*
#include "gst.go.h"
*/
import "C"
// Domain represents the different types of error domains.
type Domain string
// ErrorDomain castings
const (
DomainCore Domain = "CORE"
DomainLibrary Domain = "LIBRARY"
DomainResource Domain = "RESOURCE"
DomainStream Domain = "STREAM"
)
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (d Domain) toQuark() C.GQuark {
switch d {
case DomainCore:
return C.gst_core_error_quark()
case DomainLibrary:
return C.gst_library_error_quark()
case DomainResource:
return C.gst_resource_error_quark()
case DomainStream:
return C.gst_stream_error_quark()
default:
return C.gst_library_error_quark()
}
}
// ErrorCode represents GstGError codes.
type ErrorCode int
// Type castings of CoreErrors
const (
CoreErrorFailed ErrorCode = C.GST_CORE_ERROR_FAILED // (1) a general error which doesn't fit in any other category. Make sure you add a custom message to the error call.
CoreErrorTooLazy ErrorCode = C.GST_CORE_ERROR_TOO_LAZY // (2) do not use this except as a placeholder for deciding where to go while developing code.
CoreErrorNotImplemented ErrorCode = C.GST_CORE_ERROR_NOT_IMPLEMENTED // (3) use this when you do not want to implement this functionality yet.
CoreErrorStateChange ErrorCode = C.GST_CORE_ERROR_STATE_CHANGE // (4) used for state change errors.
CoreErrorPad ErrorCode = C.GST_CORE_ERROR_PAD // (5) used for pad-related errors.
CoreErrorThread ErrorCode = C.GST_CORE_ERROR_THREAD // (6) used for thread-related errors.
CoreErrorNegotiation ErrorCode = C.GST_CORE_ERROR_NEGOTIATION // (7) used for negotiation-related errors.
CoreErrorEvent ErrorCode = C.GST_CORE_ERROR_EVENT // (8) used for event-related errors.
CoreErrorSeek ErrorCode = C.GST_CORE_ERROR_SEEK // (9) used for seek-related errors.
CoreErrorCaps ErrorCode = C.GST_CORE_ERROR_CAPS // (10) used for caps-related errors.
CoreErrorTag ErrorCode = C.GST_CORE_ERROR_TAG // (11) used for negotiation-related errors.
CoreErrorMissingPlugin ErrorCode = C.GST_CORE_ERROR_MISSING_PLUGIN // (12) used if a plugin is missing.
CoreErrorClock ErrorCode = C.GST_CORE_ERROR_CLOCK // (13) used for clock related errors.
CoreErrorDisabled ErrorCode = C.GST_CORE_ERROR_DISABLED // (14) used if functionality has been disabled at compile time.
)
// Type castings for LibraryErrors
const (
LibraryErrorFailed ErrorCode = C.GST_LIBRARY_ERROR_FAILED // (1) a general error which doesn't fit in any other category. Make sure you add a custom message to the error call.
LibraryErrorTooLazy ErrorCode = C.GST_LIBRARY_ERROR_TOO_LAZY // (2) do not use this except as a placeholder for deciding where to go while developing code.
LibraryErrorInit ErrorCode = C.GST_LIBRARY_ERROR_INIT // (3) used when the library could not be opened.
LibraryErrorShutdown ErrorCode = C.GST_LIBRARY_ERROR_SHUTDOWN // (4) used when the library could not be closed.
LibraryErrorSettings ErrorCode = C.GST_LIBRARY_ERROR_SETTINGS // (5) used when the library doesn't accept settings.
LibraryErrorEncode ErrorCode = C.GST_LIBRARY_ERROR_ENCODE // (6) used when the library generated an encoding error.
)
// Type castings for ResourceErrors
const (
ResourceErrorFailed ErrorCode = C.GST_RESOURCE_ERROR_FAILED // (1) a general error which doesn't fit in any other category. Make sure you add a custom message to the error call.
ResourceErrorTooLazy ErrorCode = C.GST_RESOURCE_ERROR_TOO_LAZY // (2) do not use this except as a placeholder for deciding where to go while developing code.
ResourceErrorNotFound ErrorCode = C.GST_RESOURCE_ERROR_NOT_FOUND // (3) used when the resource could not be found.
ResourceErrorBusy ErrorCode = C.GST_RESOURCE_ERROR_BUSY // (4) used when resource is busy.
ResourceErrorOpenRead ErrorCode = C.GST_RESOURCE_ERROR_OPEN_READ // (5) used when resource fails to open for reading.
ResourceErrorOpenWrite ErrorCode = C.GST_RESOURCE_ERROR_OPEN_WRITE // (6) used when resource fails to open for writing.
ResourceErrorOpenReadWrite ErrorCode = C.GST_RESOURCE_ERROR_OPEN_READ_WRITE // (7) used when resource cannot be opened for both reading and writing, or either (but unspecified which).
ResourceErrorClose ErrorCode = C.GST_RESOURCE_ERROR_CLOSE // (8) used when the resource can't be closed.
ResourceErrorRead ErrorCode = C.GST_RESOURCE_ERROR_READ // (9) used when the resource can't be read from.
ResourceErrorWrite ErrorCode = C.GST_RESOURCE_ERROR_WRITE // (10) used when the resource can't be written to.
ResourceErrorSeek ErrorCode = C.GST_RESOURCE_ERROR_SEEK // (11) used when a seek on the resource fails.
ResourceErrorSync ErrorCode = C.GST_RESOURCE_ERROR_SYNC // (12) used when a synchronize on the resource fails.
ResourceErrorSettings ErrorCode = C.GST_RESOURCE_ERROR_SETTINGS // (13) used when settings can't be manipulated on.
ResourceErrorNoSpaceLeft ErrorCode = C.GST_RESOURCE_ERROR_NO_SPACE_LEFT // (14) used when the resource has no space left.
ResourceErrorNotAuthorized ErrorCode = C.GST_RESOURCE_ERROR_NOT_AUTHORIZED // (15) used when the resource can't be opened due to missing authorization. (Since: 1.2.4)
)
// Type castings for StreamErrors
const (
StreamErrorFailed ErrorCode = C.GST_STREAM_ERROR_FAILED // (1) a general error which doesn't fit in any other category. Make sure you add a custom message to the error call.
StreamErrorTooLazy ErrorCode = C.GST_STREAM_ERROR_TOO_LAZY // (2) do not use this except as a placeholder for deciding where to go while developing code.
StreamErrorNotImplemented ErrorCode = C.GST_STREAM_ERROR_NOT_IMPLEMENTED // (3) use this when you do not want to implement this functionality yet.
StreamErrorTypeNotFound ErrorCode = C.GST_STREAM_ERROR_TYPE_NOT_FOUND // (4) used when the element doesn't know the stream's type.
StreamErrorWrongType ErrorCode = C.GST_STREAM_ERROR_WRONG_TYPE // (5) used when the element doesn't handle this type of stream.
StreamErrorCodecNotFound ErrorCode = C.GST_STREAM_ERROR_CODEC_NOT_FOUND // (6) used when there's no codec to handle the stream's type.
StreamErrorDecode ErrorCode = C.GST_STREAM_ERROR_DECODE // (7) used when decoding fails.
StreamErrorEncode ErrorCode = C.GST_STREAM_ERROR_ENCODE // (8) used when encoding fails.
StreamErrorDemux ErrorCode = C.GST_STREAM_ERROR_DEMUX // (9) used when demuxing fails.
StreamErrorMux ErrorCode = C.GST_STREAM_ERROR_MUX // (10) used when muxing fails.
StreamErrorFormat ErrorCode = C.GST_STREAM_ERROR_FORMAT // (11) used when the stream is of the wrong format (for example, wrong caps).
StreamErrorDecrypt ErrorCode = C.GST_STREAM_ERROR_DECRYPT // (12) used when the stream is encrypted and can't be decrypted because this is not supported by the element.
StreamErrorDecryptNoKey ErrorCode = C.GST_STREAM_ERROR_DECRYPT_NOKEY // (13) used when the stream is encrypted and can't be decrypted because no suitable key is available.
)
// GError is a Go wrapper for a C GError in the context of GStreamer. It implements the error interface
// and provides additional functions for retrieving debug strings and details.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type GError struct {
errMsg, debugStr string
structure *Structure
// used for message constructors
code ErrorCode
}
// Message is an alias to `Error()`. It's for clarity when this object
// is parsed from a `GST_MESSAGE_INFO` or `GST_MESSAGE_WARNING`.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *GError) Message() string { return e.Error() }
// Error implements the error interface and returns the error message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *GError) Error() string { return e.errMsg }
// DebugString returns any debug info alongside the error.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *GError) DebugString() string { return e.debugStr }
// Structure returns the structure of the error message which may contain additional metadata.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *GError) Structure() *Structure { return e.structure }
// Code returns the error code of the error message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *GError) Code() ErrorCode { return e.code }
// NewGError wraps the given error inside a GError (to be used with message constructors).
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewGError(code ErrorCode, err error) *GError {
return &GError{
errMsg: err.Error(),
code: code,
}
}

View File

@@ -1,473 +0,0 @@
package gst
// #include "gst.go.h"
import "C"
import (
"runtime"
"time"
"unsafe"
)
// Event is a go wrapper around a GstEvent.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type Event struct {
ptr *C.GstEvent
}
// // FromGstEventUnsafe is an alias to FromGstEventUnsafeNone.
// func FromGstEventUnsafe(ev unsafe.Pointer) *Event { return FromGstEventUnsafeNone(ev) }
// FromGstEventUnsafeNone wraps the pointer to the given C GstEvent with the go type.
// A ref is taken and finalizer applied.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstEventUnsafeNone(ev unsafe.Pointer) *Event {
event := ToGstEvent(ev)
event.Ref()
runtime.SetFinalizer(event, (*Event).Unref)
return event
}
// FromGstEventUnsafeFull wraps the pointer to the given C GstEvent without taking a ref.
// A finalizer is applied.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstEventUnsafeFull(ev unsafe.Pointer) *Event {
event := ToGstEvent(ev)
runtime.SetFinalizer(event, (*Event).Unref)
return event
}
// ToGstEvent converts the given pointer into an Event without affecting the ref count or
// placing finalizers.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func ToGstEvent(ev unsafe.Pointer) *Event {
return wrapEvent((*C.GstEvent)(ev))
}
// Instance returns the underlying GstEvent instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) Instance() *C.GstEvent { return C.toGstEvent(unsafe.Pointer(e.ptr)) }
// Type returns the type of the event
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) Type() EventType { return EventType(e.Instance()._type) }
// Timestamp returns the timestamp of the event.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) Timestamp() time.Duration {
ts := e.Instance().timestamp
return time.Duration(uint64(ts)) * time.Nanosecond
}
// Seqnum returns the sequence number of the event.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) Seqnum() uint32 {
return uint32(e.Instance().seqnum)
}
// Copy copies the event using the event specific copy function.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) Copy() *Event {
return FromGstEventUnsafeFull(unsafe.Pointer(C.gst_event_copy(e.Instance())))
}
// CopySegment parses a segment event and copies the Segment into the location given by segment.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) CopySegment(segment *Segment) {
C.gst_event_copy_segment(e.Instance(), segment.Instance())
}
// GetRunningTimeOffset retrieves the accumulated running time offset of the event.
//
// Events passing through GstPad that have a running time offset set via gst_pad_set_offset will get their
// offset adjusted according to the pad's offset.
//
// If the event contains any information that related to the running time, this information will need to be
// updated before usage with this offset.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) GetRunningTimeOffset() int64 {
return int64(C.gst_event_get_running_time_offset(e.Instance()))
}
// GetSeqnum retrieves the sequence number of a event.
//
// Events have ever-incrementing sequence numbers, which may also be set explicitly via SetSeqnum. Sequence
// numbers are typically used to indicate that a event corresponds to some other set of events or messages,
// for example an EOS event corresponding to a SEEK event. It is considered good practice to make this
// correspondence when possible, though it is not required.
//
// Note that events and messages share the same sequence number incrementor; two events or messages will never
// have the same sequence number unless that correspondence was made explicitly.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) GetSeqnum() uint32 {
return uint32(C.gst_event_get_seqnum(e.Instance()))
}
// GetStructure accesses the structure of the event.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) GetStructure() *Structure {
return wrapStructure(C.gst_event_get_structure(e.Instance()))
}
// HasName checks if event has the given name. This function is usually used to check the name of a custom event.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) HasName(name string) bool {
cName := C.CString(name)
defer C.free(unsafe.Pointer(cName))
return gobool(C.gst_event_has_name(e.Instance(), (*C.gchar)(unsafe.Pointer(cName))))
}
// ParseBufferSize gets the format, minsize, maxsize and async-flag in the buffersize event.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) ParseBufferSize() (format Format, minSize, maxSize int64, async bool) {
var gformat C.GstFormat
var gmin, gmax C.gint64
var gasync C.gboolean
C.gst_event_parse_buffer_size(e.Instance(), &gformat, &gmin, &gmax, &gasync)
return Format(gformat), int64(gmin), int64(gmax), gobool(gasync)
}
// ParseCaps gets the caps from event. The caps remains valid as long as event remains valid.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) ParseCaps() *Caps {
var caps *C.GstCaps
C.gst_event_parse_caps(e.Instance(), &caps)
return FromGstCapsUnsafeNone(unsafe.Pointer(caps))
}
// ParseFlushStop parses the FLUSH_STOP event and retrieve the reset_time member. Value reflects whether
// time should be reset.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) ParseFlushStop() (resetTime bool) {
var gbool C.gboolean
C.gst_event_parse_flush_stop(e.Instance(), &gbool)
return gobool(gbool)
}
// ParseGap extracts timestamp and duration from a new GAP event.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) ParseGap() (timestamp, duration time.Duration) {
var ts, dur C.GstClockTime
C.gst_event_parse_gap(e.Instance(), &ts, &dur)
return time.Duration(ts), time.Duration(dur)
}
// ParseGapFlags retrieves the gap flags that may have been set on a gap event with SetGapFlags.
// func (e *Event) ParseGapFlags() GapFlags {
// var out C.GstGapFlags
// C.gst_event_parse_gap_flags(e.Instance(), &out)
// return GapFlags(out)
// }
// ParseGroupID returns a group ID if set on the event.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) ParseGroupID() (ok bool, gid uint) {
var out C.guint
gok := C.gst_event_parse_group_id(e.Instance(), &out)
return gobool(gok), uint(out)
}
// ParseInstantRateChange extracts rate and flags from an instant-rate-change event.
// func (e *Event) ParseInstantRateChange() {}
// ParseInstantRateSyncTime extracts the rate multiplier and running times from an instant-rate-sync-time event.
// func (e *Event) ParseInstantRateChange() {}
// ParseLatency gets the latency in the latency event.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) ParseLatency() ClockTime {
var out C.GstClockTime
C.gst_event_parse_latency(e.Instance(), &out)
return ClockTime(out)
}
// ParseProtection parses an event containing protection system specific information and stores the results in
// system_id, data and origin. The data stored in system_id, origin and data are valid until event is released.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) ParseProtection() (systemID string, data *Buffer, origin string) {
idPtr := C.malloc(C.sizeof_char * 1024)
originPtr := C.malloc(C.sizeof_char * 1024)
defer C.free(unsafe.Pointer(idPtr))
defer C.free(unsafe.Pointer(originPtr))
var buf *C.GstBuffer
C.gst_event_parse_protection(
e.Instance(),
(**C.gchar)(unsafe.Pointer(&idPtr)),
&buf,
(**C.gchar)(unsafe.Pointer(&originPtr)),
)
return C.GoString((*C.char)(unsafe.Pointer(idPtr))), wrapBuffer(buf), C.GoString((*C.char)(unsafe.Pointer(originPtr)))
}
// ParseQOS gets the type, proportion, diff and timestamp in the qos event. See NewQOSEvent for more information about
// the different QoS values.
//
// timestamp will be adjusted for any pad offsets of pads it was passing through.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) ParseQOS() (qTtype QOSType, proportion float64, diff ClockTimeDiff, timestamp ClockTime) {
var gtype C.GstQOSType
var gprop C.gdouble
var gdiff C.GstClockTimeDiff
var gts C.GstClockTime
C.gst_event_parse_qos(
e.Instance(),
&gtype, &gprop, &gdiff, &gts,
)
return QOSType(gtype), float64(gprop), ClockTimeDiff(gdiff), ClockTime(gts)
}
// ParseSeek parses a seek event.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) ParseSeek() (rate float64, format Format, flags SeekFlags, startType SeekType, start int64, stopType SeekType, stop int64) {
var grate C.gdouble
var gformat C.GstFormat
var gflags C.GstSeekFlags
var gstartType, gstopType C.GstSeekType
var gstart, gstop C.gint64
C.gst_event_parse_seek(e.Instance(), &grate, &gformat, &gflags, &gstartType, &gstart, &gstopType, &gstop)
return float64(grate), Format(gformat), SeekFlags(gflags), SeekType(gstartType), int64(gstart), SeekType(gstopType), int64(gstop)
}
// ParseSeekTrickModeInterval retrieves the trickmode interval that may have been set on a seek event with
// SetSeekTrickModeInterval.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) ParseSeekTrickModeInterval() (interval ClockTime) {
var out C.GstClockTime
C.gst_event_parse_seek_trickmode_interval(e.Instance(), &out)
return ClockTime(out)
}
// ParseSegment parses a segment event and stores the result in the given segment location. segment remains valid
// only until the event is freed. Don't modify the segment and make a copy if you want to modify it or store it for
// later use.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) ParseSegment() *Segment {
var out *C.GstSegment
C.gst_event_parse_segment(e.Instance(), &out)
return wrapSegment(out)
}
// ParseSegmentDone extracts the position and format from the segment done message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) ParseSegmentDone() (Format, int64) {
var format C.GstFormat
var pos C.gint64
C.gst_event_parse_segment_done(e.Instance(), &format, &pos)
return Format(format), int64(pos)
}
// ParseSelectStreams parses the SELECT_STREAMS event and retrieve the contained streams.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) ParseSelectStreams() []*Stream {
var outList *C.GList
C.gst_event_parse_select_streams(e.Instance(), &outList)
return glistToStreamSlice(outList)
}
// ParseSinkMessage parses the sink-message event. Unref msg after usage.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) ParseSinkMessage() *Message {
var msg *C.GstMessage
C.gst_event_parse_sink_message(e.Instance(), &msg)
return wrapMessage(msg)
}
// ParseStep parses a step message
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) ParseStep() (format Format, amount uint64, rate float64, flush, intermediate bool) {
var gformat C.GstFormat
var gamount C.guint64
var grate C.gdouble
var gflush, gintermediate C.gboolean
C.gst_event_parse_step(e.Instance(), &gformat, &gamount, &grate, &gflush, &gintermediate)
return Format(gformat), uint64(gamount), float64(grate), gobool(gflush), gobool(gintermediate)
}
// ParseStream parses a stream-start event and extract the GstStream from it.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) ParseStream() *Stream {
var stream *C.GstStream
C.gst_event_parse_stream(e.Instance(), &stream)
return FromGstStreamUnsafeFull(unsafe.Pointer(stream))
}
// ParseStreamCollection parses a stream collection from the event.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) ParseStreamCollection() *StreamCollection {
stream := &C.GstStreamCollection{}
C.gst_event_parse_stream_collection(e.Instance(), &stream)
return FromGstStreamCollectionUnsafeFull(unsafe.Pointer(stream))
}
// ParseStreamFlags parses the stream flags from an event.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) ParseStreamFlags() StreamFlags {
var out C.GstStreamFlags
C.gst_event_parse_stream_flags(e.Instance(), &out)
return StreamFlags(out)
}
// ParseStreamGroupDone parses a stream-group-done event and store the result in the given group_id location.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) ParseStreamGroupDone() uint {
var out C.guint
C.gst_event_parse_stream_group_done(e.Instance(), &out)
return uint(out)
}
// ParseStreamStart parses a stream-id event and store the result in the given stream_id location.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) ParseStreamStart() string {
idPtr := C.malloc(C.sizeof_char * 1024)
defer C.free(idPtr)
C.gst_event_parse_stream_start(e.Instance(), (**C.gchar)(unsafe.Pointer(&idPtr)))
return C.GoString((*C.char)(unsafe.Pointer(idPtr)))
}
// ParseTag parses a tag event and stores the results in the given taglist location. Do not modify or free the returned
// tag list.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) ParseTag() *TagList {
var out *C.GstTagList
C.gst_event_parse_tag(e.Instance(), &out)
return FromGstTagListUnsafeNone(unsafe.Pointer(out))
}
// ParseTOC parses a TOC event and store the results in the given toc and updated locations.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) ParseTOC() (toc *TOC, updated bool) {
var out *C.GstToc
var gupdated C.gboolean
C.gst_event_parse_toc(e.Instance(), &out, &gupdated)
return FromGstTOCUnsafeFull(unsafe.Pointer(out)), gobool(gupdated)
}
// ParseTOCSelect parses a TOC select event and store the results in the given uid location.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) ParseTOCSelect() string {
idPtr := C.malloc(C.sizeof_char * 1024)
defer C.free(unsafe.Pointer(idPtr))
C.gst_event_parse_toc_select(e.Instance(), (**C.gchar)(unsafe.Pointer(&idPtr)))
return C.GoString((*C.char)(unsafe.Pointer(idPtr)))
}
// Ref increases the ref count on the event by one.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) Ref() *Event {
C.gst_event_ref(e.Instance())
return e
}
// SetGapFlags sets flags on event to give additional information about the reason for the GST_EVENT_GAP.
// func (e *Event) SetGapFlags(flags GapFlags) {
// C.gst_event_set_gap_flags(e.Instance(), C.GstGapFlags(flags))
// }
// NextGroupID returns a new group id that can be used for an event.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NextGroupID() uint {
return uint(C.gst_util_group_id_next())
}
// SetGroupID sets the group id for the stream. All streams that have the same group id are supposed to be played
// together, i.e. all streams inside a container file should have the same group id but different stream ids. The
// group id should change each time the stream is started, resulting in different group ids each time a file is
// played for example.
//
// Use NextGroupID to get a new group id.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) SetGroupID(id uint) {
C.gst_event_set_group_id(e.Instance(), C.guint(id))
}
// SetRunningTimeOffset sets the running time offset of a event. See GetRunningTimeOffset for more information.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) SetRunningTimeOffset(offset int64) {
C.gst_event_set_running_time_offset(e.Instance(), C.gint64(offset))
}
// SetSeekTrickModeInterval sets a trickmode interval on a (writable) seek event. Elements that support TRICKMODE_KEY_UNITS
// seeks SHOULD use this as the minimal interval between each frame they may output.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) SetSeekTrickModeInterval(interval ClockTime) {
C.gst_event_set_seek_trickmode_interval(e.Instance(), C.GstClockTime(interval))
}
// SetSeqnum sets the sequence number of a event.
//
// This function might be called by the creator of a event to indicate that the event relates to other events or messages.
// See GetSeqnum for more information.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) SetSeqnum(seqnum uint32) {
C.gst_event_set_seqnum(e.Instance(), C.guint32(seqnum))
}
// SetStream sets the stream on the stream-start event
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) SetStream(stream *Stream) {
C.gst_event_set_stream(e.Instance(), stream.Instance())
}
// SetStreamFlags sets the stream flags on the event.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) SetStreamFlags(flags StreamFlags) {
C.gst_event_set_stream_flags(e.Instance(), C.GstStreamFlags(flags))
}
// Unref decreases the refcount of an event, freeing it if the refcount reaches 0.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) Unref() { C.gst_event_unref(e.Instance()) }
// WritableStructure returns a writable version of the structure.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (e *Event) WritableStructure() *Structure {
return wrapStructure(C.gst_event_writable_structure(e.Instance()))
}

View File

@@ -1,410 +0,0 @@
package gst
// #include "gst.go.h"
import "C"
import (
"unsafe"
)
// NewBufferSizeEvent creates a new buffersize event. The event is sent downstream and notifies
// elements that they should provide a buffer of the specified dimensions.
//
// When the async flag is set, a thread boundary is preferred.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewBufferSizeEvent(format Format, minSize, maxSize int64, async bool) *Event {
return FromGstEventUnsafeFull(unsafe.Pointer(C.gst_event_new_buffer_size(
C.GstFormat(format),
C.gint64(minSize),
C.gint64(maxSize),
gboolean(async),
)))
}
// NewCapsEvent creates a new CAPS event for caps. The caps event can only travel downstream synchronized with
// the buffer flow and contains the format of the buffers that will follow after the event.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewCapsEvent(caps *Caps) *Event {
return FromGstEventUnsafeFull(unsafe.Pointer(C.gst_event_new_caps(
caps.Instance(),
)))
}
// NewEOSEvent creates a new EOS event. The eos event can only travel downstream synchronized with the buffer flow.
// Elements that receive the EOS event on a pad can return FlowEOS as a FlowReturn when data after the EOS event arrives.
//
// The EOS event will travel down to the sink elements in the pipeline which will then post the MessageEOS on the bus
// after they have finished playing any buffered data.
//
// When all sinks have posted an EOS message, an EOS message is forwarded to the application.
//
// The EOS event itself will not cause any state transitions of the pipeline.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewEOSEvent() *Event { return FromGstEventUnsafeFull(unsafe.Pointer(C.gst_event_new_eos())) }
// NewFlushStartEvent allocates a new flush start event. The flush start event can be sent upstream and downstream and
// travels out-of-bounds with the dataflow.
//
// It marks pads as being flushing and will make them return FlowFlushing when used for data flow with gst_pad_push,
// gst_pad_chain, gst_pad_get_range and gst_pad_pull_range. Any event (except a EventFlushSStop) received on a flushing
// pad will return FALSE immediately.
//
// Elements should unlock any blocking functions and exit their streaming functions as fast as possible when this event is received.
//
// This event is typically generated after a seek to flush out all queued data in the pipeline so that the new media is played as soon as possible.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewFlushStartEvent() *Event {
return FromGstEventUnsafeFull(unsafe.Pointer(C.gst_event_new_flush_start()))
}
// NewFlushStopEvent allocates a new flush stop event. The flush stop event can be sent upstream and downstream and travels serialized with the
// dataflow. It is typically sent after sending a FLUSH_START event to make the pads accept data again.
//
// Elements can process this event synchronized with the dataflow since the preceding FLUSH_START event stopped the dataflow.
//
// This event is typically generated to complete a seek and to resume dataflow.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewFlushStopEvent(resetTime bool) *Event {
return FromGstEventUnsafeFull(unsafe.Pointer(C.gst_event_new_flush_stop(gboolean(resetTime))))
}
// NewGapEvent creates a new GAP event. A gap event can be thought of as conceptually equivalent to a buffer to signal that there is no data for a
// certain amount of time. This is useful to signal a gap to downstream elements which may wait for data, such as muxers or mixers or overlays,
// especially for sparse streams such as subtitle streams.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewGapEvent(timestamp, duration ClockTime) *Event {
return FromGstEventUnsafeFull(unsafe.Pointer(C.gst_event_new_gap(
C.GstClockTime(timestamp),
C.GstClockTime(duration),
)))
}
// NewInstantRateChangeEvent creates a new instant-rate-change event. This event is sent by seek handlers (e.g. demuxers) when receiving a seek with the
// GST_SEEK_FLAG_INSTANT_RATE_CHANGE and signals to downstream elements that the playback rate in the existing segment should be immediately multiplied
// by the rate_multiplier factor.
//
// The flags provided replace any flags in the existing segment, for the flags within the GST_SEGMENT_INSTANT_FLAGS set. Other GstSegmentFlags are ignored
// and not transferred in the event.
// func NewInstantRateChangeEvent(rateMultiplier float64, newFlags SegmentFlags) *Event {
// return wrapEvent(C.gst_event_new_instant_rate_change(
// C.gdouble(rateMultiplier),
// C.GstSegmentFlags(newFlags),
// ))
// }
// NewInstantRateSyncTimeEvent creates a new instant-rate-sync-time event. This event is sent by the pipeline to notify elements handling the instant-rate-change
// event about the running-time when the new rate should be applied. The running time may be in the past when elements handle this event, which can lead to switching
// artifacts. The magnitude of those depends on the exact timing of event delivery to each element and the magnitude of the change in playback rate being applied.
//
// The running_time and upstream_running_time are the same if this is the first instant-rate adjustment, but will differ for later ones to compensate for the
// accumulated offset due to playing at a rate different to the one indicated in the playback segments.
// func NewInstantRateSyncTimeEvent(rateMultiplier float64, runningTime, upstreamRunningTime time.Duration) *Event {
// return wrapEvent(C.gst_event_new_instant_rate_sync_time(
// C.gdouble(rateMultiplier),
// C.GstClockTime(durationToClockTime(runningTime)),
// C.GstClockTime(durationToClockTime(upstreamRunningTime)),
// ))
// }
// NewLatencyEvent creates a new latency event. The event is sent upstream from the sinks and notifies elements that they should add an additional latency to the
// running time before synchronizing against the clock.
//
// The latency is mostly used in live sinks and is always expressed in the time format.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewLatencyEvent(latency ClockTime) *Event {
return FromGstEventUnsafeFull(unsafe.Pointer(C.gst_event_new_latency(
C.GstClockTime(latency),
)))
}
// NewNavigationEvent creates a new navigation event from the given description. The event will take ownership of the structure.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewNavigationEvent(structure *Structure) *Event {
return FromGstEventUnsafeFull(unsafe.Pointer(C.gst_event_new_navigation(
structure.Instance(),
)))
}
// NewProtectionEvent creates a new event containing information specific to a particular protection system (uniquely identified by system_id), by which that protection system
// can acquire key(s) to decrypt a protected stream.
//
// In order for a decryption element to decrypt media protected using a specific system, it first needs all the protection system specific information necessary to acquire the
// decryption key(s) for that stream. The functions defined here enable this information to be passed in events from elements that extract it (e.g., ISOBMFF demuxers, MPEG DASH
// demuxers) to protection decrypter elements that use it.
//
// Events containing protection system specific information are created using NewProtectionEvent, and they can be parsed by downstream elements using ParseProtection.
//
// In Common Encryption, protection system specific information may be located within ISOBMFF files, both in movie (moov) boxes and movie fragment (moof) boxes; it may also be
// contained in ContentProtection elements within MPEG DASH MPDs. The events created by gst_event_new_protection contain data identifying from which of these locations the encapsulated
// protection system specific information originated. This origin information is required as some protection systems use different encodings depending upon where the information originates.
//
// The events returned by NewProtectionEvent are implemented in such a way as to ensure that the most recently-pushed protection info event of a particular origin and system_id will be
// stuck to the output pad of the sending element.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewProtectionEvent(systemID string, buffer *Buffer, origin string) *Event {
cSystemID := C.CString(systemID)
cOrigin := C.CString(origin)
defer C.free(unsafe.Pointer(cSystemID))
defer C.free(unsafe.Pointer(cOrigin))
return FromGstEventUnsafeFull(unsafe.Pointer(C.gst_event_new_protection(
(*C.gchar)(unsafe.Pointer(cSystemID)),
buffer.Instance(),
(*C.gchar)(unsafe.Pointer(cOrigin)),
)))
}
// NewQOSEvent allocates a new qos event with the given values. The QOS event is generated in an element that wants an upstream element to either reduce or increase its rate because of
// high/low CPU load or other resource usage such as network performance or throttling. Typically sinks generate these events for each buffer they receive.
//
// Type indicates the reason for the QoS event. GST_QOS_TYPE_OVERFLOW is used when a buffer arrived in time or when the sink cannot keep up with the upstream datarate. GST_QOS_TYPE_UNDERFLOW
// is when the sink is not receiving buffers fast enough and thus has to drop late buffers. GST_QOS_TYPE_THROTTLE is used when the datarate is artificially limited by the application, for
// example to reduce power consumption.
//
// Proportion indicates the real-time performance of the streaming in the element that generated the QoS event (usually the sink). The value is generally computed based on more long term
// statistics about the streams timestamps compared to the clock. A value < 1.0 indicates that the upstream element is producing data faster than real-time. A value > 1.0 indicates that the
// upstream element is not producing data fast enough. 1.0 is the ideal proportion value. The proportion value can safely be used to lower or increase the quality of the element.
//
// Diff is the difference against the clock in running time of the last buffer that caused the element to generate the QOS event. A negative value means that the buffer with timestamp arrived
// in time. A positive value indicates how late the buffer with timestamp was. When throttling is enabled, diff will be set to the requested throttling interval.
//
// Timestamp is the timestamp of the last buffer that cause the element to generate the QOS event. It is expressed in running time and thus an ever increasing value.
//
// The upstream element can use the diff and timestamp values to decide whether to process more buffers. For positive diff, all buffers with timestamp <= timestamp + diff will certainly arrive
// late in the sink as well. A (negative) diff value so that timestamp + diff would yield a result smaller than 0 is not allowed.
//
// The application can use general event probes to intercept the QoS event and implement custom application specific QoS handling.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewQOSEvent(qType QOSType, proportion float64, diff ClockTimeDiff, timestamp ClockTime) *Event {
return FromGstEventUnsafeFull(unsafe.Pointer(C.gst_event_new_qos(
C.GstQOSType(qType),
C.gdouble(proportion),
C.GstClockTimeDiff(diff),
C.GstClockTime(timestamp),
)))
}
// NewReconfigureEvent creates a new reconfigure event. The purpose of the reconfigure event is to travel upstream and make elements renegotiate their caps or reconfigure their buffer pools.
// This is useful when changing properties on elements or changing the topology of the pipeline.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewReconfigureEvent() *Event {
return FromGstEventUnsafeFull(unsafe.Pointer(C.gst_event_new_reconfigure()))
}
// NewSeekEvent allocates a new seek event with the given parameters.
//
// The seek event configures playback of the pipeline between start to stop at the speed given in rate, also called a playback segment. The start and stop values are expressed in format.
//
// A rate of 1.0 means normal playback rate, 2.0 means double speed. Negatives values means backwards playback. A value of 0.0 for the rate is not allowed and should be accomplished instead
// by PAUSING the pipeline.
//
// A pipeline has a default playback segment configured with a start position of 0, a stop position of -1 and a rate of 1.0. The currently configured playback segment can be queried with
// GST_QUERY_SEGMENT.
//
// start_type and stop_type specify how to adjust the currently configured start and stop fields in playback segment. Adjustments can be made relative or absolute to the last configured values.
// A type of GST_SEEK_TYPE_NONE means that the position should not be updated.
//
// When the rate is positive and start has been updated, playback will start from the newly configured start position.
//
// For negative rates, playback will start from the newly configured stop position (if any). If the stop position is updated, it must be different from -1 (#GST_CLOCK_TIME_NONE) for negative rates.
//
// It is not possible to seek relative to the current playback position, to do this, PAUSE the pipeline, query the current playback position with GST_QUERY_POSITION and update the playback segment
// current position with a GST_SEEK_TYPE_SET to the desired position.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewSeekEvent(rate float64, format Format, flags SeekFlags, startType SeekType, start int64, stopType SeekType, stop int64) *Event {
return FromGstEventUnsafeFull(unsafe.Pointer(C.gst_event_new_seek(
C.gdouble(rate),
C.GstFormat(format),
C.GstSeekFlags(flags),
C.GstSeekType(startType),
C.gint64(start),
C.GstSeekType(stopType),
C.gint64(stop),
)))
}
// NewSegmentEvent creates a new SEGMENT event for segment. The segment event can only travel downstream synchronized with the buffer flow and contains timing information and playback properties
// for the buffers that will follow.
//
// The segment event marks the range of buffers to be processed. All data not within the segment range is not to be processed. This can be used intelligently by plugins to apply more efficient
// methods of skipping unneeded data. The valid range is expressed with the start and stop values.
//
// The time value of the segment is used in conjunction with the start value to convert the buffer timestamps into the stream time. This is usually done in sinks to report the current stream_time.
// time represents the stream_time of a buffer carrying a timestamp of start. time cannot be -1.
//
// start cannot be -1, stop can be -1. If there is a valid stop given, it must be greater or equal the start, including when the indicated playback rate is < 0.
//
// The applied_rate value provides information about any rate adjustment that has already been made to the timestamps and content on the buffers of the stream. (@rate * applied_rate) should always
// equal the rate that has been requested for playback. For example, if an element has an input segment with intended playback rate of 2.0 and applied_rate of 1.0, it can adjust incoming timestamps
// and buffer content by half and output a segment event with rate of 1.0 and applied_rate of 2.0
//
// After a segment event, the buffer stream time is calculated with:
//
// time + (TIMESTAMP(buf) - start) * ABS (rate * applied_rate)
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewSegmentEvent(segment *Segment) *Event {
return FromGstEventUnsafeFull(unsafe.Pointer(C.gst_event_new_segment(
segment.Instance(),
)))
}
// NewSegmentDoneEvent creates a new segment-done event. This event is sent by elements that finish playback of a segment as a result of a segment seek.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewSegmentDoneEvent(format Format, position int64) *Event {
return FromGstEventUnsafeFull(unsafe.Pointer(C.gst_event_new_segment_done(
C.GstFormat(format), C.gint64(position),
)))
}
// NewSelectStreamsEvent allocates a new select-streams event.
//
// The select-streams event requests the specified streams to be activated.
//
// The list of streams corresponds to the "Stream ID" of each stream to be activated. Those ID can be obtained via the GstStream objects present in EventStreamStart,
// EventStreamCollection or MessageStreamCollection.
//
// Note: The list of streams can not be empty.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewSelectStreamsEvent(streams []*Stream) *Event {
return FromGstEventUnsafeFull(unsafe.Pointer(C.gst_event_new_select_streams(
streamSliceToGlist(streams),
)))
}
// NewSinkMessageEvent creates a new sink-message event. The purpose of the sink-message event is to instruct a sink to post the message contained in the event
// synchronized with the stream.
//
// name is used to store multiple sticky events on one pad.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewSinkMessageEvent(name string, msg *Message) *Event {
cName := C.CString(name)
defer C.free(unsafe.Pointer(cName))
return FromGstEventUnsafeFull(unsafe.Pointer(C.gst_event_new_sink_message(
(*C.gchar)(unsafe.Pointer(cName)),
msg.Instance(),
)))
}
// NewStepEvent createss a new step event. The purpose of the step event is to instruct a sink to skip amount (expressed in format) of media. It can be used to
// implement stepping through the video frame by frame or for doing fast trick modes.
//
// A rate of <= 0.0 is not allowed. Pause the pipeline, for the effect of rate = 0.0 or first reverse the direction of playback using a seek event to get the same
// effect as rate < 0.0.
//
// The flush flag will clear any pending data in the pipeline before starting the step operation.
//
// The intermediate flag instructs the pipeline that this step operation is part of a larger step operation.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewStepEvent(format Format, amount uint64, rate float64, flush, intermediate bool) *Event {
return FromGstEventUnsafeFull(unsafe.Pointer(C.gst_event_new_step(
C.GstFormat(format),
C.guint64(amount),
C.gdouble(rate),
gboolean(flush),
gboolean(intermediate),
)))
}
// NewStreamCollectionEvent creates a new STREAM_COLLECTION event. The stream collection event can only travel downstream synchronized with the buffer flow.
//
// Source elements, demuxers and other elements that manage collections of streams and post GstStreamCollection messages on the bus also send this event downstream
// on each pad involved in the collection, so that activation of a new collection can be tracked through the downstream data flow.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewStreamCollectionEvent(collection *StreamCollection) *Event {
return FromGstEventUnsafeFull(unsafe.Pointer(C.gst_event_new_stream_collection(
collection.Instance(),
)))
}
// NewStreamGroupDoneEvent creates a new Stream Group Done event. The stream-group-done event can only travel downstream synchronized with the buffer flow. Elements
// that receive the event on a pad should handle it mostly like EOS, and emit any data or pending buffers that would depend on more data arriving and unblock, since
// there won't be any more data.
//
// This event is followed by EOS at some point in the future, and is generally used when switching pads - to unblock downstream so that new pads can be exposed before
// sending EOS on the existing pads.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewStreamGroupDoneEvent(groupID uint) *Event {
return FromGstEventUnsafeFull(unsafe.Pointer(C.gst_event_new_stream_group_done(C.guint(groupID))))
}
// NewStreamStartEvent creates a new STREAM_START event. The stream start event can only travel downstream synchronized with the buffer flow. It is expected to be the
// first event that is sent for a new stream.
//
// Source elements, demuxers and other elements that create new streams are supposed to send this event as the first event of a new stream. It should not be sent after a
// flushing seek or in similar situations and is used to mark the beginning of a new logical stream. Elements combining multiple streams must ensure that this event is only
// forwarded downstream once and not for every single input stream.
//
// The stream_id should be a unique string that consists of the upstream stream-id, / as separator and a unique stream-id for this specific stream. A new stream-id should
// only be created for a stream if the upstream stream is split into (potentially) multiple new streams, e.g. in a demuxer, but not for every single element in the pipeline.
// Pad CreateStreamID can be used to create a stream-id. There are no particular semantics for the stream-id, though it should be deterministic (to support stream matching)
// and it might be used to order streams (besides any information conveyed by stream flags).
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewStreamStartEvent(streamID string) *Event {
cName := C.CString(streamID)
defer C.free(unsafe.Pointer(cName))
return FromGstEventUnsafeFull(unsafe.Pointer(C.gst_event_new_stream_start(
(*C.gchar)(unsafe.Pointer(cName)),
)))
}
// NewTagEvent generates a metadata tag event from the given taglist.
//
// The scope of the taglist specifies if the taglist applies to the complete medium or only to this specific stream. As the tag event is a sticky event, elements should merge
// tags received from upstream with a given scope with their own tags with the same scope and create a new tag event from it.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewTagEvent(tagList *TagList) *Event {
return FromGstEventUnsafeFull(unsafe.Pointer(C.gst_event_new_tag(
tagList.Ref().Instance(),
)))
}
// NewTOCEvent generates a TOC event from the given toc. The purpose of the TOC event is to inform elements that some kind of the TOC was found.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewTOCEvent(toc *TOC, updated bool) *Event {
return FromGstEventUnsafeFull(unsafe.Pointer(C.gst_event_new_toc(
toc.Instance(), gboolean(updated),
)))
}
// NewTOCSelectEvent generates a TOC select event with the given uid. The purpose of the TOC select event is to start playback based on the TOC's
// entry with the given uid.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewTOCSelectEvent(uid string) *Event {
cUID := C.CString(uid)
defer C.free(unsafe.Pointer(cUID))
return FromGstEventUnsafeFull(unsafe.Pointer(C.gst_event_new_toc_select(
(*C.gchar)(unsafe.Pointer(cUID)),
)))
}
// NewCustomEvent creates a new custom-typed event. This can be used for anything not handled by other event-specific functions to pass an event
// to another element.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewCustomEvent(eventType EventType, structure *Structure) *Event {
return FromGstEventUnsafeFull(unsafe.Pointer(C.gst_event_new_custom(
C.GstEventType(eventType), structure.Instance(),
)))
}

View File

@@ -1,240 +0,0 @@
package gst
// #include "gst.go.h"
import "C"
import (
"runtime"
"unsafe"
"github.com/go-gst/go-glib/glib"
)
// GhostPad is a go representation of a GstGhostPad.
type GhostPad struct{ *ProxyPad }
// FromGstGhostPadUnsafeNone wraps the given GstGhostPad.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstGhostPadUnsafeNone(pad unsafe.Pointer) *GhostPad {
return &GhostPad{&ProxyPad{&Pad{wrapObject(glib.TransferNone(pad))}}}
}
// FromGstGhostPadUnsafeFull wraps the given GstGhostPad.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstGhostPadUnsafeFull(pad unsafe.Pointer) *GhostPad {
return &GhostPad{&ProxyPad{&Pad{wrapObject(glib.TransferFull(pad))}}}
}
// NewGhostPad create a new ghostpad with target as the target. The direction will be
// taken from the target pad. The target must be unlinked. If name is empty, one will be
// selected.
//
// Will ref the target.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewGhostPad(name string, target *Pad) *GhostPad {
var cName *C.gchar
if name != "" {
cStr := C.CString(name)
defer C.free(unsafe.Pointer(cStr))
cName = (*C.gchar)(unsafe.Pointer(cStr))
}
pad := C.gst_ghost_pad_new(
cName,
target.Instance(),
)
if pad == nil {
return nil
}
return FromGstGhostPadUnsafeNone(unsafe.Pointer(pad))
}
// NewGhostPadFromTemplate creates a new ghostpad with target as the target. The direction will be taken
// from the target pad. The template used on the ghostpad will be template. If name is empty one will be
// selected.
//
// Will ref the target.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewGhostPadFromTemplate(name string, target *Pad, tmpl *PadTemplate) *GhostPad {
var cName *C.gchar
if name != "" {
cStr := C.CString(name)
defer C.free(unsafe.Pointer(cStr))
cName = (*C.gchar)(unsafe.Pointer(cStr))
}
pad := C.gst_ghost_pad_new_from_template(
cName,
target.Instance(),
tmpl.Instance(),
)
if pad == nil {
return nil
}
return FromGstGhostPadUnsafeNone(unsafe.Pointer(pad))
}
// NewGhostPadNoTarget creates a new ghostpad without a target with the given direction. A target can be set on the
// ghostpad later with the SetTarget function. If name is empty, one will be selected.
//
// The created ghostpad will not have a padtemplate.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewGhostPadNoTarget(name string, direction PadDirection) *GhostPad {
var cName *C.gchar
if name != "" {
cStr := C.CString(name)
defer C.free(unsafe.Pointer(cStr))
cName = (*C.gchar)(unsafe.Pointer(cStr))
}
pad := C.gst_ghost_pad_new_no_target(
cName,
C.GstPadDirection(direction),
)
if pad == nil {
return nil
}
return FromGstGhostPadUnsafeNone(unsafe.Pointer(pad))
}
// NewGhostPadNoTargetFromTemplate creates a new ghostpad based on templ, without setting a target. The direction will be taken
// from the templ.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewGhostPadNoTargetFromTemplate(name string, tmpl *PadTemplate) *GhostPad {
var cName *C.gchar
if name != "" {
cStr := C.CString(name)
defer C.free(unsafe.Pointer(cStr))
cName = (*C.gchar)(unsafe.Pointer(cStr))
}
pad := C.gst_ghost_pad_new_no_target_from_template(
cName,
tmpl.Instance(),
)
if pad == nil {
return nil
}
return FromGstGhostPadUnsafeNone(unsafe.Pointer(pad))
}
// Instance returns the underlying ghost pad instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GhostPad) Instance() *C.GstGhostPad { return C.toGstGhostPad(g.Unsafe()) }
// GetTarget gets the target pad of gpad.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GhostPad) GetTarget() *Pad {
pad := C.gst_ghost_pad_get_target(g.Instance())
if pad == nil {
return nil
}
return FromGstPadUnsafeFull(unsafe.Pointer(pad))
}
// SetTarget sets the new target of the ghostpad gpad. Any existing target is unlinked and links to the new target are
// established. if newtarget is nil the target will be cleared.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GhostPad) SetTarget(target *Pad) bool {
var ctarget *C.GstPad
if target != nil {
ctarget = target.Instance()
}
return gobool(C.gst_ghost_pad_set_target(
g.Instance(), ctarget,
))
}
// ActivateModeDefault invokes the default activate mode function of a ghost pad.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GhostPad) ActivateModeDefault(parent *Object, mode PadMode, active bool) bool {
if parent == nil {
return gobool(C.gst_ghost_pad_activate_mode_default(
C.toGstPad(g.Unsafe()), nil, C.GstPadMode(mode), gboolean(active),
))
}
return gobool(C.gst_ghost_pad_activate_mode_default(
C.toGstPad(g.Unsafe()), parent.Instance(), C.GstPadMode(mode), gboolean(active),
))
}
// InternalActivateModeDefault invokes the default activate mode function of a proxy pad that is owned by a ghost pad.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (g *GhostPad) InternalActivateModeDefault(parent *Object, mode PadMode, active bool) bool {
if parent == nil {
return gobool(C.gst_ghost_pad_internal_activate_mode_default(
C.toGstPad(g.Unsafe()), nil, C.GstPadMode(mode), gboolean(active),
))
}
return gobool(C.gst_ghost_pad_internal_activate_mode_default(
C.toGstPad(g.Unsafe()), parent.Instance(), C.GstPadMode(mode), gboolean(active),
))
}
// ProxyPad is a go representation of a GstProxyPad.
type ProxyPad struct{ *Pad }
// toPad returns the underling GstPad of this ProxyPad.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (p *ProxyPad) toPad() *C.GstPad { return C.toGstPad(p.Unsafe()) }
// Instance returns the underlying GstProxyPad instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (p *ProxyPad) Instance() *C.GstProxyPad { return C.toGstProxyPad(p.Unsafe()) }
// GetInternal gets the internal pad of pad.
//
// The internal pad of a GhostPad is the internally used pad of opposite direction, which is used to link to the target.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (p *ProxyPad) GetInternal() *ProxyPad {
pad := C.gst_proxy_pad_get_internal(p.Instance())
proxyPad := wrapProxyPad(toGObject(unsafe.Pointer(pad)))
runtime.SetFinalizer(proxyPad, (*ProxyPad).Unref)
return proxyPad
}
// ChainDefault invokes the default chain function of the proxy pad.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (p *ProxyPad) ChainDefault(parent *Object, buffer *Buffer) FlowReturn {
return FlowReturn(C.gst_proxy_pad_chain_default(p.toPad(), parent.Instance(), buffer.Instance()))
}
// ChainListDefault invokes the default chain list function of the proxy pad.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (p *ProxyPad) ChainListDefault(parent *Object, bufferList *BufferList) FlowReturn {
return FlowReturn(C.gst_proxy_pad_chain_list_default(p.toPad(), parent.Instance(), bufferList.Instance()))
}
// GetRangeDefault invokes the default getrange function of the proxy pad.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (p *ProxyPad) GetRangeDefault(parent *Object, offset uint64, size uint) (FlowReturn, *Buffer) {
var buf *C.GstBuffer
ret := FlowReturn(C.gst_proxy_pad_getrange_default(p.toPad(), parent.Instance(), C.guint64(offset), C.guint(size), &buf))
if ret != FlowError {
return ret, FromGstBufferUnsafeFull(unsafe.Pointer(buf))
}
return ret, nil
}
// GetInternalLinksDefault invokes the default iterate internal links function of the proxy pad.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (p *ProxyPad) GetInternalLinksDefault(parent *Object) ([]*Pad, error) {
iterator := C.gst_proxy_pad_iterate_internal_links_default(p.toPad(), parent.Instance())
return iteratorToPadSlice(iterator)
}

View File

@@ -1,58 +0,0 @@
package gst
/*
#include "gst.go.h"
static void* allocArgv(int argc) {
return malloc(sizeof(char *) * argc);
}
*/
import "C"
import "unsafe"
// CAT is the global DebugCategory used for logging from the bindings. It is okay to use
// it from applications, but plugins should use their own.
var CAT *DebugCategory
// Init is a wrapper around gst_init() and must be called before any
// other gstreamer calls and is used to initialize everything necessary.
// In addition to setting up gstreamer for usage, a pointer to a slice of
// strings may be passed in to parse standard gst command line arguments.
// args will be modified to remove any flags that were handled.
// Alternatively, nil may be passed in to not perform any command line
// parsing.
//
// The bindings will also set up their own internal DebugCategory for logging
// than can be invoked from applications or plugins as well. However, for
// plugins it is generally better to initialize your own DebugCategory.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func Init(args *[]string) {
if args != nil {
cargc := C.int(len(*args))
cargv := (*[0xfff]*C.char)(C.allocArgv(cargc))
defer C.free(unsafe.Pointer(cargv))
for i, arg := range *args {
cargv[i] = C.CString(arg)
defer C.free(unsafe.Pointer(cargv[i]))
}
C.gst_init(&cargc, (***C.char)(unsafe.Pointer(&cargv)))
unhandled := make([]string, cargc)
for i := 0; i < int(cargc); i++ {
unhandled[i] = C.GoString(cargv[i])
}
*args = unhandled
} else {
C.gst_init(nil, nil)
}
CAT = NewDebugCategory("GST_GO", DebugColorFgCyan, "GStreamer Go Bindings")
}
// Deinit is a wrapper for gst_deinit Clean up any resources created by GStreamer in gst_init().
// It is normally not needed to call this function in a normal application as the resources will automatically be freed
// when the program terminates. This function is therefore mostly used by testsuites and other memory profiling tools.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func Deinit() {
C.gst_deinit()
}

View File

@@ -1,411 +0,0 @@
package gst
/*
#include "gst.go.h"
void memcpy_offset (void * dest, guint offset, const void * src, size_t n) { memcpy(dest + offset, src, n); }
GstByteReader * newByteReader (const guint8 * data, guint size)
{
GstByteReader *ret = g_slice_new0 (GstByteReader);
ret->data = data;
ret->size = size;
return ret;
}
void freeByteReader (GstByteReader * reader)
{
g_return_if_fail (reader != NULL);
g_slice_free (GstByteReader, reader);
}
*/
import "C"
import (
"bytes"
"errors"
"io"
"unsafe"
)
// MapInfo is a go representation of a GstMapInfo.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type MapInfo struct {
ptr *C.GstMapInfo
}
// Instance returns the underlying GstMapInfo instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) Instance() *C.GstMapInfo {
return m.ptr
}
// Reader returns a Reader for the contents of this map's memory.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) Reader() io.Reader {
return bytes.NewReader(m.Bytes())
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type mapInfoWriter struct {
mapInfo *MapInfo
wsize int
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *mapInfoWriter) Write(p []byte) (int, error) {
if m.wsize+len(p) > int(m.mapInfo.Size()) {
return 0, errors.New("attempt to write more data than allocated to MapInfo")
}
m.mapInfo.WriteAt(m.wsize, p)
m.wsize += len(p)
return len(p), nil
}
// Writer returns a writer that will copy the contents passed to Write directly to the
// map's memory sequentially. An error will be returned if an attempt is made to write
// more data than the map can hold.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) Writer() io.Writer {
return &mapInfoWriter{
mapInfo: m,
wsize: 0,
}
}
// WriteData writes the given sequence directly to the map's memory.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) WriteData(data []byte) {
C.memcpy(unsafe.Pointer(m.ptr.data), unsafe.Pointer(&data[0]), C.gsize(len(data)))
}
// WriteAt writes the given data sequence directly to the map's memory at the given offset.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) WriteAt(offset int, data []byte) {
C.memcpy_offset(unsafe.Pointer(m.ptr.data), C.guint(offset), unsafe.Pointer(&data[0]), C.gsize(len(data)))
}
// Memory returns the underlying memory object.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) Memory() *Memory {
return wrapMemory(m.ptr.memory)
}
// Data returns a pointer to the raw data inside this map.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) Data() unsafe.Pointer {
return unsafe.Pointer(m.ptr.data)
}
// Flags returns the flags set on this map.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) Flags() MapFlags {
return MapFlags(m.ptr.flags)
}
// Size returrns the size of this map.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) Size() int64 {
return int64(m.ptr.size)
}
// MaxSize returns the maximum size of this map.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) MaxSize() int64 {
return int64(m.ptr.maxsize)
}
// Bytes returns a byte slice of the data inside this map info.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) Bytes() []byte {
return C.GoBytes(m.Data(), (C.int)(m.Size()))
}
// AsInt8Slice returns the contents of this map as a slice of signed 8-bit integers.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) AsInt8Slice() []int8 {
br := C.newByteReader(m.Instance().data, C.guint(m.Instance().size))
defer C.freeByteReader(br)
out := make([]int8, 0)
for C.gst_byte_reader_get_remaining(br) != C.guint(0) {
var gint C.gint8
C.gst_byte_reader_get_int8(br, &gint)
out = append(out, int8(gint))
}
return out
}
// AsInt16BESlice returns the contents of this map as a slice of signed 16-bit big-endian integers.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) AsInt16BESlice() []int16 {
br := C.newByteReader(m.Instance().data, C.guint(m.Instance().size))
defer C.freeByteReader(br)
out := make([]int16, 0)
for C.gst_byte_reader_get_remaining(br) != C.guint(0) {
var gint C.gint16
C.gst_byte_reader_get_int16_be(br, &gint)
out = append(out, int16(gint))
}
return out
}
// AsInt16LESlice returns the contents of this map as a slice of signed 16-bit little-endian integers.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) AsInt16LESlice() []int16 {
br := C.newByteReader(m.Instance().data, C.guint(m.Instance().size))
defer C.freeByteReader(br)
out := make([]int16, 0)
for C.gst_byte_reader_get_remaining(br) != C.guint(0) {
var gint C.gint16
C.gst_byte_reader_get_int16_le(br, &gint)
out = append(out, int16(gint))
}
return out
}
// AsInt32BESlice returns the contents of this map as a slice of signed 32-bit big-endian integers.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) AsInt32BESlice() []int32 {
br := C.newByteReader(m.Instance().data, C.guint(m.Instance().size))
defer C.freeByteReader(br)
out := make([]int32, 0)
for C.gst_byte_reader_get_remaining(br) != C.guint(0) {
var gint C.gint32
C.gst_byte_reader_get_int32_be(br, &gint)
out = append(out, int32(gint))
}
return out
}
// AsInt32LESlice returns the contents of this map as a slice of signed 32-bit little-endian integers.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) AsInt32LESlice() []int32 {
br := C.newByteReader(m.Instance().data, C.guint(m.Instance().size))
defer C.freeByteReader(br)
out := make([]int32, 0)
for C.gst_byte_reader_get_remaining(br) != C.guint(0) {
var gint C.gint32
C.gst_byte_reader_get_int32_le(br, &gint)
out = append(out, int32(gint))
}
return out
}
// AsInt64BESlice returns the contents of this map as a slice of signed 64-bit big-endian integers.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) AsInt64BESlice() []int64 {
br := C.newByteReader(m.Instance().data, C.guint(m.Instance().size))
defer C.freeByteReader(br)
out := make([]int64, 0)
for C.gst_byte_reader_get_remaining(br) != C.guint(0) {
var gint C.gint64
C.gst_byte_reader_get_int64_be(br, &gint)
out = append(out, int64(gint))
}
return out
}
// AsInt64LESlice returns the contents of this map as a slice of signed 64-bit little-endian integers.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) AsInt64LESlice() []int64 {
br := C.newByteReader(m.Instance().data, C.guint(m.Instance().size))
defer C.freeByteReader(br)
out := make([]int64, 0)
for C.gst_byte_reader_get_remaining(br) != C.guint(0) {
var gint C.gint64
C.gst_byte_reader_get_int64_le(br, &gint)
out = append(out, int64(gint))
}
return out
}
// AsUint8Slice returns the contents of this map as a slice of unsigned 8-bit integers.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) AsUint8Slice() []uint8 {
br := C.newByteReader(m.Instance().data, C.guint(m.Instance().size))
defer C.freeByteReader(br)
out := make([]uint8, 0)
for C.gst_byte_reader_get_remaining(br) != C.guint(0) {
var gint C.guint8
C.gst_byte_reader_get_uint8(br, &gint)
out = append(out, uint8(gint))
}
return out
}
// AsUint16BESlice returns the contents of this map as a slice of unsigned 16-bit big-endian integers.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) AsUint16BESlice() []uint16 {
br := C.newByteReader(m.Instance().data, C.guint(m.Instance().size))
defer C.freeByteReader(br)
out := make([]uint16, 0)
for C.gst_byte_reader_get_remaining(br) != C.guint(0) {
var gint C.guint16
C.gst_byte_reader_get_uint16_be(br, &gint)
out = append(out, uint16(gint))
}
return out
}
// AsUint16LESlice returns the contents of this map as a slice of unsigned 16-bit little-endian integers.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) AsUint16LESlice() []uint16 {
br := C.newByteReader(m.Instance().data, C.guint(m.Instance().size))
defer C.freeByteReader(br)
out := make([]uint16, 0)
for C.gst_byte_reader_get_remaining(br) != C.guint(0) {
var gint C.guint16
C.gst_byte_reader_get_uint16_le(br, &gint)
out = append(out, uint16(gint))
}
return out
}
// AsUint32BESlice returns the contents of this map as a slice of unsigned 32-bit big-endian integers.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) AsUint32BESlice() []uint32 {
br := C.newByteReader(m.Instance().data, C.guint(m.Instance().size))
defer C.freeByteReader(br)
out := make([]uint32, 0)
for C.gst_byte_reader_get_remaining(br) != C.guint(0) {
var gint C.guint32
C.gst_byte_reader_get_uint32_be(br, &gint)
out = append(out, uint32(gint))
}
return out
}
// AsUint32LESlice returns the contents of this map as a slice of unsigned 32-bit little-endian integers.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) AsUint32LESlice() []uint32 {
br := C.newByteReader(m.Instance().data, C.guint(m.Instance().size))
defer C.freeByteReader(br)
out := make([]uint32, 0)
for C.gst_byte_reader_get_remaining(br) != C.guint(0) {
var gint C.guint32
C.gst_byte_reader_get_uint32_le(br, &gint)
out = append(out, uint32(gint))
}
return out
}
// AsUint64BESlice returns the contents of this map as a slice of unsigned 64-bit big-endian integers.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) AsUint64BESlice() []uint64 {
br := C.newByteReader(m.Instance().data, C.guint(m.Instance().size))
defer C.freeByteReader(br)
out := make([]uint64, 0)
for C.gst_byte_reader_get_remaining(br) != C.guint(0) {
var gint C.guint64
C.gst_byte_reader_get_uint64_be(br, &gint)
out = append(out, uint64(gint))
}
return out
}
// AsUint64LESlice returns the contents of this map as a slice of unsigned 64-bit little-endian integers.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) AsUint64LESlice() []uint64 {
br := C.newByteReader(m.Instance().data, C.guint(m.Instance().size))
defer C.freeByteReader(br)
out := make([]uint64, 0)
for C.gst_byte_reader_get_remaining(br) != C.guint(0) {
var gint C.guint64
C.gst_byte_reader_get_uint64_le(br, &gint)
out = append(out, uint64(gint))
}
return out
}
// AsFloat32BESlice returns the contents of this map as a slice of 32-bit big-endian floats.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) AsFloat32BESlice() []float32 {
br := C.newByteReader(m.Instance().data, C.guint(m.Instance().size))
defer C.freeByteReader(br)
out := make([]float32, 0)
for C.gst_byte_reader_get_remaining(br) != C.guint(0) {
var gint C.gfloat
C.gst_byte_reader_get_float32_be(br, &gint)
out = append(out, float32(gint))
}
return out
}
// AsFloat32LESlice returns the contents of this map as a slice of 32-bit little-endian floats.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) AsFloat32LESlice() []float32 {
br := C.newByteReader(m.Instance().data, C.guint(m.Instance().size))
defer C.freeByteReader(br)
out := make([]float32, 0)
for C.gst_byte_reader_get_remaining(br) != C.guint(0) {
var gint C.gfloat
C.gst_byte_reader_get_float32_le(br, &gint)
out = append(out, float32(gint))
}
return out
}
// AsFloat64BESlice returns the contents of this map as a slice of 64-bit big-endian floats.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) AsFloat64BESlice() []float64 {
br := C.newByteReader(m.Instance().data, C.guint(m.Instance().size))
defer C.freeByteReader(br)
out := make([]float64, 0)
for C.gst_byte_reader_get_remaining(br) != C.guint(0) {
var gint C.gdouble
C.gst_byte_reader_get_float64_be(br, &gint)
out = append(out, float64(gint))
}
return out
}
// AsFloat64LESlice returns the contents of this map as a slice of 64-bit little-endian floats.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MapInfo) AsFloat64LESlice() []float64 {
br := C.newByteReader(m.Instance().data, C.guint(m.Instance().size))
defer C.freeByteReader(br)
out := make([]float64, 0)
for C.gst_byte_reader_get_remaining(br) != C.guint(0) {
var gint C.gdouble
C.gst_byte_reader_get_float64_le(br, &gint)
out = append(out, float64(gint))
}
return out
}

View File

@@ -1,179 +0,0 @@
package gst
/*
#include "gst.go.h"
*/
import "C"
import (
"runtime"
"unsafe"
"github.com/go-gst/go-glib/glib"
)
// Memory is a go representation of GstMemory. This object is implemented in a read-only fashion
// currently primarily for reference, and as such you should not really use it. You can create new
// memory blocks, but there are no methods implemented yet for modifying ones already in existence.
//
// Use the Buffer and its Map methods to interact with memory in both a read and writable way.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type Memory struct {
ptr *C.GstMemory
mapInfo *MapInfo
}
// FromGstMemoryUnsafe wraps the given C GstMemory in the go type. It is meant for internal usage
// and exported for visibility to other packages.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstMemoryUnsafe(mem unsafe.Pointer) *Memory {
wrapped := wrapMemory((*C.GstMemory)(mem))
wrapped.Ref()
runtime.SetFinalizer(wrapped, (*Memory).Unref)
return wrapped
}
// FromGstMemoryUnsafeNone is an alias to FromGstMemoryUnsafe.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstMemoryUnsafeNone(mem unsafe.Pointer) *Memory {
return FromGstMemoryUnsafe(mem)
}
// FromGstMemoryUnsafeFull wraps the given memory without taking an additional reference.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstMemoryUnsafeFull(mem unsafe.Pointer) *Memory {
wrapped := wrapMemory((*C.GstMemory)(mem))
runtime.SetFinalizer(wrapped, (*Memory).Unref)
return wrapped
}
// NewMemoryWrapped allocates a new memory block that wraps the given data.
//
// The prefix/padding must be filled with 0 if flags contains MemoryFlagZeroPrefixed
// and MemoryFlagZeroPadded respectively.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewMemoryWrapped(flags MemoryFlags, data []byte, maxSize, offset int64) *Memory {
mem := C.gst_memory_new_wrapped(
C.GstMemoryFlags(flags),
(C.gpointer)(unsafe.Pointer(&data[0])),
C.gsize(maxSize),
C.gsize(offset),
C.gsize(len(data)),
nil, // TODO: Allow user to set userdata for destroy notify function
nil, // TODO: Allow user to set destroy notify function
)
return FromGstMemoryUnsafeFull(unsafe.Pointer(mem))
}
// Instance returns the underlying GstMemory instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Memory) Instance() *C.GstMemory { return C.toGstMemory(unsafe.Pointer(m.ptr)) }
// Ref increases the ref count on this memory block by one.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Memory) Ref() *Memory {
return wrapMemory(C.gst_memory_ref(m.Instance()))
}
// Unref decreases the ref count on this memory block by one. When the refcount reaches
// zero the memory is freed.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Memory) Unref() { C.gst_memory_unref(m.Instance()) }
// Allocator returns the allocator for this memory.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Memory) Allocator() *Allocator {
return wrapAllocator(&glib.Object{GObject: glib.ToGObject(unsafe.Pointer(m.Instance().allocator))})
}
// Parent returns this memory block's parent.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Memory) Parent() *Memory { return wrapMemory(m.Instance().parent) }
// MaxSize returns the maximum size allocated for this memory block.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Memory) MaxSize() int64 { return int64(m.Instance().maxsize) }
// Alignment returns the alignment of the memory.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Memory) Alignment() int64 { return int64(m.Instance().align) }
// Offset returns the offset where valid data starts.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Memory) Offset() int64 { return int64(m.Instance().offset) }
// Size returns the size of valid data.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Memory) Size() int64 { return int64(m.Instance().size) }
// Copy returns a copy of size bytes from mem starting from offset. This copy is
// guaranteed to be writable. size can be set to -1 to return a copy from offset
// to the end of the memory region.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Memory) Copy(offset, size int64) *Memory {
mem := C.gst_memory_copy(m.Instance(), C.gssize(offset), C.gssize(size))
return FromGstMemoryUnsafeFull(unsafe.Pointer(mem))
}
// Map the data inside the memory. This function can return nil if the memory is not read or writable.
// It is safe to call this function multiple times on the same Memory, however it will retain the flags
// used when mapping the first time. To change between read and write access first unmap and then remap the
// memory with the appropriate flags, or map initially with both read/write access.
//
// Unmap the Memory after usage.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Memory) Map(flags MapFlags) *MapInfo {
if m.mapInfo != nil {
return m.mapInfo
}
mapInfo := C.malloc(C.sizeof_GstMapInfo)
C.gst_memory_map(
(*C.GstMemory)(m.Instance()),
(*C.GstMapInfo)(mapInfo),
C.GstMapFlags(flags),
)
if mapInfo == C.NULL {
return nil
}
m.mapInfo = wrapMapInfo((*C.GstMapInfo)(mapInfo))
return m.mapInfo
}
// Unmap will unmap the data inside this memory. Use this after calling Map on the Memory.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Memory) Unmap() {
if m.mapInfo == nil {
return
}
C.gst_memory_unmap(m.Instance(), (*C.GstMapInfo)(m.mapInfo.Instance()))
C.free(unsafe.Pointer(m.mapInfo.Instance()))
}
// Bytes will return a byte slice of the data inside this memory if it is readable.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Memory) Bytes() []byte {
mapInfo := m.Map(MapRead)
if mapInfo == nil {
return nil
}
defer m.Unmap()
return mapInfo.Bytes()
}

View File

@@ -1,609 +0,0 @@
package gst
// #include "gst.go.h"
import "C"
import (
"runtime"
"strings"
"time"
"unsafe"
"github.com/go-gst/go-glib/glib"
)
// Message is a Go wrapper around a GstMessage. It provides convenience methods for
// unref-ing and parsing the underlying messages.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type Message struct {
msg *C.GstMessage
}
// FromGstMessageUnsafeNone wraps the given unsafe.Pointer in a message. A ref is taken
// on the message and a runtime finalizer placed on the object.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstMessageUnsafeNone(msg unsafe.Pointer) *Message {
gomsg := ToGstMessage(msg)
gomsg.Ref()
runtime.SetFinalizer(gomsg, (*Message).Unref)
return gomsg
}
// FromGstMessageUnsafeFull wraps the given unsafe.Pointer in a message. No ref is taken
// and a finalizer is placed on the resulting object.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstMessageUnsafeFull(msg unsafe.Pointer) *Message {
gomsg := ToGstMessage(msg)
runtime.SetFinalizer(gomsg, (*Message).Unref)
return gomsg
}
// ToGstMessage converts the given pointer into a Message without affecting the ref count or
// placing finalizers.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func ToGstMessage(msg unsafe.Pointer) *Message { return wrapMessage((*C.GstMessage)(msg)) }
// Instance returns the underlying GstMessage object.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) Instance() *C.GstMessage { return C.toGstMessage(unsafe.Pointer(m.msg)) }
// Unref will call `gst_message_unref` on the underlying GstMessage, freeing it from memory.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) Unref() { C.gst_message_unref(m.Instance()) }
// Ref will increase the ref count on this message. This increases the total amount of times
// Unref needs to be called before the object is freed from memory. It returns the underlying
// message object for convenience.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) Ref() *Message {
C.gst_message_ref(m.Instance())
return m
}
// Copy will copy this object into a new Message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) Copy() *Message {
newNative := C.gst_message_copy(m.Instance())
return FromGstMessageUnsafeFull(unsafe.Pointer(newNative))
}
// Source returns name of the source of the message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) Source() string { return C.GoString(m.Instance().src.name) }
// Source returns object of the source of the message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) SourceObject() *Object {
return wrapObject(glib.Take(unsafe.Pointer(m.Instance().src)))
}
// Type returns the MessageType of the message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) Type() MessageType {
return MessageType(m.Instance()._type)
}
// TypeName returns a Go string of the GstMessageType name.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) TypeName() string {
return C.GoString(C.gst_message_type_get_name((C.GstMessageType)(m.Type())))
}
// GetStructure returns the GstStructure of this message, using the type of the message
// to determine the method to use. The returned structure must not be freed.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) GetStructure() *Structure {
var st *C.GstStructure
switch m.Type() {
case MessageError:
C.gst_message_parse_error_details(m.Instance(), (**C.GstStructure)(unsafe.Pointer(&st)))
case MessageInfo:
C.gst_message_parse_info_details(m.Instance(), (**C.GstStructure)(unsafe.Pointer(&st)))
case MessageWarning:
C.gst_message_parse_warning_details(m.Instance(), (**C.GstStructure)(unsafe.Pointer(&st)))
case MessageElement:
st = C.gst_message_get_structure(m.Instance())
case MessageApplication:
st = C.gst_message_get_structure(m.Instance())
}
// if no structure was returned, immediately return nil
if st == nil {
return nil
}
return structureFromGlibNone(st)
}
// parseToError returns a new GError from this message instance. There are multiple
// message types that parse to this interface.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) parseToError() *GError {
var gerr *C.GError
var debugInfo *C.gchar
switch m.Type() {
case MessageError:
C.gst_message_parse_error(m.Instance(), (**C.GError)(unsafe.Pointer(&gerr)), (**C.gchar)(unsafe.Pointer(&debugInfo)))
case MessageInfo:
C.gst_message_parse_info(m.Instance(), (**C.GError)(unsafe.Pointer(&gerr)), (**C.gchar)(unsafe.Pointer(&debugInfo)))
case MessageWarning:
C.gst_message_parse_warning(m.Instance(), (**C.GError)(unsafe.Pointer(&gerr)), (**C.gchar)(unsafe.Pointer(&debugInfo)))
}
// if error was nil return immediately
if gerr == nil {
return nil
}
// cleanup the C error immediately and let the garbage collector
// take over from here.
defer C.g_error_free((*C.GError)(gerr))
defer C.g_free((C.gpointer)(debugInfo))
return &GError{
errMsg: C.GoString(gerr.message),
structure: m.GetStructure(),
debugStr: strings.TrimSpace(C.GoString((*C.gchar)(debugInfo))),
}
}
// ParseInfo is identical to ParseError. The returned types are the same. However,
// this is intended for use with GstMessageType `GST_MESSAGE_INFO`.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseInfo() *GError {
return m.parseToError()
}
// ParseWarning is identical to ParseError. The returned types are the same. However,
// this is intended for use with GstMessageType `GST_MESSAGE_WARNING`.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseWarning() *GError {
return m.parseToError()
}
// ParseError will return a GError from the contents of this message. This will only work
// if the GstMessageType is `GST_MESSAGE_ERROR`.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseError() *GError {
return m.parseToError()
}
// ParseStateChanged will return the old and new states as Go strings. This will only work
// if the GstMessageType is `GST_MESSAGE_STATE_CHANGED`.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseStateChanged() (oldState, newState State) {
var gOldState, gNewState C.GstState
C.gst_message_parse_state_changed(m.Instance(), (*C.GstState)(unsafe.Pointer(&gOldState)), (*C.GstState)(unsafe.Pointer(&gNewState)), nil)
oldState = State(gOldState)
newState = State(gNewState)
return
}
// ParseTags extracts the tag list from the GstMessage. Tags are copied.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseTags() *TagList {
var tagList *C.GstTagList
C.gst_message_parse_tag(m.Instance(), &tagList)
if tagList == nil {
return nil
}
return FromGstTagListUnsafeFull(unsafe.Pointer(tagList))
}
// ParseTOC extracts the TOC from the GstMessage. The TOC returned in the output argument is
// a copy.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseTOC() (toc *TOC, updated bool) {
var gtoc *C.GstToc
var gupdated C.gboolean
C.gst_message_parse_toc(m.Instance(), &gtoc, &gupdated)
return FromGstTOCUnsafeFull(unsafe.Pointer(gtoc)), gobool(gupdated)
}
// ParseStreamStatus parses the stream status type of the message as well as the element
// that produced it.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseStreamStatus() (StreamStatusType, *Element) {
var cElem *C.GstElement
var cStatusType C.GstStreamStatusType
C.gst_message_parse_stream_status(
m.Instance(),
(*C.GstStreamStatusType)(&cStatusType),
(**C.GstElement)(&cElem),
)
return StreamStatusType(cStatusType), FromGstElementUnsafeNone(unsafe.Pointer(cElem))
}
// ParseAsyncDone extracts the running time from the async task done message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseAsyncDone() ClockTime {
var clockTime C.GstClockTime
C.gst_message_parse_async_done(m.Instance(), &clockTime)
return ClockTime(clockTime)
}
// BufferingStats represents the buffering stats as retrieved from a GST_MESSAGE_TYPE_BUFFERING.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type BufferingStats struct {
// The buffering mode
BufferingMode BufferingMode
// The average input rate
AverageIn int
// The average output rate
AverageOut int
// Amount of time until buffering is complete
BufferingLeft time.Duration
}
// ParseBuffering extracts the buffering percent from the GstMessage.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseBuffering() int {
var cInt C.gint
C.gst_message_parse_buffering(m.Instance(), &cInt)
return int(cInt)
}
// ParseBufferingStats extracts the buffering stats values from message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseBufferingStats() *BufferingStats {
var mode C.GstBufferingMode
var avgIn, avgOut C.gint
var bufLeft C.gint64
C.gst_message_parse_buffering_stats(
m.Instance(),
&mode, &avgIn, &avgOut, &bufLeft,
)
return &BufferingStats{
BufferingMode: BufferingMode(mode),
AverageIn: int(avgIn),
AverageOut: int(avgOut),
BufferingLeft: time.Duration(int64(bufLeft)) * time.Millisecond,
}
}
// StepStartValues represents the values inside a StepStart message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type StepStartValues struct {
Active bool
Format Format
Amount uint64
Rate float64
Flush bool
Intermediate bool
}
// ParseStepStart extracts the values for the StepStart message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseStepStart() *StepStartValues {
var active, flush, intermediate C.gboolean
var amount C.guint64
var rate C.gdouble
var format C.GstFormat
C.gst_message_parse_step_start(
m.Instance(),
&active, &format, &amount, &rate, &flush, &intermediate,
)
return &StepStartValues{
Active: gobool(active),
Format: Format(format),
Amount: uint64(amount),
Rate: float64(rate),
Flush: gobool(flush),
Intermediate: gobool(intermediate),
}
}
// StepDoneValues represents the values inside a StepDone message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type StepDoneValues struct {
Format Format
Amount uint64
Rate float64
Flush bool
Intermediate bool
Duration time.Duration
EOS bool
}
// ParseStepDone extracts the values for the StepDone message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseStepDone() *StepDoneValues {
var format C.GstFormat
var amount, duration C.guint64
var rate C.gdouble
var flush, intermediate, eos C.gboolean
C.gst_message_parse_step_done(
m.Instance(),
&format,
&amount,
&rate,
&flush,
&intermediate,
&duration,
&eos,
)
return &StepDoneValues{
Format: Format(format),
Amount: uint64(amount),
Rate: float64(rate),
Flush: gobool(flush),
Intermediate: gobool(intermediate),
Duration: time.Duration(uint64(duration)) * time.Nanosecond,
EOS: gobool(eos),
}
}
// ParseNewClock parses the new Clock in the message. The clock object returned
// remains valid until the message is freed.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseNewClock() *Clock {
var clock *C.GstClock
C.gst_message_parse_new_clock(m.Instance(), &clock)
return FromGstClockUnsafeNone(unsafe.Pointer(clock))
}
// ParseClockProvide extracts the clock and ready flag from the GstMessage.
// The clock object returned remains valid until the message is freed.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseClockProvide() (clock *Clock, ready bool) {
var gclock *C.GstClock
var gready C.gboolean
C.gst_message_parse_clock_provide(m.Instance(), &gclock, &gready)
return FromGstClockUnsafeNone(unsafe.Pointer(clock)), gobool(gready)
}
// ParseStructureChange extracts the change type and completion status from the GstMessage.
// If the returned bool is true, the change is still in progress.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseStructureChange() (chgType StructureChangeType, owner *Element, busy bool) {
var gElem *C.GstElement
var gbusy C.gboolean
var gchgType C.GstStructureChangeType
C.gst_message_parse_structure_change(
m.Instance(),
&gchgType, &gElem, &gbusy,
)
return StructureChangeType(gchgType), wrapElement(toGObject(unsafe.Pointer(gElem))), gobool(gbusy)
}
// ParseSegmentStart extracts the position and format of the SegmentStart message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseSegmentStart() (Format, int64) {
var format C.GstFormat
var position C.gint64
C.gst_message_parse_segment_start(m.Instance(), &format, &position)
return Format(format), int64(position)
}
// ParseSegmentDone extracts the position and format of the SegmentDone message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseSegmentDone() (Format, int64) {
var format C.GstFormat
var position C.gint64
C.gst_message_parse_segment_done(m.Instance(), &format, &position)
return Format(format), int64(position)
}
// ParseRequestState parses the requests state from the message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseRequestState() State {
var state C.GstState
C.gst_message_parse_request_state(m.Instance(), &state)
return State(state)
}
// QoSValues represents the values inside a QoS message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type QoSValues struct {
// If the message was generated by a live element
Live bool
// The running time of the buffer that generated the message
RunningTime time.Duration // should this be a uint64?
// The stream time of the buffer that generated the message
StreamTime time.Duration // should this be a uint64?
// The timestamps of the buffer that generated the message
Timestamp time.Duration // should this be a uint64?
// The duration of the buffer that generated the message
Duration time.Duration // should this be a uint64?
}
// ParseQoS extracts the timestamps and live status from the QoS message.
// The values reflect those of the dropped buffer. Values of ClockTimeNone
// or -1 mean unknown values.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseQoS() *QoSValues {
var live C.gboolean
var runningTime, streamTime, timestamp, duration C.guint64
C.gst_message_parse_qos(
m.Instance(),
&live, &runningTime, &streamTime, &timestamp, &duration,
)
return &QoSValues{
Live: gobool(live),
RunningTime: time.Duration(runningTime),
StreamTime: time.Duration(streamTime),
Timestamp: time.Duration(timestamp),
Duration: time.Duration(duration),
}
}
// ParseProgress parses the progress type, code and text.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseProgress() (progressType ProgressType, code, text string) {
codePtr := C.malloc(C.sizeof_char * 1024)
defer C.free(unsafe.Pointer(codePtr))
textPtr := C.malloc(C.sizeof_char * 1024)
defer C.free(unsafe.Pointer(textPtr))
var gpType C.GstProgressType
C.gst_message_parse_progress(
m.Instance(),
&gpType,
(**C.gchar)(unsafe.Pointer(codePtr)),
(**C.gchar)(unsafe.Pointer(textPtr)),
)
return ProgressType(gpType),
string(C.GoBytes(codePtr, C.sizeOfGCharArray((**C.gchar)(codePtr)))),
string(C.GoBytes(textPtr, C.sizeOfGCharArray((**C.gchar)(textPtr))))
}
// ParseResetTime extracts the running-time from the ResetTime message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseResetTime() ClockTime {
var clockTime C.GstClockTime
C.gst_message_parse_reset_time(m.Instance(), &clockTime)
return ClockTime(clockTime)
}
// ParseDeviceAdded parses a device-added message. The device-added message is
// produced by GstDeviceProvider or a GstDeviceMonitor. It announces the appearance
// of monitored devices.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseDeviceAdded() *Device {
var device *C.GstDevice
C.gst_message_parse_device_added(m.Instance(), &device)
return FromGstDeviceUnsafeFull(unsafe.Pointer(device))
}
// ParseDeviceRemoved parses a device-removed message. The device-removed message
// is produced by GstDeviceProvider or a GstDeviceMonitor. It announces the disappearance
// of monitored devices.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseDeviceRemoved() *Device {
var device *C.GstDevice
C.gst_message_parse_device_removed(m.Instance(), &device)
return FromGstDeviceUnsafeFull(unsafe.Pointer(device))
}
// ParseDeviceChanged Parses a device-changed message. The device-changed message is
// produced by GstDeviceProvider or a GstDeviceMonitor. It announces that a device's properties
// have changed.
// The first device returned is the updated Device, and the second changedDevice represents
// the old state of the device.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseDeviceChanged() (newDevice, oldDevice *Device) {
var gstNewDevice, gstOldDevice *C.GstDevice
C.gst_message_parse_device_changed(m.Instance(), &gstNewDevice, &gstOldDevice)
return FromGstDeviceUnsafeFull(unsafe.Pointer(gstNewDevice)),
FromGstDeviceUnsafeFull(unsafe.Pointer(gstOldDevice))
}
// ParsePropertyNotify parses a property-notify message. These will be posted on the bus only
// when set up with Element.AddPropertyNotifyWatch (TODO) or Element.AddPropertyDeepNotifyWatch (TODO).
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParsePropertyNotify() (obj *Object, propertName string, propertyValue *glib.Value) {
var gstobj *C.GstObject
var gval *C.GValue
namePtr := C.malloc(C.sizeof_char * 1024)
defer C.free(unsafe.Pointer(namePtr))
C.gst_message_parse_property_notify(
m.Instance(),
&gstobj, (**C.gchar)(unsafe.Pointer(namePtr)), &gval,
)
return wrapObject(toGObject(unsafe.Pointer(gstobj))),
string(C.GoBytes(namePtr, C.sizeOfGCharArray((**C.gchar)(namePtr)))),
glib.ValueFromNative(unsafe.Pointer(gval))
}
// ParseStreamCollection parses a stream-collection message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseStreamCollection() *StreamCollection {
var collection *C.GstStreamCollection
C.gst_message_parse_stream_collection(
m.Instance(),
&collection,
)
return FromGstStreamCollectionUnsafeFull(unsafe.Pointer(collection))
}
// ParseStreamsSelected parses a streams-selected message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseStreamsSelected() *StreamCollection {
var collection *C.GstStreamCollection
C.gst_message_parse_streams_selected(
m.Instance(),
&collection,
)
return FromGstStreamCollectionUnsafeFull(unsafe.Pointer(collection))
}
// NumRedirectEntries returns the number of redirect entries in a MessageRedirect.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) NumRedirectEntries() int64 {
return int64(C.gst_message_get_num_redirect_entries(m.Instance()))
}
// ParseRedirectEntryAt parses the redirect entry at the given index. Total indices can be retrieved
// with NumRedirectEntries().
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseRedirectEntryAt(idx int64) (location string, tags *TagList, structure *Structure) {
locPtr := C.malloc(C.sizeof_char * 1024)
defer C.free(unsafe.Pointer(locPtr))
var tagList *C.GstTagList
var entryStruct *C.GstStructure
C.gst_message_parse_redirect_entry(
m.Instance(),
C.gsize(idx),
(**C.char)(locPtr),
&tagList,
&entryStruct,
)
return string(C.GoBytes(locPtr, C.sizeOfGCharArray((**C.gchar)(locPtr)))),
FromGstTagListUnsafeNone(unsafe.Pointer(tagList)), wrapStructure(entryStruct)
}
// ParseHaveContext parses the context from a HaveContext message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) ParseHaveContext() *Context {
var ctx *C.GstContext
C.gst_message_parse_have_context(m.Instance(), &ctx)
return FromGstContextUnsafeFull(unsafe.Pointer(ctx))
}

View File

@@ -1,729 +0,0 @@
package gst
// #include "gst.go.h"
import "C"
import (
"unsafe"
"github.com/go-gst/go-glib/glib"
)
// GstObjectHolder interface is used as a go representation of the GLib check
// for an input type to be derived from the GstObject.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type GstObjectHolder interface {
GstObject() *C.GstObject
}
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func getMessageSourceObj(src GstObjectHolder) *C.GstObject {
if src == nil {
return nil
}
return src.GstObject()
}
// NewApplicationMessage creates a new application-typed message. GStreamer will never
// create these messages; they are a gift from them to you. Enjoy.
//
// The source of all message constructors must be a valid Object or descendant, specifically
// one created from the go runtime. If not the message returned will be nil.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewApplicationMessage(src GstObjectHolder, structure *Structure) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_application(srcObj, structure.Instance())))
}
// NewAsyncDoneMessage builds a message that is posted when elements completed an ASYNC state change.
// RunningTime contains the time of the desired running time when this elements goes to PLAYING.
// A value less than 0 for runningTime means that the element has no clock interaction and thus doesn't
// care about the running time of the pipeline.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewAsyncDoneMessage(src GstObjectHolder, runningTime ClockTime) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_async_done(
srcObj,
C.GstClockTime(runningTime),
)))
}
// NewAsyncStartMessage returns a message that is posted by elements when they start an ASYNC state change.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewAsyncStartMessage(src GstObjectHolder) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_async_start(srcObj)))
}
// NewBufferingMessage returns a message that can be posted by an element that needs to buffer data before it
// can continue processing. percent should be a value between 0 and 100. A value of 100 means that the buffering completed.
//
// When percent is < 100 the application should PAUSE a PLAYING pipeline. When percent is 100, the application can set the
// pipeline (back) to PLAYING. The application must be prepared to receive BUFFERING messages in the PREROLLING state and
// may only set the pipeline to PLAYING after receiving a message with percent set to 100, which can happen after the pipeline
// completed prerolling.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewBufferingMessage(src GstObjectHolder, percent int) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_buffering(srcObj, C.gint(percent))))
}
// NewClockLostMessage creates a clock lost message. This message is posted whenever the clock is not valid anymore.
//
// If this message is posted by the pipeline, the pipeline will select a new clock again when it goes to PLAYING. It might
// therefore be needed to set the pipeline to PAUSED and PLAYING again.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewClockLostMessage(src GstObjectHolder, clock *Clock) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_clock_lost(srcObj, clock.Instance())))
}
// NewClockProvideMessage creates a clock provide message. This message is posted whenever an element is ready to provide a
// clock or lost its ability to provide a clock (maybe because it paused or became EOS).
//
// This message is mainly used internally to manage the clock selection.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewClockProvideMessage(src GstObjectHolder, clock *Clock, ready bool) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_clock_provide(srcObj, clock.Instance(), gboolean(ready))))
}
// NewCustomMessage creates a new custom-typed message. This can be used for anything not handled by other message-specific
// functions to pass a message to the app. The structure field can be nil.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewCustomMessage(src GstObjectHolder, msgType MessageType, structure *Structure) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
if structure == nil {
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_custom(C.GstMessageType(msgType), srcObj, nil)))
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_custom(C.GstMessageType(msgType), srcObj, structure.Instance())))
}
// NewDeviceAddedMessage creates a new device-added message. The device-added message is produced by a DeviceProvider or a DeviceMonitor.
// They announce the appearance of monitored devices.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewDeviceAddedMessage(src GstObjectHolder, device *Device) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_device_added(srcObj, device.Instance())))
}
// NewDeviceChangedMessage creates a new device-changed message. The device-changed message is produced by a DeviceProvider or a DeviceMonitor.
// They announce that a device properties has changed and device represent the new modified version of changed_device.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewDeviceChangedMessage(src GstObjectHolder, device, changedDevice *Device) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_device_changed(srcObj, device.Instance(), changedDevice.Instance())))
}
// NewDeviceRemovedMessage creates a new device-removed message. The device-removed message is produced by a DeviceProvider or a DeviceMonitor.
// They announce the disappearance of monitored devices.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewDeviceRemovedMessage(src GstObjectHolder, device *Device) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_device_removed(srcObj, device.Instance())))
}
// NewDurationChangedMessage creates a new duration changed message. This message is posted by elements that know the duration of a
// stream when the duration changes. This message is received by bins and is used to calculate the total duration of a pipeline.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewDurationChangedMessage(src GstObjectHolder) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_duration_changed(srcObj)))
}
// NewElementMessage creates a new element-specific message. This is meant as a generic way of allowing one-way communication from an
// element to an application, for example "the firewire cable was unplugged". The format of the message should be documented in the
// element's documentation. The structure field can be nil.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewElementMessage(src GstObjectHolder, structure *Structure) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
if structure == nil {
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_element(srcObj, nil)))
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_element(srcObj, structure.Instance())))
}
// NewEOSMessage creates a new eos message. This message is generated and posted in the sink elements of a Bin. The bin will only forward
// the EOS message to the application if all sinks have posted an EOS message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewEOSMessage(src GstObjectHolder) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_eos(srcObj)))
}
// NewErrorMessage creates a new error message. The message will copy error and debug. This message is posted by element when a fatal event
// occurred. The pipeline will probably (partially) stop. The application receiving this message should stop the pipeline.
// Structure can be nil to not add a structure to the message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewErrorMessage(src GstObjectHolder, err error, debugStr string, structure *Structure) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
errmsg := C.CString(err.Error())
gerr := C.g_error_new_literal(DomainLibrary.toQuark(), C.gint(LibraryErrorFailed), (*C.gchar)(errmsg))
defer C.free(unsafe.Pointer(errmsg))
defer C.g_error_free(gerr)
gdebugStr := C.CString(debugStr)
defer C.free(unsafe.Pointer(gdebugStr))
if structure != nil {
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_error_with_details(
srcObj,
gerr,
gdebugStr,
structure.Instance(),
)))
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_error(
srcObj,
gerr,
gdebugStr,
)))
}
// NewHaveContextMessage creates a message that is posted when an element has a new local Context.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewHaveContextMessage(src GstObjectHolder, ctx *Context) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_have_context(
srcObj,
ctx.Ref().Instance(),
)))
}
// NewInfoMessage creates a new info message. Structure can be nil.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewInfoMessage(src GstObjectHolder, msg string, debugStr string, structure *Structure) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
errmsg := C.CString(msg)
gerr := C.g_error_new_literal(DomainLibrary.toQuark(), C.gint(0), (*C.gchar)(errmsg))
defer C.free(unsafe.Pointer(errmsg))
defer C.g_error_free(gerr)
gdebugStr := C.CString(debugStr)
defer C.free(unsafe.Pointer(gdebugStr))
if structure != nil {
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_info_with_details(
srcObj,
gerr,
gdebugStr,
structure.Instance(),
)))
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_info(
srcObj,
gerr,
gdebugStr,
)))
}
// NewLatencyMessage creates a message that can be posted by elements when their latency requirements have changed.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewLatencyMessage(src GstObjectHolder) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_latency(srcObj)))
}
// NewNeedContextMessage creates a message that is posted when an element needs a specific Context.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewNeedContextMessage(src GstObjectHolder, ctxType string) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
cStr := C.CString(ctxType)
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_need_context(srcObj, (*C.gchar)(unsafe.Pointer(cStr)))))
}
// NewNewClockMessage creates a new clock message. This message is posted whenever the pipeline selects a new clock for the pipeline.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewNewClockMessage(src GstObjectHolder, clock *Clock) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_new_clock(srcObj, clock.Instance())))
}
// NewProgressMessage creates messages that are posted by elements when they use an asynchronous task to perform actions triggered by a state change.
//
// Code contains a well defined string describing the action. Text should contain a user visible string detailing the current action.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewProgressMessage(src GstObjectHolder, progressType ProgressType, code, text string) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
cCode := (*C.gchar)(unsafe.Pointer(C.CString(code)))
cText := (*C.gchar)(unsafe.Pointer(C.CString(text)))
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_progress(srcObj, C.GstProgressType(progressType), cCode, cText)))
}
// NewPropertyNotifyMessage creates a new message notifying an object's properties have changed. If the
// source OR the value cannot be coereced to C types, the function will return nil.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewPropertyNotifyMessage(src GstObjectHolder, propName string, val interface{}) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
gVal, err := glib.GValue(val)
if err != nil {
return nil
}
cName := (*C.gchar)(unsafe.Pointer(C.CString(propName)))
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_property_notify(
srcObj,
cName,
(*C.GValue)(unsafe.Pointer(gVal.GValue)),
)))
}
// NewQoSMessage creates a message that is posted on the bus whenever an element decides to drop a buffer because of
// QoS reasons or whenever it changes its processing strategy because of QoS reasons (quality adjustments such as processing at lower accuracy).
//
// This message can be posted by an element that performs synchronization against the clock (live) or it could be dropped by an element that performs
// QoS because of QOS events received from a downstream element (!live).
//
// running_time, stream_time, timestamp, duration should be set to the respective running-time, stream-time, timestamp and duration of the (dropped) buffer
// that generated the QoS event. Values can be left to less than zero when unknown.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewQoSMessage(src GstObjectHolder, live bool, runningTime, streamTime, timestamp, duration uint64) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_qos(
srcObj,
gboolean(live),
C.guint64(runningTime),
C.guint64(streamTime),
C.guint64(timestamp),
C.guint64(duration),
)))
}
// NewRedirectMessage creates a new redirect message and adds a new entry to it. Redirect messages are posted when an element detects that the actual
// data has to be retrieved from a different location. This is useful if such a redirection cannot be handled inside a source element, for example when
// HTTP 302/303 redirects return a non-HTTP URL.
//
// The redirect message can hold multiple entries. The first one is added when the redirect message is created, with the given location, tag_list, entry_struct
// arguments. Use AddRedirectEntry to add more entries.
//
// Each entry has a location, a tag list, and a structure. All of these are optional. The tag list and structure are useful for additional metadata, such as
// bitrate statistics for the given location.
//
// By default, message recipients should treat entries in the order they are stored. The recipient should therefore try entry #0 first, and if this entry is not
// acceptable or working, try entry #1 etc. Senders must make sure that they add entries in this order. However, recipients are free to ignore the order and pick
// an entry that is "best" for them. One example would be a recipient that scans the entries for the one with the highest bitrate tag.
//
// The specified location string is copied. However, ownership over the tag list and structure are transferred to the message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewRedirectMessage(src GstObjectHolder, location string, tagList *TagList, entryStructure *Structure) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
var loc *C.gchar
var tl *C.GstTagList
var st *C.GstStructure
if location != "" {
locc := C.CString(location)
defer C.free(unsafe.Pointer(locc))
loc = (*C.gchar)(unsafe.Pointer(locc))
}
if tagList != nil {
tl = tagList.Ref().Instance()
}
if entryStructure != nil {
st = entryStructure.Instance()
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_redirect(
srcObj,
loc, tl, st,
)))
}
// AddRedirectEntry creates and appends a new entry to the message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) AddRedirectEntry(location string, tagList *TagList, entryStructure *Structure) {
var loc *C.gchar
var tl *C.GstTagList
var st *C.GstStructure
if location != "" {
locc := C.CString(location)
defer C.free(unsafe.Pointer(locc))
loc = (*C.gchar)(unsafe.Pointer(locc))
}
if tagList != nil {
tl = tagList.Ref().Instance()
}
if entryStructure != nil {
st = entryStructure.Instance()
}
C.gst_message_add_redirect_entry(m.Instance(), loc, tl, st)
}
// NewRequestStateMessage creates a message that can be posted by elements when they want to have their state changed.
// A typical use case would be an audio server that wants to pause the pipeline because a higher priority stream is being played.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewRequestStateMessage(src GstObjectHolder, state State) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_request_state(srcObj, C.GstState(state))))
}
// NewResetTimeMessage creates a message that is posted when the pipeline running-time should be reset to running_time, like after a flushing seek.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewResetTimeMessage(src GstObjectHolder, runningTime ClockTime) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_reset_time(srcObj, C.GstClockTime(runningTime))))
}
// NewSegmentDoneMessage creates a new segment done message. This message is posted by elements that finish playback of a segment as a result of a
// segment seek. This message is received by the application after all elements that posted a segment_start have posted the segment_done.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewSegmentDoneMessage(src GstObjectHolder, format Format, position int64) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_segment_done(
srcObj,
C.GstFormat(format),
C.gint64(position),
)))
}
// NewSegmentStartMessage creates a new segment message. This message is posted by elements that start playback of a segment as a result of a segment seek.
// This message is not received by the application but is used for maintenance reasons in container elements.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewSegmentStartMessage(src GstObjectHolder, format Format, position int64) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_segment_start(
srcObj,
C.GstFormat(format),
C.gint64(position),
)))
}
// NewStateChangedMessage creates a state change message. This message is posted whenever an element changed its state.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewStateChangedMessage(src GstObjectHolder, oldState, newState, pendingState State) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_state_changed(
srcObj,
C.GstState(oldState), C.GstState(newState), C.GstState(pendingState),
)))
}
// NewStateDirtyMessage creates a state dirty message. This message is posted whenever an element changed its state asynchronously
// and is used internally to update the states of container objects.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewStateDirtyMessage(src GstObjectHolder) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_state_dirty(srcObj)))
}
// NewStepDoneMessage creates a message that is posted by elements when they complete a part, when intermediate set to TRUE, or a
// complete step operation.
//
// Duration will contain the amount of time of the stepped amount of media in format format.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewStepDoneMessage(src GstObjectHolder, format Format, amount uint64, rate float64, flush, intermediate bool, duration uint64, eos bool) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_step_done(
srcObj,
C.GstFormat(format),
C.guint64(amount),
C.gdouble(rate),
gboolean(flush),
gboolean(intermediate),
C.guint64(duration),
gboolean(eos),
)))
}
// NewStepStartMessage creates a message that is posted by elements when they accept or activate a new step event for amount in format.
//
// Active is set to FALSE when the element accepted the new step event and has queued it for execution in the streaming threads.
//
// Active is set to TRUE when the element has activated the step operation and is now ready to start executing the step in the streaming thread.
// After this message is emitted, the application can queue a new step operation in the element.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewStepStartMessage(src GstObjectHolder, active bool, format Format, amount uint64, rate float64, flush, intermediate bool) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_step_start(
srcObj,
gboolean(active),
C.GstFormat(format),
C.guint64(amount),
C.gdouble(rate),
gboolean(flush),
gboolean(intermediate),
)))
}
// NewStreamCollectionMessage creates a new stream-collection message. The message is used to announce new StreamCollections.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewStreamCollectionMessage(src GstObjectHolder, collection *StreamCollection) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_stream_collection(srcObj, collection.Instance())))
}
// NewStreamStartMessage creates a new stream_start message. This message is generated and posted in the sink elements of a Bin.
// The bin will only forward the StreamStart message to the application if all sinks have posted a StreamStart message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewStreamStartMessage(src GstObjectHolder) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_stream_start(srcObj)))
}
// NewStreamStatusMessage creates a new stream status message. This message is posted when a streaming thread is created/destroyed or
// when the state changed.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewStreamStatusMessage(src GstObjectHolder, stType StreamStatusType, owner *Element) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_stream_status(srcObj, C.GstStreamStatusType(stType), owner.Instance())))
}
// NewStreamSelectedMessage creates a new steams-selected message. The message is used to announce that an array of streams has been selected.
// This is generally in response to a GST_EVENT_SELECT_STREAMS event, or when an element (such as decodebin3) makes an initial selection of streams.
//
// The message also contains the StreamCollection to which the various streams belong to.
//
// Users of this constructor can add the selected streams with StreamsSelectedAdd.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewStreamSelectedMessage(src GstObjectHolder, collection *StreamCollection) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_streams_selected(srcObj, collection.Instance())))
}
// StreamsSelectedAdd adds the stream to the message
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) StreamsSelectedAdd(stream *Stream) {
C.gst_message_streams_selected_add(m.Instance(), stream.Instance())
}
// StreamsSelectedSize returns the number of streams contained in the message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) StreamsSelectedSize() uint {
return uint(C.gst_message_streams_selected_get_size(m.Instance()))
}
// StreamsSelectedGetStream retrieves the Stream with index index from the message.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) StreamsSelectedGetStream(index uint) *Stream {
stream := C.gst_message_streams_selected_get_stream(m.Instance(), C.guint(index))
if stream == nil {
return nil
}
return wrapStream(glib.TransferFull(unsafe.Pointer(stream)))
}
// NewStructureChangeMessage creates a new structure change message. This message is posted when the structure of a pipeline is in the process
// of being changed, for example when pads are linked or unlinked.
//
// Src should be the sinkpad that unlinked or linked.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewStructureChangeMessage(src GstObjectHolder, chgType StructureChangeType, owner *Element, busy bool) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_structure_change(
srcObj,
C.GstStructureChangeType(chgType),
owner.Instance(),
gboolean(busy),
)))
}
// NewTagMessage creates a new tag message. The message will take ownership of the tag list. The message is posted by elements that discovered a new taglist.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewTagMessage(src GstObjectHolder, tagList *TagList) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_tag(srcObj, tagList.Ref().Instance())))
}
// NewTOCMessage creates a new TOC message. The message is posted by elements that discovered or updated a TOC.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewTOCMessage(src GstObjectHolder, toc *TOC, updated bool) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_toc(
srcObj,
toc.Instance(),
gboolean(updated),
)))
}
// NewWarningMessage creates a new warning message. Structure can be nil.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func NewWarningMessage(src GstObjectHolder, msg string, debugStr string, structure *Structure) *Message {
srcObj := getMessageSourceObj(src)
if srcObj == nil {
return nil
}
errmsg := C.CString(msg)
gerr := C.g_error_new_literal(DomainLibrary.toQuark(), C.gint(0), (*C.gchar)(errmsg))
defer C.free(unsafe.Pointer(errmsg))
defer C.g_error_free(gerr)
gdebugStr := C.CString(debugStr)
defer C.free(unsafe.Pointer(gdebugStr))
if structure != nil {
return wrapMessage(C.gst_message_new_warning_with_details(
srcObj,
gerr,
gdebugStr,
structure.Instance(),
))
}
return FromGstMessageUnsafeFull(unsafe.Pointer(C.gst_message_new_warning(
srcObj,
gerr,
gdebugStr,
)))
}

View File

@@ -1,191 +0,0 @@
package gst
import (
"encoding/json"
"fmt"
"strings"
)
// String implements a stringer on the message. It iterates over the type of the message
// and applies the correct parser, then dumps a string of the basic contents of the
// message. This function can be expensive and should only be used for debugging purposes
// or in routines where latency is not a concern.
//
// This stringer really just helps in keeping track of making sure all message types are
// accounted for in some way. It's the devil, writing it was the devil, and I hope you
// enjoy being able to `fmt.Println(msg)`.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Message) String() string {
msg := fmt.Sprintf("[%s] %s - ", m.Source(), strings.ToUpper(m.TypeName()))
switch m.Type() {
case MessageEOS:
msg += "End-of-stream reached in the pipeline"
case MessageInfo:
msg += m.parseToError().Message()
case MessageWarning:
msg += m.parseToError().Message()
case MessageError:
msg += m.parseToError().Message()
case MessageTag:
tags := m.ParseTags()
if tags != nil {
msg += tags.String()
}
case MessageBuffering:
stats := m.ParseBufferingStats()
msg += fmt.Sprintf(
"Buffering %s - %d%% complete (avg in %d/sec, avg out %d/sec, time left %s)",
stats.BufferingMode.String(),
m.ParseBuffering(),
stats.AverageIn,
stats.AverageOut,
stats.BufferingLeft.String(),
)
case MessageStateChanged:
oldState, newState := m.ParseStateChanged()
msg += fmt.Sprintf("State changed from %s to %s", oldState.String(), newState.String())
case MessageStateDirty:
msg += "(DEPRECATED MESSAGE) An element changed state in a streaming thread"
case MessageStepDone:
out, err := json.Marshal(m.ParseStepDone())
if err == nil {
msg += string(out)
}
case MessageClockProvide:
msg += "Element has clock provide capability"
case MessageClockLost:
msg += "Lost a clock"
case MessageNewClock:
msg += "Got a new clock"
case MessageStructureChange:
chgType, elem, busy := m.ParseStructureChange()
msg += fmt.Sprintf("Structure change of type %s from %s. (in progress: %v)", chgType.String(), elem.GetName(), busy)
case MessageStreamStatus:
statusType, elem := m.ParseStreamStatus()
msg += fmt.Sprintf("Stream status from %s: %s", elem.GetName(), statusType.String())
case MessageApplication:
msg += "Message posted by the application, possibly via an application-specific element."
case MessageElement:
msg += "Internal element message posted"
case MessageSegmentStart:
format, pos := m.ParseSegmentStart()
msg += fmt.Sprintf("Segment started at %d %s", pos, format.String())
case MessageSegmentDone:
format, pos := m.ParseSegmentDone()
msg += fmt.Sprintf("Segment started at %d %s", pos, format.String())
case MessageDurationChanged:
msg += "The duration of the pipeline changed"
case MessageLatency:
msg += "Element's latency has changed"
case MessageAsyncStart:
msg += "Async task started"
case MessageAsyncDone:
msg += "Async task completed"
if dur := m.ParseAsyncDone(); dur > 0 {
msg += fmt.Sprintf(" in %s", dur.String())
}
case MessageRequestState:
msg += fmt.Sprintf("State chnage request to %s", m.ParseRequestState().String())
case MessageStepStart:
out, err := json.Marshal(m.ParseStepStart())
if err == nil {
msg += string(out)
}
case MessageQoS:
out, err := json.Marshal(m.ParseQoS())
if err == nil {
msg += string(out)
}
case MessageProgress:
progressType, code, text := m.ParseProgress()
msg += fmt.Sprintf("%s - %s - %s", strings.ToUpper(progressType.String()), code, text)
case MessageTOC:
// TODO
case MessageResetTime:
msg += fmt.Sprintf("Running time: %s", m.ParseResetTime().String())
case MessageStreamStart:
msg += "Pipeline stream is starting"
case MessageNeedContext:
msg += "Element needs context"
case MessageHaveContext:
ctx := m.ParseHaveContext()
msg += fmt.Sprintf("Received context of type %s", ctx.GetType())
case MessageExtended:
msg += "Extended message type"
case MessageDeviceAdded:
if device := m.ParseDeviceAdded(); device != nil {
msg += fmt.Sprintf("Device %s added", device.GetDisplayName())
}
case MessageDeviceRemoved:
if device := m.ParseDeviceRemoved(); device != nil {
msg += fmt.Sprintf("Device %s removed", device.GetDisplayName())
}
case MessageDeviceChanged:
if device, _ := m.ParseDeviceChanged(); device != nil {
msg += fmt.Sprintf("Device %s had its properties updated", device.GetDisplayName())
}
case MessagePropertyNotify:
obj, propName, propVal := m.ParsePropertyNotify()
if obj != nil && propVal != nil {
goval, err := propVal.GoValue()
if err != nil {
msg += fmt.Sprintf("Object %s had property '%s' changed to %+v", obj.GetName(), propName, goval)
}
}
case MessageStreamCollection:
collection := m.ParseStreamCollection()
msg += fmt.Sprintf("New stream collection with upstream id: %s", collection.GetUpstreamID())
case MessageStreamsSelected:
collection := m.ParseStreamsSelected()
msg += fmt.Sprintf("Stream with upstream id '%s' has selected new streams", collection.GetUpstreamID())
case MessageRedirect:
msg += fmt.Sprintf("Received redirect message with %d entries", m.NumRedirectEntries())
case MessageUnknown:
msg += "Unknown message type"
case MessageAny:
msg += "Message did not match any known types"
}
return msg
}

View File

@@ -1,221 +0,0 @@
package gst
/*
#include "gst.go.h"
extern void goMetaFreeFunc (GstMeta * meta, GstBuffer * buffer);
extern gboolean goMetaInitFunc (GstMeta *meta, gpointer params, GstBuffer * buffer);
extern gboolean goMetaTransformFunc (GstBuffer * transBuf, GstMeta * meta, GstBuffer * buffer, GQuark type, gpointer data);
void cgoMetaFreeFunc (GstMeta * meta, GstBuffer * buffer)
{
goMetaFreeFunc(meta, buffer);
}
gboolean cgoMetaInitFunc (GstMeta * meta, gpointer params, GstBuffer * buffer)
{
return goMetaInitFunc(meta, params, buffer);
}
gboolean cgoMetaTransformFunc (GstBuffer * transBuf, GstMeta * meta, GstBuffer * buffer, GQuark type, gpointer data)
{
return goMetaTransformFunc(transBuf, meta, buffer, type, data);
}
*/
import "C"
import (
"unsafe"
"github.com/go-gst/go-glib/glib"
)
// Meta is a go representation of GstMeta.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type Meta struct {
ptr *C.GstMeta
}
// FromGstMetaUnsafe wraps the pointer to the given C GstMeta with the go type.
// This is meant for internal usage and is exported for visibility to other packages.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstMetaUnsafe(ptr unsafe.Pointer) *Meta { return wrapMeta(C.toGstMeta(ptr)) }
// Instance returns the underlying GstMeta instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Meta) Instance() *C.GstMeta { return C.toGstMeta(unsafe.Pointer(m.ptr)) }
// Flags returns the flags on this Meta instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Meta) Flags() MetaFlags { return MetaFlags(m.Instance().flags) }
// SetFlags sets the flags on this Meta instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Meta) SetFlags(flags MetaFlags) { m.Instance().flags = C.GstMetaFlags(flags) }
// Info returns the extra info with this metadata.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Meta) Info() *MetaInfo { return wrapMetaInfo(m.Instance().info) }
// SetInfo sets the info on this metadata.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *Meta) SetInfo(info *MetaInfo) { m.Instance().info = info.Instance() }
// MetaInfo is a go representation of GstMetaInfo
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type MetaInfo struct {
ptr *C.GstMetaInfo
}
// FromGstMetaInfoUnsafe wraps the given unsafe pointer in a MetaInfo instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func FromGstMetaInfoUnsafe(ptr unsafe.Pointer) *MetaInfo {
if ptr == nil {
return nil
}
return &MetaInfo{ptr: (*C.GstMetaInfo)(ptr)}
}
// RegisterAPIType registers and returns a GType for the given api name and associates it with tags.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func RegisterAPIType(name string, tags []string) glib.Type {
cTags := gcharStrings(tags)
defer C.g_free((C.gpointer)(unsafe.Pointer(cTags)))
cName := C.CString(name)
defer C.free(unsafe.Pointer(cName))
newType := C.gst_meta_api_type_register((*C.gchar)(cName), cTags)
return glib.Type(newType)
}
// GetAPIInfo gets the MetaInfo for the given api type.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func GetAPIInfo(name string) *MetaInfo {
cName := C.CString(name)
defer C.free(unsafe.Pointer(cName))
return wrapMetaInfo(C.gst_meta_get_info((*C.gchar)(cName)))
}
// GetAPITags retrieves the tags for the given api type.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func GetAPITags(apiType glib.Type) []string {
tags := C.gst_meta_api_type_get_tags(C.GType(apiType))
return goStrings(C.sizeOfGCharArray(tags), tags)
}
// APIHasTag returns true if the given api has the given tag.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func APIHasTag(api glib.Type, tag string) bool {
q := newQuarkFromString(tag)
return gobool(C.gst_meta_api_type_has_tag(C.GType(api), q))
}
// MetaInitFunc is a function called when meta is initialized in buffer.
type MetaInitFunc func(params interface{}, buffer *Buffer) bool
// MetaFreeFunc is a function called when meta is freed in buffer.
type MetaFreeFunc func(buffer *Buffer)
// MetaTransformFunc is a function called for each meta in buf as a result
// of performing a transformation on transbuf. Additional type specific transform
// data is passed to the function as data.
type MetaTransformFunc func(transBuf, buf *Buffer, mType string, data *MetaTransformCopy) bool
// MetaTransformCopy is extra data passed to a MetaTransformFunc
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type MetaTransformCopy struct {
// true if only region is copied
Region bool
// the offset to copy, 0 if region is FALSE, otherwise > 0
Offset int64
// the size to copy, -1 or the buffer size when region is FALSE
Size int64
}
// MetaInfoCallbackFuncs represents callback functions to include when registering a new
// meta type.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
type MetaInfoCallbackFuncs struct {
InitFunc MetaInitFunc
FreeFunc MetaFreeFunc
TransformFunc MetaTransformFunc
}
// Register meta callbacks internally as well so we can track them. Not all
// GstMeta callbacks include userdata.
var registeredMetas = make(map[glib.Type]map[string]*MetaInfoCallbackFuncs)
// RegisterMeta registers and returns a new MetaInfo instance denoting the
// given type, name, and size.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func RegisterMeta(api glib.Type, name string, size int64, cbFuncs *MetaInfoCallbackFuncs) *MetaInfo {
cName := C.CString(name)
defer C.free(unsafe.Pointer(cName))
metaInfo := C.gst_meta_register(
C.GType(api),
(*C.gchar)(unsafe.Pointer(cName)),
C.gsize(size),
C.GstMetaInitFunction(C.cgoMetaInitFunc),
C.GstMetaFreeFunction(C.cgoMetaFreeFunc),
C.GstMetaTransformFunction(C.cgoMetaTransformFunc),
)
if metaInfo == nil {
return nil
}
wrapped := wrapMetaInfo(metaInfo)
if registeredMetas[api] == nil {
registeredMetas[api] = make(map[string]*MetaInfoCallbackFuncs)
}
registeredMetas[api][name] = cbFuncs
return wrapped
}
// Instance returns the underlying GstMetaInfo instance.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MetaInfo) Instance() *C.GstMetaInfo { return m.ptr }
// API returns the tag identifying the metadata structure and api.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MetaInfo) API() glib.Type { return glib.Type(m.Instance().api) }
// SetAPI sets the API tag identifying the metadata structure and api.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MetaInfo) SetAPI(t glib.Type) { m.Instance().api = C.GType(t) }
// Type returns the type identifying the implementor of the api.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MetaInfo) Type() glib.Type { return glib.Type(m.Instance()._type) }
// SetType sets the type identifying the implementor of the api.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MetaInfo) SetType(t glib.Type) { m.Instance()._type = C.GType(t) }
// Size returns the size of the metadata.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MetaInfo) Size() int64 { return int64(m.Instance().size) }
// SetSize sets the size on the metadata.
//
// Deprecated: This is handwritten and will be removed in a future version. Please use the autogenerated bindings instead.
func (m *MetaInfo) SetSize(size int64) { m.Instance().size = C.gsize(size) }

Some files were not shown because too many files have changed in this diff Show More