目前国内的视频播放器中,支持 DLNA 播放比较好的是:腾讯视频。

刚才反编了一下他们的代码,发现使用了一个开源库,

地址:https://github.com/FuruyamaTakeshi/DLNA

并且在这个库的基础了做了一层封装,包含如下几个类:

DLNAController:

 @class CGUpnpAvController, CGUpnpAvRenderer, QLUpnpAVVolumeInfo, NSMutableArray, QLUpnpAVPositionInfo, NSString, NSTimer;
@protocol DLNAControllerDelegate; @interface DLNAController : XXUnknownSuperclass <CGUpnpControlPointDelegate> {
@private
dispatch_queue_s* _playQueue; // 4 = 0x4
dispatch_queue_s* _searchQueue; // 8 = 0x8
CGUpnpAvRenderer* _dlnaPlayingRender; // 12 = 0xc
CGUpnpAvRenderer* _dlnaSelectedRender; // 16 = 0x10
CGUpnpAvController* _upnpAvController; // 20 = 0x14
NSMutableArray* _dlnaRenders; // 24 = 0x18
NSTimer* _timerLoadInfos; // 28 = 0x1c
BOOL _isSettingVolume; // 32 = 0x20
BOOL _isSettingSeek; // 33 = 0x21
id<DLNAControllerDelegate> delegate; // 36 = 0x24
float _trackDuration; // 40 = 0x28
float _curPlayTime; // 44 = 0x2c
float _volumePercentage; // 48 = 0x30
NSString* _curRenderName; // 52 = 0x34
unsigned _fileSize; // 56 = 0x38
QLUpnpAVPositionInfo* _positionInfo; // 60 = 0x3c
QLUpnpAVVolumeInfo* _volumeInfo; // 64 = 0x40
NSString* _curTitle; // 68 = 0x44
}
@property(retain) QLUpnpAVPositionInfo* positionInfo; // G=0x1ecead; S=0x1ecec5;
@property(retain) QLUpnpAVVolumeInfo* volumeInfo; // G=0x1ecee9; S=0x1ecf01;
@property(readonly, assign) int dlnaRendersCount; // G=0x1eabf5;
@property(readonly, assign) float volumePercentage; // G=0x1eae41;
@property(readonly, assign) float curPlayTime; // G=0x1ead59;
@property(readonly, assign) float trackDuration; // G=0x1eadcd;
@property(readonly, assign) NSString* curRenderName; // G=0x1eacc1;
@property(copy) NSString* curTitle; // G=0x1ecf25; S=0x1ecf3d;
@property(assign) unsigned fileSize; // G=0x1ece81; S=0x1ece95;
@property(assign) id<DLNAControllerDelegate> delegate; // G=0x1ece55; S=0x1ece69;
+(id)sharedDLNAController; // 0x1ea329
-(void)didFindRendersMain:(id)main; // 0x1ecdfd
-(void)maitainConnectionMain:(id)main; // 0x1ecdb5
-(void)loseConnectionMain:(id)main; // 0x1eccc1
-(void)mainPlayStop:(id)stop; // 0x1ecc65
-(void)mainPlayFailed:(id)failed; // 0x1ecc1d
-(void)mainPlayDown:(id)down; // 0x1ecbc1
-(BOOL)setVolume:(float)volume skipIfBusy:(BOOL)busy; // 0x1eca55
-(BOOL)seek:(double)seek; // 0x1ec8f9
-(BOOL)quit; // 0x1ec719
-(BOOL)stop; // 0x1ec5ed
-(BOOL)pause; // 0x1ec4d1
-(BOOL)play; // 0x1ec341
-(BOOL)isPlaying; // 0x1ec305
-(void)controlPoint:(id)point deviceInvalid:(id)invalid; // 0x1ec301
-(void)controlPoint:(id)point deviceUpdated:(id)updated; // 0x1ec2fd
-(void)controlPoint:(id)point deviceRemoved:(id)removed; // 0x1ebfa1
-(void)controlPoint:(id)point deviceAdded:(id)added; // 0x1ebc61
-(void)searchReaders:(BOOL)readers; // 0x1eb8a9
-(void)connection:(id)connection didReceiveResponse:(id)response; // 0x1eb785
-(void)connectionDidFinishLoading:(id)connection; // 0x1eb76d
-(void)connection:(id)connection didFailWithError:(id)error; // 0x1eb719
-(void)playOnThreadWithInfo:(id)info; // 0x1eb4e5
-(void)beginPlayDLNAWithUrl:(id)url; // 0x1eb225
-(void)playURL:(id)url; // 0x1eafc5
-(void)setRenderAtIndex:(int)index; // 0x1eaea5
-(id)getRenderAtIndex:(int)index; // 0x1eaafd
-(void)loadInfoOfDLNA; // 0x1ea83d
-(void)stopTimers; // 0x1ea80d
-(void)startTimers; // 0x1ea7ad
-(void)clearAllInfos; // 0x1ea76d
-(void)clearTimerInfo; // 0x1ea71d
-(void)clearPlayInfo; // 0x1ea5e5
-(id)init; // 0x1ea539
-(void)dealloc; // 0x1ea411
@end

DLNAControllerDelegate

 @protocol DLNAControllerDelegate <NSObject>
-(void)dlnaControllerdidStoped:(id)stoped;
-(void)dlnaControllerdidMaitainConnection:(id)connection;
-(void)dlnaControllerdidLoseConnection:(id)connection;
-(void)dlnaControllerdidFailedToPlay:(id)play;
-(void)dlnaControllerdidStartToPlay:(id)play;
-(void)dlnaController:(id)controller didFindRenders:(id)renders;
@end

DLNAModel

 @protocol DLNAModelDelegate;

 @interface DLNAModel : XXUnknownSuperclass {
@private
id<DLNAModelDelegate> _delegate; // 4 = 0x4
}
@property(assign, nonatomic) id<DLNAModelDelegate> delegate; // G=0x1d2409; S=0x1d2419;
-(void)request:(id)request didFailLoadWithError:(id)error; // 0x1d23c9
-(void)requestDidFinishLoad:(id)request; // 0x1d2045
-(void)sendRequestWithVideoID:(id)videoID isPay:(BOOL)pay; // 0x1d1ef5
@end

DLNAModelDelegate

@protocol DLNAModelDelegate <NSObject>
-(void)DLNAModelDelegateRequestDidFail:(id)dlnamodelDelegateRequest;
-(void)DLNAModelDelegateRequestDidSuccess:(id)dlnamodelDelegateRequest urlString:(id)string;
@end

DLNAPlayBkgView

@class UIActivityIndicatorView, UILabel;

@interface DLNAPlayBkgView : XXUnknownSuperclass {
@private
UILabel* _tmpLabel; // 48 = 0x30
UIActivityIndicatorView* _tIndicator; // 52 = 0x34
}
@property(retain, nonatomic) UILabel* tmpLabel; // G=0x1d0c25; S=0x1d0c35;
@property(retain, nonatomic) UIActivityIndicatorView* tIndicator; // G=0x1d0c59; S=0x1d0c69;
-(void)setLableTip:(id)tip showActivity:(BOOL)activity; // 0x1d0a5d
-(id)initWithFrame:(CGRect)frame; // 0x1d06c1
-(void)dealloc; // 0x1d0669
@end

DLNASelectorView

@class UITableView, UIView;
@protocol DLNASelectorViewDelegate; @interface DLNASelectorView : XXUnknownSuperclass <UITableViewDataSource, UITableViewDelegate> {
@private
UIView* _dlnaSearchingView; // 48 = 0x30
UITableView* _dlnaTableView; // 52 = 0x34
id<DLNASelectorViewDelegate> _delegate; // 56 = 0x38
UIView* _tContentView; // 60 = 0x3c
UIView* _noneDLNATipView; // 64 = 0x40
}
@property(retain, nonatomic) UIView* dlnaSearchingView; // G=0x1d16c9; S=0x1d1e35;
@property(retain, nonatomic) UITableView* dlnaTableView; // G=0x1d15dd; S=0x1d1e59;
@property(retain, nonatomic) UIView* noneDLNATipView; // G=0x1d12cd; S=0x1d1ed1;
@property(retain, nonatomic) UIView* tContentView; // G=0x1d1e9d; S=0x1d1ead;
@property(assign, nonatomic) id<DLNASelectorViewDelegate> delegate; // G=0x1d1e7d; S=0x1d1e8d;
-(void)tableView:(id)view didSelectRowAtIndexPath:(id)indexPath; // 0x1d1dc1
-(int)tableView:(id)view numberOfRowsInSection:(int)section; // 0x1d1d8d
-(id)tableView:(id)view cellForRowAtIndexPath:(id)indexPath; // 0x1d1bf1
-(void)dlnaCloseDown:(id)down; // 0x1d1bc5
-(void)dlnaRefreshDown:(id)down; // 0x1d1b15
-(void)showSearchView; // 0x1d1ab9
-(void)refreshSelectorTable; // 0x1d18dd
-(id)initWithFrame:(CGRect)frame; // 0x1d0d11
-(void)dealloc; // 0x1d0c91
@end
@protocol DLNASelectorViewDelegate <NSObject>
-(void)DLNASelectorViewSelectedRender:(id)render;
-(void)DLNASelectorViewWillClose:(id)dlnaselectorView;
@end

QLUpnpAVPositionInfo:

@class CGUpnpAction;

@interface QLUpnpAVPositionInfo : XXUnknownSuperclass {
@private
float _trackDuration; // 4 = 0x4
float _absTime; // 8 = 0x8
float _relTime; // 12 = 0xc
CGUpnpAction* _upnpAction; // 16 = 0x10
}
@property(retain, nonatomic) CGUpnpAction* upnpAction; // G=0x1f1eb5; S=0x1f1ec5;
@property(readonly, assign, nonatomic) float relTime; // G=0x1f1ea5;
@property(readonly, assign, nonatomic) float absTime; // G=0x1f1e95;
@property(readonly, assign, nonatomic) float trackDuration; // G=0x1f1e85;
-(void)dealloc; // 0x1f1e41
-(id)initWithAction:(id)action; // 0x1f1d65
@end

QLUpnpAVVolumeInfo

@class CGUpnpAction;

@interface QLUpnpAVVolumeInfo : XXUnknownSuperclass {
@private
float _currentVolumePercentage; // 4 = 0x4
CGUpnpAction* _upnpAction; // 8 = 0x8
}
@property(retain, nonatomic) CGUpnpAction* upnpAction; // G=0x1ed05d; S=0x1ed06d;
@property(readonly, assign, nonatomic) float currentVolumePercentage; // G=0x1ed04d;
-(void)dealloc; // 0x1ed009
-(id)initWithAction:(id)action; // 0x1ecf61
@end

找时间阅读下汇编代码,写出一个开源版本。^_^

[原]关于在 iOS 中支持 DLNA的更多相关文章

  1. 【原/转】iOS中非常强大的过滤器:NSPredicate

    在APPLE的官方Demo:UICatalog中实现UISearchBar模糊搜索功能是这么做的: - (void)viewDidLoad { [super viewDidLoad]; self.al ...

  2. 日期格式在ios中的兼容性

    在IOS中支持 2017/3/2 这种格式的日期 不支持2017-3-2日期 /** * 返回兼容ios.android的日期时间格式 * @param dateTime String * @retu ...

  3. IOS中input键盘事件支持的解决方法

    欢迎大家去我的网站详细查看http://genghongshuo.com.cn/ IOS中input键盘事件keyup.keydown.等支持不是很好, 用input监听键盘keyup事件,在安卓手机 ...

  4. iOS中如何让TextView和TextField控件支持return键收起输入法

    TextView和TextField控件是iOS中负责接收用户输入的控件,那当用户输入完成时怎么收起面板呢? 1.TextView和TextField控件获得焦点之后的第一反应就是弹出输入法面板: 2 ...

  5. ios 中不new Date 的格式 不支持年月日 以‘-’ 分割的格式

    new Date("2018-1-5") 在 ios 中显示 invalid date - 换做 / 则可以顺利显示 new Date("2018/1/5")

  6. iOS 中的 HotFix 方案总结详解

    相信HotFix大家应该都很熟悉了,今天主要对于最近调研的一些方案做一些总结.iOS中的HotFix方案大致可以分为四种: WaxPatch(Alibaba) Dynamic Framework(Ap ...

  7. 【原】实时渲染中常用的几种Rendering Path

    [原]实时渲染中常用的几种Rendering Path 本文转载请注明出处 —— polobymulberry-博客园 本文为我的图形学大作业的论文部分,介绍了一些Rendering Path,比较简 ...

  8. iOS中支付宝集成

    iOS中支付宝集成 如今各种的App中都使用了三方支付的功能,现在将我在使用支付宝支付集成过程的心得分享一下,希望对大家都能有所帮助 要集成一个支付宝支付过程的环境,大致需要: 1>公司:先与支 ...

  9. 在DirectShow中支持DXVA 2.0(Supporting DXVA 2.0 in DirectShow)

    这几天在做dxva2硬件加速,找不到什么资料,翻译了一下微软的两篇相关文档.并准备记录一下用ffmpeg实现dxva2,将在第三篇写到.这是第二篇.,英文原址:https://msdn.microso ...

随机推荐

  1. 【分享】小工具大智慧之Sql执行工具

    原文:[分享]小工具大智慧之Sql执行工具 工具概况 情况是这样的,以前我们公司有很多Sql用于完成一些很不起眼但又不得不完成的业务,出于方便就直接在Sql查询分析器里执行,按理说应该写一些专门的工具 ...

  2. 【机器学习算法-python实现】KNN-k近邻算法的实现(附源代码)

    ,400],[200,5],[100,77],[40,300]]) shape:显示(行,列)例:shape(group)=(4,2) zeros:列出一个同样格式的空矩阵,例:zeros(group ...

  3. 关于WebBrowser(浏览器)控件的调用

    原文:关于WebBrowser(浏览器)控件的调用 在VS.NET2002和2003中,要应用WebBrowser(浏览器)控件,得用InterOp,刚开始用的时候很正常,后来不知道为什么窗口一打开就 ...

  4. ios MKNetworkKit 的使用

    常用框架比如:AFNetworking,ASIHttpRequest,SDWebImage,MKNetWorKit等. iOS5已出来这么久了,而ASIHttpRequest的作者已经申明不更新了,在 ...

  5. ASP.NET MVC中对Model进行分步验证的解决方法

    原文:ASP.NET MVC中对Model进行分步验证的解决方法 在我之前的文章:ASP.NET MVC2.0结合WF4.0实现用户多步注册流程中将一个用户的注册分成了四步,而这四个步骤都是在完善一个 ...

  6. Django教程汇总

    Django基础教程 被解放的姜戈01 初试天涯 被解放的姜戈02 庄园疑云 被解放的姜戈03 所谓伊人 被解放的姜戈04 各取所需 被解放的姜戈05 黑面管家 被解放的姜戈06 假作真时 Djang ...

  7. nodejs开发aspnet5项目

    结合nodejs开发aspnet5项目 1.安装kvm   官方教程地址:https://github.com/ligershark/Kulture 打开 powershell命令窗口,找不到可以在开 ...

  8. a链接bug

    <a href=”javascript:void(0);” class="btn" id="btn"></a> 在ios系统中(andr ...

  9. sql性能

    ---正在运行的 select a.username, a.sid,b.SQL_TEXT, b.SQL_FULLTEXT   from v$session a, v$sqlarea b where a ...

  10. 一步一步写算法(之挑选最大的n个数)

    原文:一步一步写算法(之挑选最大的n个数) [ 声明:版权所有,欢迎转载,请勿用于商业用途.  联系信箱:feixiaoxing @163.com] 从一堆数据中挑选n个最大的数,这个问题是网上流传的 ...