Subversion Repositories Kolibri OS

Rev

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

Rev 6118 Rev 6121
Line 174... Line 174...
174
 
174
 
175
    drm_fd = 0;
175
    drm_fd = 0;
176
    return NULL;
176
    return NULL;
Line 177... Line 177...
177
};
177
};
178
 
178
 
179
int vaapi_init(VADisplay display)
179
void *vaapi_init(VADisplay display)
180
{
180
{
181
    struct vaapi_context *vaapi;
181
    struct vaapi_context *vaapi;
182
    int major_version, minor_version;
182
    int major_version, minor_version;
Line 223... Line 223...
223
    vaapi->config_id             = VA_INVALID_ID;
223
    vaapi->config_id             = VA_INVALID_ID;
224
    vaapi->context_id            = VA_INVALID_ID;
224
    vaapi->context_id            = VA_INVALID_ID;
Line 225... Line 225...
225
 
225
 
Line 226... Line 226...
226
    v_context = vaapi;
226
    v_context = vaapi;
Line 227... Line 227...
227
 
227
 
228
    return 0;
228
    return vaapi;
229
 
229
 
230
error:
230
error:
Line 231... Line -...
231
    free(display_attrs);
-
 
232
    return -1;
231
    free(display_attrs);
233
}
232
    return NULL;
234
 
233
}
235
 
234
 
236
static int has_profile(struct vaapi_context *vaapi, VAProfile profile)
235
static int has_profile(struct vaapi_context *vaapi, VAProfile profile)
Line 483... Line 482...
483
 
482
 
484
int fplay_init_context(vst_t *vst)
483
int fplay_init_context(vst_t *vst)
485
{
484
{
Line -... Line 485...
-
 
485
    AVCodecContext *vCtx = vst->vCtx;
-
 
486
 
-
 
487
    if(va_check_codec_support(vCtx->codec_id))
-
 
488
    {
-
 
489
        VADisplay dpy;
-
 
490
 
-
 
491
        dpy = va_open_display();
-
 
492
        vst->hwCtx = vaapi_init(dpy);
-
 
493
 
-
 
494
        if(vst->hwCtx != NULL)
-
 
495
        {
-
 
496
            for(int i = 0; i < 4; i++)
-
 
497
            {
-
 
498
                int ret;
-
 
499
 
-
 
500
                ret = avpicture_alloc(&vst->vframe[i].picture, AV_PIX_FMT_BGRA,
-
 
501
                                      vst->vCtx->width, vst->vCtx->height);
-
 
502
                if ( ret != 0 )
-
 
503
                {
-
 
504
                    printf("Cannot alloc video buffer\n\r");
-
 
505
                    return ret;
-
 
506
                };
-
 
507
                vst->vframe[i].format = AV_PIX_FMT_BGRA;
-
 
508
                vst->vframe[i].pts   = 0;
-
 
509
                vst->vframe[i].ready  = 0;
-
 
510
            };
486
    AVCodecContext *vCtx = vst->vCtx;
511
 
487
 
512
            vst->hwdec         = 1;
488
    vCtx->opaque       = vst;
513
            vCtx->opaque       = vst;
489
    vCtx->thread_count = 1;
514
            vCtx->thread_count = 1;
490
    vCtx->get_format   = get_format;
-
 
491
    vCtx->get_buffer2  = get_buffer2;
515
            vCtx->get_format   = get_format;
-
 
516
            vCtx->get_buffer2  = get_buffer2;
492
 
517
            return 0;
Line 493... Line -...
493
    return 0;
-
 
494
}
-
 
495
 
518
        };
Line 496... Line 519...
496
int fplay_vaapi_init(void)
519
    };
-
 
520
 
-
 
521
    vst->hwdec = 0;
Line -... Line 522...
-
 
522
 
-
 
523
    for(int i = 0; i < 4; i++)
497
{
524
    {
-
 
525
        int ret;
-
 
526
 
498
    VADisplay dpy;
527
        ret = avpicture_alloc(&vst->vframe[i].picture, vst->vCtx->pix_fmt,
-
 
528
                               vst->vCtx->width, vst->vCtx->height);
-
 
529
        if ( ret != 0 )
-
 
530
        {
-
 
531
            printf("Cannot alloc video buffer\n\r");
-
 
532
            return ret;
Line 499... Line 533...
499
 
533
        };
500
    dpy = va_open_display();
534
        vst->vframe[i].format = vst->vCtx->pix_fmt;
Line -... Line 535...
-
 
535
        vst->vframe[i].pts    = 0;
501
 
536
        vst->vframe[i].ready  = 0;
Line 502... Line 537...
502
    if (vaapi_init(dpy) < 0)
537
    };
503
        return -1;
538
 
504
 
539
    return 0;
Line 582... Line 617...
582
    {
617
    {
583
        printf("Cannot initialize the conversion context!\n");
618
        printf("Cannot initialize the conversion context!\n");
584
        return ;
619
        return ;
585
    };
620
    };
Line 586... Line -...
586
 
-
 
587
 
-
 
588
//    __asm__ volatile ("int3");
-
 
589
 
621
 
Line 590... Line 622...
590
    sws_scale(vacvt_ctx, (const uint8_t* const *)src_data, src_linesize, 0, height, pic->data, pic->linesize);
622
    sws_scale(vacvt_ctx, (const uint8_t* const *)src_data, src_linesize, 0, height, pic->data, pic->linesize);
591
 
623
 
592
    vaUnmapBuffer (vaapi->display, vaimage.buf);
624
    vaUnmapBuffer (vaapi->display, vaimage.buf);