Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
3f75e511
Commit
3f75e511
authored
8 years ago
by
Luca Barbato
Committed by
Vittorio Giovara
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
avio: Keep track of the amount of data written
Make avio_size() work with any write AVIOContext.
parent
fc85646a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
libavformat/avio.h
+1
-0
1 addition, 0 deletions
libavformat/avio.h
libavformat/aviobuf.c
+10
-3
10 additions, 3 deletions
libavformat/aviobuf.c
libavformat/version.h
+1
-1
1 addition, 1 deletion
libavformat/version.h
with
12 additions
and
4 deletions
libavformat/avio.h
+
1
−
0
View file @
3f75e511
...
...
@@ -176,6 +176,7 @@ typedef struct AVIOContext {
*/
enum
AVIODataMarkerType
current_type
;
int64_t
last_time
;
int64_t
written
;
}
AVIOContext
;
/**
...
...
This diff is collapsed.
Click to expand it.
libavformat/aviobuf.c
+
10
−
3
View file @
3f75e511
...
...
@@ -168,18 +168,22 @@ AVIOContext *avio_alloc_context(
static
void
flush_buffer
(
AVIOContext
*
s
)
{
if
(
s
->
buf_ptr
>
s
->
buffer
)
{
int
size
=
s
->
buf_ptr
-
s
->
buffer
;
if
(
!
s
->
error
)
{
int
ret
=
0
;
if
(
s
->
write_data_type
)
ret
=
s
->
write_data_type
(
s
->
opaque
,
s
->
buffer
,
s
->
buf_ptr
-
s
->
buffer
,
s
ize
,
s
->
current_type
,
s
->
last_time
);
else
if
(
s
->
write_packet
)
ret
=
s
->
write_packet
(
s
->
opaque
,
s
->
buffer
,
s
->
buf_ptr
-
s
->
buffer
);
s
ize
);
if
(
ret
<
0
)
{
s
->
error
=
ret
;
}
else
{
if
(
s
->
pos
+
size
>
s
->
written
)
s
->
written
=
s
->
pos
+
size
;
}
}
if
(
s
->
current_type
==
AVIO_DATA_MARKER_SYNC_POINT
||
...
...
@@ -192,7 +196,7 @@ static void flush_buffer(AVIOContext *s)
s
->
buf_ptr
-
s
->
checksum_ptr
);
s
->
checksum_ptr
=
s
->
buffer
;
}
s
->
pos
+=
s
->
buf_ptr
-
s
->
buffer
;
s
->
pos
+=
s
ize
;
}
s
->
buf_ptr
=
s
->
buffer
;
}
...
...
@@ -301,6 +305,9 @@ int64_t avio_size(AVIOContext *s)
if
(
!
s
)
return
AVERROR
(
EINVAL
);
if
(
s
->
written
)
return
s
->
written
;
if
(
!
s
->
seek
)
return
AVERROR
(
ENOSYS
);
size
=
s
->
seek
(
s
->
opaque
,
0
,
AVSEEK_SIZE
);
...
...
This diff is collapsed.
Click to expand it.
libavformat/version.h
+
1
−
1
View file @
3f75e511
...
...
@@ -31,7 +31,7 @@
#define LIBAVFORMAT_VERSION_MAJOR 57
#define LIBAVFORMAT_VERSION_MINOR 10
#define LIBAVFORMAT_VERSION_MICRO
1
#define LIBAVFORMAT_VERSION_MICRO
2
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment