Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
79f6c2f2
Commit
79f6c2f2
authored
Nov 16, 2015
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VideoToolbox: add 4K support for Twister SoCs
Also add a couple of missing warnings
parent
c3b4e38d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
7 deletions
+53
-7
modules/codec/videotoolbox.m
modules/codec/videotoolbox.m
+53
-7
No files found.
modules/codec/videotoolbox.m
View file @
79f6c2f2
...
...
@@ -44,6 +44,12 @@
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
/* support iOS SDKs < v9.1 */
#ifndef CPUFAMILY_ARM_TWISTER
#define CPUFAMILY_ARM_TWISTER 0x92fb37c8
#endif
#endif
#pragma mark - module descriptor
...
...
@@ -89,6 +95,7 @@ void VTDictionarySetInt32(CFMutableDictionaryRef, CFStringRef, int);
static
void
copy420YpCbCr8Planar
(
picture_t
*
,
CVPixelBufferRef
buffer
,
unsigned
i_width
,
unsigned
i_height
);
static
BOOL
deviceSupportsAdvancedProfiles
();
static
BOOL
deviceSupportsAdvancedLevels
();
struct
picture_sys_t
{
CFTypeRef
pixelBuffer
;
...
...
@@ -158,12 +165,19 @@ static CMVideoCodecType CodecPrecheck(decoder_t *p_dec)
#if !TARGET_OS_IPHONE
/* a level higher than 5.2 was not tested, so don't dare to
* try to decode it*/
if
(
i_level
>
52
)
if
(
i_level
>
52
)
{
msg_Dbg
(
p_dec
,
"unsupported H264 level %zu"
,
i_level
);
return
-
1
;
}
#else
/* on SoC A8, 4.2 is the highest specified profile */
if
(
i_level
>
42
)
if
(
i_level
>
42
)
{
/* on Twister, we can do up to 5.2 */
if
(
!
deviceSupportsAdvancedLevels
()
||
i_level
>
52
)
{
msg_Dbg
(
p_dec
,
"unsupported H264 level %zu"
,
i_level
);
return
-
1
;
}
}
#endif
break
;
...
...
@@ -322,6 +336,7 @@ static int StartVideoToolbox(decoder_t *p_dec, block_t *p_block)
if
(
i_ret
!=
VLC_SUCCESS
)
{
free
(
p_alloc_buf
);
msg_Warn
(
p_dec
,
"extra buffer allocation failed"
);
return
VLC_EGENERIC
;
}
...
...
@@ -329,6 +344,7 @@ static int StartVideoToolbox(decoder_t *p_dec, block_t *p_block)
size_t
i_sps_size
=
0
,
i_pps_size
=
0
;
if
(
!
p_buf
)
{
free
(
p_alloc_buf
);
msg_Warn
(
p_dec
,
"extra buffer allocation failed"
);
return
VLC_EGENERIC
;
}
...
...
@@ -341,7 +357,7 @@ static int StartVideoToolbox(decoder_t *p_dec, block_t *p_block)
&
p_pps_buf
,
&
i_pps_size
);
if
(
i_ret
!=
VLC_SUCCESS
)
{
msg_Warn
(
p_dec
,
"sps pps
parsing
failed"
);
msg_Warn
(
p_dec
,
"sps pps
detection
failed"
);
free
(
p_alloc_buf
);
return
VLC_EGENERIC
;
}
...
...
@@ -353,6 +369,7 @@ static int StartVideoToolbox(decoder_t *p_dec, block_t *p_block)
if
(
i_ret
!=
VLC_SUCCESS
)
{
free
(
p_alloc_buf
);
msg_Warn
(
p_dec
,
"sps pps parsing failed"
);
return
VLC_EGENERIC
;
}
/* this data is more trust-worthy than what we receive
...
...
@@ -373,8 +390,10 @@ static int StartVideoToolbox(decoder_t *p_dec, block_t *p_block)
&
sps_data
,
p_sps_buf
,
i_sps_size
,
p_pps_buf
,
i_pps_size
);
free
(
p_alloc_buf
);
if
(
!
p_block
)
if
(
!
p_block
)
{
msg_Warn
(
p_dec
,
"buffer creation failed"
);
return
VLC_EGENERIC
;
}
extradata
=
CFDataCreate
(
kCFAllocatorDefault
,
p_block
->
p_buffer
,
...
...
@@ -585,8 +604,10 @@ static int StartVideoToolbox(decoder_t *p_dec, block_t *p_block)
/* setup storage */
p_sys
->
outputTimeStamps
=
[[
NSMutableArray
alloc
]
init
];
p_sys
->
outputFrames
=
[[
NSMutableDictionary
alloc
]
init
];
if
(
!
p_sys
->
outputFrames
)
if
(
!
p_sys
->
outputFrames
)
{
msg_Warn
(
p_dec
,
"buffer management structure allocation failed"
);
return
VLC_ENOMEM
;
}
p_sys
->
b_started
=
YES
;
...
...
@@ -638,8 +659,9 @@ static int OpenDecoder(vlc_object_t *p_this)
/* check quickly if we can digest the offered data */
CMVideoCodecType
codec
;
codec
=
CodecPrecheck
(
p_dec
);
if
(
codec
==
-
1
)
if
(
codec
==
-
1
)
{
return
VLC_EGENERIC
;
}
/* now that we see a chance to decode anything, allocate the
* internals and start the decoding session */
...
...
@@ -715,6 +737,30 @@ static BOOL deviceSupportsAdvancedProfiles()
#endif
}
static
BOOL
deviceSupportsAdvancedLevels
()
{
#if TARGET_IPHONE_SIMULATOR
return
YES
;
#endif
#if TARGET_OS_IPHONE
size_t
size
;
int32_t
cpufamily
;
size
=
sizeof
(
cpufamily
);
sysctlbyname
(
"hw.cpufamily"
,
&
cpufamily
,
&
size
,
NULL
,
0
);
/* Proper 4K decoding requires a Twister SoC
* Everything below will kill the decoder daemon */
if
(
cpufamily
==
CPUFAMILY_ARM_TWISTER
)
{
return
YES
;
}
return
NO
;
#else
return
YES
;
#endif
}
static
inline
void
bo_add_mp4_tag_descr
(
bo_t
*
p_bo
,
uint8_t
tag
,
uint32_t
size
)
{
bo_add_8
(
p_bo
,
tag
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment