Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodger Combs <rodger.combs@gmail.com>2016-06-25 06:02:50 +0300
committerRodger Combs <rodger.combs@gmail.com>2016-10-24 11:53:21 +0300
commita246fef163387c0d79830a9bdf408443a9aba1c1 (patch)
treeba5a56853e481e34c2cf2dcceaae00cb0b2ae883 /libavformat/avformat.h
parent8a24e03684cad4b8207a0317123ca2bd544d012e (diff)
lavf/mux: add avformat_init_output
This allows a consumer to run the muxer's init function without actually writing the header, which is useful in chained muxers that support automatic bitstream filtering.
Diffstat (limited to 'libavformat/avformat.h')
-rw-r--r--libavformat/avformat.h34
1 files changed, 32 insertions, 2 deletions
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 057f8c58aa..82ca7277ae 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -618,6 +618,8 @@ typedef struct AVOutputFormat {
* AVStream parameters that need to be set before packets are sent.
* This method must not write output.
*
+ * Return 0 if streams were fully configured, 1 if not, negative AVERROR on failure
+ *
* Any allocations made here must be freed in deinit().
*/
int (*init)(struct AVFormatContext *);
@@ -2374,6 +2376,10 @@ void avformat_close_input(AVFormatContext **s);
* @addtogroup lavf_encoding
* @{
*/
+
+#define AVSTREAM_INIT_IN_WRITE_HEADER 0 ///< stream parameters initialized in avformat_write_header
+#define AVSTREAM_INIT_IN_INIT_OUTPUT 1 ///< stream parameters initialized in avformat_init_output
+
/**
* Allocate the stream private data and write the stream header to
* an output media file.
@@ -2385,14 +2391,38 @@ void avformat_close_input(AVFormatContext **s);
* On return this parameter will be destroyed and replaced with a dict containing
* options that were not found. May be NULL.
*
- * @return 0 on success, negative AVERROR on failure.
+ * @return AVSTREAM_INIT_IN_WRITE_HEADER on success if the codec had not already been fully initialized in avformat_init,
+ * AVSTREAM_INIT_IN_INIT_OUTPUT on success if the codec had already been fully initialized in avformat_init,
+ * negative AVERROR on failure.
*
- * @see av_opt_find, av_dict_set, avio_open, av_oformat_next.
+ * @see av_opt_find, av_dict_set, avio_open, av_oformat_next, avformat_init_output.
*/
av_warn_unused_result
int avformat_write_header(AVFormatContext *s, AVDictionary **options);
/**
+ * Allocate the stream private data and initialize the codec, but do not write the header.
+ * May optionally be used before avformat_write_header to initialize stream parameters
+ * before actually writing the header.
+ * If using this function, do not pass the same options to avformat_write_header.
+ *
+ * @param s Media file handle, must be allocated with avformat_alloc_context().
+ * Its oformat field must be set to the desired output format;
+ * Its pb field must be set to an already opened AVIOContext.
+ * @param options An AVDictionary filled with AVFormatContext and muxer-private options.
+ * On return this parameter will be destroyed and replaced with a dict containing
+ * options that were not found. May be NULL.
+ *
+ * @return AVSTREAM_INIT_IN_WRITE_HEADER on success if the codec requires avformat_write_header to fully initialize,
+ * AVSTREAM_INIT_IN_INIT_OUTPUT on success if the codec has been fully initialized,
+ * negative AVERROR on failure.
+ *
+ * @see av_opt_find, av_dict_set, avio_open, av_oformat_next, avformat_write_header.
+ */
+av_warn_unused_result
+int avformat_init_output(AVFormatContext *s, AVDictionary **options);
+
+/**
* Write a packet to an output media file.
*
* This function passes the packet directly to the muxer, without any buffering