diff options
author | wm4 <wm4@nowhere> | 2017-01-31 14:48:10 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-01-31 14:48:10 +0100 |
commit | 9c12d54afa70f3535a7114498433cf566a9e9a86 (patch) | |
tree | 5d6171dc4d8ad0278fc8c051a02037ac4ceff893 /demux/packet.c | |
parent | 55d6408526214d8ec97aab25a20396944c6d04ad (diff) | |
download | mpv-9c12d54afa70f3535a7114498433cf566a9e9a86.tar.bz2 mpv-9c12d54afa70f3535a7114498433cf566a9e9a86.tar.xz |
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.
Diffstat (limited to 'demux/packet.c')
-rw-r--r-- | demux/packet.c | 20 |
1 files changed, 19 insertions, 1 deletions
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; +} |