Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts: src/imports/multimedia/qdeclarativeaudio.cpp Change-Id: I57c6252b084e4ed796f6f308b2e0c717d0f59b13
This commit is contained in:
686
LICENSE.GPLv3
Normal file
686
LICENSE.GPLv3
Normal file
@@ -0,0 +1,686 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
|
||||||
|
The Qt Toolkit is Copyright (C) 2015 The Qt Company Ltd.
|
||||||
|
Contact: http://www.qt.io/licensing/
|
||||||
|
|
||||||
|
You may use, distribute and copy the Qt GUI Toolkit under the terms of
|
||||||
|
GNU Lesser General Public License version 3. That license references
|
||||||
|
the General Public License version 3, that is displayed below. Other
|
||||||
|
portions of the Qt Toolkit may be licensed directly under this license.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, 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
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If 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 convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU 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
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "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 PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state 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 program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program 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 General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||||
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
You may use, distribute and copy the Qt GUI Toolkit under the terms of
|
You may use, distribute and copy the Qt GUI Toolkit under the terms of
|
||||||
GNU Lesser General Public License version 3, which is displayed below.
|
GNU Lesser General Public License version 3, which is displayed below.
|
||||||
|
This license makes reference to the version 3 of the GNU General
|
||||||
|
Public License, which you can find in the LICENSE.GPLv3 file.
|
||||||
|
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,8 @@ PRIVATE_HEADERS += \
|
|||||||
qgstcodecsinfo_p.h \
|
qgstcodecsinfo_p.h \
|
||||||
qgstreamervideoprobecontrol_p.h \
|
qgstreamervideoprobecontrol_p.h \
|
||||||
qgstreameraudioprobecontrol_p.h \
|
qgstreameraudioprobecontrol_p.h \
|
||||||
qgstreamervideowindow_p.h
|
qgstreamervideowindow_p.h \
|
||||||
|
qgstreamervideooverlay_p.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
qgstreamerbushelper.cpp \
|
qgstreamerbushelper.cpp \
|
||||||
@@ -68,7 +69,8 @@ SOURCES += \
|
|||||||
qgstcodecsinfo.cpp \
|
qgstcodecsinfo.cpp \
|
||||||
qgstreamervideoprobecontrol.cpp \
|
qgstreamervideoprobecontrol.cpp \
|
||||||
qgstreameraudioprobecontrol.cpp \
|
qgstreameraudioprobecontrol.cpp \
|
||||||
qgstreamervideowindow.cpp
|
qgstreamervideowindow.cpp \
|
||||||
|
qgstreamervideooverlay.cpp
|
||||||
|
|
||||||
qtHaveModule(widgets) {
|
qtHaveModule(widgets) {
|
||||||
QT += multimediawidgets
|
QT += multimediawidgets
|
||||||
|
|||||||
429
src/gsttools/qgstreamervideooverlay.cpp
Normal file
429
src/gsttools/qgstreamervideooverlay.cpp
Normal file
@@ -0,0 +1,429 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2015 The Qt Company Ltd.
|
||||||
|
** Contact: http://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL21$
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
|
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at http://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 or version 3 as published by the Free
|
||||||
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||||
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||||
|
** following information to ensure the GNU Lesser General Public License
|
||||||
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||||
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** As a special exception, The Qt Company gives you certain additional
|
||||||
|
** rights. These rights are described in The Qt Company LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "qgstreamervideooverlay_p.h"
|
||||||
|
|
||||||
|
#include <QtGui/qguiapplication.h>
|
||||||
|
#include "qgstutils_p.h"
|
||||||
|
|
||||||
|
#if !GST_CHECK_VERSION(1,0,0)
|
||||||
|
#include <gst/interfaces/xoverlay.h>
|
||||||
|
#else
|
||||||
|
#include <gst/video/videooverlay.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
struct ElementMap
|
||||||
|
{
|
||||||
|
const char *qtPlatform;
|
||||||
|
const char *gstreamerElement;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Ordered by descending priority
|
||||||
|
static const ElementMap elementMap[] =
|
||||||
|
{
|
||||||
|
{ "xcb", "vaapisink" },
|
||||||
|
{ "xcb", "xvimagesink" },
|
||||||
|
{ "xcb", "ximagesink" }
|
||||||
|
};
|
||||||
|
|
||||||
|
QGstreamerVideoOverlay::QGstreamerVideoOverlay(QObject *parent, const QByteArray &elementName)
|
||||||
|
: QObject(parent)
|
||||||
|
, QGstreamerBufferProbe(QGstreamerBufferProbe::ProbeCaps)
|
||||||
|
, m_videoSink(0)
|
||||||
|
, m_isActive(false)
|
||||||
|
, m_hasForceAspectRatio(false)
|
||||||
|
, m_hasBrightness(false)
|
||||||
|
, m_hasContrast(false)
|
||||||
|
, m_hasHue(false)
|
||||||
|
, m_hasSaturation(false)
|
||||||
|
, m_hasShowPrerollFrame(false)
|
||||||
|
, m_windowId(0)
|
||||||
|
, m_aspectRatioMode(Qt::KeepAspectRatio)
|
||||||
|
, m_brightness(0)
|
||||||
|
, m_contrast(0)
|
||||||
|
, m_hue(0)
|
||||||
|
, m_saturation(0)
|
||||||
|
{
|
||||||
|
if (!elementName.isEmpty())
|
||||||
|
m_videoSink = gst_element_factory_make(elementName.constData(), NULL);
|
||||||
|
else
|
||||||
|
m_videoSink = findBestVideoSink();
|
||||||
|
|
||||||
|
if (m_videoSink) {
|
||||||
|
qt_gst_object_ref_sink(GST_OBJECT(m_videoSink)); //Take ownership
|
||||||
|
|
||||||
|
GstPad *pad = gst_element_get_static_pad(m_videoSink, "sink");
|
||||||
|
addProbeToPad(pad);
|
||||||
|
gst_object_unref(GST_OBJECT(pad));
|
||||||
|
|
||||||
|
m_hasForceAspectRatio = g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "force-aspect-ratio");
|
||||||
|
m_hasBrightness = g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "brightness");
|
||||||
|
m_hasContrast = g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "contrast");
|
||||||
|
m_hasHue = g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "hue");
|
||||||
|
m_hasSaturation = g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "saturation");
|
||||||
|
m_hasShowPrerollFrame = g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "show-preroll-frame");
|
||||||
|
|
||||||
|
if (m_hasShowPrerollFrame) {
|
||||||
|
g_signal_connect(m_videoSink, "notify::show-preroll-frame",
|
||||||
|
G_CALLBACK(showPrerollFrameChanged), this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QGstreamerVideoOverlay::~QGstreamerVideoOverlay()
|
||||||
|
{
|
||||||
|
if (m_videoSink) {
|
||||||
|
GstPad *pad = gst_element_get_static_pad(m_videoSink, "sink");
|
||||||
|
removeProbeFromPad(pad);
|
||||||
|
gst_object_unref(GST_OBJECT(pad));
|
||||||
|
gst_object_unref(GST_OBJECT(m_videoSink));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool qt_gst_element_is_functioning(GstElement *element)
|
||||||
|
{
|
||||||
|
GstStateChangeReturn ret = gst_element_set_state(element, GST_STATE_READY);
|
||||||
|
if (ret == GST_STATE_CHANGE_SUCCESS) {
|
||||||
|
gst_element_set_state(element, GST_STATE_NULL);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
GstElement *QGstreamerVideoOverlay::findBestVideoSink() const
|
||||||
|
{
|
||||||
|
GstElement *choice = 0;
|
||||||
|
QString platform = QGuiApplication::platformName();
|
||||||
|
|
||||||
|
// We need a native window ID to use the GstVideoOverlay interface.
|
||||||
|
// Bail out if the Qt platform plugin in use cannot provide a sensible WId.
|
||||||
|
if (platform != QLatin1String("xcb"))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// First, try some known video sinks, depending on the Qt platform plugin in use.
|
||||||
|
for (quint32 i = 0; i < (sizeof(elementMap) / sizeof(ElementMap)); ++i) {
|
||||||
|
if (platform == QLatin1String(elementMap[i].qtPlatform)
|
||||||
|
&& (choice = gst_element_factory_make(elementMap[i].gstreamerElement, NULL))) {
|
||||||
|
|
||||||
|
if (qt_gst_element_is_functioning(choice))
|
||||||
|
return choice;
|
||||||
|
|
||||||
|
gst_object_unref(choice);
|
||||||
|
choice = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If none of the known video sinks are available, try to find one that implements the
|
||||||
|
// GstVideoOverlay interface and has autoplugging rank.
|
||||||
|
GList *list = gst_element_factory_list_get_elements(GST_ELEMENT_FACTORY_TYPE_SINK | GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO,
|
||||||
|
GST_RANK_MARGINAL);
|
||||||
|
|
||||||
|
for (GList *item = list; item != NULL; item = item->next) {
|
||||||
|
GstElementFactory *f = GST_ELEMENT_FACTORY(item->data);
|
||||||
|
|
||||||
|
if (!gst_element_factory_has_interface(f, QT_GSTREAMER_VIDEOOVERLAY_INTERFACE_NAME))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (GstElement *el = gst_element_factory_create(f, NULL)) {
|
||||||
|
if (qt_gst_element_is_functioning(el)) {
|
||||||
|
choice = el;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
gst_object_unref(el);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gst_plugin_feature_list_free(list);
|
||||||
|
|
||||||
|
return choice;
|
||||||
|
}
|
||||||
|
|
||||||
|
GstElement *QGstreamerVideoOverlay::videoSink() const
|
||||||
|
{
|
||||||
|
return m_videoSink;
|
||||||
|
}
|
||||||
|
|
||||||
|
QSize QGstreamerVideoOverlay::nativeVideoSize() const
|
||||||
|
{
|
||||||
|
return m_nativeVideoSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QGstreamerVideoOverlay::setWindowHandle(WId id)
|
||||||
|
{
|
||||||
|
m_windowId = id;
|
||||||
|
|
||||||
|
if (isActive())
|
||||||
|
setWindowHandle_helper(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QGstreamerVideoOverlay::setWindowHandle_helper(WId id)
|
||||||
|
{
|
||||||
|
#if GST_CHECK_VERSION(1,0,0)
|
||||||
|
if (m_videoSink && GST_IS_VIDEO_OVERLAY(m_videoSink)) {
|
||||||
|
gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(m_videoSink), id);
|
||||||
|
#else
|
||||||
|
if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
|
||||||
|
# if GST_CHECK_VERSION(0,10,31)
|
||||||
|
gst_x_overlay_set_window_handle(GST_X_OVERLAY(m_videoSink), id);
|
||||||
|
# else
|
||||||
|
gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(m_videoSink), id);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Properties need to be reset when changing the winId.
|
||||||
|
setAspectRatioMode(m_aspectRatioMode);
|
||||||
|
setBrightness(m_brightness);
|
||||||
|
setContrast(m_contrast);
|
||||||
|
setHue(m_hue);
|
||||||
|
setSaturation(m_saturation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QGstreamerVideoOverlay::expose()
|
||||||
|
{
|
||||||
|
if (!isActive())
|
||||||
|
return;
|
||||||
|
|
||||||
|
#if !GST_CHECK_VERSION(1,0,0)
|
||||||
|
if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink))
|
||||||
|
gst_x_overlay_expose(GST_X_OVERLAY(m_videoSink));
|
||||||
|
#else
|
||||||
|
if (m_videoSink && GST_IS_VIDEO_OVERLAY(m_videoSink)) {
|
||||||
|
gst_video_overlay_expose(GST_VIDEO_OVERLAY(m_videoSink));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void QGstreamerVideoOverlay::setRenderRectangle(const QRect &rect)
|
||||||
|
{
|
||||||
|
int x = -1;
|
||||||
|
int y = -1;
|
||||||
|
int w = -1;
|
||||||
|
int h = -1;
|
||||||
|
|
||||||
|
if (!rect.isEmpty()) {
|
||||||
|
x = rect.x();
|
||||||
|
y = rect.y();
|
||||||
|
w = rect.width();
|
||||||
|
h = rect.height();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !GST_CHECK_VERSION(1,0,0)
|
||||||
|
if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink))
|
||||||
|
gst_x_overlay_set_render_rectangle(GST_X_OVERLAY(m_videoSink), x, y , w , h);
|
||||||
|
#else
|
||||||
|
if (m_videoSink && GST_IS_VIDEO_OVERLAY(m_videoSink))
|
||||||
|
gst_video_overlay_set_render_rectangle(GST_VIDEO_OVERLAY(m_videoSink), x, y, w, h);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QGstreamerVideoOverlay::processSyncMessage(const QGstreamerMessage &message)
|
||||||
|
{
|
||||||
|
GstMessage* gm = message.rawMessage();
|
||||||
|
|
||||||
|
#if !GST_CHECK_VERSION(1,0,0)
|
||||||
|
if (gm && (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) &&
|
||||||
|
gst_structure_has_name(gm->structure, "prepare-xwindow-id")) {
|
||||||
|
#else
|
||||||
|
if (gm && (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) &&
|
||||||
|
gst_structure_has_name(gst_message_get_structure(gm), "prepare-window-handle")) {
|
||||||
|
#endif
|
||||||
|
setWindowHandle_helper(m_windowId);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QGstreamerVideoOverlay::processBusMessage(const QGstreamerMessage &message)
|
||||||
|
{
|
||||||
|
GstMessage* gm = message.rawMessage();
|
||||||
|
|
||||||
|
if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_STATE_CHANGED &&
|
||||||
|
GST_MESSAGE_SRC(gm) == GST_OBJECT_CAST(m_videoSink)) {
|
||||||
|
|
||||||
|
updateIsActive();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QGstreamerVideoOverlay::probeCaps(GstCaps *caps)
|
||||||
|
{
|
||||||
|
QSize size = QGstUtils::capsCorrectedResolution(caps);
|
||||||
|
if (size != m_nativeVideoSize) {
|
||||||
|
m_nativeVideoSize = size;
|
||||||
|
emit nativeVideoSizeChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QGstreamerVideoOverlay::isActive() const
|
||||||
|
{
|
||||||
|
return m_isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QGstreamerVideoOverlay::updateIsActive()
|
||||||
|
{
|
||||||
|
if (!m_videoSink)
|
||||||
|
return;
|
||||||
|
|
||||||
|
GstState state = GST_STATE(m_videoSink);
|
||||||
|
gboolean showPreroll = true;
|
||||||
|
|
||||||
|
if (m_hasShowPrerollFrame)
|
||||||
|
g_object_get(G_OBJECT(m_videoSink), "show-preroll-frame", &showPreroll, NULL);
|
||||||
|
|
||||||
|
bool newIsActive = (state == GST_STATE_PLAYING || (state == GST_STATE_PAUSED && showPreroll));
|
||||||
|
|
||||||
|
if (newIsActive != m_isActive) {
|
||||||
|
m_isActive = newIsActive;
|
||||||
|
emit activeChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QGstreamerVideoOverlay::showPrerollFrameChanged(GObject *, GParamSpec *, QGstreamerVideoOverlay *overlay)
|
||||||
|
{
|
||||||
|
overlay->updateIsActive();
|
||||||
|
}
|
||||||
|
|
||||||
|
Qt::AspectRatioMode QGstreamerVideoOverlay::aspectRatioMode() const
|
||||||
|
{
|
||||||
|
Qt::AspectRatioMode mode = Qt::KeepAspectRatio;
|
||||||
|
|
||||||
|
if (m_hasForceAspectRatio) {
|
||||||
|
gboolean forceAR = false;
|
||||||
|
g_object_get(G_OBJECT(m_videoSink), "force-aspect-ratio", &forceAR, NULL);
|
||||||
|
if (!forceAR)
|
||||||
|
mode = Qt::IgnoreAspectRatio;
|
||||||
|
}
|
||||||
|
|
||||||
|
return mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QGstreamerVideoOverlay::setAspectRatioMode(Qt::AspectRatioMode mode)
|
||||||
|
{
|
||||||
|
if (m_hasForceAspectRatio) {
|
||||||
|
g_object_set(G_OBJECT(m_videoSink),
|
||||||
|
"force-aspect-ratio",
|
||||||
|
(mode == Qt::KeepAspectRatio),
|
||||||
|
(const char*)NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_aspectRatioMode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
int QGstreamerVideoOverlay::brightness() const
|
||||||
|
{
|
||||||
|
int brightness = 0;
|
||||||
|
|
||||||
|
if (m_hasBrightness)
|
||||||
|
g_object_get(G_OBJECT(m_videoSink), "brightness", &brightness, NULL);
|
||||||
|
|
||||||
|
return brightness / 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QGstreamerVideoOverlay::setBrightness(int brightness)
|
||||||
|
{
|
||||||
|
if (m_hasBrightness) {
|
||||||
|
g_object_set(G_OBJECT(m_videoSink), "brightness", brightness * 10, NULL);
|
||||||
|
emit brightnessChanged(brightness);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_brightness = brightness;
|
||||||
|
}
|
||||||
|
|
||||||
|
int QGstreamerVideoOverlay::contrast() const
|
||||||
|
{
|
||||||
|
int contrast = 0;
|
||||||
|
|
||||||
|
if (m_hasContrast)
|
||||||
|
g_object_get(G_OBJECT(m_videoSink), "contrast", &contrast, NULL);
|
||||||
|
|
||||||
|
return contrast / 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QGstreamerVideoOverlay::setContrast(int contrast)
|
||||||
|
{
|
||||||
|
if (m_hasContrast) {
|
||||||
|
g_object_set(G_OBJECT(m_videoSink), "contrast", contrast * 10, NULL);
|
||||||
|
emit contrastChanged(contrast);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_contrast = contrast;
|
||||||
|
}
|
||||||
|
|
||||||
|
int QGstreamerVideoOverlay::hue() const
|
||||||
|
{
|
||||||
|
int hue = 0;
|
||||||
|
|
||||||
|
if (m_hasHue)
|
||||||
|
g_object_get(G_OBJECT(m_videoSink), "hue", &hue, NULL);
|
||||||
|
|
||||||
|
return hue / 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QGstreamerVideoOverlay::setHue(int hue)
|
||||||
|
{
|
||||||
|
if (m_hasHue) {
|
||||||
|
g_object_set(G_OBJECT(m_videoSink), "hue", hue * 10, NULL);
|
||||||
|
emit hueChanged(hue);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_hue = hue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int QGstreamerVideoOverlay::saturation() const
|
||||||
|
{
|
||||||
|
int saturation = 0;
|
||||||
|
|
||||||
|
if (m_hasSaturation)
|
||||||
|
g_object_get(G_OBJECT(m_videoSink), "saturation", &saturation, NULL);
|
||||||
|
|
||||||
|
return saturation / 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QGstreamerVideoOverlay::setSaturation(int saturation)
|
||||||
|
{
|
||||||
|
if (m_hasSaturation) {
|
||||||
|
g_object_set(G_OBJECT(m_videoSink), "saturation", saturation * 10, NULL);
|
||||||
|
emit saturationChanged(saturation);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_saturation = saturation;
|
||||||
|
}
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
@@ -32,22 +32,11 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qgstreamervideowidget_p.h"
|
#include "qgstreamervideowidget_p.h"
|
||||||
#include <private/qgstutils_p.h>
|
|
||||||
|
|
||||||
#include <QtCore/qcoreevent.h>
|
#include <QtCore/qcoreevent.h>
|
||||||
#include <QtCore/qdebug.h>
|
#include <QtCore/qdebug.h>
|
||||||
#include <QtWidgets/qapplication.h>
|
|
||||||
#include <QtGui/qpainter.h>
|
#include <QtGui/qpainter.h>
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
#if !GST_CHECK_VERSION(1,0,0)
|
|
||||||
#include <gst/interfaces/xoverlay.h>
|
|
||||||
#include <gst/interfaces/propertyprobe.h>
|
|
||||||
#else
|
|
||||||
#include <gst/video/videooverlay.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class QGstreamerVideoWidget : public QWidget
|
class QGstreamerVideoWidget : public QWidget
|
||||||
@@ -82,167 +71,133 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
void paint_helper()
|
||||||
void paintEvent(QPaintEvent *)
|
|
||||||
{
|
{
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
painter.fillRect(rect(), palette().background());
|
painter.fillRect(rect(), palette().background());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *)
|
||||||
|
{
|
||||||
|
paint_helper();
|
||||||
|
}
|
||||||
|
|
||||||
QSize m_nativeSize;
|
QSize m_nativeSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
QGstreamerVideoWidgetControl::QGstreamerVideoWidgetControl(QObject *parent)
|
QGstreamerVideoWidgetControl::QGstreamerVideoWidgetControl(QObject *parent, const QByteArray &elementName)
|
||||||
: QVideoWidgetControl(parent)
|
: QVideoWidgetControl(parent)
|
||||||
, m_videoSink(0)
|
, m_videoOverlay(this, !elementName.isEmpty() ? elementName : qgetenv("QT_GSTREAMER_WIDGET_VIDEOSINK"))
|
||||||
, m_widget(0)
|
, m_widget(0)
|
||||||
|
, m_stopped(false)
|
||||||
|
, m_windowId(0)
|
||||||
, m_fullScreen(false)
|
, m_fullScreen(false)
|
||||||
{
|
{
|
||||||
// The QWidget needs to have a native X window handle to be able to use xvimagesink.
|
connect(&m_videoOverlay, &QGstreamerVideoOverlay::activeChanged,
|
||||||
// Bail out if Qt is not using xcb (the control will then be ignored by the plugin)
|
this, &QGstreamerVideoWidgetControl::onOverlayActiveChanged);
|
||||||
if (QGuiApplication::platformName().compare(QLatin1String("xcb"), Qt::CaseInsensitive) == 0)
|
connect(&m_videoOverlay, &QGstreamerVideoOverlay::nativeVideoSizeChanged,
|
||||||
m_videoSink = gst_element_factory_make ("xvimagesink", NULL);
|
this, &QGstreamerVideoWidgetControl::onNativeVideoSizeChanged);
|
||||||
|
connect(&m_videoOverlay, &QGstreamerVideoOverlay::brightnessChanged,
|
||||||
if (m_videoSink) {
|
this, &QGstreamerVideoWidgetControl::brightnessChanged);
|
||||||
// Check if the xv sink is usable
|
connect(&m_videoOverlay, &QGstreamerVideoOverlay::contrastChanged,
|
||||||
if (gst_element_set_state(m_videoSink, GST_STATE_READY) != GST_STATE_CHANGE_SUCCESS) {
|
this, &QGstreamerVideoWidgetControl::contrastChanged);
|
||||||
gst_object_unref(GST_OBJECT(m_videoSink));
|
connect(&m_videoOverlay, &QGstreamerVideoOverlay::hueChanged,
|
||||||
m_videoSink = 0;
|
this, &QGstreamerVideoWidgetControl::hueChanged);
|
||||||
} else {
|
connect(&m_videoOverlay, &QGstreamerVideoOverlay::saturationChanged,
|
||||||
gst_element_set_state(m_videoSink, GST_STATE_NULL);
|
this, &QGstreamerVideoWidgetControl::saturationChanged);
|
||||||
g_object_set(G_OBJECT(m_videoSink), "force-aspect-ratio", 1, (const char*)NULL);
|
|
||||||
qt_gst_object_ref_sink(GST_OBJECT (m_videoSink)); //Take ownership
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QGstreamerVideoWidgetControl::~QGstreamerVideoWidgetControl()
|
QGstreamerVideoWidgetControl::~QGstreamerVideoWidgetControl()
|
||||||
{
|
{
|
||||||
if (m_videoSink)
|
|
||||||
gst_object_unref(GST_OBJECT(m_videoSink));
|
|
||||||
|
|
||||||
delete m_widget;
|
delete m_widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGstreamerVideoWidgetControl::createVideoWidget()
|
void QGstreamerVideoWidgetControl::createVideoWidget()
|
||||||
{
|
{
|
||||||
if (!m_videoSink || m_widget)
|
if (m_widget)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_widget = new QGstreamerVideoWidget;
|
m_widget = new QGstreamerVideoWidget;
|
||||||
|
|
||||||
m_widget->installEventFilter(this);
|
m_widget->installEventFilter(this);
|
||||||
m_windowId = m_widget->winId();
|
m_videoOverlay.setWindowHandle(m_windowId = m_widget->winId());
|
||||||
}
|
}
|
||||||
|
|
||||||
GstElement *QGstreamerVideoWidgetControl::videoSink()
|
GstElement *QGstreamerVideoWidgetControl::videoSink()
|
||||||
{
|
{
|
||||||
return m_videoSink;
|
return m_videoOverlay.videoSink();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QGstreamerVideoWidgetControl::onOverlayActiveChanged()
|
||||||
|
{
|
||||||
|
updateWidgetAttributes();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QGstreamerVideoWidgetControl::stopRenderer()
|
||||||
|
{
|
||||||
|
m_stopped = true;
|
||||||
|
updateWidgetAttributes();
|
||||||
|
m_widget->setNativeSize(QSize());
|
||||||
|
}
|
||||||
|
|
||||||
|
void QGstreamerVideoWidgetControl::onNativeVideoSizeChanged()
|
||||||
|
{
|
||||||
|
const QSize &size = m_videoOverlay.nativeVideoSize();
|
||||||
|
|
||||||
|
if (size.isValid())
|
||||||
|
m_stopped = false;
|
||||||
|
|
||||||
|
if (m_widget)
|
||||||
|
m_widget->setNativeSize(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QGstreamerVideoWidgetControl::eventFilter(QObject *object, QEvent *e)
|
bool QGstreamerVideoWidgetControl::eventFilter(QObject *object, QEvent *e)
|
||||||
{
|
{
|
||||||
if (m_widget && object == m_widget) {
|
if (m_widget && object == m_widget) {
|
||||||
if (e->type() == QEvent::ParentChange || e->type() == QEvent::Show) {
|
if (e->type() == QEvent::ParentChange || e->type() == QEvent::Show || e->type() == QEvent::WinIdChange) {
|
||||||
WId newWId = m_widget->winId();
|
WId newWId = m_widget->winId();
|
||||||
if (newWId != m_windowId) {
|
if (newWId != m_windowId)
|
||||||
m_windowId = newWId;
|
m_videoOverlay.setWindowHandle(m_windowId = newWId);
|
||||||
setOverlay();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e->type() == QEvent::Show) {
|
if (e->type() == QEvent::Paint) {
|
||||||
// Setting these values ensures smooth resizing since it
|
if (m_videoOverlay.isActive())
|
||||||
// will prevent the system from clearing the background
|
m_videoOverlay.expose(); // triggers a repaint of the last frame
|
||||||
m_widget->setAttribute(Qt::WA_NoSystemBackground, true);
|
else
|
||||||
} else if (e->type() == QEvent::Resize) {
|
m_widget->paint_helper(); // paints the black background
|
||||||
// This is a workaround for missing background repaints
|
|
||||||
// when reducing window size
|
return true;
|
||||||
windowExposed();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QGstreamerVideoWidgetControl::updateWidgetAttributes()
|
||||||
|
{
|
||||||
|
// When frames are being rendered (sink is active), we need the WA_PaintOnScreen attribute to
|
||||||
|
// be set in order to avoid flickering when the widget is repainted (for example when resized).
|
||||||
|
// We need to clear that flag when the the sink is inactive to allow the widget to paint its
|
||||||
|
// background, otherwise some garbage will be displayed.
|
||||||
|
if (m_videoOverlay.isActive() && !m_stopped) {
|
||||||
|
m_widget->setAttribute(Qt::WA_NoSystemBackground, true);
|
||||||
|
m_widget->setAttribute(Qt::WA_PaintOnScreen, true);
|
||||||
|
} else {
|
||||||
|
m_widget->setAttribute(Qt::WA_NoSystemBackground, false);
|
||||||
|
m_widget->setAttribute(Qt::WA_PaintOnScreen, false);
|
||||||
|
m_widget->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool QGstreamerVideoWidgetControl::processSyncMessage(const QGstreamerMessage &message)
|
bool QGstreamerVideoWidgetControl::processSyncMessage(const QGstreamerMessage &message)
|
||||||
{
|
{
|
||||||
GstMessage* gm = message.rawMessage();
|
return m_videoOverlay.processSyncMessage(message);
|
||||||
|
|
||||||
#if !GST_CHECK_VERSION(1,0,0)
|
|
||||||
if (gm && (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) &&
|
|
||||||
gst_structure_has_name(gm->structure, "prepare-xwindow-id")) {
|
|
||||||
#else
|
|
||||||
if (gm && (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) &&
|
|
||||||
gst_structure_has_name(gst_message_get_structure(gm), "prepare-window-handle")) {
|
|
||||||
#endif
|
|
||||||
setOverlay();
|
|
||||||
QMetaObject::invokeMethod(this, "updateNativeVideoSize", Qt::QueuedConnection);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QGstreamerVideoWidgetControl::processBusMessage(const QGstreamerMessage &message)
|
bool QGstreamerVideoWidgetControl::processBusMessage(const QGstreamerMessage &message)
|
||||||
{
|
{
|
||||||
GstMessage* gm = message.rawMessage();
|
return m_videoOverlay.processBusMessage(message);
|
||||||
|
|
||||||
if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_STATE_CHANGED &&
|
|
||||||
GST_MESSAGE_SRC(gm) == GST_OBJECT_CAST(m_videoSink)) {
|
|
||||||
GstState oldState;
|
|
||||||
GstState newState;
|
|
||||||
gst_message_parse_state_changed(gm, &oldState, &newState, 0);
|
|
||||||
|
|
||||||
if (oldState == GST_STATE_READY && newState == GST_STATE_PAUSED)
|
|
||||||
updateNativeVideoSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QGstreamerVideoWidgetControl::setOverlay()
|
|
||||||
{
|
|
||||||
#if !GST_CHECK_VERSION(1,0,0)
|
|
||||||
if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
|
|
||||||
gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(m_videoSink), m_windowId);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (m_videoSink && GST_IS_VIDEO_OVERLAY(m_videoSink)) {
|
|
||||||
gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(m_videoSink), m_windowId);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void QGstreamerVideoWidgetControl::updateNativeVideoSize()
|
|
||||||
{
|
|
||||||
if (m_videoSink) {
|
|
||||||
//find video native size to update video widget size hint
|
|
||||||
GstPad *pad = gst_element_get_static_pad(m_videoSink, "sink");
|
|
||||||
GstCaps *caps = qt_gst_pad_get_current_caps(pad);
|
|
||||||
|
|
||||||
gst_object_unref(GST_OBJECT(pad));
|
|
||||||
|
|
||||||
if (caps) {
|
|
||||||
m_widget->setNativeSize(QGstUtils::capsCorrectedResolution(caps));
|
|
||||||
gst_caps_unref(caps);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (m_widget)
|
|
||||||
m_widget->setNativeSize(QSize());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void QGstreamerVideoWidgetControl::windowExposed()
|
|
||||||
{
|
|
||||||
#if !GST_CHECK_VERSION(1,0,0)
|
|
||||||
if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink))
|
|
||||||
gst_x_overlay_expose(GST_X_OVERLAY(m_videoSink));
|
|
||||||
#else
|
|
||||||
if (m_videoSink && GST_IS_VIDEO_OVERLAY(m_videoSink))
|
|
||||||
gst_video_overlay_expose(GST_VIDEO_OVERLAY(m_videoSink));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *QGstreamerVideoWidgetControl::videoWidget()
|
QWidget *QGstreamerVideoWidgetControl::videoWidget()
|
||||||
@@ -253,19 +208,12 @@ QWidget *QGstreamerVideoWidgetControl::videoWidget()
|
|||||||
|
|
||||||
Qt::AspectRatioMode QGstreamerVideoWidgetControl::aspectRatioMode() const
|
Qt::AspectRatioMode QGstreamerVideoWidgetControl::aspectRatioMode() const
|
||||||
{
|
{
|
||||||
return m_aspectRatioMode;
|
return m_videoOverlay.aspectRatioMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGstreamerVideoWidgetControl::setAspectRatioMode(Qt::AspectRatioMode mode)
|
void QGstreamerVideoWidgetControl::setAspectRatioMode(Qt::AspectRatioMode mode)
|
||||||
{
|
{
|
||||||
if (m_videoSink) {
|
m_videoOverlay.setAspectRatioMode(mode);
|
||||||
g_object_set(G_OBJECT(m_videoSink),
|
|
||||||
"force-aspect-ratio",
|
|
||||||
(mode == Qt::KeepAspectRatio),
|
|
||||||
(const char*)NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_aspectRatioMode = mode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QGstreamerVideoWidgetControl::isFullScreen() const
|
bool QGstreamerVideoWidgetControl::isFullScreen() const
|
||||||
@@ -280,78 +228,42 @@ void QGstreamerVideoWidgetControl::setFullScreen(bool fullScreen)
|
|||||||
|
|
||||||
int QGstreamerVideoWidgetControl::brightness() const
|
int QGstreamerVideoWidgetControl::brightness() const
|
||||||
{
|
{
|
||||||
int brightness = 0;
|
return m_videoOverlay.brightness();
|
||||||
|
|
||||||
if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "brightness"))
|
|
||||||
g_object_get(G_OBJECT(m_videoSink), "brightness", &brightness, NULL);
|
|
||||||
|
|
||||||
return brightness / 10;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGstreamerVideoWidgetControl::setBrightness(int brightness)
|
void QGstreamerVideoWidgetControl::setBrightness(int brightness)
|
||||||
{
|
{
|
||||||
if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "brightness")) {
|
m_videoOverlay.setBrightness(brightness);
|
||||||
g_object_set(G_OBJECT(m_videoSink), "brightness", brightness * 10, NULL);
|
|
||||||
|
|
||||||
emit brightnessChanged(brightness);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int QGstreamerVideoWidgetControl::contrast() const
|
int QGstreamerVideoWidgetControl::contrast() const
|
||||||
{
|
{
|
||||||
int contrast = 0;
|
return m_videoOverlay.contrast();
|
||||||
|
|
||||||
if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "contrast"))
|
|
||||||
g_object_get(G_OBJECT(m_videoSink), "contrast", &contrast, NULL);
|
|
||||||
|
|
||||||
return contrast / 10;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGstreamerVideoWidgetControl::setContrast(int contrast)
|
void QGstreamerVideoWidgetControl::setContrast(int contrast)
|
||||||
{
|
{
|
||||||
if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "contrast")) {
|
m_videoOverlay.setContrast(contrast);
|
||||||
g_object_set(G_OBJECT(m_videoSink), "contrast", contrast * 10, NULL);
|
|
||||||
|
|
||||||
emit contrastChanged(contrast);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int QGstreamerVideoWidgetControl::hue() const
|
int QGstreamerVideoWidgetControl::hue() const
|
||||||
{
|
{
|
||||||
int hue = 0;
|
return m_videoOverlay.hue();
|
||||||
|
|
||||||
if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "hue"))
|
|
||||||
g_object_get(G_OBJECT(m_videoSink), "hue", &hue, NULL);
|
|
||||||
|
|
||||||
return hue / 10;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGstreamerVideoWidgetControl::setHue(int hue)
|
void QGstreamerVideoWidgetControl::setHue(int hue)
|
||||||
{
|
{
|
||||||
if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "hue")) {
|
m_videoOverlay.setHue(hue);
|
||||||
g_object_set(G_OBJECT(m_videoSink), "hue", hue * 10, NULL);
|
|
||||||
|
|
||||||
emit hueChanged(hue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int QGstreamerVideoWidgetControl::saturation() const
|
int QGstreamerVideoWidgetControl::saturation() const
|
||||||
{
|
{
|
||||||
int saturation = 0;
|
return m_videoOverlay.saturation();
|
||||||
|
|
||||||
if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "saturation"))
|
|
||||||
g_object_get(G_OBJECT(m_videoSink), "saturation", &saturation, NULL);
|
|
||||||
|
|
||||||
return saturation / 10;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGstreamerVideoWidgetControl::setSaturation(int saturation)
|
void QGstreamerVideoWidgetControl::setSaturation(int saturation)
|
||||||
{
|
{
|
||||||
if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "saturation")) {
|
m_videoOverlay.setSaturation(saturation);
|
||||||
g_object_set(G_OBJECT(m_videoSink), "saturation", saturation * 10, NULL);
|
|
||||||
|
|
||||||
emit saturationChanged(saturation);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|||||||
@@ -35,52 +35,33 @@
|
|||||||
#include <private/qgstutils_p.h>
|
#include <private/qgstutils_p.h>
|
||||||
|
|
||||||
#include <QtCore/qdebug.h>
|
#include <QtCore/qdebug.h>
|
||||||
#include <QtGui/qguiapplication.h>
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
QGstreamerVideoWindow::QGstreamerVideoWindow(QObject *parent, const QByteArray &elementName)
|
||||||
|
|
||||||
#if !GST_CHECK_VERSION(1,0,0)
|
|
||||||
#include <gst/interfaces/xoverlay.h>
|
|
||||||
#include <gst/interfaces/propertyprobe.h>
|
|
||||||
#else
|
|
||||||
#include <gst/video/videooverlay.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
QGstreamerVideoWindow::QGstreamerVideoWindow(QObject *parent, const char *elementName)
|
|
||||||
: QVideoWindowControl(parent)
|
: QVideoWindowControl(parent)
|
||||||
, QGstreamerBufferProbe(QGstreamerBufferProbe::ProbeCaps)
|
, m_videoOverlay(this, !elementName.isEmpty() ? elementName : qgetenv("QT_GSTREAMER_WINDOW_VIDEOSINK"))
|
||||||
, m_videoSink(0)
|
|
||||||
, m_windowId(0)
|
, m_windowId(0)
|
||||||
, m_aspectRatioMode(Qt::KeepAspectRatio)
|
|
||||||
, m_fullScreen(false)
|
, m_fullScreen(false)
|
||||||
, m_colorKey(QColor::Invalid)
|
, m_colorKey(QColor::Invalid)
|
||||||
{
|
{
|
||||||
if (elementName) {
|
connect(&m_videoOverlay, &QGstreamerVideoOverlay::nativeVideoSizeChanged,
|
||||||
m_videoSink = gst_element_factory_make(elementName, NULL);
|
this, &QGstreamerVideoWindow::nativeSizeChanged);
|
||||||
} else if (QGuiApplication::platformName().compare(QLatin1String("xcb"), Qt::CaseInsensitive) == 0) {
|
connect(&m_videoOverlay, &QGstreamerVideoOverlay::brightnessChanged,
|
||||||
// We need a native X window handle to be able to use xvimagesink.
|
this, &QGstreamerVideoWindow::brightnessChanged);
|
||||||
// Bail out if Qt is not using xcb (the control will then be ignored by the plugin)
|
connect(&m_videoOverlay, &QGstreamerVideoOverlay::contrastChanged,
|
||||||
m_videoSink = gst_element_factory_make("xvimagesink", NULL);
|
this, &QGstreamerVideoWindow::contrastChanged);
|
||||||
}
|
connect(&m_videoOverlay, &QGstreamerVideoOverlay::hueChanged,
|
||||||
|
this, &QGstreamerVideoWindow::hueChanged);
|
||||||
if (m_videoSink) {
|
connect(&m_videoOverlay, &QGstreamerVideoOverlay::saturationChanged,
|
||||||
qt_gst_object_ref_sink(GST_OBJECT(m_videoSink)); //Take ownership
|
this, &QGstreamerVideoWindow::saturationChanged);
|
||||||
|
|
||||||
GstPad *pad = gst_element_get_static_pad(m_videoSink, "sink");
|
|
||||||
addProbeToPad(pad);
|
|
||||||
gst_object_unref(GST_OBJECT(pad));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QGstreamerVideoWindow::~QGstreamerVideoWindow()
|
QGstreamerVideoWindow::~QGstreamerVideoWindow()
|
||||||
{
|
{
|
||||||
if (m_videoSink) {
|
}
|
||||||
GstPad *pad = gst_element_get_static_pad(m_videoSink,"sink");
|
|
||||||
removeProbeFromPad(pad);
|
GstElement *QGstreamerVideoWindow::videoSink()
|
||||||
gst_object_unref(GST_OBJECT(pad));
|
{
|
||||||
gst_object_unref(GST_OBJECT(m_videoSink));
|
return m_videoOverlay.videoSink();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WId QGstreamerVideoWindow::winId() const
|
WId QGstreamerVideoWindow::winId() const
|
||||||
@@ -94,17 +75,8 @@ void QGstreamerVideoWindow::setWinId(WId id)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
WId oldId = m_windowId;
|
WId oldId = m_windowId;
|
||||||
|
m_videoOverlay.setWindowHandle(m_windowId = id);
|
||||||
|
|
||||||
m_windowId = id;
|
|
||||||
#if GST_CHECK_VERSION(1,0,0)
|
|
||||||
if (m_videoSink && GST_IS_VIDEO_OVERLAY(m_videoSink)) {
|
|
||||||
gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(m_videoSink), m_windowId);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
|
|
||||||
gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(m_videoSink), m_windowId);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (!oldId)
|
if (!oldId)
|
||||||
emit readyChanged(true);
|
emit readyChanged(true);
|
||||||
|
|
||||||
@@ -114,28 +86,12 @@ void QGstreamerVideoWindow::setWinId(WId id)
|
|||||||
|
|
||||||
bool QGstreamerVideoWindow::processSyncMessage(const QGstreamerMessage &message)
|
bool QGstreamerVideoWindow::processSyncMessage(const QGstreamerMessage &message)
|
||||||
{
|
{
|
||||||
GstMessage* gm = message.rawMessage();
|
return m_videoOverlay.processSyncMessage(message);
|
||||||
#if GST_CHECK_VERSION(1,0,0)
|
}
|
||||||
const GstStructure *s = gst_message_get_structure(gm);
|
|
||||||
if ((GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) &&
|
|
||||||
gst_structure_has_name(s, "prepare-window-handle") &&
|
|
||||||
m_videoSink && GST_IS_VIDEO_OVERLAY(m_videoSink)) {
|
|
||||||
|
|
||||||
gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(m_videoSink), m_windowId);
|
bool QGstreamerVideoWindow::processBusMessage(const QGstreamerMessage &message)
|
||||||
|
{
|
||||||
return true;
|
return m_videoOverlay.processBusMessage(message);
|
||||||
}
|
|
||||||
#else
|
|
||||||
if ((GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) &&
|
|
||||||
gst_structure_has_name(gm->structure, "prepare-xwindow-id") &&
|
|
||||||
m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
|
|
||||||
|
|
||||||
gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(m_videoSink), m_windowId);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect QGstreamerVideoWindow::displayRect() const
|
QRect QGstreamerVideoWindow::displayRect() const
|
||||||
@@ -145,188 +101,63 @@ QRect QGstreamerVideoWindow::displayRect() const
|
|||||||
|
|
||||||
void QGstreamerVideoWindow::setDisplayRect(const QRect &rect)
|
void QGstreamerVideoWindow::setDisplayRect(const QRect &rect)
|
||||||
{
|
{
|
||||||
m_displayRect = rect;
|
m_videoOverlay.setRenderRectangle(m_displayRect = rect);
|
||||||
#if GST_CHECK_VERSION(1,0,0)
|
repaint();
|
||||||
if (m_videoSink && GST_IS_VIDEO_OVERLAY(m_videoSink)) {
|
|
||||||
if (m_displayRect.isEmpty())
|
|
||||||
gst_video_overlay_set_render_rectangle(GST_VIDEO_OVERLAY(m_videoSink), -1, -1, -1, -1);
|
|
||||||
else
|
|
||||||
gst_video_overlay_set_render_rectangle(GST_VIDEO_OVERLAY(m_videoSink),
|
|
||||||
m_displayRect.x(),
|
|
||||||
m_displayRect.y(),
|
|
||||||
m_displayRect.width(),
|
|
||||||
m_displayRect.height());
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
|
|
||||||
#if GST_VERSION_MICRO >= 29
|
|
||||||
if (m_displayRect.isEmpty())
|
|
||||||
gst_x_overlay_set_render_rectangle(GST_X_OVERLAY(m_videoSink), -1, -1, -1, -1);
|
|
||||||
else
|
|
||||||
gst_x_overlay_set_render_rectangle(GST_X_OVERLAY(m_videoSink),
|
|
||||||
m_displayRect.x(),
|
|
||||||
m_displayRect.y(),
|
|
||||||
m_displayRect.width(),
|
|
||||||
m_displayRect.height());
|
|
||||||
repaint();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::AspectRatioMode QGstreamerVideoWindow::aspectRatioMode() const
|
Qt::AspectRatioMode QGstreamerVideoWindow::aspectRatioMode() const
|
||||||
{
|
{
|
||||||
return m_aspectRatioMode;
|
return m_videoOverlay.aspectRatioMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGstreamerVideoWindow::setAspectRatioMode(Qt::AspectRatioMode mode)
|
void QGstreamerVideoWindow::setAspectRatioMode(Qt::AspectRatioMode mode)
|
||||||
{
|
{
|
||||||
m_aspectRatioMode = mode;
|
m_videoOverlay.setAspectRatioMode(mode);
|
||||||
|
|
||||||
if (m_videoSink) {
|
|
||||||
g_object_set(G_OBJECT(m_videoSink),
|
|
||||||
"force-aspect-ratio",
|
|
||||||
(m_aspectRatioMode == Qt::KeepAspectRatio),
|
|
||||||
(const char*)NULL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGstreamerVideoWindow::repaint()
|
void QGstreamerVideoWindow::repaint()
|
||||||
{
|
{
|
||||||
#if GST_CHECK_VERSION(1,0,0)
|
m_videoOverlay.expose();
|
||||||
if (m_videoSink && GST_IS_VIDEO_OVERLAY(m_videoSink)) {
|
|
||||||
//don't call gst_x_overlay_expose if the sink is in null state
|
|
||||||
GstState state = GST_STATE_NULL;
|
|
||||||
GstStateChangeReturn res = gst_element_get_state(m_videoSink, &state, NULL, 1000000);
|
|
||||||
if (res != GST_STATE_CHANGE_FAILURE && state != GST_STATE_NULL) {
|
|
||||||
gst_video_overlay_expose(GST_VIDEO_OVERLAY(m_videoSink));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
|
|
||||||
//don't call gst_x_overlay_expose if the sink is in null state
|
|
||||||
GstState state = GST_STATE_NULL;
|
|
||||||
GstStateChangeReturn res = gst_element_get_state(m_videoSink, &state, NULL, 1000000);
|
|
||||||
if (res != GST_STATE_CHANGE_FAILURE && state != GST_STATE_NULL) {
|
|
||||||
gst_x_overlay_expose(GST_X_OVERLAY(m_videoSink));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
QColor QGstreamerVideoWindow::colorKey() const
|
|
||||||
{
|
|
||||||
if (!m_colorKey.isValid()) {
|
|
||||||
gint colorkey = 0;
|
|
||||||
if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "colorkey"))
|
|
||||||
g_object_get(G_OBJECT(m_videoSink), "colorkey", &colorkey, NULL);
|
|
||||||
|
|
||||||
if (colorkey > 0)
|
|
||||||
m_colorKey.setRgb(colorkey);
|
|
||||||
}
|
|
||||||
|
|
||||||
return m_colorKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QGstreamerVideoWindow::setColorKey(const QColor &color)
|
|
||||||
{
|
|
||||||
m_colorKey = color;
|
|
||||||
|
|
||||||
if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "colorkey"))
|
|
||||||
g_object_set(G_OBJECT(m_videoSink), "colorkey", color.rgba(), NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QGstreamerVideoWindow::autopaintColorKey() const
|
|
||||||
{
|
|
||||||
bool enabled = true;
|
|
||||||
|
|
||||||
if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "autopaint-colorkey"))
|
|
||||||
g_object_get(G_OBJECT(m_videoSink), "autopaint-colorkey", &enabled, NULL);
|
|
||||||
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QGstreamerVideoWindow::setAutopaintColorKey(bool enabled)
|
|
||||||
{
|
|
||||||
if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "autopaint-colorkey"))
|
|
||||||
g_object_set(G_OBJECT(m_videoSink), "autopaint-colorkey", enabled, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int QGstreamerVideoWindow::brightness() const
|
int QGstreamerVideoWindow::brightness() const
|
||||||
{
|
{
|
||||||
int brightness = 0;
|
return m_videoOverlay.brightness();
|
||||||
|
|
||||||
if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "brightness"))
|
|
||||||
g_object_get(G_OBJECT(m_videoSink), "brightness", &brightness, NULL);
|
|
||||||
|
|
||||||
return brightness / 10;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGstreamerVideoWindow::setBrightness(int brightness)
|
void QGstreamerVideoWindow::setBrightness(int brightness)
|
||||||
{
|
{
|
||||||
if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "brightness")) {
|
m_videoOverlay.setBrightness(brightness);
|
||||||
g_object_set(G_OBJECT(m_videoSink), "brightness", brightness * 10, NULL);
|
|
||||||
|
|
||||||
emit brightnessChanged(brightness);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int QGstreamerVideoWindow::contrast() const
|
int QGstreamerVideoWindow::contrast() const
|
||||||
{
|
{
|
||||||
int contrast = 0;
|
return m_videoOverlay.contrast();
|
||||||
|
|
||||||
if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "contrast"))
|
|
||||||
g_object_get(G_OBJECT(m_videoSink), "contrast", &contrast, NULL);
|
|
||||||
|
|
||||||
return contrast / 10;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGstreamerVideoWindow::setContrast(int contrast)
|
void QGstreamerVideoWindow::setContrast(int contrast)
|
||||||
{
|
{
|
||||||
if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "contrast")) {
|
m_videoOverlay.setContrast(contrast);
|
||||||
g_object_set(G_OBJECT(m_videoSink), "contrast", contrast * 10, NULL);
|
|
||||||
|
|
||||||
emit contrastChanged(contrast);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int QGstreamerVideoWindow::hue() const
|
int QGstreamerVideoWindow::hue() const
|
||||||
{
|
{
|
||||||
int hue = 0;
|
return m_videoOverlay.hue();
|
||||||
|
|
||||||
if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "hue"))
|
|
||||||
g_object_get(G_OBJECT(m_videoSink), "hue", &hue, NULL);
|
|
||||||
|
|
||||||
return hue / 10;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGstreamerVideoWindow::setHue(int hue)
|
void QGstreamerVideoWindow::setHue(int hue)
|
||||||
{
|
{
|
||||||
if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "hue")) {
|
m_videoOverlay.setHue(hue);
|
||||||
g_object_set(G_OBJECT(m_videoSink), "hue", hue * 10, NULL);
|
|
||||||
|
|
||||||
emit hueChanged(hue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int QGstreamerVideoWindow::saturation() const
|
int QGstreamerVideoWindow::saturation() const
|
||||||
{
|
{
|
||||||
int saturation = 0;
|
return m_videoOverlay.saturation();
|
||||||
|
|
||||||
if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "saturation"))
|
|
||||||
g_object_get(G_OBJECT(m_videoSink), "saturation", &saturation, NULL);
|
|
||||||
|
|
||||||
return saturation / 10;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGstreamerVideoWindow::setSaturation(int saturation)
|
void QGstreamerVideoWindow::setSaturation(int saturation)
|
||||||
{
|
{
|
||||||
if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "saturation")) {
|
m_videoOverlay.setSaturation(saturation);
|
||||||
g_object_set(G_OBJECT(m_videoSink), "saturation", saturation * 10, NULL);
|
|
||||||
|
|
||||||
emit saturationChanged(saturation);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QGstreamerVideoWindow::isFullScreen() const
|
bool QGstreamerVideoWindow::isFullScreen() const
|
||||||
@@ -341,28 +172,5 @@ void QGstreamerVideoWindow::setFullScreen(bool fullScreen)
|
|||||||
|
|
||||||
QSize QGstreamerVideoWindow::nativeSize() const
|
QSize QGstreamerVideoWindow::nativeSize() const
|
||||||
{
|
{
|
||||||
return m_nativeSize;
|
return m_videoOverlay.nativeVideoSize();
|
||||||
}
|
|
||||||
|
|
||||||
void QGstreamerVideoWindow::probeCaps(GstCaps *caps)
|
|
||||||
{
|
|
||||||
QSize resolution = QGstUtils::capsCorrectedResolution(caps);
|
|
||||||
QMetaObject::invokeMethod(
|
|
||||||
this,
|
|
||||||
"updateNativeVideoSize",
|
|
||||||
Qt::QueuedConnection,
|
|
||||||
Q_ARG(QSize, resolution));
|
|
||||||
}
|
|
||||||
|
|
||||||
void QGstreamerVideoWindow::updateNativeVideoSize(const QSize &size)
|
|
||||||
{
|
|
||||||
if (m_nativeSize != size) {
|
|
||||||
m_nativeSize = size;
|
|
||||||
emit nativeSizeChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GstElement *QGstreamerVideoWindow::videoSink()
|
|
||||||
{
|
|
||||||
return m_videoSink;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1453,6 +1453,17 @@ GstCaps *qt_gst_caps_normalize(GstCaps *caps)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const gchar *qt_gst_element_get_factory_name(GstElement *element)
|
||||||
|
{
|
||||||
|
const gchar *name = 0;
|
||||||
|
const GstElementFactory *factory = 0;
|
||||||
|
|
||||||
|
if (element && (factory = gst_element_get_factory(element)))
|
||||||
|
name = gst_plugin_feature_get_name(GST_PLUGIN_FEATURE(factory));
|
||||||
|
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
QDebug operator <<(QDebug debug, GstCaps *caps)
|
QDebug operator <<(QDebug debug, GstCaps *caps)
|
||||||
{
|
{
|
||||||
if (caps) {
|
if (caps) {
|
||||||
|
|||||||
@@ -48,9 +48,6 @@ import QtMultimedia 5.6
|
|||||||
types.
|
types.
|
||||||
|
|
||||||
\qml
|
\qml
|
||||||
import QtQuick 2.0
|
|
||||||
import QtMultimedia 5.0
|
|
||||||
|
|
||||||
Video {
|
Video {
|
||||||
id: video
|
id: video
|
||||||
width : 800
|
width : 800
|
||||||
@@ -239,7 +236,15 @@ Item {
|
|||||||
*/
|
*/
|
||||||
property alias hasVideo: player.hasVideo
|
property alias hasVideo: player.hasVideo
|
||||||
|
|
||||||
/* documented below due to length of metaData documentation */
|
/*!
|
||||||
|
\qmlproperty object Video::metaData
|
||||||
|
|
||||||
|
This property holds the meta data for the current media.
|
||||||
|
|
||||||
|
See \l{MediaPlayer::metaData}{MediaPlayer.metaData} for details about each meta data key.
|
||||||
|
|
||||||
|
\sa {QMediaMetaData}
|
||||||
|
*/
|
||||||
property alias metaData: player.metaData
|
property alias metaData: player.metaData
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -457,540 +462,3 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************
|
|
||||||
// Documentation for meta-data properties.
|
|
||||||
// ***************************************
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData
|
|
||||||
|
|
||||||
This property holds a collection of all the meta-data for the media.
|
|
||||||
|
|
||||||
You can access individual properties like \l {Video::metaData.title}{metaData.title}
|
|
||||||
or \l {Video::metaData.trackNumber} {metaData.trackNumber}.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.title
|
|
||||||
|
|
||||||
This property holds the title of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.subTitle
|
|
||||||
|
|
||||||
This property holds the sub-title of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.author
|
|
||||||
|
|
||||||
This property holds the author of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.comment
|
|
||||||
|
|
||||||
This property holds a user comment about the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.description
|
|
||||||
|
|
||||||
This property holds a description of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.category
|
|
||||||
|
|
||||||
This property holds the category of the media
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.genre
|
|
||||||
|
|
||||||
This property holds the genre of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.year
|
|
||||||
|
|
||||||
This property holds the year of release of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.date
|
|
||||||
|
|
||||||
This property holds the date of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.userRating
|
|
||||||
|
|
||||||
This property holds a user rating of the media in the range of 0 to 100.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.keywords
|
|
||||||
|
|
||||||
This property holds a list of keywords describing the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.language
|
|
||||||
|
|
||||||
This property holds the language of the media, as an ISO 639-2 code.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.publisher
|
|
||||||
|
|
||||||
This property holds the publisher of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.copyright
|
|
||||||
|
|
||||||
This property holds the media's copyright notice.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.parentalRating
|
|
||||||
|
|
||||||
This property holds the parental rating of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.ratingOrganization
|
|
||||||
|
|
||||||
This property holds the name of the rating organization responsible for the
|
|
||||||
parental rating of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.size
|
|
||||||
|
|
||||||
This property property holds the size of the media in bytes.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.mediaType
|
|
||||||
|
|
||||||
This property holds the type of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.audioBitRate
|
|
||||||
|
|
||||||
This property holds the bit rate of the media's audio stream in bits per
|
|
||||||
second.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.audioCodec
|
|
||||||
|
|
||||||
This property holds the encoding of the media audio stream.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.averageLevel
|
|
||||||
|
|
||||||
This property holds the average volume level of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.channelCount
|
|
||||||
|
|
||||||
This property holds the number of channels in the media's audio stream.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.peakValue
|
|
||||||
|
|
||||||
This property holds the peak volume of the media's audio stream.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.sampleRate
|
|
||||||
|
|
||||||
This property holds the sample rate of the media's audio stream in Hertz.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.albumTitle
|
|
||||||
|
|
||||||
This property holds the title of the album the media belongs to.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.albumArtist
|
|
||||||
|
|
||||||
This property holds the name of the principal artist of the album the media
|
|
||||||
belongs to.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.contributingArtist
|
|
||||||
|
|
||||||
This property holds the names of artists contributing to the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.composer
|
|
||||||
|
|
||||||
This property holds the composer of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.conductor
|
|
||||||
|
|
||||||
This property holds the conductor of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.lyrics
|
|
||||||
|
|
||||||
This property holds the lyrics to the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.mood
|
|
||||||
|
|
||||||
This property holds the mood of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.trackNumber
|
|
||||||
|
|
||||||
This property holds the track number of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.trackCount
|
|
||||||
|
|
||||||
This property holds the number of track on the album containing the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.coverArtUrlSmall
|
|
||||||
|
|
||||||
This property holds the URL of a small cover art image.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.coverArtUrlLarge
|
|
||||||
|
|
||||||
This property holds the URL of a large cover art image.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.resolution
|
|
||||||
|
|
||||||
This property holds the dimension of an image or video.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.pixelAspectRatio
|
|
||||||
|
|
||||||
This property holds the pixel aspect ratio of an image or video.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.videoFrameRate
|
|
||||||
|
|
||||||
This property holds the frame rate of the media's video stream.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.videoBitRate
|
|
||||||
|
|
||||||
This property holds the bit rate of the media's video stream in bits per
|
|
||||||
second.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.videoCodec
|
|
||||||
|
|
||||||
This property holds the encoding of the media's video stream.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.posterUrl
|
|
||||||
|
|
||||||
This property holds the URL of a poster image.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.chapterNumber
|
|
||||||
|
|
||||||
This property holds the chapter number of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.director
|
|
||||||
|
|
||||||
This property holds the director of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.leadPerformer
|
|
||||||
|
|
||||||
This property holds the lead performer in the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.writer
|
|
||||||
|
|
||||||
This property holds the writer of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// The remaining properties are related to photos, and are technically
|
|
||||||
// available but will certainly never have values.
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.cameraManufacturer
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.cameraModel
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.event
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.subject
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.orientation
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.exposureTime
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.fNumber
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.exposureProgram
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.isoSpeedRatings
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.exposureBiasValue
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.dateTimeDigitized
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.subjectDistance
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.meteringMode
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.lightSource
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.flash
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.focalLength
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.exposureMode
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.whiteBalance
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.DigitalZoomRatio
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.focalLengthIn35mmFilm
|
|
||||||
|
|
||||||
\sa {QMediaMetaData::FocalLengthIn35mmFile}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.sceneCaptureType
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.gainControl
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.contrast
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.saturation
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.sharpness
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant Video::metaData.deviceSettingDescription
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
@@ -59,12 +59,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
\ingroup multimedia_qml
|
\ingroup multimedia_qml
|
||||||
\ingroup multimedia_audio_qml
|
\ingroup multimedia_audio_qml
|
||||||
|
|
||||||
This type is part of the \b{QtMultimedia 5.0} module.
|
|
||||||
|
|
||||||
\qml
|
\qml
|
||||||
import QtQuick 2.0
|
|
||||||
import QtMultimedia 5.0
|
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: "Click Me!";
|
text: "Click Me!";
|
||||||
font.pointSize: 24;
|
font.pointSize: 24;
|
||||||
@@ -919,369 +914,124 @@ void QDeclarativeAudio::_q_mediaChanged(const QMediaContent &media)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
\qmlproperty variant QtMultimedia::Audio::mediaObject
|
||||||
|
|
||||||
|
This property holds the native media object.
|
||||||
|
|
||||||
|
It can be used to get a pointer to a QMediaPlayer object in order to integrate with C++ code.
|
||||||
|
|
||||||
|
\code
|
||||||
|
QObject *qmlAudio; // The QML Audio object
|
||||||
|
QMediaPlayer *player = qvariant_cast<QMediaPlayer *>(qmlAudio->property("mediaObject"));
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
\note This property is not accessible from QML.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\qmlpropertygroup QtMultimedia::Audio::metaData
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.title
|
\qmlproperty variant QtMultimedia::Audio::metaData.title
|
||||||
|
|
||||||
This property holds the title of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.subTitle
|
\qmlproperty variant QtMultimedia::Audio::metaData.subTitle
|
||||||
|
|
||||||
This property holds the sub-title of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.author
|
\qmlproperty variant QtMultimedia::Audio::metaData.author
|
||||||
|
|
||||||
This property holds the author of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.comment
|
\qmlproperty variant QtMultimedia::Audio::metaData.comment
|
||||||
|
|
||||||
This property holds a user comment about the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.description
|
\qmlproperty variant QtMultimedia::Audio::metaData.description
|
||||||
|
|
||||||
This property holds a description of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.category
|
\qmlproperty variant QtMultimedia::Audio::metaData.category
|
||||||
|
|
||||||
This property holds the category of the media
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.genre
|
\qmlproperty variant QtMultimedia::Audio::metaData.genre
|
||||||
|
|
||||||
This property holds the genre of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.year
|
\qmlproperty variant QtMultimedia::Audio::metaData.year
|
||||||
|
|
||||||
This property holds the year of release of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.date
|
\qmlproperty variant QtMultimedia::Audio::metaData.date
|
||||||
|
|
||||||
This property holds the date of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.userRating
|
\qmlproperty variant QtMultimedia::Audio::metaData.userRating
|
||||||
|
|
||||||
This property holds a user rating of the media in the range of 0 to 100.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.keywords
|
\qmlproperty variant QtMultimedia::Audio::metaData.keywords
|
||||||
|
|
||||||
This property holds a list of keywords describing the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.language
|
\qmlproperty variant QtMultimedia::Audio::metaData.language
|
||||||
|
|
||||||
This property holds the language of the media, as an ISO 639-2 code.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.publisher
|
\qmlproperty variant QtMultimedia::Audio::metaData.publisher
|
||||||
|
|
||||||
This property holds the publisher of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.copyright
|
\qmlproperty variant QtMultimedia::Audio::metaData.copyright
|
||||||
|
|
||||||
This property holds the media's copyright notice.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.parentalRating
|
\qmlproperty variant QtMultimedia::Audio::metaData.parentalRating
|
||||||
|
|
||||||
This property holds the parental rating of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.ratingOrganization
|
\qmlproperty variant QtMultimedia::Audio::metaData.ratingOrganization
|
||||||
|
|
||||||
This property holds the name of the rating organization responsible for the
|
|
||||||
parental rating of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.size
|
\qmlproperty variant QtMultimedia::Audio::metaData.size
|
||||||
|
|
||||||
This property property holds the size of the media in bytes.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.mediaType
|
\qmlproperty variant QtMultimedia::Audio::metaData.mediaType
|
||||||
|
|
||||||
This property holds the type of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.audioBitRate
|
\qmlproperty variant QtMultimedia::Audio::metaData.audioBitRate
|
||||||
|
|
||||||
This property holds the bit rate of the media's audio stream in bits per
|
|
||||||
second.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.audioCodec
|
\qmlproperty variant QtMultimedia::Audio::metaData.audioCodec
|
||||||
|
|
||||||
This property holds the encoding of the media audio stream.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.averageLevel
|
\qmlproperty variant QtMultimedia::Audio::metaData.averageLevel
|
||||||
|
|
||||||
This property holds the average volume level of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.channelCount
|
\qmlproperty variant QtMultimedia::Audio::metaData.channelCount
|
||||||
|
|
||||||
This property holds the number of channels in the media's audio stream.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.peakValue
|
\qmlproperty variant QtMultimedia::Audio::metaData.peakValue
|
||||||
|
|
||||||
This property holds the peak volume of media's audio stream.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.sampleRate
|
\qmlproperty variant QtMultimedia::Audio::metaData.sampleRate
|
||||||
|
|
||||||
This property holds the sample rate of the media's audio stream in hertz.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.albumTitle
|
\qmlproperty variant QtMultimedia::Audio::metaData.albumTitle
|
||||||
|
|
||||||
This property holds the title of the album the media belongs to.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.albumArtist
|
\qmlproperty variant QtMultimedia::Audio::metaData.albumArtist
|
||||||
|
|
||||||
This property holds the name of the principal artist of the album the media
|
|
||||||
belongs to.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.contributingArtist
|
\qmlproperty variant QtMultimedia::Audio::metaData.contributingArtist
|
||||||
|
|
||||||
This property holds the names of artists contributing to the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.composer
|
\qmlproperty variant QtMultimedia::Audio::metaData.composer
|
||||||
|
|
||||||
This property holds the composer of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.conductor
|
\qmlproperty variant QtMultimedia::Audio::metaData.conductor
|
||||||
|
|
||||||
This property holds the conductor of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.lyrics
|
\qmlproperty variant QtMultimedia::Audio::metaData.lyrics
|
||||||
|
|
||||||
This property holds the lyrics to the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.mood
|
\qmlproperty variant QtMultimedia::Audio::metaData.mood
|
||||||
|
|
||||||
This property holds the mood of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.trackNumber
|
\qmlproperty variant QtMultimedia::Audio::metaData.trackNumber
|
||||||
|
|
||||||
This property holds the track number of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.trackCount
|
\qmlproperty variant QtMultimedia::Audio::metaData.trackCount
|
||||||
|
|
||||||
This property holds the number of tracks on the album containing the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.coverArtUrlSmall
|
\qmlproperty variant QtMultimedia::Audio::metaData.coverArtUrlSmall
|
||||||
|
|
||||||
This property holds the URL of a small cover art image.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.coverArtUrlLarge
|
\qmlproperty variant QtMultimedia::Audio::metaData.coverArtUrlLarge
|
||||||
|
|
||||||
This property holds the URL of a large cover art image.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.resolution
|
\qmlproperty variant QtMultimedia::Audio::metaData.resolution
|
||||||
|
|
||||||
This property holds the dimension of an image or video.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.pixelAspectRatio
|
\qmlproperty variant QtMultimedia::Audio::metaData.pixelAspectRatio
|
||||||
|
|
||||||
This property holds the pixel aspect ratio of an image or video.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.videoFrameRate
|
\qmlproperty variant QtMultimedia::Audio::metaData.videoFrameRate
|
||||||
|
|
||||||
This property holds the frame rate of the media's video stream.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.videoBitRate
|
\qmlproperty variant QtMultimedia::Audio::metaData.videoBitRate
|
||||||
|
|
||||||
This property holds the bit rate of the media's video stream in bits per
|
|
||||||
second.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.videoCodec
|
\qmlproperty variant QtMultimedia::Audio::metaData.videoCodec
|
||||||
|
|
||||||
This property holds the encoding of the media's video stream.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.posterUrl
|
\qmlproperty variant QtMultimedia::Audio::metaData.posterUrl
|
||||||
|
|
||||||
This property holds the URL of a poster image.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.chapterNumber
|
\qmlproperty variant QtMultimedia::Audio::metaData.chapterNumber
|
||||||
|
|
||||||
This property holds the chapter number of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.director
|
\qmlproperty variant QtMultimedia::Audio::metaData.director
|
||||||
|
|
||||||
This property holds the director of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.leadPerformer
|
\qmlproperty variant QtMultimedia::Audio::metaData.leadPerformer
|
||||||
|
|
||||||
This property holds the lead performer in the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Audio::metaData.writer
|
\qmlproperty variant QtMultimedia::Audio::metaData.writer
|
||||||
|
|
||||||
This property holds the writer of the media.
|
These properties hold the meta data for the current media.
|
||||||
|
|
||||||
|
\list
|
||||||
|
\li \c metaData.title - the title of the media.
|
||||||
|
\li \c metaData.subTitle - the sub-title of the media.
|
||||||
|
\li \c metaData.author - the author of the media.
|
||||||
|
\li \c metaData.comment - a user comment about the media.
|
||||||
|
\li \c metaData.description - a description of the media.
|
||||||
|
\li \c metaData.category - the category of the media.
|
||||||
|
\li \c metaData.genre - the genre of the media.
|
||||||
|
\li \c metaData.year - the year of release of the media.
|
||||||
|
\li \c metaData.date - the date of the media.
|
||||||
|
\li \c metaData.userRating - a user rating of the media in the range of 0 to 100.
|
||||||
|
\li \c metaData.keywords - a list of keywords describing the media.
|
||||||
|
\li \c metaData.language - the language of the media, as an ISO 639-2 code.
|
||||||
|
\li \c metaData.publisher - the publisher of the media.
|
||||||
|
\li \c metaData.copyright - the media's copyright notice.
|
||||||
|
\li \c metaData.parentalRating - the parental rating of the media.
|
||||||
|
\li \c metaData.ratingOrganization - the name of the rating organization responsible for the
|
||||||
|
parental rating of the media.
|
||||||
|
\li \c metaData.size - the size of the media in bytes.
|
||||||
|
\li \c metaData.mediaType - the type of the media.
|
||||||
|
\li \c metaData.audioBitRate - the bit rate of the media's audio stream in bits per second.
|
||||||
|
\li \c metaData.audioCodec - the encoding of the media audio stream.
|
||||||
|
\li \c metaData.averageLevel - the average volume level of the media.
|
||||||
|
\li \c metaData.channelCount - the number of channels in the media's audio stream.
|
||||||
|
\li \c metaData.peakValue - the peak volume of media's audio stream.
|
||||||
|
\li \c metaData.sampleRate - the sample rate of the media's audio stream in hertz.
|
||||||
|
\li \c metaData.albumTitle - the title of the album the media belongs to.
|
||||||
|
\li \c metaData.albumArtist - the name of the principal artist of the album the media
|
||||||
|
belongs to.
|
||||||
|
\li \c metaData.contributingArtist - the names of artists contributing to the media.
|
||||||
|
\li \c metaData.composer - the composer of the media.
|
||||||
|
\li \c metaData.conductor - the conductor of the media.
|
||||||
|
\li \c metaData.lyrics - the lyrics to the media.
|
||||||
|
\li \c metaData.mood - the mood of the media.
|
||||||
|
\li \c metaData.trackNumber - the track number of the media.
|
||||||
|
\li \c metaData.trackCount - the number of tracks on the album containing the media.
|
||||||
|
\li \c metaData.coverArtUrlSmall - the URL of a small cover art image.
|
||||||
|
\li \c metaData.coverArtUrlLarge - the URL of a large cover art image.
|
||||||
|
\li \c metaData.resolution - the dimension of an image or video.
|
||||||
|
\li \c metaData.pixelAspectRatio - the pixel aspect ratio of an image or video.
|
||||||
|
\li \c metaData.videoFrameRate - the frame rate of the media's video stream.
|
||||||
|
\li \c metaData.videoBitRate - the bit rate of the media's video stream in bits per second.
|
||||||
|
\li \c metaData.videoCodec - the encoding of the media's video stream.
|
||||||
|
\li \c metaData.posterUrl - the URL of a poster image.
|
||||||
|
\li \c metaData.chapterNumber - the chapter number of the media.
|
||||||
|
\li \c metaData.director - the director of the media.
|
||||||
|
\li \c metaData.leadPerformer - the lead performer in the media.
|
||||||
|
\li \c metaData.writer - the writer of the media.
|
||||||
|
\endlist
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
\sa {QMediaMetaData}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
///////////// MediaPlayer Docs /////////////
|
///////////// MediaPlayer Docs /////////////
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -1294,12 +1044,7 @@ void QDeclarativeAudio::_q_mediaChanged(const QMediaContent &media)
|
|||||||
\ingroup multimedia_audio_qml
|
\ingroup multimedia_audio_qml
|
||||||
\ingroup multimedia_video_qml
|
\ingroup multimedia_video_qml
|
||||||
|
|
||||||
MediaPlayer is part of the \b{QtMultimedia 5.0} module.
|
|
||||||
|
|
||||||
\qml
|
\qml
|
||||||
import QtQuick 2.0
|
|
||||||
import QtMultimedia 5.0
|
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: "Click Me!";
|
text: "Click Me!";
|
||||||
font.pointSize: 24;
|
font.pointSize: 24;
|
||||||
@@ -1321,9 +1066,6 @@ void QDeclarativeAudio::_q_mediaChanged(const QMediaContent &media)
|
|||||||
or you can use it in conjunction with a \l VideoOutput for rendering video.
|
or you can use it in conjunction with a \l VideoOutput for rendering video.
|
||||||
|
|
||||||
\qml
|
\qml
|
||||||
import QtQuick 2.0
|
|
||||||
import QtMultimedia 5.0
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
MediaPlayer {
|
MediaPlayer {
|
||||||
id: mediaplayer
|
id: mediaplayer
|
||||||
@@ -1664,365 +1406,119 @@ void QDeclarativeAudio::_q_mediaChanged(const QMediaContent &media)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
\qmlproperty variant QtMultimedia::MediaPlayer::mediaObject
|
||||||
|
|
||||||
|
This property holds the native media object.
|
||||||
|
|
||||||
|
It can be used to get a pointer to a QMediaPlayer object in order to integrate with C++ code.
|
||||||
|
|
||||||
|
\code
|
||||||
|
QObject *qmlMediaPlayer; // The QML MediaPlayer object
|
||||||
|
QMediaPlayer *player = qvariant_cast<QMediaPlayer *>(qmlMediaPlayer->property("mediaObject"));
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
\note This property is not accessible from QML.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\qmlpropertygroup QtMultimedia::MediaPlayer::metaData
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.title
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.title
|
||||||
|
|
||||||
This property holds the title of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.subTitle
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.subTitle
|
||||||
|
|
||||||
This property holds the sub-title of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.author
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.author
|
||||||
|
|
||||||
This property holds the author of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.comment
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.comment
|
||||||
|
|
||||||
This property holds a user comment about the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.description
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.description
|
||||||
|
|
||||||
This property holds a description of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.category
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.category
|
||||||
|
|
||||||
This property holds the category of the media
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.genre
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.genre
|
||||||
|
|
||||||
This property holds the genre of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.year
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.year
|
||||||
|
|
||||||
This property holds the year of release of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.date
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.date
|
||||||
|
|
||||||
This property holds the date of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.userRating
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.userRating
|
||||||
|
|
||||||
This property holds a user rating of the media in the range of 0 to 100.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.keywords
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.keywords
|
||||||
|
|
||||||
This property holds a list of keywords describing the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.language
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.language
|
||||||
|
|
||||||
This property holds the language of the media, as an ISO 639-2 code.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.publisher
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.publisher
|
||||||
|
|
||||||
This property holds the publisher of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.copyright
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.copyright
|
||||||
|
|
||||||
This property holds the media's copyright notice.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.parentalRating
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.parentalRating
|
||||||
|
|
||||||
This property holds the parental rating of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.ratingOrganization
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.ratingOrganization
|
||||||
|
|
||||||
This property holds the name of the rating organization responsible for the
|
|
||||||
parental rating of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.size
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.size
|
||||||
|
|
||||||
This property property holds the size of the media in bytes.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.mediaType
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.mediaType
|
||||||
|
|
||||||
This property holds the type of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.audioBitRate
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.audioBitRate
|
||||||
|
|
||||||
This property holds the bit rate of the media's audio stream in bits per
|
|
||||||
second.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.audioCodec
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.audioCodec
|
||||||
|
|
||||||
This property holds the encoding of the media audio stream.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.averageLevel
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.averageLevel
|
||||||
|
|
||||||
This property holds the average volume level of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.channelCount
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.channelCount
|
||||||
|
|
||||||
This property holds the number of channels in the media's audio stream.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.peakValue
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.peakValue
|
||||||
|
|
||||||
This property holds the peak volume of media's audio stream.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.sampleRate
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.sampleRate
|
||||||
|
|
||||||
This property holds the sample rate of the media's audio stream in hertz.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.albumTitle
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.albumTitle
|
||||||
|
|
||||||
This property holds the title of the album the media belongs to.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.albumArtist
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.albumArtist
|
||||||
|
|
||||||
This property holds the name of the principal artist of the album the media
|
|
||||||
belongs to.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.contributingArtist
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.contributingArtist
|
||||||
|
|
||||||
This property holds the names of artists contributing to the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.composer
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.composer
|
||||||
|
|
||||||
This property holds the composer of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.conductor
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.conductor
|
||||||
|
|
||||||
This property holds the conductor of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.lyrics
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.lyrics
|
||||||
|
|
||||||
This property holds the lyrics to the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.mood
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.mood
|
||||||
|
|
||||||
This property holds the mood of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.trackNumber
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.trackNumber
|
||||||
|
|
||||||
This property holds the track number of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.trackCount
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.trackCount
|
||||||
|
|
||||||
This property holds the number of tracks on the album containing the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.coverArtUrlSmall
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.coverArtUrlSmall
|
||||||
|
|
||||||
This property holds the URL of a small cover art image.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.coverArtUrlLarge
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.coverArtUrlLarge
|
||||||
|
|
||||||
This property holds the URL of a large cover art image.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.resolution
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.resolution
|
||||||
|
|
||||||
This property holds the dimension of an image or video.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.pixelAspectRatio
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.pixelAspectRatio
|
||||||
|
|
||||||
This property holds the pixel aspect ratio of an image or video.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.videoFrameRate
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.videoFrameRate
|
||||||
|
|
||||||
This property holds the frame rate of the media's video stream.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.videoBitRate
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.videoBitRate
|
||||||
|
|
||||||
This property holds the bit rate of the media's video stream in bits per
|
|
||||||
second.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.videoCodec
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.videoCodec
|
||||||
|
|
||||||
This property holds the encoding of the media's video stream.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.posterUrl
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.posterUrl
|
||||||
|
|
||||||
This property holds the URL of a poster image.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.chapterNumber
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.chapterNumber
|
||||||
|
|
||||||
This property holds the chapter number of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.director
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.director
|
||||||
|
|
||||||
This property holds the director of the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.leadPerformer
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.leadPerformer
|
||||||
|
|
||||||
This property holds the lead performer in the media.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.writer
|
\qmlproperty variant QtMultimedia::MediaPlayer::metaData.writer
|
||||||
|
|
||||||
This property holds the writer of the media.
|
These properties hold the meta data for the current media.
|
||||||
|
|
||||||
|
\list
|
||||||
|
\li \c metaData.title - the title of the media.
|
||||||
|
\li \c metaData.subTitle - the sub-title of the media.
|
||||||
|
\li \c metaData.author - the author of the media.
|
||||||
|
\li \c metaData.comment - a user comment about the media.
|
||||||
|
\li \c metaData.description - a description of the media.
|
||||||
|
\li \c metaData.category - the category of the media.
|
||||||
|
\li \c metaData.genre - the genre of the media.
|
||||||
|
\li \c metaData.year - the year of release of the media.
|
||||||
|
\li \c metaData.date - the date of the media.
|
||||||
|
\li \c metaData.userRating - a user rating of the media in the range of 0 to 100.
|
||||||
|
\li \c metaData.keywords - a list of keywords describing the media.
|
||||||
|
\li \c metaData.language - the language of the media, as an ISO 639-2 code.
|
||||||
|
\li \c metaData.publisher - the publisher of the media.
|
||||||
|
\li \c metaData.copyright - the media's copyright notice.
|
||||||
|
\li \c metaData.parentalRating - the parental rating of the media.
|
||||||
|
\li \c metaData.ratingOrganization - the name of the rating organization responsible for the
|
||||||
|
parental rating of the media.
|
||||||
|
\li \c metaData.size - the size of the media in bytes.
|
||||||
|
\li \c metaData.mediaType - the type of the media.
|
||||||
|
\li \c metaData.audioBitRate - the bit rate of the media's audio stream in bits per second.
|
||||||
|
\li \c metaData.audioCodec - the encoding of the media audio stream.
|
||||||
|
\li \c metaData.averageLevel - the average volume level of the media.
|
||||||
|
\li \c metaData.channelCount - the number of channels in the media's audio stream.
|
||||||
|
\li \c metaData.peakValue - the peak volume of media's audio stream.
|
||||||
|
\li \c metaData.sampleRate - the sample rate of the media's audio stream in hertz.
|
||||||
|
\li \c metaData.albumTitle - the title of the album the media belongs to.
|
||||||
|
\li \c metaData.albumArtist - the name of the principal artist of the album the media
|
||||||
|
belongs to.
|
||||||
|
\li \c metaData.contributingArtist - the names of artists contributing to the media.
|
||||||
|
\li \c metaData.composer - the composer of the media.
|
||||||
|
\li \c metaData.conductor - the conductor of the media.
|
||||||
|
\li \c metaData.lyrics - the lyrics to the media.
|
||||||
|
\li \c metaData.mood - the mood of the media.
|
||||||
|
\li \c metaData.trackNumber - the track number of the media.
|
||||||
|
\li \c metaData.trackCount - the number of tracks on the album containing the media.
|
||||||
|
\li \c metaData.coverArtUrlSmall - the URL of a small cover art image.
|
||||||
|
\li \c metaData.coverArtUrlLarge - the URL of a large cover art image.
|
||||||
|
\li \c metaData.resolution - the dimension of an image or video.
|
||||||
|
\li \c metaData.pixelAspectRatio - the pixel aspect ratio of an image or video.
|
||||||
|
\li \c metaData.videoFrameRate - the frame rate of the media's video stream.
|
||||||
|
\li \c metaData.videoBitRate - the bit rate of the media's video stream in bits per second.
|
||||||
|
\li \c metaData.videoCodec - the encoding of the media's video stream.
|
||||||
|
\li \c metaData.posterUrl - the URL of a poster image.
|
||||||
|
\li \c metaData.chapterNumber - the chapter number of the media.
|
||||||
|
\li \c metaData.director - the director of the media.
|
||||||
|
\li \c metaData.leadPerformer - the lead performer in the media.
|
||||||
|
\li \c metaData.writer - the writer of the media.
|
||||||
|
\endlist
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
\sa {QMediaMetaData}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -84,10 +84,6 @@ void QDeclarativeCamera::_q_availabilityChanged(QMultimedia::AvailabilityStatus
|
|||||||
viewfinder you can use \l VideoOutput with the Camera set as the source.
|
viewfinder you can use \l VideoOutput with the Camera set as the source.
|
||||||
|
|
||||||
\qml
|
\qml
|
||||||
|
|
||||||
import QtQuick 2.0
|
|
||||||
import QtMultimedia 5.4
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
width: 640
|
width: 640
|
||||||
height: 360
|
height: 360
|
||||||
@@ -778,7 +774,16 @@ void QDeclarativeCamera::setDigitalZoom(qreal value)
|
|||||||
/*!
|
/*!
|
||||||
\qmlproperty variant QtMultimedia::Camera::mediaObject
|
\qmlproperty variant QtMultimedia::Camera::mediaObject
|
||||||
|
|
||||||
This property holds the media object for the camera.
|
This property holds the native media object for the camera.
|
||||||
|
|
||||||
|
It can be used to get a pointer to a QCamera object in order to integrate with C++ code.
|
||||||
|
|
||||||
|
\code
|
||||||
|
QObject *qmlCamera; // The QML Camera object
|
||||||
|
QCamera *camera = qvariant_cast<QCamera *>(qmlCamera->property("mediaObject"));
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
\note This property is not accessible from QML.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -866,116 +871,42 @@ void QDeclarativeCamera::setDigitalZoom(qreal value)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
\qmlpropertygroup QtMultimedia::Camera::metaData
|
||||||
\qmlproperty variant QtMultimedia::Camera::metaData.cameraManufacturer
|
\qmlproperty variant QtMultimedia::Camera::metaData.cameraManufacturer
|
||||||
|
|
||||||
This property holds the name of the manufacturer of the camera.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
\since 5.4
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Camera::metaData.cameraModel
|
\qmlproperty variant QtMultimedia::Camera::metaData.cameraModel
|
||||||
|
|
||||||
This property holds the name of the model of the camera.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
\since 5.4
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Camera::metaData.event
|
\qmlproperty variant QtMultimedia::Camera::metaData.event
|
||||||
|
|
||||||
This property holds the event during which the photo or video is to be captured.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
\since 5.4
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Camera::metaData.subject
|
\qmlproperty variant QtMultimedia::Camera::metaData.subject
|
||||||
|
|
||||||
This property holds the name of the subject of the capture or recording.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
\since 5.4
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Camera::metaData.orientation
|
\qmlproperty variant QtMultimedia::Camera::metaData.orientation
|
||||||
|
|
||||||
This property holds the clockwise rotation of the camera at time of capture.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
\since 5.4
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Camera::metaData.dateTimeOriginal
|
\qmlproperty variant QtMultimedia::Camera::metaData.dateTimeOriginal
|
||||||
|
|
||||||
This property holds the initial time at which the photo or video is
|
|
||||||
captured.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
\since 5.4
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Camera::metaData.gpsLatitude
|
\qmlproperty variant QtMultimedia::Camera::metaData.gpsLatitude
|
||||||
\qmlproperty variant QtMultimedia::Camera::metaData.gpsLongitude
|
\qmlproperty variant QtMultimedia::Camera::metaData.gpsLongitude
|
||||||
\qmlproperty variant QtMultimedia::Camera::metaData.gpsAltitude
|
\qmlproperty variant QtMultimedia::Camera::metaData.gpsAltitude
|
||||||
|
|
||||||
These properties hold the geographic position in decimal degrees of the
|
|
||||||
camera at time of capture.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
\since 5.4
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Camera::metaData.gpsTimestamp
|
\qmlproperty variant QtMultimedia::Camera::metaData.gpsTimestamp
|
||||||
|
|
||||||
This property holds the timestamp of the GPS position data.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
\since 5.4
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Camera::metaData.gpsTrack
|
\qmlproperty variant QtMultimedia::Camera::metaData.gpsTrack
|
||||||
|
|
||||||
This property holds direction of movement of the camera at the time of
|
|
||||||
capture. It is measured in degrees clockwise from north.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
\since 5.4
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Camera::metaData.gpsSpeed
|
\qmlproperty variant QtMultimedia::Camera::metaData.gpsSpeed
|
||||||
|
|
||||||
This property holds the velocity in kilometers per hour of the camera at
|
|
||||||
time of capture.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
\since 5.4
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Camera::metaData.gpsImgDirection
|
\qmlproperty variant QtMultimedia::Camera::metaData.gpsImgDirection
|
||||||
|
|
||||||
This property holds direction the camera is facing at the time of capture.
|
|
||||||
It is measured in degrees clockwise from north.
|
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
|
||||||
\since 5.4
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\qmlproperty variant QtMultimedia::Camera::metaData.gpsProcessingMethod
|
\qmlproperty variant QtMultimedia::Camera::metaData.gpsProcessingMethod
|
||||||
|
|
||||||
This property holds the name of the method for determining the GPS position
|
These properties hold the meta data for the camera captures.
|
||||||
data.
|
|
||||||
|
\list
|
||||||
|
\li \c metaData.cameraManufacturer holds the name of the manufacturer of the camera.
|
||||||
|
\li \c metaData.cameraModel holds the name of the model of the camera.
|
||||||
|
\li \c metaData.event holds the event during which the photo or video is to be captured.
|
||||||
|
\li \c metaData.subject holds the name of the subject of the capture or recording.
|
||||||
|
\li \c metaData.orientation holds the clockwise rotation of the camera at time of capture.
|
||||||
|
\li \c metaData.dateTimeOriginal holds the initial time at which the photo or video is captured.
|
||||||
|
\li \c metaData.gpsLatitude holds the latitude of the camera in decimal degrees at time of capture.
|
||||||
|
\li \c metaData.gpsLongitude holds the longitude of the camera in decimal degrees at time of capture.
|
||||||
|
\li \c metaData.gpsAltitude holds the altitude of the camera in meters at time of capture.
|
||||||
|
\li \c metaData.gpsTimestamp holds the timestamp of the GPS position data.
|
||||||
|
\li \c metaData.gpsTrack holds direction of movement of the camera at the time of
|
||||||
|
capture. It is measured in degrees clockwise from north.
|
||||||
|
\li \c metaData.gpsSpeed holds the velocity in kilometers per hour of the camera at time of capture.
|
||||||
|
\li \c metaData.gpsImgDirection holds direction the camera is facing at the time of capture.
|
||||||
|
It is measured in degrees clockwise from north.
|
||||||
|
\li \c metaData.gpsProcessingMethod holds the name of the method for determining the GPS position.
|
||||||
|
\endlist
|
||||||
|
|
||||||
\sa {QMediaMetaData}
|
\sa {QMediaMetaData}
|
||||||
\since 5.4
|
\since 5.4
|
||||||
|
|||||||
@@ -57,9 +57,6 @@ QT_BEGIN_NAMESPACE
|
|||||||
and cannot be created directly.
|
and cannot be created directly.
|
||||||
|
|
||||||
\qml
|
\qml
|
||||||
import QtQuick 2.0
|
|
||||||
import QtMultimedia 5.0
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
width: 640
|
width: 640
|
||||||
height: 360
|
height: 360
|
||||||
|
|||||||
@@ -44,8 +44,6 @@ QT_BEGIN_NAMESPACE
|
|||||||
\ingroup camera_qml
|
\ingroup camera_qml
|
||||||
\inqmlmodule QtMultimedia
|
\inqmlmodule QtMultimedia
|
||||||
|
|
||||||
This type is part of the \b{QtMultimedia 5.0} module.
|
|
||||||
|
|
||||||
CameraExposure allows you to adjust exposure related settings
|
CameraExposure allows you to adjust exposure related settings
|
||||||
like aperture and shutter speed, metering and ISO speed.
|
like aperture and shutter speed, metering and ISO speed.
|
||||||
|
|
||||||
@@ -53,8 +51,6 @@ QT_BEGIN_NAMESPACE
|
|||||||
\c exposure property of the a \l Camera should be used.
|
\c exposure property of the a \l Camera should be used.
|
||||||
|
|
||||||
\qml
|
\qml
|
||||||
import QtQuick 2.0
|
|
||||||
import QtMultimedia 5.0
|
|
||||||
|
|
||||||
Camera {
|
Camera {
|
||||||
id: camera
|
id: camera
|
||||||
|
|||||||
@@ -44,8 +44,6 @@ QT_BEGIN_NAMESPACE
|
|||||||
\ingroup multimedia_qml
|
\ingroup multimedia_qml
|
||||||
\ingroup camera_qml
|
\ingroup camera_qml
|
||||||
|
|
||||||
CameraFlash is part of the \b{QtMultimedia 5.0} module.
|
|
||||||
|
|
||||||
This type allows you to operate the camera flash
|
This type allows you to operate the camera flash
|
||||||
hardware and control the flash mode used. Not all cameras have
|
hardware and control the flash mode used. Not all cameras have
|
||||||
flash hardware (and in some cases it is shared with the
|
flash hardware (and in some cases it is shared with the
|
||||||
@@ -55,8 +53,6 @@ QT_BEGIN_NAMESPACE
|
|||||||
\c flash property of a \l Camera should be used.
|
\c flash property of a \l Camera should be used.
|
||||||
|
|
||||||
\qml
|
\qml
|
||||||
import QtQuick 2.0
|
|
||||||
import QtMultimedia 5.0
|
|
||||||
|
|
||||||
Camera {
|
Camera {
|
||||||
id: camera
|
id: camera
|
||||||
@@ -81,11 +77,7 @@ QDeclarativeCameraFlash::QDeclarativeCameraFlash(QCamera *camera, QObject *paren
|
|||||||
QDeclarativeCameraFlash::~QDeclarativeCameraFlash()
|
QDeclarativeCameraFlash::~QDeclarativeCameraFlash()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
/*!
|
|
||||||
\property bool QDeclarativeCameraFlash::ready
|
|
||||||
|
|
||||||
This property indicates whether the flash is charged.
|
|
||||||
*/
|
|
||||||
/*!
|
/*!
|
||||||
\qmlproperty bool QtMultimedia::CameraFlash::ready
|
\qmlproperty bool QtMultimedia::CameraFlash::ready
|
||||||
|
|
||||||
@@ -95,11 +87,7 @@ bool QDeclarativeCameraFlash::isFlashReady() const
|
|||||||
{
|
{
|
||||||
return m_exposure->isFlashReady();
|
return m_exposure->isFlashReady();
|
||||||
}
|
}
|
||||||
/*!
|
|
||||||
\property QDeclarativeCameraFlash::mode
|
|
||||||
|
|
||||||
This property holds the camera flash mode. The mode can be one of the constants in \l QCameraExposure::FlashMode.
|
|
||||||
*/
|
|
||||||
/*!
|
/*!
|
||||||
\qmlproperty enumeration QtMultimedia::CameraFlash::mode
|
\qmlproperty enumeration QtMultimedia::CameraFlash::mode
|
||||||
|
|
||||||
|
|||||||
@@ -44,8 +44,6 @@ QT_BEGIN_NAMESPACE
|
|||||||
\ingroup multimedia_qml
|
\ingroup multimedia_qml
|
||||||
\ingroup camera_qml
|
\ingroup camera_qml
|
||||||
|
|
||||||
CameraFocus is part of the \b{QtMultimedia 5.0} module.
|
|
||||||
|
|
||||||
This type allows control over manual and automatic
|
This type allows control over manual and automatic
|
||||||
focus settings, including information about any parts of the
|
focus settings, including information about any parts of the
|
||||||
camera frame that are selected for autofocusing.
|
camera frame that are selected for autofocusing.
|
||||||
@@ -54,8 +52,6 @@ QT_BEGIN_NAMESPACE
|
|||||||
\c focus property of a \l Camera should be used.
|
\c focus property of a \l Camera should be used.
|
||||||
|
|
||||||
\qml
|
\qml
|
||||||
import QtQuick 2.0
|
|
||||||
import QtMultimedia 5.0
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
width: 640
|
width: 640
|
||||||
|
|||||||
@@ -52,8 +52,6 @@ QT_BEGIN_NAMESPACE
|
|||||||
\c imageProcessing property of a \l Camera should be used.
|
\c imageProcessing property of a \l Camera should be used.
|
||||||
|
|
||||||
\qml
|
\qml
|
||||||
import QtQuick 2.0
|
|
||||||
import QtMultimedia 5.0
|
|
||||||
|
|
||||||
Camera {
|
Camera {
|
||||||
id: camera
|
id: camera
|
||||||
@@ -220,7 +218,7 @@ void QDeclarativeCameraImageProcessing::setDenoisingLevel(qreal value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\qmlproperty QtMultimedia::CameraImageProcessing::colorFilter
|
\qmlproperty enumeration QtMultimedia::CameraImageProcessing::colorFilter
|
||||||
|
|
||||||
This property holds which color filter if any will be applied to image data captured by the camera.
|
This property holds which color filter if any will be applied to image data captured by the camera.
|
||||||
|
|
||||||
|
|||||||
@@ -51,9 +51,6 @@ It is not instantiable; to use it, call the members of the global \c QtMultimedi
|
|||||||
For example:
|
For example:
|
||||||
|
|
||||||
\qml
|
\qml
|
||||||
import QtQuick 2.0
|
|
||||||
import QtMultimedia 5.4
|
|
||||||
|
|
||||||
Camera {
|
Camera {
|
||||||
deviceId: QtMultimedia.defaultCamera.deviceId
|
deviceId: QtMultimedia.defaultCamera.deviceId
|
||||||
}
|
}
|
||||||
@@ -121,9 +118,6 @@ Camera {
|
|||||||
the active camera by selecting one of the items in the list.
|
the active camera by selecting one of the items in the list.
|
||||||
|
|
||||||
\qml
|
\qml
|
||||||
import QtQuick 2.0
|
|
||||||
import QtMultimedia 5.4
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
||||||
Camera {
|
Camera {
|
||||||
|
|||||||
@@ -45,12 +45,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
\ingroup multimedia_radio_qml
|
\ingroup multimedia_radio_qml
|
||||||
\inherits Item
|
\inherits Item
|
||||||
|
|
||||||
Radio is part of the \b{QtMultimedia 5.0} module.
|
|
||||||
|
|
||||||
\qml
|
\qml
|
||||||
import QtQuick 2.0
|
|
||||||
import QtMultimedia 5.0
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: 320
|
width: 320
|
||||||
height: 480
|
height: 480
|
||||||
|
|||||||
@@ -44,17 +44,12 @@ QT_BEGIN_NAMESPACE
|
|||||||
\ingroup multimedia_radio_qml
|
\ingroup multimedia_radio_qml
|
||||||
\inherits Item
|
\inherits Item
|
||||||
|
|
||||||
This type is part of the \b{QtMultimedia 5.0} module.
|
|
||||||
|
|
||||||
\c RadioData is your gateway to all the data available through RDS. RDS is the Radio Data System
|
\c RadioData is your gateway to all the data available through RDS. RDS is the Radio Data System
|
||||||
which allows radio stations to broadcast information like the \l stationId, \l programType, \l programTypeName,
|
which allows radio stations to broadcast information like the \l stationId, \l programType, \l programTypeName,
|
||||||
\l stationName, and \l radioText. This information can be read from the \c RadioData. It also allows
|
\l stationName, and \l radioText. This information can be read from the \c RadioData. It also allows
|
||||||
you to set whether the radio should tune to alternative frequencies if the current signal strength falls too much.
|
you to set whether the radio should tune to alternative frequencies if the current signal strength falls too much.
|
||||||
|
|
||||||
\qml
|
\qml
|
||||||
import QtQuick 2.0
|
|
||||||
import QtMultimedia 5.0
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: 480
|
width: 480
|
||||||
height: 320
|
height: 320
|
||||||
|
|||||||
@@ -46,16 +46,12 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
\ingroup multimedia_qml
|
\ingroup multimedia_qml
|
||||||
|
|
||||||
\c Torch is part of the \b{QtMultimedia 5.0} module.
|
|
||||||
|
|
||||||
In many cases the torch hardware is shared with camera flash functionality,
|
In many cases the torch hardware is shared with camera flash functionality,
|
||||||
and might be automatically controlled by the device. You have control over
|
and might be automatically controlled by the device. You have control over
|
||||||
the power level (of course, higher power levels are brighter but reduce
|
the power level (of course, higher power levels are brighter but reduce
|
||||||
battery life significantly).
|
battery life significantly).
|
||||||
|
|
||||||
\qml
|
\qml
|
||||||
import QtQuick 2.0
|
|
||||||
import QtMultimedia 5.0
|
|
||||||
|
|
||||||
Torch {
|
Torch {
|
||||||
power: 75 // 75% of full power
|
power: 75 // 75% of full power
|
||||||
|
|||||||
@@ -83,8 +83,6 @@ QT_BEGIN_NAMESPACE
|
|||||||
\ingroup multimedia_audio_qml
|
\ingroup multimedia_audio_qml
|
||||||
\inqmlmodule QtMultimedia
|
\inqmlmodule QtMultimedia
|
||||||
|
|
||||||
SoundEffect is part of the \b{QtMultimedia 5.0} module.
|
|
||||||
|
|
||||||
This type allows you to play uncompressed audio files (typically WAV files) in
|
This type allows you to play uncompressed audio files (typically WAV files) in
|
||||||
a generally lower latency way, and is suitable for "feedback" type sounds in
|
a generally lower latency way, and is suitable for "feedback" type sounds in
|
||||||
response to user actions (e.g. virtual keyboard sounds, positive or negative
|
response to user actions (e.g. virtual keyboard sounds, positive or negative
|
||||||
|
|||||||
@@ -72,6 +72,9 @@ static bool qt_sizeLessThan(const QSize &s1, const QSize &s2)
|
|||||||
|
|
||||||
static bool qt_frameRateRangeLessThan(const QCamera::FrameRateRange &s1, const QCamera::FrameRateRange &s2)
|
static bool qt_frameRateRangeLessThan(const QCamera::FrameRateRange &s1, const QCamera::FrameRateRange &s2)
|
||||||
{
|
{
|
||||||
|
if (s1.maximumFrameRate == s2.maximumFrameRate)
|
||||||
|
return s1.minimumFrameRate < s2.minimumFrameRate;
|
||||||
|
|
||||||
return s1.maximumFrameRate < s2.maximumFrameRate;
|
return s1.maximumFrameRate < s2.maximumFrameRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -658,7 +661,7 @@ QList<QCameraViewfinderSettings> QCamera::supportedViewfinderSettings(const QCam
|
|||||||
&& (qFuzzyIsNull(settings.minimumFrameRate()) || qFuzzyCompare((float)settings.minimumFrameRate(), (float)s.minimumFrameRate()))
|
&& (qFuzzyIsNull(settings.minimumFrameRate()) || qFuzzyCompare((float)settings.minimumFrameRate(), (float)s.minimumFrameRate()))
|
||||||
&& (qFuzzyIsNull(settings.maximumFrameRate()) || qFuzzyCompare((float)settings.maximumFrameRate(), (float)s.maximumFrameRate()))
|
&& (qFuzzyIsNull(settings.maximumFrameRate()) || qFuzzyCompare((float)settings.maximumFrameRate(), (float)s.maximumFrameRate()))
|
||||||
&& (settings.pixelFormat() == QVideoFrame::Format_Invalid || settings.pixelFormat() == s.pixelFormat())
|
&& (settings.pixelFormat() == QVideoFrame::Format_Invalid || settings.pixelFormat() == s.pixelFormat())
|
||||||
&& (settings.pixelAspectRatio() == QSize(1, 1) || settings.pixelAspectRatio() == s.pixelAspectRatio())) {
|
&& (settings.pixelAspectRatio().isEmpty() || settings.pixelAspectRatio() == s.pixelAspectRatio())) {
|
||||||
results.append(s);
|
results.append(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1042,6 +1045,19 @@ void QCamera::unlock()
|
|||||||
\sa QCamera::supportedViewfinderFrameRateRanges(), QCameraViewfinderSettings
|
\sa QCamera::supportedViewfinderFrameRateRanges(), QCameraViewfinderSettings
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn QCamera::FrameRateRange::FrameRateRange()
|
||||||
|
|
||||||
|
Constructs a null frame rate range, with both minimumFrameRate and maximumFrameRate
|
||||||
|
equal to \c 0.0.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn QCamera::FrameRateRange::FrameRateRange(qreal minimum, qreal maximum)
|
||||||
|
|
||||||
|
Constructs a frame rate range with the given \a minimum and \a maximum frame rates.
|
||||||
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\variable QCamera::FrameRateRange::minimumFrameRate
|
\variable QCamera::FrameRateRange::minimumFrameRate
|
||||||
The minimum frame rate supported by the range, in frames per second.
|
The minimum frame rate supported by the range, in frames per second.
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ void QCameraImageProcessing::setDenoisingLevel(qreal level)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\enum QCameraImageProcessing::Filter
|
\enum QCameraImageProcessing::ColorFilter
|
||||||
|
|
||||||
\value ColorFilterNone No filter is applied to images.
|
\value ColorFilterNone No filter is applied to images.
|
||||||
\value ColorFilterGrayscale A grayscale filter.
|
\value ColorFilterGrayscale A grayscale filter.
|
||||||
|
|||||||
@@ -50,8 +50,7 @@ public:
|
|||||||
isNull(true),
|
isNull(true),
|
||||||
minimumFrameRate(0.0),
|
minimumFrameRate(0.0),
|
||||||
maximumFrameRate(0.0),
|
maximumFrameRate(0.0),
|
||||||
pixelFormat(QVideoFrame::Format_Invalid),
|
pixelFormat(QVideoFrame::Format_Invalid)
|
||||||
pixelAspectRatio(1, 1)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,6 +134,18 @@ QCameraViewfinderSettings &QCameraViewfinderSettings::operator=(const QCameraVie
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! \fn QCameraViewfinderSettings &QCameraViewfinderSettings::operator=(QCameraViewfinderSettings &&other)
|
||||||
|
|
||||||
|
Moves \a other to this viewfinder settings object and returns a reference to this object.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn void QCameraViewfinderSettings::swap(QCameraViewfinderSettings &other)
|
||||||
|
|
||||||
|
Swaps this viewfinder settings object with \a other. This
|
||||||
|
function is very fast and never fails.
|
||||||
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\relates QCameraViewfinderSettings
|
\relates QCameraViewfinderSettings
|
||||||
\since 5.5
|
\since 5.5
|
||||||
|
|||||||
@@ -31,10 +31,10 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
//! [complete snippet]
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import QtMultimedia 5.0
|
import QtMultimedia 5.5
|
||||||
|
|
||||||
|
//! [complete snippet]
|
||||||
Text {
|
Text {
|
||||||
text: "Click Me!";
|
text: "Click Me!";
|
||||||
font.pointSize: 24;
|
font.pointSize: 24;
|
||||||
|
|||||||
@@ -102,9 +102,6 @@ In QML, use the \l{QtMultimedia::QtMultimedia::availableCameras}{QtMultimedia.av
|
|||||||
property:
|
property:
|
||||||
|
|
||||||
\qml
|
\qml
|
||||||
import QtQuick 2.0
|
|
||||||
import QtMultimedia 5.4
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
property bool isCameraAvailable: QtMultimedia.availableCameras.length > 0
|
property bool isCameraAvailable: QtMultimedia.availableCameras.length > 0
|
||||||
}
|
}
|
||||||
@@ -163,9 +160,6 @@ In QML, you can use \l Camera and \l VideoOutput together to show a
|
|||||||
simple viewfinder:
|
simple viewfinder:
|
||||||
|
|
||||||
\qml
|
\qml
|
||||||
import QtQuick 2.0
|
|
||||||
import QtMultimedia 5.4
|
|
||||||
|
|
||||||
VideoOutput {
|
VideoOutput {
|
||||||
source: camera
|
source: camera
|
||||||
|
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ what changed, and what you might need to change when porting code.
|
|||||||
\section2 QML Types
|
\section2 QML Types
|
||||||
The QML types are accessed by using:
|
The QML types are accessed by using:
|
||||||
\code
|
\code
|
||||||
import QtMultimedia 5.4
|
import QtMultimedia 5.5
|
||||||
\endcode
|
\endcode
|
||||||
\annotatedlist multimedia_qml
|
\annotatedlist multimedia_qml
|
||||||
The following types are accessed by using \l{Qt Audio Engine QML Types}{Qt Audio Engine}:
|
The following types are accessed by using \l{Qt Audio Engine QML Types}{Qt Audio Engine}:
|
||||||
|
|||||||
@@ -54,10 +54,6 @@
|
|||||||
|
|
||||||
\qml
|
\qml
|
||||||
|
|
||||||
import QtQuick 2.0
|
|
||||||
import QtMultimedia 5.0
|
|
||||||
// ...
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
width: 640
|
width: 640
|
||||||
height: 360
|
height: 360
|
||||||
@@ -196,9 +192,6 @@
|
|||||||
|
|
||||||
\qml
|
\qml
|
||||||
|
|
||||||
import QtQuick 2.0
|
|
||||||
import QtMultimedia 5.0
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
width: 640
|
width: 640
|
||||||
height: 360
|
height: 360
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
import statement in your \c {.qml} file.
|
import statement in your \c {.qml} file.
|
||||||
|
|
||||||
\code
|
\code
|
||||||
import QtMultimedia 5.4
|
import QtMultimedia 5.5
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
If you intend to use the C++ classes in your application, include the C++
|
If you intend to use the C++ classes in your application, include the C++
|
||||||
@@ -104,12 +104,18 @@
|
|||||||
\row
|
\row
|
||||||
\li QAudioOutput
|
\li QAudioOutput
|
||||||
\li Sends audio data to an audio output device
|
\li Sends audio data to an audio output device
|
||||||
|
\row
|
||||||
|
\li QAudioRecorder
|
||||||
|
\li Record media content from an audio source.
|
||||||
\row
|
\row
|
||||||
\li QCamera
|
\li QCamera
|
||||||
\li Access camera viewfinder.
|
\li Access camera viewfinder.
|
||||||
\row
|
\row
|
||||||
\li QCameraImageCapture
|
\li QCameraImageCapture
|
||||||
\li Record media content. Intended to be used with QCamera to record media.
|
\li Capture still images with a camera.
|
||||||
|
\row
|
||||||
|
\li QMediaRecorder
|
||||||
|
\li Record media content from a camera or radio tuner source.
|
||||||
\row
|
\row
|
||||||
\li QMediaPlayer
|
\li QMediaPlayer
|
||||||
\li Playback media from a source.
|
\li Playback media from a source.
|
||||||
@@ -120,8 +126,8 @@
|
|||||||
\li QRadioTuner
|
\li QRadioTuner
|
||||||
\li Access radio device.
|
\li Access radio device.
|
||||||
\row
|
\row
|
||||||
\li QVideoRendererControl
|
\li QAbstractVideoSurface
|
||||||
\li Control video data.
|
\li Base class for video presentation.
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
\section1 Related Information
|
\section1 Related Information
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\qmlmodule QtMultimedia 5.4
|
\qmlmodule QtMultimedia 5.5
|
||||||
\title Qt Multimedia QML Types
|
\title Qt Multimedia QML Types
|
||||||
\ingroup qmlmodules
|
\ingroup qmlmodules
|
||||||
\brief Provides QML types for multimedia support.
|
\brief Provides QML types for multimedia support.
|
||||||
@@ -42,7 +42,7 @@ The QML types for \l{Qt Multimedia} support the basic use cases such as:
|
|||||||
The QML types can be imported into your application using the following import
|
The QML types can be imported into your application using the following import
|
||||||
statement in your .qml file:
|
statement in your .qml file:
|
||||||
\code
|
\code
|
||||||
import QtMultimedia 5.4
|
import QtMultimedia 5.5
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
\section1 QML types
|
\section1 QML types
|
||||||
|
|||||||
120
src/multimedia/gsttools_headers/qgstreamervideooverlay_p.h
Normal file
120
src/multimedia/gsttools_headers/qgstreamervideooverlay_p.h
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2015 The Qt Company Ltd.
|
||||||
|
** Contact: http://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL21$
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
|
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at http://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 or version 3 as published by the Free
|
||||||
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||||
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||||
|
** following information to ensure the GNU Lesser General Public License
|
||||||
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||||
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** As a special exception, The Qt Company gives you certain additional
|
||||||
|
** rights. These rights are described in The Qt Company LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef QGSTREAMERVIDEOOVERLAY_P_H
|
||||||
|
#define QGSTREAMERVIDEOOVERLAY_P_H
|
||||||
|
|
||||||
|
#include <private/qgstreamerbushelper_p.h>
|
||||||
|
#include <private/qgstreamerbufferprobe_p.h>
|
||||||
|
#include <QtGui/qwindowdefs.h>
|
||||||
|
#include <QtCore/qsize.h>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class QGstreamerVideoOverlay
|
||||||
|
: public QObject
|
||||||
|
, public QGstreamerSyncMessageFilter
|
||||||
|
, public QGstreamerBusMessageFilter
|
||||||
|
, private QGstreamerBufferProbe
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_INTERFACES(QGstreamerSyncMessageFilter QGstreamerBusMessageFilter)
|
||||||
|
public:
|
||||||
|
explicit QGstreamerVideoOverlay(QObject *parent = 0, const QByteArray &elementName = QByteArray());
|
||||||
|
virtual ~QGstreamerVideoOverlay();
|
||||||
|
|
||||||
|
GstElement *videoSink() const;
|
||||||
|
QSize nativeVideoSize() const;
|
||||||
|
|
||||||
|
void setWindowHandle(WId id);
|
||||||
|
void expose();
|
||||||
|
void setRenderRectangle(const QRect &rect);
|
||||||
|
|
||||||
|
bool isActive() const;
|
||||||
|
|
||||||
|
Qt::AspectRatioMode aspectRatioMode() const;
|
||||||
|
void setAspectRatioMode(Qt::AspectRatioMode mode);
|
||||||
|
|
||||||
|
int brightness() const;
|
||||||
|
void setBrightness(int brightness);
|
||||||
|
|
||||||
|
int contrast() const;
|
||||||
|
void setContrast(int contrast);
|
||||||
|
|
||||||
|
int hue() const;
|
||||||
|
void setHue(int hue);
|
||||||
|
|
||||||
|
int saturation() const;
|
||||||
|
void setSaturation(int saturation);
|
||||||
|
|
||||||
|
bool processSyncMessage(const QGstreamerMessage &message);
|
||||||
|
bool processBusMessage(const QGstreamerMessage &message);
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void nativeVideoSizeChanged();
|
||||||
|
void activeChanged();
|
||||||
|
void brightnessChanged(int brightness);
|
||||||
|
void contrastChanged(int contrast);
|
||||||
|
void hueChanged(int hue);
|
||||||
|
void saturationChanged(int saturation);
|
||||||
|
|
||||||
|
private:
|
||||||
|
GstElement *findBestVideoSink() const;
|
||||||
|
void setWindowHandle_helper(WId id);
|
||||||
|
void updateIsActive();
|
||||||
|
void probeCaps(GstCaps *caps);
|
||||||
|
static void showPrerollFrameChanged(GObject *, GParamSpec *, QGstreamerVideoOverlay *);
|
||||||
|
|
||||||
|
GstElement *m_videoSink;
|
||||||
|
QSize m_nativeVideoSize;
|
||||||
|
bool m_isActive;
|
||||||
|
|
||||||
|
bool m_hasForceAspectRatio;
|
||||||
|
bool m_hasBrightness;
|
||||||
|
bool m_hasContrast;
|
||||||
|
bool m_hasHue;
|
||||||
|
bool m_hasSaturation;
|
||||||
|
bool m_hasShowPrerollFrame;
|
||||||
|
|
||||||
|
WId m_windowId;
|
||||||
|
Qt::AspectRatioMode m_aspectRatioMode;
|
||||||
|
int m_brightness;
|
||||||
|
int m_contrast;
|
||||||
|
int m_hue;
|
||||||
|
int m_saturation;
|
||||||
|
};
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // QGSTREAMERVIDEOOVERLAY_P_H
|
||||||
|
|
||||||
@@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
#include "qgstreamervideorendererinterface_p.h"
|
#include "qgstreamervideorendererinterface_p.h"
|
||||||
#include <private/qgstreamerbushelper_p.h>
|
#include <private/qgstreamerbushelper_p.h>
|
||||||
|
#include <private/qgstreamervideooverlay_p.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@@ -52,13 +53,15 @@ class QGstreamerVideoWidgetControl
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(QGstreamerVideoRendererInterface QGstreamerSyncMessageFilter QGstreamerBusMessageFilter)
|
Q_INTERFACES(QGstreamerVideoRendererInterface QGstreamerSyncMessageFilter QGstreamerBusMessageFilter)
|
||||||
public:
|
public:
|
||||||
QGstreamerVideoWidgetControl(QObject *parent = 0);
|
explicit QGstreamerVideoWidgetControl(QObject *parent = 0, const QByteArray &elementName = QByteArray());
|
||||||
virtual ~QGstreamerVideoWidgetControl();
|
virtual ~QGstreamerVideoWidgetControl();
|
||||||
|
|
||||||
GstElement *videoSink();
|
GstElement *videoSink();
|
||||||
|
|
||||||
QWidget *videoWidget();
|
QWidget *videoWidget();
|
||||||
|
|
||||||
|
void stopRenderer();
|
||||||
|
|
||||||
Qt::AspectRatioMode aspectRatioMode() const;
|
Qt::AspectRatioMode aspectRatioMode() const;
|
||||||
void setAspectRatioMode(Qt::AspectRatioMode mode);
|
void setAspectRatioMode(Qt::AspectRatioMode mode);
|
||||||
|
|
||||||
@@ -77,27 +80,27 @@ public:
|
|||||||
int saturation() const;
|
int saturation() const;
|
||||||
void setSaturation(int saturation);
|
void setSaturation(int saturation);
|
||||||
|
|
||||||
void setOverlay();
|
|
||||||
|
|
||||||
bool eventFilter(QObject *object, QEvent *event);
|
bool eventFilter(QObject *object, QEvent *event);
|
||||||
bool processSyncMessage(const QGstreamerMessage &message);
|
|
||||||
bool processBusMessage(const QGstreamerMessage &message);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void updateNativeVideoSize();
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sinkChanged();
|
void sinkChanged();
|
||||||
void readyChanged(bool);
|
void readyChanged(bool);
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void onOverlayActiveChanged();
|
||||||
|
void onNativeVideoSizeChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createVideoWidget();
|
void createVideoWidget();
|
||||||
void windowExposed();
|
void updateWidgetAttributes();
|
||||||
|
|
||||||
GstElement *m_videoSink;
|
bool processSyncMessage(const QGstreamerMessage &message);
|
||||||
|
bool processBusMessage(const QGstreamerMessage &message);
|
||||||
|
|
||||||
|
QGstreamerVideoOverlay m_videoOverlay;
|
||||||
QGstreamerVideoWidget *m_widget;
|
QGstreamerVideoWidget *m_widget;
|
||||||
|
bool m_stopped;
|
||||||
WId m_windowId;
|
WId m_windowId;
|
||||||
Qt::AspectRatioMode m_aspectRatioMode;
|
|
||||||
bool m_fullScreen;
|
bool m_fullScreen;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -38,23 +38,22 @@
|
|||||||
|
|
||||||
#include "qgstreamervideorendererinterface_p.h"
|
#include "qgstreamervideorendererinterface_p.h"
|
||||||
#include <private/qgstreamerbushelper_p.h>
|
#include <private/qgstreamerbushelper_p.h>
|
||||||
#include <private/qgstreamerbufferprobe_p.h>
|
#include <private/qgstreamervideooverlay_p.h>
|
||||||
#include <QtGui/qcolor.h>
|
#include <QtGui/qcolor.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QAbstractVideoSurface;
|
class QAbstractVideoSurface;
|
||||||
|
|
||||||
class QGstreamerVideoWindow : public QVideoWindowControl,
|
class QGstreamerVideoWindow :
|
||||||
|
public QVideoWindowControl,
|
||||||
public QGstreamerVideoRendererInterface,
|
public QGstreamerVideoRendererInterface,
|
||||||
public QGstreamerSyncMessageFilter,
|
public QGstreamerSyncMessageFilter,
|
||||||
private QGstreamerBufferProbe
|
public QGstreamerBusMessageFilter
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(QGstreamerVideoRendererInterface QGstreamerSyncMessageFilter)
|
Q_INTERFACES(QGstreamerVideoRendererInterface QGstreamerSyncMessageFilter QGstreamerBusMessageFilter)
|
||||||
Q_PROPERTY(QColor colorKey READ colorKey WRITE setColorKey)
|
|
||||||
Q_PROPERTY(bool autopaintColorKey READ autopaintColorKey WRITE setAutopaintColorKey)
|
|
||||||
public:
|
public:
|
||||||
QGstreamerVideoWindow(QObject *parent = 0, const char *elementName = 0);
|
explicit QGstreamerVideoWindow(QObject *parent = 0, const QByteArray &elementName = QByteArray());
|
||||||
~QGstreamerVideoWindow();
|
~QGstreamerVideoWindow();
|
||||||
|
|
||||||
WId winId() const;
|
WId winId() const;
|
||||||
@@ -71,12 +70,6 @@ public:
|
|||||||
Qt::AspectRatioMode aspectRatioMode() const;
|
Qt::AspectRatioMode aspectRatioMode() const;
|
||||||
void setAspectRatioMode(Qt::AspectRatioMode mode);
|
void setAspectRatioMode(Qt::AspectRatioMode mode);
|
||||||
|
|
||||||
QColor colorKey() const;
|
|
||||||
void setColorKey(const QColor &);
|
|
||||||
|
|
||||||
bool autopaintColorKey() const;
|
|
||||||
void setAutopaintColorKey(bool);
|
|
||||||
|
|
||||||
void repaint();
|
void repaint();
|
||||||
|
|
||||||
int brightness() const;
|
int brightness() const;
|
||||||
@@ -96,24 +89,18 @@ public:
|
|||||||
GstElement *videoSink();
|
GstElement *videoSink();
|
||||||
|
|
||||||
bool processSyncMessage(const QGstreamerMessage &message);
|
bool processSyncMessage(const QGstreamerMessage &message);
|
||||||
|
bool processBusMessage(const QGstreamerMessage &message);
|
||||||
bool isReady() const { return m_windowId != 0; }
|
bool isReady() const { return m_windowId != 0; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sinkChanged();
|
void sinkChanged();
|
||||||
void readyChanged(bool);
|
void readyChanged(bool);
|
||||||
|
|
||||||
private slots:
|
|
||||||
void updateNativeVideoSize(const QSize &size);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void probeCaps(GstCaps *caps);
|
QGstreamerVideoOverlay m_videoOverlay;
|
||||||
|
|
||||||
GstElement *m_videoSink;
|
|
||||||
WId m_windowId;
|
WId m_windowId;
|
||||||
Qt::AspectRatioMode m_aspectRatioMode;
|
|
||||||
QRect m_displayRect;
|
QRect m_displayRect;
|
||||||
bool m_fullScreen;
|
bool m_fullScreen;
|
||||||
QSize m_nativeSize;
|
|
||||||
mutable QColor m_colorKey;
|
mutable QColor m_colorKey;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -61,11 +61,13 @@
|
|||||||
# define QT_GSTREAMER_CAMERABIN_ELEMENT_NAME "camerabin"
|
# define QT_GSTREAMER_CAMERABIN_ELEMENT_NAME "camerabin"
|
||||||
# define QT_GSTREAMER_COLORCONVERSION_ELEMENT_NAME "videoconvert"
|
# define QT_GSTREAMER_COLORCONVERSION_ELEMENT_NAME "videoconvert"
|
||||||
# define QT_GSTREAMER_RAW_AUDIO_MIME "audio/x-raw"
|
# define QT_GSTREAMER_RAW_AUDIO_MIME "audio/x-raw"
|
||||||
|
# define QT_GSTREAMER_VIDEOOVERLAY_INTERFACE_NAME "GstVideoOverlay"
|
||||||
#else
|
#else
|
||||||
# define QT_GSTREAMER_PLAYBIN_ELEMENT_NAME "playbin2"
|
# define QT_GSTREAMER_PLAYBIN_ELEMENT_NAME "playbin2"
|
||||||
# define QT_GSTREAMER_CAMERABIN_ELEMENT_NAME "camerabin2"
|
# define QT_GSTREAMER_CAMERABIN_ELEMENT_NAME "camerabin2"
|
||||||
# define QT_GSTREAMER_COLORCONVERSION_ELEMENT_NAME "ffmpegcolorspace"
|
# define QT_GSTREAMER_COLORCONVERSION_ELEMENT_NAME "ffmpegcolorspace"
|
||||||
# define QT_GSTREAMER_RAW_AUDIO_MIME "audio/x-raw-int"
|
# define QT_GSTREAMER_RAW_AUDIO_MIME "audio/x-raw-int"
|
||||||
|
# define QT_GSTREAMER_VIDEOOVERLAY_INTERFACE_NAME "GstXOverlay"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@@ -147,6 +149,7 @@ GstStructure *qt_gst_structure_new_empty(const char *name);
|
|||||||
gboolean qt_gst_element_query_position(GstElement *element, GstFormat format, gint64 *cur);
|
gboolean qt_gst_element_query_position(GstElement *element, GstFormat format, gint64 *cur);
|
||||||
gboolean qt_gst_element_query_duration(GstElement *element, GstFormat format, gint64 *cur);
|
gboolean qt_gst_element_query_duration(GstElement *element, GstFormat format, gint64 *cur);
|
||||||
GstCaps *qt_gst_caps_normalize(GstCaps *caps);
|
GstCaps *qt_gst_caps_normalize(GstCaps *caps);
|
||||||
|
const gchar *qt_gst_element_get_factory_name(GstElement *element);
|
||||||
|
|
||||||
QDebug operator <<(QDebug debug, GstCaps *caps);
|
QDebug operator <<(QDebug debug, GstCaps *caps);
|
||||||
|
|
||||||
|
|||||||
@@ -468,6 +468,7 @@ void QMediaPlayerPrivate::disconnectPlaylist()
|
|||||||
QObject::disconnect(playlist, SIGNAL(currentMediaChanged(QMediaContent)),
|
QObject::disconnect(playlist, SIGNAL(currentMediaChanged(QMediaContent)),
|
||||||
q, SLOT(_q_updateMedia(QMediaContent)));
|
q, SLOT(_q_updateMedia(QMediaContent)));
|
||||||
QObject::disconnect(playlist, SIGNAL(destroyed()), q, SLOT(_q_playlistDestroyed()));
|
QObject::disconnect(playlist, SIGNAL(destroyed()), q, SLOT(_q_playlistDestroyed()));
|
||||||
|
q->unbind(playlist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -475,6 +476,7 @@ void QMediaPlayerPrivate::connectPlaylist()
|
|||||||
{
|
{
|
||||||
Q_Q(QMediaPlayer);
|
Q_Q(QMediaPlayer);
|
||||||
if (playlist) {
|
if (playlist) {
|
||||||
|
q->bind(playlist);
|
||||||
QObject::connect(playlist, SIGNAL(currentMediaChanged(QMediaContent)),
|
QObject::connect(playlist, SIGNAL(currentMediaChanged(QMediaContent)),
|
||||||
q, SLOT(_q_updateMedia(QMediaContent)));
|
q, SLOT(_q_updateMedia(QMediaContent)));
|
||||||
QObject::connect(playlist, SIGNAL(destroyed()), q, SLOT(_q_playlistDestroyed()));
|
QObject::connect(playlist, SIGNAL(destroyed()), q, SLOT(_q_playlistDestroyed()));
|
||||||
@@ -622,6 +624,8 @@ QMediaPlayer::~QMediaPlayer()
|
|||||||
{
|
{
|
||||||
Q_D(QMediaPlayer);
|
Q_D(QMediaPlayer);
|
||||||
|
|
||||||
|
d->disconnectPlaylist();
|
||||||
|
|
||||||
if (d->service) {
|
if (d->service) {
|
||||||
if (d->control)
|
if (d->control)
|
||||||
d->service->releaseControl(d->control);
|
d->service->releaseControl(d->control);
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ Q_CONSTRUCTOR_FUNCTION(qRegisterMediaPlaylistMetaTypes)
|
|||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Create a new playlist object for with the given \a parent.
|
Create a new playlist object with the given \a parent.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QMediaPlaylist::QMediaPlaylist(QObject *parent)
|
QMediaPlaylist::QMediaPlaylist(QObject *parent)
|
||||||
@@ -214,8 +214,10 @@ bool QMediaPlaylist::setMediaObject(QMediaObject *mediaObject)
|
|||||||
connect(d->control, SIGNAL(currentMediaChanged(QMediaContent)),
|
connect(d->control, SIGNAL(currentMediaChanged(QMediaContent)),
|
||||||
this, SIGNAL(currentMediaChanged(QMediaContent)));
|
this, SIGNAL(currentMediaChanged(QMediaContent)));
|
||||||
|
|
||||||
if (oldSize)
|
if (oldSize) {
|
||||||
|
emit mediaAboutToBeRemoved(0, oldSize-1);
|
||||||
emit mediaRemoved(0, oldSize-1);
|
emit mediaRemoved(0, oldSize-1);
|
||||||
|
}
|
||||||
|
|
||||||
if (playlist->mediaCount()) {
|
if (playlist->mediaCount()) {
|
||||||
emit mediaAboutToBeInserted(0,playlist->mediaCount()-1);
|
emit mediaAboutToBeInserted(0,playlist->mediaCount()-1);
|
||||||
@@ -302,7 +304,7 @@ int QMediaPlaylist::mediaCount() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns true if the playlist contains no items; otherwise returns false.
|
Returns true if the playlist contains no items, otherwise returns false.
|
||||||
|
|
||||||
\sa mediaCount()
|
\sa mediaCount()
|
||||||
*/
|
*/
|
||||||
@@ -312,7 +314,7 @@ bool QMediaPlaylist::isEmpty() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns true if the playlist can be modified; otherwise returns false.
|
Returns true if the playlist can be modified, otherwise returns false.
|
||||||
|
|
||||||
\sa mediaCount()
|
\sa mediaCount()
|
||||||
*/
|
*/
|
||||||
@@ -333,7 +335,7 @@ QMediaContent QMediaPlaylist::media(int index) const
|
|||||||
/*!
|
/*!
|
||||||
Append the media \a content to the playlist.
|
Append the media \a content to the playlist.
|
||||||
|
|
||||||
Returns true if the operation is successful, otherwise return false.
|
Returns true if the operation is successful, otherwise returns false.
|
||||||
*/
|
*/
|
||||||
bool QMediaPlaylist::addMedia(const QMediaContent &content)
|
bool QMediaPlaylist::addMedia(const QMediaContent &content)
|
||||||
{
|
{
|
||||||
@@ -343,7 +345,7 @@ bool QMediaPlaylist::addMedia(const QMediaContent &content)
|
|||||||
/*!
|
/*!
|
||||||
Append multiple media content \a items to the playlist.
|
Append multiple media content \a items to the playlist.
|
||||||
|
|
||||||
Returns true if the operation is successful, otherwise return false.
|
Returns true if the operation is successful, otherwise returns false.
|
||||||
*/
|
*/
|
||||||
bool QMediaPlaylist::addMedia(const QList<QMediaContent> &items)
|
bool QMediaPlaylist::addMedia(const QList<QMediaContent> &items)
|
||||||
{
|
{
|
||||||
@@ -353,23 +355,25 @@ bool QMediaPlaylist::addMedia(const QList<QMediaContent> &items)
|
|||||||
/*!
|
/*!
|
||||||
Insert the media \a content to the playlist at position \a pos.
|
Insert the media \a content to the playlist at position \a pos.
|
||||||
|
|
||||||
Returns true if the operation is successful, otherwise false.
|
Returns true if the operation is successful, otherwise returns false.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool QMediaPlaylist::insertMedia(int pos, const QMediaContent &content)
|
bool QMediaPlaylist::insertMedia(int pos, const QMediaContent &content)
|
||||||
{
|
{
|
||||||
return d_func()->playlist()->insertMedia(pos, content);
|
QMediaPlaylistProvider *playlist = d_func()->playlist();
|
||||||
|
return playlist->insertMedia(qBound(0, pos, playlist->mediaCount()), content);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Insert multiple media content \a items to the playlist at position \a pos.
|
Insert multiple media content \a items to the playlist at position \a pos.
|
||||||
|
|
||||||
Returns true if the operation is successful, otherwise false.
|
Returns true if the operation is successful, otherwise returns false.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool QMediaPlaylist::insertMedia(int pos, const QList<QMediaContent> &items)
|
bool QMediaPlaylist::insertMedia(int pos, const QList<QMediaContent> &items)
|
||||||
{
|
{
|
||||||
return d_func()->playlist()->insertMedia(pos, items);
|
QMediaPlaylistProvider *playlist = d_func()->playlist();
|
||||||
|
return playlist->insertMedia(qBound(0, pos, playlist->mediaCount()), items);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -379,8 +383,11 @@ bool QMediaPlaylist::insertMedia(int pos, const QList<QMediaContent> &items)
|
|||||||
*/
|
*/
|
||||||
bool QMediaPlaylist::removeMedia(int pos)
|
bool QMediaPlaylist::removeMedia(int pos)
|
||||||
{
|
{
|
||||||
Q_D(QMediaPlaylist);
|
QMediaPlaylistProvider *playlist = d_func()->playlist();
|
||||||
return d->playlist()->removeMedia(pos);
|
if (pos >= 0 && pos < playlist->mediaCount())
|
||||||
|
return playlist->removeMedia(pos);
|
||||||
|
else
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -390,8 +397,13 @@ bool QMediaPlaylist::removeMedia(int pos)
|
|||||||
*/
|
*/
|
||||||
bool QMediaPlaylist::removeMedia(int start, int end)
|
bool QMediaPlaylist::removeMedia(int start, int end)
|
||||||
{
|
{
|
||||||
Q_D(QMediaPlaylist);
|
QMediaPlaylistProvider *playlist = d_func()->playlist();
|
||||||
return d->playlist()->removeMedia(start, end);
|
start = qMax(0, start);
|
||||||
|
end = qMin(end, playlist->mediaCount() - 1);
|
||||||
|
if (start <= end)
|
||||||
|
return playlist->removeMedia(start, end);
|
||||||
|
else
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ public:
|
|||||||
|
|
||||||
virtual QMediaControl* requestControl(const char *name) = 0;
|
virtual QMediaControl* requestControl(const char *name) = 0;
|
||||||
|
|
||||||
#ifndef QT_NO_MEMBER_TEMPLATES
|
|
||||||
template <typename T> inline T requestControl() {
|
template <typename T> inline T requestControl() {
|
||||||
if (QMediaControl *control = requestControl(qmediacontrol_iid<T>())) {
|
if (QMediaControl *control = requestControl(qmediacontrol_iid<T>())) {
|
||||||
if (T typedControl = qobject_cast<T>(control))
|
if (T typedControl = qobject_cast<T>(control))
|
||||||
@@ -62,7 +61,6 @@ public:
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
virtual void releaseControl(QMediaControl *control) = 0;
|
virtual void releaseControl(QMediaControl *control) = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -359,19 +359,14 @@ public:
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case QMediaServiceProviderHint::Device: {
|
case QMediaServiceProviderHint::Device: {
|
||||||
|
plugin = plugins[0];
|
||||||
foreach (QMediaServiceProviderPlugin *currentPlugin, plugins) {
|
foreach (QMediaServiceProviderPlugin *currentPlugin, plugins) {
|
||||||
QMediaServiceSupportedDevicesInterface *iface =
|
QMediaServiceSupportedDevicesInterface *iface =
|
||||||
qobject_cast<QMediaServiceSupportedDevicesInterface*>(currentPlugin);
|
qobject_cast<QMediaServiceSupportedDevicesInterface*>(currentPlugin);
|
||||||
|
|
||||||
if (!iface) {
|
if (iface && iface->devices(type).contains(hint.device())) {
|
||||||
// the plugin may support the device,
|
|
||||||
// but this choice still can be overridden
|
|
||||||
plugin = currentPlugin;
|
plugin = currentPlugin;
|
||||||
} else {
|
break;
|
||||||
if (iface->devices(type).contains(hint.device())) {
|
|
||||||
plugin = currentPlugin;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -887,14 +882,6 @@ QMediaServiceProvider *QMediaServiceProvider::defaultServiceProvider()
|
|||||||
Destroys a media service supported devices interface.
|
Destroys a media service supported devices interface.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
|
||||||
\since 5.3
|
|
||||||
|
|
||||||
\fn QByteArray QMediaServiceSupportedDevicesInterface::defaultDevice(const QByteArray &service) const
|
|
||||||
|
|
||||||
Returns the default device for a \a service type.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn QList<QByteArray> QMediaServiceSupportedDevicesInterface::devices(const QByteArray &service) const
|
\fn QList<QByteArray> QMediaServiceSupportedDevicesInterface::devices(const QByteArray &service) const
|
||||||
|
|
||||||
@@ -907,6 +894,29 @@ QMediaServiceProvider *QMediaServiceProvider::defaultServiceProvider()
|
|||||||
Returns the description of a \a device available for a \a service type.
|
Returns the description of a \a device available for a \a service type.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\class QMediaServiceDefaultDeviceInterface
|
||||||
|
\inmodule QtMultimedia
|
||||||
|
\brief The QMediaServiceDefaultDeviceInterface class interface
|
||||||
|
identifies the default device used by a media service plug-in.
|
||||||
|
|
||||||
|
A QMediaServiceProviderPlugin may implement this interface.
|
||||||
|
|
||||||
|
\since 5.3
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn QMediaServiceDefaultDeviceInterface::~QMediaServiceDefaultDeviceInterface()
|
||||||
|
|
||||||
|
Destroys a media service default device interface.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn QByteArray QMediaServiceDefaultDeviceInterface::defaultDevice(const QByteArray &service) const
|
||||||
|
|
||||||
|
Returns the default device for a \a service type.
|
||||||
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class QMediaServiceCameraInfoInterface
|
\class QMediaServiceCameraInfoInterface
|
||||||
\inmodule QtMultimedia
|
\inmodule QtMultimedia
|
||||||
@@ -918,6 +928,12 @@ QMediaServiceProvider *QMediaServiceProvider::defaultServiceProvider()
|
|||||||
implement the QMediaServiceSupportedDevicesInterface.
|
implement the QMediaServiceSupportedDevicesInterface.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn QMediaServiceCameraInfoInterface::~QMediaServiceCameraInfoInterface()
|
||||||
|
|
||||||
|
Destroys a media service camera info interface.
|
||||||
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn QMediaServiceCameraInfoInterface::cameraPosition(const QByteArray &device) const
|
\fn QMediaServiceCameraInfoInterface::cameraPosition(const QByteArray &device) const
|
||||||
|
|
||||||
|
|||||||
@@ -276,10 +276,13 @@ QAbstractVideoFilter::~QAbstractVideoFilter()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\return \c true if the filter is active.
|
\property QAbstractVideoFilter::active
|
||||||
|
\brief the active status of the filter.
|
||||||
|
|
||||||
By default filters are active. When set to \c false, the filter will be
|
This is true if the filter is active, false otherwise.
|
||||||
ignored by the VideoOutput type.
|
|
||||||
|
By default filters are active. When set to \c false, the filter will be
|
||||||
|
ignored by the VideoOutput type.
|
||||||
*/
|
*/
|
||||||
bool QAbstractVideoFilter::isActive() const
|
bool QAbstractVideoFilter::isActive() const
|
||||||
{
|
{
|
||||||
@@ -287,9 +290,6 @@ bool QAbstractVideoFilter::isActive() const
|
|||||||
return d->active;
|
return d->active;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
\internal
|
|
||||||
*/
|
|
||||||
void QAbstractVideoFilter::setActive(bool v)
|
void QAbstractVideoFilter::setActive(bool v)
|
||||||
{
|
{
|
||||||
Q_D(QAbstractVideoFilter);
|
Q_D(QAbstractVideoFilter);
|
||||||
|
|||||||
@@ -38,63 +38,87 @@ import android.graphics.ImageFormat;
|
|||||||
import android.graphics.SurfaceTexture;
|
import android.graphics.SurfaceTexture;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import java.lang.Math;
|
import java.lang.Math;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
|
||||||
|
|
||||||
public class QtCameraListener implements Camera.ShutterCallback,
|
public class QtCameraListener implements Camera.ShutterCallback,
|
||||||
Camera.PictureCallback,
|
Camera.PictureCallback,
|
||||||
Camera.AutoFocusCallback,
|
Camera.AutoFocusCallback,
|
||||||
Camera.PreviewCallback
|
Camera.PreviewCallback
|
||||||
{
|
{
|
||||||
private int m_cameraId = -1;
|
|
||||||
private byte[][] m_cameraPreviewBuffer = null;
|
|
||||||
private volatile int m_actualPreviewBuffer = 0;
|
|
||||||
private final ReentrantLock m_buffersLock = new ReentrantLock();
|
|
||||||
private boolean m_fetchEachFrame = false;
|
|
||||||
|
|
||||||
private static final String TAG = "Qt Camera";
|
private static final String TAG = "Qt Camera";
|
||||||
|
|
||||||
|
private static final int BUFFER_POOL_SIZE = 2;
|
||||||
|
|
||||||
|
private int m_cameraId = -1;
|
||||||
|
|
||||||
|
private boolean m_notifyNewFrames = false;
|
||||||
|
private byte[][] m_previewBuffers = null;
|
||||||
|
private byte[] m_lastPreviewBuffer = null;
|
||||||
|
private Camera.Size m_previewSize = null;
|
||||||
|
|
||||||
private QtCameraListener(int id)
|
private QtCameraListener(int id)
|
||||||
{
|
{
|
||||||
m_cameraId = id;
|
m_cameraId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void preparePreviewBuffer(Camera camera)
|
public void notifyNewFrames(boolean notify)
|
||||||
{
|
{
|
||||||
Camera.Size previewSize = camera.getParameters().getPreviewSize();
|
m_notifyNewFrames = notify;
|
||||||
double bytesPerPixel = ImageFormat.getBitsPerPixel(camera.getParameters().getPreviewFormat()) / 8.0;
|
|
||||||
int bufferSizeNeeded = (int)Math.ceil(bytesPerPixel*previewSize.width*previewSize.height);
|
|
||||||
m_buffersLock.lock();
|
|
||||||
if (m_cameraPreviewBuffer == null || m_cameraPreviewBuffer[0].length < bufferSizeNeeded)
|
|
||||||
m_cameraPreviewBuffer = new byte[2][bufferSizeNeeded];
|
|
||||||
m_buffersLock.unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fetchEachFrame(boolean fetch)
|
public byte[] lastPreviewBuffer()
|
||||||
{
|
{
|
||||||
m_fetchEachFrame = fetch;
|
return m_lastPreviewBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] lockAndFetchPreviewBuffer()
|
public int previewWidth()
|
||||||
{
|
{
|
||||||
//This method should always be followed by unlockPreviewBuffer()
|
if (m_previewSize == null)
|
||||||
//This method is not just a getter. It also marks last preview as already seen one.
|
return -1;
|
||||||
//We should reset actualBuffer flag here to make sure we will not use old preview with future captures
|
|
||||||
byte[] result = null;
|
return m_previewSize.width;
|
||||||
m_buffersLock.lock();
|
|
||||||
result = m_cameraPreviewBuffer[(m_actualPreviewBuffer == 1) ? 0 : 1];
|
|
||||||
m_actualPreviewBuffer = 0;
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unlockPreviewBuffer()
|
public int previewHeight()
|
||||||
{
|
{
|
||||||
if (m_buffersLock.isHeldByCurrentThread())
|
if (m_previewSize == null)
|
||||||
m_buffersLock.unlock();
|
return -1;
|
||||||
|
|
||||||
|
return m_previewSize.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] callbackBuffer()
|
public void setupPreviewCallback(Camera camera)
|
||||||
{
|
{
|
||||||
return m_cameraPreviewBuffer[(m_actualPreviewBuffer == 1) ? 1 : 0];
|
// Clear previous callback (also clears added buffers)
|
||||||
|
m_lastPreviewBuffer = null;
|
||||||
|
camera.setPreviewCallbackWithBuffer(null);
|
||||||
|
|
||||||
|
final Camera.Parameters params = camera.getParameters();
|
||||||
|
m_previewSize = params.getPreviewSize();
|
||||||
|
double bytesPerPixel = ImageFormat.getBitsPerPixel(params.getPreviewFormat()) / 8.0;
|
||||||
|
int bufferSizeNeeded = (int) Math.ceil(bytesPerPixel * m_previewSize.width * m_previewSize.height);
|
||||||
|
|
||||||
|
// We could keep the same buffers when they are already bigger than the required size
|
||||||
|
// but the Android doc says the size must match, so in doubt just replace them.
|
||||||
|
if (m_previewBuffers == null || m_previewBuffers[0].length != bufferSizeNeeded)
|
||||||
|
m_previewBuffers = new byte[BUFFER_POOL_SIZE][bufferSizeNeeded];
|
||||||
|
|
||||||
|
// Add callback and queue all buffers
|
||||||
|
camera.setPreviewCallbackWithBuffer(this);
|
||||||
|
for (byte[] buffer : m_previewBuffers)
|
||||||
|
camera.addCallbackBuffer(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPreviewFrame(byte[] data, Camera camera)
|
||||||
|
{
|
||||||
|
// Re-enqueue the last buffer
|
||||||
|
if (m_lastPreviewBuffer != null)
|
||||||
|
camera.addCallbackBuffer(m_lastPreviewBuffer);
|
||||||
|
|
||||||
|
m_lastPreviewBuffer = data;
|
||||||
|
|
||||||
|
if (data != null && m_notifyNewFrames)
|
||||||
|
notifyNewPreviewFrame(m_cameraId, data, m_previewSize.width, m_previewSize.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -109,24 +133,6 @@ public class QtCameraListener implements Camera.ShutterCallback,
|
|||||||
notifyPictureCaptured(m_cameraId, data);
|
notifyPictureCaptured(m_cameraId, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPreviewFrame(byte[] data, Camera camera)
|
|
||||||
{
|
|
||||||
m_buffersLock.lock();
|
|
||||||
|
|
||||||
if (data != null && m_fetchEachFrame)
|
|
||||||
notifyFrameFetched(m_cameraId, data);
|
|
||||||
|
|
||||||
if (data == m_cameraPreviewBuffer[0])
|
|
||||||
m_actualPreviewBuffer = 1;
|
|
||||||
else if (data == m_cameraPreviewBuffer[1])
|
|
||||||
m_actualPreviewBuffer = 2;
|
|
||||||
else
|
|
||||||
m_actualPreviewBuffer = 0;
|
|
||||||
camera.addCallbackBuffer(m_cameraPreviewBuffer[(m_actualPreviewBuffer == 1) ? 1 : 0]);
|
|
||||||
m_buffersLock.unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAutoFocus(boolean success, Camera camera)
|
public void onAutoFocus(boolean success, Camera camera)
|
||||||
{
|
{
|
||||||
@@ -136,5 +142,5 @@ public class QtCameraListener implements Camera.ShutterCallback,
|
|||||||
private static native void notifyAutoFocusComplete(int id, boolean success);
|
private static native void notifyAutoFocusComplete(int id, boolean success);
|
||||||
private static native void notifyPictureExposed(int id);
|
private static native void notifyPictureExposed(int id);
|
||||||
private static native void notifyPictureCaptured(int id, byte[] data);
|
private static native void notifyPictureCaptured(int id, byte[] data);
|
||||||
private static native void notifyFrameFetched(int id, byte[] data);
|
private static native void notifyNewPreviewFrame(int id, byte[] data, int width, int height);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -206,9 +206,10 @@ bool QAndroidCameraSession::open()
|
|||||||
|
|
||||||
if (m_camera) {
|
if (m_camera) {
|
||||||
connect(m_camera, SIGNAL(pictureExposed()), this, SLOT(onCameraPictureExposed()));
|
connect(m_camera, SIGNAL(pictureExposed()), this, SLOT(onCameraPictureExposed()));
|
||||||
connect(m_camera, SIGNAL(previewFetched(QByteArray)), this, SLOT(onCameraPreviewFetched(QByteArray)));
|
connect(m_camera, SIGNAL(lastPreviewFrameFetched(QByteArray,int,int)),
|
||||||
connect(m_camera, SIGNAL(frameFetched(QByteArray)),
|
this, SLOT(onLastPreviewFrameFetched(QByteArray,int,int)));
|
||||||
this, SLOT(onCameraFrameFetched(QByteArray)),
|
connect(m_camera, SIGNAL(newPreviewFrame(QByteArray,int,int)),
|
||||||
|
this, SLOT(onNewPreviewFrame(QByteArray,int,int)),
|
||||||
Qt::DirectConnection);
|
Qt::DirectConnection);
|
||||||
connect(m_camera, SIGNAL(pictureCaptured(QByteArray)), this, SLOT(onCameraPictureCaptured(QByteArray)));
|
connect(m_camera, SIGNAL(pictureCaptured(QByteArray)), this, SLOT(onCameraPictureCaptured(QByteArray)));
|
||||||
connect(m_camera, SIGNAL(previewStarted()), this, SLOT(onCameraPreviewStarted()));
|
connect(m_camera, SIGNAL(previewStarted()), this, SLOT(onCameraPreviewStarted()));
|
||||||
@@ -221,7 +222,7 @@ bool QAndroidCameraSession::open()
|
|||||||
if (m_camera->getPreviewFormat() != AndroidCamera::NV21)
|
if (m_camera->getPreviewFormat() != AndroidCamera::NV21)
|
||||||
m_camera->setPreviewFormat(AndroidCamera::NV21);
|
m_camera->setPreviewFormat(AndroidCamera::NV21);
|
||||||
|
|
||||||
m_camera->fetchEachFrame(m_videoProbes.count());
|
m_camera->notifyNewFrames(m_videoProbes.count());
|
||||||
|
|
||||||
emit opened();
|
emit opened();
|
||||||
} else {
|
} else {
|
||||||
@@ -410,7 +411,7 @@ void QAndroidCameraSession::addProbe(QAndroidMediaVideoProbeControl *probe)
|
|||||||
if (probe)
|
if (probe)
|
||||||
m_videoProbes << probe;
|
m_videoProbes << probe;
|
||||||
if (m_camera)
|
if (m_camera)
|
||||||
m_camera->fetchEachFrame(m_videoProbes.count());
|
m_camera->notifyNewFrames(m_videoProbes.count());
|
||||||
m_videoProbesMutex.unlock();
|
m_videoProbesMutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,7 +420,7 @@ void QAndroidCameraSession::removeProbe(QAndroidMediaVideoProbeControl *probe)
|
|||||||
m_videoProbesMutex.lock();
|
m_videoProbesMutex.lock();
|
||||||
m_videoProbes.remove(probe);
|
m_videoProbes.remove(probe);
|
||||||
if (m_camera)
|
if (m_camera)
|
||||||
m_camera->fetchEachFrame(m_videoProbes.count());
|
m_camera->notifyNewFrames(m_videoProbes.count());
|
||||||
m_videoProbesMutex.unlock();
|
m_videoProbesMutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -562,25 +563,54 @@ void QAndroidCameraSession::onCameraPictureExposed()
|
|||||||
m_camera->fetchLastPreviewFrame();
|
m_camera->fetchLastPreviewFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QAndroidCameraSession::onCameraPreviewFetched(const QByteArray &preview)
|
void QAndroidCameraSession::onLastPreviewFrameFetched(const QByteArray &preview, int width, int height)
|
||||||
{
|
{
|
||||||
if (preview.size()) {
|
if (preview.size()) {
|
||||||
QtConcurrent::run(this, &QAndroidCameraSession::processPreviewImage,
|
QtConcurrent::run(this, &QAndroidCameraSession::processPreviewImage,
|
||||||
m_currentImageCaptureId,
|
m_currentImageCaptureId,
|
||||||
preview,
|
preview,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
m_camera->getRotation());
|
m_camera->getRotation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QAndroidCameraSession::onCameraFrameFetched(const QByteArray &frame)
|
void QAndroidCameraSession::processPreviewImage(int id, const QByteArray &data, int width, int height, int rotation)
|
||||||
|
{
|
||||||
|
emit imageCaptured(id, prepareImageFromPreviewData(data, width, height, rotation));
|
||||||
|
}
|
||||||
|
|
||||||
|
QImage QAndroidCameraSession::prepareImageFromPreviewData(const QByteArray &data, int width, int height, int rotation)
|
||||||
|
{
|
||||||
|
QImage result(width, height, QImage::Format_ARGB32);
|
||||||
|
qt_convert_NV21_to_ARGB32((const uchar *)data.constData(),
|
||||||
|
(quint32 *)result.bits(),
|
||||||
|
width,
|
||||||
|
height);
|
||||||
|
|
||||||
|
QTransform transform;
|
||||||
|
|
||||||
|
// Preview display of front-facing cameras is flipped horizontally, but the frame data
|
||||||
|
// we get here is not. Flip it ourselves if the camera is front-facing to match what the user
|
||||||
|
// sees on the viewfinder.
|
||||||
|
if (m_camera->getFacing() == AndroidCamera::CameraFacingFront)
|
||||||
|
transform.scale(-1, 1);
|
||||||
|
|
||||||
|
transform.rotate(rotation);
|
||||||
|
|
||||||
|
result = result.transformed(transform);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QAndroidCameraSession::onNewPreviewFrame(const QByteArray &frame, int width, int height)
|
||||||
{
|
{
|
||||||
m_videoProbesMutex.lock();
|
m_videoProbesMutex.lock();
|
||||||
if (frame.size() && m_videoProbes.count()) {
|
if (frame.size() && m_videoProbes.count()) {
|
||||||
const QSize frameSize = m_camera->previewSize();
|
|
||||||
// Bytes per line should be only for the first plane. For NV21, the Y plane has 8 bits
|
// Bytes per line should be only for the first plane. For NV21, the Y plane has 8 bits
|
||||||
// per sample, so bpl == width
|
// per sample, so bpl == width
|
||||||
QVideoFrame videoFrame(new DataVideoBuffer(frame, frameSize.width()),
|
QVideoFrame videoFrame(new DataVideoBuffer(frame, width),
|
||||||
frameSize,
|
QSize(width, height),
|
||||||
QVideoFrame::Format_NV21);
|
QVideoFrame::Format_NV21);
|
||||||
foreach (QAndroidMediaVideoProbeControl *probe, m_videoProbes)
|
foreach (QAndroidMediaVideoProbeControl *probe, m_videoProbes)
|
||||||
probe->newFrameProbed(videoFrame);
|
probe->newFrameProbed(videoFrame);
|
||||||
@@ -666,35 +696,6 @@ void QAndroidCameraSession::processCapturedImage(int id,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QAndroidCameraSession::processPreviewImage(int id, const QByteArray &data, int rotation)
|
|
||||||
{
|
|
||||||
emit imageCaptured(id, prepareImageFromPreviewData(data, rotation));
|
|
||||||
}
|
|
||||||
|
|
||||||
QImage QAndroidCameraSession::prepareImageFromPreviewData(const QByteArray &data, int rotation)
|
|
||||||
{
|
|
||||||
QSize frameSize = m_camera->previewSize();
|
|
||||||
QImage result(frameSize, QImage::Format_ARGB32);
|
|
||||||
qt_convert_NV21_to_ARGB32((const uchar *)data.constData(),
|
|
||||||
(quint32 *)result.bits(),
|
|
||||||
frameSize.width(),
|
|
||||||
frameSize.height());
|
|
||||||
|
|
||||||
QTransform transform;
|
|
||||||
|
|
||||||
// Preview display of front-facing cameras is flipped horizontally, but the frame data
|
|
||||||
// we get here is not. Flip it ourselves if the camera is front-facing to match what the user
|
|
||||||
// sees on the viewfinder.
|
|
||||||
if (m_camera->getFacing() == AndroidCamera::CameraFacingFront)
|
|
||||||
transform.scale(-1, 1);
|
|
||||||
|
|
||||||
transform.rotate(rotation);
|
|
||||||
|
|
||||||
result = result.transformed(transform);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QAndroidCameraSession::onVideoOutputReady(bool ready)
|
void QAndroidCameraSession::onVideoOutputReady(bool ready)
|
||||||
{
|
{
|
||||||
if (ready && m_state == QCamera::ActiveState)
|
if (ready && m_state == QCamera::ActiveState)
|
||||||
|
|||||||
@@ -113,9 +113,9 @@ private Q_SLOTS:
|
|||||||
void onApplicationStateChanged(Qt::ApplicationState state);
|
void onApplicationStateChanged(Qt::ApplicationState state);
|
||||||
|
|
||||||
void onCameraPictureExposed();
|
void onCameraPictureExposed();
|
||||||
void onCameraPreviewFetched(const QByteArray &preview);
|
|
||||||
void onCameraFrameFetched(const QByteArray &frame);
|
|
||||||
void onCameraPictureCaptured(const QByteArray &data);
|
void onCameraPictureCaptured(const QByteArray &data);
|
||||||
|
void onLastPreviewFrameFetched(const QByteArray &preview, int width, int height);
|
||||||
|
void onNewPreviewFrame(const QByteArray &frame, int width, int height);
|
||||||
void onCameraPreviewStarted();
|
void onCameraPreviewStarted();
|
||||||
void onCameraPreviewStopped();
|
void onCameraPreviewStopped();
|
||||||
|
|
||||||
@@ -129,8 +129,8 @@ private:
|
|||||||
void stopPreview();
|
void stopPreview();
|
||||||
|
|
||||||
void applyImageSettings();
|
void applyImageSettings();
|
||||||
void processPreviewImage(int id, const QByteArray &data, int rotation);
|
void processPreviewImage(int id, const QByteArray &data, int width, int height, int rotation);
|
||||||
QImage prepareImageFromPreviewData(const QByteArray &data, int rotation);
|
QImage prepareImageFromPreviewData(const QByteArray &data, int width, int height, int rotation);
|
||||||
void processCapturedImage(int id,
|
void processCapturedImage(int id,
|
||||||
const QByteArray &data,
|
const QByteArray &data,
|
||||||
const QSize &resolution,
|
const QSize &resolution,
|
||||||
|
|||||||
@@ -233,9 +233,14 @@ void QAndroidCaptureSession::start()
|
|||||||
m_notifyTimer.start();
|
m_notifyTimer.start();
|
||||||
updateDuration();
|
updateDuration();
|
||||||
|
|
||||||
if (m_cameraSession)
|
if (m_cameraSession) {
|
||||||
m_cameraSession->setReadyForCapture(false);
|
m_cameraSession->setReadyForCapture(false);
|
||||||
|
|
||||||
|
// Preview frame callback is cleared when setting up the camera with the media recorder.
|
||||||
|
// We need to reset it.
|
||||||
|
m_cameraSession->camera()->setupPreviewFrameCallback();
|
||||||
|
}
|
||||||
|
|
||||||
m_state = QMediaRecorder::RecordingState;
|
m_state = QMediaRecorder::RecordingState;
|
||||||
emit stateChanged(m_state);
|
emit stateChanged(m_state);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ static void notifyPictureCaptured(JNIEnv *env, jobject, int id, jbyteArray data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void notifyFrameFetched(JNIEnv *env, jobject, int id, jbyteArray data)
|
static void notifyNewPreviewFrame(JNIEnv *env, jobject, int id, jbyteArray data, int width, int height)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&g_cameraMapMutex);
|
QMutexLocker locker(&g_cameraMapMutex);
|
||||||
AndroidCamera *obj = g_cameraMap->value(id, 0);
|
AndroidCamera *obj = g_cameraMap->value(id, 0);
|
||||||
@@ -123,7 +123,7 @@ static void notifyFrameFetched(JNIEnv *env, jobject, int id, jbyteArray data)
|
|||||||
QByteArray bytes(arrayLength, Qt::Uninitialized);
|
QByteArray bytes(arrayLength, Qt::Uninitialized);
|
||||||
env->GetByteArrayRegion(data, 0, arrayLength, (jbyte*)bytes.data());
|
env->GetByteArrayRegion(data, 0, arrayLength, (jbyte*)bytes.data());
|
||||||
|
|
||||||
Q_EMIT obj->frameFetched(bytes);
|
Q_EMIT obj->newPreviewFrame(bytes, width, height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,7 +204,8 @@ public:
|
|||||||
|
|
||||||
Q_INVOKABLE void takePicture();
|
Q_INVOKABLE void takePicture();
|
||||||
|
|
||||||
Q_INVOKABLE void fetchEachFrame(bool fetch);
|
Q_INVOKABLE void setupPreviewFrameCallback();
|
||||||
|
Q_INVOKABLE void notifyNewFrames(bool notify);
|
||||||
Q_INVOKABLE void fetchLastPreviewFrame();
|
Q_INVOKABLE void fetchLastPreviewFrame();
|
||||||
|
|
||||||
Q_INVOKABLE void applyParameters();
|
Q_INVOKABLE void applyParameters();
|
||||||
@@ -229,7 +230,7 @@ Q_SIGNALS:
|
|||||||
|
|
||||||
void whiteBalanceChanged();
|
void whiteBalanceChanged();
|
||||||
|
|
||||||
void previewFetched(const QByteArray &preview);
|
void lastPreviewFrameFetched(const QByteArray &preview, int width, int height);
|
||||||
};
|
};
|
||||||
|
|
||||||
AndroidCamera::AndroidCamera(AndroidCameraPrivate *d, QThread *worker)
|
AndroidCamera::AndroidCamera(AndroidCameraPrivate *d, QThread *worker)
|
||||||
@@ -247,7 +248,7 @@ AndroidCamera::AndroidCamera(AndroidCameraPrivate *d, QThread *worker)
|
|||||||
connect(d, &AndroidCameraPrivate::previewStopped, this, &AndroidCamera::previewStopped);
|
connect(d, &AndroidCameraPrivate::previewStopped, this, &AndroidCamera::previewStopped);
|
||||||
connect(d, &AndroidCameraPrivate::autoFocusStarted, this, &AndroidCamera::autoFocusStarted);
|
connect(d, &AndroidCameraPrivate::autoFocusStarted, this, &AndroidCamera::autoFocusStarted);
|
||||||
connect(d, &AndroidCameraPrivate::whiteBalanceChanged, this, &AndroidCamera::whiteBalanceChanged);
|
connect(d, &AndroidCameraPrivate::whiteBalanceChanged, this, &AndroidCamera::whiteBalanceChanged);
|
||||||
connect(d, &AndroidCameraPrivate::previewFetched, this, &AndroidCamera::previewFetched);
|
connect(d, &AndroidCameraPrivate::lastPreviewFrameFetched, this, &AndroidCamera::lastPreviewFrameFetched);
|
||||||
}
|
}
|
||||||
|
|
||||||
AndroidCamera::~AndroidCamera()
|
AndroidCamera::~AndroidCamera()
|
||||||
@@ -633,10 +634,16 @@ void AndroidCamera::takePicture()
|
|||||||
QMetaObject::invokeMethod(d, "takePicture", Qt::BlockingQueuedConnection);
|
QMetaObject::invokeMethod(d, "takePicture", Qt::BlockingQueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidCamera::fetchEachFrame(bool fetch)
|
void AndroidCamera::setupPreviewFrameCallback()
|
||||||
{
|
{
|
||||||
Q_D(AndroidCamera);
|
Q_D(AndroidCamera);
|
||||||
QMetaObject::invokeMethod(d, "fetchEachFrame", Q_ARG(bool, fetch));
|
QMetaObject::invokeMethod(d, "setupPreviewFrameCallback");
|
||||||
|
}
|
||||||
|
|
||||||
|
void AndroidCamera::notifyNewFrames(bool notify)
|
||||||
|
{
|
||||||
|
Q_D(AndroidCamera);
|
||||||
|
QMetaObject::invokeMethod(d, "notifyNewFrames", Q_ARG(bool, notify));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidCamera::fetchLastPreviewFrame()
|
void AndroidCamera::fetchLastPreviewFrame()
|
||||||
@@ -1307,17 +1314,7 @@ void AndroidCameraPrivate::setJpegQuality(int quality)
|
|||||||
|
|
||||||
void AndroidCameraPrivate::startPreview()
|
void AndroidCameraPrivate::startPreview()
|
||||||
{
|
{
|
||||||
//We need to clear preview buffers queue here, but there is no method to do it
|
setupPreviewFrameCallback();
|
||||||
//Though just resetting preview callback do the trick
|
|
||||||
m_camera.callMethod<void>("setPreviewCallbackWithBuffer",
|
|
||||||
"(Landroid/hardware/Camera$PreviewCallback;)V",
|
|
||||||
jobject(0));
|
|
||||||
m_cameraListener.callMethod<void>("preparePreviewBuffer", "(Landroid/hardware/Camera;)V", m_camera.object());
|
|
||||||
QJNIObjectPrivate buffer = m_cameraListener.callObjectMethod<jbyteArray>("callbackBuffer");
|
|
||||||
m_camera.callMethod<void>("addCallbackBuffer", "([B)V", buffer.object());
|
|
||||||
m_camera.callMethod<void>("setPreviewCallbackWithBuffer",
|
|
||||||
"(Landroid/hardware/Camera$PreviewCallback;)V",
|
|
||||||
m_cameraListener.object());
|
|
||||||
m_camera.callMethod<void>("startPreview");
|
m_camera.callMethod<void>("startPreview");
|
||||||
emit previewStarted();
|
emit previewStarted();
|
||||||
}
|
}
|
||||||
@@ -1338,28 +1335,34 @@ void AndroidCameraPrivate::takePicture()
|
|||||||
m_cameraListener.object());
|
m_cameraListener.object());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidCameraPrivate::fetchEachFrame(bool fetch)
|
void AndroidCameraPrivate::setupPreviewFrameCallback()
|
||||||
{
|
{
|
||||||
m_cameraListener.callMethod<void>("fetchEachFrame", "(Z)V", fetch);
|
m_cameraListener.callMethod<void>("setupPreviewCallback", "(Landroid/hardware/Camera;)V", m_camera.object());
|
||||||
|
}
|
||||||
|
|
||||||
|
void AndroidCameraPrivate::notifyNewFrames(bool notify)
|
||||||
|
{
|
||||||
|
m_cameraListener.callMethod<void>("notifyNewFrames", "(Z)V", notify);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidCameraPrivate::fetchLastPreviewFrame()
|
void AndroidCameraPrivate::fetchLastPreviewFrame()
|
||||||
{
|
{
|
||||||
QJNIEnvironmentPrivate env;
|
QJNIEnvironmentPrivate env;
|
||||||
QJNIObjectPrivate data = m_cameraListener.callObjectMethod("lockAndFetchPreviewBuffer", "()[B");
|
QJNIObjectPrivate data = m_cameraListener.callObjectMethod("lastPreviewBuffer", "()[B");
|
||||||
if (!data.isValid()) {
|
|
||||||
m_cameraListener.callMethod<void>("unlockPreviewBuffer");
|
if (!data.isValid())
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
const int arrayLength = env->GetArrayLength(static_cast<jbyteArray>(data.object()));
|
const int arrayLength = env->GetArrayLength(static_cast<jbyteArray>(data.object()));
|
||||||
QByteArray bytes(arrayLength, Qt::Uninitialized);
|
QByteArray bytes(arrayLength, Qt::Uninitialized);
|
||||||
env->GetByteArrayRegion(static_cast<jbyteArray>(data.object()),
|
env->GetByteArrayRegion(static_cast<jbyteArray>(data.object()),
|
||||||
0,
|
0,
|
||||||
arrayLength,
|
arrayLength,
|
||||||
reinterpret_cast<jbyte *>(bytes.data()));
|
reinterpret_cast<jbyte *>(bytes.data()));
|
||||||
m_cameraListener.callMethod<void>("unlockPreviewBuffer");
|
|
||||||
|
|
||||||
emit previewFetched(bytes);
|
emit lastPreviewFrameFetched(bytes,
|
||||||
|
m_cameraListener.callMethod<jint>("previewWidth"),
|
||||||
|
m_cameraListener.callMethod<jint>("previewHeight"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidCameraPrivate::applyParameters()
|
void AndroidCameraPrivate::applyParameters()
|
||||||
@@ -1404,7 +1407,7 @@ bool AndroidCamera::initJNI(JNIEnv *env)
|
|||||||
{"notifyAutoFocusComplete", "(IZ)V", (void *)notifyAutoFocusComplete},
|
{"notifyAutoFocusComplete", "(IZ)V", (void *)notifyAutoFocusComplete},
|
||||||
{"notifyPictureExposed", "(I)V", (void *)notifyPictureExposed},
|
{"notifyPictureExposed", "(I)V", (void *)notifyPictureExposed},
|
||||||
{"notifyPictureCaptured", "(I[B)V", (void *)notifyPictureCaptured},
|
{"notifyPictureCaptured", "(I[B)V", (void *)notifyPictureCaptured},
|
||||||
{"notifyFrameFetched", "(I[B)V", (void *)notifyFrameFetched}
|
{"notifyNewPreviewFrame", "(I[BII)V", (void *)notifyNewPreviewFrame}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (clazz && env->RegisterNatives(clazz,
|
if (clazz && env->RegisterNatives(clazz,
|
||||||
|
|||||||
@@ -155,7 +155,8 @@ public:
|
|||||||
|
|
||||||
void takePicture();
|
void takePicture();
|
||||||
|
|
||||||
void fetchEachFrame(bool fetch);
|
void setupPreviewFrameCallback();
|
||||||
|
void notifyNewFrames(bool notify);
|
||||||
void fetchLastPreviewFrame();
|
void fetchLastPreviewFrame();
|
||||||
QJNIObjectPrivate getCameraObject();
|
QJNIObjectPrivate getCameraObject();
|
||||||
|
|
||||||
@@ -176,8 +177,8 @@ Q_SIGNALS:
|
|||||||
|
|
||||||
void pictureExposed();
|
void pictureExposed();
|
||||||
void pictureCaptured(const QByteArray &data);
|
void pictureCaptured(const QByteArray &data);
|
||||||
void previewFetched(const QByteArray &preview);
|
void lastPreviewFrameFetched(const QByteArray &preview, int width, int height);
|
||||||
void frameFetched(const QByteArray &frame);
|
void newPreviewFrame(const QByteArray &frame, int width, int height);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AndroidCamera(AndroidCameraPrivate *d, QThread *worker);
|
AndroidCamera(AndroidCameraPrivate *d, QThread *worker);
|
||||||
|
|||||||
@@ -646,7 +646,8 @@ bool DSCameraSession::configurePreviewFormat()
|
|||||||
if ((m_viewfinderSettings.resolution().isEmpty() || m_viewfinderSettings.resolution() == s.resolution())
|
if ((m_viewfinderSettings.resolution().isEmpty() || m_viewfinderSettings.resolution() == s.resolution())
|
||||||
&& (qFuzzyIsNull(m_viewfinderSettings.minimumFrameRate()) || qFuzzyCompare((float)m_viewfinderSettings.minimumFrameRate(), (float)s.minimumFrameRate()))
|
&& (qFuzzyIsNull(m_viewfinderSettings.minimumFrameRate()) || qFuzzyCompare((float)m_viewfinderSettings.minimumFrameRate(), (float)s.minimumFrameRate()))
|
||||||
&& (qFuzzyIsNull(m_viewfinderSettings.maximumFrameRate()) || qFuzzyCompare((float)m_viewfinderSettings.maximumFrameRate(), (float)s.maximumFrameRate()))
|
&& (qFuzzyIsNull(m_viewfinderSettings.maximumFrameRate()) || qFuzzyCompare((float)m_viewfinderSettings.maximumFrameRate(), (float)s.maximumFrameRate()))
|
||||||
&& (m_viewfinderSettings.pixelFormat() == QVideoFrame::Format_Invalid || m_viewfinderSettings.pixelFormat() == s.pixelFormat())) {
|
&& (m_viewfinderSettings.pixelFormat() == QVideoFrame::Format_Invalid || m_viewfinderSettings.pixelFormat() == s.pixelFormat())
|
||||||
|
&& (m_viewfinderSettings.pixelAspectRatio().isEmpty() || m_viewfinderSettings.pixelAspectRatio() == s.pixelAspectRatio())) {
|
||||||
resolvedViewfinderSettings = s;
|
resolvedViewfinderSettings = s;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -899,6 +900,7 @@ void DSCameraSession::updateSourceCapabilities()
|
|||||||
settings.setMinimumFrameRate(frameRateRange.minimumFrameRate);
|
settings.setMinimumFrameRate(frameRateRange.minimumFrameRate);
|
||||||
settings.setMaximumFrameRate(frameRateRange.maximumFrameRate);
|
settings.setMaximumFrameRate(frameRateRange.maximumFrameRate);
|
||||||
settings.setPixelFormat(pixelFormat);
|
settings.setPixelFormat(pixelFormat);
|
||||||
|
settings.setPixelAspectRatio(1, 1);
|
||||||
m_supportedViewfinderSettings.append(settings);
|
m_supportedViewfinderSettings.append(settings);
|
||||||
|
|
||||||
AM_MEDIA_TYPE format;
|
AM_MEDIA_TYPE format;
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include "camerabinaudioencoder.h"
|
#include "camerabinaudioencoder.h"
|
||||||
#include "camerabincontainer.h"
|
#include "camerabincontainer.h"
|
||||||
#include <private/qgstcodecsinfo_p.h>
|
#include <private/qgstcodecsinfo_p.h>
|
||||||
|
#include <private/qgstutils_p.h>
|
||||||
|
|
||||||
#include <QtCore/qdebug.h>
|
#include <QtCore/qdebug.h>
|
||||||
|
|
||||||
@@ -120,8 +121,7 @@ GstEncodingProfile *CameraBinAudioEncoder::createProfile()
|
|||||||
void CameraBinAudioEncoder::applySettings(GstElement *encoder)
|
void CameraBinAudioEncoder::applySettings(GstElement *encoder)
|
||||||
{
|
{
|
||||||
GObjectClass * const objectClass = G_OBJECT_GET_CLASS(encoder);
|
GObjectClass * const objectClass = G_OBJECT_GET_CLASS(encoder);
|
||||||
const char * const name = gst_plugin_feature_get_name(
|
const char * const name = qt_gst_element_get_factory_name(encoder);
|
||||||
GST_PLUGIN_FEATURE(gst_element_get_factory(encoder)));
|
|
||||||
|
|
||||||
const bool isVorbis = qstrcmp(name, "vorbisenc") == 0;
|
const bool isVorbis = qstrcmp(name, "vorbisenc") == 0;
|
||||||
|
|
||||||
|
|||||||
@@ -124,8 +124,8 @@ CameraBinService::CameraBinService(GstElementFactory *sourceFactory, QObject *pa
|
|||||||
#else
|
#else
|
||||||
m_videoWindow = new QGstreamerVideoWindow(this);
|
m_videoWindow = new QGstreamerVideoWindow(this);
|
||||||
#endif
|
#endif
|
||||||
// If the GStreamer sink element is not available (xvimagesink), don't provide
|
// If the GStreamer video sink is not available, don't provide the video window control since
|
||||||
// the video window control since it won't work anyway.
|
// it won't work anyway.
|
||||||
if (!m_videoWindow->videoSink()) {
|
if (!m_videoWindow->videoSink()) {
|
||||||
delete m_videoWindow;
|
delete m_videoWindow;
|
||||||
m_videoWindow = 0;
|
m_videoWindow = 0;
|
||||||
@@ -133,9 +133,8 @@ CameraBinService::CameraBinService(GstElementFactory *sourceFactory, QObject *pa
|
|||||||
#if defined(HAVE_WIDGETS)
|
#if defined(HAVE_WIDGETS)
|
||||||
m_videoWidgetControl = new QGstreamerVideoWidgetControl(this);
|
m_videoWidgetControl = new QGstreamerVideoWidgetControl(this);
|
||||||
|
|
||||||
// If the GStreamer sink element is not available (xvimagesink or ximagesink), don't provide
|
// If the GStreamer video sink is not available, don't provide the video widget control since
|
||||||
// the video widget control since it won't work anyway.
|
// it won't work anyway. QVideoWidget will fall back to QVideoRendererControl in that case.
|
||||||
// QVideoWidget will fall back to QVideoRendererControl in that case.
|
|
||||||
if (!m_videoWidgetControl->videoSink()) {
|
if (!m_videoWidgetControl->videoSink()) {
|
||||||
delete m_videoWidgetControl;
|
delete m_videoWidgetControl;
|
||||||
m_videoWidgetControl = 0;
|
m_videoWidgetControl = 0;
|
||||||
|
|||||||
@@ -388,7 +388,7 @@ void CameraBinSession::setupCaptureResolution()
|
|||||||
gst_caps_unref(caps);
|
gst_caps_unref(caps);
|
||||||
|
|
||||||
// Special case when using mfw_v4lsrc
|
// Special case when using mfw_v4lsrc
|
||||||
if (m_videoSrc && qstrcmp(gst_plugin_feature_get_name(GST_PLUGIN_FEATURE(gst_element_get_factory(m_videoSrc))), "mfw_v4lsrc") == 0) {
|
if (m_videoSrc && qstrcmp(qt_gst_element_get_factory_name(m_videoSrc), "mfw_v4lsrc") == 0) {
|
||||||
int capMode = 0;
|
int capMode = 0;
|
||||||
if (viewfinderResolution == QSize(320, 240))
|
if (viewfinderResolution == QSize(320, 240))
|
||||||
capMode = 1;
|
capMode = 1;
|
||||||
@@ -472,9 +472,7 @@ GstElement *CameraBinSession::buildCameraSource()
|
|||||||
#if CAMERABIN_DEBUG
|
#if CAMERABIN_DEBUG
|
||||||
qDebug() << "set camera device" << m_inputDevice;
|
qDebug() << "set camera device" << m_inputDevice;
|
||||||
#endif
|
#endif
|
||||||
const char *const cameraSrcName = gst_plugin_feature_get_name(
|
m_usingWrapperCameraBinSrc = qstrcmp(qt_gst_element_get_factory_name(m_cameraSrc), "wrappercamerabinsrc") == 0;
|
||||||
GST_PLUGIN_FEATURE(gst_element_get_factory(m_cameraSrc)));
|
|
||||||
m_usingWrapperCameraBinSrc = qstrcmp(cameraSrcName, "wrappercamerabinsrc") == 0;
|
|
||||||
|
|
||||||
if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_cameraSrc), "video-source")) {
|
if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_cameraSrc), "video-source")) {
|
||||||
if (!m_videoSrc) {
|
if (!m_videoSrc) {
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include "camerabinvideoencoder.h"
|
#include "camerabinvideoencoder.h"
|
||||||
#include "camerabinsession.h"
|
#include "camerabinsession.h"
|
||||||
#include "camerabincontainer.h"
|
#include "camerabincontainer.h"
|
||||||
|
#include <private/qgstutils_p.h>
|
||||||
|
|
||||||
#include <QtCore/qdebug.h>
|
#include <QtCore/qdebug.h>
|
||||||
|
|
||||||
@@ -178,8 +179,7 @@ GstEncodingProfile *CameraBinVideoEncoder::createProfile()
|
|||||||
void CameraBinVideoEncoder::applySettings(GstElement *encoder)
|
void CameraBinVideoEncoder::applySettings(GstElement *encoder)
|
||||||
{
|
{
|
||||||
GObjectClass * const objectClass = G_OBJECT_GET_CLASS(encoder);
|
GObjectClass * const objectClass = G_OBJECT_GET_CLASS(encoder);
|
||||||
const char * const name = gst_plugin_feature_get_name(
|
const char * const name = qt_gst_element_get_factory_name(encoder);
|
||||||
GST_PLUGIN_FEATURE(gst_element_get_factory(encoder)));
|
|
||||||
|
|
||||||
const int bitRate = m_actualVideoSettings.bitRate();
|
const int bitRate = m_actualVideoSettings.bitRate();
|
||||||
if (bitRate == -1) {
|
if (bitRate == -1) {
|
||||||
|
|||||||
@@ -102,8 +102,8 @@ QGstreamerCaptureService::QGstreamerCaptureService(const QString &service, QObje
|
|||||||
m_videoRenderer = new QGstreamerVideoRenderer(this);
|
m_videoRenderer = new QGstreamerVideoRenderer(this);
|
||||||
|
|
||||||
m_videoWindow = new QGstreamerVideoWindow(this);
|
m_videoWindow = new QGstreamerVideoWindow(this);
|
||||||
// If the GStreamer sink element is not available (xvimagesink), don't provide
|
// If the GStreamer video sink is not available, don't provide the video window control since
|
||||||
// the video window control since it won't work anyway.
|
// it won't work anyway.
|
||||||
if (!m_videoWindow->videoSink()) {
|
if (!m_videoWindow->videoSink()) {
|
||||||
delete m_videoWindow;
|
delete m_videoWindow;
|
||||||
m_videoWindow = 0;
|
m_videoWindow = 0;
|
||||||
@@ -112,9 +112,8 @@ QGstreamerCaptureService::QGstreamerCaptureService(const QString &service, QObje
|
|||||||
#if defined(HAVE_WIDGETS)
|
#if defined(HAVE_WIDGETS)
|
||||||
m_videoWidgetControl = new QGstreamerVideoWidgetControl(this);
|
m_videoWidgetControl = new QGstreamerVideoWidgetControl(this);
|
||||||
|
|
||||||
// If the GStreamer sink element is not available (xvimagesink or ximagesink), don't provide
|
// If the GStreamer video sink is not available, don't provide the video widget control since
|
||||||
// the video widget control since it won't work anyway.
|
// it won't work anyway. QVideoWidget will fall back to QVideoRendererControl in that case.
|
||||||
// QVideoWidget will fall back to QVideoRendererControl in that case.
|
|
||||||
if (!m_videoWidgetControl->videoSink()) {
|
if (!m_videoWidgetControl->videoSink()) {
|
||||||
delete m_videoWidgetControl;
|
delete m_videoWidgetControl;
|
||||||
m_videoWidgetControl = 0;
|
m_videoWidgetControl = 0;
|
||||||
|
|||||||
@@ -776,11 +776,11 @@ void QGstreamerCaptureSession::setState(QGstreamerCaptureSession::State newState
|
|||||||
if (!m_waitingForEos) {
|
if (!m_waitingForEos) {
|
||||||
m_waitingForEos = true;
|
m_waitingForEos = true;
|
||||||
//qDebug() << "Waiting for EOS";
|
//qDebug() << "Waiting for EOS";
|
||||||
|
// Unless gstreamer is in GST_STATE_PLAYING our EOS message will not be received.
|
||||||
|
gst_element_set_state(m_pipeline, GST_STATE_PLAYING);
|
||||||
//with live sources it's necessary to send EOS even to pipeline
|
//with live sources it's necessary to send EOS even to pipeline
|
||||||
//before going to STOPPED state
|
//before going to STOPPED state
|
||||||
gst_element_send_event(m_pipeline, gst_event_new_eos());
|
gst_element_send_event(m_pipeline, gst_event_new_eos());
|
||||||
// Unless gstreamer is in GST_STATE_PLAYING our EOS message will not be received.
|
|
||||||
gst_element_set_state(m_pipeline, GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -99,8 +99,8 @@ QGstreamerPlayerService::QGstreamerPlayerService(QObject *parent):
|
|||||||
#else
|
#else
|
||||||
m_videoWindow = new QGstreamerVideoWindow(this);
|
m_videoWindow = new QGstreamerVideoWindow(this);
|
||||||
#endif
|
#endif
|
||||||
// If the GStreamer sink element is not available (xvimagesink), don't provide
|
// If the GStreamer video sink is not available, don't provide the video window control since
|
||||||
// the video window control since it won't work anyway.
|
// it won't work anyway.
|
||||||
if (!m_videoWindow->videoSink()) {
|
if (!m_videoWindow->videoSink()) {
|
||||||
delete m_videoWindow;
|
delete m_videoWindow;
|
||||||
m_videoWindow = 0;
|
m_videoWindow = 0;
|
||||||
@@ -109,8 +109,8 @@ QGstreamerPlayerService::QGstreamerPlayerService(QObject *parent):
|
|||||||
#if defined(HAVE_WIDGETS)
|
#if defined(HAVE_WIDGETS)
|
||||||
m_videoWidget = new QGstreamerVideoWidgetControl(this);
|
m_videoWidget = new QGstreamerVideoWidgetControl(this);
|
||||||
|
|
||||||
// If the GStreamer sink element is not available (xvimagesink or ximagesink), don't provide
|
// If the GStreamer video sink is not available, don't provide the video widget control since
|
||||||
// the video widget control since it won't work anyway.
|
// it won't work anyway.
|
||||||
// QVideoWidget will fall back to QVideoRendererControl in that case.
|
// QVideoWidget will fall back to QVideoRendererControl in that case.
|
||||||
if (!m_videoWidget->videoSink()) {
|
if (!m_videoWidget->videoSink()) {
|
||||||
delete m_videoWidget;
|
delete m_videoWidget;
|
||||||
|
|||||||
@@ -58,11 +58,7 @@ Q_LOGGING_CATEGORY(qLcVideo, "qt.multimedia.video")
|
|||||||
\ingroup multimedia_video_qml
|
\ingroup multimedia_video_qml
|
||||||
\inqmlmodule QtMultimedia
|
\inqmlmodule QtMultimedia
|
||||||
|
|
||||||
\c VideoOutput is part of the \b{QtMultimedia 5.0} module.
|
|
||||||
|
|
||||||
\qml
|
\qml
|
||||||
import QtQuick 2.0
|
|
||||||
import QtMultimedia 5.0
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: 800
|
width: 800
|
||||||
|
|||||||
@@ -90,6 +90,14 @@ private slots:
|
|||||||
void testImageSettings();
|
void testImageSettings();
|
||||||
void testViewfinderSettings();
|
void testViewfinderSettings();
|
||||||
void testViewfinderSettingsChange();
|
void testViewfinderSettingsChange();
|
||||||
|
void testSupportedViewfinderSettings_data();
|
||||||
|
void testSupportedViewfinderSettings();
|
||||||
|
void testSupportedViewfinderResolutions_data();
|
||||||
|
void testSupportedViewfinderResolutions();
|
||||||
|
void testSupportedViewfinderFrameRateRanges_data();
|
||||||
|
void testSupportedViewfinderFrameRateRanges();
|
||||||
|
void testSupportedViewfinderPixelFormats_data();
|
||||||
|
void testSupportedViewfinderPixelFormats();
|
||||||
void testCameraLock();
|
void testCameraLock();
|
||||||
void testCameraLockCancel();
|
void testCameraLockCancel();
|
||||||
void testCameraEncodingProperyChange();
|
void testCameraEncodingProperyChange();
|
||||||
@@ -163,8 +171,11 @@ private:
|
|||||||
MockMediaServiceProvider *provider;
|
MockMediaServiceProvider *provider;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(QCamera::FrameRateRange)
|
||||||
|
|
||||||
void tst_QCamera::initTestCase()
|
void tst_QCamera::initTestCase()
|
||||||
{
|
{
|
||||||
|
qRegisterMetaType<QCamera::FrameRateRange>("FrameRateRange");
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QCamera::init()
|
void tst_QCamera::init()
|
||||||
@@ -906,7 +917,7 @@ void tst_QCamera::testViewfinderSettings()
|
|||||||
QVERIFY(!settings.isNull());
|
QVERIFY(!settings.isNull());
|
||||||
|
|
||||||
settings = QCameraViewfinderSettings();
|
settings = QCameraViewfinderSettings();
|
||||||
QCOMPARE(settings.pixelAspectRatio(), QSize(1, 1));
|
QCOMPARE(settings.pixelAspectRatio(), QSize());
|
||||||
settings.setPixelAspectRatio(QSize(2, 1));
|
settings.setPixelAspectRatio(QSize(2, 1));
|
||||||
QCOMPARE(settings.pixelAspectRatio(), QSize(2, 1));
|
QCOMPARE(settings.pixelAspectRatio(), QSize(2, 1));
|
||||||
settings.setPixelAspectRatio(3, 2);
|
settings.setPixelAspectRatio(3, 2);
|
||||||
@@ -1044,6 +1055,404 @@ void tst_QCamera::testViewfinderSettingsChange()
|
|||||||
QCOMPARE(statusChangedSignal.count(), 1);
|
QCOMPARE(statusChangedSignal.count(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ViewfinderSettingsBuilder
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ViewfinderSettingsBuilder &setResolution(int width, int height) {
|
||||||
|
m_settings.setResolution(width, height);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
ViewfinderSettingsBuilder &setMinimumFrameRate(qreal r) {
|
||||||
|
m_settings.setMinimumFrameRate(r);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
ViewfinderSettingsBuilder &setMaximumFrameRate(qreal r) {
|
||||||
|
m_settings.setMaximumFrameRate(r);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
ViewfinderSettingsBuilder &setPixelFormat(QVideoFrame::PixelFormat f) {
|
||||||
|
m_settings.setPixelFormat(f);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
ViewfinderSettingsBuilder &setPixelAspectRatio(int h, int v) {
|
||||||
|
m_settings.setPixelAspectRatio(h, v);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
QCameraViewfinderSettings build() {
|
||||||
|
QCameraViewfinderSettings s = m_settings;
|
||||||
|
m_settings = QCameraViewfinderSettings();
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
QCameraViewfinderSettings m_settings;
|
||||||
|
};
|
||||||
|
|
||||||
|
void tst_QCamera::testSupportedViewfinderSettings_data()
|
||||||
|
{
|
||||||
|
// see mockcameraviewfindersettingscontrol.h for expected values
|
||||||
|
|
||||||
|
ViewfinderSettingsBuilder builder;
|
||||||
|
|
||||||
|
QTest::addColumn<QCameraViewfinderSettings>("settings");
|
||||||
|
QTest::addColumn< QList<int> >("expectedSupportedSettings");
|
||||||
|
|
||||||
|
QTest::newRow("all supported settings") << QCameraViewfinderSettings()
|
||||||
|
<< (QList<int>() << 0 << 1 << 2 << 3 << 4 << 5);
|
||||||
|
|
||||||
|
QTest::newRow("invalid resolution") << builder.setResolution(452472, 44453).build()
|
||||||
|
<< QList<int>();
|
||||||
|
|
||||||
|
QTest::newRow("resolution (1)") << builder.setResolution(640, 480).build()
|
||||||
|
<< (QList<int>() << 0);
|
||||||
|
|
||||||
|
QTest::newRow("resolution (2)") << builder.setResolution(1280, 720).build()
|
||||||
|
<< (QList<int>() << 1 << 3 << 4);
|
||||||
|
|
||||||
|
QTest::newRow("invalid minimum frame rate") << builder.setMinimumFrameRate(2).build()
|
||||||
|
<< QList<int>();
|
||||||
|
|
||||||
|
QTest::newRow("minimum frame rate (1)") << builder.setMinimumFrameRate(5).build()
|
||||||
|
<< (QList<int>() << 2);
|
||||||
|
|
||||||
|
QTest::newRow("minimum frame rate (2)") << builder.setMinimumFrameRate(10).build()
|
||||||
|
<< (QList<int>() << 1 << 3);
|
||||||
|
|
||||||
|
QTest::newRow("minimum frame rate (3)") << builder.setMinimumFrameRate(30).build()
|
||||||
|
<< (QList<int>() << 0 << 4 << 5);
|
||||||
|
|
||||||
|
QTest::newRow("invalid maximum frame rate") << builder.setMaximumFrameRate(2).build()
|
||||||
|
<< QList<int>();
|
||||||
|
|
||||||
|
QTest::newRow("maximum frame rate (1)") << builder.setMaximumFrameRate(10).build()
|
||||||
|
<< (QList<int>() << 1 << 2 << 3);
|
||||||
|
|
||||||
|
QTest::newRow("maximum frame rate (2)") << builder.setMaximumFrameRate(30).build()
|
||||||
|
<< (QList<int>() << 0 << 4 << 5);
|
||||||
|
|
||||||
|
QTest::newRow("invalid pixel format") << builder.setPixelFormat(QVideoFrame::Format_CameraRaw).build()
|
||||||
|
<< QList<int>();
|
||||||
|
|
||||||
|
QTest::newRow("pixel format (1)") << builder.setPixelFormat(QVideoFrame::Format_BGR32).build()
|
||||||
|
<< (QList<int>() << 2);
|
||||||
|
|
||||||
|
QTest::newRow("pixel format (2)") << builder.setPixelFormat(QVideoFrame::Format_YV12).build()
|
||||||
|
<< (QList<int>() << 3 << 4);
|
||||||
|
|
||||||
|
QTest::newRow("pixel format (3)") << builder.setPixelFormat(QVideoFrame::Format_NV12).build()
|
||||||
|
<< (QList<int>() << 0 << 1 << 5);
|
||||||
|
|
||||||
|
QTest::newRow("invalid pixel aspect ratio") << builder.setPixelAspectRatio(5, 3).build()
|
||||||
|
<< QList<int>();
|
||||||
|
|
||||||
|
QTest::newRow("pixel aspect ratio (1)") << builder.setPixelAspectRatio(2, 1).build()
|
||||||
|
<< (QList<int>() << 2);
|
||||||
|
|
||||||
|
QTest::newRow("pixel aspect ratio (2)") << builder.setPixelAspectRatio(1, 1).build()
|
||||||
|
<< (QList<int>() << 0 << 1 << 3 << 4 << 5);
|
||||||
|
|
||||||
|
QTest::newRow("invalid multi settings") << builder.setResolution(640, 480)
|
||||||
|
.setMinimumFrameRate(10)
|
||||||
|
.setMaximumFrameRate(10)
|
||||||
|
.build()
|
||||||
|
<< QList<int>();
|
||||||
|
|
||||||
|
QTest::newRow("multi settings (1)") << builder.setResolution(640, 480)
|
||||||
|
.setMinimumFrameRate(30)
|
||||||
|
.setMaximumFrameRate(30)
|
||||||
|
.build()
|
||||||
|
<< (QList<int>() << 0);
|
||||||
|
|
||||||
|
QTest::newRow("multi settings (2)") << builder.setResolution(1280, 720)
|
||||||
|
.setMinimumFrameRate(10)
|
||||||
|
.setMaximumFrameRate(10)
|
||||||
|
.build()
|
||||||
|
<< (QList<int>() << 1 << 3);
|
||||||
|
|
||||||
|
QTest::newRow("multi settings (3)") << builder.setPixelFormat(QVideoFrame::Format_NV12)
|
||||||
|
.setMinimumFrameRate(30)
|
||||||
|
.build()
|
||||||
|
<< (QList<int>() << 0 << 5);
|
||||||
|
|
||||||
|
QTest::newRow("multi settings (4)") << builder.setPixelAspectRatio(1, 1)
|
||||||
|
.setMaximumFrameRate(10)
|
||||||
|
.build()
|
||||||
|
<< (QList<int>() << 1 << 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
void tst_QCamera::testSupportedViewfinderSettings()
|
||||||
|
{
|
||||||
|
QFETCH(QCameraViewfinderSettings, settings);
|
||||||
|
QFETCH(QList<int>, expectedSupportedSettings);
|
||||||
|
|
||||||
|
QList<QCameraViewfinderSettings> actualSupportedSettings = QCamera().supportedViewfinderSettings(settings);
|
||||||
|
QCOMPARE(actualSupportedSettings.size(), expectedSupportedSettings.size());
|
||||||
|
for (int i = 0; i < expectedSupportedSettings.size(); ++i) {
|
||||||
|
QCameraViewfinderSettings expectedSettings = mockCameraService->mockViewfinderSettingsControl->supportedSettings.at(expectedSupportedSettings.at(i));
|
||||||
|
QCOMPARE(actualSupportedSettings.at(i), expectedSettings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void tst_QCamera::testSupportedViewfinderResolutions_data()
|
||||||
|
{
|
||||||
|
// see mockcameraviewfindersettingscontrol.h for expected values
|
||||||
|
|
||||||
|
typedef QList<QSize> SizeList;
|
||||||
|
ViewfinderSettingsBuilder builder;
|
||||||
|
|
||||||
|
QTest::addColumn<QCameraViewfinderSettings>("settings");
|
||||||
|
QTest::addColumn<SizeList>("expectedResolutions");
|
||||||
|
|
||||||
|
QTest::newRow("empty settings") << QCameraViewfinderSettings()
|
||||||
|
<< (SizeList() << QSize(320, 240)
|
||||||
|
<< QSize(640, 480)
|
||||||
|
<< QSize(1280, 720)
|
||||||
|
<< QSize(1920, 1080));
|
||||||
|
|
||||||
|
QTest::newRow("invalid minimum frame rate") << builder.setMinimumFrameRate(2).build()
|
||||||
|
<< SizeList();
|
||||||
|
|
||||||
|
QTest::newRow("minimum frame rate (1)") << builder.setMinimumFrameRate(5).build()
|
||||||
|
<< (SizeList() << QSize(1920, 1080));
|
||||||
|
|
||||||
|
QTest::newRow("minimum frame rate (2)") << builder.setMinimumFrameRate(10).build()
|
||||||
|
<< (SizeList() << QSize(1280, 720));
|
||||||
|
|
||||||
|
QTest::newRow("minimum frame rate (3)") << builder.setMinimumFrameRate(30).build()
|
||||||
|
<< (SizeList() << QSize(320, 240)
|
||||||
|
<< QSize(640, 480)
|
||||||
|
<< QSize(1280, 720));
|
||||||
|
|
||||||
|
QTest::newRow("invalid maximum frame rate") << builder.setMaximumFrameRate(2).build()
|
||||||
|
<< SizeList();
|
||||||
|
|
||||||
|
QTest::newRow("maximum frame rate") << builder.setMaximumFrameRate(10).build()
|
||||||
|
<< (SizeList() << QSize(1280, 720)
|
||||||
|
<< QSize(1920, 1080));
|
||||||
|
|
||||||
|
QTest::newRow("invalid pixel format") << builder.setPixelFormat(QVideoFrame::Format_CameraRaw).build()
|
||||||
|
<< SizeList();
|
||||||
|
|
||||||
|
QTest::newRow("pixel format (1)") << builder.setPixelFormat(QVideoFrame::Format_BGR32).build()
|
||||||
|
<< (SizeList() << QSize(1920, 1080));
|
||||||
|
|
||||||
|
QTest::newRow("pixel format (2)") << builder.setPixelFormat(QVideoFrame::Format_YV12).build()
|
||||||
|
<< (SizeList() << QSize(1280, 720));
|
||||||
|
|
||||||
|
QTest::newRow("pixel format (3)") << builder.setPixelFormat(QVideoFrame::Format_NV12).build()
|
||||||
|
<< (SizeList() << QSize(320, 240)
|
||||||
|
<< QSize(640, 480)
|
||||||
|
<< QSize(1280, 720));
|
||||||
|
|
||||||
|
QTest::newRow("invalid pixel aspect ratio") << builder.setPixelAspectRatio(7, 2).build()
|
||||||
|
<< SizeList();
|
||||||
|
|
||||||
|
QTest::newRow("pixel aspect ratio (1") << builder.setPixelAspectRatio(2, 1).build()
|
||||||
|
<< (SizeList() << QSize(1920, 1080));
|
||||||
|
|
||||||
|
QTest::newRow("pixel aspect ratio (2") << builder.setPixelAspectRatio(1, 1).build()
|
||||||
|
<< (SizeList() << QSize(320, 240)
|
||||||
|
<< QSize(640, 480)
|
||||||
|
<< QSize(1280, 720));
|
||||||
|
|
||||||
|
QTest::newRow("invalid multi settings (1)") << builder.setMinimumFrameRate(2)
|
||||||
|
.setMaximumFrameRate(3)
|
||||||
|
.build()
|
||||||
|
<< SizeList();
|
||||||
|
|
||||||
|
QTest::newRow("invalid multi settings (2)") << builder.setMinimumFrameRate(5)
|
||||||
|
.setMaximumFrameRate(11)
|
||||||
|
.build()
|
||||||
|
<< SizeList();
|
||||||
|
|
||||||
|
QTest::newRow("multi settings (1)") << builder.setMinimumFrameRate(10)
|
||||||
|
.setMaximumFrameRate(10)
|
||||||
|
.build()
|
||||||
|
<< (SizeList() << QSize(1280, 720));
|
||||||
|
|
||||||
|
QTest::newRow("multi settings (2)") << builder.setMinimumFrameRate(30)
|
||||||
|
.setMaximumFrameRate(30)
|
||||||
|
.build()
|
||||||
|
<< (SizeList() << QSize(320, 240)
|
||||||
|
<< QSize(640, 480)
|
||||||
|
<< QSize(1280, 720));
|
||||||
|
|
||||||
|
QTest::newRow("multi settings (3)") << builder.setPixelFormat(QVideoFrame::Format_NV12)
|
||||||
|
.setMinimumFrameRate(30)
|
||||||
|
.build()
|
||||||
|
<< (SizeList() << QSize(320, 240)
|
||||||
|
<< QSize(640, 480));
|
||||||
|
|
||||||
|
QTest::newRow("multi settings (4)") << builder.setPixelAspectRatio(1, 1)
|
||||||
|
.setMaximumFrameRate(10)
|
||||||
|
.build()
|
||||||
|
<< (SizeList() << QSize(1280, 720));
|
||||||
|
}
|
||||||
|
|
||||||
|
void tst_QCamera::testSupportedViewfinderResolutions()
|
||||||
|
{
|
||||||
|
QFETCH(QCameraViewfinderSettings, settings);
|
||||||
|
QFETCH(QList<QSize>, expectedResolutions);
|
||||||
|
|
||||||
|
QList<QSize> actualResolutions = QCamera().supportedViewfinderResolutions(settings);
|
||||||
|
QCOMPARE(actualResolutions.size(), expectedResolutions.size());
|
||||||
|
for (int i = 0; i < actualResolutions.size(); ++i)
|
||||||
|
QCOMPARE(actualResolutions.at(i), expectedResolutions.at(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
void tst_QCamera::testSupportedViewfinderFrameRateRanges_data()
|
||||||
|
{
|
||||||
|
// see mockcameraviewfindersettingscontrol.h for expected values
|
||||||
|
|
||||||
|
typedef QList<QCamera::FrameRateRange> RangeList;
|
||||||
|
ViewfinderSettingsBuilder builder;
|
||||||
|
|
||||||
|
QTest::addColumn<QCameraViewfinderSettings>("settings");
|
||||||
|
QTest::addColumn<RangeList>("expectedFrameRateRanges");
|
||||||
|
|
||||||
|
QTest::newRow("empty settings") << QCameraViewfinderSettings()
|
||||||
|
<< (RangeList() << QCamera::FrameRateRange(5, 10)
|
||||||
|
<< QCamera::FrameRateRange(10, 10)
|
||||||
|
<< QCamera::FrameRateRange(30, 30));
|
||||||
|
|
||||||
|
QTest::newRow("invalid resolution") << builder.setResolution(452472, 444534).build()
|
||||||
|
<< RangeList();
|
||||||
|
|
||||||
|
QTest::newRow("resolution (1)") << builder.setResolution(320, 240).build()
|
||||||
|
<< (RangeList() << QCamera::FrameRateRange(30, 30));
|
||||||
|
|
||||||
|
QTest::newRow("resolution (2)") << builder.setResolution(1280, 720).build()
|
||||||
|
<< (RangeList() << QCamera::FrameRateRange(10, 10)
|
||||||
|
<< QCamera::FrameRateRange(30, 30));
|
||||||
|
|
||||||
|
QTest::newRow("resolution (3)") << builder.setResolution(1920, 1080).build()
|
||||||
|
<< (RangeList() << QCamera::FrameRateRange(5, 10));
|
||||||
|
|
||||||
|
QTest::newRow("invalid minimum frame rate") << builder.setMinimumFrameRate(2).build()
|
||||||
|
<< RangeList();
|
||||||
|
|
||||||
|
QTest::newRow("minimum frame rate (1)") << builder.setMinimumFrameRate(5).build()
|
||||||
|
<< (RangeList() << QCamera::FrameRateRange(5, 10));
|
||||||
|
|
||||||
|
QTest::newRow("minimum frame rate (2)") << builder.setMinimumFrameRate(10).build()
|
||||||
|
<< (RangeList() << QCamera::FrameRateRange(10, 10));
|
||||||
|
|
||||||
|
QTest::newRow("invalid maximum frame rate") << builder.setMaximumFrameRate(2).build()
|
||||||
|
<< RangeList();
|
||||||
|
|
||||||
|
QTest::newRow("maximum frame rate (1)") << builder.setMaximumFrameRate(10).build()
|
||||||
|
<< (RangeList() << QCamera::FrameRateRange(5, 10)
|
||||||
|
<< QCamera::FrameRateRange(10, 10));
|
||||||
|
|
||||||
|
QTest::newRow("maximum frame rate (2)") << builder.setMaximumFrameRate(30).build()
|
||||||
|
<< (RangeList() << QCamera::FrameRateRange(30, 30));
|
||||||
|
|
||||||
|
QTest::newRow("invalid pixel format") << builder.setPixelFormat(QVideoFrame::Format_IMC1).build()
|
||||||
|
<< RangeList();
|
||||||
|
|
||||||
|
QTest::newRow("pixel format (1)") << builder.setPixelFormat(QVideoFrame::Format_BGR32).build()
|
||||||
|
<< (RangeList() << QCamera::FrameRateRange(5, 10));
|
||||||
|
|
||||||
|
QTest::newRow("pixel format (2)") << builder.setPixelFormat(QVideoFrame::Format_NV12).build()
|
||||||
|
<< (RangeList() << QCamera::FrameRateRange(10, 10)
|
||||||
|
<< QCamera::FrameRateRange(30, 30));
|
||||||
|
|
||||||
|
QTest::newRow("invalid pixel aspect ratio") << builder.setPixelAspectRatio(2, 3).build()
|
||||||
|
<< RangeList();
|
||||||
|
|
||||||
|
QTest::newRow("pixel aspect ratio (1)") << builder.setPixelAspectRatio(2, 1).build()
|
||||||
|
<< (RangeList() << QCamera::FrameRateRange(5, 10));
|
||||||
|
|
||||||
|
QTest::newRow("pixel aspect ratio (2)") << builder.setPixelAspectRatio(1, 1).build()
|
||||||
|
<< (RangeList() << QCamera::FrameRateRange(10, 10)
|
||||||
|
<< QCamera::FrameRateRange(30, 30));
|
||||||
|
}
|
||||||
|
|
||||||
|
void tst_QCamera::testSupportedViewfinderFrameRateRanges()
|
||||||
|
{
|
||||||
|
QFETCH(QCameraViewfinderSettings, settings);
|
||||||
|
QFETCH(QList<QCamera::FrameRateRange>, expectedFrameRateRanges);
|
||||||
|
|
||||||
|
QList<QCamera::FrameRateRange> actualFrameRateRanges = QCamera().supportedViewfinderFrameRateRanges(settings);
|
||||||
|
QCOMPARE(actualFrameRateRanges.size(), expectedFrameRateRanges.size());
|
||||||
|
for (int i = 0; i < actualFrameRateRanges.size(); ++i)
|
||||||
|
QCOMPARE(actualFrameRateRanges.at(i), expectedFrameRateRanges.at(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
void tst_QCamera::testSupportedViewfinderPixelFormats_data()
|
||||||
|
{
|
||||||
|
// see mockcameraviewfindersettingscontrol.h for expected values
|
||||||
|
|
||||||
|
typedef QList<QVideoFrame::PixelFormat> FormatList;
|
||||||
|
ViewfinderSettingsBuilder builder;
|
||||||
|
|
||||||
|
QTest::addColumn<QCameraViewfinderSettings>("settings");
|
||||||
|
QTest::addColumn<FormatList>("expectedPixelFormats");
|
||||||
|
|
||||||
|
QTest::newRow("empty settings") << QCameraViewfinderSettings()
|
||||||
|
<< (FormatList() << QVideoFrame::Format_NV12
|
||||||
|
<< QVideoFrame::Format_BGR32
|
||||||
|
<< QVideoFrame::Format_YV12);
|
||||||
|
|
||||||
|
QTest::newRow("invalid resolution") << builder.setResolution(452472, 444534).build()
|
||||||
|
<< FormatList();
|
||||||
|
|
||||||
|
QTest::newRow("resolution (1)") << builder.setResolution(640, 480).build()
|
||||||
|
<< (FormatList() << QVideoFrame::Format_NV12);
|
||||||
|
|
||||||
|
QTest::newRow("resolution (2)") << builder.setResolution(1280, 720).build()
|
||||||
|
<< (FormatList() << QVideoFrame::Format_NV12
|
||||||
|
<< QVideoFrame::Format_YV12);
|
||||||
|
|
||||||
|
QTest::newRow("invalid minimum frame rate") << builder.setMinimumFrameRate(2).build()
|
||||||
|
<< FormatList();
|
||||||
|
|
||||||
|
QTest::newRow("minimum frame rate (1)") << builder.setMinimumFrameRate(5).build()
|
||||||
|
<< (FormatList() << QVideoFrame::Format_BGR32);
|
||||||
|
|
||||||
|
QTest::newRow("minimum frame rate (2)") << builder.setMinimumFrameRate(10).build()
|
||||||
|
<< (FormatList() << QVideoFrame::Format_NV12
|
||||||
|
<< QVideoFrame::Format_YV12);
|
||||||
|
|
||||||
|
QTest::newRow("invalid maximum frame rate") << builder.setMaximumFrameRate(2).build()
|
||||||
|
<< FormatList();
|
||||||
|
|
||||||
|
QTest::newRow("maximum frame rate (1)") << builder.setMaximumFrameRate(10).build()
|
||||||
|
<< (FormatList() << QVideoFrame::Format_NV12
|
||||||
|
<< QVideoFrame::Format_BGR32
|
||||||
|
<< QVideoFrame::Format_YV12);
|
||||||
|
|
||||||
|
QTest::newRow("maximum frame rate (2)") << builder.setMinimumFrameRate(30).build()
|
||||||
|
<< (FormatList() << QVideoFrame::Format_NV12
|
||||||
|
<< QVideoFrame::Format_YV12);
|
||||||
|
|
||||||
|
QTest::newRow("invalid pixel aspect ratio") << builder.setPixelAspectRatio(2, 3).build()
|
||||||
|
<< FormatList();
|
||||||
|
|
||||||
|
QTest::newRow("pixel aspect ratio (1)") << builder.setPixelAspectRatio(2, 1).build()
|
||||||
|
<< (FormatList() << QVideoFrame::Format_BGR32);
|
||||||
|
|
||||||
|
QTest::newRow("pixel aspect ratio (2)") << builder.setPixelAspectRatio(1, 1).build()
|
||||||
|
<< (FormatList() << QVideoFrame::Format_NV12
|
||||||
|
<< QVideoFrame::Format_YV12);
|
||||||
|
}
|
||||||
|
|
||||||
|
void tst_QCamera::testSupportedViewfinderPixelFormats()
|
||||||
|
{
|
||||||
|
QFETCH(QCameraViewfinderSettings, settings);
|
||||||
|
QFETCH(QList<QVideoFrame::PixelFormat>, expectedPixelFormats);
|
||||||
|
|
||||||
|
QList<QVideoFrame::PixelFormat> actualPixelFormats = QCamera().supportedViewfinderPixelFormats(settings);
|
||||||
|
QCOMPARE(actualPixelFormats.size(), expectedPixelFormats.size());
|
||||||
|
for (int i = 0; i < actualPixelFormats.size(); ++i)
|
||||||
|
QCOMPARE(actualPixelFormats.at(i), expectedPixelFormats.at(i));
|
||||||
|
}
|
||||||
|
|
||||||
void tst_QCamera::testCameraLock()
|
void tst_QCamera::testCameraLock()
|
||||||
{
|
{
|
||||||
QCamera camera;
|
QCamera camera;
|
||||||
|
|||||||
@@ -234,6 +234,71 @@ void tst_QMediaPlaylist::insert()
|
|||||||
playlist.insertMedia(1, QList<QMediaContent>());
|
playlist.insertMedia(1, QList<QMediaContent>());
|
||||||
QCOMPARE(aboutToBeInsertedSignalSpy.count(), 0);
|
QCOMPARE(aboutToBeInsertedSignalSpy.count(), 0);
|
||||||
QCOMPARE(insertedSignalSpy.count(), 0);
|
QCOMPARE(insertedSignalSpy.count(), 0);
|
||||||
|
|
||||||
|
playlist.clear();
|
||||||
|
playlist.addMedia(content1);
|
||||||
|
aboutToBeInsertedSignalSpy.clear();
|
||||||
|
insertedSignalSpy.clear();
|
||||||
|
|
||||||
|
playlist.insertMedia(-10, content2);
|
||||||
|
QCOMPARE(playlist.media(0), content2);
|
||||||
|
QCOMPARE(playlist.media(1), content1);
|
||||||
|
QCOMPARE(aboutToBeInsertedSignalSpy.count(), 1);
|
||||||
|
QCOMPARE(aboutToBeInsertedSignalSpy.first()[0].toInt(), 0);
|
||||||
|
QCOMPARE(aboutToBeInsertedSignalSpy.first()[1].toInt(), 0);
|
||||||
|
QCOMPARE(insertedSignalSpy.count(), 1);
|
||||||
|
QCOMPARE(insertedSignalSpy.first()[0].toInt(), 0);
|
||||||
|
QCOMPARE(insertedSignalSpy.first()[1].toInt(), 0);
|
||||||
|
|
||||||
|
aboutToBeInsertedSignalSpy.clear();
|
||||||
|
insertedSignalSpy.clear();
|
||||||
|
|
||||||
|
playlist.insertMedia(10, content3);
|
||||||
|
QCOMPARE(playlist.media(0), content2);
|
||||||
|
QCOMPARE(playlist.media(1), content1);
|
||||||
|
QCOMPARE(playlist.media(2), content3);
|
||||||
|
QCOMPARE(aboutToBeInsertedSignalSpy.count(), 1);
|
||||||
|
QCOMPARE(aboutToBeInsertedSignalSpy.first()[0].toInt(), 2);
|
||||||
|
QCOMPARE(aboutToBeInsertedSignalSpy.first()[1].toInt(), 2);
|
||||||
|
QCOMPARE(insertedSignalSpy.count(), 1);
|
||||||
|
QCOMPARE(insertedSignalSpy.first()[0].toInt(), 2);
|
||||||
|
QCOMPARE(insertedSignalSpy.first()[1].toInt(), 2);
|
||||||
|
|
||||||
|
aboutToBeInsertedSignalSpy.clear();
|
||||||
|
insertedSignalSpy.clear();
|
||||||
|
|
||||||
|
playlist.insertMedia(-10, QList<QMediaContent>() << content4 << content5);
|
||||||
|
QCOMPARE(playlist.media(0), content4);
|
||||||
|
QCOMPARE(playlist.media(1), content5);
|
||||||
|
QCOMPARE(playlist.media(2), content2);
|
||||||
|
QCOMPARE(playlist.media(3), content1);
|
||||||
|
QCOMPARE(playlist.media(4), content3);
|
||||||
|
QCOMPARE(aboutToBeInsertedSignalSpy.count(), 1);
|
||||||
|
QCOMPARE(aboutToBeInsertedSignalSpy.first()[0].toInt(), 0);
|
||||||
|
QCOMPARE(aboutToBeInsertedSignalSpy.first()[1].toInt(), 1);
|
||||||
|
QCOMPARE(insertedSignalSpy.count(), 1);
|
||||||
|
QCOMPARE(insertedSignalSpy.first()[0].toInt(), 0);
|
||||||
|
QCOMPARE(insertedSignalSpy.first()[1].toInt(), 1);
|
||||||
|
|
||||||
|
aboutToBeInsertedSignalSpy.clear();
|
||||||
|
insertedSignalSpy.clear();
|
||||||
|
|
||||||
|
QMediaContent content6(QUrl(QLatin1String("file:///6")));
|
||||||
|
QMediaContent content7(QUrl(QLatin1String("file:///7")));
|
||||||
|
playlist.insertMedia(10, QList<QMediaContent>() << content6 << content7);
|
||||||
|
QCOMPARE(playlist.media(0), content4);
|
||||||
|
QCOMPARE(playlist.media(1), content5);
|
||||||
|
QCOMPARE(playlist.media(2), content2);
|
||||||
|
QCOMPARE(playlist.media(3), content1);
|
||||||
|
QCOMPARE(playlist.media(4), content3);
|
||||||
|
QCOMPARE(playlist.media(5), content6);
|
||||||
|
QCOMPARE(playlist.media(6), content7);
|
||||||
|
QCOMPARE(aboutToBeInsertedSignalSpy.count(), 1);
|
||||||
|
QCOMPARE(aboutToBeInsertedSignalSpy.first()[0].toInt(), 5);
|
||||||
|
QCOMPARE(aboutToBeInsertedSignalSpy.first()[1].toInt(), 6);
|
||||||
|
QCOMPARE(insertedSignalSpy.count(), 1);
|
||||||
|
QCOMPARE(insertedSignalSpy.first()[0].toInt(), 5);
|
||||||
|
QCOMPARE(insertedSignalSpy.first()[1].toInt(), 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -329,6 +394,58 @@ void tst_QMediaPlaylist::removeMedia()
|
|||||||
playlist.removeMedia(0,1);
|
playlist.removeMedia(0,1);
|
||||||
QCOMPARE(playlist.mediaCount(), 1);
|
QCOMPARE(playlist.mediaCount(), 1);
|
||||||
QCOMPARE(playlist.media(0), content3);
|
QCOMPARE(playlist.media(0), content3);
|
||||||
|
|
||||||
|
QCOMPARE(playlist.removeMedia(-1), false);
|
||||||
|
QCOMPARE(playlist.removeMedia(1), false);
|
||||||
|
|
||||||
|
playlist.addMedia(content1);
|
||||||
|
aboutToBeRemovedSignalSpy.clear();
|
||||||
|
removedSignalSpy.clear();
|
||||||
|
|
||||||
|
playlist.removeMedia(-10, 10);
|
||||||
|
QCOMPARE(aboutToBeRemovedSignalSpy.count(), 1);
|
||||||
|
QCOMPARE(aboutToBeRemovedSignalSpy.first()[0].toInt(), 0);
|
||||||
|
QCOMPARE(aboutToBeRemovedSignalSpy.first()[1].toInt(), 1);
|
||||||
|
QCOMPARE(removedSignalSpy.count(), 1);
|
||||||
|
QCOMPARE(removedSignalSpy.first()[0].toInt(), 0);
|
||||||
|
QCOMPARE(removedSignalSpy.first()[1].toInt(), 1);
|
||||||
|
|
||||||
|
playlist.addMedia(content1);
|
||||||
|
playlist.addMedia(content2);
|
||||||
|
playlist.addMedia(content3);
|
||||||
|
aboutToBeRemovedSignalSpy.clear();
|
||||||
|
removedSignalSpy.clear();
|
||||||
|
|
||||||
|
QCOMPARE(playlist.removeMedia(10, -10), false);
|
||||||
|
QCOMPARE(aboutToBeRemovedSignalSpy.count(), 0);
|
||||||
|
QCOMPARE(removedSignalSpy.count(), 0);
|
||||||
|
QCOMPARE(playlist.removeMedia(-10, -5), false);
|
||||||
|
QCOMPARE(aboutToBeRemovedSignalSpy.count(), 0);
|
||||||
|
QCOMPARE(removedSignalSpy.count(), 0);
|
||||||
|
QCOMPARE(playlist.removeMedia(5, 10), false);
|
||||||
|
QCOMPARE(aboutToBeRemovedSignalSpy.count(), 0);
|
||||||
|
QCOMPARE(removedSignalSpy.count(), 0);
|
||||||
|
|
||||||
|
playlist.removeMedia(1, 10);
|
||||||
|
QCOMPARE(aboutToBeRemovedSignalSpy.count(), 1);
|
||||||
|
QCOMPARE(aboutToBeRemovedSignalSpy.first()[0].toInt(), 1);
|
||||||
|
QCOMPARE(aboutToBeRemovedSignalSpy.first()[1].toInt(), 2);
|
||||||
|
QCOMPARE(removedSignalSpy.count(), 1);
|
||||||
|
QCOMPARE(removedSignalSpy.first()[0].toInt(), 1);
|
||||||
|
QCOMPARE(removedSignalSpy.first()[1].toInt(), 2);
|
||||||
|
|
||||||
|
playlist.addMedia(content2);
|
||||||
|
playlist.addMedia(content3);
|
||||||
|
aboutToBeRemovedSignalSpy.clear();
|
||||||
|
removedSignalSpy.clear();
|
||||||
|
|
||||||
|
playlist.removeMedia(-10, 1);
|
||||||
|
QCOMPARE(aboutToBeRemovedSignalSpy.count(), 1);
|
||||||
|
QCOMPARE(aboutToBeRemovedSignalSpy.first()[0].toInt(), 0);
|
||||||
|
QCOMPARE(aboutToBeRemovedSignalSpy.first()[1].toInt(), 1);
|
||||||
|
QCOMPARE(removedSignalSpy.count(), 1);
|
||||||
|
QCOMPARE(removedSignalSpy.first()[0].toInt(), 0);
|
||||||
|
QCOMPARE(removedSignalSpy.first()[1].toInt(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QMediaPlaylist::saveAndLoad()
|
void tst_QMediaPlaylist::saveAndLoad()
|
||||||
|
|||||||
@@ -43,6 +43,48 @@ public:
|
|||||||
MockCameraViewfinderSettingsControl(QObject *parent = 0):
|
MockCameraViewfinderSettingsControl(QObject *parent = 0):
|
||||||
QCameraViewfinderSettingsControl2(parent)
|
QCameraViewfinderSettingsControl2(parent)
|
||||||
{
|
{
|
||||||
|
QCameraViewfinderSettings s;
|
||||||
|
s.setResolution(640, 480);
|
||||||
|
s.setMinimumFrameRate(30);
|
||||||
|
s.setMaximumFrameRate(30);
|
||||||
|
s.setPixelFormat(QVideoFrame::Format_NV12);
|
||||||
|
s.setPixelAspectRatio(1, 1);
|
||||||
|
supportedSettings.append(s);
|
||||||
|
|
||||||
|
s.setResolution(1280, 720);
|
||||||
|
s.setMinimumFrameRate(10);
|
||||||
|
s.setMaximumFrameRate(10);
|
||||||
|
s.setPixelFormat(QVideoFrame::Format_NV12);
|
||||||
|
s.setPixelAspectRatio(1, 1);
|
||||||
|
supportedSettings.append(s);
|
||||||
|
|
||||||
|
s.setResolution(1920, 1080);
|
||||||
|
s.setMinimumFrameRate(5);
|
||||||
|
s.setMaximumFrameRate(10);
|
||||||
|
s.setPixelFormat(QVideoFrame::Format_BGR32);
|
||||||
|
s.setPixelAspectRatio(2, 1);
|
||||||
|
supportedSettings.append(s);
|
||||||
|
|
||||||
|
s.setResolution(1280, 720);
|
||||||
|
s.setMinimumFrameRate(10);
|
||||||
|
s.setMaximumFrameRate(10);
|
||||||
|
s.setPixelFormat(QVideoFrame::Format_YV12);
|
||||||
|
s.setPixelAspectRatio(1, 1);
|
||||||
|
supportedSettings.append(s);
|
||||||
|
|
||||||
|
s.setResolution(1280, 720);
|
||||||
|
s.setMinimumFrameRate(30);
|
||||||
|
s.setMaximumFrameRate(30);
|
||||||
|
s.setPixelFormat(QVideoFrame::Format_YV12);
|
||||||
|
s.setPixelAspectRatio(1, 1);
|
||||||
|
supportedSettings.append(s);
|
||||||
|
|
||||||
|
s.setResolution(320, 240);
|
||||||
|
s.setMinimumFrameRate(30);
|
||||||
|
s.setMaximumFrameRate(30);
|
||||||
|
s.setPixelFormat(QVideoFrame::Format_NV12);
|
||||||
|
s.setPixelAspectRatio(1, 1);
|
||||||
|
supportedSettings.append(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
~MockCameraViewfinderSettingsControl() {}
|
~MockCameraViewfinderSettingsControl() {}
|
||||||
@@ -59,10 +101,11 @@ public:
|
|||||||
|
|
||||||
QList<QCameraViewfinderSettings> supportedViewfinderSettings() const
|
QList<QCameraViewfinderSettings> supportedViewfinderSettings() const
|
||||||
{
|
{
|
||||||
return QList<QCameraViewfinderSettings>();
|
return supportedSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
QCameraViewfinderSettings settings;
|
QCameraViewfinderSettings settings;
|
||||||
|
QList<QCameraViewfinderSettings> supportedSettings;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MOCKCAMERAVIEWFINDERSETTINGSCONTROL_H
|
#endif // MOCKCAMERAVIEWFINDERSETTINGSCONTROL_H
|
||||||
|
|||||||
Reference in New Issue
Block a user