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
b4f5da26
Commit
b4f5da26
authored
Jan 14, 2015
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avutil/buffer: factor buffer_replace() out
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
ecd39520
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
buffer.c
libavutil/buffer.c
+16
-5
No files found.
libavutil/buffer.c
View file @
b4f5da26
...
...
@@ -103,14 +103,17 @@ AVBufferRef *av_buffer_ref(AVBufferRef *buf)
return
ret
;
}
void
av_buffer_unref
(
AVBufferRef
**
buf
)
static
void
buffer_replace
(
AVBufferRef
**
dst
,
AVBufferRef
**
src
)
{
AVBuffer
*
b
;
if
(
!
buf
||
!*
buf
)
return
;
b
=
(
*
buf
)
->
buffer
;
av_freep
(
buf
);
b
=
(
*
dst
)
->
buffer
;
if
(
src
)
{
**
dst
=
**
src
;
av_freep
(
src
);
}
else
av_freep
(
dst
);
if
(
!
avpriv_atomic_int_add_and_fetch
(
&
b
->
refcount
,
-
1
))
{
b
->
free
(
b
->
opaque
,
b
->
data
);
...
...
@@ -118,6 +121,14 @@ void av_buffer_unref(AVBufferRef **buf)
}
}
void
av_buffer_unref
(
AVBufferRef
**
buf
)
{
if
(
!
buf
||
!*
buf
)
return
;
buffer_replace
(
buf
,
NULL
);
}
int
av_buffer_is_writable
(
const
AVBufferRef
*
buf
)
{
if
(
buf
->
buffer
->
flags
&
AV_BUFFER_FLAG_READONLY
)
...
...
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