Mercurial > mplayer.hg
annotate libmpcodecs/ve_x264.c @ 21325:963e85e82154
Change "p" asm constraints to "g", since "p" was a no longer necessary hack to
make AMD64 compilation work and ICC can not handle "p".
author | reimar |
---|---|
date | Mon, 27 Nov 2006 21:59:13 +0000 |
parents | 9d88396480bb |
children | a90aa203186c |
rev | line source |
---|---|
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
1 /***************************************************************************** |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
2 * |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
3 * - H.264 encoder for mencoder using x264 - |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
4 * |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
5 * Copyright (C) 2004 LINUX4MEDIA GmbH |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
6 * Copyright (C) 2004 Ark Linux |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
7 * |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
8 * Written by Bernhard Rosenkraenzer <bero@arklinux.org> |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
9 * |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
10 * This program is free software; you can redistribute it and/or modify |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
11 * it under the terms of the GNU General Public License version 2 as |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
12 * published by the Free Software Foundation, or if, and only if, |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
13 * version 2 is ruled invalid in a court of law, any later version |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
14 * of the GNU General Public License published by the Free Software |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
15 * Foundation. |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
16 * |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
17 * This program is distributed in the hope that it will be useful, |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
19 * MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
20 * GNU General Public License for more details. |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
21 * |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
22 * You should have received a copy of the GNU General Public License |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
23 * along with this program; if not, write to the Free Software |
19614 | 24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
25 * |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
26 *****************************************************************************/ |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
27 |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
28 #include <stdio.h> |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
29 #include <stdlib.h> |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
30 #include <string.h> |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
31 #include <errno.h> |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
32 |
17012 | 33 #include "config.h" |
34 #include "mp_msg.h" | |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
35 |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
36 #include "m_option.h" |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
37 #include "codec-cfg.h" |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
38 #include "stream.h" |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
39 #include "demuxer.h" |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
40 #include "stheader.h" |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
41 |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
42 #include "muxer.h" |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
43 |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
44 #include "img_format.h" |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
45 #include "mp_image.h" |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
46 #include "vf.h" |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
47 |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
48 #include <x264.h> |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
49 |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
50 typedef struct _h264_module_t { |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
51 muxer_stream_t *mux; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
52 x264_t * x264; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
53 x264_picture_t pic; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
54 } h264_module_t; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
55 |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
56 extern char* passtmpfile; |
15964
d244178a3105
x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents:
15744
diff
changeset
|
57 static int turbo = 0; |
20252
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
58 static x264_param_t param; |
20317 | 59 static int parse_error = 0; |
16366
e054a3c93a26
custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents:
16016
diff
changeset
|
60 |
19577
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
61 static int encode_nals(uint8_t *buf, int size, x264_nal_t *nals, int nnal){ |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
62 uint8_t *p = buf; |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
63 int i; |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
64 |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
65 for(i = 0; i < nnal; i++){ |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
66 int s = x264_nal_encode(p, &size, 1, nals + i); |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
67 if(s < 0) |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
68 return -1; |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
69 p += s; |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
70 } |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
71 |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
72 return p - buf; |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
73 } |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
74 |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17902
diff
changeset
|
75 static int put_image(struct vf_instance_s *vf, mp_image_t *mpi, double pts); |
14784
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
76 static int encode_frame(struct vf_instance_s *vf, x264_picture_t *pic_in); |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
77 |
20317 | 78 void x264enc_set_param(m_option_t* opt, char* arg) |
20252
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
79 { |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
80 static int initted = 0; |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
81 if(!initted) { |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
82 x264_param_default(¶m); |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
83 x264_param_parse(¶m, "psnr", "no"); |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
84 x264_param_parse(¶m, "ssim", "no"); |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
85 initted = 1; |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
86 } |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
87 |
20252
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
88 while(*arg) { |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
89 char *name = arg; |
20054
8760c8681eac
Remove the x264 option parser, and pass the options on to libx264 as a string instead. This provides automatic support for all current and future x264 options.
lorenm
parents:
19623
diff
changeset
|
90 char *value; |
8760c8681eac
Remove the x264 option parser, and pass the options on to libx264 as a string instead. This provides automatic support for all current and future x264 options.
lorenm
parents:
19623
diff
changeset
|
91 int ret; |
8760c8681eac
Remove the x264 option parser, and pass the options on to libx264 as a string instead. This provides automatic support for all current and future x264 options.
lorenm
parents:
19623
diff
changeset
|
92 |
20252
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
93 arg += strcspn(arg, ":"); |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
94 if(*arg) { |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
95 *arg = 0; |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
96 arg++; |
20054
8760c8681eac
Remove the x264 option parser, and pass the options on to libx264 as a string instead. This provides automatic support for all current and future x264 options.
lorenm
parents:
19623
diff
changeset
|
97 } |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
98 |
20054
8760c8681eac
Remove the x264 option parser, and pass the options on to libx264 as a string instead. This provides automatic support for all current and future x264 options.
lorenm
parents:
19623
diff
changeset
|
99 value = strchr( name, '=' ); |
8760c8681eac
Remove the x264 option parser, and pass the options on to libx264 as a string instead. This provides automatic support for all current and future x264 options.
lorenm
parents:
19623
diff
changeset
|
100 if(value) { |
8760c8681eac
Remove the x264 option parser, and pass the options on to libx264 as a string instead. This provides automatic support for all current and future x264 options.
lorenm
parents:
19623
diff
changeset
|
101 *value = 0; |
8760c8681eac
Remove the x264 option parser, and pass the options on to libx264 as a string instead. This provides automatic support for all current and future x264 options.
lorenm
parents:
19623
diff
changeset
|
102 value++; |
16366
e054a3c93a26
custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents:
16016
diff
changeset
|
103 } |
20054
8760c8681eac
Remove the x264 option parser, and pass the options on to libx264 as a string instead. This provides automatic support for all current and future x264 options.
lorenm
parents:
19623
diff
changeset
|
104 |
8760c8681eac
Remove the x264 option parser, and pass the options on to libx264 as a string instead. This provides automatic support for all current and future x264 options.
lorenm
parents:
19623
diff
changeset
|
105 if(!strcmp(name, "turbo")) { |
8760c8681eac
Remove the x264 option parser, and pass the options on to libx264 as a string instead. This provides automatic support for all current and future x264 options.
lorenm
parents:
19623
diff
changeset
|
106 turbo = value ? atoi(value) : 1; |
8760c8681eac
Remove the x264 option parser, and pass the options on to libx264 as a string instead. This provides automatic support for all current and future x264 options.
lorenm
parents:
19623
diff
changeset
|
107 continue; |
8760c8681eac
Remove the x264 option parser, and pass the options on to libx264 as a string instead. This provides automatic support for all current and future x264 options.
lorenm
parents:
19623
diff
changeset
|
108 } |
8760c8681eac
Remove the x264 option parser, and pass the options on to libx264 as a string instead. This provides automatic support for all current and future x264 options.
lorenm
parents:
19623
diff
changeset
|
109 |
20252
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
110 ret = x264_param_parse(¶m, name, value); |
20054
8760c8681eac
Remove the x264 option parser, and pass the options on to libx264 as a string instead. This provides automatic support for all current and future x264 options.
lorenm
parents:
19623
diff
changeset
|
111 if(ret == X264_PARAM_BAD_NAME) |
8760c8681eac
Remove the x264 option parser, and pass the options on to libx264 as a string instead. This provides automatic support for all current and future x264 options.
lorenm
parents:
19623
diff
changeset
|
112 mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Option x264encopts: Unknown suboption %s\n", name); |
8760c8681eac
Remove the x264 option parser, and pass the options on to libx264 as a string instead. This provides automatic support for all current and future x264 options.
lorenm
parents:
19623
diff
changeset
|
113 if(ret == X264_PARAM_BAD_VALUE) |
8760c8681eac
Remove the x264 option parser, and pass the options on to libx264 as a string instead. This provides automatic support for all current and future x264 options.
lorenm
parents:
19623
diff
changeset
|
114 mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Option x264encopts: Bad argument %s=%s\n", name, value ? value : "(null)"); |
20252
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
115 |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
116 /* mark this option as done, so it's not reparsed if there's another -x264encopts */ |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
117 *name = 0; |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
118 |
20317 | 119 parse_error |= ret; |
16366
e054a3c93a26
custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents:
16016
diff
changeset
|
120 } |
e054a3c93a26
custom quantization matrix for x264, original patch by Robert Swain < robert POUM swain AH gmail POUM com>
gpoirier
parents:
16016
diff
changeset
|
121 |
20340
9d88396480bb
x264: don't enable turbo in the middle pass of a 3pass encode. (broke in r20060)
lorenm
parents:
20333
diff
changeset
|
122 if(param.rc.b_stat_write && !param.rc.b_stat_read) { |
15964
d244178a3105
x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents:
15744
diff
changeset
|
123 /* Adjust or disable some flags to gain speed in the first pass */ |
d244178a3105
x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents:
15744
diff
changeset
|
124 if(turbo == 1) |
d244178a3105
x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents:
15744
diff
changeset
|
125 { |
20252
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
126 param.i_frame_reference = ( param.i_frame_reference + 1 ) >> 1; |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
127 param.analyse.i_subpel_refine = max( min( 3, param.analyse.i_subpel_refine - 1 ), 1 ); |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
128 param.analyse.inter &= ( ~X264_ANALYSE_PSUB8x8 ); |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
129 param.analyse.inter &= ( ~X264_ANALYSE_BSUB16x16 ); |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
130 param.analyse.i_trellis = 0; |
15964
d244178a3105
x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents:
15744
diff
changeset
|
131 } |
20054
8760c8681eac
Remove the x264 option parser, and pass the options on to libx264 as a string instead. This provides automatic support for all current and future x264 options.
lorenm
parents:
19623
diff
changeset
|
132 else if(turbo >= 2) |
15964
d244178a3105
x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents:
15744
diff
changeset
|
133 { |
20252
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
134 param.i_frame_reference = 1; |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
135 param.analyse.i_subpel_refine = 1; |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
136 param.analyse.i_me_method = X264_ME_DIA; |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
137 param.analyse.inter = 0; |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
138 param.analyse.b_transform_8x8 = 0; |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
139 param.analyse.b_weighted_bipred = 0; |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
140 param.analyse.i_trellis = 0; |
15964
d244178a3105
x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents:
15744
diff
changeset
|
141 } |
d244178a3105
x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents:
15744
diff
changeset
|
142 } |
20252
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
143 } |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
144 |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
145 static int config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt) { |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
146 h264_module_t *mod=(h264_module_t*)vf->priv; |
20317 | 147 |
148 if(parse_error) | |
149 return 0; | |
150 | |
20252
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
151 mod->mux->bih->biWidth = width; |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
152 mod->mux->bih->biHeight = height; |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
153 mod->mux->aspect = (float)d_width/d_height; |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
154 |
20333
7f84082900a3
Add a call to x264enc_set_param in config, otherwise mencoder -ovc x264
reimar
parents:
20317
diff
changeset
|
155 // make sure param is initialized |
7f84082900a3
Add a call to x264enc_set_param in config, otherwise mencoder -ovc x264
reimar
parents:
20317
diff
changeset
|
156 x264enc_set_param(NULL, ""); |
20252
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
157 param.i_width = width; |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
158 param.i_height = height; |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
159 param.i_fps_num = mod->mux->h.dwRate; |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
160 param.i_fps_den = mod->mux->h.dwScale; |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
161 param.vui.i_sar_width = d_width*height; |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
162 param.vui.i_sar_height = d_height*width; |
15964
d244178a3105
x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
gpoirier
parents:
15744
diff
changeset
|
163 |
20297
b69c85b29cb5
make -passlogfile work with x264 again (broke in r20060)
lorenm
parents:
20252
diff
changeset
|
164 x264_param_parse(¶m, "stats", passtmpfile); |
b69c85b29cb5
make -passlogfile work with x264 again (broke in r20060)
lorenm
parents:
20252
diff
changeset
|
165 |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
166 switch(outfmt) { |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
167 case IMGFMT_I420: |
20252
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
168 param.i_csp = X264_CSP_I420; |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
169 mod->mux->bih->biSizeImage = width * height * 3; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
170 break; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
171 case IMGFMT_YV12: |
20252
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
172 param.i_csp = X264_CSP_YV12; |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
173 mod->mux->bih->biSizeImage = width * height * 3; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
174 break; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
175 case IMGFMT_422P: |
20252
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
176 param.i_csp = X264_CSP_I422; |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
177 mod->mux->bih->biSizeImage = width * height * 3; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
178 break; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
179 case IMGFMT_444P: |
20252
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
180 param.i_csp = X264_CSP_I444; |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
181 mod->mux->bih->biSizeImage = width * height * 3; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
182 break; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
183 case IMGFMT_YVYU: |
20252
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
184 param.i_csp = X264_CSP_YUYV; |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
185 mod->mux->bih->biSizeImage = width * height * 3; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
186 break; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
187 case IMGFMT_RGB: |
20252
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
188 param.i_csp = X264_CSP_RGB; |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
189 mod->mux->bih->biSizeImage = width * height * 3; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
190 break; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
191 case IMGFMT_BGR: |
20252
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
192 param.i_csp = X264_CSP_BGR; |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
193 mod->mux->bih->biSizeImage = width * height * 3; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
194 break; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
195 case IMGFMT_BGR32: |
20252
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
196 param.i_csp = X264_CSP_BGRA; |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
197 mod->mux->bih->biSizeImage = width * height * 4; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
198 break; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
199 default: |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
200 mp_msg(MSGT_MENCODER, MSGL_ERR, "Wrong colorspace.\n"); |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
201 return 0; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
202 } |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
203 |
20252
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
204 mod->x264 = x264_encoder_open(¶m); |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
205 if(!mod->x264) { |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
206 mp_msg(MSGT_MENCODER, MSGL_ERR, "x264_encoder_open failed.\n"); |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
207 return 0; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
208 } |
19577
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
209 |
20252
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
210 if(!param.b_repeat_headers){ |
19577
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
211 uint8_t *extradata; |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
212 x264_nal_t *nal; |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
213 int extradata_size, nnal, i, s = 0; |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
214 |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
215 x264_encoder_headers(mod->x264, &nal, &nnal); |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
216 |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
217 /* 5 bytes NAL header + worst case escaping */ |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
218 for(i = 0; i < nnal; i++) |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
219 s += 5 + nal[i].i_payload * 4 / 3; |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
220 |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
221 extradata = malloc(s); |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
222 extradata_size = encode_nals(extradata, s, nal, nnal); |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
223 |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
224 mod->mux->bih= realloc(mod->mux->bih, sizeof(BITMAPINFOHEADER) + extradata_size); |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
225 memcpy(mod->mux->bih + 1, extradata, extradata_size); |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
226 mod->mux->bih->biSize= sizeof(BITMAPINFOHEADER) + extradata_size; |
7e19b1207b81
"global header" support, this is pretty much just copy and pasted code from
michael
parents:
19125
diff
changeset
|
227 } |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
228 |
20252
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
229 if (param.i_bframe > 1 && param.b_bframe_pyramid) |
17659 | 230 mod->mux->decoder_delay = 2; |
231 else | |
20252
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
232 mod->mux->decoder_delay = param.i_bframe ? 1 : 0; |
17659 | 233 |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
234 return 1; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
235 } |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
236 |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
237 static int control(struct vf_instance_s* vf, int request, void *data) |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
238 { |
20054
8760c8681eac
Remove the x264 option parser, and pass the options on to libx264 as a string instead. This provides automatic support for all current and future x264 options.
lorenm
parents:
19623
diff
changeset
|
239 h264_module_t *mod=(h264_module_t*)vf->priv; |
14784
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
240 switch(request){ |
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
241 case VFCTRL_FLUSH_FRAMES: |
20252
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
242 if(param.i_bframe) |
14784
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
243 while(encode_frame(vf, NULL) > 0); |
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
244 return CONTROL_TRUE; |
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
245 default: |
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
246 return CONTROL_UNKNOWN; |
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
247 } |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
248 } |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
249 |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
250 static int query_format(struct vf_instance_s* vf, unsigned int fmt) |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
251 { |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
252 switch(fmt) { |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
253 case IMGFMT_I420: |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
254 return (VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW); |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
255 case IMGFMT_YV12: |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
256 case IMGFMT_422P: |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
257 case IMGFMT_444P: |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
258 case IMGFMT_YVYU: |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
259 case IMGFMT_RGB: |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
260 case IMGFMT_BGR: |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
261 case IMGFMT_BGR32: |
14943 | 262 /* These colorspaces are supported, but they'll just have |
263 * to be converted to I420 internally */ | |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
264 return 0; /* VFCAP_CSP_SUPPORTED */ |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
265 } |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
266 return 0; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
267 } |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
268 |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17902
diff
changeset
|
269 static int put_image(struct vf_instance_s *vf, mp_image_t *mpi, double pts) |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
270 { |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
271 h264_module_t *mod=(h264_module_t*)vf->priv; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
272 int i; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
273 |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
274 memset(&mod->pic, 0, sizeof(x264_picture_t)); |
20252
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
275 mod->pic.img.i_csp=param.i_csp; |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
276 mod->pic.img.i_plane=3; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
277 for(i=0; i<4; i++) { |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
278 mod->pic.img.plane[i] = mpi->planes[i]; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
279 mod->pic.img.i_stride[i] = mpi->stride[i]; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
280 } |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
281 |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
282 mod->pic.i_type = X264_TYPE_AUTO; |
14784
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
283 |
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
284 return encode_frame(vf, &mod->pic) >= 0; |
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
285 } |
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
286 |
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
287 static int encode_frame(struct vf_instance_s *vf, x264_picture_t *pic_in) |
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
288 { |
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
289 h264_module_t *mod=(h264_module_t*)vf->priv; |
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
290 x264_picture_t pic_out; |
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
291 x264_nal_t *nal; |
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
292 int i_nal; |
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
293 int i_size = 0; |
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
294 int i; |
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
295 |
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
296 if(x264_encoder_encode(mod->x264, &nal, &i_nal, pic_in, &pic_out) < 0) { |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
297 mp_msg(MSGT_MENCODER, MSGL_ERR, "x264_encoder_encode failed\n"); |
14784
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
298 return -1; |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
299 } |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
300 |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
301 for(i=0; i < i_nal; i++) { |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
302 int i_data = mod->mux->buffer_size - i_size; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
303 i_size += x264_nal_encode(mod->mux->buffer + i_size, &i_data, 1, &nal[i]); |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
304 } |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
305 if(i_size>0) { |
14784
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
306 int keyframe = (pic_out.i_type == X264_TYPE_IDR) || |
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
307 (pic_out.i_type == X264_TYPE_I |
20252
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
308 && param.i_frame_reference == 1 |
eaaf13b39595
fix multiple instances of -x264encopts on the commandline (broke in r20060)
lorenm
parents:
20054
diff
changeset
|
309 && !param.i_bframe); |
17487
fa17424b4c7b
change muxer_write_chunk() so that pts/dts _could_ be passed from encoder to muxer
michael
parents:
17402
diff
changeset
|
310 muxer_write_chunk(mod->mux, i_size, keyframe?0x10:0, MP_NOPTS_VALUE, MP_NOPTS_VALUE); |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
311 } |
17659 | 312 else |
313 ++mod->mux->encoder_delay; | |
14784
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
314 |
53d306774ce2
sync to x264 r137: adaptive B-frame decision, flush delayed frames.
lorenm
parents:
14759
diff
changeset
|
315 return i_size; |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
316 } |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
317 |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
318 static void uninit(struct vf_instance_s *vf) |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
319 { |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
320 h264_module_t *mod=(h264_module_t*)vf->priv; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
321 x264_encoder_close(mod->x264); |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
322 } |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
323 |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
324 static int vf_open(vf_instance_t *vf, char *args) { |
13334 | 325 h264_module_t *mod; |
326 | |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
327 vf->config = config; |
14878 | 328 vf->default_caps = VFCAP_CONSTANT; |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
329 vf->control = control; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
330 vf->query_format = query_format; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
331 vf->put_image = put_image; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
332 vf->uninit = uninit; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
333 vf->priv = malloc(sizeof(h264_module_t)); |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
334 |
13334 | 335 mod=(h264_module_t*)vf->priv; |
13166
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
336 mod->mux = (muxer_stream_t*)args; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
337 mod->mux->bih = malloc(sizeof(BITMAPINFOHEADER)); |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
338 memset(mod->mux->bih, 0, sizeof(BITMAPINFOHEADER)); |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
339 mod->mux->bih->biSize = sizeof(BITMAPINFOHEADER); |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
340 mod->mux->bih->biPlanes = 1; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
341 mod->mux->bih->biBitCount = 24; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
342 mod->mux->bih->biCompression = mmioFOURCC('h', '2', '6', '4'); |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
343 |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
344 return 1; |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
345 } |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
346 |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
347 vf_info_t ve_info_x264 = { |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
348 "H.264 encoder", |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
349 "x264", |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
350 "Bernhard Rosenkraenzer <bero@arklinux.org>", |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
351 "(C) 2004 LINUX4MEDIA GmbH; (C) 2004 Ark Linux", |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
352 vf_open |
d198f255bee9
x264 encoder support. Original patch send by Bernhard Rosenkraenzer <bero at arklinux dot org>, modifications by Loren Merritt <lorenm at u.washington dot edu>, Jeff Clagg <snacky at ikaruga.co dot uk> and me
iive
parents:
diff
changeset
|
353 }; |