Subversion Repositories Kolibri OS

Rev

Rev 2349 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1.  
  2. #define BLACK_MAGIC_SOUND
  3. #define BLACK_MAGIC_VIDEO
  4.  
  5. typedef unsigned int color_t;
  6. typedef unsigned int count_t;
  7.  
  8. typedef struct
  9. {
  10.     uint32_t    width;
  11.     uint32_t    height;
  12.     uint32_t    pitch;
  13.     uint32_t    handle;
  14.     uint8_t    *data;
  15. }bitmap_t;
  16.  
  17. typedef struct render  render_t;
  18.  
  19. #define HAS_LEFT        (1<<0)
  20. #define HAS_TOP         (1<<1)
  21. #define HAS_RIGHT       (1<<2)
  22. #define HAS_BOTTOM      (1<<3)
  23.  
  24. struct render
  25. {
  26.     uint32_t   caps;
  27.     uint32_t   ctx_width;
  28.     uint32_t   ctx_height;
  29.     uint32_t   win_width;
  30.     uint32_t   win_height;
  31.  
  32.     rect_t     rc_client;
  33.     rect_t     rcvideo;
  34.     rect_t     rcleft;
  35.     rect_t     rctop;
  36.     rect_t     rcright;
  37.     rect_t     rcbottom;
  38.  
  39.     uint32_t   layout;
  40.     bitmap_t   bitmap[4];
  41.     uint32_t   ctx_format;
  42.     int        target;
  43.    
  44.     window_t   *win;
  45.     enum{
  46.       EMPTY, INIT }state;
  47.     enum win_state win_state;
  48.  
  49.     void (*draw)(render_t *render, AVPicture *picture);
  50. };
  51.  
  52. typedef struct
  53. {
  54.     volatile uint32_t   lock;
  55.     char               *buffer;
  56.     volatile uint32_t   count;
  57. }astream_t;
  58.  
  59. typedef struct
  60. {
  61.   unsigned int  code;
  62.   unsigned int  sender;
  63.   unsigned int  stream;
  64.   unsigned int  offset;
  65.   unsigned int  size;
  66.   unsigned int  unused[2];
  67. }SND_EVENT;
  68.  
  69. typedef struct
  70. {
  71.   unsigned      handle;
  72.   unsigned      io_code;
  73.   void          *input;
  74.   int           inp_size;
  75.   void          *output;
  76.   int           out_size;
  77. }ioctl_t;
  78.  
  79. typedef struct {
  80.     AVPacketList *first_pkt;
  81.     AVPacketList *last_pkt;
  82.     int size;
  83.     int count;
  84.     volatile uint32_t lock;
  85. } queue_t;
  86.  
  87. int put_packet(queue_t *q, AVPacket *pkt);
  88. int get_packet(queue_t *q, AVPacket *pkt);
  89.  
  90.  
  91. extern astream_t astream;
  92. extern AVRational video_time_base;
  93.  
  94. render_t *create_render(uint32_t width, uint32_t height,
  95.                         uint32_t ctx_format, uint32_t flags);
  96.  
  97. int init_render(render_t *render, int width, int height);
  98. void render_adjust_size(render_t *render, window_t *win);
  99. int render_set_size(render_t *render, int width, int height);
  100. void render_draw_client(render_t *render);
  101.  
  102.  
  103. int init_audio(int format);
  104. int audio_thread(void *param);
  105.  
  106. int init_video(AVCodecContext *ctx);
  107. int video_thread(void *param);
  108.  
  109. int decode_video(AVCodecContext  *ctx, queue_t *qv);
  110. int decode_audio(AVCodecContext  *ctx, queue_t *qa);
  111.  
  112. double get_master_clock();
  113.  
  114.  
  115. int create_thread(int (*proc)(void *param), void *param, int stack_size);
  116.  
  117. void mutex_lock(volatile uint32_t *val);
  118.  
  119. static inline void mutex_unlock(volatile uint32_t *val)
  120. {
  121.     *val = 0;
  122. }
  123.  
  124. static inline void GetNotify(void *event)
  125. {
  126.     __asm__ __volatile__ (
  127.     "int $0x40"
  128.     ::"a"(68),"b"(14),"c"(event));
  129. }
  130.  
  131. static inline uint32_t get_os_button()
  132. {
  133.     uint32_t val;
  134.     __asm__ __volatile__(
  135.     "int $0x40"
  136.     :"=a"(val)
  137.     :"a"(17));
  138.     return val>>8;
  139. };
  140.  
  141. static inline void yield(void)
  142. {
  143.     __asm__ __volatile__(
  144.     "int $0x40"
  145.     ::"a"(68), "b"(1));
  146. };
  147.  
  148. static inline void delay(uint32_t time)
  149. {
  150.     __asm__ __volatile__(
  151.     "int $0x40"
  152.     ::"a"(5), "b"(time));
  153. };
  154.  
  155.  
  156.  
  157.  
  158. #define HW_BIT_BLIT         (1<<0)      /* BGRX blitter             */
  159. #define HW_TEX_BLIT         (1<<1)      /* stretch blit             */
  160. #define HW_VID_BLIT         (1<<2)      /* planar and packed video  */
  161.  
  162. uint32_t InitPixlib(uint32_t flags);
  163.  
  164. int create_bitmap(bitmap_t *bitmap);
  165. int lock_bitmap(bitmap_t *bitmap);
  166. int resize_bitmap(bitmap_t *bitmap);
  167. int blit_bitmap(bitmap_t *bitmap, int dst_x, int dst_y,
  168.                 int w, int h);
  169.  
  170.  
  171.