read contents defined by four-cc code; returns true if contens ok
(int fourcc, long endPosition)
| 744 | |
| 745 | /** read contents defined by four-cc code; returns true if contens ok */ |
| 746 | private boolean readContents (int fourcc, long endPosition) throws Exception, IOException { |
| 747 | switch (fourcc) { |
| 748 | case FOURCC_hdrl: |
| 749 | headerPositionEnd = endPosition; |
| 750 | findFourccAndRead(FOURCC_avih, false, endPosition, true); |
| 751 | findFourccAndRead(FOURCC_strl, true, endPosition, true); |
| 752 | return true; |
| 753 | case FOURCC_avih: |
| 754 | readAviHeader(); |
| 755 | return true; |
| 756 | case FOURCC_strl: |
| 757 | long nextPosition = findFourccAndRead(FOURCC_strh, false, endPosition, false); |
| 758 | if (nextPosition<0) return false; |
| 759 | indexPosition = findFourccAndRead(FOURCC_strf, false, endPosition, true); |
| 760 | indexPositionEnd= endPosition; |
| 761 | indexForCountingOnly = true; //try reading indx for counting number of entries |
| 762 | totalFramesFromIndex = 0; |
| 763 | nextPosition = findFourccAndRead(FOURCC_indx, false, endPosition, false); |
| 764 | if (nextPosition > 0 && totalFramesFromIndex > dwTotalFrames) |
| 765 | dwTotalFrames = totalFramesFromIndex; |
| 766 | indexForCountingOnly = false; |
| 767 | return true; |
| 768 | case FOURCC_strh: |
| 769 | int streamType = readInt(); |
| 770 | if (streamType != FOURCC_vids) { |
| 771 | if (verbose) |
| 772 | IJ.log("Non-video Stream '"+fourccString(streamType)+" skipped"); |
| 773 | streamNumber++; |
| 774 | return false; |
| 775 | } |
| 776 | readStreamHeader(); |
| 777 | return true; |
| 778 | case FOURCC_strf: |
| 779 | readBitMapInfo(endPosition); |
| 780 | return true; |
| 781 | case FOURCC_indx: |
| 782 | case FOURCC_ix00: |
| 783 | readAvi2Index(endPosition); |
| 784 | return true; |
| 785 | case FOURCC_idx1: |
| 786 | readOldFrameIndex(endPosition); |
| 787 | return true; |
| 788 | case FOURCC_RIFF: |
| 789 | readAVIX(endPosition); |
| 790 | return true; |
| 791 | case FOURCC_movi: |
| 792 | readMovieData(endPosition); |
| 793 | return true; |
| 794 | } |
| 795 | throw new Exception("Program error, type "+fourccString(fourcc)); |
| 796 | } |
| 797 | |
| 798 | void readAviHeader() throws Exception, IOException { //'avih' |
| 799 | dwMicroSecPerFrame = readInt(); |
no test coverage detected