Subversion Repositories Kolibri OS

Rev

Rev 2427 | 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.     bitmap_t  *last_bitmap;
  42.    
  43.     uint32_t   ctx_format;
  44.     int        target;
  45.    
  46.     window_t   *win;
  47.     enum{
  48.       EMPTY, INIT }state;
  49.     enum win_state win_state;
  50.  
  51.     void (*draw)(render_t *render, AVPicture *picture);
  52. };
  53.  
  54. enum player_state
  55. {  CLOSED=0,PLAY_INIT,
  56.    STOP, PAUSE, PLAY, REWIND,
  57.    PAUSE_2_PLAY, REWIND_2_PLAY
  58. };
  59.  
  60. #define ID_PLAY      100
  61. #define ID_PROGRESS  101
  62. typedef struct
  63. {
  64.     volatile uint32_t   lock;
  65.     char               *buffer;
  66.     volatile uint32_t   count;
  67. }astream_t;
  68.  
  69. typedef struct
  70. {
  71.   unsigned int  code;
  72.   unsigned int  sender;
  73.   unsigned int  stream;
  74.   unsigned int  offset;
  75.   unsigned int  size;
  76.   unsigned int  unused[2];
  77. }SND_EVENT;
  78.  
  79. typedef struct
  80. {
  81.   unsigned      handle;
  82.   unsigned      io_code;
  83.   void          *input;
  84.   int           inp_size;
  85.   void          *output;
  86.   int           out_size;
  87. }ioctl_t;
  88.  
  89. typedef struct {
  90.     AVPacketList *first_pkt;
  91.     AVPacketList *last_pkt;
  92.     int size;
  93.     int count;
  94.     volatile uint32_t lock;
  95. } queue_t;
  96.  
  97. int put_packet(queue_t *q, AVPacket *pkt);
  98. int get_packet(queue_t *q, AVPacket *pkt);
  99.  
  100.  
  101. extern astream_t astream;
  102. extern AVRational video_time_base;
  103.  
  104. render_t *create_render(uint32_t width, uint32_t height,
  105.                         uint32_t ctx_format, uint32_t flags);
  106.  
  107. int init_render(render_t *render, int width, int height);
  108. void render_adjust_size(render_t *render, window_t *win);
  109. int render_set_size(render_t *render, int width, int height);
  110. void render_draw_client(render_t *render);
  111.  
  112.  
  113. int init_audio(int format);
  114. int audio_thread(void *param);
  115.  
  116. int init_video(AVCodecContext *ctx);
  117. int video_thread(void *param);
  118.  
  119. int decode_video(AVCodecContext  *ctx, queue_t *qv);
  120. int decode_audio(AVCodecContext  *ctx, queue_t *qa);
  121.  
  122. double get_master_clock(void);
  123.  
  124.  
  125. int create_thread(int (*proc)(void *param), void *param, int stack_size);
  126.  
  127. void mutex_lock(volatile uint32_t *val);
  128.  
  129. static inline void mutex_unlock(volatile uint32_t *val)
  130. {
  131.     *val = 0;
  132. }
  133.  
  134. static inline void GetNotify(void *event)
  135. {
  136.     __asm__ __volatile__ (
  137.     "int $0x40"
  138.     ::"a"(68),"b"(14),"c"(event));
  139. }
  140.  
  141. static inline uint32_t get_os_button()
  142. {
  143.     uint32_t val;
  144.     __asm__ __volatile__(
  145.     "int $0x40"
  146.     :"=a"(val)
  147.     :"a"(17));
  148.     return val>>8;
  149. };
  150.  
  151. static inline void yield(void)
  152. {
  153.     __asm__ __volatile__(
  154.     "int $0x40"
  155.     ::"a"(68), "b"(1));
  156. };
  157.  
  158. static inline void delay(uint32_t time)
  159. {
  160.     __asm__ __volatile__(
  161.     "int $0x40"
  162.     ::"a"(5), "b"(time)
  163.     :"memory");
  164. };
  165.  
  166.  
  167.  
  168.  
  169. #define HW_BIT_BLIT         (1<<0)      /* BGRX blitter             */
  170. #define HW_TEX_BLIT         (1<<1)      /* stretch blit             */
  171. #define HW_VID_BLIT         (1<<2)      /* planar and packed video  */
  172.  
  173. uint32_t InitPixlib(uint32_t flags);
  174.  
  175. int create_bitmap(bitmap_t *bitmap);
  176. int lock_bitmap(bitmap_t *bitmap);
  177. int resize_bitmap(bitmap_t *bitmap);
  178. int blit_bitmap(bitmap_t *bitmap, int dst_x, int dst_y,
  179.                 int w, int h);
  180.  
  181.  
  182.