Mercurial > mplayer.hg
annotate libmpcodecs/vd_svq1.c @ 8180:4ba9aed295f2
Fixing segfault bug and addnig support for lrintf() in format conversion
author | anders |
---|---|
date | Wed, 13 Nov 2002 09:09:50 +0000 |
parents | b465ba5897a3 |
children |
rev | line source |
---|---|
6506 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
3 | |
4 #include "config.h" | |
8026
b465ba5897a3
usage of libmpeg2, liba52, mp3lib & svq1 can be disabled
arpi
parents:
7180
diff
changeset
|
5 #ifdef USE_SVQ1 |
b465ba5897a3
usage of libmpeg2, liba52, mp3lib & svq1 can be disabled
arpi
parents:
7180
diff
changeset
|
6 |
6506 | 7 #include "mp_msg.h" |
8 | |
9 #include "vd_internal.h" | |
10 | |
11 static vd_info_t info = { | |
12 "SVQ1 (Sorenson v1) Video decoder", | |
13 "svq1", | |
14 "A'rpi", | |
15 "XINE team", | |
16 "native codec" | |
17 }; | |
18 | |
19 LIBVD_EXTERN(svq1) | |
20 | |
7127 | 21 #ifdef USE_LIBAVCODEC |
22 #ifdef USE_LIBAVCODEC_SO | |
23 #include <ffmpeg/avcodec.h> | |
24 #else | |
25 #include "libavcodec/avcodec.h" | |
26 #endif | |
27 #endif | |
28 | |
6506 | 29 #include "native/svq1.h" |
30 | |
31 // to set/get/query special features/parameters | |
32 static int control(sh_video_t *sh,int cmd,void* arg,...){ | |
33 return CONTROL_UNKNOWN; | |
34 } | |
35 | |
6509 | 36 extern int avcodec_inited; |
37 | |
6506 | 38 // init driver |
39 static int init(sh_video_t *sh){ | |
6509 | 40 |
41 #ifdef USE_LIBAVCODEC | |
42 if(!avcodec_inited){ | |
43 avcodec_init(); | |
44 avcodec_register_all(); | |
45 avcodec_inited=1; | |
46 } | |
47 #endif | |
48 | |
6506 | 49 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YVU9)) return 0; |
50 | |
51 sh->context=malloc(sizeof(svq1_t)); | |
52 memset(sh->context,0,sizeof(svq1_t)); | |
53 | |
54 return 1; | |
55 } | |
56 | |
57 // uninit driver | |
58 static void uninit(sh_video_t *sh){ | |
59 svq1_free(sh->context); | |
60 sh->context=NULL; | |
61 } | |
62 | |
63 // decode a frame | |
64 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ | |
65 mp_image_t* mpi; | |
66 svq1_t* svq1=sh->context; | |
67 int ret; | |
68 | |
69 if(len<=0) return NULL; // skipped frame | |
70 | |
6511
a2086150099b
use libavcodec's get_bits() code (optional, disabled by default)
arpi
parents:
6509
diff
changeset
|
71 ret=svq1_decode_frame(svq1,data,len); |
6521 | 72 if (ret != 0) |
73 return NULL; | |
6506 | 74 |
75 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE, | |
76 sh->disp_w, sh->disp_h); | |
77 if(!mpi) return NULL; | |
78 | |
79 mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"SVQ1: ret=%d wh=%dx%d p=%p \n",ret,svq1->width,svq1->height,svq1->current); | |
80 | |
81 mpi->planes[0]=svq1->base[0]; | |
82 mpi->planes[1]=svq1->base[1]; | |
83 mpi->planes[2]=svq1->base[2]; | |
84 mpi->stride[0]=svq1->luma_width; | |
85 mpi->stride[1]=mpi->stride[2]=svq1->chroma_width; | |
86 | |
87 return mpi; | |
88 } | |
89 | |
8026
b465ba5897a3
usage of libmpeg2, liba52, mp3lib & svq1 can be disabled
arpi
parents:
7180
diff
changeset
|
90 #endif |