diff mbox series

[FFmpeg-devel,v2] avformat/webm_chunk: Don't keep pointer to AVOutputFormat

Message ID 20200313233226.19858-1-andreas.rheinhardt@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel,v2] avformat/webm_chunk: Don't keep pointer to AVOutputFormat
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork warning Failed to apply patch

Commit Message

Andreas Rheinhardt March 13, 2020, 11:32 p.m. UTC
It is no longer needed given that the function pointers of the child
muxer's AVOutputFormat are no longer called directly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
The difference to the previous version is that this version is not based
upon my patch [1], so that the patches to webm_chunk are not blocked by
it.

[1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-March/257844.html

 libavformat/webm_chunk.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/webm_chunk.c b/libavformat/webm_chunk.c
index d4b2eb6dff..30ba30e929 100644
--- a/libavformat/webm_chunk.c
+++ b/libavformat/webm_chunk.c
@@ -53,19 +53,23 @@  typedef struct WebMChunkContext {
     char *http_method;
     uint64_t duration_written;
     int64_t prev_pts;
-    ff_const59 AVOutputFormat *oformat;
     AVFormatContext *avf;
 } WebMChunkContext;
 
 static int chunk_mux_init(AVFormatContext *s)
 {
     WebMChunkContext *wc = s->priv_data;
+    ff_const59 AVOutputFormat *oformat;
     AVFormatContext *oc;
     AVStream *st, *ost = s->streams[0];
     AVDictionary *dict = NULL;
     int ret;
 
-    ret = avformat_alloc_output_context2(&wc->avf, wc->oformat, NULL, NULL);
+    oformat = av_guess_format("webm", s->url, "video/webm");
+    if (!oformat)
+        return AVERROR_MUXER_NOT_FOUND;
+
+    ret = avformat_alloc_output_context2(&wc->avf, oformat, NULL, NULL);
     if (ret < 0)
         return ret;
     oc = wc->avf;
@@ -156,9 +160,6 @@  static int webm_chunk_write_header(AVFormatContext *s)
     if (s->nb_streams != 1) { return AVERROR_INVALIDDATA; }
 
     wc->chunk_index = wc->chunk_start_index;
-    wc->oformat = av_guess_format("webm", s->url, "video/webm");
-    if (!wc->oformat)
-        return AVERROR_MUXER_NOT_FOUND;
     wc->prev_pts = AV_NOPTS_VALUE;
 
     ret = chunk_mux_init(s);