Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1696 serge 1
 
2
#include 
3
#include 
4
#include 
5
6
 
7
8
 
9
10
 
11
{
12
    __asm__ __volatile__(
13
    "int $0x40"
14
    ::"a"(7), "b"(bitmap),
15
      "c"((w << 16) | h),
16
      "d"((x << 16) | y));
17
}
18
19
 
20
{
21
    AVFrame       *frame;
22
    uint8_t       *buffer;
23
    double         pts;
24
    volatile int   ready;
25
}vframe_t;
26
27
 
28
29
 
30
31
 
32
int dfx    = 0;
33
34
 
35
int height;
36
37
 
38
AVFrame  *Frame;
39
40
 
41
{
42
    uint32_t   size;
43
    int        i;
44
45
 
46
    height = ctx->height;
47
48
 
49
50
 
51
    if ( Frame == NULL )
52
    {
53
        printf("Cannot alloc video buffer\n\r");
54
        return 0;
55
    };
56
57
 
58
                            ctx->width,
59
                            ctx->height,
60
                            ctx->pix_fmt,
61
                            ctx->width,
62
                            ctx->height,
63
                            PIX_FMT_BGR24,
64
                            SWS_BILINEAR,
65
                            NULL, NULL, NULL);
66
    if(cvt_ctx == NULL)
67
    {
68
	    printf("Cannot initialize the conversion context!\n");
69
	    return 0;
70
    }
71
72
 
73
74
 
75
    {
76
        AVFrame   *frame;
77
78
 
79
80
 
81
        {
82
            uint8_t *buffer = (uint8_t*)av_malloc(size);
83
84
 
85
            {
86
                avpicture_fill((AVPicture *)frame, buffer, PIX_FMT_BGR24,
87
                               ctx->width, ctx->height);
88
89
 
90
                frames[i].buffer = buffer;
91
                frames[i].pts = 0;
92
                frames[i].ready  = 0;
93
                continue;
94
            };
95
        };
96
        printf("Cannot alloc frame buffer\n\r");
97
        return 0;
98
    };
99
100
 
101
102
 
103
};
104
105
 
106
107
 
108
{
109
    double     pts;
110
     AVPicture pict;
111
     const uint8_t  *data[4];
112
    double av_time;
113
114
 
115
116
 
117
			             pkt->data, pkt->size) <= 0)
118
        printf("decode error\n");
119
120
 
121
        Frame->reordered_opaque != AV_NOPTS_VALUE)
122
        pts= Frame->reordered_opaque;
123
    else if(pkt->dts != AV_NOPTS_VALUE)
124
        pts= pkt->dts;
125
    else
126
        pts= 0;
127
128
 
129
130
 
131
    {
132
        while( frames[dfx].ready != 0 )
133
            yield();
134
135
 
136
        pict.data[1] = frames[dfx].frame->data[1];
137
        pict.data[2] = frames[dfx].frame->data[2];
138
        pict.data[3] = NULL;
139
140
 
141
        pict.linesize[1] = frames[dfx].frame->linesize[1];
142
        pict.linesize[2] = frames[dfx].frame->linesize[2];
143
        pict.linesize[3] = 0;
144
145
 
146
        data[1] = Frame->data[1];
147
        data[2] = Frame->data[2];
148
        data[3] = NULL;
149
150
 
151
                  pict.data, pict.linesize);
152
153
 
154
        frames[dfx].ready = 1;
155
156
 
157
        dfx&= 7;
158
    };
159
160
 
161
}
162
163
 
164
165
 
166
typedef unsigned int count_t;
167
typedef unsigned int u32_t;
168
169
 
170
                       color_t workcolor, u32_t style)
171
{
172
173
 
174
    "int $0x40"
175
    ::"a"(0),
176
      "b"((x << 16) | (w & 0xFFFF)),
177
      "c"((y << 16) | (h & 0xFFFF)),
178
      "d"((style << 24) | (workcolor & 0xFFFFFF)),
179
      "D"(name));
180
};
181
182
 
183
 
184
{
185
    int ev;
186
187
 
188
189
 
190
    {
191
        case 1:
192
            DrawWindow(10, 10, width+9, height+26, NULL, 0x000000,0x74);
193
            break;
194
195
 
196
            if(get_os_button()==1)
197
                status = 0;
198
            break;
199
    };
200
    return 1;
201
}
202
203
 
204
 
205
206
 
207
{
208
    char *path;
209
210
 
211
212
 
213
214
 
215
    {
216
        double ctime;
217
        double fdelay;
218
219
 
220
221
 
222
        {
223
            ctime = get_master_clock();
224
            fdelay = (frames[vfx].pts - ctime);
225
//            printf("ctime %f pts %f delay %f\n",
226
//                    ctime, frames[vfx].pts, fdelay);
227
228
 
229
            {
230
                int  next_vfx;
231
                fdelay = 0;
232
                next_vfx = (vfx+1) & 7;
233
                if( frames[next_vfx].ready == 1 )
234
                {
235
                    if(frames[next_vfx].pts <= ctime)
236
                    {
237
                        frames[vfx].ready = 0;                  // skip this frame
238
                        vfx++;
239
                        vfx&= 7;
240
                     }
241
                    else
242
                    {
243
                        if( (frames[next_vfx].pts - ctime) <
244
                            ( ctime - frames[vfx].pts) )
245
                        {
246
                            frames[vfx].ready = 0;                  // skip this frame
247
                            vfx++;
248
                            vfx&= 7;
249
                            fdelay = (frames[next_vfx].pts - ctime);
250
                        }
251
                    }
252
                };
253
            };
254
255
 
256
            {
257
                delay( (uint32_t)(fdelay/10.0));
258
            };
259
260
 
261
            frames[vfx].ready = 0;
262
            vfx++;
263
            vfx&= 7;
264
        }
265
        else
266
        {
267
            yield();
268
        };
269
    };
270
};
271
>
272