diff options
author | Pixel <Pixel> | 2002-06-18 15:59:42 +0000 |
---|---|---|
committer | Pixel <Pixel> | 2002-06-18 15:59:42 +0000 |
commit | 0cc4a6ec508043c5dbf3edde9398df8e4034be8b (patch) | |
tree | e2eb47a5e042288888cc5001fa281dfc60b9ffb6 /str-util.cpp | |
parent | 4f9643c00b8be3ef4381d81999c096acb40c6040 (diff) |
Still working on it.
Diffstat (limited to 'str-util.cpp')
-rw-r--r-- | str-util.cpp | 72 |
1 files changed, 71 insertions, 1 deletions
diff --git a/str-util.cpp b/str-util.cpp index b93e2a6..f0dd3f7 100644 --- a/str-util.cpp +++ b/str-util.cpp @@ -3,10 +3,80 @@ #include "generic.h" #include "yazedc.h" +/* + From the SONY documentation: + + 32 bytes header: + +StSTATUS : 2 bytes 0 +StTYPE : 2 bytes 2 +StSECTOR_OFFSET: 2 bytes 4 +StSECTOR_SIZE : 2 bytes 6 +StFRAME_NO : 4 bytes 10 +StFRAME_SIZE : 4 bytes 14 +StMOVIE_WIDTH : 2 bytes 16 +StMOVIE_HEIGHT : 2 bytes 18 +StMOVIE_HEADM : 4 bytes 22 +StMOVIE_HEADV : 4 bytes 26 +Channels : 2 bytes 30 + */ + +struct STR_Header { + Uint16 StSTATUS; + Uint16 StTYPE; + Uint16 StSECTOR_OFFSET; + Uint16 StSECTOR_SIZE; + Uint32 StFRAME_NO; + Uint32 StFRAME_SIZE; + Uint16 StMOVIE_WIDTH; + Uint16 StMOVIE_HEIGHT; + Uint32 StMOVIE_HEADM; + Uint32 StMOVIE_HEADV; + Uint16 Channels; +} __attribute__((packed)); + +void process_one_sector(FILE * f) { + Byte sector[2336]; + STR_Header * h; + + fread(sector, 2336, 1, f); + h = (STR_Header *) ((Byte *) sector + 8); + + printm(M_BARE, "SubHeader FN : %x\n", sector[0]); + printm(M_BARE, "SubHeader CN : %x\n", sector[1]); + printm(M_BARE, "SubHeader SM : %x\n", sector[2]); + printm(M_BARE, "SubHeader CI : %x\n", sector[3]); + + if (sector[2] == 0x48) { + printm(M_BARE, "Video sector\n"); + } else if (sector[2] == 0x64) { + printm(M_BARE, "Audio sector\n"); + } else { + printm(M_BARE, "Unknow sector\n"); + } + + printm(M_BARE, "Status : %04x\n", h->StSTATUS); + printm(M_BARE, "Type : %04x\n", h->StTYPE); + printm(M_BARE, "Sector Offset: %i\n", h->StSECTOR_OFFSET); + printm(M_BARE, "Sector Size : %i\n", h->StSECTOR_SIZE); + printm(M_BARE, "Frame Number : %i\n", h->StFRAME_NO); + printm(M_BARE, "Frame Size : %i\n", h->StFRAME_SIZE); + printm(M_BARE, "Movie Width : %i\n", h->StMOVIE_WIDTH); + printm(M_BARE, "Movie Height : %i\n", h->StMOVIE_HEIGHT); + printm(M_BARE, "Movie HeadM : %08x\n", h->StMOVIE_HEADM); + printm(M_BARE, "Movie HeadV : %08x\n", h->StMOVIE_HEADV); + printm(M_BARE, "Channels : %04x\n", h->Channels); + printm(M_BARE, "---------------------------------\n\n"); +} + +#ifdef STR_MAIN -#ifdef __STR_MAIN__ int main(void) { + while (!feof(stdin)) { + process_one_sector(stdin); + } } + #endif |