Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
ffworker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Video AG Infrastruktur
ffworker
Commits
b6ebc494
Commit
b6ebc494
authored
7 years ago
by
Julian Rother
Browse files
Options
Downloads
Patches
Plain Diff
Got rid of JSTR_SIZE
parent
9d277ec9
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
remux.c
+3
-4
3 additions, 4 deletions
remux.c
thumbnail.c
+3
-3
3 additions, 3 deletions
thumbnail.c
util.h
+3
-3
3 additions, 3 deletions
util.h
util/json.c
+5
-11
5 additions, 11 deletions
util/json.c
with
14 additions
and
21 deletions
remux.c
+
3
−
4
View file @
b6ebc494
...
...
@@ -9,13 +9,12 @@ static AVRational chapter_time_base = {1, 1};
void
parse_dict
(
AVDictionary
**
d
,
char
*
s
)
{
char
*
val
;
char
key
[
JSTR_SIZE
],
value
[
JSTR_SIZE
];
for
(
s
=
jenter
(
s
);
s
;
s
=
jnext
(
s
))
{
if
(
val
=
jstr
b
(
jvalue
(
s
),
0
,
value
))
av_dict_set
(
d
,
jstr
b
(
s
,
0
,
key
),
val
,
0
);
if
(
val
=
jstr
(
jvalue
(
s
),
0
))
av_dict_set
(
d
,
jstr
(
s
,
0
),
val
,
0
);
else
av_dict_set_int
(
d
,
jstr
b
(
s
,
0
,
key
),
jint
(
jvalue
(
s
),
0
),
0
);
av_dict_set_int
(
d
,
jstr
(
s
,
0
),
jint
(
jvalue
(
s
),
0
),
0
);
}
}
...
...
This diff is collapsed.
Click to expand it.
thumbnail.c
+
3
−
3
View file @
b6ebc494
...
...
@@ -25,7 +25,7 @@ AVFrame *scale_frame(AVFrame *frame, enum AVPixelFormat pix_fmt,
int
main
(
int
argc
,
char
*
argv
[])
{
int
err
,
vidx
;
char
lectureid
[
JSTR_SIZE
],
*
src
,
*
tmp
,
*
dest
;
char
*
src
,
*
tmp
,
*
dest
;
AVFormatContext
*
demux
,
*
mux
;
AVCodecContext
*
dec
,
*
enc
;
AVPacket
pkt
;
...
...
@@ -37,10 +37,10 @@ int main(int argc, char *argv[])
/* Prepare arguments */
jobid
=
atoi
(
argv
[
1
]);
jstrb
(
jlookup
(
argv
[
4
],
"lectureid"
),
"-1"
,
lectureid
);
src
=
mprintf
(
"%s/%s"
,
CONFIG_VIDEOS_RELEASED
,
jstr
(
jlookup
(
argv
[
4
],
"path"
),
""
));
tmp
=
mprintf
(
"%s/.tmp-%i"
,
CONFIG_VIDEOS_TMP
,
jobid
);
dest
=
mprintf
(
"%s/thumbnail/l_%s.jpg"
,
CONFIG_VIDEOS_RELEASED
,
lectureid
);
dest
=
mprintf
(
"%s/thumbnail/l_%s.jpg"
,
CONFIG_VIDEOS_RELEASED
,
jstr
(
jlookup
(
argv
[
4
],
"lectureid"
),
"0"
));
ping_job
(
jobid
,
"running"
,
0
);
/* Open src */
...
...
This diff is collapsed.
Click to expand it.
util.h
+
3
−
3
View file @
b6ebc494
...
...
@@ -19,11 +19,11 @@ int ping_job(int id, char *state, char *status, ...);
void
job_failed
(
char
*
msg
,
...);
/* JSON parser */
#define JS
TR
_SIZE 100
#define JS
ON_KEY
_SIZE 100
ssize_t
jbin
(
char
*
s
,
char
*
buf
,
size_t
len
);
char
*
jstrb
(
char
*
s
,
char
*
err
,
char
*
buf
);
char
*
jstr
(
char
*
s
,
char
*
err
);
char
*
jstrb
(
char
*
s
,
char
*
err
,
char
*
buf
,
size_t
len
);
#define jstr(s, e) jstrb(s, e
,
(
char
[JSON_KEY_SIZE]){0}, JSON_KEY_SIZE)
int
jint
(
char
*
s
,
int
err
);
char
*
jenter
(
char
*
s
);
char
*
jnext
(
char
*
s
);
...
...
This diff is collapsed.
Click to expand it.
util/json.c
+
5
−
11
View file @
b6ebc494
...
...
@@ -135,22 +135,16 @@ ssize_t jbin(char *s, char *buf, size_t len)
return
i
;
}
char
*
jstrb
(
char
*
s
,
char
*
err
,
char
*
buf
)
char
*
jstrb
(
char
*
s
,
char
*
err
,
char
*
buf
,
size_t
len
)
{
ssize_t
res
;
res
=
jbin
(
s
,
buf
,
JSTR_SIZE
);
if
(
res
==
-
1
||
res
+
1
>=
JSTR_SIZE
)
res
=
jbin
(
s
,
buf
,
len
);
if
(
res
==
-
1
||
res
+
1
>=
len
)
return
err
;
buf
[
res
]
=
0
;
return
buf
;
}
char
*
jstr
(
char
*
s
,
char
*
err
)
{
static
__thread
char
buf
[
JSTR_SIZE
];
return
jstrb
(
s
,
err
,
buf
);
}
int
jint
(
char
*
s
,
int
err
)
{
if
(
!
s
)
...
...
@@ -199,14 +193,14 @@ char *jvalue(char *s)
char
*
jlookup
(
char
*
s
,
char
*
key
)
{
static
__thread
char
buf
[
JS
TR
_SIZE
];
static
__thread
char
buf
[
JS
ON_KEY
_SIZE
];
if
(
!
s
)
return
0
;
s
=
skip_ws
(
s
);
if
(
*
s
!=
'{'
)
return
0
;
for
(
s
=
skip_ws
(
s
+
1
);
s
;
s
=
jnext
(
s
))
if
(
!
strcmp
(
jstrb
(
s
,
"INVALID KEY"
,
buf
),
key
))
if
(
!
strcmp
(
jstrb
(
s
,
"INVALID KEY"
,
BL
(
buf
)
)
,
key
))
return
jvalue
(
s
);
return
0
;
}
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