[FFmpeg-devel] [PATCH 3/6] avformat/argo_asf: use ArgoASFContext in muxer

Zane van Iperen zane at zanevaniperen.com
Sat Aug 8 11:00:53 EEST 2020


Preparation for options.

Signed-off-by: Zane van Iperen <zane at zanevaniperen.com>
---
 libavformat/argo_asf.c | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c
index 52e37f9c10..1770192aad 100644
--- a/libavformat/argo_asf.c
+++ b/libavformat/argo_asf.c
@@ -292,29 +292,28 @@ static void argo_asf_write_chunk_header(const ArgoASFChunkHeader *ckhdr, AVIOCon
 
 static int argo_asf_write_header(AVFormatContext *s)
 {
-    const AVCodecParameters  *par = s->streams[0]->codecpar;
-    ArgoASFFileHeader  fhdr;
-    ArgoASFChunkHeader chdr;
-
-    fhdr.magic         = ASF_TAG;
-    fhdr.version_major = 2;
-    fhdr.version_minor = 1;
-    fhdr.num_chunks    = 1;
-    fhdr.chunk_offset  = ASF_FILE_HEADER_SIZE;
-    strncpy(fhdr.name, av_basename(s->url), FF_ARRAY_ELEMS(fhdr.name));
-
-    chdr.num_blocks    = 0;
-    chdr.num_samples   = ASF_SAMPLE_COUNT;
-    chdr.unk1          = 0;
-    chdr.sample_rate   = par->sample_rate;
-    chdr.unk2          = ~0;
-    chdr.flags         = ASF_CF_BITS_PER_SAMPLE | ASF_CF_ALWAYS1;
+    const AVCodecParameters *par = s->streams[0]->codecpar;
+    ArgoASFContext          *ctx = s->priv_data;
+
+    ctx->fhdr.magic              = ASF_TAG;
+    ctx->fhdr.version_major      = 2;
+    ctx->fhdr.version_minor      = 1;
+    ctx->fhdr.num_chunks         = 1;
+    ctx->fhdr.chunk_offset       = ASF_FILE_HEADER_SIZE;
+    strncpy(ctx->fhdr.name, av_basename(s->url), FF_ARRAY_ELEMS(ctx->fhdr.name));
+
+    ctx->ckhdr.num_blocks        = 0;
+    ctx->ckhdr.num_samples       = ASF_SAMPLE_COUNT;
+    ctx->ckhdr.unk1              = 0;
+    ctx->ckhdr.sample_rate       = par->sample_rate;
+    ctx->ckhdr.unk2              = ~0;
+    ctx->ckhdr.flags             = ASF_CF_BITS_PER_SAMPLE | ASF_CF_ALWAYS1;
 
     if (par->channels == 2)
-        chdr.flags |= ASF_CF_STEREO;
+        ctx->ckhdr.flags |= ASF_CF_STEREO;
 
-    argo_asf_write_file_header(&fhdr, s->pb);
-    argo_asf_write_chunk_header(&chdr, s->pb);
+    argo_asf_write_file_header(&ctx->fhdr, s->pb);
+    argo_asf_write_chunk_header(&ctx->ckhdr, s->pb);
     return 0;
 }
 
@@ -353,6 +352,7 @@ AVOutputFormat ff_argo_asf_muxer = {
     .init           = argo_asf_write_init,
     .write_header   = argo_asf_write_header,
     .write_packet   = argo_asf_write_packet,
-    .write_trailer  = argo_asf_write_trailer
+    .write_trailer  = argo_asf_write_trailer,
+    .priv_data_size = sizeof(ArgoASFContext)
 };
 #endif
-- 
2.25.1




More information about the ffmpeg-devel mailing list