mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-23 04:24:35 +02:00
avformat/avio: move ff_rename implementation from internal.h to avio.c
Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
parent
15133c6ab2
commit
df993269ec
libavformat
@ -26,6 +26,7 @@
|
|||||||
#include "libavutil/avassert.h"
|
#include "libavutil/avassert.h"
|
||||||
#include "os_support.h"
|
#include "os_support.h"
|
||||||
#include "avformat.h"
|
#include "avformat.h"
|
||||||
|
#include "internal.h"
|
||||||
#if CONFIG_NETWORK
|
#if CONFIG_NETWORK
|
||||||
#include "network.h"
|
#include "network.h"
|
||||||
#endif
|
#endif
|
||||||
@ -665,3 +666,17 @@ int ff_check_interrupt(AVIOInterruptCB *cb)
|
|||||||
return cb->callback(cb->opaque);
|
return cb->callback(cb->opaque);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ff_rename(const char *oldpath, const char *newpath, void *logctx)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
if (rename(oldpath, newpath) == -1) {
|
||||||
|
ret = AVERROR(errno);
|
||||||
|
if (logctx) {
|
||||||
|
char err[AV_ERROR_MAX_STRING_SIZE] = {0};
|
||||||
|
av_make_error_string(err, AV_ERROR_MAX_STRING_SIZE, ret);
|
||||||
|
av_log(logctx, AV_LOG_ERROR, "failed to rename file %s to %s: %s\n", oldpath, newpath, err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
@ -586,19 +586,7 @@ int ff_stream_encode_params_copy(AVStream *dst, const AVStream *src);
|
|||||||
* @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, void *logctx)
|
int ff_rename(const char *oldpath, const char *newpath, void *logctx);
|
||||||
{
|
|
||||||
int ret = 0;
|
|
||||||
if (rename(oldpath, newpath) == -1) {
|
|
||||||
ret = AVERROR(errno);
|
|
||||||
if (logctx) {
|
|
||||||
char err[AV_ERROR_MAX_STRING_SIZE] = {0};
|
|
||||||
av_make_error_string(err, AV_ERROR_MAX_STRING_SIZE, ret);
|
|
||||||
av_log(logctx, AV_LOG_ERROR, "failed to rename file %s to %s: %s\n", oldpath, newpath, err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end
|
* Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user