Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_25606643
ijkplayer
提交
0107f897
I
ijkplayer
项目概览
qq_25606643
/
ijkplayer
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
ijkplayer
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0107f897
编写于
10月 11, 2013
作者:
B
bbcallen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ios: IJKFF: use concat:// instead of data:// due to url length limit
上级
752ae4b5
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
237 addition
and
3 deletion
+237
-3
ios/IJKMediaPlayer/IJKMediaPlayer.xcodeproj/project.pbxproj
ios/IJKMediaPlayer/IJKMediaPlayer.xcodeproj/project.pbxproj
+12
-0
ios/IJKMediaPlayer/IJKMediaPlayer/IJKFFMoviePlayerController.m
...JKMediaPlayer/IJKMediaPlayer/IJKFFMoviePlayerController.m
+11
-3
ios/IJKMediaPlayer/IJKMediaPlayer/IJKFFMrl.h
ios/IJKMediaPlayer/IJKMediaPlayer/IJKFFMrl.h
+33
-0
ios/IJKMediaPlayer/IJKMediaPlayer/IJKFFMrl.m
ios/IJKMediaPlayer/IJKMediaPlayer/IJKFFMrl.m
+94
-0
ios/IJKMediaPlayer/IJKMediaPlayer/IJKMediaUtils.h
ios/IJKMediaPlayer/IJKMediaPlayer/IJKMediaUtils.h
+34
-0
ios/IJKMediaPlayer/IJKMediaPlayer/IJKMediaUtils.m
ios/IJKMediaPlayer/IJKMediaPlayer/IJKMediaUtils.m
+53
-0
未找到文件。
ios/IJKMediaPlayer/IJKMediaPlayer.xcodeproj/project.pbxproj
浏览文件 @
0107f897
...
...
@@ -20,6 +20,8 @@
E66F8DE717EFD9C300354D80
/* IJKFFMoviePlayerController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
E66F8DE617EFD9C300354D80
/* IJKFFMoviePlayerController.m */
;
};
E66F8DF117EFEA9400354D80
/* ijkplayer.c in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
E66F8DEF17EFEA9400354D80
/* ijkplayer.c */
;
};
E66F8E0317EFEEA400354D80
/* ijkplayer_ios.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
E66F8E0117EFEEA400354D80
/* ijkplayer_ios.m */
;
settings
=
{
COMPILER_FLAGS
=
"-fno-objc-arc"
;
};
};
E6716E4B1807E5FC00B3FBC1
/* IJKMediaUtils.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
E6716E4A1807E5FC00B3FBC1
/* IJKMediaUtils.m */
;
};
E6716E4E1807EA5000B3FBC1
/* IJKFFMrl.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
E6716E4D1807EA5000B3FBC1
/* IJKFFMrl.m */
;
};
E6903EC217EAF6C500CFD954
/* IJKMediaPlayback.h in CopyFiles */
=
{
isa
=
PBXBuildFile
;
fileRef
=
E6903EC117EAF6C500CFD954
/* IJKMediaPlayback.h */
;
};
E6903FC717EAFC2C00CFD954
/* libavcodec.a in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
E6903FC217EAFC2C00CFD954
/* libavcodec.a */
;
};
E6903FC817EAFC2C00CFD954
/* libavformat.a in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
E6903FC317EAFC2C00CFD954
/* libavformat.a */
;
};
...
...
@@ -94,6 +96,10 @@
E66F8E0117EFEEA400354D80
/* ijkplayer_ios.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
name
=
ijkplayer_ios.m
;
path
=
ijkmedia/ijkplayer/ios/ijkplayer_ios.m
;
sourceTree
=
"<group>"
;
};
E66F8E0217EFEEA400354D80
/* ijkplayer_ios.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
name
=
ijkplayer_ios.h
;
path
=
ijkmedia/ijkplayer/ios/ijkplayer_ios.h
;
sourceTree
=
"<group>"
;
};
E66F8E0517EFEF3900354D80
/* ijksdl_ios.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
name
=
ijksdl_ios.h
;
path
=
ijkmedia/ijksdl/ios/ijksdl_ios.h
;
sourceTree
=
"<group>"
;
};
E6716E491807E5FC00B3FBC1
/* IJKMediaUtils.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
name
=
IJKMediaUtils.h
;
path
=
IJKMediaPlayer/IJKMediaUtils.h
;
sourceTree
=
"<group>"
;
};
E6716E4A1807E5FC00B3FBC1
/* IJKMediaUtils.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
name
=
IJKMediaUtils.m
;
path
=
IJKMediaPlayer/IJKMediaUtils.m
;
sourceTree
=
"<group>"
;
};
E6716E4C1807EA4F00B3FBC1
/* IJKFFMrl.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
IJKFFMrl.h
;
sourceTree
=
"<group>"
;
};
E6716E4D1807EA5000B3FBC1
/* IJKFFMrl.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
IJKFFMrl.m
;
sourceTree
=
"<group>"
;
};
E6903EB917EAF6C500CFD954
/* libIJKMediaPlayer.a */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
archive.ar
;
includeInIndex
=
0
;
path
=
libIJKMediaPlayer.a
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
E6903EC017EAF6C500CFD954
/* IJKMediaPlayer-Prefix.pch */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
"IJKMediaPlayer-Prefix.pch"
;
sourceTree
=
"<group>"
;
};
E6903EC117EAF6C500CFD954
/* IJKMediaPlayback.h */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
name
=
IJKMediaPlayback.h
;
path
=
IJKMediaPlayer/IJKMediaPlayback.h
;
sourceTree
=
"<group>"
;
};
...
...
@@ -324,6 +330,8 @@
E6903EBE17EAF6C500CFD954
/* IJKFFMoviePlayerController */
=
{
isa
=
PBXGroup
;
children
=
(
E6716E4C1807EA4F00B3FBC1
/* IJKFFMrl.h */
,
E6716E4D1807EA5000B3FBC1
/* IJKFFMrl.m */
,
E66F8DE517EFD9C300354D80
/* IJKFFMoviePlayerController.h */
,
E66F8DE617EFD9C300354D80
/* IJKFFMoviePlayerController.m */
,
E6F727B917F2D9D30043623F
/* IJKFFMoviePlayerDef.h */
,
...
...
@@ -593,6 +601,8 @@
E6903EC117EAF6C500CFD954
/* IJKMediaPlayback.h */
,
E6F727C117F7C9B90043623F
/* IJKMediaPlayback.m */
,
E66F8DC217EECB1E00354D80
/* IJKMediaPlayer.h */
,
E6716E491807E5FC00B3FBC1
/* IJKMediaUtils.h */
,
E6716E4A1807E5FC00B3FBC1
/* IJKMediaUtils.m */
,
);
name
=
IJKMediaPlayer
;
sourceTree
=
"<group>"
;
...
...
@@ -675,6 +685,8 @@
E6F727B817F2B1B10043623F
/* IJKMediaModule.m in Sources */
,
E6F727BB17F2D9D40043623F
/* IJKFFMoviePlayerDef.m in Sources */
,
E6F727C217F7C9BA0043623F
/* IJKMediaPlayback.m in Sources */
,
E6716E4B1807E5FC00B3FBC1
/* IJKMediaUtils.m in Sources */
,
E6716E4E1807EA5000B3FBC1
/* IJKFFMrl.m in Sources */
,
);
runOnlyForDeploymentPostprocessing
=
0
;
};
...
...
ios/IJKMediaPlayer/IJKMediaPlayer/IJKFFMoviePlayerController.m
浏览文件 @
0107f897
...
...
@@ -23,9 +23,11 @@
#import "IJKFFMoviePlayerController.h"
#import "IJKFFMoviePlayerDef.h"
#import "IJKMediaPlayback.h"
#import "IJKFFMrl.h"
@implementation
IJKFFMoviePlayerController
{
NSURL
*
_url
;
IJKFFMrl
*
_ffMrl
;
IjkMediaPlayer
*
_mediaPlayer
;
IJKFFMoviePlayerMessagePool
*
_msgPool
;
...
...
@@ -70,7 +72,8 @@
_initialPlaybackTime
=
0
;
_endPlaybackTime
=
0
;
_url
=
aUrl
;
_ffMrl
=
[[
IJKFFMrl
alloc
]
initWithMrl
:[
aUrl
absoluteString
]];
_mediaPlayer
=
ijkmp_ios_create
(
media_player_msg_loop
);
_msgPool
=
[[
IJKFFMoviePlayerMessagePool
alloc
]
init
];
...
...
@@ -85,12 +88,17 @@
return
self
;
}
-
(
void
)
dealloc
{
[
_ffMrl
removeTempFiles
];
}
-
(
void
)
prepareToPlay
{
if
(
!
_mediaPlayer
)
return
;
ijkmp_set_data_source
(
_mediaPlayer
,
[
[
_url
absoluteString
]
UTF8String
]);
ijkmp_set_data_source
(
_mediaPlayer
,
[
_ffMrl
.
resolvedMrl
UTF8String
]);
ijkmp_set_format_option
(
_mediaPlayer
,
"safe"
,
"0"
);
// for concat demuxer
ijkmp_prepare_async
(
_mediaPlayer
);
}
...
...
ios/IJKMediaPlayer/IJKMediaPlayer/IJKFFMrl.h
0 → 100644
浏览文件 @
0107f897
/*
* IJKFFMrl.h
*
* Copyright (c) 2013 Zhang Rui <bbcallen@gmail.com>
*
* This file is part of ijkPlayer.
*
* ijkPlayer is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* ijkPlayer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with ijkPlayer; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#import <Foundation/Foundation.h>
@interface
IJKFFMrl
:
NSObject
-
(
IJKFFMrl
*
)
initWithMrl
:
(
NSString
*
)
aMrl
;
-
(
void
)
removeTempFiles
;
@property
(
nonatomic
,
readonly
)
NSString
*
rawMrl
;
@property
(
nonatomic
,
readonly
)
NSString
*
resolvedMrl
;
@end
ios/IJKMediaPlayer/IJKMediaPlayer/IJKFFMrl.m
0 → 100644
浏览文件 @
0107f897
/*
* IJKFFMrl.m
*
* Copyright (c) 2013 Zhang Rui <bbcallen@gmail.com>
*
* This file is part of ijkPlayer.
*
* ijkPlayer is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* ijkPlayer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with ijkPlayer; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#import "IJKFFMrl.h"
#import "IJKMediaUtils.h"
#include "libavutil/base64.h"
#include "libavutil/mem.h"
@implementation
IJKFFMrl
{
NSString
*
_tmpFile
;
}
@synthesize
rawMrl
=
_rawMrl
;
@synthesize
resolvedMrl
=
_resolvedMrl
;
-
(
IJKFFMrl
*
)
initWithMrl
:
(
NSString
*
)
aMrl
{
self
=
[
super
init
];
if
(
self
)
{
_rawMrl
=
aMrl
;
_resolvedMrl
=
aMrl
;
if
([
_rawMrl
hasPrefix
:
@"data://"
])
{
NSRange
range
=
[
_rawMrl
rangeOfString
:
@","
];
if
(
range
.
length
>
0
)
{
NSString
*
data
=
[
_rawMrl
substringFromIndex
:(
range
.
location
+
1
)];
NSString
*
ffConcat
=
[
IJKFFMrl
base64Decode
:
data
];
_tmpFile
=
[
IJKMediaUtils
createTempFileNameForFFConcat
];
[
ffConcat
writeToFile
:
_tmpFile
atomically:
YES
encoding:
NSStringEncodingConversionAllowLossy
error:
nil
];
_resolvedMrl
=
[[
NSString
alloc
]
initWithFormat
:
@"concat://%@"
,
_tmpFile
];
}
}
if
(
!
_resolvedMrl
)
_resolvedMrl
=
_rawMrl
;
}
return
self
;
}
-
(
void
)
removeTempFiles
{
if
(
_tmpFile
)
{
[[
NSFileManager
defaultManager
]
removeItemAtPath
:
_tmpFile
error
:
nil
];
_tmpFile
=
nil
;
}
}
+
(
NSString
*
)
base64Decode
:
(
NSString
*
)
cipher
{
int
ret
=
0
;
const
char
*
utf8Cipher
=
[
cipher
UTF8String
];
uint8_t
*
utf8Plain
=
NULL
;
size_t
in_size
=
strlen
(
utf8Cipher
);
size_t
out_size
=
3
*
(
in_size
/
4
)
+
1
;
if
(
out_size
>
INT_MAX
||
!
(
utf8Plain
=
av_malloc
(
out_size
)))
return
NULL
;
if
((
ret
=
av_base64_decode
(
utf8Plain
,
utf8Cipher
,
out_size
))
<
0
)
{
av_free
(
utf8Plain
);
NSLog
(
@"Invalid base64 in MRL
\n
"
);
return
NULL
;
}
NSString
*
plain
=
[[
NSString
alloc
]
initWithUTF8String
:(
const
char
*
)
utf8Plain
];
av_free
(
utf8Plain
);
return
plain
;
}
@end
ios/IJKMediaPlayer/IJKMediaPlayer/IJKMediaUtils.h
0 → 100644
浏览文件 @
0107f897
/*
* IJKMediaUtils.h
*
* Copyright (c) 2013 Zhang Rui <bbcallen@gmail.com>
*
* This file is part of ijkPlayer.
*
* ijkPlayer is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* ijkPlayer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with ijkPlayer; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#import <Foundation/Foundation.h>
@interface
IJKMediaUtils
:
NSObject
+
(
NSString
*
)
createTempFileNameForFFConcat
;
+
(
NSString
*
)
createTempFileNameWithPrefix
:
(
NSString
*
)
aPrefix
;
+
(
NSString
*
)
createTempFileNameInDirectory
:
(
NSString
*
)
aDirectory
withPrefix
:
(
NSString
*
)
aPrefix
;
@end
ios/IJKMediaPlayer/IJKMediaPlayer/IJKMediaUtils.m
0 → 100644
浏览文件 @
0107f897
/*
* IJKMediaUtils.m
*
* Copyright (c) 2013 Zhang Rui <bbcallen@gmail.com>
*
* This file is part of ijkPlayer.
*
* ijkPlayer is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* ijkPlayer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with ijkPlayer; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#import "IJKMediaUtils.h"
@implementation
IJKMediaUtils
+
(
NSString
*
)
createTempFileNameForFFConcat
{
return
[
IJKMediaUtils
createTempFileNameWithPrefix
:
@"ffconcat-"
];
}
+
(
NSString
*
)
createTempFileNameWithPrefix
:
(
NSString
*
)
aPrefix
{
return
[
IJKMediaUtils
createTempFileNameInDirectory
:
NSTemporaryDirectory
()
withPrefix:
aPrefix
];
}
+
(
NSString
*
)
createTempFileNameInDirectory
:
(
NSString
*
)
aDirectory
withPrefix
:
(
NSString
*
)
aPrefix
{
NSString
*
templateStr
=
[
NSString
stringWithFormat
:
@"%@/%@XXXXX"
,
aDirectory
,
aPrefix
];
char
template
[
templateStr
.
length
+
1
];
strcpy
(
template
,
[
templateStr
cStringUsingEncoding
:
NSASCIIStringEncoding
]);
char
*
filename
=
mktemp
(
template
);
if
(
filename
==
NULL
)
{
NSLog
(
@"Could not create file in directory %@"
,
aDirectory
);
return
nil
;
}
return
[
NSString
stringWithCString
:
filename
encoding
:
NSASCIIStringEncoding
];
}
@end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录