From f4b1ca99ff86c6ba78e1b4730c85eac0d5a5817a Mon Sep 17 00:00:00 2001 From: Jan Gerber Date: Thu, 14 Nov 2013 12:58:28 +0100 Subject: [PATCH] lavf/matroska*: DiscardPadding is a signed integer according to the Matriska Specification http://matroska.org/technical/specs/index.html DiscardPadding is a signed integer. Tested-by: Jan Gerber Tested-by: James Almer Signed-off-by: Michael Niedermayer --- libavformat/matroskadec.c | 8 ++++---- libavformat/matroskaenc.c | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 685f7837ed..e7d7efe33e 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -293,7 +293,7 @@ typedef struct { EbmlBin bin; uint64_t additional_id; EbmlBin additional; - uint64_t discard_padding; + int64_t discard_padding; } MatroskaBlock; static EbmlSyntax ebml_header[] = { @@ -571,7 +571,7 @@ static EbmlSyntax matroska_blockgroup[] = { { MATROSKA_ID_BLOCKADDITIONS, EBML_NEST, 0, 0, {.n=matroska_blockadditions} }, { MATROSKA_ID_SIMPLEBLOCK, EBML_BIN, 0, offsetof(MatroskaBlock,bin) }, { MATROSKA_ID_BLOCKDURATION, EBML_UINT, 0, offsetof(MatroskaBlock,duration) }, - { MATROSKA_ID_DISCARDPADDING, EBML_UINT, 0, offsetof(MatroskaBlock,discard_padding) }, + { MATROSKA_ID_DISCARDPADDING, EBML_SINT, 0, offsetof(MatroskaBlock,discard_padding) }, { MATROSKA_ID_BLOCKREFERENCE, EBML_UINT, 0, offsetof(MatroskaBlock,reference) }, { MATROSKA_ID_CODECSTATE, EBML_NONE }, { 1, EBML_UINT, 0, offsetof(MatroskaBlock,non_simple), {.u=1} }, @@ -2416,7 +2416,7 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska, uint64_t timecode, uint64_t lace_duration, int64_t pos, int is_keyframe, uint8_t *additional, uint64_t additional_id, int additional_size, - uint64_t discard_padding) + int64_t discard_padding) { MatroskaTrackEncoding *encodings = track->encodings.elem; uint8_t *pkt_data = data; @@ -2553,7 +2553,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, int size, int64_t pos, uint64_t cluster_time, uint64_t block_duration, int is_keyframe, uint8_t *additional, uint64_t additional_id, int additional_size, - int64_t cluster_pos, uint64_t discard_padding) + int64_t cluster_pos, int64_t discard_padding) { uint64_t timecode = AV_NOPTS_VALUE; MatroskaTrack *track; diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 3f466d0eaa..eaeccdeb87 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1337,7 +1337,8 @@ static void mkv_write_block(AVFormatContext *s, AVIOContext *pb, uint8_t *data = NULL, *side_data = NULL; int offset = 0, size = pkt->size, side_data_size = 0; int64_t ts = mkv->tracks[pkt->stream_index].write_dts ? pkt->dts : pkt->pts; - uint64_t additional_id = 0, discard_padding = 0; + uint64_t additional_id = 0; + int64_t discard_padding = 0; ebml_master block_group, block_additions, block_more; av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, " @@ -1396,7 +1397,7 @@ static void mkv_write_block(AVFormatContext *s, AVIOContext *pb, av_free(data); if (discard_padding) { - put_ebml_uint(pb, MATROSKA_ID_DISCARDPADDING, discard_padding); + put_ebml_sint(pb, MATROSKA_ID_DISCARDPADDING, discard_padding); } if (side_data_size && additional_id == 1) {