Index: patched-ffmpeg-mt/libavformat/matroskadec.c |
=================================================================== |
--- patched-ffmpeg-mt/libavformat/matroskadec.c (revision 41250) |
+++ patched-ffmpeg-mt/libavformat/matroskadec.c (working copy) |
@@ -143,6 +143,7 @@ |
AVStream *stream; |
int64_t end_timecode; |
+ int ms_compat; |
} MatroskaTrack; |
typedef struct { |
@@ -1244,6 +1245,7 @@ |
if (!strcmp(track->codec_id, "V_MS/VFW/FOURCC") |
&& track->codec_priv.size >= 40 |
&& track->codec_priv.data != NULL) { |
+ track->ms_compat = 1; |
track->video.fourcc = AV_RL32(track->codec_priv.data + 16); |
codec_id = ff_codec_get_id(ff_codec_bmp_tags, track->video.fourcc); |
extradata_offset = 40; |
@@ -1674,6 +1676,11 @@ |
int offset = 0, pkt_size = lace_size[n]; |
uint8_t *pkt_data = data; |
+ if (lace_size[n] > size) { |
+ av_log(matroska->ctx, AV_LOG_ERROR, "Invalid packet size\n"); |
+ break; |
+ } |
+ |
if (encodings && encodings->scope & 1) { |
offset = matroska_decode_buffer(&pkt_data,&pkt_size, track); |
if (offset < 0) |
@@ -1698,7 +1705,10 @@ |
pkt->flags = is_keyframe; |
pkt->stream_index = st->index; |
- pkt->pts = timecode; |
+ if (track->ms_compat) |
+ pkt->dts = timecode; |
+ else |
+ pkt->pts = timecode; |
pkt->pos = pos; |
if (st->codec->codec_id == CODEC_ID_TEXT) |
pkt->convergence_duration = duration; |
@@ -1722,6 +1732,7 @@ |
if (timecode != AV_NOPTS_VALUE) |
timecode = duration ? timecode + duration : AV_NOPTS_VALUE; |
data += lace_size[n]; |
+ size -= lace_size[n]; |
} |
} |