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
001d668d
Commit
001d668d
authored
Jul 13, 2011
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf: factor out conversion of ISO8601 string to unix time
parent
b21e6b70
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
21 deletions
+20
-21
dvenc.c
libavformat/dvenc.c
+2
-5
gxfenc.c
libavformat/gxfenc.c
+2
-6
internal.h
libavformat/internal.h
+5
-0
movenc.c
libavformat/movenc.c
+2
-5
mxfenc.c
libavformat/mxfenc.c
+2
-5
utils.c
libavformat/utils.c
+7
-0
No files found.
libavformat/dvenc.c
View file @
001d668d
...
...
@@ -343,11 +343,8 @@ static DVMuxContext* dv_init_mux(AVFormatContext* s)
c
->
start_time
=
s
->
timestamp
;
else
#endif
if
(
t
=
av_dict_get
(
s
->
metadata
,
"creation_time"
,
NULL
,
0
))
{
struct
tm
time
=
{
0
};
strptime
(
t
->
value
,
"%Y - %m - %dT%T"
,
&
time
);
c
->
start_time
=
mktime
(
&
time
);
}
if
(
t
=
av_dict_get
(
s
->
metadata
,
"creation_time"
,
NULL
,
0
))
c
->
start_time
=
ff_iso8601_to_unix_time
(
t
->
value
);
for
(
i
=
0
;
i
<
c
->
n_ast
;
i
++
)
{
if
(
c
->
ast
[
i
]
&&
!
(
c
->
audio_data
[
i
]
=
av_fifo_alloc
(
100
*
AVCODEC_MAX_AUDIO_FRAME_SIZE
)))
{
...
...
libavformat/gxfenc.c
View file @
001d668d
...
...
@@ -402,12 +402,8 @@ static int gxf_write_umf_material_description(AVFormatContext *s)
timestamp
=
s
->
timestamp
;
else
#endif
if
(
t
=
av_dict_get
(
s
->
metadata
,
"creation_time"
,
NULL
,
0
))
{
struct
tm
time
=
{
0
};
strptime
(
t
->
value
,
"%Y - %m - %dT%T"
,
&
time
);
timestamp
=
mktime
(
&
time
);
}
if
(
t
=
av_dict_get
(
s
->
metadata
,
"creation_time"
,
NULL
,
0
))
timestamp
=
ff_iso8601_to_unix_time
(
t
->
value
);
// XXX drop frame
uint32_t
timecode
=
...
...
libavformat/internal.h
View file @
001d668d
...
...
@@ -248,4 +248,9 @@ void ff_make_absolute_url(char *buf, int size, const char *base,
enum
CodecID
ff_guess_image2_codec
(
const
char
*
filename
);
/**
* Convert a date string in ISO8601 format to Unix timestamp.
*/
int64_t
ff_iso8601_to_unix_time
(
const
char
*
datestr
);
#endif
/* AVFORMAT_INTERNAL_H */
libavformat/movenc.c
View file @
001d668d
...
...
@@ -2266,11 +2266,8 @@ static int mov_write_header(AVFormatContext *s)
mov
->
time
=
s
->
timestamp
;
else
#endif
if
(
t
=
av_dict_get
(
s
->
metadata
,
"creation_time"
,
NULL
,
0
))
{
struct
tm
time
=
{
0
};
strptime
(
t
->
value
,
"%Y - %m - %dT%T"
,
&
time
);
mov
->
time
=
mktime
(
&
time
);
}
if
(
t
=
av_dict_get
(
s
->
metadata
,
"creation_time"
,
NULL
,
0
))
mov
->
time
=
ff_iso8601_to_unix_time
(
t
->
value
);
mov
->
time
+=
0x7C25B080
;
//1970 based -> 1904 based
if
(
mov
->
chapter_track
)
...
...
libavformat/mxfenc.c
View file @
001d668d
...
...
@@ -1519,11 +1519,8 @@ static int mxf_write_header(AVFormatContext *s)
timestamp
=
s
->
timestamp
;
else
#endif
if
(
t
=
av_dict_get
(
s
->
metadata
,
"creation_time"
,
NULL
,
0
))
{
struct
tm
time
=
{
0
};
strptime
(
t
->
value
,
"%Y - %m - %dT%T"
,
&
time
);
timestamp
=
mktime
(
&
time
);
}
if
(
t
=
av_dict_get
(
s
->
metadata
,
"creation_time"
,
NULL
,
0
))
timestamp
=
ff_iso8601_to_unix_time
(
t
->
value
);
if
(
timestamp
)
mxf
->
timestamp
=
mxf_parse_timestamp
(
timestamp
);
mxf
->
duration
=
-
1
;
...
...
libavformat/utils.c
View file @
001d668d
...
...
@@ -3884,3 +3884,10 @@ void ff_make_absolute_url(char *buf, int size, const char *base,
}
av_strlcat
(
buf
,
rel
,
size
);
}
int64_t
ff_iso8601_to_unix_time
(
const
char
*
datestr
)
{
struct
tm
time
=
{
0
};
strptime
(
datestr
,
"%Y - %m - %dT%T"
,
&
time
);
return
mktime
(
&
time
);
}
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