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 11... Line 11...
11
#include 
11
#include 
12
#include 
12
#include 
13
#include "winlib/winlib.h"
13
#include "winlib/winlib.h"
14
#include "fplay.h"
14
#include "fplay.h"
Line 15... Line -...
15
 
-
 
16
extern int dfx;
-
 
17
 
15
 
18
struct hw_profile
16
struct hw_profile
19
{
17
{
20
    enum AVCodecID av_codec;
18
    enum AVCodecID av_codec;
21
    int ff_profile;
19
    int ff_profile;
Line 222... Line 220...
222
    if ((vaapi = calloc(1, sizeof(*vaapi))) == NULL)
220
    if ((vaapi = calloc(1, sizeof(*vaapi))) == NULL)
223
        goto error;
221
        goto error;
224
    vaapi->display               = display;
222
    vaapi->display               = display;
225
    vaapi->config_id             = VA_INVALID_ID;
223
    vaapi->config_id             = VA_INVALID_ID;
226
    vaapi->context_id            = VA_INVALID_ID;
224
    vaapi->context_id            = VA_INVALID_ID;
227
//    vaapi->pic_param_buf_id      = VA_INVALID_ID;
-
 
228
//    vaapi->iq_matrix_buf_id      = VA_INVALID_ID;
-
 
229
//    vaapi->bitplane_buf_id       = VA_INVALID_ID;
-
 
Line 230... Line 225...
230
 
225
 
Line 231... Line 226...
231
    v_context = vaapi;
226
    v_context = vaapi;
Line 464... Line 459...
464
 
459
 
465
//    ctx->video_surface_destroy(surface);
460
//    ctx->video_surface_destroy(surface);
466
    av_freep(&data);
461
    av_freep(&data);
Line 467... Line -...
467
}
-
 
468
 
462
}
469
 
463
 
-
 
464
static int get_buffer2(AVCodecContext *avctx, AVFrame *pic, int flags)
470
static int get_buffer2(AVCodecContext *avctx, AVFrame *pic, int flags)
465
{
Line 471... Line -...
471
{
-
 
472
    void *surface = (void *)(uintptr_t)v_surface_id[dfx];
-
 
473
 
-
 
474
//    printf("%s surface %x\n", __FUNCTION__, surface);
466
    vst_t *vst = (vst_t*)avctx->opaque;
Line 475... Line 467...
475
 
467
    void *surface = (void *)(uintptr_t)v_surface_id[vst->dfx];
476
//    pic->type= FF_BUFFER_TYPE_USER;
468
 
477
    pic->data[3] = surface;
469
    pic->data[3] = surface;
Line 487... Line 479...
487
    return 0;
479
    return 0;
488
}
480
}
Line 489... Line 481...
489
 
481
 
Line 490... Line 482...
490
struct vaapi_context va_context_storage;
482
struct vaapi_context va_context_storage;
491
 
483
 
492
int fplay_init_context(AVCodecContext *avctx)
484
int fplay_init_context(vst_t *vst)
Line -... Line 485...
-
 
485
{
493
{
486
    AVCodecContext *vCtx = vst->vCtx;
494
    ENTER();
487
 
495
 
488
    vCtx->opaque       = vst;
Line 496... Line -...
496
    avctx->thread_count    = 1;
-
 
497
    avctx->get_format      = get_format;
489
    vCtx->thread_count = 1;
498
    avctx->get_buffer2      = get_buffer2;
490
    vCtx->get_format   = get_format;
Line 499... Line 491...
499
 
491
    vCtx->get_buffer2  = get_buffer2;
500
    LEAVE();
492
 
Line 513... Line 505...
513
    return 0;
505
    return 0;
514
}
506
}
Line 515... Line 507...
515
 
507
 
Line 516... Line -...
516
struct SwsContext *vacvt_ctx;
-
 
517
 
-
 
518
 
-
 
519
void va_sync()
-
 
520
{
-
 
521
    struct vaapi_context* const vaapi = v_context;
-
 
522
 
-
 
523
    vaSyncSurface(vaapi->display,v_surface_id[dfx]);
-
 
524
};
-
 
525
 
508
struct SwsContext *vacvt_ctx;
526
 
509
 
527
void va_convert_picture(int width, int height, AVPicture *pic)
510
void va_convert_picture(vst_t *vst, int width, int height, AVPicture *pic)
528
{
511
{
529
    uint8_t  *src_data[4];
512
    uint8_t  *src_data[4];
530
    int       src_linesize[4];
513
    int       src_linesize[4];
531
    VAImage vaimage;
514
    VAImage vaimage;
532
    VAStatus status;
515
    VAStatus status;
Line -... Line 516...
-
 
516
    uint8_t *vdata;
Line 533... Line -...
533
    uint8_t *vdata;
-
 
534
    struct vaapi_context* const vaapi = v_context;
-
 
535
 
517
    struct vaapi_context* const vaapi = v_context;
536
 
518
 
537
    va_sync();
519
    vaSyncSurface(vaapi->display,v_surface_id[vst->dfx]);
538
 
520
 
539
    status = vaDeriveImage(vaapi->display,v_surface_id[dfx],&vaimage);
521
    status = vaDeriveImage(vaapi->display,v_surface_id[vst->dfx],&vaimage);
540
    if (!vaapi_check_status(status, "vaDeriveImage()"))
522
    if (!vaapi_check_status(status, "vaDeriveImage()"))
Line 541... Line 523...
541
    {
523
    {
Line 542... Line 524...
542
        FAIL();
524
        FAIL();
543
        return;
525
        return;
544
    };
526
    };
Line 545... Line 527...
545
 
527
 
546
    static int once = 2;
528
    static int once = 2;