6506
|
1 #include <stdio.h>
|
|
2 #include <stdlib.h>
|
|
3
|
|
4 #include "config.h"
|
|
5 #include "mp_msg.h"
|
|
6
|
|
7 #include "vd_internal.h"
|
|
8
|
|
9 static vd_info_t info = {
|
|
10 "SVQ1 (Sorenson v1) Video decoder",
|
|
11 "svq1",
|
|
12 VFM_SVQ1,
|
|
13 "A'rpi",
|
|
14 "XINE team",
|
|
15 "native codec"
|
|
16 };
|
|
17
|
|
18 LIBVD_EXTERN(svq1)
|
|
19
|
|
20 #include "native/svq1.h"
|
|
21
|
|
22 // to set/get/query special features/parameters
|
|
23 static int control(sh_video_t *sh,int cmd,void* arg,...){
|
|
24 return CONTROL_UNKNOWN;
|
|
25 }
|
|
26
|
|
27 // init driver
|
|
28 static int init(sh_video_t *sh){
|
|
29 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YVU9)) return 0;
|
|
30
|
|
31 sh->context=malloc(sizeof(svq1_t));
|
|
32 memset(sh->context,0,sizeof(svq1_t));
|
|
33
|
|
34 return 1;
|
|
35 }
|
|
36
|
|
37 // uninit driver
|
|
38 static void uninit(sh_video_t *sh){
|
|
39 svq1_free(sh->context);
|
|
40 sh->context=NULL;
|
|
41 }
|
|
42
|
|
43 // decode a frame
|
|
44 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
|
|
45 mp_image_t* mpi;
|
|
46 svq1_t* svq1=sh->context;
|
|
47 int ret;
|
|
48
|
|
49 if(len<=0) return NULL; // skipped frame
|
|
50
|
|
51 ret=svq1_decode_frame(svq1,data);
|
|
52
|
|
53 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE,
|
|
54 sh->disp_w, sh->disp_h);
|
|
55 if(!mpi) return NULL;
|
|
56
|
|
57 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"SVQ1: ret=%d wh=%dx%d p=%p \n",ret,svq1->width,svq1->height,svq1->current);
|
|
58
|
|
59 mpi->planes[0]=svq1->base[0];
|
|
60 mpi->planes[1]=svq1->base[1];
|
|
61 mpi->planes[2]=svq1->base[2];
|
|
62 mpi->stride[0]=svq1->luma_width;
|
|
63 mpi->stride[1]=mpi->stride[2]=svq1->chroma_width;
|
|
64
|
|
65 return mpi;
|
|
66 }
|
|
67
|