Mercurial > libavformat.hg
comparison electronicarts.c @ 4849:92468cd5b594 libavformat
Make electronicarts demuxer return partial frames, this is the default
behaviour of av_get_packet and should not be override without good reason.
As a side effect this fixes the memleak described in issue 956.
Also return the exact error code from av_get_packet instead of AVERROR(EIO).
author | reimar |
---|---|
date | Sat, 11 Apr 2009 10:38:56 +0000 |
parents | 4b44e8f4853e |
children | 50df4a8b9733 |
comparison
equal
deleted
inserted
replaced
4848:69c5cb7c0487 | 4849:92468cd5b594 |
---|---|
468 num_samples = get_le32(pb); | 468 num_samples = get_le32(pb); |
469 url_fskip(pb, 8); | 469 url_fskip(pb, 8); |
470 chunk_size -= 12; | 470 chunk_size -= 12; |
471 } | 471 } |
472 ret = av_get_packet(pb, pkt, chunk_size); | 472 ret = av_get_packet(pb, pkt, chunk_size); |
473 if (ret != chunk_size) | 473 if (ret < 0) |
474 ret = AVERROR(EIO); | 474 return ret; |
475 else { | |
476 pkt->stream_index = ea->audio_stream_index; | 475 pkt->stream_index = ea->audio_stream_index; |
477 pkt->pts = 90000; | 476 pkt->pts = 90000; |
478 pkt->pts *= ea->audio_frame_counter; | 477 pkt->pts *= ea->audio_frame_counter; |
479 pkt->pts /= ea->sample_rate; | 478 pkt->pts /= ea->sample_rate; |
480 | 479 |
491 break; | 490 break; |
492 default: | 491 default: |
493 ea->audio_frame_counter += chunk_size / | 492 ea->audio_frame_counter += chunk_size / |
494 (ea->bytes * ea->num_channels); | 493 (ea->bytes * ea->num_channels); |
495 } | 494 } |
496 } | |
497 | 495 |
498 packet_read = 1; | 496 packet_read = 1; |
499 break; | 497 break; |
500 | 498 |
501 /* ending tag */ | 499 /* ending tag */ |
529 case pIQT_TAG: | 527 case pIQT_TAG: |
530 key = PKT_FLAG_KEY; | 528 key = PKT_FLAG_KEY; |
531 case MV0F_TAG: | 529 case MV0F_TAG: |
532 get_video_packet: | 530 get_video_packet: |
533 ret = av_get_packet(pb, pkt, chunk_size); | 531 ret = av_get_packet(pb, pkt, chunk_size); |
534 if (ret != chunk_size) | 532 if (ret < 0) |
535 ret = AVERROR_IO; | 533 return ret; |
536 else { | |
537 pkt->stream_index = ea->video_stream_index; | 534 pkt->stream_index = ea->video_stream_index; |
538 pkt->flags |= key; | 535 pkt->flags |= key; |
539 } | |
540 packet_read = 1; | 536 packet_read = 1; |
541 break; | 537 break; |
542 | 538 |
543 default: | 539 default: |
544 url_fseek(pb, chunk_size, SEEK_CUR); | 540 url_fseek(pb, chunk_size, SEEK_CUR); |