Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
92d366f6
Commit
92d366f6
authored
10 years ago
by
Michael Niedermayer
Browse files
Options
Downloads
Patches
Plain Diff
avformat: Print error message on failure of ff_rename()
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
eeb9242b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
libavformat/hdsenc.c
+3
-3
3 additions, 3 deletions
libavformat/hdsenc.c
libavformat/internal.h
+8
-4
8 additions, 4 deletions
libavformat/internal.h
libavformat/smoothstreamingenc.c
+2
-2
2 additions, 2 deletions
libavformat/smoothstreamingenc.c
with
13 additions
and
9 deletions
libavformat/hdsenc.c
+
3
−
3
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
);
...
...
This diff is collapsed.
Click to expand it.
libavformat/internal.h
+
8
−
4
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
;
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
libavformat/smoothstreamingenc.c
+
2
−
2
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
,
...
...
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