Mercurial > mplayer.hg
annotate libmpcodecs/vd_svq1.c @ 7280:d77c243f0456
Added CDDA credits to Alban.
Added CDDB credits to Bertrand.
Why is my last name all upper case, and only for me?
Sorry for the cosmetic, but it looks wierd :/
author | bertrand |
---|---|
date | Thu, 05 Sep 2002 05:08:55 +0000 |
parents | 28677d779205 |
children | b465ba5897a3 |
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 "A'rpi", | |
13 "XINE team", | |
14 "native codec" | |
15 }; | |
16 | |
17 LIBVD_EXTERN(svq1) | |
18 | |
7127 | 19 #ifdef USE_LIBAVCODEC |
20 #ifdef USE_LIBAVCODEC_SO | |
21 #include <ffmpeg/avcodec.h> | |
22 #else | |
23 #include "libavcodec/avcodec.h" | |
24 #endif | |
25 #endif | |
26 | |
6506 | 27 #include "native/svq1.h" |
28 | |
29 // to set/get/query special features/parameters | |
30 static int control(sh_video_t *sh,int cmd,void* arg,...){ | |
31 return CONTROL_UNKNOWN; | |
32 } | |
33 | |
6509 | 34 extern int avcodec_inited; |
35 | |
6506 | 36 // init driver |
37 static int init(sh_video_t *sh){ | |
6509 | 38 |
39 #ifdef USE_LIBAVCODEC | |
40 if(!avcodec_inited){ | |
41 avcodec_init(); | |
42 avcodec_register_all(); | |
43 avcodec_inited=1; | |
44 } | |
45 #endif | |
46 | |
6506 | 47 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YVU9)) return 0; |
48 | |
49 sh->context=malloc(sizeof(svq1_t)); | |
50 memset(sh->context,0,sizeof(svq1_t)); | |
51 | |
52 return 1; | |
53 } | |
54 | |
55 // uninit driver | |
56 static void uninit(sh_video_t *sh){ | |
57 svq1_free(sh->context); | |
58 sh->context=NULL; | |
59 } | |
60 | |
61 // decode a frame | |
62 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ | |
63 mp_image_t* mpi; | |
64 svq1_t* svq1=sh->context; | |
65 int ret; | |
66 | |
67 if(len<=0) return NULL; // skipped frame | |
68 | |
6511
a2086150099b
use libavcodec's get_bits() code (optional, disabled by default)
arpi
parents:
6509
diff
changeset
|
69 ret=svq1_decode_frame(svq1,data,len); |
6521 | 70 if (ret != 0) |
71 return NULL; | |
6506 | 72 |
73 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE, | |
74 sh->disp_w, sh->disp_h); | |
75 if(!mpi) return NULL; | |
76 | |
77 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"SVQ1: ret=%d wh=%dx%d p=%p \n",ret,svq1->width,svq1->height,svq1->current); | |
78 | |
79 mpi->planes[0]=svq1->base[0]; | |
80 mpi->planes[1]=svq1->base[1]; | |
81 mpi->planes[2]=svq1->base[2]; | |
82 mpi->stride[0]=svq1->luma_width; | |
83 mpi->stride[1]=mpi->stride[2]=svq1->chroma_width; | |
84 | |
85 return mpi; | |
86 } | |
87 |