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 <j@v2v.cc>
Tested-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/48/head
Jan Gerber 11 years ago committed by Michael Niedermayer
parent 150c5543ff
commit f4b1ca99ff
  1. 8
      libavformat/matroskadec.c
  2. 5
      libavformat/matroskaenc.c

@ -293,7 +293,7 @@ typedef struct {
EbmlBin bin; EbmlBin bin;
uint64_t additional_id; uint64_t additional_id;
EbmlBin additional; EbmlBin additional;
uint64_t discard_padding; int64_t discard_padding;
} MatroskaBlock; } MatroskaBlock;
static EbmlSyntax ebml_header[] = { static EbmlSyntax ebml_header[] = {
@ -571,7 +571,7 @@ static EbmlSyntax matroska_blockgroup[] = {
{ MATROSKA_ID_BLOCKADDITIONS, EBML_NEST, 0, 0, {.n=matroska_blockadditions} }, { MATROSKA_ID_BLOCKADDITIONS, EBML_NEST, 0, 0, {.n=matroska_blockadditions} },
{ MATROSKA_ID_SIMPLEBLOCK, EBML_BIN, 0, offsetof(MatroskaBlock,bin) }, { MATROSKA_ID_SIMPLEBLOCK, EBML_BIN, 0, offsetof(MatroskaBlock,bin) },
{ MATROSKA_ID_BLOCKDURATION, EBML_UINT, 0, offsetof(MatroskaBlock,duration) }, { 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_BLOCKREFERENCE, EBML_UINT, 0, offsetof(MatroskaBlock,reference) },
{ MATROSKA_ID_CODECSTATE, EBML_NONE }, { MATROSKA_ID_CODECSTATE, EBML_NONE },
{ 1, EBML_UINT, 0, offsetof(MatroskaBlock,non_simple), {.u=1} }, { 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, uint64_t timecode, uint64_t lace_duration,
int64_t pos, int is_keyframe, int64_t pos, int is_keyframe,
uint8_t *additional, uint64_t additional_id, int additional_size, uint8_t *additional, uint64_t additional_id, int additional_size,
uint64_t discard_padding) int64_t discard_padding)
{ {
MatroskaTrackEncoding *encodings = track->encodings.elem; MatroskaTrackEncoding *encodings = track->encodings.elem;
uint8_t *pkt_data = data; 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, int size, int64_t pos, uint64_t cluster_time,
uint64_t block_duration, int is_keyframe, uint64_t block_duration, int is_keyframe,
uint8_t *additional, uint64_t additional_id, int additional_size, 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; uint64_t timecode = AV_NOPTS_VALUE;
MatroskaTrack *track; MatroskaTrack *track;

@ -1337,7 +1337,8 @@ static void mkv_write_block(AVFormatContext *s, AVIOContext *pb,
uint8_t *data = NULL, *side_data = NULL; uint8_t *data = NULL, *side_data = NULL;
int offset = 0, size = pkt->size, side_data_size = 0; int offset = 0, size = pkt->size, side_data_size = 0;
int64_t ts = mkv->tracks[pkt->stream_index].write_dts ? pkt->dts : pkt->pts; 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; ebml_master block_group, block_additions, block_more;
av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, " 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); av_free(data);
if (discard_padding) { 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) { if (side_data_size && additional_id == 1) {

Loading…
Cancel
Save