Added old abandoned KDE3 version of kmplayer

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmplayer@1091557 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 14 years ago
commit 092be7678b

@ -0,0 +1 @@
Koos Vriezen <koos dot vriezen at gmail dot com>

@ -0,0 +1,280 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Steet, Fifth Floor, Cambridge, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) 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
this service 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 make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. 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.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the 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 a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE 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.
END OF TERMS AND CONDITIONS

@ -0,0 +1,397 @@
GNU Free Documentation License
Version 1.2, November 2002
Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
0. PREAMBLE
The purpose of this License is to make a manual, textbook, or other
functional and useful document "free" in the sense of freedom: to
assure everyone the effective freedom to copy and redistribute it,
with or without modifying it, either commercially or noncommercially.
Secondarily, this License preserves for the author and publisher a way
to get credit for their work, while not being considered responsible
for modifications made by others.
This License is a kind of "copyleft", which means that derivative
works of the document must themselves be free in the same sense. It
complements the GNU General Public License, which is a copyleft
license designed for free software.
We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free
program should come with manuals providing the same freedoms that the
software does. But this License is not limited to software manuals;
it can be used for any textual work, regardless of subject matter or
whether it is published as a printed book. We recommend this License
principally for works whose purpose is instruction or reference.
1. APPLICABILITY AND DEFINITIONS
This License applies to any manual or other work, in any medium, that
contains a notice placed by the copyright holder saying it can be
distributed under the terms of this License. Such a notice grants a
world-wide, royalty-free license, unlimited in duration, to use that
work under the conditions stated herein. The "Document", below,
refers to any such manual or work. Any member of the public is a
licensee, and is addressed as "you". You accept the license if you
copy, modify or distribute the work in a way requiring permission
under copyright law.
A "Modified Version" of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language.
A "Secondary Section" is a named appendix or a front-matter section of
the Document that deals exclusively with the relationship of the
publishers or authors of the Document to the Document's overall subject
(or to related matters) and contains nothing that could fall directly
within that overall subject. (Thus, if the Document is in part a
textbook of mathematics, a Secondary Section may not explain any
mathematics.) The relationship could be a matter of historical
connection with the subject or with related matters, or of legal,
commercial, philosophical, ethical or political position regarding
them.
The "Invariant Sections" are certain Secondary Sections whose titles
are designated, as being those of Invariant Sections, in the notice
that says that the Document is released under this License. If a
section does not fit the above definition of Secondary then it is not
allowed to be designated as Invariant. The Document may contain zero
Invariant Sections. If the Document does not identify any Invariant
Sections then there are none.
The "Cover Texts" are certain short passages of text that are listed,
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
the Document is released under this License. A Front-Cover Text may
be at most 5 words, and a Back-Cover Text may be at most 25 words.
A "Transparent" copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the
general public, that is suitable for revising the document
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or
for automatic translation to a variety of formats suitable for input
to text formatters. A copy made in an otherwise Transparent file
format whose markup, or absence of markup, has been arranged to thwart
or discourage subsequent modification by readers is not Transparent.
An image format is not Transparent if used for any substantial amount
of text. A copy that is not "Transparent" is called "Opaque".
Examples of suitable formats for Transparent copies include plain
ASCII without markup, Texinfo input format, LaTeX input format, SGML
or XML using a publicly available DTD, and standard-conforming simple
HTML, PostScript or PDF designed for human modification. Examples of
transparent image formats include PNG, XCF and JPG. Opaque formats
include proprietary formats that can be read and edited only by
proprietary word processors, SGML or XML for which the DTD and/or
processing tools are not generally available, and the
machine-generated HTML, PostScript or PDF produced by some word
processors for output purposes only.
The "Title Page" means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the material
this License requires to appear in the title page. For works in
formats which do not have any title page as such, "Title Page" means
the text near the most prominent appearance of the work's title,
preceding the beginning of the body of the text.
A section "Entitled XYZ" means a named subunit of the Document whose
title either is precisely XYZ or contains XYZ in parentheses following
text that translates XYZ in another language. (Here XYZ stands for a
specific section name mentioned below, such as "Acknowledgements",
"Dedications", "Endorsements", or "History".) To "Preserve the Title"
of such a section when you modify the Document means that it remains a
section "Entitled XYZ" according to this definition.
The Document may include Warranty Disclaimers next to the notice which
states that this License applies to the Document. These Warranty
Disclaimers are considered to be included by reference in this
License, but only as regards disclaiming warranties: any other
implication that these Warranty Disclaimers may have is void and has
no effect on the meaning of this License.
2. VERBATIM COPYING
You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the
copyright notices, and the license notice saying this License applies
to the Document are reproduced in all copies, and that you add no other
conditions whatsoever to those of this License. You may not use
technical measures to obstruct or control the reading or further
copying of the copies you make or distribute. However, you may accept
compensation in exchange for copies. If you distribute a large enough
number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and
you may publicly display copies.
3. COPYING IN QUANTITY
If you publish printed copies (or copies in media that commonly have
printed covers) of the Document, numbering more than 100, and the
Document's license notice requires Cover Texts, you must enclose the
copies in covers that carry, clearly and legibly, all these Cover
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify
you as the publisher of these copies. The front cover must present
the full title with all words of the title equally prominent and
visible. You may add other material on the covers in addition.
Copying with changes limited to the covers, as long as they preserve
the title of the Document and satisfy these conditions, can be treated
as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit
reasonably) on the actual cover, and continue the rest onto adjacent
pages.
If you publish or distribute Opaque copies of the Document numbering
more than 100, you must either include a machine-readable Transparent
copy along with each Opaque copy, or state in or with each Opaque copy
a computer-network location from which the general network-using
public has access to download using public-standard network protocols
a complete Transparent copy of the Document, free of added material.
If you use the latter option, you must take reasonably prudent steps,
when you begin distribution of Opaque copies in quantity, to ensure
that this Transparent copy will remain thus accessible at the stated
location until at least one year after the last time you distribute an
Opaque copy (directly or through your agents or retailers) of that
edition to the public.
It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to give
them a chance to provide you with an updated version of the Document.
4. MODIFICATIONS
You may copy and distribute a Modified Version of the Document under
the conditions of sections 2 and 3 above, provided that you release
the Modified Version under precisely this License, with the Modified
Version filling the role of the Document, thus licensing distribution
and modification of the Modified Version to whoever possesses a copy
of it. In addition, you must do these things in the Modified Version:
A. Use in the Title Page (and on the covers, if any) a title distinct
from that of the Document, and from those of previous versions
(which should, if there were any, be listed in the History section
of the Document). You may use the same title as a previous version
if the original publisher of that version gives permission.
B. List on the Title Page, as authors, one or more persons or entities
responsible for authorship of the modifications in the Modified
Version, together with at least five of the principal authors of the
Document (all of its principal authors, if it has fewer than five),
unless they release you from this requirement.
C. State on the Title page the name of the publisher of the
Modified Version, as the publisher.
D. Preserve all the copyright notices of the Document.
E. Add an appropriate copyright notice for your modifications
adjacent to the other copyright notices.
F. Include, immediately after the copyright notices, a license notice
giving the public permission to use the Modified Version under the
terms of this License, in the form shown in the Addendum below.
G. Preserve in that license notice the full lists of Invariant Sections
and required Cover Texts given in the Document's license notice.
H. Include an unaltered copy of this License.
I. Preserve the section Entitled "History", Preserve its Title, and add
to it an item stating at least the title, year, new authors, and
publisher of the Modified Version as given on the Title Page. If
there is no section Entitled "History" in the Document, create one
stating the title, year, authors, and publisher of the Document as
given on its Title Page, then add an item describing the Modified
Version as stated in the previous sentence.
J. Preserve the network location, if any, given in the Document for
public access to a Transparent copy of the Document, and likewise
the network locations given in the Document for previous versions
it was based on. These may be placed in the "History" section.
You may omit a network location for a work that was published at
least four years before the Document itself, or if the original
publisher of the version it refers to gives permission.
K. For any section Entitled "Acknowledgements" or "Dedications",
Preserve the Title of the section, and preserve in the section all
the substance and tone of each of the contributor acknowledgements
and/or dedications given therein.
L. Preserve all the Invariant Sections of the Document,
unaltered in their text and in their titles. Section numbers
or the equivalent are not considered part of the section titles.
M. Delete any section Entitled "Endorsements". Such a section
may not be included in the Modified Version.
N. Do not retitle any existing section to be Entitled "Endorsements"
or to conflict in title with any Invariant Section.
O. Preserve any Warranty Disclaimers.
If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no material
copied from the Document, you may at your option designate some or all
of these sections as invariant. To do this, add their titles to the
list of Invariant Sections in the Modified Version's license notice.
These titles must be distinct from any other section titles.
You may add a section Entitled "Endorsements", provided it contains
nothing but endorsements of your Modified Version by various
parties--for example, statements of peer review or that the text has
been approved by an organization as the authoritative definition of a
standard.
You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list
of Cover Texts in the Modified Version. Only one passage of
Front-Cover Text and one of Back-Cover Text may be added by (or
through arrangements made by) any one entity. If the Document already
includes a cover text for the same cover, previously added by you or
by arrangement made by the same entity you are acting on behalf of,
you may not add another; but you may replace the old one, on explicit
permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License
give permission to use their names for publicity for or to assert or
imply endorsement of any Modified Version.
5. COMBINING DOCUMENTS
You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified
versions, provided that you include in the combination all of the
Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its
license notice, and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and
multiple identical Invariant Sections may be replaced with a single
copy. If there are multiple Invariant Sections with the same name but
different contents, make the title of each such section unique by
adding at the end of it, in parentheses, the name of the original
author or publisher of that section if known, or else a unique number.
Make the same adjustment to the section titles in the list of
Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections Entitled "History"
in the various original documents, forming one section Entitled
"History"; likewise combine any sections Entitled "Acknowledgements",
and any sections Entitled "Dedications". You must delete all sections
Entitled "Endorsements".
6. COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other documents
released under this License, and replace the individual copies of this
License in the various documents with a single copy that is included in
the collection, provided that you follow the rules of this License for
verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute
it individually under this License, provided you insert a copy of this
License into the extracted document, and follow this License in all
other respects regarding verbatim copying of that document.
7. AGGREGATION WITH INDEPENDENT WORKS
A compilation of the Document or its derivatives with other separate
and independent documents or works, in or on a volume of a storage or
distribution medium, is called an "aggregate" if the copyright
resulting from the compilation is not used to limit the legal rights
of the compilation's users beyond what the individual works permit.
When the Document is included in an aggregate, this License does not
apply to the other works in the aggregate which are not themselves
derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these
copies of the Document, then if the Document is less than one half of
the entire aggregate, the Document's Cover Texts may be placed on
covers that bracket the Document within the aggregate, or the
electronic equivalent of covers if the Document is in electronic form.
Otherwise they must appear on printed covers that bracket the whole
aggregate.
8. TRANSLATION
Translation is considered a kind of modification, so you may
distribute translations of the Document under the terms of section 4.
Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include
translations of some or all Invariant Sections in addition to the
original versions of these Invariant Sections. You may include a
translation of this License, and all the license notices in the
Document, and any Warranty Disclaimers, provided that you also include
the original English version of this License and the original versions
of those notices and disclaimers. In case of a disagreement between
the translation and the original version of this License or a notice
or disclaimer, the original version will prevail.
If a section in the Document is Entitled "Acknowledgements",
"Dedications", or "History", the requirement (section 4) to Preserve
its Title (section 1) will typically require changing the actual
title.
9. TERMINATION
You may not copy, modify, sublicense, or distribute the Document except
as expressly provided for under this License. Any other attempt to
copy, modify, sublicense or distribute the Document is void, and will
automatically terminate your rights under this License. However,
parties who have received copies, or rights, from you under this
License will not have their licenses terminated so long as such
parties remain in full compliance.
10. FUTURE REVISIONS OF THIS LICENSE
The Free Software Foundation may publish new, revised versions
of the GNU Free Documentation 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. See
http://www.gnu.org/copyleft/.
Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this
License "or any later version" applies to it, you have the option of
following the terms and conditions either of that specified version or
of any later version that has been published (not as a draft) by the
Free Software Foundation. If the Document does not specify a version
number of this License, you may choose any version ever published (not
as a draft) by the Free Software Foundation.
ADDENDUM: How to use this License for your documents
To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
license notices just after the title page:
Copyright (c) YEAR YOUR NAME.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
replace the "with...Texts." line with this:
with the Invariant Sections being LIST THEIR TITLES, with the
Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.
If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License,
to permit their use in free software.

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

@ -0,0 +1,655 @@
Changes since version 0.10.0b
- Use html page baseurl for resolving urls from the knpplayer backend
- Initialize thread support for knpplayer, makes knpplayer crashes go away
- Second part of set viewarea background to part's parent background
Changes since version 0.10.0a
- Fix some flash wanting full Url out of a relative Url before streaming data
- Hardcode flash mimetypes in pluginsinfo
- Fix kpart not reading the system global kmplayerrc
- Set viewarea background to part's parent background for the plugin
- Fix kxineplayer crash when sending the configurations
Changes since version 0.10.0
- Fix npp streams with javascript urls, that never reached the finish state
- Fix memory leak in SMIL image
- Get rid of nspr dependency
Changes since version 0.10.0-pre3
- Fix double scaling of video in a region
- Use XPLAIN again for npp's GtkPlug embedded in QXEmbed, makes reproducable
mouse grab go away
Changes since version 0.10.0-pre2
- Fix unpausing with multi items from playlist
- Compile fix for gcc >= 4.2
- Cairo painting speedups, always round to screen pixel values
- Adjust for timer drifting in SMIL files
- SMIL additions, add AnimateMotion, more transition types, transOut support,
region background image and 'showBackground' attribute among others
- Replace -vop with -vf for MPlayer
Changes since version 0.9.4a
- Allow per mimetype preferred player backend
- Add npp backend that plays xembed style browser plugins
Changes since version 0.9.4
- Crash fix in playlist change while still playing
- Support for mouse events on 'area' elements in SMIL
- Clear the 'Connecting' status message when we got the data
- Fix regression in 0.9.4, xine added reference links weren't auto played
- Fix painting gifs that where larger than qmovie default buffer size
- Support SMIL 'fillDefault' attribute
- Globally share XML attribute names, reducing memory pressure
- Fix region painting regression to limit updating only the region rectangle
- Add audio/x-ms* to list of possible playlists
Changes since version 0.9.3a
- Support for MPlayer ICY stream info
- Fix flashing/resizing infowindow between two items having info
- Podcast item w/o an enclose but having a description now keep them self
active for a calculated time
- Fix easy breaking reading CDATA sections
- Changed intro animation, making it slightly shorter and using fade transition
- Add support for SMIL linknodes a and area, brush and transiton (only fade)
- RealPix's fades now realy fades in or out
- Moved SMIL/RealPix painting to libcairo
- Fix auto hiding controlpanel disappeared after switching to console view
- Fix autohiding controlpanel when there is also a statusbar
Changes since version 0.9.3
- Reading RAM playlists should stop on '--stop--' stop lines
- Make playlist occuring on top less likely
- Support for 'repeatCount="indefinite"' in SMIL
- Fix uninitialized member in GenericMrl, eg. reopening saved playlist crashed
- "quot" entity fix in XML parser
- Also show content of cdata sections in infoview w/ RSS and XSPF
- Fix konqueror wheel spinning when HTML object has an 'autostart=0' set
- Fix possible hang in RemoteObject for SMIL or RealPix
- Don't play exit animation when KDE terminates
- Nested playlist fix for RSS and XSPF
- Item 'Playlist', of panel's popup menu, didn't work in fullscreen/minimal view
- Allow Xine as player for TV using v4l:/Tuner/frequency mrls
Changes since version 0.9.3-rc1
- Fix audio/video CD w/ MPlayer adding more and more nodes on restart
- MPlayer movie length detection fix for URLs in lists
- Fix playlistview accessing root node w/o checking (crash fix)
- XML Shareable Playlist Format (aka spiff) support
- Fixed editing in place tree of URL, they were modified by KURL::prettyURL()
- Fixed missing 'NotRunning' state change notification in some cases
- Window title for playlists fix, either group name or item URL
- Catergory items should not be editable
Changes since version 0.9.3-pre2
- Patch from bero, add more output audio and video drivers
- Frequencies for Xv TV watching should now be in MHz (like with MPlayer)
- Add more help in the handbook about the backends and the playlist format
- Support MPLAYEROPTS argument for group/item nodes to add extra settings
- Add option to set path/application name for mplayer backend
- Fix possible crash when updating the playlist tree from QListView click events
- Add 'Delete item' and MoveUp/Down for persistent playlists context menu and TV
- Delay loading of recent XML file to first item played or category opened
- Defaults to not show progress slider instead of having a disabled slider,
this greatly improves channel switching with Xv and the bttv driver
- Properly stop kmplayer when 'hanging' in the resolving state, also add
'Connecting' when starting resolving
Changes since version 0.9.3-pre1
- Support for audio cdrom
- Fixes for 'Persistent Playlists' tree; drop position didn't account for
scrollbar position, painting fixes, popup menu position and dropping an item
in a not-yet-loaded tree created a temporary ghost tree
Changes since version 0.9.2a
- Painting of root items in playlist view as 'Window Background'
- Add a 'Persistent Playlists' sub tree to playlist view, editing by D&D,
in-place node editing or changing the XML directly using the 'Edit Mode'
- Add a 'Most Recent' sub tree to playlist view, when having more than 10
items, automatic create a sub tree 'More ..'
- Merge TV input and device name to make tree one step less deep
- Add Television as persistent sub tree to playlist view
- Add 'Optical Disks' with VCD/DVD as persistent sub tree to playlist view
- Make playlist tree less deep and remove the branches paintings
- Plugin fix for http://www.orbital.pt/ for Konqueror >= 3.5.4 users
Changes since version 0.9.2
- Fix realvideo on tagesschau.de, support control lists as well
- Toolbar can now be changed using KDE's default KEditToolbar dialog
- Support 'ref' media tags and 'meta' head tags for Smil
- TV source channel switching using Xv player now lowers volume for a short time
- Fix passing playlist files at the commandline, were directly fed to backends
- Fix ASX in case entries point to other playlist files, these weren't resolved
- With plugin, undo infowindow or controlpanel only view if video output
is detected (basically undo (mis)detection which controls to show)
- Fix set Edit mode window to plain text, it interpretered HTML tags
Changes since version 0.9.2-rc1
- Added a DCOP call 'isPlaying()' that returns true when backend is running
and a DCOP call 'isPlaying()' on the backends, other than MPlayer, that
returns true when not paused
- Fix having to press 'pause' twice for unpause and pausing not working with
playlists (likely regression since 0.9.2-pre1)
- Compile fix for when not using Xine (regression in 0.9.2-rc1)
- Crash fix when restarting certain SMIL files, eg when having an RealPix img
Changes since version 0.9.2-pre3
- Recorder added using Xine's mrl setup (see xine-ui-ver/doc/README.en.15.MRLs)
- Seeking support for gstreamer backend
- Ported gstreamer backend from 0.8 to 0.10
- Fix length parsing for MPlayer current CVS version (by Jonas Hurrelmann)
Changes since version 0.9.2-pre2
- Update with 0.9.1c
- SMIL files can be part of other SMIL files
- y-coordinate fix for images in RealPix
Changes since version 0.9.2-pre1
- Update with 0.9.1b
- Added RealPix support for SMIL animations
Changes since version 0.9.1c
- Option added to disable color setting on movie start
- Simple playlist edit mode, edit (sub)tree in raw XML
- SMIL animations can be paused now
Changes since version 0.9.1b
- WMP's showdisplay object argument interpretation fix, it's about clip info
- Fix current playlist item not visual selected and plugin's playlist not
showing HTML object's arguments (regression in 0.9.1b compared to 0.9.1a)
- Fix KHTML setting palette on controlpanel, buttons weren't updated
- Double click on video widget for Xine/Gst/Xv or background toggles fullscreen
Changes since version 0.9.1a
- WMP plugin fix for not showing video widget when 'controls' is
specified
- Fix for audio only plugin group for real
- Fix media:// url's
- Crash fix for SMIL when resolving multible url's simultaneously
- Don't play exit animation if started with an url
- Fix for plugin w/ floating statusbar,wrong parent was set
- Real plugin fix for 'controls=All', shouldn't show video widget
- Support for uimode/nolabels/nocontrols/showdisplay/showcontrols/showstatusbar
attributes for WMP's embedded object emulation
- Autohide controlpanel w/ 'Click to play' and support for TARGET attribute
for QT embedded object emulation
Changes since version 0.9.1
- Fix that switching channels w/ VDR sometimes stopped the backend
- Fix saving playlist looses cdata sections (if any) and don't normalize them
- Fix application window stays hidden when fullscreen window closed with ALT_F4
- Fix parser closing root's parent object when reading a XML file in an
existing playlist (ie. a playlist item points to a broken XML playlist file)
- Fix small chance of crashing by the intro movie when choosing another
source very fast (eg. when having, and using, a shortcut for VDR directly)
- Remove hardcode Esc shortcut to escape fullscreen mode, it clashes with
canceling playlist editing
- Workaround bug in KListView when clearing the playlist while it's editing
an item, by clearing Focus on any child widget. Also move focus back to
ViewArea when an item is executed
Changes since version 0.9.1-rc1
- Added Find/FindNext in playlist's context menu
- Intro-movie's background will finish when clicked on its background
- Fix possible crash w/ plugin if javascript did a 'put' on an unknown property
- Support reading playlist files from media:// or remote:// protocols, movie
files that resolve to these, still doesn't work though
- Support SMIL's 'begin' attribute on group tags (seq/par/excl) as well
- Fix not honouring MPlayer's aspects detection in case it's not width:height
- Fix MPlayer with the X11Shm video driver not scaling correctly when
'keep aspects' is set
- Fix Xine not resuming on 'pause' when pressing the 'pause' button again
- Fix to not let the session manager restore a backend application as well
- Support for CONTROLS="StatusBar" for plugin, having the same statusbar
as application. See tests/controls.html, after installing KMPlayer-plugin,
with konqueror (also used on many sites when choosing for real format)
Changes since version 0.9.1-pre3
- Show backend's status in application's statusbar and show the play time
left as well.
- Add OBJECT's attributes coming from khtml to the document of urlsource, that
might be helpful for web developers (using the 'Show all' feature of playlist)
- Add KAction for showing the control or language popup menu
- Put colors and font settings on a separate tab, reducing total config
dialog dimensions
- Fix restoring playlist causing flashing on screen after intro animation
- Also remember window location for window->minimal mode->window
- Integrate MPlayer's languague/subtitles menus for DVD with new languague
popup menu and seek to current position when changing languague/subtitles
with MPlayer
- Support for audio/subtitles within a stream. A language button will be added
when detected which has submenus for the languages. GStreamer only subtitles
with an external url ATM.
Changes since version 0.9.1-pre2
- Support for CONTROLS="Playlist" for plugin
- Support for <base HREF='...'/> tags for ASX
- Network bandwidth setting added, this is used in SMIL's <switch> element
when <video> or <audio> elements have a system-bitrate attribute
- Unpushing the playbutton now actually stops playing
- Fix kxineplayer crashing on exit due to double deletion
- Keep playlist entry in popupmenu, controlpanel button might be gone
- Remember window location so window->fullscreen->window is at same place again
- Option to not resize on opening new source added
- Fix ASX Entry's having more than one Ref child nodes, current wasn't set
right in playlist (did play though)
Changes since version 0.9.1-pre1
- Playlist button of controlpanel has no use when in fullscreen or minimal
mode, so reuse if for a back-to-normal-window button
- Fixed bug in plugin, 0.9.1-pre1 only, that messed up all attributes passed
to KMPlayer from KHTML and likely breaking lots of webpages having
audio/video and also omitting KMPlayer's checks for local access.
- Shorten intro/exit animations and also animate the icon rise and fall
- SMIL's regPoint/regAlign support
- Don't resize kpart if 'intrinsic' size is 0x0
- Don't resize for intro/exit animations
- XML export, or regenerate in case of XML playlist, of loaded playlist.
- Fix possible crash when changing source from the TV source to another one.
Changes since version 0.9.0c
- Font settings for playlist and infowindow added.
- Color settings for infowindow added.
- Added some docu about intro/exit movies and kmplayer:// urls in handbook.
- Added minimal mode option that hides playlist, status- and menubar and
autohides the controlpanel.
- Moved playlist option from popupmenu to controlpanel and a configure option
whether to show this button
Changes since version 0.9.0b
- Fix 1+ movies become black&white with Xine backend playing the playlist
- Fix the 'Remember window size on exit' setting and make the 'Always start
with fixed size' setting use the last remembered size.
- Fix XML parser if two or more entities follow each other and block a
possible stack overflow
- Check for local file access on playlist items too
- Hide more XML nodes in playlist if they don't have a title
- Fix displaying jpeg pictures in SMIL's <img> elements
- Make sure to reset view after playing
- Add js binding to DoPlayPause for real plugin
- Try to restore playlist to previous position
- Fix creating default region in SMIL (if no <layout> is found)
- Show inner text in infowindow if clicked on an element that isn't a mrl
- Support for Atom type podcast playlists, plays <link rel="enclosure" src=../>
- Add a scale slider to popup menu when in fullscreen. This is particular
useful if watching a 4:3 movie on a widescreen display.
- Allow for custom intro/exit movies when exists {intro,exit}.xml in either
$KDEDIR/share/apps/kmplayer/ or an user's .kde/share/apps/kmplayer/
Changes since version 0.9.0a
- Removed decoration (+ and - for tree) from root item in playlist, saving
16px horizontal. Also set icon for this item to an url.
- Removed extra text/html mimetype check for playlist detection. Seems some
sites use this mimetype for ASX too.
- Fixed random navigating in ASX playlists.
- Don't show a folder icon when playlist item has no childeren and isn't a
multi-media link either.
- Make playlist menu/toolbar item a toggle for show and hide.
- Combine console/video toolbar buttons and menu items as one toggle and get
rid of 'View' submenu in popup menu. Fill gap on toolbar with zoom100%
- Clear history didn't clear 'Recent files' permanently.
Changes since version 0.9.0
- Fixed last minute change that broke almost all Podcast RSS support
Changes since version 0.9.0-rc1
- Fix the broken recording from rc1 and possible some pre's too
- start and end with a simple smil document if started with no url.
Can be turned off in rc file with option "No Intro=1" in section
"[General Options]".
- support Podcast rss urls, list chanel/item/enclosure tags and play url
arguments of enclosure elements and display inner text from description
in info window
- Added an info panel that is now implemented as a dockable view, this should
become the infopanel for Real plugin's CONTROLS attribute possibility. Put
messages from Xine backend in this window.
Changes since version 0.9.0-pre4
- In place renaming of TV channel/input names in playlist
- Added help sections for TV and VDR in handbook.
- TV settings are now stored in ~/.kde/share/apps/kmplayer/tv.xml. There is an
automatic conversion. Should make manual changes more easy, see handbook for
the format. Now also XVideo port and encoding can be configured, although
manually only.
- More work on SMIL. Allow playing mediatype elements w/o having a region
assigned, fixes audio only streams (eg. with the <audio> tag).
- Optionally use the expat SAX parser (instead of kmplayer's own one) when
configured with --enable-expat. Note, the expat parser is more strict and
therefor can misread some ASX files.
Changes since version 0.9.0-pre3
- Fix for DVD submenus for MPlayer and update regexp for audio/subtitle
languages
- More work on SMIL. Show active SMIL element in playlist using the color
settings. Like mediatypes, if set/animate elements have a duration than it
should not deactivate itself immediately.
- Undo 'First jump to URL source page when opening an URL' from 0.8.1. Now the
'Configure KMPlayer' option jumps to that page. File open, opens a file
dialog again (and can select multible files)
- Allow opening multible files
- Support for gif movies in SMIL's 'img' element
- Regression fix plugin; when split over multible objects, the base url could
be opened instead of the SRC url.
Changes since version 0.9.0-pre2
- Support javascript properties FileName and Volume
- Internal redesign of DOM classes
- Store current url in KDE's session config
- Added a 'Clear History' action, that will clear recent files and URL source
history
- Delayed mouse hiding in fullscreen, patch from Ben Laenen
- Option for docking in system tray
- Smarter painting when moving regions in SMIL document
- More work on SMIL support. Implemented animate's 'values' attribute and
'calcMode="discrete"'. Added 'fit' attribute for mediatypes (only used
for images now, and value 'scroll' is not implemented). Group
'excl' is now supported. Text elements are rendered by QTextEdit, so it
supports html now too. Updated applications in tests/ directory
Changes since version 0.9.0-pre1
- Include tests directory
Changes since version 0.8.4b
- Build fix for compiling with -fvisibility=hidden
- More work on SMIL, support for layout/root-layout/region tags so one can
position a mediatype in a rectangle, other than video/audio also support
for text/img mediatypes and flow control with begin/dur/end attribute that
can be time values but also (mouse) events or clip ends and set/animate can
be used to alter arguments on-the-fly.
- Added option to adjust the colors of playlist and viewing area
- Added an option in playlist context menu to show all nodes in case of XML
based playlists (ASX or SMIL)
- Added option whether backends should set volume on start
- Original gcc-2.95 compile fixes (Leo Savernik)
Changes since version 0.8.4a
- gcc-2.95 compile fixes (Leo Savernik) hopefully correctly backported
- Read playlist from audio/m3u mimetypes
- Don't print log to stdout but to stderr instead (BR100422)
- Don't set volume on starting MPlayer because MPlayer sets volume relative
to current volume (BR99953)
Changes since version 0.8.4
- Fix keyboard shortcuts for increase/decrease volume for fullscreen
- Better 100% zoom calculation
- Prevents ways to crash KMPlayer via DCOP when just started
- Fix MPlayer's command queue after manually stop a movie
Changes since version 0.8.4-rc5
- Debian builds now a kmplayer-i18n package too
- Controlpanel uses paletteForegroundColor for drawing
- Added a volume control to controlpanel that let backends control the volume
(unlike the slider in menu, which uses kmix) + two actions for shortcut
possibility in 'Configure Shortcuts' dialog
- Bookmarking a VDR channel now bookmarks it as kmplayer://vdrsource/channel
- When controlpanel is in autohide mode, move it over the video instead of
shifting the video up causing annoying flickering (bug 96861)
- up/down/ok/back/menu for VDR are added to the toolbar as well when connected
- Unmute DVB card when VDR reports volume of zero, restore on exit
- Auto scroll playlist when current is outside the viewing area
Changes since version 0.8.4-rc4
- Recording now stops movie playing after hitting 'Start Recording'
- Be less strict with parsing ASX (and SMIL) play list files
- Internals: merge code from backends, with the 'never reaching' goal to add
a new backend just by configuration (plus a backend player of course)
- Internals: move playlist handling to Partbase, instead of each process have
their own tricks. Also kxineplayer accepts '-vo x11' now, kgstreamer eats
local url's w/o file:// prefix.
- Internals: re-implement backend XML config and TV config data using own
DOM-like classes for no less reason than increasing the code coolness :-)
- Added view video/playlist/console to toolbar
- Playlist will default appear on top if there are only a few items
- TV inputs/channels are now displayed inside the playlist, instead of a menu
- kxvplayer also accounts for frequency setting when guessing the xvideo port,
more usable for TV viewing
- Move all library classes to the KMPlayer namespace and strip the KMPlayer
prefix in the name. Rename class KMPlayer itself to PartBase.
- Binary data detection when reading a playlist that turns out to be
video/audio stream (instead of creating a playlist w/ wierd names)
Changes since version 0.8.4-rc3
- Look for title entries in ASX and .pls files for playlist items
- DemiBold font for playlist and console log window for readability
- Begin of GStreamer backend support, local file only
- Allow disconnect/connect for VDR while still playing, allows other apps to
access the VDR port
- Actively determine mime-type for playlist detection (was guess on extension
or use the one the plugin got from konqueror)
- VCD tracks are, for MPlayer only, displayed in playlist and not in menu
- Added custom command for VDR, output to console view
- Made command interaction with VDR much more reliable
Changes since version 0.8.4-rc2
- Added a XVideo player (kxvplayer) process. Used now for viewing VDR
- Fixed various crash cases with the playlist
- Playlist view is dockable now
Changes since version 0.8.4-rc1
- Oops, left an ugly hack in the icon loading for the playlist tree, can crash
konqueror.
- Some playlist tree visualization ordering fixes
Changes since version 0.8.3a
- Nice icons from Marcel Dierkes, thanks!!!
- Replaced internal playlist structure from std::list to DOM
- Removed the 'Show Console' option, now one can always switch to the console
output window
- Visualization of internal playlist, becomes one of the
video/playlist/console views of the data
- More icons in the menus and some context menus added
Changes since version 0.8.3
- Auto hiding in fullscreen fix
- Mencoder recording fix for URLs
- Yet another spurious seek locking Xine when playing a playlist
- Comment out NoExpose debug line with kxineplayer
Changes since version 0.8.3-rc5
- Two more regression fixes in show cache progress, get rid of spurious seek
command caused by switching progress slider usage and don't update playing
position if there is no position change (might fill cache instead).
- Xinerama fix, fullscreen on display where video widget is on.
Changes since version 0.8.3-rc4
- Fix regression in show cache progress in 0.8.3-rc2, which made the xine
backend hang on some web movies
- Ripped out the arts volume slider. Now you only get a volume slider if you
run kmix standalone or as an applet in kicker.
- Try to limit symbols in the shared objects by using KDE_NO_EXPORT. Although
hard to measure, hopefully speed up loading the plugin
- New recorder (mplayer -dumpstream) from Stefan Siegel
Changes since version 0.8.3-rc3a
- Downloading of .m3u/.pls also eats .asx, so try to read this one too. This
fixes also MPlayer-1.0pre not been able to read .asx files.
- Make sure if we're downloading a playlist file, it isn't bigger than 50k
- More or less revert the alsa5/alsa9 change to just alsa. Seems latest
MPlayer doesn't work with alsa5/alsa9. Although they are still available.
Changes since version 0.8.3-rc3
- add AM_MAINTAINER_MODE in configure.in.in, no recheck/automake/autoconf
version mismatch
Changes since version 0.8.3-rc2
- All QtoolTips to QWhatsThis and help from Xine for whatsthis by xine options
- Store xine settings in ~/.kde/share/apps/kmplayer/xine_config and not in
~/.xine/config2. Save the first time if file does not exist (Automaticly
sets the misc.memcpy_method).
- Added a debian build directory, builds a kmplayer-lib, kmplayer-plugin and a
kmplayer-app package. Eg. install only kmplayer-lib and kmplayer-plugin if
you prefer another player but do want the plugin for konqueror.
- Added protocol files for mms://, rtsp:// and pnm://
- Position slider now also shows progress of the cache fill
Changes since version 0.8.3-rc1
- Remove configure options for control buttons. Simply always autohide for
fullscreen and embedded part and show them otherwise
- Fix another case of video widget stays black cause in kxineplayer
- If position slider is hidden, make buttons small again (like <= 0.8.2)
- Support for AUTOSTART attribute
- Support for FULLSCREENMODE attribute
- Seeking while sliding :-)
- Local .pls and .m3u playlist files support. Works too if autodownloaded, eg
pls' on http://www.shoutcast.com should work now
Changes since version 0.8.2
- fix for the "video window stays (sometimes/often) black" bug, which seems to
occur more with the latest Qt versions. KMPlayer uses a XSimpleWindow now
that is managed by QXEmbed
- Support for Real's CONTROLS/CONSOLE attributes. This makes it possible
multible plugins cooperate with imagewindow/controlpanel
- Combine control buttons and position slider to one control panel
Changes since version 0.8.2-rc5
- Don't show ffserver setting when no v4l devices are configured
- Stream detection fix for MPlayer-1.0prex (needed for recording)
Changes since version 0.8.2-rc4
- Locale fixes for Xine
- Let Xine play all URLs in playlist
- Change alsa to alsa5/alsa9 audio driver for MPlayer
Changes since version 0.8.2-rc3
- Compile fix for Qt-3.1
- Compile fix for xine-lib-1-rc2
Changes since version 0.8.2-rc2
- Add audio/x-pn-realaudio to supported mimetypes
- Fix for filenames containing a #
- Build fix for KDE-3.1.x
- Add audio.visualization property for Xine (very nice for eg. web radio)
Changes since version 0.8.2-rc1
- Don't fill X log with ffmpeg output
- Jump to broadcast config page first when clicking broadcast button
- 'Start' button on broadcast config page and two leds for ffserver and ffmpeg
- dvd/vcd fix (regression from '-frames 0' removal
- put mplayer's output patterns in a QTable
- default to asf for ffserver
Changes since version 0.8.1a
- MPlayer-1.0-pre is default now ([MPlayer] Post MPlayer 0.90=true in
kmplayerrc)
- Removed the '-frames 0' switch for MPlayer-1.0-pre, now identifying is done
in one stroke with playback (faster playing, less sensible to failures)
- Xine configuration tab for convenient editing of ~/.xine/config2
- Made config dialog somewhat flexible, and TV/broadcast settings are now
not available when launched from the plugin
- Change dir of mplayer/kxineplayer process if playing a local file. Hopefully
fixes relative links in supported playlist files.
- Profiles for broadcasting
- Fixed always having a left/right black border with Xine
- Sub title support (although MPlayer-1.0-pre3 crashes with '-sub' option)
Changes since version 0.8.1
- Fix for Web object having HREF attributes and not 'Click to Play' enabled
- Allow opening 'vcd://' and 'dvd://' URLs (useful for Xine VCD Nav)
- Pass vcd/dvd device setting to kxineplayer
Changes since version 0.8.1-rc1
- Delay arts volume initialization for faster startup when not build with
--disable-arts-volume
- First jump to URL source page when opening an URL
- Added history combo for URL on URL source page
- Replaced tree for icons with tabs in settings dialog
Changes since version 0.8b
- First jump to recording page when pressing the record button
- Optionally use ffmpeg for recording (URL or v4l sources)
- Fix mplayer v4l device scanning for mplayer > 0.91
- Bookmarks added
- Beginning of more configurable mencoder options
- Fix signaling of backend player play (regression from 0.8b)
Changes since version 0.8a
- Layout fixes in configuration dialog
- Fix loading percentage feedback
- Fix console output for kxineplayer
- Fix tv channel switching
Changes since version 0.8
- Fix forward/backward/position seek for mplayer and implemented for kxineplayer
- Hide zoom sub menu when in fullscreen
Changes since version 0.7.97
- Locale fix for filenames
- Added audio/x-ms-wma mimetype
Changes since version 0.7.96
- Build changes, kdeinit wasn't used (speeds up loading) and an option for
disabling arts volume slider (eg. if you use kmix already)
use --disable-arts-volume with configure and it prevents linking agains the
arts libs (speeds up loading of kmplayer too)
- Moved color sliders to a sub menu, fix it for mplayer
Changes since version 0.7.95
- Support for mplayer/mencoder from CVS. Set 'Post MPlayer 0.90=true' in
.kde/share/config/kmplayer.rc under group [MPlayer] to use it.
- Also enable DVD playing using kxineplayer (dvdnav, yeah!)
Changes since version 0.7.4c
- Added a simple Xine player backend (kxineplayer). Basically a finger practice
for the upcoming MPlayer-G2 lib, but now quite useful for rtsp/real playback.
Works only for URLs
- Added the javascript bindings to mimic a realplay plugin (only some are
really doing something). You must set KMPlayer as default viewer for
audio/x-pn-realaudio to use it.
- Support for 'Click to play' start images as found on
http://www.apple.com/switch/ads/
- Broadcast, http streaming, for video devices (needs ffmpeg/ffserver)
"Say hi to a friend", if you have a webcam.
Changes since version 0.7.4b
- Fix postprocessing checkbox
- Fix proxy setting for mplayer process
Changes since version 0.7.4a
- Height calculation fix when position slider is visible
- Q&D fix for mplayer compiled with locale output (,->. for aspect)
- Aspect fix for fullscreen when embedded in khtml
- Position slider fix VCD, re-determine length for each track
Changes since version 0.7.4
- Fix VCD playing
Changes since version 0.7.3
- Re-added the main application toolbar
- Re-identify dvd if another title is selected, because they have different
chapters/subtitles/languagues/length
- Added a record button. Currently only configurable in kmplayerrc, see the
mencoder options in mplayer man page. Doesn't work for audio only streams.
- New config dialog from Joonas Koivunen
- Support for MPlayer's experimental TV capturing (use with care, I need to
rmmod bttv, tvaudio and msp3400 to get xawtv working again afterwards)
No audio capturing for now
- Added a position slider
- Fixed two cases of double deletes found by valgrind
Changes since version 0.7.2
- Make using of arts optional, now that the volume slider automatic starts
artsd
- Patch from Rainer Blessing; show/hide menubar. Enhanced it a bit for
people, like me, who forget how to get it back again.
Changes since version 0.7.1
- Check for an onFinished handler before emiting it
- Great patch from Joonas Koivunen, add postprocessing filter configuration
Changes since version 0.7a
- Added a 'Open Pipe' item to 'Source' menu for mplayer reading from stdin.
Of course slave commands doesn't work here (forward/backward/pause/...)
And I had some hard time killing mplayer this way (make 'stop' work).
Not available for the embedded part.
- Add tearoff handle to 'DVD'/'VCD' menus
- Changed 'File' menu to 'Source' menu and move 'DVD'/'VCD' to it
- Use KProtocolManager::proxyForURL to determine if http_proxy should be set.
Copied some code from KProtocolManager::slaveProtocol for the exceptions.
MPlayer seems to only support http protocol proxies.
- End fullscreen mode when movie ends when embedded
- Zoom fix when embedded, 100% resets original movie size
- Move config button to front, makes it accessable for very small movies
- Also delay hiding of control buttons a bit
Changes since version 0.7
- Arts::Dispatcher -> KArtsDispatcher, fix multiple use crash
Changes since version 0.6.5b
- Zoom sub menu added in popup menu
- Arts volume slider added in popup menu
- Fullscreen mode for part (when embedded)
- Small config button shows a popup menu now
- Set environment variable http_proxy in mplayer's process when defined
- Use LiveConnect for automatic resizing to movie size when embedded in khtml
fixes movie sizes at http://wwwa.accuweather.com, needs KDE-3.1 from cvs
- Typo in application/x-mplayer2 mimetype
Changes since version 0.6.5a
- Remove -mpentium4 from admin/acinclude.m4.in (build fix)
Changes since version 0.6.5
- Changed regexp in wrong string fix
Changes since version 0.6.4
- Don't set a subtitle automatically
- Put some basic install instructions in README
- Get rid of the compiler warnings
- Added ; at end of Patterns in mimetypes. Lets hope this fixes the mimetype
install
- Changed regexp; mplayer rc3 changed "Start playing" to "Starting playback"
- Fix uncheck of subtitle/language DVD menu
Changes since version 0.6.3a
- View Arts Control menu option (kdemultimedia)
- disable screensaver in fullscreen mode
- more user feedback; BrowserExtension::infoMessage for cache fill
- start hiding buttons when the movie starts, not when mplayer is executed
- do a lowercase match on HREF, fixes more on http://www.apple.com/switch/ads/
Changes since version 0.6.3
- compile fix for KDE-3.1 'kdDebug () << KURL' works only in HEAD
Changes since version 0.6.2
- Play HREF's if given, fixes movies at http://www.apple.com/trailers
Changes since version 0.6.1
- added auto hide buttons option
- drop -alang and -slang in favor of -aid and -sid (fix duplicate languages)
= synchronious killing of mplayer in KMPlayer's part dtor, fix possible crash
- implemented some BrowserExtension functions,
loadingProgress, better progress feedback in konqueror of cache fill
save/restoreState, backward/forward works now in konqueror
setLocationBarURL when url changes in config dialog, updates locationbar
- added video/x-ms-asf mimetype, now I can watch webtv from www.dsltv.nl :-)
- sync config after each Ok/Apply
- fix url argument (was broken by fix file argument)
- fix crash, ConfigDialog already destoyed by view
Changes since version 0.6
- fix kmplayer file argument without path
- fix some memory leaks
- fix ratio settings when setting a new URL from the configure dialog
- make loop non default (MPlayer bug workaround)
- drop quoteURL, use KProcess:quote
- add VCD menu
- --enable-final fix
- gcc-2.95.x compile fix
Changes since version 0.5
- Made colors of console output window darker
- Fix for not restoring main window size
- Don't have an useless toolbar
- Make DVD menu optional
- Make buttonbar optional
- Add loop option
- Config dialog added
- Quick fix for File|Quit hang
- Fix escaping bug
- Make keep width/height ratio default
Changes since version 0.4
- Make small control buttons even smaller and flat
- Play and Stop buttons are toggles
- Try even harder to kill mplayer
- Make console output window optional
- More config options, eg. mplayer output patterns
(use vi .kde/share/config/kmplayerrc for now)
- Added an extra mimetype application/x-mplayer2 (how many are ther for wmf?)
I hope someone can tell me why these mimetypes doesn't show up in file
associatives.
- a patch for mplayer x11 video driver, for those that don't have xv

@ -0,0 +1,167 @@
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes a while. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Type `make install' to install the programs and any data files and
documentation.
4. You can remove the program binaries and object files from the
source code directory by typing `make clean'.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made.
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.

@ -0,0 +1,16 @@
if need_kde33_compatibility
KDE33PROTOCOLS = protocols
endif
SUBDIRS = mimetypes $(KDE33PROTOCOLS) src icons doc po
EXTRA_DIST = AUTHORS COPYING ChangeLog INSTALL README TODO kmplayer.lsm
$(top_srcdir)/configure.in: configure.in.in $(top_srcdir)/subdirs
cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common configure.in ;
$(top_srcdir)/subdirs:
cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common subdirs
$(top_srcdir)/acinclude.m4: $(top_srcdir)/admin/acinclude.m4.in $(top_srcdir)/admin/libtool.m4.in
@cd $(top_srcdir) && cat admin/acinclude.m4.in admin/libtool.m4.in > acinclude.m4

@ -0,0 +1,53 @@
KMPlayer, a simple frontend for MPlayer/FFMpeg/Xine.
It can play DVD/VCD movies, from file or url and from a video device.
If setup right, KMPlayer can embed inside konqueror. Which means if you click
on a movie file, the movie is played inside konqueror.
It can also embed inside khtml, enabling movie playback inside a html page.
Movie recording using mencoder (part of the mplayer package). No video during recording, but you can always open a new window and play it there.
Broadcasting, http streaming, by using ffserver/ffmpeg. For TV sources, you need v4lctl (part of the xawtv package).
KMPlayer needs KDE3.1 and a working mplayer/mencoder somewhere in you PATH.
Additonally, for broadcasting, ffserver/ffmpeg/v4lctl also.
For DVD navigation Xine is used. MPlayer has broken dvdnav support. DVDNav is included in libxine and works fine.
Unless you reconfigure kmplayer, both mplayer and ffmpeg should be compiled with liblame for mp3.
Quickly installing MPlayer
Download the sources from http://www.mplayerhq.hu/homepage/.
If you want quicktime support, also download the quicktime dll's
(http://www.mplayerhq.hu/MPlayer/releases/codecs/qt6dlls.tar.bz2) and unpack
them and copy the files to /usr/lib/win32 (make this dir if it doesn't exist).
Or download the 'All in one' package and have even more codecs.
Untar the mplayer source package (tar xfj MPlayer-0.90.tar.bz2), change to
that directory. Make sure $KDEDIR/bin is in you path (check if you can run
'artsplay').
Now run configure (./configure) and make ('make'). Install it as root ('su -c "make install"').
Finally you must setup the config files in ~/.mplayer ('mkdir ~/.mplayer').
Copy the files, from the mplayer sources, etc/codecs.conf and etc/example.conf as codecs.conf and config resp
('cp etc/codecs.conf ~/.mplayer; cp etc/example.conf ~/.mplayer/config').
Next change ~/.mplayer/config with an editor and change the video driver (vo=xv) and audio driver (ao=arts) and remove the last line.
Quickly installing Xine
Download the sources for libxine (xine-lib-1-beta12.tar.gz) from http://xinehq.de. Unpack it (tar xfz xine-lib-1-beta12.tar.gz) and change to this directory (cd xine-lib-1-beta12). Now run configure (./configure) and make ('make'). Install it as root ('su -c "make install"').
Recommended, for encrypted DVDs, install libdvdcss from http://developers.videolan.org/libdvdcss too.
Xine can use the codecs for MPlayer in /usr/lib/win32, however it can't find
the real codecs in there. Eg run
$ strings /usr/local/lib/xine/plugins/1.0.0/xineplug_decode_real.so |grep drv
after installing to see where it looks for the Real codecs. Either copy or
symlink for Xine to find them.
Quickly installing ffmpeg/ffserver
Download the sources from http://ffmpeg.sourceforge.net/. If the current version is 0.4.6, I recommend using a more recent CVS snapshot because it uses less CPU when grabbing a TV device.
Untar the source package, run './configure --enable-mp3lame' and 'make'. Install as root 'su -c "make install"'.
KMPlayer doesn't work with all the video drivers that mplayer supports.
I tested only xv (X Video Extension) and x11 (Image/Shm). If none work, you
might try the patch for the x11 driver and see if that works for you (not needed anymore for mplayer version >= 0.90-rc4).
You might need to change mimetype settings (Control Center | KDE Components | File Associations) to make sure KMPlayer (or 'Embedded MPlayer for KDE' in embedded tab) is set for all the formats you want to play with KMPlayer.
Also make sure in the 'Embedding' tab 'Show file in embedded viewer' is set.
If you run an older versio of MPlayer (0.9x), set 'Post MPlayer 0.90=false' in
.kde/share/config/kmplayer.rc under group [MPlayer]. It will change some of the
mencoder arguments (for recording).
Enjoy!

@ -0,0 +1,8 @@
- open URL popup
- configure kmplayer end of settings menu
- 200/400% zoom
- shorter names in recent menu
- remove play/pause/stop from toolbar, add various sources
- removing playlist items, reorder, easy adding (other than playlist edit mode)
- more accessable loop option for item or playlist, eg. RMB
- also callback RMB events for xine/gst/xv

File diff suppressed because it is too large Load Diff

1050
aclocal.m4 vendored

File diff suppressed because it is too large Load Diff

@ -0,0 +1,48 @@
--- configure.in.in 2007-10-06 12:25:00.851848655 +0200
+++ configure.in.in 2007-09-29 00:20:22.000000000 +0200
@@ -132,16 +137,16 @@
AM_CONDITIONAL(include_kgstplayer, [test "x$have_gst" = "xyes" && test "x$have_gst_plugins" = "xyes"])
-buildnpp=yes
+hasnspr=yes
LIBNSPR_LIBS=""
LIBNSPR_CFLAGS=""
LIBQTDBUS=""
LIBDBUS_CFLAGS=""
AC_ARG_ENABLE(nspr, [ --enable-npplayer Enables building with npp support],
[if test "x$enableval" == "xno"; then
- buildnpp=no
+ hasnspr=no
fi])
-if test "$buildnpp" = "yes"; then
+if test "$hasnspr" = "yes"; then
if test "$PKGCONFIGFOUND" = "yes" ; then
DBUS_REQ=1.0.0
PKG_CHECK_MODULES(DBUS, dbus-1 >= $DBUS_REQ,
@@ -150,9 +155,22 @@
AC_DEFINE(HAVE_DBUS, 1, [have DBus])
LIBQTDBUS="`$PKG_CONFIG --libs dbus-1` -ldbus-qt-1"
LIBDBUS_CFLAGS="`$PKG_CONFIG --cflags dbus-1`"
- AC_DEFINE(HAVE_NSPR, 1, [build Netscape plugin loader])
- LIBNSPR_LIBS="`$PKG_CONFIG --libs gtk+-x11-2.0` `$PKG_CONFIG --libs dbus-glib-1`"
- LIBNSPR_CFLAGS="`$PKG_CONFIG --cflags gtk+-x11-2.0` `$PKG_CONFIG --cflags dbus-glib-1`"
+ PKG_CHECK_MODULES(NSPR, nspr >= 1.8.0,
+ have_nspr=yes,have_nspr=no)
+ if test "x$have_nspr" = "xno"; then
+ AC_CHECK_PROG(NSPRCONFIGFOUND, nspr-config,[yes])
+ if test $NSPRCONFIGFOUND; then
+ have_nspr=yes
+ NSPR_CFG=nspr-config
+ fi
+ else
+ NSPR_CFG=pkg-config nspr
+ fi
+ if test "x$have_nspr" = "xyes"; then
+ AC_DEFINE(HAVE_NSPR, 1, [have Netscape Portable Runtime])
+ LIBNSPR_LIBS="`$PKG_CONFIG --libs gtk+-x11-2.0` `$PKG_CONFIG --libs dbus-glib-1` `$NSPR_CFG --libs`"
+ LIBNSPR_CFLAGS="`$PKG_CONFIG --cflags gtk+-x11-2.0` `$PKG_CONFIG --cflags dbus-glib-1` `$NSPR_CFG --cflags`"
+ fi
fi
fi
fi

@ -0,0 +1,261 @@
/* config.h.in. Generated from configure.in by autoheader. */
/* Defines if your system has the cairo library */
#undef HAVE_CAIRO
/* Define to 1 if you have the <Carbon/Carbon.h> header file. */
#undef HAVE_CARBON_CARBON_H
/* Define if you have the CoreAudio API */
#undef HAVE_COREAUDIO
/* Define to 1 if you have the <crt_externs.h> header file. */
#undef HAVE_CRT_EXTERNS_H
/* Defines if your system has the crypt function */
#undef HAVE_CRYPT
/* have DBus */
#undef HAVE_DBUS
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* If libexpat is installed */
#undef HAVE_EXPAT
/* have GStreamer */
#undef HAVE_GSTREAMER
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* If we have koffice installed */
#undef HAVE_KOFFICE
/* Define if you have libjpeg */
#undef HAVE_LIBJPEG
/* Define if you have libpng */
#undef HAVE_LIBPNG
/* Define if you have a working libpthread (will enable threaded code) */
#undef HAVE_LIBPTHREAD
/* Define if you have libz */
#undef HAVE_LIBZ
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define if your system needs _NSGetEnviron to set up the environment */
#undef HAVE_NSGETENVIRON
/* build Netscape plugin loader */
#undef HAVE_NSPR
/* Define if you have res_init */
#undef HAVE_RES_INIT
/* Define if you have the res_init prototype */
#undef HAVE_RES_INIT_PROTO
/* Define if you have a STL implementation by SGI */
#undef HAVE_SGI_STL
/* Define to 1 if you have the `snprintf' function. */
#undef HAVE_SNPRINTF
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define if you have strlcat */
#undef HAVE_STRLCAT
/* Define if you have the strlcat prototype */
#undef HAVE_STRLCAT_PROTO
/* Define if you have strlcpy */
#undef HAVE_STRLCPY
/* Define if you have the strlcpy prototype */
#undef HAVE_STRLCPY_PROTO
/* Define to 1 if you have the <sys/bitypes.h> header file. */
#undef HAVE_SYS_BITYPES_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the `vsnprintf' function. */
#undef HAVE_VSNPRINTF
/* If we have libxine installed */
#undef HAVE_XINE
/* Suffix for lib directories */
#undef KDELIBSUFF
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* The size of `char *', as computed by sizeof. */
#undef SIZEOF_CHAR_P
/* The size of `int', as computed by sizeof. */
#undef SIZEOF_INT
/* The size of `long', as computed by sizeof. */
#undef SIZEOF_LONG
/* The size of `short', as computed by sizeof. */
#undef SIZEOF_SHORT
/* The size of `size_t', as computed by sizeof. */
#undef SIZEOF_SIZE_T
/* The size of `unsigned long', as computed by sizeof. */
#undef SIZEOF_UNSIGNED_LONG
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION
/* Defined if compiling without arts */
#undef WITHOUT_ARTS
/*
* jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system
* headers and I'm too lazy to write a configure test as long as only
* unixware is related
*/
#ifdef _UNIXWARE
#define HAVE_BOOLEAN
#endif
/*
* AIX defines FD_SET in terms of bzero, but fails to include <strings.h>
* that defines bzero.
*/
#if defined(_AIX)
#include <strings.h>
#endif
#if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H)
# include <sys/time.h>
# include <crt_externs.h>
# define environ (*_NSGetEnviron())
#endif
#if !defined(HAVE_RES_INIT_PROTO)
#ifdef __cplusplus
extern "C" {
#endif
int res_init(void);
#ifdef __cplusplus
}
#endif
#endif
#if !defined(HAVE_STRLCAT_PROTO)
#ifdef __cplusplus
extern "C" {
#endif
unsigned long strlcat(char*, const char*, unsigned long);
#ifdef __cplusplus
}
#endif
#endif
#if !defined(HAVE_STRLCPY_PROTO)
#ifdef __cplusplus
extern "C" {
#endif
unsigned long strlcpy(char*, const char*, unsigned long);
#ifdef __cplusplus
}
#endif
#endif
/*
* On HP-UX, the declaration of vsnprintf() is needed every time !
*/
#if !defined(HAVE_VSNPRINTF) || defined(hpux)
#if __STDC__
#include <stdarg.h>
#include <stdlib.h>
#else
#include <varargs.h>
#endif
#ifdef __cplusplus
extern "C"
#endif
int vsnprintf(char *str, size_t n, char const *fmt, va_list ap);
#ifdef __cplusplus
extern "C"
#endif
int snprintf(char *str, size_t n, char const *fmt, ...);
#endif
/* define to 1 if -fvisibility is supported */
#undef __KDE_HAVE_GCC_VISIBILITY
#if defined(__SVR4) && !defined(__svr4__)
#define __svr4__ 1
#endif
/* type to use in place of socklen_t if not defined */
#undef kde_socklen_t
/* type to use in place of socklen_t if not defined (deprecated, use
kde_socklen_t) */
#undef ksize_t

@ -0,0 +1,2 @@
./admin/configure.in.min
configure.in.in

@ -0,0 +1,396 @@
dnl =======================================================
dnl FILE: ./admin/configure.in.min
dnl =======================================================
dnl This file is part of the KDE libraries/packages
dnl Copyright (C) 2001 Stephan Kulow (coolo@kde.org)
dnl This file is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Library General Public
dnl License as published by the Free Software Foundation; either
dnl version 2 of the License, or (at your option) any later version.
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Library General Public License for more details.
dnl You should have received a copy of the GNU Library General Public License
dnl along with this library; see the file COPYING.LIB. If not, write to
dnl the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
dnl Boston, MA 02110-1301, USA.
# Original Author was Kalle@kde.org
# I lifted it in some mater. (Stephan Kulow)
# I used much code from Janos Farkas
dnl Process this file with autoconf to produce a configure script.
AC_INIT(acinclude.m4) dnl a source file from your sub dir
dnl This is so we can use kde-common
AC_CONFIG_AUX_DIR(admin)
dnl This ksh/zsh feature conflicts with `cd blah ; pwd`
unset CDPATH
dnl Checking host/target/build systems, for make, install etc.
AC_CANONICAL_SYSTEM
dnl Perform program name transformation
AC_ARG_PROGRAM
dnl Automake doc recommends to do this only here. (Janos)
AM_INIT_AUTOMAKE(kmplayer, 0.10.0c) dnl searches for some needed programs
KDE_SET_PREFIX
dnl generate the config header
AM_CONFIG_HEADER(config.h) dnl at the distribution this done
dnl Checks for programs.
AC_CHECK_COMPILERS
AC_ENABLE_SHARED(yes)
AC_ENABLE_STATIC(no)
KDE_PROG_LIBTOOL
dnl for NLS support. Call them in this order!
dnl WITH_NLS is for the po files
AM_KDE_WITH_NLS
KDE_USE_QT(3)
AC_PATH_KDE
dnl =======================================================
dnl FILE: configure.in.in
dnl =======================================================
#MIN_CONFIG(3)
dnl PACKAGE set before
KDE_ENABLE_HIDDEN_VISIBILITY
AM_MAINTAINER_MODE
AC_ARG_VAR(PKGCONFIGFOUND, [Path to pkg-config])
AC_ARG_VAR(NSPRCONFIGFOUND, [Path to nspr-config])
AC_CHECK_PROG(PKGCONFIGFOUND, pkg-config,[yes])
AC_MSG_CHECKING(if koffice-plugin support is wanted)
AC_ARG_ENABLE(koffice-plugin,
[ --enable-koffice-plugin enable koffice plugin],
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
want_koffice_plugin="yes"
else
AC_MSG_RESULT(no)
fi], [AC_MSG_RESULT(no); want_koffice_plugin="no"])
KDE_CHECK_HEADER(koDocument.h,
have_koffice=yes,
have_koffice=no)
AC_MSG_CHECKING([if kmplayer can be compiled with koffice support])
AC_MSG_RESULT($have_koffice)
AM_CONDITIONAL(include_koffice_support, test "$want_koffice_plugin" = "yes" -a "$have_koffice" = "yes")
if test "$want_koffice_plugin" = "yes" -a "$have_koffice" = "yes"; then
AC_DEFINE(HAVE_KOFFICE, 1, [If we have koffice installed])
LIB_KOFFICE="-lkofficecore -lkofficeui"
AC_SUBST(LIB_KOFFICE)
fi
AC_MSG_CHECKING(if expat XML parsing is wanted)
AC_ARG_ENABLE(expat,
[ --enable-expat use expat libs],
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
want_expat="yes"
else
AC_MSG_RESULT(no)
fi], [AC_MSG_RESULT(no); want_expat="no"])
KDE_CHECK_HEADER(expat.h,
have_expat=yes,
have_expat=no)
AC_MSG_CHECKING([if kmplayer can use expat its XML parser])
AC_MSG_RESULT($have_expat)
AM_CONDITIONAL(include_expat_support, test "$want_expat" = "yes" -a "$have_expat" = "yes")
if test x$have_expat = xyes -a x$want_expat = xyes; then
AC_DEFINE(HAVE_EXPAT, 1, [If libexpat is installed])
LIB_EXPAT="-lexpat"
AC_SUBST(LIB_EXPAT)
fi
KDE_CHECK_HEADER(xine.h,
have_xine=yes,
have_xine=no)
AC_MSG_CHECKING([if kxineplayer can be compiled])
AC_MSG_RESULT($have_xine)
AC_ARG_WITH(xine,
AC_HELP_STRING([--without-xine],[build KMPlayer without Xine [default=with]]),
[build_xine=$withval],
[build_xine=yes]
)
if test "$build_xine" != "no"; then
if test "$have_xine" = "yes"; then
vers=`xine-config --version 2>/dev/null | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
if test -n "$vers" && test "$vers" -ge 1000000
then
AC_DEFINE(HAVE_XINE, 1, [If we have libxine installed])
LIB_XINE="`xine-config --libs`"
AC_SUBST(LIB_XINE)
CFLAGS_XINE="`xine-config --cflags`"
AC_SUBST(CFLAGS_XINE)
else
have_xine="no"
AC_MSG_WARN([Your xine installation is too old (1.0.0 or later required)])
fi
fi
else
have_xine="no"
fi
AM_CONDITIONAL(include_kxineplayer, test "$have_xine" = "yes")
AC_ARG_WITH(gstreamer,
AC_HELP_STRING([--without-gstreamer],[build KMPlayer without GStreamer [default=with]]),
[build_gstreamer=$withval],
[build_gstreamer=yes]
)
if test "$build_gstreamer" != "no"; then
if test "$PKGCONFIGFOUND" = "yes" ; then
# check for GStreamer
dnl Now we're ready to ask for gstreamer libs and cflags
dnl And we can also ask for the right version of gstreamer
GST_MAJORMINOR=0.10
GST_REQ=0.10.0
PKG_CHECK_MODULES(GST, gstreamer-$GST_MAJORMINOR >= $GST_REQ,
have_gst=yes,have_gst=no)
PKG_CHECK_MODULES(GST_PLUGINS, gstreamer-plugins-base-$GST_MAJORMINOR >= $GST_REQ, \
have_gst_plugins=yes,have_gst_plugins=no)
LIB_GST=""
CFLAGS_GST=""
LIB_GST_PLUGINS=""
dnl Give error if we don't have gstreamer
if test "x$have_gst" = "xyes"; then
AC_SUBST(GST_MAJORMINOR)
AC_DEFINE(HAVE_GSTREAMER, 1, [have GStreamer])
LIB_GST=$GST_LIBS
CFLAGS_GST=$GST_CFLAGS
LIB_GST_PLUGINS=$GST_INTERFACES_LIBS
fi
AC_SUBST(LIB_GST)
AC_SUBST(CFLAGS_GST)
AC_SUBST(LIB_GST_PLUGINS)
fi
fi
AC_MSG_CHECKING([if kgstplayer can be compiled])
if test "x$have_gst" = "xyes" && test "x$have_gst_plugins" = "xyes"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(include_kgstplayer, [test "x$have_gst" = "xyes" && test "x$have_gst_plugins" = "xyes"])
buildnpp=yes
LIBNSPR_LIBS=""
LIBNSPR_CFLAGS=""
LIBQTDBUS=""
LIBDBUS_CFLAGS=""
AC_ARG_ENABLE(nspr, [ --enable-npplayer Enables building with npp support],
[if test "x$enableval" == "xno"; then
buildnpp=no
fi])
if test "$buildnpp" = "yes"; then
if test "$PKGCONFIGFOUND" = "yes" ; then
DBUS_REQ=1.0.0
PKG_CHECK_MODULES(DBUS, dbus-1 >= $DBUS_REQ,
have_dbus=yes,have_dbus=no)
if test "x$have_dbus" = "xyes"; then
have_nspr=yes
AC_DEFINE(HAVE_DBUS, 1, [have DBus])
LIBQTDBUS="`$PKG_CONFIG --libs dbus-1` -ldbus-qt-1"
LIBDBUS_CFLAGS="`$PKG_CONFIG --cflags dbus-1`"
AC_DEFINE(HAVE_NSPR, 1, [build Netscape plugin loader])
LIBNSPR_LIBS="`$PKG_CONFIG --libs gtk+-x11-2.0` `$PKG_CONFIG --libs dbus-glib-1` `$PKG_CONFIG --libs gthread-2.0`"
LIBNSPR_CFLAGS="`$PKG_CONFIG --cflags gtk+-x11-2.0` `$PKG_CONFIG --cflags dbus-glib-1`"
fi
fi
fi
AC_SUBST(LIBNSPR_LIBS)
AC_SUBST(LIBNSPR_CFLAGS)
AC_SUBST(LIBQTDBUS)
AC_SUBST(LIBDBUS_CFLAGS)
AM_CONDITIONAL(include_knpplayer, test "$have_nspr" = "yes")
hascairo=yes
LIBCAIRO_LIBS=""
LIBCAIRO_CFLAGS=""
AC_ARG_ENABLE(cairo, [ --enable-cairo Enables building with cairo support],
[if test "x$enableval" == "xno"; then
hascairo=no
fi])
if test $hascairo = yes; then
AC_MSG_CHECKING([Checking for cairo with pkg-config])
hascairo=no
if test -n "$PKG_CONFIG"; then
LIBCAIRO_LIBS="`$PKG_CONFIG cairo --libs`"
LIBCAIRO_CFLAGS="`$PKG_CONFIG cairo --cflags`"
if test -n "$LIBCAIRO_LIBS" || test -n "$LIBCAIRO_CFLAGS"; then
AC_MSG_RESULT([found])
hascairo=yes
else
AC_MSG_RESULT([not found])
fi
else
AC_MSG_RESULT([failed: pkg-config not found])
fi
if test $hascairo = yes; then
AC_DEFINE_UNQUOTED(HAVE_CAIRO, 1, [Defines if your system has the cairo library])
else
AC_MSG_WARN([Couldn't find a usable cairo])
fi
fi
AC_SUBST(LIBCAIRO_LIBS)
AC_SUBST(LIBCAIRO_CFLAGS)
KDE_CHECK_BINUTILS
AC_MSG_CHECKING([for KDE version])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
kdeversion_save_CXXFLAGS="$CXXFLAGS"
kdeversion_safe_LIBS="$LIBS"
LIBS="$LIBS $X_EXTRA_LIBS"
CXXFLAGS="$CXXFLAGS $all_includes"
AC_COMPILE_IFELSE([
#include <kdeversion.h>
#if ! ( KDE_IS_VERSION( 3, 3, 91 ) )
#error KDE 3.3
#endif
],
need_kde33_compat="no"
,
need_kde33_compat="yes"
)
AC_COMPILE_IFELSE([
#include <kdeversion.h>
#if ! ( KDE_IS_VERSION( 3, 2, 90 ) )
#error KDE 3.2
#endif
],
need_kde32_compat="no"
,
need_kde32_compat="yes"
)
AC_COMPILE_IFELSE([
#include <kdeversion.h>
#if ! ( KDE_IS_VERSION( 3, 1, 90 ) )
#error KDE 3.1
#endif
],
need_kde31_compat="no"
,
need_kde31_compat="yes"
)
CXXFLAGS="$kdeversion_save_CXXFLAGS"
LIBS="$kdeversion_safe_LIBS"
AC_LANG_RESTORE
if test "$need_kde32_compat" = "yes"; then
AC_MSG_RESULT([KDE 3.2.x])
fi
if test "$need_kde31_compat" = "yes"; then
AC_MSG_RESULT([KDE 3.1.x])
fi
AM_CONDITIONAL(need_kde33_compatibility, test "$need_kde33_compat" = "yes")
AM_CONDITIONAL(need_kde32_compatibility, test "$need_kde32_compat" = "yes")
AM_CONDITIONAL(need_kde31_compatibility, test "$need_kde31_compat" = "yes")
KDE_CREATE_SUBDIRSLIST
AC_CONFIG_FILES([ Makefile ])
AC_CONFIG_FILES([ doc/Makefile ])
AC_CONFIG_FILES([ doc/da/Makefile ])
AC_CONFIG_FILES([ doc/de/Makefile ])
AC_CONFIG_FILES([ doc/en/Makefile ])
AC_CONFIG_FILES([ doc/es/Makefile ])
AC_CONFIG_FILES([ doc/et/Makefile ])
AC_CONFIG_FILES([ doc/fr/Makefile ])
AC_CONFIG_FILES([ doc/it/Makefile ])
AC_CONFIG_FILES([ doc/nl/Makefile ])
AC_CONFIG_FILES([ doc/pt/Makefile ])
AC_CONFIG_FILES([ doc/ru/Makefile ])
AC_CONFIG_FILES([ doc/sv/Makefile ])
AC_CONFIG_FILES([ icons/Makefile ])
AC_CONFIG_FILES([ mimetypes/Makefile ])
AC_CONFIG_FILES([ mimetypes/application/Makefile ])
AC_CONFIG_FILES([ mimetypes/audio/Makefile ])
AC_CONFIG_FILES([ mimetypes/video/Makefile ])
AC_CONFIG_FILES([ mimetypes/video/kde31/Makefile ])
AC_CONFIG_FILES([ po/Makefile ])
AC_CONFIG_FILES([ protocols/Makefile ])
AC_CONFIG_FILES([ src/Makefile ])
AC_OUTPUT
# Check if KDE_SET_PREFIX was called, and --prefix was passed to configure
if test -n "$kde_libs_prefix" -a -n "$given_prefix"; then
# And if so, warn when they don't match
if test "$kde_libs_prefix" != "$given_prefix"; then
# And if kde doesn't know about the prefix yet
echo ":"`kde-config --path exe`":" | grep ":$given_prefix/bin/:" 2>&1 >/dev/null
if test $? -ne 0; then
echo ""
echo "Warning: you chose to install this package in $given_prefix,"
echo "but KDE was found in $kde_libs_prefix."
echo "For this to work, you will need to tell KDE about the new prefix, by ensuring"
echo "that KDEDIRS contains it, e.g. export KDEDIRS=$given_prefix:$kde_libs_prefix"
echo "Then restart KDE."
echo ""
fi
fi
fi
if test x$GXX = "xyes" -a x$kde_have_gcc_visibility = "xyes" -a x$kde_cv_val_qt_gcc_visibility_patched = "xno"; then
echo ""
echo "Your GCC supports symbol visibility, but the patch for Qt supporting visibility"
echo "was not included. Therefore, GCC symbol visibility support remains disabled."
echo ""
echo "For better performance, consider including the Qt visibility supporting patch"
echo "located at:"
echo ""
echo "http://bugs.kde.org/show_bug.cgi?id=109386"
echo ""
echo "and recompile all of Qt and KDE. Note, this is entirely optional and"
echo "everything will continue to work just fine without it."
echo ""
fi
if test "$all_tests" = "bad"; then
if test ! "$cache_file" = "/dev/null"; then
echo ""
echo "Please remove the file $cache_file after changing your setup"
echo "so that configure will find the changes next time."
echo ""
fi
else
echo ""
echo "Good - your configure finished. Start make now"
echo ""
fi

@ -0,0 +1,262 @@
#MIN_CONFIG(3)
AM_INIT_AUTOMAKE(kmplayer,0.10.0c)
KDE_ENABLE_HIDDEN_VISIBILITY
AM_MAINTAINER_MODE
AC_ARG_VAR(PKGCONFIGFOUND, [Path to pkg-config])
AC_ARG_VAR(NSPRCONFIGFOUND, [Path to nspr-config])
AC_CHECK_PROG(PKGCONFIGFOUND, pkg-config,[yes])
AC_MSG_CHECKING(if koffice-plugin support is wanted)
AC_ARG_ENABLE(koffice-plugin,
[ --enable-koffice-plugin enable koffice plugin],
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
want_koffice_plugin="yes"
else
AC_MSG_RESULT(no)
fi], [AC_MSG_RESULT(no); want_koffice_plugin="no"])
KDE_CHECK_HEADER(koDocument.h,
have_koffice=yes,
have_koffice=no)
AC_MSG_CHECKING([if kmplayer can be compiled with koffice support])
AC_MSG_RESULT($have_koffice)
AM_CONDITIONAL(include_koffice_support, test "$want_koffice_plugin" = "yes" -a "$have_koffice" = "yes")
if test "$want_koffice_plugin" = "yes" -a "$have_koffice" = "yes"; then
AC_DEFINE(HAVE_KOFFICE, 1, [If we have koffice installed])
LIB_KOFFICE="-lkofficecore -lkofficeui"
AC_SUBST(LIB_KOFFICE)
fi
AC_MSG_CHECKING(if expat XML parsing is wanted)
AC_ARG_ENABLE(expat,
[ --enable-expat use expat libs],
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
want_expat="yes"
else
AC_MSG_RESULT(no)
fi], [AC_MSG_RESULT(no); want_expat="no"])
KDE_CHECK_HEADER(expat.h,
have_expat=yes,
have_expat=no)
AC_MSG_CHECKING([if kmplayer can use expat its XML parser])
AC_MSG_RESULT($have_expat)
AM_CONDITIONAL(include_expat_support, test "$want_expat" = "yes" -a "$have_expat" = "yes")
if test x$have_expat = xyes -a x$want_expat = xyes; then
AC_DEFINE(HAVE_EXPAT, 1, [If libexpat is installed])
LIB_EXPAT="-lexpat"
AC_SUBST(LIB_EXPAT)
fi
KDE_CHECK_HEADER(xine.h,
have_xine=yes,
have_xine=no)
AC_MSG_CHECKING([if kxineplayer can be compiled])
AC_MSG_RESULT($have_xine)
AC_ARG_WITH(xine,
AC_HELP_STRING([--without-xine],[build KMPlayer without Xine [default=with]]),
[build_xine=$withval],
[build_xine=yes]
)
if test "$build_xine" != "no"; then
if test "$have_xine" = "yes"; then
vers=`xine-config --version 2>/dev/null | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
if test -n "$vers" && test "$vers" -ge 1000000
then
AC_DEFINE(HAVE_XINE, 1, [If we have libxine installed])
LIB_XINE="`xine-config --libs`"
AC_SUBST(LIB_XINE)
CFLAGS_XINE="`xine-config --cflags`"
AC_SUBST(CFLAGS_XINE)
else
have_xine="no"
AC_MSG_WARN([Your xine installation is too old (1.0.0 or later required)])
fi
fi
else
have_xine="no"
fi
AM_CONDITIONAL(include_kxineplayer, test "$have_xine" = "yes")
AC_ARG_WITH(gstreamer,
AC_HELP_STRING([--without-gstreamer],[build KMPlayer without GStreamer [default=with]]),
[build_gstreamer=$withval],
[build_gstreamer=yes]
)
if test "$build_gstreamer" != "no"; then
if test "$PKGCONFIGFOUND" = "yes" ; then
# check for GStreamer
dnl Now we're ready to ask for gstreamer libs and cflags
dnl And we can also ask for the right version of gstreamer
GST_MAJORMINOR=0.10
GST_REQ=0.10.0
PKG_CHECK_MODULES(GST, gstreamer-$GST_MAJORMINOR >= $GST_REQ,
have_gst=yes,have_gst=no)
PKG_CHECK_MODULES(GST_PLUGINS, gstreamer-plugins-base-$GST_MAJORMINOR >= $GST_REQ, \
have_gst_plugins=yes,have_gst_plugins=no)
LIB_GST=""
CFLAGS_GST=""
LIB_GST_PLUGINS=""
dnl Give error if we don't have gstreamer
if test "x$have_gst" = "xyes"; then
AC_SUBST(GST_MAJORMINOR)
AC_DEFINE(HAVE_GSTREAMER, 1, [have GStreamer])
LIB_GST=$GST_LIBS
CFLAGS_GST=$GST_CFLAGS
LIB_GST_PLUGINS=$GST_INTERFACES_LIBS
fi
AC_SUBST(LIB_GST)
AC_SUBST(CFLAGS_GST)
AC_SUBST(LIB_GST_PLUGINS)
fi
fi
AC_MSG_CHECKING([if kgstplayer can be compiled])
if test "x$have_gst" = "xyes" && test "x$have_gst_plugins" = "xyes"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(include_kgstplayer, [test "x$have_gst" = "xyes" && test "x$have_gst_plugins" = "xyes"])
buildnpp=yes
LIBNSPR_LIBS=""
LIBNSPR_CFLAGS=""
LIBQTDBUS=""
LIBDBUS_CFLAGS=""
AC_ARG_ENABLE(nspr, [ --enable-npplayer Enables building with npp support],
[if test "x$enableval" == "xno"; then
buildnpp=no
fi])
if test "$buildnpp" = "yes"; then
if test "$PKGCONFIGFOUND" = "yes" ; then
DBUS_REQ=1.0.0
PKG_CHECK_MODULES(DBUS, dbus-1 >= $DBUS_REQ,
have_dbus=yes,have_dbus=no)
if test "x$have_dbus" = "xyes"; then
have_nspr=yes
AC_DEFINE(HAVE_DBUS, 1, [have DBus])
LIBQTDBUS="`$PKG_CONFIG --libs dbus-1` -ldbus-qt-1"
LIBDBUS_CFLAGS="`$PKG_CONFIG --cflags dbus-1`"
AC_DEFINE(HAVE_NSPR, 1, [build Netscape plugin loader])
LIBNSPR_LIBS="`$PKG_CONFIG --libs gtk+-x11-2.0` `$PKG_CONFIG --libs dbus-glib-1` `$PKG_CONFIG --libs gthread-2.0`"
LIBNSPR_CFLAGS="`$PKG_CONFIG --cflags gtk+-x11-2.0` `$PKG_CONFIG --cflags dbus-glib-1`"
fi
fi
fi
AC_SUBST(LIBNSPR_LIBS)
AC_SUBST(LIBNSPR_CFLAGS)
AC_SUBST(LIBQTDBUS)
AC_SUBST(LIBDBUS_CFLAGS)
AM_CONDITIONAL(include_knpplayer, test "$have_nspr" = "yes")
hascairo=yes
LIBCAIRO_LIBS=""
LIBCAIRO_CFLAGS=""
AC_ARG_ENABLE(cairo, [ --enable-cairo Enables building with cairo support],
[if test "x$enableval" == "xno"; then
hascairo=no
fi])
if test $hascairo = yes; then
AC_MSG_CHECKING([Checking for cairo with pkg-config])
hascairo=no
if test -n "$PKG_CONFIG"; then
LIBCAIRO_LIBS="`$PKG_CONFIG cairo --libs`"
LIBCAIRO_CFLAGS="`$PKG_CONFIG cairo --cflags`"
if test -n "$LIBCAIRO_LIBS" || test -n "$LIBCAIRO_CFLAGS"; then
AC_MSG_RESULT([found])
hascairo=yes
else
AC_MSG_RESULT([not found])
fi
else
AC_MSG_RESULT([failed: pkg-config not found])
fi
if test $hascairo = yes; then
AC_DEFINE_UNQUOTED(HAVE_CAIRO, 1, [Defines if your system has the cairo library])
else
AC_MSG_WARN([Couldn't find a usable cairo])
fi
fi
AC_SUBST(LIBCAIRO_LIBS)
AC_SUBST(LIBCAIRO_CFLAGS)
KDE_CHECK_BINUTILS
AC_MSG_CHECKING([for KDE version])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
kdeversion_save_CXXFLAGS="$CXXFLAGS"
kdeversion_safe_LIBS="$LIBS"
LIBS="$LIBS $X_EXTRA_LIBS"
CXXFLAGS="$CXXFLAGS $all_includes"
AC_COMPILE_IFELSE([
#include <kdeversion.h>
#if ! ( KDE_IS_VERSION( 3, 3, 91 ) )
#error KDE 3.3
#endif
],
need_kde33_compat="no"
,
need_kde33_compat="yes"
)
AC_COMPILE_IFELSE([
#include <kdeversion.h>
#if ! ( KDE_IS_VERSION( 3, 2, 90 ) )
#error KDE 3.2
#endif
],
need_kde32_compat="no"
,
need_kde32_compat="yes"
)
AC_COMPILE_IFELSE([
#include <kdeversion.h>
#if ! ( KDE_IS_VERSION( 3, 1, 90 ) )
#error KDE 3.1
#endif
],
need_kde31_compat="no"
,
need_kde31_compat="yes"
)
CXXFLAGS="$kdeversion_save_CXXFLAGS"
LIBS="$kdeversion_safe_LIBS"
AC_LANG_RESTORE
if test "$need_kde32_compat" = "yes"; then
AC_MSG_RESULT([KDE 3.2.x])
fi
if test "$need_kde31_compat" = "yes"; then
AC_MSG_RESULT([KDE 3.1.x])
fi
AM_CONDITIONAL(need_kde33_compatibility, test "$need_kde33_compat" = "yes")
AM_CONDITIONAL(need_kde32_compatibility, test "$need_kde32_compat" = "yes")
AM_CONDITIONAL(need_kde31_compatibility, test "$need_kde31_compat" = "yes")

@ -0,0 +1 @@
SUBDIRS = da de en es et fr it nl pt ru sv

@ -0,0 +1,5 @@
EXTRA_DIST = index.docbook
KDE_LANG = da
KDE_DOCS = kmplayer

@ -0,0 +1,571 @@
<?xml version="1.0" ?>
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
<!ENTITY kmplayer '<application
>Kmplayer</application
>'>
<!ENTITY kappname "&kmplayer;"
><!-- replace kmplayer here -->
<!ENTITY package "kdeextragear-2">
<!ENTITY % addindex "IGNORE">
<!ENTITY % Danish "INCLUDE"
><!-- change language only here -->
]>
<book lang="&language;">
<bookinfo>
<title
>&kmplayer;-håndbogen</title>
<authorgroup>
<author
><firstname
>Koos</firstname
> <surname
>Vriezen</surname
> <affiliation
> <address
><email
>koos dot vriezen at gmail dot com</email
></address>
</affiliation>
</author>
</authorgroup>
&erik.kjaer.pedersen.role;
<copyright>
<year
>2002</year>
<year
>2006</year>
<holder
>Koos Vriezen</holder>
</copyright>
<!-- Translators: put here the copyright notice of the translation -->
<!-- Put here the FDL notice. Read the explanation in fdl-notice.docbook
and in the FDL itself on how to use it. -->
<legalnotice
>&FDLNotice;</legalnotice>
<date
>2003-12-24</date>
<releaseinfo
>0.05.00</releaseinfo>
<!-- Abstract about this handbook -->
<abstract>
<para
>&kmplayer; er et program som er en &kde;-grænseflade for <application
>Mplayer</application
>, <application
>Xine</application
> og <application
>GStreamer</application
>. </para>
</abstract>
<keywordset>
<keyword
>KDE</keyword>
<keyword
>kdemultimedia</keyword>
<keyword
>MPlayer</keyword>
<keyword
>konqueror</keyword>
<keyword
>video</keyword>
</keywordset>
</bookinfo>
<chapter id="introduction">
<title
>Indledning</title>
<para
>&kmplayer; er en simpel grænseflade for <application
>Mplayer</application
>, <application
>Xine</application
>, <application
>Gstreamer</application
> og <application
>FFMpeg</application
>. Du kan bruge det til at kigge på alle filmfilformat som <application
>Mplayer</application
>, <application
>Xine</application
> eller <application
>Gstreamer</application
> understøtter, samt kigge på en <acronym
>dvd</acronym
>, <acronym
>vcd</acronym
> eller <acronym
>tv</acronym
> og kamera. </para>
<para
>Dokumentationen for &kappname; var ikke færdig da &kde; blev installeret på denne computer.</para
> <para
>Hvis du behøver mere hjælp, kig på <ulink url="http://www.kde.org"
>KDE's hjemmeside</ulink
> for opdateringer, eller send dit spørgsmål til <ulink url="mailto:kde-user@kde.org"
>&kde;'s e-mail-liste for brugere</ulink
>. </para>
<para
><emphasis
>&kde;-gruppen</emphasis
></para>
</chapter>
<chapter id="gui">
<title
>Brugergrænsefladen</title>
<para
>Programvinduet består af såkaldte dokningsbare vinduer. Det centrale visningsvindue findes altid. Desuden er der et valgfrit spillelistevindue. Endelig er der et informationsvindue, som kun vises når der er en information at vise. </para>
<section id="playlistwindow">
<title
>Spillelistevinduet</title>
<para
>Spillelistevinduet har fem kategorier når dette skrives, nuværende punkt, <guilabel
>Optiske diske</guilabel
>, <guilabel
>Television</guilabel
>, <guilabel
>Bevarede spillelister</guilabel
> og <guilabel
>Nyligste</guilabel
>. Ved et klik på en kategoris tekst vises dens indhold under linjen. Der skal naturligvis være noget indhold, se for eksempel <link linkend="tvsource"
><acronym
>TV</acronym
>-indstillinger</link
> om hvordan man tilføjer indhold for kategorien <guilabel
>Television</guilabel
>. Kategorien <guilabel
>Nyligste</guilabel
> udfyldes i når lokale mediafiler eller netværks-url'er afspilles. Denne kategori kan indeholde 60 punkter, hvoraf de sidste 50 er under grenen <guilabel
>Mere...</guilabel
>. </para>
<section>
<title
>Kategorien Bevarede spillelister</title>
<para
>Det er muligt at opbevare dine favoritlink i menuen <guilabel
>Bogmærker</guilabel
>, men de er enkelte punkter. Hvis du vil oprette en liste med punkter som spilles i rækkefølge, skal du bruge kategorien <guilabel
>Bevarede spillelister</guilabel
>. </para>
<para
>Den nemmeste måde at tilføje et punkt til listen er at trække det fra <guilabel
>Nyligste</guilabel
> og slippe det på <guilabel
>Bevarede spillelister</guilabel
>. Som du vil se, vises en menu når du slipper det, hvor du kan vælge at tilføje det til denne liste eller oprette en ny gruppe. Punkter på øverste niveau opfører sig som bogmærkepunkter, men punkter i grupper afspiller hele gruppen som de indgår i. Punkter i denne kategori kan nemt flyttes, kopieres, tilføjes til en ny gruppe eller fjernes, blot ved at trække punktet til et andet sted i kategorien. Desuden er der valgmulighederne <guimenu
>Slet punkt</guimenu
>, <guimenu
>Flyt opad</guimenu
> og <guimenu
>Flyt nedad</guimenu
> i den sammenhængsafhængige menu (ved klik med højre museknap på et punkt). </para>
<para
>Du kan naturligvis tilføje grupper til grupper for at få et dybere hierarki. Ved klik på et punkt, kopieres dets gruppe og alle undergrupper til den nuværende kategori, og afspilning begynder på det klikkede punkts position. </para>
<section>
<title
>Opbevaringsformat</title>
<para
>Data opbevares i <filename
>~/.kde/share/apps/kmplayer/playlist.xml</filename
>, og dets format er som i dette eksempel. Kig <link linkend="XML-editing"
>her</link
> om hvordan man håndterer denne data direkte. <programlisting>
&lt;playlist&gt;
&lt;group title="feeds"&gt;
&lt;item url="http://www.lugradio.org/episodes.rss"/&gt;
&lt;item url="http://science.nasa.gov/podcast.xml"/&gt;
&lt;item url="http://www.theworld.org/rss/tech.xml"/&gt;
&lt;/group&gt;
&lt;group title="iradio"&gt;
&lt;group title="sunny"&gt;
&lt;item mplayeropts="-cache 256" url="http://www.swissgroove.ch/listen.m3u"/&gt;
&lt;item url="http://www.boombasticradio.com/shoutcast/64.pls"/&gt;
&lt;/group&gt;
&lt;group title="rainy"&gt;
&lt;item url="http://www.radioparadise.com/musiclinks/rp_64.m3u"/&gt;
&lt;item url="http://www.woxy.com/stream/wma64.asx"/&gt;
&lt;item url="http://radionigel.com/winmedia.asx"/&gt;
&lt;item url="rtsp://livestreams.omroep.nl/live/vpro/vpro3voor12radioalt.rm"/&gt;
&lt;/group&gt;
&lt;/group&gt;
&lt;/playlist&gt;
</programlisting
> Bemærk også at egne tilvalg kan indstilles med flaget <computeroutput
>mplayeropts</computeroutput
> for <application
>Mplayer</application
>. &kmplayer; søger opad i træet efter dette flag, så du kan indstille det for en hel gruppe og sætte det ud af kraft for en undergruppe eller for et punkt. </para>
</section>
</section>
</section>
<section id="XML-editing">
<title
>Direkte XML-redigering</title>
<para
>Kategorierne Seneste, <guilabel
>Television</guilabel
> og <guilabel
>Bevarede spillelister</guilabel
> kan også håndteres ved at redigere deres <acronym
>XML</acronym
>-opbevaring. Man kan naturligvis gøre det når &kmplayer; ikke kører, og redigere de forskellige filer i <filename
>~/.kde/share/apps/kmplayer/</filename
>, men også i selve programmet. Klik blot på en kategorioverskrift, og vælg derefter <guimenu
>Vis</guimenu
> og siden <guimenu
>Redigeringstilstand</guimenu
>. Du kan også klikke på en undergren og så ser du kun <acronym
>XML</acronym
>-indholdet for grenen. </para>
<para
>Efter at du har redigeret noget <acronym
>XML</acronym
>, klikkes på <guilabel
>Synkronisér med spilleliste</guilabel
> og afmarkér enten tilvalget <guimenu
>Redigeringstilstand</guimenu
> eller klik på en anden kategori. <caution
><para
>Alle ændringer går tabt hvis du forlader redigeringstilstand eller vælger en anden gren uden at synkronisere med spillelisten. </para
></caution>
</para>
<para
>På grund af dovenskab blandt &kmplayer;s forfattere, kan visse funktioner kun aktiveres ved at redigere XML. </para>
</section>
</chapter>
<chapter id="settings">
<title
>Opsætning</title>
<section>
<title
>Animering ved start og afslutning</title>
<para
>Deaktivering af start- og slutanimeringen kan udføres ved at redigere <filename
>~/.kde/share/config/kmplayerrc</filename
> og ændre <programlisting>
[General Options]
No Intro=0
</programlisting
> ovenstående tilvalg til '1'. Tilføj blot dette tilvalg hvis der ikke allerede er der. </para>
<para
>Det er også muligt at angive alternative animeringer. Kmplayer kigger på <filename
>~/.kde/share/apps/kmplayer/intro.xml</filename
> og <filename
>~/.kde/share/apps/kmplayer/exit.xml</filename
>. Formatet skal være en <acronym
>XML</acronym
>-fil som understøttes. </para>
<para
>Den indledende animering behøver ikke være kort, eftersom den automatisk slutter når en anden kilde åbnes. Dette ville naturligvis være noget irriterende for slutanimeringen, men brugeren kan altid afslutte programmet to gange. </para>
<para
>Et simpelt eksempel på en indledning, som viser dit favoritfoto kunne være <programlisting>
&lt;smil&gt;
&lt;body&gt;
&lt;img dur="indefinite" src="file:///home/bruger/lillemor.gif" fit="meet"/&gt;
&lt;/body&gt;
&lt;/smil&gt;
</programlisting
> I Kmplayers kildekodepakke, under <filename
>tests/</filename
> er der nogle eksempler på <acronym
>SMIL</acronym
> som Kmplayer understøtter. </para>
</section>
</chapter>
<chapter id="backends">
<title
>Afspilningsgrænsefladen</title>
<para
>&kmplayer; bruger eksterne programmer til at udføre selve afspilningen. </para>
<section id="mplayer">
<title
>MPlayer</title>
<para
>Der er et indstillingsfaneblad for Mplayer i &kmplayer;s indstillingsdialog. Der kan man blandt andet indstille søgestien til Mplayer og dets cachestørrelse for netværksstrømme. </para>
<section id="mplayer-debug">
<title
>Fejlsøgning</title>
<para
>Den bedste måde at fejlsøge i grænsefladen er at starte &kmplayer; fra et terminalprogram såsom konsole. Start derefter en film med Kmplayer og se nøjagtigt den kommandolinje som bruges til at starte Mplayer i terminalprogrammet. Kopiér og indsæt den nu i et andet terminalprogram, fjerne flaget '-wid 12344' og spil den. Formodentlig er det blot om at vælge rigtige parametre for -ao og -vo. Sørg også for at Mplayer ikke er forudindstillet til at starte med en grafisk grænseflade. </para>
<para
>Et andet fejlsøgningsværktøj er knappen 'Terminal' i Kmplayers værktøjslinje. Der kan du se uddataen fra Mplayer. </para>
</section>
</section>
<section id="xine">
<title
>Xine</title>
<para
>Når &kmplayer; er konfigureret med understøttelse for Xine, er der indstillingsfaneblade for Xine i &kmplayer;s indstillingsdialog. Der kan du indstille diverse tilvalg. Disse tilvalg hentes dynamisk fra Xines bibliotek. Brug den sammenhængsafhængige hjælp til at få information om hvad valgmulighederne gør (dvs. klikke på spørgsmålstegnet i dialogens navnelist og klik derefter på et tilvalg). </para>
<para
>Tilvalgene gemmes i <filename
>.kde/share/apps/kmplayer/xine_config</filename
> som et tekstdokument. </para>
<section id="xine-debug">
<title
>Fejlsøgning</title>
<para
>Hovedsageligt på samme måde at fejlsøge som for <link linkend="mplayer-debug"
>Mplayer</link
>, men med progravnavnet <filename
>kxineplayer</filename
>. </para>
</section>
</section>
<section id="gstreamer">
<title
>GStreamer</title>
<para
>Der er intet indstillingsfaneblad for Gstreamer i &kmplayer;s indstillingsdialog. De sædvanlige valgmulighederne for f.eks. <acronym
>dvd</acronym
>-enheder bruges når det passer. </para>
<section id="gstremaer-debug">
<title
>Fejlsøgning</title>
<para
>Hovedsagelig på samme måde at fejlsøge som for <link linkend="mplayer-debug"
>Mplayer</link
>, men med programnavnet <filename
>kgstplayer</filename
>. </para>
</section>
</section>
</chapter>
<chapter id="sources">
<title
>Kilder som kan afspilles</title>
<para
>&kmplayer; kan afspille forskellige kilder. Disse kilder listes i menuen Kilde. </para>
<section id="tvsource">
<title
>TV</title>
<para
>&kmplayer; kan afspille fra et tv-kort med <application
>Mplayer</application
> eller <acronym
>Xvideo</acronym
> (ved brug af <application
>kxvplayer</application
>). Inden du kan kigge på tv skal du indstille hvilken enhed som skal bruges, og tv-kanalerne. Du kan bruge søgefunktionen i indstillingsdialogen til dette, eller redigere indstillingsfilen manuelt. </para>
<para
>Indstillingsfilen for tv-indstillingerne er en <acronym
>XML</acronym
>-fil, med navnet <filename
>~/.kde/share/apps/kmplayer/tv.xml</filename
>. Kig <link linkend="XML-editing"
>her</link
> om hvordan man håndterer denne data direkte. <acronym
>XML</acronym
>-formatet er som følgende eksempel: <programlisting>
&lt;tvdevices&gt;
&lt;device path="/dev/video0" width="320" height="240" name="BT878 video (Hauppauge (bt878))" audio=""
minwidth="48" minheight="32" maxwidth="924" maxheight="576" playback="0" xvport="240"&gt;
&lt;input name="Television" id="0" tuner="1" norm="PAL" xvenc="0"&gt;
&lt;channel name="Ned1" frequency="21600"/&gt;
&lt;channel name="VCR" frequency="59490"/&gt;
&lt;/input&gt;
&lt;input name="Composite1" id="1" xvenc="7"/&gt;
&lt;input name="S-Video" id="2" xvenc="14"/&gt;
&lt;input name="Composite3" id="3"/&gt;
&lt;/device&gt;
&lt;device path="/dev/video1" width="640" height="480" name="Philips 740 webcam" audio=""
minwidth="160" minheight="120" maxwidth="640" maxheight="480" playback="1"&gt;
&lt;input name="Webcam" id="0"/&gt;
&lt;/device&gt;
&lt;/tvdevices&gt;
</programlisting
> Bemærk at elementerne <quote
>input</quote
> som har kanaler, skal have egenskaben <quote
>tuner</quote
> indstillet til <quote
>1</quote
>. </para>
<para
><acronym
>Xvideo</acronym
> bruger kun egenskaberne <quote
>xvport</quote
> og <quote
>xvenc</quote
> og kan kun indstilles ved at redigere filen manuelt. Egenskabernes værdier kan hentes ved at køre <quote
>kxvplayer</quote
> i et terminalvindue såsom <quote
>konsole</quote
>. For hver port skriver <quote
>kxvplayer</quote
> linjer ud som vises nedenfor, og værdierne kan indstilles for de nævnte egenskaber. <programlisting>
xvport 240
....
encoding: 0 PAL-television
encoding: 1 NTSC-television
encoding: 2 SECAM-television
....
</programlisting
> Desuden ignoreres egenskaberne bredde og højde af <acronym
>Xvideo</acronym
>-afspilleren. Afspilleren henter størrelserna fra X-serveren. En af de gode ting ved <acronym
>Xvideo</acronym
> er at skalering gøres i hardware af videokortet, hvilket giver understøttelse for fuldskærmsvisning uden processorbrug og uden at ændre billedskærmens opløsning. Desuden opstår der ikke noget irriterende flimmer når et andet vindue overlapper videovinduet. </para>
<para
>Se afsnittet VDR for mere information om at bruge <acronym
>Xvideo</acronym
>. </para>
</section>
<section id="vdrsource">
<title
>VDR</title>
<para
>For at indstille VDR-indstillinger i Kmplayer, bruges indstillingsfeltet Kilde -> VDR -> Xvideo port. Der skal være detekterede porte, hvorfra du skal vælge en. Du skal regne ud hvilken kodning du skal bruge (i vesteuropa er det f.eks. PAL) og formodentlig har den rigtige et navn som indeholder <quote
>dvb</quote
>. </para>
<para
>Jeg har for eksempel et tv-kort, et DVB-S kort og en web-kamera sluttet til i mit system. Med disse har mine indstillinger tre porte. Den første har en lang liste med NTSC(-JP)/PAL(-M)/SECAM-indgange som alle indeholder noget med television/composite/svideo (mit tv-kort). Den anden har NTSC-dvb/PAL-dvb/SECAM-dvb (mit DVB-S kort). Den tredje har endelig kun ntsc/pal (formodentlig mit web-kamera). Derfor skal jeg indstille (blot ved at markere den) den anden port og den anden indgang (PAL-dvb). </para>
<para
>Eftersom VDR-understøttelse i Kmplayer kun kan bruge <acronym
>Xvideo</acronym
>, burde <acronym
>Xvideo</acronym
> naturligvis virke (og jeg tror at denne måde at kigge på videoenheder kun virker med Linux). Dette virker også kun på den første skærm (:0.0). Sørg altså for at udvidelsen <quote
>videoforlinux</quote
> virker med X-serveren. For XFree86-serveren, skal følgende være i indstillingsfilen (<filename
>/etc/X11/XF86Config</filename
>): <programlisting
>Section "Module"
....
Load "v4l"
EndSection
</programlisting>
</para>
<para
>Desværre skal du indstille dette igen ligeså snart du opdaterer din videodriver. </para>
</section>
<section id="kmplayer_url">
<title
>Kommandolinje</title>
<para
>Internt bruger Kmplayer distinkte navne for kilder. På det tidspunkt hvor dette skrives er de "dvdnavsource", "dvdsource", "exitsource", "hrefsource", "introsource", "pipesource", "tvscanner", "tvsource", "urlsource", "vcdsource" og "vdrsource". Når de aktiveres begynder de som regel at spille listen med spilbare punkter. </para>
<para
>Du kan aktivere en bestemt kilde med URL <filename
>kmplayer://</filename
>. Angiv blot værtsdelen som kildens navn og den valgfrie del som ekstra argument, hvilket vil kunne se ud som <filename
>kmplayer://vdrsource/22 MTV 2</filename
> for en kanal fra "vdrsource". For eksempel starter følgende script Kmplayer med "dvdnavsource" og bruger <acronym
>DCOP</acronym
> til at afspille i fuldskærmstilstand. <programlisting>
/bin/bash
kmplayer kmplayer://dvdnavsource/ &amp;
PID=$!
sleep 2
dcop kmplayer-$PID KMediaPlayer toggleFullScreen
</programlisting
> Dette udfører ikke meget for visse kilder, eftersom de ikke er beregnede til normal afspilning. Det er deaktiveret for "pipesource", eftersom det naturligvis ville være et alvorligt sikkerhedshul. </para>
</section>
</chapter>
<chapter id="questionsanswersandtips">
<title
>Spørgsmål, svar og tips</title>
<qandaset id="faq">
<title
>Ofte stillede spørgsmål</title>
<qandaentry>
<question>
<para
>Xine starter langsomt, hvorfor skal den måle min processorydelse hele tiden?</para>
</question>
<answer>
<para
>Bemærk at svaret nedenfor er forældet. <application
>kxineplayer</application
> gemmer den automatisk til den seneste værdi, så xine udfører kun processortesten første gangen. </para>
<para
>Grænsefladen for <application
>Xine</application
> i &kmplayer;, <application
>kxineplayer</application
>, bruger <filename
>~/.kde/share/apps/kmplayer/xine_config</filename
> til sine indstillinger. Indstillingerne for <application
>Xine</application
> er i indstillingsdialogen <quote
>General Options</quote
>|<quote
>Xine</quote
>. (Hvis du ændrer et punkt der og gemmer det, indeholder <filename
>~/.kde/share/apps/kmplayer/xine_config</filename
> også en del forklaringer). Målingen af processorydelse forårsages af at punktet <computeroutput
>misc.memcpy_method</computeroutput
> er indstillet til <computeroutput
>probe</computeroutput
>. For at finde ud af hvilken version af hukommelseskopiering som er hurtigst for dig, aktiveres <quote
>Vis terminaludskrift</quote
> i menuen <quote
>Vis</quote
> og kig på resultatet af målingen når du spiller noget med Xine. Indstil <computeroutput
>misc.memcpy_method</computeroutput
> til metoden med kortest tid.</para>
</answer>
</qandaentry>
<qandaentry>
<question>
<para
>Nogle tip til at gøre cdrom-enheden mere stille når den bruges til afspilning (ikke VCD://)?</para>
</question>
<answer>
<para
>Selvfølgelig, prøv <command
>hdparm -E 8 /dev/cdrom</command
> som systemadministrator, efter at have monteret enheden. Men sørg for at du dobbelttjekker at <filename
>/dev/cdrom</filename
> peger på cdrom-enheden. </para>
</answer>
</qandaentry>
</qandaset>
</chapter>
<chapter id="credits-and-licenses">
<title
>Medvirkende og licens</title>
<para
>&kmplayer; ophavsret 2002, 2003 Koos Vriezen</para>
&underFDL; &underGPL; </chapter>
&documentation.index;
</book>
<!--
Local Variables:
mode: sgml
sgml-minimize-attributes:nil
sgml-general-insert-case:lower
sgml-indent-step:0
sgml-indent-data:nil
End:
-->

@ -0,0 +1,5 @@
EXTRA_DIST = index.docbook
KDE_LANG = de
KDE_DOCS = kmplayer

@ -0,0 +1,400 @@
<?xml version="1.0" ?>
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
<!ENTITY kmplayer '<application
>Kmplayer</application
>'>
<!ENTITY kappname "&kmplayer;"
><!-- replace kmplayer here -->
<!ENTITY package "kdeextragear-2">
<!ENTITY % addindex "IGNORE">
<!ENTITY % German "INCLUDE"
><!-- change language only here -->
]>
<book lang="&language;">
<bookinfo>
<title
>Das Handbuch zu &kmplayer;</title>
<authorgroup>
<author
><firstname
>Koos</firstname
> <surname
>Vriezen</surname
> <affiliation
> <address
><email
>koos dot vriezen at xs4all dot nl</email
></address>
</affiliation>
</author>
</authorgroup>
<othercredit role="translator"
> <firstname
>René</firstname
> <surname
>Landert</surname
> <affiliation
><address
><email
>rene.landert@bluewin.ch</email
> </address
> </affiliation
> <contrib
>Deutsche Übersetzung </contrib
> </othercredit
>
<copyright>
<year
>2002</year>
<year
>2003</year>
<holder
>Koos Vriezen</holder>
</copyright>
<!-- Translators: put here the copyright notice of the translation -->
<!-- Put here the FDL notice. Read the explanation in fdl-notice.docbook
and in the FDL itself on how to use it. -->
<legalnotice
>&FDLNotice;</legalnotice>
<date
>2003-12-24</date>
<releaseinfo
>0.05.00</releaseinfo>
<!-- Abstract about this handbook -->
<abstract>
<para
>&kmplayer; ist die Benutzeroberfläche des Programmes <application
>MPlayer</application
> für das &kde;. </para>
</abstract>
<keywordset>
<keyword
>KDE</keyword>
<keyword
>kdemultimedia</keyword>
<keyword
>MPlayer</keyword>
<keyword
>Konqueror</keyword>
<keyword
>Video</keyword>
</keywordset>
</bookinfo>
<chapter id="introduction">
<title
>Einleitung</title>
<para
>&kmplayer; ist eine einfache Benutzeroberfläche für <application
>MPlayer</application
>, <application
>Xine</application
> und <application
>FFMpeg</application
>. Das Programm wird gebraucht zum Abspielen von Videodateien der von <application
>MPlayer</application
>/<application
>Xine</application
> unterstützten Formate, sowie zur Wiedergabe von <acronym
>DVD</acronym
>s, <acronym
>VCD</acronym
>s oder <acronym
>TV</acronym
>/<acronym
>Kamera</acronym
>. </para>
<para
>Die Dokumentation für &kappname; war noch nicht beendet als &kde; auf diesem Rechner installiert wurde.</para
> <para
>Für Hilfe bitte die Seite <ulink url="http://www.kde.org"
> The KDE Website</ulink
> auf neue Versionen überprüfen, oder die Frage an <ulink url="mailto:kde-user@kde.org"
>The &kde; User Mailing list</ulink
> schicken.</para>
<para
><emphasis
>Das &kde;-Team</emphasis
></para>
</chapter>
<chapter id="settings">
<title
>Einstellungen</title>
<section>
<title
>Animation beim Starten / Beenden</title>
<para
>Die Animation beim Starten und Beenden kann deaktiviert werden durch das Editieren von <filename
>~/.kde/share/config/kmplayerrc</filename
> und Ändern von <programlisting>
[General Options]
No Intro=0
</programlisting
> obiger Option auf '1'. Falls die Option nicht vorhanden ist, kann sie einfach eingefügt werden. </para>
<para
>Es ist auch möglich eine andere Animation zu aktivieren. KMPlayer wird die Dateien <filename
>~/.kde/share/apps/kmplayer/intro.xml</filename
> und <filename
>~/.kde/share/apps/kmplayer/exit.xml</filename
> beachten. Das Format muss eine unterstützte <acronym
>XML</acronym
> Datei sein. </para>
<para
>Die Animation beim Starten braucht nicht kurz zu sein, sie wird automatisch beendet durch das Öffnen einer anderen Quelle. Dies wäre bei der Ende-Animation allerdings störend, der Benutzer kann daher die Applikation ein zweites Mal beenden. </para>
<para
>Ein einfaches Beispiel einer Start-Animation kann das Anzeigen eines Lieblingsfotos sein: <programlisting>
&lt;smil&gt;
&lt;body&gt;
&lt;img dur="indefinite" src="file:///home/koos/mum.gif" fit="meet"/&gt;
&lt;/body&gt;
&lt;/smil&gt;
</programlisting
> Im Quellpaket von KMPlayer sind im Verzeichnis <filename
>tests/</filename
> einige Beispiele von <acronym
>SMIL</acronym
> die von KMPlayer unterstützt werden. </para>
</section>
</chapter>
<chapter id="sources">
<title
>Die abspielbaren Quellen</title>
<para
>&kmplayer; kann von verschiedenen Quellen abspielen. Diese Quellen sind im Menü Quellen aufgeführt. </para>
<section id="tvsource">
<title
>TV</title>
<para
>&kmplayer; kann von TV Karten abspielen, entweder mittels <application
>MPlayer</application
> oder <acronym
>XVideo</acronym
> (dies braucht <application
>kxvplayer</application
>). Bevor TV geschaut werden kann, müssen das zu gebrauchende Gerät und die TV Kanäle konfiguriert werden. Dazu kann der Scanner aus dem Konfigurationsdialog benutzt werden oder die Konfigurationsdatei kann manuell editiert werden. </para>
<para
>Die Konfigurationsdatei für die TV Einstellungen ist eine <acronym
>XML</acronym
>-Datei mit dem Namen <filename
>~/.kde/share/apps/kmplayer/tv.xml</filename
>. Das <acronym
>XML</acronym
> Format ist wie im folgenden Beispiel: <programlisting>
&lt;tvdevices&gt;
&lt;device path="/dev/video0" width="320" height="240" name="BT878 video (Hauppauge (bt878))" audio=""
minwidth="48" minheight="32" maxwidth="924" maxheight="576" playback="0" xvport="240"&gt;
&lt;input name="Television" id="0" tuner="1" norm="PAL" xvenc="0"&gt;
&lt;channel name="Ned1" frequency="21600"/&gt;
&lt;channel name="VCR" frequency="59490"/&gt;
&lt;/input&gt;
&lt;input name="Composite1" id="1" xvenc="7"/&gt;
&lt;input name="S-Video" id="2" xvenc="14"/&gt;
&lt;input name="Composite3" id="3"/&gt;
&lt;/device&gt;
&lt;device path="/dev/video1" width="640" height="480" name="Philips 740 webcam" audio=""
minwidth="160" minheight="120" maxwidth="640" maxheight="480" playback="1"&gt;
&lt;input name="Webcam" id="0"/&gt;
&lt;/device&gt;
&lt;/tvdevices&gt;
</programlisting
> Es ist darauf zu achten, dass <quote
>input</quote
> Elemente mit <quote
>channels</quote
> das <quote
>tuner</quote
> Attribut auf <quote
>1</quote
> gesetzt haben sollten. </para>
<para
><acronym
>XVideo</acronym
> braucht nur die <quote
>xvport</quote
> und <quote
>xvenc</quote
> Attribute; diese können nur durch manuelles Editieren der Datei gesetzt werden. Die Werte dieser beiden Attribute können ausgelesen werden, indem <quote
>kxvplayer</quote
> in einer Terminal Anwendung wie z.B. <quote
>konsole</quote
> gestartet wird. Für jeden Port wird <quote
>kxvplayer</quote
> eine Zeile wie unten aufgeführt ausgeben. Die Werte können daraufhin für die erwähnten Attribute gesetzt werden. <programlisting>
xvport 240
....
encoding: 0 PAL-television
encoding: 1 NTSC-television
encoding: 2 SECAM-television
....
</programlisting
> Die Attribute für die Breite und die Höhe werden vom <acronym
>XVideo</acronym
>-Spieler nicht beachtet. Dieses Programm erhält seine Bildgröße vom X Server. Einer der Vorteile von <acronym
>XVideo</acronym
> ist die Eigenschaft, dass die Skalierung durch die Hardware erledigt wird, d.h. durch die Video Karte, und somit auch im Vollbildmodus ohne CPU Belastung und ohne Wechsel der Bildschirmauflösung. Ebensowenig gibt es ein Flickern wenn ein anderes Fenster das Videobild überlagert. </para>
<para
>Im Kapitel VDR sind mehr Informationen enthalten über den Gebrauch von <acronym
>XVideo</acronym
>. </para>
</section>
<section id="vdrsource">
<title
>VDR</title>
<para
>Zum Konfigurieren der VDR (Video Daten Rekorder) Einstellungen im kmplayer ist der Dialog in den Einstellungen unter ->Quelle->VDR->XVideo Port zu benutzen. Dort sollten Ports erkannt werden, von denen einer ausgewählt wird. Die zu verwendende Codierung muss herausgefunden werden (z.B. ist es PAL für West Europa), der korrekte Name hat wahrscheinlich ein<quote
>dvb</quote
> darin enthalten. </para>
<para
>Als Beispiel sei im PC eine TV Karte, eine DVB-S Karte und eine Webkamera eingebaut. In diesem Fall enthält die Konfiguration drei Ports. Der erste Port enthält eine lange Liste mit Einträgen für NTSC(-JP)/PAL(-M)/SECAM , die alle etwas über Television/Composite/Svideo (die TV Karte) aussagen. Der zweite Port enthält NTSC-dvb/PAL-dvb/SECAM-dvb (die DVB-S Karte). Und schliesslich der dritte Port, der nur ntsc/pal enthält (vermutlich die Webkamera). Daher ist in diesem Fall der zweite Port mit dem zweiten Eintrag (diesen einfach nur auswählen) zu konfigurieren (PAL-dvb). </para>
<para
>Da die VDR Unterstützung von kmplayer nur <acronym
>XVideo</acronym
> nutzen kann, sollte <acronym
>XVideo</acronym
> auch funktionieren (vermutlich ist diese Art des Abspielens von Video Geräten unter Linux die einzige die funktioniert). Dies wird zudem auch nur auf dem ersten Bildschirm (:0.0) untertstützt. Aus diesem Grund muss die <quote
>videoforlinux</quote
> Erweiterung für den X Server funktionstüchtig sein. Für den XFree86 Server muss daher in seiner Konfigurationsdatei (<filename
>/etc/X11/XF86Config</filename
>) folgendes enthalten sein <programlisting
>Section "Module"
....
Load "v4l"
EndSection
</programlisting>
</para>
<para
>Unglücklicherweise muss man bei jedem Aktualisieren des Video Treibers diese Einstellung wieder konfigurieren. </para>
</section>
<section id="kmplayer_url">
<title
>Kommandozeile</title>
<para
>Intern werden von KMPlayer für die Quellen verschiedene Namen benutzt. Zum Zeitpunkt der Entstehung dieser Dokumentation sind dies "dvdnavsource", "dvdsource", "exitsource", "hrefsource", "introsource", "pipesource", "tvscanner", "tvsource", "urlsource", "vcdsource" und "vdrsource". Wenn sie aktiviert werden, beginnen sie mit dem Abspielen der Wiedergabeliste. </para>
<para
>Eine bestimmte Quelle kann mit der <acronym
>URL</acronym
> der Form <filename
>kmplayer://</filename
> aktiviert werden. Für den Rechnernamen ist der Quellname zu setzen und optional der Pfad als Teil des zusätzlichen Arguments; für einen Kanal der Quelle "vdrsource" könnte dies wie folgt aussehen: <filename
>kmplayer://vdrsource/22 MTV 2</filename
>. Die nachfolgende Kommandodatei startet kmplayer mit der Quelle "dvdnavsource" unter Nutzung von <acronym
>DCOP</acronym
> um im Vollbildmodus wiederzugeben. <programlisting>
/bin/bash
kmplayer kmplayer://dvdnavsource/ &amp;
PID=$!
sleep 2
dcop kmplayer-$PID KMediaPlayer toggleFullScreen
</programlisting
> Für einige Quellen wird dies nicht viel ergeben, weil diese nicht für das übliche Abspielen vorgesehen sind. Für "pipesource" ist dies abgeschaltet, weil dies natürlich eine grosse Sicherheitslücke wäre. </para>
</section>
</chapter>
<chapter id="questionsanswersandtips">
<title
>Fragen, Antworten, und Tips</title>
<qandaset id="faq">
<title
>Häufig gestellte Fragen</title>
<qandaentry>
<question>
<para
>Xine startet nur langsam auf, wieso muss jedes Mal meine CPU auf ihre Leistung geprüft werden?</para>
</question>
<answer>
<para
>Anmerkung: die Antwort ist überholt. <application
>kxineplayer</application
> braucht automatisch den letzten gespeicherten Wert, nur das erste Mal wird xine die CPU prüfen. </para>
<para
>Die <application
>Xine</application
> Oberfläche für &kmplayer;, <application
>kxineplayer</application
>, braucht <filename
>~/.kde/share/apps/kmplayer/xine_config</filename
> für ihre Konfiguration. Die Einstellungen für <application
>Xine</application
> befinden sich im Konfigurationsdialog <quote
>Generelle Optionen</quote
>|<quote
>Xine</quote
>. (Wird hier eine Option geändert und gesichert, so enthält <filename
>~/.kde/share/apps/kmplayer/xine_config</filename
> ebenfalls einige Erklärungen). Die Leistungsmessung der CPU wird durch das Setzen der Option <computeroutput
>misc.memcpy_method</computeroutput
> auf den Wert <computeroutput
>probe</computeroutput
>aktiviert. Um festzustellen welche memcpy Version am schnellsten arbeitet, muss <quote
>Konsole</quote
> aus dem Menü <quote
>Ansicht</quote
> gewählt werden. Die Resultate der Leistungsmessung werden beim Abspielen mit Xine angezeigt. <computeroutput
>misc.memcpy_method</computeroutput
> ist mit der Methode mit der kleinsten gemessenen Zeit zu konfigurieren.</para>
</answer>
</qandaentry>
<qandaentry>
<question>
<para
>Gibt es Hinweise wie ich mein CDROM Laufwerk leiser machen kann, wenn ich von ihm abspiele (nicht von der VCD://)?</para>
</question>
<answer>
<para
>Ja, der Befehl <command
>hdparm -E 8 /dev/cdrom</command
> ist als Benutzer "root" nach dem Einbinden des Geräts auszuführen. Dabei ist unbedingt sicher zu stellen, dass <filename
>/dev/cdrom</filename
> auf das CDROM Laufwerk zeigt. </para>
</answer>
</qandaentry>
</qandaset>
</chapter>
<chapter id="credits-and-licenses">
<title
>Mitwirkende und Lizenzen</title>
<para
>&kmplayer; Copyright 2002,2003 Koos Vriezen</para>
&underFDL; &underGPL; </chapter>
&documentation.index;
</book>
<!--
Local Variables:
mode: sgml
sgml-minimize-attributes:nil
sgml-general-insert-case:lower
sgml-indent-step:0
sgml-indent-data:nil
End:
-->

@ -0,0 +1,5 @@
EXTRA_DIST = index.docbook
KDE_LANG = en
KDE_DOCS = kmplayer

@ -0,0 +1,513 @@
<?xml version="1.0" ?>
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
<!ENTITY kmplayer '<application>KMPlayer</application>'>
<!ENTITY kappname "&kmplayer;"><!-- replace kmplayer here -->
<!ENTITY package "kdeextragear-2">
<!ENTITY % addindex "IGNORE">
<!ENTITY % English "INCLUDE"><!-- change language only here -->
]>
<book lang="&language;">
<bookinfo>
<title>The &kmplayer; Handbook</title>
<authorgroup>
<author>
<firstname>Koos</firstname>
<surname>Vriezen</surname>
<affiliation>
<address><email>koos dot vriezen at gmail dot com</email></address>
</affiliation>
</author>
</authorgroup>
<!-- TRANS:ROLES_OF_TRANSLATORS -->
<copyright>
<year>2002</year>
<year>2006</year>
<year>2007</year>
<holder>Koos Vriezen</holder>
</copyright>
<!-- Translators: put here the copyright notice of the translation -->
<!-- Put here the FDL notice. Read the explanation in fdl-notice.docbook
and in the FDL itself on how to use it. -->
<legalnotice>&FDLNotice;</legalnotice>
<date>2007-07-28</date>
<releaseinfo>0.06.00</releaseinfo>
<!-- Abstract about this handbook -->
<abstract>
<para>
&kmplayer; is an application that is a &kde; frontend to <application>MPlayer</application>, <application>Xine</application> and <application>GStreamer</application>.
</para>
</abstract>
<keywordset>
<keyword>KDE</keyword>
<keyword>kdemultimedia</keyword>
<keyword>MPlayer</keyword>
<keyword>konqueror</keyword>
<keyword>video</keyword>
</keywordset>
</bookinfo>
<chapter id="introduction">
<title>Introduction</title>
<para>
&kmplayer; is a simple frontend to <application>MPlayer</application>,
<application>Xine</application>, <application>GStreamer</application> and
<application>FFMpeg</application>. You can use it for watching all the movie
file formats that <application>MPlayer</application>,
<application>Xine</application> or <application>GStreamer</application>
supports as well as watching from <acronym>DVD</acronym>,
<acronym>VCD</acronym> or <acronym>TV</acronym> and <acronym>camera</acronym>.
</para>
<para>
The documentation for &kappname; was not finished when &kde; was
installed on this computer.</para> <para>If you need more help, please
check <ulink url="http://www.kde.org">The KDE Website</ulink> for
updates, or by submitting your question to
<ulink url="mailto:kde-user@kde.org">The &kde; User Mailing list</ulink>.
</para>
<para><emphasis>The &kde; Team</emphasis></para>
</chapter>
<chapter id="gui">
<title>The user interface</title>
<para>
The application window is made of so called dockable windows. There is always
the central view window. Optional there is the playlist window. And finally
there is an info window, that just shows itself when some information is there
to been shown.
</para>
<section id="playlistwindow">
<title>Playlist window</title>
<para>
The playlist window has as of this writing five categories, current item(s),
<guilabel>Optical Disks</guilabel>, <guilabel>Television</guilabel>,
<guilabel>Persistent Playlists</guilabel> and <guilabel>Most Recent</guilabel>.
When clicked on a category's text, it will show the contents below this line.
Of course there has to be contents, eg. see
<link linkend="tvsource"><acronym>TV</acronym> settings</link> for adding
content for the <guilabel>Television</guilabel> category. The
<guilabel>Most Recent</guilabel> category will fill itself when playing
locale media files or network <acronym>Url</acronym>s. This category can
hold 60 items of which the last 50 are under the <guilabel>More ..</guilabel>
branch.
</para>
<section>
<title>Persisent Playlists category</title>
<para>
It's possible to store your favorite links in the <guilabel>Bookmark</guilabel>
menu, but those are single items. If you want to create a list of items that
play after each other, than you should use the
<guilabel>Persistent Playlists</guilabel> category.
</para>
<para>
The easiest way to add an item in this list is to drag it from
<guilabel>Most Recent</guilabel> and drop it on
<guilabel>Persistent Playlists</guilabel>. As you will see, when dropped, a
pop-up menu appears where you can choose to add to this list or create a
new group. Top level items behave like a bookmark item, but items in groups
will play the whole group wherein they reside. Items in this category can
easily be moved, copied, added to a new group or deleted just by dragging this
item to another place in this category. Additionally there are
<guimenu>Delete item</guimenu>, <guimenu>Move up</guimenu> and
<guimenu>Move down</guimenu> items in the context menu (when clicking with
the right mouse button on an item).
</para>
<para>
Of course you can add groups to groups to get a deeper hierarchy. When clicked
on an item, its group and all its child groups will be copied to the current
category and playings starts at the clicked item position.
</para>
<section>
<title>Storage format</title>
<para>
The data is stored in
<filename>~/.kde/share/apps/kmplayer/playlist.xml</filename>, and its format
is like this example. See <link linkend="XML-editing">here</link> for
manipulating this data directly.
<programlisting>
&lt;playlist&gt;
&lt;group title="feeds"&gt;
&lt;item url="http://www.lugradio.org/episodes.rss"/&gt;
&lt;item url="http://science.nasa.gov/podcast.xml"/&gt;
&lt;item url="http://www.theworld.org/rss/tech.xml"/&gt;
&lt;/group&gt;
&lt;group title="iradio"&gt;
&lt;group title="sunny"&gt;
&lt;item mplayeropts="-cache 256" url="http://www.swissgroove.ch/listen.m3u"/&gt;
&lt;item url="http://www.boombasticradio.com/shoutcast/64.pls"/&gt;
&lt;/group&gt;
&lt;group title="rainy"&gt;
&lt;item url="http://www.radioparadise.com/musiclinks/rp_64.m3u"/&gt;
&lt;item url="http://www.woxy.com/stream/wma64.asx"/&gt;
&lt;item url="http://radionigel.com/winmedia.asx"/&gt;
&lt;item url="rtsp://livestreams.omroep.nl/live/vpro/vpro3voor12radioalt.rm"/&gt;
&lt;/group&gt;
&lt;/group&gt;
&lt;/playlist&gt;
</programlisting>
Also note that for <application>MPlayer</application> custom options can be
set using the <computeroutput>mplayeropts</computeroutput> argument. &kmplayer;
searches for this option upwards in the tree, so you can set it for a whole
group and override it for a child group or item.
</para>
</section>
</section>
</section>
<section id="XML-editing">
<title>Direct XML editing</title>
<para>
The current, <guilabel>Television</guilabel> and
<guilabel>Persistent Playlists</guilabel> categories can also be manipulated
by editing their <acronym>XML</acronym> storage. Of course one can do that
when &kmplayer; is not running and editing the various files in
<filename>~/.kde/share/apps/kmplayer/</filename>, but also in the application
itself. Simply click on a catergory label, then choose <guimenu>View</guimenu>
and next <guimenu>Edit mode</guimenu>. You can also click on a child branch
and will then see only the <acronym>XML</acronym> contents of the branch.
</para>
<para>
After you have edited some <acronym>XML</acronym>, click on the
<guilabel>Sync with playlist</guilabel> and either deselect the
<guimenu>Edit mode</guimenu> item or click on another catergory.
<caution><para>
All changes are lost when leaving edit mode or selecting another branch without syncing with playlist.
</para></caution>
</para>
<para>
Because of the lazyness of &kmplayer;'s author(s), some features can only be
enabled by editing the XML.
</para>
</section>
</chapter>
<chapter id="settings">
<title>Settings</title>
<section>
<title>Intro/exit animation</title>
<para>
Disabling the starting/ending animation can be configured by editing <filename>~/.kde/share/config/kmplayerrc</filename> and modify
<programlisting>
[General Options]
No Intro=0
</programlisting>
the above option to '1'. Just add this option if it's not there yet.
</para>
<para>
It's also possible to set an alternative animation. &kmplayer; will look at resp. <filename>~/.kde/share/apps/kmplayer/intro.xml</filename> and <filename>~/.kde/share/apps/kmplayer/exit.xml</filename>. The format has to be a supported <acronym>XML</acronym> file.
</para>
<para>
The intro animation doesn't have to be a short one, because it will automatically end when another source is opened. Of course for the exit animation this would be a bit annoying, however the user can always end the application twice.
</para>
<para>
A simple example of an intro, showing your favorite photo can be
<programlisting>
&lt;smil&gt;
&lt;body&gt;
&lt;img dur="indefinite" src="file:///home/koos/mum.gif" fit="meet"/&gt;
&lt;/body&gt;
&lt;/smil&gt;
</programlisting>
In &kmplayer;'s source package, in the <filename>tests/</filename> are some examples of <acronym>SMIL</acronym> that &kmplayer; supports.
</para>
</section>
</chapter>
<chapter id="backends">
<title>The backend players</title>
<para>
&kmplayer; uses external programs to do the actual playing.
</para>
<section id="mplayer">
<title>MPlayer</title>
<para>
There is a configuration tab for MPlayer in &kmplayer;'s config dialog. Here
you can set MPlayer's path and it cache size for network stream, among other
things.
</para>
<para>
This player configuration name is <parameter>mplayer</parameter>.
</para>
<section id="mplayer-debug">
<title>Trouble shooting</title>
<para>
The best way to debug this backend is to start &kmplayer; from a console
application like konsole. Then start a movie with kmplayer and see the exact
commandline that is used to start mplayer in the console application.
Now copy/paste that to another console, remove the '-wid 12344' options, and
make it play. Probably it's just choosing the right -ao/-vo params. Also make
sure mplayer doesn't start default with a <acronym>GUI</acronym>.
</para>
<para>
Another debugging tool is the 'console' button in kmplayer's toolbar. Here you
can see the output from mplayer.
</para>
</section>
</section>
<section id="xine">
<title>Xine</title>
<para>
When configured &kmplayer; with Xine support, there will be configuration tab
for Xine in &kmplayer;'s config dialog. Here you can set various options.
These options are dynamic retrieved from the Xine library. Use context help to
get information on what these options do (ie. click on the question mark
button from the dialog title bar and then click on an option).
</para>
<para>
This player configuration name is <parameter>xine</parameter>.
</para>
<para>
The options are saved in
<filename>.kde/share/apps/kmplayer/xine_config</filename> as a text document.
</para>
<section id="xine-debug">
<title>Trouble shooting</title>
<para>
Basically the same way as trouble shooting
<link linkend="mplayer-debug">MPlayer</link>, with the application name of
<filename>kxineplayer</filename>.
</para>
</section>
</section>
<section id="gstreamer">
<title>GStreamer</title>
<para>
There is no configuration tab for GStreamer in &kmplayer;'s config dialog. The
common options for eg. <acronym>DVD</acronym> device are used when appropriate.
</para>
<para>
This player configuration name is <parameter>gstreamer</parameter>.
</para>
<section id="gstremaer-debug">
<title>Trouble shooting</title>
<para>
Basically the same way as trouble shooting
<link linkend="mplayer-debug">MPlayer</link>, with the application name of
<filename>kgstplayer</filename>.
</para>
</section>
</section>
<section id="npp">
<title>Browser plugin</title>
<para>
There is no configuration tab for this player in &kmplayer;'s config dialog.
Everything must be configured by manually editing the
<filename>~/.kde/share/config/kmplayerrc</filename> like with configuring the
<link linkend="backend-mimetype">backend per mimetype</link>. This is an
example how to let flash be played with the swfdec-mozilla plugin:
<programlisting>
[application/x-shockwave-flash]
player=npp
plugin=/usr/lib/mozilla/plugins/libswfdecmozilla.so
</programlisting>
</para>
<para>
You can play flash inside &kmplayer;, actually you can even paste the special
<parameter>embed</parameter> field for
<ulink url="http://www.youtube.com">YouTube</ulink> in the
<link linkend="XML-editing">playlist <acronym>XML</acronym></link>.
</para>
<para>
In order to let &kmplayer; play flash in HTML pages, you should make the
&kmplayer; plugin the service provider for the
<parameter>application/x-shockwave-flash</parameter> mimetype in KDE's
<guilabel>File Associations</guilabel> configuration dialog.
</para>
<para>
As in the above example, this player configuration name is
<parameter>npp</parameter>.
</para>
<section id="npp-debug">
<title>Trouble shooting</title>
<para>
Start Konqueror or &kmplayer; in a console application and look for errors
about loading the browser plugin library. The process started is called
<filename>knpplayer</filename>. If that doesn't give any errors, check
the backend output capturing inside &kmplayer; (<guimenu>View</guimenu>,
<guimenuitem>Console</guimenuitem>, or <guimenuitem>Console</guimenuitem>
from the popup menu).
</para>
</section>
</section>
<section id="backend-mimetype">
<title>Force backend player for a mimetype</title>
<para>
To configure to always use a given backend for a particular mimetype
(if detected of course) can be done by manually editing the
<filename>~/.kde/share/config/kmplayerrc</filename>. For example, let xine play
all ogg files:
<programlisting>
[audio/ogg]
player=xine
</programlisting>
</para>
</section>
</chapter>
<chapter id="sources">
<title>The playable sources</title>
<para>
&kmplayer; can play from various sources. These sources are listed in the Source menu.
</para>
<section id="tvsource">
<title>TV</title>
<para>
&kmplayer; can play from TV cards using <application>MPlayer</application> or <acronym>XVideo</acronym> (using <application>kxvplayer</application>). Before you can watch TV, you have to configure which device to use and the TV channels. You can use the scanner from the configure dialog for this or edit the config file manually.
</para>
<para>
The config file for TV settings is a <acronym>XML</acronym> file, located
<filename>~/.kde/share/apps/kmplayer/tv.xml</filename>. See
<link linkend="XML-editing">here</link> for manipulating this data directly.
The <acronym>XML</acronym> format is like this example:
<programlisting>
&lt;tvdevices&gt;
&lt;device path="/dev/video0" width="320" height="240" name="BT878 video (Hauppauge (bt878))" audio=""
minwidth="48" minheight="32" maxwidth="924" maxheight="576" playback="0" xvport="240"&gt;
&lt;input name="Television" id="0" tuner="1" norm="PAL" xvenc="0"&gt;
&lt;channel name="Ned1" frequency="216"/&gt;
&lt;channel name="VCR" frequency="594.90"/&gt;
&lt;/input&gt;
&lt;input name="Composite1" id="1" xvenc="7"/&gt;
&lt;input name="S-Video" id="2" xvenc="14"/&gt;
&lt;input name="Composite3" id="3"/&gt;
&lt;/device&gt;
&lt;device path="/dev/video1" width="640" height="480" name="Philips 740 webcam" audio=""
minwidth="160" minheight="120" maxwidth="640" maxheight="480" playback="1"&gt;
&lt;input name="Webcam" id="0"/&gt;
&lt;/device&gt;
&lt;/tvdevices&gt;
</programlisting>
Note that <quote>input</quote> elements having channels, should have the <quote>tuner</quote> attribute set to <quote>1</quote>.
</para>
<para>
<acronym>XVideo</acronym> only uses the <quote>xvport</quote> and <quote>xvenc</quote> attributes and they can only be set by manually editing this file. The values of these two attributes can be retrieved by running <quote>kxvplayer</quote> in a terminal application like <quote>konsole</quote>. For every port, <quote>kxvplayer</quote> will output lines like below and the numbers can be set for the attributes mentioned.
<programlisting>
xvport 240
....
encoding: 0 PAL-television
encoding: 1 NTSC-television
encoding: 2 SECAM-television
....
</programlisting>
Also width and height attributes are ignored by the <acronym>XVideo</acronym> player. This player gets the sizes from the X server. One of the nice things of <acronym>XVideo</acronym> is that scaling is done in hardware, by the video card, so fullscreen support without CPU usage and without resolution change of your monitor. Also no annoying flicker when another window overlaps this video window.
</para>
<para>
See the VDR section for more information about using <acronym>XVideo</acronym>.
</para>
</section>
<section id="vdrsource">
<title>VDR</title>
<para>
To configure your VDR settings in kmplayer, see the Configure panel->Source->VDR->XVideo port panel. There should be ports detected, from which you should select one. You have to figure out what encoding you should use (eg. for western europe, that is PAL) and likely the correct one has a name with <quote>dvb</quote> in it.
</para>
<para>
For instance, I have a TV card, a DVB-S card and a webcam pluged into my system. With these, my settings are that there are three Ports. The first one has a long list of NTSC(-JP)/PAL(-M)/SECAM entries all saying something about television/composite/svideo (my TV card). The second one has NTSC-dvb/PAL-dvb/SECAM-dvb (my DVB-S card). And finally the third has only ntsc/pal (probably my webcam). I should therefore configure (just select it) the second port and second entry (PAL-dvb).
</para>
<para>
Because VDR support from kmplayer can only use <acronym>XVideo</acronym>, of course <acronym>XVideo</acronym> should work (and I believe for video devices, this way of viewing only works on linux). Also this only works on your first display (:0.0). So make sure <quote>videoforlinux</quote> extension works with the X server. For the XFree86 server, therefor in its configuration (<filename>/etc/X11/XF86Config</filename>) it should have
<programlisting>
Section "Module"
....
Load "v4l"
EndSection
</programlisting>
</para>
<para>
Unfortunately, when ever you update your video driver, you have to reconfigure this setting.
</para>
</section>
<section id="kmplayer_url">
<title>Commandline</title>
<para>
Internally for the sources, &kmplayer; uses distinct names. At the time of
this writing these are "dvdnavsource", "dvdsource", "exitsource",
"hrefsource", "introsource", "pipesource", "tvscanner", "tvsource",
"urlsource", "vcdsource" and "vdrsource". When activated, they mostly
starts playing the list of playable items.
</para>
<para>
You can activate a particular source with a <filename>kmplayer://</filename> type <acronym>URL</acronym>. Just set the host part as the source name and optional path part as extra arguments, so for a channel for the "vdrsource" this could look like <filename>kmplayer://vdrsource/22 MTV 2</filename>. Eg. this script starts kmplayer using "dvdnavsource" and using <acronym>DCOP</acronym> to play fullscreen.
<programlisting>
/bin/bash
kmplayer kmplayer://dvdnavsource/ &amp;
PID=$!
sleep 2
dcop kmplayer-$PID KMediaPlayer toggleFullScreen
</programlisting>
For some sources this will not do much because they are not meant to be
for normal playing. For "pipesource" this is disabled because that
would be a bad security hole of course.
</para>
</section>
</chapter>
<chapter id="questionsanswersandtips">
<title>Questions, Answers, and Tips</title>
<qandaset id="faq">
<title>Frequently asked questions</title>
<qandaentry>
<question>
<para>Xine starts up slow, why does it have to benchmark my CPU all the time?</para>
</question>
<answer>
<para>
Note the answer below is outdated. <application>kxineplayer</application> saves it automatically to last value, so only the first time xine will do the CPU test.
</para>
<para>The <application>Xine</application> frontend for &kmplayer;, <application>kxineplayer</application>, uses <filename>~/.kde/share/apps/kmplayer/xine_config</filename> for its configuration. Settings for <application>Xine</application> are found in the configuration dialog <quote>General Options</quote>|<quote>Xine</quote>. (If you change an option here and save it, <filename>~/.kde/share/apps/kmplayer/xine_config</filename> will contain some explainations too). The CPU benchmarking is caused by the option <computeroutput>misc.memcpy_method</computeroutput> set to <computeroutput>probe</computeroutput>. To see which memcpy version works the fastest for you, enable <quote>Show Console Output</quote> from the <quote>View</quote> menu and look at the results from this benchmarking when you play something with Xine. Configure <computeroutput>misc.memcpy_method</computeroutput> with the method with the lowest time.</para>
</answer>
</qandaentry>
<qandaentry>
<question>
<para>Any hints to make my CDROM less noisy when playing from it (not VCD://)?</para>
</question>
<answer>
<para>Sure, try <command>hdparm -E 8 /dev/cdrom</command> as root after mounting the device. But be sure to double check <filename>/dev/cdrom</filename> pointing to your CDROM drive.
</para>
</answer>
</qandaentry>
</qandaset>
</chapter>
<chapter id="credits-and-licenses">
<title>Credits and Licenses</title>
<para>&kmplayer; copyright 2002,2003 Koos Vriezen</para>
&underFDL;
&underGPL;
</chapter>
&documentation.index;
</book>
<!--
Local Variables:
mode: sgml
sgml-minimize-attributes:nil
sgml-general-insert-case:lower
sgml-indent-step:0
sgml-indent-data:nil
End:
-->

@ -0,0 +1,5 @@
EXTRA_DIST = index.docbook
KDE_LANG = es
KDE_DOCS = kmplayer

@ -0,0 +1,225 @@
<?xml version="1.0" ?>
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
<!ENTITY kmplayer '<application
>Kmplayer</application
>'>
<!ENTITY kappname "&kmplayer;"
><!-- replace kmplayer here -->
<!ENTITY package "kdeextragear-2">
<!ENTITY % addindex "IGNORE">
<!ENTITY % Spanish "INCLUDE"
><!-- change language only here -->
]>
<book lang="&language;">
<bookinfo>
<title
>El manual de &kmplayer;</title>
<authorgroup>
<author
><firstname
>Koos</firstname
> <surname
>Vriezen</surname
> <affiliation
> <address
><email
>koos dot vriezen at xs4all dot nl</email
></address>
</affiliation>
</author>
</authorgroup>
<othercredit role="translator"
><firstname
></firstname
><surname
></surname
><affiliation
><address
><email
>pablo.pita@pitagoral.com</email
></address
></affiliation
><contrib
></contrib
></othercredit
>
<copyright>
<year
>2002</year>
<year
>2003</year>
<holder
>Koos Vriezen</holder>
</copyright>
<!-- Translators: put here the copyright notice of the translation -->
<!-- Put here the FDL notice. Read the explanation in fdl-notice.docbook
and in the FDL itself on how to use it. -->
<legalnotice
>&FDLNotice;</legalnotice>
<date
>2003-12-24</date>
<releaseinfo
>0.05.00</releaseinfo>
<!-- Abstract about this handbook -->
<abstract>
<para
>&kmplayer; es una aplicación de &kde; y es una interfaz gráfica sobre <application
>MPlayer</application
>. </para>
</abstract>
<keywordset>
<keyword
>KDE</keyword>
<keyword
>kdemultimedia</keyword>
<keyword
>MPlayer</keyword>
<keyword
>konqueror</keyword>
<keyword
>vídeo</keyword>
</keywordset>
</bookinfo>
<chapter id="introduction">
<title
>Introducción</title>
<para
>&kmplayer; es una interfaz gráfica simple a <application
>MPlayer</application
>, <application
>Xine</application
> y <application
>FFMpeg</application
>. Puede usarla para ver los distintos formatos de películas que soportan <application
>MPlayer</application
>/<application
>Xine</application
> así como ver <acronym
>DVD</acronym
>s, <acronym
>VCD</acronym
> o <acronym
>TV</acronym
>/<acronym
>cámaras</acronym
>. </para>
<para
>La documentación de &kappname; no se terminó cuando &kde; se instaló en este ordenador.</para
> <para
>Si necesita ayuda, por favor vaya al <ulink url="http://www.kde.org"
>sitio web de KDE</ulink
> para actualizaciones, o para enviar su pregunta, a <ulink url="mail to:kde-user@kde.org"
>la lista de correo de los usuarios de &kde;</ulink
>.</para>
<para
><emphasis
>El equipo de &kde;</emphasis
></para>
</chapter>
<chapter id="questionsanswersandtips">
<title
>Preguntas, respuestas y consejos</title>
<qandaset id="faq">
<title
>Preguntas habituales</title>
<qandaentry>
<question>
<para
>Xine comienza lentamente, porqué tiene que hacer siempre la prueba de mi CPU ?</para>
</question>
<answer>
<para
>La interfaz gráfica de &kmplayer; para <application
>Xine</application
>, <application
>kxineplayer</application
>, usa como archivo de configuración <application
>~/.xine/config2</application
>. Las preferencias para <filename
>Xine</filename
> se encuentran en el diálogo de configuración <application
>Opciones generales</application
>|<quote
>Xine</quote
>. (Si cambia una opción aquí y la guarda, el archivo <filename
>~/.xine/config2</filename
> contendrá algunas explicaciones también). La prueba de la CPU la causa el valor de la opción <computeroutput
>misc.memcpy_method</computeroutput
> dado como <computeroutput
>probe</computeroutput
>. Para ver que versión de memcpy funciona de manera más rápida para usted, habilite <quote
>Mostrar salida de consola</quote
> desde la <quote
>Vista</quote
></para>
</answer>
</qandaentry>
<qandaentry>
<question>
<para
>Alguna idea de como hacer más silencioso mi CDROM cuando se usa (no VCD://) ?</para>
</question>
<answer>
<para
>Por supuesto, pruebe como usuario root el comando <command
>hdparm -E 8 /dev/cdrom</command
> despues de montar el dispositivo. Pero asegúrese de que <filename
>/dev/cdrom</filename
> se refiere a su dispositivo CDROM. </para>
</answer>
</qandaentry>
</qandaset>
</chapter>
<chapter id="credits-and-licenses">
<title
>Créditos y licencias</title>
<para
>&kmplayer; copyright 2002,2003 Koos Vriezen</para>
&underFDL; &underGPL; </chapter>
&documentation.index;
</book>
<!--
Local Variables:
mode: sgml
sgml-minimize-attributes:nil
sgml-general-insert-case:lower
sgml-indent-step:0
sgml-indent-data:nil
End:
-->

@ -0,0 +1,5 @@
EXTRA_DIST = index.docbook
KDE_LANG = et
KDE_DOCS = kmplayer

@ -0,0 +1,227 @@
<?xml version="1.0" ?>
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
<!ENTITY kmplayer '<application
>Kmplayer</application
>'>
<!ENTITY kappname "&kmplayer;"
><!-- replace kmplayer here -->
<!ENTITY package "kdeextragear-2">
<!ENTITY % addindex "IGNORE">
<!ENTITY % Estonian "INCLUDE"
><!-- change language only here -->
]>
<book lang="&language;">
<bookinfo>
<title
>&kmplayer;i käsiraamat</title>
<authorgroup>
<author
><firstname
>Koos</firstname
> <surname
>Vriezen</surname
> <affiliation
> <address
><email
>koos dot vriezen at xs4all dot nl</email
></address>
</affiliation>
</author>
</authorgroup>
<othercredit role="translator"
><firstname
>Marek</firstname
><surname
>Laane</surname
><affiliation
><address
><email
>bald@online.ee</email
></address
></affiliation
><contrib
>Tõlge eesti keelde</contrib
></othercredit
>
<copyright>
<year
>2002</year>
<year
>2003</year>
<holder
>Koos Vriezen</holder>
</copyright>
<!-- Translators: put here the copyright notice of the translation -->
<!-- Put here the FDL notice. Read the explanation in fdl-notice.docbook
and in the FDL itself on how to use it. -->
<legalnotice
>&FDLNotice;</legalnotice>
<date
>2003-12-24</date>
<releaseinfo
>0.05.00</releaseinfo>
<!-- Abstract about this handbook -->
<abstract>
<para
>&kmplayer; on meediamängija <application
>MPlayer</application
> kasutajaliides &kde; keskkonnale. </para>
</abstract>
<keywordset>
<keyword
>KDE</keyword>
<keyword
>kdemultimedia</keyword>
<keyword
>MPlayer</keyword>
<keyword
>konqueror</keyword>
<keyword
>video</keyword>
</keywordset>
</bookinfo>
<chapter id="introduction">
<title
>Sissejuhatus</title>
<para
>&kmplayer; on meediamängija <application
>MPlayer</application
>, <application
>Xine</application
> ja <application
>FFMpeg</application
> lihtne kasutajaliides. Sellega saab vaadata nii filme kõigis vormingutes, mida <application
>MPlayer</application
>/<application
>Xine</application
> toetab, kui ka <acronym
>DVD</acronym
>-sid, <acronym
>VCD</acronym
>-sid või <acronym
>TV</acronym
>/<acronym
>kaamera</acronym
> võtteid. </para>
<para
>Vabandust, aga &kappname; dokumentatsioon ei olnud lõpetatud ajaks, kui &kde; sellele arvutile paigaldati.</para
> <para
>Kui vajad abi või uuemat infot, külasta <ulink url="http://www.kde.org"
>KDE veebilehekülge</ulink
> või postita oma küsimus <ulink url="mailto:kde-user@kde.org"
>&kde; meililisti</ulink
>.</para>
<para
><emphasis
>&kde; meeskond</emphasis
></para>
</chapter>
<chapter id="questionsanswersandtips">
<title
>Küsimused, vastused ja nõuanded</title>
<qandaset id="faq">
<title
>Korduma kippuvad küsimused</title>
<qandaentry>
<question>
<para
>Xine käivitub aeglaselt, miks see kogu aeg minu protsessori jõudlust uurib?</para>
</question>
<answer>
<para
>&kmplayer;i <application
>Xine</application
> kasutajaliides <application
>kxineplayer</application
> võtab seadistuse aluseks faili <filename
>~/.xine/config2</filename
>. <application
>Xine</application
> seadistusi näeb seadistustedialoogis <quote
>Üldised valikud</quote
>|<quote
>Xine</quote
>. (Kui muudad seal midagi ja salvestad, sisaldab <filename
>~/.xine/config2</filename
> selle kohta ka mõningaid selgitusi). Protsessori jõudluse uurimist tingib see, et võtme <computeroutput
>misc.memcpy_method</computeroutput
> väärtuseks on <computeroutput
>probe</computeroutput
>. Kui soovid näha, milline memcpy versioon sinu jaoks kõige kiiremini toimib, lülita sisse käsk <quote
>Näita konsooli väljundit</quote
>, mille leiad menüüst <quote
>Vaade</quote
> ning jälgi seda millegi taasesitamisel Xines. Määra <computeroutput
>misc.memcpy_method</computeroutput
> väärtuseks väikseima ajaga meetod.</para>
</answer>
</qandaentry>
<qandaentry>
<question>
<para
>Kuidas vähendada CD-ROM-i müra, kui mängitakse sellelt (mitte VCD://)?</para>
</question>
<answer>
<para
>Proovi pärast seadme ühendamist administraatorina anda käsk <command
>hdparm -E 8 /dev/cdrom</command
>. Aga kontrolli kindlasti hoolikalt, et <filename
>/dev/cdrom</filename
> ikka viitaks sinu CD-ROM seadmele. </para>
</answer>
</qandaentry>
</qandaset>
</chapter>
<chapter id="credits-and-licenses">
<title
>Autorid ja litsents</title>
<para
>&kmplayer;i autoriõigus 2002, 2003: Koos Vriezen</para>
&underFDL; &underGPL; </chapter>
&documentation.index;
</book>
<!--
Local Variables:
mode: sgml
sgml-minimize-attributes:nil
sgml-general-insert-case:lower
sgml-indent-step:0
sgml-indent-data:nil
End:
-->

@ -0,0 +1,5 @@
EXTRA_DIST = index.docbook
KDE_LANG = fr
KDE_DOCS = kmplayer

@ -0,0 +1,213 @@
<?xml version="1.0" ?>
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
<!ENTITY kmplayer '<application
>Kmplayer</application
>'>
<!ENTITY kappname "&kmplayer;"
><!-- replace kmplayer here -->
<!ENTITY package "kdeextragear-2">
<!ENTITY % addindex "IGNORE">
<!ENTITY % French "INCLUDE"
><!-- change language only here -->
]>
<book lang="&language;">
<bookinfo>
<title
>Le guide de &kmplayer;</title>
<authorgroup>
<author
><firstname
>Koos</firstname
> <surname
>Vriezen</surname
> <affiliation
> <address
><email
>koos POINT vriezen CHEZ xs4all POINT nl</email
></address>
</affiliation>
</author>
</authorgroup>
&traducteurSimonDepiets;
<copyright>
<year
>2002</year>
<year
>2003</year>
<holder
>Koos Vriezen</holder>
</copyright>
<!-- Translators: put here the copyright notice of the translation -->
<!-- Put here the FDL notice. Read the explanation in fdl-notice.docbook
and in the FDL itself on how to use it. -->
<legalnotice
>&FDLNotice;</legalnotice>
<date
>2003-12-24</date>
<releaseinfo
>0.05.00</releaseinfo>
<!-- Abstract about this handbook -->
<abstract>
<para
>&kmplayer; est une interface graphique pour &kde; de <application
>MPlayer</application
>. </para>
</abstract>
<keywordset>
<keyword
>KDE</keyword>
<keyword
>kdemultimedia</keyword>
<keyword
>MPlayer</keyword>
<keyword
>konqueror</keyword>
<keyword
>vidéo</keyword>
</keywordset>
</bookinfo>
<chapter id="introduction">
<title
>Introduction</title>
<para
>&kmplayer; est une interface graphique simple de <application
>MPlayer</application
>, <application
>Xine</application
> et <application
>FFMpeg</application
>. Vous pouvez l'utiliser pour regarder tous les formats vidéo que <application
>MPlayer</application
>/<application
>Xine</application
> supporte ainsi que regarder des<acronym
>DVD</acronym
>s, <acronym
>VCD</acronym
> ou <acronym
>TV</acronym
>/<acronym
>caméra</acronym
>. </para>
<para
>La documentation de &kappname; n'était pas finie quand &kde; fut installé sur cet ordinateur.</para
> <para
>Si vous avez besoin, veuillez regarder sur le <ulink url="http://www.kde.org"
>Site Web de KDE</ulink
> pour les mises à jour, ou pour soumettre vos questions à la <ulink url="mail to:kde-user@kde.org"
>Liste de diffusion &kde;</ulink
>.</para>
<para
><emphasis
>L'équipe de &kde;</emphasis
></para>
</chapter>
<chapter id="questionsanswersandtips">
<title
>Questions, Réponses, et Astuces</title>
<qandaset id="faq">
<title
>Foire aux questions</title>
<qandaentry>
<question>
<para
>Wine se lance lentement, pourquoi doit-il tester mon processeur en permanence.</para>
</question>
<answer>
<para
>L'interface graphique <application
>Xine</application
> pour &kmplayer;, <application
>kxineplayer</application
>, utilise <filename
>~/.xine/config2</filename
> pour sa configuration. La configuration de<application
>Xine</application
> et configurable dans la boîte de dialogue <quote
>Options Générales</quote
>|<quote
>Xine</quote
>. (Si vous changez une option ici et l'enregistrez, <filename
>~/.xine/config2</filename
> contiendra aussi quelques explications). Le test processus est lancé par l'option <computeroutput
>misc.memcpy_method</computeroutput
> au réglage <computeroutput
>probe</computeroutput
>. Pour voir quelle version de memcpy fonctionne le plus rapidement chez vous, activez <quote
>Montrer la Sortie Console</quote
> depuis le menu <quote
>Afficher</quote
> et regardez les résultats du test quand vous jouez quelque chose avec Xine. Configurez <computeroutput
>misc.memcpy_method</computeroutput
> avec la méthode prenant le moins de temps.</para>
</answer>
</qandaentry>
<qandaentry>
<question>
<para
>Avez-vous une astuce pour rendre mon CDROM moins bruyant quand je joue depuis celui-ci (non VCD ://) ?</para>
</question>
<answer>
<para
>Bien sûr, essayez la commande <command
>hdparm -E 8 /dev/cdrom</command
> en tant que route après avoir monté le périphérique. Mais assurez-vous que le lien <filename
>/dev/cdrom</filename
> pointe vers votre lecteur CDROM. </para>
</answer>
</qandaentry>
</qandaset>
</chapter>
<chapter id="credits-and-licenses">
<title
>Remerciements et licence</title>
<para
>&kmplayer; copyright 2002,2003 Koos Vriezen</para>
&underFDL; &underGPL; </chapter>
&documentation.index;
</book>
<!--
Local Variables:
mode: sgml
sgml-minimize-attributes:nil
sgml-general-insert-case:lower
sgml-indent-step:0
sgml-indent-data:nil
End:
-->

@ -0,0 +1,5 @@
EXTRA_DIST = index.docbook
KDE_LANG = it
KDE_DOCS = kmplayer

@ -0,0 +1,593 @@
<?xml version="1.0" ?>
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
<!ENTITY kmplayer '<application
>Kmplayer</application
>'>
<!ENTITY kappname "&kmplayer;"
><!-- replace kmplayer here -->
<!ENTITY package "kdeextragear-2">
<!ENTITY % addindex "IGNORE">
<!ENTITY % Italian "INCLUDE"
><!-- change language only here -->
]>
<book lang="&language;">
<bookinfo>
<title
>Manuale di &kmplayer;</title>
<authorgroup>
<author
><firstname
>Koos</firstname
> <surname
>Vriezen</surname
> <affiliation
> <address
><email
>koos dot vriezen at gmail dot com</email
></address>
</affiliation>
</author>
</authorgroup>
<othercredit role="translator"
><firstname
>Federico</firstname
><surname
>Zenith</surname
><affiliation
><address
><email
>zenith@chemeng.ntnu.no</email
></address
></affiliation
><contrib
>Quando ci sarà la documentazione, ah, allora la tradurrò...</contrib
></othercredit
>
<copyright>
<year
>2002</year>
<year
>2006</year>
<holder
>Koos Vriezen</holder>
</copyright>
<!-- Translators: put here the copyright notice of the translation -->
<!-- Put here the FDL notice. Read the explanation in fdl-notice.docbook
and in the FDL itself on how to use it. -->
<legalnotice
>&FDLNotice;</legalnotice>
<date
>2003-12-24</date>
<releaseinfo
>0.05.00</releaseinfo>
<!-- Abstract about this handbook -->
<abstract>
<para
>&kmplayer; è un'applicazione di interfaccia tra &kde; e<application
>MPlayer</application
>, <application
>Xine</application
> e <application
>GStreamer</application
>. </para>
</abstract>
<keywordset>
<keyword
>KDE</keyword>
<keyword
>kdemultimedia</keyword>
<keyword
>MPlayer</keyword>
<keyword
>konqueror</keyword>
<keyword
>video</keyword>
</keywordset>
</bookinfo>
<chapter id="introduction">
<title
>Introduzione</title>
<para
>&kmplayer; è una semplice interfaccia per <application
>MPlayer</application
>, <application
>Xine</application
> and <application
>GStreamer</application
> e <application
>FFMpeg</application
>. Puoi usarlo per vedere tutti i formati video filmati che <application
>MPlayer</application
>, <application
>Xine</application
> o <application
>GStreamer</application
> supportano, e anche vedere <acronym
>DVD</acronym
>, <acronym
>VCD</acronym
>, <acronym
>TV</acronym
> o <acronym
>telecamere</acronym
>. </para>
<para
>La documentazione di &kappname; non era pronta quando &kde; è stato installato su questo computer.</para
> <para
>Se hai bisogno di aiuto, per piacere visita <ulink url="http://www.kde.org"
>il sito web di KDE</ulink
> per aggiornamenti, o manda la tua domanda alla <ulink url="mail to:kde-user@kde.org"
>Mailing list utenti &kde;</ulink
>. </para>
<para
><emphasis
>Il gruppo di &kde;</emphasis
></para>
</chapter>
<chapter id="gui">
<title
>L'interfaccia utente</title>
<para
>La finestra dell'applicazione è composta da finestre cosiddette agganciabili. C'è sempre la finestra di vista centrale. Opzionalmente c'è anche la finestra della scaletta. Infine c'è una finestra di informazioni, che si fa vedere quando ci sono informazioni da comunicare. </para>
<section id="playlistwindow">
<title
>Finestra della scaletta</title>
<para
>La finestra della scaletta ha, al momento della stesura di questo documento, cinque categorie: gli elementi attuali, <guilabel
>Dischi ottici</guilabel
>, <guilabel
>Televisione</guilabel
> <guilabel
>Scalette persistenti</guilabel
> e <guilabel
>Più recenti</guilabel
>. Quando si fa clic sul testo di una categoria, ne saranno mostrati i contenuti. Ovviamente questi dovrebbero innanzi tutto esserci, per esempio vedi <link linkend="tvsource"
>le impostazioni della <acronym
>TV</acronym
></link
> per aggiungere la categoria <guilabel
>Televisione</guilabel
>. La categoria <guilabel
>Più recenti</guilabel
> si riempirà quando si riproducono file multimediali sul tuo computer o da un <acronym
>URL</acronym
> in rete. Questa categoria può contenere fino a 60 elementi, di cui gli ultimi 50 sono raggruppati sotto <guilabel
>Altri...</guilabel
>. </para>
<section>
<title
>Categoria delle scalette persistenti</title>
<para
>È possibile salvare le i tuoi collegamenti preferiti nel menu dei <guilabel
>Segnalibri</guilabel
>, ma sarebbero elementi singoli. Se vuoi creare un elenco di elementi da riprodurre in sequenza, dovresti usare la categoria delle <guilabel
>Scalette persistenti</guilabel
>. </para>
<para
>Il modo più semplice di aggiungere un elemento in questo elenco è trascinarlo da <guilabel
>Più recenti</guilabel
> in <guilabel
>Scalette persistenti</guilabel
>. Come vedrai, quando lo metti lì, appare un menu a comparsa dove puoi scegliere di aggiungerlo alla scaletta o creare un nuovo gruppo. Gli elementi di massimo livello si comportano come dei segnalibri, ma gli elementi nei gruppi leggeranno tutto il gruppo in cui si trovano. Gli elementi di questa categoria si possono facilmente spostare, copiare, aggiungere a un nuovo gruppo o eliminare solo trascinandoli in un altro posto. Inoltre ci sono i comandi <guimenu
>Elimina elemento</guimenu
>, <guimenu
>Sposta in alto</guimenu
>, <guimenu
>Sposta in basso</guimenu
> nel menu contestuale (che si ottiene facendo clic destro su un elemento). </para>
<para
>Ovviamente puoi aggiungere gruppi ad altri gruppi per avere una gerarchia ramificata. Quando fai clic su un elemento, il suo gruppo e tutti i suoi gruppi figli saranno copiati nella categoria attuale, e la lettura comincerà dalla posizione dell'elemento su cui si è fatto clic. </para>
<section>
<title
>Formato di memorizzazione</title>
<para
>I dati sono memorizzati in <filename
>~/.kde/share/apps/kmplayer/playlist.xml</filename
>, e il suo formato è come un questo esempio. Vedi <link linkend="XML-editing"
>qui</link
> per sapere come manipolare i dati direttamente. <programlisting>
&lt;playlist&gt;
&lt;group title="feeds"&gt;
&lt;item url="http://www.lugradio.org/episodes.rss"/&gt;
&lt;item url="http://science.nasa.gov/podcast.xml"/&gt;
&lt;item url="http://www.theworld.org/rss/tech.xml"/&gt;
&lt;/group&gt;
&lt;group title="iradio"&gt;
&lt;group title="sunny"&gt;
&lt;item mplayeropts="-cache 256" url="http://www.swissgroove.ch/listen.m3u"/&gt;
&lt;item url="http://www.boombasticradio.com/shoutcast/64.pls"/&gt;
&lt;/group&gt;
&lt;group title="rainy"&gt;
&lt;item url="http://www.radioparadise.com/musiclinks/rp_64.m3u"/&gt;
&lt;item url="http://www.woxy.com/stream/wma64.asx"/&gt;
&lt;item url="http://radionigel.com/winmedia.asx"/&gt;
&lt;item url="rtsp://livestreams.omroep.nl/live/vpro/vpro3voor12radioalt.rm"/&gt;
&lt;/group&gt;
&lt;/group&gt;
&lt;/playlist&gt;
</programlisting
> Nota anche che per <application
>MPlayer</application
> si possono impostare delle opzioni personalizzane usando l'argomento <computeroutput
>mplayeropts</computeroutput
>. &kmplayer; cerca questa opzione andando in alto nell'albero, quindi puoi impostarla per un intero gruppo sostituendo le impostazioni di un gruppo o elemento figlio. </para>
</section>
</section>
</section>
<section id="XML-editing">
<title
>Modifica diretta dei file XML</title>
<para
>Le categorie attuali, <guilabel
>Televisione</guilabel
> e <guilabel
>Scalette persistenti</guilabel
> possono essere manipolate anche modificando il loro file <acronym
>XML</acronym
> associato. Ovviamente lo si può fare quando &kmplayer; non è in esecuzione e non sta modificando i vari file in <filename
>~/.kde/share/apps/kmplayer/</filename
>, ma anche dall'applicazione. Basta fare clic sull'etichetta di una categoria, scegliere <guimenu
>Visualizza</guimenu
> e poi <guimenu
>Modalità di modifica</guimenu
>. Puoi anche fare clic su un ramo figlio, e allora vedrai solo i contenuti <acronym
>XML</acronym
> del ramo. </para>
<para
>Dopo che hai modificato l'<acronym
>XML</acronym
>, fai clic su <guilabel
>Sincronizza con scaletta</guilabel
> e deseleziona la <guimenu
>Modalità di modifica</guimenu
> o fai clic su un'altra categoria. <caution
><para
>Tutte le modifiche vengono perse se lasci la modalità di modifica o selezioni un'altro ramo senza sincronizzare con la scaletta. </para
></caution>
</para>
<para
>A causa della pigrizia dell'autore di &kmplayer;, alcune funzionalità si possono abilitare solo attraverso modifiche del codice <acronym
>XML</acronym
>. </para>
</section>
</chapter>
<chapter id="settings">
<title
>Impostazioni</title>
<section>
<title
>Animazione introduttiva e di uscita</title>
<para
>È possibile disattivare l'animazione di avvio e di uscita modificando <filename
>~/.kde/share/config/kmplayerrc</filename
> e cambiando <programlisting>
[General Options]
No Intro=0
</programlisting
> questa opzione a '1'. Se l'opzione non c'è, basta aggiungerla. </para>
<para
>È anche possibile impostare un'animazione alternativa. KMPlayer cercherà rispettivamente <filename
>~/.kde/share/apps/kmplayer/intro.xml</filename
> e <filename
>~/.kde/share/apps/kmplayer/exit.xml</filename
>. Il formato deve essere un file <acronym
>XML</acronym
> supportato. </para>
<para
>L'animazione di avvio non deve essere breve, perché terminerà automaticamente quando viene aperta un'altra sorgente. Ovviamente ciò sarebbe un po' fastidioso per l'animazione di uscita, ma l'utente può sempre terminare l'applicazione due volte. </para>
<para
>Un semplice esempio di introduzione, che mostra le tue foto preferite, potrebbe essere: <programlisting>
&lt;smil&gt;
&lt;body&gt;
&lt;img dur="indefinite" src="file:///home/pippo/mamma.png" fit="meet"/&gt;
&lt;/body&gt;
&lt;/smil&gt;
</programlisting
>Nel pacchetto sorgente di KMPlayer, nella cartella <filename
>tests/</filename
>, ci sono degli esempi di <acronym
>SMIL</acronym
> supportati da KMPlayer. </para>
</section>
</chapter>
<chapter id="backends">
<title
>I lettori</title>
<para
>&kmplayer; usa dei programmi esterni per la lettura dei file. </para>
<section id="mplayer">
<title
>MPlayer</title>
<para
>C'è una scheda di configurazione per MPlayer nella finestra di configurazione di &kmplayer;. Qui puoi impostare il percorso di MPlayer e le dimensioni della sua cache per i flussi di rete, tra le altre cose. </para>
<section id="mplayer-debug">
<title
>Risoluzione dei problemi</title>
<para
>Il modo migliore di risolvere i problemi legati a questo lettore è avviare &kmplayer; da una console. Avvia un filmato con &kmplayer; e guarda la riga di comando esatta che viene usata per avviare MPlayer nella console. Ora copia e incolla in un'altra console, rimuovi le o opzioni '-wid 12344', e fallo partire. Probabilmente si tratta solo di scegliere i parametri giusti per -ao/-vo. Assicurati anche che MPlayer non parta con un'interfaccia grafica. </para>
<para
>Un altro strumento per risolvere i problemi è il pulsante <guilabel
>Console</guilabel
> nella barra degli strumenti di &kmplayer;. Qui puoi vedere l'output di MPlayer. </para>
</section>
</section>
<section id="xine">
<title
>Xine</title>
<para
>Quando &kmplayer; è configurato per supportare Xine, ci sarà una scheda relativa per la configurazione di Xine nella finestra di configurazione di &kmplayer;. Qui puoi impostare varie opzioni. Queste sono recuperate dinamicamente dalla libreria di Xine. Usa l'aiuto contestuale per avere informazioni su cosa fanno le opzioni (cioè fai clic sul punto interrogativo sulla barra del titolo della finestra e fai clic su un'opzione). </para>
<para
>Le opzioni vengono salvate in <filename
>.kde/share/apps/kmplayer/xine_config</filename
> come file di testo. </para>
<section id="xine-debug">
<title
>Risoluzione dei problemi</title>
<para
>Fondamentalmente la risoluzione dei problemi funziona come per <link linkend="mplayer-debug"
>MPlayer</link
>, con il nome di applicazione <filename
>kxineplayer</filename
>. </para>
</section>
</section>
<section id="gstreamer">
<title
>GStreamer</title>
<para
>Non c'è nessuna scheda di configurazione per GStreamer nella finestra di configurazione di &kmplayer;. Le opzioni comuni per i dispositivi come i <acronym
>DVD</acronym
> vengono usate secondo opportunità. </para>
<section id="gstremaer-debug">
<title
>Risoluzione dei problemi</title>
<para
>Fondamentalmente la risoluzione dei problemi funziona come per <link linkend="mplayer-debug"
>MPlayer</link
>, con il nome di applicazione <filename
>kgstplayer</filename
>. </para>
</section>
</section>
</chapter>
<chapter id="sources">
<title
>Le sorgenti riproducibili</title>
<para
>&kmplayer; può riprodurre diverse sorgenti. Queste sono elencate nel menu Sorgente. </para>
<section id="tvsource">
<title
>TV</title>
<para
>&kmplayer; può usare le schede TV usando <application
>MPlayer</application
> o <acronym
>XVideo</acronym
> (usando <application
>kxvplayer</application
>). Prima di poter vedere la TV, devi configurare quale dispositivo usare e i canali televisivi. Puoi usare il programma di scansione dalla finestra di configurazione, oppure puoi configurare il file manualmente. </para>
<para
>Il file di configurazione per le impostazioni della TV è un file <acronym
>XML</acronym
>, posizionato a <filename
>~/.kde/share/apps/kmplayer/tv.xml</filename
>. Vedi <link linkend="XML-editing"
>qui</link
> per la manipolazione diretta di questi dati. Il formato <acronym
>XML</acronym
> è come in questo esempio: <programlisting>
&lt;tvdevices&gt;
&lt;device path="/dev/video0" width="320" height="240" name="BT878 video (Hauppauge (bt878))" audio=""
minwidth="48" minheight="32" maxwidth="924" maxheight="576" playback="0" xvport="240"&gt;
&lt;input name="Television" id="0" tuner="1" norm="PAL" xvenc="0"&gt;
&lt;channel name="Ned1" frequency="21600"/&gt;
&lt;channel name="VCR" frequency="59490"/&gt;
&lt;/input&gt;
&lt;input name="Composite1" id="1" xvenc="7"/&gt;
&lt;input name="S-Video" id="2" xvenc="14"/&gt;
&lt;input name="Composite3" id="3"/&gt;
&lt;/device&gt;
&lt;device path="/dev/video1" width="640" height="480" name="Philips 740 webcam" audio=""
minwidth="160" minheight="120" maxwidth="640" maxheight="480" playback="1"&gt;
&lt;input name="Webcam" id="0"/&gt;
&lt;/device&gt;
&lt;/tvdevices&gt;
</programlisting
> Nota che gli elementi <quote
>input</quote
> con dei canali dovrebbero avere l'attributo <quote
>tuner</quote
> impostato a <quote
>1</quote
>. </para>
<para
><acronym
>XVideo</acronym
> usa solo gli attributi <quote
>xvport</quote
> e <quote
>xvenc</quote
>, e possono essere impostati manualmente solo modificando questo file. I valori di questi attributi possono essere recuperati usando <quote
>kxvplayer</quote
> in un'applicazione di terminale come &konsole;. Per ogni porta, <quote
>kxvplayer</quote
> scriverà delle righe come le seguenti, e si possono impostare i numeri per gli attributi di cui si è parlato. <programlisting>
xvport 240
....
encoding: 0 PAL-television
encoding: 1 NTSC-television
encoding: 2 SECAM-television
....
</programlisting
> Anche gli attributi di altezza e larghezza sono ignorati dal lettore <acronym
>XVideo</acronym
>. Questo lettore ottiene le dimensioni dal server X. Una delle cose carine di <acronym
>XVideo</acronym
> è che la scala è fatta dall'hardware, dalla scheda video, quindi è possibile avere il supporto a schermo intero senza uso di CPU e senza cambio di risoluzione del tuo monitor. Inoltre, non ci sarà un noioso sfarfallio quando un'altra finestra si sovrapporrà a questa finestra video. </para>
<para
>Vedi la sezione VDR per maggiori informazioni sull'uso di <acronym
>XVideo</acronym
>. </para>
</section>
<section id="vdrsource">
<title
>VDR</title>
<para
>Per configurare le tue impostazioni VDR in kmplayer, vedi il pannello Configura pannello->Sorgente->VDR->Porta XVideo. Ci dovrebbero essere le porte rilevate, tra cui dovresti sceglierne una. Devi decidere quale codifica usare (per esempio PAL per l'europa occidentale), e probabilmente quella giusta ha un nome contenente <quote
>dvb</quote
>. </para>
<para
>Per esempio, io ho una scheda TV, una scheda DVB-S e una webcam nel mio sistema. Con questi, ho tre porte nelle mie impostazioni. La prima è un lungo elenco di voci NTSC(-JP)/PAL(-M)/SECAM, tutte riguardo a un television/composite/svideo (la mia scheda TV). La seconda contiene NTSC-dvb/PAL-dvb/SECAM-dvb (la mia scheda DVB-S). Infine, la terza contiene solo ntsc/pal (probabilmente la mia webcam). Quindi dovrei configurare la seconda porta (basta selezionarla) e la seconda voce (PAL-dvb). </para>
<para
>Siccome il supporto VDR di &kmplayer; può usare solo <acronym
>XVideo</acronym
>, <acronym
>XVideo</acronym
> deve ovviamente funzionare (credo che per i dispositivi video, questo modo di visualizzazione funzioni solo in Linux). Ciò funziona solo sul tuo primo schermo (:0.0). Perciò assicurati che l'estensione <quote
>videoforlinux</quote
> funzioni nel server X. Per il server XFree86, nel suo file di configurazione (<filename
>/etc/X11/XF86Config</filename
>), dovrebbe esserci <programlisting
>Section "Module"
....
Load "v4l"
EndSection
</programlisting>
</para>
<para
>Sfortunatamente, quando aggiorni il tuo driver video, devi riconfigurare questa impostazione. </para>
</section>
<section id="kmplayer_url">
<title
>Riga di comando</title>
<para
>Internamente, KMPlayer usa diversi nomi per le sorgenti. Al momento della scrittura questi erano "dvdnavsource", "dvdsource", "exitsource", "hrefsource", "introsource", "pipesource", "tvscanner", "tvsource", "urlsource", "vcdsource" e "vdrsource". Quando attivi, cominciano a riprodurre l'elenco di elementi riproducibili. </para>
<para
>Puoi attivare una sorgente particolare con un <acronym
>URL</acronym
> di tipo <filename
>kmplayer://</filename
>. Basta impostare la parte host come il nome della sorgente e la parte del percorso opzionale come argomenti aggiuntivi; quindi per un canale per "vdrsource" potrebbe essere: <filename
>kmplayer://vdrsource/22 MTV 2</filename
>. Per esempio, questo script avvia KMPlayer usando "dvdnavsource" e usando <acronym
>DCOP</acronym
> per riprodurre a schermo intero.<programlisting>
/bin/bash
kmplayer kmplayer://dvdnavsource/ &amp;
PID=$!
sleep 2
dcop kmplayer-$PID KMediaPlayer toggleFullScreen
</programlisting
>Per alcune sorgenti ciò non farà molto, perché non sono fatte per la riproduzione normale. Per "pipesource" questo è disattivato perché sarebbe una pericolosa falla nella sicurezza. </para>
</section>
</chapter>
<chapter id="questionsanswersandtips">
<title
>Domande, risposte e suggerimenti</title>
<qandaset id="faq">
<title
>Domande frequenti</title>
<qandaentry>
<question>
<para
>Xine si avvia lentamente, perché deve fare benchmark della mia CPU in continuazione?</para>
</question>
<answer>
<para
>Nota che la risposta sotto è obsoleta. <application
>kxineplayer</application
> salva automaticamente l'ultimo valore, quindi solo xine farà il test della CPU solo la prima volta. </para>
<para
>L'interfaccia di &kmplayer; per <application
>Xine</application
>, <application
>kxineplayer</application
>, usa <filename
>~/.kde/share/apps/kmplayer/xine_config</filename
> per la sua configurazione. Le impostazioni di <application
>Xine</application
> si trovano nella finestra di configurazione <quote
>Opzioni generali</quote
>|<quote
>Xine</quote
> (Se cambi un'opzione qui e la salvi, anche <filename
>~/.kde/share/apps/kmplayer/xine_config</filename
> conterrà delle spiegazioni). Il benchmarking della CPU è causato dall'opzione <computeroutput
>misc.memcpy_method</computeroutput
> impostata a <computeroutput
>probe</computeroutput
>. Per vedere quale versione di memcpy funziona più velocemente per te, attiva <quote
>Mostra output della console</quote
> dal menu <quote
>Visualizza</quote
>, e guarda i risultati di questo benchmark quando riproduci qualcosa con Xine. Configura <computeroutput
>misc.memcpy_method</computeroutput
> con il metodo con il tempo più basso.</para>
</answer>
</qandaentry>
<qandaentry>
<question>
<para
>Ci sono trucchi per rendere il mio CDROM meno rumoroso quando sto riproducendo qualcosa (non VCD://)?</para>
</question>
<answer>
<para
>Certo, prova <command
>hdparm -E 8 /dev/cdrom</command
> come root dopo aver montato il dispositivo. Assicurati di controllare bene che <filename
>/dev/cdrom</filename
> punti al tuo dispositivo CDROM. </para>
</answer>
</qandaentry>
</qandaset>
</chapter>
<chapter id="credits-and-licenses">
<title
>Riconoscimenti e licenza</title>
<para
>&kmplayer; copyright 2002,2003 Koos Vriezen</para>
&underFDL; &underGPL; </chapter>
&documentation.index;
</book>
<!--
Local Variables:
mode: sgml
sgml-minimize-attributes:nil
sgml-general-insert-case:lower
sgml-indent-step:0
sgml-indent-data:nil
End:
-->

@ -0,0 +1,5 @@
EXTRA_DIST = index.docbook
KDE_LANG = nl
KDE_DOCS = kmplayer

@ -0,0 +1,386 @@
<?xml version="1.0" ?>
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
<!ENTITY kmplayer '<application
>Kmplayer</application
>'>
<!ENTITY kappname "&kmplayer;"
><!-- replace kmplayer here -->
<!ENTITY package "kdeextragear-2">
<!ENTITY % addindex "IGNORE">
<!ENTITY % Dutch "INCLUDE"
><!-- change language only here -->
]>
<book lang="&language;">
<bookinfo>
<title
>Het handboek van &kmplayer;</title>
<authorgroup>
<author
><firstname
>Koos</firstname
> <surname
>Vriezen</surname
> <affiliation
> <address
><email
>koos dot vriezen at xs4all dot nl</email
></address>
</affiliation>
</author>
</authorgroup>
&Rinse.Devries;
<copyright>
<year
>2002</year>
<year
>2003</year>
<holder
>Koos Vriezen</holder>
</copyright>
<!-- Translators: put here the copyright notice of the translation -->
<!-- Put here the FDL notice. Read the explanation in fdl-notice.docbook
and in the FDL itself on how to use it. -->
<legalnotice
>&FDLNotice;</legalnotice>
<date
>2003-12-24</date>
<releaseinfo
>0.05.00</releaseinfo>
<!-- Abstract about this handbook -->
<abstract>
<para
>&kmplayer; is een grafische schil voor <application
>MPlayer</application
>, geschreven voor &kde;. </para>
</abstract>
<keywordset>
<keyword
>KDE</keyword>
<keyword
>kdemultimedia</keyword>
<keyword
>MPlayer</keyword>
<keyword
>konqueror</keyword>
<keyword
>video</keyword>
</keywordset>
</bookinfo>
<chapter id="introduction">
<title
>Inleiding</title>
<para
>&kmplayer; is een eenvoudige schil voor <application
>Mplayer</application
>, <application
>Xine</application
> en <application
>FFMpeg</application
>. U kunt het gebruiken voor het bekijken van alle videoformaten die <application
>MPlayer</application
> en <application
>Xine</application
> ondersteunen, waaronder <acronym
>DVD</acronym
>, <acronym
>VCD</acronym
> of <acronym
>TV</acronym
>/camera. </para>
<para
>De documentatie voor &kappname; was nog niet af toen &kde; op deze computer werd geïnstalleerd.</para
> <para
>Als u hulp nodig hebt, kijk dan op de <ulink url="http://www.kde.org"
>website van KDE</ulink
> voor nieuwe versies, of stel uw vraag op de <ulink url="mailto:kde-user@kde.org"
>KDE-mailinglist</ulink
>.</para>
<para
><emphasis
>Het &kde;-team</emphasis
></para>
</chapter>
<chapter id="settings">
<title
>Instellingen</title>
<section>
<title
>Intro/afsluit animatie</title>
<para
>U kunt de animatie bij het opstarten/afsluiten an het programma instellen door het bestand <filename
>~/.kde/share/config/kmplayerrc</filename
> te bewerken. Wijzig onderstaande optie in '1' <programlisting>
[General Options]
No Intro=0
</programlisting
> Of voeg deze optie toe als hij er nog iet bij staat. </para>
<para
>Het is ook mogelijk om een alternatieve animatie op te geven. KMPlayer zoekt respectievelijk in <filename
>~/.kde/share/apps/kmplayer/intro.xml</filename
> en <filename
>~/.kde/share/apps/kmplayer/exit.xml</filename
>. Het bestand dient te zijn opgemaakt in ondersteunde <acronym
>XML</acronym
>. </para>
<para
>De intro-animatie hoeft niet kort te zijn omdat hij automatisch zal worden beëindigd als er een andere bron wordt geopend. Een lange afsluitanimatie is uiteraard hinderlijk, maar de gebruiker kan altijd het programma tweemaal afsluiten. </para>
<para
>Een eenvoudig voorbeeld van een intro die uw favoriete foto toont: <programlisting>
&lt;smil&gt;
&lt;body&gt;
&lt;img dur="indefinite" src="file:///home/koos/mams.gif" fit="meet"/&gt;
&lt;/body&gt;
&lt;/smil&gt;
</programlisting
> In het broncodepakket van KMPlayer vindt u in de map <filename
>tests/</filename
> enkele voorbeelden van <acronym
>SMIL</acronym
> die KMPlayer ondersteunt. </para>
</section>
</chapter>
<chapter id="sources">
<title
>De afspeelbare bronnen</title>
<para
>&kmplayer; kan vanuit vele bronnen afspelen. Deze bronnen staan in het Bron-menu. </para>
<section id="tvsource">
<title
>TV</title>
<para
>&kmplayer; kan tv-programma's van de tv-kaar spelen met behulp van <application
>MPlayer</application
> of <acronym
>XVideo</acronym
> (met behulp van <application
>kxvplayer</application
>). Voordat u kunt tv kijken dient u eerst het te gebruiken apparaat in te stellen en de tv-kanalen. U kunt de scanner uit de instellingendialoog hiervoor gebruiken, of het configuratiebestand handmatig bewerken. </para>
<para
>Het configuratiebestand voor de tv-instellingen is opgemaakt in <acronym
>XML</acronym
> en bevindt zich op <filename
>~/.kde/share/apps/kmplayer/tv.xml</filename
>. Het <acronym
>XML</acronym
>-formaat is zoals in dit voorbeeld: <programlisting>
&lt;tvdevices&gt;
&lt;device path="/dev/video0" width="320" height="240" name="BT878 video (Hauppauge (bt878))" audio=""
minwidth="48" minheight="32" maxwidth="924" maxheight="576" playback="0" xvport="240"&gt;
&lt;input name="Television" id="0" tuner="1" norm="PAL" xvenc="0"&gt;
&lt;channel name="Ned1" frequency="21600"/&gt;
&lt;channel name="VCR" frequency="59490"/&gt;
&lt;/input&gt;
&lt;input name="Composite1" id="1" xvenc="7"/&gt;
&lt;input name="S-Video" id="2" xvenc="14"/&gt;
&lt;input name="Composite3" id="3"/&gt;
&lt;/device&gt;
&lt;device path="/dev/video1" width="640" height="480" name="Philips 740 webcam" audio=""
minwidth="160" minheight="120" maxwidth="640" maxheight="480" playback="1"&gt;
&lt;input name="Webcam" id="0"/&gt;
&lt;/device&gt;
&lt;/tvdevices&gt;
</programlisting
> Merk op dat bij de elementen <quote
>input</quote
> die kanalen bevatten het attribuut <quote
>tuner</quote
> op <quote
>1</quote
> gezet moeten zijn. </para>
<para
><acronym
>XVideo</acronym
> gebruikt alleen de attributen <quote
>xvport</quote
> en <quote
>xvenx</quote
>. Ze kunnen alleen handmatig in dit bestand worden gezet. De waarden van deze twee attributen kunnen worden verkregen door <quote
>kxvplayer</quote
> in een terminalprogramam als <quote
>konsole</quote
> te draaien. Voor elke poort zal <quote
>kvplayer</quote
> uitvoerregels zoals hieronder produceren en de getallen voor de attributen kunnen zoals eerder genoemd worden ingesteld. <programlisting>
xvport 240
....
encoding: 0 PAL-television
encoding: 1 NTSC-television
encoding: 2 SECAM-television
....
</programlisting
> De <acronym
>XVideo</acronym
>-speler negeert ook de attributen widht en height. Deze speler krijgt de afmetingen van de X-server. Een van de aardigheden vn <acronym
>XVideo</acronym
> is dat het schalen door de hardware, de videokaart, wordt gedaan, dus ondesteuning voor volledig-scherm-weergave zonder processorgebruik en zonder resolutiewijzing van uw monitor. Bovendien geen hinderlijk geflikker als een ander venster dit videovenster overlapt. </para>
<para
>Zie de VDR-sectie voor meer informatie over het gebruik van <acronym
>XVideo</acronym
>. </para>
</section>
<section id="vdrsource">
<title
>VDR</title>
<para
>Voor het instellen van de VDR-instellingen van kmplayer gaat u naar <quote
>Instellingen ->KMplayer instellen</quote
>, sectie <quote
>Bron</quote
>, tabblad <quote
>VDR</quote
>. Als het goed is zijn er poorten gedetecteerd waaruit u een kunt kiezen. U dient uit te vogelen welke codering u moet gebruiken (voor West-Europa is dat PAL), de juiste heeft waarschijnlijk een naam met <quote
>dvb</quote
> erin. </para>
<para
>Bijvoorbeeld, ik heb een tv-kaart, een DVB-S-kaart en een webcam op mijn computer aangesloten. Met deze configuratie zitten er 3 poorten bij mijn instellingen. De eerste heeft een lange lijst met items als NTSC(-JP)/PAL(-M)/SECAM en zeggen allen iets over television/composite/svideo (mijn tv-kaart). De tweede heeft NTSC-dvb/PAL-dvb/SECAM-dvb (mijn DVB-S-kaart). En tot slot de laatste heeft alleen ntsc/pal (waarschijnlijk mijn webcam). Ik moet dus de tweede poort instellen (gewoon selecteren) en het tweede item (PAL-dvb) kiezen. </para>
<para
>Omdat VDR-ondersteuning van kmplayer alleen <acronym
>XVideo</acronym
> kan gebruiken dient <acronym
>XVideo</acronym
> uiteraard te werken (en ik geloof dat voor video-apparaten alleen deze manier van weergeven in Linux werkt). Dit werkt bovendien alleen voor de eerste display (:0.0). Zorg er dus voor dat de <quote
>videoforlinux</quote
>-extensie werkt met de X-server. Voor deXFree86-server moet daarom het volgende in het configuratiebestand (<filename
>/etc/X11/XF86Config</filename
>) staan: <programlisting
>Section "Module"
....
Load "v4l"
EndSection
</programlisting>
</para>
<para
>Helaas dient u deze instelling opnieuw toe te voegen als u het stuurprogramma van uw videokaart opwaardeert. </para>
</section>
<section id="kmplayer_url">
<title
>Commandoregel</title>
<para
>Intern gebruikt KMPlayer aparte namen voor de bronnen. Op het moment dat dit document is geschreven waren dat "dvdnavsource", "dvdsource", "exitsource", "hrefsource", "introsource", "pipesource", "tvscanner", "tvsource", "urlsource", "vcdsource" en "vdrsource". Wanneer geactiveerd beginnen ze in de meeste gevallen met het afspelen van de lijst met afspeelbare items. </para>
<para
>U kunt een specifieke bron activeren met een <filename
>kmplayer://</filename
> <acronym
>URL</acronym
>-adres. Zet het hostgedeelte als bronnaam en het optionele gedeelte als extra argumenten. Dus voor een kanaal voor de "vdrsource" ziet dit er uit als <filename
>kmplayer://vdrsource/22 MTV 2</filename
>. Bijv. dit script start kmplayer met "dvdnavsource" en gebruikt &DCOP; om op volledig scherm af te spelen:<programlisting>
/bin/bash
kmplayer kmplayer://dvdnavsource/ &amp;
PID=$!
sleep 2
dcop kmplayer-$PID KMediaPlayer toggleFullScreen
</programlisting
> Bij sommige bronnen doet dit niet veel omdat ze niet bedoeld zijn voor normaal afspelen. voor "pipesource" is dit uitgeschakeld omdat het anders een flink beveiligingsgat zou veroorzaken. </para>
</section>
</chapter>
<chapter id="questionsanswersandtips">
<title
>Vragen, antwoorden en tips</title>
<qandaset id="faq">
<title
>Veel voorkomende vragen</title>
<qandaentry>
<question>
<para
>Xine start traag op, waarom voert het telkens een CPU-benchmark uit?</para>
</question>
<answer>
<para
>Merk op dat onderstaand antwoord verouderd is. <application
>kxineplayer</application
> slaat de laatste waarde automatisch op, zodat de CPU-test alleen de eerste keer zal worden uitgevoerd. </para>
<para
>De <application
>Xine</application
>-schil voor &kmplayer;, <application
>kxineplayer</application
>, gebruikt het bestand <filename
>~/.kde/share/apps/kmplayer/xine_config</filename
> voor diens configuratie. De instellingen voor <application
>Xine</application
> staan in de configuratiedialoog <quote
>Algemene opties</quote
>|<quote
>Xine</quote
>. (Als u daar een optie wijzigt en opslaat, dan zal het bestand <filename
>~/.kde/share/apps/kmplayer/xine_config</filename
> ook enige uitleg bevatten.) De CPU-benchmarking wordt veroorzaakt door de optie <computeroutput
>misc.memcpy_method</computeroutput
> die is gezet op <computeroutput
>probe</computeroutput
>. Om na te gaan welke memcpy-versie het snelst is voor u, activeer de optie <quote
>Console-uitvoer tonen</quote
> in het menu <quote
>Beeld</quote
> en bekijk de resultaten van deze benchmarking als u iets met Xine afspeelt. Stel de optie <computeroutput
>misc.memcpy_method</computeroutput
> in met de methode met de laagste tijd.</para>
</answer>
</qandaentry>
<qandaentry>
<question>
<para
>Enige tips om mijn CD-ROM stiller te maken als er een film wordt afgespeeld (niet VCD://)?</para>
</question>
<answer>
<para
>Zeker, probeer commando <command
>hdparm -E 8 /dev/cdrom</command
> als root nadat het station is aangekoppeld (mount), waarbij <filename
>/dev/cdrom</filename
> naar uw CD-ROM-staton verwijst. </para>
</answer>
</qandaentry>
</qandaset>
</chapter>
<chapter id="credits-and-licenses">
<title
>Dankbetuigingen en licenties</title>
<para
>&kmplayer; copyright 2002,2003 Koos Vriezen</para>
&underFDL; &underGPL; &meld.fouten; &vertaling.rinse; </chapter>
&documentation.index;
</book>
<!--
Local Variables:
mode: sgml
sgml-minimize-attributes:nil
sgml-general-insert-case:lower
sgml-indent-step:0
sgml-indent-data:nil
End:
-->

@ -0,0 +1,5 @@
EXTRA_DIST = index.docbook
KDE_LANG = pt
KDE_DOCS = kmplayer

@ -0,0 +1,593 @@
<?xml version="1.0" ?>
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
<!ENTITY kmplayer '<application
>Kmplayer</application
>'>
<!ENTITY kappname "&kmplayer;"
><!-- replace kmplayer here -->
<!ENTITY package "kdeextragear-2">
<!ENTITY % addindex "IGNORE">
<!ENTITY % Portuguese "INCLUDE"
><!-- change language only here -->
]>
<book lang="&language;">
<bookinfo>
<title
>O Manual do &kmplayer;</title>
<authorgroup>
<author
><firstname
>Koos</firstname
> <surname
>Vriezen</surname
> <affiliation
> <address
><email
>koos dot vriezen at gmail dot com</email
></address>
</affiliation>
</author>
</authorgroup>
<othercredit role="translator"
><firstname
>Pedro</firstname
><surname
>Morais</surname
><affiliation
><address
><email
>morais@kde.org</email
></address
></affiliation
><contrib
>Tradução</contrib
></othercredit
>
<copyright>
<year
>2002</year>
<year
>2006</year>
<holder
>Koos Vriezen</holder>
</copyright>
<!-- Translators: put here the copyright notice of the translation -->
<!-- Put here the FDL notice. Read the explanation in fdl-notice.docbook
and in the FDL itself on how to use it. -->
<legalnotice
>&FDLNotice;</legalnotice>
<date
>2003-12-24</date>
<releaseinfo
>0.05.00</releaseinfo>
<!-- Abstract about this handbook -->
<abstract>
<para
>O &kmplayer; é uma interface &kde; para o <application
>MPlayer</application
>, o <application
>Xine</application
> e o <application
>GStreamer</application
>. </para>
</abstract>
<keywordset>
<keyword
>KDE</keyword>
<keyword
>kdemultimedia</keyword>
<keyword
>MPlayer</keyword>
<keyword
>konqueror</keyword>
<keyword
>vídeo</keyword>
</keywordset>
</bookinfo>
<chapter id="introduction">
<title
>Introdução</title>
<para
>O &kmplayer; é uma interface simples para o <application
>MPlayer</application
>, o <application
>Xine</application
>, o <application
>GStreamer</application
> e o <application
>FFMpeg</application
>. Você poderá usá-lo para ver todos os tipos de formatos de ficheiros que o <application
>MPlayer</application
>, o <application
>Xine</application
> ou o <application
>GStreamer</application
> suportam, assim como ver <acronym
>DVD</acronym
>s, <acronym
>VCD</acronym
> ou <acronym
>TV</acronym
>/<acronym
>vídeo</acronym
>. </para>
<para
>A documentação do &kappname; não estava terminada quando o &kde; foi instalado neste computador.</para
> <para
>Se necessitar de ajuda, procure na <ulink url="http://www.kde.org"
>Página do KDE</ulink
> actualizações, ou envie perguntas para <ulink url="mail to:kde-user@kde.org"
>A Lista de E-mail dos Utilizadores do &kde;</ulink
>. </para>
<para
><emphasis
>A Equipa do &kde;</emphasis
></para>
</chapter>
<chapter id="gui">
<title
>A interface do utilizador</title>
<para
>A janela da aplicação é composta por janelas acopláveis. Existe sempre a janela central. Uma janela opcional é a janela da lista de reprodução. Finalmente, existe uma janela de informação, que aparece simplesmente quando existe alguma informação para ser apresentada. </para>
<section id="playlistwindow">
<title
>Janela da lista de reprodução</title>
<para
>A janela da lista de reprodução tem, na altura em que este documento foi escrito, cinco categorias, sendo os itens actuais, os <guilabel
>Discos Ópticos</guilabel
>, a <guilabel
>Televisão</guilabel
>, as <guilabel
>Listas Persistentes</guilabel
> e o <guilabel
>Mais Recente</guilabel
>. Quando carregar no texto de uma categoria, o mesmo irá mostrar os conteúdos por baixo desta linha. Obviamente, terão de existir conteúdos; p.ex., veja a <link linkend="tvsource"
>configuração da <acronym
>TV</acronym
></link
> para adicionar conteúdos à categoria <guilabel
>Television</guilabel
> (Televisão). A categoria <guilabel
>Mais Recente</guilabel
> preencher-se-á à medida que vão sendo tocados ficheiros multimédia locais ou <acronym
>URL</acronym
>s remotos. Esta categoria poderá conter 60 itens, dos quais os últimos 50 se encontram no ramo <guilabel
>Mais ..</guilabel
>. </para>
<section>
<title
>Categoria das Listas Persistentes</title>
<para
>É possível gravar as suas referências favoritas no menu <guilabel
>Favorito</guilabel
>, mas estes são itens únicos. Se quiser criar uma lista de itens que sejam reproduzidos uns atrás dos outros, então deverá usar a categoria de <guilabel
>Listas Persistentes</guilabel
>. </para>
<para
>A forma mais simples de adicionar um item nesta lista é arrastá-la da categoria <guilabel
>Mais Recente</guilabel
> e largá-la nas <guilabel
>Listas Persistentes</guilabel
>. Como poderá ver, ao largar os itens, irá aparecer um menu onde poderá escolher entre adicionar a esta lista ou criar um grupo novo. Os itens do nível de topo comportam-se como um item de favorito, mas os itens nos grupos irão tocar o grupo inteiro onde residem. Os itens desta categoria poderão ser movidos, copiados, adicionados a um novo grupo ou removidos facilmente, bastando para tal arrastar este item para outro local nesta categoria. Para além disso, existem os itens <guimenu
>Apagar o item</guimenu
>, <guimenu
>Subir</guimenu
> e <guimenu
>Descer</guimenu
> no menu de contexto (ao carregar com o botão direito do rato num item). </para>
<para
>Como é óbvio, poderá adicionar grupos aos grupos, para obter uma hierarquia mais profunda. Quando carregar num item, o seu grupo e todos os grupos-filhos serão copiados para a categoria actual e a reprodução começa na posição do item seleccionado. </para>
<section>
<title
>Formato de armazenamento</title>
<para
>Os dados são gravados em <filename
>~/.kde/share/apps/kmplayer/playlist.xml</filename
> e o seu formato é semelhante ao exemplo seguinte. Veja <link linkend="XML-editing"
>aqui</link
> como manipular estes dados directamente. <programlisting>
&lt;playlist&gt;
&lt;group title="feeds"&gt;
&lt;item url="http://www.lugradio.org/episodes.rss"/&gt;
&lt;item url="http://science.nasa.gov/podcast.xml"/&gt;
&lt;item url="http://www.theworld.org/rss/tech.xml"/&gt;
&lt;/group&gt;
&lt;group title="iradio"&gt;
&lt;group title="sunny"&gt;
&lt;item mplayeropts="-cache 256" url="http://www.swissgroove.ch/listen.m3u"/&gt;
&lt;item url="http://www.boombasticradio.com/shoutcast/64.pls"/&gt;
&lt;/group&gt;
&lt;group title="rainy"&gt;
&lt;item url="http://www.radioparadise.com/musiclinks/rp_64.m3u"/&gt;
&lt;item url="http://www.woxy.com/stream/wma64.asx"/&gt;
&lt;item url="http://radionigel.com/winmedia.asx"/&gt;
&lt;item url="rtsp://livestreams.omroep.nl/live/vpro/vpro3voor12radioalt.rm"/&gt;
&lt;/group&gt;
&lt;/group&gt;
&lt;/playlist&gt;
</programlisting
> Repare também que as opções personalizadas do <application
>MPlayer</application
> podem ser definidas com o argumento <computeroutput
>mplayeropts</computeroutput
>. O &kmplayer; procura por esta opção para cima na árvore, para que a possa definir para um grupo inteiro e substituí-la por um grupo ou item-filho. </para>
</section>
</section>
</section>
<section id="XML-editing">
<title
>Edição directa do XML</title>
<para
>A categoria actual, a <guilabel
>Television</guilabel
> e a das <guilabel
>Listas Persistentes</guilabel
> poderão ser também manipuladas, se editar o seu armazenamento em <acronym
>XML</acronym
>. Obviamente, uma pessoa podê-lo-á fazer quando o &kmplayer; não estiver a correr e editar os vários ficheiros em <filename
>~/.kde/share/apps/kmplayer/</filename
>, mas também na aplicação em si. Basta carregar no texto de uma categoria, escolher <guimenu
>Ver</guimenu
> e depois <guimenu
>modo de Edição</guimenu
>. Poderá também carregar num ramo-filho, vendo apenas o conteúdo em <acronym
>XML</acronym
> desse ramo. </para>
<para
>Depois de ter editado algum <acronym
>XML</acronym
>, carregue na opção <guilabel
>Sincronizar com a lista</guilabel
> e depois desligue o item <guimenu
>modo de Edição</guimenu
> ou carregue noutra categoria. <caution
><para
>Todas as alterações serão perdidas, quando sair do modo de edição, ou seleccionar outro ramo, sem sincronizar com a lista. </para
></caution>
</para>
<para
>Devido à preguiça dos autores do &kmplayer;, algumas funcionalidades só poderão ser activadas se editar o XML. </para>
</section>
</chapter>
<chapter id="settings">
<title
>Configuração</title>
<section>
<title
>Animação no arranque/saída</title>
<para
>A desactivação da animação inicial/final poderá ser configurada se editar o ficheiro <filename
>~/.kde/share/config/kmplayerrc</filename
> e modificar <programlisting>
[General Options]
No Intro=0
</programlisting
> a opção anterior para '1'. Basta adicionar a opção se não existir no ficheiro. </para>
<para
>Também é possível definir uma animação alternativa. O KMPlayer irá ver, respectivamente, em <filename
>~/.kde/share/apps/kmplayer/intro.xml</filename
> e <filename
>~/.kde/share/apps/kmplayer/exit.xml</filename
>. O formato terá de ser um ficheiro <acronym
>XML</acronym
> suportado. </para>
<para
>A animação inicial não terá de ser reduzida, dado que irá terminar imediatamente, quando for aberto outro ficheiro. Claro que, para a animação final, isso poder-se-á tornar incómodo; contudo, o utilizador poderá terminar a aplicação duas vezes. </para>
<para
>Um exemplo simples de uma introdução que mostre a sua fotografia favorito poderá ser<programlisting>
&lt;smil&gt;
&lt;body&gt;
&lt;img dur="indefinite" src="file:///home/ze/namorada.gif" fit="meet"/&gt;
&lt;/body&gt;
&lt;/smil&gt;
</programlisting
> No pacote de código do KMPlayer, em <filename
>tests/</filename
> existem alguns exemplos de ficheiros <acronym
>SMIL</acronym
> que o KMPlayer suporta. </para>
</section>
</chapter>
<chapter id="backends">
<title
>Os leitores das infra-estruturas</title>
<para
>O &kmplayer; usa programas externos para efectuar a reprodução em si. </para>
<section id="mplayer">
<title
>MPlayer</title>
<para
>Existe uma página de configuração do MPlayer na janela de configuração do &kmplayer;. Aqui, poderá configurar a localização do MPlayer e o tamanho da sua 'cache, para as transmissões pela rede, entre outras coisas. </para>
<section id="mplayer-debug">
<title
>Resolução de problemas</title>
<para
>A melhor forma de depurar esta infra-estrutura é iniciar o &kmplayer; a partir de uma aplicação da consola, como o 'konsole'. Depois, inicie um filme com o 'kmplayer' e veja a linha de comandos exacta que é usada para iniciar o 'mplayer' na aplicação da consola. De seguida, copie/cole essa informação para outra consola, remova as opções '-wid 12344' e ponha-o a tocar. Provavelmente, basta apenas escolher os parâmetros '-ao'/'-vo' correctos. Verifique também se o 'mplayer' não inicia por omissão com uma <acronym
>GUI</acronym
>. </para>
<para
>Outra ferramenta de depuração é o botão de 'consola' da barra de ferramentas do 'kmplayer'. Aí poderá ver o resultado do 'mplayer'. </para>
</section>
</section>
<section id="xine">
<title
>Xine</title>
<para
>Quando configurar o &kmplayer; com o suporte para o Xine, irá existir uma página de configuração para o Xine na janela de configuração do &kmplayer;. Aqui poderá definir várias opções. Estas opções são obtidas, de forma dinâmica, da biblioteca do Xine. Use a ajuda de contexto para obter informações sobre o que estas opções fazem (ie., carregue no botão do ponto de interrogação, na barra de título da janela, e carregue depois numa opção). </para>
<para
>As opções são gravadas no ficheiro <filename
>.kde/share/apps/kmplayer/xine_config</filename
>, como um documento de texto. </para>
<section id="xine-debug">
<title
>Resolução de problemas</title>
<para
>Basicamente, a mesma forma de resolver os problemas do <link linkend="mplayer-debug"
>MPlayer</link
>, com o nome da aplicação a ser <filename
>kxineplayer</filename
>. </para>
</section>
</section>
<section id="gstreamer">
<title
>GStreamer</title>
<para
>Não existe nenhuma página de configuração do GStreamer na janela de configuração do &kmplayer;. As opções comuns são, p.ex., o dispositivo de <acronym
>DVD</acronym
> que é usado, na medida do possível. </para>
<section id="gstremaer-debug">
<title
>Resolução de problemas</title>
<para
>Basicamente a mesma forma de resolver os problemas do <link linkend="mplayer-debug"
>MPlayer</link
>, sendo o nome da aplicação <filename
>kgstplayer</filename
>. </para>
</section>
</section>
</chapter>
<chapter id="sources">
<title
>Fontes que podem ser lidas</title>
<para
>O &kmplayer; pode ler a partir de várias fontes. Estas estão listadas no menu Fonte. </para>
<section id="tvsource">
<title
>TV</title>
<para
>O &kmplayer; poderá ver o conteúdo das placas de TV com o <application
>MPlayer</application
> ou o <acronym
>XVideo</acronym
> (usando o <application
>kxvplayer</application
>). Antes de poder ver televisão, terá de configurar o dispositivo a usar e os canais de TV. Poderá usar o sintonizador da janela de configuração para tal ou editar o ficheiro de configuração manualmente. </para>
<para
>O ficheiro de configuração da TV é um ficheiro em <acronym
>XML</acronym
>, localizado em <filename
>~/.kde/share/apps/kmplayer/tv.xml</filename
>. Veja <link linkend="XML-editing"
>aqui</link
> como manipular directamente estes dados. O formato em <acronym
>XML</acronym
> é mais ou menos como neste exemplo: <programlisting>
&lt;tvdevices&gt;
&lt;device path="/dev/video0" width="320" height="240" name="BT878 video (Hauppauge (bt878))" audio=""
minwidth="48" minheight="32" maxwidth="924" maxheight="576" playback="0" xvport="240"&gt;
&lt;input name="Television" id="0" tuner="1" norm="PAL" xvenc="0"&gt;
&lt;channel name="Ned1" frequency="216"/&gt;
&lt;channel name="VCR" frequency="594.90"/&gt;
&lt;/input&gt;
&lt;input name="Composite1" id="1" xvenc="7"/&gt;
&lt;input name="S-Video" id="2" xvenc="14"/&gt;
&lt;input name="Composite3" id="3"/&gt;
&lt;/device&gt;
&lt;device path="/dev/video1" width="640" height="480" name="Philips 740 webcam" audio=""
minwidth="160" minheight="120" maxwidth="640" maxheight="480" playback="1"&gt;
&lt;input name="Webcam" id="0"/&gt;
&lt;/device&gt;
&lt;/tvdevices&gt;
</programlisting
> Repare que os elementos <quote
>input</quote
> que têm canais, deverão ter o atributo <quote
>tuner</quote
> igual a <quote
>1</quote
>. </para>
<para
>O <acronym
>XVideo</acronym
> só usa os atributos <quote
>xvport</quote
> e <quote
>xvenc</quote
>, e eles só poderão ser definidos se editar manualmente este ficheiro. Os valores destes dois atributos poderão ser obtidos se executar o <quote
>kxvplayer</quote
> numa aplicação de terminal, como o <quote
>konsole</quote
>. Para todos os portos, o <quote
>kxvplayer</quote
> irá mostrar linhas como as que aparecem abaixo e os números poderão definidos para os atributos mencionados.<programlisting>
xvport 240
....
encoding: 0 PAL-television
encoding: 1 NTSC-television
encoding: 2 SECAM-television
....
</programlisting
> Também os atributos 'width' e 'height' são ignorados pelo leitor do <acronym
>XVideo</acronym
>. Este leitor obtém os tamanhos do servidor do X. Uma das coisas boas do <acronym
>XVideo</acronym
> é que o dimensionamento é feito por 'hardware', pela placa de vídeo, como tal o suporte de ecrã completo é feito sem utilizar o CPU e sem a mudança de resolução do seu monitor. Do mesmo modo, também não haverá nenhuma interferência incómoda quando outra janela se sobrepor a esta janela de vídeo. </para>
<para
>Veja a secção de VDR para mais informações sobre o uso do <acronym
>XVideo</acronym
>. </para>
</section>
<section id="vdrsource">
<title
>VDR</title>
<para
>Para configurar as suas opções de VDR no 'kmplayer', veja o painel Configurar->Fonte->VDR->XVideo. Deverão existir portos detectados, nos quais deverá seleccionar um deles. Terá de descobrir a codificação que deverá usar (p.ex., para a Europa ocidental, este é o PAL) e, provavelmente, o correcto terá um nome com <quote
>dvb</quote
> incluído. </para>
<para
>Por exemplo, o autor tem uma placa de TV, uma placa de DVB-S e uma webcam ligada ao seu sistema. Graças a elas, a configuração acusa três portos. O primeiro tem uma lista extensa de itens NTSC(-JP)/PAL(-M)/SECAM que dizem algo sobre a televisão/composto/svideo (corresponde à placa de TV). O segundo tem opções referente a NTSC-dvb/PAL-dvb/SECAM-dvb (da placa DVB-S). Finalmente, o terceiro só tem ntsc/pal (talvez a webcam). Como tal, deverá ser configurado (bastando para tal seleccioná-lo) o segundo porto e o segundo item (PAL-dvb). </para>
<para
>Dado que o suporte de VDR do 'kmplayer' só poderá usar o <acronym
>XVideo</acronym
>, claro que o <acronym
>XVideo</acronym
> deverá funcionar (no caso dos dispositivos, segundo a opinião do autor, esta forma de visualização só funciona no Linux). Do mesmo modo, também só funciona no seu primeiro ecrã (:0.0). Como tal, deverá certificar-se que a extensão <quote
>videoforlinux</quote
> funciona para o servidor do X. Para o servidor XFree86, na sua configuração (em <filename
>/etc/X11/XF86Config</filename
>), deverá existir <programlisting
>Section "Module"
....
Load "v4l"
EndSection
</programlisting>
</para>
<para
>Infelizmente, sempre que actualizar o seu controlador de vídeo, terá de configurar de novo esta opção. </para>
</section>
<section id="kmplayer_url">
<title
>Linha de comandos</title>
<para
>Internamente, no que respeita às fontes, o KMPlayer usa nomes distintos. Na altura em que este documento foi escrito, são as seguintes: "dvdnavsource", "dvdsource", "exitsource", "hrefsource", "introsource", "pipesource", "tvscanner", "tvsource", "urlsource", "vcdsource" e "vdrsource". Quando estiver activado, o programa irá executar a lista de itens com possibilidade de reprodução. </para>
<para
>Poderá activar uma fonte em particular com um <acronym
>URL</acronym
> do tipo <filename
>kmplayer://</filename
>. Basta definir o nome da máquina como nome da fonte e uma localização opcional como argumento extra, como tal, para um canal da fonte "vdrsource", isto poderá ficar algo do género <filename
>kmplayer://vdrsource/22 MTV 2</filename
>. P.ex., este programa inicia o 'kmplayer' com o "dvdnavsource" e a usar o <acronym
>DCOP</acronym
> para mostrar em todo o ecrã.<programlisting>
/bin/bash
kmplayer kmplayer://dvdnavsource/ &amp;
PID=$!
sleep 2
dcop kmplayer-$PID KMediaPlayer toggleFullScreen
</programlisting
> Para algumas fontes, isto não fará muita coisa, porque não se pretende usá-las na reprodução normal. Na "pipesource", esta opção está desactivada, porque poderia ser um grave problema de segurança. </para>
</section>
</chapter>
<chapter id="questionsanswersandtips">
<title
>Perguntas, Respostas e Dicas</title>
<qandaset id="faq">
<title
>Perguntas mais frequentes</title>
<qandaentry>
<question>
<para
>O Xine demora muito a arrancar, porque é que tem que verificar a velocidade do meu processador todas as vezes?</para>
</question>
<answer>
<para
>Repare que a resposta abaixo está desactualizada. O <application
>kxineplayer</application
> grava-a automaticamente com o último valor, como tal, da primeira vez, o 'xine' irá fazer o teste do CPU. </para>
<para
>A interface do <application
>Xine</application
> para o &kmplayer;, o <application
>kxineplayer</application
>, usa o <filename
>~/.kde/share/apps/kmplayer/xine_config</filename
> para a sua configuração. As opções do <application
>Xine</application
> estão na janela de configuração <quote
>Opções Gerais</quote
>|<quote
>Xine</quote
>. (Se você mudar aqui uma opção e gravá-la, o <filename
>~/.kde/share/apps/kmplayer/xine_config</filename
> irá conter também algumas explicações). A medida de performance do CPU e devida à opção <computeroutput
>misc.memcpy_method</computeroutput
> configurada para <computeroutput
>probe</computeroutput
> (detectar). Para ver qual a versão do 'memcpy' que funciona mais rapidamente para si, active a opção <quote
>Mostrar o Resultado da Consola</quote
> do menu <quote
>Ver</quote
> e veja os resultados desta análise quando tocar algo com o Xine. Configure o <computeroutput
>misc.memcpy_method</computeroutput
> com o método com menor tempo.</para>
</answer>
</qandaentry>
<qandaentry>
<question>
<para
>Algumas dicas em como tornar o CDROM menos barulhento quando é utilizado (não com VCD://)?</para>
</question>
<answer>
<para
>Claro, tente o comando <command
>hdparm -E 8 /dev/cdrom</command
> como 'root' depois de montar o dispositivo. Mas certifique-se que tem o <filename
>/dev/cdrom</filename
> a apontar para a sua unidade de CDROM. </para>
</answer>
</qandaentry>
</qandaset>
</chapter>
<chapter id="credits-and-licenses">
<title
>Créditos e Licenças</title>
<para
>&kmplayer; copyright 2002,2003 Koos Vriezen</para>
&underFDL; &underGPL; </chapter>
&documentation.index;
</book>
<!--
Local Variables:
mode: sgml
sgml-minimize-attributes:nil
sgml-general-insert-case:lower
sgml-indent-step:0
sgml-indent-data:nil
End:
-->

@ -0,0 +1,5 @@
EXTRA_DIST = index.docbook
KDE_LANG = ru
KDE_DOCS = kmplayer

@ -0,0 +1,227 @@
<?xml version="1.0" ?>
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
<!ENTITY kmplayer '<application
>Kmplayer</application
>'>
<!ENTITY kappname "&kmplayer;"
><!-- replace kmplayer here -->
<!ENTITY package "kdeextragear-2">
<!ENTITY % addindex "IGNORE">
<!ENTITY % Russian "INCLUDE"
><!-- change language only here -->
]>
<book lang="&language;">
<bookinfo>
<title
>Руководство &kmplayer;</title>
<authorgroup>
<author
><firstname
>Koos</firstname
> <surname
>Vriezen</surname
> <affiliation
> <address
><email
>koos dot vriezen at xs4all dot nl</email
></address>
</affiliation>
</author>
</authorgroup>
<othercredit role="translator"
><firstname
>Григорий</firstname
><surname
>Мохин</surname
><affiliation
><address
><email
>mok@kde.ru</email
></address
></affiliation
><contrib
>Перевод на русский, 2005</contrib
></othercredit
>
<copyright>
<year
>2002</year>
<year
>2003</year>
<holder
>Koos Vriezen</holder>
</copyright>
<!-- Translators: put here the copyright notice of the translation -->
<!-- Put here the FDL notice. Read the explanation in fdl-notice.docbook
and in the FDL itself on how to use it. -->
<legalnotice
>&FDLNotice;</legalnotice>
<date
>2003-12-24</date>
<releaseinfo
>0.05.00</releaseinfo>
<!-- Abstract about this handbook -->
<abstract>
<para
>&kmplayer; - это программа-облочка &kde; для <application
>MPlayer</application
>. </para>
</abstract>
<keywordset>
<keyword
>KDE</keyword>
<keyword
>kdemultimedia</keyword>
<keyword
>MPlayer</keyword>
<keyword
>konqueror</keyword>
<keyword
>video</keyword>
</keywordset>
</bookinfo>
<chapter id="introduction">
<title
>Введение</title>
<para
>&kmplayer; - это простая оболочка для <application
>MPlayer</application
>, <application
>Xine</application
> и <application
>FFMpeg</application
>. С его помощью можно просматривать все форматы видео, поддерживаемые <application
>MPlayer</application
> или <application
>Xine</application
>, а также <acronym
>DVD</acronym
>, <acronym
>VCD</acronym
> и программы с <acronym
>ТВ</acronym
> или <acronym
>видеокамеры</acronym
>. </para>
<para
>Документация &kappname; находится в процессе написания.</para
> <para
>Обратитесь на <ulink url="http://www.kde.org"
>Сайт KDE</ulink
> за помощью или обновлениями или отправьте вопрос в <ulink url="mail to:kde-user@kde.org"
>рассылку пользователей &kde;</ulink
>.</para>
<para
><emphasis
>Команда &kde;</emphasis
></para>
</chapter>
<chapter id="questionsanswersandtips">
<title
>Советы и подсказки</title>
<qandaset id="faq">
<title
>Вопросы и ответы</title>
<qandaentry>
<question>
<para
>Xine стартует медленно, почему всякий раз идёт проверка быстродействия процессора?</para>
</question>
<answer>
<para
>Облочка <application
>Xine</application
> в &kmplayer;, <application
>kxineplayer</application
> использует файл конфигурации <filename
>~/.xine/config2</filename
>. Параметры для <application
>Xine</application
> можно задать в диалоге <quote
>Общие параметры</quote
>|<quote
>Xine</quote
>. (Если сохранить опцию, в файле <filename
>~/.xine/config2</filename
> будет содержаться информация о ней). Тест процессора можно запустить, задав <computeroutput
>misc.memcpy_method</computeroutput
> равным <computeroutput
>probe</computeroutput
>. Чтобы просмотреть, какая версия memcpy работает быстрее всего, включите опцию <quote
>Показать вывод консоли</quote
> в меню <quote
>Вид</quote
> и посмотрите на результаты при воспроизведении чего-либо с помощью Xine. Укажите самый быстрый метод <computeroutput
>misc.memcpy_method</computeroutput
>.</para>
</answer>
</qandaentry>
<qandaentry>
<question>
<para
>Как уменьшить шум от CDROM при проигрывании с него (не VCD://)?</para>
</question>
<answer>
<para
>Выполните команду <command
>hdparm -E 8 /dev/cdrom</command
> от имени root после монтирования устройства. Но сначала убедитесь, что <filename
>/dev/cdrom</filename
> указывает на устройство CD-ROM. </para>
</answer>
</qandaentry>
</qandaset>
</chapter>
<chapter id="credits-and-licenses">
<title
>Благодарности и лицензия</title>
<para
>&kmplayer; copyright 2002,2003 Koos Vriezen</para>
&underFDL; &underGPL; </chapter>
&documentation.index;
</book>
<!--
Local Variables:
mode: sgml
sgml-minimize-attributes:nil
sgml-general-insert-case:lower
sgml-indent-step:0
sgml-indent-data:nil
End:
-->

@ -0,0 +1,5 @@
EXTRA_DIST = index.docbook
KDE_LANG = sv
KDE_DOCS = kmplayer

@ -0,0 +1,660 @@
<?xml version="1.0" ?>
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
<!ENTITY kmplayer '<application
>KMPlayer</application
>'>
<!ENTITY kappname "&kmplayer;"
><!-- replace kmplayer here -->
<!ENTITY package "kdeextragear-2">
<!ENTITY % addindex "IGNORE">
<!ENTITY % Swedish "INCLUDE"
><!-- change language only here -->
]>
<book lang="&language;">
<bookinfo>
<title
>Handbok &kmplayer;</title>
<authorgroup>
<author
><firstname
>Koos</firstname
> <surname
>Vriezen</surname
> <affiliation
> <address
><email
>koos dot vriezen at gmail dot com</email
></address>
</affiliation>
</author>
</authorgroup>
<othercredit role="translator"
><firstname
>Stefan</firstname
><surname
>Asserhäll</surname
><affiliation
><address
><email
>stefan.asserhall@comhem.se</email
></address
></affiliation
><contrib
>Översättare</contrib
></othercredit
>
<copyright>
<year
>2002</year>
<year
>2006</year>
<year
>2007</year>
<holder
>Koos Vriezen</holder>
</copyright>
<!-- Translators: put here the copyright notice of the translation -->
<!-- Put here the FDL notice. Read the explanation in fdl-notice.docbook
and in the FDL itself on how to use it. -->
<legalnotice
>&FDLNotice;</legalnotice>
<date
>2007-07-28</date>
<releaseinfo
>0.06.00</releaseinfo>
<!-- Abstract about this handbook -->
<abstract>
<para
>&kmplayer; är ett program som är ett &kde;-gränssnitt till <application
>Mplayer</application
>, <application
>Xine</application
> och <application
>Gstreamer</application
>. </para>
</abstract>
<keywordset>
<keyword
>KDE</keyword>
<keyword
>kdemultimedia</keyword>
<keyword
>Mplayer</keyword>
<keyword
>konqueror</keyword>
<keyword
>video</keyword>
</keywordset>
</bookinfo>
<chapter id="introduction">
<title
>Inledning</title>
<para
>&kmplayer; är ett enkelt gränssnitt till <application
>Mplayer</application
>, <application
>Xine</application
>, <application
>Gstreamer</application
> och <application
>FFMpeg</application
>. Du kan använda det för att titta på alla filmfilformat som <application
>Mplayer</application
>, <application
>Xine</application
> eller <application
>Gstreamer</application
> stöder, samt titta på en <acronym
>dvd</acronym
>, <acronym
>vcd</acronym
> eller <acronym
>tv</acronym
> och kamera. </para>
<para
>Dokumentationen för &kappname; var inte klar när &kde; installerades på den här datorn.</para
> <para
>Om du behöver mer hjälp, titta på <ulink url="http://www.kde.org"
>KDE:s hemsida</ulink
> för uppdateringar, eller skicka din fråga till <ulink url="mailto:kde-user@kde.org"
>&kde;:s e-postlista för användare</ulink
>. </para>
<para
><emphasis
>&kde;-gruppen</emphasis
></para>
</chapter>
<chapter id="gui">
<title
>Användargränssnittet</title>
<para
>Programfönstret består av så kallade dockningsbara fönster. Det centrala visningsfönstret finns alltid. Dessutom finns ett valfritt spellistefönster. Slutligen finns ett informationsfönster, som bara visas när det finns någon information att visa. </para>
<section id="playlistwindow">
<title
>Spellistefönstret</title>
<para
>Spellistefönstret har fem kategorier när det här skrivs, aktuella objekt, <guilabel
>Optiska skivor</guilabel
>, <guilabel
>Television</guilabel
>, <guilabel
>Bevarade spellistor</guilabel
> och <guilabel
>Senaste</guilabel
>. Vid ett klick på en kategoris text visas dess innehåll under linjen. Det måste förstås finnas något innehåll, se till exempel <link linkend="tvsource"
><acronym
>TV</acronym
>-inställningar</link
> om hur man lägger till innehåll för kategorin <guilabel
>Television</guilabel
>. Kategorin <guilabel
>Senaste</guilabel
> fylls i när lokala mediafiler eller nätverkswebbadresser spelas upp. Kategorin kan innehålla 60 objekt, varav de sista 50 är under grenen <guilabel
>Mer...</guilabel
>. </para>
<section>
<title
>Kategorin Bevarade spellistor</title>
<para
>Det är möjligt att lagra dina favoritlänkar i menyn <guilabel
>Bokmärken</guilabel
>, men de är enskilda objekt. Om du vill skapa en lista med objekt som spelas i tur och ordning, ska du använda kategorin <guilabel
>Bevarade spellistor</guilabel
>. </para>
<para
>Det enklaste sättet att lägga till ett objekt i listan är att dra det från <guilabel
>Senaste</guilabel
> och släppa det på <guilabel
>Bevarade spellistor</guilabel
>. Som du märker, visas en meny när du släpper det, där du kan välja att lägga till det i den här listan eller skapa en ny grupp. Objekt på översta nivån beter sig som bokmärkesobjekt, men objekt i grupper spelar upp hela gruppen som de ingår i. Objekt i kategorin kan enkelt flyttas, kopieras, läggas till i en ny grupp eller tas bort, bara genom att dra objektet till en annan plats i kategorin. Dessutom finns alternativen <guimenu
>Ta bort objekt</guimenu
>, <guimenu
>Flytta upp</guimenu
> och <guimenu
>Flytta ner</guimenu
> i den sammanhangsberoende menyn (vid klick med höger musknapp på ett objekt). </para>
<para
>Du kan förstås lägga till grupper i grupper för att få en djupare hierarki. Vid klick på ett objekt, kopieras dess grupp och alla undergrupper till den aktuella kategorin, och uppspelning börjar på det klickade objektets position. </para>
<section>
<title
>Lagringsformat</title>
<para
>Data lagras i <filename
>~/.kde/share/apps/kmplayer/playlist.xml</filename
>, och dess format är som i exemplet. Titta <link linkend="XML-editing"
>här</link
> om hur man hanterar denna data direkt. <programlisting>
&lt;playlist&gt;
&lt;group title="feeds"&gt;
&lt;item url="http://www.lugradio.org/episodes.rss"/&gt;
&lt;item url="http://science.nasa.gov/podcast.xml"/&gt;
&lt;item url="http://www.theworld.org/rss/tech.xml"/&gt;
&lt;/group&gt;
&lt;group title="iradio"&gt;
&lt;group title="sunny"&gt;
&lt;item mplayeropts="-cache 256" url="http://www.swissgroove.ch/listen.m3u"/&gt;
&lt;item url="http://www.boombasticradio.com/shoutcast/64.pls"/&gt;
&lt;/group&gt;
&lt;group title="rainy"&gt;
&lt;item url="http://www.radioparadise.com/musiclinks/rp_64.m3u"/&gt;
&lt;item url="http://www.woxy.com/stream/wma64.asx"/&gt;
&lt;item url="http://radionigel.com/winmedia.asx"/&gt;
&lt;item url="rtsp://livestreams.omroep.nl/live/vpro/vpro3voor12radioalt.rm"/&gt;
&lt;/group&gt;
&lt;/group&gt;
&lt;/playlist&gt;
</programlisting
> Observera också att egna alternativ kan ställas in med väljaren <computeroutput
>mplayeropts</computeroutput
> för <application
>Mplayer</application
>. &kmplayer; söker uppåt i trädet efter väljaren, så du kan ställa in den för en hel grupp och överskrida den för en undergrupp eller för ett objekt. </para>
</section>
</section>
</section>
<section id="XML-editing">
<title
>Direkt XML-redigering</title>
<para
>Kategorierna Senaste, <guilabel
>Television</guilabel
> och <guilabel
>Bevarade spellistor</guilabel
> kan också hanteras genom att redigera deras <acronym
>XML</acronym
>-lagring. Man kan förstås göra det när &kmplayer; inte kör, och redigera de olika filerna i <filename
>~/.kde/share/apps/kmplayer/</filename
>, men också i själva programmet. Klicka helt enkelt på en kategorirubrik, välj därefter <guimenu
>Visa</guimenu
> och sedan <guimenu
>Redigeringsläge</guimenu
>. Du kan också klicka på en undergren och då ser du bara <acronym
>XML</acronym
>-innehållet för grenen. </para>
<para
>Efter du har redigerat en del <acronym
>XML</acronym
>, klicka på <guilabel
>Synkronisera med spellista</guilabel
> och avmarkera antingen alternativet <guimenu
>Redigeringsläge</guimenu
> eller klicka på en annan kategori. <caution
><para
>Alla ändringar går förlorade om du lämnar redigeringsläge eller väljer en annan gren utan att synkronisera med spellistan. </para
></caution>
</para>
<para
>På grund av lättja hos &kmplayer;s upphovsmän, kan vissa funktioner bara aktiveras genom att redigera XML. </para>
</section>
</chapter>
<chapter id="settings">
<title
>Inställningar</title>
<section>
<title
>Animering vid start och avslutning</title>
<para
>Att inaktivera start- och slutanimeringen kan utföras genom att redigera <filename
>~/.kde/share/config/kmplayerrc</filename
> och ändra <programlisting>
[General Options]
No Intro=0
</programlisting
> ovanstående alternativ till '1'. Lägg bara till alternativet om det inte redan finns där. </para>
<para
>Det är också möjligt att ange alternativa animeringar. &kmplayer; tittar på <filename
>~/.kde/share/apps/kmplayer/intro.xml</filename
> och <filename
>~/.kde/share/apps/kmplayer/exit.xml</filename
>. Formatet måste vara en <acronym
>XML</acronym
>-fil som stöds. </para>
<para
>Den inledande animeringen behöver inte vara kort, eftersom den automatiskt slutar när en annan källa öppnas. Det skulle förstås vara något irriterande för slutanimeringen, men användaren kan alltid avsluta programmet två gånger. </para>
<para
>Ett enkelt exempel på en inledning, som visar ditt favoritfoto skulle kunna vara <programlisting>
&lt;smil&gt;
&lt;body&gt;
&lt;img dur="indefinite" src="///home/användare/mamma.gif" fit="meet"/&gt;
&lt;/body&gt;
&lt;/smil&gt;
</programlisting
> I &kmplayer;s källkodspaket, under <filename
>tests/</filename
> finns några exempel på <acronym
>SMIL</acronym
> som &kmplayer; stöder. </para>
</section>
</chapter>
<chapter id="backends">
<title
>Uppspelningsgränssnitten</title>
<para
>&kmplayer; använder externa program för att utföra själva uppspelningen. </para>
<section id="mplayer">
<title
>Mplayer</title>
<para
>Det finns en inställningsflik för Mplayer i &kmplayer;s inställnigsdialogruta. Där kan man bland annat ställa in sökvägen till Mplayer och dess cachestorlek för nätverksströmmar. </para>
<para
>Spelarens inställningsnamn är <parameter
>mplayer</parameter
>. </para>
<section id="mplayer-debug">
<title
>Felsökning</title>
<para
>Det bästa sättet att felsöka i gränssnittet är att starta &kmplayer; från ett terminalprogram som konsole. Starta därefter en film med Kmplayer och se exakt den kommandorad som används för att starta Mplayer i terminalprogrammet. Kopiera och klistra nu in den i ett annat terminalprogram, ta bort väljaren '-wid 12344' och spela den. Troligen är det bara att välja rätt parametrar för -ao och -vo. Försäkra dig också om att Mplayer inte är förinställt att starta med ett grafiskt gränssnitt. </para>
<para
>Ett annat felsökningsverktyg är knappen 'Terminal' i Kmplayers verktygsrad. Där kan du se utmatningen från Mplayer. </para>
</section>
</section>
<section id="xine">
<title
>Xine</title>
<para
>När &kmplayer; är konfigurerad med stöd för Xine, finns det inställningsflikar för Xine i &kmplayer;s inställningsdialogruta. Där kan du ställa in diverse alternativ. Alternativen hämtas dynamiskt från Xines bibliotek. Använd den sammanhangsberoende hjälpen för att få information om vad alternativen gör (dvs. klicka på frågetecknet i dialogrutans namnlist och klicka därefter på ett alternativ). </para>
<para
>Spelarens inställningsnamn är <parameter
>xine</parameter
>. </para>
<para
>Alternativen sparas i <filename
>.kde/share/apps/kmplayer/xine_config</filename
> som ett textdokument. </para>
<section id="xine-debug">
<title
>Felsökning</title>
<para
>Huvudsakligen samma sätt att felsöka som för <link linkend="mplayer-debug"
>Mplayer</link
>, men med programnamnet <filename
>kxineplayer</filename
>. </para>
</section>
</section>
<section id="gstreamer">
<title
>Gstreamer</title>
<para
>Det finns ingen inställningsflik för Gstreamer i &kmplayer;s inställningsdialogruta. De vanliga alternativen för t.ex. <acronym
>dvd</acronym
>-enheter används när det passar. </para>
<para
>Spelarens inställningsnamn är <parameter
>gstreamer</parameter
>. </para>
<section id="gstremaer-debug">
<title
>Felsökning</title>
<para
>Huvudsakligen samma sätt att felsöka som för <link linkend="mplayer-debug"
>Mplayer</link
>, men med programnamnet <filename
>kgstplayer</filename
>. </para>
</section>
</section>
<section id="npp">
<title
>Insticksprogram för bläddring</title>
<para
>Det finns ingen inställningsflik för spelaren i &kmplayer;s inställningsdialogruta. Allting måste ställas in genom att redigera <filename
>~/.kde/share/config/kmplayerrc</filename
> för hand, liksom vid inställning av <link linkend="backend-mimetype"
>uppspelningsgränssnitt per Mime-typ</link
>. Här är ett exempel på hur man kan få Flash att spelas upp med insticksprogrammet swfdec-mozilla: <programlisting
>[application/x-shockwave-flash]
player=npp
plugin=/usr/lib/mozilla/plugins/libswfdecmozilla.so
</programlisting>
</para>
<para
>Du kan spela upp Flash inne i &kmplayer;. I själva verket kan du till och med klistra in det särskilda fältet <parameter
>embed</parameter
> för <ulink url="http://www.youtube.com"
>YouTube</ulink
> i <link linkend="XML-editing"
>spellistans <acronym
>XML</acronym
></link
>. </para>
<para
>För att låta &kmplayer; spela upp Flash på HTML-sidor, ska du ställa in &kmplayer;-insticksprogrammet att vara den tjänst som tillhandahåller Mime-typen <parameter
>application/x-shockwave-flash</parameter
> i KDE:s inställningsdialogruta <guilabel
>Filbindningar</guilabel
>. </para>
<para
>Som i föregående exempel, är spelarens inställningsnamn <parameter
>npp</parameter
>. </para>
<section id="npp-debug">
<title
>Felsökning</title>
<para
>Starta Konqueror eller &kmplayer; i ett terminalprogram och titta efter fel när biblioteket för insticksprogrammet för bläddring laddas. Processen som startas kallas <filename
>knpplayer</filename
>. Om det inte finns några fel, kontrollera uppspelningsgränssnittets utmatning inne i &kmplayer; (<guimenu
>Visa</guimenu
> <guimenuitem
>Terminal</guimenuitem
>, eller <guimenuitem
>Terminal</guimenuitem
> i den sammanhangsberoende menyn). </para>
</section>
</section>
<section id="backend-mimetype">
<title
>Tvinga uppspelningsgränssnitt för en viss Mime-typ</title>
<para
>Att ändra inställningen så att ett givet gränssnitt alltid används för en viss Mime-typ (naturligtvis enbart om den har detekterats) kan göras genom att redigera filen <filename
>~/.kde/share/config/kmplayerrc</filename
> för hand. För att till exempel låta Xine spela upp alla ogg-filer: <programlisting
>[audio/ogg]
player=xine
</programlisting>
</para>
</section>
</chapter>
<chapter id="sources">
<title
>Källor som kan spelas upp</title>
<para
>&kmplayer; kan spela upp olika källor. Dessa källor listas i menyn Källa. </para>
<section id="tvsource">
<title
>Tv</title>
<para
>&kmplayer; kan spela från tv-kort med <application
>Mplayer</application
> eller <acronym
>Xvideo</acronym
> (med användning av <application
>kxvplayer</application
>). Innan du kan titta på tv måste du ställa in vilken enhet som ska användas, och tv-kanalerna. Du kan använda sökfunktionen i inställningsdialogrutan för detta, eller redigera inställningsfilen för hand. </para>
<para
>Inställningsfilen för tv-inställningarna är en <acronym
>XML</acronym
>-fil, med namnet <filename
>~/.kde/share/apps/kmplayer/tv.xml</filename
>. Titta <link linkend="XML-editing"
>här</link
> om hur man hanterar denna data direkt. <acronym
>XML</acronym
>-formatet är som följande exempel: <programlisting>
&lt;tvdevices&gt;
&lt;device path="/dev/video0" width="320" height="240" name="BT878 video (Hauppauge (bt878))" audio=""
minwidth="48" minheight="32" maxwidth="924" maxheight="576" playback="0" xvport="240"&gt;
&lt;input name="Television" id="0" tuner="1" norm="PAL" xvenc="0"&gt;
&lt;channel name="Ned1" frequency="21600"/&gt;
&lt;channel name="VCR" frequency="59490"/&gt;
&lt;/input&gt;
&lt;input name="Composite1" id="1" xvenc="7"/&gt;
&lt;input name="S-Video" id="2" xvenc="14"/&gt;
&lt;input name="Composite3" id="3"/&gt;
&lt;/device&gt;
&lt;device path="/dev/video1" width="640" height="480" name="Philips 740 webcam" audio=""
minwidth="160" minheight="120" maxwidth="640" maxheight="480" playback="1"&gt;
&lt;input name="Webcam" id="0"/&gt;
&lt;/device&gt;
&lt;/tvdevices&gt;
</programlisting
> Observera att elementen <quote
>input</quote
> som har kanaler, ska ha egenskapen <quote
>tuner</quote
> inställd till <quote
>1</quote
>. </para>
<para
><acronym
>Xvideo</acronym
> använder bara egenskaperna <quote
>xvport</quote
> och <quote
>xvenc</quote
> och kan bara ställas in genom att redigera filen för hand. Värden för de två egenskaperna kan hämtas genom att köra <quote
>kxvplayer</quote
> i ett terminalfönster som <quote
>konsole</quote
>. För varje port skriver <quote
>kxvplayer</quote
> ut rader som visas nedan, och värdena kan ställas in för de nämnda egenskaperna. <programlisting>
xvport 240
....
encoding: 0 PAL-television
encoding: 1 NTSC-television
encoding: 2 SECAM-television
....
</programlisting
> Dessutom ignoreras egenskaperna bredd och höjd av <acronym
>Xvideo</acronym
>-spelaren. Spelaren hämtar storlekarna från X-servern. En av de trevliga sakerna med <acronym
>Xvideo</acronym
> är att skalning görs i hårdvara av videokortet, vilket ger stöd för fullskärmsvisning utan processoranvändning och utan att ändra bildskärmens upplösning. Dessutom uppstår inget irriterande flimmer när ett annat fönster överlappar videofönstret. </para>
<para
>Se avsnittet VDR för mer information om att använda <acronym
>Xvideo</acronym
>. </para>
</section>
<section id="vdrsource">
<title
>VDR</title>
<para
>För att ställa in VDR-inställningar i Kmplayer, använd inställningsrutan Källa -> VDR -> Xvideo port. Det ska finnas detekterade portar, där du ska välja en. Du måste räkna ut vilken kodning du ska använda (i västeuropa är det t.ex. PAL) och troligen har den rätta ett namn som innehåller <quote
>dvb</quote
>. </para>
<para
>Jag har till exempel ett tv-kort, ett DVB-S kort och en webbkamera inkopplade i mitt system. Med dessa har mina inställningar tre portar. Den första har en lång lista med NTSC(-JP)/PAL(-M)/SECAM-poster som alla innehåller något med television/composite/svideo (mitt tv-kort). Den andra har NTSC-dvb/PAL-dvb/SECAM-dvb (mitt DVB-S kort). Den tredje har slutligen bara ntsc/pal (troligen min webbkamera). Därför ska jag ställa in (bara genom att markera den) den andra porten och andra posten (PAL-dvb). </para>
<para
>Eftersom VDR-stöd i Kmplayer bara kan använda <acronym
>Xvideo</acronym
>, måste förstås <acronym
>Xvideo</acronym
> fungera (och jag tror att detta sätt att titta på videoenheter bara fungerar med Linux). Detta fungerar också bara på den första skärmen (:0.0). Försäkra dig alltså om att utökningen <quote
>videoforlinux</quote
> fungerar med X-servern. För XFree86-servern, ska följande finnas i inställningsfilen (<filename
>/etc/X11/XF86Config</filename
>): <programlisting
>Section "Module"
....
Load "v4l"
EndSection
</programlisting>
</para>
<para
>Tyvärr måste du ställa in det här alternativet igen så fort du uppdaterar din videodrivrutin. </para>
</section>
<section id="kmplayer_url">
<title
>Kommandorad</title>
<para
>Internt använder &kmplayer; distinkta namn för källor. När det här skrivs är de "dvdnavsource", "dvdsource", "exitsource", "hrefsource", "introsource", "pipesource", "tvscanner", "tvsource", "urlsource", "vcdsource" och "vdrsource". När de aktiveras börjar de oftast spela listan med spelbara objekt. </para>
<para
>Du kan aktivera en viss källa med webbadressen <filename
>kmplayer://</filename
>. Ange bara värddatordelen som källans namn och den valfria delen som extra argument, vilket skulle kunna se ut som <filename
>kmplayer://vdrsource/22 MTV 2</filename
> för en kanal från "vdrsource". Till exempel startar följande skript Kmplayer med "dvdnavsource" och använder <acronym
>DCOP</acronym
> för att spela upp med fullskärmsläge. <programlisting>
/bin/bash
kmplayer kmplayer://dvdnavsource/ &amp;
PID=$!
sleep 2
dcop kmplayer-$PID KMediaPlayer toggleFullScreen
</programlisting
> Det gör inte mycket för vissa källor, eftersom de inte är avsedda för normal uppspelning. Det är inaktiverat för "pipesource", eftersom det naturligtvis skulle vara ett allvarligt säkerhetshål. </para>
</section>
</chapter>
<chapter id="questionsanswersandtips">
<title
>Frågor, svar och tips</title>
<qandaset id="faq">
<title
>Vanliga frågor</title>
<qandaentry>
<question>
<para
>Xine startar långsamt, varför måste det mäta min processorprestanda hela tiden?</para>
</question>
<answer>
<para
>Observera att svaret nedan är föråldrat. <application
>kxineplayer</application
> sparar den automatiskt i det senaste värdet, så xine gör bara processortesten första gången. </para>
<para
>Gränssnittet till <application
>Xine</application
> i &kmplayer;, <application
>kxineplayer</application
>, använder <filename
>~/.kde/share/apps/kmplayer/xine_config</filename
> för sina inställningar. Inställningar för <application
>Xine</application
> finns i inställningsdialogrutan <quote
>General Options</quote
>|<quote
>Xine</quote
>. (Om du ändrar ett alternativ här och sparar det, innehåller <filename
>~/.kde/share/apps/kmplayer/xine_config</filename
> också en del förklaringar). Mätningen av processorprestanda orsakas av att alternativet <computeroutput
>misc.memcpy_method</computeroutput
> är inställt till <computeroutput
>probe</computeroutput
>. För att ta reda på vilken version av minneskopiering som är snabbast för dig, aktivera <quote
>Visa terminalutmatning</quote
> i menyn <quote
>Visa</quote
> och titta på resultatet av mätningen när du spelar någonting med Xine. Ställ in <computeroutput
>misc.memcpy_method</computeroutput
> till metoden med kortast tid.</para>
</answer>
</qandaentry>
<qandaentry>
<question>
<para
>Några tips för att göra cdrom-enheten tystare när den används för uppspelning (inte VCD://)?</para>
</question>
<answer>
<para
>Visst, prova <command
>hdparm -E 8 /dev/cdrom</command
> som systemadministratör, efter att ha monterat enheten. Men försäkra dig om att du dubbelkollar att <filename
>/dev/cdrom</filename
> pekar på cdrom-enheten. </para>
</answer>
</qandaentry>
</qandaset>
</chapter>
<chapter id="credits-and-licenses">
<title
>Tack till och licenser</title>
<para
>&kmplayer; copyright 2002, 2003 Koos Vriezen</para>
&underFDL; &underGPL; </chapter>
&documentation.index;
</book>
<!--
Local Variables:
mode: sgml
sgml-minimize-attributes:nil
sgml-general-insert-case:lower
sgml-indent-step:0
sgml-indent-data:nil
End:
-->

@ -0,0 +1,3 @@
INCLUDES = $(all_includes)
METASOURCES = AUTO
KDE_ICON = AUTO

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,14 @@
Begin3
Title: Kmplayer
Version: 0.10.0c
Entered-date:
Description:
Keywords:
Author: Koos Vriezen <>
Maintained-by: Koos Vriezen <>
Primary-site:
Home-page: http://kmplayer.kde.org
Original-site:
Platforms: Linux and other Unices
Copying-policy: GNU Public License
End

7037
libtool

File diff suppressed because it is too large Load Diff

@ -0,0 +1,5 @@
if need_kde32_compatibility
KDE32MIMEDIR = audio
endif
SUBDIRS = application video $(KDE32MIMEDIR)

@ -0,0 +1,4 @@
mime_DATA = x-mplayer2.desktop x-kmplayer.desktop
mimedir = $(kde_mimedir)/application
EXTRA_DIST = $(mime_DATA)

@ -0,0 +1,47 @@
# KDE Config File
[Desktop Entry]
Encoding=UTF-8
MimeType=application/x-kmplayer
Comment=KMPlayer Document
Comment[af]=KMPlayer Dokument
Comment[ar]=وثيقة KMPlayer
Comment[bg]=Документ за KMPlayer
Comment[br]=Teul KMPlayer
Comment[bs]=KMPlayer dokument
Comment[ca]=Document KMPlayer
Comment[cs]=KMPlayer dokument
Comment[da]=KMPlayer-dokument
Comment[de]=KMPlayer-Datei
Comment[el]=Έγγραφο KMPlayer
Comment[es]=Documento de KMPlayer
Comment[et]=KMPlayeri dokument
Comment[fi]=KMPlayer-asiakirja
Comment[fr]=Document de KMPlayer
Comment[gl]=Documento de KMPlayer
Comment[he]=מסמך KMPlayer
Comment[hi]=केएमप्लेयर दस्तावेज
Comment[hu]=KMPlayer-dokumentum
Comment[it]=Documento KMPlayer
Comment[ja]=KMPlayer ドキュメント
Comment[ka]=KMPlayer-ის დოკუმენტი
Comment[mk]=Документ на KMPlayer
Comment[nb]=KMPlayer-dokument
Comment[nl]=KMPlayer-document
Comment[pa]=KMPlayer ਦਸਤਾਵੇਜ਼
Comment[pt]=Documento do KMPlayer
Comment[pt_BR]=Documento do KMplayer
Comment[ru]=Файл KMPlayer
Comment[sk]=Dokument KMPlayera
Comment[sr]=KMPlayer-ов документ
Comment[sr@Latn]=KMPlayer-ov dokument
Comment[sv]=Kmplayer-dokument
Comment[ta]=கேஎம்இயக்கி ஆவணம்
Comment[th]=เอกสาร KMPlayer
Comment[tr]=KMPlayer Belgesi
Comment[uk]=Документ KMPlayer
Comment[xx]=xxKMPlayer Documentxx
Comment[zh_CN]=KMPlayer 文档
Comment[zh_TW]=KMPlayer 文件
Icon=kmplayer
Type=MimeType
X-KDE-AutoEmbed=true

@ -0,0 +1,46 @@
[Desktop Entry]
Encoding=UTF-8
Type=MimeType
Comment=MS Media Format
Comment[af]=MS Media Formaat
Comment[ar]= ضيغة MS Media
Comment[bg]=MS формат на медия
Comment[br]=Furmad MS Media
Comment[bs]=MS Media format
Comment[ca]=Format multimèdia de Microsoft
Comment[cs]=MS média formát
Comment[da]=MS Medie-Format
Comment[de]=MS-Media-Format
Comment[el]=Μορφή πολυμέσων MS
Comment[es]=Formato multimedia de Microsoft
Comment[et]=MS Media vorming
Comment[fr]=Format multimédia Microsoft
Comment[gl]=Formato Multimédia de Microsoft
Comment[he]=תבנית מדיה של חלונות
Comment[hi]=एमएस मीडिया फॉर्मेट
Comment[hu]=MS Media fájl
Comment[it]=Formato media MS
Comment[ja]=MS Media フォーマット
Comment[ka]=MS Media-ის ფორმატი
Comment[mk]=Мултимедијален формат на MS
Comment[nb]=Microsoft Media-format
Comment[nl]=MS mediaformaat
Comment[pa]=MS ਮੀਡਿਆ ਫਾਰਮੈਟ
Comment[pt]=Formato Multimédia Microsoft
Comment[pt_BR]=Formato de Mídia MS
Comment[ru]=Формат MS Media
Comment[sk]=MS Media formát
Comment[sr]=MS формат медија
Comment[sr@Latn]=MS format medija
Comment[sv]=MS-mediaformat
Comment[ta]=எம்எஸ் ஊடக வடிவம்
Comment[th]=รูปแบบ MS Media
Comment[tr]=MS Medya Biçimi
Comment[uk]=Формат MS Media
Comment[xx]=xxMS Media Formatxx
Comment[zh_CN]=MS Media 格式
Comment[zh_TW]=MS 媒體格式
MimeType=application/x-mplayer2
Icon=multimedia
Patterns=*.asx;*.ASX;*.asf;*.ASF;
X-KDE-AutoEmbed=true

@ -0,0 +1,4 @@
mime_DATA =x-ms-wma.desktop
mimedir = $(kde_mimedir)/audio

@ -0,0 +1,36 @@
[Desktop Entry]
Encoding=UTF-8
Type=MimeType
MimeType=audio/x-ms-wma
Icon=audio
Patterns=*.AVI;*.wma;*.WMA;
Comment=Microsoft Audio
Comment[af]=Microsoft Oudio
Comment[ar]= صوت (من) ميكروسوفت
Comment[bg]=Microsoft аудио
Comment[br]=Klevet Microsoft
Comment[ca]=Àudio de Microsoft
Comment[cs]=Microsoft audio
Comment[el]=Ήχος Microsoft
Comment[es]=Audio de Microsoft
Comment[fr]=Audio Microsoft (WMA)
Comment[gl]=Áudio Microsoft
Comment[he]=שמע של מיקרוסופט
Comment[hi]=माइक्रोसॉफ्ट ऑडियो
Comment[hu]=Microsoft Audio fájl
Comment[ja]=Microsoft オーディオ
Comment[mk]=Мајкрософт аудио
Comment[nb]=Microsoft-lydformat
Comment[pa]=ਮਾਈਕਰੋਸਾਫਟ ਆਡੀਓ
Comment[pt]=Áudio Microsoft
Comment[pt_BR]=Áudio da Microsoft
Comment[sr]=Microsoft-ов аудио
Comment[sr@Latn]=Microsoft-ov audio
Comment[sv]=Microsoft ljud
Comment[ta]=மைக்ரோசாஃப்ட் கேட்பொலி
Comment[th]=รูปแบบเสียงของ Microsoft
Comment[tr]=Microsoft Ses
Comment[uk]=Microsoft аудіо
Comment[xx]=xxMicrosoft Audioxx
Comment[zh_CN]=微软音频
Comment[zh_TW]=Microsoft 音效格式

@ -0,0 +1,9 @@
if need_kde31_compatibility
KDE31MIMEDIR = kde31
endif
SUBDIRS = . $(KDE31MIMEDIR)
mime_DATA = x-ms-wmp.desktop
mimedir = $(kde_mimedir)/video

@ -0,0 +1,4 @@
mime_DATA =x-ms-wmv.desktop
mimedir = $(kde_mimedir)/video

@ -0,0 +1,44 @@
[Desktop Entry]
Encoding=UTF-8
Type=MimeType
MimeType=video/x-ms-wmv
Icon=video
Patterns=*.avi;*.AVI;*.wmv;*.WMV;
Comment=Microsoft AVI Video
Comment[ar]=ميكروسوفت AVIفيديو
Comment[bg]=Microsoft AVI видео
Comment[br]=Video Microsoft AVI
Comment[ca]=Vídeo AVI de Microsoft
Comment[cs]=Microsoft AVI video
Comment[cy]=Fideo Microsoft AVI
Comment[de]=AVI-Video (Microsoft)
Comment[el]=Βίντεο Microsoft AVI
Comment[es]=Vídeo AVI de Microsoft
Comment[fi]=Microsoft AVI -video
Comment[fr]=Vidéo AVI Microsoft
Comment[ga]=Físeán Microsoft AVI
Comment[gl]=Vídeo MS AVI
Comment[he]=קובץ וידאו AVI של מיקרוסופט
Comment[hi]=माइक्रोसॉफ्ट एवीआई वीडियो
Comment[hu]=Microsoft AVI videó
Comment[it]=Video Microsoft AVI
Comment[ja]=Microsoft AVI ビデオ
Comment[ka]=Microsoft AVI ვიდეო
Comment[mk]=Мајкрософт AVI-видео
Comment[nb]=Microsoft AVI-video
Comment[nl]=Microsoft AVI-video
Comment[pa]=ਮਾਈਕਰੋਸਾਫਟ AVI ਵੀਡਿਓ
Comment[pt]=Vídeo Microsoft AVI
Comment[pt_BR]=Vídeo AVI da Microsoft
Comment[rw]=Microsoft AVI Inyerekanamashusho
Comment[sr]=Microsoft-ов AVI видео
Comment[sr@Latn]=Microsoft-ov AVI video
Comment[sv]=Microsoft AVI-video
Comment[ta]=மைக்ரோசாஃப்ட் ஏவீஐ ஒளித்தோற்றம்
Comment[th]=รูปแบบวิดีโอ AVI ของ Microsoft
Comment[tr]=Microsoft AVI Görüntü
Comment[uk]=Microsoft AVI-відео
Comment[xx]=xxMicrosoft AVI Videoxx
Comment[zh_CN]=微软 AVI 视频
Comment[zh_TW]=Microsoft AVI 視像
Comment[zu]=Microsoft AVI Vidiyo

@ -0,0 +1,44 @@
[Desktop Entry]
Encoding=UTF-8
Type=MimeType
MimeType=video/x-ms-wmp
Icon=video
Patterns=*.wmp;*.WMP;
Comment=Microsoft AVI Video
Comment[ar]=ميكروسوفت AVIفيديو
Comment[bg]=Microsoft AVI видео
Comment[br]=Video Microsoft AVI
Comment[ca]=Vídeo AVI de Microsoft
Comment[cs]=Microsoft AVI video
Comment[cy]=Fideo Microsoft AVI
Comment[de]=AVI-Video (Microsoft)
Comment[el]=Βίντεο Microsoft AVI
Comment[es]=Vídeo AVI de Microsoft
Comment[fi]=Microsoft AVI -video
Comment[fr]=Vidéo AVI Microsoft
Comment[ga]=Físeán Microsoft AVI
Comment[gl]=Vídeo MS AVI
Comment[he]=קובץ וידאו AVI של מיקרוסופט
Comment[hi]=माइक्रोसॉफ्ट एवीआई वीडियो
Comment[hu]=Microsoft AVI videó
Comment[it]=Video Microsoft AVI
Comment[ja]=Microsoft AVI ビデオ
Comment[ka]=Microsoft AVI ვიდეო
Comment[mk]=Мајкрософт AVI-видео
Comment[nb]=Microsoft AVI-video
Comment[nl]=Microsoft AVI-video
Comment[pa]=ਮਾਈਕਰੋਸਾਫਟ AVI ਵੀਡਿਓ
Comment[pt]=Vídeo Microsoft AVI
Comment[pt_BR]=Vídeo AVI da Microsoft
Comment[rw]=Microsoft AVI Inyerekanamashusho
Comment[sr]=Microsoft-ов AVI видео
Comment[sr@Latn]=Microsoft-ov AVI video
Comment[sv]=Microsoft AVI-video
Comment[ta]=மைக்ரோசாஃப்ட் ஏவீஐ ஒளித்தோற்றம்
Comment[th]=รูปแบบวิดีโอ AVI ของ Microsoft
Comment[tr]=Microsoft AVI Görüntü
Comment[uk]=Microsoft AVI-відео
Comment[xx]=xxMicrosoft AVI Videoxx
Comment[zh_CN]=微软 AVI 视频
Comment[zh_TW]=Microsoft AVI 視像
Comment[zu]=Microsoft AVI Vidiyo

@ -0,0 +1,28 @@
--- libvo/vo_x11.c.orig Thu Dec 26 18:18:31 2002
+++ libvo/vo_x11.c Thu Dec 26 19:58:49 2002
@@ -294,12 +294,12 @@
bg=WhitePixel( mDisplay,mScreen );
fg=BlackPixel( mDisplay,mScreen );
- theCmap=vo_x11_create_colormap(&vinfo);
+ //theCmap=vo_x11_create_colormap(&vinfo);
xswa.background_pixel=0;
xswa.border_pixel=0;
- xswa.colormap=theCmap;
- xswamask=CWBackPixel | CWBorderPixel | CWColormap;
+ //xswa.colormap=theCmap;
+ xswamask=CWBackPixel | CWBorderPixel;// | CWColormap;
#ifdef HAVE_XF86VM
if ( vm )
@@ -321,6 +321,9 @@
}
else
{
+ theCmap=vo_x11_create_colormap(&vinfo);
+ xswa.colormap=theCmap;
+ xswamask=CWBackPixel | CWBorderPixel | CWColormap;
if ( vo_window == None )
{
vo_window=XCreateWindow( mDisplay,mRootWin,

@ -0,0 +1 @@
POFILES = AUTO

1674
po/ar.po

File diff suppressed because it is too large Load Diff

1628
po/be.po

File diff suppressed because it is too large Load Diff

1644
po/br.po

File diff suppressed because it is too large Load Diff

1842
po/bs.po

File diff suppressed because it is too large Load Diff

1679
po/ca.po

File diff suppressed because it is too large Load Diff

1665
po/cs.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1694
po/cy.po

File diff suppressed because it is too large Load Diff

1682
po/da.po

File diff suppressed because it is too large Load Diff

1696
po/de.po

File diff suppressed because it is too large Load Diff

1687
po/el.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1715
po/es.po

File diff suppressed because it is too large Load Diff

1666
po/et.po

File diff suppressed because it is too large Load Diff

1678
po/fi.po

File diff suppressed because it is too large Load Diff

1691
po/fr.po

File diff suppressed because it is too large Load Diff

1667
po/ga.po

File diff suppressed because it is too large Load Diff

1692
po/gl.po

File diff suppressed because it is too large Load Diff

1688
po/he.po

File diff suppressed because it is too large Load Diff

1735
po/hi.po

File diff suppressed because it is too large Load Diff

1680
po/hu.po

File diff suppressed because it is too large Load Diff

1622
po/is.po

File diff suppressed because it is too large Load Diff

1802
po/it.po

File diff suppressed because it is too large Load Diff

1657
po/ja.po

File diff suppressed because it is too large Load Diff

1710
po/ka.po

File diff suppressed because it is too large Load Diff

2228
po/lt.po

File diff suppressed because it is too large Load Diff

1685
po/mt.po

File diff suppressed because it is too large Load Diff

1670
po/nb.po

File diff suppressed because it is too large Load Diff

1689
po/nl.po

File diff suppressed because it is too large Load Diff

1722
po/nn.po

File diff suppressed because it is too large Load Diff

1650
po/pa.po

File diff suppressed because it is too large Load Diff

1695
po/pl.po

File diff suppressed because it is too large Load Diff

1685
po/pt.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1631
po/ro.po

File diff suppressed because it is too large Load Diff

1686
po/ru.po

File diff suppressed because it is too large Load Diff

1945
po/rw.po

File diff suppressed because it is too large Load Diff

1657
po/sk.po

File diff suppressed because it is too large Load Diff

1688
po/sr.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1673
po/sv.po

File diff suppressed because it is too large Load Diff

1754
po/ta.po

File diff suppressed because it is too large Load Diff

1687
po/tr.po

File diff suppressed because it is too large Load Diff

1679
po/uk.po

File diff suppressed because it is too large Load Diff

1670
po/xx.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,2 @@
protocoldir = $(kde_servicesdir)
protocol_DATA = mms.protocol rtsp.protocol pnm.protocol

@ -0,0 +1,50 @@
[Protocol]
Class=:internet
Description=Microsoft Media Server Protocol
Description[af]=Mecrosoft Media Bediener Protokol
Description[ar]=ميفاق Microsoft لخادم الوسائط
Description[ca]=Protocol de servidor de medis de Microsoft
Description[cs]=Microsoft Media Server protokol
Description[da]=Microsoft Medieserver-protokol
Description[de]=Microsoft Media Server Protokoll
Description[el]=Πρωτόκολλο εξυπηρετητή πολυμέσων της Microsoft
Description[es]=Protocol Media Server de Microsoft
Description[et]=Microsoft Media Serveri protokoll
Description[fr]=Protocole Microsoft Media Server
Description[gl]=Protocolo Microsoft Media Server
Description[he]=פרוטוקול שרת מדיה של מיקרוסופט
Description[hi]=माइक्रोसॉफ्ट मीडिया सर्वर प्रोटोकॉल
Description[it]=Protocollo Microsoft Media Server
Description[ja]=Microsoft Media サーバプロトコル
Description[ka]=Microsoft Media Server-ის ოქმი
Description[lt]=Microsoft media serverio protokolas
Description[nb]=Microsoft Meida Server-protokoll
Description[nl]=Microsoft Media Server-protocol
Description[pa]=ਮਾਈਕਰੋਸਾਫਟ ਮੀਡਿਆ ਸਰਵਰ ਪਰੋਟੋਕਾਲ
Description[pt]=Protocolo Microsoft Media Server
Description[pt_BR]=Protocolo do Servidor de Mídia Microsoft
Description[ru]=Протокол Microsoft Media Server
Description[rw]=Porotokole Igihuza Seriveri ya Microsoft
Description[sk]=Microsoft Media Server (mms) Protokol
Description[sr]=Microsoft-ов протокол сервера медија
Description[sr@Latn]=Microsoft-ov protokol servera medija
Description[sv]=Microsoft mediaserver-protokoll
Description[ta]=மைக்ரோசாப்ட் ஊடக சேவக நெறிமுறை
Description[th]=โปรโตคอลระบบเซิร์ฟเวอร์กระจายสื่อของ Microsoft (mms)
Description[tr]=Microsoft Medya Sunucu Protokolü
Description[uk]=Протокол сервера Microsoft Media
Description[xx]=xxMicrosoft Media Server Protocolxx
Description[zh_TW]=Microsoft Media Server 通訊協定
exec=kmplayer "%u"
protocol=mms
input=none
output=none
helper=true
reading=false
listing=false
writing=false
makedir=false
deleting=false
linking=false
moving=false
Icon=kmplayer

@ -0,0 +1,15 @@
[Protocol]
Class=:internet
exec=kmplayer "%u"
protocol=pnm
input=none
output=none
helper=true
reading=false
listing=false
writing=false
makedir=false
deleting=false
linking=false
moving=false
Icon=kmplayer

@ -0,0 +1,15 @@
[Protocol]
Class=:internet
exec=kmplayer "%u"
protocol=rtsp
input=none
output=none
helper=true
reading=false
listing=false
writing=false
makedir=false
deleting=false
linking=false
moving=false
Icon=kmplayer

@ -0,0 +1,38 @@
The core of kmplayer is in kmplayerpartbase.x. PartBase keeps
the list of Source objects (dvd/vcd/url/..) and Process objects
(mplayer/xine/gst/xv), controls the View or respond to its signals. Both
application as kpart (for plugin) have one PartBase. However, in case of
plugin for khtml, it's possible one PartBase controls multible View
objects (see tests/controls.html).
The View is the parent of ViewArea, PlayList and InfoWindow. ViewArea is
the parent of Viewer (the output for the backend players) and
ControlPanel.
In case of smil animations, the Viewer widget can be hidden or made
smaller so ViewArea background is where the rendering is done.
Classes in kmplayerplaylist.x are actually base for the XML playlist
formats (smil/asx/rss/..).
There is always one Source object active. A Source object sets up the
interface to the user as far possible, handling playlists and launching
backends. This is not fully worked out yet, eg. URLSource should be able
to launch multible backends for smil. Which probably means that PartBase
should have a list of Process factories and Source objects a list of
running Process objects.
Backends are instances of Process and should be simple, just passing
data from/to external processes. A Recorder object is also a Process.
Though for mplayer, there is quite some code for output parsing.
The XML classes and parser provide a quick way for storing any XML file
in the playlist. Tree nodes build the tree themselves and recognized
multimedia elements more or less play the playlist themselves too.
The parser is build to recover from all kinds of typos. This is because
ASX is quite often full of XML errors that made other parsers give up,
eg. I've seen something like "<Title>Laurel & Hardy< / title>".
KMPlayerPart and KMPlayerApp are classes that use the above for plugin
and application.
Finally there is also a Settings class for general usage and for
launching the configure dialog.

@ -0,0 +1,80 @@
AM_CPPFLAGS= -I$(kde_includes)/kio $(CFLAGS_GST) $(all_includes) $(LIBCAIRO_CFLAGS) $(LIBNSPR_CFLAGS) $(LIBDBUS_CFLAGS)
METASOURCES= AUTO
lib_LTLIBRARIES= libkmplayercommon.la
libkmplayercommon_la_SOURCES = viewarea.cpp kmplayerview.cpp playlistview.cpp kmplayercontrolpanel.cpp kmplayerconfig.cpp pref.cpp kmplayerprocess.cpp kmplayer_callback.skel kmplayer_backend.stub kmplayerpartbase.cpp kmplayerplaylist.cpp kmplayer_asx.cpp kmplayer_smil.cpp kmplayer_rp.cpp kmplayer_rss.cpp kmplayer_atom.cpp kmplayer_xspf.cpp triestring.cpp kmplayerpartbase.skel
libkmplayercommon_la_LDFLAGS = -avoid-version $(all_libraries)
libkmplayercommon_la_LIBADD = -lkmediaplayer $(LIB_KPARTS) $(LIB_KUTILS) $(LIB_EXPAT) -lm $(LIBCAIRO_LIBS) $(LIBQTDBUS)
if include_koffice_support
kofficeplugin_lib= libkmplayerkofficepart.la
SERVICES_KOFFICE = kmplayer_koffice.desktop
endif
kde_module_LTLIBRARIES= libkmplayerpart.la $(kofficeplugin_lib)
libkmplayerpart_la_SOURCES= kmplayer_part.cpp
libkmplayerpart_la_LDFLAGS= -avoid-version $(all_libraries) $(KDE_RPATH)
libkmplayerpart_la_LIBADD= libkmplayercommon.la
libkmplayerkofficepart_la_SOURCES=kmplayer_koffice_part.cpp
libkmplayerkofficepart_la_LDFLAGS= -avoid-version $(all_libraries) $(KDE_RPATH)
libkmplayerkofficepart_la_LIBADD= libkmplayercommon.la $(LIB_KOFFICE)
kdeinit_LTLIBRARIES=kmplayer.la
kmplayer_la_SOURCES= main.cpp kmplayerapp.cpp kmplayertvsource.cpp kmplayerbroadcast.cpp kmplayervdr.cpp
kmplayer_la_LIBADD= libkmplayercommon.la
kmplayer_la_LDFLAGS= -module $(KDE_PLUGIN)
EXTRA_PROGRAMS = kxineplayer kxvplayer kgstplayer
if include_kxineplayer
kxineplayer_app = kxineplayer
endif
if include_kgstplayer
kgstplayer_app = kgstplayer
endif
if include_knpplayer
knpplayer_app = knpplayer
endif
bin_PROGRAMS= $(kxineplayer_app) kxvplayer $(kgstplayer_app) $(knpplayer_app)
noinst_LTLIBRARIES = libkmplayerbackend.la
libkmplayerbackend_la_SOURCES = kmplayer_backend.skel kmplayer_callback.stub
kxineplayer_LDADD= libkmplayerbackend.la $(LIB_XINE) -lDCOP
kxineplayer_CFLAGS= $(CFLAGS_XINE)
kxineplayer_LDFLAGS= $(all_libraries) $(KDE_RPATH)
kxineplayer_SOURCES= xineplayer.cpp
kxvplayer_LDADD= libkmplayerbackend.la -lDCOP -lXv
kxvplayer_LDFLAGS= $(all_libraries) $(KDE_RPATH)
kxvplayer_SOURCES= xvplayer.cpp
kgstplayer_LDADD= libkmplayerbackend.la $(LIB_GST) $(LIB_GST_PLUGINS) -lgstinterfaces-0.10 -lDCOP
kgstplayer_LDFLAGS= $(all_libraries) $(KDE_RPATH)
kgstplayer_SOURCES= gstplayer.cpp
knpplayer_LDADD= $(LIBNSPR_LIBS)
knpplayer_SOURCES= npplayer.c
xdg_apps_DATA = kmplayer.desktop
kde_services_DATA = kmplayer_part.desktop $(SERVICES_KOFFICE)
rc_DATA = kmplayerui.rc kmplayerpartui.rc
rcdir = $(kde_datadir)/kmplayer
conf_DATA = kmplayerrc
confdir = $(kde_confdir)
appsdatadir=$(kde_datadir)/kmplayer
appsdata_DATA= bookmarks.xml pluginsinfo noise.gif
dummy.cpp:
echo > dummy.cpp
messages: rc.cpp
$(XGETTEXT) *.cpp -o $(podir)/kmplayer.pot

@ -0,0 +1,670 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xbel>
<xbel folded="yes" >
<folder folded="yes" icon="bookmark_folder" >
<title>South America</title>
<folder folded="yes" icon="bookmark_folder" >
<title>Brazil</title>
<bookmark icon="video" href="http://www.bloomberg.com/streams/video/LiveBR_nb.ram" >
<title>Bloomberg TV Brazil</title>
</bookmark>
</folder>
</folder>
<folder folded="yes" icon="bookmark_folder" >
<title>Asia</title>
<folder folded="yes" icon="bookmark_folder" >
<title>TV</title>
<bookmark icon="video" href="http://www.bloomberg.com/streams/video/LiveAS_nb.ram" >
<title>Bloomberg TV Asia-Pacific</title>
</bookmark>
<bookmark icon="video" href="http://www.bloomberg.com/streams/video/LiveJA_nb.ram" >
<title>Bloomberg TV Japan</title>
</bookmark>
</folder>
</folder>
<folder folded="no" icon="bookmark_folder" >
<title>Europe</title>
<folder folded="no" icon="bookmark_folder" >
<title>belgium</title>
<folder folded="no" >
<title>flanders</title>
<bookmark icon="www" href="http://mp3.streampower.be/radio1-high.mp3" >
<title>Radio 1</title>
</bookmark>
<bookmark icon="www" href="http://mp3.streampower.be/sporza-high.mp3" >
<title>Sporza</title>
</bookmark>
<bookmark icon="www" href="http://mp3.streampower.be/ra2ant-high.mp3" >
<title>Radio 2 Antwerpen</title>
</bookmark>
<bookmark icon="www" href="http://mp3.streampower.be/ra2vlb-high.mp3" >
<title>Radio 2 Vlaams-Brabant</title>
</bookmark>
<bookmark icon="www" href="http://mp3.streampower.be/ra2lim-high.mp3" >
<title>Radio 2 Limburg</title>
</bookmark>
<bookmark icon="www" href="http://mp3.streampower.be/ra2ovl-high.mp3" >
<title>Radio 2 Oost-Vlaanderen</title>
</bookmark>
<bookmark icon="www" href="http://mp3.streampower.be/ra2wvl-high.mp3" >
<title>Radio 2 West-Vlaanderen</title>
</bookmark>
<bookmark icon="www" href="http://mp3.streampower.be/klara-high.mp3" >
<title>Klara</title>
</bookmark>
<bookmark icon="www" href="http://mp3.streampower.be/klaracontinuo-high.mp3" >
<title>Klara Continuo</title>
</bookmark>
<bookmark icon="www" href="http://mp3.streampower.be/stubru-high.mp3" >
<title>Studio Brussel</title>
</bookmark>
<bookmark icon="www" href="http://mp3.streampower.be/donna-high.mp3" >
<title>Donna</title>
</bookmark>
<bookmark icon="www" href="http://mp3.streampower.be/donnahitbits-high.mp3" >
<title>Donna Hitbits</title>
</bookmark>
<bookmark icon="www" href="http://mp3.streampower.be/rvi-high.mp3" >
<title>RVI</title>
</bookmark>
<bookmark icon="www" href="http://stream.urgent.fm/high.ogg" >
<title>Urgent.fm</title>
</bookmark>
<bookmark icon="www" href="http://www.beoneradio.be/modules/desktop/streaming/pls.aspx?mid=84" >
<title>Be One</title>
</bookmark>
<bookmark icon="www" href="http://mediaserver02.cybernet.be/contactnl" >
<title>Radio Contact</title>
</bookmark>
<bookmark icon="www" href="http://wm.streampower.be/qmusic_ahi" >
<title>Q-Music</title>
</bookmark>
<bookmark icon="www" href="http://www.topradio.be/new/website/topradioHigh.asx" >
<title>Topradio</title>
</bookmark>
<bookmark icon="www" href="http://www.4fm.be/streams/high.asx" >
<title>4fm</title>
</bookmark>
</folder>
</folder>
<folder folded="yes" icon="bookmark_folder" >
<title>czech republic</title>
<folder folded="yes" icon="bookmark_folder" >
<title>radio valc</title>
<bookmark icon="sound" href="http://www.radiovalc.cz/asx/valc-5.asx" >
<title>radio valc live</title>
</bookmark>
<bookmark icon="sound" href="http://www.radiovalc.cz/asx/valc1-2.asx" >
<title>radio valc 1 gold</title>
</bookmark>
<bookmark icon="sound" href="http://www.radiovalc.cz/asx/valc2-2.asx" >
<title>radio valc 2 country</title>
</bookmark>
<bookmark icon="sound" href="http://www.radiovalc.cz/asx/valc3-2.asx" >
<title>radio valc 3 hit</title>
</bookmark>
<bookmark icon="sound" href="http://www.radiovalc.cz/asx/valc4-2.asx" >
<title>radio valc 4 rock</title>
</bookmark>
<bookmark icon="sound" href="http://www.radiovalc.cz/asx/valc5-2.asx" >
<title>radio valc 5 classic</title>
</bookmark>
<bookmark icon="sound" href="http://www.radiovalc.cz/asx/valc6-2.asx" >
<title>radio valc 6 valcarka</title>
</bookmark>
<bookmark icon="sound" href="http://www.radiovalc.cz/asx/valc7-2.asx" >
<title>radio valc 7 folk</title>
</bookmark>
</folder>
<folder folded="yes" icon="bookmark_folder" >
<title>cesky rozhlas</title>
<bookmark icon="sound" href="mms://netshow4.live.cz/cro1-96" >
<title>cro1 radiozurnal</title>
</bookmark>
<bookmark icon="sound" href="mms://netshow4.live.cz/cro2-96" >
<title>cro2 praha</title>
</bookmark>
<bookmark icon="sound" href="http://amp1.cesnet.cz:8000/cro3.ogg" >
<title>cro3 vltava</title>
</bookmark>
<bookmark icon="sound" href="mms://netshow3.live.cz/crocb48" >
<title>cro ceske budejovice</title>
</bookmark>
<bookmark icon="sound" href="mms://netshow3.live.cz/crohk48" >
<title>cro hradec kralove</title>
</bookmark>
<bookmark icon="sound" href="mms://netshow3.live.cz/crool48" >
<title>cro olomouc</title>
</bookmark>
<bookmark icon="sound" href="mms://netshow3.live.cz/croov48" >
<title>cro ostrava</title>
</bookmark>
<bookmark icon="sound" href="mms://netshow3.live.cz/croplzen64" >
<title>cro plzen</title>
</bookmark>
<bookmark icon="sound" href="mms://netshow3.live.cz/croregion48" >
<title>cro stredni cechy</title>
</bookmark>
</folder>
<bookmark icon="sound" href="http://amp.cesnet.cz:8000/akropolis.ogg" >
<title>radio akropolis</title>
</bookmark>
<bookmark icon="sound" href="mms://netshow3.live.cz/krokodyl32" >
<title>krokodyl</title>
</bookmark>
<bookmark icon="sound" href="mms://netshow3.live.cz/joeradioi64" >
<title>joe</title>
</bookmark>
<bookmark icon="sound" href="mms://netshow3.live.cz/croregina-32" >
<title>regina</title>
</bookmark>
<bookmark icon="sound" href="mms://netshow3.live.cz/kisshady32" >
<title>kiss hady</title>
</bookmark>
<bookmark icon="sound" href="mms://netshow3.live.cz/proglas32" >
<title>proglas</title>
</bookmark>
<bookmark icon="sound" href="mms://netshow4.live.cz/country128" >
<title>country radio</title>
</bookmark>
<bookmark icon="sound" href="mms://netshow3.live.cz/kissproton32" >
<title>proton</title>
</bookmark>
<bookmark icon="sound" href="mms://netshow3.atlas.cz/beat32" >
<title>radio beat</title>
</bookmark>
<bookmark icon="sound" href="mms://82.208.28.37/expres128" >
<title>expresradio</title>
</bookmark>
<bookmark icon="sound" href="mms://netshow3.live.cz/kiss64" >
<title>kiss 98 fm</title>
</bookmark>
<bookmark icon="sound" href="mms://netshow3.live.cz/radio164" >
<title>radio1</title>
</bookmark>
<bookmark icon="sound" href="mms://netshow3.live.cz/kisspublikum48" >
<title>kiss publikum</title>
</bookmark>
<bookmark icon="sound" href="mms://netshow3.live.cz/apollo64" >
<title>radio apollo</title>
</bookmark>
<bookmark icon="sound" href="mms://netshow3.live.cz/evropa2-32" >
<title>evropa 2</title>
</bookmark>
<bookmark icon="sound" href="mms://netshow3.live.cz/crystal64" >
<title>radio crystal</title>
</bookmark>
<bookmark icon="sound" href="mms://195.113.135.100/northmusic" >
<title>northmusic</title>
</bookmark>
<bookmark icon="sound" href="mms://82.208.28.37/sumava64" >
<title>radio sumava</title>
</bookmark>
<bookmark icon="sound" href="mms://82.208.28.37/karolina64" >
<title>radio karolina</title>
</bookmark>
<bookmark icon="sound" href="mms://netshow3.live.cz/hity64" >
<title>fajn radio hity</title>
</bookmark>
<bookmark icon="sound" href="mms://netshow3.live.cz/kisspublikum48" >
<title>kiss fm</title>
</bookmark>
<bookmark icon="sound" href="mms://netshow3.live.cz/kissmorava48" >
<title>kiss morava</title>
</bookmark>
<bookmark icon="sound" href="mms://82.208.28.37/cernahora128" >
<title>cerna hora</title>
</bookmark>
<bookmark icon="sound" href="mms://82.208.28.37/fmplus64" >
<title>radio fm plus</title>
</bookmark>
<bookmark icon="sound" href="mms://82.208.28.37/helax128" >
<title>helax</title>
</bookmark>
<bookmark icon="sound" href="mms://82.208.28.37/impuls128" >
<title>radio impuls</title>
</bookmark>
<bookmark icon="sound" href="mms://netshow4.live.cz/inforadio128" >
<title>radio info</title>
</bookmark>
<bookmark icon="sound" href="mms://netshow3.live.cz/life64" >
<title>radio life fajn</title>
</bookmark>
<bookmark icon="sound" href="mms://82.208.28.37/relax64" >
<title>radio relax</title>
</bookmark>
</folder>
<folder folded="yes" icon="bookmark_folder" >
<title>denmark</title>
<bookmark icon="sound" href="http://wmsc.dr.dk/e02ch01m?wmcontentbitrate=300000/.wma" >
<title>P1</title>
</bookmark>
<bookmark icon="sound" href="http://wmsc.dr.dk/e02ch02m?wmcontentbitrate=300000/.wma" >
<title>P2</title>
</bookmark>
<bookmark icon="sound" href="http://wmsc.dr.dk/e02ch03m?wmcontentbitrate=300000" >
<title>P3</title>
</bookmark>
<bookmark icon="sound" href="http://wmsc.dr.dk/e04ch04m?wmcontentbitrate=300000/.wma" >
<title>Kanal 94</title>
</bookmark>
<bookmark icon="sound" href="http://wmsc.dr.dk/e04ch06m?wmcontentbitrate=300000/.wma" >
<title>Radio Fyn</title>
</bookmark>
<bookmark icon="sound" href="http://wmsc.dr.dk/e04ch08m?wmcontentbitrate=300000/.wma" >
<title>Bornholms Radio</title>
</bookmark>
<bookmark icon="sound" href="http://wmsc.dr.dk/e04ch07m?wmcontentbitrate=300000/.wma" >
<title>Regionalen</title>
</bookmark>
<bookmark icon="sound" href="http://wmsc.dr.dk/e04ch09m?wmcontentbitrate=300000/.wma" >
<title>Københavns Radio</title>
</bookmark>
<bookmark icon="sound" href="http://wmsc.dr.dk/e04ch05m?wmcontentbitrate=300000/.wma" >
<title>Radio Syd</title>
</bookmark>
<bookmark icon="sound" href="http://wmsc.dr.dk/e04ch03m?wmcontentbitrate=300000/.wma" >
<title>Østjyllands Radio</title>
</bookmark>
<bookmark icon="sound" href="http://wmsc.dr.dk/e04ch02m?wmcontentbitrate=300000/.wma" >
<title>Radio Midt &amp; Vest</title>
</bookmark>
<bookmark icon="sound" href="http://wmsc.dr.dk/e02ch09m?wmcontentbitrate=300000/.wma" >
<title>DR Barometer</title>
</bookmark>
<bookmark icon="sound" href="http://wmsc.dr.dk/e02ch07m?wmcontentbitrate=300000/.wma" >
<title>DR Boogieradio</title>
</bookmark>
<bookmark icon="sound" href="http://wmsc.dr.dk/e06ch02m?wmcontentbitrate=300000/.wma" >
<title>DR Erhverv</title>
</bookmark>
<bookmark icon="sound" href="http://wmsc.dr.dk/e02ch08m?wmcontentbitrate=300000/.wma" >
<title>DR Ghetto</title>
</bookmark>
<bookmark icon="sound" href="http://wmsc.dr.dk/e06ch01m?wmcontentbitrate=300000/.wma" >
<title>DR Gyldne Genhør</title>
</bookmark>
<bookmark icon="sound" href="http://wmsc.dr.dk/e02ch05m?wmcontentbitrate=300000/.wma" >
<title>DR Jazz</title>
</bookmark>
<bookmark icon="sound" href="http://wmsc.dr.dk/e02ch06m?wmcontentbitrate=300000/.wma" >
<title>DR Klassisk</title>
</bookmark>
<bookmark icon="sound" href="http://wmsc.dr.dk/e04ch11m?wmcontentbitrate=300000/.wma" >
<title>DR Nyheder</title>
</bookmark>
<bookmark icon="sound" href="http://wmsc.dr.dk/e02ch04m?wmcontentbitrate=300000/.wma" >
<title>DR Rock</title>
</bookmark>
<bookmark icon="sound" href="http://wmsc.dr.dk/e04ch10m?wmcontentbitrate=300000/.wma" >
<title>DR Soft</title>
</bookmark>
<bookmark icon="sound" href="http://wms.dr.dk/e02ch12m?wmcontentbitrate=300000/.wma" >
<title>DR Sport</title>
</bookmark>
</folder>
<folder folded="yes" >
<folder folded="yes" >
<title>TV</title>
<bookmark icon="video" href="http://www.itele.fr/smi/direct.smi" >
<title>I Télévision</title>
</bookmark>
<bookmark icon="video" href="http://www.bloomberg.com/streams/video/LiveFR_nb.ram" >
<title>Bloomberg TV France</title>
</bookmark>
<bookmark icon="video" href="http://www.bbc.co.uk/newsa/n5ctrl/tvseq/n24.ram" >
<title>bbc news</title>
</bookmark>
</folder>
<title>france</title>
<bookmark icon="sound" href="mms://vip8.yacast.fr/encodereurope1" >
<title>europe1</title>
</bookmark>
<bookmark icon="sound" href="mms://vip6.yacast.fr/encodercheriefm" >
<title>cherie FM</title>
</bookmark>
<bookmark icon="sound" href="mms://viptvr.yacast.fr/tvr_vibration?site" >
<title>vibration</title>
</bookmark>
<bookmark icon="sound" href="http://www.tv-radio.com/station/rfi/rfi-20k.asx" >
<title>rfi</title>
</bookmark>
<bookmark icon="sound" href="http://ogg.tv-radio.fr:1441/encoderfinter.ogg" >
<title>france-inter</title>
</bookmark>
<bookmark icon="sound" href="mms://viptvr2.yacast.fr/encoderfranceinfo" >
<title>france info</title>
</bookmark>
<bookmark icon="sound" href="mms://vip6.yacast.fr/encoderrmc" >
<title>rmc</title>
</bookmark>
<bookmark icon="sound" href="mms://vip6.yacast.fr/encoderrtl" >
<title>rtl</title>
</bookmark>
<bookmark icon="sound" href="mms://vip6.yacast.fr/encodernrj" >
<title>nrj</title>
</bookmark>
<bookmark icon="sound" href="mms://vip6.yacast.fr/encodernostalgie" >
<title>nostalgie</title>
</bookmark>
<bookmark icon="sound" href="mms://vip2.yacast.fr/encoderfun" >
<title>fun</title>
</bookmark>
<bookmark icon="sound" href="http://stream.servstream.com/ViewWeb/BBCRadio_music/Event/BBCRadio7.asx" >
<title>bbc 7</title>
</bookmark>
<bookmark icon="sound" href="http://www.live365.com/play/127730?membername=abfjungle" >
<title>abf</title>
</bookmark>
<bookmark icon="sound" href="mms://viptvr2.yacast.fr/tvr_europe2" >
<title>europe 2</title>
</bookmark>
<bookmark icon="sound" href="http://ogg.tv-radio.fr:1441/encoderfip.ogg" >
<title>fip</title>
</bookmark>
<bookmark icon="sound" href="mms://viptvr.yacast.fr/tvr_franceculture" >
<title>franceculture</title>
</bookmark>
<bookmark icon="sound" href="mms://viptvr2.yacast.fr/tvr_rfm" >
<title>rfm</title>
</bookmark>
<bookmark icon="sound" href="mms://vip2.yacast.fr/encoderrtl2" >
<title>rtl2</title>
</bookmark>
<bookmark icon="sound" href="mms://vip2.yacast.fr/encoderskyrock" >
<title>skyrock</title>
</bookmark>
<bookmark icon="sound" href="mms://vip2.yacast.fr/encoderrireetchansons" >
<title>rireet chansons</title>
</bookmark>
<bookmark icon="sound" href="mms://viptvr.yacast.fr/tvr_francemusiques2" >
<title>france musique</title>
</bookmark>
<bookmark icon="sound" href="http://trevize.letsgozik.com:44444/letsgozik_56" >
<title>Let's Go Zik</title>
</bookmark>
</folder>
<folder folded="yes" >
<title>germany</title>
<folder folded="yes" >
<title>TV</title>
<bookmark icon="video" href="http://www.bloomberg.com/streams/video/LiveDE_nb.ram" >
<title>Bloomberg TV Germany</title>
</bookmark>
<bookmark icon="video" href="http://broadcast.giga.de" >
<title>GIGA TV</title>
</bookmark>
</folder>
<bookmark icon="sound" href="mms://213.200.75.252/antenne1$livestream.wma" >
<title>hit radio antenne 1</title>
</bookmark>
<bookmark icon="sound" href="mms://213.200.64.231/radiohamburg$livestream.wma" >
<title>radio hamburg</title>
</bookmark>
<bookmark icon="sound" href="mms://213.200.64.227/fettesradio$livestream.wma" >
<title>89.0 rtl</title>
</bookmark>
<bookmark icon="sound" href="mms://62.146.11.2/2884starfm_live.wmv?cid=47241&amp;dummy=.wmv" >
<title>107.8 star fm</title>
</bookmark>
<bookmark icon="sound" href="rtsp://213.200.64.166/farm/pull2/62.89.187.100%3A2030/encoder/rockland/livestream.rm" >
<title>rockland sachsen-anhalt</title>
</bookmark>
</folder>
<folder folded="yes" >
<title>greece</title>
<bookmark icon="sound" href="http://64.246.32.39:8906/" >
<title>Cosmoradio</title>
</bookmark>
</folder>
<folder folded="yes" >
<title>hungary</title>
<bookmark icon="sound" href="http://yp.tilos.hu:9000/tilos_high.ogg" >
<title>Tilos Radio </title>
</bookmark>
<bookmark icon="sound" href="http://195.184.2.4:8000/" >
<title>Csaba Radio</title>
</bookmark>
<bookmark icon="sound" href="http://broadcast.jazzradio.hu/jazzradio-128" >
<title>Jazz Radio</title>
</bookmark>
</folder>
<folder folded="yes" >
<title>ireland</title>
<bookmark icon="sound" href="http://69.57.152.94:8000" >
<title>Live Ireland</title>
</bookmark>
</folder>
<folder folded="yes" >
<title>italy</title>
<folder folded="yes" icon="bookmark_folder" >
<title>TV</title>
<bookmark icon="video" href="http://www.bloomberg.com/streams/video/LiveIT_nb.ram" >
<title>Bloomberg TV Italy</title>
</bookmark>
</folder>
<bookmark icon="sound" href="mms://62.101.104.172/company" >
<title>Company</title>
</bookmark>
<bookmark icon="sound" href="http://213.92.19.12:80/radiodeejay2?MSWMExt=.asf" >
<title>DeeJay</title>
</bookmark>
<bookmark icon="sound" href="mms://livemedia.kataweb.it/Radio_m2o" >
<title>M2O</title>
</bookmark>
<bookmark icon="sound" href="rtsp://live.media.rai.it/broadcast/radiouno.rm" >
<title>Radio Uno</title>
</bookmark>
<bookmark icon="sound" href="rtsp://live.media.rai.it/broadcast/radiodue.rm" >
<title>Radio Due</title>
</bookmark>
<bookmark icon="sound" href="rtsp://live.media.rai.it/broadcast/radiotre.rm" >
<title>Radio Tre</title>
</bookmark>
</folder>
<folder folded="yes" >
<title>macedonia</title>
<bookmark icon="sound" href="http://195.26.152.92:8000/" >
<title>City Radio</title>
</bookmark>
</folder>
<folder folded="yes" >
<title>netherlands</title>
<bookmark icon="video" href="http://cgi.omroep.nl/cgi-bin/streams?/tv/nos/journaal/bb.laatste.rm" >
<title>NOS Journaal</title>
</bookmark>
<bookmark icon="sound" href="http://213.10.138.62:8000" >
<title>DBS Radio</title>
</bookmark>
</folder>
<folder folded="yes" >
<title>norway</title>
<bookmark icon="sound" href="http://radio.metalexpress.no:7128" >
<title>metal express</title>
</bookmark>
</folder>
<folder folded="yes" >
<title>russia</title>
<bookmark icon="sound" href="http://horus.mtu.ru:9000/" >
<title>Europa Plus</title>
</bookmark>
<bookmark icon="sound" href="http://channel1.region72.ru:8000" >
<title>Red Army Radio</title>
</bookmark>
</folder>
<folder folded="yes" >
<title>san marino</title>
<bookmark icon="video" href="mms://streaming-1.intelcom.sm/Live Radio" >
<title>san marino</title>
</bookmark>
</folder>
<folder folded="yes" icon="bookmark_folder" >
<title>slovakia</title>
<folder folded="yes" icon="bookmark_folder" >
<title>TV</title>
<bookmark icon="video" href="http://www.joj.sk/tvarchiv/video/playlist/playlist.wvx?video=random" >
<title>joj</title>
</bookmark>
<bookmark icon="video" href="mmsh://mslive2.markiza.sk/markiza/" >
<title>markíza</title>
</bookmark>
</folder>
<bookmark icon="sound" href="http://www.flash.viapvt.sk/Zive_vysielanie.ram" >
<title>flash</title>
</bookmark>
<bookmark icon="sound" href="http://ra.slovakradio.sk:8000/RockFM_Live_32_kb" >
<title>RockFM</title>
</bookmark>
<bookmark icon="sound" href="http://stream.radiozet.sk:8000/radiozet96kbit" >
<title>zet</title>
</bookmark>
<bookmark icon="sound" href="http://ra.slovakradio.sk:8000/SlovakRadio_Live_32_kb" >
<title>slovensko</title>
</bookmark>
<bookmark icon="sound" href="mmsh://195.98.128.202:80/twist" >
<title>twist radio</title>
</bookmark>
<bookmark icon="sound" href="http://www.rferl.org/realaudio/c13.ram" >
<title>Radio Slobodna Europa</title>
</bookmark>
<bookmark icon="sound" href="http://www.bbc.co.uk/slovak/vak.ram" >
<title>BBC World Service Slovak</title>
</bookmark>
<bookmark icon="sound" href="http://62.168.116.98:8000/dsp0" >
<title>fun radio</title>
</bookmark>
<bookmark icon="sound" href="mms://live.okey.sk/OKEY" >
<title>radio okey</title>
</bookmark>
<bookmark icon="sound" href="http://www.lumen.sk/real/live.ram" >
<title>lumen</title>
</bookmark>
<bookmark icon="sound" href="http://www.internetradio.cz/duha.asx" >
<title>duha</title>
</bookmark>
<bookmark icon="sound" href="mms://81.0.210.137/nradio" >
<title>nradio</title>
</bookmark>
<bookmark icon="sound" href="http://live.jaseus.sk:8000/rf32.ogg" >
<title>frontinus</title>
</bookmark>
</folder>
<folder folded="yes" >
<title>slovenia</title>
<bookmark icon="sound" href="http://193.95.242.36:8000/" >
<title>Libra Radio</title>
</bookmark>
</folder>
<folder folded="yes" >
<title>spain</title>
<folder folded="yes" icon="bookmark_folder" >
<title>TV</title>
<bookmark icon="video" href="http://www.bloomberg.com/streams/video/LiveES_nb.ram" >
<title>Bloomberg TV Spain</title>
</bookmark>
</folder>
<bookmark icon="sound" href="http://www.onamallorca.net:8000/ona.ogg" >
<title>Ona Mallorca</title>
</bookmark>
<bookmark icon="sound" href="http://217.125.97.68:80/" >
<title>Alpicat Radio</title>
</bookmark>
</folder>
<folder folded="yes" >
<title>united kingdom</title>
<folder folded="yes" icon="bookmark_folder" >
<title>virgin radio</title>
<bookmark icon="sound" href="http://ogg.smgradio.com/vr32.ogg" >
<title>1215AM</title>
</bookmark>
<bookmark icon="sound" href="http://ogg.smgradio.com/vr160.ogg" >
<title>1215AM (broadband)</title>
</bookmark>
<bookmark icon="sound" href="http://ogg.smgradio.com/vc32.ogg" >
<title>classic rock</title>
</bookmark>
<bookmark icon="sound" href="http://ogg.smgradio.com/vc160.ogg" >
<title>classic rock (broadband)</title>
</bookmark>
<bookmark icon="sound" href="http://ogg.smgradio.com/gr32.ogg" >
<title>groove</title>
</bookmark>
<bookmark icon="sound" href="http://ogg.smgradio.com/gr160.ogg" >
<title>groove (broadband)</title>
</bookmark>
</folder>
<folder folded="yes" icon="bookmark_folder" >
<title>TV</title>
<bookmark icon="video" href="http://www.bloomberg.com/streams/video/LiveUK_nb.ram" >
<title>Bloomberg TV UK</title>
</bookmark>
</folder>
<bookmark icon="sound" href="http://live.urn1350.net:8080/urn_high.ogg" >
<title>URN</title>
</bookmark>
</folder>
</folder>
<folder folded="yes" icon="bookmark_folder" >
<title>North America</title>
<folder folded="yes" >
<title>USA</title>
<folder folded="yes" icon="bookmark_folder" >
<title>TV</title>
<bookmark icon="video" href="http://www.bloomberg.com/streams/video/LiveBTV56.ramx" >
<title>Bloomberg TV US</title>
</bookmark>
<bookmark icon="video" href="http://www.bloomberg.com/streams/video/LiveBTV200.ramx" >
<title>Bloomberg TV US (broadband)</title>
</bookmark>
</folder>
<folder folded="yes" >
<title>NH</title>
<bookmark icon="sound" href="http://www.WNTK.COM/audio/wntk.ram" >
<title>WNTK</title>
</bookmark>
<bookmark icon="sound" href="http://wunh.unh.edu:8000/" >
<title>WUNH</title>
</bookmark>
</folder>
<folder folded="yes" >
<title>NY</title>
<bookmark icon="sound" href="http://205.188.234.68:8002" >
<title>Digitally Imported - EuroDance</title>
</bookmark>
<bookmark icon="sound" href="http://64.236.34.97:80/stream/1019" >
<title>Digitally Imported - Modern Jazz</title>
</bookmark>
<bookmark icon="sound" href="http://69.31.76.84:8000" >
<title>MostlyClassical.com</title>
</bookmark>
</folder>
<bookmark icon="sound" href="mms://media.apex2000.net/KQRX" >
<title>kqrx 95x</title>
</bookmark>
<bookmark icon="sound" href="rtsp://media.monroe.edu/encoder/live2.ra" >
<title>wber 90.5 fm</title>
</bookmark>
<bookmark icon="sound" href="rtsp://streamer.kozt.com/encoder/live.rm" >
<title>the coast kozt fm</title>
</bookmark>
</folder>
<folder folded="yes" >
<title>Canada</title>
<bookmark icon="sound" href="http://caracal.rttinc.com:8002/" >
<title>CIZZ Zed 99 </title>
</bookmark>
<bookmark icon="sound" href="http://caracal.rttinc.com:8004/" >
<title>CKGY Country </title>
</bookmark>
<bookmark icon="sound" href="http://oggtrial.nm.cbc.ca:80/cbcr1-toronto.ogg" >
<title>CBC - radioONE</title>
</bookmark>
</folder>
<folder folded="yes" >
<title>Mexico</title>
<bookmark icon="sound" href="http://66.98.138.13:9520/" >
<title>XEMA B15 </title>
</bookmark>
</folder>
</folder>
</xbel>

@ -0,0 +1,38 @@
#!/usr/bin/env kjscmd
/**
* Simple video widget added to your own KJSEmbed application that plays a movie
*/
// Create main view
var mw = new KMainWindow();
var box = new QVBox( mw );
mw.setCentralWidget(box);
var part = Factory.createROPart("application/x-kmplayer", box, "video_win");
/**
* KJS Bindings for KDE-3.3 also allows passing extra arguments to the part
* This allows to split of the control panel from the video widget:
var part = Factory.createROPart("application/x-kmplayer", "'KParts/ReadOnlyPart' in ServiceTypes", box, "video_win", ["CONSOLE=foo", "CONTROLS=ImageWindow"]);
var part1 = Factory.createROPart("application/x-kmplayer", "'KParts/ReadOnlyPart' in ServiceTypes", box, "control_win", ["CONSOLE=foo", "CONTROLS=ControlPanel"]);
* The order in which the part are created doesn't really matter. Also on which
* part openURL is called should not make a difference
*/
/**
* There are at least two ways to communicate with kmplayer part
* 1. use the slots of the part (see below), an array of slots is returned by
* part.slots()
* 2. use kmplayer's DCOP interface
*/
var stopbutton = new QPushButton( box, 'Stop' );
stopbutton.text = "&Stop";
mw.connect( stopbutton, 'clicked()', part, 'stop()' );
part.openURL( "file:/home/koos/doc/example.avi" );
mw.show();
application.exec();

@ -0,0 +1,59 @@
<html><head><title>crash.html</title></head>
<script>
var entriecount = 0;
var currentid = -1;
function writeMenu(node, doc) {
if (!node) return;
if (node.nodeName == "video") {
var src = node.getAttribute("src");
var title = node.getAttribute("title");
if (!title || title == "")
title = "no title";
doc.write("<tr><td id='" + entriecount + "'><a href=\"javascript:top.play(" + entriecount + ",'" + src + "')\">" + title + "</a></td></tr>");
entriecount++;
}
for (var i = 0; i < node.childNodes.length; i++)
writeMenu(node.childNodes.item(i), doc);
}
function loadXML(url) {
try {
var xmldoc = document.implementation.createDocument("", "", null);
xmldoc.async = false;
xmldoc.load(url);
var doc = menuframe.document;
doc.open();
doc.write("<html><style>\nbody {color:#a0a0a0;background-color:#323232;}\ntd {font-size:9pt;}\na {color:#fffff0;}\n</style><body bgcolor='#323232'><table>");
entriecount = 0;
writeMenu(xmldoc.firstChild, doc);
doc.write("</table></body></html>");
doc.close();
doc = playerframe.document;
doc.open();
doc.write("<html><body bgcolor='#161616'></body></html>");
doc.close();
} catch(ex) {
alert ("Error: " + ex);
}
}
function play(id, url) {
if (currentid > -1) {
var td = menuframe.document.getElementById(currentid);
td.style.backgroundColor = '#323232';
}
var td = menuframe.document.getElementById(id);
td.style.backgroundColor = '#646464';
currentid = id;
var doc = playerframe.document;
doc.open();
doc.write("<html><body bgcolor='#161616'><embed type='video/x-ms-wmv' src='" + url + "' width='100%' height='100%'><script>\nfunction onFinished(){top.finished(" + id + ");}\n<\/script></embed></body></html>");
doc.close();
}
function finished(id) {
var td = menuframe.document.getElementById(id);
td.style.backgroundColor = '#323232';
}
</script>
<frameset cols="200,*" onLoad="loadXML('file:/your-smil.xml')">
<frame name="menuframe" src="about:blank">
<frame name="playerframe" src="about:blank">
</html>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,64 @@
/* This file is part of the KMPlayer application
Copyright (C) 2004 Koos Vriezen <koos.vriezen@xs4all.nl>
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 2 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; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _K_GST_PLAYER_H_
#define _K_GST_PLAYER_H_
#include <qapplication.h>
#include <qstring.h>
#include <qsessionmanager.h>
struct GstSizeEvent : public QEvent {
GstSizeEvent (int l, int w, int h);
int length;
int width;
int height;
};
struct GstProgressEvent : public QEvent {
GstProgressEvent (int p);
int progress;
};
class KGStreamerPlayer : public QApplication {
Q_OBJECT
public:
KGStreamerPlayer (int argc, char ** argv);
~KGStreamerPlayer ();
void init ();
void finished ();
void saturation (int val);
void hue (int val);
void contrast (int val);
void brightness (int val);
void volume (int val);
void seek (int val);
bool event (QEvent * e);
public slots:
void play (int repeat_count);
void stop ();
void pause ();
void updatePosition ();
//void postFinished ();
protected:
void saveState (QSessionManager & sm);
};
#endif //_K_GST_PLAYER_H_

@ -0,0 +1,100 @@
# KDE Config File
[Desktop Entry]
Encoding=UTF-8
Type=Application
Exec=kmplayer -caption "%c" %i %m %U
Icon=kmplayer.png
DocPath=kmplayer/index.html
Comment=KDE interface for MPlayer
Comment[af]=KDE koppelvlak na MPlayer
Comment[ar]=واجهة KDE لِــ MPlayer
Comment[be]=KDE інтэрфейс да MPlayer
Comment[bg]=KDE интерфейс за MPlayer
Comment[br]=Etrefas MPlayer evit KDE
Comment[bs]=KDE interfejs za MPlayer
Comment[ca]=Interfície KDE per a MPlayer
Comment[cs]=KDE rozhraní pro MPlayer
Comment[csb]=Interfejs KDE dlô MPlayer
Comment[da]=KDE-grænseflade for MPlayer
Comment[de]=KDE-Oberfläche für MPlayer
Comment[el]=Περιβάλλον χρήσης του MPlayer για το KDE
Comment[es]=Interfaz KDE para MPlayer
Comment[et]=KDE MPlayeri liides
Comment[fi]=KDE-käyttöliittymä MPlayerille
Comment[fr]=Une interface de MPlayer pour KDE
Comment[gl]=Interface de KDE para MPlayer
Comment[he]=ממשק KDE של MPlayer
Comment[hi]=एमप्लेयर हेतु केडीई इंटरफेस
Comment[hu]=KDE-alapú felület az MPlayerhez
Comment[it]=Interfaccia KDE per MPlayer
Comment[ja]=MPlayer の KDE インターフェース
Comment[nb]=KDE-grensesnitt for MPlayer
Comment[nl]=KDE-interface voor MPlayer
Comment[pa]=MPlayer ਲਈ KDE ਇੰਟਰਫੇਸ
Comment[pt]=Interface KDE para o MPlayer
Comment[pt_BR]=Interface do KDE para o MPlayer
Comment[ru]=Интерфейс KDE для MPlayer
Comment[sk]=KDE rozhranie pre MPlayer
Comment[sr]=KDE-ов интерфејс за MPlayer
Comment[sr@Latn]=KDE-ov interfejs za MPlayer
Comment[sv]=KDE-gränssnitt för Mplayer
Comment[ta]=எம் இயக்கிக்கான கேடீஇ இடைமுகம்
Comment[th]=ระบบติดต่อผู้ใช้แบบ KDE ของ MPlayer
Comment[tr]=MPlayer için KDE arayüzü
Comment[uk]=Інтерфейс KDE для MPlayer
Comment[xx]=xxKDE interface for MPlayerxx
Comment[zh_CN]=MPlayer 的 KDE 界面
Comment[zh_TW]=Mplayer 的 KDE 介面
Terminal=false
Name=KMPlayer
Name[hi]=केएमप्लेयर
Name[hu]=KMPLayer
Name[sv]=Kmplayer
Name[ta]=கேஎம்இயக்கி
Name[xx]=xxKMPlayerxx
MimeType=application/ogg;application/smil;application/vnd.ms-asf;application/vnd.rn-realmedia;application/x-kmplayer;application/x-mplayer2;application/x-ogg;application/xspf+xml;video/avi;video/mediaplayer;video/mp4;video/mpeg;video/quicktime;video/vnd.rn-realvideo;video/x-avi;video/x-flic;video/x-matroska;video/x-ms-asf;video/x-msvideo;video/x-ms-wmp;video/x-ms-wmv;video/x-ms-wvx;video/x-ogm;video/x-theora;uri/mms;uri/pnm;uri/rtspt;uri/rtspu;
InitialPreference=5
Categories=Qt;KDE;AudioVideo;
GenericName=Media Player
GenericName[af]=Media Speler
GenericName[ar]= قارئ الوسئط
GenericName[be]=Медыяпрайгравальнік
GenericName[bg]=Медия плеър
GenericName[br]=Soner liesvedia
GenericName[ca]=Reproductor de medis
GenericName[cs]=Přehrávač médií
GenericName[csb]=Òdgrëwôcz lopków wideò
GenericName[cy]=Chwaraeydd Cyfryngau
GenericName[da]=Medieafspiller
GenericName[el]=Αναπαραγωγή πολυμέσων
GenericName[es]=Reproductor multimedia
GenericName[et]=Meediamängija
GenericName[fr]=Lecteur multimédia
GenericName[ga]=Seinnteoir Meán
GenericName[gl]=Reprodutor Multimédia
GenericName[he]=נגן מדיה
GenericName[hi]=मीडिया प्लेयर
GenericName[hu]=Médialejátszó
GenericName[it]=Lettore multimediale
GenericName[ja]=メディアプレーヤ
GenericName[ka]=მედიადამკვრელი
GenericName[lt]=Media grotuvas
GenericName[mk]=Изведувач на мултимедиа
GenericName[nb]=Mediaspiller
GenericName[nl]=Mediaspeler
GenericName[pa]=ਮੀਡਿਆ ਪਲੇਅਰ
GenericName[pt]=Leitor Multimédia
GenericName[pt_BR]=Reprodutor de Mídia
GenericName[ru]=Медиаплеер
GenericName[sk]=Multimediálny prehrávač
GenericName[sr]=Медија плејер
GenericName[sr@Latn]=Medija plejer
GenericName[sv]=Mediaspelare
GenericName[th]=โปรแกรมเล่นสื่อ
GenericName[tr]=Medya Oynatıcı
GenericName[uk]=Аудіо-відео програвач
GenericName[xh]=Umdlali we Midia
GenericName[xx]=xxMedia Playerxx
GenericName[zh_CN]=媒体播放器
GenericName[zh_TW]=媒體播放程式
GenericName[zu]=Umdlali Wezezindaba

@ -0,0 +1,204 @@
/***************************************************************************
kmplayer.h - description
-------------------
begin : Sat Dec 7 16:14:51 CET 2002
copyright : (C) 2002 by Koos Vriezen
email :
***************************************************************************/
/***************************************************************************
* *
* 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 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef KMPLAYER_H
#define KMPLAYER_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <kapp.h>
#include <kmainwindow.h>
#include <kaccel.h>
#include <kaction.h>
#include <kurl.h>
#include "kmplayerplaylist.h"
static const int id_status_msg = 1;
static const int id_status_timer = 2;
class QPopupMenu;
class QMenuItem;
class QListViewItem;
class KProcess;
class KMPlayerBroadcastConfig;
class KMPlayerFFServerConfig;
class KSystemTray;
namespace KMPlayer {
class View;
class PartBase;
class Source;
class KMPlayerDVDSource;
class KMPlayerDVDNavSource;
class KMPlayerVCDSource;
class KMPlayerPipeSource;
class KMPlayerTVSource;
class FFMpeg;
class PlayListItem;
} // namespace
class KMPlayerApp : public KMainWindow
{
Q_OBJECT
public:
KMPlayerApp (QWidget* parent=0, const char* name=0);
~KMPlayerApp ();
void openDocumentFile (const KURL& url=KURL());
void addURL (const KURL& url);
KMPlayer::PartBase * player () const { return m_player; }
void resizePlayer (int percentage);
KDE_NO_EXPORT KRecentFilesAction * recentFiles () const { return fileOpenRecent; }
KDE_NO_EXPORT KMPlayer::View *view () const { return m_view; }
bool broadcasting () const;
void showBroadcastConfig ();
void hideBroadcastConfig ();
KDE_NO_EXPORT KMPlayerBroadcastConfig * broadcastConfig () const { return m_broadcastconfig; }
/* After createGUI() some menu's have to readded again */
void initMenu ();
void restoreFromConfig ();
protected:
void saveOptions ();
void readOptions ();
void saveProperties (KConfig * config);
void readProperties (KConfig * config);
void initActions ();
void initStatusBar ();
void initView ();
virtual bool queryClose ();
virtual bool queryExit ();
public slots:
void slotFileNewWindow ();
void slotFileOpen ();
void slotFileOpenRecent (const KURL& url);
void slotSaveAs ();
void slotFileClose ();
void slotFileQuit ();
void slotPreferences ();
void slotViewToolBar ();
void slotViewStatusBar ();
void slotViewMenuBar ();
void slotStatusMsg (const QString &text);
void slotSourceChanged (KMPlayer::Source *, KMPlayer::Source *);
private slots:
void dvdNav ();
void openDVD ();
void openVCD ();
void openAudioCD ();
void openPipe ();
void openVDR ();
void fullScreen ();
void configChanged ();
void keepSizeRatio ();
void startArtsControl();
void loadingProgress (int percentage);
void positioned (int pos, int length);
void zoom50 ();
void zoom100 ();
void zoom150 ();
void editMode ();
void syncEditMode ();
void broadcastClicked ();
void broadcastStarted ();
void broadcastStopped ();
void playerStarted ();
void slotMinimalMode ();
void slotConfigureKeys();
void slotConfigureToolbars ();
void slotClearHistory ();
void windowVideoConsoleToggled (int wt);
void playListItemSelected (QListViewItem *);
void playListItemDropped (QDropEvent * e, QListViewItem * after);
void playListItemMoved ();
void menuDropInList ();
void menuDropInGroup ();
void menuCopyDrop ();
void menuDeleteNode ();
void menuMoveUpNode ();
void menuMoveDownNode ();
void preparePlaylistMenu (KMPlayer::PlayListItem *, QPopupMenu *);
private:
void menuItemClicked (QPopupMenu * menu, int id);
void minimalMode (bool deco=true);
KConfig * config;
KSystemTray * m_systray;
KMPlayer::PartBase * m_player;
KMPlayer::View * m_view;
KMPlayer::NodePtr recents;
KMPlayer::NodePtr playlist;
KMPlayer::NodePtrW manip_node;
KAction * fileNewWindow;
KAction * fileOpen;
KRecentFilesAction * fileOpenRecent;
KAction * fileClose;
KAction * fileQuit;
KAction * editVolumeInc;
KAction * editVolumeDec;
KAction * toggleView;
KAction * viewSyncEditMode;
#if KDE_IS_VERSION(3,1,90)
KToggleAction * viewFullscreen;
#else
KAction * viewFullscreen;
#endif
KToggleAction * viewEditMode;
KToggleAction * viewToolBar;
KToggleAction * viewStatusBar;
KToggleAction * viewMenuBar;
KToggleAction * viewKeepRatio;
QMenuItem * m_sourcemenu;
QPopupMenu * m_dvdmenu;
QPopupMenu * m_dvdnavmenu;
QPopupMenu * m_vcdmenu;
QPopupMenu * m_audiocdmenu;
QPopupMenu * m_tvmenu;
QPopupMenu * m_dropmenu;
KMPlayerFFServerConfig * m_ffserverconfig;
KMPlayerBroadcastConfig * m_broadcastconfig;
QCString m_dcopName;
KURL::List m_drop_list;
QListViewItem * m_drop_after;
int edit_tree_id;
int manip_tree_id;
int last_time_left;
int recents_id;
int playlist_id;
bool m_showToolbar;
bool m_showStatusbar;
bool m_showMenubar;
bool m_played_intro;
bool m_played_exit;
bool m_minimal_mode;
bool m_auto_resize;
};
class KMPLAYER_NO_EXPORT FileDocument : public KMPlayer::Document {
public:
FileDocument (short id, const QString &, KMPlayer::PlayListNotify * notify = 0L);
KMPlayer::NodePtr childFromTag (const QString & tag);
void readFromFile (const QString & file);
void writeToFile (const QString & file);
};
#endif // KMPLAYER_H

@ -0,0 +1,146 @@
/**
* Copyright (C) 2005 by Koos Vriezen <koos.vriezen@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
**/
#include <config.h>
#include <kdebug.h>
#include <kurl.h>
#include "kmplayer_asx.h"
using namespace KMPlayer;
static QString getAsxAttribute (Element * e, const QString & attr) {
for (AttributePtr a = e->attributes ()->first (); a; a = a->nextSibling ())
if (attr == a->name ().toString ().lower ())
return a->value ();
return QString ();
}
KDE_NO_EXPORT NodePtr ASX::Asx::childFromTag (const QString & tag) {
const char * name = tag.latin1 ();
if (!strcasecmp (name, "entry"))
return new ASX::Entry (m_doc);
else if (!strcasecmp (name, "entryref"))
return new ASX::EntryRef (m_doc);
else if (!strcasecmp (name, "title"))
return new DarkNode (m_doc, name, id_node_title);
else if (!strcasecmp (name, "base"))
return new DarkNode (m_doc, name, id_node_base);
else if (!strcasecmp (name, "param"))
return new DarkNode (m_doc, name, id_node_param);
return 0L;
}
KDE_NO_EXPORT Node::PlayType ASX::Asx::playType () {
if (cached_ismrl_version != document ()->m_tree_version)
for (NodePtr e = firstChild (); e; e = e->nextSibling ()) {
if (e->id == id_node_title)
pretty_name = e->innerText ().simplifyWhiteSpace ();
else if (e->id == id_node_base)
src = getAsxAttribute (convertNode <Element> (e), "href");
}
return Mrl::playType ();
}
//-----------------------------------------------------------------------------
KDE_NO_EXPORT NodePtr ASX::Entry::childFromTag (const QString & tag) {
const char * name = tag.latin1 ();
if (!strcasecmp (name, "ref"))
return new ASX::Ref (m_doc);
else if (!strcasecmp (name, "title"))
return new DarkNode (m_doc, name, id_node_title);
else if (!strcasecmp (name, "base"))
return new DarkNode (m_doc, name, id_node_base);
else if (!strcasecmp (name, "param"))
return new DarkNode (m_doc, name, id_node_param);
else if (!strcasecmp (name, "starttime"))
return new DarkNode (m_doc, name, id_node_starttime);
else if (!strcasecmp (name, "duration"))
return new DarkNode (m_doc, name, id_node_duration);
return 0L;
}
KDE_NO_EXPORT Node::PlayType ASX::Entry::playType () {
if (cached_ismrl_version != document ()->m_tree_version) {
ref_child_count = 0;
NodePtr ref;
for (NodePtr e = firstChild (); e; e = e->nextSibling ()) {
switch (e->id) {
case id_node_title:
pretty_name = e->innerText (); // already normalized (hopefully)
break;
case id_node_base:
src = getAsxAttribute (convertNode <Element> (e), "href");
break;
case id_node_ref:
ref = e;
ref_child_count++;
}
}
if (ref_child_count == 1 && !pretty_name.isEmpty ())
convertNode <ASX::Ref> (ref)->pretty_name = pretty_name;
cached_ismrl_version = document()->m_tree_version;
}
return play_type_none;
}
KDE_NO_EXPORT void ASX::Entry::activate () {
resolved = true;
for (NodePtr e = firstChild (); e; e = e->nextSibling ())
if (e->id == id_node_param) {
Element * elm = convertNode <Element> (e);
if (getAsxAttribute(elm,"name").lower() == QString("clipsummary")) {
PlayListNotify * n = document ()->notify_listener;
if (n)
n->setInfoMessage (KURL::decode_string (
getAsxAttribute (elm, "value")));
break;
}
}
Mrl::activate ();
}
KDE_NO_EXPORT void ASX::Entry::deactivate () {
PlayListNotify * n = document ()->notify_listener;
if (n)
n->setInfoMessage (QString ());
}
KDE_NO_EXPORT bool ASX::Entry::expose () const {
return ref_child_count > 1 && !pretty_name.isEmpty ();
}
//-----------------------------------------------------------------------------
KDE_NO_EXPORT void ASX::Ref::opened () {
src = getAsxAttribute (this, "href");
//kdDebug () << "Ref attr found src: " << src << endl;
}
KDE_NO_EXPORT bool ASX::Ref::expose () const {
return !src.isEmpty ();
}
//-----------------------------------------------------------------------------
KDE_NO_EXPORT void ASX::EntryRef::opened () {
src = getAsxAttribute (this, "href");
//kdDebug () << "EntryRef attr found src: " << src << endl;
}

@ -0,0 +1,101 @@
/* This file is part of the KDE project
*
* Copyright (C) 2005 Koos Vriezen <koos.vriezen@xs4all.nl>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KMPLAYER_ASX_H_
#define _KMPLAYER_ASX_H_
#include <qstring.h>
#include "kmplayerplaylist.h"
namespace KMPlayer {
namespace ASX {
const short id_node_asx = 400;
const short id_node_entry = 401;
const short id_node_ref = 402;
const short id_node_entryref = 403;
const short id_node_title = 404;
const short id_node_base = 405;
const short id_node_param = 406;
const short id_node_starttime = 407;
const short id_node_duration = 408;
/**
* '<ASX>' tag
*/
class KMPLAYER_NO_EXPORT Asx : public Mrl {
public:
KDE_NO_CDTOR_EXPORT Asx (NodePtr & d) : Mrl (d, id_node_asx) {}
NodePtr childFromTag (const QString & tag);
KDE_NO_EXPORT const char * nodeName () const { return "ASX"; }
bool expose () const { return !pretty_name.isEmpty (); }
PlayType playType ();
};
/**
* Entry tag as found in ASX for playlist item
*/
class KMPLAYER_NO_EXPORT Entry : public Mrl {
public:
KDE_NO_CDTOR_EXPORT Entry (NodePtr & d)
: Mrl (d, id_node_entry), ref_child_count (0) {}
NodePtr childFromTag (const QString & tag);
KDE_NO_EXPORT const char * nodeName () const { return "Entry"; }
/**
* False, but since we might have a 'base' child, we can have a rel. src
*/
PlayType playType ();
void activate ();
void deactivate ();
bool expose () const;
int ref_child_count;
};
/**
* Ref tag as found in ASX for URL item in playlist item
*/
class KMPLAYER_NO_EXPORT Ref : public Mrl {
public:
KDE_NO_CDTOR_EXPORT Ref (NodePtr & d) : Mrl (d, id_node_ref) {}
//NodePtr childFromTag (const QString & tag);
void opened ();
KDE_NO_EXPORT const char * nodeName () const { return "Ref"; }
bool expose () const;
};
/**
* EntryRef tag as found in ASX for shortcut of Entry plus Ref playlist item
*/
class KMPLAYER_NO_EXPORT EntryRef : public Mrl {
public:
KDE_NO_CDTOR_EXPORT EntryRef (NodePtr & d) : Mrl (d, id_node_entryref) {}
//NodePtr childFromTag (const QString & tag);
void opened ();
KDE_NO_EXPORT const char * nodeName () const { return "EntryRef"; }
};
} //namespace ASX
} // namespace KMPlayer
#endif //_KMPLAYER_ASX_H_

@ -0,0 +1,107 @@
/**
* Copyright (C) 2005-2006 by Koos Vriezen <koos.vriezen@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
**/
#include <config.h>
#include <kdebug.h>
#include "kmplayer_atom.h"
using namespace KMPlayer;
NodePtr ATOM::Feed::childFromTag (const QString & tag) {
if (!strcmp (tag.latin1 (), "entry"))
return new ATOM::Entry (m_doc);
else if (!strcmp (tag.latin1 (), "link"))
return new ATOM::Link (m_doc);
else if (!strcmp (tag.latin1 (), "title"))
return new DarkNode (m_doc, tag, id_node_title);
return 0L;
}
void ATOM::Feed::closed () {
for (NodePtr c = firstChild (); c; c = c->nextSibling ())
if (c->id == id_node_title) {
pretty_name = c->innerText ().simplifyWhiteSpace ();
break;
}
}
NodePtr ATOM::Entry::childFromTag (const QString & tag) {
if (!strcmp (tag.latin1 (), "link"))
return new ATOM::Link (m_doc);
else if (!strcmp (tag.latin1 (), "content"))
return new ATOM::Content (m_doc);
else if (!strcmp (tag.latin1 (), "title"))
return new DarkNode (m_doc, tag, id_node_title);
else if (!strcmp (tag.latin1 (), "summary"))
return new DarkNode (m_doc, tag, id_node_summary);
return 0L;
}
void ATOM::Entry::closed () {
for (NodePtr c = firstChild (); c; c = c->nextSibling ())
if (c->id == id_node_title) {
pretty_name = c->innerText ().simplifyWhiteSpace ();
break;
}
}
Node::PlayType ATOM::Link::playType () {
return src.isEmpty () ? play_type_none : play_type_unknown;
}
void ATOM::Link::closed () {
QString href;
QString rel;
for (AttributePtr a = attributes ()->first (); a; a = a->nextSibling ()) {
if (a->name () == StringPool::attr_href)
href = a->value ();
else if (a->name () == StringPool::attr_title)
pretty_name = a->value ();
else if (a->name () == "rel")
rel = a->value ();
}
if (!href.isEmpty () && rel == QString::fromLatin1 ("enclosure"))
src = href;
else if (pretty_name.isEmpty ())
pretty_name = href;
}
void ATOM::Content::closed () {
for (AttributePtr a = attributes ()->first (); a; a = a->nextSibling ()) {
if (a->name () == StringPool::attr_src)
src = a->value ();
else if (a->name () == StringPool::attr_type) {
QString v = a->value ().lower ();
if (v == QString::fromLatin1 ("text"))
mimetype = QString::fromLatin1 ("text/plain");
else if (v == QString::fromLatin1 ("html"))
mimetype = QString::fromLatin1 ("text/html");
else if (v == QString::fromLatin1 ("xhtml"))
mimetype = QString::fromLatin1 ("application/xhtml+xml");
else
mimetype = v;
}
}
}
Node::PlayType ATOM::Content::playType () {
if (!hasChildNodes () && !src.isEmpty ())
return play_type_unknown;
return play_type_none;
}

@ -0,0 +1,82 @@
/* This file is part of the KDE project
*
* Copyright (C) 2005-2006 Koos Vriezen <koos.vriezen@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KMPLAYER_ATOM_H_
#define _KMPLAYER_ATOM_H_
#include <qstringlist.h>
#include "kmplayerplaylist.h"
namespace KMPlayer {
namespace ATOM {
const short id_node_feed = 300;
const short id_node_entry = 301;
const short id_node_link = 302;
const short id_node_title = 303;
const short id_node_summary = 304;
const short id_node_content = 305;
/**
* '<feed>' tag
*/
class KMPLAYER_NO_EXPORT Feed : public Mrl {
public:
KDE_NO_CDTOR_EXPORT Feed (NodePtr & d) : Mrl (d, id_node_feed) {}
NodePtr childFromTag (const QString & tag);
KDE_NO_EXPORT const char * nodeName () const { return "feed"; }
void closed ();
bool expose () const { return !pretty_name.isEmpty (); }
};
class KMPLAYER_NO_EXPORT Entry : public Mrl {
public:
KDE_NO_CDTOR_EXPORT Entry (NodePtr & d) : Mrl (d, id_node_entry) {}
NodePtr childFromTag (const QString & tag);
KDE_NO_EXPORT const char * nodeName () const { return "entry"; }
PlayType playType () { return play_type_none; }
void closed ();
};
class KMPLAYER_NO_EXPORT Link : public Mrl {
public:
KDE_NO_CDTOR_EXPORT Link (NodePtr & d) : Mrl (d, id_node_link) {}
KDE_NO_EXPORT const char * nodeName () const { return "link"; }
PlayType playType ();
void closed ();
};
class KMPLAYER_NO_EXPORT Content : public Mrl {
public:
KDE_NO_CDTOR_EXPORT Content (NodePtr &d) : Mrl(d, id_node_content) {}
KDE_NO_EXPORT const char * nodeName () const { return "content"; }
PlayType playType ();
void closed ();
//bool expose () const { return isPlayable (); }
};
} //namespace ATOM
} // namespace KMPlayer
#endif //_KMPLAYER_ATOM_H_

@ -0,0 +1,58 @@
/**
* Copyright (C) 2003 by Koos Vriezen <koos.vriezen@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
**/
#ifndef _KMPLAYER_BACKEND_H_
#define _KMPLAYER_BACKEND_H_
#include <dcopobject.h>
namespace KMPlayer {
class BackendPrivate;
class Backend : public DCOPObject {
K_DCOP
public:
Backend ();
virtual ~Backend ();
k_dcop:
virtual ASYNC setURL (QString url);
virtual ASYNC setSubTitleURL (QString url);
virtual ASYNC play (int repeat_count);
virtual ASYNC stop ();
virtual ASYNC pause ();
/* seek (pos, abs) seek position in deci-seconds */
virtual ASYNC seek (int pos, bool absolute);
virtual ASYNC hue (int h, bool absolute);
virtual ASYNC saturation (int s, bool absolute);
virtual ASYNC contrast (int c, bool absolute);
virtual ASYNC brightness (int b, bool absolute);
virtual ASYNC volume (int v, bool absolute);
virtual ASYNC frequency (int f);
virtual ASYNC quit ();
virtual ASYNC setConfig (QByteArray);
virtual ASYNC setAudioLang (int, QString);
virtual ASYNC setSubtitle (int, QString);
virtual bool isPlaying ();
private:
BackendPrivate * d;
};
} // namespace
#endif //_KMPLAYER_BACKEND_H_

@ -0,0 +1,51 @@
/**
* Copyright (C) 2003 by Koos Vriezen <koos.vriezen@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
**/
#ifndef _KMPLAYER_CALLBACK_H_
#define _KMPLAYER_CALLBACK_H_
#include <dcopobject.h>
#include <qstringlist.h>
namespace KMPlayer {
class CallbackProcess;
class Callback : public DCOPObject {
K_DCOP
public:
enum StatusCode { stat_addurl = 0, stat_newtitle, stat_hasvideo };
Callback (CallbackProcess *);
k_dcop:
ASYNC statusMessage (int code, QString msg);
ASYNC errorMessage (int code, QString msg);
ASYNC subMrl (QString mrl, QString title);
ASYNC finished ();
ASYNC playing ();
ASYNC started (QCString dcopname, QByteArray data);
ASYNC movieParams (int length, int width, int height, float aspect, QStringList alang, QStringList slang);
ASYNC moviePosition (int position);
ASYNC loadingProgress (int percentage);
ASYNC toggleFullScreen ();
private:
CallbackProcess * m_process;
};
} // namespace
#endif //_KMPLAYER_CALLBACK_H_

@ -0,0 +1,69 @@
/* This file is part of the KDE project
*
* Copyright (C) 2006 Koos Vriezen <koos.vriezen@xs4all.nl>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* until boost gets common, a more or less compatable one ..
*/
#ifndef _KMPLAYER_DEF_H_
#define _KMPLAYER_DEF_H_
#include <config.h>
#ifndef ASSERT
#define ASSERT Q_ASSERT
#endif
#include <kdemacros.h>
#undef KDE_NO_CDTOR_EXPORT
#undef KDE_NO_EXPORT
#ifndef KDE_EXPORT
#define KDE_EXPORT
#endif
#if __GNUC__ - 0 > 3 && __GNUC_MINOR__ - 0 > 1
# define KMPLAYER_NO_EXPORT __attribute__ ((visibility("hidden")))
# define KMPLAYER_EXPORT __attribute__ ((visibility("default")))
# define KMPLAYER_NO_MBR_EXPORT __attribute__ ((visibility("hidden")))
# define KDE_NO_CDTOR_EXPORT
# define KDE_NO_EXPORT
#elif __GNUC__ - 0 > 3 || (__GNUC__ - 0 == 3 && __GNUC_MINOR__ - 0 > 3)
#if __GNUC__ - 0 > 3
#define KMPLAYER_NO_EXPORT __attribute__ ((visibility("hidden")))
#else
#define KMPLAYER_NO_EXPORT
#endif
#define KDE_NO_CDTOR_EXPORT __attribute__ ((visibility("hidden")))
#define KDE_NO_EXPORT __attribute__ ((visibility("hidden")))
#define KMPLAYER_EXPORT __attribute__ ((visibility("default")))
#define KMPLAYER_NO_MBR_EXPORT
#elif __GNUC__ - 0 > 3 || (__GNUC__ - 0 == 3 && __GNUC_MINOR__ - 0 > 2)
#define KDE_NO_CDTOR_EXPORT
#define KDE_NO_EXPORT __attribute__ ((visibility("hidden")))
#define KMPLAYER_EXPORT
#define KMPLAYER_NO_EXPORT
#define KMPLAYER_NO_MBR_EXPORT
#else
#define KDE_NO_CDTOR_EXPORT
#define KDE_NO_EXPORT
#define KMPLAYER_EXPORT
#define KMPLAYER_NO_EXPORT
#define KMPLAYER_NO_MBR_EXPORT
#endif
#endif //_KMPLAYER_DEF_H_

@ -0,0 +1,15 @@
[Desktop Entry]
Encoding=UTF-8
Name=KMPlayer
Name[hi]=केएमप्लेयर
Name[hu]=KMPLayer
Name[sv]=Kmplayer
Name[ta]=கேஎம்இயக்கி
Name[xx]=xxKMPlayerxx
X-KDE-Library=libkmplayerkofficepart
MimeType=application/ogg;application/smil;application/vnd.ms-asf;application/vnd.rn-realmedia;application/x-kmplayer;application/x-mplayer2;application/x-ogg;video/avi;video/mediaplayer;video/mp4;video/mpeg;video/quicktime;video/vnd.rn-realvideo;video/x-avi;video/x-flic;video/x-matroska;video/x-ms-asf;video/x-msvideo;video/x-ms-wmp;video/x-ms-wmv;video/x-ogm;video/x-theora;uri/mms;uri/pnm;uri/rtspt;uri/rtspu;
Type=Service
Icon=kmplayer
ServiceTypes=KOfficePart,KParts/ReadOnlyPart,KParts/ReadWritePart,Browser/View,KMediaPlayer/Player
X-KDE-NativeMimeType=application/x-kmplayer
InitialPreference=5

@ -0,0 +1,168 @@
/**
* Copyright (C) 2002-2003 by Koos Vriezen <koos.vriezen@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
**/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <signal.h>
#include <qapplication.h>
#include <qcstring.h>
#include <qtimer.h>
#include <qmultilineedit.h>
#include <qpushbutton.h>
#include <qpopupmenu.h>
#include <qslider.h>
#include <qvaluelist.h>
#include <kprocess.h>
#include <kmessagebox.h>
#include <kaboutdata.h>
#include <kdebug.h>
#include <kconfig.h>
#include <kaction.h>
#include <kstandarddirs.h>
#include <kparts/factory.h>
#include "kmplayerpartbase.h"
#include "kmplayer_koffice_part.h"
#include "kmplayerview.h"
#include "kmplayerconfig.h"
#ifdef HAVE_KOFFICE
#include <qdom.h>
//#include <qmetaobject.h>
#include <qlayout.h>
#include <qptrlist.h>
#include <qpainter.h>
#include <koFrame.h>
class KMPlayerFactory : public KParts::Factory {
public:
KMPlayerFactory ();
virtual ~KMPlayerFactory ();
virtual KParts::Part *createPartObject
(QWidget *wparent, const char *wname, QObject *parent, const char *name,
const char *className, const QStringList &args);
static KInstance * instance () { return s_instance; }
private:
static KInstance * s_instance;
};
K_EXPORT_COMPONENT_FACTORY (libkmplayerkofficepart, KMPlayerFactory)
KInstance *KMPlayerFactory::s_instance = 0;
KMPlayerFactory::KMPlayerFactory () {
s_instance = new KInstance ("KMPlayerKofficePart");
}
KMPlayerFactory::~KMPlayerFactory () {
delete s_instance;
}
KParts::Part *KMPlayerFactory::createPartObject
(QWidget *wparent, const char *wname,
QObject *parent, const char * name,
const char * cls, const QStringList & args) {
if (strstr (cls, "KoDocument"))
return new KOfficeMPlayer (wparent, wname, parent, name);
return 0L;
}
//-----------------------------------------------------------------------------
KOfficeMPlayer::KOfficeMPlayer (QWidget *parentWidget, const char *widgetName, QObject* parent, const char* name, bool singleViewMode)
: KoDocument (parentWidget, widgetName, parent, name, singleViewMode),
m_config (new KConfig ("kmplayerrc")),
m_player (new KMPlayer (parentWidget, 0L, 0L, 0L, m_config))
{
setInstance (KMPlayerFactory::instance (), false);
setReadWrite (false);
m_player->init();
m_player->setSource (m_player->sources () ["urlsource"]);
//setWidget (view);
}
KOfficeMPlayer::~KOfficeMPlayer () {
kdDebug() << "KOfficeMPlayer::~KOfficeMPlayer" << /*kdBacktrace() <<*/ endl;
}
void KOfficeMPlayer::paintContent (QPainter& p, const QRect& r, bool, double, double) {
p.fillRect (r, QBrush (QColor (0, 0, 0)));
}
bool KOfficeMPlayer::initDoc() {
kdDebug() << "KOfficeMPlayer::initDoc" << endl;
return true;
}
bool KOfficeMPlayer::loadXML (QIODevice *, const QDomDocument & doc) {
QDomNode node = doc.firstChild ();
if (node.isNull ()) return true;
kdDebug() << "KOfficeMPlayer::loadXML " << node.nodeName () << endl;
node = node.firstChild ();
if (node.isNull ()) return true;
kdDebug() << "KOfficeMPlayer::loadXML " << node.nodeName () << endl;
node = node.firstChild ();
if (node.isNull () || !node.isText ()) return true;
m_player->setURL (KURL (node.toText ().data ()));
return true;
}
bool KOfficeMPlayer::loadOasis (const QDomDocument &, KoOasisStyles &, const QDomDocument &, KoStore *) {
return true;
}
QDomDocument KOfficeMPlayer::saveXML() {
QDomDocument doc = createDomDocument ("kmplayer", QString::number(1.0));
QDomElement docelm = doc.documentElement();
docelm.setAttribute ("editor", "KMPlayer");
docelm.setAttribute ("mime", "application/x-kmplayer");
QDomElement url = doc.createElement ("url");
url.appendChild (doc.createTextNode (m_player->url ().url ()));
doc.appendChild (url);
return doc;
}
KoView* KOfficeMPlayer::createViewInstance (QWidget* parent, const char* name) {
kdDebug() << "KOfficeMPlayer::createViewInstance" << endl;
return new KOfficeMPlayerView (this, parent);
}
KOfficeMPlayerView::KOfficeMPlayerView (KOfficeMPlayer* part, QWidget* parent, const char* name)
: KoView (part, parent, name),
m_view (static_cast <KMPlayer::View*> (part->player ()->view ())) {
kdDebug() << "KOfficeMPlayerView::KOfficeMPlayerView this:" << this << " parent:" << parent << endl;
m_oldparent = static_cast <QWidget*> (m_view->parent());
m_view->reparent (this, QPoint (0, 0));
QVBoxLayout * box = new QVBoxLayout (this, 0, 0);
box->addWidget (m_view);
}
KOfficeMPlayerView::~KOfficeMPlayerView () {
kdDebug() << "KOfficeMPlayerView::~KOfficeMPlayerView this:" << this << endl;
m_view->reparent (m_oldparent, QPoint (0, 0));
}
#include "kmplayer_koffice_part.moc"
#endif

@ -0,0 +1,85 @@
/**
* Copyright (C) 2002-2003 by Koos Vriezen <koos.vriezen@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
**/
#ifndef KMPLAYER_KOFFICE_PART_H
#define KMPLAYER_KOFFICE_PART_H
#include <config.h>
#include <kmediaplayer/player.h>
#include <kparts/browserextension.h>
#include <kparts/factory.h>
#include <kurl.h>
#ifdef HAVE_KOFFICE
#include <koDocument.h>
#include <koView.h>
#endif //HAVE_KOFFICE
#include <qobject.h>
#include <qvaluelist.h>
#include <qstringlist.h>
#include <qguardedptr.h>
#include <qregexp.h>
#include "kmplayerview.h"
#include "kmplayersource.h"
class KProcess;
class KAboutData;
class KMPlayer;
class KInstance;
class KConfig;
class QIODevice;
#ifdef HAVE_KOFFICE
class KOfficeMPlayer;
class KOfficeMPlayerView : public KoView {
Q_OBJECT
public:
KOfficeMPlayerView (KOfficeMPlayer* part, QWidget* parent, const char* name = 0 );
~KOfficeMPlayerView ();
void updateReadWrite(bool) {}
private:
KMPlayer::View * m_view;
QGuardedPtr <QWidget> m_oldparent;
};
class KOfficeMPlayer : public KoDocument {
Q_OBJECT
public:
KOfficeMPlayer (QWidget *parentWidget = 0, const char *widgetName = 0, QObject* parent = 0, const char* name = 0, bool singleViewMode = false);
~KOfficeMPlayer ();
virtual void paintContent (QPainter& painter, const QRect& rect,
bool transparent = false, double zoomX = 1.0, double zoomY = 1.0);
virtual bool initDoc ();
virtual bool loadXML (QIODevice *, const QDomDocument &);
virtual bool loadOasis (const QDomDocument &, KoOasisStyles &, const QDomDocument &, KoStore *);
virtual QDomDocument saveXML ();
virtual QCString mimeType() const { return "application/x-kmplayer"; }
KMPlayer * player () const { return m_player; }
protected:
virtual KoView* createViewInstance (QWidget* parent, const char* name);
private:
KConfig * m_config;
KMPlayer * m_player;
KOfficeMPlayerView * m_view;
};
#endif //HAVE_KOFFICE
#endif

File diff suppressed because it is too large Load Diff

@ -0,0 +1,88 @@
[Desktop Entry]
Encoding=UTF-8
Name=Embedded MPlayer for KDE
Name[af]=Ingelegde MPlayer vir KDE
Name[ar]=MPlayer مدمج في KDE
Name[be]=Убудаваны MPlayer для KDE
Name[bg]=Вграден MPlayer за KDE
Name[br]=MPlayer enframmet evit KDE
Name[bs]=Ugrađeni MPlayer za KDE
Name[ca]=MPlayer encastat per al KDE
Name[cs]=MPlayer pro KDE
Name[csb]=Wbùdowóny MPlayer dlô KDE
Name[da]=Indlejret MPlayer for KDE
Name[de]=Eingebetteter MPlayer für KDE
Name[el]=Ενσωμάτωση του MPlayer για το KDE
Name[es]=MPlayer embebido para KDE
Name[et]=KDE põimitud MPlayer
Name[fi]=Upotettu MPlayer KDE:lle
Name[fr]=MPlayer intégré pour KDE
Name[gl]=MPlayer Embebido para KDE
Name[he]=נגן MPlayer עבור KDE
Name[hi]=केडीई हेतु एम्बेडेड एमप्लेयर
Name[hu]=Beágyazott MPlayer a KDE-hez
Name[it]=MPlayer integrato per KDE
Name[ja]=KDE のための埋め込み MPlayer
Name[mk]=Вгнезден MPlayer за KDE
Name[nb]=Innebygget MPlayer for KDE
Name[nl]=Ingebedde MPlayer voor KDE
Name[pa]=KDE ਲਈ ਸ਼ਾਮਲ MPlayer
Name[pt]=MPlayer Embebido para o KDE
Name[pt_BR]=MPlayer Integrado ao KDE
Name[ru]=Встроенный MPlayer для KDE
Name[sk]=Vložený MPlayer pre KDE
Name[sr]=Угњеждени MPlayer за KDE
Name[sr@Latn]=Ugnježdeni MPlayer za KDE
Name[sv]=Inbäddad Mplayer för KDE
Name[ta]= KDEவிற்கு விதைத்த ஊடக வாசிப்பான்
Name[th]=โปรแกรมเล่นสื่อ MPlayer แบบฝังตัวสำหรับ KDE
Name[tr]=KDE için gömülmüş MPlayer
Name[uk]=Вбудований MPlayer для KDE
Name[xx]=xxEmbedded MPlayer for KDExx
Name[zh_CN]=KDE 嵌入的 MPlayer
Name[zh_TW]=MPlayer 的 KDE 嵌入式介面
Comment=Video player plugin (QuickTime, XMovie, Windows Media and RealPlayer compatible)
Comment[af]=Video speler inprop module (Ondersteun QuickTime, XMovie, Windows Media en RealPlayer)
Comment[ar]=قابس القارئ المرئي ( ملائم مع QuickTime, XMovie, Windows Media و RealPlayer)
Comment[be]=Утулка прайгравання відэа (сумяшчальны з QuickTime, XMovie, Windows Media і RealPlayer)
Comment[bg]=Приставка за видео плеър (QuickTime, XMovie, Windows Media и RealPlayer съвместима)
Comment[ca]=Connector per a la reproducció de vídeo (compatible amb QuickTime, XMovie, Windows Media i RealPlayer)
Comment[cs]=Modul video přehrávače (kompatibilní s QuickTime, XMovie, Windows Media a RealPlayer)
Comment[csb]=Pluginsë òdgrëwôcza wideò (zgódne z QickTime, XMovie, Windows Media ë RealPlayer)
Comment[da]=Videoafspiller plugin (QuickTime, XMovie, Windows Media og RealPlayer kompatibel)
Comment[de]=Video player plugin (QuickTime, XMovie, Windows Media und RealPlayer kompatibel)
Comment[el]=Πρόσθετο αναπαραγωγής βίντεο (συμβατό με QuickTime, XMovie, πολυμέσα Windows και RealPlayer)
Comment[es]=Complemento de reproducción de vídeo (compatible con QuickTime, XMovie, Windows Media y RealPlayer)
Comment[et]=Videomängija plugin (QuickTime, XMovie, Windows Media ja RealPlayer)
Comment[fr]=Module de lecture de vidéos (compatible QuickTime, XMovie, Windows Media et RealPlayer)
Comment[gl]=Plugin de reproduzón de vídeo (compatível con QuickTime, XMovie, Windows Media e RealPlayer)
Comment[he]=תוסף וידאו לניגון (QuickTime, XMovie, מדיה של חלונות ותואם RealPlayer)
Comment[hi]=वीडियो प्लेयर प्लगइन (क्विक-टाइम, एक्समूवी, विंडोज़ मीडिया तथा रीयल-प्लेयर कंपेटिबल)
Comment[it]=Plugin lettore video (compatibile con QuickTime, XMovie, Windows Media e RealPlayer)
Comment[ja]=ビデオプレーヤプラグイン (QuickTime, XMovie, Windows Media, RealPlayer をサポート)
Comment[ka]=ვიდეოდამკვრელის მოდული (QuickTime, XMovie, Windows Media და RealPlayer თავსებადი)
Comment[mk]=Приклучок за видеоизведувач (компатибилен со QuickTime, XMovie, Windows Media и RealPlayer)
Comment[nb]=Tilleggsmodul for videospiller (kompatibel med QuickTime, XMovie, Windows Media og RealPlayer)
Comment[nl]=Videospelerplugin (ondersteuning voor Quicktime, XMovie, Windows Media- en RealAudio-speler)
Comment[pa]=ਵੀਡਿਆ ਪਲੇਅਰ ਪਲੱਗਿੰਨ (QuickTime, XMovie, Windows Media ਅਤੇ RealPlayer ਅਨੁਕੂਲ)
Comment[pt]='Plugin' de reprodução de vídeo (compatível com QuickTime, XMovie, Windows Media e RealPlayer)
Comment[pt_BR]=Plugin de reprodução de vídeo (compatível com QuickTime, XMovie, Windows Media e RealPlayer)
Comment[ru]=Модуль видеоплеера (совместимый с QuickTime, XMovie, Windows Media и RealPlayer)
Comment[sk]=Plugin prehrávača videa (kompatibilný s QuickTime, XMovie, Windows Media a RealPlayer)
Comment[sr]=Прикључак за пуштање видеа (компатибилан са: QuickTime, XMovie, Windows Media, RealPlayer)
Comment[sr@Latn]=Priključak za puštanje videa (kompatibilan sa: QuickTime, XMovie, Windows Media, RealPlayer)
Comment[sv]=Insticksprogram för videospelare (fungerar med Quicktime, Xmovie, Windows Media och Realplayer)
Comment[ta]=வீடியோ சொருகி(விரைவுநேரம், Xபடம், Windows படம் மற்றும் RealPlayer compatible)
Comment[th]=ปลั๊กอินโปรแกรมเล่นวิดีโอ (ใช้ด้วยกันได้กับ QuickTime, XMovie, Windows Media และ RealPlayer)
Comment[tr]=Video oynatıcı eklentisi (QuickTime, XMovie, Windows Media ve RealPlayer ile uyumlu)
Comment[uk]=Втулок відео-програвача (програє QuickTime, XMovie, Windows Media і RealPlayer)
Comment[xx]=xxVideo player plugin (QuickTime, XMovie, Windows Media and RealPlayer compatible)xx
Comment[zh_TW]=視像播放程式 (可播放 QuickTime, XMovie, Windows Media 和 RealPlayer)
X-KDE-Library=libkmplayerpart
# Keep in sync with the audio types in kmplayer.desktop
MimeType=application/ogg;application/smil;application/vnd.ms-asf;application/vnd.rn-realmedia;application/x-kmplayer;application/x-mplayer2;application/x-ogg;application/xspf+xml;video/avi;video/mediaplayer;video/mp4;video/mpeg;video/quicktime;video/vnd.rn-realvideo;video/x-avi;video/x-flic;video/x-matroska;video/x-ms-asf;video/x-msvideo;video/x-ms-wmp;video/x-ms-wmv;video/x-ms-wvx;video/x-ogm;video/x-theora;uri/mms;uri/pnm;uri/rtspt;uri/rtspu;
Type=Service
Icon=kmplayer
ServiceTypes=KParts/ReadOnlyPart,Browser/View,KMediaPlayer/Player
X-KDE-BrowserView-PluginsInfo=kmplayer/pluginsinfo
InitialPreference=5

@ -0,0 +1,176 @@
/**
* Copyright (C) 2002-2003 by Koos Vriezen <koos.vriezen@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
**/
#ifndef KMPLAYER_PART_H
#define KMPLAYER_PART_H
#include <kparts/browserextension.h>
#include "kmplayerpartbase.h"
#include "kmplayersource.h"
class KAboutData;
class KMPlayerPart;
class KInstance;
class JSCommandEntry;
/*
* Wrapper source for URLSource that has a HREF attribute
*/
class KMPLAYER_NO_EXPORT KMPlayerHRefSource : public KMPlayer::Source {
Q_OBJECT
public:
KMPlayerHRefSource (KMPlayer::PartBase * player);
virtual ~KMPlayerHRefSource ();
virtual bool processOutput (const QString & line);
virtual bool hasLength ();
void setURL (const KURL &);
void clear ();
virtual QString prettyName ();
public slots:
virtual void init ();
virtual void activate ();
virtual void deactivate ();
void finished ();
private slots:
void grabReady (const QString & path);
void play ();
private:
QString m_grabfile;
bool m_finished;
};
/*
* Part notifications to hosting application
*/
class KMPLAYER_NO_EXPORT KMPlayerBrowserExtension : public KParts::BrowserExtension {
Q_OBJECT
public:
KMPlayerBrowserExtension(KMPlayerPart *parent);
KDE_NO_CDTOR_EXPORT ~KMPlayerBrowserExtension () {}
void urlChanged (const QString & url);
void setLoadingProgress (int percentage);
void saveState (QDataStream & stream);
void restoreState (QDataStream & stream);
void requestOpenURL (const KURL & url, const QString & target, const QString & service);
public slots:
void slotRequestOpenURL (const KURL & url, const QString & target);
};
/*
* Part javascript support
*/
class KMPLAYER_NO_EXPORT KMPlayerLiveConnectExtension : public KParts::LiveConnectExtension {
Q_OBJECT
public:
KMPlayerLiveConnectExtension (KMPlayerPart * parent);
~KMPlayerLiveConnectExtension ();
// LiveConnect interface
bool get (const unsigned long, const QString &,
KParts::LiveConnectExtension::Type &, unsigned long &, QString &);
bool put (const unsigned long, const QString &, const QString &);
bool call (const unsigned long, const QString &,
const QStringList &, KParts::LiveConnectExtension::Type &,
unsigned long &, QString &);
void unregister (const unsigned long);
void sendEvent(const unsigned long objid, const QString & event, const KParts::LiveConnectExtension::ArgList & args ) {
emit partEvent(objid, event, args);
}
void enableFinishEvent (bool b = true) { m_enablefinish = b; }
signals:
void partEvent (const unsigned long, const QString &,
const KParts::LiveConnectExtension::ArgList &);
public slots:
void setSize (int w, int h);
void started ();
void finished ();
void evaluate (const QString & script, QString & result);
private:
KMPlayerPart * player;
QString script_result;
const JSCommandEntry * lastJSCommandEntry;
bool m_started;
bool m_enablefinish;
bool m_evaluating;
};
/*
* Part that gets created when used a KPart
*/
class KMPLAYER_NO_EXPORT KMPlayerPart : public KMPlayer::PartBase {
Q_OBJECT
friend struct GroupPredicate;
public:
enum Features {
Feat_Unknown = 0,
Feat_Viewer = 0x01, Feat_Controls = 0x02,
Feat_Label = 0x04, Feat_StatusBar = 0x08,
Feat_InfoPanel = 0x10, Feat_VolumeSlider = 0x20, Feat_PlayList = 0x40,
Feat_ImageWindow = 0x80, Feat_All = 0xff
};
KMPlayerPart (QWidget * wparent, const char * wname,
QObject * parent, const char * name, const QStringList &args);
~KMPlayerPart ();
KDE_NO_EXPORT KMPlayerBrowserExtension * browserextension() const
{ return m_browserextension; }
KMPlayerLiveConnectExtension * liveconnectextension () const
{ return m_liveconnectextension; }
KDE_NO_EXPORT bool hasFeature (int f) { return m_features & f; }
bool allowRedir (const KURL & url) const;
void connectToPart (KMPlayerPart *);
KMPlayerPart * master () const { return m_master; }
void setMaster (KMPlayerPart * m) { m_master = m; }
virtual void setLoaded (int percentage);
bool openNewURL (const KURL & url); // for JS interface
public slots:
virtual bool openURL (const KURL & url);
virtual bool closeURL ();
void setMenuZoom (int id);
protected slots:
virtual void playingStarted ();
virtual void playingStopped ();
void viewerPartDestroyed (QObject *);
void viewerPartProcessChanged (const char *);
void viewerPartSourceChanged (KMPlayer::Source *, KMPlayer::Source *);
void waitForImageWindowTimeOut ();
void statusPosition (int pos, int length);
private:
void setAutoControls (bool);
KMPlayerPart * m_master;
KMPlayerBrowserExtension * m_browserextension;
KMPlayerLiveConnectExtension * m_liveconnectextension;
QString m_group;
KURL m_docbase;
QString m_src_url;
QString m_file_name;
int m_features;
int last_time_left;
bool m_started_emited : 1;
//bool m_noresize : 1;
bool m_havehref : 1;
};
#endif

@ -0,0 +1,497 @@
/**
* Copyright (C) 2006 by Koos Vriezen <koos.vriezen@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
**/
#include <config.h>
#include <qcolor.h>
#include <qimage.h>
#include <qtimer.h>
#include <kdebug.h>
#include "kmplayer_rp.h"
#include "kmplayer_smil.h"
using namespace KMPlayer;
KDE_NO_CDTOR_EXPORT RP::Imfl::Imfl (NodePtr & d)
: Mrl (d, id_node_imfl),
fit (fit_hidden),
duration (0),
needs_scene_img (0) {}
KDE_NO_CDTOR_EXPORT RP::Imfl::~Imfl () {
}
KDE_NO_EXPORT void RP::Imfl::closed () {
for (NodePtr n = firstChild (); n; n = n->nextSibling ())
if (RP::id_node_head == n->id) {
AttributePtr a = convertNode <Element> (n)->attributes ()->first ();
for (; a; a = a->nextSibling ()) {
if (StringPool::attr_width == a->name ()) {
width = a->value ().toInt ();
} else if (StringPool::attr_height == a->name ()) {
height = a->value ().toInt ();
} else if (a->name () == "duration") {
int dur;
parseTime (a->value ().lower (), dur);
duration = dur;
}
}
}
}
KDE_NO_EXPORT void RP::Imfl::defer () {
kdDebug () << "RP::Imfl::defer " << endl;
setState (state_deferred);
for (Node * n = firstChild ().ptr (); n; n = n->nextSibling ().ptr ())
if (n->id == RP::id_node_image && !n->active ())
n->activate ();
}
KDE_NO_EXPORT void RP::Imfl::activate () {
kdDebug () << "RP::Imfl::activate " << endl;
resolved = true;
setState (state_activated);
int timings_count = 0;
for (NodePtr n = firstChild (); n; n = n->nextSibling ())
switch (n->id) {
case RP::id_node_crossfade:
case RP::id_node_fadein:
case RP::id_node_fadeout:
case RP::id_node_fill:
case RP::id_node_wipe:
case RP::id_node_viewchange:
n->activate (); // set their start timers
timings_count++;
break;
case RP::id_node_image:
if (!n->active ())
n->activate ();
break;
}
if (duration > 0)
duration_timer = document ()->setTimeout (this, duration * 100);
else if (!timings_count)
finish ();
}
KDE_NO_EXPORT void RP::Imfl::finish () {
kdDebug () << "RP::Imfl::finish " << endl;
Mrl::finish ();
if (duration_timer) {
document ()->cancelTimer (duration_timer);
duration_timer = 0;
}
for (NodePtr n = firstChild (); n; n = n->nextSibling ())
if (n->unfinished ())
n->finish ();
}
KDE_NO_EXPORT void RP::Imfl::childDone (NodePtr) {
if (unfinished () && !duration_timer) {
for (NodePtr n = firstChild (); n; n = n->nextSibling ())
switch (n->id) {
case RP::id_node_crossfade:
case RP::id_node_fadein:
case RP::id_node_fadeout:
case RP::id_node_fill:
if (n->unfinished ())
return;
}
finish ();
}
}
KDE_NO_EXPORT void RP::Imfl::deactivate () {
kdDebug () << "RP::Imfl::deactivate " << endl;
if (unfinished ())
finish ();
if (!active ())
return; // calling finish might call deactivate() as well
setState (state_deactivated);
for (NodePtr n = firstChild (); n; n = n->nextSibling ())
if (n->active ())
n->deactivate ();
rp_surface = Mrl::getSurface (0L);
}
KDE_NO_EXPORT bool RP::Imfl::handleEvent (EventPtr event) {
if (event->id () == event_timer) {
TimerEvent * te = static_cast <TimerEvent *> (event.ptr ());
if (te->timer_info == duration_timer) {
kdDebug () << "RP::Imfl timer " << duration << endl;
duration_timer = 0;
if (unfinished ())
finish ();
}
}
return true;
}
KDE_NO_EXPORT void RP::Imfl::accept (Visitor * v) {
v->visit (this);
}
KDE_NO_EXPORT Surface *RP::Imfl::surface () {
if (!rp_surface) {
rp_surface = Mrl::getSurface (this);
if (rp_surface) {
if (width <= 0 || width > 32000)
width = rp_surface->bounds.width ();
if (height <= 0 || height > 32000)
height = rp_surface->bounds.height ();
}
}
return rp_surface.ptr ();
}
KDE_NO_EXPORT NodePtr RP::Imfl::childFromTag (const QString & tag) {
const char * ctag = tag.latin1 ();
if (!strcmp (ctag, "head"))
return new DarkNode (m_doc, "head", RP::id_node_head);
else if (!strcmp (ctag, "image"))
return new RP::Image (m_doc);
else if (!strcmp (ctag, "fill"))
return new RP::Fill (m_doc);
else if (!strcmp (ctag, "wipe"))
return new RP::Wipe (m_doc);
else if (!strcmp (ctag, "viewchange"))
return new RP::ViewChange (m_doc);
else if (!strcmp (ctag, "crossfade"))
return new RP::Crossfade (m_doc);
else if (!strcmp (ctag, "fadein"))
return new RP::Fadein (m_doc);
else if (!strcmp (ctag, "fadeout"))
return new RP::Fadeout (m_doc);
return 0L;
}
KDE_NO_EXPORT void RP::Imfl::repaint () {
if (!active ())
kdWarning () << "Spurious Imfl repaint" << endl;
else if (surface () && width > 0 && height > 0)
rp_surface->repaint (SRect (0, 0, width, height));
}
KDE_NO_CDTOR_EXPORT RP::Image::Image (NodePtr & doc)
: Mrl (doc, id_node_image)
{}
KDE_NO_CDTOR_EXPORT RP::Image::~Image () {
}
KDE_NO_EXPORT void RP::Image::closed () {
src = getAttribute (StringPool::attr_name);
}
KDE_NO_EXPORT void RP::Image::activate () {
kdDebug () << "RP::Image::activate" << endl;
setState (state_activated);
isPlayable (); // update src attribute
cached_img.setUrl (absolutePath ());
if (cached_img.isEmpty ()) {
wget (absolutePath ());
} else {
width = cached_img.data->image->width ();
height = cached_img.data->image->height ();
}
}
KDE_NO_EXPORT void RP::Image::begin () {
Node::begin ();
}
KDE_NO_EXPORT void RP::Image::deactivate () {
cached_img.setUrl (QString ());
if (img_surface) {
img_surface->remove ();
img_surface = NULL;
}
setState (state_deactivated);
postpone_lock = 0L;
}
KDE_NO_EXPORT void RP::Image::remoteReady (QByteArray & data) {
kdDebug () << "RP::Image::remoteReady" << endl;
if (!data.isEmpty () && cached_img.isEmpty ()) {
QImage * img = new QImage (data);
if (!img->isNull ()) {
cached_img.data->image = img;
width = img->width ();
height = img->height ();
} else {
delete img;
}
}
postpone_lock = 0L;
}
KDE_NO_EXPORT bool RP::Image::isReady (bool postpone_if_not) {
if (downloading () && postpone_if_not)
postpone_lock = document ()->postpone ();
return !downloading ();
}
KDE_NO_EXPORT Surface *RP::Image::surface () {
if (!img_surface && !cached_img.isEmpty ()) {
Node * p = parentNode ().ptr ();
if (p && p->id == RP::id_node_imfl) {
Surface *ps = static_cast <RP::Imfl *> (p)->surface ();
if (ps)
img_surface = ps->createSurface (this,
SRect (0, 0, width, height));
}
}
return img_surface;
}
KDE_NO_CDTOR_EXPORT RP::TimingsBase::TimingsBase (NodePtr & d, const short i)
: Element (d, i), x (0), y (0), w (0), h (0), start (0), duration (0) {}
KDE_NO_EXPORT void RP::TimingsBase::activate () {
setState (state_activated);
x = y = w = h = 0;
srcx = srcy = srcw = srch = 0;
for (Attribute * a= attributes ()->first ().ptr (); a; a = a->nextSibling ().ptr ()) {
if (a->name () == StringPool::attr_target) {
for (NodePtr n = parentNode()->firstChild(); n; n= n->nextSibling())
if (convertNode <Element> (n)->
getAttribute ("handle") == a->value ())
target = n;
} else if (a->name () == "start") {
int dur;
parseTime (a->value ().lower (), dur);
start = dur;
} else if (a->name () == "duration") {
int dur;
parseTime (a->value ().lower (), dur);
duration = dur;
} else if (a->name () == "dstx") {
x = a->value ().toInt ();
} else if (a->name () == "dsty") {
y = a->value ().toInt ();
} else if (a->name () == "dstw") {
w = a->value ().toInt ();
} else if (a->name () == "dsth") {
h = a->value ().toInt ();
} else if (a->name () == "srcx") {
srcx = a->value ().toInt ();
} else if (a->name () == "srcy") {
srcy = a->value ().toInt ();
} else if (a->name () == "srcw") {
srcw = a->value ().toInt ();
} else if (a->name () == "srch") {
srch = a->value ().toInt ();
}
}
start_timer = document ()->setTimeout (this, start *100);
}
KDE_NO_EXPORT void RP::TimingsBase::deactivate () {
if (unfinished ())
finish ();
setState (state_deactivated);
}
KDE_NO_EXPORT bool RP::TimingsBase::handleEvent (EventPtr event) {
if (event->id () == event_timer) {
TimerEvent * te = static_cast <TimerEvent *> (event.ptr ());
if (te->timer_info == update_timer && duration > 0) {
update (100 * ++curr_step / duration);
te->interval = true;
} else if (te->timer_info == start_timer) {
start_timer = 0;
duration_timer = document ()->setTimeout (this, duration * 100);
begin ();
} else if (te->timer_info == duration_timer) {
duration_timer = 0;
update (100);
finish ();
} else
return false;
return true;
} else if (event->id () == event_postponed) {
if (!static_cast <PostponedEvent *> (event.ptr ())->is_postponed) {
document_postponed = 0L; // disconnect
update (duration > 0 ? 0 : 100);
}
}
return false;
}
KDE_NO_EXPORT void RP::TimingsBase::begin () {
progress = 0;
setState (state_began);
if (target)
target->begin ();
if (duration > 0) {
steps = duration; // 10/s updates
update_timer = document ()->setTimeout (this, 100); // 50ms
curr_step = 1;
}
}
KDE_NO_EXPORT void RP::TimingsBase::update (int percentage) {
progress = percentage;
Node * p = parentNode ().ptr ();
if (p->id == RP::id_node_imfl)
static_cast <RP::Imfl *> (p)->repaint ();
}
KDE_NO_EXPORT void RP::TimingsBase::finish () {
progress = 100;
if (start_timer) {
document ()->cancelTimer (start_timer);
start_timer = 0;
} else if (duration_timer) {
document ()->cancelTimer (duration_timer);
duration_timer = 0;
}
if (update_timer) {
document ()->cancelTimer (update_timer);
update_timer = 0;
}
document_postponed = 0L; // disconnect
Element::finish ();
}
KDE_NO_EXPORT void RP::Crossfade::activate () {
TimingsBase::activate ();
}
KDE_NO_EXPORT void RP::Crossfade::begin () {
//kdDebug () << "RP::Crossfade::begin" << endl;
TimingsBase::begin ();
if (target && target->id == id_node_image) {
RP::Image * img = static_cast <RP::Image *> (target.ptr ());
if (!img->isReady (true))
document_postponed = document()->connectTo (this, event_postponed);
else
update (duration > 0 ? 0 : 100);
}
}
KDE_NO_EXPORT void RP::Crossfade::accept (Visitor * v) {
v->visit (this);
}
KDE_NO_EXPORT void RP::Fadein::activate () {
// pickup color from Fill that should be declared before this node
from_color = 0;
TimingsBase::activate ();
}
KDE_NO_EXPORT void RP::Fadein::begin () {
//kdDebug () << "RP::Fadein::begin" << endl;
TimingsBase::begin ();
if (target && target->id == id_node_image) {
RP::Image * img = static_cast <RP::Image *> (target.ptr ());
if (!img->isReady (true))
document_postponed = document()->connectTo (this, event_postponed);
else
update (duration > 0 ? 0 : 100);
}
}
KDE_NO_EXPORT void RP::Fadein::accept (Visitor * v) {
v->visit (this);
}
KDE_NO_EXPORT void RP::Fadeout::activate () {
to_color = QColor (getAttribute ("color")).rgb ();
TimingsBase::activate ();
}
KDE_NO_EXPORT void RP::Fadeout::begin () {
//kdDebug () << "RP::Fadeout::begin" << endl;
TimingsBase::begin ();
}
KDE_NO_EXPORT void RP::Fadeout::accept (Visitor * v) {
v->visit (this);
}
KDE_NO_EXPORT void RP::Fill::activate () {
color = QColor (getAttribute ("color")).rgb ();
TimingsBase::activate ();
}
KDE_NO_EXPORT void RP::Fill::begin () {
setState (state_began);
update (0);
}
KDE_NO_EXPORT void RP::Fill::accept (Visitor * v) {
v->visit (this);
}
KDE_NO_EXPORT void RP::Wipe::activate () {
//TODO implement 'type="push"'
QString dir = getAttribute ("direction").lower ();
direction = dir_right;
if (dir == QString::fromLatin1 ("left"))
direction = dir_left;
else if (dir == QString::fromLatin1 ("up"))
direction = dir_up;
else if (dir == QString::fromLatin1 ("down"))
direction = dir_down;
TimingsBase::activate ();
}
KDE_NO_EXPORT void RP::Wipe::begin () {
//kdDebug () << "RP::Wipe::begin" << endl;
TimingsBase::begin ();
if (target && target->id == id_node_image) {
RP::Image * img = static_cast <RP::Image *> (target.ptr ());
if (!img->isReady (true))
document_postponed = document()->connectTo (this, event_postponed);
else
update (duration > 0 ? 0 : 100);
}
}
KDE_NO_EXPORT void RP::Wipe::accept (Visitor * v) {
v->visit (this);
}
KDE_NO_EXPORT void RP::ViewChange::activate () {
TimingsBase::activate ();
}
KDE_NO_EXPORT void RP::ViewChange::begin () {
kdDebug () << "RP::ViewChange::begin" << endl;
setState (state_began);
Node * p = parentNode ().ptr ();
if (p->id == RP::id_node_imfl)
static_cast <RP::Imfl *> (p)->needs_scene_img++;
update (0);
}
KDE_NO_EXPORT void RP::ViewChange::finish () {
Node * p = parentNode ().ptr ();
if (p && p->id == RP::id_node_imfl)
static_cast <RP::Imfl *> (p)->needs_scene_img--;
TimingsBase::finish ();
}
KDE_NO_EXPORT void RP::ViewChange::accept (Visitor * v) {
v->visit (this);
}

@ -0,0 +1,193 @@
/* This file is part of the KDE project
*
* Copyright (C) 2006-2007 Koos Vriezen <koos.vriezen@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KMPLAYER_RP_H_
#define _KMPLAYER_RP_H_
#include <qobject.h>
#include <qstring.h>
#include "kmplayerplaylist.h"
#include "kmplayer_smil.h"
namespace KIO {
class Job;
}
namespace KMPlayer {
/**
* RealPix support classes
*/
namespace RP {
const short id_node_imfl = 150;
const short id_node_head = 151;
const short id_node_image = 152;
const short id_node_crossfade = 153;
const short id_node_fill = 154;
const short id_node_wipe = 155;
const short id_node_fadein = 156;
const short id_node_fadeout = 157;
const short id_node_viewchange = 158;
const short id_node_animate = 159;
class KMPLAYER_NO_EXPORT Imfl : public Mrl {
public:
Imfl (NodePtr & d);
~Imfl ();
KDE_NO_EXPORT virtual const char * nodeName () const { return "imfl"; }
virtual NodePtr childFromTag (const QString & tag);
virtual void closed ();
virtual void defer (); // start loading the images if not yet done
virtual void activate (); // start timings, handle paint events
virtual void finish (); // end the timings
virtual void deactivate (); // stop handling paint events
virtual void childDone (NodePtr child); // for if no duration_timer set
KDE_NO_EXPORT virtual bool expose () const { return false; }
KDE_NO_EXPORT virtual PlayType playType () const { return play_type_image; }
virtual bool handleEvent (EventPtr event);
virtual void accept (Visitor *);
Surface *surface ();
void repaint (); // called whenever something changes on image
Fit fit; // how to layout images
unsigned int duration; // cached attributes of head
TimerInfoPtrW duration_timer;
SurfacePtrW rp_surface;
int needs_scene_img;
};
class KMPLAYER_NO_EXPORT TimingsBase : public Element {
public:
TimingsBase (NodePtr & d, const short id);
KDE_NO_CDTOR_EXPORT ~TimingsBase () {}
virtual void activate (); // start the 'start_timer'
virtual void begin (); // start_timer has expired
virtual void finish (); // ?duration_timer has expired?
virtual void deactivate (); // disabled
virtual bool handleEvent (EventPtr event);
KDE_NO_EXPORT virtual bool expose () const { return false; }
int progress;
Single x, y, w, h;
Single srcx, srcy, srcw, srch;
NodePtrW target;
protected:
void update (int percentage);
unsigned int start, duration;
int steps, curr_step;
TimerInfoPtrW start_timer;
TimerInfoPtrW duration_timer;
TimerInfoPtrW update_timer;
ConnectionPtr document_postponed;
};
class KMPLAYER_NO_EXPORT Crossfade : public TimingsBase {
public:
KDE_NO_CDTOR_EXPORT Crossfade (NodePtr & d)
: TimingsBase (d, id_node_crossfade) {}
KDE_NO_CDTOR_EXPORT ~Crossfade () {}
KDE_NO_EXPORT virtual const char * nodeName () const { return "crossfade"; }
virtual void activate ();
virtual void begin ();
virtual void accept (Visitor *);
};
class KMPLAYER_NO_EXPORT Fadein : public TimingsBase {
public:
KDE_NO_CDTOR_EXPORT Fadein (NodePtr & d) : TimingsBase(d, id_node_fadein) {}
KDE_NO_CDTOR_EXPORT ~Fadein () {}
KDE_NO_EXPORT virtual const char * nodeName () const { return "fadein"; }
virtual void activate ();
virtual void begin ();
virtual void accept (Visitor *);
unsigned int from_color;
};
class KMPLAYER_NO_EXPORT Fadeout : public TimingsBase {
public:
KDE_NO_CDTOR_EXPORT Fadeout(NodePtr &d) : TimingsBase(d, id_node_fadeout) {}
KDE_NO_CDTOR_EXPORT ~Fadeout () {}
KDE_NO_EXPORT virtual const char * nodeName () const { return "fadeout"; }
virtual void activate ();
virtual void begin ();
virtual void accept (Visitor *);
unsigned int to_color;
};
class KMPLAYER_NO_EXPORT Fill : public TimingsBase {
public:
KDE_NO_CDTOR_EXPORT Fill (NodePtr & d) : TimingsBase (d, id_node_fill) {}
KDE_NO_CDTOR_EXPORT ~Fill () {}
KDE_NO_EXPORT virtual const char * nodeName () const { return "fill"; }
virtual void activate ();
virtual void begin ();
unsigned int fillColor () const { return color; }
virtual void accept (Visitor *);
unsigned int color;
};
class KMPLAYER_NO_EXPORT Wipe : public TimingsBase {
public:
KDE_NO_CDTOR_EXPORT Wipe (NodePtr & d) : TimingsBase (d, id_node_wipe) {}
KDE_NO_CDTOR_EXPORT ~Wipe () {}
KDE_NO_EXPORT virtual const char * nodeName () const { return "wipe"; }
virtual void activate ();
virtual void begin ();
virtual void accept (Visitor *);
enum { dir_right, dir_left, dir_up, dir_down } direction;
};
class KMPLAYER_NO_EXPORT ViewChange : public TimingsBase {
public:
KDE_NO_CDTOR_EXPORT ViewChange (NodePtr & d)
: TimingsBase (d, id_node_viewchange) {}
KDE_NO_CDTOR_EXPORT ~ViewChange () {}
KDE_NO_EXPORT virtual const char * nodeName() const { return "viewchange"; }
virtual void activate ();
virtual void begin ();
virtual void finish ();
virtual void accept (Visitor *);
};
class KMPLAYER_NO_EXPORT Image : public RemoteObject, public Mrl {
PostponePtr postpone_lock;
public:
Image (NodePtr & d);
~Image ();
KDE_NO_EXPORT virtual const char * nodeName () const { return "image"; }
virtual void activate ();
virtual void begin ();
virtual void deactivate ();
virtual void closed ();
bool isReady (bool postpone_if_not = false); // is downloading ready
Surface *surface ();
SurfacePtrW img_surface;
CachedImage cached_img;
bool expose () const { return false; }
protected:
virtual void remoteReady (QByteArray & data);
};
} // RP namespace
} // KMPlayer namespace
#endif //_KMPLAYER_RP_H_

@ -0,0 +1,130 @@
/**
* Copyright (C) 2005 by Koos Vriezen <koos.vriezen@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
**/
#include <config.h>
#include <kdebug.h>
#include "kmplayer_rss.h"
using namespace KMPlayer;
KDE_NO_EXPORT NodePtr RSS::Rss::childFromTag (const QString & tag) {
if (!strcmp (tag.latin1 (), "channel"))
return new RSS::Channel (m_doc);
return 0L;
}
KDE_NO_EXPORT NodePtr RSS::Channel::childFromTag (const QString & tag) {
const char *ctag = tag.ascii ();
if (!strcmp (ctag, "item"))
return new RSS::Item (m_doc);
else if (!strcmp (ctag, "title"))
return new DarkNode (m_doc, tag, id_node_title);
return 0L;
}
KDE_NO_EXPORT void RSS::Channel::closed () {
for (NodePtr c = firstChild (); c; c = c->nextSibling ())
if (c->id == id_node_title) {
pretty_name = c->innerText ().simplifyWhiteSpace ();
break;
}
}
KDE_NO_EXPORT bool RSS::Channel::expose () const {
return !pretty_name.isEmpty () || //return false if no title and only one
previousSibling () || nextSibling ();
}
KDE_NO_EXPORT NodePtr RSS::Item::childFromTag (const QString & tag) {
const char *ctag = tag.ascii ();
if (!strcmp (ctag, "enclosure"))
return new RSS::Enclosure (m_doc);
else if (!strcmp (ctag, "title"))
return new DarkNode (m_doc, tag, id_node_title);
else if (!strcmp (ctag, "description"))
return new DarkNode (m_doc, tag, id_node_description);
return 0L;
}
KDE_NO_EXPORT void RSS::Item::closed () {
cached_play_type = play_type_none;
for (NodePtr c = firstChild (); c; c = c->nextSibling ()) {
switch (c->id) {
case id_node_title:
pretty_name = c->innerText ().simplifyWhiteSpace ();
break;
case id_node_enclosure:
enclosure = c;
src = c->mrl ()->src;
break;
case id_node_description:
cached_play_type = play_type_info;
break;
}
}
if (enclosure && !enclosure->mrl ()->src.isEmpty ())
cached_play_type = play_type_audio;
}
KDE_NO_EXPORT Mrl * RSS::Item::linkNode () {
if (enclosure)
return enclosure->mrl ();
return Mrl::linkNode ();
}
KDE_NO_EXPORT void RSS::Item::activate () {
PlayListNotify * n = document()->notify_listener;
if (n) {
for (NodePtr c = firstChild (); c; c = c->nextSibling ())
if (c->id == id_node_description) {
QString s = c->innerText ();
n->setInfoMessage (s);
if (!enclosure && !s.isEmpty ()) {
setState (state_activated);
begin ();
timer = document ()->setTimeout (this, 5000+s.length()*200);
return;
}
break;
}
}
Mrl::activate ();
}
KDE_NO_EXPORT void RSS::Item::deactivate () {
if (timer) {
document ()->cancelTimer (timer);
timer = 0L;
}
PlayListNotify * n = document()->notify_listener;
if (n)
n->setInfoMessage (QString ());
Mrl::deactivate ();
}
KDE_NO_EXPORT bool RSS::Item::handleEvent (EventPtr event) {
if (event->id () == event_timer) {
timer = 0L;
finish ();
}
return true;
}
KDE_NO_EXPORT void RSS::Enclosure::closed () {
src = getAttribute (StringPool::attr_url);
}

@ -0,0 +1,88 @@
/* This file is part of the KDE project
*
* Copyright (C) 2005-2006 Koos Vriezen <koos.vriezen@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KMPLAYER_RSS_H_
#define _KMPLAYER_RSS_H_
#include <qstring.h>
#include "kmplayerplaylist.h"
namespace KMPlayer {
namespace RSS {
const short id_node_rss = 200;
const short id_node_channel = 201;
const short id_node_item = 202;
const short id_node_title = 203;
const short id_node_description = 204;
const short id_node_enclosure = 205;
/**
* '<RSS>' tag
*/
class KMPLAYER_NO_EXPORT Rss : public Mrl {
public:
KDE_NO_CDTOR_EXPORT Rss (NodePtr & d) : Mrl (d, id_node_rss) {}
NodePtr childFromTag (const QString & tag);
KDE_NO_EXPORT const char * nodeName () const { return "rss"; }
bool expose () const { return false; }
};
class KMPLAYER_NO_EXPORT Channel : public Mrl {
public:
KDE_NO_CDTOR_EXPORT Channel (NodePtr & d) : Mrl (d, id_node_channel) {}
NodePtr childFromTag (const QString & tag);
KDE_NO_EXPORT const char * nodeName () const { return "channel"; }
PlayType playType () { return play_type_none; }
void closed ();
bool expose () const;
};
class KMPLAYER_NO_EXPORT Item : public Mrl {
public:
KDE_NO_CDTOR_EXPORT Item (NodePtr & d) : Mrl (d, id_node_item) {}
NodePtr childFromTag (const QString & tag);
KDE_NO_EXPORT const char * nodeName () const { return "item"; }
PlayType playType () { return cached_play_type; }
Mrl * linkNode ();
void closed ();
void activate ();
void deactivate ();
bool handleEvent (EventPtr event);
NodePtrW enclosure;
TimerInfoPtrW timer;
};
class KMPLAYER_NO_EXPORT Enclosure : public Mrl {
public:
KDE_NO_CDTOR_EXPORT Enclosure(NodePtr &d) : Mrl(d, id_node_enclosure) {}
KDE_NO_EXPORT const char * nodeName () const { return "enclosure"; }
void closed ();
bool expose () const { return false; }
};
} //namespace RSS
} // namespace KMPlayer
#endif //_KMPLAYER_RSS_H_

File diff suppressed because it is too large Load Diff

@ -0,0 +1,898 @@
/* This file is part of the KDE project
*
* Copyright (C) 2005-2007 Koos Vriezen <koos.vriezen@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KMPLAYER_SMILL_H_
#define _KMPLAYER_SMILL_H_
#include <config.h>
#include <qobject.h>
#include <qstring.h>
#include <qstringlist.h>
#include "kmplayerplaylist.h"
class QTextStream;
class QImage;
class QPainter;
namespace KIO {
class Job;
}
struct TransTypeInfo;
namespace KMPlayer {
struct KMPLAYER_NO_EXPORT ImageData {
ImageData( const QString & img);
~ImageData();
QImage *image;
private:
QString url;
};
typedef SharedPtr <ImageData> ImageDataPtr;
typedef WeakPtr <ImageData> ImageDataPtrW;
struct KMPLAYER_NO_EXPORT CachedImage {
void setUrl (const QString & url);
bool isEmpty ();
ImageDataPtr data;
};
class TextRuntimePrivate;
/*
* Event signaled before the actual starting takes place. Use by SMIL::Excl
* to stop possible other children
*/
class ToBeStartedEvent : public Event {
public:
ToBeStartedEvent (NodePtr n);
NodePtrW node;
};
/*
* Interpretation of sizes
*/
class KMPLAYER_NO_EXPORT SizeType {
public:
SizeType ();
SizeType (const QString & s);
void reset ();
SizeType & operator = (const QString & s);
SizeType & operator += (const SizeType & s);
SizeType & operator -= (const SizeType & s);
SizeType & operator /= (const int i)
{ perc_size /= i; abs_size /= i; return *this; }
SizeType & operator *= (const float f)
{ perc_size *= f; abs_size *= f; return *this; }
Single size (Single relative_to = 100) const;
bool isSet () const { return isset; }
private:
Single perc_size;
Single abs_size;
bool isset;
};
/**
* For RegPoint, RegionRuntime and MediaRuntime, having sizes
*/
class KMPLAYER_NO_EXPORT CalculatedSizer {
public:
KDE_NO_CDTOR_EXPORT CalculatedSizer () {}
KDE_NO_CDTOR_EXPORT ~CalculatedSizer () {}
void resetSizes ();
void calcSizes (Node *, Single w, Single h,
Single & xoff, Single & yoff, Single & w1, Single & h1);
bool applyRegPoints (Node *, Single w, Single h,
Single & xoff, Single & yoff, Single & w1, Single & h1);
SizeType left, top, width, height, right, bottom;
QString reg_point, reg_align;
bool setSizeParam (const TrieString &name, const QString &value, bool &dim);
void move (const SizeType &x, const SizeType &y);
};
/**
* Live representation of a SMIL element having timings
*/
class KMPLAYER_NO_EXPORT Runtime {
public:
enum TimingState {
timings_reset = 0, timings_began, timings_started, timings_stopped
};
enum DurationTime { begin_time = 0, duration_time, end_time, durtime_last };
enum Duration {
dur_infinite = -1, dur_timer = 0, dur_media,
dur_activated, dur_inbounds, dur_outbounds,
dur_end, dur_start, dur_last_dur
};
Runtime (NodePtr e);
virtual ~Runtime ();
/**
* Called when element is pulled in scope, from Node::activate()
*/
virtual void begin ();
virtual void beginAndStart (); // skip start timer (if any)
/**
* Reset all data, called from end() and init()
*/
virtual void reset ();
virtual bool parseParam (const TrieString & name, const QString & value);
TimingState state () const { return timingstate; }
void propagateStop (bool forced);
void propagateStart ();
void processEvent (unsigned int event);
/**
* Duration items, begin/dur/end, length information or connected element
*/
struct DurationItem {
DurationItem () : durval (dur_timer), offset (0) {}
Duration durval;
int offset;
ConnectionPtr connection;
} durations [(const int) durtime_last];
virtual void started ();
virtual void stopped ();
KDE_NO_EXPORT DurationItem & beginTime () { return durations[begin_time]; }
KDE_NO_EXPORT DurationItem & durTime () { return durations[duration_time]; }
KDE_NO_EXPORT DurationItem & endTime () { return durations [end_time]; }
private:
void setDurationItem (DurationTime item, const QString & val);
public:
TimingState timingstate;
protected:
NodePtrW element;
TimerInfoPtrW start_timer;
TimerInfoPtrW duration_timer;
int repeat_count;
};
/**
* Some common runtime data for all mediatype classes
*/
class KMPLAYER_NO_EXPORT MediaTypeRuntime : public RemoteObject,public Runtime {
public:
~MediaTypeRuntime ();
virtual void reset ();
virtual void stopped ();
virtual void postpone (bool b);
virtual void clipStart ();
virtual void clipStop ();
PostponePtr postpone_lock;
MediaTypeRuntime (NodePtr e);
protected:
ConnectionPtr document_postponed; // pause audio/video accordantly
};
/**
* Data needed for audio/video clips
*/
class KMPLAYER_NO_EXPORT AudioVideoData : public MediaTypeRuntime {
public:
AudioVideoData (NodePtr e);
virtual bool isAudioVideo ();
virtual bool parseParam (const TrieString & name, const QString & value);
virtual void started ();
virtual void postpone (bool b);
virtual void clipStart ();
virtual void clipStop ();
};
class KMPLAYER_NO_EXPORT ImageRuntime : public QObject,public MediaTypeRuntime {
Q_OBJECT
public:
ImageRuntime (NodePtr e);
~ImageRuntime ();
virtual bool parseParam (const TrieString & name, const QString & value);
virtual void postpone (bool b);
virtual void clipStart ();
virtual void clipStop ();
QMovie * img_movie;
CachedImage cached_img;
int frame_nr;
protected:
virtual void started ();
virtual void remoteReady (QByteArray &);
private slots:
void movieUpdated (const QRect &);
void movieStatus (int);
void movieResize (const QSize &);
};
/**
* Data needed for text
*/
class KMPLAYER_NO_EXPORT TextRuntime : public MediaTypeRuntime {
public:
TextRuntime (NodePtr e);
~TextRuntime ();
void reset ();
virtual bool parseParam (const TrieString & name, const QString & value);
int font_size;
unsigned int font_color;
unsigned int background_color;
int bg_opacity;
enum { align_left, align_center, align_right } halign;
QString text;
TextRuntimePrivate * d;
protected:
virtual void started ();
virtual void remoteReady (QByteArray &);
};
/**
* Stores runtime data of elements from animate group set/animate/..
*/
class KMPLAYER_NO_EXPORT AnimateGroupData : public Runtime {
public:
KDE_NO_CDTOR_EXPORT ~AnimateGroupData () {}
virtual bool parseParam (const TrieString & name, const QString & value);
virtual void reset ();
protected:
void restoreModification ();
AnimateGroupData (NodePtr e);
NodePtrW target_element;
TrieString changed_attribute;
QString change_to;
int modification_id;
protected:
virtual void stopped ();
};
/**
* Stores runtime data of set element
*/
class KMPLAYER_NO_EXPORT SetData : public AnimateGroupData {
public:
KDE_NO_CDTOR_EXPORT SetData (NodePtr e) : AnimateGroupData (e) {}
KDE_NO_CDTOR_EXPORT ~SetData () {}
protected:
virtual void started ();
};
/**
* Stores runtime data of animate element
*/
class KMPLAYER_NO_EXPORT AnimateData : public AnimateGroupData {
public:
AnimateData (NodePtr e);
KDE_NO_CDTOR_EXPORT ~AnimateData () {}
virtual bool parseParam (const TrieString & name, const QString & value);
virtual void reset ();
virtual void started ();
virtual void stopped ();
bool timerTick();
private:
void applyStep ();
TimerInfoPtrW anim_timer;
enum { acc_none, acc_sum } accumulate;
enum { add_replace, add_sum } additive;
int change_by;
enum { calc_discrete, calc_linear, calc_paced, calc_spline } calcMode;
QString change_from;
QStringList change_values;
int steps;
float change_delta, change_to_val, change_from_val;
QString change_from_unit;
};
/**
* Stores runtime data of animate element
*/
class KMPLAYER_NO_EXPORT AnimateMotionData : public AnimateGroupData {
public:
AnimateMotionData (NodePtr e);
~AnimateMotionData ();
virtual bool parseParam (const TrieString & name, const QString & value);
virtual void reset ();
virtual void started ();
virtual void stopped ();
bool timerTick();
private:
bool checkTarget (Node *n);
bool setInterval ();
void applyStep ();
bool getCoordinates (const QString &coord, SizeType &x, SizeType &y);
TimerInfoPtrW anim_timer;
enum { acc_none, acc_sum } accumulate;
enum { add_replace, add_sum } additive;
enum { calc_discrete, calc_linear, calc_paced, calc_spline } calcMode;
QString change_from;
QString change_by;
QStringList values;
float *keytimes;
int keytime_count;
QStringList splines;
float control_point[4];
unsigned int steps;
unsigned int cur_step;
unsigned int keytime_steps;
unsigned int interval;
SizeType begin_x, begin_y;
SizeType cur_x, cur_y;
SizeType delta_x, delta_y;
SizeType end_x, end_y;
};
class KMPLAYER_NO_EXPORT MouseListeners {
public:
MouseListeners();
NodeRefListPtr listeners (unsigned int event_id);
NodeRefListPtr m_ActionListeners; // mouse clicked
NodeRefListPtr m_OutOfBoundsListeners; // mouse left
NodeRefListPtr m_InBoundsListeners; // mouse entered
};
/**
* Translates string to deci-seconds or 'special' high number
*/
bool parseTime (const QString & val, int & dur /*,const QString & dateformat*/);
//-----------------------------------------------------------------------------
namespace SMIL {
const short id_node_smil = 100;
const short id_node_head = 101;
const short id_node_layout = 103;
const short id_node_root_layout = 104;
const short id_node_region = 105;
const short id_node_regpoint = 106;
const short id_node_transition = 107;
const short id_node_body = 110;
const short id_node_par = 111;
const short id_node_seq = 112;
const short id_node_switch = 113;
const short id_node_excl = 114;
const short id_node_img = 120;
const short id_node_audio_video = 121;
const short id_node_text = 122;
const short id_node_ref = 123;
const short id_node_brush = 124;
const short id_node_set = 132;
const short id_node_animate = 133;
const short id_node_title = 140;
const short id_node_param = 141;
const short id_node_meta = 142;
const short id_node_anchor = 150;
const short id_node_area = 151;
const short id_node_first = id_node_smil;
const short id_node_first_timed_mrl = id_node_body;
const short id_node_last_timed_mrl = id_node_animate;
const short id_node_first_mediatype = id_node_img;
const short id_node_last_mediatype = id_node_brush;
const short id_node_first_group = id_node_body;
const short id_node_last_group = id_node_excl;
const short id_node_last = 200; // reserve 100 ids
/**
* '<smil>' tag
*/
class Smil : public Mrl {
public:
KDE_NO_CDTOR_EXPORT Smil (NodePtr & d) : Mrl (d, id_node_smil) {}
NodePtr childFromTag (const QString & tag);
KDE_NO_EXPORT const char * nodeName () const { return "smil"; }
PlayType playType () { return play_type_video; }
void activate ();
void deactivate ();
void closed ();
void childDone (NodePtr child);
bool expose () const;
bool handleEvent (EventPtr event);
void accept (Visitor *);
void jump (const QString & id);
static Smil * findSmilNode (Node * node);
/**
* Hack to mark the currently playing MediaType as finished
* FIXME: think of a descent callback way for this
*/
Mrl * linkNode ();
NodePtrW current_av_media_type;
NodePtrW layout_node;
};
/**
* Represents optional 'head' tag of SMIL document as in
* &lt;smil&gt;&lt;head/&gt;&lt;body/&gt;&lt;/smil&gt;
*/
class KMPLAYER_NO_EXPORT Head : public Element {
public:
KDE_NO_CDTOR_EXPORT Head (NodePtr & d) : Element (d, id_node_head) {}
NodePtr childFromTag (const QString & tag);
KDE_NO_EXPORT const char * nodeName () const { return "head"; }
void closed ();
void childDone (NodePtr child);
bool expose () const;
};
/**
* Base class for SMIL::Region, SMIL::RootLayout and SMIL::Layout
*/
class KMPLAYER_NO_EXPORT RegionBase : public RemoteObject, public Element {
public:
enum ShowBackground { ShowAlways, ShowWhenActive };
~RegionBase ();
bool expose () const { return false; }
void activate ();
void childDone (NodePtr child);
void deactivate ();
virtual void parseParam (const TrieString & name, const QString & value);
/**
* repaints region, calls scheduleRepaint(x,y,w,h) on view
*/
void repaint ();
void repaint (const SRect & rect);
/**
* calculate the relative x,y,w,h on the child region elements
* given this element's w and h value
* and child's left/top/right/width/height/bottom attributes
*/
virtual void updateDimensions ();
void boundsUpdate (); // recalculates and repaint old and new bounds
virtual Surface *surface ();
SurfacePtrW region_surface;
CachedImage cached_img;
CalculatedSizer sizes;
Single x, y, w, h; // unscaled values
int z_order;
unsigned int background_color;
QString background_image;
ShowBackground show_background;
protected:
RegionBase (NodePtr & d, short id);
PostponePtr postpone_lock; // pause while loading bg image
virtual void remoteReady (QByteArray &); // image downloaded
};
/**
* Defines region layout, should reside below 'head' element
*/
class KMPLAYER_NO_EXPORT Layout : public RegionBase {
public:
Layout (NodePtr & d);
NodePtr childFromTag (const QString & tag);
KDE_NO_EXPORT const char * nodeName () const { return "layout"; }
void activate ();
void closed ();
virtual void accept (Visitor *);
/**
* recursively calculates dimensions of this and child regions
*/
virtual void updateDimensions ();
virtual Surface *surface ();
NodePtrW rootLayout;
};
/**
* Represents a rectangle on the viewing area
*/
class KMPLAYER_NO_EXPORT Region : public RegionBase {
public:
Region (NodePtr & d);
KDE_NO_EXPORT const char * nodeName () const { return "region"; }
NodePtr childFromTag (const QString & tag);
void calculateBounds (Single w, Single h);
virtual NodeRefListPtr listeners (unsigned int event_id);
virtual void accept (Visitor *);
/**
* boolean for check if pointerEntered/pointerLeft should be called by View
*/
bool has_mouse;
NodeRefListPtr m_AttachedMediaTypes; // active attached mediatypes
private:
MouseListeners mouse_listeners;
};
/**
* Represents the root area for the other regions
*/
class KMPLAYER_NO_EXPORT RootLayout : public RegionBase {
public:
KDE_NO_CDTOR_EXPORT RootLayout (NodePtr & d)
: RegionBase (d, id_node_root_layout) {}
KDE_NO_EXPORT const char * nodeName () const { return "root-layout"; }
};
/**
* Represents a regPoint element for alignment inside regions
*/
class KMPLAYER_NO_EXPORT RegPoint : public Element {
public:
KDE_NO_CDTOR_EXPORT RegPoint (NodePtr & d) : Element(d, id_node_regpoint) {}
KDE_NO_CDTOR_EXPORT ~RegPoint () {}
KDE_NO_EXPORT const char * nodeName () const { return "regPoint"; }
KDE_NO_EXPORT bool expose () const { return false; }
void parseParam (const TrieString & name, const QString & value);
CalculatedSizer sizes;
};
/**
* Represents a transition element for starting media types
*/
class KMPLAYER_NO_EXPORT Transition : public Element {
public:
enum TransType {
TransTypeNone = 0,
BarWipe, IrisWipe, ClockWipe, SnakeWipe, // required, TODO
BoxWipe, FourBoxWipe, BarnDoorWipe, DiagonalWipe, BowTieWipe,
MiscDiagonalWipe, VeeWipe, BarnVeeWipe, ZigZagWipe, BarnZigZagWipe,
TriangleWipe, ArrowHeadWipe, PentagonWipe, HexagonWipe, EllipseWipe,
EyeWipe, RoundRectWipe, StarWipe, MiscShapeWipe,
PinWheelWipe, SingleSweepWipe, FanWipe, DoubleFanWipe,
DoubleSweepWipe, SaloonDoorWipe, WindShieldWipe,
SpiralWipe, ParallelSnakesWipe, BoxSnakesWipe, WaterFallWipe,
PushWipe, SideWipe, Fade,
TransLast
};
enum TransSubType {
SubTransTypeNone = 0,
SubLeftToRight, SubTopToBottom, SubTopLeft, SubTopRight,
SubBottomRight, SubBottomLeft,
SubTopCenter, SubRightCenter, SubBottomCenter, SubLeftCenter,
SubCornersIn, SubCornersOut,
SubCircle, SubVertical, SubHorizontal,
SubFromLeft, SubFromTop, SubFromRight, SubFromBottom,
SubCrossfade, SubFadeToColor, SubFadeFromColor,
SubRectangle, SubDiamond,
SubClockwiseTwelve, SubClockwiseThree, SubClockwiseSix,
SubClockwiseNine,
// and lots more .. TODO
SubTransLast
};
Transition (NodePtr & d);
KDE_NO_CDTOR_EXPORT ~Transition () {}
void activate ();
KDE_NO_EXPORT void accept (Visitor * v) { v->visit (this); }
KDE_NO_EXPORT const char * nodeName () const { return "transition"; }
void parseParam (const TrieString & name, const QString & value);
KDE_NO_EXPORT bool expose () const { return false; }
bool supported ();
TransType type;
TransSubType sub_type;
TransTypeInfo *type_info;
enum { dir_forward, dir_reverse } direction;
int dur; // deci seconds
float start_progress, end_progress;
unsigned int fade_color;
};
/**
* Base for all SMIL media elements having begin/dur/end/.. attributes
*/
class KMPLAYER_NO_EXPORT TimedMrl : public Mrl {
public:
enum Fill {
fill_default, fill_inherit, fill_remove, fill_freeze,
fill_hold, fill_transition, fill_auto
};
~TimedMrl ();
void closed ();
void activate ();
void begin ();
void finish ();
void deactivate ();
void reset ();
bool expose () const { return false; }
void childBegan (NodePtr child);
void childDone (NodePtr child);
virtual bool handleEvent (EventPtr event);
virtual NodeRefListPtr listeners (unsigned int event_id);
KDE_NO_EXPORT void accept (Visitor * v) { v->visit (this); }
void init ();
virtual void parseParam (const TrieString &, const QString &);
Runtime * runtime ();
static Runtime::DurationItem * getDuration (NodePtr n);
static bool isTimedMrl (const Node *n);
static bool keepContent (Node *n);
static Fill getDefaultFill (NodePtr n);
unsigned int begin_time;
unsigned int finish_time;
Fill fill;
Fill fill_def;
Fill fill_active;
protected:
TimedMrl (NodePtr & d, short id);
virtual Runtime * getNewRuntime ();
NodeRefListPtr m_StartListeners; // Element about to be started
NodeRefListPtr m_StartedListeners; // Element is started
NodeRefListPtr m_StoppedListeners; // Element stopped
Runtime * m_runtime;
};
KDE_NO_EXPORT inline Runtime * TimedMrl::runtime () {
if (!m_runtime)
m_runtime = getNewRuntime ();
return m_runtime;
}
KDE_NO_EXPORT inline bool TimedMrl::isTimedMrl (const Node *n) {
return n &&
n->id >= id_node_first_timed_mrl &&
n->id <= id_node_last_timed_mrl;
}
/**
* Abstract base for the group elements (par/seq/excl/..)
*/
class KMPLAYER_NO_EXPORT GroupBase : public TimedMrl {
public:
KDE_NO_CDTOR_EXPORT ~GroupBase () {}
NodePtr childFromTag (const QString & tag);
PlayType playType () { return play_type_none; }
void finish ();
void deactivate ();
void setJumpNode (NodePtr);
protected:
KDE_NO_CDTOR_EXPORT GroupBase (NodePtr & d, short id) : TimedMrl (d, id) {}
NodePtrW jump_node;
};
/**
* A Par represents parallel processing of all its children
*/
class KMPLAYER_NO_EXPORT Par : public GroupBase {
public:
KDE_NO_CDTOR_EXPORT Par (NodePtr & d) : GroupBase (d, id_node_par) {}
KDE_NO_EXPORT const char * nodeName () const { return "par"; }
void begin ();
void reset ();
void childDone (NodePtr child);
};
/**
* A Seq represents sequential processing of all its children
*/
class KMPLAYER_NO_EXPORT Seq : public GroupBase {
public:
KDE_NO_CDTOR_EXPORT Seq (NodePtr & d) : GroupBase(d, id_node_seq) {}
KDE_NO_EXPORT const char * nodeName () const { return "seq"; }
void begin ();
void childDone (NodePtr child);
protected:
KDE_NO_CDTOR_EXPORT Seq (NodePtr & d, short id) : GroupBase(d, id) {}
};
/**
* Represents the 'body' tag of SMIL document as in
* &lt;smil&gt;&lt;head/&gt;&lt;body/&gt;&lt;/smil&gt;
*/
class KMPLAYER_NO_EXPORT Body : public Seq {
public:
KDE_NO_CDTOR_EXPORT Body (NodePtr & d) : Seq (d, id_node_body) {}
KDE_NO_EXPORT const char * nodeName () const { return "body"; }
};
/**
* An Excl represents exclusive processing of one of its children
*/
class KMPLAYER_NO_EXPORT Excl : public GroupBase {
public:
KDE_NO_CDTOR_EXPORT Excl (NodePtr & d) : GroupBase (d, id_node_excl) {}
KDE_NO_EXPORT const char * nodeName () const { return "excl"; }
void begin ();
void deactivate ();
void childDone (NodePtr child);
virtual bool handleEvent (EventPtr event);
private:
typedef ListNode <ConnectionPtr> ConnectionStoreItem;
List <ConnectionStoreItem> started_event_list;
};
/*
* An automatic selection between child elements based on a condition
*/
class KMPLAYER_NO_EXPORT Switch : public GroupBase {
public:
KDE_NO_CDTOR_EXPORT Switch (NodePtr &d) : GroupBase (d, id_node_switch) {}
KDE_NO_EXPORT const char * nodeName () const { return "switch"; }
// Condition
void begin ();
void deactivate ();
void reset ();
void childDone (NodePtr child);
NodePtrW chosenOne;
};
class KMPLAYER_NO_EXPORT LinkingBase : public Element {
public:
KDE_NO_CDTOR_EXPORT ~LinkingBase () {}
void deactivate ();
KDE_NO_EXPORT bool expose () const { return false; }
void parseParam (const TrieString & name, const QString & value);
ConnectionPtr mediatype_activated;
ConnectionPtr mediatype_attach;
QString href;
enum { show_new, show_replace } show;
protected:
LinkingBase (NodePtr & d, short id);
};
class KMPLAYER_NO_EXPORT Anchor : public LinkingBase {
public:
Anchor (NodePtr & d);
KDE_NO_CDTOR_EXPORT ~Anchor () {}
void activate ();
void childDone (NodePtr child);
KDE_NO_EXPORT const char * nodeName () const { return "a"; }
NodePtr childFromTag (const QString & tag);
KDE_NO_EXPORT void accept (Visitor * v) { v->visit (this); }
};
class KMPLAYER_NO_EXPORT Area : public LinkingBase {
public:
Area (NodePtr & d, const QString & tag);
~Area ();
void activate ();
KDE_NO_EXPORT const char * nodeName () const { return tag.ascii (); }
KDE_NO_EXPORT void accept (Visitor * v) { v->visit (this); }
void parseParam (const TrieString & name, const QString & value);
NodeRefListPtr listeners (unsigned int event_id);
SizeType * coords;
int nr_coords;
const QString tag;
MouseListeners mouse_listeners;
};
/**
* Abstract base for the MediaType classes (video/audio/text/img/..)
*/
class KMPLAYER_NO_EXPORT MediaType : public TimedMrl {
public:
MediaType (NodePtr & d, const QString & t, short id);
NodePtr childFromTag (const QString & tag);
KDE_NO_EXPORT const char * nodeName () const { return m_type.latin1 (); }
void closed ();
void activate ();
void deactivate ();
void begin ();
void finish ();
void childDone (NodePtr child);
virtual SurfacePtr getSurface (NodePtr node);
/* (new) sub-region or NULL if not displayed */
Surface *surface ();
void resetSurface ();
SRect calculateBounds ();
void boundsUpdate (); // recalculates and repaint old and new bounds
virtual void parseParam (const TrieString & name, const QString & value);
virtual bool handleEvent (EventPtr event);
NodeRefListPtr listeners (unsigned int event_id);
bool needsVideoWidget (); // for 'video' and 'ref' nodes
SurfacePtrW sub_surface;
NodePtrW external_tree; // if src points to playlist, the resolved top node
NodePtrW trans_in;
NodePtrW trans_out;
NodePtrW active_trans;
NodePtrW region_node;
QString m_type;
CalculatedSizer sizes;
Fit fit;
int opacity;
unsigned int bitrate;
unsigned int trans_step;
unsigned int trans_steps;
enum { sens_opaque, sens_transparent, sens_percentage } sensitivity;
bool trans_out_active;
protected:
MouseListeners mouse_listeners;
NodeRefListPtr m_MediaAttached; // mouse entered
ConnectionPtr region_paint; // attached region needs painting
ConnectionPtr region_mouse_enter; // attached region has mouse entered
ConnectionPtr region_mouse_leave; // attached region has mouse left
ConnectionPtr region_mouse_click; // attached region is clicked
ConnectionPtr region_attach; // attached to region
TimerInfoPtrW trans_timer;
TimerInfoPtrW trans_out_timer;
};
class KMPLAYER_NO_EXPORT AVMediaType : public MediaType {
public:
AVMediaType (NodePtr & d, const QString & t);
NodePtr childFromTag (const QString & tag);
virtual Runtime * getNewRuntime ();
virtual void defer ();
virtual void undefer ();
virtual void endOfFile ();
virtual void accept (Visitor *);
virtual bool expose () const;
};
class KMPLAYER_NO_EXPORT ImageMediaType : public MediaType {
public:
ImageMediaType (NodePtr & d);
Runtime * getNewRuntime ();
NodePtr childFromTag (const QString & tag);
PlayType playType () { return play_type_image; }
virtual void accept (Visitor *);
};
class KMPLAYER_NO_EXPORT TextMediaType : public MediaType {
public:
TextMediaType (NodePtr & d);
Runtime * getNewRuntime ();
PlayType playType () { return play_type_info; }
virtual void accept (Visitor *);
};
class KMPLAYER_NO_EXPORT RefMediaType : public MediaType {
public:
RefMediaType (NodePtr & d);
Runtime * getNewRuntime ();
virtual void accept (Visitor *);
};
class KMPLAYER_NO_EXPORT Brush : public MediaType {
public:
Brush (NodePtr & d);
virtual void accept (Visitor *);
virtual Runtime * getNewRuntime ();
};
class KMPLAYER_NO_EXPORT Set : public TimedMrl {
public:
KDE_NO_CDTOR_EXPORT Set (NodePtr & d) : TimedMrl (d, id_node_set) {}
KDE_NO_EXPORT const char * nodeName () const { return "set"; }
virtual Runtime * getNewRuntime ();
PlayType playType () { return play_type_none; }
};
class KMPLAYER_NO_EXPORT Animate : public TimedMrl {
public:
KDE_NO_CDTOR_EXPORT Animate (NodePtr & d) : TimedMrl (d, id_node_animate) {}
KDE_NO_EXPORT const char * nodeName () const { return "animate"; }
virtual Runtime * getNewRuntime ();
PlayType playType () { return play_type_none; }
bool handleEvent (EventPtr event);
};
class KMPLAYER_NO_EXPORT AnimateMotion : public TimedMrl {
public:
KDE_NO_CDTOR_EXPORT AnimateMotion (NodePtr & d)
: TimedMrl (d, id_node_animate) {}
KDE_NO_EXPORT const char * nodeName () const { return "animateMotion"; }
virtual Runtime *getNewRuntime ();
PlayType playType () { return play_type_none; }
bool handleEvent (EventPtr event);
};
// TODO animateColor transitionFilter
class KMPLAYER_NO_EXPORT Param : public Element {
public:
KDE_NO_CDTOR_EXPORT Param (NodePtr & d) : Element (d, id_node_param) {}
KDE_NO_EXPORT const char * nodeName () const { return "param"; }
void activate ();
bool expose () const { return false; }
};
} // SMIL namespace
} // KMPlayer namespace
#endif //_KMPLAYER_SMIL_H_

@ -0,0 +1,151 @@
/**
* Copyright (C) 2006 by Koos Vriezen <koos.vriezen@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
**/
#include <config.h>
#include <kdebug.h>
#include <kurl.h>
#include "kmplayer_xspf.h"
using namespace KMPlayer;
KDE_NO_EXPORT NodePtr XSPF::Playlist::childFromTag (const QString & tag) {
const char * name = tag.latin1 ();
if (!strcasecmp (name, "tracklist"))
return new Tracklist (m_doc);
else if (!strcasecmp (name, "creator"))
return new DarkNode (m_doc, name, id_node_creator);
else if (!strcasecmp (name, "title"))
return new DarkNode (m_doc, name, id_node_title);
else if (!strcasecmp (name, "annotation"))
return new DarkNode (m_doc, name, id_node_annotation);
else if (!strcasecmp (name, "info"))
return new DarkNode (m_doc, name, id_node_info);
else if (!strcasecmp (name, "location"))
return new DarkNode (m_doc, name, id_node_location);
else if (!strcasecmp (name, "identifier"))
return new DarkNode (m_doc, name, id_node_identifier);
else if (!strcasecmp (name, "image"))
return new DarkNode (m_doc, name, id_node_image);
else if (!strcasecmp (name, "date"))
return new DarkNode (m_doc, name, id_node_date);
else if (!strcasecmp (name, "license"))
return new DarkNode (m_doc, name, id_node_license);
else if (!strcasecmp (name, "attribution"))
return new DarkNode (m_doc, name, id_node_attribution);
else if (!strcasecmp (name, "link"))
return new DarkNode (m_doc, name, id_node_link);
else if (!strcasecmp (name, "meta"))
return new DarkNode (m_doc, name, id_node_meta);
else if (!strcasecmp (name, "extension"))
return new DarkNode (m_doc, name, id_node_extension);
return 0L;
}
KDE_NO_EXPORT void XSPF::Playlist::closed () {
for (NodePtr e = firstChild (); e; e = e->nextSibling ()) {
if (e->id == id_node_title)
pretty_name = e->innerText ().simplifyWhiteSpace ();
else if (e->id == id_node_location)
src = e->innerText ().stripWhiteSpace ();
}
}
//-----------------------------------------------------------------------------
KDE_NO_EXPORT NodePtr XSPF::Tracklist::childFromTag (const QString & tag) {
const char * name = tag.latin1 ();
if (!strcasecmp (name, "track"))
return new XSPF::Track (m_doc);
return 0L;
}
//-----------------------------------------------------------------------------
KDE_NO_EXPORT NodePtr XSPF::Track::childFromTag (const QString & tag) {
const char * name = tag.latin1 ();
if (!strcasecmp (name, "location"))
return new Location (m_doc);
else if (!strcasecmp (name, "creator"))
return new DarkNode (m_doc, name, id_node_creator);
else if (!strcasecmp (name, "title"))
return new DarkNode (m_doc, name, id_node_title);
else if (!strcasecmp (name, "annotation"))
return new DarkNode (m_doc, name, id_node_annotation);
else if (!strcasecmp (name, "info"))
return new DarkNode (m_doc, name, id_node_info);
else if (!strcasecmp (name, "identifier"))
return new DarkNode (m_doc, name, id_node_identifier);
else if (!strcasecmp (name, "album"))
return new DarkNode (m_doc, name, id_node_album);
else if (!strcasecmp (name, "image"))
return new DarkNode (m_doc, name, id_node_image);
else if (!strcasecmp (name, "trackNum"))
return new DarkNode (m_doc, name, id_node_tracknum);
else if (!strcasecmp (name, "duration"))
return new DarkNode (m_doc, name, id_node_duration);
else if (!strcasecmp (name, "link"))
return new DarkNode (m_doc, name, id_node_link);
else if (!strcasecmp (name, "meta"))
return new DarkNode (m_doc, name, id_node_meta);
else if (!strcasecmp (name, "extension"))
return new DarkNode (m_doc, name, id_node_extension);
return 0L;
}
KDE_NO_EXPORT void XSPF::Track::closed () {
for (NodePtr e = firstChild (); e; e = e->nextSibling ()) {
switch (e->id) {
case id_node_title:
pretty_name = e->innerText ();
break;
case id_node_location:
location = e;
src = e->mrl ()->src;
break;
}
}
}
KDE_NO_EXPORT void XSPF::Track::activate () {
for (NodePtr e = firstChild (); e; e = e->nextSibling ())
if (e->id == id_node_annotation) {
PlayListNotify * n = document ()->notify_listener;
if (n)
n->setInfoMessage (e->innerText ().stripWhiteSpace ());
break;
}
Mrl::activate ();
}
KDE_NO_EXPORT Node::PlayType XSPF::Track::playType () {
if (location)
return location->playType ();
return Mrl::playType ();
}
KDE_NO_EXPORT Mrl * XSPF::Track::linkNode () {
if (location)
return location->mrl ();
return Mrl::linkNode ();
}
void XSPF::Location::closed () {
src = innerText ().stripWhiteSpace ();
}

@ -0,0 +1,94 @@
/* This file is part of the KDE project
*
* Copyright (C) 2006 Koos Vriezen <koos.vriezen@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KMPLAYER_XSPF_H_
#define _KMPLAYER_XSPF_H_
#include <qstring.h>
#include "kmplayerplaylist.h"
namespace KMPlayer {
namespace XSPF {
const short id_node_playlist = 500;
const short id_node_title = 501;
const short id_node_creator = 502;
const short id_node_annotation = 503;
const short id_node_info = 504;
const short id_node_location = 505;
const short id_node_identifier = 506;
const short id_node_image = 507;
const short id_node_date = 508;
const short id_node_license = 509;
const short id_node_attribution = 510;
const short id_node_meta = 511;
const short id_node_extension = 512;
const short id_node_tracklist = 513;
const short id_node_track = 514;
const short id_node_album = 515;
const short id_node_tracknum = 516;
const short id_node_duration = 517;
const short id_node_link = 518;
class KMPLAYER_NO_EXPORT Playlist : public Mrl {
public:
KDE_NO_CDTOR_EXPORT Playlist (NodePtr & d) : Mrl (d, id_node_playlist) {}
NodePtr childFromTag (const QString & tag);
KDE_NO_EXPORT const char * nodeName () const { return "playlist"; }
bool expose () const { return !pretty_name.isEmpty (); }
void closed ();
};
class KMPLAYER_NO_EXPORT Tracklist : public Element {
public:
KDE_NO_CDTOR_EXPORT Tracklist (NodePtr & d) : Element (d, id_node_tracklist) {}
NodePtr childFromTag (const QString & tag);
KDE_NO_EXPORT const char * nodeName () const { return "tracklist"; }
bool expose () const { return false; }
};
class KMPLAYER_NO_EXPORT Track : public Mrl {
public:
KDE_NO_CDTOR_EXPORT Track (NodePtr & d) : Mrl (d, id_node_track) {}
void closed ();
void activate ();
PlayType playType ();
Mrl * linkNode ();
KDE_NO_EXPORT const char * nodeName () const { return "track"; }
NodePtr childFromTag (const QString & tag);
NodePtrW location;
};
class KMPLAYER_NO_EXPORT Location : public Mrl {
public:
KDE_NO_CDTOR_EXPORT Location (NodePtr &d) : Mrl (d, id_node_location) {}
KDE_NO_EXPORT const char * nodeName () const { return "location"; }
void closed ();
bool expose () const { return false; }
};
} //namespace XSPF
} // namespace KMPlayer
#endif //_KMPLAYER_XSPF_H_

File diff suppressed because it is too large Load Diff

@ -0,0 +1,205 @@
/***************************************************************************
kmplayersource.h - description
-------------------
begin : Sat Mar 24 16:14:51 CET 2003
copyright : (C) 2003 by Koos Vriezen
email :
***************************************************************************/
/***************************************************************************
* *
* 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 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef KMPLAYERAPPSOURCE_H
#define KMPLAYERAPPSOURCE_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <qframe.h>
#include <kurl.h>
#include "kmplayersource.h"
#include "kmplayerconfig.h"
class KMPlayerApp;
class KURLRequester;
class QPopupMenu;
class QMenuItem;
class QCheckBox;
class QLineEdit;
class TVInput;
class TVChannel;
/*
* Base class for sources having a sub menu in the application
*/
class KMPLAYER_NO_EXPORT KMPlayerMenuSource : public KMPlayer::Source {
Q_OBJECT
public:
KMPlayerMenuSource (const QString & n, KMPlayerApp * app, QPopupMenu * m, const char * src);
virtual ~KMPlayerMenuSource ();
protected:
void menuItemClicked (QPopupMenu * menu, int id);
QPopupMenu * m_menu;
KMPlayerApp * m_app;
};
/*
* Preference page for DVD
*/
class KMPLAYER_NO_EXPORT KMPlayerPrefSourcePageDVD : public QFrame {
Q_OBJECT
public:
KMPlayerPrefSourcePageDVD (QWidget * parent);
~KMPlayerPrefSourcePageDVD () {}
QCheckBox * autoPlayDVD;
KURLRequester * dvddevice;
};
/*
* Source from DVD
*/
class KMPLAYER_NO_EXPORT KMPlayerDVDSource : public KMPlayerMenuSource, public KMPlayer::PreferencesPage {
Q_OBJECT
public:
KMPlayerDVDSource (KMPlayerApp * app, QPopupMenu * m);
virtual ~KMPlayerDVDSource ();
virtual bool processOutput (const QString & line);
virtual QString filterOptions ();
virtual void setIdentified (bool b = true);
virtual QString prettyName ();
virtual void write (KConfig *);
virtual void read (KConfig *);
virtual void sync (bool);
virtual void prefLocation (QString & item, QString & icon, QString & tab);
virtual QFrame * prefPage (QWidget * parent);
public slots:
virtual void activate ();
virtual void deactivate ();
void titleMenuClicked (int id);
void subtitleMenuClicked (int id);
void languageMenuClicked (int id);
void chapterMenuClicked (int id);
private:
void buildArguments ();
void play ();
QPopupMenu * m_dvdtitlemenu;
QPopupMenu * m_dvdchaptermenu;
QPopupMenu * m_dvdlanguagemenu;
QPopupMenu * m_dvdsubtitlemenu;
KMPlayer::NodePtr disks;
KMPlayerPrefSourcePageDVD * m_configpage;
int m_current_title;
bool m_start_play;
};
/*
* Source from DVDNav
*/
class KMPLAYER_NO_EXPORT KMPlayerDVDNavSource : public KMPlayerMenuSource {
Q_OBJECT
public:
KMPlayerDVDNavSource (KMPlayerApp * app, QPopupMenu * m);
virtual ~KMPlayerDVDNavSource ();
virtual QString prettyName ();
public slots:
virtual void activate ();
virtual void deactivate ();
virtual void play ();
void finished ();
void navMenuClicked (int id);
};
/*
* Preference page for VCD
*/
class KMPLAYER_NO_EXPORT KMPlayerPrefSourcePageVCD : public QFrame {
Q_OBJECT
public:
KMPlayerPrefSourcePageVCD (QWidget * parent);
~KMPlayerPrefSourcePageVCD () {}
KURLRequester * vcddevice;
QCheckBox *autoPlayVCD;
};
/*
* Source from VCD
*/
class KMPLAYER_NO_EXPORT KMPlayerVCDSource : public KMPlayerMenuSource, public KMPlayer::PreferencesPage {
Q_OBJECT
public:
KMPlayerVCDSource (KMPlayerApp * app, QPopupMenu * m);
virtual ~KMPlayerVCDSource ();
virtual bool processOutput (const QString & line);
virtual void setIdentified (bool b = true);
virtual QString prettyName ();
virtual void write (KConfig *);
virtual void read (KConfig *);
virtual void sync (bool);
virtual void prefLocation (QString & item, QString & icon, QString & tab);
virtual QFrame * prefPage (QWidget * parent);
public slots:
virtual void activate ();
virtual void deactivate ();
private:
void buildArguments ();
KMPlayerPrefSourcePageVCD * m_configpage;
bool m_start_play;
};
/*
* Source from AudoCD
*/
class KMPLAYER_NO_EXPORT KMPlayerAudioCDSource : public KMPlayerMenuSource {
Q_OBJECT
public:
KMPlayerAudioCDSource (KMPlayerApp * app, QPopupMenu * m);
virtual ~KMPlayerAudioCDSource ();
virtual bool processOutput (const QString & line);
virtual void setIdentified (bool b = true);
virtual QString prettyName ();
public slots:
virtual void activate ();
virtual void deactivate ();
private:
void buildArguments ();
};
/*
* Source from stdin (for the backends, not kmplayer)
*/
class KMPLAYER_NO_EXPORT KMPlayerPipeSource : public KMPlayer::Source {
Q_OBJECT
public:
KMPlayerPipeSource (KMPlayerApp * app);
virtual ~KMPlayerPipeSource ();
virtual bool hasLength ();
virtual bool isSeekable ();
void setCommand (const QString & cmd);
virtual QString prettyName ();
public slots:
virtual void activate ();
virtual void deactivate ();
private:
KMPlayerApp * m_app;
};
#endif // KMPLAYERAPPSOURCE_H

@ -0,0 +1,670 @@
/* this file is part of the kmplayer application
copyright (c) 2003 koos vriezen <koos.vriezen@xs4all.nl>
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 2 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; see the file copying. if not, write to
the free software foundation, inc., 59 temple place - suite 330,
boston, ma 02110-1301, usa.
*/
#include <algorithm>
#include <qlayout.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qtable.h>
#include <qstringlist.h>
#include <qcombobox.h>
#include <qlistbox.h>
#include <qlineedit.h>
#include <qwhatsthis.h>
#include <qtabwidget.h>
#include <qcursor.h>
#include <qdir.h>
#include <qfile.h>
#include <qtimer.h>
#include <klocale.h>
#include <kdebug.h>
#include <kled.h>
#include <kconfig.h>
#include <kprocess.h>
#include <kprocctrl.h>
#include <kmessagebox.h>
#include "kmplayerbroadcast.h"
#include "kmplayerprocess.h"
#include "kmplayerview.h"
#include "kmplayerpartbase.h"
static const char * strBroadcast = "Broadcast";
static const char * strBindAddress = "Bind Address";
static const char * strFFServerPort = "FFServer Port";
static const char * strMaxClients = "Maximum Connections";
static const char * strMaxBandwidth = "Maximum Bandwidth";
static const char * strFeedFile = "Feed File";
static const char * strFeedFileSize = "Feed File Size";
//static const char * strFFServerSetting = "FFServer Setting";
static const char * strFFServerCustomSetting = "Custom Setting";
static const char * strFFServerProfiles = "Profiles";
KDE_NO_CDTOR_EXPORT FFServerSetting::FFServerSetting (int i, const QString & n, const QString & f, const QString & ac, int abr, int asr, const QString & vc, int vbr, int q, int fr, int gs, int w, int h)
: index (i), name (n), format (f), audiocodec (ac),
audiobitrate (abr > 0 ? QString::number (abr) : QString ()),
audiosamplerate (asr > 0 ? QString::number (asr) : QString ()),
videocodec (vc),
videobitrate (vbr > 0 ? QString::number (vbr) : QString ()),
quality (q > 0 ? QString::number (q) : QString ()),
framerate (fr > 0 ? QString::number (fr) : QString ()),
gopsize (gs > 0 ? QString::number (gs) : QString ()),
width (w > 0 ? QString::number (w) : QString ()),
height (h > 0 ? QString::number (h) : QString ()) {}
KDE_NO_EXPORT FFServerSetting & FFServerSetting::operator = (const FFServerSetting & fs) {
format = fs.format;
audiocodec = fs.audiocodec;
audiobitrate = fs.audiobitrate;
audiosamplerate = fs.audiosamplerate;
videocodec = fs.videocodec;
videobitrate = fs.videobitrate;
quality = fs.quality;
framerate = fs.framerate;
gopsize = fs.gopsize;
width = fs.width;
height = fs.height;
return *this;
}
KDE_NO_EXPORT FFServerSetting & FFServerSetting::operator = (const QStringList & sl) {
if (sl.count () < 11) {
return *this;
}
QStringList::const_iterator it = sl.begin ();
format = *it++;
audiocodec = *it++;
audiobitrate = *it++;
audiosamplerate = *it++;
videocodec = *it++;
videobitrate = *it++;
quality = *it++;
framerate = *it++;
gopsize = *it++;
width = *it++;
height = *it++;
acl.clear ();
QStringList::const_iterator end( sl.end() );
for (; it != end; ++it)
acl.push_back (*it);
return *this;
}
KDE_NO_EXPORT QString & FFServerSetting::ffconfig (QString & buf) {
QString nl ("\n");
buf = QString ("Format ") + format + nl;
if (!audiocodec.isEmpty ())
buf += QString ("AudioCodec ") + audiocodec + nl;
if (!audiobitrate.isEmpty ())
buf += QString ("AudioBitRate ") + audiobitrate + nl;
if (!audiosamplerate.isEmpty () > 0)
buf += QString ("AudioSampleRate ") + audiosamplerate + nl;
if (!videocodec.isEmpty ())
buf += QString ("VideoCodec ") + videocodec + nl;
if (!videobitrate.isEmpty ())
buf += QString ("VideoBitRate ") + videobitrate + nl;
if (!quality.isEmpty ())
buf += QString ("VideoQMin ") + quality + nl;
if (!framerate.isEmpty ())
buf += QString ("VideoFrameRate ") + framerate + nl;
if (!gopsize.isEmpty ())
buf += QString ("VideoGopSize ") + gopsize + nl;
if (!width.isEmpty () && !height.isEmpty ())
buf += QString ("VideoSize ") + width + QString ("x") + height + nl;
return buf;
}
KDE_NO_EXPORT const QStringList FFServerSetting::list () {
QStringList sl;
sl.push_back (format);
sl.push_back (audiocodec);
sl.push_back (audiobitrate);
sl.push_back (audiosamplerate);
sl.push_back (videocodec);
sl.push_back (videobitrate);
sl.push_back (quality);
sl.push_back (framerate);
sl.push_back (gopsize);
sl.push_back (width);
sl.push_back (height);
QStringList::const_iterator it = acl.begin ();
QStringList::const_iterator end( acl.end () );
for (; it != end; ++it)
sl.push_back (*it);
return sl;
}
//-----------------------------------------------------------------------------
KDE_NO_CDTOR_EXPORT KMPlayerPrefBroadcastPage::KMPlayerPrefBroadcastPage (QWidget *parent) : QFrame (parent) {
QVBoxLayout *layout = new QVBoxLayout (this, 5);
QGridLayout *gridlayout = new QGridLayout (layout, 6, 2, 2);
QLabel *label = new QLabel (i18n ("Bind address:"), this);
bindaddress = new QLineEdit ("", this);
QWhatsThis::add (bindaddress, i18n ("If you have multiple network devices, you can limit access"));
gridlayout->addWidget (label, 0, 0);
gridlayout->addWidget (bindaddress, 0, 1);
label = new QLabel (i18n ("Listen port:"), this);
port = new QLineEdit ("", this);
gridlayout->addWidget (label, 1, 0);
gridlayout->addWidget (port, 1, 1);
label = new QLabel (i18n ("Maximum connections:"), this);
maxclients = new QLineEdit ("", this);
gridlayout->addWidget (label, 2, 0);
gridlayout->addWidget (maxclients, 2, 1);
label = new QLabel (i18n ("Maximum bandwidth (kbit):"), this);
maxbandwidth = new QLineEdit ("", this);
gridlayout->addWidget (label, 3, 0);
gridlayout->addWidget (maxbandwidth, 3, 1);
label = new QLabel (i18n ("Temporary feed file:"), this);
feedfile = new QLineEdit ("", this);
gridlayout->addWidget (label, 4, 0);
gridlayout->addWidget (feedfile, 4, 1);
label = new QLabel (i18n ("Feed file size (kB):"), this);
feedfilesize = new QLineEdit ("", this);
gridlayout->addWidget (label, 5, 0);
gridlayout->addWidget (feedfilesize, 5, 1);
layout->addItem (new QSpacerItem (0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
}
//-----------------------------------------------------------------------------
#undef ADDPROPERTY
#define ADDPROPERTY(label,qedit,gridlayout,row,parent) \
qedit = new QLineEdit ("", parent); \
gridlayout->addWidget (new QLabel (qedit, label, parent), row, 0); \
gridlayout->addWidget (qedit, row, 1);
KDE_NO_CDTOR_EXPORT KMPlayerPrefBroadcastFormatPage::KMPlayerPrefBroadcastFormatPage (QWidget *parent, FFServerSettingList & ffs) : QFrame (parent, "BroadcastPage"), profiles (ffs)
{
QHBoxLayout *layout = new QHBoxLayout (this, 5);
QGridLayout *formatlayout = new QGridLayout (11, 2, 2);
formatlayout->setAlignment (Qt::AlignTop);
QVBoxLayout *leftlayout = new QVBoxLayout (15);
QHBoxLayout *ledlayout = new QHBoxLayout (5);
format = new QComboBox (this);
QLabel * label = new QLabel (format, i18n ("Format:"), this);
format->clear ();
format->insertItem (QString ("asf"));
format->insertItem (QString ("avi"));
format->insertItem (QString ("mpjpeg"));
format->insertItem (QString ("mpeg"));
format->insertItem (QString ("rm"));
format->insertItem (QString ("swf"));
QWhatsThis::add (format, i18n ("Only avi, mpeg and rm work for mplayer playback"));
formatlayout->addWidget (label, 0, 0);
formatlayout->addWidget (format, 0, 1);
ADDPROPERTY (i18n ("Audio codec:"), audiocodec, formatlayout, 1, this);
ADDPROPERTY (i18n ("Audio bit rate (kbit):"), audiobitrate, formatlayout, 2, this);
ADDPROPERTY (i18n ("Audio sample rate (Hz):"), audiosamplerate, formatlayout, 3, this);
ADDPROPERTY (i18n ("Video codec:"), videocodec, formatlayout, 4, this);
ADDPROPERTY (i18n ("Video bit rate (kbit):"), videobitrate, formatlayout, 5, this);
ADDPROPERTY (i18n ("Quality (1-31):"), quality, formatlayout, 6, this);
ADDPROPERTY (i18n ("Frame rate (Hz):"), framerate, formatlayout, 7, this);
ADDPROPERTY (i18n ("Gop size:"), gopsize, formatlayout, 8, this);
ADDPROPERTY (i18n ("Width (pixels):"), moviewidth, formatlayout, 9, this);
ADDPROPERTY (i18n ("Height (pixels):"), movieheight, formatlayout, 10, this);
label = new QLabel (i18n ("Allow access from:"), this);
accesslist = new QTable (40, 1, this);
accesslist->verticalHeader ()->hide ();
accesslist->setLeftMargin (0);
accesslist->setColumnWidth (0, 250);
QWhatsThis::add (accesslist, i18n ("'Single IP' or 'start-IP end-IP' for IP ranges"));
QHeader *header = accesslist->horizontalHeader ();
header->setLabel (0, i18n ("Host/IP or IP Range"));
QFrame *profileframe = new QFrame (this);
QGridLayout *profileslayout = new QGridLayout (profileframe, 5, 2, 2);
profile = new QLineEdit ("", profileframe);
connect (profile, SIGNAL(textChanged (const QString &)),
this, SLOT (slotTextChanged (const QString &)));
profilelist = new QListBox (profileframe);
for (int i = 0; i < (int) profiles.size (); i++)
profilelist->insertItem (profiles[i]->name, i);
connect (profilelist, SIGNAL (selected (int)),
this, SLOT (slotIndexChanged (int)));
connect (profilelist, SIGNAL (highlighted (int)),
this, SLOT (slotItemHighlighted (int)));
load = new QPushButton (i18n ("Load"), profileframe);
save = new QPushButton (i18n ("Save"), profileframe);
del = new QPushButton (i18n ("Delete"), profileframe);
load->setEnabled (false);
save->setEnabled (false);
del->setEnabled (false);
connect (load, SIGNAL (clicked ()), this, SLOT (slotLoad ()));
connect (save, SIGNAL (clicked ()), this, SLOT (slotSave ()));
connect (del, SIGNAL (clicked ()), this, SLOT (slotDelete ()));
profileslayout->addWidget (profile, 0, 0);
#if (QT_VERSION < 0x030200)
profileslayout->addRowSpacing (4, 60);
#else
profileslayout->setRowSpacing (4, 60);
#endif
profileslayout->addMultiCellWidget (profilelist, 1, 4, 0, 0);
profileslayout->addWidget (load, 1, 1);
profileslayout->addWidget (save, 2, 1);
profileslayout->addWidget (del, 3, 1);
leftlayout->addWidget (profileframe);
startbutton = new QPushButton (i18n ("Start"), this);
serverled = new KLed (Qt::green, KLed::Off, KLed::Raised, KLed::Circular, this);
feedled = new KLed (Qt::green, KLed::Off, KLed::Raised, KLed::Circular, this);
ledlayout->addWidget (startbutton);
ledlayout->addItem (new QSpacerItem (0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum));
ledlayout->addWidget (serverled);
ledlayout->addWidget (feedled);
leftlayout->addLayout (ledlayout);
QFrame * line = new QFrame (this);
line->setFrameShape (QFrame::HLine);
leftlayout->addWidget (line);
leftlayout->addWidget (label);
leftlayout->addWidget (accesslist);
leftlayout->addItem (new QSpacerItem (0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
layout->addLayout (leftlayout);
line = new QFrame (this);
line->setFrameShape (QFrame::VLine);
layout->addWidget (line);
layout->addLayout (formatlayout);
layout->addItem (new QSpacerItem (0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
}
#undef ADDPROPERTY
KDE_NO_EXPORT void KMPlayerPrefBroadcastFormatPage::setSettings (const FFServerSetting & fs) {
if (!fs.format.isEmpty ())
format->setCurrentText (fs.format);
audiocodec->setText (fs.audiocodec);
audiobitrate->setText (fs.audiobitrate);
audiosamplerate->setText (fs.audiosamplerate);
videocodec->setText (fs.videocodec);
videobitrate->setText (fs.videobitrate);
quality->setText (fs.quality);
framerate->setText (fs.framerate);
gopsize->setText (fs.gopsize);
moviewidth->setText (fs.width);
movieheight->setText (fs.height);
accesslist->setNumRows (0);
accesslist->setNumRows (50);
QStringList::const_iterator it = fs.acl.begin ();
QStringList::const_iterator end( fs.acl.end () );
for (int i = 0; it != end; ++i, ++it)
accesslist->setItem (i, 0, new QTableItem (accesslist, QTableItem::Always, *it));
}
KDE_NO_EXPORT void KMPlayerPrefBroadcastFormatPage::getSettings (FFServerSetting & fs) {
fs.format = format->currentText ();
fs.audiocodec = audiocodec->text ();
fs.audiobitrate = audiobitrate->text ();
fs.audiosamplerate = audiosamplerate->text ();
fs.videocodec = videocodec->text ();
fs.videobitrate = videobitrate->text ();
fs.quality = quality->text ();
fs.framerate = framerate->text ();
fs.gopsize = gopsize->text ();
fs.width = moviewidth->text ();
fs.height = movieheight->text ();
fs.acl.clear ();
for (int i = 0; i < accesslist->numRows (); ++i) {
if (accesslist->item (i, 0) && !accesslist->item (i, 0)->text ().isEmpty ())
fs.acl.push_back (accesslist->item (i, 0)->text ());
}
}
KDE_NO_EXPORT void KMPlayerPrefBroadcastFormatPage::slotIndexChanged (int index) {
slotItemHighlighted (index);
if (index >= 0 && index < (int) profiles.size ())
setSettings (*profiles[index]);
}
KDE_NO_EXPORT void KMPlayerPrefBroadcastFormatPage::slotTextChanged (const QString & txt) {
save->setEnabled (txt.length ());
}
KDE_NO_EXPORT void KMPlayerPrefBroadcastFormatPage::slotItemHighlighted (int index) {
if (index < 0 || index >= (int) profiles.size ()) {
load->setEnabled (false);
del->setEnabled (false);
} else {
profile->setText (profiles[profilelist->currentItem ()]->name);
load->setEnabled (true);
del->setEnabled (true);
slotTextChanged (profilelist->currentText ());
}
}
KDE_NO_EXPORT void KMPlayerPrefBroadcastFormatPage::slotSave () {
for (int i = 0; i < (int) profiles.size (); ++i)
if (profiles[i]->name == profile->text ()) {
getSettings (*profiles[i]);
return;
}
FFServerSetting * fs = new FFServerSetting;
fs->name = profile->text ();
getSettings (*fs);
profiles.push_back (fs);
profilelist->insertItem (fs->name);
}
KDE_NO_EXPORT void KMPlayerPrefBroadcastFormatPage::slotLoad () {
setSettings (*profiles[profilelist->currentItem ()]);
}
KDE_NO_EXPORT void KMPlayerPrefBroadcastFormatPage::slotDelete () {
FFServerSettingList::iterator it = profiles.begin();
for (int i = 0; i < profilelist->currentItem (); i++)
++it;
delete *it;
profiles.erase (it);
profilelist->removeItem (profilelist->currentItem ());
load->setEnabled (false);
del->setEnabled (false);
}
//-----------------------------------------------------------------------------
static bool stopProcess (KProcess * process, const char * cmd = 0L) {
if (!process || !process->isRunning ()) return true;
do {
if (cmd)
process->writeStdin (cmd, strlen (cmd));
KProcessController::theKProcessController->waitForProcessExit (1);
if (!process->isRunning ())
break;
process->kill (SIGINT);
KProcessController::theKProcessController->waitForProcessExit (3);
if (!process->isRunning ())
break;
process->kill (SIGTERM);
KProcessController::theKProcessController->waitForProcessExit (1);
if (!process->isRunning ())
break;
process->kill (SIGKILL);
KProcessController::theKProcessController->waitForProcessExit (1);
if (process->isRunning ()) {
return false; // give up
}
} while (false);
return true;
}
KDE_NO_CDTOR_EXPORT KMPlayerBroadcastConfig::KMPlayerBroadcastConfig (KMPlayer::PartBase * player, KMPlayerFFServerConfig * fsc)
: m_player (player),
m_ffserverconfig (fsc),
m_ffmpeg_process (0L),
m_ffserver_process (0L),
m_endserver (true) {
}
KDE_NO_CDTOR_EXPORT KMPlayerBroadcastConfig::~KMPlayerBroadcastConfig () {
stopServer ();
}
KDE_NO_EXPORT void KMPlayerBroadcastConfig::write (KConfig * config) {
config->setGroup (strBroadcast);
config->writeEntry (strFFServerCustomSetting, ffserversettings.list (), ';');
QStringList sl;
for (int i = 0; i < (int) ffserversettingprofiles.size (); i++) {
sl.push_back (ffserversettingprofiles[i]->name);
config->writeEntry (QString ("Profile_") + ffserversettingprofiles[i]->name, ffserversettingprofiles[i]->list(), ';');
}
config->writeEntry (strFFServerProfiles, sl, ';');
}
KDE_NO_EXPORT void KMPlayerBroadcastConfig::read (KConfig * config) {
std::for_each (ffserversettingprofiles.begin (), ffserversettingprofiles.end (), KMPlayer::Deleter<FFServerSetting>());
ffserversettingprofiles.clear ();
config->setGroup (strBroadcast);
ffserversettings = config->readListEntry (strFFServerCustomSetting, ';');
QStringList profiles = config->readListEntry (strFFServerProfiles, ';');
QStringList::iterator pr_it = profiles.begin ();
QStringList::iterator pr_end( profiles.end () );
for (; pr_it != pr_end; ++pr_it) {
QStringList sl = config->readListEntry (QString ("Profile_") + *pr_it, ';');
if (sl.size () > 10) {
FFServerSetting * ffs = new FFServerSetting (sl);
ffs->name = *pr_it;
ffserversettingprofiles.push_back (ffs);
}
}
}
KDE_NO_EXPORT void KMPlayerBroadcastConfig::sync (bool fromUI) {
if (fromUI) {
m_configpage->getSettings(ffserversettings);
} else {
m_configpage->setSettings (ffserversettings);
m_configpage->profile->setText (QString ());
}
}
KDE_NO_EXPORT void KMPlayerBroadcastConfig::prefLocation (QString & item, QString & icon, QString & tab) {
item = i18n ("Broadcasting");
icon = QString ("share");
tab = i18n ("Profiles");
}
QFrame * KMPlayerBroadcastConfig::prefPage (QWidget * parent) {
if (!m_configpage) {
m_configpage = new KMPlayerPrefBroadcastFormatPage (parent, ffserversettingprofiles);
connect (m_configpage->startbutton, SIGNAL (clicked ()), this, SLOT (startServer ()));
connect (m_player, SIGNAL (sourceChanged (KMPlayer::Source *, KMPlayer::Source *)), this, SLOT (sourceChanged (KMPlayer::Source *,KMPlayer::Source *)));
m_configpage->startbutton->setEnabled
(!m_player->source ()->videoDevice ().isEmpty ());
}
return m_configpage;
}
KDE_NO_EXPORT bool KMPlayerBroadcastConfig::broadcasting () const {
return m_ffserver_process && m_ffserver_process->isRunning ();
}
#include <kglobal.h>
#include <kstandarddirs.h>
static const char ffserverconf[] =
"Port %d\nBindAddress %s\nMaxClients %d\nMaxBandwidth %d\n"
"CustomLog -\nNoDaemon\n"
"<Feed kmplayer.ffm>\nFile %s\nFileMaxSize %dK\nACL allow 127.0.0.1\n</Feed>\n"
"<Stream video.%s>\nFeed kmplayer.ffm\n%s\n%s%s\n</Stream>\n"
"<Stream stat.html>\nFormat status\nACL allow localhost\n</Stream>\n";
KDE_NO_EXPORT void KMPlayerBroadcastConfig::startServer () {
if (broadcasting ()) {
stopServer ();
return;
}
m_configpage->setCursor (QCursor (Qt::WaitCursor));
m_ffserver_process = new KProcess;
m_ffserver_process->setUseShell (true);
connect (m_ffserver_process, SIGNAL (processExited (KProcess *)),
this, SLOT (processStopped (KProcess *)));
QString conffile = locateLocal ("data", "kmplayer/ffserver.conf");
const char * noaudio = m_player->source ()->audioDevice ().isEmpty () ? "NoAudio" : "";
FFServerSetting ffs;
m_configpage->getSettings (ffs);
QString acl;
QStringList::iterator it = ffs.acl.begin ();
QStringList::iterator end( ffs.acl.end () );
for (; it != end; ++it)
acl += QString ("ACL allow ") + *it + QString ("\n");
unlink (m_ffserverconfig->feedfile.ascii ());
QFile qfile (conffile);
qfile.open (IO_WriteOnly);
QString configdata;
QString buf;
configdata.sprintf (ffserverconf, m_ffserverconfig->ffserverport, m_ffserverconfig->bindaddress.ascii (), m_ffserverconfig->maxclients, m_ffserverconfig->maxbandwidth, m_ffserverconfig->feedfile.ascii (), m_ffserverconfig->feedfilesize, ffs.format.ascii (), acl.ascii (), ffs.ffconfig (buf).ascii (), noaudio);
qfile.writeBlock (configdata.ascii (), configdata.length ());
qfile.close ();
kdDebug () << configdata << endl;
kdDebug () << "ffserver -f " << conffile << endl;
*m_ffserver_process << "ffserver -f " << conffile;
m_ffserver_out.truncate (0);
connect (m_ffserver_process,
SIGNAL (receivedStderr (KProcess *, char *, int)),
this, SLOT (processOutput (KProcess *, char *, int)));
m_ffserver_process->start (KProcess::NotifyOnExit, KProcess::Stderr);
if (m_ffserver_process->isRunning ()) {
m_configpage->startbutton->setText (i18n ("Stop"));
m_configpage->serverled->setState (KLed::On);
emit broadcastStarted ();
}
QTimer::singleShot (500, this, SLOT (startFeed ()));
}
KDE_NO_EXPORT void KMPlayerBroadcastConfig::stopServer () {
m_endserver = true;
if (m_ffmpeg_process)
m_ffmpeg_process->stop ();
if (!stopProcess (m_ffserver_process))
KMessageBox::error (m_configpage, i18n ("Failed to end ffserver process."), i18n ("Error"));
}
KDE_NO_EXPORT void KMPlayerBroadcastConfig::processOutput (KProcess * p, char * s, int) {
if (p == m_ffserver_process)
m_ffserver_out += QString (s);
}
KDE_NO_EXPORT void KMPlayerBroadcastConfig::startFeed () {
if (!m_configpage) {
stopServer ();
return;
}
FFServerSetting ffs;
m_configpage->getSettings (ffs);
QString ffurl;
if (!m_ffserver_process || !m_ffserver_process->isRunning ()) {
KMessageBox::error (m_configpage, i18n ("Failed to start ffserver.\n") + m_ffserver_out, i18n ("Error"));
goto bail_out;
}
disconnect (m_ffserver_process, SIGNAL (receivedStderr (KProcess *, char *, int)),
this, SLOT (processOutput (KProcess *, char *, int)));
if (m_ffmpeg_process)
m_ffmpeg_process->stop ();
delete m_ffmpeg_process;
m_ffmpeg_process = new KMPlayer::FFMpeg (m_player, m_player->settings ());
connect (m_ffmpeg_process, SIGNAL (stateChange (KMPlayer::Process::State, KMPlayer::Process::State)), this, SLOT (stateChange (KMPlayer::Process::State, KMPlayer::Process::State)));
ffurl.sprintf ("http://localhost:%d/kmplayer.ffm", m_ffserverconfig->ffserverport);
m_ffmpeg_process->setURL (KURL(ffurl));
if (!m_ffmpeg_process->play (m_player->source (), KMPlayer::NodePtr())) {
KMessageBox::error (m_configpage, i18n ("Failed to start ffmpeg."), i18n ("Error"));
stopProcess (m_ffserver_process);
goto bail_out;
}
if (m_ffmpeg_process->playing ()) {
m_ffserver_url.sprintf ("http://localhost:%d/video.%s", m_ffserverconfig->ffserverport, ffs.format.ascii ());
m_endserver = false;
m_configpage->feedled->setState (KLed::On);
m_player->openURL (KURL (m_ffserver_url));
} else
stopServer ();
bail_out:
m_configpage->setCursor (QCursor (Qt::ArrowCursor));
}
KDE_NO_EXPORT void KMPlayerBroadcastConfig::stateChange (KMPlayer::Process::State old, KMPlayer::Process::State state) {
if (state < KMPlayer::Process::Buffering && old >KMPlayer::Process::Ready) {
if (m_configpage)
m_configpage->feedled->setState (KLed::Off);
m_ffmpeg_process->deleteLater ();
m_ffmpeg_process = 0L;
kdDebug () << "ffmpeg process stopped " << m_endserver << endl;
if (m_endserver && !stopProcess (m_ffserver_process)) {
disconnect (m_ffserver_process,
SIGNAL (receivedStderr (KProcess *, char *, int)),
this, SLOT (processOutput (KProcess *, char *, int)));
KMessageBox::error (m_configpage, i18n ("Failed to end ffserver process."), i18n ("Error"));
processStopped (0L);
}
}
}
KDE_NO_EXPORT void KMPlayerBroadcastConfig::processStopped (KProcess *) {
kdDebug () << "ffserver process stopped" << endl;
if (m_configpage) {
m_configpage->serverled->setState (KLed::Off);
m_configpage->startbutton->setText (i18n ("Start"));
m_configpage->startbutton->setEnabled
(!m_player->source ()->videoDevice ().isEmpty ());
}
m_ffserver_process->deleteLater ();
m_ffserver_process = 0L;
emit broadcastStopped ();
}
KDE_NO_EXPORT void KMPlayerBroadcastConfig::sourceChanged (KMPlayer::Source *, KMPlayer::Source * source) {
if (m_configpage)
m_configpage->startbutton->setEnabled (broadcasting () || (source && !source->videoDevice ().isEmpty ()));
}
//-----------------------------------------------------------------------------
KDE_NO_CDTOR_EXPORT KMPlayerFFServerConfig::KMPlayerFFServerConfig () {
}
KDE_NO_EXPORT void KMPlayerFFServerConfig::write (KConfig * config) {
config->setGroup (strBroadcast);
config->writeEntry (strBindAddress, bindaddress);
config->writeEntry (strFFServerPort, ffserverport);
config->writeEntry (strMaxClients, maxclients);
config->writeEntry (strMaxBandwidth, maxbandwidth);
config->writePathEntry (strFeedFile, feedfile);
config->writeEntry (strFeedFileSize, feedfilesize);
}
KDE_NO_EXPORT void KMPlayerFFServerConfig::read (KConfig * config) {
config->setGroup (strBroadcast);
bindaddress = config->readEntry (strBindAddress, "0.0.0.0");
ffserverport = config->readNumEntry (strFFServerPort, 8090);
maxclients = config->readNumEntry (strMaxClients, 10);
maxbandwidth = config->readNumEntry (strMaxBandwidth, 1000);
feedfile = config->readPathEntry (strFeedFile, "/tmp/kmplayer.ffm");
feedfilesize = config->readNumEntry (strFeedFileSize, 512);
}
KDE_NO_EXPORT void KMPlayerFFServerConfig::sync (bool fromUI) {
if (fromUI) {
bindaddress = m_configpage->bindaddress->text ();
ffserverport = m_configpage->port->text ().toInt ();
maxclients = m_configpage->maxclients->text ().toInt ();
maxbandwidth = m_configpage->maxbandwidth->text ().toInt();
feedfile = m_configpage->feedfile->text ();
feedfilesize = m_configpage->feedfilesize->text ().toInt();
} else {
m_configpage->bindaddress->setText (bindaddress);
m_configpage->port->setText (QString::number (ffserverport));
m_configpage->maxclients->setText (QString::number (maxclients));
m_configpage->maxbandwidth->setText (QString::number (maxbandwidth));
m_configpage->feedfile->setText (feedfile);
m_configpage->feedfilesize->setText (QString::number (feedfilesize));
}
}
KDE_NO_EXPORT void KMPlayerFFServerConfig::prefLocation (QString & item, QString & icon, QString & tab) {
item = i18n ("Broadcasting");
icon = QString ("share");
tab = i18n ("FFServer");
}
KDE_NO_EXPORT QFrame *KMPlayerFFServerConfig::prefPage (QWidget * parent) {
if (!m_configpage)
m_configpage = new KMPlayerPrefBroadcastPage (parent);
return m_configpage;
}
#include "kmplayerbroadcast.moc"

@ -0,0 +1,194 @@
/* this file is part of the kmplayer application
copyright (c) 2003 koos vriezen <koos.vriezen@xs4all.nl>
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 2 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; see the file copying. if not, write to
the free software foundation, inc., 59 temple place - suite 330,
boston, ma 02110-1301, usa.
*/
#ifndef _KMPLAYER_BROADCAST_SOURCE_H_
#define _KMPLAYER_BROADCAST_SOURCE_H_
#include <list>
#include <vector>
#include <qframe.h>
#include <qguardedptr.h>
#include "kmplayerappsource.h"
#include "kmplayerprocess.h"
#include "kmplayerconfig.h"
class KMPlayerPrefBroadcastPage; // broadcast
class KMPlayerPrefBroadcastFormatPage; // broadcast format
class QListBox;
class QComboBox;
class QLineEdit;
class QTable;
class QPushButton;
class KLed;
namespace KMPlayer {
class FFMpeg;
}
class KMPLAYER_NO_EXPORT FFServerSetting {
public:
KDE_NO_CDTOR_EXPORT FFServerSetting () {}
FFServerSetting (int i, const QString & n, const QString & f, const QString & ac, int abr, int asr, const QString & vc, int vbr, int q, int fr, int gs, int w, int h);
KDE_NO_CDTOR_EXPORT FFServerSetting (const QStringList & sl) { *this = sl; }
KDE_NO_CDTOR_EXPORT ~FFServerSetting () {}
int index;
QString name;
QString format;
QString audiocodec;
QString audiobitrate;
QString audiosamplerate;
QString videocodec;
QString videobitrate;
QString quality;
QString framerate;
QString gopsize;
QString width;
QString height;
QStringList acl;
FFServerSetting & operator = (const QStringList &);
FFServerSetting & operator = (const FFServerSetting & fs);
const QStringList list ();
QString & ffconfig (QString & buf);
};
typedef std::vector <FFServerSetting *> FFServerSettingList;
class KMPLAYER_NO_EXPORT KMPlayerPrefBroadcastPage : public QFrame {
Q_OBJECT
public:
KMPlayerPrefBroadcastPage (QWidget * parent);
KDE_NO_CDTOR_EXPORT ~KMPlayerPrefBroadcastPage () {}
QLineEdit * bindaddress;
QLineEdit * port;
QLineEdit * maxclients;
QLineEdit * maxbandwidth;
QLineEdit * feedfile;
QLineEdit * feedfilesize;
};
class KMPLAYER_NO_EXPORT KMPlayerPrefBroadcastFormatPage : public QFrame {
Q_OBJECT
public:
KMPlayerPrefBroadcastFormatPage (QWidget * parent, FFServerSettingList &);
KDE_NO_CDTOR_EXPORT ~KMPlayerPrefBroadcastFormatPage () {}
QListBox * profilelist;
QComboBox * format;
QLineEdit * audiocodec;
QLineEdit * audiobitrate;
QLineEdit * audiosamplerate;
QLineEdit * videocodec;
QLineEdit * videobitrate;
QLineEdit * quality;
QLineEdit * framerate;
QLineEdit * gopsize;
QLineEdit * moviewidth;
QLineEdit * movieheight;
QLineEdit * profile;
QPushButton * startbutton;
KLed * serverled;
KLed * feedled;
void setSettings (const FFServerSetting &);
void getSettings (FFServerSetting &);
private slots:
void slotIndexChanged (int index);
void slotItemHighlighted (int index);
void slotTextChanged (const QString &);
void slotLoad ();
void slotSave ();
void slotDelete ();
private:
QTable * accesslist;
QPushButton * load;
QPushButton * save;
QPushButton * del;
FFServerSettingList & profiles;
};
/*
* Preference page for ffmpeg commandline arguments
*/
class KMPLAYER_NO_EXPORT KMPlayerFFServerConfig : public KMPlayer::PreferencesPage {
public:
KMPlayerFFServerConfig ();
KDE_NO_CDTOR_EXPORT ~KMPlayerFFServerConfig () {}
virtual void write (KConfig *);
virtual void read (KConfig *);
virtual void sync (bool fromUI);
virtual void prefLocation (QString & item, QString & icon, QString & tab);
virtual QFrame * prefPage (QWidget * parent);
int ffserverport;
int maxclients;
int maxbandwidth;
QString feedfile;
int feedfilesize;
QString bindaddress;
private:
QGuardedPtr <KMPlayerPrefBroadcastPage> m_configpage;
};
/*
* Preference page for ffserver
*/
class KMPLAYER_NO_EXPORT KMPlayerBroadcastConfig : public QObject, public KMPlayer::PreferencesPage {
Q_OBJECT
public:
KMPlayerBroadcastConfig (KMPlayer::PartBase * player, KMPlayerFFServerConfig * fsc);
KDE_NO_CDTOR_EXPORT ~KMPlayerBroadcastConfig ();
virtual void write (KConfig *);
virtual void read (KConfig *);
virtual void sync (bool fromUI);
virtual void prefLocation (QString & item, QString & icon, QString & tab);
virtual QFrame * prefPage (QWidget * parent);
bool broadcasting () const;
void stopServer ();
KDE_NO_EXPORT const QString & serverURL () const { return m_ffserver_url; }
FFServerSetting ffserversettings;
FFServerSettingList ffserversettingprofiles;
signals:
void broadcastStarted ();
void broadcastStopped ();
private slots:
void processOutput (KProcess *, char *, int);
void processStopped (KProcess * process);
void startServer ();
void startFeed ();
void stateChange (KMPlayer::Process::State, KMPlayer::Process::State);
void sourceChanged (KMPlayer::Source *, KMPlayer::Source *);
private:
KMPlayer::PartBase * m_player;
KMPlayerFFServerConfig * m_ffserverconfig;
QGuardedPtr <KMPlayerPrefBroadcastFormatPage> m_configpage;
KMPlayer::FFMpeg * m_ffmpeg_process;
KProcess * m_ffserver_process;
bool m_endserver;
QString m_ffserver_out;
QString m_ffserver_url;
};
#endif //_KMPLAYER_BROADCAST_SOURCE_H_

@ -0,0 +1,749 @@
/**
* Copyright (C) 2002-2003 by Koos Vriezen <koos.vriezen@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
**/
#include <algorithm>
#include <functional>
#include <config.h>
#include <qcheckbox.h>
#include <qtextedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qtabwidget.h>
#include <qslider.h>
#include <qspinbox.h>
#include <qlabel.h>
#include <qbuttongroup.h>
#include <qfileinfo.h>
#include <kurlrequester.h>
#include <klineedit.h>
#include <kstatusbar.h>
#include <kconfig.h>
#include <kapplication.h>
#include <kurl.h>
#include <kdebug.h>
#include <klocale.h>
#include <kcombobox.h>
#include <kmessagebox.h>
#include <kglobalsettings.h>
#include "kmplayersource.h"
#include "kmplayerconfig.h"
#include "kmplayerpartbase.h"
#include "kmplayerprocess.h"
#include "playlistview.h"
#include "viewarea.h"
#include "pref.h"
using namespace KMPlayer;
static OutputDriver _ads[] = {
{ "alsa,oss,sdl,arts", i18n ("Auto") },
{ "oss", i18n ("Open Sound System") },
{ "sdl", i18n ("Simple DirectMedia Layer") },
{ "alsa", i18n ("Advanced Linux Sound Architecture") },
{ "arts", i18n ("Analog Real-Time Synthesizer") },
{ "jack", i18n ("JACK Audio Connection Kit") },
{ "openal", i18n ("OpenAL") },
{ "esd", i18n ("Enlightened Sound Daemon") },
{ "alsa5", i18n ("Advanced Linux Sound Architecture v0.5") },
{ "alsa9", i18n ("Advanced Linux Sound Architecture v0.9") },
{ "", i18n ("Use back-end defaults") },
{ 0, QString () }
};
static OutputDriver _vds [] = {
{ "xv,sdl,x11", i18n ("Auto") },
{ "x11", i18n ("X11Shm") },
{ "xvidix", i18n ("XVidix") },
{ "xvmc,xv", i18n ("XvMC") },
{ "sdl", i18n ("SDL") },
{ "gl", i18n ("OpenGL") },
{ "gl2", i18n ("OpenGL MT") },
{ "xv", i18n ("XVideo") },
{ 0, QString () }
};
static const int ADRIVER_ARTS_INDEX = 4;
KDE_NO_CDTOR_EXPORT Settings::Settings (PartBase * player, KConfig * config)
: pagelist (0L), configdialog (0L), m_config (config), m_player (player) {
audiodrivers = _ads;
videodrivers = _vds;
colors [ColorSetting::playlist_background].title = i18n ("Playlist background");
colors [ColorSetting::playlist_background].option = "PlaylistBackground";
colors [ColorSetting::playlist_background].color = KGlobalSettings::baseColor ();
colors [ColorSetting::playlist_foreground].title = i18n ("Playlist foreground");
colors [ColorSetting::playlist_foreground].option = "PlaylistForeground";
colors [ColorSetting::playlist_foreground].color = KGlobalSettings::textColor();
colors [ColorSetting::console_background].title =i18n("Console background");
colors [ColorSetting::playlist_active].title = i18n("Playlist active item");
colors [ColorSetting::playlist_active].option = "PlaylistActive";
colors [ColorSetting::playlist_active].color = KGlobalSettings::linkColor();
colors [ColorSetting::console_background].option = "ConsoleBackground";
colors [ColorSetting::console_background].color = QColor (0, 0, 0);
colors [ColorSetting::console_foreground].title = i18n ("Console foreground");
colors [ColorSetting::console_foreground].option = "ConsoleForeground";
colors [ColorSetting::console_foreground].color = QColor (0xB2, 0xB2, 0xB2);
colors [ColorSetting::video_background].title = i18n ("Video background");
colors [ColorSetting::video_background].option = "VideoBackground";
colors [ColorSetting::video_background].color = QColor (0, 0, 0);
colors [ColorSetting::area_background].title = i18n ("Viewing area background");
colors [ColorSetting::area_background].option = "ViewingAreaBackground";
colors [ColorSetting::area_background].color = QColor (0, 0, 0);
colors [ColorSetting::infowindow_background].title = i18n ("Info window background");
colors [ColorSetting::infowindow_background].option ="InfoWindowBackground";
colors [ColorSetting::infowindow_background].color = KGlobalSettings::baseColor ();
colors [ColorSetting::infowindow_foreground].title = i18n ("Info window foreground");
colors [ColorSetting::infowindow_foreground].option ="InfoWindowForeground";
colors [ColorSetting::infowindow_foreground].color = KGlobalSettings::textColor();
fonts [FontSetting::playlist].title = i18n ("Playlist");
fonts [FontSetting::playlist].option = "PlaylistFont";
fonts [FontSetting::playlist].font = KGlobalSettings::generalFont();
fonts [FontSetting::playlist].font.setItalic (true);
fonts [FontSetting::infowindow].title = i18n ("Info window");
fonts [FontSetting::infowindow].option = "InfoWindowFont";
fonts [FontSetting::infowindow].font = KGlobalSettings::generalFont();
}
KDE_NO_CDTOR_EXPORT Settings::~Settings () {
// configdialog should be destroyed when the view is destroyed
//delete configdialog;
}
KDE_EXPORT const char * strMPlayerGroup = "MPlayer";
const char * strGeneralGroup = "General Options";
static const char * strKeepSizeRatio = "Keep Size Ratio";
static const char * strRememberSize = "Remember Size";
static const char * strAutoResize = "Auto Resize";
static const char * strDockSysTray = "Dock in System Tray";
static const char * strNoIntro = "No Intro";
static const char * strVolume = "Volume";
static const char * strContrast = "Contrast";
static const char * strBrightness = "Brightness";
static const char * strHue = "Hue";
static const char * strSaturation = "Saturation";
static const char * strURLList = "URL List";
static const char * strSubURLList = "URL Sub Title List";
static const char * strPrefBitRate = "Prefered Bitrate";
static const char * strMaxBitRate = "Maximum Bitrate";
//static const char * strUseArts = "Use aRts";
static const char * strVoDriver = "Video Driver";
static const char * strAoDriver = "Audio Driver";
static const char * strLoop = "Loop";
static const char * strFrameDrop = "Frame Drop";
static const char * strAdjustVolume = "Auto Adjust Volume";
static const char * strAdjustColors = "Auto Adjust Colors";
static const char * strAddConfigButton = "Add Configure Button";
static const char * strAddPlaylistButton = "Add Playlist Button";
static const char * strAddRecordButton = "Add Record Button";
static const char * strAddBroadcastButton = "Add Broadcast Button";
static const char * strPostMPlayer090 = "Post MPlayer 0.90";
//static const char * strAutoHideSlider = "Auto Hide Slider";
static const char * strSeekTime = "Forward/Backward Seek Time";
static const char * strDVDDevice = "DVD Device";
//static const char * strShowDVD = "Show DVD Menu";
//static const char * strShowVCD = "Show VCD Menu";
static const char * strVCDDevice = "VCD Device";
const char * strUrlBackend = "URL Backend";
static const char * strAllowHref = "Allow HREF";
// postproc thingies
static const char * strPPGroup = "Post processing options";
static const char * strPostProcessing = "Post processing";
static const char * strDisablePPauto = "Automaticly disable post processing";
static const char * strPP_Default = "Default preset";
static const char * strPP_Fast = "Fast preset";
static const char * strPP_Custom = "Custom preset";
static const char * strCustom_Hz = "Horizontal deblocking";
static const char * strCustom_Hz_Aq = "Horizontal deblocking auto quality";
static const char * strCustom_Hz_Ch = "Horizontal deblocking chrominance";
static const char * strCustom_Vt = "Vertical deblocking";
static const char * strCustom_Vt_Aq = "Vertical deblocking auto quality";
static const char * strCustom_Vt_Ch = "Vertical deblocking chrominance";
static const char * strCustom_Dr = "Dering filter";
static const char * strCustom_Dr_Aq = "Dering auto quality";
static const char * strCustom_Dr_Ch = "Dering chrominance";
static const char * strCustom_Al = "Autolevel";
static const char * strCustom_Al_F = "Autolevel full range";
static const char * strCustom_Tn = "Temporal Noise Reducer";
static const char * strCustom_Tn_S = "Temporal Noise Reducer strength";
static const char * strPP_Lin_Blend_Int = "Linear Blend Deinterlacer";
static const char * strPP_Lin_Int = "Linear Interpolating Deinterlacer";
static const char * strPP_Cub_Int = "Cubic Interpolating Deinterlacer";
static const char * strPP_Med_Int = "Median Interpolating Deinterlacer";
static const char * strPP_FFmpeg_Int = "FFmpeg Interpolating Deinterlacer";
// end of postproc
// recording
static const char * strRecordingGroup = "Recording";
static const char * strRecorder = "Recorder";
static const char * strMencoderArgs = "Mencoder Arguments";
static const char * strFFMpegArgs = "FFMpeg Arguments";
static const char * strRecordingFile = "Last Recording Ouput File";
static const char * strAutoPlayAfterRecording = "Auto Play After Recording";
static const char * strAutoPlayAfterTime = "Auto Play After Recording Time";
static const char * strRecordingCopy = "Recording Is Copy";
KDE_NO_EXPORT void Settings::applyColorSetting (bool only_changed_ones) {
View *view = static_cast <View *> (m_player->view ());
if (!view) return;
for (int i = 0; i < int (ColorSetting::last_target); i++)
if (!only_changed_ones || colors[i].color != colors[i].newcolor) {
colors[i].color = colors[i].newcolor;
switch (ColorSetting::Target (i)) {
case ColorSetting::playlist_background:
view->playList()->setPaletteBackgroundColor(colors[i].color);
break;
case ColorSetting::playlist_foreground:
view->playList()->setPaletteForegroundColor(colors[i].color);
break;
case ColorSetting::playlist_active:
view->playList()->setActiveForegroundColor (colors[i].color);
break;
case ColorSetting::console_background:
view->console()->setPaper (QBrush (colors[i].color));
break;
case ColorSetting::console_foreground:
view->console()->setColor(colors[i].color);
break;
case ColorSetting::video_background:
view->viewer ()->setBackgroundColor (colors[i].color);
break;
case ColorSetting::area_background:
view->viewArea()->setPaletteBackgroundColor(colors[i].color);
break;
case ColorSetting::infowindow_background:
view->infoPanel ()->setPaper (QBrush (colors[i].color));
break;
case ColorSetting::infowindow_foreground:
view->infoPanel()->setPaletteForegroundColor(colors[i].color);
view->infoPanel ()->setColor (colors[i].color);
break;
default:
;
}
}
for (int i = 0; i < int (FontSetting::last_target); i++)
if (!only_changed_ones || fonts[i].font != fonts[i].newfont) {
fonts[i].font = fonts[i].newfont;
switch (FontSetting::Target (i)) {
case FontSetting::playlist:
view->playList ()->setFont (fonts[i].font);
break;
case FontSetting::infowindow:
view->infoPanel ()->setFont (fonts[i].font);
break;
default:
;
}
}
}
View * Settings::defaultView () {
return static_cast <View *> (m_player->view ());
}
KDE_NO_EXPORT void Settings::readConfig () {
m_config->setGroup (strGeneralGroup);
no_intro = m_config->readBoolEntry (strNoIntro, false);
urllist = m_config->readListEntry (strURLList, ';');
sub_urllist = m_config->readListEntry (strSubURLList, ';');
prefbitrate = m_config->readNumEntry (strPrefBitRate, 512);
maxbitrate = m_config->readNumEntry (strMaxBitRate, 1024);
volume = m_config->readNumEntry (strVolume, 20);
contrast = m_config->readNumEntry (strContrast, 0);
brightness = m_config->readNumEntry (strBrightness, 0);
hue = m_config->readNumEntry (strHue, 0);
saturation = m_config->readNumEntry (strSaturation, 0);
const QMap <QString, Source*>::const_iterator e = m_player->sources ().end ();
QMap <QString, Source *>::const_iterator i = m_player->sources().begin ();
for (; i != e; ++i)
backends[i.data()->name ()] = m_config->readEntry (i.data()->name ());
for (int i = 0; i < int (ColorSetting::last_target); i++)
colors[i].newcolor = colors[i].color = m_config->readColorEntry (colors[i].option, &colors[i].color);
for (int i = 0; i < int (FontSetting::last_target); i++)
fonts[i].newfont = fonts[i].font = m_config->readFontEntry (fonts[i].option, &fonts[i].font);
m_config->setGroup (strMPlayerGroup);
sizeratio = m_config->readBoolEntry (strKeepSizeRatio, true);
remembersize = m_config->readBoolEntry (strRememberSize, true);
autoresize = m_config->readBoolEntry (strAutoResize, true);
docksystray = m_config->readBoolEntry (strDockSysTray, true);
loop = m_config->readBoolEntry (strLoop, false);
framedrop = m_config->readBoolEntry (strFrameDrop, true);
autoadjustvolume = m_config->readBoolEntry (strAdjustVolume, true);
autoadjustcolors = m_config->readBoolEntry (strAdjustColors, true);
mplayerpost090 = m_config->readBoolEntry (strPostMPlayer090, true);
showcnfbutton = m_config->readBoolEntry (strAddConfigButton, true);
showrecordbutton = m_config->readBoolEntry (strAddRecordButton, true);
showbroadcastbutton = m_config->readBoolEntry (strAddBroadcastButton, true);
showplaylistbutton = m_config->readBoolEntry (strAddPlaylistButton, true);
seektime = m_config->readNumEntry (strSeekTime, 10);
dvddevice = m_config->readEntry (strDVDDevice, "/dev/dvd");
vcddevice = m_config->readEntry (strVCDDevice, "/dev/cdrom");
videodriver = m_config->readNumEntry (strVoDriver, 0);
audiodriver = m_config->readNumEntry (strAoDriver, 0);
allowhref = m_config->readBoolEntry(strAllowHref, false);
// recording
m_config->setGroup (strRecordingGroup);
mencoderarguments = m_config->readEntry (strMencoderArgs, "-oac mp3lame -ovc lavc");
ffmpegarguments = m_config->readEntry (strFFMpegArgs, "-f avi -acodec mp3 -vcodec mpeg4");
recordfile = m_config->readPathEntry(strRecordingFile, QDir::homeDirPath () + "/record.avi");
recorder = Recorder (m_config->readNumEntry (strRecorder, int (MEncoder)));
replayoption = ReplayOption (m_config->readNumEntry (strAutoPlayAfterRecording, ReplayFinished));
replaytime = m_config->readNumEntry (strAutoPlayAfterTime, 60);
recordcopy = m_config->readBoolEntry(strRecordingCopy, true);
// postproc
m_config->setGroup (strPPGroup);
postprocessing = m_config->readBoolEntry (strPostProcessing, false);
disableppauto = m_config->readBoolEntry (strDisablePPauto, true);
pp_default = m_config->readBoolEntry (strPP_Default, true);
pp_fast = m_config->readBoolEntry (strPP_Fast, false);
pp_custom = m_config->readBoolEntry (strPP_Custom, false);
// default these to default preset
pp_custom_hz = m_config->readBoolEntry (strCustom_Hz, true);
pp_custom_hz_aq = m_config->readBoolEntry (strCustom_Hz_Aq, true);
pp_custom_hz_ch = m_config->readBoolEntry (strCustom_Hz_Ch, false);
pp_custom_vt = m_config->readBoolEntry (strCustom_Vt, true);
pp_custom_vt_aq = m_config->readBoolEntry (strCustom_Vt_Aq, true);
pp_custom_vt_ch = m_config->readBoolEntry (strCustom_Vt_Ch, false);
pp_custom_dr = m_config->readBoolEntry (strCustom_Dr, true);
pp_custom_dr_aq = m_config->readBoolEntry (strCustom_Dr_Aq, true);
pp_custom_dr_ch = m_config->readBoolEntry (strCustom_Dr_Ch, false);
pp_custom_al = m_config->readBoolEntry (strCustom_Al, true);
pp_custom_al_f = m_config->readBoolEntry (strCustom_Al_F, false);
pp_custom_tn = m_config->readBoolEntry (strCustom_Tn, true);
pp_custom_tn_s = m_config->readNumEntry (strCustom_Tn_S, 0);
pp_lin_blend_int = m_config->readBoolEntry (strPP_Lin_Blend_Int, false);
pp_lin_int = m_config->readBoolEntry (strPP_Lin_Int, false);
pp_cub_int = m_config->readBoolEntry (strPP_Cub_Int, false);
pp_med_int = m_config->readBoolEntry (strPP_Med_Int, false);
pp_ffmpeg_int = m_config->readBoolEntry (strPP_FFmpeg_Int, false);
for (PreferencesPage * p = pagelist; p; p = p->next)
p->read (m_config);
emit configChanged ();
}
KDE_NO_EXPORT bool Settings::createDialog () {
if (configdialog) return false;
configdialog = new Preferences (m_player, this);
int id = 0;
const PartBase::ProcessMap::const_iterator e = m_player->players ().end ();
for (PartBase::ProcessMap::const_iterator i = m_player->players ().begin(); i != e; ++i) {
Process * p = i.data ();
if (p->supports ("urlsource"))
configdialog->m_SourcePageURL->backend->insertItem (p->menuName ().remove (QChar ('&')), id++);
}
connect (configdialog, SIGNAL (okClicked ()),
this, SLOT (okPressed ()));
connect (configdialog, SIGNAL (applyClicked ()),
this, SLOT (okPressed ()));
if (KApplication::kApplication())
connect (configdialog, SIGNAL (helpClicked ()),
this, SLOT (getHelp ()));
return true;
}
void Settings::addPage (PreferencesPage * page) {
for (PreferencesPage * p = pagelist; p; p = p->next)
if (p == page)
return;
page->read (m_config);
if (configdialog) {
configdialog->addPrefPage (page);
page->sync (false);
}
page->next = pagelist;
pagelist = page;
}
void Settings::removePage (PreferencesPage * page) {
if (configdialog)
configdialog->removePrefPage (page);
PreferencesPage * prev = 0L;
for (PreferencesPage * p = pagelist; p; prev = p, p = p->next)
if (p == page) {
if (prev)
prev->next = p->next;
else
pagelist = p->next;
break;
}
}
void Settings::show (const char * pagename) {
bool created = createDialog ();
configdialog->m_GeneralPageGeneral->keepSizeRatio->setChecked (sizeratio);
configdialog->m_GeneralPageGeneral->autoResize->setChecked (autoresize);
configdialog->m_GeneralPageGeneral->sizesChoice->setButton (remembersize ? 0 : 1);
configdialog->m_GeneralPageGeneral->dockSysTray->setChecked (docksystray);
configdialog->m_GeneralPageGeneral->loop->setChecked (loop);
configdialog->m_GeneralPageGeneral->framedrop->setChecked (framedrop);
configdialog->m_GeneralPageGeneral->adjustvolume->setChecked (autoadjustvolume);
configdialog->m_GeneralPageGeneral->adjustcolors->setChecked (autoadjustcolors);
//configdialog->m_GeneralPageGeneral->autoHideSlider->setChecked (autohideslider);
configdialog->m_GeneralPageGeneral->showConfigButton->setChecked (showcnfbutton);
configdialog->m_GeneralPageGeneral->showPlaylistButton->setChecked (showplaylistbutton);
configdialog->m_GeneralPageGeneral->showRecordButton->setChecked (showrecordbutton);
configdialog->m_GeneralPageGeneral->showBroadcastButton->setChecked (showbroadcastbutton);
configdialog->m_GeneralPageGeneral->seekTime->setValue(seektime);
for (int i = 0; i < int (ColorSetting::last_target); i++)
colors[i].newcolor = colors[i].color;
for (int i = 0; i < int (FontSetting::last_target); i++)
fonts[i].newfont = fonts[i].font;
configdialog->m_SourcePageURL->urllist->clear ();
configdialog->m_SourcePageURL->urllist->insertStringList (urllist);
configdialog->m_SourcePageURL->urllist->setCurrentText (m_player->source ()->url ().prettyURL ());
configdialog->m_SourcePageURL->sub_urllist->clear ();
configdialog->m_SourcePageURL->sub_urllist->insertStringList (sub_urllist);
configdialog->m_SourcePageURL->sub_urllist->setCurrentText (m_player->source ()->subUrl ().prettyURL ());
configdialog->m_SourcePageURL->changed = false;
configdialog->m_SourcePageURL->prefBitRate->setText (QString::number (prefbitrate));
configdialog->m_SourcePageURL->maxBitRate->setText (QString::number (maxbitrate));
configdialog->m_GeneralPageOutput->videoDriver->setCurrentItem (videodriver);
configdialog->m_GeneralPageOutput->audioDriver->setCurrentItem (audiodriver);
configdialog->m_SourcePageURL->backend->setCurrentItem (configdialog->m_SourcePageURL->backend->findItem (backends["urlsource"]));
int id = 0;
const PartBase::ProcessMap::const_iterator e = m_player->players ().end ();
for (PartBase::ProcessMap::const_iterator i = m_player->players ().begin(); i != e; ++i) {
Process * p = i.data ();
if (p->supports ("urlsource")) {
if (backends["urlsource"] == QString (p->name()))
configdialog->m_SourcePageURL->backend->setCurrentItem (id);
id++;
}
}
configdialog->m_SourcePageURL->allowhref->setChecked (allowhref);
// postproc
configdialog->m_OPPagePostproc->postProcessing->setChecked (postprocessing);
configdialog->m_OPPagePostproc->disablePPauto->setChecked (disableppauto);
configdialog->m_OPPagePostproc->PostprocessingOptions->setEnabled (postprocessing);
configdialog->m_OPPagePostproc->defaultPreset->setChecked (pp_default);
configdialog->m_OPPagePostproc->fastPreset->setChecked (pp_fast);
configdialog->m_OPPagePostproc->customPreset->setChecked (pp_custom);
configdialog->m_OPPagePostproc->HzDeblockFilter->setChecked (pp_custom_hz);
configdialog->m_OPPagePostproc->HzDeblockAQuality->setChecked (pp_custom_hz_aq);
configdialog->m_OPPagePostproc->HzDeblockCFiltering->setChecked (pp_custom_hz_ch);
configdialog->m_OPPagePostproc->VtDeblockFilter->setChecked (pp_custom_vt);
configdialog->m_OPPagePostproc->VtDeblockAQuality->setChecked (pp_custom_vt_aq);
configdialog->m_OPPagePostproc->VtDeblockCFiltering->setChecked (pp_custom_vt_ch);
configdialog->m_OPPagePostproc->DeringFilter->setChecked (pp_custom_dr);
configdialog->m_OPPagePostproc->DeringAQuality->setChecked (pp_custom_dr_aq);
configdialog->m_OPPagePostproc->DeringCFiltering->setChecked (pp_custom_dr_ch);
configdialog->m_OPPagePostproc->AutolevelsFilter->setChecked (pp_custom_al);
configdialog->m_OPPagePostproc->AutolevelsFullrange->setChecked (pp_custom_al_f);
configdialog->m_OPPagePostproc->TmpNoiseFilter->setChecked (pp_custom_tn);
//configdialog->m_OPPagePostproc->TmpNoiseSlider->setValue (pp_custom_tn_s);
configdialog->m_OPPagePostproc->LinBlendDeinterlacer->setChecked (pp_lin_blend_int);
configdialog->m_OPPagePostproc->LinIntDeinterlacer->setChecked (pp_lin_int);
configdialog->m_OPPagePostproc->CubicIntDeinterlacer->setChecked (pp_cub_int);
configdialog->m_OPPagePostproc->MedianDeinterlacer->setChecked (pp_med_int);
configdialog->m_OPPagePostproc->FfmpegDeinterlacer->setChecked (pp_ffmpeg_int);
// recording
configdialog->m_RecordPage->url->lineEdit()->setText (recordfile);
configdialog->m_RecordPage->replay->setButton (int (replayoption));
configdialog->m_RecordPage->recorder->setButton (int (recorder));
configdialog->m_RecordPage->replayClicked (int (replayoption));
configdialog->m_RecordPage->recorderClicked (int (recorder));
configdialog->m_RecordPage->replaytime->setText (QString::number (replaytime));
configdialog->m_MEncoderPage->arguments->setText (mencoderarguments);
configdialog->m_MEncoderPage->format->setButton (recordcopy ? 0 : 1);
configdialog->m_MEncoderPage->formatClicked (recordcopy ? 0 : 1);
configdialog->m_FFMpegPage->arguments->setText (ffmpegarguments);
//dynamic stuff
for (PreferencesPage * p = pagelist; p; p = p->next)
p->sync (false);
//\dynamic stuff
if (pagename)
configDialog ()->setPage (pagename);
if (created)
configdialog->resize (configdialog->minimumSize ());
configdialog->show ();
}
void Settings::writeConfig () {
m_config->setGroup (strGeneralGroup);
m_config->writeEntry (strURLList, urllist, ';');
m_config->writeEntry (strSubURLList, sub_urllist, ';');
m_config->writeEntry (strPrefBitRate, prefbitrate);
m_config->writeEntry (strMaxBitRate, maxbitrate);
m_config->writeEntry (strVolume, volume);
m_config->writeEntry (strContrast, contrast);
m_config->writeEntry (strBrightness, brightness);
m_config->writeEntry (strHue, hue);
m_config->writeEntry (strSaturation, saturation);
const QMap<QString,QString>::iterator b_end = backends.end ();
for (QMap<QString,QString>::iterator i = backends.begin(); i != b_end; ++i)
m_config->writeEntry (i.key (), i.data ());
for (int i = 0; i < int (ColorSetting::last_target); i++)
m_config->writeEntry (colors[i].option, colors[i].color);
for (int i = 0; i < int (FontSetting::last_target); i++)
m_config->writeEntry (fonts[i].option, fonts[i].font);
m_config->setGroup (strMPlayerGroup);
m_config->writeEntry (strKeepSizeRatio, sizeratio);
m_config->writeEntry (strAutoResize, autoresize);
m_config->writeEntry (strRememberSize, remembersize);
m_config->writeEntry (strDockSysTray, docksystray);
m_config->writeEntry (strLoop, loop);
m_config->writeEntry (strFrameDrop, framedrop);
m_config->writeEntry (strAdjustVolume, autoadjustvolume);
m_config->writeEntry (strAdjustColors, autoadjustcolors);
m_config->writeEntry (strSeekTime, seektime);
m_config->writeEntry (strVoDriver, videodriver);
m_config->writeEntry (strAoDriver, audiodriver);
m_config->writeEntry (strAllowHref, allowhref);
m_config->writeEntry (strAddConfigButton, showcnfbutton);
m_config->writeEntry (strAddPlaylistButton, showplaylistbutton);
m_config->writeEntry (strAddRecordButton, showrecordbutton);
m_config->writeEntry (strAddBroadcastButton, showbroadcastbutton);
m_config->writeEntry (strDVDDevice, dvddevice);
m_config->writeEntry (strVCDDevice, vcddevice);
//postprocessing stuff
m_config->setGroup (strPPGroup);
m_config->writeEntry (strPostProcessing, postprocessing);
m_config->writeEntry (strDisablePPauto, disableppauto);
m_config->writeEntry (strPP_Default, pp_default);
m_config->writeEntry (strPP_Fast, pp_fast);
m_config->writeEntry (strPP_Custom, pp_custom);
m_config->writeEntry (strCustom_Hz, pp_custom_hz);
m_config->writeEntry (strCustom_Hz_Aq, pp_custom_hz_aq);
m_config->writeEntry (strCustom_Hz_Ch, pp_custom_hz_ch);
m_config->writeEntry (strCustom_Vt, pp_custom_vt);
m_config->writeEntry (strCustom_Vt_Aq, pp_custom_vt_aq);
m_config->writeEntry (strCustom_Vt_Ch, pp_custom_vt_ch);
m_config->writeEntry (strCustom_Dr, pp_custom_dr);
m_config->writeEntry (strCustom_Dr_Aq, pp_custom_vt_aq);
m_config->writeEntry (strCustom_Dr_Ch, pp_custom_vt_ch);
m_config->writeEntry (strCustom_Al, pp_custom_al);
m_config->writeEntry (strCustom_Al_F, pp_custom_al_f);
m_config->writeEntry (strCustom_Tn, pp_custom_tn);
m_config->writeEntry (strCustom_Tn_S, pp_custom_tn_s);
m_config->writeEntry (strPP_Lin_Blend_Int, pp_lin_blend_int);
m_config->writeEntry (strPP_Lin_Int, pp_lin_int);
m_config->writeEntry (strPP_Cub_Int, pp_cub_int);
m_config->writeEntry (strPP_Med_Int, pp_med_int);
m_config->writeEntry (strPP_FFmpeg_Int, pp_ffmpeg_int);
// recording
m_config->setGroup (strRecordingGroup);
m_config->writePathEntry (strRecordingFile, recordfile);
m_config->writeEntry (strAutoPlayAfterRecording, int (replayoption));
m_config->writeEntry (strAutoPlayAfterTime, replaytime);
m_config->writeEntry (strRecorder, int (recorder));
m_config->writeEntry (strRecordingCopy, recordcopy);
m_config->writeEntry (strMencoderArgs, mencoderarguments);
m_config->writeEntry (strFFMpegArgs, ffmpegarguments);
//dynamic stuff
for (PreferencesPage * p = pagelist; p; p = p->next)
p->write (m_config);
//\dynamic stuff
m_config->sync ();
}
void Settings::okPressed () {
bool urlchanged = configdialog->m_SourcePageURL->changed;
bool playerchanged = false;
if (urlchanged) {
if (configdialog->m_SourcePageURL->url->url ().isEmpty ())
urlchanged = false;
else {
if (KURL::fromPathOrURL (configdialog->m_SourcePageURL->url->url ()).isLocalFile () ||
KURL::isRelativeURL (configdialog->m_SourcePageURL->url->url ())) {
QFileInfo fi (configdialog->m_SourcePageURL->url->url ());
int hpos = configdialog->m_SourcePageURL->url->url ().findRev ('#');
QString xine_directives ("");
while (!fi.exists () && hpos > -1) {
xine_directives = configdialog->m_SourcePageURL->url->url ().mid (hpos);
fi.setFile (configdialog->m_SourcePageURL->url->url ().left (hpos));
hpos = configdialog->m_SourcePageURL->url->url ().findRev ('#', hpos-1);
}
if (!fi.exists ()) {
urlchanged = false;
KMessageBox::error (m_player->view (), i18n ("File %1 does not exist.").arg (configdialog->m_SourcePageURL->url->url ()), i18n ("Error"));
} else
configdialog->m_SourcePageURL->url->setURL (fi.absFilePath () + xine_directives);
}
if (urlchanged &&
!configdialog->m_SourcePageURL->sub_url->url ().isEmpty () &&
(KURL::fromPathOrURL (configdialog->m_SourcePageURL->sub_url->url ()).isLocalFile () ||
KURL::isRelativeURL (configdialog->m_SourcePageURL->sub_url->url ()))) {
QFileInfo sfi (configdialog->m_SourcePageURL->sub_url->url ());
if (!sfi.exists ()) {
KMessageBox::error (m_player->view (), i18n ("Sub title file %1 does not exist.").arg (configdialog->m_SourcePageURL->sub_url->url ()), i18n ("Error"));
configdialog->m_SourcePageURL->sub_url->setURL (QString ());
} else
configdialog->m_SourcePageURL->sub_url->setURL (sfi.absFilePath ());
}
}
}
if (urlchanged) {
KURL url = KURL::fromPathOrURL (configdialog->m_SourcePageURL->url->url ());
m_player->setURL (url);
if (urllist.find (url.prettyURL ()) == urllist.end ())
configdialog->m_SourcePageURL->urllist->insertItem (url.prettyURL (), 0);
KURL sub_url = KURL::fromPathOrURL (configdialog->m_SourcePageURL->sub_url->url ());
if (sub_urllist.find (sub_url.prettyURL ()) == sub_urllist.end ())
configdialog->m_SourcePageURL->sub_urllist->insertItem (sub_url.prettyURL (), 0);
}
urllist.clear ();
for (int i = 0; i < configdialog->m_SourcePageURL->urllist->count () && i < 20; ++i)
// damnit why don't maxCount and setDuplicatesEnabled(false) work :(
// and why can I put a qstringlist in it, but cannot get it out of it again..
if (!configdialog->m_SourcePageURL->urllist->text (i).isEmpty ())
urllist.push_back (configdialog->m_SourcePageURL->urllist->text (i));
sub_urllist.clear ();
for (int i = 0; i < configdialog->m_SourcePageURL->sub_urllist->count () && i < 20; ++i)
if (!configdialog->m_SourcePageURL->sub_urllist->text (i).isEmpty ())
sub_urllist.push_back (configdialog->m_SourcePageURL->sub_urllist->text (i));
prefbitrate = configdialog->m_SourcePageURL->prefBitRate->text ().toInt ();
maxbitrate = configdialog->m_SourcePageURL->maxBitRate->text ().toInt ();
sizeratio = configdialog->m_GeneralPageGeneral->keepSizeRatio->isChecked ();
autoresize = configdialog->m_GeneralPageGeneral->autoResize->isChecked ();
remembersize=!configdialog->m_GeneralPageGeneral->sizesChoice->selectedId();
docksystray = configdialog->m_GeneralPageGeneral->dockSysTray->isChecked ();
loop = configdialog->m_GeneralPageGeneral->loop->isChecked ();
framedrop = configdialog->m_GeneralPageGeneral->framedrop->isChecked ();
autoadjustvolume = configdialog->m_GeneralPageGeneral->adjustvolume->isChecked ();
autoadjustcolors = configdialog->m_GeneralPageGeneral->adjustcolors->isChecked ();
showcnfbutton = configdialog->m_GeneralPageGeneral->showConfigButton->isChecked ();
showplaylistbutton = configdialog->m_GeneralPageGeneral->showPlaylistButton->isChecked ();
showrecordbutton = configdialog->m_GeneralPageGeneral->showRecordButton->isChecked ();
showbroadcastbutton = configdialog->m_GeneralPageGeneral->showBroadcastButton->isChecked ();
seektime = configdialog->m_GeneralPageGeneral->seekTime->value();
videodriver = configdialog->m_GeneralPageOutput->videoDriver->currentItem();
audiodriver = configdialog->m_GeneralPageOutput->audioDriver->currentItem();
if (!strcmp (m_player->source()->name (), "urlsource")) {
int backend = configdialog->m_SourcePageURL->backend->currentItem ();
const PartBase::ProcessMap::const_iterator e = m_player->players ().end();
for (PartBase::ProcessMap::const_iterator i = m_player->players ().begin(); backend >=0 && i != e; ++i) {
Process * proc = i.data ();
if (proc->supports ("urlsource") && backend-- == 0) {
backends["urlsource"] = proc->name ();
if (proc != m_player->process ()) {
m_player->setProcess (proc->name ());
playerchanged = true;
}
}
}
}
allowhref = configdialog->m_SourcePageURL->allowhref->isChecked ();
//postproc
postprocessing = configdialog->m_OPPagePostproc->postProcessing->isChecked();
disableppauto = configdialog->m_OPPagePostproc->disablePPauto->isChecked();
pp_default = configdialog->m_OPPagePostproc->defaultPreset->isChecked();
pp_fast = configdialog->m_OPPagePostproc->fastPreset->isChecked();
pp_custom = configdialog->m_OPPagePostproc->customPreset->isChecked();
pp_custom_hz = configdialog->m_OPPagePostproc->HzDeblockFilter->isChecked();
pp_custom_hz_aq = configdialog->m_OPPagePostproc->HzDeblockAQuality->isChecked();
pp_custom_hz_ch = configdialog->m_OPPagePostproc->HzDeblockCFiltering->isChecked();
pp_custom_vt = configdialog->m_OPPagePostproc->VtDeblockFilter->isChecked();
pp_custom_vt_aq = configdialog->m_OPPagePostproc->VtDeblockAQuality->isChecked();
pp_custom_vt_ch = configdialog->m_OPPagePostproc->VtDeblockCFiltering->isChecked();
pp_custom_dr = configdialog->m_OPPagePostproc->DeringFilter->isChecked();
pp_custom_dr_aq = configdialog->m_OPPagePostproc->DeringAQuality->isChecked();
pp_custom_dr_ch = configdialog->m_OPPagePostproc->DeringCFiltering->isChecked();
pp_custom_al = configdialog->m_OPPagePostproc->AutolevelsFilter->isChecked();
pp_custom_al_f = configdialog->m_OPPagePostproc->AutolevelsFullrange->isChecked();
pp_custom_tn = configdialog->m_OPPagePostproc->TmpNoiseFilter->isChecked();
pp_custom_tn_s = 0; // gotta fix this later
//pp_custom_tn_s = configdialog->m_OPPagePostproc->TmpNoiseSlider->value();
pp_lin_blend_int = configdialog->m_OPPagePostproc->LinBlendDeinterlacer->isChecked();
pp_lin_int = configdialog->m_OPPagePostproc->LinIntDeinterlacer->isChecked();
pp_cub_int = configdialog->m_OPPagePostproc->CubicIntDeinterlacer->isChecked();
pp_med_int = configdialog->m_OPPagePostproc->MedianDeinterlacer->isChecked();
pp_ffmpeg_int = configdialog->m_OPPagePostproc->FfmpegDeinterlacer->isChecked();
// recording
#if (QT_VERSION < 0x030200)
recorder = Recorder (configdialog->m_RecordPage->recorder->id (configdialog->m_RecordPage->recorder->selected ()));
#else
recorder = Recorder (configdialog->m_RecordPage->recorder->selectedId ());
#endif
replaytime = configdialog->m_RecordPage->replaytime->text ().toInt ();
configdialog->m_RecordPage->replaytime->setText (QString::number (replaytime));
recordfile = configdialog->m_RecordPage->url->lineEdit()->text ();
mencoderarguments = configdialog->m_MEncoderPage->arguments->text ();
ffmpegarguments = configdialog->m_FFMpegPage->arguments->text ();
#if (QT_VERSION < 0x030200)
recordcopy = !configdialog->m_MEncoderPage->format->id (configdialog->m_MEncoderPage->format->selected ());
#else
recordcopy = !configdialog->m_MEncoderPage->format->selectedId ();
#endif
//dynamic stuff
for (PreferencesPage * p = pagelist; p; p = p->next)
p->sync (true);
//\dynamic stuff
writeConfig ();
emit configChanged ();
if (urlchanged || playerchanged) {
m_player->sources () ["urlsource"]->setSubURL
(KURL(configdialog->m_SourcePageURL->sub_url->url()));
m_player->openURL (KURL::fromPathOrURL (configdialog->m_SourcePageURL->url->url ()));
m_player->source ()->setSubURL (KURL::fromPathOrURL (configdialog->m_SourcePageURL->sub_url->url ()));
}
}
KDE_NO_EXPORT void Settings::getHelp () {
KApplication::kApplication()->invokeBrowser ("man:/mplayer");
}
#include "kmplayerconfig.moc"

@ -0,0 +1,204 @@
/**
* Copyright (C) 2002-2003 by Koos Vriezen <koos.vriezen@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
**/
#ifndef _KMPLAYERCONFIG_H_
#define _KMPLAYERCONFIG_H_
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <qobject.h>
#include <qstringlist.h>
#include <qmap.h>
#include <kurl.h>
class KConfig;
namespace KMPlayer {
class PartBase;
class Preferences;
class View;
class OutputDriver {
public:
const char * driver;
const QString description;
};
class ColorSetting {
public:
QString title;
QString option;
QColor color;
QColor newcolor;
enum Target {
playlist_background = 0, playlist_foreground, playlist_active,
console_background, console_foreground,
video_background, area_background,
infowindow_background, infowindow_foreground,
last_target
} target;
};
class FontSetting {
public:
QString title;
QString option; // for ini file
QFont font;
QFont newfont;
enum Target {
playlist, infowindow, last_target
} target;
};
template <class T>
struct Deleter {
void operator ()(T * t) {
delete t;
}
};
/*
* Base class for all dynamic preferance pages
*/
class KMPLAYER_EXPORT PreferencesPage {
public:
virtual ~PreferencesPage () {}
virtual void write (KConfig *) = 0;
virtual void read (KConfig *) = 0;
virtual void sync (bool fromUI) = 0;
virtual void prefLocation (QString & item, QString & icon, QString & tab) = 0;
virtual QFrame * prefPage (QWidget * parent) = 0;
PreferencesPage * next;
};
/*
* Class for storing all actual settings and reading/writing them
*/
class KMPLAYER_EXPORT Settings : public QObject {
Q_OBJECT
public:
Settings (PartBase *, KConfig * part);
~Settings ();
bool createDialog () KDE_NO_EXPORT;
void show (const char * pagename = 0L);
void addPage (PreferencesPage *);
void removePage (PreferencesPage *);
void applyColorSetting (bool only_changed_ones);
Preferences *configDialog() const { return configdialog; }
View * defaultView ();
KConfig * kconfig () { return m_config; }
QStringList urllist;
QStringList sub_urllist;
int volume;
int contrast;
int brightness;
int hue;
int saturation;
int prefbitrate;
int maxbitrate;
bool usearts : 1;
bool no_intro : 1;
bool sizeratio : 1;
bool remembersize : 1;
bool autoresize : 1;
bool docksystray : 1;
bool loop : 1;
bool framedrop : 1;
bool autoadjustvolume : 1;
bool autoadjustcolors : 1;
bool showcnfbutton : 1;
bool showplaylistbutton : 1;
bool showrecordbutton : 1;
bool showbroadcastbutton : 1;
bool autohideslider : 1;
bool mplayerpost090 : 1;
bool allowhref : 1;
// postproc thingies
bool postprocessing : 1;
bool disableppauto : 1;
bool pp_default : 1; // -vf pp=de
bool pp_fast : 1; // -vf pp=fa
bool pp_custom : 1; // coming up
bool pp_custom_hz : 1; // horizontal deblocking
bool pp_custom_hz_aq : 1; // - autoquality
bool pp_custom_hz_ch : 1; // - chrominance
bool pp_custom_vt : 1; // vertical deblocking
bool pp_custom_vt_aq : 1; // - autoquality
bool pp_custom_vt_ch : 1; // - chrominance
bool pp_custom_dr : 1; // dering filter
bool pp_custom_dr_aq : 1; // - autoquality
bool pp_custom_dr_ch : 1; // - chrominance
bool pp_custom_al : 1; // pp=al
bool pp_custom_al_f : 1;// - fullrange
bool pp_custom_tn : 1; // pp=tn
int pp_custom_tn_s : 1; // - noise reducer strength (1 <= x <= 3)
bool pp_lin_blend_int : 1; // linear blend deinterlacer
bool pp_lin_int : 1; // - interpolating -
bool pp_cub_int : 1; // cubic - -
bool pp_med_int : 1; // median interlacer
bool pp_ffmpeg_int : 1; // ffmpeg interlacer
// end of postproc
// recording
bool recordcopy : 1;
enum Recorder { MEncoder = 0, FFMpeg, MPlayerDumpstream };
Recorder recorder;
enum ReplayOption { ReplayNo = 0, ReplayFinished, ReplayAfter };
ReplayOption replayoption;
int replaytime;
QString mencoderarguments;
QString ffmpegarguments;
QString recordfile;
int seektime;
int videodriver;
int audiodriver;
OutputDriver * audiodrivers;
OutputDriver * videodrivers;
ColorSetting colors [ColorSetting::last_target];
FontSetting fonts [FontSetting::last_target];
QString dvddevice;
QString vcddevice;
QMap <QString, QString> backends;
PreferencesPage * pagelist;
signals:
void configChanged ();
public slots:
void readConfig () KDE_NO_EXPORT;
void writeConfig ();
private slots:
void okPressed ();
void getHelp ();
private:
Preferences * configdialog;
KConfig * m_config;
PartBase * m_player;
};
} // namespace
#endif //_KMPLAYERCONFIG_H_

@ -0,0 +1,703 @@
/**
* Copyright (C) 2005 by Koos Vriezen <koos ! vriezen ? gmail ! com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
**/
#include <qlayout.h>
#include <qpixmap.h>
#include <qslider.h>
#include <qlabel.h>
#include <qtooltip.h>
#include <qpainter.h>
#include <qstringlist.h>
#include <kiconloader.h>
#include <klocale.h>
#include <kdebug.h>
#include "kmplayerview.h"
#include "kmplayercontrolpanel.h"
#include "kmplayersource.h"
static const int button_height_with_slider = 15;
static const int button_height_only_buttons = 11;
extern const char * normal_window_xpm[];
extern const char * playlist_xpm[];
#include "kmplayerview.h"
#include "kmplayercontrolpanel.h"
using namespace KMPlayer;
static char xpm_fg_color [32] = ". c #000000";
static const char * stop_xpm[] = {
"5 7 2 1",
" c None",
xpm_fg_color,
" ",
".....",
".....",
".....",
".....",
".....",
" "};
static const char * play_xpm[] = {
"5 9 2 1",
" c None",
xpm_fg_color,
". ",
".. ",
"... ",
".... ",
".....",
".... ",
"... ",
".. ",
". "};
static const char * pause_xpm[] = {
"7 9 2 1",
" c None",
xpm_fg_color,
" ",
".. ..",
".. ..",
".. ..",
".. ..",
".. ..",
".. ..",
".. ..",
" "};
static const char * forward_xpm[] = {
"11 9 2 1",
" c None",
xpm_fg_color,
". . ",
".. .. ",
"... ... ",
".... .... ",
"..... .....",
".... .... ",
"... ... ",
".. .. ",
". . "};
static const char * back_xpm[] = {
"11 9 2 1",
" c None",
xpm_fg_color,
" . .",
" .. ..",
" ... ...",
" .... ....",
"..... .....",
" .... ....",
" ... ...",
" .. ..",
" . ."};
static const char * config_xpm[] = {
"11 8 2 1",
" c None",
xpm_fg_color,
" ",
" ",
"...........",
" ......... ",
" ....... ",
" ..... ",
" ... ",
" . "};
const char * playlist_xpm[] = {
"8 9 2 1",
" c None",
xpm_fg_color,
" ",
" ",
"........",
"........",
" ",
" ",
"........",
"........",
" "};
const char * normal_window_xpm[] = {
"7 9 2 1",
" c None",
xpm_fg_color,
" ",
".......",
".......",
". .",
". .",
". .",
". .",
".......",
" "};
static const char * record_xpm[] = {
"7 7 3 1",
" c None",
xpm_fg_color,
"+ c #FF0000",
" ",
".......",
".+++++.",
".+++++.",
".+++++.",
".......",
" "};
static const char * broadcast_xpm[] = {
"21 9 2 1",
" c None",
xpm_fg_color,
" ",
" .. .. .. .. ",
".. .. ... .. ..",
".. .. ..... .. ..",
".. .. ..... .. ..",
".. .. ..... .. ..",
".. .. ... .. ..",
" .. .. .. .. ",
" "};
static const char * language_xpm [] = {
"12 9 2 1",
" c None",
xpm_fg_color,
" ",
" ",
" ",
" ",
" ",
".... ......",
".... ......",
".... ......",
" "};
static const char * red_xpm[] = {
"7 9 3 1",
" c None",
xpm_fg_color,
"+ c #FF0000",
" ",
".......",
".+++++.",
".+++++.",
".+++++.",
".+++++.",
".+++++.",
".......",
" "};
static const char * green_xpm[] = {
"7 9 3 1",
" c None",
xpm_fg_color,
"+ c #00FF00",
" ",
".......",
".+++++.",
".+++++.",
".+++++.",
".+++++.",
".+++++.",
".......",
" "};
static const char * yellow_xpm[] = {
"7 9 3 1",
" c None",
xpm_fg_color,
"+ c #FFFF00",
" ",
".......",
".+++++.",
".+++++.",
".+++++.",
".+++++.",
".+++++.",
".......",
" "};
static const char * blue_xpm[] = {
"7 9 3 1",
" c None",
xpm_fg_color,
"+ c #0080FF00",
" ",
".......",
".+++++.",
".+++++.",
".+++++.",
".+++++.",
".+++++.",
".......",
" "};
//-----------------------------------------------------------------------------
static QPushButton * ctrlButton (QWidget * w, QBoxLayout * l, const char ** p, int key = 0) {
QPushButton * b = new QPushButton (QIconSet (QPixmap(p)), QString (), w);
b->setFocusPolicy (QWidget::NoFocus);
b->setFlat (true);
if (key)
b->setAccel (QKeySequence (key));
l->addWidget (b);
return b;
}
KDE_NO_CDTOR_EXPORT
KMPlayerMenuButton::KMPlayerMenuButton (QWidget * parent, QBoxLayout * l, const char ** p, int key)
: QPushButton (QIconSet (QPixmap(p)), QString (), parent, "kde_kmplayer_control_button") {
setFocusPolicy (QWidget::NoFocus);
setFlat (true);
if (key)
setAccel (QKeySequence (key));
l->addWidget (this);
}
KDE_NO_EXPORT void KMPlayerMenuButton::enterEvent (QEvent *) {
emit mouseEntered ();
}
//-----------------------------------------------------------------------------
KDE_NO_CDTOR_EXPORT KMPlayerPopupMenu::KMPlayerPopupMenu (QWidget * parent)
: KPopupMenu (parent, "kde_kmplayer_popupmenu") {}
KDE_NO_EXPORT void KMPlayerPopupMenu::leaveEvent (QEvent *) {
emit mouseLeft ();
}
//-----------------------------------------------------------------------------
KDE_NO_CDTOR_EXPORT VolumeBar::VolumeBar (QWidget * parent, View * view)
: QWidget (parent), m_view (view), m_value (100) {
setSizePolicy( QSizePolicy (QSizePolicy::Minimum, QSizePolicy::Fixed));
setMinimumSize (QSize (51, button_height_only_buttons + 2));
QToolTip::add (this, i18n ("Volume is %1").arg (m_value));
}
KDE_NO_CDTOR_EXPORT VolumeBar::~VolumeBar () {
}
void VolumeBar::setValue (int v) {
m_value = v;
if (m_value < 0) m_value = 0;
if (m_value > 100) m_value = 100;
QToolTip::remove (this);
QToolTip::add (this, i18n ("Volume is %1").arg (m_value));
repaint (true);
emit volumeChanged (m_value);
}
void VolumeBar::wheelEvent (QWheelEvent * e) {
setValue (m_value + (e->delta () > 0 ? 2 : -2));
e->accept ();
}
void VolumeBar::paintEvent (QPaintEvent * e) {
QWidget::paintEvent (e);
QPainter p;
p.begin (this);
QColor color = paletteForegroundColor ();
p.setPen (color);
int w = width () - 6;
int vx = m_value * w / 100;
p.fillRect (3, 3, vx, 7, color);
p.drawRect (vx + 3, 3, w - vx, 7);
p.end ();
//kdDebug () << "w=" << w << " vx=" << vx << endl;
}
void VolumeBar::mousePressEvent (QMouseEvent * e) {
setValue (100 * (e->x () - 3) / (width () - 6));
e->accept ();
}
void VolumeBar::mouseMoveEvent (QMouseEvent * e) {
setValue (100 * (e->x () - 3) / (width () - 6));
e->accept ();
}
//-----------------------------------------------------------------------------
KDE_NO_CDTOR_EXPORT ControlPanel::ControlPanel(QWidget * parent, View * view)
: QWidget (parent),
m_progress_mode (progress_playing),
m_progress_length (0),
m_popup_timer (0),
m_popdown_timer (0),
m_view (view),
m_auto_controls (true),
m_popup_clicked (false) {
m_buttonbox = new QHBoxLayout (this, 5, 4);
QColor c = paletteForegroundColor ();
strncpy (xpm_fg_color, QString().sprintf(". c #%02x%02x%02x", c.red(), c.green(),c.blue()).ascii(), 31);
xpm_fg_color[31] = 0;
m_buttons[button_config] = new KMPlayerMenuButton (this, m_buttonbox, config_xpm);
m_buttons[button_playlist] = ctrlButton (this, m_buttonbox, playlist_xpm);
m_buttons[button_back] = ctrlButton (this, m_buttonbox, back_xpm);
m_buttons[button_play] = ctrlButton(this, m_buttonbox, play_xpm, Qt::Key_R);
m_buttons[button_forward] = ctrlButton (this, m_buttonbox, forward_xpm);
m_buttons[button_stop] = ctrlButton(this, m_buttonbox, stop_xpm, Qt::Key_S);
m_buttons[button_pause]=ctrlButton(this, m_buttonbox, pause_xpm, Qt::Key_P);
m_buttons[button_record] = ctrlButton (this, m_buttonbox, record_xpm);
m_buttons[button_broadcast] = ctrlButton (this, m_buttonbox, broadcast_xpm);
m_buttons[button_language] = new KMPlayerMenuButton (this, m_buttonbox, language_xpm);
m_buttons[button_red] = ctrlButton (this, m_buttonbox, red_xpm);
m_buttons[button_green] = ctrlButton (this, m_buttonbox, green_xpm);
m_buttons[button_yellow] = ctrlButton (this, m_buttonbox, yellow_xpm);
m_buttons[button_blue] = ctrlButton (this, m_buttonbox, blue_xpm);
m_buttons[button_play]->setToggleButton (true);
m_buttons[button_stop]->setToggleButton (true);
m_buttons[button_record]->setToggleButton (true);
m_buttons[button_broadcast]->setToggleButton (true);
m_posSlider = new QSlider (0, 100, 1, 0, Qt::Horizontal, this);
m_posSlider->setEnabled (false);
m_buttonbox->addWidget (m_posSlider);
setupPositionSlider (true);
m_volume = new VolumeBar (this, m_view);
m_buttonbox->addWidget (m_volume);
m_popupMenu = new KMPlayerPopupMenu (this);
m_playerMenu = new KMPlayerPopupMenu (this);
m_popupMenu->insertItem (i18n ("&Play with"), m_playerMenu, menu_player);
m_bookmarkMenu = new KMPlayerPopupMenu (this);
m_popupMenu->insertItem (i18n("&Bookmarks"), m_bookmarkMenu, menu_bookmark);
m_popupMenu->insertItem (KGlobal::iconLoader ()->loadIconSet (QString ("konsole"), KIcon::Small, 0, true), i18n ("Con&sole"), menu_video);
m_popupMenu->insertItem (KGlobal::iconLoader ()->loadIconSet (QString ("player_playlist"), KIcon::Small, 0, true), i18n ("Play&list"), menu_playlist);
m_zoomMenu = new KMPlayerPopupMenu (this);
m_zoomMenu->insertItem (i18n ("50%"), menu_zoom50);
m_zoomMenu->insertItem (i18n ("100%"), menu_zoom100);
m_zoomMenu->insertItem (i18n ("150%"), menu_zoom150);
m_popupMenu->insertItem (KGlobal::iconLoader ()->loadIconSet (QString ("viewmag"), KIcon::Small, 0, false), i18n ("&Zoom"), m_zoomMenu, menu_zoom);
m_popupMenu->insertItem (KGlobal::iconLoader()->loadIconSet (QString ("window_fullscreen"), KIcon::Small, 0, true), i18n ("&Full Screen"), menu_fullscreen);
m_popupMenu->setAccel (QKeySequence (Qt::Key_F), menu_fullscreen);
m_popupMenu->insertSeparator ();
m_colorMenu = new KMPlayerPopupMenu (this);
m_languageMenu = new KMPlayerPopupMenu (this);
m_audioMenu = new KMPlayerPopupMenu (this);
m_subtitleMenu = new KMPlayerPopupMenu (this);
m_languageMenu->insertItem (KGlobal::iconLoader ()->loadIconSet (QString ("mime-sound"), KIcon::Small, 0, true), i18n ("&Audio languages"), m_audioMenu);
m_languageMenu->insertItem (KGlobal::iconLoader ()->loadIconSet (QString ("view_text"), KIcon::Small, 0, true), i18n ("&Subtitles"), m_subtitleMenu);
QLabel * label = new QLabel (i18n ("Contrast:"), m_colorMenu);
m_colorMenu->insertItem (label);
m_contrastSlider = new QSlider (-100, 100, 10, 0, Qt::Horizontal, m_colorMenu);
m_colorMenu->insertItem (m_contrastSlider);
label = new QLabel (i18n ("Brightness:"), m_colorMenu);
m_colorMenu->insertItem (label);
m_brightnessSlider = new QSlider (-100, 100, 10, 0, Qt::Horizontal, m_colorMenu);
m_colorMenu->insertItem (m_brightnessSlider);
label = new QLabel (i18n ("Hue:"), m_colorMenu);
m_colorMenu->insertItem (label);
m_hueSlider = new QSlider (-100, 100, 10, 0, Qt::Horizontal, m_colorMenu);
m_colorMenu->insertItem (m_hueSlider);
label = new QLabel (i18n ("Saturation:"), m_colorMenu);
m_colorMenu->insertItem (label);
m_saturationSlider = new QSlider (-100, 100, 10, 0, Qt::Horizontal, m_colorMenu);
m_colorMenu->insertItem (m_saturationSlider);
m_popupMenu->insertItem (KGlobal::iconLoader ()->loadIconSet (QString ("colorize"), KIcon::Small, 0, true), i18n ("Co&lors"), m_colorMenu);
m_popupMenu->insertSeparator ();
m_popupMenu->insertItem (KGlobal::iconLoader ()->loadIconSet (QString ("configure"), KIcon::Small, 0, true), i18n ("&Configure KMPlayer..."), menu_config);
setAutoControls (true);
connect (m_buttons [button_config], SIGNAL (clicked ()),
this, SLOT (buttonClicked ()));
connect (m_buttons [button_language], SIGNAL (clicked ()),
this, SLOT (buttonClicked ()));
connect (m_buttons [button_config], SIGNAL (mouseEntered ()),
this, SLOT (buttonMouseEntered ()));
connect (m_buttons [button_language], SIGNAL (mouseEntered ()),
this, SLOT (buttonMouseEntered ()));
connect (m_popupMenu, SIGNAL (mouseLeft ()), this, SLOT (menuMouseLeft ()));
connect (m_playerMenu, SIGNAL (mouseLeft ()), this, SLOT(menuMouseLeft ()));
connect (m_zoomMenu, SIGNAL (mouseLeft ()), this, SLOT (menuMouseLeft ()));
connect (m_colorMenu, SIGNAL (mouseLeft ()), this, SLOT (menuMouseLeft ()));
connect (m_languageMenu, SIGNAL(mouseLeft ()), this, SLOT(menuMouseLeft()));
connect (m_subtitleMenu, SIGNAL(mouseLeft ()), this, SLOT(menuMouseLeft()));
connect (m_audioMenu, SIGNAL (mouseLeft ()), this, SLOT (menuMouseLeft ()));
}
KDE_NO_EXPORT void ControlPanel::setPalette (const QPalette & pal) {
QWidget::setPalette (pal);
QColor c = paletteForegroundColor ();
strncpy (xpm_fg_color, QString().sprintf(". c #%02x%02x%02x", c.red(), c.green(),c.blue()).ascii(), 31);
xpm_fg_color[31] = 0;
m_buttons[button_config]->setIconSet (QIconSet (QPixmap (config_xpm)));
m_buttons[button_playlist]->setIconSet (QIconSet (QPixmap (playlist_xpm)));
m_buttons[button_back]->setIconSet (QIconSet (QPixmap (back_xpm)));
m_buttons[button_play]->setIconSet (QIconSet (QPixmap (play_xpm)));
m_buttons[button_forward]->setIconSet (QIconSet (QPixmap (forward_xpm)));
m_buttons[button_stop]->setIconSet (QIconSet (QPixmap (stop_xpm)));
m_buttons[button_pause]->setIconSet (QIconSet (QPixmap (pause_xpm)));
m_buttons[button_record]->setIconSet (QIconSet (QPixmap (record_xpm)));
m_buttons[button_broadcast]->setIconSet (QIconSet (QPixmap (broadcast_xpm)));
m_buttons[button_language]->setIconSet (QIconSet (QPixmap (language_xpm)));
m_buttons[button_red]->setIconSet (QIconSet (QPixmap (red_xpm)));
m_buttons[button_green]->setIconSet (QIconSet (QPixmap (green_xpm)));
m_buttons[button_yellow]->setIconSet (QIconSet (QPixmap (yellow_xpm)));
m_buttons[button_blue]->setIconSet (QIconSet (QPixmap (blue_xpm)));
}
KDE_NO_EXPORT void ControlPanel::timerEvent (QTimerEvent * e) {
if (e->timerId () == m_popup_timer) {
m_popup_timer = 0;
if (m_button_monitored == button_config) {
if (m_buttons [button_config]->hasMouse() &&
!m_popupMenu->isVisible ())
showPopupMenu ();
} else if (m_buttons [button_language]->hasMouse() &&
!m_languageMenu->isVisible ()) {
showLanguageMenu ();
}
} else if (e->timerId () == m_popdown_timer) {
m_popdown_timer = 0;
if (m_popupMenu->isVisible () &&
!m_popupMenu->hasMouse () &&
!m_playerMenu->hasMouse () &&
!m_zoomMenu->hasMouse () &&
!m_colorMenu->hasMouse () &&
!m_bookmarkMenu->hasMouse ()) {
if (!(m_bookmarkMenu->isVisible () &&
static_cast <QWidget *> (m_bookmarkMenu) != QWidget::keyboardGrabber ())) {
// not if user entered the bookmark sub menu or if I forgot one
m_popupMenu->hide ();
if (m_buttons [button_config]->isOn ())
m_buttons [button_config]->toggle ();
}
} else if (m_languageMenu->isVisible () &&
!m_languageMenu->hasMouse () &&
!m_audioMenu->hasMouse () &&
!m_subtitleMenu->hasMouse ()) {
m_languageMenu->hide ();
if (m_buttons [button_language]->isOn ())
m_buttons [button_language]->toggle ();
}
}
killTimer (e->timerId ());
}
void ControlPanel::setAutoControls (bool b) {
m_auto_controls = b;
if (m_auto_controls) {
for (int i = 0; i < (int) button_broadcast; i++)
m_buttons [i]->show ();
for (int i = button_broadcast; i < (int) button_last; i++)
m_buttons [i]->hide ();
showPositionSlider (false);
m_volume->show ();
if (m_buttons [button_broadcast]->isOn ()) // still broadcasting
m_buttons [button_broadcast]->show ();
} else { // hide everything
for (int i = 0; i < (int) button_last; i++)
m_buttons [i]->hide ();
m_posSlider->hide ();
m_volume->hide ();
}
m_view->updateLayout ();
}
KDE_NO_EXPORT void ControlPanel::showPopupMenu () {
m_view->updateVolume ();
m_popupMenu->exec (m_buttons [button_config]->mapToGlobal (QPoint (0, maximumSize ().height ())));
}
KDE_NO_EXPORT void ControlPanel::showLanguageMenu () {
m_languageMenu->exec (m_buttons [button_language]->mapToGlobal (QPoint (0, maximumSize ().height ())));
}
void ControlPanel::showPositionSlider (bool show) {
if (!m_auto_controls || show == m_posSlider->isShown ())
return;
setupPositionSlider (show);
if (isVisible ())
m_view->updateLayout ();
}
KDE_NO_EXPORT void ControlPanel::setupPositionSlider (bool show) {
int h = show ? button_height_with_slider : button_height_only_buttons;
m_posSlider->setEnabled (false);
m_posSlider->setValue (0);
if (show) {
m_posSlider->show ();
m_buttonbox->setMargin (4);
m_buttonbox->setSpacing (4);
setEraseColor (m_view->topLevelWidget ()->paletteBackgroundColor ());
} else {
m_posSlider->hide ();
m_buttonbox->setMargin (1);
m_buttonbox->setSpacing (1);
setEraseColor (QColor (0, 0, 0));
}
for (int i = 0; i < (int) button_last; i++) {
m_buttons[i]->setMinimumSize (15, h-1);
m_buttons[i]->setMaximumSize (750, h);
}
setMaximumSize (2500, h + (show ? 8 : 2 ));
}
KDE_NO_EXPORT int ControlPanel::preferedHeight () {
return m_posSlider->isVisible () ?
button_height_with_slider + 8 : button_height_only_buttons + 2;
}
void ControlPanel::enableSeekButtons (bool enable) {
if (!m_auto_controls) return;
if (enable) {
m_buttons[button_back]->show ();
m_buttons[button_forward]->show ();
} else {
m_buttons[button_back]->hide ();
m_buttons[button_forward]->hide ();
}
}
void ControlPanel::enableRecordButtons (bool enable) {
if (!m_auto_controls) return;
if (enable)
m_buttons[button_record]->show ();
else
m_buttons[button_record]->hide ();
}
void ControlPanel::setPlaying (bool play) {
if (play != m_buttons[button_play]->isOn ())
m_buttons[button_play]->toggle ();
m_posSlider->setEnabled (false);
m_posSlider->setValue (0);
if (!play) {
showPositionSlider (false);
enableSeekButtons (true);
}
}
KDE_NO_EXPORT void ControlPanel::setRecording (bool record) {
if (record != m_buttons[button_record]->isOn ())
m_buttons[button_record]->toggle ();
}
KDE_NO_EXPORT void ControlPanel::setPlayingProgress (int pos, int len) {
m_posSlider->setEnabled (false);
m_progress_length = len;
showPositionSlider (len > 0);
if (m_progress_mode != progress_playing) {
m_posSlider->setMaxValue (m_progress_length);
m_progress_mode = progress_playing;
}
if (pos < len && len > 0 && len != m_posSlider->maxValue ())
m_posSlider->setMaxValue (m_progress_length);
else if (m_progress_length <= 0 && pos > 7 * m_posSlider->maxValue ()/8)
m_posSlider->setMaxValue (m_posSlider->maxValue() * 2);
else if (m_posSlider->maxValue() < pos)
m_posSlider->setMaxValue (int (1.4 * m_posSlider->maxValue()));
m_posSlider->setValue (pos);
m_posSlider->setEnabled (true);
}
KDE_NO_EXPORT void ControlPanel::setLoadingProgress (int pos) {
if (pos > 0 && pos < 100 && !m_posSlider->isVisible ())
showPositionSlider (true);
m_posSlider->setEnabled (false);
if (m_progress_mode != progress_loading) {
m_posSlider->setMaxValue (100);
m_progress_mode = progress_loading;
}
m_posSlider->setValue (pos);
}
KDE_NO_EXPORT void ControlPanel::buttonClicked () {
if (m_popup_timer) {
killTimer (m_popup_timer);
m_popup_timer = 0;
}
m_popup_clicked = true;
if (sender () == m_buttons [button_language])
showLanguageMenu ();
else
showPopupMenu ();
}
KDE_NO_EXPORT void ControlPanel::buttonMouseEntered () {
if (!m_popup_timer) {
if (sender () == m_buttons [button_config]) {
if (!m_popupMenu->isVisible ()) {
m_button_monitored = button_config;
m_popup_clicked = false;
m_popup_timer = startTimer (400);
}
} else if (!m_languageMenu->isVisible ()) {
m_button_monitored = button_language;
m_popup_clicked = false;
m_popup_timer = startTimer (400);
}
}
}
KDE_NO_EXPORT void ControlPanel::menuMouseLeft () {
if (!m_popdown_timer && !m_popup_clicked)
m_popdown_timer = startTimer (400);
}
KDE_NO_EXPORT void ControlPanel::setLanguages (const QStringList & alang, const QStringList & slang) {
int sz = (int) alang.size ();
bool showbutton = (sz > 0);
m_audioMenu->clear ();
for (int i = 0; i < sz; i++)
m_audioMenu->insertItem (alang [i], i);
sz = (int) slang.size ();
showbutton |= (sz > 0);
m_subtitleMenu->clear ();
for (int i = 0; i < sz; i++)
m_subtitleMenu->insertItem (slang [i], i);
if (showbutton)
m_buttons [button_language]->show ();
else
m_buttons [button_language]->hide ();
}
KDE_NO_EXPORT void ControlPanel::selectSubtitle (int id) {
if (m_subtitleMenu->isItemChecked (id))
return;
int size = m_subtitleMenu->count ();
for (int i = 0; i < size; i++)
if (m_subtitleMenu->isItemChecked (i)) {
m_subtitleMenu->setItemChecked (i, false);
break;
}
m_subtitleMenu->setItemChecked (id, true);
}
KDE_NO_EXPORT void ControlPanel::selectAudioLanguage (int id) {
kdDebug () << "ControlPanel::selectAudioLanguage " << id << endl;
if (m_audioMenu->isItemChecked (id))
return;
int sz = m_audioMenu->count ();
for (int i = 0; i < sz; i++)
if (m_audioMenu->isItemChecked (i)) {
m_audioMenu->setItemChecked (i, false);
break;
}
m_audioMenu->setItemChecked (id, true);
}
//-----------------------------------------------------------------------------
#include "kmplayercontrolpanel.moc"

@ -0,0 +1,181 @@
/**
* Copyright (C) 2005 by Koos Vriezen <koos ! vriezen ? gmail ! com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
**/
#ifndef KMPLAYER_CONTROLPANEL_H
#define KMPLAYER_CONTROLPANEL_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <qwidget.h>
#include <qpushbutton.h>
#include <kpopupmenu.h>
class QSlider;
//class QPushButton;
class QBoxLayout;
class QStringList;
class KPopupMenu;
namespace KMPlayer {
class View;
/*
* A button from the controlpanel
*/
class KMPLAYER_NO_EXPORT KMPlayerMenuButton : public QPushButton {
Q_OBJECT
public:
KMPlayerMenuButton (QWidget *, QBoxLayout *, const char **, int = 0);
KDE_NO_CDTOR_EXPORT ~KMPlayerMenuButton () {}
signals:
void mouseEntered ();
protected:
void enterEvent (QEvent *);
};
/*
* The pop down menu from the controlpanel
*/
class KMPLAYER_EXPORT KMPlayerPopupMenu : public KPopupMenu {
Q_OBJECT
public:
KMPlayerPopupMenu (QWidget *);
KDE_NO_CDTOR_EXPORT ~KMPlayerPopupMenu () {}
signals:
void mouseLeft ();
protected:
void leaveEvent (QEvent *);
};
/*
* The volume bar from the controlpanel
*/
class KMPLAYER_EXPORT VolumeBar : public QWidget {
Q_OBJECT
public:
VolumeBar (QWidget * parent, View * view);
~VolumeBar ();
KDE_NO_EXPORT int value () const { return m_value; }
void setValue (int v);
signals:
void volumeChanged (int); // 0 - 100
protected:
void wheelEvent (QWheelEvent * e);
void paintEvent (QPaintEvent *);
void mousePressEvent (QMouseEvent * e);
void mouseMoveEvent (QMouseEvent * e);
private:
View * m_view;
int m_value;
};
/*
* The controlpanel GUI
*/
class KMPLAYER_EXPORT ControlPanel : public QWidget {
Q_OBJECT
public:
enum MenuID {
menu_config = 0, menu_player, menu_fullscreen, menu_volume,
menu_bookmark, menu_zoom, menu_zoom50, menu_zoom100, menu_zoom150,
menu_view, menu_video, menu_playlist
};
enum Button {
button_config = 0, button_playlist,
button_back, button_play, button_forward,
button_stop, button_pause, button_record,
button_broadcast, button_language,
button_red, button_green, button_yellow, button_blue,
button_last
};
ControlPanel (QWidget * parent, View * view);
KDE_NO_CDTOR_EXPORT ~ControlPanel () {}
void showPositionSlider (bool show);
void enableSeekButtons (bool enable);
void enableRecordButtons (bool enable);
void setPlaying (bool play);
void setRecording (bool record);
void setAutoControls (bool b);
void setPalette (const QPalette &);
int preferedHeight ();
KDE_NO_EXPORT bool autoControls () const { return m_auto_controls; }
KDE_NO_EXPORT QSlider * positionSlider () const { return m_posSlider; }
KDE_NO_EXPORT QSlider * contrastSlider () const { return m_contrastSlider; }
KDE_NO_EXPORT QSlider * brightnessSlider () const { return m_brightnessSlider; }
KDE_NO_EXPORT QSlider * hueSlider () const { return m_hueSlider; }
KDE_NO_EXPORT QSlider * saturationSlider () const { return m_saturationSlider; }
QPushButton * button (Button b) const { return m_buttons [(int) b]; }
KDE_NO_EXPORT QPushButton * broadcastButton () const { return m_buttons[button_broadcast]; }
KDE_NO_EXPORT VolumeBar * volumeBar () const { return m_volume; }
KDE_NO_EXPORT KMPlayerPopupMenu * popupMenu () const { return m_popupMenu; }
KDE_NO_EXPORT KPopupMenu * bookmarkMenu () const { return m_bookmarkMenu; }
KDE_NO_EXPORT QPopupMenu * zoomMenu () const { return m_zoomMenu; }
KDE_NO_EXPORT QPopupMenu * playerMenu () const { return m_playerMenu; }
KDE_NO_EXPORT QPopupMenu * colorMenu () const { return m_colorMenu; }
KDE_NO_EXPORT QPopupMenu * audioMenu () const { return m_audioMenu; }
KDE_NO_EXPORT QPopupMenu * subtitleMenu () const { return m_subtitleMenu; }
KDE_NO_EXPORT View * view () const { return m_view; }
public slots:
void setLanguages (const QStringList & al, const QStringList & sl);
void selectSubtitle (int id);
void selectAudioLanguage (int id);
void showPopupMenu ();
void showLanguageMenu ();
void setPlayingProgress (int position, int length);
void setLoadingProgress (int pos);
protected:
void timerEvent (QTimerEvent * e);
void setupPositionSlider (bool show);
private slots:
void buttonMouseEntered ();
void buttonClicked ();
void menuMouseLeft ();
private:
enum { progress_loading, progress_playing } m_progress_mode;
int m_progress_length;
int m_popup_timer;
int m_popdown_timer;
int m_button_monitored;
View * m_view;
QBoxLayout * m_buttonbox;
QSlider * m_posSlider;
QSlider * m_contrastSlider;
QSlider * m_brightnessSlider;
QSlider * m_hueSlider;
QSlider * m_saturationSlider;
QPushButton * m_buttons [button_last];
VolumeBar * m_volume;
KMPlayerPopupMenu * m_popupMenu;
KMPlayerPopupMenu * m_bookmarkMenu;
KMPlayerPopupMenu * m_zoomMenu;
KMPlayerPopupMenu * m_playerMenu;
KMPlayerPopupMenu * m_colorMenu;
KMPlayerPopupMenu * m_languageMenu;
KMPlayerPopupMenu * m_audioMenu;
KMPlayerPopupMenu * m_subtitleMenu;
bool m_auto_controls; // depending on source caps
bool m_popup_clicked;
};
}
#endif // KMPLAYER_CONTROLPANEL_H

File diff suppressed because it is too large Load Diff

@ -0,0 +1,298 @@
/**
* Copyright (C) 2002-2003 by Koos Vriezen <koos.vriezen@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
**/
#ifndef KMPLAYERPARTBASE_H
#define KMPLAYERPARTBASE_H
#include <config.h>
#include "kmplayer_def.h"
#include <qobject.h>
#include <qguardedptr.h>
#include <qstringlist.h>
#include <qmap.h>
#include <dcopobject.h>
#include <kmediaplayer/player.h>
#include <kurl.h>
#include "kmplayerview.h"
#include "kmplayersource.h"
class KAboutData;
class KInstance;
class KActionCollection;
class KBookmarkMenu;
class KConfig;
class QIODevice;
class QTextStream;
class QListViewItem;
namespace KIO {
class Job;
}
namespace KMPlayer {
class PartBase;
class Process;
class MPlayer;
class BookmarkOwner;
class BookmarkManager;
class MEncoder;
class MPlayerDumpstream;
class FFMpeg;
class Xine;
class Settings;
/*
* Source from URLs
*/
class KMPLAYER_EXPORT URLSource : public Source {
Q_OBJECT
public:
URLSource (PartBase * player, const KURL & url = KURL ());
virtual ~URLSource ();
virtual void dimensions (int & w, int & h);
virtual bool hasLength ();
virtual QString prettyName ();
virtual void reset ();
virtual void setURL (const KURL & url);
public slots:
virtual void init ();
virtual void activate ();
virtual void deactivate ();
virtual void playCurrent ();
virtual void forward ();
virtual void backward ();
virtual void jump (NodePtr e);
void play ();
private slots:
void kioData (KIO::Job *, const QByteArray &);
void kioMimetype (KIO::Job *, const QString &);
void kioResult (KIO::Job *);
protected:
virtual bool requestPlayURL (NodePtr mrl);
virtual bool resolveURL (NodePtr mrl);
private:
void read (NodePtr mrl, QTextStream &);
void stopResolving ();
struct ResolveInfo {
ResolveInfo (NodePtr mrl, KIO::Job * j, SharedPtr <ResolveInfo> & n)
: resolving_mrl (mrl), job (j), progress (0), next (n) {}
NodePtrW resolving_mrl;
KIO::Job * job;
QByteArray data;
int progress;
SharedPtr <ResolveInfo> next;
};
SharedPtr <ResolveInfo> m_resolve_info;
bool activated; // 'solve' an singleShot race w/ cmdline url's
};
/*
* KDE's KMediaPlayer::Player implementation and base for KMPlayerPart
*/
class KMPLAYER_EXPORT PartBase : public KMediaPlayer::Player {
Q_OBJECT
K_DCOP
public:
typedef QMap <QString, Process *> ProcessMap;
PartBase (QWidget * parent, const char * wname,QObject * objectParent, const char * name, KConfig *);
~PartBase ();
void init (KActionCollection * = 0L);
virtual KMediaPlayer::View* view ();
static KAboutData* createAboutData ();
Settings * settings () const { return m_settings; }
void keepMovieAspect (bool);
KURL url () const { return m_sources ["urlsource"]->url (); }
void setURL (const KURL & url) { m_sources ["urlsource"]->setURL (url); }
/* Changes the backend process */
void setProcess (const char *);
bool setProcess (Mrl *mrl);
void setRecorder (const char *);
/* Changes the source,
* calls init() and reschedules an activate() on the source
* */
void setSource (Source * source);
void connectPanel (ControlPanel * panel);
void connectPlaylist (PlayListView * playlist);
void connectInfoPanel (InfoWindow * infopanel);
void connectSource (Source * old_source, Source * source);
Process * process () const { return m_process; }
Process * recorder () const { return m_recorder; }
Source * source () const { return m_source; }
QMap <QString, Process *> & players () { return m_players; }
QMap <QString, Process *> & recorders () { return m_recorders; }
QMap <QString, Source *> & sources () { return m_sources; }
KConfig * config () const { return m_config; }
bool mayResize () const { return !m_noresize; }
void updatePlayerMenu (ControlPanel *);
void updateInfo (const QString & msg);
void updateStatus (const QString & msg);
#ifdef HAVE_DBUS
void setServiceName (const QString & srv) { m_service = srv; }
QString serviceName () const { return m_service; }
#endif
// these are called from Process
void changeURL (const QString & url);
void updateTree (bool full=true, bool force=false);
void setLanguages (const QStringList & alang, const QStringList & slang);
public slots:
virtual bool openURL (const KURL & url);
virtual bool openURL (const KURL::List & urls);
virtual bool closeURL ();
virtual void pause (void);
virtual void play (void);
virtual void stop (void);
void record ();
virtual void seek (unsigned long msec);
void adjustVolume (int incdec);
bool playing () const;
void showConfigDialog ();
void showPlayListWindow ();
void slotPlayerMenu (int);
void back ();
void forward ();
void addBookMark (const QString & title, const QString & url);
void volumeChanged (int);
void increaseVolume ();
void decreaseVolume ();
void setPosition (int position, int length);
virtual void setLoaded (int percentage);
public:
virtual bool isSeekable (void) const;
virtual unsigned long position (void) const;
virtual bool hasLength (void) const;
virtual unsigned long length (void) const;
k_dcop:
void toggleFullScreen ();
bool isPlaying ();
signals:
void sourceChanged (KMPlayer::Source * old, KMPlayer::Source * nw);
void sourceDimensionChanged ();
void loading (int percentage);
void urlAdded (const QString & url);
void urlChanged (const QString & url);
void processChanged (const char *);
void treeChanged (int id, NodePtr root, NodePtr, bool select, bool open);
void treeUpdated ();
void infoUpdated (const QString & msg);
void statusUpdated (const QString & msg);
void languagesUpdated(const QStringList & alang, const QStringList & slang);
void audioIsSelected (int id);
void subtitleIsSelected (int id);
void positioned (int pos, int length);
protected:
bool openFile();
virtual void timerEvent (QTimerEvent *);
protected slots:
void posSliderPressed ();
void posSliderReleased ();
void positionValueChanged (int val);
void contrastValueChanged (int val);
void brightnessValueChanged (int val);
void hueValueChanged (int val);
void saturationValueChanged (int val);
void sourceHasChangedAspects ();
void fullScreen ();
void playListItemClicked (QListViewItem *);
void playListItemExecuted (QListViewItem *);
virtual void playingStarted ();
virtual void playingStopped ();
void recordingStarted ();
void recordingStopped ();
void settingsChanged ();
void audioSelected (int);
void subtitleSelected (int);
protected:
KConfig * m_config;
QGuardedPtr <View> m_view;
QMap <QString, QString> temp_backends;
Settings * m_settings;
Process * m_process;
Process * m_recorder;
Source * m_source;
ProcessMap m_players;
ProcessMap m_recorders;
QMap <QString, Source *> m_sources;
BookmarkManager * m_bookmark_manager;
BookmarkOwner * m_bookmark_owner;
KBookmarkMenu * m_bookmark_menu;
#ifdef HAVE_DBUS
QString m_service;
#endif
int m_record_timer;
int m_update_tree_timer;
bool m_noresize : 1;
bool m_auto_controls : 1;
bool m_use_slave : 1;
bool m_bPosSliderPressed : 1;
bool m_in_update_tree : 1;
bool m_update_tree_full : 1;
};
class KMPLAYER_NO_EXPORT DataCache : public QObject {
Q_OBJECT
typedef QMap <QString, QByteArray> DataMap;
typedef QMap <QString, bool> PreserveMap;
DataMap cache_map;
PreserveMap preserve_map;
public:
DataCache () {}
~DataCache () {}
void add (const QString &, const QByteArray &);
bool get (const QString &, QByteArray &);
bool preserve (const QString &);
bool unpreserve (const QString &);
bool isPreserved (const QString &);
signals:
void preserveRemoved (const QString &); // ready or canceled
};
class KMPLAYER_NO_EXPORT RemoteObjectPrivate : public QObject {
Q_OBJECT
public:
RemoteObjectPrivate (RemoteObject * r);
~RemoteObjectPrivate ();
bool download (const QString &);
void clear ();
KIO::Job * job;
QString url;
QByteArray data;
QString mime;
private slots:
void slotResult (KIO::Job*);
void slotData (KIO::Job*, const QByteArray& qb);
void slotMimetype (KIO::Job * job, const QString & mimestr);
void cachePreserveRemoved (const QString &);
private:
RemoteObject * remote_object;
bool preserve_wait;
};
} // namespace
#endif

@ -0,0 +1,19 @@
<!DOCTYPE kpartgui>
<kpartgui name="kmplayer" version="8">
<MenuBar>
<Menu name="view"><text>&amp;View</text>
<Action name="play"/>
<Action name="pause"/>
<Action name="stop"/>
<Action name="edit_playlist_item"/>
</Menu>
</MenuBar>
<ActionProperties>
<Action shortcut="F2" name="edit_playlist_item"/>
</ActionProperties>
<Toolbar name="mainToolBar"><text></text>
<Action name="play"/>
<Action name="pause"/>
<Action name="stop"/>
</Toolbar>
</kpartgui>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,979 @@
/* This file is part of the KDE project
*
* Copyright (C) 2004 Koos Vriezen <koos.vriezen@xs4all.nl>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* until boost gets common, a more or less compatable one ..
*/
#ifndef _KMPLAYER_PLAYLIST_H_
#define _KMPLAYER_PLAYLIST_H_
#include <config.h>
#include <sys/time.h>
#include <qstring.h>
#include "kmplayer_def.h"
#include "kmplayertypes.h"
#include "kmplayershared.h"
typedef struct _cairo_surface cairo_surface_t;
class QTextStream;
namespace KMPlayer {
class Document;
class Node;
class Mrl;
class Surface;
class ElementPrivate;
class RemoteObjectPrivate;
class Visitor;
/*
* Base class for objects that will be used as SharedPtr/WeakPtr pointers.
* Item<T> keeps its own copy of the shared SharedData<T> as a weak refence.
* \sa: self()
*/
template <class T>
class KMPLAYER_EXPORT Item {
friend class SharedPtr<T>;
friend class WeakPtr<T>;
public:
typedef SharedPtr <T> SharedType;
typedef WeakPtr <T> WeakType;
virtual ~Item () {}
SharedType self () const { return m_self; }
protected:
Item ();
WeakType m_self;
private:
Item (const Item <T> &); // forbidden copy constructor
};
/**
* Because of the m_self member of Item<T>, it's not allowed to assign a
* Item<T>* directly to SharedPtr<Item<T>>. Item<T>* will then reside in
* two independent SharedData<Item<T>> objects.
* So specialize constructor and assignment operators to fetch the
* SharedData<Item<T>> from the Item<T>* instead of creating a new one
*/
#define ITEM_AS_POINTER(CLASS) \
template <> inline SharedPtr<CLASS>::SharedPtr (CLASS * t) \
: data (t ? t->m_self.data : 0L) { \
if (data) \
data->addRef (); \
} \
\
template <> \
inline SharedPtr<CLASS> & SharedPtr<CLASS>::operator = (CLASS * t) { \
if (t) { \
operator = (t->m_self); \
} else if (data) { \
data->release (); \
data = 0L; \
} \
return *this; \
} \
\
template <> inline WeakPtr<CLASS>::WeakPtr (CLASS * t) \
: data (t ? t->m_self.data : 0L) { \
if (data) \
data->addWeakRef (); \
} \
\
template <> \
inline WeakPtr<CLASS> & WeakPtr<CLASS>::operator = (CLASS * t) { \
if (t) { \
operator = (t->m_self); \
} else if (data) { \
data->releaseWeak (); \
data = 0L; \
} \
return *this; \
}
/*
* A shareable double linked list of ListNodeBase<T> nodes
*/
template <class T>
class KMPLAYER_EXPORT List : public Item <List <T> > {
public:
List () {}
List (typename Item<T>::SharedType f, typename Item<T>::SharedType l)
: m_first (f), m_last (l) {}
~List () { clear (); }
typename Item<T>::SharedType first () const { return m_first; }
typename Item<T>::SharedType last () const { return m_last; }
void append (typename Item<T>::SharedType c);
void insertBefore(typename Item<T>::SharedType c, typename Item<T>::SharedType b);
void remove (typename Item<T>::SharedType c);
void clear ();
unsigned int length () const;
typename Item<T>::SharedType item (int i) const;
protected:
typename Item<T>::SharedType m_first;
typename Item<T>::WeakType m_last;
};
/*
* Base class for double linked list nodes of SharedPtr/WeakPtr objects.
* The linkage is a shared nextSibling and a weak previousSibling.
*/
template <class T>
class KMPLAYER_EXPORT ListNodeBase : public Item <T> {
friend class List<T>;
public:
virtual ~ListNodeBase () {}
typename Item<T>::SharedType nextSibling () const { return m_next; }
typename Item<T>::SharedType previousSibling () const { return m_prev; }
protected:
ListNodeBase () {}
typename Item<T>::SharedType m_next;
typename Item<T>::WeakType m_prev;
};
/*
* ListNode for class T storage
*/
template <class T>
class ListNode : public ListNodeBase <ListNode <T> > {
public:
ListNode (T d) : data (d) {}
T data;
};
/*
* Base class for double linked tree nodes having parent/siblings/children.
* The linkage is a shared firstChild and weak parentNode.
*/
template <class T>
class KMPLAYER_EXPORT TreeNode : public ListNodeBase <T> {
public:
virtual ~TreeNode () {}
virtual void appendChild (typename Item<T>::SharedType c);
virtual void removeChild (typename Item<T>::SharedType c);
bool hasChildNodes () const { return m_first_child != 0L; }
typename Item<T>::SharedType parentNode () const { return m_parent; }
typename Item<T>::SharedType firstChild () const { return m_first_child; }
typename Item<T>::SharedType lastChild () const { return m_last_child; }
protected:
TreeNode () {}
typename Item<T>::WeakType m_parent;
typename Item<T>::SharedType m_first_child;
typename Item<T>::WeakType m_last_child;
};
/**
* Attribute having a name/value pair for use with Elements
*/
class KMPLAYER_EXPORT Attribute : public ListNodeBase <Attribute> {
public:
KDE_NO_CDTOR_EXPORT Attribute () {}
Attribute (const TrieString & n, const QString & v);
KDE_NO_CDTOR_EXPORT ~Attribute () {}
TrieString name () const { return m_name; }
QString value () const { return m_value; }
void setName (const TrieString &);
void setValue (const QString &);
protected:
TrieString m_name;
QString m_value;
};
ITEM_AS_POINTER(KMPlayer::Attribute)
/**
* Object should scale according the passed Fit value in SizedEvent
*/
enum Fit {
fit_fill, // fill complete area, no aspect preservation
fit_hidden, // keep aspect and don't scale, cut off what doesn't fit
fit_meet, // keep aspect and scale so that the smallest size just fits
fit_slice, // keep aspect and scale so that the largest size just fits
fit_scroll // keep aspect and don't scale, add scollbars if needed
};
/*
* A generic event type
*/
class KMPLAYER_EXPORT Event : public Item <Event> {
public:
KDE_NO_CDTOR_EXPORT Event (unsigned int event_id) : m_event_id (event_id) {}
KDE_NO_CDTOR_EXPORT virtual ~Event () {}
KDE_NO_EXPORT unsigned int id () const { return m_event_id; }
protected:
unsigned int m_event_id;
};
ITEM_AS_POINTER(KMPlayer::Event)
extern const unsigned int event_pointer_clicked;
extern const unsigned int event_pointer_moved;
extern const unsigned int event_inbounds;
extern const unsigned int event_outbounds;
extern const unsigned int event_sized;
extern const unsigned int event_postponed;
extern const unsigned int event_timer;
extern const unsigned int mediatype_attached;
// convenient types
typedef Item<Node>::SharedType NodePtr;
typedef Item<Node>::WeakType NodePtrW;
typedef Item<Attribute>::SharedType AttributePtr;
typedef Item<Attribute>::WeakType AttributePtrW;
typedef Item<Event>::SharedType EventPtr;
typedef List<Node> NodeList; // eg. for Node's children
typedef Item<NodeList>::SharedType NodeListPtr;
typedef Item<NodeList>::WeakType NodeListPtrW;
ITEM_AS_POINTER(KMPlayer::NodeList)
typedef List<Attribute> AttributeList; // eg. for Element's attributes
typedef Item<AttributeList>::SharedType AttributeListPtr;
ITEM_AS_POINTER(KMPlayer::AttributeList)
typedef ListNode<NodePtrW> NodeRefItem; // Node for ref Nodes
ITEM_AS_POINTER(KMPlayer::NodeRefItem)
//typedef ListNode<NodePtr> NodeStoreItem; // list stores Nodes
typedef NodeRefItem::SharedType NodeRefItemPtr;
typedef NodeRefItem::WeakType NodeRefItemPtrW;
typedef List<NodeRefItem> NodeRefList; // ref nodes, eg. event listeners
typedef Item<NodeRefList>::SharedType NodeRefListPtr;
typedef Item<NodeRefList>::WeakType NodeRefListPtrW;
ITEM_AS_POINTER(KMPlayer::NodeRefList)
typedef Item<Surface>::SharedType SurfacePtr;
typedef Item<Surface>::WeakType SurfacePtrW;
/*
* Weak ref of the listeners list from signaler and the listener node
*/
class KMPLAYER_EXPORT Connection {
friend class Node;
public:
KDE_NO_CDTOR_EXPORT ~Connection () { disconnect (); }
void disconnect ();
NodePtrW connectee; // the one that will, when ever, trigger the event
private:
Connection (NodeRefListPtr ls, NodePtr node, NodePtr invoker);
NodeRefListPtrW listeners;
NodeRefItemPtrW listen_item;
};
typedef SharedPtr <Connection> ConnectionPtr;
/*
* Base class for XML nodes. Provides a w3c's DOM like API
*
* Most severe traps with using SharedPtr/WeakPtr for tree nodes:
* - pointer ends up in two independent shared objects (hopefully with
* template specialization for constructor for T* and assignment of T* should
* be enough of defences ..)
* - Node added two times (added ASSERT in appendChild/insertBefore)
* - Node is destroyed before being stored in a SharedPtr with kmplayer usage
* of each object having a WeakPtr to itself (eg. be extremely careful with
* using m_self in the constructor, no SharedPtr storage yet)
*
* Livetime of an element is
|-->state_activated<-->state_began<-->state_finished-->state_deactivated-->|
In scope begin event end event Out scope
*/
class KMPLAYER_EXPORT Node : public TreeNode <Node> {
friend class DocumentBuilder;
public:
enum State {
state_init, state_deferred,
state_activated, state_began, state_finished, state_deactivated
};
enum PlayType {
play_type_none, play_type_unknown, play_type_info,
play_type_image, play_type_audio, play_type_video
};
virtual ~Node ();
Document * document ();
virtual Mrl * mrl ();
virtual NodePtr childFromTag (const QString & tag);
void characterData (const QString & s);
QString innerText () const;
QString innerXML () const;
QString outerXML () const;
virtual const char * nodeName () const;
virtual QString nodeValue () const;
virtual void setNodeName (const QString &) {}
/**
* If this is a derived Mrl object and has a SRC attribute
*/
virtual PlayType playType ();
bool isPlayable () { return playType () > play_type_none; }
virtual bool isElementNode () { return false; }
/**
* If this node should be visible to the user
*/
virtual bool expose () const;
/**
* If this node should be visible to the user
*/
bool isEditable () const { return editable; }
/**
* If this node purpose is for storing runtime data only,
* ie. node doesn't exist in the original document
*/
bool auxiliaryNode () const { return auxiliary_node; }
void setAuxiliaryNode (bool b) { auxiliary_node = b; }
/**
* Add node as listener for a certain event_id.
* Return a NULL ptr if event_id is not supported.
* \sa: Connection::disconnect()
*/
ConnectionPtr connectTo (NodePtr node, unsigned int event_id);
/*
* Event send to this node, return true if handled
*/
virtual bool handleEvent (EventPtr event);
/*
* Dispatch Event to all listeners of event->id()
*/
void propagateEvent (EventPtr event);
/**
* Alternative to event handling is the Visitor pattern
*/
virtual void accept (Visitor *);
/*
* Returns a listener list for event_id, or a null ptr if not supported.
*/
virtual NodeRefListPtr listeners (unsigned int event_id);
/**
* Adds node to call 'handleEvent()' for all events that gets
* delivered to this node, ignored by default
*/
virtual SurfacePtr getSurface (NodePtr node);
/**
* Activates element, sets state to state_activated. Will call activate() on
* firstChild or call deactivate().
*/
virtual void activate ();
/**
* if state is between state_activated and state_deactivated
*/
bool active () const
{ return state >= state_deferred && state < state_deactivated; }
/**
* if state is between state_activated and state_finished
*/
bool unfinished () const
{ return state > state_deferred && state < state_finished; }
/**
* Defers an activated, so possible playlists items can be added.
*/
virtual void defer ();
/**
* Puts a deferred element in activated again, calls activate() again
*/
virtual void undefer ();
/**
* Sets state to state_begin when active
*/
virtual void begin ();
/**
* Sets state to state_finish when >= state_activated.
* Notifies parent with a childDone call.
*/
virtual void finish ();
/**
* Stops element, sets state to state_deactivated. Calls deactivate() on
* activated/deferred children. May call childDone() when active() and not
* finished yet.
*/
virtual void deactivate ();
/**
* Resets element, calls deactivate() if state is state_activated and sets
* state to state_init.
*/
virtual void reset ();
/**
* Notification from child that it has began.
*/
virtual void childBegan (NodePtr child);
/**
* Notification from child that it's finished. Will call deactivate() on
* child if it state is state_finished. Call activate() on nexSibling
* or deactivate() if there is none.
*/
virtual void childDone (NodePtr child);
virtual void clear ();
void clearChildren ();
void appendChild (NodePtr c);
void insertBefore (NodePtr c, NodePtr b);
void removeChild (NodePtr c);
void replaceChild (NodePtr _new, NodePtr old);
/*
* Get rid of whitespace only text nodes
*/
void normalize ();
KDE_NO_EXPORT bool isDocument () const { return m_doc == m_self; }
KDE_NO_EXPORT NodeListPtr childNodes () const;
void setState (State nstate);
/*
* Open tag is found by parser, attributes are set
*/
virtual void opened ();
/*
* Close tag is found by parser, children are appended
*/
virtual void closed ();
protected:
Node (NodePtr & d, short _id=0);
NodePtr m_doc;
public:
State state;
short id;
private:
bool auxiliary_node;
protected:
bool editable;
};
ITEM_AS_POINTER(KMPlayer::Node)
const short id_node_document = 1;
const short id_node_text = 5;
const short id_node_cdata = 6;
const short id_node_group_node = 25;
const short id_node_playlist_document = 26;
const short id_node_playlist_item = 27;
const short id_node_param = 28;
const short id_node_html_object = 29;
const short id_node_html_embed = 30;
/*
* Element node, XML node that can have attributes
*/
class KMPLAYER_EXPORT Element : public Node {
public:
~Element ();
void setAttributes (AttributeListPtr attrs);
void setAttribute (const TrieString & name, const QString & value);
QString getAttribute (const TrieString & name);
KDE_NO_EXPORT AttributeListPtr attributes () const { return m_attributes; }
virtual void init ();
virtual void reset ();
virtual void clear ();
virtual bool isElementNode () { return true; }
/**
* Params are like attributes, but meant to be set dynamically. Caller may
* pass a modification id, that it can use to restore the old value.
* Param will be auto removed on deactivate
*/
void setParam (const TrieString &para, const QString &val, int * mod_id=0L);
QString param (const TrieString & para);
void resetParam (const TrieString & para, int mod_id);
/**
* Called from (re)setParam for specialized interpretation of params
**/
virtual void parseParam (const TrieString &, const QString &) {}
protected:
Element (NodePtr & d, short id=0);
AttributeListPtr m_attributes;
private:
ElementPrivate * d;
};
/**
* Node that references another node
*/
class RefNode : public Node {
public:
RefNode (NodePtr & d, NodePtr ref);
virtual const char * nodeName () const { return tag_name.ascii (); }
NodePtr refNode () const { return ref_node; }
void setRefNode (const NodePtr ref);
protected:
NodePtrW ref_node;
QString tag_name;
};
template <class T>
inline KDE_NO_EXPORT T * convertNode (NodePtr e) {
return static_cast <T *> (e.ptr ());
}
/**
* Element representing a playable link, like URL to a movie or playlist.
*/
class KMPLAYER_EXPORT Mrl : public Element {
protected:
Mrl (NodePtr & d, short id=0);
NodePtr childFromTag (const QString & tag);
void parseParam (const TrieString &, const QString &);
unsigned int cached_ismrl_version;
PlayType cached_play_type;
public:
~Mrl ();
PlayType playType ();
/*
* The original node (or this) having the URL, needed for playlist expansion
*/
virtual Mrl * linkNode ();
virtual Mrl * mrl ();
virtual void endOfFile ();
QString absolutePath ();
/*
* Reimplement to callback with requestPlayURL if isPlayable()
*/
virtual void activate ();
virtual void begin ();
/**
* By default support one event handler (eg. SMIL or RP child document)
*/
virtual SurfacePtr getSurface (NodePtr node);
virtual bool handleEvent (EventPtr event);
/**
* If this Mrl is top node of external document, opener has the
* location in SCR. Typically that's the parent of this node.
*/
NodePtrW opener; //if this node is top node of external document,
QString src;
QString pretty_name;
QString mimetype;
Single width;
Single height;
float aspect;
int repeat;
enum { SingleMode = 0, WindowMode } view_mode;
bool resolved;
bool bookmarkable;
};
/**
* Document listener interface
*/
class KMPLAYER_EXPORT PlayListNotify {
public:
virtual ~PlayListNotify () {}
/**
* Ask for playing a video/audio mrl by backend players
* If returning false, the element will be set to finished
*/
virtual bool requestPlayURL (NodePtr mrl) = 0;
/**
* Called by an unresolved Mrl, check if this node points to a playlist
*/
virtual bool resolveURL (NodePtr mrl) = 0;
/**
* Element has activated or deactivated notification
*/
virtual void stateElementChanged (Node * element, Node::State old_state, Node::State new_state) = 0;
/**
* Set element to which to send GUI events and return a surface for drawing
*/
virtual SurfacePtr getSurface (NodePtr node) = 0;
/**
* Request to show msg for informing the user
*/
virtual void setInfoMessage (const QString & msg) = 0;
/**
* Ask for connection bitrates settings
*/
virtual void bitRates (int & preferred, int & maximal) = 0;
/**
* Sets next call to Document::timer() or -1 to cancel a previous call
*/
virtual void setTimeout (int ms) = 0;
};
/**
* Base class for cached network data
*/
class KMPLAYER_NO_EXPORT RemoteObject {
friend class RemoteObjectPrivate;
public:
RemoteObject ();
virtual ~RemoteObject ();
bool wget (const QString & url);
void killWGet ();
void clear ();
QString mimetype ();
protected:
KDE_NO_EXPORT virtual void remoteReady (QByteArray &) {}
bool downloading () const;
private:
RemoteObjectPrivate *d;
};
class KMPLAYER_NO_EXPORT Surface : public TreeNode <Surface> {
public:
Surface (NodePtr node, const SRect & rect);
~Surface();
virtual SurfacePtr createSurface (NodePtr owner, const SRect & rect) = 0;
virtual IRect toScreen (Single x, Single y, Single w, Single h) = 0;
virtual void resize (const SRect & rect) = 0;
virtual void repaint () = 0;
virtual void repaint (const SRect &rect) = 0;
virtual void video () = 0;
void remove (); // remove from parent, mark ancestors dirty
void markDirty (); // mark this and ancestors dirty
NodePtrW node;
SRect bounds; // bounds in in parent coord.
float xscale, yscale; // internal scaling
unsigned int background_color; // rgba background color
bool dirty; // a decendant is removed
#ifdef HAVE_CAIRO
cairo_surface_t *surface;
#endif
};
ITEM_AS_POINTER(KMPlayer::Surface)
/**
* To have a somewhat synchronized time base, node having timers should use
* this. Idea is that if a node still waiting for network data, it can hold
* this time line.
*/
class KMPLAYER_NO_EXPORT TimerInfo : public ListNodeBase <TimerInfo> {
public:
TimerInfo (NodePtr n, unsigned id, struct timeval & now, int ms);
KDE_NO_CDTOR_EXPORT ~TimerInfo () {}
NodePtrW node;
unsigned event_id;
struct timeval timeout;
int milli_sec;
};
ITEM_AS_POINTER(KMPlayer::TimerInfo)
typedef Item <TimerInfo>::SharedType TimerInfoPtr;
typedef Item <TimerInfo>::WeakType TimerInfoPtrW;
/**
* Event signaling a timer event
*/
class KMPLAYER_NO_EXPORT TimerEvent : public Event {
public:
TimerEvent (TimerInfoPtr tinfo);
TimerInfoPtrW timer_info;
bool interval; // set to 'true' in 'Node::handleEvent()' to make it repeat
};
/**
* Event signaling postponed or proceeded
*/
class KMPLAYER_NO_EXPORT PostponedEvent : public Event {
public:
PostponedEvent (bool postponed);
bool is_postponed; // postponed or proceeded
};
/**
* Postpone object representing a postponed document
* During its livetime, no TimerEvent's happen
*/
class KMPLAYER_NO_EXPORT Postpone {
friend class Document;
struct timeval postponed_time;
NodePtrW m_doc;
Postpone (NodePtr doc);
public:
~Postpone ();
};
typedef SharedPtr <Postpone> PostponePtr;
typedef WeakPtr <Postpone> PostponePtrW;
/**
* The root of the DOM tree
*/
class KMPLAYER_EXPORT Document : public Mrl {
friend class Postpone;
public:
Document (const QString &, PlayListNotify * notify = 0L);
~Document ();
NodePtr getElementById (const QString & id);
NodePtr getElementById (NodePtr start, const QString & id, bool inter_doc);
/** All nodes have shared pointers to Document,
* so explicitly dispose it (calls clear and set m_doc to 0L)
* */
void dispose ();
virtual NodePtr childFromTag (const QString & tag);
KDE_NO_EXPORT const char * nodeName () const { return "document"; }
virtual void activate ();
virtual void defer ();
virtual void undefer ();
virtual void reset ();
/**
* Ask for TimerEvent for Node n in ms milli-seconds.
* Returns weak ref to TimerInfo ptr, which is an item in the timers list
*/
TimerInfoPtrW setTimeout (NodePtr n, int ms, unsigned id=0);
void cancelTimer (TimerInfoPtr ti);
void timeOfDay (struct timeval &);
PostponePtr postpone ();
/**
* Called by PlayListNotify, creates TimerEvent on first item in timers.
* Returns true if to repeat this same timeout FIXME.
*/
bool timer ();
/**
* Document has list of postponed listeners, eg. for running (gif)movies
*/
virtual NodeRefListPtr listeners (unsigned int event_id);
/**
* Reimplement, so it will call PlayListNotify::getSurface()
*/
virtual SurfacePtr getSurface (NodePtr node);
List <TimerInfo> timers; //FIXME: make as connections
PlayListNotify * notify_listener;
unsigned int m_tree_version;
unsigned int last_event_time;
private:
void proceed (const struct timeval & postponed_time);
PostponePtrW postpone_ref;
PostponePtr postpone_lock;
NodeRefListPtr m_PostponedListeners;
int cur_timeout;
struct timeval first_event_time;
bool intimer;
};
/**
* Represents XML text, like "some text" in '<foo>some text</foo>'
*/
class KMPLAYER_EXPORT TextNode : public Node {
public:
TextNode (NodePtr & d, const QString & s, short _id = id_node_text);
KDE_NO_CDTOR_EXPORT ~TextNode () {}
void appendText (const QString & s);
void setText (const QString & txt) { text = txt; }
const char * nodeName () const { return "#text"; }
QString nodeValue () const;
bool expose () const;
protected:
QString text;
};
/**
* Represents cdata sections, like "some text" in '<![CDATA[some text]]>'
*/
class KMPLAYER_EXPORT CData : public TextNode {
public:
CData (NodePtr & d, const QString & s);
KDE_NO_CDTOR_EXPORT ~CData () {}
const char * nodeName () const { return "#cdata"; }
};
/**
* Unrecognized tag by parent element or just some auxiliary node
*/
class KMPLAYER_EXPORT DarkNode : public Element {
public:
DarkNode (NodePtr & d, const QString & n, short id=0);
KDE_NO_CDTOR_EXPORT ~DarkNode () {}
const char * nodeName () const { return name.ascii (); }
NodePtr childFromTag (const QString & tag);
virtual bool expose () const;
protected:
QString name;
};
namespace SMIL {
class RegionBase;
class Region;
class Layout;
class Transition;
class MediaType;
class ImageMediaType;
class TextMediaType;
class RefMediaType;
class AVMediaType;
class Brush;
class TimedMrl;
class Anchor;
class Area;
}
namespace RP {
class Imfl;
class Crossfade;
class Fadein;
class Fadeout;
class Fill;
class Wipe;
class ViewChange;
class Animate;
}
class KMPLAYER_NO_EXPORT Visitor {
public:
KDE_NO_CDTOR_EXPORT Visitor () {}
KDE_NO_CDTOR_EXPORT virtual ~Visitor () {}
virtual void visit (Node *) {}
virtual void visit (SMIL::Region *);
virtual void visit (SMIL::Layout *);
virtual void visit (SMIL::Transition *);
virtual void visit (SMIL::TimedMrl *);
virtual void visit (SMIL::MediaType *);
virtual void visit (SMIL::ImageMediaType *);
virtual void visit (SMIL::TextMediaType *);
virtual void visit (SMIL::RefMediaType *);
virtual void visit (SMIL::AVMediaType *);
virtual void visit (SMIL::Brush *);
virtual void visit (SMIL::Anchor *);
virtual void visit (SMIL::Area *);
virtual void visit (RP::Imfl *) {}
virtual void visit (RP::Crossfade *) {}
virtual void visit (RP::Fadein *) {}
virtual void visit (RP::Fadeout *) {}
virtual void visit (RP::Fill *) {}
virtual void visit (RP::Wipe *) {}
virtual void visit (RP::ViewChange *) {}
virtual void visit (RP::Animate *) {}
};
//-----------------------------------------------------------------------------
/**
* just some url, can get a SMIL, RSS, or ASX childtree
*/
class KMPLAYER_EXPORT GenericURL : public Mrl {
public:
GenericURL(NodePtr &d, const QString &s, const QString &n=QString ());
KDE_NO_EXPORT const char * nodeName () const { return "url"; }
void closed ();
};
/**
* Non url mrl
*/
class KMPLAYER_EXPORT GenericMrl : public Mrl {
public:
KDE_NO_CDTOR_EXPORT GenericMrl (NodePtr & d) : Mrl (d), node_name ("mrl") {}
GenericMrl(NodePtr &d, const QString &s, const QString & name=QString (), const QString &tag=QString ("mrl"));
KDE_NO_EXPORT const char * nodeName () const { return node_name.ascii (); }
void closed ();
bool expose () const;
QString node_name;
};
KMPLAYER_EXPORT
void readXML (NodePtr root, QTextStream & in, const QString & firstline, bool set_opener=true);
KMPLAYER_EXPORT Node * fromXMLDocumentTag (NodePtr & d, const QString & tag);
template <class T>
inline Item<T>::Item () : m_self (static_cast <T*> (this), true) {}
template <class T> inline void List<T>::append(typename Item<T>::SharedType c) {
if (!m_first) {
m_first = m_last = c;
} else {
m_last->m_next = c;
c->m_prev = m_last;
m_last = c;
}
}
template <class T> inline void List<T>::insertBefore(typename Item<T>::SharedType c, typename Item<T>::SharedType b) {
if (!b) {
append (c);
} else {
if (b->m_prev) {
b->m_prev->m_next = c;
c->m_prev = b->m_prev;
} else {
c->m_prev = 0L;
m_first = c;
}
b->m_prev = c;
c->m_next = b;
}
}
template <class T> inline void List<T>::remove(typename Item<T>::SharedType c) {
if (c->m_prev) {
c->m_prev->m_next = c->m_next;
} else
m_first = c->m_next;
if (c->m_next) {
c->m_next->m_prev = c->m_prev;
c->m_next = 0L;
} else
m_last = c->m_prev;
c->m_prev = 0L;
}
template <class T> inline unsigned int List<T>::length () const {
unsigned int count = 0;
for (typename Item<T>::SharedType t = m_first; t; t = t->nextSibling ())
count++;
return count;
}
template <class T> inline void List<T>::clear () {
m_first = m_last = 0L;
}
template <class T>
inline typename Item<T>::SharedType List<T>::item (int i) const {
for (typename Item<T>::SharedType t = m_first; t; t = t->nextSibling(), --i)
if (i == 0)
return t;
return typename Item<T>::SharedType ();
}
template <class T>
inline void TreeNode<T>::appendChild (typename Item<T>::SharedType c) {
if (!m_first_child) {
m_first_child = m_last_child = c;
} else {
m_last_child->m_next = c;
c->m_prev = m_last_child;
m_last_child = c;
}
c->m_parent = Item<T>::m_self;
}
template <class T>
inline void TreeNode<T>::removeChild (typename Item<T>::SharedType c) {
if (c->m_prev) {
c->m_prev->m_next = c->m_next;
} else
m_first_child = c->m_next;
if (c->m_next) {
c->m_next->m_prev = c->m_prev;
c->m_next = 0L;
} else
m_last_child = c->m_prev;
c->m_prev = 0L;
c->m_parent = 0L;
}
inline KDE_NO_EXPORT NodeListPtr Node::childNodes () const {
return new NodeList (m_first_child, m_last_child);
}
} // KMPlayer namespace
#endif //_KMPLAYER_PLAYLIST_H_

File diff suppressed because it is too large Load Diff

@ -0,0 +1,500 @@
/* This file is part of the KDE project
*
* Copyright (C) 2003 Koos Vriezen <koos.vriezen@xs4all.nl>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KMPLAYERPROCESS_H_
#define _KMPLAYERPROCESS_H_
#include <qobject.h>
#include <qguardedptr.h>
#include <qstring.h>
#include <qcstring.h>
#include <qstringlist.h>
#include <qregexp.h>
#include <kurl.h>
#include <kio/global.h>
#include "kmplayerconfig.h"
#include "kmplayersource.h"
class QWidget;
class KProcess;
namespace KIO {
class Job;
class TransferJob;
}
namespace KMPlayer {
class Settings;
class Viewer;
class Source;
class Callback;
class Backend_stub;
/*
* Base class for all backend processes
*/
class KMPLAYER_EXPORT Process : public QObject {
Q_OBJECT
public:
enum State {
NotRunning = 0, Ready, Buffering, Playing
};
Process (QObject * parent, Settings * settings, const char * n);
virtual ~Process ();
virtual void init ();
virtual void initProcess (Viewer *);
virtual QString menuName () const;
virtual void setAudioLang (int, const QString &);
virtual void setSubtitle (int, const QString &);
bool playing () const;
KDE_NO_EXPORT KProcess * process () const { return m_process; }
KDE_NO_EXPORT Source * source () const { return m_source; }
virtual WId widget ();
Viewer * viewer () const;
void setSource (Source * src) { m_source = src; }
virtual bool grabPicture (const KURL & url, int pos);
bool supports (const char * source) const;
State state () const { return m_state; }
NodePtr mrl () const { return m_mrl; }
signals:
void grabReady (const QString & path);
public slots:
virtual bool ready (Viewer *);
bool play (Source *, NodePtr mrl);
virtual bool stop ();
virtual bool quit ();
virtual bool pause ();
/* seek (pos, abs) seek position in deci-seconds */
virtual bool seek (int pos, bool absolute);
/* volume from 0 to 100 */
virtual bool volume (int pos, bool absolute);
/* saturation/hue/contrast/brightness from -100 to 100 */
virtual bool saturation (int pos, bool absolute);
virtual bool hue (int pos, bool absolute);
virtual bool contrast (int pos, bool absolute);
virtual bool brightness (int pos, bool absolute);
protected slots:
void rescheduledStateChanged ();
void result (KIO::Job *);
protected:
void setState (State newstate);
virtual bool deMediafiedPlay ();
virtual void terminateJobs ();
Source * m_source;
Settings * m_settings;
NodePtrW m_mrl;
State m_state;
State m_old_state;
KProcess * m_process;
KIO::Job * m_job;
QString m_url;
int m_request_seek;
const char ** m_supported_sources;
private:
QGuardedPtr <Viewer> m_viewer;
};
/*
* Base class for all MPlayer based processes
*/
class MPlayerBase : public Process {
Q_OBJECT
public:
MPlayerBase (QObject * parent, Settings * settings, const char * n);
~MPlayerBase ();
void initProcess (Viewer *);
public slots:
virtual bool stop ();
virtual bool quit ();
protected:
bool sendCommand (const QString &);
QStringList commands;
bool m_use_slave : 1;
protected slots:
virtual void processStopped (KProcess *);
private slots:
void dataWritten (KProcess *);
};
class MPlayerPreferencesPage;
class MPlayerPreferencesFrame;
/*
* MPlayer process
*/
class KDE_EXPORT MPlayer : public MPlayerBase {
Q_OBJECT
public:
MPlayer (QObject * parent, Settings * settings);
~MPlayer ();
virtual void init ();
virtual QString menuName () const;
virtual WId widget ();
virtual bool grabPicture (const KURL & url, int pos);
virtual void setAudioLang (int, const QString &);
virtual void setSubtitle (int, const QString &);
bool run (const char * args, const char * pipe = 0L);
public slots:
virtual bool deMediafiedPlay ();
virtual bool stop ();
virtual bool pause ();
virtual bool seek (int pos, bool absolute);
virtual bool volume (int pos, bool absolute);
virtual bool saturation (int pos, bool absolute);
virtual bool hue (int pos, bool absolute);
virtual bool contrast (int pos, bool absolute);
virtual bool brightness (int pos, bool absolute);
MPlayerPreferencesPage * configPage () const { return m_configpage; }
bool ready (Viewer *);
protected slots:
void processStopped (KProcess *);
private slots:
void processOutput (KProcess *, char *, int);
private:
QString m_process_output;
QString m_grabfile;
QWidget * m_widget;
MPlayerPreferencesPage * m_configpage;
QString m_tmpURL;
struct LangInfo {
LangInfo (int i, const QString & n) : id (i), name (n) {}
int id; QString name; SharedPtr <LangInfo> next;
};
SharedPtr <LangInfo> alanglist;
WeakPtr <LangInfo> alanglist_end;
SharedPtr <LangInfo> slanglist;
WeakPtr <LangInfo> slanglist_end;
int aid, sid;
int old_volume;
bool m_needs_restarted;
};
/*
* MPlayer preferences page
*/
class KMPLAYER_NO_EXPORT MPlayerPreferencesPage : public PreferencesPage {
public:
enum Pattern {
pat_size = 0, pat_cache, pat_pos, pat_index,
pat_refurl, pat_ref, pat_start,
pat_dvdlang, pat_dvdsub, pat_dvdtitle, pat_dvdchapter,
pat_vcdtrack, pat_cdromtracks,
pat_last
};
MPlayerPreferencesPage (MPlayer *);
KDE_NO_CDTOR_EXPORT ~MPlayerPreferencesPage () {}
void write (KConfig *);
void read (KConfig *);
void sync (bool fromUI);
void prefLocation (QString & item, QString & icon, QString & tab);
QFrame * prefPage (QWidget * parent);
QRegExp m_patterns[pat_last];
int cachesize;
QString mplayer_path;
QString additionalarguments;
bool alwaysbuildindex;
private:
MPlayer * m_process;
MPlayerPreferencesFrame * m_configframe;
};
/*
* Base class for all recorders
*/
class KMPLAYER_EXPORT Recorder {
public:
KDE_NO_EXPORT const KURL & recordURL () const { return m_recordurl; }
KDE_NO_EXPORT void setURL (const KURL & url) { m_recordurl = url; }
protected:
KURL m_recordurl;
};
/*
* MEncoder recorder
*/
class MEncoder : public MPlayerBase, public Recorder {
Q_OBJECT
public:
MEncoder (QObject * parent, Settings * settings);
~MEncoder ();
virtual void init ();
virtual bool deMediafiedPlay ();
public slots:
virtual bool stop ();
};
/*
* MPlayer recorder, runs 'mplayer -dumpstream'
*/
class KMPLAYER_NO_EXPORT MPlayerDumpstream
: public MPlayerBase, public Recorder {
Q_OBJECT
public:
MPlayerDumpstream (QObject * parent, Settings * settings);
~MPlayerDumpstream ();
virtual void init ();
virtual bool deMediafiedPlay ();
public slots:
virtual bool stop ();
};
class XMLPreferencesPage;
class XMLPreferencesFrame;
/*
* Base class for all backend processes having the KMPlayer::Backend interface
*/
class KMPLAYER_EXPORT CallbackProcess : public Process {
Q_OBJECT
friend class Callback;
public:
CallbackProcess (QObject * parent, Settings * settings, const char * n, const QString & menu);
~CallbackProcess ();
virtual void setStatusMessage (const QString & msg);
virtual void setErrorMessage (int code, const QString & msg);
virtual void setFinished ();
virtual void setPlaying ();
virtual void setStarted (QCString dcopname, QByteArray & data);
virtual void setMovieParams (int length, int width, int height, float aspect, const QStringList & alang, const QStringList & slang);
virtual void setMoviePosition (int position);
virtual void setLoadingProgress (int percentage);
virtual void setAudioLang (int, const QString &);
virtual void setSubtitle (int, const QString &);
virtual QString menuName () const;
virtual WId widget ();
KDE_NO_EXPORT QByteArray & configData () { return m_configdata; }
KDE_NO_EXPORT bool haveConfig () { return m_have_config == config_yes; }
bool getConfigData ();
void setChangedData (const QByteArray &);
QString dcopName ();
NodePtr configDocument () { return configdoc; }
void initProcess (Viewer *);
virtual bool deMediafiedPlay ();
public slots:
bool stop ();
bool quit ();
bool pause ();
bool seek (int pos, bool absolute);
bool volume (int pos, bool absolute);
bool saturation (int pos, bool absolute);
bool hue (int pos, bool absolute);
bool contrast (int pos, bool absolute);
bool brightness (int pos, bool absolute);
signals:
void configReceived ();
protected slots:
void processStopped (KProcess *);
void processOutput (KProcess *, char *, int);
protected:
Callback * m_callback;
Backend_stub * m_backend;
QString m_menuname;
QByteArray m_configdata;
QByteArray m_changeddata;
XMLPreferencesPage * m_configpage;
NodePtr configdoc;
bool in_gui_update;
enum { config_unknown, config_probe, config_yes, config_no } m_have_config;
enum { send_no, send_try, send_new } m_send_config;
};
/*
* Config document as used by kxineplayer backend
*/
struct KMPLAYER_NO_EXPORT ConfigDocument : public Document {
ConfigDocument ();
~ConfigDocument ();
NodePtr childFromTag (const QString & tag);
};
/*
* Element for ConfigDocument
*/
struct KMPLAYER_NO_EXPORT ConfigNode : public DarkNode {
ConfigNode (NodePtr & d, const QString & tag);
KDE_NO_CDTOR_EXPORT ~ConfigNode () {}
NodePtr childFromTag (const QString & tag);
QWidget * w;
};
/*
* Element for ConfigDocument, defining type of config item
*/
struct KMPLAYER_NO_EXPORT TypeNode : public ConfigNode {
TypeNode (NodePtr & d, const QString & t);
KDE_NO_CDTOR_EXPORT ~TypeNode () {}
NodePtr childFromTag (const QString & tag);
void changedXML (QTextStream & out);
QWidget * createWidget (QWidget * parent);
const char * nodeName () const { return tag.ascii (); }
QString tag;
};
/*
* Preference page for XML type of docuement
*/
class KMPLAYER_NO_EXPORT XMLPreferencesPage : public PreferencesPage {
public:
XMLPreferencesPage (CallbackProcess *);
~XMLPreferencesPage ();
void write (KConfig *);
void read (KConfig *);
void sync (bool fromUI);
void prefLocation (QString & item, QString & icon, QString & tab);
QFrame * prefPage (QWidget * parent);
private:
CallbackProcess * m_process;
XMLPreferencesFrame * m_configframe;
};
/*
* Xine backend process
*/
class KMPLAYER_NO_EXPORT Xine : public CallbackProcess, public Recorder {
Q_OBJECT
public:
Xine (QObject * parent, Settings * settings);
~Xine ();
public slots:
bool ready (Viewer *);
};
/*
* GStreamer backend process
*/
class KMPLAYER_NO_EXPORT GStreamer : public CallbackProcess {
Q_OBJECT
public:
GStreamer (QObject * parent, Settings * settings);
~GStreamer ();
public slots:
virtual bool ready (Viewer *);
};
/*
* ffmpeg backend recorder
*/
class KMPLAYER_EXPORT FFMpeg : public Process, public Recorder {
Q_OBJECT
public:
FFMpeg (QObject * parent, Settings * settings);
~FFMpeg ();
virtual void init ();
virtual bool deMediafiedPlay ();
public slots:
virtual bool stop ();
virtual bool quit ();
private slots:
void processStopped (KProcess *);
};
/*
* npplayer backend
*/
class KMPLAYER_NO_EXPORT NpStream : public QObject {
Q_OBJECT
public:
enum Reason {
NoReason = -1,
BecauseDone = 0, BecauseError = 1, BecauseStopped = 2
};
NpStream (QObject *parent, Q_UINT32 stream_id, const KURL & url);
~NpStream ();
void open ();
void close ();
KURL url;
QByteArray pending_buf;
KIO::TransferJob *job;
timeval data_arrival;
Q_UINT32 bytes;
Q_UINT32 stream_id;
Q_UINT32 content_length;
Reason finish_reason;
QString mimetype;
signals:
void stateChanged ();
void redirected (Q_UINT32, const KURL &);
private slots:
void slotResult (KIO::Job*);
void slotData (KIO::Job*, const QByteArray& qb);
void redirection (KIO::Job *, const KURL &url);
void slotMimetype (KIO::Job *, const QString &mime);
void slotTotalSize (KIO::Job *, KIO::filesize_t sz);
};
class KMPLAYER_NO_EXPORT NpPlayer : public Process {
Q_OBJECT
public:
NpPlayer (QObject * parent, Settings * settings, const QString & srv);
~NpPlayer ();
virtual void init ();
virtual bool deMediafiedPlay ();
virtual void initProcess (Viewer * viewer);
virtual QString menuName () const;
void setStarted (const QString & srv);
void requestStream (const QString & path, const QString & url, const QString & target);
void destroyStream (const QString & path);
KDE_NO_EXPORT const QString & destination () const { return service; }
KDE_NO_EXPORT const QString & interface () const { return iface; }
KDE_NO_EXPORT QString objectPath () const { return path; }
QString evaluateScript (const QString & scr);
signals:
void evaluate (const QString & scr, QString & result);
void openUrl (const KURL & url, const QString & target);
public slots:
virtual bool stop ();
virtual bool quit ();
public slots:
bool ready (Viewer *);
private slots:
void processOutput (KProcess *, char *, int);
void processStopped (KProcess *);
void wroteStdin (KProcess *);
void streamStateChanged ();
void streamRedirected (Q_UINT32, const KURL &);
protected:
virtual void terminateJobs ();
private:
void sendFinish (Q_UINT32 sid, Q_UINT32 total, NpStream::Reason because);
void processStreams ();
QString service;
QString iface;
QString path;
QString filter;
QString m_base_url;
typedef QMap <Q_UINT32, NpStream *> StreamMap;
StreamMap streams;
QString remote_service;
QByteArray send_buf;
bool write_in_progress;
};
} // namespace
#endif //_KMPLAYERPROCESS_H_

@ -0,0 +1,55 @@
[General Options]
Show Statusbar=true
Show Toolbar=true
pipesource=xine
urlsource=xine
vcdsource=xine
[KFileDialog Settings]
[KFileDialog Speedbar]
[MPlayer]
Post MPlayer 0.90=true
Add Configure Button=true
Additional Arguments=
Mencoder Arguments=-oac mp3lame -ovc lavc
Cache Size for Streaming=128
DVD Device=/dev/dvd
Forward/Backward Seek Time=10
Immediately Play DVD=true
Keep Size Ratio=true
Loop=false
Frame Drop=true
Add Record Button=true
Add Broadcast Button=true
Show DVD Menu=true
Video Driver=xv
[Pipe Command]
Command1=cat ~/example.avi
[MPlayer Output Matching]
DVD Chapters=There are ([0-9]+) chapters
DVD Language=ID_AID_([0-9]+)_LANG=([A-Za-z]+)
DVD Sub Title=ID_SID_([0-9]+)_LANG=([A-Za-z]+)
DVD Titles=There are ([0-9]+) titles
Movie Size=VO:.*[^0-9]([0-9]+)x([0-9]+)
Cache Fill=Cache fill:[^0-9]*([0-9\\.]+)%
Movie Position=V:\\s*([0-9\\.]+)
Start Playing=Start[^ ]* play
VCD Tracks=track ([0-9]+):
[Broadcast]
Custom Setting=asf;mp3;32;22050;mpeg4;80;10;10;12;320;240;127.0.0.1;10.0.0.0 10.255.255.255;192.168.0.0 192.168.255.255
Profile_Modem (32k)=asf;mp3;8;11025;mpeg4;50;19;3;3;160;128;27.0.0.1;10.0.0.0 10.255.255.255;192.168.0.0 192.168.255.255
Profile_ISDN (64k)=asf;mp3;8;11025;mpeg4;50;16;3;3;320;240;127.0.0.1;10.0.0.0 10.255.255.255;192.168.0.0 192.168.255.255
Profile_ISDN2 (128k)=asf;mp3;32;22050;mpeg4;80;10;10;12;320;240;127.0.0.1;10.0.0.0 10.255.255.255;192.168.0.0 192.168.255.255
Profile_LAN (1024k)=mpeg;;64;44100;;512;5;25;12;320;240;127.0.0.1;10.0.0.0 10.255.255.255;192.168.0.0 192.168.255.255
Profiles=Modem (32k);ISDN (64k);ISDN2 (128k);LAN (1024k)
[Recent Files]
[Recording]
Auto Play After Recording=0
Recorder=3

@ -0,0 +1,264 @@
/* This file is part of the KDE project
*
* Copyright (C) 2004 Koos Vriezen <koos.vriezen@xs4all.nl>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* until boost gets common, a more or less compatable one ..
*/
#ifndef _SHAREDPTR_H_
#define _SHAREDPTR_H_
//#define SHAREDPTR_DEBUG
#ifdef SHAREDPTR_DEBUG
extern int shared_data_count;
#include <iostream>
#endif
namespace KMPlayer {
/**
* Shared data for SharedPtr and WeakPtr objects.
**/
template <class T>
struct SharedData {
SharedData (T * t, bool w) : use_count (w?0:1), weak_count (1), ptr (t) {
#ifdef SHAREDPTR_DEBUG
std::cerr << "SharedData::SharedData use:" << use_count << " weak:" << weak_count << " total:" << ++shared_data_count << std::endl;
#endif
}
#ifdef SHAREDPTR_DEBUG
~SharedData () { std::cerr << "SharedData::~SharedData" << " total:" << --shared_data_count << std::endl; }
#endif
void addRef ();
void addWeakRef ();
void release ();
void releaseWeak ();
void dispose ();
int use_count;
int weak_count;
T * ptr;
};
template <class T> inline void SharedData<T>::addRef () {
use_count++;
weak_count++;
#ifdef SHAREDPTR_DEBUG
std::cerr << "SharedData::addRef use:" << use_count << " weak:" << weak_count << std::endl;
#endif
}
template <class T> inline void SharedData<T>::addWeakRef () {
weak_count++;
#ifdef SHAREDPTR_DEBUG
std::cerr << "SharedData::addWeakRef use:" << use_count << " weak:" << weak_count << std::endl;
#endif
}
template <class T> inline void SharedData<T>::releaseWeak () {
ASSERT (weak_count > 0 && weak_count > use_count);
#ifdef SHAREDPTR_DEBUG
std::cerr << "SharedData::releaseWeak use:" << use_count << " weak:" << weak_count-1 << std::endl;
#endif
if (--weak_count <= 0) delete this;
}
template <class T> inline void SharedData<T>::release () {
ASSERT (use_count > 0);
if (--use_count <= 0) dispose ();
#ifdef SHAREDPTR_DEBUG
std::cerr << "SharedData::release use:" << use_count << " weak:" << weak_count << std::endl;
#endif
releaseWeak ();
}
template <class T> inline void SharedData<T>::dispose () {
ASSERT (use_count == 0);
#ifdef SHAREDPTR_DEBUG
std::cerr << "SharedData::dispose use:" << use_count << " weak:" << weak_count << std::endl;
#endif
delete ptr;
ptr = 0;
}
template <class T> struct WeakPtr;
/**
* Shared class based on boost shared
* This makes it possible to share pointers w/o having to worry about
* memory leaks. A pointer gets deleted as soon as the last Shared pointer
* gets destroyed. As such, never use (or be extremely carefull) not to
* use pointers or references to shared objects
**/
template <class T>
struct SharedPtr {
SharedPtr () : data (0L) {};
SharedPtr (T *t) : data (t ? new SharedData<T> (t, false) : 0L) {}
SharedPtr (const SharedPtr<T> & s) : data (s.data) { if (data) data->addRef (); }
SharedPtr (const WeakPtr <T> &);
~SharedPtr () { if (data) data->release (); }
SharedPtr<T> & operator = (const SharedPtr<T> &);
SharedPtr<T> & operator = (const WeakPtr<T> &);
SharedPtr<T> & operator = (T *);
T * ptr () const { return data ? data->ptr : 0L; }
T * operator -> () { return data ? data->ptr : 0L; }
T * operator -> () const { return data ? data->ptr : 0L; }
T & operator * () { return *data->ptr; }
const T & operator * () const { return *data->ptr; }
// operator bool () const { return data && data->ptr; }
bool operator == (const SharedPtr<T> & s) const { return data == s.data; }
bool operator == (const WeakPtr<T> & w) const;
bool operator == (const T * t) const { return (!t && !data) || (data && data->ptr == t); }
bool operator == (T * t) const { return (!t && !data) || (data && data->ptr == t); }
bool operator != (const SharedPtr<T> & s) const { return data != s.data; }
bool operator != (const WeakPtr<T> & w) const;
bool operator != (const T * t) const { return !operator == (t); }
operator T * () { return data ? data->ptr : 0L; }
operator const T * () const { return data ? data->ptr : 0L; }
mutable SharedData<T> * data;
};
template <class T>
bool operator == (T * t, SharedPtr <T> & s) {
return (!t && !s.data) || (s.data && s.data->ptr == t);
}
template <class T>
bool operator == (const T * t, SharedPtr <T> & s) {
return (!t && !s.data) || (s.data && s.data->ptr == t);
}
template <class T>
inline SharedPtr<T> & SharedPtr<T>::operator = (const SharedPtr<T> & s) {
if (data != s.data) {
SharedData<T> * tmp = data;
data = s.data;
if (data) data->addRef ();
if (tmp) tmp->release ();
}
return *this;
}
template <class T> inline SharedPtr<T> & SharedPtr<T>::operator = (T * t) {
if ((!data && t) || (data && data->ptr != t)) {
if (data) data->release ();
data = t ? new SharedData<T> (t, false) : 0L;
}
return *this;
}
/**
* Weak version of SharedPtr. This will also have access to the SharedData
* pointer, only these object wont prevent destruction of the shared
* pointer, hence weak references
*/
template <class T>
struct WeakPtr {
WeakPtr () : data (0L) {};
WeakPtr (T * t) : data (t ? new SharedData<T> (t, true) : 0) {}
WeakPtr (T * t, bool /*b*/) : data (t ? new SharedData<T> (t, true) : 0) {}
WeakPtr (const WeakPtr<T> & s) : data (s.data) { if (data) data->addWeakRef (); }
WeakPtr (const SharedPtr<T> & s) : data (s.data) { if (data) data->addWeakRef (); }
~WeakPtr () { if (data) data->releaseWeak (); }
WeakPtr<T> & operator = (const WeakPtr<T> &);
WeakPtr<T> & operator = (const SharedPtr<T> &);
WeakPtr<T> & operator = (T *);
T * ptr () const { return data ? data->ptr : 0L; }
T * operator -> () { return data ? data->ptr : 0L; }
const T * operator -> () const { return data ? data->ptr : 0L; }
T & operator * () { return *data->ptr; }
const T & operator * () const { return *data->ptr; }
// operator bool () const { return data && !!data->ptr; }
bool operator == (const WeakPtr<T> & w) const { return data == w.data; }
bool operator == (const SharedPtr<T> & s) const { return data == s.data; }
bool operator == (const T * t) const { return (!t && !data) || (data && data.ptr == t); }
bool operator == (T * t) const { return (!t && !data) || (data && data.ptr == t); }
bool operator != (const WeakPtr<T> & w) const { return data != w.data; }
bool operator != (const SharedPtr<T> & s) const { return data != s.data; }
operator T * () { return data ? data->ptr : 0L; }
operator const T * () const { return data ? data->ptr : 0L; }
mutable SharedData<T> * data;
};
template <class T>
bool operator == (T * t, WeakPtr <T> & s) {
return (!t && !s.data) || (s.data && s.data->ptr == t);
}
template <class T>
bool operator == (const T * t, WeakPtr <T> & s) {
return (!t && !s.data) || (s.data && s.data->ptr == t);
}
template <class T>
inline WeakPtr<T> & WeakPtr<T>::operator = (const WeakPtr<T> & w) {
if (data != w.data) {
SharedData<T> * tmp = data;
data = w.data;
if (data) data->addWeakRef ();
if (tmp) tmp->releaseWeak ();
}
return *this;
}
template <class T>
inline WeakPtr<T> & WeakPtr<T>::operator = (const SharedPtr<T> & s) {
if (data != s.data) {
SharedData<T> * tmp = data;
data = s.data;
if (data) data->addWeakRef ();
if (tmp) tmp->releaseWeak ();
}
return *this;
}
template <class T>
inline WeakPtr<T> & WeakPtr<T>::operator = (T * t) {
if (data) data->releaseWeak ();
data = t ? new SharedData<T> (t, true) : 0L;
return *this;
}
template <class T> inline SharedPtr<T>::SharedPtr (const WeakPtr <T> & w) : data (w.data) {
if (data) data->addRef ();
}
template <class T>
inline SharedPtr<T> & SharedPtr<T>::operator = (const WeakPtr<T> & s) {
if (data != s.data) {
SharedData<T> * tmp = data;
data = s.data;
if (data) data->addRef ();
if (tmp) tmp->release ();
}
return *this;
}
template <class T>
inline bool SharedPtr<T>::operator == (const WeakPtr<T> & w) const {
return data == w.data;
}
template <class T>
inline bool SharedPtr<T>::operator != (const WeakPtr<T> & w) const {
return data != w.data;
}
}
#endif

@ -0,0 +1,176 @@
/* This file is part of the KDE project
*
* Copyright (C) 2003 Koos Vriezen <koos.vriezen@xs4all.nl>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KMPLAYERSOURCE_H
#define KMPLAYERSOURCE_H
#include <qobject.h>
#include <qstring.h>
#include <kurl.h>
#include "kmplayerplaylist.h"
#include "kmplayerprocess.h"
class KConfig;
class QWidget;
class QFrame;
namespace KMPlayer {
class PartBase;
/**
* Class for a certain media, like URL, DVD, TV etc
*/
class KMPLAYER_EXPORT Source : public QObject, public PlayListNotify {
Q_OBJECT
public:
Source (const QString & name, PartBase * player, const char * src);
virtual ~Source ();
virtual void init ();
virtual bool processOutput (const QString & line);
bool identified () const { return m_identified; }
virtual bool hasLength ();
virtual bool isSeekable ();
KDE_NO_EXPORT int width () const { return m_width; }
KDE_NO_EXPORT int height () const { return m_height; }
virtual void dimensions (int & w, int & h) { w = m_width; h = m_height; }
/* length () returns length in deci-seconds */
KDE_NO_EXPORT int length () const { return m_length; }
/* position () returns position in deci-seconds */
KDE_NO_EXPORT int position () const { return m_position; }
KDE_NO_EXPORT float aspect () const { return m_aspect; }
KDE_NO_EXPORT const KURL & url () const { return m_url; }
KDE_NO_EXPORT const KURL & subUrl () const { return m_sub_url; }
PartBase * player () { return m_player; }
virtual void reset ();
QString currentMrl ();
KDE_NO_EXPORT const QString & audioDevice () const { return m_audiodevice; }
KDE_NO_EXPORT const QString & videoDevice () const { return m_videodevice; }
KDE_NO_EXPORT const QString & videoNorm () const { return m_videonorm; }
/* frequency() if set, returns frequency in kHz */
KDE_NO_EXPORT int frequency () const { return m_frequency; }
KDE_NO_EXPORT int xvPort () const { return m_xvport; }
KDE_NO_EXPORT int xvEncoding () const { return m_xvencoding; }
KDE_NO_EXPORT const QString & pipeCmd () const { return m_pipecmd; }
KDE_NO_EXPORT const QString & options () const { return m_options; }
KDE_NO_EXPORT const QString & recordCmd () const { return m_recordcmd; }
KDE_NO_EXPORT const QString & tuner () const { return m_tuner; }
KDE_NO_EXPORT NodePtr current () const { return m_current; }
QString plugin (const QString &mime) const;
virtual NodePtr document ();
virtual NodePtr root ();
virtual QString filterOptions ();
virtual void setURL (const KURL & url);
void insertURL (NodePtr mrl, const QString & url, const QString & title=QString());
KDE_NO_EXPORT void setSubURL (const KURL & url) { m_sub_url = url; }
void setLanguages (const QStringList & alang, const QStringList & slang);
KDE_NO_EXPORT void setWidth (int w) { m_width = w; }
KDE_NO_EXPORT void setHeight (int h) { m_height = h; }
virtual void setDimensions (NodePtr, int w, int h);
virtual void setAspect (NodePtr, float a);
/* setLength (len) set length in deci-seconds */
void setLength (NodePtr, int len);
/* setPosition (pos) set position in deci-seconds */
void setPosition (int pos);
virtual void setIdentified (bool b = true);
// backend process state changed
virtual void stateChange (Process *, Process::State os, Process::State ns);
KDE_NO_EXPORT void setAutoPlay (bool b) { m_auto_play = b; }
KDE_NO_EXPORT bool autoPlay () const { return m_auto_play; }
void setTitle (const QString & title);
void setLoading (int percentage);
bool setCurrent (NodePtr mrl);
virtual QString prettyName ();
signals:
void startPlaying ();
void stopPlaying ();
void startRecording ();
void stopRecording ();
/**
* Signal for notifying this source is at the end of play items
*/
void endOfPlayItems ();
void dimensionsChanged ();
void titleChanged (const QString & title);
public slots:
virtual void activate () = 0;
virtual void deactivate () = 0;
virtual void forward ();
virtual void backward ();
virtual void play ();
/**
* Continuing playing where current is now
* May call play process if a video needs to play or
* emit endOfPlayItems when done
*/
virtual void playCurrent ();
virtual void jump (NodePtr e);
void setAudioLang (int);
void setSubtitle (int);
protected:
void timerEvent (QTimerEvent *);
/**
* PlayListNotify implementation
*/
bool requestPlayURL (NodePtr mrl);
bool resolveURL (NodePtr mrl);
void stateElementChanged (Node * element, Node::State os, Node::State ns);
SurfacePtr getSurface (NodePtr node);
void setInfoMessage (const QString & msg);
void bitRates (int & preferred, int & maximal);
void setTimeout (int ms);
NodePtr m_document;
NodePtrW m_current;
NodePtrW m_back_request;
QString m_name;
PartBase * m_player;
QString m_recordcmd;
bool m_identified;
bool m_auto_play;
KURL m_url;
KURL m_sub_url;
QString m_audiodevice;
QString m_videodevice;
QString m_videonorm;
QString m_tuner;
int m_frequency;
int m_xvport;
int m_xvencoding;
QString m_pipecmd;
QString m_options;
QString m_plugin;
private:
int m_width;
int m_height;
float m_aspect;
int m_length;
int m_position;
int m_doc_timer;
};
} // namespace
#endif

@ -0,0 +1,737 @@
/* This file is part of the KMPlayer application
Copyright (C) 2003 Koos Vriezen <koos.vriezen@xs4all.nl>
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 2 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; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include <qlayout.h>
#include <qlabel.h>
#include <qtimer.h>
#include <qpushbutton.h>
#include <qcheckbox.h>
#include <qtable.h>
#include <qstringlist.h>
#include <qcombobox.h>
#include <qlineedit.h>
#include <qgroupbox.h>
#include <qwhatsthis.h>
#include <qtabwidget.h>
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <qfontmetrics.h>
#include <klocale.h>
#include <kdebug.h>
#include <kmessagebox.h>
#include <klineedit.h>
#include <kurlrequester.h>
#include <kcombobox.h>
#include <kconfig.h>
#include <kstandarddirs.h>
#include "kmplayerpartbase.h"
#include "kmplayerprocess.h"
#include "kmplayerconfig.h"
#include "kmplayertvsource.h"
#include "playlistview.h"
#include "kmplayer.h"
#include "kmplayercontrolpanel.h"
#include "kmplayerbroadcast.h"
static const char * strTV = "TV";
static const char * strTVDriver = "Driver";
KDE_NO_CDTOR_EXPORT TVDevicePage::TVDevicePage (QWidget *parent, KMPlayer::NodePtr dev)
: QFrame (parent, "PageTVDevice"), device_doc (dev) {
TVDevice * device = KMPlayer::convertNode <TVDevice> (device_doc);
QVBoxLayout *layout = new QVBoxLayout (this, 5, 2);
QLabel * deviceLabel = new QLabel (i18n ("Video device:") + device->src, this, 0);
layout->addWidget (deviceLabel);
QGridLayout *gridlayout = new QGridLayout (layout, 3, 4);
QLabel * audioLabel = new QLabel (i18n ("Audio device:"), this);
audiodevice = new KURLRequester (device->getAttribute ("audio"), this);
QLabel * nameLabel = new QLabel (i18n ("Name:"), this, 0);
name = new QLineEdit (device->pretty_name, this, 0);
QLabel *sizewidthLabel = new QLabel (i18n ("Width:"), this, 0);
sizewidth = new QLineEdit (device->getAttribute (KMPlayer::StringPool::attr_width), this, 0);
QLabel *sizeheightLabel = new QLabel (i18n ("Height:"), this, 0);
sizeheight = new QLineEdit (device->getAttribute (KMPlayer::StringPool::attr_height), this, 0);
noplayback = new QCheckBox (i18n ("Do not immediately play"), this);
noplayback->setChecked (!device->getAttribute ("playback").toInt ());
QWhatsThis::add (noplayback, i18n ("Only start playing after clicking the play button"));
inputsTab = new QTabWidget (this);
for (KMPlayer::NodePtr ip = device->firstChild (); ip; ip = ip->nextSibling ()) {
if (ip->id != id_node_tv_input)
continue;
TVInput * input = KMPlayer::convertNode <TVInput> (ip);
QWidget * widget = new QWidget (this);
QHBoxLayout *tablayout = new QHBoxLayout (widget, 5, 2);
if (!input->getAttribute ("tuner").isEmpty ()) {
QHBoxLayout *horzlayout = new QHBoxLayout ();
QVBoxLayout *vertlayout = new QVBoxLayout ();
horzlayout->addWidget (new QLabel (i18n ("Norm:"), widget));
QComboBox * norms = new QComboBox (widget, "PageTVNorm");
norms->insertItem (QString ("NTSC"), 0);
norms->insertItem (QString ("PAL"), 1);
norms->insertItem (QString ("SECAM"), 2);
norms->setCurrentText (input->getAttribute ("norm"));
horzlayout->addWidget (norms);
vertlayout->addLayout (horzlayout);
vertlayout->addItem (new QSpacerItem (0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
QTable * table = new QTable (90, 2, widget, "PageTVChannels");
QFontMetrics metrics (table->font ());
QHeader *header = table->horizontalHeader();
header->setLabel (0, i18n ("Channel"));
header->setLabel (1, i18n ("Frequency (MHz)"));
int index = 0;
int first_column_width = QFontMetrics (header->font ()).boundingRect (header->label (0)).width () + 20;
for (KMPlayer::NodePtr c=input->firstChild();c;c=c->nextSibling()) {
if (c->id != id_node_tv_channel)
continue;
int strwid = metrics.boundingRect (c->mrl ()->pretty_name).width ();
if (strwid > first_column_width)
first_column_width = strwid + 4;
table->setItem (index, 0, new QTableItem (table, QTableItem::Always, c->mrl ()->pretty_name));
table->setItem (index++, 1, new QTableItem (table, QTableItem::Always, KMPlayer::convertNode<TVChannel>(c)->getAttribute ("frequency")));
}
table->setColumnWidth (0, first_column_width);
table->setColumnStretchable (1, true);
tablayout->addWidget (table);
tablayout->addLayout (vertlayout);
}
inputsTab->addTab (widget, input->mrl ()->pretty_name);
}
QPushButton * delButton = new QPushButton (i18n ("Delete"), this);
connect (delButton, SIGNAL (clicked ()), this, SLOT (slotDelete ()));
gridlayout->addWidget (audioLabel, 0, 0);
gridlayout->addMultiCellWidget (audiodevice, 0, 0, 1, 3);
gridlayout->addWidget (nameLabel, 1, 0);
gridlayout->addMultiCellWidget (name, 1, 1, 1, 3);
gridlayout->addWidget (sizewidthLabel, 2, 0);
gridlayout->addWidget (sizewidth, 2, 1);
gridlayout->addWidget (sizeheightLabel, 2, 2);
gridlayout->addWidget (sizeheight, 2, 3);
layout->addWidget (inputsTab);
layout->addSpacing (5);
layout->addItem (new QSpacerItem (0, 0, QSizePolicy::Minimum, QSizePolicy::Minimum));
QHBoxLayout *buttonlayout = new QHBoxLayout ();
buttonlayout->addWidget (noplayback);
buttonlayout->addItem (new QSpacerItem (0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum));
buttonlayout->addWidget (delButton);
layout->addLayout (buttonlayout);
}
KDE_NO_EXPORT void TVDevicePage::slotDelete () {
if (KMessageBox::warningYesNo (this, i18n ("You are about to remove this device from the Source menu.\nContinue?"), i18n ("Confirm")) == KMessageBox::Yes)
emit deleted (this);
}
//-----------------------------------------------------------------------------
KDE_NO_CDTOR_EXPORT KMPlayerPrefSourcePageTV::KMPlayerPrefSourcePageTV (QWidget *parent, KMPlayerTVSource * tvsource)
: QFrame (parent), m_tvsource (tvsource) {
QVBoxLayout * mainlayout = new QVBoxLayout (this, 5);
notebook = new QTabWidget (this);
notebook->setTabPosition (QTabWidget::Bottom);
mainlayout->addWidget (notebook);
QWidget * general = new QWidget (notebook);
QVBoxLayout *layout = new QVBoxLayout (general);
QGridLayout *gridlayout = new QGridLayout (layout, 2, 2, 2);
QLabel *driverLabel = new QLabel (i18n ("Driver:"), general, 0);
driver = new QLineEdit ("", general, 0);
QWhatsThis::add (driver, i18n ("dummy, v4l or bsdbt848"));
QLabel *deviceLabel = new QLabel (i18n ("Device:"), general, 0);
device = new KURLRequester ("/dev/video", general);
QWhatsThis::add(device, i18n("Path to your video device, eg. /dev/video0"));
scan = new QPushButton (i18n ("Scan..."), general);
gridlayout->addWidget (driverLabel, 0, 0);
gridlayout->addWidget (driver, 0, 1);
gridlayout->addWidget (deviceLabel, 1, 0);
gridlayout->addWidget (device, 1, 1);
QHBoxLayout *buttonlayout = new QHBoxLayout ();
buttonlayout->addItem (new QSpacerItem (0, 0, QSizePolicy::Minimum, QSizePolicy::Minimum));
buttonlayout->addWidget (scan);
layout->addLayout (buttonlayout);
layout->addItem (new QSpacerItem (0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
notebook->insertTab (general, i18n ("General"));
}
KDE_NO_EXPORT void KMPlayerPrefSourcePageTV::showEvent (QShowEvent *) {
m_tvsource->readXML ();
}
//-----------------------------------------------------------------------------
KDE_NO_CDTOR_EXPORT TVNode::TVNode (KMPlayer::NodePtr &d, const QString & s, const char * t, short id, const QString & n) : KMPlayer::GenericMrl (d, s, n, t) {
this->id = id;
editable = true;
}
KDE_NO_EXPORT void TVNode::setNodeName (const QString & nn) {
pretty_name = nn;
setAttribute (KMPlayer::StringPool::attr_name, nn);
}
//-----------------------------------------------------------------------------
KDE_NO_CDTOR_EXPORT TVChannel::TVChannel (KMPlayer::NodePtr & d, const QString & n, double freq) : TVNode (d, QString ("tv://"), "channel", id_node_tv_channel, n) {
setAttribute (KMPlayer::StringPool::attr_name, n);
setAttribute ("frequency", QString::number (freq, 'f', 2));
}
KDE_NO_CDTOR_EXPORT TVChannel::TVChannel (KMPlayer::NodePtr & d) : TVNode (d, QString ("tv://"), "channel", id_node_tv_channel) {
}
KDE_NO_EXPORT void TVChannel::closed () {
pretty_name = getAttribute (KMPlayer::StringPool::attr_name);
}
//-----------------------------------------------------------------------------
TVInput::TVInput (KMPlayer::NodePtr & d, const QString & n, int id)
: TVNode (d, QString ("tv://"), "input", id_node_tv_input, n) {
setAttribute (KMPlayer::StringPool::attr_name, n);
setAttribute (KMPlayer::StringPool::attr_id, QString::number (id));
}
KDE_NO_CDTOR_EXPORT TVInput::TVInput (KMPlayer::NodePtr & d) : TVNode (d, QString ("tv://"), "input", id_node_tv_input) {
}
KDE_NO_EXPORT KMPlayer::NodePtr TVInput::childFromTag (const QString & tag) {
// kdDebug () << nodeName () << " childFromTag " << tag << endl;
if (tag == QString::fromLatin1 ("channel")) {
return new TVChannel (m_doc);
} else
return 0L;
}
KDE_NO_EXPORT void TVInput::closed () {
//pretty_name = getAttribute (KMPlayer::StringPool::attr_name);
}
KDE_NO_EXPORT void TVInput::setNodeName (const QString & name) {
Node * p = parentNode ().ptr ();
QString nm (name);
if (p && p->id == id_node_tv_device) {
int pos = name.find (QString (" - ") + p->mrl ()->pretty_name);
if (pos > -1)
nm.truncate (pos);
}
pretty_name = nm + QString (" - ") + pretty_name;
TVNode::setNodeName (nm);
}
//-----------------------------------------------------------------------------
KDE_NO_CDTOR_EXPORT TVDevice::TVDevice (KMPlayer::NodePtr & doc, const QString & d) : TVNode (doc, d, "device", id_node_tv_device), zombie (false) {
setAttribute ("path", d);
}
KDE_NO_CDTOR_EXPORT TVDevice::TVDevice (KMPlayer::NodePtr & doc)
: TVNode (doc, i18n ("tv device"), "device", id_node_tv_device), zombie (false) {
}
KDE_NO_CDTOR_EXPORT TVDevice::~TVDevice () {
if (device_page)
device_page->deleteLater ();
}
KDE_NO_EXPORT KMPlayer::NodePtr TVDevice::childFromTag (const QString & tag) {
// kdDebug () << nodeName () << " childFromTag " << tag << endl;
if (tag == QString::fromLatin1 ("input"))
return new TVInput (m_doc);
return 0L;
}
KDE_NO_EXPORT void TVDevice::closed () {
updateNodeName ();
}
KDE_NO_EXPORT void TVDevice::childDone (KMPlayer::NodePtr) {
finish ();
}
KDE_NO_EXPORT void TVDevice::setNodeName (const QString & name) {
TVNode::setNodeName (name);
updateNodeName ();
}
KDE_NO_EXPORT void TVDevice::updateNodeName () {
pretty_name = getAttribute (KMPlayer::StringPool::attr_name);
src = getAttribute ("path");
for (KMPlayer::NodePtr c = firstChild (); c; c = c->nextSibling ())
if (c->id == id_node_tv_input) {
TVInput * i = static_cast <TVInput *> (c.ptr ());
i->pretty_name = i->getAttribute (KMPlayer::StringPool::attr_name) +
QString (" - ") + pretty_name;
}
}
KDE_NO_EXPORT void TVDevice::updateDevicePage () {
if (!device_page)
return;
pretty_name = device_page->name->text ();
setAttribute (KMPlayer::StringPool::attr_name, pretty_name);
setAttribute ("audio", device_page->audiodevice->lineEdit()->text ());
setAttribute ("playback", device_page->noplayback->isChecked() ? "0" : "1");
setAttribute (KMPlayer::StringPool::attr_width, device_page->sizewidth->text ());
setAttribute (KMPlayer::StringPool::attr_height, device_page->sizeheight->text ());
int i = 0;
for (KMPlayer::NodePtr ip = firstChild(); ip; ip=ip->nextSibling(),++i) {
if (ip->id != id_node_tv_input)
continue;
TVInput * input = KMPlayer::convertNode <TVInput> (ip);
bool ok;
if (input->getAttribute ("tuner").toInt (&ok) && ok) {
QWidget * widget = device_page->inputsTab->page (i);
QTable * table = static_cast <QTable *> (widget->child ("PageTVChannels", "QTable"));
if (table) {
input->clearChildren ();
for (int j = 0; j<table->numRows() && table->item (j, 1); ++j) {
input->appendChild (new TVChannel (m_doc, table->item (j, 0)->text (), table->item (j, 1)->text ().toDouble ()));
}
}
QComboBox * norms = static_cast <QComboBox *> (widget->child ("PageTVNorm", "QComboBox"));
if (norms) {
input->setAttribute ("norm", norms->currentText ());
}
}
}
}
//-----------------------------------------------------------------------------
KDE_NO_CDTOR_EXPORT
TVDocument::TVDocument (KMPlayerTVSource * source)
: FileDocument (id_node_tv_document, "tv://", source), m_source (source) {
pretty_name = i18n ("Television");
}
KDE_NO_EXPORT KMPlayer::NodePtr TVDocument::childFromTag (const QString & tag) {
// kdDebug () << nodeName () << " childFromTag " << tag << endl;
if (tag == QString::fromLatin1 ("device"))
return new TVDevice (m_doc);
return FileDocument::childFromTag (tag);
}
KDE_NO_EXPORT void TVDocument::childDone (KMPlayer::NodePtr) {
finish ();
}
KDE_NO_EXPORT void TVDocument::defer () {
if (!resolved) {
resolved = true;
readFromFile (locateLocal ("data", "kmplayer/tv.xml"));
}
}
//-----------------------------------------------------------------------------
KDE_NO_CDTOR_EXPORT KMPlayerTVSource::KMPlayerTVSource (KMPlayerApp * a, QPopupMenu * m)
: KMPlayerMenuSource (i18n ("TV"), a, m, "tvsource"), m_configpage (0L), scanner (0L), config_read (false) {
m_url = "tv://";
m_menu->insertTearOffHandle ();
connect (m_menu, SIGNAL (aboutToShow ()), this, SLOT (menuAboutToShow ()));
m_document = new TVDocument (this);
m_player->settings ()->addPage (this);
tree_id = static_cast <KMPlayer::View*>(m_player->view ())->playList ()->addTree (m_document, "tvsource", "tv", KMPlayer::PlayListView::TreeEdit | KMPlayer::PlayListView::Moveable | KMPlayer::PlayListView::Deleteable);
}
KDE_NO_CDTOR_EXPORT KMPlayerTVSource::~KMPlayerTVSource () {
}
KDE_NO_EXPORT void KMPlayerTVSource::activate () {
m_identified = true;
if (m_player->settings ()->showbroadcastbutton)
m_app->view()->controlPanel()->broadcastButton ()->show ();
if (m_cur_tvdevice && !m_current) {
for (KMPlayer::NodePtr i = m_cur_tvdevice->firstChild(); i && !m_current; i=i->nextSibling())
if (i->id == id_node_tv_input) {
TVInput * input = KMPlayer::convertNode <TVInput> (i);
bool ok;
m_cur_tvinput = i;
if (input->getAttribute ("tuner").toInt (&ok) && ok) {
for (KMPlayer::NodePtr c = i->firstChild (); c; c = c->nextSibling ())
if (c->id == id_node_tv_channel) {
m_current = c;
break;
}
} else
m_current = i;
}
} else if (!m_cur_tvdevice)
KMPlayer::Source::reset ();
buildArguments ();
if (m_cur_tvdevice) {
QString playback = static_cast <KMPlayer::Element *> (m_cur_tvdevice.ptr ())->getAttribute (QString::fromLatin1 ("playback"));
if (playback.isEmpty () || playback.toInt ())
QTimer::singleShot (0, m_player, SLOT (play ()));
}
}
/* TODO: playback by
* ffmpeg -vd /dev/video0 -r 25 -s 768x576 -f rawvideo - |mplayer -nocache -ao arts -rawvideo on:w=768:h=576:fps=25 -quiet -
*/
KDE_NO_EXPORT void KMPlayerTVSource::deactivate () {
if (m_player->view () && !m_app->view ()->controlPanel()->broadcastButton ()->isOn ())
m_app->view ()->controlPanel()->broadcastButton ()->hide ();
reset ();
}
KDE_NO_EXPORT void KMPlayerTVSource::buildMenu () {
m_menu->clear ();
int counter = 0;
for (KMPlayer::NodePtr dp = m_document->firstChild (); dp; dp = dp->nextSibling ())
if (dp->id == id_node_tv_device)
m_menu->insertItem (KMPlayer::convertNode <TVDevice> (dp)->pretty_name, this, SLOT (menuClicked (int)), 0, counter++);
}
KDE_NO_EXPORT void KMPlayerTVSource::menuAboutToShow () {
readXML ();
}
void KMPlayerTVSource::jump (KMPlayer::NodePtr e) {
if (e->id == id_node_tv_document) {
readXML ();
} else {
m_current = e;
for (; e; e = e->parentNode ()) {
if (e->id == id_node_tv_device) {
m_cur_tvdevice = e;
break;
} else if (e->id == id_node_tv_input)
m_cur_tvinput = e;
}
if (m_player->source () != this)
m_player->setSource (this);
else if (m_player->process ()->playing ()) {
m_back_request = m_current;
m_player->process ()->stop ();
} else
playCurrent ();
}
}
KDE_NO_EXPORT KMPlayer::NodePtr KMPlayerTVSource::root () {
return m_cur_tvinput;
}
KDE_NO_EXPORT void KMPlayerTVSource::buildArguments () {
TVChannel * channel = 0L;
TVInput * input = 0L;
KMPlayer::NodePtr elm = m_current;
if (elm && elm->id == id_node_tv_channel) {
channel = KMPlayer::convertNode <TVChannel> (elm);
elm = elm->parentNode ();
}
if (elm && elm->id == id_node_tv_input)
input = KMPlayer::convertNode <TVInput> (elm);
if (!(channel || (input && input->getAttribute ("tuner").isEmpty ())))
return;
m_cur_tvinput = input;
m_cur_tvdevice = input->parentNode ();
static_cast <KMPlayer::View*>(m_player->view ())->playList ()->updateTree (0, m_cur_tvinput, m_current, true, false);
if (m_cur_tvdevice->id != id_node_tv_device) {
return;
}
TVDevice * tvdevice = KMPlayer::convertNode <TVDevice> (m_cur_tvdevice);
m_identified = true;
m_audiodevice = tvdevice->getAttribute ("audio");
m_videodevice = tvdevice->src;
m_videonorm = input->getAttribute ("norm");
m_tuner = input->getAttribute (KMPlayer::StringPool::attr_name);
QString xvport = tvdevice->getAttribute ("xvport");
if (!xvport.isEmpty ())
m_xvport = xvport.toInt ();
QString xvenc = input->getAttribute ("xvenc");
if (!xvenc.isEmpty ())
m_xvencoding = xvenc.toInt ();
QString command;
command.sprintf ("device=%s:input=%s",
tvdevice->src.ascii (),
input->getAttribute (KMPlayer::StringPool::attr_id).ascii ());
if (channel) {
QString freq = channel->getAttribute ("frequency");
m_frequency = (int)(1000 * freq.toDouble ());
command += QString (":freq=%1").arg (freq);
} else
m_frequency = 0;
if (!m_videonorm.isEmpty ())
command += QString (":norm=%1").arg (m_videonorm);
m_app->setCaption (i18n ("TV: ") + (channel ? channel->mrl ()->pretty_name : input->mrl ()->pretty_name), false);
setDimensions (m_cur_tvdevice,
tvdevice->getAttribute (KMPlayer::StringPool::attr_width).toInt (),
tvdevice->getAttribute (KMPlayer::StringPool::attr_height).toInt ());
m_options.sprintf ("-tv noaudio:driver=%s:%s:width=%d:height=%d -slave -nocache -quiet", tvdriver.ascii (), command.ascii (), width (), height ());
if (m_player->settings ()->mplayerpost090)
m_recordcmd.sprintf ("-tv %s:driver=%s:%s:width=%d:height=%d", m_audiodevice.isEmpty () ? "noaudio" : (QString ("forceaudio:adevice=") + m_audiodevice).ascii(), tvdriver.ascii (), command.ascii (), width (), height ());
else
m_recordcmd.sprintf ("-tv on:%s:driver=%s:%s:width=%d:height=%d", m_audiodevice.isEmpty () ? "noaudio" : (QString ("forceaudio:adevice=") + m_audiodevice).ascii(), tvdriver.ascii (), command.ascii (), width (), height ());
}
KDE_NO_EXPORT void KMPlayerTVSource::playCurrent () {
buildArguments ();
if (m_app->broadcasting ())
QTimer::singleShot (0, m_app->broadcastConfig (), SLOT (startFeed ()));
else
KMPlayer::Source::playCurrent ();
}
KDE_NO_EXPORT void KMPlayerTVSource::menuClicked (int id) {
KMPlayer::NodePtr elm = m_document->firstChild ();
for (; id > 0; --id, elm = elm->nextSibling ())
;
m_cur_tvdevice = elm;
m_cur_tvinput = elm->firstChild (); // FIXME
m_current = 0L;
m_player->setSource (this);
}
KDE_NO_EXPORT QString KMPlayerTVSource::filterOptions () {
if (! m_player->settings ()->disableppauto)
return KMPlayer::Source::filterOptions ();
return QString ("-vf pp=lb");
}
KDE_NO_EXPORT bool KMPlayerTVSource::hasLength () {
return false;
}
KDE_NO_EXPORT bool KMPlayerTVSource::isSeekable () {
return true;
}
KDE_NO_EXPORT QString KMPlayerTVSource::prettyName () {
QString name (i18n ("TV"));
//if (m_tvsource)
// name += ' ' + m_tvsource->title;
return name;
}
KDE_NO_EXPORT void KMPlayerTVSource::write (KConfig * m_config) {
if (!config_read) return;
m_config->setGroup (strTV);
m_config->writeEntry (strTVDriver, tvdriver);
static_cast <TVDocument *> (m_document.ptr ())->writeToFile
(locateLocal ("data", "kmplayer/tv.xml"));
kdDebug () << "KMPlayerTVSource::write XML" << endl;
}
KDE_NO_EXPORT void KMPlayerTVSource::readXML () {
if (config_read) return;
config_read = true;
kdDebug () << "KMPlayerTVSource::readXML" << endl;
m_document->defer ();
static_cast <KMPlayer::View*>(m_player->view ())->playList ()->updateTree (tree_id, m_document, 0, false, false);
buildMenu ();
sync (false);
}
KDE_NO_EXPORT void KMPlayerTVSource::read (KConfig * m_config) {
m_config->setGroup (strTV);
tvdriver = m_config->readEntry (strTVDriver, "v4l");
}
KDE_NO_EXPORT void KMPlayerTVSource::sync (bool fromUI) {
if (!m_configpage) return;
if (m_document && m_document->hasChildNodes ())
m_app->showBroadcastConfig ();
else
m_app->hideBroadcastConfig ();
if (fromUI) {
tvdriver = m_configpage->driver->text ();
for (KMPlayer::NodePtr d=m_document->firstChild();d; d=d->nextSibling())
if (d->id == id_node_tv_device)
static_cast <TVDevice *> (d.ptr ())->updateDevicePage ();
} else {
m_configpage->driver->setText (tvdriver);
for (KMPlayer::NodePtr dp = m_document->firstChild (); dp; dp = dp->nextSibling ())
if (dp->id == id_node_tv_device)
addTVDevicePage (KMPlayer::convertNode <TVDevice> (dp));
}
}
KDE_NO_EXPORT void KMPlayerTVSource::prefLocation (QString & item, QString & icon, QString & tab) {
item = i18n ("Source");
icon = QString ("source");
tab = i18n ("TV");
}
KDE_NO_EXPORT QFrame * KMPlayerTVSource::prefPage (QWidget * parent) {
if (!m_configpage) {
m_configpage = new KMPlayerPrefSourcePageTV (parent, this);
scanner = new TVDeviceScannerSource (this);
connect (m_configpage->scan, SIGNAL(clicked()), this, SLOT(slotScan()));
}
return m_configpage;
}
static bool hasTVDevice (KMPlayer::NodePtr doc, const QString & devstr) {
for (KMPlayer::NodePtr e = doc->firstChild (); e; e = e->nextSibling ())
if (e->id == id_node_tv_device &&
KMPlayer::convertNode <TVDevice> (e)->src == devstr)
return true;
return false;
}
KDE_NO_EXPORT void KMPlayerTVSource::slotScan () {
QString devstr = m_configpage->device->lineEdit()->text ();
if (!hasTVDevice(m_document, devstr)) {
scanner->scan (devstr, m_configpage->driver->text());
connect (scanner, SIGNAL (scanFinished (TVDevice *)),
this, SLOT (slotScanFinished (TVDevice *)));
} else
KMessageBox::error (m_configpage, i18n ("Device already present."),
i18n ("Error"));
}
KDE_NO_EXPORT void KMPlayerTVSource::slotScanFinished (TVDevice * tvdevice) {
disconnect (scanner, SIGNAL (scanFinished (TVDevice *)),
this, SLOT (slotScanFinished (TVDevice *)));
if (tvdevice) {
tvdevice->zombie = false;
addTVDevicePage (tvdevice, true);
} else
KMessageBox::error(m_configpage,i18n("No device found."),i18n("Error"));
}
KDE_NO_EXPORT void KMPlayerTVSource::addTVDevicePage(TVDevice *dev, bool show) {
if (dev->device_page)
dev->device_page->deleteLater ();
dev->device_page = new TVDevicePage (m_configpage->notebook, dev);
m_configpage->notebook->insertTab (dev->device_page, dev->pretty_name);
connect (dev->device_page, SIGNAL (deleted (TVDevicePage *)),
this, SLOT (slotDeviceDeleted (TVDevicePage *)));
if (show)
m_configpage->notebook->setCurrentPage (m_configpage->notebook->count ()-1);
}
KDE_NO_EXPORT void KMPlayerTVSource::slotDeviceDeleted (TVDevicePage *devpage) {
m_document->removeChild (devpage->device_doc);
m_configpage->notebook->setCurrentPage (0);
}
//-----------------------------------------------------------------------------
KDE_NO_CDTOR_EXPORT TVDeviceScannerSource::TVDeviceScannerSource (KMPlayerTVSource * src)
: KMPlayer::Source (i18n ("TVScanner"), src->player (), "tvscanner"), m_tvsource (src), m_tvdevice (0L) {
}
KDE_NO_EXPORT void TVDeviceScannerSource::init () {
}
KDE_NO_EXPORT bool TVDeviceScannerSource::processOutput (const QString & line) {
if (m_nameRegExp.search (line) > -1) {
m_tvdevice->pretty_name = m_nameRegExp.cap (1);
m_tvdevice->setAttribute(KMPlayer::StringPool::attr_name,m_tvdevice->pretty_name);
kdDebug() << "Name " << m_tvdevice->pretty_name << endl;
} else if (m_sizesRegExp.search (line) > -1) {
m_tvdevice->setAttribute (KMPlayer::StringPool::attr_width,
m_sizesRegExp.cap(1));
m_tvdevice->setAttribute (KMPlayer::StringPool::attr_height,
m_sizesRegExp.cap(2));
m_tvdevice->setAttribute ("minwidth", m_sizesRegExp.cap (1));
m_tvdevice->setAttribute ("minheight", m_sizesRegExp.cap (2));
m_tvdevice->setAttribute ("maxwidth", m_sizesRegExp.cap (3));
m_tvdevice->setAttribute ("maxheight", m_sizesRegExp.cap (4));
} else if (m_inputRegExp.search (line) > -1) {
KMPlayer::NodePtr doc = m_tvsource->document ();
TVInput * input = new TVInput (doc, m_inputRegExp.cap (2).stripWhiteSpace (),
m_inputRegExp.cap (1).toInt ());
if (m_inputRegExp.cap (3).toInt () == 1)
input->setAttribute ("tuner", "1");
m_tvdevice->appendChild (input);
kdDebug() << "Input " << input->mrl ()->pretty_name << endl;
} else
return false;
return true;
}
KDE_NO_EXPORT QString TVDeviceScannerSource::filterOptions () {
return QString ("");
}
KDE_NO_EXPORT bool TVDeviceScannerSource::hasLength () {
return false;
}
KDE_NO_EXPORT bool TVDeviceScannerSource::isSeekable () {
return false;
}
KDE_NO_EXPORT bool TVDeviceScannerSource::scan (const QString & dev, const QString & dri) {
if (m_tvdevice)
return false;
setURL (KURL ("tv://"));
KMPlayer::NodePtr doc = m_tvsource->document ();
m_tvdevice = new TVDevice (doc, dev);
m_tvsource->document ()->appendChild (m_tvdevice);
m_tvdevice->zombie = true; // not for real yet
m_driver = dri;
m_old_source = m_tvsource->player ()->source ();
m_tvsource->player ()->setSource (this);
m_identified = true;
play ();
return true;
}
KDE_NO_EXPORT void TVDeviceScannerSource::activate () {
m_nameRegExp.setPattern ("Selected device:\\s*([^\\s].*)");
m_sizesRegExp.setPattern ("Supported sizes:\\s*([0-9]+)x([0-9]+) => ([0-9]+)x([0-9]+)");
m_inputRegExp.setPattern ("\\s*([0-9]+):\\s*([^:]+):[^\\(]*\\(tuner:([01]),\\s*norm:([^\\)]+)\\)");
}
KDE_NO_EXPORT void TVDeviceScannerSource::deactivate () {
kdDebug () << "TVDeviceScannerSource::deactivate" << endl;
if (m_tvdevice) {
if (m_tvdevice->parentNode ())
m_tvdevice->parentNode ()->removeChild (m_tvdevice);
m_tvdevice = 0L;
emit scanFinished (m_tvdevice);
}
}
KDE_NO_EXPORT void TVDeviceScannerSource::play () {
if (!m_tvdevice)
return;
QString args;
args.sprintf ("tv:// -tv driver=%s:device=%s -identify -frames 0", m_driver.ascii (), m_tvdevice->src.ascii ());
m_tvsource->player ()->stop ();
m_tvsource->player ()->process ()->initProcess (m_player->settings ()->defaultView ()->viewer ());
KMPlayer::Process *proc = m_tvsource->player ()->players () ["mplayer"];
proc->setSource (this);
if (!static_cast <KMPlayer::MPlayer *> (proc)->run (args.ascii()))
deactivate ();
}
KDE_NO_EXPORT void TVDeviceScannerSource::stateChange (KMPlayer::Process * p, KMPlayer::Process::State os, KMPlayer::Process::State ns) {
if (m_tvdevice && // can be deactivated
ns == KMPlayer::Process::Ready && os > KMPlayer::Process::Ready) {
TVDevice * dev = 0L;
kdDebug () << "scanning done " << m_tvdevice->hasChildNodes () << endl;
if (!m_tvdevice->hasChildNodes ())
m_tvsource->document ()->removeChild (m_tvdevice);
else
dev = m_tvdevice;
m_tvdevice = 0L;
m_player->setSource (m_old_source);
emit scanFinished (dev);
}
KMPlayer::Source::stateChange (p, os, ns);
}
#include "kmplayertvsource.moc"

@ -0,0 +1,218 @@
/* This file is part of the KMPlayer application
Copyright (C) 2003 Koos Vriezen <koos.vriezen@xs4all.nl>
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 2 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; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _KMPLAYER_TV_SOURCE_H_
#define _KMPLAYER_TV_SOURCE_H_
#include <qguardedptr.h>
#include <qstring.h>
#include <qframe.h>
#include "kmplayerappsource.h"
#include "kmplayerconfig.h"
#include "kmplayer.h"
const short id_node_tv_document = 40;
const short id_node_tv_device = 41;
const short id_node_tv_input = 42;
const short id_node_tv_channel = 43;
class KMPlayerPrefSourcePageTV; // source, TV
class TVDeviceScannerSource;
class KMPlayerTVSource;
class KURLRequester;
class KHistoryCombo;
class KMPlayerApp;
class QTabWidget;
class QGroupBox;
class QLineEdit;
class QCheckBox;
class KComboBox;
class KConfig;
class KMPLAYER_NO_EXPORT TVDevicePage : public QFrame {
Q_OBJECT
public:
TVDevicePage (QWidget *parent, KMPlayer::NodePtr dev);
KDE_NO_CDTOR_EXPORT ~TVDevicePage () {}
QLineEdit * name;
KURLRequester * audiodevice;
QLineEdit * sizewidth;
QLineEdit * sizeheight;
QCheckBox * noplayback;
QTabWidget * inputsTab;
KMPlayer::NodePtrW device_doc;
signals:
void deleted (TVDevicePage *);
private slots:
void slotDelete ();
};
class KMPLAYER_NO_EXPORT KMPlayerPrefSourcePageTV : public QFrame {
Q_OBJECT
public:
KMPlayerPrefSourcePageTV (QWidget *parent, KMPlayerTVSource *);
KDE_NO_CDTOR_EXPORT ~KMPlayerPrefSourcePageTV () {}
QLineEdit * driver;
KURLRequester * device;
QPushButton * scan;
QTabWidget * notebook;
protected:
void showEvent (QShowEvent *);
KMPlayerTVSource * m_tvsource;
};
class KMPLAYER_NO_EXPORT TVNode : public KMPlayer::GenericMrl {
public:
TVNode (KMPlayer::NodePtr &d, const QString &s, const char * t, short id, const QString &n=QString ());
virtual void setNodeName (const QString &);
};
/*
* Element for channels
*/
class KMPLAYER_NO_EXPORT TVChannel : public TVNode {
public:
TVChannel (KMPlayer::NodePtr & d, const QString & n, double f);
TVChannel (KMPlayer::NodePtr & d);
KDE_NO_CDTOR_EXPORT ~TVChannel () {}
void closed ();
};
/*
* Element for inputs
*/
class KMPLAYER_NO_EXPORT TVInput : public TVNode {
public:
TVInput (KMPlayer::NodePtr & d, const QString & n, int id);
TVInput (KMPlayer::NodePtr & d);
KDE_NO_CDTOR_EXPORT ~TVInput () {}
KMPlayer::NodePtr childFromTag (const QString &);
void setNodeName (const QString &);
void closed ();
};
/*
* Element for TV devices
*/
class KMPLAYER_NO_EXPORT TVDevice : public TVNode {
public:
TVDevice (KMPlayer::NodePtr & d, const QString & s);
TVDevice (KMPlayer::NodePtr & d);
~TVDevice ();
KMPlayer::NodePtr childFromTag (const QString &);
void closed ();
void childDone (KMPlayer::NodePtr child);
void setNodeName (const QString &);
bool expose () const { return false; }
void updateNodeName ();
void updateDevicePage ();
bool zombie;
QGuardedPtr <TVDevicePage> device_page;
};
class KMPLAYER_NO_EXPORT TVDocument : public FileDocument {
KMPlayerTVSource * m_source;
public:
TVDocument (KMPlayerTVSource *);
KMPlayer::NodePtr childFromTag (const QString &);
void defer ();
KDE_NO_EXPORT const char * nodeName () const { return "tvdevices"; }
void childDone (KMPlayer::NodePtr child);
};
/*
* Source form scanning TV devices
*/
class KMPLAYER_NO_EXPORT TVDeviceScannerSource : public KMPlayer::Source {
Q_OBJECT
public:
TVDeviceScannerSource (KMPlayerTVSource * src);
KDE_NO_CDTOR_EXPORT ~TVDeviceScannerSource () {};
virtual void init ();
virtual bool processOutput (const QString & line);
virtual QString filterOptions ();
virtual bool hasLength ();
virtual bool isSeekable ();
virtual bool scan (const QString & device, const QString & driver);
public slots:
virtual void activate ();
virtual void deactivate ();
virtual void play ();
virtual void stateChange (KMPlayer::Process *, KMPlayer::Process::State os, KMPlayer::Process::State ns);
signals:
void scanFinished (TVDevice * tvdevice);
private:
KMPlayerTVSource * m_tvsource;
TVDevice * m_tvdevice;
KMPlayer::Source * m_old_source;
QString m_driver;
QRegExp m_nameRegExp;
QRegExp m_sizesRegExp;
QRegExp m_inputRegExp;
};
/*
* Source form TV devices, also implementing preference page for it
*/
class KMPLAYER_NO_EXPORT KMPlayerTVSource : public KMPlayerMenuSource, public KMPlayer::PreferencesPage {
Q_OBJECT
public:
KMPlayerTVSource (KMPlayerApp * app, QPopupMenu * m);
virtual ~KMPlayerTVSource ();
virtual QString filterOptions ();
virtual bool hasLength ();
virtual bool isSeekable ();
virtual KMPlayer::NodePtr root ();
void buildMenu ();
virtual QString prettyName ();
virtual void write (KConfig *);
virtual void read (KConfig *);
virtual void sync (bool);
virtual void prefLocation (QString & item, QString & icon, QString & tab);
virtual QFrame * prefPage (QWidget * parent);
void readXML ();
public slots:
virtual void activate ();
virtual void deactivate ();
virtual void playCurrent ();
virtual void jump (KMPlayer::NodePtr e);
void menuAboutToShow ();
void menuClicked (int id);
private slots:
void slotScan ();
void slotScanFinished (TVDevice * device);
void slotDeviceDeleted (TVDevicePage *);
private:
void addTVDevicePage (TVDevice * dev, bool show=false);
void buildArguments ();
KMPlayer::NodePtrW m_cur_tvdevice;
KMPlayer::NodePtrW m_cur_tvinput;
QPopupMenu * m_channelmenu;
QString tvdriver;
KMPlayerPrefSourcePageTV * m_configpage;
TVDeviceScannerSource * scanner;
int tree_id;
bool config_read; // whether tv.xml is read
};
#endif //_KMPLAYER_TV_SOURCE_H_

@ -0,0 +1,300 @@
/*
* Copyright (C) 2006 Koos Vriezen <koos.vriezen@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _KMPLAYER_TYPES_H_
#define _KMPLAYER_TYPES_H_
#include <stdint.h>
#include "kmplayer_def.h"
#include "triestring.h"
namespace KMPlayer {
/**
* Type meant for screen coordinates
*/
class KMPLAYER_NO_EXPORT Single {
int value;
friend Single operator + (const Single s1, const Single s2);
friend Single operator - (const Single s1, const Single s2);
friend Single operator * (const Single s1, const Single s2);
friend Single operator / (const Single s1, const Single s2);
friend Single operator + (const Single s1, const int i);
friend Single operator - (const Single s1, const int i);
friend float operator * (const Single s, const float f);
friend double operator * (const Single s, const double f);
friend Single operator * (const int i, const Single s);
friend float operator * (const float f, const Single s);
friend double operator * (const double d, const Single s);
friend Single operator / (const Single s, const int i);
friend float operator / (const Single s, const float f);
friend double operator / (const Single s, const double d);
friend double operator / (const double d, const Single s);
friend bool operator > (const Single s1, const Single s2);
friend bool operator > (const Single s, const int i);
friend bool operator > (const int i, const Single s);
friend bool operator >= (const Single s1, const Single s2);
friend bool operator == (const Single s1, const Single s2);
friend bool operator != (const Single s1, const Single s2);
friend bool operator < (const Single s1, const Single s2);
friend bool operator < (const Single s, const int i);
friend bool operator < (const int i, const Single s);
friend bool operator <= (const Single s1, const Single s2);
friend bool operator <= (const Single s, const int i);
#ifdef _KDEBUG_H_
friend kdbgstream & operator << (kdbgstream &, Single s);
friend kndbgstream & operator << (kndbgstream &, Single s);
#endif
friend Single operator - (const Single s);
public:
Single () : value (0) {}
Single (const int v) : value (v << 8) {}
Single (const float v) : value (int (256 * v)) {}
Single (const double v) : value (int (256 * v)) {}
Single & operator = (const Single s) { value = s.value; return *this; }
Single & operator = (const int v) { value = v << 8; return *this; }
Single & operator = (const float v) { value = int (256 * v); return *this; }
Single & operator = (const double v) { value = int(256 * v); return *this; }
Single & operator += (const Single s) { value += s.value; return *this; }
Single & operator += (const int i) { value += (i << 8); return *this; }
Single & operator -= (const Single s) { value -= s.value; return *this; }
Single & operator -= (const int i) { value -= (i << 8); return *this; }
Single & operator *= (const Single s);
Single & operator *= (const float f) { value = int(value*f); return *this; }
Single & operator /= (const int i) { value /= i; return *this; }
Single & operator /= (const float f);
operator int () const { return value >> 8; }
operator double () const { return 1.0 * value / 256; }
};
/** a b 0
* Matrix for coordinate transforms c d 0
* tx ty 1 */
class KMPLAYER_NO_EXPORT Matrix {
friend class SizeEvent;
float a, b, c, d;
Single tx, ty;
public:
Matrix ();
Matrix (const Matrix & matrix);
Matrix (Single xoff, Single yoff, float xscale, float yscale);
void getXY (Single & x, Single & y) const;
void getXYWH (Single & x, Single & y, Single & w, Single & h) const;
void invXYWH (Single & x, Single & y, Single & w, Single & h) const;
void transform (const Matrix & matrix);
void scale (float sx, float sy);
void translate (Single x, Single y);
// void rotate (float phi); // add this when needed
};
class KMPLAYER_NO_EXPORT SRect {
Single _x, _y, _w, _h;
#ifdef _KDEBUG_H_
friend kdbgstream & operator << (kdbgstream &, const SRect &s);
friend kndbgstream & operator << (kndbgstream &, const SRect &s);
#endif
public:
SRect () {}
SRect (Single a, Single b, Single w, Single h)
: _x (a), _y (b), _w (w), _h (h) {}
Single x () const { return _x; }
Single y () const { return _y; }
Single width () const { return _w; }
Single height () const { return _h; }
SRect unite (const SRect & r) const;
SRect intersect (const SRect & r) const;
bool isValid () const { return _w >= Single (0) && _h >= Single (0); }
bool operator == (const SRect & r) const;
bool operator != (const SRect & r) const;
};
class KMPLAYER_NO_EXPORT IRect {
public:
int x, y, w, h;
IRect ()
: x (0), y (0), w (0), h (0) {}
explicit IRect (const SRect r)
: x (r.x ()), y (r.y ()), w (r.width ()), h (r.height ()) {}
IRect (int a, int b, int c, int d)
: x (a), y (b), w (c), h (d) {}
IRect unite (const IRect & r) const;
IRect intersect (const IRect & r) const;
bool isValid () const { return w >= 0 && h >= 0; }
bool isEmpty () const { return w < 0 || h < 0; }
};
//-----------------------------------------------------------------------------
#ifdef _KDEBUG_H_
inline kdbgstream & operator << (kdbgstream & dbg, Single s) {
dbg << (double) (s);
return dbg;
}
inline kndbgstream & operator << (kndbgstream & dbg, Single) { return dbg; }
inline kdbgstream & operator << (kdbgstream & dbg, const SRect &r) {
dbg << "SRect(x=" << r._x << " y=" << r._y << " w=" << r._w << " h=" << r._h << ")";
return dbg;
}
inline kndbgstream & operator << (kndbgstream &d, const SRect&) { return d; }
inline kdbgstream & operator << (kdbgstream & dbg, const IRect &r) {
dbg << "IRect(x=" << r.x << " y=" << r.y << " w=" << r.w << " h=" << r.h << ")";
return dbg;
}
inline kndbgstream & operator << (kndbgstream &d, const IRect&) { return d; }
#endif
inline Single & Single::operator *= (const Single s) {
value = (((int64_t)value) * s.value) >> 8;
return *this;
}
inline Single & Single::operator /= (const float f) {
value = (int) (value / f);
return *this;
}
inline Single operator + (const Single s1, const Single s2) {
Single s;
s.value = s1.value + s2.value;
return s;
}
inline Single operator - (const Single s1, const Single s2) {
Single s;
s.value = s1.value - s2.value;
return s;
}
inline Single operator * (const Single s1, const Single s2) {
Single s;
s.value = (((int64_t)s1.value) * s2.value) >> 8;
return s;
}
inline Single operator / (const Single s1, const Single s2) {
Single s;
s.value = ((int64_t)s1.value << 8) / s2.value;
return s;
}
inline Single operator + (const Single s, const int i) {
return s + Single (i);
}
inline Single operator - (const Single s, const int i) {
return s - Single (i);
}
inline Single operator * (const int i, const Single s) {
Single s1;
s1.value = s.value * i;
return s1;
}
inline Single operator * (const Single s, const int i) {
return i * s;
}
inline float operator * (const Single s, const float f) {
return s.value * f / 256;
}
inline double operator * (const Single s, const double d) {
return s.value * d / 256;
}
inline float operator * (const float f, const Single s) {
return s.value * f / 256;
}
inline double operator * (const double d, const Single s) {
return s.value * d / 256;
}
inline Single operator / (const Single s, const int i) {
Single s1;
s1.value = s.value / i;
return s1;
}
inline float operator / (const Single s, const float f) {
return (s.value / f ) / 256;
}
inline double operator / (const Single s, const double d) {
return (s.value / d ) / 256;
}
inline double operator / (const double d, const Single s) {
return (d * 256 / s.value);
}
inline bool
operator > (const Single s1, const Single s2) { return s1.value > s2.value; }
inline bool
operator > (const Single s, const int i) { return s > Single (i); }
inline bool
operator > (const int i, const Single s) { return Single (i) > s; }
inline bool
operator >= (const Single s1, const Single s2) { return s1.value >= s2.value; }
inline bool
operator == (const Single s1, const Single s2) { return s1.value == s2.value; }
inline bool
operator != (const Single s1, const Single s2) { return s1.value != s2.value; }
inline bool
operator < (const Single s1, const Single s2) { return s1.value < s2.value; }
inline bool
operator < (const Single s, const int i) { return s < Single (i); }
inline bool
operator < (const int i, const Single s) { return Single (i) < s; }
inline bool
operator <= (const Single s1, const Single s2) { return s1.value <= s2.value; }
inline bool
operator <= (const Single s, const int i) { return s <= Single (i); }
inline Single operator - (const Single s) {
Single s1;
s1.value = -s.value;
return s1;
}
//-----------------------------------------------------------------------------
inline bool SRect::operator == (const SRect & r) const {
return _x == r._x && _y == r._y && _w == r._w && _h == r._h;
}
inline bool SRect::operator != (const SRect & r) const { return !(*this == r); }
} // KMPlayer namespace
#endif //_KMPLAYER_TYPES_H_

@ -0,0 +1,99 @@
<!DOCTYPE kpartgui>
<kpartgui name="kmplayer" version="24">
<MenuBar>
<Menu name="file"><text>&amp;File</text>
<Action name="open"/>
<Action name="new_window"/>
<Action name="open_recent"/>
<Action name="save_as"/>
<Action name="clear_history"/>
<Separator/>
<Action name="source_pipe"/>
<Menu name="vdr"><text>VD&amp;R</text>
<Action name="vdr_connect"/>
<Action name="vdr_key_up"/>
<Action name="vdr_key_down"/>
<Action name="vdr_key_back"/>
<Action name="vdr_key_ok"/>
<Action name="vdr_key_setup"/>
<Action name="vdr_key_channels"/>
<Action name="vdr_key_menu"/>
<Action name="vdr_key_red"/>
<Action name="vdr_key_green"/>
<Action name="vdr_key_yellow"/>
<Action name="vdr_key_blue"/>
<Action name="vdr_key_custom"/>
</Menu>
</Menu>
<Menu name="view"><text>&amp;View</text>
<Action name="view_video"/>
<Action name="view_playlist"/>
<Action name="view_minimal"/>
<Action name="view_fullscreen"/>
<Menu name="zoom"><text>&amp;Zoom</text>
<Action name="view_zoom_50"/>
<Action name="view_zoom_100"/>
<Action name="view_zoom_150"/>
</Menu>
<Action name="view_keep_ratio"/>
<Separator />
<Action name="play"/>
<Action name="pause"/>
<Action name="stop"/>
<Separator />
<Action name="find"/>
<Action name="next"/>
<Separator />
<Action name="edit_mode"/>
<Action name="sync_edit_mode"/>
<Action name="edit_playlist_item"/>
<Separator />
<Action name="view_arts_control"/>
</Menu>
<Menu name="settings"><text>&amp;Settings</text>
<Separator />
<Action name="showmenu"/>
<Action name="showtoolbar"/>
<Action name="showstatusbar"/>
<Separator />
<Action name="configkeys"/>
<Action name="configtoolbars"/>
<Action name="configure"/>
</Menu>
</MenuBar>
<ActionProperties>
<Action name="new_window" icon="window_new"/>
<Action name="play" icon="player_play"/>
<Action name="pause" icon="player_pause"/>
<Action name="stop" icon="player_stop"/>
<Action shortcut="F" name="view_fullscreen" />
<Action shortcut="R" name="play" />
<Action shortcut="P" name="pause" />
<Action shortcut="S" name="stop" />
<Action shortcut="F2" name="edit_playlist_item"/>
<Action shortcut="C" name="view_arts_control" />
</ActionProperties>
<ToolBar name="mainToolBar"><text></text>
<Action name="new_window"/>
<Action name="open"/>
<Separator/>
<Action name="play"/>
<Action name="pause"/>
<Action name="stop"/>
<Separator/>
<Action name="view_fullscreen"/>
<Action name="view_zoom_100"/>
<Separator/>
<Action name="view_video"/>
<Action name="view_playlist"/>
<Action name="sync_edit_mode"/>
<Separator/>
<Action name="configure"/>
<Separator/>
<Action name="vdr_key_up"/>
<Action name="vdr_key_down"/>
<Action name="vdr_key_back"/>
<Action name="vdr_key_ok"/>
<Action name="vdr_key_menu"/>
</ToolBar>
</kpartgui>

@ -0,0 +1,780 @@
/* This file is part of the KMPlayer application
Copyright (C) 2004 Koos Vriezen <koos.vriezen@xs4all.nl>
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 2 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; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include <math.h>
#include <unistd.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qmap.h>
#include <qtimer.h>
#include <qpushbutton.h>
#include <qbuttongroup.h>
#include <qcheckbox.h>
#include <qtable.h>
#include <qstringlist.h>
#include <qcombobox.h>
#include <qlineedit.h>
#include <qgroupbox.h>
#include <qwhatsthis.h>
#include <qtabwidget.h>
#include <qradiobutton.h>
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <qsocket.h>
#include <qeventloop.h>
#include <klocale.h>
#include <kdebug.h>
#include <kmessagebox.h>
#include <klineedit.h>
#include <kurlrequester.h>
#include <kcombobox.h>
#include <kstatusbar.h>
#include <kprocess.h>
#include <kconfig.h>
#include <kaction.h>
#include <kiconloader.h>
#include <klistview.h>
#include <kdeversion.h>
#if KDE_IS_VERSION(3, 1, 90)
#include <kinputdialog.h>
#endif
#include "kmplayer_backend_stub.h"
#include "kmplayer_callback.h"
#include "kmplayerpartbase.h"
#include "kmplayercontrolpanel.h"
#include "kmplayerconfig.h"
#include "playlistview.h"
#include "viewarea.h"
#include "kmplayervdr.h"
#include "kmplayer.h"
using namespace KMPlayer;
static const char * strVDR = "VDR";
static const char * strVDRPort = "Port";
static const char * strXVPort = "XV Port";
static const char * strXVEncoding = "XV Encoding";
static const char * strXVScale = "XV Scale";
KDE_NO_CDTOR_EXPORT KMPlayerPrefSourcePageVDR::KMPlayerPrefSourcePageVDR (QWidget * parent, KMPlayer::PartBase * player)
: QFrame (parent), m_player (player) {
//KURLRequester * v4ldevice;
QVBoxLayout *layout = new QVBoxLayout (this, 5, 2);
QGridLayout *gridlayout = new QGridLayout (1, 2);
xv_port = new KListView (this);
xv_port->addColumn (QString());
xv_port->header()->hide ();
xv_port->setTreeStepSize (15);
//xv_port->setRootIsDecorated (true);
//xv_port->setSorting (-1);
QListViewItem * vitem = new QListViewItem (xv_port, i18n ("XVideo port"));
vitem->setOpen (true);
QWhatsThis::add (xv_port, i18n ("Port base of the X Video extension.\nIf left to default (0), the first available port will be used. However if you have multiple XVideo instances, you might have to provide the port to use here.\nSee the output from 'xvinfo' for more information"));
QLabel * label = new QLabel (i18n ("Communication port:"), this);
gridlayout->addWidget (label, 0, 0);
tcp_port = new QLineEdit ("", this);
QWhatsThis::add (tcp_port, i18n ("Communication port with VDR. Default is port 2001.\nIf you use another port, with the '-p' option of 'vdr', you must set it here too."));
gridlayout->addWidget (tcp_port, 0, 1);
layout->addWidget (xv_port);
layout->addLayout (gridlayout);
scale = new QButtonGroup (2, Qt::Vertical, i18n ("Scale"), this);
new QRadioButton (i18n ("4:3"), scale);
new QRadioButton (i18n ("16:9"), scale);
QWhatsThis::add (scale, i18n ("Aspects to use when viewing VDR"));
scale->setButton (0);
layout->addWidget (scale);
layout->addItem (new QSpacerItem (5, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
}
KDE_NO_CDTOR_EXPORT KMPlayerPrefSourcePageVDR::~KMPlayerPrefSourcePageVDR () {}
KDE_NO_EXPORT void KMPlayerPrefSourcePageVDR::showEvent (QShowEvent *) {
XVideo * xvideo = static_cast<XVideo *>(m_player->players()["xvideo"]);
if (!xvideo->configDocument ())
xvideo->getConfigData ();
}
//-----------------------------------------------------------------------------
static const char * cmd_chan_query = "CHAN\n";
static const char * cmd_list_channels = "LSTC\n";
static const char * cmd_volume_query = "VOLU\n";
class VDRCommand {
public:
KDE_NO_CDTOR_EXPORT VDRCommand (const char * c, VDRCommand * n=0L)
: command (strdup (c)), next (n) {}
KDE_NO_CDTOR_EXPORT ~VDRCommand () { free (command); }
char * command;
VDRCommand * next;
};
//-----------------------------------------------------------------------------
KDE_NO_CDTOR_EXPORT KMPlayerVDRSource::KMPlayerVDRSource (KMPlayerApp * app)
: KMPlayer::Source (QString ("VDR"), app->player (), "vdrsource"),
m_app (app),
m_configpage (0),
m_socket (new QSocket (this)),
commands (0L),
channel_timer (0),
timeout_timer (0),
finish_timer (0),
tcp_port (0),
m_stored_volume (0) {
memset (m_actions, 0, sizeof (KAction *) * int (act_last));
m_player->settings ()->addPage (this);
connect (m_socket, SIGNAL (connectionClosed()), this, SLOT(disconnected()));
connect (m_socket, SIGNAL (connected ()), this, SLOT (connected ()));
connect (m_socket, SIGNAL (readyRead ()), this, SLOT (readyRead ()));
connect (m_socket, SIGNAL (error (int)), this, SLOT (socketError (int)));
}
KDE_NO_CDTOR_EXPORT KMPlayerVDRSource::~KMPlayerVDRSource () {}
KDE_NO_CDTOR_EXPORT void KMPlayerVDRSource::waitForConnectionClose () {
if (timeout_timer) {
finish_timer = startTimer (500);
kdDebug () << "VDR connection not yet closed" << endl;
QApplication::eventLoop ()->enterLoop ();
kdDebug () << "VDR connection:" << (m_socket->state () == QSocket::Connected) << endl;
timeout_timer = 0;
}
}
KDE_NO_EXPORT bool KMPlayerVDRSource::hasLength () {
return false;
}
KDE_NO_EXPORT bool KMPlayerVDRSource::isSeekable () {
return true;
}
KDE_NO_EXPORT QString KMPlayerVDRSource::prettyName () {
return i18n ("VDR");
}
KDE_NO_EXPORT void KMPlayerVDRSource::activate () {
last_channel = 0;
connect (this, SIGNAL (startPlaying ()), this, SLOT (processStarted()));
connect (this, SIGNAL (stopPlaying ()), this, SLOT (processStopped ()));
KMPlayer::ControlPanel * panel = m_app->view()->controlPanel ();
panel->button (KMPlayer::ControlPanel::button_red)->show ();
panel->button (KMPlayer::ControlPanel::button_green)->show ();
panel->button (KMPlayer::ControlPanel::button_yellow)->show ();
panel->button (KMPlayer::ControlPanel::button_blue)->show ();
panel->button (KMPlayer::ControlPanel::button_pause)->hide ();
panel->button (KMPlayer::ControlPanel::button_record)->hide ();
connect (panel->volumeBar (), SIGNAL (volumeChanged (int)), this, SLOT (volumeChanged (int)));
connect (panel->button (KMPlayer::ControlPanel::button_red), SIGNAL (clicked ()), this, SLOT (keyRed ()));
connect (panel->button (KMPlayer::ControlPanel::button_green), SIGNAL (clicked ()), this, SLOT (keyGreen ()));
connect (panel->button (KMPlayer::ControlPanel::button_yellow), SIGNAL (clicked ()), this, SLOT (keyYellow ()));
connect (panel->button (KMPlayer::ControlPanel::button_blue), SIGNAL (clicked ()), this, SLOT (keyBlue ()));
setAspect (m_document, scale ? 16.0/9 : 1.33);
if (!m_url.protocol ().compare ("kmplayer"))
m_request_jump = KURL::decode_string (m_url.path ()).mid (1);
setURL (KURL (QString ("vdr://localhost:%1").arg (tcp_port)));
QTimer::singleShot (0, m_player, SLOT (play ()));
}
KDE_NO_EXPORT void KMPlayerVDRSource::deactivate () {
disconnect (m_socket, SIGNAL (error (int)), this, SLOT (socketError (int)));
if (m_player->view ()) {
disconnect (this, SIGNAL(startPlaying()), this, SLOT(processStarted()));
disconnect (this, SIGNAL (stopPlaying()), this, SLOT(processStopped()));
KMPlayer::ControlPanel * panel = m_app->view()->controlPanel ();
disconnect (panel->volumeBar (), SIGNAL (volumeChanged (int)), this, SLOT (volumeChanged (int)));
disconnect (panel->button (KMPlayer::ControlPanel::button_red), SIGNAL (clicked ()), this, SLOT (keyRed ()));
disconnect (panel->button (KMPlayer::ControlPanel::button_green), SIGNAL (clicked ()), this, SLOT (keyGreen ()));
disconnect (panel->button (KMPlayer::ControlPanel::button_yellow), SIGNAL (clicked ()), this, SLOT (keyYellow ()));
disconnect (panel->button (KMPlayer::ControlPanel::button_blue), SIGNAL (clicked ()), this, SLOT (keyBlue ()));
}
processStopped ();
m_request_jump.truncate (0);
}
KDE_NO_EXPORT void KMPlayerVDRSource::playCurrent () {
if (m_player->process ())
m_player->process ()->play (this, current ()); // FIXME HACK
}
KDE_NO_EXPORT void KMPlayerVDRSource::processStopped () {
if (m_socket->state () == QSocket::Connected) {
queueCommand (QString ("VOLU %1\n").arg (m_stored_volume).ascii ());
queueCommand ("QUIT\n");
}
}
KDE_NO_EXPORT void KMPlayerVDRSource::processStarted () {
m_socket->connectToHost ("127.0.0.1", tcp_port);
commands = new VDRCommand ("connect", commands);
}
#define DEF_ACT(i,text,pix,scut,slot,name) \
m_actions [i] = new KAction (text, QString (pix), KShortcut (scut), this, slot, m_app->actionCollection (), name); \
m_fullscreen_actions [i] = new KAction (text, KShortcut (scut), this, slot, m_app->view ()->viewArea ()->actionCollection (), name)
KDE_NO_EXPORT void KMPlayerVDRSource::connected () {
queueCommand (cmd_list_channels);
queueCommand (cmd_volume_query);
killTimer (channel_timer);
channel_timer = startTimer (3000);
KAction * action = m_app->actionCollection ()->action ("vdr_connect");
action->setIcon (QString ("connect_no"));
action->setText (i18n ("Dis&connect"));
DEF_ACT (act_up, i18n ("VDR Key Up"), "up", , SLOT (keyUp ()), "vdr_key_up");
DEF_ACT (act_down, i18n ("VDR Key Down"), "down", , SLOT (keyDown ()), "vdr_key_down");
DEF_ACT (act_back, i18n ("VDR Key Back"), "back", , SLOT (keyBack ()), "vdr_key_back");
DEF_ACT (act_ok, i18n ("VDR Key Ok"), "ok", , SLOT (keyOk ()), "vdr_key_ok");
DEF_ACT (act_setup, i18n ("VDR Key Setup"), "configure", , SLOT (keySetup ()), "vdr_key_setup");
DEF_ACT (act_channels, i18n ("VDR Key Channels"), "player_playlist", , SLOT (keyChannels ()), "vdr_key_channels");
DEF_ACT (act_menu, i18n ("VDR Key Menu"), "showmenu", , SLOT (keyMenu ()), "vdr_key_menu");
DEF_ACT (act_red, i18n ("VDR Key Red"), "red", , SLOT (keyRed ()), "vdr_key_red");
DEF_ACT (act_green, i18n ("VDR Key Green"), "green", , SLOT (keyGreen ()), "vdr_key_green");
DEF_ACT (act_yellow, i18n ("VDR Key Yellow"), "yellow", , SLOT (keyYellow ()), "vdr_key_yellow");
DEF_ACT (act_blue, i18n ("VDR Key Blue"), "blue", , SLOT (keyBlue ()), "vdr_key_blue");
#if KDE_IS_VERSION(3, 1, 90)
DEF_ACT (act_custom, "VDR Custom Command", "exec", , SLOT (customCmd ()), "vdr_key_custom");
#endif
m_app->initMenu (); // update menu and toolbar
DEF_ACT (act_0, i18n ("VDR Key 0"), "0", Qt::Key_0, SLOT (key0 ()), "vdr_key_0");
DEF_ACT (act_1, i18n ("VDR Key 1"), "1", Qt::Key_1, SLOT (key1 ()), "vdr_key_1");
DEF_ACT (act_2, i18n ("VDR Key 2"), "2", Qt::Key_2, SLOT (key2 ()), "vdr_key_2");
DEF_ACT (act_3, i18n ("VDR Key 3"), "3", Qt::Key_3, SLOT (key3 ()), "vdr_key_3");
DEF_ACT (act_4, i18n ("VDR Key 4"), "4", Qt::Key_4, SLOT (key4 ()), "vdr_key_4");
DEF_ACT (act_5, i18n ("VDR Key 5"), "5", Qt::Key_5, SLOT (key5 ()), "vdr_key_5");
DEF_ACT (act_6, i18n ("VDR Key 6"), "6", Qt::Key_6, SLOT (key6 ()), "vdr_key_6");
DEF_ACT (act_7, i18n ("VDR Key 7"), "7", Qt::Key_7, SLOT (key7 ()), "vdr_key_7");
DEF_ACT (act_8, i18n ("VDR Key 8"), "8", Qt::Key_8, SLOT (key8 ()), "vdr_key_8");
DEF_ACT (act_9, i18n ("VDR Key 9"), "9", Qt::Key_9, SLOT (key9 ()), "vdr_key_9");
//KMPlayer::ViewLayer * layer = m_app->view ()->viewArea ();
for (int i = 0; i < int (act_last); ++i)
// somehow, the configured shortcuts only show up after createGUI() call
m_fullscreen_actions [i]->setShortcut (m_actions [i]->shortcut ());
// m_fullscreen_actions[i]->plug (layer);
}
#undef DEF_ACT
KDE_NO_EXPORT void KMPlayerVDRSource::disconnected () {
kdDebug() << "disconnected " << commands << endl;
if (finish_timer) {
deleteCommands ();
return;
}
setURL (KURL (QString ("vdr://localhost:%1").arg (tcp_port)));
if (channel_timer && m_player->source () == this)
m_player->process ()->quit ();
deleteCommands ();
KAction * action = m_app->actionCollection ()->action ("vdr_connect");
action->setIcon (QString ("connect_established"));
action->setText (i18n ("&Connect"));
m_app->guiFactory ()->removeClient (m_app);// crash w/ m_actions[i]->unplugAll (); in for loop below
for (int i = 0; i < int (act_last); ++i)
if (m_player->view () && m_actions[i]) {
m_fullscreen_actions[i]->unplug (m_app->view()->viewArea());
delete m_actions[i];
delete m_fullscreen_actions[i];
}
m_app->initMenu ();
}
KDE_NO_EXPORT void KMPlayerVDRSource::toggleConnected () {
if (m_socket->state () == QSocket::Connected) {
queueCommand ("QUIT\n");
killTimer (channel_timer);
channel_timer = 0;
} else {
m_socket->connectToHost ("127.0.0.1", tcp_port);
commands = new VDRCommand ("connect", commands);
}
}
KDE_NO_EXPORT void KMPlayerVDRSource::volumeChanged (int val) {
queueCommand (QString ("VOLU %1\n").arg (int (sqrt (255 * 255 * val / 100))).ascii ());
}
static struct ReadBuf {
char * buf;
int length;
KDE_NO_CDTOR_EXPORT ReadBuf () : buf (0L), length (0) {}
KDE_NO_CDTOR_EXPORT ~ReadBuf () {
clear ();
}
KDE_NO_EXPORT void operator += (const char * s) {
int l = strlen (s);
char * b = new char [length + l + 1];
if (length)
strcpy (b, buf);
strcpy (b + length, s);
length += l;
delete buf;
buf = b;
}
KDE_NO_EXPORT QCString mid (int p) {
return QCString (buf + p);
}
KDE_NO_EXPORT QCString left (int p) {
return QCString (buf, p);
}
KDE_NO_EXPORT QCString getReadLine ();
KDE_NO_EXPORT void clear () {
delete [] buf;
buf = 0;
length = 0;
}
} readbuf;
KDE_NO_EXPORT QCString ReadBuf::getReadLine () {
QCString out;
if (!length)
return out;
int p = strcspn (buf, "\r\n");
if (p < length) {
int skip = strspn (buf + p, "\r\n");
out = left (p+1);
int nl = length - p - skip;
memmove (buf, buf + p + skip, nl + 1);
length = nl;
}
return out;
}
KDE_NO_EXPORT void KMPlayerVDRSource::readyRead () {
KMPlayer::View * v = finish_timer ? 0L : static_cast <KMPlayer::View *> (m_player->view ());
long nr = m_socket->bytesAvailable();
char * data = new char [nr + 1];
m_socket->readBlock (data, nr);
data [nr] = 0;
readbuf += data;
QCString line = readbuf.getReadLine ();
if (commands) {
bool cmd_done = false;
while (!line.isEmpty ()) {
bool toconsole = true;
cmd_done = (line.length () > 3 && line[3] == ' '); // from svdrpsend.pl
// kdDebug () << "readyRead " << cmd_done << " " << commands->command << endl;
if (!strcmp (commands->command, cmd_list_channels) && m_document) {
int p = line.find (';');
int q = line.find (':');
if (q > 0 && (p < 0 || q < p))
p = q;
if (p > 0)
line.truncate (p);
QString channel_name = line.mid (4);
m_document->appendChild (new KMPlayer::GenericMrl (m_document, QString ("kmplayer://vdrsource/%1").arg(channel_name), channel_name));
if (cmd_done) {
m_player->updateTree ();
if (!m_request_jump.isEmpty ()) {
jump (m_request_jump);
m_request_jump.truncate (0);
}
}
toconsole = false;
} else if (!strcmp (commands->command, cmd_chan_query)) {
if (v && line.length () > 4) {
QString ch = line.mid (4);
setTitle (ch);
KMPlayer::PlayListItem * lvi = static_cast <KMPlayer::PlayListItem *> (v->playList ()->findItem (ch, 0));
if (lvi && lvi->node != m_last_channel) {
KMPlayer::PlayListItem * si = static_cast <KMPlayer::PlayListItem *> (v->playList ()->selectedItem ());
bool jump_selection = (si && (si->node == m_document || si->node == m_last_channel));
if (m_last_channel)
m_last_channel->setState (KMPlayer::Node::state_finished);
m_last_channel = lvi->node;
if (m_last_channel)
m_last_channel->setState (KMPlayer::Node::state_began);
if (jump_selection) {
v->playList ()->setSelected (lvi, true);
v->playList ()->ensureItemVisible (lvi);
}
v->playList ()->triggerUpdate ();
}
//v->playList ()->selectItem (ch);
int c = strtol(ch.ascii(), 0L, 10);
if (c != last_channel) {
last_channel = c;
m_app->statusBar ()->changeItem (QString::number (c),
id_status_timer);
}
}
} else if (cmd_done && !strcmp(commands->command,cmd_volume_query)){
int pos = line.findRev (QChar (' '));
if (pos > 0) {
QString vol = line.mid (pos + 1);
if (!vol.compare ("mute"))
m_stored_volume = 0;
else
m_stored_volume = vol.toInt ();
if (m_stored_volume == 0)
volumeChanged (m_app->view ()->controlPanel ()->volumeBar ()->value ());
}
}
if (v && toconsole)
v->addText (QString (line), true);
line = readbuf.getReadLine ();
}
if (cmd_done) {
VDRCommand * c = commands->next;
delete commands;
commands = c;
if (commands)
sendCommand ();
else {
killTimer (timeout_timer);
timeout_timer = 0;
}
}
}
delete [] data;
}
KDE_NO_EXPORT void KMPlayerVDRSource::socketError (int code) {
if (code == QSocket::ErrHostNotFound) {
KMessageBox::error (m_configpage, i18n ("Host not found"), i18n ("Error"));
} else if (code == QSocket::ErrConnectionRefused) {
KMessageBox::error (m_configpage, i18n ("Connection refused"), i18n ("Error"));
}
}
KDE_NO_EXPORT void KMPlayerVDRSource::queueCommand (const char * cmd) {
if (m_player->source () != this)
return;
if (!commands) {
readbuf.clear ();
commands = new VDRCommand (cmd);
if (m_socket->state () == QSocket::Connected) {
sendCommand ();
} else {
m_socket->connectToHost ("127.0.0.1", tcp_port);
commands = new VDRCommand ("connect", commands);
}
} else {
VDRCommand * c = commands;
for (int i = 0; i < 10; ++i, c = c->next)
if (!c->next) {
c->next = new VDRCommand (cmd);
break;
}
}
}
KDE_NO_EXPORT void KMPlayerVDRSource::queueCommand (const char * cmd, int t) {
queueCommand (cmd);
killTimer (channel_timer);
channel_timer = startTimer (t);
}
KDE_NO_EXPORT void KMPlayerVDRSource::sendCommand () {
//kdDebug () << "sendCommand " << commands->command << endl;
m_socket->writeBlock (commands->command, strlen(commands->command));
m_socket->flush ();
killTimer (timeout_timer);
timeout_timer = startTimer (30000);
}
KDE_NO_EXPORT void KMPlayerVDRSource::customCmd () {
#if KDE_IS_VERSION(3, 1, 90)
QString cmd = KInputDialog::getText (i18n ("Custom VDR command"), i18n ("You can pass commands to VDR.\nEnter 'HELP' to see a list of available commands.\nYou can see VDR response in the console window.\n\nVDR Command:"), QString(), 0, m_player->view ());
if (!cmd.isEmpty ())
queueCommand (QString (cmd + QChar ('\n')).local8Bit ());
#endif
}
KDE_NO_EXPORT void KMPlayerVDRSource::timerEvent (QTimerEvent * e) {
if (e->timerId () == timeout_timer || e->timerId () == finish_timer) {
deleteCommands ();
} else if (e->timerId () == channel_timer) {
queueCommand (cmd_chan_query);
killTimer (channel_timer);
channel_timer = startTimer (30000);
}
}
KDE_NO_EXPORT void KMPlayerVDRSource::deleteCommands () {
killTimer (timeout_timer);
timeout_timer = 0;
killTimer (channel_timer);
channel_timer = 0;
for (VDRCommand * c = commands; c; c = commands) {
commands = commands->next;
delete c;
}
readbuf.clear ();
if (finish_timer) {
killTimer (finish_timer);
QApplication::eventLoop ()->exitLoop ();
}
}
KDE_NO_EXPORT void KMPlayerVDRSource::jump (KMPlayer::NodePtr e) {
if (!e->isPlayable ()) return;
m_current = e;
jump (e->mrl ()->pretty_name);
}
KDE_NO_EXPORT void KMPlayerVDRSource::jump (const QString & channel) {
QCString c ("CHAN ");
QCString ch = channel.local8Bit ();
int p = ch.find (' ');
if (p > 0)
c += ch.left (p);
else
c += ch; // hope for the best ..
c += '\n';
queueCommand (c);
}
KDE_NO_EXPORT void KMPlayerVDRSource::forward () {
queueCommand ("CHAN +\n", 1000);
}
KDE_NO_EXPORT void KMPlayerVDRSource::backward () {
queueCommand ("CHAN -\n", 1000);
}
KDE_NO_EXPORT void KMPlayerVDRSource::keyUp () {
queueCommand ("HITK UP\n", 1000);
}
KDE_NO_EXPORT void KMPlayerVDRSource::keyDown () {
queueCommand ("HITK DOWN\n", 1000);
}
KDE_NO_EXPORT void KMPlayerVDRSource::keyBack () {
queueCommand ("HITK BACK\n");
}
KDE_NO_EXPORT void KMPlayerVDRSource::keyOk () {
queueCommand ("HITK OK\n");
}
KDE_NO_EXPORT void KMPlayerVDRSource::keySetup () {
queueCommand ("HITK SETUP\n");
}
KDE_NO_EXPORT void KMPlayerVDRSource::keyChannels () {
queueCommand ("HITK CHANNELS\n");
}
KDE_NO_EXPORT void KMPlayerVDRSource::keyMenu () {
queueCommand ("HITK MENU\n");
}
KDE_NO_EXPORT void KMPlayerVDRSource::key0 () {
queueCommand ("HITK 0\n", 2000);
}
KDE_NO_EXPORT void KMPlayerVDRSource::key1 () {
queueCommand ("HITK 1\n", 2000);
}
KDE_NO_EXPORT void KMPlayerVDRSource::key2 () {
queueCommand ("HITK 2\n", 2000);
}
KDE_NO_EXPORT void KMPlayerVDRSource::key3 () {
queueCommand ("HITK 3\n", 2000);
}
KDE_NO_EXPORT void KMPlayerVDRSource::key4 () {
queueCommand ("HITK 4\n", 2000);
}
KDE_NO_EXPORT void KMPlayerVDRSource::key5 () {
queueCommand ("HITK 5\n", 2000);
}
KDE_NO_EXPORT void KMPlayerVDRSource::key6 () {
queueCommand ("HITK 6\n", 2000);
}
KDE_NO_EXPORT void KMPlayerVDRSource::key7 () {
queueCommand ("HITK 7\n", 2000);
}
KDE_NO_EXPORT void KMPlayerVDRSource::key8 () {
queueCommand ("HITK 8\n", 2000);
}
KDE_NO_EXPORT void KMPlayerVDRSource::key9 () {
queueCommand ("HITK 9\n", 2000);
}
KDE_NO_EXPORT void KMPlayerVDRSource::keyRed () {
queueCommand ("HITK RED\n");
}
KDE_NO_EXPORT void KMPlayerVDRSource::keyGreen () {
queueCommand ("HITK GREEN\n");
}
KDE_NO_EXPORT void KMPlayerVDRSource::keyYellow () {
queueCommand ("HITK YELLOW\n");
}
KDE_NO_EXPORT void KMPlayerVDRSource::keyBlue () {
queueCommand ("HITK BLUE\n");
}
KDE_NO_EXPORT void KMPlayerVDRSource::write (KConfig * m_config) {
m_config->setGroup (strVDR);
m_config->writeEntry (strVDRPort, tcp_port);
m_config->writeEntry (strXVPort, m_xvport);
m_config->writeEntry (strXVEncoding, m_xvencoding);
m_config->writeEntry (strXVScale, scale);
}
KDE_NO_EXPORT void KMPlayerVDRSource::read (KConfig * m_config) {
m_config->setGroup (strVDR);
tcp_port = m_config->readNumEntry (strVDRPort, 2001);
m_xvport = m_config->readNumEntry (strXVPort, 0);
m_xvencoding = m_config->readNumEntry (strXVEncoding, 0);
scale = m_config->readNumEntry (strXVScale, 0);
}
struct XVTreeItem : public QListViewItem {
XVTreeItem (QListViewItem *parent, const QString & t, int p, int e)
: QListViewItem (parent, t), port (p), encoding (e) {}
int port;
int encoding;
};
KDE_NO_EXPORT void KMPlayerVDRSource::sync (bool fromUI) {
XVideo * xvideo = static_cast<XVideo *>(m_player->players()["xvideo"]);
if (fromUI) {
tcp_port = m_configpage->tcp_port->text ().toInt ();
scale = m_configpage->scale->id (m_configpage->scale->selected ());
setAspect (m_document, scale ? 16.0/9 : 1.25);
XVTreeItem * vitem = dynamic_cast <XVTreeItem *> (m_configpage->xv_port->selectedItem ());
if (vitem) {
m_xvport = vitem->port;
m_xvencoding = vitem->encoding;
}
} else {
m_configpage->tcp_port->setText (QString::number (tcp_port));
m_configpage->scale->setButton (scale);
QListViewItem * vitem = m_configpage->xv_port->firstChild ();
NodePtr configdoc = xvideo->configDocument ();
if (configdoc && configdoc->firstChild ()) {
for (QListViewItem *i=vitem->firstChild(); i; i=vitem->firstChild())
delete i;
NodePtr node = configdoc->firstChild ();
for (node = node->firstChild (); node; node = node->nextSibling()) {
if (!node->isElementNode ())
continue; // some text sneaked in ?
Element * elm = convertNode <Element> (node);
if (elm->getAttribute (KMPlayer::StringPool::attr_type) !=
QString ("tree"))
continue;
for (NodePtr n = elm->firstChild (); n; n = n->nextSibling ()) {
if (!n->isElementNode () || strcmp (n->nodeName (), "Port"))
continue;
Element * e = convertNode <Element> (n);
QString portatt = e->getAttribute (
KMPlayer::StringPool::attr_value);
int port;
QListViewItem *pi = new QListViewItem (vitem, i18n ("Port ") + portatt);
port = portatt.toInt ();
for (NodePtr in=e->firstChild(); in; in=in->nextSibling()) {
if (!in->isElementNode () ||
strcmp (in->nodeName (), "Input"))
continue;
Element * i = convertNode <Element> (in);
QString inp = i->getAttribute (
KMPlayer::StringPool::attr_name);
int enc = i->getAttribute (
KMPlayer::StringPool::attr_value).toInt ();
QListViewItem * ii = new XVTreeItem(pi, inp, port, enc);
if (m_xvport == port && enc == m_xvencoding) {
ii->setSelected (true);
m_configpage->xv_port->ensureItemVisible (ii);
}
}
}
}
} else // wait for showEvent
connect (xvideo, SIGNAL (configReceived()), this, SLOT (configReceived()));
}
}
KDE_NO_EXPORT void KMPlayerVDRSource::configReceived () {
XVideo * xvideo = static_cast<XVideo *>(m_player->players()["xvideo"]);
disconnect (xvideo, SIGNAL (configReceived()), this, SLOT (configReceived()));
sync (false);
}
KDE_NO_EXPORT void KMPlayerVDRSource::prefLocation (QString & item, QString & icon, QString & tab) {
item = i18n ("Source");
icon = QString ("source");
tab = i18n ("VDR");
}
KDE_NO_EXPORT QFrame * KMPlayerVDRSource::prefPage (QWidget * parent) {
if (!m_configpage)
m_configpage = new KMPlayerPrefSourcePageVDR (parent, m_player);
return m_configpage;
}
KDE_NO_EXPORT bool KMPlayerVDRSource::requestPlayURL (KMPlayer::NodePtr) {
return true;
}
KDE_NO_EXPORT void KMPlayerVDRSource::stateElementChanged (KMPlayer::Node *, KMPlayer::Node::State, KMPlayer::Node::State) {
}
//-----------------------------------------------------------------------------
static const char * xv_supported [] = {
"tvsource", "vdrsource", 0L
};
KDE_NO_CDTOR_EXPORT XVideo::XVideo (QObject * parent, Settings * settings)
: KMPlayer::CallbackProcess (parent, settings, "xvideo", i18n ("X&Video")) {
m_supported_sources = xv_supported;
//m_player->settings ()->addPage (m_configpage);
}
KDE_NO_CDTOR_EXPORT XVideo::~XVideo () {}
KDE_NO_EXPORT bool XVideo::ready (KMPlayer::Viewer * v) {
if (playing ()) {
return true;
}
initProcess (v);
QString cmd = QString ("kxvplayer -wid %3 -cb %4").arg (viewer ()->embeddedWinId ()).arg (dcopName ());
if (m_have_config == config_unknown || m_have_config == config_probe)
cmd += QString (" -c");
if (m_source) {
int xv_port = m_source->xvPort ();
int xv_encoding = m_source->xvEncoding ();
int freq = m_source->frequency ();
cmd += QString (" -port %1 -enc %2 -norm \"%3\"").arg (xv_port).arg (xv_encoding).arg (m_source->videoNorm ());
if (freq > 0)
cmd += QString (" -freq %1").arg (freq);
}
fprintf (stderr, "%s\n", cmd.latin1 ());
*m_process << cmd;
m_process->start (KProcess::NotifyOnExit, KProcess::All);
return m_process->isRunning ();
}
#include "kmplayervdr.moc"

@ -0,0 +1,169 @@
/* This file is part of the KMPlayer application
Copyright (C) 2004 Koos Vriezen <koos.vriezen@xs4all.nl>
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 2 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; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KMPLAYER_VDR_SOURCE_H
#define KMPLAYER_VDR_SOURCE_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <qframe.h>
#include <kurl.h>
#include "kmplayerappsource.h"
#include "kmplayerconfig.h"
#include "kmplayerprocess.h"
class KMPlayerApp;
class VDRCommand;
class KURLRequester;
class QButtonGroup;
class QMenuItem;
class QCheckBox;
class QLineEdit;
class KAction;
class QSocket;
class QTimerEvent;
class KListView;
/*
* Preference page for VDR
*/
class KMPLAYER_NO_EXPORT KMPlayerPrefSourcePageVDR : public QFrame {
Q_OBJECT
public:
KMPlayerPrefSourcePageVDR (QWidget * parent, KMPlayer::PartBase * player);
~KMPlayerPrefSourcePageVDR ();
KURLRequester * vcddevice;
KListView * xv_port;
QLineEdit * tcp_port;
QButtonGroup * scale;
protected:
void showEvent (QShowEvent *);
private:
KMPlayer::PartBase * m_player;
};
/*
* Source from VDR (XVideo actually) and socket connection
*/
class KMPLAYER_NO_EXPORT KMPlayerVDRSource : public KMPlayer::Source, public KMPlayer::PreferencesPage {
Q_OBJECT
public:
KMPlayerVDRSource (KMPlayerApp * app);
virtual ~KMPlayerVDRSource ();
virtual bool hasLength ();
virtual bool isSeekable ();
virtual QString prettyName ();
virtual void write (KConfig *);
virtual void read (KConfig *);
virtual void sync (bool);
virtual void prefLocation (QString & item, QString & icon, QString & tab);
virtual QFrame * prefPage (QWidget * parent);
virtual bool requestPlayURL (KMPlayer::NodePtr mrl);
virtual void stateElementChanged (KMPlayer::Node * node, KMPlayer::Node::State os, KMPlayer::Node::State ns);
void waitForConnectionClose ();
public slots:
void activate ();
void deactivate ();
void jump (KMPlayer::NodePtr e);
void forward ();
void backward ();
void playCurrent ();
void toggleConnected ();
void volumeChanged (int);
private slots:
void keyUp ();
void keyDown ();
void keyBack ();
void keyOk ();
void keySetup ();
void keyChannels ();
void keyMenu ();
void key0 ();
void key1 ();
void key2 ();
void key3 ();
void key4 ();
void key5 ();
void key6 ();
void key7 ();
void key8 ();
void key9 ();
void keyRed ();
void keyGreen ();
void keyYellow ();
void keyBlue ();
void customCmd ();
void connected ();
void disconnected ();
void readyRead ();
void socketError (int);
void processStopped ();
void processStarted ();
void configReceived ();
protected:
void timerEvent (QTimerEvent *);
private:
enum {
act_up = 0, act_down, act_back, act_ok,
act_setup, act_channels, act_menu,
act_red, act_green, act_yellow, act_blue,
act_0, act_1, act_2, act_3, act_4, act_5, act_6, act_7, act_8, act_9,
#if KDE_IS_VERSION(3, 1, 90)
act_custom,
#endif
act_last
};
void queueCommand (const char * cmd);
void queueCommand (const char * cmd, int repeat_ms);
void sendCommand ();
void deleteCommands ();
void jump (const QString & channel);
KMPlayerApp * m_app;
KMPlayerPrefSourcePageVDR * m_configpage;
KAction * m_actions [act_last];
KAction * m_fullscreen_actions [act_last];
QSocket * m_socket;
VDRCommand * commands;
QString m_request_jump;
KMPlayer::NodePtrW m_last_channel;
int channel_timer;
int timeout_timer;
int finish_timer;
int tcp_port;
int m_stored_volume;
int scale;
int last_channel;
};
class XVideo : public KMPlayer::CallbackProcess {
Q_OBJECT
public:
XVideo (QObject * parent, KMPlayer::Settings * settings);
~XVideo ();
public slots:
virtual bool ready (KMPlayer::Viewer *);
};
#endif // KMPLAYER_VDR_SOURCE_H

@ -0,0 +1,831 @@
/**
* Copyright (C) 2002-2003 by Koos Vriezen <koos.vriezen@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
**/
#include <stdio.h>
#include <math.h>
#include <config.h>
// include files for Qt
#include <qstyle.h>
#include <qtimer.h>
#include <qpainter.h>
#include <qmetaobject.h>
#include <qlayout.h>
#include <qpixmap.h>
#include <qtextedit.h>
#include <qtooltip.h>
#include <qapplication.h>
#include <qiconset.h>
#include <qcursor.h>
#include <qkeysequence.h>
#include <qslider.h>
#include <qlabel.h>
#include <qdatastream.h>
#include <qwidgetstack.h>
#include <qcursor.h>
#include <qclipboard.h>
#include <kiconloader.h>
#include <kstatusbar.h>
#include <kdebug.h>
#include <klocale.h>
#include <kapplication.h>
#include <kactioncollection.h>
#include <kstdaction.h>
#include <kshortcut.h>
#include <kurldrag.h>
#include <kfinddialog.h>
#include <dcopclient.h>
#include <kglobalsettings.h>
#include <kstaticdeleter.h>
#include "kmplayerview.h"
#include "kmplayercontrolpanel.h"
#include "kmplayersource.h"
#include "playlistview.h"
#include "viewarea.h"
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
static const int XKeyPress = KeyPress;
#undef KeyPress
#undef Always
#undef Never
#undef Status
#undef Unsorted
#undef Bool
extern const char * normal_window_xpm[];
extern const char * playlist_xpm[];
/* mouse invisible: define the time (in 1/1000 seconds) before mouse goes invisible */
using namespace KMPlayer;
//-------------------------------------------------------------------------
namespace KMPlayer {
class KMPlayerPictureWidget : public QWidget {
View * m_view;
public:
KDE_NO_CDTOR_EXPORT KMPlayerPictureWidget (QWidget * parent, View * view)
: QWidget (parent), m_view (view) {}
KDE_NO_CDTOR_EXPORT ~KMPlayerPictureWidget () {}
protected:
void mousePressEvent (QMouseEvent *);
};
} // namespace
KDE_NO_EXPORT void KMPlayerPictureWidget::mousePressEvent (QMouseEvent *) {
m_view->emitPictureClicked ();
}
//-----------------------------------------------------------------------------
KDE_NO_CDTOR_EXPORT TextEdit::TextEdit (QWidget * parent, View * view) : QTextEdit (parent, "kde_kmplayer_console"), m_view (view) {
setReadOnly (true);
setPaper (QBrush (QColor (0, 0, 0)));
setColor (QColor (0xB2, 0xB2, 0xB2));
}
KDE_NO_EXPORT void TextEdit::contextMenuEvent (QContextMenuEvent * e) {
m_view->controlPanel ()->popupMenu ()->exec (e->globalPos ());
}
//-----------------------------------------------------------------------------
KDE_NO_CDTOR_EXPORT InfoWindow::InfoWindow (QWidget * parent, View * view) : QTextEdit (parent, "kde_kmplayer_console"), m_view (view) {
setReadOnly (true);
setLinkUnderline (false);
}
KDE_NO_EXPORT void InfoWindow::contextMenuEvent (QContextMenuEvent * e) {
m_view->controlPanel ()->popupMenu ()->exec (e->globalPos ());
}
//-----------------------------------------------------------------------------
KDE_NO_CDTOR_EXPORT View::View (QWidget *parent, const char *name)
: KMediaPlayer::View (parent, name),
m_image (0L),
m_control_panel (0L),
m_status_bar (0L),
m_volume_slider (0L),
m_mixer_object ("kicker"),
m_controlpanel_mode (CP_Show),
m_old_controlpanel_mode (CP_Show),
m_statusbar_mode (SB_Hide),
controlbar_timer (0),
infopanel_timer (0),
m_keepsizeratio (false),
m_playing (false),
m_mixer_init (false),
m_inVolumeUpdate (false),
m_tmplog_needs_eol (false),
m_revert_fullscreen (false),
m_no_info (false),
m_edit_mode (false)
{}
KDE_NO_EXPORT void View::dropEvent (QDropEvent * de) {
KURL::List sl;
if (KURLDrag::canDecode (de)) {
KURLDrag::decode (de, sl);
} else if (QTextDrag::canDecode (de)) {
QString text;
QTextDrag::decode (de, text);
sl.push_back (KURL (text));
}
if (sl.size () > 0) {
for (unsigned i = 0; i < sl.size (); i++)
sl [i] = KURL::decode_string (sl [i].url ());
m_widgetstack->visibleWidget ()->setFocus ();
emit urlDropped (sl);
de->accept ();
}
}
KDE_NO_EXPORT void View::dragEnterEvent (QDragEnterEvent* dee) {
if (isDragValid (dee))
dee->accept ();
}
KDE_NO_EXPORT void View::init (KActionCollection * action_collection) {
setBackgroundMode(Qt::NoBackground); // prevents flashing
//m_dockarea->setEraseColor (QColor (0, 0, 0));
QPalette pal (QColor (64, 64,64), QColor (32, 32, 32));
QVBoxLayout * viewbox = new QVBoxLayout (this, 0, 0);
m_dockarea = new KDockArea (this, "kde_kmplayer_dock_area");
m_dock_video = new KDockWidget (m_dockarea->manager (), 0, KGlobal::iconLoader ()->loadIcon (QString ("kmplayer"), KIcon::Small), m_dockarea);
m_dock_video->setEraseColor (QColor (0, 0, 255));
m_dock_video->setDockSite (KDockWidget::DockLeft | KDockWidget::DockBottom | KDockWidget::DockRight | KDockWidget::DockTop);
m_dock_video->setEnableDocking(KDockWidget::DockNone);
m_view_area = new ViewArea (m_dock_video, this);
m_dock_video->setWidget (m_view_area);
m_dockarea->setMainDockWidget (m_dock_video);
m_dock_playlist = m_dockarea->createDockWidget (i18n ("Play List"), KGlobal::iconLoader ()->loadIcon (QString ("player_playlist"), KIcon::Small));
m_playlist = new PlayListView (m_dock_playlist, this, action_collection);
m_dock_playlist->setWidget (m_playlist);
viewbox->addWidget (m_dockarea);
m_widgetstack = new QWidgetStack (m_view_area);
m_control_panel = new ControlPanel (m_view_area, this);
m_control_panel->setMaximumSize (2500, controlPanel ()->maximumSize ().height ());
m_status_bar = new StatusBar (m_view_area);
m_status_bar->insertItem (QString (""), 0);
QSize sbsize = m_status_bar->sizeHint ();
m_status_bar->hide ();
m_status_bar->setMaximumSize (2500, sbsize.height ());
m_viewer = new Viewer (m_widgetstack, this);
m_widgettypes [WT_Video] = m_viewer;
#if KDE_IS_VERSION(3,1,90)
setVideoWidget (m_view_area);
#endif
m_multiedit = new TextEdit (m_widgetstack, this);
m_multiedit->setTextFormat (Qt::PlainText);
QFont fnt = KGlobalSettings::fixedFont ();
m_multiedit->setFont (fnt);
m_widgettypes[WT_Console] = m_multiedit;
m_widgettypes[WT_Picture] = new KMPlayerPictureWidget (m_widgetstack, this);
m_dock_infopanel = m_dockarea->createDockWidget ("infopanel", KGlobal::iconLoader ()->loadIcon (QString ("info"), KIcon::Small));
m_infopanel = new InfoWindow (m_dock_infopanel, this);
m_dock_infopanel->setWidget (m_infopanel);
m_widgetstack->addWidget (m_viewer);
m_widgetstack->addWidget (m_multiedit);
m_widgetstack->addWidget (m_widgettypes[WT_Picture]);
setFocusPolicy (QWidget::ClickFocus);
setAcceptDrops (true);
m_view_area->resizeEvent (0L);
kapp->installX11EventFilter (this);
}
KDE_NO_CDTOR_EXPORT View::~View () {
delete m_image;
if (m_view_area->parent () != this)
delete m_view_area;
}
KDE_NO_EXPORT void View::setEraseColor (const QColor & color) {
KMediaPlayer::View::setEraseColor (color);
if (statusBar ()) {
statusBar ()->setEraseColor (color);
controlPanel ()->setEraseColor (color);
}
}
void View::setInfoMessage (const QString & msg) {
bool ismain = m_dockarea->getMainDockWidget () == m_dock_infopanel;
if (msg.isEmpty ()) {
if (!ismain && !m_edit_mode && !infopanel_timer)
infopanel_timer = startTimer (0);
m_infopanel->clear ();
} else if (ismain || !m_no_info) {
if (!m_edit_mode && m_dock_infopanel->mayBeShow ())
m_dock_infopanel->manualDock(m_dock_video,KDockWidget::DockBottom,80);
m_infopanel->setText (msg);
}
}
void View::setStatusMessage (const QString & msg) {
if (m_statusbar_mode != SB_Hide)
m_status_bar->changeItem (msg, 0);
}
void View::toggleShowPlaylist () {
if (m_controlpanel_mode == CP_Only)
return;
if (m_dock_playlist->mayBeShow ()) {
if (m_dock_playlist->isDockBackPossible ())
m_dock_playlist->dockBack ();
else {
bool horz = true;
QStyle & style = m_playlist->style ();
int h = style.pixelMetric (QStyle::PM_ScrollBarExtent, m_playlist);
h += style.pixelMetric(QStyle::PM_DockWindowFrameWidth, m_playlist);
h +=style.pixelMetric(QStyle::PM_DockWindowHandleExtent,m_playlist);
for (QListViewItem *i=m_playlist->firstChild();i;i=i->itemBelow()) {
h += i->height ();
if (h > int (0.25 * height ())) {
horz = false;
break;
}
}
int perc = 30;
if (horz && 100 * h / height () < perc)
perc = 100 * h / height ();
m_dock_playlist->manualDock (m_dock_video, horz ? KDockWidget::DockTop : KDockWidget::DockLeft, perc);
}
} else
m_dock_playlist->undock ();
}
void View::setViewOnly () {
if (m_dock_playlist->mayBeHide ())
m_dock_playlist->undock ();
if (m_dock_infopanel->mayBeHide ())
m_dock_infopanel->undock ();
}
void View::setInfoPanelOnly () {
if (m_dock_playlist->mayBeHide ())
m_dock_playlist->undock ();
m_dock_video->setEnableDocking (KDockWidget::DockCenter);
m_dock_video->undock ();
m_dock_infopanel->setEnableDocking (KDockWidget::DockNone);
m_dockarea->setMainDockWidget (m_dock_infopanel);
}
void View::setPlaylistOnly () {
if (m_dock_infopanel->mayBeHide ())
m_dock_infopanel->undock ();
m_dock_video->setEnableDocking (KDockWidget::DockCenter);
m_dock_video->undock ();
m_dock_playlist->setEnableDocking (KDockWidget::DockNone);
m_dockarea->setMainDockWidget (m_dock_playlist);
}
void View::setEditMode (RootPlayListItem *ri, bool enable) {
m_edit_mode = enable;
m_infopanel->setReadOnly (!m_edit_mode);
m_infopanel->setTextFormat (enable ? Qt::PlainText : Qt::AutoText);
if (m_edit_mode && m_dock_infopanel->mayBeShow ())
m_dock_infopanel->manualDock(m_dock_video,KDockWidget::DockBottom,50);
m_playlist->showAllNodes (ri, m_edit_mode);
}
bool View::setPicture (const QString & path) {
delete m_image;
if (path.isEmpty ())
m_image = 0L;
else {
m_image = new QPixmap (path);
if (m_image->isNull ()) {
delete m_image;
m_image = 0L;
kdDebug() << "View::setPicture failed " << path << endl;
}
}
if (!m_image) {
m_widgetstack->raiseWidget (m_viewer);
} else {
m_widgettypes[WT_Picture]->setPaletteBackgroundPixmap (*m_image);
m_widgetstack->raiseWidget (m_widgettypes[WT_Picture]);
setControlPanelMode (CP_AutoHide);
}
return m_image;
}
KDE_NO_EXPORT void View::updateVolume () {
if (m_mixer_init && !m_volume_slider)
return;
QByteArray data, replydata;
QCString replyType;
int volume;
bool has_mixer = kapp->dcopClient ()->call (m_mixer_object, "Mixer0",
"masterVolume()", data, replyType, replydata);
if (!has_mixer) {
m_mixer_object = "kmix";
has_mixer = kapp->dcopClient ()->call (m_mixer_object, "Mixer0",
"masterVolume()", data, replyType, replydata);
}
if (has_mixer) {
QDataStream replystream (replydata, IO_ReadOnly);
replystream >> volume;
if (!m_mixer_init) {
QLabel * mixer_label = new QLabel (i18n ("Volume:"), m_control_panel->popupMenu ());
m_control_panel->popupMenu ()->insertItem (mixer_label, -1, 4);
m_volume_slider = new QSlider (0, 100, 10, volume, Qt::Horizontal, m_control_panel->popupMenu ());
connect(m_volume_slider, SIGNAL(valueChanged(int)), this,SLOT(setVolume(int)));
m_control_panel->popupMenu ()->insertItem (m_volume_slider, ControlPanel::menu_volume, 5);
m_control_panel->popupMenu ()->insertSeparator (6);
} else {
m_inVolumeUpdate = true;
m_volume_slider->setValue (volume);
m_inVolumeUpdate = false;
}
} else if (m_volume_slider) {
m_control_panel->popupMenu ()->removeItemAt (6);
m_control_panel->popupMenu ()->removeItemAt (5);
m_control_panel->popupMenu ()->removeItemAt (4);
m_volume_slider = 0L;
}
m_mixer_init = true;
}
void View::showWidget (WidgetType wt) {
m_widgetstack->raiseWidget (m_widgettypes [wt]);
if (m_widgetstack->visibleWidget () == m_widgettypes[WT_Console]) {
addText (QString (""), false);
if (m_controlpanel_mode == CP_AutoHide && m_playing)
m_control_panel->show();
} else
delayedShowButtons (false);
updateLayout ();
}
void View::toggleVideoConsoleWindow () {
WidgetType wt = WT_Console;
if (m_widgetstack->visibleWidget () == m_widgettypes[WT_Console]) {
wt = WT_Video;
m_control_panel->popupMenu ()->changeItem (ControlPanel::menu_video, KGlobal::iconLoader ()->loadIconSet (QString ("konsole"), KIcon::Small, 0, true), i18n ("Con&sole"));
} else
m_control_panel->popupMenu ()->changeItem (ControlPanel::menu_video, KGlobal::iconLoader ()->loadIconSet (QString ("video"), KIcon::Small, 0, true), i18n ("V&ideo"));
showWidget (wt);
emit windowVideoConsoleToggled (int (wt));
}
void View::setControlPanelMode (ControlPanelMode m) {
killTimer (controlbar_timer);
controlbar_timer = 0L;
m_old_controlpanel_mode = m_controlpanel_mode = m;
if (m_playing && isFullScreen())
m_controlpanel_mode = CP_AutoHide;
if ((m_controlpanel_mode == CP_Show || m_controlpanel_mode == CP_Only) &&
!m_control_panel->isVisible ()) {
m_control_panel->show ();
m_view_area->resizeEvent (0L);
} else if (m_controlpanel_mode == CP_AutoHide) {
if ((m_playing &&
m_widgetstack->visibleWidget () != m_widgettypes[WT_Console]))
delayedShowButtons (false);
else if (!m_control_panel->isVisible ()) {
m_control_panel->show ();
m_view_area->resizeEvent (0L);
}
} else if (m_controlpanel_mode == CP_Hide && m_control_panel->isVisible()) {
m_control_panel->hide ();
m_view_area->resizeEvent (0L);
}
}
void View::setStatusBarMode (StatusBarMode m) {
m_statusbar_mode = m;
if (m == SB_Hide)
m_status_bar->hide ();
else
m_status_bar->show ();
m_view_area->resizeEvent (0L);
}
KDE_NO_EXPORT void View::delayedShowButtons (bool show) {
if ((show && m_control_panel->isVisible ()) ||
(!show && !m_control_panel->isVisible ())) {
if (controlbar_timer) {
killTimer (controlbar_timer);
controlbar_timer = 0;
}
if (!show)
m_control_panel->hide (); // for initial race
} else if (m_controlpanel_mode == CP_AutoHide &&
(m_playing ||
m_widgetstack->visibleWidget () == m_widgettypes[WT_Picture]) &&
m_widgetstack->visibleWidget () != m_widgettypes[WT_Console] &&
!controlbar_timer) {
controlbar_timer = startTimer (500);
}
}
KDE_NO_EXPORT void View::setVolume (int vol) {
if (m_inVolumeUpdate) return;
QByteArray data;
QDataStream arg( data, IO_WriteOnly );
arg << vol;
if (!kapp->dcopClient()->send (m_mixer_object, "Mixer0", "setMasterVolume(int)", data))
kdWarning() << "Failed to update volume" << endl;
}
KDE_NO_EXPORT void View::updateLayout () {
if (m_controlpanel_mode == CP_Only)
m_control_panel->setMaximumSize (2500, height ());
m_view_area->resizeEvent (0L);
}
void View::setKeepSizeRatio (bool b) {
if (m_keepsizeratio != b) {
m_keepsizeratio = b;
updateLayout ();
m_view_area->update ();
}
}
KDE_NO_EXPORT void View::timerEvent (QTimerEvent * e) {
if (e->timerId () == controlbar_timer) {
controlbar_timer = 0;
if (m_playing ||
m_widgetstack->visibleWidget () == m_widgettypes[WT_Picture]) {
int vert_buttons_pos = m_view_area->height()-statusBarHeight ();
QPoint mouse_pos = m_view_area->mapFromGlobal (QCursor::pos ());
int cp_height = m_control_panel->maximumSize ().height ();
bool mouse_on_buttons = (//m_view_area->hasMouse () &&
mouse_pos.y () >= vert_buttons_pos-cp_height &&
mouse_pos.y ()<= vert_buttons_pos &&
mouse_pos.x () > 0 &&
mouse_pos.x () < m_control_panel->width());
if (mouse_on_buttons && !m_control_panel->isVisible ()) {
m_control_panel->show ();
m_view_area->resizeEvent (0L);
} else if (!mouse_on_buttons && m_control_panel->isVisible ()) {
m_control_panel->hide ();
m_view_area->resizeEvent (0L);
}
}
} else if (e->timerId () == infopanel_timer) {
if (m_infopanel->text ().isEmpty ())
m_dock_infopanel->undock ();
infopanel_timer = 0;
}
killTimer (e->timerId ());
}
void View::addText (const QString & str, bool eol) {
if (m_tmplog_needs_eol)
tmplog += QChar ('\n');
tmplog += str;
m_tmplog_needs_eol = eol;
if (m_widgetstack->visibleWidget () != m_widgettypes[WT_Console] &&
tmplog.length () < 7500)
return;
if (eol) {
m_multiedit->append (tmplog);
tmplog.truncate (0);
m_tmplog_needs_eol = false;
} else {
int pos = tmplog.findRev (QChar ('\n'));
if (pos >= 0) {
m_multiedit->append (tmplog.left (pos));
tmplog = tmplog.mid (pos+1);
}
}
int p = m_multiedit->paragraphs ();
if (5000 < p) {
m_multiedit->setSelection (0, 0, p - 4499, 0);
m_multiedit->removeSelectedText ();
}
m_multiedit->setCursorPosition (m_multiedit->paragraphs () - 1, 0);
}
/* void View::print (QPrinter *pPrinter)
{
QPainter printpainter;
printpainter.begin (pPrinter);
// TODO: add your printing code here
printpainter.end ();
}*/
KDE_NO_EXPORT void View::videoStart () {
if (m_dockarea->getMainDockWidget () != m_dock_video) {
// restore from an info or playlist only setting
KDockWidget * dw = m_dockarea->getMainDockWidget ();
dw->setEnableDocking (KDockWidget::DockCenter);
dw->undock ();
m_dock_video->setEnableDocking (KDockWidget::DockNone);
m_dockarea->setMainDockWidget (m_dock_video);
m_view_area->resizeEvent (0L);
}
if (m_controlpanel_mode == CP_Only) {
m_control_panel->setMaximumSize(2500, controlPanel()->preferedHeight());
setControlPanelMode (CP_Show);
}
}
KDE_NO_EXPORT void View::playingStart () {
if (m_playing) return; //FIXME: make symetric with playingStop
if (m_widgetstack->visibleWidget () == m_widgettypes[WT_Picture])
m_widgetstack->raiseWidget (m_viewer);
m_playing = true;
m_revert_fullscreen = !isFullScreen();
setControlPanelMode (m_old_controlpanel_mode);
}
KDE_NO_EXPORT void View::playingStop () {
if (m_controlpanel_mode == CP_AutoHide &&
m_widgetstack->visibleWidget () != m_widgettypes[WT_Picture]) {
m_control_panel->show ();
//m_view_area->setMouseTracking (false);
}
killTimer (controlbar_timer);
controlbar_timer = 0;
m_playing = false;
WId w = m_viewer->embeddedWinId ();
if (w)
XClearWindow (qt_xdisplay(), w);
m_view_area->resizeEvent (0L);
}
KDE_NO_EXPORT void View::leaveEvent (QEvent *) {
delayedShowButtons (false);
}
KDE_NO_EXPORT void View::reset () {
if (m_revert_fullscreen && isFullScreen())
m_control_panel->popupMenu ()->activateItemAt (m_control_panel->popupMenu ()->indexOf (ControlPanel::menu_fullscreen));
//m_view_area->fullScreen ();
playingStop ();
m_viewer->show ();
}
bool View::isFullScreen () const {
return m_view_area->isFullScreen ();
}
void View::fullScreen () {
if (!m_view_area->isFullScreen()) {
m_sreensaver_disabled = false;
QByteArray data, replydata;
QCString replyType;
if (kapp->dcopClient ()->call ("kdesktop", "KScreensaverIface",
"isEnabled()", data, replyType, replydata)) {
bool enabled;
QDataStream replystream (replydata, IO_ReadOnly);
replystream >> enabled;
if (enabled)
m_sreensaver_disabled = kapp->dcopClient()->send
("kdesktop", "KScreensaverIface", "enable(bool)", "false");
}
//if (m_keepsizeratio && m_viewer->aspect () < 0.01)
// m_viewer->setAspect (1.0 * m_viewer->width() / m_viewer->height());
m_view_area->fullScreen();
m_control_panel->popupMenu ()->setItemVisible (ControlPanel::menu_zoom, false);
m_widgetstack->visibleWidget ()->setFocus ();
} else {
if (m_sreensaver_disabled)
m_sreensaver_disabled = !kapp->dcopClient()->send
("kdesktop", "KScreensaverIface", "enable(bool)", "true");
m_view_area->fullScreen();
m_control_panel->popupMenu ()->setItemVisible (ControlPanel::menu_zoom, true);
}
setControlPanelMode (m_old_controlpanel_mode);
emit fullScreenChanged ();
}
KDE_NO_EXPORT int View::statusBarHeight () const {
if (statusBar()->isVisible () && !viewArea()->isFullScreen ()) {
if (statusBarMode () == SB_Only)
return height ();
else
return statusBar()->maximumSize ().height ();
}
return 0;
}
bool View::x11Event (XEvent * e) {
switch (e->type) {
case UnmapNotify:
if (e->xunmap.event == m_viewer->embeddedWinId ()) {
videoStart ();
//hide();
}
break;
case XKeyPress:
if (e->xkey.window == m_viewer->embeddedWinId ()) {
KeySym ksym;
char kbuf[16];
XLookupString (&e->xkey, kbuf, sizeof(kbuf), &ksym, NULL);
switch (ksym) {
case XK_f:
case XK_F:
//fullScreen ();
break;
};
}
break;
/*case ColormapNotify:
fprintf (stderr, "colormap notify\n");
return true;*/
case MotionNotify:
if (e->xmotion.window == m_viewer->embeddedWinId ())
delayedShowButtons (e->xmotion.y > m_view_area->height () -
statusBarHeight () -
m_control_panel->maximumSize ().height ());
m_view_area->mouseMoved ();
break;
case MapNotify:
if (e->xmap.event == m_viewer->embeddedWinId ()) {
show ();
QTimer::singleShot (10, m_viewer, SLOT (sendConfigureEvent ()));
}
break;
/*case ConfigureNotify:
break;
//return true;*/
default:
break;
}
return false;
}
//----------------------------------------------------------------------
KDE_NO_CDTOR_EXPORT Viewer::Viewer (QWidget *parent, View * view)
: QXEmbed (parent), m_plain_window (0), m_bgcolor (0), m_aspect (0.0),
m_view (view) {
/*XWindowAttributes xwa;
XGetWindowAttributes (qt_xdisplay(), winId (), &xwa);
XSetWindowAttributes xswa;
xswa.background_pixel = 0;
xswa.border_pixel = 0;
xswa.colormap = xwa.colormap;
create (XCreateWindow (qt_xdisplay (), parent->winId (), 0, 0, 10, 10, 0,
x11Depth (), InputOutput, (Visual*)x11Visual (),
CWBackPixel | CWBorderPixel | CWColormap, &xswa));*/
setAcceptDrops (true);
initialize ();
//setProtocol (QXEmbed::XPLAIN);
}
KDE_NO_CDTOR_EXPORT Viewer::~Viewer () {
}
KDE_NO_EXPORT void Viewer::changeProtocol (QXEmbed::Protocol p) {
kdDebug () << "changeProtocol " << (int)protocol () << "->" << p << endl;
if (!embeddedWinId () || p != protocol ()) {
if (p == QXEmbed::XPLAIN) {
setProtocol (p);
if (!m_plain_window) {
int scr = DefaultScreen (qt_xdisplay ());
m_plain_window = XCreateSimpleWindow (
qt_xdisplay(),
m_view->winId (),
0, 0, width(), height(),
1,
BlackPixel (qt_xdisplay(), scr),
BlackPixel (qt_xdisplay(), scr));
embed (m_plain_window);
}
XClearWindow (qt_xdisplay(), m_plain_window);
} else {
if (m_plain_window) {
XDestroyWindow (qt_xdisplay(), m_plain_window);
m_plain_window = 0;
XSync (qt_xdisplay (), false);
}
//setProtocol (p);
setProtocol (QXEmbed::XPLAIN);
}
}
}
KDE_NO_EXPORT void Viewer::windowChanged (WId w) {
kdDebug () << "windowChanged " << (int)w << endl;
if (w /*&& m_plain_window*/)
XSelectInput (qt_xdisplay (), w,
//KeyPressMask | KeyReleaseMask |
KeyPressMask |
//EnterWindowMask | LeaveWindowMask |
//FocusChangeMask |
ExposureMask |
StructureNotifyMask |
PointerMotionMask);
}
KDE_NO_EXPORT void Viewer::mouseMoveEvent (QMouseEvent * e) {
if (e->state () == Qt::NoButton) {
int cp_height = m_view->controlPanel ()->maximumSize ().height ();
m_view->delayedShowButtons (e->y () > height () - cp_height);
}
m_view->viewArea ()->mouseMoved ();
}
void Viewer::setAspect (float a) {
m_aspect = a;
}
KDE_NO_EXPORT int Viewer::heightForWidth (int w) const {
if (m_aspect <= 0.01)
return 0;
return int (w/m_aspect);
}
KDE_NO_EXPORT void Viewer::dropEvent (QDropEvent * de) {
m_view->dropEvent (de);
}
KDE_NO_EXPORT void Viewer::dragEnterEvent (QDragEnterEvent* dee) {
m_view->dragEnterEvent (dee);
}
/*
*/
void Viewer::sendKeyEvent (int key) {
WId w = embeddedWinId ();
if (w) {
char buf[2] = { char (key), '\0' };
KeySym keysym = XStringToKeysym (buf);
XKeyEvent event = {
XKeyPress, 0, true,
qt_xdisplay (), w, qt_xrootwin(), w,
/*time*/ 0, 0, 0, 0, 0,
0, XKeysymToKeycode (qt_xdisplay (), keysym), true
};
XSendEvent (qt_xdisplay(), w, false, KeyPressMask, (XEvent *) &event);
XFlush (qt_xdisplay ());
}
}
KDE_NO_EXPORT void Viewer::sendConfigureEvent () {
WId w = embeddedWinId ();
if (w) {
XConfigureEvent c = {
ConfigureNotify, 0UL, True,
qt_xdisplay (), w, winId (),
x (), y (), width (), height (),
0, None, False
};
XSendEvent(qt_xdisplay(),c.event,true,StructureNotifyMask,(XEvent*)&c);
XFlush (qt_xdisplay ());
}
}
KDE_NO_EXPORT void Viewer::contextMenuEvent (QContextMenuEvent * e) {
m_view->controlPanel ()->popupMenu ()->exec (e->globalPos ());
}
KDE_NO_EXPORT void Viewer::setBackgroundColor (const QColor & c) {
if (m_bgcolor != c.rgb ()) {
m_bgcolor = c.rgb ();
setCurrentBackgroundColor (c);
}
}
KDE_NO_EXPORT void Viewer::resetBackgroundColor () {
setCurrentBackgroundColor (m_bgcolor);
}
KDE_NO_EXPORT void Viewer::setCurrentBackgroundColor (const QColor & c) {
setPaletteBackgroundColor (c);
WId w = embeddedWinId ();
if (w) {
XSetWindowBackground (qt_xdisplay (), w, c.rgb ());
XFlush (qt_xdisplay ());
}
}
#include "kmplayerview.moc"

@ -0,0 +1,243 @@
/**
* Copyright (C) 2002-2003 by Koos Vriezen <koos.vriezen@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
**/
#ifndef KMPLAYERVIEW_H
#define KMPLAYERVIEW_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <qwidget.h>
#include <qtextedit.h>
#include <kdockwidget.h>
#include <kurl.h>
#include <qxembed.h>
#include <kmediaplayer/view.h>
#include "kmplayersource.h"
#define MOUSE_INVISIBLE_DELAY 2000
class QWidgetStack;
class QPixmap;
class QPaintDevice;
class QPainter;
class QSlider;
class QLabel;
class KActionCollection;
class KAction;
class KShortcut;
class KStatusBar;
class KFindDialog;
namespace KMPlayer {
class View;
class ViewArea;
class Viewer;
class ControlPanel;
class VolumeBar;
class Console;
class PlayListView;
class PlayListView;
class RootPlayListItem;
typedef KStatusBar StatusBar;
/*
* The console GUI
*/
class TextEdit : public QTextEdit {
public:
TextEdit (QWidget * parent, View * view);
protected:
void contextMenuEvent (QContextMenuEvent * e);
private:
View * m_view;
};
/*
* The infowindow GUI
*/
class InfoWindow : public QTextEdit {
public:
InfoWindow (QWidget * parent, View * view);
KDE_NO_EXPORT View * view () const { return m_view; }
protected:
void contextMenuEvent (QContextMenuEvent * e);
private:
View * m_view;
};
/*
* The view containing ViewArea and playlist
*/
class KMPLAYER_EXPORT View : public KMediaPlayer::View {
Q_OBJECT
public:
enum ControlPanelMode {
CP_Hide, CP_AutoHide, CP_Show, CP_Only /* no video widget */
};
enum StatusBarMode {
SB_Hide, SB_Show, SB_Only /* no video widget */
};
enum WidgetType {
WT_Video, WT_Console, WT_Picture, WT_Last
};
View (QWidget *parent, const char *);
~View();
void addText (const QString &, bool eol=false);
void init (KActionCollection * ac);
void reset ();
//void print(QPrinter *pPrinter);
TextEdit * console () const { return m_multiedit; }
KDE_NO_EXPORT Viewer * viewer () const { return m_viewer; }
KDE_NO_EXPORT ControlPanel * controlPanel () const {return m_control_panel;}
KDE_NO_EXPORT StatusBar * statusBar () const {return m_status_bar;}
KDE_NO_EXPORT PlayListView * playList () const { return m_playlist; }
KDE_NO_EXPORT InfoWindow * infoPanel () const { return m_infopanel; }
KDE_NO_EXPORT QWidgetStack * widgetStack () const { return m_widgetstack; }
KDE_NO_EXPORT KDockArea * docArea () const { return m_dockarea; }
KDE_NO_EXPORT ViewArea * viewArea () const { return m_view_area; }
KDE_NO_EXPORT bool keepSizeRatio () const { return m_keepsizeratio; }
void setKeepSizeRatio (bool b);
void showWidget (WidgetType w);
void setControlPanelMode (ControlPanelMode m);
void setStatusBarMode (StatusBarMode m);
void setEraseColor (const QColor &);
KDE_NO_EXPORT ControlPanelMode controlPanelMode () const { return m_controlpanel_mode; }
KDE_NO_EXPORT StatusBarMode statusBarMode () const { return m_statusbar_mode; }
void delayedShowButtons (bool show);
bool isFullScreen () const;
int statusBarHeight () const;
KDE_NO_EXPORT bool editMode () const { return m_edit_mode; }
bool setPicture (const QString & path);
KDE_NO_EXPORT QPixmap * image () const { return m_image; }
void setNoInfoMessages (bool b) { m_no_info = b; }
void setViewOnly ();
void setInfoPanelOnly ();
void setPlaylistOnly ();
void setEditMode (RootPlayListItem *, bool enable=true);
void dragEnterEvent (QDragEnterEvent *);
void dropEvent (QDropEvent *);
KDE_NO_EXPORT void emitPictureClicked () { emit pictureClicked (); }
/* raise video widget, might (auto) hides panel */
void videoStart ();
void playingStart ();
/* shows panel */
void playingStop ();
public slots:
void setVolume (int);
void updateVolume ();
void fullScreen ();
void updateLayout ();
void toggleShowPlaylist ();
void toggleVideoConsoleWindow ();
void setInfoMessage (const QString & msg);
void setStatusMessage (const QString & msg);
signals:
void urlDropped (const KURL::List & urls);
void pictureClicked ();
void fullScreenChanged ();
void windowVideoConsoleToggled (int wt);
protected:
void leaveEvent (QEvent *) KDE_NO_EXPORT;
void timerEvent (QTimerEvent *) KDE_NO_EXPORT;
bool x11Event (XEvent *) KDE_NO_EXPORT;
private:
// widget for player's output
Viewer * m_viewer;
// console output
TextEdit * m_multiedit;
// widget stack contains m_viewer, m_multiedit and m_picturewidget
QWidgetStack * m_widgetstack;
// widget that layouts m_widgetstack for ratio setting and m_control_panel
ViewArea * m_view_area;
// playlist widget
PlayListView * m_playlist;
// infopanel widget
InfoWindow * m_infopanel;
// all widget types
QWidget * m_widgettypes [WT_Last];
KDockArea * m_dockarea;
KDockWidget * m_dock_video;
KDockWidget * m_dock_playlist;
KDockWidget * m_dock_infopanel;
QString tmplog;
QPixmap * m_image;
ControlPanel * m_control_panel;
StatusBar * m_status_bar;
QSlider * m_volume_slider;
const char * m_mixer_object;
ControlPanelMode m_controlpanel_mode;
ControlPanelMode m_old_controlpanel_mode;
StatusBarMode m_statusbar_mode;
int controlbar_timer;
int infopanel_timer;
bool m_keepsizeratio;
bool m_playing;
bool m_mixer_init;
bool m_inVolumeUpdate;
bool m_sreensaver_disabled;
bool m_tmplog_needs_eol;
bool m_revert_fullscreen;
bool m_no_info;
bool m_edit_mode;
};
/*
* The video widget
*/
class KMPLAYER_EXPORT Viewer : public QXEmbed {
Q_OBJECT
public:
Viewer(QWidget *parent, View * view);
~Viewer();
int heightForWidth (int w) const;
void setAspect (float a);
float aspect () { return m_aspect; }
void sendKeyEvent (int key);
void setBackgroundColor (const QColor & c);
void resetBackgroundColor ();
void setCurrentBackgroundColor (const QColor & c);
KDE_NO_EXPORT View * view () const { return m_view; }
void changeProtocol (QXEmbed::Protocol p);
public slots:
void sendConfigureEvent ();
protected:
void dragEnterEvent (QDragEnterEvent *);
void dropEvent (QDropEvent *);
void mouseMoveEvent (QMouseEvent * e);
void contextMenuEvent (QContextMenuEvent * e);
virtual void windowChanged( WId w );
private:
WId m_plain_window;
unsigned int m_bgcolor;
float m_aspect;
View * m_view;
};
} // namespace
#endif // KMPLAYERVIEW_H

@ -0,0 +1,90 @@
/***************************************************************************
main.cpp - description
-------------------
begin : Sat Dec 7 16:14:51 CET 2002
copyright : (C) 2002 by Koos Vriezen
email :
***************************************************************************/
/***************************************************************************
* *
* 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 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <unistd.h>
#include <config.h>
#include <kcmdlineargs.h>
#include <kaboutdata.h>
#include <klocale.h>
#include <kdemacros.h>
#include <dcopclient.h>
#include <qguardedptr.h>
#include <qfileinfo.h>
#include "kmplayer.h"
static const char description[] = I18N_NOOP("KMPlayer");
static KCmdLineOptions options[] =
{
{ "+[File]", I18N_NOOP("file to open"), 0 },
KCmdLineLastOption
// INSERT YOUR COMMANDLINE OPTIONS HERE
};
extern "C" {
KDE_EXPORT int kdemain (int argc, char *argv[])
{
setsid ();
KAboutData aboutData ("kmplayer", I18N_NOOP ("KMPlayer"),
VERSION, description, KAboutData::License_GPL,
"(c) 2002-2005, Koos Vriezen", 0, 0, "");
aboutData.addAuthor( "Koos Vriezen",0, "");
KCmdLineArgs::init (argc, argv, &aboutData);
KCmdLineArgs::addCmdLineOptions (options); // Add our own options.
KMPlayer::StringPool::init();
KApplication app;
QGuardedPtr <KMPlayerApp> kmplayer;
if (app.isRestored ()) {
RESTORE (KMPlayerApp);
} else {
kmplayer = new KMPlayerApp ();
kmplayer->show();
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
KURL url;
if (args->count () == 1)
url = args->url (0);
if (args->count () > 1)
for (int i = 0; i < args->count (); i++) {
KURL url = args->url (i);
if (url.url ().find ("://") < 0)
url = KURL (QFileInfo (url.url ()).absFilePath ());
if (url.isValid ())
kmplayer->addURL (url);
}
kmplayer->openDocumentFile (url);
args->clear ();
}
app.dcopClient()->registerAs("kmplayer");
int retvalue = app.exec ();
delete kmplayer;
KMPlayer::StringPool::reset();
return retvalue;
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,199 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK *****
*
*
* This Original Code has been modified by IBM Corporation.
* Modifications made by IBM described herein are
* Copyright (c) International Business Machines
* Corporation, 2000
*
* Modifications to Mozilla code or documentation
* identified per MPL Section 3.3
*
* Date Modified by Description of modification
* 03/27/2000 IBM Corp. Set JNICALL to Optlink for
* use in OS2
*/
/*******************************************************************************
* Netscape version of jni_md.h -- depends on jri_md.h
******************************************************************************/
#ifndef JNI_MD_H
#define JNI_MD_H
#include "prtypes.h" /* needed for _declspec */
/*******************************************************************************
* WHAT'S UP WITH THIS FILE?
*
* This is where we define the mystical JNI_PUBLIC_API macro that works on all
* platforms. If you're running with Visual C++, Symantec C, or Borland's
* development environment on the PC, you're all set. Or if you're on the Mac
* with Metrowerks, Symantec or MPW with SC you're ok too. For UNIX it shouldn't
* matter.
* Changes by sailesh on 9/26
* There are two symbols used in the declaration of the JNI functions
* and native code that uses the JNI:
* JNICALL - specifies the calling convention
* JNIEXPORT - specifies export status of the function
*
* The syntax to specify calling conventions is different in Win16 and
* Win32 - the brains at Micro$oft at work here. JavaSoft in their
* infinite wisdom cares for no platform other than Win32, and so they
* just define these two symbols as:
#define JNIEXPORT __declspec(dllexport)
#define JNICALL __stdcall
* We deal with this, in the way JRI defines the JRI_PUBLIC_API, by
* defining a macro called JNI_PUBLIC_API. Any of our developers who
* wish to use code for Win16 and Win32, _must_ use JNI_PUBLIC_API to
* be able to export functions properly.
* Since we must also maintain compatibility with JavaSoft, we
* continue to define the symbol JNIEXPORT. However, use of this
* internally is deprecated, since it will cause a mess on Win16.
* We _do not_ need a new symbol called JNICALL. Instead we
* redefine JNICALL in the same way JRI_CALLBACK was defined.
******************************************************************************/
/* DLL Entry modifiers... */
#if defined(XP_OS2)
# ifdef XP_OS2_VACPP
# define JNI_PUBLIC_API(ResultType) ResultType _System
# define JNI_PUBLIC_VAR(VarType) VarType
# define JNICALL _Optlink
# define JNIEXPORT
# else
# define JNI_PUBLIC_API(ResultType) ResultType
# define JNI_PUBLIC_VAR(VarType) VarType
# define JNICALL
# define JNIEXPORT
# endif
/* Win32 */
#elif defined(XP_WIN) || defined(_WINDOWS) || defined(WIN32) || defined(_WIN32)
# include <windows.h>
# if defined(_MSC_VER) || defined(__GNUC__)
# if defined(WIN32) || defined(_WIN32)
# define JNI_PUBLIC_API(ResultType) _declspec(dllexport) ResultType __stdcall
# define JNI_PUBLIC_VAR(VarType) VarType
# define JNI_NATIVE_STUB(ResultType) _declspec(dllexport) ResultType
# define JNICALL __stdcall
# else /* !_WIN32 */
# if defined(_WINDLL)
# define JNI_PUBLIC_API(ResultType) ResultType __cdecl __export __loadds
# define JNI_PUBLIC_VAR(VarType) VarType
# define JNI_NATIVE_STUB(ResultType) ResultType __cdecl __loadds
# define JNICALL __loadds
# else /* !WINDLL */
# define JNI_PUBLIC_API(ResultType) ResultType __cdecl __export
# define JNI_PUBLIC_VAR(VarType) VarType
# define JNI_NATIVE_STUB(ResultType) ResultType __cdecl __export
# define JNICALL __export
# endif /* !WINDLL */
# endif /* !_WIN32 */
# elif defined(__BORLANDC__)
# if defined(WIN32) || defined(_WIN32)
# define JNI_PUBLIC_API(ResultType) __export ResultType
# define JNI_PUBLIC_VAR(VarType) VarType
# define JNI_NATIVE_STUB(ResultType) __export ResultType
# define JNICALL
# else /* !_WIN32 */
# define JNI_PUBLIC_API(ResultType) ResultType _cdecl _export _loadds
# define JNI_PUBLIC_VAR(VarType) VarType
# define JNI_NATIVE_STUB(ResultType) ResultType _cdecl _loadds
# define JNICALL _loadds
# endif
# else
# error Unsupported PC development environment.
# endif
# ifndef IS_LITTLE_ENDIAN
# define IS_LITTLE_ENDIAN
# endif
/* This is the stuff inherited from JavaSoft .. */
# define JNIEXPORT __declspec(dllexport)
/* Mac */
#elif macintosh || Macintosh || THINK_C
# if defined(__MWERKS__) /* Metrowerks */
# if !__option(enumsalwaysint)
# error You need to define 'Enums Always Int' for your project.
# endif
# if defined(TARGET_CPU_68K) && !TARGET_RT_MAC_CFM
# if !__option(fourbyteints)
# error You need to define 'Struct Alignment: 68k' for your project.
# endif
# endif /* !GENERATINGCFM */
# define JNI_PUBLIC_API(ResultType) __declspec(export) ResultType
# define JNI_PUBLIC_VAR(VarType) JNI_PUBLIC_API(VarType)
# define JNI_NATIVE_STUB(ResultType) JNI_PUBLIC_API(ResultType)
# elif defined(__SC__) /* Symantec */
# error What are the Symantec defines? (warren@netscape.com)
# elif macintosh && applec /* MPW */
# error Please upgrade to the latest MPW compiler (SC).
# else
# error Unsupported Mac development environment.
# endif
# define JNICALL
/* This is the stuff inherited from JavaSoft .. */
# define JNIEXPORT
/* Unix or else */
#else
# define JNI_PUBLIC_API(ResultType) ResultType
# define JNI_PUBLIC_VAR(VarType) VarType
# define JNI_NATIVE_STUB(ResultType) ResultType
# define JNICALL
/* This is the stuff inherited from JavaSoft .. */
# define JNIEXPORT
#endif
#ifndef FAR /* for non-Win16 */
#define FAR
#endif
/* Get the rest of the stuff from jri_md.h */
#include "jri_md.h"
#endif /* JNI_MD_H */

@ -0,0 +1,689 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*******************************************************************************
* Java Runtime Interface
******************************************************************************/
#ifndef JRI_H
#define JRI_H
#include "jritypes.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*******************************************************************************
* JRIEnv
******************************************************************************/
/* The type of the JRIEnv interface. */
typedef struct JRIEnvInterface JRIEnvInterface;
/* The type of a JRIEnv instance. */
typedef const JRIEnvInterface* JRIEnv;
/*******************************************************************************
* JRIEnv Operations
******************************************************************************/
#define JRI_DefineClass(env, classLoader, buf, bufLen) \
(((*(env))->DefineClass)(env, JRI_DefineClass_op, classLoader, buf, bufLen))
#define JRI_FindClass(env, name) \
(((*(env))->FindClass)(env, JRI_FindClass_op, name))
#define JRI_Throw(env, obj) \
(((*(env))->Throw)(env, JRI_Throw_op, obj))
#define JRI_ThrowNew(env, clazz, message) \
(((*(env))->ThrowNew)(env, JRI_ThrowNew_op, clazz, message))
#define JRI_ExceptionOccurred(env) \
(((*(env))->ExceptionOccurred)(env, JRI_ExceptionOccurred_op))
#define JRI_ExceptionDescribe(env) \
(((*(env))->ExceptionDescribe)(env, JRI_ExceptionDescribe_op))
#define JRI_ExceptionClear(env) \
(((*(env))->ExceptionClear)(env, JRI_ExceptionClear_op))
#define JRI_NewGlobalRef(env, ref) \
(((*(env))->NewGlobalRef)(env, JRI_NewGlobalRef_op, ref))
#define JRI_DisposeGlobalRef(env, gref) \
(((*(env))->DisposeGlobalRef)(env, JRI_DisposeGlobalRef_op, gref))
#define JRI_GetGlobalRef(env, gref) \
(((*(env))->GetGlobalRef)(env, JRI_GetGlobalRef_op, gref))
#define JRI_SetGlobalRef(env, gref, ref) \
(((*(env))->SetGlobalRef)(env, JRI_SetGlobalRef_op, gref, ref))
#define JRI_IsSameObject(env, a, b) \
(((*(env))->IsSameObject)(env, JRI_IsSameObject_op, a, b))
#define JRI_NewObject(env) ((*(env))->NewObject)
#define JRI_NewObjectV(env, clazz, methodID, args) \
(((*(env))->NewObjectV)(env, JRI_NewObject_op_va_list, clazz, methodID, args))
#define JRI_NewObjectA(env, clazz, method, args) \
(((*(env))->NewObjectA)(env, JRI_NewObject_op_array, clazz, methodID, args))
#define JRI_GetObjectClass(env, obj) \
(((*(env))->GetObjectClass)(env, JRI_GetObjectClass_op, obj))
#define JRI_IsInstanceOf(env, obj, clazz) \
(((*(env))->IsInstanceOf)(env, JRI_IsInstanceOf_op, obj, clazz))
#define JRI_GetMethodID(env, clazz, name, sig) \
(((*(env))->GetMethodID)(env, JRI_GetMethodID_op, clazz, name, sig))
#define JRI_CallMethod(env) ((*(env))->CallMethod)
#define JRI_CallMethodV(env, obj, methodID, args) \
(((*(env))->CallMethodV)(env, JRI_CallMethod_op_va_list, obj, methodID, args))
#define JRI_CallMethodA(env, obj, methodID, args) \
(((*(env))->CallMethodA)(env, JRI_CallMethod_op_array, obj, methodID, args))
#define JRI_CallMethodBoolean(env) ((*(env))->CallMethodBoolean)
#define JRI_CallMethodBooleanV(env, obj, methodID, args) \
(((*(env))->CallMethodBooleanV)(env, JRI_CallMethodBoolean_op_va_list, obj, methodID, args))
#define JRI_CallMethodBooleanA(env, obj, methodID, args) \
(((*(env))->CallMethodBooleanA)(env, JRI_CallMethodBoolean_op_array, obj, methodID, args))
#define JRI_CallMethodByte(env) ((*(env))->CallMethodByte)
#define JRI_CallMethodByteV(env, obj, methodID, args) \
(((*(env))->CallMethodByteV)(env, JRI_CallMethodByte_op_va_list, obj, methodID, args))
#define JRI_CallMethodByteA(env, obj, methodID, args) \
(((*(env))->CallMethodByteA)(env, JRI_CallMethodByte_op_array, obj, methodID, args))
#define JRI_CallMethodChar(env) ((*(env))->CallMethodChar)
#define JRI_CallMethodCharV(env, obj, methodID, args) \
(((*(env))->CallMethodCharV)(env, JRI_CallMethodChar_op_va_list, obj, methodID, args))
#define JRI_CallMethodCharA(env, obj, methodID, args) \
(((*(env))->CallMethodCharA)(env, JRI_CallMethodChar_op_array, obj, methodID, args))
#define JRI_CallMethodShort(env) ((*(env))->CallMethodShort)
#define JRI_CallMethodShortV(env, obj, methodID, args) \
(((*(env))->CallMethodShortV)(env, JRI_CallMethodShort_op_va_list, obj, methodID, args))
#define JRI_CallMethodShortA(env, obj, methodID, args) \
(((*(env))->CallMethodShortA)(env, JRI_CallMethodShort_op_array, obj, methodID, args))
#define JRI_CallMethodInt(env) ((*(env))->CallMethodInt)
#define JRI_CallMethodIntV(env, obj, methodID, args) \
(((*(env))->CallMethodIntV)(env, JRI_CallMethodInt_op_va_list, obj, methodID, args))
#define JRI_CallMethodIntA(env, obj, methodID, args) \
(((*(env))->CallMethodIntA)(env, JRI_CallMethodInt_op_array, obj, methodID, args))
#define JRI_CallMethodLong(env) ((*(env))->CallMethodLong)
#define JRI_CallMethodLongV(env, obj, methodID, args) \
(((*(env))->CallMethodLongV)(env, JRI_CallMethodLong_op_va_list, obj, methodID, args))
#define JRI_CallMethodLongA(env, obj, methodID, args) \
(((*(env))->CallMethodLongA)(env, JRI_CallMethodLong_op_array, obj, methodID, args))
#define JRI_CallMethodFloat(env) ((*(env))->CallMethodFloat)
#define JRI_CallMethodFloatV(env, obj, methodID, args) \
(((*(env))->CallMethodFloatV)(env, JRI_CallMethodFloat_op_va_list, obj, methodID, args))
#define JRI_CallMethodFloatA(env, obj, methodID, args) \
(((*(env))->CallMethodFloatA)(env, JRI_CallMethodFloat_op_array, obj, methodID, args))
#define JRI_CallMethodDouble(env) ((*(env))->CallMethodDouble)
#define JRI_CallMethodDoubleV(env, obj, methodID, args) \
(((*(env))->CallMethodDoubleV)(env, JRI_CallMethodDouble_op_va_list, obj, methodID, args))
#define JRI_CallMethodDoubleA(env, obj, methodID, args) \
(((*(env))->CallMethodDoubleA)(env, JRI_CallMethodDouble_op_array, obj, methodID, args))
#define JRI_GetFieldID(env, clazz, name, sig) \
(((*(env))->GetFieldID)(env, JRI_GetFieldID_op, clazz, name, sig))
#define JRI_GetField(env, obj, fieldID) \
(((*(env))->GetField)(env, JRI_GetField_op, obj, fieldID))
#define JRI_GetFieldBoolean(env, obj, fieldID) \
(((*(env))->GetFieldBoolean)(env, JRI_GetFieldBoolean_op, obj, fieldID))
#define JRI_GetFieldByte(env, obj, fieldID) \
(((*(env))->GetFieldByte)(env, JRI_GetFieldByte_op, obj, fieldID))
#define JRI_GetFieldChar(env, obj, fieldID) \
(((*(env))->GetFieldChar)(env, JRI_GetFieldChar_op, obj, fieldID))
#define JRI_GetFieldShort(env, obj, fieldID) \
(((*(env))->GetFieldShort)(env, JRI_GetFieldShort_op, obj, fieldID))
#define JRI_GetFieldInt(env, obj, fieldID) \
(((*(env))->GetFieldInt)(env, JRI_GetFieldInt_op, obj, fieldID))
#define JRI_GetFieldLong(env, obj, fieldID) \
(((*(env))->GetFieldLong)(env, JRI_GetFieldLong_op, obj, fieldID))
#define JRI_GetFieldFloat(env, obj, fieldID) \
(((*(env))->GetFieldFloat)(env, JRI_GetFieldFloat_op, obj, fieldID))
#define JRI_GetFieldDouble(env, obj, fieldID) \
(((*(env))->GetFieldDouble)(env, JRI_GetFieldDouble_op, obj, fieldID))
#define JRI_SetField(env, obj, fieldID, value) \
(((*(env))->SetField)(env, JRI_SetField_op, obj, fieldID, value))
#define JRI_SetFieldBoolean(env, obj, fieldID, value) \
(((*(env))->SetFieldBoolean)(env, JRI_SetFieldBoolean_op, obj, fieldID, value))
#define JRI_SetFieldByte(env, obj, fieldID, value) \
(((*(env))->SetFieldByte)(env, JRI_SetFieldByte_op, obj, fieldID, value))
#define JRI_SetFieldChar(env, obj, fieldID, value) \
(((*(env))->SetFieldChar)(env, JRI_SetFieldChar_op, obj, fieldID, value))
#define JRI_SetFieldShort(env, obj, fieldID, value) \
(((*(env))->SetFieldShort)(env, JRI_SetFieldShort_op, obj, fieldID, value))
#define JRI_SetFieldInt(env, obj, fieldID, value) \
(((*(env))->SetFieldInt)(env, JRI_SetFieldInt_op, obj, fieldID, value))
#define JRI_SetFieldLong(env, obj, fieldID, value) \
(((*(env))->SetFieldLong)(env, JRI_SetFieldLong_op, obj, fieldID, value))
#define JRI_SetFieldFloat(env, obj, fieldID, value) \
(((*(env))->SetFieldFloat)(env, JRI_SetFieldFloat_op, obj, fieldID, value))
#define JRI_SetFieldDouble(env, obj, fieldID, value) \
(((*(env))->SetFieldDouble)(env, JRI_SetFieldDouble_op, obj, fieldID, value))
#define JRI_IsSubclassOf(env, a, b) \
(((*(env))->IsSubclassOf)(env, JRI_IsSubclassOf_op, a, b))
#define JRI_GetStaticMethodID(env, clazz, name, sig) \
(((*(env))->GetStaticMethodID)(env, JRI_GetStaticMethodID_op, clazz, name, sig))
#define JRI_CallStaticMethod(env) ((*(env))->CallStaticMethod)
#define JRI_CallStaticMethodV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodV)(env, JRI_CallStaticMethod_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodA)(env, JRI_CallStaticMethod_op_array, clazz, methodID, args))
#define JRI_CallStaticMethodBoolean(env) ((*(env))->CallStaticMethodBoolean)
#define JRI_CallStaticMethodBooleanV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodBooleanV)(env, JRI_CallStaticMethodBoolean_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodBooleanA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodBooleanA)(env, JRI_CallStaticMethodBoolean_op_array, clazz, methodID, args))
#define JRI_CallStaticMethodByte(env) ((*(env))->CallStaticMethodByte)
#define JRI_CallStaticMethodByteV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodByteV)(env, JRI_CallStaticMethodByte_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodByteA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodByteA)(env, JRI_CallStaticMethodByte_op_array, clazz, methodID, args))
#define JRI_CallStaticMethodChar(env) ((*(env))->CallStaticMethodChar)
#define JRI_CallStaticMethodCharV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodCharV)(env, JRI_CallStaticMethodChar_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodCharA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodCharA)(env, JRI_CallStaticMethodChar_op_array, clazz, methodID, args))
#define JRI_CallStaticMethodShort(env) ((*(env))->CallStaticMethodShort)
#define JRI_CallStaticMethodShortV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodShortV)(env, JRI_CallStaticMethodShort_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodShortA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodShortA)(env, JRI_CallStaticMethodShort_op_array, clazz, methodID, args))
#define JRI_CallStaticMethodInt(env) ((*(env))->CallStaticMethodInt)
#define JRI_CallStaticMethodIntV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodIntV)(env, JRI_CallStaticMethodInt_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodIntA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodIntA)(env, JRI_CallStaticMethodInt_op_array, clazz, methodID, args))
#define JRI_CallStaticMethodLong(env) ((*(env))->CallStaticMethodLong)
#define JRI_CallStaticMethodLongV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodLongV)(env, JRI_CallStaticMethodLong_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodLongA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodLongA)(env, JRI_CallStaticMethodLong_op_array, clazz, methodID, args))
#define JRI_CallStaticMethodFloat(env) ((*(env))->CallStaticMethodFloat)
#define JRI_CallStaticMethodFloatV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodFloatV)(env, JRI_CallStaticMethodFloat_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodFloatA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodFloatA)(env, JRI_CallStaticMethodFloat_op_array, clazz, methodID, args))
#define JRI_CallStaticMethodDouble(env) ((*(env))->CallStaticMethodDouble)
#define JRI_CallStaticMethodDoubleV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodDoubleV)(env, JRI_CallStaticMethodDouble_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodDoubleA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodDoubleA)(env, JRI_CallStaticMethodDouble_op_array, clazz, methodID, args))
#define JRI_GetStaticFieldID(env, clazz, name, sig) \
(((*(env))->GetStaticFieldID)(env, JRI_GetStaticFieldID_op, clazz, name, sig))
#define JRI_GetStaticField(env, clazz, fieldID) \
(((*(env))->GetStaticField)(env, JRI_GetStaticField_op, clazz, fieldID))
#define JRI_GetStaticFieldBoolean(env, clazz, fieldID) \
(((*(env))->GetStaticFieldBoolean)(env, JRI_GetStaticFieldBoolean_op, clazz, fieldID))
#define JRI_GetStaticFieldByte(env, clazz, fieldID) \
(((*(env))->GetStaticFieldByte)(env, JRI_GetStaticFieldByte_op, clazz, fieldID))
#define JRI_GetStaticFieldChar(env, clazz, fieldID) \
(((*(env))->GetStaticFieldChar)(env, JRI_GetStaticFieldChar_op, clazz, fieldID))
#define JRI_GetStaticFieldShort(env, clazz, fieldID) \
(((*(env))->GetStaticFieldShort)(env, JRI_GetStaticFieldShort_op, clazz, fieldID))
#define JRI_GetStaticFieldInt(env, clazz, fieldID) \
(((*(env))->GetStaticFieldInt)(env, JRI_GetStaticFieldInt_op, clazz, fieldID))
#define JRI_GetStaticFieldLong(env, clazz, fieldID) \
(((*(env))->GetStaticFieldLong)(env, JRI_GetStaticFieldLong_op, clazz, fieldID))
#define JRI_GetStaticFieldFloat(env, clazz, fieldID) \
(((*(env))->GetStaticFieldFloat)(env, JRI_GetStaticFieldFloat_op, clazz, fieldID))
#define JRI_GetStaticFieldDouble(env, clazz, fieldID) \
(((*(env))->GetStaticFieldDouble)(env, JRI_GetStaticFieldDouble_op, clazz, fieldID))
#define JRI_SetStaticField(env, clazz, fieldID, value) \
(((*(env))->SetStaticField)(env, JRI_SetStaticField_op, clazz, fieldID, value))
#define JRI_SetStaticFieldBoolean(env, clazz, fieldID, value) \
(((*(env))->SetStaticFieldBoolean)(env, JRI_SetStaticFieldBoolean_op, clazz, fieldID, value))
#define JRI_SetStaticFieldByte(env, clazz, fieldID, value) \
(((*(env))->SetStaticFieldByte)(env, JRI_SetStaticFieldByte_op, clazz, fieldID, value))
#define JRI_SetStaticFieldChar(env, clazz, fieldID, value) \
(((*(env))->SetStaticFieldChar)(env, JRI_SetStaticFieldChar_op, clazz, fieldID, value))
#define JRI_SetStaticFieldShort(env, clazz, fieldID, value) \
(((*(env))->SetStaticFieldShort)(env, JRI_SetStaticFieldShort_op, clazz, fieldID, value))
#define JRI_SetStaticFieldInt(env, clazz, fieldID, value) \
(((*(env))->SetStaticFieldInt)(env, JRI_SetStaticFieldInt_op, clazz, fieldID, value))
#define JRI_SetStaticFieldLong(env, clazz, fieldID, value) \
(((*(env))->SetStaticFieldLong)(env, JRI_SetStaticFieldLong_op, clazz, fieldID, value))
#define JRI_SetStaticFieldFloat(env, clazz, fieldID, value) \
(((*(env))->SetStaticFieldFloat)(env, JRI_SetStaticFieldFloat_op, clazz, fieldID, value))
#define JRI_SetStaticFieldDouble(env, clazz, fieldID, value) \
(((*(env))->SetStaticFieldDouble)(env, JRI_SetStaticFieldDouble_op, clazz, fieldID, value))
#define JRI_NewString(env, unicode, len) \
(((*(env))->NewString)(env, JRI_NewString_op, unicode, len))
#define JRI_GetStringLength(env, string) \
(((*(env))->GetStringLength)(env, JRI_GetStringLength_op, string))
#define JRI_GetStringChars(env, string) \
(((*(env))->GetStringChars)(env, JRI_GetStringChars_op, string))
#define JRI_NewStringUTF(env, utf, len) \
(((*(env))->NewStringUTF)(env, JRI_NewStringUTF_op, utf, len))
#define JRI_GetStringUTFLength(env, string) \
(((*(env))->GetStringUTFLength)(env, JRI_GetStringUTFLength_op, string))
#define JRI_GetStringUTFChars(env, string) \
(((*(env))->GetStringUTFChars)(env, JRI_GetStringUTFChars_op, string))
#define JRI_NewScalarArray(env, length, elementSig, initialElements) \
(((*(env))->NewScalarArray)(env, JRI_NewScalarArray_op, length, elementSig, initialElements))
#define JRI_GetScalarArrayLength(env, array) \
(((*(env))->GetScalarArrayLength)(env, JRI_GetScalarArrayLength_op, array))
#define JRI_GetScalarArrayElements(env, array) \
(((*(env))->GetScalarArrayElements)(env, JRI_GetScalarArrayElements_op, array))
#define JRI_NewObjectArray(env, length, elementClass, initialElement) \
(((*(env))->NewObjectArray)(env, JRI_NewObjectArray_op, length, elementClass, initialElement))
#define JRI_GetObjectArrayLength(env, array) \
(((*(env))->GetObjectArrayLength)(env, JRI_GetObjectArrayLength_op, array))
#define JRI_GetObjectArrayElement(env, array, index) \
(((*(env))->GetObjectArrayElement)(env, JRI_GetObjectArrayElement_op, array, index))
#define JRI_SetObjectArrayElement(env, array, index, value) \
(((*(env))->SetObjectArrayElement)(env, JRI_SetObjectArrayElement_op, array, index, value))
#define JRI_RegisterNatives(env, clazz, nameAndSigArray, nativeProcArray) \
(((*(env))->RegisterNatives)(env, JRI_RegisterNatives_op, clazz, nameAndSigArray, nativeProcArray))
#define JRI_UnregisterNatives(env, clazz) \
(((*(env))->UnregisterNatives)(env, JRI_UnregisterNatives_op, clazz))
#define JRI_NewStringPlatform(env, string, len, encoding, encodingLength) \
(((*(env))->NewStringPlatform)(env, JRI_NewStringPlatform_op, string, len, encoding, encodingLength))
#define JRI_GetStringPlatformChars(env, string, encoding, encodingLength) \
(((*(env))->GetStringPlatformChars)(env, JRI_GetStringPlatformChars_op, string, encoding, encodingLength))
/*******************************************************************************
* JRIEnv Interface
******************************************************************************/
struct java_lang_ClassLoader;
struct java_lang_Class;
struct java_lang_Throwable;
struct java_lang_Object;
struct java_lang_String;
struct JRIEnvInterface {
void* reserved0;
void* reserved1;
void* reserved2;
void* reserved3;
struct java_lang_Class* (*FindClass)(JRIEnv* env, jint op, const char* a);
void (*Throw)(JRIEnv* env, jint op, struct java_lang_Throwable* a);
void (*ThrowNew)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b);
struct java_lang_Throwable* (*ExceptionOccurred)(JRIEnv* env, jint op);
void (*ExceptionDescribe)(JRIEnv* env, jint op);
void (*ExceptionClear)(JRIEnv* env, jint op);
jglobal (*NewGlobalRef)(JRIEnv* env, jint op, void* a);
void (*DisposeGlobalRef)(JRIEnv* env, jint op, jglobal a);
void* (*GetGlobalRef)(JRIEnv* env, jint op, jglobal a);
void (*SetGlobalRef)(JRIEnv* env, jint op, jglobal a, void* b);
jbool (*IsSameObject)(JRIEnv* env, jint op, void* a, void* b);
void* (*NewObject)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
void* (*NewObjectV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
void* (*NewObjectA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
struct java_lang_Class* (*GetObjectClass)(JRIEnv* env, jint op, void* a);
jbool (*IsInstanceOf)(JRIEnv* env, jint op, void* a, struct java_lang_Class* b);
jint (*GetMethodID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c);
void* (*CallMethod)(JRIEnv* env, jint op, void* a, jint b, ...);
void* (*CallMethodV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
void* (*CallMethodA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jbool (*CallMethodBoolean)(JRIEnv* env, jint op, void* a, jint b, ...);
jbool (*CallMethodBooleanV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
jbool (*CallMethodBooleanA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jbyte (*CallMethodByte)(JRIEnv* env, jint op, void* a, jint b, ...);
jbyte (*CallMethodByteV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
jbyte (*CallMethodByteA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jchar (*CallMethodChar)(JRIEnv* env, jint op, void* a, jint b, ...);
jchar (*CallMethodCharV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
jchar (*CallMethodCharA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jshort (*CallMethodShort)(JRIEnv* env, jint op, void* a, jint b, ...);
jshort (*CallMethodShortV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
jshort (*CallMethodShortA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jint (*CallMethodInt)(JRIEnv* env, jint op, void* a, jint b, ...);
jint (*CallMethodIntV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
jint (*CallMethodIntA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jlong (*CallMethodLong)(JRIEnv* env, jint op, void* a, jint b, ...);
jlong (*CallMethodLongV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
jlong (*CallMethodLongA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jfloat (*CallMethodFloat)(JRIEnv* env, jint op, void* a, jint b, ...);
jfloat (*CallMethodFloatV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
jfloat (*CallMethodFloatA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jdouble (*CallMethodDouble)(JRIEnv* env, jint op, void* a, jint b, ...);
jdouble (*CallMethodDoubleV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
jdouble (*CallMethodDoubleA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jint (*GetFieldID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c);
void* (*GetField)(JRIEnv* env, jint op, void* a, jint b);
jbool (*GetFieldBoolean)(JRIEnv* env, jint op, void* a, jint b);
jbyte (*GetFieldByte)(JRIEnv* env, jint op, void* a, jint b);
jchar (*GetFieldChar)(JRIEnv* env, jint op, void* a, jint b);
jshort (*GetFieldShort)(JRIEnv* env, jint op, void* a, jint b);
jint (*GetFieldInt)(JRIEnv* env, jint op, void* a, jint b);
jlong (*GetFieldLong)(JRIEnv* env, jint op, void* a, jint b);
jfloat (*GetFieldFloat)(JRIEnv* env, jint op, void* a, jint b);
jdouble (*GetFieldDouble)(JRIEnv* env, jint op, void* a, jint b);
void (*SetField)(JRIEnv* env, jint op, void* a, jint b, void* c);
void (*SetFieldBoolean)(JRIEnv* env, jint op, void* a, jint b, jbool c);
void (*SetFieldByte)(JRIEnv* env, jint op, void* a, jint b, jbyte c);
void (*SetFieldChar)(JRIEnv* env, jint op, void* a, jint b, jchar c);
void (*SetFieldShort)(JRIEnv* env, jint op, void* a, jint b, jshort c);
void (*SetFieldInt)(JRIEnv* env, jint op, void* a, jint b, jint c);
void (*SetFieldLong)(JRIEnv* env, jint op, void* a, jint b, jlong c);
void (*SetFieldFloat)(JRIEnv* env, jint op, void* a, jint b, jfloat c);
void (*SetFieldDouble)(JRIEnv* env, jint op, void* a, jint b, jdouble c);
jbool (*IsSubclassOf)(JRIEnv* env, jint op, struct java_lang_Class* a, struct java_lang_Class* b);
jint (*GetStaticMethodID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c);
void* (*CallStaticMethod)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
void* (*CallStaticMethodV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
void* (*CallStaticMethodA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jbool (*CallStaticMethodBoolean)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
jbool (*CallStaticMethodBooleanV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
jbool (*CallStaticMethodBooleanA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jbyte (*CallStaticMethodByte)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
jbyte (*CallStaticMethodByteV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
jbyte (*CallStaticMethodByteA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jchar (*CallStaticMethodChar)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
jchar (*CallStaticMethodCharV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
jchar (*CallStaticMethodCharA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jshort (*CallStaticMethodShort)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
jshort (*CallStaticMethodShortV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
jshort (*CallStaticMethodShortA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jint (*CallStaticMethodInt)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
jint (*CallStaticMethodIntV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
jint (*CallStaticMethodIntA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jlong (*CallStaticMethodLong)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
jlong (*CallStaticMethodLongV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
jlong (*CallStaticMethodLongA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jfloat (*CallStaticMethodFloat)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
jfloat (*CallStaticMethodFloatV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
jfloat (*CallStaticMethodFloatA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jdouble (*CallStaticMethodDouble)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
jdouble (*CallStaticMethodDoubleV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
jdouble (*CallStaticMethodDoubleA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jint (*GetStaticFieldID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c);
void* (*GetStaticField)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
jbool (*GetStaticFieldBoolean)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
jbyte (*GetStaticFieldByte)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
jchar (*GetStaticFieldChar)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
jshort (*GetStaticFieldShort)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
jint (*GetStaticFieldInt)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
jlong (*GetStaticFieldLong)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
jfloat (*GetStaticFieldFloat)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
jdouble (*GetStaticFieldDouble)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
void (*SetStaticField)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, void* c);
void (*SetStaticFieldBoolean)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jbool c);
void (*SetStaticFieldByte)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jbyte c);
void (*SetStaticFieldChar)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jchar c);
void (*SetStaticFieldShort)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jshort c);
void (*SetStaticFieldInt)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jint c);
void (*SetStaticFieldLong)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jlong c);
void (*SetStaticFieldFloat)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jfloat c);
void (*SetStaticFieldDouble)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jdouble c);
struct java_lang_String* (*NewString)(JRIEnv* env, jint op, const jchar* a, jint b);
jint (*GetStringLength)(JRIEnv* env, jint op, struct java_lang_String* a);
const jchar* (*GetStringChars)(JRIEnv* env, jint op, struct java_lang_String* a);
struct java_lang_String* (*NewStringUTF)(JRIEnv* env, jint op, const jbyte* a, jint b);
jint (*GetStringUTFLength)(JRIEnv* env, jint op, struct java_lang_String* a);
const jbyte* (*GetStringUTFChars)(JRIEnv* env, jint op, struct java_lang_String* a);
void* (*NewScalarArray)(JRIEnv* env, jint op, jint a, const char* b, const jbyte* c);
jint (*GetScalarArrayLength)(JRIEnv* env, jint op, void* a);
jbyte* (*GetScalarArrayElements)(JRIEnv* env, jint op, void* a);
void* (*NewObjectArray)(JRIEnv* env, jint op, jint a, struct java_lang_Class* b, void* c);
jint (*GetObjectArrayLength)(JRIEnv* env, jint op, void* a);
void* (*GetObjectArrayElement)(JRIEnv* env, jint op, void* a, jint b);
void (*SetObjectArrayElement)(JRIEnv* env, jint op, void* a, jint b, void* c);
void (*RegisterNatives)(JRIEnv* env, jint op, struct java_lang_Class* a, char** b, void** c);
void (*UnregisterNatives)(JRIEnv* env, jint op, struct java_lang_Class* a);
struct java_lang_Class* (*DefineClass)(JRIEnv* env, jint op, struct java_lang_ClassLoader* a, jbyte* b, jsize bLen);
struct java_lang_String* (*NewStringPlatform)(JRIEnv* env, jint op, const jbyte* a, jint b, const jbyte* c, jint d);
const jbyte* (*GetStringPlatformChars)(JRIEnv* env, jint op, struct java_lang_String* a, const jbyte* b, jint c);
};
/*
** ****************************************************************************
** JRIEnv Operation IDs
** ***************************************************************************
*/
typedef enum JRIEnvOperations {
JRI_Reserved0_op,
JRI_Reserved1_op,
JRI_Reserved2_op,
JRI_Reserved3_op,
JRI_FindClass_op,
JRI_Throw_op,
JRI_ThrowNew_op,
JRI_ExceptionOccurred_op,
JRI_ExceptionDescribe_op,
JRI_ExceptionClear_op,
JRI_NewGlobalRef_op,
JRI_DisposeGlobalRef_op,
JRI_GetGlobalRef_op,
JRI_SetGlobalRef_op,
JRI_IsSameObject_op,
JRI_NewObject_op,
JRI_NewObject_op_va_list,
JRI_NewObject_op_array,
JRI_GetObjectClass_op,
JRI_IsInstanceOf_op,
JRI_GetMethodID_op,
JRI_CallMethod_op,
JRI_CallMethod_op_va_list,
JRI_CallMethod_op_array,
JRI_CallMethodBoolean_op,
JRI_CallMethodBoolean_op_va_list,
JRI_CallMethodBoolean_op_array,
JRI_CallMethodByte_op,
JRI_CallMethodByte_op_va_list,
JRI_CallMethodByte_op_array,
JRI_CallMethodChar_op,
JRI_CallMethodChar_op_va_list,
JRI_CallMethodChar_op_array,
JRI_CallMethodShort_op,
JRI_CallMethodShort_op_va_list,
JRI_CallMethodShort_op_array,
JRI_CallMethodInt_op,
JRI_CallMethodInt_op_va_list,
JRI_CallMethodInt_op_array,
JRI_CallMethodLong_op,
JRI_CallMethodLong_op_va_list,
JRI_CallMethodLong_op_array,
JRI_CallMethodFloat_op,
JRI_CallMethodFloat_op_va_list,
JRI_CallMethodFloat_op_array,
JRI_CallMethodDouble_op,
JRI_CallMethodDouble_op_va_list,
JRI_CallMethodDouble_op_array,
JRI_GetFieldID_op,
JRI_GetField_op,
JRI_GetFieldBoolean_op,
JRI_GetFieldByte_op,
JRI_GetFieldChar_op,
JRI_GetFieldShort_op,
JRI_GetFieldInt_op,
JRI_GetFieldLong_op,
JRI_GetFieldFloat_op,
JRI_GetFieldDouble_op,
JRI_SetField_op,
JRI_SetFieldBoolean_op,
JRI_SetFieldByte_op,
JRI_SetFieldChar_op,
JRI_SetFieldShort_op,
JRI_SetFieldInt_op,
JRI_SetFieldLong_op,
JRI_SetFieldFloat_op,
JRI_SetFieldDouble_op,
JRI_IsSubclassOf_op,
JRI_GetStaticMethodID_op,
JRI_CallStaticMethod_op,
JRI_CallStaticMethod_op_va_list,
JRI_CallStaticMethod_op_array,
JRI_CallStaticMethodBoolean_op,
JRI_CallStaticMethodBoolean_op_va_list,
JRI_CallStaticMethodBoolean_op_array,
JRI_CallStaticMethodByte_op,
JRI_CallStaticMethodByte_op_va_list,
JRI_CallStaticMethodByte_op_array,
JRI_CallStaticMethodChar_op,
JRI_CallStaticMethodChar_op_va_list,
JRI_CallStaticMethodChar_op_array,
JRI_CallStaticMethodShort_op,
JRI_CallStaticMethodShort_op_va_list,
JRI_CallStaticMethodShort_op_array,
JRI_CallStaticMethodInt_op,
JRI_CallStaticMethodInt_op_va_list,
JRI_CallStaticMethodInt_op_array,
JRI_CallStaticMethodLong_op,
JRI_CallStaticMethodLong_op_va_list,
JRI_CallStaticMethodLong_op_array,
JRI_CallStaticMethodFloat_op,
JRI_CallStaticMethodFloat_op_va_list,
JRI_CallStaticMethodFloat_op_array,
JRI_CallStaticMethodDouble_op,
JRI_CallStaticMethodDouble_op_va_list,
JRI_CallStaticMethodDouble_op_array,
JRI_GetStaticFieldID_op,
JRI_GetStaticField_op,
JRI_GetStaticFieldBoolean_op,
JRI_GetStaticFieldByte_op,
JRI_GetStaticFieldChar_op,
JRI_GetStaticFieldShort_op,
JRI_GetStaticFieldInt_op,
JRI_GetStaticFieldLong_op,
JRI_GetStaticFieldFloat_op,
JRI_GetStaticFieldDouble_op,
JRI_SetStaticField_op,
JRI_SetStaticFieldBoolean_op,
JRI_SetStaticFieldByte_op,
JRI_SetStaticFieldChar_op,
JRI_SetStaticFieldShort_op,
JRI_SetStaticFieldInt_op,
JRI_SetStaticFieldLong_op,
JRI_SetStaticFieldFloat_op,
JRI_SetStaticFieldDouble_op,
JRI_NewString_op,
JRI_GetStringLength_op,
JRI_GetStringChars_op,
JRI_NewStringUTF_op,
JRI_GetStringUTFLength_op,
JRI_GetStringUTFChars_op,
JRI_NewScalarArray_op,
JRI_GetScalarArrayLength_op,
JRI_GetScalarArrayElements_op,
JRI_NewObjectArray_op,
JRI_GetObjectArrayLength_op,
JRI_GetObjectArrayElement_op,
JRI_SetObjectArrayElement_op,
JRI_RegisterNatives_op,
JRI_UnregisterNatives_op,
JRI_DefineClass_op,
JRI_NewStringPlatform_op,
JRI_GetStringPlatformChars_op
} JRIEnvOperations;
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif /* JRI_H */
/******************************************************************************/

@ -0,0 +1,565 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*******************************************************************************
* Java Runtime Interface - Machine Dependent Types
******************************************************************************/
#ifndef JRI_MD_H
#define JRI_MD_H
#include <assert.h>
#include "prtypes.h" /* Needed for HAS_LONG_LONG ifdefs */
#ifdef __cplusplus
extern "C" {
#endif
/*******************************************************************************
* WHAT'S UP WITH THIS FILE?
*
* This is where we define the mystical JRI_PUBLIC_API macro that works on all
* platforms. If you're running with Visual C++, Symantec C, or Borland's
* development environment on the PC, you're all set. Or if you're on the Mac
* with Metrowerks, Symantec or MPW with SC you're ok too. For UNIX it shouldn't
* matter.
*
* On UNIX though you probably care about a couple of other symbols though:
* IS_LITTLE_ENDIAN must be defined for little-endian systems
* HAVE_LONG_LONG must be defined on systems that have 'long long' integers
* HAVE_ALIGNED_LONGLONGS must be defined if long-longs must be 8 byte aligned
* HAVE_ALIGNED_DOUBLES must be defined if doubles must be 8 byte aligned
* IS_64 must be defined on 64-bit machines (like Dec Alpha)
******************************************************************************/
/* DLL Entry modifiers... */
/* PC */
#if defined(XP_OS2)
# ifdef XP_OS2_VACPP
# define JRI_PUBLIC_API(ResultType) ResultType _Optlink
# define JRI_PUBLIC_VAR(VarType) VarType
# define JRI_CALLBACK
# else
# define JRI_PUBLIC_API(ResultType) ResultType
# define JRI_PUBLIC_VAR(VarType) VarType
# define JRI_CALLBACK
# endif
#elif defined(XP_WIN) || defined(_WINDOWS) || defined(WIN32) || defined(_WIN32)
# include <windows.h>
# if defined(_MSC_VER) || defined(__GNUC__)
# if defined(WIN32) || defined(_WIN32)
# define JRI_PUBLIC_API(ResultType) __declspec(dllexport) ResultType
# define JRI_PUBLIC_VAR(VarType) VarType
# define JRI_PUBLIC_VAR_EXP(VarType) __declspec(dllexport) VarType
# define JRI_PUBLIC_VAR_IMP(VarType) __declspec(dllimport) VarType
# define JRI_NATIVE_STUB(ResultType) __declspec(dllexport) ResultType
# define JRI_CALLBACK
# else /* !_WIN32 */
# if defined(_WINDLL)
# define JRI_PUBLIC_API(ResultType) ResultType __cdecl __export __loadds
# define JRI_PUBLIC_VAR(VarType) VarType
# define JRI_PUBLIC_VAR_EXP(VarType) JRI_PUBLIC_VAR(VarType)
# define JRI_PUBLIC_VAR_IMP(VarType) JRI_PUBLIC_VAR(VarType)
# define JRI_NATIVE_STUB(ResultType) ResultType __cdecl __loadds
# define JRI_CALLBACK __loadds
# else /* !WINDLL */
# define JRI_PUBLIC_API(ResultType) ResultType __cdecl __export
# define JRI_PUBLIC_VAR(VarType) VarType
# define JRI_PUBLIC_VAR_EXP(VarType) JRI_PUBLIC_VAR(VarType)
# define JRI_PUBLIC_VAR_IMP(VarType) JRI_PUBLIC_VAR(VarType)
# define JRI_NATIVE_STUB(ResultType) ResultType __cdecl __export
# define JRI_CALLBACK __export
# endif /* !WINDLL */
# endif /* !_WIN32 */
# elif defined(__BORLANDC__)
# if defined(WIN32) || defined(_WIN32)
# define JRI_PUBLIC_API(ResultType) __export ResultType
# define JRI_PUBLIC_VAR(VarType) VarType
# define JRI_PUBLIC_VAR_EXP(VarType) __export VarType
# define JRI_PUBLIC_VAR_IMP(VarType) __import VarType
# define JRI_NATIVE_STUB(ResultType) __export ResultType
# define JRI_CALLBACK
# else /* !_WIN32 */
# define JRI_PUBLIC_API(ResultType) ResultType _cdecl _export _loadds
# define JRI_PUBLIC_VAR(VarType) VarType
# define JRI_PUBLIC_VAR_EXP(VarType) __cdecl __export VarType
# define JRI_PUBLIC_VAR_IMP(VarType) __cdecl __import VarType
# define JRI_NATIVE_STUB(ResultType) ResultType _cdecl _loadds
# define JRI_CALLBACK _loadds
# endif
# else
# error Unsupported PC development environment.
# endif
# ifndef IS_LITTLE_ENDIAN
# define IS_LITTLE_ENDIAN
# endif
/* Mac */
#elif defined (macintosh) || Macintosh || THINK_C
# if defined(__MWERKS__) /* Metrowerks */
# if !__option(enumsalwaysint)
# error You need to define 'Enums Always Int' for your project.
# endif
# if defined(TARGET_CPU_68K) && !TARGET_RT_MAC_CFM
# if !__option(fourbyteints)
# error You need to define 'Struct Alignment: 68k' for your project.
# endif
# endif /* !GENERATINGCFM */
# define JRI_PUBLIC_API(ResultType) __declspec(export) ResultType
# define JRI_PUBLIC_VAR(VarType) JRI_PUBLIC_API(VarType)
# define JRI_PUBLIC_VAR_EXP(VarType) JRI_PUBLIC_API(VarType)
# define JRI_PUBLIC_VAR_IMP(VarType) JRI_PUBLIC_API(VarType)
# define JRI_NATIVE_STUB(ResultType) JRI_PUBLIC_API(ResultType)
# elif defined(__SC__) /* Symantec */
# error What are the Symantec defines? (warren@netscape.com)
# elif macintosh && applec /* MPW */
# error Please upgrade to the latest MPW compiler (SC).
# else
# error Unsupported Mac development environment.
# endif
# define JRI_CALLBACK
/* Unix or else */
#else
# define JRI_PUBLIC_API(ResultType) ResultType
# define JRI_PUBLIC_VAR(VarType) VarType
# define JRI_PUBLIC_VAR_EXP(VarType) JRI_PUBLIC_VAR(VarType)
# define JRI_PUBLIC_VAR_IMP(VarType) JRI_PUBLIC_VAR(VarType)
# define JRI_NATIVE_STUB(ResultType) ResultType
# define JRI_CALLBACK
#endif
#ifndef FAR /* for non-Win16 */
#define FAR
#endif
/******************************************************************************/
/* Java Scalar Types */
#if 0 /* now in jni.h */
typedef short jchar;
typedef short jshort;
typedef float jfloat;
typedef double jdouble;
typedef juint jsize;
#endif
/* moved from jni.h -- Sun's new jni.h doesn't have this anymore */
#ifdef __cplusplus
typedef class _jobject *jref;
#else
typedef struct _jobject *jref;
#endif
typedef unsigned char jbool;
typedef signed char jbyte;
#ifdef IS_64 /* XXX ok for alpha, but not right on all 64-bit architectures */
typedef unsigned int juint;
typedef int jint;
#else
typedef unsigned long juint;
typedef long jint;
#endif
/*******************************************************************************
* jlong : long long (64-bit signed integer type) support.
******************************************************************************/
/*
** Bit masking macros. (n must be <= 31 to be portable)
*/
#define JRI_BIT(n) ((juint)1 << (n))
#define JRI_BITMASK(n) (JRI_BIT(n) - 1)
#ifdef HAVE_LONG_LONG
#ifdef OSF1
/* long is default 64-bit on OSF1, -std1 does not allow long long */
typedef long jlong;
typedef unsigned long julong;
#define jlong_MAXINT 0x7fffffffffffffffL
#define jlong_MININT 0x8000000000000000L
#define jlong_ZERO 0x0L
#elif (defined(WIN32) || defined(_WIN32))
typedef LONGLONG jlong;
typedef DWORDLONG julong;
#define jlong_MAXINT 0x7fffffffffffffffi64
#define jlong_MININT 0x8000000000000000i64
#define jlong_ZERO 0x0i64
#else
typedef long long jlong;
typedef unsigned long long julong;
#define jlong_MAXINT 0x7fffffffffffffffLL
#define jlong_MININT 0x8000000000000000LL
#define jlong_ZERO 0x0LL
#endif
#define jlong_IS_ZERO(a) ((a) == 0)
#define jlong_EQ(a, b) ((a) == (b))
#define jlong_NE(a, b) ((a) != (b))
#define jlong_GE_ZERO(a) ((a) >= 0)
#define jlong_CMP(a, op, b) ((a) op (b))
#define jlong_AND(r, a, b) ((r) = (a) & (b))
#define jlong_OR(r, a, b) ((r) = (a) | (b))
#define jlong_XOR(r, a, b) ((r) = (a) ^ (b))
#define jlong_OR2(r, a) ((r) = (r) | (a))
#define jlong_NOT(r, a) ((r) = ~(a))
#define jlong_NEG(r, a) ((r) = -(a))
#define jlong_ADD(r, a, b) ((r) = (a) + (b))
#define jlong_SUB(r, a, b) ((r) = (a) - (b))
#define jlong_MUL(r, a, b) ((r) = (a) * (b))
#define jlong_DIV(r, a, b) ((r) = (a) / (b))
#define jlong_MOD(r, a, b) ((r) = (a) % (b))
#define jlong_SHL(r, a, b) ((r) = (a) << (b))
#define jlong_SHR(r, a, b) ((r) = (a) >> (b))
#define jlong_USHR(r, a, b) ((r) = (julong)(a) >> (b))
#define jlong_ISHL(r, a, b) ((r) = ((jlong)(a)) << (b))
#define jlong_L2I(i, l) ((i) = (int)(l))
#define jlong_L2UI(ui, l) ((ui) =(unsigned int)(l))
#define jlong_L2F(f, l) ((f) = (l))
#define jlong_L2D(d, l) ((d) = (l))
#define jlong_I2L(l, i) ((l) = (i))
#define jlong_UI2L(l, ui) ((l) = (ui))
#define jlong_F2L(l, f) ((l) = (f))
#define jlong_D2L(l, d) ((l) = (d))
#define jlong_UDIVMOD(qp, rp, a, b) \
(*(qp) = ((julong)(a) / (b)), \
*(rp) = ((julong)(a) % (b)))
#else /* !HAVE_LONG_LONG */
typedef struct {
#ifdef IS_LITTLE_ENDIAN
juint lo, hi;
#else
juint hi, lo;
#endif
} jlong;
typedef jlong julong;
extern jlong jlong_MAXINT, jlong_MININT, jlong_ZERO;
#define jlong_IS_ZERO(a) (((a).hi == 0) && ((a).lo == 0))
#define jlong_EQ(a, b) (((a).hi == (b).hi) && ((a).lo == (b).lo))
#define jlong_NE(a, b) (((a).hi != (b).hi) || ((a).lo != (b).lo))
#define jlong_GE_ZERO(a) (((a).hi >> 31) == 0)
/*
* NB: jlong_CMP and jlong_UCMP work only for strict relationals (<, >).
*/
#define jlong_CMP(a, op, b) (((int32)(a).hi op (int32)(b).hi) || \
(((a).hi == (b).hi) && ((a).lo op (b).lo)))
#define jlong_UCMP(a, op, b) (((a).hi op (b).hi) || \
(((a).hi == (b).hi) && ((a).lo op (b).lo)))
#define jlong_AND(r, a, b) ((r).lo = (a).lo & (b).lo, \
(r).hi = (a).hi & (b).hi)
#define jlong_OR(r, a, b) ((r).lo = (a).lo | (b).lo, \
(r).hi = (a).hi | (b).hi)
#define jlong_XOR(r, a, b) ((r).lo = (a).lo ^ (b).lo, \
(r).hi = (a).hi ^ (b).hi)
#define jlong_OR2(r, a) ((r).lo = (r).lo | (a).lo, \
(r).hi = (r).hi | (a).hi)
#define jlong_NOT(r, a) ((r).lo = ~(a).lo, \
(r).hi = ~(a).hi)
#define jlong_NEG(r, a) ((r).lo = -(int32)(a).lo, \
(r).hi = -(int32)(a).hi - ((r).lo != 0))
#define jlong_ADD(r, a, b) { \
jlong _a, _b; \
_a = a; _b = b; \
(r).lo = _a.lo + _b.lo; \
(r).hi = _a.hi + _b.hi + ((r).lo < _b.lo); \
}
#define jlong_SUB(r, a, b) { \
jlong _a, _b; \
_a = a; _b = b; \
(r).lo = _a.lo - _b.lo; \
(r).hi = _a.hi - _b.hi - (_a.lo < _b.lo); \
} \
/*
* Multiply 64-bit operands a and b to get 64-bit result r.
* First multiply the low 32 bits of a and b to get a 64-bit result in r.
* Then add the outer and inner products to r.hi.
*/
#define jlong_MUL(r, a, b) { \
jlong _a, _b; \
_a = a; _b = b; \
jlong_MUL32(r, _a.lo, _b.lo); \
(r).hi += _a.hi * _b.lo + _a.lo * _b.hi; \
}
/* XXX _jlong_lo16(a) = ((a) << 16 >> 16) is better on some archs (not on mips) */
#define _jlong_lo16(a) ((a) & JRI_BITMASK(16))
#define _jlong_hi16(a) ((a) >> 16)
/*
* Multiply 32-bit operands a and b to get 64-bit result r.
* Use polynomial expansion based on primitive field element (1 << 16).
*/
#define jlong_MUL32(r, a, b) { \
juint _a1, _a0, _b1, _b0, _y0, _y1, _y2, _y3; \
_a1 = _jlong_hi16(a), _a0 = _jlong_lo16(a); \
_b1 = _jlong_hi16(b), _b0 = _jlong_lo16(b); \
_y0 = _a0 * _b0; \
_y1 = _a0 * _b1; \
_y2 = _a1 * _b0; \
_y3 = _a1 * _b1; \
_y1 += _jlong_hi16(_y0); /* can't carry */ \
_y1 += _y2; /* might carry */ \
if (_y1 < _y2) _y3 += 1 << 16; /* propagate */ \
(r).lo = (_jlong_lo16(_y1) << 16) + _jlong_lo16(_y0); \
(r).hi = _y3 + _jlong_hi16(_y1); \
}
/*
* Divide 64-bit unsigned operand a by 64-bit unsigned operand b, setting *qp
* to the 64-bit unsigned quotient, and *rp to the 64-bit unsigned remainder.
* Minimize effort if one of qp and rp is null.
*/
#define jlong_UDIVMOD(qp, rp, a, b) jlong_udivmod(qp, rp, a, b)
extern JRI_PUBLIC_API(void)
jlong_udivmod(julong *qp, julong *rp, julong a, julong b);
#define jlong_DIV(r, a, b) { \
jlong _a, _b; \
juint _negative = (int32)(a).hi < 0; \
if (_negative) { \
jlong_NEG(_a, a); \
} else { \
_a = a; \
} \
if ((int32)(b).hi < 0) { \
_negative ^= 1; \
jlong_NEG(_b, b); \
} else { \
_b = b; \
} \
jlong_UDIVMOD(&(r), 0, _a, _b); \
if (_negative) \
jlong_NEG(r, r); \
}
#define jlong_MOD(r, a, b) { \
jlong _a, _b; \
juint _negative = (int32)(a).hi < 0; \
if (_negative) { \
jlong_NEG(_a, a); \
} else { \
_a = a; \
} \
if ((int32)(b).hi < 0) { \
jlong_NEG(_b, b); \
} else { \
_b = b; \
} \
jlong_UDIVMOD(0, &(r), _a, _b); \
if (_negative) \
jlong_NEG(r, r); \
}
/*
* NB: b is a juint, not jlong or julong, for the shift ops.
*/
#define jlong_SHL(r, a, b) { \
if (b) { \
jlong _a; \
_a = a; \
if ((b) < 32) { \
(r).lo = _a.lo << (b); \
(r).hi = (_a.hi << (b)) | (_a.lo >> (32 - (b))); \
} else { \
(r).lo = 0; \
(r).hi = _a.lo << ((b) & 31); \
} \
} else { \
(r) = (a); \
} \
}
/* a is an int32, b is int32, r is jlong */
#define jlong_ISHL(r, a, b) { \
if (b) { \
jlong _a; \
_a.lo = (a); \
_a.hi = 0; \
if ((b) < 32) { \
(r).lo = (a) << (b); \
(r).hi = ((a) >> (32 - (b))); \
} else { \
(r).lo = 0; \
(r).hi = (a) << ((b) & 31); \
} \
} else { \
(r).lo = (a); \
(r).hi = 0; \
} \
}
#define jlong_SHR(r, a, b) { \
if (b) { \
jlong _a; \
_a = a; \
if ((b) < 32) { \
(r).lo = (_a.hi << (32 - (b))) | (_a.lo >> (b)); \
(r).hi = (int32)_a.hi >> (b); \
} else { \
(r).lo = (int32)_a.hi >> ((b) & 31); \
(r).hi = (int32)_a.hi >> 31; \
} \
} else { \
(r) = (a); \
} \
}
#define jlong_USHR(r, a, b) { \
if (b) { \
jlong _a; \
_a = a; \
if ((b) < 32) { \
(r).lo = (_a.hi << (32 - (b))) | (_a.lo >> (b)); \
(r).hi = _a.hi >> (b); \
} else { \
(r).lo = _a.hi >> ((b) & 31); \
(r).hi = 0; \
} \
} else { \
(r) = (a); \
} \
}
#define jlong_L2I(i, l) ((i) = (l).lo)
#define jlong_L2UI(ui, l) ((ui) = (l).lo)
#define jlong_L2F(f, l) { double _d; jlong_L2D(_d, l); (f) = (float) _d; }
#define jlong_L2D(d, l) { \
int32 _negative; \
jlong _absval; \
\
_negative = (l).hi >> 31; \
if (_negative) { \
jlong_NEG(_absval, l); \
} else { \
_absval = l; \
} \
(d) = (double)_absval.hi * 4.294967296e9 + _absval.lo; \
if (_negative) \
(d) = -(d); \
}
#define jlong_I2L(l, i) ((l).hi = (i) >> 31, (l).lo = (i))
#define jlong_UI2L(l, ui) ((l).hi = 0, (l).lo = (ui))
#define jlong_F2L(l, f) { double _d = (double) f; jlong_D2L(l, _d); }
#define jlong_D2L(l, d) { \
int _negative; \
double _absval, _d_hi; \
jlong _lo_d; \
\
_negative = ((d) < 0); \
_absval = _negative ? -(d) : (d); \
\
(l).hi = (juint)(_absval / 4.294967296e9); \
(l).lo = 0; \
jlong_L2D(_d_hi, l); \
_absval -= _d_hi; \
_lo_d.hi = 0; \
if (_absval < 0) { \
_lo_d.lo = (juint) -_absval; \
jlong_SUB(l, l, _lo_d); \
} else { \
_lo_d.lo = (juint) _absval; \
jlong_ADD(l, l, _lo_d); \
} \
\
if (_negative) \
jlong_NEG(l, l); \
}
#endif /* !HAVE_LONG_LONG */
/******************************************************************************/
#ifdef HAVE_ALIGNED_LONGLONGS
#define JRI_GET_INT64(_t,_addr) ( ((_t).x[0] = ((jint*)(_addr))[0]), \
((_t).x[1] = ((jint*)(_addr))[1]), \
(_t).l )
#define JRI_SET_INT64(_t, _addr, _v) ( (_t).l = (_v), \
((jint*)(_addr))[0] = (_t).x[0], \
((jint*)(_addr))[1] = (_t).x[1] )
#else
#define JRI_GET_INT64(_t,_addr) (*(jlong*)(_addr))
#define JRI_SET_INT64(_t, _addr, _v) (*(jlong*)(_addr) = (_v))
#endif
/* If double's must be aligned on doubleword boundaries then define this */
#ifdef HAVE_ALIGNED_DOUBLES
#define JRI_GET_DOUBLE(_t,_addr) ( ((_t).x[0] = ((jint*)(_addr))[0]), \
((_t).x[1] = ((jint*)(_addr))[1]), \
(_t).d )
#define JRI_SET_DOUBLE(_t, _addr, _v) ( (_t).d = (_v), \
((jint*)(_addr))[0] = (_t).x[0], \
((jint*)(_addr))[1] = (_t).x[1] )
#else
#define JRI_GET_DOUBLE(_t,_addr) (*(jdouble*)(_addr))
#define JRI_SET_DOUBLE(_t, _addr, _v) (*(jdouble*)(_addr) = (_v))
#endif
/******************************************************************************/
#ifdef __cplusplus
}
#endif
#endif /* JRI_MD_H */
/******************************************************************************/

@ -0,0 +1,243 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*******************************************************************************
* Java Runtime Interface
******************************************************************************/
#ifndef JRITYPES_H
#define JRITYPES_H
#include "jri_md.h"
#include "jni.h"
#include <stddef.h>
#include <stdlib.h>
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif
/*******************************************************************************
* Types
******************************************************************************/
struct JRIEnvInterface;
typedef void* JRIRef;
typedef void* JRIGlobalRef;
typedef jint JRIFieldID;
typedef jint JRIMethodID;
/* synonyms: */
typedef JRIGlobalRef jglobal;
typedef union JRIValue {
jbool z;
jbyte b;
jchar c;
jshort s;
jint i;
jlong l;
jfloat f;
jdouble d;
jref r;
} JRIValue;
typedef enum JRIBoolean {
JRIFalse = 0,
JRITrue = 1
} JRIBoolean;
typedef enum JRIConstant {
JRIUninitialized = -1
} JRIConstant;
/* convenience types (these must be distinct struct types for c++ overloading): */
#if 0 /* now in jni.h */
typedef struct jbooleanArrayStruct* jbooleanArray;
typedef struct jbyteArrayStruct* jbyteArray;
typedef struct jcharArrayStruct* jcharArray;
typedef struct jshortArrayStruct* jshortArray;
typedef struct jintArrayStruct* jintArray;
typedef struct jlongArrayStruct* jlongArray;
typedef struct jfloatArrayStruct* jfloatArray;
typedef struct jdoubleArrayStruct* jdoubleArray;
typedef struct jobjectArrayStruct* jobjectArray;
#endif
typedef struct jstringArrayStruct* jstringArray;
typedef struct jarrayArrayStruct* jarrayArray;
#define JRIConstructorMethodName "<init>"
/*******************************************************************************
* Signature Construction Macros
******************************************************************************/
/*
** These macros can be used to construct signature strings. Hopefully their names
** are a little easier to remember than the single character they correspond to.
** For example, to specify the signature of the method:
**
** public int read(byte b[], int off, int len);
**
** you could write something like this in C:
**
** char* readSig = JRISigMethod(JRISigArray(JRISigByte)
** JRISigInt
** JRISigInt) JRISigInt;
**
** Of course, don't put commas between the types.
*/
#define JRISigArray(T) "[" T
#define JRISigByte "B"
#define JRISigChar "C"
#define JRISigClass(name) "L" name ";"
#define JRISigFloat "F"
#define JRISigDouble "D"
#define JRISigMethod(args) "(" args ")"
#define JRISigNoArgs ""
#define JRISigInt "I"
#define JRISigLong "J"
#define JRISigShort "S"
#define JRISigVoid "V"
#define JRISigBoolean "Z"
/*******************************************************************************
* Environments
******************************************************************************/
extern JRI_PUBLIC_API(const struct JRIEnvInterface**)
JRI_GetCurrentEnv(void);
/*******************************************************************************
* Specific Scalar Array Types
******************************************************************************/
/*
** The JRI Native Method Interface does not support boolean arrays. This
** is to allow Java runtime implementations to optimize boolean array
** storage. Using the ScalarArray operations on boolean arrays is bound
** to fail, so convert any boolean arrays to byte arrays in Java before
** passing them to a native method.
*/
#define JRI_NewByteArray(env, length, initialValues) \
JRI_NewScalarArray(env, length, JRISigByte, (jbyte*)(initialValues))
#define JRI_GetByteArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetByteArrayElements(env, array) \
JRI_GetScalarArrayElements(env, array)
#define JRI_NewCharArray(env, length, initialValues) \
JRI_NewScalarArray(env, ((length) * sizeof(jchar)), JRISigChar, (jbyte*)(initialValues))
#define JRI_GetCharArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetCharArrayElements(env, array) \
((jchar*)JRI_GetScalarArrayElements(env, array))
#define JRI_NewShortArray(env, length, initialValues) \
JRI_NewScalarArray(env, ((length) * sizeof(jshort)), JRISigShort, (jbyte*)(initialValues))
#define JRI_GetShortArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetShortArrayElements(env, array) \
((jshort*)JRI_GetScalarArrayElements(env, array))
#define JRI_NewIntArray(env, length, initialValues) \
JRI_NewScalarArray(env, ((length) * sizeof(jint)), JRISigInt, (jbyte*)(initialValues))
#define JRI_GetIntArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetIntArrayElements(env, array) \
((jint*)JRI_GetScalarArrayElements(env, array))
#define JRI_NewLongArray(env, length, initialValues) \
JRI_NewScalarArray(env, ((length) * sizeof(jlong)), JRISigLong, (jbyte*)(initialValues))
#define JRI_GetLongArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetLongArrayElements(env, array) \
((jlong*)JRI_GetScalarArrayElements(env, array))
#define JRI_NewFloatArray(env, length, initialValues) \
JRI_NewScalarArray(env, ((length) * sizeof(jfloat)), JRISigFloat, (jbyte*)(initialValues))
#define JRI_GetFloatArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetFloatArrayElements(env, array) \
((jfloat*)JRI_GetScalarArrayElements(env, array))
#define JRI_NewDoubleArray(env, length, initialValues) \
JRI_NewScalarArray(env, ((length) * sizeof(jdouble)), JRISigDouble, (jbyte*)(initialValues))
#define JRI_GetDoubleArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetDoubleArrayElements(env, array) \
((jdouble*)JRI_GetScalarArrayElements(env, array))
/******************************************************************************/
/*
** JDK Stuff -- This stuff is still needed while we're using the JDK
** dynamic linking strategy to call native methods.
*/
typedef union JRI_JDK_stack_item {
/* Non pointer items */
jint i;
jfloat f;
jint o;
/* Pointer items */
void *h;
void *p;
unsigned char *addr;
#ifdef IS_64
double d;
long l; /* == 64bits! */
#endif
} JRI_JDK_stack_item;
typedef union JRI_JDK_Java8Str {
jint x[2];
jdouble d;
jlong l;
void *p;
float f;
} JRI_JDK_Java8;
/******************************************************************************/
#ifdef __cplusplus
}
#endif
#endif /* JRITYPES_H */
/******************************************************************************/

@ -0,0 +1,726 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
* npapi.h $Revision: 3.40.4.1 $
* Netscape client plug-in API spec
*/
#ifndef _NPAPI_H_
#define _NPAPI_H_
#ifdef __OS2__
#pragma pack(1)
#endif
#include "prtypes.h"
/* Copied from xp_core.h */
/* removed #ifdef for hpux defined in /usr/include/model.h */
#ifndef XP_MAC
#ifndef _INT16
#define _INT16
#endif
#ifndef _INT32
#define _INT32
#endif
#ifndef _UINT16
#define _UINT16
#endif
#ifndef _UINT32
#define _UINT32
#endif
#endif
/*
* NO_NSPR_10_SUPPORT disables the inclusion
* of obsolete/protypes.h, whose int16, uint16,
* int32, and uint32 typedefs conflict with those
* in this file.
*/
#ifndef NO_NSPR_10_SUPPORT
#define NO_NSPR_10_SUPPORT
#endif
#ifdef OJI
#include "jri.h" /* Java Runtime Interface */
#endif
#if defined (__OS2__ ) || defined (OS2)
# ifndef XP_OS2
# define XP_OS2 1
# endif /* XP_OS2 */
#endif /* __OS2__ */
#ifdef _WINDOWS
# include <windef.h>
# ifndef XP_WIN
# define XP_WIN 1
# endif /* XP_WIN */
#endif /* _WINDOWS */
#ifdef __MWERKS__
# define _declspec __declspec
# ifdef macintosh
# ifndef XP_MAC
# define XP_MAC 1
# endif /* XP_MAC */
# endif /* macintosh */
# ifdef __INTEL__
# undef NULL
# ifndef XP_WIN
# define XP_WIN 1
# endif /* XP_WIN */
# endif /* __INTEL__ */
#endif /* __MWERKS__ */
#if defined(XP_MAC) || defined(XP_MACOSX)
#include <Quickdraw.h>
#include <Events.h>
#endif
#if defined(XP_UNIX)
# include <stdio.h>
# if defined(MOZ_X11)
# include <X11/Xlib.h>
# include <X11/Xutil.h>
# endif
#endif
/*----------------------------------------------------------------------*/
/* Plugin Version Constants */
/*----------------------------------------------------------------------*/
#define NP_VERSION_MAJOR 0
#define NP_VERSION_MINOR 16
/* The OS/2 version of Netscape uses RC_DATA to define the
mime types, file extensions, etc that are required.
Use a vertical bar to separate types, end types with \0.
FileVersion and ProductVersion are 32bit ints, all other
entries are strings the MUST be terminated wwith a \0.
AN EXAMPLE:
RCDATA NP_INFO_ProductVersion { 1,0,0,1,}
RCDATA NP_INFO_MIMEType { "video/x-video|",
"video/x-flick\0" }
RCDATA NP_INFO_FileExtents { "avi|",
"flc\0" }
RCDATA NP_INFO_FileOpenName{ "MMOS2 video player(*.avi)|",
"MMOS2 Flc/Fli player(*.flc)\0" }
RCDATA NP_INFO_FileVersion { 1,0,0,1 }
RCDATA NP_INFO_CompanyName { "Netscape Communications\0" }
RCDATA NP_INFO_FileDescription { "NPAVI32 Extension DLL\0"
RCDATA NP_INFO_InternalName { "NPAVI32\0" )
RCDATA NP_INFO_LegalCopyright { "Copyright Netscape Communications \251 1996\0"
RCDATA NP_INFO_OriginalFilename { "NVAPI32.DLL" }
RCDATA NP_INFO_ProductName { "NPAVI32 Dynamic Link Library\0" }
*/
/* RC_DATA types for version info - required */
#define NP_INFO_ProductVersion 1
#define NP_INFO_MIMEType 2
#define NP_INFO_FileOpenName 3
#define NP_INFO_FileExtents 4
/* RC_DATA types for version info - used if found */
#define NP_INFO_FileDescription 5
#define NP_INFO_ProductName 6
/* RC_DATA types for version info - optional */
#define NP_INFO_CompanyName 7
#define NP_INFO_FileVersion 8
#define NP_INFO_InternalName 9
#define NP_INFO_LegalCopyright 10
#define NP_INFO_OriginalFilename 11
#ifndef RC_INVOKED
/*----------------------------------------------------------------------*/
/* Definition of Basic Types */
/*----------------------------------------------------------------------*/
#ifndef _UINT16
typedef unsigned short uint16;
#endif
#ifndef _UINT32
# if defined(__alpha) || defined(__amd64__) || defined(__x86_64__)
typedef unsigned int uint32;
# else /* __alpha */
typedef unsigned long uint32;
# endif /* __alpha */
#endif
/*
* AIX defines these in sys/inttypes.h included from sys/types.h
*/
#ifndef AIX
#ifndef _INT16
typedef short int16;
#endif
#ifndef _INT32
# if defined(__alpha) || defined(__amd64__) || defined(__x86_64__)
typedef int int32;
# else /* __alpha */
typedef long int32;
# endif /* __alpha */
#endif
#endif
#ifndef FALSE
#define FALSE (0)
#endif
#ifndef TRUE
#define TRUE (1)
#endif
#ifndef NULL
#define NULL (0L)
#endif
typedef unsigned char NPBool;
typedef int16 NPError;
typedef int16 NPReason;
typedef char* NPMIMEType;
/*----------------------------------------------------------------------*/
/* Structures and definitions */
/*----------------------------------------------------------------------*/
#ifdef XP_MAC
#pragma options align=mac68k
#endif
/*
* NPP is a plug-in's opaque instance handle
*/
typedef struct _NPP
{
void* pdata; /* plug-in private data */
void* ndata; /* netscape private data */
} NPP_t;
typedef NPP_t* NPP;
typedef struct _NPStream
{
void* pdata; /* plug-in private data */
void* ndata; /* netscape private data */
const char* url;
uint32 end;
uint32 lastmodified;
void* notifyData;
} NPStream;
typedef struct _NPByteRange
{
int32 offset; /* negative offset means from the end */
uint32 length;
struct _NPByteRange* next;
} NPByteRange;
typedef struct _NPSavedData
{
int32 len;
void* buf;
} NPSavedData;
typedef struct _NPRect
{
uint16 top;
uint16 left;
uint16 bottom;
uint16 right;
} NPRect;
typedef struct _NPSize
{
int32 width;
int32 height;
} NPSize;
#ifdef XP_UNIX
/*
* Unix specific structures and definitions
*/
/*
* Callback Structures.
*
* These are used to pass additional platform specific information.
*/
enum {
NP_SETWINDOW = 1,
NP_PRINT
};
typedef struct
{
int32 type;
} NPAnyCallbackStruct;
typedef struct
{
int32 type;
#ifdef MOZ_X11
Display* display;
Visual* visual;
Colormap colormap;
unsigned int depth;
#endif
} NPSetWindowCallbackStruct;
typedef struct
{
int32 type;
FILE* fp;
} NPPrintCallbackStruct;
#endif /* XP_UNIX */
/*
* The following masks are applied on certain platforms to NPNV and
* NPPV selectors that pass around pointers to COM interfaces. Newer
* compilers on some platforms may generate vtables that are not
* compatible with older compilers. To prevent older plugins from
* not understanding a new browser's ABI, these masks change the
* values of those selectors on those platforms. To remain backwards
* compatible with differenet versions of the browser, plugins can
* use these masks to dynamically determine and use the correct C++
* ABI that the browser is expecting. This does not apply to Windows
* as Microsoft's COM ABI will likely not change.
*/
#define NP_ABI_GCC3_MASK 0x10000000
/*
* gcc 3.x generated vtables on UNIX and OSX are incompatible with
* previous compilers.
*/
#if (defined (XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3))
#define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK
#else
#define _NP_ABI_MIXIN_FOR_GCC3 0
#endif
#define NP_ABI_MACHO_MASK 0x01000000
/*
* On OSX, the Mach-O executable format is significantly
* different than CFM. In addition to having a different
* C++ ABI, it also has has different C calling convention.
* You must use glue code when calling between CFM and
* Mach-O C functions.
*/
#if (defined(TARGET_RT_MAC_MACHO))
#define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK
#else
#define _NP_ABI_MIXIN_FOR_MACHO 0
#endif
#define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO)
/*
* List of variable names for which NPP_GetValue shall be implemented
*/
typedef enum {
NPPVpluginNameString = 1,
NPPVpluginDescriptionString,
NPPVpluginWindowBool,
NPPVpluginTransparentBool,
NPPVjavaClass, /* Not implemented in Mozilla 1.0 */
NPPVpluginWindowSize,
NPPVpluginTimerInterval,
NPPVpluginScriptableInstance = (10 | NP_ABI_MASK),
NPPVpluginScriptableIID = 11,
/* Introduced in Mozilla 0.9.9 */
NPPVjavascriptPushCallerBool = 12,
/* Introduced in Mozilla 1.0 */
NPPVpluginKeepLibraryInMemory = 13,
NPPVpluginNeedsXEmbed = 14,
/* Get the NPObject for scripting the plugin. Introduced in Firefox
* 1.0 (NPAPI minor version 14).
*/
NPPVpluginScriptableNPObject = 15,
/* Get the plugin value (as \0-terminated UTF-8 string data) for
* form submission if the plugin is part of a form. Use
* NPN_MemAlloc() to allocate memory for the string data. Introduced
* in Mozilla 1.8b2 (NPAPI minor version 15).
*/
NPPVformValue = 16
} NPPVariable;
/*
* List of variable names for which NPN_GetValue is implemented by Mozilla
*/
typedef enum {
NPNVxDisplay = 1,
NPNVxtAppContext,
NPNVnetscapeWindow,
NPNVjavascriptEnabledBool,
NPNVasdEnabledBool,
NPNVisOfflineBool,
/* 10 and over are available on Mozilla builds starting with 0.9.4 */
NPNVserviceManager = (10 | NP_ABI_MASK),
NPNVDOMElement = (11 | NP_ABI_MASK), /* available in Mozilla 1.2 */
NPNVDOMWindow = (12 | NP_ABI_MASK),
NPNVToolkit = (13 | NP_ABI_MASK),
NPNVSupportsXEmbedBool = 14,
/* Get the NPObject wrapper for the browser window. */
NPNVWindowNPObject = 15,
/* Get the NPObject wrapper for the plugins DOM element. */
NPNVPluginElementNPObject = 16
} NPNVariable;
/*
* The type of Tookkit the widgets use
*/
typedef enum {
NPNVGtk12 = 1,
NPNVGtk2
} NPNToolkitType;
/*
* The type of a NPWindow - it specifies the type of the data structure
* returned in the window field.
*/
typedef enum {
NPWindowTypeWindow = 1,
NPWindowTypeDrawable
} NPWindowType;
typedef struct _NPWindow
{
void* window; /* Platform specific window handle */
/* OS/2: x - Position of bottom left corner */
/* OS/2: y - relative to visible netscape window */
int32 x; /* Position of top left corner relative */
int32 y; /* to a netscape page. */
uint32 width; /* Maximum window size */
uint32 height;
NPRect clipRect; /* Clipping rectangle in port coordinates */
/* Used by MAC only. */
#if defined(XP_UNIX) && !defined(XP_MACOSX)
void * ws_info; /* Platform-dependent additonal data */
#endif /* XP_UNIX */
NPWindowType type; /* Is this a window or a drawable? */
} NPWindow;
typedef struct _NPFullPrint
{
NPBool pluginPrinted;/* Set TRUE if plugin handled fullscreen printing */
NPBool printOne; /* TRUE if plugin should print one copy to default printer */
void* platformPrint; /* Platform-specific printing info */
} NPFullPrint;
typedef struct _NPEmbedPrint
{
NPWindow window;
void* platformPrint; /* Platform-specific printing info */
} NPEmbedPrint;
typedef struct _NPPrint
{
uint16 mode; /* NP_FULL or NP_EMBED */
union
{
NPFullPrint fullPrint; /* if mode is NP_FULL */
NPEmbedPrint embedPrint; /* if mode is NP_EMBED */
} print;
} NPPrint;
#if defined(XP_MAC) || defined(XP_MACOSX)
typedef EventRecord NPEvent;
#elif defined(XP_WIN)
typedef struct _NPEvent
{
uint16 event;
uint32 wParam;
uint32 lParam;
} NPEvent;
#elif defined(XP_OS2)
typedef struct _NPEvent
{
uint32 event;
uint32 wParam;
uint32 lParam;
} NPEvent;
#elif defined (XP_UNIX) && defined(MOZ_X11)
typedef XEvent NPEvent;
#else
typedef void* NPEvent;
#endif /* XP_MAC */
#if defined(XP_MAC) || defined(XP_MACOSX)
typedef RgnHandle NPRegion;
#elif defined(XP_WIN)
typedef HRGN NPRegion;
#elif defined(XP_UNIX) && defined(MOZ_X11)
typedef Region NPRegion;
#else
typedef void *NPRegion;
#endif /* XP_MAC */
#if defined(XP_MAC) || defined(XP_MACOSX)
/*
* Mac-specific structures and definitions.
*/
typedef struct NP_Port
{
CGrafPtr port; /* Grafport */
int32 portx; /* position inside the topmost window */
int32 porty;
} NP_Port;
/*
* Non-standard event types that can be passed to HandleEvent
*/
enum NPEventType {
NPEventType_GetFocusEvent = (osEvt + 16),
NPEventType_LoseFocusEvent,
NPEventType_AdjustCursorEvent,
NPEventType_MenuCommandEvent,
NPEventType_ClippingChangedEvent,
NPEventType_ScrollingBeginsEvent = 1000,
NPEventType_ScrollingEndsEvent
};
#ifdef OBSOLETE
#define getFocusEvent (osEvt + 16)
#define loseFocusEvent (osEvt + 17)
#define adjustCursorEvent (osEvt + 18)
#endif
#endif /* XP_MAC */
/*
* Values for mode passed to NPP_New:
*/
#define NP_EMBED 1
#define NP_FULL 2
/*
* Values for stream type passed to NPP_NewStream:
*/
#define NP_NORMAL 1
#define NP_SEEK 2
#define NP_ASFILE 3
#define NP_ASFILEONLY 4
#define NP_MAXREADY (((unsigned)(~0)<<1)>>1)
#ifdef XP_MAC
#pragma options align=reset
#endif
/*----------------------------------------------------------------------*/
/* Error and Reason Code definitions */
/*----------------------------------------------------------------------*/
/*
* Values of type NPError:
*/
#define NPERR_BASE 0
#define NPERR_NO_ERROR (NPERR_BASE + 0)
#define NPERR_GENERIC_ERROR (NPERR_BASE + 1)
#define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2)
#define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3)
#define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4)
#define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5)
#define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6)
#define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7)
#define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8)
#define NPERR_INVALID_PARAM (NPERR_BASE + 9)
#define NPERR_INVALID_URL (NPERR_BASE + 10)
#define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11)
#define NPERR_NO_DATA (NPERR_BASE + 12)
#define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13)
/*
* Values of type NPReason:
*/
#define NPRES_BASE 0
#define NPRES_DONE (NPRES_BASE + 0)
#define NPRES_NETWORK_ERR (NPRES_BASE + 1)
#define NPRES_USER_BREAK (NPRES_BASE + 2)
/*
* Don't use these obsolete error codes any more.
*/
#define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR
#define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR
#define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK
/*
* Version feature information
*/
#define NPVERS_HAS_STREAMOUTPUT 8
#define NPVERS_HAS_NOTIFICATION 9
#define NPVERS_HAS_LIVECONNECT 9
#define NPVERS_WIN16_HAS_LIVECONNECT 9
#define NPVERS_68K_HAS_LIVECONNECT 11
#define NPVERS_HAS_WINDOWLESS 11
#define NPVERS_HAS_XPCONNECT_SCRIPTING 13
/*----------------------------------------------------------------------*/
/* Function Prototypes */
/*----------------------------------------------------------------------*/
#if defined(_WINDOWS) && !defined(WIN32)
#define NP_LOADDS _loadds
#else
#if defined(__OS2__)
#define NP_LOADDS _System
#else
#define NP_LOADDS
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* NPP_* functions are provided by the plugin and called by the navigator.
*/
#ifdef XP_UNIX
char* NPP_GetMIMEDescription(void);
#endif /* XP_UNIX */
NPError NP_LOADDS NPP_Initialize(void);
void NP_LOADDS NPP_Shutdown(void);
NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance,
uint16 mode, int16 argc, char* argn[],
char* argv[], NPSavedData* saved);
NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save);
NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window);
NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type,
NPStream* stream, NPBool seekable,
uint16* stype);
NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream,
NPReason reason);
int32 NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream);
int32 NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32 offset,
int32 len, void* buffer);
void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream,
const char* fname);
void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint);
int16 NP_LOADDS NPP_HandleEvent(NPP instance, void* event);
void NP_LOADDS NPP_URLNotify(NPP instance, const char* url,
NPReason reason, void* notifyData);
#ifdef OJI
jref NP_LOADDS NPP_GetJavaClass(void);
#endif
NPError NP_LOADDS NPP_GetValue(NPP instance, NPPVariable variable, void *value);
NPError NP_LOADDS NPP_SetValue(NPP instance, NPNVariable variable, void *value);
/*
* NPN_* functions are provided by the navigator and called by the plugin.
*/
void NP_LOADDS NPN_Version(int* plugin_major, int* plugin_minor,
int* netscape_major, int* netscape_minor);
NPError NP_LOADDS NPN_GetURLNotify(NPP instance, const char* url,
const char* target, void* notifyData);
NPError NP_LOADDS NPN_GetURL(NPP instance, const char* url,
const char* target);
NPError NP_LOADDS NPN_PostURLNotify(NPP instance, const char* url,
const char* target, uint32 len,
const char* buf, NPBool file,
void* notifyData);
NPError NP_LOADDS NPN_PostURL(NPP instance, const char* url,
const char* target, uint32 len,
const char* buf, NPBool file);
NPError NP_LOADDS NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
NPError NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type,
const char* target, NPStream** stream);
int32 NP_LOADDS NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer);
NPError NP_LOADDS NPN_DestroyStream(NPP instance, NPStream* stream, NPReason reason);
void NP_LOADDS NPN_Status(NPP instance, const char* message);
const char* NP_LOADDS NPN_UserAgent(NPP instance);
void* NP_LOADDS NPN_MemAlloc(uint32 size);
void NP_LOADDS NPN_MemFree(void* ptr);
uint32 NP_LOADDS NPN_MemFlush(uint32 size);
void NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages);
#ifdef OJI
JRIEnv* NP_LOADDS NPN_GetJavaEnv(void);
jref NP_LOADDS NPN_GetJavaPeer(NPP instance);
#endif
NPError NP_LOADDS NPN_GetValue(NPP instance, NPNVariable variable, void *value);
NPError NP_LOADDS NPN_SetValue(NPP instance, NPPVariable variable, void *value);
void NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect *invalidRect);
void NP_LOADDS NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion);
void NP_LOADDS NPN_ForceRedraw(NPP instance);
void NP_LOADDS NPN_PushPopupsEnabledState(NPP instance, NPBool enabled);
void NP_LOADDS NPN_PopPopupsEnabledState(NPP instance);
#ifdef __cplusplus
} /* end extern "C" */
#endif
#endif /* RC_INVOKED */
#ifdef __OS2__
#pragma pack()
#endif
#endif /* _NPAPI_H_ */

@ -0,0 +1,397 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* Copyright © 2004, Apple Computer, Inc. and The Mozilla Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of Apple Computer, Inc. ("Apple") or The Mozilla
* Foundation ("Mozilla") nor the names of their contributors may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE, MOZILLA AND THEIR CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE, MOZILLA OR
* THEIR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Revision 1 (March 4, 2004):
* Initial proposal.
*
* Revision 2 (March 10, 2004):
* All calls into script were made asynchronous. Results are
* provided via the NPScriptResultFunctionPtr callback.
*
* Revision 3 (March 10, 2004):
* Corrected comments to not refer to class retain/release FunctionPtrs.
*
* Revision 4 (March 11, 2004):
* Added additional convenience NPN_SetExceptionWithUTF8().
* Changed NPHasPropertyFunctionPtr and NPHasMethodFunctionPtr to take NPClass
* pointers instead of NPObject pointers.
* Added NPIsValidIdentifier().
*
* Revision 5 (March 17, 2004):
* Added context parameter to result callbacks from ScriptObject functions.
*
* Revision 6 (March 29, 2004):
* Renamed functions implemented by user agent to NPN_*. Removed _ from
* type names.
* Renamed "JavaScript" types to "Script".
*
* Revision 7 (April 21, 2004):
* NPIdentifier becomes a void*, was int32_t
* Remove NP_IsValidIdentifier, renamed NP_IdentifierFromUTF8 to NP_GetIdentifier
* Added NPVariant and modified functions to use this new type.
*
* Revision 8 (July 9, 2004):
* Updated to joint Apple-Mozilla license.
*
*/
#ifndef _NP_RUNTIME_H_
#define _NP_RUNTIME_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "nptypes.h"
/*
This API is used to facilitate binding code written in C to script
objects. The API in this header does not assume the presence of a
user agent. That is, it can be used to bind C code to scripting
environments outside of the context of a user agent.
However, the normal use of the this API is in the context of a
scripting environment running in a browser or other user agent.
In particular it is used to support the extended Netscape
script-ability API for plugins (NP-SAP). NP-SAP is an extension
of the Netscape plugin API. As such we have adopted the use of
the "NP" prefix for this API.
The following NP{N|P}Variables were added to the Netscape plugin
API (in npapi.h):
NPNVWindowNPObject
NPNVPluginElementNPObject
NPPVpluginScriptableNPObject
These variables are exposed through NPN_GetValue() and
NPP_GetValue() (respectively) and are used to establish the
initial binding between the user agent and native code. The DOM
objects in the user agent can be examined and manipulated using
the NPN_ functions that operate on NPObjects described in this
header.
To the extent possible the assumptions about the scripting
language used by the scripting environment have been minimized.
*/
#define NP_BEGIN_MACRO do {
#define NP_END_MACRO } while (0)
/*
Objects (non-primitive data) passed between 'C' and script is
always wrapped in an NPObject. The 'interface' of an NPObject is
described by an NPClass.
*/
typedef struct NPObject NPObject;
typedef struct NPClass NPClass;
typedef char NPUTF8;
typedef struct _NPString {
const NPUTF8 *utf8characters;
uint32_t utf8length;
} NPString;
typedef enum {
NPVariantType_Void,
NPVariantType_Null,
NPVariantType_Bool,
NPVariantType_Int32,
NPVariantType_Double,
NPVariantType_String,
NPVariantType_Object
} NPVariantType;
typedef struct _NPVariant {
NPVariantType type;
union {
bool boolValue;
uint32_t intValue;
double doubleValue;
NPString stringValue;
NPObject *objectValue;
} value;
} NPVariant;
/*
NPN_ReleaseVariantValue is called on all 'out' parameters
references. Specifically it is to be called on variants that own
their value, as is the case with all non-const NPVariant*
arguments after a successful call to any methods (except this one)
in this API.
After calling NPN_ReleaseVariantValue, the type of the variant
will be NPVariantType_Void.
*/
void NPN_ReleaseVariantValue(NPVariant *variant);
#define NPVARIANT_IS_VOID(_v) ((_v).type == NPVariantType_Void)
#define NPVARIANT_IS_NULL(_v) ((_v).type == NPVariantType_Null)
#define NPVARIANT_IS_BOOLEAN(_v) ((_v).type == NPVariantType_Bool)
#define NPVARIANT_IS_INT32(_v) ((_v).type == NPVariantType_Int32)
#define NPVARIANT_IS_DOUBLE(_v) ((_v).type == NPVariantType_Double)
#define NPVARIANT_IS_STRING(_v) ((_v).type == NPVariantType_String)
#define NPVARIANT_IS_OBJECT(_v) ((_v).type == NPVariantType_Object)
#define NPVARIANT_TO_BOOLEAN(_v) ((_v).value.boolValue)
#define NPVARIANT_TO_INT32(_v) ((_v).value.intValue)
#define NPVARIANT_TO_DOUBLE(_v) ((_v).value.doubleValue)
#define NPVARIANT_TO_STRING(_v) ((_v).value.stringValue)
#define NPVARIANT_TO_OBJECT(_v) ((_v).value.objectValue)
#define VOID_TO_NPVARIANT(_v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_Void; \
(_v).value.objectValue = NULL; \
NP_END_MACRO
#define NULL_TO_NPVARIANT(_v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_Null; \
(_v).value.objectValue = NULL; \
NP_END_MACRO
#define BOOLEAN_TO_NPVARIANT(_val, _v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_Bool; \
(_v).value.boolValue = !!(_val); \
NP_END_MACRO
#define INT32_TO_NPVARIANT(_val, _v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_Int32; \
(_v).value.intValue = _val; \
NP_END_MACRO
#define DOUBLE_TO_NPVARIANT(_val, _v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_Double; \
(_v).value.doubleValue = _val; \
NP_END_MACRO
#define STRINGZ_TO_NPVARIANT(_val, _v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_String; \
NPString str = { _val, strlen(_val) }; \
(_v).value.stringValue = str; \
NP_END_MACRO
#define STRINGN_TO_NPVARIANT(_val, _len, _v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_String; \
NPString str = { _val, _len }; \
(_v).value.stringValue = str; \
NP_END_MACRO
#define OBJECT_TO_NPVARIANT(_val, _v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_Object; \
(_v).value.objectValue = _val; \
NP_END_MACRO
/*
Type mappings (JavaScript types have been used for illustration
purposes):
JavaScript to C (NPVariant with type:)
undefined NPVariantType_Void
null NPVariantType_Null
Boolean NPVariantType_Bool
Number NPVariantType_Double or NPVariantType_Int32
String NPVariantType_String
Object NPVariantType_Object
C (NPVariant with type:) to JavaScript
NPVariantType_Void undefined
NPVariantType_Null null
NPVariantType_Bool Boolean
NPVariantType_Int32 Number
NPVariantType_Double Number
NPVariantType_String String
NPVariantType_Object Object
*/
typedef void *NPIdentifier;
/*
NPObjects have methods and properties. Methods and properties are
identified with NPIdentifiers. These identifiers may be reflected
in script. NPIdentifiers can be either strings or integers, IOW,
methods and properties can be identified by either strings or
integers (i.e. foo["bar"] vs foo[1]). NPIdentifiers can be
compared using ==. In case of any errors, the requested
NPIdentifier(s) will be NULL.
*/
NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name);
void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount,
NPIdentifier *identifiers);
NPIdentifier NPN_GetIntIdentifier(int32_t intid);
bool NPN_IdentifierIsString(NPIdentifier identifier);
/*
The NPUTF8 returned from NPN_UTF8FromIdentifier SHOULD be freed.
*/
NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier);
/*
Get the integer represented by identifier. If identifier is not an
integer identifier, the behaviour is undefined.
*/
int32_t NPN_IntFromIdentifier(NPIdentifier identifier);
/*
NPObject behavior is implemented using the following set of
callback functions.
The NPVariant *result argument of these functions (where
applicable) should be released using NPN_ReleaseVariantValue().
*/
typedef NPObject *(*NPAllocateFunctionPtr)(NPP npp, NPClass *aClass);
typedef void (*NPDeallocateFunctionPtr)(NPObject *npobj);
typedef void (*NPInvalidateFunctionPtr)(NPObject *npobj);
typedef bool (*NPHasMethodFunctionPtr)(NPObject *npobj, NPIdentifier name);
typedef bool (*NPInvokeFunctionPtr)(NPObject *npobj, NPIdentifier name,
const NPVariant *args, uint32_t argCount,
NPVariant *result);
typedef bool (*NPInvokeDefaultFunctionPtr)(NPObject *npobj,
const NPVariant *args,
uint32_t argCount,
NPVariant *result);
typedef bool (*NPHasPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name);
typedef bool (*NPGetPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name,
NPVariant *result);
typedef bool (*NPSetPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name,
const NPVariant *value);
typedef bool (*NPRemovePropertyFunctionPtr)(NPObject *npobj,
NPIdentifier name);
/*
NPObjects returned by create, retain, invoke, and getProperty pass
a reference count to the caller. That is, the callee adds a
reference count which passes to the caller. It is the caller's
responsibility to release the returned object.
NPInvokeFunctionPtr function may return 0 to indicate a void
result.
NPInvalidateFunctionPtr is called by the scripting environment
when the native code is shutdown. Any attempt to message a
NPObject instance after the invalidate callback has been
called will result in undefined behavior, even if the native code
is still retaining those NPObject instances. (The runtime
will typically return immediately, with 0 or NULL, from an attempt
to dispatch to a NPObject, but this behavior should not be
depended upon.)
*/
struct NPClass
{
uint32_t structVersion;
NPAllocateFunctionPtr allocate;
NPDeallocateFunctionPtr deallocate;
NPInvalidateFunctionPtr invalidate;
NPHasMethodFunctionPtr hasMethod;
NPInvokeFunctionPtr invoke;
NPInvokeDefaultFunctionPtr invokeDefault;
NPHasPropertyFunctionPtr hasProperty;
NPGetPropertyFunctionPtr getProperty;
NPSetPropertyFunctionPtr setProperty;
NPRemovePropertyFunctionPtr removeProperty;
};
#define NP_CLASS_STRUCT_VERSION 1
struct NPObject {
NPClass *_class;
uint32_t referenceCount;
/*
* Additional space may be allocated here by types of NPObjects
*/
};
/*
If the class has an allocate function, NPN_CreateObject invokes
that function, otherwise a NPObject is allocated and
returned. This method will initialize the referenceCount member of
the NPObject to 1.
*/
NPObject *NPN_CreateObject(NPP npp, NPClass *aClass);
/*
Increment the NPObject's reference count.
*/
NPObject *NPN_RetainObject(NPObject *npobj);
/*
Decremented the NPObject's reference count. If the reference
count goes to zero, the class's destroy function is invoke if
specified, otherwise the object is freed directly.
*/
void NPN_ReleaseObject(NPObject *npobj);
/*
Functions to access script objects represented by NPObject.
Calls to script objects are synchronous. If a function returns a
value, it will be supplied via the result NPVariant
argument. Successful calls will return true, false will be
returned in case of an error.
Calls made from plugin code to script must be made from the thread
on which the plugin was initialized.
*/
bool NPN_Invoke(NPP npp, NPObject *npobj, NPIdentifier methodName,
const NPVariant *args, uint32_t argCount, NPVariant *result);
bool NPN_InvokeDefault(NPP npp, NPObject *npobj, const NPVariant *args,
uint32_t argCount, NPVariant *result);
bool NPN_Evaluate(NPP npp, NPObject *npobj, NPString *script,
NPVariant *result);
bool NPN_GetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName,
NPVariant *result);
bool NPN_SetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName,
const NPVariant *value);
bool NPN_RemoveProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName);
bool NPN_HasProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName);
bool NPN_HasMethod(NPP npp, NPObject *npobj, NPIdentifier methodName);
/*
NPN_SetException may be called to trigger a script exception upon
return from entry points into NPObjects. Typical usage:
NPN_SetException (npobj, message);
*/
void NPN_SetException(NPObject *npobj, const NPUTF8 *message);
#ifdef __cplusplus
}
#endif
#endif

@ -0,0 +1,105 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* mozilla.org.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Johnny Stenback <jst@mozilla.org> (Original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
* Header file for ensuring that C99 types ([u]int32_t and bool) are
* available.
*/
#if defined(WIN32) || defined(OS2)
/*
* Win32 and OS/2 don't know C99, so define [u]int_32 here. The bool
* is predefined tho, both in C and C++.
*/
typedef int int32_t;
typedef unsigned int uint32_t;
#elif defined(_AIX) || defined(__sun) || defined(__osf__) || defined(IRIX) || defined(HPUX)
/*
* AIX and SunOS ship a inttypes.h header that defines [u]int32_t,
* but not bool for C.
*/
#include <inttypes.h>
#ifndef __cplusplus
typedef int bool;
#endif
#elif defined(bsdi) || defined(FREEBSD) || defined(OPENBSD)
/*
* BSD/OS, FreeBSD, and OpenBSD ship sys/types.h that define int32_t and
* u_int32_t.
*/
#include <sys/types.h>
/*
* BSD/OS ships no header that defines uint32_t, nor bool (for C)
* OpenBSD ships no header that defines uint32_t and using its bool macro is
* unsafe.
*/
#if defined(bsdi) || defined(OPENBSD)
typedef u_int32_t uint32_t;
#if !defined(__cplusplus)
typedef int bool;
#endif
#else
/*
* FreeBSD defines uint32_t and bool.
*/
#include <inttypes.h>
#include <stdbool.h>
#endif
#elif defined(BEOS)
#include <inttypes.h>
#else
/*
* For those that ship a standard C99 stdint.h header file, include
* it. Can't do the same for stdbool.h tho, since some systems ship
* with a stdbool.h file that doesn't compile!
*/
#include <stdint.h>
#if !defined(__GNUC__) || (__GNUC__ > 2 || __GNUC_MINOR__ > 95)
#include <stdbool.h>
#else
/*
* GCC 2.91 can't deal with a typedef for bool, but a #define
* works.
*/
#define bool int
#endif
#endif

File diff suppressed because it is too large Load Diff

@ -0,0 +1,252 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
* This header typedefs the old 'native' types to the new PR<type>s.
* These definitions are scheduled to be eliminated at the earliest
* possible time. The NSPR API is implemented and documented using
* the new definitions.
*/
#if !defined(PROTYPES_H)
#define PROTYPES_H
typedef PRUintn uintn;
#ifndef _XP_Core_
typedef PRIntn intn;
#endif
/*
* It is trickier to define uint, int8, uint8, int16, uint16,
* int32, uint32, int64, and uint64 because some of these int
* types are defined by standard header files on some platforms.
* Our strategy here is to include all such standard headers
* first, and then define these int types only if they are not
* defined by those standard headers.
*/
/*
* BeOS defines all the int types below in its standard header
* file SupportDefs.h.
*/
#ifdef XP_BEOS
#include <support/SupportDefs.h>
#endif
/*
* OpenVMS defines all the int types below in its standard
* header files ints.h and types.h.
*/
#ifdef VMS
#include <ints.h>
#include <types.h>
#endif
/*
* SVR4 typedef of uint is commonly found on UNIX machines.
*
* On AIX 4.3, sys/inttypes.h (which is included by sys/types.h)
* defines the types int8, int16, int32, and int64.
*/
#ifdef XP_UNIX
#include <sys/types.h>
#endif
/* model.h on HP-UX defines int8, int16, and int32. */
#ifdef HPUX
#include <model.h>
#endif
/*
* uint
*/
#if !defined(XP_BEOS) && !defined(VMS) \
&& !defined(XP_UNIX) || defined(NTO)
typedef PRUintn uint;
#endif
/*
* uint64
*/
#if !defined(XP_BEOS) && !defined(VMS)
typedef PRUint64 uint64;
#endif
/*
* uint32
*/
#if !defined(XP_BEOS) && !defined(VMS)
#if !defined(XP_MAC) && !defined(_WIN32) && !defined(XP_OS2) && !defined(NTO)
typedef PRUint32 uint32;
#else
typedef unsigned long uint32;
#endif
#endif
/*
* uint16
*/
#if !defined(XP_BEOS) && !defined(VMS)
typedef PRUint16 uint16;
#endif
/*
* uint8
*/
#if !defined(XP_BEOS) && !defined(VMS)
typedef PRUint8 uint8;
#endif
/*
* int64
*/
#if !defined(XP_BEOS) && !defined(VMS) \
&& !defined(_PR_AIX_HAVE_BSD_INT_TYPES)
typedef PRInt64 int64;
#endif
/*
* int32
*/
#if !defined(XP_BEOS) && !defined(VMS) \
&& !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
&& !defined(HPUX)
#if !defined(XP_MAC) && !defined(_WIN32) && !defined(XP_OS2) && !defined(NTO)
typedef PRInt32 int32;
#else
typedef long int32;
#endif
#endif
/*
* int16
*/
#if !defined(XP_BEOS) && !defined(VMS) \
&& !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
&& !defined(HPUX)
typedef PRInt16 int16;
#endif
/*
* int8
*/
#if !defined(XP_BEOS) && !defined(VMS) \
&& !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
&& !defined(HPUX)
typedef PRInt8 int8;
#endif
typedef PRFloat64 float64;
typedef PRUptrdiff uptrdiff_t;
typedef PRUword uprword_t;
typedef PRWord prword_t;
/* Re: prbit.h */
#define TEST_BIT PR_TEST_BIT
#define SET_BIT PR_SET_BIT
#define CLEAR_BIT PR_CLEAR_BIT
/* Re: prarena.h->plarena.h */
#define PRArena PLArena
#define PRArenaPool PLArenaPool
#define PRArenaStats PLArenaStats
#define PR_ARENA_ALIGN PL_ARENA_ALIGN
#define PR_INIT_ARENA_POOL PL_INIT_ARENA_POOL
#define PR_ARENA_ALLOCATE PL_ARENA_ALLOCATE
#define PR_ARENA_GROW PL_ARENA_GROW
#define PR_ARENA_MARK PL_ARENA_MARK
#define PR_CLEAR_UNUSED PL_CLEAR_UNUSED
#define PR_CLEAR_ARENA PL_CLEAR_ARENA
#define PR_ARENA_RELEASE PL_ARENA_RELEASE
#define PR_COUNT_ARENA PL_COUNT_ARENA
#define PR_ARENA_DESTROY PL_ARENA_DESTROY
#define PR_InitArenaPool PL_InitArenaPool
#define PR_FreeArenaPool PL_FreeArenaPool
#define PR_FinishArenaPool PL_FinishArenaPool
#define PR_CompactArenaPool PL_CompactArenaPool
#define PR_ArenaFinish PL_ArenaFinish
#define PR_ArenaAllocate PL_ArenaAllocate
#define PR_ArenaGrow PL_ArenaGrow
#define PR_ArenaRelease PL_ArenaRelease
#define PR_ArenaCountAllocation PL_ArenaCountAllocation
#define PR_ArenaCountInplaceGrowth PL_ArenaCountInplaceGrowth
#define PR_ArenaCountGrowth PL_ArenaCountGrowth
#define PR_ArenaCountRelease PL_ArenaCountRelease
#define PR_ArenaCountRetract PL_ArenaCountRetract
/* Re: prhash.h->plhash.h */
#define PRHashEntry PLHashEntry
#define PRHashTable PLHashTable
#define PRHashNumber PLHashNumber
#define PRHashFunction PLHashFunction
#define PRHashComparator PLHashComparator
#define PRHashEnumerator PLHashEnumerator
#define PRHashAllocOps PLHashAllocOps
#define PR_NewHashTable PL_NewHashTable
#define PR_HashTableDestroy PL_HashTableDestroy
#define PR_HashTableRawLookup PL_HashTableRawLookup
#define PR_HashTableRawAdd PL_HashTableRawAdd
#define PR_HashTableRawRemove PL_HashTableRawRemove
#define PR_HashTableAdd PL_HashTableAdd
#define PR_HashTableRemove PL_HashTableRemove
#define PR_HashTableEnumerateEntries PL_HashTableEnumerateEntries
#define PR_HashTableLookup PL_HashTableLookup
#define PR_HashTableDump PL_HashTableDump
#define PR_HashString PL_HashString
#define PR_CompareStrings PL_CompareStrings
#define PR_CompareValues PL_CompareValues
#if defined(XP_MAC)
#ifndef TRUE /* Mac standard is lower case true */
#define TRUE 1
#endif
#ifndef FALSE /* Mac standard is lower case false */
#define FALSE 0
#endif
#endif
#endif /* !defined(PROTYPES_H) */

@ -0,0 +1,716 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
* This file is used by not only Linux but also other glibc systems
* such as GNU/Hurd and GNU/k*BSD.
*/
#ifndef nspr_cpucfg___
#define nspr_cpucfg___
#ifndef XP_UNIX
#define XP_UNIX
#endif
#if !defined(LINUX) && defined(__linux__)
#define LINUX
#endif
#ifdef __FreeBSD_kernel__
#define PR_AF_INET6 28 /* same as AF_INET6 */
#else
#define PR_AF_INET6 10 /* same as AF_INET6 */
#endif
#ifdef __powerpc64__
#undef IS_LITTLE_ENDIAN
#define IS_BIG_ENDIAN 1
#define IS_64
#define PR_BYTES_PER_BYTE 1
#define PR_BYTES_PER_SHORT 2
#define PR_BYTES_PER_INT 4
#define PR_BYTES_PER_INT64 8
#define PR_BYTES_PER_LONG 8
#define PR_BYTES_PER_FLOAT 4
#define PR_BYTES_PER_DOUBLE 8
#define PR_BYTES_PER_WORD 8
#define PR_BYTES_PER_DWORD 8
#define PR_BITS_PER_BYTE 8
#define PR_BITS_PER_SHORT 16
#define PR_BITS_PER_INT 32
#define PR_BITS_PER_INT64 64
#define PR_BITS_PER_LONG 64
#define PR_BITS_PER_FLOAT 32
#define PR_BITS_PER_DOUBLE 64
#define PR_BITS_PER_WORD 64
#define PR_BITS_PER_BYTE_LOG2 3
#define PR_BITS_PER_SHORT_LOG2 4
#define PR_BITS_PER_INT_LOG2 5
#define PR_BITS_PER_INT64_LOG2 6
#define PR_BITS_PER_LONG_LOG2 6
#define PR_BITS_PER_FLOAT_LOG2 5
#define PR_BITS_PER_DOUBLE_LOG2 6
#define PR_BITS_PER_WORD_LOG2 6
#define PR_ALIGN_OF_SHORT 2
#define PR_ALIGN_OF_INT 4
#define PR_ALIGN_OF_LONG 8
#define PR_ALIGN_OF_INT64 8
#define PR_ALIGN_OF_FLOAT 4
#define PR_ALIGN_OF_DOUBLE 8
#define PR_ALIGN_OF_POINTER 8
#define PR_ALIGN_OF_WORD 8
#define PR_BYTES_PER_WORD_LOG2 3
#define PR_BYTES_PER_DWORD_LOG2 3
#elif defined(__powerpc__)
#undef IS_LITTLE_ENDIAN
#define IS_BIG_ENDIAN 1
#define PR_BYTES_PER_BYTE 1
#define PR_BYTES_PER_SHORT 2
#define PR_BYTES_PER_INT 4
#define PR_BYTES_PER_INT64 8
#define PR_BYTES_PER_LONG 4
#define PR_BYTES_PER_FLOAT 4
#define PR_BYTES_PER_DOUBLE 8
#define PR_BYTES_PER_WORD 4
#define PR_BYTES_PER_DWORD 8
#define PR_BITS_PER_BYTE 8
#define PR_BITS_PER_SHORT 16
#define PR_BITS_PER_INT 32
#define PR_BITS_PER_INT64 64
#define PR_BITS_PER_LONG 32
#define PR_BITS_PER_FLOAT 32
#define PR_BITS_PER_DOUBLE 64
#define PR_BITS_PER_WORD 32
#define PR_BITS_PER_BYTE_LOG2 3
#define PR_BITS_PER_SHORT_LOG2 4
#define PR_BITS_PER_INT_LOG2 5
#define PR_BITS_PER_INT64_LOG2 6
#define PR_BITS_PER_LONG_LOG2 5
#define PR_BITS_PER_FLOAT_LOG2 5
#define PR_BITS_PER_DOUBLE_LOG2 6
#define PR_BITS_PER_WORD_LOG2 5
#define PR_ALIGN_OF_SHORT 2
#define PR_ALIGN_OF_INT 4
#define PR_ALIGN_OF_LONG 4
#define PR_ALIGN_OF_INT64 8
#define PR_ALIGN_OF_FLOAT 4
#define PR_ALIGN_OF_DOUBLE 8
#define PR_ALIGN_OF_POINTER 4
#define PR_ALIGN_OF_WORD 4
#define PR_BYTES_PER_WORD_LOG2 2
#define PR_BYTES_PER_DWORD_LOG2 3
#elif defined(__alpha)
#define IS_LITTLE_ENDIAN 1
#undef IS_BIG_ENDIAN
#define IS_64
#define PR_BYTES_PER_BYTE 1
#define PR_BYTES_PER_SHORT 2
#define PR_BYTES_PER_INT 4
#define PR_BYTES_PER_INT64 8
#define PR_BYTES_PER_LONG 8
#define PR_BYTES_PER_FLOAT 4
#define PR_BYTES_PER_DOUBLE 8
#define PR_BYTES_PER_WORD 8
#define PR_BYTES_PER_DWORD 8
#define PR_BITS_PER_BYTE 8
#define PR_BITS_PER_SHORT 16
#define PR_BITS_PER_INT 32
#define PR_BITS_PER_INT64 64
#define PR_BITS_PER_LONG 64
#define PR_BITS_PER_FLOAT 32
#define PR_BITS_PER_DOUBLE 64
#define PR_BITS_PER_WORD 64
#define PR_BITS_PER_BYTE_LOG2 3
#define PR_BITS_PER_SHORT_LOG2 4
#define PR_BITS_PER_INT_LOG2 5
#define PR_BITS_PER_INT64_LOG2 6
#define PR_BITS_PER_LONG_LOG2 6
#define PR_BITS_PER_FLOAT_LOG2 5
#define PR_BITS_PER_DOUBLE_LOG2 6
#define PR_BITS_PER_WORD_LOG2 6
#define PR_ALIGN_OF_SHORT 2
#define PR_ALIGN_OF_INT 4
#define PR_ALIGN_OF_LONG 8
#define PR_ALIGN_OF_INT64 8
#define PR_ALIGN_OF_FLOAT 4
#define PR_ALIGN_OF_DOUBLE 8
#define PR_ALIGN_OF_POINTER 8
#define PR_ALIGN_OF_WORD 8
#define PR_BYTES_PER_WORD_LOG2 3
#define PR_BYTES_PER_DWORD_LOG2 3
#elif defined(__ia64__)
#define IS_LITTLE_ENDIAN 1
#undef IS_BIG_ENDIAN
#define IS_64
#define PR_BYTES_PER_BYTE 1
#define PR_BYTES_PER_SHORT 2
#define PR_BYTES_PER_INT 4
#define PR_BYTES_PER_INT64 8
#define PR_BYTES_PER_LONG 8
#define PR_BYTES_PER_FLOAT 4
#define PR_BYTES_PER_DOUBLE 8
#define PR_BYTES_PER_WORD 8
#define PR_BYTES_PER_DWORD 8
#define PR_BITS_PER_BYTE 8
#define PR_BITS_PER_SHORT 16
#define PR_BITS_PER_INT 32
#define PR_BITS_PER_INT64 64
#define PR_BITS_PER_LONG 64
#define PR_BITS_PER_FLOAT 32
#define PR_BITS_PER_DOUBLE 64
#define PR_BITS_PER_WORD 64
#define PR_BITS_PER_BYTE_LOG2 3
#define PR_BITS_PER_SHORT_LOG2 4
#define PR_BITS_PER_INT_LOG2 5
#define PR_BITS_PER_INT64_LOG2 6
#define PR_BITS_PER_LONG_LOG2 6
#define PR_BITS_PER_FLOAT_LOG2 5
#define PR_BITS_PER_DOUBLE_LOG2 6
#define PR_BITS_PER_WORD_LOG2 6
#define PR_ALIGN_OF_SHORT 2
#define PR_ALIGN_OF_INT 4
#define PR_ALIGN_OF_LONG 8
#define PR_ALIGN_OF_INT64 8
#define PR_ALIGN_OF_FLOAT 4
#define PR_ALIGN_OF_DOUBLE 8
#define PR_ALIGN_OF_POINTER 8
#define PR_ALIGN_OF_WORD 8
#define PR_BYTES_PER_WORD_LOG2 3
#define PR_BYTES_PER_DWORD_LOG2 3
#elif defined(__x86_64__)
#define IS_LITTLE_ENDIAN 1
#undef IS_BIG_ENDIAN
#define IS_64
#define PR_BYTES_PER_BYTE 1
#define PR_BYTES_PER_SHORT 2
#define PR_BYTES_PER_INT 4
#define PR_BYTES_PER_INT64 8
#define PR_BYTES_PER_LONG 8
#define PR_BYTES_PER_FLOAT 4
#define PR_BYTES_PER_DOUBLE 8
#define PR_BYTES_PER_WORD 8
#define PR_BYTES_PER_DWORD 8
#define PR_BITS_PER_BYTE 8
#define PR_BITS_PER_SHORT 16
#define PR_BITS_PER_INT 32
#define PR_BITS_PER_INT64 64
#define PR_BITS_PER_LONG 64
#define PR_BITS_PER_FLOAT 32
#define PR_BITS_PER_DOUBLE 64
#define PR_BITS_PER_WORD 64
#define PR_BITS_PER_BYTE_LOG2 3
#define PR_BITS_PER_SHORT_LOG2 4
#define PR_BITS_PER_INT_LOG2 5
#define PR_BITS_PER_INT64_LOG2 6
#define PR_BITS_PER_LONG_LOG2 6
#define PR_BITS_PER_FLOAT_LOG2 5
#define PR_BITS_PER_DOUBLE_LOG2 6
#define PR_BITS_PER_WORD_LOG2 6
#define PR_ALIGN_OF_SHORT 2
#define PR_ALIGN_OF_INT 4
#define PR_ALIGN_OF_LONG 8
#define PR_ALIGN_OF_INT64 8
#define PR_ALIGN_OF_FLOAT 4
#define PR_ALIGN_OF_DOUBLE 8
#define PR_ALIGN_OF_POINTER 8
#define PR_ALIGN_OF_WORD 8
#define PR_BYTES_PER_WORD_LOG2 3
#define PR_BYTES_PER_DWORD_LOG2 3
#elif defined(__mc68000__)
#undef IS_LITTLE_ENDIAN
#define IS_BIG_ENDIAN 1
#define PR_BYTES_PER_BYTE 1
#define PR_BYTES_PER_SHORT 2
#define PR_BYTES_PER_INT 4
#define PR_BYTES_PER_INT64 8
#define PR_BYTES_PER_LONG 4
#define PR_BYTES_PER_FLOAT 4
#define PR_BYTES_PER_DOUBLE 8
#define PR_BYTES_PER_WORD 4
#define PR_BYTES_PER_DWORD 8
#define PR_BITS_PER_BYTE 8
#define PR_BITS_PER_SHORT 16
#define PR_BITS_PER_INT 32
#define PR_BITS_PER_INT64 64
#define PR_BITS_PER_LONG 32
#define PR_BITS_PER_FLOAT 32
#define PR_BITS_PER_DOUBLE 64
#define PR_BITS_PER_WORD 32
#define PR_BITS_PER_BYTE_LOG2 3
#define PR_BITS_PER_SHORT_LOG2 4
#define PR_BITS_PER_INT_LOG2 5
#define PR_BITS_PER_INT64_LOG2 6
#define PR_BITS_PER_LONG_LOG2 5
#define PR_BITS_PER_FLOAT_LOG2 5
#define PR_BITS_PER_DOUBLE_LOG2 6
#define PR_BITS_PER_WORD_LOG2 5
#define PR_ALIGN_OF_SHORT 2
#define PR_ALIGN_OF_INT 2
#define PR_ALIGN_OF_LONG 2
#define PR_ALIGN_OF_INT64 2
#define PR_ALIGN_OF_FLOAT 2
#define PR_ALIGN_OF_DOUBLE 2
#define PR_ALIGN_OF_POINTER 2
#define PR_ALIGN_OF_WORD 2
#define PR_BYTES_PER_WORD_LOG2 2
#define PR_BYTES_PER_DWORD_LOG2 3
#elif defined(__sparc__)
#undef IS_LITTLE_ENDIAN
#define IS_BIG_ENDIAN 1
#define PR_BYTES_PER_BYTE 1
#define PR_BYTES_PER_SHORT 2
#define PR_BYTES_PER_INT 4
#define PR_BYTES_PER_INT64 8
#define PR_BYTES_PER_LONG 4
#define PR_BYTES_PER_FLOAT 4
#define PR_BYTES_PER_DOUBLE 8
#define PR_BYTES_PER_WORD 4
#define PR_BYTES_PER_DWORD 8
#define PR_BITS_PER_BYTE 8
#define PR_BITS_PER_SHORT 16
#define PR_BITS_PER_INT 32
#define PR_BITS_PER_INT64 64
#define PR_BITS_PER_LONG 32
#define PR_BITS_PER_FLOAT 32
#define PR_BITS_PER_DOUBLE 64
#define PR_BITS_PER_WORD 32
#define PR_BITS_PER_BYTE_LOG2 3
#define PR_BITS_PER_SHORT_LOG2 4
#define PR_BITS_PER_INT_LOG2 5
#define PR_BITS_PER_INT64_LOG2 6
#define PR_BITS_PER_LONG_LOG2 5
#define PR_BITS_PER_FLOAT_LOG2 5
#define PR_BITS_PER_DOUBLE_LOG2 6
#define PR_BITS_PER_WORD_LOG2 5
#define PR_ALIGN_OF_SHORT 2
#define PR_ALIGN_OF_INT 4
#define PR_ALIGN_OF_LONG 4
#define PR_ALIGN_OF_INT64 8
#define PR_ALIGN_OF_FLOAT 4
#define PR_ALIGN_OF_DOUBLE 8
#define PR_ALIGN_OF_POINTER 4
#define PR_ALIGN_OF_WORD 4
#define PR_BYTES_PER_WORD_LOG2 2
#define PR_BYTES_PER_DWORD_LOG2 3
#elif defined(__i386__)
#define IS_LITTLE_ENDIAN 1
#undef IS_BIG_ENDIAN
#define PR_BYTES_PER_BYTE 1
#define PR_BYTES_PER_SHORT 2
#define PR_BYTES_PER_INT 4
#define PR_BYTES_PER_INT64 8
#define PR_BYTES_PER_LONG 4
#define PR_BYTES_PER_FLOAT 4
#define PR_BYTES_PER_DOUBLE 8
#define PR_BYTES_PER_WORD 4
#define PR_BYTES_PER_DWORD 8
#define PR_BITS_PER_BYTE 8
#define PR_BITS_PER_SHORT 16
#define PR_BITS_PER_INT 32
#define PR_BITS_PER_INT64 64
#define PR_BITS_PER_LONG 32
#define PR_BITS_PER_FLOAT 32
#define PR_BITS_PER_DOUBLE 64
#define PR_BITS_PER_WORD 32
#define PR_BITS_PER_BYTE_LOG2 3
#define PR_BITS_PER_SHORT_LOG2 4
#define PR_BITS_PER_INT_LOG2 5
#define PR_BITS_PER_INT64_LOG2 6
#define PR_BITS_PER_LONG_LOG2 5
#define PR_BITS_PER_FLOAT_LOG2 5
#define PR_BITS_PER_DOUBLE_LOG2 6
#define PR_BITS_PER_WORD_LOG2 5
#define PR_ALIGN_OF_SHORT 2
#define PR_ALIGN_OF_INT 4
#define PR_ALIGN_OF_LONG 4
#define PR_ALIGN_OF_INT64 4
#define PR_ALIGN_OF_FLOAT 4
#define PR_ALIGN_OF_DOUBLE 4
#define PR_ALIGN_OF_POINTER 4
#define PR_ALIGN_OF_WORD 4
#define PR_BYTES_PER_WORD_LOG2 2
#define PR_BYTES_PER_DWORD_LOG2 3
#elif defined(__mips__)
#ifdef __MIPSEB__
#define IS_BIG_ENDIAN 1
#undef IS_LITTLE_ENDIAN
#elif defined(__MIPSEL__)
#define IS_LITTLE_ENDIAN 1
#undef IS_BIG_ENDIAN
#else
#error "Unknown MIPS endianness."
#endif
#define PR_BYTES_PER_BYTE 1
#define PR_BYTES_PER_SHORT 2
#define PR_BYTES_PER_INT 4
#define PR_BYTES_PER_INT64 8
#define PR_BYTES_PER_LONG 4
#define PR_BYTES_PER_FLOAT 4
#define PR_BYTES_PER_DOUBLE 8
#define PR_BYTES_PER_WORD 4
#define PR_BYTES_PER_DWORD 8
#define PR_BITS_PER_BYTE 8
#define PR_BITS_PER_SHORT 16
#define PR_BITS_PER_INT 32
#define PR_BITS_PER_INT64 64
#define PR_BITS_PER_LONG 32
#define PR_BITS_PER_FLOAT 32
#define PR_BITS_PER_DOUBLE 64
#define PR_BITS_PER_WORD 32
#define PR_BITS_PER_BYTE_LOG2 3
#define PR_BITS_PER_SHORT_LOG2 4
#define PR_BITS_PER_INT_LOG2 5
#define PR_BITS_PER_INT64_LOG2 6
#define PR_BITS_PER_LONG_LOG2 5
#define PR_BITS_PER_FLOAT_LOG2 5
#define PR_BITS_PER_DOUBLE_LOG2 6
#define PR_BITS_PER_WORD_LOG2 5
#define PR_ALIGN_OF_SHORT 2
#define PR_ALIGN_OF_INT 4
#define PR_ALIGN_OF_LONG 4
#define PR_ALIGN_OF_INT64 8
#define PR_ALIGN_OF_FLOAT 4
#define PR_ALIGN_OF_DOUBLE 8
#define PR_ALIGN_OF_POINTER 4
#define PR_ALIGN_OF_WORD 4
#define PR_BYTES_PER_WORD_LOG2 2
#define PR_BYTES_PER_DWORD_LOG2 3
#elif defined(__arm__)
#define IS_LITTLE_ENDIAN 1
#undef IS_BIG_ENDIAN
#define PR_BYTES_PER_BYTE 1
#define PR_BYTES_PER_SHORT 2
#define PR_BYTES_PER_INT 4
#define PR_BYTES_PER_INT64 8
#define PR_BYTES_PER_LONG 4
#define PR_BYTES_PER_FLOAT 4
#define PR_BYTES_PER_DOUBLE 8
#define PR_BYTES_PER_WORD 4
#define PR_BYTES_PER_DWORD 8
#define PR_BITS_PER_BYTE 8
#define PR_BITS_PER_SHORT 16
#define PR_BITS_PER_INT 32
#define PR_BITS_PER_INT64 64
#define PR_BITS_PER_LONG 32
#define PR_BITS_PER_FLOAT 32
#define PR_BITS_PER_DOUBLE 64
#define PR_BITS_PER_WORD 32
#define PR_BITS_PER_BYTE_LOG2 3
#define PR_BITS_PER_SHORT_LOG2 4
#define PR_BITS_PER_INT_LOG2 5
#define PR_BITS_PER_INT64_LOG2 6
#define PR_BITS_PER_LONG_LOG2 5
#define PR_BITS_PER_FLOAT_LOG2 5
#define PR_BITS_PER_DOUBLE_LOG2 6
#define PR_BITS_PER_WORD_LOG2 5
#define PR_ALIGN_OF_SHORT 2
#define PR_ALIGN_OF_INT 4
#define PR_ALIGN_OF_LONG 4
#define PR_ALIGN_OF_INT64 4
#define PR_ALIGN_OF_FLOAT 4
#define PR_ALIGN_OF_DOUBLE 4
#define PR_ALIGN_OF_POINTER 4
#define PR_ALIGN_OF_WORD 4
#define PR_BYTES_PER_WORD_LOG2 2
#define PR_BYTES_PER_DWORD_LOG2 3
#elif defined(__hppa__)
#undef IS_LITTLE_ENDIAN
#define IS_BIG_ENDIAN 1
#define PR_BYTES_PER_BYTE 1
#define PR_BYTES_PER_SHORT 2
#define PR_BYTES_PER_INT 4
#define PR_BYTES_PER_INT64 8
#define PR_BYTES_PER_LONG 4
#define PR_BYTES_PER_FLOAT 4
#define PR_BYTES_PER_DOUBLE 8
#define PR_BYTES_PER_WORD 4
#define PR_BYTES_PER_DWORD 8
#define PR_BITS_PER_BYTE 8
#define PR_BITS_PER_SHORT 16
#define PR_BITS_PER_INT 32
#define PR_BITS_PER_INT64 64
#define PR_BITS_PER_LONG 32
#define PR_BITS_PER_FLOAT 32
#define PR_BITS_PER_DOUBLE 64
#define PR_BITS_PER_WORD 32
#define PR_BITS_PER_BYTE_LOG2 3
#define PR_BITS_PER_SHORT_LOG2 4
#define PR_BITS_PER_INT_LOG2 5
#define PR_BITS_PER_INT64_LOG2 6
#define PR_BITS_PER_LONG_LOG2 5
#define PR_BITS_PER_FLOAT_LOG2 5
#define PR_BITS_PER_DOUBLE_LOG2 6
#define PR_BITS_PER_WORD_LOG2 5
#define PR_ALIGN_OF_SHORT 2
#define PR_ALIGN_OF_INT 4
#define PR_ALIGN_OF_LONG 4
#define PR_ALIGN_OF_INT64 8
#define PR_ALIGN_OF_FLOAT 4
#define PR_ALIGN_OF_DOUBLE 8
#define PR_ALIGN_OF_POINTER 4
#define PR_ALIGN_OF_WORD 4
#define PR_BYTES_PER_WORD_LOG2 2
#define PR_BYTES_PER_DWORD_LOG2 3
#elif defined(__s390x__)
#define IS_BIG_ENDIAN 1
#undef IS_LITTLE_ENDIAN
#define IS_64
#define PR_BYTES_PER_BYTE 1
#define PR_BYTES_PER_SHORT 2
#define PR_BYTES_PER_INT 4
#define PR_BYTES_PER_INT64 8
#define PR_BYTES_PER_LONG 8
#define PR_BYTES_PER_FLOAT 4
#define PR_BYTES_PER_DOUBLE 8
#define PR_BYTES_PER_WORD 8
#define PR_BYTES_PER_DWORD 8
#define PR_BITS_PER_BYTE 8
#define PR_BITS_PER_SHORT 16
#define PR_BITS_PER_INT 32
#define PR_BITS_PER_INT64 64
#define PR_BITS_PER_LONG 64
#define PR_BITS_PER_FLOAT 32
#define PR_BITS_PER_DOUBLE 64
#define PR_BITS_PER_WORD 64
#define PR_BITS_PER_BYTE_LOG2 3
#define PR_BITS_PER_SHORT_LOG2 4
#define PR_BITS_PER_INT_LOG2 5
#define PR_BITS_PER_INT64_LOG2 6
#define PR_BITS_PER_LONG_LOG2 6
#define PR_BITS_PER_FLOAT_LOG2 5
#define PR_BITS_PER_DOUBLE_LOG2 6
#define PR_BITS_PER_WORD_LOG2 6
#define PR_ALIGN_OF_SHORT 2
#define PR_ALIGN_OF_INT 4
#define PR_ALIGN_OF_LONG 8
#define PR_ALIGN_OF_INT64 8
#define PR_ALIGN_OF_FLOAT 4
#define PR_ALIGN_OF_DOUBLE 8
#define PR_ALIGN_OF_POINTER 8
#define PR_ALIGN_OF_WORD 8
#define PR_BYTES_PER_WORD_LOG2 3
#define PR_BYTES_PER_DWORD_LOG2 3
#elif defined(__s390__)
#define IS_BIG_ENDIAN 1
#undef IS_LITTLE_ENDIAN
#define PR_BYTES_PER_BYTE 1
#define PR_BYTES_PER_SHORT 2
#define PR_BYTES_PER_INT 4
#define PR_BYTES_PER_INT64 8
#define PR_BYTES_PER_LONG 4
#define PR_BYTES_PER_FLOAT 4
#define PR_BYTES_PER_DOUBLE 8
#define PR_BYTES_PER_WORD 4
#define PR_BYTES_PER_DWORD 8
#define PR_BITS_PER_BYTE 8
#define PR_BITS_PER_SHORT 16
#define PR_BITS_PER_INT 32
#define PR_BITS_PER_INT64 64
#define PR_BITS_PER_LONG 32
#define PR_BITS_PER_FLOAT 32
#define PR_BITS_PER_DOUBLE 64
#define PR_BITS_PER_WORD 32
#define PR_BITS_PER_BYTE_LOG2 3
#define PR_BITS_PER_SHORT_LOG2 4
#define PR_BITS_PER_INT_LOG2 5
#define PR_BITS_PER_INT64_LOG2 6
#define PR_BITS_PER_LONG_LOG2 5
#define PR_BITS_PER_FLOAT_LOG2 5
#define PR_BITS_PER_DOUBLE_LOG2 6
#define PR_BITS_PER_WORD_LOG2 5
#define PR_ALIGN_OF_SHORT 2
#define PR_ALIGN_OF_INT 4
#define PR_ALIGN_OF_LONG 4
#define PR_ALIGN_OF_INT64 4
#define PR_ALIGN_OF_FLOAT 4
#define PR_ALIGN_OF_DOUBLE 4
#define PR_ALIGN_OF_POINTER 4
#define PR_ALIGN_OF_WORD 4
#define PR_BYTES_PER_WORD_LOG2 2
#define PR_BYTES_PER_DWORD_LOG2 3
#else
#error "Unknown CPU architecture"
#endif
#define HAVE_LONG_LONG
#if PR_ALIGN_OF_DOUBLE == 8
#define HAVE_ALIGNED_DOUBLES
#endif
#if PR_ALIGN_OF_INT64 == 8
#define HAVE_ALIGNED_LONGLONGS
#endif
#ifndef NO_NSPR_10_SUPPORT
#define BYTES_PER_BYTE PR_BYTES_PER_BYTE
#define BYTES_PER_SHORT PR_BYTES_PER_SHORT
#define BYTES_PER_INT PR_BYTES_PER_INT
#define BYTES_PER_INT64 PR_BYTES_PER_INT64
#define BYTES_PER_LONG PR_BYTES_PER_LONG
#define BYTES_PER_FLOAT PR_BYTES_PER_FLOAT
#define BYTES_PER_DOUBLE PR_BYTES_PER_DOUBLE
#define BYTES_PER_WORD PR_BYTES_PER_WORD
#define BYTES_PER_DWORD PR_BYTES_PER_DWORD
#define BITS_PER_BYTE PR_BITS_PER_BYTE
#define BITS_PER_SHORT PR_BITS_PER_SHORT
#define BITS_PER_INT PR_BITS_PER_INT
#define BITS_PER_INT64 PR_BITS_PER_INT64
#define BITS_PER_LONG PR_BITS_PER_LONG
#define BITS_PER_FLOAT PR_BITS_PER_FLOAT
#define BITS_PER_DOUBLE PR_BITS_PER_DOUBLE
#define BITS_PER_WORD PR_BITS_PER_WORD
#define BITS_PER_BYTE_LOG2 PR_BITS_PER_BYTE_LOG2
#define BITS_PER_SHORT_LOG2 PR_BITS_PER_SHORT_LOG2
#define BITS_PER_INT_LOG2 PR_BITS_PER_INT_LOG2
#define BITS_PER_INT64_LOG2 PR_BITS_PER_INT64_LOG2
#define BITS_PER_LONG_LOG2 PR_BITS_PER_LONG_LOG2
#define BITS_PER_FLOAT_LOG2 PR_BITS_PER_FLOAT_LOG2
#define BITS_PER_DOUBLE_LOG2 PR_BITS_PER_DOUBLE_LOG2
#define BITS_PER_WORD_LOG2 PR_BITS_PER_WORD_LOG2
#define ALIGN_OF_SHORT PR_ALIGN_OF_SHORT
#define ALIGN_OF_INT PR_ALIGN_OF_INT
#define ALIGN_OF_LONG PR_ALIGN_OF_LONG
#define ALIGN_OF_INT64 PR_ALIGN_OF_INT64
#define ALIGN_OF_FLOAT PR_ALIGN_OF_FLOAT
#define ALIGN_OF_DOUBLE PR_ALIGN_OF_DOUBLE
#define ALIGN_OF_POINTER PR_ALIGN_OF_POINTER
#define ALIGN_OF_WORD PR_ALIGN_OF_WORD
#define BYTES_PER_WORD_LOG2 PR_BYTES_PER_WORD_LOG2
#define BYTES_PER_DWORD_LOG2 PR_BYTES_PER_DWORD_LOG2
#define WORDS_PER_DWORD_LOG2 PR_WORDS_PER_DWORD_LOG2
#endif /* NO_NSPR_10_SUPPORT */
#endif /* nspr_cpucfg___ */

@ -0,0 +1,544 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
** File: prtypes.h
** Description: Definitions of NSPR's basic types
**
** Prototypes and macros used to make up for deficiencies that we have found
** in ANSI environments.
**
** Since we do not wrap <stdlib.h> and all the other standard headers, authors
** of portable code will not know in general that they need these definitions.
** Instead of requiring these authors to find the dependent uses in their code
** and take the following steps only in those C files, we take steps once here
** for all C files.
**/
#ifndef prtypes_h___
#define prtypes_h___
#ifdef MDCPUCFG
#include MDCPUCFG
#else
#include "prcpucfg.h"
#endif
#include <stddef.h>
/***********************************************************************
** MACROS: PR_EXTERN
** PR_IMPLEMENT
** DESCRIPTION:
** These are only for externally visible routines and globals. For
** internal routines, just use "extern" for type checking and that
** will not export internal cross-file or forward-declared symbols.
** Define a macro for declaring procedures return types. We use this to
** deal with windoze specific type hackery for DLL definitions. Use
** PR_EXTERN when the prototype for the method is declared. Use
** PR_IMPLEMENT for the implementation of the method.
**
** Example:
** in dowhim.h
** PR_EXTERN( void ) DoWhatIMean( void );
** in dowhim.c
** PR_IMPLEMENT( void ) DoWhatIMean( void ) { return; }
**
**
***********************************************************************/
#if defined(WIN32)
#define PR_EXPORT(__type) extern __declspec(dllexport) __type
#define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
#define PR_IMPORT(__type) __declspec(dllimport) __type
#define PR_IMPORT_DATA(__type) __declspec(dllimport) __type
#define PR_EXTERN(__type) extern __declspec(dllexport) __type
#define PR_IMPLEMENT(__type) __declspec(dllexport) __type
#define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type
#define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type
#define PR_CALLBACK
#define PR_CALLBACK_DECL
#define PR_STATIC_CALLBACK(__x) static __x
#elif defined(XP_BEOS)
#define PR_EXPORT(__type) extern __declspec(dllexport) __type
#define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
#define PR_IMPORT(__type) extern __declspec(dllexport) __type
#define PR_IMPORT_DATA(__type) extern __declspec(dllexport) __type
#define PR_EXTERN(__type) extern __declspec(dllexport) __type
#define PR_IMPLEMENT(__type) __declspec(dllexport) __type
#define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type
#define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type
#define PR_CALLBACK
#define PR_CALLBACK_DECL
#define PR_STATIC_CALLBACK(__x) static __x
#elif defined(WIN16)
#define PR_CALLBACK_DECL __cdecl
#if defined(_WINDLL)
#define PR_EXPORT(__type) extern __type _cdecl _export _loadds
#define PR_IMPORT(__type) extern __type _cdecl _export _loadds
#define PR_EXPORT_DATA(__type) extern __type _export
#define PR_IMPORT_DATA(__type) extern __type _export
#define PR_EXTERN(__type) extern __type _cdecl _export _loadds
#define PR_IMPLEMENT(__type) __type _cdecl _export _loadds
#define PR_EXTERN_DATA(__type) extern __type _export
#define PR_IMPLEMENT_DATA(__type) __type _export
#define PR_CALLBACK __cdecl __loadds
#define PR_STATIC_CALLBACK(__x) static __x PR_CALLBACK
#else /* this must be .EXE */
#define PR_EXPORT(__type) extern __type _cdecl _export
#define PR_IMPORT(__type) extern __type _cdecl _export
#define PR_EXPORT_DATA(__type) extern __type _export
#define PR_IMPORT_DATA(__type) extern __type _export
#define PR_EXTERN(__type) extern __type _cdecl _export
#define PR_IMPLEMENT(__type) __type _cdecl _export
#define PR_EXTERN_DATA(__type) extern __type _export
#define PR_IMPLEMENT_DATA(__type) __type _export
#define PR_CALLBACK __cdecl __loadds
#define PR_STATIC_CALLBACK(__x) __x PR_CALLBACK
#endif /* _WINDLL */
#elif defined(XP_MAC)
#define PR_EXPORT(__type) extern __declspec(export) __type
#define PR_EXPORT_DATA(__type) extern __declspec(export) __type
#define PR_IMPORT(__type) extern __declspec(export) __type
#define PR_IMPORT_DATA(__type) extern __declspec(export) __type
#define PR_EXTERN(__type) extern __declspec(export) __type
#define PR_IMPLEMENT(__type) __declspec(export) __type
#define PR_EXTERN_DATA(__type) extern __declspec(export) __type
#define PR_IMPLEMENT_DATA(__type) __declspec(export) __type
#define PR_CALLBACK
#define PR_CALLBACK_DECL
#define PR_STATIC_CALLBACK(__x) static __x
#elif defined(XP_OS2_VACPP)
#define PR_EXPORT(__type) extern __type
#define PR_EXPORT_DATA(__type) extern __type
#define PR_IMPORT(__type) extern __type
#define PR_IMPORT_DATA(__type) extern __type
#define PR_EXTERN(__type) extern __type
#define PR_IMPLEMENT(__type) __type
#define PR_EXTERN_DATA(__type) extern __type
#define PR_IMPLEMENT_DATA(__type) __type
#define PR_CALLBACK _Optlink
#define PR_CALLBACK_DECL
#define PR_STATIC_CALLBACK(__x) static __x PR_CALLBACK
#else /* Unix */
/* GCC 3.3 and later support the visibility attribute. */
#if (__GNUC__ >= 4) || \
(__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
#define PR_VISIBILITY_DEFAULT __attribute__((visibility("default")))
#else
#define PR_VISIBILITY_DEFAULT
#endif
#define PR_EXPORT(__type) extern PR_VISIBILITY_DEFAULT __type
#define PR_EXPORT_DATA(__type) extern PR_VISIBILITY_DEFAULT __type
#define PR_IMPORT(__type) extern PR_VISIBILITY_DEFAULT __type
#define PR_IMPORT_DATA(__type) extern PR_VISIBILITY_DEFAULT __type
#define PR_EXTERN(__type) extern PR_VISIBILITY_DEFAULT __type
#define PR_IMPLEMENT(__type) PR_VISIBILITY_DEFAULT __type
#define PR_EXTERN_DATA(__type) extern PR_VISIBILITY_DEFAULT __type
#define PR_IMPLEMENT_DATA(__type) PR_VISIBILITY_DEFAULT __type
#define PR_CALLBACK
#define PR_CALLBACK_DECL
#define PR_STATIC_CALLBACK(__x) static __x
#endif
#if defined(_NSPR_BUILD_)
#define NSPR_API(__type) PR_EXPORT(__type)
#define NSPR_DATA_API(__type) PR_EXPORT_DATA(__type)
#else
#define NSPR_API(__type) PR_IMPORT(__type)
#define NSPR_DATA_API(__type) PR_IMPORT_DATA(__type)
#endif
/***********************************************************************
** MACROS: PR_BEGIN_MACRO
** PR_END_MACRO
** DESCRIPTION:
** Macro body brackets so that macros with compound statement definitions
** behave syntactically more like functions when called.
***********************************************************************/
#define PR_BEGIN_MACRO do {
#define PR_END_MACRO } while (0)
/***********************************************************************
** MACROS: PR_BEGIN_EXTERN_C
** PR_END_EXTERN_C
** DESCRIPTION:
** Macro shorthands for conditional C++ extern block delimiters.
***********************************************************************/
#ifdef __cplusplus
#define PR_BEGIN_EXTERN_C extern "C" {
#define PR_END_EXTERN_C }
#else
#define PR_BEGIN_EXTERN_C
#define PR_END_EXTERN_C
#endif
/***********************************************************************
** MACROS: PR_BIT
** PR_BITMASK
** DESCRIPTION:
** Bit masking macros. XXX n must be <= 31 to be portable
***********************************************************************/
#define PR_BIT(n) ((PRUint32)1 << (n))
#define PR_BITMASK(n) (PR_BIT(n) - 1)
/***********************************************************************
** MACROS: PR_ROUNDUP
** PR_MIN
** PR_MAX
** PR_ABS
** DESCRIPTION:
** Commonly used macros for operations on compatible types.
***********************************************************************/
#define PR_ROUNDUP(x,y) ((((x)+((y)-1))/(y))*(y))
#define PR_MIN(x,y) ((x)<(y)?(x):(y))
#define PR_MAX(x,y) ((x)>(y)?(x):(y))
#define PR_ABS(x) ((x)<0?-(x):(x))
PR_BEGIN_EXTERN_C
/************************************************************************
** TYPES: PRUint8
** PRInt8
** DESCRIPTION:
** The int8 types are known to be 8 bits each. There is no type that
** is equivalent to a plain "char".
************************************************************************/
#if PR_BYTES_PER_BYTE == 1
typedef unsigned char PRUint8;
/*
** Some cfront-based C++ compilers do not like 'signed char' and
** issue the warning message:
** warning: "signed" not implemented (ignored)
** For these compilers, we have to define PRInt8 as plain 'char'.
** Make sure that plain 'char' is indeed signed under these compilers.
*/
#if (defined(HPUX) && defined(__cplusplus) \
&& !defined(__GNUC__) && __cplusplus < 199707L) \
|| (defined(SCO) && defined(__cplusplus) \
&& !defined(__GNUC__) && __cplusplus == 1L)
typedef char PRInt8;
#else
typedef signed char PRInt8;
#endif
#else
#error No suitable type for PRInt8/PRUint8
#endif
/************************************************************************
* MACROS: PR_INT8_MAX
* PR_INT8_MIN
* PR_UINT8_MAX
* DESCRIPTION:
* The maximum and minimum values of a PRInt8 or PRUint8.
************************************************************************/
#define PR_INT8_MAX 127
#define PR_INT8_MIN (-128)
#define PR_UINT8_MAX 255U
/************************************************************************
** TYPES: PRUint16
** PRInt16
** DESCRIPTION:
** The int16 types are known to be 16 bits each.
************************************************************************/
#if PR_BYTES_PER_SHORT == 2
typedef unsigned short PRUint16;
typedef short PRInt16;
#else
#error No suitable type for PRInt16/PRUint16
#endif
/************************************************************************
* MACROS: PR_INT16_MAX
* PR_INT16_MIN
* PR_UINT16_MAX
* DESCRIPTION:
* The maximum and minimum values of a PRInt16 or PRUint16.
************************************************************************/
#define PR_INT16_MAX 32767
#define PR_INT16_MIN (-32768)
#define PR_UINT16_MAX 65535U
/************************************************************************
** TYPES: PRUint32
** PRInt32
** DESCRIPTION:
** The int32 types are known to be 32 bits each.
************************************************************************/
#if PR_BYTES_PER_INT == 4
typedef unsigned int PRUint32;
typedef int PRInt32;
#define PR_INT32(x) x
#define PR_UINT32(x) x ## U
#elif PR_BYTES_PER_LONG == 4
typedef unsigned long PRUint32;
typedef long PRInt32;
#define PR_INT32(x) x ## L
#define PR_UINT32(x) x ## UL
#else
#error No suitable type for PRInt32/PRUint32
#endif
/************************************************************************
* MACROS: PR_INT32_MAX
* PR_INT32_MIN
* PR_UINT32_MAX
* DESCRIPTION:
* The maximum and minimum values of a PRInt32 or PRUint32.
************************************************************************/
#define PR_INT32_MAX PR_INT32(2147483647)
#define PR_INT32_MIN (-PR_INT32_MAX - 1)
#define PR_UINT32_MAX PR_UINT32(4294967295)
/************************************************************************
** TYPES: PRUint64
** PRInt64
** DESCRIPTION:
** The int64 types are known to be 64 bits each. Care must be used when
** declaring variables of type PRUint64 or PRInt64. Different hardware
** architectures and even different compilers have varying support for
** 64 bit values. The only guaranteed portability requires the use of
** the LL_ macros (see prlong.h).
************************************************************************/
#ifdef HAVE_LONG_LONG
#if PR_BYTES_PER_LONG == 8
typedef long PRInt64;
typedef unsigned long PRUint64;
#elif defined(WIN16)
typedef __int64 PRInt64;
typedef unsigned __int64 PRUint64;
#elif defined(WIN32) && !defined(__GNUC__)
typedef __int64 PRInt64;
typedef unsigned __int64 PRUint64;
#else
typedef long long PRInt64;
typedef unsigned long long PRUint64;
#endif /* PR_BYTES_PER_LONG == 8 */
#else /* !HAVE_LONG_LONG */
typedef struct {
#ifdef IS_LITTLE_ENDIAN
PRUint32 lo, hi;
#else
PRUint32 hi, lo;
#endif
} PRInt64;
typedef PRInt64 PRUint64;
#endif /* !HAVE_LONG_LONG */
/************************************************************************
** TYPES: PRUintn
** PRIntn
** DESCRIPTION:
** The PRIntn types are most appropriate for automatic variables. They are
** guaranteed to be at least 16 bits, though various architectures may
** define them to be wider (e.g., 32 or even 64 bits). These types are
** never valid for fields of a structure.
************************************************************************/
#if PR_BYTES_PER_INT >= 2
typedef int PRIntn;
typedef unsigned int PRUintn;
#else
#error 'sizeof(int)' not sufficient for platform use
#endif
/************************************************************************
** TYPES: PRFloat64
** DESCRIPTION:
** NSPR's floating point type is always 64 bits.
************************************************************************/
typedef double PRFloat64;
/************************************************************************
** TYPES: PRSize
** DESCRIPTION:
** A type for representing the size of objects.
************************************************************************/
typedef size_t PRSize;
/************************************************************************
** TYPES: PROffset32, PROffset64
** DESCRIPTION:
** A type for representing byte offsets from some location.
************************************************************************/
typedef PRInt32 PROffset32;
typedef PRInt64 PROffset64;
/************************************************************************
** TYPES: PRPtrDiff
** DESCRIPTION:
** A type for pointer difference. Variables of this type are suitable
** for storing a pointer or pointer subtraction.
************************************************************************/
typedef ptrdiff_t PRPtrdiff;
/************************************************************************
** TYPES: PRUptrdiff
** DESCRIPTION:
** A type for pointer difference. Variables of this type are suitable
** for storing a pointer or pointer sutraction.
************************************************************************/
typedef unsigned long PRUptrdiff;
/************************************************************************
** TYPES: PRBool
** DESCRIPTION:
** Use PRBool for variables and parameter types. Use PR_FALSE and PR_TRUE
** for clarity of target type in assignments and actual arguments. Use
** 'if (bool)', 'while (!bool)', '(bool) ? x : y' etc., to test booleans
** just as you would C int-valued conditions.
************************************************************************/
typedef PRIntn PRBool;
#define PR_TRUE 1
#define PR_FALSE 0
/************************************************************************
** TYPES: PRPackedBool
** DESCRIPTION:
** Use PRPackedBool within structs where bitfields are not desirable
** but minimum and consistant overhead matters.
************************************************************************/
typedef PRUint8 PRPackedBool;
/*
** Status code used by some routines that have a single point of failure or
** special status return.
*/
typedef enum { PR_FAILURE = -1, PR_SUCCESS = 0 } PRStatus;
#ifndef __PRUNICHAR__
#define __PRUNICHAR__
#if defined(WIN32) || defined(XP_MAC)
typedef wchar_t PRUnichar;
#else
typedef PRUint16 PRUnichar;
#endif
#endif
/*
** WARNING: The undocumented data types PRWord and PRUword are
** only used in the garbage collection and arena code. Do not
** use PRWord and PRUword in new code.
**
** A PRWord is an integer that is the same size as a void*.
** It implements the notion of a "word" in the Java Virtual
** Machine. (See Sec. 3.4 "Words", The Java Virtual Machine
** Specification, Addison-Wesley, September 1996.
** http://java.sun.com/docs/books/vmspec/index.html.)
*/
typedef long PRWord;
typedef unsigned long PRUword;
#if defined(NO_NSPR_10_SUPPORT)
#else
/********* ???????????????? FIX ME ??????????????????????????? *****/
/********************** Some old definitions until pr=>ds transition is done ***/
/********************** Also, we are still using NSPR 1.0. GC ******************/
/*
** Fundamental NSPR macros, used nearly everywhere.
*/
#define PR_PUBLIC_API PR_IMPLEMENT
/*
** Macro body brackets so that macros with compound statement definitions
** behave syntactically more like functions when called.
*/
#define NSPR_BEGIN_MACRO do {
#define NSPR_END_MACRO } while (0)
/*
** Macro shorthands for conditional C++ extern block delimiters.
*/
#ifdef NSPR_BEGIN_EXTERN_C
#undef NSPR_BEGIN_EXTERN_C
#endif
#ifdef NSPR_END_EXTERN_C
#undef NSPR_END_EXTERN_C
#endif
#ifdef __cplusplus
#define NSPR_BEGIN_EXTERN_C extern "C" {
#define NSPR_END_EXTERN_C }
#else
#define NSPR_BEGIN_EXTERN_C
#define NSPR_END_EXTERN_C
#endif
#ifdef XP_MAC
#include "protypes.h"
#else
#include "obsolete/protypes.h"
#endif
/********* ????????????? End Fix me ?????????????????????????????? *****/
#endif /* NO_NSPR_10_SUPPORT */
PR_END_EXTERN_C
#endif /* prtypes_h___ */

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

File diff suppressed because it is too large Load Diff

@ -0,0 +1,720 @@
/**
* Copyright (C) 2006 by Koos Vriezen <koos.vriezen@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
**/
#include <stdio.h>
#include <config.h>
// include files for Qt
#include <qapplication.h>
#include <qclipboard.h>
#include <qpopupmenu.h>
#include <qdrawutil.h>
#include <qpainter.h>
#include <qiconset.h>
#include <qpixmap.h>
#include <qheader.h>
#include <qstyle.h>
#include <qtimer.h>
#include <kiconloader.h>
#include <kfinddialog.h>
#include <kurldrag.h>
#include <kaction.h>
#include <klocale.h>
#include <kdebug.h>
#include "playlistview.h"
#include "kmplayerview.h"
#include "kmplayercontrolpanel.h"
using namespace KMPlayer;
//-------------------------------------------------------------------------
namespace KMPlayer {
KDE_NO_EXPORT bool isDragValid (QDropEvent * de) {
if (KURLDrag::canDecode (de))
return true;
if (QTextDrag::canDecode (de)) {
QString text;
if (QTextDrag::decode (de, text) && KURL (text).isValid ())
return true;
}
return false;
}
}
//-----------------------------------------------------------------------------
KDE_NO_CDTOR_EXPORT PlayListItem::PlayListItem (QListViewItem *p, const NodePtr & e, PlayListView * lv) : QListViewItem (p), node (e), listview (lv) {}
KDE_NO_CDTOR_EXPORT PlayListItem::PlayListItem (QListViewItem *p, const AttributePtr & a, PlayListView * lv) : QListViewItem (p), m_attr (a), listview (lv) {}
KDE_NO_CDTOR_EXPORT
PlayListItem::PlayListItem (PlayListView *v, const NodePtr &e, QListViewItem *b)
: QListViewItem (v, b), node (e), listview (v) {}
KDE_NO_CDTOR_EXPORT void PlayListItem::paintCell (QPainter * p, const QColorGroup & cg, int column, int width, int align) {
if (node && node->state == Node::state_began) {
QColorGroup mycg (cg);
mycg.setColor (QColorGroup::Foreground, listview->activeColor ());
mycg.setColor (QColorGroup::Text, listview->activeColor ());
QListViewItem::paintCell (p, mycg, column, width, align);
} else
QListViewItem::paintCell (p, cg, column, width, align);
}
KDE_NO_CDTOR_EXPORT void PlayListItem::paintBranches (QPainter * p, const QColorGroup &, int w, int, int h) {
p->fillRect (0, 0, w, h, listview->paletteBackgroundColor());
}
//-----------------------------------------------------------------------------
KDE_NO_CDTOR_EXPORT
RootPlayListItem::RootPlayListItem (int _id, PlayListView *v, const NodePtr & e, QListViewItem * before, int flgs)
: PlayListItem (v, e, before),
id (_id),
flags (flgs),
show_all_nodes (false),
have_dark_nodes (false) {}
KDE_NO_CDTOR_EXPORT void RootPlayListItem::paintCell (QPainter * p, const QColorGroup & cg, int column, int width, int align) {
QColorGroup mycg (cg);
mycg.setColor (QColorGroup::Base, listview->topLevelWidget()->paletteBackgroundColor());
mycg.setColor (QColorGroup::Highlight, mycg.base ());
mycg.setColor (QColorGroup::Text, listview->topLevelWidget()->paletteForegroundColor());
mycg.setColor (QColorGroup::HighlightedText, mycg.text ());
QListViewItem::paintCell (p, mycg, column, width, align);
qDrawShadeRect (p, 0, 0, width -1, height () -1, mycg, !isOpen ());
}
//-----------------------------------------------------------------------------
KDE_NO_CDTOR_EXPORT PlayListView::PlayListView (QWidget * parent, View * view, KActionCollection * ac)
: KListView (parent, "kde_kmplayer_playlist"),
m_view (view),
m_find_dialog (0L),
m_active_color (30, 0, 255),
last_id (0),
last_drag_tree_id (0),
m_ignore_expanded (false) {
addColumn (QString ());
header()->hide ();
//setRootIsDecorated (true);
setSorting (-1);
setAcceptDrops (true);
setDropVisualizer (true);
setItemsRenameable (true);
setItemMargin (2);
setPaletteBackgroundColor (QColor (0, 0, 0));
setPaletteForegroundColor (QColor (0xB2, 0xB2, 0xB2));
m_itemmenu = new QPopupMenu (this);
folder_pix = KGlobal::iconLoader ()->loadIcon (QString ("folder"), KIcon::Small);
auxiliary_pix = KGlobal::iconLoader ()->loadIcon (QString ("folder_grey"), KIcon::Small);
video_pix = KGlobal::iconLoader ()->loadIcon (QString ("video"), KIcon::Small);
info_pix = KGlobal::iconLoader ()->loadIcon (QString ("messagebox_info"), KIcon::Small);
img_pix = KGlobal::iconLoader ()->loadIcon (QString ("colorize"), KIcon::Small);
unknown_pix = KGlobal::iconLoader ()->loadIcon (QString ("unknown"), KIcon::Small);
menu_pix = KGlobal::iconLoader ()->loadIcon (QString ("player_playlist"), KIcon::Small);
config_pix = KGlobal::iconLoader ()->loadIcon (QString ("configure"), KIcon::Small);
url_pix = KGlobal::iconLoader ()->loadIcon (QString ("www"), KIcon::Small);
m_find = KStdAction::find (this, SLOT (slotFind ()), ac, "find");
m_find_next = KStdAction::findNext (this, SLOT(slotFindNext()), ac, "next");
m_find_next->setEnabled (false);
connect (this, SIGNAL (contextMenuRequested (QListViewItem *, const QPoint &, int)), this, SLOT (contextMenuItem (QListViewItem *, const QPoint &, int)));
connect (this, SIGNAL (expanded (QListViewItem *)),
this, SLOT (itemExpanded (QListViewItem *)));
connect (this, SIGNAL (dropped (QDropEvent *, QListViewItem *)),
this, SLOT (itemDropped (QDropEvent *, QListViewItem *)));
connect (this, SIGNAL (itemRenamed (QListViewItem *)),
this, SLOT (itemIsRenamed (QListViewItem *)));
connect (this, SIGNAL (selectionChanged (QListViewItem *)),
this, SLOT (itemIsSelected (QListViewItem *)));
}
KDE_NO_CDTOR_EXPORT PlayListView::~PlayListView () {
}
int PlayListView::addTree (NodePtr root, const QString & source, const QString & icon, int flags) {
//kdDebug () << "addTree " << source << " " << root->mrl()->src << endl;
RootPlayListItem * ritem = new RootPlayListItem (++last_id, this, root, lastChild(), flags);
ritem->source = source;
ritem->icon = icon;
ritem->setPixmap (0, !ritem->icon.isEmpty ()
? KGlobal::iconLoader ()->loadIcon (ritem->icon, KIcon::Small)
: url_pix);
updateTree (ritem, 0L, false);
return last_id;
}
KDE_NO_EXPORT PlayListItem * PlayListView::populate
(NodePtr e, NodePtr focus, RootPlayListItem *root, PlayListItem * pitem, PlayListItem ** curitem) {
root->have_dark_nodes |= !e->expose ();
if (pitem && !root->show_all_nodes && !e->expose ()) {
for (NodePtr c = e->lastChild (); c; c = c->previousSibling ())
populate (c, focus, root, pitem, curitem);
return pitem;
}
PlayListItem * item = pitem ? new PlayListItem (pitem, e, this) : root;
Mrl * mrl = e->mrl ();
QString text (e->nodeName());
if (mrl && !root->show_all_nodes) {
if (mrl->pretty_name.isEmpty ()) {
if (!mrl->src.isEmpty())
text = KURL(mrl->src).prettyURL (0, KURL::StripFileProtocol);
else if (e->isDocument ())
text = e->hasChildNodes () ? i18n ("unnamed") : i18n ("none");
} else
text = mrl->pretty_name;
} else if (e->id == id_node_text)
text = e->nodeValue ();
item->setText(0, text);
if (focus == e)
*curitem = item;
if (e->active ())
ensureItemVisible (item);
for (NodePtr c = e->lastChild (); c; c = c->previousSibling ())
populate (c, focus, root, item, curitem);
if (e->isElementNode ()) {
AttributePtr a = convertNode<Element> (e)->attributes ()->first ();
if (a) {
root->have_dark_nodes = true;
if (root->show_all_nodes) {
PlayListItem * as = new PlayListItem (item, e, this);
as->setText (0, i18n ("[attributes]"));
as->setPixmap (0, menu_pix);
for (; a; a = a->nextSibling ()) {
PlayListItem * ai = new PlayListItem (as, a, this);
ai->setText (0, QString ("%1=%2").arg (
a->name ().toString ()).arg (a->value ()));
ai->setPixmap (0, config_pix);
}
}
}
}
if (item != root) {
Node::PlayType pt = e->playType ();
QPixmap * pix;
switch (pt) {
case Node::play_type_image:
pix = &img_pix;
break;
case Node::play_type_info:
pix = &info_pix;
break;
default:
if (pt > Node::play_type_none)
pix = &video_pix;
else
pix = item->firstChild ()
? e->auxiliaryNode ()
? &auxiliary_pix : &folder_pix
: &unknown_pix;
}
item->setPixmap (0, *pix);
if (root->flags & PlayListView::AllowDrag)
item->setDragEnabled (true);
}
return item;
}
void PlayListView::updateTree (int id, NodePtr root, NodePtr active,
bool select, bool open) {
// TODO, if root is same as rootitems->node and treeversion is the same
// and show all nodes is unchanged then only update the cells
QWidget * w = focusWidget ();
if (w && w != this)
w->clearFocus ();
//setSelected (firstChild (), true);
RootPlayListItem * ritem = static_cast <RootPlayListItem *> (firstChild ());
RootPlayListItem * before = 0L;
for (; ritem; ritem =static_cast<RootPlayListItem*>(ritem->nextSibling())) {
if (ritem->id == id) {
if (!root)
root = ritem->node;
break; // found based on id
}
if (id == -1) { // wildcard id
for (NodePtr n = root; n; n = n->parentNode ())
if (n == ritem->node) {
root = n;
break;
}
if (root == ritem->node) {
id = ritem->id;
break; // found based on matching (ancestor) node
}
}
if (ritem->id < id)
before = ritem;
}
if (!root) {
delete ritem;
return;
}
if (!ritem) {
ritem =new RootPlayListItem(id, this, root, before,AllowDrops|TreeEdit);
ritem->setPixmap (0, url_pix);
} else
ritem->node = root;
m_find_next->setEnabled (!!m_current_find_elm);
bool need_timer = !tree_update;
tree_update = new TreeUpdate (ritem, active, select, open, tree_update);
if (need_timer)
QTimer::singleShot (0, this, SLOT (updateTrees ()));
}
KDE_NO_EXPORT void PlayListView::updateTrees () {
for (; tree_update; tree_update = tree_update->next) {
updateTree (tree_update->root_item, tree_update->node, tree_update->select);
if (tree_update->open) // FIXME for non-root nodes lazy loading
setOpen (tree_update->root_item, true);
}
}
void PlayListView::updateTree (RootPlayListItem * ritem, NodePtr active, bool select) {
bool set_open = ritem->id == 0 || (ritem ? ritem->isOpen () : false);
m_ignore_expanded = true;
PlayListItem * curitem = 0L;
while (ritem->firstChild ())
delete ritem->firstChild ();
if (!ritem->node)
return;
populate (ritem->node, active, ritem, 0L, &curitem);
if (set_open && ritem->firstChild () && !ritem->isOpen ())
setOpen (ritem, true);
if (curitem && select) {
setSelected (curitem, true);
ensureItemVisible (curitem);
}
if (!ritem->have_dark_nodes && ritem->show_all_nodes && !m_view->editMode())
toggleShowAllNodes (); // redo, because the user can't change it anymore
m_ignore_expanded = false;
}
void PlayListView::selectItem (const QString & txt) {
QListViewItem * item = selectedItem ();
if (item && item->text (0) == txt)
return;
item = findItem (txt, 0);
if (item) {
setSelected (item, true);
ensureItemVisible (item);
}
}
KDE_NO_EXPORT QDragObject * PlayListView::dragObject () {
PlayListItem * item = static_cast <PlayListItem *> (selectedItem ());
if (item && item->node) {
QString txt = item->node->isPlayable ()
? item->node->mrl ()->src : item->node->outerXML ();
QTextDrag * drag = new QTextDrag (txt, this);
last_drag_tree_id = rootItem (item)->id;
m_last_drag = item->node;
drag->setPixmap (*item->pixmap (0));
if (!item->node->isPlayable ())
drag->setSubtype ("xml");
return drag;
}
return 0;
}
KDE_NO_EXPORT void PlayListView::setFont (const QFont & fnt) {
setTreeStepSize (QFontMetrics (fnt).boundingRect ('m').width ());
KListView::setFont (fnt);
}
KDE_NO_EXPORT void PlayListView::contextMenuItem (QListViewItem * vi, const QPoint & p, int) {
if (vi) {
PlayListItem * item = static_cast <PlayListItem *> (vi);
if (item->node || item->m_attr) {
RootPlayListItem * ritem = rootItem (vi);
if (m_itemmenu->count () > 0) {
m_find->unplug (m_itemmenu);
m_find_next->unplug (m_itemmenu);
m_itemmenu->clear ();
}
m_itemmenu->insertItem (KGlobal::iconLoader ()->loadIconSet
(QString ("editcopy"), KIcon::Small, 0, true),
i18n ("&Copy to Clipboard"),
this, SLOT (copyToClipboard ()), 0, 0);
if (item->m_attr ||
(item->node && (item->node->isPlayable () ||
item->node->isDocument ()) &&
item->node->mrl ()->bookmarkable))
m_itemmenu->insertItem (KGlobal::iconLoader ()->loadIconSet
(QString ("bookmark_add"), KIcon::Small, 0, true),
i18n ("&Add Bookmark"),
this, SLOT (addBookMark ()), 0, 1);
if (ritem->have_dark_nodes) {
m_itemmenu->insertItem (i18n ("&Show all"),
this, SLOT (toggleShowAllNodes ()), 0, 2);
m_itemmenu->setItemChecked (2, ritem->show_all_nodes);
}
m_itemmenu->insertSeparator ();
m_find->plug (m_itemmenu);
m_find_next->plug (m_itemmenu);
emit prepareMenu (item, m_itemmenu);
m_itemmenu->exec (p);
}
} else
m_view->controlPanel ()->popupMenu ()->exec (p);
}
void PlayListView::itemExpanded (QListViewItem * item) {
if (!m_ignore_expanded && item->childCount () == 1) {
PlayListItem * child_item = static_cast<PlayListItem*>(item->firstChild ());
child_item->setOpen (rootItem (item)->show_all_nodes ||
(child_item->node && child_item->node->expose ()));
}
}
RootPlayListItem * PlayListView::rootItem (QListViewItem * item) const {
if (!item)
return 0L;
while (item->parent ())
item = item->parent ();
return static_cast <RootPlayListItem *> (item);
}
RootPlayListItem * PlayListView::rootItem (int id) const {
RootPlayListItem * ri = static_cast <RootPlayListItem *> (firstChild ());
for (; ri; ri = static_cast <RootPlayListItem *> (ri->nextSibling ())) {
if (ri->id == id)
return ri;
}
return 0L;
}
void PlayListView::copyToClipboard () {
PlayListItem * item = currentPlayListItem ();
QString text = item->text (0);
if (item->node) {
Mrl * mrl = item->node->mrl ();
if (mrl && !mrl->src.isEmpty ())
text = mrl->src;
}
QApplication::clipboard()->setText (text);
}
void PlayListView::addBookMark () {
PlayListItem * item = currentPlayListItem ();
if (item->node) {
Mrl * mrl = item->node->mrl ();
KURL url (mrl ? mrl->src : QString (item->node->nodeName ()));
emit addBookMark (mrl->pretty_name.isEmpty () ? url.prettyURL () : mrl->pretty_name, url.url ());
}
}
void PlayListView::toggleShowAllNodes () {
PlayListItem * cur_item = currentPlayListItem ();
if (cur_item) {
RootPlayListItem * ritem = rootItem (cur_item);
showAllNodes (rootItem (cur_item), !ritem->show_all_nodes);
}
}
KDE_NO_EXPORT void PlayListView::showAllNodes(RootPlayListItem *ri, bool show) {
if (ri && ri->show_all_nodes != show) {
PlayListItem * cur_item = currentPlayListItem ();
ri->show_all_nodes = show;
updateTree (ri->id, ri->node, cur_item->node, true, false);
if (m_current_find_elm &&
ri->node->document() == m_current_find_elm->document() &&
!ri->show_all_nodes) {
if (!m_current_find_elm->expose ())
m_current_find_elm = 0L;
m_current_find_attr = 0L;
}
}
}
KDE_NO_EXPORT bool PlayListView::acceptDrag (QDropEvent * de) const {
QListViewItem * item = itemAt (contentsToViewport (de->pos ()));
if (item && (de->source () == this || isDragValid (de))) {
RootPlayListItem * ritem = rootItem (item);
return ritem->flags & AllowDrops;
}
return false;
}
KDE_NO_EXPORT void PlayListView::itemDropped (QDropEvent * de, QListViewItem *after) {
if (!after) { // could still be a descendent
after = itemAt (contentsToViewport (de->pos ()));
if (after)
after = after->parent ();
}
if (after) {
RootPlayListItem * ritem = rootItem (after);
if (ritem->id > 0)
return;
NodePtr n = static_cast <PlayListItem *> (after)->node;
bool valid = n && (!n->isDocument () || n->hasChildNodes ());
KURL::List sl;
if (KURLDrag::canDecode (de)) {
KURLDrag::decode (de, sl);
} else if (QTextDrag::canDecode (de)) {
QString text;
QTextDrag::decode (de, text);
sl.push_back (KURL (text));
}
if (valid && sl.size () > 0) {
bool as_child = n->isDocument () || n->hasChildNodes ();
NodePtr d = n->document ();
for (int i = sl.size (); i > 0; i--) {
Node * ni = new KMPlayer::GenericURL (d, sl[i-1].url ());
if (as_child)
n->insertBefore (ni, n->firstChild ());
else
n->parentNode ()->insertBefore (ni, n->nextSibling ());
}
PlayListItem * citem = currentPlayListItem ();
NodePtr cn;
if (citem)
cn = citem->node;
updateTree (ritem, cn, true);
}
} else
m_view->dropEvent (de);
}
KDE_NO_EXPORT void PlayListView::itemIsRenamed (QListViewItem * qitem) {
PlayListItem * item = static_cast <PlayListItem *> (qitem);
if (item->node) {
RootPlayListItem * ri = rootItem (qitem);
if (!ri->show_all_nodes && item->node->isEditable ()) {
item->node->setNodeName (item->text (0));
if (item->node->mrl ()->pretty_name.isEmpty ())
item->setText (0, KURL (item->node->mrl ()->src).prettyURL (0, KURL::StripFileProtocol));
} else // restore damage ..
updateTree (ri, item->node, true);
} else if (item->m_attr) {
QString txt = item->text (0);
int pos = txt.find (QChar ('='));
if (pos > -1) {
item->m_attr->setName (txt.left (pos));
item->m_attr->setValue (txt.mid (pos + 1));
} else {
item->m_attr->setName (txt);
item->m_attr->setValue (QString (""));
}
PlayListItem * pi = static_cast <PlayListItem *> (item->parent ());
if (pi && pi->node)
pi->node->document ()->m_tree_version++;
}
}
KDE_NO_EXPORT void PlayListView::itemIsSelected (QListViewItem * qitem) {
RootPlayListItem * ri = rootItem (qitem);
setItemsRenameable (ri && (ri->flags & TreeEdit) && ri != qitem);
}
KDE_NO_EXPORT void PlayListView::rename (QListViewItem * qitem, int c) {
PlayListItem * item = static_cast <PlayListItem *> (qitem);
if (rootItem (qitem)->show_all_nodes && item && item->m_attr) {
PlayListItem * pi = static_cast <PlayListItem *> (qitem->parent ());
if (pi && pi->node && pi->node->isEditable ())
KListView::rename (item, c);
} else if (item && item->node && item->node->isEditable ()) {
if (!rootItem (qitem)->show_all_nodes &&
item->node->isPlayable () &&
item->node->mrl ()->pretty_name.isEmpty ())
// populate() has crippled src, restore for editing
item->setText (0, item->node->mrl ()->src);
KListView::rename (item, c);
}
}
KDE_NO_EXPORT void PlayListView::editCurrent () {
QListViewItem * qitem = selectedItem ();
if (qitem) {
RootPlayListItem * ri = rootItem (qitem);
if (ri && (ri->flags & TreeEdit) && ri != qitem)
rename (qitem, 0);
}
}
KDE_NO_EXPORT void PlayListView::slotFind () {
m_current_find_elm = 0L;
if (!m_find_dialog) {
m_find_dialog = new KFindDialog (false, this, "kde_kmplayer_find", KFindDialog::CaseSensitive);
m_find_dialog->setHasSelection (false);
connect(m_find_dialog, SIGNAL(okClicked ()), this, SLOT(slotFindOk ()));
} else
m_find_dialog->setPattern (QString ());
m_find_dialog->show ();
}
static QListViewItem * findNodeInTree (NodePtr n, QListViewItem * item) {
//kdDebug () << "item:" << item->text (0) << " n:" << (n ? n->nodeName () : "null" ) <<endl;
PlayListItem * pi = static_cast <PlayListItem *> (item);
if (!n || !pi->node)
return 0L;
if (n == pi->node)
return item;
for (QListViewItem * ci = item->firstChild(); ci; ci = ci->nextSibling ()) {
//kdDebug () << "ci:" << ci->text (0) << " n:" << n->nodeName () <<endl;
QListViewItem * vi = findNodeInTree (n, ci);
if (vi)
return vi;
}
return 0L;
}
KDE_NO_EXPORT void PlayListView::slotFindOk () {
if (!m_find_dialog)
return;
m_find_dialog->hide ();
long opt = m_find_dialog->options ();
current_find_tree_id = 0;
if (opt & KFindDialog::FromCursor && currentItem ()) {
PlayListItem * lvi = currentPlayListItem ();
if (lvi && lvi->node) {
m_current_find_elm = lvi->node;
current_find_tree_id = rootItem (lvi)->id;
} else if (lvi && lvi->m_attr) {
PlayListItem*pi=static_cast<PlayListItem*>(currentItem()->parent());
if (pi) {
m_current_find_attr = lvi->m_attr;
m_current_find_elm = pi->node;
}
}
} else if (!(opt & KFindDialog::FindIncremental))
m_current_find_elm = 0L;
if (!m_current_find_elm) {
PlayListItem * lvi = static_cast <PlayListItem *> (firstChild ());
if (lvi)
m_current_find_elm = lvi->node;
}
if (m_current_find_elm)
slotFindNext ();
}
/* A bit tricky, but between the find's PlayListItems might be gone, so
* try to match on the generated tree following the source's document tree
*/
KDE_NO_EXPORT void PlayListView::slotFindNext () {
if (!m_find_dialog)
return;
QString str = m_find_dialog->pattern();
if (!m_current_find_elm || str.isEmpty ())
return;
long opt = m_find_dialog->options ();
QRegExp regexp;
if (opt & KFindDialog::RegularExpression)
regexp = str;
bool cs = (opt & KFindDialog::CaseSensitive);
bool found = false;
NodePtr node, n = m_current_find_elm;
RootPlayListItem * ri = rootItem (current_find_tree_id);
while (!found && n) {
if (ri->show_all_nodes || n->expose ()) {
bool elm = n->isElementNode ();
QString val = n->nodeName ();
if (elm && !ri->show_all_nodes) {
Mrl * mrl = n->mrl ();
if (mrl) {
if (mrl->pretty_name.isEmpty ()) {
if (!mrl->src.isEmpty())
val = KURL(mrl->src).prettyURL();
} else
val = mrl->pretty_name;
}
} else if (!elm)
val = n->nodeValue ();
if (((opt & KFindDialog::RegularExpression) &&
val.find (regexp, 0) > -1) ||
(!(opt & KFindDialog::RegularExpression) &&
val.find (str, 0, cs) > -1)) {
node = n;
m_current_find_attr = 0L;
found = true;
} else if (elm && ri->show_all_nodes) {
for (AttributePtr a = convertNode <Element> (n)->attributes ()->first (); a; a = a->nextSibling ()) {
QString attr = a->name ().toString ();
if (((opt & KFindDialog::RegularExpression) &&
(attr.find (regexp, 0) || a->value ().find (regexp, 0) > -1)) ||
(!(opt & KFindDialog::RegularExpression) &&
(attr.find (str, 0, cs) > -1 || a->value ().find (str, 0, cs) > -1))) {
node = n;
m_current_find_attr = a;
found = true;
break;
}
}
}
}
if (n) { //set pointer to next
if (opt & KFindDialog::FindBackwards) {
if (n->lastChild ()) {
n = n->lastChild ();
} else if (n->previousSibling ()) {
n = n->previousSibling ();
} else {
for (n = n->parentNode (); n; n = n->parentNode ())
if (n->previousSibling ()) {
n = n->previousSibling ();
break;
}
while (!n && current_find_tree_id > 0) {
ri = rootItem (--current_find_tree_id);
if (ri)
n = ri->node;
}
}
} else {
if (n->firstChild ()) {
n = n->firstChild ();
} else if (n->nextSibling ()) {
n = n->nextSibling ();
} else {
for (n = n->parentNode (); n; n = n->parentNode ())
if (n->nextSibling ()) {
n = n->nextSibling ();
break;
}
while (!n) {
ri = rootItem (++current_find_tree_id);
if (!ri)
break;
n = ri->node;
}
}
}
}
}
m_current_find_elm = n;
kdDebug () << " search for " << str << "=" << (node ? node->nodeName () : "not found") << " next:" << (n ? n->nodeName () : " not found") << endl;
if (found) {
QListViewItem * fc = findNodeInTree (node, ri);
if (!fc) {
m_current_find_elm = 0L;
kdDebug () << "node not found in tree tree:" << ri->id << endl;
} else {
setSelected (fc, true);
if (m_current_find_attr && fc->firstChild () && fc->firstChild ()->firstChild ())
ensureItemVisible (fc->firstChild ()->firstChild ());
ensureItemVisible (fc);
}
}
m_find_next->setEnabled (!!m_current_find_elm);
}
#include "playlistview.moc"

@ -0,0 +1,174 @@
/**
* Copyright (C) 2006 by Koos Vriezen <koos.vriezen@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
**/
#ifndef PLAYLISTVIEW_H
#define PLAYLISTVIEW_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <klistview.h>
#include "kmplayerplaylist.h"
class QFont;
class QPixmap;
class QPainter;
class QPopupMenu;
class QDropEvent;
namespace KMPlayer {
class View;
class PlayListView;
bool isDragValid (QDropEvent * de) KMPLAYER_NO_MBR_EXPORT;
/*
* An item in the playlist
*/
class KMPLAYER_NO_EXPORT PlayListItem : public QListViewItem {
public:
PlayListItem (QListViewItem *p, const NodePtr & e, PlayListView * lv);
PlayListItem (QListViewItem *p, const AttributePtr & e, PlayListView * lv);
PlayListItem (PlayListView *v, const NodePtr & d, QListViewItem * b);
KDE_NO_CDTOR_EXPORT ~PlayListItem () {}
void paintCell (QPainter * p, const QColorGroup & cg, int column, int width, int align);
void paintBranches(QPainter *p, const QColorGroup &cg, int w, int y, int h);
PlayListView * playListView () const;
NodePtrW node;
AttributePtrW m_attr;
PlayListView * listview;
protected:
PlayListItem (PlayListView *v, const NodePtr & e);
};
class KMPLAYER_NO_EXPORT RootPlayListItem : public PlayListItem {
public:
RootPlayListItem (int id, PlayListView *v, const NodePtr & d, QListViewItem * b, int flags);
KDE_NO_CDTOR_EXPORT ~RootPlayListItem () {}
void paintCell (QPainter * p, const QColorGroup & cg, int column, int width, int align);
QString source;
QString icon;
int id;
int flags;
bool show_all_nodes;
bool have_dark_nodes;
};
/*
* The playlist GUI
*/
class KMPLAYER_EXPORT PlayListView : public KListView {
Q_OBJECT
public:
enum Flags {
AllowDrops = 0x01, AllowDrag = 0x02,
InPlaceEdit = 0x04, TreeEdit = 0x08,
Moveable = 0x10, Deleteable = 0x20
};
PlayListView (QWidget * parent, View * view, KActionCollection * ac);
~PlayListView ();
void selectItem (const QString & txt);
void showAllNodes (RootPlayListItem *, bool show=true);
void setActiveForegroundColor (const QColor & c) { m_active_color = c; }
const QColor & activeColor () const { return m_active_color; }
int addTree (NodePtr r, const QString & src, const QString & ico, int flgs);
RootPlayListItem * rootItem (QListViewItem * item) const;
RootPlayListItem * rootItem (int id) const;
void setFont (const QFont &);
PlayListItem * currentPlayListItem () const;
PlayListItem * selectedPlayListItem () const;
NodePtr lastDragNode () const { return m_last_drag; }
int lastDragTreeId () const { return last_drag_tree_id; }
signals:
void addBookMark (const QString & title, const QString & url);
void prepareMenu (KMPlayer::PlayListItem * item, QPopupMenu * menu);
protected:
bool acceptDrag (QDropEvent* event) const;
QDragObject * dragObject ();
public slots:
void editCurrent ();
void rename (QListViewItem * item, int c);
void updateTree (int id, NodePtr root, NodePtr active, bool sel, bool open);
private slots:
void contextMenuItem (QListViewItem *, const QPoint &, int);
void itemExpanded (QListViewItem *);
void copyToClipboard ();
void addBookMark ();
void toggleShowAllNodes ();
void itemDropped (QDropEvent * e, QListViewItem * after);
void itemIsRenamed (QListViewItem * item);
void itemIsSelected (QListViewItem * item);
void updateTrees ();
void slotFind ();
void slotFindOk ();
void slotFindNext ();
private:
void updateTree (RootPlayListItem * ritem, NodePtr active, bool select);
PlayListItem * populate (NodePtr e, NodePtr focus, RootPlayListItem *root, PlayListItem * item, PlayListItem ** curitem);
struct KMPLAYER_NO_EXPORT TreeUpdate {
KDE_NO_CDTOR_EXPORT TreeUpdate (RootPlayListItem *ri, NodePtr n, bool s, bool o, SharedPtr <TreeUpdate> &nx) : root_item (ri), node (n), select (s), open (o), next (nx) {}
KDE_NO_CDTOR_EXPORT ~TreeUpdate () {}
RootPlayListItem * root_item;
NodePtrW node;
bool select;
bool open;
SharedPtr <TreeUpdate> next;
};
SharedPtr <TreeUpdate> tree_update;
View * m_view;
QPopupMenu * m_itemmenu;
KAction * m_find;
KAction * m_find_next;
KFindDialog * m_find_dialog;
QPixmap folder_pix;
QPixmap auxiliary_pix;
QPixmap video_pix;
QPixmap unknown_pix;
QPixmap menu_pix;
QPixmap config_pix;
QPixmap url_pix;
QPixmap info_pix;
QPixmap img_pix;
QColor m_active_color;
NodePtrW m_current_find_elm;
NodePtrW m_last_drag;
AttributePtrW m_current_find_attr;
int last_id;
int last_drag_tree_id;
int current_find_tree_id;
bool m_ignore_expanded;
};
KDE_NO_EXPORT inline PlayListView * PlayListItem::playListView () const {
return static_cast <PlayListView *> (listView ());
}
KDE_NO_EXPORT inline PlayListItem * PlayListView::currentPlayListItem () const {
return static_cast <PlayListItem *> (currentItem ());
}
KDE_NO_EXPORT inline PlayListItem * PlayListView::selectedPlayListItem() const {
return static_cast <PlayListItem *> (selectedItem ());
}
} // namespace
#endif // PLAYLISTVIEW_H

@ -0,0 +1,31 @@
number=5
[0]
description=RealPlayer LiveConnect-Enabled Plug-In G2
file=libkmplayerpart.so
mime=audio/x-pn-realaudio:rm:Real Audio Stream;audio/x-pn-realaudio-plugin:rpm,rm,ram:RealPlayer Plug-in
name=RealPlayer
[1]
description=Windows Media Player Plug-in
file=libkmplayerpart.so
mime=application/x-mplayer2:wmp:Windows Media Player;audio/x-ms-wma:wma:Windows Media Audio;video/x-ms-asf:asx,asf:Media Files;video/x-ms-asf-plugin:*:Media Files;video/x-ms-wmv:wmv:Windows Media Video;video/msvideo:avi,*:AVI;video/x-ms-wmp:wmp,*:Windows Media;video/x-ms-wvx:wvx,*:Windows Media;audio/x-ms-wax:wax,*:Windows Media;application/x-drm-v2:asx,*:Windows Media;audio/wav:wav,*:Microsoft wave file;audio/x-wav:wav,*:Microsoft wave file;video/x-ms-wm:wm,*:Media Files
name=Windows Media Player Plugin
[2]
description=QuickTime Movie
file=libkmplayerpart.so
mime=video/quicktime:mov,qt:QuickTime
name=QuickTime Plug-in
[3]
description=Shockwave Flash 9.0 r64
file=libkmplayerpart.so
mime=application/x-shockwave-flash:swf:Shockwave Flash
name=Shockwave Flash
[4]
description=FutureSplash Player 9.0 r64
file=libkmplayerpart.so
mime=application/futuresplash:spl:FutureSplash Player
name=FutureSplash Player

@ -0,0 +1,866 @@
/**
* Copyright (C) 2003 Joonas Koivunen <rzei@mbnet.fi>
* Copyright (C) 2003 Koos Vriezen <koos.vriezen@xs4all.nl>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#undef Always
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <qlayout.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qcheckbox.h>
#include <qstringlist.h>
#include <qcombobox.h>
#include <qlineedit.h>
#include <qgroupbox.h>
#include <qwhatsthis.h>
#include <qtabwidget.h>
#include <qslider.h>
#include <qbuttongroup.h>
#include <qspinbox.h>
#include <qmessagebox.h>
#include <qmap.h>
#include <qtimer.h>
#include <qfont.h>
#include <klocale.h>
#include <kdebug.h>
#include <kfiledialog.h>
#include <kmessagebox.h>
#include <klineedit.h>
#include <kiconloader.h>
#include <kdeversion.h>
#include <kcombobox.h>
#include <kcolorbutton.h>
#include <kurlrequester.h>
#include <kfontdialog.h>
#include "pref.h"
#include "kmplayerpartbase.h"
#include "kmplayerprocess.h"
#include "kmplayerconfig.h"
using namespace KMPlayer;
KDE_NO_CDTOR_EXPORT Preferences::Preferences(PartBase * player, Settings * settings)
: KDialogBase (IconList, i18n ("Preferences"),
Help|Default|Ok|Apply|Cancel, Ok, player->view (), 0, false)
{
QFrame *frame;
QTabWidget * tab;
QStringList hierarchy; // typo? :)
QVBoxLayout *vlay;
frame = addPage(i18n("General Options"), QString(), KGlobal::iconLoader()->loadIcon (QString ("kmplayer"), KIcon::NoGroup, 32));
vlay = new QVBoxLayout(frame, marginHint(), spacingHint());
tab = new QTabWidget (frame);
vlay->addWidget (tab);
m_GeneralPageGeneral = new PrefGeneralPageGeneral (tab, settings);
tab->insertTab (m_GeneralPageGeneral, i18n("General"));
m_GeneralPageLooks = new PrefGeneralPageLooks (tab, settings);
tab->insertTab (m_GeneralPageLooks, i18n("Looks"));
m_GeneralPageOutput = new PrefGeneralPageOutput
(tab, settings->audiodrivers, settings->videodrivers);
tab->insertTab (m_GeneralPageOutput, i18n("Output"));
entries.insert (i18n("General Options"), tab);
frame = addPage (i18n ("Source"), QString(), KGlobal::iconLoader()->loadIcon (QString ("source"), KIcon::NoGroup, 32));
vlay = new QVBoxLayout (frame, marginHint(), spacingHint());
tab = new QTabWidget (frame);
vlay->addWidget (tab);
m_SourcePageURL = new PrefSourcePageURL (tab);
tab->insertTab (m_SourcePageURL, i18n ("URL"));
entries.insert (i18n("Source"), tab);
frame = addPage (i18n ("Recording"), QString(), KGlobal::iconLoader()->loadIcon (QString ("video"), KIcon::NoGroup, 32));
vlay = new QVBoxLayout (frame, marginHint(), spacingHint());
tab = new QTabWidget (frame);
vlay->addWidget (tab);
int recorders_count = 3;
m_MEncoderPage = new PrefMEncoderPage (tab, player);
tab->insertTab (m_MEncoderPage, i18n ("MEncoder"));
recorders = m_MEncoderPage;
m_FFMpegPage = new PrefFFMpegPage (tab, player);
tab->insertTab (m_FFMpegPage, i18n ("FFMpeg"));
m_MEncoderPage->next = m_FFMpegPage;
m_MPlayerDumpstreamPage = new PrefMPlayerDumpstreamPage (tab, player);
// tab->insertTab (m_MPlayerDumpstreamPage, i18n ("MPlayer -dumpstream"));
m_FFMpegPage->next = m_MPlayerDumpstreamPage;
#ifdef HAVE_XINE
recorders_count = 4;
m_XinePage = new PrefXinePage (tab, player);
// tab->insertTab (m_XinePage, i18n ("Xine"));
m_MPlayerDumpstreamPage->next = m_XinePage;
#endif
m_RecordPage = new PrefRecordPage (tab, player, recorders, recorders_count);
tab->insertTab (m_RecordPage, i18n ("General"), 0);
tab->setCurrentPage (0);
entries.insert (i18n("Recording"), tab);
frame = addPage (i18n ("Output Plugins"), QString(), KGlobal::iconLoader()->loadIcon (QString ("image"), KIcon::NoGroup, 32));
vlay = new QVBoxLayout(frame, marginHint(), spacingHint());
tab = new QTabWidget (frame);
vlay->addWidget (tab);
m_OPPagePostproc = new PrefOPPagePostProc (tab);
tab->insertTab (m_OPPagePostproc, i18n ("Postprocessing"));
entries.insert (i18n("Postprocessing"), tab);
for (PreferencesPage * p = settings->pagelist; p; p = p->next)
addPrefPage (p);
connect (this, SIGNAL (defaultClicked ()), SLOT (confirmDefaults ()));
}
KDE_NO_EXPORT void Preferences::setPage (const char * name) {
QObject * o = child (name, "QFrame");
if (!o) return;
QFrame * page = static_cast <QFrame *> (o);
QWidget * w = page->parentWidget ();
while (w && !w->inherits ("QTabWidget"))
w = w->parentWidget ();
if (!w) return;
QTabWidget * t = static_cast <QTabWidget*> (w);
t->setCurrentPage (t->indexOf(page));
if (!t->parentWidget() || !t->parentWidget()->inherits ("QFrame"))
return;
showPage (pageIndex (t->parentWidget ()));
}
KDE_NO_EXPORT void Preferences::addPrefPage (PreferencesPage * page) {
QString item, subitem, icon;
QFrame * frame;
QTabWidget * tab;
QVBoxLayout *vlay;
page->prefLocation (item, icon, subitem);
if (item.isEmpty ())
return;
QMap<QString, QTabWidget *>::iterator en_it = entries.find (item);
if (en_it == entries.end ()) {
frame = addPage (item, QString(), KGlobal::iconLoader()->loadIcon ((icon), KIcon::NoGroup, 32));
vlay = new QVBoxLayout (frame, marginHint(), spacingHint());
tab = new QTabWidget (frame);
vlay->addWidget (tab);
entries.insert (item, tab);
} else
tab = en_it.data ();
frame = page->prefPage (tab);
tab->insertTab (frame, subitem);
}
KDE_NO_EXPORT void Preferences::removePrefPage(PreferencesPage * page) {
QString item, subitem, icon;
page->prefLocation (item, icon, subitem);
if (item.isEmpty ())
return;
QMap<QString, QTabWidget *>::iterator en_it = entries.find (item);
if (en_it == entries.end ())
return;
QTabWidget * tab = en_it.data ();
for (int i = 0; i < tab->count (); i++)
if (tab->label (i) == subitem) {
QWidget * w = tab->page (i);
tab->removePage (w);
delete w;
break;
}
if (!tab->count ()) {
QWidget * w = tab->parentWidget ();
while (w && !w->inherits ("QFrame"))
w = w->parentWidget ();
delete w;
entries.erase (en_it);
}
}
KDE_NO_CDTOR_EXPORT Preferences::~Preferences() {
}
KDE_NO_CDTOR_EXPORT PrefGeneralPageGeneral::PrefGeneralPageGeneral(QWidget *parent, Settings *)
: QFrame (parent, "GeneralPage")
{
QVBoxLayout *layout = new QVBoxLayout(this, 5, 2);
QGroupBox *windowbox = new QGroupBox(1, Qt::Vertical, i18n("Window"), this);
QWidget * wbox = new QWidget (windowbox);
QWidget * bbox = new QWidget (wbox);
QGridLayout * gridlayout = new QGridLayout (bbox, 2, 2);
keepSizeRatio = new QCheckBox (i18n ("Keep size ratio"), bbox, 0);
QWhatsThis::add(keepSizeRatio, i18n("When checked, movie will keep its aspect ratio\nwhen window is resized"));
dockSysTray = new QCheckBox (i18n ("Dock in system tray"), bbox, 0);
QWhatsThis::add (dockSysTray, i18n ("When checked, an icon of KMPlayer will be added to the system tray.\nWhen clicked it will hide KMPlayer's main window and removing KMPlayer's taskbar button."));
autoResize = new QCheckBox (i18n ("Auto resize to video sizes"), bbox);
QWhatsThis::add (autoResize, i18n("When checked, KMPlayer will resize to movie sizes\nwhen video starts"));
gridlayout->addWidget (keepSizeRatio, 0, 0);
gridlayout->addWidget (dockSysTray, 1, 0);
gridlayout->addWidget (autoResize, 0, 1);
sizesChoice = new QButtonGroup (2, Qt::Vertical, wbox);
new QRadioButton (i18n("Remember window size on exit"), sizesChoice);
new QRadioButton (i18n("Always start with fixed size"), sizesChoice);
QVBoxLayout * vbox = new QVBoxLayout (wbox, 2, 2);
vbox->addWidget (bbox);
vbox->addWidget (sizesChoice);
QGroupBox *playbox =new QGroupBox(4, Qt::Vertical,i18n("Playing"),this);
loop = new QCheckBox (i18n("Loop"), playbox);
QWhatsThis::add(loop, i18n("Makes current movie loop"));
framedrop = new QCheckBox (i18n ("Allow framedrops"), playbox);
QWhatsThis::add (framedrop, i18n ("Allow dropping frames for better audio and video synchronization"));
adjustvolume = new QCheckBox(i18n("Auto set volume on start"), playbox);
QWhatsThis::add (adjustvolume, i18n ("When a new source is selected, the volume will be set according the volume control"));
adjustcolors = new QCheckBox(i18n("Auto set colors on start"), playbox);
QWhatsThis::add (adjustcolors, i18n ("When a movie starts, the colors will be set according the sliders for colors"));
QGroupBox * gbox =new QGroupBox (1, Qt::Vertical, i18n("Control Panel"), this);
bbox =new QWidget (gbox);
//QGroupBox * bbox = gbox;
gridlayout = new QGridLayout (bbox, 3, 2);
showConfigButton = new QCheckBox(i18n("Show config button"), bbox);
QWhatsThis::add (showConfigButton, i18n ("Add a button that will popup a config menu"));
showPlaylistButton = new QCheckBox(i18n("Show playlist button"), bbox);
QWhatsThis::add (showPlaylistButton, i18n ("Add a playlist button to the control buttons"));
showRecordButton = new QCheckBox(i18n("Show record button"), bbox);
QWhatsThis::add (showRecordButton, i18n ("Add a record button to the control buttons"));
showBroadcastButton = new QCheckBox (i18n ("Show broadcast button"), bbox);
QWhatsThis::add (showBroadcastButton, i18n ("Add a broadcast button to the control buttons"));
gridlayout->addWidget (showConfigButton, 0, 0);
gridlayout->addWidget (showPlaylistButton, 0, 1);
gridlayout->addWidget (showRecordButton, 1, 0);
gridlayout->addWidget (showBroadcastButton, 1, 1);
//QWidget *seekingWidget = new QWidget (bbox);
QHBoxLayout *seekLayout = new QHBoxLayout (bbox);
seekLayout->addWidget(new QLabel(i18n("Forward/backward seek time:"),bbox));
seekLayout->addItem(new QSpacerItem(0,0,QSizePolicy::Minimum, QSizePolicy::Minimum));
seekTime = new QSpinBox(1, 600, 1, bbox);
seekLayout->addWidget(seekTime);
seekLayout->addItem(new QSpacerItem(0,0,QSizePolicy::Minimum, QSizePolicy::Minimum));
gridlayout->addMultiCellLayout (seekLayout, 2, 2, 0, 1);
layout->addWidget (windowbox);
layout->addWidget (playbox);
layout->addWidget (gbox);
//layout->addWidget(autoHideSlider);
layout->addItem (new QSpacerItem (0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
}
KDE_NO_CDTOR_EXPORT PrefGeneralPageLooks::PrefGeneralPageLooks (QWidget *parent, Settings * settings)
: QFrame (parent, "LooksPage"),
colors (settings->colors),
fonts (settings->fonts) {
QVBoxLayout *layout = new QVBoxLayout(this, 5, 2);
QGroupBox *colorbox= new QGroupBox(2, Qt::Horizontal, i18n("Colors"), this);
colorscombo = new QComboBox (colorbox);
for (int i = 0; i < int (ColorSetting::last_target); i++)
colorscombo->insertItem (colors[i].title);
colorscombo->setCurrentItem (0);
connect (colorscombo, SIGNAL (activated (int)),
this, SLOT (colorItemChanged(int)));
colorbutton = new KColorButton (colorbox);
colorbutton->setColor (colors[0].color);
connect (colorbutton, SIGNAL (changed (const QColor &)),
this, SLOT (colorCanged (const QColor &)));
QGroupBox *fontbox = new QGroupBox (2,Qt::Horizontal, i18n ("Fonts"), this);
fontscombo = new QComboBox (fontbox);
for (int i = 0; i < int (FontSetting::last_target); i++)
fontscombo->insertItem (fonts[i].title);
fontscombo->setCurrentItem (0);
connect (fontscombo, SIGNAL (activated (int)),
this, SLOT (fontItemChanged(int)));
fontbutton = new QPushButton (i18n ("AaBbCc"), fontbox);
fontbutton->setFlat (true);
fontbutton->setFont (fonts[0].font);
connect (fontbutton, SIGNAL (clicked ()), this, SLOT (fontClicked ()));
layout->addWidget (colorbox);
layout->addWidget (fontbox);
layout->addItem (new QSpacerItem (0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
}
KDE_NO_EXPORT void PrefGeneralPageLooks::colorItemChanged (int c) {
if (c < int (ColorSetting::last_target))
colorbutton->setColor (colors[c].newcolor);
}
KDE_NO_EXPORT void PrefGeneralPageLooks::colorCanged (const QColor & c) {
if (colorscombo->currentItem () < int (ColorSetting::last_target))
colors[colorscombo->currentItem ()].newcolor = c;
}
KDE_NO_EXPORT void PrefGeneralPageLooks::fontItemChanged (int f) {
if (f < int (FontSetting::last_target))
fontbutton->setFont (fonts[f].newfont);
}
KDE_NO_EXPORT void PrefGeneralPageLooks::fontClicked () {
if (fontscombo->currentItem () < int (FontSetting::last_target)) {
QFont myfont = fonts [fontscombo->currentItem ()].newfont;
int res = KFontDialog::getFont (myfont, false, this);
if (res == KFontDialog::Accepted) {
fonts [fontscombo->currentItem ()].newfont = myfont;
fontbutton->setFont (myfont);
}
}
}
KDE_NO_CDTOR_EXPORT PrefSourcePageURL::PrefSourcePageURL (QWidget *parent)
: QFrame (parent, "URLPage")
{
QVBoxLayout *layout = new QVBoxLayout (this, 5, 5);
QHBoxLayout * urllayout = new QHBoxLayout ();
QHBoxLayout * sub_urllayout = new QHBoxLayout ();
QLabel *urlLabel = new QLabel (i18n ("Location:"), this, 0);
urllist = new KComboBox (true, this);
urllist->setMaxCount (20);
urllist->setDuplicatesEnabled (false); // not that it helps much :(
url = new KURLRequester (urllist, this);
QWhatsThis::add (url, i18n ("Location of the playable item"));
//url->setShowLocalProtocol (true);
url->setSizePolicy (QSizePolicy (QSizePolicy::Expanding, QSizePolicy::Preferred));
QLabel *sub_urlLabel = new QLabel (i18n ("Sub title:"), this, 0);
sub_urllist = new KComboBox (true, this);
sub_urllist->setMaxCount (20);
sub_urllist->setDuplicatesEnabled (false); // not that it helps much :(
sub_url = new KURLRequester (sub_urllist, this);
QWhatsThis::add (sub_url, i18n ("Optional location of a file containing the subtitles of the URL above"));
sub_url->setSizePolicy (QSizePolicy (QSizePolicy::Expanding, QSizePolicy::Preferred));
backend = new QListBox (this);
allowhref = new QCheckBox (i18n ("Enable 'Click to Play' support"), this);
QWhatsThis::add (allowhref, i18n ("Support for WEB pages having a start image"));
layout->addWidget (allowhref);
urllayout->addWidget (urlLabel);
urllayout->addWidget (url);
layout->addLayout (urllayout);
sub_urllayout->addWidget (sub_urlLabel);
sub_urllayout->addWidget (sub_url);
layout->addLayout (sub_urllayout);
layout->addItem (new QSpacerItem (0, 10, QSizePolicy::Minimum, QSizePolicy::Minimum));
QGridLayout * gridlayout = new QGridLayout (2, 2);
QLabel *backendLabel = new QLabel (i18n ("Use movie player:"), this, 0);
//QWhatsThis::add (allowhref, i18n ("Explain this in a few lines"));
gridlayout->addWidget (backendLabel, 0, 0);
gridlayout->addWidget (backend, 1, 0);
gridlayout->addMultiCell (new QSpacerItem (0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1, 1, 1);
QGroupBox *cbox = new QGroupBox(1, Qt::Vertical, i18n("Network bandwidth"), this);
QWidget * wbox = new QWidget (cbox);
QGridLayout * bitratelayout = new QGridLayout (wbox, 2, 3, 5);
prefBitRate = new QLineEdit (wbox);
QWhatsThis::add (prefBitRate, i18n("Sometimes it is possible to choose between various streams given a particular bitrate.\nThis option sets how much bandwidth you would prefer to allocate to video."));
maxBitRate = new QLineEdit (wbox);
QWhatsThis::add (maxBitRate, i18n("Sometimes it is possible to choose between various streams given a particular bitrate.\nThis option sets the maximum bandwidth you have available for video."));
bitratelayout->addWidget(new QLabel(i18n("Preferred bitrate:"), wbox), 0, 0);
bitratelayout->addWidget (prefBitRate, 0, 1);
bitratelayout->addWidget (new QLabel (i18n ("kbit/s"), wbox), 0, 2);
bitratelayout->addWidget (new QLabel(i18n("Maximum bitrate:"), wbox), 1, 0);
bitratelayout->addWidget (maxBitRate, 1, 1);
bitratelayout->addWidget (new QLabel (i18n ("kbit/s"), wbox), 1, 2);
layout->addLayout (gridlayout);
layout->addWidget (cbox);
layout->addItem (new QSpacerItem (0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
connect (urllist, SIGNAL(textChanged (const QString &)),
this, SLOT (slotTextChanged (const QString &)));
connect (sub_urllist, SIGNAL(textChanged (const QString &)),
this, SLOT (slotTextChanged (const QString &)));
}
KDE_NO_EXPORT void PrefSourcePageURL::slotBrowse () {
}
KDE_NO_EXPORT void PrefSourcePageURL::slotTextChanged (const QString &) {
changed = true;
}
KDE_NO_CDTOR_EXPORT PrefRecordPage::PrefRecordPage (QWidget *parent, PartBase * player, RecorderPage * rl, int rec_len) : QFrame (parent, "RecordPage"), m_player (player), m_recorders (rl), m_recorders_length (rec_len) {
QVBoxLayout *layout = new QVBoxLayout (this, 5, 5);
QHBoxLayout * urllayout = new QHBoxLayout ();
QLabel *urlLabel = new QLabel (i18n ("Output file:"), this);
url = new KURLRequester ("", this);
url->setShowLocalProtocol (true);
urllayout->addWidget (urlLabel);
urllayout->addWidget (url);
recordButton = new QPushButton (i18n ("Start &Recording"), this);
connect (recordButton, SIGNAL (clicked ()), this, SLOT (slotRecord ()));
QHBoxLayout *buttonlayout = new QHBoxLayout;
buttonlayout->addItem (new QSpacerItem (0, 0, QSizePolicy::Minimum, QSizePolicy::Minimum));
buttonlayout->addWidget (recordButton);
source = new QLabel (i18n ("Current source: ") + m_player->source ()->prettyName (), this);
recorder = new QButtonGroup (m_recorders_length, Qt::Vertical, i18n ("Recorder"), this);
for (RecorderPage * p = m_recorders; p; p = p->next)
new QRadioButton (p->name (), recorder);
if (m_player->source ())
sourceChanged (0L, m_player->source ());
recorder->setButton(0); // for now
replay = new QButtonGroup (4, Qt::Vertical, i18n ("Auto Playback"), this);
new QRadioButton (i18n ("&No"), replay);
new QRadioButton (i18n ("&When recording finished"), replay);
new QRadioButton (i18n ("A&fter"), replay);
QWidget * customreplay = new QWidget (replay);
replaytime = new QLineEdit (customreplay);
QHBoxLayout *replaylayout = new QHBoxLayout (customreplay);
replaylayout->addWidget (new QLabel (i18n("Time (seconds):"), customreplay));
replaylayout->addWidget (replaytime);
replaylayout->addItem (new QSpacerItem (0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum));
layout->addWidget (source);
layout->addItem (new QSpacerItem (5, 0, QSizePolicy::Minimum, QSizePolicy::Minimum));
layout->addLayout (urllayout);
layout->addItem (new QSpacerItem (5, 0, QSizePolicy::Minimum, QSizePolicy::Minimum));
layout->addWidget (recorder);
layout->addItem (new QSpacerItem (5, 0, QSizePolicy::Minimum, QSizePolicy::Minimum));
layout->addWidget (replay);
layout->addItem (new QSpacerItem (5, 0, QSizePolicy::Minimum, QSizePolicy::Minimum));
layout->addLayout (buttonlayout);
layout->addItem (new QSpacerItem (5, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
connect (m_player, SIGNAL (sourceChanged(KMPlayer::Source*,KMPlayer::Source*)), this, SLOT (sourceChanged(KMPlayer::Source*,KMPlayer::Source*)));
#ifdef HAVE_XINE
connect (recorder, SIGNAL (clicked(int)), this, SLOT(recorderClicked(int)));
#endif
connect (replay, SIGNAL (clicked (int)), this, SLOT (replayClicked (int)));
}
KDE_NO_EXPORT void PrefRecordPage::recordingStarted () {
recordButton->setText (i18n ("Stop Recording"));
url->setEnabled (false);
topLevelWidget ()->hide ();
}
KDE_NO_EXPORT void PrefRecordPage::recordingFinished () {
recordButton->setText (i18n ("Start Recording"));
url->setEnabled (true);
QTimer::singleShot (0, m_player, SLOT(recordingStopped())); // removed from PartBase::setSource because PartBase::recordingStopped calls openURL and that will call PartBase::setSource and Qt doesn't like disconnecting/connecting a signal that is current
}
KDE_NO_EXPORT void PrefRecordPage::sourceChanged (Source * olds, Source * nws) {
int id = 0;
int nr_recs = 0;
if (olds) {
disconnect(nws,SIGNAL(startRecording()),this, SLOT(recordingStarted()));
disconnect(nws,SIGNAL(stopRecording()),this, SLOT(recordingFinished()));
}
if (nws) {
for (RecorderPage * p = m_recorders; p; p = p->next, ++id) {
QButton * radio = recorder->find (id);
bool b = m_player->recorders () [p->recorderName ()]->supports (nws->name ());
radio->setEnabled (b);
if (b) nr_recs++;
}
source->setText (i18n ("Current Source: ") + nws->prettyName ());
connect (nws, SIGNAL(startRecording()), this, SLOT(recordingStarted()));
connect (nws, SIGNAL(stopRecording()), this, SLOT(recordingFinished()));
}
recordButton->setEnabled (nr_recs > 0);
}
KDE_NO_EXPORT void PrefRecordPage::recorderClicked (int id) {
bool b = recorder->find(id)->text().find (QString::fromLatin1("Xine")) > -1;
replay->setEnabled (!b);
if (b)
replay->setButton (Settings::ReplayNo);
}
KDE_NO_EXPORT void PrefRecordPage::replayClicked (int id) {
replaytime->setEnabled (id == Settings::ReplayAfter);
}
KDE_NO_EXPORT void PrefRecordPage::slotRecord () {
connect (m_player->source (), SIGNAL (stopPlaying ()),
this, SLOT (playingStopped ()));
if (m_player->process () && m_player->process ()->playing ())
m_player->process ()->quit ();
else
playingStopped ();
}
KDE_NO_EXPORT void PrefRecordPage::playingStopped () {
disconnect (m_player->source (), SIGNAL (stopPlaying ()),
this, SLOT (playingStopped ()));
if (!url->lineEdit()->text().isEmpty()) {
m_player->settings ()->recordfile = url->lineEdit()->text();
m_player->settings ()->replaytime = replaytime->text ().toInt ();
#if KDE_IS_VERSION(3,1,90)
int id = recorder->selectedId ();
int replayid = replay->selectedId ();
#else
int id = recorder->id (recorder->selected ());
int replayid = replay->id (replay->selectedId ());
#endif
m_player->settings ()->recorder = Settings::Recorder (id);
m_player->settings ()->replayoption = Settings::ReplayOption (replayid);
for (RecorderPage * p = m_recorders; p; p = p->next)
if (id-- == 0) {
p->record ();
break;
}
}
}
KDE_NO_CDTOR_EXPORT RecorderPage::RecorderPage (QWidget *parent, PartBase * player)
: QFrame (parent), next (0L), m_player (player) {}
KDE_NO_EXPORT void RecorderPage::record () {
Process * proc = m_player->recorders () [recorderName ()];
m_player->setRecorder (recorderName ());
Recorder * rec = dynamic_cast <Recorder *> (proc);
if (!proc->playing ()) {
if (m_player->process ())
m_player->process ()->quit ();
rec->setURL (KURL (m_player->settings ()->recordfile));
proc->setSource (m_player->source ());
proc->ready (0L);
} else {
rec->setURL (KURL ());
proc->stop ();
}
}
KDE_NO_CDTOR_EXPORT PrefMEncoderPage::PrefMEncoderPage (QWidget *parent, PartBase * player) : RecorderPage (parent, player) {
QVBoxLayout *layout = new QVBoxLayout (this, 5, 5);
format = new QButtonGroup (3, Qt::Vertical, i18n ("Format"), this);
new QRadioButton (i18n ("Same as source"), format);
new QRadioButton (i18n ("Custom"), format);
QWidget * customopts = new QWidget (format);
QGridLayout *gridlayout = new QGridLayout (customopts, 1, 2, 2);
QLabel *argLabel = new QLabel (i18n("Mencoder arguments:"), customopts, 0);
arguments = new QLineEdit ("", customopts);
gridlayout->addWidget (argLabel, 0, 0);
gridlayout->addWidget (arguments, 0, 1);
layout->addWidget (format);
layout->addItem (new QSpacerItem (0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
connect (format, SIGNAL (clicked (int)), this, SLOT (formatClicked (int)));
}
KDE_NO_EXPORT void PrefMEncoderPage::formatClicked (int id) {
arguments->setEnabled (!!id);
}
KDE_NO_EXPORT void PrefMEncoderPage::record () {
#if KDE_IS_VERSION(3,1,90)
m_player->settings ()->recordcopy = !format->selectedId ();
#else
m_player->settings ()->recordcopy = !format->id (format->selected ());
#endif
m_player->settings ()->mencoderarguments = arguments->text ();
RecorderPage::record ();
}
KDE_NO_EXPORT QString PrefMEncoderPage::name () {
return i18n ("&MEncoder");
}
KDE_NO_CDTOR_EXPORT PrefMPlayerDumpstreamPage::PrefMPlayerDumpstreamPage (QWidget *parent, PartBase * player) : RecorderPage (parent, player) {
hide();
}
KDE_NO_EXPORT QString PrefMPlayerDumpstreamPage::name () {
return i18n ("MPlayer -&dumpstream");
}
KDE_NO_CDTOR_EXPORT PrefFFMpegPage::PrefFFMpegPage (QWidget *parent, PartBase * player) : RecorderPage (parent, player) {
QVBoxLayout *layout = new QVBoxLayout (this, 5, 5);
QGridLayout *gridlayout = new QGridLayout (1, 2, 2);
QLabel *argLabel = new QLabel (i18n("FFMpeg arguments:"), this);
arguments = new QLineEdit ("", this);
gridlayout->addWidget (argLabel, 0, 0);
gridlayout->addWidget (arguments, 0, 1);
layout->addLayout (gridlayout);
layout->addItem (new QSpacerItem (0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
}
KDE_NO_EXPORT void PrefFFMpegPage::record () {
m_player->settings ()->ffmpegarguments = arguments->text ();
RecorderPage::record ();
}
KDE_NO_EXPORT QString PrefFFMpegPage::name () {
return i18n ("&FFMpeg");
}
#ifdef HAVE_XINE
KDE_NO_CDTOR_EXPORT PrefXinePage::PrefXinePage (QWidget *parent, PartBase * player) : RecorderPage (parent, player) {
hide();
}
KDE_NO_EXPORT QString PrefXinePage::name () {
return i18n ("&Xine");
}
#endif
KDE_NO_CDTOR_EXPORT PrefGeneralPageOutput::PrefGeneralPageOutput(QWidget *parent, OutputDriver * ad, OutputDriver * vd)
: QFrame (parent) {
QGridLayout *layout = new QGridLayout (this, 2, 2, 5);
videoDriver = new QListBox (this);
for (int i = 0; vd[i].driver; i++)
videoDriver->insertItem (vd[i].description, i);
QWhatsThis::add(videoDriver, i18n("Sets video driver. Recommended is XVideo, or, if it is not supported, X11, which is slower."));
layout->addWidget (new QLabel (i18n ("Video driver:"), this), 0, 0);
layout->addWidget (videoDriver, 1, 0);
audioDriver = new QListBox (this);
for (int i = 0; ad[i].driver; i++)
audioDriver->insertItem (ad[i].description, i);
layout->addWidget (new QLabel (i18n ("Audio driver:"), this), 0, 1);
layout->addWidget (audioDriver, 1, 1);
layout->addItem (new QSpacerItem (0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
}
KDE_NO_CDTOR_EXPORT PrefOPPageGeneral::PrefOPPageGeneral(QWidget *parent)
: QFrame(parent)
{
QVBoxLayout *layout = new QVBoxLayout (this, 5);
layout->setAutoAdd (true);
}
KDE_NO_CDTOR_EXPORT PrefOPPagePostProc::PrefOPPagePostProc(QWidget *parent) : QFrame(parent)
{
QVBoxLayout *tabLayout = new QVBoxLayout (this, 5);
postProcessing = new QCheckBox (i18n ("Enable use of postprocessing filters"), this);
postProcessing->setEnabled( true );
disablePPauto = new QCheckBox (i18n ("Disable use of postprocessing when watching TV/DVD"), this);
tabLayout->addWidget( postProcessing );
tabLayout->addWidget( disablePPauto );
tabLayout->addItem ( new QSpacerItem( 5, 5, QSizePolicy::Minimum, QSizePolicy::Minimum ) );
PostprocessingOptions = new QTabWidget( this, "PostprocessingOptions" );
PostprocessingOptions->setEnabled (true);
PostprocessingOptions->setAutoMask (false);
PostprocessingOptions->setTabPosition( QTabWidget::Top );
PostprocessingOptions->setTabShape( QTabWidget::Rounded );
PostprocessingOptions->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, PostprocessingOptions->sizePolicy().hasHeightForWidth() ) );
QWidget *presetSelectionWidget = new QWidget( PostprocessingOptions, "presetSelectionWidget" );
QGridLayout *presetSelectionWidgetLayout = new QGridLayout( presetSelectionWidget, 1, 1, 1);
QButtonGroup *presetSelection = new QButtonGroup(3, Qt::Vertical, presetSelectionWidget);
presetSelection->setInsideSpacing(KDialog::spacingHint());
defaultPreset = new QRadioButton (i18n ("Default"), presetSelection);
defaultPreset->setChecked( true );
presetSelection->insert (defaultPreset);
customPreset = new QRadioButton (i18n ("Custom"), presetSelection);
presetSelection->insert (customPreset);
fastPreset = new QRadioButton (i18n ("Fast"), presetSelection);
presetSelection->insert (fastPreset);
presetSelection->setRadioButtonExclusive ( true);
presetSelectionWidgetLayout->addWidget( presetSelection, 0, 0 );
PostprocessingOptions->insertTab( presetSelectionWidget, "" );
//
// SECOND!!!
//
/* I JUST WASN'T ABLE TO GET THIS WORKING WITH QGridLayouts */
QWidget *customFiltersWidget = new QWidget( PostprocessingOptions, "customFiltersWidget" );
QVBoxLayout *customFiltersWidgetLayout = new QVBoxLayout( customFiltersWidget );
QGroupBox *customFilters = new QGroupBox(0, Qt::Vertical, customFiltersWidget, "customFilters" );
customFilters->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)1, (QSizePolicy::SizeType)2));
customFilters->setFlat(false);
customFilters->setEnabled( false );
customFilters->setInsideSpacing(7);
QLayout *customFiltersLayout = customFilters->layout();
QHBoxLayout *customFiltersLayout1 = new QHBoxLayout ( customFilters->layout() );
HzDeblockFilter = new QCheckBox (i18n ("Horizontal deblocking"), customFilters);
HzDeblockAQuality = new QCheckBox (i18n ("Auto quality"), customFilters);
HzDeblockAQuality->setEnabled (false);
HzDeblockCFiltering = new QCheckBox (i18n ("Chrominance filtering"), customFilters);
HzDeblockCFiltering->setEnabled (false);
customFiltersLayout1->addWidget( HzDeblockFilter );
customFiltersLayout1->addItem( new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Minimum ) );
customFiltersLayout1->addWidget( HzDeblockAQuality );
customFiltersLayout1->addWidget( HzDeblockCFiltering );
QFrame *line1 = new QFrame( customFilters, "line1" );
line1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)2 ) );
line1->setFrameShape( QFrame::HLine );
line1->setFrameShadow( QFrame::Sunken );
customFiltersLayout->add(line1);
QHBoxLayout *customFiltersLayout2 = new QHBoxLayout ( customFilters->layout() );
VtDeblockFilter = new QCheckBox(i18n("Vertical deblocking"), customFilters);
VtDeblockAQuality = new QCheckBox (i18n ("Auto quality"), customFilters);
VtDeblockAQuality->setEnabled (false);
VtDeblockCFiltering = new QCheckBox (i18n ("Chrominance filtering"), customFilters);
VtDeblockCFiltering->setEnabled (false);
customFiltersLayout2->addWidget( VtDeblockFilter );
customFiltersLayout2->addItem( new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Minimum ) );
customFiltersLayout2->addWidget( VtDeblockAQuality );
customFiltersLayout2->addWidget( VtDeblockCFiltering );
QFrame *line2 = new QFrame( customFilters, "line2" );
line2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)2 ) );
line2->setFrameShape( QFrame::HLine );
line2->setFrameShadow( QFrame::Sunken );
customFiltersLayout->add(line2);
QHBoxLayout *customFiltersLayout3 = new QHBoxLayout ( customFilters->layout() );
DeringFilter = new QCheckBox (i18n ("Dering filter"), customFilters);
DeringAQuality = new QCheckBox (i18n ("Auto quality"), customFilters);
DeringAQuality->setEnabled (false);
DeringCFiltering=new QCheckBox(i18n("Chrominance filtering"),customFilters);
DeringCFiltering->setEnabled (false);
customFiltersLayout3->addWidget( DeringFilter );
customFiltersLayout3->addItem( new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Minimum ) );
customFiltersLayout3->addWidget( DeringAQuality );
customFiltersLayout3->addWidget( DeringCFiltering );
QFrame *line3 = new QFrame( customFilters, "line3" );
line3->setFrameShape( QFrame::HLine );
line3->setFrameShadow( QFrame::Sunken );
line3->setFrameShape( QFrame::HLine );
customFiltersLayout->add(line3);
QHBoxLayout *customFiltersLayout4 =new QHBoxLayout(customFilters->layout());
AutolevelsFilter = new QCheckBox (i18n ("Auto brightness/contrast"), customFilters);
AutolevelsFullrange = new QCheckBox (i18n ("Stretch luminance to full range"), customFilters);
AutolevelsFullrange->setEnabled (false);
customFiltersLayout4->addWidget(AutolevelsFilter);
customFiltersLayout4->addItem(new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Minimum ));
customFiltersLayout4->addWidget(AutolevelsFullrange);
QHBoxLayout *customFiltersLayout5 = new QHBoxLayout (customFilters->layout());
TmpNoiseFilter =new QCheckBox(i18n("Temporal noise reducer"),customFilters);
/* Note: Change TmpNoiseFilter text back to "Label:" if this slider gets reactivated
TmpNoiseSlider = new QSlider( customFilters, "TmpNoiseSlider" );
TmpNoiseSlider->setEnabled( false );
TmpNoiseSlider->setMinValue( 1 );
TmpNoiseSlider->setMaxValue( 3 );
TmpNoiseSlider->setValue( 1 );
TmpNoiseSlider->setOrientation( QSlider::Horizontal );
TmpNoiseSlider->setTickmarks( QSlider::Left );
TmpNoiseSlider->setTickInterval( 1 );
TmpNoiseSlider->setSizePolicy(QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1));*/
/*customFiltersLayout->addWidget(TmpNoiseFilter,7,0);
customFiltersLayout->addWidget(TmpNoiseSlider,7,2);*/
customFiltersLayout5->addWidget(TmpNoiseFilter);
customFiltersLayout5->addItem(new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Minimum ));
//customFiltersLayout5->addWidget(TmpNoiseSlider);
customFiltersWidgetLayout->addWidget( customFilters );
PostprocessingOptions->insertTab( customFiltersWidget, "" );
//
//THIRD!!!
//
QWidget *deintSelectionWidget = new QWidget( PostprocessingOptions, "deintSelectionWidget" );
QVBoxLayout *deintSelectionWidgetLayout = new QVBoxLayout( deintSelectionWidget);
QButtonGroup *deinterlacingGroup = new QButtonGroup(5, Qt::Vertical, deintSelectionWidget, "deinterlacingGroup" );
LinBlendDeinterlacer = new QCheckBox (i18n ("Linear blend deinterlacer"), deinterlacingGroup);
LinIntDeinterlacer = new QCheckBox (i18n ("Linear interpolating deinterlacer"), deinterlacingGroup);
CubicIntDeinterlacer = new QCheckBox (i18n ("Cubic interpolating deinterlacer"), deinterlacingGroup);
MedianDeinterlacer = new QCheckBox (i18n ("Median deinterlacer"), deinterlacingGroup);
FfmpegDeinterlacer = new QCheckBox (i18n ("FFmpeg deinterlacer"), deinterlacingGroup);
deinterlacingGroup->insert( LinBlendDeinterlacer );
deinterlacingGroup->insert( LinIntDeinterlacer );
deinterlacingGroup->insert( CubicIntDeinterlacer );
deinterlacingGroup->insert( MedianDeinterlacer );
deinterlacingGroup->insert( FfmpegDeinterlacer );
deintSelectionWidgetLayout->addWidget( deinterlacingGroup, 0, 0 );
PostprocessingOptions->insertTab( deintSelectionWidget, "" );
tabLayout->addWidget( PostprocessingOptions/*, 1, 0*/ );
PostprocessingOptions->setEnabled(false);
connect( customPreset, SIGNAL (toggled(bool) ), customFilters, SLOT(setEnabled(bool)));
connect( postProcessing, SIGNAL( toggled(bool) ), PostprocessingOptions, SLOT( setEnabled(bool) ) );
connect( HzDeblockFilter, SIGNAL( toggled(bool) ), HzDeblockAQuality, SLOT( setEnabled(bool) ) );
connect( HzDeblockFilter, SIGNAL( toggled(bool) ), HzDeblockCFiltering, SLOT( setEnabled(bool) ) );
connect( VtDeblockFilter, SIGNAL( toggled(bool) ), VtDeblockCFiltering, SLOT( setEnabled(bool) ) );
connect( VtDeblockFilter, SIGNAL( toggled(bool) ), VtDeblockAQuality, SLOT( setEnabled(bool) ) );
connect( DeringFilter, SIGNAL( toggled(bool) ), DeringAQuality, SLOT( setEnabled(bool) ) );
connect( DeringFilter, SIGNAL( toggled(bool) ), DeringCFiltering, SLOT( setEnabled(bool) ) );
//connect( TmpNoiseFilter, SIGNAL( toggled(bool) ), TmpNoiseSlider, SLOT( setEnabled(bool) ) );
connect( AutolevelsFilter, SIGNAL( toggled(bool) ), AutolevelsFullrange, SLOT( setEnabled(bool) ) );
QWhatsThis::add( defaultPreset, i18n( "Enable mplayer's default postprocessing filters" ) );
QWhatsThis::add( customPreset, i18n( "Enable custom postprocessing filters (See: Custom preset -tab)" ) );
QWhatsThis::add( fastPreset, i18n( "Enable mplayer's fast postprocessing filters" ) );
PostprocessingOptions->changeTab( presetSelectionWidget, i18n( "General" ) );
customFilters->setTitle (QString ());
QWhatsThis::add( HzDeblockAQuality, i18n( "Filter is used if there is enough CPU" ) );
QWhatsThis::add( VtDeblockAQuality, i18n( "Filter is used if there is enough CPU" ) );
QWhatsThis::add( DeringAQuality, i18n( "Filter is used if there is enough CPU" ) );
//QWhatsThis::add( TmpNoiseSlider, i18n( "Strength of the noise reducer" ) );
QWhatsThis::add( AutolevelsFullrange, i18n( "Stretches luminance to full range (0..255)" ) );
PostprocessingOptions->changeTab( customFiltersWidget, i18n( "Custom Preset" ) );
deinterlacingGroup->setTitle (QString ());
PostprocessingOptions->changeTab( deintSelectionWidget, i18n( "Deinterlacing" ) );
PostprocessingOptions->adjustSize();
}
KDE_NO_EXPORT void Preferences::confirmDefaults() {
// TODO: Switch to KMessageBox
switch( QMessageBox::warning( this, i18n("Reset Settings?"),
i18n("You are about to have all your settings overwritten with defaults.\nPlease confirm.\n"),
i18n ("&OK"), i18n ("&Cancel"), QString (), 0, 1)) {
case 0: Preferences::setDefaults();
break;
case 1: break;
}
}
KDE_NO_EXPORT void Preferences::setDefaults() {
m_GeneralPageGeneral->keepSizeRatio->setChecked(true);
m_GeneralPageGeneral->loop->setChecked(false);
m_GeneralPageGeneral->seekTime->setValue(10);
m_GeneralPageOutput->videoDriver->setCurrentItem (0);
m_GeneralPageOutput->audioDriver->setCurrentItem(0);
m_OPPagePostproc->postProcessing->setChecked(false);
m_OPPagePostproc->disablePPauto->setChecked(true);
m_OPPagePostproc->defaultPreset->setChecked(true);
m_OPPagePostproc->LinBlendDeinterlacer->setChecked(false);
m_OPPagePostproc->LinIntDeinterlacer->setChecked(false);
m_OPPagePostproc->CubicIntDeinterlacer->setChecked(false);
m_OPPagePostproc->MedianDeinterlacer->setChecked(false);
m_OPPagePostproc->FfmpegDeinterlacer->setChecked(false);
}
#include "pref.moc"

@ -0,0 +1,320 @@
/**
* Copyright (C) 2003 Joonas Koivunen <rzei@mbnet.fi>
* Copyright (C) 2003 Koos Vriezen <koos.vriezen@xs4all.nl>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KMPlayerPREF_H_
#define _KMPlayerPREF_H_
#include "kmplayer_def.h"
#include <kdialogbase.h>
#include <qframe.h>
#include <qmap.h>
class QTabWidget;
class QTable;
class QGroupBox;
class QCheckBox;
class QComboBox;
class QLineEdit;
class QRadioButton;
class QSlider;
class QSpinBox;
class QColor;
class QButtonGroup;
class KHistoryCombo;
class KComboBox;
class KURLRequester;
class KColorButton;
namespace KMPlayer {
class PrefGeneralPageGeneral; // general, general
class PrefSourcePageURL; // source, url
class PrefRecordPage; // recording
class RecorderPage; // base recorder
class PrefMEncoderPage; // mencoder
class PrefMPlayerDumpstreamPage; // mplayer -dumpstream
class PrefFFMpegPage; // ffmpeg
class PrefXinePage; // xine url:record
class PrefGeneralPageLooks; // general, looks
class PrefGeneralPageOutput; // general, output
class PrefOPPageGeneral; // OP = outputplugins, general
class PrefOPPagePostProc; // outputplugins, postproc
class PartBase;
class Source;
class Settings;
class PreferencesPage;
class OutputDriver;
class ColorSetting;
class FontSetting;
class KMPLAYER_NO_EXPORT Preferences : public KDialogBase
{
Q_OBJECT
public:
Preferences(PartBase *, Settings *);
~Preferences();
PrefGeneralPageGeneral *m_GeneralPageGeneral;
PrefSourcePageURL *m_SourcePageURL;
PrefRecordPage *m_RecordPage;
PrefMEncoderPage *m_MEncoderPage;
PrefMPlayerDumpstreamPage *m_MPlayerDumpstreamPage;
#ifdef HAVE_XINE
PrefXinePage *m_XinePage;
#endif
PrefFFMpegPage *m_FFMpegPage;
PrefGeneralPageLooks *m_GeneralPageLooks;
PrefGeneralPageOutput *m_GeneralPageOutput;
PrefOPPageGeneral *m_OPPageGeneral;
PrefOPPagePostProc *m_OPPagePostproc;
void setDefaults();
void setPage (const char *);
void addPrefPage (PreferencesPage *);
void removePrefPage (PreferencesPage *);
RecorderPage * recorders;
QMap<QString, QTabWidget *> entries;
public slots:
void confirmDefaults();
};
class KMPLAYER_NO_EXPORT PrefGeneralPageGeneral : public QFrame
{
Q_OBJECT
public:
PrefGeneralPageGeneral(QWidget *parent, Settings *);
~PrefGeneralPageGeneral() {}
QCheckBox *keepSizeRatio;
QCheckBox * autoResize;
QButtonGroup *sizesChoice;
QCheckBox *dockSysTray;
QCheckBox *loop;
QCheckBox *showConfigButton;
QCheckBox *showPlaylistButton;
QCheckBox *showRecordButton;
QCheckBox *showBroadcastButton;
QCheckBox *framedrop;
QCheckBox *adjustvolume;
QCheckBox *adjustcolors;
QSpinBox *seekTime;
};
class KMPLAYER_NO_EXPORT PrefGeneralPageLooks : public QFrame {
Q_OBJECT
public:
PrefGeneralPageLooks (QWidget *parent, Settings *);
~PrefGeneralPageLooks () {}
QComboBox *colorscombo;
KColorButton *colorbutton;
QComboBox *fontscombo;
QPushButton *fontbutton;
public slots:
void colorItemChanged (int);
void colorCanged (const QColor &);
void fontItemChanged (int);
void fontClicked ();
private:
ColorSetting * colors;
FontSetting * fonts;
};
class KMPLAYER_NO_EXPORT PrefSourcePageURL : public QFrame
{
Q_OBJECT
public:
PrefSourcePageURL (QWidget *parent);
~PrefSourcePageURL () {}
KURLRequester * url;
//KHistoryCombo * url;
KComboBox * urllist;
KURLRequester * sub_url;
KComboBox * sub_urllist;
QListBox * backend;
QCheckBox * allowhref;
QLineEdit * prefBitRate;
QLineEdit * maxBitRate;
bool changed;
private slots:
void slotBrowse ();
void slotTextChanged (const QString &);
};
class KMPLAYER_NO_EXPORT PrefRecordPage : public QFrame
{
Q_OBJECT
public:
PrefRecordPage (QWidget *parent, PartBase *, RecorderPage *, int len);
~PrefRecordPage () {}
KURLRequester * url;
QButtonGroup * recorder;
QButtonGroup * replay;
QLineEdit * replaytime;
QLabel * source;
public slots:
void replayClicked (int id);
void recorderClicked (int id);
private slots:
void slotRecord ();
void playingStopped ();
void sourceChanged (KMPlayer::Source *, KMPlayer::Source *);
void recordingStarted ();
void recordingFinished ();
private:
PartBase * m_player;
RecorderPage * m_recorders;
QPushButton * recordButton;
int m_recorders_length;
};
class KMPLAYER_NO_EXPORT RecorderPage : public QFrame
{
Q_OBJECT
public:
RecorderPage (QWidget *parent, PartBase *);
virtual ~RecorderPage () {};
virtual void record ();
virtual QString name () = 0;
virtual const char * recorderName () = 0;
RecorderPage * next;
protected:
PartBase * m_player;
};
class KMPLAYER_NO_EXPORT PrefMEncoderPage : public RecorderPage
{
Q_OBJECT
public:
PrefMEncoderPage (QWidget *parent, PartBase *);
~PrefMEncoderPage () {}
void record ();
QString name ();
const char * recorderName () { return "mencoder"; }
QLineEdit * arguments;
QButtonGroup * format;
public slots:
void formatClicked (int id);
private:
};
class KMPLAYER_NO_EXPORT PrefMPlayerDumpstreamPage : public RecorderPage {
public:
PrefMPlayerDumpstreamPage (QWidget *parent, PartBase *);
~PrefMPlayerDumpstreamPage () {}
QString name ();
const char * recorderName () { return "mplayerdumpstream"; }
};
#ifdef HAVE_XINE
class KMPLAYER_NO_EXPORT PrefXinePage : public RecorderPage {
public:
PrefXinePage (QWidget *parent, PartBase *);
~PrefXinePage () {}
QString name ();
const char * recorderName () { return "xine"; }
};
#endif
class KMPLAYER_NO_EXPORT PrefFFMpegPage : public RecorderPage
{
Q_OBJECT
public:
PrefFFMpegPage (QWidget *parent, PartBase *);
~PrefFFMpegPage () {}
void record ();
QString name ();
const char * recorderName () { return "ffmpeg"; }
QLineEdit * arguments;
QButtonGroup * format;
private:
};
class KMPLAYER_NO_EXPORT PrefGeneralPageOutput : public QFrame
{
Q_OBJECT
public:
PrefGeneralPageOutput (QWidget *parent, OutputDriver * ad, OutputDriver * vd);
~PrefGeneralPageOutput() {}
QListBox *videoDriver;
QListBox *audioDriver;
};
class KMPLAYER_NO_EXPORT PrefOPPageGeneral : public QFrame
{
Q_OBJECT
public:
PrefOPPageGeneral(QWidget *parent = 0);
~PrefOPPageGeneral() {}
};
class KMPLAYER_NO_EXPORT PrefOPPagePostProc : public QFrame
{
Q_OBJECT
public:
PrefOPPagePostProc(QWidget *parent = 0);
~PrefOPPagePostProc() {}
QCheckBox* postProcessing;
QCheckBox* disablePPauto;
QTabWidget* PostprocessingOptions;
QRadioButton* defaultPreset;
QRadioButton* customPreset;
QRadioButton* fastPreset;
QCheckBox* HzDeblockFilter;
QCheckBox* VtDeblockFilter;
QCheckBox* DeringFilter;
QCheckBox* HzDeblockAQuality;
QCheckBox* VtDeblockAQuality;
QCheckBox* DeringAQuality;
QCheckBox* AutolevelsFilter;
QCheckBox* AutolevelsFullrange;
QCheckBox* HzDeblockCFiltering;
QCheckBox* VtDeblockCFiltering;
QCheckBox* DeringCFiltering;
QCheckBox* TmpNoiseFilter;
QSlider* TmpNoiseSlider;
QCheckBox* LinBlendDeinterlacer;
QCheckBox* CubicIntDeinterlacer;
QCheckBox* LinIntDeinterlacer;
QCheckBox* MedianDeinterlacer;
QCheckBox* FfmpegDeinterlacer;
};
} // namespace
#endif // _KMPlayerPREF_H_

@ -0,0 +1,19 @@
{ "circle", SMIL::Transition::SubCircle },
{ "clockwiseNine", SMIL::Transition::SubClockwiseNine },
{ "clockwiseSix", SMIL::Transition::SubClockwiseSix },
{ "clockwiseThree", SMIL::Transition::SubClockwiseThree },
{ "clockwiseTwelve",SMIL::Transition::SubClockwiseTwelve },
{ "crossfade", SMIL::Transition::SubCrossfade },
{ "diamond", SMIL::Transition::SubDiamond },
{ "fadeFromColor", SMIL::Transition::SubFadeFromColor },
{ "fadeToColor", SMIL::Transition::SubFadeToColor },
{ "fromBottom", SMIL::Transition::SubFromBottom },
{ "fromLeft", SMIL::Transition::SubFromLeft },
{ "fromRight", SMIL::Transition::SubFromRight },
{ "fromTop", SMIL::Transition::SubFromTop },
{ "horizontal", SMIL::Transition::SubHorizontal },
{ "leftToRight", SMIL::Transition::SubLeftToRight },
{ "rectangle", SMIL::Transition::SubRectangle },
{ "topToBottom", SMIL::Transition::SubTopToBottom },
{ "vertical", SMIL::Transition::SubVertical },
{ NULL, SMIL::Transition::SubTransLast }

@ -0,0 +1,29 @@
/*http://www.w3.org/TR/2005/REC-SMIL2-20050107/smil-transitions.html#Table%201:%20Taxonomy%20Table*/
{ "barWipe", SMIL::Transition::BarWipe, 2, {
SMIL::Transition::SubLeftToRight,
SMIL::Transition::SubTopToBottom } },
{ "bowTieWipe", SMIL::Transition::BowTieWipe, 2, {
SMIL::Transition::SubVertical,
SMIL::Transition::SubHorizontal } },
{ "clockWipe", SMIL::Transition::ClockWipe, 4, {
SMIL::Transition::SubClockwiseTwelve,
SMIL::Transition::SubClockwiseThree,
SMIL::Transition::SubClockwiseSix,
SMIL::Transition::SubClockwiseNine } },
{ "ellipseWipe",SMIL::Transition::EllipseWipe,3, {
SMIL::Transition::SubCircle,
SMIL::Transition::SubVertical,
SMIL::Transition::SubHorizontal } },
{ "fade", SMIL::Transition::Fade, 3, {
SMIL::Transition::SubCrossfade,
SMIL::Transition::SubFadeToColor,
SMIL::Transition::SubFadeFromColor } },
{ "irisWipe", SMIL::Transition::IrisWipe, 2, {
SMIL::Transition::SubRectangle, SMIL::Transition::SubDiamond } },
{ "pushWipe", SMIL::Transition::PushWipe, 4, {
SMIL::Transition::SubFromLeft,
SMIL::Transition::SubFromTop,
SMIL::Transition::SubFromRight,
SMIL::Transition::SubFromBottom } },
{ NULL, SMIL::Transition::TransTypeNone, 0, {
} }

@ -0,0 +1,516 @@
/**
This file belong to the KMPlayer project, a movie player plugin for Konqueror
Copyright (C) 2007 Koos Vriezen <koos.vriezen@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**/
#ifdef TEST_TRIE
# define KMPLAYER_NO_EXPORT
# define KMPLAYER_EXPORT
# define KDE_NO_EXPORT
# define KDE_NO_CDTOR_EXPORT
#else
# include <config.h>
# include "kmplayer_def.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include "triestring.h"
namespace KMPlayer {
struct KMPLAYER_NO_EXPORT TrieNode {
TrieNode (const char * s);
~TrieNode ();
void unref ();
void removeChild (TrieNode *);
void dump (int lvl) {
QString indent (QString ().fill (QChar ('.'), lvl));
printf("%s%s len:%4d rc:%4d\n", indent.ascii(), str, length, ref_count);
}
char * str;
unsigned short length;
unsigned short ref_count;
TrieNode * parent;
TrieNode * first_child;
TrieNode * next_sibling;
};
}
using namespace KMPlayer;
static TrieNode * root_trie;
void dump (TrieNode * node, int lvl) {
if (!node)
return;
node->dump (lvl);
dump (node->first_child, lvl+2);
if (node->next_sibling)
dump (node->next_sibling, lvl);
}
KDE_NO_CDTOR_EXPORT TrieNode::TrieNode (const char * s)
: str (s ? strdup (s) : 0L),
length (s ? strlen (s) : 0),
ref_count (1),
parent (0L),
first_child (0L),
next_sibling (0L) {}
KDE_NO_CDTOR_EXPORT TrieNode::~TrieNode () {
if (str)
free (str);
}
KDE_NO_EXPORT void TrieNode::unref () {
if (--ref_count <= 0 && !first_child)
parent->removeChild (this);
}
KDE_NO_EXPORT void TrieNode::removeChild (TrieNode * node) {
if (node == first_child) {
first_child = node->next_sibling;
} else {
for (TrieNode *tn = first_child; tn; tn = tn->next_sibling)
if (tn->next_sibling == node) {
tn->next_sibling = node->next_sibling;
break;
}
}
delete node;
if (!parent)
return;
if (!ref_count && !first_child)
parent->removeChild (this); // can this happen ?
else if (!ref_count && !first_child->next_sibling) { // merge with child
char * tmp = first_child->str;
first_child->length = first_child->length + length;
first_child->str = (char *) malloc (first_child->length + 1);
strcpy (first_child->str, str);
strcat (first_child->str, tmp);
free (tmp);
first_child->parent = parent;
first_child->next_sibling = next_sibling;
if (parent->first_child == this) {
parent->first_child = first_child;
} else {
for (TrieNode *n = parent->first_child; n; n = n->next_sibling)
if (n->next_sibling == this) {
n->next_sibling = first_child;
break;
}
}
delete this;
}
}
static char * trieRetrieveString (TrieNode * node, int &len) {
char *buf;
if (node->parent) {
len += node->length;
buf = trieRetrieveString (node->parent, len);
strcat (buf, node->str);
} else {
buf = (char *) malloc (len + 1);
*buf = 0;
}
return buf;
}
static int trieStringCompare (TrieNode * node, const char * s, int &len) {
int cmp = 0;
if (!node)
return !!s;
if (node->parent && node->parent != root_trie)
cmp = trieStringCompare (node->parent, s, len);
if (!cmp) {
#ifdef TEST_TRIE
printf( "compare %s %s %d\n", node->str, s + len, node->length);
#endif
cmp = s ? strncmp (node->str, s + len, node->length) : 1;
len += node->length;
}
return cmp;
}
static int trieStringCompare (TrieNode * n1, TrieNode * n2) {
// pre n1 && n2 on same depth and not NIL
int cmp = 0;
if (n1->parent && n1->parent != root_trie)
cmp = trieStringCompare (n1->parent, n2->parent);
if (!cmp && n1 != n2) {
#ifdef TEST_TRIE
printf( "compare %s %s", n1->str, n2->str);
#endif
if (!n1->str)
cmp = n2->str ? 1 : 0;
else if (!n2->str)
cmp = 1;
else
cmp = strcmp (n1->str, n2->str);
#ifdef TEST_TRIE
printf( "=> %d\n", cmp);
#endif
}
return cmp;
}
static int trieStringStarts (TrieNode * node, const char * s, int & pos) {
int cmp = -1; // -1 still matches, 0 no, 1 yes
if (node->parent && node->parent != root_trie)
cmp = trieStringStarts (node->parent, s, pos);
if (cmp == -1) {
for (int i = 0; i < node->length; i++)
if (node->str[i] != s[pos + i])
return !s[pos + i] ? 1 : 0;
pos += node->length;
}
return cmp;
}
static TrieNode * trieInsert (const char * s) {
if (!root_trie)
root_trie = new TrieNode (0L);
//printf("trieInsert %s\n", s);
//dumpTrie();
TrieNode * parent = root_trie;
for (TrieNode * c = parent->first_child; c; c = c->first_child) {
TrieNode * prev = c;
for (TrieNode * n = prev; n; n = n->next_sibling) {
if (n->str[0] == s[0]) { // insert here
int i = 1;
for (; i < n->length; i++) {
if (n->str[i] != s[i]) { // break here
// insert new node so strings to n remain valid
bool bigger = n->str[i] < s[i];
char *tmp = n->str;
n->str = strdup (tmp + i);
n->length -= i;
tmp[i] = 0;
TrieNode * node = new TrieNode (tmp);
free (tmp);
node->parent = parent;
node->next_sibling = n->next_sibling;
if (prev != n)
prev->next_sibling = node;
else
parent->first_child = node;
n->parent = node;
TrieNode * snode;
if (!s[i]) {
node->first_child = n;
n->next_sibling = 0L;
snode = node; // s is complete in node
} else {
snode = new TrieNode (s+i);
snode->parent = node;
if (bigger) { // set n before snode
node->first_child = n;
n->next_sibling = snode;
} else { // set snode before n
node->first_child = snode;
snode->next_sibling = n;
n->next_sibling = 0L;
}
node->ref_count--;
}
return snode;
}
}
if (s[i]) { // go one level deeper with s+i
s = s + i;
c = n;
prev = 0;
break;
} // else n and s are equal
n->ref_count++;
return n;
} else if (n->str[0] > s[0]) { // insert before
TrieNode * node = new TrieNode (s);
node->parent = parent;
node->next_sibling = n;
if (prev != n)
prev->next_sibling = node;
else
parent->first_child = node;
return node;
}
prev = n;
}
if (prev) { // insert after
TrieNode * node = new TrieNode (s);
node->parent = parent;
prev->next_sibling = node;
return node;
}
parent = c;
}
// hit an empty first_child, add s as first_child
TrieNode * node = new TrieNode (s);
parent->first_child = node;
node->parent = parent;
return node;
}
TrieString::TrieString (const QString & s)
: node (s.isEmpty () ? 0L : trieInsert (s.utf8 ().data ()))
{}
TrieString::TrieString (const char * utf8)
: node (!utf8 ? 0L : trieInsert (utf8))
{}
TrieString::TrieString (const TrieString & s) : node (s.node) {
if (node)
node->ref_count++;
}
TrieString::~TrieString () {
if (node)
node->unref ();
}
bool TrieString::startsWith (const TrieString & s) const {
for (TrieNode * n = node; n; n = n->parent)
if (n == s.node)
return true;
return s.node ? false : true;
}
bool TrieString::startsWith (const char * str) const {
if (!node)
return !str ? true : false;
if (!str)
return true;
int pos = 0;
return trieStringStarts (node, str, pos) != 0;
}
void TrieString::clear () {
if (node)
node->unref ();
node = 0L;
}
TrieString & TrieString::operator = (const TrieString & s) {
if (s.node != node) {
if (s.node)
s.node->ref_count++;
if (node)
node->unref ();
node = s.node;
}
return *this;
}
TrieString & TrieString::operator = (const char * utf8) {
if (node)
node->unref ();
node = !utf8 ? 0L : trieInsert (utf8);
return *this;
}
QString TrieString::toString () const {
QString s;
if (node) {
int len = 0;
char *utf8 = trieRetrieveString (node, len);
s = QString::fromUtf8 (utf8);
free (utf8);
}
return s;
}
bool TrieString::operator < (const TrieString & s) const {
if (node == s.node)
return false;
int depth1 = 0, depth2 = 0;
for (TrieNode * n = node; n; n = n->parent)
depth1++;
if (!depth1)
return s.node ? true : false;
for (TrieNode * n = s.node; n; n = n->parent)
depth2++;
if (!depth2)
return false;
TrieNode * n1 = node;
TrieNode * n2 = s.node;
while (depth1 > depth2) {
if (n1 == n2)
return false;
n1 = n1->parent;
depth1--;
}
while (depth2 > depth1) {
if (n1 == n2)
return true;
n2 = n2->parent;
depth2--;
}
int cmp = trieStringCompare (n1, n2);
if (cmp)
return cmp < 0;
return depth1 < depth2;
}
bool KMPlayer::operator == (const TrieString & s1, const char * s2) {
int len = 0;
return !trieStringCompare (s1.node, s2, len);
}
TrieString StringPool::attr_id;
TrieString StringPool::attr_name;
TrieString StringPool::attr_src;
TrieString StringPool::attr_url;
TrieString StringPool::attr_href;
TrieString StringPool::attr_width;
TrieString StringPool::attr_height;
TrieString StringPool::attr_top;
TrieString StringPool::attr_left;
TrieString StringPool::attr_bottom;
TrieString StringPool::attr_right;
TrieString StringPool::attr_title;
TrieString StringPool::attr_begin;
TrieString StringPool::attr_dur;
TrieString StringPool::attr_end;
TrieString StringPool::attr_region;
TrieString StringPool::attr_target;
TrieString StringPool::attr_type;
TrieString StringPool::attr_value;
TrieString StringPool::attr_fill;
void StringPool::init() {
attr_width = "width";
attr_value = "value";
attr_url = "url";
attr_type = "type";
attr_top = "top";
attr_title = "title";
attr_target = "target";
attr_src = "src";
attr_right = "right";
attr_region = "region";
attr_name = "name";
attr_left = "left";
attr_id = "id";
attr_href = "href";
attr_height = "height";
attr_fill = "fill";
attr_end = "end";
attr_dur = "dur";
attr_bottom = "bottom";
attr_begin = "begin";
}
void StringPool::reset() {
attr_id.clear ();
attr_name.clear ();
attr_src.clear ();
attr_url.clear ();
attr_href.clear ();
attr_width.clear ();
attr_height.clear ();
attr_top.clear ();
attr_left.clear ();
attr_bottom.clear ();
attr_right.clear ();
attr_title.clear ();
attr_begin.clear ();
attr_dur.clear ();
attr_end.clear ();
attr_region.clear ();
attr_target.clear ();
attr_type.clear ();
attr_value.clear ();
attr_fill.clear ();
if (root_trie->first_child) {
qWarning ("Trie not empty");
dumpTrie ();
} else {
delete root_trie;
root_trie = 0;
}
}
void KMPlayer::dumpTrie () {
dump (root_trie, 0);
}
#ifdef TEST_TRIE
// g++ triestring.cpp -o triestring -I$QTDIR/include -L$QTDIR/lib -lqt-mt -g -DTEST_TRIE
int main (int, char **) {
StringPool::init();
{
TrieString s1;
TrieString s1_1(QString ("region"));
s1 = s1_1;
TrieString s2 (QString ("regionName"));
TrieString s3 (QString ("regPoint"));
TrieString s4 (QString ("regAlign"));
TrieString s6 (QString ("freeze"));
TrieString s7 (QString ("fit"));
{
TrieString s7_1 (QString ("fit"));
TrieString s5 (QString ("fill"));
dump (root_trie, 0);
}
dump (root_trie, 0);
TrieString s5 (QString ("fill"));
TrieString s8 (QString ("fontPtSize"));
TrieString s9 (QString ("fontSize"));
TrieString s10 (QString ("fontFace"));
TrieString s11 (QString ("fontColor"));
TrieString s12 (QString ("hAlign"));
TrieString s13 (QString ("region"));
TrieString s14 (QString ("ref"));
TrieString s15 (QString ("head"));
dump (root_trie, 0);
QString qs1 = s1.toString ();
QString qs2 = s2.toString ();
printf ("%s\n%s\n", qs1.ascii(), qs2.ascii());
printf("equal %s %s %d\n", qs2.ascii(), "regionName", s2 == "regionName");
printf("equal %s %s %d\n", qs2.ascii(), "zegionName", s2 == "zegionName");
printf("equal %s %s %d\n", qs2.ascii(), "reqionName", s2 == "reqionName");
printf("equal %s %s %d\n", qs2.ascii(), "regiinName", s2 == "regiinName");
printf("equal %s %s %d\n", qs2.ascii(), "regionNeme", s2 == "regionNeme");
printf("%s < %s %d\n", qs2.ascii(), "regionName", s2 < TrieString("regionName"));
printf("%s < %s %d\n", qs2.ascii(), "zegion", s2 < TrieString("zegion"));
printf("%s < %s %d\n", qs2.ascii(), "req", s2 < TrieString("req"));
printf("%s < %s %d\n", qs2.ascii(), "regiinName", s2 < TrieString("regiinName"));
printf("%s < %s %d\n", qs2.ascii(), "regionNeme", s2 < TrieString("regionNeme"));
printf("%s startsWith %s %d\n", s1.toString().ascii(), "region", s1.startsWith ("region"));
printf("%s startsWith %s %d\n", qs2.ascii(), "region", s2.startsWith ("region"));
printf("%s startsWith %s %d\n", qs2.ascii(), "regi", s2.startsWith ("regi"));
printf("%s startsWith %s %d\n", qs2.ascii(), "regian", s2.startsWith ("regian"));
printf("%s startsWith %s %d\n", qs2.ascii(), "regio", s2.startsWith ("regio"));
printf("%s startsWith %s %d\n", qs2.ascii(), "zegio", s2.startsWith ("zegio"));
printf("%s startsWith %s %d\n", qs2.ascii(), "r", s2.startsWith ("r"));
printf("%s startsWith %s %d\n", qs2.ascii(), "q", s2.startsWith ("q"));
TrieString fnt ("font");
printf("%s startsWith %s %d\n", s8.toString().ascii(), fnt.toString().ascii(), s8.startsWith(fnt));
printf("%s startsWith %s %d\n", s8.toString().ascii(), s14.toString().ascii(), s8.startsWith(s14));
}
dump (root_trie, 0);
StringPool::reset();
return 0;
}
#endif

@ -0,0 +1,103 @@
/**
This file belong to the KMPlayer project, a movie player plugin for Konqueror
Copyright (C) 2007 Koos Vriezen <koos.vriezen@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**/
#ifndef _TRIE_STRING_H_
#define _TRIE_STRING_H_
#include <qstring.h>
namespace KMPlayer {
class TrieNode;
class KMPLAYER_EXPORT TrieString {
TrieNode * node;
friend bool operator == (const TrieString & s1, const TrieString & s2);
friend bool operator == (const TrieString & s, const char * utf8);
friend bool operator == (const char * utf8, const TrieString & s);
friend bool operator != (const TrieString & s1, const TrieString & s2);
public:
TrieString ();
TrieString (const QString & s);
TrieString (const char * utf8);
TrieString (const TrieString & s);
~TrieString ();
QString toString () const;
bool isNull () const;
void clear ();
bool startsWith (const TrieString & s) const;
bool startsWith (const char * str) const;
TrieString & operator = (const TrieString & s);
TrieString & operator = (const char * utf8);
bool operator < (const TrieString & s) const;
};
inline TrieString::TrieString () : node (0L) {}
class KMPLAYER_EXPORT StringPool {
public:
static void init();
static void reset();
static TrieString attr_id;
static TrieString attr_name;
static TrieString attr_src;
static TrieString attr_url;
static TrieString attr_href;
static TrieString attr_width;
static TrieString attr_height;
static TrieString attr_top;
static TrieString attr_left;
static TrieString attr_bottom;
static TrieString attr_right;
static TrieString attr_title;
static TrieString attr_begin;
static TrieString attr_dur;
static TrieString attr_end;
static TrieString attr_region;
static TrieString attr_target;
static TrieString attr_type;
static TrieString attr_value;
static TrieString attr_fill;
};
inline bool TrieString::isNull () const {
return !node;
}
inline bool operator == (const TrieString & s1, const TrieString & s2) {
return s1.node == s2.node;
}
bool operator == (const TrieString & s, const char * utf8);
inline bool operator == (const char * utf8, const TrieString & s) {
return s == utf8;
}
inline bool operator != (const TrieString & s1, const TrieString & s2) {
return s1.node != s2.node;
}
void dumpTrie ();
} // namespace
#endif // _TRIE_STRING_H_

File diff suppressed because it is too large Load Diff

@ -0,0 +1,89 @@
/**
This file belong to the KMPlayer project, a movie player plugin for Konqueror
Copyright (C) 2007 Koos Vriezen <koos.vriezen@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**/
#ifndef KMPLAYER_VIEW_AREA_H
#define KMPLAYER_VIEW_AREA_H
#include <qwidget.h>
class KActionCollection;
namespace KMPlayer {
class View;
class ViewAreaPrivate;
/*
* The area in which the video widget and controlpanel are laid out
*/
class KMPLAYER_EXPORT ViewArea : public QWidget {
Q_OBJECT
public:
ViewArea (QWidget * parent, View * view);
~ViewArea ();
KDE_NO_EXPORT bool isFullScreen () const { return m_fullscreen; }
KDE_NO_EXPORT bool isMinimalMode () const { return m_minimal; }
KDE_NO_EXPORT KActionCollection * actionCollection () const { return m_collection; }
KDE_NO_EXPORT QRect topWindowRect () const { return m_topwindow_rect; }
SurfacePtr getSurface (NodePtr node);
void setAudioVideoGeometry (const IRect &rect, unsigned int * bg);
void setAudioVideoNode (NodePtr n);
void mouseMoved ();
void scheduleRepaint (const IRect &rect);
void resizeEvent (QResizeEvent *);
void minimalMode ();
public slots:
void fullScreen ();
void accelActivated ();
void scale (int);
protected:
void showEvent (QShowEvent *);
void mouseMoveEvent (QMouseEvent *);
void mousePressEvent (QMouseEvent *);
void mouseDoubleClickEvent (QMouseEvent *);
void dragEnterEvent (QDragEnterEvent *);
void dropEvent (QDropEvent *);
void contextMenuEvent (QContextMenuEvent * e);
void paintEvent (QPaintEvent *);
void timerEvent (QTimerEvent * e);
void closeEvent (QCloseEvent * e);
private:
void syncVisual (const IRect & rect);
void updateSurfaceBounds ();
ViewAreaPrivate * d;
QWidget * m_parent;
View * m_view;
KActionCollection * m_collection;
SurfacePtr surface;
NodePtrW video_node;
QRect m_av_geometry;
IRect m_repaint_rect;
QRect m_topwindow_rect;
int m_mouse_invisible_timer;
int m_repaint_timer;
int m_fullscreen_scale;
int scale_lbl_id;
int scale_slider_id;
bool m_fullscreen;
bool m_minimal;
};
} // namespace KMPlayer
#endif

File diff suppressed because it is too large Load Diff

@ -0,0 +1,79 @@
/**
* Copyright (C) 2003 by Koos Vriezen <koos.vriezen@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
**/
#ifndef _KXINEPLAYER_H_
#define _KXINEPLAYER_H_
#include <qapplication.h>
#include <qstring.h>
#include <qstringlist.h>
#include <qsessionmanager.h>
struct XineMovieParamEvent : public QEvent {
XineMovieParamEvent (int l, int w, int h, const QStringList & al, const QStringList & sl, bool ff=false);
int length;
int width;
int height;
QStringList alang;
QStringList slang;
bool first_frame;
};
struct XineURLEvent : public QEvent {
XineURLEvent (const QString & u);
QString url;
};
struct XineTitleEvent : public QEvent {
XineTitleEvent (const char *);
QString title;
};
struct XineProgressEvent : public QEvent {
XineProgressEvent (int p);
int progress;
};
class KXinePlayer : public QApplication {
Q_OBJECT
public:
KXinePlayer (int argc, char ** argv);
~KXinePlayer ();
void init ();
void finished ();
void saturation (int val);
void hue (int val);
void contrast (int val);
void brightness (int val);
void volume (int val);
void seek (int val);
bool event (QEvent * e);
void setAudioLang (int, const QString &);
void setSubtitle (int, const QString &);
public slots:
void play (int repeat_count);
void stop ();
void pause ();
void updatePosition ();
void postFinished ();
protected:
void saveState (QSessionManager & sm);
};
#endif //_KXINEPLAYER_H_

@ -0,0 +1,704 @@
/* This file is part of the KMPlayer application
Copyright (C) 2004 Koos Vriezen <koos.vriezen@xs4all.nl>
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 2 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; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <config.h>
#include <dcopclient.h>
#include <qcstring.h>
#include <qtimer.h>
#include <qfile.h>
#include <qurl.h>
#include <qthread.h>
#include <qmutex.h>
#include <qdom.h>
#include "kmplayer_backend.h"
#include "kmplayer_callback_stub.h"
#include "kmplayer_callback.h"
#include "xvplayer.h"
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <X11/extensions/XShm.h>
#include <X11/extensions/Xvlib.h>
static char configfile[2048];
static Display *display;
static KXVideoPlayer *xvapp;
static KMPlayer::Callback_stub * callback;
static Window wid;
static GC gc;
static bool window_created = true;
static bool wants_config;
static bool verbose;
static bool running;
static bool have_freq;
static bool xv_success;
static bool reset_xv_autopaint_colorkey;
static bool reset_xv_mute;
static int xvport;
static int xv_encoding = -1;
static QString xv_norm;
static int xv_frequency;
static int screen;
static int movie_width;
static int movie_height;
static int current_volume;
static int tmp_volume;
static const int start_vol_timeout = 100;
static const int inc_vol_timeout = 20;
Atom xv_enc_atom;
Atom xv_hue_atom;
Atom xv_saturation_atom;
Atom xv_brightness_atom;
Atom xv_contrast_atom;
Atom xv_freq_atom;
Atom xv_volume_atom;
Atom xv_mute_atom;
Atom xv_autopaint_colorkey_atom;
enum {
limit_volume = 0,
limit_hue, limit_contrast, limit_brightness, limit_saturation,
limit_last
};
static struct Limit { int min; int max; } xv_limits [limit_last];
static QString elmentry ("entry");
static QString elmitem ("item");
static QString attname ("name");
static QString atttype ("type");
static QString attdefault ("DEFAULT");
static QString attvalue ("value");
//static QString attstart ("START");
//static QString attend ("END");
//static QString valrange ("range");
//static QString valnum ("num");
//static QString valbool ("bool");
//static QString valenum ("enum");
//static QString valstring ("string");
static QString valtree ("tree");
static QByteArray config_buf;
extern "C" {
} // extern "C"
static void putVideo () {
XWindowAttributes attr;
XGetWindowAttributes (display, wid, &attr);
XvPutVideo (display, xvport, wid, gc, 0, 0, attr.width, attr.height, 0, 0, attr.width, attr.height);
}
using namespace KMPlayer;
Backend::Backend ()
: DCOPObject (QCString ("Backend")) {
}
Backend::~Backend () {}
void Backend::setURL (QString) {
}
void Backend::setSubTitleURL (QString) {
}
void Backend::play (int) {
xvapp->play ();
}
void Backend::stop () {
QTimer::singleShot (0, xvapp, SLOT (stop ()));
}
void Backend::pause () {
}
void Backend::seek (int, bool /*absolute*/) {
}
void Backend::hue (int h, bool) {
if (xv_limits[limit_hue].max > xv_limits[limit_hue].min)
xvapp->hue ((h + 100) * (xv_limits[limit_hue].max - xv_limits[limit_hue].min)/200 + xv_limits[limit_hue].min);
}
void Backend::saturation (int s, bool) {
if (xv_limits[limit_saturation].max > xv_limits[limit_saturation].min)
xvapp->saturation ((s + 100) * (xv_limits[limit_saturation].max - xv_limits[limit_saturation].min)/200 + xv_limits[limit_saturation].min);
}
void Backend::contrast (int c, bool) {
if (xv_limits[limit_contrast].max > xv_limits[limit_contrast].min)
xvapp->contrast ((c + 100)*(xv_limits[limit_contrast].max - xv_limits[limit_contrast].min)/200 + xv_limits[limit_contrast].min);
}
void Backend::brightness (int b, bool) {
if (xv_limits[limit_brightness].max > xv_limits[limit_brightness].min)
xvapp->brightness ((b + 100)*(xv_limits[limit_brightness].max - xv_limits[limit_brightness].min)/200 + xv_limits[limit_brightness].min);
}
void Backend::volume (int v, bool) {
if (xv_limits[limit_volume].max > xv_limits[limit_volume].min)
xvapp->volume (v*(xv_limits[limit_volume].max - xv_limits[limit_volume].min)/100 + xv_limits[limit_volume].min);
}
void Backend::frequency (int f) {
xvapp->frequency (f);
}
void Backend::setAudioLang (int, QString) {
}
void Backend::setSubtitle (int, QString) {
}
void Backend::quit () {
delete callback;
callback = 0L;
if (running)
stop ();
else
QTimer::singleShot (0, qApp, SLOT (quit ()));
}
bool updateConfigEntry (const QString & name, const QString & value) {
fprintf (stderr, "%s=%s\n", name.ascii (), (const char *) value.local8Bit ());
return true;
}
void Backend::setConfig (QByteArray data) {
QString err;
int line, column;
QDomDocument dom;
if (dom.setContent (data, false, &err, &line, &column)) {
if (dom.childNodes().length() == 1) {
for (QDomNode node = dom.firstChild().firstChild();
!node.isNull ();
node = node.nextSibling ()) {
QDomNamedNodeMap attr = node.attributes ();
updateConfigEntry (attr.namedItem (attname).nodeValue (),
attr.namedItem (attvalue).nodeValue ());
}
} else
err = QString ("invalid data");
}
if (callback)
callback->errorMessage (0, err);
}
bool Backend::isPlaying () {
return running;
}
KXVideoPlayer::KXVideoPlayer (int _argc, char ** _argv)
: QApplication (_argc, _argv, false), mute_timer (0) {
}
void KXVideoPlayer::init () {
int xpos = 0;
int ypos = 0;
int width = 320;
int height = 200;
XLockDisplay(display);
if (window_created)
wid = XCreateSimpleWindow(display, XDefaultRootWindow(display),
xpos, ypos, width, height, 1, 0, 0);
if (!callback)
QTimer::singleShot (10, this, SLOT (play ()));
XSelectInput (display, wid,
(PointerMotionMask | ExposureMask | KeyPressMask | ButtonPressMask | StructureNotifyMask)); // | SubstructureNotifyMask));
XvAdaptorInfo * ai;
unsigned int adaptors;
xv_success = true;
QDomDocument doc;
QDomElement root = doc.createElement (QString ("document"));
if (XvQueryAdaptors (display, XDefaultRootWindow (display), &adaptors, &ai) == Success) {
QDomElement elm = doc.createElement (elmentry);
elm.setAttribute (attname, QString ("XVideo"));
elm.setAttribute (atttype, valtree);
for (unsigned i = 0; i < adaptors; i++) {
if ((ai[i].type & XvInputMask) &&
(ai[i].type & XvVideoMask) &&
ai[i].base_id > 0) {
int port = ai[i].base_id;
fprintf (stderr, "xvport %d\n", port);
bool freq_found = false;
XvAttribute *attributes = 0L;
int nr_attr, cur_val;
attributes = XvQueryPortAttributes (display, port, &nr_attr);
if (attributes) {
for (int i = 0; i < nr_attr; i++) {
if (!strcmp (attributes[i].name, "XV_FREQ"))
freq_found = true;
Atom atom = XInternAtom (display, attributes[i].name, false);
fprintf (stderr, "%s[%d] (%d .. %d)", attributes[i].name, ( int ) atom, attributes[i].min_value, attributes[i].max_value);
if ((attributes[i].flags & XvGettable) && XvGetPortAttribute (display, port, atom, &cur_val) == Success)
fprintf (stderr, " current: %d", cur_val);
fprintf (stderr, "\n");
}
XFree(attributes);
}
if (!xvport && ((xv_frequency > 0) == freq_found)) {
fprintf (stderr, "using xvport %d\n", port);
xvport = port;
}
if (xvport == port)
have_freq = freq_found;
XvEncodingInfo * encodings = 0L;
unsigned nr_encode;
XvQueryEncodings (display, port, &nr_encode, &encodings);
if (encodings) {
QDomElement port_item = doc.createElement (QString("Port"));
port_item.setAttribute (attvalue, QString::number (port));
if (freq_found)
port_item.setAttribute (QString("FREQ"), QString("1"));
for (unsigned i = 0; i < nr_encode; i++) {
if (strcmp (encodings[i].name, "XV_IMAGE")) {
if (xvport == port && xv_encoding < 0 && !xv_norm.isEmpty () && QString (encodings[i].name).lower ().startsWith(xv_norm.lower ()))
xv_encoding = encodings[i].encoding_id;
if (port == xvport && encodings[i].encoding_id == xv_encoding) {
movie_width = encodings[i].width;
movie_height = encodings[i].height;
}
QDomElement item = doc.createElement (QString ("Input"));
item.setAttribute (attvalue, QString::number (encodings[i].encoding_id));
item.setAttribute (attname, QString (encodings[i].name));
port_item.appendChild (item);
fprintf (stderr, " encoding: %d %s\n", ( int ) encodings[i].encoding_id, encodings[i].name);
}
}
elm.appendChild (port_item);
XvFreeEncodingInfo (encodings);
}
}
}
root.appendChild (elm);
XvFreeAdaptorInfo(ai);
}
doc.appendChild (root);
QCString exp = doc.toCString ();
config_buf = exp;
//fprintf (stderr, "%s\n", (const char *)exp);
config_buf.resize (exp.length ()); // strip terminating \0
if (xvport <= 0) {
fprintf (stderr, "no valid xvport found\n");
xv_success = false;
return;
}
if (window_created) {
fprintf (stderr, "map %lu\n", wid);
if (movie_width > 0 && movie_height > 0)
XResizeWindow (display, wid, movie_width, movie_height);
XMapRaised(display, wid);
XSync(display, False);
}
XUnlockDisplay(display);
if (!xv_success)
fprintf (stderr, "Failed to init %d port\n", xvport);
}
KXVideoPlayer::~KXVideoPlayer () {
if (window_created) {
XLockDisplay (display);
fprintf (stderr, "unmap %lu\n", wid);
XUnmapWindow (display, wid);
XDestroyWindow(display, wid);
XSync (display, False);
XUnlockDisplay (display);
}
xvapp = 0L;
}
void getConfigEntries (QByteArray & buf) {
QDomDocument doc;
QDomElement root = doc.createElement (QString ("document"));
doc.appendChild (root);
QCString exp = doc.toCString ();
buf = exp;
buf.resize (exp.length ()); // strip terminating \0
}
void KXVideoPlayer::play () {
fprintf (stderr, "play xv://%d:%d/%d\n", xvport, xv_encoding, xv_frequency);
if (!xv_success)
return;
if (callback && movie_width > 0 && movie_height > 0)
callback->movieParams (0, movie_width, movie_height, 1.0*movie_width/movie_height, QStringList (), QStringList ());
XLockDisplay (display);
if (!running && XvGrabPort (display, xvport, CurrentTime) == Success) {
gc = XCreateGC (display, wid, 0, NULL);
XvSelectPortNotify (display, xvport, 1);
XvSelectVideoNotify (display, wid, 1);
int nr, cur_val;
if (XvGetPortAttribute (display, xvport, xv_autopaint_colorkey_atom, &cur_val) == Success && cur_val == 0) {
fprintf (stderr, "XV_AUTOPAINT_COLORKEY is 0\n");
XvSetPortAttribute (display, xvport, xv_autopaint_colorkey_atom, 1);
reset_xv_autopaint_colorkey = true;
}
XvAttribute *attributes = XvQueryPortAttributes (display, xvport, &nr);
if (attributes) {
for (int i = 0; i < nr; i++) {
Limit * limit = 0;
Atom atom = XInternAtom (display, attributes[i].name, false);
if (atom == xv_volume_atom) {
limit = xv_limits + limit_volume;
XvGetPortAttribute (display, xvport,
xv_volume_atom, &current_volume);
} else if (atom == xv_hue_atom) {
limit = xv_limits + limit_hue;
} else if (atom == xv_saturation_atom) {
limit = xv_limits + limit_saturation;
} else if (atom == xv_brightness_atom) {
limit = xv_limits + limit_brightness;
} else if (atom == xv_contrast_atom) {
limit = xv_limits + limit_contrast;
} else
continue;
limit->min = attributes[i].min_value;
limit->max = attributes[i].max_value;
}
XFree (attributes);
}
if (xv_frequency > 0)
XvSetPortAttribute (display, xvport, xv_freq_atom, int (1.0*xv_frequency/62.5));
if (xv_encoding >= 0)
XvSetPortAttribute (display, xvport, xv_enc_atom, xv_encoding);
if (XvGetPortAttribute (display, xvport, xv_mute_atom, &cur_val) ==
Success && cur_val == 1) {
fprintf (stderr, "XV_MUTE is 1\n");
if (xv_limits[limit_volume].min != xv_limits[limit_volume].max) {
tmp_volume = xv_limits[limit_volume].min;
XvSetPortAttribute(display, xvport, xv_volume_atom, tmp_volume);
mute_timer = startTimer (start_vol_timeout);
}
XvSetPortAttribute (display, xvport, xv_mute_atom, 0);
reset_xv_mute = true;
}
//XvGetVideo (..
running = true;
}
if (running) {
putVideo ();
if (callback) {
callback->playing ();
callback->statusMessage ((int) KMPlayer::Callback::stat_hasvideo, QString ());
}
}
XUnlockDisplay (display);
}
void KXVideoPlayer::stop () {
if (mute_timer) {
killTimer (mute_timer);
mute_timer = 0;
}
if (running) {
running = false;
XLockDisplay (display);
XvStopVideo (display, xvport, wid);
if (reset_xv_autopaint_colorkey) {
XvSetPortAttribute (display, xvport, xv_autopaint_colorkey_atom, 0);
reset_xv_autopaint_colorkey = false;
}
if (reset_xv_mute) {
XvSetPortAttribute (display, xvport, xv_mute_atom, 1);
reset_xv_mute = false;
}
XvUngrabPort (display, xvport, CurrentTime);
XFreeGC (display, gc);
XClearArea (display, wid, 0, 0, 0, 0, true);
XUnlockDisplay (display);
}
if (callback)
callback->finished ();
else
QTimer::singleShot (0, qApp, SLOT (quit ()));
}
void KXVideoPlayer::finished () {
QTimer::singleShot (10, this, SLOT (stop ()));
}
void KXVideoPlayer::saturation (int val) {
XLockDisplay(display);
XvSetPortAttribute (display, xvport, xv_saturation_atom, val);
XFlush (display);
XUnlockDisplay(display);
}
void KXVideoPlayer::hue (int val) {
XLockDisplay(display);
XvSetPortAttribute (display, xvport, xv_hue_atom, val);
XFlush (display);
XUnlockDisplay(display);
}
void KXVideoPlayer::contrast (int val) {
XLockDisplay(display);
XvSetPortAttribute (display, xvport, xv_contrast_atom, val);
XFlush (display);
XUnlockDisplay(display);
}
void KXVideoPlayer::brightness (int val) {
XLockDisplay(display);
XvSetPortAttribute (display, xvport, xv_brightness_atom, val);
XFlush (display);
XUnlockDisplay(display);
}
void KXVideoPlayer::volume (int val) {
current_volume = val;
if (mute_timer)
return;
XLockDisplay(display);
XvSetPortAttribute (display, xvport, xv_volume_atom, val);
XFlush (display);
XUnlockDisplay(display);
}
void KXVideoPlayer::frequency (int val) {
// this doesn't work, changing frequency kills audio for me
if (mute_timer) {
killTimer (mute_timer);
mute_timer = 0;
}
xv_frequency = val;
if (running && have_freq) {
XLockDisplay(display);
if (xv_limits[limit_volume].min != xv_limits[limit_volume].max) {
tmp_volume = xv_limits[limit_volume].min;
XvSetPortAttribute (display, xvport, xv_volume_atom, tmp_volume);
mute_timer = startTimer (start_vol_timeout);
XFlush (display);
XvSetPortAttribute (display, xvport, xv_mute_atom, 0);
}
XvSetPortAttribute (display, xvport, xv_freq_atom, int (1.0*val/6.25));
XFlush (display);
XUnlockDisplay(display);
}
}
void KXVideoPlayer::saveState (QSessionManager & sm) {
if (callback)
sm.setRestartHint (QSessionManager::RestartNever);
}
void KXVideoPlayer::timerEvent (QTimerEvent * e) {
if (e->timerId () == mute_timer) {
int step = (current_volume - xv_limits[limit_volume].min) / 20;
if (step > 0 && tmp_volume == xv_limits[limit_volume].min) {
killTimer (mute_timer);
mute_timer = startTimer (inc_vol_timeout);
}
tmp_volume += step;
if (tmp_volume >= current_volume || step <= 0) {
tmp_volume = current_volume;
killTimer (mute_timer);
mute_timer = 0;
}
XLockDisplay(display);
XvSetPortAttribute (display, xvport, xv_volume_atom, tmp_volume);
XFlush (display);
XUnlockDisplay(display);
} else
killTimer (e->timerId ());
}
class XEventThread : public QThread {
protected:
void run () {
Time prev_click_time = 0;
int prev_click_x = 0;
int prev_click_y = 0;
while (true) {
XEvent xevent;
XNextEvent(display, &xevent);
switch(xevent.type) {
case ClientMessage:
if (xevent.xclient.format == 8 &&
!strncmp(xevent.xclient.data.b, "quit_now", 8)) {
fprintf(stderr, "request quit\n");
return;
}
break;
case KeyPress: {
XKeyEvent kevent;
KeySym ksym;
char kbuf[256];
int len;
kevent = xevent.xkey;
XLockDisplay(display);
len = XLookupString(&kevent, kbuf, sizeof(kbuf), &ksym, NULL);
XUnlockDisplay(display);
fprintf(stderr, "keypressed 0x%x 0x%x\n", ( int ) kevent.keycode, ( int ) ksym);
switch (ksym) {
case XK_q:
case XK_Q:
xvapp->lock ();
xvapp->stop ();
xvapp->unlock ();
break;
}
break;
}
case Expose:
if(xevent.xexpose.count != 0 || xevent.xexpose.window != wid)
break;
break;
case ConfigureNotify:
if (::running)
putVideo ();
break;
case XvVideoNotify:
fprintf (stderr, "xvevent %lu\n", ((XvEvent*)&xevent)->xvvideo.reason);
break;
case ButtonPress: {
XButtonEvent *bev = (XButtonEvent *) &xevent;
int dx = prev_click_x - bev->x;
int dy = prev_click_y - bev->y;
if (bev->time - prev_click_time < 400 &&
(dx * dx + dy * dy) < 25) {
xvapp->lock ();
if (callback)
callback->toggleFullScreen ();
xvapp->unlock ();
}
prev_click_time = bev->time;
prev_click_x = bev->x;
prev_click_y = bev->y;
break;
}
default:
if (xevent.type < LASTEvent) {
//fprintf (stderr, "event %d\n", xevent.type);
}
}
}
}
};
int main(int argc, char **argv) {
if (!XInitThreads ()) {
fprintf (stderr, "XInitThreads () failed\n");
return 1;
}
display = XOpenDisplay(NULL);
screen = XDefaultScreen(display);
unsigned int ver, rel, req, evb, err;
if (XvQueryExtension (display, &ver, &rel, &req, &evb, &err) != Success) {
fprintf (stderr, "XVideo not supported on display\n");
XCloseDisplay (display);
return 1;
}
xv_enc_atom = XInternAtom (display, "XV_ENCODING", false);
xv_hue_atom = XInternAtom (display, "XV_HUE", false);
xv_saturation_atom = XInternAtom (display, "XV_SATURATION", false);
xv_brightness_atom = XInternAtom (display, "XV_BRIGHTNESS", false);
xv_contrast_atom = XInternAtom (display, "XV_CONTRAST", false);
xv_freq_atom = XInternAtom (display, "XV_FREQ", false);
xv_volume_atom = XInternAtom (display, "XV_VOLUME", false);
xv_mute_atom = XInternAtom (display, "XV_MUTE", false);
xv_autopaint_colorkey_atom = XInternAtom (display, "XV_AUTOPAINT_COLORKEY", false);
xvapp = new KXVideoPlayer (argc, argv);
for(int i = 1; i < argc; i++) {
if (!strcmp (argv [i], "-port")) {
xvport = strtol (argv [++i], 0L, 10);
} else if (!strcmp (argv [i], "-wid") || !strcmp (argv [i], "-window-id")) {
wid = atol (argv [++i]);
window_created = false;
} else if (!strcmp (argv [i], "-root")) {
wid = XDefaultRootWindow (display);
window_created = false;
} else if (!strcmp (argv [i], "-window")) {
;
} else if (!strcmp (argv [i], "-v")) {
verbose = true;
} else if (!strcmp (argv [i], "-c")) {
wants_config = true;
} else if (!strcmp (argv [i], "-f") && i < argc - 1) {
strncpy (configfile, argv [++i], sizeof (configfile));
configfile[sizeof (configfile) - 1] = 0;
} else if (!strcmp (argv [i], "-cb")) {
QString str = argv [++i];
int pos = str.find ('/');
if (pos > -1) {
fprintf (stderr, "callback is %s %s\n", str.left (pos).ascii (), str.mid (pos + 1).ascii ());
callback = new KMPlayer::Callback_stub
(str.left (pos).ascii (), str.mid (pos + 1).ascii ());
}
} else if (!strcmp (argv [i], "-enc")) {
xv_encoding = strtol (argv [++i], 0L, 10);
} else if (!strcmp (argv [i], "-norm")) {
xv_norm = argv [++i];
} else if (!strcmp (argv [i], "-freq")) {
xv_frequency = strtol (argv [++i], 0L, 10);
} else {
fprintf (stderr, "usage: %s [-port <xv port>] [-enc <encoding>] [-freq <frequency>] [-f <config file>] [-v] [(-wid|-window-id) <window>] [(-root|-window)] [-cb <DCOP callback name> [-c]]\n", argv[0]);
delete xvapp;
return 1;
}
}
DCOPClient dcopclient;
dcopclient.registerAs ("kxvideoplayer");
Backend player;
XEventThread * eventThread = new XEventThread;
eventThread->start ();
xvapp->init ();
if (callback)
callback->started (dcopclient.appId (), config_buf);
xvapp->exec ();
XLockDisplay(display);
XClientMessageEvent ev = {
ClientMessage, 0, true, display, wid,
XInternAtom (display, "XVIDEO", false), 8, {"quit_now"}
};
XSendEvent (display, wid, false, StructureNotifyMask, (XEvent *) & ev);
XFlush (display);
XUnlockDisplay(display);
eventThread->wait (500);
delete eventThread;
xvapp->stop ();
delete xvapp;
fprintf (stderr, "closing display\n");
XCloseDisplay (display);
fprintf (stderr, "done\n");
return 0;
}
#include "xvplayer.moc"

@ -0,0 +1,56 @@
/* This file is part of the KMPlayer application
Copyright (C) 2004 Koos Vriezen <koos.vriezen@xs4all.nl>
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 2 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; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _K_XV_PLAYER_H_
#define _K_XV_PLAYER_H_
#include <qapplication.h>
#include <qstring.h>
#include <qsessionmanager.h>
class KXVideoPlayer : public QApplication {
Q_OBJECT
public:
KXVideoPlayer (int argc, char ** argv);
~KXVideoPlayer ();
void init ();
void finished ();
void saturation (int val);
void hue (int val);
void contrast (int val);
void brightness (int val);
void volume (int val);
void frequency (int val);
//void seek (int val);
//bool event (QEvent * e);
public slots:
void play ();
void stop ();
//void pause ();
//void updatePosition ();
//void postFinished ();
protected:
void saveState (QSessionManager & sm);
void timerEvent (QTimerEvent *);
private:
int mute_timer;
};
#endif //_K_XV_PLAYER_H_

@ -0,0 +1,6 @@
doc
icons
mimetypes
po
protocols
src

@ -0,0 +1,107 @@
<!-- test for moving a region with the animate element -->
<smil>
<head>
<layout>
<root-layout width="400" height="300" background-color="green"/>
<region id="region1" left="5%" top="10%" right="5%" bottom="10%"/>
<region id="region2" left="5%" top="10%" width="20%" height="20%"
background-color="yellow" showBackground="whenActive"/>
<region id="regimg1"/>
</layout>
<transition id="fade1" dur="1" type="fade"/>
</head>
<body>
<par>
<img dur="40" id="img" src="../icons/hi48-app-kmplayer.png"
region="regimg1" left="25" top="10" rn:mediaOpacity="40%"
transIn="fade1" transOut="fade1"/>
<animateMotion target="img" dur="20" calcMode="spline" repeat="1"
values="25,10;300,45;25,85;300,125;25,165;300,205;25,80;25,10"
keyTimes="0;.1;.2;.4;.6;.8;.9;1"
keySplines=".5 0 .5 1;0 .75 .25 1;0 .75 .25 1;.5 0 .5 1;.5 0 .5 1;0 .75 .25 1;.5 0 .5 1"/>
<par begin="2">
<img dur="40" id="img2" src="../icons/hi48-app-kmplayer.png"
region="regimg1" left="25" top="10" rn:mediaOpacity="40%"
transIn="fade1" transOut="fade1"/>
<animateMotion target="img2" dur="20" calcMode="spline" repeat="1"
values="25,10;300,45;25,85;300,125;25,165;300,205;25,80;25,10"
keyTimes="0;.1;.2;.4;.6;.8;.9;1"
keySplines=".5 0 .5 1;0 .75 .25 1;0 .75 .25 1;.5 0 .5 1;.5 0 .5 1;0 .75 .25 1;.5 0 .5 1"/>
</par>
<par begin="4">
<img dur="40" id="img3" src="../icons/hi48-app-kmplayer.png"
region="regimg1" left="25" top="10" rn:mediaOpacity="40%"
transIn="fade1" transOut="fade1"/>
<animateMotion target="img3" dur="20" calcMode="spline" repeat="1"
values="25,10;300,45;25,85;300,125;25,165;300,205;25,80;25,10"
keyTimes="0;.1;.2;.4;.6;.8;.9;1"
keySplines=".5 0 .5 1;0 .75 .25 1;0 .75 .25 1;.5 0 .5 1;.5 0 .5 1;0 .75 .25 1;.5 0 .5 1"/>
</par>
<seq>
<par>
<text id="text1" src="data:,8,8%20animateMotion%20by%2032x32%20and%20back"
region="region1" left="8" top="8" dur="5"/>
<animateMotion target="text1" begin="1" dur=".5" by="32,32"/>
<animateMotion target="text1" begin="3" dur=".5" by="-32,-32"/>
</par>
<par>
<text id="text2" src="data:,20%25,75%25%0AanimateMotion%0Ato%2040%25,20%25%0Aback%20to%20150,20"
region="region1" left="20%" top="75%" dur="5"/>
<animateMotion target="text2" begin="1" dur=".5" to="40%,20%"/>
<animateMotion target="text2" begin="3" dur=".5" to="150,20"/>
</par>
<par>
<text id="text3" src="data:,8,8%0AanimateMotion%0Afrom%2040%25,20%25%0Aby%2040%25,-20%25"
region="region1" left="8" top="8" dur="3"/>
<animateMotion target="text3" begin="1" dur=".5"
from="20%,75%" by="40%,-20%"/>
</par>
<par>
<text id="text4" src="data:,8,8%0AanimateMotion%0Afrom%2010,150%0Ato%20150,10"
region="region1" left="8" top="8" dur="3"/>
<animateMotion target="text4" begin="1" dur=".5"
from="10,150" to="150,10"/>
</par>
<par>
<text id="text6" src="data:,lineair%20animateMotion%0Avalues%2020,20;150,5;160,160"
region="region1" left="8" top="8" dur="5"/>
<animateMotion target="text6" begin="2" dur="2"
values="20,20;150,5;160,170"/>
</par>
<par>
<text id="text7" src="data:,lineair%20animateMotion%0Avalues%2020,20;160,35;140,160%0AkeyTimes0;0.8;1"
region="region1" left="8" top="8" dur="5"/>
<animateMotion target="text7" begin="2" dur="2"
values="20,20;160,35;140,160" keyTimes="0;0.8;1"/>
</par>
<par>
<text id="text8" src="data:,spline%20animateMotion%0Avalues%2020,20;160,35;140,160%0AkeyTimes0;0.5;1%0AkeySplines%20.5%200%20.5%201;0%20.75%20.25%201"
region="region1" left="8" top="8" dur="5"/>
<animateMotion target="text8" begin="1" dur="3" calcMode="spline"
values="20,20;160,35;140,160"
keyTimes="0;0.5;1"
keySplines=".5 0 .5 1;0 .75 .25 1"/>
</par>
<par>
<text id="text9" src="data:,discrete%20animateMotion%0Avalues%2020,20;160,35;140,160%0AkeyTimes0;0.5;1"
region="region1" left="8" top="8" dur="5"/>
<animateMotion target="text9" begin="1" dur="3" calcMode="discrete"
values="20,20;160,35;140,160"
keyTimes="0;0.5;1"/>
</par>
<par>
<text regPoint="center" regAlign="center" id="text5" src="data:,animateMotion%20on%20region"
region="region2" dur="10"/>
<animateMotion target="region2" begin="1" dur="2" calcMode="spline"
from="5%,10%" to="55%, 15%" keySplines=".5 0 .5 1"/>
<animateMotion target="region2" begin="3" dur="2" calcMode="spline"
to="65%,60%" keySplines=".5 0 .5 1"/>
<animateMotion target="region2" begin="5" dur="2" calcMode="spline"
by="-45%,10%" keySplines=".5 0 .5 1"/>
<animateMotion target="region2" begin="7" dur="2" calcMode="spline"
from="20%,70%" by="-15%,-60%" keySplines="1 0 0 1"/>
</par>
</seq>
</par>
</body>
</smil>

@ -0,0 +1,29 @@
<html>
<body>
<table>
<tr>
<td COLSPAN=2>
<embed SRC="excl_timings.smil" TYPE="audio/x-pn-realaudio" WIDTH=320 HEIGHT=240 CONTROLS=ImageWindow CONSOLE=one AUTOSTART=true></embed>
</td>
<td>
<embed WIDTH=240 HEIGHT=240 TYPE="audio/x-pn-realaudio" CONTROLS=PlayList CONSOLE=one AUTOSTART=true></embed>
</td>
</tr>
<tr>
<td>
<embed WIDTH=160 HEIGHT=16 TYPE="audio/x-pn-realaudio" CONTROLS=PlayButton CONSOLE=one AUTOSTART=true></embed>
</td>
<td>
<embed WIDTH=160 HEIGHT=16 TYPE="audio/x-pn-realaudio" CONTROLS=VolumeSlider CONSOLE=one AUTOSTART=true></embed>
</td>
<td>
<embed WIDTH=240 HEIGHT=55 TYPE="audio/x-pn-realaudio" CONTROLS=InfoPanel CONSOLE=one AUTOSTART=true></embed>
</td>
</tr>
<tr>
<td COLSPAN=3>
<embed WIDTH=560 HEIGHT=16 TYPE="audio/x-pn-realaudio" CONTROLS=StatusBar CONSOLE=one AUTOSTART=true></embed>
</table>
<embed SRC="img_scale.smil" WIDTH=320 HEIGHT=240 TYPE="audio/x-pn-realaudio" CONTROLS=All CONSOLE=two AUTOSTART=true></embed>
</body>
</html>

@ -0,0 +1,84 @@
<smil>
<head>
<meta name="title" content="excl group test"/>
<layout>
<root-layout width="320" height="240" background-color="yellow"/>
<region id="reg_but1" left="5" top="15" width="80" height="30" background-color="red"/>
<region id="reg_but2" left="5" top="55" width="80" height="30" background-color="red"/>
<region id="reg_but3" left="5" top="95" width="80" height="30" background-color="red"/>
<region left="5" top="135" width="80" height="40">
<region id="reg_text" left="5" top="0" width="70" height="18""/>
<region id="reg_ext" left="5" top="22" width="30" height="18""/>
<region id="reg_int" left="45" top="22" width="30" height="18"/>
</region>
<region id="reg_but4" left="5" top="185" width="80" height="30" background-color="red"/>
<region left="95" top="15" width="210" height="210" background-color="blue">
<region id="reg_img" left="5" top="5" width="64" height="24" background-color="orange"/>
</region>
</layout>
</head>
<body>
<par end="but4.activateEvent">
<text src="data:,Horizontal" id="but1" region="reg_but1" fill="freeze">
<param name="fontColor" value="yellow"/>
<param name="fontSize" value="+1"/>
<param name="backgroundColor" value="blue"/>
</text>
<set targetElement="but1" attributeName="backgroundColor" to="red" begin="but1.activateEvent" dur="0.1"/>
<text src="data:,Vertical" id="but2" region="reg_but2" fill="freeze">
<param name="fontColor" value="yellow"/>
<param name="fontSize" value="+1"/>
<param name="backgroundColor" value="blue"/>
</text>
<set targetElement="but2" attributeName="backgroundColor" to="red" begin="but2.activateEvent" dur="0.1"/>
<text src="data:,Diagonal" id="but3" region="reg_but3" fill="freeze">
<param name="fontColor" value="yellow"/>
<param name="fontSize" value="+1"/>
<param name="backgroundColor" value="blue"/>
</text>
<set targetElement="but3" attributeName="backgroundColor" to="red" begin="but3.activateEvent" dur="0.1"/>
<text src="data:,Repeat" id="but_rep" region="reg_text" fill="freeze">
<param name="backgroundColor" value="cyan"/>
</text>
<text src="data:,Ext" id="but_ext" region="reg_ext" fill="freeze">
<param name="backgroundColor" value="green"/>
<param name="fontColor" value="white"/>
</text>
<text src="data:,Int" id="but_int" region="reg_int" fill="freeze">
<param name="backgroundColor" value="green"/>
<param name="fontColor" value="white"/>
</text>
<excl>
<set targetElement="but_ext" attributeName="backgroundColor" to="red"
begin="0" dur="indefinite"/>
<set targetElement="but_ext" attributeName="backgroundColor" to="red"
begin="but_ext.activateEvent" dur="indefinite"/>
<set targetElement="but_int" attributeName="backgroundColor" to="red"
begin="but_int.activateEvent" dur="indefinite"/>
</excl>
<excl>
<set targetElement="vid" attributeName="src" to="img_scale_rep.smil"
begin="but_ext.activateEvent" dur="indefinite"/>
<set targetElement="vid" attributeName="src" to="img_scale.smil"
begin="but_int.activateEvent" dur="indefinite"/>
</excl>
<text src="data:,Stop" id="but4" region="reg_but4" fill="freeze">
<param name="fontColor" value="green"/>
<param name="fontSize" value="+1"/>
<param name="backgroundColor" value="red"/>
</text>
<video src="img_scale_rep.smil" id="vid" region="reg_img" fill="freeze" fit="meet" repeatCount="indefinite"/>
<excl dur="indefinite">
<animateMotion targetElement="reg_img" from="5,5" to="140,5"
begin="but1.activateEvent" dur="2" fill="freeze"
calcMode="spline" keySplines="0 .75 .25 1"/>
<animateMotion targetElement="reg_img" from="5,5" to="5,180"
begin="reg_but2.activateEvent" dur="2" fill="freeze"
calcMode="spline" keySplines="0.75 0 1 0.25"/>
<animateMotion targetElement="reg_img" from="5,5" to="140,180"
begin="reg_but3.activateEvent" dur="2" fill="freeze"
calcMode="spline" keySplines=".5 0 .5 1"/>
</excl>
</par>
</body>
</smil>

@ -0,0 +1,8 @@
<imfl>
<head duration="10" width="320" height="240"/>
<image handle="1" name="../icons/hi128-app-kmplayer.png"/>
<fill start="0" color="yellow"/>
<fadein start="1" duration="1" target="1" dstx="96" dsty="56"
dstw="128" dsth="128"/>
<fadeout start="4" duration="1" color="yellow"/>
</imfl>

@ -0,0 +1,27 @@
<smil>
<head>
<layout>
<root-layout width="640" height="240" background-color="yellow"/>
<region id="reg_img1" left="5" top="15" width="150" height="210" background-color="red"/>
<region id="reg_img2" left="165" top="15" width="150" height="210" background-color="white"/>
<region id="reg_img3" left="325" top="15" width="150" height="210" background-color="blue"/>
<region id="reg_img4" left="485" top="15" width="150" height="210" background-color="orange"/>
</layout>
</head>
<body>
<par dur="2.5">
<img src="../icons/hi128-app-kmplayer.png" region="reg_img1" fit="fill" fill="freeze"/>
<img src="../icons/hi128-app-kmplayer.png" region="reg_img2" fit="hidden" fill="freeze"/>
<img src="../icons/hi128-app-kmplayer.png" region="reg_img3" fit="meet" fill="freeze"/>
<img src="../icons/hi128-app-kmplayer.png" region="reg_img4" fit="slice" fill="freeze"/>
<set targetElement="reg_img1" attributeName="width" to="75" begin="0.5s" dur="1s"/>
<set targetElement="reg_img2" attributeName="width" to="75" begin="0.5s" dur="1s"/>
<set targetElement="reg_img3" attributeName="width" to="75" begin="0.5s" dur="1s"/>
<set targetElement="reg_img4" attributeName="width" to="75" begin="0.5s" dur="1s"/>
<set targetElement="reg_img1" attributeName="height" to="75" begin="1s" dur="1s"/>
<set targetElement="reg_img2" attributeName="height" to="75" begin="1s" dur="1s"/>
<set targetElement="reg_img3" attributeName="height" to="75" begin="1s" dur="1s"/>
<set targetElement="reg_img4" attributeName="height" to="75" begin="1s" dur="1s"/>
</par>
</body>
</smil>

@ -0,0 +1,27 @@
<smil>
<head>
<layout>
<root-layout width="640" height="240" background-color="yellow"/>
<region id="reg_img1" left="5" top="15" width="150" height="210" background-color="green"/>
<region id="reg_img2" left="165" top="15" width="150" height="210" background-color="grey"/>
<region id="reg_img3" left="325" top="15" width="150" height="210" background-color="yellow"/>
<region id="reg_img4" left="485" top="15" width="150" height="210" background-color="purple"/>
</layout>
</head>
<body>
<par dur="2.5" repeatCount="indefinite">
<img src="../icons/hi64-app-kmplayer.png" region="reg_img1" fit="fill" fill="freeze"/>
<img src="../icons/hi64-app-kmplayer.png" region="reg_img2" fit="hidden" fill="freeze"/>
<img src="../icons/hi64-app-kmplayer.png" region="reg_img3" fit="meet" fill="freeze"/>
<img src="../icons/hi64-app-kmplayer.png" region="reg_img4" fit="slice" fill="freeze"/>
<set targetElement="reg_img1" attributeName="width" to="75" begin="0.5s" dur="1s"/>
<set targetElement="reg_img2" attributeName="width" to="75" begin="0.5s" dur="1s"/>
<set targetElement="reg_img3" attributeName="width" to="75" begin="0.5s" dur="1s"/>
<set targetElement="reg_img4" attributeName="width" to="75" begin="0.5s" dur="1s"/>
<set targetElement="reg_img1" attributeName="height" to="75" begin="1s" dur="1s"/>
<set targetElement="reg_img2" attributeName="height" to="75" begin="1s" dur="1s"/>
<set targetElement="reg_img3" attributeName="height" to="75" begin="1s" dur="1s"/>
<set targetElement="reg_img4" attributeName="height" to="75" begin="1s" dur="1s"/>
</par>
</body>
</smil>

@ -0,0 +1,32 @@
<smil>
<head>
<layout>
<root-layout width="640" height="240"/>
<region id="reg_img" >
<region id="reg_text1" left="10%" top="25%" right="60%" bottom="25%"/>
<region id="reg_vid" left="55%" top="5%" right="5%" bottom="60%" background-color="DarkBlue"/>
<region id="reg_button1" left="446" top="202" width="130" height="26" z-index="2" background-color="LightGray"/>
<region id="reg_button2" left="446" top="202" width="132" height="28" z-index="1" background-color="DarkGray"/>
<region id="reg_text2" left="448" top="204" width="128" height="24" z-index="3"/>
</region>
</layout>
</head>
<body>
<par end="text2.activateEvent">
<img src="../icons/hi128-app-kmplayer.png" region="reg_img" fit="fill" fill="freeze"/>
<text src="some_text.html" region="reg_text1" begin="3" dur="5">
<param name="charset" value="iso-8859-1"/>
<param name="fontFace" value="System"/>
<param name="fontColor" value="yellow"/>
<param name="fontSize" value="+1"/>
<param name="backgroundColor" value="blue"/>
</text>
<video src="file:///home/koos/doc/example.avi" fit="meet" id="video1" region="reg_vid" begin="3"/>
<text src="data:,Stop" id="text2" region="reg_text2" fill="freeze">
<param name="backgroundColor" value="gray"/>
</text>
<set targetElement="reg_button1" attributeName="background-color" to="DarkGray" begin="reg_text2.inBoundsEvent" end="reg_text2.outOfBoundsEvent"/>
<set targetElement="reg_button2" attributeName="background-color" to="LightGray" begin="reg_text2.inBoundsEvent" end="reg_text2.outOfBoundsEvent"/>
</par>
</body>
</smil>

@ -0,0 +1,25 @@
<smil>
<head>
<layout>
<root-layout width="320" height="260"/>
<region id="nested_smil" left="0" top="0" right="0" height="240"/>
<region id="nested_but1" left="0" top="240" width="160" height="20" background-color="LightGray"/>
<region id="nested_but2" left="160" top="240" width="160" height="20" background-color="Orange"/>
</layout>
</head>
<body>
<par>
<excl>
<text src="data:,Start" id="text1" region="nested_but1" dur="indefinite" fill="freeze">
</text>
<video src="excl_timings.smil" id="video1" region="nested_smil" begin="nested_but1.activateEvent"/>
</excl>
<text src="data:,Change%20Source" id="text2" region="nested_but2" dur="indefinite" fill="freeze">
<param name="backgroundColor" value="orange"/>
<param name="fontColor" value="black"/>
</text>
<set target="video1" attribute="src" to="img_scale.smil" begin="nested_but2.activateEvent" dur="15"/>
<set target="text2" attribute="fontColor" to="gray" begin="nested_but2.activateEvent" dur="15"/>
</par>
</body>
</smil>

@ -0,0 +1,37 @@
<!-- test for timing for 'par' tags -->
<smil>
<head>
<layout>
<root-layout width="320" height="240" background-color="green"/>
<region id="region1" left="5%" top="10%" right="5%" bottom="50%" z-index="2"/>
<region id="region2" left="25%" top="60%" right="10%" bottom="5%" z-index="3" background-color="red"/>
<region id="region3" z-index="4"/>
</layout>
</head>
<body>
<par id="par1" end="text1.inBoundsEvent">
<set target="par1" attribute="title" to="Mouse Inbound" fill="freeze"/>
<text id="text1" src="data:,par%20end%3Dtext1.inBoundsEvent%0D%0Atext%20dur%3Dindefinite%0D%0Amove%20here%20to%20end%20'par'" region="region1" dur="indefinite"/>
<text src="data:,dur%3D5s" region="region2" dur="5"/>
</par>
<par endsync="text2">
<text id="text2" src="data:,par%20endsync%3Dtext2%0D%0Atext%20dur%3D7s" region="region1" dur="7s"/>
<text src="data:,dur%3D5" region="region2" dur="5"/>
</par>
<par dur="7s">
<text src="data:,par%20dur%3D7s%0D%0Atext%20dur%3Dindefinite" region="region1" dur="indefinite"/>
<par begin="1">
<text src="data:,nested%20par%20begin%3D1%0D%0Atext%20dur%3D5" region="region2" dur="5"/>
</par>
</par>
<par end="7s">
<text src="data:,par%20end%3D7s%0D%0Atext%20dur%3Dindefinite" region="region1" dur="indefinite"/>
<text src="data:,dur%3D5" region="region2" dur="5"/>
</par>
<par>
<text src="data:,par%20no%20dur%20set%0D%0Atext%20dur%3D7" region="region1" dur="7"/>
<text src="data:,dur%3D5" region="region2" dur="5"/>
</par>
<text src="data:,that's%20all%20folks" title="Carrot time" region="region3" dur="2s" backgroundColor="black" fontColor="white"/>
</body>
</smil>

@ -0,0 +1,40 @@
<!-- test for moving a region with the animate element -->
<smil>
<head>
<layout>
<root-layout width="320" height="240" background-color="green"/>
<region id="region1" left="5%" top="10%" right="30%" bottom="50%" z-index="2"/>
<region id="region2" left="240" top="140" width="64" height="64" z-index="3" background-color="red"/>
<region id="region3" z-index="1"/>
</layout>
</head>
<body>
<par>
<text id="text1" src="data:,I'm%20a%20region" region="region1">
<param name="fontColor" value="yellow"/>
<param name="fontPtSize" value="10"/>
<param name="backgroundColor" value="blue"/>
<animate target="text1" attributeName="fontPtSize" calcMode="discrete" values="10;12;14;16;18;20;22;24;26;28;300" begin="5" dur="6"/>
</text>
<img id="image1" src="../icons/hi48-app-kmplayer.png" region="region2" left="8">
<animate target="region2" attributeName="background-color" values="red;white;blue" repeatCount="10" calcMode="discrete" dur="1.5"/>
</img>
<text src="data:,Move%20a%20region" region="region2" fill="freeze" top="48">
<param name="fontPtSize" value="6"/>
</text>
<animate target="region2" attributeName="left" from="240" to="10" begin="5" dur="5"/>
</par>
<par>
<set target="region2" attributeName="z-index" to="6" fill="freeze"/>
<set target="region2" attributeName="left" to="20" fill="freeze"/>
<set target="region2" attributeName="width" to="200" fill="freeze"/>
<set target="region3" attributeName="background-color" to="black" fill="freeze"/>
<set target="region3" attributeName="z-index" to="5" fill="freeze"/>
<text src="data:,that's%20all%20folks" region="region2" dur="2">
<param name="fontColor" value="green"/>
<param name="fontSize" value="+2"/>
<param name="backgroundColor" value="black"/>
</text>
</par>
</body>
</smil>

@ -0,0 +1,115 @@
<!-- test for mouse events -->
<smil>
<head>
<layout>
<root-layout width="320" height="240" background-color="orange"/>
<region id="reg1" left="5%" top="10%" right="60%" bottom="50%"
background-color="blue">
<region id="reg1_1" left="10%" top="30%" right="10%" bottom="30%"/>
</region>
<region id="reg2" left="60%" top="10%" right="5%" bottom="50%"
background-color="blue">
<region id="reg2_1" left="5%" top="30%" right="10%" bottom="30%"/>
</region>
<region id="reg1_txt" left="5%" top="55%" width="15%" bottom="35%"/>
<region id="reg1_click" left="5%" top="65%" width="15%" bottom="25%"
background-color="red"/>
<region id="reg1_enter" left="5%" top="75%" width="15%" bottom="15%"
background-color="red"/>
<region id="reg1_leave" left="5%" top="85%" width="15%" bottom="5%"
background-color="red"/>
<region id="reg1_1_txt" left="25%" top="55%" width="15%" bottom="35%"/>
<region id="reg1_1_click" left="25%" top="65%" width="15%" bottom="25%"
background-color="red"/>
<region id="reg1_1_enter" left="25%" top="75%" width="15%" bottom="15%"
background-color="red"/>
<region id="reg1_1_leave" left="25%" top="85%" width="15%" bottom="5%"
background-color="red"/>
<region id="reg2_txt" left="60%" top="55%" width="15%" bottom="35%"/>
<region id="reg2_click" left="60%" top="65%" width="15%" bottom="25%"
background-color="red"/>
<region id="reg2_enter" left="60%" top="75%" width="15%" bottom="15%"
background-color="red"/>
<region id="reg2_leave" left="60%" top="85%" width="15%" bottom="5%"
background-color="red"/>
<region id="reg2_1_txt" left="80%" top="55%" width="15%" bottom="35%"/>
<region id="reg2_1_click" left="80%" top="65%" width="15%" bottom="25%"
background-color="red"/>
<region id="reg2_1_enter" left="80%" top="75%" width="15%" bottom="15%"
background-color="red"/>
<region id="reg2_1_leave" left="80%" top="85%" width="15%" bottom="5%"
background-color="red"/>
</layout>
</head>
<body>
<par dur="50">
<text id="text1" src="data:,Opaque%20child" region="reg1_1" fill="freeze">
<param name="backgroundColor" value="yellow"/>
</text>
<text id="text2" src="data:,Transparent%20child" region="reg2_1"
fill="freeze" sensitivity="transparent">
<param name="backgroundColor" value="yellow"/>
</text>
<text src="data:,Outer" region="reg1_txt" fill="freeze"
rn:backgroundOpacity="0%"/>
<text id="text1_click" src="data:,Clicked" region="reg1_click"
fill="freeze" rn:backgroundOpacity="0%"/>
<text id="text1_enter" src="data:,Entered" region="reg1_enter"
fill="freeze" rn:backgroundOpacity="0%"/>
<text id="text1_leave" src="data:,Leaved" region="reg1_leave"
fill="freeze" rn:backgroundOpacity="0%"/>
<text src="data:,Inner" region="reg1_1_txt" fill="freeze"
rn:backgroundOpacity="0%"/>
<text id="text1_1_click" src="data:,Clicked" region="reg1_1_click"
fill="freeze" rn:backgroundOpacity="0%"/>
<text id="text1_1_enter" src="data:,Entered" region="reg1_1_enter"
fill="freeze" rn:backgroundOpacity="0%"/>
<text id="text1_1_leave" src="data:,Leaved" region="reg1_1_leave"
fill="freeze" rn:backgroundOpacity="0%"/>
<text src="data:,Outer" region="reg2_txt" fill="freeze"
rn:backgroundOpacity="0%"/>
<text id="text2_click" src="data:,Clicked" region="reg2_click"
fill="freeze" rn:backgroundOpacity="0%"/>
<text id="text2_enter" src="data:,Entered" region="reg2_enter"
fill="freeze" rn:backgroundOpacity="0%"/>
<text id="text2_leave" src="data:,Leaved" region="reg2_leave"
fill="freeze" rn:backgroundOpacity="0%"/>
<text src="data:,Inner" region="reg2_1_txt" fill="freeze"
rn:backgroundOpacity="0%"/>
<text id="text2_1_click" src="data:,Clicked" region="reg2_1_click"
fill="freeze" rn:backgroundOpacity="0%"/>
<text id="text2_1_enter" src="data:,Entered" region="reg2_1_enter"
fill="freeze" rn:backgroundOpacity="0%"/>
<text id="text2_1_leave" src="data:,Leaved" region="reg2_1_leave"
fill="freeze" rn:backgroundOpacity="0%"/>
<set target="reg1_click" attribute="background-color" to="green"
begin="reg1.activateEvent" dur="1"/>
<set target="reg1_enter" attribute="background-color" to="green"
begin="reg1.inBoundsEvent" end="reg1.outOfBoundsEvent"/>
<set target="reg1_leave" attribute="background-color" to="green"
end="reg1.inBoundsEvent" begin="reg1.outOfBoundsEvent"/>
<set target="reg1_1_click" attribute="background-color" to="green"
begin="reg1_1.activateEvent" dur="1"/>
<set target="reg1_1_enter" attribute="background-color" to="green"
begin="reg1_1.inBoundsEvent" end="reg1_1.outOfBoundsEvent"/>
<set target="reg1_1_leave" attribute="background-color" to="green"
end="reg1_1.inBoundsEvent" begin="reg1_1.outOfBoundsEvent"/>
<set target="reg2_click" attribute="background-color" to="green"
begin="reg2.activateEvent" dur="1"/>
<set target="reg2_enter" attribute="background-color" to="green"
begin="reg2.inBoundsEvent" end="reg2.outOfBoundsEvent"/>
<set target="reg2_leave" attribute="background-color" to="green"
end="reg2.inBoundsEvent" begin="reg2.outOfBoundsEvent"/>
<set target="reg2_1_click" attribute="background-color" to="green"
begin="reg2_1.activateEvent" dur="1"/>
<set target="reg2_1_enter" attribute="background-color" to="green"
begin="reg2_1.inBoundsEvent" end="reg2_1.outOfBoundsEvent"/>
<set target="reg2_1_leave" attribute="background-color" to="green"
end="reg2_1.inBoundsEvent" begin="reg2_1.outOfBoundsEvent"/>
</par>
</body>
</smil>

@ -0,0 +1,53 @@
<smil>
<head>
<layout>
<region id="img1" left="0" top="5" width="48" height="48" background-color="blue" z-index="2" />
<region id="img2" left="50" top="5" width="48" height="48" background-color="blue" z-index="2" />
<region id="img3" left="100" top="5" width="48" height="48" background-color="blue" z-index="2" />
<region id="img4" left="150" top="5" width="48" height="48" background-color="blue" z-index="2" />
<region id="img5" left="200" top="5" width="48" height="48" background-color="blue" z-index="2" />
<region id="img6" left="250" top="5" width="48" height="48" background-color="blue" z-index="2" />
<region id="img7" left="300" top="5" width="48" height="48" background-color="blue" z-index="2" />
<region id="img8" left="350" top="5" width="48" height="48" background-color="blue" z-index="2" />
<region id="img9" left="400" top="5" width="48" height="48" background-color="blue" z-index="2" />
<region id="img10" left="0" top="55" width="48" height="48" background-color="blue" z-index="2" />
<region id="img11" left="50" top="55" width="48" height="48" background-color="blue" z-index="2" />
<region id="img12" left="100" top="55" width="48" height="48" background-color="blue" z-index="2" />
<region id="img13" left="150" top="55" width="48" height="48" background-color="blue" z-index="2" />
<region id="img14" left="200" top="55" width="48" height="48" background-color="blue" z-index="2" />
<region id="img15" left="250" top="55" width="48" height="48" background-color="blue" z-index="2" />
<region id="img16" left="300" top="55" width="48" height="48" background-color="blue" z-index="2" />
<region id="img17" left="350" top="55" width="48" height="48" background-color="blue" z-index="2" />
<region id="img18" left="400" top="55" width="48" height="48" background-color="blue" z-index="2" />
<region id="region_end" z-index="1"/>
<regPoint id="north_north_west" top="20" left="40"/>
<regPoint id="north_west" top="20" left="20" regAlign="midLeft"/>
<root-layout background-color="white" width="450" height="240"/>
</layout>
</head>
<body>
<par dur="10">
<img src="../icons/hi48-app-kmplayer.png" region="img1" regPoint="center" regAlign="topLeft" fill="freeze"/>
<img src="../icons/hi48-app-kmplayer.png" region="img2" regPoint="center" regAlign="midLeft" fill="freeze"/>
<img src="../icons/hi48-app-kmplayer.png" region="img3" regPoint="center" regAlign="bottomLeft" fill="freeze"/>
<img src="../icons/hi48-app-kmplayer.png" region="img4" regPoint="center" regAlign="topMid" fill="freeze"/>
<img src="../icons/hi48-app-kmplayer.png" region="img5" regPoint="center" regAlign="center" fill="freeze"/>
<img src="../icons/hi48-app-kmplayer.png" region="img6" regPoint="center" regAlign="bottomMid" fill="freeze"/>
<img src="../icons/hi48-app-kmplayer.png" region="img7" regPoint="center" regAlign="topRight" fill="freeze"/>
<img src="../icons/hi48-app-kmplayer.png" region="img8" regPoint="center" regAlign="midRight" fill="freeze"/>
<img src="../icons/hi48-app-kmplayer.png" region="img9" regPoint="center" regAlign="bottomRight" fill="freeze"/>
<img src="../icons/hi48-app-kmplayer.png" region="img10" regPoint="north_north_west" regAlign="topLeft" fill="freeze"/>
<img src="../icons/hi48-app-kmplayer.png" region="img11" regPoint="north_west" fill="freeze"/>
<img src="../icons/hi48-app-kmplayer.png" region="img12" regPoint="north_west" regAlign="topLeft" fill="freeze"/>
</par>
<par>
<set target="region_end" attributeName="background-color" to="black" fill="freeze"/>
<set target="region_end" attributeName="z-index" to="3" fill="freeze"/>
<text src="data:,that's%20all%20folks" region="region_end" dur="2" left="20%" top="40%">
<param name="fontColor" value="green"/>
<param name="fontSize" value="+2"/>
<param name="backgroundColor" value="black"/>
</text>
</par>
</body>
</smil>

@ -0,0 +1,13 @@
<smil>
<head>
<layout>
<root-layout width="320" height="240" background-color="red"/>
<region left="5" top="15" width="160" height="120" background-color="blue">
<region id="img1" left="5" top="5" right="5" bottom="5"/>
</region>
</layout>
</head>
<body>
<img region="img1" fit="meet" src="fade.rp"/>
</body>
</smil>

@ -0,0 +1,6 @@
excl_timings.smil
img_scale.smil
img_video_text.smil
par_timings.smil
region_animate.smil
region_mouse_events.smil

@ -0,0 +1,6 @@
<html>
<body>
<h1>Title</h1>
Some <font color="red">text</font> for <b>reading</b>
</body>
</html>

@ -0,0 +1,40 @@
<!-- test for moving a region with the animate element -->
<smil>
<head>
<layout>
<root-layout width="640" height="480" background-color="green"/>
<region id="region1" left="7%" top="10%" width="24%" height="10%" z-index="1" background-color="pink" showBackground="whenActive"/>
<region id="region2" left="38%" top="10%" width="24%" height="10%" z-index="2" background-color="yellow" showBackground="whenActive"/>
<region id="region3" left="69%" top="10%" width="24%" height="10%" z-index="3" background-color="cyan" showBackground="whenActive"/>
<region id="region4" left="25%" top="10%" width="50%" height="80%" z-index="4"/>
</layout>
</head>
<body>
<par dur="5">
<text id="text1" src="data:,Left Align" region="region1">
<param name="fontColor" value="blue"/>
<param name="fontPtSize" value="12"/>
</text>
<text id="text2" src="data:,Center Align" region="region2">
<param name="fontColor" value="blue"/>
<param name="fontPtSize" value="12"/>
<param name="hAlign" value="center"/>
</text>
<text id="text3" src="data:,Right Align" region="region3">
<param name="fontColor" value="blue"/>
<param name="fontPtSize" value="12"/>
<param name="hAlign" value="right"/>
</text>
<animate target="region1" attributeName="left" from="7%" to="69%" begin="2" dur="1.5" fill="freeze"/>
<animate target="region3" attributeName="left" from="69%" to="7%" begin="2" dur="1.5" fill="freeze"/>
<animate target="text3" attributeName="top" from="0%" to="-50%" begin="3.5" dur="1.5" fill="freeze"/>
</par>
<par dur="5">
<text id="text4" src="chapter2.txt" region="region4">
<param name="fontColor" value="blue"/>
<param name="fontPtSize" value="11"/>
</text>
<animate target="text4" attributeName="top" from="0%" to="-170%" begin=".5" dur="4" fill="freeze"/>
</par>
</body>
</smil>

@ -0,0 +1,57 @@
<smil>
<head>
<layout>
<root-layout width="320" height="240"/>
<region id="reg1" left="5%" right="5%" top="5%" height="10%"/>
<region id="reg2" left="5%" right="5%" top="25%" height="10%"/>
<region id="reg3" left="5%" right="5%" top="45%" height="10%"/>
<region left="5%" right="5%" bottom="5%" height="10%"
background-color="gray">
<region id="but_rec" left="10%" width="30%" />
<region id="but_dep" right="10%" width="30%" />
</region>
</layout>
</head>
<body>
<par>
<a href="#rec">
<text id="rec_txt" src="data:,Recommended" region="but_rec"
fill="freeze"/>
</a>
<a href="#dep">
<text id="dep_txt" src="data:,Deprecated" region="but_dep"
fill="freeze"/>
</a>
<seq>
<par id="rec">
<text id="rtext1" src="data:,id=rtext1%20begin=2%20dur=2"
region="reg1" begin="2" dur="2"/>
<text src="data:,begin=rtext1.begin+1%20dur=2" region="reg2"
begin="rtext1.begin +1" dur="2"/>
<text src="data:,begin=rtext1.end%20dur=2" region="reg3"
begin="rtext1.end" dur="2"/>
<set target="rec_txt" attribute="background-color" to="green"
fill="freeze"/>
<set target="reg1" attribute="background-color" to="pink"
fill="freeze"/>
<set target="reg2" attribute="background-color" to="pink"
fill="freeze"/>
<set target="reg3" attribute="background-color" to="pink"
fill="freeze"/>
</par>
<par id="dep">
<text id="dtext1" src="data:,id=dtext1%20begin=2%20dur=2"
region="reg1" begin="2" dur="2"/>
<text src="data:,id(dtext1)(1)" region="reg2"
begin="id(dtext1)(1)" dur="2"/>
<set target="dep_txt" attribute="background-color" to="green"
fill="freeze"/>
<set target="reg1" attribute="background-color" to="red"
fill="freeze"/>
<set target="reg2" attribute="background-color" to="red"
fill="freeze"/>
</par>
</seq>
</par>
</body>
</smil>

@ -0,0 +1,181 @@
<smil>
<head>
<layout>
<root-layout width="160" height="120" background-color="green"/>
<region id="region1" left="25%" top="10%" right="25%" bottom="30%"/>
<region id="region2" left="5%" top="75%" right="5%" bottom="5%"
background-color="white"/>
<region id="region3" z-index="2"/>
</layout>
<transition id="pushwipe1" dur="1" subtype="fromTop" type="pushWipe"/>
<transition id="pushwipe2" dur="1" subtype="fromBottom" type="pushWipe"/>
<transition id="iriswipe1" dur="1" type="irisWipe"/>
<transition id="iriswipe2" dur="1" subtype="diamond" type="irisWipe"/>
<transition id="barwipe1" dur="1" type="barWipe"/>
<transition id="barwipe2" dur="1" direction="reverse" type="barWipe"/>
<transition id="barwipe4" dur="1" type="barWipe"
startProgress=".4" endProgress="0.6"/>
<transition id="barwipe5" dur="1" type="barWipe" endProgress="0.5"/>
<transition id="barwipe3" dur="0.3" type="barWipe"/>
<transition id="clockwipe1" dur="1" type="clockWipe"/>
<transition id="clockwipe2" dur="1" type="clockWipe"
subtype="clockwiseThree" direction="reverse"/>
<transition id="bowtiewipe1" dur="1" type="bowTieWipe"/>
<transition id="bowtiewipe2" dur="1" type="bowTieWipe" subtype="horizontal"/>
<transition id="ellipsewipe1" dur="1" type="ellipseWipe"/>
<transition id="ellipsewipe2" dur="1" type="ellipseWipe"
subtype="vertical"/>
<transition id="fade1" dur="1" type="fade"/>
<transition id="fade2" dur="0.3" type="fade"/>
</head>
<body>
<seq>
<brush region="region3" dur="1.5" color="gray" transOut="ellipsewipe1" />
<par>
<img src="../icons/hi64-app-kmplayer.png" dur="3" region="region1"
transIn="bowtiewipe1" transOut="bowtiewipe2" fit="tile"/>
<seq>
<text src="data:,bowTieWipe%20vertical" region="region2"
dur="1.5" transIn="fade2" transOut="barwipe3">
<param name="fontColor" value="blue"/>
<param name="fontPtSize" value="10"/>
</text>
<text src="data:,bowTieWipe%20horizontal"
region="region2" dur="1.5" transIn="barwipe3" transOut="fade2">
<param name="fontColor" value="blue"/>
<param name="fontPtSize" value="10"/>
</text>
</seq>
</par>
<par>
<img src="../icons/hi64-app-kmplayer.png" dur="3" region="region1"
transIn="clockwipe1" transOut="clockwipe2"/>
<seq>
<text src="data:,clockWipe%20clockwiseTwelve" region="region2"
dur="1.5" transIn="fade2" transOut="barwipe3">
<param name="fontColor" value="blue"/>
<param name="fontPtSize" value="10"/>
</text>
<text src="data:,clockWipe%20clockwiseThree%20reversed"
region="region2" dur="1.5" transIn="barwipe3" transOut="fade2">
<param name="fontColor" value="blue"/>
<param name="fontPtSize" value="10"/>
</text>
</seq>
</par>
<par>
<img src="../icons/hi64-app-kmplayer.png" dur="3" region="region1"
transIn="pushwipe1" transOut="pushwipe2"/>
<seq>
<text src="data:,pushWipe%20fromTop" region="region2" dur="1.5"
transIn="fade2" transOut="barwipe3">
<param name="fontColor" value="blue"/>
<param name="fontPtSize" value="10"/>
</text>
<text src="data:,pushWipe%20fromBottom" region="region2" dur="1.5"
transIn="barwipe3" transOut="fade2">
<param name="fontColor" value="blue"/>
<param name="fontPtSize" value="10"/>
</text>
</seq>
</par>
<par>
<img src="../icons/hi64-app-kmplayer.png" dur="3" region="region1"
transIn="iriswipe1" transOut="iriswipe2"/>
<seq>
<text src="data:,irishWipe%20rectangle" region="region2" dur="1.5"
transIn="fade2" transOut="barwipe3">
<param name="fontColor" value="blue"/>
<param name="fontPtSize" value="10"/>
</text>
<text src="data:,irishWipe%20diamond" region="region2" dur="1.5"
transIn="barwipe3" transOut="fade2">
<param name="fontColor" value="blue"/>
<param name="fontPtSize" value="10"/>
</text>
</seq>
</par>
<par>
<img src="../icons/hi64-app-kmplayer.png" dur="3" region="region1"
transIn="barwipe1" transOut="barwipe2"/>
<seq>
<text src="data:,barWipe%20leftToRight" region="region2" dur="1.5"
transIn="fade2" transOut="barwipe3">
<param name="fontColor" value="blue"/>
<param name="fontPtSize" value="10"/>
</text>
<text src="data:,irishWipe%20leftToRight%20reversed"
region="region2" dur="1.5" transIn="barwipe3" transOut="fade2">
<param name="fontColor" value="blue"/>
<param name="fontPtSize" value="10"/>
</text>
</seq>
</par>
<par>
<img src="../icons/hi64-app-kmplayer.png" dur="3" region="region1"
transIn="barwipe4" transOut="barwipe5"/>
<seq>
<text src="data:,barWipe%20leftToRight%2040-60" region="region2"
dur="1.5" transIn="fade2" transOut="barwipe3">
<param name="fontColor" value="blue"/>
<param name="fontPtSize" value="10"/>
</text>
<text src="data:,irishWipe%20leftToRight%200-50%20reversed"
region="region2" dur="1.5" transIn="barwipe3" transOut="fade2">
<param name="fontColor" value="blue"/>
<param name="fontPtSize" value="10"/>
</text>
</seq>
</par>
<par>
<img src="../icons/hi64-app-kmplayer.png" dur="3" region="region1"
transIn="fade1" transOut="fade1"/>
<seq>
<text src="data:,fade" region="region2" dur="1.5"
transIn="fade2" transOut="barwipe3">
<param name="fontColor" value="blue"/>
<param name="fontPtSize" value="10"/>
</text>
<text src="data:,fade" region="region2" dur="1.5"
transIn="fade2" transOut="fade2">
<param name="fontColor" value="blue"/>
<param name="fontPtSize" value="10"/>
</text>
</seq>
</par>
<par>
<img src="../icons/hi64-app-kmplayer.png" dur="3" region="region1"
transIn="ellipsewipe1" transOut="ellipsewipe2"/>
<seq>
<text src="data:,ellipseWipe%20vertical" region="region2"
dur="1.5" transIn="fade2" transOut="barwipe3">
<param name="fontColor" value="blue"/>
<param name="fontPtSize" value="10"/>
</text>
<text src="data:,ellipseWipe%20vertical"
region="region2" dur="1.5" transIn="barwipe3" transOut="fade2">
<param name="fontColor" value="blue"/>
<param name="fontPtSize" value="10"/>
</text>
</seq>
</par>
<par>
<video src="rp.smil" dur="6" region="region1" fit="meet"
transIn="clockwipe1" transOut="ellipsewipe1"/>
<seq>
<text src="data:,nested rp.smil%20clockWipe" region="region2"
dur="3" transIn="fade2" transOut="barwipe3">
<param name="fontColor" value="blue"/>
<param name="fontPtSize" value="10"/>
</text>
<text src="data:,ellipseWipe%20circle"
region="region2" dur="3" transIn="barwipe3" transOut="fade2">
<param name="fontColor" value="blue"/>
<param name="fontPtSize" value="10"/>
</text>
</seq>
</par>
<brush region="region3" dur="2" color="gray" transIn="ellipsewipe1" />
</seq>
</body>
</smil>
Loading…
Cancel
Save