|
Lines 1-5
Link Here
|
| 1 |
/* This file is part of the KDE project |
1 |
/* This file is part of the KDE project |
| 2 |
Copyright (C) 2006-2007 Matthias Kretz <kretz@kde.org> |
2 |
Copyright (C) 2006-2007 Matthias Kretz <kretz@kde.org> |
|
|
3 |
Copyright (C) 2008 Ian Monroe <imonroe@kde.org> |
| 3 |
|
4 |
|
| 4 |
This program is free software; you can redistribute it and/or |
5 |
This program is free software; you can redistribute it and/or |
| 5 |
modify it under the terms of the GNU Library General Public |
6 |
modify it under the terms of the GNU Library General Public |
|
Lines 19-37
Link Here
|
| 19 |
*/ |
20 |
*/ |
| 20 |
|
21 |
|
| 21 |
#include "xinestream.h" |
22 |
#include "xinestream.h" |
| 22 |
#include "xineengine.h" |
23 |
|
| 23 |
#include <QMutexLocker> |
24 |
#include <QMutexLocker> |
| 24 |
#include <QEvent> |
25 |
#include <QEvent> |
| 25 |
#include <QCoreApplication> |
26 |
#include <QCoreApplication> |
| 26 |
#include <QTimer> |
27 |
#include <QTimer> |
|
|
28 |
|
| 27 |
#include <kurl.h> |
29 |
#include <kurl.h> |
|
|
30 |
#include <klocale.h> |
| 31 |
|
| 28 |
#include "audioport.h" |
32 |
#include "audioport.h" |
| 29 |
#include "videowidget.h" |
33 |
#include "backend.h" |
|
|
34 |
#include "bytestream.h" |
| 35 |
#include "events.h" |
| 30 |
#include "mediaobject.h" |
36 |
#include "mediaobject.h" |
|
|
37 |
#include "videowidget.h" |
| 38 |
#include "xineengine.h" |
| 31 |
#include "xinethread.h" |
39 |
#include "xinethread.h" |
| 32 |
#include <klocale.h> |
|
|
| 33 |
#include "events.h" |
| 34 |
#include "bytestream.h" |
| 35 |
|
40 |
|
| 36 |
extern "C" { |
41 |
extern "C" { |
| 37 |
#define this _this_xine_ |
42 |
#define this _this_xine_ |
|
Lines 65-70
Link Here
|
| 65 |
// m_startTime(-1), |
70 |
// m_startTime(-1), |
| 66 |
m_totalTime(-1), |
71 |
m_totalTime(-1), |
| 67 |
m_currentTime(-1), |
72 |
m_currentTime(-1), |
|
|
73 |
m_availableSubtitles(-1), |
| 74 |
m_availableAudioChannels(-1), |
| 68 |
m_availableTitles(-1), |
75 |
m_availableTitles(-1), |
| 69 |
m_availableChapters(-1), |
76 |
m_availableChapters(-1), |
| 70 |
m_availableAngles(-1), |
77 |
m_availableAngles(-1), |
|
Lines 130-142
Link Here
|
| 130 |
// hmm? |
137 |
// hmm? |
| 131 |
abort(); |
138 |
abort(); |
| 132 |
case XINE_ERROR_NO_INPUT_PLUGIN: |
139 |
case XINE_ERROR_NO_INPUT_PLUGIN: |
| 133 |
error(Phonon::NormalError, i18n("cannot find input plugin for MRL [%1]", m_mrl.constData())); |
140 |
error(Phonon::NormalError, i18n("Cannot find input plugin for MRL [%1]", m_mrl.constData())); |
| 134 |
break; |
141 |
break; |
| 135 |
case XINE_ERROR_NO_DEMUX_PLUGIN: |
142 |
case XINE_ERROR_NO_DEMUX_PLUGIN: |
| 136 |
if (m_mrl.startsWith("kbytestream:/")) { |
143 |
if (m_mrl.startsWith("kbytestream:/")) { |
| 137 |
error(Phonon::FatalError, i18n("cannot find demultiplexer plugin for the given media data")); |
144 |
error(Phonon::FatalError, i18n("Cannot find demultiplexer plugin for the given media data")); |
| 138 |
} else { |
145 |
} else { |
| 139 |
error(Phonon::FatalError, i18n("cannot find demultiplexer plugin for MRL [%1]", m_mrl.constData())); |
146 |
error(Phonon::FatalError, i18n("Cannot find demultiplexer plugin for MRL [%1]", m_mrl.constData())); |
| 140 |
} |
147 |
} |
| 141 |
break; |
148 |
break; |
| 142 |
default: |
149 |
default: |
|
Lines 547-552
Link Here
|
| 547 |
QString::fromUtf8(xine_get_meta_info(m_stream, XINE_META_INFO_TRACK_NUMBER))); |
554 |
QString::fromUtf8(xine_get_meta_info(m_stream, XINE_META_INFO_TRACK_NUMBER))); |
| 548 |
metaDataMap.insert(QLatin1String("DESCRIPTION"), |
555 |
metaDataMap.insert(QLatin1String("DESCRIPTION"), |
| 549 |
QString::fromUtf8(xine_get_meta_info(m_stream, XINE_META_INFO_COMMENT))); |
556 |
QString::fromUtf8(xine_get_meta_info(m_stream, XINE_META_INFO_COMMENT))); |
|
|
557 |
metaDataMap.insert(QLatin1String("MUSICBRAINZ_DISCID"), |
| 558 |
QString::fromUtf8(xine_get_meta_info(m_stream, XINE_META_INFO_CDINDEX_DISCID))); |
| 550 |
if(metaDataMap == m_metaDataMap) |
559 |
if(metaDataMap == m_metaDataMap) |
| 551 |
return; |
560 |
return; |
| 552 |
m_metaDataMap = metaDataMap; |
561 |
m_metaDataMap = metaDataMap; |
|
Lines 708-713
Link Here
|
| 708 |
emit availableAnglesChanged(m_availableAngles); |
717 |
emit availableAnglesChanged(m_availableAngles); |
| 709 |
} |
718 |
} |
| 710 |
|
719 |
|
|
|
720 |
{ |
| 721 |
int availableSubtitles = subtitlesSize(); |
| 722 |
if(availableSubtitles != m_availableSubtitles) |
| 723 |
{ |
| 724 |
kDebug(610) << "available subtitles changed: " << availableSubtitles; |
| 725 |
m_availableSubtitles = availableSubtitles; |
| 726 |
emit availableSubtitlesChanged(); |
| 727 |
} |
| 728 |
} |
| 729 |
{ |
| 730 |
int availableAudioChannels = audioChannelsSize(); |
| 731 |
if(availableAudioChannels != m_availableAudioChannels) |
| 732 |
{ |
| 733 |
kDebug(610) << "available audio channels changed: " << availableAudioChannels; |
| 734 |
m_availableAudioChannels = availableAudioChannels; |
| 735 |
emit availableAudioChannelsChanged(); |
| 736 |
} |
| 737 |
} |
| 738 |
|
| 711 |
int currentTitle = xine_get_stream_info(m_stream, XINE_STREAM_INFO_DVD_TITLE_NUMBER); |
739 |
int currentTitle = xine_get_stream_info(m_stream, XINE_STREAM_INFO_DVD_TITLE_NUMBER); |
| 712 |
int currentChapter = xine_get_stream_info(m_stream, XINE_STREAM_INFO_DVD_CHAPTER_NUMBER); |
740 |
int currentChapter = xine_get_stream_info(m_stream, XINE_STREAM_INFO_DVD_CHAPTER_NUMBER); |
| 713 |
int currentAngle = xine_get_stream_info(m_stream, XINE_STREAM_INFO_DVD_ANGLE_NUMBER); |
741 |
int currentAngle = xine_get_stream_info(m_stream, XINE_STREAM_INFO_DVD_ANGLE_NUMBER); |
|
Lines 1250-1255
Link Here
|
| 1250 |
return m_errorType; |
1278 |
return m_errorType; |
| 1251 |
} |
1279 |
} |
| 1252 |
|
1280 |
|
|
|
1281 |
#if KDE_IS_VERSION(4,1,0) |
| 1282 |
QList<SubtitleDescription> XineStream::availableSubtitles() const |
| 1283 |
{ |
| 1284 |
uint hash = streamHash(); |
| 1285 |
QList<SubtitleDescription> subtitles; |
| 1286 |
if( !m_stream ) |
| 1287 |
return subtitles; |
| 1288 |
const int channels = subtitlesSize(); |
| 1289 |
for( int index = 0; index < channels; index++ ) |
| 1290 |
{ |
| 1291 |
subtitles << streamDescription<SubtitleDescription>( index, hash, SubtitleType, xine_get_spu_lang ); |
| 1292 |
} |
| 1293 |
return subtitles; |
| 1294 |
} |
| 1295 |
|
| 1296 |
|
| 1297 |
QList<AudioChannelDescription> XineStream::availableAudioChannels() const |
| 1298 |
{ |
| 1299 |
const uint hash = streamHash(); |
| 1300 |
QList<AudioChannelDescription> audios; |
| 1301 |
if( !m_stream ) |
| 1302 |
return audios; |
| 1303 |
const int channels = audioChannelsSize(); |
| 1304 |
for( int index = 0; index < channels; index++ ) |
| 1305 |
{ |
| 1306 |
audios << streamDescription<AudioChannelDescription>( index, hash, AudioChannelType, xine_get_audio_lang ); |
| 1307 |
} |
| 1308 |
return audios; |
| 1309 |
} |
| 1310 |
#endif |
| 1311 |
|
| 1312 |
int XineStream::subtitlesSize() const |
| 1313 |
{ |
| 1314 |
return xine_get_stream_info( m_stream, XINE_STREAM_INFO_MAX_SPU_CHANNEL ); |
| 1315 |
} |
| 1316 |
|
| 1317 |
int XineStream::audioChannelsSize() const |
| 1318 |
{ |
| 1319 |
return xine_get_stream_info( m_stream, XINE_STREAM_INFO_MAX_AUDIO_CHANNEL ); |
| 1320 |
} |
| 1321 |
|
| 1322 |
#if KDE_IS_VERSION(4,1,0) |
| 1323 |
void XineStream::setCurrentAudioChannel(const AudioChannelDescription& streamDesc) |
| 1324 |
{ |
| 1325 |
xine_set_param( m_stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL, streamDesc.index() - streamHash() ); |
| 1326 |
} |
| 1327 |
|
| 1328 |
void XineStream::setCurrentSubtitle(const SubtitleDescription& streamDesc) |
| 1329 |
{ |
| 1330 |
kDebug() << "setting the subtitle to: " << streamDesc.index(); |
| 1331 |
xine_set_param( m_stream, XINE_PARAM_SPU_CHANNEL, streamDesc.index() - streamHash() ); |
| 1332 |
} |
| 1333 |
#endif |
| 1334 |
|
| 1335 |
uint XineStream::streamHash() const |
| 1336 |
{ |
| 1337 |
return qHash( m_mrl ); |
| 1338 |
} |
| 1339 |
|
| 1340 |
template<class S> |
| 1341 |
S XineStream::streamDescription(int index, uint hash, ObjectDescriptionType type, int(*get_xine_stream_text)(xine_stream_t *stream, int channel, char *lang)) const |
| 1342 |
{ |
| 1343 |
QByteArray lang; |
| 1344 |
lang.resize( 150 ); |
| 1345 |
get_xine_stream_text( m_stream, index, lang.data() ); |
| 1346 |
QHash<QByteArray, QVariant> properities; |
| 1347 |
properities.insert( "name", QString( lang ) ); |
| 1348 |
//XineEngine::setObjectDescriptionProperities( type, index + hash, properities ); |
| 1349 |
return S( index + hash, properities ); |
| 1350 |
} |
| 1351 |
|
| 1352 |
#if KDE_IS_VERSION(4,1,0) |
| 1353 |
AudioChannelDescription XineStream::currentAudioChannel() const |
| 1354 |
{ |
| 1355 |
const int index = xine_get_param( m_stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL ); |
| 1356 |
return streamDescription<AudioChannelDescription>( index, streamHash(), AudioChannelType, xine_get_audio_lang ); |
| 1357 |
} |
| 1358 |
|
| 1359 |
SubtitleDescription XineStream::currentSubtitle() const |
| 1360 |
{ |
| 1361 |
int index = xine_get_param( m_stream, XINE_PARAM_SPU_CHANNEL ); |
| 1362 |
return streamDescription<SubtitleDescription>( index, streamHash(), SubtitleType, xine_get_spu_lang ); |
| 1363 |
} |
| 1364 |
#endif |
| 1365 |
|
| 1366 |
|
| 1253 |
xine_post_out_t *XineStream::audioOutputPort() const |
1367 |
xine_post_out_t *XineStream::audioOutputPort() const |
| 1254 |
{ |
1368 |
{ |
| 1255 |
if (!m_stream) { |
1369 |
if (!m_stream) { |