annotate libmpcodecs/vd_qtrpza.c @ 7202:b414c2e34b2e

removed buggy fd<0 check for disallowing dumpstream/cache
author arpi
date Sat, 31 Aug 2002 15:44:41 +0000
parents 28677d779205
children 75048549dc44
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4915
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
1 #include <stdio.h>
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
2 #include <stdlib.h>
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
3
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
4 #include "config.h"
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
5 #include "mp_msg.h"
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
6
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
7 #include "vd_internal.h"
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
8
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
9 static vd_info_t info = {
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
10 "Quicktime Apple Video",
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
11 "qtrpza",
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
12 "Roberto Togni",
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
13 "Roberto Togni",
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
14 "native codec"
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
15 };
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
16
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
17 LIBVD_EXTERN(qtrpza)
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
18
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
19 // to set/get/query special features/parameters
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
20 static int control(sh_video_t *sh,int cmd,void* arg,...){
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
21 return CONTROL_UNKNOWN;
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
22 }
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
23
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
24 // init driver
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
25 static int init(sh_video_t *sh){
5124
3dcbf67c0de0 handle error from mpcodecs_config_vo()
arpi
parents: 4986
diff changeset
26 return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_BGR16);
4915
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
27 }
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
28
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
29 // uninit driver
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
30 static void uninit(sh_video_t *sh){
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
31 }
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
32
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
33 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
34
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
35 void qt_decode_rpza(char *encoded, int encodec_size, char *decodec, int width, int height, int bytes_per_pixel);
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
36
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
37 // decode a frame
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
38 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
39 mp_image_t* mpi;
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
40 if(len<=0) return NULL; // skipped frame
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
41
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
42 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_PRESERVE, sh->disp_w, sh->disp_h);
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
43
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
44 if(!mpi){ // temporary!
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
45 printf("couldn't allocate image for qtrpza codec\n");
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
46 return NULL;
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
47 }
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
48
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
49 qt_decode_rpza(data, len, mpi->planes[0], sh->disp_w, sh->disp_h,
4948
869e5bff8dab optim :)
arpi
parents: 4915
diff changeset
50 mpi->bpp/8);
4915
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
51
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
52 return mpi;
f6990fad0ab3 Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff changeset
53 }