Accepting request 442946 from KDE:Extra

1

OBS-URL: https://build.opensuse.org/request/show/442946
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kaffeine?expand=0&rev=60
This commit is contained in:
Dominique Leuenberger 2016-12-02 15:43:19 +00:00 committed by Git OBS Bridge
commit 0984813148
15 changed files with 101 additions and 732 deletions

View File

@ -1,20 +0,0 @@
--- src/dvb/dvbchannelui.h 2010-09-01 21:53:54.000000000 +0200
+++ src/dvb/dvbchannelui.h 2010-09-30 19:30:56.486249907 +0200
@@ -21,6 +21,7 @@
#ifndef DVBCHANNELUI_H
#define DVBCHANNELUI_H
+#include <QSharedDataPointer>
#include <QTreeView>
class QAbstractProxyModel;
--- src/dvb/dvbmanager.h 2010-09-01 21:53:54.000000000 +0200
+++ src/dvb/dvbmanager.h 2010-09-30 20:14:30.720168393 +0200
@@ -21,6 +21,7 @@
#ifndef DVBMANAGER_H
#define DVBMANAGER_H
+#include <QSharedDataPointer>
#include <QDate>
#include <QMap>
#include <QPair>

View File

@ -1,31 +0,0 @@
---
src/dvb/dvbmanager.cpp | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
--- a/src/dvb/dvbmanager.cpp
+++ b/src/dvb/dvbmanager.cpp
@@ -448,15 +448,17 @@ void DvbManager::deviceAdded(DvbBackendD
void DvbManager::deviceRemoved(DvbBackendDevice *backendDevice)
{
for (int i = 0; i < deviceConfigs.size(); ++i) {
- if (deviceConfigs.at(i).device->getBackendDevice() == backendDevice) {
- if (deviceConfigs[i].useCount != 0) {
- deviceConfigs[i].useCount = 0;
- deviceConfigs[i].prioritizedUseCount = 0;
- deviceConfigs[i].device->release();
+ DvbDeviceConfig &it = deviceConfigs[i];
+
+ if (it.device && it.device->getBackendDevice() == backendDevice) {
+ if (it.useCount != 0) {
+ it.useCount = 0;
+ it.prioritizedUseCount = 0;
+ it.device->release();
}
- delete deviceConfigs[i].device;
- deviceConfigs[i].device = NULL;
+ delete it.device;
+ it.device = NULL;
break;
}
}

View File

@ -1,11 +0,0 @@
Index: src/kaffeine.desktop
===================================================================
--- src/kaffeine.desktop.orig
+++ src/kaffeine.desktop
@@ -97,3 +97,6 @@ X-KDE-HasTempFileOption=true
#To enable back when doc will be available
#X-DocPath=kaffeine/index.html
X-Desktop-File-Install-Version=0.15
+#Lower than Amarok so we don't override for audio.
+#Will break if Amarok ever starts to play video files.
+InitialPreference=4

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3531d980a1083abeb69f8b8ff4ddbb371a38ab866f7d6917caaa9b5bfa80b557
size 365603

3
kaffeine-2.0.5.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e1610931e9475e8b86f9c75331f51fbeea22fab0c5fc6a1085325ab2ef055a8c
size 2284712

View File

@ -1,13 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d803558..a94b676 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,6 +11,8 @@ if(DEFINED QT_VERSION_MAJOR)
add_definitions(-DQT_STRICT_ITERATORS)
endif(DEFINED QT_VERSION_MAJOR)
+include(CheckIncludeFiles)
+
check_include_files(${CMAKE_CURRENT_SOURCE_DIR}/include/frontend.h HAVE_DVB)
if(NOT HAVE_DVB)

View File

@ -1,16 +1,14 @@
Index: src/playlist/playlisttab.cpp
===================================================================
--- src/playlist/playlisttab.cpp (revision 1134989)
+++ src/playlist/playlisttab.cpp (working copy)
@@ -21,6 +21,7 @@
#include "playlisttab.h"
--- src/playlist/playlisttab.cpp.orig 2016-06-30 17:20:32.000000000 +0200
+++ src/playlist/playlisttab.cpp 2016-08-10 17:26:40.388513777 +0200
@@ -29,6 +29,7 @@
#include <QAction>
#include <QBoxLayout>
#include <QFileDialog>
+#include <QToolBar>
#include <QKeyEvent>
#include <QListView>
#include <QSplitter>
@@ -447,33 +448,35 @@
#include <QMenu>
@@ -450,33 +451,35 @@
QBoxLayout *sideLayout = new QVBoxLayout(widget);
sideLayout->setMargin(0);
@ -51,7 +49,7 @@ Index: src/playlist/playlisttab.cpp
boxLayout->addStretch();
sideLayout->addLayout(boxLayout);
@@ -500,28 +503,30 @@
@@ -503,28 +506,30 @@
sideLayout = new QVBoxLayout(widget);
sideLayout->setMargin(0);
@ -86,11 +84,11 @@ Index: src/playlist/playlisttab.cpp
boxLayout->addStretch();
sideLayout->addLayout(boxLayout);
@@ -616,6 +621,7 @@
@@ -619,6 +624,7 @@
fileWidget->setFilter(MediaWidget::extensionFilter());
fileWidget->setMode(KFile::Files | KFile::ExistingOnly);
fileWidgetSplitter->setStretchFactor(1, 1);
+ fileWidget->setMinimumWidth(40);
// KFileWidget creates a KUrlComboBox without layout (!), which steals the focus:
// KFileWidget creates a QUrlComboBox without layout (!), which steals the focus:
// kDebug() << QApplication::focusWidget();

View File

@ -1,26 +0,0 @@
Index: src/dvb/dvbepg.cpp
===================================================================
--- src/dvb/dvbepg.cpp.orig
+++ src/dvb/dvbepg.cpp
@@ -690,15 +690,15 @@ void AtscEpgFilter::processEitSection(co
// 1980-01-06T000000 minus 15 secs (= UTC - GPS in 2011)
QDateTime baseDateTime = QDateTime(QDate(1980, 1, 5), QTime(23, 59, 45), Qt::UTC);
- for (AtscEitSectionEntry entry = eitSection.entries(); (entryCount > 0) && entry.isValid();
- --entryCount, entry.advance()) {
+ for (AtscEitSectionEntry AESentry = eitSection.entries(); (entryCount > 0) && AESentry.isValid();
+ --entryCount, AESentry.advance()) {
DvbEpgEntry epgEntry;
epgEntry.channel = channel;
- epgEntry.begin = baseDateTime.addSecs(entry.startTime());
- epgEntry.duration = QTime().addSecs(entry.duration());
- epgEntry.title = entry.title();
+ epgEntry.begin = baseDateTime.addSecs(AESentry.startTime());
+ epgEntry.duration = QTime().addSecs(AESentry.duration());
+ epgEntry.title = AESentry.title();
- quint32 id = ((quint32(fakeChannel.networkId) << 16) | quint32(entry.eventId()));
+ quint32 id = ((quint32(fakeChannel.networkId) << 16) | quint32(AESentry.eventId()));
DvbSharedEpgEntry entry = epgEntries.value(id);
if (entry.isValid() && (entry->channel == epgEntry.channel) &&

View File

@ -1,32 +0,0 @@
--- a/src/dvb/dvbdevice.cpp
+++ b/src/dvb/dvbdevice.cpp
@@ -353,8 +353,8 @@
switch (config->configuration) {
case DvbConfigBase::DiseqcSwitch: {
- char cmd[] = { 0xe0, 0x10, 0x38, 0x00 };
- cmd[3] = 0xf0 | (config->lnbNumber << 2) | (horPolar ? 2 : 0) | (highBand ? 1 : 0);
+ char cmd[] = { char(0xe0), 0x10, 0x38, 0x00 };
+ cmd[3] = 0xf0 | char(config->lnbNumber << 2) | (horPolar ? 2 : 0) | (highBand ? 1 : 0);
backend->sendMessage(cmd, sizeof(cmd));
usleep(15000);
@@ -399,7 +399,7 @@
value |= 0xd000;
}
- char cmd[] = { 0xe0, 0x31, 0x6e, (value / 256), (value % 256) };
+ char cmd[] = { char(0xe0), 0x31, 0x6e, char(value / 256), char(value % 256) };
backend->sendMessage(cmd, sizeof(cmd));
usleep(15000);
moveRotor = true;
@@ -407,7 +407,7 @@
}
case DvbConfigBase::PositionsRotor: {
- char cmd[] = { 0xe0, 0x31, 0x6b, config->lnbNumber };
+ char cmd[] = { char(0xe0), 0x31, 0x6b, char(config->lnbNumber) };
backend->sendMessage(cmd, sizeof(cmd));
usleep(15000);
moveRotor = true;

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a5ad1e6bd665cda72cf5008c2dab03ce6cbb366a341c7c3c7168c4118405a0c2
size 26307

View File

@ -1,3 +1,25 @@
-------------------------------------------------------------------
Wed Nov 30 18:03:24 UTC 2016 - wbauer@tmo.at
- Update to 2.0.5:
* No changelog available
-------------------------------------------------------------------
Wed Aug 10 18:09:43 UTC 2016 - joerg.lorenzen@ki.tng.de
- Update to 2.0.4:
- No recent changelog available in tarball.
- Build against kf5 and qt5.
- Removed patches build-fix.diff, crash-on-resume-fix.patch,
initial-preference.diff, kaffeine-cmake34.patch,
kaffeine-gcc47.patch, kaffeine-gcc6.patch, ksuseinstall.diff,
support_for_sundtek_tv_tuners.patch and
support_mimetypes_bnc671581.diff, fixed upstream.
- Fixed patch kaffeine-fixsplitter.patch.
- Removed source kaffeine-icons.tar.bz2, no longer required.
- Changed summary and description because kaffeine now builds
against libvlc, libxine is no longer needed for build.
-------------------------------------------------------------------
Fri Jun 17 18:57:21 UTC 2016 - wbauer@tmo.at

View File

@ -17,130 +17,94 @@
Name: kaffeine
Version: 1.2.2
Release: 0
Summary: Xine-Based Multimedia Player
Summary: Vlc-Based Multimedia Player
License: GPL-2.0+
Group: Productivity/Multimedia/Video/Players
Version: 2.0.5
Release: 0
Url: http://kaffeine.kde.org/
# http://sourceforge.net/projects/kaffeine/files/current/kaffeine-1.2.2.tar.gz
Source0: %{name}-%{version}.tar.bz2
Source1: %{name}-icons.tar.bz2
Source0: %{name}-%{version}.tar.xz
# PATCH-FEATURE-OPENSUSE kaffeine-fixsplitter.patch -- GUI improvement (allow more flexibly set splitters)
Patch0: kaffeine-fixsplitter.patch
# PATCH-FEATURE-OPENSUSE ksuseinstall.diff llunak@novell.com -- Support for on-demand codecs install using ksuseinstall
Patch2: ksuseinstall.diff
# PATCH-FIX-OPENSUSE initial-preference.diff cmorve69@yahoo.es -- Add InitialPreference to set it as the default video player
Patch3: initial-preference.diff
# PATCH-FIX-OPENSUSE build-fix.diff -- Build fix for old qt versions
Patch4: build-fix.diff
# PATCH-FIX-OPENSUSE support_mimetypes_bnc671581.diff bnc#671581 ctrippe@gmx.net -- Support audio/webm and video/x-theora+ogg
Patch5: support_mimetypes_bnc671581.diff
# PATCH-FIX-UPSTREAM
Patch6: crash-on-resume-fix.patch
# PATCH-FIX-UPSTREAM kaffeine-gcc47.patch dimstar@opensuse.org -- Fix build with gcc 4.7
Patch7: kaffeine-gcc47.patch
# PATCH-FEATURE-UPSTREAM support_for_sundtek_tv_tuners.patch boo#827097 -- Add support for Sundtek DVB Devices
Patch8: support_for_sundtek_tv_tuners.patch
#PATCH-FIX-UPSTREAM kaffeine-cmake34.patch -- Include files containing the functions used by the build system
Patch9: kaffeine-cmake34.patch
# PATCH-FIX-UPSTREAM kaffeine-gcc6.patch boo#985371 wbauer@tmo.at -- fix build with gcc6
Patch10: kaffeine-gcc6.patch
Recommends: %{name}-lang = %version
Requires: libQt5Sql5-sqlite
Requires(post): hicolor-icon-theme
Requires(post): update-desktop-files
Requires(postun): hicolor-icon-theme
Requires(postun): update-desktop-files
BuildRequires: extra-cmake-modules
BuildRequires: cmake(KF5CoreAddons)
BuildRequires: cmake(KF5DBusAddons)
BuildRequires: cmake(KF5DocTools)
BuildRequires: cmake(KF5I18n)
BuildRequires: cmake(KF5KIO)
BuildRequires: cmake(KF5Solid)
BuildRequires: cmake(KF5WidgetsAddons)
BuildRequires: cmake(KF5XmlGui)
%if 0%{?suse_version} > 1320
BuildRequires: pkgconfig(libdvbv5)
%endif
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Network)
BuildRequires: pkgconfig(Qt5Sql)
BuildRequires: pkgconfig(Qt5Widgets)
BuildRequires: pkgconfig(Qt5X11Extras)
BuildRequires: pkgconfig(libvlc) >= 2.2.0
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(xscrnsaver)
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: libkde4-devel
%if 0%{?suse_version} > 1120
BuildRequires: libksuseinstall-devel
%endif
BuildRequires: libxine-devel
%if 0%{?suse_version}
BuildRequires: update-desktop-files
%endif
Requires: libqt4-sql-sqlite
Provides: kaffeine-lang = %version
Obsoletes: kaffeine-lang < %version
%kde4_runtime_requires
%description
Kaffeine plays all files and devices supported by Xine. For example,
MPEG files, AVI (if the codec being used is supported by Xine), MP3,
and Ogg Vorbis. It also handles Video CDs, DVDs, and DVB cards.
Kaffeine is a media player.
What makes it different from the others is its excellent support of digital TV (DVB).
Kaffeine has user-friendly interface, so that even first time users can start immediately
playing their movies: from DVD (including DVD menus, titles, chapters, etc.), VCD, or a file.
%lang_package
%prep
%setup -q -b 1
%setup -q
%patch0
%if 0%{?suse_version} > 1120
%patch2
%endif
%patch3
%if 0%{?kde_updatedapps}
%patch4 -p0
%endif
%if 0%{?suse_version} > 1130
%patch5
%endif
%patch6 -p1
%patch7
%patch8 -p1
%patch9 -p1
%patch10 -p1
%build
%cmake_kde4 -d build
%cmake_kf5 -d build
%make_jobs
%install
pushd build
%kde4_makeinstall
popd
%kf5_makeinstall -C build
%if 0%{?suse_version}
# place desktop entry in video and tv
%suse_update_desktop_file -r %{name} Qt KDE AudioVideo Video Player TV
%endif
%suse_update_desktop_file -r org.kde.%{name} Qt KDE AudioVideo Video Player TV
# symlink solid actions into place known to Plasma 5
mkdir -p %{buildroot}%{_datadir}/solid/actions
pushd %{buildroot}%{_kde4_appsdir}/solid/actions/
for i in kaffeine_*.desktop; do
ln -s %{_kde4_appsdir}/solid/actions/$i %{buildroot}%{_datadir}/solid/actions/
done
popd
%find_lang %{name} --without-kde
%kde_post_install
%post
%desktop_database_post
%icon_theme_cache_post
# Removed unneeded locales
%if 0%{?suse_version} && 0%{?suse_version} < 1140
rm -rf %{buildroot}%{_datadir}/locale/ast/LC_MESSAGES/
rm -rf %{buildroot}%{_datadir}/locale/sr@ijekavian/
rm -rf %{buildroot}%{_datadir}/locale/sr@ijekavianlatin/
%endif
%postun
%desktop_database_postun
%icon_theme_cache_postun
%find_lang %{name}
%clean
rm -rf %{buildroot}
%files -f %{name}.lang
%defattr(-,root,root,-)
%files
%defattr(-,root,root)
%doc COPYING COPYING-DOCS Changelog NOTES
%{_kde4_bindir}/kaffeine
%{_kde4_bindir}/kaffeine-xbu
%{_kde4_applicationsdir}/kaffeine.desktop
%{_kde4_iconsdir}/hicolor/*/apps/kaffeine.*
%{_kde4_iconsdir}/oxygen/*/actions/audio-radio-encrypted.*
%{_kde4_iconsdir}/oxygen/*/actions/video-television-encrypted.*
%{_kde4_appsdir}/kaffeine/
%dir %{_kde4_appsdir}/profiles
%{_kde4_appsdir}/profiles/kaffeine.profile.xml
%dir %{_kde4_appsdir}/solid
%dir %{_kde4_appsdir}/solid/actions
%{_kde4_appsdir}/solid/actions/kaffeine_play_audiocd.desktop
%{_kde4_appsdir}/solid/actions/kaffeine_play_dvd.desktop
%{_kde4_appsdir}/solid/actions/kaffeine_play_videocd.desktop
%dir %{_datadir}/solid
%dir %{_datadir}/solid/actions
%{_datadir}/solid/actions/kaffeine_*.desktop
%{_kf5_bindir}/dtvdaemon
%{_kf5_bindir}/kaffeine
%if 0%{?sle_version} == 120100
%dir %{_kf5_sharedir}/appdata
%endif
%{_kf5_sharedir}/appdata/org.kde.kaffeine.appdata.xml
%{_kf5_applicationsdir}/org.kde.kaffeine.desktop
%{_kf5_iconsdir}/hicolor/*/*/*
%{_kf5_sharedir}/kaffeine/
%{_kf5_sharedir}/profiles/
%{_kf5_sharedir}/solid/actions/
%{_kf5_htmldir}/
%{_kf5_mandir}/man1/*
%dir %{_kf5_mandir}/uk
%{_kf5_mandir}/*/man1/
%files lang -f %{name}.lang
%changelog

View File

@ -1,153 +0,0 @@
--- src/CMakeLists.txt 2010/07/07 18:16:03 1.1
+++ src/CMakeLists.txt 2010/07/07 18:17:30
@@ -42,6 +42,7 @@
kde4_add_executable(kaffeine ${kaffeinedvb_SRCS} ${kaffeine_SRCS})
target_link_libraries(kaffeine ${QT_QTSQL_LIBRARY} ${KDE4_KFILE_LIBS} ${KDE4_KIO_LIBS} ${KDE4_SOLID_LIBS} ${X11_Xscreensaver_LIB})
+target_link_libraries(kaffeine ksuseinstall)
install(TARGETS kaffeine ${INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES scanfile.dvb DESTINATION ${DATA_INSTALL_DIR}/kaffeine)
install(PROGRAMS kaffeine.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
--- src/backend-xine/xinecommands.h 2010/07/07 18:15:59 1.1
+++ src/backend-xine/xinecommands.h 2010/07/07 18:16:08
@@ -59,7 +59,8 @@
UpdateAngles = 11,
UpdateMouseTracking = 12,
UpdateMouseCursor = 13,
- UpdateVideoSize = 14
+ UpdateVideoSize = 14,
+ SupportedMimeTypes = 15
};
}
@@ -351,6 +352,13 @@
reinterpret_cast<const char *>(&videoSize), sizeof(videoSize));
}
+ void supportedMimeTypes(const QString& mime)
+ {
+ writer->write(XineCommands::SupportedMimeTypes,
+ reinterpret_cast<const char *>(mime.constData()),
+ static_cast<unsigned int>(mime.size()) * sizeof(QChar));
+ }
+
XinePipeWriterBase *writer;
};
--- src/backend-xine/xinemediawidget.cpp.sav 2010-09-27 16:08:49.648890045 -0600
+++ src/backend-xine/xinemediawidget.cpp 2010-09-27 16:21:39.342889627 -0600
@@ -22,12 +22,16 @@
#include "xinemediawidget_p.h"
#include <QResizeEvent>
+#include <QTimer>
#include <KDebug>
+#include <KLocale>
#include <KMessageBox>
#include <config-kaffeine.h>
#include <errno.h>
#include <unistd.h>
+#include <ksuseinstall.h>
+
static QString binInstallPath()
{
return QString::fromUtf8(KAFFEINE_BIN_INSTALL_DIR "/");
@@ -213,6 +217,15 @@
break;
}
+ case XineCommands::SupportedMimeTypes: {
+ QString mime = reader->readString();
+
+ if (reader->isValid()) {
+ parent->supportedMimeTypes(mime);
+ }
+
+ break;
+ }
default:
kError() << "unknown command" << command;
continue;
@@ -844,6 +857,45 @@
}
}
+void XineMediaWidget::supportedMimeTypes(const QString &mime)
+{
+ // This is a bit lame, but simply check for a mimetype that the crippled package
+ // does not provide.
+ foreach( const QString& item, mime.split( ';' )) {
+ QStringList fields = item.split( ':' );
+ if( fields.count() == 3 ) {
+ if( fields.first() == "audio/mp3" ) {
+ return; // ok
+ }
+ }
+ }
+ QTimer::singleShot( 0, this, SLOT( installAdditionalCodecs()));
+}
+
+void XineMediaWidget::installAdditionalCodecs()
+{
+ KGuiItem installGuiItem( KStandardGuiItem::yes());
+ installGuiItem.setText( i18nc( "@action:button", "Install" ));
+ if( KMessageBox::warningYesNo( window(),
+ i18n( "Kaffeine currently cannot play some file formats. Do you want to install additional support?" ),
+ i18n( "Install Additional Codecs" ),
+ installGuiItem, KStandardGuiItem::no(), "suse_additional_codecs" ) != KMessageBox::Yes )
+ {
+ return;
+ }
+ if( KSUSEInstall::installCapabilities( QStringList() << "libxine2-codecs",
+ KSUSEInstall::FullInstallRequired, window()))
+ { // TODO use the items
+ KGuiItem restartNowGuiItem( KStandardGuiItem::yes());
+ restartNowGuiItem.setText( i18nc( "@action:button", "Restart Now" ));
+ KGuiItem restartLaterGuiItem( KStandardGuiItem::no());
+ restartLaterGuiItem.setText( i18nc( "@action:button", "Restart Later" ));
+ KMessageBox::information( window(),
+ i18n( "The necessary support has been successfully installed."
+ " It may be necessary to restart the application for the support to be activated." ));
+ }
+}
+
void XineMediaWidget::playEncodedUrl(const QByteArray &encodedUrl, StateFlags stateFlags)
{
++sequenceNumber;
--- src/backend-xine/xinemediawidget.h.sav 2010-01-31 18:04:50.000000000 +0100
+++ src/backend-xine/xinemediawidget.h 2010-04-14 14:31:17.301512132 +0200
@@ -127,6 +127,9 @@ public:
Q_DECLARE_FLAGS(DirtyFlags, DirtyFlag)
+private slots:
+ void installAdditionalCodecs();
+
private:
void mouseMoveEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
@@ -149,6 +152,7 @@ private:
void updateMouseTracking(bool mouseTrackingEnabled);
void updateMouseCursor(bool pointingMouseCursor);
void updateVideoSize(unsigned int videoSize_);
+ void supportedMimeTypes(const QString &mime);
void playEncodedUrl(const QByteArray &encodedUrl, StateFlags stateFlags = 0);
void stateChanged();
--- src/backend-xine/xineapplication.cpp.sav 2010-09-27 16:30:01.619888519 -0600
+++ src/backend-xine/xineapplication.cpp 2010-09-27 16:39:05.239888392 -0600
@@ -295,7 +295,11 @@
xine_config_load(engine,
QFile::encodeName(KStandardDirs::locateLocal("data", "kaffeine/xine-config")));
xine_init(engine);
-
+
+ if( char* mimes = xine_get_mime_types( engine )) {
+ parentProcess->supportedMimeTypes( mimes );
+ }
+
QVector<const char *> audioDrivers;
audioDrivers.append("auto");

View File

@ -1,315 +0,0 @@
From: Jonathan Riddell <jr@jriddell.org>
Date: Wed, 03 Dec 2014 14:23:17 +0000
Subject: Support for Sundtek TV Tuners (Networkbased and local devices)
X-Git-Url: http://quickgit.kde.org/?p=kaffeine.git&a=commitdiff&h=333ba6c927df747b61d8ba25b097741ac353dfc2
---
Support for Sundtek TV Tuners (Networkbased and local devices)
The attached patch only adds support for our new tuners which can be
network based or locally. Due the different architecture there is no
need for additional kernel drivers.
The change does not affect legacy devices.
by Markus Rechberger kontakt@sundtek.de
REVIEW:120583
---
--- a/src/dvb/dvbdevice_linux.cpp
+++ b/src/dvb/dvbdevice_linux.cpp
@@ -29,7 +29,15 @@
#include <fcntl.h>
#include <frontend.h>
#include <poll.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <sys/types.h>
#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <sys/inotify.h>
+#include <vector>
+#include <stdlib.h>
#include <unistd.h>
#include "dvbtransponder.h"
@@ -808,15 +816,179 @@
}
}
+struct dvbdev {
+ time_t stctime;
+ char checked;
+ char adapter_name[50];
+ char node_name[75];
+ int adapternum;
+ char lnode[20];
+};
+
+class DvbDeviceMonitor : public QThread
+{
+public:
+ DvbDeviceMonitor(DvbLinuxDeviceManager *ddm)
+ {
+ this->ddm = ddm;
+ }
+ ~DvbDeviceMonitor()
+ {
+ }
+ void run() {
+ DIR *dvbdir, *adapterdirp;
+ struct dirent *dp, *dp2;
+ struct stat stbuf;
+ int adapter;
+ int rescan=0;
+ int rv;
+ int ifd;
+ int found=0;
+ char adapterdir[50];
+ char nodename[75];
+ char buffer[1024];
+ struct pollfd pfd;
+ char firstrun_complete=0;
+ std::vector<struct dvbdev*>adapterlist;
+ std::vector<struct dvbdev*>::iterator iter;
+
+ runstate = 1;
+
+ ifd = inotify_init();
+ inotify_add_watch(ifd, "/dev/dvb", IN_CREATE|IN_DELETE);
+ fcntl(ifd, F_SETFL, O_NONBLOCK);
+ pfd.fd = ifd;
+ pfd.events = POLLIN;
+
+ while(runstate) {
+ if (firstrun_complete) {
+ rv = poll(&pfd, 1, 100);
+ switch (rv) {
+ case -1:
+ break;
+ case 0:
+ continue;
+ default:
+ usleep(100000); /* give it some time to settle down */
+ while(read(ifd, buffer, 1024)>0);
+ break;
+ }
+ } else {
+ firstrun_complete=1;
+ }
+
+ dvbdir = opendir("/dev/dvb");
+ for (iter=adapterlist.begin();iter!=adapterlist.end();iter++) {
+ (*iter)->checked=0;
+ }
+ if (dvbdir) {
+ while((dp=readdir(dvbdir))!= 0) {
+ if (strcmp(dp->d_name, ".") == 0 ||
+ strcmp(dp->d_name, "..") == 0)
+ continue;
+ adapter = strtol(&dp->d_name[7], NULL, 10);
+ sprintf(adapterdir, "/dev/dvb/%s", dp->d_name);
+ adapterdirp = opendir(adapterdir);
+ if (adapterdirp) {
+ while((dp2=readdir(adapterdirp))!=0) {
+ found=0;
+ if (strcmp(dp2->d_name, ".")==0 ||
+ strcmp(dp2->d_name, "..")==0)
+ continue;
+ sprintf(nodename, "/dev/dvb/%s/%s", dp->d_name, dp2->d_name);
+ rv = stat(nodename, &stbuf);
+ for (iter=adapterlist.begin();iter!=adapterlist.end();iter++) {
+ if (strcmp((*iter)->node_name, nodename)==0 && (*iter)->stctime == stbuf.st_ctime) {
+ (*iter)->checked=1;
+ found=1;
+ break;
+ }
+ }
+ if (found == 0) {
+ struct dvbdev *dvbdev = (struct dvbdev*)calloc(1, sizeof(struct dvbdev));
+ dvbdev->checked=1;
+ dvbdev->stctime = stbuf.st_ctime;
+ strcpy(dvbdev->adapter_name, dp->d_name);
+ strcpy(dvbdev->node_name, nodename);
+ dvbdev->adapternum = adapter;
+ strcpy(dvbdev->lnode, dp2->d_name);
+ adapterlist.push_back(dvbdev);
+ ddm->componentAdded(dp2->d_name, adapter, 0);
+ }
+
+ }
+ closedir(adapterdirp);
+ }
+ }
+ closedir(dvbdir);
+ }
+ do {
+ rescan=0;
+ for (iter=adapterlist.begin();iter!=adapterlist.end();iter++) {
+ if ((*iter)->checked==0) {
+ ddm->componentRemoved((*iter)->lnode, (*iter)->adapternum, 0);
+ free(*iter);
+ adapterlist.erase(iter);
+ rescan=1;
+ break;
+ }
+ }
+ } while (rescan!=0);
+ }
+ }
+ void stop() {
+ runstate = 0;
+ wait();
+ }
+private:
+ int runstate;
+ DvbLinuxDeviceManager *ddm;
+};
+
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun)
+#define MACHADDRESS "/tmp/.mediasocket"
+#else
+#define ADDRESS "/de/sundtek/mediasocket" /* addr to connect */
+#endif
+
DvbLinuxDeviceManager::DvbLinuxDeviceManager(QObject *parent) : QObject(parent)
{
+ int fd;
+ int len;
+ int ret;
+ struct sockaddr_un saun;
QObject *notifier = Solid::DeviceNotifier::instance();
connect(notifier, SIGNAL(deviceAdded(QString)), this, SLOT(componentAdded(QString)));
connect(notifier, SIGNAL(deviceRemoved(QString)), this, SLOT(componentRemoved(QString)));
+
+ memset(&saun, 0x0, sizeof(struct sockaddr_un));
+ fd = socket(AF_UNIX, SOCK_STREAM, 0);
+ if (fd==-1) {
+ monitor = NULL;
+ return;
+ }
+ saun.sun_family = AF_UNIX;
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun)
+ strcpy(saun.sun_path, MACHADDRESS);
+ len = sizeof(saun.sun_family) + strlen(saun.sun_path)+1;
+#else
+ strcpy(&saun.sun_path[1], ADDRESS);
+ len = sizeof(saun.sun_family) + strlen(&saun.sun_path[1])+1;
+#endif
+ if ((ret=::connect(fd, (struct sockaddr*)&saun, len)) < 0) {
+ close(fd);
+ monitor = NULL;
+ return;
+ }
+ close(fd);
+ monitor = new DvbDeviceMonitor(this);
+ monitor->start();
}
DvbLinuxDeviceManager::~DvbLinuxDeviceManager()
{
+ if (monitor)
+ monitor->stop();
}
void DvbLinuxDeviceManager::doColdPlug()
@@ -824,6 +996,36 @@
foreach (const Solid::Device &device,
Solid::Device::listFromType(Solid::DeviceInterface::DvbInterface)) {
componentAdded(device.udi());
+ }
+}
+
+void DvbLinuxDeviceManager::componentAdded(QString node, int adapter, int index) {
+ int deviceIndex = (adapter << 16) | index;
+ char adapterstring[10];
+ DvbLinuxDevice *device = devices.value(deviceIndex, NULL);
+ if (device == NULL) {
+ device = new DvbLinuxDevice(this);
+ devices.insert(deviceIndex, device);
+ }
+ sprintf(adapterstring, "adapter%d", adapter);
+
+ if (node == "frontend0") {
+ device->frontendPath.sprintf("/dev/dvb/%s/%s", adapterstring, node.toAscii().data());
+ } else if (node == "dvr0") {
+ device->dvrPath.sprintf("/dev/dvb/%s/%s", adapterstring, node.toAscii().data());
+ } else if (node == "demux0") {
+ device->demuxPath.sprintf("/dev/dvb/%s/%s", adapterstring, node.toAscii().data());
+ } else {
+ return;
+ }
+
+ if (!device->demuxPath.isEmpty() && !device->dvrPath.isEmpty() &&
+ !device->frontendPath.isEmpty()) {
+ device->startDevice("");
+
+ if (device->isReady()) {
+ emit deviceAdded(device);
+ }
}
}
@@ -941,6 +1143,31 @@
if (device->isReady()) {
emit deviceAdded(device);
}
+ }
+}
+
+void DvbLinuxDeviceManager::componentRemoved(QString node, int adapter, int index) {
+ int deviceIndex = (adapter << 16) | index;
+ char adapterstring[10];
+ DvbLinuxDevice *device = devices.value(deviceIndex, NULL);
+ if (device == NULL) {
+ return;
+ }
+ sprintf(adapterstring, "adapter%d", adapter);
+ if (node == "frontend0") {
+ device->frontendPath.clear();
+ } else if (node == "dvr0") {
+ device->dvrPath.clear();
+ } else if (node == "demux0") {
+ device->demuxPath.clear();
+ } else {
+ return;
+ }
+
+ if (device->frontendPath.isEmpty() && device->dvrPath.isEmpty() &&
+ device->demuxPath.isEmpty() && device->isReady()) {
+ emit deviceRemoved(device);
+ device->stopDevice();
}
}
--- a/src/dvb/dvbdevice_linux.h
+++ b/src/dvb/dvbdevice_linux.h
@@ -90,6 +90,7 @@
DvbLinuxCam cam;
};
+class DvbDeviceMonitor;
class DvbLinuxDeviceManager : public QObject
{
Q_OBJECT
@@ -97,6 +98,8 @@
explicit DvbLinuxDeviceManager(QObject *parent);
~DvbLinuxDeviceManager();
+ void componentAdded(QString node, int adapter, int index);
+ void componentRemoved(QString node, int adapter, int index);
public slots:
void doColdPlug();
@@ -114,6 +117,7 @@
QMap<int, DvbLinuxDevice *> devices;
QMap<QString, DvbLinuxDevice *> udis;
+ class DvbDeviceMonitor *monitor;
};
#endif /* DVBDEVICE_LINUX_H */

View File

@ -1,11 +0,0 @@
--- src/kaffeine.desktop 2010-09-01 21:53:54.000000000 +0200
+++ src/kaffeine.desktop_patched 2011-02-15 21:51:59.000000000 +0100
@@ -103,7 +103,7 @@
GenericName[zh_TW]=媒體播放器
Categories=Qt;KDE;AudioVideo;Player;
Icon=kaffeine
-MimeType=application/ogg;application/ram;application/vnd.rn-realmedia;application/x-quicktime-media-link;application/x-shorten;application/xspf+xml;audio/ac3;audio/basic;audio/flac;audio/mp4;audio/mpeg;audio/ogg;audio/vnd.rn-realaudio;audio/x-aiff;audio/x-it;audio/x-m4b;audio/x-matroska;audio/x-mod;audio/x-mpegurl;audio/x-ms-asx;audio/x-ms-wma;audio/x-musepack;audio/x-s3m;audio/x-scpls;audio/x-stm;audio/x-tta;audio/x-voc;audio/x-wav;audio/x-wavpack;audio/x-xm;video/dv;video/mp2t;video/mp4;video/mpeg;video/ogg;video/quicktime;video/vnd.rn-realvideo;video/x-anim;video/x-flic;video/x-flv;video/x-matroska;video/x-mng;video/x-ms-asf;video/x-ms-wmv;video/x-msvideo;video/x-nsv;video/x-ogm+ogg;
+MimeType=application/ogg;application/ram;application/vnd.rn-realmedia;application/x-quicktime-media-link;application/x-shorten;application/xspf+xml;audio/ac3;audio/basic;audio/mp4;audio/mpeg;audio/ogg;audio/vnd.rn-realaudio;audio/x-aiff;audio/x-flac;audio/x-it;audio/x-m4b;audio/x-matroska;audio/x-mod;audio/x-mpegurl;audio/x-ms-asx;audio/x-ms-wma;audio/x-musepack;audio/x-s3m;audio/x-scpls;audio/x-speex;audio/x-stm;audio/x-tta;audio/x-voc;audio/x-wav;audio/x-wavpack;audio/x-xm;video/dv;video/mp2t;video/mp4;video/mpeg;video/ogg;video/quicktime;video/vnd.rn-realvideo;video/x-anim;video/x-flic;video/x-flv;video/x-matroska;video/x-mng;video/x-ms-asf;video/x-ms-wmv;video/x-msvideo;video/x-nsv;video/x-ogm+ogg;video/x-theora+ogg;audio/webm;
Terminal=false
Type=Application
X-KDE-HasTempFileOption=true