From 9c12d54afa70f3535a7114498433cf566a9e9a86 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 31 Jan 2017 14:48:10 +0100 Subject: demux_mkv: passthrough BlockAdditions for libvpx alpha Dumb but simple thing. Requires the FFmpeg libvpx decoder wrapper, as its native decoder doesn't support alpha. --- demux/packet.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'demux/packet.c') diff --git a/demux/packet.c b/demux/packet.c index b33d5b618e..4ee9253ebf 100644 --- a/demux/packet.c +++ b/demux/packet.c @@ -133,7 +133,7 @@ struct demux_packet *demux_copy_packet(struct demux_packet *dp) int demux_packet_set_padding(struct demux_packet *dp, int start, int end) { #if LIBAVCODEC_VERSION_MICRO >= 100 - if (!start && !end) + if (!start && !end) return 0; if (!dp->avpacket) return -1; @@ -146,3 +146,21 @@ int demux_packet_set_padding(struct demux_packet *dp, int start, int end) #endif return 0; } + +int demux_packet_add_blockadditional(struct demux_packet *dp, uint64_t id, + void *data, size_t size) +{ +#if LIBAVCODEC_VERSION_MICRO >= 100 + if (!dp->avpacket) + return -1; + uint8_t *sd = av_packet_new_side_data(dp->avpacket, + AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, + 8 + size); + if (!sd) + return -1; + AV_WB64(sd, id); + if (size > 0) + memcpy(sd + 8, data, size); +#endif + return 0; +} -- cgit v1.2.3