avformat/utils: Move ff_format_output_open() to mux_utils.c

It is obviously a muxing-only function.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2022-05-06 16:45:00 +02:00
parent d78838414b
commit 437484a66a
6 changed files with 22 additions and 21 deletions

View File

@ -28,6 +28,7 @@
#include "libavutil/threadmessage.h"
#include "avformat.h"
#include "internal.h"
#include "mux.h"
#define FIFO_DEFAULT_QUEUE_SIZE 60
#define FIFO_DEFAULT_MAX_RECOVERY_ATTEMPTS 0

View File

@ -849,16 +849,6 @@ int ff_copy_whiteblacklists(AVFormatContext *dst, const AVFormatContext *src);
*/
#define FFERROR_REDO FFERRTAG('R','E','D','O')
/**
* Utility function to open IO stream of output format.
*
* @param s AVFormatContext
* @param url URL or file name to open for writing
* @options optional options which will be passed to io_open callback
* @return >=0 on success, negative AVERROR in case of failure
*/
int ff_format_output_open(AVFormatContext *s, const char *url, AVDictionary **options);
/*
* A wrapper around AVFormatContext.io_close that should be used
* instead of calling the pointer directly.

View File

@ -103,6 +103,16 @@ enum AVWriteUncodedFrameFlags {
*/
int ff_format_shift_data(AVFormatContext *s, int64_t read_start, int shift_size);
/**
* Utility function to open IO stream of output format.
*
* @param s AVFormatContext
* @param url URL or file name to open for writing
* @options optional options which will be passed to io_open callback
* @return >=0 on success, negative AVERROR in case of failure
*/
int ff_format_output_open(AVFormatContext *s, const char *url, AVDictionary **options);
/**
* Parse creation_time in AVFormatContext metadata if exists and warn if the
* parsing fails.

View File

@ -85,6 +85,16 @@ end:
return ret;
}
int ff_format_output_open(AVFormatContext *s, const char *url, AVDictionary **options)
{
if (!s->oformat)
return AVERROR(EINVAL);
if (!(s->oformat->flags & AVFMT_NOFILE))
return s->io_open(s, &s->pb, url, AVIO_FLAG_WRITE, options);
return 0;
}
int ff_parse_creation_time_metadata(AVFormatContext *s, int64_t *timestamp, int return_seconds)
{
AVDictionaryEntry *entry;

View File

@ -26,7 +26,7 @@
#include "libavcodec/bsf.h"
#include "internal.h"
#include "avformat.h"
#include "avio_internal.h"
#include "mux.h"
#include "tee_common.h"
typedef enum {

View File

@ -1655,16 +1655,6 @@ uint8_t *av_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type,
return data;
}
int ff_format_output_open(AVFormatContext *s, const char *url, AVDictionary **options)
{
if (!s->oformat)
return AVERROR(EINVAL);
if (!(s->oformat->flags & AVFMT_NOFILE))
return s->io_open(s, &s->pb, url, AVIO_FLAG_WRITE, options);
return 0;
}
void ff_format_io_close_default(AVFormatContext *s, AVIOContext *pb)
{
avio_close(pb);