[FFmpeg-cvslog] avformat/matroskaenc: Simplify writing buffer
Andreas Rheinhardt
git at videolan.org
Wed May 6 11:49:42 EEST 2020
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Wed Apr 29 20:33:06 2020 +0200| [8370c9c206367acaec1130fe47582590123b1b64] | committer: Andreas Rheinhardt
avformat/matroskaenc: Simplify writing buffer
If one already has the contents of a master elements in a buffer of
known size, then writing a EBML master element is no different from
writing an EBML binary element. It is overtly complicated to use
start/end_ebml_master() as these functions first write an unkown-length
size field of the appropriate length, then write the buffer's contents,
followed by a seek to the length field to overwrite it with the real
size (obtained via avio_tell() although it was already known in
advance), followed by another seek to the previous position. Just use
put_ebml_binary() instead.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8370c9c206367acaec1130fe47582590123b1b64
---
libavformat/matroskaenc.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index e404b4d97f..1d155bc5c2 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -893,9 +893,7 @@ static void mkv_write_video_color(AVIOContext *pb, const AVCodecParameters *par,
colorinfo_size = avio_tell(dyn_cp);
if (colorinfo_size) {
- ebml_master colorinfo = start_ebml_master(pb, MATROSKA_ID_VIDEOCOLOR, colorinfo_size);
- avio_write(pb, colour, colorinfo_size);
- end_ebml_master(pb, colorinfo);
+ put_ebml_binary(pb, MATROSKA_ID_VIDEOCOLOR, colour, colorinfo_size);
}
}
More information about the ffmpeg-cvslog
mailing list