Mercurial > mplayer.hg
annotate libmpcodecs/ve_libdv.c @ 20531:bc7c04eaf71e
Cygwin linking fix.
author | diego |
---|---|
date | Mon, 30 Oct 2006 23:47:42 +0000 |
parents | a1807995e2ab |
children | ca9da45d13e9 |
rev | line source |
---|---|
5577 | 1 // requires libdv-0.9.5 !!! |
2 // (v0.9.0 is too old and has no encoding functionality exported!) | |
3 | |
4 #include <stdio.h> | |
5 #include <stdlib.h> | |
6 #include <string.h> | |
7 | |
17012 | 8 #include "config.h" |
9 #include "mp_msg.h" | |
5577 | 10 |
11 #include "codec-cfg.h" | |
12 #include "stream.h" | |
13 #include "demuxer.h" | |
14 #include "stheader.h" | |
15 | |
8585 | 16 #include "muxer.h" |
5577 | 17 |
5607 | 18 #include "img_format.h" |
19 #include "mp_image.h" | |
5577 | 20 #include "vf.h" |
21 | |
22 #include <libdv/dv.h> | |
23 | |
24 #ifndef DV_WIDTH | |
25 #define DV_WIDTH 720 | |
26 #define DV_PAL_HEIGHT 576 | |
27 #define DV_NTSC_HEIGHT 480 | |
28 #endif | |
29 | |
30 struct vf_priv_s { | |
8585 | 31 muxer_stream_t* mux; |
5577 | 32 dv_encoder_t* enc; |
33 | |
34 }; | |
35 #define mux_v (vf->priv->mux) | |
36 | |
37 //===========================================================================// | |
38 | |
39 static int config(struct vf_instance_s* vf, | |
40 int width, int height, int d_width, int d_height, | |
41 unsigned int flags, unsigned int outfmt){ | |
42 | |
43 if(width!=DV_WIDTH || (height!=DV_PAL_HEIGHT && height!=DV_NTSC_HEIGHT)){ | |
11261 | 44 mp_msg(MSGT_VFILTER,MSGL_ERR,"DV: only 720x480 (NTSC) and 720x576 (PAL) resolutions allowed! Try with -vf scale=720:480\n"); |
5577 | 45 } |
46 | |
47 vf->priv->enc->isPAL=(height==DV_PAL_HEIGHT); | |
48 vf->priv->enc->is16x9=(d_width/(float)d_height > 1.7); // 16:9=1.777777 | |
49 vf->priv->enc->vlc_encode_passes=3; | |
50 vf->priv->enc->static_qno=0; | |
51 vf->priv->enc->force_dct=0; | |
52 | |
53 mux_v->bih->biWidth=width; | |
54 mux_v->bih->biHeight=height; | |
55 mux_v->bih->biSizeImage=mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8); | |
12061 | 56 mux_v->aspect = (float)d_width/d_height; |
5577 | 57 |
58 return 1; | |
59 } | |
60 | |
61 static int control(struct vf_instance_s* vf, int request, void* data){ | |
62 | |
63 return CONTROL_UNKNOWN; | |
64 } | |
65 | |
66 static int query_format(struct vf_instance_s* vf, unsigned int fmt){ | |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
14878
diff
changeset
|
67 if(fmt==IMGFMT_YUY2) return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW; |
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
14878
diff
changeset
|
68 if(fmt==IMGFMT_RGB24) return VFCAP_CSP_SUPPORTED; |
5577 | 69 return 0; |
70 } | |
71 | |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17487
diff
changeset
|
72 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){ |
5577 | 73 |
74 dv_encode_full_frame(vf->priv->enc, mpi->planes, | |
75 (mpi->flags&MP_IMGFLAG_YUV) ? e_dv_color_yuv : e_dv_color_rgb, | |
76 mux_v->buffer); | |
77 | |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17487
diff
changeset
|
78 muxer_write_chunk(mux_v, 480 * (vf->priv->enc->isPAL ? 300 : 250) , 0x10, pts, pts); |
7368 | 79 return 1; |
5577 | 80 } |
81 | |
82 //===========================================================================// | |
83 | |
84 static int vf_open(vf_instance_t *vf, char* args){ | |
85 vf->config=config; | |
14878 | 86 vf->default_caps=VFCAP_CONSTANT; |
5577 | 87 vf->control=control; |
88 vf->query_format=query_format; | |
89 vf->put_image=put_image; | |
90 vf->priv=malloc(sizeof(struct vf_priv_s)); | |
91 memset(vf->priv,0,sizeof(struct vf_priv_s)); | |
8585 | 92 vf->priv->mux=(muxer_stream_t*)args; |
5577 | 93 |
11811
30507afa1cf6
prevent the libdv decoder from adding "NTSC setup" on decode
attila
parents:
11261
diff
changeset
|
94 vf->priv->enc=dv_encoder_new(0,1,1); // FIXME, parse some options! |
5577 | 95 if(!vf->priv->enc) return 0; |
96 | |
14549
acf3241be19b
Initialized BITMAPINFOHEADER to 0 to avoid problems, esp. windows has problems
reimar
parents:
12061
diff
changeset
|
97 mux_v->bih=calloc(1, sizeof(BITMAPINFOHEADER)); |
5577 | 98 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER); |
99 mux_v->bih->biWidth=0; | |
100 mux_v->bih->biHeight=0; | |
101 mux_v->bih->biCompression=mmioFOURCC('d','v','s','d'); | |
102 mux_v->bih->biPlanes=1; | |
103 mux_v->bih->biBitCount=24; | |
104 | |
105 return 1; | |
106 } | |
107 | |
108 vf_info_t ve_info_libdv = { | |
109 "DV encoder using libdv", | |
110 "libdv", | |
111 "A'rpi", | |
112 "for internal use by mencoder", | |
113 vf_open | |
114 }; | |
115 | |
116 //===========================================================================// |