Codebase list ffmpeg2theora / 0745c11
Updating to .23 Tiago Bortoletto Vaz 11 years ago
38 changed file(s) with 937 addition(s) and 1442 deletion(s). Raw diff Collapse all Expand all
+0
-1
.gitignore less more
0 .pc
+292
-629
COPYING less more
0
1 GNU GENERAL PUBLIC LICENSE
2 Version 3, 29 June 2007
3
4 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
0 GNU GENERAL PUBLIC LICENSE
1 Version 2, June 1991
2
3 Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
4 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
55 Everyone is permitted to copy and distribute verbatim copies
66 of this license document, but changing it is not allowed.
77
8 Preamble
9
10 The GNU General Public License is a free, copyleft license for
11 software and other kinds of works.
12
13 The licenses for most software and other practical works are designed
14 to take away your freedom to share and change the works. By contrast,
15 the GNU General Public License is intended to guarantee your freedom to
16 share and change all versions of a program--to make sure it remains free
17 software for all its users. We, the Free Software Foundation, use the
18 GNU General Public License for most of our software; it applies also to
19 any other work released this way by its authors. You can apply it to
8 Preamble
9
10 The licenses for most software are designed to take away your
11 freedom to share and change it. By contrast, the GNU General Public
12 License is intended to guarantee your freedom to share and change free
13 software--to make sure the software is free for all its users. This
14 General Public License applies to most of the Free Software
15 Foundation's software and to any other program whose authors commit to
16 using it. (Some other Free Software Foundation software is covered by
17 the GNU Lesser General Public License instead.) You can apply it to
2018 your programs, too.
2119
2220 When we speak of free software, we are referring to freedom, not
2321 price. Our General Public Licenses are designed to make sure that you
2422 have the freedom to distribute copies of free software (and charge for
25 them if you wish), that you receive source code or can get it if you
26 want it, that you can change the software or use pieces of it in new
27 free programs, and that you know you can do these things.
28
29 To protect your rights, we need to prevent others from denying you
30 these rights or asking you to surrender the rights. Therefore, you have
31 certain responsibilities if you distribute copies of the software, or if
32 you modify it: responsibilities to respect the freedom of others.
23 this service if you wish), that you receive source code or can get it
24 if you want it, that you can change the software or use pieces of it
25 in new free programs; and that you know you can do these things.
26
27 To protect your rights, we need to make restrictions that forbid
28 anyone to deny you these rights or to ask you to surrender the rights.
29 These restrictions translate to certain responsibilities for you if you
30 distribute copies of the software, or if you modify it.
3331
3432 For example, if you distribute copies of such a program, whether
35 gratis or for a fee, you must pass on to the recipients the same
36 freedoms that you received. You must make sure that they, too, receive
37 or can get the source code. And you must show them these terms so they
38 know their rights.
39
40 Developers that use the GNU GPL protect your rights with two steps:
41 (1) assert copyright on the software, and (2) offer you this License
42 giving you legal permission to copy, distribute and/or modify it.
43
44 For the developers' and authors' protection, the GPL clearly explains
45 that there is no warranty for this free software. For both users' and
46 authors' sake, the GPL requires that modified versions be marked as
47 changed, so that their problems will not be attributed erroneously to
48 authors of previous versions.
49
50 Some devices are designed to deny users access to install or run
51 modified versions of the software inside them, although the manufacturer
52 can do so. This is fundamentally incompatible with the aim of
53 protecting users' freedom to change the software. The systematic
54 pattern of such abuse occurs in the area of products for individuals to
55 use, which is precisely where it is most unacceptable. Therefore, we
56 have designed this version of the GPL to prohibit the practice for those
57 products. If such problems arise substantially in other domains, we
58 stand ready to extend this provision to those domains in future versions
59 of the GPL, as needed to protect the freedom of users.
60
61 Finally, every program is threatened constantly by software patents.
62 States should not allow patents to restrict development and use of
63 software on general-purpose computers, but in those that do, we wish to
64 avoid the special danger that patents applied to a free program could
65 make it effectively proprietary. To prevent this, the GPL assures that
66 patents cannot be used to render the program non-free.
33 gratis or for a fee, you must give the recipients all the rights that
34 you have. You must make sure that they, too, receive or can get the
35 source code. And you must show them these terms so they know their
36 rights.
37
38 We protect your rights with two steps: (1) copyright the software, and
39 (2) offer you this license which gives you legal permission to copy,
40 distribute and/or modify the software.
41
42 Also, for each author's protection and ours, we want to make certain
43 that everyone understands that there is no warranty for this free
44 software. If the software is modified by someone else and passed on, we
45 want its recipients to know that what they have is not the original, so
46 that any problems introduced by others will not reflect on the original
47 authors' reputations.
48
49 Finally, any free program is threatened constantly by software
50 patents. We wish to avoid the danger that redistributors of a free
51 program will individually obtain patent licenses, in effect making the
52 program proprietary. To prevent this, we have made it clear that any
53 patent must be licensed for everyone's free use or not licensed at all.
6754
6855 The precise terms and conditions for copying, distribution and
6956 modification follow.
7057
71 TERMS AND CONDITIONS
72
73 0. Definitions.
74
75 "This License" refers to version 3 of the GNU General Public License.
76
77 "Copyright" also means copyright-like laws that apply to other kinds of
78 works, such as semiconductor masks.
79
80 "The Program" refers to any copyrightable work licensed under this
81 License. Each licensee is addressed as "you". "Licensees" and
82 "recipients" may be individuals or organizations.
83
84 To "modify" a work means to copy from or adapt all or part of the work
85 in a fashion requiring copyright permission, other than the making of an
86 exact copy. The resulting work is called a "modified version" of the
87 earlier work or a work "based on" the earlier work.
88
89 A "covered work" means either the unmodified Program or a work based
90 on the Program.
91
92 To "propagate" a work means to do anything with it that, without
93 permission, would make you directly or secondarily liable for
94 infringement under applicable copyright law, except executing it on a
95 computer or modifying a private copy. Propagation includes copying,
96 distribution (with or without modification), making available to the
97 public, and in some countries other activities as well.
98
99 To "convey" a work means any kind of propagation that enables other
100 parties to make or receive copies. Mere interaction with a user through
101 a computer network, with no transfer of a copy, is not conveying.
102
103 An interactive user interface displays "Appropriate Legal Notices"
104 to the extent that it includes a convenient and prominently visible
105 feature that (1) displays an appropriate copyright notice, and (2)
106 tells the user that there is no warranty for the work (except to the
107 extent that warranties are provided), that licensees may convey the
108 work under this License, and how to view a copy of this License. If
109 the interface presents a list of user commands or options, such as a
110 menu, a prominent item in the list meets this criterion.
111
112 1. Source Code.
113
114 The "source code" for a work means the preferred form of the work
115 for making modifications to it. "Object code" means any non-source
116 form of a work.
117
118 A "Standard Interface" means an interface that either is an official
119 standard defined by a recognized standards body, or, in the case of
120 interfaces specified for a particular programming language, one that
121 is widely used among developers working in that language.
122
123 The "System Libraries" of an executable work include anything, other
124 than the work as a whole, that (a) is included in the normal form of
125 packaging a Major Component, but which is not part of that Major
126 Component, and (b) serves only to enable use of the work with that
127 Major Component, or to implement a Standard Interface for which an
128 implementation is available to the public in source code form. A
129 "Major Component", in this context, means a major essential component
130 (kernel, window system, and so on) of the specific operating system
131 (if any) on which the executable work runs, or a compiler used to
132 produce the work, or an object code interpreter used to run it.
133
134 The "Corresponding Source" for a work in object code form means all
135 the source code needed to generate, install, and (for an executable
136 work) run the object code and to modify the work, including scripts to
137 control those activities. However, it does not include the work's
138 System Libraries, or general-purpose tools or generally available free
139 programs which are used unmodified in performing those activities but
140 which are not part of the work. For example, Corresponding Source
141 includes interface definition files associated with source files for
142 the work, and the source code for shared libraries and dynamically
143 linked subprograms that the work is specifically designed to require,
144 such as by intimate data communication or control flow between those
145 subprograms and other parts of the work.
146
147 The Corresponding Source need not include anything that users
148 can regenerate automatically from other parts of the Corresponding
149 Source.
150
151 The Corresponding Source for a work in source code form is that
152 same work.
153
154 2. Basic Permissions.
155
156 All rights granted under this License are granted for the term of
157 copyright on the Program, and are irrevocable provided the stated
158 conditions are met. This License explicitly affirms your unlimited
159 permission to run the unmodified Program. The output from running a
160 covered work is covered by this License only if the output, given its
161 content, constitutes a covered work. This License acknowledges your
162 rights of fair use or other equivalent, as provided by copyright law.
163
164 You may make, run and propagate covered works that you do not
165 convey, without conditions so long as your license otherwise remains
166 in force. You may convey covered works to others for the sole purpose
167 of having them make modifications exclusively for you, or provide you
168 with facilities for running those works, provided that you comply with
169 the terms of this License in conveying all material for which you do
170 not control copyright. Those thus making or running the covered works
171 for you must do so exclusively on your behalf, under your direction
172 and control, on terms that prohibit them from making any copies of
173 your copyrighted material outside their relationship with you.
174
175 Conveying under any other circumstances is permitted solely under
176 the conditions stated below. Sublicensing is not allowed; section 10
177 makes it unnecessary.
178
179 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
181 No covered work shall be deemed part of an effective technological
182 measure under any applicable law fulfilling obligations under article
183 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 similar laws prohibiting or restricting circumvention of such
185 measures.
186
187 When you convey a covered work, you waive any legal power to forbid
188 circumvention of technological measures to the extent such circumvention
189 is effected by exercising rights under this License with respect to
190 the covered work, and you disclaim any intention to limit operation or
191 modification of the work as a means of enforcing, against the work's
192 users, your or third parties' legal rights to forbid circumvention of
193 technological measures.
194
195 4. Conveying Verbatim Copies.
196
197 You may convey verbatim copies of the Program's source code as you
198 receive it, in any medium, provided that you conspicuously and
199 appropriately publish on each copy an appropriate copyright notice;
200 keep intact all notices stating that this License and any
201 non-permissive terms added in accord with section 7 apply to the code;
202 keep intact all notices of the absence of any warranty; and give all
203 recipients a copy of this License along with the Program.
204
205 You may charge any price or no price for each copy that you convey,
206 and you may offer support or warranty protection for a fee.
207
208 5. Conveying Modified Source Versions.
209
210 You may convey a work based on the Program, or the modifications to
211 produce it from the Program, in the form of source code under the
212 terms of section 4, provided that you also meet all of these conditions:
213
214 a) The work must carry prominent notices stating that you modified
215 it, and giving a relevant date.
216
217 b) The work must carry prominent notices stating that it is
218 released under this License and any conditions added under section
219 7. This requirement modifies the requirement in section 4 to
220 "keep intact all notices".
221
222 c) You must license the entire work, as a whole, under this
223 License to anyone who comes into possession of a copy. This
224 License will therefore apply, along with any applicable section 7
225 additional terms, to the whole of the work, and all its parts,
226 regardless of how they are packaged. This License gives no
227 permission to license the work in any other way, but it does not
228 invalidate such permission if you have separately received it.
229
230 d) If the work has interactive user interfaces, each must display
231 Appropriate Legal Notices; however, if the Program has interactive
232 interfaces that do not display Appropriate Legal Notices, your
233 work need not make them do so.
234
235 A compilation of a covered work with other separate and independent
236 works, which are not by their nature extensions of the covered work,
237 and which are not combined with it such as to form a larger program,
238 in or on a volume of a storage or distribution medium, is called an
239 "aggregate" if the compilation and its resulting copyright are not
240 used to limit the access or legal rights of the compilation's users
241 beyond what the individual works permit. Inclusion of a covered work
242 in an aggregate does not cause this License to apply to the other
243 parts of the aggregate.
244
245 6. Conveying Non-Source Forms.
246
247 You may convey a covered work in object code form under the terms
248 of sections 4 and 5, provided that you also convey the
249 machine-readable Corresponding Source under the terms of this License,
250 in one of these ways:
251
252 a) Convey the object code in, or embodied in, a physical product
253 (including a physical distribution medium), accompanied by the
254 Corresponding Source fixed on a durable physical medium
255 customarily used for software interchange.
256
257 b) Convey the object code in, or embodied in, a physical product
258 (including a physical distribution medium), accompanied by a
259 written offer, valid for at least three years and valid for as
260 long as you offer spare parts or customer support for that product
261 model, to give anyone who possesses the object code either (1) a
262 copy of the Corresponding Source for all the software in the
263 product that is covered by this License, on a durable physical
264 medium customarily used for software interchange, for a price no
265 more than your reasonable cost of physically performing this
266 conveying of source, or (2) access to copy the
267 Corresponding Source from a network server at no charge.
268
269 c) Convey individual copies of the object code with a copy of the
270 written offer to provide the Corresponding Source. This
271 alternative is allowed only occasionally and noncommercially, and
272 only if you received the object code with such an offer, in accord
273 with subsection 6b.
274
275 d) Convey the object code by offering access from a designated
276 place (gratis or for a charge), and offer equivalent access to the
277 Corresponding Source in the same way through the same place at no
278 further charge. You need not require recipients to copy the
279 Corresponding Source along with the object code. If the place to
280 copy the object code is a network server, the Corresponding Source
281 may be on a different server (operated by you or a third party)
282 that supports equivalent copying facilities, provided you maintain
283 clear directions next to the object code saying where to find the
284 Corresponding Source. Regardless of what server hosts the
285 Corresponding Source, you remain obligated to ensure that it is
286 available for as long as needed to satisfy these requirements.
287
288 e) Convey the object code using peer-to-peer transmission, provided
289 you inform other peers where the object code and Corresponding
290 Source of the work are being offered to the general public at no
291 charge under subsection 6d.
292
293 A separable portion of the object code, whose source code is excluded
294 from the Corresponding Source as a System Library, need not be
295 included in conveying the object code work.
296
297 A "User Product" is either (1) a "consumer product", which means any
298 tangible personal property which is normally used for personal, family,
299 or household purposes, or (2) anything designed or sold for incorporation
300 into a dwelling. In determining whether a product is a consumer product,
301 doubtful cases shall be resolved in favor of coverage. For a particular
302 product received by a particular user, "normally used" refers to a
303 typical or common use of that class of product, regardless of the status
304 of the particular user or of the way in which the particular user
305 actually uses, or expects or is expected to use, the product. A product
306 is a consumer product regardless of whether the product has substantial
307 commercial, industrial or non-consumer uses, unless such uses represent
308 the only significant mode of use of the product.
309
310 "Installation Information" for a User Product means any methods,
311 procedures, authorization keys, or other information required to install
312 and execute modified versions of a covered work in that User Product from
313 a modified version of its Corresponding Source. The information must
314 suffice to ensure that the continued functioning of the modified object
315 code is in no case prevented or interfered with solely because
316 modification has been made.
317
318 If you convey an object code work under this section in, or with, or
319 specifically for use in, a User Product, and the conveying occurs as
320 part of a transaction in which the right of possession and use of the
321 User Product is transferred to the recipient in perpetuity or for a
322 fixed term (regardless of how the transaction is characterized), the
323 Corresponding Source conveyed under this section must be accompanied
324 by the Installation Information. But this requirement does not apply
325 if neither you nor any third party retains the ability to install
326 modified object code on the User Product (for example, the work has
327 been installed in ROM).
328
329 The requirement to provide Installation Information does not include a
330 requirement to continue to provide support service, warranty, or updates
331 for a work that has been modified or installed by the recipient, or for
332 the User Product in which it has been modified or installed. Access to a
333 network may be denied when the modification itself materially and
334 adversely affects the operation of the network or violates the rules and
335 protocols for communication across the network.
336
337 Corresponding Source conveyed, and Installation Information provided,
338 in accord with this section must be in a format that is publicly
339 documented (and with an implementation available to the public in
340 source code form), and must require no special password or key for
341 unpacking, reading or copying.
342
343 7. Additional Terms.
344
345 "Additional permissions" are terms that supplement the terms of this
346 License by making exceptions from one or more of its conditions.
347 Additional permissions that are applicable to the entire Program shall
348 be treated as though they were included in this License, to the extent
349 that they are valid under applicable law. If additional permissions
350 apply only to part of the Program, that part may be used separately
351 under those permissions, but the entire Program remains governed by
352 this License without regard to the additional permissions.
353
354 When you convey a copy of a covered work, you may at your option
355 remove any additional permissions from that copy, or from any part of
356 it. (Additional permissions may be written to require their own
357 removal in certain cases when you modify the work.) You may place
358 additional permissions on material, added by you to a covered work,
359 for which you have or can give appropriate copyright permission.
360
361 Notwithstanding any other provision of this License, for material you
362 add to a covered work, you may (if authorized by the copyright holders of
363 that material) supplement the terms of this License with terms:
364
365 a) Disclaiming warranty or limiting liability differently from the
366 terms of sections 15 and 16 of this License; or
367
368 b) Requiring preservation of specified reasonable legal notices or
369 author attributions in that material or in the Appropriate Legal
370 Notices displayed by works containing it; or
371
372 c) Prohibiting misrepresentation of the origin of that material, or
373 requiring that modified versions of such material be marked in
374 reasonable ways as different from the original version; or
375
376 d) Limiting the use for publicity purposes of names of licensors or
377 authors of the material; or
378
379 e) Declining to grant rights under trademark law for use of some
380 trade names, trademarks, or service marks; or
381
382 f) Requiring indemnification of licensors and authors of that
383 material by anyone who conveys the material (or modified versions of
384 it) with contractual assumptions of liability to the recipient, for
385 any liability that these contractual assumptions directly impose on
386 those licensors and authors.
387
388 All other non-permissive additional terms are considered "further
389 restrictions" within the meaning of section 10. If the Program as you
390 received it, or any part of it, contains a notice stating that it is
391 governed by this License along with a term that is a further
392 restriction, you may remove that term. If a license document contains
393 a further restriction but permits relicensing or conveying under this
394 License, you may add to a covered work material governed by the terms
395 of that license document, provided that the further restriction does
396 not survive such relicensing or conveying.
397
398 If you add terms to a covered work in accord with this section, you
399 must place, in the relevant source files, a statement of the
400 additional terms that apply to those files, or a notice indicating
401 where to find the applicable terms.
402
403 Additional terms, permissive or non-permissive, may be stated in the
404 form of a separately written license, or stated as exceptions;
405 the above requirements apply either way.
406
407 8. Termination.
408
409 You may not propagate or modify a covered work except as expressly
410 provided under this License. Any attempt otherwise to propagate or
411 modify it is void, and will automatically terminate your rights under
412 this License (including any patent licenses granted under the third
413 paragraph of section 11).
414
415 However, if you cease all violation of this License, then your
416 license from a particular copyright holder is reinstated (a)
417 provisionally, unless and until the copyright holder explicitly and
418 finally terminates your license, and (b) permanently, if the copyright
419 holder fails to notify you of the violation by some reasonable means
420 prior to 60 days after the cessation.
421
422 Moreover, your license from a particular copyright holder is
423 reinstated permanently if the copyright holder notifies you of the
424 violation by some reasonable means, this is the first time you have
425 received notice of violation of this License (for any work) from that
426 copyright holder, and you cure the violation prior to 30 days after
427 your receipt of the notice.
428
429 Termination of your rights under this section does not terminate the
430 licenses of parties who have received copies or rights from you under
431 this License. If your rights have been terminated and not permanently
432 reinstated, you do not qualify to receive new licenses for the same
433 material under section 10.
434
435 9. Acceptance Not Required for Having Copies.
436
437 You are not required to accept this License in order to receive or
438 run a copy of the Program. Ancillary propagation of a covered work
439 occurring solely as a consequence of using peer-to-peer transmission
440 to receive a copy likewise does not require acceptance. However,
441 nothing other than this License grants you permission to propagate or
442 modify any covered work. These actions infringe copyright if you do
443 not accept this License. Therefore, by modifying or propagating a
444 covered work, you indicate your acceptance of this License to do so.
445
446 10. Automatic Licensing of Downstream Recipients.
447
448 Each time you convey a covered work, the recipient automatically
449 receives a license from the original licensors, to run, modify and
450 propagate that work, subject to this License. You are not responsible
451 for enforcing compliance by third parties with this License.
452
453 An "entity transaction" is a transaction transferring control of an
454 organization, or substantially all assets of one, or subdividing an
455 organization, or merging organizations. If propagation of a covered
456 work results from an entity transaction, each party to that
457 transaction who receives a copy of the work also receives whatever
458 licenses to the work the party's predecessor in interest had or could
459 give under the previous paragraph, plus a right to possession of the
460 Corresponding Source of the work from the predecessor in interest, if
461 the predecessor has it or can get it with reasonable efforts.
462
463 You may not impose any further restrictions on the exercise of the
464 rights granted or affirmed under this License. For example, you may
465 not impose a license fee, royalty, or other charge for exercise of
466 rights granted under this License, and you may not initiate litigation
467 (including a cross-claim or counterclaim in a lawsuit) alleging that
468 any patent claim is infringed by making, using, selling, offering for
469 sale, or importing the Program or any portion of it.
470
471 11. Patents.
472
473 A "contributor" is a copyright holder who authorizes use under this
474 License of the Program or a work on which the Program is based. The
475 work thus licensed is called the contributor's "contributor version".
476
477 A contributor's "essential patent claims" are all patent claims
478 owned or controlled by the contributor, whether already acquired or
479 hereafter acquired, that would be infringed by some manner, permitted
480 by this License, of making, using, or selling its contributor version,
481 but do not include claims that would be infringed only as a
482 consequence of further modification of the contributor version. For
483 purposes of this definition, "control" includes the right to grant
484 patent sublicenses in a manner consistent with the requirements of
58 GNU GENERAL PUBLIC LICENSE
59 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
60
61 0. This License applies to any program or other work which contains
62 a notice placed by the copyright holder saying it may be distributed
63 under the terms of this General Public License. The "Program", below,
64 refers to any such program or work, and a "work based on the Program"
65 means either the Program or any derivative work under copyright law:
66 that is to say, a work containing the Program or a portion of it,
67 either verbatim or with modifications and/or translated into another
68 language. (Hereinafter, translation is included without limitation in
69 the term "modification".) Each licensee is addressed as "you".
70
71 Activities other than copying, distribution and modification are not
72 covered by this License; they are outside its scope. The act of
73 running the Program is not restricted, and the output from the Program
74 is covered only if its contents constitute a work based on the
75 Program (independent of having been made by running the Program).
76 Whether that is true depends on what the Program does.
77
78 1. You may copy and distribute verbatim copies of the Program's
79 source code as you receive it, in any medium, provided that you
80 conspicuously and appropriately publish on each copy an appropriate
81 copyright notice and disclaimer of warranty; keep intact all the
82 notices that refer to this License and to the absence of any warranty;
83 and give any other recipients of the Program a copy of this License
84 along with the Program.
85
86 You may charge a fee for the physical act of transferring a copy, and
87 you may at your option offer warranty protection in exchange for a fee.
88
89 2. You may modify your copy or copies of the Program or any portion
90 of it, thus forming a work based on the Program, and copy and
91 distribute such modifications or work under the terms of Section 1
92 above, provided that you also meet all of these conditions:
93
94 a) You must cause the modified files to carry prominent notices
95 stating that you changed the files and the date of any change.
96
97 b) You must cause any work that you distribute or publish, that in
98 whole or in part contains or is derived from the Program or any
99 part thereof, to be licensed as a whole at no charge to all third
100 parties under the terms of this License.
101
102 c) If the modified program normally reads commands interactively
103 when run, you must cause it, when started running for such
104 interactive use in the most ordinary way, to print or display an
105 announcement including an appropriate copyright notice and a
106 notice that there is no warranty (or else, saying that you provide
107 a warranty) and that users may redistribute the program under
108 these conditions, and telling the user how to view a copy of this
109 License. (Exception: if the Program itself is interactive but
110 does not normally print such an announcement, your work based on
111 the Program is not required to print an announcement.)
112
113 These requirements apply to the modified work as a whole. If
114 identifiable sections of that work are not derived from the Program,
115 and can be reasonably considered independent and separate works in
116 themselves, then this License, and its terms, do not apply to those
117 sections when you distribute them as separate works. But when you
118 distribute the same sections as part of a whole which is a work based
119 on the Program, the distribution of the whole must be on the terms of
120 this License, whose permissions for other licensees extend to the
121 entire whole, and thus to each and every part regardless of who wrote it.
122
123 Thus, it is not the intent of this section to claim rights or contest
124 your rights to work written entirely by you; rather, the intent is to
125 exercise the right to control the distribution of derivative or
126 collective works based on the Program.
127
128 In addition, mere aggregation of another work not based on the Program
129 with the Program (or with a work based on the Program) on a volume of
130 a storage or distribution medium does not bring the other work under
131 the scope of this License.
132
133 3. You may copy and distribute the Program (or a work based on it,
134 under Section 2) in object code or executable form under the terms of
135 Sections 1 and 2 above provided that you also do one of the following:
136
137 a) Accompany it with the complete corresponding machine-readable
138 source code, which must be distributed under the terms of Sections
139 1 and 2 above on a medium customarily used for software interchange; or,
140
141 b) Accompany it with a written offer, valid for at least three
142 years, to give any third party, for a charge no more than your
143 cost of physically performing source distribution, a complete
144 machine-readable copy of the corresponding source code, to be
145 distributed under the terms of Sections 1 and 2 above on a medium
146 customarily used for software interchange; or,
147
148 c) Accompany it with the information you received as to the offer
149 to distribute corresponding source code. (This alternative is
150 allowed only for noncommercial distribution and only if you
151 received the program in object code or executable form with such
152 an offer, in accord with Subsection b above.)
153
154 The source code for a work means the preferred form of the work for
155 making modifications to it. For an executable work, complete source
156 code means all the source code for all modules it contains, plus any
157 associated interface definition files, plus the scripts used to
158 control compilation and installation of the executable. However, as a
159 special exception, the source code distributed need not include
160 anything that is normally distributed (in either source or binary
161 form) with the major components (compiler, kernel, and so on) of the
162 operating system on which the executable runs, unless that component
163 itself accompanies the executable.
164
165 If distribution of executable or object code is made by offering
166 access to copy from a designated place, then offering equivalent
167 access to copy the source code from the same place counts as
168 distribution of the source code, even though third parties are not
169 compelled to copy the source along with the object code.
170
171 4. You may not copy, modify, sublicense, or distribute the Program
172 except as expressly provided under this License. Any attempt
173 otherwise to copy, modify, sublicense or distribute the Program is
174 void, and will automatically terminate your rights under this License.
175 However, parties who have received copies, or rights, from you under
176 this License will not have their licenses terminated so long as such
177 parties remain in full compliance.
178
179 5. You are not required to accept this License, since you have not
180 signed it. However, nothing else grants you permission to modify or
181 distribute the Program or its derivative works. These actions are
182 prohibited by law if you do not accept this License. Therefore, by
183 modifying or distributing the Program (or any work based on the
184 Program), you indicate your acceptance of this License to do so, and
185 all its terms and conditions for copying, distributing or modifying
186 the Program or works based on it.
187
188 6. Each time you redistribute the Program (or any work based on the
189 Program), the recipient automatically receives a license from the
190 original licensor to copy, distribute or modify the Program subject to
191 these terms and conditions. You may not impose any further
192 restrictions on the recipients' exercise of the rights granted herein.
193 You are not responsible for enforcing compliance by third parties to
485194 this License.
486195
487 Each contributor grants you a non-exclusive, worldwide, royalty-free
488 patent license under the contributor's essential patent claims, to
489 make, use, sell, offer for sale, import and otherwise run, modify and
490 propagate the contents of its contributor version.
491
492 In the following three paragraphs, a "patent license" is any express
493 agreement or commitment, however denominated, not to enforce a patent
494 (such as an express permission to practice a patent or covenant not to
495 sue for patent infringement). To "grant" such a patent license to a
496 party means to make such an agreement or commitment not to enforce a
497 patent against the party.
498
499 If you convey a covered work, knowingly relying on a patent license,
500 and the Corresponding Source of the work is not available for anyone
501 to copy, free of charge and under the terms of this License, through a
502 publicly available network server or other readily accessible means,
503 then you must either (1) cause the Corresponding Source to be so
504 available, or (2) arrange to deprive yourself of the benefit of the
505 patent license for this particular work, or (3) arrange, in a manner
506 consistent with the requirements of this License, to extend the patent
507 license to downstream recipients. "Knowingly relying" means you have
508 actual knowledge that, but for the patent license, your conveying the
509 covered work in a country, or your recipient's use of the covered work
510 in a country, would infringe one or more identifiable patents in that
511 country that you have reason to believe are valid.
512
513 If, pursuant to or in connection with a single transaction or
514 arrangement, you convey, or propagate by procuring conveyance of, a
515 covered work, and grant a patent license to some of the parties
516 receiving the covered work authorizing them to use, propagate, modify
517 or convey a specific copy of the covered work, then the patent license
518 you grant is automatically extended to all recipients of the covered
519 work and works based on it.
520
521 A patent license is "discriminatory" if it does not include within
522 the scope of its coverage, prohibits the exercise of, or is
523 conditioned on the non-exercise of one or more of the rights that are
524 specifically granted under this License. You may not convey a covered
525 work if you are a party to an arrangement with a third party that is
526 in the business of distributing software, under which you make payment
527 to the third party based on the extent of your activity of conveying
528 the work, and under which the third party grants, to any of the
529 parties who would receive the covered work from you, a discriminatory
530 patent license (a) in connection with copies of the covered work
531 conveyed by you (or copies made from those copies), or (b) primarily
532 for and in connection with specific products or compilations that
533 contain the covered work, unless you entered into that arrangement,
534 or that patent license was granted, prior to 28 March 2007.
535
536 Nothing in this License shall be construed as excluding or limiting
537 any implied license or other defenses to infringement that may
538 otherwise be available to you under applicable patent law.
539
540 12. No Surrender of Others' Freedom.
541
542 If conditions are imposed on you (whether by court order, agreement or
196 7. If, as a consequence of a court judgment or allegation of patent
197 infringement or for any other reason (not limited to patent issues),
198 conditions are imposed on you (whether by court order, agreement or
543199 otherwise) that contradict the conditions of this License, they do not
544 excuse you from the conditions of this License. If you cannot convey a
545 covered work so as to satisfy simultaneously your obligations under this
546 License and any other pertinent obligations, then as a consequence you may
547 not convey it at all. For example, if you agree to terms that obligate you
548 to collect a royalty for further conveying from those to whom you convey
549 the Program, the only way you could satisfy both those terms and this
550 License would be to refrain entirely from conveying the Program.
551
552 13. Use with the GNU Affero General Public License.
553
554 Notwithstanding any other provision of this License, you have
555 permission to link or combine any covered work with a work licensed
556 under version 3 of the GNU Affero General Public License into a single
557 combined work, and to convey the resulting work. The terms of this
558 License will continue to apply to the part which is the covered work,
559 but the special requirements of the GNU Affero General Public License,
560 section 13, concerning interaction through a network will apply to the
561 combination as such.
562
563 14. Revised Versions of this License.
564
565 The Free Software Foundation may publish revised and/or new versions of
566 the GNU General Public License from time to time. Such new versions will
200 excuse you from the conditions of this License. If you cannot
201 distribute so as to satisfy simultaneously your obligations under this
202 License and any other pertinent obligations, then as a consequence you
203 may not distribute the Program at all. For example, if a patent
204 license would not permit royalty-free redistribution of the Program by
205 all those who receive copies directly or indirectly through you, then
206 the only way you could satisfy both it and this License would be to
207 refrain entirely from distribution of the Program.
208
209 If any portion of this section is held invalid or unenforceable under
210 any particular circumstance, the balance of the section is intended to
211 apply and the section as a whole is intended to apply in other
212 circumstances.
213
214 It is not the purpose of this section to induce you to infringe any
215 patents or other property right claims or to contest validity of any
216 such claims; this section has the sole purpose of protecting the
217 integrity of the free software distribution system, which is
218 implemented by public license practices. Many people have made
219 generous contributions to the wide range of software distributed
220 through that system in reliance on consistent application of that
221 system; it is up to the author/donor to decide if he or she is willing
222 to distribute software through any other system and a licensee cannot
223 impose that choice.
224
225 This section is intended to make thoroughly clear what is believed to
226 be a consequence of the rest of this License.
227
228 8. If the distribution and/or use of the Program is restricted in
229 certain countries either by patents or by copyrighted interfaces, the
230 original copyright holder who places the Program under this License
231 may add an explicit geographical distribution limitation excluding
232 those countries, so that distribution is permitted only in or among
233 countries not thus excluded. In such case, this License incorporates
234 the limitation as if written in the body of this License.
235
236 9. The Free Software Foundation may publish revised and/or new versions
237 of the General Public License from time to time. Such new versions will
567238 be similar in spirit to the present version, but may differ in detail to
568239 address new problems or concerns.
569240
570 Each version is given a distinguishing version number. If the
571 Program specifies that a certain numbered version of the GNU General
572 Public License "or any later version" applies to it, you have the
573 option of following the terms and conditions either of that numbered
574 version or of any later version published by the Free Software
575 Foundation. If the Program does not specify a version number of the
576 GNU General Public License, you may choose any version ever published
577 by the Free Software Foundation.
578
579 If the Program specifies that a proxy can decide which future
580 versions of the GNU General Public License can be used, that proxy's
581 public statement of acceptance of a version permanently authorizes you
582 to choose that version for the Program.
583
584 Later license versions may give you additional or different
585 permissions. However, no additional obligations are imposed on any
586 author or copyright holder as a result of your choosing to follow a
587 later version.
588
589 15. Disclaimer of Warranty.
590
591 THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
600 16. Limitation of Liability.
601
602 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 SUCH DAMAGES.
611
612 17. Interpretation of Sections 15 and 16.
613
614 If the disclaimer of warranty and limitation of liability provided
615 above cannot be given local legal effect according to their terms,
616 reviewing courts shall apply local law that most closely approximates
617 an absolute waiver of all civil liability in connection with the
618 Program, unless a warranty or assumption of liability accompanies a
619 copy of the Program in return for a fee.
620
621 END OF TERMS AND CONDITIONS
622
623 How to Apply These Terms to Your New Programs
241 Each version is given a distinguishing version number. If the Program
242 specifies a version number of this License which applies to it and "any
243 later version", you have the option of following the terms and conditions
244 either of that version or of any later version published by the Free
245 Software Foundation. If the Program does not specify a version number of
246 this License, you may choose any version ever published by the Free Software
247 Foundation.
248
249 10. If you wish to incorporate parts of the Program into other free
250 programs whose distribution conditions are different, write to the author
251 to ask for permission. For software which is copyrighted by the Free
252 Software Foundation, write to the Free Software Foundation; we sometimes
253 make exceptions for this. Our decision will be guided by the two goals
254 of preserving the free status of all derivatives of our free software and
255 of promoting the sharing and reuse of software generally.
256
257 NO WARRANTY
258
259 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
260 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
261 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
262 PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
263 OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
264 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
265 TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
266 PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
267 REPAIR OR CORRECTION.
268
269 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
270 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
271 REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
272 INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
273 OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
274 TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
275 YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
276 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
277 POSSIBILITY OF SUCH DAMAGES.
278
279 END OF TERMS AND CONDITIONS
280
281 How to Apply These Terms to Your New Programs
624282
625283 If you develop a new program, and you want it to be of the greatest
626284 possible use to the public, the best way to achieve this is to make it
628286
629287 To do so, attach the following notices to the program. It is safest
630288 to attach them to the start of each source file to most effectively
631 state the exclusion of warranty; and each file should have at least
289 convey the exclusion of warranty; and each file should have at least
632290 the "copyright" line and a pointer to where the full notice is found.
633291
634292 <one line to give the program's name and a brief idea of what it does.>
635293 Copyright (C) <year> <name of author>
636294
637 This program is free software: you can redistribute it and/or modify
295 This program is free software; you can redistribute it and/or modify
638296 it under the terms of the GNU General Public License as published by
639 the Free Software Foundation, either version 3 of the License, or
297 the Free Software Foundation; either version 2 of the License, or
640298 (at your option) any later version.
641299
642300 This program is distributed in the hope that it will be useful,
644302 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645303 GNU General Public License for more details.
646304
647 You should have received a copy of the GNU General Public License
648 along with this program. If not, see <http://www.gnu.org/licenses/>.
305 You should have received a copy of the GNU General Public License along
306 with this program; if not, write to the Free Software Foundation, Inc.,
307 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
649308
650309 Also add information on how to contact you by electronic and paper mail.
651310
652 If the program does terminal interaction, make it output a short
653 notice like this when it starts in an interactive mode:
654
655 <program> Copyright (C) <year> <name of author>
656 This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
311 If the program is interactive, make it output a short notice like this
312 when it starts in an interactive mode:
313
314 Gnomovision version 69, Copyright (C) year name of author
315 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657316 This is free software, and you are welcome to redistribute it
658317 under certain conditions; type `show c' for details.
659318
660319 The hypothetical commands `show w' and `show c' should show the appropriate
661 parts of the General Public License. Of course, your program's commands
662 might be different; for a GUI interface, you would use an "about box".
663
664 You should also get your employer (if you work as a programmer) or school,
665 if any, to sign a "copyright disclaimer" for the program, if necessary.
666 For more information on this, and how to apply and follow the GNU GPL, see
667 <http://www.gnu.org/licenses/>.
668
669 The GNU General Public License does not permit incorporating your program
670 into proprietary programs. If your program is a subroutine library, you
671 may consider it more useful to permit linking proprietary applications with
672 the library. If this is what you want to do, use the GNU Lesser General
673 Public License instead of this License. But first, please read
674 <http://www.gnu.org/philosophy/why-not-lgpl.html>.
675
320 parts of the General Public License. Of course, the commands you use may
321 be called something other than `show w' and `show c'; they could even be
322 mouse-clicks or menu items--whatever suits your program.
323
324 You should also get your employer (if you work as a programmer) or your
325 school, if any, to sign a "copyright disclaimer" for the program, if
326 necessary. Here is a sample; alter the names:
327
328 Yoyodyne, Inc., hereby disclaims all copyright interest in the program
329 `Gnomovision' (which makes passes at compilers) written by James Hacker.
330
331 <signature of Ty Coon>, 1 April 1989
332 Ty Coon, President of Vice
333
334 This General Public License does not permit incorporating your program into
335 proprietary programs. If your program is a subroutine library, you may
336 consider it more useful to permit linking proprietary applications with the
337 library. If this is what you want to do, use the GNU Lesser General
338 Public License instead of this License.
0 0.29 2012-06-25
1 - use GPL 2 or later, to make use of some decoders only available
2 in GPL 2 version of ffmpeg
3 - update to current ffmpeg api
4 - output version information of libraries used
5
6 0.28 2011-07-30
7 - select resize method via commandline
8 - fix 5.1 channel ordering
9 - update to FFmpeg 0.7 branch
10
011 0.27 2010-06-18
112 - Use Skeleton 4.0 by default (including index),
213 can be disabled with --skeleton-3 or --no-skeleton
22 you need
33 - scons (http://www.scons.org/)
44 - the latest version of libtheora <http://downloads.xiph.org/releases/theora/>
5 - ffmpeg svn <http://ffmpeg.sf.net> by running ./get_ffmpeg_svn.sh
5 - ffmpeg git <http://ffmpeg.org> by running ./get_ffmpeg.sh
66 (this script downloads ffmpeg and runs configure and compiles ffmpeg)
77 - for subtitles support, libkate <http://code.google.com/p/libkate/>,
88 or by running ./get_libkate.sh (this script downloads libkate, and
00 # SCons build specification
1 # vi:si:et:sw=2:sts=2:ts=2
12 from glob import glob
23 import os
34
45 import SCons
56
6 def svnversion():
7 f = os.popen("svnversion")
7 def version():
8 f = os.popen("./version.sh")
89 version = f.read().strip()
910 f.close()
1011 return version
1112
12 pkg_version="0.27"
13 #pkg_version +="+svn" + svnversion()
13 pkg_version="0.29"
1414
1515 pkg_name="ffmpeg2theora"
1616
17 scons_version=(0,97,0)
18 #this is needed to make scons -h work, so not checking for it right now
19 #(i.e. ubuntu hardy only ships with 0.97..)
20 #scons_version=(0,98,0)
17 scons_version=(1,2,0)
2118
2219 try:
2320 EnsureSConsVersion(*scons_version)
2522 print 'SCons %d.%d.%d or greater is required, but you have an older version' % scons_version
2623 Exit(2)
2724
28 opts = Options()
29 opts.AddOptions(
30 BoolOption('static', 'Set to 1 for static linking', 0),
31 BoolOption('debug', 'Set to 1 to enable debugging', 0),
25 opts = Variables()
26 opts.AddVariables(
27 BoolVariable('static', 'Set to 1 for static linking', 0),
28 BoolVariable('debug', 'Set to 1 to enable debugging', 0),
29 BoolVariable('build_ffmpeg', 'Set to 1 to build local copy of ffmpeg', 0),
3230 ('prefix', 'install files in', '/usr/local'),
3331 ('bindir', 'user executables', 'PREFIX/bin'),
3432 ('mandir', 'man documentation', 'PREFIX/man'),
3533 ('destdir', 'extra install time prefix', ''),
3634 ('APPEND_CCFLAGS', 'Additional C/C++ compiler flags'),
3735 ('APPEND_LINKFLAGS', 'Additional linker flags'),
38 BoolOption('libkate', 'enable libkate support', 1),
39 BoolOption('crossmingw', 'Set to 1 for crosscompile with mingw', 0)
36 BoolVariable('libkate', 'enable libkate support', 1),
37 BoolVariable('crossmingw', 'Set to 1 for crosscompile with mingw', 0)
4038 )
4139 env = Environment(options = opts)
4240 Help(opts.GenerateHelpText(env))
7270
7371 if GetOption("help"):
7472 Return()
75
76 env.PrependENVPath ('PATH', os.environ['PATH'])
7773
7874 def ParsePKGConfig(env, name):
7975 if os.environ.get('PKG_CONFIG_PATH', ''):
105101 context.Result( ret )
106102 return ret
107103
104 env.PrependENVPath ('PATH', os.environ['PATH'])
105
108106 conf = Configure(env, custom_tests = {
109107 'CheckPKGConfig' : CheckPKGConfig,
110108 'CheckPKG' : CheckPKG,
111 })
112
113 pkgconfig_version='0.15.0'
114 if not conf.CheckPKGConfig(pkgconfig_version):
115 print 'pkg-config >= %s not found.' % pkgconfig_version
116 Exit(1)
117
118 if not conf.CheckPKG("ogg >= 1.1"):
119 print 'ogg >= 1.1 missing'
120 Exit(1)
121
122 if not conf.CheckPKG("vorbis"):
123 print 'vorbis missing'
124 Exit(1)
125
126 if not conf.CheckPKG("vorbisenc"):
127 print 'vorbisenc missing'
128 Exit(1)
129
130 if not conf.CheckPKG("theoraenc >= 1.1.0"):
131 print 'theoraenc >= 1.1.0 missing'
132 Exit(1)
133
134 XIPH_LIBS="ogg >= 1.1 vorbis vorbisenc theoraenc >= 1.1.0"
135
136 if not conf.CheckPKG(XIPH_LIBS):
137 print 'some xiph libs are missing, ffmpeg2theora depends on %s' % XIPH_LIBS
138 Exit(1)
139 ParsePKGConfig(env, XIPH_LIBS)
140
141 FFMPEG_LIBS=["libavcodec >= 52.30.0", "libavdevice", "libavformat", "libpostproc", "libswscale"]
142 if os.path.exists("./ffmpeg"):
143 os.environ['PKG_CONFIG_PATH'] = "./ffmpeg/libavutil:./ffmpeg/libavformat:./ffmpeg/libavcodec:./ffmpeg/libavdevice:./ffmpeg/libswscale:./ffmpeg/libpostproc:" + os.environ.get('PKG_CONFIG_PATH', '')
144 if not conf.CheckPKG(' '.join(FFMPEG_LIBS)):
145 print """
146 Could not find %s.
147 You can install it via
148 sudo apt-get install %s
149 or update PKG_CONFIG_PATH to point to ffmpeg's source folder
150 or run ./get_ffmpeg_svn.sh (for more information see INSTALL)
151 """ %(" ".join(FFMPEG_LIBS), " ".join(["%s-dev"%l.split()[0] for l in FFMPEG_LIBS]))
152 Exit(1)
153
154 for lib in FFMPEG_LIBS:
155 ParsePKGConfig(env, lib)
156
157 if conf.CheckCHeader('libavformat/framehook.h'):
109 })
110
111 if env["build_ffmpeg"]:
112 if env.GetOption('clean'):
113 TryAction("cd ffmpeg;make distclean")
114 else:
115 TryAction("./build_ffmpeg.sh")
116
117 if not env.GetOption('clean'):
118 pkgconfig_version='0.15.0'
119 if not conf.CheckPKGConfig(pkgconfig_version):
120 print 'pkg-config >= %s not found.' % pkgconfig_version
121 Exit(1)
122
123 if not conf.CheckPKG("ogg >= 1.1"):
124 print 'ogg >= 1.1 missing'
125 Exit(1)
126
127 if not conf.CheckPKG("vorbis"):
128 print 'vorbis missing'
129 Exit(1)
130
131 if not conf.CheckPKG("vorbisenc"):
132 print 'vorbisenc missing'
133 Exit(1)
134
135 if not conf.CheckPKG("theoraenc >= 1.1.0"):
136 print 'theoraenc >= 1.1.0 missing'
137 Exit(1)
138
139 XIPH_LIBS="ogg >= 1.1 vorbis vorbisenc theoraenc >= 1.1.0"
140
141 if not conf.CheckPKG(XIPH_LIBS):
142 print 'some xiph libs are missing, ffmpeg2theora depends on %s' % XIPH_LIBS
143 Exit(1)
144 ParsePKGConfig(env, XIPH_LIBS)
145
146 FFMPEG_LIBS=[
147 "libavdevice",
148 "libavformat",
149 "libavfilter",
150 "libavcodec >= 52.30.0",
151 "libpostproc",
152 "libswscale",
153 "libswresample",
154 "libavutil",
155 ]
156 if os.path.exists("./ffmpeg"):
157 pkg_path = list(set(map(os.path.dirname, glob('./ffmpeg/*/*.pc'))))
158 pkg_path.append(os.environ.get('PKG_CONFIG_PATH', ''))
159 os.environ['PKG_CONFIG_PATH'] = ':'.join(pkg_path)
158160 env.Append(CCFLAGS=[
159 '-DHAVE_FRAMEHOOK'
161 '-Iffmpeg'
160162 ])
161163
162 KATE_LIBS="oggkate"
163 if env['libkate']:
164 if os.path.exists("./libkate/misc/pkgconfig"):
165 os.environ['PKG_CONFIG_PATH'] = "./libkate/misc/pkgconfig:" + os.environ.get('PKG_CONFIG_PATH', '')
166 if os.path.exists("./libkate/pkg/pkgconfig"):
167 os.environ['PKG_CONFIG_PATH'] = "./libkate/pkg/pkgconfig:" + os.environ.get('PKG_CONFIG_PATH', '')
168 if conf.CheckPKG(KATE_LIBS):
169 ParsePKGConfig(env, KATE_LIBS)
170 env.Append(CCFLAGS=['-DHAVE_KATE', '-DHAVE_OGGKATE'])
171 else:
164 if not conf.CheckPKG(' '.join(FFMPEG_LIBS)):
172165 print """
173 Could not find libkate. Subtitles support will be disabled.
174 You can also run ./get_libkate.sh (for more information see INSTALL)
175 or update PKG_CONFIG_PATH to point to libkate's source folder
176 """
177
178 if conf.CheckCHeader('iconv.h'):
179 env.Append(CCFLAGS=[
180 '-DHAVE_ICONV'
181 ])
182 if conf.CheckLib('iconv'):
183 env.Append(LIBS=['iconv'])
184
185 if env['static']:
186 env.Append(LIBS=['m', 'dl'])
166 Could not find %s.
167 You can install it via
168 sudo apt-get install %s
169 or update PKG_CONFIG_PATH to point to ffmpeg's source folder
170 or run ./get_ffmpeg.sh (for more information see INSTALL)
171 """ %(" ".join(FFMPEG_LIBS), " ".join(["%s-dev"%l.split()[0] for l in FFMPEG_LIBS]))
172 Exit(1)
173
174 for lib in FFMPEG_LIBS:
175 ParsePKGConfig(env, lib)
176
177 if conf.CheckCHeader('libavformat/framehook.h'):
178 env.Append(CCFLAGS=[
179 '-DHAVE_FRAMEHOOK'
180 ])
181
182 KATE_LIBS="oggkate"
183 if env['libkate']:
184 if os.path.exists("./libkate/misc/pkgconfig"):
185 os.environ['PKG_CONFIG_PATH'] = "./libkate/misc/pkgconfig:" + os.environ.get('PKG_CONFIG_PATH', '')
186 if os.path.exists("./libkate/pkg/pkgconfig"):
187 os.environ['PKG_CONFIG_PATH'] = "./libkate/pkg/pkgconfig:" + os.environ.get('PKG_CONFIG_PATH', '')
188 if conf.CheckPKG(KATE_LIBS):
189 ParsePKGConfig(env, KATE_LIBS)
190 env.Append(CCFLAGS=['-DHAVE_KATE', '-DHAVE_OGGKATE'])
191 else:
192 print """
193 Could not find libkate. Subtitles support will be disabled.
194 You can also run ./get_libkate.sh (for more information see INSTALL)
195 or update PKG_CONFIG_PATH to point to libkate's source folder
196 """
197
198 if conf.CheckCHeader('iconv.h'):
199 env.Append(CCFLAGS=[
200 '-DHAVE_ICONV'
201 ])
202 if conf.CheckLib('iconv'):
203 env.Append(LIBS=['iconv'])
204
205 if env['crossmingw']:
206 env.Append(CCFLAGS=['-Wl,-subsystem,windows'])
207 env.Append(LIBS=['m'])
208 elif env['static']:
209 env.Append(LIBS=['m', 'dl'])
210
187211
188212 env = conf.Finish()
189213
195219 ffmpeg2theora.Install(bin_dir, 'ffmpeg2theora')
196220 ffmpeg2theora.Install(man_dir + "/man1", 'ffmpeg2theora.1')
197221 ffmpeg2theora.Alias('install', prefix)
198
0 #!/bin/sh
1 . ./ffmpegrev
2
3
4 common="--enable-gpl --enable-postproc --disable-muxers --disable-encoders --enable-libvorbis"
5 common="$common --disable-ffmpeg --disable-ffplay --disable-ffserver --disable-ffprobe --disable-doc"
6
7 #optional, if you have those libs installed(requires GPL3):
8 #extra="$extra --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb"
9
10 #apt-get install liba52-dev libgsm1-dev
11 #extra="$extra --enable-libgsm"
12
13 #optional, if you have libvpx installed:
14 #extra="$extra --enable-libvpx"
15
16 #linux
17 options="$common --enable-pthreads $extra"
18
19 #mingw32
20 uname | grep MINGW && options="$common --enable-memalign-hack --enable-mingw32 --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib $extra"
21
22 #configure and build ffmpeg
23 cd $FFMPEG_CO_DIR && ./configure $options && make
24
+0
-1
debian/compat less more
0 5
+0
-21
debian/control less more
0 Source: ffmpeg2theora
1 Section: video
2 Priority: optional
3 Maintainer: Debian Multimedia Maintainers <pkg-multimedia-maintainers@lists.alioth.debian.org>
4 Uploaders: Tiago Bortoletto Vaz <tiago@debian.org>, RISKO Gergely <risko@debian.org>
5 DM-Upload-Allowed: yes
6 Build-Depends: quilt, debhelper (>= 7.0.50~), libavcodec-dev (>= 4:0.6), libavutil-dev, libpostproc-dev (>= 4:0.6),
7 libswscale-dev (>= 4:0.6), libavformat-dev (>= 4:0.6), libavdevice-dev (>= 4:0.6), libogg-dev, libvorbis-dev,
8 libtheora-dev, scons, pkg-config, libkate-dev, liboggkate-dev
9 Standards-Version: 3.9.2
10 Vcs-Browser: http://git.debian.org/?p=pkg-multimedia/ffmpeg2theora.git
11 Vcs-Git: git://git.debian.org/git/pkg-multimedia/ffmpeg2theora.git
12 Homepage: http://v2v.cc/~j/ffmpeg2theora/
13
14 Package: ffmpeg2theora
15 Architecture: any
16 Depends: ${shlibs:Depends}, ${misc:Depends}
17 Description: Theora video encoder using ffmpeg
18 This package provides a command-line tool to encode/recode various
19 video formats (basically everything that ffmpeg can read) into Theora,
20 the free video codec.
+0
-31
debian/copyright less more
0 This package was debianized by RISKO Gergely <risko@debian.org> on
1 Thu, 09 Jun 2005 15:55:02 +0200.
2
3 It was downloaded from http://www.v2v.cc/~j/ffmpeg2theora/index.html
4
5 Upstream Author: jan gerber <j@v2v.cc>
6
7 Copyright as mentioned in ffmpeg2theora.c source file:
8 /* -*- tab-width:4;c-file-style:"cc-mode"; -*- */
9 /*
10 * ffmpeg2theora.c -- Convert ffmpeg supported a/v files to Ogg Theora
11 * Copyright (C) 2003-2004 <j@v2v.cc>
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software Foundation,
25 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
26 *
27 */
28
29 You can find the mentioned GNU General Public License (GPL) (on a
30 Debian system) in the file /usr/share/common-licenses/GPL.
+0
-2
debian/docs less more
0 README
1 TODO
+0
-240
debian/patches/001-build-with-libav-0.7.patch less more
0 diff -pruN 0.27-1.1/src/avinfo.c 0.27-1.1ubuntu1/src/avinfo.c
1 --- 0.27-1.1/src/avinfo.c 2010-06-23 01:07:49.000000000 +0100
2 +++ 0.27-1.1ubuntu1/src/avinfo.c 2011-07-14 09:06:37.000000000 +0100
3 @@ -196,7 +196,7 @@ void json_codec_info(FILE *output, AVCod
4 }
5
6 switch(enc->codec_type) {
7 - case CODEC_TYPE_VIDEO:
8 + case AVMEDIA_TYPE_VIDEO:
9 codec_name = fix_codec_name(codec_name);
10 json_add_key_value(output, "codec", (void *)codec_name, JSON_STRING, 0, indent);
11 if (enc->pix_fmt != PIX_FMT_NONE) {
12 @@ -224,7 +224,7 @@ void json_codec_info(FILE *output, AVCod
13 json_add_key_value(output, "bitrate", &t, JSON_FLOAT, 0, indent);
14 }
15 break;
16 - case CODEC_TYPE_AUDIO:
17 + case AVMEDIA_TYPE_AUDIO:
18 codec_name = fix_codec_name(codec_name);
19 json_add_key_value(output, "codec", (void *)codec_name, JSON_STRING, 0, indent);
20 if (enc->sample_rate) {
21 @@ -277,15 +277,15 @@ void json_codec_info(FILE *output, AVCod
22 }
23 break;
24 /*
25 - case CODEC_TYPE_DATA:
26 + case AVMEDIA_TYPE_DATA:
27 fprintf(output, "datacodec: %s\n", codec_name);
28 bitrate = enc->bit_rate;
29 break;
30 - case CODEC_TYPE_SUBTITLE:
31 + case AVMEDIA_TYPE_SUBTITLE:
32 fprintf(output, "subtitle: %s\n", codec_name);
33 bitrate = enc->bit_rate;
34 break;
35 - case CODEC_TYPE_ATTACHMENT:
36 + case AVMEDIA_TYPE_ATTACHMENT:
37 fprintf(output, "attachment: : %s\n", codec_name);
38 bitrate = enc->bit_rate;
39 break;
40 @@ -330,7 +330,7 @@ static void json_stream_format(FILE *out
41 display_aspect_ratio.num, display_aspect_ratio.den);
42 json_add_key_value(output, "display_aspect_ratio", buf1, JSON_STRING, 0, indent + 1);
43 }
44 - if(st->codec->codec_type == CODEC_TYPE_VIDEO){
45 + if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO){
46 if (st->time_base.den && st->time_base.num && av_q2d(st->time_base) > 0.001) {
47 snprintf(buf1, sizeof(buf1), "%d:%d",
48 st->time_base.den, st->time_base.num);
49 @@ -340,6 +340,20 @@ static void json_stream_format(FILE *out
50 st->r_frame_rate.num, st->r_frame_rate.den);
51 json_add_key_value(output, "framerate", buf1, JSON_STRING, 0, indent + 1);
52 }
53 + if (st->sample_aspect_ratio.num && // default
54 + av_cmp_q(st->sample_aspect_ratio, st->codec->sample_aspect_ratio)) {
55 + AVRational display_aspect_ratio;
56 + av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
57 + st->codec->width*st->sample_aspect_ratio.num,
58 + st->codec->height*st->sample_aspect_ratio.den,
59 + 1024*1024);
60 + snprintf(buf1, sizeof(buf1), "%d:%d",
61 + st->sample_aspect_ratio.num, st->sample_aspect_ratio.den);
62 + json_add_key_value(output, "pixel_aspect_ratio", buf1, JSON_STRING, 0, indent+1);
63 + snprintf(buf1, sizeof(buf1), "%d:%d",
64 + display_aspect_ratio.num, display_aspect_ratio.den);
65 + json_add_key_value(output, "display_aspect_ratio", buf1, JSON_STRING, 0, indent+1);
66 + }
67 }
68 json_add_key_value(output, "id", &i, JSON_INT, 1, indent + 1);
69 do_indent(output, indent-1);
70 @@ -484,11 +498,11 @@ void json_format_info(FILE* output, AVFo
71 int j, k;
72 for(j=0; j<ic->nb_programs; j++) {
73 for(k=0; k<ic->programs[j]->nb_stream_indexes; k++)
74 - json_stream_format(output, ic, ic->programs[j]->stream_index[k], 2, !k && !j, CODEC_TYPE_VIDEO);
75 + json_stream_format(output, ic, ic->programs[j]->stream_index[k], 2, !k && !j, AVMEDIA_TYPE_VIDEO);
76 }
77 } else {
78 for(i=0;i<ic->nb_streams;i++) {
79 - json_stream_format(output, ic, i, 2, !i, CODEC_TYPE_VIDEO);
80 + json_stream_format(output, ic, i, 2, !i, AVMEDIA_TYPE_VIDEO);
81 }
82 }
83 fprintf(output, "],\n");
84 @@ -499,11 +513,11 @@ void json_format_info(FILE* output, AVFo
85 int j, k;
86 for(j=0; j<ic->nb_programs; j++) {
87 for(k=0; k<ic->programs[j]->nb_stream_indexes; k++)
88 - json_stream_format(output, ic, ic->programs[j]->stream_index[k], 2, !k && !j, CODEC_TYPE_AUDIO);
89 + json_stream_format(output, ic, ic->programs[j]->stream_index[k], 2, !k && !j, AVMEDIA_TYPE_AUDIO);
90 }
91 } else {
92 for(i=0;i<ic->nb_streams;i++) {
93 - json_stream_format(output, ic, i, 2, !i, CODEC_TYPE_AUDIO);
94 + json_stream_format(output, ic, i, 2, !i, AVMEDIA_TYPE_AUDIO);
95 }
96 }
97 fprintf(output, "],\n");
98 diff -pruN 0.27-1.1/src/ffmpeg2theora.c 0.27-1.1ubuntu1/src/ffmpeg2theora.c
99 --- 0.27-1.1/src/ffmpeg2theora.c 2010-06-23 01:07:49.000000000 +0100
100 +++ 0.27-1.1ubuntu1/src/ffmpeg2theora.c 2011-07-14 09:06:37.000000000 +0100
101 @@ -341,7 +341,7 @@ static void prepare_ycbcr_buffer(ff2theo
102 static const char *find_category_for_subtitle_stream (ff2theora this, int idx, int included_subtitles)
103 {
104 AVCodecContext *enc = this->context->streams[idx]->codec;
105 - if (enc->codec_type != CODEC_TYPE_SUBTITLE) return 0;
106 + if (enc->codec_type != AVMEDIA_TYPE_SUBTITLE) return 0;
107 switch (enc->codec_id) {
108 case CODEC_ID_TEXT:
109 case CODEC_ID_SSA:
110 @@ -500,9 +500,11 @@ static void extra_info_from_ssa(AVPacket
111
112 static const char *find_language_for_subtitle_stream(const AVStream *s)
113 {
114 - const char *lang=find_iso639_1(s->language);
115 + AVMetadataTag *language = av_metadata_get(s->metadata, "language", NULL, 0);
116 + const char *lang=find_iso639_1(language->value);
117 if (!lang) {
118 - fprintf(stderr,"WARNING - unrecognized ISO 639-2 language code: %s\n",s->language);
119 + fprintf(stderr, "WARNING - unrecognized ISO 639-2 language code: %s\n",
120 + language->value);
121 }
122 return lang;
123 }
124 @@ -516,8 +518,8 @@ void ff2theora_output(ff2theora this) {
125 AVStream *vstream = NULL;
126 AVCodec *acodec = NULL;
127 AVCodec *vcodec = NULL;
128 - pp_mode_t *ppMode = NULL;
129 - pp_context_t *ppContext = NULL;
130 + pp_mode *ppMode = NULL;
131 + pp_context *ppContext = NULL;
132 int sws_flags;
133 float frame_aspect = 0;
134 double fps = 0.0;
135 @@ -530,7 +532,7 @@ void ff2theora_output(ff2theora this) {
136
137 if (this->audiostream >= 0 && this->context->nb_streams > this->audiostream) {
138 AVCodecContext *enc = this->context->streams[this->audiostream]->codec;
139 - if (enc->codec_type == CODEC_TYPE_AUDIO) {
140 + if (enc->codec_type == AVMEDIA_TYPE_AUDIO) {
141 this->audio_index = this->audiostream;
142 fprintf(stderr, " Using stream #0.%d as audio input\n",this->audio_index);
143 }
144 @@ -540,7 +542,7 @@ void ff2theora_output(ff2theora this) {
145 }
146 if (this->videostream >= 0 && this->context->nb_streams > this->videostream) {
147 AVCodecContext *enc = this->context->streams[this->videostream]->codec;
148 - if (enc->codec_type == CODEC_TYPE_VIDEO) {
149 + if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
150 this->video_index = this->videostream;
151 fprintf(stderr, " Using stream #0.%d as video input\n",this->video_index);
152 }
153 @@ -552,11 +554,11 @@ void ff2theora_output(ff2theora this) {
154 for (i = 0; i < this->context->nb_streams; i++) {
155 AVCodecContext *enc = this->context->streams[i]->codec;
156 switch (enc->codec_type) {
157 - case CODEC_TYPE_VIDEO:
158 + case AVMEDIA_TYPE_VIDEO:
159 if (this->video_index < 0 && !this->disable_video)
160 this->video_index = i;
161 break;
162 - case CODEC_TYPE_AUDIO:
163 + case AVMEDIA_TYPE_AUDIO:
164 if (this->audio_index < 0 && !this->disable_audio)
165 this->audio_index = i;
166 break;
167 @@ -980,7 +982,7 @@ void ff2theora_output(ff2theora this) {
168 AVStream *stream = this->context->streams[i];
169 AVCodecContext *enc = stream->codec;
170 const char *category;
171 - if (enc->codec_type == CODEC_TYPE_SUBTITLE) {
172 + if (enc->codec_type == AVMEDIA_TYPE_SUBTITLE) {
173 AVCodec *codec = avcodec_find_decoder (enc->codec_id);
174 if (codec && avcodec_open (enc, codec) >= 0) {
175 subtitles_opened[i] = 1;
176 @@ -1451,9 +1453,11 @@ void ff2theora_output(ff2theora this) {
177 }
178 if (this->sws_scale_ctx) {
179 sws_scale(this->sws_scale_ctx,
180 - output_cropped->data, output_cropped->linesize, 0,
181 - display_height - (this->frame_topBand + this->frame_bottomBand),
182 - output_resized->data, output_resized->linesize);
183 + output_cropped->data,
184 + output_cropped->linesize, 0,
185 + display_height - (this->frame_topBand + this->frame_bottomBand),
186 + output_resized->data,
187 + output_resized->linesize);
188 }
189 else{
190 output_resized = output_cropped;
191 @@ -1512,7 +1516,7 @@ void ff2theora_output(ff2theora this) {
192 int samples=0;
193 int samples_out=0;
194 int data_size = 4*AVCODEC_MAX_AUDIO_FRAME_SIZE;
195 - int bytes_per_sample = av_get_bits_per_sample_format(aenc->sample_fmt)/8;
196 + int bytes_per_sample = av_get_bits_per_sample_fmt(aenc->sample_fmt)/8;
197
198 if (avpkt.size > 0) {
199 len1 = avcodec_decode_audio3(astream->codec, audio_buf, &data_size, &avpkt);
200 @@ -2726,8 +2730,7 @@ int main(int argc, char **argv) {
201
202 for(info.passno=(info.twopass==3?1:info.twopass);info.passno<=(info.twopass==3?2:info.twopass);info.passno++){
203 //detect image sequences and set framerate if provided
204 - if (av_guess_image2_codec(inputfile_name) != CODEC_ID_NONE || \
205 - (input_fmt != NULL && strcmp(input_fmt->name, "video4linux") >= 0)) {
206 + if (input_fmt != NULL && strcmp(input_fmt->name, "video4linux") >= 0) {
207 formatParams = &params;
208 memset(formatParams, 0, sizeof(*formatParams));
209 if (input_fmt != NULL && strcmp(input_fmt->name, "video4linux") >= 0) {
210 @@ -2748,7 +2751,6 @@ int main(int argc, char **argv) {
211 formatParams->time_base.den = convert->framerate_new.num;
212 formatParams->time_base.num = convert->framerate_new.den;
213 }
214 - formatParams->video_codec_id = av_guess_image2_codec(inputfile_name);
215 }
216 if (av_open_input_file(&convert->context, inputfile_name, input_fmt, 0, formatParams) >= 0) {
217 if (av_find_stream_info(convert->context) >= 0) {
218 @@ -2760,9 +2762,9 @@ int main(int argc, char **argv) {
219 for (i = 0; i < convert->context->nb_streams; i++) {
220 AVCodecContext *enc = convert->context->streams[i]->codec;
221 switch (enc->codec_type) {
222 - case CODEC_TYPE_VIDEO: has_video = 1; break;
223 - case CODEC_TYPE_AUDIO: has_audio = 1; break;
224 - case CODEC_TYPE_SUBTITLE: if (is_supported_subtitle_stream(convert, i, convert->included_subtitles)) has_kate = 1; break;
225 + case AVMEDIA_TYPE_VIDEO: has_video = 1; break;
226 + case AVMEDIA_TYPE_AUDIO: has_audio = 1; break;
227 + case AVMEDIA_TYPE_SUBTITLE: if (is_supported_subtitle_stream(convert, i, convert->included_subtitles)) has_kate = 1; break;
228 default: break;
229 }
230 }
231 @@ -2828,7 +2830,7 @@ int main(int argc, char **argv) {
232
233 if (!info.frontend) {
234 if (info.twopass!=3 || info.passno==1) {
235 - dump_format(convert->context, 0,inputfile_name, 0);
236 + av_dump_format(convert->context, 0,inputfile_name, 0);
237 }
238 }
239 if (convert->disable_audio) {
+0
-11
debian/patches/002-Makefile.patch less more
0 --- ffmpeg2theora-0.27.orig/Makefile
1 +++ ffmpeg2theora-0.27/Makefile
2 @@ -5,7 +5,7 @@ clean:
3 scons -c
4
5 install:
6 - scons install $(PREFIX)
7 + scons install destdir=$(CURDIR)/debian/ffmpeg2theora prefix=/usr mandir=$(CURDIR)/debian/ffmpeg2theora/usr/share/man
8
9 dist:
10 svn export . ffmpeg2theora-`grep ^pkg_version= SConstruct | cut -d\" -f2`
+0
-2
debian/patches/series less more
0 001-build-with-libav-0.7.patch
1 002-Makefile.patch
+0
-18
debian/rules less more
0 #!/usr/bin/make -f
1
2 #DEB_SCONS_OPTIONS := prefix=/usr destdir=$(DEB_DESTDIR) mandir=PREFIX/share/man
3
4 #PREFIX="prefix=$(CURDIR)/debian/ffmpeg2theora/usr destdir=$(CURDIR)/debian/ffmpeg2theora mandir=$(CURDIR)/debian/usr/share/man"
5
6 %:
7 dh $@ --with quilt
8
9 #override_dh_auto_build:
10 # scons
11 #
12 #override_dh_auto_install:
13 # PREFIX="destdir=$(CURDIR)/debian/ffmpeg2theora prefix=/usr mandir=$(CURDIR)/debian/usr/share/man"; make install
14
15 override_dh_auto_clean:
16 dh_auto_clean
17 rm -rf .sconf_temp/ .sconsign.dblite config.log
+0
-1
debian/source/format less more
0 3.0 (quilt)
+0
-1
debian/source/local-options less more
0 unapply-patches
+0
-3
debian/watch less more
0 # watch control file for uscan
1 version=2
2 http://www.v2v.cc/~j/ffmpeg2theora/download.html ffmpeg2theora-([\d\.]*)\.tar\.bz2
8888 but it is slower and therefore is disabled by default.
8989 .TP
9090 .B \-\-speedlevel
91 encoding is faster with higher values the cost is quality and bandwidth
92 0: Slowest (best)
93 1: Enable early skip (default)
94 2: Disable motion compensation
91 encoding is faster with higher values
92 the cost is quality and bandwidth (default 1)
93 available values depend on the version of libtheora
94 check ffmpeg2theora --help for supported values.
9595 .TP
9696 .B \-x, \-\-width
9797 Scale to given width (in pixels).
170170 Force deinterlace. Otherwise only material marked as interlaced will be
171171 deinterlaced.
172172 .TP
173 .B \-\-no-deinterlace
174 Force deinterlace off.
175 .TP
173176 .B \-\-vhook
174177 you can use ffmpeg's vhook system, example:
175178 ffmpeg2theora \-\-vhook '/path/watermark.so \-f wm.gif' input.dv
308311 ffmpeg2theora frame%06d.png -o output.ogv
309312
310313 Live streaming from V4L Device:
311 ffmpeg2theora /dev/video0 \-f video4linux \-\-inputfps 15 \-x 160 \-y 128 \\
312 \-o \- | oggfwd icast2server 8000 password /theora.ogv
314 ffmpeg2theora \-\-no\-skeleton /dev/video0 \-f video4linux \\
315 \-\-inputfps 15 \-x 160 \-y 128 \\
316 \-o \- | oggfwd icast2server 8000 password /theora.ogv
317
313318 (you might have to use video4linux2 depending on your hardware)
314319
315320 Live encoding from a DV camcorder (needs a fast machine):
317322
318323 Live encoding and streaming to icecast server:
319324 dvgrab \-\-format raw \- \\
320 | ffmpeg2theora \-f dv \-x 160 \-y 128 \-o /dev/stdout \- \\
321 | oggfwd icast2server 8000 password /theora.ogv
325 | ffmpeg2theora \-\-no\-skeleton \-f dv \-x 160 \-y 128 \-o /dev/stdout \- \\
326 | oggfwd icast2server 8000 password /theora.ogv
322327
323328
324329 .SH AUTHOR
0 <pkg-contents spec="1.12"><f n="ffmpeg2theora" o="root" g="wheel" p="16877" pt="/tmp/ffmpeg2theora/" m="false" t="file"><f n="usr" o="root" g="wheel" p="16877"><f n="local" o="root" g="wheel" p="16877"><f n="bin" o="root" g="wheel" p="16877"><f n="ffmpeg2theora" o="root" g="wheel" p="33261"><mod>owner</mod></f><mod>owner</mod></f><mod>owner</mod></f><mod>owner</mod></f><mod>owner</mod></f></pkg-contents>
0 <pkgref spec="1.12" uuid="01291888-CCA4-41A5-AAB3-BC2E3CFE6477"><config><identifier>cc.v2v.ffmpeg2theora</identifier><version>0.28</version><description/><post-install type="none"/><requireAuthorization/><installFrom mod="true">/tmp/ffmpeg2theora/</installFrom><installTo>/</installTo><flags><followSymbolicLinks/></flags><packageStore type="internal"/><mod>installTo.isRelativeType</mod><mod>installTo</mod><mod>installTo.isAbsoluteType</mod><mod>installFrom.path</mod><mod>identifier</mod><mod>parent</mod><mod>version</mod></config><contents><file-list>01ffmpeg-contents.xml</file-list><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass</filter></contents></pkgref>
0 <pkmkdoc spec="1.12"><properties><title>ffmpeg2theora</title><build>/Users/build/ffmpeg2theora-0.28.pkg</build><organization>org.xiph</organization><userSees ui="easy"/><min-target os="3"/><domain anywhere="true"/></properties><distribution><versions min-spec="1.000000"/><scripts></scripts></distribution><description>Commandline tool to encode video in Ogg Theora</description><contents><choice title="ffmpeg2theora" id="choice0" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="cc.v2v.ffmpeg2theora"/></choice></contents><resources bg-scale="none" bg-align="topleft"><locale lang="en"/></resources><flags/><item type="file">01ffmpeg.xml</item></pkmkdoc>
ffmpeg2theora.pmproj less more
Binary diff not shown
00 FFMPEG_CO_DIR=ffmpeg
1 FFMPEG_SVN=svn://svn.ffmpeg.org/ffmpeg/branches/0.6
2 #not required fro 0.6 branch
3 # Because ffmpeg checks out libswscale via an svn:externals, checking
4 # out an old ffmpeg does not check out a corresponding libswscale.
5 # Keep the swscale checkout manually synchronized, then. Update this
6 # when you update FFMPEG_REVISION.
7 #FFMPEG_REVISION=23309
8 #FFMPEG_EXTERNALS_REVISION=31211
1 FFMPEG_URL=git://git.videolan.org/ffmpeg
2 #FFMPEG_REVISION=54bc6403620286f595becd01842947395020e2f4
0 #!/bin/sh
1 cd `dirname $0`
2
3 # load FFMPEG specific properties
4 . ./ffmpegrev
5
6 test -e $FFMPEG_CO_DIR || git clone --depth 1 $FFMPEG_URL $FFMPEG_CO_DIR
7 cd $FFMPEG_CO_DIR
8 #git pull -r $FFMPEG_REVISION
9 #git checkout release/0.7
10 git checkout master
11 git pull
12 cd ..
13
14 apply_patches() {
15 cd $FFMPEG_CO_DIR
16 for patch in ../patches/*.patch; do
17 patch -p0 < $patch
18 done
19 touch .ffmpeg2theora_patched
20 cd ..
21 }
22
23 ./build_ffmpeg.sh
24
+0
-43
get_ffmpeg_svn.sh less more
0 #!/bin/sh
1
2 common="--enable-version3 --enable-gpl --enable-postproc --disable-muxers --disable-encoders --enable-libvorbis"
3 common="$common --disable-ffmpeg --disable-ffplay --disable-ffserver --disable-ffprobe --disable-doc"
4
5 #optional, if you have those libs installed:
6 #extra="--enable-libopencore-amrnb --enable-libopencore-amrwb"
7
8 #apt-get install liba52-dev libfaad-dev libgsm1-dev
9 #extra="$extra--enable-libfaad --enable-libgsm"
10
11 #optional, if you have libvpx installed:
12 #extra="--enable-libvpx"
13
14 #linux
15 options="$common --enable-pthreads $extra"
16
17 #mingw32
18 uname | grep MINGW && options="$common --enable-memalign-hack --enable-mingw32 --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib $extra"
19
20 # load FFMPEG specific properties
21 . ./ffmpegrev
22
23 #Get ffmpeg from svn
24 #svn -r $FFMPEG_REVISION co $FFMPEG_SVN $FFMPEG_CO_DIR
25 #svn update -r $FFMPEG_EXTERNALS_REVISION $FFMPEG_CO_DIR/libswscale
26
27 #Get ffmpeg from svn 0.6 branch
28 svn co $FFMPEG_SVN $FFMPEG_CO_DIR
29
30 apply_patches() {
31 cd ffmpeg
32 for patch in ../patches/*.patch; do
33 patch -p0 < $patch
34 done
35 touch .ffmpeg2theora_patched
36 cd ..
37 }
38
39 test -e ffmpeg/.ffmpeg2theora_patched || apply_patches
40 #configure and build ffmpeg
41 cd ffmpeg && ./configure $options && make
42
00 #!/bin/bash
11
2 version=0.3.7
2 version=0.4.1
33 baseurl="http://libkate.googlecode.com/files/libkate-$version.tar.gz"
44
55 which wget >& /dev/null
+0
-92
patches/6to2channel-resample.patch less more
0 Index: libavcodec/resample.c
1 ===================================================================
2 --- libavcodec/resample.c (revision 22168)
3 +++ libavcodec/resample.c (working copy)
4 @@ -52,6 +52,17 @@
5 unsigned buffer_size[2]; ///< sizes of allocated buffers
6 };
7
8 +/*
9 +*/
10 +static short clip_short(int v) {
11 + if (v < -32768)
12 + v = -32768;
13 + else if (v > 32767)
14 + v = 32767;
15 + return (short) v;
16 +}
17 +
18 +
19 /* n1: number of samples */
20 static void stereo_to_mono(short *output, short *input, int n1)
21 {
22 @@ -103,14 +114,43 @@
23 }
24 }
25
26 -/* XXX: should use more abstract 'N' channels system */
27 -static void stereo_split(short *output1, short *output2, short *input, int n)
28 -{
29 +/* XXX: make this better. channels will always be >= 2.
30 + - Left = front_left + rear_gain * rear_left + center_gain * center
31 + - Right = front_right + rear_gain * rear_right + center_gain * center
32 + where rear_gain is usually around 0.5-1.0 and center_gain is almost always 0.7 (-3 dB) if I recall correctly. */
33 +static void multi_to_stereo_split(short *output1, short *output2, short *input, int n, int channels) {
34 int i;
35 + short l,r;
36
37 for(i=0;i<n;i++) {
38 - *output1++ = *input++;
39 - *output2++ = *input++;
40 + if (channels == 2) {
41 + /* simple stereo to stereo. Input is: l, r */
42 + l = input[0];
43 + r = input[1];
44 + } else if (channels == 6) {
45 + /* 5.1 to stereo input: [fl, fr, c, lfe, rl, rr] */
46 + int fl,fr,c,rl,rr,lfe;
47 + fl = input[0];
48 + fr = input[1];
49 + c = input[2];
50 + lfe = input[3];
51 + rl = input[4];
52 + rr = input[5];
53 +
54 + l = clip_short(fl + (0.5 * rl) + (0.7 * c));
55 + r = clip_short(fr + (0.5 * rr) + (0.7 * c));
56 + } else {
57 + /* channels must be 3-5, or >= 7. l, c, r, ? */
58 + l = input[0];
59 + r = input[2];
60 + }
61 +
62 + /* output l & r. */
63 + *output1++ = l;
64 + *output2++ = r;
65 +
66 + /* increment input. */
67 + input += channels;
68 }
69 }
70
71 @@ -150,9 +190,9 @@
72 {
73 ReSampleContext *s;
74
75 - if ( input_channels > 2)
76 + if ((input_channels > 2) && (input_channels != 6))
77 {
78 - av_log(NULL, AV_LOG_ERROR, "Resampling with input channels greater than 2 unsupported.\n");
79 + av_log(NULL, AV_LOG_ERROR, "Resampling with input channels other than 1,2, or 6 is unsupported.\n");
80 return NULL;
81 }
82
83 @@ -312,7 +352,7 @@
84 } else if (s->output_channels >= 2) {
85 buftmp3[0] = bufout[0];
86 buftmp3[1] = bufout[1];
87 - stereo_split(buftmp2[0], buftmp2[1], input, nb_samples);
88 + multi_to_stereo_split(buftmp2[0], buftmp2[1], input, nb_samples, s->input_channels);
89 } else {
90 buftmp3[0] = output;
91 memcpy(buftmp2[0], input, nb_samples*sizeof(short));
+0
-23
patches/ogg_duration.patch less more
0 Index: libavformat/oggdec.c
1 ===================================================================
2 --- libavformat/oggdec.c (revision 19439)
3 +++ libavformat/oggdec.c (working copy)
4 @@ -469,6 +469,18 @@
5 ogg->size = size;
6 ogg_restore (s, 0);
7
8 + ogg_save (s);
9 + url_fseek (s->pb, 0, SEEK_SET);
10 + while (!ogg_read_page (s, &i)){
11 + if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 &&
12 + ogg->streams[i].codec) {
13 + s->streams[i]->duration -=
14 + ogg_gptopts (s, i, ogg->streams[i].granule, NULL);
15 + break;
16 + }
17 + }
18 + ogg_restore (s, 0);
19 +
20 return 0;
21 }
22
4343 i486-mingw32msvc-
4444 i586-mingw32msvc-
4545 i686-mingw32msvc-
46 i686-w64-mingw32-
4647 """)
4748
4849 def find(env):
00 /* -*- tab-width:4;c-file-style:"cc-mode"; -*- */
11 /*
22 * avinfo.c -- Convert ffmpeg supported a/v files to Ogg Theora / Vorbis
3 * Copyright (C) 2003-2009 <j@v2v.cc>
3 * Copyright (C) 2003-2011 <j@v2v.cc>
44 *
55 * gcc -o avinfo avinfo.c -DAVINFO `pkg-config --cflags --libs libavcodec libavformat`
66 *
77 * This program is free software: you can redistribute it and/or modify
88 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
9 * the Free Software Foundation, either version 2 of the License, or
1010 * (at your option) any later version.
1111 *
1212 * This program is distributed in the hope that it will be useful,
4141 #include <sys/stat.h>
4242
4343 #include "libavformat/avformat.h"
44 #include "libavutil/pixdesc.h"
4445
4546 #ifndef WIN32
4647 #if !defined(off64_t)
195196 }
196197
197198 switch(enc->codec_type) {
198 case CODEC_TYPE_VIDEO:
199 case AVMEDIA_TYPE_VIDEO:
199200 codec_name = fix_codec_name(codec_name);
200201 json_add_key_value(output, "codec", (void *)codec_name, JSON_STRING, 0, indent);
201202 if (enc->pix_fmt != PIX_FMT_NONE) {
202 json_add_key_value(output, "pixel_format", (void *)avcodec_get_pix_fmt_name(enc->pix_fmt), JSON_STRING, 0, indent);
203 json_add_key_value(output, "pixel_format", (void *)av_get_pix_fmt_name(enc->pix_fmt), JSON_STRING, 0, indent);
203204 }
204205 if (enc->width) {
205206 json_add_key_value(output, "width", &enc->width, JSON_INT, 0, indent);
223224 json_add_key_value(output, "bitrate", &t, JSON_FLOAT, 0, indent);
224225 }
225226 break;
226 case CODEC_TYPE_AUDIO:
227 case AVMEDIA_TYPE_AUDIO:
227228 codec_name = fix_codec_name(codec_name);
228229 json_add_key_value(output, "codec", (void *)codec_name, JSON_STRING, 0, indent);
229230 if (enc->sample_rate) {
276277 }
277278 break;
278279 /*
279 case CODEC_TYPE_DATA:
280 case AVMEDIA_TYPE_DATA:
280281 fprintf(output, "datacodec: %s\n", codec_name);
281282 bitrate = enc->bit_rate;
282283 break;
283 case CODEC_TYPE_SUBTITLE:
284 case AVMEDIA_TYPE_SUBTITLE:
284285 fprintf(output, "subtitle: %s\n", codec_name);
285286 bitrate = enc->bit_rate;
286287 break;
287 case CODEC_TYPE_ATTACHMENT:
288 case AVMEDIA_TYPE_ATTACHMENT:
288289 fprintf(output, "attachment: : %s\n", codec_name);
289290 bitrate = enc->bit_rate;
290291 break;
315316 fprintf(output, "{\n");
316317
317318 json_codec_info(output, st->codec, indent + 1);
318 if (st->sample_aspect_ratio.num && // default
319 av_cmp_q(st->sample_aspect_ratio, st->codec->sample_aspect_ratio)) {
320 AVRational display_aspect_ratio;
321 av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
322 st->codec->width*st->sample_aspect_ratio.num,
323 st->codec->height*st->sample_aspect_ratio.den,
324 1024*1024);
325 snprintf(buf1, sizeof(buf1), "%d:%d",
326 st->sample_aspect_ratio.num, st->sample_aspect_ratio.den);
327 json_add_key_value(output, "pixel_aspect_ratio", buf1, JSON_STRING, 0, indent + 1);
328 snprintf(buf1, sizeof(buf1), "%d:%d",
329 display_aspect_ratio.num, display_aspect_ratio.den);
330 json_add_key_value(output, "display_aspect_ratio", buf1, JSON_STRING, 0, indent + 1);
331 }
332 if(st->codec->codec_type == CODEC_TYPE_VIDEO){
319 if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO){
333320 if (st->time_base.den && st->time_base.num && av_q2d(st->time_base) > 0.001) {
334321 snprintf(buf1, sizeof(buf1), "%d:%d",
335322 st->time_base.den, st->time_base.num);
339326 st->r_frame_rate.num, st->r_frame_rate.den);
340327 json_add_key_value(output, "framerate", buf1, JSON_STRING, 0, indent + 1);
341328 }
329 if (st->sample_aspect_ratio.num && // default
330 av_cmp_q(st->sample_aspect_ratio, st->codec->sample_aspect_ratio)) {
331 AVRational display_aspect_ratio;
332 av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
333 st->codec->width*st->sample_aspect_ratio.num,
334 st->codec->height*st->sample_aspect_ratio.den,
335 1024*1024);
336 snprintf(buf1, sizeof(buf1), "%d:%d",
337 st->sample_aspect_ratio.num, st->sample_aspect_ratio.den);
338 json_add_key_value(output, "pixel_aspect_ratio", buf1, JSON_STRING, 0, indent+1);
339 snprintf(buf1, sizeof(buf1), "%d:%d",
340 display_aspect_ratio.num, display_aspect_ratio.den);
341 json_add_key_value(output, "display_aspect_ratio", buf1, JSON_STRING, 0, indent+1);
342 }
342343 }
343344 json_add_key_value(output, "id", &i, JSON_INT, 1, indent + 1);
344345 do_indent(output, indent-1);
357358 i+=4;
358359 continue;
359360 }
361 if (s[i] < 0) goto error;
360362 if (s[i] < 128) {
361363 i++;
362364 continue;
384386 error:
385387 return i == n;
386388 }
387
388 void json_metadata(FILE *output, const AVFormatContext *av)
389 int _json_metadata(FILE *output, AVDictionary *m, int first, int indent)
389390 {
390 int first = 1, indent=2;
391 AVMetadataTag *tag = NULL;
392 while ((tag = av_metadata_get(av->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) {
391 int i = 0;
392 AVDictionaryEntry *tag = NULL;
393 while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX))) {
393394 if (strlen(tag->value) && utf8_validate (tag->value, strlen(tag->value))) {
394395 if (first) {
395396 first = 0;
402403 }
403404 json_add_key_value(output, tag->key, tag->value, JSON_STRING, 1, indent);
404405 }
406 }
407 return first;
408 }
409
410 void json_metadata(FILE *output, const AVFormatContext *av)
411 {
412 int first = 1, indent=2, i=0;
413 first = _json_metadata(output, av->metadata, first, indent);
414
415 for(i=0;i<av->nb_streams;i++) {
416 first = _json_metadata(output, av->streams[i]->metadata, first, indent);
405417 }
406418 if (!first) {
407419 do_indent(output, 1);
483495 int j, k;
484496 for(j=0; j<ic->nb_programs; j++) {
485497 for(k=0; k<ic->programs[j]->nb_stream_indexes; k++)
486 json_stream_format(output, ic, ic->programs[j]->stream_index[k], 2, !k && !j, CODEC_TYPE_VIDEO);
498 json_stream_format(output, ic, ic->programs[j]->stream_index[k], 2, !k && !j, AVMEDIA_TYPE_VIDEO);
487499 }
488500 } else {
489501 for(i=0;i<ic->nb_streams;i++) {
490 json_stream_format(output, ic, i, 2, !i, CODEC_TYPE_VIDEO);
502 json_stream_format(output, ic, i, 2, !i, AVMEDIA_TYPE_VIDEO);
491503 }
492504 }
493505 fprintf(output, "],\n");
498510 int j, k;
499511 for(j=0; j<ic->nb_programs; j++) {
500512 for(k=0; k<ic->programs[j]->nb_stream_indexes; k++)
501 json_stream_format(output, ic, ic->programs[j]->stream_index[k], 2, !k && !j, CODEC_TYPE_AUDIO);
513 json_stream_format(output, ic, ic->programs[j]->stream_index[k], 2, !k && !j, AVMEDIA_TYPE_AUDIO);
502514 }
503515 } else {
504516 for(i=0;i<ic->nb_streams;i++) {
505 json_stream_format(output, ic, i, 2, !i, CODEC_TYPE_AUDIO);
517 json_stream_format(output, ic, i, 2, !i, AVMEDIA_TYPE_AUDIO);
506518 }
507519 }
508520 fprintf(output, "],\n");
00 /* -*- tab-width:4;c-file-style:"cc-mode"; -*- */
11 /*
22 * ffmpeg2theora.c -- Convert ffmpeg supported a/v files to Ogg Theora / Vorbis
3 * Copyright (C) 2003-2009 <j@v2v.cc>
3 * Copyright (C) 2003-2011 <j@v2v.cc>
44 *
55 * This program is free software: you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
7 * the Free Software Foundation, either version 2 of the License, or
88 * (at your option) any later version.
99 *
1010 * This program is distributed in the hope that it will be useful,
5151 enum {
5252 NULL_FLAG,
5353 DEINTERLACE_FLAG,
54 NODEINTERLACE_FLAG,
5455 SOFTTARGET_FLAG,
5556 TWOPASS_FLAG,
5657 FIRSTPASS_FLAG,
8485 FRONTENDFILE_FLAG,
8586 SPEEDLEVEL_FLAG,
8687 PP_FLAG,
88 RESIZE_METHOD_FLAG,
8789 NOSKELETON,
8890 SKELETON_3,
8991 INDEX_INTERVAL,
232234 this->uv_lut_used = 0;
233235 this->sws_colorspace_ctx = NULL;
234236 this->sws_scale_ctx = NULL;
237
238 this->resize_method = -1;
235239 }
236240 return this;
237241 }
340344 static const char *find_category_for_subtitle_stream (ff2theora this, int idx, int included_subtitles)
341345 {
342346 AVCodecContext *enc = this->context->streams[idx]->codec;
343 if (enc->codec_type != CODEC_TYPE_SUBTITLE) return 0;
347 if (enc->codec_type != AVMEDIA_TYPE_SUBTITLE) return 0;
344348 switch (enc->codec_id) {
345349 case CODEC_ID_TEXT:
346350 case CODEC_ID_SSA:
499503
500504 static const char *find_language_for_subtitle_stream(const AVStream *s)
501505 {
502 const char *lang=find_iso639_1(s->language);
506 AVDictionaryEntry *language = av_dict_get(s->metadata, "language", NULL, 0);
507 const char *lang=find_iso639_1(language->value);
503508 if (!lang) {
504 fprintf(stderr,"WARNING - unrecognized ISO 639-2 language code: %s\n",s->language);
509 fprintf(stderr, "WARNING - unrecognized ISO 639-2 language code: %s\n",
510 language->value);
505511 }
506512 return lang;
507513 }
510516 unsigned int i;
511517 AVCodecContext *aenc = NULL;
512518 AVCodecContext *venc = NULL;
513 int venc_pix_fmt;
519 int venc_pix_fmt = 0;
514520 AVStream *astream = NULL;
515521 AVStream *vstream = NULL;
516522 AVCodec *acodec = NULL;
517523 AVCodec *vcodec = NULL;
518 pp_mode_t *ppMode = NULL;
519 pp_context_t *ppContext = NULL;
520 int sws_flags;
524 pp_mode *ppMode = NULL;
525 pp_context *ppContext = NULL;
526 int sws_flags = this->resize_method;
521527 float frame_aspect = 0;
522528 double fps = 0.0;
523529 AVRational vstream_fps;
524 int display_width, display_height;
530 int display_width = -1, display_height = -1;
525531 char *subtitles_enabled = (char*)alloca(this->context->nb_streams);
526532 char *subtitles_opened = (char*)alloca(this->context->nb_streams);
527533 int synced = this->start_time == 0.0;
529535
530536 if (this->audiostream >= 0 && this->context->nb_streams > this->audiostream) {
531537 AVCodecContext *enc = this->context->streams[this->audiostream]->codec;
532 if (enc->codec_type == CODEC_TYPE_AUDIO) {
538 if (enc->codec_type == AVMEDIA_TYPE_AUDIO) {
533539 this->audio_index = this->audiostream;
534540 fprintf(stderr, " Using stream #0.%d as audio input\n",this->audio_index);
535541 }
539545 }
540546 if (this->videostream >= 0 && this->context->nb_streams > this->videostream) {
541547 AVCodecContext *enc = this->context->streams[this->videostream]->codec;
542 if (enc->codec_type == CODEC_TYPE_VIDEO) {
548 if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
543549 this->video_index = this->videostream;
544550 fprintf(stderr, " Using stream #0.%d as video input\n",this->video_index);
545551 }
551557 for (i = 0; i < this->context->nb_streams; i++) {
552558 AVCodecContext *enc = this->context->streams[i]->codec;
553559 switch (enc->codec_type) {
554 case CODEC_TYPE_VIDEO:
560 case AVMEDIA_TYPE_VIDEO:
555561 if (this->video_index < 0 && !this->disable_video)
556562 this->video_index = i;
557563 break;
558 case CODEC_TYPE_AUDIO:
564 case AVMEDIA_TYPE_AUDIO:
559565 if (this->audio_index < 0 && !this->disable_audio)
560566 this->audio_index = i;
561567 break;
568574 vstream = this->context->streams[this->video_index];
569575 venc = vstream->codec;
570576 vcodec = avcodec_find_decoder (venc->codec_id);
577
571578 display_width = venc->width;
572579 display_height = venc->height;
573580 venc_pix_fmt = venc->pix_fmt;
587594 }
588595 this->fps = fps = av_q2d(vstream_fps);
589596
590 if (vcodec == NULL || avcodec_open (venc, vcodec) < 0) {
597 if (vcodec == NULL || avcodec_open2 (venc, vcodec, NULL) < 0) {
591598 this->video_index = -1;
592599 }
593600 this->fps = fps;
697704 this->frame_aspect.num = width;
698705 this->frame_aspect.den = height;
699706 }
700 if (av_q2d(this->frame_aspect) <= 1.5) {
701 this->picture_width=128;
702 this->picture_height=96;
703 }
704 else {
705 this->picture_width=128;
706 this->picture_height=72;
707 }
707
708 this->picture_width=128;
709 this->picture_height=128/av_q2d(this->frame_aspect);
710
708711 this->frame_aspect.num = this->picture_width;
709712 this->frame_aspect.den = this->picture_height;
710713 }
850853 fprintf(stderr, " Frame Aspect Ratio: %.2f/1\n", frame_aspect);
851854 }
852855
853 if (!(info.twopass==3 && info.passno==2) && !info.frontend && this->deinterlace==1)
856 if (!(info.twopass==3 && info.passno==2) && !info.frontend &&
857 this->deinterlace==1)
854858 fprintf(stderr, " Deinterlace: on\n");
859 if (!(info.twopass==3 && info.passno==2) && !info.frontend &&
860 this->deinterlace==-1)
861 fprintf(stderr, " Deinterlace: off\n");
855862
856863 if (strcmp(this->pp_mode, "")) {
857864 ppContext = pp_get_context(display_width, display_height, PP_FORMAT_420);
881888 this->frame_y_offset = this->frame_height-this->picture_height>>1&~1;
882889
883890 //Bicubic (best for upscaling),
884 if(display_width - (this->frame_leftBand + this->frame_rightBand) < this->picture_width ||
885 display_height - (this->frame_topBand + this->frame_bottomBand) < this->picture_height) {
886 sws_flags = SWS_BICUBIC;
887 } else { //Bilinear (best for downscaling),
888 sws_flags = SWS_BILINEAR;
891 if (sws_flags < 0) {
892 if(display_width - (this->frame_leftBand + this->frame_rightBand) < this->picture_width ||
893 display_height - (this->frame_topBand + this->frame_bottomBand) < this->picture_height) {
894 sws_flags = SWS_BICUBIC;
895 } else { //Bilinear (best for downscaling),
896 sws_flags = SWS_BILINEAR;
897 }
889898 }
890899
891900 if (this->frame_width > 0 || this->frame_height > 0) {
930939 astream = this->context->streams[this->audio_index];
931940 aenc = this->context->streams[this->audio_index]->codec;
932941 acodec = avcodec_find_decoder (aenc->codec_id);
942 int sample_rate = aenc->sample_rate;
933943 if (this->channels < 1) {
934944 this->channels = aenc->channels;
935945 }
944954 this->channels = aenc->channels;
945955 }
946956
947 if (acodec != NULL && avcodec_open (aenc, acodec) >= 0) {
948 if (this->sample_rate != aenc->sample_rate
957 if (acodec != NULL && avcodec_open2 (aenc, acodec, NULL) >= 0) {
958 if (this->sample_rate != sample_rate
949959 || this->channels != aenc->channels
950 || aenc->sample_fmt != SAMPLE_FMT_S16) {
960 || aenc->sample_fmt != AV_SAMPLE_FMT_S16) {
951961 // values take from libavcodec/resample.c
952962 this->audio_resample_ctx = av_audio_resample_init(this->channels, aenc->channels,
953 this->sample_rate, aenc->sample_rate,
954 SAMPLE_FMT_S16, aenc->sample_fmt,
963 this->sample_rate, sample_rate,
964 AV_SAMPLE_FMT_S16, aenc->sample_fmt,
955965 16, 10, 0, 0.8);
956966 if (!this->audio_resample_ctx) {
957967 this->channels = aenc->channels;
958968 }
959 if (!info.frontend && this->sample_rate!=aenc->sample_rate)
960 fprintf(stderr, " Resample: %dHz => %dHz\n",aenc->sample_rate,this->sample_rate);
969 if (!info.frontend && this->sample_rate!=sample_rate)
970 fprintf(stderr, " Resample: %dHz => %dHz\n", sample_rate,this->sample_rate);
961971 if (!info.frontend && this->channels!=aenc->channels)
962972 fprintf(stderr, " Channels: %d => %d\n",aenc->channels,this->channels);
963973 }
979989 AVStream *stream = this->context->streams[i];
980990 AVCodecContext *enc = stream->codec;
981991 const char *category;
982 if (enc->codec_type == CODEC_TYPE_SUBTITLE) {
992 if (enc->codec_type == AVMEDIA_TYPE_SUBTITLE) {
983993 AVCodec *codec = avcodec_find_decoder (enc->codec_id);
984 if (codec && avcodec_open (enc, codec) >= 0) {
994 if (codec && avcodec_open2 (enc, codec, NULL) >= 0) {
985995 subtitles_opened[i] = 1;
986996 }
987997 category = find_category_for_subtitle_stream(this, i, this->included_subtitles);
12821292 ki->gps_denominator = 1;
12831293 }
12841294 ki->granule_shift = 32;
1285 ki->original_canvas_width = display_width;
1286 ki->original_canvas_height = display_height;
1295 if (display_width >= 0)
1296 ki->original_canvas_width = display_width;
1297 if (display_height >= 0)
1298 ki->original_canvas_height = display_height;
12871299 }
12881300 }
12891301 }
12921304 oggmux_init(&info);
12931305 /*seek to start time*/
12941306 if (this->start_time) {
1295 av_seek_frame( this->context, -1, (int64_t)AV_TIME_BASE*this->start_time, 1);
1307 int64_t timestamp = this->start_time * AV_TIME_BASE;
1308 /* add the stream start time */
1309 if (this->context->start_time != AV_NOPTS_VALUE)
1310 timestamp += this->context->start_time;
1311 av_seek_frame( this->context, -1, timestamp, AVSEEK_FLAG_BACKWARD);
12961312 /* discard subtitles by their end time, so we still have those that start before the start time,
12971313 but end after it */
12981314 if (info.passno != 1) {
14151431 display_width, display_height);
14161432 output_tmp_p=NULL;
14171433 }
1418 if (frame->interlaced_frame || this->deinterlace) {
1434 if ((this->deinterlace==0 && frame->interlaced_frame) ||
1435 this->deinterlace==1) {
14191436 if (avpicture_deinterlace((AVPicture *)output,(AVPicture *)output_tmp,this->pix_fmt,display_width,display_height)<0) {
14201437 fprintf(stderr, "Deinterlace failed.\n");
14211438 exit(1);
14501467 }
14511468 if (this->sws_scale_ctx) {
14521469 sws_scale(this->sws_scale_ctx,
1453 output_cropped->data, output_cropped->linesize, 0,
1454 display_height - (this->frame_topBand + this->frame_bottomBand),
1455 output_resized->data, output_resized->linesize);
1470 output_cropped->data,
1471 output_cropped->linesize, 0,
1472 display_height - (this->frame_topBand + this->frame_bottomBand),
1473 output_resized->data,
1474 output_resized->linesize);
14561475 }
14571476 else{
14581477 output_resized = output_cropped;
15111530 int samples=0;
15121531 int samples_out=0;
15131532 int data_size = 4*AVCODEC_MAX_AUDIO_FRAME_SIZE;
1514 int bytes_per_sample = av_get_bits_per_sample_format(aenc->sample_fmt)/8;
1533 int bytes_per_sample = av_get_bytes_per_sample(aenc->sample_fmt);
15151534
15161535 if (avpkt.size > 0) {
15171536 len1 = avcodec_decode_audio3(astream->codec, audio_buf, &data_size, &avpkt);
16831702 while (ks->subtitles_count < ks->num_subtitles && sub->t0-1.0 <= avtime+this->start_time) {
16841703 #ifdef HAVE_KATE
16851704 if (sub->text) {
1686 oggmux_add_kate_text(&info, i, sub->t0, sub->t1, sub->text, sub->len);
1705 oggmux_add_kate_text(&info, i, sub->t0, sub->t1, sub->text, sub->len, sub->x1, sub->x2, sub->y1, sub->y2);
16871706 }
16881707 else {
16891708 oggmux_add_kate_image(&info, i, sub->t0, sub->t1, &sub->kr, &sub->kp, &sub->kb);
17661785 /* clear out state */
17671786 if (info.passno != 1)
17681787 free_subtitles(this);
1788 this->context = NULL;
17691789 if (info.twopass != 3) {
17701790 av_free(this);
17711791 }
18461866 return crop_value;
18471867 }
18481868
1869 static const struct {
1870 const char *name;
1871 int method;
1872 } resize_methods[] = {
1873 { "fast-bilinear", SWS_FAST_BILINEAR },
1874 { "bilinear", SWS_BILINEAR },
1875 { "bicubic", SWS_BICUBIC },
1876 { "x", SWS_X },
1877 { "point", SWS_POINT },
1878 { "area", SWS_AREA },
1879 { "bicublin", SWS_BICUBLIN },
1880 { "gauss", SWS_GAUSS },
1881 { "sinc", SWS_SINC },
1882 { "lanczos", SWS_LANCZOS },
1883 { "spline", SWS_SPLINE },
1884 };
1885
1886 static int get_resize_method_by_name(const char *name)
1887 {
1888 int n;
1889 for (n=0; n<sizeof(resize_methods)/sizeof(resize_methods[0]); ++n) {
1890 if (!strcmp(resize_methods[n].name, name))
1891 return resize_methods[n].method;
1892 }
1893 return -1;
1894 }
1895
1896 static void print_resize_help(void)
1897 {
1898 int n;
1899 printf("Known resize methods:\n");
1900 for (n=0; n<sizeof(resize_methods)/sizeof(resize_methods[0]); ++n) {
1901 printf(" %s\n",resize_methods[n].name);
1902 }
1903 }
1904
18491905 void copy_metadata(const AVFormatContext *av)
18501906 {
18511907 static const char *allowed[] = {
18671923
18681924 "AUTHOR"
18691925 };
1870 AVMetadataTag *tag = NULL;
1871 while ((tag = av_metadata_get(av->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) {
1926 AVDictionaryEntry *tag = NULL;
1927 while ((tag = av_dict_get(av->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
18721928 char uc_key[16];
18731929 int i;
18741930 for (i = 0; tag->key[i] != '\0' && i < LENGTH(uc_key) - 1; i++)
19171973 }
19181974
19191975 void print_usage() {
1976 th_info ti;
1977 th_enc_ctx *td;
1978 int max_speed_level = -1;
1979
1980 th_info_init(&ti);
1981 ti.pic_width = ti.frame_width = 320;
1982 ti.pic_height = ti.frame_height = 240;
1983 td = th_encode_alloc(&ti);
1984 th_encode_ctl(td, TH_ENCCTL_GET_SPLEVEL_MAX, &max_speed_level, sizeof(int));
1985 th_encode_free(td);
1986
19201987 fprintf(stdout,
1921 PACKAGE " " PACKAGE_VERSION " - %s\n", th_version_string());
1988 PACKAGE " " PACKAGE_VERSION "\n\n"
1989 "\t%s\n"
1990 "\t%s\n",
1991 th_version_string(),
1992 vorbis_version_string());
1993
1994 unsigned int version = avcodec_version();
1995 fprintf(stdout, "\tFFmpeg\t libavcodec %02d.%d.%d\n",
1996 version >> 16, version >> 8 & 0xff, version & 0xff);
1997 version = avformat_version();
1998 fprintf(stdout, "\tFFmpeg\t libavformat %02d.%d.%d\n",
1999 version >> 16, version >> 8 & 0xff, version & 0xff);
2000
19222001 fprintf(stdout,
1923 "\n"
2002 "\n\n"
19242003 " Usage: " PACKAGE " [options] input\n"
19252004 "\n"
19262005 "General output options:\n"
19592038 " --optimize optimize video output filesize (slower)\n"
19602039 " (same as speedlevel 0)\n"
19612040 " --speedlevel encoding is faster with higher values\n"
1962 " the cost is quality and bandwidth\n"
1963 " - 0: Slowest (best)\n"
1964 " - 1: Enable early skip (default)\n"
1965 " - 2: Disable motion compensation\n"
2041 " the cost is quality and bandwidth (default 1)\n"
2042 " available values depend on the version of libtheora\n"
2043 " your version supports speedlevels 0 to %d\n"
19662044
19672045 " -x, --width scale to given width (in pixels)\n"
19682046 " -y, --height scale to given height (in pixels)\n"
19852063 " two-pass encoding. (only works in bitrate mode)\n"
19862064 " --no-upscaling only scale video or resample audio if input is\n"
19872065 " bigger than provided parameters\n"
2066 " --resize-method <method> Use this method for rescaling the video\n"
2067 " See --resize-method help for a list of available\n"
2068 " resizing methods\n"
19882069 "\n"
19892070 "Video transfer options:\n"
19902071 " --pp Video Postprocessing, denoise, deblock, deinterlacer\n"
20102091 "Input options:\n"
20112092 " --deinterlace force deinterlace, otherwise only material\n"
20122093 " marked as interlaced will be deinterlaced\n"
2094 " --no-deinterlace force deinterlace off\n"
20132095 #ifdef HAVE_FRAMEHOOK
20142096 " --vhook you can use ffmpeg's vhook system, example:\n"
20152097 " ffmpeg2theora --vhook '/path/watermark.so -f wm.gif' input.dv\n"
20802162 " ffmpeg2theora frame%%06d.png -o output.ogv\n"
20812163 "\n"
20822164 " Live streaming from V4L Device:\n"
2083 " ffmpeg2theora /dev/video0 -f video4linux --inputfps 15 -x 160 -y 128 -o - \\\n"
2084 " | oggfwd icast2server 8000 password /theora.ogv\n"
2165 " ffmpeg2theora --no-skeleton /dev/video0 -f video4linux \\\n"
2166 " --inputfps 15 -x 160 -y 128 -o - \\\n"
2167 " | oggfwd icast2server 8000 password /theora.ogv\n"
2168 "\n"
20852169 " (you might have to use video4linux2 depending on your hardware)\n"
20862170 "\n"
20872171 " Live encoding from a DV camcorder (needs a fast machine):\n"
20882172 " dvgrab - | ffmpeg2theora -f dv -x 352 -y 288 -o output.ogv -\n"
20892173 "\n"
20902174 " Live encoding and streaming to icecast server:\n"
2091 " dvgrab --format raw - \\\n"
2092 " | ffmpeg2theora -f dv -x 160 -y 128 -o /dev/stdout - \\\n"
2093 " | oggfwd icast2server 8000 password /theora.ogv\n"
2175 " dvgrab --format raw - \\\n"
2176 " | ffmpeg2theora --no-skeleton -f dv -x 160 -y 128 -o /dev/stdout - \\\n"
2177 " | oggfwd icast2server 8000 password /theora.ogv\n"
20942178 "\n"
2095 );
2179 ,max_speed_level);
20962180 exit(0);
20972181 }
20982182
21092193 static int metadata_flag = -1;
21102194
21112195 AVInputFormat *input_fmt = NULL;
2112 AVFormatParameters params, *formatParams = NULL;
2196 AVDictionary *format_opts = NULL;
21132197
21142198 int c,long_option_index;
21152199 const char *optstring = "P:o:k:f:F:x:y:v:V:a:A:K:d:H:c:G:Z:C:B:p:N:s:e:D:h::";
21382222 {"keyint",required_argument,NULL,'K'},
21392223 {"buf-delay",required_argument,NULL,'d'},
21402224 {"deinterlace",0,&flag,DEINTERLACE_FLAG},
2225 {"no-deinterlace",0,&flag,NODEINTERLACE_FLAG},
21412226 {"pp",required_argument,&flag,PP_FLAG},
2227 {"resize-method",required_argument,&flag,RESIZE_METHOD_FLAG},
21422228 {"samplerate",required_argument,NULL,'H'},
21432229 {"channels",required_argument,NULL,'c'},
21442230 {"gamma",required_argument,NULL,'G'},
22242310 convert->deinterlace = 1;
22252311 flag = -1;
22262312 break;
2313 case NODEINTERLACE_FLAG:
2314 convert->deinterlace = -1;
2315 flag = -1;
2316 break;
22272317 case SOFTTARGET_FLAG:
22282318 convert->soft_target = 1;
22292319 flag = -1;
22732363 exit(1);
22742364 }
22752365 snprintf(convert->pp_mode,sizeof(convert->pp_mode),"%s",optarg);
2366 flag = -1;
2367 break;
2368 case RESIZE_METHOD_FLAG:
2369 if (!strcmp(optarg, "help")) {
2370 print_resize_help();
2371 exit(1);
2372 }
2373 convert->resize_method = get_resize_method_by_name(optarg);
22762374 flag = -1;
22772375 break;
22782376 case VHOOK_FLAG:
26972795
26982796 if (convert->soft_target) {
26992797 if (convert->video_bitrate <= 0) {
2700 fprintf(stderr,"Soft rate target (--soft-tagret) requested without a bitrate (-V).\n");
2798 fprintf(stderr,"Soft rate target (--soft-target) requested without a bitrate (-V).\n");
27012799 exit(1);
27022800 }
27032801 if (convert->video_quality == -1)
27252823
27262824 for(info.passno=(info.twopass==3?1:info.twopass);info.passno<=(info.twopass==3?2:info.twopass);info.passno++){
27272825 //detect image sequences and set framerate if provided
2728 if (av_guess_image2_codec(inputfile_name) != CODEC_ID_NONE || \
2729 (input_fmt != NULL && strcmp(input_fmt->name, "video4linux") >= 0)) {
2730 formatParams = &params;
2731 memset(formatParams, 0, sizeof(*formatParams));
2732 if (input_fmt != NULL && strcmp(input_fmt->name, "video4linux") >= 0) {
2733 formatParams->channel = 0;
2734 formatParams->width = PAL_HALF_WIDTH;
2735 formatParams->height = PAL_HALF_HEIGHT;
2736 formatParams->time_base.den = 25;
2737 formatParams->time_base.num = 2;
2738 if (convert->picture_width)
2739 formatParams->width = convert->picture_width;
2740 if (convert->picture_height)
2741 formatParams->height = convert->picture_height;
2826 if (input_fmt != NULL && strcmp(input_fmt->name, "video4linux") >= 0) {
2827 char buf[100];
2828 av_dict_set(&format_opts, "channel", "0", 0);
2829 if (convert->picture_width || convert->picture_height) {
2830 snprintf(buf, sizeof(buf), "%dx%d",
2831 convert->picture_width, convert->picture_height);
2832 av_dict_set(&format_opts,"video_size", buf, 0);
27422833 }
27432834 if (convert->force_input_fps.num > 0) {
2744 formatParams->time_base.den = convert->force_input_fps.num;
2745 formatParams->time_base.num = convert->force_input_fps.den;
2835 snprintf(buf, sizeof(buf), "%d/%d",
2836 convert->force_input_fps.den, convert->force_input_fps.num);
2837 av_dict_set(&format_opts, "framerate", buf, 0);
27462838 } else if (convert->framerate_new.num > 0) {
2747 formatParams->time_base.den = convert->framerate_new.num;
2748 formatParams->time_base.num = convert->framerate_new.den;
2749 }
2750 formatParams->video_codec_id = av_guess_image2_codec(inputfile_name);
2751 }
2752 if (av_open_input_file(&convert->context, inputfile_name, input_fmt, 0, formatParams) >= 0) {
2753 if (av_find_stream_info(convert->context) >= 0) {
2839 snprintf(buf, sizeof(buf), "%d/%d",
2840 convert->framerate_new.den, convert->framerate_new.num);
2841 av_dict_set(&format_opts, "framerate", buf, 0);
2842 }
2843 }
2844 if (avformat_open_input(&convert->context, inputfile_name, input_fmt, &format_opts) >= 0) {
2845 if (avformat_find_stream_info(convert->context, NULL) >= 0) {
27542846
27552847 if (output_filename_needs_building) {
27562848 int i;
27592851 for (i = 0; i < convert->context->nb_streams; i++) {
27602852 AVCodecContext *enc = convert->context->streams[i]->codec;
27612853 switch (enc->codec_type) {
2762 case CODEC_TYPE_VIDEO: has_video = 1; break;
2763 case CODEC_TYPE_AUDIO: has_audio = 1; break;
2764 case CODEC_TYPE_SUBTITLE: if (is_supported_subtitle_stream(convert, i, convert->included_subtitles)) has_kate = 1; break;
2854 case AVMEDIA_TYPE_VIDEO: has_video = 1; break;
2855 case AVMEDIA_TYPE_AUDIO: has_audio = 1; break;
2856 case AVMEDIA_TYPE_SUBTITLE: if (is_supported_subtitle_stream(convert, i, convert->included_subtitles)) has_kate = 1; break;
27652857 default: break;
27662858 }
27672859 }
27802872 /* reserve 4 bytes in the buffer for the `.og[va]' extension */
27812873 snprintf(outputfile_name, sizeof(outputfile_name) - strlen(ext), "%s",inputfile_name);
27822874 if ((str_ptr = strrchr(outputfile_name, '.'))) {
2783 sprintf(str_ptr, ext);
2875 sprintf(str_ptr, "%s", ext);
27842876 if (!strcmp(inputfile_name, outputfile_name)) {
27852877 snprintf(outputfile_name, sizeof(outputfile_name), "%s%s", inputfile_name, ext);
27862878 }
28272919
28282920 if (!info.frontend) {
28292921 if (info.twopass!=3 || info.passno==1) {
2830 dump_format(convert->context, 0,inputfile_name, 0);
2922 av_dump_format(convert->context, 0,inputfile_name, 0);
28312923 }
2832 }
2833 if (convert->disable_audio) {
2834 fprintf(stderr, " [audio disabled].\n");
2835 }
2836 if (convert->disable_video) {
2837 fprintf(stderr, " [video disabled].\n");
2838 }
2839 if (!convert->included_subtitles) {
2840 fprintf(stderr, " [subtitles disabled].\n");
2924 if (convert->disable_audio) {
2925 fprintf(stderr, " [audio disabled].\n");
2926 }
2927 if (convert->disable_video) {
2928 fprintf(stderr, " [video disabled].\n");
2929 }
2930 if (!convert->included_subtitles) {
2931 fprintf(stderr, " [subtitles disabled].\n");
2932 }
28412933 }
28422934 if (convert->disable_metadata) {
2843 fprintf(stderr, " [metadata disabled].\n");
2935 if (!info.frontend)
2936 fprintf(stderr, " [metadata disabled].\n");
28442937 } else {
28452938 copy_metadata(convert->context);
28462939 }
28472940
2848 if (!convert->sync) {
2941 if (!convert->sync && !info.frontend) {
28492942 fprintf(stderr, " Ignore A/V Sync from input container.\n");
28502943 }
28512944
28762969 fprintf(stderr,"\nUnable to decode input.\n");
28772970 return(1);
28782971 }
2879 av_close_input_file(convert->context);
2972 avformat_close_input(&convert->context);
28802973 }
28812974 else{
28822975 if (info.frontend)
28982991 if (info.twopass_file)
28992992 fclose(info.twopass_file);
29002993
2901 if (info.frontend)
2994 if (info.frontend) {
29022995 fprintf(info.frontend, "{\"result\": \"ok\"}\n");
2903 if (info.frontend && info.frontend != stderr)
2996 fflush(info.frontend);
2997 }
2998 if (info.frontend && info.frontend != stdout)
29042999 fclose(info.frontend);
29053000 #ifdef WIN32
29063001 if (info.twopass==3)
29073002 unlink(_tmp_2pass);
29083003 #endif
3004 av_dict_free(&format_opts);
29093005 return(0);
29103006 }
1212 kate_palette kp;
1313 kate_bitmap kb;
1414 #endif
15 int x1,x2,y1,y2;
1516 } ff2theora_subtitle;
1617
1718 typedef struct ff2theora_kate_stream{
7475 int video_bitrate;
7576 ogg_uint32_t keyint;
7677 char pp_mode[255];
78 int resize_method;
7779
7880 AVRational force_input_fps;
7981 int sync;
66 *
77 * This program is free software: you can redistribute it and/or modify
88 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
9 * the Free Software Foundation, either version 2 of the License, or
1010 * (at your option) any later version.
1111 *
1212 * This program is distributed in the hope that it will be useful,
66 *
77 * This program is free software: you can redistribute it and/or modify
88 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
9 * the Free Software Foundation, either version 2 of the License, or
1010 * (at your option) any later version.
1111 *
1212 * This program is distributed in the hope that it will be useful,
00 /* -*- tab-width:4;c-file-style:"cc-mode"; -*- */
11 /*
22 * subtitles.c -- Kate Subtitles
3 * Copyright (C) 2003-2009 <j@v2v.cc>
3 * Copyright (C) 2003-2011 <j@v2v.cc>
44 *
55 * This program is free software: you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
7 * the Free Software Foundation, either version 2 of the License, or
88 * (at your option) any later version.
99 *
1010 * This program is distributed in the hope that it will be useful,
180180
181181 static char *fgets2(char *s,size_t sz,FILE *f)
182182 {
183 char *ret = fgets(s, sz, f);
183 char *ret = fgets(s, sz, f);
184 if (ret) {
184185 /* fixup DOS newline character */
185186 char *ptr=strchr(s, '\r');
186187 if (ptr) {
187188 *ptr='\n';
188189 *(ptr+1)=0;
189190 }
190 return ret;
191 }
192 else *s=0;
193 return ret;
191194 }
192195
193196 static double hmsms2s(int h,int m,int s,int ms)
330333 }
331334 }
332335
336 static int store_subtitle(ff2theora_kate_stream *this,
337 char *text, double t0, double t1, int x1, int x2, int y1, int y2,
338 int ignore_non_utf8,int *warned, unsigned int line, FILE *frontend)
339 {
340 char *utf8;
341 size_t len;
342 int ret;
343
344 remove_last_newline(text);
345
346 /* we want all text to be UTF-8 */
347 utf8=convert_subtitle_to_utf8(this->subtitles_encoding,text,ignore_non_utf8, frontend);
348 if (!utf8) {
349 warn(frontend, this->filename, line, "Failed to get UTF-8 text");
350 return -1;
351 }
352
353 len = strlen(utf8);
354 this->subtitles = (ff2theora_subtitle*)realloc(this->subtitles, (this->num_subtitles+1)*sizeof(ff2theora_subtitle));
355 if (!this->subtitles) {
356 free(utf8);
357 warn(frontend, NULL, 0, "Out of memory");
358 return -1;
359 }
360 ret=kate_text_validate(kate_utf8,utf8,len+1);
361 if (ret<0) {
362 if (!*warned) {
363 warn(frontend, this->filename, line, "subtitle is not valid UTF-8: %s",utf8);
364 if (!frontend)
365 fprintf(stderr," further invalid subtitles will NOT be flagged\n");
366 *warned=1;
367 }
368 }
369 else {
370 /* kill off trailing \n characters */
371 while (len>0) {
372 if (utf8[len-1]=='\n') utf8[--len]=0; else break;
373 }
374 this->subtitles[this->num_subtitles].text = utf8;
375 this->subtitles[this->num_subtitles].len = len;
376 this->subtitles[this->num_subtitles].t0 = t0;
377 this->subtitles[this->num_subtitles].t1 = t1;
378 this->subtitles[this->num_subtitles].x1 = x1;
379 this->subtitles[this->num_subtitles].x2 = x2;
380 this->subtitles[this->num_subtitles].y1 = y1;
381 this->subtitles[this->num_subtitles].y2 = y2;
382 this->num_subtitles++;
383 }
384
385 return 0;
386 }
387
333388 #endif
334389
335390 int load_subtitles(ff2theora_kate_stream *this, int ignore_non_utf8, FILE *frontend)
342397 int id;
343398 static char text[4096];
344399 int h0,m0,s0,ms0,h1,m1,s1,ms1;
400 int x1,x2,y1,y2;
345401 double t0=0.0;
346402 double t1=0.0;
347403 static char str[4096];
348404 int warned=0;
349405 FILE *f;
350 size_t len;
351406 unsigned int line=0;
352 char *utf8;
353407
354408 this->subtitles = NULL;
355409
373427
374428 fgets2(str,sizeof(str),f);
375429 ++line;
376 while (!feof(f)) {
430 while (!feof(f) || *str) {
377431 switch (need) {
378432 case need_id:
379433 if (!strcmp(str,"\n")) {
396450 }
397451 break;
398452 case need_timing:
399 ret=sscanf(str,"%d:%d:%d%*[.,]%d --> %d:%d:%d%*[.,]%d\n",&h0,&m0,&s0,&ms0,&h1,&m1,&s1,&ms1);
400 if (ret!=8 || (h0|m0|s0|ms0)<0 || (h1|m1|s1|ms1)<0) {
401 warn(frontend, this->filename, line, "Syntax error: %s",str);
453 ret=sscanf(str,"%d:%d:%d%*[.,]%d --> %d:%d:%d%*[.,]%d %*[xX]1: %d %*[xX]2: %d %*[yY]1: %d %*[yY]2: %d\n",&h0,&m0,&s0,&ms0,&h1,&m1,&s1,&ms1,&x1,&x2,&y1,&y2);
454 if (ret!=12) {
455 x1=y1=x2=y2=-INT_MAX;
456 ret=sscanf(str,"%d:%d:%d%*[.,]%d --> %d:%d:%d%*[.,]%d\n",&h0,&m0,&s0,&ms0,&h1,&m1,&s1,&ms1);
457 if (ret!=8) {
458 warn(frontend, this->filename, line, "Syntax error: %s",str);
459 fclose(f);
460 free(this->subtitles);
461 return -1;
462 }
463 }
464 t0=hmsms2s(h0,m0,s0,ms0);
465 t1=hmsms2s(h1,m1,s1,ms1);
466 if ((h0|m0|s0|ms0)<0 || (h1|m1|s1|ms1)<0) {
467 warn(frontend, this->filename, line, "Bad timestamp specification: %s",str);
402468 fclose(f);
403469 free(this->subtitles);
404470 return -1;
405 }
406 else {
407 t0=hmsms2s(h0,m0,s0,ms0);
408 t1=hmsms2s(h1,m1,s1,ms1);
409471 }
410472 need=need_text;
411473 break;
412474 case need_text:
413475 if (str[0]=='\n') {
414476 /* we have all the lines for that subtitle, remove the last \n */
415 remove_last_newline(text);
416
417 /* we want all text to be UTF-8 */
418 utf8=convert_subtitle_to_utf8(this->subtitles_encoding,text,ignore_non_utf8, frontend);
419 if (!utf8) {
420 warn(frontend, this->filename, line, "Failed to get UTF-8 text");
477 int ret = store_subtitle(this, text, t0, t1, x1, x2, y1, y2, ignore_non_utf8, &warned, line, frontend);
478 if (ret < 0) {
421479 fclose(f);
422480 free(this->subtitles);
423 return -1;
424 break;
425 }
426
427 len = strlen(utf8);
428 this->subtitles = (ff2theora_subtitle*)realloc(this->subtitles, (this->num_subtitles+1)*sizeof(ff2theora_subtitle));
429 if (!this->subtitles) {
430 free(utf8);
431 warn(frontend, NULL, 0, "Out of memory");
432 fclose(f);
433 free(this->subtitles);
434 return -1;
435 }
436 ret=kate_text_validate(kate_utf8,utf8,len+1);
437 if (ret<0) {
438 if (!warned) {
439 warn(frontend, this->filename, line, "subtitle is not valid UTF-8: %s",utf8);
440 if (!frontend)
441 fprintf(stderr," further invalid subtitles will NOT be flagged\n");
442 warned=1;
443 }
444 }
445 else {
446 /* kill off trailing \n characters */
447 while (len>0) {
448 if (utf8[len-1]=='\n') utf8[--len]=0; else break;
449 }
450 this->subtitles[this->num_subtitles].text = utf8;
451 this->subtitles[this->num_subtitles].len = len;
452 this->subtitles[this->num_subtitles].t0 = t0;
453 this->subtitles[this->num_subtitles].t1 = t1;
454 this->num_subtitles++;
481 return ret;
455482 }
456483 need=need_id;
457484 }
458485 else {
459486 /* in case of very long subtitles */
460 len=strlen(text);
487 size_t len=strlen(text);
461488 if (len+strlen(str) >= sizeof(text)) {
462489 warn(frontend, this->filename, line, "Subtitle text is too long - truncated");
463490 }
472499
473500 fclose(f);
474501
475 #if 0
476 // there seems to be quite a lot of files like this, so disable this test.
477502 if (need!=need_id) {
478503 /* shouldn't be a problem though, but warn */
479504 warn(frontend, this->filename, line, "Missing data in - truncated file ?");
480 }
481 #endif
505
506 /* add any leftover text we've accumulated */
507 if (need == need_text && text[0]) {
508 int ret = store_subtitle(this, text, t0, t1, x1, x2, y1, y2, ignore_non_utf8, &warned, line, frontend);
509 if (ret < 0) {
510 fclose(f);
511 free(this->subtitles);
512 return ret;
513 }
514 }
515 }
482516
483517 /* fprintf(stderr," %u subtitles loaded.\n", this->num_subtitles); */
484518
521555 ks->subtitles[ks->num_subtitles].len = utf8len;
522556 ks->subtitles[ks->num_subtitles].t0 = t;
523557 ks->subtitles[ks->num_subtitles].t1 = t+duration;
558 ks->subtitles[ks->num_subtitles].x1 = -INT_MAX;
559 ks->subtitles[ks->num_subtitles].x2 = -INT_MAX;
560 ks->subtitles[ks->num_subtitles].y1 = -INT_MAX;
561 ks->subtitles[ks->num_subtitles].y2 = -INT_MAX;
524562 ks->num_subtitles++;
525563 }
526564 }
00 /* -*- tab-width:4;c-file-style:"cc-mode"; -*- */
11 /*
22 * theorautils.c - Ogg Theora/Ogg Vorbis Abstraction and Muxing
3 * Copyright (C) 2003-2009 <j@v2v.cc>
3 * Copyright (C) 2003-2011 <j@v2v.cc>
44 *
55 * This program is free software: you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
7 * the Free Software Foundation, either version 2 of the License, or
88 * (at your option) any later version.
99 *
1010 * This program is distributed in the hope that it will be useful,
3535 #endif
3636 #endif
3737
38 #ifdef WIN32
39 #define fseeko fseeko64
40 #define ftello ftello64
41 #endif
42
4338 #include <stdio.h>
4439 #include <stdlib.h>
4540 #include <unistd.h>
4944 #include <assert.h>
5045 #include <math.h>
5146 #include <limits.h>
47
48 #ifdef WIN32
49 #if !defined(fseeko)
50 #define fseeko fseeko64
51 #define ftello ftello64
52 #endif
53 #endif
5254
5355 #include "theora/theoraenc.h"
5456 #include "vorbis/codec.h"
105107
106108 info->prev_vorbis_window = -1;
107109 info->content_offset = 0;
110
111 info->serialno = 0;
108112 }
109113
110114 void oggmux_setup_kate_streams(oggmux_info *info, int n_kate_streams)
530534 int index_bytes = 0;
531535 int keypoints_cutoff = 0;
532536
533 /* Must have indexed keypoints. */
534 assert(index->max_keypoints > 0 && index->packet_num > 0);
537 /* Must have indexed keypoints to go on */
538 if (index->max_keypoints == 0 || index->packet_num == 0) {
539 fprintf(stderr, "WARNING: no key points for %s stream %08x\n", name, serialno);
540 return 0;
541 }
542
535543 /* Must have placeholder packet to rewrite. */
536544 assert(index->page_location > 0);
537545
812820
813821 /* yayness. Set up Ogg output stream */
814822 srand (time (NULL));
815 ogg_stream_init (&info->vo, rand ());
823 info->serialno = rand();
824 ogg_stream_init (&info->vo, info->serialno++);
816825
817826 if (info->passno!=1) {
818827 th_comment_add_tag(&info->tc, "ENCODER", PACKAGE_STRING);
824833 }
825834
826835 if (!info->audio_only) {
827 ogg_stream_init (&info->to, rand ()); /* oops, add one ot the above */
836 ogg_stream_init (&info->to, info->serialno++);
828837 seek_index_init(&info->theora_index, info->index_interval);
829838 }
830839 /* init theora done */
850859 vorbis_block_init (&info->vd, &info->vb);
851860
852861 seek_index_init(&info->vorbis_index, info->index_interval);
862 info->vorbis_granulepos = 0;
853863 }
854864 /* audio init done */
855865
859869 int ret, n;
860870 for (n=0; n<info->n_kate_streams; ++n) {
861871 oggmux_kate_stream *ks=info->kate_streams+n;
862 ogg_stream_init (&ks->ko, rand ()); /* oops, add one ot the above */
872 ogg_stream_init (&ks->ko, info->serialno++);
863873 ret = kate_encode_init (&ks->k, &ks->ki);
864874 if (ret<0) {
865875 fprintf(stderr, "kate_encode_init: %d\n",ret);
878888 }
879889 /* kate init done */
880890
881 if (!info->skeleton_3 &&
891 if (info->with_skeleton &&
892 !info->skeleton_3 &&
882893 info->duration == -1)
883894 {
884895 /* We've not got a duration, we can't index the keyframes. */
896907 page with a Skeleton4.0 header page. */
897908 int skeleton_3 = info->skeleton_3;
898909 info->skeleton_3 = 1;
899 ogg_stream_init (&info->so, rand());
910 ogg_stream_init (&info->so, info->serialno++);
900911 add_fishead_packet (info, 3, 0);
901912 if (ogg_stream_pageout (&info->so, &og) != 1) {
902913 fprintf (stderr, "Internal Ogg library error.\n");
920931 exit (1);
921932 }
922933 ogg_stream_clear (&info->so);
923 ogg_stream_init (&info->so, rand());
934 ogg_stream_init (&info->so, info->serialno++);
924935 add_fishead_packet (info, 4, 0);
925936 if (ogg_stream_pageout (&info->so, &og) != 1) {
926937 fprintf (stderr, "Internal Ogg library error.\n");
12141225 void oggmux_add_audio (oggmux_info *info, int16_t * buffer, int bytes, int samples, int e_o_s) {
12151226 ogg_packet op;
12161227
1217 int i,j, count = 0;
1228 int i, j, k, count = 0;
12181229 float **vorbis_buffer;
12191230
12201231 if (bytes <= 0 && samples <= 0) {
12271238 /* uninterleave samples */
12281239 for (i = 0; i < samples; i++) {
12291240 for (j=0;j<info->channels;j++) {
1230 vorbis_buffer[j][i] = buffer[count++] / 32768.f;
1241 k = j;
1242 /* 5.1 input: [fl, fr, c, lfe, rl, rr] */
1243 if(info->channels == 6) {
1244 switch(j) {
1245 case 0: k = 0; break;
1246 case 1: k = 2; break;
1247 case 2: k = 1; break;
1248 case 3: k = 5; break;
1249 case 4: k = 3; break;
1250 case 5: k = 4; break;
1251 default: k = j;
1252 }
1253 }
1254 vorbis_buffer[k][i] = buffer[count++] / 32768.f;
12311255 }
12321256 }
12331257 vorbis_analysis_wrote (&info->vd, samples);
12581282 info->prev_vorbis_window = info->vb.pcmend;
12591283
12601284 ogg_int64_t start_granule = op.granulepos - num_samples;
1285 if (start_granule < 0) {
1286 /* The first vorbis content packet can have more samples than
1287 its granulepos reports. This is allowed by the spec, and
1288 players should discard the leading samples and not play them.
1289 Thus the indexer needs to discard them as well.*/
1290 if (op.packetno != 4) {
1291 /* We only expect negative start granule in the first content
1292 packet, not any of the others... */
1293 fprintf(stderr, "WARNING: vorbis packet %lld has calculated start"
1294 " granule of %lld, but it should be non-negative!",
1295 op.packetno, start_granule);
1296 }
1297 start_granule = 0;
1298 }
1299 if (start_granule < info->vorbis_granulepos) {
1300 /* This packet starts before the end of the previous packet. This is
1301 allowed by the specification in the last packet only, and the
1302 trailing samples should be discarded and not played/indexed. */
1303 if (!op.e_o_s) {
1304 fprintf(stderr, "WARNING: vorbis packet %lld (granulepos %lld) starts before"
1305 " the end of the preceeding packet!", op.packetno, op.granulepos);
1306 }
1307 start_granule = info->vorbis_granulepos;
1308 }
1309 info->vorbis_granulepos = op.granulepos;
12611310 ogg_int64_t start_time = vorbis_time (&info->vd, start_granule);
12621311
12631312 if (op.granulepos != -1 &&
13021351 * @param text the utf-8 text
13031352 * @param len the number of bytes in the text
13041353 */
1305 void oggmux_add_kate_text (oggmux_info *info, int idx, double t0, double t1, const char *text, size_t len) {
1354 void oggmux_add_kate_text (oggmux_info *info, int idx, double t0, double t1, const char *text, size_t len, int x1, int x2, int y1, int y2) {
13061355 ogg_packet op;
13071356 oggmux_kate_stream *ks=info->kate_streams+idx;
13081357 int ret;
1358 if (x1!=-INT_MAX && y1!=-INT_MAX && x2!=-INT_MAX && y2!=-INT_MAX) {
1359 kate_region kr;
1360 kate_region_init(&kr);
1361 kr.metric=kate_pixel;
1362 kr.x=x1;
1363 kr.y=y1;
1364 kr.w=x2-x1+1;
1365 kr.h=y2-y1+1;
1366 ret=kate_encode_set_region(&ks->k,&kr);
1367 if (ret<0) {
1368 fprintf(stderr,"Error setting region: %d\n",ret);
1369 return;
1370 }
1371 }
13091372 ret = kate_ogg_encode_text(&ks->k, t0, t1, text, len, &op);
13101373 if (ret>=0) {
13111374 if (!info->skeleton_3 && info->passno != 1) {
14441507 else if (timebase - last > 0.5 || timebase < last || !remaining) {
14451508 last = timebase;
14461509 if (info->frontend) {
1510 #ifdef WIN32
1511 fprintf(info->frontend, "{\"duration\": %f, \"position\": %.02f, \"audio_kbps\": %d, \"video_kbps\": %d, \"remaining\": %.02f}\n",
1512 info->duration,
1513 timebase,
1514 info->akbps, info->vkbps,
1515 remaining
1516 );
1517 #else
14471518 fprintf(info->frontend, "{\"duration\": %lf, \"position\": %.02lf, \"audio_kbps\": %d, \"video_kbps\": %d, \"remaining\": %.02lf}\n",
14481519 info->duration,
14491520 timebase,
14501521 info->akbps, info->vkbps,
14511522 remaining
14521523 );
1524 #endif
14531525 fflush (info->frontend);
14541526 }
14551527 else if (timebase > 0) {
44 *
55 * This program is free software: you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
7 * the Free Software Foundation, either version 2 of the License, or
88 * (at your option) any later version.
99 *
1010 * This program is distributed in the hope that it will be useful,
156156 calculate duration of vorbis packets. */
157157 /* The offset of the first non header page in bytes. */
158158 ogg_int64_t content_offset;
159 /* Granulepos of the last encoded packet. */
160 ogg_int64_t vorbis_granulepos;
161
162 ogg_int32_t serialno;
159163 }
160164 oggmux_info;
161165
165169 extern void oggmux_add_video (oggmux_info *info, th_ycbcr_buffer ycbcr, int e_o_s);
166170 extern void oggmux_add_audio (oggmux_info *info, int16_t * readbuffer, int bytesread, int samplesread,int e_o_s);
167171 #ifdef HAVE_KATE
168 extern void oggmux_add_kate_text (oggmux_info *info, int idx, double t0, double t1, const char *text, size_t len);
172 extern void oggmux_add_kate_text (oggmux_info *info, int idx, double t0, double t1, const char *text, size_t len, int x1, int x2, int y1, int y2);
169173 extern void oggmux_add_kate_image (oggmux_info *info, int idx, double t0, double t1, const kate_region *kr, const kate_palette *kp, const kate_bitmap *kb);
170174 extern void oggmux_add_kate_end_packet (oggmux_info *info, int idx, double t);
171175 #endif
0 #!/bin/bash
1 cd `dirname $0`
2 version='0.29'
3 test -e .svn && svnversion=`which svnversion`
4 echo -n $version
5 if [ "x$svnversion" != "x" ]; then
6 echo -n "+svn"
7 svnversion
8 else
9 echo
10 fi