[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/network/ktorrent
From:       Joris Guisson <joris.guisson () gmail ! com>
Date:       2010-10-04 17:03:59
Message-ID: 20101004170359.5D62DAC892 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1182464 by guisson:

Finish basic video streaming support

BUG: 234212

 M  +1 -0      ChangeLog  
 M  +1 -0      plugins/mediaplayer/CMakeLists.txt  
 M  +10 -8     plugins/mediaplayer/mediafile.cpp  
 M  +4 -2      plugins/mediaplayer/mediafile.h  
 A             plugins/mediaplayer/mediafilestream.cpp   [License: GPL (v2+)]
 A             plugins/mediaplayer/mediafilestream.h   [License: GPL (v2+)]


--- trunk/extragear/network/ktorrent/ChangeLog #1182463:1182464
@@ -23,6 +23,7 @@
 - Add exclusion patterns to syndication plugin filters (251141)
 - Show current upload and download limit in trayicon submenus instead of limits from \
                the settings (251953)
 - Show notifications when automatic update of IP filter fails (243458)
+- Add video streaming support (234212)
 
 Changes in 4.0.4:
 - Make sure that syndication filter save location overrides group save location \
                (250116)
--- trunk/extragear/network/ktorrent/plugins/mediaplayer/CMakeLists.txt \
#1182463:1182464 @@ -9,6 +9,7 @@
 	mediaview.cpp 
 	mediamodel.cpp 
 	mediafile.cpp 
+	mediafilestream.cpp 
 	mediaplayer.cpp 
 	videowidget.cpp
 )
--- trunk/extragear/network/ktorrent/plugins/mediaplayer/mediafile.cpp \
#1182463:1182464 @@ -19,12 +19,12 @@
  ***************************************************************************/
 
 #include "mediafile.h"
+#include <QFile>
 #include <QStringList>
 #include <interfaces/torrentinterface.h>
 #include <interfaces/torrentfileinterface.h>
-#include <torrent/torrentfilestream.h>
 #include <util/functions.h>
-#include <QFile>
+#include "mediafilestream.h"
 
 
 namespace kt
@@ -173,9 +173,12 @@
 		}
 	}
 
-	bt::TorrentFileStream* MediaFile::stream(QObject* parent)
+	bt::TorrentFileStream::WPtr MediaFile::stream(QObject* parent)
 	{
-		return tc->createTorrentFileStream(idx,parent);
+		if (!tfs)
+			tfs = bt::TorrentFileStream::Ptr(tc->createTorrentFileStream(idx,parent));
+		
+		return bt::TorrentFileStream::WPtr(tfs);
 	}
 	
 	///////////////////////////////////////////////////////
@@ -219,16 +222,15 @@
 	
 	Phonon::MediaSource MediaFileRef::createMediaSource()
 	{
-		#if 0
 		MediaFile::Ptr mf = mediaFile();
-		if (mf)
+		if (mf && !mf->fullyAvailable())
 		{
-			Phonon::MediaSource ms(mf->stream(0));
+			MediaFileStream* stream = new MediaFileStream(mf->stream(0));
+			Phonon::MediaSource ms(stream);
 			ms.setAutoDelete(true);
 			return ms;
 		}
 		else
-			#endif
 			return Phonon::MediaSource(file_path);
 	}
 
--- trunk/extragear/network/ktorrent/plugins/mediaplayer/mediafile.h #1182463:1182464
@@ -26,6 +26,7 @@
 #include <QSharedPointer>
 #include <Phonon/MediaSource>
 #include <util/constants.h>
+#include <torrent/torrentfilestream.h>
 
 
 class QObject;
@@ -93,14 +94,15 @@
 		/// Get the last chunk of the file
 		bt::Uint32 lastChunk() const;
 		
-		/// Create a TorrentFileStream object for this MediaFile
-		bt::TorrentFileStream* stream(QObject* parent);
+		/// Create a TorrentFileStream object for this MediaFile and return a weak pointer \
to it +		bt::TorrentFileStream::WPtr stream(QObject* parent);
 		
 		typedef QSharedPointer<MediaFile> Ptr;
 		typedef QWeakPointer<MediaFile> WPtr;
 	private:
 		bt::TorrentInterface* tc;
 		bt::Uint32 idx;
+		bt::TorrentFileStream::Ptr tfs;
 	};
 	
 	/**


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic