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
d8157635
Commit
d8157635
authored
Sep 01, 2012
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf/segment: add escaping for filename field of the CSV list file
CSV escaping code is borrowed from ffprobe.c.
parent
29948971
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
3 deletions
+28
-3
muxers.texi
doc/muxers.texi
+2
-2
segment.c
libavformat/segment.c
+26
-1
No files found.
doc/muxers.texi
View file @
d8157635
...
...
@@ -498,8 +498,8 @@ each line matching the format:
@end example
@var{segment_filename} is the name of the output file generated by the
muxer according to the provided pattern
, and should not contain the
"," character for simplifying parsing operations
.
muxer according to the provided pattern
. CSV escaping (according to
RFC4180) is applied if required
.
@var{segment_start_time} and @var{segment_end_time} specify
the segment start and end time expressed in seconds.
...
...
libavformat/segment.c
View file @
d8157635
...
...
@@ -67,6 +67,30 @@ typedef struct {
double
start_time
,
end_time
;
}
SegmentContext
;
static
void
print_csv_escaped_str
(
AVIOContext
*
ctx
,
const
char
*
str
)
{
const
char
*
p
;
int
quote
=
0
;
/* check if input needs quoting */
for
(
p
=
str
;
*
p
;
p
++
)
if
(
strchr
(
"
\"
,
\n\r
"
,
*
p
))
{
quote
=
1
;
break
;
}
if
(
quote
)
avio_w8
(
ctx
,
'"'
);
for
(
p
=
str
;
*
p
;
p
++
)
{
if
(
*
p
==
'"'
)
avio_w8
(
ctx
,
'"'
);
avio_w8
(
ctx
,
*
p
);
}
if
(
quote
)
avio_w8
(
ctx
,
'"'
);
}
static
int
segment_start
(
AVFormatContext
*
s
)
{
SegmentContext
*
seg
=
s
->
priv_data
;
...
...
@@ -169,7 +193,8 @@ static int segment_end(AVFormatContext *s)
if
(
seg
->
list_type
==
LIST_TYPE_FLAT
)
{
avio_printf
(
seg
->
list_pb
,
"%s
\n
"
,
oc
->
filename
);
}
else
if
(
seg
->
list_type
==
LIST_TYPE_EXT
)
{
avio_printf
(
seg
->
list_pb
,
"%s,%f,%f
\n
"
,
oc
->
filename
,
seg
->
start_time
,
seg
->
end_time
);
print_csv_escaped_str
(
seg
->
list_pb
,
oc
->
filename
);
avio_printf
(
seg
->
list_pb
,
",%f,%f
\n
"
,
seg
->
start_time
,
seg
->
end_time
);
}
else
if
(
seg
->
list_type
==
LIST_TYPE_M3U8
)
{
avio_printf
(
seg
->
list_pb
,
"#EXTINF:%f,
\n
%s
\n
"
,
seg
->
end_time
-
seg
->
start_time
,
oc
->
filename
);
...
...
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