Mercurial > mplayer.hg
annotate libmpcodecs/vd_svq1.c @ 6986:5c29c5c5f47c
Mozilla/Opera/? fix
author | jonas |
---|---|
date | Tue, 13 Aug 2002 11:20:12 +0000 |
parents | adc50c83986d |
children | 1e47c2e7aa8e |
rev | line source |
---|---|
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 | |
6509 | 27 extern int avcodec_inited; |
28 | |
6506 | 29 // init driver |
30 static int init(sh_video_t *sh){ | |
6509 | 31 |
32 #ifdef USE_LIBAVCODEC | |
33 if(!avcodec_inited){ | |
34 avcodec_init(); | |
35 avcodec_register_all(); | |
36 avcodec_inited=1; | |
37 } | |
38 #endif | |
39 | |
6506 | 40 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YVU9)) return 0; |
41 | |
42 sh->context=malloc(sizeof(svq1_t)); | |
43 memset(sh->context,0,sizeof(svq1_t)); | |
44 | |
45 return 1; | |
46 } | |
47 | |
48 // uninit driver | |
49 static void uninit(sh_video_t *sh){ | |
50 svq1_free(sh->context); | |
51 sh->context=NULL; | |
52 } | |
53 | |
54 // decode a frame | |
55 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ | |
56 mp_image_t* mpi; | |
57 svq1_t* svq1=sh->context; | |
58 int ret; | |
59 | |
60 if(len<=0) return NULL; // skipped frame | |
61 | |
6511
a2086150099b
use libavcodec's get_bits() code (optional, disabled by default)
arpi
parents:
6509
diff
changeset
|
62 ret=svq1_decode_frame(svq1,data,len); |
6521 | 63 if (ret != 0) |
64 return NULL; | |
6506 | 65 |
66 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE, | |
67 sh->disp_w, sh->disp_h); | |
68 if(!mpi) return NULL; | |
69 | |
70 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"SVQ1: ret=%d wh=%dx%d p=%p \n",ret,svq1->width,svq1->height,svq1->current); | |
71 | |
72 mpi->planes[0]=svq1->base[0]; | |
73 mpi->planes[1]=svq1->base[1]; | |
74 mpi->planes[2]=svq1->base[2]; | |
75 mpi->stride[0]=svq1->luma_width; | |
76 mpi->stride[1]=mpi->stride[2]=svq1->chroma_width; | |
77 | |
78 return mpi; | |
79 } | |
80 |