Subversion Repositories Kolibri OS

Rev

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

Rev 6121 Rev 6133
Line 24... Line 24...
24
volatile enum player_state sound_state   = STOP;
24
volatile enum player_state sound_state   = STOP;
25
 
25
 
Line 26... Line 26...
26
uint32_t win_width, win_height;
26
uint32_t win_width, win_height;
Line 27... Line -...
27
 
-
 
28
 
-
 
29
AVFrame *pFrame;
-
 
30
 
27
 
Line 31... Line 28...
31
int      have_sound = 0;
28
int      have_sound = 0;
32
 
29
 
Line 145... Line 142...
145
    vst.vCodec = avcodec_find_decoder(vst.vCtx->codec_id);
142
    vst.vCodec = avcodec_find_decoder(vst.vCtx->codec_id);
146
    printf("codec id %x name %s\n",vst.vCtx->codec_id, vst.vCodec->name);
143
    printf("codec id %x name %s\n",vst.vCtx->codec_id, vst.vCodec->name);
147
    printf("ctx->pix_fmt %d\n", vst.vCtx->pix_fmt);
144
    printf("ctx->pix_fmt %d\n", vst.vCtx->pix_fmt);
Line -... Line 145...
-
 
145
 
-
 
146
    INIT_LIST_HEAD(&vst.input_list);
-
 
147
    INIT_LIST_HEAD(&vst.output_list);
-
 
148
    mutex_init(&vst.q_video.lock);
-
 
149
    mutex_init(&vst.q_audio.lock);
-
 
150
    mutex_init(&vst.gpu_lock);
-
 
151
    mutex_init(&vst.decoder_lock);
-
 
152
    mutex_init(&vst.input_lock);
-
 
153
    mutex_init(&vst.output_lock);
148
 
154
 
149
    if(vst.vCodec == NULL)
155
    if(vst.vCodec == NULL)
150
    {
156
    {
151
        printf("Unsupported codec with id %d for input stream %d\n",
157
        printf("Unsupported codec with id %d for input stream %d\n",
152
        vst.vCtx->codec_id, vst.vStream);
158
        vst.vCtx->codec_id, vst.vStream);
Line 164... Line 170...
164
    };
170
    };
165
 
171
 
Line 166... Line 172...
166
    printf("ctx->pix_fmt %d\n", vst.vCtx->pix_fmt);
172
    printf("ctx->pix_fmt %d\n", vst.vCtx->pix_fmt);
Line 167... Line -...
167
 
-
 
168
    mutex_init(&vst.q_video.lock);
-
 
169
    mutex_init(&vst.q_audio.lock);
-
 
170
    mutex_init(&vst.gpu_lock);
-
 
171
 
173
 
172
    if (vst.aCtx->channels > 0)
174
    if (vst.aCtx->channels > 0)
173
        vst.aCtx->request_channels = FFMIN(2, vst.aCtx->channels);
175
        vst.aCtx->request_channels = FFMIN(2, vst.aCtx->channels);
174
    else
176
    else
Line 222... Line 224...
222
 
224
 
Line 223... Line 225...
223
    if(!init_video(&vst))
225
    if(!init_video(&vst))
224
        return 0;
226
        return 0;
Line 225... Line 227...
225
 
227
 
Line 226... Line -...
226
    decoder(&vst);
-
 
227
 
228
    mutex_lock_timeout(&vst.decoder_lock, 3000);
Line 228... Line 229...
228
  // Free the YUV frame
229
 
Line 229... Line 230...
229
    av_free(pFrame);
230
    decoder(&vst);
Line 239... Line 240...
239
        mutex_destroy(&astream.lock);
240
        mutex_destroy(&astream.lock);
240
 
241
 
Line 241... Line 242...
241
    mutex_destroy(&vst.q_video.lock);
242
    mutex_destroy(&vst.q_video.lock);
242
    mutex_destroy(&vst.q_audio.lock);
243
    mutex_destroy(&vst.q_audio.lock);
243
 
-
 
-
 
244
    mutex_destroy(&vst.decoder_lock);
244
    return 0;
245
    return 0;
245
}
246
}
Line 246... Line 247...
246
 
247
 
Line 332... Line 333...
332
                        eof = load_frame(vst);
333
                        eof = load_frame(vst);
333
                    }
334
                    }
334
                    decode_video(vst);
335
                    decode_video(vst);
335
                    ret = decode_audio(vst->aCtx, &vst->q_audio);
336
                    ret = decode_audio(vst->aCtx, &vst->q_audio);
336
                }while(astream.count < resampler_size*2 &&
337
                }while(astream.count < resampler_size*2 && ret == 1);
337
                       ret == 1);
338
 
338
 
-
 
Line 339... Line 339...
339
                sound_state   = PREPARE;
339
                sound_state   = PREPARE;
340
                decoder_state = PLAY;
340
                decoder_state = PLAY;
341
                player_state  = PLAY;
341
                player_state  = PLAY;