Subversion Repositories Kolibri OS

Rev

Rev 6117 | Rev 6121 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6117 Rev 6118
Line 14... Line 14...
14
 
14
 
Line 15... Line 15...
15
#include "sound.h"
15
#include "sound.h"
16
#include "fplay.h"
16
#include "fplay.h"
Line -... Line 17...
-
 
17
 
-
 
18
#ifdef HAVE_VAAPI
-
 
19
int va_check_codec_support(enum AVCodecID id);
-
 
20
#endif
17
 
21
 
18
volatile enum player_state player_state  = STOP;
22
volatile enum player_state player_state  = STOP;
19
volatile enum player_state decoder_state = PREPARE;
23
volatile enum player_state decoder_state = PREPARE;
Line 20... Line 24...
20
volatile enum player_state sound_state   = STOP;
24
volatile enum player_state sound_state   = STOP;
Line 21... Line -...
21
 
-
 
22
uint32_t win_width, win_height;
-
 
Line 23... Line 25...
23
 
25
 
Line 24... Line 26...
24
void decoder();
26
uint32_t win_width, win_height;
Line 33... Line 35...
33
 
35
 
Line 34... Line 36...
34
extern int sample_rate;
36
extern int sample_rate;
35
char *movie_file;
37
char *movie_file;
Line 36... Line 38...
36
 
38
 
Line 37... Line 39...
37
void flush_video();
39
void flush_video(vst_t* vst);
Line 38... Line 40...
38
 
40
 
Line 76... Line 78...
76
    avcodec_register_all();
78
    avcodec_register_all();
77
    avdevice_register_all();
79
    avdevice_register_all();
78
    av_register_all();
80
    av_register_all();
Line -... Line 81...
-
 
81
 
-
 
82
#ifdef HAVE_VAAPI
-
 
83
    fplay_vaapi_init();
-
 
84
#endif
79
 
85
 
80
    if( avformat_open_input(&vst.fCtx, movie_file, NULL, NULL) < 0)
86
    if( avformat_open_input(&vst.fCtx, movie_file, NULL, NULL) < 0)
81
    {
87
    {
82
        printf("Cannot open file %s\n\r", movie_file);
88
        printf("Cannot open file %s\n\r", movie_file);
83
        return -1; // Couldn't open file
89
        return -1; // Couldn't open file
Line 150... Line 156...
150
        vst.vCtx->codec_id, vst.vStream);
156
        vst.vCtx->codec_id, vst.vStream);
151
        return -1; // Codec not found
157
        return -1; // Codec not found
152
    }
158
    }
153
 
159
 
Line -... Line 160...
-
 
160
#ifdef HAVE_VAAPI
-
 
161
    int hwdec = va_check_codec_support(vst.vCtx->codec_id);
Line -... Line 162...
-
 
162
 
-
 
163
    if(hwdec)
-
 
164
    {
Line -... Line 165...
-
 
165
        printf("hardware decode supported\n");
-
 
166
 
-
 
167
        if (fplay_init_context(&vst) < 0)
-
 
168
        {
-
 
169
            printf("context initialization failed\n");
-
 
170
            return -1;
-
 
171
        };
Line 154... Line 172...
154
 
172
    };
155
 
173
#endif
156
 
174
 
157
    if(avcodec_open2(vst.vCtx, vst.vCodec, NULL) < 0)
175
    if(avcodec_open2(vst.vCtx, vst.vCodec, NULL) < 0)
Line 296... Line 314...
296
 
314
 
Line 297... Line 315...
297
    while( get_packet(&vst->q_audio, &packet)!= 0)
315
    while( get_packet(&vst->q_audio, &packet)!= 0)
298
        av_free_packet(&packet);
316
        av_free_packet(&packet);
Line 299... Line 317...
299
 
317
 
Line 300... Line 318...
300
    flush_video();
318
    flush_video(vst);
301
 
319
 
Line 302... Line 320...
302
    astream.count = 0;
320
    astream.count = 0;