codec_id == CODEC_ID_RV30 || codec_id == CODEC_ID_RV40) {
extradata_offset = 26;
track->codec_priv_size -= extradata_offset;
- track->flags |= MATROSKA_TRACK_REAL_V;
}
else if (codec_id == CODEC_ID_RA_144) {
return res;
}
-static inline int
-rv_offset(uint8_t *data, int slice, int slices)
-{
- return AV_RL32(data+8*slice+4) + 8*slices;
-}
-
static int
matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, int size,
int64_t pos, uint64_t cluster_time, uint64_t duration,
}
if (res == 0) {
- int real_v = matroska->tracks[track]->flags & MATROSKA_TRACK_REAL_V;
uint64_t timecode = AV_NOPTS_VALUE;
if (cluster_time != (uint64_t)-1
timecode = cluster_time + block_time;
for (n = 0; n < laces; n++) {
- int slice, slices = 1;
-
- if (real_v) {
- slices = *data++ + 1;
- lace_size[n]--;
- }
-
- for (slice=0; slice<slices; slice++) {
- int slice_size, slice_offset = 0;
- if (real_v)
- slice_offset = rv_offset(data, slice, slices);
- if (slice+1 == slices)
- slice_size = lace_size[n] - slice_offset;
- else
- slice_size = rv_offset(data, slice+1, slices) - slice_offset;
-
if (st->codec->codec_id == CODEC_ID_RA_288 ||
st->codec->codec_id == CODEC_ID_COOK ||
st->codec->codec_id == CODEC_ID_ATRAC3) {
if (st->codec->codec_id == CODEC_ID_TEXT
&& ((MatroskaSubtitleTrack *)(matroska->tracks[track]))->ass) {
int i;
- for (i=0; i<8 && data[slice_offset+offset]; offset++)
- if (data[slice_offset+offset] == ',')
+ for (i=0; i<8 && data[offset]; offset++)
+ if (data[offset] == ',')
i++;
}
pkt = av_mallocz(sizeof(AVPacket));
/* XXX: prevent data copy... */
- if (av_new_packet(pkt, slice_size-offset) < 0) {
+ if (av_new_packet(pkt, lace_size[n]-offset) < 0) {
res = AVERROR(ENOMEM);
n = laces-1;
break;
}
- memcpy (pkt->data, data+slice_offset+offset, slice_size-offset);
+ memcpy (pkt->data, data+offset, lace_size[n]-offset);
if (n == 0)
pkt->flags = is_keyframe;
if (timecode != AV_NOPTS_VALUE)
timecode = duration ? timecode + duration : AV_NOPTS_VALUE;
- }
data += lace_size[n];
}
}