Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
40a433e3
Commit
40a433e3
authored
Aug 28, 2019
by
Lukas Rusak
Committed by
Aman Gupta
Sep 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/v4l2_buffers: split out v4l2_buf_increase_ref helper
Signed-off-by:
Aman Gupta
<
aman@tmm1.net
>
parent
d620b1f9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
13 deletions
+23
-13
v4l2_buffers.c
libavcodec/v4l2_buffers.c
+23
-13
No files found.
libavcodec/v4l2_buffers.c
View file @
40a433e3
...
@@ -228,27 +228,17 @@ static void v4l2_free_buffer(void *opaque, uint8_t *unused)
...
@@ -228,27 +228,17 @@ static void v4l2_free_buffer(void *opaque, uint8_t *unused)
}
}
}
}
static
int
v4l2_buf_
to_bufref
(
V4L2Buffer
*
in
,
int
plane
,
AVBufferRef
**
buf
)
static
int
v4l2_buf_
increase_ref
(
V4L2Buffer
*
in
)
{
{
V4L2m2mContext
*
s
=
buf_to_m2mctx
(
in
);
V4L2m2mContext
*
s
=
buf_to_m2mctx
(
in
);
if
(
plane
>=
in
->
num_planes
)
return
AVERROR
(
EINVAL
);
/* even though most encoders return 0 in data_offset encoding vp8 does require this value */
*
buf
=
av_buffer_create
((
char
*
)
in
->
plane_info
[
plane
].
mm_addr
+
in
->
planes
[
plane
].
data_offset
,
in
->
plane_info
[
plane
].
length
,
v4l2_free_buffer
,
in
,
0
);
if
(
!*
buf
)
return
AVERROR
(
ENOMEM
);
if
(
in
->
context_ref
)
if
(
in
->
context_ref
)
atomic_fetch_add
(
&
in
->
context_refcount
,
1
);
atomic_fetch_add
(
&
in
->
context_refcount
,
1
);
else
{
else
{
in
->
context_ref
=
av_buffer_ref
(
s
->
self_ref
);
in
->
context_ref
=
av_buffer_ref
(
s
->
self_ref
);
if
(
!
in
->
context_ref
)
{
if
(
!
in
->
context_ref
)
av_buffer_unref
(
buf
);
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
}
in
->
context_refcount
=
1
;
in
->
context_refcount
=
1
;
}
}
...
@@ -258,6 +248,26 @@ static int v4l2_buf_to_bufref(V4L2Buffer *in, int plane, AVBufferRef **buf)
...
@@ -258,6 +248,26 @@ static int v4l2_buf_to_bufref(V4L2Buffer *in, int plane, AVBufferRef **buf)
return
0
;
return
0
;
}
}
static
int
v4l2_buf_to_bufref
(
V4L2Buffer
*
in
,
int
plane
,
AVBufferRef
**
buf
)
{
int
ret
;
if
(
plane
>=
in
->
num_planes
)
return
AVERROR
(
EINVAL
);
/* even though most encoders return 0 in data_offset encoding vp8 does require this value */
*
buf
=
av_buffer_create
((
char
*
)
in
->
plane_info
[
plane
].
mm_addr
+
in
->
planes
[
plane
].
data_offset
,
in
->
plane_info
[
plane
].
length
,
v4l2_free_buffer
,
in
,
0
);
if
(
!*
buf
)
return
AVERROR
(
ENOMEM
);
ret
=
v4l2_buf_increase_ref
(
in
);
if
(
ret
)
av_buffer_unref
(
buf
);
return
ret
;
}
static
int
v4l2_bufref_to_buf
(
V4L2Buffer
*
out
,
int
plane
,
const
uint8_t
*
data
,
int
size
,
int
offset
,
AVBufferRef
*
bref
)
static
int
v4l2_bufref_to_buf
(
V4L2Buffer
*
out
,
int
plane
,
const
uint8_t
*
data
,
int
size
,
int
offset
,
AVBufferRef
*
bref
)
{
{
unsigned
int
bytesused
,
length
;
unsigned
int
bytesused
,
length
;
...
...
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