]> git.pld-linux.org Git - packages/kdelibs.git/blame - kdelibs-3.1.1-video-20030314.patch
- update md5
[packages/kdelibs.git] / kdelibs-3.1.1-video-20030314.patch
CommitLineData
200cfe4d 1diff -Pur kdelibs-3.1.1-orig/arts/kde/kvideowidget.cpp kdelibs-3.1.1/arts/kde/kvideowidget.cpp
2--- kdelibs-3.1.1-orig/arts/kde/kvideowidget.cpp 2003-03-14 23:06:58.000000000 +0100
3+++ kdelibs-3.1.1/arts/kde/kvideowidget.cpp 2003-03-14 23:09:42.000000000 +0100
4@@ -25,12 +25,85 @@
5 #include "kvideowidget.h"
6
7
8-class KFullscreenVideoWidget : public KVideoWidget
9+static struct { const char *code; const char *language; } iso631_table[136] = {
10+ { "aa", "Afar" }, { "ab", "Abkhazian" },
11+ { "af", "Afrikaans" }, { "am", "Amharic" },
12+ { "ar", "Arabic" }, { "as", "Assamese" },
13+ { "ay", "Aymara" }, { "az", "Azerbaijani" },
14+ { "ba", "Bashkir" }, { "be", "Byelorussian" },
15+ { "bg", "Bulgarian" }, { "bh", "Bihari" },
16+ { "bi", "Bislama" }, { "bn", "Bengali; Bangla" },
17+ { "bo", "Tibetan" }, { "br", "Breton" },
18+ { "ca", "Catalan" }, { "co", "Corsican" },
19+ { "cs", "Czech" }, { "cy", "Welsh" },
20+ { "da", "Danish" }, { "de", "German" },
21+ { "dz", "Bhutani" }, { "el", "Greek" },
22+ { "en", "English" }, { "eo", "Esperanto" },
23+ { "es", "Spanish" }, { "et", "Estonian" },
24+ { "eu", "Basque" }, { "fa", "Persian" },
25+ { "fi", "Finnish" }, { "fj", "Fiji" },
26+ { "fo", "Faeroese" }, { "fr", "French" },
27+ { "fy", "Frisian" }, { "ga", "Irish" },
28+ { "gd", "Scots Gaelic" }, { "gl", "Galician" },
29+ { "gn", "Guarani" }, { "gu", "Gujarati" },
30+ { "ha", "Hausa" }, { "hi", "Hindi" },
31+ { "hr", "Croatian" }, { "hu", "Hungarian" },
32+ { "hy", "Armenian" }, { "ia", "Interlingua" },
33+ { "ie", "Interlingue" }, { "ik", "Inupiak" },
34+ { "in", "Indonesian" }, { "is", "Icelandic" },
35+ { "it", "Italian" }, { "iw", "Hebrew" },
36+ { "ja", "Japanese" }, { "ji", "Yiddish" },
37+ { "jw", "Javanese" }, { "ka", "Georgian" },
38+ { "kk", "Kazakh" }, { "kl", "Greenlandic" },
39+ { "km", "Cambodian" }, { "kn", "Kannada" },
40+ { "ko", "Korean" }, { "ks", "Kashmiri" },
41+ { "ku", "Kurdish" }, { "ky", "Kirghiz" },
42+ { "la", "Latin" }, { "ln", "Lingala" },
43+ { "lo", "Laothian" }, { "lt", "Lithuanian" },
44+ { "lv", "Latvian, Lettish" }, { "mg", "Malagasy" },
45+ { "mi", "Maori" }, { "mk", "Macedonian" },
46+ { "ml", "Malayalam" }, { "mn", "Mongolian" },
47+ { "mo", "Moldavian" }, { "mr", "Marathi" },
48+ { "ms", "Malay" }, { "mt", "Maltese" },
49+ { "my", "Burmese" }, { "na", "Nauru" },
50+ { "ne", "Nepali" }, { "nl", "Dutch" },
51+ { "no", "Norwegian" }, { "oc", "Occitan" },
52+ { "om", "Oromo (Afan)" }, { "or", "Oriya" },
53+ { "pa", "Punjabi" }, { "pl", "Polish" },
54+ { "ps", "Pashto, Pushto" }, { "pt", "Portuguese" },
55+ { "qu", "Quechua" }, { "rm", "Rhaeto-Romance" },
56+ { "rn", "Kirundi" }, { "ro", "Romanian" },
57+ { "ru", "Russian" }, { "rw", "Kinyarwanda" },
58+ { "sa", "Sanskrit" }, { "sd", "Sindhi" },
59+ { "sg", "Sangro" }, { "sh", "Serbo-Croatian" },
60+ { "si", "Singhalese" }, { "sk", "Slovak" },
61+ { "sl", "Slovenian" }, { "sm", "Samoan" },
62+ { "sn", "Shona" }, { "so", "Somali" },
63+ { "sq", "Albanian" }, { "sr", "Serbian" },
64+ { "ss", "Siswati" }, { "st", "Sesotho" },
65+ { "su", "Sudanese" }, { "sv", "Swedish" },
66+ { "sw", "Swahili" }, { "ta", "Tamil" },
67+ { "te", "Tegulu" }, { "tg", "Tajik" },
68+ { "th", "Thai" }, { "ti", "Tigrinya" },
69+ { "tk", "Turkmen" }, { "tl", "Tagalog" },
70+ { "tn", "Setswana" }, { "to", "Tonga" },
71+ { "tr", "Turkish" }, { "ts", "Tsonga" },
72+ { "tt", "Tatar" }, { "tw", "Twi" },
73+ { "uk", "Ukrainian" }, { "ur", "Urdu" },
74+ { "uz", "Uzbek" }, { "vi", "Vietnamese" },
75+ { "vo", "Volapuk" }, { "wo", "Wolof" },
76+ { "xh", "Xhosa" }, { "yo", "Yoruba" },
77+ { "zh", "Chinese" }, { "zu", "Zulu" }
78+};
79+
80+
81+class KFullscreenVideoWidget : public QWidget
82 {
83 public:
84 KFullscreenVideoWidget( KVideoWidget *parent = 0, const char *name = 0 );
85
86 protected:
87+ virtual void mousePressEvent( QMouseEvent *event );
88 virtual void windowActivationChange( bool );
89 virtual bool x11Event( XEvent *event );
90
91@@ -39,13 +112,31 @@
92 };
93
94 KFullscreenVideoWidget::KFullscreenVideoWidget( KVideoWidget *parent, const char *name )
95- : KVideoWidget( parent, name, WType_TopLevel | WStyle_Customize | WStyle_NoBorder )
96+ : QWidget( parent, name, WType_TopLevel | WStyle_Customize | WStyle_NoBorder )
97 {
98- this->videoWidget = parent;
99 setEraseColor( black );
100 setCursor(QCursor(Qt::BlankCursor));
101+
102+ videoWidget = parent;
103+
104+ // Leave fullscreen mode with <Escape> key
105+ QAccel *accelEsc = new QAccel( this );
106+ accelEsc->connectItem( accelEsc->insertItem( Key_Escape ),
107+ videoWidget, SLOT(setWindowed()) );
108+}
109+
110+void KFullscreenVideoWidget::mousePressEvent( QMouseEvent *event )
111+{
112+ if (event->button() == RightButton)
113+ videoWidget->clickRightButton( mapToGlobal( event->pos() ) );
114 }
115
116+void KVideoWidget::clickRightButton( const QPoint &p )
117+{
118+ emit rightButtonPressed( p );
119+}
120+
121+
122 void KFullscreenVideoWidget::windowActivationChange( bool )
123 {
124 if (!isActiveWindow())
125@@ -120,7 +211,7 @@
126 {
127 if (isEmbedded())
128 {
129- poVideo.x11WindowId( -1 );
130+ poVideo.property( "Display.Window", -1 );
131 poVideo = Arts::VideoPlayObject::null();
132 }
133
134@@ -137,8 +228,11 @@
135 {
136 if (isEmbedded())
137 {
138- poVideo.x11WindowId( -1 );
139+ poVideo.property( "Display.Window", -1 );
140 poVideo = Arts::VideoPlayObject::null();
141+
142+ emit audioLanguagesChanged();
143+ emit subtitleLanguagesChanged();
144 }
145
146 setBackgroundMode( PaletteBackground );
147@@ -151,14 +245,14 @@
148 if (isHalfSize() || isNormalSize() || isDoubleSize())
149 emit adaptSize( 0, 0 );
150
151- enable = false;
152+ enable = false;
153 updateGeometry();
154 }
155 else
156 {
157 if (isEmbedded())
158 {
159- poVideo.x11WindowId( -1 );
160+ poVideo.property( "Display.Window", -1 );
161 }
162
163 poVideo = vpo;
164@@ -166,17 +260,20 @@
165 // Don't reset fullscreen mode for video playlists
166 if (fullscreenWidget)
167 {
168- poVideo.x11WindowId( fullscreenWidget->winId() );
169+ poVideo.property( "Display.Window", fullscreenWidget->winId() );
170 fullscreenWidget->setBackgroundMode( NoBackground );
171
172 setEraseColor( black );
173 }
174 else
175 {
176- poVideo.x11WindowId( winId() );
177+ poVideo.property( "Display.Window", winId() );
178 setBackgroundMode( NoBackground );
179 }
180- enable = true;
181+ enable = true;
182+
183+ emit audioLanguagesChanged();
184+ emit subtitleLanguagesChanged();
185 }
186 action("double_size")->setEnabled(enable);
187 action("half_size")->setEnabled(enable);
188@@ -277,6 +374,24 @@
189 doubleSizeActivated();
190 }
191
192+void KVideoWidget::setAudioChannel( int channel )
193+{
194+ if (!poVideo.isNull())
195+ {
196+ poVideo.property( "Display.AudioChannel", channel );
197+ emit audioChannelChanged( channel );
198+ }
199+}
200+
201+void KVideoWidget::setSubtitleChannel( int channel )
202+{
203+ if (!poVideo.isNull())
204+ {
205+ poVideo.property( "Display.Subtitles", channel );
206+ emit subtitleChannelChanged( channel );
207+ }
208+}
209+
210 QSize KVideoWidget::sizeHint() const
211 {
212 return QSize( videoWidth, videoHeight );
213@@ -290,6 +405,109 @@
214 return int( double(w)*double(videoHeight)/double(videoWidth) );
215 }
216
217+QString KVideoWidget::getLanguageByCode( const QString &code )
218+{
219+ int left, right, middle;
220+
221+ left = 0;
222+ right = 135;
223+
224+ QString str = code.stripWhiteSpace().lower();
225+
226+ // Find ISO-631 language using binary search
227+ do
228+ {
229+ middle = (left + right + 1) / 2;
230+
231+ if (str < iso631_table[middle].code)
232+ right = (middle - 1);
233+ else
234+ left = middle;
235+ }
236+ while (left < right);
237+
238+ if (str == iso631_table[left].code)
239+ {
240+ return QString( iso631_table[left].language );
241+ }
242+
243+ return QString::null;
244+}
245+
246+int KVideoWidget::getAudioChannel()
247+{
248+ return (!poVideo.isNull() ? poVideo.property( "Display.AudioChannel" ) : -1);
249+}
250+
251+QValueVector<QString> KVideoWidget::getAudioLanguages()
252+{
253+ QValueVector<QString> vec;
254+
255+ if (!poVideo.isNull())
256+ {
257+ for (int i=1, n=poVideo.property( "Audio.Languages" ); i <= n; i++)
258+ {
259+ long lang = poVideo.property( "Audio.Language." + QString::number( i ) );
260+
261+ if (lang != -1)
262+ {
263+ vec.append( QString( "" ) );
264+ }
265+ else
266+ {
267+ char buf[5];
268+
269+ buf[0] = ((lang >> 24) & 0xFF);
270+ buf[1] = ((lang >> 16) & 0xFF);
271+ buf[2] = ((lang >> 8) & 0xFF);
272+ buf[3] = (lang & 0xFF);
273+ buf[4] = 0;
274+
275+ vec.append( QString( buf ) );
276+ }
277+ }
278+ }
279+
280+ return vec;
281+}
282+
283+int KVideoWidget::getSubtitleChannel()
284+{
285+ return (!poVideo.isNull() ? poVideo.property( "Display.Subtitles" ) : -1);
286+}
287+
288+QValueVector<QString> KVideoWidget::getSubtitleLanguages()
289+{
290+ QValueVector<QString> vec;
291+
292+ if (!poVideo.isNull())
293+ {
294+ for (int i=1, n=poVideo.property( "Subtitles.Languages" ); i <= n; i++)
295+ {
296+ long lang = poVideo.property( "Subtitles.Language." + QString::number( i ) );
297+
298+ if (lang != -1)
299+ {
300+ vec.append( QString( "" ) );
301+ }
302+ else
303+ {
304+ char buf[5];
305+
306+ buf[0] = ((lang >> 24) & 0xFF);
307+ buf[1] = ((lang >> 16) & 0xFF);
308+ buf[2] = ((lang >> 8) & 0xFF);
309+ buf[3] = (lang & 0xFF);
310+ buf[4] = 0;
311+
312+ vec.append( QString( buf ) );
313+ }
314+ }
315+ }
316+
317+ return vec;
318+}
319+
320 void KVideoWidget::mousePressEvent( QMouseEvent *event )
321 {
322 if (event->button() == RightButton)
323@@ -357,21 +575,12 @@
324 {
325 fullscreenWidget = new KFullscreenVideoWidget( this );
326
327- // Interconnect right mouse button signals
328- connect( fullscreenWidget, SIGNAL(rightButtonPressed(const QPoint &)),
329- this, SIGNAL(rightButtonPressed(const QPoint &)) );
330-
331- // Leave fullscreen mode with <Escape> key
332- QAccel *a = new QAccel( fullscreenWidget );
333- a->connectItem( a->insertItem( Key_Escape ),
334- this, SLOT(setWindowed()) );
335-
336 fullscreenWidget->showFullScreen();
337 fullscreenWidget->setFocus();
338
339 if (isEmbedded())
340 {
341- poVideo.x11WindowId( fullscreenWidget->winId() );
342+ poVideo.property( "Display.Window", fullscreenWidget->winId() );
343 fullscreenWidget->setBackgroundMode( NoBackground );
344 }
345 }
346@@ -379,7 +588,7 @@
347 {
348 if (isEmbedded())
349 {
350- poVideo.x11WindowId( winId() );
351+ poVideo.property( "Display.Window", winId() );
352 setBackgroundMode( NoBackground );
353 }
354
355diff -Pur kdelibs-3.1.1-orig/arts/kde/kvideowidget.h kdelibs-3.1.1/arts/kde/kvideowidget.h
356--- kdelibs-3.1.1-orig/arts/kde/kvideowidget.h 2003-03-14 23:06:58.000000000 +0100
357+++ kdelibs-3.1.1/arts/kde/kvideowidget.h 2003-03-14 23:07:50.000000000 +0100
358@@ -13,45 +13,160 @@
359
360 #include <qevent.h>
361 #include <qimage.h>
362+#include <qvaluevector.h>
363 #include <qwidget.h>
364 #include <kmedia2.h>
365 #include <kxmlguiclient.h>
366
367
368+/**
369+ * Video widget class.
370+ */
371 class KVideoWidget : public QWidget, virtual public KXMLGUIClient
372 {
373 Q_OBJECT
374
375 public:
376+ /**
377+ * Constructor.
378+ */
379 KVideoWidget( KXMLGUIClient *clientParent, QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
380+
381+ /**
382+ * Constructor.
383+ */
384 KVideoWidget( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
385+
386+ /**
387+ * Destructor.
388+ */
389 virtual ~KVideoWidget();
390
391+ /**
392+ * Embed and display video on this widget.
393+ * @param vpo the PlayObject to embed
394+ */
395 void embed( Arts::VideoPlayObject vpo );
396+
397+ /**
398+ * Snapshot.
399+ */
400 static QImage snapshot( Arts::VideoPlayObject vpo );
401
402+ /**
403+ * Returns true if this widget is currently displaying a video.
404+ */
405 bool isEmbedded();
406+
407+ /**
408+ * Returns true if the video is shown in full screen.
409+ */
410 bool isFullscreen();
411+
412+ /**
413+ * Returns true if the video is shown at half size (50%).
414+ */
415 bool isHalfSize();
416+
417+ /**
418+ * Returns true if the video is shown at normal size (100%).
419+ */
420 bool isNormalSize();
421+
422+ /**
423+ * Returns true if the video is shown at double size (200%).
424+ */
425 bool isDoubleSize();
426
427+ /**
428+ * Returns the recommended size for the widget.
429+ */
430 QSize sizeHint() const;
431
432+ /**
433+ * Returns the preferred height for this widget, given the width w.
434+ */
435 virtual int heightForWidth ( int w ) const;
436
437+ /**
438+ * Get language by ISO-631 language code.
439+ * @param code the language code
440+ * @return the language in English
441+ */
442+ QString getLanguageByCode( const QString &code );
443+
444+ /**
445+ * Returns the current audio channel.
446+ */
447+ int getAudioChannel();
448+
449+ /**
450+ * Returns a list of available audio languages.
451+ * Empty strings indicate the language of the channel is unknown.
452+ */
453+ QValueVector<QString> getAudioLanguages();
454+
455+ /**
456+ * Returns the current subtitle channel or -1 if subtitles are
457+ * disabled.
458+ */
459+ int getSubtitleChannel();
460+
461+ /**
462+ * Returns a list of available subtitle languages.
463+ * Empty strings indicate the language of the channel is unknown.
464+ */
465+ QValueVector<QString> getSubtitleLanguages();
466+
467 protected:
468 virtual void mousePressEvent( QMouseEvent *event );
469 virtual void resizeEvent( QResizeEvent *event );
470 virtual bool x11Event( XEvent *event );
471
472 public slots:
473+ void clickRightButton( const QPoint &p );
474+ /**
475+ * Select full screen mode.
476+ */
477 void setFullscreen();
478+
479+ /**
480+ * Select windowed mode.
481+ */
482 void setWindowed();
483+
484+ /**
485+ * Select half (50%) video size, emits an 'adaptSize()' signal.
486+ */
487 void setHalfSize();
488+
489+ /**
490+ * Select normal (100%) video size, emits an 'adaptSize()' signal.
491+ */
492 void setNormalSize();
493+
494+ /**
495+ * Select double (200%) video size, emits an 'adaptSize()' signal.
496+ */
497 void setDoubleSize();
498
499+ /**
500+ * Select audio channel.
501+ * @param channel the audio channel
502+ */
503+ void setAudioChannel( int channel );
504+
505+ /**
506+ * Select subtitle channel.
507+ * @param channel the subtitle channel or -1 to disable subtitles
508+ */
509+ void setSubtitleChannel( int channel );
510+
511+ /**
512+ * Video display size change notification.
513+ * @param width the new video display width
514+ * @param height the new video display height
515+ */
516 void resizeNotify( int width, int height );
517
518 protected slots:
519@@ -61,8 +176,40 @@
520 void doubleSizeActivated();
521
522 signals:
523+ /**
524+ * Adapt GUI to new video size.
525+ * @param width the suggested width for this widget
526+ * @param height the suggested height for this widget
527+ */
528 void adaptSize( int width, int height );
529- void rightButtonPressed( const QPoint & );
530+
531+ /**
532+ * Right mouse button pressed,
533+ * @param p the location of the mouse cursor
534+ */
535+ void rightButtonPressed( const QPoint &p );
536+
537+ /**
538+ * Current audio channel or PlayObject has changed.
539+ * @param channel the active audio channel
540+ */
541+ void audioChannelChanged( int channel );
542+
543+ /**
544+ * List of audio languages or PlayObject has changed.
545+ */
546+ void audioLanguagesChanged();
547+
548+ /**
549+ * Current subtitle channel or PlayObject has changed.
550+ * @param channel the active subtitle channel
551+ */
552+ void subtitleChannelChanged( int channel );
553+
554+ /**
555+ * List of subtitle languages or PlayObject has changed.
556+ */
557+ void subtitleLanguagesChanged();
558
559 private:
560 void init(void);
This page took 0.124374 seconds and 4 git commands to generate.