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
8bea72f7
Commit
8bea72f7
authored
Apr 03, 2011
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avio: simplify url_open_dyn_buf_internal by using avio_alloc_context()
parent
724f6a0f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
14 deletions
+6
-14
aviobuf.c
libavformat/aviobuf.c
+6
-14
No files found.
libavformat/aviobuf.c
View file @
8bea72f7
...
...
@@ -1136,7 +1136,6 @@ static int64_t dyn_buf_seek(void *opaque, int64_t offset, int whence)
static
int
url_open_dyn_buf_internal
(
AVIOContext
**
s
,
int
max_packet_size
)
{
DynBuffer
*
d
;
int
ret
;
unsigned
io_buffer_size
=
max_packet_size
?
max_packet_size
:
1024
;
if
(
sizeof
(
DynBuffer
)
+
io_buffer_size
<
io_buffer_size
)
...
...
@@ -1144,23 +1143,16 @@ static int url_open_dyn_buf_internal(AVIOContext **s, int max_packet_size)
d
=
av_mallocz
(
sizeof
(
DynBuffer
)
+
io_buffer_size
);
if
(
!
d
)
return
AVERROR
(
ENOMEM
);
*
s
=
av_mallocz
(
sizeof
(
AVIOContext
));
d
->
io_buffer_size
=
io_buffer_size
;
*
s
=
avio_alloc_context
(
d
->
io_buffer
,
d
->
io_buffer_size
,
1
,
d
,
NULL
,
max_packet_size
?
dyn_packet_buf_write
:
dyn_buf_write
,
max_packet_size
?
NULL
:
dyn_buf_seek
);
if
(
!*
s
)
{
av_free
(
d
);
return
AVERROR
(
ENOMEM
);
}
d
->
io_buffer_size
=
io_buffer_size
;
ret
=
ffio_init_context
(
*
s
,
d
->
io_buffer
,
io_buffer_size
,
1
,
d
,
NULL
,
max_packet_size
?
dyn_packet_buf_write
:
dyn_buf_write
,
max_packet_size
?
NULL
:
dyn_buf_seek
);
if
(
ret
==
0
)
{
(
*
s
)
->
max_packet_size
=
max_packet_size
;
}
else
{
av_free
(
d
);
av_freep
(
s
);
}
return
ret
;
(
*
s
)
->
max_packet_size
=
max_packet_size
;
return
0
;
}
int
avio_open_dyn_buf
(
AVIOContext
**
s
)
...
...
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