Mercurial > mplayer.hg
annotate libmpcodecs/ve_libdv.c @ 36794:138582cbff16
configure: Make the XShape extension optional.
The GUI compiles and runs without it.
Although some skins will look ugly,
there are skins that not even require the extension.
author | ib |
---|---|
date | Wed, 19 Feb 2014 16:58:41 +0000 |
parents | a86413775fbe |
children |
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 * requires libdv-0.9.5 !!! |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
3 * (v0.9.0 is too old and has no encoding functionality exported!) |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
4 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
5 * This file is part of MPlayer. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
6 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
7 * 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
|
8 * 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
|
9 * 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
|
10 * (at your option) any later version. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
11 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
12 * 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
|
13 * 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
|
14 * 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
|
15 * GNU General Public License for more details. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
16 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
17 * 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
|
18 * 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
|
19 * 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
|
20 */ |
5577 | 21 |
22 #include <stdio.h> | |
23 #include <stdlib.h> | |
24 #include <string.h> | |
25 | |
17012 | 26 #include "config.h" |
27 #include "mp_msg.h" | |
5577 | 28 |
29 #include "codec-cfg.h" | |
22600
3c2b4a866c6a
Add explicit location for headers from the stream/ directory.
diego
parents:
21660
diff
changeset
|
30 #include "stream/stream.h" |
22601
ed8f90096c65
Add explicit location for headers from the libmpdemux/ directory.
diego
parents:
22600
diff
changeset
|
31 #include "libmpdemux/demuxer.h" |
ed8f90096c65
Add explicit location for headers from the libmpdemux/ directory.
diego
parents:
22600
diff
changeset
|
32 #include "libmpdemux/stheader.h" |
5577 | 33 |
22600
3c2b4a866c6a
Add explicit location for headers from the stream/ directory.
diego
parents:
21660
diff
changeset
|
34 #include "stream/stream.h" |
22601
ed8f90096c65
Add explicit location for headers from the libmpdemux/ directory.
diego
parents:
22600
diff
changeset
|
35 #include "libmpdemux/muxer.h" |
5577 | 36 |
5607 | 37 #include "img_format.h" |
38 #include "mp_image.h" | |
5577 | 39 #include "vf.h" |
40 | |
41 #include <libdv/dv.h> | |
42 | |
43 #ifndef DV_WIDTH | |
44 #define DV_WIDTH 720 | |
45 #define DV_PAL_HEIGHT 576 | |
46 #define DV_NTSC_HEIGHT 480 | |
47 #endif | |
48 | |
49 struct vf_priv_s { | |
8585 | 50 muxer_stream_t* mux; |
5577 | 51 dv_encoder_t* enc; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
22601
diff
changeset
|
52 |
5577 | 53 }; |
54 #define mux_v (vf->priv->mux) | |
55 | |
56 //===========================================================================// | |
57 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30421
diff
changeset
|
58 static int config(struct vf_instance *vf, |
5577 | 59 int width, int height, int d_width, int d_height, |
60 unsigned int flags, unsigned int outfmt){ | |
61 | |
62 if(width!=DV_WIDTH || (height!=DV_PAL_HEIGHT && height!=DV_NTSC_HEIGHT)){ | |
11261 | 63 mp_msg(MSGT_VFILTER,MSGL_ERR,"DV: only 720x480 (NTSC) and 720x576 (PAL) resolutions allowed! Try with -vf scale=720:480\n"); |
5577 | 64 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
22601
diff
changeset
|
65 |
5577 | 66 vf->priv->enc->isPAL=(height==DV_PAL_HEIGHT); |
67 vf->priv->enc->is16x9=(d_width/(float)d_height > 1.7); // 16:9=1.777777 | |
68 vf->priv->enc->vlc_encode_passes=3; | |
69 vf->priv->enc->static_qno=0; | |
70 vf->priv->enc->force_dct=0; | |
71 | |
72 mux_v->bih->biWidth=width; | |
73 mux_v->bih->biHeight=height; | |
74 mux_v->bih->biSizeImage=mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8); | |
12061 | 75 mux_v->aspect = (float)d_width/d_height; |
5577 | 76 |
77 return 1; | |
78 } | |
79 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30421
diff
changeset
|
80 static int control(struct vf_instance *vf, int request, void* data){ |
5577 | 81 |
82 return CONTROL_UNKNOWN; | |
83 } | |
84 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30421
diff
changeset
|
85 static int query_format(struct vf_instance *vf, unsigned int fmt){ |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
14878
diff
changeset
|
86 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
|
87 if(fmt==IMGFMT_RGB24) return VFCAP_CSP_SUPPORTED; |
5577 | 88 return 0; |
89 } | |
90 | |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30421
diff
changeset
|
91 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ |
5577 | 92 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
22601
diff
changeset
|
93 dv_encode_full_frame(vf->priv->enc, mpi->planes, |
5577 | 94 (mpi->flags&MP_IMGFLAG_YUV) ? e_dv_color_yuv : e_dv_color_rgb, |
95 mux_v->buffer); | |
96 | |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17487
diff
changeset
|
97 muxer_write_chunk(mux_v, 480 * (vf->priv->enc->isPAL ? 300 : 250) , 0x10, pts, pts); |
7368 | 98 return 1; |
5577 | 99 } |
100 | |
101 //===========================================================================// | |
102 | |
103 static int vf_open(vf_instance_t *vf, char* args){ | |
104 vf->config=config; | |
14878 | 105 vf->default_caps=VFCAP_CONSTANT; |
5577 | 106 vf->control=control; |
107 vf->query_format=query_format; | |
108 vf->put_image=put_image; | |
109 vf->priv=malloc(sizeof(struct vf_priv_s)); | |
110 memset(vf->priv,0,sizeof(struct vf_priv_s)); | |
8585 | 111 vf->priv->mux=(muxer_stream_t*)args; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
22601
diff
changeset
|
112 |
11811
30507afa1cf6
prevent the libdv decoder from adding "NTSC setup" on decode
attila
parents:
11261
diff
changeset
|
113 vf->priv->enc=dv_encoder_new(0,1,1); // FIXME, parse some options! |
5577 | 114 if(!vf->priv->enc) return 0; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
22601
diff
changeset
|
115 |
32123 | 116 mux_v->bih=calloc(1, sizeof(*mux_v->bih)); |
117 mux_v->bih->biSize=sizeof(*mux_v->bih); | |
5577 | 118 mux_v->bih->biWidth=0; |
119 mux_v->bih->biHeight=0; | |
120 mux_v->bih->biCompression=mmioFOURCC('d','v','s','d'); | |
121 mux_v->bih->biPlanes=1; | |
122 mux_v->bih->biBitCount=24; | |
123 | |
124 return 1; | |
125 } | |
126 | |
32033 | 127 const vf_info_t ve_info_libdv = { |
5577 | 128 "DV encoder using libdv", |
129 "libdv", | |
130 "A'rpi", | |
131 "for internal use by mencoder", | |
132 vf_open | |
133 }; | |
134 | |
135 //===========================================================================// |