annotate libmpcodecs/ve_libdv.c @ 14841:a7cc851f72ad

Move native RealAudio 1.0 / 2.0 up in the list to prefer it over the binary codecs from Real and made the info line fit 80 characters. blessed by Roberto
author diego
date Sun, 27 Feb 2005 14:07:28 +0000
parents acf3241be19b
children 5723c4b2a2ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5577
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
1 // requires libdv-0.9.5 !!!
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
2 // (v0.9.0 is too old and has no encoding functionality exported!)
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
3
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
4 #include <stdio.h>
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
5 #include <stdlib.h>
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
6 #include <string.h>
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
7
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
8 #include "../config.h"
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
9 #include "../mp_msg.h"
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
10
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
11 #ifdef HAVE_LIBDV095
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
12
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
13 #include "codec-cfg.h"
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
14 #include "stream.h"
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
15 #include "demuxer.h"
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
16 #include "stheader.h"
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
17
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7557
diff changeset
18 #include "muxer.h"
5577
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
19
5607
1972c3475d93 mp_image.h and img_format.h moved to libmpcodecs
arpi
parents: 5577
diff changeset
20 #include "img_format.h"
1972c3475d93 mp_image.h and img_format.h moved to libmpcodecs
arpi
parents: 5577
diff changeset
21 #include "mp_image.h"
5577
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
22 #include "vf.h"
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
23
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
24 #include <libdv/dv.h>
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
25
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
26 #ifndef DV_WIDTH
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
27 #define DV_WIDTH 720
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
28 #define DV_PAL_HEIGHT 576
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
29 #define DV_NTSC_HEIGHT 480
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
30 #endif
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
31
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
32 struct vf_priv_s {
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7557
diff changeset
33 muxer_stream_t* mux;
5577
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
34 dv_encoder_t* enc;
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
35
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
36 };
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
37 #define mux_v (vf->priv->mux)
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
38
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
39 //===========================================================================//
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
40
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
41 static int config(struct vf_instance_s* vf,
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
42 int width, int height, int d_width, int d_height,
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
43 unsigned int flags, unsigned int outfmt){
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
44
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
45 if(width!=DV_WIDTH || (height!=DV_PAL_HEIGHT && height!=DV_NTSC_HEIGHT)){
11261
835822ce4bb1 -vop ---> -vf
diego
parents: 9014
diff changeset
46 mp_msg(MSGT_VFILTER,MSGL_ERR,"DV: only 720x480 (NTSC) and 720x576 (PAL) resolutions allowed! Try with -vf scale=720:480\n");
5577
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
47 }
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
48
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
49 vf->priv->enc->isPAL=(height==DV_PAL_HEIGHT);
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
50 vf->priv->enc->is16x9=(d_width/(float)d_height > 1.7); // 16:9=1.777777
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
51 vf->priv->enc->vlc_encode_passes=3;
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
52 vf->priv->enc->static_qno=0;
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
53 vf->priv->enc->force_dct=0;
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
54
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
55 mux_v->bih->biWidth=width;
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
56 mux_v->bih->biHeight=height;
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
57 mux_v->bih->biSizeImage=mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8);
12061
656a1b45b309 Use aspect from encoder for AVI vprp header
ranma
parents: 11811
diff changeset
58 mux_v->aspect = (float)d_width/d_height;
5577
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
59
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
60 return 1;
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
61 }
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
62
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
63 static int control(struct vf_instance_s* vf, int request, void* data){
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
64
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
65 return CONTROL_UNKNOWN;
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
66 }
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
67
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
68 static int query_format(struct vf_instance_s* vf, unsigned int fmt){
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
69 if(fmt==IMGFMT_YUY2) return 3;
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
70 if(fmt==IMGFMT_RGB24) return 1;
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
71 return 0;
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
72 }
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
73
7368
a894e99c1e51 changing return type of put_image void->int
arpi
parents: 7127
diff changeset
74 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
5577
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
75
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
76 dv_encode_full_frame(vf->priv->enc, mpi->planes,
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
77 (mpi->flags&MP_IMGFLAG_YUV) ? e_dv_color_yuv : e_dv_color_rgb,
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
78 mux_v->buffer);
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
79
9014
c671e9adbe22 Cleanup of the muxer API, func parameters muxer & muxer_f eliminated.
arpi
parents: 8585
diff changeset
80 muxer_write_chunk(mux_v, 480 * (vf->priv->enc->isPAL ? 300 : 250) , 0x10);
7368
a894e99c1e51 changing return type of put_image void->int
arpi
parents: 7127
diff changeset
81 return 1;
5577
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
82 }
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
83
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
84 //===========================================================================//
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
85
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
86 static int vf_open(vf_instance_t *vf, char* args){
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
87 vf->config=config;
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
88 vf->control=control;
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
89 vf->query_format=query_format;
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
90 vf->put_image=put_image;
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
91 vf->priv=malloc(sizeof(struct vf_priv_s));
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
92 memset(vf->priv,0,sizeof(struct vf_priv_s));
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7557
diff changeset
93 vf->priv->mux=(muxer_stream_t*)args;
5577
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
94
11811
30507afa1cf6 prevent the libdv decoder from adding "NTSC setup" on decode
attila
parents: 11261
diff changeset
95 vf->priv->enc=dv_encoder_new(0,1,1); // FIXME, parse some options!
5577
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
96 if(!vf->priv->enc) return 0;
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
97
14549
acf3241be19b Initialized BITMAPINFOHEADER to 0 to avoid problems, esp. windows has problems
reimar
parents: 12061
diff changeset
98 mux_v->bih=calloc(1, sizeof(BITMAPINFOHEADER));
5577
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
99 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER);
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
100 mux_v->bih->biWidth=0;
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
101 mux_v->bih->biHeight=0;
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
102 mux_v->bih->biCompression=mmioFOURCC('d','v','s','d');
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
103 mux_v->bih->biPlanes=1;
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
104 mux_v->bih->biBitCount=24;
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
105
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
106 return 1;
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
107 }
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
108
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
109 vf_info_t ve_info_libdv = {
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
110 "DV encoder using libdv",
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
111 "libdv",
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
112 "A'rpi",
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
113 "for internal use by mencoder",
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
114 vf_open
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
115 };
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
116
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
117 //===========================================================================//
80eedd3ef6d3 RGB24/YUY2 -> DV encoding, using libdv
arpi
parents:
diff changeset
118 #endif