summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/packages/helix/helix-libs.bb59
-rw-r--r--meta/packages/helix/helix-libs/add-clutter.patch12668
-rw-r--r--meta/packages/helix/helix-libs/helix-player.pc11
-rw-r--r--meta/packages/helix/helix-libs/hxclient.pc11
-rw-r--r--meta/packages/helix/ribosome.bb37
-rw-r--r--meta/packages/helix/ribosome/buildrc4
-rwxr-xr-xmeta/packages/helix/ribosome/clutter.bif68
7 files changed, 12858 insertions, 0 deletions
diff --git a/meta/packages/helix/helix-libs.bb b/meta/packages/helix/helix-libs.bb
new file mode 100644
index 0000000000..83c9d8139c
--- /dev/null
+++ b/meta/packages/helix/helix-libs.bb
@@ -0,0 +1,59 @@
1DESCRIPTION = "Helix Client Libraries"
2SECTION = "base"
3DEPENDS = "ribosome gtk+ libxv"
4HOMEPAGE = "http://helixcommunity.org"
5LICENSE = "RPSL"
6
7_SNAPSHOT = "atlas310_11212008"
8_TARBALL_SERVER = "http://git.moblin.org/repos/users/rusty"
9
10PV="r0"
11
12SRC_URI = "${_TARBALL_SERVER}/helix-libs_${_SNAPSHOT}.tar.bz2 \
13 file://helix-libs/helix-player.pc \
14 file://helix-libs/add-clutter.patch;patch=1"
15S = "${WORKDIR}/helix-libs_${_SNAPSHOT}"
16
17export BUILD_ROOT=${STAGING_DIR_HOST}${libdir}/ribosome
18export BUILDRC=${BUILD_ROOT}/buildrc
19export SYSTEM_ID=linux-2.2-libc6-gcc32-i586
20export BUILD=$BUILD_ROOT/bin/build.py
21
22do_compile() {
23 ${BUILD} -k -trelease -mclutter -Phelix-client-all-defines clutter
24}
25
26do_stage() {
27 mkdir -p ${STAGING_DIR_HOST}/opt/helix/lib
28 mkdir -p ${STAGING_DIR_HOST}/opt/helix/include
29 mkdir -p ${STAGING_DIR_HOST}/usr/lib/pkgconfig
30
31 install -m 0644 clientapps/clutter/player.h \
32 ${STAGING_DIR_HOST}/opt/helix/include
33 install -m 0644 ../helix-libs/helix-player.pc \
34 ${STAGING_DIR_HOST}/usr/lib/pkgconfig
35
36 install -m 0644 release/*.so ${STAGING_DIR_HOST}/opt/helix/lib
37
38 install -d ${STAGING_DIR_HOST}${libdir}
39 install -m 0644 release/libhelix-player.so ${STAGING_DIR_HOST}${libdir}
40}
41
42do_install() {
43 mkdir -p ${D}/opt/helix/lib
44 mkdir -p ${D}/opt/helix/include
45 mkdir -p ${D}/usr/lib/pkgconfig
46
47 install -m 0644 clientapps/clutter/player.h ${D}/opt/helix/include/
48 install -m 0644 ../helix-libs/helix-player.pc ${D}/usr/lib/pkgconfig
49
50 install -m 0644 release/*.so ${D}/opt/helix/lib
51
52 install -d ${D}${libdir}
53 install -m 0644 release/libhelix-player.so ${D}${libdir}
54}
55
56FILES_${PN} = "/usr/lib/libhelix-player.so"
57FILES_${PN} += "/opt/helix/lib"
58FILES_${PN}-dev = "/usr/lib/pkgconfig"
59FILES_${PN}-dev += "/opt/helix/include"
diff --git a/meta/packages/helix/helix-libs/add-clutter.patch b/meta/packages/helix/helix-libs/add-clutter.patch
new file mode 100644
index 0000000000..eb545ff73f
--- /dev/null
+++ b/meta/packages/helix/helix-libs/add-clutter.patch
@@ -0,0 +1,12668 @@
1Index: helix-libs/clientapps/clutter/LICENSE.txt
2===================================================================
3--- /dev/null 1970-01-01 00:00:00.000000000 +0000
4+++ helix-libs/clientapps/clutter/LICENSE.txt 2008-10-13 06:05:49.000000000 -0700
5@@ -0,0 +1,30 @@
6+ Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
7+
8+ The contents of this directory, and (except where otherwise
9+ indicated) the directories included within this directory, are
10+ subject to the current version of the RealNetworks Public Source
11+ License (the "RPSL") available at RPSL.txt in this directory, unless
12+ you have licensed the directory under the current version of the
13+ RealNetworks Community Source License (the "RCSL") available at
14+ RCSL.txt in this directory, in which case the RCSL will apply. You
15+ may also obtain the license terms directly from RealNetworks. You
16+ may not use the files in this directory except in compliance with the
17+ RPSL or, if you have a valid RCSL with RealNetworks applicable to
18+ this directory, the RCSL. Please see the applicable RPSL or RCSL for
19+ the rights, obligations and limitations governing use of the contents
20+ of the directory.
21+
22+ This directory is part of the Helix DNA Technology. RealNetworks is
23+ the developer of the Original Code and owns the copyrights in the
24+ portions it created.
25+
26+ This directory, and the directories included with this directory, are
27+ distributed and made available on an 'AS IS' basis, WITHOUT WARRANTY
28+ OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY
29+ DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY
30+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
31+ QUIET ENJOYMENT OR NON-INFRINGEMENT.
32+
33+ Technology Compatibility Kit Test Suite(s) Location:
34+ http://www.helixcommunity.org/content/tck
35+
36Index: helix-libs/clientapps/clutter/RCSL.txt
37===================================================================
38--- /dev/null 1970-01-01 00:00:00.000000000 +0000
39+++ helix-libs/clientapps/clutter/RCSL.txt 2008-10-13 06:05:49.000000000 -0700
40@@ -0,0 +1,948 @@
41+The RCSL is made up of a base agreement and a few Attachments.
42+
43+For Research and Development use, you agree to the terms of the
44+RCSL R&D License (base RCSL and Attachments A, B, and C)
45+
46+For Commercial Use (either distribution or internal commercial
47+deployment) of the Helix DNA with or without support for RealNetworks'
48+RealAudio and RealVideo Add-on Technology, you agree to the
49+terms of the same RCSL R&D license
50+and execute one or more additional Commercial Use License attachments
51+<see http://www.helixcommunity.org/content/rcsl-attachments>.
52+
53+------------------------------------------------------------------------
54+
55+
56+ REALNETWORKS COMMUNITY SOURCE LICENSE
57+
58+Version 1.2 (Rev. Date: January 22, 2003).
59+
60+
61+ RECITALS
62+
63+Original Contributor has developed Specifications, Source Code
64+implementations and Executables of certain Technology; and
65+
66+Original Contributor desires to license the Technology to a large
67+community to facilitate research, innovation and product development
68+while maintaining compatibility of such products with the Technology as
69+delivered by Original Contributor; and
70+
71+Original Contributor desires to license certain Trademarks for the
72+purpose of branding products that are compatible with the relevant
73+Technology delivered by Original Contributor; and
74+
75+You desire to license the Technology and possibly certain Trademarks
76+from Original Contributor on the terms and conditions specified in this
77+License.
78+
79+In consideration for the mutual covenants contained herein, You and
80+Original Contributor agree as follows:
81+
82+
83+ AGREEMENT
84+
85+*1. Introduction.*
86+
87+The RealNetworks Community Source License ("RCSL") and effective
88+attachments ("License") may include five distinct licenses:
89+
90+i) Research Use license -- License plus Attachments A, B and C only.
91+
92+ii) Commercial Use and Trademark License, which may be for Internal
93+Deployment Use or external distribution, or both -- License plus
94+Attachments A, B, C, and D.
95+
96+iii) Technology Compatibility Kit (TCK) license -- Attachment C.
97+
98+iv) Add-On Technology License (Executable) Commercial Use License
99+-Attachment F.
100+
101+v) Add-On Technology Source Code Porting and Optimization
102+License-Attachment G.
103+
104+The Research Use license is effective when You click and accept this
105+License. The TCK is effective when You click and accept this License,
106+unless otherwise specified in the TCK attachments. The Commercial Use
107+and Trademark, Add-On Technology License, and the Add-On Technology
108+Source Code Porting and Optimization licenses must each be signed by You
109+and Original Contributor to become effective. Once effective, these
110+licenses and the associated requirements and responsibilities are
111+cumulative. Capitalized terms used in this License are defined in the
112+Glossary.
113+
114+*2. License Grants.*
115+
116+2.1 Original Contributor Grant.
117+
118+Subject to Your compliance with Sections 3, 8.10 and Attachment A of
119+this License, Original Contributor grants to You a worldwide,
120+royalty-free, non-exclusive license, to the extent of Original
121+Contributor's Intellectual Property Rights covering the Original Code,
122+Upgraded Code and Specifications, to do the following:
123+
124+(a) Research Use License:
125+
126+(i) use, reproduce and modify the Original Code, Upgraded Code and
127+Specifications to create Modifications and Reformatted Specifications
128+for Research Use by You;
129+
130+(ii) publish and display Original Code, Upgraded Code and Specifications
131+with, or as part of Modifications, as permitted under Section 3.1(b) below;
132+
133+(iii) reproduce and distribute copies of Original Code and Upgraded Code
134+to Licensees and students for Research Use by You;
135+
136+(iv) compile, reproduce and distribute Original Code and Upgraded Code
137+in Executable form, and Reformatted Specifications to anyone for
138+Research Use by You.
139+
140+(b) Other than the licenses expressly granted in this License, Original
141+Contributor retains all right, title, and interest in Original Code and
142+Upgraded Code and Specifications.
143+
144+2.2 Your Grants.
145+
146+(a) To Other Licensees. You hereby grant to each Licensee a license to
147+Your Error Corrections and Shared Modifications, of the same scope and
148+extent as Original Contributor's licenses under Section 2.1 a) above
149+relative to Research Use and Attachment D relative to Commercial Use.
150+
151+(b) To Original Contributor. You hereby grant to Original Contributor a
152+worldwide, royalty-free, non-exclusive, perpetual and irrevocable
153+license, to the extent of Your Intellectual Property Rights covering
154+Your Error Corrections, Shared Modifications and Reformatted
155+Specifications, to use, reproduce, modify, display and distribute Your
156+Error Corrections, Shared Modifications and Reformatted Specifications,
157+in any form, including the right to sublicense such rights through
158+multiple tiers of distribution.
159+
160+(c) Other than the licenses expressly granted in Sections 2.2(a) and (b)
161+above, and the restrictions set forth in Section 3.1(d)(iv) below, You
162+retain all right, title, and interest in Your Error Corrections, Shared
163+Modifications and Reformatted Specifications.
164+
165+2.3 Contributor Modifications.
166+
167+You may use, reproduce, modify, display and distribute Contributor Error
168+Corrections, Shared Modifications and Reformatted Specifications,
169+obtained by You under this License, to the same scope and extent as with
170+Original Code, Upgraded Code and Specifications.
171+
172+2.4 Subcontracting.
173+
174+You may deliver the Source Code of Covered Code to other Licensees
175+having at least a Research Use license, for the sole purpose of
176+furnishing development services to You in connection with Your rights
177+granted in this License. All such Licensees must execute appropriate
178+documents with respect to such work consistent with the terms of this
179+License, and acknowledging their work-made-for-hire status or assigning
180+exclusive right to the work product and associated Intellectual Property
181+Rights to You.
182+
183+*3. Requirements and Responsibilities*.
184+
185+3.1 Research Use License.
186+
187+As a condition of exercising the rights granted under Section 2.1(a)
188+above, You agree to comply with the following:
189+
190+(a) Your Contribution to the Community. All Error Corrections and Shared
191+Modifications which You create or contribute to are automatically
192+subject to the licenses granted under Section 2.2 above. You are
193+encouraged to license all of Your other Modifications under Section 2.2
194+as Shared Modifications, but are not required to do so. You agree to
195+notify Original Contributor of any errors in the Specification.
196+
197+(b) Source Code Availability. You agree to provide all Your Error
198+Corrections to Original Contributor as soon as reasonably practicable
199+and, in any event, prior to Internal Deployment Use or Commercial Use,
200+if applicable. Original Contributor may, at its discretion, post Source
201+Code for Your Error Corrections and Shared Modifications on the
202+Community Webserver. You may also post Error Corrections and Shared
203+Modifications on a web-server of Your choice; provided, that You must
204+take reasonable precautions to ensure that only Licensees have access to
205+such Error Corrections and Shared Modifications. Such precautions shall
206+include, without limitation, a password protection scheme limited to
207+Licensees and a click-on, download certification of Licensee status
208+required of those attempting to download from the server. An example of
209+an acceptable certification is attached as Attachment A-2.
210+
211+(c) Notices. All Error Corrections and Shared Modifications You create
212+or contribute to must include a file documenting the additions and
213+changes You made and the date of such additions and changes. You must
214+also include the notice set forth in Attachment A-1 in the file header.
215+If it is not possible to put the notice in a particular Source Code file
216+due to its structure, then You must include the notice in a location
217+(such as a relevant directory file), where a recipient would be most
218+likely to look for such a notice.
219+
220+(d) Redistribution.
221+
222+(i) Source. Covered Code may be distributed in Source Code form only to
223+another Licensee (except for students as provided below). You may not
224+offer or impose any terms on any Covered Code that alter the rights,
225+requirements, or responsibilities of such Licensee. You may distribute
226+Covered Code to students for use in connection with their course work
227+and research projects undertaken at accredited educational institutions.
228+Such students need not be Licensees, but must be given a copy of the
229+notice set forth in Attachment A-3 and such notice must also be included
230+in a file header or prominent location in the Source Code made available
231+to such students.
232+
233+(ii) Executable. You may distribute Executable version(s) of Covered
234+Code to Licensees and other third parties only for the purpose of
235+evaluation and comment in connection with Research Use by You and under
236+a license of Your choice, but which limits use of such Executable
237+version(s) of Covered Code only to that purpose.
238+
239+(iii) Modified Class, Interface and Package Naming. In connection with
240+Research Use by You only, You may use Original Contributor's class,
241+Interface and package names only to accurately reference or invoke the
242+Source Code files You modify. Original Contributor grants to You a
243+limited license to the extent necessary for such purposes.
244+
245+(iv) You expressly agree that any distribution, in whole or in part, of
246+Modifications developed by You shall only be done pursuant to the terms
247+and conditions of this License.
248+
249+(e) Extensions.
250+
251+(i) Covered Code. You may not include any Source Code of Community Code
252+in any Extensions. You may include the compiled Header Files of
253+Community Code in an Extension provided that Your use of the Covered
254+Code, including Heading Files, complies with the Commercial Use License,
255+the TCK and all other terms of this License.
256+
257+(ii) Publication. No later than the date on which You first distribute
258+such Extension for Commercial Use, You must publish to the industry, on
259+a non-confidential basis and free of all copyright restrictions with
260+respect to reproduction and use, an accurate and current specification
261+for any Extension. In addition, You must make available an appropriate
262+test suite, pursuant to the same rights as the specification,
263+sufficiently detailed to allow any third party reasonably skilled in the
264+technology to produce implementations of the Extension compatible with
265+the specification. Such test suites must be made available as soon as
266+reasonably practicable but, in no event, later than ninety (90) days
267+after Your first Commercial Use of the Extension. You must use
268+reasonable efforts to promptly clarify and correct the specification and
269+the test suite upon written request by Original Contributor.
270+
271+(iii) Open. You agree to refrain from enforcing any Intellectual
272+Property Rights You may have covering any interface(s) of Your
273+Extension, which would prevent the implementation of such interface(s)
274+by Original Contributor or any Licensee. This obligation does not
275+prevent You from enforcing any Intellectual Property Right You have that
276+would otherwise be infringed by an implementation of Your Extension.
277+
278+(iv) Interface Modifications and Naming. You may not modify or add to
279+the GUID space * * "xxxxxxxx-0901-11d1-8B06-00A024406D59" or any other
280+GUID space designated by Original Contributor. You may not modify any
281+Interface prefix provided with the Covered Code or any other prefix
282+designated by Original Contributor.* *
283+
284+* *
285+
286+(f) You agree that any Specifications provided to You by Original
287+Contributor are confidential and proprietary information of Original
288+Contributor. You must maintain the confidentiality of the Specifications
289+and may not disclose them to any third party without Original
290+Contributor's prior written consent. You may only use the Specifications
291+under the terms of this License and only for the purpose of implementing
292+the terms of this License with respect to Covered Code. You agree not
293+use, copy or distribute any such Specifications except as provided in
294+writing by Original Contributor.
295+
296+3.2 Commercial Use License.
297+
298+You may not make Commercial Use of any Covered Code unless You and
299+Original Contributor have executed a copy of the Commercial Use and
300+Trademark License attached as Attachment D.
301+
302+*4. Versions of the License.*
303+
304+4.1 License Versions.
305+
306+Original Contributor may publish revised versions of the License from
307+time to time. Each version will be given a distinguishing version number.
308+
309+4.2 Effect.
310+
311+Once a particular version of Covered Code has been provided under a
312+version of the License, You may always continue to use such Covered Code
313+under the terms of that version of the License. You may also choose to
314+use such Covered Code under the terms of any subsequent version of the
315+License. No one other than Original Contributor has the right to
316+promulgate License versions.
317+
318+4.3 Multiple-Licensed Code.
319+
320+Original Contributor may designate portions of the Covered Code as
321+"Multiple-Licensed." "Multiple-Licensed" means that the Original
322+Contributor permits You to utilize those designated portions of the
323+Covered Code under Your choice of this License or the alternative
324+license(s), if any, specified by the Original Contributor in an
325+Attachment to this License.
326+
327+*5. Disclaimer of Warranty.*
328+
329+5.1 COVERED CODE PROVIDED AS IS.
330+
331+COVERED CODE IS PROVIDED UNDER THIS LICENSE "AS IS," WITHOUT WARRANTY OF
332+ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION,
333+WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT
334+FOR A PARTICULAR PURPOSE OR NON-INFRINGING. YOU AGREE TO BEAR THE ENTIRE
335+RISK IN CONNECTION WITH YOUR USE AND DISTRIBUTION OF COVERED CODE UNDER
336+THIS LICENSE. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART
337+OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER
338+EXCEPT SUBJECT TO THIS DISCLAIMER.
339+
340+5.2 Not Designed for High Risk Activities.
341+
342+You acknowledge that Original Code, Upgraded Code and Specifications are
343+not designed or intended for use in high risk activities including, but
344+not limited to: (i) on-line control of aircraft, air traffic, aircraft
345+navigation or aircraft communications; or (ii) in the design,
346+construction, operation or maintenance of any nuclear facility. Original
347+Contributor disclaims any express or implied warranty of fitness for
348+such uses.
349+
350+*6. Termination.*
351+
352+6.1 By You.
353+
354+You may terminate this Research Use license at anytime by providing
355+written notice to Original Contributor.
356+
357+6.2 By Original Contributor.
358+
359+This License and the rights granted hereunder will terminate:
360+
361+(i) automatically if You fail to comply with the terms of this License
362+and fail to cure such breach within 30 days of receipt of written notice
363+of the breach;
364+
365+(ii) immediately in the event of circumstances specified in Sections 7.1
366+and 8.4; or
367+
368+(iii) at Original Contributor's discretion upon any action initiated by
369+You (including by cross-claim or counter claim) alleging that use or
370+distribution by Original Contributor or any Licensee, of Original Code,
371+Upgraded Code, Error Corrections, Shared Modifications or Specifications
372+infringe a patent owned or controlled by You.
373+
374+6.3 Effective of Termination.
375+
376+Upon termination, You agree to discontinue use of and destroy all copies
377+of Covered Code in Your possession. All sublicenses to the Covered Code
378+which You have properly granted shall survive any termination of this
379+License. Provisions that, by their nature, should remain in effect
380+beyond the termination of this License shall survive including, without
381+limitation, Sections 2.2, 3, 5, 7 and 8.
382+
383+6.4 No Compensation.
384+
385+Each party waives and releases the other from any claim to compensation
386+or indemnity for permitted or lawful termination of the business
387+relationship established by this License.
388+
389+*7. Liability.*
390+
391+7.1 Infringement. Should any of the Original Code, Upgraded Code, TCK or
392+Specifications ("Materials") become the subject of a claim of
393+infringement, Original Contributor may, at its sole option, (i) attempt
394+to procure the rights necessary for You to continue using the Materials,
395+(ii) modify the Materials so that they are no longer infringing, or
396+(iii) terminate Your right to use the Materials, immediately upon
397+written notice, and refund to You the amount, if any, having then
398+actually been paid by You to Original Contributor for the Original Code,
399+Upgraded Code and TCK, depreciated on a straight line, five year basis.
400+
401+7.2 LIMITATION OF LIABILITY. TO THE FULL EXTENT ALLOWED BY APPLICABLE
402+LAW, ORIGINAL CONTRIBUTOR'S LIABILITY TO YOU FOR CLAIMS RELATING TO THIS
403+LICENSE, WHETHER FOR BREACH OR IN TORT, SHALL BE LIMITED TO ONE HUNDRED
404+PERCENT (100%) OF THE AMOUNT HAVING THEN ACTUALLY BEEN PAID BY YOU TO
405+ORIGINAL CONTRIBUTOR FOR ALL COPIES LICENSED HEREUNDER OF THE PARTICULAR
406+ITEMS GIVING RISE TO SUCH CLAIM, IF ANY, DURING THE TWELVE MONTHS
407+PRECEDING THE CLAIMED BREACH. IN NO EVENT WILL YOU (RELATIVE TO YOUR
408+SHARED MODIFICATIONS OR ERROR CORRECTIONS) OR ORIGINAL CONTRIBUTOR BE
409+LIABLE FOR ANY INDIRECT, PUNITIVE, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
410+DAMAGES IN CONNECTION WITH OR RISING OUT OF THIS LICENSE (INCLUDING,
411+WITHOUT LIMITATION, LOSS OF PROFITS, USE, DATA, OR OTHER ECONOMIC
412+ADVANTAGE), HOWEVER IT ARISES AND ON ANY THEORY OF LIABILITY, WHETHER IN
413+AN ACTION FOR CONTRACT, STRICT LIABILITY OR TORT (INCLUDING NEGLIGENCE)
414+OR OTHERWISE, WHETHER OR NOT YOU OR ORIGINAL CONTRIBUTOR HAS BEEN
415+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE AND NOTWITHSTANDING THE
416+FAILURE OF ESSENTIAL PURPOSE OF ANY REMEDY.
417+
418+*8. Miscellaneous.*
419+
420+8.1 Trademark.
421+
422+You shall not use any Trademark unless You and Original Contributor
423+execute a copy of the Commercial Use and Trademark License Agreement
424+attached hereto as Attachment D. Except as expressly provided in the
425+License, You are granted no right, title or license to, or interest in,
426+any Trademarks. Whether or not You and Original Contributor enter into
427+the Trademark License, You agree not to (i) challenge Original
428+Contributor's ownership or use of Trademarks; (ii) attempt to register
429+any Trademarks, or any mark or logo substantially similar thereto; or
430+(iii) incorporate any Trademarks into Your own trademarks, product
431+names, service marks, company names, or domain names.
432+
433+8.2 Integration.
434+
435+This License represents the complete agreement concerning the subject
436+matter hereof.
437+
438+8.3 Assignment.
439+
440+Original Contributor may assign this License, and its rights and
441+obligations hereunder, in its sole discretion. You may assign the
442+Research Use portions of this License and the TCK license to a third
443+party upon prior written notice to Original Contributor (which may be
444+provided electronically via the Community Web-Server). You may not
445+assign the Commercial Use and Trademark license, the Add-On Technology
446+License, or the Add-On Technology Source Code Porting License, including
447+by way of merger (regardless of whether You are the surviving entity) or
448+acquisition, without Original Contributor's prior written consent.
449+
450+8.4 Severability.
451+
452+If any provision of this License is held to be unenforceable, such
453+provision shall be reformed only to the extent necessary to make it
454+enforceable. Notwithstanding the foregoing, if You are prohibited by law
455+from fully and specifically complying with Sections 2.2 or 3, this
456+License will immediately terminate and You must immediately discontinue
457+any use of Covered Code.
458+
459+8.5 Governing Law.
460+
461+This License shall be governed by the laws of the United States and the
462+State of Washington, as applied to contracts entered into and to be
463+performed in Washington between Washington residents. The application of
464+the United Nations Convention on Contracts for the International Sale of
465+Goods is expressly excluded. You agree that the state and federal courts
466+located in Seattle, Washington have exclusive jurisdiction over any
467+claim relating to the License, including contract and tort claims.
468+
469+8.6 Dispute Resolution.
470+
471+a) Arbitration. Any dispute arising out of or relating to this License
472+shall be finally settled by arbitration as set out herein, except that
473+either party may bring any action, in a court of competent jurisdiction
474+(which jurisdiction shall be exclusive), with respect to any dispute
475+relating to such party's Intellectual Property Rights or with respect to
476+Your compliance with the TCK license. Arbitration shall be administered:
477+(i) by the American Arbitration Association (AAA), (ii) in accordance
478+with the rules of the United Nations Commission on International Trade
479+Law (UNCITRAL) (the "Rules") in effect at the time of arbitration as
480+modified herein; and (iii) the arbitrator will apply the substantive
481+laws of Washington and the United States. Judgment upon the award
482+rendered by the arbitrator may be entered in any court having
483+jurisdiction to enforce such award.
484+
485+b) Arbitration language, venue and damages. All arbitration proceedings
486+shall be conducted in English by a single arbitrator selected in
487+accordance with the Rules, who must be fluent in English and be either a
488+retired judge or practicing attorney having at least ten (10) years
489+litigation experience and be reasonably familiar with the technology
490+matters relative to the dispute. Unless otherwise agreed, arbitration
491+venue shall be in Seattle, Washington. The arbitrator may award monetary
492+damages only and nothing shall preclude either party from seeking
493+provisional or emergency relief from a court of competent jurisdiction.
494+The arbitrator shall have no authority to award damages in excess of
495+those permitted in this License and any such award in excess is void.
496+All awards will be payable in U.S. dollars and may include, for the
497+prevailing party (i) pre-judgment award interest, (ii) reasonable
498+attorneys' fees incurred in connection with the arbitration, and (iii)
499+reasonable costs and expenses incurred in enforcing the award. The
500+arbitrator will order each party to produce identified documents and
501+respond to no more than twenty-five single question interrogatories.
502+
503+8.7 Construction.
504+
505+Any law or regulation, which provides that the language of a contract
506+shall be construed against the drafter, shall not apply to this License.
507+
508+8.8 U.S. Government End Users.
509+
510+The Covered Code is a "commercial item," as that term is defined in 48
511+C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software"
512+and "commercial computer software documentation," as such terms are used
513+in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and
514+48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government
515+End Users acquire Covered Code with only those rights set forth herein.
516+You agree to pass this notice to our licensees.
517+
518+8.9 Marketing Activities.
519+
520+Licensee hereby grants Original Contributor a non-exclusive,
521+non-transferable, limited license to use the Licensee's company name and
522+logo ("Licensee Marks") in any presentations, press releases, or
523+marketing materials solely for the purpose of identifying Licensee as a
524+member of the Helix Community. Licensee shall provide samples of
525+Licensee Marks to Original Contributor upon request by Original
526+Contributor. Original Contributor acknowledges that the Licensee Marks
527+are the trademarks of Licensee. Original Contributor shall not use the
528+Licensee Marks in a way that may imply that Original Contributor is an
529+agency or branch of Licensee. Original Contributor understands and
530+agrees that the use of any Licensee Marks in connection with this
531+Agreement shall not create any right, title or interest, in, or to the
532+Licensee Marks or any Licensee trademarks and that all such use and
533+goodwill associated with any such trademarks will inure to the benefit
534+of Licensee. Further the Original Contributor will stop usage of the
535+Licensee Marks upon Licensee's request.
536+
537+8.10 Press Announcements.
538+
539+You may make press announcements or other public statements regarding
540+this License without the prior written consent of the Original
541+Contributor, if Your statement is limited to announcing the licensing of
542+the Covered Code or the availability of Your Product and its
543+compatibility with the Covered Code. All other public announcements
544+regarding this license require the prior written consent of the Original
545+Contributor. Consent requests are welcome at press@helixcommunity.org.
546+
547+8.11 International Use.
548+
549+a) Export/Import laws. Covered Code is subject to U.S. export control
550+laws and may be subject to export or import regulations in other
551+countries. Each party agrees to comply strictly with all such laws and
552+regulations and acknowledges their responsibility to obtain such
553+licenses to export, re-export, or import as may be required. You agree
554+to pass these obligations to Your licensees.
555+
556+b) Intellectual Property Protection. Due to limited intellectual
557+property protection and enforcement in certain countries, You agree not
558+to redistribute the Original Code, Upgraded Code, TCK and Specifications
559+to any country on the list of restricted countries on the Community Web
560+Server.
561+
562+8.12 Language.
563+
564+This License is in the English language only, which language shall be
565+controlling in all respects, and all versions of this License in any
566+other language shall be for accommodation only and shall not be binding
567+on the parties to this License. All communications and notices made or
568+given pursuant to this License, and all documentation and support to be
569+provided, unless otherwise noted, shall be in the English language.
570+
571+PLEASE READ THE TERMS OF THIS LICENSE CAREFULLY. BY CLICKING ON THE
572+"ACCEPT" BUTTON BELOW YOU ARE ACCEPTING AND AGREEING TO THE TERMS AND
573+CONDITIONS OF THIS LICENSE WITH REALNETWORKS, INC. IF YOU ARE AGREEING
574+TO THIS LICENSE ON BEHALF OF A COMPANY, YOU REPRESENT THAT YOU ARE
575+AUTHORIZED TO BIND THE COMPANY TO SUCH A LICENSE. WHETHER YOU ARE ACTING
576+ON YOUR OWN BEHALF, OR REPRESENTING A COMPANY, YOU MUST BE OF MAJORITY
577+AGE AND BE OTHERWISE COMPETENT TO ENTER INTO CONTRACTS. IF YOU DO NOT
578+MEET THIS CRITERIA OR YOU DO NOT AGREE TO ANY OF THE TERMS AND
579+CONDITIONS OF THIS LICENSE, CLICK ON THE REJECT BUTTON TO EXIT.
580+
581+
582+ GLOSSARY
583+
584+1. *"Added Value"* means code which:
585+
586+(i) has a principal purpose which is substantially different from that
587+of the stand-alone Technology;
588+
589+(ii) represents a significant functional and value enhancement to the
590+Technology;
591+
592+(iii) operates in conjunction with the Technology; and
593+
594+(iv) is not marketed as a technology which replaces or substitutes for
595+the Technology
596+
597+2. "*Applicable Patent Rights*" mean: (a) in the case where Original
598+Contributor is the grantor of rights, claims of patents that (i) are now
599+or hereafter acquired, owned by or assigned to Original Contributor and
600+(ii) are necessarily infringed by using or making the Original Code or
601+Upgraded Code, including Modifications provided by Original Contributor,
602+alone and not in combination with other software or hardware; and (b) in
603+the case where Licensee is the grantor of rights, claims of patents that
604+(i) are now or hereafter acquired, owned by or assigned to Licensee and
605+(ii) are infringed (directly or indirectly) by using or making
606+Licensee's Modifications or Error Corrections, taken alone or in
607+combination with Covered Code.
608+
609+3. "*Application Programming Interfaces (APIs)"* means the interfaces,
610+associated header files, service provider interfaces, and protocols that
611+enable a device, application, Operating System, or other program to
612+obtain services from or make requests of (or provide services in
613+response to requests from) other programs, and to use, benefit from, or
614+rely on the resources, facilities, and capabilities of the relevant
615+programs using the APIs. APIs includes the technical documentation
616+describing the APIs, the Source Code constituting the API, and any
617+Header Files used with the APIs.
618+
619+4. "*Commercial Use*" means any use (internal or external), copying,
620+sublicensing or distribution (internal or external), directly or
621+indirectly of Covered Code by You other than Your Research Use of
622+Covered Code within Your business or organization or in conjunction with
623+other Licensees with equivalent Research Use rights. Commercial Use
624+includes any use of the Covered Code for direct or indirect commercial
625+or strategic gain, advantage or other business purpose. Any Commercial
626+Use requires execution of Attachment D by You and Original Contributor.
627+
628+5. "*Community Code*" means the Original Code, Upgraded Code, Error
629+Corrections, Shared Modifications, or any combination thereof.
630+
631+6. "*Community Webserver(s)"* means the webservers designated by
632+Original Contributor for access to the Original Code, Upgraded Code, TCK
633+and Specifications and for posting Error Corrections and Shared
634+Modifications.
635+
636+7. "*Compliant Covered Code*" means Covered Code that complies with the
637+requirements of the TCK.
638+
639+8. "*Contributor*" means each Licensee that creates or contributes to
640+the creation of any Error Correction or Shared Modification.
641+
642+9. "*Covered Code*" means the Original Code, Upgraded Code,
643+Modifications, or any combination thereof.
644+
645+10. "*Error Correction*" means any change made to Community Code which
646+conforms to the Specification and corrects the adverse effect of a
647+failure of Community Code to perform any function set forth in or
648+required by the Specifications.
649+
650+11. "*Executable*" means Covered Code that has been converted from
651+Source Code to the preferred form for execution by a computer or digital
652+processor (e.g. binary form).
653+
654+12. "*Extension(s)"* means any additional Interfaces developed by or for
655+You which: (i) are designed for use with the Technology; (ii) constitute
656+an API for a library of computing functions or services; and (iii) are
657+disclosed or otherwise made available to third party software developers
658+for the purpose of developing software which invokes such additional
659+Interfaces. The foregoing shall not apply to software developed by Your
660+subcontractors to be exclusively used by You.
661+
662+13. "*Header File(s)"* means that portion of the Source Code that
663+provides the names and types of member functions, data members, class
664+definitions, and interface definitions necessary to implement the APIs
665+for the Covered Code. Header Files include, files specifically
666+designated by Original Contributor as Header Files. Header Files do not
667+include the code necessary to implement the functionality underlying the
668+Interface.
669+
670+14. *"Helix DNA Server Technology"* means the program(s) that implement
671+the Helix Universal Server streaming engine for the Technology as
672+defined in the Specification.
673+
674+15. *"Helix DNA Client Technology"* means the Covered Code that
675+implements the RealOne Player engine as defined in the Specification.
676+
677+16. *"Helix DNA Producer Technology"* means the Covered Code that
678+implements the Helix Producer engine as defined in the Specification.
679+
680+17. *"Helix DNA Technology"* means the Helix DNA Server Technology, the
681+Helix DNA Client Technology, the Helix DNA Producer Technology and other
682+Helix technologies designated by Original Contributor.
683+
684+18. "*Intellectual Property Rights*" means worldwide statutory and
685+common law rights associated solely with (i) Applicable Patent Rights;
686+(ii) works of authorship including copyrights, copyright applications,
687+copyright registrations and "moral rights"; (iii) the protection of
688+trade and industrial secrets and confidential information; and (iv)
689+divisions, continuations, renewals, and re-issuances of the foregoing
690+now existing or acquired in the future.
691+
692+19. *"Interface*" means interfaces, functions, properties, class
693+definitions, APIs, Header Files, GUIDs, V-Tables, and/or protocols
694+allowing one piece of software, firmware or hardware to communicate or
695+interoperate with another piece of software, firmware or hardware.
696+
697+20. "*Internal Deployment Use*" means use of Compliant Covered Code
698+(excluding Research Use) within Your business or organization only by
699+Your employees and/or agents on behalf of Your business or organization,
700+but not to provide services, including content distribution, to third
701+parties, subject to execution of Attachment D by You and Original
702+Contributor, if required.
703+
704+21. "*Licensee*" means any party that has entered into and has in effect
705+a version of this License with Original Contributor.
706+
707+22. "*MIME type*" means a description of what type of media or other
708+content is in a file, including by way of example but not limited to
709+'audio/x-pn-realaudio-plugin.'
710+
711+23. "*Modification(s)"* means (i) any addition to, deletion from and/or
712+change to the substance and/or structure of the Covered Code, including
713+Interfaces; (ii) the combination of any Covered Code and any previous
714+Modifications; (iii) any new file or other representation of computer
715+program statements that contains any portion of Covered Code; and/or
716+(iv) any new Source Code implementing any portion of the Specifications.
717+
718+24. "*MP3 Patents*" means any patents necessary to make, use or sell
719+technology implementing any portion of the specification developed by
720+the Moving Picture Experts Group known as MPEG-1 Audio Layer-3 or MP3,
721+including but not limited to all past and future versions, profiles,
722+extensions, parts and amendments relating to the MP3 specification.
723+
724+25. "*MPEG-4 Patents*" means any patents necessary to make, use or sell
725+technology implementing any portion of the specification developed by
726+the Moving Pictures Experts Group known as MPEG-4, including but not
727+limited to all past and future versions, profiles, extensions, parts and
728+amendments relating to the MPEG-4 specification.
729+
730+26. "*Original Code*" means the initial Source Code for the Technology
731+as described on the Community Web Server.
732+
733+27. "*Original Contributor*" means RealNetworks, Inc., its affiliates
734+and its successors and assigns.
735+
736+28. "*Original Contributor MIME Type*" means the MIME registry, browser
737+preferences, or local file/protocol associations invoking any Helix DNA
738+Client-based application, including the RealOne Player, for playback of
739+RealAudio, RealVideo, other RealMedia MIME types or datatypes (e.g.,
740+.ram, .rnx, .rpm, .ra, .rm, .rp, .rt, .rf, .prx, .mpe, .rmp, .rmj, .rav,
741+.rjs, .rmx, .rjt, .rms), and any other Original Contributor-specific or
742+proprietary MIME types that Original Contributor may introduce in the
743+future.
744+
745+29. "*Personal Use*" means use of Covered Code by an individual solely
746+for his or her personal, private and non-commercial purposes. An
747+individual's use of Covered Code in his or her capacity as an officer,
748+employee, member, independent contractor or agent of a corporation,
749+business or organization (commercial or non-commercial) does not qualify
750+as Personal Use.
751+
752+30. "*RealMedia File Format*" means the file format designed and
753+developed by RealNetworks for storing multimedia data and used to store
754+RealAudio and RealVideo encoded streams. Valid RealMedia File Format
755+extensions include: .rm, .rmj, .rmc, .rmvb, .rms.
756+
757+31. "*RCSL Webpage*" means the RealNetworks Community Source License
758+webpage located at https://www.helixcommunity.org/content/rcsl or such
759+other URL that Original Contributor may designate from time to time.
760+
761+32. "*Reformatted Specifications*" means any revision to the
762+Specifications which translates or reformats the Specifications (as for
763+example in connection with Your documentation) but which does not alter,
764+subset or superset * *the functional or operational aspects of the
765+Specifications.
766+
767+33. "*Research Use*" means use and distribution of Covered Code only for
768+Your Personal Use, research or development use and expressly excludes
769+Internal Deployment Use and Commercial Use. Research Use also includes
770+use of Covered Code to teach individuals how to use Covered Code.
771+
772+34. "*Shared Modifications*" means Modifications that You distribute or
773+use for a Commercial Use, in addition to any Modifications provided by
774+You, at Your option, pursuant to Section 2.2, or received by You from a
775+Contributor pursuant to Section 2.3.
776+
777+35. "*Source Code*" means the preferred form of the Covered Code for
778+making modifications to it, including all modules it contains, plus any
779+associated interface definition files, scripts used to control
780+compilation and installation of an Executable, or source code
781+differential comparisons against either the Original Code or another
782+well known, available Covered Code of the Contributor's choice. The
783+Source Code can be in a compressed or archival form, provided the
784+appropriate decompression or de-archiving software is widely available
785+for no charge.
786+
787+36. "*Specifications*" means the specifications for the Technology and
788+other documentation, as designated on the Community Web Server, as may
789+be revised by Original Contributor from time to time.
790+
791+37. "*Trademarks*" means Original Contributor's trademarks and logos,
792+including, but not limited to, RealNetworks, RealAudio, RealVideo,
793+RealOne, RealSystem, SureStream, Helix, Helix DNA and other trademarks
794+whether now used or adopted in the future.
795+
796+38. "*Technology*" means the technology described in Attachment B, and
797+Upgrades.
798+
799+39. "*Technology Compatibility Kit"* or *"TCK*" means the test programs,
800+procedures, acceptance criteria and/or other requirements, designated by
801+Original Contributor for use in verifying compliance of Covered Code
802+with the Specifications, in conjunction with the Original Code and
803+Upgraded Code. Original Contributor may, in its sole discretion and from
804+time to time, revise a TCK to correct errors and/or omissions and in
805+connection with Upgrades.
806+
807+40. "*Upgrade(s)"* means new versions of Technology designated
808+exclusively by Original Contributor as an "Upgrade" and released by
809+Original Contributor from time to time under the terms of the License.
810+
811+41. "*Upgraded Code*" means the Source Code and/or Executables for
812+Upgrades, possibly including Modifications made by Contributors.
813+
814+42. *"User's Guide"* means the users guide for the TCK which Original
815+Contributor makes available to You to provide direction in how to run
816+the TCK and properly interpret the results, as may be revised by
817+Original Contributor from time to time.
818+
819+43. "*You(r)*" means an individual, or a legal entity acting by and
820+through an individual or individuals, exercising rights either under
821+this License or under a future version of this License issued pursuant
822+to Section 4.1. For legal entities, "You(r)" includes any entity that by
823+majority voting interest controls, is controlled by, or is under common
824+control with You.
825+
826+44. "*Your Products*" means any (i) hardware products You distribute
827+integrating the Covered Code; (ii) any software products You distribute
828+with the Covered Code that utilize the APIs of the Covered Code; or
829+(iii) any services You provide using the Covered Code.
830+
831+
832+ ATTACHMENT A
833+
834+REQUIRED NOTICES
835+
836+
837+ ATTACHMENT A-1
838+
839+REQUIRED IN ALL CASES
840+
841+Notice to be included in header file of all Error Corrections and Shared
842+Modifications:
843+
844+Portions Copyright 1994-2003 © RealNetworks, Inc. All rights reserved.
845+
846+The contents of this file, and the files included with this file, are
847+subject to the current version of RealNetworks Community Source License
848+Version 1.1 (the "License"). You may not use this file except in
849+compliance with the License executed by both You and RealNetworks. You
850+may obtain a copy of the License at *
851+https://www.helixcommunity.org/content/rcsl.* You may also obtain a copy
852+of the License by contacting RealNetworks directly. Please see the
853+License for the rights, obligations and limitations governing use of the
854+contents of the file.
855+
856+This file is part of the Helix DNA technology. RealNetworks, Inc., is
857+the developer of the Original code and owns the copyrights in the
858+portions it created.
859+
860+This file, and the files included with this file, are distributed on an
861+'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
862+AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
863+LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
864+PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
865+
866+Contributor(s):
867+
868+_______________________________________________
869+
870+Technology Compatibility Kit Test Suite(s) Location:
871+
872+________________________________
873+
874+
875+ ATTACHMENT A-2
876+
877+SAMPLE LICENSEE CERTIFICATION
878+
879+"By clicking the `Agree' button below, You certify that You are a
880+Licensee in good standing under the RealNetworks Community Source
881+License, ("License") and that Your access, use and distribution of code
882+and information You may obtain at this site is subject to the License.
883+If You are not a Licensee under the RealNetworks Community Source
884+License You agree not to download, copy or use the Helix DNA technology.
885+
886+
887+ ATTACHMENT A-3
888+
889+REQUIRED STUDENT NOTIFICATION
890+
891+"This software and related documentation has been obtained by Your
892+educational institution subject to the RealNetworks Community Source
893+License. You have been provided access to the software and related
894+documentation for use only in connection with your course work and
895+research activities as a matriculated student of Your educational
896+institution. Any other use is expressly prohibited.
897+
898+THIS SOFTWARE AND RELATED DOCUMENTATION CONTAINS PROPRIETARY MATERIAL OF
899+REALNETWORKS, INC, WHICH ARE PROTECTED BY VARIOUS INTELLECTUAL PROPERTY
900+RIGHTS.
901+
902+You may not use this file except in compliance with the License. You may
903+obtain a copy of the License on the web at
904+https://www.helixcommunity.org/content/rcsl.
905+
906+*
907+*
908+
909+
910+ ATTACHMENT B
911+
912+Description of Technology
913+
914+Helix DNA, which consists of Helix DNA Client, Helix DNA Server and
915+Helix DNA Producer.
916+
917+Description of "Technology"
918+
919+Helix DNA Technology v1.0 as described on the Community Web Server.
920+
921+
922+ ATTACHMENT C
923+
924+TECHNOLOGY COMPATIBILITY KIT LICENSE
925+
926+The following license is effective for the *Helix DNA* Technology
927+Compatibility Kit - as described on the Community Web Server. The
928+Technology Compatibility Kit(s) for the Technology specified in
929+Attachment B may be accessed at the Community Web Server.
930+
931+1. TCK License.
932+
933+1.1 Grants to use TCK
934+
935+Subject to the terms and restrictions set forth below and the
936+RealNetworks Community Source License, and the Research Use license,
937+Original Contributor grants to You a worldwide, non-exclusive,
938+non-transferable license, to the extent of Original Contributor's
939+Intellectual Property Rights in the TCK (without the right to
940+sublicense), to use the TCK to develop and test Covered Code.
941+
942+1.2 TCK Use Restrictions.
943+
944+You are not authorized to create derivative works of the TCK or use the
945+TCK to test any implementation of the Specification that is not Covered
946+Code. You may not publish Your test results or make claims of
947+comparative compatibility with respect to other implementations of the
948+Specification. In consideration for the license grant in Section 1.1
949+above You agree not to develop Your own tests that are intended to
950+validate conformation with the Specification.
951+
952+2. Test Results.
953+
954+You agree to provide to Original Contributor or the third party test
955+facility if applicable, Your test results that demonstrate that Covered
956+Code is Compliant Covered Code and that Original Contributor may publish
957+or otherwise distribute such test results.
958+
959+PLEASE READ THE TERMS OF THIS LICENSE CAREFULLY. BY CLICKING ON THE
960+"ACCEPT" BUTTON BELOW YOU ARE ACCEPTING AND AGREEING TO THE TERMS AND
961+CONDITIONS OF THIS LICENSE WITH THE ORIGINAL CONTRIBUTOR, REALNETWORKS,
962+INC. IF YOU ARE AGREEING TO THIS LICENSE ON BEHALF OF A COMPANY, YOU
963+REPRESENT THAT YOU ARE AUTHORIZED TO BIND THE COMPANY TO SUCH A LICENSE.
964+WHETHER YOU ARE ACTING ON YOUR OWN BEHALF, OR REPRESENTING A COMPANY,
965+YOU MUST BE OF MAJORITY AGE AND BE OTHERWISE COMPETENT TO ENTER INTO
966+CONTRACTS. IF YOU DO NOT MEET THIS CRITERIA OR YOU DO NOT AGREE TO ANY
967+OF THE TERMS AND CONDITIONS OF THIS LICENSE, CLICK ON THE REJECT BUTTON
968+TO EXIT.
969+
970+*ACCEPT / REJECT
971+*
972+
973+*
974+*
975+
976+*To agree to the R&D/academic terms of this license, please register
977+<https://www.helixcommunity.org/2002/intro/why-register> on the site --
978+you will then be given a chance to agree to the clickwrap RCSL
979+<https://reguseronly.helixcommunity.org/2002/clickwrap/rcsl-clickwrap>
980+R&D License
981+<https://reguseronly.helixcommunity.org/2002/clickwrap/rcsl-clickwrap>
982+and gain access to the RCSL-licensed source code. To build or deploy
983+commercial applications based on the RCSL, you will need to agree to the
984+Commercial Use license attachments
985+<https://www.helixcommunity.org/content/rcsl-attachments>*
986+
987+
988+
989Index: helix-libs/clientapps/clutter/RPSL.txt
990===================================================================
991--- /dev/null 1970-01-01 00:00:00.000000000 +0000
992+++ helix-libs/clientapps/clutter/RPSL.txt 2008-10-13 06:05:49.000000000 -0700
993@@ -0,0 +1,518 @@
994+RealNetworks Public Source License Version 1.0
995+(Rev. Date October 28, 2002)
996+
997+1. General Definitions. This License applies to any program or other work which
998+RealNetworks, Inc., or any other entity that elects to use this license,
999+("Licensor") makes publicly available and which contains a notice placed by
1000+Licensor identifying such program or work as "Original Code" and stating that it
1001+is subject to the terms of this RealNetworks Public Source License version 1.0
1002+(or subsequent version thereof) ("License"). You are not required to accept this
1003+License. However, nothing else grants You permission to use, copy, modify or
1004+distribute the software or its derivative works. These actions are prohibited by
1005+law if You do not accept this License. Therefore, by modifying, copying or
1006+distributing the software (or any work based on the software), You indicate your
1007+acceptance of this License to do so, and all its terms and conditions. In
1008+addition, you agree to the terms of this License by clicking the Accept button
1009+or downloading the software. As used in this License:
1010+
1011+1.1 "Applicable Patent Rights" mean: (a) in the case where Licensor is the
1012+grantor of rights, claims of patents that (i) are now or hereafter acquired,
1013+owned by or assigned to Licensor and (ii) are necessarily infringed by using or
1014+making the Original Code alone and not in combination with other software or
1015+hardware; and (b) in the case where You are the grantor of rights, claims of
1016+patents that (i) are now or hereafter acquired, owned by or assigned to You and
1017+(ii) are infringed (directly or indirectly) by using or making Your
1018+Modifications, taken alone or in combination with Original Code.
1019+
1020+1.2 "Compatible Source License" means any one of the licenses listed on Exhibit
1021+B or at https://www.helixcommunity.org/content/complicense or other licenses
1022+specifically identified by Licensor in writing. Notwithstanding any term to the
1023+contrary in any Compatible Source License, any code covered by any Compatible
1024+Source License that is used with Covered Code must be made readily available in
1025+Source Code format for royalty-free use under the terms of the Compatible Source
1026+License or this License.
1027+
1028+1.3 "Contributor" means any person or entity that creates or contributes to the
1029+creation of Modifications.
1030+
1031+1.4 "Covered Code" means the Original Code, Modifications, the combination of
1032+Original Code and any Modifications, and/or any respective portions thereof.
1033+
1034+1.5 "Deploy" means to use, sublicense or distribute Covered Code other than for
1035+Your internal research and development (R&D) and/or Personal Use, and includes
1036+without limitation, any and all internal use or distribution of Covered Code
1037+within Your business or organization except for R&D use and/or Personal Use, as
1038+well as direct or indirect sublicensing or distribution of Covered Code by You
1039+to any third party in any form or manner.
1040+
1041+1.6 "Derivative Work" means either the Covered Code or any derivative work under
1042+United States copyright law, and including any work containing or including any
1043+portion of the Covered Code or Modifications, either verbatim or with
1044+modifications and/or translated into another language. Derivative Work also
1045+includes any work which combines any portion of Covered Code or Modifications
1046+with code not otherwise governed by the terms of this License.
1047+
1048+1.7 "Externally Deploy" means to Deploy the Covered Code in any way that may be
1049+accessed or used by anyone other than You, used to provide any services to
1050+anyone other than You, or used in any way to deliver any content to anyone other
1051+than You, whether the Covered Code is distributed to those parties, made
1052+available as an application intended for use over a computer network, or used to
1053+provide services or otherwise deliver content to anyone other than You.
1054+
1055+1.8. "Interface" means interfaces, functions, properties, class definitions,
1056+APIs, header files, GUIDs, V-Tables, and/or protocols allowing one piece of
1057+software, firmware or hardware to communicate or interoperate with another piece
1058+of software, firmware or hardware.
1059+
1060+1.9 "Modifications" mean any addition to, deletion from, and/or change to, the
1061+substance and/or structure of the Original Code, any previous Modifications, the
1062+combination of Original Code and any previous Modifications, and/or any
1063+respective portions thereof. When code is released as a series of files, a
1064+Modification is: (a) any addition to or deletion from the contents of a file
1065+containing Covered Code; and/or (b) any new file or other representation of
1066+computer program statements that contains any part of Covered Code.
1067+
1068+1.10 "Original Code" means (a) the Source Code of a program or other work as
1069+originally made available by Licensor under this License, including the Source
1070+Code of any updates or upgrades to such programs or works made available by
1071+Licensor under this License, and that has been expressly identified by Licensor
1072+as such in the header file(s) of such work; and (b) the object code compiled
1073+from such Source Code and originally made available by Licensor under this
1074+License.
1075+
1076+1.11 "Personal Use" means use of Covered Code by an individual solely for his or
1077+her personal, private and non-commercial purposes. An individual's use of
1078+Covered Code in his or her capacity as an officer, employee, member, independent
1079+contractor or agent of a corporation, business or organization (commercial or
1080+non-commercial) does not qualify as Personal Use.
1081+
1082+1.12 "Source Code" means the human readable form of a program or other work that
1083+is suitable for making modifications to it, including all modules it contains,
1084+plus any associated interface definition files, scripts used to control
1085+compilation and installation of an executable (object code).
1086+
1087+1.13 "You" or "Your" means an individual or a legal entity exercising rights
1088+under this License. For legal entities, "You" or "Your" includes any entity
1089+which controls, is controlled by, or is under common control with, You, where
1090+"control" means (a) the power, direct or indirect, to cause the direction or
1091+management of such entity, whether by contract or otherwise, or (b) ownership of
1092+fifty percent (50%) or more of the outstanding shares or beneficial ownership of
1093+such entity.
1094+
1095+2. Permitted Uses; Conditions & Restrictions. Subject to the terms and
1096+conditions of this License, Licensor hereby grants You, effective on the date
1097+You accept this License (via downloading or using Covered Code or otherwise
1098+indicating your acceptance of this License), a worldwide, royalty-free,
1099+non-exclusive copyright license, to the extent of Licensor's copyrights cover
1100+the Original Code, to do the following:
1101+
1102+2.1 You may reproduce, display, perform, modify and Deploy Covered Code,
1103+provided that in each instance:
1104+
1105+(a) You must retain and reproduce in all copies of Original Code the copyright
1106+and other proprietary notices and disclaimers of Licensor as they appear in the
1107+Original Code, and keep intact all notices in the Original Code that refer to
1108+this License;
1109+
1110+(b) You must include a copy of this License with every copy of Source Code of
1111+Covered Code and documentation You distribute, and You may not offer or impose
1112+any terms on such Source Code that alter or restrict this License or the
1113+recipients' rights hereunder, except as permitted under Section 6;
1114+
1115+(c) You must duplicate, to the extent it does not already exist, the notice in
1116+Exhibit A in each file of the Source Code of all Your Modifications, and cause
1117+the modified files to carry prominent notices stating that You changed the files
1118+and the date of any change;
1119+
1120+(d) You must make Source Code of all Your Externally Deployed Modifications
1121+publicly available under the terms of this License, including the license grants
1122+set forth in Section 3 below, for as long as you Deploy the Covered Code or
1123+twelve (12) months from the date of initial Deployment, whichever is longer. You
1124+should preferably distribute the Source Code of Your Deployed Modifications
1125+electronically (e.g. download from a web site); and
1126+
1127+(e) if You Deploy Covered Code in object code, executable form only, You must
1128+include a prominent notice, in the code itself as well as in related
1129+documentation, stating that Source Code of the Covered Code is available under
1130+the terms of this License with information on how and where to obtain such
1131+Source Code. You must also include the Object Code Notice set forth in Exhibit A
1132+in the "about" box or other appropriate place where other copyright notices are
1133+placed, including any packaging materials.
1134+
1135+2.2 You expressly acknowledge and agree that although Licensor and each
1136+Contributor grants the licenses to their respective portions of the Covered Code
1137+set forth herein, no assurances are provided by Licensor or any Contributor that
1138+the Covered Code does not infringe the patent or other intellectual property
1139+rights of any other entity. Licensor and each Contributor disclaim any liability
1140+to You for claims brought by any other entity based on infringement of
1141+intellectual property rights or otherwise. As a condition to exercising the
1142+rights and licenses granted hereunder, You hereby assume sole responsibility to
1143+secure any other intellectual property rights needed, if any. For example, if a
1144+third party patent license is required to allow You to make, use, sell, import
1145+or offer for sale the Covered Code, it is Your responsibility to acquire such
1146+license(s).
1147+
1148+2.3 Subject to the terms and conditions of this License, Licensor hereby grants
1149+You, effective on the date You accept this License (via downloading or using
1150+Covered Code or otherwise indicating your acceptance of this License), a
1151+worldwide, royalty-free, perpetual, non-exclusive patent license under
1152+Licensor's Applicable Patent Rights to make, use, sell, offer for sale and
1153+import the Covered Code, provided that in each instance you comply with the
1154+terms of this License.
1155+
1156+3. Your Grants. In consideration of, and as a condition to, the licenses granted
1157+to You under this License:
1158+
1159+(a) You grant to Licensor and all third parties a non-exclusive, perpetual,
1160+irrevocable, royalty free license under Your Applicable Patent Rights and other
1161+intellectual property rights owned or controlled by You, to make, sell, offer
1162+for sale, use, import, reproduce, display, perform, modify, distribute and
1163+Deploy Your Modifications of the same scope and extent as Licensor's licenses
1164+under Sections 2.1 and 2.2; and
1165+
1166+(b) You grant to Licensor and its subsidiaries a non-exclusive, worldwide,
1167+royalty-free, perpetual and irrevocable license, under Your Applicable Patent
1168+Rights and other intellectual property rights owned or controlled by You, to
1169+make, use, sell, offer for sale, import, reproduce, display, perform,
1170+distribute, modify or have modified (for Licensor and/or its subsidiaries),
1171+sublicense and distribute Your Modifications, in any form and for any purpose,
1172+through multiple tiers of distribution.
1173+
1174+(c) You agree not use any information derived from Your use and review of the
1175+Covered Code, including but not limited to any algorithms or inventions that may
1176+be contained in the Covered Code, for the purpose of asserting any of Your
1177+patent rights, or assisting a third party to assert any of its patent rights,
1178+against Licensor or any Contributor.
1179+
1180+4. Derivative Works. You may create a Derivative Work by combining Covered Code
1181+with other code not otherwise governed by the terms of this License and
1182+distribute the Derivative Work as an integrated product. In each such instance,
1183+You must make sure the requirements of this License are fulfilled for the
1184+Covered Code or any portion thereof, including all Modifications.
1185+
1186+4.1 You must cause any Derivative Work that you distribute, publish or
1187+Externally Deploy, that in whole or in part contains or is derived from the
1188+Covered Code or any part thereof, to be licensed as a whole at no charge to all
1189+third parties under the terms of this License and no other license except as
1190+provided in Section 4.2. You also must make Source Code available for the
1191+Derivative Work under the same terms as Modifications, described in Sections 2
1192+and 3, above.
1193+
1194+4.2 Compatible Source Licenses. Software modules that have been independently
1195+developed without any use of Covered Code and which contain no portion of the
1196+Covered Code, Modifications or other Derivative Works, but are used or combined
1197+in any way wtih the Covered Code or any Derivative Work to form a larger
1198+Derivative Work, are exempt from the conditions described in Section 4.1 but
1199+only to the extent that: the software module, including any software that is
1200+linked to, integrated with, or part of the same applications as, the software
1201+module by any method must be wholly subject to one of the Compatible Source
1202+Licenses. Notwithstanding the foregoing, all Covered Code must be subject to the
1203+terms of this License. Thus, the entire Derivative Work must be licensed under a
1204+combination of the RPSL (for Covered Code) and a Compatible Source License for
1205+any independently developed software modules within the Derivative Work. The
1206+foregoing requirement applies even if the Compatible Source License would
1207+ordinarily allow the software module to link with, or form larger works with,
1208+other software that is not subject to the Compatible Source License. For
1209+example, although the Mozilla Public License v1.1 allows Mozilla code to be
1210+combined with proprietary software that is not subject to the MPL, if
1211+MPL-licensed code is used with Covered Code the MPL-licensed code could not be
1212+combined or linked with any code not governed by the MPL. The general intent of
1213+this section 4.2 is to enable use of Covered Code with applications that are
1214+wholly subject to an acceptable open source license. You are responsible for
1215+determining whether your use of software with Covered Code is allowed under Your
1216+license to such software.
1217+
1218+4.3 Mere aggregation of another work not based on the Covered Code with the
1219+Covered Code (or with a work based on the Covered Code) on a volume of a storage
1220+or distribution medium does not bring the other work under the scope of this
1221+License. If You deliver the Covered Code for combination and/or integration with
1222+an application previously provided by You (for example, via automatic updating
1223+technology), such combination and/or integration constitutes a Derivative Work
1224+subject to the terms of this License.
1225+
1226+5. Exclusions From License Grant. Nothing in this License shall be deemed to
1227+grant any rights to trademarks, copyrights, patents, trade secrets or any other
1228+intellectual property of Licensor or any Contributor except as expressly stated
1229+herein. No right is granted to the trademarks of Licensor or any Contributor
1230+even if such marks are included in the Covered Code. Nothing in this License
1231+shall be interpreted to prohibit Licensor from licensing under different terms
1232+from this License any code that Licensor otherwise would have a right to
1233+license. Modifications, Derivative Works and/or any use or combination of
1234+Covered Code with other technology provided by Licensor or third parties may
1235+require additional patent licenses from Licensor which Licensor may grant in its
1236+sole discretion. No patent license is granted separate from the Original Code or
1237+combinations of the Original Code with other software or hardware.
1238+
1239+5.1. Trademarks. This License does not grant any rights to use the trademarks or
1240+trade names owned by Licensor ("Licensor Marks" defined in Exhibit C) or to any
1241+trademark or trade name belonging to any Contributor. No Licensor Marks may be
1242+used to endorse or promote products derived from the Original Code other than as
1243+permitted by the Licensor Trademark Policy defined in Exhibit C.
1244+
1245+6. Additional Terms. You may choose to offer, and to charge a fee for, warranty,
1246+support, indemnity or liability obligations and/or other rights consistent with
1247+the scope of the license granted herein ("Additional Terms") to one or more
1248+recipients of Covered Code. However, You may do so only on Your own behalf and
1249+as Your sole responsibility, and not on behalf of Licensor or any Contributor.
1250+You must obtain the recipient's agreement that any such Additional Terms are
1251+offered by You alone, and You hereby agree to indemnify, defend and hold
1252+Licensor and every Contributor harmless for any liability incurred by or claims
1253+asserted against Licensor or such Contributor by reason of any such Additional
1254+Terms.
1255+
1256+7. Versions of the License. Licensor may publish revised and/or new versions of
1257+this License from time to time. Each version will be given a distinguishing
1258+version number. Once Original Code has been published under a particular version
1259+of this License, You may continue to use it under the terms of that version. You
1260+may also choose to use such Original Code under the terms of any subsequent
1261+version of this License published by Licensor. No one other than Licensor has
1262+the right to modify the terms applicable to Covered Code created under this
1263+License.
1264+
1265+8. NO WARRANTY OR SUPPORT. The Covered Code may contain in whole or in part
1266+pre-release, untested, or not fully tested works. The Covered Code may contain
1267+errors that could cause failures or loss of data, and may be incomplete or
1268+contain inaccuracies. You expressly acknowledge and agree that use of the
1269+Covered Code, or any portion thereof, is at Your sole and entire risk. THE
1270+COVERED CODE IS PROVIDED "AS IS" AND WITHOUT WARRANTY, UPGRADES OR SUPPORT OF
1271+ANY KIND AND LICENSOR AND LICENSOR'S LICENSOR(S) (COLLECTIVELY REFERRED TO AS
1272+"LICENSOR" FOR THE PURPOSES OF SECTIONS 8 AND 9) AND ALL CONTRIBUTORS EXPRESSLY
1273+DISCLAIM ALL WARRANTIES AND/OR CONDITIONS, EXPRESS OR IMPLIED, INCLUDING, BUT
1274+NOT LIMITED TO, THE IMPLIED WARRANTIES AND/OR CONDITIONS OF MERCHANTABILITY, OF
1275+SATISFACTORY QUALITY, OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY, OF QUIET
1276+ENJOYMENT, AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. LICENSOR AND EACH
1277+CONTRIBUTOR DOES NOT WARRANT AGAINST INTERFERENCE WITH YOUR ENJOYMENT OF THE
1278+COVERED CODE, THAT THE FUNCTIONS CONTAINED IN THE COVERED CODE WILL MEET YOUR
1279+REQUIREMENTS, THAT THE OPERATION OF THE COVERED CODE WILL BE UNINTERRUPTED OR
1280+ERROR-FREE, OR THAT DEFECTS IN THE COVERED CODE WILL BE CORRECTED. NO ORAL OR
1281+WRITTEN DOCUMENTATION, INFORMATION OR ADVICE GIVEN BY LICENSOR, A LICENSOR
1282+AUTHORIZED REPRESENTATIVE OR ANY CONTRIBUTOR SHALL CREATE A WARRANTY. You
1283+acknowledge that the Covered Code is not intended for use in high risk
1284+activities, including, but not limited to, the design, construction, operation
1285+or maintenance of nuclear facilities, aircraft navigation, aircraft
1286+communication systems, or air traffic control machines in which case the failure
1287+of the Covered Code could lead to death, personal injury, or severe physical or
1288+environmental damage. Licensor disclaims any express or implied warranty of
1289+fitness for such uses.
1290+
1291+9. LIMITATION OF LIABILITY. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT
1292+SHALL LICENSOR OR ANY CONTRIBUTOR BE LIABLE FOR ANY INCIDENTAL, SPECIAL,
1293+INDIRECT OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO THIS LICENSE OR
1294+YOUR USE OR INABILITY TO USE THE COVERED CODE, OR ANY PORTION THEREOF, WHETHER
1295+UNDER A THEORY OF CONTRACT, WARRANTY, TORT (INCLUDING NEGLIGENCE OR STRICT
1296+LIABILITY), PRODUCTS LIABILITY OR OTHERWISE, EVEN IF LICENSOR OR SUCH
1297+CONTRIBUTOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND
1298+NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY REMEDY. SOME
1299+JURISDICTIONS DO NOT ALLOW THE LIMITATION OF LIABILITY OF INCIDENTAL OR
1300+CONSEQUENTIAL DAMAGES, SO THIS LIMITATION MAY NOT APPLY TO YOU. In no event
1301+shall Licensor's total liability to You for all damages (other than as may be
1302+required by applicable law) under this License exceed the amount of ten dollars
1303+($10.00).
1304+
1305+10. Ownership. Subject to the licenses granted under this License, each
1306+Contributor retains all rights, title and interest in and to any Modifications
1307+made by such Contributor. Licensor retains all rights, title and interest in and
1308+to the Original Code and any Modifications made by or on behalf of Licensor
1309+("Licensor Modifications"), and such Licensor Modifications will not be
1310+automatically subject to this License. Licensor may, at its sole discretion,
1311+choose to license such Licensor Modifications under this License, or on
1312+different terms from those contained in this License or may choose not to
1313+license them at all.
1314+
1315+11. Termination.
1316+
1317+11.1 Term and Termination. The term of this License is perpetual unless
1318+terminated as provided below. This License and the rights granted hereunder will
1319+terminate:
1320+
1321+(a) automatically without notice from Licensor if You fail to comply with any
1322+term(s) of this License and fail to cure such breach within 30 days of becoming
1323+aware of such breach;
1324+
1325+(b) immediately in the event of the circumstances described in Section 12.5(b);
1326+or
1327+
1328+(c) automatically without notice from Licensor if You, at any time during the
1329+term of this License, commence an action for patent infringement against
1330+Licensor (including by cross-claim or counter claim in a lawsuit);
1331+
1332+(d) upon written notice from Licensor if You, at any time during the term of
1333+this License, commence an action for patent infringement against any third party
1334+alleging that the Covered Code itself (excluding combinations with other
1335+software or hardware) infringes any patent (including by cross-claim or counter
1336+claim in a lawsuit).
1337+
1338+11.2 Effect of Termination. Upon termination, You agree to immediately stop any
1339+further use, reproduction, modification, sublicensing and distribution of the
1340+Covered Code and to destroy all copies of the Covered Code that are in your
1341+possession or control. All sublicenses to the Covered Code which have been
1342+properly granted prior to termination shall survive any termination of this
1343+License. Provisions which, by their nature, should remain in effect beyond the
1344+termination of this License shall survive, including but not limited to Sections
1345+3, 5, 8, 9, 10, 11, 12.2 and 13. No party will be liable to any other for
1346+compensation, indemnity or damages of any sort solely as a result of terminating
1347+this License in accordance with its terms, and termination of this License will
1348+be without prejudice to any other right or remedy of any party.
1349+
1350+12. Miscellaneous.
1351+
1352+12.1 Government End Users. The Covered Code is a "commercial item" as defined in
1353+FAR 2.101. Government software and technical data rights in the Covered Code
1354+include only those rights customarily provided to the public as defined in this
1355+License. This customary commercial license in technical data and software is
1356+provided in accordance with FAR 12.211 (Technical Data) and 12.212 (Computer
1357+Software) and, for Department of Defense purchases, DFAR 252.227-7015 (Technical
1358+Data -- Commercial Items) and 227.7202-3 (Rights in Commercial Computer Software
1359+or Computer Software Documentation). Accordingly, all U.S. Government End Users
1360+acquire Covered Code with only those rights set forth herein.
1361+
1362+12.2 Relationship of Parties. This License will not be construed as creating an
1363+agency, partnership, joint venture or any other form of legal association
1364+between or among You, Licensor or any Contributor, and You will not represent to
1365+the contrary, whether expressly, by implication, appearance or otherwise.
1366+
1367+12.3 Independent Development. Nothing in this License will impair Licensor's
1368+right to acquire, license, develop, have others develop for it, market and/or
1369+distribute technology or products that perform the same or similar functions as,
1370+or otherwise compete with, Modifications, Derivative Works, technology or
1371+products that You may develop, produce, market or distribute.
1372+
1373+12.4 Waiver; Construction. Failure by Licensor or any Contributor to enforce any
1374+provision of this License will not be deemed a waiver of future enforcement of
1375+that or any other provision. Any law or regulation which provides that the
1376+language of a contract shall be construed against the drafter will not apply to
1377+this License.
1378+
1379+12.5 Severability. (a) If for any reason a court of competent jurisdiction finds
1380+any provision of this License, or portion thereof, to be unenforceable, that
1381+provision of the License will be enforced to the maximum extent permissible so
1382+as to effect the economic benefits and intent of the parties, and the remainder
1383+of this License will continue in full force and effect. (b) Notwithstanding the
1384+foregoing, if applicable law prohibits or restricts You from fully and/or
1385+specifically complying with Sections 2 and/or 3 or prevents the enforceability
1386+of either of those Sections, this License will immediately terminate and You
1387+must immediately discontinue any use of the Covered Code and destroy all copies
1388+of it that are in your possession or control.
1389+
1390+12.6 Dispute Resolution. Any litigation or other dispute resolution between You
1391+and Licensor relating to this License shall take place in the Seattle,
1392+Washington, and You and Licensor hereby consent to the personal jurisdiction of,
1393+and venue in, the state and federal courts within that District with respect to
1394+this License. The application of the United Nations Convention on Contracts for
1395+the International Sale of Goods is expressly excluded.
1396+
1397+12.7 Export/Import Laws. This software is subject to all export and import laws
1398+and restrictions and regulations of the country in which you receive the Covered
1399+Code and You are solely responsible for ensuring that You do not export,
1400+re-export or import the Covered Code or any direct product thereof in violation
1401+of any such restrictions, laws or regulations, or without all necessary
1402+authorizations.
1403+
1404+12.8 Entire Agreement; Governing Law. This License constitutes the entire
1405+agreement between the parties with respect to the subject matter hereof. This
1406+License shall be governed by the laws of the United States and the State of
1407+Washington.
1408+
1409+Where You are located in the province of Quebec, Canada, the following clause
1410+applies: The parties hereby confirm that they have requested that this License
1411+and all related documents be drafted in English. Les parties ont exig&eacute;
1412+que le pr&eacute;sent contrat et tous les documents connexes soient
1413+r&eacute;dig&eacute;s en anglais.
1414+
1415+ EXHIBIT A.
1416+
1417+"Copyright &copy; 1995-2002
1418+RealNetworks, Inc. and/or its licensors. All Rights Reserved.
1419+
1420+The contents of this file, and the files included with this file, are subject to
1421+the current version of the RealNetworks Public Source License Version 1.0 (the
1422+"RPSL") available at https://www.helixcommunity.org/content/rpsl unless you have
1423+licensed the file under the RealNetworks Community Source License Version 1.0
1424+(the "RCSL") available at https://www.helixcommunity.org/content/rcsl, in which
1425+case the RCSL will apply. You may also obtain the license terms directly from
1426+RealNetworks. You may not use this file except in compliance with the RPSL or,
1427+if you have a valid RCSL with RealNetworks applicable to this file, the RCSL.
1428+Please see the applicable RPSL or RCSL for the rights, obligations and
1429+limitations governing use of the contents of the file.
1430+
1431+This file is part of the Helix DNA Technology. RealNetworks is the developer of
1432+the Original code and owns the copyrights in the portions it created.
1433+
1434+This file, and the files included with this file, is distributed and made
1435+available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR
1436+IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING
1437+WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
1438+PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1439+
1440+Contributor(s): ____________________________________
1441+
1442+Technology Compatibility Kit Test
1443+Suite(s) Location (if licensed under the RCSL): ______________________________
1444+
1445+Object Code Notice: Helix DNA Client technology included. Copyright (c)
1446+RealNetworks, Inc., 1995-2002. All rights reserved.
1447+
1448+
1449+ EXHIBIT B
1450+
1451+Compatible Source Licenses for the RealNetworks Public Source License. The
1452+following list applies to the most recent version of the license as of October
1453+25, 2002, unless otherwise indicated.
1454+
1455+* Academic Free License
1456+* Apache Software License
1457+* Apple Public Source License
1458+* Artistic license
1459+* Attribution Assurance Licenses
1460+* BSD license
1461+* Common Public License (1)
1462+* Eiffel Forum License
1463+* GNU General Public License (GPL) (1)
1464+* GNU Library or "Lesser" General Public License (LGPL) (1)
1465+* IBM Public License
1466+* Intel Open Source License
1467+* Jabber Open Source License
1468+* MIT license
1469+* MITRE Collaborative Virtual Workspace License (CVW License)
1470+* Motosoto License
1471+* Mozilla Public License 1.0 (MPL)
1472+* Mozilla Public License 1.1 (MPL)
1473+* Nokia Open Source License
1474+* Open Group Test Suite License
1475+* Python Software Foundation License
1476+* Ricoh Source Code Public License
1477+* Sun Industry Standards Source License (SISSL)
1478+* Sun Public License
1479+* University of Illinois/NCSA Open Source License
1480+* Vovida Software License v. 1.0
1481+* W3C License
1482+* X.Net License
1483+* Zope Public License
1484+* zlib/libpng license
1485+
1486+(1) Note: because this license contains certain reciprocal licensing terms that
1487+purport to extend to independently developed code, You may be prohibited under
1488+the terms of this otherwise compatible license from using code licensed under
1489+its terms with Covered Code because Covered Code may only be licensed under the
1490+RealNetworks Public Source License. Any attempt to apply non RPSL license terms,
1491+including without limitation the GPL, to Covered Code is expressly forbidden.
1492+You are responsible for ensuring that Your use of Compatible Source Licensed
1493+code does not violate either the RPSL or the Compatible Source License.
1494+
1495+The latest version of this list can be found at:
1496+https://www.helixcommunity.org/content/complicense
1497+
1498+ EXHIBIT C
1499+
1500+RealNetworks' Trademark policy.
1501+
1502+RealNetworks defines the following trademarks collectively as "Licensor
1503+Trademarks": "RealNetworks", "RealPlayer", "RealJukebox", "RealSystem",
1504+"RealAudio", "RealVideo", "RealOne Player", "RealMedia", "Helix" or any other
1505+trademarks or trade names belonging to RealNetworks.
1506+
1507+RealNetworks "Licensor Trademark Policy" forbids any use of Licensor Trademarks
1508+except as permitted by and in strict compliance at all times with RealNetworks'
1509+third party trademark usage guidelines which are posted at
1510+http://www.realnetworks.com/info/helixlogo.html.
1511+
1512Index: helix-libs/clientapps/clutter/Umakefil
1513===================================================================
1514--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1515+++ helix-libs/clientapps/clutter/Umakefil 2008-10-13 06:05:49.000000000 -0700
1516@@ -0,0 +1,325 @@
1517+#
1518+# ***** BEGIN LICENSE BLOCK *****
1519+# Version: RCSL 1.0/RPSL 1.0
1520+#
1521+# Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
1522+#
1523+# The contents of this file, and the files included with this file, are
1524+# subject to the current version of the RealNetworks Public Source License
1525+# Version 1.0 (the "RPSL") available at
1526+# http://www.helixcommunity.org/content/rpsl unless you have licensed
1527+# the file under the RealNetworks Community Source License Version 1.0
1528+# (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
1529+# in which case the RCSL will apply. You may also obtain the license terms
1530+# directly from RealNetworks. You may not use this file except in
1531+# compliance with the RPSL or, if you have a valid RCSL with RealNetworks
1532+# applicable to this file, the RCSL. Please see the applicable RPSL or
1533+# RCSL for the rights, obligations and limitations governing use of the
1534+# contents of the file.
1535+#
1536+# This file is part of the Helix DNA Technology. RealNetworks is the
1537+# developer of the Original Code and owns the copyrights in the portions
1538+# it created.
1539+#
1540+# This file, and the files included with this file, is distributed and made
1541+# available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1542+# EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1543+# INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
1544+# FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1545+#
1546+# Technology Compatibility Kit Test Suite(s) Location:
1547+# http://www.helixcommunity.org/content/tck
1548+#
1549+# Contributor(s):
1550+#
1551+# ***** END LICENSE BLOCK *****
1552+#
1553+
1554+UmakefileVersion(2,2)
1555+
1556+project.AddModuleIncludes("common/include",
1557+ "common/runtime/pub",
1558+ "client/include",
1559+ "client/common/system/pub",
1560+ "client/common/container/pub",
1561+ "client/audiosvc/pub",
1562+ "common/container/pub",
1563+ "video/sitelib/pub",
1564+ "video/colconverter/pub",
1565+ "video/sitelib/pub/platform/unix",
1566+ "video/sitelib",
1567+ "datatype/rm/include",
1568+ "client/core")
1569+
1570+project.AddSources("player.cpp",
1571+ "excontxt.cpp",
1572+ "exsite.cpp",
1573+ "exroot.cpp",
1574+ "exadvsnk.cpp",
1575+ "exerror.cpp",
1576+ "iids.cpp",
1577+ "exstateadvsnk.cpp",
1578+ "excallback.cpp",
1579+ "print.cpp")
1580+
1581+project.AddModuleLibraries(
1582+ "common/runtime[runtlib]",
1583+ "common/system[syslib]",
1584+ "common/container[contlib]",
1585+ "common/runtime[runtlib]",
1586+ "client/common/system[sysclntlib]",
1587+ "common/dbgtool[debuglib]",
1588+ "common/util[utillib]",
1589+ "video/sitelib[sitelib]",
1590+ "video/sitelib[sitecreatelib]",
1591+ "common/log/logutil[logutillib]",
1592+ "video/vidutil[vidutillib]"
1593+ )
1594+project.AddSystemLibraries('Xv', 'Xext')
1595+
1596+if project.IsDefined("HELIX_FEATURE_PREFERENCES"):
1597+ project.AddSources("preflist.cpp")
1598+
1599+if project.IsDefined("HELIX_FEATURE_AUTHENTICATION"):
1600+ project.AddSources("exaumgr.cpp")
1601+
1602+if project.IsDefined("HELIX_FEATURE_VIDEO"):
1603+ project.AddSources("exsitsup.cpp",
1604+ "fivemmap.cpp")
1605+ project.AddModuleIncludes('video/include')
1606+ if project.IsDefined("HELIX_FEATURE_PNG"):
1607+ project.AddModuleIncludes('datatype/image/png/common/pub')
1608+ project.AddModuleLibraries("common/import/zlib[zlib]",
1609+ "datatype/image/png/import/libpng[libpng]",
1610+ "datatype/image/png/common[pngcomlib]")
1611+
1612+if project.IsDefined("HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS"):
1613+ project.AddSources("exprdnld.cpp")
1614+
1615+if project.BuildOption("nodll"):
1616+ ## Client core
1617+ static_plugin_list = ["clntcore"]
1618+ project.AddModuleLibraries("common/runtime[runtlib]",
1619+ "common/fileio[fileiolib]",
1620+ "client/common/system[sysclntlib]",
1621+ "client/common/container[contclntlib]",
1622+ "client/core[clntcorelib]")
1623+ if not project.IsDefined("HELIX_FEATURE_LOGLEVEL_NONE"):
1624+ project.AddModuleLibraries("common/log/logutil[logutillib]")
1625+ if not project.IsDefined("HELIX_CONFIG_MINIMIZE_SIZE"):
1626+ project.AddModuleLibraries("client/common/util[utlclntlib]")
1627+ ## Client core libraries
1628+ if project.IsDefined("HELIX_FEATURE_AUDIO"):
1629+ project.AddModuleLibraries("audio/device[auddevlib]",
1630+ "client/audiosvc[audsvclib]")
1631+ if ('HELIX_FEATURE_VOLUME' in project.defines):
1632+ project.AddModuleLibraries("audio/gaintool[audgainlib]" )
1633+ if ('HELIX_FEATURE_VOLUME' in project.defines):
1634+ project.AddModuleLibraries("audio/crossfade[audxfadelib]")
1635+ if project.IsDefined("HELIX_FEATURE_MIXER"):
1636+ project.AddModuleLibraries("audio/mixer[audmixlib]")
1637+ if project.IsDefined("HELIX_FEATURE_RESAMPLER"):
1638+ project.AddModuleLibraries("audio/resampler[audresamplib]")
1639+ if project.IsDefined("HELIX_FEATURE_LIMITER"):
1640+ project.AddModuleLibraries("audio/limiter[audlimiter]")
1641+
1642+ if project.IsDefined("HELIX_FEATURE_VIDEO"):
1643+ project.AddModuleLibraries("client/videosvc[vidsvclib]",
1644+ "protocol/sdp[sdplib]")
1645+ if project.IsDefined("HELIX_FEATURE_PLAYBACK_NET"):
1646+ project.AddModuleLibraries("client/netwksvc[netsvclib]",
1647+ "common/netio[netiolib]",
1648+ "client/common/netio[netioclntlib]",
1649+ "protocol/transport/common/system[systranlib]",
1650+ "protocol/transport/rtp[rtptranlib]",
1651+ "protocol/common/util[protutillib]",
1652+ "protocol/rtsp[rtsplib]")
1653+ if project.IsDefined("HELIX_FEATURE_RDT"):
1654+ project.AddLibraries(GetSDKPath("prtclrdt_lib"))
1655+ project.AddModuleLibraries("protocol/transport/rdt[rdttranlib]")
1656+ if project.IsDefined("HELIX_FEATURE_PNA"):
1657+ project.AddLibraries(GetSDKPath("prtclpna_lib"))
1658+ if project.IsDefined("HELIX_FEATURE_XMLPARSER"):
1659+ project.AddModuleLibraries("common/lang/xml[xmllib]")
1660+ ## Add RAM file format and renderer
1661+ if project.IsDefined("HELIX_FEATURE_META"):
1662+ static_plugin_list[-1:-1] = ["ramfformat", "ramrender"]
1663+ project.AddModuleLibraries("datatype/ram/renderer[ramrendrlib]")
1664+ ## Add local file system
1665+ if project.IsDefined("HELIX_FEATURE_PLAYBACK_LOCAL"):
1666+ static_plugin_list[-1:-1] = ["smplfsys"]
1667+ project.AddModuleLibraries("common/fileio[fileiolib]")
1668+ ## Add http file system
1669+ if project.IsDefined("HELIX_FEATURE_PLAYBACK_NET"):
1670+ static_plugin_list[-1:-1] = ["hxsdp", "httpfsys"]
1671+ project.AddModuleLibraries("protocol/http[httplib]",
1672+ "protocol/common/util[protutillib]",
1673+ "protocol/sdp[sdplib]",
1674+ "filesystem/data[datafsys]",
1675+ "common/fileio[fileiolib]",
1676+ "common/import/zlib[zlib]")
1677+ ## Add realmedia file format
1678+ if project.IsDefined("HELIX_FEATURE_PLAYBACK_LOCAL") and \
1679+ (project.IsDefined("HELIX_FEATURE_AUDIO_REAL") or \
1680+ project.IsDefined("HELIX_FEATURE_VIDEO_REAL")):
1681+ static_plugin_list[-1:-1] = ["rmfformat"]
1682+ project.AddModuleLibraries("datatype/common/util[dtutillib]",
1683+ "datatype/common/container[dtcomcontlib]")
1684+ project.AddLibraries(GetSDKPath("rmcom_lib"),
1685+ GetSDKPath("rmacom_lib"),
1686+ GetSDKPath("rmff_lib"),
1687+ GetSDKPath("rmvidpyld_lib"))
1688+
1689+ ## Add realmedia renderer
1690+ if project.IsDefined("HELIX_FEATURE_AUDIO_REAL"):
1691+ static_plugin_list[-1:-1] = ["rarender"]
1692+ project.AddModuleLibraries("datatype/rm/audio/payload[rapayld]")
1693+ project.AddLibraries(GetSDKPath("rmarend_lib"),
1694+ GetSDKPath("rmacom_lib"))
1695+ ## Add mp3 file format and renderer
1696+ if project.IsDefined("HELIX_FEATURE_AUDIO_MPA_LAYER3") or \
1697+ project.IsDefined("HELIX_FEATURE_AUDIO_MPA_LAYER2") or \
1698+ project.IsDefined("HELIX_FEATURE_AUDIO_MPA_LAYER1"):
1699+ static_plugin_list[-1:-1] = ["mp3render"]
1700+ project.AddModuleLibraries("datatype/mp3/codec/fltpt[mp3codecfltpt]",
1701+ "datatype/mp3/common[mp3lib]",
1702+ "datatype/mp3/payload[mp3payld]",
1703+ "datatype/common/util[dtutillib]")
1704+ if project.IsDefined("HELIX_FEATURE_PLAYBACK_LOCAL"):
1705+ static_plugin_list[-1:-1] = ["mp3fformat"]
1706+ project.AddModuleLibraries("datatype/mp3/common[mp3lib]")
1707+ ## Add gecko realmedia codec
1708+ if project.IsDefined("HELIX_FEATURE_AUDIO_CODEC_GECKO"):
1709+ static_plugin_list[-1:-1] = ["cook"]
1710+ if not project.IsDefined("HELIX_CONFIG_FIXEDPOINT"):
1711+ project.AddLibraries(GetSDKPath("ra8lbrdec_flt_lib"))
1712+ else:
1713+ project.AddLibraries(GetSDKPath("ra8lbrdec_fix_lib"))
1714+ project.AddModuleLibraries("datatype/rm/audio/codec/common[racompat]")
1715+ ## Add RAAC codec
1716+ if project.IsDefined("HELIX_FEATURE_AUDIO_CODEC_RAAC"):
1717+ static_plugin_list[-1:-1] = ["raac"]
1718+ project.AddModuleLibraries("datatype/mp4/common[mp4comlib]",
1719+ "datatype/aac/codec/fixpt/decoder/hxwrap[aacdeclib]")
1720+ ## Add sipro realmedia codec
1721+ ## (Right now this only works for floating-point platforms)
1722+ if project.IsDefined("HELIX_FEATURE_AUDIO_CODEC_SIPRO"):
1723+ static_plugin_list[-1:-1] = ["sipr"]
1724+ project.AddLibraries(GetSDKPath("sipro_flt_backend_lib"))
1725+ ## Add tokyo realmedia codec
1726+ if project.IsDefined("HELIX_FEATURE_AUDIO_CODEC_TOKYO"):
1727+ static_plugin_list[-1:-1] = ["atrc"]
1728+ project.AddLibraries(GetSDKPath("ra8hbr_lib"))
1729+ ##
1730+ if project.IsDefined("HELIX_FEATURE_VIDEO"):
1731+ static_plugin_list[-1:-1] = ["vidsite"]
1732+ static_plugin_list[-1:-1] = ["hxltcolor"]
1733+ project.AddModuleLibraries("datatype/common/vidrend[vidrend]",
1734+ "video/sitelib[sitelib]",
1735+ "video/site[vidsite]",
1736+ "video/colconverter[hxltcolor]",
1737+ "datatype/rm/common[rmcomlib]",
1738+ "video/vidutil[vidutillib]")
1739+
1740+ if (project.IsDefined('HELIX_FEATURE_ALTERNATE_SITE_CREATE_LIB')):
1741+ project.AddLibraries(GetSDKPath("sitecreate_lib"))
1742+ else:
1743+ project.AddModuleLibraries('video/sitelib[sitecreatelib]')
1744+
1745+ ## Add realvideo renderer
1746+ if project.IsDefined("HELIX_FEATURE_VIDEO_REAL"):
1747+ project.AddModuleLibraries("datatype/rm/video/renderer[rvxrendlib]")
1748+ project.AddLibraries(GetSDKPath("rmvidcom_lib"),
1749+ GetSDKPath("rmvidpyld_lib"),
1750+ GetSDKPath("rvcodcom_lib"))
1751+ project.AddModuleLibraries("datatype/common/util[dtutillib]")
1752+ static_plugin_list[-1:-1] = ["rvrender"]
1753+
1754+ ## Add mpeg4 file format
1755+ if project.IsDefined("HELIX_FEATURE_PLAYBACK_LOCAL")and \
1756+ (project.IsDefined("HELIX_FEATURE_VIDEO_H263") or \
1757+ project.IsDefined("HELIX_FEATURE_VIDEO_MPEG4") or \
1758+ project.IsDefined("HELIX_FEATURE_AUDIO_MPEG4")):
1759+ static_plugin_list[-1:-1] = ["mp4fformat"]
1760+ project.AddModuleLibraries("datatype/common/util[dtutillib]",
1761+ "datatype/common/audrend",
1762+ "datatype/mp4/common[mp4comlib]",
1763+ "datatype/mp4/payload[mp4pyldlib]",
1764+ "datatype/mp4/fileformat[mp4fformatlib]")
1765+ if not project.IsDefined("HELIX_FEATURE_MP4_FILEFORMAT_M4A_ONLY"):
1766+ project.AddModuleLibraries("protocol/sdp[sdplib]",
1767+ "protocol/rtsp[rtsplib]",
1768+ "protocol/common/util[protutillib]",
1769+ "datatype/rm/common[rmcomlib]",
1770+ "datatype/amr/common[amrcomlib]")
1771+ ## Add h.263 renderer
1772+ if project.IsDefined("HELIX_FEATURE_VIDEO_H263"):
1773+ project.AddModuleLibraries("datatype/h263/payload[h263pyldlib]")
1774+ static_plugin_list[-1:-1] = ["h263render"]
1775+ ## Add MPEG4 renderer
1776+# if project.IsDefined("HELIX_FEATURE_VIDEO_MPEG4"):
1777+# static_plugin_list[-1:-1] = ["mp4xrender"]
1778+ ## Add mpeg 4 audio renderer
1779+ if project.IsDefined("HELIX_FEATURE_AUDIO_MPEG4"):
1780+ static_plugin_list[-1:-1] = ["mp4arender"]
1781+ project.AddModuleLibraries("datatype/mp4/audio/renderer[mp4arenderlib]")
1782+ if not project.IsDefined("HELIX_FEATURE_MP4_FILEFORMAT_M4A_ONLY"):
1783+ project.AddModuleLibraries("datatype/amr/common[amrcomlib]")
1784+ ## Add RV10 codec
1785+ if project.IsDefined("HELIX_FEATURE_VIDEO_CODEC_RV10"):
1786+ project.AddLibraries(GetSDKPath("rv1dec_libs")+"[rv10lib]",
1787+ GetSDKPath("rv1dec_libs")+"[drv1lib]")
1788+ static_plugin_list[-1:-1] = ["rv10", "drv1"]
1789+ ## Add RV20 codec
1790+ if project.IsDefined("HELIX_FEATURE_VIDEO_CODEC_RV20"):
1791+ project.AddLibraries(GetSDKPath("rvg2dec_libs")+"[rv20lib]",
1792+ GetSDKPath("rvg2dec_libs")+"[drv2lib]")
1793+ static_plugin_list[-1:-1] = ["rv20", "drv2"]
1794+
1795+ if project.IsDefined("HELIX_FEATURE_VIDEO_CODEC_RV30") or \
1796+ project.IsDefined("HELIX_FEATURE_VIDEO_CODEC_RV40"):
1797+ static_plugin_list[-1:-1] = ["drvc"]
1798+ if project.IsDefined("HELIX_FEATURE_ANSIC_RV89COMBO"):
1799+ project.AddLibraries(GetSDKPath("rv89combo_c_libs")+"[drvc]")
1800+ else:
1801+ project.AddLibraries(GetSDKPath("rv89combo_libs")+"[drvclib]")
1802+
1803+ if project.IsDefined("HELIX_FEATURE_VIDEO_CODEC_RV30"):
1804+ static_plugin_list[-1:-1] = ["rv30"]
1805+ project.AddLibraries(GetSDKPath("rv89combo_libs")+"[rv3xlib]")
1806+ project.AddModuleLibraries("datatype/rm/video/codec/rv89combo[rv30]")
1807+
1808+ if project.IsDefined("HELIX_FEATURE_VIDEO_CODEC_RV40"):
1809+ static_plugin_list[-1:-1] = ["rv40"]
1810+ project.AddLibraries(GetSDKPath("rv89combo_libs")+"[rv4xlib]")
1811+ project.AddModuleLibraries("datatype/rm/video/codec/rv89combo[rv40]")
1812+
1813+# if project.IsDefined("HELIX_FEATURE_AUDIO_CODEC_AAC"):
1814+# static_plugin_list[-1:-1] = ["aac4"]
1815+
1816+ CreateStaticPluginTable(static_plugin_list)
1817+
1818+project.ExportFunction("init_main", "void")
1819+project.ExportFunction("deinit_main", "void")
1820+project.ExportFunction("get_player", "void **ppPlayer",
1821+ "on_buffering_cb_t on_buffering_cb",
1822+ "on_pos_length_cb_t on_pos_length_cb")
1823+project.ExportFunction("player_openurl", "void *pPlayerHandle",
1824+ "char *pszRawURL")
1825+project.ExportFunction("put_player", "void *pPlayerHandle")
1826+project.ExportFunction("player_geturl", "void *pPlayerHandle", "char **pszURL")
1827+project.ExportFunction("player_begin", "void *pPlayerHandle")
1828+project.ExportFunction("player_stop", "void *pPlayerHandle")
1829+project.ExportFunction("player_pause", "void *pPlayerHandle")
1830+project.ExportFunction("player_seek", "void *pPlayerHandle", "int pos")
1831+project.ExportFunction("get_curr_playtime", "void *pPlayerHandle")
1832+project.ExportFunction("player_getvolume", "void *pPlayerHandle")
1833+project.ExportFunction("player_canseek", "void *pPlayerHandle")
1834+project.ExportFunction("player_setvolume", "void *pPlayerHandle", "unsigned short volumn")
1835+
1836+
1837+
1838+DLLTarget('libhelix-player')
1839+
1840+DependTarget()
1841+
1842Index: helix-libs/clientapps/clutter/exabd.cpp
1843===================================================================
1844--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1845+++ helix-libs/clientapps/clutter/exabd.cpp 2008-10-13 06:05:49.000000000 -0700
1846@@ -0,0 +1,245 @@
1847+/* ***** BEGIN LICENSE BLOCK *****
1848+ * Version: RCSL 1.0/RPSL 1.0
1849+ *
1850+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
1851+ *
1852+ * The contents of this file, and the files included with this file, are
1853+ * subject to the current version of the RealNetworks Public Source License
1854+ * Version 1.0 (the "RPSL") available at
1855+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
1856+ * the file under the RealNetworks Community Source License Version 1.0
1857+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
1858+ * in which case the RCSL will apply. You may also obtain the license terms
1859+ * directly from RealNetworks. You may not use this file except in
1860+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
1861+ * applicable to this file, the RCSL. Please see the applicable RPSL or
1862+ * RCSL for the rights, obligations and limitations governing use of the
1863+ * contents of the file.
1864+ *
1865+ * This file is part of the Helix DNA Technology. RealNetworks is the
1866+ * developer of the Original Code and owns the copyrights in the portions
1867+ * it created.
1868+ *
1869+ * This file, and the files included with this file, is distributed and made
1870+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1871+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1872+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
1873+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1874+ *
1875+ * Technology Compatibility Kit Test Suite(s) Location:
1876+ * http://www.helixcommunity.org/content/tck
1877+ *
1878+ * Contributor(s):
1879+ *
1880+ * ***** END LICENSE BLOCK ***** */
1881+
1882+#include <stdio.h>
1883+
1884+#include "hxtypes.h"
1885+
1886+#include "hxcom.h"
1887+#include "hxcomm.h"
1888+#include "hxmon.h"
1889+#include "hxcore.h"
1890+#include "hxengin.h"
1891+#include "chxpckts.h"
1892+#include "hxclsnk.h"
1893+#include "hxstrutl.h"
1894+#include "exabd.h"
1895+
1896+#include "print.h"
1897+
1898+#include "globals.h"
1899+
1900+struct _stGlobals*& GetGlobal(); //in main.cpp
1901+
1902+ExampleABD::ExampleABD(IUnknown* pUnknown)
1903+ : m_lRefCount (0)
1904+ , m_pUnknown (NULL)
1905+ , m_ulABDStartTime(0)
1906+ , m_ulABDResult(0)
1907+ , m_bABDDone(FALSE)
1908+{
1909+ if (pUnknown)
1910+ {
1911+ m_pUnknown = pUnknown;
1912+ m_pUnknown->AddRef();
1913+ }
1914+}
1915+
1916+ExampleABD::~ExampleABD(void)
1917+{
1918+ HX_RELEASE(m_pUnknown);
1919+}
1920+
1921+
1922+// *** IUnknown methods ***
1923+
1924+/////////////////////////////////////////////////////////////////////////
1925+// Method:
1926+// IUnknown::QueryInterface
1927+// Purpose:
1928+// Implement this to export the interfaces supported by your
1929+// object.
1930+//
1931+STDMETHODIMP ExampleABD::QueryInterface(REFIID riid, void** ppvObj)
1932+{
1933+ if (IsEqualIID(riid, IID_IUnknown))
1934+ {
1935+ AddRef();
1936+ *ppvObj = (IUnknown*)(IHXAutoBWCalibrationAdviseSink*)this;
1937+ return HXR_OK;
1938+ }
1939+ else if (IsEqualIID(riid, IID_IHXAutoBWCalibrationAdviseSink))
1940+ {
1941+ AddRef();
1942+ *ppvObj = (IHXAutoBWCalibrationAdviseSink*)this;
1943+ return HXR_OK;
1944+ }
1945+
1946+ *ppvObj = NULL;
1947+ return HXR_NOINTERFACE;
1948+}
1949+
1950+/////////////////////////////////////////////////////////////////////////
1951+// Method:
1952+// IUnknown::AddRef
1953+// Purpose:
1954+// Everyone usually implements this the same... feel free to use
1955+// this implementation.
1956+//
1957+STDMETHODIMP_(ULONG32) ExampleABD::AddRef()
1958+{
1959+ return InterlockedIncrement(&m_lRefCount);
1960+}
1961+
1962+/////////////////////////////////////////////////////////////////////////
1963+// Method:
1964+// IUnknown::Release
1965+// Purpose:
1966+// Everyone usually implements this the same... feel free to use
1967+// this implementation.
1968+//
1969+STDMETHODIMP_(ULONG32) ExampleABD::Release()
1970+{
1971+ if (InterlockedDecrement(&m_lRefCount) > 0)
1972+ {
1973+ return m_lRefCount;
1974+ }
1975+
1976+ delete this;
1977+ return 0;
1978+}
1979+
1980+/*
1981+ * IHXAutoBWCalibrationAdviseSink methods
1982+ */
1983+STDMETHODIMP
1984+ExampleABD::AutoBWCalibrationStarted (const char* pszServer)
1985+{
1986+ if (pszServer)
1987+ {
1988+ STDOUT("ABD: contacting %s\n", pszServer);
1989+ }
1990+
1991+ return HXR_OK;
1992+}
1993+
1994+STDMETHODIMP
1995+ExampleABD::AutoBWCalibrationDone(HX_RESULT status,
1996+ UINT32 ulBW)
1997+{
1998+ m_bABDDone = TRUE;
1999+
2000+ if (HXR_OK == status)
2001+ {
2002+ m_ulABDResult = ulBW;
2003+ STDOUT("ABD: %lu(Kbps) %lu(ms)\n", ulBW, GetTickCount() - m_ulABDStartTime);
2004+ }
2005+ else
2006+ {
2007+ STDOUT("ABD failed: %lu\n", status);
2008+ }
2009+
2010+ return HXR_OK;
2011+}
2012+
2013+HX_RESULT
2014+ExampleABD::DoABD(const char* pszServer,
2015+ UINT32 mode,
2016+ UINT32 packetSize,
2017+ UINT32 packetNum)
2018+{
2019+ HX_RESULT rc = HXR_OK;
2020+ UINT32 length = 0;
2021+ IHXAutoBWCalibration* pABD = NULL;
2022+ IHXValues* pValues = NULL;
2023+ IHXBuffer* pBuffer = NULL;
2024+
2025+ m_ulABDStartTime = GetTickCount();
2026+ m_ulABDResult = 0;
2027+ m_bABDDone = FALSE;
2028+
2029+ if (m_pUnknown &&
2030+ HXR_OK == m_pUnknown->QueryInterface(IID_IHXAutoBWCalibration, (void**)&pABD))
2031+ {
2032+ pValues = (IHXValues*) new CHXHeader();
2033+ pValues->AddRef();
2034+
2035+ pBuffer = (IHXBuffer*) new CHXBuffer();
2036+ pBuffer->AddRef();
2037+
2038+ pBuffer->Set((UCHAR*)pszServer, strlen(pszServer)+1);
2039+ pValues->SetPropertyCString("ABDServers", pBuffer);
2040+
2041+ pValues->SetPropertyULONG32("AutoBWDetectionMode", mode);
2042+ pValues->SetPropertyULONG32("AutoBWDetectionPacketSize", packetSize);
2043+ pValues->SetPropertyULONG32("AutoBWDetectionPackets", packetNum);
2044+
2045+ pABD->AddAutoBWCalibrationSink((IHXAutoBWCalibrationAdviseSink*)this);
2046+ pABD->InitAutoBWCalibration(pValues);
2047+
2048+ pABD->StartAutoBWCalibration();
2049+
2050+ while (!m_bABDDone)
2051+ {
2052+ MSG msg;
2053+ DWORD starttime, endtime, i;
2054+ BOOL sleep = TRUE;
2055+ static const int checkinterval = 10;
2056+
2057+ starttime = GetTickCount();
2058+ endtime = starttime + (20);
2059+ i = 0;
2060+ while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
2061+ {
2062+ DispatchMessage(&msg);
2063+ if ((i % checkinterval) == 0)
2064+ {
2065+ if (GetTickCount() > endtime)
2066+ break;
2067+ ++i;
2068+ }
2069+ sleep = FALSE;
2070+ }
2071+
2072+ if (sleep)
2073+ Sleep(10);
2074+ }
2075+ }
2076+
2077+cleanup:
2078+
2079+ if (pABD)
2080+ {
2081+ pABD->RemoveAutoBWCalibrationSink((IHXAutoBWCalibrationAdviseSink*)this);
2082+ }
2083+
2084+ HX_RELEASE(pBuffer);
2085+ HX_RELEASE(pValues);
2086+ HX_RELEASE(pABD);
2087+
2088+ return rc;
2089+}
2090+
2091+
2092Index: helix-libs/clientapps/clutter/exabd.h
2093===================================================================
2094--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2095+++ helix-libs/clientapps/clutter/exabd.h 2008-10-13 06:05:49.000000000 -0700
2096@@ -0,0 +1,85 @@
2097+/* ***** BEGIN LICENSE BLOCK *****
2098+ * Version: RCSL 1.0/RPSL 1.0
2099+ *
2100+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
2101+ *
2102+ * The contents of this file, and the files included with this file, are
2103+ * subject to the current version of the RealNetworks Public Source License
2104+ * Version 1.0 (the "RPSL") available at
2105+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
2106+ * the file under the RealNetworks Community Source License Version 1.0
2107+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
2108+ * in which case the RCSL will apply. You may also obtain the license terms
2109+ * directly from RealNetworks. You may not use this file except in
2110+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
2111+ * applicable to this file, the RCSL. Please see the applicable RPSL or
2112+ * RCSL for the rights, obligations and limitations governing use of the
2113+ * contents of the file.
2114+ *
2115+ * This file is part of the Helix DNA Technology. RealNetworks is the
2116+ * developer of the Original Code and owns the copyrights in the portions
2117+ * it created.
2118+ *
2119+ * This file, and the files included with this file, is distributed and made
2120+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
2121+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
2122+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
2123+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
2124+ *
2125+ * Technology Compatibility Kit Test Suite(s) Location:
2126+ * http://www.helixcommunity.org/content/tck
2127+ *
2128+ * Contributor(s):
2129+ *
2130+ * ***** END LICENSE BLOCK ***** */
2131+
2132+#ifndef _EXAMPLEABD_
2133+#define _EXAMPLEABD_
2134+
2135+struct IHXAutoBWCalibrationAdviseSink;
2136+struct IUnknown;
2137+
2138+class ExampleABD : public IHXAutoBWCalibrationAdviseSink
2139+{
2140+ private:
2141+ LONG32 m_lRefCount;
2142+ IUnknown* m_pUnknown;
2143+ UINT32 m_ulABDStartTime;
2144+ UINT32 m_ulABDResult;
2145+ BOOL m_bABDDone;
2146+
2147+ ~ExampleABD();
2148+
2149+ public:
2150+
2151+ ExampleABD(IUnknown* /*IN*/ pUnknown);
2152+
2153+ /*
2154+ * IUnknown methods
2155+ */
2156+ STDMETHOD(QueryInterface) (THIS_
2157+ REFIID riid,
2158+ void** ppvObj);
2159+
2160+ STDMETHOD_(ULONG32,AddRef) (THIS);
2161+
2162+ STDMETHOD_(ULONG32,Release) (THIS);
2163+
2164+ /*
2165+ * IHXAutoBWCalibrationAdviseSink methods
2166+ */
2167+ STDMETHOD(AutoBWCalibrationStarted) (THIS_
2168+ const char* pszServer);
2169+ STDMETHOD(AutoBWCalibrationDone) (THIS_
2170+ HX_RESULT status,
2171+ UINT32 ulBW);
2172+
2173+ HX_RESULT DoABD(const char* pszServer,
2174+ UINT32 mode,
2175+ UINT32 packetSize,
2176+ UINT32 packetNum);
2177+
2178+ UINT32 GetABD(void) { return m_ulABDResult; };
2179+};
2180+
2181+#endif /* _EXAMPLEABDSNK_ */
2182Index: helix-libs/clientapps/clutter/exadvsnk.cpp
2183===================================================================
2184--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2185+++ helix-libs/clientapps/clutter/exadvsnk.cpp 2008-10-13 06:05:49.000000000 -0700
2186@@ -0,0 +1,1116 @@
2187+/* ***** BEGIN LICENSE BLOCK *****
2188+ * Version: RCSL 1.0/RPSL 1.0
2189+ *
2190+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
2191+ *
2192+ * The contents of this file, and the files included with this file, are
2193+ * subject to the current version of the RealNetworks Public Source License
2194+ * Version 1.0 (the "RPSL") available at
2195+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
2196+ * the file under the RealNetworks Community Source License Version 1.0
2197+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
2198+ * in which case the RCSL will apply. You may also obtain the license terms
2199+ * directly from RealNetworks. You may not use this file except in
2200+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
2201+ * applicable to this file, the RCSL. Please see the applicable RPSL or
2202+ * RCSL for the rights, obligations and limitations governing use of the
2203+ * contents of the file.
2204+ *
2205+ * This file is part of the Helix DNA Technology. RealNetworks is the
2206+ * developer of the Original Code and owns the copyrights in the portions
2207+ * it created.
2208+ *
2209+ * This file, and the files included with this file, is distributed and made
2210+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
2211+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
2212+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
2213+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
2214+ *
2215+ * Technology Compatibility Kit Test Suite(s) Location:
2216+ * http://www.helixcommunity.org/content/tck
2217+ *
2218+ * Contributor(s):
2219+ *
2220+ * ***** END LICENSE BLOCK ***** */
2221+
2222+#include <stdio.h>
2223+
2224+#include "hxtypes.h"
2225+
2226+#include "hxcom.h"
2227+#include "hxcomm.h"
2228+#include "hxmon.h"
2229+#include "hxcore.h"
2230+#include "hxengin.h"
2231+#include "hxclsnk.h"
2232+#include "hxgroup.h"
2233+#include "hxstrutl.h"
2234+#include "exadvsnk.h"
2235+#include "hxstring.h"
2236+#include "hxprefs.h"
2237+#include "excontxt.h"
2238+
2239+#include "print.h"
2240+
2241+#include "globals.h"
2242+#include "player.h"
2243+
2244+struct _stGlobals*& GetGlobal(); //in main.cpp
2245+
2246+#ifdef __TCS__
2247+extern unsigned long gStreamTime;
2248+
2249+static int iOpened = 0;
2250+
2251+
2252+#if defined(__cplusplus)
2253+extern "C" {
2254+#endif /* defined(__cplusplus) */
2255+
2256+typedef enum hookBuffering {
2257+ eContacting = 0,
2258+ eConnecting = 1,
2259+ eBuffering = 2,
2260+ ePlaying = 3
2261+}hookBuffering;
2262+
2263+void hookRealAudio_Buffering(hookBuffering connectState, int pct);
2264+
2265+void hookRealAudio_PlayPosition(unsigned long current,unsigned long duration);
2266+
2267+typedef enum hookState {
2268+ ePlay = 0,
2269+ ePause = 1,
2270+ eStop = 2,
2271+ eResume = 3,
2272+ eComplete // Clip is done playing
2273+}hookState;
2274+void hookRealAudio_State(hookState newState);
2275+
2276+
2277+#if defined(__cplusplus)
2278+}
2279+#endif /* defined(__cplusplus) */
2280+
2281+#endif // __TCS__
2282+
2283+void PrintBuffer(const char* pszName,const unsigned char* pbBuf, unsigned int dwBytes);
2284+
2285+ExampleClientAdviceSink::ExampleClientAdviceSink(IUnknown* pUnknown, LONG32 lClientIndex, on_buffering_cb_t on_buffering_cb, on_pos_length_cb_t on_pos_length_cb, void *context)
2286+ : m_lRefCount (0)
2287+ , m_lClientIndex (lClientIndex)
2288+ , m_pUnknown (NULL)
2289+ , m_pRegistry (NULL)
2290+ , m_pScheduler (NULL)
2291+ , m_lCurrentBandwidth(0)
2292+ , m_lAverageBandwidth(0)
2293+ , m_bOnStop(0)
2294+ , m_pPlayer(0)
2295+ , m_bWaitForTrackStart(0)
2296+ , m_on_buffering_cb(on_buffering_cb)
2297+ , m_on_pos_length_cb(on_pos_length_cb)
2298+ , m_context(context)
2299+{
2300+ if (pUnknown)
2301+ {
2302+ m_pUnknown = pUnknown;
2303+ m_pUnknown->AddRef();
2304+
2305+ if (HXR_OK != m_pUnknown->QueryInterface(IID_IHXRegistry, (void**)&m_pRegistry))
2306+ {
2307+ m_pRegistry = NULL;
2308+ }
2309+
2310+ if (HXR_OK != m_pUnknown->QueryInterface(IID_IHXScheduler, (void**)&m_pScheduler))
2311+ {
2312+ m_pScheduler = NULL;
2313+ }
2314+
2315+ IHXPlayer* pPlayer;
2316+ if(HXR_OK == m_pUnknown->QueryInterface(IID_IHXPlayer,
2317+ (void**)&pPlayer))
2318+ {
2319+ m_pPlayer = pPlayer;
2320+
2321+ IHXGroupManager* pGroupMgr = NULL;
2322+ if(HXR_OK == m_pPlayer->QueryInterface(IID_IHXGroupManager,
2323+ (void**)&pGroupMgr))
2324+ {
2325+ pGroupMgr->AddSink((IHXGroupSink*)this);
2326+ pGroupMgr->Release();
2327+ }
2328+
2329+ pPlayer->AddAdviseSink(this);
2330+
2331+ }
2332+ }
2333+
2334+#ifdef __TCS__
2335+ bEnableAdviceSink = TRUE;
2336+ iOpened = 0;
2337+#endif
2338+}
2339+
2340+ExampleClientAdviceSink::~ExampleClientAdviceSink(void)
2341+{
2342+ if (m_pScheduler)
2343+ {
2344+ m_pScheduler->Release();
2345+ m_pScheduler = NULL;
2346+ }
2347+
2348+ if (m_pRegistry)
2349+ {
2350+ m_pRegistry->Release();
2351+ m_pRegistry = NULL;
2352+ }
2353+
2354+ if (m_pPlayer)
2355+ {
2356+ m_pPlayer->Release();
2357+ m_pPlayer = NULL;
2358+ }
2359+ if (m_pUnknown)
2360+ {
2361+ m_pUnknown->Release();
2362+ m_pUnknown = NULL;
2363+ }
2364+}
2365+
2366+
2367+// *** IUnknown methods ***
2368+
2369+/////////////////////////////////////////////////////////////////////////
2370+// Method:
2371+// IUnknown::QueryInterface
2372+// Purpose:
2373+// Implement this to export the interfaces supported by your
2374+// object.
2375+//
2376+STDMETHODIMP ExampleClientAdviceSink::QueryInterface(REFIID riid, void** ppvObj)
2377+{
2378+ if (IsEqualIID(riid, IID_IUnknown))
2379+ {
2380+ AddRef();
2381+ *ppvObj = (IUnknown*)(IHXClientAdviseSink*)this;
2382+ return HXR_OK;
2383+ }
2384+ else if (IsEqualIID(riid, IID_IHXClientAdviseSink))
2385+ {
2386+ AddRef();
2387+ *ppvObj = (IHXClientAdviseSink*)this;
2388+ return HXR_OK;
2389+ }
2390+ else if (IsEqualIID(riid, IID_IHXGroupSink))
2391+ {
2392+ AddRef();
2393+ *ppvObj = (IHXGroupSink*)this;
2394+ return HXR_OK;
2395+ }
2396+
2397+ *ppvObj = NULL;
2398+ return HXR_NOINTERFACE;
2399+}
2400+
2401+/////////////////////////////////////////////////////////////////////////
2402+// Method:
2403+// IUnknown::AddRef
2404+// Purpose:
2405+// Everyone usually implements this the same... feel free to use
2406+// this implementation.
2407+//
2408+STDMETHODIMP_(ULONG32) ExampleClientAdviceSink::AddRef()
2409+{
2410+ return InterlockedIncrement(&m_lRefCount);
2411+}
2412+
2413+/////////////////////////////////////////////////////////////////////////
2414+// Method:
2415+// IUnknown::Release
2416+// Purpose:
2417+// Everyone usually implements this the same... feel free to use
2418+// this implementation.
2419+//
2420+STDMETHODIMP_(ULONG32) ExampleClientAdviceSink::Release()
2421+{
2422+ if (InterlockedDecrement(&m_lRefCount) > 0)
2423+ {
2424+ return m_lRefCount;
2425+ }
2426+
2427+ delete this;
2428+ return 0;
2429+}
2430+
2431+/*
2432+ * IHXClientAdviseSink methods
2433+ */
2434+
2435+/************************************************************************
2436+ * Method:
2437+ * IHXClientAdviseSink::OnPosLength
2438+ * Purpose:
2439+ * Called to advise the client that the position or length of the
2440+ * current playback context has changed.
2441+ */
2442+
2443+#ifdef __TCS__
2444+static long lastPosition = -1;
2445+#endif
2446+
2447+STDMETHODIMP
2448+ExampleClientAdviceSink::OnPosLength(UINT32 ulPosition,
2449+ UINT32 ulLength)
2450+{
2451+ // Are we doing a multi-seek?
2452+ if (GetGlobal()->g_bMultiSeek)
2453+ {
2454+ // Have we run out of seek times?
2455+ if (GetGlobal()->g_ulMultiSeekIndex < GetGlobal()->g_ulNumMultiSeeks)
2456+ {
2457+ STDOUT("Multi-seeking the first player to %lu\n",
2458+ GetGlobal()->g_ulMultiSeekTime[GetGlobal()->g_ulMultiSeekIndex]);
2459+ GetGlobal()->g_Players[0]->Seek(GetGlobal()->g_ulMultiSeekTime[GetGlobal()->g_ulMultiSeekIndex++]);
2460+ }
2461+ else
2462+ {
2463+ // We've run out - stop the multi-seek
2464+ GetGlobal()->g_bMultiSeek = FALSE;
2465+ GetGlobal()->g_ulNumMultiSeeks = 0;
2466+ GetGlobal()->g_ulMultiSeekIndex = 0;
2467+ }
2468+ }
2469+
2470+ if (m_on_pos_length_cb)
2471+ m_on_pos_length_cb(ulPosition, ulLength, m_context);
2472+
2473+ return HXR_OK;
2474+}
2475+
2476+/************************************************************************
2477+ * Method:
2478+ * IHXClientAdviseSink::OnPresentationOpened
2479+ * Purpose:
2480+ * Called to advise the client a presentation has been opened.
2481+ */
2482+STDMETHODIMP ExampleClientAdviceSink::OnPresentationOpened()
2483+{
2484+#ifdef __TCS__
2485+ iOpened = 1;
2486+ lastPosition = -1;
2487+#else
2488+ if (GetGlobal()->bEnableAdviceSink)
2489+ {
2490+ STDOUT("OnPresentationOpened()\n");
2491+ }
2492+#if defined(HELIX_FEATURE_PLAYBACK_VELOCITY)
2493+ // Try to get the IHXPlaybackVelocity interface
2494+ // from the first player
2495+ if (GetGlobal()->g_nPlayers > 0 && GetGlobal()->g_Players[0])
2496+ {
2497+ IHXPlaybackVelocity* pVel = NULL;
2498+ HX_RESULT rv = GetGlobal()->g_Players[0]->QueryInterface(IID_IHXPlaybackVelocity, (void**) &pVel);
2499+ if (SUCCEEDED(rv))
2500+ {
2501+ // Get the capabilities object from the player
2502+ rv = pVel->QueryVelocityCaps(GetGlobal()->g_pVelocityCaps);
2503+ if (SUCCEEDED(rv) && GetGlobal()->bEnableAdviceSink)
2504+ {
2505+ STDOUT("Available Velocity Ranges:");
2506+ UINT32 ulNumRanges = GetGlobal()->g_pVelocityCaps->GetNumRanges();
2507+ for (UINT32 i = 0; i < ulNumRanges && SUCCEEDED(rv); i++)
2508+ {
2509+ INT32 lMin = 0;
2510+ INT32 lMax = 0;
2511+ rv = GetGlobal()->g_pVelocityCaps->GetRange(i, lMin, lMax);
2512+ if (SUCCEEDED(rv))
2513+ {
2514+ STDOUT(" [%ld,%ld]", lMin, lMax);
2515+ }
2516+ }
2517+ STDOUT("\n");
2518+ }
2519+ }
2520+ HX_RELEASE(pVel);
2521+ }
2522+#endif /* #if defined(HELIX_FEATURE_PLAYBACK_VELOCITY) */
2523+#endif
2524+
2525+ UINT32 sourceCount = m_pPlayer->GetSourceCount();
2526+ for (UINT32 sourceID = 0; sourceID < sourceCount; sourceID ++)
2527+ {
2528+ // get HXSource
2529+ IUnknown* pUnkSource = NULL;
2530+ IHXStreamSource* pStreamSrc = NULL;
2531+
2532+ if (HXR_OK != m_pPlayer->GetSource (sourceID, pUnkSource))
2533+ {
2534+ continue;
2535+ }
2536+
2537+ pUnkSource->QueryInterface(IID_IHXStreamSource, (void **)&pStreamSrc);
2538+
2539+ HX_RELEASE(pUnkSource);
2540+
2541+ if (!pStreamSrc)
2542+ {
2543+ continue;
2544+ }
2545+
2546+ UINT32 num_streams = pStreamSrc->GetStreamCount();
2547+
2548+ // get information from Streams
2549+ for (UINT32 streamID = 0; streamID < num_streams ; streamID++)
2550+ {
2551+ IUnknown* pUnkStream = NULL;
2552+
2553+ if (HXR_OK == pStreamSrc->GetStream(streamID, pUnkStream))
2554+ {
2555+ IHXStream* pStream = NULL;
2556+
2557+ if (HXR_OK == pUnkStream->QueryInterface(IID_IHXStream,
2558+ (void**)&pStream))
2559+ {
2560+ const char* pMimeType = pStream->GetStreamType();
2561+ if( 0 == strcmp(pMimeType, "application/ram"))
2562+ {
2563+ m_bWaitForTrackStart = TRUE;
2564+ }
2565+ else
2566+ {
2567+ m_bWaitForTrackStart = FALSE;
2568+ }
2569+ }
2570+ HX_RELEASE(pStream);
2571+ }
2572+ HX_RELEASE(pUnkStream);
2573+ if (!m_bWaitForTrackStart)
2574+ {
2575+ break;
2576+ }
2577+ }
2578+
2579+ if (!m_bWaitForTrackStart)
2580+ {
2581+ break;
2582+ }
2583+ HX_RELEASE(pStreamSrc);
2584+ }
2585+
2586+ if (!m_bWaitForTrackStart)
2587+ {
2588+ STDOUT("----------------clip info--------------------\n");
2589+ if(m_pScheduler) {
2590+ m_hCallback = m_pScheduler->RelativeEnter(this,50);
2591+ }
2592+ }
2593+ return HXR_OK;
2594+}
2595+
2596+
2597+/************************************************************************
2598+ * Method:
2599+ * IHXClientAdviseSink::OnPresentationClosed
2600+ * Purpose:
2601+ * Called to advise the client a presentation has been closed.
2602+ */
2603+STDMETHODIMP ExampleClientAdviceSink::OnPresentationClosed()
2604+{
2605+#ifdef __TCS__
2606+ iOpened = 0;
2607+ lastPosition = -1;
2608+#else
2609+ if (GetGlobal()->bEnableAdviceSink)
2610+ {
2611+ STDOUT("OnPresentationClosed()\n");
2612+ }
2613+#endif
2614+
2615+ return HXR_OK;
2616+}
2617+
2618+void ExampleClientAdviceSink::GetStatistics (char* pszRegistryKey)
2619+{
2620+ char szRegistryValue[MAX_DISPLAY_NAME] = {0}; /* Flawfinder: ignore */
2621+ INT32 lValue = 0;
2622+ INT32 i = 0;
2623+ INT32 lStatistics = 8;
2624+ UINT32 *plValue;
2625+
2626+#ifdef __TCS__
2627+ return; // DISABLED FOR NOW
2628+#endif
2629+
2630+ // collect statistic
2631+ for (i = 0; i < lStatistics; i++)
2632+ {
2633+ plValue = NULL;
2634+ switch (i)
2635+ {
2636+ case 0:
2637+ SafeSprintf(szRegistryValue, MAX_DISPLAY_NAME, "%s.Normal", pszRegistryKey);
2638+ break;
2639+ case 1:
2640+ SafeSprintf(szRegistryValue, MAX_DISPLAY_NAME, "%s.Recovered", pszRegistryKey);
2641+ break;
2642+ case 2:
2643+ SafeSprintf(szRegistryValue, MAX_DISPLAY_NAME, "%s.Received", pszRegistryKey);
2644+ break;
2645+ case 3:
2646+ SafeSprintf(szRegistryValue, MAX_DISPLAY_NAME, "%s.Lost", pszRegistryKey);
2647+ break;
2648+ case 4:
2649+ SafeSprintf(szRegistryValue, MAX_DISPLAY_NAME, "%s.Late", pszRegistryKey);
2650+ break;
2651+ case 5:
2652+ SafeSprintf(szRegistryValue, MAX_DISPLAY_NAME, "%s.ClipBandwidth", pszRegistryKey);
2653+ break;
2654+ case 6:
2655+ SafeSprintf(szRegistryValue, MAX_DISPLAY_NAME, "%s.AverageBandwidth", pszRegistryKey);
2656+ plValue = &m_lAverageBandwidth;
2657+ break;
2658+ case 7:
2659+ SafeSprintf(szRegistryValue, MAX_DISPLAY_NAME, "%s.CurrentBandwidth", pszRegistryKey);
2660+ plValue = &m_lCurrentBandwidth;
2661+ break;
2662+ default:
2663+ break;
2664+ }
2665+
2666+ m_pRegistry->GetIntByName(szRegistryValue, lValue);
2667+ if (plValue)
2668+ {
2669+ if (m_bOnStop || lValue == 0)
2670+ {
2671+ lValue = *plValue;
2672+ }
2673+ else
2674+ {
2675+ *plValue = lValue;
2676+ }
2677+ }
2678+ if (GetGlobal()->bEnableAdviceSink || (GetGlobal()->bEnableVerboseMode && m_bOnStop))
2679+ {
2680+ STDOUT("%s = %ld\n", szRegistryValue, lValue);
2681+ }
2682+ }
2683+}
2684+
2685+void ExampleClientAdviceSink::GetAllStatistics(void)
2686+{
2687+ UINT32 unPlayerIndex = 0;
2688+ UINT32 unSourceIndex = 0;
2689+ UINT32 unStreamIndex = 0;
2690+
2691+ char* pszRegistryPrefix = "Statistics";
2692+ char szRegistryName[MAX_DISPLAY_NAME] = {0}; /* Flawfinder: ignore */
2693+
2694+#ifdef __TCS__
2695+ return; // DISABLED FOR NOW
2696+#endif
2697+
2698+ // display the content of whole statistic registry
2699+ if (m_pRegistry)
2700+ {
2701+ // ok, let's start from the top (player)
2702+ SafeSprintf(szRegistryName, MAX_DISPLAY_NAME, "%s.Player%ld", pszRegistryPrefix, m_lClientIndex);
2703+ if (PT_COMPOSITE == m_pRegistry->GetTypeByName(szRegistryName))
2704+ {
2705+ // display player statistic
2706+ GetStatistics(szRegistryName);
2707+
2708+ SafeSprintf(szRegistryName, MAX_DISPLAY_NAME, "%s.Source%ld", szRegistryName, unSourceIndex);
2709+ while (PT_COMPOSITE == m_pRegistry->GetTypeByName(szRegistryName))
2710+ {
2711+ // display source statistic
2712+ GetStatistics(szRegistryName);
2713+
2714+ SafeSprintf(szRegistryName, MAX_DISPLAY_NAME, "%s.Stream%ld", szRegistryName, unStreamIndex);
2715+ while (PT_COMPOSITE == m_pRegistry->GetTypeByName(szRegistryName))
2716+ {
2717+ // display stream statistic
2718+ GetStatistics(szRegistryName);
2719+
2720+ unStreamIndex++;
2721+
2722+ SafeSprintf(szRegistryName, MAX_DISPLAY_NAME, "%s.Player%ld.Source%ld.Stream%ld",
2723+ pszRegistryPrefix, unPlayerIndex, unSourceIndex, unStreamIndex);
2724+ }
2725+
2726+ unSourceIndex++;
2727+
2728+ SafeSprintf(szRegistryName, MAX_DISPLAY_NAME, "%s.Player%ld.Source%ld",
2729+ pszRegistryPrefix, unPlayerIndex, unSourceIndex);
2730+ }
2731+
2732+ unPlayerIndex++;
2733+
2734+ SafeSprintf(szRegistryName, MAX_DISPLAY_NAME, "%s.Player%ld", pszRegistryPrefix, unPlayerIndex);
2735+ }
2736+ }
2737+}
2738+
2739+/************************************************************************
2740+ * Method:
2741+ * IHXClientAdviseSink::OnStatisticsChanged
2742+ * Purpose:
2743+ * Called to advise the client that the presentation statistics
2744+ * have changed.
2745+ */
2746+STDMETHODIMP ExampleClientAdviceSink::OnStatisticsChanged(void)
2747+{
2748+ char szBuff[1024]; /* Flawfinder: ignore */
2749+ HX_RESULT res = HXR_OK;
2750+ UINT16 uPlayer = 0;
2751+
2752+#ifdef __TCS__
2753+ return HXR_OK; // DISABLED FOR NOW
2754+#endif
2755+
2756+ if(GetGlobal()->bEnableAdviceSink)
2757+ {
2758+ STDOUT("OnStatisticsChanged():\n");
2759+
2760+ SafeSprintf(szBuff, 1024, "Statistics");
2761+ res = DumpRegTree( szBuff );
2762+ }
2763+
2764+ return HXR_OK;
2765+}
2766+
2767+HX_RESULT ExampleClientAdviceSink::DumpRegTree(const char* pszTreeName )
2768+{
2769+ const char* pszName = NULL;
2770+ ULONG32 ulRegID = 0;
2771+ HX_RESULT res = HXR_OK;
2772+ INT32 nVal = 0;
2773+ IHXBuffer* pBuff = NULL;
2774+ IHXValues* pValues = NULL;
2775+
2776+ //See if the name exists in the reg tree.
2777+ res = m_pRegistry->GetPropListByName( pszTreeName, pValues);
2778+ if( HXR_OK!=res || !pValues )
2779+ return HXR_FAIL;
2780+
2781+ //make sure this is a PT_COMPOSITE type reg entry.
2782+ if( PT_COMPOSITE != m_pRegistry->GetTypeByName(pszTreeName))
2783+ return HXR_FAIL;
2784+
2785+ //Print out the value of each member of this tree.
2786+ res = pValues->GetFirstPropertyULONG32( pszName, ulRegID );
2787+ while( HXR_OK == res )
2788+ {
2789+ //We have at least one entry. See what type it is.
2790+ HXPropType pt = m_pRegistry->GetTypeById(ulRegID);
2791+ switch(pt)
2792+ {
2793+ case PT_COMPOSITE:
2794+ DumpRegTree(pszName);
2795+ break;
2796+ case PT_INTEGER :
2797+ nVal = 0;
2798+ m_pRegistry->GetIntById( ulRegID, nVal );
2799+ STDOUT("%s : %d\n", pszName, nVal );
2800+ break;
2801+ case PT_INTREF :
2802+ nVal = 0;
2803+ m_pRegistry->GetIntById( ulRegID, nVal );
2804+ STDOUT("%s : %d\n", pszName, nVal );
2805+ break;
2806+ case PT_STRING :
2807+ pBuff = NULL;
2808+ m_pRegistry->GetStrById( ulRegID, pBuff );
2809+ STDOUT("%s : \"", pszName );
2810+ if( pBuff )
2811+ STDOUT("%s", (const char *)(pBuff->GetBuffer()) );
2812+ STDOUT("\"\n" );
2813+ HX_RELEASE(pBuff);
2814+ break;
2815+ case PT_BUFFER :
2816+ STDOUT("%s : BUFFER TYPE NOT SHOWN\n",
2817+ pszName, nVal );
2818+ break;
2819+ case PT_UNKNOWN:
2820+ STDOUT("%s Unkown registry type entry\n", pszName );
2821+ break;
2822+ default:
2823+ STDOUT("%s Unkown registry type entry\n", pszName );
2824+ break;
2825+ }
2826+ res = pValues->GetNextPropertyULONG32( pszName, ulRegID);
2827+ }
2828+
2829+ HX_RELEASE( pValues );
2830+
2831+ return HXR_OK;
2832+}
2833+
2834+
2835+/************************************************************************
2836+ * Method:
2837+ * IHXClientAdviseSink::OnPreSeek
2838+ * Purpose:
2839+ * Called by client engine to inform the client that a seek is
2840+ * about to occur. The render is informed the last time for the
2841+ * stream's time line before the seek, as well as the first new
2842+ * time for the stream's time line after the seek will be completed.
2843+ *
2844+ */
2845+STDMETHODIMP ExampleClientAdviceSink::OnPreSeek( ULONG32 ulOldTime,
2846+ ULONG32 ulNewTime)
2847+{
2848+#if !defined(__TCS__)
2849+ if (GetGlobal()->bEnableAdviceSink)
2850+ {
2851+ STDOUT("OnPreSeek(%ld, %ld)\n", ulOldTime, ulNewTime);
2852+ }
2853+#endif
2854+
2855+ return HXR_OK;
2856+}
2857+
2858+
2859+/************************************************************************
2860+ * Method:
2861+ * IHXClientAdviseSink::OnPostSeek
2862+ * Purpose:
2863+ * Called by client engine to inform the client that a seek has
2864+ * just occured. The render is informed the last time for the
2865+ * stream's time line before the seek, as well as the first new
2866+ * time for the stream's time line after the seek.
2867+ *
2868+ */
2869+STDMETHODIMP ExampleClientAdviceSink::OnPostSeek( ULONG32 ulOldTime,
2870+ ULONG32 ulNewTime)
2871+{
2872+#ifdef __TCS__
2873+ lastPosition = -1;
2874+#else
2875+ if (GetGlobal()->bEnableAdviceSink)
2876+ {
2877+ STDOUT("OnPostSeek(%ld, %ld)\n", ulOldTime, ulNewTime);
2878+ }
2879+#endif
2880+
2881+ return HXR_OK;
2882+}
2883+
2884+
2885+/************************************************************************
2886+ * Method:
2887+ * IHXClientAdviseSink::OnStop
2888+ * Purpose:
2889+ * Called by client engine to inform the client that a stop has
2890+ * just occured.
2891+ *
2892+ */
2893+STDMETHODIMP ExampleClientAdviceSink::OnStop(void)
2894+{
2895+ HXTimeval now;
2896+
2897+#ifdef __TCS__
2898+ hookRealAudio_State(eStop);
2899+#else
2900+ if (GetGlobal()->bEnableAdviceSink)
2901+ {
2902+ STDOUT("OnStop()\n");
2903+ }
2904+
2905+ if (GetGlobal()->bEnableVerboseMode)
2906+ {
2907+ STDOUT("Player %ld stopped.\n", m_lClientIndex);
2908+ m_bOnStop = TRUE;
2909+ GetAllStatistics();
2910+ }
2911+#endif
2912+
2913+ // Find out the current time and subtract the beginning time to
2914+ // figure out how many seconds we played
2915+ now = m_pScheduler->GetCurrentSchedulerTime();
2916+ m_ulStopTime = now.tv_sec;
2917+
2918+ GetGlobal()->g_ulNumSecondsPlayed = m_ulStopTime - m_ulStartTime;
2919+
2920+ return HXR_OK;
2921+}
2922+
2923+/************************************************************************
2924+ * Method:
2925+ * IHXClientAdviseSink::OnPause
2926+ * Purpose:
2927+ * Called by client engine to inform the client that a pause has
2928+ * just occured. The render is informed the last time for the
2929+ * stream's time line before the pause.
2930+ *
2931+ */
2932+STDMETHODIMP ExampleClientAdviceSink::OnPause(ULONG32 ulTime)
2933+{
2934+#ifdef __TCS__
2935+ hookRealAudio_State(ePause);
2936+#else
2937+ if (GetGlobal()->bEnableAdviceSink)
2938+ {
2939+ STDOUT("OnPause(%ld)\n", ulTime);
2940+ }
2941+#endif
2942+
2943+ return HXR_OK;
2944+}
2945+
2946+
2947+/************************************************************************
2948+ * Method:
2949+ * IHXClientAdviseSink::OnBegin
2950+ * Purpose:
2951+ * Called by client engine to inform the client that a begin or
2952+ * resume has just occured. The render is informed the first time
2953+ * for the stream's time line after the resume.
2954+ *
2955+ */
2956+STDMETHODIMP ExampleClientAdviceSink::OnBegin(ULONG32 ulTime)
2957+{
2958+ HXTimeval now;
2959+
2960+#if !defined(__TCS__)
2961+ if (GetGlobal()->bEnableAdviceSink)
2962+ {
2963+ STDOUT("OnBegin(%ld)\n", ulTime);
2964+ }
2965+
2966+ if (GetGlobal()->bEnableVerboseMode)
2967+ {
2968+ STDOUT("Player %ld beginning playback...\n", m_lClientIndex);
2969+ }
2970+#endif
2971+
2972+ GetGlobal()->g_bOnBeginOccurred = TRUE;
2973+
2974+ // Record the current time, so we can figure out many seconds we played
2975+ now = m_pScheduler->GetCurrentSchedulerTime();
2976+ m_ulStartTime = now.tv_sec;
2977+
2978+ return HXR_OK;
2979+}
2980+
2981+
2982+/************************************************************************
2983+ * Method:
2984+ * IHXClientAdviseSink::OnBuffering
2985+ * Purpose:
2986+ * Called by client engine to inform the client that buffering
2987+ * of data is occuring. The render is informed of the reason for
2988+ * the buffering (start-up of stream, seek has occured, network
2989+ * congestion, etc.), as well as percentage complete of the
2990+ * buffering process.
2991+ *
2992+ */
2993+STDMETHODIMP ExampleClientAdviceSink::OnBuffering(ULONG32 ulFlags,
2994+ UINT16 unPercentComplete)
2995+{
2996+#ifdef __TCS__
2997+static UINT16 lastPct = 0;
2998+ if (unPercentComplete > 0)
2999+ {
3000+ UINT16 nextPct = lastPct + 10;
3001+ if (unPercentComplete < lastPct)
3002+ {
3003+ lastPct = 0;
3004+ nextPct = lastPct + 10;
3005+ }
3006+ if (unPercentComplete >= nextPct)
3007+ {
3008+ lastPct = (unPercentComplete / 10) * 10;
3009+ nextPct = lastPct + 10;
3010+ hookRealAudio_Buffering(eBuffering,lastPct);
3011+ }
3012+ }
3013+#else
3014+ if (GetGlobal()->bEnableAdviceSink)
3015+ {
3016+ STDOUT("OnBuffering(%ld, %d)\n", ulFlags, unPercentComplete);
3017+ }
3018+#endif
3019+ if (m_on_buffering_cb)
3020+ m_on_buffering_cb(ulFlags, unPercentComplete, m_context);
3021+
3022+ return HXR_OK;
3023+}
3024+
3025+
3026+/************************************************************************
3027+ * Method:
3028+ * IHXClientAdviseSink::OnContacting
3029+ * Purpose:
3030+ * Called by client engine to inform the client is contacting
3031+ * hosts(s).
3032+ *
3033+ */
3034+STDMETHODIMP ExampleClientAdviceSink::OnContacting(const char* pHostName)
3035+{
3036+#ifdef __TCS__
3037+ printf("Contacting\n");
3038+ hookRealAudio_Buffering(eContacting,0);
3039+#else
3040+ if (GetGlobal()->bEnableAdviceSink)
3041+ {
3042+ STDOUT("OnContacting(\"%s\")\n", pHostName);
3043+ }
3044+#endif
3045+
3046+ return HXR_OK;
3047+}
3048+
3049+void ExampleClientAdviceSink::PrintPropName( IHXValues* pHeader )
3050+{
3051+ if ( pHeader == NULL )
3052+ {
3053+ return ;
3054+ }
3055+
3056+ const char *pChar;
3057+ ULONG32 pValue;
3058+ if(HXR_OK == pHeader->GetFirstPropertyULONG32(pChar, pValue))
3059+ {
3060+ do
3061+ {
3062+ STDOUT("%s %d\n", pChar, pValue);
3063+ }
3064+ while(HXR_OK == pHeader->GetNextPropertyULONG32(pChar, pValue));
3065+ }
3066+
3067+ IHXBuffer *pBuffer;
3068+
3069+ if(HXR_OK == pHeader->GetFirstPropertyBuffer(pChar, pBuffer))
3070+ {
3071+ do
3072+ {
3073+ STDOUT("%s %s\n", pChar, (const char *) ( pBuffer->GetBuffer() ));
3074+ PrintBuffer(pChar, pBuffer->GetBuffer() ,pBuffer->GetSize());
3075+ HX_RELEASE(pBuffer);
3076+ } while(HXR_OK == pHeader->GetNextPropertyBuffer(pChar, pBuffer ));
3077+ }
3078+
3079+ if(HXR_OK == pHeader->GetFirstPropertyCString(pChar, pBuffer))
3080+ {
3081+ do
3082+ {
3083+ STDERR("%s %s\n", pChar, (const char *) ( pBuffer->GetBuffer() ));
3084+ HX_RELEASE(pBuffer);
3085+ } while(HXR_OK == pHeader->GetNextPropertyCString(pChar, pBuffer ));
3086+ }
3087+
3088+ fflush(stdout);
3089+}
3090+
3091+
3092+void ExampleClientAdviceSink::SetClipInfo( IHXPlayer* m_pRMAPlayer)
3093+{
3094+ bool bSendOnClipInfo = false;
3095+
3096+ // Get HXSource and try to get clip infor.
3097+ UINT32 sourceCount = m_pRMAPlayer->GetSourceCount();
3098+ for (UINT32 sourceID = 0; sourceID < sourceCount; sourceID ++)
3099+ {
3100+ // get HXSource
3101+ STDOUT("========Source %d========\n",sourceID);
3102+ IUnknown* pUnkSource = NULL;
3103+ IHXStreamSource* pStreamSrc = NULL;
3104+
3105+ if (HXR_OK != m_pRMAPlayer->GetSource (sourceID, pUnkSource))
3106+ {
3107+ continue;
3108+ }
3109+
3110+ pUnkSource->QueryInterface(IID_IHXStreamSource, (void **)&pStreamSrc);
3111+
3112+ HX_RELEASE(pUnkSource);
3113+
3114+ if (!pStreamSrc)
3115+ {
3116+ continue;
3117+ }
3118+
3119+ UINT32 num_streams = pStreamSrc->GetStreamCount();
3120+
3121+ STDOUT("====File Header====\n");
3122+
3123+ IHXValues* pFileHdr = NULL;
3124+ pStreamSrc->QueryInterface(IID_IHXValues, (void**)&pFileHdr);
3125+
3126+ if ( pFileHdr)
3127+ {
3128+ PrintPropName(pFileHdr);
3129+ }
3130+ HX_RELEASE(pFileHdr);
3131+
3132+ // get information from Streams
3133+ for (UINT32 streamID = 0; streamID < num_streams ; streamID++)
3134+ {
3135+ STDOUT("====Stream %d====\n",streamID);
3136+ IUnknown* pUnkStream = NULL;
3137+
3138+ if (HXR_OK == pStreamSrc->GetStream(streamID, pUnkStream))
3139+ {
3140+ IHXStream* pStream = NULL;
3141+
3142+ if (HXR_OK == pUnkStream->QueryInterface(IID_IHXStream,
3143+ (void**)&pStream))
3144+ {
3145+ IHXValues* pStreamHdr = pStream->GetHeader();
3146+ if (pStreamHdr)
3147+ {
3148+ PrintPropName(pStreamHdr);
3149+ }
3150+ HX_RELEASE(pStreamHdr);
3151+ }
3152+ HX_RELEASE(pStream);
3153+ }
3154+ HX_RELEASE(pUnkStream);
3155+ }
3156+ STDOUT("---------------------------------------------\n");
3157+
3158+ HX_RELEASE(pStreamSrc);
3159+ }
3160+}
3161+
3162+
3163+STDMETHODIMP ExampleClientAdviceSink::Func()
3164+{
3165+ m_hCallback = 0;
3166+
3167+ // set clip info
3168+ if(m_pPlayer)
3169+ SetClipInfo(m_pPlayer);
3170+
3171+ return HXR_OK;
3172+}
3173+
3174+void PrintBuffer(const char* pszName,const unsigned char* pbBuf, unsigned int dwBytes)
3175+{
3176+ if(pszName == NULL || pbBuf == NULL)
3177+ return;
3178+
3179+ STDOUT(" ");
3180+ for(unsigned int i= 0; i<dwBytes; i++) {
3181+ STDOUT("0x%02x ",*pbBuf++);
3182+ if(i % 15 == 0 && i!=0)
3183+ STDOUT("\n ");
3184+ }
3185+ STDOUT("\n");
3186+ return;
3187+}
3188+
3189+/*
3190+ * IHXGroupSink methods
3191+ */
3192+/************************************************************************
3193+ * Method:
3194+ * IHXGroupSink::GroupAdded
3195+ * Purpose:
3196+ * Notification of a new group being added to the presentation.
3197+ */
3198+STDMETHODIMP ExampleClientAdviceSink::GroupAdded( UINT16 /*IN*/ uGroupIndex,
3199+ IHXGroup* /*IN*/ pGroup)
3200+{
3201+ return HXR_OK;
3202+}
3203+
3204+/************************************************************************
3205+ * Method:
3206+ * IHXGroupSink::GroupRemoved
3207+ * Purpose:
3208+ * Notification of a group being removed from the presentation.
3209+ */
3210+STDMETHODIMP ExampleClientAdviceSink::GroupRemoved( UINT16 /*IN*/ uGroupIndex,
3211+ IHXGroup* /*IN*/ pGroup)
3212+{
3213+ return HXR_OK;
3214+}
3215+
3216+/************************************************************************
3217+ * Method:
3218+ * IHXGroupSink::AllGroupsRemoved
3219+ * Purpose:
3220+ * Notification that all groups have been removed from the
3221+ * current presentation.
3222+ */
3223+STDMETHODIMP ExampleClientAdviceSink::AllGroupsRemoved()
3224+{
3225+ return HXR_OK;
3226+}
3227+
3228+/************************************************************************
3229+ * Method:
3230+ * IHXGroupSink::TrackAdded
3231+ * Purpose:
3232+ * Notification of a new track being added to a group.
3233+ */
3234+STDMETHODIMP ExampleClientAdviceSink::TrackAdded( UINT16 /*IN*/ uGroupIndex,
3235+ UINT16 /*IN*/ uTrackIndex,
3236+ IHXValues* /*IN*/ pTrack)
3237+{
3238+ return HXR_OK;
3239+}
3240+
3241+/************************************************************************
3242+ * Method:
3243+ * IHXGroupSink::TrackRemoved
3244+ * Purpose:
3245+ * Notification of a track being removed from a group.
3246+ */
3247+STDMETHODIMP ExampleClientAdviceSink::TrackRemoved( UINT16 /*IN*/ uGroupIndex,
3248+ UINT16 /*IN*/ uTrackIndex,
3249+ IHXValues* /*IN*/ pTrack)
3250+{
3251+ return HXR_OK;
3252+}
3253+
3254+/************************************************************************
3255+ * Method:
3256+ * IHXGroupSink::TrackStarted
3257+ * Purpose:
3258+ * Notification of a track being started (to get duration, for
3259+ * instance...)
3260+ */
3261+STDMETHODIMP ExampleClientAdviceSink::TrackStarted( UINT16 /*IN*/ uGroupIndex,
3262+ UINT16 /*IN*/ uTrackIndex,
3263+ IHXValues* /*IN*/ pTrack)
3264+{
3265+ if ( m_bWaitForTrackStart )
3266+ {
3267+ STDOUT("----------------clip info--------------------\n");
3268+ if(m_pScheduler)
3269+ {
3270+ m_hCallback = m_pScheduler->RelativeEnter(this,50);
3271+ }
3272+ m_bWaitForTrackStart = FALSE;
3273+ }
3274+ return HXR_OK;
3275+}
3276+
3277+/************************************************************************
3278+ * Method:
3279+ * IHXGroupSink::TrackStopped
3280+ * Purpose:
3281+ * Notification of a track being stopped
3282+ *
3283+ */
3284+STDMETHODIMP ExampleClientAdviceSink::TrackStopped( UINT16 /*IN*/ uGroupIndex,
3285+ UINT16 /*IN*/ uTrackIndex,
3286+ IHXValues* /*IN*/ pTrack)
3287+{
3288+ return HXR_OK;
3289+}
3290+
3291+/************************************************************************
3292+ * Method:
3293+ * IHXGroupSink::CurrentGroupSet
3294+ * Purpose:
3295+ * This group is being currently played in the presentation.
3296+ */
3297+STDMETHODIMP ExampleClientAdviceSink::CurrentGroupSet( UINT16 /*IN*/ uGroupIndex,
3298+ IHXGroup* /*IN*/ pGroup)
3299+{
3300+ return HXR_OK;
3301+}
3302+
3303Index: helix-libs/clientapps/clutter/exadvsnk.h
3304===================================================================
3305--- /dev/null 1970-01-01 00:00:00.000000000 +0000
3306+++ helix-libs/clientapps/clutter/exadvsnk.h 2008-10-13 06:05:49.000000000 -0700
3307@@ -0,0 +1,324 @@
3308+/* ***** BEGIN LICENSE BLOCK *****
3309+ * Version: RCSL 1.0/RPSL 1.0
3310+ *
3311+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
3312+ *
3313+ * The contents of this file, and the files included with this file, are
3314+ * subject to the current version of the RealNetworks Public Source License
3315+ * Version 1.0 (the "RPSL") available at
3316+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
3317+ * the file under the RealNetworks Community Source License Version 1.0
3318+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
3319+ * in which case the RCSL will apply. You may also obtain the license terms
3320+ * directly from RealNetworks. You may not use this file except in
3321+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
3322+ * applicable to this file, the RCSL. Please see the applicable RPSL or
3323+ * RCSL for the rights, obligations and limitations governing use of the
3324+ * contents of the file.
3325+ *
3326+ * This file is part of the Helix DNA Technology. RealNetworks is the
3327+ * developer of the Original Code and owns the copyrights in the portions
3328+ * it created.
3329+ *
3330+ * This file, and the files included with this file, is distributed and made
3331+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
3332+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
3333+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
3334+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
3335+ *
3336+ * Technology Compatibility Kit Test Suite(s) Location:
3337+ * http://www.helixcommunity.org/content/tck
3338+ *
3339+ * Contributor(s):
3340+ *
3341+ * ***** END LICENSE BLOCK ***** */
3342+
3343+#ifndef _EXAMPLECLSNK_
3344+#define _EXAMPLECLSNK_
3345+
3346+#include "player.h"
3347+
3348+struct IHXClientAdviseSink;
3349+struct IHXGroupSink;
3350+struct IUnknown;
3351+struct IHXRegistry;
3352+struct IHXScheduler;
3353+struct IHXCallback;
3354+struct IHXPlayer;
3355+struct IHXGroup;
3356+
3357+class ExampleClientAdviceSink : public IHXClientAdviseSink,
3358+ public IHXGroupSink,
3359+ public IHXCallback
3360+{
3361+ private:
3362+ LONG32 m_lRefCount;
3363+ LONG32 m_lClientIndex;
3364+
3365+ IUnknown* m_pUnknown;
3366+ IHXRegistry* m_pRegistry;
3367+ IHXScheduler* m_pScheduler;
3368+
3369+ UINT32 m_ulStartTime;
3370+ UINT32 m_ulStopTime;
3371+
3372+ UINT32 m_lCurrentBandwidth;
3373+ UINT32 m_lAverageBandwidth;
3374+ HXBOOL m_bOnStop;
3375+
3376+ HXBOOL m_bWaitForTrackStart;
3377+
3378+ on_buffering_cb_t m_on_buffering_cb;
3379+ on_pos_length_cb_t m_on_pos_length_cb;
3380+ void *m_context; /* a argument passed by texture-helix lib */
3381+
3382+ // IHXCallback
3383+ IHXPlayer* m_pPlayer;
3384+ ULONG32 m_hCallback;
3385+ ~ExampleClientAdviceSink();
3386+ HX_RESULT DumpRegTree(const char* pszTreeName );
3387+
3388+
3389+ void GetStatistics (char* /*IN*/ pszRegistryKey);
3390+ void GetAllStatistics (void);
3391+ void SetClipInfo( IHXPlayer* m_pRMAPlayer);
3392+ void PrintPropName( IHXValues* pHeader );
3393+
3394+ public:
3395+
3396+ ExampleClientAdviceSink(IUnknown* /*IN*/ pUnknown, LONG32 /*IN*/ lClientIndex, on_buffering_cb_t on_buffer_cb, on_pos_length_cb_t on_pos_length_cb, void *context);
3397+
3398+ /*
3399+ * IUnknown methods
3400+ */
3401+ STDMETHOD(QueryInterface) (THIS_
3402+ REFIID riid,
3403+ void** ppvObj);
3404+
3405+ STDMETHOD_(ULONG32,AddRef) (THIS);
3406+
3407+ STDMETHOD_(ULONG32,Release) (THIS);
3408+
3409+ /*
3410+ * IHXClientAdviseSink methods
3411+ */
3412+
3413+ /************************************************************************
3414+ * Method:
3415+ * IHXClientAdviseSink::OnPosLength
3416+ * Purpose:
3417+ * Called to advise the client that the position or length of the
3418+ * current playback context has changed.
3419+ */
3420+ STDMETHOD(OnPosLength) (THIS_
3421+ UINT32 ulPosition,
3422+ UINT32 ulLength);
3423+
3424+ /************************************************************************
3425+ * Method:
3426+ * IHXClientAdviseSink::OnPresentationOpened
3427+ * Purpose:
3428+ * Called to advise the client a presentation has been opened.
3429+ */
3430+ STDMETHOD(OnPresentationOpened) (THIS);
3431+
3432+ /************************************************************************
3433+ * Method:
3434+ * IHXClientAdviseSink::OnPresentationClosed
3435+ * Purpose:
3436+ * Called to advise the client a presentation has been closed.
3437+ */
3438+ STDMETHOD(OnPresentationClosed) (THIS);
3439+
3440+ /************************************************************************
3441+ * Method:
3442+ * IHXClientAdviseSink::OnStatisticsChanged
3443+ * Purpose:
3444+ * Called to advise the client that the presentation statistics
3445+ * have changed.
3446+ */
3447+ STDMETHOD(OnStatisticsChanged) (THIS);
3448+
3449+ /************************************************************************
3450+ * Method:
3451+ * IHXClientAdviseSink::OnPreSeek
3452+ * Purpose:
3453+ * Called by client engine to inform the client that a seek is
3454+ * about to occur. The render is informed the last time for the
3455+ * stream's time line before the seek, as well as the first new
3456+ * time for the stream's time line after the seek will be completed.
3457+ *
3458+ */
3459+ STDMETHOD (OnPreSeek) (THIS_
3460+ ULONG32 ulOldTime,
3461+ ULONG32 ulNewTime);
3462+
3463+ /************************************************************************
3464+ * Method:
3465+ * IHXClientAdviseSink::OnPostSeek
3466+ * Purpose:
3467+ * Called by client engine to inform the client that a seek has
3468+ * just occured. The render is informed the last time for the
3469+ * stream's time line before the seek, as well as the first new
3470+ * time for the stream's time line after the seek.
3471+ *
3472+ */
3473+ STDMETHOD (OnPostSeek) (THIS_
3474+ ULONG32 ulOldTime,
3475+ ULONG32 ulNewTime);
3476+
3477+ /************************************************************************
3478+ * Method:
3479+ * IHXClientAdviseSink::OnStop
3480+ * Purpose:
3481+ * Called by client engine to inform the client that a stop has
3482+ * just occured.
3483+ *
3484+ */
3485+ STDMETHOD (OnStop) (THIS);
3486+
3487+ /************************************************************************
3488+ * Method:
3489+ * IHXClientAdviseSink::OnPause
3490+ * Purpose:
3491+ * Called by client engine to inform the client that a pause has
3492+ * just occured. The render is informed the last time for the
3493+ * stream's time line before the pause.
3494+ *
3495+ */
3496+ STDMETHOD (OnPause) (THIS_
3497+ ULONG32 ulTime);
3498+
3499+ /************************************************************************
3500+ * Method:
3501+ * IHXClientAdviseSink::OnBegin
3502+ * Purpose:
3503+ * Called by client engine to inform the client that a begin or
3504+ * resume has just occured. The render is informed the first time
3505+ * for the stream's time line after the resume.
3506+ *
3507+ */
3508+ STDMETHOD (OnBegin) (THIS_
3509+ ULONG32 ulTime);
3510+
3511+ /************************************************************************
3512+ * Method:
3513+ * IHXClientAdviseSink::OnBuffering
3514+ * Purpose:
3515+ * Called by client engine to inform the client that buffering
3516+ * of data is occuring. The render is informed of the reason for
3517+ * the buffering (start-up of stream, seek has occured, network
3518+ * congestion, etc.), as well as percentage complete of the
3519+ * buffering process.
3520+ *
3521+ */
3522+ STDMETHOD (OnBuffering) (THIS_
3523+ ULONG32 ulFlags,
3524+ UINT16 unPercentComplete);
3525+
3526+
3527+ /************************************************************************
3528+ * Method:
3529+ * IHXClientAdviseSink::OnContacting
3530+ * Purpose:
3531+ * Called by client engine to inform the client is contacting
3532+ * hosts(s).
3533+ *
3534+ */
3535+ STDMETHOD (OnContacting) (THIS_
3536+ const char* pHostName);
3537+
3538+ // IHXCallback
3539+ STDMETHOD(Func) (THIS);
3540+
3541+ /*
3542+ * IHXGroupSink methods
3543+ */
3544+ /************************************************************************
3545+ * Method:
3546+ * IHXGroupSink::GroupAdded
3547+ * Purpose:
3548+ * Notification of a new group being added to the presentation.
3549+ */
3550+ STDMETHOD(GroupAdded) (THIS_
3551+ UINT16 /*IN*/ uGroupIndex,
3552+ IHXGroup* /*IN*/ pGroup);
3553+
3554+ /************************************************************************
3555+ * Method:
3556+ * IHXGroupSink::GroupRemoved
3557+ * Purpose:
3558+ * Notification of a group being removed from the presentation.
3559+ */
3560+ STDMETHOD(GroupRemoved) (THIS_
3561+ UINT16 /*IN*/ uGroupIndex,
3562+ IHXGroup* /*IN*/ pGroup);
3563+
3564+ /************************************************************************
3565+ * Method:
3566+ * IHXGroupSink::AllGroupsRemoved
3567+ * Purpose:
3568+ * Notification that all groups have been removed from the
3569+ * current presentation.
3570+ */
3571+ STDMETHOD(AllGroupsRemoved) (THIS);
3572+
3573+ /************************************************************************
3574+ * Method:
3575+ * IHXGroupSink::TrackAdded
3576+ * Purpose:
3577+ * Notification of a new track being added to a group.
3578+ */
3579+ STDMETHOD(TrackAdded) (THIS_
3580+ UINT16 /*IN*/ uGroupIndex,
3581+ UINT16 /*IN*/ uTrackIndex,
3582+ IHXValues* /*IN*/ pTrack);
3583+
3584+ /************************************************************************
3585+ * Method:
3586+ * IHXGroupSink::TrackRemoved
3587+ * Purpose:
3588+ * Notification of a track being removed from a group.
3589+ */
3590+ STDMETHOD(TrackRemoved) (THIS_
3591+ UINT16 /*IN*/ uGroupIndex,
3592+ UINT16 /*IN*/ uTrackIndex,
3593+ IHXValues* /*IN*/ pTrack);
3594+
3595+ /************************************************************************
3596+ * Method:
3597+ * IHXGroupSink::TrackStarted
3598+ * Purpose:
3599+ * Notification of a track being started (to get duration, for
3600+ * instance...)
3601+ */
3602+ STDMETHOD (TrackStarted) (THIS_
3603+ UINT16 /*IN*/ uGroupIndex,
3604+ UINT16 /*IN*/ uTrackIndex,
3605+ IHXValues* /*IN*/ pTrack) ;
3606+
3607+ /************************************************************************
3608+ * Method:
3609+ * IHXGroupSink::TrackStopped
3610+ * Purpose:
3611+ * Notification of a track being stopped
3612+ *
3613+ */
3614+ STDMETHOD(TrackStopped) (THIS_
3615+ UINT16 /*IN*/ uGroupIndex,
3616+ UINT16 /*IN*/ uTrackIndex,
3617+ IHXValues* /*IN*/ pTrack);
3618+
3619+ /************************************************************************
3620+ * Method:
3621+ * IHXGroupSink::CurrentGroupSet
3622+ * Purpose:
3623+ * This group is being currently played in the presentation.
3624+ */
3625+ STDMETHOD(CurrentGroupSet) (THIS_
3626+ UINT16 /*IN*/ uGroupIndex,
3627+ IHXGroup* /*IN*/ pGroup);
3628+
3629+};
3630+
3631+#endif /* _EXAMPLECLSNK_ */
3632Index: helix-libs/clientapps/clutter/exaumgr.cpp
3633===================================================================
3634--- /dev/null 1970-01-01 00:00:00.000000000 +0000
3635+++ helix-libs/clientapps/clutter/exaumgr.cpp 2008-10-13 06:05:49.000000000 -0700
3636@@ -0,0 +1,137 @@
3637+/* ***** BEGIN LICENSE BLOCK *****
3638+ * Version: RCSL 1.0/RPSL 1.0
3639+ *
3640+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
3641+ *
3642+ * The contents of this file, and the files included with this file, are
3643+ * subject to the current version of the RealNetworks Public Source License
3644+ * Version 1.0 (the "RPSL") available at
3645+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
3646+ * the file under the RealNetworks Community Source License Version 1.0
3647+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
3648+ * in which case the RCSL will apply. You may also obtain the license terms
3649+ * directly from RealNetworks. You may not use this file except in
3650+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
3651+ * applicable to this file, the RCSL. Please see the applicable RPSL or
3652+ * RCSL for the rights, obligations and limitations governing use of the
3653+ * contents of the file.
3654+ *
3655+ * This file is part of the Helix DNA Technology. RealNetworks is the
3656+ * developer of the Original Code and owns the copyrights in the portions
3657+ * it created.
3658+ *
3659+ * This file, and the files included with this file, is distributed and made
3660+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
3661+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
3662+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
3663+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
3664+ *
3665+ * Technology Compatibility Kit Test Suite(s) Location:
3666+ * http://www.helixcommunity.org/content/tck
3667+ *
3668+ * Contributor(s):
3669+ *
3670+ * ***** END LICENSE BLOCK ***** */
3671+
3672+#include <stdio.h>
3673+#include "hxtypes.h"
3674+#include "hxcom.h"
3675+#include "hxauth.h"
3676+#include "hxstrutl.h"
3677+#include "exaumgr.h"
3678+#include <ctype.h>
3679+#include "print.h"
3680+
3681+
3682+#include "globals.h"
3683+struct _stGlobals*& GetGlobal(); //in main.cpp
3684+
3685+
3686+
3687+ExampleAuthenticationManager::ExampleAuthenticationManager() :
3688+ m_lRefCount(0),
3689+ m_bSentPassword(FALSE)
3690+{
3691+}
3692+
3693+ExampleAuthenticationManager::~ExampleAuthenticationManager()
3694+{
3695+}
3696+
3697+STDMETHODIMP
3698+ExampleAuthenticationManager::QueryInterface(REFIID riid, void**ppvObj)
3699+{
3700+ if(IsEqualIID(riid, IID_IUnknown))
3701+ {
3702+ AddRef();
3703+ *ppvObj = (IUnknown*)(IHXAuthenticationManager*)this;
3704+ return HXR_OK;
3705+ }
3706+ else if(IsEqualIID(riid, IID_IHXAuthenticationManager))
3707+ {
3708+ AddRef();
3709+ *ppvObj = (IHXAuthenticationManager*)this;
3710+ return HXR_OK;
3711+ }
3712+ *ppvObj = NULL;
3713+ return HXR_NOINTERFACE;
3714+}
3715+
3716+STDMETHODIMP_(UINT32)
3717+ExampleAuthenticationManager::AddRef()
3718+{
3719+ return InterlockedIncrement(&m_lRefCount);
3720+}
3721+
3722+STDMETHODIMP_(UINT32)
3723+ExampleAuthenticationManager::Release()
3724+{
3725+ if (InterlockedDecrement(&m_lRefCount) > 0)
3726+ {
3727+ return m_lRefCount;
3728+ }
3729+
3730+ delete this;
3731+ return 0;
3732+}
3733+
3734+STDMETHODIMP
3735+ExampleAuthenticationManager::HandleAuthenticationRequest(IHXAuthenticationManagerResponse* pResponse)
3736+{
3737+ char username[1024] = ""; /* Flawfinder: ignore */
3738+ char password[1024] = ""; /* Flawfinder: ignore */
3739+ HX_RESULT res = HXR_FAIL;
3740+
3741+ if( !m_bSentPassword )
3742+ {
3743+ res = HXR_OK;
3744+ if (GetGlobal()->bEnableVerboseMode)
3745+ STDOUT("\nSending Username and Password...\n");
3746+
3747+ SafeStrCpy(username, GetGlobal()->g_pszUsername, 1024);
3748+ SafeStrCpy(password, GetGlobal()->g_pszPassword, 1024);
3749+
3750+ //strip trailing whitespace
3751+ char* c;
3752+ for(c = username + strlen(username) - 1;
3753+ c > username && isspace(*c);
3754+ c--)
3755+ ;
3756+ *(c+1) = 0;
3757+
3758+ for(c = password + strlen(password) - 1;
3759+ c > password && isspace(*c);
3760+ c--)
3761+ ;
3762+ *(c+1) = 0;
3763+
3764+ m_bSentPassword = TRUE;
3765+ }
3766+
3767+ if (GetGlobal()->bEnableVerboseMode && FAILED(res) )
3768+ STDOUT("\nInvalid Username and/or Password.\n");
3769+
3770+ pResponse->AuthenticationRequestDone(res, username, password);
3771+ return res;
3772+}
3773+
3774Index: helix-libs/clientapps/clutter/exaumgr.h
3775===================================================================
3776--- /dev/null 1970-01-01 00:00:00.000000000 +0000
3777+++ helix-libs/clientapps/clutter/exaumgr.h 2008-10-13 06:05:49.000000000 -0700
3778@@ -0,0 +1,56 @@
3779+/* ***** BEGIN LICENSE BLOCK *****
3780+ * Version: RCSL 1.0/RPSL 1.0
3781+ *
3782+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
3783+ *
3784+ * The contents of this file, and the files included with this file, are
3785+ * subject to the current version of the RealNetworks Public Source License
3786+ * Version 1.0 (the "RPSL") available at
3787+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
3788+ * the file under the RealNetworks Community Source License Version 1.0
3789+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
3790+ * in which case the RCSL will apply. You may also obtain the license terms
3791+ * directly from RealNetworks. You may not use this file except in
3792+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
3793+ * applicable to this file, the RCSL. Please see the applicable RPSL or
3794+ * RCSL for the rights, obligations and limitations governing use of the
3795+ * contents of the file.
3796+ *
3797+ * This file is part of the Helix DNA Technology. RealNetworks is the
3798+ * developer of the Original Code and owns the copyrights in the portions
3799+ * it created.
3800+ *
3801+ * This file, and the files included with this file, is distributed and made
3802+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
3803+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
3804+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
3805+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
3806+ *
3807+ * Technology Compatibility Kit Test Suite(s) Location:
3808+ * http://www.helixcommunity.org/content/tck
3809+ *
3810+ * Contributor(s):
3811+ *
3812+ * ***** END LICENSE BLOCK ***** */
3813+
3814+#ifndef _EXAUMGR_H_
3815+#define _EXAUMGR_H_
3816+
3817+#include "hxauth.h"
3818+
3819+class ExampleAuthenticationManager : public IHXAuthenticationManager
3820+{
3821+private:
3822+ INT32 m_lRefCount;
3823+ HXBOOL m_bSentPassword;
3824+ ~ExampleAuthenticationManager();
3825+
3826+public:
3827+ ExampleAuthenticationManager();
3828+ STDMETHOD(QueryInterface) (THIS_ REFIID riid, void** ppvObj);
3829+ STDMETHOD_(UINT32,AddRef) (THIS);
3830+ STDMETHOD_(UINT32,Release) (THIS);
3831+
3832+ STDMETHOD(HandleAuthenticationRequest) (IHXAuthenticationManagerResponse* pResponse);
3833+};
3834+#endif
3835Index: helix-libs/clientapps/clutter/excallback.cpp
3836===================================================================
3837--- /dev/null 1970-01-01 00:00:00.000000000 +0000
3838+++ helix-libs/clientapps/clutter/excallback.cpp 2008-10-13 06:05:49.000000000 -0700
3839@@ -0,0 +1,38 @@
3840+#include "excallback.h"
3841+
3842+STDMETHODIMP ExCallback::QueryInterface(REFIID riid, void** ppvObj)
3843+{
3844+ if (IsEqualIID(riid, IID_IHXCallback))
3845+ {
3846+ AddRef();
3847+ *ppvObj = (IHXCallback*)this;
3848+ return HXR_OK;
3849+ }
3850+ else if (IsEqualIID(riid, IID_IUnknown))
3851+ {
3852+ AddRef();
3853+ *ppvObj = this;
3854+ return HXR_OK;
3855+ }
3856+
3857+ *ppvObj = NULL;
3858+ return HXR_NOINTERFACE;
3859+}
3860+
3861+STDMETHODIMP_(ULONG32) ExCallback::AddRef()
3862+{
3863+ return HXR_OK;
3864+}
3865+
3866+STDMETHODIMP_(ULONG32) ExCallback::Release()
3867+{
3868+ return HXR_OK;
3869+}
3870+
3871+STDMETHODIMP ExCallback::Func(void)
3872+{
3873+ UINT32 sleepTime = 0;
3874+ m_pKicker->Kick(HXGetCurrentThreadID, &sleepTime);
3875+ printf("Get called, sleeptime:%d\n", sleepTime);
3876+ m_pScheduler->RelativeEnter(this, sleepTime/1000);
3877+}
3878Index: helix-libs/clientapps/clutter/excallback.h
3879===================================================================
3880--- /dev/null 1970-01-01 00:00:00.000000000 +0000
3881+++ helix-libs/clientapps/clutter/excallback.h 2008-10-13 06:05:49.000000000 -0700
3882@@ -0,0 +1,32 @@
3883+#ifndef _EX_CALLBACK_H_
3884+#define _EX_CALLBACK_H_
3885+
3886+#include "hxcom.h"
3887+#include "hxengin.h"
3888+#include "ihxmedpltfm.h"
3889+#include "thrdutil.h"
3890+
3891+class ExCallback : public IHXCallback
3892+{
3893+ public:
3894+ ExCallback(IHXScheduler *pIHXScheduler, IHXMediaPlatformKicker *pKicker) : m_pScheduler(pIHXScheduler), m_pKicker(pKicker){};
3895+
3896+ /*
3897+ * * IUnknown methods
3898+ * */
3899+ STDMETHOD(QueryInterface) (THIS_ REFIID riid, void** ppvObj);
3900+ STDMETHOD_(ULONG32,AddRef) (THIS);
3901+ STDMETHOD_(ULONG32,Release) (THIS);
3902+
3903+ /*
3904+ * * IHXCallback methods
3905+ * */
3906+ STDMETHOD(Func) (THIS);
3907+ private:
3908+ IHXScheduler *m_pScheduler;
3909+ IHXMediaPlatformKicker* m_pKicker;
3910+
3911+};
3912+
3913+
3914+#endif
3915Index: helix-libs/clientapps/clutter/excontxt.cpp
3916===================================================================
3917--- /dev/null 1970-01-01 00:00:00.000000000 +0000
3918+++ helix-libs/clientapps/clutter/excontxt.cpp 2008-10-13 06:05:49.000000000 -0700
3919@@ -0,0 +1,315 @@
3920+/* ***** BEGIN LICENSE BLOCK *****
3921+ * Version: RCSL 1.0/RPSL 1.0
3922+ *
3923+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
3924+ *
3925+ * The contents of this file, and the files included with this file, are
3926+ * subject to the current version of the RealNetworks Public Source License
3927+ * Version 1.0 (the "RPSL") available at
3928+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
3929+ * the file under the RealNetworks Community Source License Version 1.0
3930+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
3931+ * in which case the RCSL will apply. You may also obtain the license terms
3932+ * directly from RealNetworks. You may not use this file except in
3933+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
3934+ * applicable to this file, the RCSL. Please see the applicable RPSL or
3935+ * RCSL for the rights, obligations and limitations governing use of the
3936+ * contents of the file.
3937+ *
3938+ * This file is part of the Helix DNA Technology. RealNetworks is the
3939+ * developer of the Original Code and owns the copyrights in the portions
3940+ * it created.
3941+ *
3942+ * This file, and the files included with this file, is distributed and made
3943+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
3944+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
3945+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
3946+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
3947+ *
3948+ * Technology Compatibility Kit Test Suite(s) Location:
3949+ * http://www.helixcommunity.org/content/tck
3950+ *
3951+ * Contributor(s):
3952+ *
3953+ * ***** END LICENSE BLOCK ***** */
3954+
3955+#include "hxtypes.h"
3956+
3957+#include "hxwintyp.h"
3958+#include "hxcom.h"
3959+#include "hxcomm.h"
3960+#include "hxwin.h"
3961+#include "fivemmap.h"
3962+
3963+#include "hxbuffer.h"
3964+#include "hxmangle.h"
3965+
3966+#include "hxclsnk.h"
3967+#include "hxgroup.h"
3968+#include "hxerror.h"
3969+#include "hxprefs.h"
3970+#include "hxstrutl.h"
3971+
3972+#include "exadvsnk.h"
3973+#include "exstateadvsnk.h"
3974+#include "exerror.h"
3975+#include "exsitsup.h"
3976+#include "exaumgr.h"
3977+#include "hxprdnld.h"
3978+#include "exprdnld.h"
3979+
3980+#include "excontxt.h"
3981+
3982+extern HXBOOL bEnableAdviceSink;
3983+
3984+
3985+ExampleClientContext::ExampleClientContext(LONG32 lClientIndex)
3986+ : m_lRefCount(0)
3987+ , m_lClientIndex(lClientIndex)
3988+ , m_pClientSink(NULL)
3989+ , m_pClientStateSink(NULL)
3990+ , m_pErrorSink(NULL)
3991+ , m_pAuthMgr(NULL)
3992+ , m_pSiteSupplier(NULL)
3993+ , m_pDefaultPrefs(NULL)
3994+#if defined(HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS)
3995+ , m_pPrgDnldStatusObserver(NULL)
3996+#endif // /HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS.
3997+{
3998+}
3999+
4000+
4001+ExampleClientContext::~ExampleClientContext()
4002+{
4003+ Close();
4004+};
4005+
4006+void ExampleClientContext::Init(IUnknown* /*IN*/ pUnknown,
4007+ IHXPreferences* /*IN*/ pPreferences,
4008+ char* /*IN*/ pszGUID,
4009+ on_buffering_cb_t on_buffering_cb,
4010+ on_pos_length_cb_t on_pos_length_cb,
4011+ on_state_change_cb_t on_state_change_cb,
4012+ on_new_frame_cb_t on_new_frame_cb,
4013+ void *context)
4014+{
4015+ char* pszCipher = NULL;
4016+
4017+
4018+ m_pClientSink = new ExampleClientAdviceSink(pUnknown, m_lClientIndex, on_buffering_cb, on_pos_length_cb, context);
4019+
4020+ m_pClientStateSink = new ExampleClientStateAdviceSink(pUnknown, m_lClientIndex, on_state_change_cb, context);
4021+ m_pErrorSink = new ExampleErrorSink(pUnknown);
4022+#if defined(HELIX_FEATURE_AUTHENTICATION)
4023+ m_pAuthMgr = new ExampleAuthenticationManager();
4024+ if(m_pAuthMgr)
4025+ {
4026+ m_pAuthMgr->AddRef();
4027+ }
4028+
4029+#endif /* #if defined(HELIX_FEATURE_AUTHENTICATION) */
4030+#if defined(HELIX_FEATURE_VIDEO)
4031+ m_pSiteSupplier = new ExampleSiteSupplier(pUnknown, on_new_frame_cb, context);
4032+#endif
4033+
4034+#if defined(HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS)
4035+ m_pPrgDnldStatusObserver = new ExamplePDStatusObserver(pUnknown);
4036+#endif // /HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS.
4037+
4038+ if (m_pClientSink)
4039+ {
4040+ m_pClientSink->AddRef();
4041+ }
4042+
4043+ if (m_pErrorSink)
4044+ {
4045+ m_pErrorSink->AddRef();
4046+ }
4047+
4048+ if (m_pClientStateSink)
4049+ m_pClientStateSink->AddRef();
4050+
4051+ if(m_pSiteSupplier)
4052+ {
4053+ m_pSiteSupplier->AddRef();
4054+ }
4055+
4056+ if (pPreferences)
4057+ {
4058+ m_pDefaultPrefs = pPreferences;
4059+ m_pDefaultPrefs->AddRef();
4060+ }
4061+
4062+ if (pszGUID && *pszGUID)
4063+ {
4064+ // Encode GUID
4065+ pszCipher = Cipher(pszGUID);
4066+ SafeStrCpy(m_pszGUID, pszCipher, 256);
4067+ }
4068+ else
4069+ {
4070+ m_pszGUID[0] = '\0';
4071+ }
4072+}
4073+
4074+void ExampleClientContext::Close()
4075+{
4076+ HX_RELEASE(m_pClientSink);
4077+ HX_RELEASE(m_pClientStateSink);
4078+ HX_RELEASE(m_pErrorSink);
4079+#if defined(HELIX_FEATURE_AUTHENTICATION)
4080+ HX_RELEASE(m_pAuthMgr);
4081+#endif /* #if defined(HELIX_FEATURE_AUTHENTICATION) */
4082+ HX_RELEASE(m_pSiteSupplier);
4083+ HX_RELEASE(m_pDefaultPrefs);
4084+#if defined(HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS)
4085+ HX_RELEASE(m_pPrgDnldStatusObserver);
4086+#endif // /HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS.
4087+}
4088+
4089+
4090+
4091+// *** IUnknown methods ***
4092+
4093+/////////////////////////////////////////////////////////////////////////
4094+// Method:
4095+// IUnknown::QueryInterface
4096+// Purpose:
4097+// Implement this to export the interfaces supported by your
4098+// object.
4099+//
4100+STDMETHODIMP ExampleClientContext::QueryInterface(REFIID riid, void** ppvObj)
4101+{
4102+ if (IsEqualIID(riid, IID_IUnknown))
4103+ {
4104+ AddRef();
4105+ *ppvObj = this;
4106+ return HXR_OK;
4107+ }
4108+ else if (IsEqualIID(riid, IID_IHXPreferences))
4109+ {
4110+ AddRef();
4111+ *ppvObj = (IHXPreferences*)this;
4112+ return HXR_OK;
4113+ }
4114+ else if (m_pClientSink &&
4115+ m_pClientSink->QueryInterface(riid, ppvObj) == HXR_OK)
4116+ {
4117+ return HXR_OK;
4118+ }
4119+ else if (m_pErrorSink &&
4120+ m_pErrorSink->QueryInterface(riid, ppvObj) == HXR_OK)
4121+ {
4122+ return HXR_OK;
4123+ }
4124+ else if (m_pClientStateSink &&
4125+ m_pClientStateSink->QueryInterface(riid, ppvObj) == HXR_OK)
4126+ {
4127+ return HXR_OK;
4128+ }
4129+#if defined(HELIX_FEATURE_AUTHENTICATION)
4130+ else if(m_pAuthMgr &&
4131+ m_pAuthMgr->QueryInterface(riid, ppvObj) == HXR_OK)
4132+ {
4133+ return HXR_OK;
4134+ }
4135+#endif /* #if defined(HELIX_FEATURE_AUTHENTICATION) */
4136+ else if(m_pSiteSupplier &&
4137+ m_pSiteSupplier->QueryInterface(riid, ppvObj) == HXR_OK)
4138+ {
4139+ return HXR_OK;
4140+ }
4141+ *ppvObj = NULL;
4142+ return HXR_NOINTERFACE;
4143+}
4144+
4145+/////////////////////////////////////////////////////////////////////////
4146+// Method:
4147+// IUnknown::AddRef
4148+// Purpose:
4149+// Everyone usually implements this the same... feel free to use
4150+// this implementation.
4151+//
4152+STDMETHODIMP_(ULONG32) ExampleClientContext::AddRef()
4153+{
4154+ return InterlockedIncrement(&m_lRefCount);
4155+}
4156+
4157+/////////////////////////////////////////////////////////////////////////
4158+// Method:
4159+// IUnknown::Release
4160+// Purpose:
4161+// Everyone usually implements this the same... feel free to use
4162+// this implementation.
4163+//
4164+STDMETHODIMP_(ULONG32) ExampleClientContext::Release()
4165+{
4166+ if (InterlockedDecrement(&m_lRefCount) > 0)
4167+ {
4168+ return m_lRefCount;
4169+ }
4170+
4171+ delete this;
4172+ return 0;
4173+}
4174+
4175+
4176+// *** IUnknown methods ***
4177+
4178+/////////////////////////////////////////////////////////////////////////
4179+// Method:
4180+// IHXPreferences::ReadPref
4181+// Purpose:
4182+// Read a Preference from the registry.
4183+//
4184+STDMETHODIMP
4185+ExampleClientContext::ReadPref(const char* pref_key, IHXBuffer*& buffer)
4186+{
4187+ HX_RESULT hResult = HXR_OK;
4188+ char* pszCipher = NULL;
4189+
4190+ if ((stricmp(pref_key, CLIENT_GUID_REGNAME) == 0) &&
4191+ (*m_pszGUID))
4192+ {
4193+ // Create a Buffer
4194+ buffer = new CHXBuffer();
4195+ buffer->AddRef();
4196+
4197+ // Copy the encoded GUID into the buffer
4198+ buffer->Set((UCHAR*)m_pszGUID, strlen(m_pszGUID) + 1);
4199+ }
4200+ else if (m_pDefaultPrefs)
4201+ {
4202+ hResult = m_pDefaultPrefs->ReadPref(pref_key, buffer);
4203+ }
4204+ else
4205+ {
4206+ hResult = HXR_NOTIMPL;
4207+ }
4208+
4209+ return hResult;
4210+}
4211+
4212+/////////////////////////////////////////////////////////////////////////
4213+// Method:
4214+// IHXPreferences::WritePref
4215+// Purpose:
4216+// Write a Preference to the registry.
4217+//
4218+STDMETHODIMP
4219+ExampleClientContext::WritePref(const char* pref_key, IHXBuffer* buffer)
4220+{
4221+ if (m_pDefaultPrefs)
4222+ {
4223+ return m_pDefaultPrefs->WritePref(pref_key, buffer);
4224+ }
4225+ else
4226+ {
4227+ return HXR_OK;
4228+ }
4229+}
4230+
4231+EHXClientState ExampleClientContext::GetState()
4232+{
4233+ return m_pClientStateSink->GetState();
4234+};
4235Index: helix-libs/clientapps/clutter/excontxt.h
4236===================================================================
4237--- /dev/null 1970-01-01 00:00:00.000000000 +0000
4238+++ helix-libs/clientapps/clutter/excontxt.h 2008-10-13 06:05:49.000000000 -0700
4239@@ -0,0 +1,106 @@
4240+/* ***** BEGIN LICENSE BLOCK *****
4241+ * Version: RCSL 1.0/RPSL 1.0
4242+ *
4243+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
4244+ *
4245+ * The contents of this file, and the files included with this file, are
4246+ * subject to the current version of the RealNetworks Public Source License
4247+ * Version 1.0 (the "RPSL") available at
4248+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
4249+ * the file under the RealNetworks Community Source License Version 1.0
4250+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
4251+ * in which case the RCSL will apply. You may also obtain the license terms
4252+ * directly from RealNetworks. You may not use this file except in
4253+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
4254+ * applicable to this file, the RCSL. Please see the applicable RPSL or
4255+ * RCSL for the rights, obligations and limitations governing use of the
4256+ * contents of the file.
4257+ *
4258+ * This file is part of the Helix DNA Technology. RealNetworks is the
4259+ * developer of the Original Code and owns the copyrights in the portions
4260+ * it created.
4261+ *
4262+ * This file, and the files included with this file, is distributed and made
4263+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
4264+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
4265+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
4266+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
4267+ *
4268+ * Technology Compatibility Kit Test Suite(s) Location:
4269+ * http://www.helixcommunity.org/content/tck
4270+ *
4271+ * Contributor(s):
4272+ *
4273+ * ***** END LICENSE BLOCK ***** */
4274+#ifndef _EXCONTXT_H_
4275+#define _EXCONTXT_H_
4276+
4277+#include "exerror.h"
4278+#include "exsitsup.h"
4279+#include "hxprefs.h"
4280+#include "player.h"
4281+#include "hxclsnk.h"
4282+
4283+struct IUnknown;
4284+struct IHXPreferences;
4285+class ExampleClientAdviceSink;
4286+class ExampleClientStateAdviceSink;
4287+class ExampleErrorMessages;
4288+class ExampleAuthenticationManager;
4289+class ExamplePDStatusObserver;
4290+
4291+
4292+class ExampleClientContext : public IHXPreferences
4293+{
4294+private:
4295+ LONG32 m_lRefCount;
4296+ LONG32 m_lClientIndex;
4297+
4298+ ExampleClientAdviceSink* m_pClientSink;
4299+ ExampleClientStateAdviceSink* m_pClientStateSink;
4300+ ExampleErrorSink* m_pErrorSink;
4301+ ExampleAuthenticationManager* m_pAuthMgr;
4302+
4303+ ExampleSiteSupplier* m_pSiteSupplier;
4304+ ExamplePDStatusObserver* m_pPrgDnldStatusObserver;
4305+ IHXPreferences* m_pDefaultPrefs;
4306+ char m_pszGUID[256]; /* Flawfinder: ignore */
4307+
4308+
4309+public:
4310+
4311+ ExampleClientContext(LONG32 /*IN*/ lClientIndex);
4312+ ~ExampleClientContext();
4313+
4314+ void Init(IUnknown* /*IN*/ pUnknown,
4315+ IHXPreferences* /*IN*/ pPreferences,
4316+ char* /*IN*/ pszGUID,
4317+ on_buffering_cb_t on_buffering_cb = NULL,
4318+ on_pos_length_cb_t on_pos_length_cb = NULL,
4319+ on_state_change_cb_t on_state_change_cb = NULL,
4320+ on_new_frame_cb_t on_new_frame_cb = NULL,
4321+ void *context = NULL);
4322+ void Close();
4323+
4324+ EHXClientState GetState();
4325+
4326+ /*
4327+ * IUnknown methods
4328+ */
4329+ STDMETHOD(QueryInterface) (THIS_
4330+ REFIID riid,
4331+ void** ppvObj);
4332+
4333+ STDMETHOD_(ULONG32,AddRef) (THIS);
4334+ STDMETHOD_(ULONG32,Release) (THIS);
4335+
4336+ /*
4337+ * IHXPreferences methods
4338+ */
4339+ STDMETHOD(ReadPref) (THIS_ const char* pref_key,
4340+ IHXBuffer*& buffer);
4341+ STDMETHOD(WritePref) (THIS_ const char* pref_key,
4342+ IHXBuffer* buffer);
4343+};
4344+
4345+#endif
4346Index: helix-libs/clientapps/clutter/exerror.cpp
4347===================================================================
4348--- /dev/null 1970-01-01 00:00:00.000000000 +0000
4349+++ helix-libs/clientapps/clutter/exerror.cpp 2008-10-13 06:05:49.000000000 -0700
4350@@ -0,0 +1,230 @@
4351+/* ***** BEGIN LICENSE BLOCK *****
4352+ * Version: RCSL 1.0/RPSL 1.0
4353+ *
4354+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
4355+ *
4356+ * The contents of this file, and the files included with this file, are
4357+ * subject to the current version of the RealNetworks Public Source License
4358+ * Version 1.0 (the "RPSL") available at
4359+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
4360+ * the file under the RealNetworks Community Source License Version 1.0
4361+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
4362+ * in which case the RCSL will apply. You may also obtain the license terms
4363+ * directly from RealNetworks. You may not use this file except in
4364+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
4365+ * applicable to this file, the RCSL. Please see the applicable RPSL or
4366+ * RCSL for the rights, obligations and limitations governing use of the
4367+ * contents of the file.
4368+ *
4369+ * This file is part of the Helix DNA Technology. RealNetworks is the
4370+ * developer of the Original Code and owns the copyrights in the portions
4371+ * it created.
4372+ *
4373+ * This file, and the files included with this file, is distributed and made
4374+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
4375+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
4376+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
4377+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
4378+ *
4379+ * Technology Compatibility Kit Test Suite(s) Location:
4380+ * http://www.helixcommunity.org/content/tck
4381+ *
4382+ * Contributor(s):
4383+ *
4384+ * ***** END LICENSE BLOCK ***** */
4385+
4386+#include "hxtypes.h"
4387+
4388+#include "hxcom.h"
4389+#include "hxcomm.h"
4390+#include "hxerror.h"
4391+#include "hxstrutl.h"
4392+#include "hxcore.h"
4393+#include "hxassert.h"
4394+#include "hxbuffer.h"
4395+
4396+#ifdef __TCS__
4397+#include "hxresult.h"
4398+#endif
4399+
4400+#if !defined(HELIX_CONFIG_MINIMIZE_SIZE)
4401+#include "HXErrorCodeStrings.h"
4402+#endif
4403+
4404+#include "exerror.h"
4405+
4406+#include <stdio.h>
4407+#include "print.h"
4408+
4409+#include "globals.h"
4410+struct _stGlobals*& GetGlobal(); //in main.cpp
4411+
4412+#ifdef __TCS__
4413+#if defined(__cplusplus)
4414+extern "C" {
4415+#endif
4416+
4417+void hookRealAudio_ReportError(int err, long errVal);
4418+
4419+#ifdef __cplusplus
4420+}
4421+#endif
4422+#endif
4423+
4424+ExampleErrorSink::ExampleErrorSink(IUnknown* pUnknown)
4425+ : m_lRefCount(0),
4426+ m_pPlayer(NULL)
4427+{
4428+ IHXClientEngine* pEngine = NULL;
4429+ pUnknown->QueryInterface(IID_IHXClientEngine, (void**)&pEngine );
4430+ if( pEngine )
4431+ {
4432+ IUnknown* pTmp = NULL;
4433+ pEngine->GetPlayer(0, pTmp);
4434+ m_pPlayer = (IHXPlayer*)pTmp;
4435+ }
4436+
4437+ HX_RELEASE( pEngine );
4438+ HX_ASSERT(m_pPlayer);
4439+}
4440+
4441+ExampleErrorSink::~ExampleErrorSink()
4442+{
4443+ HX_RELEASE(m_pPlayer);
4444+}
4445+
4446+// *** IUnknown methods ***
4447+
4448+/////////////////////////////////////////////////////////////////////////
4449+// Method:
4450+// IUnknown::QueryInterface
4451+// Purpose:
4452+// Implement this to export the interfaces supported by your
4453+// object.
4454+//
4455+STDMETHODIMP ExampleErrorSink::QueryInterface(REFIID riid, void** ppvObj)
4456+{
4457+ if (IsEqualIID(riid, IID_IUnknown))
4458+ {
4459+ AddRef();
4460+ *ppvObj = (IUnknown*)(IHXErrorSink*)this;
4461+ return HXR_OK;
4462+ }
4463+ else if (IsEqualIID(riid, IID_IHXErrorSink))
4464+ {
4465+ AddRef();
4466+ *ppvObj = (IHXErrorSink*) this;
4467+ return HXR_OK;
4468+ }
4469+
4470+ *ppvObj = NULL;
4471+ return HXR_NOINTERFACE;
4472+}
4473+
4474+/////////////////////////////////////////////////////////////////////////
4475+// Method:
4476+// IUnknown::AddRef
4477+// Purpose:
4478+// Everyone usually implements this the same... feel free to use
4479+// this implementation.
4480+//
4481+STDMETHODIMP_(ULONG32) ExampleErrorSink::AddRef()
4482+{
4483+ return InterlockedIncrement(&m_lRefCount);
4484+}
4485+
4486+/////////////////////////////////////////////////////////////////////////
4487+// Method:
4488+// IUnknown::Release
4489+// Purpose:
4490+// Everyone usually implements this the same... feel free to use
4491+// this implementation.
4492+//
4493+STDMETHODIMP_(ULONG32) ExampleErrorSink::Release()
4494+{
4495+ if (InterlockedDecrement(&m_lRefCount) > 0)
4496+ {
4497+ return m_lRefCount;
4498+ }
4499+
4500+ delete this;
4501+ return 0;
4502+}
4503+
4504+/*
4505+ * IHXErrorSink methods
4506+ */
4507+
4508+STDMETHODIMP
4509+ExampleErrorSink::ErrorOccurred(const UINT8 unSeverity,
4510+ const ULONG32 ulHXCode,
4511+ const ULONG32 ulUserCode,
4512+ const char* pUserString,
4513+ const char* pMoreInfoURL
4514+ )
4515+{
4516+ char HXDefine[256]; /* Flawfinder: ignore */
4517+
4518+ // Store the code, so we can return it from main()
4519+ GetGlobal()->g_Error = ulHXCode;
4520+
4521+ ConvertErrorToString(ulHXCode, HXDefine, 256);
4522+
4523+#ifdef __TCS__
4524+ hookRealAudio_ReportError(ulHXCode,ulUserCode);
4525+#else
4526+ STDOUT("Report(%d, %ld, \"%s\", %ld, \"%s\", \"%s\")\n",
4527+ unSeverity,
4528+ ulHXCode,
4529+ (pUserString && *pUserString) ? pUserString : "(NULL)",
4530+ ulUserCode,
4531+ (pMoreInfoURL && *pMoreInfoURL) ? pMoreInfoURL : "(NULL)",
4532+ HXDefine);
4533+#endif
4534+
4535+ return HXR_OK;
4536+}
4537+
4538+void
4539+ExampleErrorSink::ConvertErrorToString(const ULONG32 ulHXCode, char* pszBuffer, UINT32 ulBufLen)
4540+{
4541+ IHXErrorMessages* pErrMsg = NULL;
4542+
4543+ if( !pszBuffer)
4544+ return;
4545+
4546+ pszBuffer[0]='\0';
4547+
4548+ HX_ASSERT(m_pPlayer);
4549+ if( m_pPlayer)
4550+ {
4551+ m_pPlayer->QueryInterface(IID_IHXErrorMessages, (void**)&pErrMsg);
4552+ if( pErrMsg )
4553+ {
4554+ IHXBuffer* pMessage = pErrMsg->GetErrorText(ulHXCode);
4555+ if( pMessage )
4556+ {
4557+ SafeStrCpy( pszBuffer, (const char*)pMessage->GetBuffer(), ulBufLen);
4558+ pMessage->Release();
4559+ }
4560+ }
4561+ HX_RELEASE(pErrMsg);
4562+ }
4563+
4564+ if( strlen(pszBuffer)==0 )
4565+ {
4566+#if !defined(HELIX_CONFIG_MINIMIZE_SIZE)
4567+ const char* pszHXCodeString = HXErrorCodeToString(ulHXCode);
4568+ if (pszHXCodeString)
4569+ {
4570+ SafeSprintf( pszBuffer, ulBufLen, "%s", pszHXCodeString);
4571+ }
4572+ else
4573+#endif
4574+ {
4575+ HX_ASSERT(FALSE);
4576+ SafeSprintf( pszBuffer, ulBufLen, "Can't convert error code %p - make sure it's defined in common/util/HXErrorCodeStrings.c", ulHXCode );
4577+ }
4578+ }
4579+}
4580+
4581Index: helix-libs/clientapps/clutter/exerror.h
4582===================================================================
4583--- /dev/null 1970-01-01 00:00:00.000000000 +0000
4584+++ helix-libs/clientapps/clutter/exerror.h 2008-10-13 06:05:49.000000000 -0700
4585@@ -0,0 +1,92 @@
4586+/* ***** BEGIN LICENSE BLOCK *****
4587+ * Version: RCSL 1.0/RPSL 1.0
4588+ *
4589+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
4590+ *
4591+ * The contents of this file, and the files included with this file, are
4592+ * subject to the current version of the RealNetworks Public Source License
4593+ * Version 1.0 (the "RPSL") available at
4594+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
4595+ * the file under the RealNetworks Community Source License Version 1.0
4596+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
4597+ * in which case the RCSL will apply. You may also obtain the license terms
4598+ * directly from RealNetworks. You may not use this file except in
4599+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
4600+ * applicable to this file, the RCSL. Please see the applicable RPSL or
4601+ * RCSL for the rights, obligations and limitations governing use of the
4602+ * contents of the file.
4603+ *
4604+ * This file is part of the Helix DNA Technology. RealNetworks is the
4605+ * developer of the Original Code and owns the copyrights in the portions
4606+ * it created.
4607+ *
4608+ * This file, and the files included with this file, is distributed and made
4609+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
4610+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
4611+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
4612+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
4613+ *
4614+ * Technology Compatibility Kit Test Suite(s) Location:
4615+ * http://www.helixcommunity.org/content/tck
4616+ *
4617+ * Contributor(s):
4618+ *
4619+ * ***** END LICENSE BLOCK ***** */
4620+
4621+#ifndef _EXAMPLEERRORMESSAGES_
4622+#define _EXAMPLEERRORMESSAGES_
4623+
4624+#include "hxerror.h"
4625+
4626+struct IUnknown;
4627+struct IHXErrorMessages;
4628+struct IHXPlayer;
4629+
4630+class ExampleErrorSink : public IHXErrorSink
4631+{
4632+public:
4633+
4634+ ExampleErrorSink(IUnknown* pUnknown);
4635+ ~ExampleErrorSink();
4636+
4637+ /*
4638+ * IUnknown methods
4639+ */
4640+ STDMETHOD(QueryInterface) (THIS_
4641+ REFIID riid,
4642+ void** ppvObj);
4643+
4644+ STDMETHOD_(ULONG32,AddRef) (THIS);
4645+
4646+ STDMETHOD_(ULONG32,Release) (THIS);
4647+
4648+ /*
4649+ * IHXErrorSink methods
4650+ */
4651+
4652+ /************************************************************************
4653+ * Method:
4654+ * IHXErrorSink::ErrorOccurred
4655+ * Purpose:
4656+ * After you have registered your error sink with an IHXErrorSinkControl
4657+ * (either in the server or player core) this method will be called to
4658+ * report an error, event, or status message.
4659+ *
4660+ * The meaning of the arguments is exactly as described in
4661+ * hxerror.h
4662+ */
4663+ STDMETHOD(ErrorOccurred) (THIS_
4664+ const UINT8 unSeverity,
4665+ const ULONG32 ulHXCode,
4666+ const ULONG32 ulUserCode,
4667+ const char* pUserString,
4668+ const char* pMoreInfoURL
4669+ );
4670+
4671+protected:
4672+ LONG32 m_lRefCount;
4673+ IHXPlayer* m_pPlayer;
4674+
4675+ void ConvertErrorToString (const ULONG32 ulHXCode, char* pszBuffer, UINT32 ulBufLen);
4676+};
4677+#endif /*_EXAMPLEERRORMESSAGES_*/
4678Index: helix-libs/clientapps/clutter/exprdnld.cpp
4679===================================================================
4680--- /dev/null 1970-01-01 00:00:00.000000000 +0000
4681+++ helix-libs/clientapps/clutter/exprdnld.cpp 2008-10-13 06:05:49.000000000 -0700
4682@@ -0,0 +1,468 @@
4683+/* ***** BEGIN LICENSE BLOCK *****
4684+ * Version: RCSL 1.0/RPSL 1.0
4685+ *
4686+ * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
4687+ *
4688+ * The contents of this file, and the files included with this file, are
4689+ * subject to the current version of the RealNetworks Public Source License
4690+ * Version 1.0 (the "RPSL") available at
4691+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
4692+ * the file under the RealNetworks Community Source License Version 1.0
4693+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
4694+ * in which case the RCSL will apply. You may also obtain the license terms
4695+ * directly from RealNetworks. You may not use this file except in
4696+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
4697+ * applicable to this file, the RCSL. Please see the applicable RPSL or
4698+ * RCSL for the rights, obligations and limitations governing use of the
4699+ * contents of the file.
4700+ *
4701+ * This file is part of the Helix DNA Technology. RealNetworks is the
4702+ * developer of the Original Code and owns the copyrights in the portions
4703+ * it created.
4704+ *
4705+ * This file, and the files included with this file, is distributed and made
4706+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
4707+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
4708+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
4709+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
4710+ *
4711+ * Technology Compatibility Kit Test Suite(s) Location:
4712+ * http://www.helixcommunity.org/content/tck
4713+ *
4714+ * Contributor(s):
4715+ *
4716+ * ***** END LICENSE BLOCK ***** */
4717+
4718+#include "hxcom.h"
4719+#include "hxtypes.h"
4720+#include "hxcore.h"
4721+#include "hxprdnld.h"
4722+#include "exprdnld.h"
4723+#include "print.h"
4724+
4725+#include "globals.h"
4726+struct _stGlobals*& GetGlobal();
4727+
4728+UINT32 GetTime(); // /In main.cpp.
4729+
4730+// /#if defined(HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS)
4731+/************************************************************************
4732+ * Method:
4733+ * Constructor
4734+ */
4735+ExamplePDStatusObserver::ExamplePDStatusObserver(IUnknown* pUnkPlayer)
4736+ : m_lRefCount(0)
4737+ , m_pPrgDnldStatusMgr(NULL)
4738+ , m_pUnkPlayer(pUnkPlayer)
4739+ , m_pHXPlayer(NULL)
4740+ , m_bPlayerIsPausedByThis(FALSE)
4741+ , m_bFirstPDStatusMessage(TRUE)
4742+ , m_ulTotalDurReported(HX_PROGDOWNLD_UNKNOWN_DURATION)
4743+ , m_ulDurSoFar(HX_PROGDOWNLD_UNKNOWN_DURATION)
4744+ , m_ulCurStatusUpdateGranularity(
4745+ HX_PROGDOWNLD_DEFAULT_STATUSREPORT_INTERVAL_MSEC)
4746+ , m_bInitialPrerollUpateGranularitySet(FALSE)
4747+ , m_bDownloadIsComplete(FALSE)
4748+{
4749+ if (m_pUnkPlayer)
4750+ {
4751+ m_pUnkPlayer->QueryInterface(IID_IHXPlayer,
4752+ (void**)&m_pHXPlayer);
4753+
4754+ m_pUnkPlayer->QueryInterface(IID_IHXPDStatusMgr,
4755+ (void**)&m_pPrgDnldStatusMgr);
4756+
4757+ if (m_pPrgDnldStatusMgr)
4758+ {
4759+ // /Add ourselves as an observer of progressive download playback:
4760+ m_pPrgDnldStatusMgr->AddObserver(this);
4761+ // /Set granularity of status reports to 10 per second until we
4762+ // know enough about the situation to go back to getting reports
4763+ // at the default interval (every 5 seconds). Do that as soon
4764+ // as we receive the first progress report:
4765+ m_ulCurStatusUpdateGranularity = 100;
4766+ }
4767+
4768+ m_pUnkPlayer->AddRef();
4769+ }
4770+};
4771+
4772+/************************************************************************
4773+ * Method:
4774+ * Destructor
4775+ */
4776+ExamplePDStatusObserver::~ExamplePDStatusObserver()
4777+{
4778+ if (m_pPrgDnldStatusMgr)
4779+ {
4780+ m_pPrgDnldStatusMgr->RemoveObserver(this);
4781+ }
4782+ HX_RELEASE(m_pPrgDnldStatusMgr);
4783+ HX_RELEASE(m_pHXPlayer);
4784+ HX_RELEASE(m_pUnkPlayer);
4785+}
4786+
4787+/************************************************************************
4788+ * Method:
4789+ * IUnknown::QueryInterface
4790+ */
4791+STDMETHODIMP
4792+ExamplePDStatusObserver::QueryInterface(REFIID riid, void** ppvObj)
4793+{
4794+ if (IsEqualIID(riid, IID_IUnknown))
4795+ {
4796+ AddRef();
4797+ *ppvObj = (IUnknown*)(IHXPDStatusObserver*)this;
4798+ return HXR_OK;
4799+ }
4800+ else if (IsEqualIID(riid, IID_IHXPDStatusObserver))
4801+ {
4802+ AddRef();
4803+ *ppvObj = (IHXPDStatusObserver*)this;
4804+ return HXR_OK;
4805+ }
4806+
4807+ *ppvObj = NULL;
4808+ return HXR_NOINTERFACE;
4809+}
4810+
4811+/************************************************************************
4812+ * Method:
4813+ * IUnknown::AddRef
4814+ */
4815+STDMETHODIMP_(ULONG32)
4816+ExamplePDStatusObserver::AddRef()
4817+{
4818+ return InterlockedIncrement(&m_lRefCount);
4819+}
4820+
4821+/************************************************************************
4822+ * Method:
4823+ * IUnknown::Release
4824+ */
4825+STDMETHODIMP_(ULONG32)
4826+ExamplePDStatusObserver::Release()
4827+{
4828+ if (InterlockedDecrement(&m_lRefCount) > 0)
4829+ {
4830+ return m_lRefCount;
4831+ }
4832+
4833+ delete this;
4834+ return 0;
4835+}
4836+
4837+
4838+/*
4839+ * IHXPDStatusObserver methods
4840+ */
4841+
4842+/************************************************************************
4843+ * Method:
4844+ * IHXPDStatusObserver::OnDownloadProgress
4845+ *
4846+ * Purpose:
4847+ * Notification from IHXPDStatusMgr of download progress when
4848+ * file size changes.
4849+ *
4850+ * lTimeSurplus:
4851+ * - When negative, the absolute value of it is the estimated number
4852+ * of milliseconds of wall-clock time that need to pass while
4853+ * downloading continues before reaching the point at which playback
4854+ * can resume and play the remainder of the stream without having to
4855+ * buffer, assuming that playback is paused and remains so during
4856+ * that period.
4857+ * - When positive, it is the estimated number of milliseconds of
4858+ * wall-clock time between when the download should complete and when
4859+ * the natural content play-out duration will be reached, assuming
4860+ * playback is currently progressing and that no pause will occur.
4861+ *
4862+ * Note: ulNewDurSoFar can be HX_PROGDOWNLD_UNKNOWN_DURATION if the
4863+ * IHXMediaBytesToMediaDur was not available to, or was unable to
4864+ * convert the bytes to a duration for the IHXPDStatusMgr calling this:
4865+ */
4866+STDMETHODIMP
4867+ExamplePDStatusObserver::OnDownloadProgress(
4868+ IHXStreamSource* /*IN*/ /*NULL is valid value*/ pStreamSource,
4869+ UINT32 /*IN*/ ulNewDurSoFar,
4870+ UINT32 /*IN*/ ulNewBytesSoFar,
4871+ INT32 /*IN*/ lTimeSurplus)
4872+{
4873+ m_ulDurSoFar = ulNewDurSoFar;
4874+
4875+ if (m_ulCurStatusUpdateGranularity <
4876+ HX_PROGDOWNLD_DEFAULT_STATUSREPORT_INTERVAL_MSEC)
4877+ {
4878+ if (m_bInitialPrerollUpateGranularitySet)
4879+ {
4880+ if (HX_PROGDOWNLD_UNKNOWN_DURATION != ulNewDurSoFar &&
4881+ // /Preroll is done, so reset update interval back to default:
4882+ GetGlobal()->g_bOnBeginOccurred)
4883+ {
4884+ m_ulCurStatusUpdateGranularity =
4885+ HX_PROGDOWNLD_DEFAULT_STATUSREPORT_INTERVAL_MSEC;
4886+ m_pPrgDnldStatusMgr->SetStatusUpdateGranularityMsec(
4887+ m_ulCurStatusUpdateGranularity);
4888+ }
4889+ }
4890+ else if (!GetGlobal()->g_bOnBeginOccurred)
4891+ {
4892+ if (HXR_OK == m_pPrgDnldStatusMgr->SetStatusUpdateGranularityMsec(
4893+ m_ulCurStatusUpdateGranularity))
4894+ {
4895+ m_bInitialPrerollUpateGranularitySet = TRUE;
4896+ }
4897+ }
4898+ }
4899+
4900+ UINT32 ulCurPlayTime = 0;
4901+
4902+ HXBOOL bPauseWasAttempted = FALSE;
4903+ HXBOOL bPauseOccurred = FALSE;
4904+ HXBOOL bResumeWasAttempted = FALSE;
4905+ HXBOOL bResumeOccurred = FALSE;
4906+
4907+
4908+ if (m_pHXPlayer)
4909+ {
4910+ ulCurPlayTime = m_pHXPlayer->GetCurrentPlayTime();
4911+
4912+ if (GetGlobal()->g_bEnableSlowStart &&
4913+ lTimeSurplus != HX_PROGDOWNLD_UNKNOWN_TIME_SURPLUS)
4914+ {
4915+ // /"slow start" is enabled so if we have run dry of data,
4916+ // pause and wait for more data:
4917+ if (!m_bPlayerIsPausedByThis)
4918+ {
4919+ if (!m_bDownloadIsComplete && lTimeSurplus<0)
4920+ {
4921+ // /Use a 1000-millisecond allowance for variation:
4922+ if (lTimeSurplus < -1000)
4923+ {
4924+ bPauseWasAttempted = TRUE;
4925+ bPauseOccurred = m_bPlayerIsPausedByThis =
4926+ (HXR_OK == m_pHXPlayer->Pause());
4927+ }
4928+ }
4929+ }
4930+ else // /paused; see if we can resume yet:
4931+ {
4932+ if (lTimeSurplus > 0)
4933+ {
4934+ // /Use a 1000-millisecond allowance for variation:
4935+ if (lTimeSurplus > 1000)
4936+ {
4937+ bResumeWasAttempted = TRUE;
4938+ bResumeOccurred = (HXR_OK == m_pHXPlayer->Begin());
4939+ m_bPlayerIsPausedByThis = !bResumeOccurred;
4940+ }
4941+ }
4942+ }
4943+ }
4944+ }
4945+
4946+ if (GetGlobal()->bEnableVerboseMode && !m_bDownloadIsComplete)
4947+ {
4948+ STDOUT("\nDownload progress: (play time=%lu,",
4949+ ulCurPlayTime);
4950+ if (HX_PROGDOWNLD_UNKNOWN_TIME_SURPLUS == lTimeSurplus)
4951+ {
4952+ STDOUT(" UNKNOWN surplus|deficit)");
4953+ }
4954+ else if (HX_PROGDOWNLD_MIN_TIME_SURPLUS == lTimeSurplus)
4955+ {
4956+ STDOUT(" deficit exceeds maximum");
4957+ }
4958+ else if (HX_PROGDOWNLD_MAX_TIME_SURPLUS == lTimeSurplus)
4959+ {
4960+ STDOUT(" surplus exceeds maximum)");
4961+ }
4962+ else
4963+ {
4964+ STDOUT(" surplus=%ld milliseconds)", lTimeSurplus);
4965+ }
4966+ if (HX_PROGDOWNLD_UNKNOWN_DURATION == ulNewDurSoFar)
4967+ {
4968+ STDOUT("\n\thave UNKNOWN");
4969+ }
4970+ else
4971+ {
4972+ STDOUT("\n\thave %lu", ulNewDurSoFar);
4973+ }
4974+
4975+ if (HX_PROGDOWNLD_UNKNOWN_DURATION != m_ulTotalDurReported)
4976+ {
4977+ STDOUT(" of %lu msec", m_ulTotalDurReported);
4978+ }
4979+ else
4980+ {
4981+ STDOUT(" of UNKNOWN msec of media");
4982+ }
4983+ if (HX_PROGDOWNLD_UNKNOWN_FILE_SIZE != ulNewBytesSoFar)
4984+ {
4985+ STDOUT(" (%lu", ulNewBytesSoFar);
4986+ }
4987+ else
4988+ {
4989+ STDOUT(" (UNKNOWN");
4990+ }
4991+ STDOUT(" bytes downloaded so far)\n", ulNewBytesSoFar);
4992+
4993+ if (bPauseOccurred || bPauseWasAttempted)
4994+ {
4995+ STDOUT("# Waiting for more data: %splayback.\n "
4996+ " Should take %ld milliseconds before playback resumes.\n",
4997+ bPauseOccurred? "Pausing " :
4998+ (bPauseWasAttempted? "Failed attempting to pause "
4999+ : " "), -lTimeSurplus);
5000+ }
5001+ if (bResumeOccurred || bResumeWasAttempted)
5002+ {
5003+ STDOUT("# Data available: %splayback\n "
5004+ " Time surplus is now %ld",
5005+ bResumeOccurred? "Resuming " :
5006+ (bResumeWasAttempted? "Failed attempting to resume "
5007+ : " "), lTimeSurplus);
5008+ }
5009+ }
5010+
5011+ m_bFirstPDStatusMessage = FALSE;
5012+
5013+ return HXR_OK;
5014+}
5015+
5016+/************************************************************************
5017+ * Method:
5018+ * IHXPDStatusObserver::OnTotalDurChanged
5019+ * Purpose:
5020+ * This is a notification if the total file duration becomes known
5021+ * or becomes better-known during download/playback
5022+ *
5023+ * Note: pStreamSource can be NULL. This will be true when
5024+ * IHXPDStatusMgr calling this is upstream of the IHXStreamSource
5025+ * object.
5026+ */
5027+STDMETHODIMP
5028+ExamplePDStatusObserver::OnTotalDurChanged(
5029+ IHXStreamSource* /*IN*/ /*NULL is valid value*/ pStreamSource,
5030+ UINT32 ulNewTotalDur)
5031+{
5032+ m_ulTotalDurReported = ulNewTotalDur;
5033+
5034+ if (GetGlobal()->bEnableVerboseMode)
5035+ {
5036+ STDOUT("\nOnTotalDurChanged(): to %lu milliseconds\n", ulNewTotalDur);
5037+ }
5038+
5039+ return HXR_OK;
5040+}
5041+
5042+/************************************************************************
5043+ * Method:
5044+ * IHXPDStatusObserver::OnDownloadComplete
5045+ *
5046+ * Purpose:
5047+ * Notification that the entire file has been downloaded.
5048+ *
5049+ * Note: pStreamSource can be NULL. This will be true when
5050+ * IHXPDStatusMgr calling this is upstream of the IHXStreamSource
5051+ * object.
5052+ *
5053+ */
5054+STDMETHODIMP
5055+ExamplePDStatusObserver::OnDownloadComplete(
5056+ IHXStreamSource* /*IN*/ /*NULL is valid value*/ pStreamSource)
5057+{
5058+ m_bDownloadIsComplete = TRUE;
5059+
5060+ HXBOOL bResumeWasAttempted = FALSE;
5061+ HXBOOL bResumeOccurred = FALSE;
5062+
5063+ // /In case we're paused, resume now that there is no more data to get:
5064+ if (m_pHXPlayer && m_bPlayerIsPausedByThis)
5065+ {
5066+ bResumeWasAttempted = TRUE;
5067+ bResumeOccurred = (HXR_OK == m_pHXPlayer->Begin());
5068+ m_bPlayerIsPausedByThis = !bResumeOccurred;
5069+ }
5070+
5071+ if (GetGlobal()->bEnableVerboseMode)
5072+ {
5073+ STDOUT("\nOnDownloadComplete()\n");
5074+ if (bResumeOccurred || bResumeWasAttempted)
5075+ {
5076+ STDOUT("\n%splayback now that bytes are available for "
5077+ "uninterrupted playback\n",
5078+ bResumeOccurred? "Resuming " :
5079+ (bResumeWasAttempted? "Failed attempting to resume "
5080+ : " "));
5081+ }
5082+ }
5083+
5084+ return HXR_OK;
5085+}
5086+
5087+/************************************************************************
5088+ * Method:
5089+ * IHXPDStatusObserver::SrcClaimsSeekSupport ref: hxprdnld.h
5090+ * Purpose:
5091+ * Passes along notification from file sys that seek support
5092+ * is or is not claimed to be available (although sometimes HTTP
5093+ * server claims this when it doesn't actually support it).
5094+ */
5095+STDMETHODIMP
5096+ExamplePDStatusObserver::SrcClaimsSeekSupport(IHXStreamSource* pStreamSource,
5097+ HXBOOL bClaimsSupport)
5098+{
5099+ if (GetGlobal()->bEnableVerboseMode)
5100+ {
5101+ STDOUT("\nSrcClaimsSeekSupport(%sE)\n", bClaimsSupport?"TRU":"FALS");
5102+ }
5103+ return HXR_OK;
5104+}
5105+
5106+
5107+/************************************************************************
5108+ * Method:
5109+ * IHXPDStatusObserver::OnDownloadPause
5110+ * Purpose:
5111+ * Notification that the file-download process has purposefully
5112+ * and temporarily halted downloading of the file
5113+ *
5114+ * Note: pStreamSource can be NULL. This will be true when
5115+ * IHXPDStatusMgr calling this is upstream of the IHXStreamSource
5116+ * object.
5117+ */
5118+STDMETHODIMP
5119+ExamplePDStatusObserver::OnDownloadPause(
5120+ IHXStreamSource* /*IN*/ /*NULL is valid value*/ pStreamSource)
5121+{
5122+ if (GetGlobal()->bEnableVerboseMode)
5123+ {
5124+ STDOUT("\nOnDownloadPause()\n");
5125+ }
5126+ return HXR_OK;
5127+}
5128+
5129+/************************************************************************
5130+ * Method:
5131+ * IHXPDStatusObserver::OnDownloadResume
5132+ * Purpose:
5133+ * Notification that the file-download process has resumed
5134+ * the process of downloading the remainder of the file
5135+ *
5136+ * Note: pStreamSource can be NULL. This will be true when
5137+ * IHXPDStatusMgr calling this is upstream of the IHXStreamSource
5138+ * object.
5139+ */
5140+STDMETHODIMP
5141+ExamplePDStatusObserver::OnDownloadResume(
5142+ IHXStreamSource* /*IN*/ /*NULL is valid value*/ pStreamSource)
5143+{
5144+ if (GetGlobal()->bEnableVerboseMode)
5145+ {
5146+ STDOUT("\nOnDownloadResume()\n");
5147+ }
5148+ return HXR_OK;
5149+}
5150+// /#endif // /HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS.
5151Index: helix-libs/clientapps/clutter/exprdnld.h
5152===================================================================
5153--- /dev/null 1970-01-01 00:00:00.000000000 +0000
5154+++ helix-libs/clientapps/clutter/exprdnld.h 2008-10-13 06:05:49.000000000 -0700
5155@@ -0,0 +1,196 @@
5156+/* ***** BEGIN LICENSE BLOCK *****
5157+ * Version: RCSL 1.0/RPSL 1.0
5158+ *
5159+ * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
5160+ *
5161+ * The contents of this file, and the files included with this file, are
5162+ * subject to the current version of the RealNetworks Public Source License
5163+ * Version 1.0 (the "RPSL") available at
5164+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
5165+ * the file under the RealNetworks Community Source License Version 1.0
5166+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
5167+ * in which case the RCSL will apply. You may also obtain the license terms
5168+ * directly from RealNetworks. You may not use this file except in
5169+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
5170+ * applicable to this file, the RCSL. Please see the applicable RPSL or
5171+ * RCSL for the rights, obligations and limitations governing use of the
5172+ * contents of the file.
5173+ *
5174+ * This file is part of the Helix DNA Technology. RealNetworks is the
5175+ * developer of the Original Code and owns the copyrights in the portions
5176+ * it created.
5177+ *
5178+ * This file, and the files included with this file, is distributed and made
5179+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
5180+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
5181+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
5182+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
5183+ *
5184+ * Technology Compatibility Kit Test Suite(s) Location:
5185+ * http://www.helixcommunity.org/content/tck
5186+ *
5187+ * Contributor(s):
5188+ *
5189+ * ***** END LICENSE BLOCK ***** */
5190+
5191+#ifndef _EXPRDNLD_H_
5192+#define _EXPRDNLD_H_
5193+
5194+// /#if defined(HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS)
5195+
5196+/****************************************************************************
5197+ *
5198+ * Class:
5199+ *
5200+ * ExamplePDStatusObserver
5201+ *
5202+ * Purpose:
5203+ *
5204+ * Implementation for IHXPDStatusObserver which receives progressive-
5205+ * download status reports:
5206+ *
5207+ */
5208+class ExamplePDStatusObserver :
5209+ public IHXPDStatusObserver
5210+{
5211+private:
5212+ INT32 m_lRefCount;
5213+ IHXPDStatusMgr* m_pPrgDnldStatusMgr;
5214+ IUnknown* m_pUnkPlayer;
5215+ IHXPlayer* m_pHXPlayer;
5216+ HXBOOL m_bPlayerIsPausedByThis;
5217+ HXBOOL m_bFirstPDStatusMessage;
5218+ UINT32 m_ulTotalDurReported;
5219+ UINT32 m_ulDurSoFar;
5220+ UINT32 m_ulCurStatusUpdateGranularity;
5221+ HXBOOL m_bInitialPrerollUpateGranularitySet;
5222+ HXBOOL m_bDownloadIsComplete;
5223+
5224+ ExamplePDStatusObserver();
5225+ ~ExamplePDStatusObserver();
5226+
5227+public:
5228+ ExamplePDStatusObserver(IUnknown* pUnkPlayer);
5229+
5230+ /*
5231+ * IUnknown methods
5232+ */
5233+ STDMETHOD(QueryInterface) (THIS_
5234+ REFIID riid,
5235+ void** ppvObj);
5236+
5237+ STDMETHOD_(ULONG32,AddRef) (THIS);
5238+
5239+ STDMETHOD_(ULONG32,Release) (THIS);
5240+
5241+ /*
5242+ * IHXPDStatusObserver methods
5243+ */
5244+
5245+ /************************************************************************
5246+ * Method:
5247+ * IHXPDStatusObserver::OnDownloadProgress
5248+ *
5249+ * Purpose:
5250+ * Notification from IHXPDStatusMgr of download progress when
5251+ * file size changes.
5252+ *
5253+ * lTimeSurplus:
5254+ * - When negative, the absolute value of it is the estimated number
5255+ * of milliseconds of wall-clock time that need to pass while
5256+ * downloading continues before reaching the point at which playback
5257+ * can resume and play the remainder of the stream without having to
5258+ * buffer, assuming that playback is paused and remains so during
5259+ * that period.
5260+ * - When positive, it is the estimated number of milliseconds of
5261+ * wall-clock time between when the download should complete and when
5262+ * the natural content play-out duration will be reached, assuming
5263+ * playback is currently progressing and that no pause will occur.
5264+ *
5265+ * Note: ulNewDurSoFar can be HX_PROGDOWNLD_UNKNOWN_DURATION if the
5266+ * IHXMediaBytesToMediaDurConverter was not available to, or was
5267+ * unable to convert the bytes to a duration for the IHXPDStatusMgr
5268+ * calling this:
5269+ */
5270+ STDMETHOD(OnDownloadProgress) (THIS_
5271+ IHXStreamSource* /*IN*/ /*NULL is valid value*/ pStreamSource,
5272+ UINT32 /*IN*/ ulNewDurSoFar,
5273+ UINT32 /*IN*/ ulNewBytesSoFar,
5274+ INT32 /*IN*/ lTimeSurplus);
5275+
5276+ /************************************************************************
5277+ * Method:
5278+ * IHXPDStatusObserver::OnTotalDurChanged
5279+ * Purpose:
5280+ * This is a notification if the total file duration becomes known
5281+ * or becomes better-known during download/playback
5282+ *
5283+ * Note: pStreamSource can be NULL. This will be true when
5284+ * IHXPDStatusMgr calling this is upstream of the IHXStreamSource
5285+ * object.
5286+ */
5287+ STDMETHOD(OnTotalDurChanged) (THIS_
5288+ IHXStreamSource* /*IN*/ /*NULL is valid value*/ pStreamSource,
5289+ UINT32 /*IN*/ ulNewDur);
5290+
5291+ /************************************************************************
5292+ * Method:
5293+ * IHXPDStatusObserver::OnDownloadComplete
5294+ *
5295+ * Purpose:
5296+ * Notification that the entire file has been downloaded.
5297+ *
5298+ * Note: pStreamSource can be NULL. This will be true when
5299+ * IHXPDStatusMgr calling this is upstream of the IHXStreamSource
5300+ * object.
5301+ *
5302+ */
5303+ STDMETHOD(OnDownloadComplete) (THIS_
5304+ IHXStreamSource* /*IN*/ /*NULL is valid value*/ pStreamSource);
5305+
5306+ /************************************************************************
5307+ * Method:
5308+ * IHXPDStatusObserver::SrcClaimsSeekSupport
5309+ *
5310+ * Purpose:
5311+ * Passes along notification from file sys that seek support
5312+ * is claimed to be available (although sometimes HTTP server
5313+ * claims this when it doesn't actually support it).
5314+ *
5315+ */
5316+ STDMETHOD(SrcClaimsSeekSupport) (THIS_
5317+ IHXStreamSource* pStreamSource,
5318+ HXBOOL /*IN*/ bSrcClaimsSeekSupport);
5319+
5320+ /************************************************************************
5321+ * Method:
5322+ * IHXPDStatusObserver::OnDownloadPause
5323+ * Purpose:
5324+ * Notification that the file-download process has purposefully
5325+ * and temporarily halted downloading of the file
5326+ *
5327+ * Note: pStreamSource can be NULL. This will be true when
5328+ * IHXPDStatusMgr calling this is upstream of the IHXStreamSource
5329+ * object.
5330+ */
5331+ STDMETHOD(OnDownloadPause) (THIS_
5332+ IHXStreamSource* /*IN*/ /*NULL is valid value*/ pStreamSource);
5333+
5334+ /************************************************************************
5335+ * Method:
5336+ * IHXPDStatusObserver::OnDownloadResume
5337+ * Purpose:
5338+ * Notification that the file-download process has resumed
5339+ * the process of downloading the remainder of the file
5340+ *
5341+ * Note: pStreamSource can be NULL. This will be true when
5342+ * IHXPDStatusMgr calling this is upstream of the IHXStreamSource
5343+ * object.
5344+ */
5345+ STDMETHOD(OnDownloadResume) (THIS_
5346+ IHXStreamSource* /*IN*/ /*NULL is valid value*/ pStreamSource);
5347+};
5348+// /#endif // /HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS.
5349+
5350+#endif // _EXPRDNLD_H_
5351+
5352Index: helix-libs/clientapps/clutter/exroot.cpp
5353===================================================================
5354--- /dev/null 1970-01-01 00:00:00.000000000 +0000
5355+++ helix-libs/clientapps/clutter/exroot.cpp 2008-10-13 06:54:08.000000000 -0700
5356@@ -0,0 +1,672 @@
5357+/* ***** BEGIN LICENSE BLOCK *****
5358+ * Source last modified: $Id: unixroot.cpp,v 1.9 2007/07/06 20:54:01 jfinnecy Exp $
5359+ *
5360+ * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
5361+ *
5362+ * The contents of this file, and the files included with this file,
5363+ * are subject to the current version of the RealNetworks Public
5364+ * Source License (the "RPSL") available at
5365+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
5366+ * the file under the current version of the RealNetworks Community
5367+ * Source License (the "RCSL") available at
5368+ * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
5369+ * will apply. You may also obtain the license terms directly from
5370+ * RealNetworks. You may not use this file except in compliance with
5371+ * the RPSL or, if you have a valid RCSL with RealNetworks applicable
5372+ * to this file, the RCSL. Please see the applicable RPSL or RCSL for
5373+ * the rights, obligations and limitations governing use of the
5374+ * contents of the file.
5375+ *
5376+ * Alternatively, the contents of this file may be used under the
5377+ * terms of the GNU General Public License Version 2 (the
5378+ * "GPL") in which case the provisions of the GPL are applicable
5379+ * instead of those above. If you wish to allow use of your version of
5380+ * this file only under the terms of the GPL, and not to allow others
5381+ * to use your version of this file under the terms of either the RPSL
5382+ * or RCSL, indicate your decision by deleting the provisions above
5383+ * and replace them with the notice and other provisions required by
5384+ * the GPL. If you do not delete the provisions above, a recipient may
5385+ * use your version of this file under the terms of any one of the
5386+ * RPSL, the RCSL or the GPL.
5387+ *
5388+ * This file is part of the Helix DNA Technology. RealNetworks is the
5389+ * developer of the Original Code and owns the copyrights in the
5390+ * portions it created.
5391+ *
5392+ * This file, and the files included with this file, is distributed
5393+ * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
5394+ * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
5395+ * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
5396+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
5397+ * ENJOYMENT OR NON-INFRINGEMENT.
5398+ *
5399+ * Technology Compatibility Kit Test Suite(s) Location:
5400+ * http://www.helixcommunity.org/content/tck
5401+ *
5402+ * Contributor(s):
5403+ *
5404+ * ***** END LICENSE BLOCK ***** */
5405+
5406+// for shared memory
5407+#include <sys/types.h>
5408+#include <sys/ipc.h>
5409+#include <sys/shm.h>
5410+#include <sys/utsname.h>
5411+
5412+#include "hxcom.h"
5413+#include "hxwintyp.h"
5414+#include "hxvsurf.h"
5415+#include "hxslist.h"
5416+#include "colormap.h"
5417+#include "hxprefs.h"
5418+#include "hxtick.h"
5419+#include "hxthread.h"
5420+#include "basesite.h"
5421+#include "exroot.h"
5422+#include "exsite.h"
5423+#include "unixcmap.h"
5424+#include "shmhelp.h"
5425+
5426+// #ifdef _DEBUG
5427+// #include <X11/extensions/xf86vmode.h> //for debug video sync rates..
5428+// #endif
5429+
5430+//Work around AIX problem.
5431+#ifdef _AIX
5432+# define MAX_SHARED_REGIONS ((UINT32)1)
5433+#else
5434+# define MAX_SHARED_REGIONS ((UINT32)9999)
5435+#endif
5436+
5437+CExRootSurf::CExRootSurf(IUnknown* pContext, CHXBaseSite* pSite, on_new_frame_cb_t on_new_frame_cb, void *context )
5438+ : CBaseRootSurface(pContext, pSite)
5439+ , m_bUseShm(FALSE)
5440+ , m_nShmId(0)
5441+ , m_pDisplay(NULL)
5442+ , m_GC(0)
5443+ , m_nScreenNumber(0)
5444+ , m_pXImage(NULL)
5445+ , m_pVisual(NULL)
5446+ , m_unDepth(0)
5447+ , m_pScreen(NULL)
5448+ , m_pYUVScratchBits(NULL)
5449+ , m_nYUVScratchPitch(0)
5450+ , m_pScratchBits(NULL)
5451+ , m_nScratchPitch(0)
5452+ , m_nBitsPerPixel(0)
5453+ , m_nCompositionSize(0)
5454+ , m_on_new_frame_cb(on_new_frame_cb)
5455+ , m_context(context)
5456+{
5457+}
5458+
5459+HX_RESULT CExRootSurf::Init()
5460+{
5461+ //get window and display from main Site.
5462+ HXxWindow* pWindow = m_pSite->GetWindow();
5463+ HX_ASSERT(pWindow);
5464+
5465+ m_pDisplay = (Display*)pWindow->display;
5466+ m_window = (Window)pWindow->window;
5467+
5468+ HX_ASSERT( m_pDisplay );
5469+ HX_ASSERT( m_window );
5470+
5471+ //
5472+ // Now see if our X11 server supports the Shared Memory extension.
5473+ //
5474+ // ShmHelp::Init(m_pDisplay);
5475+ // m_bUseShm = ShmHelp::ShmAvailable();
5476+
5477+ //Create the graphics context
5478+ XGCValues values;
5479+
5480+ XLockDisplay(m_pDisplay);
5481+ m_GC = XCreateGC(m_pDisplay, m_window, 0, &values);
5482+
5483+ //Get X window attributes & visual
5484+ XWindowAttributes attr;
5485+ XGetWindowAttributes(m_pDisplay, m_window, &attr);
5486+ XUnlockDisplay(m_pDisplay);
5487+ m_pVisual = attr.visual;
5488+
5489+ // get visual info & depth
5490+ int nv=0;
5491+ XVisualInfo visInfo;
5492+ memset(&visInfo, 0, sizeof(XVisualInfo));
5493+ XLockDisplay(m_pDisplay);
5494+ visInfo.visualid = XVisualIDFromVisual(m_pVisual);
5495+ XVisualInfo* pVisualInfo = XGetVisualInfo (m_pDisplay, VisualIDMask, &visInfo, &nv);
5496+// m_unDepth = pVisualInfo->depth;
5497+ m_unDepth = 24;
5498+ m_nScreenNumber = DefaultScreen(m_pDisplay);
5499+ m_pScreen = XScreenOfDisplay(m_pDisplay, m_nScreenNumber);
5500+ XUnlockDisplay(m_pDisplay);
5501+ m_colormap = HXGetXColormap(m_pDisplay, m_window);
5502+
5503+ // get pixmap (blt) information for the best depth we can display
5504+ int i=0;
5505+ int nNum=0;
5506+ XLockDisplay(m_pDisplay);
5507+ XPixmapFormatValues *pixmap_formats = XListPixmapFormats(m_pDisplay, &nNum);
5508+ XUnlockDisplay(m_pDisplay);
5509+ if(pixmap_formats)
5510+ {
5511+ for (i=0 ; i<nNum; i++)
5512+ {
5513+ if (pixmap_formats[i].depth == m_unDepth)
5514+ {
5515+ m_nBitsPerPixel = pixmap_formats[i].bits_per_pixel;
5516+ }
5517+ }
5518+ XFree(pixmap_formats);
5519+ pixmap_formats = NULL;
5520+ }
5521+
5522+ memset(&m_bmiSave, 0, sizeof(HXBitmapInfo));
5523+#if 0
5524+ m_bmiSave.bmiHeader.biBitCount = m_nBitsPerPixel;
5525+ m_bmiSave.bmiHeader.biCompression = (m_unDepth==8 ? BI_RGB : BI_BITFIELDS);
5526+ m_bmiSave.un.dwBitMask[0] = pVisualInfo->red_mask;
5527+ m_bmiSave.un.dwBitMask[1] = pVisualInfo->green_mask;
5528+ m_bmiSave.un.dwBitMask[2] = pVisualInfo->blue_mask;
5529+#else
5530+ /* Fake a RGB24 */
5531+ m_nBitsPerPixel = 24;
5532+ m_bmiSave.bmiHeader.biBitCount = m_nBitsPerPixel;
5533+ m_bmiSave.bmiHeader.biCompression = BI_RGB;
5534+#endif
5535+ //Set primary surface CID.
5536+ m_nCompositionSurfaceCID = GetBitmapColor(&m_bmiSave);
5537+ XFree( pVisualInfo );
5538+
5539+// #ifdef _DEBUG
5540+// //Lets find out what Hsync and Vsync rates we have for this display.
5541+// //Ripped from xvidtune.c
5542+// XF86VidModeModeLine mode_line;
5543+// int scrn=0;
5544+// int dot_clock;
5545+// double vsync_hz, HSyncRate,HTotal, VTotal, PixelClock;
5546+// if(XF86VidModeGetModeLine(m_pDisplay, scrn, &dot_clock, &mode_line))
5547+// {
5548+// PixelClock=dot_clock;
5549+// HTotal = mode_line.htotal;
5550+// VTotal = mode_line.vtotal;
5551+// HSyncRate = PixelClock*1000.0/HTotal;
5552+// vsync_hz = HSyncRate/VTotal;
5553+// fprintf( stderr, "This Display's Hsync rate is: %f and Vsync: %f\n",
5554+// HSyncRate, vsync_hz );
5555+// }
5556+
5557+// #endif
5558+
5559+ return HXR_OK;
5560+}
5561+
5562+CExRootSurf::~CExRootSurf()
5563+{
5564+ _DestroyCompositionSurface();
5565+
5566+ if( m_GC )
5567+ {
5568+ XLockDisplay(m_pDisplay);
5569+ XFreeGC( m_pDisplay, m_GC );
5570+ XUnlockDisplay(m_pDisplay);
5571+ m_GC=0;
5572+ }
5573+ if (m_pVisual)
5574+ {
5575+ /* PJG: don't have to free visuals */
5576+ m_pVisual = NULL;
5577+ }
5578+
5579+ if(m_bUseShm)
5580+ {
5581+ if( m_pCompositionSurface != NULL )
5582+ ShmHelp::DetachSharedRegion(&m_pCompositionSurface, &m_shmInfo);
5583+ }
5584+ else
5585+ {
5586+ HX_DELETE(m_pCompositionSurface);
5587+ m_nCompositionSize=0;
5588+ m_bCompositionSurfaceCreated=FALSE;
5589+ }
5590+
5591+ //XXXgfw any more clean up for these two?
5592+ HX_VECTOR_DELETE( m_pScratchBits );
5593+ HX_VECTOR_DELETE( m_pYUVScratchBits );
5594+
5595+}
5596+
5597+HX_RESULT CExRootSurf::_ResizeVideoBuffer( INT32 nSize)
5598+{
5599+ HX_RESULT retVal=HXR_OK;
5600+
5601+ if(nSize <= m_nCompositionSize)
5602+ return retVal;
5603+
5604+ if(m_bUseShm)
5605+ {
5606+ if( m_pCompositionSurface != NULL )
5607+ retVal = ShmHelp::DetachSharedRegion(&m_pCompositionSurface, &m_shmInfo);
5608+ if( retVal==HXR_OK )
5609+ {
5610+ retVal = ShmHelp::CreateSharedRegion( nSize,
5611+ &m_pCompositionSurface,
5612+ &m_nShmId,
5613+ &m_shmInfo
5614+ );
5615+
5616+ }
5617+ if( retVal != HXR_OK )
5618+ {
5619+ m_bCompositionSurfaceCreated = FALSE;
5620+ m_nCompositionSize = 0;
5621+ m_bUseShm = FALSE;
5622+ }
5623+ else
5624+ {
5625+ //It all worked
5626+ m_nCompositionSize = nSize;
5627+ m_bCompositionSurfaceCreated = TRUE;
5628+ return retVal;
5629+ }
5630+
5631+ }
5632+
5633+ //We need to fall through here so that if the shared memory stuff
5634+ //above fails we can create it the old fashioned way.
5635+ if(m_pCompositionSurface == NULL)
5636+ {
5637+ m_pCompositionSurface = (UCHAR*) malloc(nSize);
5638+ }
5639+ else
5640+ {
5641+ m_pCompositionSurface = (UCHAR*) realloc(m_pCompositionSurface, nSize);
5642+ }
5643+ if( m_pCompositionSurface )
5644+ {
5645+ m_nCompositionSize = nSize;
5646+ }
5647+ else
5648+ {
5649+ HX_ASSERT("We can't alloc the composition surface." == NULL );
5650+ m_nCompositionSize = 0;
5651+ }
5652+
5653+ return retVal;
5654+}
5655+
5656+HX_RESULT CExRootSurf::_DebugBlt( UCHAR* pImageData, HXBitmapInfoHeader* pBitmapInfo,
5657+ HXxRect& rDestRect, HXxRect& rSrcRect)
5658+{
5659+ HX_ASSERT( m_window );
5660+ HX_ASSERT( m_pDisplay );
5661+ HX_ASSERT( m_GC );
5662+ XLockDisplay(m_pDisplay);
5663+ XSetForeground( m_pDisplay, m_GC, WhitePixel(m_pDisplay, 0 ));
5664+ XSetBackground( m_pDisplay, m_GC, BlackPixel(m_pDisplay, 0 ));
5665+ XSetLineAttributes(m_pDisplay, m_GC, 5, LineSolid, CapRound, JoinRound );
5666+ XSetForeground( m_pDisplay, m_GC, WhitePixel(m_pDisplay, 0) );
5667+ XFillRectangle( m_pDisplay, m_window, m_GC,
5668+ rDestRect.left, rDestRect.top,
5669+ rDestRect.right-rDestRect.left,
5670+ rDestRect.bottom-rDestRect.top
5671+ );
5672+ XDrawRectangle( m_pDisplay, m_window, m_GC,
5673+ rDestRect.left, rDestRect.top,
5674+ rDestRect.right-rDestRect.left,
5675+ rDestRect.bottom-rDestRect.top
5676+ );
5677+ XUnlockDisplay(m_pDisplay);
5678+ return HXR_OK;
5679+}
5680+
5681+void CExRootSurf::_GetYUVScratchWidthHeight(UINT32* pWidth, UINT32* pHeight)
5682+{
5683+ *pWidth = m_bmiYUVScratch.bmiHeader.biWidth;
5684+ *pHeight = m_bmiYUVScratch.bmiHeader.biHeight;
5685+}
5686+
5687+XImage* CExRootSurf::_GetCompositionSurfaceDrawable()
5688+{
5689+ return m_pXImage;
5690+}
5691+
5692+
5693+
5694+//Not used except for XING.....
5695+void CExRootSurf::_CreateYUVScratchSurface(UINT32 width, UINT32 height)
5696+{
5697+ //Remove old bits....
5698+ HX_DELETE(m_pYUVScratchBits);
5699+
5700+ //Clear BitmapInfo struct....
5701+ memset(&m_bmiYUVScratch, 0, sizeof(HXBitmapInfo));
5702+ int nResult = MakeBitmap( &m_bmiYUVScratch,
5703+ sizeof(m_bmiYUVScratch),
5704+ CID_YUY2,
5705+ width,
5706+ height,
5707+ NULL,
5708+ 0);
5709+ if( nResult )
5710+ {
5711+ m_pYUVScratchBits = new UCHAR[m_bmiYUVScratch.bmiHeader.biSizeImage];
5712+ m_nYUVScratchPitch = GetBitmapPitch(&m_bmiYUVScratch);
5713+ }
5714+}
5715+
5716+
5717+void CExRootSurf::_GetYUVScratchSurfacePointer(UCHAR** pYUVBits, INT32* YUVPitch)
5718+{
5719+ *pYUVBits = m_pYUVScratchBits;
5720+ *YUVPitch = m_nYUVScratchPitch;
5721+}
5722+
5723+HX_RESULT CExRootSurf::CreateScratchSurface( int nCompositionSurfaceCID, HXxSize* pSize)
5724+{
5725+ //Remove old bits....
5726+ HX_DELETE(m_pScratchBits);
5727+
5728+ //Clear BitmapInfo struct....
5729+ memset(&m_bmiScratch, 0, sizeof(HXBitmapInfo));
5730+ int nResult = MakeBitmap( &m_bmiScratch,
5731+ sizeof(m_bmiScratch),
5732+ nCompositionSurfaceCID,
5733+ pSize->cx,
5734+ pSize->cy,
5735+ NULL,
5736+ 0);
5737+ if( nResult )
5738+ {
5739+ m_pScratchBits = new UCHAR[m_bmiScratch.bmiHeader.biSizeImage];
5740+ m_nScratchPitch = GetBitmapPitch(&m_bmiScratch);
5741+ }
5742+
5743+ return nResult? HXR_OK : HXR_FAIL;
5744+}
5745+
5746+HX_RESULT CExRootSurf::ScratchLock(UCHAR** pBits, INT32* pPitch)
5747+{
5748+ *pBits = m_pScratchBits;
5749+ *pPitch = m_nScratchPitch;
5750+ return HXR_OK;
5751+}
5752+
5753+HX_RESULT CExRootSurf::ScratchUnlock(UCHAR* pBits)
5754+{
5755+ return HXR_OK;
5756+}
5757+
5758+HX_RESULT CExRootSurf::_MinimalUnlock(HXxWindow* pWindow)
5759+{
5760+// Window win = m_window;
5761+// HX_ASSERT(win);
5762+// HXxSize hxxSize;
5763+// m_pSite->GetSize(hxxSize);
5764+
5765+// if (m_bUseShm)
5766+// {
5767+// XShmPutImage(m_pDisplay,
5768+// win,
5769+// m_GC,
5770+// m_pXImage,
5771+// 0,
5772+// 0,
5773+// 0,
5774+// 0,
5775+// hxxSize.cx,
5776+// hxxSize.cy,
5777+// False
5778+// );
5779+// }
5780+// else
5781+// {
5782+// XPutImage(m_pDisplay,
5783+// win,
5784+// m_GC,
5785+// m_pXImage,
5786+// 0,
5787+// 0,
5788+// 0,
5789+// 0,
5790+// hxxSize.cx,
5791+// hxxSize.cy
5792+// );
5793+// }
5794+ return HXR_OK;
5795+}
5796+
5797+HX_RESULT CExRootSurf::_LockComposition(UCHAR** pBits, INT32* pPitch)
5798+{
5799+ HX_RESULT retVal = HXR_OK;
5800+ if( !m_bCompositionSurfaceCreated || m_pCompositionSurface==NULL )
5801+ {
5802+ retVal = _CreateCompositionSurface();
5803+ }
5804+ HX_ASSERT( m_pCompositionSurface );
5805+ *pBits = m_pCompositionSurface;
5806+ *pPitch = m_nCompositionPitch;
5807+ return HXR_OK;
5808+}
5809+
5810+
5811+void CExRootSurf::_BltFromScratchToComposition( HXxRect& rDestRect, HXxRect& rSrcRect)
5812+{
5813+ HX_ASSERT( "Not implemented on unix yet...."==NULL );
5814+}
5815+
5816+HX_RESULT CExRootSurf::_CreateCompositionSurface()
5817+{
5818+ HX_RESULT retVal = HXR_FAIL;
5819+
5820+ if(m_bCompositionSurfaceCreated)
5821+ {
5822+ return HXR_OK;
5823+ }
5824+
5825+ HX_ASSERT( !m_bCompositionSurfaceCreated );
5826+ HX_ASSERT( m_pSite );
5827+
5828+ //Create a BMI to describe the composition surface
5829+ HXxSize hxxSize;
5830+ m_pSite->GetSize(hxxSize);
5831+ memcpy(&m_compositionSize, &hxxSize, sizeof(HXxSize)); /* Flawfinder: ignore */
5832+
5833+ // find out how big we want to allocate.
5834+ if (m_pSite->IsFullScreen())
5835+ {
5836+ UINT16 unDummy=0;
5837+ UINT16 unHorzRes=0;
5838+ UINT16 unVertRes=0;
5839+ m_pSite->_GetDeviceCaps(NULL, unDummy, unHorzRes, unVertRes );
5840+ m_allocatedCompositionSize.cx = unHorzRes;
5841+ m_allocatedCompositionSize.cy = unVertRes;
5842+ }
5843+ else
5844+ {
5845+ // we use root surface for BASIC_BLT and it assumes the offset(position)
5846+ // of the root site it cooresponding to is (0, 0).
5847+ //
5848+ // this is not true for "windowless" mode where the root site can be given
5849+ // an offset, as a result, we fail to blt the video.
5850+ //
5851+ // to fix this, we'll take the m_positionOrg into consideration when
5852+ // creating the composition surface, this may not be optimal but good enough
5853+ // for now.
5854+ //
5855+ // similar logic is also added for other platforms, we need to move this
5856+ // common code to the base class when we have chance to clean it up
5857+ if (m_compositionSize.cx && m_compositionSize.cy)
5858+ {
5859+ m_compositionSize.cx += m_pSite->m_positionOrig.x;
5860+ m_compositionSize.cy += m_pSite->m_positionOrig.y;
5861+ }
5862+
5863+ m_allocatedCompositionSize.cx = m_compositionSize.cx;
5864+ m_allocatedCompositionSize.cy = m_compositionSize.cy;
5865+ }
5866+
5867+ //XXXgfw uhhhh, OK.
5868+ if( m_compositionSize.cx > m_allocatedCompositionSize.cx ||
5869+ m_compositionSize.cy > m_allocatedCompositionSize.cy )
5870+ {
5871+ m_allocatedCompositionSize.cx = m_compositionSize.cx;
5872+ m_allocatedCompositionSize.cy = m_compositionSize.cy;
5873+ }
5874+
5875+ //Make the bitmap header struct.
5876+ m_bmiComposition.bmiHeader.biBitCount = m_bmiSave.bmiHeader.biBitCount;
5877+ m_bmiComposition.bmiHeader.biCompression = m_bmiSave.bmiHeader.biCompression;
5878+ m_bmiComposition.un.dwBitMask[0] = m_bmiSave.un.dwBitMask[0];
5879+ m_bmiComposition.un.dwBitMask[1] = m_bmiSave.un.dwBitMask[1];
5880+ m_bmiComposition.un.dwBitMask[2] = m_bmiSave.un.dwBitMask[2];
5881+ int nResult = MakeBitmap( &m_bmiComposition,
5882+ sizeof(m_bmiComposition),
5883+ m_nCompositionSurfaceCID,
5884+ m_allocatedCompositionSize.cx,
5885+ m_allocatedCompositionSize.cy,
5886+ NULL,
5887+ 0
5888+ );
5889+ m_bmiComposition.bmiHeader.biBitCount = m_bmiSave.bmiHeader.biBitCount;
5890+ m_bmiComposition.bmiHeader.biCompression = m_bmiSave.bmiHeader.biCompression;
5891+ m_bmiComposition.un.dwBitMask[0] = m_bmiSave.un.dwBitMask[0];
5892+ m_bmiComposition.un.dwBitMask[1] = m_bmiSave.un.dwBitMask[1];
5893+ m_bmiComposition.un.dwBitMask[2] = m_bmiSave.un.dwBitMask[2];
5894+
5895+ //Now create the bits....
5896+ _ResizeVideoBuffer( m_bmiComposition.bmiHeader.biSizeImage );
5897+ m_nCompositionPitch = GetBitmapPitch( &m_bmiComposition );
5898+
5899+ if( m_pXImage )
5900+ {
5901+ XFree( m_pXImage );
5902+ }
5903+
5904+ if( m_bUseShm )
5905+ {
5906+ XLockDisplay(m_pDisplay);
5907+ m_pXImage = XShmCreateImage( m_pDisplay,
5908+ m_pVisual,
5909+ m_unDepth,
5910+ ZPixmap,
5911+ (char*)m_pCompositionSurface,
5912+ &m_shmInfo,
5913+ m_allocatedCompositionSize.cx,
5914+ m_allocatedCompositionSize.cy
5915+ );
5916+ XUnlockDisplay(m_pDisplay);
5917+ }
5918+ else
5919+ {
5920+ XLockDisplay(m_pDisplay);
5921+ m_pXImage = XCreateImage( m_pDisplay,
5922+ m_pVisual,
5923+ m_unDepth,
5924+ ZPixmap,
5925+ 0,
5926+ (char*)m_pCompositionSurface,
5927+ m_allocatedCompositionSize.cx,
5928+ m_allocatedCompositionSize.cy,
5929+ 32,
5930+ 0);
5931+ XUnlockDisplay(m_pDisplay);
5932+ }
5933+
5934+ if( m_pXImage )
5935+ {
5936+ m_bCompositionSurfaceCreated = TRUE;
5937+#ifdef _BIG_ENDIAN
5938+ m_pXImage->byte_order = MSBFirst;
5939+#else
5940+ m_pXImage->byte_order = LSBFirst;
5941+#endif
5942+ retVal = HXR_OK;
5943+ }
5944+ return retVal;
5945+}
5946+
5947+void CExRootSurf::_MinimalBlt(HXxRect& destRect)
5948+{
5949+ if (m_on_new_frame_cb)
5950+ {
5951+ PlayerImgInfo Info;
5952+ Info.Rect.left = destRect.left;
5953+ Info.Rect.right = destRect.right;
5954+ Info.Rect.top = destRect.top;
5955+ Info.Rect.bottom = destRect.bottom;
5956+ Info.cx = m_allocatedCompositionSize.cx;
5957+ Info.cy = m_allocatedCompositionSize.cy;
5958+ m_on_new_frame_cb(m_pCompositionSurface,
5959+ m_bmiComposition.bmiHeader.biSizeImage,
5960+ &Info,
5961+ m_context);
5962+ }
5963+}
5964+
5965+HX_RESULT CExRootSurf::_DestroyCompositionSurface()
5966+{
5967+ HX_RESULT retVal = HXR_OK;
5968+ if( m_bCompositionSurfaceCreated )
5969+ {
5970+ if( m_pXImage )
5971+ {
5972+ XFree(m_pXImage);
5973+ m_pXImage = NULL;
5974+ }
5975+ m_bCompositionSurfaceCreated = FALSE;
5976+ }
5977+
5978+ return retVal;
5979+}
5980+
5981+
5982+
5983+HX_RESULT CExRootSurf::BeginOptimizedBlt(HXBitmapInfoHeader* pBitmapInfo)
5984+{
5985+#ifdef _DEBUG
5986+ fprintf(stderr, "CExRootSurf::BeginOptimizedBlt Needs to be written\n" );
5987+#endif
5988+ return HXR_NOTIMPL;
5989+}
5990+
5991+HX_RESULT CExRootSurf::OptimizedBlt( UCHAR* pImageBits,
5992+ HXxRect& rDestRect,
5993+ HXxRect& rSrcRect)
5994+{
5995+#ifdef _DEBUG
5996+ fprintf(stderr, "CExRootSurf::OptimizedBlt Needs to be written\n" );
5997+#endif
5998+ return HXR_NOTIMPL;
5999+}
6000+
6001+HX_RESULT CExRootSurf::EndOptimizedBlt(void)
6002+{
6003+#ifdef _DEBUG
6004+ fprintf(stderr, "CExRootSurf::EndOptimizedBlt Needs to be written\n" );
6005+#endif
6006+ return HXR_NOTIMPL;
6007+}
6008+
6009+HX_RESULT CExRootSurf::GetOptimizedFormat(HX_COMPRESSION_TYPE& ulType)
6010+{
6011+#ifdef _DEBUG
6012+ fprintf(stderr, "CExRootSurf::GetOptimizedFormat Needs to be written\n" );
6013+#endif
6014+ return HXR_NOTIMPL;
6015+}
6016+
6017+HX_RESULT CExRootSurf::GetPreferredFormat(HX_COMPRESSION_TYPE& ulType)
6018+{
6019+#ifdef _DEBUG
6020+ fprintf(stderr, "CExRootSurf::GetPreferredFormat Needs to be written\n" );
6021+#endif
6022+ return HXR_NOTIMPL;
6023+}
6024+
6025+GC CExRootSurf::GetGC()
6026+{
6027+ return m_GC;
6028+}
6029Index: helix-libs/clientapps/clutter/exroot.h
6030===================================================================
6031--- /dev/null 1970-01-01 00:00:00.000000000 +0000
6032+++ helix-libs/clientapps/clutter/exroot.h 2008-10-13 06:05:49.000000000 -0700
6033@@ -0,0 +1,155 @@
6034+/* ***** BEGIN LICENSE BLOCK *****
6035+ * Source last modified: $Id: unixroot.h,v 1.8 2007/07/06 20:54:05 jfinnecy Exp $
6036+ *
6037+ * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
6038+ *
6039+ * The contents of this file, and the files included with this file,
6040+ * are subject to the current version of the RealNetworks Public
6041+ * Source License (the "RPSL") available at
6042+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
6043+ * the file under the current version of the RealNetworks Community
6044+ * Source License (the "RCSL") available at
6045+ * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
6046+ * will apply. You may also obtain the license terms directly from
6047+ * RealNetworks. You may not use this file except in compliance with
6048+ * the RPSL or, if you have a valid RCSL with RealNetworks applicable
6049+ * to this file, the RCSL. Please see the applicable RPSL or RCSL for
6050+ * the rights, obligations and limitations governing use of the
6051+ * contents of the file.
6052+ *
6053+ * Alternatively, the contents of this file may be used under the
6054+ * terms of the GNU General Public License Version 2 (the
6055+ * "GPL") in which case the provisions of the GPL are applicable
6056+ * instead of those above. If you wish to allow use of your version of
6057+ * this file only under the terms of the GPL, and not to allow others
6058+ * to use your version of this file under the terms of either the RPSL
6059+ * or RCSL, indicate your decision by deleting the provisions above
6060+ * and replace them with the notice and other provisions required by
6061+ * the GPL. If you do not delete the provisions above, a recipient may
6062+ * use your version of this file under the terms of any one of the
6063+ * RPSL, the RCSL or the GPL.
6064+ *
6065+ * This file is part of the Helix DNA Technology. RealNetworks is the
6066+ * developer of the Original Code and owns the copyrights in the
6067+ * portions it created.
6068+ *
6069+ * This file, and the files included with this file, is distributed
6070+ * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
6071+ * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
6072+ * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
6073+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
6074+ * ENJOYMENT OR NON-INFRINGEMENT.
6075+ *
6076+ * Technology Compatibility Kit Test Suite(s) Location:
6077+ * http://www.helixcommunity.org/content/tck
6078+ *
6079+ * Contributor(s):
6080+ *
6081+ * ***** END LICENSE BLOCK ***** */
6082+
6083+#ifndef _UNIXROOT_H
6084+#define _UNIXROOT_H
6085+
6086+#include "baseroot.h"
6087+#if defined(USE_XWINDOWS)
6088+#include <X11/Xatom.h>
6089+#include <X11/Xlib.h>
6090+#include <X11/Xutil.h>
6091+#include <X11/Xos.h>
6092+#include <X11/Intrinsic.h>
6093+#include <X11/extensions/XShm.h>
6094+#endif
6095+
6096+#include "player.h"
6097+
6098+class CExRootSurf : public CBaseRootSurface
6099+{
6100+public:
6101+ CExRootSurf(IUnknown* pContext, CHXBaseSite* pSite, on_new_frame_cb_t on_new_frame_cb = NULL, void *context = NULL);
6102+
6103+ //Helpers....
6104+ HX_RESULT Init();
6105+ GC GetGC();
6106+
6107+ //public inherited stuff
6108+ virtual HX_RESULT CreateScratchSurface(int nCompositionSurfaceCID,
6109+ HXxSize* pSize);
6110+ virtual HX_RESULT ScratchLock(UCHAR** pBits, INT32* pPitch);
6111+ virtual HX_RESULT ScratchUnlock(UCHAR* pBits);
6112+
6113+ virtual HX_RESULT BeginOptimizedBlt(HXBitmapInfoHeader* pBitmapInfo);
6114+ virtual HX_RESULT OptimizedBlt( UCHAR* pImageBits,
6115+ HXxRect& rDestRect,
6116+ HXxRect& rSrcRect);
6117+ virtual HX_RESULT EndOptimizedBlt(void);
6118+ virtual HX_RESULT GetOptimizedFormat(HX_COMPRESSION_TYPE& ulType);
6119+ virtual HX_RESULT GetPreferredFormat(HX_COMPRESSION_TYPE& ulType);
6120+
6121+ XImage* _GetCompositionSurfaceDrawable();
6122+
6123+ //Shared Memory helper func for the basesurf to use.
6124+// HX_RESULT _DetachSharedRegion();
6125+// HX_RESULT _CreateSharedRegion(INT32 nSize);
6126+
6127+protected:
6128+
6129+ //Smartly handle resizing of shm buffer.
6130+ HX_RESULT _ResizeVideoBuffer(INT32 nSize);
6131+
6132+ //Inherited from CBaseRootSurface....
6133+ virtual void _BltFromScratchToComposition(HXxRect& rDestRect,
6134+ HXxRect& rSrcRect);
6135+ virtual HX_RESULT _DebugBlt( UCHAR* pImageData,
6136+ HXBitmapInfoHeader* pBitmapInfo,
6137+ HXxRect& rDestRect,
6138+ HXxRect& rSrcRect);
6139+ virtual void _GetYUVScratchWidthHeight(UINT32* pWidth, UINT32* pHeight);
6140+ virtual void _CreateYUVScratchSurface(UINT32 width, UINT32 height);
6141+ virtual void _GetYUVScratchSurfacePointer(UCHAR** pYUVBits, INT32* YUVPitch);
6142+ virtual HX_RESULT _MinimalUnlock(HXxWindow* pWindow);
6143+ virtual HX_RESULT _LockComposition(UCHAR** pBits, INT32* pPitch);
6144+ virtual HX_RESULT _CreateCompositionSurface();
6145+ virtual HX_RESULT _DestroyCompositionSurface();
6146+ virtual void _MinimalBlt(HXxRect& dest);
6147+
6148+
6149+private:
6150+
6151+ virtual ~CExRootSurf();
6152+
6153+ //Protect unintentional copy and default ctors.
6154+ CExRootSurf();
6155+ CExRootSurf( const CExRootSurf& );
6156+ CExRootSurf& operator=( const CExRootSurf& it );
6157+
6158+ //Shared memory members.
6159+ HXBOOL m_bUseShm;
6160+ XShmSegmentInfo m_shmInfo;
6161+ int m_nShmId;
6162+
6163+ //General display and GC stuff.
6164+ Display* m_pDisplay;
6165+ GC m_GC;
6166+ int m_nScreenNumber;
6167+ XImage* m_pXImage;
6168+ Window m_window;
6169+ Visual* m_pVisual;
6170+ unsigned int m_unDepth;
6171+ Screen* m_pScreen;
6172+ Colormap m_colormap;
6173+ int m_nBitsPerPixel;
6174+
6175+ //Bitmap stuff.
6176+ UCHAR* m_pYUVScratchBits;
6177+ HXBitmapInfo m_bmiYUVScratch;
6178+ int m_nYUVScratchPitch;
6179+ UCHAR* m_pScratchBits;
6180+ HXBitmapInfo m_bmiScratch;
6181+ int m_nScratchPitch;
6182+ HXBitmapInfo m_bmiSave;
6183+ ULONG32 m_nCompositionSize;
6184+ on_new_frame_cb_t m_on_new_frame_cb;
6185+ void * m_context;
6186+};
6187+
6188+#endif
6189Index: helix-libs/clientapps/clutter/exsite.cpp
6190===================================================================
6191--- /dev/null 1970-01-01 00:00:00.000000000 +0000
6192+++ helix-libs/clientapps/clutter/exsite.cpp 2008-10-13 06:05:49.000000000 -0700
6193@@ -0,0 +1,2915 @@
6194+/* ***** BEGIN LICENSE BLOCK *****
6195+ * Source last modified: $Id: unixsite.cpp,v 1.18.2.6 2008/06/05 14:24:30 lovish Exp $
6196+ *
6197+ * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
6198+ *
6199+ * The contents of this file, and the files included with this file,
6200+ * are subject to the current version of the RealNetworks Public
6201+ * Source License (the "RPSL") available at
6202+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
6203+ * the file under the current version of the RealNetworks Community
6204+ * Source License (the "RCSL") available at
6205+ * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
6206+ * will apply. You may also obtain the license terms directly from
6207+ * RealNetworks. You may not use this file except in compliance with
6208+ * the RPSL or, if you have a valid RCSL with RealNetworks applicable
6209+ * to this file, the RCSL. Please see the applicable RPSL or RCSL for
6210+ * the rights, obligations and limitations governing use of the
6211+ * contents of the file.
6212+ *
6213+ * Alternatively, the contents of this file may be used under the
6214+ * terms of the GNU General Public License Version 2 (the
6215+ * "GPL") in which case the provisions of the GPL are applicable
6216+ * instead of those above. If you wish to allow use of your version of
6217+ * this file only under the terms of the GPL, and not to allow others
6218+ * to use your version of this file under the terms of either the RPSL
6219+ * or RCSL, indicate your decision by deleting the provisions above
6220+ * and replace them with the notice and other provisions required by
6221+ * the GPL. If you do not delete the provisions above, a recipient may
6222+ * use your version of this file under the terms of any one of the
6223+ * RPSL, the RCSL or the GPL.
6224+ *
6225+ * This file is part of the Helix DNA Technology. RealNetworks is the
6226+ * developer of the Original Code and owns the copyrights in the
6227+ * portions it created.
6228+ *
6229+ * This file, and the files included with this file, is distributed
6230+ * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
6231+ * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
6232+ * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
6233+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
6234+ * ENJOYMENT OR NON-INFRINGEMENT.
6235+ *
6236+ * Technology Compatibility Kit Test Suite(s) Location:
6237+ * http://www.helixcommunity.org/content/tck
6238+ *
6239+ * Contributor(s):
6240+ * Phil Dibowitz
6241+ *
6242+ * ***** END LICENSE BLOCK ***** */
6243+
6244+#ifndef _UNIX
6245+#error This is the UNIX platform specific implementation.
6246+#endif
6247+
6248+//
6249+// System includes...
6250+//
6251+#include <stdio.h>
6252+#include "hlxclib/string.h"
6253+#if defined(USE_XWINDOWS)
6254+#include <X11/Intrinsic.h>
6255+#include <X11/Shell.h>
6256+#include <X11/Xlib.h>
6257+#include <X11/Xutil.h>
6258+#include <X11/keysym.h>
6259+#include <X11/Xos.h>
6260+#include <X11/cursorfont.h>
6261+#include <X11/extensions/XShm.h>
6262+#endif
6263+
6264+
6265+//
6266+// RMA includes...
6267+//
6268+#include "hxcom.h"
6269+#include "hxcore.h"
6270+#include "hxevent.h"
6271+#include "hxwintyp.h"
6272+#include "hxwin.h"
6273+#include "hxsite2.h"
6274+#include "hxtypes.h"
6275+#include "exsite.h"
6276+#include "unixcmap.h"
6277+#include "visuals.h"
6278+#include "region.h"
6279+#include "basesurf.h"
6280+#include "exroot.h"
6281+#include "hxthread.h"
6282+#include "hxtick.h"
6283+#include "sitetext.h"
6284+
6285+#include "unixsurf.h"
6286+
6287+#include "hxprefs.h"
6288+
6289+//
6290+// Global & Static global/member data....
6291+//
6292+Display *CHXExSite::zm_display = NULL;
6293+static CHXMapPtrToPtr z_mapSiteToWindow;
6294+
6295+//
6296+// Scroll bar support
6297+//
6298+#define SCROLL_BAR_WIDTH 13 //Width of scroll bar.
6299+//#define _ARROWS_SIDE_BY_SIDE 1 //Regular or side by side arrows?
6300+
6301+
6302+
6303+
6304+//
6305+// CHXExSite only Methods...
6306+//
6307+CHXExSite::CHXExSite( IUnknown* pContext, IUnknown* pUnkOuter, INT32 lInitialZorder, on_new_frame_cb_t on_new_frame_cb, void *context)
6308+ : CHXBaseSite( pContext, pUnkOuter, lInitialZorder )
6309+ , m_pUnixEventHandler(NULL)
6310+ , m_ScrollHorizButtonL(0)
6311+ , m_ScrollHorizButtonR(0)
6312+ , m_ScrollVertButtonT(0)
6313+ , m_ScrollVertButtonB(0)
6314+ , m_winFullScreenWindow(0)
6315+ , m_winOldParent(0)
6316+ , m_bScrollingInProgress(FALSE)
6317+ , m_nScrollDir(0)
6318+ , m_bLastPointInSite(FALSE)
6319+ , m_bDamaged(FALSE)
6320+ , m_bIgnoreFocusOutInFS(FALSE)
6321+ , m_bReparent(FALSE)
6322+ , m_on_new_frame_cb(on_new_frame_cb)
6323+ , m_context(context)
6324+#if defined(HELIX_CONFIG_MOBLIN)
6325+ , m_pAttachWindowCallback(NULL)
6326+ , m_pForceRedrawCallback(NULL)
6327+#endif
6328+{
6329+ m_ptScrollVertPosT.x = m_ptScrollVertPosT.y = 0;
6330+ m_ptScrollVertPosB.x = m_ptScrollVertPosB.y = 0;
6331+ m_ptScrollHorizPosR.x = m_ptScrollHorizPosR.y = 0;
6332+ m_ptScrollHorizPosL.x = m_ptScrollHorizPosL.y = 0;
6333+ m_ptFullScreenOffset.x = m_ptFullScreenOffset.y = 0;
6334+ memset( &m_PreFullScreenSize, 0, sizeof( m_PreFullScreenSize ) );
6335+
6336+ HX_ASSERT( m_pContext );
6337+
6338+ /* Replace m_pVideoSurface with my own */
6339+/* HX_RELEASE(m_pVideoSurface);
6340+ m_pVideoSurface = new CUnixSurf(m_pContext, this);
6341+ HX_ASSERT( m_pVideoSurface );
6342+ m_pVideoSurface->InitSurface(m_pContext);
6343+ m_pVideoSurface->AddRef();
6344+*/
6345+ IHXPreferences* pPreferences = NULL;
6346+ if( m_pContext && HXR_OK == m_pContext->QueryInterface( IID_IHXPreferences, (void **) &pPreferences))
6347+ {
6348+ IHXBuffer *pBuffer = NULL;
6349+ pPreferences->ReadPref("IgnoreFocusOutInFS", pBuffer);
6350+ if(pBuffer)
6351+ {
6352+ m_bIgnoreFocusOutInFS = (::atoi((const char*)pBuffer->GetBuffer()) == 1);
6353+ HX_RELEASE(pBuffer);
6354+ }
6355+ }
6356+}
6357+
6358+CHXExSite::~CHXExSite()
6359+{
6360+#if defined(HELIX_CONFIG_MOBLIN)
6361+ RemovePendingCallback(m_pAttachWindowCallback);
6362+ HX_RELEASE(m_pAttachWindowCallback);
6363+
6364+ RemovePendingCallback(m_pForceRedrawCallback);
6365+ HX_RELEASE(m_pForceRedrawCallback);
6366+#endif
6367+ void* pDummy;
6368+ if (z_mapSiteToWindow.Lookup((void*)this, pDummy))
6369+ {
6370+ z_mapSiteToWindow.RemoveKey((void*)this);
6371+ }
6372+
6373+ if( m_pUnixEventHandler )
6374+ {
6375+ m_pUnixEventHandler->CancelCallback();
6376+ HX_RELEASE(m_pUnixEventHandler);
6377+ }
6378+}
6379+
6380+HX_RESULT CHXExSite::_OpenXDisplay(char* pszDisplayString)
6381+{
6382+ HX_RESULT retVal = HXR_OK;
6383+
6384+ //Is the connection open already?
6385+ if( NULL==zm_display )
6386+ {
6387+ zm_display = XOpenDisplay(pszDisplayString);
6388+
6389+ //If you can't open the display your done.
6390+ if(NULL == zm_display )
6391+ {
6392+ HX_ASSERT("Can't open X Display..."==NULL);
6393+ retVal = HXR_FAIL;
6394+ }
6395+ else
6396+ {
6397+ HX_ASSERT(m_pScheduler);
6398+ if( m_pScheduler )
6399+ {
6400+ //UnixEventHandler scheduls itself for init callback
6401+ //in the ctor.
6402+ m_pUnixEventHandler = new UnixEventHandler(this);
6403+ m_pUnixEventHandler->AddRef();
6404+ }
6405+ }
6406+ }
6407+ return retVal;
6408+}
6409+
6410+Window CHXExSite::CreateXWindow( Window win )
6411+{
6412+ Window parentWindow;
6413+ HXxWindow* pWindow = NULL;
6414+ //If parentWin is NULL then we belong to the root window.
6415+ if( win )
6416+ {
6417+ parentWindow = win;
6418+ }
6419+ else
6420+ {
6421+ HX_ASSERT(zm_display);
6422+ XLockDisplay(zm_display);
6423+ parentWindow = RootWindow(zm_display, DefaultScreen(zm_display));
6424+ XUnlockDisplay(zm_display);
6425+ }
6426+
6427+ //Find the best visual to use on this display.
6428+ Visual* visual = GetBestVisual(zm_display);
6429+
6430+ //Get the visual info.
6431+ int nNotUsed=0;
6432+ XVisualInfo stVisInfo;
6433+
6434+ memset(&stVisInfo, 0, sizeof(XVisualInfo));
6435+ stVisInfo.visualid = XVisualIDFromVisual(visual);
6436+ XLockDisplay(zm_display);
6437+ XVisualInfo* pVisual = XGetVisualInfo( zm_display,
6438+ VisualIDMask,
6439+ &stVisInfo,
6440+ &nNotUsed );
6441+ XUnlockDisplay(zm_display);
6442+
6443+ // Set up attributes of the window.
6444+ int attrMask = CWBackPixel | CWBorderPixel;
6445+ XSetWindowAttributes attr;
6446+
6447+ memset(&attr, 0, sizeof(XSetWindowAttributes));
6448+ XLockDisplay(zm_display);
6449+ attr.background_pixel = BlackPixel(zm_display, DefaultScreen(zm_display));
6450+ attr.border_pixel = BlackPixel(zm_display, DefaultScreen(zm_display));
6451+ XUnlockDisplay(zm_display);
6452+
6453+ //See if the default visaul of hte screen is the same one we Want
6454+ //to use. If not, create a new one and install it.
6455+ Colormap cmap;
6456+ XLockDisplay(zm_display);
6457+ Visual* defVisual = DefaultVisual(zm_display, DefaultScreen(zm_display));
6458+ XUnlockDisplay(zm_display);
6459+ if( defVisual->visualid != stVisInfo.visualid )
6460+ {
6461+ //XXXgfw Are we leaking this colormap????
6462+ XLockDisplay(zm_display);
6463+ cmap = XCreateColormap(zm_display, parentWindow, visual, AllocNone);
6464+ XUnlockDisplay(zm_display);
6465+ attr.colormap = cmap;
6466+ attrMask |= CWColormap;
6467+ }
6468+
6469+ // Set the size/position of the window before creating.
6470+ XSizeHints size_hints;
6471+
6472+ size_hints.flags = PPosition | PSize;
6473+ size_hints.x = m_position.x;
6474+ size_hints.y = m_position.y;
6475+ size_hints.width = 1;
6476+ size_hints.height = 1;
6477+
6478+ //Create it.
6479+ XLockDisplay(zm_display);
6480+ Window window = XCreateWindow(zm_display,
6481+ parentWindow,
6482+ size_hints.x,
6483+ size_hints.y,
6484+ size_hints.width,
6485+ size_hints.height,
6486+ 0,
6487+ pVisual->depth,
6488+ InputOutput,
6489+ visual,
6490+ attrMask,
6491+ &attr);
6492+ XUnlockDisplay(zm_display);
6493+ XFree(pVisual);
6494+
6495+ //Tell the WM about this window.
6496+#if 0
6497+ XSetStandardProperties( zm_display,
6498+ window,
6499+ "CHXExSite",
6500+ "CHXExSite",
6501+ None,
6502+ NULL, 0,
6503+ &size_hints
6504+ );
6505+#endif
6506+
6507+ //Select all input events on the window since the other platforms
6508+ //we work with have no concept of event masks
6509+ XLockDisplay(zm_display);
6510+#if 0
6511+ int result = XSelectInput( zm_display, window,
6512+ ButtonPressMask | ButtonReleaseMask | KeyPressMask |
6513+ KeyReleaseMask | EnterWindowMask | LeaveWindowMask |
6514+ PointerMotionMask | ButtonMotionMask | KeymapStateMask |
6515+ ExposureMask | StructureNotifyMask | FocusChangeMask
6516+ );
6517+#else
6518+ int result = XSelectInput( zm_display, window, 0 );
6519+
6520+
6521+#endif
6522+ XUnlockDisplay(zm_display);
6523+ if( BadWindow == result )
6524+ {
6525+#ifdef _DEBUG
6526+ fprintf( stderr, "Can select events.\n" );
6527+#endif
6528+ }
6529+
6530+ //Map the window.
6531+ XLockDisplay(zm_display);
6532+ /* XMapWindow(zm_display, window); */
6533+
6534+ //Flush event queue.
6535+ XFlush(zm_display);
6536+ XUnlockDisplay(zm_display);
6537+
6538+
6539+ return window;
6540+}
6541+
6542+void CHXExSite::_MapHorzScroll()
6543+{
6544+#if 0
6545+ if( GetWindow() && GetWindow()->display && m_ScrollHorizButtonL)
6546+ {
6547+ Display* pDis = (Display*)GetWindow()->display;
6548+ XLockDisplay(pDis);
6549+ XMapWindow( pDis, m_ScrollHorizButtonL );
6550+ XMapWindow( pDis, m_ScrollHorizButtonR );
6551+ XUnlockDisplay(pDis);
6552+ }
6553+ _DrawArrows();
6554+#endif
6555+}
6556+
6557+void CHXExSite::_MapVertScroll()
6558+{
6559+#if 0
6560+ if( GetWindow() && GetWindow()->display && m_ScrollVertButtonT)
6561+ {
6562+ Display* pDis = (Display*)GetWindow()->display;
6563+ XLockDisplay(pDis);
6564+ XMapWindow( pDis, m_ScrollVertButtonT );
6565+ XMapWindow( pDis, m_ScrollVertButtonB );
6566+ XUnlockDisplay(pDis);
6567+ }
6568+ _DrawArrows();
6569+#endif
6570+}
6571+
6572+void CHXExSite::_MapScrollButtons()
6573+{
6574+#if 0
6575+ _MapHorzScroll();
6576+ _MapVertScroll();
6577+#endif
6578+}
6579+
6580+void CHXExSite::_UnmapHorzScroll()
6581+{
6582+#if 0
6583+ HX_ASSERT( GetWindow() );
6584+ if( m_ScrollHorizButtonL && GetWindow()->display )
6585+ {
6586+ Display* pDis = (Display*)GetWindow()->display;
6587+ XLockDisplay(pDis);
6588+ XUnmapWindow( pDis, m_ScrollHorizButtonL );
6589+ XUnmapWindow( pDis, m_ScrollHorizButtonR );
6590+ XUnlockDisplay(pDis);
6591+ }
6592+#endif
6593+}
6594+void CHXExSite::_UnmapVertScroll()
6595+{
6596+#if 0
6597+ HX_ASSERT( GetWindow() );
6598+ if( m_ScrollVertButtonT && GetWindow()->display )
6599+ {
6600+ Display* pDis = (Display*)GetWindow()->display;
6601+ XLockDisplay(pDis);
6602+ XUnmapWindow( pDis, m_ScrollVertButtonT );
6603+ XUnmapWindow( pDis, m_ScrollVertButtonB );
6604+ XUnlockDisplay(pDis);
6605+ }
6606+#endif
6607+}
6608+
6609+void CHXExSite::_UnmapScrollButtons()
6610+{
6611+#if 0
6612+ if( GetWindow() )
6613+ {
6614+ _UnmapVertScroll();
6615+ _UnmapHorzScroll();
6616+ }
6617+#endif
6618+}
6619+
6620+void CHXExSite::_DestroyScrollButtons()
6621+{
6622+ HXxWindow* pWin = GetWindow();
6623+ Display* pDis = (Display*)(pWin?pWin->display:NULL);
6624+
6625+ if( m_ScrollHorizButtonL && pDis )
6626+ {
6627+ XLockDisplay(pDis);
6628+ XDestroyWindow( pDis, m_ScrollHorizButtonL );
6629+ m_ScrollHorizButtonL = 0;
6630+ XDestroyWindow( pDis, m_ScrollHorizButtonR );
6631+ XUnlockDisplay(pDis);
6632+ m_ScrollHorizButtonR = 0;
6633+ }
6634+
6635+ if( m_ScrollVertButtonT && pDis)
6636+ {
6637+ XLockDisplay(pDis);
6638+ XDestroyWindow( pDis, m_ScrollVertButtonT );
6639+ m_ScrollVertButtonT = 0;
6640+ XDestroyWindow( pDis, m_ScrollVertButtonB );
6641+ XUnlockDisplay(pDis);
6642+ m_ScrollVertButtonB = 0;
6643+ }
6644+ m_ptScrollVertPosT.x = m_ptScrollVertPosT.y = 0;
6645+ m_ptScrollVertPosB.x = m_ptScrollVertPosB.y = 0;
6646+ m_ptScrollHorizPosR.x = m_ptScrollHorizPosR.y = 0;
6647+ m_ptScrollHorizPosL.x = m_ptScrollHorizPosL.y = 0;
6648+}
6649+
6650+void CHXExSite::_DrawArrows()
6651+{
6652+#if 0 //Paul Debug
6653+ //only do the work if our site is visible.
6654+ if( !IsSiteVisible() )
6655+ return;
6656+
6657+ //Draw an arrow on this window.
6658+ XPoint points[4];
6659+ int offset = SCROLL_BAR_WIDTH/10;
6660+ GC tmpGC;
6661+ XGCValues values;
6662+ Display* dis = (Display*)GetWindow()->display;
6663+
6664+ if( m_ScrollVertButtonB )
6665+ {
6666+ XLockDisplay(dis);
6667+ tmpGC = XCreateGC( dis, m_ScrollVertButtonB, 0, &values );
6668+ XUnlockDisplay(dis);
6669+ }
6670+ else if( m_ScrollHorizButtonL )
6671+ {
6672+ XLockDisplay(dis);
6673+ tmpGC = XCreateGC( dis, m_ScrollHorizButtonL, 0, &values );
6674+ XUnlockDisplay(dis);
6675+ }
6676+ else
6677+ {
6678+ //We don't have any scroll bars to draw....
6679+ return;
6680+ }
6681+
6682+
6683+ XLockDisplay(dis);
6684+ XSetForeground( dis, tmpGC, WhitePixel(dis, 0 ));
6685+ XSetBackground( dis, tmpGC, BlackPixel(dis, 0 ));
6686+ XUnlockDisplay(dis);
6687+ Colormap cmap = HXGetXColormap((Display*)GetWindow()->display,
6688+ (Window)GetWindow()->window);
6689+ XColor color;
6690+
6691+ memset(&color, 0, sizeof(XColor));
6692+ XLockDisplay(dis);
6693+ XParseColor(dis, cmap, "blue", &color);
6694+ XUnlockDisplay(dis);
6695+ HXFindBestXColor(dis, cmap, &color);
6696+ XLockDisplay(dis);
6697+ XSetForeground( dis, tmpGC, color.pixel);
6698+ XSetLineAttributes(dis, tmpGC, 1, LineSolid, CapRound, JoinRound );
6699+ XUnlockDisplay(dis);
6700+
6701+
6702+ //Draw up Vertical arrow.
6703+ if( m_ScrollVertButtonT )
6704+ {
6705+ points[0].x = offset;
6706+ points[0].y = SCROLL_BAR_WIDTH-offset;
6707+ points[1].x = SCROLL_BAR_WIDTH/2;
6708+ points[1].y = offset;
6709+ points[2].x = SCROLL_BAR_WIDTH-offset;
6710+ points[2].y = SCROLL_BAR_WIDTH-offset;
6711+ points[3].x = points[0].x;
6712+ points[3].y = points[0].y;
6713+ XLockDisplay(dis);
6714+ XFillPolygon( dis, m_ScrollVertButtonT, tmpGC, points, 4, Convex, CoordModeOrigin);
6715+ XUnlockDisplay(dis);
6716+ }
6717+
6718+ //Draw down Vertical arrow.
6719+ if( m_ScrollVertButtonB )
6720+ {
6721+ points[0].x = offset;
6722+ points[0].y = offset;
6723+ points[1].x = SCROLL_BAR_WIDTH-offset;
6724+ points[1].y = offset;
6725+ points[2].x = SCROLL_BAR_WIDTH/2;
6726+ points[2].y = SCROLL_BAR_WIDTH-offset;
6727+ points[3].x = points[0].x;
6728+ points[3].y = points[0].y;
6729+ XLockDisplay(dis);
6730+ XFillPolygon( dis, m_ScrollVertButtonB, tmpGC, points, 4, Convex, CoordModeOrigin);
6731+ XUnlockDisplay(dis);
6732+ }
6733+
6734+ //Draw Left Horizontal arrow.
6735+ if( m_ScrollHorizButtonL )
6736+ {
6737+ points[0].x = SCROLL_BAR_WIDTH-offset;
6738+ points[0].y = offset;
6739+ points[1].x = SCROLL_BAR_WIDTH-offset;
6740+ points[1].y = SCROLL_BAR_WIDTH-offset;
6741+ points[2].x = offset;
6742+ points[2].y = SCROLL_BAR_WIDTH/2;
6743+ points[3].x = points[0].x;
6744+ points[3].y = points[0].y;
6745+ XLockDisplay(dis);
6746+ XFillPolygon( dis, m_ScrollHorizButtonL, tmpGC, points, 4, Convex, CoordModeOrigin);
6747+ XUnlockDisplay(dis);
6748+ }
6749+
6750+ //Draw Right Horizontal arrow.
6751+ if( m_ScrollHorizButtonR )
6752+ {
6753+ points[0].x = offset;
6754+ points[0].y = SCROLL_BAR_WIDTH-offset;
6755+ points[1].x = offset;
6756+ points[1].y = offset;
6757+ points[2].x = SCROLL_BAR_WIDTH-offset;
6758+ points[2].y = SCROLL_BAR_WIDTH/2;
6759+ points[3].x = points[0].x;
6760+ points[3].y = points[0].y;
6761+ XLockDisplay(dis);
6762+ XFillPolygon( dis, m_ScrollHorizButtonR, tmpGC, points, 4, Convex, CoordModeOrigin);
6763+ XUnlockDisplay(dis);
6764+ }
6765+
6766+ //Free the GC and go.
6767+ XLockDisplay(dis);
6768+ XFreeGC( dis, tmpGC );
6769+ XUnlockDisplay(dis);
6770+#endif
6771+}
6772+
6773+HXBOOL CHXExSite::_InButton( HXxPoint& pt, int x, int y )
6774+{
6775+ HXBOOL retVal =FALSE;
6776+ if( x>= pt.x && x< pt.x+SCROLL_BAR_WIDTH && y>=pt.y && y<pt.y+SCROLL_BAR_WIDTH )
6777+ retVal=TRUE;
6778+ else
6779+ retVal=FALSE;
6780+
6781+ return retVal;
6782+}
6783+
6784+void CHXExSite::_CreateHorizScrollBar()
6785+{
6786+ HX_ASSERT( m_ScrollHorizButtonL == 0 );
6787+ HX_ASSERT( m_ScrollHorizButtonR == 0 );
6788+
6789+ HXxSize mySize;
6790+
6791+ HXxWindow* pParentWindow = NULL;
6792+ if(GetParentSite())
6793+ {
6794+ pParentWindow = GetParentSite()->GetWindow();
6795+ }
6796+ if(pParentWindow)
6797+ {
6798+ GetParentSite()->GetSize(mySize);
6799+ }
6800+
6801+ HX_ASSERT( pParentWindow );
6802+ HX_ASSERT( pParentWindow->window != 0 );
6803+
6804+ if( m_ScrollVertButtonB )
6805+ {
6806+ // if the other bar already exists, don't overlap it!
6807+ mySize.cx -= SCROLL_BAR_WIDTH;
6808+ }
6809+
6810+ m_ptScrollHorizPosL.x = m_topleft.x;
6811+ m_ptScrollHorizPosL.y = m_topleft.y+mySize.cy-SCROLL_BAR_WIDTH;
6812+
6813+#ifndef _ARROWS_SIDE_BY_SIDE
6814+ m_ptScrollHorizPosR.x = m_topleft.x+mySize.cx-SCROLL_BAR_WIDTH;
6815+#else
6816+ m_ptScrollHorizPosR.x = m_topleft.x+SCROLL_BAR_WIDTH;
6817+#endif
6818+ m_ptScrollHorizPosR.y = m_topleft.y+mySize.cy-SCROLL_BAR_WIDTH;
6819+
6820+ Display* dis = (Display*)GetWindow()->display;
6821+ XLockDisplay(dis);
6822+ Pixel blackPixel = BlackPixel( dis, DefaultScreen(dis) );
6823+ XUnlockDisplay(dis);
6824+ Pixel greyPixel = blackPixel;
6825+
6826+ Colormap cmap = HXGetXColormap(dis, (Window)GetWindow()->window);
6827+ XColor color;
6828+
6829+ XLockDisplay(dis);
6830+ XParseColor(dis, cmap, "gray", &color);
6831+ XUnlockDisplay(dis);
6832+ HXFindBestXColor(dis, cmap, &color);
6833+ greyPixel = color.pixel;
6834+
6835+ XLockDisplay(dis);
6836+ m_ScrollHorizButtonL = XCreateSimpleWindow( dis,
6837+ (Window)pParentWindow->window,
6838+ m_ptScrollHorizPosL.x, m_ptScrollHorizPosL.y,
6839+ SCROLL_BAR_WIDTH, SCROLL_BAR_WIDTH,
6840+ 1,
6841+ blackPixel,
6842+ greyPixel
6843+ );
6844+ m_ScrollHorizButtonR = XCreateSimpleWindow( dis,
6845+ (Window)pParentWindow->window,
6846+ m_ptScrollHorizPosR.x, m_ptScrollHorizPosR.y,
6847+ SCROLL_BAR_WIDTH, SCROLL_BAR_WIDTH,
6848+ 1,
6849+ blackPixel,
6850+ greyPixel
6851+ );
6852+ XUnlockDisplay(dis);
6853+ HX_ASSERT( m_ScrollHorizButtonR && m_ScrollHorizButtonL );
6854+
6855+}
6856+
6857+void CHXExSite::_CreateVertScrollBar()
6858+{
6859+ HX_ASSERT( m_ScrollVertButtonB == 0 );
6860+ HX_ASSERT( m_ScrollVertButtonT == 0 );
6861+
6862+ HXxSize mySize;
6863+
6864+ HXxWindow* pParentWindow = NULL;
6865+ if(GetParentSite())
6866+ {
6867+ pParentWindow = GetParentSite()->GetWindow();
6868+ }
6869+ if(pParentWindow)
6870+ {
6871+ GetParentSite()->GetSize(mySize);
6872+ }
6873+
6874+ HX_ASSERT( pParentWindow );
6875+ HX_ASSERT( pParentWindow->window != 0 );
6876+
6877+ if( m_ScrollHorizButtonR )
6878+ {
6879+ // if the other bar already exists, don't overlap it!
6880+ mySize.cy -= SCROLL_BAR_WIDTH;
6881+ }
6882+
6883+
6884+ m_ptScrollVertPosT.x = m_topleft.x+mySize.cx-SCROLL_BAR_WIDTH;
6885+ m_ptScrollVertPosT.y = m_topleft.y;
6886+
6887+ m_ptScrollVertPosB.x = m_topleft.x+mySize.cx-SCROLL_BAR_WIDTH;
6888+#ifndef _ARROWS_SIDE_BY_SIDE
6889+ m_ptScrollVertPosB.y = m_topleft.y+mySize.cy-SCROLL_BAR_WIDTH;
6890+#else
6891+ m_ptScrollVertPosB.y = m_topleft.y+SCROLL_BAR_WIDTH;
6892+#endif
6893+
6894+ Display* dis = (Display*)GetWindow()->display;
6895+ XLockDisplay(dis);
6896+ Pixel blackPixel = BlackPixel( dis, DefaultScreen(dis) );
6897+ XUnlockDisplay(dis);
6898+ Pixel greyPixel = blackPixel;
6899+ Colormap cmap = HXGetXColormap((Display*)GetWindow()->display,
6900+ (Window)GetWindow()->window);
6901+ XColor color;
6902+ XLockDisplay(dis);
6903+ XParseColor(dis, cmap, "gray", &color);
6904+ XUnlockDisplay(dis);
6905+ HXFindBestXColor(dis, cmap, &color);
6906+ greyPixel = color.pixel;
6907+
6908+ HX_ASSERT( GetWindow() );
6909+ XLockDisplay(dis);
6910+ m_ScrollVertButtonT = XCreateSimpleWindow( dis,
6911+ (Window)pParentWindow->window,
6912+ m_ptScrollVertPosT.x, m_ptScrollVertPosT.y,
6913+ SCROLL_BAR_WIDTH, SCROLL_BAR_WIDTH,
6914+ 1,
6915+ blackPixel,
6916+ greyPixel
6917+ );
6918+ m_ScrollVertButtonB = XCreateSimpleWindow( dis,
6919+ (Window)pParentWindow->window,
6920+ m_ptScrollVertPosB.x, m_ptScrollVertPosB.y,
6921+ SCROLL_BAR_WIDTH, SCROLL_BAR_WIDTH,
6922+ 1,
6923+ blackPixel,
6924+ greyPixel
6925+ );
6926+ XUnlockDisplay(dis);
6927+
6928+ HX_ASSERT( m_ScrollVertButtonB && m_ScrollVertButtonT );
6929+
6930+}
6931+
6932+//
6933+// Inherited CHXBaseSite methods.
6934+//
6935+void CHXExSite::_NeedWindowedSite()
6936+{
6937+#ifdef _DEBUG
6938+ fprintf( stderr, "CHXExSite::_NeedWindowedSite do something here....\n" );
6939+#endif
6940+ //Nothing to do on unix....
6941+}
6942+
6943+void CHXExSite::_AttachWindow()
6944+{
6945+#if 1
6946+ void* pDummy=NULL;
6947+
6948+ if (m_pRootSurface)
6949+ { /* Replace CUnixRootSurf with my own CExRootSurf */
6950+ HX_RELEASE(m_pRootSurface);
6951+ m_pRootSurface = new CExRootSurf(m_pContext, this, m_on_new_frame_cb, m_context);
6952+ m_pRootSurface->AddRef();
6953+ }
6954+
6955+ if(!z_mapSiteToWindow.Lookup((void*)this, pDummy))
6956+ {
6957+ z_mapSiteToWindow.SetAt((void*)this, (void*)m_pWindow);
6958+ }
6959+
6960+ //Set the display variable.
6961+ if( m_pWindow->display == NULL )
6962+ {
6963+ HX_ASSERT(zm_display);
6964+ m_pWindow->display = zm_display;
6965+ }
6966+
6967+ //Now that we have a window be sure to init the CExRootSurf.
6968+ //this lets it set up the display, colormap, etc.
6969+ ((CExRootSurf*)m_pRootSurface)->Init();
6970+#endif
6971+}
6972+
6973+void CHXExSite::_DetachWindow()
6974+{
6975+#if 1
6976+ void* pDummy;
6977+
6978+ if (z_mapSiteToWindow.Lookup((void*)this, pDummy))
6979+ {
6980+ z_mapSiteToWindow.RemoveKey((void*)this);
6981+ }
6982+#endif
6983+}
6984+
6985+void* CHXExSite::_Create(void* pParentWindow, UINT32 style)
6986+{
6987+ HRESULT result = HXR_OK;
6988+ if( m_pWindow && m_pWindow->window )
6989+ {
6990+ HX_ASSERT( "We already have created a window"==NULL);
6991+ return NULL;
6992+ }
6993+
6994+ if (pParentWindow==NULL || style)
6995+ {
6996+ m_bIsChildWindow = FALSE;
6997+ }
6998+ else
6999+ {
7000+ m_bIsChildWindow = TRUE;
7001+ }
7002+
7003+ if( _OpenXDisplay(NULL) != HXR_OK )
7004+ {
7005+ return NULL;
7006+ }
7007+ return (void*)CreateXWindow((Window)pParentWindow);
7008+}
7009+
7010+
7011+void CHXExSite::_Destroy(HXxWindow* pWindow)
7012+{
7013+ _DestroySliders();
7014+ HXxWindow* pWin = GetWindow();
7015+ Display* pDis = (Display*)(pWin?pWin->display:NULL);
7016+ if( pDis )
7017+ {
7018+ XLockDisplay(pDis);
7019+ XDestroyWindow( pDis, (Window)pWindow->window );
7020+ XUnlockDisplay(pDis);
7021+ }
7022+}
7023+
7024+void CHXExSite::_SetSize(HXxSize size)
7025+{
7026+ HX_ASSERT( m_pWindow && m_pWindow->display && m_pWindow->window);
7027+ //The scroll bars get resized also...
7028+ _DestroySliders();
7029+ Display* pDis = (Display*)GetWindow()->display;
7030+ XLockDisplay(pDis);
7031+ XResizeWindow(pDis,
7032+ (Window) m_pWindow->window,
7033+ size.cx,
7034+ size.cy);
7035+ XUnlockDisplay(pDis);
7036+}
7037+
7038+void CHXExSite::_SetPosition(HXxPoint position)
7039+{
7040+ HX_ASSERT( m_pWindow && m_pWindow->display && m_pWindow->window);
7041+ _DestroyScrollButtons();
7042+ XLockDisplay((Display*) m_pWindow->display);
7043+ XMoveWindow((Display*)m_pWindow->display,
7044+ (Window)m_pWindow->window,
7045+ position.x,
7046+ position.y);
7047+ XUnlockDisplay((Display*) m_pWindow->display);
7048+}
7049+
7050+void CHXExSite::_DamageRect(HXxRect rect)
7051+{
7052+ if(GetWindow())
7053+ {
7054+ m_bDamaged = TRUE;
7055+ }
7056+ return;
7057+}
7058+
7059+void CHXExSite::_DamageRegion(HXxRegion rect)
7060+{
7061+ if(GetWindow())
7062+ {
7063+ m_bDamaged = TRUE;
7064+ }
7065+ return;
7066+}
7067+
7068+void CHXExSite::_SendOSUpdateMessage()
7069+{
7070+ //We need to redraw our window here, m_pWindow.
7071+}
7072+
7073+void CHXExSite::_ShowSite(HXBOOL bShow)
7074+{
7075+ if( bShow )
7076+ {
7077+ _MapScrollButtons();
7078+ }
7079+ else
7080+ {
7081+ _UnmapScrollButtons();
7082+ }
7083+ //do nothing....
7084+}
7085+
7086+HXBOOL CHXExSite::_AtSystemTime()
7087+{
7088+ return TRUE;
7089+}
7090+
7091+void CHXExSite::_GetDeviceCaps( void* hdc,
7092+ UINT16& uBitsPerPixel,
7093+ UINT16& uHorzRes,
7094+ UINT16& uVertRes )
7095+{
7096+ Screen* pScreen = NULL;
7097+ HXxWindow* pWin = GetWindow();
7098+ HX_ASSERT( pWin );
7099+ if( pWin )
7100+ {
7101+ Display* dis = (Display*)pWin->display;
7102+ HX_ASSERT( dis );
7103+ if( dis )
7104+ {
7105+ Display* pDisp = (Display*)GetWindow()->display;
7106+ XLockDisplay(pDisp);
7107+ pScreen = DefaultScreenOfDisplay(pDisp);
7108+ XUnlockDisplay(pDisp);
7109+
7110+ uBitsPerPixel = pScreen->root_depth;
7111+ uHorzRes = pScreen->width;
7112+ uVertRes = pScreen->height;
7113+ }
7114+ }
7115+}
7116+
7117+void CHXExSite::_GetWindowRect(HXxRect* destRect)
7118+{
7119+ HX_ASSERT( "Doesn't seem to be used anywhere"==NULL );
7120+}
7121+
7122+void CHXExSite::_DestroySliders()
7123+{
7124+ _DestroyScrollButtons();
7125+}
7126+
7127+void CHXExSite::_ForwardUpdateEvent(HXxEvent* pEvent)
7128+{
7129+ GC gc = NULL;
7130+ AddRef();
7131+
7132+ HX_ASSERT(GetWindow()->window);
7133+ HX_ASSERT(m_pUser);
7134+ if(m_bIsChildWindow)
7135+ {
7136+ //Create a clip region that excludes our higher z-order
7137+ //siblings and is clipped to our parent.
7138+ if( !m_bRegionIsValid )
7139+ {
7140+ RecomputeClip();
7141+ }
7142+
7143+ // The problem is that regions are locked to the origin so we
7144+ // will need to reverse shift the region before we set the
7145+ // origin of the graph port! get the GC from the video surface
7146+ gc = ((CExRootSurf*)m_pRootSurface)->GetGC();
7147+ HX_ASSERT( gc );
7148+
7149+ //Actually setup our clip region
7150+ Display* pDis = (Display*)GetWindow()->display;
7151+ XLockDisplay(pDis);
7152+ XSetRegion( pDis, gc, (Region) m_Region );
7153+ XUnlockDisplay(pDis);
7154+ }
7155+
7156+ XEvent* pXEvent = (XEvent*) pEvent->param2;
7157+ XExposeEvent* exposeEvent = (XExposeEvent*) pXEvent;
7158+
7159+ // get the rect for this site with respect to our parent
7160+ HXRECTANGLE exposedRect = { exposeEvent->x,
7161+ exposeEvent->y,
7162+ exposeEvent->width,
7163+ exposeEvent->height };
7164+ HXREGION* exposedRegion = HXCreateRegion();
7165+ HXUnionRectWithRegion(&exposedRect, exposedRegion, exposedRegion);
7166+
7167+ // does the site intersect the current clipping region?
7168+ HXREGION* resultRegion = HXCreateRegion();
7169+ HXIntersectRegion(exposedRegion, m_Region, resultRegion);
7170+ HXBOOL bSiteIntersectsExposed = (HXEmptyRegion(resultRegion)==FALSE);
7171+
7172+ HXDestroyRegion(resultRegion);
7173+ HXDestroyRegion(exposedRegion);
7174+
7175+ // if the exposed region intersects the sites clipping region
7176+ if(bSiteIntersectsExposed)
7177+ {
7178+ m_pUser->HandleEvent(pEvent);
7179+ }
7180+
7181+ //If the user doesn't handle the standard update event then send
7182+ //them the cross platform HX_SURFACE_UPDATE event don't damage the
7183+ //original event structure
7184+ if(!pEvent->handled && m_pUser )
7185+ {
7186+ HX_ASSERT(GetWindow());
7187+ HXxEvent event;
7188+ event.event = HX_SURFACE_UPDATE;
7189+ event.window = GetWindow()->window;
7190+ event.param1 = m_pVideoSurface;
7191+ event.param2 = GetWindow();
7192+ event.result = 0;
7193+ event.handled = FALSE;
7194+ m_pUser->HandleEvent(&event);
7195+ pEvent->handled = event.handled;
7196+ }
7197+
7198+
7199+ //reset the gc to use no region
7200+ if(m_bIsChildWindow && gc)
7201+ {
7202+ Display* pDisp = (Display*)GetWindow()->display;
7203+ XLockDisplay(pDisp);
7204+ XSetClipMask(pDisp, gc, None);
7205+ XUnlockDisplay(pDisp);
7206+ }
7207+
7208+ //Handle the drawing of our arrows...
7209+ _DrawArrows();
7210+
7211+ //Now do all our children....
7212+ CHXMapPtrToPtr::Iterator i = m_ChildrenMap.Begin();
7213+ for(;i!=m_ChildrenMap.End();++i)
7214+ {
7215+ CHXExSite* pSite = (CHXExSite*) *i;
7216+ pSite->_ForwardUpdateEvent(pEvent);
7217+ }
7218+
7219+ Release();
7220+}
7221+
7222+UINT32 CHXExSite::_MapKeySymToHXVK(KeySym sym, UINT32& uFlags )
7223+{
7224+ //XXXgfw if we add the extended flag in the HX_KEYBOARD event
7225+ //structure then we can modify the flags here to show that these
7226+ //keys are 'extended' in the windows sense.
7227+ UINT32 ulRet = 0;
7228+ switch( sym )
7229+ {
7230+ case XK_Shift_R:
7231+ ulRet = XK_Shift_L;
7232+ break;
7233+ case XK_Alt_R:
7234+ ulRet = XK_Alt_L;
7235+ break;
7236+ case XK_KP_Home:
7237+ ulRet = XK_Home;
7238+ break;
7239+ case XK_KP_Next:
7240+ ulRet = XK_Next;
7241+ break;
7242+ case XK_KP_Prior:
7243+ ulRet = XK_Prior;
7244+ break;
7245+ case XK_KP_Enter:
7246+ ulRet = XK_Return;
7247+ break;
7248+ case XK_KP_End:
7249+ ulRet = XK_End;
7250+ break;
7251+ case XK_KP_Begin:
7252+ ulRet = XK_Begin;
7253+ break;
7254+ case XK_KP_Left:
7255+ ulRet = XK_Left;
7256+ break;
7257+ case XK_KP_Up:
7258+ ulRet = XK_Up;
7259+ break;
7260+ case XK_Control_R:
7261+ ulRet = XK_Control_L;
7262+ break;
7263+ case XK_KP_Right:
7264+ ulRet = XK_Right;
7265+ break;
7266+ case XK_KP_Down:
7267+ ulRet = XK_Down;
7268+ break;
7269+ case XK_KP_Insert:
7270+ ulRet = XK_Insert;
7271+ break;
7272+ case XK_KP_Delete:
7273+ ulRet = XK_Delete;
7274+ break;
7275+ default:
7276+ ulRet = sym;
7277+ break;
7278+ }
7279+ if( ulRet != sym )
7280+ {
7281+ //We have mapped a key from Right hand side, keypad, arrows
7282+ //or other parts of an extended keyboard. Set the flag.
7283+ uFlags |= HX_EXTENDED_KEY_MASK;
7284+ }
7285+ return ulRet;
7286+}
7287+
7288+
7289+HXBOOL CHXExSite::_ConvertToHXEvent(HXxEvent* pEvent )
7290+{
7291+ // get original events info from pEvent
7292+ XEvent* pXEvent = (XEvent*) pEvent->param2;
7293+ XButtonEvent* buttonEvent = (XButtonEvent*) pXEvent;
7294+
7295+
7296+ //===============================================================
7297+ // Convert all other event to RMA generic events and pass back.
7298+ //===============================================================
7299+ if( ((pEvent->event == ButtonPress) ||
7300+ (pEvent->event == ButtonRelease) ||
7301+ (pEvent->event == MotionNotify ) ||
7302+ (pEvent->event == EnterNotify) ||
7303+ (pEvent->event == FocusIn) ||
7304+ (pEvent->event == FocusOut) ||
7305+ (pEvent->event == KeyPress) ||
7306+ (pEvent->event == KeyRelease) ||
7307+ (pEvent->event == LeaveNotify))
7308+ )
7309+ {
7310+ // set modifier flags for all events....
7311+ UINT32 flags = 0;
7312+
7313+ // create new HXxEvent
7314+ HXxEvent theEvent;
7315+
7316+ //XXXgfw ouch....
7317+ static HXxPoint realPt = {0,0};
7318+
7319+ //Init certain members.
7320+ memset(&theEvent, 0, sizeof(HXxEvent));
7321+ theEvent.window = pEvent->window;
7322+ theEvent.handled = FALSE;
7323+
7324+ //
7325+ // NOTE:
7326+ //
7327+ // theEvent must be filled in by *ALL* event types.
7328+ // theEvent will be memcopied into the pEvent passed
7329+ // back to the basesite at the end of the method.
7330+ //
7331+
7332+ //==================================================
7333+ // LEAVE NOTIFY EVENT
7334+ //==================================================
7335+ if( pEvent->event==LeaveNotify)
7336+ {
7337+ if( m_pTopLevelSite->m_pMouseInSite )
7338+ {
7339+ HXxPoint oobPoint;
7340+ oobPoint.x = -1;
7341+ oobPoint.y = -1;
7342+ HXxEvent Outevent = { HX_MOUSE_LEAVE,
7343+ m_pWindow->window,
7344+ (void*)&oobPoint,
7345+ 0, 0,
7346+ FALSE };
7347+ m_pTopLevelSite->m_pMouseInSite->EventOccurred(&Outevent);
7348+ m_pTopLevelSite->m_pMouseInSite = NULL;
7349+ }
7350+ pEvent->handled=TRUE;
7351+ return TRUE;
7352+ }
7353+
7354+ //==================================================
7355+ // ENTER NOTIFY EVENT
7356+ //==================================================
7357+ if( pEvent->event==EnterNotify)
7358+ {
7359+ pEvent->handled=TRUE;
7360+ return TRUE;
7361+ }
7362+
7363+ //==================================================
7364+ // KEY PRESS/RELEASE EVENT
7365+ //==================================================
7366+ if ( pEvent->event == KeyPress || pEvent->event==KeyRelease )
7367+ {
7368+ XKeyEvent* pKeyEvent = (XKeyEvent*)pEvent->param2;
7369+
7370+ //
7371+ //Set the event type
7372+ //
7373+ theEvent.event = pEvent->event==KeyPress?HX_KEY_DOWN:HX_KEY_UP;
7374+
7375+ //
7376+ // Fill in the scan/key code.
7377+ //
7378+ flags = pKeyEvent->keycode;
7379+ flags &= 0x000000ff; //the scan code only gets bits 0-7
7380+
7381+ //
7382+ // build key modifier list...
7383+ //
7384+ if( pKeyEvent->state & ShiftMask )
7385+ flags |= HX_SHIFT_MASK;
7386+
7387+ if( pKeyEvent->state & ControlMask )
7388+ flags |= HX_CTRL_MASK;
7389+
7390+ if( pKeyEvent->state & LockMask )
7391+ flags |= HX_CAPS_LOCK_MASK;
7392+
7393+ if( pKeyEvent->state & Mod1Mask)
7394+ flags |= HX_ALT_MASK;
7395+
7396+ if( pKeyEvent->state & Mod2Mask)
7397+ flags |= HX_NUM_LOCK_MASK;
7398+
7399+ if( pKeyEvent->state & Mod5Mask)
7400+ flags |= HX_SCROLL_LOCK_MASK;
7401+
7402+ //
7403+ //Store the char pressed.
7404+ //
7405+ KeySym sym;
7406+ char szBuf[10]; /* Flawfinder: ignore */
7407+ int nNum;
7408+
7409+ //Save the state of the keys...
7410+ unsigned int unSave = pKeyEvent->state;
7411+ pKeyEvent->state=0;
7412+
7413+ //Lookup the key without any state.
7414+ nNum = XLookupString( pKeyEvent, szBuf, 10, &sym, NULL );
7415+ if( nNum > 0 )
7416+ {
7417+ theEvent.param1 = (void*)*szBuf;
7418+ }
7419+ else
7420+ {
7421+ theEvent.param1 = (void*)_MapKeySymToHXVK(sym, flags);
7422+ flags |= HX_VIRTUAL_KEY_MASK;
7423+ }
7424+ //restore the state of the event
7425+ pKeyEvent->state = unSave;
7426+
7427+ //Set the flags...
7428+ theEvent.param2 = (void*)flags;
7429+
7430+ //Check for HX_CHAR needed or not.
7431+ if( theEvent.event == HX_KEY_DOWN )
7432+ {
7433+ //We have to send an extra HX_CHAR event
7434+ HXxEvent extraEvent;
7435+ memcpy( &extraEvent, &theEvent, sizeof( extraEvent ) ); /* Flawfinder: ignore */
7436+
7437+ //Change the type.
7438+ extraEvent.event = HX_CHAR;
7439+
7440+ //
7441+ //Change the keycode to an translated ascii char.
7442+ //
7443+ KeySym sym;
7444+ char szBuf[10]; /* Flawfinder: ignore */
7445+ int nNum;
7446+
7447+ nNum = XLookupString( pKeyEvent, szBuf, 10, &sym, NULL );
7448+
7449+ if( nNum > 0 )
7450+ {
7451+ extraEvent.param1 = (void*)*szBuf;
7452+ }
7453+ else
7454+ {
7455+ extraEvent.param1 = (void*)_MapKeySymToHXVK(sym, flags);
7456+ flags |= HX_VIRTUAL_KEY_MASK;
7457+ }
7458+ extraEvent.param2 = (void*)flags;
7459+
7460+ //
7461+ // Now send the extra event....
7462+ //
7463+ CHXBaseSite::EventOccurred(&extraEvent);
7464+ }
7465+ }
7466+
7467+ //==================================================
7468+ // FOCUS OUT EVENT
7469+ //==================================================
7470+ if ( pEvent->event == FocusOut )
7471+ {
7472+ theEvent.event = HX_LOSE_FOCUS;
7473+ }
7474+
7475+ if ( pEvent->event == FocusIn )
7476+ {
7477+ theEvent.event = HX_SET_FOCUS;
7478+ }
7479+
7480+ //==================================================
7481+ // MOUSE MOVE EVENT
7482+ //==================================================
7483+ if( pEvent->event == MotionNotify )
7484+ {
7485+ XMotionEvent* pp = (XMotionEvent*)pEvent->param2;
7486+ theEvent.event = HX_MOUSE_MOVE;
7487+
7488+ if( pp->state&Button1Mask )
7489+ flags |= HX_PRIMARY_BUTTON;
7490+
7491+ if( pp->state&Button2Mask )
7492+ flags |= HX_CONTEXT_BUTTON;
7493+
7494+ if( pp->state&Button3Mask )
7495+ flags |= HX_THIRD_BUTTON;
7496+
7497+ if(pp->state & ShiftMask)
7498+ flags |= HX_SHIFT_KEY;
7499+
7500+ if(pp->state & ControlMask)
7501+ flags |= HX_CTRL_KEY;
7502+
7503+ if(pp->state & Mod1Mask)
7504+ flags |= HX_ALT_COMMAND_KEY;
7505+
7506+ theEvent.param2 = (void*) flags;
7507+
7508+ //Grab the X and Y.
7509+ theEvent.param1 = (void*) &realPt;
7510+ realPt.x = pp->x;
7511+ realPt.y = pp->y;
7512+ }
7513+
7514+ //==================================================
7515+ // BUTTON PRESS/RELEASE EVENT
7516+ //==================================================
7517+ if((pEvent->event == ButtonPress) || (pEvent->event == ButtonRelease))
7518+ {
7519+ // remap event
7520+ if (pEvent->event == ButtonPress)
7521+ {
7522+ if (buttonEvent->button == Button3)
7523+ theEvent.event = HX_CONTEXT_BUTTON_DOWN;
7524+ else
7525+ theEvent.event = HX_PRIMARY_BUTTON_DOWN;
7526+ }
7527+ else if (pEvent->event == ButtonRelease)
7528+ {
7529+ if (buttonEvent->button == Button3)
7530+ theEvent.event = HX_CONTEXT_BUTTON_UP;
7531+ else
7532+ theEvent.event = HX_PRIMARY_BUTTON_UP;
7533+ }
7534+
7535+ if(buttonEvent->state & ShiftMask)
7536+ flags |= HX_SHIFT_KEY;
7537+
7538+ if(buttonEvent->state & ControlMask)
7539+ flags |= HX_CTRL_KEY;
7540+
7541+ theEvent.param2 = (void*) flags;
7542+
7543+ //Grab the X and Y.
7544+ theEvent.param1 = (void*) &realPt;
7545+ realPt.x = buttonEvent->x;
7546+ realPt.y = buttonEvent->y;
7547+ }
7548+
7549+ //Copy the new event back into the passed in one for
7550+ //all events that fall through here...
7551+ memcpy( pEvent, &theEvent, sizeof(HXxEvent) ); /* Flawfinder: ignore */
7552+
7553+#if defined(_DEBUG)
7554+ //If the users presses control-primary button
7555+ //dump info on all sites. If shift-context, then
7556+ //just this site.
7557+ if( (buttonEvent->state&ControlMask)&&
7558+ (theEvent.event==HX_PRIMARY_BUTTON_DOWN))
7559+ {
7560+ DisplayAllSiteData();
7561+ }
7562+ if( (buttonEvent->state&ShiftMask)&&
7563+ (theEvent.event==HX_PRIMARY_BUTTON_DOWN))
7564+ {
7565+ DisplaySiteData("");
7566+ }
7567+#endif
7568+ }
7569+ return pEvent->handled;
7570+}
7571+
7572+
7573+void CHXExSite::CheckColorSettings()
7574+{
7575+#if !defined(HELIX_FEATURE_HARDWARE_COLOR_CONTROLS)
7576+ CHXBaseSite::CheckColorSettings();
7577+#else
7578+ CUnixSurf* pSurf = (CUnixSurf*)m_pVideoSurface;
7579+ if( !pSurf->HasHWColorConrols() )
7580+ {
7581+ CHXBaseSite::CheckColorSettings();
7582+ }
7583+ else
7584+ {
7585+ pSurf->SetHWColorControls();
7586+
7587+ //We do all color stuff except sharpmess in hardware.
7588+ float fCurrentSharpness;
7589+ INT16 bInterpolate;
7590+ zm_pColorAcc->GetSharpnessAdjustments(&fCurrentSharpness, &bInterpolate);
7591+
7592+ if (fCurrentSharpness != m_fSharpness)
7593+ {
7594+ zm_pColorAcc->SetSharpnessAdjustments(m_fSharpness, FALSE);
7595+ }
7596+ }
7597+#endif
7598+}
7599+
7600+//
7601+// OK, here it is. Take care of any OS specific duties, like scrollbar
7602+// stuff and expose events. Then, if the event isn't handled, convert
7603+// to an RMA event and return.
7604+HXBOOL CHXExSite::_HandleOSEvents(HXxEvent* pEvent)
7605+{
7606+ HXxPoint position = {0, 0};
7607+ HXxPoint point;
7608+
7609+ if( NULL==pEvent )
7610+ {
7611+ return FALSE;
7612+ }
7613+
7614+ return TRUE;
7615+
7616+#if defined(_DEBUG) && 0
7617+// fprintf( stderr, "this: %p m_pUser: %p ", this, m_pUser );
7618+ switch( pEvent->event )
7619+ {
7620+ case HX_MOUSE_LEAVE:
7621+ fprintf( stderr, "HX_MOUSE_LEAVE\n" );
7622+ break;
7623+// case HX_MOUSE_MOVE:
7624+// point.x = ((HXxPoint*)pEvent->param1)->x;
7625+// point.y = ((HXxPoint*)pEvent->param1)->y;
7626+// fprintf( stderr, "HX_MOUSE_MOVE: %d %d\n", point.x, point.y );
7627+// break;
7628+ case HX_MOUSE_ENTER:
7629+ fprintf( stderr, "HX_MOUSE_ENTER\n" );
7630+ break;
7631+// case MotionNotify:
7632+// point.x = ((XMotionEvent*)pEvent->param2)->x;
7633+// point.y = ((XMotionEvent*)pEvent->param2)->y;
7634+// fprintf( stderr, "MotionNotify: %d %d\n", point.x, point.y );
7635+// break;
7636+ case Expose:
7637+ fprintf( stderr, "Expose\n" );
7638+ break;
7639+ case EnterNotify :
7640+ fprintf( stderr, "EnterNotify\n" );
7641+ break;
7642+ case LeaveNotify:
7643+ fprintf( stderr, "LeaveNotify\n" );
7644+ break;
7645+ case KeyPress:
7646+ fprintf( stderr, "this: %p m_pUser: %p ", this, m_pUser );
7647+ fprintf( stderr, "Keypress\n\n" );
7648+ break;
7649+ case KeyRelease:
7650+ fprintf( stderr, "this: %p m_pUser: %p ", this, m_pUser );
7651+ fprintf( stderr, "KeyRelease\n" );
7652+ break;
7653+ default:
7654+ fprintf( stderr, "Other\n" );
7655+ break;
7656+ }
7657+#endif
7658+
7659+ //Find the ConfigureNotify events so we can drop to RGB from
7660+ //overlay while we move....
7661+// if( pEvent->event == ConfigureNotify && this==m_pTopLevelSite )
7662+// {
7663+// XConfigureEvent* pev = (XConfigureEvent*)pEvent->param2;
7664+// if( m_pWindow && pev->window == (Window)m_pWindow->window )
7665+// {
7666+// HXxPoint p;
7667+// _GetPositionRelativeToActualWindow( p );
7668+// // fprintf( stderr, "wint %p -- x,y width, height: %d %d %d %d \n",
7669+// // pev->window,
7670+// // pev->x, pev->y, pev->width, pev->height);
7671+// // fprintf( stderr, "size of site: %d %d\n", m_size.cx, m_size.cy);
7672+// // fprintf( stderr, "pos of site: %d %d\n", m_topleft.x, m_topleft.y);
7673+// m_pTopLevelSite->m_pMutex->Lock();
7674+// m_pTopLevelSite->SiteMoving(0, 0);
7675+// m_pTopLevelSite->m_nLastMoveTime = HX_GET_TICKCOUNT();
7676+// m_pTopLevelSite->ScheduleCallback(MOUSE, 100);
7677+// m_pTopLevelSite->m_pMutex->Unlock();
7678+// }
7679+// }
7680+
7681+ //See if we should drop out of full screen
7682+ if( pEvent->event == FocusOut && IsFullScreen() && !m_bIgnoreFocusOutInFS )
7683+ {
7684+// fprintf( stderr, "_HandleOSEvents: focus out: " );
7685+// XEvent* pXEvent = (XEvent*) pEvent->param2;
7686+// XFocusChangeEvent* event = (XFocusChangeEvent*) pXEvent;
7687+// switch( event->mode )
7688+// {
7689+// case NotifyAncestor:
7690+// fprintf( stderr, "NotifyAncestor\n" );
7691+// break;
7692+// case NotifyVirtual:
7693+// fprintf( stderr, "NotifyVirtual\n" );
7694+// break;
7695+// case NotifyInferior:
7696+// fprintf( stderr, "NotifyInferior\n" );
7697+// break;
7698+// case NotifyNonlinear:
7699+// fprintf( stderr, "NotifyNonlinear\n" );
7700+// break;
7701+// case NotifyNonlinearVirtual:
7702+// fprintf( stderr, "NotifyNonlinearVirtual\n" );
7703+// break;
7704+// case NotifyPointer:
7705+// fprintf( stderr, "NotifyPointer\n" );
7706+// break;
7707+// case NotifyPointerRoot:
7708+// fprintf( stderr, "NotifyPointerRoot\n" );
7709+// break;
7710+// case NotifyDetailNone:
7711+// fprintf( stderr, "NotifyDetailNone\n" );
7712+// break;
7713+// default:
7714+// fprintf( stderr, "screwed.....\n" );
7715+// }
7716+ ExitFullScreen();
7717+ }
7718+
7719+
7720+#if defined(_DEBUG) && defined(TEST_FULL_SCREEN)
7721+ if( pEvent->event == KeyPress )
7722+ {
7723+ KeySym sym;
7724+ char szBuf[10]; /* Flawfinder: ignore */
7725+ int nNum;
7726+
7727+ //Lookup the key without any state.
7728+ nNum = XLookupString( (XKeyEvent*)(pEvent->param2), szBuf, 10, &sym, NULL );
7729+ if( nNum > 0 )
7730+ {
7731+ if( 'f' == szBuf[0] && IsFullScreen() )
7732+ {
7733+ //Exit full screen if 'f' is pressed.....
7734+ m_pTopLevelSite->ExitFullScreen();
7735+ }
7736+ else if( 'f' == szBuf[0] && !IsFullScreen() )
7737+ {
7738+ //Enter full screen if 'f' is pressed.....
7739+ m_pTopLevelSite->EnterFullScreen();
7740+ }
7741+
7742+ }
7743+
7744+ }
7745+#endif
7746+
7747+#if defined(_DEBUG) && defined(_TEST_COLOR_CONTROLS)
7748+ if( pEvent->event == KeyPress )
7749+ {
7750+ KeySym sym;
7751+ char szBuf[10]; /* Flawfinder: ignore */
7752+ int nNum;
7753+
7754+ //Lookup the key without any state.
7755+ nNum = XLookupString( (XKeyEvent*)(pEvent->param2), szBuf, 10, &sym, NULL );
7756+ if( nNum > 0 )
7757+ {
7758+ if( 'b' == szBuf[0] )
7759+ {
7760+ SetBrightness( GetBrightness()-.05);
7761+ }
7762+ if( 'B' == szBuf[0] )
7763+ {
7764+ SetBrightness( GetBrightness()+.05);
7765+ }
7766+
7767+ if( 'c' == szBuf[0] )
7768+ {
7769+ SetContrast( GetContrast()-.05);
7770+ }
7771+ if( 'C' == szBuf[0] )
7772+ {
7773+ SetContrast( GetContrast()+.05);
7774+ }
7775+
7776+ if( 'h' == szBuf[0] )
7777+ {
7778+ SetHue( GetHue()-.05);
7779+ }
7780+ if( 'H' == szBuf[0] )
7781+ {
7782+ SetHue( GetHue()+.05 );
7783+ }
7784+
7785+ if( 's' == szBuf[0] )
7786+ {
7787+ SetSaturation( GetSaturation()-.05);
7788+ }
7789+ if( 'S' == szBuf[0] )
7790+ {
7791+ SetSaturation( GetSaturation()+.05);
7792+ }
7793+ fprintf( stderr, "colors %f %f %f %f\n",
7794+ GetBrightness(),
7795+ GetContrast(),
7796+ GetSaturation(),
7797+ GetHue());
7798+ }
7799+
7800+ }
7801+#endif
7802+
7803+ //Exit full screen on ESC pressed......
7804+ if( pEvent->event == KeyPress )
7805+ {
7806+ KeySym sym;
7807+ char szBuf[10]; /* Flawfinder: ignore */
7808+ int nNum;
7809+
7810+ //Lookup the key without any state.
7811+ nNum = XLookupString( (XKeyEvent*)(pEvent->param2), szBuf, 10, &sym, NULL );
7812+ if( nNum > 0 )
7813+ {
7814+ if( 27 == (int)szBuf[0] && IsFullScreen() )
7815+ {
7816+ //Exit full screen if esc is pressed.....
7817+ m_pTopLevelSite->ExitFullScreen();
7818+ }
7819+ }
7820+ }
7821+
7822+ //Find out if this is an event we are interested in. Make sure we
7823+ //are visible, it isn't a button, expose or FocusIn event and also
7824+ //make sure it is headed for our window.
7825+ if (!_ShouldProcess(pEvent))
7826+ {
7827+ return FALSE;
7828+ }
7829+
7830+
7831+ if(m_pUser && GetWindow() && GetWindow()->window)
7832+ {
7833+ //Do not send an update event to a hidden site.
7834+ if( pEvent->event == Expose ||
7835+ pEvent->event == FocusIn ||
7836+ pEvent->event == HX_SURFACE_UPDATE )
7837+ {
7838+ if( (m_ScrollVertButtonT || m_ScrollHorizButtonR) && IsSiteVisible() )
7839+ {
7840+ _DrawArrows();
7841+ }
7842+ _ForwardUpdateEvent(pEvent);
7843+ return TRUE;
7844+ }
7845+ else
7846+ {
7847+ // get original events info from pEvent
7848+ XEvent* pXEvent = (XEvent*) pEvent->param2;
7849+ XButtonEvent* buttonEvent = (XButtonEvent*) pXEvent;
7850+
7851+
7852+ //XXXgfw all this code sucks! It really need to be written
7853+ //for just native events or RMA events. With the change to a
7854+ //common site it is all screwed up. I am leaving it for now
7855+ //so we can get on with transparancy but get back to it!
7856+
7857+ //If the user clicks MB1 on a scroll button, handle it here and
7858+ //don't pass it up or let the user handle the event.
7859+ //Hit detection here.
7860+
7861+ ////////////////////////////////////////////////////////
7862+ // BEGIN SCROLLING GARBAGE
7863+ ////////////////////////////////////////////////////////
7864+ if(
7865+ ((pEvent->event==ButtonPress || pEvent->event==ButtonRelease) &&
7866+ buttonEvent->button==Button1) &&
7867+ (m_ScrollHorizButtonL || m_ScrollVertButtonB )
7868+ )
7869+ {
7870+ int buttonX=0;
7871+ int buttonY=0;
7872+
7873+ if( pEvent->event==ButtonRelease )
7874+ {
7875+ if( m_bScrollingInProgress )
7876+ {
7877+ m_bScrollingInProgress = FALSE;
7878+ m_nScrollDir = 0;
7879+ return TRUE ;
7880+ }
7881+ }
7882+ else
7883+ {
7884+ buttonX = buttonEvent->x;
7885+ buttonY = buttonEvent->y;
7886+
7887+ HXBOOL bPointInSite = FALSE;
7888+ if( m_Region )
7889+ bPointInSite = HXPointInRegion(m_Region, buttonX, buttonY);
7890+
7891+ if( bPointInSite )
7892+ {
7893+ if( m_ScrollHorizButtonL )
7894+ {
7895+ if( _InButton( m_ptScrollHorizPosL, buttonX, buttonY ))
7896+ {
7897+ m_bScrollingInProgress = TRUE;
7898+ m_nScrollDir = 1;
7899+ }
7900+ if( _InButton( m_ptScrollHorizPosR, buttonX, buttonY ))
7901+ {
7902+ m_bScrollingInProgress = TRUE;
7903+ m_nScrollDir = 2;
7904+ }
7905+ }
7906+ if( m_ScrollVertButtonT )
7907+ {
7908+ if( _InButton( m_ptScrollVertPosT, buttonX, buttonY ))
7909+ {
7910+ m_bScrollingInProgress = TRUE;
7911+ m_nScrollDir = 3;
7912+ }
7913+ if( _InButton( m_ptScrollVertPosB, buttonX, buttonY ))
7914+ {
7915+ m_bScrollingInProgress = TRUE;
7916+ m_nScrollDir = 4;
7917+ }
7918+ }
7919+ }
7920+ }
7921+
7922+ if( (m_ScrollHorizButtonL||m_ScrollVertButtonT) && m_bScrollingInProgress)
7923+ {
7924+ int xx=0;
7925+ int yy=0;
7926+ HXxWindow* pParentWindow = GetParentSite()->GetWindow();
7927+ //Make it scroll 10% of the parent window each click.
7928+ HXxSize sizeTmp;
7929+ GetParentSite()->GetSize(sizeTmp);
7930+
7931+ //Set it to a percentage of the slider range.
7932+ int incX = sizeTmp.cx/10;
7933+ int incY = sizeTmp.cy/10;
7934+
7935+ HX_ASSERT( pParentWindow );
7936+
7937+ xx = m_XSliderPos;
7938+ yy = m_YSliderPos;
7939+
7940+ if( m_nScrollDir == 1 )
7941+ xx-=incX;
7942+ if( m_nScrollDir == 2 )
7943+ xx+=incX;
7944+ if( m_nScrollDir == 3 )
7945+ yy-=incY;
7946+ if( m_nScrollDir == 4 )
7947+ yy+=incY;
7948+
7949+ if( xx > m_size.cx-sizeTmp.cx )
7950+ xx = m_size.cx-sizeTmp.cx;
7951+ if( yy > m_size.cy-sizeTmp.cy)
7952+ yy = m_size.cy-sizeTmp.cy;
7953+
7954+ if( xx < 0 )
7955+ xx = 0;
7956+ if( yy < 0 )
7957+ yy = 0;
7958+
7959+ m_XSliderPos = xx;
7960+ m_YSliderPos = yy;
7961+
7962+ HXxRect rect;
7963+ DamageRect(rect);
7964+
7965+ InternalForceRedraw();
7966+ }
7967+ //Only throw away the event if it had something to do with
7968+ //scolling.
7969+ if( m_bScrollingInProgress )
7970+ {
7971+ m_bScrollingInProgress = FALSE;
7972+ m_nScrollDir = 0;
7973+ return TRUE;
7974+ }
7975+ }
7976+ ////////////////////////////////////////////////////////
7977+ // END SCROLLING GARBAGE
7978+ ////////////////////////////////////////////////////////
7979+ point.x = -1;
7980+ point.y = -1;
7981+
7982+ if( pEvent->event == MotionNotify)
7983+ {
7984+ point.x = ((XMotionEvent*)pXEvent)->x;
7985+ point.y = ((XMotionEvent*)pXEvent)->y;
7986+ }
7987+ else if( pEvent->event == ButtonPress )
7988+ {
7989+ point.x = ((XMotionEvent*)pXEvent)->x;
7990+ point.y = ((XMotionEvent*)pXEvent)->y;
7991+ }
7992+
7993+ //
7994+ //Give the user a chance at the native event.
7995+ //
7996+ if( m_RegionWithoutChildren && HXPointInRegion(m_RegionWithoutChildren, point.x, point.y ))
7997+ {
7998+ if( m_Region && HXPointInRegion(m_Region, point.x, point.y) )
7999+ {
8000+ if (m_pUser)
8001+ m_pUser->HandleEvent(pEvent);
8002+ }
8003+ else
8004+ {
8005+ INT32 handledCount = 0;
8006+ INT32 mapCount = 0;
8007+
8008+ //try send this to all of our children
8009+ _unixsitecpp1:
8010+ mapCount = m_ChildrenMap.GetCount();
8011+ CHXMapPtrToPtr::Iterator i;
8012+ for(i=m_ChildrenMap.Begin() ; i!=m_ChildrenMap.End() ; ++i)
8013+ {
8014+ CHXBaseSite* pSite = (CHXBaseSite*) *i;
8015+ pSite->_HandleOSEvents(pEvent);
8016+ if (pEvent->handled)
8017+ {
8018+ break;
8019+ }
8020+ handledCount+=pEvent->handled;
8021+ pEvent->handled=0;
8022+
8023+ if (m_ChildrenMap.GetCount() != mapCount)
8024+ {
8025+ goto _unixsitecpp1;
8026+ }
8027+ }
8028+ if (handledCount)
8029+ {
8030+ pEvent->handled = 1;
8031+ }
8032+ HX_ASSERT(handledCount<2);
8033+ }
8034+ }
8035+ pEvent->handled=FALSE;
8036+ }
8037+ }
8038+
8039+ return FALSE;
8040+}
8041+
8042+void CHXExSite::_GenerateOSEvent(HXxEvent* pEvent, HXxEvent* pEvent2)
8043+{
8044+ //XXXgfw Not needed on UNIX I guess???
8045+}
8046+
8047+void CHXExSite::_GenerateSetCursorEvent()
8048+{
8049+#ifdef _DEBUG
8050+ fprintf( stderr, "CHXExSite::_GenerateSetCursorEvent\n" );
8051+#endif
8052+ //XXXgfw do we need this??
8053+}
8054+
8055+void CHXExSite::_TryCreateXSlider()
8056+{
8057+#if 0
8058+ if( !m_ScrollHorizButtonL && IsSiteVisible() )
8059+ _CreateHorizScrollBar();
8060+#endif
8061+}
8062+
8063+void CHXExSite::_SetXSliderValues(INT32 range, INT32 pageSize)
8064+{
8065+ //XXXgfw this is a do nothing as long as we only have
8066+ //scroll buttons on unix and not real scroll bars.
8067+}
8068+
8069+void CHXExSite::_TryCreateYSlider()
8070+{
8071+#if 0
8072+ if( !m_ScrollVertButtonT && IsSiteVisible() )
8073+ _CreateVertScrollBar();
8074+#endif
8075+}
8076+
8077+void CHXExSite::_SetYSliderValues(INT32 range, INT32 pageSize)
8078+{
8079+ //XXXgfw this is a do nothing as long as we only have
8080+ //scroll buttons on unix and not real scroll bars.
8081+}
8082+
8083+void CHXExSite::_GetSystemSizeOfSliders(INT32* pWidth, INT32* pHeight)
8084+{
8085+#if 0
8086+ *pWidth = *pHeight = SCROLL_BAR_WIDTH;
8087+#endif
8088+}
8089+
8090+HXBOOL CHXExSite::_IsWindowVisible()
8091+{
8092+#if 0
8093+ HX_RESULT retVal = FALSE;
8094+ //XXXgfw do this for now...
8095+ retVal = IsSiteVisible();
8096+ return retVal;
8097+#else
8098+ return FALSE;
8099+#endif
8100+
8101+}
8102+
8103+void CHXExSite::_ShowXSlider(HXBOOL bShow)
8104+{
8105+#if 0
8106+ if( GetWindow() )
8107+ {
8108+ if( bShow )
8109+ _MapHorzScroll();
8110+ else
8111+ _UnmapHorzScroll();
8112+ }
8113+#endif
8114+}
8115+
8116+void CHXExSite::_MoveXSlider( INT32 left,
8117+ INT32 top,
8118+ INT32 right,
8119+ INT32 bottom,
8120+ HXBOOL bRedraw )
8121+{
8122+ //Do nothing right now....
8123+}
8124+
8125+void CHXExSite::_ShowYSlider(HXBOOL bShow)
8126+{
8127+#if 0
8128+ if( GetWindow() )
8129+ {
8130+ if( bShow )
8131+ _MapVertScroll();
8132+ else
8133+ _UnmapVertScroll();
8134+ }
8135+#endif
8136+}
8137+
8138+void CHXExSite::_MoveYSlider( INT32 left,
8139+ INT32 top,
8140+ INT32 right,
8141+ INT32 bottom,
8142+ HXBOOL bRedraw)
8143+{
8144+ //do nothing right now...
8145+}
8146+
8147+HXBOOL CHXExSite::_DoesXSliderExist()
8148+{
8149+ return FALSE;
8150+// return (m_ScrollHorizButtonL!=0);
8151+}
8152+
8153+void* CHXExSite::_GetContainingWindow()
8154+{
8155+ //XXXgfw Do we need this???
8156+ return NULL;
8157+}
8158+
8159+void CHXExSite::_GetCursorPos(HXxPoint* pPoint)
8160+{
8161+ //Return the cursor pos in screen coords.
8162+ Window rootWin;
8163+ Window childWin;
8164+ int rootX=0;
8165+ int rootY=0;
8166+ int childX=0;
8167+ int childY=0;
8168+ unsigned int mask=0;
8169+ Bool ret=FALSE;
8170+
8171+ HX_ASSERT(GetWindow());
8172+ Display* pDis = (Display*)GetWindow()->display;
8173+ XLockDisplay(pDis);
8174+ ret = XQueryPointer(pDis,
8175+ (Window)GetWindow()->window,
8176+ &rootWin,
8177+ &childWin,
8178+ &rootX, &rootY,
8179+ &childX, &childY,
8180+ &mask);
8181+ XUnlockDisplay(pDis);
8182+
8183+ if(ret)
8184+ {
8185+ pPoint->x = rootX;
8186+ pPoint->y = rootY;
8187+ }
8188+}
8189+void* CHXExSite::_GetWindowWithCursor()
8190+{
8191+#if 0
8192+ //Return the cursor pos in screen coords.
8193+ void* pRet = NULL;
8194+ int rootX = 0;
8195+ int rootY = 0;
8196+ int childX= 0;
8197+ int childY= 0;
8198+ unsigned int mask = 0;
8199+ Bool ret = FALSE;
8200+ Window rootWin;
8201+ Window childWin;
8202+
8203+ HX_ASSERT(GetWindow());
8204+ Display* pDis = (Display*)GetWindow()->display;
8205+ XLockDisplay(pDis);
8206+ ret = XQueryPointer(pDis,
8207+ (Window)GetWindow()->window,
8208+ &rootWin,
8209+ &childWin,
8210+ &rootX, &rootY,
8211+ &childX, &childY,
8212+ &mask);
8213+ XUnlockDisplay(pDis);
8214+
8215+ if(ret)
8216+ {
8217+ pRet = (void*)childWin;
8218+ }
8219+ return pRet;
8220+#else
8221+ HX_ASSERT( "Not implemented..." == NULL );
8222+ return NULL;
8223+#endif
8224+}
8225+
8226+void CHXExSite::_MapPointToOSWindow(HXxPoint* pPt, void** pWindowHandle)
8227+{
8228+ //XXXgfw we could query the window tree and traverse down but that
8229+ //is really slow and this isn't used right now.
8230+ HX_ASSERT( "Not implemented..." == NULL );
8231+}
8232+
8233+void CHXExSite::_ReInitPrimarySurface()
8234+{
8235+ //Nothing to do in unix here right?
8236+}
8237+
8238+HXBOOL CHXExSite::_MoveWindow( void* win,
8239+ INT32 X,
8240+ INT32 Y,
8241+ INT32 nWidth,
8242+ INT32 nHeight,
8243+ HXBOOL bRepaint)
8244+{
8245+#if 0
8246+ //XXXgfw we still have to do bRepaint....
8247+ HX_ASSERT( m_pWindow && m_pWindow->window && m_pWindow->display);
8248+ _DestroyScrollButtons();
8249+ XLockDisplay((Display*) m_pWindow->display);
8250+ XMoveResizeWindow( (Display*)m_pWindow->display,
8251+ (Window)m_pWindow->window,
8252+ X,
8253+ Y,
8254+ nWidth,
8255+ nHeight
8256+ );
8257+ XUnlockDisplay((Display*) m_pWindow->display);
8258+#else
8259+ HX_ASSERT( "Not implemented..." == NULL );
8260+#endif
8261+ return TRUE;
8262+}
8263+
8264+HXBOOL CHXExSite::_UpdateWindow(void* hWnd)
8265+{
8266+ //We need to generate a repaint here of the window....
8267+ return TRUE;
8268+}
8269+
8270+HXBOOL CHXExSite::_ShowWindow(void* hWnd, INT32 nCmdShow)
8271+{
8272+#if 0
8273+ HX_ASSERT( nCmdShow==HX_SHOW_WINDOW || nCmdShow==HX_HIDE_WINDOW);
8274+ if( !m_pWindow || !m_pWindow->window || !m_pWindow->display )
8275+ return FALSE;
8276+
8277+ if( nCmdShow == HX_SHOW_WINDOW )
8278+ {
8279+ _MapScrollButtons();
8280+ XLockDisplay((Display*) m_pWindow->display);
8281+ XMapWindow( (Display*)m_pWindow->display, (Window)m_pWindow->window );
8282+ XUnlockDisplay((Display*) m_pWindow->display);
8283+ }
8284+ else
8285+ {
8286+ _UnmapScrollButtons();
8287+ XLockDisplay((Display*) m_pWindow->display);
8288+ XUnmapWindow( (Display*)m_pWindow->display, (Window)m_pWindow->window );
8289+ XUnlockDisplay((Display*) m_pWindow->display);
8290+ }
8291+#endif
8292+ return TRUE;
8293+}
8294+
8295+HXBOOL CHXExSite::_SetWindowPos(void* hWnd,
8296+ void* hWndInsertAfter,
8297+ INT32 X,
8298+ INT32 Y,
8299+ INT32 cx,
8300+ INT32 cy,
8301+ INT32 uFlags)
8302+{
8303+#ifdef _DEBUG
8304+ fprintf( stderr, "Now what on earth is this suppose to do??\n" );
8305+#endif
8306+ return TRUE;
8307+}
8308+
8309+HXBOOL CHXExSite::_SetWindowRgn(void* hWnd, HXREGION* hRgn, HXBOOL bRedraw)
8310+{
8311+#if 0
8312+ HX_ASSERT( GetWindow() );
8313+ Display* pDis = (Display*)GetWindow()->display;
8314+ XLockDisplay(pDis);
8315+ XSetRegion( pDis,
8316+ (GC)m_pVideoSurface->_GetDC(NULL),
8317+ (Region)hRgn
8318+ );
8319+ XUnlockDisplay(pDis);
8320+ if( bRedraw )
8321+ {
8322+ HX_ASSERT("Redraw asked for here"==NULL );
8323+ }
8324+#endif
8325+ return TRUE;
8326+}
8327+
8328+void CHXExSite::_SetFocus(void* pWindow)
8329+{
8330+#if 0
8331+ XWindowAttributes attr;
8332+ HXxWindow* pWin = GetWindow();
8333+
8334+ HX_ASSERT(pWin);
8335+ HX_ASSERT(pWindow);
8336+
8337+ XLockDisplay((Display*) pWin->display);
8338+ XGetWindowAttributes((Display*)pWin->display, (Window)pWindow, &attr);
8339+ XUnlockDisplay((Display*) pWin->display);
8340+ if( attr.map_state == IsViewable )
8341+ {
8342+ XLockDisplay((Display*) pWin->display);
8343+ XSetInputFocus( (Display*)pWin->display,
8344+ (Window)pWindow,
8345+ RevertToParent,
8346+ CurrentTime
8347+ );
8348+ XUnlockDisplay((Display*) pWin->display);
8349+ }
8350+
8351+ return;
8352+#endif
8353+}
8354+
8355+HX_RESULT CHXExSite::_EnterFullScreen(HXxWindow* pWindow)
8356+{
8357+#if 0
8358+ HXxWindow* pWin = GetWindow();
8359+ HX_ASSERT( pWin && pWin->display && pWin->display);
8360+ HX_ASSERT( this == m_pTopLevelSite );
8361+
8362+ if( 0 != m_winFullScreenWindow || IsFullScreen() )
8363+ {
8364+ //We are already in full screen
8365+ return HXR_FAIL;
8366+ }
8367+
8368+ //Create a override redirect window to fill the root.
8369+ XSizeHints size_hints;
8370+ XLockDisplay((Display*) pWin->display);
8371+ Screen* pScreen = XDefaultScreenOfDisplay((Display*)pWin->display);
8372+ XUnlockDisplay((Display*) pWin->display);
8373+ UINT16 uHorzRes = WidthOfScreen(pScreen);
8374+ UINT16 uVertRes = HeightOfScreen(pScreen);
8375+ int attrMask = 0;
8376+ XSetWindowAttributes attr;
8377+
8378+ memset(&attr, 0, sizeof(XSetWindowAttributes));
8379+ attrMask = CWOverrideRedirect | CWBorderPixel |
8380+ CWBackPixel | CWCursor;
8381+ attr.cursor = None;
8382+ attr.override_redirect = True;
8383+ XLockDisplay((Display*)pWin->display);
8384+ attr.background_pixel = BlackPixel((Display*)pWin->display,
8385+ DefaultScreen((Display*)pWin->display));
8386+ attr.border_pixel = BlackPixel((Display*)pWin->display,
8387+ DefaultScreen((Display*)pWin->display));
8388+ XUnlockDisplay((Display*)pWin->display);
8389+
8390+ size_hints.flags = PPosition | PSize;
8391+ size_hints.x = 0;
8392+ size_hints.y = 0;
8393+ size_hints.width = uHorzRes;
8394+ size_hints.height = uVertRes;
8395+
8396+ //Create it.
8397+ XLockDisplay((Display*) pWin->display);
8398+ Window window = XCreateWindow((Display*)pWin->display,
8399+ DefaultRootWindow((Display*)pWin->display),
8400+ size_hints.x,
8401+ size_hints.y,
8402+ size_hints.width,
8403+ size_hints.height,
8404+ 0,
8405+ CopyFromParent,
8406+ InputOutput,
8407+ CopyFromParent,
8408+ attrMask,
8409+ &attr);
8410+
8411+ //Tell the WM about this window.
8412+ XSetStandardProperties( (Display*)pWin->display,
8413+ window,
8414+ "unixfullscreen",
8415+ "unixfullscreen",
8416+ None,
8417+ NULL, 0,
8418+ &size_hints
8419+ );
8420+
8421+ int result = XSelectInput( zm_display, window,
8422+ ButtonPressMask | ButtonReleaseMask | KeyPressMask |
8423+ KeyReleaseMask | EnterWindowMask | LeaveWindowMask |
8424+ PointerMotionMask | ButtonMotionMask | KeymapStateMask |
8425+ ExposureMask | StructureNotifyMask | FocusChangeMask
8426+ );
8427+
8428+ //Map the window.
8429+ XMapWindow((Display*)pWin->display, window);
8430+ XUnlockDisplay((Display*) pWin->display);
8431+
8432+
8433+ //Get ready to resize the presentation....
8434+ if(m_pTopLevelSite)
8435+ {
8436+ m_pTopLevelSite->m_bDisableForceRedraw = TRUE;
8437+ }
8438+
8439+ //Maintain aspect ratio and Scale it.
8440+ float fXScale = (float)uHorzRes/(float)(m_size.cx);
8441+ float fYScale = (float)uVertRes/(float)(m_size.cy);
8442+ float fScale = (fXScale<fYScale) ? fXScale : fYScale;
8443+ int nWidth = (int)(fScale*m_size.cx+.5);
8444+ int nHeight = (int)(fScale*m_size.cy+.5);
8445+
8446+ //Center the presentation and save the old size
8447+ memcpy( &m_PreFullScreenSize, &m_size, sizeof( HXxSize) ); /* Flawfinder: ignore */
8448+ HXxSize size = {nWidth, nHeight};
8449+
8450+ if( nWidth<uHorzRes )
8451+ m_ptFullScreenOffset.x = (uHorzRes-nWidth)/2;
8452+
8453+ if( nHeight<uVertRes )
8454+ m_ptFullScreenOffset.y = (uVertRes-nHeight)/2;
8455+
8456+ //Reparent our main window.......
8457+ Window winRootParent = 0;
8458+ Window winParent = 0;
8459+ Window* pwinChildren = NULL;
8460+ unsigned int nNumChildren = 0;
8461+ XLockDisplay((Display*) pWin->display);
8462+ XQueryTree( (Display*)pWin->display,
8463+ (Window)pWin->window,
8464+ &winRootParent,
8465+ &winParent,
8466+ &pwinChildren,
8467+ &nNumChildren
8468+ );
8469+ //Free unused children list.
8470+ XFree( pwinChildren );
8471+ XUnlockDisplay((Display*) pWin->display);
8472+
8473+ HX_ASSERT( winParent );
8474+ m_winOldParent = winParent;
8475+ XLockDisplay((Display*) pWin->display);
8476+ XReparentWindow( (Display*)pWin->display,
8477+ (Window)pWin->window,
8478+ window,
8479+ m_ptFullScreenOffset.x,
8480+ m_ptFullScreenOffset.y
8481+ );
8482+
8483+ //Flush event queue.
8484+ XSync((Display*)pWin->display, False);
8485+ XUnlockDisplay((Display*) pWin->display);
8486+
8487+ //Save it
8488+ m_winFullScreenWindow = window;
8489+ m_bInFullScreen = TRUE;
8490+
8491+ //Now resize it...
8492+ SetSize(m_size);
8493+ //Redraw the presentation....
8494+ m_pTopLevelSite->m_bDisableForceRedraw = FALSE;
8495+ _ForceRedrawAll();
8496+
8497+ //Give it focus....
8498+ _SetFocus( (void*)pWin->window );
8499+
8500+ // now eat all the focusouts that came as a result of this reparent...
8501+ XEvent event;
8502+ XLockDisplay((Display*) pWin->display);
8503+ HXBOOL status = XCheckTypedWindowEvent((Display*)pWin->display, (Window)pWin->window,
8504+ FocusOut, &event);
8505+ XUnlockDisplay((Display*) pWin->display);
8506+ while (m_bWindowCreatedByCreate && status)
8507+ {
8508+ // just discarding these
8509+ XLockDisplay((Display*) pWin->display);
8510+ status = XCheckTypedWindowEvent((Display*)pWin->display, (Window)pWin->window,
8511+ FocusOut, &event);
8512+ XUnlockDisplay((Display*) pWin->display);
8513+ }
8514+
8515+ //Update the status text...
8516+ if(m_pStatusText)
8517+ {
8518+ m_pStatusText->ParentChangedSize();
8519+ m_pStatusText->Show();
8520+ }
8521+
8522+#else
8523+ HX_ASSERT( "Not implemented..." == NULL );
8524+#endif
8525+ return HXR_OK;
8526+}
8527+
8528+HX_RESULT CHXExSite::_ExitFullScreen()
8529+{
8530+#if 0
8531+ HX_ASSERT( this == m_pTopLevelSite );
8532+
8533+ HXxWindow* pWin = GetWindow();
8534+
8535+ HX_ASSERT( pWin && pWin->display && pWin->window );
8536+
8537+ //Give the window back to the TLC.
8538+
8539+ XLockDisplay((Display*) pWin->display);
8540+ XReparentWindow( (Display*)pWin->display,
8541+ (Window)pWin->window,
8542+ m_winOldParent,
8543+ m_position.x, m_position.y
8544+ );
8545+ XUnlockDisplay((Display*) pWin->display);
8546+
8547+ //Just kill our window and take us out of full screen....
8548+ if( 0 != m_winFullScreenWindow )
8549+ {
8550+ XLockDisplay((Display*) pWin->display);
8551+ XDestroyWindow( (Display*)pWin->display, m_winFullScreenWindow );
8552+ XUnlockDisplay((Display*) pWin->display);
8553+ m_winFullScreenWindow = 0;
8554+ }
8555+
8556+ m_bDisableForceRedraw = TRUE;
8557+
8558+ m_bInFullScreen = FALSE;
8559+ HXxSize size = {0,0};
8560+ memcpy( &size, &m_PreFullScreenSize, sizeof(HXxSize) ); /* Flawfinder: ignore */
8561+ m_PreFullScreenSize.cx = m_PreFullScreenSize.cy = 0;
8562+
8563+ SetSize(size);
8564+ _SetFocus( (void*)pWin->window );
8565+ m_ptFullScreenOffset.x = 0;
8566+ m_ptFullScreenOffset.y = 0;
8567+
8568+
8569+ m_bDisableForceRedraw = FALSE;
8570+ _ForceRedrawAll();
8571+
8572+ if(m_pStatusText)
8573+ {
8574+ m_pStatusText->ParentChangedSize();
8575+ m_pStatusText->Hide();
8576+ }
8577+
8578+ //move the site back to where it was.
8579+ if( m_pTopLevelSite )
8580+ {
8581+ m_pTopLevelSite->_SetPosition(m_CreateWindowPos);
8582+ }
8583+
8584+ return HXR_OK;
8585+#else
8586+ HX_ASSERT( "Not implemented..." == NULL );
8587+#endif
8588+}
8589+
8590+HX_RESULT CHXExSite::_EnterFullScreenNoNewWindow()
8591+{
8592+#if 0
8593+ HXxWindow* pWin = GetWindow();
8594+
8595+ HX_ASSERT( pWin && pWin->display && pWin->display);
8596+ HX_ASSERT( this == m_pTopLevelSite );
8597+
8598+ if(IsFullScreen() || !pWin)
8599+ {
8600+ //We are already in full screen
8601+ return HXR_FAIL;
8602+ }
8603+
8604+ //Get the screen size.
8605+ XLockDisplay((Display*) pWin->display);
8606+ Screen* pScreen = XDefaultScreenOfDisplay((Display*)pWin->display);
8607+ UINT16 uHorzRes = WidthOfScreen(pScreen);
8608+ UINT16 uVertRes = HeightOfScreen(pScreen);
8609+ XUnlockDisplay((Display*)pWin->display);
8610+
8611+ //Get ready to resize the presentation....
8612+ if( m_pTopLevelSite )
8613+ {
8614+ m_pTopLevelSite->m_bDisableForceRedraw = TRUE;
8615+ }
8616+
8617+ //Maintain aspect ratio and Scale it.
8618+ float fXScale = (float)uHorzRes/(float)(m_size.cx);
8619+ float fYScale = (float)uVertRes/(float)(m_size.cy);
8620+ float fScale = (fXScale<fYScale) ? fXScale : fYScale;
8621+ int nWidth = (int)(fScale*m_size.cx+.5);
8622+ int nHeight = (int)(fScale*m_size.cy+.5);
8623+
8624+ //Center the presentation and save the old size
8625+ memcpy( &m_PreFullScreenSize, &m_size, sizeof( HXxSize) ); /* Flawfinder: ignore */
8626+
8627+ HXxSize size = {nWidth, nHeight};
8628+
8629+ if( nWidth < uHorzRes )
8630+ {
8631+ m_ptFullScreenOffset.x = (uHorzRes - nWidth)/2;
8632+ }
8633+
8634+ if( nHeight < uVertRes )
8635+ {
8636+ m_ptFullScreenOffset.y = (uVertRes - nHeight)/2;
8637+ }
8638+
8639+ //Reparent our main window.......
8640+ Window winRootParent = 0;
8641+ Window winParent = 0;
8642+ Window* pwinChildren = NULL;
8643+ unsigned int nNumChildren = 0;
8644+ XLockDisplay((Display*) pWin->display);
8645+ XQueryTree( (Display*)pWin->display,
8646+ (Window)pWin->window,
8647+ &winRootParent,
8648+ &winParent,
8649+ &pwinChildren,
8650+ &nNumChildren
8651+ );
8652+
8653+ //Free unused children list.
8654+ XFree( pwinChildren );
8655+ XUnlockDisplay((Display*) pWin->display);
8656+
8657+ HX_ASSERT( winParent );
8658+ m_winOldParent = winParent;
8659+
8660+ m_bInFullScreen = TRUE;
8661+
8662+ //Now resize it...
8663+ SetSize(m_size);
8664+
8665+ //Redraw the presentation....
8666+ if( m_pTopLevelSite )
8667+ {
8668+ m_pTopLevelSite->m_bDisableForceRedraw = FALSE;
8669+ }
8670+
8671+ _ForceRedrawAll();
8672+
8673+ //Give it focus....
8674+ _SetFocus( (void*)pWin->window );
8675+
8676+ // now eat all the focusouts that came as a result of this reparent...
8677+ XEvent event;
8678+ XLockDisplay((Display*) pWin->display);
8679+ HXBOOL status = XCheckTypedWindowEvent((Display*)pWin->display, (Window)pWin->window,
8680+ FocusOut, &event);
8681+ XUnlockDisplay((Display*) pWin->display);
8682+ while (m_bWindowCreatedByCreate && status)
8683+ {
8684+ // just discarding these
8685+ XLockDisplay((Display*) pWin->display);
8686+ status = XCheckTypedWindowEvent((Display*)pWin->display, (Window)pWin->window,
8687+ FocusOut, &event);
8688+ XUnlockDisplay((Display*) pWin->display);
8689+ }
8690+
8691+ //Update the status text...
8692+ if(m_pStatusText)
8693+ {
8694+ m_pStatusText->ParentChangedSize();
8695+ m_pStatusText->Show();
8696+ }
8697+#if defined(HELIX_CONFIG_MOBLIN)
8698+ if(!m_pAttachWindowCallback)
8699+ {
8700+ m_pAttachWindowCallback = new CHXGenericCallback((void*)this, (fGenericCBFunc)AttachWindowCallback);
8701+ m_pAttachWindowCallback->AddRef();
8702+ }
8703+ if(!m_pForceRedrawCallback)
8704+ {
8705+ m_pForceRedrawCallback = new CHXGenericCallback((void*)this, (fGenericCBFunc)ForceRedrawCallback);
8706+ m_pForceRedrawCallback->AddRef();
8707+ }
8708+
8709+ // schedule callback for Attaching Window
8710+ if(m_pAttachWindowCallback)
8711+ {
8712+ m_pAttachWindowCallback->CallbackScheduled(m_pScheduler->RelativeEnter(m_pAttachWindowCallback, 100));
8713+ }
8714+ if(m_pForceRedrawCallback)
8715+ {
8716+ m_pForceRedrawCallback->CallbackScheduled(m_pScheduler->RelativeEnter(m_pForceRedrawCallback, 500));
8717+ }
8718+
8719+#endif
8720+#else
8721+ HX_ASSERT( "Not implemented..." == NULL );
8722+#endif
8723+ return HXR_OK;
8724+}
8725+
8726+#if defined(HELIX_CONFIG_MOBLIN)
8727+void CHXExSite::AttachWindowCallback(void* pParam)
8728+{
8729+ CHXExSite* pObj = (CHXExSite*)pParam;
8730+ if (pObj)
8731+ {
8732+ pObj->_AttachWindow();
8733+ }
8734+}
8735+
8736+
8737+void CHXExSite::ForceRedrawCallback(void* pParam)
8738+{
8739+ CHXExSite* pObj = (CHXExSite*)pParam;
8740+
8741+ if (pObj)
8742+ {
8743+ UINT32 ulNumOfChildren = pObj->GetNumberOfChildSites();
8744+ if(pObj->m_pTopLevelSite)
8745+ {
8746+ pObj->m_pTopLevelSite->m_bDisableForceRedraw = FALSE;
8747+ }
8748+ for ( UINT32 i = 0; i < ulNumOfChildren; ++i )
8749+ {
8750+ SPIHXSite spChildSite;
8751+ if ( SUCCEEDED( pObj->GetNthChildSite( i, *spChildSite.AsInOutParam() ) )
8752+ && spChildSite.IsValid() )
8753+ {
8754+ spChildSite->DamageRegion( NULL );
8755+ spChildSite->ForceRedraw();
8756+ }
8757+
8758+ }
8759+ }
8760+}
8761+
8762+void CHXExSite::RemovePendingCallback(CHXGenericCallback* pCB)
8763+{
8764+ if (pCB &&
8765+ pCB->GetPendingCallback() &&
8766+ m_pScheduler)
8767+ {
8768+ m_pScheduler->Remove(pCB->GetPendingCallback());
8769+ pCB->CallbackCanceled();
8770+ }
8771+}
8772+#endif
8773+
8774+HX_RESULT CHXExSite::_EnterFullScreenExt(HXxWindow* pWindow, IHXValues* pValues)
8775+{
8776+#if 0
8777+ m_bReparent = FALSE;
8778+ HX_RESULT res = HXR_OK;
8779+ UINT32 ulReparent = 0;
8780+
8781+ if (pValues)
8782+ {
8783+ pValues->GetPropertyULONG32("Reparent", ulReparent);
8784+ }
8785+
8786+ m_bReparent = (HXBOOL)ulReparent;
8787+
8788+ if (m_bReparent)
8789+ {
8790+ res = _EnterFullScreen(pWindow);
8791+ }
8792+ else
8793+ {
8794+ res = _EnterFullScreenNoNewWindow();
8795+ }
8796+
8797+ CHXBaseSite::FullScreenEntered(res);
8798+ return res;
8799+#else
8800+ HX_ASSERT( "Not implemented..." == NULL );
8801+ return HXR_OK; /* this makes compiler happy */
8802+#endif
8803+}
8804+
8805+HX_RESULT CHXExSite::_ExitFullScreenExt()
8806+{
8807+#if 0
8808+ HX_RESULT res = _ExitFullScreen();
8809+#if defined(HELIX_CONFIG_MOBLIN)
8810+ // schedule callback for attaching window
8811+ if(m_pAttachWindowCallback)
8812+ {
8813+ m_pAttachWindowCallback->CallbackScheduled(m_pScheduler->RelativeEnter(m_pAttachWindowCallback, 100));
8814+ }
8815+ // schedule callback for Force Redraw the window
8816+ if(m_pForceRedrawCallback)
8817+ {
8818+ m_pForceRedrawCallback->CallbackScheduled(m_pScheduler->RelativeEnter(m_pForceRedrawCallback, 500));
8819+ }
8820+#endif
8821+ CHXBaseSite::FullScreenExited(res);
8822+
8823+ return res;
8824+#else
8825+ HX_ASSERT( "Not implemented..." == NULL );
8826+ return HXR_OK; /* this makes compiler happy */
8827+#endif
8828+
8829+}
8830+
8831+HX_RESULT CHXExSite::_EventOccurred(HXxEvent* pEvent)
8832+{
8833+ return HXR_OK;
8834+}
8835+
8836+HX_RESULT CHXExSite::_TestFullScreen( void* hTestBitmap,
8837+ const char* pszStatusText )
8838+{
8839+#ifdef _DEBUG
8840+ fprintf( stderr, "Going to test full screen....\n" );
8841+#endif
8842+ return HXR_OK;
8843+}
8844+
8845+void CHXExSite::ProcessEvent(HXxEvent* pEvent)
8846+{
8847+ if(pEvent)
8848+ {
8849+ //Expose event compression. Combine all outstanding expose events
8850+ //into one big region.
8851+ if(Expose==pEvent->event)
8852+ {
8853+ _CollapseExposeEvents((XEvent*)pEvent->param2);
8854+ }
8855+ }
8856+
8857+ //Send the event to each registered UnixSite.
8858+ void* pSite = NULL;
8859+ void* pWindow = NULL;
8860+ POSITION pos = z_mapSiteToWindow.GetStartPosition();
8861+ while( pos )
8862+ {
8863+ z_mapSiteToWindow.GetNextAssoc(pos, pSite, pWindow);
8864+ CHXExSite* pSiteWindowed = (CHXExSite*)pSite;
8865+ CHXExSite* pTopLevel = NULL;
8866+ HX_ASSERT(pSiteWindowed);
8867+ pSiteWindowed->AddRef();
8868+ pTopLevel = (CHXExSite*)pSiteWindowed->GetTopLevelSite();
8869+
8870+ if(pEvent)
8871+ {
8872+ //Call back into the basesite's event loop.
8873+ pTopLevel->EventOccurred(pEvent);
8874+ }
8875+
8876+ //XXXgfw As a workaround for the overlay not moving while the
8877+ //player is paused, we will check it here and update it if needed.
8878+
8879+ //XXXRGG We might be able to use X's ConfigureNotify messages instead
8880+ //of doing a refresh every 50 ms.
8881+ pTopLevel->_UpdateOverlayIfNeeded();
8882+
8883+ pSiteWindowed->Release();
8884+ }
8885+}
8886+
8887+void CHXExSite::_CollapseExposeEvents(XEvent* xevent)
8888+{
8889+ Display* display = xevent->xany.display;
8890+ Window window = xevent->xany.window;
8891+ XExposeEvent* expose_event = (XExposeEvent*)xevent;
8892+ XEvent new_event;
8893+ XExposeEvent* new_expose_event = (XExposeEvent*)&new_event;
8894+ ushort x1;
8895+ ushort y1;
8896+ ushort x2;
8897+ ushort y2;
8898+ ushort x3;
8899+ ushort y3;
8900+
8901+ x1 = expose_event->x;
8902+ y1 = expose_event->y;
8903+ x2 = x1 + expose_event->width;
8904+ y2 = y1 + expose_event->height;
8905+ XLockDisplay(display);
8906+ HXBOOL status = XCheckWindowEvent(display, window, ExposureMask, &new_event);
8907+ XUnlockDisplay(display);
8908+ while( status)
8909+ {
8910+ if (new_expose_event->x < x1)
8911+ x1 = new_expose_event->x;
8912+
8913+ if (new_expose_event->y < y1)
8914+ y1 = new_expose_event->y;
8915+
8916+ x3 = new_expose_event->x + new_expose_event->width;
8917+ if (x3 > x2)
8918+ x2 = x3;
8919+
8920+ y3 = new_expose_event->y + new_expose_event->height;
8921+ if (y3 > y2)
8922+ y2 = y3;
8923+ XLockDisplay(display);
8924+ status = XCheckWindowEvent(display, window, ExposureMask, &new_event);
8925+ XUnlockDisplay(display);
8926+
8927+ }
8928+
8929+ expose_event->x = x1;
8930+ expose_event->y = y1;
8931+ expose_event->width = x2 - x1;
8932+ expose_event->height = y2 - y1;
8933+ expose_event->count = new_expose_event->count;
8934+}
8935+
8936+
8937+HXBOOL CHXExSite::_ShouldProcess(HXxEvent* pEvent)
8938+{
8939+ HXBOOL bShouldProcessThisEvent = TRUE;
8940+
8941+
8942+ if( !IsSiteVisible() )
8943+ {
8944+ switch (pEvent->event)
8945+ {
8946+ case ButtonPress:
8947+ case ButtonRelease:
8948+ case Expose:
8949+ case FocusIn:
8950+ bShouldProcessThisEvent = FALSE;
8951+ break;
8952+ default:
8953+ break;
8954+ }
8955+ }
8956+
8957+ if(m_pWindow && m_pWindow->window!=pEvent->window)
8958+ {
8959+ bShouldProcessThisEvent = FALSE;
8960+ }
8961+ return bShouldProcessThisEvent;
8962+}
8963+
8964+
8965+///////////////////////////////////////////////////////
8966+//
8967+// UnixEventHandler methods...
8968+//
8969+CHXExSite::UnixEventHandler::UnixEventHandler(CHXExSite* pParent)
8970+ : m_pParent(pParent),
8971+ m_lRefCount(0),
8972+ m_cbHandle(0)
8973+{
8974+ HX_ASSERT(m_pParent);
8975+ HX_ASSERT(m_pParent->m_pScheduler);
8976+ m_cbHandle = m_pParent->m_pScheduler->RelativeEnter((IHXCallback*)this, 30);
8977+}
8978+
8979+CHXExSite::UnixEventHandler::~UnixEventHandler()
8980+{
8981+ CancelCallback();
8982+}
8983+
8984+void
8985+CHXExSite::UnixEventHandler::CancelCallback()
8986+{
8987+ if( m_cbHandle && m_pParent && m_pParent->m_pScheduler )
8988+ {
8989+ UINT32 tempHandle = m_cbHandle;
8990+ m_cbHandle = 0;
8991+ m_pParent->m_pScheduler->Remove(tempHandle);
8992+ }
8993+}
8994+
8995+HX_RESULT CHXExSite::UnixEventHandler::QueryInterface(REFIID riid, void** ppvObj)
8996+{
8997+ if (IsEqualIID(riid, IID_IHXCallback))
8998+ {
8999+ AddRef();
9000+ *ppvObj = (IHXCallback*)this;
9001+ return HXR_OK;
9002+ }
9003+ else if (IsEqualIID(riid, IID_IUnknown))
9004+ {
9005+ AddRef();
9006+ *ppvObj = this;
9007+ return HXR_OK;
9008+ }
9009+
9010+ *ppvObj = NULL;
9011+ return HXR_NOINTERFACE;
9012+}
9013+
9014+ULONG32 CHXExSite::UnixEventHandler::AddRef()
9015+{
9016+ return InterlockedIncrement(&m_lRefCount);
9017+}
9018+
9019+ULONG32 CHXExSite::UnixEventHandler::Release()
9020+{
9021+ HX_ASSERT(m_lRefCount>0);
9022+ if( InterlockedDecrement(&m_lRefCount)>0 )
9023+ {
9024+ return m_lRefCount;
9025+ }
9026+ delete this;
9027+ return 0;
9028+}
9029+
9030+//IHXCallback methods
9031+HX_RESULT CHXExSite::UnixEventHandler::Func()
9032+{
9033+ XEvent xevent;
9034+ static HXxEvent pnevent;
9035+
9036+ m_cbHandle = 0;
9037+ XLockDisplay(m_pParent->zm_display);
9038+ int status = XPending(m_pParent->zm_display);
9039+ XUnlockDisplay(m_pParent->zm_display);
9040+ while(status)
9041+ {
9042+ XLockDisplay(m_pParent->zm_display);
9043+ XNextEvent(m_pParent->zm_display, &xevent);
9044+ XUnlockDisplay(m_pParent->zm_display);
9045+
9046+ // package native event in HXxEvent and send to dispatcher
9047+ pnevent.event = xevent.type;
9048+ pnevent.window = (void *)xevent.xany.window;
9049+ pnevent.param1 = xevent.xany.display;
9050+ pnevent.param2 = &xevent;
9051+
9052+ m_pParent->ProcessEvent(&pnevent);
9053+ XLockDisplay(m_pParent->zm_display);
9054+ status = XPending(m_pParent->zm_display);
9055+ XUnlockDisplay(m_pParent->zm_display);
9056+ }
9057+
9058+ if (m_pParent && m_pParent->m_pScheduler)
9059+ {
9060+ m_cbHandle = m_pParent->m_pScheduler->RelativeEnter((IHXCallback*)this, 30);
9061+ }
9062+ return HXR_OK;
9063+}
9064+
9065+void CHXExSite::_UpdateOverlayIfNeeded()
9066+{
9067+ if( m_pVideoSurface )
9068+ {
9069+ if( m_pVideoSurface->m_nBltMode == HX_OVERLAY_BLT )
9070+ {
9071+ ULONG32 ulNow = HX_GET_BETTERTICKCOUNT();
9072+ CUnixSurf* pSurf = (CUnixSurf*)m_pVideoSurface;
9073+ if( ulNow- pSurf->m_ulLastOverlayUpdateTime > 50 )
9074+ {
9075+ SiteMoving(0,0);
9076+ }
9077+ }
9078+ }
9079+ LISTPOSITION pos = m_ChildrenInZOrder.GetHeadPosition();
9080+ while(pos)
9081+ {
9082+ CHXExSite* pSite = (CHXExSite*)m_ChildrenInZOrder.GetNext(pos);
9083+ pSite->_UpdateOverlayIfNeeded();
9084+ }
9085+}
9086+
9087+
9088+HXBOOL CHXExSite::_ShouldEnterForceRedraw()
9089+{
9090+ if( !m_bDamaged || !m_pUser || !IsSiteVisible() )
9091+ {
9092+ return FALSE;
9093+ }
9094+
9095+ if(InterlockedIncrement(&m_lBltEntryCount)>1)
9096+ {
9097+ InterlockedDecrement(&m_lBltEntryCount);
9098+ return FALSE;
9099+ }
9100+
9101+ return TRUE;
9102+}
9103+
9104+void CHXExSite::_ExitForceRedraw()
9105+{
9106+ InterlockedDecrement(&m_lBltEntryCount);
9107+}
9108+
9109Index: helix-libs/clientapps/clutter/exsite.h
9110===================================================================
9111--- /dev/null 1970-01-01 00:00:00.000000000 +0000
9112+++ helix-libs/clientapps/clutter/exsite.h 2008-10-13 06:05:49.000000000 -0700
9113@@ -0,0 +1,272 @@
9114+/* ***** BEGIN LICENSE BLOCK *****
9115+ * Source last modified: $Id: unixsite.h,v 1.10.2.3 2008/06/05 14:24:30 lovish Exp $
9116+ *
9117+ * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
9118+ *
9119+ * The contents of this file, and the files included with this file,
9120+ * are subject to the current version of the RealNetworks Public
9121+ * Source License (the "RPSL") available at
9122+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
9123+ * the file under the current version of the RealNetworks Community
9124+ * Source License (the "RCSL") available at
9125+ * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
9126+ * will apply. You may also obtain the license terms directly from
9127+ * RealNetworks. You may not use this file except in compliance with
9128+ * the RPSL or, if you have a valid RCSL with RealNetworks applicable
9129+ * to this file, the RCSL. Please see the applicable RPSL or RCSL for
9130+ * the rights, obligations and limitations governing use of the
9131+ * contents of the file.
9132+ *
9133+ * Alternatively, the contents of this file may be used under the
9134+ * terms of the GNU General Public License Version 2 (the
9135+ * "GPL") in which case the provisions of the GPL are applicable
9136+ * instead of those above. If you wish to allow use of your version of
9137+ * this file only under the terms of the GPL, and not to allow others
9138+ * to use your version of this file under the terms of either the RPSL
9139+ * or RCSL, indicate your decision by deleting the provisions above
9140+ * and replace them with the notice and other provisions required by
9141+ * the GPL. If you do not delete the provisions above, a recipient may
9142+ * use your version of this file under the terms of any one of the
9143+ * RPSL, the RCSL or the GPL.
9144+ *
9145+ * This file is part of the Helix DNA Technology. RealNetworks is the
9146+ * developer of the Original Code and owns the copyrights in the
9147+ * portions it created.
9148+ *
9149+ * This file, and the files included with this file, is distributed
9150+ * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
9151+ * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
9152+ * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
9153+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
9154+ * ENJOYMENT OR NON-INFRINGEMENT.
9155+ *
9156+ * Technology Compatibility Kit Test Suite(s) Location:
9157+ * http://www.helixcommunity.org/content/tck
9158+ *
9159+ * Contributor(s):
9160+ * Phil Dibowitz (jaymzh)
9161+ *
9162+ * ***** END LICENSE BLOCK ***** */
9163+
9164+#ifndef _UNIXSITE_H
9165+#define _UNIXSITE_H
9166+
9167+#if defined(USE_XWINDOWS)
9168+#include <X11/Xatom.h>
9169+#include <X11/Xlib.h>
9170+#include <X11/Xutil.h>
9171+#include <X11/Xos.h>
9172+#include <X11/Intrinsic.h>
9173+#include <X11/extensions/XShm.h>
9174+#endif
9175+
9176+#include "basesite.h"
9177+#include "hxcbobj.h"
9178+#include "player.h"
9179+
9180+class CHXExSite : public CHXBaseSite
9181+{
9182+public:
9183+
9184+ friend class CExSurf;
9185+ friend class CExRootSurf;
9186+
9187+ CHXExSite( IUnknown* pContext,
9188+ IUnknown* pUnkOuter,
9189+ INT32 lInitialZorder,
9190+ on_new_frame_cb_t on_new_frame_cb = NULL,
9191+ void *context = NULL);
9192+
9193+ static void ProcessEvent(HXxEvent* pEvent);
9194+ Window CreateXWindow( Window win );
9195+
9196+ void _ForwardUpdateEvent(HXxEvent* pEvent);
9197+
9198+ //static member vars.
9199+ static Display* zm_display;
9200+ void _UpdateOverlayIfNeeded();
9201+ HXBOOL m_bIgnoreFocusOutInFS;
9202+
9203+ //We override this.
9204+ void CheckColorSettings();
9205+
9206+protected:
9207+
9208+ virtual ~CHXExSite();
9209+
9210+ //
9211+ // CHXExSite only methods....
9212+ //
9213+ HX_RESULT _OpenXDisplay(char* DiplayString);
9214+ static void _CollapseExposeEvents(XEvent* xevent);
9215+ HXBOOL _ShouldProcess(HXxEvent* pEvent);
9216+ void _DrawArrows();
9217+ void _CreateHorizScrollBar(void);
9218+ void _CreateVertScrollBar(void);
9219+ HXBOOL _InButton(HXxPoint& pt, int x, int y );
9220+ void _DestroyScrollButtons();
9221+ void _MapScrollButtons();
9222+ void _MapHorzScroll();
9223+ void _MapVertScroll();
9224+ void _UnmapHorzScroll();
9225+ void _UnmapVertScroll();
9226+ void _UnmapScrollButtons();
9227+ void _BuildClipRegion();
9228+ void _ReleaseClippingRegion();
9229+
9230+ //
9231+ // Seperate object for our callbacks to keep the events flowing.
9232+ //
9233+ class UnixEventHandler : public IHXCallback
9234+ {
9235+ public:
9236+ UnixEventHandler(CHXExSite* pParent);
9237+
9238+ //IUnknown methods
9239+ virtual HX_RESULT QueryInterface(REFIID riid, void** ppvObj);
9240+ virtual ULONG32 AddRef();
9241+ virtual ULONG32 Release();
9242+
9243+ //IHXCallback methods
9244+ virtual HX_RESULT Func();
9245+ void CancelCallback();
9246+
9247+ private:
9248+ virtual ~UnixEventHandler();
9249+
9250+ UnixEventHandler();
9251+ UnixEventHandler(const UnixEventHandler&);
9252+ UnixEventHandler& operator=(const UnixEventHandler& it );
9253+
9254+ CHXExSite* m_pParent;
9255+ LONG32 m_lRefCount;
9256+ CallbackHandle m_cbHandle;
9257+
9258+ IUnknown* m_pUnkPlayer;
9259+ };
9260+
9261+
9262+ //
9263+ // CHXBaseSite inherited methods
9264+ //
9265+ virtual void _NeedWindowedSite();
9266+ virtual void _AttachWindow();
9267+ virtual void _DetachWindow();
9268+ virtual void* _Create(void* ParentWindow, UINT32 style);
9269+ virtual void _Destroy(HXxWindow* pWindow);
9270+ virtual void _SetSize(HXxSize size);
9271+ virtual void _SetPosition(HXxPoint position);
9272+ virtual void _DamageRect(HXxRect rect);
9273+ virtual void _DamageRegion(HXxRegion rect);
9274+ virtual HXBOOL _ShouldEnterForceRedraw();
9275+ virtual void _ExitForceRedraw();
9276+ virtual void _SendOSUpdateMessage();
9277+ virtual void _ShowSite(HXBOOL bShow);
9278+ virtual HXBOOL _AtSystemTime();
9279+ virtual void _GetDeviceCaps( void* hdc,
9280+ UINT16& uBitesPerPixel,
9281+ UINT16& uHorzRes,
9282+ UINT16& uVertRes );
9283+ virtual void _GetWindowRect(HXxRect* destRect);
9284+ virtual void _DestroySliders();
9285+ virtual HXBOOL _HandleOSEvents(HXxEvent* pEvent);
9286+ virtual HXBOOL _ConvertToHXEvent(HXxEvent* pEvent);
9287+ virtual void _GenerateOSEvent(HXxEvent* pEvent, HXxEvent* pEvent2);
9288+ virtual void _GenerateSetCursorEvent();
9289+ virtual void _TryCreateXSlider();
9290+ virtual void _SetXSliderValues(INT32 range, INT32 pageSize);
9291+ virtual void _TryCreateYSlider();
9292+ virtual void _SetYSliderValues(INT32 range, INT32 pageSize);
9293+ virtual void _GetSystemSizeOfSliders(INT32* pWidth, INT32* pHeight);
9294+ virtual HXBOOL _IsWindowVisible();
9295+ virtual void _ShowXSlider(HXBOOL bShow);
9296+ virtual void _MoveXSlider( INT32 left,
9297+ INT32 top,
9298+ INT32 right,
9299+ INT32 bottom,
9300+ HXBOOL bRedraw );
9301+ virtual void _ShowYSlider(HXBOOL bShow);
9302+ virtual void _MoveYSlider( INT32 left,
9303+ INT32 top,
9304+ INT32 right,
9305+ INT32 bottom,
9306+ HXBOOL bRedraw);
9307+ virtual HXBOOL _DoesXSliderExist();
9308+ virtual void* _GetContainingWindow();
9309+ virtual void _GetCursorPos(HXxPoint* pPoint);
9310+ virtual void _MapPointToOSWindow(HXxPoint* pPt, void** pWindowHandle);
9311+ virtual void* _GetWindowWithCursor();
9312+ virtual void _ReInitPrimarySurface();
9313+ virtual HXBOOL _MoveWindow( void* ,
9314+ INT32 X,
9315+ INT32 Y,
9316+ INT32 nWidth,
9317+ INT32 nHeight,
9318+ HXBOOL bRepaint);
9319+ virtual HXBOOL _UpdateWindow(void* hWnd);
9320+ virtual HXBOOL _ShowWindow(void* hWnd, INT32 nCmdShow);
9321+ virtual HXBOOL _SetWindowPos(void* hWnd,
9322+ void* hWndInsertAfter,
9323+ INT32 X,
9324+ INT32 Y,
9325+ INT32 cx,
9326+ INT32 cy,
9327+ INT32 uFlags);
9328+ virtual HXBOOL _SetWindowRgn(void* hWnd, HXREGION* hRgn, HXBOOL bRedraw);
9329+ virtual void _SetFocus(void* pWindow);
9330+
9331+ virtual HX_RESULT _EnterFullScreen(HXxWindow* pWindow = NULL);
9332+ virtual HX_RESULT _EventOccurred(HXxEvent* pEvent);
9333+ virtual HX_RESULT _ExitFullScreen();
9334+ virtual HX_RESULT _TestFullScreen( void* hTestBitmap,
9335+ const char* pszStatusText );
9336+ virtual HX_RESULT _EnterFullScreenExt(HXxWindow* pWindow, IHXValues* pValues);
9337+ virtual HX_RESULT _ExitFullScreenExt();
9338+#if defined(HELIX_CONFIG_MOBLIN)
9339+ static void AttachWindowCallback(void *pParam);
9340+ static void ForceRedrawCallback(void *pParam);
9341+ void RemovePendingCallback(CHXGenericCallback* pCB);
9342+
9343+ CHXGenericCallback* m_pAttachWindowCallback;
9344+ CHXGenericCallback* m_pForceRedrawCallback;
9345+#endif
9346+ HXBOOL m_bReparent;
9347+
9348+private:
9349+
9350+ //Protect unintentional copy and default ctors.
9351+ CHXExSite();
9352+ CHXExSite( const CHXExSite& );
9353+ CHXExSite& operator=( const CHXExSite& it );
9354+ HX_RESULT _EnterFullScreenNoNewWindow();
9355+
9356+ //member vars.
9357+ UnixEventHandler* m_pUnixEventHandler;
9358+ static Cursor zm_GrabCursor;
9359+ Window m_ScrollHorizButtonL;
9360+ Window m_ScrollHorizButtonR;
9361+ Window m_ScrollVertButtonT;
9362+ Window m_ScrollVertButtonB;
9363+ Window m_winFullScreenWindow;
9364+ Window m_winOldParent;
9365+ HXxPoint m_ptScrollHorizPosL;
9366+ HXxPoint m_ptScrollHorizPosR;
9367+ HXxPoint m_ptScrollVertPosT;
9368+ HXxPoint m_ptScrollVertPosB;
9369+ HXxPoint m_ptFullScreenOffset;
9370+ HXxSize m_PreFullScreenSize;
9371+ HXBOOL m_bScrollingInProgress;
9372+ int m_nScrollDir;
9373+ HXBOOL m_bLastPointInSite;
9374+ HXBOOL m_bDamaged;
9375+ //
9376+ //Private helpers...
9377+ //
9378+
9379+ //returns the HX_VK associated with this keysym....
9380+ UINT32 _MapKeySymToHXVK(KeySym tmpSym, UINT32& uFlags);
9381+ on_new_frame_cb_t m_on_new_frame_cb;
9382+ void *m_context;
9383+};
9384+
9385+#endif //_UNIXSITE_H
9386Index: helix-libs/clientapps/clutter/exsitsup.cpp
9387===================================================================
9388--- /dev/null 1970-01-01 00:00:00.000000000 +0000
9389+++ helix-libs/clientapps/clutter/exsitsup.cpp 2008-10-13 06:05:49.000000000 -0700
9390@@ -0,0 +1,455 @@
9391+/* ***** BEGIN LICENSE BLOCK *****
9392+ * Version: RCSL 1.0/RPSL 1.0
9393+ *
9394+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
9395+ *
9396+ * The contents of this file, and the files included with this file, are
9397+ * subject to the current version of the RealNetworks Public Source License
9398+ * Version 1.0 (the "RPSL") available at
9399+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
9400+ * the file under the RealNetworks Community Source License Version 1.0
9401+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
9402+ * in which case the RCSL will apply. You may also obtain the license terms
9403+ * directly from RealNetworks. You may not use this file except in
9404+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
9405+ * applicable to this file, the RCSL. Please see the applicable RPSL or
9406+ * RCSL for the rights, obligations and limitations governing use of the
9407+ * contents of the file.
9408+ *
9409+ * This file is part of the Helix DNA Technology. RealNetworks is the
9410+ * developer of the Original Code and owns the copyrights in the portions
9411+ * it created.
9412+ *
9413+ * This file, and the files included with this file, is distributed and made
9414+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
9415+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
9416+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
9417+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
9418+ *
9419+ * Technology Compatibility Kit Test Suite(s) Location:
9420+ * http://www.helixcommunity.org/content/tck
9421+ *
9422+ * Contributor(s):
9423+ *
9424+ * ***** END LICENSE BLOCK ***** */
9425+
9426+#ifdef _WIN16
9427+#include <windows.h>
9428+#endif
9429+
9430+#include "hxcom.h"
9431+#include "hxtypes.h"
9432+#include "hxwintyp.h"
9433+#include "hxwin.h"
9434+#include "ihxpckts.h"
9435+#include "hxcomm.h"
9436+#include "fivemmap.h"
9437+#include "hxstring.h" // CHXString
9438+#include "exsite.h"
9439+#include "exsitsup.h"
9440+#include "pckunpck.h" // CreateBufferCCF
9441+#include "ciddefs.h" // CID_RGB32
9442+#if defined(HELIX_FEATURE_PNG)
9443+#include "pxpngenc.h" // PXPNGEncode::EncodeToPNGBuffer
9444+#endif // HELIX_FEATURE_PNG
9445+#include "print.h"
9446+
9447+
9448+#include "globals.h"
9449+struct _stGlobals*& GetGlobal();
9450+
9451+/************************************************************************
9452+ * Method:
9453+ * Constructor
9454+ */
9455+ ExampleSiteSupplier::ExampleSiteSupplier(IUnknown* pUnkPlayer, on_new_frame_cb_t on_new_frame_cb = NULL, void *context = NULL)
9456+ : m_lRefCount(0)
9457+ , m_pSiteManager(NULL)
9458+ , m_pSite(NULL)
9459+ , m_pSiteCapture(NULL)
9460+ , m_pCaptureBuffer(NULL)
9461+ , m_pCCF(NULL)
9462+ , m_pUnkPlayer(pUnkPlayer)
9463+ , m_on_new_frame_cb(on_new_frame_cb)
9464+ , m_context(context)
9465+{
9466+ if (m_pUnkPlayer)
9467+ {
9468+ m_pUnkPlayer->QueryInterface(IID_IHXSiteManager,
9469+ (void**)&m_pSiteManager);
9470+
9471+ //printf("pauldebug:m_pUnkplayer->QueryInterface for m_pCCF calling\n");
9472+ m_pUnkPlayer->QueryInterface(IID_IHXCommonClassFactory,
9473+ (void**)&m_pCCF);
9474+ //printf("pauldebug:m_pUnkplayer->QueryInterface for m_pCCF called\n");
9475+
9476+ m_pUnkPlayer->AddRef();
9477+ }
9478+};
9479+
9480+/************************************************************************
9481+ * Method:
9482+ * Destructor
9483+ */
9484+ExampleSiteSupplier::~ExampleSiteSupplier()
9485+{
9486+ HX_RELEASE(m_pSiteManager);
9487+ HX_RELEASE(m_pSite);
9488+ HX_RELEASE(m_pSiteCapture);
9489+ HX_RELEASE(m_pCaptureBuffer);
9490+ HX_RELEASE(m_pCCF);
9491+ HX_RELEASE(m_pUnkPlayer);
9492+}
9493+
9494+/************************************************************************
9495+ * Method:
9496+ * IUnknown::QueryInterface
9497+ */
9498+ STDMETHODIMP
9499+ExampleSiteSupplier::QueryInterface(REFIID riid, void** ppvObj)
9500+{
9501+ if (IsEqualIID(riid, IID_IUnknown))
9502+ {
9503+ AddRef();
9504+ *ppvObj = (IUnknown*)(IHXSiteSupplier*)this;
9505+ return HXR_OK;
9506+ }
9507+ else if (IsEqualIID(riid, IID_IHXSiteSupplier))
9508+ {
9509+ AddRef();
9510+ *ppvObj = (IHXSiteSupplier*)this;
9511+ return HXR_OK;
9512+ }
9513+
9514+ *ppvObj = NULL;
9515+ return HXR_NOINTERFACE;
9516+}
9517+
9518+/************************************************************************
9519+ * Method:
9520+ * IUnknown::AddRef
9521+ */
9522+ STDMETHODIMP_(ULONG32)
9523+ExampleSiteSupplier::AddRef()
9524+{
9525+ return InterlockedIncrement(&m_lRefCount);
9526+}
9527+
9528+/************************************************************************
9529+ * Method:
9530+ * IUnknown::Release
9531+ */
9532+ STDMETHODIMP_(ULONG32)
9533+ExampleSiteSupplier::Release()
9534+{
9535+ if (InterlockedDecrement(&m_lRefCount) > 0)
9536+ {
9537+ return m_lRefCount;
9538+ }
9539+
9540+ delete this;
9541+ return 0;
9542+}
9543+
9544+/************************************************************************
9545+ * Method:
9546+ * IHXSiteSupplier::SitesNeeded
9547+ * Purpose:
9548+ * Called to inform the site supplier that a site with a particular
9549+ * set of characteristics is needed. If the site supplier can
9550+ * fulfill the request it should call the site manager and add one
9551+ * or more new sites.
9552+ * Note that the request for sites is associated with a Request ID
9553+ * the client core will inform the site supplier when this requested
9554+ * site is no longer needed.
9555+ */
9556+STDMETHODIMP
9557+ExampleSiteSupplier::SitesNeeded
9558+(
9559+ UINT32 uRequestID,
9560+ IHXValues* pProps
9561+ )
9562+{
9563+ /*
9564+ * Don't create a site if the -NULL_RENDER command line option
9565+ * was given. - jfarr
9566+ */
9567+ if (GetGlobal()->g_bNullRender)
9568+ {
9569+ return (HXR_OK);
9570+ }
9571+
9572+ /*
9573+ * If there are no properties, then we can't really create a
9574+ * site, because we have no idea what type of site is desired!
9575+ */
9576+ if (!pProps)
9577+ {
9578+ return HXR_INVALID_PARAMETER;
9579+ }
9580+
9581+ HRESULT hres = HXR_OK;
9582+ IHXValues* pSiteProps = NULL;
9583+ IHXSiteWindowed* pSiteWindowed = NULL;
9584+ IHXBuffer* pValue = NULL;
9585+ UINT32 style = 0;
9586+ IHXSite* pSite = NULL;
9587+
9588+#if 0
9589+ // Just let the RMA client core create a windowed site for us.
9590+ hres = m_pCCF->CreateInstance(CLSID_IHXSiteWindowed,(void**)&pSiteWindowed);
9591+ if (HXR_OK != hres)
9592+ {
9593+ goto exit;
9594+ }
9595+#else
9596+ {
9597+ *(void **)&pSiteWindowed = (IUnknown*)(IHXSiteWindowed*)(new CHXExSite(GetGlobal()->pMediaPlatform, NULL, 0, m_on_new_frame_cb, m_context));
9598+ hres = ((IUnknown*)*(void **)&pSiteWindowed)->QueryInterface(IID_IHXSiteWindowed, (void**)&pSiteWindowed);
9599+ if (HXR_OK != hres)
9600+ {
9601+ goto exit;
9602+ }
9603+ }
9604+#endif
9605+
9606+ hres = pSiteWindowed->QueryInterface(IID_IHXSite,(void**)&pSite);
9607+ if (HXR_OK != hres)
9608+ {
9609+ goto exit;
9610+ }
9611+
9612+ if( !m_pSite )
9613+ {
9614+ m_pSite = pSite;
9615+ m_pSite->AddRef();
9616+ }
9617+
9618+
9619+ hres = pSiteWindowed->QueryInterface(IID_IHXValues,(void**)&pSiteProps);
9620+ if (HXR_OK != hres)
9621+ {
9622+ goto exit;
9623+ }
9624+
9625+ /*
9626+ * We need to figure out what type of site we are supposed to
9627+ * to create. We need to "switch" between site user and site
9628+ * properties. So look for the well known site user properties
9629+ * that are mapped onto sites...
9630+ */
9631+ hres = pProps->GetPropertyCString("playto",pValue);
9632+ if (HXR_OK == hres)
9633+ {
9634+ pSiteProps->SetPropertyCString("channel",pValue);
9635+ HX_RELEASE(pValue);
9636+ }
9637+ else
9638+ {
9639+ hres = pProps->GetPropertyCString("name",pValue);
9640+ if (HXR_OK == hres)
9641+ {
9642+ pSiteProps->SetPropertyCString("LayoutGroup",pValue);
9643+ HX_RELEASE(pValue);
9644+ }
9645+ }
9646+
9647+#ifdef _WINDOWS
9648+ style = WS_OVERLAPPED | WS_VISIBLE | WS_CLIPCHILDREN;
9649+#endif
9650+
9651+ hres = pSiteWindowed->Create(NULL, style);
9652+ if (HXR_OK != hres)
9653+ {
9654+ goto exit;
9655+ }
9656+
9657+ /*
9658+ * We need to wait until we have set all the properties before
9659+ * we add the site.
9660+ */
9661+ hres = m_pSiteManager->AddSite(pSite);
9662+ if (HXR_OK != hres)
9663+ {
9664+ goto exit;
9665+ }
9666+#ifdef _WINDOWS
9667+ {
9668+ HXxWindow* pWindow = pSiteWindowed->GetWindow();
9669+ if (pWindow && pWindow->window) ::SetForegroundWindow( (HWND)(pWindow->window) );
9670+ }
9671+#endif
9672+ m_CreatedSites.SetAt((void*)uRequestID,pSite);
9673+ pSite->AddRef();
9674+
9675+exit:
9676+
9677+ HX_RELEASE(pSiteProps);
9678+ HX_RELEASE(pSiteWindowed);
9679+ HX_RELEASE(pSite);
9680+
9681+ return hres;
9682+}
9683+
9684+/************************************************************************
9685+ * Method:
9686+ * IHXSiteSupplier::SitesNotNeeded
9687+ * Purpose:
9688+ * Called to inform the site supplier that all sites from a previos
9689+ * site request are no longer needed. If the site supplier had
9690+ * previously created non-persistant sites (like popup windows)
9691+ * to fulfill a request for sites it should call the site manager
9692+ * and remove those sites.
9693+ */
9694+STDMETHODIMP
9695+ExampleSiteSupplier::SitesNotNeeded(UINT32 uRequestID)
9696+{
9697+ IHXSite* pSite = NULL;
9698+ IHXSiteWindowed* pSiteWindowed = NULL;
9699+ void* pVoid = NULL;
9700+
9701+ if (!m_CreatedSites.Lookup((void*)uRequestID,pVoid))
9702+ {
9703+ return HXR_INVALID_PARAMETER;
9704+ }
9705+ pSite = (IHXSite*)pVoid;
9706+
9707+ m_pSiteManager->RemoveSite(pSite);
9708+
9709+ // Need to actually do the work on destroying the window
9710+ // and all that jazz.
9711+ pSite->QueryInterface(IID_IHXSiteWindowed,(void**)&pSiteWindowed);
9712+
9713+ pSiteWindowed->Destroy();
9714+
9715+ // ref count = 2
9716+ pSiteWindowed->Release();
9717+
9718+ // ref count = 1; deleted from this object's view!
9719+ pSite->Release();
9720+
9721+ m_CreatedSites.RemoveKey((void*)uRequestID);
9722+
9723+ return HXR_OK;
9724+}
9725+
9726+/************************************************************************
9727+ * Method:
9728+ * IHXSiteSupplier::BeginChangeLayout
9729+ * Purpose:
9730+ * Called to inform the site supplier a layout change has beginning
9731+ * it can expect to recieve SitesNeeded() and SitesNotNeeded() calls
9732+ * while a layout change is in progress,
9733+ */
9734+STDMETHODIMP
9735+ExampleSiteSupplier::BeginChangeLayout()
9736+{
9737+ return HXR_OK;
9738+}
9739+
9740+/************************************************************************
9741+ * Method:
9742+ * IHXSiteSupplier::DoneChangeLayout
9743+ * Purpose:
9744+ * Called to inform the site supplier the layout change has been
9745+ * completed.
9746+ */
9747+STDMETHODIMP
9748+ExampleSiteSupplier::DoneChangeLayout()
9749+{
9750+ return HXR_OK;
9751+}
9752+
9753+HX_RESULT
9754+ExampleSiteSupplier::CaptureImage(CHXString pszFileName, INT32 dWidth, INT32 dHeight)
9755+{
9756+ HX_RESULT res=HXR_FAIL;
9757+
9758+ // Get the IHXSiteCapture object from the site
9759+ if (m_pSiteCapture == NULL)
9760+ {
9761+ if (m_pSite && m_pSite->QueryInterface(IID_IHXSiteCapture, (void**)&m_pSiteCapture) == HXR_OK)
9762+ {
9763+ m_pSiteCapture->AddRef();
9764+ }
9765+ }
9766+
9767+ // Create the buffer that will receive the image data
9768+ if (m_pCaptureBuffer == NULL)
9769+ {
9770+ CreateBufferCCF(m_pCaptureBuffer, m_pCCF);
9771+ if (!m_pCaptureBuffer)
9772+ {
9773+ return HXR_OUTOFMEMORY;
9774+ }
9775+ }
9776+
9777+ HXBOOL bCanCapture = FALSE;
9778+
9779+ // Check if the site is available to capture an image
9780+ if (m_pSiteCapture && (res = m_pSiteCapture->CanCapture(bCanCapture)) == HXR_OK && bCanCapture)
9781+ {
9782+ HX_RESULT res;
9783+ HXxSize outputSize;
9784+ outputSize.cx = dWidth;
9785+ outputSize.cy = dHeight;
9786+ m_strFileName = pszFileName;
9787+
9788+ // Asynchronous call. CaptureDone() will be called with result.
9789+ res = m_pSiteCapture->Capture((IHXSiteCaptureResponse*)this, m_pCaptureBuffer, &outputSize, CID_RGB32);
9790+ }
9791+
9792+ return res;
9793+
9794+}
9795+
9796+//
9797+// IHXSiteCaptureResponse::CaptureDone
9798+//
9799+// Called when the site has captured the next frame.
9800+// bmiOutputFormat points to image format description which
9801+// is valid until the completion of CaptureDone.
9802+// bmiOutputFormat can be different for every capture.
9803+// pCaptureBuffer holds the image if supplied in
9804+// Capture() method. pCaptureBuffer is automatically
9805+// resized if it has insufficient size to hold the image
9806+// data.
9807+//
9808+// status may be:
9809+// HXR_FAIL -- No capture was done. General Error. All data is invalid.
9810+// HXR_OK -- Capture was done. Both variables are valid.
9811+STDMETHODIMP
9812+ExampleSiteSupplier::CaptureDone(REF(HX_RESULT) status,
9813+ REF(HXBitmapInfoHeader) bmiOutputFormat,
9814+ REF(IHXBuffer*) pCaptureBuffer)
9815+{
9816+ if (status == HXR_OK)
9817+ {
9818+#if defined(HELIX_FEATURE_PNG)
9819+ // Convert capture buffer into PNG
9820+ IHXBuffer* pConvertedBuffer=NULL;
9821+ HX_RESULT res = HXR_OK;
9822+ res = PXPNGEncode::EncodeToPNGBuffer(pCaptureBuffer, &bmiOutputFormat, m_pCCF, pConvertedBuffer);
9823+ if (res == HXR_OK && !m_strFileName.IsEmpty())
9824+ {
9825+ CHXString strTail = m_strFileName.Right(4);
9826+ if (strTail.CompareNoCase(".png") != 0)
9827+ {
9828+ m_strFileName += ".png";
9829+ }
9830+
9831+ FILE* fp = fopen(m_strFileName, "wb");
9832+ if (fp)
9833+ {
9834+ fwrite(pConvertedBuffer->GetBuffer(), 1, pConvertedBuffer->GetSize(), fp);
9835+ fclose(fp);
9836+ STDOUT("Captured image to PNG file: %s\n", (const char*)m_strFileName);
9837+ STDOUT("File size: %ld\n", pConvertedBuffer->GetSize());
9838+ }
9839+ HX_RELEASE(pConvertedBuffer);
9840+ }
9841+#endif // HELIX_FEATURE_PNG
9842+ }
9843+
9844+ return status;
9845+}
9846Index: helix-libs/clientapps/clutter/exsitsup.h
9847===================================================================
9848--- /dev/null 1970-01-01 00:00:00.000000000 +0000
9849+++ helix-libs/clientapps/clutter/exsitsup.h 2008-10-13 06:05:49.000000000 -0700
9850@@ -0,0 +1,154 @@
9851+/* ***** BEGIN LICENSE BLOCK *****
9852+ * Version: RCSL 1.0/RPSL 1.0
9853+ *
9854+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
9855+ *
9856+ * The contents of this file, and the files included with this file, are
9857+ * subject to the current version of the RealNetworks Public Source License
9858+ * Version 1.0 (the "RPSL") available at
9859+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
9860+ * the file under the RealNetworks Community Source License Version 1.0
9861+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
9862+ * in which case the RCSL will apply. You may also obtain the license terms
9863+ * directly from RealNetworks. You may not use this file except in
9864+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
9865+ * applicable to this file, the RCSL. Please see the applicable RPSL or
9866+ * RCSL for the rights, obligations and limitations governing use of the
9867+ * contents of the file.
9868+ *
9869+ * This file is part of the Helix DNA Technology. RealNetworks is the
9870+ * developer of the Original Code and owns the copyrights in the portions
9871+ * it created.
9872+ *
9873+ * This file, and the files included with this file, is distributed and made
9874+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
9875+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
9876+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
9877+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
9878+ *
9879+ * Technology Compatibility Kit Test Suite(s) Location:
9880+ * http://www.helixcommunity.org/content/tck
9881+ *
9882+ * Contributor(s):
9883+ *
9884+ * ***** END LICENSE BLOCK ***** */
9885+
9886+#ifndef _EXSITSUP_H_
9887+#define _EXSITSUP_H_
9888+
9889+#include "fivemmap.h"
9890+#include "player.h"
9891+
9892+/****************************************************************************
9893+ *
9894+ * Class:
9895+ *
9896+ * ExampleSiteSupplier
9897+ *
9898+ * Purpose:
9899+ *
9900+ * Implementation for ragui's IHXSiteSupplier
9901+ *
9902+ */
9903+class ExampleSiteSupplier :
9904+ public IHXSiteSupplier
9905+ , public IHXSiteCaptureResponse
9906+{
9907+private:
9908+ LONG32 m_lRefCount;
9909+ IHXSiteManager* m_pSiteManager;
9910+ IHXSite* m_pSite;
9911+ IHXSiteCapture* m_pSiteCapture;
9912+ IHXBuffer* m_pCaptureBuffer;
9913+ IHXCommonClassFactory* m_pCCF;
9914+ IUnknown* m_pUnkPlayer;
9915+ FiveMinuteMap m_CreatedSites;
9916+ CHXString m_strFileName;
9917+ on_new_frame_cb_t m_on_new_frame_cb;
9918+ void * m_context;
9919+
9920+ ~ExampleSiteSupplier();
9921+
9922+public:
9923+ ExampleSiteSupplier(IUnknown* pUnkPlayer, on_new_frame_cb_t new_frame_cb = NULL, void *context = NULL);
9924+
9925+ /*
9926+ * IUnknown methods
9927+ */
9928+ STDMETHOD(QueryInterface) (THIS_
9929+ REFIID riid,
9930+ void** ppvObj);
9931+
9932+ STDMETHOD_(ULONG32,AddRef) (THIS);
9933+
9934+ STDMETHOD_(ULONG32,Release) (THIS);
9935+
9936+ /*
9937+ * IHXSiteSupplier methods
9938+ */
9939+
9940+ /************************************************************************
9941+ * Method:
9942+ * IHXSiteSupplier::SitesNeeded
9943+ * Purpose:
9944+ * Called to inform the site supplier that a site with a particular
9945+ * set of characteristics is needed. If the site supplier can
9946+ * fulfill the request it should call the site manager and add one
9947+ * or more new sites.
9948+ * Note that the request for sites is associated with a Request ID
9949+ * the client core will inform the site supplier when this requested
9950+ * site is no longer needed.
9951+ */
9952+ STDMETHOD(SitesNeeded) (THIS_
9953+ UINT32 uRequestID,
9954+ IHXValues* pSiteProps);
9955+
9956+ /************************************************************************
9957+ * Method:
9958+ * IHXSiteSupplier::SitesNotNeeded
9959+ * Purpose:
9960+ * Called to inform the site supplier that all sites from a previos
9961+ * site request are no longer needed. If the site supplier had
9962+ * previously created non-persistant sites (like popup windows)
9963+ * to fulfill a request for sites it should call the site manager
9964+ * and remove those sites.
9965+ */
9966+ STDMETHOD(SitesNotNeeded)
9967+ (THIS_
9968+ UINT32 uRequestID);
9969+
9970+
9971+ /************************************************************************
9972+ * Method:
9973+ * IHXSiteSupplier::BeginChangeLayout
9974+ * Purpose:
9975+ * Called to inform the site supplier a layout change has beginning
9976+ * it can expect to recieve SitesNeeded() and SitesNotNeeded() calls
9977+ * while a layout change is in progress,
9978+ */
9979+ STDMETHOD(BeginChangeLayout) (THIS);
9980+
9981+ /************************************************************************
9982+ * Method:
9983+ * IHXSiteSupplier::DoneChangeLayout
9984+ * Purpose:
9985+ * Called to inform the site supplier the layout change has been
9986+ * completed.
9987+ */
9988+ STDMETHOD(DoneChangeLayout) (THIS);
9989+
9990+ /*
9991+ * IHXSiteCaptureResponse
9992+ */
9993+ STDMETHOD(CaptureDone) (THIS_
9994+ REF(HX_RESULT) status,
9995+ REF(HXBitmapInfoHeader) bmiOutputFormat,
9996+ REF(IHXBuffer*) pImageDataBuffer
9997+ );
9998+
9999+ HX_RESULT CaptureImage(CHXString pFileName, INT32 dWidth, INT32 dHeight);
10000+
10001+};
10002+
10003+#endif // _EXSITSUP_H_
10004+
10005Index: helix-libs/clientapps/clutter/exstateadvsnk.cpp
10006===================================================================
10007--- /dev/null 1970-01-01 00:00:00.000000000 +0000
10008+++ helix-libs/clientapps/clutter/exstateadvsnk.cpp 2008-10-13 06:05:49.000000000 -0700
10009@@ -0,0 +1,229 @@
10010+/* ***** BEGIN LICENSE BLOCK *****
10011+ * Version: RCSL 1.0/RPSL 1.0
10012+ *
10013+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
10014+ *
10015+ * The contents of this file, and the files included with this file, are
10016+ * subject to the current version of the RealNetworks Public Source License
10017+ * Version 1.0 (the "RPSL") available at
10018+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
10019+ * the file under the RealNetworks Community Source License Version 1.0
10020+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
10021+ * in which case the RCSL will apply. You may also obtain the license terms
10022+ * directly from RealNetworks. You may not use this file except in
10023+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
10024+ * applicable to this file, the RCSL. Please see the applicable RPSL or
10025+ * RCSL for the rights, obligations and limitations governing use of the
10026+ * contents of the file.
10027+ *
10028+ * This file is part of the Helix DNA Technology. RealNetworks is the
10029+ * developer of the Original Code and owns the copyrights in the portions
10030+ * it created.
10031+ *
10032+ * This file, and the files included with this file, is distributed and made
10033+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
10034+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
10035+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
10036+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
10037+ *
10038+ * Technology Compatibility Kit Test Suite(s) Location:
10039+ * http://www.helixcommunity.org/content/tck
10040+ *
10041+ * Contributor(s):
10042+ *
10043+ * ***** END LICENSE BLOCK ***** */
10044+
10045+#include <stdio.h>
10046+
10047+#include "hxtypes.h"
10048+
10049+#include "hxcom.h"
10050+#include "hxcomm.h"
10051+#include "hxmon.h"
10052+#include "hxcore.h"
10053+#include "hxengin.h"
10054+#include "hxclsnk.h"
10055+#include "hxgroup.h"
10056+#include "hxstrutl.h"
10057+#include "exstateadvsnk.h"
10058+#include "hxstring.h"
10059+#include "hxprefs.h"
10060+#include "excontxt.h"
10061+
10062+#include "print.h"
10063+
10064+#include "globals.h"
10065+#include "player.h"
10066+
10067+struct _stGlobals*& GetGlobal(); //in main.cpp
10068+
10069+#ifdef __TCS__
10070+extern unsigned long gStreamTime;
10071+
10072+static int iOpened = 0;
10073+
10074+
10075+#if defined(__cplusplus)
10076+extern "C" {
10077+#endif /* defined(__cplusplus) */
10078+
10079+typedef enum hookBuffering {
10080+ eContacting = 0,
10081+ eConnecting = 1,
10082+ eBuffering = 2,
10083+ ePlaying = 3
10084+}hookBuffering;
10085+
10086+void hookRealAudio_Buffering(hookBuffering connectState, int pct);
10087+
10088+void hookRealAudio_PlayPosition(unsigned long current,unsigned long duration);
10089+
10090+typedef enum hookState {
10091+ ePlay = 0,
10092+ ePause = 1,
10093+ eStop = 2,
10094+ eResume = 3,
10095+ eComplete // Clip is done playing
10096+}hookState;
10097+void hookRealAudio_State(hookState newState);
10098+
10099+
10100+#if defined(__cplusplus)
10101+}
10102+#endif /* defined(__cplusplus) */
10103+
10104+#endif // __TCS__
10105+
10106+void PrintBuffer(const char* pszName,const unsigned char* pbBuf, unsigned int dwBytes);
10107+
10108+ExampleClientStateAdviceSink::ExampleClientStateAdviceSink(IUnknown* pUnknown, LONG32 lClientIndex, on_state_change_cb_t on_state_change_cb, void *context)
10109+ : m_lRefCount (0)
10110+ , m_lClientIndex (lClientIndex)
10111+ , m_pUnknown (NULL)
10112+ , m_State (HX_CLIENT_STATE_READY)
10113+ , m_state_change_cb(on_state_change_cb)
10114+ , m_context(context)
10115+{
10116+ if (pUnknown)
10117+ {
10118+ m_pUnknown = pUnknown;
10119+ m_pUnknown->AddRef();
10120+
10121+ IHXPlayer* pPlayer;
10122+ IHXClientStateAdviseSinkControl *pStateControl;
10123+ if(HXR_OK == m_pUnknown->QueryInterface(IID_IHXPlayer,
10124+ (void**)&pPlayer))
10125+ {
10126+ m_pPlayer = pPlayer;
10127+
10128+
10129+ }
10130+
10131+ if (HXR_OK == m_pUnknown->QueryInterface(IID_IHXClientStateAdviseSinkControl, (void **)&pStateControl))
10132+ {
10133+ pStateControl->AddClientStateAdviseSink(this);
10134+ }
10135+ }
10136+
10137+#ifdef __TCS__
10138+ bEnableAdviceSink = TRUE;
10139+ iOpened = 0;
10140+#endif
10141+}
10142+
10143+ExampleClientStateAdviceSink::~ExampleClientStateAdviceSink(void)
10144+{
10145+
10146+ if (m_pPlayer)
10147+ {
10148+ m_pPlayer->Release();
10149+ m_pPlayer = NULL;
10150+ }
10151+ if (m_pUnknown)
10152+ {
10153+ m_pUnknown->Release();
10154+ m_pUnknown = NULL;
10155+ }
10156+}
10157+
10158+
10159+// *** IUnknown methods ***
10160+
10161+/////////////////////////////////////////////////////////////////////////
10162+// Method:
10163+// IUnknown::QueryInterface
10164+// Purpose:
10165+// Implement this to export the interfaces supported by your
10166+// object.
10167+//
10168+STDMETHODIMP ExampleClientStateAdviceSink::QueryInterface(REFIID riid, void** ppvObj)
10169+{
10170+ if (IsEqualIID(riid, IID_IUnknown))
10171+ {
10172+ AddRef();
10173+ *ppvObj = (IUnknown*)(IHXClientStateAdviseSink *)this;
10174+ return HXR_OK;
10175+ }
10176+ else if (IsEqualIID(riid, IID_IHXClientStateAdviseSink))
10177+ {
10178+ AddRef();
10179+ *ppvObj = (IHXClientStateAdviseSink*)this;
10180+ return HXR_OK;
10181+ }
10182+
10183+ *ppvObj = NULL;
10184+ return HXR_NOINTERFACE;
10185+}
10186+
10187+/////////////////////////////////////////////////////////////////////////
10188+// Method:
10189+// IUnknown::AddRef
10190+// Purpose:
10191+// Everyone usually implements this the same... feel free to use
10192+// this implementation.
10193+//
10194+STDMETHODIMP_(ULONG32) ExampleClientStateAdviceSink::AddRef()
10195+{
10196+ return InterlockedIncrement(&m_lRefCount);
10197+}
10198+
10199+/////////////////////////////////////////////////////////////////////////
10200+// Method:
10201+// IUnknown::Release
10202+// Purpose:
10203+// Everyone usually implements this the same... feel free to use
10204+// this implementation.
10205+//
10206+STDMETHODIMP_(ULONG32) ExampleClientStateAdviceSink::Release()
10207+{
10208+ if (InterlockedDecrement(&m_lRefCount) > 0)
10209+ {
10210+ return m_lRefCount;
10211+ }
10212+
10213+ delete this;
10214+ return 0;
10215+}
10216+
10217+
10218+/************************************************************************
10219+ * Method:
10220+ * IHXClientStateAdviseSink::OnStateChange
10221+ * Purpose:
10222+ * Called to advise the client state has changed state
10223+ */
10224+STDMETHODIMP ExampleClientStateAdviceSink::OnStateChange(UINT16 uOldState, UINT16 uNewState)
10225+{
10226+ if (m_state_change_cb)
10227+ m_state_change_cb(uOldState, uNewState, m_context);
10228+
10229+ m_State = uNewState;
10230+ return HXR_OK;
10231+}
10232+
10233+EHXClientState ExampleClientStateAdviceSink::GetState()
10234+{
10235+ return m_State;
10236+}
10237+
10238+
10239Index: helix-libs/clientapps/clutter/exstateadvsnk.h
10240===================================================================
10241--- /dev/null 1970-01-01 00:00:00.000000000 +0000
10242+++ helix-libs/clientapps/clutter/exstateadvsnk.h 2008-10-13 06:05:49.000000000 -0700
10243@@ -0,0 +1,108 @@
10244+/* ***** BEGIN LICENSE BLOCK *****
10245+ * Version: RCSL 1.0/RPSL 1.0
10246+ *
10247+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
10248+ *
10249+ * The contents of this file, and the files included with this file, are
10250+ * subject to the current version of the RealNetworks Public Source License
10251+ * Version 1.0 (the "RPSL") available at
10252+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
10253+ * the file under the RealNetworks Community Source License Version 1.0
10254+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
10255+ * in which case the RCSL will apply. You may also obtain the license terms
10256+ * directly from RealNetworks. You may not use this file except in
10257+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
10258+ * applicable to this file, the RCSL. Please see the applicable RPSL or
10259+ * RCSL for the rights, obligations and limitations governing use of the
10260+ * contents of the file.
10261+ *
10262+ * This file is part of the Helix DNA Technology. RealNetworks is the
10263+ * developer of the Original Code and owns the copyrights in the portions
10264+ * it created.
10265+ *
10266+ * This file, and the files included with this file, is distributed and made
10267+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
10268+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
10269+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
10270+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
10271+ *
10272+ * Technology Compatibility Kit Test Suite(s) Location:
10273+ * http://www.helixcommunity.org/content/tck
10274+ *
10275+ * Contributor(s):
10276+ *
10277+ * ***** END LICENSE BLOCK ***** */
10278+
10279+#ifndef _EXAMPLE_CLIENT_STATE_ADVISE_SNK_H_
10280+#define _EXAMPLE_CLIENT_STATE_ADVISE_SNK_H_
10281+
10282+#include "player.h"
10283+
10284+struct IHXClientStateAdviseSink;
10285+struct IHXGroupSink;
10286+struct IUnknown;
10287+struct IHXRegistry;
10288+struct IHXScheduler;
10289+struct IHXCallback;
10290+struct IHXPlayer;
10291+struct IHXGroup;
10292+
10293+class ExampleClientStateAdviceSink : public IHXClientStateAdviseSink
10294+{
10295+ private:
10296+ LONG32 m_lRefCount;
10297+ LONG32 m_lClientIndex;
10298+
10299+ IUnknown* m_pUnknown;
10300+
10301+ UINT32 m_ulStartTime;
10302+ UINT32 m_ulStopTime;
10303+
10304+ UINT32 m_lCurrentBandwidth;
10305+ UINT32 m_lAverageBandwidth;
10306+ HXBOOL m_bOnStop;
10307+
10308+ HXBOOL m_bWaitForTrackStart;
10309+
10310+ on_state_change_cb_t m_state_change_cb;
10311+ void *m_context;
10312+ EHXClientState m_State;
10313+
10314+ // IHXCallback
10315+ IHXPlayer* m_pPlayer;
10316+ ULONG32 m_hCallback;
10317+ ~ExampleClientStateAdviceSink();
10318+
10319+
10320+ public:
10321+
10322+ ExampleClientStateAdviceSink(IUnknown* /*IN*/ pUnknown, LONG32 /*IN*/ lClientIndex, on_state_change_cb_t on_state_change_cb = NULL, void *context = NULL);
10323+
10324+ /*
10325+ * IUnknown methods
10326+ */
10327+ STDMETHOD(QueryInterface) (THIS_
10328+ REFIID riid,
10329+ void** ppvObj);
10330+
10331+ STDMETHOD_(ULONG32,AddRef) (THIS);
10332+
10333+ STDMETHOD_(ULONG32,Release) (THIS);
10334+
10335+ /***********************************************************************
10336+ * Method:
10337+ * IHXClientStateAdviseSink::OnStateChange
10338+ * Purpose:
10339+ * Called by client engine to inform the client that the state has changed.
10340+ * States are defined in the enum EHXClientState, defined in this file.
10341+ *
10342+ */
10343+ STDMETHOD(OnStateChange) (THIS_
10344+ UINT16 uOldState,
10345+ UINT16 uNewState
10346+ ) ;
10347+
10348+ EHXClientState GetState();
10349+};
10350+
10351+#endif /* _EXAMPLECLSNK_ */
10352Index: helix-libs/clientapps/clutter/fivemmap.cpp
10353===================================================================
10354--- /dev/null 1970-01-01 00:00:00.000000000 +0000
10355+++ helix-libs/clientapps/clutter/fivemmap.cpp 2008-10-13 06:05:49.000000000 -0700
10356@@ -0,0 +1,175 @@
10357+/* ***** BEGIN LICENSE BLOCK *****
10358+ * Version: RCSL 1.0/RPSL 1.0
10359+ *
10360+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
10361+ *
10362+ * The contents of this file, and the files included with this file, are
10363+ * subject to the current version of the RealNetworks Public Source License
10364+ * Version 1.0 (the "RPSL") available at
10365+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
10366+ * the file under the RealNetworks Community Source License Version 1.0
10367+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
10368+ * in which case the RCSL will apply. You may also obtain the license terms
10369+ * directly from RealNetworks. You may not use this file except in
10370+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
10371+ * applicable to this file, the RCSL. Please see the applicable RPSL or
10372+ * RCSL for the rights, obligations and limitations governing use of the
10373+ * contents of the file.
10374+ *
10375+ * This file is part of the Helix DNA Technology. RealNetworks is the
10376+ * developer of the Original Code and owns the copyrights in the portions
10377+ * it created.
10378+ *
10379+ * This file, and the files included with this file, is distributed and made
10380+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
10381+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
10382+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
10383+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
10384+ *
10385+ * Technology Compatibility Kit Test Suite(s) Location:
10386+ * http://www.helixcommunity.org/content/tck
10387+ *
10388+ * Contributor(s):
10389+ *
10390+ * ***** END LICENSE BLOCK ***** */
10391+
10392+#include <string.h>
10393+#include "hxtypes.h"
10394+#include "fivemmap.h"
10395+
10396+void* FiveMinuteMap::GetFirstValue()
10397+{
10398+ m_nCursor = 0;
10399+
10400+ if (m_nMapSize)
10401+ {
10402+ return m_pValueArray[m_nCursor];
10403+ }
10404+ else
10405+ {
10406+ return NULL;
10407+ }
10408+}
10409+
10410+void* FiveMinuteMap::GetNextValue()
10411+{
10412+ m_nCursor++;
10413+
10414+ if (m_nCursor < m_nMapSize)
10415+ {
10416+ return m_pValueArray[m_nCursor];
10417+ }
10418+ else
10419+ {
10420+ return NULL;
10421+ }
10422+}
10423+
10424+HXBOOL FiveMinuteMap::Lookup(void* Key, void*& Value) const
10425+{
10426+ HXBOOL bFound = FALSE;
10427+ int nIndex = 0;
10428+
10429+ // If Key is alrady in the list, replace value
10430+ for (; nIndex < m_nMapSize; nIndex++)
10431+ {
10432+ if (m_pKeyArray[nIndex] == Key)
10433+ {
10434+ Value = m_pValueArray[nIndex];
10435+ bFound = TRUE;
10436+ goto exit;
10437+ }
10438+ }
10439+
10440+exit:
10441+ return bFound;
10442+}
10443+
10444+void FiveMinuteMap::RemoveKey(void* Key)
10445+{
10446+ HXBOOL bFound = FALSE;
10447+ int nIndex = 0;
10448+
10449+ // If Key is alrady in the list, replace value
10450+ for (; nIndex < m_nMapSize; nIndex++)
10451+ {
10452+ if (m_pKeyArray[nIndex] == Key)
10453+ {
10454+ if (nIndex < (m_nMapSize-1))
10455+ {
10456+ memmove(&(m_pKeyArray[nIndex]),&(m_pKeyArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1)));
10457+ memmove(&(m_pValueArray[nIndex]),&(m_pValueArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1)));
10458+ }
10459+ m_nMapSize--;
10460+ goto exit;
10461+ }
10462+ }
10463+
10464+exit:
10465+ (NULL); // We're done!
10466+}
10467+
10468+void FiveMinuteMap::RemoveValue(void* Value)
10469+{
10470+ HXBOOL bFound = FALSE;
10471+ int nIndex = 0;
10472+
10473+ // If Value is alrady in the list, replace value
10474+ for (; nIndex < m_nMapSize; nIndex++)
10475+ {
10476+ if (m_pValueArray[nIndex] == Value)
10477+ {
10478+ if (nIndex < (m_nMapSize-1))
10479+ {
10480+ memmove(&(m_pKeyArray[nIndex]),&(m_pKeyArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1)));
10481+ memmove(&(m_pValueArray[nIndex]),&(m_pValueArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1)));
10482+ }
10483+ m_nMapSize--;
10484+ goto exit;
10485+ }
10486+ }
10487+
10488+exit:
10489+ (NULL); // We're done!
10490+}
10491+
10492+
10493+void FiveMinuteMap::SetAt(void* Key, void* Value)
10494+{
10495+ int nIndex = 0;
10496+
10497+ // If Key is alrady in the list, replace value
10498+ for (; nIndex < m_nMapSize; nIndex++)
10499+ {
10500+ if (m_pKeyArray[nIndex] == Key)
10501+ {
10502+ m_pValueArray[nIndex] = Value;
10503+ goto exit;
10504+ }
10505+ }
10506+
10507+ // If we have room, add it to the end!
10508+ if (m_nAllocSize == m_nMapSize)
10509+ {
10510+ m_nAllocSize += AllocationSize;
10511+ void** pNewKeys = new void*[m_nAllocSize];
10512+ void** pNewValues = new void*[m_nAllocSize];
10513+
10514+ memcpy(pNewKeys,m_pKeyArray,sizeof(void*)*m_nMapSize); /* Flawfinder: ignore */
10515+ memcpy(pNewValues,m_pValueArray,sizeof(void*)*m_nMapSize); /* Flawfinder: ignore */
10516+
10517+ delete [] m_pKeyArray;
10518+ delete [] m_pValueArray;
10519+
10520+ m_pKeyArray = pNewKeys;
10521+ m_pValueArray = pNewValues;
10522+ }
10523+
10524+ m_pKeyArray[m_nMapSize] = Key;
10525+ m_pValueArray[m_nMapSize] = Value;
10526+ m_nMapSize++;
10527+
10528+exit:
10529+ (NULL); // We're done!
10530+}
10531+
10532Index: helix-libs/clientapps/clutter/fivemmap.h
10533===================================================================
10534--- /dev/null 1970-01-01 00:00:00.000000000 +0000
10535+++ helix-libs/clientapps/clutter/fivemmap.h 2008-10-13 06:05:49.000000000 -0700
10536@@ -0,0 +1,79 @@
10537+/* ***** BEGIN LICENSE BLOCK *****
10538+ * Version: RCSL 1.0/RPSL 1.0
10539+ *
10540+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
10541+ *
10542+ * The contents of this file, and the files included with this file, are
10543+ * subject to the current version of the RealNetworks Public Source License
10544+ * Version 1.0 (the "RPSL") available at
10545+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
10546+ * the file under the RealNetworks Community Source License Version 1.0
10547+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
10548+ * in which case the RCSL will apply. You may also obtain the license terms
10549+ * directly from RealNetworks. You may not use this file except in
10550+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
10551+ * applicable to this file, the RCSL. Please see the applicable RPSL or
10552+ * RCSL for the rights, obligations and limitations governing use of the
10553+ * contents of the file.
10554+ *
10555+ * This file is part of the Helix DNA Technology. RealNetworks is the
10556+ * developer of the Original Code and owns the copyrights in the portions
10557+ * it created.
10558+ *
10559+ * This file, and the files included with this file, is distributed and made
10560+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
10561+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
10562+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
10563+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
10564+ *
10565+ * Technology Compatibility Kit Test Suite(s) Location:
10566+ * http://www.helixcommunity.org/content/tck
10567+ *
10568+ * Contributor(s):
10569+ *
10570+ * ***** END LICENSE BLOCK ***** */
10571+
10572+#ifndef _FIVEMMAP_H_
10573+#define _FIVEMMAP_H_
10574+
10575+#ifndef _HXTYPES_H_
10576+#error FiveMinuteMap assumes pntypes.h.
10577+#endif
10578+
10579+class FiveMinuteMap
10580+{
10581+ const int AllocationSize;
10582+
10583+ void** m_pKeyArray;
10584+ void** m_pValueArray;
10585+ int m_nMapSize;
10586+ int m_nAllocSize;
10587+ int m_nCursor;
10588+public:
10589+ FiveMinuteMap()
10590+ : m_pKeyArray(NULL)
10591+ , m_pValueArray(NULL)
10592+ , m_nMapSize(0)
10593+ , m_nAllocSize(0)
10594+ , m_nCursor(0)
10595+ , AllocationSize(10)
10596+ {};
10597+
10598+ ~FiveMinuteMap()
10599+ {
10600+ delete [] m_pKeyArray;
10601+ delete [] m_pValueArray;
10602+ };
10603+
10604+ int GetCount() {return m_nMapSize;}
10605+
10606+ void* GetFirstValue();
10607+ void* GetNextValue();
10608+
10609+ HXBOOL Lookup(void* Key, void*& Value) const;
10610+ void RemoveKey(void* Key);
10611+ void RemoveValue(void* Value);
10612+ void SetAt(void* Key, void* Value);
10613+};
10614+
10615+#endif /* _FIVEMMAP_H_ */
10616Index: helix-libs/clientapps/clutter/globals.h
10617===================================================================
10618--- /dev/null 1970-01-01 00:00:00.000000000 +0000
10619+++ helix-libs/clientapps/clutter/globals.h 2008-10-13 06:05:49.000000000 -0700
10620@@ -0,0 +1,150 @@
10621+/* ***** BEGIN LICENSE BLOCK *****
10622+ * Version: RCSL 1.0/RPSL 1.0
10623+ *
10624+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
10625+ *
10626+ * The contents of this file, and the files included with this file, are
10627+ * subject to the current version of the RealNetworks Public Source License
10628+ * Version 1.0 (the "RPSL") available at
10629+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
10630+ * the file under the RealNetworks Community Source License Version 1.0
10631+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
10632+ * in which case the RCSL will apply. You may also obtain the license terms
10633+ * directly from RealNetworks. You may not use this file except in
10634+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
10635+ * applicable to this file, the RCSL. Please see the applicable RPSL or
10636+ * RCSL for the rights, obligations and limitations governing use of the
10637+ * contents of the file.
10638+ *
10639+ * This file is part of the Helix DNA Technology. RealNetworks is the
10640+ * developer of the Original Code and owns the copyrights in the portions
10641+ * it created.
10642+ *
10643+ * This file, and the files included with this file, is distributed and made
10644+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
10645+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
10646+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
10647+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
10648+ *
10649+ * Technology Compatibility Kit Test Suite(s) Location:
10650+ * http://www.helixcommunity.org/content/tck
10651+ *
10652+ * Contributor(s):
10653+ *
10654+ * ***** END LICENSE BLOCK ***** */
10655+
10656+/****************************************************************************
10657+ *
10658+ * Test Client:
10659+ *
10660+ *
10661+ * This is an test client running on Windows, Mac, and Unix without a GUI.
10662+ *
10663+ */
10664+
10665+#ifndef _SPLAY_GLOBALS_H
10666+#define _SPLAY_GLOBALS_H
10667+
10668+#include "dllacces.h"
10669+#include "dllpath.h"
10670+#include "hxengin.h"
10671+#include "hxplayvelocity.h"
10672+#include "hxcore.h"
10673+#include "ihxmedpltfm.h"
10674+#include "excontxt.h"
10675+#include "preflist.h"
10676+
10677+#define HX_COMMAND_BUFFER_SIZE 256
10678+#define HX_MAX_NUM_MULTI_SEEKS 10
10679+struct _stGlobals
10680+{
10681+ _stGlobals()
10682+ : g_pDLLAccess(NULL),
10683+ g_nPlayers(0),
10684+ m_fpHXMediaPlatformOpen(NULL),
10685+ m_fpHXCreateMediaPlatform(NULL),
10686+ m_fpHXMediaPlatformClose(NULL),
10687+ m_fpCreateEngine(NULL),
10688+ m_fpCloseEngine(NULL),
10689+ m_fpSetDLLAccessPath(NULL),
10690+ bEnableAdviceSink(FALSE),
10691+ bEnableVerboseMode(FALSE),
10692+ g_bEnableSlowStart(TRUE),
10693+ g_bOnBeginOccurred(FALSE),
10694+ g_pszUsername( NULL),
10695+ g_pszPassword(NULL),
10696+ g_pszGUIDFile(NULL),
10697+ g_pszGUIDList(NULL),
10698+ g_Error(HXR_OK),
10699+ g_ulNumSecondsPlayed(0),
10700+ pMediaPlatform(NULL),
10701+ g_pIHXKicker(NULL),
10702+ bUseLegacyAPIs(FALSE),
10703+ pEngine(NULL),
10704+ g_pQuickSeek(NULL),
10705+ g_bNullRender(FALSE),
10706+ g_bUserStop(FALSE),
10707+ g_bInitVelocity(FALSE),
10708+ g_bABD(FALSE),
10709+ g_pVelocityCaps(NULL),
10710+ g_ulNumMultiSeeks(0),
10711+ g_ulMultiSeekIndex(0),
10712+ g_bMultiSeek(FALSE),
10713+ g_uThreadIDForKicker(-1)
10714+ {
10715+ memset(g_szCommandBuffer, 0, HX_COMMAND_BUFFER_SIZE);
10716+ memset(g_szPriorCommandBuffer, 0, HX_COMMAND_BUFFER_SIZE);
10717+ memset(g_Players, 0, sizeof(g_Players));
10718+ memset(g_pszURLs, 0, sizeof(g_pszURLs));
10719+ memset(g_pClientContexts, 0, sizeof(g_pClientContexts));
10720+ }
10721+
10722+ #define MAX_NUM_PLAYERS 256
10723+ IHXPlayer* g_Players[MAX_NUM_PLAYERS];
10724+ char *g_pszURLs[MAX_NUM_PLAYERS];
10725+ ExampleClientContext *g_pClientContexts[MAX_NUM_PLAYERS];
10726+ int g_nPlayers;
10727+ DLLAccessPath g_statclnt;
10728+ DLLAccess* g_pDLLAccess;
10729+ CHXPrefList g_prefList;
10730+
10731+ FPHXMEDIAPLATFORMOPEN m_fpHXMediaPlatformOpen;
10732+ FPHXCREATEMEDIAPLATFORM m_fpHXCreateMediaPlatform;
10733+ FPHXMEDIAPLATFORMCLOSE m_fpHXMediaPlatformClose;
10734+
10735+ FPRMCREATEENGINE m_fpCreateEngine;
10736+ FPRMCLOSEENGINE m_fpCloseEngine;
10737+ FPRMSETDLLACCESSPATH m_fpSetDLLAccessPath;
10738+
10739+ HXBOOL bEnableAdviceSink;
10740+ HXBOOL bEnableVerboseMode;
10741+ HXBOOL g_bEnableSlowStart;
10742+ HXBOOL g_bOnBeginOccurred;
10743+ char* g_pszUsername;
10744+ char* g_pszPassword;
10745+ char* g_pszGUIDFile;
10746+ char* g_pszGUIDList;
10747+ HX_RESULT g_Error;
10748+ UINT32 g_ulNumSecondsPlayed;
10749+ IHXMediaPlatform* pMediaPlatform;
10750+ IHXMediaPlatformKicker* g_pIHXKicker;
10751+ UINT32 g_uThreadIDForKicker;
10752+ pthread_t g_pThreadKickmanId;
10753+ HXBOOL bUseLegacyAPIs;
10754+ IHXClientEngine* pEngine;
10755+ IHXQuickSeek* g_pQuickSeek;
10756+ HXBOOL g_bNullRender;
10757+ HXBOOL g_bUserStop;
10758+ HXBOOL g_bInitVelocity;
10759+ HXBOOL g_bABD;
10760+ IHXPlaybackVelocityCaps* g_pVelocityCaps;
10761+ HXBOOL g_bMultiSeek;
10762+ UINT32 g_ulMultiSeekTime[HX_MAX_NUM_MULTI_SEEKS];
10763+ UINT32 g_ulNumMultiSeeks;
10764+ UINT32 g_ulMultiSeekIndex;
10765+ char g_szCommandBuffer[HX_COMMAND_BUFFER_SIZE];
10766+ char g_szPriorCommandBuffer[HX_COMMAND_BUFFER_SIZE];
10767+};
10768+
10769+
10770+#endif // _SPLAY_GLOBALS_H
10771Index: helix-libs/clientapps/clutter/iids.cpp
10772===================================================================
10773--- /dev/null 1970-01-01 00:00:00.000000000 +0000
10774+++ helix-libs/clientapps/clutter/iids.cpp 2008-10-13 06:05:49.000000000 -0700
10775@@ -0,0 +1,50 @@
10776+/* ***** BEGIN LICENSE BLOCK *****
10777+ * Version: RCSL 1.0/RPSL 1.0
10778+ *
10779+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
10780+ *
10781+ * The contents of this file, and the files included with this file, are
10782+ * subject to the current version of the RealNetworks Public Source License
10783+ * Version 1.0 (the "RPSL") available at
10784+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
10785+ * the file under the RealNetworks Community Source License Version 1.0
10786+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
10787+ * in which case the RCSL will apply. You may also obtain the license terms
10788+ * directly from RealNetworks. You may not use this file except in
10789+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
10790+ * applicable to this file, the RCSL. Please see the applicable RPSL or
10791+ * RCSL for the rights, obligations and limitations governing use of the
10792+ * contents of the file.
10793+ *
10794+ * This file is part of the Helix DNA Technology. RealNetworks is the
10795+ * developer of the Original Code and owns the copyrights in the portions
10796+ * it created.
10797+ *
10798+ * This file, and the files included with this file, is distributed and made
10799+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
10800+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
10801+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
10802+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
10803+ *
10804+ * Technology Compatibility Kit Test Suite(s) Location:
10805+ * http://www.helixcommunity.org/content/tck
10806+ *
10807+ * Contributor(s):
10808+ *
10809+ * ***** END LICENSE BLOCK ***** */
10810+
10811+// define all guids here once...
10812+#define INITGUID
10813+#define NCIHACK
10814+#include "hxtypes.h"
10815+#include "hxcom.h"
10816+#include "hxiids.h"
10817+#include "hxpiids.h"
10818+#if defined _WINDOWS
10819+#if defined (HELIX_FEATURE_DIRECT_SOUND)
10820+#include "dsound.h"
10821+#endif /* HELIX_FEATURE_DIRECT_SOUND */
10822+#if defined (HELIX_FEATURE_VIDEO) && !defined(_WINCE)
10823+#include "ddraw.h"
10824+#endif /* HELIX_FEATURE_VIDEO */
10825+#endif
10826Index: helix-libs/clientapps/clutter/linux2.pcf
10827===================================================================
10828--- /dev/null 1970-01-01 00:00:00.000000000 +0000
10829+++ helix-libs/clientapps/clutter/linux2.pcf 2008-10-13 06:05:49.000000000 -0700
10830@@ -0,0 +1,42 @@
10831+#
10832+# ***** BEGIN LICENSE BLOCK *****
10833+# Version: RCSL 1.0/RPSL 1.0
10834+#
10835+# Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
10836+#
10837+# The contents of this file, and the files included with this file, are
10838+# subject to the current version of the RealNetworks Public Source License
10839+# Version 1.0 (the "RPSL") available at
10840+# http://www.helixcommunity.org/content/rpsl unless you have licensed
10841+# the file under the RealNetworks Community Source License Version 1.0
10842+# (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
10843+# in which case the RCSL will apply. You may also obtain the license terms
10844+# directly from RealNetworks. You may not use this file except in
10845+# compliance with the RPSL or, if you have a valid RCSL with RealNetworks
10846+# applicable to this file, the RCSL. Please see the applicable RPSL or
10847+# RCSL for the rights, obligations and limitations governing use of the
10848+# contents of the file.
10849+#
10850+# This file is part of the Helix DNA Technology. RealNetworks is the
10851+# developer of the Original Code and owns the copyrights in the portions
10852+# it created.
10853+#
10854+# This file, and the files included with this file, is distributed and made
10855+# available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
10856+# EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
10857+# INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
10858+# FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
10859+#
10860+# Technology Compatibility Kit Test Suite(s) Location:
10861+# http://www.helixcommunity.org/content/tck
10862+#
10863+# Contributor(s):
10864+#
10865+# ***** END LICENSE BLOCK *****
10866+#
10867+
10868+project.AddSystemLibraries("dl", "m", "pthread")
10869+
10870+if (project.IsDefined("HELIX_FEATURE_VIDEO") and
10871+ project.IsDefined("USE_XWINDOWS")):
10872+ project.AddSystemLibraries("X11")
10873Index: helix-libs/clientapps/clutter/player.cpp
10874===================================================================
10875--- /dev/null 1970-01-01 00:00:00.000000000 +0000
10876+++ helix-libs/clientapps/clutter/player.cpp 2008-10-13 06:05:49.000000000 -0700
10877@@ -0,0 +1,1057 @@
10878+/* ***** BEGIN LICENSE BLOCK *****
10879+ * Version: RCSL 1.0/RPSL 1.0
10880+ *
10881+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
10882+ *
10883+ * The contents of this file, and the files included with this file, are
10884+ * subject to the current version of the RealNetworks Public Source License
10885+ * Version 1.0 (the "RPSL") available at
10886+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
10887+ * the file under the RealNetworks Community Source License Version 1.0
10888+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
10889+ * in which case the RCSL will apply. You may also obtain the license terms
10890+ * directly from RealNetworks. You may not use this file except in
10891+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
10892+ * applicable to this file, the RCSL. Please see the applicable RPSL or
10893+ * RCSL for the rights, obligations and limitations governing use of the
10894+ * contents of the file.
10895+ *
10896+ * This file is part of the Helix DNA Technology. RealNetworks is the
10897+ * developer of the Original Code and owns the copyrights in the portions
10898+ * it created.
10899+ *
10900+ * This file, and the files included with this file, is distributed and made
10901+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
10902+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
10903+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
10904+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
10905+ *
10906+ * Technology Compatibility Kit Test Suite(s) Location:
10907+ * http://www.helixcommunity.org/content/tck
10908+ *
10909+ * Contributor(s):
10910+ *
10911+ * ***** END LICENSE BLOCK ***** */
10912+
10913+/****************************************************************************
10914+ *
10915+ * Test Client:
10916+ *
10917+ *
10918+ * This is an test client running on Windows, Mac, and Unix without a GUI.
10919+ *
10920+ */
10921+#include "hxtypes.h"
10922+
10923+#include <stdlib.h>
10924+
10925+#include "hlxclib/time.h"
10926+#include "ihxmedpltfm.h"
10927+#include "hxwintyp.h"
10928+#include "hxcom.h"
10929+#include "ihxpckts.h"
10930+#include "hxcomm.h"
10931+#include "hxmon.h"
10932+#include "hxfiles.h"
10933+#include "hxengin.h"
10934+#include "hxcore.h"
10935+#include "hxclsnk.h"
10936+#include "hxgroup.h"
10937+#include "hxerror.h"
10938+#include "hxauth.h"
10939+#include "hxwin.h"
10940+#include "hxprefs.h"
10941+#include "hxtbuf.h"
10942+#include "fivemmap.h"
10943+#include "dllacces.h"
10944+#include "hxausvc.h"
10945+#include "hxstrutl.h"
10946+#include "hxgroup.h"
10947+#include "hxwin.h"
10948+#include "hxtick.h"
10949+#include "hxbuffer.h"
10950+#include "hxplayvelocity.h"
10951+#include "pckunpck.h" // For CreateAndSetBufferCCF()
10952+#include "hxvctrl.h"
10953+#include "hxbsrc.h"
10954+#include "excallback.h"
10955+#include "pthread.h"
10956+
10957+#if defined(HELIX_FEATURE_PRESENTATION_FEATURE_SELECTION)
10958+#include "hxpfs.h"
10959+#endif // HELIX_FEATURE_PRESENTATION_FEATURE_SELECTION.
10960+
10961+#if defined(HELIX_FEATURE_PREFERENCES)
10962+#include "preflist.h"
10963+#endif /* #if defined(HELIX_FEATURE_PREFERENCES) */
10964+#include "exadvsnk.h"
10965+#include "exerror.h"
10966+#include "exsitsup.h"
10967+#include "exaumgr.h"
10968+#if defined(_WIN32)
10969+#include "exabd.h"
10970+#endif
10971+#include "excontxt.h"
10972+#include "print.h"
10973+#if defined(USE_XWINDOWS)
10974+#include <X11/Xlib.h>
10975+#endif
10976+#if defined (_UNIX)
10977+#include <stdio.h>
10978+#include <sys/time.h>
10979+#include <sys/types.h>
10980+#include <unistd.h>
10981+#include <termios.h>
10982+#endif
10983+#if defined(_WINDOWS)
10984+#include <conio.h>
10985+#endif
10986+
10987+#ifdef __TCS__
10988+#include <unistd.h>
10989+#if defined(__cplusplus)
10990+extern "C" {
10991+#endif /* defined(__cplusplus) */
10992+ extern unsigned long tmosTimSleep(unsigned long ticks);
10993+ unsigned long gForcePlayerToStop = 0;
10994+#if defined(__cplusplus)
10995+}
10996+#endif /* defined(__cplusplus) */
10997+#endif
10998+
10999+#if defined (_MACINTOSH) || defined (_MAC_UNIX)
11000+bool gMacPlayerIsDone = false;
11001+#endif
11002+
11003+
11004+#if defined _VXWORKS
11005+#include "sys/times.h"
11006+#include "string.h"
11007+#include "hxtime.h"
11008+#endif
11009+
11010+#if defined(_MACINTOSH)
11011+#ifndef _MAC_MACHO
11012+#include <sioux.h>
11013+#include <console.h>
11014+#endif
11015+#endif
11016+
11017+#include "dllpath.h"
11018+
11019+#ifdef _SYMBIAN
11020+#include <e32svr.h>
11021+#include "platform/symbian/symbian_event_hndlr.h"
11022+#endif
11023+
11024+ENABLE_DLLACCESS_PATHS(g_SPlayAccessPath);
11025+
11026+// typedef for SetDLLAccessPath
11027+
11028+
11029+#include "thrdutil.h"
11030+
11031+#if defined(_AIX)
11032+#include <strings.h>
11033+#endif
11034+
11035+#if defined _DEBUG || defined DEBUG
11036+#include "debug.h"
11037+#endif
11038+
11039+#ifndef MAX_PATH
11040+#define MAX_PATH 256
11041+#endif //!MAX_PATH
11042+
11043+#if defined(HELIX_CONFIG_NOSTATICS)
11044+# include "globals/hxglobals.h"
11045+#endif
11046+
11047+#define MAX_NUM_URLS 10
11048+
11049+#include "globals.h" //for global struct.
11050+
11051+#include "player.h"
11052+
11053+#if defined(_WINDOWS) && defined(_STATICALLY_LINKED)
11054+HINSTANCE g_hInstance = NULL;
11055+#endif
11056+
11057+struct _stGlobals*& GetGlobal()
11058+{
11059+#if defined(HELIX_CONFIG_NOSTATICS)
11060+ static const struct _stGlobals* const _g_pstGlobals = NULL;
11061+ struct _stGlobals*& g_pstGlobals = (struct _stGlobals*&)HXGlobalPtr::Get(&_g_pstGlobals);
11062+#else
11063+ static struct _stGlobals* g_pstGlobals = NULL;
11064+#endif
11065+ if( g_pstGlobals == NULL )
11066+ {
11067+ g_pstGlobals = new struct _stGlobals();
11068+ }
11069+ return g_pstGlobals;
11070+
11071+}
11072+
11073+
11074+// Constants
11075+const int DEFAULT_TIME_DELTA = 2000;
11076+const int DEFAULT_STOP_TIME = -1;
11077+const int SLEEP_TIME = 5;
11078+const int GUID_LEN = 64;
11079+
11080+// Function prototypes
11081+void PrintUsage(const char* pszAppName);
11082+HXBOOL AllPlayersDone(int nNumPlayers, IHXPlayer** ppPlayers);
11083+void StopAllPlayers(int nNumPlayers, IHXPlayer** ppPlayers);
11084+HXBOOL ReadGUIDFile();
11085+char* GetAppName(char* pszArgv0);
11086+
11087+#ifdef __TCS__
11088+#if defined(__cplusplus)
11089+extern "C" {
11090+#endif /* defined(__cplusplus) */
11091+
11092+ extern void _alloc_stats(int verbose);
11093+#if defined(__cplusplus)
11094+}
11095+#endif /* defined(__cplusplus) */
11096+
11097+static IHXPlayer** g_Players;
11098+static int g_nPlayers = 0;
11099+static long evtCount = 0;
11100+static long evtFullCount = 0;
11101+#endif
11102+
11103+
11104+
11105+#if defined(HELIX_FEATURE_PRESENTATION_FEATURE_SELECTION)
11106+HX_RESULT
11107+DumpPFdata(IHXPresentationFeatureManager* pPFMgr,
11108+ const char* pszPFName)
11109+{
11110+ HX_RESULT hxr = HXR_OK;
11111+
11112+ IHXBuffer* pFeatureCurrentSetting = NULL;
11113+ IHXValues* pFeatureOptions = NULL;
11114+
11115+ if (!pPFMgr || !pszPFName)
11116+ {
11117+ hxr = HXR_INVALID_PARAMETER;
11118+ }
11119+ else
11120+ {
11121+ // List all the options for this PF:
11122+ HX_RESULT hxr = pPFMgr->GetPresentationFeature(
11123+ pszPFName,
11124+ pFeatureCurrentSetting,
11125+ pFeatureOptions);
11126+
11127+ if (FAILED(hxr))
11128+ {
11129+ // PF doesn't exist!
11130+ STDOUT("\t%s - No such presentation feature\n\n", pszPFName);
11131+ }
11132+ else
11133+ {
11134+ // Now, go through pFeatureOptions and display
11135+ // them and their "is-selectable"-flag values:
11136+ const char* pszPFOptionName = NULL;
11137+ const char* pszPFCurSetting = pFeatureCurrentSetting?
11138+ (const char*)pFeatureCurrentSetting->GetBuffer() : NULL;
11139+ UINT32 bPFOptionIsSelectableFlag = FALSE;
11140+ IHXBuffer* pPFOptionIsSelectableFlag = NULL;
11141+
11142+ HX_ASSERT(pszPFCurSetting);
11143+ STDOUT("\t%s\t(Current setting == \"%s\")\n", pszPFName, pszPFCurSetting?
11144+ pszPFCurSetting : "<ERROR: THIS PF HAS NO CURRENT SETTING!>");
11145+
11146+ if (!pFeatureOptions) // NULL is OK; that means freeform (open-ended):
11147+ {
11148+ STDOUT("\t\t(%s's options are freeform, i.e., open-ended)\n",
11149+ pszPFName);
11150+ }
11151+ else // List all the options and their flags:
11152+ {
11153+ if (HXR_OK == pFeatureOptions->GetFirstPropertyCString(pszPFOptionName,
11154+ pPFOptionIsSelectableFlag) && *pszPFOptionName)
11155+ {
11156+ do
11157+ {
11158+ const UCHAR* pIsSelFlag = pPFOptionIsSelectableFlag->GetBuffer();
11159+ if (pIsSelFlag && *pIsSelFlag)
11160+ {
11161+ // Anything but '0' (zero) is treated as '1' (is selectable):
11162+ bPFOptionIsSelectableFlag = (HXBOOL)('0' != *pIsSelFlag &&
11163+ '\0' == *(pIsSelFlag+1));
11164+ }
11165+ else
11166+ {
11167+ // Set the error, but we'll go ahead and treat it as '0':
11168+ hxr = HXR_INVALID_PARAMETER;
11169+ bPFOptionIsSelectableFlag = FALSE;
11170+ }
11171+
11172+ STDOUT("\t\t%s\t\tIs selectable: %s\n",
11173+ pszPFOptionName, bPFOptionIsSelectableFlag? "yes":"no");
11174+ // Release it to get the next PF:
11175+ HX_RELEASE(pPFOptionIsSelectableFlag);
11176+ } while (HXR_OK == pFeatureOptions->GetNextPropertyCString(
11177+ pszPFOptionName, pPFOptionIsSelectableFlag));
11178+ }
11179+ }
11180+
11181+ HX_RELEASE(pPFOptionIsSelectableFlag);
11182+ }
11183+ }
11184+
11185+ HX_RELEASE(pFeatureCurrentSetting);
11186+ HX_RELEASE(pFeatureOptions);
11187+
11188+ return hxr;
11189+}
11190+#endif // HELIX_FEATURE_PRESENTATION_FEATURE_SELECTION.
11191+
11192+
11193+char* RemoveWrappingQuotes(char* str)
11194+{
11195+ int len = strlen(str);
11196+ if (len > 0)
11197+ {
11198+ if (str[len-1] == '"') str[--len] = 0;
11199+ if (str[0] == '"') { int i = 0; do { str[i++] = str[i+1]; } while(--len); }
11200+ }
11201+ return str;
11202+}
11203+
11204+void *kickman(void *dummy)
11205+{
11206+ while(1) {
11207+ UINT32 sleepTime = 0;
11208+ IHXMediaPlatformKicker* pKicker = GetGlobal()->g_pIHXKicker;
11209+ if( pKicker )
11210+ {
11211+ pKicker->Kick(GetGlobal()->g_uThreadIDForKicker, &sleepTime);
11212+ }
11213+ usleep(sleepTime);
11214+ }
11215+}
11216+
11217+PLAYER_API int init_main( )
11218+{
11219+#if defined(_WIN32) && !defined(WIN32_PLATFORM_PSPC)
11220+ setvbuf(stdout, NULL, _IONBF, 0);
11221+#endif /* defined(_WIN32) && !defined(WIN32_PLATFORM_PSPC) */
11222+
11223+ FPHXMEDIAPLATFORMOPEN fpHXMediaPlatformOpen = NULL;
11224+ FPHXCREATEMEDIAPLATFORM fpHXCreateMediaPlatform = NULL;
11225+ FPHXMEDIAPLATFORMCLOSE fpHXMediaPlatformClose = NULL;
11226+
11227+ FPRMCREATEENGINE fpCreateEngine = NULL;
11228+ FPRMCLOSEENGINE fpCloseEngine = NULL;
11229+ FPRMSETDLLACCESSPATH fpSetDll = NULL;
11230+
11231+ HX_RESULT theErr = HXR_OK;
11232+ ExampleClientContext** ppExContexts = NULL;
11233+#if defined(HELIX_FEATURE_AUTO_BANDWIDTH_DETECTION) && defined(_WIN32)
11234+ ExampleABD* pABD = NULL;
11235+#endif
11236+ IHXPlayer** ppPlayers = NULL;
11237+ IHXQuickSeek* ppQuickSeek = NULL;
11238+ IHXErrorSink* pErrorSink = NULL;
11239+ IHXErrorSinkControl* pErrorSinkControl = NULL;
11240+ UINT32 ulABDResult = 0;
11241+ UINT32 ulProbPktSize = 0;
11242+ UINT32 ulProbPktNum = 0;
11243+#if defined(HELIX_FEATURE_PLAYBACK_VELOCITY)
11244+ INT32 lVelocity = 100;
11245+ INT32 lKeyFrameMode = 0;
11246+ INT32 lAutoSwitch = 0;
11247+#endif /* #if defined(HELIX_FEATURE_PLAYBACK_VELOCITY) */
11248+ CHXString* pABDServer = NULL;
11249+ char* pszURL[MAX_NUM_URLS];
11250+ char* pszURLOrig[MAX_NUM_URLS];
11251+ UINT32 ulNumURLsFound = 0;
11252+ int nNumPlayers = 1;
11253+ int nNumPlayRepeats = 1;
11254+ int nTimeDelta = DEFAULT_TIME_DELTA;
11255+ int nStopTime = DEFAULT_STOP_TIME;
11256+ bool bStopTime = true;
11257+ int i = 0;
11258+ char* pszGUIDList = NULL;
11259+#ifdef _MACINTOSH
11260+ char dllhome[MAX_PATH] = {'\0'}; /* Flawfinder: ignore */
11261+#elif defined(_SYMBIAN)
11262+ char dllhome[MAX_PATH] = "c:"; /* Flawfinder: ignore */
11263+#else
11264+ char dllhome[MAX_PATH] = {'.','\0'}; /* Flawfinder: ignore */
11265+#endif
11266+ DLLAccess* pDLLAccess = NULL;
11267+ char staticLibPath[MAX_PATH] = {0}; /* Flawfinder: ignore */
11268+#ifdef _WINDOWS
11269+ HINSTANCE hDll = NULL;
11270+#endif
11271+ bool bStopping = false;
11272+ int nPlay = 0;
11273+
11274+ // NULL out the URL arrays
11275+ memset(pszURL, 0, MAX_NUM_URLS * sizeof(char*));
11276+ memset(pszURLOrig, 0, MAX_NUM_URLS * sizeof(char*));
11277+
11278+
11279+ //See if the user has set their HELIX_LIBS env var. This is overridden by the
11280+ //-l option.
11281+ const char* pszHelixLibs = getenv("HELIX_LIBS");
11282+ if( pszHelixLibs )
11283+ SafeStrCpy( dllhome, pszHelixLibs, MAX_PATH);
11284+
11285+
11286+
11287+ GetGlobal()->bEnableAdviceSink = TRUE;
11288+ GetGlobal()->g_prefList.Add("UseOverlay", "0");
11289+
11290+ SafeSprintf(staticLibPath, MAX_PATH, "%s/%s", dllhome, "hxmedpltfm.so");
11291+
11292+ if (dllhome)
11293+ {
11294+ GetDLLAccessPath()->SetPath(DLLTYPE_COMMON, dllhome);
11295+ GetDLLAccessPath()->SetPath(DLLTYPE_PLUGIN, dllhome);
11296+ GetDLLAccessPath()->SetPath(DLLTYPE_CODEC, dllhome);
11297+ }
11298+
11299+ // initialize the globals
11300+ GetGlobal()->m_fpCreateEngine = NULL;
11301+ GetGlobal()->m_fpCloseEngine = NULL;
11302+ GetGlobal()->g_nPlayers = 0;
11303+
11304+ // prepare/load the HXCore module
11305+ pDLLAccess = new DLLAccess();
11306+
11307+ STDOUT("Simpleplayer is looking for the client core at %s\n", staticLibPath );
11308+
11309+ if (DLLAccess::DLL_OK != pDLLAccess->open(staticLibPath))
11310+ {
11311+ const char* pErrorString = NULL;
11312+ pErrorString = pDLLAccess->getErrorString();
11313+ STDERR("splayer: %s\n\n", pErrorString);
11314+#ifndef _STATICALLY_LINKED
11315+#ifndef _MACINTOSH
11316+ //Make sure the user has told us where to find the DLLs at. Either
11317+ //with the -l option or with the HELIX_LIBS env var.
11318+ STDERR("You must tell the player where to find the client core and\n");
11319+ STDERR("all of its supporting DLLs and codecs. Please use the -l\n");
11320+ STDERR("option or set your HELIX_LIBS env variable to point the player.\n");
11321+ STDERR("to where you have all of the DLLs installed.\n\n" );
11322+ //PrintUsage(argv[0]);
11323+#endif
11324+#endif
11325+ goto cleanup;
11326+ }
11327+
11328+ GetGlobal()->m_fpHXMediaPlatformOpen = (FPHXMEDIAPLATFORMOPEN) pDLLAccess->getSymbol("HXMediaPlatformOpen");
11329+ GetGlobal()->m_fpHXCreateMediaPlatform = (FPHXCREATEMEDIAPLATFORM) pDLLAccess->getSymbol("HXCreateMediaPlatform");
11330+ GetGlobal()->m_fpHXMediaPlatformClose = (FPHXMEDIAPLATFORMCLOSE) pDLLAccess->getSymbol("HXMediaPlatformClose");
11331+
11332+ GetGlobal()->m_fpCreateEngine = (FPRMCREATEENGINE) pDLLAccess->getSymbol("CreateEngine");
11333+ GetGlobal()->m_fpCloseEngine = (FPRMCLOSEENGINE) pDLLAccess->getSymbol("CloseEngine");
11334+ GetGlobal()->m_fpSetDLLAccessPath = (FPRMSETDLLACCESSPATH) pDLLAccess->getSymbol("SetDLLAccessPath");
11335+
11336+ if (GetGlobal()->m_fpHXMediaPlatformOpen == NULL ||
11337+ GetGlobal()->m_fpHXCreateMediaPlatform == NULL ||
11338+ GetGlobal()->m_fpHXMediaPlatformClose == NULL ||
11339+ GetGlobal()->m_fpCreateEngine == NULL ||
11340+ GetGlobal()->m_fpCloseEngine == NULL ||
11341+ GetGlobal()->m_fpSetDLLAccessPath == NULL )
11342+ {
11343+ theErr = HXR_FAILED;
11344+ goto cleanup;
11345+ }
11346+
11347+#if defined(USE_XWINDOWS) && defined(HELIX_FEATURE_VIDEO)
11348+ XInitThreads();
11349+#endif
11350+
11351+ {
11352+ fpHXMediaPlatformOpen = GetGlobal()->m_fpHXMediaPlatformOpen;
11353+ fpHXCreateMediaPlatform = GetGlobal()->m_fpHXCreateMediaPlatform;
11354+ fpHXMediaPlatformClose = GetGlobal()->m_fpHXMediaPlatformClose;
11355+
11356+ if (HXR_OK != fpHXMediaPlatformOpen())
11357+ {
11358+ theErr = HXR_FAILED;
11359+ goto cleanup;
11360+ }
11361+
11362+ if (HXR_OK != fpHXCreateMediaPlatform((IHXMediaPlatform**)&GetGlobal()->pMediaPlatform))
11363+ {
11364+ theErr = HXR_FAILED;
11365+ goto cleanup;
11366+ }
11367+
11368+ IHXMediaPlatform* pMediaPlatform = GetGlobal()->pMediaPlatform;
11369+
11370+
11371+ if (HXR_OK != pMediaPlatform->AddPluginPath("HelixSimplePlayer", dllhome))
11372+ {
11373+ theErr = HXR_FAILED;
11374+ goto cleanup;
11375+ }
11376+
11377+ if (HXR_OK != pMediaPlatform->Init(NULL))
11378+ {
11379+ theErr = HXR_FAILED;
11380+ goto cleanup;
11381+ }
11382+
11383+ IHXCommonClassFactory* pCCF = NULL;
11384+ if (HXR_OK != pMediaPlatform->QueryInterface(IID_IHXCommonClassFactory,
11385+ (void**)&pCCF))
11386+ {
11387+ theErr = HXR_FAILED;
11388+ goto cleanup;
11389+ }
11390+
11391+ if (HXR_OK != pCCF->CreateInstance(CLSID_IHXClientEngine, (void**)&GetGlobal()->pEngine))
11392+ {
11393+ HX_RELEASE(pCCF);
11394+ theErr = HXR_FAILED;
11395+ goto cleanup;
11396+ }
11397+
11398+ HX_RELEASE(pCCF);
11399+
11400+ IHXMediaPlatformKicker* pKicker = NULL;
11401+ pMediaPlatform->QueryInterface(IID_IHXMediaPlatformKicker, (void**)&pKicker);
11402+ HX_ASSERT(pKicker);
11403+ GetGlobal()->g_pIHXKicker = pKicker;
11404+ GetGlobal()->g_uThreadIDForKicker = HXGetCurrentThreadID();
11405+
11406+ pthread_t thread_id;
11407+ pthread_create(&thread_id, NULL, kickman, NULL);
11408+ GetGlobal()->g_pThreadKickmanId = thread_id;
11409+ }
11410+
11411+
11412+
11413+ {
11414+
11415+
11416+#if defined(_WIN32) && !defined(WIN32_PLATFORM_PSPC)
11417+ SetConsoleCtrlHandler((PHANDLER_ROUTINE)HandlerRoutine,
11418+ TRUE);
11419+#endif
11420+
11421+ }
11422+
11423+ return HXR_OK;
11424+
11425+ cleanup:
11426+ deinit_main();
11427+ return HXR_FAIL;
11428+}
11429+
11430+/* Get the least index to available entry in Getglobal()->gPlayers */
11431+static int get_index()
11432+{
11433+ int i;
11434+ /* an simple implementation */
11435+ for (i = 0; i < MAX_NUM_PLAYERS; i++)
11436+ {
11437+ if (GetGlobal()->g_Players[i] == NULL)
11438+ return i;
11439+ }
11440+
11441+ return -1;
11442+}
11443+
11444+PLAYER_API unsigned int get_curr_playtime(void *pPlayerHandle)
11445+{
11446+ unsigned int time = 0;
11447+ IHXPlayer *pPlayer = (IHXPlayer *)pPlayerHandle;
11448+ if (pPlayer)
11449+ time = pPlayer->GetCurrentPlayTime();
11450+ return time;
11451+}
11452+
11453+PLAYER_API int get_player(void **ppPlayerHandle, on_buffering_cb_t on_buffering_cb, on_pos_length_cb_t on_pos_length_cb, on_state_change_cb_t on_state_change_cb, on_new_frame_cb_t on_new_frame_cb, void *context)
11454+{
11455+ int index = get_index();
11456+ IHXPlayer **ppPlayer = (IHXPlayer **)ppPlayerHandle;
11457+ ExampleClientContext* pExContext = NULL;
11458+ pExContext = new ExampleClientContext(index);
11459+ if (!pExContext)
11460+ {
11461+ return HXR_UNEXPECTED;
11462+ }
11463+ pExContext->AddRef();
11464+
11465+ ppPlayer[0] = NULL;
11466+ IHXClientEngine* pEngine = GetGlobal()->pEngine;
11467+ if (HXR_OK != pEngine->CreatePlayer(*ppPlayer))
11468+ {
11469+ HX_RELEASE(pExContext);
11470+ return HXR_FAILED;
11471+ }
11472+#if 1
11473+ char* pszGUIDList = NULL;
11474+ //initialize the example context
11475+ pszGUIDList = GetGlobal()->g_pszGUIDList;
11476+ {
11477+ char pszGUID[GUID_LEN + 1]; /* Flawfinder: ignore */ // add 1 for terminator
11478+ char* token = NULL;
11479+ IHXPreferences* pPreferences = NULL;
11480+
11481+ pszGUID[0] = '\0';
11482+
11483+ if (pszGUIDList)
11484+ {
11485+ // Get next GUID from the GUID list
11486+ {
11487+ token = strtok(pszGUIDList, "\n\0");
11488+ }
11489+ if (token)
11490+ {
11491+ strncpy(pszGUID, token, GUID_LEN); /* Flawfinder: ignore */
11492+ pszGUID[GUID_LEN] = '\0';
11493+ }
11494+ }
11495+
11496+ ppPlayer[0]->QueryInterface(IID_IHXPreferences,
11497+ (void**) &pPreferences);
11498+
11499+ pExContext->Init(ppPlayer[0], pPreferences, pszGUID, on_buffering_cb, on_pos_length_cb, on_state_change_cb, on_new_frame_cb, context);
11500+
11501+ ppPlayer[0]->SetClientContext(pExContext);
11502+
11503+ HX_RELEASE(pPreferences);
11504+
11505+ IHXErrorSinkControl* pErrorSinkControl = NULL;
11506+ ppPlayer[0]->QueryInterface(IID_IHXErrorSinkControl,
11507+ (void**) &pErrorSinkControl);
11508+
11509+ if (pErrorSinkControl)
11510+ {
11511+ IHXErrorSink* pErrorSink = NULL;
11512+ pExContext->QueryInterface(IID_IHXErrorSink,
11513+ (void**) &pErrorSink);
11514+ if (pErrorSink)
11515+ {
11516+ pErrorSinkControl->AddErrorSink(pErrorSink, HXLOG_EMERG, HXLOG_INFO);
11517+ }
11518+ HX_RELEASE(pErrorSink);
11519+ }
11520+ HX_RELEASE(pErrorSinkControl);
11521+ GetGlobal()->g_prefList.SetPreferences(ppPlayer[0]);
11522+
11523+ }
11524+#endif
11525+ HX_ASSERT(GetGlobal()->g_nPlayers < MAX_NUM_PLAYERS);
11526+ GetGlobal()->g_Players[index] = ppPlayer[0];
11527+ GetGlobal()->g_pClientContexts[index] = pExContext;
11528+ GetGlobal()->g_nPlayers++;
11529+
11530+ return HXR_OK;
11531+}
11532+
11533+static int get_index_by_player( IHXPlayer *pPlayer)
11534+{
11535+ int i;
11536+ /* an simple implementation */
11537+ for (i = 0; i < MAX_NUM_PLAYERS; i++)
11538+ {
11539+ if (GetGlobal()->g_Players[i] && GetGlobal()->g_Players[i] == pPlayer)
11540+ return i;
11541+ }
11542+
11543+ return -1;
11544+}
11545+
11546+PLAYER_API int player_openurl( void *pPlayerHandle, char *pszRawURL)
11547+{
11548+ HX_RESULT ret;
11549+ IHXPlayer *pPlayer = (IHXPlayer *)pPlayerHandle;
11550+ int index = get_index_by_player(pPlayer);
11551+ if (index < 0)
11552+ return HXR_FAIL;
11553+
11554+ char *pszURLOrig = RemoveWrappingQuotes(pszRawURL);
11555+
11556+ //if no "://" was found lets add file:// by default so that you
11557+ //can refer to local content as just ./splay ~/Content/startrek.rm,
11558+ //for example, and not ./splay file:///home/gregory/Content/startrek.rm
11559+ char* pszAddOn = NULL;
11560+ if( strstr( pszURLOrig, "://") )
11561+ pszAddOn = (char *)"";
11562+ else
11563+ pszAddOn = (char *)"file://";
11564+
11565+ char *pszURL = new char[strlen(pszURLOrig)+strlen(pszAddOn)+1];
11566+ sprintf( pszURL, "%s%s", pszAddOn, pszURLOrig ); /* Flawfinder: ignore */
11567+ // Increment the number of URLs we have found
11568+ STDERR("opening %s on player\n", pszURL);
11569+
11570+ GetGlobal()->g_pszURLs[index] = pszURL;
11571+ ret = pPlayer->OpenURL(pszURL);
11572+
11573+ UINT32 sleepTime = 0;
11574+
11575+ IHXMediaPlatformKicker* pKicker = GetGlobal()->g_pIHXKicker;
11576+ if( pKicker )
11577+ {
11578+ pKicker->Kick(HXGetCurrentThreadID(), &sleepTime);
11579+ }
11580+
11581+ return ret;
11582+}
11583+
11584+PLAYER_API int put_player( void *pPlayerHandle)
11585+{
11586+ IHXPlayer *pPlayer = (IHXPlayer *)pPlayerHandle;
11587+ int index;
11588+ index = get_index_by_player(pPlayer);
11589+ if (index < 0)
11590+ return HXR_FAIL;
11591+
11592+ ExampleClientContext *pClientContext = GetGlobal()->g_pClientContexts[index];
11593+ if (pClientContext) {
11594+ pClientContext->Release();
11595+ pClientContext = NULL;
11596+ }
11597+
11598+ GetGlobal()->g_pClientContexts[index] = NULL;
11599+ if (pPlayer) {
11600+ if (GetGlobal()->pEngine) {
11601+ GetGlobal()->pEngine->ClosePlayer(pPlayer);
11602+ }
11603+ pPlayer->Release();
11604+ pPlayer = NULL;
11605+ }
11606+ GetGlobal()->g_Players[index] = NULL;
11607+ GetGlobal()->g_nPlayers--;
11608+ delete [] GetGlobal()->g_pszURLs[index];
11609+ GetGlobal()->g_pszURLs[index] = NULL;
11610+
11611+ return HXR_OK;
11612+}
11613+
11614+PLAYER_API int player_geturl( void *pPlayerHandle, char **pszURL)
11615+{
11616+ IHXPlayer *pPlayer = (IHXPlayer *)pPlayerHandle;
11617+ int index = get_index_by_player(pPlayer);
11618+ if (index >= 0) {
11619+ *pszURL = GetGlobal()->g_pszURLs[index];
11620+ return HXR_OK;
11621+ }
11622+
11623+ return HXR_FAIL;
11624+}
11625+
11626+PLAYER_API int player_begin( void *pPlayerHandle )
11627+{
11628+ IHXPlayer *pPlayer = (IHXPlayer *)pPlayerHandle;
11629+ UINT32 sleepTime = 0;
11630+ pPlayer->Begin();
11631+
11632+#if 0
11633+ IHXMediaPlatformKicker* pKicker = GetGlobal()->g_pIHXKicker;
11634+ if( pKicker )
11635+ {
11636+ pKicker->Kick(HXGetCurrentThreadID(), &sleepTime);
11637+ }
11638+#endif
11639+ return HXR_OK;
11640+}
11641+
11642+PLAYER_API int player_pause( void *pPlayerHandle )
11643+{
11644+ IHXPlayer *pPlayer = (IHXPlayer *)pPlayerHandle;
11645+ UINT32 sleepTime = 0;
11646+ pPlayer->Pause();
11647+
11648+#if 0
11649+ IHXMediaPlatformKicker* pKicker = GetGlobal()->g_pIHXKicker;
11650+ if( pKicker )
11651+ {
11652+ pKicker->Kick(HXGetCurrentThreadID(), &sleepTime);
11653+ }
11654+#endif
11655+ return HXR_OK;
11656+}
11657+
11658+PLAYER_API int player_stop( void *pPlayerHandle )
11659+{
11660+ IHXPlayer *pPlayer = (IHXPlayer *)pPlayerHandle;
11661+ pPlayer->Stop();
11662+ return HXR_OK;
11663+}
11664+
11665+#if 0
11666+int main(int argc, char *argv[])
11667+{
11668+ IHXPlayer *pPlayer;
11669+ init_main();
11670+ while(1) {
11671+ get_player(&pPlayer);
11672+ player_openurl(pPlayer, argv[1]);
11673+ player_begin(pPlayer);
11674+ // sleep(2);
11675+ player_stop(pPlayer);
11676+ put_player(pPlayer);
11677+ }
11678+ deinit_main();
11679+ return 0;
11680+}
11681+#endif
11682+
11683+PLAYER_API int player_seek(void *pPlayerHandle, int pos)
11684+{
11685+ IHXPlayer *pPlayer = (IHXPlayer *)pPlayerHandle;
11686+ if (pPlayer == NULL)
11687+ return HXR_FAIL;
11688+
11689+ return pPlayer->Seek(pos);
11690+}
11691+PLAYER_API int player_getvolume(void *pPlayerHandle)
11692+{
11693+ IHXPlayer *pPlayer = (IHXPlayer *)pPlayerHandle;
11694+ if (pPlayer == NULL)
11695+ return HXR_FAIL;
11696+
11697+ int volume = 0;
11698+
11699+ IHXAudioPlayer* pAudioPlayer = NULL;
11700+ pPlayer->QueryInterface(IID_IHXAudioPlayer, (void**) &pAudioPlayer);
11701+ if (pAudioPlayer)
11702+ {
11703+ // Get the IHXVolume
11704+ IHXVolume* pVolume = pAudioPlayer->GetAudioVolume();
11705+ if (pVolume)
11706+ {
11707+ volume = pVolume->GetVolume();
11708+ }
11709+ HX_RELEASE(pVolume);
11710+ }
11711+ HX_RELEASE(pAudioPlayer);
11712+
11713+ return volume;
11714+}
11715+
11716+
11717+PLAYER_API int player_setvolume(void *pPlayerHandle, unsigned short volume)
11718+{
11719+ IHXPlayer *pPlayer = (IHXPlayer *)pPlayerHandle;
11720+ if (pPlayer == NULL)
11721+ return HXR_FAIL;
11722+
11723+ IHXAudioPlayer* pAudioPlayer = NULL;
11724+ pPlayer->QueryInterface(IID_IHXAudioPlayer, (void**) &pAudioPlayer);
11725+ if (pAudioPlayer)
11726+ {
11727+ // Get the IHXVolume
11728+ IHXVolume* pVolume = pAudioPlayer->GetAudioVolume();
11729+ if (pVolume)
11730+ {
11731+ pVolume->SetVolume(volume);
11732+ }
11733+ HX_RELEASE(pVolume);
11734+ }
11735+ HX_RELEASE(pAudioPlayer);
11736+}
11737+
11738+PLAYER_API int deinit_main()
11739+{
11740+
11741+ pthread_cancel(GetGlobal()->g_pThreadKickmanId);
11742+ int ret ;
11743+ ret = pthread_join(GetGlobal()->g_pThreadKickmanId, NULL);
11744+ if (ret < 0) {
11745+ perror("pthread_join error\n");
11746+ }
11747+#if defined(HELIX_FEATURE_PLAYBACK_VELOCITY)
11748+ if (GetGlobal()->g_pVelocityCaps)
11749+ {
11750+ IHXPlaybackVelocityCaps* pCaps = GetGlobal()->g_pVelocityCaps;
11751+ pCaps->Release();
11752+ GetGlobal()->g_pVelocityCaps = NULL;
11753+ }
11754+#endif /* #if defined(HELIX_FEATURE_PLAYBACK_VELOCITY) */
11755+
11756+#ifdef __TCS__
11757+ g_nPlayers = 0;
11758+#endif
11759+
11760+
11761+ {
11762+ IHXClientEngine* pEngine = GetGlobal()->pEngine;
11763+
11764+ if (pEngine)
11765+ {
11766+ IHXClientEngine2* pEngine2 = NULL;
11767+ if (HXR_OK == pEngine->QueryInterface(IID_IHXClientEngine2,
11768+ (void**)&pEngine2))
11769+ {
11770+ pEngine2->Close();
11771+ }
11772+ HX_RELEASE(pEngine2);
11773+ }
11774+ HX_RELEASE(GetGlobal()->pEngine);
11775+ HX_RELEASE(GetGlobal()->g_pIHXKicker);
11776+
11777+ if (GetGlobal()->pMediaPlatform)
11778+ {
11779+ // Reset() not only close the platform but also remove all
11780+ // persistent information(i.e. preferences) maintained by the
11781+ // platform
11782+ // GetGlobal()->pMediaPlatform->Reset(NULL);
11783+ GetGlobal()->pMediaPlatform->Close();
11784+ HX_RELEASE(GetGlobal()->pMediaPlatform);
11785+ }
11786+
11787+ if (GetGlobal()->m_fpHXMediaPlatformClose)
11788+ {
11789+ GetGlobal()->m_fpHXMediaPlatformClose();
11790+ }
11791+ }
11792+
11793+
11794+ if (GetGlobal()->bEnableVerboseMode)
11795+ {
11796+ STDOUT("\nDone.\n");
11797+ }
11798+
11799+ if (GetGlobal()->g_pszUsername)
11800+ {
11801+ delete [] GetGlobal()->g_pszUsername;
11802+ GetGlobal()->g_pszUsername = NULL;
11803+ }
11804+ if (GetGlobal()->g_pszPassword)
11805+ {
11806+ delete [] GetGlobal()->g_pszPassword;
11807+ GetGlobal()->g_pszPassword = NULL;
11808+ }
11809+ if (GetGlobal()->g_pszGUIDFile)
11810+ {
11811+ delete [] GetGlobal()->g_pszGUIDFile;
11812+ GetGlobal()->g_pszGUIDFile = NULL;
11813+ }
11814+ if (GetGlobal()->g_pszGUIDList)
11815+ {
11816+ delete [] GetGlobal()->g_pszGUIDList;
11817+ GetGlobal()->g_pszGUIDList = NULL;
11818+ }
11819+ // If an error occurred during playback, return that
11820+
11821+ if (GetGlobal()->g_Error != HXR_OK)
11822+ {
11823+ return GetGlobal()->g_Error;
11824+ }
11825+ // or HXR_OK (if there was more than one player)
11826+ else
11827+ {
11828+ return HXR_OK;
11829+ }
11830+}
11831+char* GetAppName(char* pszArgv0)
11832+{
11833+ char* pszAppName;
11834+
11835+ pszAppName = strrchr(pszArgv0, '\\');
11836+
11837+ if (NULL == pszAppName)
11838+ {
11839+ return pszArgv0;
11840+ }
11841+ else
11842+ {
11843+ return pszAppName + 1;
11844+ }
11845+}
11846+
11847+void PrintUsage(const char* pszAppName)
11848+{
11849+}
11850+
11851+
11852+
11853+HXBOOL ReadGUIDFile()
11854+{
11855+ HXBOOL bSuccess = FALSE;
11856+ FILE* pFile = NULL;
11857+ int nNumRead = 0;
11858+ int readSize = 10000;
11859+ char* pszBuffer = new char[readSize];
11860+
11861+ if (GetGlobal()->g_pszGUIDFile)
11862+ {
11863+ if((pFile = fopen(GetGlobal()->g_pszGUIDFile, "r")) != NULL)
11864+ {
11865+ // Read in the entire file
11866+ nNumRead = fread(pszBuffer, sizeof(char), readSize, pFile);
11867+ pszBuffer[nNumRead] = '\0';
11868+
11869+ // Store it for later parsing
11870+ GetGlobal()->g_pszGUIDList = new char[nNumRead + 1];
11871+ strcpy(GetGlobal()->g_pszGUIDList, pszBuffer); /* Flawfinder: ignore */
11872+
11873+ fclose(pFile);
11874+ pFile = NULL;
11875+
11876+ if (nNumRead > 0)
11877+ {
11878+ bSuccess = TRUE;
11879+ }
11880+ }
11881+ }
11882+
11883+ delete [] pszBuffer;
11884+
11885+ return bSuccess;
11886+}
11887+
11888+static int are_all_src_seekable(IHXPlayer *pPlayer)
11889+{
11890+ UINT16 nSrcCnt;
11891+ nSrcCnt = pPlayer->GetSourceCount();
11892+ HXSource *pSource = NULL; /* This is brute-force */
11893+ for (UINT16 i = 0; i < nSrcCnt; i++)
11894+ {
11895+ if (pPlayer->GetSource(i, (IUnknown *&)pSource) == HXR_OK)
11896+ {
11897+ if (!pSource->IsSeekable())
11898+ return FALSE;
11899+
11900+
11901+ }
11902+ }
11903+
11904+}
11905+
11906+PLAYER_API int player_canseek(void *pPlayerHandle)
11907+{
11908+ if (!pPlayerHandle)
11909+ return FALSE;
11910+
11911+ IHXPlayer *pPlayer = (IHXPlayer *)pPlayerHandle;
11912+ ExampleClientContext* pExContext=NULL;
11913+ if (pPlayer->GetClientContext((IUnknown*&)pExContext) != HXR_OK)
11914+ return FALSE;
11915+
11916+ if (!pExContext)
11917+ return FALSE;
11918+
11919+ EHXClientState State = pExContext->GetState();
11920+
11921+ int all_src_seekable = are_all_src_seekable(pPlayer);
11922+
11923+ HX_RELEASE(pExContext);
11924+
11925+ if (State < HX_CLIENT_STATE_CONNECTED)
11926+ return TRUE;
11927+
11928+ if (all_src_seekable && (!pPlayer->IsLive() || State == HX_CLIENT_STATE_PAUSED))
11929+ return TRUE;
11930+
11931+ return FALSE;
11932+}
11933+
11934+
11935Index: helix-libs/clientapps/clutter/player.h
11936===================================================================
11937--- /dev/null 1970-01-01 00:00:00.000000000 +0000
11938+++ helix-libs/clientapps/clutter/player.h 2008-10-13 06:54:45.000000000 -0700
11939@@ -0,0 +1,60 @@
11940+#ifndef _PLAYER_H_
11941+#define _PLAYER_H_
11942+
11943+#ifdef __cplusplus
11944+#define PLAYER_API extern "C"
11945+#else
11946+#define PLAYER_API
11947+#endif
11948+
11949+/* Duplicate of EHXClientState */
11950+typedef enum _EPlayerStateState
11951+{
11952+ PLAYER_STATE_READY = 0, // uninitialized
11953+ PLAYER_STATE_CONNECTING, // attempting to connect to sources
11954+ PLAYER_STATE_CONNECTED, // connected to sources (realized)
11955+ PLAYER_STATE_OPENING, // opening sources
11956+ PLAYER_STATE_OPENED, // opened sources
11957+ PLAYER_STATE_PREFETCHING,// obtaining resources, buffering, etc.
11958+ PLAYER_STATE_PREFETCHED, // ready for playback at time zero
11959+ PLAYER_STATE_PLAYING, // currently playing
11960+ PLAYER_STATE_PAUSED, // paused
11961+ PLAYER_STATE_SEEKING // seeking
11962+} EHXPlayerState;
11963+
11964+typedef struct {
11965+ int left;
11966+ int top;
11967+ int right;
11968+ int bottom;
11969+} PlayerRect;
11970+
11971+typedef struct {
11972+ PlayerRect Rect;
11973+ unsigned int cx;
11974+ unsigned int cy;
11975+} PlayerImgInfo;
11976+
11977+typedef void (*on_pos_length_cb_t)(unsigned int, unsigned int, void *);
11978+typedef void (*on_buffering_cb_t)(unsigned int, unsigned short, void *);
11979+typedef void (*on_state_change_cb_t)(unsigned short, unsigned short, void *);
11980+typedef void (*on_new_frame_cb_t)(unsigned char *p, unsigned int size, PlayerImgInfo *rect, void *context);
11981+
11982+PLAYER_API int init_main();
11983+PLAYER_API int deinit_main();
11984+PLAYER_API int get_player(void **ppPlayerHandle, on_buffering_cb_t on_buffering_cb, on_pos_length_cb_t on_pos_length_cb, on_state_change_cb_t on_state_change_cb, on_new_frame_cb_t on_new_frame_cb, void *context);
11985+PLAYER_API int player_openurl( void *pPlayerHandle, char *pszRawURL);
11986+PLAYER_API int put_player( void *pPlayerHandle);
11987+PLAYER_API int player_geturl( void *pPlayerHandle, char **pszURL);
11988+PLAYER_API int player_begin( void *pPlayerHandle );
11989+PLAYER_API int player_stop( void *pPlayerHandle );
11990+PLAYER_API int player_pause( void *pPlayerHandle );
11991+PLAYER_API unsigned int get_curr_playtime(void *pPlayerHandle);
11992+PLAYER_API int player_seek(void *pPlayerHandle, int pos);
11993+PLAYER_API int player_getvolume(void *pPlayerHandle);
11994+PLAYER_API int player_setvolume(void *pPlayerHandle, unsigned short volumn);
11995+PLAYER_API int player_canseek(void *pPlayerHandle);
11996+
11997+
11998+#endif
11999+
12000Index: helix-libs/clientapps/clutter/preflist.cpp
12001===================================================================
12002--- /dev/null 1970-01-01 00:00:00.000000000 +0000
12003+++ helix-libs/clientapps/clutter/preflist.cpp 2008-10-13 06:05:49.000000000 -0700
12004@@ -0,0 +1,142 @@
12005+/* ***** BEGIN LICENSE BLOCK *****
12006+ * Source last modified: $Id: preflist.cpp,v 1.2 2007/07/06 20:32:36 jfinnecy Exp $
12007+ *
12008+ * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
12009+ *
12010+ * The contents of this file, and the files included with this file,
12011+ * are subject to the current version of the RealNetworks Public
12012+ * Source License (the "RPSL") available at
12013+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
12014+ * the file under the current version of the RealNetworks Community
12015+ * Source License (the "RCSL") available at
12016+ * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
12017+ * will apply. You may also obtain the license terms directly from
12018+ * RealNetworks. You may not use this file except in compliance with
12019+ * the RPSL or, if you have a valid RCSL with RealNetworks applicable
12020+ * to this file, the RCSL. Please see the applicable RPSL or RCSL for
12021+ * the rights, obligations and limitations governing use of the
12022+ * contents of the file.
12023+ *
12024+ * Alternatively, the contents of this file may be used under the
12025+ * terms of the GNU General Public License Version 2 (the
12026+ * "GPL") in which case the provisions of the GPL are applicable
12027+ * instead of those above. If you wish to allow use of your version of
12028+ * this file only under the terms of the GPL, and not to allow others
12029+ * to use your version of this file under the terms of either the RPSL
12030+ * or RCSL, indicate your decision by deleting the provisions above
12031+ * and replace them with the notice and other provisions required by
12032+ * the GPL. If you do not delete the provisions above, a recipient may
12033+ * use your version of this file under the terms of any one of the
12034+ * RPSL, the RCSL or the GPL.
12035+ *
12036+ * This file is part of the Helix DNA Technology. RealNetworks is the
12037+ * developer of the Original Code and owns the copyrights in the
12038+ * portions it created.
12039+ *
12040+ * This file, and the files included with this file, is distributed
12041+ * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
12042+ * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
12043+ * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
12044+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
12045+ * ENJOYMENT OR NON-INFRINGEMENT.
12046+ *
12047+ * Technology Compatibility Kit Test Suite(s) Location:
12048+ * http://www.helixcommunity.org/content/tck
12049+ *
12050+ * Contributor(s):
12051+ *
12052+ * ***** END LICENSE BLOCK ***** */
12053+#include "preflist.h"
12054+
12055+#include "hxstring.h"
12056+#include "hxccf.h"
12057+#include "hxprefs.h"
12058+#include "ihxpckts.h"
12059+
12060+class CHXPrefInfo
12061+{
12062+public:
12063+ CHXPrefInfo(const char* pKey, const char* pValue);
12064+ ~CHXPrefInfo();
12065+
12066+ const char* Key() const { return m_key;}
12067+ const char* Value() const { return m_value;}
12068+
12069+private:
12070+ CHXString m_key;
12071+ CHXString m_value;
12072+};
12073+
12074+CHXPrefInfo::CHXPrefInfo(const char* pKey, const char* pValue) :
12075+ m_key(pKey),
12076+ m_value(pValue)
12077+{}
12078+
12079+CHXPrefInfo::~CHXPrefInfo()
12080+{}
12081+
12082+CHXPrefList::CHXPrefList()
12083+{}
12084+
12085+CHXPrefList::~CHXPrefList()
12086+{
12087+ Clear();
12088+}
12089+
12090+void CHXPrefList::Add(const char* pKey, const char* pValue)
12091+{
12092+ CHXPrefInfo* pInfo = new CHXPrefInfo(pKey, pValue);
12093+
12094+ if (pInfo)
12095+ {
12096+ if (!m_prefInfo.AddTail(pInfo))
12097+ {
12098+ // We failed to insert the preference.
12099+ HX_DELETE(pInfo);
12100+ }
12101+ }
12102+}
12103+
12104+void CHXPrefList::Clear()
12105+{
12106+ while(!m_prefInfo.IsEmpty())
12107+ {
12108+ CHXPrefInfo* pInfo = (CHXPrefInfo*)m_prefInfo.RemoveHead();
12109+ HX_DELETE(pInfo);
12110+ }
12111+}
12112+
12113+void CHXPrefList::SetPreferences(IUnknown* pContext)
12114+{
12115+ IHXPreferences* pPrefs = NULL;
12116+ IHXCommonClassFactory* pCCF = NULL;
12117+
12118+ if (pContext &&
12119+ (HXR_OK == pContext->QueryInterface(IID_IHXPreferences,
12120+ (void**)&pPrefs)) &&
12121+ (HXR_OK == pContext->QueryInterface(IID_IHXCommonClassFactory,
12122+ (void**)&pCCF)))
12123+ {
12124+ CHXSimpleList::Iterator itr = m_prefInfo.Begin();
12125+
12126+ for(; itr != m_prefInfo.End(); ++itr)
12127+ {
12128+ CHXPrefInfo* pInfo = (CHXPrefInfo*)(*itr);
12129+
12130+ IHXBuffer* pBuf = NULL;
12131+
12132+ if ((HXR_OK == pCCF->CreateInstance(CLSID_IHXBuffer,
12133+ (void**)&pBuf)) &&
12134+ (HXR_OK == pBuf->Set((const unsigned char*)pInfo->Value(),
12135+ strlen(pInfo->Value()))))
12136+ {
12137+ pPrefs->WritePref(pInfo->Key(), pBuf);
12138+ }
12139+
12140+ HX_RELEASE(pBuf);
12141+ }
12142+ }
12143+
12144+ HX_RELEASE(pPrefs);
12145+ HX_RELEASE(pCCF);
12146+}
12147Index: helix-libs/clientapps/clutter/preflist.h
12148===================================================================
12149--- /dev/null 1970-01-01 00:00:00.000000000 +0000
12150+++ helix-libs/clientapps/clutter/preflist.h 2008-10-13 06:05:49.000000000 -0700
12151@@ -0,0 +1,69 @@
12152+/* ***** BEGIN LICENSE BLOCK *****
12153+ * Source last modified: $Id: preflist.h,v 1.2 2007/07/06 20:32:36 jfinnecy Exp $
12154+ *
12155+ * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
12156+ *
12157+ * The contents of this file, and the files included with this file,
12158+ * are subject to the current version of the RealNetworks Public
12159+ * Source License (the "RPSL") available at
12160+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
12161+ * the file under the current version of the RealNetworks Community
12162+ * Source License (the "RCSL") available at
12163+ * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
12164+ * will apply. You may also obtain the license terms directly from
12165+ * RealNetworks. You may not use this file except in compliance with
12166+ * the RPSL or, if you have a valid RCSL with RealNetworks applicable
12167+ * to this file, the RCSL. Please see the applicable RPSL or RCSL for
12168+ * the rights, obligations and limitations governing use of the
12169+ * contents of the file.
12170+ *
12171+ * Alternatively, the contents of this file may be used under the
12172+ * terms of the GNU General Public License Version 2 (the
12173+ * "GPL") in which case the provisions of the GPL are applicable
12174+ * instead of those above. If you wish to allow use of your version of
12175+ * this file only under the terms of the GPL, and not to allow others
12176+ * to use your version of this file under the terms of either the RPSL
12177+ * or RCSL, indicate your decision by deleting the provisions above
12178+ * and replace them with the notice and other provisions required by
12179+ * the GPL. If you do not delete the provisions above, a recipient may
12180+ * use your version of this file under the terms of any one of the
12181+ * RPSL, the RCSL or the GPL.
12182+ *
12183+ * This file is part of the Helix DNA Technology. RealNetworks is the
12184+ * developer of the Original Code and owns the copyrights in the
12185+ * portions it created.
12186+ *
12187+ * This file, and the files included with this file, is distributed
12188+ * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
12189+ * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
12190+ * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
12191+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
12192+ * ENJOYMENT OR NON-INFRINGEMENT.
12193+ *
12194+ * Technology Compatibility Kit Test Suite(s) Location:
12195+ * http://www.helixcommunity.org/content/tck
12196+ *
12197+ * Contributor(s):
12198+ *
12199+ * ***** END LICENSE BLOCK ***** */
12200+#ifndef PREFLIST_H
12201+#define PREFLIST_H
12202+
12203+#include "hxslist.h"
12204+
12205+class CHXPrefList
12206+{
12207+public:
12208+ CHXPrefList();
12209+ ~CHXPrefList();
12210+
12211+ void Add(const char* pKey, const char* pValue);
12212+ void Clear();
12213+
12214+ void SetPreferences(IUnknown* pContext);
12215+
12216+private:
12217+ CHXSimpleList m_prefInfo;
12218+};
12219+
12220+#endif /* PREFLIST_H */
12221Index: helix-libs/clientapps/clutter/print.cpp
12222===================================================================
12223--- /dev/null 1970-01-01 00:00:00.000000000 +0000
12224+++ helix-libs/clientapps/clutter/print.cpp 2008-10-13 06:05:49.000000000 -0700
12225@@ -0,0 +1,80 @@
12226+/* ***** BEGIN LICENSE BLOCK *****
12227+ * Version: RCSL 1.0/RPSL 1.0
12228+ *
12229+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
12230+ *
12231+ * The contents of this file, and the files included with this file, are
12232+ * subject to the current version of the RealNetworks Public Source License
12233+ * Version 1.0 (the "RPSL") available at
12234+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
12235+ * the file under the RealNetworks Community Source License Version 1.0
12236+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
12237+ * in which case the RCSL will apply. You may also obtain the license terms
12238+ * directly from RealNetworks. You may not use this file except in
12239+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
12240+ * applicable to this file, the RCSL. Please see the applicable RPSL or
12241+ * RCSL for the rights, obligations and limitations governing use of the
12242+ * contents of the file.
12243+ *
12244+ * This file is part of the Helix DNA Technology. RealNetworks is the
12245+ * developer of the Original Code and owns the copyrights in the portions
12246+ * it created.
12247+ *
12248+ * This file, and the files included with this file, is distributed and made
12249+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
12250+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
12251+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
12252+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
12253+ *
12254+ * Technology Compatibility Kit Test Suite(s) Location:
12255+ * http://www.helixcommunity.org/content/tck
12256+ *
12257+ * Contributor(s):
12258+ *
12259+ * ***** END LICENSE BLOCK ***** */
12260+
12261+#include <stdarg.h>
12262+#include <stdio.h>
12263+#include "print.h"
12264+#ifdef WIN32_PLATFORM_PSPC
12265+#include "hlxosstr.h"
12266+#include <winbase.h>
12267+#endif
12268+
12269+int print2stdout(const char* pFmt, ...)
12270+{
12271+ va_list args;
12272+
12273+ va_start(args, pFmt);
12274+
12275+#ifdef WIN32_PLATFORM_PSPC
12276+ char szMessage[512];
12277+ int ret = vsprintf(szMessage, pFmt, args);
12278+ OutputDebugString(OS_STRING(szMessage));
12279+#else
12280+ int ret = vfprintf(stdout, pFmt, args);
12281+#endif
12282+
12283+ va_end(args);
12284+
12285+ return ret;
12286+}
12287+
12288+int print2stderr(const char* pFmt, ...)
12289+{
12290+ va_list args;
12291+
12292+ va_start(args, pFmt);
12293+
12294+#ifdef WIN32_PLATFORM_PSPC
12295+ char szMessage[512];
12296+ int ret = vsprintf(szMessage, pFmt, args);
12297+ OutputDebugString(OS_STRING(szMessage));
12298+#else
12299+ int ret = vfprintf(stderr, pFmt, args);
12300+#endif
12301+
12302+ va_end(args);
12303+
12304+ return ret;
12305+}
12306Index: helix-libs/clientapps/clutter/print.h
12307===================================================================
12308--- /dev/null 1970-01-01 00:00:00.000000000 +0000
12309+++ helix-libs/clientapps/clutter/print.h 2008-10-13 06:05:49.000000000 -0700
12310@@ -0,0 +1,60 @@
12311+/* ***** BEGIN LICENSE BLOCK *****
12312+ * Version: RCSL 1.0/RPSL 1.0
12313+ *
12314+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
12315+ *
12316+ * The contents of this file, and the files included with this file, are
12317+ * subject to the current version of the RealNetworks Public Source License
12318+ * Version 1.0 (the "RPSL") available at
12319+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
12320+ * the file under the RealNetworks Community Source License Version 1.0
12321+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
12322+ * in which case the RCSL will apply. You may also obtain the license terms
12323+ * directly from RealNetworks. You may not use this file except in
12324+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
12325+ * applicable to this file, the RCSL. Please see the applicable RPSL or
12326+ * RCSL for the rights, obligations and limitations governing use of the
12327+ * contents of the file.
12328+ *
12329+ * This file is part of the Helix DNA Technology. RealNetworks is the
12330+ * developer of the Original Code and owns the copyrights in the portions
12331+ * it created.
12332+ *
12333+ * This file, and the files included with this file, is distributed and made
12334+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
12335+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
12336+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
12337+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
12338+ *
12339+ * Technology Compatibility Kit Test Suite(s) Location:
12340+ * http://www.helixcommunity.org/content/tck
12341+ *
12342+ * Contributor(s):
12343+ *
12344+ * ***** END LICENSE BLOCK ***** */
12345+
12346+#ifndef PRINT_H
12347+#define PRINT_H
12348+
12349+#ifdef __cplusplus
12350+extern "C" {
12351+#endif
12352+
12353+#ifdef _SYMBIAN
12354+#include "platform/symbian/symbian_print.h"
12355+
12356+#define STDOUT symbianPrint
12357+#define STDERR symbianPrint
12358+#else
12359+int print2stdout(const char* pFmt, ...);
12360+int print2stderr(const char* pFmt, ...);
12361+#define STDOUT print2stdout
12362+#define STDERR print2stderr
12363+#endif
12364+
12365+#ifdef __cplusplus
12366+};
12367+#endif
12368+
12369+
12370+#endif /* PRINT_H */
12371Index: helix-libs/clientapps/clutter/shmhelp.h
12372===================================================================
12373--- /dev/null 1970-01-01 00:00:00.000000000 +0000
12374+++ helix-libs/clientapps/clutter/shmhelp.h 2008-10-13 06:05:49.000000000 -0700
12375@@ -0,0 +1,88 @@
12376+/* ***** BEGIN LICENSE BLOCK *****
12377+ * Source last modified: $Id: shmhelp.h,v 1.5 2007/07/06 20:54:01 jfinnecy Exp $
12378+ *
12379+ * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
12380+ *
12381+ * The contents of this file, and the files included with this file,
12382+ * are subject to the current version of the RealNetworks Public
12383+ * Source License (the "RPSL") available at
12384+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
12385+ * the file under the current version of the RealNetworks Community
12386+ * Source License (the "RCSL") available at
12387+ * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
12388+ * will apply. You may also obtain the license terms directly from
12389+ * RealNetworks. You may not use this file except in compliance with
12390+ * the RPSL or, if you have a valid RCSL with RealNetworks applicable
12391+ * to this file, the RCSL. Please see the applicable RPSL or RCSL for
12392+ * the rights, obligations and limitations governing use of the
12393+ * contents of the file.
12394+ *
12395+ * Alternatively, the contents of this file may be used under the
12396+ * terms of the GNU General Public License Version 2 (the
12397+ * "GPL") in which case the provisions of the GPL are applicable
12398+ * instead of those above. If you wish to allow use of your version of
12399+ * this file only under the terms of the GPL, and not to allow others
12400+ * to use your version of this file under the terms of either the RPSL
12401+ * or RCSL, indicate your decision by deleting the provisions above
12402+ * and replace them with the notice and other provisions required by
12403+ * the GPL. If you do not delete the provisions above, a recipient may
12404+ * use your version of this file under the terms of any one of the
12405+ * RPSL, the RCSL or the GPL.
12406+ *
12407+ * This file is part of the Helix DNA Technology. RealNetworks is the
12408+ * developer of the Original Code and owns the copyrights in the
12409+ * portions it created.
12410+ *
12411+ * This file, and the files included with this file, is distributed
12412+ * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
12413+ * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
12414+ * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
12415+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
12416+ * ENJOYMENT OR NON-INFRINGEMENT.
12417+ *
12418+ * Technology Compatibility Kit Test Suite(s) Location:
12419+ * http://www.helixcommunity.org/content/tck
12420+ *
12421+ * Contributor(s):
12422+ *
12423+ * ***** END LICENSE BLOCK ***** */
12424+
12425+#if defined(USE_XWINDOWS)
12426+#include <X11/X.h>
12427+#include <X11/Xlib.h>
12428+#include <X11/extensions/XShm.h>
12429+#endif
12430+
12431+#include "hxcom.h"
12432+#include "hxtypes.h"
12433+
12434+
12435+class ShmHelp
12436+{
12437+ public:
12438+
12439+ //Helpers
12440+ static void Init(Display* pDisplay );
12441+ static HXBOOL ShmAvailable();
12442+ static HX_RESULT DetachSharedRegion(UCHAR**ppMem, XShmSegmentInfo* pInfo );
12443+ static HX_RESULT CreateSharedRegion( INT32 nSize,
12444+ UCHAR**ppMem,
12445+ int* pnShmID,
12446+ XShmSegmentInfo* pInfo );
12447+
12448+
12449+ protected:
12450+
12451+ private:
12452+ static HXBOOL zm_bUseShm;
12453+
12454+ //The X11 Segment ID....
12455+ static int zm_nSegment;
12456+ static Display* zm_pDisplay;
12457+
12458+ ShmHelp();
12459+ ShmHelp(Display*);
12460+ ~ShmHelp();
12461+
12462+};
12463+
12464Index: helix-libs/clientapps/clutter/unix.pcf
12465===================================================================
12466--- /dev/null 1970-01-01 00:00:00.000000000 +0000
12467+++ helix-libs/clientapps/clutter/unix.pcf 2008-10-13 06:05:49.000000000 -0700
12468@@ -0,0 +1,65 @@
12469+#
12470+# ***** BEGIN LICENSE BLOCK *****
12471+# Version: RCSL 1.0/RPSL 1.0
12472+#
12473+# Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
12474+#
12475+# The contents of this file, and the files included with this file, are
12476+# subject to the current version of the RealNetworks Public Source License
12477+# Version 1.0 (the "RPSL") available at
12478+# http://www.helixcommunity.org/content/rpsl unless you have licensed
12479+# the file under the RealNetworks Community Source License Version 1.0
12480+# (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
12481+# in which case the RCSL will apply. You may also obtain the license terms
12482+# directly from RealNetworks. You may not use this file except in
12483+# compliance with the RPSL or, if you have a valid RCSL with RealNetworks
12484+# applicable to this file, the RCSL. Please see the applicable RPSL or
12485+# RCSL for the rights, obligations and limitations governing use of the
12486+# contents of the file.
12487+#
12488+# This file is part of the Helix DNA Technology. RealNetworks is the
12489+# developer of the Original Code and owns the copyrights in the portions
12490+# it created.
12491+#
12492+# This file, and the files included with this file, is distributed and made
12493+# available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
12494+# EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
12495+# INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
12496+# FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
12497+#
12498+# Technology Compatibility Kit Test Suite(s) Location:
12499+# http://www.helixcommunity.org/content/tck
12500+#
12501+# Contributor(s):
12502+#
12503+# ***** END LICENSE BLOCK *****
12504+#
12505+
12506+
12507+if( ('HELIX_FEATURE_MINI_SITE' not in project.defines) and
12508+ (platform.name in ('linux2', 'linux-i386')) and
12509+ ('HELIX_FEATURE_VIDEO' in project.defines) and
12510+ (project.BuildOption("nodll"))
12511+ ):
12512+ project.sys_libraries.append('Xv', 'Xext')
12513+
12514+
12515+
12516+
12517+if project.BuildOption("nodll"):
12518+ if project.IsDefined("HELIX_FEATURE_VIDEO_CODEC_RV20"):
12519+ if platform.name in ('linux2', 'linux-i386', 'win32') and sysinfo.arch == 'i386':
12520+ project.AddLibraries(GetSDKPath("rvg2dec_libs") + '[adecg2]')
12521+ else:
12522+ project.AddLibraries(GetSDKPath("rvg2dec_libs") + '[cdecg2]')
12523+
12524+ if project.IsDefined("HELIX_FEATURE_VIDEO_CODEC_RV30") or \
12525+ project.IsDefined("HELIX_FEATURE_VIDEO_CODEC_RV40"):
12526+ if project.IsDefined("HELIX_FEATURE_ANSIC_RV89COMBO"):
12527+ project.AddLibraries(GetSDKPath("rv89combo_c_libs")+"[cdec]")
12528+ else:
12529+ if platform.name in ('linux2', 'linux-i386') and sysinfo.arch == 'i386':
12530+ project.AddLibraries(GetSDKPath("rv89combo_libs")+"[adec40]")
12531+ else:
12532+ project.AddLibraries(GetSDKPath("rv89combo_libs")+"[cdec40]")
12533+
12534Index: helix-libs/clientapps/clutter/unixcmap.h
12535===================================================================
12536--- /dev/null 1970-01-01 00:00:00.000000000 +0000
12537+++ helix-libs/clientapps/clutter/unixcmap.h 2008-10-13 06:05:49.000000000 -0700
12538@@ -0,0 +1,51 @@
12539+/* ***** BEGIN LICENSE BLOCK *****
12540+ * Source last modified: $Id: unixcmap.h,v 1.3 2007/07/06 20:54:01 jfinnecy Exp $
12541+ *
12542+ * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
12543+ *
12544+ * The contents of this file, and the files included with this file,
12545+ * are subject to the current version of the RealNetworks Public
12546+ * Source License (the "RPSL") available at
12547+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
12548+ * the file under the current version of the RealNetworks Community
12549+ * Source License (the "RCSL") available at
12550+ * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
12551+ * will apply. You may also obtain the license terms directly from
12552+ * RealNetworks. You may not use this file except in compliance with
12553+ * the RPSL or, if you have a valid RCSL with RealNetworks applicable
12554+ * to this file, the RCSL. Please see the applicable RPSL or RCSL for
12555+ * the rights, obligations and limitations governing use of the
12556+ * contents of the file.
12557+ *
12558+ * Alternatively, the contents of this file may be used under the
12559+ * terms of the GNU General Public License Version 2 (the
12560+ * "GPL") in which case the provisions of the GPL are applicable
12561+ * instead of those above. If you wish to allow use of your version of
12562+ * this file only under the terms of the GPL, and not to allow others
12563+ * to use your version of this file under the terms of either the RPSL
12564+ * or RCSL, indicate your decision by deleting the provisions above
12565+ * and replace them with the notice and other provisions required by
12566+ * the GPL. If you do not delete the provisions above, a recipient may
12567+ * use your version of this file under the terms of any one of the
12568+ * RPSL, the RCSL or the GPL.
12569+ *
12570+ * This file is part of the Helix DNA Technology. RealNetworks is the
12571+ * developer of the Original Code and owns the copyrights in the
12572+ * portions it created.
12573+ *
12574+ * This file, and the files included with this file, is distributed
12575+ * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
12576+ * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
12577+ * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
12578+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
12579+ * ENJOYMENT OR NON-INFRINGEMENT.
12580+ *
12581+ * Technology Compatibility Kit Test Suite(s) Location:
12582+ * http://www.helixcommunity.org/content/tck
12583+ *
12584+ * Contributor(s):
12585+ *
12586+ * ***** END LICENSE BLOCK ***** */
12587+
12588+EXTERN_C Colormap HXGetXColormap(Display* pDisplay, Window window);
12589+EXTERN_C void HXFindBestXColor(Display* pDisplay, Colormap cmap, XColor* desired);
12590Index: helix-libs/clientapps/clutter/visuals.h
12591===================================================================
12592--- /dev/null 1970-01-01 00:00:00.000000000 +0000
12593+++ helix-libs/clientapps/clutter/visuals.h 2008-10-13 06:05:49.000000000 -0700
12594@@ -0,0 +1,74 @@
12595+/* ***** BEGIN LICENSE BLOCK *****
12596+ * Source last modified: $Id: visuals.h,v 1.4 2007/07/06 20:54:01 jfinnecy Exp $
12597+ *
12598+ * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
12599+ *
12600+ * The contents of this file, and the files included with this file,
12601+ * are subject to the current version of the RealNetworks Public
12602+ * Source License (the "RPSL") available at
12603+ * http://www.helixcommunity.org/content/rpsl unless you have licensed
12604+ * the file under the current version of the RealNetworks Community
12605+ * Source License (the "RCSL") available at
12606+ * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
12607+ * will apply. You may also obtain the license terms directly from
12608+ * RealNetworks. You may not use this file except in compliance with
12609+ * the RPSL or, if you have a valid RCSL with RealNetworks applicable
12610+ * to this file, the RCSL. Please see the applicable RPSL or RCSL for
12611+ * the rights, obligations and limitations governing use of the
12612+ * contents of the file.
12613+ *
12614+ * Alternatively, the contents of this file may be used under the
12615+ * terms of the GNU General Public License Version 2 (the
12616+ * "GPL") in which case the provisions of the GPL are applicable
12617+ * instead of those above. If you wish to allow use of your version of
12618+ * this file only under the terms of the GPL, and not to allow others
12619+ * to use your version of this file under the terms of either the RPSL
12620+ * or RCSL, indicate your decision by deleting the provisions above
12621+ * and replace them with the notice and other provisions required by
12622+ * the GPL. If you do not delete the provisions above, a recipient may
12623+ * use your version of this file under the terms of any one of the
12624+ * RPSL, the RCSL or the GPL.
12625+ *
12626+ * This file is part of the Helix DNA Technology. RealNetworks is the
12627+ * developer of the Original Code and owns the copyrights in the
12628+ * portions it created.
12629+ *
12630+ * This file, and the files included with this file, is distributed
12631+ * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
12632+ * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
12633+ * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
12634+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
12635+ * ENJOYMENT OR NON-INFRINGEMENT.
12636+ *
12637+ * Technology Compatibility Kit Test Suite(s) Location:
12638+ * http://www.helixcommunity.org/content/tck
12639+ *
12640+ * Contributor(s):
12641+ *
12642+ * ***** END LICENSE BLOCK ***** */
12643+
12644+#ifndef _UNIX
12645+#error This is the UNIX platform specific implementation.
12646+#endif
12647+
12648+#ifndef _VISUALS_H_
12649+#define _VISUALS_H_
12650+
12651+#if defined(USE_XWINDOWS)
12652+#include <X11/Xlib.h>
12653+#include <X11/Xutil.h>
12654+#include <X11/Xos.h>
12655+#endif
12656+
12657+//
12658+// These functions are loaded with dlsym() so turn off name mangling
12659+// with extern "C".
12660+//
12661+extern "C" {
12662+
12663+Visual* GetBestVisual(Display* display);
12664+Visual* GetVisual(Display* display, long mask, XVisualInfo* templ);
12665+
12666+}
12667+
12668+#endif // _VISUALS_H_
diff --git a/meta/packages/helix/helix-libs/helix-player.pc b/meta/packages/helix/helix-libs/helix-player.pc
new file mode 100644
index 0000000000..bac67fc5c9
--- /dev/null
+++ b/meta/packages/helix/helix-libs/helix-player.pc
@@ -0,0 +1,11 @@
1prefix=/usr
2exec_prefix=${prefix}
3libdir=${exec_prefix}/lib
4includedir=${prefix}/include
5
6Name: helix-player
7Description: Helix Player Interface
8Version: 4.1.0
9Libs: -L${libdir} -lhelix-player
10Cflags: -I/opt/helix/include -D_UNIX
11Requires:
diff --git a/meta/packages/helix/helix-libs/hxclient.pc b/meta/packages/helix/helix-libs/hxclient.pc
new file mode 100644
index 0000000000..8f64d25670
--- /dev/null
+++ b/meta/packages/helix/helix-libs/hxclient.pc
@@ -0,0 +1,11 @@
1prefix=/opt/helix
2exec_prefix=${prefix}
3libdir=${exec_prefix}/lib
4includedir=${prefix}/include
5
6Name: hxclient
7Description: Helix Client Libraries off the Atlas Branch
8Version: 4.1.0
9Libs: -L${libdir} -lhxclient -lstdc++
10Cflags: -I${includedir} -D_UNIX
11Requires:
diff --git a/meta/packages/helix/ribosome.bb b/meta/packages/helix/ribosome.bb
new file mode 100644
index 0000000000..4339a6ce49
--- /dev/null
+++ b/meta/packages/helix/ribosome.bb
@@ -0,0 +1,37 @@
1DESCRIPTION = "Ribosome: HelixCommunity Build System"
2SECTION = "base"
3HOMEPAGE = "http://helixcommunity.org"
4LICENSE = "GPLv2"
5
6_SNAPSHOT = "22102008"
7_TARBALL_SERVER = "http://git.moblin.org/repos/users/rusty"
8
9PV="r0"
10
11SRC_URI = "${_TARBALL_SERVER}/ribosome-${_SNAPSHOT}.tar.bz2 \
12 ${_TARBALL_SERVER}/client-bif-${_SNAPSHOT}.tar.bz2 \
13 ${_TARBALL_SERVER}/common-bif-${_SNAPSHOT}.tar.bz2 \
14 file://ribosome/clutter.bif \
15 file://ribosome/buildrc"
16
17S = "${WORKDIR}"
18
19do_stage() {
20 # Install build system of doom
21 install -d ${STAGING_DIR_HOST}${libdir}
22 cp -a ribosome-${_SNAPSHOT} ${STAGING_DIR_HOST}${libdir}/ribosome
23 install -m 0644 ribosome/buildrc ${STAGING_DIR_HOST}${libdir}/ribosome/
24
25 # Install client BIF's
26 install -d ${STAGING_DIR_HOST}${libdir}/ribosome/bif-cvs/helix/client/build/BIF
27 install -m 0644 client-bif-${_SNAPSHOT}/*.bif \
28 ${STAGING_DIR_HOST}${libdir}/ribosome/bif-cvs/helix/client/build/BIF
29
30 # Install common BIF's
31 install -d ${STAGING_DIR_HOST}${libdir}/ribosome/bif-cvs/helix/common/build/BIF
32 install -m 0644 common-bif-${_SNAPSHOT}/*.bif \
33 ${STAGING_DIR_HOST}${libdir}/ribosome/bif-cvs/helix/common/build/BIF
34
35 # Install our own custom BIF
36 install -m 0644 ribosome/*.bif ${STAGING_DIR_HOST}${libdir}/ribosome/bif-cvs/helix/client/build/BIF/
37}
diff --git a/meta/packages/helix/ribosome/buildrc b/meta/packages/helix/ribosome/buildrc
new file mode 100644
index 0000000000..6dbc47a06d
--- /dev/null
+++ b/meta/packages/helix/ribosome/buildrc
@@ -0,0 +1,4 @@
1AddMultiCVS("helix",":ext:cvs.helixcommunity.org:/cvsroot/")
2AddBIFPath("common", "[helix]/common/build/BIF")
3AddBIFPath("client", "[helix]/client/build/BIF")
4SetSDKPath("oggvorbissdk", "/usr/")
diff --git a/meta/packages/helix/ribosome/clutter.bif b/meta/packages/helix/ribosome/clutter.bif
new file mode 100755
index 0000000000..a87fcb3faa
--- /dev/null
+++ b/meta/packages/helix/ribosome/clutter.bif
@@ -0,0 +1,68 @@
1<?xml version="1.0" ?>
2<build id="clutter">
3 <inherit id="hxclient_3_1_0_atlas"/>
4 <cvs root="helix"/>
5 <cvs tag="hxclient_3_1_0_atlas"/>
6 <default target="clutter" profile="helix-client-all-defines" options=""/>
7 <targets>
8
9 <!-- clutter -->
10 <module id="clutter" name="clientapps/clutter" group="core">
11 <includeplatforms>
12 unix
13 </includeplatforms>
14
15 <defines>
16 HELIX_FEATURE_AUDIO_VORBIS
17 HELIX_FEATURE_VIDEO_THEORA
18 HELIX_FEATURE_NETSERVICES_SHIM
19 HELIX_FEATURE_AVIFF
20 HELIX_CONFIG_SLUGGISHAUTOUPGRADE
21 HELIX_FEATURE_ALSA
22 _FORTIFY_SOURCE=2
23 </defines>
24
25 <source_dependlist>
26 client_include
27 datatype_tools_dtdriver_dtdrplin
28 </source_dependlist>
29
30 <dependlist>
31 helix_client_objs
32 player_hxclientkit
33 player_hxclientkit_src_hxrecordengine
34 client_core
35 client_resource
36 client_xres
37 protocol_sdp
38 video_site
39 datatype_smil
40 datatype_text_realtext_fileformat
41 datatype_text_realtext_renderer
42 datatype_tools_dtdriver_dtdrplin
43 datatype_ogg_fileformat
44 datatype_vorbis_renderer
45 datatype_theora_renderer
46 datatype_h261_renderer
47 datatype_h263
48 datatype_group_audio
49 datatype_group_image
50 datatype_ram
51 datatype_sdp
52 datatype_avi_fileformat
53 filesystem_local
54 filesystem_http
55 filesystem_memory
56 common_auth_authmgr
57 common_auth_rn5auth
58 client_auth_basicauth
59 common_log_logsystem
60 common_log_logobserverfile
61 </dependlist>
62
63 </module>
64
65 </targets>
66
67</build>
68