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
e942454d
Commit
e942454d
authored
Feb 04, 2016
by
Marton Balint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/utils: add ff_parse_creation_time_metadata
Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
f834f0ca
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
internal.h
libavformat/internal.h
+11
-0
utils.c
libavformat/utils.c
+17
-0
No files found.
libavformat/internal.h
View file @
e942454d
...
...
@@ -554,4 +554,15 @@ int ffio_open2_wrapper(struct AVFormatContext *s, AVIOContext **pb, const char *
*/
void
ff_format_io_close
(
AVFormatContext
*
s
,
AVIOContext
**
pb
);
/**
* Parse creation_time in AVFormatContext metadata if exists and warn if the
* parsing fails.
*
* @param s AVFormatContext
* @param timestamp parsed timestamp in microseconds, only set on successful parsing
* @param return_seconds set this to get the number of seconds in timestamp instead of microseconds
* @return 1 if OK, 0 if the metadata was not present, AVERROR(EINVAL) on parse error
*/
int
ff_parse_creation_time_metadata
(
AVFormatContext
*
s
,
int64_t
*
timestamp
,
int
return_seconds
);
#endif
/* AVFORMAT_INTERNAL_H */
libavformat/utils.c
View file @
e942454d
...
...
@@ -4751,3 +4751,20 @@ void ff_format_io_close(AVFormatContext *s, AVIOContext **pb)
s
->
io_close
(
s
,
*
pb
);
*
pb
=
NULL
;
}
int
ff_parse_creation_time_metadata
(
AVFormatContext
*
s
,
int64_t
*
timestamp
,
int
return_seconds
)
{
AVDictionaryEntry
*
entry
;
int64_t
parsed_timestamp
;
int
ret
;
if
((
entry
=
av_dict_get
(
s
->
metadata
,
"creation_time"
,
NULL
,
0
)))
{
if
((
ret
=
av_parse_time
(
&
parsed_timestamp
,
entry
->
value
,
0
))
>=
0
)
{
*
timestamp
=
return_seconds
?
parsed_timestamp
/
1000000
:
parsed_timestamp
;
return
1
;
}
else
{
av_log
(
s
,
AV_LOG_WARNING
,
"Failed to parse creation_time %s
\n
"
,
entry
->
value
);
return
ret
;
}
}
return
0
;
}
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