annotate libmpcodecs/vd_libdv.c @ 30792:f89de69d4527

Clarify that ssh is not required for committing to MPlayer.
author diego
date Thu, 04 Mar 2010 15:53:56 +0000
parents b2829d4f2de4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30421
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
1 /*
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
2 * This file is part of MPlayer.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
3 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
5 * it under the terms of the GNU General Public License as published by
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
7 * (at your option) any later version.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
8 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
12 * GNU General Public License for more details.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
13 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
14 * You should have received a copy of the GNU General Public License along
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
17 */
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
18
6927
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
19 #include <stdio.h>
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
20 #include <stdlib.h>
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
21 #include <string.h>
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
22 #include <sys/types.h>
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
23 #include <unistd.h>
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
24 #include <math.h>
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
25
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
26 #include "config.h"
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
27
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
28 #include "img_format.h"
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
29
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
30 #include <libdv/dv.h>
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
31 #include <libdv/dv_types.h>
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
32
22599
4faee1254928 Add explicit location for headers from the stream/ directory.
diego
parents: 18771
diff changeset
33 #include "stream/stream.h"
22601
ed8f90096c65 Add explicit location for headers from the libmpdemux/ directory.
diego
parents: 22599
diff changeset
34 #include "libmpdemux/demuxer.h"
ed8f90096c65 Add explicit location for headers from the libmpdemux/ directory.
diego
parents: 22599
diff changeset
35 #include "libmpdemux/stheader.h"
6927
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
36
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
37 #include "vd_internal.h"
30553
b2829d4f2de4 Add header for init_global_rawdv_decoder() instead of forward declaring it.
diego
parents: 30504
diff changeset
38 #include "vd_libdv.h"
6927
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
39
30504
cc27da5d7286 Mark all ad_info_t/vd_info_t structure declarations as const.
diego
parents: 30421
diff changeset
40 static const vd_info_t info =
6927
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
41 {
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
42 "Raw DV Video Decoder",
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
43 "libdv",
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
44 "Alexander Neundorf <neundorf@kde.org>",
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
45 "http://libdv.sf.net",
7191
1eadce15446c -afm/-vfm help implemenetd, some cosmetics of ad/vd codec names/comments
arpi
parents: 7180
diff changeset
46 "native codec"
6927
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
47 };
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
48
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
49 LIBVD_EXTERN(libdv)
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
50
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
51 // to set/get/query special features/parameters
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
52 static int control(sh_video_t *sh,int cmd,void* arg,...){
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
53 return CONTROL_UNKNOWN;
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
54 }
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
55
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
56 static dv_decoder_t* global_rawdv_decoder=NULL;
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
57
22886
71b3e04d0555 "()" to "(void)" function param list fixes
uau
parents: 22601
diff changeset
58 dv_decoder_t* init_global_rawdv_decoder(void)
6927
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
59 {
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
60 if(!global_rawdv_decoder){
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
61 global_rawdv_decoder=dv_decoder_new(TRUE,TRUE,FALSE);
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
62 global_rawdv_decoder->quality=DV_QUALITY_BEST;
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
63 global_rawdv_decoder->prev_frame_decoded = 0;
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
64 }
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
65 return global_rawdv_decoder;
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
66 }
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
67
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
68 // init driver
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
69 static int init(sh_video_t *sh)
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
70 {
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
71 sh->context = (void *)init_global_rawdv_decoder();
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
72 return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2);
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
73 }
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
74
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
75 // uninit driver
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
76 static void uninit(sh_video_t *sh){
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
77 }
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
78
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
79 // decode a frame
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
80 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags)
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
81 {
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
82 mp_image_t* mpi;
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
83 dv_decoder_t *decoder=sh->context;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 22886
diff changeset
84
6927
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
85 if(len<=0 || (flags&3)){
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
86 // fprintf(stderr,"decode() (rawdv) SKIPPED\n");
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
87 return NULL; // skipped frame
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
88 }
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
89
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
90 dv_parse_header(decoder, data);
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
91
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
92 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, sh->disp_w, sh->disp_h);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 22886
diff changeset
93
6927
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
94 if(!mpi){ // temporary!
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
95 fprintf(stderr,"couldn't allocate image for stderr codec\n");
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
96 return NULL;
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
97 }
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
98
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
99 dv_decode_full_frame(decoder, data, e_dv_color_yuv, mpi->planes, mpi->stride);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 22886
diff changeset
100
6927
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
101 return mpi;
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents:
diff changeset
102 }