summaryrefslogtreecommitdiff
path: root/apps/codecs/libm4a/demux.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libm4a/demux.c')
-rw-r--r--apps/codecs/libm4a/demux.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/apps/codecs/libm4a/demux.c b/apps/codecs/libm4a/demux.c
index 00fd3132aa..9f887b6b83 100644
--- a/apps/codecs/libm4a/demux.c
+++ b/apps/codecs/libm4a/demux.c
@@ -746,7 +746,10 @@ int qtmovie_read(stream_t *file, demux_res_t *demux_res)
746 chunk_len = stream_read_uint32(qtmovie.stream); 746 chunk_len = stream_read_uint32(qtmovie.stream);
747 if (stream_eof(qtmovie.stream)) 747 if (stream_eof(qtmovie.stream))
748 { 748 {
749 return 0; 749 if(qtmovie.res->mdat_offset == 0 || qtmovie.res->format == 0)
750 return 0;
751 stream_seek(qtmovie.stream, qtmovie.res->mdat_offset);
752 return 1;
750 } 753 }
751 754
752 if (chunk_len == 1) 755 if (chunk_len == 1)
@@ -767,20 +770,19 @@ int qtmovie_read(stream_t *file, demux_res_t *demux_res)
767 return 0; 770 return 0;
768 } 771 }
769 break; 772 break;
770 /* once we hit mdat we stop reading and return.
771 * this is on the assumption that there is no furhter interesting
772 * stuff in the stream. if there is stuff will fail (:()).
773 * But we need the read pointer to be at the mdat stuff
774 * for the decoder. And we don't want to rely on fseek/ftell,
775 * as they may not always be avilable */
776 case MAKEFOURCC('m','d','a','t'): 773 case MAKEFOURCC('m','d','a','t'):
777 read_chunk_mdat(&qtmovie, chunk_len); 774 read_chunk_mdat(&qtmovie, chunk_len);
778 /* Keep track of start of stream in file - used for seeking */ 775 /* Keep track of start of stream in file - used for seeking */
779 qtmovie.res->mdat_offset=stream_tell(qtmovie.stream); 776 qtmovie.res->mdat_offset=stream_tell(qtmovie.stream);
780 /* There can be empty mdats before the real one. If so, skip them */ 777 /* There can be empty mdats before the real one. If so, skip them */
781 if (qtmovie.res->mdat_len > 0) { 778 if (qtmovie.res->mdat_len == 0)
779 break;
780 /* If we've already seen the format, assume there's nothing
781 interesting after the mdat chunk (the file is "streamable").
782 This avoids having to seek, which might cause rebuffering. */
783 if(qtmovie.res->format > 0)
782 return 1; 784 return 1;
783 } 785 stream_skip(qtmovie.stream, chunk_len - 8);
784 break; 786 break;
785 787
786 /* these following atoms can be skipped !!!! */ 788 /* these following atoms can be skipped !!!! */