annotate libmpcodecs/vf_lavc.c @ 34191:47e1375c4d79

Whitespace cosmetics: Align some IMGFMT-lists.
author cehoyos
date Sun, 30 Oct 2011 18:00:25 +0000
parents 30f5e5cd3676
children 220497708307
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
5873
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
19 #include <stdio.h>
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
20 #include <stdlib.h>
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
21 #include <string.h>
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
22 #include <inttypes.h>
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
23
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 15843
diff changeset
24 #include "config.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 15843
diff changeset
25 #include "mp_msg.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 15843
diff changeset
26 #include "help_mp.h"
5873
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
27
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
28 #include "img_format.h"
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
29 #include "mp_image.h"
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
30 #include "vf.h"
33871
30f5e5cd3676 Move code for setting up libav* logging callbacks from vd_ffmpeg to a
reimar
parents: 32537
diff changeset
31 #include "av_helpers.h"
5873
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
32 #include "libavcodec/avcodec.h"
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
33
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
34
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
35 struct vf_priv_s {
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
36 unsigned char* outbuf;
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
37 int outbuf_size;
7852
e4f87bbf682c - using avcodec_alloc_context()
arpi
parents: 7368
diff changeset
38 AVCodecContext* context;
8413
2670aec42989 AVVideoFrame -> AVFrame
michael
parents: 8340
diff changeset
39 AVFrame* pic;
7852
e4f87bbf682c - using avcodec_alloc_context()
arpi
parents: 7368
diff changeset
40 AVCodec* codec;
5873
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
41 vo_mpegpes_t pes;
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
42 };
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
43
7852
e4f87bbf682c - using avcodec_alloc_context()
arpi
parents: 7368
diff changeset
44 #define lavc_venc_context (*vf->priv->context)
5873
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
45
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
46 //===========================================================================//
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
47
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
48 static int config(struct vf_instance *vf,
5873
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
49 int width, int height, int d_width, int d_height,
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
50 unsigned int flags, unsigned int outfmt){
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
51 if(vf_next_query_format(vf,IMGFMT_MPEGPES)<=0) return 0;
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
52
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
53 lavc_venc_context.width = width;
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
54 lavc_venc_context.height = height;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26754
diff changeset
55
15843
77a5b8ef3314 restored framerate autodetection based on height
nicodvb
parents: 15349
diff changeset
56 if(!lavc_venc_context.time_base.num || !lavc_venc_context.time_base.den){
6019
5c3b0b165f3a FPS autodetection, accept args: quality:fps
arpi
parents: 5876
diff changeset
57 // guess FPS:
5c3b0b165f3a FPS autodetection, accept args: quality:fps
arpi
parents: 5876
diff changeset
58 switch(height){
5c3b0b165f3a FPS autodetection, accept args: quality:fps
arpi
parents: 5876
diff changeset
59 case 240:
5c3b0b165f3a FPS autodetection, accept args: quality:fps
arpi
parents: 5876
diff changeset
60 case 480:
15307
58bd9c33864c LIBAVCODEC_BUILD >= 4754
michael
parents: 11419
diff changeset
61 lavc_venc_context.time_base= (AVRational){1001,30000};
6019
5c3b0b165f3a FPS autodetection, accept args: quality:fps
arpi
parents: 5876
diff changeset
62 break;
5c3b0b165f3a FPS autodetection, accept args: quality:fps
arpi
parents: 5876
diff changeset
63 case 576:
5c3b0b165f3a FPS autodetection, accept args: quality:fps
arpi
parents: 5876
diff changeset
64 case 288:
5c3b0b165f3a FPS autodetection, accept args: quality:fps
arpi
parents: 5876
diff changeset
65 default:
15307
58bd9c33864c LIBAVCODEC_BUILD >= 4754
michael
parents: 11419
diff changeset
66 lavc_venc_context.time_base= (AVRational){1,25};
6019
5c3b0b165f3a FPS autodetection, accept args: quality:fps
arpi
parents: 5876
diff changeset
67 break;
5c3b0b165f3a FPS autodetection, accept args: quality:fps
arpi
parents: 5876
diff changeset
68 // lavc_venc_context.frame_rate=vo_fps*FRAME_RATE_BASE; // same as src
5c3b0b165f3a FPS autodetection, accept args: quality:fps
arpi
parents: 5876
diff changeset
69 }
5c3b0b165f3a FPS autodetection, accept args: quality:fps
arpi
parents: 5876
diff changeset
70 }
5873
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
71
32537
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 31959
diff changeset
72 free(vf->priv->outbuf);
5873
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
73
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
74 vf->priv->outbuf_size=10000+width*height; // must be enough!
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
75 vf->priv->outbuf = malloc(vf->priv->outbuf_size);
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
76
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
77 if (avcodec_open(&lavc_venc_context, vf->priv->codec) != 0) {
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
78 mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_CantOpenCodec);
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
79 return 0;
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
80 }
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
81
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
82 if (lavc_venc_context.codec->encode == NULL) {
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
83 mp_msg(MSGT_MENCODER,MSGL_ERR,"avcodec init failed (ctx->codec->encode == NULL)!\n");
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
84 return 0;
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
85 }
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
86
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
87 return vf_next_config(vf,width,height,d_width,d_height,flags,IMGFMT_MPEGPES);
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
88 }
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
89
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
90 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
5873
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
91 mp_image_t* dmpi;
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
92 int out_size;
8413
2670aec42989 AVVideoFrame -> AVFrame
michael
parents: 8340
diff changeset
93 AVFrame *pic= vf->priv->pic;
5873
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
94
8339
ff0bddb59e81 support for lavc build 4641
michael
parents: 7852
diff changeset
95 pic->data[0]=mpi->planes[0];
ff0bddb59e81 support for lavc build 4641
michael
parents: 7852
diff changeset
96 pic->data[1]=mpi->planes[1];
ff0bddb59e81 support for lavc build 4641
michael
parents: 7852
diff changeset
97 pic->data[2]=mpi->planes[2];
ff0bddb59e81 support for lavc build 4641
michael
parents: 7852
diff changeset
98 pic->linesize[0]=mpi->stride[0];
ff0bddb59e81 support for lavc build 4641
michael
parents: 7852
diff changeset
99 pic->linesize[1]=mpi->stride[1];
ff0bddb59e81 support for lavc build 4641
michael
parents: 7852
diff changeset
100 pic->linesize[2]=mpi->stride[2];
5873
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
101
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26754
diff changeset
102 out_size = avcodec_encode_video(&lavc_venc_context,
8339
ff0bddb59e81 support for lavc build 4641
michael
parents: 7852
diff changeset
103 vf->priv->outbuf, vf->priv->outbuf_size, pic);
5873
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
104
7368
a894e99c1e51 changing return type of put_image void->int
arpi
parents: 7127
diff changeset
105 if(out_size<=0) return 1;
5873
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
106
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
107 dmpi=vf_get_image(vf->next,IMGFMT_MPEGPES,
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
108 MP_IMGTYPE_EXPORT, 0,
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
109 mpi->w, mpi->h);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26754
diff changeset
110
5873
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
111 vf->priv->pes.data=vf->priv->outbuf;
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
112 vf->priv->pes.size=out_size;
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
113 vf->priv->pes.id=0x1E0;
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
114 vf->priv->pes.timestamp=-1; // dunno
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26754
diff changeset
115
7127
1e47c2e7aa8e mostly compiler warning fixes, some small bugfix
arpi
parents: 7004
diff changeset
116 dmpi->planes[0]=(unsigned char*)&vf->priv->pes;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26754
diff changeset
117
17906
20aca9baf5d8 passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents: 17523
diff changeset
118 return vf_next_put_image(vf,dmpi, MP_NOPTS_VALUE);
5873
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
119 }
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
120
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
121 //===========================================================================//
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
122
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
123 static int query_format(struct vf_instance *vf, unsigned int fmt){
5873
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
124 switch(fmt){
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
125 case IMGFMT_YV12:
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
126 case IMGFMT_I420:
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
127 case IMGFMT_IYUV:
26754
63630c09e237 cosmetics: Remove pointless parentheses from return calls.
diego
parents: 26069
diff changeset
128 return vf_next_query_format(vf, IMGFMT_MPEGPES) & (~(VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_ACCEPT_STRIDE));
5873
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
129 }
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
130 return 0;
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
131 }
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
132
30638
a7b908875c14 Rename open() vf initialization function to vf_open().
diego
parents: 30421
diff changeset
133 static int vf_open(vf_instance_t *vf, char *args){
6019
5c3b0b165f3a FPS autodetection, accept args: quality:fps
arpi
parents: 5876
diff changeset
134 int p_quality=0;
5c3b0b165f3a FPS autodetection, accept args: quality:fps
arpi
parents: 5876
diff changeset
135 float p_fps=0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26754
diff changeset
136
5873
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
137 vf->config=config;
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
138 vf->put_image=put_image;
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
139 vf->query_format=query_format;
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
140 vf->priv=malloc(sizeof(struct vf_priv_s));
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
141 memset(vf->priv,0,sizeof(struct vf_priv_s));
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
142
31959
f957f330aa6d Introduce init_avcodec function to avoid duplicated FFmpeg initializations.
diego
parents: 30642
diff changeset
143 init_avcodec();
5873
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
144
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
145 vf->priv->codec = (AVCodec *)avcodec_find_encoder_by_name("mpeg1video");
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
146 if (!vf->priv->codec) {
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
147 mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_MissingLAVCcodec, "mpeg1video");
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
148 return 0;
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
149 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26754
diff changeset
150
7852
e4f87bbf682c - using avcodec_alloc_context()
arpi
parents: 7368
diff changeset
151 vf->priv->context=avcodec_alloc_context();
8413
2670aec42989 AVVideoFrame -> AVFrame
michael
parents: 8340
diff changeset
152 vf->priv->pic = avcodec_alloc_frame();
5873
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
153
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
154 // TODO: parse args ->
6019
5c3b0b165f3a FPS autodetection, accept args: quality:fps
arpi
parents: 5876
diff changeset
155 if(args) sscanf(args, "%d:%f", &p_quality, &p_fps);
5c3b0b165f3a FPS autodetection, accept args: quality:fps
arpi
parents: 5876
diff changeset
156
5c3b0b165f3a FPS autodetection, accept args: quality:fps
arpi
parents: 5876
diff changeset
157 if(p_quality<32){
5c3b0b165f3a FPS autodetection, accept args: quality:fps
arpi
parents: 5876
diff changeset
158 // fixed qscale
5c3b0b165f3a FPS autodetection, accept args: quality:fps
arpi
parents: 5876
diff changeset
159 lavc_venc_context.flags = CODEC_FLAG_QSCALE;
11257
837bca3ae69f constant qscale was broken due to libavcodec changes, fix taken from ve_lavc.c
ranma
parents: 11000
diff changeset
160 lavc_venc_context.global_quality =
837bca3ae69f constant qscale was broken due to libavcodec changes, fix taken from ve_lavc.c
ranma
parents: 11000
diff changeset
161 vf->priv->pic->quality = (int)(FF_QP2LAMBDA * ((p_quality<1) ? 1 : p_quality) + 0.5);
6019
5c3b0b165f3a FPS autodetection, accept args: quality:fps
arpi
parents: 5876
diff changeset
162 } else {
5c3b0b165f3a FPS autodetection, accept args: quality:fps
arpi
parents: 5876
diff changeset
163 // fixed bitrate (in kbits)
5c3b0b165f3a FPS autodetection, accept args: quality:fps
arpi
parents: 5876
diff changeset
164 lavc_venc_context.bit_rate = 1000*p_quality;
5c3b0b165f3a FPS autodetection, accept args: quality:fps
arpi
parents: 5876
diff changeset
165 }
15307
58bd9c33864c LIBAVCODEC_BUILD >= 4754
michael
parents: 11419
diff changeset
166 lavc_venc_context.time_base.num = 1000*1001;
17906
20aca9baf5d8 passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents: 17523
diff changeset
167 lavc_venc_context.time_base.den = (p_fps<1.0) ? 1000*1001*25 : (p_fps * lavc_venc_context.time_base.num);
5873
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
168 lavc_venc_context.gop_size = 0; // I-only
15349
d73a6d42a27f set pix_fmt
michael
parents: 15307
diff changeset
169 lavc_venc_context.pix_fmt= PIX_FMT_YUV420P;
5873
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
170
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
171 return 1;
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
172 }
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
173
25221
00fff9a3b735 Make all vf_info_t structs const
reimar
parents: 23373
diff changeset
174 const vf_info_t vf_info_lavc = {
5873
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
175 "realtime mpeg1 encoding with libavcodec",
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
176 "lavc",
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
177 "A'rpi",
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
178 "",
30638
a7b908875c14 Rename open() vf initialization function to vf_open().
diego
parents: 30421
diff changeset
179 vf_open,
9593
e9a2af584986 Add the new -vf option wich is the same as vop in reverse order.
albeu
parents: 9577
diff changeset
180 NULL
5873
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
181 };
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
182
74cbaabeaa33 realtime yv12->mpeg1 with libavcodec qscale=1
arpi
parents:
diff changeset
183 //===========================================================================//