Subversion Repositories Kolibri OS

Rev

Rev 4438 | Rev 5592 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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