Subversion Repositories Kolibri OS

Rev

Rev 5592 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1.  
  2. #include "pixlib2.h"
  3.  
  4. #define BLACK_MAGIC_SOUND
  5. #define BLACK_MAGIC_VIDEO
  6.  
  7. typedef unsigned int color_t;
  8. typedef unsigned int count_t;
  9.  
  10. typedef struct render  render_t;
  11.  
  12. #define HAS_LEFT        (1<<0)
  13. #define HAS_TOP         (1<<1)
  14. #define HAS_RIGHT       (1<<2)
  15. #define HAS_BOTTOM      (1<<3)
  16.  
  17. struct render
  18. {
  19.     uint32_t   caps;
  20.     uint32_t   ctx_width;
  21.     uint32_t   ctx_height;
  22.     uint32_t   win_width;
  23.     uint32_t   win_height;
  24.  
  25.     rect_t     rc_client;
  26.     rect_t     rcvideo;
  27.     rect_t     rcleft;
  28.     rect_t     rctop;
  29.     rect_t     rcright;
  30.     rect_t     rcbottom;
  31.  
  32.     uint32_t   layout;
  33.     bitmap_t   bitmap[4];
  34.     bitmap_t  *last_bitmap;
  35.  
  36.     uint32_t   ctx_format;
  37.     int        target;
  38.  
  39.     window_t   *win;
  40.     enum{
  41.       EMPTY, INIT }state;
  42.     enum win_state win_state;
  43.  
  44.     void (*draw)(render_t *render, AVPicture *picture);
  45. };
  46.  
  47. enum player_state
  48. {
  49.     CLOSED = 0,
  50.     PREPARE,
  51.     STOP,
  52.     PAUSE,
  53.     PLAY,
  54.     REWIND,
  55.     PLAY_2_STOP,
  56.     PLAY_2_PAUSE,
  57.     PAUSE_2_PLAY,
  58.     REWIND_2_PLAY,
  59. };
  60.  
  61. #define ID_PLAY             100
  62. #define ID_STOP             101
  63. #define ID_PROGRESS         102
  64. #define ID_VOL_LEVEL        103
  65. #define ID_VOL_CTRL         104
  66.  
  67. typedef struct
  68. {
  69.     volatile uint32_t   lock;
  70.     char               *buffer;
  71.     volatile uint32_t   count;
  72. }astream_t;
  73.  
  74. typedef struct
  75. {
  76.   unsigned int  code;
  77.   unsigned int  sender;
  78.   unsigned int  stream;
  79.   unsigned int  offset;
  80.   unsigned int  size;
  81.   unsigned int  unused[2];
  82. }SND_EVENT;
  83.  
  84.  
  85. typedef struct {
  86.     AVPacketList *first_pkt;
  87.     AVPacketList *last_pkt;
  88.     int size;
  89.     int count;
  90.     volatile uint32_t lock;
  91. } queue_t;
  92.  
  93. int put_packet(queue_t *q, AVPacket *pkt);
  94. int get_packet(queue_t *q, AVPacket *pkt);
  95.  
  96.  
  97. extern astream_t astream;
  98. extern AVRational video_time_base;
  99.  
  100. render_t *create_render(window_t *win, AVCodecContext *ctx, uint32_t flags);
  101. void destroy_render(render_t *render);
  102. int init_render(render_t *render, int width, int height);
  103. void render_adjust_size(render_t *render, window_t *win);
  104. void render_set_size(render_t *render, int width, int height);
  105. void render_draw_client(render_t *render);
  106.  
  107.  
  108. int init_audio(int format);
  109. int audio_thread(void *param);
  110. void set_audio_volume(int left, int right);
  111.  
  112. int init_video(AVCodecContext *ctx);
  113. int video_thread(void *param);
  114.  
  115. int decode_video(AVCodecContext  *ctx, queue_t *qv);
  116. int decode_audio(AVCodecContext  *ctx, queue_t *qa);
  117.  
  118. double get_master_clock(void);
  119.  
  120.  
  121. int create_thread(int (*proc)(void *param), void *param, int stack_size);
  122.  
  123. void mutex_lock(volatile uint32_t *val);
  124.  
  125. static inline void mutex_unlock(volatile uint32_t *val)
  126. {
  127.     *val = 0;
  128. }
  129.  
  130. static inline void GetNotify(void *event)
  131. {
  132.     __asm__ __volatile__ (
  133.     "int $0x40"
  134.     ::"a"(68),"b"(14),"c"(event));
  135. }
  136.  
  137.  
  138.  
  139. int init_fontlib();
  140. int draw_text(bitmap_t *winbitmap, int face, char *text, int x, int y, int color);
  141. int draw_text_ext(bitmap_t *winbitmap, int face, char *text, rect_t *rc, int color);
  142. char *get_moviefile();
  143.  
  144.