mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-13 02:41:37 +00:00
Change ASF demuxer to return incomplete last packets.
Whether the behaviour for streams using scrambling makes sense is unclear. Originally committed as revision 26053 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
d09b5a869f
commit
bf09a01981
@ -953,12 +953,24 @@ static int ff_asf_parse_packet(AVFormatContext *s, ByteIOContext *pb, AVPacket *
|
|||||||
|
|
||||||
ret = get_buffer(pb, asf_st->pkt.data + asf->packet_frag_offset,
|
ret = get_buffer(pb, asf_st->pkt.data + asf->packet_frag_offset,
|
||||||
asf->packet_frag_size);
|
asf->packet_frag_size);
|
||||||
if (ret != asf->packet_frag_size)
|
if (ret != asf->packet_frag_size) {
|
||||||
return ret >= 0 ? AVERROR_EOF : ret;
|
if (ret < 0 || asf->packet_frag_offset + ret == 0)
|
||||||
|
return ret < 0 ? ret : AVERROR_EOF;
|
||||||
|
if (asf_st->ds_span > 1) {
|
||||||
|
// scrambling, we can either drop it completely or fill the remainder
|
||||||
|
// TODO: should we fill the whole packet instead of just the current
|
||||||
|
// fragment?
|
||||||
|
memset(asf_st->pkt.data + asf->packet_frag_offset + ret, 0,
|
||||||
|
asf->packet_frag_size - ret);
|
||||||
|
ret = asf->packet_frag_size;
|
||||||
|
} else
|
||||||
|
// no scrambling, so we can return partial packets
|
||||||
|
av_shrink_packet(&asf_st->pkt, asf->packet_frag_offset + ret);
|
||||||
|
}
|
||||||
if (s->key && s->keylen == 20)
|
if (s->key && s->keylen == 20)
|
||||||
ff_asfcrypt_dec(s->key, asf_st->pkt.data + asf->packet_frag_offset,
|
ff_asfcrypt_dec(s->key, asf_st->pkt.data + asf->packet_frag_offset,
|
||||||
asf->packet_frag_size);
|
ret);
|
||||||
asf_st->frag_offset += asf->packet_frag_size;
|
asf_st->frag_offset += ret;
|
||||||
/* test if whole packet is read */
|
/* test if whole packet is read */
|
||||||
if (asf_st->frag_offset == asf_st->pkt.size) {
|
if (asf_st->frag_offset == asf_st->pkt.size) {
|
||||||
//workaround for macroshit radio DVR-MS files
|
//workaround for macroshit radio DVR-MS files
|
||||||
|
@ -160,3 +160,4 @@
|
|||||||
0, 596250, 84480, 0xbce22331
|
0, 596250, 84480, 0xbce22331
|
||||||
0, 600000, 84480, 0x020545d7
|
0, 600000, 84480, 0x020545d7
|
||||||
0, 603750, 84480, 0x71869e48
|
0, 603750, 84480, 0x71869e48
|
||||||
|
0, 607500, 84480, 0x5befc578
|
||||||
|
Loading…
Reference in New Issue
Block a user