摘要: 要想利用HLS来实现视频的在线播放,就得需要将一个完整的视频文件切割成多个ts视频流,然后利用m3u8的索引文件来播放。在Mac下,苹果提供了streamingTools的工具,里面有mediafilesegmenter和mediastreamsegmenter来分别实现文件和直播流的切割,一行命令直接就可以将输入的原始视频文件导出成几个ts和索引文件,直接就可以用了。但是一般服务器都是基于linux的,要想在linux下实现同样的切割,着实费了一番功夫。网上也找了好多相关的资料,基本是利用开源的ffmpeg和segmenter工具来实现,但是这搭建这个环境的过程是曲折的,编译这些工具的时候会 阅读全文
posted @ 2013-04-07 21:25 Story Of My Life 阅读(32792) 评论(4) 推荐(0) 编辑
摘要: 1、纯虚函数:类中函数声明为 virtual void foo() = 0;则此类不能实例化,为抽象类,子类若不实现纯虚函数,也不能实例化,继续为抽象类,直到实现父类所有纯虚函数为止。2、const后谁离const最近const就修饰谁const int a = 1; 或 int const a = 1; 都是修饰a,a为只读,且声明时必须初始化const int *a; 或 int const * a; const后为*,则表示修饰a指向的内容*a的值为readonlyint * const a; const后是a,则a的值为readonlyvoid foo() const; 表示foo.. 阅读全文
posted @ 2013-03-25 21:24 Story Of My Life 阅读(260) 评论(0) 推荐(0) 编辑
摘要: 重写drawRect后,设置layer的属性会失效,可能在drawRect中还会对layer进行改变所以要设定view的边框形状有两种方法:1、重写drawRect,用UIBezierPath等画出圆角矩形或者圆,然后addClips,将边框包裹住,最后要注意将view的背景色设置为透明。2、不重写drawRect,初始化中改变view.layer的属性,可以变为圆角矩形,圆,还能设置阴影,边框等,但是要注意layer的maskToBounds和view的clipsToBounds属性,保证只在bounds内绘图。 阅读全文
posted @ 2013-03-25 11:53 Story Of My Life 阅读(235) 评论(0) 推荐(0) 编辑
摘要: 1、NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];CGFloat cellHeight = [selftableView:self.tableView heightForRowAtIndexPath:indexPath];2、NSIndexPath *indexPath = [self.tableViewindexPathForCell:cell];CGFloatcellHeight =[self.tableView rectForRowAtIndexPath:indexPath].size.height; 阅读全文
posted @ 2013-03-24 17:04 Story Of My Life 阅读(2427) 评论(0) 推荐(0) 编辑
摘要: 和delegate一样,KVO和NSNotification的作用也是类与类之间的通信,与delegate不同的是1)这两个都是负责发出通知,剩下的事情就不管了,所以没有返回值;2)delegate只是一对一,而这两个可以一对多。这两者也有各自的特点。1)KVO的使用:被观察者发出 addObserver:forKeyPath:options:context: 方法来添加观察者- (void)addObserver:(NSObject *)anObserver forKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions) 阅读全文
posted @ 2013-03-07 21:16 Story Of My Life 阅读(2592) 评论(0) 推荐(0) 编辑
摘要: git rm --cached Q\&A.xcodeproj/project.xcworkspace/xcuserdata/lty.xcuserdatad/UserInterfaceState.xcuserstate 阅读全文
posted @ 2013-03-01 21:48 Story Of My Life 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 转载自:http://www.cnblogs.com/mybkn/articles/2831190.html 阅读全文
posted @ 2013-02-23 21:18 Story Of My Life 阅读(173) 评论(0) 推荐(0) 编辑
摘要: #import "Abc.h"@implementation Abc+ (Abc *)sharedInstance{ static Abc *abc = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ abc = [[Abc alloc] init]; }); return abc;}@end这是Objective-c的singleton写法。 阅读全文
posted @ 2013-02-18 16:12 Story Of My Life 阅读(121) 评论(0) 推荐(0) 编辑
摘要: Lazy Instantiation即被动初始化,当需要用到某个property时,再在此property的getters中进行初始化,例如- (Foo *)aFoo{ if (!_aFoo) { _aFoo = [[Foo alloc] init]; } return _aFoo;}Designated Initailization即指定初始化方法,一般为默认初始化(init),有时候会自己定义指定初始化方法,这时必须重写默认初始化init返回nil,以防止初始化失败,并在自定义初始化方法中调用[super init],如下- (id)initWithCoun... 阅读全文
posted @ 2013-02-17 15:50 Story Of My Life 阅读(502) 评论(0) 推荐(0) 编辑
摘要: 1、一次性修改一个scope里的变量名:点击该变量,出现下划虚线,然后command+control+E激活所有相同变量,然后进行修改。2、删除一个词:option+delete 删除一句话:command+delete3、快捷搜索:先点亮想要搜索的词,然后command+E将该次放入剪贴板,然后command+G来向下遍历该词,shift+command+G向上遍历。4、新建tab:command+T tab间切换:command+shift+[ 或 ] 前后两行交换:command+option+[ 或 ] 不同窗口间切换:command+`5、快捷open:command+shi... 阅读全文
posted @ 2013-01-31 20:35 Story Of My Life 阅读(12890) 评论(0) 推荐(3) 编辑