| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
#ifndef H_YOUTUBE_VIDEO |
| 14 |
#define H_YOUTUBE_VIDEO |
| 15 |
|
| 16 |
#include <smooth.h> |
| 17 |
#include <boca.h> |
| 18 |
|
| 19 |
using namespace smooth; |
| 20 |
|
| 21 |
using namespace BoCA; |
| 22 |
|
| 23 |
#include "videosite.h" |
| 24 |
|
| 25 |
namespace BoCA |
| 26 |
{ |
| 27 |
class Video |
| 28 |
{ |
| 29 |
private: |
| 30 |
static Int activeDownloads; |
| 31 |
|
| 32 |
Threads::Mutex downloadMutex; |
| 33 |
|
| 34 |
VideoSite *videoSite; |
| 35 |
|
| 36 |
String videoURL; |
| 37 |
String videoPageHTML; |
| 38 |
|
| 39 |
String videoFile; |
| 40 |
String videoDecoder; |
| 41 |
|
| 42 |
String videoTitle; |
| 43 |
String videoDescription; |
| 44 |
|
| 45 |
String videoUploader; |
| 46 |
String videoDate; |
| 47 |
|
| 48 |
String videoThumbnailURL; |
| 49 |
Picture videoThumbnail; |
| 50 |
|
| 51 |
Bool pageDownloaded; |
| 52 |
Bool metadataQueried; |
| 53 |
|
| 54 |
Bool videoDownloadStarted; |
| 55 |
Bool videoDownloadFinished; |
| 56 |
|
| 57 |
Bool doCancelDownload; |
| 58 |
|
| 59 |
Int DownloaderThread(String); |
| 60 |
|
| 61 |
Bool DownloadPage(); |
| 62 |
public: |
| 63 |
Video(VideoSite *); |
| 64 |
~Video(); |
| 65 |
|
| 66 |
Bool QueryMetadata(); |
| 67 |
const String &GetDecoderID(); |
| 68 |
|
| 69 |
Bool Download(); |
| 70 |
Bool CancelDownload(); |
| 71 |
accessors: |
| 72 |
Bool IsDownloadStarted() const { return videoDownloadStarted; } |
| 73 |
Bool IsDownloadFinished() const { return videoDownloadFinished; } |
| 74 |
|
| 75 |
Bool IsDownloadCancelled() const { return doCancelDownload; } |
| 76 |
|
| 77 |
Bool SetVideoURL(const String &nVideoURL) { videoURL = nVideoURL; return True; } |
| 78 |
const String &GetVideoURL() const { return videoURL; } |
| 79 |
|
| 80 |
Bool SetVideoFile(const String &nVideoFile) { videoFile = nVideoFile; return True; } |
| 81 |
const String &GetVideoFile() const { return videoFile; } |
| 82 |
|
| 83 |
const String &GetVideoSiteName() const { return videoSite->GetName(); } |
| 84 |
|
| 85 |
const String &GetVideoTitle() const { return videoTitle; } |
| 86 |
const String &GetVideoDescription() const { return videoDescription; } |
| 87 |
|
| 88 |
const String &GetVideoUploader() const { return videoUploader; } |
| 89 |
const String &GetVideoDate() const { return videoDate; } |
| 90 |
|
| 91 |
const String &GetVideoThumbnailURL() const { return videoThumbnailURL; } |
| 92 |
const Picture &GetVideoThumbnail() const { return videoThumbnail; } |
| 93 |
signals: |
| 94 |
Signal1<Void, Int> downloadProgress; |
| 95 |
Signal1<Void, const String &> downloadSpeed; |
| 96 |
|
| 97 |
Signal1<Void, Video *> startDownload; |
| 98 |
Signal1<Void, Video *> finishDownload; |
| 99 |
slots: |
| 100 |
Bool DoCancelDownload() { return doCancelDownload; } |
| 101 |
}; |
| 102 |
}; |
| 103 |
|
| 104 |
#endif |