mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-07-05 21:40:25 +00:00
Removed download archive of Opus tools and updated Opus licence.
This avoids having to distribute opusinfo, which had a GPL licence attached. A link to the download and the Opus homepage remains in conversion/download.txt.
This commit is contained in:
parent
d7aad9cc49
commit
beb3f089d8
|
@ -27,345 +27,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
|
||||
Opusinfo is a fork of ogginfo from the vorbis-tools package
|
||||
(http://www.xiph.org). It is available under the GPL:
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
(http://www.xiph.org). Opusinfo has been removed from this version of Opus-tools.
|
||||
|
|
2
internal/c/parts/audio/conversion/download.txt
Normal file
2
internal/c/parts/audio/conversion/download.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
This resampler comes from Opus Tools 0.1.9, downloaded from https://ftp.mozilla.org/pub/mozilla.org/opus/opus-tools-0.1.9.tar.gz
|
||||
The homepage for the project is http://www.opus-codec.org/downloads/
|
|
@ -1,5 +0,0 @@
|
|||
Gregory Maxwell (greg@xiph.org)
|
||||
Jean-Marc Valin - Original opusdec implementation / Resampler
|
||||
Thorvald Natvig - Resampler
|
||||
Michael Smith - Ogginfo (basis of opusinfo)
|
||||
John Edwards - Windows audio output
|
|
@ -1,371 +0,0 @@
|
|||
|
||||
Opus-tools, with the exception of opusinfo.[ch] is available under
|
||||
the following two clause BSD-style license:
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Opusinfo is a fork of ogginfo from the vorbis-tools package
|
||||
(http://www.xiph.org). It is available under the GPL:
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
|
@ -1,3 +0,0 @@
|
|||
2012-05-16 Gregory Maxwell <greg@xiph.org>
|
||||
|
||||
* Initial public version, 0.1.0
|
|
@ -1,110 +0,0 @@
|
|||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
#AUTOMAKE_OPTIONS = subdir-objects 1.6 dist-zip
|
||||
AUTOMAKE_OPTIONS = subdir-objects 1.11 dist-zip dist-xz
|
||||
|
||||
SUBDIRS = .
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/win32 -D_FORTIFY_SOURCE=2
|
||||
AM_CFLAGS = $(OPUS_CFLAGS) $(OGG_CFLAGS)
|
||||
|
||||
bin_PROGRAMS = opusenc opusdec opusinfo
|
||||
noinst_PROGRAMS = opusrtp
|
||||
|
||||
noinst_HEADERS = src/arch.h \
|
||||
src/diag_range.h \
|
||||
src/flac.h \
|
||||
src/info_opus.h \
|
||||
src/lpc.h \
|
||||
src/opusenc.h \
|
||||
src/opus_header.h \
|
||||
src/opusinfo.h \
|
||||
src/os_support.h \
|
||||
src/picture.h \
|
||||
src/resample_sse.h \
|
||||
src/speex_resampler.h \
|
||||
src/stack_alloc.h \
|
||||
win32/unicode_support.h \
|
||||
src/cpusupport.h \
|
||||
src/wave_out.h \
|
||||
src/wav_io.h
|
||||
|
||||
EXTRA_DIST = Makefile.unix \
|
||||
man/opusrtp.1 \
|
||||
opus-tools.sln \
|
||||
src/opusdec.vcxproj.filters \
|
||||
src/opusinfo.vcxproj.filters \
|
||||
src/opusenc.vcxproj.filters \
|
||||
src/opusinfo.vcxproj \
|
||||
src/opusenc.vcxproj \
|
||||
src/opusdec.vcxproj \
|
||||
include/getopt.h \
|
||||
share/getopt.c \
|
||||
share/getopt1.c \
|
||||
win32/genversion.bat \
|
||||
win32/config.h \
|
||||
win32/unicode_support.h \
|
||||
win32/unicode_support.c \
|
||||
win32/version.h
|
||||
|
||||
dist_man_MANS = man/opusenc.1 man/opusdec.1 man/opusinfo.1
|
||||
|
||||
resampler_CPPFLAGS = -DSPX_RESAMPLE_EXPORT= -DRANDOM_PREFIX=opustools -DOUTSIDE_SPEEX -DFLOATING_POINT
|
||||
|
||||
opusenc_SOURCES = src/opus_header.c src/opusenc.c src/picture.c src/resample.c src/audio-in.c src/diag_range.c src/flac.c src/lpc.c win32/unicode_support.c
|
||||
opusenc_CPPFLAGS = $(AM_CPPFLAGS) $(resampler_CPPFLAGS)
|
||||
opusenc_CFLAGS = $(AM_CFLAGS) $(FLAC_CFLAGS)
|
||||
opusenc_LDADD = $(OPUS_LIBS) $(FLAC_LIBS) $(OGG_LIBS) $(LIBM)
|
||||
opusenc_MANS = man/opusenc.1
|
||||
|
||||
opusdec_SOURCES = src/opus_header.c src/wav_io.c src/wave_out.c src/opusdec.c src/resample.c src/diag_range.c win32/unicode_support.c
|
||||
opusdec_CPPFLAGS = $(AM_CPPFLAGS) $(resampler_CPPFLAGS)
|
||||
opusdec_LDADD = $(OPUS_LIBS) $(OGG_LIBS) $(LIBM)
|
||||
opusdec_MANS = man/opusdec.1
|
||||
|
||||
opusinfo_SOURCES = src/opus_header.c src/opusinfo.c src/info_opus.c src/picture.c win32/unicode_support.c
|
||||
opusinfo_CPPFLAGS = $(AM_CPPFLAGS) -DOPUSTOOLS
|
||||
opusinfo_LDADD = $(OGG_LIBS)
|
||||
opusinfo_MANS = man/opusinfo.1
|
||||
|
||||
opusrtp_SOURCES = src/opusrtp.c
|
||||
opusrtp_LDADD = $(OPUS_LIBS) $(OGG_LIBS) @LIBPCAP@
|
||||
|
||||
#TESTS = FIXME
|
||||
|
||||
|
||||
# We check this every time make is run, with configure.ac being touched to
|
||||
# trigger an update of the build system files if update_version changes the
|
||||
# current PACKAGE_VERSION (or if package_version was modified manually by a
|
||||
# user with either AUTO_UPDATE=no or no update_version script present - the
|
||||
# latter being the normal case for tarball releases).
|
||||
#
|
||||
# We can't just add the package_version file to CONFIGURE_DEPENDENCIES since
|
||||
# simply running autoconf will not actually regenerate configure for us when
|
||||
# the content of that file changes (due to autoconf dependency checking not
|
||||
# knowing about that without us creating yet another file for it to include).
|
||||
#
|
||||
# The MAKECMDGOALS check is a gnu-make'ism, but will degrade 'gracefully' for
|
||||
# makes that don't support it. The only loss of functionality is not forcing
|
||||
# an update of package_version for `make dist` if AUTO_UPDATE=no, but that is
|
||||
# unlikely to be a real problem for any real user.
|
||||
$(top_srcdir)/configure.ac: force
|
||||
@case "$(MAKECMDGOALS)" in \
|
||||
dist-hook) exit 0 ;; \
|
||||
dist-* | dist | distcheck | distclean) _arg=release ;; \
|
||||
esac; \
|
||||
if ! $(top_srcdir)/update_version $$_arg 2> /dev/null; then \
|
||||
if [ ! -e $(top_srcdir)/package_version ]; then \
|
||||
echo 'PACKAGE_VERSION="unknown"' > $(top_srcdir)/package_version; \
|
||||
fi; \
|
||||
. $(top_srcdir)/package_version || exit 1; \
|
||||
[ "$(PACKAGE_VERSION)" != "$$PACKAGE_VERSION" ] || exit 0; \
|
||||
fi; \
|
||||
touch $@
|
||||
|
||||
force:
|
||||
|
||||
# Create a minimal package_version file when make dist is run.
|
||||
dist-hook:
|
||||
echo 'PACKAGE_VERSION="$(PACKAGE_VERSION)"' > $(top_distdir)/package_version
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -1,64 +0,0 @@
|
|||
#Opus-tools should be built with autotools, not this makefile.
|
||||
#Run ./configure to run autotools/autoconf.
|
||||
#This makefile exists as a fallback where autotools isn't working.
|
||||
|
||||
-include package_version
|
||||
|
||||
#CC=gcc
|
||||
CFLAGS := -O2 -g -c -Wall -Wextra -DHAVE_LIBFLAC $(CFLAGS)
|
||||
INCLUDES := -I../opus/include -I/usr/include/FLAC
|
||||
|
||||
ifneq (,$(findstring mingw,$(CC)))
|
||||
INCLUDES += -Iwin32
|
||||
COMMON_OBJS += win32/unicode_support.o
|
||||
CFLAGS += -DHAVE_WINMM
|
||||
LIBS += -lwinmm
|
||||
endif
|
||||
|
||||
PROGS := opusenc opusdec opusinfo
|
||||
all: $(PROGS)
|
||||
|
||||
clean:
|
||||
rm -f src/*.o win32/*.o $(PROGS) opusrtp
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
|
||||
VERSIONED_OBJS = src/opusenc.o src/opusdec.o src/opusinfo.o src/opusrtp.o \
|
||||
src/wave_out.o
|
||||
|
||||
$(VERSIONED_OBJS): CFLAGS += -DPACKAGE_NAME='"opus-tools"' -DPACKAGE_VERSION='$(PACKAGE_VERSION)'
|
||||
$(VERSIONED_OBJS): package_version
|
||||
|
||||
RESAMPLER_CPPFLAGS = -DSPX_RESAMPLE_EXPORT= -DRANDOM_PREFIX=opustools -DOUTSIDE_SPEEX -DFLOATING_POINT
|
||||
|
||||
src/opusdec.o src/resample.o src/audio-in.o: CFLAGS += $(RESAMPLER_CPPFLAGS)
|
||||
|
||||
src/info_opus.o: CFLAGS += -DOPUSTOOLS
|
||||
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) $(INCLUDES) $< -o $@
|
||||
|
||||
opusenc: src/opus_header.o src/opusenc.o src/resample.o src/audio-in.o src/diag_range.o src/lpc.o src/flac.o src/picture.o $(COMMON_OBJS)
|
||||
$(CC) $(LDFLAGS) $^ -o $@ ../opus/.libs/libopus.a -lm -logg -lFLAC $(LIBS)
|
||||
|
||||
opusdec: src/opus_header.o src/wav_io.o src/wave_out.o src/opusdec.o src/resample.o src/diag_range.o $(COMMON_OBJS)
|
||||
$(CC) $(LDFLAGS) $^ -o $@ ../opus/.libs/libopus.a -lm -logg $(LIBS)
|
||||
|
||||
opusinfo: src/opus_header.o src/opusinfo.o src/info_opus.o src/picture.o $(COMMON_OBJS)
|
||||
$(CC) $(LDFLAGS) $^ -o $@ -logg $(LIBS)
|
||||
|
||||
opusrtp: src/opusrtp.o
|
||||
$(CC) $(LDFLAGS) $^ -o $@ ../opus/.libs/libopus.a -logg -lm
|
||||
|
||||
|
||||
package_version: force
|
||||
@if [ -x ./update_version ]; then \
|
||||
./update_version || true; \
|
||||
elif [ ! -e ./package_version ]; then \
|
||||
echo 'PACKAGE_VERSION="unknown"' > ./package_version; \
|
||||
fi
|
||||
|
||||
force:
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
== Opus Audio Tools ==
|
||||
|
||||
This is opus-tools, a set of tools to encode, inspect, and decode
|
||||
audio in the Opus format.
|
||||
|
||||
For more information on Opus see http://www.opus-codec.org/
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -1,270 +0,0 @@
|
|||
#! /bin/sh
|
||||
# Wrapper for Microsoft lib.exe
|
||||
|
||||
me=ar-lib
|
||||
scriptversion=2012-03-01.08; # UTC
|
||||
|
||||
# Copyright (C) 2010-2013 Free Software Foundation, Inc.
|
||||
# Written by Peter Rosin <peda@lysator.liu.se>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
|
||||
# func_error message
|
||||
func_error ()
|
||||
{
|
||||
echo "$me: $1" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
file_conv=
|
||||
|
||||
# func_file_conv build_file
|
||||
# Convert a $build file to $host form and store it in $file
|
||||
# Currently only supports Windows hosts.
|
||||
func_file_conv ()
|
||||
{
|
||||
file=$1
|
||||
case $file in
|
||||
/ | /[!/]*) # absolute file, and not a UNC file
|
||||
if test -z "$file_conv"; then
|
||||
# lazily determine how to convert abs files
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
CYGWIN*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
file_conv=wine
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case $file_conv in
|
||||
mingw)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine)
|
||||
file=`winepath -w "$file" || echo "$file"`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# func_at_file at_file operation archive
|
||||
# Iterate over all members in AT_FILE performing OPERATION on ARCHIVE
|
||||
# for each of them.
|
||||
# When interpreting the content of the @FILE, do NOT use func_file_conv,
|
||||
# since the user would need to supply preconverted file names to
|
||||
# binutils ar, at least for MinGW.
|
||||
func_at_file ()
|
||||
{
|
||||
operation=$2
|
||||
archive=$3
|
||||
at_file_contents=`cat "$1"`
|
||||
eval set x "$at_file_contents"
|
||||
shift
|
||||
|
||||
for member
|
||||
do
|
||||
$AR -NOLOGO $operation:"$member" "$archive" || exit $?
|
||||
done
|
||||
}
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
func_error "no command. Try '$0 --help' for more information."
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<EOF
|
||||
Usage: $me [--help] [--version] PROGRAM ACTION ARCHIVE [MEMBER...]
|
||||
|
||||
Members may be specified in a file named with @FILE.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "$me, version $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
if test $# -lt 3; then
|
||||
func_error "you must specify a program, an action and an archive"
|
||||
fi
|
||||
|
||||
AR=$1
|
||||
shift
|
||||
while :
|
||||
do
|
||||
if test $# -lt 2; then
|
||||
func_error "you must specify a program, an action and an archive"
|
||||
fi
|
||||
case $1 in
|
||||
-lib | -LIB \
|
||||
| -ltcg | -LTCG \
|
||||
| -machine* | -MACHINE* \
|
||||
| -subsystem* | -SUBSYSTEM* \
|
||||
| -verbose | -VERBOSE \
|
||||
| -wx* | -WX* )
|
||||
AR="$AR $1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
action=$1
|
||||
shift
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
orig_archive=$1
|
||||
shift
|
||||
func_file_conv "$orig_archive"
|
||||
archive=$file
|
||||
|
||||
# strip leading dash in $action
|
||||
action=${action#-}
|
||||
|
||||
delete=
|
||||
extract=
|
||||
list=
|
||||
quick=
|
||||
replace=
|
||||
index=
|
||||
create=
|
||||
|
||||
while test -n "$action"
|
||||
do
|
||||
case $action in
|
||||
d*) delete=yes ;;
|
||||
x*) extract=yes ;;
|
||||
t*) list=yes ;;
|
||||
q*) quick=yes ;;
|
||||
r*) replace=yes ;;
|
||||
s*) index=yes ;;
|
||||
S*) ;; # the index is always updated implicitly
|
||||
c*) create=yes ;;
|
||||
u*) ;; # TODO: don't ignore the update modifier
|
||||
v*) ;; # TODO: don't ignore the verbose modifier
|
||||
*)
|
||||
func_error "unknown action specified"
|
||||
;;
|
||||
esac
|
||||
action=${action#?}
|
||||
done
|
||||
|
||||
case $delete$extract$list$quick$replace,$index in
|
||||
yes,* | ,yes)
|
||||
;;
|
||||
yesyes*)
|
||||
func_error "more than one action specified"
|
||||
;;
|
||||
*)
|
||||
func_error "no action specified"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -n "$delete"; then
|
||||
if test ! -f "$orig_archive"; then
|
||||
func_error "archive not found"
|
||||
fi
|
||||
for member
|
||||
do
|
||||
case $1 in
|
||||
@*)
|
||||
func_at_file "${1#@}" -REMOVE "$archive"
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$1"
|
||||
$AR -NOLOGO -REMOVE:"$file" "$archive" || exit $?
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
elif test -n "$extract"; then
|
||||
if test ! -f "$orig_archive"; then
|
||||
func_error "archive not found"
|
||||
fi
|
||||
if test $# -gt 0; then
|
||||
for member
|
||||
do
|
||||
case $1 in
|
||||
@*)
|
||||
func_at_file "${1#@}" -EXTRACT "$archive"
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$1"
|
||||
$AR -NOLOGO -EXTRACT:"$file" "$archive" || exit $?
|
||||
;;
|
||||
esac
|
||||
done
|
||||
else
|
||||
$AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member
|
||||
do
|
||||
$AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
|
||||
done
|
||||
fi
|
||||
|
||||
elif test -n "$quick$replace"; then
|
||||
if test ! -f "$orig_archive"; then
|
||||
if test -z "$create"; then
|
||||
echo "$me: creating $orig_archive"
|
||||
fi
|
||||
orig_archive=
|
||||
else
|
||||
orig_archive=$archive
|
||||
fi
|
||||
|
||||
for member
|
||||
do
|
||||
case $1 in
|
||||
@*)
|
||||
func_file_conv "${1#@}"
|
||||
set x "$@" "@$file"
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$1"
|
||||
set x "$@" "$file"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
shift
|
||||
done
|
||||
|
||||
if test -n "$orig_archive"; then
|
||||
$AR -NOLOGO -OUT:"$archive" "$orig_archive" "$@" || exit $?
|
||||
else
|
||||
$AR -NOLOGO -OUT:"$archive" "$@" || exit $?
|
||||
fi
|
||||
|
||||
elif test -n "$list"; then
|
||||
if test ! -f "$orig_archive"; then
|
||||
func_error "archive not found"
|
||||
fi
|
||||
$AR -NOLOGO -LIST "$archive" || exit $?
|
||||
fi
|
|
@ -1,347 +0,0 @@
|
|||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand '-c -o'.
|
||||
|
||||
scriptversion=2012-10-14.11; # UTC
|
||||
|
||||
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
nl='
|
||||
'
|
||||
|
||||
# We need space, tab and new line, in precisely that order. Quoting is
|
||||
# there to prevent tools from complaining about whitespace usage.
|
||||
IFS=" "" $nl"
|
||||
|
||||
file_conv=
|
||||
|
||||
# func_file_conv build_file lazy
|
||||
# Convert a $build file to $host form and store it in $file
|
||||
# Currently only supports Windows hosts. If the determined conversion
|
||||
# type is listed in (the comma separated) LAZY, no conversion will
|
||||
# take place.
|
||||
func_file_conv ()
|
||||
{
|
||||
file=$1
|
||||
case $file in
|
||||
/ | /[!/]*) # absolute file, and not a UNC file
|
||||
if test -z "$file_conv"; then
|
||||
# lazily determine how to convert abs files
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
CYGWIN*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
file_conv=wine
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case $file_conv/,$2, in
|
||||
*,$file_conv,*)
|
||||
;;
|
||||
mingw/*)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin/*)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine/*)
|
||||
file=`winepath -w "$file" || echo "$file"`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# func_cl_dashL linkdir
|
||||
# Make cl look for libraries in LINKDIR
|
||||
func_cl_dashL ()
|
||||
{
|
||||
func_file_conv "$1"
|
||||
if test -z "$lib_path"; then
|
||||
lib_path=$file
|
||||
else
|
||||
lib_path="$lib_path;$file"
|
||||
fi
|
||||
linker_opts="$linker_opts -LIBPATH:$file"
|
||||
}
|
||||
|
||||
# func_cl_dashl library
|
||||
# Do a library search-path lookup for cl
|
||||
func_cl_dashl ()
|
||||
{
|
||||
lib=$1
|
||||
found=no
|
||||
save_IFS=$IFS
|
||||
IFS=';'
|
||||
for dir in $lib_path $LIB
|
||||
do
|
||||
IFS=$save_IFS
|
||||
if $shared && test -f "$dir/$lib.dll.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.dll.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/$lib.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/lib$lib.a"; then
|
||||
found=yes
|
||||
lib=$dir/lib$lib.a
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS=$save_IFS
|
||||
|
||||
if test "$found" != yes; then
|
||||
lib=$lib.lib
|
||||
fi
|
||||
}
|
||||
|
||||
# func_cl_wrapper cl arg...
|
||||
# Adjust compile command to suit cl
|
||||
func_cl_wrapper ()
|
||||
{
|
||||
# Assume a capable shell
|
||||
lib_path=
|
||||
shared=:
|
||||
linker_opts=
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.[oO][bB][jJ])
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fo"$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fe"$file"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
-I)
|
||||
eat=1
|
||||
func_file_conv "$2" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-I*)
|
||||
func_file_conv "${1#-I}" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-l)
|
||||
eat=1
|
||||
func_cl_dashl "$2"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-l*)
|
||||
func_cl_dashl "${1#-l}"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-L)
|
||||
eat=1
|
||||
func_cl_dashL "$2"
|
||||
;;
|
||||
-L*)
|
||||
func_cl_dashL "${1#-L}"
|
||||
;;
|
||||
-static)
|
||||
shared=false
|
||||
;;
|
||||
-Wl,*)
|
||||
arg=${1#-Wl,}
|
||||
save_ifs="$IFS"; IFS=','
|
||||
for flag in $arg; do
|
||||
IFS="$save_ifs"
|
||||
linker_opts="$linker_opts $flag"
|
||||
done
|
||||
IFS="$save_ifs"
|
||||
;;
|
||||
-Xlinker)
|
||||
eat=1
|
||||
linker_opts="$linker_opts $2"
|
||||
;;
|
||||
-*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
|
||||
func_file_conv "$1"
|
||||
set x "$@" -Tp"$file"
|
||||
shift
|
||||
;;
|
||||
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
|
||||
func_file_conv "$1" mingw
|
||||
set x "$@" "$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
if test -n "$linker_opts"; then
|
||||
linker_opts="-link$linker_opts"
|
||||
fi
|
||||
exec "$@" $linker_opts
|
||||
exit 1
|
||||
}
|
||||
|
||||
eat=
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand '-c -o'.
|
||||
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file 'INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
|
||||
func_cl_wrapper "$@" # Doesn't return...
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
# So we strip '-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no '-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# '.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
File diff suppressed because it is too large
Load diff
|
@ -1,132 +0,0 @@
|
|||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define if building universal (internal helper macro) */
|
||||
#undef AC_APPLE_UNIVERSAL_BUILD
|
||||
|
||||
/* Assertions */
|
||||
#undef ENABLE_ASSERTIONS
|
||||
|
||||
/* Define to 1 if you have the `fmaxf' function. */
|
||||
#undef HAVE_FMAXF
|
||||
|
||||
/* Define to 1 if you have the `fminf' function. */
|
||||
#undef HAVE_FMINF
|
||||
|
||||
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
|
||||
#undef HAVE_FSEEKO
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* FLAC */
|
||||
#undef HAVE_LIBFLAC
|
||||
|
||||
/* Define to 1 if you have the `sndio' library (-lsndio). */
|
||||
#undef HAVE_LIBSNDIO
|
||||
|
||||
/* Define to 1 if you have the `winmm' library (-lwinmm). */
|
||||
#undef HAVE_LIBWINMM
|
||||
|
||||
/* Define to 1 if you have the `lrintf' function. */
|
||||
#undef HAVE_LRINTF
|
||||
|
||||
/* Define to 1 if you have the <machine/soundcard.h> header file. */
|
||||
#undef HAVE_MACHINE_SOUNDCARD_H
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define if building with libpcap support */
|
||||
#undef HAVE_PCAP
|
||||
|
||||
/* Define to 1 if you have the <soundcard.h> header file. */
|
||||
#undef HAVE_SOUNDCARD_H
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the <sys/soundcard.h> header file. */
|
||||
#undef HAVE_SYS_SOUNDCARD_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
|
||||
#undef NO_MINUS_C_MINUS_O
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Use C99 variable-size arrays */
|
||||
#undef VAR_ARRAYS
|
||||
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */
|
||||
#if defined AC_APPLE_UNIVERSAL_BUILD
|
||||
# if defined __BIG_ENDIAN__
|
||||
# define WORDS_BIGENDIAN 1
|
||||
# endif
|
||||
#else
|
||||
# ifndef WORDS_BIGENDIAN
|
||||
# undef WORDS_BIGENDIAN
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
|
||||
#undef _LARGEFILE_SOURCE
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
#undef inline
|
||||
#endif
|
||||
|
||||
/* Define to the equivalent of the C99 'restrict' keyword, or to
|
||||
nothing if this is not supported. Do not define if restrict is
|
||||
supported directly. */
|
||||
#undef restrict
|
||||
/* Work around a bug in Sun C++: it does not support _Restrict or
|
||||
__restrict__, even though the corresponding Sun C compiler ends up with
|
||||
"#define restrict _Restrict" or "#define restrict __restrict__" in the
|
||||
previous line. Perhaps some future version of Sun C++ will work with
|
||||
restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
|
||||
#if defined __SUNPRO_CC && !defined __RESTRICT
|
||||
# define _Restrict
|
||||
# define __restrict__
|
||||
#endif
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,323 +0,0 @@
|
|||
dnl Process this file with autoconf to produce a configure script. -*-m4-*-
|
||||
|
||||
dnl The package_version file will be automatically synced to the git revision
|
||||
dnl by the update_version script when configured in the repository, but will
|
||||
dnl remain constant in tarball releases unless it is manually edited.
|
||||
m4_define([CURRENT_VERSION],
|
||||
m4_esyscmd([ ./update_version 2>/dev/null || true
|
||||
if test -e package_version; then
|
||||
. ./package_version
|
||||
printf "$PACKAGE_VERSION"
|
||||
else
|
||||
printf "unknown"
|
||||
fi ]))
|
||||
|
||||
AC_INIT([opus-tools],[CURRENT_VERSION],[opus@xiph.org])
|
||||
AC_CONFIG_SRCDIR([src/opusenc.c])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
dnl enable silent rules on automake 1.11 and later
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
|
||||
AM_INIT_AUTOMAKE([1.11 foreign no-define])
|
||||
AM_MAINTAINER_MODE([enable])
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
AM_PROG_CC_C_O
|
||||
|
||||
AC_PROG_CC_C99
|
||||
AC_C_BIGENDIAN
|
||||
AC_C_CONST
|
||||
AC_C_INLINE
|
||||
|
||||
#Use a hacked up version of autoconf's AC_C_RESTRICT because it's not
|
||||
#strong enough a test to detect old buggy versions of GCC (e.g. 2.95.3)
|
||||
#Note: Both this and the test for variable-size arrays below are also
|
||||
# done by AC_PROG_CC_C99, but not thoroughly enough apparently.
|
||||
AC_CACHE_CHECK([for C/C++ restrict keyword], ac_cv_c_restrict,
|
||||
[ac_cv_c_restrict=no
|
||||
# The order here caters to the fact that C++ does not require restrict.
|
||||
for ac_kw in __restrict __restrict__ _Restrict restrict; do
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
||||
[[typedef int * int_ptr;
|
||||
int foo (int_ptr $ac_kw ip, int * $ac_kw baz[]) {
|
||||
return ip[0];
|
||||
}]],
|
||||
[[int s[1];
|
||||
int * $ac_kw t = s;
|
||||
t[0] = 0;
|
||||
return foo(t, (void *)0)]])],
|
||||
[ac_cv_c_restrict=$ac_kw])
|
||||
test "$ac_cv_c_restrict" != no && break
|
||||
done
|
||||
])
|
||||
|
||||
AH_VERBATIM([restrict],
|
||||
[/* Define to the equivalent of the C99 'restrict' keyword, or to
|
||||
nothing if this is not supported. Do not define if restrict is
|
||||
supported directly. */
|
||||
#undef restrict
|
||||
/* Work around a bug in Sun C++: it does not support _Restrict or
|
||||
__restrict__, even though the corresponding Sun C compiler ends up with
|
||||
"#define restrict _Restrict" or "#define restrict __restrict__" in the
|
||||
previous line. Perhaps some future version of Sun C++ will work with
|
||||
restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
|
||||
#if defined __SUNPRO_CC && !defined __RESTRICT
|
||||
# define _Restrict
|
||||
# define __restrict__
|
||||
#endif])
|
||||
|
||||
case $ac_cv_c_restrict in
|
||||
restrict) ;;
|
||||
no) AC_DEFINE([restrict], []) ;;
|
||||
*) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
|
||||
esac
|
||||
|
||||
AC_MSG_CHECKING(for C99 variable-size arrays)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
|
||||
[[static int x; char a[++x]; a[sizeof a - 1] = 0; int N; return a[0];]])],
|
||||
[ has_var_arrays=yes
|
||||
AC_DEFINE([VAR_ARRAYS], [1], [Use C99 variable-size arrays])
|
||||
],[
|
||||
has_var_arrays=no
|
||||
])
|
||||
AC_MSG_RESULT([$has_var_arrays])
|
||||
|
||||
AC_ARG_ENABLE([assertions],
|
||||
[AS_HELP_STRING([--enable-assertions],[enable additional software error checking])],,
|
||||
[enable_assertions=no])
|
||||
|
||||
AS_IF([test "$enable_assertions" = "yes"], [
|
||||
AC_DEFINE([ENABLE_ASSERTIONS], [1], [Assertions])
|
||||
])
|
||||
|
||||
if test "$CFLAGS" = "-g -O2"; then
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
CFLAGS="-O3 -ffast-math"
|
||||
AC_MSG_CHECKING([if ${CC} supports -O3 -g -ffast-math])
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])],
|
||||
[ AC_MSG_RESULT([yes])
|
||||
saved_CFLAGS="-O3 -g -ffast-math"
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
CFLAGS="$saved_CFLAGS"
|
||||
fi
|
||||
|
||||
LT_LIB_M
|
||||
AC_CHECK_LIB([winmm], [main])
|
||||
|
||||
dnl check for pkg-config itself so we don't try the m4 macro without pkg-config
|
||||
AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes)
|
||||
|
||||
dnl check for Ogg
|
||||
AS_IF([test "$HAVE_PKG_CONFIG" = "yes"],
|
||||
dnl first try via pkg-config
|
||||
[PKG_CHECK_MODULES([OGG],[ogg >= 1.3])],
|
||||
[
|
||||
dnl fall back to the old school test
|
||||
XIPH_PATH_OGG(, AC_MSG_ERROR([
|
||||
libogg is required to build this package!
|
||||
please see http://www.xiph.org/ for how to
|
||||
obtain a copy.
|
||||
]))
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
saved_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $OGG_CFLAGS"
|
||||
LIBS="$LIBS $OGG_LIBS"
|
||||
AC_CHECK_FUNC([ogg_stream_flush_fill],,[
|
||||
AC_MSG_ERROR([newer libogg version (1.3 or later) required])
|
||||
])
|
||||
CFLAGS="$saved_CFLAGS"
|
||||
LIBS="$saved_LIBS"
|
||||
])
|
||||
|
||||
dnl check for Opus
|
||||
AS_IF([test "$HAVE_PKG_CONFIG" = "yes"],
|
||||
[PKG_CHECK_MODULES([OPUS],[opus >= 1.0.3])],
|
||||
[
|
||||
dnl fall back to the old school test
|
||||
XIPH_PATH_OPUS(, AC_MSG_ERROR([
|
||||
Opus is required to build this package!
|
||||
please see http://opus-codec.org/ for how to
|
||||
obtain a copy.
|
||||
]))
|
||||
])
|
||||
|
||||
dnl check for OSS
|
||||
HAVE_OSS=no
|
||||
AC_CHECK_HEADERS([sys/soundcard.h soundcard.h machine/soundcard.h],[
|
||||
HAVE_OSS=yes
|
||||
break
|
||||
])
|
||||
|
||||
dnl check for sndio
|
||||
AC_CHECK_LIB([sndio], [sio_open])
|
||||
|
||||
if test "$HAVE_OSS" != "yes" && test "$ac_cv_lib_sndio_sio_open" != "yes"; then
|
||||
AC_MSG_WARN([Audio support not found -- no direct audio output in opusdec])
|
||||
fi
|
||||
|
||||
dnl check for flac
|
||||
AC_ARG_WITH([flac],
|
||||
[AS_HELP_STRING([--without-flac],[disable FLAC support])],,
|
||||
[with_flac=yes])
|
||||
|
||||
AS_IF([test "$with_flac" = "yes"],
|
||||
[
|
||||
AS_IF([test "$HAVE_PKG_CONFIG" = "yes"],
|
||||
[PKG_CHECK_MODULES([FLAC],[flac >= 1.1.3])],
|
||||
[
|
||||
dnl fall back to AC_CHECK_LIB
|
||||
AC_CHECK_LIB([FLAC],[FLAC__stream_decoder_init_ogg_stream],
|
||||
[
|
||||
FLAC_LIBS="-lFLAC"
|
||||
],
|
||||
[
|
||||
AC_MSG_ERROR([
|
||||
FLAC 1.1.3 or later is required to build this package!
|
||||
Please install it or configure with --disable-flac.
|
||||
])
|
||||
]
|
||||
)
|
||||
AC_CHECK_HEADER([FLAC/stream_decoder.h],,
|
||||
[
|
||||
AC_MSG_ERROR([
|
||||
FLAC headers are required to build this package!
|
||||
Please install the development version of FLAC
|
||||
or configure with --disable-flac.
|
||||
])
|
||||
]
|
||||
)
|
||||
])
|
||||
|
||||
AC_DEFINE([HAVE_LIBFLAC],[1],[FLAC])
|
||||
])
|
||||
|
||||
dnl check for pcap
|
||||
AC_CHECK_LIB([pcap], [pcap_open_live], [
|
||||
AC_DEFINE([HAVE_PCAP], 1, [Define if building with libpcap support])
|
||||
LIBPCAP="-lpcap"
|
||||
])
|
||||
AC_SUBST(LIBPCAP)
|
||||
|
||||
on_x86=no
|
||||
case "$host_cpu" in
|
||||
i[[3456]]86 | x86_64)
|
||||
on_x86=yes
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl check for sse
|
||||
AC_ARG_ENABLE([sse],
|
||||
[AS_HELP_STRING([--enable-sse],[Build binaries that require SSE])],,
|
||||
[enable_sse=no])
|
||||
|
||||
AS_IF([test "$on_x86" = "yes" && test "$enable_sse" = "yes"],
|
||||
[
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -msse"
|
||||
AC_MSG_CHECKING([if ${CC} supports -msse])
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([],[[char foo;]])],
|
||||
[ AC_MSG_RESULT([yes]) ],
|
||||
[
|
||||
AC_MSG_RESULT([no])
|
||||
enable_sse=no
|
||||
CFLAGS="$saved_CFLAGS"
|
||||
])
|
||||
])
|
||||
|
||||
dnl Enable stack-protector-all only on x86 where it's well supported.
|
||||
dnl on some platforms it causes crashes. Hopefully the OS's default's
|
||||
dnl include this on platforms that work but have been missed here.
|
||||
AC_ARG_ENABLE([stack-protector],
|
||||
[AS_HELP_STRING([--disable-stack-protector],[Disable compiler stack hardening])],,
|
||||
[
|
||||
AS_IF([test "$ac_cv_c_compiler_gnu" = "yes" && test "$on_x86" = "yes"],
|
||||
[enable_stack_protector=yes],[enable_stack_protector=no])
|
||||
])
|
||||
|
||||
AS_IF([test "$enable_stack_protector" = "yes"],
|
||||
[
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -fstack-protector-all"
|
||||
AC_MSG_CHECKING([if ${CC} supports -fstack-protector-all])
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([],[[char foo;]])],
|
||||
[ AC_MSG_RESULT([yes]) ],
|
||||
[
|
||||
AC_MSG_RESULT([no])
|
||||
enable_stack_protector=no
|
||||
CFLAGS="$saved_CFLAGS"
|
||||
])
|
||||
])
|
||||
|
||||
|
||||
AC_ARG_ENABLE([pie],
|
||||
[AS_HELP_STRING([--disable-pie],[Disable PIE/RELRO hardening])],,
|
||||
[enable_pie=yes])
|
||||
|
||||
AS_IF([test "$enable_pie" = "yes"],
|
||||
[
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
saved_LDFLAGS="$LDFLAGS"
|
||||
saved_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS -fPIE"
|
||||
LDFLAGS="$LDFLAGS -pie -Wl,-z,relro -Wl,-z,now"
|
||||
LIBS="$LIBS $OPUS_LIBS"
|
||||
AC_MSG_CHECKING([for PIE support])
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <opus/opus.h>]],
|
||||
[[OpusDecoder *dec = opus_decoder_create(48000, 2, 0L)]])],
|
||||
[ AC_MSG_RESULT([yes]) ],
|
||||
[ AC_MSG_RESULT([no])
|
||||
enable_pie=no
|
||||
CFLAGS="$saved_CFLAGS"
|
||||
LDFLAGS="$saved_LDFLAGS"
|
||||
])
|
||||
LIBS="$saved_LIBS"
|
||||
])
|
||||
|
||||
CFLAGS="$CFLAGS -W"
|
||||
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes"
|
||||
AC_MSG_CHECKING([if ${CC} supports -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes])
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])],
|
||||
[ AC_MSG_RESULT([yes]) ],
|
||||
[ AC_MSG_RESULT([no])
|
||||
CFLAGS="$saved_CFLAGS"
|
||||
])
|
||||
|
||||
AC_FUNC_FSEEKO
|
||||
|
||||
saved_LIBS="$LIBS"
|
||||
LIBS="$LIBS $LIBM"
|
||||
AC_CHECK_FUNCS([lrintf])
|
||||
AC_CHECK_FUNCS([fminf])
|
||||
AC_CHECK_FUNCS([fmaxf])
|
||||
LIBS="$saved_LIBS"
|
||||
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_OUTPUT
|
||||
|
||||
AC_MSG_NOTICE([
|
||||
------------------------------------------------------------------------
|
||||
$PACKAGE_NAME $PACKAGE_VERSION: Automatic configuration OK.
|
||||
|
||||
Compiler support:
|
||||
|
||||
C99 var arrays: ................ ${has_var_arrays}
|
||||
C99 lrintf: .................... ${ac_cv_func_lrintf}
|
||||
Stack protector: ............... ${enable_stack_protector}
|
||||
PIE: ........................... ${enable_pie}
|
||||
|
||||
General configuration:
|
||||
|
||||
Assertion checking: ............ ${enable_assertions}
|
||||
FLAC input: .................... ${with_flac}
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Type "make; make install" to compile and install
|
||||
])
|
||||
|
|
@ -1,791 +0,0 @@
|
|||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2013-05-30.07; # UTC
|
||||
|
||||
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by 'PROGRAMS ARGS'.
|
||||
object Object file output by 'PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputting dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
# Get the directory component of the given path, and save it in the
|
||||
# global variables '$dir'. Note that this directory component will
|
||||
# be either empty or ending with a '/' character. This is deliberate.
|
||||
set_dir_from ()
|
||||
{
|
||||
case $1 in
|
||||
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
|
||||
*) dir=;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Get the suffix-stripped basename of the given path, and save it the
|
||||
# global variable '$base'.
|
||||
set_base_from ()
|
||||
{
|
||||
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
|
||||
}
|
||||
|
||||
# If no dependency file was actually created by the compiler invocation,
|
||||
# we still have to create a dummy depfile, to avoid errors with the
|
||||
# Makefile "include basename.Plo" scheme.
|
||||
make_dummy_depfile ()
|
||||
{
|
||||
echo "#dummy" > "$depfile"
|
||||
}
|
||||
|
||||
# Factor out some common post-processing of the generated depfile.
|
||||
# Requires the auxiliary global variable '$tmpdepfile' to be set.
|
||||
aix_post_process_depfile ()
|
||||
{
|
||||
# If the compiler actually managed to produce a dependency file,
|
||||
# post-process it.
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form 'foo.o: dependency.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# $object: dependency.h
|
||||
# and one to simply output
|
||||
# dependency.h:
|
||||
# which is needed to avoid the deleted-header problem.
|
||||
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
|
||||
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
|
||||
} > "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
}
|
||||
|
||||
# A tabulation character.
|
||||
tab=' '
|
||||
# A newline character.
|
||||
nl='
|
||||
'
|
||||
# Character ranges might be problematic outside the C locale.
|
||||
# These definitions help.
|
||||
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
lower=abcdefghijklmnopqrstuvwxyz
|
||||
digits=0123456789
|
||||
alpha=${upper}${lower}
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Avoid interferences from the environment.
|
||||
gccflag= dashmflag=
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
if test "$depmode" = msvc7msys; then
|
||||
# This is just like msvc7 but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvc7
|
||||
fi
|
||||
|
||||
if test "$depmode" = xlc; then
|
||||
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
|
||||
gccflag=-qmakedep=gcc,-MF
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
|
||||
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
|
||||
## (see the conditional assignment to $gccflag above).
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say). Also, it might not be
|
||||
## supported by the other compilers which use the 'gcc' depmode.
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The second -e expression handles DOS-style file names with drive
|
||||
# letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the "deleted header file" problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
## Some versions of gcc put a space before the ':'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well. hp depmode also adds that space, but also prefixes the VPATH
|
||||
## to the object. Take care to not repeat it in the output.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like '#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
|
||||
| tr "$nl" ' ' >> "$depfile"
|
||||
echo >> "$depfile"
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
xlc)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts '$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
tmpdepfile3=$dir.libs/$base.u
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$dir$base.u
|
||||
tmpdepfile3=$dir$base.u
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
tcc)
|
||||
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
|
||||
# FIXME: That version still under development at the moment of writing.
|
||||
# Make that this statement remains true also for stable, released
|
||||
# versions.
|
||||
# It will wrap lines (doesn't matter whether long or short) with a
|
||||
# trailing '\', as in:
|
||||
#
|
||||
# foo.o : \
|
||||
# foo.c \
|
||||
# foo.h \
|
||||
#
|
||||
# It will put a trailing '\' even on the last line, and will use leading
|
||||
# spaces rather than leading tabs (at least since its commit 0394caf7
|
||||
# "Emit spaces for -MD").
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
|
||||
# We have to change lines of the first kind to '$object: \'.
|
||||
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
|
||||
# And for each line of the second kind, we have to emit a 'dep.h:'
|
||||
# dummy dependency, to avoid the deleted-header problem.
|
||||
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
## The order of this option in the case statement is important, since the
|
||||
## shell code in configure will try each of these formats in the order
|
||||
## listed in this file. A plain '-MD' option would be understood by many
|
||||
## compilers, so we must ensure this comes after the gcc and icc options.
|
||||
pgcc)
|
||||
# Portland's C compiler understands '-MD'.
|
||||
# Will always output deps to 'file.d' where file is the root name of the
|
||||
# source file under compilation, even if file resides in a subdirectory.
|
||||
# The object file name does not affect the name of the '.d' file.
|
||||
# pgcc 10.2 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using '\' :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
set_dir_from "$object"
|
||||
# Use the source, not the object, to determine the base name, since
|
||||
# that's sadly what pgcc will do too.
|
||||
set_base_from "$source"
|
||||
tmpdepfile=$base.d
|
||||
|
||||
# For projects that build the same source file twice into different object
|
||||
# files, the pgcc approach of using the *source* file root name can cause
|
||||
# problems in parallel builds. Use a locking strategy to avoid stomping on
|
||||
# the same $tmpdepfile.
|
||||
lockdir=$base.d-lock
|
||||
trap "
|
||||
echo '$0: caught signal, cleaning up...' >&2
|
||||
rmdir '$lockdir'
|
||||
exit 1
|
||||
" 1 2 13 15
|
||||
numtries=100
|
||||
i=$numtries
|
||||
while test $i -gt 0; do
|
||||
# mkdir is a portable test-and-set.
|
||||
if mkdir "$lockdir" 2>/dev/null; then
|
||||
# This process acquired the lock.
|
||||
"$@" -MD
|
||||
stat=$?
|
||||
# Release the lock.
|
||||
rmdir "$lockdir"
|
||||
break
|
||||
else
|
||||
# If the lock is being held by a different process, wait
|
||||
# until the winning process is done or we timeout.
|
||||
while test -d "$lockdir" && test $i -gt 0; do
|
||||
sleep 1
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
fi
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
trap - 1 2 13 15
|
||||
if test $i -le 0; then
|
||||
echo "$0: failed to acquire lock after $numtries attempts" >&2
|
||||
echo "$0: check lockdir '$lockdir'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add 'dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in 'foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# Libtool generates 2 separate objects for the 2 libraries. These
|
||||
# two compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
|
||||
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
# Same post-processing that is required for AIX mode.
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
msvc7)
|
||||
if test "$libtool" = yes; then
|
||||
showIncludes=-Wc,-showIncludes
|
||||
else
|
||||
showIncludes=-showIncludes
|
||||
fi
|
||||
"$@" $showIncludes > "$tmpdepfile"
|
||||
stat=$?
|
||||
grep -v '^Note: including file: ' "$tmpdepfile"
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The first sed program below extracts the file names and escapes
|
||||
# backslashes for cygpath. The second sed program outputs the file
|
||||
# name when reading, but also accumulates all include files in the
|
||||
# hold buffer in order to output them again at the end. This only
|
||||
# works with sed implementations that can handle large buffers.
|
||||
sed < "$tmpdepfile" -n '
|
||||
/^Note: including file: *\(.*\)/ {
|
||||
s//\1/
|
||||
s/\\/\\\\/g
|
||||
p
|
||||
}' | $cygpath_u | sort -u | sed -n '
|
||||
s/ /\\ /g
|
||||
s/\(.*\)/'"$tab"'\1 \\/p
|
||||
s/.\(.*\) \\/\1:/
|
||||
H
|
||||
$ {
|
||||
s/.*/'"$tab"'/
|
||||
G
|
||||
p
|
||||
}' >> "$depfile"
|
||||
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvc7msys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for ':'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this sed invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no eat=no
|
||||
for arg
|
||||
do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
if test $eat = yes; then
|
||||
eat=no
|
||||
continue
|
||||
fi
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-arch)
|
||||
eat=yes ;;
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
# makedepend may prepend the VPATH from the source file name to the object.
|
||||
# No need to regex-escape $object, excess matching of '.' is harmless.
|
||||
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process the last invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed '1,2d' "$tmpdepfile" \
|
||||
| tr ' ' "$nl" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E \
|
||||
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
| sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
|
||||
echo "$tab" >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvcmsys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
|
@ -1,169 +0,0 @@
|
|||
/* Declarations for getopt.
|
||||
Copyright (C) 1989,90,91,92,93,94,96,97,98 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _GETOPT_H
|
||||
|
||||
#ifndef __need_getopt
|
||||
# define _GETOPT_H 1
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* For communication from `getopt' to the caller.
|
||||
When `getopt' finds an option that takes an argument,
|
||||
the argument value is returned here.
|
||||
Also, when `ordering' is RETURN_IN_ORDER,
|
||||
each non-option ARGV-element is returned here. */
|
||||
|
||||
extern char *optarg;
|
||||
|
||||
/* Index in ARGV of the next element to be scanned.
|
||||
This is used for communication to and from the caller
|
||||
and for communication between successive calls to `getopt'.
|
||||
|
||||
On entry to `getopt', zero means this is the first call; initialize.
|
||||
|
||||
When `getopt' returns -1, this is the index of the first of the
|
||||
non-option elements that the caller should itself scan.
|
||||
|
||||
Otherwise, `optind' communicates from one call to the next
|
||||
how much of ARGV has been scanned so far. */
|
||||
|
||||
extern int optind;
|
||||
|
||||
/* Callers store zero here to inhibit the error message `getopt' prints
|
||||
for unrecognized options. */
|
||||
|
||||
extern int opterr;
|
||||
|
||||
/* Set to an option character which was unrecognized. */
|
||||
|
||||
extern int optopt;
|
||||
|
||||
#ifndef __need_getopt
|
||||
/* Describe the long-named options requested by the application.
|
||||
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
|
||||
of `struct option' terminated by an element containing a name which is
|
||||
zero.
|
||||
|
||||
The field `has_arg' is:
|
||||
no_argument (or 0) if the option does not take an argument,
|
||||
required_argument (or 1) if the option requires an argument,
|
||||
optional_argument (or 2) if the option takes an optional argument.
|
||||
|
||||
If the field `flag' is not NULL, it points to a variable that is set
|
||||
to the value given in the field `val' when the option is found, but
|
||||
left unchanged if the option is not found.
|
||||
|
||||
To have a long-named option do something other than set an `int' to
|
||||
a compiled-in constant, such as set a value from `optarg', set the
|
||||
option's `flag' field to zero and its `val' field to a nonzero
|
||||
value (the equivalent single-letter option character, if there is
|
||||
one). For long options that have a zero `flag' field, `getopt'
|
||||
returns the contents of the `val' field. */
|
||||
|
||||
struct option
|
||||
{
|
||||
# if defined __STDC__ && __STDC__
|
||||
const char *name;
|
||||
# else
|
||||
char *name;
|
||||
# endif
|
||||
/* has_arg can't be an enum because some compilers complain about
|
||||
type mismatches in all the code that assumes it is an int. */
|
||||
int has_arg;
|
||||
int *flag;
|
||||
int val;
|
||||
};
|
||||
|
||||
/* Names for the values of the `has_arg' field of `struct option'. */
|
||||
|
||||
# define no_argument 0
|
||||
# define required_argument 1
|
||||
# define optional_argument 2
|
||||
#endif /* need getopt */
|
||||
|
||||
|
||||
/* Get definitions and prototypes for functions to process the
|
||||
arguments in ARGV (ARGC of them, minus the program name) for
|
||||
options given in OPTS.
|
||||
|
||||
Return the option character from OPTS just read. Return -1 when
|
||||
there are no more options. For unrecognized options, or options
|
||||
missing arguments, `optopt' is set to the option letter, and '?' is
|
||||
returned.
|
||||
|
||||
The OPTS string is a list of characters which are recognized option
|
||||
letters, optionally followed by colons, specifying that that letter
|
||||
takes an argument, to be placed in `optarg'.
|
||||
|
||||
If a letter in OPTS is followed by two colons, its argument is
|
||||
optional. This behavior is specific to the GNU `getopt'.
|
||||
|
||||
The argument `--' causes premature termination of argument
|
||||
scanning, explicitly telling `getopt' that there are no more
|
||||
options.
|
||||
|
||||
If OPTS begins with `--', then non-option arguments are treated as
|
||||
arguments to the option '\0'. This behavior is specific to the GNU
|
||||
`getopt'. */
|
||||
|
||||
#if defined __STDC__ && __STDC__
|
||||
# ifdef __GNU_LIBRARY__
|
||||
/* Many other libraries have conflicting prototypes for getopt, with
|
||||
differences in the consts, in stdlib.h. To avoid compilation
|
||||
errors, only prototype getopt for the GNU C library. */
|
||||
extern int getopt (int __argc, char *const *__argv, const char *__shortopts);
|
||||
# else /* not __GNU_LIBRARY__ */
|
||||
extern int getopt ();
|
||||
# endif /* __GNU_LIBRARY__ */
|
||||
|
||||
# ifndef __need_getopt
|
||||
extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind);
|
||||
extern int getopt_long_only (int __argc, char *const *__argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind);
|
||||
|
||||
/* Internal only. Users should not call this directly. */
|
||||
extern int _getopt_internal (int __argc, char *const *__argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind,
|
||||
int __long_only);
|
||||
# endif
|
||||
#else /* not __STDC__ */
|
||||
extern int getopt ();
|
||||
# ifndef __need_getopt
|
||||
extern int getopt_long ();
|
||||
extern int getopt_long_only ();
|
||||
|
||||
extern int _getopt_internal ();
|
||||
# endif
|
||||
#endif /* __STDC__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Make sure we later can get all the definitions and declarations. */
|
||||
#undef __need_getopt
|
||||
|
||||
#endif /* getopt.h */
|
|
@ -1,527 +0,0 @@
|
|||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2011-11-20.07; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# 'make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
nl='
|
||||
'
|
||||
IFS=" "" $nl"
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit=${DOITPROG-}
|
||||
if test -z "$doit"; then
|
||||
doit_exec=exec
|
||||
else
|
||||
doit_exec=$doit
|
||||
fi
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_glob='?'
|
||||
initialize_posix_glob='
|
||||
test "$posix_glob" != "?" || {
|
||||
if (set -f) 2>/dev/null; then
|
||||
posix_glob=
|
||||
else
|
||||
posix_glob=:
|
||||
fi
|
||||
}
|
||||
'
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
no_target_directory=
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *' '* | *'
|
||||
'* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t) dst_arg=$2
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) no_target_directory=true;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call 'install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
do_exit='(exit $ret); exit $ret'
|
||||
trap "ret=129; $do_exit" 1
|
||||
trap "ret=130; $do_exit" 2
|
||||
trap "ret=141; $do_exit" 13
|
||||
trap "ret=143; $do_exit" 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $src in
|
||||
-* | [=\(\)!]) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst_arg
|
||||
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test -n "$no_target_directory"; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dst=$dstdir/`basename "$src"`
|
||||
dstdir_status=0
|
||||
else
|
||||
# Prefer dirname, but fall back on a substitute if dirname fails.
|
||||
dstdir=`
|
||||
(dirname "$dst") 2>/dev/null ||
|
||||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X"$dst" : 'X\(//\)[^/]' \| \
|
||||
X"$dst" : 'X\(//\)$' \| \
|
||||
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
|
||||
echo X"$dst" |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)[^/].*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\).*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
s/.*/./; q'
|
||||
`
|
||||
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
if (umask $mkdir_umask &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/d" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
[-=\(\)!]*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
eval "$initialize_posix_glob"
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
$posix_glob set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
$posix_glob set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test X"$d" = X && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
|
||||
eval "$initialize_posix_glob" &&
|
||||
$posix_glob set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
$posix_glob set +f &&
|
||||
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
File diff suppressed because it is too large
Load diff
|
@ -1,116 +0,0 @@
|
|||
# Configure paths for libogg
|
||||
# Jack Moffitt <jack@icecast.org> 10-21-2000
|
||||
# Shamelessly stolen from Owen Taylor and Manish Singh
|
||||
|
||||
dnl XIPH_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||
dnl Test for libogg, and define OGG_CFLAGS and OGG_LIBS
|
||||
dnl
|
||||
AC_DEFUN([XIPH_PATH_OGG],
|
||||
[dnl
|
||||
dnl Get the cflags and libraries
|
||||
dnl
|
||||
AC_ARG_WITH(ogg,AC_HELP_STRING([--with-ogg=PFX],[Prefix where libogg is installed (optional)]), ogg_prefix="$withval", ogg_prefix="")
|
||||
AC_ARG_WITH(ogg-libraries,AC_HELP_STRING([--with-ogg-libraries=DIR],[Directory where libogg library is installed (optional)]), ogg_libraries="$withval", ogg_libraries="")
|
||||
AC_ARG_WITH(ogg-includes,AC_HELP_STRING([--with-ogg-includes=DIR],[Directory where libogg header files are installed (optional)]), ogg_includes="$withval", ogg_includes="")
|
||||
AC_ARG_ENABLE(oggtest,AC_HELP_STRING([--disable-oggtest],[Do not try to compile and run a test Ogg program]),, enable_oggtest=yes)
|
||||
|
||||
if test "x$ogg_libraries" != "x" ; then
|
||||
OGG_LIBS="-L$ogg_libraries"
|
||||
elif test "x$ogg_prefix" = "xno" || test "x$ogg_prefix" = "xyes" ; then
|
||||
OGG_LIBS=""
|
||||
elif test "x$ogg_prefix" != "x" ; then
|
||||
OGG_LIBS="-L$ogg_prefix/lib"
|
||||
elif test "x$prefix" != "xNONE" ; then
|
||||
OGG_LIBS="-L$prefix/lib"
|
||||
fi
|
||||
|
||||
if test "x$ogg_prefix" != "xno" ; then
|
||||
OGG_LIBS="$OGG_LIBS -logg"
|
||||
fi
|
||||
|
||||
if test "x$ogg_includes" != "x" ; then
|
||||
OGG_CFLAGS="-I$ogg_includes"
|
||||
elif test "x$ogg_prefix" = "xno" || test "x$ogg_prefix" = "xyes" ; then
|
||||
OGG_CFLAGS=""
|
||||
elif test "x$ogg_prefix" != "x" ; then
|
||||
OGG_CFLAGS="-I$ogg_prefix/include"
|
||||
elif test "x$prefix" != "xNONE"; then
|
||||
OGG_CFLAGS="-I$prefix/include"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for Ogg)
|
||||
if test "x$ogg_prefix" = "xno" ; then
|
||||
no_ogg="disabled"
|
||||
enable_oggtest="no"
|
||||
else
|
||||
no_ogg=""
|
||||
fi
|
||||
|
||||
|
||||
if test "x$enable_oggtest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $OGG_CFLAGS"
|
||||
LIBS="$LIBS $OGG_LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed Ogg is sufficiently new.
|
||||
dnl
|
||||
rm -f conf.oggtest
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ogg/ogg.h>
|
||||
|
||||
int main ()
|
||||
{
|
||||
system("touch conf.oggtest");
|
||||
return 0;
|
||||
}
|
||||
|
||||
],, no_ogg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
|
||||
if test "x$no_ogg" = "xdisabled" ; then
|
||||
AC_MSG_RESULT(no)
|
||||
ifelse([$2], , :, [$2])
|
||||
elif test "x$no_ogg" = "x" ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$1], , :, [$1])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test -f conf.oggtest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run Ogg test program, checking why..."
|
||||
CFLAGS="$CFLAGS $OGG_CFLAGS"
|
||||
LIBS="$LIBS $OGG_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <stdio.h>
|
||||
#include <ogg/ogg.h>
|
||||
], [ return 0; ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding Ogg or finding the wrong"
|
||||
echo "*** version of Ogg. If it is not finding Ogg, you'll need to set your"
|
||||
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
|
||||
echo "*** to the installed location Also, make sure you have run ldconfig if that"
|
||||
echo "*** is required on your system"
|
||||
echo "***"
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occured. This usually means Ogg was incorrectly installed"
|
||||
echo "*** or that you have moved Ogg since it was installed." ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
OGG_CFLAGS=""
|
||||
OGG_LIBS=""
|
||||
ifelse([$2], , :, [$2])
|
||||
fi
|
||||
AC_SUBST(OGG_CFLAGS)
|
||||
AC_SUBST(OGG_LIBS)
|
||||
rm -f conf.oggtest
|
||||
])
|
|
@ -1,117 +0,0 @@
|
|||
# Configure paths for libopus
|
||||
# Gregory Maxwell <greg@xiph.org> 08-30-2012
|
||||
# Shamelessly stolen from Jack Moffitt (libogg) who
|
||||
# Shamelessly stole from Owen Taylor and Manish Singh
|
||||
|
||||
dnl XIPH_PATH_OPUS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||
dnl Test for libopus, and define OPUS_CFLAGS and OPUS_LIBS
|
||||
dnl
|
||||
AC_DEFUN([XIPH_PATH_OPUS],
|
||||
[dnl
|
||||
dnl Get the cflags and libraries
|
||||
dnl
|
||||
AC_ARG_WITH(opus,AC_HELP_STRING([--with-opus=PFX],[Prefix where opus is installed (optional)]), opus_prefix="$withval", opus_prefix="")
|
||||
AC_ARG_WITH(opus-libraries,AC_HELP_STRING([--with-opus-libraries=DIR],[Directory where the opus library is installed (optional)]), opus_libraries="$withval", opus_libraries="")
|
||||
AC_ARG_WITH(opus-includes,AC_HELP_STRING([--with-opus-includes=DIR],[Directory where the opus header files are installed (optional)]), opus_includes="$withval", opus_includes="")
|
||||
AC_ARG_ENABLE(opustest,AC_HELP_STRING([--disable-opustest],[Do not try to compile and run a test opus program]),, enable_opustest=yes)
|
||||
|
||||
if test "x$opus_libraries" != "x" ; then
|
||||
OPUS_LIBS="-L$opus_libraries"
|
||||
elif test "x$opus_prefix" = "xno" || test "x$opus_prefix" = "xyes" ; then
|
||||
OPUS_LIBS=""
|
||||
elif test "x$opus_prefix" != "x" ; then
|
||||
OPUS_LIBS="-L$opus_prefix/lib"
|
||||
elif test "x$prefix" != "xNONE" ; then
|
||||
OPUS_LIBS="-L$prefix/lib"
|
||||
fi
|
||||
|
||||
if test "x$opus_prefix" != "xno" ; then
|
||||
OPUS_LIBS="$OPUS_LIBS -lopus"
|
||||
fi
|
||||
|
||||
if test "x$opus_includes" != "x" ; then
|
||||
OPUS_CFLAGS="-I$opus_includes"
|
||||
elif test "x$opus_prefix" = "xno" || test "x$opus_prefix" = "xyes" ; then
|
||||
OPUS_CFLAGS=""
|
||||
elif test "x$opus_prefix" != "x" ; then
|
||||
OPUS_CFLAGS="-I$opus_prefix/include"
|
||||
elif test "x$prefix" != "xNONE"; then
|
||||
OPUS_CFLAGS="-I$prefix/include"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for Opus)
|
||||
if test "x$opus_prefix" = "xno" ; then
|
||||
no_opus="disabled"
|
||||
enable_opustest="no"
|
||||
else
|
||||
no_opus=""
|
||||
fi
|
||||
|
||||
|
||||
if test "x$enable_opustest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $OPUS_CFLAGS"
|
||||
LIBS="$LIBS $OPUS_LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed Opus is sufficiently new.
|
||||
dnl
|
||||
rm -f conf.opustest
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <opus.h>
|
||||
|
||||
int main ()
|
||||
{
|
||||
system("touch conf.opustest");
|
||||
return 0;
|
||||
}
|
||||
|
||||
],, no_opus=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
|
||||
if test "x$no_opus" = "xdisabled" ; then
|
||||
AC_MSG_RESULT(no)
|
||||
ifelse([$2], , :, [$2])
|
||||
elif test "x$no_opus" = "x" ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$1], , :, [$1])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test -f conf.opustest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run Opus test program, checking why..."
|
||||
CFLAGS="$CFLAGS $OPUS_CFLAGS"
|
||||
LIBS="$LIBS $OPUS_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <stdio.h>
|
||||
#include <opus.h>
|
||||
], [ return 0; ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding Opus or finding the wrong"
|
||||
echo "*** version of Opus. If it is not finding Opus, you'll need to set your"
|
||||
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
|
||||
echo "*** to the installed location Also, make sure you have run ldconfig if that"
|
||||
echo "*** is required on your system"
|
||||
echo "***"
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occured. This usually means Opus was incorrectly installed"
|
||||
echo "*** or that you have moved Opus since it was installed." ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
OPUS_CFLAGS=""
|
||||
OPUS_LIBS=""
|
||||
ifelse([$2], , :, [$2])
|
||||
fi
|
||||
AC_SUBST(OPUS_CFLAGS)
|
||||
AC_SUBST(OPUS_LIBS)
|
||||
rm -f conf.opustest
|
||||
])
|
|
@ -1,157 +0,0 @@
|
|||
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
|
||||
# serial 1 (pkg-config-0.24)
|
||||
#
|
||||
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
|
||||
# ----------------------------------
|
||||
AC_DEFUN([PKG_PROG_PKG_CONFIG],
|
||||
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
|
||||
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
|
||||
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
|
||||
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
|
||||
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
|
||||
|
||||
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
|
||||
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
|
||||
fi
|
||||
if test -n "$PKG_CONFIG"; then
|
||||
_pkg_min_version=m4_default([$1], [0.9.0])
|
||||
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
|
||||
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
PKG_CONFIG=""
|
||||
fi
|
||||
fi[]dnl
|
||||
])# PKG_PROG_PKG_CONFIG
|
||||
|
||||
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||
#
|
||||
# Check to see whether a particular set of modules exists. Similar
|
||||
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
|
||||
#
|
||||
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
||||
# only at the first occurence in configure.ac, so if the first place
|
||||
# it's called might be skipped (such as if it is within an "if", you
|
||||
# have to call PKG_CHECK_EXISTS manually
|
||||
# --------------------------------------------------------------
|
||||
AC_DEFUN([PKG_CHECK_EXISTS],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
|
||||
m4_default([$2], [:])
|
||||
m4_ifvaln([$3], [else
|
||||
$3])dnl
|
||||
fi])
|
||||
|
||||
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
|
||||
# ---------------------------------------------
|
||||
m4_define([_PKG_CONFIG],
|
||||
[if test -n "$$1"; then
|
||||
pkg_cv_[]$1="$$1"
|
||||
elif test -n "$PKG_CONFIG"; then
|
||||
PKG_CHECK_EXISTS([$3],
|
||||
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
|
||||
[pkg_failed=yes])
|
||||
else
|
||||
pkg_failed=untried
|
||||
fi[]dnl
|
||||
])# _PKG_CONFIG
|
||||
|
||||
# _PKG_SHORT_ERRORS_SUPPORTED
|
||||
# -----------------------------
|
||||
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
||||
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
|
||||
_pkg_short_errors_supported=yes
|
||||
else
|
||||
_pkg_short_errors_supported=no
|
||||
fi[]dnl
|
||||
])# _PKG_SHORT_ERRORS_SUPPORTED
|
||||
|
||||
|
||||
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
|
||||
# [ACTION-IF-NOT-FOUND])
|
||||
#
|
||||
#
|
||||
# Note that if there is a possibility the first call to
|
||||
# PKG_CHECK_MODULES might not happen, you should be sure to include an
|
||||
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
|
||||
#
|
||||
#
|
||||
# --------------------------------------------------------------
|
||||
AC_DEFUN([PKG_CHECK_MODULES],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
||||
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
|
||||
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
|
||||
|
||||
pkg_failed=no
|
||||
AC_MSG_CHECKING([for $1])
|
||||
|
||||
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
|
||||
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
|
||||
|
||||
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
|
||||
and $1[]_LIBS to avoid the need to call pkg-config.
|
||||
See the pkg-config man page for more details.])
|
||||
|
||||
if test $pkg_failed = yes; then
|
||||
AC_MSG_RESULT([no])
|
||||
_PKG_SHORT_ERRORS_SUPPORTED
|
||||
if test $_pkg_short_errors_supported = yes; then
|
||||
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
|
||||
else
|
||||
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
|
||||
fi
|
||||
# Put the nasty error message in config.log where it belongs
|
||||
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
|
||||
|
||||
m4_default([$4], [AC_MSG_ERROR(
|
||||
[Package requirements ($2) were not met:
|
||||
|
||||
$$1_PKG_ERRORS
|
||||
|
||||
Consider adjusting the PKG_CONFIG_PATH environment variable if you
|
||||
installed software in a non-standard prefix.
|
||||
|
||||
_PKG_TEXT])
|
||||
])
|
||||
elif test $pkg_failed = untried; then
|
||||
AC_MSG_RESULT([no])
|
||||
m4_default([$4], [AC_MSG_FAILURE(
|
||||
[The pkg-config script could not be found or is too old. Make sure it
|
||||
is in your PATH or set the PKG_CONFIG environment variable to the full
|
||||
path to pkg-config.
|
||||
|
||||
_PKG_TEXT
|
||||
|
||||
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])
|
||||
])
|
||||
else
|
||||
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
|
||||
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
|
||||
AC_MSG_RESULT([yes])
|
||||
$3
|
||||
fi[]dnl
|
||||
])# PKG_CHECK_MODULES
|
|
@ -1,122 +0,0 @@
|
|||
.\" Process this file with
|
||||
.\" groff -man -Tascii opusdec.1
|
||||
.\"
|
||||
.TH opusdec 1 2012-08-31 "Xiph.Org Foundation" "opus-tools"
|
||||
|
||||
.SH NAME
|
||||
opusdec \- decode audio from Opus format to WAV (or simple audio output)
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B opusdec
|
||||
[
|
||||
.B -hV
|
||||
] [
|
||||
.B --rate Hz
|
||||
] [
|
||||
.B --gain dB
|
||||
] [
|
||||
.B --no-dither
|
||||
] [
|
||||
.B --float
|
||||
] [
|
||||
.B --force-wav
|
||||
] [
|
||||
.B --packet-loss pct
|
||||
] [
|
||||
.B --save-range file
|
||||
]
|
||||
.B input.opus
|
||||
[
|
||||
.B output.wav
|
||||
]
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
||||
.B opusdec
|
||||
decodes Opus files into PCM Wave (uncompressed) files.
|
||||
|
||||
If the input file is specified as
|
||||
.B "-"
|
||||
, then
|
||||
.B opusdec
|
||||
will read from stdin. Likewise, an output filename of
|
||||
.B "-"
|
||||
will cause output to be to stdout.
|
||||
|
||||
If no output is specified
|
||||
.B opusdec
|
||||
will attempt to play the audio in realtime if it supports
|
||||
audio playback on your system.
|
||||
|
||||
.SH "OPTIONS"
|
||||
.IP "-h, --help"
|
||||
Print help message
|
||||
.IP "-V, --version"
|
||||
Display version information
|
||||
.IP "--quiet"
|
||||
Suppresses program output
|
||||
.IP "--rate"
|
||||
.br
|
||||
Force decoding at sampling rate n Hz
|
||||
.IP "--gain"
|
||||
.br
|
||||
Adjust the output volume n dB, negative values make the signal quieter.
|
||||
.IP "--no-dither"
|
||||
Do not dither 16-bit output
|
||||
.IP "--float"
|
||||
32-bit floating-point files instead of 16-bit files
|
||||
.IP "--force-wav"
|
||||
Force including a wav header on output (e.g. for non-wav extensions and stdout)
|
||||
.IP "--packet-loss"
|
||||
Simulate n % random Opus packet loss
|
||||
.IP "--save-range"
|
||||
Saves check values for every frame to a file
|
||||
|
||||
.SH EXAMPLES
|
||||
Decode a file
|
||||
.B input.opus
|
||||
to
|
||||
.B output.wav
|
||||
.RS
|
||||
opusdec input.opus output.wav
|
||||
.RE
|
||||
|
||||
Play a file
|
||||
.B input.opus
|
||||
and force output at 48000 regardless of
|
||||
the original sampling rate
|
||||
.br
|
||||
.I (48kHz output may be faster, due to avoiding resampling and some sound hardware produces higher quality output when run at 48kHz)
|
||||
.RS
|
||||
opusdec --rate 48000 input.opus
|
||||
.RE
|
||||
|
||||
Re-encode a high bitrate Opus file to a lower rate
|
||||
.RS
|
||||
opusdec --force-wav input.opus - | opusenc --bitrate 64 - output.opus
|
||||
.RE
|
||||
|
||||
Play an http stream
|
||||
.B http://icecast.somwhere.org:8000/stream.opus
|
||||
with the help of curl on a system with pulseaudio
|
||||
.br
|
||||
.I (press ctrl-c to quit)
|
||||
.RS
|
||||
curl http://icecast.somwhere.org:8000/stream.opus | padsp opusdec -
|
||||
.RE
|
||||
|
||||
.SH AUTHORS
|
||||
.br
|
||||
Jean-Marc Valin <jmvalin@jmvalin.ca>
|
||||
.br
|
||||
Gregory Maxwell <greg@xiph.org>
|
||||
|
||||
.SH BUGS
|
||||
|
||||
Opusdec does not currently reject all invalid files which it should reject.
|
||||
It also doesn't provide very helpful output for the corrupted files it
|
||||
does reject. Use \fBopusinfo\fR(1) for somewhat better diagnostics.
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR opusenc (1),
|
||||
.BR opusinfo (1)
|
|
@ -1,360 +0,0 @@
|
|||
.\" Process this file with
|
||||
.\" groff -man -Tascii opusenc.1
|
||||
.\"
|
||||
.TH opusenc 1 2012-08-31 "Xiph.Org Foundation" "opus-tools"
|
||||
|
||||
.SH NAME
|
||||
opusenc \- encode audio into the Opus format
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B opusenc
|
||||
[
|
||||
.B -h
|
||||
] [
|
||||
.B -V
|
||||
] [
|
||||
.B --bitrate
|
||||
.I kbit/sec
|
||||
] [
|
||||
.B --vbr
|
||||
] [
|
||||
.B --cvbr
|
||||
] [
|
||||
.B --hard-cbr
|
||||
] [
|
||||
.B --comp
|
||||
.I complexity
|
||||
] [
|
||||
.B --framesize
|
||||
.I 2.5, 5, 10, 20, 40, 60
|
||||
] [
|
||||
.B --expect-loss
|
||||
.I pct
|
||||
] [
|
||||
.B --downmix-mono
|
||||
] [
|
||||
.B --downmix-stereo
|
||||
] [
|
||||
.B --max-delay
|
||||
.I ms
|
||||
] [
|
||||
.B --serial
|
||||
.I serial number
|
||||
] [
|
||||
.B --save-range
|
||||
.I file
|
||||
] [
|
||||
.B --set-ctl-int
|
||||
.I ctl=value
|
||||
] [
|
||||
.B --comment
|
||||
.I tag=value
|
||||
] [
|
||||
.B --artist
|
||||
.I author
|
||||
] [
|
||||
.B --title
|
||||
.I 'track title'
|
||||
] [
|
||||
.B --album
|
||||
.I 'album title'
|
||||
] [
|
||||
.B --date
|
||||
.I YYYY-MM-DD
|
||||
] [
|
||||
.B --genre
|
||||
.I genre
|
||||
] [
|
||||
.B --picture
|
||||
.IB filename | specification
|
||||
] [
|
||||
.B --padding
|
||||
.I n
|
||||
] [
|
||||
.B --discard-comments
|
||||
] [
|
||||
.B --discard-pictures
|
||||
] [
|
||||
.B --raw
|
||||
] [
|
||||
.B --raw-bits
|
||||
.I bits/sample
|
||||
] [
|
||||
.B --raw-rate
|
||||
.I Hz
|
||||
] [
|
||||
.B --raw-chan
|
||||
.I N
|
||||
] [
|
||||
.B --raw-endianness
|
||||
.I flag
|
||||
] [
|
||||
.B --ignorelength
|
||||
]
|
||||
.I input.wav
|
||||
.I output.opus
|
||||
|
||||
.SH DESCRIPTION
|
||||
.B opusenc
|
||||
reads audio data in either raw, Wave, or AIFF format and encodes it into an
|
||||
Opus stream. If the input file is "-" audio data is read from stdin.
|
||||
Likewise, if the output file is "-" opus data is written to stdout.
|
||||
|
||||
Unless quieted
|
||||
.B opusenc
|
||||
displays fancy statistics about the encoding progress.
|
||||
|
||||
.SH OPTIONS
|
||||
.IP "-h, --help"
|
||||
Show command help
|
||||
.IP "-V, --version"
|
||||
Show the version number
|
||||
.IP "--bitrate N.nnn"
|
||||
Target bitrate in kbit/sec (6-256 per channel)
|
||||
|
||||
In VBR mode this specifies the average rate for a large and diverse
|
||||
collection of audio. In CVBR and Hard-CBR mode it specifies the specific
|
||||
output bitrate.
|
||||
|
||||
Default for >=44.1kHz input is 64kbps per mono stream, 96kbps per coupled pair.
|
||||
|
||||
.IP "--vbr"
|
||||
Use variable bitrate encoding (default)
|
||||
|
||||
In VBR mode the bitrate may go up and down freely depending on the content
|
||||
to achieve more consistent quality.
|
||||
|
||||
.IP "--cvbr"
|
||||
Use constrained variable bitrate encoding.
|
||||
|
||||
Outputs to a specific bitrate. This mode is analogous to CBR in AAC/MP3
|
||||
encoders and managed mode in vorbis coders. This delivers less consistent
|
||||
quality than VBR mode but consistent bitrate.
|
||||
.IP "--hard-cbr"
|
||||
Use hard constant bitrate encoding.
|
||||
|
||||
With hard-cbr every frame will be exactly the same size, similar to how
|
||||
speech codecs work. This delivers lower overall quality but is useful
|
||||
where bitrate changes might leak data in encrypted channels or on
|
||||
synchronous transports.
|
||||
.IP "--comp N"
|
||||
Encoding computational complexity (0-10, default: 10). Zero gives the
|
||||
fastest encodes but lower quality, while 10 gives the highest quality
|
||||
but slower encoding.
|
||||
.IP "--framesize N"
|
||||
Maximum frame size in milliseconds (2.5, 5, 10, 20, 40, 60, default: 20)
|
||||
.br
|
||||
Smaller framesizes achieve lower latency but less quality at a given
|
||||
bitrate.
|
||||
.br
|
||||
Sizes greater than 20ms are only interesting at fairly low
|
||||
bitrates.
|
||||
.IP "--expect-loss N"
|
||||
Percentage packet loss to expect (default: 0)
|
||||
.IP "--downmix-mono"
|
||||
Downmix to mono
|
||||
.IP "--downmix-stereo"
|
||||
Downmix to stereo (if >2 channels input)
|
||||
.IP "--max-delay N"
|
||||
Maximum container delay in milliseconds (0-1000, default: 1000)
|
||||
.IP "--serial n"
|
||||
Forces the stream serial number to a specified value (instead of being random).
|
||||
This is used to make the encoder deterministic for testing and is not generally recommended.
|
||||
.IP "--save-range file"
|
||||
Saves check values for every frame to a file
|
||||
.IP "--set-ctl-int x=y"
|
||||
Pass the encoder control x with value y (advanced)
|
||||
Preface with s: to direct the ctl to multistream s
|
||||
.br
|
||||
This may be used multiple times
|
||||
|
||||
.IP "--comment tag=value"
|
||||
Add an extra comment. This may be used multiple times, and all
|
||||
instances will be added to each of the input files specified. The argument
|
||||
should be in the form "tag=value".
|
||||
See the vorbis-comment specification for well known tag names:
|
||||
http://www.xiph.org/vorbis/doc/v-comment.html
|
||||
.IP "--artist artist"
|
||||
Set the artist comment field to
|
||||
.I artist.
|
||||
This may be used multiple times to list contributing artists individually.
|
||||
Note that some playback software does not display multiple artists gracefully.
|
||||
.IP "--title title"
|
||||
Set the track title comment field to
|
||||
.I title
|
||||
.IP "--album album"
|
||||
Set the album or collection title field to
|
||||
.I album
|
||||
.IP "--date YYYY-MM-DD"
|
||||
Set the date comment field to
|
||||
.I YYYY-MM-DD
|
||||
.IP "--genre genre"
|
||||
Set the genre comment field to
|
||||
.I genre.
|
||||
This option may be specified multiple times to tag a track with
|
||||
multiple overlapping genres.
|
||||
.IP "--picture filename|specification"
|
||||
Attach album art for the track.
|
||||
|
||||
Either a
|
||||
.I filename
|
||||
for the artwork or a more complete
|
||||
.I specification
|
||||
form can be used.
|
||||
The picture is added to a
|
||||
.B METADATA_BLOCK_PICTURE
|
||||
comment field similar to what is used in
|
||||
.SM FLAC.
|
||||
The
|
||||
.I specification
|
||||
is a string whose parts are separated by | (pipe) characters.
|
||||
Some parts may be left empty to invoke default values.
|
||||
Passing a plain filename is just shorthand for the "||||filename"
|
||||
specification.
|
||||
|
||||
The format of
|
||||
.I specification
|
||||
is [\fBtype\fR]|[\fBmime-type\fR]|[\fBdescription\fR]|[\fBwidth\fRx\fBheight\fRx\fBdepth\fR[/\fBcolors\fR]]|\fBfilename\fR
|
||||
|
||||
.I type
|
||||
is an optional number describing the nature of the picture.
|
||||
Defined values are from one of:
|
||||
|
||||
0: Other
|
||||
.br
|
||||
1: 32x32 pixel 'file icon' (PNG only)
|
||||
.br
|
||||
2: Other file icon
|
||||
.br
|
||||
3: Cover (front)
|
||||
.br
|
||||
4: Cover (back)
|
||||
.br
|
||||
5: Leaflet page
|
||||
.br
|
||||
6: Media (e.g., label side of a CD)
|
||||
.br
|
||||
7: Lead artist/lead performer/soloist
|
||||
.br
|
||||
8: Artist/performer
|
||||
.br
|
||||
9: Conductor
|
||||
.br
|
||||
10: Band/Orchestra
|
||||
.br
|
||||
11: Composer
|
||||
.br
|
||||
12: Lyricist/text writer
|
||||
.br
|
||||
13: Recording location
|
||||
.br
|
||||
14: During recording
|
||||
.br
|
||||
15: During performance
|
||||
.br
|
||||
16: Movie/video screen capture
|
||||
.br
|
||||
17: A bright colored fish
|
||||
.br
|
||||
18: Illustration
|
||||
.br
|
||||
19: Band/artist logotype
|
||||
.br
|
||||
20: Publisher/studio logotype
|
||||
|
||||
The default is 3 (front cover).
|
||||
More than one --picture option can be specified to attach multiple pictures.
|
||||
There may only be one picture each of type 1 and 2 in a file.
|
||||
|
||||
.I mime-type
|
||||
is optional. If left blank, it will be detected from the file. For
|
||||
best compatibility with players, use pictures with a
|
||||
.I mime-type
|
||||
of image/jpeg or image/png. The
|
||||
.I mime-type
|
||||
can also be "-->" to mean that
|
||||
.I filename
|
||||
is actually a URL to an image, though this use is discouraged.
|
||||
The file at the URL will not be fetched.
|
||||
The URL itself is stored in the comment field.
|
||||
|
||||
.I description
|
||||
is optional. The default is an empty string.
|
||||
|
||||
The next part specifies the resolution and color information. If the
|
||||
.I mime-type
|
||||
is image/jpeg, image/png, or image/gif, you can usually leave this empty and
|
||||
they can be detected from the file. Otherwise, you must specify the width in
|
||||
pixels, height in pixels, and color depth in bits-per-pixel. If the image has
|
||||
indexed colors you should also specify the number of colors used. If possible,
|
||||
these are checked against the file for accuracy.
|
||||
|
||||
.I filename
|
||||
is the path to the picture file to be imported, or the URL if the
|
||||
.I mime-type
|
||||
is -->.
|
||||
.IP "--padding n"
|
||||
Reserve
|
||||
.I n
|
||||
extra bytes for metadata tags. This can make later tag editing more
|
||||
efficient. Defaults to 512.
|
||||
.IP "--discard-comments"
|
||||
Don't propagate metadata tags from the input file.
|
||||
.IP "--discard-pictures"
|
||||
Don't propagate pictures or art from the input file.
|
||||
|
||||
.IP "--raw"
|
||||
Raw (headerless) PCM input
|
||||
.IP "--raw-bits N"
|
||||
Set bits/sample for raw input (default: 16)
|
||||
.IP "--raw-rate N"
|
||||
Set sampling rate for raw input (default: 48000)
|
||||
.IP "--raw-chan N"
|
||||
Set number of channels for raw input (default: 2)
|
||||
.IP "--raw-endianness [0/1]"
|
||||
Set the endianness for raw input: 1 for bigendian, 0 for little (defaults to 0)
|
||||
.IP "--ignorelength"
|
||||
Always ignore the datalength in Wave headers. Opusenc automatically ignores
|
||||
the length when its implausible (very small or very large) but some STDIN
|
||||
usage may still need this option to avoid truncation.
|
||||
|
||||
.SH EXAMPLES
|
||||
|
||||
Simplest usage. Take input as input.wav and produce output as output.opus:
|
||||
.RS
|
||||
opusenc input.wav output.opus
|
||||
.RE
|
||||
.PP
|
||||
|
||||
Produce a very high quality encode with a target rate of 160kbps:
|
||||
.RS
|
||||
opusenc --bitrate 160 input.wav output.opus
|
||||
.RE
|
||||
.PP
|
||||
|
||||
Record and send a live stream to an Icecast HTTP streaming server using oggfwd:
|
||||
.RS
|
||||
arecord -c 2 -r 48000 -twav - | opusenc --bitrate 96 - - | oggfwd icecast.somewhere.org 8000 password /stream.opus
|
||||
.RE
|
||||
.PP
|
||||
|
||||
.SH NOTES
|
||||
|
||||
While it is possible to use opusenc for low latency streaming (e.g. with --max-delay set to 0
|
||||
and netcat instead of Icecast) it's not really designed for this, and the Ogg container
|
||||
and TCP transport aren't the best tools for that application. Shell
|
||||
pipelines themselves will often have high buffering. The ability to set
|
||||
framesizes as low as 2.5 ms in opusenc mostly exists to try out the quality
|
||||
of the format with low latency settings, but not really for actual low
|
||||
latency usage.
|
||||
.br
|
||||
Interactive usage should use UDP/RTP directly.
|
||||
|
||||
.SH AUTHORS
|
||||
.br
|
||||
Gregory Maxwell <greg@xiph.org>
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR opusdec (1),
|
||||
.BR opusinfo (1),
|
||||
.BR oggfwd (1)
|
|
@ -1,72 +0,0 @@
|
|||
.\" Process this file with
|
||||
.\" groff -man -Tascii opusinfo.1
|
||||
.\"
|
||||
.TH opusinfo 1 2012-08-31 "Xiph.Org Foundation" "opus-tools"
|
||||
|
||||
.SH NAME
|
||||
opusinfo \- gives information about Opus files and does extensive validity checking
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B opusinfo
|
||||
[
|
||||
.B -q
|
||||
|
|
||||
.B -v
|
||||
] [
|
||||
.B -h
|
||||
] [
|
||||
.B -V
|
||||
]
|
||||
.I file1.opus
|
||||
.B ...
|
||||
.I fileN.opus
|
||||
|
||||
.SH DESCRIPTION
|
||||
.B opusinfo
|
||||
reads one or more Opus files and prints information about stream contents
|
||||
(including chained and/or multiplexed streams) to standard output. It will
|
||||
detect (but not correct) a wide range of common defects, with many
|
||||
additional checks specifically for Opus streams.
|
||||
|
||||
For all stream types
|
||||
.B opusinfo
|
||||
will print the filename being processed, the stream serial numbers, and various
|
||||
common error conditions.
|
||||
|
||||
For
|
||||
.B Opus
|
||||
streams, information including the version used for encoding, number of channels
|
||||
and other header information, the bitrate and playback length, the contents of the
|
||||
comment header, and general statistics about the stream are printed.
|
||||
|
||||
Opusinfo is a fork of \fBogginfo\fR(1) with the non-opus parts largely removed.
|
||||
|
||||
.SH OPTIONS
|
||||
.IP -h
|
||||
Show a help and usage message.
|
||||
.IP -q
|
||||
Quiet mode. This may be specified multiple times. Doing so once will remove
|
||||
the detailed informative messages; twice will remove warnings as well.
|
||||
.IP -v
|
||||
Verbose mode. At the current time, this does not do anything.
|
||||
.IP -V
|
||||
Show program version info and exit.
|
||||
|
||||
.SH NOTES
|
||||
|
||||
There are many kinds of errored, invalid, non-normative, or otherwise
|
||||
unwise stream constructions which opusinfo will not produce warnings
|
||||
on. Passing opusinfo with flying colors is not certification of the
|
||||
correctness of a stream. Future versions may detect more error
|
||||
conditions.
|
||||
|
||||
.SH AUTHORS
|
||||
.br
|
||||
Michael Smith <msmith@xiph.org>
|
||||
.br
|
||||
Gregory Maxwell <greg@xiph.org>
|
||||
|
||||
.SH SEE ALSO
|
||||
|
||||
.BR opusdec (1),
|
||||
.BR opusenc (1)
|
|
@ -1,58 +0,0 @@
|
|||
.\" Process this file with
|
||||
.\" groff -man -Tascii opusrtp.1
|
||||
.\"
|
||||
.TH opusrtp 1 2012-08-31 "Xiph.Org Foundation" "opus-tools"
|
||||
|
||||
.SH NAME
|
||||
opusrtp \- encapsulate Opus audio in RTP
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B opusrtp
|
||||
[
|
||||
.B -hV
|
||||
]
|
||||
[
|
||||
.B --sniff
|
||||
]
|
||||
.B file.opus
|
||||
[
|
||||
.B file2.opus ...
|
||||
]
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
||||
.B opusrtp
|
||||
Demonstration tool for sending and receiving Opus audio data in RTP,
|
||||
used for interactive applications on the internet.
|
||||
|
||||
By default, Opus audio from each given file is sent as an RTP stream.
|
||||
|
||||
.SH "OPTIONS"
|
||||
.IP "-h, --help"
|
||||
Print help message
|
||||
.IP "-V, --version"
|
||||
Display version information
|
||||
.IP "--quiet"
|
||||
Suppresses program output
|
||||
.IP "--sniff"
|
||||
Sniff the network for active RTP sessions and save them to .opus
|
||||
files. This can be useful for debugging other Opus RTP implementations.
|
||||
For this function to work, the program must be run with superuser
|
||||
privileges.
|
||||
|
||||
.SH AUTHORS
|
||||
.br
|
||||
Ralph Giles <giles@thaumas.net>
|
||||
|
||||
.SH BUGS
|
||||
|
||||
Only the sniff mode is implemented; the tool should do normal unicast
|
||||
and multicast send/receive.
|
||||
|
||||
The sniff mode should allow specifying device/host/port/payload type
|
||||
to limit capture. All that is hard-coded.
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR opusdec (1),
|
||||
.BR opusenc (1),
|
||||
.BR opusinfo (1)
|
|
@ -1,215 +0,0 @@
|
|||
#! /bin/sh
|
||||
# Common wrapper for a few potentially missing GNU programs.
|
||||
|
||||
scriptversion=2012-06-26.16; # UTC
|
||||
|
||||
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
|
||||
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
|
||||
--is-lightweight)
|
||||
# Used by our autoconf macros to check whether the available missing
|
||||
# script is modern enough.
|
||||
exit 0
|
||||
;;
|
||||
|
||||
--run)
|
||||
# Back-compat with the calling convention used by older automake.
|
||||
shift
|
||||
;;
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
|
||||
to PROGRAM being missing or too old.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal autoconf autoheader autom4te automake makeinfo
|
||||
bison yacc flex lex help2man
|
||||
|
||||
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
|
||||
'g' are ignored when checking the name.
|
||||
|
||||
Send bug reports to <bug-automake@gnu.org>."
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing $scriptversion (GNU Automake)"
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: unknown '$1' option"
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# Run the given program, remember its exit status.
|
||||
"$@"; st=$?
|
||||
|
||||
# If it succeeded, we are done.
|
||||
test $st -eq 0 && exit 0
|
||||
|
||||
# Also exit now if we it failed (or wasn't found), and '--version' was
|
||||
# passed; such an option is passed most likely to detect whether the
|
||||
# program is present and works.
|
||||
case $2 in --version|--help) exit $st;; esac
|
||||
|
||||
# Exit code 63 means version mismatch. This often happens when the user
|
||||
# tries to use an ancient version of a tool on a file that requires a
|
||||
# minimum version.
|
||||
if test $st -eq 63; then
|
||||
msg="probably too old"
|
||||
elif test $st -eq 127; then
|
||||
# Program was missing.
|
||||
msg="missing on your system"
|
||||
else
|
||||
# Program was found and executed, but failed. Give up.
|
||||
exit $st
|
||||
fi
|
||||
|
||||
perl_URL=http://www.perl.org/
|
||||
flex_URL=http://flex.sourceforge.net/
|
||||
gnu_software_URL=http://www.gnu.org/software
|
||||
|
||||
program_details ()
|
||||
{
|
||||
case $1 in
|
||||
aclocal|automake)
|
||||
echo "The '$1' program is part of the GNU Automake package:"
|
||||
echo "<$gnu_software_URL/automake>"
|
||||
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/autoconf>"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
autoconf|autom4te|autoheader)
|
||||
echo "The '$1' program is part of the GNU Autoconf package:"
|
||||
echo "<$gnu_software_URL/autoconf/>"
|
||||
echo "It also requires GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice ()
|
||||
{
|
||||
# Normalize program name to check for.
|
||||
normalized_program=`echo "$1" | sed '
|
||||
s/^gnu-//; t
|
||||
s/^gnu//; t
|
||||
s/^g//; t'`
|
||||
|
||||
printf '%s\n' "'$1' is $msg."
|
||||
|
||||
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
|
||||
case $normalized_program in
|
||||
autoconf*)
|
||||
echo "You should only need it if you modified 'configure.ac',"
|
||||
echo "or m4 files included by it."
|
||||
program_details 'autoconf'
|
||||
;;
|
||||
autoheader*)
|
||||
echo "You should only need it if you modified 'acconfig.h' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'autoheader'
|
||||
;;
|
||||
automake*)
|
||||
echo "You should only need it if you modified 'Makefile.am' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'automake'
|
||||
;;
|
||||
aclocal*)
|
||||
echo "You should only need it if you modified 'acinclude.m4' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'aclocal'
|
||||
;;
|
||||
autom4te*)
|
||||
echo "You might have modified some maintainer files that require"
|
||||
echo "the 'automa4te' program to be rebuilt."
|
||||
program_details 'autom4te'
|
||||
;;
|
||||
bison*|yacc*)
|
||||
echo "You should only need it if you modified a '.y' file."
|
||||
echo "You may want to install the GNU Bison package:"
|
||||
echo "<$gnu_software_URL/bison/>"
|
||||
;;
|
||||
lex*|flex*)
|
||||
echo "You should only need it if you modified a '.l' file."
|
||||
echo "You may want to install the Fast Lexical Analyzer package:"
|
||||
echo "<$flex_URL>"
|
||||
;;
|
||||
help2man*)
|
||||
echo "You should only need it if you modified a dependency" \
|
||||
"of a man page."
|
||||
echo "You may want to install the GNU Help2man package:"
|
||||
echo "<$gnu_software_URL/help2man/>"
|
||||
;;
|
||||
makeinfo*)
|
||||
echo "You should only need it if you modified a '.texi' file, or"
|
||||
echo "any other file indirectly affecting the aspect of the manual."
|
||||
echo "You might want to install the Texinfo package:"
|
||||
echo "<$gnu_software_URL/texinfo/>"
|
||||
echo "The spurious makeinfo call might also be the consequence of"
|
||||
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
|
||||
echo "want to install GNU make:"
|
||||
echo "<$gnu_software_URL/make/>"
|
||||
;;
|
||||
*)
|
||||
echo "You might have modified some files without having the proper"
|
||||
echo "tools for further handling them. Check the 'README' file, it"
|
||||
echo "often tells you about the needed prerequisites for installing"
|
||||
echo "this package. You may also peek at any GNU archive site, in"
|
||||
echo "case some other package contains this missing '$1' program."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice "$1" | sed -e '1s/^/WARNING: /' \
|
||||
-e '2,$s/^/ /' >&2
|
||||
|
||||
# Propagate the correct exit status (expected to be 127 for a program
|
||||
# not found, 63 for a program that failed due to version mismatch).
|
||||
exit $st
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
|
@ -1,32 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opusdec", "src\opusdec.vcxproj", "{26A9EEB4-030D-52F5-8999-7479F39B0420}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opusenc", "src\opusenc.vcxproj", "{0A40D595-3CCF-C117-31DC-2AC7A03419AF}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opusinfo", "src\opusinfo.vcxproj", "{63B119F8-86A2-2F2A-FBA5-E10744E703CB}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{26A9EEB4-030D-52F5-8999-7479F39B0420}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{26A9EEB4-030D-52F5-8999-7479F39B0420}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{26A9EEB4-030D-52F5-8999-7479F39B0420}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{26A9EEB4-030D-52F5-8999-7479F39B0420}.Release|Win32.Build.0 = Release|Win32
|
||||
{0A40D595-3CCF-C117-31DC-2AC7A03419AF}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{0A40D595-3CCF-C117-31DC-2AC7A03419AF}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{0A40D595-3CCF-C117-31DC-2AC7A03419AF}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{0A40D595-3CCF-C117-31DC-2AC7A03419AF}.Release|Win32.Build.0 = Release|Win32
|
||||
{63B119F8-86A2-2F2A-FBA5-E10744E703CB}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{63B119F8-86A2-2F2A-FBA5-E10744E703CB}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{63B119F8-86A2-2F2A-FBA5-E10744E703CB}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{63B119F8-86A2-2F2A-FBA5-E10744E703CB}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1 +0,0 @@
|
|||
PACKAGE_VERSION="0.1.9"
|
File diff suppressed because it is too large
Load diff
|
@ -1,188 +0,0 @@
|
|||
/* getopt_long and getopt_long_only entry points for GNU getopt.
|
||||
Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98
|
||||
Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "getopt.h"
|
||||
|
||||
#if !defined __STDC__ || !__STDC__
|
||||
/* This is a separate conditional since some stdc systems
|
||||
reject `defined (const)'. */
|
||||
#ifndef const
|
||||
#define const
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* Comment out all this code if we are using the GNU C Library, and are not
|
||||
actually compiling the library itself. This code is part of the GNU C
|
||||
Library, but also included in many other GNU distributions. Compiling
|
||||
and linking in this code is a waste when using the GNU C library
|
||||
(especially if it is a shared library). Rather than having every GNU
|
||||
program understand `configure --with-gnu-libc' and omit the object files,
|
||||
it is simpler to just do this in the source for each such file. */
|
||||
|
||||
#define GETOPT_INTERFACE_VERSION 2
|
||||
#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
|
||||
#include <gnu-versions.h>
|
||||
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
|
||||
#define ELIDE_CODE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ELIDE_CODE
|
||||
|
||||
|
||||
/* This needs to come after some library #include
|
||||
to get __GNU_LIBRARY__ defined. */
|
||||
#ifdef __GNU_LIBRARY__
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
int
|
||||
getopt_long (argc, argv, options, long_options, opt_index)
|
||||
int argc;
|
||||
char *const *argv;
|
||||
const char *options;
|
||||
const struct option *long_options;
|
||||
int *opt_index;
|
||||
{
|
||||
return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
|
||||
}
|
||||
|
||||
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
|
||||
If an option that starts with '-' (not '--') doesn't match a long option,
|
||||
but does match a short option, it is parsed as a short option
|
||||
instead. */
|
||||
|
||||
int
|
||||
getopt_long_only (argc, argv, options, long_options, opt_index)
|
||||
int argc;
|
||||
char *const *argv;
|
||||
const char *options;
|
||||
const struct option *long_options;
|
||||
int *opt_index;
|
||||
{
|
||||
return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
|
||||
}
|
||||
|
||||
|
||||
#endif /* Not ELIDE_CODE. */
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
int c;
|
||||
int digit_optind = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
int this_option_optind = optind ? optind : 1;
|
||||
int option_index = 0;
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{"add", 1, 0, 0},
|
||||
{"append", 0, 0, 0},
|
||||
{"delete", 1, 0, 0},
|
||||
{"verbose", 0, 0, 0},
|
||||
{"create", 0, 0, 0},
|
||||
{"file", 1, 0, 0},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
c = getopt_long (argc, argv, "abc:d:0123456789",
|
||||
long_options, &option_index);
|
||||
if (c == -1)
|
||||
break;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case 0:
|
||||
printf ("option %s", long_options[option_index].name);
|
||||
if (optarg)
|
||||
printf (" with arg %s", optarg);
|
||||
printf ("\n");
|
||||
break;
|
||||
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
if (digit_optind != 0 && digit_optind != this_option_optind)
|
||||
printf ("digits occur in two different argv-elements.\n");
|
||||
digit_optind = this_option_optind;
|
||||
printf ("option %c\n", c);
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
printf ("option a\n");
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
printf ("option b\n");
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
printf ("option c with value `%s'\n", optarg);
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
printf ("option d with value `%s'\n", optarg);
|
||||
break;
|
||||
|
||||
case '?':
|
||||
break;
|
||||
|
||||
default:
|
||||
printf ("?? getopt returned character code 0%o ??\n", c);
|
||||
}
|
||||
}
|
||||
|
||||
if (optind < argc)
|
||||
{
|
||||
printf ("non-option ARGV-elements: ");
|
||||
while (optind < argc)
|
||||
printf ("%s ", argv[optind++]);
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
#endif /* TEST */
|
|
@ -1,239 +0,0 @@
|
|||
/* Copyright (C) 2003 Jean-Marc Valin */
|
||||
/**
|
||||
@file arch.h
|
||||
@brief Various architecture definitions Speex
|
||||
*/
|
||||
/*
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef ARCH_H
|
||||
#define ARCH_H
|
||||
|
||||
#ifndef SPEEX_VERSION
|
||||
#define SPEEX_MAJOR_VERSION 1 /**< Major Speex version. */
|
||||
#define SPEEX_MINOR_VERSION 1 /**< Minor Speex version. */
|
||||
#define SPEEX_MICRO_VERSION 15 /**< Micro Speex version. */
|
||||
#define SPEEX_EXTRA_VERSION "" /**< Extra Speex version. */
|
||||
#define SPEEX_VERSION "speex-1.2beta3" /**< Speex version string. */
|
||||
#endif
|
||||
|
||||
/* A couple test to catch stupid option combinations */
|
||||
#ifdef FIXED_POINT
|
||||
|
||||
#ifdef FLOATING_POINT
|
||||
#error You cannot compile as floating point and fixed point at the same time
|
||||
#endif
|
||||
#ifdef _USE_SSE
|
||||
#error SSE is only for floating-point
|
||||
#endif
|
||||
#if ((defined (ARM4_ASM)||defined (ARM4_ASM)) && defined(BFIN_ASM)) || (defined (ARM4_ASM)&&defined(ARM5E_ASM))
|
||||
#error Make up your mind. What CPU do you have?
|
||||
#endif
|
||||
#ifdef VORBIS_PSYCHO
|
||||
#error Vorbis-psy model currently not implemented in fixed-point
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#ifndef FLOATING_POINT
|
||||
#error You now need to define either FIXED_POINT or FLOATING_POINT
|
||||
#endif
|
||||
#if defined (ARM4_ASM) || defined(ARM5E_ASM) || defined(BFIN_ASM)
|
||||
#error I suppose you can have a [ARM4/ARM5E/Blackfin] that has float instructions?
|
||||
#endif
|
||||
#ifdef FIXED_POINT_DEBUG
|
||||
#error "Don't you think enabling fixed-point is a good thing to do if you want to debug that?"
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef OUTSIDE_SPEEX
|
||||
#include "../include/speex/speex_types.h"
|
||||
#endif
|
||||
|
||||
#define ABS(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute integer value. */
|
||||
#define ABS16(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute 16-bit value. */
|
||||
#define MIN16(a,b) ((a) < (b) ? (a) : (b)) /**< Maximum 16-bit value. */
|
||||
#define MAX16(a,b) ((a) > (b) ? (a) : (b)) /**< Maximum 16-bit value. */
|
||||
#define ABS32(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute 32-bit value. */
|
||||
#define MIN32(a,b) ((a) < (b) ? (a) : (b)) /**< Maximum 32-bit value. */
|
||||
#define MAX32(a,b) ((a) > (b) ? (a) : (b)) /**< Maximum 32-bit value. */
|
||||
|
||||
#ifdef FIXED_POINT
|
||||
|
||||
typedef spx_int16_t spx_word16_t;
|
||||
typedef spx_int32_t spx_word32_t;
|
||||
typedef spx_word32_t spx_mem_t;
|
||||
typedef spx_word16_t spx_coef_t;
|
||||
typedef spx_word16_t spx_lsp_t;
|
||||
typedef spx_word32_t spx_sig_t;
|
||||
|
||||
#define Q15ONE 32767
|
||||
|
||||
#define LPC_SCALING 8192
|
||||
#define SIG_SCALING 16384
|
||||
#define LSP_SCALING 8192.
|
||||
#define GAMMA_SCALING 32768.
|
||||
#define GAIN_SCALING 64
|
||||
#define GAIN_SCALING_1 0.015625
|
||||
|
||||
#define LPC_SHIFT 13
|
||||
#define LSP_SHIFT 13
|
||||
#define SIG_SHIFT 14
|
||||
#define GAIN_SHIFT 6
|
||||
|
||||
#define VERY_SMALL 0
|
||||
#define VERY_LARGE32 ((spx_word32_t)2147483647)
|
||||
#define VERY_LARGE16 ((spx_word16_t)32767)
|
||||
#define Q15_ONE ((spx_word16_t)32767)
|
||||
|
||||
|
||||
#ifdef FIXED_DEBUG
|
||||
#include "fixed_debug.h"
|
||||
#else
|
||||
|
||||
#include "fixed_generic.h"
|
||||
|
||||
#ifdef ARM5E_ASM
|
||||
#include "fixed_arm5e.h"
|
||||
#elif defined (ARM4_ASM)
|
||||
#include "fixed_arm4.h"
|
||||
#elif defined (BFIN_ASM)
|
||||
#include "fixed_bfin.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#else
|
||||
|
||||
typedef float spx_mem_t;
|
||||
typedef float spx_coef_t;
|
||||
typedef float spx_lsp_t;
|
||||
typedef float spx_sig_t;
|
||||
typedef float spx_word16_t;
|
||||
typedef float spx_word32_t;
|
||||
|
||||
#define Q15ONE 1.0f
|
||||
#define LPC_SCALING 1.f
|
||||
#define SIG_SCALING 1.f
|
||||
#define LSP_SCALING 1.f
|
||||
#define GAMMA_SCALING 1.f
|
||||
#define GAIN_SCALING 1.f
|
||||
#define GAIN_SCALING_1 1.f
|
||||
|
||||
|
||||
#define VERY_SMALL 1e-15f
|
||||
#define VERY_LARGE32 1e15f
|
||||
#define VERY_LARGE16 1e15f
|
||||
#define Q15_ONE ((spx_word16_t)1.f)
|
||||
|
||||
#define QCONST16(x,bits) (x)
|
||||
#define QCONST32(x,bits) (x)
|
||||
|
||||
#define NEG16(x) (-(x))
|
||||
#define NEG32(x) (-(x))
|
||||
#define EXTRACT16(x) (x)
|
||||
#define EXTEND32(x) (x)
|
||||
#define SHR16(a,shift) (a)
|
||||
#define SHL16(a,shift) (a)
|
||||
#define SHR32(a,shift) (a)
|
||||
#define SHL32(a,shift) (a)
|
||||
#define PSHR16(a,shift) (a)
|
||||
#define PSHR32(a,shift) (a)
|
||||
#define VSHR32(a,shift) (a)
|
||||
#define SATURATE16(x,a) (x)
|
||||
#define SATURATE32(x,a) (x)
|
||||
|
||||
#define PSHR(a,shift) (a)
|
||||
#define SHR(a,shift) (a)
|
||||
#define SHL(a,shift) (a)
|
||||
#define SATURATE(x,a) (x)
|
||||
|
||||
#define ADD16(a,b) ((a)+(b))
|
||||
#define SUB16(a,b) ((a)-(b))
|
||||
#define ADD32(a,b) ((a)+(b))
|
||||
#define SUB32(a,b) ((a)-(b))
|
||||
#define MULT16_16_16(a,b) ((a)*(b))
|
||||
#define MULT16_16(a,b) ((spx_word32_t)(a)*(spx_word32_t)(b))
|
||||
#define MAC16_16(c,a,b) ((c)+(spx_word32_t)(a)*(spx_word32_t)(b))
|
||||
|
||||
#define MULT16_32_Q11(a,b) ((a)*(b))
|
||||
#define MULT16_32_Q13(a,b) ((a)*(b))
|
||||
#define MULT16_32_Q14(a,b) ((a)*(b))
|
||||
#define MULT16_32_Q15(a,b) ((a)*(b))
|
||||
#define MULT16_32_P15(a,b) ((a)*(b))
|
||||
|
||||
#define MAC16_32_Q11(c,a,b) ((c)+(a)*(b))
|
||||
#define MAC16_32_Q15(c,a,b) ((c)+(a)*(b))
|
||||
|
||||
#define MAC16_16_Q11(c,a,b) ((c)+(a)*(b))
|
||||
#define MAC16_16_Q13(c,a,b) ((c)+(a)*(b))
|
||||
#define MAC16_16_P13(c,a,b) ((c)+(a)*(b))
|
||||
#define MULT16_16_Q11_32(a,b) ((a)*(b))
|
||||
#define MULT16_16_Q13(a,b) ((a)*(b))
|
||||
#define MULT16_16_Q14(a,b) ((a)*(b))
|
||||
#define MULT16_16_Q15(a,b) ((a)*(b))
|
||||
#define MULT16_16_P15(a,b) ((a)*(b))
|
||||
#define MULT16_16_P13(a,b) ((a)*(b))
|
||||
#define MULT16_16_P14(a,b) ((a)*(b))
|
||||
|
||||
#define DIV32_16(a,b) (((spx_word32_t)(a))/(spx_word16_t)(b))
|
||||
#define PDIV32_16(a,b) (((spx_word32_t)(a))/(spx_word16_t)(b))
|
||||
#define DIV32(a,b) (((spx_word32_t)(a))/(spx_word32_t)(b))
|
||||
#define PDIV32(a,b) (((spx_word32_t)(a))/(spx_word32_t)(b))
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if defined (CONFIG_TI_C54X) || defined (CONFIG_TI_C55X)
|
||||
|
||||
/* 2 on TI C5x DSP */
|
||||
#define BYTES_PER_CHAR 2
|
||||
#define BITS_PER_CHAR 16
|
||||
#define LOG2_BITS_PER_CHAR 4
|
||||
|
||||
#else
|
||||
|
||||
#define BYTES_PER_CHAR 1
|
||||
#define BITS_PER_CHAR 8
|
||||
#define LOG2_BITS_PER_CHAR 3
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef FIXED_DEBUG
|
||||
extern long long spx_mips;
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load diff
|
@ -1,67 +0,0 @@
|
|||
/**
|
||||
@file cpusupport.h
|
||||
*/
|
||||
/*
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef OPUSTOOLS_CPUSUPPORT_H
|
||||
# define OPUSTOOLS_CPUSUPPORT_H
|
||||
|
||||
/* We want to warn if we're built with SSE support, but running
|
||||
on a host without those instructions. Therefore we disable
|
||||
the query both if the compiler isn't supporting SSE, and on
|
||||
targets which are guaranteed to have SSE. */
|
||||
# if !defined(__SSE__) || defined(_M_X64) || defined(__amd64__)
|
||||
# define query_cpu_support() 0
|
||||
# else
|
||||
|
||||
#if defined WIN32 || defined _WIN32
|
||||
#include <intrin.h>
|
||||
static inline int query_cpu_support(void)
|
||||
{
|
||||
int buffer[4];
|
||||
__cpuid(buffer, 1);
|
||||
return ((buffer[3] & (1<<25)) == 0) /*SSE*/
|
||||
# ifdef __SSE2__
|
||||
+ ((buffer[3] & (1<<26)) == 0) /*SSE2*/
|
||||
# endif
|
||||
;
|
||||
}
|
||||
#else
|
||||
#include <cpuid.h>
|
||||
static inline int query_cpu_support(void)
|
||||
{
|
||||
unsigned int eax, ebx, ecx, edx=0;
|
||||
__get_cpuid(1, &eax, &ebx, &ecx, &edx);
|
||||
return ((edx & 1<<25) == 0) /*SSE*/
|
||||
#ifdef __SSE2__
|
||||
+ ((edx & 1<<26) == 0) /*SSE2*/
|
||||
#endif
|
||||
;
|
||||
}
|
||||
#endif
|
||||
|
||||
# endif
|
||||
#endif
|
|
@ -1,245 +0,0 @@
|
|||
/* Copyright (C)2012 Xiph.Org Foundation
|
||||
Copyright (C)2012 Gregory Maxwell
|
||||
Copyright (C)2012 Jean-Marc Valin
|
||||
File: diag_range.c
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define I64FORMAT "I64d"
|
||||
#define I64uFORMAT "I64u"
|
||||
#else
|
||||
#define I64FORMAT "lld"
|
||||
#define I64uFORMAT "llu"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <opus.h>
|
||||
#include "diag_range.h"
|
||||
|
||||
/*This is some non-exported code copied wholesale from libopus.
|
||||
*Normal programs shouldn't need these functions, but we use them here
|
||||
*to parse deep inside multichannel packets in order to get diagnostic
|
||||
*data for save-range. If you're thinking about copying it and you aren't
|
||||
*making an opus stream diagnostic tool, you're probably doing something
|
||||
*wrong.*/
|
||||
static int parse_size(const unsigned char *data, opus_int32 len, short *size)
|
||||
{
|
||||
if (len<1)
|
||||
{
|
||||
*size = -1;
|
||||
return -1;
|
||||
} else if (data[0]<252)
|
||||
{
|
||||
*size = data[0];
|
||||
return 1;
|
||||
} else if (len<2)
|
||||
{
|
||||
*size = -1;
|
||||
return -1;
|
||||
} else {
|
||||
*size = 4*data[1] + data[0];
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
static int opus_packet_parse_impl(const unsigned char *data, opus_int32 len,
|
||||
int self_delimited, unsigned char *out_toc,
|
||||
const unsigned char *frames[48], short size[48], int *payload_offset)
|
||||
{
|
||||
int i, bytes;
|
||||
int count;
|
||||
int cbr;
|
||||
unsigned char ch, toc;
|
||||
int framesize;
|
||||
int last_size;
|
||||
const unsigned char *data0 = data;
|
||||
|
||||
if (size==NULL)
|
||||
return OPUS_BAD_ARG;
|
||||
|
||||
framesize = opus_packet_get_samples_per_frame(data, 48000);
|
||||
|
||||
cbr = 0;
|
||||
toc = *data++;
|
||||
len--;
|
||||
last_size = len;
|
||||
switch (toc&0x3)
|
||||
{
|
||||
/* One frame */
|
||||
case 0:
|
||||
count=1;
|
||||
break;
|
||||
/* Two CBR frames */
|
||||
case 1:
|
||||
count=2;
|
||||
cbr = 1;
|
||||
if (!self_delimited)
|
||||
{
|
||||
if (len&0x1)
|
||||
return OPUS_INVALID_PACKET;
|
||||
size[0] = last_size = len/2;
|
||||
}
|
||||
break;
|
||||
/* Two VBR frames */
|
||||
case 2:
|
||||
count = 2;
|
||||
bytes = parse_size(data, len, size);
|
||||
len -= bytes;
|
||||
if (size[0]<0 || size[0] > len)
|
||||
return OPUS_INVALID_PACKET;
|
||||
data += bytes;
|
||||
last_size = len-size[0];
|
||||
break;
|
||||
/* Multiple CBR/VBR frames (from 0 to 120 ms) */
|
||||
case 3:
|
||||
if (len<1)
|
||||
return OPUS_INVALID_PACKET;
|
||||
/* Number of frames encoded in bits 0 to 5 */
|
||||
ch = *data++;
|
||||
count = ch&0x3F;
|
||||
if (count <= 0 || framesize*count > 5760)
|
||||
return OPUS_INVALID_PACKET;
|
||||
len--;
|
||||
/* Padding flag is bit 6 */
|
||||
if (ch&0x40)
|
||||
{
|
||||
int padding=0;
|
||||
int p;
|
||||
do {
|
||||
if (len<=0)
|
||||
return OPUS_INVALID_PACKET;
|
||||
p = *data++;
|
||||
len--;
|
||||
padding += p==255 ? 254: p;
|
||||
} while (p==255);
|
||||
len -= padding;
|
||||
}
|
||||
if (len<0)
|
||||
return OPUS_INVALID_PACKET;
|
||||
/* VBR flag is bit 7 */
|
||||
cbr = !(ch&0x80);
|
||||
if (!cbr)
|
||||
{
|
||||
/* VBR case */
|
||||
last_size = len;
|
||||
for (i=0;i<count-1;i++)
|
||||
{
|
||||
bytes = parse_size(data, len, size+i);
|
||||
len -= bytes;
|
||||
if (size[i]<0 || size[i] > len)
|
||||
return OPUS_INVALID_PACKET;
|
||||
data += bytes;
|
||||
last_size -= bytes+size[i];
|
||||
}
|
||||
if (last_size<0)
|
||||
return OPUS_INVALID_PACKET;
|
||||
} else if (!self_delimited)
|
||||
{
|
||||
/* CBR case */
|
||||
last_size = len/count;
|
||||
if (last_size*count!=len)
|
||||
return OPUS_INVALID_PACKET;
|
||||
for (i=0;i<count-1;i++)
|
||||
size[i] = last_size;
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* Self-delimited framing has an extra size for the last frame. */
|
||||
if (self_delimited)
|
||||
{
|
||||
bytes = parse_size(data, len, size+count-1);
|
||||
len -= bytes;
|
||||
if (size[count-1]<0 || size[count-1] > len)
|
||||
return OPUS_INVALID_PACKET;
|
||||
data += bytes;
|
||||
/* For CBR packets, apply the size to all the frames. */
|
||||
if (cbr)
|
||||
{
|
||||
if (size[count-1]*count > len)
|
||||
return OPUS_INVALID_PACKET;
|
||||
for (i=0;i<count-1;i++)
|
||||
size[i] = size[count-1];
|
||||
} else if(size[count-1] > last_size)
|
||||
return OPUS_INVALID_PACKET;
|
||||
} else
|
||||
{
|
||||
/* Because it's not encoded explicitly, it's possible the size of the
|
||||
last packet (or all the packets, for the CBR case) is larger than
|
||||
1275. Reject them here.*/
|
||||
if (last_size > 1275)
|
||||
return OPUS_INVALID_PACKET;
|
||||
size[count-1] = last_size;
|
||||
}
|
||||
|
||||
if (frames)
|
||||
{
|
||||
for (i=0;i<count;i++)
|
||||
{
|
||||
frames[i] = data;
|
||||
data += size[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (out_toc)
|
||||
*out_toc = toc;
|
||||
|
||||
if (payload_offset)
|
||||
*payload_offset = data-data0;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
void save_range(FILE *frange, int frame_size, unsigned char *packet, int nbBytes, opus_uint32 *rngs, int nb_streams){
|
||||
int i, parsed_size;
|
||||
const unsigned char *subpkt;
|
||||
static const char *bw_strings[5]={"NB","MB","WB","SWB","FB"};
|
||||
static const char *mode_strings[3]={"LP","HYB","MDCT"};
|
||||
fprintf(frange,"%d, %d, ",frame_size,nbBytes);
|
||||
subpkt=packet;
|
||||
parsed_size=nbBytes;
|
||||
for(i=0;i<nb_streams;i++){
|
||||
int j,payload_offset,nf;
|
||||
const unsigned char *frames[48];
|
||||
unsigned char toc;
|
||||
short size[48];
|
||||
payload_offset=0;
|
||||
nf=opus_packet_parse_impl(subpkt,parsed_size,i+1!=nb_streams,
|
||||
&toc,frames,size,&payload_offset);
|
||||
fprintf(frange,"[[%d",(int)(frames[0]-subpkt));
|
||||
for(j=0;j<nf;j++)fprintf(frange,", %d",size[j]);
|
||||
fprintf(frange,"], %s, %s, %c, %d",
|
||||
mode_strings[((((subpkt[0]>>3)+48)&92)+4)>>5],
|
||||
bw_strings[opus_packet_get_bandwidth(subpkt)-OPUS_BANDWIDTH_NARROWBAND],
|
||||
subpkt[0]&4?'S':'M',opus_packet_get_samples_per_frame(subpkt,48000));
|
||||
fprintf(frange,", %" I64uFORMAT "]%s",(unsigned long long)rngs[i],i+1==nb_streams?"\n":", ");
|
||||
parsed_size-=payload_offset;
|
||||
subpkt+=payload_offset;
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
/* Copyright (C)2012 Xiph.Org Foundation
|
||||
File: diag_range.h
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
void save_range(FILE *frange, int frame_size, unsigned char *packet, int nbBytes, opus_uint32 *rngs, int nb_streams);
|
|
@ -1,435 +0,0 @@
|
|||
/*Copyright 2012-2013, Xiph.Org Foundation and contributors.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <locale.h>
|
||||
#include "flac.h"
|
||||
#include "opus_header.h"
|
||||
#include "picture.h"
|
||||
|
||||
#if defined(HAVE_LIBFLAC)
|
||||
|
||||
/*Callback to read more data for the FLAC decoder.*/
|
||||
static FLAC__StreamDecoderReadStatus read_callback(
|
||||
const FLAC__StreamDecoder *decoder,FLAC__byte buffer[],size_t *bytes,
|
||||
void *client_data){
|
||||
flacfile *flac;
|
||||
(void)decoder;
|
||||
flac=(flacfile *)client_data;
|
||||
if(*bytes>0){
|
||||
int bufpos;
|
||||
int buflen;
|
||||
bufpos=flac->bufpos;
|
||||
buflen=flac->buflen;
|
||||
if(bufpos<buflen){
|
||||
size_t bytes_to_copy;
|
||||
/*If we haven't consumed all the data we used for file ID yet, consume
|
||||
some more.*/
|
||||
bytes_to_copy=buflen-bufpos;
|
||||
bytes_to_copy=*bytes<bytes_to_copy?*bytes:bytes_to_copy;
|
||||
memcpy(buffer,flac->oldbuf,bytes_to_copy);
|
||||
flac->bufpos+=bytes_to_copy;
|
||||
*bytes=bytes_to_copy;
|
||||
}else{
|
||||
/*Otherwise just read from the file.*/
|
||||
*bytes=fread(buffer,sizeof(*buffer),*bytes,flac->f);
|
||||
}
|
||||
/*This pretty much comes from the FLAC documentation, except that we only
|
||||
check ferror() if we didn't read any bytes at all.*/
|
||||
return *bytes==0?ferror(flac->f)?
|
||||
FLAC__STREAM_DECODER_READ_STATUS_ABORT:
|
||||
FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM:
|
||||
FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
|
||||
}
|
||||
return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
|
||||
}
|
||||
|
||||
/*Callback to test the stream for EOF.*/
|
||||
static FLAC__bool eof_callback(const FLAC__StreamDecoder *decoder,
|
||||
void *client_data){
|
||||
flacfile *flac;
|
||||
(void)decoder;
|
||||
flac=(flacfile *)client_data;
|
||||
return feof(flac->f)?true:false;
|
||||
}
|
||||
|
||||
/*Callback to process a metadata packet.*/
|
||||
static void metadata_callback(const FLAC__StreamDecoder *decoder,
|
||||
const FLAC__StreamMetadata *metadata,void *client_data){
|
||||
flacfile *flac;
|
||||
oe_enc_opt *inopt;
|
||||
(void)decoder;
|
||||
flac=(flacfile *)client_data;
|
||||
inopt=flac->inopt;
|
||||
switch(metadata->type){
|
||||
case FLAC__METADATA_TYPE_STREAMINFO:
|
||||
flac->max_blocksize=metadata->data.stream_info.max_blocksize;
|
||||
inopt->rate=metadata->data.stream_info.sample_rate;
|
||||
inopt->channels=flac->channels=metadata->data.stream_info.channels;
|
||||
inopt->samplesize=metadata->data.stream_info.bits_per_sample;
|
||||
inopt->total_samples_per_channel=
|
||||
metadata->data.stream_info.total_samples;
|
||||
flac->block_buf=malloc(
|
||||
flac->max_blocksize*flac->channels*sizeof(*flac->block_buf));
|
||||
flac->block_buf_pos=0;
|
||||
flac->block_buf_len=0;
|
||||
break;
|
||||
case FLAC__METADATA_TYPE_VORBIS_COMMENT:
|
||||
{
|
||||
FLAC__StreamMetadata_VorbisComment_Entry *comments;
|
||||
FLAC__uint32 num_comments;
|
||||
FLAC__uint32 i;
|
||||
double reference_loudness;
|
||||
double album_gain;
|
||||
double track_gain;
|
||||
double gain;
|
||||
int saw_album_gain;
|
||||
int saw_track_gain;
|
||||
char *saved_locale;
|
||||
if(!inopt->copy_comments)break;
|
||||
num_comments=metadata->data.vorbis_comment.num_comments;
|
||||
comments=metadata->data.vorbis_comment.comments;
|
||||
saw_album_gain=saw_track_gain=0;
|
||||
album_gain=track_gain=0;
|
||||
/*The default reference loudness for ReplayGain is 89.0 dB*/
|
||||
reference_loudness=89;
|
||||
/*The code below uses strtod for the gain tags, so make sure the locale is C*/
|
||||
saved_locale=setlocale(LC_NUMERIC,"C");
|
||||
for(i=0;i<num_comments;i++){
|
||||
char *entry;
|
||||
char *end;
|
||||
entry=(char *)comments[i].entry;
|
||||
/*Check for ReplayGain tags.
|
||||
Parse the ones we have R128 equivalents for, and skip the others.*/
|
||||
if(oi_strncasecmp(entry,"REPLAYGAIN_REFERENCE_LOUDNESS=",30)==0){
|
||||
gain=strtod(entry+30,&end);
|
||||
if(end<=entry+30){
|
||||
fprintf(stderr,_("WARNING: Invalid ReplayGain tag: %s\n"),entry);
|
||||
}
|
||||
else reference_loudness=gain;
|
||||
continue;
|
||||
}
|
||||
if(oi_strncasecmp(entry,"REPLAYGAIN_ALBUM_GAIN=",22)==0){
|
||||
gain=strtod(entry+22,&end);
|
||||
if(end<=entry+22){
|
||||
fprintf(stderr,_("WARNING: Invalid ReplayGain tag: %s\n"),entry);
|
||||
}
|
||||
else{
|
||||
album_gain=gain;
|
||||
saw_album_gain=1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(oi_strncasecmp(entry,"REPLAYGAIN_TRACK_GAIN=",22)==0){
|
||||
gain=strtod(entry+22,&end);
|
||||
if(end<entry+22){
|
||||
fprintf(stderr,_("WARNING: Invalid ReplayGain tag: %s\n"),entry);
|
||||
}
|
||||
else{
|
||||
track_gain=gain;
|
||||
saw_track_gain=1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(oi_strncasecmp(entry,"REPLAYGAIN_ALBUM_PEAK=",22)==0
|
||||
||oi_strncasecmp(entry,"REPLAYGAIN_TRACK_PEAK=",22)==0){
|
||||
continue;
|
||||
}
|
||||
if(!strchr(entry,'=')){
|
||||
fprintf(stderr,_("WARNING: Invalid comment: %s\n"),entry);
|
||||
fprintf(stderr,
|
||||
_("Discarding comment not in the form name=value\n"));
|
||||
continue;
|
||||
}
|
||||
comment_add(&inopt->comments,&inopt->comments_length,NULL,entry);
|
||||
}
|
||||
setlocale(LC_NUMERIC,saved_locale);
|
||||
/*Set the header gain to the album gain after converting to the R128
|
||||
reference level.*/
|
||||
if(saw_album_gain){
|
||||
gain=256*(album_gain+(84-reference_loudness))+0.5;
|
||||
inopt->gain=gain<-32768?-32768:gain<32767?(int)floor(gain):32767;
|
||||
}
|
||||
/*If there was a track gain, then add an equivalent R128 tag for that.*/
|
||||
if(saw_track_gain){
|
||||
char track_gain_buf[7];
|
||||
int track_gain_val;
|
||||
gain=256*(track_gain-album_gain)+0.5;
|
||||
track_gain_val=gain<-32768?-32768:gain<32767?(int)floor(gain):32767;
|
||||
sprintf(track_gain_buf,"%i",track_gain_val);
|
||||
comment_add(&inopt->comments,&inopt->comments_length,
|
||||
"R128_TRACK_GAIN",track_gain_buf);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FLAC__METADATA_TYPE_PICTURE:
|
||||
{
|
||||
char *buf;
|
||||
char *b64;
|
||||
size_t mime_type_length;
|
||||
size_t description_length;
|
||||
size_t buf_sz;
|
||||
size_t b64_sz;
|
||||
size_t offs;
|
||||
if(!inopt->copy_pictures)break;
|
||||
mime_type_length=strlen(metadata->data.picture.mime_type);
|
||||
description_length=strlen((char *)metadata->data.picture.description);
|
||||
buf_sz=32+mime_type_length+description_length
|
||||
+metadata->data.picture.data_length;
|
||||
buf=(char *)malloc(buf_sz);
|
||||
offs=0;
|
||||
WRITE_U32_BE(buf+offs,metadata->data.picture.type);
|
||||
offs+=4;
|
||||
WRITE_U32_BE(buf+offs,(FLAC__uint32)mime_type_length);
|
||||
offs+=4;
|
||||
memcpy(buf+offs,metadata->data.picture.mime_type,mime_type_length);
|
||||
offs+=mime_type_length;
|
||||
WRITE_U32_BE(buf+offs,(FLAC__uint32)description_length);
|
||||
offs+=4;
|
||||
memcpy(buf+offs,metadata->data.picture.description,description_length);
|
||||
offs+=description_length;
|
||||
WRITE_U32_BE(buf+offs,metadata->data.picture.width);
|
||||
offs+=4;
|
||||
WRITE_U32_BE(buf+offs,metadata->data.picture.height);
|
||||
offs+=4;
|
||||
WRITE_U32_BE(buf+offs,metadata->data.picture.depth);
|
||||
offs+=4;
|
||||
WRITE_U32_BE(buf+offs,metadata->data.picture.colors);
|
||||
offs+=4;
|
||||
WRITE_U32_BE(buf+offs,metadata->data.picture.data_length);
|
||||
offs+=4;
|
||||
memcpy(buf+offs,metadata->data.picture.data,
|
||||
metadata->data.picture.data_length);
|
||||
b64_sz=BASE64_LENGTH(buf_sz)+1;
|
||||
b64=(char *)malloc(b64_sz);
|
||||
base64_encode(b64,buf,buf_sz);
|
||||
free(buf);
|
||||
comment_add(&inopt->comments,&inopt->comments_length,
|
||||
"METADATA_BLOCK_PICTURE",b64);
|
||||
free(b64);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*Callback to process an audio frame.*/
|
||||
static FLAC__StreamDecoderWriteStatus write_callback(
|
||||
const FLAC__StreamDecoder *decoder,const FLAC__Frame *frame,
|
||||
const FLAC__int32 *const buffer[],void *client_data){
|
||||
flacfile *flac;
|
||||
int channels;
|
||||
opus_int32 blocksize;
|
||||
int bits_per_sample;
|
||||
float scale;
|
||||
const int *channel_permute;
|
||||
float *block_buf;
|
||||
int ci;
|
||||
opus_int32 si;
|
||||
(void)decoder;
|
||||
flac=(flacfile *)client_data;
|
||||
/*We do not allow the number of channels to change.*/
|
||||
channels=frame->header.channels;
|
||||
if(channels!=flac->channels){
|
||||
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
|
||||
}
|
||||
/*We do not allow block sizes larger than the declared maximum.*/
|
||||
blocksize=frame->header.blocksize;
|
||||
if(blocksize>flac->max_blocksize){
|
||||
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
|
||||
}
|
||||
/*We do allow the bits per sample to change, though this will confound Opus's
|
||||
silence detection.*/
|
||||
bits_per_sample=frame->header.bits_per_sample;
|
||||
speex_assert(bits_per_sample>0&&bits_per_sample<=32);
|
||||
scale=(0x80000000U>>(bits_per_sample-1))*(1.0F/0x80000000U);
|
||||
channel_permute=flac->channel_permute;
|
||||
block_buf=flac->block_buf;
|
||||
for(ci=0;ci<channels;ci++){
|
||||
const FLAC__int32 *channel_buf;
|
||||
channel_buf=buffer[channel_permute[ci]];
|
||||
for(si=0;si<blocksize;si++){
|
||||
/*There's a loss of precision here for 32-bit samples, but libFLAC
|
||||
doesn't currently support more than 24.*/
|
||||
block_buf[si*channels+ci]=scale*(float)channel_buf[si];
|
||||
}
|
||||
}
|
||||
flac->block_buf_pos=0;
|
||||
flac->block_buf_len=blocksize;
|
||||
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
|
||||
}
|
||||
|
||||
/*Dummy error callback (required by libFLAC).*/
|
||||
static void error_callback(const FLAC__StreamDecoder *decoder,
|
||||
FLAC__StreamDecoderErrorStatus status,void *client_data){
|
||||
(void)decoder;
|
||||
(void)status;
|
||||
(void)client_data;
|
||||
}
|
||||
|
||||
int flac_id(unsigned char *buf,int len){
|
||||
/*Something screwed up.*/
|
||||
if(len<4)return 0;
|
||||
/*Not FLAC.*/
|
||||
if(memcmp(buf,"fLaC",4))return 0;
|
||||
/*Looks like FLAC.*/
|
||||
return 1;
|
||||
}
|
||||
|
||||
int oggflac_id(unsigned char *buf,int len){
|
||||
/*Something screwed up.*/
|
||||
if(len<33)return 0;
|
||||
/*Not Ogg.*/
|
||||
if(memcmp(buf,"OggS",4))return 0;
|
||||
/*Not FLAC.*/
|
||||
if(memcmp(buf+28,"\177FLAC",5))return 0;
|
||||
/*Looks like OggFLAC.*/
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*Read more data for the encoder.*/
|
||||
static long flac_read(void *client_data,float *buffer,int samples){
|
||||
flacfile *flac;
|
||||
int channels;
|
||||
float *block_buf;
|
||||
long ret;
|
||||
flac=(flacfile *)client_data;
|
||||
channels=flac->channels;
|
||||
block_buf=flac->block_buf;
|
||||
ret=0;
|
||||
/*Keep reading until we get all the samples or hit an error/EOF.
|
||||
Short reads are not allowed.*/
|
||||
while(samples>0){
|
||||
opus_int32 block_buf_pos;
|
||||
opus_int32 block_buf_len;
|
||||
size_t samples_to_copy;
|
||||
block_buf_pos=flac->block_buf_pos;
|
||||
block_buf_len=flac->block_buf_len;
|
||||
if(block_buf_pos>=block_buf_len){
|
||||
/*Read the next frame from the stream.*/
|
||||
if(!FLAC__stream_decoder_process_single(flac->decoder))return ret;
|
||||
block_buf_pos=flac->block_buf_pos;
|
||||
block_buf_len=flac->block_buf_len;
|
||||
/*If we didn't get another block, we hit EOF.
|
||||
FLAC__stream_decoder_process_single still returns successfully in this
|
||||
case.*/
|
||||
if(block_buf_pos>=block_buf_len)return ret;
|
||||
}
|
||||
block_buf_len-=block_buf_pos;
|
||||
samples_to_copy=samples<block_buf_len?samples:block_buf_len;
|
||||
memcpy(buffer,block_buf+block_buf_pos*channels,
|
||||
samples_to_copy*channels*sizeof(*buffer));
|
||||
flac->block_buf_pos+=samples_to_copy;
|
||||
ret+=samples_to_copy;
|
||||
buffer+=samples_to_copy*channels;
|
||||
samples-=samples_to_copy;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int flac_open(FILE *in,oe_enc_opt *opt,unsigned char *oldbuf,int buflen){
|
||||
flacfile *flac;
|
||||
/*Ok. At this point, we know we have a FLAC or an OggFLAC file.
|
||||
Set up the FLAC decoder.*/
|
||||
flac=malloc(sizeof(*flac));
|
||||
flac->decoder=FLAC__stream_decoder_new();
|
||||
FLAC__stream_decoder_set_md5_checking(flac->decoder,false);
|
||||
/*We get STREAMINFO packets by default, but not VORBIS_COMMENT or PICTURE.*/
|
||||
FLAC__stream_decoder_set_metadata_respond(flac->decoder,
|
||||
FLAC__METADATA_TYPE_VORBIS_COMMENT);
|
||||
FLAC__stream_decoder_set_metadata_respond(flac->decoder,
|
||||
FLAC__METADATA_TYPE_PICTURE);
|
||||
flac->inopt=opt;
|
||||
flac->f=in;
|
||||
flac->oldbuf=malloc(buflen*sizeof(*flac->oldbuf));
|
||||
memcpy(flac->oldbuf,oldbuf,buflen*sizeof(*flac->oldbuf));
|
||||
flac->bufpos=0;
|
||||
flac->buflen=buflen;
|
||||
flac->block_buf=NULL;
|
||||
if((*(flac_id(oldbuf,buflen)?
|
||||
FLAC__stream_decoder_init_stream:FLAC__stream_decoder_init_ogg_stream))(
|
||||
flac->decoder,read_callback,NULL,NULL,NULL,eof_callback,
|
||||
write_callback,metadata_callback,error_callback,flac)==
|
||||
FLAC__STREAM_DECODER_INIT_STATUS_OK){
|
||||
/*Decode until we get the file length, sample rate, the number of channels,
|
||||
and the Vorbis comments (if any).*/
|
||||
if(FLAC__stream_decoder_process_until_end_of_metadata(flac->decoder)){
|
||||
opt->read_samples=flac_read;
|
||||
opt->readdata=flac;
|
||||
/*FLAC supports 1 to 8 channels only.*/
|
||||
speex_assert(flac->channels>0&&flac->channels<=8);
|
||||
/*It uses the same channel mappings as WAV.*/
|
||||
flac->channel_permute=wav_permute_matrix[flac->channels-1];
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
flac_close(flac);
|
||||
fprintf(stderr,_("ERROR: Could not open FLAC stream.\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
void flac_close(void *client_data){
|
||||
flacfile *flac;
|
||||
flac=(flacfile *)client_data;
|
||||
free(flac->block_buf);
|
||||
free(flac->oldbuf);
|
||||
FLAC__stream_decoder_delete(flac->decoder);
|
||||
free(flac);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/*FLAC support is disabled.*/
|
||||
|
||||
int flac_id(unsigned char *buf,int len){
|
||||
(void)buf;
|
||||
(void)len;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int oggflac_id(unsigned char *buf,int len){
|
||||
(void)buf;
|
||||
(void)len;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int flac_open(FILE *in,oe_enc_opt *opt,unsigned char *oldbuf,int buflen){
|
||||
(void)in;
|
||||
(void)opt;
|
||||
(void)oldbuf;
|
||||
(void)buflen;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void flac_close(void *client_data){
|
||||
(void)client_data;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,58 +0,0 @@
|
|||
/*Copyright 2012-2013, Xiph.Org Foundation and contributors.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
|
||||
#ifndef __FLAC_H
|
||||
# define __FLAC_H
|
||||
# include <stdio.h>
|
||||
# include "os_support.h"
|
||||
# include "opusenc.h"
|
||||
# if defined(HAVE_LIBFLAC)
|
||||
# include <FLAC/stream_decoder.h>
|
||||
# include <FLAC/metadata.h>
|
||||
|
||||
typedef struct flacfile flacfile;
|
||||
|
||||
struct flacfile{
|
||||
FLAC__StreamDecoder *decoder;
|
||||
oe_enc_opt *inopt;
|
||||
short channels;
|
||||
FILE *f;
|
||||
const int *channel_permute;
|
||||
unsigned char *oldbuf;
|
||||
int bufpos;
|
||||
int buflen;
|
||||
float *block_buf;
|
||||
opus_int32 block_buf_pos;
|
||||
opus_int32 block_buf_len;
|
||||
opus_int32 max_blocksize;
|
||||
};
|
||||
|
||||
# endif
|
||||
|
||||
int flac_id(unsigned char *buf,int len);
|
||||
int oggflac_id(unsigned char *buf,int len);
|
||||
int flac_open(FILE *in,oe_enc_opt *opt,unsigned char *oldbuf,int buflen);
|
||||
void flac_close(void *client_data);
|
||||
|
||||
#endif
|
|
@ -1,320 +0,0 @@
|
|||
/* Copyright (C)2012 Gregory Maxwell
|
||||
File: info_opus.c
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ogg/ogg.h>
|
||||
|
||||
#ifndef OPUSTOOLS
|
||||
# include "ogginfo2.h"
|
||||
#else
|
||||
# include "opusinfo.h"
|
||||
#endif
|
||||
#include "opus_header.h"
|
||||
#include "info_opus.h"
|
||||
|
||||
/* From libopus, src/opus_decode.c */
|
||||
static int packet_get_samples_per_frame(const unsigned char *data, ogg_int32_t Fs)
|
||||
{
|
||||
int audiosize;
|
||||
if (data[0]&0x80)
|
||||
{
|
||||
audiosize = ((data[0]>>3)&0x3);
|
||||
audiosize = (Fs<<audiosize)/400;
|
||||
} else if ((data[0]&0x60) == 0x60)
|
||||
{
|
||||
audiosize = (data[0]&0x08) ? Fs/50 : Fs/100;
|
||||
} else {
|
||||
audiosize = ((data[0]>>3)&0x3);
|
||||
if (audiosize == 3)
|
||||
audiosize = Fs*60/1000;
|
||||
else
|
||||
audiosize = (Fs<<audiosize)/100;
|
||||
}
|
||||
return audiosize;
|
||||
}
|
||||
|
||||
/* From libopus, src/opus_decode.c */
|
||||
static int packet_get_nb_frames(const unsigned char packet[], ogg_int32_t len)
|
||||
{
|
||||
int count;
|
||||
if (len<1)
|
||||
return -1;
|
||||
count = packet[0]&0x3;
|
||||
if (count==0)
|
||||
return 1;
|
||||
else if (count!=3)
|
||||
return 2;
|
||||
else if (len<2)
|
||||
return -4;
|
||||
else
|
||||
return packet[1]&0x3F;
|
||||
}
|
||||
|
||||
#define readle32(buf, base) (((buf[base+3]<<24)&0xff000000)| \
|
||||
((buf[base+2]<<16)&0xff0000)| \
|
||||
((buf[base+1]<<8)&0xff00)| \
|
||||
(buf[base]&0xff))
|
||||
|
||||
void info_opus_process(stream_processor *stream, ogg_page *page )
|
||||
{
|
||||
ogg_packet packet;
|
||||
ogg_int64_t page_samples=0;
|
||||
misc_opus_info *inf = stream->data;
|
||||
int header=0, packets=0;
|
||||
int res;
|
||||
|
||||
ogg_stream_pagein(&stream->os, page);
|
||||
if(inf->doneheaders < 2)
|
||||
header = 1;
|
||||
inf->last_eos = ogg_page_eos(page);
|
||||
|
||||
while(1) {
|
||||
ogg_int32_t spp;
|
||||
res = ogg_stream_packetout(&stream->os, &packet);
|
||||
if(res < 0) {
|
||||
oi_warn(_("WARNING: discontinuity in stream (%d)\n"), stream->num);
|
||||
continue;
|
||||
}
|
||||
else if (res == 0)
|
||||
break;
|
||||
|
||||
packets++;
|
||||
if(inf->doneheaders < 2) {
|
||||
if(inf->doneheaders==0 && opus_header_parse(packet.packet,packet.bytes,&inf->oh)!=1) {
|
||||
oi_warn(_("WARNING: Could not decode Opus header "
|
||||
"packet %d - invalid Opus stream (%d)\n"),
|
||||
inf->doneheaders, stream->num);
|
||||
continue;
|
||||
} else if (inf->doneheaders==0){
|
||||
if(inf->oh.preskip<120)oi_warn(_("WARNING: Implausibly low preskip in Opus stream (%d)\n"),stream->num);
|
||||
}
|
||||
if(inf->doneheaders==1 && (packet.bytes<8 || memcmp(packet.packet, "OpusTags",8)!=0)) {
|
||||
oi_warn(_("WARNING: Could not decode OpusTags header "
|
||||
"packet %d - invalid Opus stream (%d)\n"),
|
||||
inf->doneheaders, stream->num);
|
||||
continue;
|
||||
} else if (inf->doneheaders==1) {
|
||||
char *tmp;
|
||||
char *c=(char *)packet.packet;
|
||||
int length, len, i, nb_fields;
|
||||
|
||||
length=packet.bytes;
|
||||
if (length<(8+4+4)) {
|
||||
oi_warn(_("Invalid/corrupted comments in stream %d\n"),stream->num);
|
||||
continue;
|
||||
}
|
||||
c += 8;
|
||||
len=readle32(c, 0);
|
||||
c+=4;
|
||||
if (len < 0 || len>(length-16)) {
|
||||
oi_warn(_("Invalid/corrupted comments in stream %d\n"),stream->num);
|
||||
continue;
|
||||
}
|
||||
tmp=calloc(len+1,1);
|
||||
memcpy(tmp,c,len);
|
||||
oi_info(_("Encoded with %s\n"),tmp);
|
||||
free(tmp);
|
||||
c+=len;
|
||||
/*The -16 check above makes sure we can read this.*/
|
||||
nb_fields=readle32(c, 0);
|
||||
c+=4;
|
||||
length-=16+len;
|
||||
if (nb_fields < 0 || nb_fields>(length>>2)) {
|
||||
oi_warn(_("Invalid/corrupted comments in stream %d\n"),stream->num);
|
||||
continue;
|
||||
}
|
||||
if(nb_fields)oi_info(_("User comments section follows...\n"));
|
||||
for (i=0;i<nb_fields;i++) {
|
||||
char *comment;
|
||||
if (length<4) {
|
||||
oi_warn(_("Invalid/corrupted comments in stream %d\n"),stream->num);
|
||||
break;
|
||||
}
|
||||
len=readle32(c, 0);
|
||||
c+=4;
|
||||
length-=4;
|
||||
if (len < 0 || len>length) {
|
||||
oi_warn(_("Invalid/corrupted comments in stream %d\n"),stream->num);
|
||||
break;
|
||||
}
|
||||
/*check_xiph_comment expects a null terminated comment*/
|
||||
comment=malloc((len+1)*sizeof(char));
|
||||
memcpy(comment,c,len);
|
||||
comment[len]=0;
|
||||
check_xiph_comment(stream, i, comment, len);
|
||||
free(comment);
|
||||
c+=len;
|
||||
length-=len;
|
||||
}
|
||||
}
|
||||
|
||||
inf->doneheaders++;
|
||||
continue;
|
||||
}
|
||||
if(packet.bytes>=2 && memcmp(packet.packet, "Op",2)==0) {
|
||||
oi_warn(_("WARNING: Invalid packet or misplaced header in stream %d\n"),stream->num);
|
||||
continue;
|
||||
}
|
||||
if(packet.bytes<1) {
|
||||
oi_warn(_("WARNING: Invalid zero byte packet in stream %d\n"),stream->num);
|
||||
continue;
|
||||
}
|
||||
spp = packet_get_nb_frames(packet.packet,packet.bytes);
|
||||
if(spp<1 || spp>48) {
|
||||
oi_warn(_("WARNING: Invalid packet TOC in stream %d\n"),stream->num);
|
||||
continue;
|
||||
}
|
||||
spp *= packet_get_samples_per_frame(packet.packet,48000);
|
||||
if(spp<120 || spp>5760 || (spp%120)!=0) {
|
||||
oi_warn(_("WARNING: Invalid packet TOC in stream %d\n"),stream->num);
|
||||
continue;
|
||||
}
|
||||
inf->total_samples += spp;
|
||||
page_samples += spp;
|
||||
inf->total_packets++;
|
||||
inf->last_packet_duration = spp;
|
||||
if(inf->max_packet_duration<spp)inf->max_packet_duration=spp;
|
||||
if(inf->min_packet_duration>spp)inf->min_packet_duration=spp;
|
||||
if(inf->max_packet_bytes<packet.bytes)inf->max_packet_bytes=packet.bytes;
|
||||
if(inf->min_packet_bytes>packet.bytes)inf->min_packet_bytes=packet.bytes;
|
||||
}
|
||||
|
||||
if(!header) {
|
||||
ogg_int64_t gp = ogg_page_granulepos(page);
|
||||
if(gp > 0) {
|
||||
if(gp < inf->lastgranulepos)
|
||||
oi_warn(_("WARNING: granulepos in stream %d decreases from %"
|
||||
I64FORMAT " to %" I64FORMAT "\n" ),
|
||||
stream->num, inf->lastgranulepos, gp);
|
||||
if(inf->lastgranulepos==0 && inf->firstgranule==-1) {
|
||||
/*First timed page, now we can recover the start time.*/
|
||||
inf->firstgranule = gp-inf->total_samples;
|
||||
if(inf->firstgranule<0) {
|
||||
/*There shouldn't be any negative samples after counting the samples in the page backwards
|
||||
from the first GP, but if this is the last page of the stream there may need to be to trim.*/
|
||||
if(!ogg_page_eos(page))oi_warn(_("WARNING: Samples with negative granpos in stream %d\n"),stream->num);
|
||||
else inf->firstgranule=0;
|
||||
}
|
||||
}
|
||||
if(inf->total_samples<gp-inf->firstgranule)oi_warn(_("WARNING: Sample count behind granule (%" I64FORMAT "<%" I64FORMAT ") in stream %d\n"),
|
||||
(long long)inf->total_samples,(long long)(gp-inf->firstgranule),stream->num);
|
||||
if(!ogg_page_eos(page) && (inf->total_samples>gp-inf->firstgranule))
|
||||
oi_warn(_("WARNING: Sample count ahead of granule (%" I64FORMAT ">%" I64FORMAT ") in stream %d\n"),
|
||||
(long long)inf->total_samples,(long long)(gp-inf->firstgranule),stream->num);
|
||||
inf->lastlastgranulepos = inf->lastgranulepos;
|
||||
inf->lastgranulepos = gp;
|
||||
if(!packets)
|
||||
oi_warn(_("WARNING: Page with positive granpos (%" I64FORMAT ") on a page with no completed packets in stream %d\n"),gp,stream->num);
|
||||
}
|
||||
else if(packets) {
|
||||
/* Only do this if we saw at least one packet ending on this page.
|
||||
* It's legal (though very unusual) to have no packets in a page at
|
||||
* all - this is occasionally used to have an empty EOS page */
|
||||
oi_warn(_("Negative or zero granulepos (%" I64FORMAT ") on Opus stream outside of headers. This file was created by a buggy encoder\n"), gp);
|
||||
}
|
||||
inf->overhead_bytes += page->header_len;
|
||||
if(page_samples)inf->last_page_duration = page_samples;
|
||||
if(inf->max_page_duration<page_samples)inf->max_page_duration=page_samples;
|
||||
if(inf->min_page_duration>page_samples)inf->min_page_duration=page_samples;
|
||||
inf->total_pages++;
|
||||
} else {
|
||||
/* Headers and metadata are pure overhead. */
|
||||
inf->overhead_bytes += page->header_len + page->body_len;
|
||||
}
|
||||
inf->bytes += page->header_len + page->body_len;
|
||||
}
|
||||
|
||||
void info_opus_end(stream_processor *stream)
|
||||
{
|
||||
misc_opus_info *inf = stream->data;
|
||||
|
||||
oi_info(_("Opus stream %d:\n"),stream->num);
|
||||
|
||||
if(inf && inf->total_packets>0){
|
||||
int i;
|
||||
long minutes, seconds, milliseconds;
|
||||
double time;
|
||||
time = (inf->lastgranulepos-inf->firstgranule-inf->oh.preskip) / 48000.;
|
||||
if(time<=0)time=0;
|
||||
minutes = (long)(time) / 60;
|
||||
seconds = (long)(time - minutes*60);
|
||||
milliseconds = (long)((time - minutes*60 - seconds)*1000);
|
||||
if(inf->lastgranulepos-inf->firstgranule<inf->oh.preskip)
|
||||
oi_error(_("\tERROR: stream %d has a negative duration: %" I64FORMAT "-%" I64FORMAT "-%d=%" I64FORMAT "\n"),stream->num,
|
||||
inf->lastgranulepos,inf->firstgranule,inf->oh.preskip,inf->lastgranulepos-inf->firstgranule-inf->oh.preskip);
|
||||
if((inf->total_samples-inf->last_page_duration)>(inf->lastgranulepos-inf->firstgranule))
|
||||
oi_error(_("\tERROR: stream %d has interior holes or more than one page of end trimming\n"),stream->num);
|
||||
if(inf->last_eos &&( (inf->last_page_duration-inf->last_packet_duration)>(inf->lastgranulepos-inf->lastlastgranulepos)))
|
||||
oi_warn(_("\tWARNING: stream %d has more than one packet of end trimming\n"),stream->num);
|
||||
if(inf->max_page_duration>=240000)
|
||||
oi_warn(_("\tWARNING: stream %d has high muxing delay\n"),stream->num);
|
||||
oi_info(_("\tPre-skip: %d\n"),inf->oh.preskip);
|
||||
oi_info(_("\tPlayback gain: %g dB\n"),inf->oh.gain/256.);
|
||||
oi_info(_("\tChannels: %d\n"),inf->oh.channels);
|
||||
if(inf->oh.input_sample_rate)oi_info(_("\tOriginal sample rate: %dHz\n"),inf->oh.input_sample_rate);
|
||||
if(inf->oh.nb_streams>1)oi_info(_("\tStreams: %d, Coupled: %d\n"),inf->oh.nb_streams,inf->oh.nb_coupled);
|
||||
if(inf->oh.channel_mapping>0) {
|
||||
oi_info(_("\tChannel Mapping family: %d Map:"),inf->oh.channel_mapping);
|
||||
for(i=0;i<inf->oh.channels;i++)oi_info("%s%d%s",i==0?" [":", ",inf->oh.stream_map[i],i==inf->oh.channels-1?"]\n":"");
|
||||
}
|
||||
if(inf->total_packets)oi_info(_("\tPacket duration: %6.1fms (max), %6.1fms (avg), %6.1fms (min)\n"),
|
||||
inf->max_packet_duration/48.,inf->total_samples/(double)inf->total_packets/48.,inf->min_packet_duration/48.);
|
||||
if(inf->total_pages)oi_info(_("\tPage duration: %8.1fms (max), %6.1fms (avg), %6.1fms (min)\n"),
|
||||
inf->max_page_duration/48.,inf->total_samples/(double)inf->total_pages/48.,inf->min_page_duration/48.);
|
||||
oi_info(_("\tTotal data length: %" I64FORMAT " bytes (overhead: %0.3g%%)\n"),inf->bytes,(double)inf->overhead_bytes/inf->bytes*100.);
|
||||
oi_info(_("\tPlayback length: %ldm:%02ld.%03lds\n"), minutes, seconds, milliseconds);
|
||||
oi_info(_("\tAverage bitrate: %0.4g kb/s, w/o overhead: %.04g kb/s%s\n"),time<=0?0:inf->bytes*8/time/1000.0,
|
||||
time<=0?0:(inf->bytes-inf->overhead_bytes)*8/time/1000.0,
|
||||
(inf->min_packet_duration==inf->max_packet_duration)&&(inf->min_packet_bytes==inf->max_packet_bytes)?" (hard-CBR)":"");
|
||||
} else {
|
||||
oi_warn(_("\tWARNING: stream %d is empty\n"),stream->num);
|
||||
}
|
||||
free(stream->data);
|
||||
}
|
||||
|
||||
void info_opus_start(stream_processor *stream)
|
||||
{
|
||||
misc_opus_info *oinfo;
|
||||
|
||||
stream->type = "opus";
|
||||
stream->process_page = info_opus_process;
|
||||
stream->process_end = info_opus_end;
|
||||
|
||||
stream->data = calloc(1, sizeof(misc_opus_info));
|
||||
|
||||
oinfo = stream->data;
|
||||
oinfo->firstgranule=-1;
|
||||
oinfo->min_packet_duration=5760;
|
||||
oinfo->min_page_duration=5760*255;
|
||||
oinfo->min_packet_bytes=2147483647;
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
/* Copyright (C)2012 Gregory Maxwell
|
||||
File: info_opus.h
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
OpusHeader oh;
|
||||
ogg_int64_t bytes;
|
||||
ogg_int64_t overhead_bytes;
|
||||
ogg_int64_t lastlastgranulepos;
|
||||
ogg_int64_t lastgranulepos;
|
||||
ogg_int64_t firstgranule;
|
||||
ogg_int64_t total_samples;
|
||||
ogg_int64_t total_packets;
|
||||
ogg_int64_t total_pages;
|
||||
ogg_int32_t last_packet_duration;
|
||||
ogg_int32_t last_page_duration;
|
||||
ogg_int32_t max_page_duration;
|
||||
ogg_int32_t min_page_duration;
|
||||
ogg_int32_t max_packet_duration;
|
||||
ogg_int32_t min_packet_duration;
|
||||
ogg_int32_t max_packet_bytes;
|
||||
ogg_int32_t min_packet_bytes;
|
||||
int last_eos;
|
||||
|
||||
int doneheaders;
|
||||
} misc_opus_info;
|
||||
|
||||
void info_opus_start(stream_processor *stream);
|
|
@ -1,161 +0,0 @@
|
|||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: LPC low level routines
|
||||
last mod: $Id: lpc.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
/* Some of these routines (autocorrelator, LPC coefficient estimator)
|
||||
are derived from code written by Jutta Degener and Carsten Bormann;
|
||||
thus we include their copyright below. The entirety of this file
|
||||
is freely redistributable on the condition that both of these
|
||||
copyright notices are preserved without modification. */
|
||||
|
||||
/* Preserved Copyright: *********************************************/
|
||||
|
||||
/* Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann,
|
||||
Technische Universita"t Berlin
|
||||
|
||||
Any use of this software is permitted provided that this notice is not
|
||||
removed and that neither the authors nor the Technische Universita"t
|
||||
Berlin are deemed to have made any representations as to the
|
||||
suitability of this software for any purpose nor are held responsible
|
||||
for any defects of this software. THERE IS ABSOLUTELY NO WARRANTY FOR
|
||||
THIS SOFTWARE.
|
||||
|
||||
As a matter of courtesy, the authors request to be informed about uses
|
||||
this software has found, about bugs in this software, and about any
|
||||
improvements that may be of general interest.
|
||||
|
||||
Berlin, 28.11.1994
|
||||
Jutta Degener
|
||||
Carsten Bormann
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include "stack_alloc.h"
|
||||
#include "lpc.h"
|
||||
|
||||
/* Autocorrelation LPC coeff generation algorithm invented by
|
||||
N. Levinson in 1947, modified by J. Durbin in 1959. */
|
||||
|
||||
/* Input : n elements of time doamin data
|
||||
Output: m lpc coefficients, excitation energy */
|
||||
|
||||
float vorbis_lpc_from_data(float *data,float *lpci,int n,int m,int stride){
|
||||
double *aut=alloca(sizeof(*aut)*(m+1));
|
||||
double *lpc=alloca(sizeof(*lpc)*(m));
|
||||
double error;
|
||||
double epsilon;
|
||||
int i,j;
|
||||
|
||||
/* autocorrelation, p+1 lag coefficients */
|
||||
j=m+1;
|
||||
while(j--){
|
||||
double d=0; /* double needed for accumulator depth */
|
||||
for(i=j;i<n;i++)d+=(double)data[i*stride]*data[(i-j)*stride];
|
||||
aut[j]=d;
|
||||
}
|
||||
|
||||
/* Generate lpc coefficients from autocorr values */
|
||||
|
||||
/* set our noise floor to about -100dB */
|
||||
error=aut[0] * (1. + 1e-10);
|
||||
epsilon=1e-9*aut[0]+1e-10;
|
||||
|
||||
for(i=0;i<m;i++){
|
||||
double r= -aut[i+1];
|
||||
|
||||
if(error<epsilon){
|
||||
memset(lpc+i,0,(m-i)*sizeof(*lpc));
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Sum up this iteration's reflection coefficient; note that in
|
||||
Vorbis we don't save it. If anyone wants to recycle this code
|
||||
and needs reflection coefficients, save the results of 'r' from
|
||||
each iteration. */
|
||||
|
||||
for(j=0;j<i;j++)r-=lpc[j]*aut[i-j];
|
||||
r/=error;
|
||||
|
||||
/* Update LPC coefficients and total error */
|
||||
|
||||
lpc[i]=r;
|
||||
for(j=0;j<i/2;j++){
|
||||
double tmp=lpc[j];
|
||||
|
||||
lpc[j]+=r*lpc[i-1-j];
|
||||
lpc[i-1-j]+=r*tmp;
|
||||
}
|
||||
if(i&1)lpc[j]+=lpc[j]*r;
|
||||
|
||||
error*=1.-r*r;
|
||||
|
||||
}
|
||||
|
||||
done:
|
||||
|
||||
/* slightly damp the filter */
|
||||
{
|
||||
double g = .99;
|
||||
double damp = g;
|
||||
for(j=0;j<m;j++){
|
||||
lpc[j]*=damp;
|
||||
damp*=g;
|
||||
}
|
||||
}
|
||||
|
||||
for(j=0;j<m;j++)lpci[j]=(float)lpc[j];
|
||||
|
||||
/* we need the error value to know how big an impulse to hit the
|
||||
filter with later */
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
void vorbis_lpc_predict(float *coeff,float *prime,int m,
|
||||
float *data,long n,int stride){
|
||||
|
||||
/* in: coeff[0...m-1] LPC coefficients
|
||||
prime[0...m-1] initial values (allocated size of n+m-1)
|
||||
out: data[0...n-1] data samples */
|
||||
|
||||
long i,j,o,p;
|
||||
float y;
|
||||
float *work=alloca(sizeof(*work)*(m+n));
|
||||
|
||||
if(!prime)
|
||||
for(i=0;i<m;i++)
|
||||
work[i]=0.f;
|
||||
else
|
||||
for(i=0;i<m;i++)
|
||||
work[i]=prime[i*stride];
|
||||
|
||||
for(i=0;i<n;i++){
|
||||
y=0;
|
||||
o=i;
|
||||
p=m;
|
||||
for(j=0;j<m;j++)
|
||||
y-=work[o++]*coeff[--p];
|
||||
|
||||
data[i*stride]=work[o]=y;
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: LPC low level routines
|
||||
last mod: $Id: lpc.h 16037 2009-05-26 21:10:58Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#ifndef _V_LPC_H_
|
||||
#define _V_LPC_H_
|
||||
|
||||
/* simple linear scale LPC code */
|
||||
extern float vorbis_lpc_from_data(float *data,float *lpc,int n,int m,int stride);
|
||||
|
||||
extern void vorbis_lpc_predict(float *coeff,float *prime,int m,
|
||||
float *data,long n,int stride);
|
||||
|
||||
#endif
|
|
@ -1,286 +0,0 @@
|
|||
/* Copyright (C)2012 Xiph.Org Foundation
|
||||
File: opus_header.c
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "opus_header.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* Header contents:
|
||||
- "OpusHead" (64 bits)
|
||||
- version number (8 bits)
|
||||
- Channels C (8 bits)
|
||||
- Pre-skip (16 bits)
|
||||
- Sampling rate (32 bits)
|
||||
- Gain in dB (16 bits, S7.8)
|
||||
- Mapping (8 bits, 0=single stream (mono/stereo) 1=Vorbis mapping,
|
||||
2..254: reserved, 255: multistream with no mapping)
|
||||
|
||||
- if (mapping != 0)
|
||||
- N = totel number of streams (8 bits)
|
||||
- M = number of paired streams (8 bits)
|
||||
- C times channel origin
|
||||
- if (C<2*M)
|
||||
- stream = byte/2
|
||||
- if (byte&0x1 == 0)
|
||||
- left
|
||||
else
|
||||
- right
|
||||
- else
|
||||
- stream = byte-M
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
unsigned char *data;
|
||||
int maxlen;
|
||||
int pos;
|
||||
} Packet;
|
||||
|
||||
typedef struct {
|
||||
const unsigned char *data;
|
||||
int maxlen;
|
||||
int pos;
|
||||
} ROPacket;
|
||||
|
||||
static int write_uint32(Packet *p, ogg_uint32_t val)
|
||||
{
|
||||
if (p->pos>p->maxlen-4)
|
||||
return 0;
|
||||
p->data[p->pos ] = (val ) & 0xFF;
|
||||
p->data[p->pos+1] = (val>> 8) & 0xFF;
|
||||
p->data[p->pos+2] = (val>>16) & 0xFF;
|
||||
p->data[p->pos+3] = (val>>24) & 0xFF;
|
||||
p->pos += 4;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int write_uint16(Packet *p, ogg_uint16_t val)
|
||||
{
|
||||
if (p->pos>p->maxlen-2)
|
||||
return 0;
|
||||
p->data[p->pos ] = (val ) & 0xFF;
|
||||
p->data[p->pos+1] = (val>> 8) & 0xFF;
|
||||
p->pos += 2;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int write_chars(Packet *p, const unsigned char *str, int nb_chars)
|
||||
{
|
||||
int i;
|
||||
if (p->pos>p->maxlen-nb_chars)
|
||||
return 0;
|
||||
for (i=0;i<nb_chars;i++)
|
||||
p->data[p->pos++] = str[i];
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int read_uint32(ROPacket *p, ogg_uint32_t *val)
|
||||
{
|
||||
if (p->pos>p->maxlen-4)
|
||||
return 0;
|
||||
*val = (ogg_uint32_t)p->data[p->pos ];
|
||||
*val |= (ogg_uint32_t)p->data[p->pos+1]<< 8;
|
||||
*val |= (ogg_uint32_t)p->data[p->pos+2]<<16;
|
||||
*val |= (ogg_uint32_t)p->data[p->pos+3]<<24;
|
||||
p->pos += 4;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int read_uint16(ROPacket *p, ogg_uint16_t *val)
|
||||
{
|
||||
if (p->pos>p->maxlen-2)
|
||||
return 0;
|
||||
*val = (ogg_uint16_t)p->data[p->pos ];
|
||||
*val |= (ogg_uint16_t)p->data[p->pos+1]<<8;
|
||||
p->pos += 2;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int read_chars(ROPacket *p, unsigned char *str, int nb_chars)
|
||||
{
|
||||
int i;
|
||||
if (p->pos>p->maxlen-nb_chars)
|
||||
return 0;
|
||||
for (i=0;i<nb_chars;i++)
|
||||
str[i] = p->data[p->pos++];
|
||||
return 1;
|
||||
}
|
||||
|
||||
int opus_header_parse(const unsigned char *packet, int len, OpusHeader *h)
|
||||
{
|
||||
int i;
|
||||
char str[9];
|
||||
ROPacket p;
|
||||
unsigned char ch;
|
||||
ogg_uint16_t shortval;
|
||||
|
||||
p.data = packet;
|
||||
p.maxlen = len;
|
||||
p.pos = 0;
|
||||
str[8] = 0;
|
||||
if (len<19)return 0;
|
||||
read_chars(&p, (unsigned char*)str, 8);
|
||||
if (memcmp(str, "OpusHead", 8)!=0)
|
||||
return 0;
|
||||
|
||||
if (!read_chars(&p, &ch, 1))
|
||||
return 0;
|
||||
h->version = ch;
|
||||
if((h->version&240) != 0) /* Only major version 0 supported. */
|
||||
return 0;
|
||||
|
||||
if (!read_chars(&p, &ch, 1))
|
||||
return 0;
|
||||
h->channels = ch;
|
||||
if (h->channels == 0)
|
||||
return 0;
|
||||
|
||||
if (!read_uint16(&p, &shortval))
|
||||
return 0;
|
||||
h->preskip = shortval;
|
||||
|
||||
if (!read_uint32(&p, &h->input_sample_rate))
|
||||
return 0;
|
||||
|
||||
if (!read_uint16(&p, &shortval))
|
||||
return 0;
|
||||
h->gain = (short)shortval;
|
||||
|
||||
if (!read_chars(&p, &ch, 1))
|
||||
return 0;
|
||||
h->channel_mapping = ch;
|
||||
|
||||
if (h->channel_mapping != 0)
|
||||
{
|
||||
if (!read_chars(&p, &ch, 1))
|
||||
return 0;
|
||||
|
||||
if (ch<1)
|
||||
return 0;
|
||||
h->nb_streams = ch;
|
||||
|
||||
if (!read_chars(&p, &ch, 1))
|
||||
return 0;
|
||||
|
||||
if (ch>h->nb_streams || (ch+h->nb_streams)>255)
|
||||
return 0;
|
||||
h->nb_coupled = ch;
|
||||
|
||||
/* Multi-stream support */
|
||||
for (i=0;i<h->channels;i++)
|
||||
{
|
||||
if (!read_chars(&p, &h->stream_map[i], 1))
|
||||
return 0;
|
||||
if (h->stream_map[i]>(h->nb_streams+h->nb_coupled) && h->stream_map[i]!=255)
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if(h->channels>2)
|
||||
return 0;
|
||||
h->nb_streams = 1;
|
||||
h->nb_coupled = h->channels>1;
|
||||
h->stream_map[0]=0;
|
||||
h->stream_map[1]=1;
|
||||
}
|
||||
/*For version 0/1 we know there won't be any more data
|
||||
so reject any that have data past the end.*/
|
||||
if ((h->version==0 || h->version==1) && p.pos != len)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int opus_header_to_packet(const OpusHeader *h, unsigned char *packet, int len)
|
||||
{
|
||||
int i;
|
||||
Packet p;
|
||||
unsigned char ch;
|
||||
|
||||
p.data = packet;
|
||||
p.maxlen = len;
|
||||
p.pos = 0;
|
||||
if (len<19)return 0;
|
||||
if (!write_chars(&p, (const unsigned char*)"OpusHead", 8))
|
||||
return 0;
|
||||
/* Version is 1 */
|
||||
ch = 1;
|
||||
if (!write_chars(&p, &ch, 1))
|
||||
return 0;
|
||||
|
||||
ch = h->channels;
|
||||
if (!write_chars(&p, &ch, 1))
|
||||
return 0;
|
||||
|
||||
if (!write_uint16(&p, h->preskip))
|
||||
return 0;
|
||||
|
||||
if (!write_uint32(&p, h->input_sample_rate))
|
||||
return 0;
|
||||
|
||||
if (!write_uint16(&p, h->gain))
|
||||
return 0;
|
||||
|
||||
ch = h->channel_mapping;
|
||||
if (!write_chars(&p, &ch, 1))
|
||||
return 0;
|
||||
|
||||
if (h->channel_mapping != 0)
|
||||
{
|
||||
ch = h->nb_streams;
|
||||
if (!write_chars(&p, &ch, 1))
|
||||
return 0;
|
||||
|
||||
ch = h->nb_coupled;
|
||||
if (!write_chars(&p, &ch, 1))
|
||||
return 0;
|
||||
|
||||
/* Multi-stream support */
|
||||
for (i=0;i<h->channels;i++)
|
||||
{
|
||||
if (!write_chars(&p, &h->stream_map[i], 1))
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return p.pos;
|
||||
}
|
||||
|
||||
/* This is just here because it's a convenient file linked by both opusenc and
|
||||
opusdec (to guarantee this maps stays in sync). */
|
||||
const int wav_permute_matrix[8][8] =
|
||||
{
|
||||
{0}, /* 1.0 mono */
|
||||
{0,1}, /* 2.0 stereo */
|
||||
{0,2,1}, /* 3.0 channel ('wide') stereo */
|
||||
{0,1,2,3}, /* 4.0 discrete quadraphonic */
|
||||
{0,2,1,3,4}, /* 5.0 surround */
|
||||
{0,2,1,4,5,3}, /* 5.1 surround */
|
||||
{0,2,1,5,6,4,3}, /* 6.1 surround */
|
||||
{0,2,1,6,7,4,5,3} /* 7.1 surround (classic theater 8-track) */
|
||||
};
|
|
@ -1,51 +0,0 @@
|
|||
/* Copyright (C)2012 Xiph.Org Foundation
|
||||
File: opus_header.h
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef OPUS_HEADER_H
|
||||
#define OPUS_HEADER_H
|
||||
|
||||
#include <ogg/ogg.h>
|
||||
|
||||
typedef struct {
|
||||
int version;
|
||||
int channels; /* Number of channels: 1..255 */
|
||||
int preskip;
|
||||
ogg_uint32_t input_sample_rate;
|
||||
int gain; /* in dB S7.8 should be zero whenever possible */
|
||||
int channel_mapping;
|
||||
/* The rest is only used if channel_mapping != 0 */
|
||||
int nb_streams;
|
||||
int nb_coupled;
|
||||
unsigned char stream_map[255];
|
||||
} OpusHeader;
|
||||
|
||||
int opus_header_parse(const unsigned char *header, int len, OpusHeader *h);
|
||||
int opus_header_to_packet(const OpusHeader *h, unsigned char *packet, int len);
|
||||
|
||||
extern const int wav_permute_matrix[8][8];
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load diff
|
@ -1,231 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\share\getopt.c" />
|
||||
<ClCompile Include="..\share\getopt1.c" />
|
||||
<ClCompile Include="audio-in.c" />
|
||||
<ClCompile Include="diag_range.c" />
|
||||
<ClCompile Include="flac.c" />
|
||||
<ClCompile Include="lpc.c" />
|
||||
<ClCompile Include="opusdec.c" />
|
||||
<ClCompile Include="opus_header.c" />
|
||||
<ClCompile Include="resample.c" />
|
||||
<ClCompile Include="..\win32\unicode_support.c" />
|
||||
<ClCompile Include="wave_out.c" />
|
||||
<ClCompile Include="wav_io.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\win32\config.h" />
|
||||
<ClInclude Include="arch.h" />
|
||||
<ClInclude Include="diag_range.h" />
|
||||
<ClInclude Include="flac.h" />
|
||||
<ClInclude Include="info_opus.h" />
|
||||
<ClInclude Include="lpc.h" />
|
||||
<ClInclude Include="opusenc.h" />
|
||||
<ClInclude Include="opusinfo.h" />
|
||||
<ClInclude Include="opus_header.h" />
|
||||
<ClInclude Include="os_support.h" />
|
||||
<ClInclude Include="resample_sse.h" />
|
||||
<ClInclude Include="speex_resampler.h" />
|
||||
<ClInclude Include="stack_alloc.h" />
|
||||
<ClInclude Include="..\win32\unicode_support.h" />
|
||||
<ClInclude Include="wave_out.h" />
|
||||
<ClInclude Include="wav_io.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectName>opusdec</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LibraryPath>..\..\opus\win32\VS2010\$(Platform)\$(Configuration);..\..\libogg\win32\VS2010\$(Platform)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
<IntDir>$(Configuration)_opusdec\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LibraryPath>..\..\opus\win32\VS2010\$(Platform)\$(Configuration);..\..\libogg\win32\VS2010\$(Platform)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
<IntDir>$(Platform)\$(Configuration)_opusdec\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LibraryPath>..\..\opus\win32\VS2010\$(Platform)\$(Configuration);..\..\libogg\win32\VS2010\$(Platform)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
<IntDir>$(Configuration)_opusdec\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LibraryPath>..\..\opus\win32\VS2010\$(Platform)\$(Configuration);..\..\libogg\win32\VS2010\$(Platform)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
<IntDir>$(Platform)\$(Configuration)_opusdec\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\libogg\include;..\..\opus\include;..\win32;..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<AdditionalDependencies>celt.lib;opus.lib;silk_common.lib;silk_float.lib;libogg_static.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>"$(ProjectDir)..\win32\genversion.bat" "$(ProjectDir)..\win32\version.h" PACKAGE_VERSION</Command>
|
||||
<Message>Generating version.h</Message>
|
||||
</PreBuildEvent>
|
||||
<CustomBuildStep>
|
||||
<Command>
|
||||
</Command>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep>
|
||||
<Outputs>
|
||||
</Outputs>
|
||||
</CustomBuildStep>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;WIN64;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\libogg\include;..\..\opus\include;..\win32;..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<AdditionalDependencies>celt.lib;opus.lib;silk_common.lib;silk_float.lib;libogg_static.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>"$(ProjectDir)..\win32\genversion.bat" "$(ProjectDir)..\win32\version.h" PACKAGE_VERSION</Command>
|
||||
<Message>Generating version.h</Message>
|
||||
</PreBuildEvent>
|
||||
<CustomBuildStep>
|
||||
<Command>
|
||||
</Command>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep>
|
||||
<Outputs>
|
||||
</Outputs>
|
||||
</CustomBuildStep>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<AdditionalIncludeDirectories>..\..\libogg\include;..\..\opus\include;..\win32;..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>celt.lib;opus.lib;silk_common.lib;silk_float.lib;libogg_static.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>"$(ProjectDir)..\win32\genversion.bat" "$(ProjectDir)..\win32\version.h" PACKAGE_VERSION</Command>
|
||||
<Message>Generating version.h</Message>
|
||||
</PreBuildEvent>
|
||||
<CustomBuildStep>
|
||||
<Command>
|
||||
</Command>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep>
|
||||
<Outputs>
|
||||
</Outputs>
|
||||
</CustomBuildStep>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;WIN64;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<AdditionalIncludeDirectories>..\..\libogg\include;..\..\opus\include;..\win32;..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>celt.lib;opus.lib;silk_common.lib;silk_float.lib;libogg_static.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>"$(ProjectDir)..\win32\genversion.bat" "$(ProjectDir)..\win32\version.h" PACKAGE_VERSION</Command>
|
||||
<Message>Generating version.h</Message>
|
||||
</PreBuildEvent>
|
||||
<CustomBuildStep>
|
||||
<Command>
|
||||
</Command>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep>
|
||||
<Outputs>
|
||||
</Outputs>
|
||||
</CustomBuildStep>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -1,101 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{24918d8b-7cfd-42bd-a0b3-cd6e23c146a5}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{8c349b04-68c5-46dc-a94d-0bf5c1511206}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="opusdec.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="resample.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="wav_io.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="wave_out.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="audio-in.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="diag_range.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="lpc.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="opus_header.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\share\getopt.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\share\getopt1.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\win32\unicode_support.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="flac.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="lpc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="opus_header.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="opusenc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="opusinfo.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="os_support.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="speex_resampler.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="stack_alloc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="wav_io.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="wave_out.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="arch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="diag_range.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="info_opus.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resample_sse.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\win32\config.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\win32\unicode_support.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="flac.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
File diff suppressed because it is too large
Load diff
|
@ -1,109 +0,0 @@
|
|||
#ifndef __OPUSENC_H
|
||||
#define __OPUSENC_H
|
||||
|
||||
#include <opus_types.h>
|
||||
#include <ogg/ogg.h>
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
#include <libintl.h>
|
||||
#define _(X) gettext(X)
|
||||
#else
|
||||
#define _(X) (X)
|
||||
#define textdomain(X)
|
||||
#define bindtextdomain(X, Y)
|
||||
#endif
|
||||
#ifdef gettext_noop
|
||||
#define N_(X) gettext_noop(X)
|
||||
#else
|
||||
#define N_(X) (X)
|
||||
#endif
|
||||
|
||||
typedef long (*audio_read_func)(void *src, float *buffer, int samples);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
audio_read_func read_samples;
|
||||
void *readdata;
|
||||
opus_int64 total_samples_per_channel;
|
||||
int rawmode;
|
||||
int channels;
|
||||
long rate;
|
||||
int gain;
|
||||
int samplesize;
|
||||
int endianness;
|
||||
char *infilename;
|
||||
int ignorelength;
|
||||
int skip;
|
||||
int extraout;
|
||||
char *comments;
|
||||
int comments_length;
|
||||
int copy_comments;
|
||||
int copy_pictures;
|
||||
} oe_enc_opt;
|
||||
|
||||
void setup_scaler(oe_enc_opt *opt, float scale);
|
||||
void clear_scaler(oe_enc_opt *opt);
|
||||
void setup_padder(oe_enc_opt *opt, ogg_int64_t *original_samples);
|
||||
void clear_padder(oe_enc_opt *opt);
|
||||
int setup_downmix(oe_enc_opt *opt, int out_channels);
|
||||
void clear_downmix(oe_enc_opt *opt);
|
||||
void comment_add(char **comments, int* length, char *tag, char *val);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int (*id_func)(unsigned char *buf, int len); /* Returns true if can load file */
|
||||
int id_data_len; /* Amount of data needed to id whether this can load the file */
|
||||
int (*open_func)(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen);
|
||||
void (*close_func)(void *);
|
||||
char *format;
|
||||
char *description;
|
||||
} input_format;
|
||||
|
||||
typedef struct {
|
||||
short format;
|
||||
short channels;
|
||||
int samplerate;
|
||||
int bytespersec;
|
||||
short align;
|
||||
short samplesize;
|
||||
unsigned int mask;
|
||||
} wav_fmt;
|
||||
|
||||
typedef struct {
|
||||
short channels;
|
||||
short samplesize;
|
||||
opus_int64 totalsamples;
|
||||
opus_int64 samplesread;
|
||||
FILE *f;
|
||||
short bigendian;
|
||||
short unsigned8bit;
|
||||
int *channel_permute;
|
||||
} wavfile;
|
||||
|
||||
typedef struct {
|
||||
short channels;
|
||||
opus_int64 totalframes;
|
||||
short samplesize;
|
||||
int rate;
|
||||
int offset;
|
||||
int blocksize;
|
||||
} aiff_fmt;
|
||||
|
||||
typedef wavfile aifffile; /* They're the same */
|
||||
|
||||
input_format *open_audio_file(FILE *in, oe_enc_opt *opt);
|
||||
|
||||
int raw_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen);
|
||||
int wav_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen);
|
||||
int aiff_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen);
|
||||
int wav_id(unsigned char *buf, int len);
|
||||
int aiff_id(unsigned char *buf, int len);
|
||||
void wav_close(void *);
|
||||
void raw_close(void *);
|
||||
int setup_resample(oe_enc_opt *opt, int complexity, long outfreq);
|
||||
void clear_resample(oe_enc_opt *opt);
|
||||
|
||||
long wav_read(void *, float *buffer, int samples);
|
||||
long wav_ieee_read(void *, float *buffer, int samples);
|
||||
|
||||
#endif /* __OPUSENC_H */
|
|
@ -1,233 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\share\getopt.c" />
|
||||
<ClCompile Include="..\share\getopt1.c" />
|
||||
<ClCompile Include="audio-in.c" />
|
||||
<ClCompile Include="diag_range.c" />
|
||||
<ClCompile Include="flac.c" />
|
||||
<ClCompile Include="lpc.c" />
|
||||
<ClCompile Include="opusenc.c" />
|
||||
<ClCompile Include="opus_header.c" />
|
||||
<ClCompile Include="picture.c" />
|
||||
<ClCompile Include="resample.c" />
|
||||
<ClCompile Include="..\win32\unicode_support.c" />
|
||||
<ClCompile Include="wave_out.c" />
|
||||
<ClCompile Include="wav_io.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\win32\config.h" />
|
||||
<ClInclude Include="arch.h" />
|
||||
<ClInclude Include="diag_range.h" />
|
||||
<ClInclude Include="flac.h" />
|
||||
<ClInclude Include="info_opus.h" />
|
||||
<ClInclude Include="lpc.h" />
|
||||
<ClInclude Include="opusenc.h" />
|
||||
<ClInclude Include="opusinfo.h" />
|
||||
<ClInclude Include="opus_header.h" />
|
||||
<ClInclude Include="os_support.h" />
|
||||
<ClInclude Include="picture.h" />
|
||||
<ClInclude Include="resample_sse.h" />
|
||||
<ClInclude Include="speex_resampler.h" />
|
||||
<ClInclude Include="stack_alloc.h" />
|
||||
<ClInclude Include="..\win32\unicode_support.h" />
|
||||
<ClInclude Include="wave_out.h" />
|
||||
<ClInclude Include="wav_io.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectName>opusenc</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LibraryPath>..\..\opus\win32\VS2010\$(Platform)\$(Configuration);..\..\libogg\win32\VS2010\$(Platform)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
<IntDir>$(Configuration)_opusenc\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LibraryPath>..\..\opus\win32\VS2010\$(Platform)\$(Configuration);..\..\libogg\win32\VS2010\$(Platform)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
<IntDir>$(Platform)\$(Configuration)_opusenc\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LibraryPath>..\..\opus\win32\VS2010\$(Platform)\$(Configuration);..\..\libogg\win32\VS2010\$(Platform)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
<IntDir>$(Configuration)_opusenc\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LibraryPath>..\..\opus\win32\VS2010\$(Platform)\$(Configuration);..\..\libogg\win32\VS2010\$(Platform)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
<IntDir>$(Platform)\$(Configuration)_opusenc\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\libogg\include;..\..\opus\include;..\win32;..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<AdditionalDependencies>celt.lib;opus.lib;silk_common.lib;silk_float.lib;libogg_static.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>"$(ProjectDir)..\win32\genversion.bat" "$(ProjectDir)..\win32\version.h" PACKAGE_VERSION</Command>
|
||||
<Message>Generating version.h</Message>
|
||||
</PreBuildEvent>
|
||||
<CustomBuildStep>
|
||||
<Command>
|
||||
</Command>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep>
|
||||
<Outputs>
|
||||
</Outputs>
|
||||
</CustomBuildStep>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;WIN64;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\libogg\include;..\..\opus\include;..\win32;..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<AdditionalDependencies>celt.lib;opus.lib;silk_common.lib;silk_float.lib;libogg_static.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>"$(ProjectDir)..\win32\genversion.bat" "$(ProjectDir)..\win32\version.h" PACKAGE_VERSION</Command>
|
||||
<Message>Generating version.h</Message>
|
||||
</PreBuildEvent>
|
||||
<CustomBuildStep>
|
||||
<Command>
|
||||
</Command>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep>
|
||||
<Outputs>
|
||||
</Outputs>
|
||||
</CustomBuildStep>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<AdditionalIncludeDirectories>..\..\libogg\include;..\..\opus\include;..\win32;..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>celt.lib;opus.lib;silk_common.lib;silk_float.lib;libogg_static.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>"$(ProjectDir)..\win32\genversion.bat" "$(ProjectDir)..\win32\version.h" PACKAGE_VERSION</Command>
|
||||
<Message>Generating version.h</Message>
|
||||
</PreBuildEvent>
|
||||
<CustomBuildStep>
|
||||
<Command>
|
||||
</Command>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep>
|
||||
<Outputs>
|
||||
</Outputs>
|
||||
</CustomBuildStep>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;WIN64;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<AdditionalIncludeDirectories>..\..\libogg\include;..\..\opus\include;..\win32;..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>celt.lib;opus.lib;silk_common.lib;silk_float.lib;libogg_static.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>"$(ProjectDir)..\win32\genversion.bat" "$(ProjectDir)..\win32\version.h" PACKAGE_VERSION</Command>
|
||||
<Message>Generating version.h</Message>
|
||||
</PreBuildEvent>
|
||||
<CustomBuildStep>
|
||||
<Command>
|
||||
</Command>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep>
|
||||
<Outputs>
|
||||
</Outputs>
|
||||
</CustomBuildStep>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -1,107 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{a97dcbdc-73ba-4511-a2e2-94d54ff2e4cf}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{3eef0629-e020-4efb-a840-9fee027384f4}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="wav_io.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="wave_out.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="audio-in.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="diag_range.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="lpc.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="opus_header.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="opusenc.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="picture.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="resample.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\share\getopt.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\share\getopt1.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\win32\unicode_support.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="flac.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="info_opus.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="lpc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="opus_header.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="opusenc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="opusinfo.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="os_support.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="picture.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="speex_resampler.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="stack_alloc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="wav_io.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="wave_out.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="arch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="diag_range.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resample_sse.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\win32\config.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\win32\unicode_support.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="flac.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
File diff suppressed because it is too large
Load diff
|
@ -1,52 +0,0 @@
|
|||
/* Ogginfo
|
||||
*
|
||||
* A tool to describe ogg file contents and metadata.
|
||||
*
|
||||
* Copyright 2002-2005 Michael Smith <msmith@xiph.org>
|
||||
* Licensed under the GNU GPL, distributed with this program.
|
||||
*/
|
||||
|
||||
/*No NLS support for now*/
|
||||
#define _(X) (X)
|
||||
|
||||
#ifdef _WIN32
|
||||
#define I64FORMAT "I64d"
|
||||
#else
|
||||
#define I64FORMAT "lld"
|
||||
#endif
|
||||
|
||||
typedef struct _stream_processor {
|
||||
void (*process_page)(struct _stream_processor *, ogg_page *);
|
||||
void (*process_end)(struct _stream_processor *);
|
||||
int isillegal;
|
||||
int constraint_violated;
|
||||
int shownillegal;
|
||||
int isnew;
|
||||
long seqno;
|
||||
int lostseq;
|
||||
int seen_file_icons;
|
||||
|
||||
int start;
|
||||
int end;
|
||||
|
||||
int num;
|
||||
char *type;
|
||||
|
||||
ogg_uint32_t serial; /* must be 32 bit unsigned */
|
||||
ogg_stream_state os;
|
||||
void *data;
|
||||
} stream_processor;
|
||||
|
||||
typedef struct {
|
||||
stream_processor *streams;
|
||||
int allocated;
|
||||
int used;
|
||||
|
||||
int in_headers;
|
||||
} stream_set;
|
||||
|
||||
|
||||
void oi_info(char *format, ...);
|
||||
void oi_warn(char *format, ...);
|
||||
void oi_error(char *format, ...);
|
||||
void check_xiph_comment(stream_processor *stream, int i, const char *comment, int comment_length);
|
|
@ -1,234 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\share\getopt.c" />
|
||||
<ClCompile Include="..\share\getopt1.c" />
|
||||
<ClCompile Include="audio-in.c" />
|
||||
<ClCompile Include="diag_range.c" />
|
||||
<ClCompile Include="flac.c" />
|
||||
<ClCompile Include="info_opus.c" />
|
||||
<ClCompile Include="lpc.c" />
|
||||
<ClCompile Include="opusinfo.c" />
|
||||
<ClCompile Include="opus_header.c" />
|
||||
<ClCompile Include="picture.c" />
|
||||
<ClCompile Include="resample.c" />
|
||||
<ClCompile Include="wave_out.c" />
|
||||
<ClCompile Include="wav_io.c" />
|
||||
<ClCompile Include="..\win32\unicode_support.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\win32\config.h" />
|
||||
<ClInclude Include="arch.h" />
|
||||
<ClInclude Include="diag_range.h" />
|
||||
<ClInclude Include="flac.h" />
|
||||
<ClInclude Include="info_opus.h" />
|
||||
<ClInclude Include="lpc.h" />
|
||||
<ClInclude Include="opusenc.h" />
|
||||
<ClInclude Include="opusinfo.h" />
|
||||
<ClInclude Include="opus_header.h" />
|
||||
<ClInclude Include="os_support.h" />
|
||||
<ClInclude Include="picture.h" />
|
||||
<ClInclude Include="resample_sse.h" />
|
||||
<ClInclude Include="speex_resampler.h" />
|
||||
<ClInclude Include="stack_alloc.h" />
|
||||
<ClInclude Include="wave_out.h" />
|
||||
<ClInclude Include="wav_io.h" />
|
||||
<ClInclude Include="..\win32\unicode_support.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectName>opusinfo</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LibraryPath>..\..\opus\win32\VS2010\$(Platform)\$(Configuration);..\..\libogg\win32\VS2010\$(Platform)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
<IntDir>$(Configuration)_opusinfo\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LibraryPath>..\..\opus\win32\VS2010\$(Platform)\$(Configuration);..\..\libogg\win32\VS2010\$(Platform)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
<IntDir>$(Platform)\$(Configuration)_opusinfo\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LibraryPath>..\..\opus\win32\VS2010\$(Platform)\$(Configuration);..\..\libogg\win32\VS2010\$(Platform)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
<IntDir>$(Configuration)_opusinfo\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LibraryPath>..\..\opus\win32\VS2010\$(Platform)\$(Configuration);..\..\libogg\win32\VS2010\$(Platform)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
<IntDir>$(Platform)\$(Configuration)_opusinfo\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\libogg\include;..\..\opus\include;..\win32;..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<AdditionalDependencies>celt.lib;opus.lib;silk_common.lib;silk_float.lib;libogg_static.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>"$(ProjectDir)..\win32\genversion.bat" "$(ProjectDir)..\win32\version.h" PACKAGE_VERSION</Command>
|
||||
<Message>Generating version.h</Message>
|
||||
</PreBuildEvent>
|
||||
<CustomBuildStep>
|
||||
<Command>
|
||||
</Command>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep>
|
||||
<Outputs>
|
||||
</Outputs>
|
||||
</CustomBuildStep>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;WIN64;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\libogg\include;..\..\opus\include;..\win32;..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<AdditionalDependencies>celt.lib;opus.lib;silk_common.lib;silk_float.lib;libogg_static.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>"$(ProjectDir)..\win32\genversion.bat" "$(ProjectDir)..\win32\version.h" PACKAGE_VERSION</Command>
|
||||
<Message>Generating version.h</Message>
|
||||
</PreBuildEvent>
|
||||
<CustomBuildStep>
|
||||
<Command>
|
||||
</Command>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep>
|
||||
<Outputs>
|
||||
</Outputs>
|
||||
</CustomBuildStep>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<AdditionalIncludeDirectories>..\..\libogg\include;..\..\opus\include;..\win32;..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>celt.lib;opus.lib;silk_common.lib;silk_float.lib;libogg_static.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>"$(ProjectDir)..\win32\genversion.bat" "$(ProjectDir)..\win32\version.h" PACKAGE_VERSION</Command>
|
||||
<Message>Generating version.h</Message>
|
||||
</PreBuildEvent>
|
||||
<CustomBuildStep>
|
||||
<Command>
|
||||
</Command>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep>
|
||||
<Outputs>
|
||||
</Outputs>
|
||||
</CustomBuildStep>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;WIN64;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<AdditionalIncludeDirectories>..\..\libogg\include;..\..\opus\include;..\win32;..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>celt.lib;opus.lib;silk_common.lib;silk_float.lib;libogg_static.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>"$(ProjectDir)..\win32\genversion.bat" "$(ProjectDir)..\win32\version.h" PACKAGE_VERSION</Command>
|
||||
<Message>Generating version.h</Message>
|
||||
</PreBuildEvent>
|
||||
<CustomBuildStep>
|
||||
<Command>
|
||||
</Command>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep>
|
||||
<Outputs>
|
||||
</Outputs>
|
||||
</CustomBuildStep>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -1,110 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{9151be1a-eb66-4999-80bf-86a9a9850aad}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{6002a8c5-eecb-40c8-b815-523357c42aeb}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="wave_out.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="audio-in.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="diag_range.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="info_opus.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="lpc.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="opus_header.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="opusinfo.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="picture.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="resample.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="wav_io.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\share\getopt.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\share\getopt1.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\win32\unicode_support.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="flac.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="opus_header.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="opusenc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="opusinfo.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="os_support.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="picture.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="speex_resampler.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="stack_alloc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="wav_io.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="wave_out.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="arch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="diag_range.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="info_opus.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="lpc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resample_sse.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\win32\config.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\win32\unicode_support.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="flac.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,938 +0,0 @@
|
|||
/* Copyright 2012 Mozilla Foundation
|
||||
Copyright 2012 Xiph.Org Foundation
|
||||
Copyright 2012 Gregory Maxwell
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* dump opus rtp packets into an ogg file
|
||||
*
|
||||
* compile with: cc -g -Wall -o opusrtc opusrtp.c -lpcap -logg
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PCAP
|
||||
#include <pcap.h>
|
||||
#endif
|
||||
#include <opus.h>
|
||||
#include <ogg/ogg.h>
|
||||
|
||||
#define OPUS_PAYLOAD_TYPE 120
|
||||
|
||||
/* state struct for passing around our handles */
|
||||
typedef struct {
|
||||
ogg_stream_state *stream;
|
||||
FILE *out;
|
||||
int seq;
|
||||
ogg_int64_t granulepos;
|
||||
int linktype;
|
||||
} state;
|
||||
|
||||
/* helper, write a little-endian 32 bit int to memory */
|
||||
void le32(unsigned char *p, int v)
|
||||
{
|
||||
p[0] = v & 0xff;
|
||||
p[1] = (v >> 8) & 0xff;
|
||||
p[2] = (v >> 16) & 0xff;
|
||||
p[3] = (v >> 24) & 0xff;
|
||||
}
|
||||
|
||||
/* helper, write a little-endian 16 bit int to memory */
|
||||
void le16(unsigned char *p, int v)
|
||||
{
|
||||
p[0] = v & 0xff;
|
||||
p[1] = (v >> 8) & 0xff;
|
||||
}
|
||||
|
||||
/* helper, write a big-endian 32 bit int to memory */
|
||||
void be32(unsigned char *p, int v)
|
||||
{
|
||||
p[0] = (v >> 24) & 0xff;
|
||||
p[1] = (v >> 16) & 0xff;
|
||||
p[2] = (v >> 8) & 0xff;
|
||||
p[3] = v & 0xff;
|
||||
}
|
||||
|
||||
/* helper, write a big-endian 16 bit int to memory */
|
||||
void be16(unsigned char *p, int v)
|
||||
{
|
||||
p[0] = (v >> 8) & 0xff;
|
||||
p[1] = v & 0xff;
|
||||
}
|
||||
|
||||
|
||||
/* manufacture a generic OpusHead packet */
|
||||
ogg_packet *op_opushead(void)
|
||||
{
|
||||
int size = 19;
|
||||
unsigned char *data = malloc(size);
|
||||
ogg_packet *op = malloc(sizeof(*op));
|
||||
|
||||
if (!data) {
|
||||
fprintf(stderr, "Couldn't allocate data buffer.\n");
|
||||
free(op);
|
||||
return NULL;
|
||||
}
|
||||
if (!op) {
|
||||
fprintf(stderr, "Couldn't allocate Ogg packet.\n");
|
||||
free(data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memcpy(data, "OpusHead", 8); /* identifier */
|
||||
data[8] = 1; /* version */
|
||||
data[9] = 2; /* channels */
|
||||
le16(data+10, 0); /* pre-skip */
|
||||
le32(data + 12, 48000); /* original sample rate */
|
||||
le16(data + 16, 0); /* gain */
|
||||
data[18] = 0; /* channel mapping family */
|
||||
|
||||
op->packet = data;
|
||||
op->bytes = size;
|
||||
op->b_o_s = 1;
|
||||
op->e_o_s = 0;
|
||||
op->granulepos = 0;
|
||||
op->packetno = 0;
|
||||
|
||||
return op;
|
||||
}
|
||||
|
||||
|
||||
/* manufacture a generic OpusTags packet */
|
||||
ogg_packet *op_opustags(void)
|
||||
{
|
||||
char *identifier = "OpusTags";
|
||||
char *vendor = "opus rtp packet dump";
|
||||
int size = strlen(identifier) + 4 + strlen(vendor) + 4;
|
||||
unsigned char *data = malloc(size);
|
||||
ogg_packet *op = malloc(sizeof(*op));
|
||||
|
||||
if (!data) {
|
||||
fprintf(stderr, "Couldn't allocate data buffer.\n");
|
||||
free(op);
|
||||
return NULL;
|
||||
}
|
||||
if (!op) {
|
||||
fprintf(stderr, "Couldn't allocate Ogg packet.\n");
|
||||
free(data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memcpy(data, identifier, 8);
|
||||
le32(data + 8, strlen(vendor));
|
||||
memcpy(data + 12, vendor, strlen(vendor));
|
||||
le32(data + 12 + strlen(vendor), 0);
|
||||
|
||||
op->packet = data;
|
||||
op->bytes = size;
|
||||
op->b_o_s = 0;
|
||||
op->e_o_s = 0;
|
||||
op->granulepos = 0;
|
||||
op->packetno = 1;
|
||||
|
||||
return op;
|
||||
}
|
||||
|
||||
ogg_packet *op_from_pkt(const unsigned char *pkt, int len)
|
||||
{
|
||||
ogg_packet *op = malloc(sizeof(*op));
|
||||
if (!op) {
|
||||
fprintf(stderr, "Couldn't allocate Ogg packet.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
op->packet = (unsigned char *)pkt;
|
||||
op->bytes = len;
|
||||
op->b_o_s = 0;
|
||||
op->e_o_s = 0;
|
||||
|
||||
return op;
|
||||
}
|
||||
|
||||
/* free a packet and its contents */
|
||||
void op_free(ogg_packet *op) {
|
||||
if (op) {
|
||||
if (op->packet) {
|
||||
free(op->packet);
|
||||
}
|
||||
free(op);
|
||||
}
|
||||
}
|
||||
|
||||
/* check if an ogg page begins an opus stream */
|
||||
int is_opus(ogg_page *og)
|
||||
{
|
||||
ogg_stream_state os;
|
||||
ogg_packet op;
|
||||
|
||||
ogg_stream_init(&os, ogg_page_serialno(og));
|
||||
ogg_stream_pagein(&os, og);
|
||||
if (ogg_stream_packetout(&os, &op) == 1) {
|
||||
if (op.bytes >= 19 && !memcmp(op.packet, "OpusHead", 8)) {
|
||||
ogg_stream_clear(&os);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
ogg_stream_clear(&os);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* calculate the number of samples in an opus packet */
|
||||
int opus_samples(const unsigned char *packet, int size)
|
||||
{
|
||||
/* number of samples per frame at 48 kHz */
|
||||
int samples = opus_packet_get_samples_per_frame(packet, 48000);
|
||||
/* number "frames" in this packet */
|
||||
int frames = opus_packet_get_nb_frames(packet, size);
|
||||
|
||||
return samples*frames;
|
||||
}
|
||||
|
||||
/* helper, write out available ogg pages */
|
||||
int ogg_write(state *params)
|
||||
{
|
||||
ogg_page page;
|
||||
size_t written;
|
||||
|
||||
if (!params || !params->stream || !params->out) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
while (ogg_stream_pageout(params->stream, &page)) {
|
||||
written = fwrite(page.header, 1, page.header_len, params->out);
|
||||
if (written != (size_t)page.header_len) {
|
||||
fprintf(stderr, "Error writing Ogg page header\n");
|
||||
return -2;
|
||||
}
|
||||
written = fwrite(page.body, 1, page.body_len, params->out);
|
||||
if (written != (size_t)page.body_len) {
|
||||
fprintf(stderr, "Error writing Ogg page body\n");
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* helper, flush remaining ogg data */
|
||||
int ogg_flush(state *params)
|
||||
{
|
||||
ogg_page page;
|
||||
size_t written;
|
||||
|
||||
if (!params || !params->stream || !params->out) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
while (ogg_stream_flush(params->stream, &page)) {
|
||||
written = fwrite(page.header, 1, page.header_len, params->out);
|
||||
if (written != (size_t)page.header_len) {
|
||||
fprintf(stderr, "Error writing Ogg page header\n");
|
||||
return -2;
|
||||
}
|
||||
written = fwrite(page.body, 1, page.body_len, params->out);
|
||||
if (written != (size_t)page.body_len) {
|
||||
fprintf(stderr, "Error writing Ogg page body\n");
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define ETH_HEADER_LEN 14
|
||||
typedef struct {
|
||||
unsigned char src[6], dst[6]; /* ethernet MACs */
|
||||
int type;
|
||||
} eth_header;
|
||||
|
||||
#define LOOP_HEADER_LEN 4
|
||||
typedef struct {
|
||||
int family;
|
||||
} loop_header;
|
||||
|
||||
#define IP_HEADER_MIN 20
|
||||
typedef struct {
|
||||
int version;
|
||||
int header_size;
|
||||
unsigned char src[4], dst[4]; /* ipv4 addrs */
|
||||
int protocol;
|
||||
} ip_header;
|
||||
|
||||
#define UDP_HEADER_LEN 8
|
||||
typedef struct {
|
||||
int src, dst; /* ports */
|
||||
int size, checksum;
|
||||
} udp_header;
|
||||
|
||||
#define RTP_HEADER_MIN 12
|
||||
typedef struct {
|
||||
int version;
|
||||
int type;
|
||||
int pad, ext, cc, mark;
|
||||
int seq, time;
|
||||
int ssrc;
|
||||
int *csrc;
|
||||
int header_size;
|
||||
int payload_size;
|
||||
} rtp_header;
|
||||
|
||||
/* helper, read a big-endian 16 bit int from memory */
|
||||
static int rbe16(const unsigned char *p)
|
||||
{
|
||||
int v = p[0] << 8 | p[1];
|
||||
return v;
|
||||
}
|
||||
|
||||
/* helper, read a big-endian 32 bit int from memory */
|
||||
static int rbe32(const unsigned char *p)
|
||||
{
|
||||
int v = p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3];
|
||||
return v;
|
||||
}
|
||||
|
||||
/* helper, read a native-endian 32 bit int from memory */
|
||||
static int rne32(const unsigned char *p)
|
||||
{
|
||||
/* On x86 we could just cast, but that might not meet
|
||||
* arm alignment requirements. */
|
||||
int d = 0;
|
||||
memcpy(&d, p, 4);
|
||||
return d;
|
||||
}
|
||||
|
||||
int parse_eth_header(const unsigned char *packet, int size, eth_header *eth)
|
||||
{
|
||||
if (!packet || !eth) {
|
||||
return -2;
|
||||
}
|
||||
if (size < ETH_HEADER_LEN) {
|
||||
fprintf(stderr, "Packet too short for eth\n");
|
||||
return -1;
|
||||
}
|
||||
memcpy(eth->src, packet + 0, 6);
|
||||
memcpy(eth->dst, packet + 6, 6);
|
||||
eth->type = rbe16(packet + 12);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* used by the darwin loopback interface, at least */
|
||||
int parse_loop_header(const unsigned char *packet, int size, loop_header *loop)
|
||||
{
|
||||
if (!packet || !loop) {
|
||||
return -2;
|
||||
}
|
||||
if (size < LOOP_HEADER_LEN) {
|
||||
fprintf(stderr, "Packet too short for loopback\n");
|
||||
return -1;
|
||||
}
|
||||
/* protocol is in host byte order on osx. may be big endian on openbsd? */
|
||||
loop->family = rne32(packet);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int parse_ip_header(const unsigned char *packet, int size, ip_header *ip)
|
||||
{
|
||||
if (!packet || !ip) {
|
||||
return -2;
|
||||
}
|
||||
if (size < IP_HEADER_MIN) {
|
||||
fprintf(stderr, "Packet too short for ip\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ip->version = (packet[0] >> 4) & 0x0f;
|
||||
if (ip->version != 4) {
|
||||
fprintf(stderr, "unhandled ip version %d\n", ip->version);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ipv4 header */
|
||||
ip->header_size = 4 * (packet[0] & 0x0f);
|
||||
ip->protocol = packet[9];
|
||||
memcpy(ip->src, packet + 12, 4);
|
||||
memcpy(ip->dst, packet + 16, 4);
|
||||
|
||||
if (size < ip->header_size) {
|
||||
fprintf(stderr, "Packet too short for ipv4 with options\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int parse_udp_header(const unsigned char *packet, int size, udp_header *udp)
|
||||
{
|
||||
if (!packet || !udp) {
|
||||
return -2;
|
||||
}
|
||||
if (size < UDP_HEADER_LEN) {
|
||||
fprintf(stderr, "Packet too short for udp\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
udp->src = rbe16(packet);
|
||||
udp->dst = rbe16(packet + 2);
|
||||
udp->size = rbe16(packet + 4);
|
||||
udp->checksum = rbe16(packet + 6);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int parse_rtp_header(const unsigned char *packet, int size, rtp_header *rtp)
|
||||
{
|
||||
if (!packet || !rtp) {
|
||||
return -2;
|
||||
}
|
||||
if (size < RTP_HEADER_MIN) {
|
||||
fprintf(stderr, "Packet too short for rtp\n");
|
||||
return -1;
|
||||
}
|
||||
rtp->version = (packet[0] >> 6) & 3;
|
||||
rtp->pad = (packet[0] >> 5) & 1;
|
||||
rtp->ext = (packet[0] >> 4) & 1;
|
||||
rtp->cc = packet[0] & 7;
|
||||
rtp->header_size = 12 + 4 * rtp->cc;
|
||||
rtp->payload_size = size - rtp->header_size;
|
||||
|
||||
rtp->mark = (packet[1] >> 7) & 1;
|
||||
rtp->type = (packet[1]) & 127;
|
||||
rtp->seq = rbe16(packet + 2);
|
||||
rtp->time = rbe32(packet + 4);
|
||||
rtp->ssrc = rbe32(packet + 8);
|
||||
rtp->csrc = NULL;
|
||||
if (size < rtp->header_size) {
|
||||
fprintf(stderr, "Packet too short for RTP header\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int serialize_rtp_header(unsigned char *packet, int size, rtp_header *rtp)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!packet || !rtp) {
|
||||
return -2;
|
||||
}
|
||||
if (size < RTP_HEADER_MIN) {
|
||||
fprintf(stderr, "Packet buffer too short for RTP\n");
|
||||
return -1;
|
||||
}
|
||||
if (size < rtp->header_size) {
|
||||
fprintf(stderr, "Packet buffer too short for declared RTP header size\n");
|
||||
return -3;
|
||||
}
|
||||
packet[0] = ((rtp->version & 3) << 6) |
|
||||
((rtp->pad & 1) << 5) |
|
||||
((rtp->ext & 1) << 4) |
|
||||
((rtp->cc & 7));
|
||||
packet[1] = ((rtp->mark & 1) << 7) |
|
||||
((rtp->type & 127));
|
||||
be16(packet+2, rtp->seq);
|
||||
be32(packet+4, rtp->time);
|
||||
be32(packet+8, rtp->ssrc);
|
||||
if (rtp->cc && rtp->csrc) {
|
||||
for (i = 0; i < rtp->cc; i++) {
|
||||
be32(packet + 12 + i*4, rtp->csrc[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int update_rtp_header(rtp_header *rtp)
|
||||
{
|
||||
rtp->header_size = 12 + 4 * rtp->cc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
int send_rtp_packet(int fd, struct sockaddr *sin,
|
||||
rtp_header *rtp, const unsigned char *opus)
|
||||
{
|
||||
update_rtp_header(rtp);
|
||||
unsigned char *packet = malloc(rtp->header_size + rtp->payload_size);
|
||||
int ret;
|
||||
|
||||
if (!packet) {
|
||||
fprintf(stderr, "Couldn't allocate packet buffer\n");
|
||||
return -1;
|
||||
}
|
||||
serialize_rtp_header(packet, rtp->header_size, rtp);
|
||||
memcpy(packet + rtp->header_size, opus, rtp->payload_size);
|
||||
ret = sendto(fd, packet, rtp->header_size + rtp->payload_size, 0,
|
||||
sin, sizeof(*sin));
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "error sending: %s\n", strerror(errno));
|
||||
}
|
||||
free(packet);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rtp_send_file(const char *filename, const char *dest, int port)
|
||||
{
|
||||
rtp_header rtp;
|
||||
int fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||
struct sockaddr_in sin;
|
||||
int optval = 0;
|
||||
int ret;
|
||||
|
||||
if (fd < 0) {
|
||||
fprintf(stderr, "Couldn't create socket\n");
|
||||
return fd;
|
||||
}
|
||||
sin.sin_family = AF_INET;
|
||||
sin.sin_port = htons(port);
|
||||
if ((sin.sin_addr.s_addr = inet_addr(dest)) == INADDR_NONE) {
|
||||
fprintf(stderr, "Invalid address %s\n", dest);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(int));
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "Couldn't set socket options\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
rtp.version = 2;
|
||||
rtp.type = OPUS_PAYLOAD_TYPE;
|
||||
rtp.pad = 0;
|
||||
rtp.ext = 0;
|
||||
rtp.cc = 0;
|
||||
rtp.mark = 0;
|
||||
rtp.seq = rand();
|
||||
rtp.time = rand();
|
||||
rtp.ssrc = rand();
|
||||
rtp.csrc = NULL;
|
||||
rtp.header_size = 0;
|
||||
rtp.payload_size = 0;
|
||||
|
||||
fprintf(stderr, "Sending %s...\n", filename);
|
||||
FILE *in = fopen(filename, "rb");
|
||||
ogg_sync_state oy;
|
||||
ogg_stream_state os;
|
||||
ogg_page og;
|
||||
ogg_packet op;
|
||||
int headers = 0;
|
||||
char *in_data;
|
||||
const long in_size = 8192;
|
||||
size_t in_read;
|
||||
|
||||
if (!in) {
|
||||
fprintf(stderr, "Couldn't open input file '%s'\n", filename);
|
||||
return -1;
|
||||
}
|
||||
ret = ogg_sync_init(&oy);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "Couldn't initialize Ogg sync state\n");
|
||||
return ret;
|
||||
}
|
||||
while (!feof(in)) {
|
||||
in_data = ogg_sync_buffer(&oy, in_size);
|
||||
if (!in_data) {
|
||||
fprintf(stderr, "ogg_sync_buffer failed\n");
|
||||
return -1;
|
||||
}
|
||||
in_read = fread(in_data, 1, in_size, in);
|
||||
ret = ogg_sync_wrote(&oy, in_read);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "ogg_sync_wrote failed\n");
|
||||
return ret;
|
||||
}
|
||||
while (ogg_sync_pageout(&oy, &og) == 1) {
|
||||
if (headers == 0) {
|
||||
if (is_opus(&og)) {
|
||||
/* this is the start of an Opus stream */
|
||||
ret = ogg_stream_init(&os, ogg_page_serialno(&og));
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "ogg_stream_init failed\n");
|
||||
return ret;
|
||||
}
|
||||
headers++;
|
||||
} else if (!ogg_page_bos(&og)) {
|
||||
/* We're past the header and haven't found an Opus stream.
|
||||
* Time to give up. */
|
||||
return 1;
|
||||
} else {
|
||||
/* try again */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
/* submit the page for packetization */
|
||||
ret = ogg_stream_pagein(&os, &og);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "ogg_stream_pagein failed\n");
|
||||
return ret;
|
||||
}
|
||||
/* read and process available packets */
|
||||
while (ogg_stream_packetout(&os,&op) == 1) {
|
||||
int samples;
|
||||
/* skip header packets */
|
||||
if (headers == 1 && op.bytes >= 19 && !memcmp(op.packet, "OpusHead", 8)) {
|
||||
headers++;
|
||||
continue;
|
||||
}
|
||||
if (headers == 2 && op.bytes >= 16 && !memcmp(op.packet, "OpusTags", 8)) {
|
||||
headers++;
|
||||
continue;
|
||||
}
|
||||
/* get packet duration */
|
||||
samples = opus_samples(op.packet, op.bytes);
|
||||
/* update the rtp header and send */
|
||||
rtp.seq++;
|
||||
rtp.time += samples;
|
||||
rtp.payload_size = op.bytes;
|
||||
fprintf(stderr, "rtp %d %d %d %3d ms %5d bytes\n",
|
||||
rtp.type, rtp.seq, rtp.time, samples/48, rtp.payload_size);
|
||||
send_rtp_packet(fd, (struct sockaddr *)&sin, &rtp, op.packet);
|
||||
usleep(samples*1000/48);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (headers > 0)
|
||||
ogg_stream_clear(&os);
|
||||
ogg_sync_clear(&oy);
|
||||
fclose(in);
|
||||
return 0;
|
||||
}
|
||||
#else /* _WIN32 */
|
||||
int rtp_send_file(const char *filename, const char *addr, int port)
|
||||
{
|
||||
fprintf(stderr, "Cannot send '%s to %s:%d'. Socket support not available.\n",
|
||||
filename, addr, port);
|
||||
return -2;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_PCAP
|
||||
/* pcap 'got_packet' callback */
|
||||
void write_packet(u_char *args, const struct pcap_pkthdr *header,
|
||||
const u_char *data)
|
||||
{
|
||||
state *params = (state *)args;
|
||||
const unsigned char *packet;
|
||||
int size;
|
||||
eth_header eth;
|
||||
loop_header loop;
|
||||
ip_header ip;
|
||||
udp_header udp;
|
||||
rtp_header rtp;
|
||||
|
||||
fprintf(stderr, "Got %d byte packet (%d bytes captured)\n",
|
||||
header->len, header->caplen);
|
||||
packet = data;
|
||||
size = header->caplen;
|
||||
|
||||
/* parse the link-layer header */
|
||||
switch (params->linktype) {
|
||||
case DLT_EN10MB:
|
||||
if (parse_eth_header(packet, size, ð)) {
|
||||
fprintf(stderr, "error parsing eth header\n");
|
||||
return;
|
||||
}
|
||||
fprintf(stderr, " eth 0x%04x", eth.type);
|
||||
fprintf(stderr, " %02x:%02x:%02x:%02x:%02x:%02x ->",
|
||||
eth.src[0], eth.src[1], eth.src[2],
|
||||
eth.src[3], eth.src[4], eth.src[5]);
|
||||
fprintf(stderr, " %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
eth.dst[0], eth.dst[1], eth.dst[2],
|
||||
eth.dst[3], eth.dst[4], eth.dst[5]);
|
||||
if (eth.type != 0x0800) {
|
||||
fprintf(stderr, "skipping packet: no IPv4\n");
|
||||
return;
|
||||
}
|
||||
packet += ETH_HEADER_LEN;
|
||||
size -= ETH_HEADER_LEN;
|
||||
break;
|
||||
case DLT_NULL:
|
||||
if (parse_loop_header(packet, size, &loop)) {
|
||||
fprintf(stderr, "error parsing loopback header\n");
|
||||
return;
|
||||
}
|
||||
fprintf(stderr, " loopback family %d\n", loop.family);
|
||||
if (loop.family != PF_INET) {
|
||||
fprintf(stderr, "skipping packet: not IP\n");
|
||||
return;
|
||||
}
|
||||
packet += LOOP_HEADER_LEN;
|
||||
size -= LOOP_HEADER_LEN;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "skipping packet: unrecognized linktype %d\n",
|
||||
params->linktype);
|
||||
return;
|
||||
}
|
||||
|
||||
if (parse_ip_header(packet, size, &ip)) {
|
||||
fprintf(stderr, "error parsing ip header\n");
|
||||
return;
|
||||
}
|
||||
fprintf(stderr, " ipv%d protocol %d", ip.version, ip.protocol);
|
||||
fprintf(stderr, " %d.%d.%d.%d ->",
|
||||
ip.src[0], ip.src[1], ip.src[2], ip.src[3]);
|
||||
fprintf(stderr, " %d.%d.%d.%d",
|
||||
ip.dst[0], ip.dst[1], ip.dst[2], ip.dst[3]);
|
||||
fprintf(stderr, " header %d bytes\n", ip.header_size);
|
||||
if (ip.protocol != 17) {
|
||||
fprintf(stderr, "skipping packet: not UDP\n");
|
||||
return;
|
||||
}
|
||||
packet += ip.header_size;
|
||||
size -= ip.header_size;
|
||||
|
||||
if (parse_udp_header(packet, size, &udp)) {
|
||||
fprintf(stderr, "error parsing udp header\n");
|
||||
return;
|
||||
}
|
||||
fprintf(stderr, " udp %d bytes %d -> %d crc 0x%04x\n",
|
||||
udp.size, udp.src, udp.dst, udp.checksum);
|
||||
packet += UDP_HEADER_LEN;
|
||||
size -= UDP_HEADER_LEN;
|
||||
|
||||
if (parse_rtp_header(packet, size, &rtp)) {
|
||||
fprintf(stderr, "error parsing rtp header\n");
|
||||
return;
|
||||
}
|
||||
fprintf(stderr, " rtp 0x%08x %d %d %d",
|
||||
rtp.ssrc, rtp.type, rtp.seq, rtp.time);
|
||||
fprintf(stderr, " v%d %s%s%s CC %d", rtp.version,
|
||||
rtp.pad ? "P":".", rtp.ext ? "X":".",
|
||||
rtp.mark ? "M":".", rtp.cc);
|
||||
fprintf(stderr, " %5d bytes\n", rtp.payload_size);
|
||||
|
||||
packet += rtp.header_size;
|
||||
size -= rtp.header_size;
|
||||
|
||||
if (size < 0) {
|
||||
fprintf(stderr, "skipping short packet\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (rtp.seq < params->seq) {
|
||||
fprintf(stderr, "skipping out-of-sequence packet\n");
|
||||
return;
|
||||
}
|
||||
params->seq = rtp.seq;
|
||||
|
||||
if (rtp.type != OPUS_PAYLOAD_TYPE) {
|
||||
fprintf(stderr, "skipping non-opus packet\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* write the payload to our opus file */
|
||||
ogg_packet *op = op_from_pkt(packet, size);
|
||||
op->packetno = rtp.seq;
|
||||
params->granulepos += opus_samples(packet, size);
|
||||
op->granulepos = params->granulepos;
|
||||
ogg_stream_packetin(params->stream, op);
|
||||
free(op);
|
||||
ogg_write(params);
|
||||
|
||||
if (size < rtp.payload_size) {
|
||||
fprintf(stderr, "!! truncated %d uncaptured bytes\n",
|
||||
rtp.payload_size - size);
|
||||
}
|
||||
}
|
||||
|
||||
/* use libpcap to capture packets and write them to a file */
|
||||
int sniff(char *device)
|
||||
{
|
||||
state *params;
|
||||
pcap_t *pcap;
|
||||
char errbuf[PCAP_ERRBUF_SIZE];
|
||||
ogg_packet *op;
|
||||
|
||||
if (!device) {
|
||||
device = "lo";
|
||||
}
|
||||
|
||||
/* set up */
|
||||
pcap = pcap_open_live(device, 9600, 0, 1000, errbuf);
|
||||
if (pcap == NULL) {
|
||||
fprintf(stderr, "Couldn't open device %s: %s\n", device, errbuf);
|
||||
return(2);
|
||||
}
|
||||
params = malloc(sizeof(state));
|
||||
if (!params) {
|
||||
fprintf(stderr, "Couldn't allocate param struct.\n");
|
||||
return -1;
|
||||
}
|
||||
params->linktype = pcap_datalink(pcap);
|
||||
params->stream = malloc(sizeof(ogg_stream_state));
|
||||
if (!params->stream) {
|
||||
fprintf(stderr, "Couldn't allocate stream struct.\n");
|
||||
free(params);
|
||||
return -1;
|
||||
}
|
||||
if (ogg_stream_init(params->stream, rand()) < 0) {
|
||||
fprintf(stderr, "Couldn't initialize Ogg stream state.\n");
|
||||
free(params->stream);
|
||||
free(params);
|
||||
return -1;
|
||||
}
|
||||
params->out = fopen("rtpdump.opus", "wb");
|
||||
if (!params->out) {
|
||||
fprintf(stderr, "Couldn't open output file.\n");
|
||||
free(params->stream);
|
||||
free(params);
|
||||
return -2;
|
||||
}
|
||||
params->seq = 0;
|
||||
params->granulepos = 0;
|
||||
|
||||
/* write stream headers */
|
||||
op = op_opushead();
|
||||
ogg_stream_packetin(params->stream, op);
|
||||
op_free(op);
|
||||
op = op_opustags();
|
||||
ogg_stream_packetin(params->stream, op);
|
||||
op_free(op);
|
||||
ogg_flush(params);
|
||||
|
||||
/* start capture loop */
|
||||
fprintf(stderr, "Capturing packets\n");
|
||||
pcap_loop(pcap, 300, write_packet, (u_char *)params);
|
||||
|
||||
/* write outstanding data */
|
||||
ogg_flush(params);
|
||||
|
||||
/* clean up */
|
||||
fclose(params->out);
|
||||
ogg_stream_destroy(params->stream);
|
||||
free(params);
|
||||
pcap_close(pcap);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* HAVE_PCAP */
|
||||
|
||||
void opustools_version(void)
|
||||
{
|
||||
printf("opusrtp %s %s\n", PACKAGE_NAME, PACKAGE_VERSION);
|
||||
printf("Copyright (C) 2012 Xiph.Org Foundation\n");
|
||||
}
|
||||
|
||||
void usage(char *exe)
|
||||
{
|
||||
printf("Usage: %s [--sniff] <file.opus> [<file2.opus>]\n", exe);
|
||||
printf("\n");
|
||||
printf("Sends and receives Opus audio RTP streams.\n");
|
||||
printf("\nGeneral Options:\n");
|
||||
printf(" -h, --help This help\n");
|
||||
printf(" -V, --version Version information\n");
|
||||
printf(" -q, --quiet Suppress status output\n");
|
||||
printf(" -d, --destination Destination address (default 127.0.0.1)\n");
|
||||
printf(" -p, --port Destination port (default 1234)\n");
|
||||
printf(" --sniff Sniff and record Opus RTP streams\n");
|
||||
printf("\n");
|
||||
printf("By default, the given file(s) will be sent over RTP.\n");
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int option, i;
|
||||
const char *dest = "127.0.0.1";
|
||||
int port = 1234;
|
||||
struct option long_options[] = {
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{"version", no_argument, NULL, 'V'},
|
||||
{"quiet", no_argument, NULL, 'q'},
|
||||
{"destination", required_argument, NULL, 'd'},
|
||||
{"port", required_argument, NULL, 'p'},
|
||||
{"sniff", no_argument, NULL, 0},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
/* process command line arguments */
|
||||
while ((option = getopt_long(argc, argv, "hVqd:p:", long_options, &i)) != -1) {
|
||||
switch (option) {
|
||||
case 0:
|
||||
if (!strcmp(long_options[i].name, "sniff")) {
|
||||
#ifdef HAVE_PCAP
|
||||
sniff("lo0");
|
||||
return 0;
|
||||
#else
|
||||
fprintf(stderr, "pcap support disabled, sorry.\n");
|
||||
return 1;
|
||||
#endif
|
||||
} else {
|
||||
fprintf(stderr, "Unknown option - try %s --help.\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case 'V':
|
||||
opustools_version();
|
||||
return 0;
|
||||
case 'q':
|
||||
break;
|
||||
case 'd':
|
||||
if (optarg)
|
||||
dest = optarg;
|
||||
break;
|
||||
case 'p':
|
||||
if (optarg)
|
||||
port = atoi(optarg);
|
||||
break;
|
||||
case 'h':
|
||||
usage(argv[0]);
|
||||
return 0;
|
||||
case '?':
|
||||
default:
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = optind; i < argc; i++) {
|
||||
rtp_send_file(argv[i], dest, port);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,167 +0,0 @@
|
|||
/* Copyright (C) 2007 Jean-Marc Valin
|
||||
|
||||
File: os_support.h
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef OS_SUPPORT_H
|
||||
#define OS_SUPPORT_H
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#ifdef OS_SUPPORT_CUSTOM
|
||||
#include "os_support_custom.h"
|
||||
#endif
|
||||
|
||||
/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_free
|
||||
NOTE: speex_alloc needs to CLEAR THE MEMORY */
|
||||
#ifndef OVERRIDE_SPEEX_ALLOC
|
||||
static inline void *speex_alloc (int size)
|
||||
{
|
||||
/* WARNING: this is not equivalent to malloc(). If you want to use malloc()
|
||||
or your own allocator, YOU NEED TO CLEAR THE MEMORY ALLOCATED. Otherwise
|
||||
you will experience strange bugs */
|
||||
return calloc(size,1);
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Same as speex_alloc, except that the area is only needed inside a Speex call (might cause problem with wideband though) */
|
||||
#ifndef OVERRIDE_SPEEX_ALLOC_SCRATCH
|
||||
static inline void *speex_alloc_scratch (int size)
|
||||
{
|
||||
/* Scratch space doesn't need to be cleared */
|
||||
return calloc(size,1);
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Speex wrapper for realloc. To do your own dynamic allocation, all you need to do is replace this function, speex_alloc and speex_free */
|
||||
#ifndef OVERRIDE_SPEEX_REALLOC
|
||||
static inline void *speex_realloc (void *ptr, int size)
|
||||
{
|
||||
return realloc(ptr, size);
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_alloc */
|
||||
#ifndef OVERRIDE_SPEEX_FREE
|
||||
static inline void speex_free (void *ptr)
|
||||
{
|
||||
free(ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Same as speex_free, except that the area is only needed inside a Speex call (might cause problem with wideband though) */
|
||||
#ifndef OVERRIDE_SPEEX_FREE_SCRATCH
|
||||
static inline void speex_free_scratch (void *ptr)
|
||||
{
|
||||
free(ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Copy n bytes of memory from src to dst. The 0* term provides compile-time type checking */
|
||||
#ifndef OVERRIDE_SPEEX_COPY
|
||||
#define SPEEX_COPY(dst, src, n) (memcpy((dst), (src), (n)*sizeof(*(dst)) + 0*((dst)-(src)) ))
|
||||
#endif
|
||||
|
||||
/** Copy n bytes of memory from src to dst, allowing overlapping regions. The 0* term
|
||||
provides compile-time type checking */
|
||||
#ifndef OVERRIDE_SPEEX_MOVE
|
||||
#define SPEEX_MOVE(dst, src, n) (memmove((dst), (src), (n)*sizeof(*(dst)) + 0*((dst)-(src)) ))
|
||||
#endif
|
||||
|
||||
/** Set n bytes of memory to value of c, starting at address s */
|
||||
#ifndef OVERRIDE_SPEEX_MEMSET
|
||||
#define SPEEX_MEMSET(dst, c, n) (memset((dst), (c), (n)*sizeof(*(dst))))
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef OVERRIDE_SPEEX_FATAL
|
||||
static inline void _speex_fatal(const char *str, const char *file, int line)
|
||||
{
|
||||
fprintf (stderr, "Fatal (internal) error in %s, line %d: %s\n", file, line, str);
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OVERRIDE_SPEEX_WARNING
|
||||
static inline void speex_warning(const char *str)
|
||||
{
|
||||
#ifndef DISABLE_WARNINGS
|
||||
fprintf (stderr, "warning: %s\n", str);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OVERRIDE_SPEEX_WARNING_INT
|
||||
static inline void speex_warning_int(const char *str, int val)
|
||||
{
|
||||
#ifndef DISABLE_WARNINGS
|
||||
fprintf (stderr, "warning: %s %d\n", str, val);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OVERRIDE_SPEEX_NOTIFY
|
||||
static inline void speex_notify(const char *str)
|
||||
{
|
||||
#ifndef DISABLE_NOTIFICATIONS
|
||||
fprintf (stderr, "notification: %s\n", str);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OVERRIDE_SPEEX_PUTC
|
||||
/** Speex wrapper for putc */
|
||||
static inline void _speex_putc(int ch, void *file)
|
||||
{
|
||||
FILE *f = (FILE *)file;
|
||||
fprintf(f, "%c", ch);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define speex_fatal(str) _speex_fatal(str, __FILE__, __LINE__);
|
||||
#define speex_assert(cond) {if (!(cond)) {speex_fatal("assertion failed: " #cond);}}
|
||||
|
||||
#ifndef RELEASE
|
||||
static inline void print_vec(float *vec, int len, char *name)
|
||||
{
|
||||
int i;
|
||||
printf ("%s ", name);
|
||||
for (i=0;i<len;i++)
|
||||
printf (" %f", vec[i]);
|
||||
printf ("\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -1,499 +0,0 @@
|
|||
/* Copyright (C)2007-2013 Xiph.Org Foundation
|
||||
File: picture.c
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "picture.h"
|
||||
|
||||
static const char BASE64_TABLE[64]={
|
||||
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',
|
||||
'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f',
|
||||
'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v',
|
||||
'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/'
|
||||
};
|
||||
|
||||
/*Utility function for base64 encoding METADATA_BLOCK_PICTURE tags.
|
||||
Stores BASE64_LENGTH(len)+1 bytes in dst (including a terminating NUL).*/
|
||||
void base64_encode(char *dst, const char *src, int len){
|
||||
unsigned s0;
|
||||
unsigned s1;
|
||||
unsigned s2;
|
||||
int ngroups;
|
||||
int i;
|
||||
ngroups=len/3;
|
||||
for(i=0;i<ngroups;i++){
|
||||
s0=(unsigned char)src[3*i+0];
|
||||
s1=(unsigned char)src[3*i+1];
|
||||
s2=(unsigned char)src[3*i+2];
|
||||
dst[4*i+0]=BASE64_TABLE[s0>>2];
|
||||
dst[4*i+1]=BASE64_TABLE[(s0&3)<<4|s1>>4];
|
||||
dst[4*i+2]=BASE64_TABLE[(s1&15)<<2|s2>>6];
|
||||
dst[4*i+3]=BASE64_TABLE[s2&63];
|
||||
}
|
||||
len-=3*i;
|
||||
if(len==1){
|
||||
s0=(unsigned char)src[3*i+0];
|
||||
dst[4*i+0]=BASE64_TABLE[s0>>2];
|
||||
dst[4*i+1]=BASE64_TABLE[(s0&3)<<4];
|
||||
dst[4*i+2]='=';
|
||||
dst[4*i+3]='=';
|
||||
i++;
|
||||
}
|
||||
else if(len==2){
|
||||
s0=(unsigned char)src[3*i+0];
|
||||
s1=(unsigned char)src[3*i+1];
|
||||
dst[4*i+0]=BASE64_TABLE[s0>>2];
|
||||
dst[4*i+1]=BASE64_TABLE[(s0&3)<<4|s1>>4];
|
||||
dst[4*i+2]=BASE64_TABLE[(s1&15)<<2];
|
||||
dst[4*i+3]='=';
|
||||
i++;
|
||||
}
|
||||
dst[4*i]='\0';
|
||||
}
|
||||
|
||||
/*A version of strncasecmp() that is guaranteed to only ignore the case of
|
||||
ASCII characters.*/
|
||||
int oi_strncasecmp(const char *a, const char *b, int n){
|
||||
int i;
|
||||
for(i=0;i<n;i++){
|
||||
int aval;
|
||||
int bval;
|
||||
int diff;
|
||||
aval=a[i];
|
||||
bval=b[i];
|
||||
if(aval>='a'&&aval<='z') {
|
||||
aval-='a'-'A';
|
||||
}
|
||||
if(bval>='a'&&bval<='z'){
|
||||
bval-='a'-'A';
|
||||
}
|
||||
diff=aval-bval;
|
||||
if(diff){
|
||||
return diff;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int is_jpeg(const unsigned char *buf, size_t length){
|
||||
return length>=11&&memcmp(buf,"\xFF\xD8\xFF\xE0",4)==0
|
||||
&&(buf[4]<<8|buf[5])>=16&&memcmp(buf+6,"JFIF",5)==0;
|
||||
}
|
||||
|
||||
int is_png(const unsigned char *buf, size_t length){
|
||||
return length>=8&&memcmp(buf,"\x89PNG\x0D\x0A\x1A\x0A",8)==0;
|
||||
}
|
||||
|
||||
int is_gif(const unsigned char *buf, size_t length){
|
||||
return length>=6
|
||||
&&(memcmp(buf,"GIF87a",6)==0||memcmp(buf,"GIF89a",6)==0);
|
||||
}
|
||||
|
||||
#define READ_U32_BE(buf) \
|
||||
(((buf)[0]<<24)|((buf)[1]<<16)|((buf)[2]<<8)|((buf)[3]&0xff))
|
||||
|
||||
/*Tries to extract the width, height, bits per pixel, and palette size of a
|
||||
PNG.
|
||||
On failure, simply leaves its outputs unmodified.*/
|
||||
void extract_png_params(const unsigned char *data, size_t data_length,
|
||||
ogg_uint32_t *width, ogg_uint32_t *height,
|
||||
ogg_uint32_t *depth, ogg_uint32_t *colors,
|
||||
int *has_palette){
|
||||
if(is_png(data,data_length)){
|
||||
size_t offs;
|
||||
offs=8;
|
||||
while(data_length-offs>=12){
|
||||
ogg_uint32_t chunk_len;
|
||||
chunk_len=READ_U32_BE(data+offs);
|
||||
if(chunk_len>data_length-(offs+12))break;
|
||||
else if(chunk_len==13&&memcmp(data+offs+4,"IHDR",4)==0){
|
||||
int color_type;
|
||||
*width=READ_U32_BE(data+offs+8);
|
||||
*height=READ_U32_BE(data+offs+12);
|
||||
color_type=data[offs+17];
|
||||
if(color_type==3){
|
||||
*depth=24;
|
||||
*has_palette=1;
|
||||
}
|
||||
else{
|
||||
int sample_depth;
|
||||
sample_depth=data[offs+16];
|
||||
if(color_type==0)*depth=sample_depth;
|
||||
else if(color_type==2)*depth=sample_depth*3;
|
||||
else if(color_type==4)*depth=sample_depth*2;
|
||||
else if(color_type==6)*depth=sample_depth*4;
|
||||
*colors=0;
|
||||
*has_palette=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(*has_palette>0&&memcmp(data+offs+4,"PLTE",4)==0){
|
||||
*colors=chunk_len/3;
|
||||
break;
|
||||
}
|
||||
offs+=12+chunk_len;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*Tries to extract the width, height, bits per pixel, and palette size of a
|
||||
GIF.
|
||||
On failure, simply leaves its outputs unmodified.*/
|
||||
void extract_gif_params(const unsigned char *data, size_t data_length,
|
||||
ogg_uint32_t *width, ogg_uint32_t *height,
|
||||
ogg_uint32_t *depth, ogg_uint32_t *colors,
|
||||
int *has_palette){
|
||||
if(is_gif(data,data_length)&&data_length>=14){
|
||||
*width=data[6]|data[7]<<8;
|
||||
*height=data[8]|data[9]<<8;
|
||||
/*libFLAC hard-codes the depth to 24.*/
|
||||
*depth=24;
|
||||
*colors=1<<((data[10]&7)+1);
|
||||
*has_palette=1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*Tries to extract the width, height, bits per pixel, and palette size of a
|
||||
JPEG.
|
||||
On failure, simply leaves its outputs unmodified.*/
|
||||
void extract_jpeg_params(const unsigned char *data, size_t data_length,
|
||||
ogg_uint32_t *width, ogg_uint32_t *height,
|
||||
ogg_uint32_t *depth, ogg_uint32_t *colors,
|
||||
int *has_palette){
|
||||
if(is_jpeg(data,data_length)){
|
||||
size_t offs;
|
||||
offs=2;
|
||||
for(;;){
|
||||
size_t segment_len;
|
||||
int marker;
|
||||
while(offs<data_length&&data[offs]!=0xFF)offs++;
|
||||
while(offs<data_length&&data[offs]==0xFF)offs++;
|
||||
marker=data[offs];
|
||||
offs++;
|
||||
/*If we hit EOI* (end of image), or another SOI* (start of image),
|
||||
or SOS (start of scan), then stop now.*/
|
||||
if(offs>=data_length||(marker>=0xD8&&marker<=0xDA))break;
|
||||
/*RST* (restart markers): skip (no segment length).*/
|
||||
else if(marker>=0xD0&&marker<=0xD7)continue;
|
||||
/*Read the length of the marker segment.*/
|
||||
if(data_length-offs<2)break;
|
||||
segment_len=data[offs]<<8|data[offs+1];
|
||||
if(segment_len<2||data_length-offs<segment_len)break;
|
||||
if(marker==0xC0||(marker>0xC0&&marker<0xD0&&(marker&3)!=0)){
|
||||
/*Found a SOFn (start of frame) marker segment:*/
|
||||
if(segment_len>=8){
|
||||
*height=data[offs+3]<<8|data[offs+4];
|
||||
*width=data[offs+5]<<8|data[offs+6];
|
||||
*depth=data[offs+2]*data[offs+7];
|
||||
*colors=0;
|
||||
*has_palette=0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
/*Other markers: skip the whole marker segment.*/
|
||||
offs+=segment_len;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define IMAX(a,b) ((a) > (b) ? (a) : (b))
|
||||
|
||||
/*Parse a picture SPECIFICATION as given on the command-line.
|
||||
spec: The specification.
|
||||
error_message: Returns an error message on error.
|
||||
seen_file_icons: Bit flags used to track if any pictures of type 1 or type 2
|
||||
have already been added, to ensure only one is allowed.
|
||||
Return: A Base64-encoded string suitable for use in a METADATA_BLOCK_PICTURE
|
||||
tag.*/
|
||||
char *parse_picture_specification(const char *spec,
|
||||
const char **error_message,
|
||||
int *seen_file_icons){
|
||||
FILE *picture_file;
|
||||
unsigned long picture_type;
|
||||
unsigned long width;
|
||||
unsigned long height;
|
||||
unsigned long depth;
|
||||
unsigned long colors;
|
||||
const char *mime_type;
|
||||
const char *mime_type_end;
|
||||
const char *description;
|
||||
const char *description_end;
|
||||
const char *filename;
|
||||
unsigned char *buf;
|
||||
char *out;
|
||||
size_t cbuf;
|
||||
size_t nbuf;
|
||||
size_t data_offset;
|
||||
size_t data_length;
|
||||
size_t b64_length;
|
||||
int is_url;
|
||||
/*If a filename has a '|' in it, there's no way we can distinguish it from a
|
||||
full specification just from the spec string.
|
||||
Instead, try to open the file.
|
||||
If it exists, the user probably meant the file.*/
|
||||
picture_type=3;
|
||||
width=height=depth=colors=0;
|
||||
mime_type=mime_type_end=description=description_end=filename=spec;
|
||||
is_url=0;
|
||||
picture_file=fopen(filename,"rb");
|
||||
if(picture_file==NULL&&strchr(spec,'|')){
|
||||
const char *p;
|
||||
char *q;
|
||||
/*We don't have a plain file, and there is a pipe character: assume it's
|
||||
the full form of the specification.*/
|
||||
picture_type=strtoul(spec,&q,10);
|
||||
if(*q!='|'||picture_type>20){
|
||||
*error_message="invalid picture type";
|
||||
return NULL;
|
||||
}
|
||||
if(picture_type>=1&&picture_type<=2&&(*seen_file_icons&picture_type)){
|
||||
*error_message=picture_type==1?
|
||||
"only one picture of type 1 (32x32 icon) allowed":
|
||||
"only one picture of type 2 (icon) allowed";
|
||||
return NULL;
|
||||
}
|
||||
/*An empty field implies a default of 'Cover (front)'.*/
|
||||
if(spec==q)picture_type=3;
|
||||
mime_type=q+1;
|
||||
mime_type_end=mime_type+strcspn(mime_type,"|");
|
||||
if(*mime_type_end!='|'){
|
||||
*error_message="invalid picture specification: not enough fields";
|
||||
return NULL;
|
||||
}
|
||||
/*The mime type must be composed of ASCII printable characters 0x20-0x7E.*/
|
||||
for(p=mime_type;p<mime_type_end;p++)if(*p<0x20||*p>0x7E){
|
||||
*error_message="invalid characters in mime type";
|
||||
return NULL;
|
||||
}
|
||||
is_url=mime_type_end-mime_type==3
|
||||
&&strncmp("-->",mime_type,mime_type_end-mime_type)==0;
|
||||
description=mime_type_end+1;
|
||||
description_end=description+strcspn(description,"|");
|
||||
if(*description_end!='|'){
|
||||
*error_message="invalid picture specification: not enough fields";
|
||||
return NULL;
|
||||
}
|
||||
p=description_end+1;
|
||||
if(*p!='|'){
|
||||
width=strtoul(p,&q,10);
|
||||
if(*q!='x'){
|
||||
*error_message=
|
||||
"invalid picture specification: can't parse resolution/color field";
|
||||
return NULL;
|
||||
}
|
||||
p=q+1;
|
||||
height=strtoul(p,&q,10);
|
||||
if(*q!='x'){
|
||||
*error_message=
|
||||
"invalid picture specification: can't parse resolution/color field";
|
||||
return NULL;
|
||||
}
|
||||
p=q+1;
|
||||
depth=strtoul(p,&q,10);
|
||||
if(*q=='/'){
|
||||
p=q+1;
|
||||
colors=strtoul(p,&q,10);
|
||||
}
|
||||
if(*q!='|'){
|
||||
*error_message=
|
||||
"invalid picture specification: can't parse resolution/color field";
|
||||
return NULL;
|
||||
}
|
||||
p=q;
|
||||
}
|
||||
filename=p+1;
|
||||
if(!is_url)picture_file=fopen(filename,"rb");
|
||||
}
|
||||
/*Buffer size: 8 static 4-byte fields plus 2 dynamic fields, plus the
|
||||
file/URL data.
|
||||
We reserve at least 10 bytes for the mime type, in case we still need to
|
||||
extract it from the file.*/
|
||||
data_offset=32+(description_end-description)+IMAX(mime_type_end-mime_type,10);
|
||||
buf=NULL;
|
||||
if(is_url){
|
||||
/*Easy case: just stick the URL at the end.
|
||||
We don't do anything to verify it's a valid URL.*/
|
||||
data_length=strlen(filename);
|
||||
cbuf=nbuf=data_offset+data_length;
|
||||
buf=(unsigned char *)malloc(cbuf);
|
||||
memcpy(buf+data_offset,filename,data_length);
|
||||
}
|
||||
else{
|
||||
ogg_uint32_t file_width;
|
||||
ogg_uint32_t file_height;
|
||||
ogg_uint32_t file_depth;
|
||||
ogg_uint32_t file_colors;
|
||||
int has_palette;
|
||||
/*Complicated case: we have a real file.
|
||||
Read it in, attempt to parse the mime type and image dimensions if
|
||||
necessary, and validate what the user passed in.*/
|
||||
if(picture_file==NULL){
|
||||
*error_message="error opening picture file";
|
||||
return NULL;
|
||||
}
|
||||
nbuf=data_offset;
|
||||
/*Add a reasonable starting image file size.*/
|
||||
cbuf=data_offset+65536;
|
||||
for(;;){
|
||||
unsigned char *new_buf;
|
||||
size_t nread;
|
||||
new_buf=realloc(buf,cbuf);
|
||||
if(new_buf==NULL){
|
||||
fclose(picture_file);
|
||||
free(buf);
|
||||
*error_message="insufficient memory";
|
||||
return NULL;
|
||||
}
|
||||
buf=new_buf;
|
||||
nread=fread(buf+nbuf,1,cbuf-nbuf,picture_file);
|
||||
nbuf+=nread;
|
||||
if(nbuf<cbuf){
|
||||
int error;
|
||||
error=ferror(picture_file);
|
||||
fclose(picture_file);
|
||||
if(error){
|
||||
free(buf);
|
||||
*error_message="error reading picture file";
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(cbuf==0xFFFFFFFF){
|
||||
fclose(picture_file);
|
||||
free(buf);
|
||||
*error_message="file too large";
|
||||
return NULL;
|
||||
}
|
||||
else if(cbuf>0x7FFFFFFFU)cbuf=0xFFFFFFFFU;
|
||||
else cbuf=cbuf<<1|1;
|
||||
}
|
||||
data_length=nbuf-data_offset;
|
||||
/*If there was no mimetype, try to extract it from the file data.*/
|
||||
if(mime_type_end==mime_type){
|
||||
if(is_jpeg(buf+data_offset,data_length)){
|
||||
mime_type="image/jpeg";
|
||||
mime_type_end=mime_type+10;
|
||||
}
|
||||
else if(is_png(buf+data_offset,data_length)){
|
||||
mime_type="image/png";
|
||||
mime_type_end=mime_type+9;
|
||||
}
|
||||
else if(is_gif(buf+data_offset,data_length)){
|
||||
mime_type="image/gif";
|
||||
mime_type_end=mime_type+9;
|
||||
}
|
||||
else{
|
||||
free(buf);
|
||||
*error_message="unable to guess MIME type from file, "
|
||||
"must set it explicitly";
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
/*Try to extract the image dimensions/color information from the file.*/
|
||||
file_width=file_height=file_depth=file_colors=0;
|
||||
has_palette=-1;
|
||||
if(mime_type_end-mime_type==9
|
||||
&&oi_strncasecmp("image/png",mime_type,mime_type_end-mime_type)==0){
|
||||
extract_png_params(buf+data_offset,data_length,
|
||||
&file_width,&file_height,&file_depth,&file_colors,&has_palette);
|
||||
}
|
||||
else if(mime_type_end-mime_type==9
|
||||
&&oi_strncasecmp("image/gif",mime_type,mime_type_end-mime_type)==0){
|
||||
extract_gif_params(buf+data_offset,data_length,
|
||||
&file_width,&file_height,&file_depth,&file_colors,&has_palette);
|
||||
}
|
||||
else if(mime_type_end-mime_type==10
|
||||
&&oi_strncasecmp("image/jpeg",mime_type,mime_type_end-mime_type)==0){
|
||||
extract_jpeg_params(buf+data_offset,data_length,
|
||||
&file_width,&file_height,&file_depth,&file_colors,&has_palette);
|
||||
}
|
||||
if(!width)width=file_width;
|
||||
if(!height)height=file_height;
|
||||
if(!depth)depth=file_depth;
|
||||
if(!colors)colors=file_colors;
|
||||
if((file_width&&width!=file_width)
|
||||
||(file_height&&height!=file_height)
|
||||
||(file_depth&&depth!=file_depth)
|
||||
/*We use has_palette to ensure we also reject non-0 user color counts for
|
||||
images we've positively identified as non-paletted.*/
|
||||
||(has_palette>=0&&colors!=file_colors)){
|
||||
free(buf);
|
||||
*error_message="invalid picture specification: "
|
||||
"resolution/color field does not match file";
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
/*These fields MUST be set correctly OR all set to zero.
|
||||
So if any of them (except colors, for which 0 is a valid value) are still
|
||||
zero, clear the rest to zero.*/
|
||||
if(width==0||height==0||depth==0)width=height=depth=colors=0;
|
||||
if(picture_type==1&&(width!=32||height!=32
|
||||
||mime_type_end-mime_type!=9
|
||||
||oi_strncasecmp("image/png",mime_type,mime_type_end-mime_type)!=0)){
|
||||
free(buf);
|
||||
*error_message="pictures of type 1 MUST be 32x32 PNGs";
|
||||
return NULL;
|
||||
}
|
||||
/*Build the METADATA_BLOCK_PICTURE buffer.
|
||||
We do this backwards from data_offset, because we didn't necessarily know
|
||||
how big the mime type string was before we read the data in.*/
|
||||
data_offset-=4;
|
||||
WRITE_U32_BE(buf+data_offset,(unsigned long)data_length);
|
||||
data_offset-=4;
|
||||
WRITE_U32_BE(buf+data_offset,colors);
|
||||
data_offset-=4;
|
||||
WRITE_U32_BE(buf+data_offset,depth);
|
||||
data_offset-=4;
|
||||
WRITE_U32_BE(buf+data_offset,height);
|
||||
data_offset-=4;
|
||||
WRITE_U32_BE(buf+data_offset,width);
|
||||
data_offset-=description_end-description;
|
||||
memcpy(buf+data_offset,description,description_end-description);
|
||||
data_offset-=4;
|
||||
WRITE_U32_BE(buf+data_offset,(unsigned long)(description_end-description));
|
||||
data_offset-=mime_type_end-mime_type;
|
||||
memcpy(buf+data_offset,mime_type,mime_type_end-mime_type);
|
||||
data_offset-=4;
|
||||
WRITE_U32_BE(buf+data_offset,(unsigned long)(mime_type_end-mime_type));
|
||||
data_offset-=4;
|
||||
WRITE_U32_BE(buf+data_offset,picture_type);
|
||||
data_length=nbuf-data_offset;
|
||||
b64_length=BASE64_LENGTH(data_length);
|
||||
out=(char *)malloc(b64_length+1);
|
||||
if(out!=NULL){
|
||||
base64_encode(out,(char *)buf+data_offset,data_length);
|
||||
if(picture_type>=1&&picture_type<=2)*seen_file_icons|=picture_type;
|
||||
}
|
||||
free(buf);
|
||||
return out;
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
#ifndef __PICTURE_H
|
||||
#define __PICTURE_H
|
||||
|
||||
#include <ogg/ogg.h>
|
||||
|
||||
typedef enum{
|
||||
PIC_FORMAT_JPEG,
|
||||
PIC_FORMAT_PNG,
|
||||
PIC_FORMAT_GIF
|
||||
}picture_format;
|
||||
|
||||
#define BASE64_LENGTH(len) (((len)+2)/3*4)
|
||||
|
||||
/*Utility function for base64 encoding METADATA_BLOCK_PICTURE tags.
|
||||
Stores BASE64_LENGTH(len)+1 bytes in dst (including a terminating NUL).*/
|
||||
void base64_encode(char *dst, const char *src, int len);
|
||||
|
||||
int oi_strncasecmp(const char *a, const char *b, int n);
|
||||
|
||||
int is_jpeg(const unsigned char *buf, size_t length);
|
||||
int is_png(const unsigned char *buf, size_t length);
|
||||
int is_gif(const unsigned char *buf, size_t length);
|
||||
|
||||
void extract_png_params(const unsigned char *data, size_t data_length,
|
||||
ogg_uint32_t *width, ogg_uint32_t *height,
|
||||
ogg_uint32_t *depth, ogg_uint32_t *colors,
|
||||
int *has_palette);
|
||||
void extract_gif_params(const unsigned char *data, size_t data_length,
|
||||
ogg_uint32_t *width, ogg_uint32_t *height,
|
||||
ogg_uint32_t *depth, ogg_uint32_t *colors,
|
||||
int *has_palette);
|
||||
void extract_jpeg_params(const unsigned char *data, size_t data_length,
|
||||
ogg_uint32_t *width, ogg_uint32_t *height,
|
||||
ogg_uint32_t *depth, ogg_uint32_t *colors,
|
||||
int *has_palette);
|
||||
|
||||
char *parse_picture_specification(const char *spec,
|
||||
const char **error_message,
|
||||
int *seen_file_icons);
|
||||
|
||||
#define WRITE_U32_BE(buf, val) \
|
||||
do{ \
|
||||
(buf)[0]=(unsigned char)((val)>>24); \
|
||||
(buf)[1]=(unsigned char)((val)>>16); \
|
||||
(buf)[2]=(unsigned char)((val)>>8); \
|
||||
(buf)[3]=(unsigned char)(val); \
|
||||
} \
|
||||
while(0);
|
||||
|
||||
#endif /* __PICTURE_H */
|
File diff suppressed because it is too large
Load diff
|
@ -1,152 +0,0 @@
|
|||
/* Copyright (C) 2007-2008 Jean-Marc Valin
|
||||
* Copyright (C) 2008 Thorvald Natvig
|
||||
*/
|
||||
/**
|
||||
@file resample_sse.h
|
||||
@brief Resampler functions (SSE version)
|
||||
*/
|
||||
/*
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <xmmintrin.h>
|
||||
|
||||
#define OVERRIDE_INNER_PRODUCT_SINGLE
|
||||
static inline float inner_product_single(const float *a, const float *b, unsigned int len)
|
||||
{
|
||||
int i;
|
||||
float ret;
|
||||
if (1)
|
||||
{
|
||||
__m128 sum = _mm_setzero_ps();
|
||||
for (i=0;i<len;i+=8)
|
||||
{
|
||||
sum = _mm_add_ps(sum, _mm_mul_ps(_mm_loadu_ps(a+i), _mm_loadu_ps(b+i)));
|
||||
sum = _mm_add_ps(sum, _mm_mul_ps(_mm_loadu_ps(a+i+4), _mm_loadu_ps(b+i+4)));
|
||||
}
|
||||
sum = _mm_add_ps(sum, _mm_movehl_ps(sum, sum));
|
||||
sum = _mm_add_ss(sum, _mm_shuffle_ps(sum, sum, 0x55));
|
||||
_mm_store_ss(&ret, sum);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = 0;
|
||||
for (i=0;i<len;i++) ret += a[i] * b[i];
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define OVERRIDE_INTERPOLATE_PRODUCT_SINGLE
|
||||
static inline float interpolate_product_single(const float *a, const float *b, unsigned int len, const spx_uint32_t oversample, float *frac) {
|
||||
int i;
|
||||
float ret;
|
||||
if (1)
|
||||
{
|
||||
__m128 sum = _mm_setzero_ps();
|
||||
__m128 f = _mm_loadu_ps(frac);
|
||||
for(i=0;i<len;i+=2)
|
||||
{
|
||||
sum = _mm_add_ps(sum, _mm_mul_ps(_mm_load1_ps(a+i), _mm_loadu_ps(b+i*oversample)));
|
||||
sum = _mm_add_ps(sum, _mm_mul_ps(_mm_load1_ps(a+i+1), _mm_loadu_ps(b+(i+1)*oversample)));
|
||||
}
|
||||
sum = _mm_mul_ps(f, sum);
|
||||
sum = _mm_add_ps(sum, _mm_movehl_ps(sum, sum));
|
||||
sum = _mm_add_ss(sum, _mm_shuffle_ps(sum, sum, 0x55));
|
||||
_mm_store_ss(&ret, sum);
|
||||
}
|
||||
else
|
||||
{
|
||||
float accum[4] = {0,0,0,0};
|
||||
for(i=0;i<len;i++)
|
||||
{
|
||||
const float curr_in=a[i];
|
||||
accum[0] += curr_in * b[i * oversample + 0];
|
||||
accum[1] += curr_in * b[i * oversample + 1];
|
||||
accum[2] += curr_in * b[i * oversample + 2];
|
||||
accum[3] += curr_in * b[i * oversample + 3];
|
||||
}
|
||||
ret = accum[0] * frac[0] + accum[1] * frac[1] + accum[2] * frac[2] + accum[3] * frac[3];
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef __SSE2__
|
||||
#include <emmintrin.h>
|
||||
#define OVERRIDE_INNER_PRODUCT_DOUBLE
|
||||
|
||||
static inline double inner_product_double(const float *a, const float *b, unsigned int len)
|
||||
{
|
||||
int i;
|
||||
double ret;
|
||||
__m128d sum = _mm_setzero_pd();
|
||||
__m128 t;
|
||||
for (i=0;i<len;i+=8)
|
||||
{
|
||||
t = _mm_mul_ps(_mm_loadu_ps(a+i), _mm_loadu_ps(b+i));
|
||||
sum = _mm_add_pd(sum, _mm_cvtps_pd(t));
|
||||
sum = _mm_add_pd(sum, _mm_cvtps_pd(_mm_movehl_ps(t, t)));
|
||||
|
||||
t = _mm_mul_ps(_mm_loadu_ps(a+i+4), _mm_loadu_ps(b+i+4));
|
||||
sum = _mm_add_pd(sum, _mm_cvtps_pd(t));
|
||||
sum = _mm_add_pd(sum, _mm_cvtps_pd(_mm_movehl_ps(t, t)));
|
||||
}
|
||||
sum = _mm_add_sd(sum, (__m128d) _mm_movehl_ps((__m128) sum, (__m128) sum));
|
||||
_mm_store_sd(&ret, sum);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define OVERRIDE_INTERPOLATE_PRODUCT_DOUBLE
|
||||
static inline double interpolate_product_double(const float *a, const float *b, unsigned int len, const spx_uint32_t oversample, float *frac) {
|
||||
int i;
|
||||
double ret;
|
||||
__m128d sum;
|
||||
__m128d sum1 = _mm_setzero_pd();
|
||||
__m128d sum2 = _mm_setzero_pd();
|
||||
__m128 f = _mm_loadu_ps(frac);
|
||||
__m128d f1 = _mm_cvtps_pd(f);
|
||||
__m128d f2 = _mm_cvtps_pd(_mm_movehl_ps(f,f));
|
||||
__m128 t;
|
||||
for(i=0;i<len;i+=2)
|
||||
{
|
||||
t = _mm_mul_ps(_mm_load1_ps(a+i), _mm_loadu_ps(b+i*oversample));
|
||||
sum1 = _mm_add_pd(sum1, _mm_cvtps_pd(t));
|
||||
sum2 = _mm_add_pd(sum2, _mm_cvtps_pd(_mm_movehl_ps(t, t)));
|
||||
|
||||
t = _mm_mul_ps(_mm_load1_ps(a+i+1), _mm_loadu_ps(b+(i+1)*oversample));
|
||||
sum1 = _mm_add_pd(sum1, _mm_cvtps_pd(t));
|
||||
sum2 = _mm_add_pd(sum2, _mm_cvtps_pd(_mm_movehl_ps(t, t)));
|
||||
}
|
||||
sum1 = _mm_mul_pd(f1, sum1);
|
||||
sum2 = _mm_mul_pd(f2, sum2);
|
||||
sum = _mm_add_pd(sum1, sum2);
|
||||
sum = _mm_add_sd(sum, (__m128d) _mm_movehl_ps((__m128) sum, (__m128) sum));
|
||||
_mm_store_sd(&ret, sum);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,344 +0,0 @@
|
|||
/* Copyright (C) 2007 Jean-Marc Valin
|
||||
|
||||
File: speex_resampler.h
|
||||
Resampling code
|
||||
|
||||
The design goals of this code are:
|
||||
- Very fast algorithm
|
||||
- Low memory requirement
|
||||
- Good *perceptual* quality (and not best SNR)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SPEEX_RESAMPLER_H
|
||||
#define SPEEX_RESAMPLER_H
|
||||
|
||||
#ifdef OUTSIDE_SPEEX
|
||||
|
||||
/********* WARNING: MENTAL SANITY ENDS HERE *************/
|
||||
|
||||
/* If the resampler is defined outside of Speex, we change the symbol names so that
|
||||
there won't be any clash if linking with Speex later on. */
|
||||
|
||||
/* #define RANDOM_PREFIX your software name here */
|
||||
#ifndef RANDOM_PREFIX
|
||||
#error "Please define RANDOM_PREFIX (above) to something specific to your project to prevent symbol name clashes"
|
||||
#endif
|
||||
|
||||
#define CAT_PREFIX2(a,b) a ## b
|
||||
#define CAT_PREFIX(a,b) CAT_PREFIX2(a, b)
|
||||
|
||||
#define speex_resampler_init CAT_PREFIX(RANDOM_PREFIX,_resampler_init)
|
||||
#define speex_resampler_init_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_init_frac)
|
||||
#define speex_resampler_destroy CAT_PREFIX(RANDOM_PREFIX,_resampler_destroy)
|
||||
#define speex_resampler_process_float CAT_PREFIX(RANDOM_PREFIX,_resampler_process_float)
|
||||
#define speex_resampler_process_int CAT_PREFIX(RANDOM_PREFIX,_resampler_process_int)
|
||||
#define speex_resampler_process_interleaved_float CAT_PREFIX(RANDOM_PREFIX,_resampler_process_interleaved_float)
|
||||
#define speex_resampler_process_interleaved_int CAT_PREFIX(RANDOM_PREFIX,_resampler_process_interleaved_int)
|
||||
#define speex_resampler_set_rate CAT_PREFIX(RANDOM_PREFIX,_resampler_set_rate)
|
||||
#define speex_resampler_get_rate CAT_PREFIX(RANDOM_PREFIX,_resampler_get_rate)
|
||||
#define speex_resampler_set_rate_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_set_rate_frac)
|
||||
#define speex_resampler_get_ratio CAT_PREFIX(RANDOM_PREFIX,_resampler_get_ratio)
|
||||
#define speex_resampler_set_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_set_quality)
|
||||
#define speex_resampler_get_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_get_quality)
|
||||
#define speex_resampler_set_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_input_stride)
|
||||
#define speex_resampler_get_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_stride)
|
||||
#define speex_resampler_set_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_output_stride)
|
||||
#define speex_resampler_get_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_stride)
|
||||
#define speex_resampler_get_input_latency CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_latency)
|
||||
#define speex_resampler_get_output_latency CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_latency)
|
||||
#define speex_resampler_skip_zeros CAT_PREFIX(RANDOM_PREFIX,_resampler_skip_zeros)
|
||||
#define speex_resampler_reset_mem CAT_PREFIX(RANDOM_PREFIX,_resampler_reset_mem)
|
||||
#define speex_resampler_strerror CAT_PREFIX(RANDOM_PREFIX,_resampler_strerror)
|
||||
|
||||
#define spx_int16_t short
|
||||
#define spx_int32_t int
|
||||
#define spx_uint16_t unsigned short
|
||||
#define spx_uint32_t unsigned int
|
||||
|
||||
#else /* OUTSIDE_SPEEX */
|
||||
|
||||
#ifdef _BUILD_SPEEX
|
||||
# include "speex_types.h"
|
||||
#else
|
||||
# include <speex/speex_types.h>
|
||||
#endif
|
||||
|
||||
#endif /* OUTSIDE_SPEEX */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SPEEX_RESAMPLER_QUALITY_MAX 10
|
||||
#define SPEEX_RESAMPLER_QUALITY_MIN 0
|
||||
#define SPEEX_RESAMPLER_QUALITY_DEFAULT 4
|
||||
#define SPEEX_RESAMPLER_QUALITY_VOIP 3
|
||||
#define SPEEX_RESAMPLER_QUALITY_DESKTOP 5
|
||||
|
||||
enum {
|
||||
RESAMPLER_ERR_SUCCESS = 0,
|
||||
RESAMPLER_ERR_ALLOC_FAILED = 1,
|
||||
RESAMPLER_ERR_BAD_STATE = 2,
|
||||
RESAMPLER_ERR_INVALID_ARG = 3,
|
||||
RESAMPLER_ERR_PTR_OVERLAP = 4,
|
||||
|
||||
RESAMPLER_ERR_MAX_ERROR
|
||||
};
|
||||
|
||||
struct SpeexResamplerState_;
|
||||
typedef struct SpeexResamplerState_ SpeexResamplerState;
|
||||
|
||||
/** Create a new resampler with integer input and output rates.
|
||||
* @param nb_channels Number of channels to be processed
|
||||
* @param in_rate Input sampling rate (integer number of Hz).
|
||||
* @param out_rate Output sampling rate (integer number of Hz).
|
||||
* @param quality Resampling quality between 0 and 10, where 0 has poor quality
|
||||
* and 10 has very high quality.
|
||||
* @return Newly created resampler state
|
||||
* @retval NULL Error: not enough memory
|
||||
*/
|
||||
SpeexResamplerState *speex_resampler_init(spx_uint32_t nb_channels,
|
||||
spx_uint32_t in_rate,
|
||||
spx_uint32_t out_rate,
|
||||
int quality,
|
||||
int *err);
|
||||
|
||||
/** Create a new resampler with fractional input/output rates. The sampling
|
||||
* rate ratio is an arbitrary rational number with both the numerator and
|
||||
* denominator being 32-bit integers.
|
||||
* @param nb_channels Number of channels to be processed
|
||||
* @param ratio_num Numerator of the sampling rate ratio
|
||||
* @param ratio_den Denominator of the sampling rate ratio
|
||||
* @param in_rate Input sampling rate rounded to the nearest integer (in Hz).
|
||||
* @param out_rate Output sampling rate rounded to the nearest integer (in Hz).
|
||||
* @param quality Resampling quality between 0 and 10, where 0 has poor quality
|
||||
* and 10 has very high quality.
|
||||
* @return Newly created resampler state
|
||||
* @retval NULL Error: not enough memory
|
||||
*/
|
||||
SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels,
|
||||
spx_uint32_t ratio_num,
|
||||
spx_uint32_t ratio_den,
|
||||
spx_uint32_t in_rate,
|
||||
spx_uint32_t out_rate,
|
||||
int quality,
|
||||
int *err);
|
||||
|
||||
/** Destroy a resampler state.
|
||||
* @param st Resampler state
|
||||
*/
|
||||
void speex_resampler_destroy(SpeexResamplerState *st);
|
||||
|
||||
/** Resample a float array. The input and output buffers must *not* overlap.
|
||||
* @param st Resampler state
|
||||
* @param channel_index Index of the channel to process for the multi-channel
|
||||
* base (0 otherwise)
|
||||
* @param in Input buffer
|
||||
* @param in_len Number of input samples in the input buffer. Returns the
|
||||
* number of samples processed
|
||||
* @param out Output buffer
|
||||
* @param out_len Size of the output buffer. Returns the number of samples written
|
||||
*/
|
||||
int speex_resampler_process_float(SpeexResamplerState *st,
|
||||
spx_uint32_t channel_index,
|
||||
const float *in,
|
||||
spx_uint32_t *in_len,
|
||||
float *out,
|
||||
spx_uint32_t *out_len);
|
||||
|
||||
/** Resample an int array. The input and output buffers must *not* overlap.
|
||||
* @param st Resampler state
|
||||
* @param channel_index Index of the channel to process for the multi-channel
|
||||
* base (0 otherwise)
|
||||
* @param in Input buffer
|
||||
* @param in_len Number of input samples in the input buffer. Returns the number
|
||||
* of samples processed
|
||||
* @param out Output buffer
|
||||
* @param out_len Size of the output buffer. Returns the number of samples written
|
||||
*/
|
||||
int speex_resampler_process_int(SpeexResamplerState *st,
|
||||
spx_uint32_t channel_index,
|
||||
const spx_int16_t *in,
|
||||
spx_uint32_t *in_len,
|
||||
spx_int16_t *out,
|
||||
spx_uint32_t *out_len);
|
||||
|
||||
/** Resample an interleaved float array. The input and output buffers must *not* overlap.
|
||||
* @param st Resampler state
|
||||
* @param in Input buffer
|
||||
* @param in_len Number of input samples in the input buffer. Returns the number
|
||||
* of samples processed. This is all per-channel.
|
||||
* @param out Output buffer
|
||||
* @param out_len Size of the output buffer. Returns the number of samples written.
|
||||
* This is all per-channel.
|
||||
*/
|
||||
int speex_resampler_process_interleaved_float(SpeexResamplerState *st,
|
||||
const float *in,
|
||||
spx_uint32_t *in_len,
|
||||
float *out,
|
||||
spx_uint32_t *out_len);
|
||||
|
||||
/** Resample an interleaved int array. The input and output buffers must *not* overlap.
|
||||
* @param st Resampler state
|
||||
* @param in Input buffer
|
||||
* @param in_len Number of input samples in the input buffer. Returns the number
|
||||
* of samples processed. This is all per-channel.
|
||||
* @param out Output buffer
|
||||
* @param out_len Size of the output buffer. Returns the number of samples written.
|
||||
* This is all per-channel.
|
||||
*/
|
||||
int speex_resampler_process_interleaved_int(SpeexResamplerState *st,
|
||||
const spx_int16_t *in,
|
||||
spx_uint32_t *in_len,
|
||||
spx_int16_t *out,
|
||||
spx_uint32_t *out_len);
|
||||
|
||||
/** Set (change) the input/output sampling rates (integer value).
|
||||
* @param st Resampler state
|
||||
* @param in_rate Input sampling rate (integer number of Hz).
|
||||
* @param out_rate Output sampling rate (integer number of Hz).
|
||||
*/
|
||||
int speex_resampler_set_rate(SpeexResamplerState *st,
|
||||
spx_uint32_t in_rate,
|
||||
spx_uint32_t out_rate);
|
||||
|
||||
/** Get the current input/output sampling rates (integer value).
|
||||
* @param st Resampler state
|
||||
* @param in_rate Input sampling rate (integer number of Hz) copied.
|
||||
* @param out_rate Output sampling rate (integer number of Hz) copied.
|
||||
*/
|
||||
void speex_resampler_get_rate(SpeexResamplerState *st,
|
||||
spx_uint32_t *in_rate,
|
||||
spx_uint32_t *out_rate);
|
||||
|
||||
/** Set (change) the input/output sampling rates and resampling ratio
|
||||
* (fractional values in Hz supported).
|
||||
* @param st Resampler state
|
||||
* @param ratio_num Numerator of the sampling rate ratio
|
||||
* @param ratio_den Denominator of the sampling rate ratio
|
||||
* @param in_rate Input sampling rate rounded to the nearest integer (in Hz).
|
||||
* @param out_rate Output sampling rate rounded to the nearest integer (in Hz).
|
||||
*/
|
||||
int speex_resampler_set_rate_frac(SpeexResamplerState *st,
|
||||
spx_uint32_t ratio_num,
|
||||
spx_uint32_t ratio_den,
|
||||
spx_uint32_t in_rate,
|
||||
spx_uint32_t out_rate);
|
||||
|
||||
/** Get the current resampling ratio. This will be reduced to the least
|
||||
* common denominator.
|
||||
* @param st Resampler state
|
||||
* @param ratio_num Numerator of the sampling rate ratio copied
|
||||
* @param ratio_den Denominator of the sampling rate ratio copied
|
||||
*/
|
||||
void speex_resampler_get_ratio(SpeexResamplerState *st,
|
||||
spx_uint32_t *ratio_num,
|
||||
spx_uint32_t *ratio_den);
|
||||
|
||||
/** Set (change) the conversion quality.
|
||||
* @param st Resampler state
|
||||
* @param quality Resampling quality between 0 and 10, where 0 has poor
|
||||
* quality and 10 has very high quality.
|
||||
*/
|
||||
int speex_resampler_set_quality(SpeexResamplerState *st,
|
||||
int quality);
|
||||
|
||||
/** Get the conversion quality.
|
||||
* @param st Resampler state
|
||||
* @param quality Resampling quality between 0 and 10, where 0 has poor
|
||||
* quality and 10 has very high quality.
|
||||
*/
|
||||
void speex_resampler_get_quality(SpeexResamplerState *st,
|
||||
int *quality);
|
||||
|
||||
/** Set (change) the input stride.
|
||||
* @param st Resampler state
|
||||
* @param stride Input stride
|
||||
*/
|
||||
void speex_resampler_set_input_stride(SpeexResamplerState *st,
|
||||
spx_uint32_t stride);
|
||||
|
||||
/** Get the input stride.
|
||||
* @param st Resampler state
|
||||
* @param stride Input stride copied
|
||||
*/
|
||||
void speex_resampler_get_input_stride(SpeexResamplerState *st,
|
||||
spx_uint32_t *stride);
|
||||
|
||||
/** Set (change) the output stride.
|
||||
* @param st Resampler state
|
||||
* @param stride Output stride
|
||||
*/
|
||||
void speex_resampler_set_output_stride(SpeexResamplerState *st,
|
||||
spx_uint32_t stride);
|
||||
|
||||
/** Get the output stride.
|
||||
* @param st Resampler state copied
|
||||
* @param stride Output stride
|
||||
*/
|
||||
void speex_resampler_get_output_stride(SpeexResamplerState *st,
|
||||
spx_uint32_t *stride);
|
||||
|
||||
/** Get the latency introduced by the resampler measured in input samples.
|
||||
* @param st Resampler state
|
||||
*/
|
||||
int speex_resampler_get_input_latency(SpeexResamplerState *st);
|
||||
|
||||
/** Get the latency introduced by the resampler measured in output samples.
|
||||
* @param st Resampler state
|
||||
*/
|
||||
int speex_resampler_get_output_latency(SpeexResamplerState *st);
|
||||
|
||||
/** Make sure that the first samples to go out of the resamplers don't have
|
||||
* leading zeros. This is only useful before starting to use a newly created
|
||||
* resampler. It is recommended to use that when resampling an audio file, as
|
||||
* it will generate a file with the same length. For real-time processing,
|
||||
* it is probably easier not to use this call (so that the output duration
|
||||
* is the same for the first frame).
|
||||
* @param st Resampler state
|
||||
*/
|
||||
int speex_resampler_skip_zeros(SpeexResamplerState *st);
|
||||
|
||||
/** Reset a resampler so a new (unrelated) stream can be processed.
|
||||
* @param st Resampler state
|
||||
*/
|
||||
int speex_resampler_reset_mem(SpeexResamplerState *st);
|
||||
|
||||
/** Returns the English meaning for an error code
|
||||
* @param err Error code
|
||||
* @return English string
|
||||
*/
|
||||
const char *speex_resampler_strerror(int err);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,116 +0,0 @@
|
|||
/* Copyright (C) 2002 Jean-Marc Valin */
|
||||
/**
|
||||
@file stack_alloc.h
|
||||
@brief Temporary memory allocation on stack
|
||||
*/
|
||||
/*
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef STACK_ALLOC_H
|
||||
#define STACK_ALLOC_H
|
||||
|
||||
#ifdef WIN32
|
||||
# include <malloc.h>
|
||||
# ifndef alloca
|
||||
# define alloca(_x) _alloca(_x);
|
||||
# endif
|
||||
#else
|
||||
#ifdef HAVE_ALLOCA_H
|
||||
# include <alloca.h>
|
||||
# else
|
||||
# include <stdlib.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def ALIGN(stack, size)
|
||||
*
|
||||
* Aligns the stack to a 'size' boundary
|
||||
*
|
||||
* @param stack Stack
|
||||
* @param size New size boundary
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def PUSH(stack, size, type)
|
||||
*
|
||||
* Allocates 'size' elements of type 'type' on the stack
|
||||
*
|
||||
* @param stack Stack
|
||||
* @param size Number of elements
|
||||
* @param type Type of element
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def VARDECL(var)
|
||||
*
|
||||
* Declare variable on stack
|
||||
*
|
||||
* @param var Variable to declare
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def ALLOC(var, size, type)
|
||||
*
|
||||
* Allocate 'size' elements of 'type' on stack
|
||||
*
|
||||
* @param var Name of variable to allocate
|
||||
* @param size Number of elements
|
||||
* @param type Type of element
|
||||
*/
|
||||
|
||||
#ifdef ENABLE_VALGRIND
|
||||
|
||||
#include <valgrind/memcheck.h>
|
||||
|
||||
#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
|
||||
|
||||
#define PUSH(stack, size, type) (VALGRIND_MAKE_NOACCESS(stack, 1000),ALIGN((stack),sizeof(type)),VALGRIND_MAKE_WRITABLE(stack, ((size)*sizeof(type))),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))
|
||||
|
||||
#else
|
||||
|
||||
#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
|
||||
|
||||
#define PUSH(stack, size, type) (ALIGN((stack),sizeof(type)),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(VAR_ARRAYS)
|
||||
#define VARDECL(var)
|
||||
#define ALLOC(var, size, type) type var[size]
|
||||
#elif defined(USE_ALLOCA)
|
||||
#define VARDECL(var) var
|
||||
#define ALLOC(var, size, type) var = alloca(sizeof(type)*(size))
|
||||
#else
|
||||
#define VARDECL(var) var
|
||||
#define ALLOC(var, size, type) var = PUSH(stack, size, type)
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
|
@ -1,141 +0,0 @@
|
|||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: wav_io.c
|
||||
Routines to handle wav (RIFF) headers
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "wav_io.h"
|
||||
#include "opus_header.h"
|
||||
|
||||
/* Adjust the stream->channel mapping to ensure the proper output order for
|
||||
WAV files. */
|
||||
void adjust_wav_mapping(int mapping_family, int channels, unsigned char *stream_map)
|
||||
{
|
||||
unsigned char new_stream_map[8];
|
||||
int i;
|
||||
/* If we aren't using one of the defined semantic channel maps, or we have
|
||||
more channels than we know what to do with, use a default 1-1 mapping. */
|
||||
if(mapping_family != 1 || channels > 8)
|
||||
return;
|
||||
for(i = 0; i < channels; i++)
|
||||
{
|
||||
new_stream_map[wav_permute_matrix[channels-1][i]] = stream_map[i];
|
||||
}
|
||||
memcpy(stream_map, new_stream_map, channels*sizeof(*stream_map));
|
||||
}
|
||||
|
||||
static size_t fwrite_le32(opus_int32 i32, FILE *file)
|
||||
{
|
||||
unsigned char buf[4];
|
||||
buf[0]=(unsigned char)(i32&0xFF);
|
||||
buf[1]=(unsigned char)(i32>>8&0xFF);
|
||||
buf[2]=(unsigned char)(i32>>16&0xFF);
|
||||
buf[3]=(unsigned char)(i32>>24&0xFF);
|
||||
return fwrite(buf,4,1,file);
|
||||
}
|
||||
|
||||
static size_t fwrite_le16(int i16, FILE *file)
|
||||
{
|
||||
unsigned char buf[2];
|
||||
buf[0]=(unsigned char)(i16&0xFF);
|
||||
buf[1]=(unsigned char)(i16>>8&0xFF);
|
||||
return fwrite(buf,2,1,file);
|
||||
}
|
||||
|
||||
int write_wav_header(FILE *file, int rate, int mapping_family, int channels, int fp)
|
||||
{
|
||||
int ret;
|
||||
int extensible;
|
||||
|
||||
/* Multichannel files require a WAVEFORMATEXTENSIBLE header to declare the
|
||||
proper channel meanings. */
|
||||
extensible = mapping_family == 1 && 3 <= channels && channels <= 8;
|
||||
|
||||
/* >16 bit audio also requires WAVEFORMATEXTENSIBLE. */
|
||||
extensible |= fp;
|
||||
|
||||
ret = fprintf (file, "RIFF") >= 0;
|
||||
ret &= fwrite_le32 (0x7fffffff, file);
|
||||
|
||||
ret &= fprintf (file, "WAVEfmt ") >= 0;
|
||||
ret &= fwrite_le32 (extensible ? 40 : 16, file);
|
||||
ret &= fwrite_le16 (extensible ? 0xfffe : (fp?3:1), file);
|
||||
ret &= fwrite_le16 (channels, file);
|
||||
ret &= fwrite_le32 (rate, file);
|
||||
ret &= fwrite_le32 ((fp?4:2)*channels*rate, file);
|
||||
ret &= fwrite_le16 ((fp?4:2)*channels, file);
|
||||
ret &= fwrite_le16 (fp?32:16, file);
|
||||
|
||||
if(extensible)
|
||||
{
|
||||
static const unsigned char ksdataformat_subtype_pcm[16]=
|
||||
{
|
||||
0x01, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
0x10, 0x00,
|
||||
0x80, 0x00,
|
||||
0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71
|
||||
};
|
||||
static const unsigned char ksdataformat_subtype_float[16]=
|
||||
{
|
||||
0x03, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
0x10, 0x00,
|
||||
0x80, 0x00,
|
||||
0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71
|
||||
};
|
||||
static const int wav_channel_masks[8] =
|
||||
{
|
||||
1, /* 1.0 mono */
|
||||
1|2, /* 2.0 stereo */
|
||||
1|2|4, /* 3.0 channel ('wide') stereo */
|
||||
1|2|16|32, /* 4.0 discrete quadrophonic */
|
||||
1|2|4|16|32, /* 5.0 */
|
||||
1|2|4|8|16|32, /* 5.1 */
|
||||
1|2|4|8|256|512|1024, /* 6.1 */
|
||||
1|2|4|8|16|32|512|1024, /* 7.1 */
|
||||
};
|
||||
ret &= fwrite_le16 (22, file);
|
||||
ret &= fwrite_le16 (fp?32:16, file);
|
||||
ret &= fwrite_le32 (wav_channel_masks[channels-1], file);
|
||||
if (!fp)
|
||||
{
|
||||
ret &= fwrite (ksdataformat_subtype_pcm, 16, 1, file);
|
||||
} else {
|
||||
ret &= fwrite (ksdataformat_subtype_float, 16, 1, file);
|
||||
}
|
||||
}
|
||||
|
||||
ret &= fprintf (file, "data") >= 0;
|
||||
ret &= fwrite_le32 (0x7fffffff, file);
|
||||
|
||||
return !ret ? -1 : extensible ? 40 : 16;
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: wav_io.h
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef WAV_IO_H
|
||||
#define WAV_IO_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <opus_types.h>
|
||||
|
||||
#if !defined(__LITTLE_ENDIAN__) && ( defined(WORDS_BIGENDIAN) || defined(__BIG_ENDIAN__) )
|
||||
#define le_short(s) ((short) ((unsigned short) (s) << 8) | ((unsigned short) (s) >> 8))
|
||||
#define be_short(s) ((short) (s))
|
||||
#else
|
||||
#define le_short(s) ((short) (s))
|
||||
#define be_short(s) ((short) ((unsigned short) (s) << 8) | ((unsigned short) (s) >> 8))
|
||||
#endif
|
||||
|
||||
/** Convert little endian */
|
||||
static inline opus_int32 le_int(opus_int32 i)
|
||||
{
|
||||
#if !defined(__LITTLE_ENDIAN__) && ( defined(WORDS_BIGENDIAN) || defined(__BIG_ENDIAN__) )
|
||||
opus_uint32 ui, ret;
|
||||
ui = i;
|
||||
ret = ui>>24;
|
||||
ret |= (ui>>8)&0x0000ff00;
|
||||
ret |= (ui<<8)&0x00ff0000;
|
||||
ret |= (ui<<24);
|
||||
return ret;
|
||||
#else
|
||||
return i;
|
||||
#endif
|
||||
}
|
||||
|
||||
void adjust_wav_mapping(int mapping_family, int channels, unsigned char *stream_map);
|
||||
|
||||
int write_wav_header(FILE *file, int rate, int mapping_family, int channels, int fp);
|
||||
|
||||
#endif
|
|
@ -1,223 +0,0 @@
|
|||
/* Copyright (c) 2002, John Edwards
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
/* Set TABS = 4 */
|
||||
/********************************************************************
|
||||
|
||||
function: To provide playback of 16 bit PCM wave data in Win32
|
||||
environments from decoded compressed files.
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#if defined WIN32 || defined _WIN32
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include "wave_out.h"
|
||||
|
||||
#define MAXWAVESIZE 4294967040LU
|
||||
#define MAX_WAVEBLOCKS 32
|
||||
|
||||
// This is modified for USE_WIN_AUDIO - ONLY 2002-02-27
|
||||
|
||||
|
||||
static CRITICAL_SECTION cs;
|
||||
static HWAVEOUT dev = NULL;
|
||||
static unsigned ScheduledBlocks = 0;
|
||||
static int PlayedWaveHeadersCount = 0; // free index
|
||||
static WAVEHDR* PlayedWaveHeaders [MAX_WAVEBLOCKS];
|
||||
|
||||
static int
|
||||
Box ( const char* msg )
|
||||
{
|
||||
MessageBox ( NULL, msg, " "PACKAGE_NAME" "PACKAGE_VERSION": Error Message . . .", MB_OK | MB_ICONEXCLAMATION );
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This function registers already played WAVE chunks. Freeing is done by free_memory(),
|
||||
*/
|
||||
|
||||
static void CALLBACK
|
||||
wave_callback ( HWAVE hWave, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 )
|
||||
{
|
||||
(void) hWave;
|
||||
(void) dwInstance;
|
||||
(void) dwParam2;
|
||||
if ( uMsg == WOM_DONE ) {
|
||||
EnterCriticalSection ( &cs );
|
||||
PlayedWaveHeaders [PlayedWaveHeadersCount++] = (WAVEHDR*) dwParam1;
|
||||
LeaveCriticalSection ( &cs );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
free_memory ( void )
|
||||
{
|
||||
WAVEHDR* wh;
|
||||
HGLOBAL hg;
|
||||
|
||||
EnterCriticalSection ( &cs );
|
||||
wh = PlayedWaveHeaders [--PlayedWaveHeadersCount];
|
||||
ScheduledBlocks--; // decrease the number of USED blocks
|
||||
LeaveCriticalSection ( &cs );
|
||||
|
||||
waveOutUnprepareHeader ( dev, wh, sizeof (WAVEHDR) );
|
||||
|
||||
hg = GlobalHandle ( wh -> lpData ); // Deallocate the buffer memory
|
||||
GlobalUnlock (hg);
|
||||
GlobalFree (hg);
|
||||
|
||||
hg = GlobalHandle ( wh ); // Deallocate the header memory
|
||||
GlobalUnlock (hg);
|
||||
GlobalFree (hg);
|
||||
}
|
||||
|
||||
|
||||
Int
|
||||
Set_WIN_Params ( FILE_T dummyFile ,
|
||||
Ldouble SampleFreq,
|
||||
Uint BitsPerSample,
|
||||
Uint Channels )
|
||||
{
|
||||
WAVEFORMATEX outFormat;
|
||||
UINT deviceID = WAVE_MAPPER;
|
||||
|
||||
(void) dummyFile;
|
||||
|
||||
if ( waveOutGetNumDevs () == 0 )
|
||||
return Box ( "No audio device present." );
|
||||
|
||||
outFormat.wFormatTag = WAVE_FORMAT_PCM;
|
||||
outFormat.wBitsPerSample = BitsPerSample;
|
||||
outFormat.nChannels = Channels;
|
||||
outFormat.nSamplesPerSec = (unsigned long)(SampleFreq + 0.5);
|
||||
outFormat.nBlockAlign = (outFormat.wBitsPerSample + 7) / 8 * outFormat.nChannels;
|
||||
outFormat.nAvgBytesPerSec = outFormat.nSamplesPerSec * outFormat.nBlockAlign;
|
||||
|
||||
switch ( waveOutOpen ( &dev, deviceID, &outFormat, (DWORD_PTR)wave_callback, 0, CALLBACK_FUNCTION ) )
|
||||
{
|
||||
case MMSYSERR_ALLOCATED: return Box ( "Device is already open." );
|
||||
case MMSYSERR_BADDEVICEID: return Box ( "The specified device is out of range." );
|
||||
case MMSYSERR_NODRIVER: return Box ( "There is no audio driver in this system." );
|
||||
case MMSYSERR_NOMEM: return Box ( "Unable to allocate sound memory." );
|
||||
case WAVERR_BADFORMAT: return Box ( "This audio format is not supported." );
|
||||
case WAVERR_SYNC: return Box ( "The device is synchronous." );
|
||||
default: return Box ( "Unknown media error." );
|
||||
case MMSYSERR_NOERROR: break;
|
||||
}
|
||||
|
||||
waveOutReset ( dev );
|
||||
InitializeCriticalSection ( &cs );
|
||||
SetPriorityClass ( GetCurrentProcess (), HIGH_PRIORITY_CLASS );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
WIN_Play_Samples ( const void* data, size_t len )
|
||||
{
|
||||
HGLOBAL hg;
|
||||
HGLOBAL hg2;
|
||||
LPWAVEHDR wh;
|
||||
void* allocptr;
|
||||
|
||||
do {
|
||||
while ( PlayedWaveHeadersCount > 0 ) // free used blocks ...
|
||||
free_memory ();
|
||||
|
||||
if ( ScheduledBlocks < sizeof(PlayedWaveHeaders)/sizeof(*PlayedWaveHeaders) ) // wait for a free block ...
|
||||
break;
|
||||
Sleep (26);
|
||||
} while (1);
|
||||
|
||||
if ( (hg2 = GlobalAlloc ( GMEM_MOVEABLE, len )) == NULL ) // allocate some memory for a copy of the buffer
|
||||
return Box ( "GlobalAlloc failed." );
|
||||
|
||||
allocptr = GlobalLock (hg2);
|
||||
CopyMemory ( allocptr, data, len ); // Here we can call any modification output functions we want....
|
||||
|
||||
if ( (hg = GlobalAlloc (GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof (WAVEHDR))) == NULL ) // now make a header and WRITE IT!
|
||||
return -1;
|
||||
|
||||
wh = GlobalLock (hg);
|
||||
wh -> dwBufferLength = len;
|
||||
wh -> lpData = allocptr;
|
||||
|
||||
if ( waveOutPrepareHeader ( dev, wh, sizeof (WAVEHDR)) != MMSYSERR_NOERROR ) {
|
||||
GlobalUnlock (hg);
|
||||
GlobalFree (hg);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( waveOutWrite ( dev, wh, sizeof (WAVEHDR)) != MMSYSERR_NOERROR ) {
|
||||
GlobalUnlock (hg);
|
||||
GlobalFree (hg);
|
||||
return -1;
|
||||
}
|
||||
|
||||
EnterCriticalSection ( &cs );
|
||||
ScheduledBlocks++;
|
||||
LeaveCriticalSection ( &cs );
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
WIN_Audio_close ( void )
|
||||
{
|
||||
if ( dev != NULL ) {
|
||||
|
||||
while ( ScheduledBlocks > 0 ) {
|
||||
Sleep (ScheduledBlocks);
|
||||
while ( PlayedWaveHeadersCount > 0 ) // free used blocks ...
|
||||
free_memory ();
|
||||
}
|
||||
|
||||
waveOutReset (dev); // reset the device
|
||||
waveOutClose (dev); // close the device
|
||||
dev = NULL;
|
||||
}
|
||||
|
||||
DeleteCriticalSection ( &cs );
|
||||
ScheduledBlocks = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* end of wave_out.c */
|
|
@ -1,60 +0,0 @@
|
|||
/* Copyright (c) 2002, John Edwards
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// WAVE_OUT.H - Necessary stuff for WIN_AUDIO
|
||||
|
||||
#ifndef WAVE_OUT_H
|
||||
#define WAVE_OUT_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#ifdef __MINGW32__
|
||||
#include <mmsystem.h>
|
||||
#endif
|
||||
|
||||
//// constants /////////////////////////////////////////////////////
|
||||
|
||||
#define SAMPLE_SIZE 16
|
||||
#define FILE_T FILE*
|
||||
#define INVALID_FILEDESC NULL
|
||||
|
||||
//// Simple types //////////////////////////////////////////////////
|
||||
|
||||
typedef signed int Int; // at least -32767...+32767, fast type
|
||||
typedef unsigned int Uint; // at least 0...65535, fast type
|
||||
typedef long double Ldouble; // most exact floating point format
|
||||
|
||||
//// procedures/functions //////////////////////////////////////////
|
||||
// wave_out.c
|
||||
Int Set_WIN_Params ( FILE_T dummyFile , Ldouble SampleFreq, Uint BitsPerSample, Uint Channels);
|
||||
int WIN_Play_Samples ( const void* buff, size_t len );
|
||||
int WIN_Audio_close ( void );
|
||||
|
||||
#endif /* WAVE_OUT_H */
|
|
@ -1,21 +0,0 @@
|
|||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#define OUTSIDE_SPEEX 1
|
||||
#define OPUSTOOLS 1
|
||||
|
||||
#define inline __inline
|
||||
#define alloca _alloca
|
||||
#define getpid _getpid
|
||||
#define USE_ALLOCA 1
|
||||
#define FLOATING_POINT 1
|
||||
#define SPX_RESAMPLE_EXPORT
|
||||
#define __SSE__
|
||||
|
||||
#define RANDOM_PREFIX foo
|
||||
|
||||
#define PACKAGE_NAME "opus-tools"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
#endif /* CONFIG_H */
|
|
@ -1,17 +0,0 @@
|
|||
@echo off
|
||||
|
||||
for /f %%v in ('git describe --tags --match "v*" --always') do set version=%%v
|
||||
|
||||
set version_out=#define %2 "%version%"
|
||||
|
||||
echo %version_out% > %1_temp
|
||||
|
||||
echo n | comp %1_temp %1 > NUL 2> NUL
|
||||
|
||||
if not errorlevel 1 goto exit
|
||||
|
||||
copy /y %1_temp %1
|
||||
|
||||
:exit
|
||||
|
||||
del %1_temp
|
|
@ -1,197 +0,0 @@
|
|||
/* Copyright (c) 2004-2012 LoRd_MuldeR <mulder2@gmx.de>
|
||||
File: unicode_support.c
|
||||
|
||||
This file was originally part of a patch included with LameXP,
|
||||
released under the same license as the original audio tools.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64
|
||||
|
||||
#include "unicode_support.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <io.h>
|
||||
|
||||
static UINT g_old_output_cp = ((UINT)-1);
|
||||
|
||||
char *utf16_to_utf8(const wchar_t *input)
|
||||
{
|
||||
char *Buffer;
|
||||
int BuffSize = 0, Result = 0;
|
||||
|
||||
BuffSize = WideCharToMultiByte(CP_UTF8, 0, input, -1, NULL, 0, NULL, NULL);
|
||||
Buffer = (char*) malloc(sizeof(char) * BuffSize);
|
||||
if(Buffer)
|
||||
{
|
||||
Result = WideCharToMultiByte(CP_UTF8, 0, input, -1, Buffer, BuffSize, NULL, NULL);
|
||||
}
|
||||
|
||||
return ((Result > 0) && (Result <= BuffSize)) ? Buffer : NULL;
|
||||
}
|
||||
|
||||
char *utf16_to_ansi(const wchar_t *input)
|
||||
{
|
||||
char *Buffer;
|
||||
int BuffSize = 0, Result = 0;
|
||||
|
||||
BuffSize = WideCharToMultiByte(CP_ACP, 0, input, -1, NULL, 0, NULL, NULL);
|
||||
Buffer = (char*) malloc(sizeof(char) * BuffSize);
|
||||
if(Buffer)
|
||||
{
|
||||
Result = WideCharToMultiByte(CP_ACP, 0, input, -1, Buffer, BuffSize, NULL, NULL);
|
||||
}
|
||||
|
||||
return ((Result > 0) && (Result <= BuffSize)) ? Buffer : NULL;
|
||||
}
|
||||
|
||||
wchar_t *utf8_to_utf16(const char *input)
|
||||
{
|
||||
wchar_t *Buffer;
|
||||
int BuffSize = 0, Result = 0;
|
||||
|
||||
BuffSize = MultiByteToWideChar(CP_UTF8, 0, input, -1, NULL, 0);
|
||||
Buffer = (wchar_t*) malloc(sizeof(wchar_t) * BuffSize);
|
||||
if(Buffer)
|
||||
{
|
||||
Result = MultiByteToWideChar(CP_UTF8, 0, input, -1, Buffer, BuffSize);
|
||||
}
|
||||
|
||||
return ((Result > 0) && (Result <= BuffSize)) ? Buffer : NULL;
|
||||
}
|
||||
|
||||
void init_commandline_arguments_utf8(int *argc, char ***argv)
|
||||
{
|
||||
int i, nArgs;
|
||||
LPWSTR *szArglist;
|
||||
|
||||
szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
|
||||
|
||||
if(NULL == szArglist)
|
||||
{
|
||||
fprintf(stderr, "\nFATAL: CommandLineToArgvW failed\n\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
*argv = (char**) malloc(sizeof(char*) * nArgs);
|
||||
*argc = nArgs;
|
||||
|
||||
if(NULL == *argv)
|
||||
{
|
||||
fprintf(stderr, "\nFATAL: Malloc failed\n\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
for(i = 0; i < nArgs; i++)
|
||||
{
|
||||
(*argv)[i] = utf16_to_utf8(szArglist[i]);
|
||||
if(NULL == (*argv)[i])
|
||||
{
|
||||
fprintf(stderr, "\nFATAL: utf16_to_utf8 failed\n\n");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
LocalFree(szArglist);
|
||||
}
|
||||
|
||||
void free_commandline_arguments_utf8(int *argc, char ***argv)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
if(*argv != NULL)
|
||||
{
|
||||
for(i = 0; i < *argc; i++)
|
||||
{
|
||||
if((*argv)[i] != NULL)
|
||||
{
|
||||
free((*argv)[i]);
|
||||
(*argv)[i] = NULL;
|
||||
}
|
||||
}
|
||||
free(*argv);
|
||||
*argv = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
FILE *fopen_utf8(const char *filename_utf8, const char *mode_utf8)
|
||||
{
|
||||
FILE *ret = NULL;
|
||||
wchar_t *filename_utf16 = utf8_to_utf16(filename_utf8);
|
||||
wchar_t *mode_utf16 = utf8_to_utf16(mode_utf8);
|
||||
|
||||
if(filename_utf16 && mode_utf16)
|
||||
{
|
||||
ret = _wfopen(filename_utf16, mode_utf16);
|
||||
}
|
||||
|
||||
if(filename_utf16) free(filename_utf16);
|
||||
if(mode_utf16) free(mode_utf16);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int stat_utf8(const char *path_utf8, struct _stat *buf)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
wchar_t *path_utf16 = utf8_to_utf16(path_utf8);
|
||||
if(path_utf16)
|
||||
{
|
||||
ret = _wstat(path_utf16, buf);
|
||||
free(path_utf16);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int unlink_utf8(const char *path_utf8)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
wchar_t *path_utf16 = utf8_to_utf16(path_utf8);
|
||||
if(path_utf16)
|
||||
{
|
||||
ret = _wunlink(path_utf16);
|
||||
free(path_utf16);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void init_console_utf8(void)
|
||||
{
|
||||
g_old_output_cp = GetConsoleOutputCP();
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
}
|
||||
|
||||
void uninit_console_utf8(void)
|
||||
{
|
||||
if(g_old_output_cp != ((UINT)-1))
|
||||
{
|
||||
SetConsoleOutputCP(g_old_output_cp);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,49 +0,0 @@
|
|||
/* Copyright (c) 2004-2012 LoRd_MuldeR <mulder2@gmx.de>
|
||||
File: unicode_support.h
|
||||
|
||||
This file was originally part of a patch included with LameXP,
|
||||
released under the same license as the original audio tools.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef UNICODE_SUPPORT_H_INCLUDED
|
||||
#define UNICODE_SUPPORT_H_INCLUDED
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define WIN_UNICODE 1
|
||||
|
||||
char *utf16_to_utf8(const wchar_t *input);
|
||||
char *utf16_to_ansi(const wchar_t *input);
|
||||
wchar_t *utf8_to_utf16(const char *input);
|
||||
void init_commandline_arguments_utf8(int *argc, char ***argv);
|
||||
void free_commandline_arguments_utf8(int *argc, char ***argv);
|
||||
FILE *fopen_utf8(const char *filename_utf8, const char *mode_utf8);
|
||||
int stat_utf8(const char *path_utf8, struct _stat *buf);
|
||||
int unlink_utf8(const char *path_utf8);
|
||||
void init_console_utf8(void);
|
||||
void uninit_console_utf8(void);
|
||||
|
||||
#endif
|
|
@ -1 +0,0 @@
|
|||
#define PACKAGE_VERSION "v0.1.9"
|
Loading…
Reference in a new issue