check for scale==0
parse strn chunk fix spelling errors prepare for INFO list parsing git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21346 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
f44764386f
commit
27cc6d1f0f
@ -25,7 +25,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "OpenDMLFile.h"
|
#include "OpenDMLFile.h"
|
||||||
|
|
||||||
//#define TRACE_ODML_FILE
|
#define TRACE_ODML_FILE
|
||||||
#ifdef TRACE_ODML_FILE
|
#ifdef TRACE_ODML_FILE
|
||||||
#define TRACE printf
|
#define TRACE printf
|
||||||
#else
|
#else
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "OpenDMLParser.h"
|
#include "OpenDMLParser.h"
|
||||||
#include "avi.h"
|
#include "avi.h"
|
||||||
|
|
||||||
//#define TRACE_ODML_PARSER
|
#define TRACE_ODML_PARSER
|
||||||
#ifdef TRACE_ODML_PARSER
|
#ifdef TRACE_ODML_PARSER
|
||||||
#define TRACE printf
|
#define TRACE printf
|
||||||
#else
|
#else
|
||||||
@ -151,7 +151,7 @@ OpenDMLParser::Parse()
|
|||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
if (fSize < 32) {
|
if (fSize < 32) {
|
||||||
ERROR("OpenDMLParser::Parse: file to small\n");
|
ERROR("OpenDMLParser::Parse: file too small\n");
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ OpenDMLParser::Parse()
|
|||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
cont:
|
cont:
|
||||||
pos += (size) + (size & 1);
|
pos += size + (size & 1);
|
||||||
riff_chunk_number++;
|
riff_chunk_number++;
|
||||||
}
|
}
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@ -252,7 +252,7 @@ OpenDMLParser::ParseChunk_AVI(int number, uint64 start, uint32 size)
|
|||||||
uint64 end = start + size;
|
uint64 end = start + size;
|
||||||
|
|
||||||
if (size < 9) {
|
if (size < 9) {
|
||||||
ERROR("OpenDMLParser::ParseChunk_AVI: chunk is to small at pos %llu\n", start);
|
ERROR("OpenDMLParser::ParseChunk_AVI: chunk is too small at pos %llu\n", start);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,7 +301,7 @@ OpenDMLParser::ParseChunk_AVI(int number, uint64 start, uint32 size)
|
|||||||
TRACE("OpenDMLParser::ParseChunk_AVI: unknown chunk ignored\n");
|
TRACE("OpenDMLParser::ParseChunk_AVI: unknown chunk ignored\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
pos += (Chunksize) + (Chunksize & 1);
|
pos += Chunksize + (Chunksize & 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@ -315,7 +315,7 @@ OpenDMLParser::ParseChunk_LIST(uint64 start, uint32 size)
|
|||||||
uint32 fourcc;
|
uint32 fourcc;
|
||||||
|
|
||||||
if (size < 5) {
|
if (size < 5) {
|
||||||
ERROR("OpenDMLParser::ParseChunk_LIST: chunk is to small at pos %llu\n", start);
|
ERROR("OpenDMLParser::ParseChunk_LIST: chunk is too small at pos %llu\n", start);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,6 +338,8 @@ OpenDMLParser::ParseChunk_LIST(uint64 start, uint32 size)
|
|||||||
return ParseList_strl(start + 4, size - 4);
|
return ParseList_strl(start + 4, size - 4);
|
||||||
} else if (fourcc == FOURCC('o','d','m','l')) {
|
} else if (fourcc == FOURCC('o','d','m','l')) {
|
||||||
return ParseList_generic(start + 4, size - 4);
|
return ParseList_generic(start + 4, size - 4);
|
||||||
|
} else if (fourcc == FOURCC('I','N','F','O')) {
|
||||||
|
return ParseList_INFO(start + 4, size - 4);
|
||||||
} else {
|
} else {
|
||||||
TRACE("OpenDMLParser::ParseChunk_LIST: unknown list type ignored\n");
|
TRACE("OpenDMLParser::ParseChunk_LIST: unknown list type ignored\n");
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@ -458,6 +460,11 @@ OpenDMLParser::ParseChunk_strh(uint64 start, uint32 size)
|
|||||||
DO_SWAP_INT16(fCurrentStream->stream_header.rect_bottom);
|
DO_SWAP_INT16(fCurrentStream->stream_header.rect_bottom);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (fCurrentStream->stream_header.scale == 0) {
|
||||||
|
printf("OpenDMLParser::ParseChunk_strh: scale is 0\n");
|
||||||
|
fCurrentStream->stream_header.scale = 1;
|
||||||
|
}
|
||||||
|
|
||||||
fCurrentStream->stream_header_valid = true;
|
fCurrentStream->stream_header_valid = true;
|
||||||
fCurrentStream->is_audio = fCurrentStream->stream_header.fourcc_type == FOURCC('a','u','d','s');
|
fCurrentStream->is_audio = fCurrentStream->stream_header.fourcc_type == FOURCC('a','u','d','s');
|
||||||
fCurrentStream->is_video = fCurrentStream->stream_header.fourcc_type == FOURCC('v','i','d','s');
|
fCurrentStream->is_video = fCurrentStream->stream_header.fourcc_type == FOURCC('v','i','d','s');
|
||||||
@ -596,6 +603,22 @@ OpenDMLParser::ParseChunk_strf(uint64 start, uint32 size)
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
status_t
|
||||||
|
OpenDMLParser::ParseChunk_strn(uint64 start, uint32 size)
|
||||||
|
{
|
||||||
|
TRACE("OpenDMLParser::ParseChunk_strn, size %lu\n", size);
|
||||||
|
|
||||||
|
if (fCurrentStream == 0) {
|
||||||
|
ERROR("OpenDMLParser::ParseChunk_strn: error, no Stream info\n");
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// this is an optional null-terminated string, we ignore it...
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
OpenDMLParser::ParseChunk_indx(uint64 start, uint32 size)
|
OpenDMLParser::ParseChunk_indx(uint64 start, uint32 size)
|
||||||
{
|
{
|
||||||
@ -648,7 +671,7 @@ OpenDMLParser::ParseChunk_dmlh(uint64 start, uint32 size)
|
|||||||
status_t
|
status_t
|
||||||
OpenDMLParser::ParseList_strl(uint64 start, uint32 size)
|
OpenDMLParser::ParseList_strl(uint64 start, uint32 size)
|
||||||
{
|
{
|
||||||
TRACE("OpenDMLParser::ParseList_strl\n");
|
TRACE("OpenDMLParser::ParseList_strl, size %lu\n", size);
|
||||||
|
|
||||||
CreateNewStreamInfo();
|
CreateNewStreamInfo();
|
||||||
fStreamCount++;
|
fStreamCount++;
|
||||||
@ -659,7 +682,7 @@ OpenDMLParser::ParseList_strl(uint64 start, uint32 size)
|
|||||||
status_t
|
status_t
|
||||||
OpenDMLParser::ParseList_generic(uint64 start, uint32 size)
|
OpenDMLParser::ParseList_generic(uint64 start, uint32 size)
|
||||||
{
|
{
|
||||||
TRACE("OpenDMLParser::ParseList_generic\n");
|
TRACE("OpenDMLParser::ParseList_generic, size %lu\n", size);
|
||||||
uint64 pos = start;
|
uint64 pos = start;
|
||||||
uint64 end = start + size;
|
uint64 end = start + size;
|
||||||
|
|
||||||
@ -713,6 +736,9 @@ OpenDMLParser::ParseList_generic(uint64 start, uint32 size)
|
|||||||
} else if (Chunkfcc == FOURCC('s','t','r','f')) {
|
} else if (Chunkfcc == FOURCC('s','t','r','f')) {
|
||||||
if (ParseChunk_strf(pos, Chunksize) < B_OK)
|
if (ParseChunk_strf(pos, Chunksize) < B_OK)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
} else if (Chunkfcc == FOURCC('s','t','r','n')) {
|
||||||
|
if (ParseChunk_strn(pos, Chunksize) < B_OK)
|
||||||
|
return B_ERROR;
|
||||||
} else if (Chunkfcc == FOURCC('i','n','d','x')) {
|
} else if (Chunkfcc == FOURCC('i','n','d','x')) {
|
||||||
if (ParseChunk_indx(pos, Chunksize) < B_OK)
|
if (ParseChunk_indx(pos, Chunksize) < B_OK)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
@ -730,10 +756,18 @@ OpenDMLParser::ParseList_generic(uint64 start, uint32 size)
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
status_t
|
||||||
|
OpenDMLParser::ParseList_INFO(uint64 start, uint32 size)
|
||||||
|
{
|
||||||
|
TRACE("OpenDMLParser::ParseList_INFO, size %lu\n", size);
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
OpenDMLParser::ParseList_movi(uint64 start, uint32 size)
|
OpenDMLParser::ParseList_movi(uint64 start, uint32 size)
|
||||||
{
|
{
|
||||||
TRACE("OpenDMLParser::ParseList_movi\n");
|
TRACE("OpenDMLParser::ParseList_movi, size %lu\n", size);
|
||||||
|
|
||||||
if (fMovieListStart == 0)
|
if (fMovieListStart == 0)
|
||||||
fMovieListStart = start;
|
fMovieListStart = start;
|
||||||
|
@ -71,9 +71,11 @@ private:
|
|||||||
status_t ParseChunk_avih(uint64 start, uint32 size);
|
status_t ParseChunk_avih(uint64 start, uint32 size);
|
||||||
status_t ParseChunk_strh(uint64 start, uint32 size);
|
status_t ParseChunk_strh(uint64 start, uint32 size);
|
||||||
status_t ParseChunk_strf(uint64 start, uint32 size);
|
status_t ParseChunk_strf(uint64 start, uint32 size);
|
||||||
|
status_t ParseChunk_strn(uint64 start, uint32 size);
|
||||||
status_t ParseChunk_dmlh(uint64 start, uint32 size);
|
status_t ParseChunk_dmlh(uint64 start, uint32 size);
|
||||||
status_t ParseList_movi(uint64 start, uint32 size);
|
status_t ParseList_movi(uint64 start, uint32 size);
|
||||||
status_t ParseList_generic(uint64 start, uint32 size);
|
status_t ParseList_generic(uint64 start, uint32 size);
|
||||||
|
status_t ParseList_INFO(uint64 start, uint32 size);
|
||||||
status_t ParseList_strl(uint64 start, uint32 size);
|
status_t ParseList_strl(uint64 start, uint32 size);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user