2 +----------------------------------------------------------------------+
3 | Author: yoya@awm.jp |
4 +----------------------------------------------------------------------+
8 #include "swf_define.h"
9 #include "swf_header.h"
12 swf_header_parse(bitstream_t *bs, swf_header_t *header) {
13 bitstream_getstring(bs, header->magic, 3);
14 header->version = bitstream_getbyte(bs);
15 header->file_length = bitstream_getbytesLE(bs, 4);
20 swf_header_build(bitstream_t *bs, swf_header_t *header) {
21 if (bitstream_putstring(bs, header->magic, 3)) {
24 if (bitstream_putbyte(bs, header->version)) {
27 if (bitstream_putbytesLE(bs, header->file_length, 4)) {
34 swf_header_movie_parse(bitstream_t *bs,
35 swf_header_movie_t *header_movie) {
36 swf_rect_parse(bs, &header_movie->frame_size);
37 header_movie->frame_rate_decimal = bitstream_getbyte(bs);
38 header_movie->frame_rate_integral = bitstream_getbyte(bs);
39 header_movie->frame_count = bitstream_getbytesLE(bs, 2);
44 swf_header_movie_build(bitstream_t *bs,
45 swf_header_movie_t *header_movie) {
46 swf_rect_build(bs, &header_movie->frame_size);
47 bitstream_putbyte(bs, header_movie->frame_rate_decimal);
48 bitstream_putbyte(bs, header_movie->frame_rate_integral);
49 bitstream_putbytesLE(bs, header_movie->frame_count, 2);
53 int swf_header_print(swf_header_t *header) {
54 printf("magic=%s version=%d file_length=%lu\n",
55 header->magic, header->version, header->file_length);
59 int swf_header_movie_print(swf_header_movie_t *header_movie) {
60 swf_rect_print(&header_movie->frame_size, 0);
61 printf("frame_rate=%d.%d frame_count=%d\n",
62 header_movie->frame_rate_integral,
63 header_movie->frame_rate_decimal,
64 header_movie->frame_count);