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
d93d03a4
Commit
d93d03a4
authored
Dec 13, 2012
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf/segment: add function set_segment_filename()
Factorize.
parent
616e6ffa
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
12 deletions
+18
-12
segment.c
libavformat/segment.c
+18
-12
No files found.
libavformat/segment.c
View file @
d93d03a4
...
@@ -130,6 +130,21 @@ static int segment_mux_init(AVFormatContext *s)
...
@@ -130,6 +130,21 @@ static int segment_mux_init(AVFormatContext *s)
return
0
;
return
0
;
}
}
static
int
set_segment_filename
(
AVFormatContext
*
s
)
{
SegmentContext
*
seg
=
s
->
priv_data
;
AVFormatContext
*
oc
=
seg
->
avf
;
if
(
seg
->
segment_idx_wrap
)
seg
->
segment_idx
%=
seg
->
segment_idx_wrap
;
if
(
av_get_frame_filename
(
oc
->
filename
,
sizeof
(
oc
->
filename
),
s
->
filename
,
seg
->
segment_idx
)
<
0
)
{
av_log
(
oc
,
AV_LOG_ERROR
,
"Invalid segment filename template '%s'
\n
"
,
s
->
filename
);
return
AVERROR
(
EINVAL
);
}
return
0
;
}
static
int
segment_start
(
AVFormatContext
*
s
,
int
write_header
)
static
int
segment_start
(
AVFormatContext
*
s
,
int
write_header
)
{
{
SegmentContext
*
seg
=
s
->
priv_data
;
SegmentContext
*
seg
=
s
->
priv_data
;
...
@@ -145,14 +160,8 @@ static int segment_start(AVFormatContext *s, int write_header)
...
@@ -145,14 +160,8 @@ static int segment_start(AVFormatContext *s, int write_header)
}
}
seg
->
segment_idx
++
;
seg
->
segment_idx
++
;
if
(
seg
->
segment_idx_wrap
)
if
((
err
=
set_segment_filename
(
s
))
<
0
)
seg
->
segment_idx
%=
seg
->
segment_idx_wrap
;
return
err
;
if
(
av_get_frame_filename
(
oc
->
filename
,
sizeof
(
oc
->
filename
),
s
->
filename
,
seg
->
segment_idx
)
<
0
)
{
av_log
(
oc
,
AV_LOG_ERROR
,
"Invalid segment filename template '%s'
\n
"
,
s
->
filename
);
return
AVERROR
(
EINVAL
);
}
seg
->
segment_count
++
;
seg
->
segment_count
++
;
if
((
err
=
avio_open2
(
&
oc
->
pb
,
oc
->
filename
,
AVIO_FLAG_WRITE
,
if
((
err
=
avio_open2
(
&
oc
->
pb
,
oc
->
filename
,
AVIO_FLAG_WRITE
,
...
@@ -413,11 +422,8 @@ static int seg_write_header(AVFormatContext *s)
...
@@ -413,11 +422,8 @@ static int seg_write_header(AVFormatContext *s)
goto
fail
;
goto
fail
;
oc
=
seg
->
avf
;
oc
=
seg
->
avf
;
if
(
av_get_frame_filename
(
oc
->
filename
,
sizeof
(
oc
->
filename
),
if
((
ret
=
set_segment_filename
(
s
))
<
0
)
s
->
filename
,
seg
->
segment_idx
)
<
0
)
{
ret
=
AVERROR
(
EINVAL
);
goto
fail
;
goto
fail
;
}
seg
->
segment_count
++
;
seg
->
segment_count
++
;
if
(
seg
->
write_header_trailer
)
{
if
(
seg
->
write_header_trailer
)
{
...
...
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