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
186ec178
Commit
186ec178
authored
Jun 30, 2013
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/aviobuf: Add ffio_ensure_seekback()
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
2ca48e46
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
0 deletions
+34
-0
avio_internal.h
libavformat/avio_internal.h
+9
-0
aviobuf.c
libavformat/aviobuf.c
+25
-0
No files found.
libavformat/avio_internal.h
View file @
186ec178
...
@@ -71,6 +71,15 @@ uint64_t ffio_read_varlen(AVIOContext *bc);
...
@@ -71,6 +71,15 @@ uint64_t ffio_read_varlen(AVIOContext *bc);
/** @warning must be called before any I/O */
/** @warning must be called before any I/O */
int
ffio_set_buf_size
(
AVIOContext
*
s
,
int
buf_size
);
int
ffio_set_buf_size
(
AVIOContext
*
s
,
int
buf_size
);
/**
* Ensures that the requested seekback buffer size will be available
*
* Will ensure that when reading sequentially up to buf_size, seeking
* within the current pos and pos+buf_size is possible.
* Once the stream position moves outside this window this gurantee is lost.
*/
int
ffio_ensure_seekback
(
AVIOContext
*
s
,
int
buf_size
);
int
ffio_limit
(
AVIOContext
*
s
,
int
size
);
int
ffio_limit
(
AVIOContext
*
s
,
int
size
);
void
ffio_init_checksum
(
AVIOContext
*
s
,
void
ffio_init_checksum
(
AVIOContext
*
s
,
...
...
libavformat/aviobuf.c
View file @
186ec178
...
@@ -725,6 +725,31 @@ int ffio_fdopen(AVIOContext **s, URLContext *h)
...
@@ -725,6 +725,31 @@ int ffio_fdopen(AVIOContext **s, URLContext *h)
return
0
;
return
0
;
}
}
int
ffio_ensure_seekback
(
AVIOContext
*
s
,
int
buf_size
)
{
uint8_t
*
buffer
;
int
max_buffer_size
=
s
->
max_packet_size
?
s
->
max_packet_size
:
IO_BUFFER_SIZE
;
buf_size
+=
s
->
buf_ptr
-
s
->
buffer
+
max_buffer_size
;
if
(
buf_size
<
s
->
buffer_size
||
s
->
seekable
)
return
0
;
av_assert0
(
!
s
->
write_flag
);
buffer
=
av_malloc
(
buf_size
);
if
(
!
buffer
)
return
AVERROR
(
ENOMEM
);
memcpy
(
buffer
,
s
->
buffer
,
s
->
buffer_size
);
av_free
(
s
->
buffer
);
s
->
buf_ptr
=
buffer
+
(
s
->
buf_ptr
-
s
->
buffer
);
s
->
buf_end
=
buffer
+
(
s
->
buf_end
-
s
->
buffer
);
s
->
buffer
=
buffer
;
s
->
buffer_size
=
buf_size
;
return
0
;
}
int
ffio_set_buf_size
(
AVIOContext
*
s
,
int
buf_size
)
int
ffio_set_buf_size
(
AVIOContext
*
s
,
int
buf_size
)
{
{
uint8_t
*
buffer
;
uint8_t
*
buffer
;
...
...
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