Rev 1696 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1696 | Rev 2349 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #define BLACK_MAGIC_SOUND |
1 | #define BLACK_MAGIC_SOUND |
2 | #define BLACK_MAGIC_VIDEO |
2 | #define BLACK_MAGIC_VIDEO |
Line -... | Line 3... | ||
- | 3 | ||
- | 4 | typedef unsigned int color_t; |
|
- | 5 | typedef unsigned int count_t; |
|
- | 6 | ||
- | 7 | typedef struct |
|
- | 8 | { |
|
- | 9 | int left; |
|
- | 10 | int top; |
|
- | 11 | int right; |
|
- | 12 | int bottom; |
|
- | 13 | }rect_t; |
|
- | 14 | ||
- | 15 | typedef struct |
|
- | 16 | { |
|
- | 17 | uint32_t width; |
|
- | 18 | uint32_t height; |
|
- | 19 | uint32_t pitch; |
|
- | 20 | uint32_t handle; |
|
- | 21 | uint8_t *data; |
|
- | 22 | }bitmap_t; |
|
- | 23 | ||
- | 24 | typedef struct render render_t; |
|
- | 25 | ||
- | 26 | struct render |
|
- | 27 | { |
|
- | 28 | uint32_t caps; |
|
- | 29 | uint32_t ctx_width; |
|
- | 30 | uint32_t ctx_height; |
|
- | 31 | uint32_t win_width; |
|
- | 32 | uint32_t win_height; |
|
- | 33 | ||
- | 34 | bitmap_t bitmap[4]; |
|
- | 35 | uint32_t ctx_format; |
|
- | 36 | int target; |
|
- | 37 | enum{ |
|
- | 38 | EMPTY, INIT }state; |
|
- | 39 | enum{ |
|
- | 40 | NORMAL, MINIMIZED, ROLLED |
|
- | 41 | }win_state; |
|
- | 42 | ||
- | 43 | void (*draw)(render_t *render, AVPicture *picture); |
|
- | 44 | }; |
|
3 | 45 | ||
4 | typedef struct |
46 | typedef struct |
5 | { |
47 | { |
6 | volatile uint32_t lock; |
48 | volatile uint32_t lock; |
7 | char *buffer; |
49 | char *buffer; |
Line 17... | Line 59... | ||
17 | unsigned int size; |
59 | unsigned int size; |
18 | unsigned int unused[2]; |
60 | unsigned int unused[2]; |
19 | }SND_EVENT; |
61 | }SND_EVENT; |
20 | 62 | ||
Line -... | Line 63... | ||
- | 63 | typedef struct |
|
- | 64 | { |
|
- | 65 | unsigned handle; |
|
- | 66 | unsigned io_code; |
|
- | 67 | void *input; |
|
- | 68 | int inp_size; |
|
- | 69 | void *output; |
|
- | 70 | int out_size; |
|
- | 71 | }ioctl_t; |
|
- | 72 | ||
- | 73 | typedef struct { |
|
- | 74 | AVPacketList *first_pkt; |
|
- | 75 | AVPacketList *last_pkt; |
|
- | 76 | int size; |
|
- | 77 | int count; |
|
- | 78 | volatile uint32_t lock; |
|
- | 79 | } queue_t; |
|
- | 80 | ||
- | 81 | int put_packet(queue_t *q, AVPacket *pkt); |
|
- | 82 | int get_packet(queue_t *q, AVPacket *pkt); |
|
- | 83 | ||
- | 84 | ||
21 | extern astream_t astream; |
85 | extern astream_t astream; |
22 | extern AVRational video_time_base; |
86 | extern AVRational video_time_base; |
Line -... | Line 87... | ||
- | 87 | ||
- | 88 | render_t *create_render(uint32_t width, uint32_t height, |
|
- | 89 | uint32_t ctx_format, uint32_t flags); |
|
- | 90 | ||
- | 91 | int init_render(render_t *render, int width, int height); |
|
- | 92 | void render_adjust_size(render_t *render); |
|
23 | 93 | ||
- | 94 | int init_audio(int format); |
|
- | 95 | int audio_thread(void *param); |
|
24 | int init_audio(int format); |
96 | |
- | 97 | int init_video(AVCodecContext *ctx); |
|
- | 98 | int video_thread(void *param); |
|
25 | int init_video(AVCodecContext *ctx); |
99 | |
- | 100 | int decode_video(AVCodecContext *ctx, queue_t *qv); |
|
- | 101 | int decode_audio(AVCodecContext *ctx, queue_t *qa); |
|
26 | int decode_video(AVCodecContext *ctx, AVPacket *pkt); |
102 | |
Line 27... | Line 103... | ||
27 | double get_master_clock(); |
103 | double get_master_clock(); |
Line 28... | Line 104... | ||
28 | 104 | ||
Line 29... | Line 105... | ||
29 | 105 | ||
30 | int create_thread(void (*proc)(void *param), void *param, int stack_size); |
106 | int create_thread(int (*proc)(void *param), void *param, int stack_size); |
31 | 107 | ||
32 | void spinlock_lock(volatile uint32_t *val); |
108 | void mutex_lock(volatile uint32_t *val); |
Line 33... | Line 109... | ||
33 | 109 | ||
Line 75... | Line 151... | ||
75 | __asm__ __volatile__( |
151 | __asm__ __volatile__( |
76 | "int $0x40" |
152 | "int $0x40" |
77 | ::"a"(5), "b"(time)); |
153 | ::"a"(5), "b"(time)); |
78 | }; |
154 | }; |
79 | 155 | ||
- | 156 | static inline draw_bitmap(void *bitmap, int x, int y, int w, int h) |
|
- | 157 | { |
|
- | 158 | __asm__ __volatile__( |
|
- | 159 | "int $0x40" |
|
- | 160 | ::"a"(7), "b"(bitmap), |
|
- | 161 | "c"((w << 16) | h), |
|
- | 162 | "d"((x << 16) | y)); |
|
- | 163 | } |
|
- | 164 | ||
- | 165 | static inline void BeginDraw(void) |
|
- | 166 | { |
|
- | 167 | __asm__ __volatile__( |
|
- | 168 | "int $0x40" ::"a"(12),"b"(1)); |
|
- | 169 | }; |
|
- | 170 | ||
- | 171 | static inline void EndDraw(void) |
|
- | 172 | { |
|
- | 173 | __asm__ __volatile__( |
|
- | 174 | "int $0x40" ::"a"(12),"b"(2)); |
|
- | 175 | }; |
|
- | 176 | ||
- | 177 | ||
- | 178 | static inline void DrawWindow(int x, int y, int w, int h, char *name, |
|
- | 179 | color_t workcolor, uint32_t style) |
|
- | 180 | { |
|
- | 181 | ||
- | 182 | __asm__ __volatile__( |
|
- | 183 | "int $0x40" |
|
- | 184 | ::"a"(0), |
|
- | 185 | "b"((x << 16) | (w & 0xFFFF)), |
|
- | 186 | "c"((y << 16) | (h & 0xFFFF)), |
|
- | 187 | "d"((style << 24) | (workcolor & 0xFFFFFF)), |
|
- | 188 | "D"(name)); |
|
- | 189 | }; |
|
- | 190 | ||
- | 191 | static inline void get_proc_info(char *info) |
|
- | 192 | { |
|
- | 193 | __asm__ __volatile__( |
|
- | 194 | "int $0x40" |
|
- | 195 | ::"a"(9), "b"(info), "c"(-1) |
|
- | 196 | :"memory"); |
|
- | 197 | } |
|
- | 198 | ||
- | 199 | #define HW_BIT_BLIT (1<<0) /* BGRX blitter */ |
|
- | 200 | #define HW_TEX_BLIT (1<<1) /* stretch blit */ |
|
- | 201 | #define HW_VID_BLIT (1<<2) /* planar and packed video */ |
|
- | 202 | ||
- | 203 | uint32_t InitPixlib(uint32_t flags); |
|
- | 204 | ||
- | 205 | int create_bitmap(bitmap_t *bitmap); |
|
- | 206 | int resize_bitmap(bitmap_t *bitmap); |
|
- | 207 | int blit_bitmap(bitmap_t *bitmap, int dst_x, int dst_y, |
|
- | 208 | int w, int h);2)><2)>1)><1)>0)><0)>><>><>><>><>><> |
|
- | 209 | ||
- | 210 | ||
- | 211 |