* Fixed some coding style issues. David, please take a little more care about

this!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34408 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-12-01 13:04:21 +00:00
parent c1cb57b1b1
commit 2920b81793
@@ -22,6 +22,8 @@
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE. * OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <SupportDefs.h> #include <SupportDefs.h>
#include <math.h> #include <math.h>
#include <stdio.h> #include <stdio.h>
@@ -39,7 +41,8 @@
OpenDMLIndex::OpenDMLIndex(BPositionIO *source, OpenDMLParser *parser) OpenDMLIndex::OpenDMLIndex(BPositionIO *source, OpenDMLParser *parser)
: Index(source, parser) :
Index(source, parser)
{ {
} }
@@ -62,14 +65,15 @@ OpenDMLIndex::Init()
int64 pos = 0; int64 pos = 0;
uint32 bytesRead; uint32 bytesRead;
for (uint32 i=0; i < fStreamCount; i++) { for (int32 i = 0; i < fStreamCount; i++) {
stream = fParser->StreamInfo(i); stream = fParser->StreamInfo(i);
pos = stream->odml_index_start; pos = stream->odml_index_start;
bytesRead = sizeof(odml_index_header); bytesRead = sizeof(odml_index_header);
if ((int32)bytesRead != fSource->ReadAt(pos, &superIndex, bytesRead)) { if ((int32)bytesRead != fSource->ReadAt(pos, &superIndex, bytesRead)) {
ERROR("libOpenDML: OpenDMLIndex::Init file reading failed to read superindex\n"); ERROR("libOpenDML: OpenDMLIndex::Init file reading failed to read "
"superindex\n");
return B_IO_ERROR; return B_IO_ERROR;
} }
@@ -84,35 +88,34 @@ OpenDMLIndex::Init()
return B_OK; return B_OK;
} }
status_t status_t
OpenDMLIndex::ReadIndex(uint32 stream_index, int64 pos, uint32 *lastFrame, bigtime_t *pts, odml_index_header *superIndex) { OpenDMLIndex::ReadIndex(uint32 stream_index, int64 pos, uint32 *lastFrame,
bigtime_t *pts, odml_index_header *superIndex)
odml_superindex_entry superIndexEntry; {
//odml_field_index_entry fieldIndexEntry; odml_superindex_entry superIndexEntry;
uint32 bytesRead; const OpenDMLStream *stream = fParser->StreamInfo(stream_index);
const OpenDMLStream *stream = fParser->StreamInfo(stream_index);
for (uint32 i=0; i < superIndex->entries_used; i++) {
for (uint32 i = 0; i < superIndex->entries_used; i++) {
if (superIndex->index_type == AVI_INDEX_OF_INDEXES) { if (superIndex->index_type == AVI_INDEX_OF_INDEXES) {
ssize_t bytesRead = fSource->ReadAt(pos, &superIndexEntry,
bytesRead = sizeof(odml_superindex_entry); sizeof(odml_superindex_entry));
if (bytesRead < 0)
if ((int32)bytesRead != fSource->ReadAt(pos, &superIndexEntry, bytesRead)) { return bytesRead;
ERROR("libOpenDML: OpenDMLIndex::Init file reading failed to read superindex entry\n"); if (bytesRead != (ssize_t)sizeof(odml_superindex_entry)) {
ERROR("libOpenDML: OpenDMLIndex::Init file reading failed to "
"read superindex entry\n");
return B_IO_ERROR; return B_IO_ERROR;
} }
pos += bytesRead; pos += bytesRead;
if (superIndexEntry.start == 0) { if (superIndexEntry.start == 0)
continue; continue;
}
if (superIndex->index_sub_type == AVI_INDEX_2FIELD) { if (superIndex->index_sub_type != AVI_INDEX_2FIELD) {
} else { ReadChunkIndex(stream_index, superIndexEntry.start + 8,
ReadChunkIndex(stream_index, superIndexEntry.start + 8, lastFrame, pts, stream); lastFrame, pts, stream);
} }
} }
} }
@@ -120,17 +123,19 @@ const OpenDMLStream *stream = fParser->StreamInfo(stream_index);
return B_OK; return B_OK;
} }
status_t
OpenDMLIndex::ReadChunkIndex(uint32 stream_index, int64 pos, uint32 *lastFrame, bigtime_t *pts, const OpenDMLStream *stream) {
odml_index_entry chunkIndexEntry; status_t
odml_chunk_index_header chunkIndex; OpenDMLIndex::ReadChunkIndex(uint32 stream_index, int64 pos, uint32 *lastFrame,
uint32 bytesRead; bigtime_t *pts, const OpenDMLStream *stream)
uint32 frameNo; {
bool keyframe; odml_index_entry chunkIndexEntry;
uint32 sample_size; odml_chunk_index_header chunkIndex;
int64 position; uint32 bytesRead;
uint32 size; uint32 frameNo;
bool keyframe;
uint32 sample_size;
int64 position;
uint32 size;
bytesRead = sizeof(odml_chunk_index_header); bytesRead = sizeof(odml_chunk_index_header);