KBYTDownloadStream.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //
  2. // KBYTDownloadStream.h
  3. // Seas0nPass
  4. //
  5. // Created by Kevin Bradley on 3/9/07.
  6. // Copyright 2007 nito, LLC. All rights reserved.
  7. //
  8. #import "KBYourTube.h"
  9. #import "URLDownloader.h"
  10. /**
  11. This class is used for downloading files from youtube, it takes care of fixing and multiplexing streams when necessary
  12. feed it a stream into downloadStream method and it will take care of the rest.
  13. */
  14. @protocol KBYTDownloadStreamDelegate
  15. - (void)downloadFinished:(NSString *)downloadFile;
  16. - (void)downloadFailed:(NSString *)downloadFile;
  17. - (void)setDownloadProgress:(double)theProgress;
  18. @end
  19. @interface KBYTDownloadStream : NSObject <URLDownloaderDelegate> {
  20. //NSURLDownload *urlDownload;
  21. NSURLResponse *myResponse;
  22. float bytesReceived;
  23. NSString *downloadLocation;
  24. long long updateFrequency;
  25. long long freq;
  26. KBYTStream *audioStream;
  27. NSString *videoDownloadLocation;
  28. }
  29. @property (retain) URLDownloader *downloader;
  30. @property (strong, atomic) void (^ProgressBlock)(double percentComplete);
  31. @property (strong, atomic) void (^FancyProgressBlock)(double percentComplete, NSString *status);
  32. @property (strong, atomic) void (^CompletedBlock)(NSString *downloadedFile);
  33. typedef void(^DownloadProgressBlock)(double percentComplete);
  34. typedef void(^FancyDownloadProgressBlock)(double percentComplete, NSString *downloadedFile);
  35. typedef void(^DownloadCompletedBlock)(NSString *downloadedFile);
  36. @property (nonatomic, retain) NSString *downloadLocation;
  37. @property (readwrite, assign) NSInteger downloadMode; //0 = muxed file, 1 = demuxed tracks
  38. - (void)downloadStream:(KBYTStream *)inputStream
  39. progress:(FancyDownloadProgressBlock)progressBlock
  40. completed:(DownloadCompletedBlock)completedBlock;
  41. - (long long)updateFrequency;
  42. - (void)setUpdateFrequency:(long long)newUpdateFrequency;
  43. - (void)setDownloadResponse:(NSURLResponse *)response;
  44. - (void)cancel;
  45. @end