Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
714c8b07
Commit
714c8b07
authored
May 12, 2019
by
Rick Kern
Committed by
Rick Kern
May 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavc/videotoolboxenc: simplify frame creation logic between OS X and iOS.
Signed-off-by:
Rick Kern
<
kernrj@gmail.com
>
parent
247bda44
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
62 deletions
+0
-62
videotoolboxenc.c
libavcodec/videotoolboxenc.c
+0
-62
No files found.
libavcodec/videotoolboxenc.c
View file @
714c8b07
...
...
@@ -2011,19 +2011,6 @@ static int get_cv_pixel_info(
return
0
;
}
#if !TARGET_OS_IPHONE
//Not used on iOS - frame is always copied.
static
void
free_avframe
(
void
*
release_ctx
,
const
void
*
data
,
size_t
size
,
size_t
plane_count
,
const
void
*
plane_addresses
[])
{
AVFrame
*
frame
=
release_ctx
;
av_frame_free
(
&
frame
);
}
#else
//Not used on OSX - frame is never copied.
static
int
copy_avframe_to_pixel_buffer
(
AVCodecContext
*
avctx
,
const
AVFrame
*
frame
,
...
...
@@ -2116,7 +2103,6 @@ static int copy_avframe_to_pixel_buffer(AVCodecContext *avctx,
return
0
;
}
#endif //!TARGET_OS_IPHONE
static
int
create_cv_pixel_buffer
(
AVCodecContext
*
avctx
,
const
AVFrame
*
frame
,
...
...
@@ -2129,18 +2115,8 @@ static int create_cv_pixel_buffer(AVCodecContext *avctx,
size_t
strides
[
AV_NUM_DATA_POINTERS
];
int
status
;
size_t
contiguous_buf_size
;
#if TARGET_OS_IPHONE
CVPixelBufferPoolRef
pix_buf_pool
;
VTEncContext
*
vtctx
=
avctx
->
priv_data
;
#else
CFMutableDictionaryRef
pix_buf_attachments
=
CFDictionaryCreateMutable
(
kCFAllocatorDefault
,
10
,
&
kCFCopyStringDictionaryKeyCallBacks
,
&
kCFTypeDictionaryValueCallBacks
);
if
(
!
pix_buf_attachments
)
return
AVERROR
(
ENOMEM
);
#endif
if
(
avctx
->
pix_fmt
==
AV_PIX_FMT_VIDEOTOOLBOX
)
{
av_assert0
(
frame
->
format
==
AV_PIX_FMT_VIDEOTOOLBOX
);
...
...
@@ -2180,7 +2156,6 @@ static int create_cv_pixel_buffer(AVCodecContext *avctx,
return
AVERROR_EXTERNAL
;
}
#if TARGET_OS_IPHONE
pix_buf_pool
=
VTCompressionSessionGetPixelBufferPool
(
vtctx
->
session
);
if
(
!
pix_buf_pool
)
{
/* On iOS, the VT session is invalidated when the APP switches from
...
...
@@ -2222,43 +2197,6 @@ static int create_cv_pixel_buffer(AVCodecContext *avctx,
*
cv_img
=
NULL
;
return
status
;
}
#else
AVFrame
*
enc_frame
=
av_frame_alloc
();
if
(
!
enc_frame
)
return
AVERROR
(
ENOMEM
);
status
=
av_frame_ref
(
enc_frame
,
frame
);
if
(
status
)
{
av_frame_free
(
&
enc_frame
);
return
status
;
}
status
=
CVPixelBufferCreateWithPlanarBytes
(
kCFAllocatorDefault
,
enc_frame
->
width
,
enc_frame
->
height
,
color
,
NULL
,
contiguous_buf_size
,
plane_count
,
(
void
**
)
enc_frame
->
data
,
widths
,
heights
,
strides
,
free_avframe
,
enc_frame
,
NULL
,
cv_img
);
add_color_attr
(
avctx
,
pix_buf_attachments
);
CVBufferSetAttachments
(
*
cv_img
,
pix_buf_attachments
,
kCVAttachmentMode_ShouldPropagate
);
CFRelease
(
pix_buf_attachments
);
if
(
status
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Error: Could not create CVPixelBuffer: %d
\n
"
,
status
);
return
AVERROR_EXTERNAL
;
}
#endif
return
0
;
}
...
...
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