summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-01-01 01:58:20 +0100
committerJames Almer <jamrial@gmail.com>2020-01-27 16:38:06 -0300
commit44be057380384ed8168d17571ffd2763506048e6 (patch)
tree60678f941a8a29ce76b8c6a7161700aa7773c608 /libavformat
parent9c8aa86883f28fc27ca790b290c3be2d347b0d19 (diff)
avformat/matroskaenc: Remove useless AVIOContext
Write a few numbers directly via AV_WB32 instead of using an AVIOContext (that is initialized only for this very purpose) to write these numbers at known offsets into a fixed buffer. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/matroskaenc.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 799b2ef6eb..eec07d1ffd 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -944,7 +944,6 @@ static int mkv_write_video_color(AVIOContext *pb, AVCodecParameters *par, AVStre
static int mkv_write_video_projection(AVFormatContext *s, AVIOContext *pb,
AVStream *st)
{
- AVIOContext b;
ebml_master projection;
int side_data_size = 0;
uint8_t private[20];
@@ -974,26 +973,24 @@ static int mkv_write_video_projection(AVFormatContext *s, AVIOContext *pb,
MATROSKA_VIDEO_PROJECTION_TYPE_EQUIRECTANGULAR);
break;
case AV_SPHERICAL_EQUIRECTANGULAR_TILE:
- ffio_init_context(&b, private, 20, 1, NULL, NULL, NULL, NULL);
put_ebml_uint(pb, MATROSKA_ID_VIDEOPROJECTIONTYPE,
MATROSKA_VIDEO_PROJECTION_TYPE_EQUIRECTANGULAR);
- avio_wb32(&b, 0); // version + flags
- avio_wb32(&b, spherical->bound_top);
- avio_wb32(&b, spherical->bound_bottom);
- avio_wb32(&b, spherical->bound_left);
- avio_wb32(&b, spherical->bound_right);
+ AV_WB32(private, 0); // version + flags
+ AV_WB32(private + 4, spherical->bound_top);
+ AV_WB32(private + 8, spherical->bound_bottom);
+ AV_WB32(private + 12, spherical->bound_left);
+ AV_WB32(private + 16, spherical->bound_right);
put_ebml_binary(pb, MATROSKA_ID_VIDEOPROJECTIONPRIVATE,
- private, avio_tell(&b));
+ private, 20);
break;
case AV_SPHERICAL_CUBEMAP:
- ffio_init_context(&b, private, 12, 1, NULL, NULL, NULL, NULL);
put_ebml_uint(pb, MATROSKA_ID_VIDEOPROJECTIONTYPE,
MATROSKA_VIDEO_PROJECTION_TYPE_CUBEMAP);
- avio_wb32(&b, 0); // version + flags
- avio_wb32(&b, 0); // layout
- avio_wb32(&b, spherical->padding);
+ AV_WB32(private, 0); // version + flags
+ AV_WB32(private + 4, 0); // layout
+ AV_WB32(private + 8, spherical->padding);
put_ebml_binary(pb, MATROSKA_ID_VIDEOPROJECTIONPRIVATE,
- private, avio_tell(&b));
+ private, 12);
break;
default:
av_assert0(0);