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
92d366f6
Commit
92d366f6
authored
Oct 25, 2014
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat: Print error message on failure of ff_rename()
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
eeb9242b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
9 deletions
+13
-9
hdsenc.c
libavformat/hdsenc.c
+3
-3
internal.h
libavformat/internal.h
+8
-4
smoothstreamingenc.c
libavformat/smoothstreamingenc.c
+2
-2
No files found.
libavformat/hdsenc.c
View file @
92d366f6
...
@@ -204,7 +204,7 @@ static int write_manifest(AVFormatContext *s, int final)
...
@@ -204,7 +204,7 @@ static int write_manifest(AVFormatContext *s, int final)
avio_printf
(
out
,
"</manifest>
\n
"
);
avio_printf
(
out
,
"</manifest>
\n
"
);
avio_flush
(
out
);
avio_flush
(
out
);
avio_close
(
out
);
avio_close
(
out
);
return
ff_rename
(
temp_filename
,
filename
);
return
ff_rename
(
temp_filename
,
filename
,
s
);
}
}
static
void
update_size
(
AVIOContext
*
out
,
int64_t
pos
)
static
void
update_size
(
AVIOContext
*
out
,
int64_t
pos
)
...
@@ -285,7 +285,7 @@ static int write_abst(AVFormatContext *s, OutputStream *os, int final)
...
@@ -285,7 +285,7 @@ static int write_abst(AVFormatContext *s, OutputStream *os, int final)
update_size
(
out
,
afrt_pos
);
update_size
(
out
,
afrt_pos
);
update_size
(
out
,
0
);
update_size
(
out
,
0
);
avio_close
(
out
);
avio_close
(
out
);
return
ff_rename
(
temp_filename
,
filename
);
return
ff_rename
(
temp_filename
,
filename
,
s
);
}
}
static
int
init_file
(
AVFormatContext
*
s
,
OutputStream
*
os
,
int64_t
start_ts
)
static
int
init_file
(
AVFormatContext
*
s
,
OutputStream
*
os
,
int64_t
start_ts
)
...
@@ -480,7 +480,7 @@ static int hds_flush(AVFormatContext *s, OutputStream *os, int final,
...
@@ -480,7 +480,7 @@ static int hds_flush(AVFormatContext *s, OutputStream *os, int final,
snprintf
(
target_filename
,
sizeof
(
target_filename
),
snprintf
(
target_filename
,
sizeof
(
target_filename
),
"%s/stream%dSeg1-Frag%d"
,
s
->
filename
,
index
,
os
->
fragment_index
);
"%s/stream%dSeg1-Frag%d"
,
s
->
filename
,
index
,
os
->
fragment_index
);
ret
=
ff_rename
(
os
->
temp_filename
,
target_filename
);
ret
=
ff_rename
(
os
->
temp_filename
,
target_filename
,
s
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
ret
;
return
ret
;
add_fragment
(
os
,
target_filename
,
os
->
frag_start_ts
,
end_ts
-
os
->
frag_start_ts
);
add_fragment
(
os
,
target_filename
,
os
->
frag_start_ts
,
end_ts
-
os
->
frag_start_ts
);
...
...
libavformat/internal.h
View file @
92d366f6
...
@@ -378,11 +378,15 @@ int ff_generate_avci_extradata(AVStream *st);
...
@@ -378,11 +378,15 @@ int ff_generate_avci_extradata(AVStream *st);
* @param newpath destination path
* @param newpath destination path
* @return 0 or AVERROR on failure
* @return 0 or AVERROR on failure
*/
*/
static
inline
int
ff_rename
(
const
char
*
oldpath
,
const
char
*
newpath
)
static
inline
int
ff_rename
(
const
char
*
oldpath
,
const
char
*
newpath
,
void
*
logctx
)
{
{
if
(
rename
(
oldpath
,
newpath
)
==
-
1
)
int
ret
=
0
;
return
AVERROR
(
errno
);
if
(
rename
(
oldpath
,
newpath
)
==
-
1
)
{
return
0
;
ret
=
AVERROR
(
errno
);
if
(
logctx
)
av_log
(
logctx
,
AV_LOG_ERROR
,
"failed to rename file %s to %s
\n
"
,
oldpath
,
newpath
);
}
return
ret
;
}
}
/**
/**
...
...
libavformat/smoothstreamingenc.c
View file @
92d366f6
...
@@ -283,7 +283,7 @@ static int write_manifest(AVFormatContext *s, int final)
...
@@ -283,7 +283,7 @@ static int write_manifest(AVFormatContext *s, int final)
avio_printf
(
out
,
"</SmoothStreamingMedia>
\n
"
);
avio_printf
(
out
,
"</SmoothStreamingMedia>
\n
"
);
avio_flush
(
out
);
avio_flush
(
out
);
avio_close
(
out
);
avio_close
(
out
);
return
ff_rename
(
temp_filename
,
filename
);
return
ff_rename
(
temp_filename
,
filename
,
s
);
}
}
static
int
ism_write_header
(
AVFormatContext
*
s
)
static
int
ism_write_header
(
AVFormatContext
*
s
)
...
@@ -540,7 +540,7 @@ static int ism_flush(AVFormatContext *s, int final)
...
@@ -540,7 +540,7 @@ static int ism_flush(AVFormatContext *s, int final)
snprintf
(
header_filename
,
sizeof
(
header_filename
),
"%s/FragmentInfo(%s=%"
PRIu64
")"
,
os
->
dirname
,
os
->
stream_type_tag
,
start_ts
);
snprintf
(
header_filename
,
sizeof
(
header_filename
),
"%s/FragmentInfo(%s=%"
PRIu64
")"
,
os
->
dirname
,
os
->
stream_type_tag
,
start_ts
);
snprintf
(
target_filename
,
sizeof
(
target_filename
),
"%s/Fragments(%s=%"
PRIu64
")"
,
os
->
dirname
,
os
->
stream_type_tag
,
start_ts
);
snprintf
(
target_filename
,
sizeof
(
target_filename
),
"%s/Fragments(%s=%"
PRIu64
")"
,
os
->
dirname
,
os
->
stream_type_tag
,
start_ts
);
copy_moof
(
s
,
filename
,
header_filename
,
moof_size
);
copy_moof
(
s
,
filename
,
header_filename
,
moof_size
);
ret
=
ff_rename
(
filename
,
target_filename
);
ret
=
ff_rename
(
filename
,
target_filename
,
s
);
if
(
ret
<
0
)
if
(
ret
<
0
)
break
;
break
;
add_fragment
(
os
,
target_filename
,
header_filename
,
start_ts
,
duration
,
add_fragment
(
os
,
target_filename
,
header_filename
,
start_ts
,
duration
,
...
...
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