Commit b96b441a authored by Aurelien Jacobs's avatar Aurelien Jacobs Committed by Kostya Shishkov

Make Matroska demuxer output full frames instead of slices for RealVideo

Patch by Aurelien Jacobs (aurel at "... is not unix"age.org)
Thread [RFC] Feed whole frames to RV* decoders

Originally committed as revision 10824 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 383b123e
......@@ -169,7 +169,6 @@ typedef enum {
MATROSKA_TRACK_ENABLED = (1<<0),
MATROSKA_TRACK_DEFAULT = (1<<1),
MATROSKA_TRACK_LACING = (1<<2),
MATROSKA_TRACK_REAL_V = (1<<4),
MATROSKA_TRACK_SHIFT = (1<<16)
} MatroskaTrackFlags;
......
......@@ -2110,7 +2110,6 @@ matroska_read_header (AVFormatContext *s,
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) {
......@@ -2237,12 +2236,6 @@ matroska_read_header (AVFormatContext *s,
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,
......@@ -2379,7 +2372,6 @@ matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, int size,
}
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
......@@ -2387,22 +2379,6 @@ matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, int size,
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) {
......@@ -2444,19 +2420,19 @@ matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, int size,
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;
......@@ -2471,7 +2447,6 @@ matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, int size,
if (timecode != AV_NOPTS_VALUE)
timecode = duration ? timecode + duration : AV_NOPTS_VALUE;
}
data += lace_size[n];
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment