Subversion Repositories Kolibri OS

Rev

Rev 6135 | Rev 6144 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4438 Serge 1
 
6117 serge 2
#include 
6133 serge 3
#include "list.h"
4
4438 Serge 5
 
6
#define BLACK_MAGIC_VIDEO
7
8
 
9
typedef unsigned int count_t;
10
11
 
12
typedef struct vstate vst_t;
6117 serge 13
4438 Serge 14
 
15
#define HAS_TOP         (1<<1)
16
#define HAS_RIGHT       (1<<2)
17
#define HAS_BOTTOM      (1<<3)
18
19
 
6121 serge 20
{
21
    struct list_head list;
6133 serge 22
    enum AVPixelFormat format;
6121 serge 23
    AVPicture     picture;
24
    planar_t*     planar;
6133 serge 25
    int           is_hw_pic;
26
    int           index;
27
    double        pts;
6121 serge 28
    double        pkt_pts;
6133 serge 29
    volatile int  ready;
6121 serge 30
}vframe_t;
31
32
 
4438 Serge 33
{
34
    vst_t     *vst;
6117 serge 35
    uint32_t   caps;
4438 Serge 36
    uint32_t   ctx_width;
37
    uint32_t   ctx_height;
38
    uint32_t   win_width;
39
    uint32_t   win_height;
40
41
 
42
    rect_t     rcvideo;
43
    rect_t     rcleft;
44
    rect_t     rctop;
45
    rect_t     rcright;
46
    rect_t     rcbottom;
47
48
 
49
    bitmap_t  *bitmap[4];
5372 serge 50
    bitmap_t  *last_bitmap;
4438 Serge 51
52
 
53
    int        target;
54
55
 
56
    enum{
57
      EMPTY, INIT }state;
58
    enum win_state win_state;
59
60
 
6133 serge 61
};
4438 Serge 62
63
 
64
{
65
    CLOSED = 0,
66
    PREPARE,
67
    STOP,
68
    PAUSE,
69
    PLAY,
70
    REWIND,
71
    PLAY_2_STOP,
72
    PLAY_2_PAUSE,
73
    PAUSE_2_PLAY,
74
    REWIND_2_PLAY,
75
};
76
77
 
78
#define ID_STOP             101
79
#define ID_PROGRESS         102
80
#define ID_VOL_LEVEL        103
81
#define ID_VOL_CTRL         104
82
83
 
84
{
85
    mutex_t lock;
5603 serge 86
    char    *buffer;
87
    int     count;
88
}astream_t;
4438 Serge 89
90
 
91
{
92
  unsigned int  code;
93
  unsigned int  sender;
94
  unsigned int  stream;
95
  unsigned int  offset;
96
  unsigned int  size;
97
  unsigned int  unused[2];
98
}SND_EVENT;
99
100
 
101
 
102
    AVPacketList *first_pkt;
103
    AVPacketList *last_pkt;
104
    int size;
105
    int count;
106
    mutex_t       lock;
6117 serge 107
} queue_t;
4438 Serge 108
109
 
110
int get_packet(queue_t *q, AVPacket *pkt);
111
112
 
6117 serge 113
{
114
    AVFormatContext *fCtx;              /* format context           */
6136 serge 115
    AVCodecContext  *vCtx;              /* video decoder context    */
116
    AVCodecContext  *aCtx;              /* audio decoder context    */
117
    AVCodec         *vCodec;            /* video codec              */
118
    AVCodec         *aCodec;            /* audio codec              */
119
    char            *input_file;
120
    char            *input_name;
121
    int             vStream;            /* video stream index       */
122
    int             aStream;            /* audio stream index       */
123
    AVRational      video_time_base;
124
    AVRational      audio_time_base;
125
4438 Serge 126
 
6136 serge 127
    queue_t         q_audio;            /* audio packets queue      */
128
6117 serge 129
 
6136 serge 130
    mutex_t         decoder_lock;
6133 serge 131
6117 serge 132
 
6133 serge 133
    mutex_t         output_lock;
134
    struct list_head input_list;
135
    struct list_head output_list;
136
137
 
6136 serge 138
139
 
6133 serge 140
    volatile int    frames_count;
6136 serge 141
    void           *hwCtx;              /* hardware context         */
142
    int             hwdec:1;            /* hardware decoder         */
143
    int             blit_bitmap:1;      /* hardware RGBA blitter    */
144
    int             blit_texture:1;     /* hardware RGBA blit and scale */
145
    int             blit_planar:1;      /* hardbare YUV blit and scale */
146
    int             frame_reorder:1;
6135 serge 147
    int             nframes;
6136 serge 148
    vframe_t        vframes[16];
149
};
6117 serge 150
151
 
152
 
5603 serge 153
#define AUDIO_THREAD    2
154
#define VIDEO_THREAD    4
155
156
 
157
extern astream_t astream;
4438 Serge 158
159
 
6117 serge 160
void destroy_render(render_t *render);
4438 Serge 161
int init_render(render_t *render, int width, int height);
162
void render_adjust_size(render_t *render, window_t *win);
163
void render_set_size(render_t *render, int width, int height);
164
void render_draw_client(render_t *render);
165
166
 
6118 serge 167
4438 Serge 168
 
169
int audio_thread(void *param);
170
void set_audio_volume(int left, int right);
171
172
 
173
void flush_video(vst_t* vst);
6136 serge 174
4438 Serge 175
 
6117 serge 176
int decode_video(vst_t* vst);
177
int decode_audio(AVCodecContext  *ctx, queue_t *qa);
4438 Serge 178
179
 
180
181
 
182
{
183
    __asm__ __volatile__ (
184
    "int $0x40"
185
    ::"a"(68),"b"(14),"c"(event));
186
}
187
188
 
6136 serge 189
{
190
    return (double)av_q2d(vst->fCtx->streams[vst->aStream]->time_base)*1000;
191
};
192
193
 
6133 serge 194
6118 serge 195
 
4438 Serge 196
char *get_moviefile();
197
198