Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Video AG Infrastruktur
ffworker
Commits
30c0a4cf
Commit
30c0a4cf
authored
Nov 28, 2017
by
Julian Rother
Browse files
Moved checktime out of transcode.c and added calls to remux
parent
a8ab6dea
Changes
4
Hide whitespace changes
Inline
Side-by-side
remux.c
View file @
30c0a4cf
...
...
@@ -57,6 +57,8 @@ int main(int argc, char *argv[])
job_failed
(
"Writing temporary file failed: %s"
,
av_err2str
(
err
));
while
(
!
av_read_frame
(
demux
,
&
pkt
))
{
if
(
!
checktime
(
30
))
ping_job
(
jobid
,
"running"
,
0
);
if
(
pkt
.
stream_index
>=
demux
->
nb_streams
||
idxmap
[
pkt
.
stream_index
]
==
-
1
)
continue
;
...
...
transcode.c
View file @
30c0a4cf
#include
<stdio.h>
#include
<unistd.h>
#include
<time.h>
#include
<libavutil/opt.h>
#include
<libavcodec/avcodec.h>
#include
<libavformat/avformat.h>
...
...
@@ -245,22 +244,6 @@ void connect_pads(AVFilterInOut **ins, AVFilterInOut **outs)
}
}
int
checktime
(
time_t
min
)
{
static
struct
timespec
prev
=
{};
time_t
delta
;
struct
timespec
t
;
clock_gettime
(
CLOCK_MONOTONIC
,
&
t
);
if
(
t
.
tv_sec
<
prev
.
tv_sec
)
delta
=
min
;
else
delta
=
t
.
tv_sec
-
prev
.
tv_sec
;
if
(
delta
<
min
)
return
1
;
memcpy
(
&
prev
,
&
t
,
sizeof
(
prev
));
return
0
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
err
,
i
,
progress
,
_progress
;
...
...
util.h
View file @
30c0a4cf
...
...
@@ -17,6 +17,7 @@ double fileduration(char *path);
size_t
filesize
(
char
*
path
);
char
*
json_fileinfo
(
char
*
path
);
void
overwrite_check
(
char
*
path
);
int
checktime
(
time_t
min
);
#define WORKER_APIKEY "WORKER_APIKEY"
#define WORKER_APIBASE "WORKER_APIBASE"
...
...
util/checktime.c
0 → 100644
View file @
30c0a4cf
#include
<time.h>
#include
<string.h>
#include
"../util.h"
int
checktime
(
time_t
min
)
{
static
struct
timespec
prev
=
{};
time_t
delta
;
struct
timespec
t
;
clock_gettime
(
CLOCK_MONOTONIC
,
&
t
);
if
(
t
.
tv_sec
<
prev
.
tv_sec
)
delta
=
min
;
else
delta
=
t
.
tv_sec
-
prev
.
tv_sec
;
if
(
delta
<
min
)
return
1
;
memcpy
(
&
prev
,
&
t
,
sizeof
(
prev
));
return
0
;
}
Write
Preview
Supports
Markdown
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