зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central to fx-team
This commit is contained in:
Коммит
eb879b9526
|
@ -17,3 +17,11 @@ OS_LIBS += [
|
|||
'ole32',
|
||||
'oleaut32',
|
||||
]
|
||||
|
||||
# The Windows MIDL code generator creates things like:
|
||||
#
|
||||
# #endif !_MIDL_USE_GUIDDEF_
|
||||
#
|
||||
# which clang-cl complains about. MSVC doesn't, so turn this warning off.
|
||||
if CONFIG['CLANG_CL']:
|
||||
CXXFLAGS += ['-Wno-extra-tokens']
|
||||
|
|
|
@ -25,3 +25,11 @@ OS_LIBS += [
|
|||
'rpcrt4',
|
||||
'oleaut32',
|
||||
]
|
||||
|
||||
# The Windows MIDL code generator creates things like:
|
||||
#
|
||||
# #endif !_MIDL_USE_GUIDDEF_
|
||||
#
|
||||
# which clang-cl complains about. MSVC doesn't, so turn this warning off.
|
||||
if CONFIG['CLANG_CL']:
|
||||
CFLAGS += ['-Wno-extra-tokens']
|
||||
|
|
|
@ -50,4 +50,12 @@ FINAL_LIBRARY = 'xul'
|
|||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
# The Windows MIDL code generator creates things like:
|
||||
#
|
||||
# #endif !_MIDL_USE_GUIDDEF_
|
||||
#
|
||||
# which clang-cl complains about. MSVC doesn't, so turn this warning off.
|
||||
if CONFIG['CLANG_CL']:
|
||||
CXXFLAGS += ['-Wno-extra-tokens']
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
|
|
@ -59,6 +59,14 @@ LOCAL_INCLUDES += [
|
|||
'/layout/style',
|
||||
]
|
||||
|
||||
# The Windows MIDL code generator creates things like:
|
||||
#
|
||||
# #endif !_MIDL_USE_GUIDDEF_
|
||||
#
|
||||
# which clang-cl complains about. MSVC doesn't, so turn this warning off.
|
||||
if CONFIG['CLANG_CL']:
|
||||
CXXFLAGS += ['-Wno-extra-tokens']
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
|
|
@ -62,6 +62,11 @@ body.content-loaded > #installing {
|
|||
animation-timing-function: linear;
|
||||
}
|
||||
|
||||
#titlebar-buttonbox {
|
||||
margin: 6px 7px;
|
||||
-moz-appearance: -moz-window-button-box;
|
||||
}
|
||||
|
||||
@keyframes throbber{
|
||||
from {
|
||||
transform: scale(0);
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
<h1 id="placeholder">wtf mac os!</h1>
|
||||
#endif
|
||||
#else
|
||||
<div id="titlebar-buttonbox"></div>
|
||||
<div id="installing">
|
||||
<div class="throbber"></div>
|
||||
<div class="message"></div>
|
||||
|
|
|
@ -0,0 +1,195 @@
|
|||
<?xml version="1.0" ?><manifest>
|
||||
<!--
|
||||
Remotes
|
||||
-->
|
||||
<!--original fetch url was https://android.googlesource.com/-->
|
||||
<remote fetch="https://git.mozilla.org/external/aosp" name="aosp"/>
|
||||
<!--original fetch url was git://github.com/apitrace/-->
|
||||
<remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
|
||||
<!--original fetch url was git://github.com/mozilla-b2g/-->
|
||||
<remote fetch="https://git.mozilla.org/b2g" name="b2g"/>
|
||||
<!--original fetch url was https://git.mozilla.org/b2g-->
|
||||
<remote fetch="https://git.mozilla.org/b2g" name="b2gmozilla"/>
|
||||
<!--original fetch url was git://codeaurora.org/-->
|
||||
<remote fetch="https://git.mozilla.org/external/caf" name="caf"/>
|
||||
<!--original fetch url was http://android.git.linaro.org/git-ro/-->
|
||||
<remote fetch="https://git.mozilla.org/external/linaro" name="linaro"/>
|
||||
<!--original fetch url was git://github.com/mozilla/-->
|
||||
<remote fetch="https://git.mozilla.org/b2g" name="mozilla"/>
|
||||
<!--original fetch url was https://git.mozilla.org/releases-->
|
||||
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
|
||||
<!--
|
||||
B2G repositories for all targets
|
||||
-->
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="3c97d6a8ac5a69662e1e2c22a84ea59bf50c305e"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
<!-- B2G specific things. -->
|
||||
<project name="platform_build" path="build" remote="b2g" revision="be4b291a90b371b41b62ade68c31ad173bb87baa">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8b76e208f3ba77f26017122fe9661d2221028f7a"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="0f86914b89cf8a069533e66b218533a17bad6b43"/>
|
||||
<project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" revision="6b1fb5b730b1299f99f9194c1fcf088579cc7977"/>
|
||||
<project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.8" revision="755656d9a7c79c6463920ad13f95d71e45e21397"/>
|
||||
<project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8" revision="ad086223028d281b2ea95f0f42f23ff4435917dd"/>
|
||||
<project groups="pdk,linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6" revision="94d88f335cdc90bf43471bacf243006e99cff908"/>
|
||||
<project groups="pdk,linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8" revision="ac160a43fddd833d4a0bc430f44f8b1956bac1e9"/>
|
||||
<project groups="pdk,linux,x86" name="platform/prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.8" path="prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.8" revision="966dbeff106bf36966d4c80a4f2c58a464ae314e"/>
|
||||
<project groups="linux" name="platform/prebuilts/python/linux-x86/2.7.5" path="prebuilts/python/linux-x86/2.7.5" revision="accd992f11a8ec0a0ec52cdc891302dc54e2941e"/>
|
||||
<project name="device/common" path="device/common" revision="cf1543ff569188c1df9f4e9c7fa53b75393c49e3"/>
|
||||
<project name="device/sample" path="device/sample" revision="3bbddd699b3e093a664aae7d9a63032b798b561b"/>
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="870adeafa39f8cb4bec108e35638bb1c36fc648a"/>
|
||||
<project name="platform/bionic" path="bionic" revision="060309e1369e7aa394d720fbc0703d5e20a60391"/>
|
||||
<project name="platform/bootable/recovery" path="bootable/recovery" revision="ac9bafa97733238b0f8538d1f28e9a01d2931fa1"/>
|
||||
<project name="platform/external/aac" path="external/aac" revision="925c65e2186ed3f33d26e85d1471a1b5f18b1bfa"/>
|
||||
<project name="platform/external/bison" path="external/bison" revision="ba6887d58129c3cba6f181942943709f6250471f"/>
|
||||
<project name="platform/external/bluetooth/bluedroid" path="external/bluetooth/bluedroid" revision="7456378c0ebfac007506decf0d187b747b70affd"/>
|
||||
<project name="platform/external/bsdiff" path="external/bsdiff" revision="ef2f916f26550b6d2684c5f96ef404deb24060e8"/>
|
||||
<project name="platform/external/bzip2" path="external/bzip2" revision="34b2cdaab634bcd1bd2f01130573a7833771df70"/>
|
||||
<project name="platform/external/checkpolicy" path="external/checkpolicy" revision="cb2e70cd69a05cdfffa00825ed2f944789bbf95f"/>
|
||||
<project name="platform/external/clang" path="external/clang" revision="eeb154f1b498998e77261475909c28aa6f61377e"/>
|
||||
<project name="platform/external/compiler-rt" path="external/compiler-rt" revision="c87fcb2428a26ae69a2f7110c73ac08bafb652d7"/>
|
||||
<project name="platform/external/dhcpcd" path="external/dhcpcd" revision="ffae58641836bb1c19b340b70ed4c625e0171a5d"/>
|
||||
<project name="platform/external/dnsmasq" path="external/dnsmasq" revision="9d46bf92e0953655ca81c8b02ae5007dc67bd920"/>
|
||||
<project name="platform/external/e2fsprogs" path="external/e2fsprogs" revision="c31df77fe0064ca3d16676be2cfa04362c14a01d"/>
|
||||
<project name="platform/external/elfutils" path="external/elfutils" revision="a4e81ae7683f1b49f35f4cf3936ad9a9e4a54231"/>
|
||||
<project name="platform/external/expat" path="external/expat" revision="f5fef24959803e65738cf96a91b4153cddcd3bf6"/>
|
||||
<project name="platform/external/f2fs-tools" path="external/f2fs-tools" revision="fc24ac8347630a14d62ffafa93a27ec3b81cc44b"/>
|
||||
<project name="platform/external/fdlibm" path="external/fdlibm" revision="0447a94e59aaad84ba9606bd7ef5bab525c356c3"/>
|
||||
<project name="platform/external/flac" path="external/flac" revision="e15b8e8f7ee9af14f048c8bee8875583453a4259"/>
|
||||
<project name="platform/external/freetype" path="external/freetype" revision="8276a1e4822384a763ee5a239352e815858802e9"/>
|
||||
<project name="platform/external/gcc-demangle" path="external/gcc-demangle" revision="408f3ac7a9a3716c8198a04305d0132816ba02ad"/>
|
||||
<project name="platform/external/genext2fs" path="external/genext2fs" revision="d1420472b31fab33fb23dd16197fdc6c1a056d4c"/>
|
||||
<project name="platform/external/giflib" path="external/giflib" revision="c06fa3137c3c990f281400007f1426789e882a6f"/>
|
||||
<project name="platform/external/gtest" path="external/gtest" revision="4b4c07cf16bc2a0e915be8acbd1947d4cca4dcab"/>
|
||||
<project name="platform/external/harfbuzz_ng" path="external/harfbuzz_ng" revision="001e8c6dd3a1aa77d4449b66b5cd5e00a158481b"/>
|
||||
<project name="platform/external/icu" path="external/icu" revision="3667975ba9c170a65c66666c019c8256ccc047bf"/>
|
||||
<project name="platform/external/iproute2" path="external/iproute2" revision="2b9c711e59817efcf487b790cd95d441ce434b45"/>
|
||||
<project name="platform/external/ipsec-tools" path="external/ipsec-tools" revision="8c1adaedd11540df5647f19c9ab5bc81fa614548"/>
|
||||
<project name="platform/external/iptables" path="external/iptables" revision="38e301e24878e82cf6a4f0fbcd920cbe7270ff13"/>
|
||||
<project name="platform/external/jack" path="external/jack" revision="72d913b877f04598204bfac6cce1ab96a193d058"/>
|
||||
<project name="platform/external/jemalloc" path="external/jemalloc" revision="768ad4c9555dca6dafd147c7c00920eedddd3969"/>
|
||||
<project name="platform/external/jhead" path="external/jhead" revision="e55f218242ffd89d0a76ba1dee11a2a439d233c5"/>
|
||||
<project name="platform/external/jpeg" path="external/jpeg" revision="06ff2ef8790692b2a8d11eceb145d8723c77b622"/>
|
||||
<project name="platform/external/jsmn" path="external/jsmn" revision="7af4b7e6369d6afc276da699bd41251d2398e350"/>
|
||||
<project name="platform/external/jsoncpp" path="external/jsoncpp" revision="6e813c30f660b10f430e7f600799ae1379a287dc"/>
|
||||
<project name="platform/external/junit" path="external/junit" revision="61fcf385c1b65ef439c5664adda77b9cfa0e8118"/>
|
||||
<project name="platform/external/libcxxabi" path="external/libcxxabi" revision="96c4e7bce0f0e710cf5c0c6f2557f142a6ebed27"/>
|
||||
<project name="platform/external/libcxx" path="external/libcxx" revision="3c2d8389b6c83fc5d88111aae64c527e903e73c7"/>
|
||||
<project name="platform/external/libgsm" path="external/libgsm" revision="f107553887fbb8ed03b7bd8f6318d1bc4489fee4"/>
|
||||
<project name="platform/external/liblzf" path="external/liblzf" revision="c57cd8d9318259f8f85fa5ceaa6327ec9c7b0296"/>
|
||||
<project name="platform/external/libnfc-nxp" path="external/libnfc-nxp" revision="057646515e2d6dffec80bbbabddc706689fb12e3"/>
|
||||
<project name="platform/external/libnl" path="external/libnl" revision="103740e4486e7aa783323f4b9b1b3f596c858b30"/>
|
||||
<project name="platform/external/libogg" path="external/libogg" revision="921a239234786023cdade5d6b222a7c88068b61d"/>
|
||||
<project name="platform/external/libopus" path="external/libopus" revision="2b6e63f8fe19a481e3577d6de764855198493ea4"/>
|
||||
<project name="platform/external/libpcap" path="external/libpcap" revision="f391e622e30509cd1731152aab61511e82969236"/>
|
||||
<project name="platform/external/libpng" path="external/libpng" revision="72d906de7515609342498f5e45c81282b1302448"/>
|
||||
<project name="platform/external/libselinux" path="external/libselinux" revision="6472342ee6c171882891d2f644b88eef55c9ebc3"/>
|
||||
<project name="platform/external/libsepol" path="external/libsepol" revision="9eb69f1e70aa80a1ccc00242c634fcf2a424b06a"/>
|
||||
<project name="platform/external/libunwind" path="external/libunwind" revision="989888043cdaf966b8b86853910aa19165e5194e"/>
|
||||
<project name="platform/external/libvpx" path="external/libvpx" revision="052edf77a2149d108bfa5e6ca88adf26c6950bd7"/>
|
||||
<project name="platform/external/llvm" path="external/llvm" revision="00b16d2275a2305137a2afca1479cc4077aad2e5"/>
|
||||
<project name="platform/external/mdnsresponder" path="external/mdnsresponder" revision="49f160bbaea5d855bddfa22a7d61a29fb6e736f9"/>
|
||||
<project name="platform/external/mksh" path="external/mksh" revision="be73b929515f8e4a59e979a5372bc192e1324ece"/>
|
||||
<project name="platform/external/netcat" path="external/netcat" revision="5bc44d564f09695b89e713afaeee09fc07ecd182"/>
|
||||
<project name="platform/external/openssl" path="external/openssl" revision="d8a69d6b9f960c068ce5d375875e3c8609a1f405"/>
|
||||
<project name="platform/external/pcre" path="external/pcre" revision="74befec51e20f2e31ae4a11f7e992dbeb6be8bd9"/>
|
||||
<project name="platform/external/protobuf" path="external/protobuf" revision="8cd15d4980ba1b4dc2a05cc3e5bf48bfabaa14ea"/>
|
||||
<project name="platform/external/safe-iop" path="external/safe-iop" revision="ba3ac916708940cc761318c57e8efe4cd73af400"/>
|
||||
<project name="platform/external/scrypt" path="external/scrypt" revision="4059b5c88404bc81350bb37b23fca35ea3c97179"/>
|
||||
<project name="platform/external/sfntly" path="external/sfntly" revision="9656ee1e46a5ad61c569c2e70e94187be52cebe6"/>
|
||||
<project name="platform/external/skia" path="external/skia" revision="14cd31a0bafabdc222e9beaccfb6162a312d6e90"/>
|
||||
<project name="platform/external/sonivox" path="external/sonivox" revision="dc512141dae4ef69e470a64d0cfbf412277aa0b3"/>
|
||||
<project name="platform/external/speex" path="external/speex" revision="f26fe68d1400a503a71b55728e9ba43b5bf8f65f"/>
|
||||
<project name="platform/external/sqlite" path="external/sqlite" revision="8bf2eb40ff5dd0a6724d493eb997d99a2e07e20f"/>
|
||||
<project name="platform/external/stlport" path="external/stlport" revision="76e06e090244f1960bdd48f1109613ea4cf05884"/>
|
||||
<project name="platform/external/strace" path="external/strace" revision="b2dc0fc24db579b0fedf26e89a1a466b2c9a32e2"/>
|
||||
<project name="platform/external/svox" path="external/svox" revision="7c3164643a2115617581d34bb9f9612f0e0173bf"/>
|
||||
<project name="platform/external/tagsoup" path="external/tagsoup" revision="7d489e3f8f2c5463d334de9cc74bdce271a1886d"/>
|
||||
<project name="platform/external/tcpdump" path="external/tcpdump" revision="75b33a817a0c62278c6099c47985f8704e7d9232"/>
|
||||
<project name="platform/external/tinyalsa" path="external/tinyalsa" revision="8fbb1a592beafe2de3ddbdcac78ffcd96df5e383"/>
|
||||
<project name="platform/external/tinycompress" path="external/tinycompress" revision="82c0b2c653987ff4280be7b14d1f0c1d89eba4c9"/>
|
||||
<project name="platform/external/tinyxml2" path="external/tinyxml2" revision="de52ec2164bb14fba7ae01ac8f0167212b8c741f"/>
|
||||
<project name="platform/external/tinyxml" path="external/tinyxml" revision="0d3f3eb780888334c9d87d22d5595f313395f8d6"/>
|
||||
<project name="platform/external/tremolo" path="external/tremolo" revision="1d89e41830bf268fca6b4a797ea30a96d84a84fb"/>
|
||||
<project name="platform/external/webp" path="external/webp" revision="5ac894de5df4345a26e006d4f73acb422ea9d814"/>
|
||||
<project name="platform/external/webrtc" path="external/webrtc" revision="333fb8884c0467f06ad956b3e52ff1169b822eb0"/>
|
||||
<project name="platform/external/yaffs2" path="external/yaffs2" revision="0f5965cfdf082b9e329d543e2a49d229dccf0050"/>
|
||||
<project name="platform/external/zlib" path="external/zlib" revision="d0f3ac473d9d1356ce175cffc3c2a33c2fbda006"/>
|
||||
<project name="platform/external/zopfli" path="external/zopfli" revision="546647ec998acbaa06124ee57b826257b6530905"/>
|
||||
<project name="platform/frameworks/native" path="frameworks/native" revision="0951e44a56a7721c26d82fdc1d4c8c05f83f6496"/>
|
||||
<project name="platform/frameworks/opt/emoji" path="frameworks/opt/emoji" revision="d9f0fe12f016cd8105dfd110cd2209db725e035a"/>
|
||||
<project name="platform/hardware/libhardware_legacy" path="hardware/libhardware_legacy" revision="f5cec8be8143538003c4cdc84a3bc4973e70adec"/>
|
||||
<project name="platform/libcore" path="libcore" revision="42e5c65efd528e3d360ecf147016af8f51abe679"/>
|
||||
<project name="platform/libnativehelper" path="libnativehelper" revision="1c07d779580f3db10a7f96fba387968bf2783e28"/>
|
||||
<project name="platform/ndk" path="ndk" revision="2f78ff38973c8e8e89dc28915fe637ea185b102e"/>
|
||||
<project name="platform_prebuilts_misc" path="prebuilts/misc" remote="b2g" revision="25b96077aeae7bd0e3a5e7c284fb636664337013"/>
|
||||
<project name="platform/prebuilts/ndk" path="prebuilts/ndk" revision="3881c90cec9a89b1b1e13c97af537647dcf63c71"/>
|
||||
<project name="platform/prebuilts/sdk" path="prebuilts/sdk" revision="a259bbcab27bb60bb75b16bce581549c724954cc"/>
|
||||
<project name="platform/prebuilts/tools" path="prebuilts/tools" revision="a6dda1861aee67e18947fee510e4e85f8c1ffeb7"/>
|
||||
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="bb356d6505f914347690c8143dbd03af427dd07e"/>
|
||||
<project name="platform/system/extras" path="system/extras" revision="7eb50bad98466762626ae1dd31df2acd77202c06"/>
|
||||
<project name="platform_system_libfdio" path="system/libfdio" remote="b2g" revision="34adfb400e031f3dd3353d92413572db5e3a7376"/>
|
||||
<project name="platform/system/media" path="system/media" revision="9de34d557017fe115051fbbd49f05564de6ba3de"/>
|
||||
<project name="platform/system/netd" path="system/netd" revision="313c71603fbfa643ff5f62f4fb3c26aa4696435c"/>
|
||||
<project name="platform/system/security" path="system/security" revision="7c9f4ee469a965f119e302a39f00004d8c59bc6b"/>
|
||||
<project name="platform/system/vold" path="system/vold" revision="d4435cf658bc391a5dc85d4973b38e5b9ada92fc"/>
|
||||
<project name="platform_frameworks_av" path="frameworks/av" remote="b2g" revision="479a404164986b3e95212eecdae7e67da4fba9ed"/>
|
||||
<project name="platform_frameworks_base" path="frameworks/base" remote="b2g" revision="10592803994aa01fa3dc0d0bd36d0d29f006d779"/>
|
||||
<project name="platform_frameworks_wilhelm" path="frameworks/wilhelm" remote="b2g" revision="174bb44bb9af7583e6337e1e1b6cc18d0217ae82"/>
|
||||
<project name="platform_system_core" path="system/core" remote="b2g" revision="1b8322b228f717ff2a4d48fa8b44240d8e3f62bc"/>
|
||||
<project name="platform_external_sepolicy" path="external/sepolicy" remote="b2g" revision="246c603d9fe181fa8893af7293dbc63e870fe5e0"/>
|
||||
<default remote="caf" revision="refs/tags/android-5.1.1_r29" sync-j="4"/>
|
||||
<!-- Platform common things -->
|
||||
<project name="platform/external/libxml2" path="external/libxml2" revision="d0fea31601c5a47c1327515a1ed1d81c4d3586cf"/>
|
||||
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="60a2b840daa7e877d7aec9c08909a17b72095d10"/>
|
||||
<project name="platform/hardware/broadcom/wlan" path="hardware/broadcom/wlan" revision="0e5baccde90f60ab248a1aedd1f50bff0ba224d9"/>
|
||||
<project name="platform/hardware/qcom/bt" path="hardware/qcom/bt" remote="caf" revision="d2b071c3683bace40c9ed666107367dac5a5bb45"/>
|
||||
<project name="platform/hardware/qcom/audio" path="hardware/qcom/audio" revision="4225df42ce215c0b46c7bd5a59a03f0c85c1d06c"/>
|
||||
<project name="platform/hardware/qcom/gps" path="hardware/qcom/gps" revision="b299e214bf810b2b29a3cdcf872f8de09595845f"/>
|
||||
<project name="platform/hardware/qcom/media" path="hardware/qcom/media" revision="0a774fd3bfc78cf03ca10d436255d0120c49a068"/>
|
||||
<project name="platform/hardware/qcom/wlan" path="hardware/qcom/wlan" revision="82d8c482d59926ff27c53f1fcc8a0ce3554e5491"/>
|
||||
<project name="platform/hardware/ril" path="hardware/ril" revision="4782b037af55a8d61078305df6a4c31c1424623c"/>
|
||||
<project name="platform_external_libnfc-nci" path="external/libnfc-nci" remote="b2g" revision="cac2be832f7bf748d8f0de7eac93009ef7c2eea9"/>
|
||||
<project name="hardware_qcom_display" path="hardware/qcom/display" remote="b2g" revision="288427e047fcdadba1b907fc886bf1142e1f646e"/>
|
||||
<project name="platform_hardware_broadcom_libbt" path="hardware/broadcom/libbt" remote="b2g" revision="c927f10590b39bfe35976e01aed0969afeed3ba8"/>
|
||||
<project name="platform_hardware_libhardware" path="hardware/libhardware" remote="b2g" revision="c4bdd7888f2ab3069f6f8853915a806ebd390320"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="5f4b68c799927b6e078f987b12722c3a6ccd4a45"/>
|
||||
<!--
|
||||
<project name="platform/hardware/qcom/camera" path="hardware/qcom/camera" revision="l_LNX.LA.3.6"/>
|
||||
-->
|
||||
<!-- Sony platform specific things -->
|
||||
<project name="codeaurora_kernel_msm" path="kernel" remote="b2g" revision="831789c04366336dd35ce0678f02656c1476d6d7"/>
|
||||
<project name="device-qcom-sepolicy" path="device/qcom/sepolicy" remote="b2g" revision="e0a1cce6a8559ccc88e15da148531d36e18ae5f7"/>
|
||||
<project name="android_external_busybox" path="external/busybox" remote="b2g" revision="757a15c84e7bf9897b908058f2e529fcffea73b8"/>
|
||||
<project groups="device" name="init_sh" path="hardware/sony/init_sh" remote="b2g" revision="58d94ebe3a2e9a1af4bc8c003cd6837e53cc4867"/>
|
||||
<project groups="device" name="macaddrsetup" path="hardware/sony/macaddrsetup" remote="b2g" revision="e7ee149283eaec32a525ee39b2ecdca46d502e77"/>
|
||||
<project groups="device" name="mkqcdtbootimg" path="hardware/sony/mkqcdtbootimg" remote="b2g" revision="4badb288cefe7cc708450c02fd4f6cab84c3ed98"/>
|
||||
<project groups="device" name="thermanager" path="hardware/sony/thermanager" remote="b2g" revision="ec9a2b6a7fe8254ecc3c2c4781e7304f3822e390"/>
|
||||
<project groups="device" name="timekeep" path="hardware/sony/timekeep" remote="b2g" revision="4cbb0abc00681f116f043584661307b5c4855a31"/>
|
||||
<!-- Shinano platform specific things -->
|
||||
<project groups="device" name="device-sony-shinano" path="device/sony/shinano" remote="b2g" revision="fdc22f74b2271dfcfba1e7191b83257b5a2b1343"/>
|
||||
<project groups="device" name="device-sony-aries" path="device/sony/aries" remote="b2g" revision="56f665a19e35623d923949014bc15013d292fa37"/>
|
||||
<project groups="device" name="device-sony-leo" path="device/sony/leo" remote="b2g" revision="3fdec3f02117be6b57d2f9c5946119f179119a51"/>
|
||||
<project groups="device" name="device-sony-scorpion" path="device/sony/scorpion" remote="b2g" revision="b0cd32cb805637d2afda61b67d0421e2c39b2ffa"/>
|
||||
<project groups="device" name="device-sony-sirius" path="device/sony/sirius" remote="b2g" revision="5e5c19c6cd7c042bcac41a2b30b3ad3eeb66e7ab"/>
|
||||
<!-- Rhine platform specific things -->
|
||||
<project groups="device" name="device-sony-rhine" path="device/sony/rhine" remote="b2g" revision="236bfcab94371ca7056dab2dab15b77a6f9fa1b3"/>
|
||||
<project groups="device" name="device-sony-honami" path="device/sony/honami" remote="b2g" revision="f8a9d6d3a2ce73d336453b71db591a82f72a2120"/>
|
||||
<project groups="device" name="device-sony-amami" path="device/sony/amami" remote="b2g" revision="9f05cdc34e60df19fcd9189ff8a14f752dcf07b9"/>
|
||||
<!-- Yukon platform specific things -->
|
||||
<project name="device-sony-yukon" path="device/sony/yukon" remote="b2g" revision="054306b53d6a9c85c6276fea625c3dfb55ac38c3"/>
|
||||
<project name="device-sony-tianchi" path="device/sony/tianchi" remote="b2g" revision="571afbafe2abf52e031c2484f38ca5f6f81a114a"/>
|
||||
<project name="device-sony-eagle" path="device/sony/eagle" remote="b2g" revision="b253fa75f0eeea10a1fa747fd98deb80ec71a654"/>
|
||||
<project name="device-sony-flamingo" path="device/sony/flamingo" remote="b2g" revision="44fb20f16a9b1a44af6109dbfad2a975ca29fece"/>
|
||||
<project name="device-sony-seagull" path="device/sony/seagull" remote="b2g" revision="666810a3b77df8cd7a5e68e3d041052b6dd8cd22"/>
|
||||
</manifest>
|
|
@ -21,7 +21,7 @@
|
|||
<!--
|
||||
B2G repositories for all targets
|
||||
-->
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="260e51a4262f75341e037e583dfc8f6835b5ab31"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="3c97d6a8ac5a69662e1e2c22a84ea59bf50c305e"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
|
@ -35,7 +35,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5e96ed318db1ba8037eb402724bc052240ac9e05"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8b76e208f3ba77f26017122fe9661d2221028f7a"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<!--
|
||||
B2G repositories for all targets
|
||||
-->
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="260e51a4262f75341e037e583dfc8f6835b5ab31"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="3c97d6a8ac5a69662e1e2c22a84ea59bf50c305e"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
|
@ -35,7 +35,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5e96ed318db1ba8037eb402724bc052240ac9e05"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8b76e208f3ba77f26017122fe9661d2221028f7a"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<!--
|
||||
B2G repositories for all targets
|
||||
-->
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="260e51a4262f75341e037e583dfc8f6835b5ab31"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="3c97d6a8ac5a69662e1e2c22a84ea59bf50c305e"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<!--
|
||||
B2G repositories for all targets
|
||||
-->
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="260e51a4262f75341e037e583dfc8f6835b5ab31"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="3c97d6a8ac5a69662e1e2c22a84ea59bf50c305e"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
|
@ -31,7 +31,7 @@
|
|||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5e96ed318db1ba8037eb402724bc052240ac9e05"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8b76e208f3ba77f26017122fe9661d2221028f7a"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<!-- Stock Android things -->
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<!--
|
||||
B2G repositories for all targets
|
||||
-->
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="260e51a4262f75341e037e583dfc8f6835b5ab31"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="3c97d6a8ac5a69662e1e2c22a84ea59bf50c305e"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
|
@ -34,7 +34,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5e96ed318db1ba8037eb402724bc052240ac9e05"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8b76e208f3ba77f26017122fe9661d2221028f7a"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<!--
|
||||
B2G repositories for all targets
|
||||
-->
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="260e51a4262f75341e037e583dfc8f6835b5ab31"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="3c97d6a8ac5a69662e1e2c22a84ea59bf50c305e"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
|
@ -34,7 +34,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5e96ed318db1ba8037eb402724bc052240ac9e05"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8b76e208f3ba77f26017122fe9661d2221028f7a"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/>
|
||||
<project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" revision="337e0ef5e40f02a1ae59b90db0548976c70a7226"/>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<!--
|
||||
B2G repositories for all targets
|
||||
-->
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="260e51a4262f75341e037e583dfc8f6835b5ab31"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="3c97d6a8ac5a69662e1e2c22a84ea59bf50c305e"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<!--
|
||||
B2G repositories for all targets
|
||||
-->
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="260e51a4262f75341e037e583dfc8f6835b5ab31"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="3c97d6a8ac5a69662e1e2c22a84ea59bf50c305e"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
|
@ -35,7 +35,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5e96ed318db1ba8037eb402724bc052240ac9e05"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8b76e208f3ba77f26017122fe9661d2221028f7a"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"git": {
|
||||
"git_revision": "260e51a4262f75341e037e583dfc8f6835b5ab31",
|
||||
"git_revision": "3c97d6a8ac5a69662e1e2c22a84ea59bf50c305e",
|
||||
"remote": "https://git.mozilla.org/releases/gaia.git",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "1af9f0deab127d830bbd4e29651fed46614104f8",
|
||||
"revision": "39dd39c9b2ff6718c79af1617577366fa9510603",
|
||||
"repo_path": "integration/gaia-central"
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<!--
|
||||
B2G repositories for all targets
|
||||
-->
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="260e51a4262f75341e037e583dfc8f6835b5ab31"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="3c97d6a8ac5a69662e1e2c22a84ea59bf50c305e"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
|
@ -35,7 +35,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5e96ed318db1ba8037eb402724bc052240ac9e05"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8b76e208f3ba77f26017122fe9661d2221028f7a"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<!--
|
||||
B2G repositories for all targets
|
||||
-->
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="260e51a4262f75341e037e583dfc8f6835b5ab31"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="3c97d6a8ac5a69662e1e2c22a84ea59bf50c305e"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
|
@ -32,7 +32,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5e96ed318db1ba8037eb402724bc052240ac9e05"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8b76e208f3ba77f26017122fe9661d2221028f7a"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<!-- Stock Android things -->
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<!--
|
||||
B2G repositories for all targets
|
||||
-->
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="260e51a4262f75341e037e583dfc8f6835b5ab31"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="3c97d6a8ac5a69662e1e2c22a84ea59bf50c305e"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="99c333dab00ed79baff9e1cf76b320aee8e1c123"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
|
@ -35,7 +35,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5e96ed318db1ba8037eb402724bc052240ac9e05"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8b76e208f3ba77f26017122fe9661d2221028f7a"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/>
|
||||
<project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" revision="337e0ef5e40f02a1ae59b90db0548976c70a7226"/>
|
||||
|
|
|
@ -34,57 +34,7 @@ NS_IMPL_ISUPPORTS(DirectoryProvider,
|
|||
NS_IMETHODIMP
|
||||
DirectoryProvider::GetFile(const char *aKey, bool *aPersist, nsIFile* *aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
*aResult = nullptr;
|
||||
|
||||
// NOTE: This function can be reentrant through the NS_GetSpecialDirectory
|
||||
// call, so be careful not to cause infinite recursion.
|
||||
|
||||
nsCOMPtr<nsIFile> file;
|
||||
|
||||
char const* leafName = nullptr;
|
||||
|
||||
if (!strcmp(aKey, NS_APP_BOOKMARKS_50_FILE)) {
|
||||
leafName = "bookmarks.html";
|
||||
|
||||
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||
if (prefs) {
|
||||
nsCString path;
|
||||
rv = prefs->GetCharPref("browser.bookmarks.file", getter_Copies(path));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
NS_NewNativeLocalFile(path, true, getter_AddRefs(file));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsDependentCString leafstr(leafName);
|
||||
|
||||
nsCOMPtr<nsIFile> parentDir;
|
||||
if (file) {
|
||||
rv = file->GetParent(getter_AddRefs(parentDir));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
else {
|
||||
rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(parentDir));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = parentDir->Clone(getter_AddRefs(file));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
file->AppendNative(leafstr);
|
||||
}
|
||||
|
||||
*aPersist = true;
|
||||
NS_ADDREF(*aResult = file);
|
||||
|
||||
return NS_OK;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -12,10 +12,6 @@ SOURCES += [
|
|||
'DirectoryProvider.cpp',
|
||||
]
|
||||
|
||||
XPCSHELL_TESTS_MANIFESTS += [
|
||||
'tests/unit/xpcshell.ini',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'browsercomps'
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
|
||||
var gProfD = do_get_profile();
|
||||
var gDirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties);
|
||||
var gPrefSvc = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefBranch);
|
||||
|
||||
function writeTestFile(aParent, aName) {
|
||||
let file = aParent.clone();
|
||||
file.append(aName);
|
||||
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0644);
|
||||
return file;
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// We need to run this test separately since DirectoryProvider persists BMarks
|
||||
|
||||
function run_test() {
|
||||
let dir = gProfD.clone();
|
||||
let tfile = writeTestFile(dir, "bookmarkfile.test");
|
||||
gPrefSvc.setCharPref("browser.bookmarks.file", tfile.path);
|
||||
|
||||
let bmarks = gDirSvc.get("BMarks", Ci.nsIFile);
|
||||
do_check_true(tfile.equals(bmarks));
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
function test_bookmarkhtml() {
|
||||
let bmarks = gProfD.clone();
|
||||
bmarks.append("bookmarks.html");
|
||||
|
||||
let tbmarks = gDirSvc.get("BMarks", Ci.nsIFile);
|
||||
do_check_true(bmarks.equals(tbmarks));
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
[test_bookmarkhtml
|
||||
].forEach(function(f) {
|
||||
do_test_pending();
|
||||
print("Running test: " + f.name);
|
||||
f();
|
||||
do_test_finished();
|
||||
});
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
[DEFAULT]
|
||||
head = head_dirprovider.js
|
||||
tail =
|
||||
firefox-appdir = browser
|
||||
skip-if = toolkit == 'android' || toolkit == 'gonk'
|
||||
|
||||
[test_bookmark_pref.js]
|
||||
[test_keys.js]
|
|
@ -51,7 +51,7 @@ LoadContext::LoadContext(nsIPrincipal* aPrincipal,
|
|||
#endif
|
||||
{
|
||||
PrincipalOriginAttributes poa = BasePrincipal::Cast(aPrincipal)->OriginAttributesRef();
|
||||
mOriginAttributes = DocShellOriginAttributes(poa.mAppId, poa.mInBrowser);
|
||||
mOriginAttributes.InheritFromDocToChildDocShell(poa);
|
||||
|
||||
if (!aOptionalBase) {
|
||||
return;
|
||||
|
|
|
@ -28,9 +28,8 @@
|
|||
#include "nsWrapperCacheInlines.h"
|
||||
|
||||
nsIAttribute::nsIAttribute(nsDOMAttributeMap* aAttrMap,
|
||||
already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
|
||||
bool aNsAware)
|
||||
: nsINode(aNodeInfo), mAttrMap(aAttrMap), mNsAware(aNsAware)
|
||||
already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
||||
: nsINode(aNodeInfo), mAttrMap(aAttrMap)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -46,8 +45,8 @@ bool Attr::sInitialized;
|
|||
|
||||
Attr::Attr(nsDOMAttributeMap *aAttrMap,
|
||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
||||
const nsAString &aValue, bool aNsAware)
|
||||
: nsIAttribute(aAttrMap, aNodeInfo, aNsAware), mValue(aValue)
|
||||
const nsAString &aValue)
|
||||
: nsIAttribute(aAttrMap, aNodeInfo), mValue(aValue)
|
||||
{
|
||||
MOZ_ASSERT(mNodeInfo, "We must get a nodeinfo here!");
|
||||
MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::ATTRIBUTE_NODE,
|
||||
|
@ -262,7 +261,7 @@ Attr::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const
|
|||
const_cast<Attr*>(this)->GetValue(value);
|
||||
|
||||
RefPtr<mozilla::dom::NodeInfo> ni = aNodeInfo;
|
||||
*aResult = new Attr(nullptr, ni.forget(), value, mNsAware);
|
||||
*aResult = new Attr(nullptr, ni.forget(), value);
|
||||
if (!*aResult) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
|
|
@ -37,8 +37,7 @@ class Attr final : public nsIAttribute,
|
|||
public:
|
||||
Attr(nsDOMAttributeMap* aAttrMap,
|
||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
||||
const nsAString& aValue,
|
||||
bool aNsAware);
|
||||
const nsAString& aValue);
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
|
||||
|
|
|
@ -80,10 +80,7 @@ public:
|
|||
NS_DECL_NSIREQUEST
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSIEVENTTARGET
|
||||
// missing from NS_DECL_NSIEVENTTARGET because MSVC
|
||||
nsresult Dispatch(nsIRunnable* aEvent, uint32_t aFlags) {
|
||||
return Dispatch(nsCOMPtr<nsIRunnable>(aEvent).forget(), aFlags);
|
||||
}
|
||||
using nsIEventTarget::Dispatch;
|
||||
|
||||
explicit WebSocketImpl(WebSocket* aWebSocket)
|
||||
: mWebSocket(aWebSocket)
|
||||
|
|
|
@ -2773,11 +2773,14 @@ nsContentUtils::IsCustomElementName(nsIAtom* aName)
|
|||
{
|
||||
// The custom element name identifies a custom element and is a sequence of
|
||||
// alphanumeric ASCII characters that must match the NCName production and
|
||||
// contain a U+002D HYPHEN-MINUS character.
|
||||
// contain a U+002D HYPHEN-MINUS character. We check for the HYPHEN-MINUS
|
||||
// first, since that will typically not be present, which will allow us to
|
||||
// return before doing the more expensive (and generally passing) CheckQName
|
||||
// check.
|
||||
nsDependentAtomString str(aName);
|
||||
const char16_t* colon;
|
||||
if (NS_FAILED(nsContentUtils::CheckQName(str, false, &colon)) || colon ||
|
||||
str.FindChar('-') == -1) {
|
||||
if (str.FindChar('-') == -1 ||
|
||||
NS_FAILED(nsContentUtils::CheckQName(str, false, &colon)) || colon) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -148,35 +148,8 @@ nsDOMAttributeMap::DropAttribute(int32_t aNamespaceID, nsIAtom* aLocalName)
|
|||
}
|
||||
}
|
||||
|
||||
already_AddRefed<Attr>
|
||||
nsDOMAttributeMap::RemoveAttribute(mozilla::dom::NodeInfo* aNodeInfo)
|
||||
{
|
||||
NS_ASSERTION(aNodeInfo, "RemoveAttribute() called with aNodeInfo == nullptr!");
|
||||
|
||||
nsAttrKey attr(aNodeInfo->NamespaceID(), aNodeInfo->NameAtom());
|
||||
|
||||
RefPtr<Attr> node;
|
||||
if (!mAttributeCache.Get(attr, getter_AddRefs(node))) {
|
||||
nsAutoString value;
|
||||
// As we are removing the attribute we need to set the current value in
|
||||
// the attribute node.
|
||||
mContent->GetAttr(aNodeInfo->NamespaceID(), aNodeInfo->NameAtom(), value);
|
||||
RefPtr<mozilla::dom::NodeInfo> ni = aNodeInfo;
|
||||
node = new Attr(nullptr, ni.forget(), value, true);
|
||||
}
|
||||
else {
|
||||
// Break link to map
|
||||
node->SetMap(nullptr);
|
||||
|
||||
// Remove from cache
|
||||
mAttributeCache.Remove(attr);
|
||||
}
|
||||
|
||||
return node.forget();
|
||||
}
|
||||
|
||||
Attr*
|
||||
nsDOMAttributeMap::GetAttribute(mozilla::dom::NodeInfo* aNodeInfo, bool aNsAware)
|
||||
nsDOMAttributeMap::GetAttribute(mozilla::dom::NodeInfo* aNodeInfo)
|
||||
{
|
||||
NS_ASSERTION(aNodeInfo, "GetAttribute() called with aNodeInfo == nullptr!");
|
||||
|
||||
|
@ -186,7 +159,7 @@ nsDOMAttributeMap::GetAttribute(mozilla::dom::NodeInfo* aNodeInfo, bool aNsAware
|
|||
if (!node) {
|
||||
RefPtr<mozilla::dom::NodeInfo> ni = aNodeInfo;
|
||||
RefPtr<Attr> newAttr =
|
||||
new Attr(this, ni.forget(), EmptyString(), aNsAware);
|
||||
new Attr(this, ni.forget(), EmptyString());
|
||||
mAttributeCache.Put(attr, newAttr);
|
||||
node = newAttr;
|
||||
}
|
||||
|
@ -206,7 +179,7 @@ nsDOMAttributeMap::NamedGetter(const nsAString& aAttrName, bool& aFound)
|
|||
}
|
||||
|
||||
aFound = true;
|
||||
return GetAttribute(ni, false);
|
||||
return GetAttribute(ni);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -329,38 +302,22 @@ nsDOMAttributeMap::SetNamedItemNS(Attr& aAttr, ErrorResult& aError)
|
|||
}
|
||||
}
|
||||
|
||||
RefPtr<Attr> attr;
|
||||
RefPtr<Attr> oldAttr;
|
||||
|
||||
if (oldNi) {
|
||||
RefPtr<Attr> oldAttr = GetAttribute(oldNi, true);
|
||||
oldAttr = GetAttribute(oldNi);
|
||||
|
||||
if (oldAttr == &aAttr) {
|
||||
return oldAttr.forget();
|
||||
}
|
||||
|
||||
if (oldAttr) {
|
||||
attr = RemoveNamedItem(oldNi, aError);
|
||||
NS_ASSERTION(attr->NodeInfo()->NameAndNamespaceEquals(oldNi),
|
||||
"RemoveNamedItem() called, attr->NodeInfo() should be equal to oldNi!");
|
||||
|
||||
// That might have run mutation event listeners, so re-verify
|
||||
// our assumptions.
|
||||
nsDOMAttributeMap* newOwner = aAttr.GetMap();
|
||||
if (newOwner) {
|
||||
if (newOwner == this) {
|
||||
// OK, we're just done here.
|
||||
return attr.forget();
|
||||
}
|
||||
|
||||
// The attr we're trying to set got stuck on some other
|
||||
// element. Just throw, for lack of anything better to do.
|
||||
aError.Throw(NS_ERROR_DOM_INUSE_ATTRIBUTE_ERR);
|
||||
return nullptr;
|
||||
} else if (mContent->OwnerDoc() != aAttr.OwnerDoc()) {
|
||||
// Got moved into a different document, boo.
|
||||
aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
// Just remove it from our hashtable. This has no side-effects, so we
|
||||
// don't have to recheck anything after we do it. Then we'll add our new
|
||||
// Attr to the hashtable and do the actual attr set on the element. This
|
||||
// will make the whole thing look like a single attribute mutation (with
|
||||
// the new attr node in place) as opposed to a removal and addition.
|
||||
DropAttribute(oldNi->NamespaceID(), oldNi->NameAtom());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -382,13 +339,13 @@ nsDOMAttributeMap::SetNamedItemNS(Attr& aAttr, ErrorResult& aError)
|
|||
DropAttribute(ni->NamespaceID(), ni->NameAtom());
|
||||
}
|
||||
|
||||
return attr.forget();
|
||||
return oldAttr.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<Attr>
|
||||
nsDOMAttributeMap::RemoveNamedItem(NodeInfo* aNodeInfo, ErrorResult& aError)
|
||||
{
|
||||
RefPtr<Attr> attribute = GetAttribute(aNodeInfo, true);
|
||||
RefPtr<Attr> attribute = GetAttribute(aNodeInfo);
|
||||
// This removes the attribute node from the attribute map.
|
||||
aError = mContent->UnsetAttr(aNodeInfo->NamespaceID(), aNodeInfo->NameAtom(), true);
|
||||
return attribute.forget();
|
||||
|
@ -438,7 +395,7 @@ nsDOMAttributeMap::IndexedGetter(uint32_t aIndex, bool& aFound)
|
|||
RefPtr<mozilla::dom::NodeInfo> ni = mContent->NodeInfo()->NodeInfoManager()->
|
||||
GetNodeInfo(name->LocalName(), name->GetPrefix(), name->NamespaceID(),
|
||||
nsIDOMNode::ATTRIBUTE_NODE);
|
||||
return GetAttribute(ni, true);
|
||||
return GetAttribute(ni);
|
||||
}
|
||||
|
||||
Attr*
|
||||
|
@ -489,7 +446,7 @@ nsDOMAttributeMap::GetNamedItemNS(const nsAString& aNamespaceURI,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
return GetAttribute(ni, true);
|
||||
return GetAttribute(ni);
|
||||
}
|
||||
|
||||
already_AddRefed<mozilla::dom::NodeInfo>
|
||||
|
|
|
@ -178,12 +178,7 @@ private:
|
|||
GetAttrNodeInfo(const nsAString& aNamespaceURI,
|
||||
const nsAString& aLocalName);
|
||||
|
||||
Attr* GetAttribute(mozilla::dom::NodeInfo* aNodeInfo, bool aNsAware);
|
||||
|
||||
/**
|
||||
* Remove an attribute, returns the removed node.
|
||||
*/
|
||||
already_AddRefed<Attr> RemoveAttribute(mozilla::dom::NodeInfo* aNodeInfo);
|
||||
Attr* GetAttribute(mozilla::dom::NodeInfo* aNodeInfo);
|
||||
};
|
||||
|
||||
// XXX khuey yes this is crazy. The bindings code needs to see this include,
|
||||
|
|
|
@ -5684,7 +5684,7 @@ nsIDocument::CreateAttribute(const nsAString& aName, ErrorResult& rv)
|
|||
}
|
||||
|
||||
RefPtr<Attr> attribute = new Attr(nullptr, nodeInfo.forget(),
|
||||
EmptyString(), false);
|
||||
EmptyString());
|
||||
return attribute.forget();
|
||||
}
|
||||
|
||||
|
@ -5717,7 +5717,7 @@ nsIDocument::CreateAttributeNS(const nsAString& aNamespaceURI,
|
|||
}
|
||||
|
||||
RefPtr<Attr> attribute = new Attr(nullptr, nodeInfo.forget(),
|
||||
EmptyString(), true);
|
||||
EmptyString());
|
||||
return attribute.forget();
|
||||
}
|
||||
|
||||
|
|
|
@ -5914,8 +5914,12 @@ FullscreenTransitionTask::Run()
|
|||
mWindow->mFullScreen = mFullscreen;
|
||||
}
|
||||
// Toggle the fullscreen state on the widget
|
||||
mWindow->SetWidgetFullscreen(nsPIDOMWindow::eForFullscreenAPI,
|
||||
mFullscreen, mWidget, mScreen);
|
||||
if (!mWindow->SetWidgetFullscreen(nsPIDOMWindow::eForFullscreenAPI,
|
||||
mFullscreen, mWidget, mScreen)) {
|
||||
// Fail to setup the widget, call FinishFullscreenChange to
|
||||
// complete fullscreen change directly.
|
||||
mWindow->FinishFullscreenChange(mFullscreen);
|
||||
}
|
||||
// Set observer for the next content paint.
|
||||
nsCOMPtr<nsIObserver> observer = new Observer(this);
|
||||
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
||||
|
@ -5994,14 +5998,14 @@ MakeWidgetFullscreen(nsGlobalWindow* aWindow, gfx::VRDeviceProxy* aHMD,
|
|||
}
|
||||
nsCOMPtr<nsIScreen> screen = aHMD ? aHMD->GetScreen() : nullptr;
|
||||
if (!performTransition) {
|
||||
aWindow->SetWidgetFullscreen(aReason, aFullscreen, widget, screen);
|
||||
return aWindow->SetWidgetFullscreen(aReason, aFullscreen, widget, screen);
|
||||
} else {
|
||||
nsCOMPtr<nsIRunnable> task =
|
||||
new FullscreenTransitionTask(duration, aWindow, aFullscreen,
|
||||
widget, screen, transitionData);
|
||||
task->Run();
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -6094,11 +6098,18 @@ nsGlobalWindow::SetFullscreenInternal(FullscreenReason aReason,
|
|||
}
|
||||
}
|
||||
|
||||
// If we didn't setup the widget, we may need to manually set this
|
||||
// flag, or the assertion in FinishFullscreenChange is violated.
|
||||
if (nsCOMPtr<nsIPresShell> presShell = mDocShell->GetPresShell()) {
|
||||
if (!presShell->IsInFullscreenChange()) {
|
||||
presShell->SetIsInFullscreenChange(true);
|
||||
}
|
||||
}
|
||||
FinishFullscreenChange(aFullScreen);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
nsGlobalWindow::SetWidgetFullscreen(FullscreenReason aReason, bool aIsFullscreen,
|
||||
nsIWidget* aWidget, nsIScreen* aScreen)
|
||||
{
|
||||
|
@ -6110,13 +6121,12 @@ nsGlobalWindow::SetWidgetFullscreen(FullscreenReason aReason, bool aIsFullscreen
|
|||
if (nsCOMPtr<nsIPresShell> presShell = mDocShell->GetPresShell()) {
|
||||
presShell->SetIsInFullscreenChange(true);
|
||||
}
|
||||
if (aReason == nsPIDOMWindow::eForFullscreenMode) {
|
||||
nsresult rv = aReason == nsPIDOMWindow::eForFullscreenMode ?
|
||||
// If we enter fullscreen for fullscreen mode, we want
|
||||
// the native system behavior.
|
||||
aWidget->MakeFullScreenWithNativeTransition(aIsFullscreen, aScreen);
|
||||
} else {
|
||||
aWidget->MakeFullScreenWithNativeTransition(aIsFullscreen, aScreen) :
|
||||
aWidget->MakeFullScreen(aIsFullscreen, aScreen);
|
||||
}
|
||||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
/* virtual */ void
|
||||
|
|
|
@ -473,7 +473,7 @@ public:
|
|||
FullscreenReason aReason, bool aIsFullscreen,
|
||||
mozilla::gfx::VRDeviceProxy *aHMD = nullptr) override final;
|
||||
virtual void FinishFullscreenChange(bool aIsFullscreen) override final;
|
||||
void SetWidgetFullscreen(FullscreenReason aReason, bool aIsFullscreen,
|
||||
bool SetWidgetFullscreen(FullscreenReason aReason, bool aIsFullscreen,
|
||||
nsIWidget* aWidget, nsIScreen* aScreen);
|
||||
bool FullScreen() const;
|
||||
|
||||
|
|
|
@ -41,13 +41,11 @@ public:
|
|||
protected:
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
nsIAttribute(nsDOMAttributeMap *aAttrMap,
|
||||
already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
|
||||
bool aNsAware);
|
||||
already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
||||
#endif //MOZILLA_INTERNAL_API
|
||||
virtual ~nsIAttribute();
|
||||
|
||||
RefPtr<nsDOMAttributeMap> mAttrMap;
|
||||
bool mNsAware;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIAttribute, NS_IATTRIBUTE_IID)
|
||||
|
|
|
@ -36,7 +36,7 @@ const BinaryInputStream =
|
|||
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
var listener = {
|
||||
_httpstatus : 0,
|
||||
|
@ -61,16 +61,8 @@ var listener = {
|
|||
};
|
||||
|
||||
function runTest() {
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Components.interfaces.nsIIOService);
|
||||
var uri = ios.newURI("https://redirproxy.example.com/test", "", null);
|
||||
|
||||
var channel = ios.newChannelFromURI2(uri,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var uri = NetUtil.newURI("https://redirproxy.example.com/test");
|
||||
var channel = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true});
|
||||
|
||||
/* Previously, necko would allow a 302 as part of a CONNECT response
|
||||
if the LOAD_DOCUMENT_URI flag was set and the original document
|
||||
|
@ -79,7 +71,7 @@ function runTest() {
|
|||
channel.loadFlags |= Components.interfaces.nsIChannel.LOAD_DOCUMENT_URI;
|
||||
channel.QueryInterface(Components.interfaces.nsIHttpChannelInternal);
|
||||
channel.documentURI = uri;
|
||||
channel.asyncOpen(listener, null);
|
||||
channel.asyncOpen2(listener);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "MainThreadUtils.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
@ -848,8 +849,7 @@ BluetoothAvrcpManager::GetElementAttrNotification(
|
|||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsAutoArrayPtr<BluetoothAvrcpElementAttribute> attrs(
|
||||
new BluetoothAvrcpElementAttribute[aNumAttrs]);
|
||||
auto attrs = MakeUnique<BluetoothAvrcpElementAttribute[]>(aNumAttrs);
|
||||
|
||||
for (uint8_t i = 0; i < aNumAttrs; ++i) {
|
||||
attrs[i].mId = aAttrs[i];
|
||||
|
@ -859,7 +859,7 @@ BluetoothAvrcpManager::GetElementAttrNotification(
|
|||
}
|
||||
|
||||
MOZ_ASSERT(sBtAvrcpInterface);
|
||||
sBtAvrcpInterface->GetElementAttrRsp(aNumAttrs, attrs, nullptr);
|
||||
sBtAvrcpInterface->GetElementAttrRsp(aNumAttrs, attrs.get(), nullptr);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -633,8 +633,8 @@ BluetoothMapSmsManager::ReplyToGetWithHeaderBody(UniquePtr<uint8_t[]> aResponse,
|
|||
|
||||
// Read blob data from input stream
|
||||
uint32_t numRead = 0;
|
||||
nsAutoArrayPtr<char> buf(new char[remainingPacketSize]);
|
||||
nsresult rv = mDataStream->Read(buf, remainingPacketSize, &numRead);
|
||||
auto buf = MakeUnique<char[]>(remainingPacketSize);
|
||||
nsresult rv = mDataStream->Read(buf.get(), remainingPacketSize, &numRead);
|
||||
if (NS_FAILED(rv)) {
|
||||
BT_LOGR("Failed to read from input stream. rv=0x%x",
|
||||
static_cast<uint32_t>(rv));
|
||||
|
@ -722,16 +722,16 @@ BluetoothMapSmsManager::ReplyToMessagesListing(Blob* aBlob, long aMasId,
|
|||
uint8_t len = timestampStr.Length();
|
||||
|
||||
// Total length: [NewMessage:3] + [MseTime:var] + [MessageListingSize:4]
|
||||
nsAutoArrayPtr<uint8_t> appParameters(new uint8_t[len + 9]);
|
||||
auto appParameters = MakeUnique<uint8_t[]>(len + 9);
|
||||
uint8_t newMessage = aNewMessage ? 1 : 0;
|
||||
|
||||
AppendAppParameter(appParameters,
|
||||
AppendAppParameter(&appParameters[0],
|
||||
3,
|
||||
(uint8_t) Map::AppParametersTagId::NewMessage,
|
||||
&newMessage,
|
||||
sizeof(newMessage));
|
||||
|
||||
AppendAppParameter(appParameters + 3,
|
||||
AppendAppParameter(&appParameters[3],
|
||||
len + 2,
|
||||
(uint8_t) Map::AppParametersTagId::MSETime,
|
||||
str,
|
||||
|
@ -740,7 +740,7 @@ BluetoothMapSmsManager::ReplyToMessagesListing(Blob* aBlob, long aMasId,
|
|||
uint8_t msgListingSize[2];
|
||||
BigEndian::writeUint16(&msgListingSize[0], aSize);
|
||||
|
||||
AppendAppParameter(appParameters + 5 + len,
|
||||
AppendAppParameter(&appParameters[5 + len],
|
||||
4,
|
||||
(uint8_t) Map::AppParametersTagId::MessagesListingSize,
|
||||
msgListingSize,
|
||||
|
@ -748,7 +748,7 @@ BluetoothMapSmsManager::ReplyToMessagesListing(Blob* aBlob, long aMasId,
|
|||
|
||||
index += AppendHeaderAppParameters(&res[index],
|
||||
mRemoteMaxPacketLength,
|
||||
appParameters,
|
||||
appParameters.get(),
|
||||
len + 9);
|
||||
|
||||
if (mBodyRequired) {
|
||||
|
@ -844,7 +844,7 @@ BluetoothMapSmsManager::ReplyToSendMessage(
|
|||
* with 16 hexadecimal digits.
|
||||
*/
|
||||
int len = aHandleId.Length();
|
||||
nsAutoArrayPtr<uint8_t> handleId(new uint8_t[(len + 1) * 2]);
|
||||
auto handleId = MakeUnique<uint8_t[]>((len + 1) * 2);
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
BigEndian::writeUint16(&handleId[i * 2], aHandleId[i]);
|
||||
|
@ -854,7 +854,7 @@ BluetoothMapSmsManager::ReplyToSendMessage(
|
|||
auto res = MakeUnique<uint8_t[]>(mRemoteMaxPacketLength);
|
||||
int index = kObexRespHeaderSize;
|
||||
index += AppendHeaderName(&res[index], mRemoteMaxPacketLength - index,
|
||||
handleId, (len + 1) * 2);
|
||||
handleId.get(), (len + 1) * 2);
|
||||
SendMasObexData(Move(res), ObexResponseCode::Success, index);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCExternalHandlerService.h"
|
||||
#include "nsIObserver.h"
|
||||
|
@ -105,8 +106,8 @@ BluetoothOppManager::Observe(nsISupports* aSubject,
|
|||
class BluetoothOppManager::SendSocketDataTask final : public nsRunnable
|
||||
{
|
||||
public:
|
||||
SendSocketDataTask(uint8_t* aStream, uint32_t aSize)
|
||||
: mStream(aStream)
|
||||
SendSocketDataTask(UniquePtr<uint8_t[]> aStream, uint32_t aSize)
|
||||
: mStream(Move(aStream))
|
||||
, mSize(aSize)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
@ -116,13 +117,13 @@ public:
|
|||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
sBluetoothOppManager->SendPutRequest(mStream, mSize);
|
||||
sBluetoothOppManager->SendPutRequest(mStream.get(), mSize);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
nsAutoArrayPtr<uint8_t> mStream;
|
||||
UniquePtr<uint8_t[]> mStream;
|
||||
uint32_t mSize;
|
||||
};
|
||||
|
||||
|
@ -142,10 +143,11 @@ public:
|
|||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
||||
uint32_t numRead;
|
||||
nsAutoArrayPtr<char> buf(new char[mAvailablePacketSize]);
|
||||
auto buf = MakeUnique<uint8_t[]>(mAvailablePacketSize);
|
||||
|
||||
// function inputstream->Read() only works on non-main thread
|
||||
nsresult rv = mInputStream->Read(buf, mAvailablePacketSize, &numRead);
|
||||
nsresult rv = mInputStream->Read((char*)buf.get(), mAvailablePacketSize,
|
||||
&numRead);
|
||||
if (NS_FAILED(rv)) {
|
||||
// Needs error handling here
|
||||
BT_WARNING("Failed to read from input stream");
|
||||
|
@ -156,7 +158,7 @@ public:
|
|||
sBluetoothOppManager->CheckPutFinal(numRead);
|
||||
|
||||
RefPtr<SendSocketDataTask> task =
|
||||
new SendSocketDataTask((uint8_t*)buf.forget(), numRead);
|
||||
new SendSocketDataTask(Move(buf), numRead);
|
||||
if (NS_FAILED(NS_DispatchToMainThread(task))) {
|
||||
BT_WARNING("Failed to dispatch to main thread!");
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -1206,7 +1208,7 @@ BluetoothOppManager::SendPutHeaderRequest(const nsAString& aFileName,
|
|||
}
|
||||
|
||||
int len = aFileName.Length();
|
||||
nsAutoArrayPtr<uint8_t> fileName(new uint8_t[(len + 1) * 2]);
|
||||
auto fileName = MakeUnique<uint8_t[]>((len + 1) * 2);
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
BigEndian::writeUint16(&fileName[i * 2], aFileName[i]);
|
||||
|
@ -1217,7 +1219,7 @@ BluetoothOppManager::SendPutHeaderRequest(const nsAString& aFileName,
|
|||
auto req = MakeUnique<uint8_t[]>(mRemoteMaxPacketLength);
|
||||
int index = 3;
|
||||
index += AppendHeaderName(&req[index], mRemoteMaxPacketLength - index,
|
||||
fileName, (len + 1) * 2);
|
||||
fileName.get(), (len + 1) * 2);
|
||||
index += AppendHeaderLength(&req[index], aFileSize);
|
||||
|
||||
// This is final put packet if file size equals to 0
|
||||
|
|
|
@ -517,9 +517,7 @@ BluetoothPbapManager::NotifyPasswordRequest(const ObexHeaderSet& aHeader)
|
|||
MOZ_ASSERT(aHeader.Has(ObexHeaderId::AuthChallenge));
|
||||
|
||||
// Get authentication challenge data
|
||||
int dataLength;
|
||||
nsAutoArrayPtr<uint8_t> dataPtr;
|
||||
aHeader.GetAuthChallenge(dataPtr, &dataLength);
|
||||
const ObexHeader* authHeader = aHeader.GetHeader(ObexHeaderId::AuthChallenge);
|
||||
|
||||
// Get nonce from authentication challenge
|
||||
// Section 3.5.1 "Digest Challenge", IrOBEX spec 1.2
|
||||
|
@ -527,16 +525,16 @@ BluetoothPbapManager::NotifyPasswordRequest(const ObexHeaderSet& aHeader)
|
|||
// [tagId:1][length:1][nonce:16]
|
||||
uint8_t offset = 0;
|
||||
do {
|
||||
uint8_t tagId = dataPtr[offset++];
|
||||
uint8_t length = dataPtr[offset++];
|
||||
uint8_t tagId = authHeader->mData[offset++];
|
||||
uint8_t length = authHeader->mData[offset++];
|
||||
|
||||
BT_LOGR("AuthChallenge header includes tagId %d", tagId);
|
||||
if (tagId == ObexDigestChallenge::Nonce) {
|
||||
memcpy(mRemoteNonce, &dataPtr[offset], DIGEST_LENGTH);
|
||||
memcpy(mRemoteNonce, &authHeader->mData[offset], DIGEST_LENGTH);
|
||||
}
|
||||
|
||||
offset += length;
|
||||
} while (offset < dataLength);
|
||||
} while (offset < authHeader->mDataLength);
|
||||
|
||||
// Ensure bluetooth service is available
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
|
|
|
@ -1288,7 +1288,7 @@ BluetoothServiceBluedroid::PinReplyInternal(
|
|||
|
||||
ENSURE_BLUETOOTH_IS_ENABLED_VOID(aRunnable);
|
||||
|
||||
if (aAccept) {
|
||||
if (aAccept && aPinCode.mLength) {
|
||||
sBtCoreInterface->PinReply(aDeviceAddress, aAccept, aPinCode,
|
||||
new PinReplyResultHandler(aRunnable));
|
||||
} else {
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCExternalHandlerService.h"
|
||||
#include "nsIObserver.h"
|
||||
|
@ -100,8 +101,8 @@ BluetoothOppManager::Observe(nsISupports* aSubject,
|
|||
class SendSocketDataTask : public nsRunnable
|
||||
{
|
||||
public:
|
||||
SendSocketDataTask(uint8_t* aStream, uint32_t aSize)
|
||||
: mStream(aStream)
|
||||
SendSocketDataTask(UniquePtr<uint8_t[]> aStream, uint32_t aSize)
|
||||
: mStream(Move(aStream))
|
||||
, mSize(aSize)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
@ -111,13 +112,13 @@ public:
|
|||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
sBluetoothOppManager->SendPutRequest(mStream, mSize);
|
||||
sBluetoothOppManager->SendPutRequest(mStream.get(), mSize);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
nsAutoArrayPtr<uint8_t> mStream;
|
||||
UniquePtr<uint8_t[]> mStream;
|
||||
uint32_t mSize;
|
||||
};
|
||||
|
||||
|
@ -137,10 +138,11 @@ public:
|
|||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
||||
uint32_t numRead;
|
||||
nsAutoArrayPtr<char> buf(new char[mAvailablePacketSize]);
|
||||
auto buf = MakeUnique<uint8_t[]>(mAvailablePacketSize);
|
||||
|
||||
// function inputstream->Read() only works on non-main thread
|
||||
nsresult rv = mInputStream->Read(buf, mAvailablePacketSize, &numRead);
|
||||
nsresult rv = mInputStream->Read((char*)buf.get(), mAvailablePacketSize,
|
||||
&numRead);
|
||||
if (NS_FAILED(rv)) {
|
||||
// Needs error handling here
|
||||
BT_WARNING("Failed to read from input stream");
|
||||
|
@ -151,7 +153,7 @@ public:
|
|||
sBluetoothOppManager->CheckPutFinal(numRead);
|
||||
|
||||
RefPtr<SendSocketDataTask> task =
|
||||
new SendSocketDataTask((uint8_t*)buf.forget(), numRead);
|
||||
new SendSocketDataTask(Move(buf), numRead);
|
||||
if (NS_FAILED(NS_DispatchToMainThread(task))) {
|
||||
BT_WARNING("Failed to dispatch to main thread!");
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "mozilla/Compiler.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/Observer.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsString.h"
|
||||
|
@ -517,7 +518,7 @@ struct BluetoothAddress {
|
|||
struct BluetoothConfigurationParameter {
|
||||
uint8_t mType;
|
||||
uint16_t mLength;
|
||||
nsAutoArrayPtr<uint8_t> mValue;
|
||||
mozilla::UniquePtr<uint8_t[]> mValue;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -248,21 +248,6 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void GetAuthChallenge(nsAutoArrayPtr<uint8_t>& aRetData,
|
||||
int* aRetDataLength) const
|
||||
{
|
||||
*aRetDataLength = 0;
|
||||
|
||||
for (uint8_t i = 0; i < mHeaders.Length(); ++i) {
|
||||
if (mHeaders[i]->mId == ObexHeaderId::AuthChallenge) {
|
||||
aRetData = new uint8_t[mHeaders[i]->mDataLength];
|
||||
memcpy(aRetData, mHeaders[i]->mData, mHeaders[i]->mDataLength);
|
||||
*aRetDataLength = mHeaders[i]->mDataLength;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t GetConnectionId() const
|
||||
{
|
||||
int length = mHeaders.Length();
|
||||
|
|
|
@ -462,6 +462,7 @@ BrowserElementParent.prototype = {
|
|||
/* username and password */
|
||||
let detail = {
|
||||
host: authDetail.host,
|
||||
path: authDetail.path,
|
||||
realm: authDetail.realm,
|
||||
isProxy: authDetail.isProxy
|
||||
};
|
||||
|
|
|
@ -381,6 +381,7 @@ BrowserElementAuthPrompt.prototype = {
|
|||
let [hostname, httpRealm] = this._getAuthTarget(channel, authInfo);
|
||||
return {
|
||||
host: hostname,
|
||||
path: channel.URI.path,
|
||||
realm: httpRealm,
|
||||
username: authInfo.username,
|
||||
isProxy: !!(authInfo.flags & Ci.nsIAuthInformation.AUTH_PROXY),
|
||||
|
|
|
@ -49,6 +49,9 @@ function testHttpAuthCancel(e) {
|
|||
|
||||
is(e.detail.realm, 'http_realm', 'expected realm matches');
|
||||
is(e.detail.host, 'http://test', 'expected host matches');
|
||||
is(e.detail.path,
|
||||
'/tests/dom/browser-element/mochitest/file_http_401_response.sjs',
|
||||
'expected path matches');
|
||||
e.preventDefault();
|
||||
|
||||
SimpleTest.executeSoon(function() {
|
||||
|
@ -71,6 +74,9 @@ function testHttpAuth(e) {
|
|||
|
||||
is(e.detail.realm, 'http_realm', 'expected realm matches');
|
||||
is(e.detail.host, 'http://test', 'expected host matches');
|
||||
is(e.detail.path,
|
||||
'/tests/dom/browser-element/mochitest/file_http_401_response.sjs',
|
||||
'expected path matches');
|
||||
is(e.detail.isProxy, false, 'expected isProxy is false');
|
||||
e.preventDefault();
|
||||
|
||||
|
@ -98,6 +104,9 @@ function testProxyAuth(e) {
|
|||
|
||||
is(e.detail.realm, 'http_realm', 'expected realm matches');
|
||||
is(e.detail.host, mozproxy, 'expected host matches');
|
||||
is(e.detail.path,
|
||||
'/tests/dom/browser-element/mochitest/file_http_407_response.sjs',
|
||||
'expected path matches');
|
||||
is(e.detail.isProxy, true, 'expected isProxy is true');
|
||||
e.preventDefault();
|
||||
|
||||
|
|
|
@ -118,18 +118,15 @@ WebGL2Context::BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY
|
|||
return;
|
||||
}
|
||||
|
||||
if (!mBoundReadFramebuffer->ValidateAndInitAttachments("blitFramebuffer's READ_FRAMEBUFFER") ||
|
||||
!mBoundDrawFramebuffer->ValidateAndInitAttachments("blitFramebuffer's DRAW_FRAMEBUFFER"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GLsizei srcSamples;
|
||||
const webgl::FormatInfo* srcColorFormat = nullptr;
|
||||
const webgl::FormatInfo* srcDepthFormat = nullptr;
|
||||
const webgl::FormatInfo* srcStencilFormat = nullptr;
|
||||
|
||||
if (mBoundReadFramebuffer) {
|
||||
if (!mBoundReadFramebuffer->ValidateAndInitAttachments("blitFramebuffer's READ_FRAMEBUFFER"))
|
||||
return;
|
||||
|
||||
if (!GetFBInfoForBlit(mBoundReadFramebuffer, "READ_FRAMEBUFFER", &srcSamples,
|
||||
&srcColorFormat, &srcDepthFormat, &srcStencilFormat))
|
||||
{
|
||||
|
@ -148,6 +145,9 @@ WebGL2Context::BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY
|
|||
const webgl::FormatInfo* dstStencilFormat = nullptr;
|
||||
|
||||
if (mBoundDrawFramebuffer) {
|
||||
if (!mBoundDrawFramebuffer->ValidateAndInitAttachments("blitFramebuffer's DRAW_FRAMEBUFFER"))
|
||||
return;
|
||||
|
||||
if (!GetFBInfoForBlit(mBoundDrawFramebuffer, "DRAW_FRAMEBUFFER", &dstSamples,
|
||||
&dstColorFormat, &dstDepthFormat, &dstStencilFormat))
|
||||
{
|
||||
|
|
|
@ -537,6 +537,11 @@ WebGLContext::FramebufferTexture2D(GLenum target,
|
|||
if (!ValidateFramebufferTarget(target, "framebufferTexture2D"))
|
||||
return;
|
||||
|
||||
if (level < 0) {
|
||||
ErrorInvalidValue("framebufferTexture2D: level must not be negative.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsWebGL2() && level != 0) {
|
||||
ErrorInvalidValue("framebufferTexture2D: level must be 0.");
|
||||
return;
|
||||
|
|
|
@ -476,9 +476,11 @@ WebGLFBAttachPoint::GetParameter(const char* funcName, WebGLContext* webgl, JSCo
|
|||
if (webgl->IsWebGL2() ||
|
||||
webgl->IsExtensionEnabled(WebGLExtensionID::EXT_sRGB))
|
||||
{
|
||||
const auto format = Format()->format;
|
||||
return JS::Int32Value(format->isSRGB ? LOCAL_GL_SRGB
|
||||
: LOCAL_GL_LINEAR);
|
||||
const auto format = Format();
|
||||
if (!format)
|
||||
return JS::NullValue();
|
||||
return JS::Int32Value(format->format->isSRGB ? LOCAL_GL_SRGB
|
||||
: LOCAL_GL_LINEAR);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -2184,7 +2184,7 @@ void HTMLMediaElement::StopSuspendingAfterFirstFrame()
|
|||
return;
|
||||
mSuspendedAfterFirstFrame = false;
|
||||
if (mDecoder) {
|
||||
mDecoder->Resume(true);
|
||||
mDecoder->Resume();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4191,7 +4191,7 @@ void HTMLMediaElement::SuspendOrResumeElement(bool aPauseElement, bool aSuspendE
|
|||
MOZ_ASSERT(!mMediaKeys);
|
||||
#endif
|
||||
if (mDecoder) {
|
||||
mDecoder->Resume(false);
|
||||
mDecoder->Resume();
|
||||
if (!mPaused && !mDecoder->IsEndedOrShutdown()) {
|
||||
mDecoder->Play();
|
||||
}
|
||||
|
@ -4891,7 +4891,7 @@ HTMLMediaElement::SetMediaKeys(mozilla::dom::MediaKeys* aMediaKeys,
|
|||
if (mDecoder) {
|
||||
// We don't support swapping out the MediaKeys once we've started to
|
||||
// setup the playback pipeline. Note this also means we don't need to worry
|
||||
// about handling disassociating the MediaKeys from the MediaDecoder.
|
||||
// about handling disassociating the MediaKeys from the MediaDecoder.
|
||||
promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR,
|
||||
NS_LITERAL_CSTRING("Can't change MediaKeys on HTMLMediaElement after load has started"));
|
||||
return promise.forget();
|
||||
|
|
|
@ -1411,17 +1411,12 @@ MediaDecoder::Suspend()
|
|||
}
|
||||
|
||||
void
|
||||
MediaDecoder::Resume(bool aForceBuffering)
|
||||
MediaDecoder::Resume()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (mResource) {
|
||||
mResource->Resume();
|
||||
}
|
||||
if (aForceBuffering) {
|
||||
if (mDecoderStateMachine) {
|
||||
mDecoderStateMachine->DispatchStartBuffering();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -3,184 +3,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/*
|
||||
Each video element based on MediaDecoder has a state machine to manage
|
||||
its play state and keep the current frame up to date. All state machines
|
||||
share time in a single shared thread. Each decoder also has a TaskQueue
|
||||
running in a SharedThreadPool to decode audio and video data.
|
||||
Each decoder also has a thread to push decoded audio
|
||||
to the hardware. This thread is not created until playback starts, but
|
||||
currently is not destroyed when paused, only when playback ends.
|
||||
|
||||
The decoder owns the resources for downloading the media file, and the
|
||||
high level state. It holds an owning reference to the state machine that
|
||||
owns all the resources related to decoding data, and manages the low level
|
||||
decoding operations and A/V sync.
|
||||
|
||||
Each state machine runs on the shared state machine thread. Every time some
|
||||
action is required for a state machine, it is scheduled to run on the shared
|
||||
the state machine thread. The state machine runs one "cycle" on the state
|
||||
machine thread, and then returns. If necessary, it will schedule itself to
|
||||
run again in future. While running this cycle, it must not block the
|
||||
thread, as other state machines' events may need to run. State shared
|
||||
between a state machine's threads is synchronised via the monitor owned
|
||||
by its MediaDecoder object.
|
||||
|
||||
The Main thread controls the decode state machine by setting the value
|
||||
of a mPlayState variable and notifying on the monitor based on the
|
||||
high level player actions required (Seek, Pause, Play, etc).
|
||||
|
||||
The player states are the states requested by the client through the
|
||||
DOM API. They represent the desired state of the player, while the
|
||||
decoder's state represents the actual state of the decoder.
|
||||
|
||||
The high level state of the player is maintained via a PlayState value.
|
||||
It can have the following states:
|
||||
|
||||
START
|
||||
The decoder has been initialized but has no resource loaded.
|
||||
PAUSED
|
||||
A request via the API has been received to pause playback.
|
||||
LOADING
|
||||
A request via the API has been received to load a resource.
|
||||
PLAYING
|
||||
A request via the API has been received to start playback.
|
||||
SEEKING
|
||||
A request via the API has been received to start seeking.
|
||||
COMPLETED
|
||||
Playback has completed.
|
||||
SHUTDOWN
|
||||
The decoder is about to be destroyed.
|
||||
|
||||
State transition occurs when the Media Element calls the Play, Seek,
|
||||
etc methods on the MediaDecoder object. When the transition
|
||||
occurs MediaDecoder then calls the methods on the decoder state
|
||||
machine object to cause it to behave as required by the play state.
|
||||
State transitions will likely schedule the state machine to run to
|
||||
affect the change.
|
||||
|
||||
An implementation of the MediaDecoderStateMachine class is the event
|
||||
that gets dispatched to the state machine thread. Each time the event is run,
|
||||
the state machine must cycle the state machine once, and then return.
|
||||
|
||||
The state machine has the following states:
|
||||
|
||||
DECODING_METADATA
|
||||
The media headers are being loaded, and things like framerate, etc are
|
||||
being determined.
|
||||
DECODING_FIRSTFRAME
|
||||
The first frame of audio/video data is being decoded.
|
||||
DECODING
|
||||
The decode has started. If the PlayState is PLAYING, the decode thread
|
||||
should be alive and decoding video and audio frame, the audio thread
|
||||
should be playing audio, and the state machine should run periodically
|
||||
to update the video frames being displayed.
|
||||
SEEKING
|
||||
A seek operation is in progress. The decode thread should be seeking.
|
||||
BUFFERING
|
||||
Decoding is paused while data is buffered for smooth playback. If playback
|
||||
is paused (PlayState transitions to PAUSED) we'll destory the decode thread.
|
||||
COMPLETED
|
||||
The resource has completed decoding, but possibly not finished playback.
|
||||
The decode thread will be destroyed. Once playback finished, the audio
|
||||
thread will also be destroyed.
|
||||
SHUTDOWN
|
||||
The decoder object and its state machine are about to be destroyed.
|
||||
Once the last state machine has been destroyed, the shared state machine
|
||||
thread will also be destroyed. It will be recreated later if needed.
|
||||
|
||||
The following result in state transitions.
|
||||
|
||||
Shutdown()
|
||||
Clean up any resources the MediaDecoderStateMachine owns.
|
||||
Play()
|
||||
Start decoding and playback of media data.
|
||||
Buffer
|
||||
This is not user initiated. It occurs when the
|
||||
available data in the stream drops below a certain point.
|
||||
Complete
|
||||
This is not user initiated. It occurs when the
|
||||
stream is completely decoded.
|
||||
Seek(double)
|
||||
Seek to the time position given in the resource.
|
||||
|
||||
A state transition diagram:
|
||||
|
||||
|---<-- DECODING_METADATA ----->--------|
|
||||
| | |
|
||||
Seek(t) v Shutdown()
|
||||
| | |
|
||||
-->--- DECODING_FIRSTFRAME |------->-----------------|
|
||||
| | |
|
||||
| Shutdown() |
|
||||
| | |
|
||||
v |-->----------------->--------------------------|
|
||||
|---------------->----->------------------------| v
|
||||
DECODING | | | | |
|
||||
^ v Seek(t) | | | |
|
||||
| Play() | v | | |
|
||||
^-----------<----SEEKING | v Complete v v
|
||||
| | | | | |
|
||||
| | | COMPLETED SHUTDOWN-<-|
|
||||
^ ^ | |Shutdown() |
|
||||
| | | >-------->-----^
|
||||
| Play() |Seek(t) |Buffer() |
|
||||
-----------<--------<-------BUFFERING |
|
||||
| ^
|
||||
v Shutdown() |
|
||||
| |
|
||||
------------>-----|
|
||||
|
||||
The following represents the states that the MediaDecoder object
|
||||
can be in, and the valid states the MediaDecoderStateMachine can be in at that
|
||||
time:
|
||||
|
||||
player LOADING decoder DECODING_METADATA, DECODING_FIRSTFRAME
|
||||
player PLAYING decoder DECODING, BUFFERING, SEEKING, COMPLETED
|
||||
player PAUSED decoder DECODING, BUFFERING, SEEKING, COMPLETED
|
||||
player SEEKING decoder SEEKING
|
||||
player COMPLETED decoder SHUTDOWN
|
||||
player SHUTDOWN decoder SHUTDOWN
|
||||
|
||||
The general sequence of events is:
|
||||
|
||||
1) The video element calls Load on MediaDecoder. This creates the
|
||||
state machine and starts the channel for downloading the
|
||||
file. It instantiates and schedules the MediaDecoderStateMachine. The
|
||||
high level LOADING state is entered, which results in the decode
|
||||
thread being created and starting to decode metadata. These are
|
||||
the headers that give the video size, framerate, etc. Load() returns
|
||||
immediately to the calling video element.
|
||||
|
||||
2) When the metadata has been loaded by the decode thread, the state machine
|
||||
will call a method on the video element object to inform it that this
|
||||
step is done, so it can do the things required by the video specification
|
||||
at this stage. The decode thread then continues to decode the first frame
|
||||
of data.
|
||||
|
||||
3) When the first frame of data has been successfully decoded the state
|
||||
machine calls a method on the video element object to inform it that
|
||||
this step has been done, once again so it can do the required things
|
||||
by the video specification at this stage.
|
||||
|
||||
This results in the high level state changing to PLAYING or PAUSED
|
||||
depending on any user action that may have occurred.
|
||||
|
||||
While the play state is PLAYING, the decode thread will decode
|
||||
data, and the audio thread will push audio data to the hardware to
|
||||
be played. The state machine will run periodically on the shared
|
||||
state machine thread to ensure video frames are played at the
|
||||
correct time; i.e. the state machine manages A/V sync.
|
||||
|
||||
The Shutdown method on MediaDecoder closes the download channel, and
|
||||
signals to the state machine that it should shutdown. The state machine
|
||||
shuts down asynchronously, and will release the owning reference to the
|
||||
state machine once its threads are shutdown.
|
||||
|
||||
The owning object of a MediaDecoder object *MUST* call Shutdown when
|
||||
destroying the MediaDecoder object.
|
||||
|
||||
*/
|
||||
#if !defined(MediaDecoder_h_)
|
||||
#define MediaDecoder_h_
|
||||
|
||||
|
@ -501,10 +324,8 @@ public:
|
|||
// media element when it is restored from the bfcache, or when we need
|
||||
// to stop throttling the download. Call on the main thread only.
|
||||
// The download will only actually resume once as many Resume calls
|
||||
// have been made as Suspend calls. When aForceBuffering is true,
|
||||
// we force the decoder to go into buffering state before resuming
|
||||
// playback.
|
||||
virtual void Resume(bool aForceBuffering);
|
||||
// have been made as Suspend calls.
|
||||
virtual void Resume();
|
||||
|
||||
// Moves any existing channel loads into or out of background. Background
|
||||
// loads don't block the load event. This is called when we stop or restart
|
||||
|
|
|
@ -1392,8 +1392,8 @@ void MediaDecoderStateMachine::StartDecoding()
|
|||
}
|
||||
|
||||
// Reset other state to pristine values before starting decode.
|
||||
mIsAudioPrerolling = !DonePrerollingAudio();
|
||||
mIsVideoPrerolling = !DonePrerollingVideo();
|
||||
mIsAudioPrerolling = !DonePrerollingAudio() && !mAudioWaitRequest.Exists();
|
||||
mIsVideoPrerolling = !DonePrerollingVideo() && !mVideoWaitRequest.Exists();
|
||||
|
||||
// Ensure that we've got tasks enqueued to decode data if we need to.
|
||||
DispatchDecodeTasksIfNeeded();
|
||||
|
@ -2679,6 +2679,10 @@ void MediaDecoderStateMachine::StartBuffering()
|
|||
return;
|
||||
}
|
||||
|
||||
// Update playback position again before entering BUFFERING so the currentTime
|
||||
// of the media element is more accurate during buffering.
|
||||
UpdatePlaybackPositionPeriodically();
|
||||
|
||||
if (IsPlaying()) {
|
||||
StopPlayback();
|
||||
}
|
||||
|
@ -2768,6 +2772,13 @@ MediaDecoderStateMachine::LogicalPlaybackRateChanged()
|
|||
mPlaybackRate = mLogicalPlaybackRate;
|
||||
mMediaSink->SetPlaybackRate(mPlaybackRate);
|
||||
|
||||
if (mIsAudioPrerolling && DonePrerollingAudio()) {
|
||||
StopPrerollingAudio();
|
||||
}
|
||||
if (mIsVideoPrerolling && DonePrerollingVideo()) {
|
||||
StopPrerollingVideo();
|
||||
}
|
||||
|
||||
ScheduleStateMachine();
|
||||
}
|
||||
|
||||
|
|
|
@ -170,13 +170,6 @@ public:
|
|||
|
||||
RefPtr<ShutdownPromise> BeginShutdown();
|
||||
|
||||
void DispatchStartBuffering()
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethod(this, &MediaDecoderStateMachine::StartBuffering);
|
||||
OwnerThread()->Dispatch(runnable.forget());
|
||||
}
|
||||
|
||||
// Notifies the state machine that should minimize the number of samples
|
||||
// decoded we preroll, until playback starts. The first time playback starts
|
||||
// the state machine is free to return to prerolling normally. Note
|
||||
|
|
|
@ -270,6 +270,8 @@ MediaFormatReader::OnDemuxerInitDone(nsresult)
|
|||
|
||||
mDemuxerInitDone = true;
|
||||
|
||||
UniquePtr<MetadataTags> tags(MakeUnique<MetadataTags>());
|
||||
|
||||
// To decode, we need valid video and a place to put it.
|
||||
bool videoActive = !!mDemuxer->GetNumberTracks(TrackInfo::kVideoTrack) &&
|
||||
GetImageContainer();
|
||||
|
@ -282,6 +284,10 @@ MediaFormatReader::OnDemuxerInitDone(nsresult)
|
|||
return;
|
||||
}
|
||||
mInfo.mVideo = *mVideo.mTrackDemuxer->GetInfo()->GetAsVideoInfo();
|
||||
UniquePtr<TrackInfo> info(mVideo.mTrackDemuxer->GetInfo());
|
||||
for (const MetadataTag& tag : info->mTags) {
|
||||
tags->Put(tag.mKey, tag.mValue);
|
||||
}
|
||||
mVideo.mCallback = new DecoderCallback(this, TrackInfo::kVideoTrack);
|
||||
mVideo.mTimeRanges = mVideo.mTrackDemuxer->GetBuffered();
|
||||
mTrackDemuxersMayBlock |= mVideo.mTrackDemuxer->GetSamplesMayBlock();
|
||||
|
@ -295,6 +301,10 @@ MediaFormatReader::OnDemuxerInitDone(nsresult)
|
|||
return;
|
||||
}
|
||||
mInfo.mAudio = *mAudio.mTrackDemuxer->GetInfo()->GetAsAudioInfo();
|
||||
UniquePtr<TrackInfo> info(mAudio.mTrackDemuxer->GetInfo());
|
||||
for (const MetadataTag& tag : info->mTags) {
|
||||
tags->Put(tag.mKey, tag.mValue);
|
||||
}
|
||||
mAudio.mCallback = new DecoderCallback(this, TrackInfo::kAudioTrack);
|
||||
mAudio.mTimeRanges = mAudio.mTrackDemuxer->GetBuffered();
|
||||
mTrackDemuxersMayBlock |= mAudio.mTrackDemuxer->GetSamplesMayBlock();
|
||||
|
|
|
@ -23,6 +23,17 @@ class AudioInfo;
|
|||
class VideoInfo;
|
||||
class TextInfo;
|
||||
|
||||
class MetadataTag {
|
||||
public:
|
||||
MetadataTag(const nsACString& aKey,
|
||||
const nsACString& aValue)
|
||||
: mKey(aKey)
|
||||
, mValue(aValue)
|
||||
{}
|
||||
nsCString mKey;
|
||||
nsCString mValue;
|
||||
};
|
||||
|
||||
class TrackInfo {
|
||||
public:
|
||||
enum TrackType {
|
||||
|
@ -80,6 +91,8 @@ public:
|
|||
int64_t mMediaTime;
|
||||
CryptoTrack mCrypto;
|
||||
|
||||
nsTArray<MetadataTag> mTags;
|
||||
|
||||
// True if the track is gonna be (decrypted)/decoded and
|
||||
// rendered directly by non-gecko components.
|
||||
bool mIsRenderedExternally;
|
||||
|
@ -150,6 +163,7 @@ protected:
|
|||
mCrypto = aOther.mCrypto;
|
||||
mIsRenderedExternally = aOther.mIsRenderedExternally;
|
||||
mType = aOther.mType;
|
||||
mTags = aOther.mTags;
|
||||
MOZ_COUNT_CTOR(TrackInfo);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,8 +44,8 @@ FFmpegAudioDecoder<LIBAV_VER>::InitCodecContext()
|
|||
// isn't implemented.
|
||||
mCodecContext->thread_count = 1;
|
||||
// FFmpeg takes this as a suggestion for what format to use for audio samples.
|
||||
uint32_t major, minor;
|
||||
FFmpegRuntimeLinker::GetVersion(major, minor);
|
||||
uint32_t major, minor, micro;
|
||||
FFmpegRuntimeLinker::GetVersion(major, minor, micro);
|
||||
// LibAV 0.8 produces rubbish float interleaved samples, request 16 bits audio.
|
||||
mCodecContext->request_sample_fmt =
|
||||
(major == 53) ? AV_SAMPLE_FMT_S16 : AV_SAMPLE_FMT_FLT;
|
||||
|
|
|
@ -11,11 +11,9 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "FFmpegLibs.h"
|
||||
#include "FFmpegLog.h"
|
||||
#include "FFmpegDataDecoder.h"
|
||||
#include "prsystem.h"
|
||||
#include "FFmpegRuntimeLinker.h"
|
||||
|
||||
namespace mozilla
|
||||
{
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "PlatformDecoderModule.h"
|
||||
#include "FFmpegLibs.h"
|
||||
#include "FFmpegRuntimeLinker.h"
|
||||
#include "mozilla/StaticMutex.h"
|
||||
|
||||
namespace mozilla
|
||||
|
|
|
@ -2,36 +2,24 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// A value of 0 indicates that the entry is located in libavcodec.dll
|
||||
// A negative value indicates that the entry is to always be loaded from
|
||||
// libavutil.dll, regardless of the version.
|
||||
// A positive value indicates that it is to be loaded from libavutil
|
||||
// and in that version only.
|
||||
#define AV_FUNC_AVCODEC_ALL 0
|
||||
#define AV_FUNC_AVUTIL_ALL (-1)
|
||||
|
||||
/* libavcodec */
|
||||
AV_FUNC(avcodec_align_dimensions2, AV_FUNC_AVCODEC_ALL)
|
||||
AV_FUNC(avcodec_get_frame_defaults, AV_FUNC_AVCODEC_ALL)
|
||||
AV_FUNC(avcodec_alloc_context3, AV_FUNC_AVCODEC_ALL)
|
||||
AV_FUNC(avcodec_close, AV_FUNC_AVCODEC_ALL)
|
||||
AV_FUNC(avcodec_decode_audio4, AV_FUNC_AVCODEC_ALL)
|
||||
AV_FUNC(avcodec_decode_video2, AV_FUNC_AVCODEC_ALL)
|
||||
AV_FUNC(avcodec_default_get_buffer, AV_FUNC_AVCODEC_ALL)
|
||||
AV_FUNC(avcodec_default_release_buffer, AV_FUNC_AVCODEC_ALL)
|
||||
AV_FUNC(avcodec_find_decoder, AV_FUNC_AVCODEC_ALL)
|
||||
AV_FUNC(avcodec_flush_buffers, AV_FUNC_AVCODEC_ALL)
|
||||
AV_FUNC(avcodec_alloc_context3, AV_FUNC_AVCODEC_ALL)
|
||||
AV_FUNC(avcodec_get_edge_width, AV_FUNC_AVCODEC_ALL)
|
||||
AV_FUNC(avcodec_open2, AV_FUNC_AVCODEC_ALL)
|
||||
AV_FUNC(avcodec_register_all, AV_FUNC_AVCODEC_ALL)
|
||||
AV_FUNC(av_init_packet, AV_FUNC_AVCODEC_ALL)
|
||||
AV_FUNC(av_parser_init, AV_FUNC_AVCODEC_ALL)
|
||||
AV_FUNC(av_parser_close, AV_FUNC_AVCODEC_ALL)
|
||||
AV_FUNC(av_parser_parse2, AV_FUNC_AVCODEC_ALL)
|
||||
AV_FUNC(avcodec_register_all, AV_FUNC_AVCODEC_ALL)
|
||||
#if LIBAVCODEC_VERSION_MAJOR <= 54 || defined(LIBAVCODEC_ALLVERSION)
|
||||
AV_FUNC(avcodec_get_frame_defaults, (AV_FUNC_53 | AV_FUNC_54))
|
||||
#endif
|
||||
|
||||
/* libavutil */
|
||||
AV_FUNC(av_image_fill_linesizes, AV_FUNC_AVUTIL_ALL)
|
||||
AV_FUNC(av_image_fill_pointers, AV_FUNC_AVUTIL_ALL)
|
||||
AV_FUNC(av_log_set_level, AV_FUNC_AVUTIL_ALL)
|
||||
AV_FUNC(av_malloc, AV_FUNC_AVUTIL_ALL)
|
||||
AV_FUNC(av_freep, AV_FUNC_AVUTIL_ALL)
|
||||
|
@ -39,13 +27,13 @@ AV_FUNC(av_freep, AV_FUNC_AVUTIL_ALL)
|
|||
#if defined(LIBAVCODEC_VERSION_MAJOR) || defined(LIBAVCODEC_ALLVERSION)
|
||||
#if LIBAVCODEC_VERSION_MAJOR == 54 || defined(LIBAVCODEC_ALLVERSION)
|
||||
/* libavutil v54 only */
|
||||
AV_FUNC(avcodec_alloc_frame, 54)
|
||||
AV_FUNC(avcodec_free_frame, 54)
|
||||
AV_FUNC(avcodec_alloc_frame, AV_FUNC_AVUTIL_54)
|
||||
AV_FUNC(avcodec_free_frame, AV_FUNC_AVUTIL_54)
|
||||
#endif
|
||||
#if LIBAVCODEC_VERSION_MAJOR >= 55 || defined(LIBAVCODEC_ALLVERSION)
|
||||
/* libavutil v55 only */
|
||||
AV_FUNC(av_frame_alloc, 55)
|
||||
AV_FUNC(av_frame_free, 55)
|
||||
AV_FUNC(av_frame_unref, 55)
|
||||
/* libavutil v55 and later only */
|
||||
AV_FUNC(av_frame_alloc, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57))
|
||||
AV_FUNC(av_frame_free, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57))
|
||||
AV_FUNC(av_frame_unref, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57))
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -16,6 +16,14 @@
|
|||
#include "FFmpegLog.h"
|
||||
#include "mozilla/PodOperations.h"
|
||||
|
||||
#include "libavutil/pixfmt.h"
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 54
|
||||
#define AVPixelFormat PixelFormat
|
||||
#define AV_PIX_FMT_YUV420P PIX_FMT_YUV420P
|
||||
#define AV_PIX_FMT_YUVJ420P PIX_FMT_YUVJ420P
|
||||
#define AV_PIX_FMT_NONE PIX_FMT_NONE
|
||||
#endif
|
||||
|
||||
typedef mozilla::layers::Image Image;
|
||||
typedef mozilla::layers::PlanarYCbCrImage PlanarYCbCrImage;
|
||||
|
||||
|
@ -28,19 +36,19 @@ namespace mozilla
|
|||
* For now, we just look for YUV420P as it is the only non-HW accelerated format
|
||||
* supported by FFmpeg's H264 decoder.
|
||||
*/
|
||||
static PixelFormat
|
||||
ChoosePixelFormat(AVCodecContext* aCodecContext, const PixelFormat* aFormats)
|
||||
static AVPixelFormat
|
||||
ChoosePixelFormat(AVCodecContext* aCodecContext, const AVPixelFormat* aFormats)
|
||||
{
|
||||
FFMPEG_LOG("Choosing FFmpeg pixel format for video decoding.");
|
||||
for (; *aFormats > -1; aFormats++) {
|
||||
if (*aFormats == PIX_FMT_YUV420P || *aFormats == PIX_FMT_YUVJ420P) {
|
||||
if (*aFormats == AV_PIX_FMT_YUV420P || *aFormats == AV_PIX_FMT_YUVJ420P) {
|
||||
FFMPEG_LOG("Requesting pixel format YUV420P.");
|
||||
return PIX_FMT_YUV420P;
|
||||
return AV_PIX_FMT_YUV420P;
|
||||
}
|
||||
}
|
||||
|
||||
NS_WARNING("FFmpeg does not share any supported pixel formats.");
|
||||
return PIX_FMT_NONE;
|
||||
return AV_PIX_FMT_NONE;
|
||||
}
|
||||
|
||||
FFmpegH264Decoder<LIBAV_VER>::PtsCorrectionContext::PtsCorrectionContext()
|
||||
|
@ -117,17 +125,20 @@ FFmpegH264Decoder<LIBAV_VER>::InitCodecContext()
|
|||
// We use the same logic as libvpx in determining the number of threads to use
|
||||
// so that we end up behaving in the same fashion when using ffmpeg as
|
||||
// we would otherwise cause various crashes (see bug 1236167)
|
||||
int decode_threads = 2;
|
||||
if (mCodecID != AV_CODEC_ID_VP8) {
|
||||
if (mDisplay.width >= 2048) {
|
||||
decode_threads = 8;
|
||||
} else if (mDisplay.width >= 1024) {
|
||||
decode_threads = 4;
|
||||
}
|
||||
int decode_threads = 1;
|
||||
if (mDisplay.width >= 2048) {
|
||||
decode_threads = 8;
|
||||
} else if (mDisplay.width >= 1024) {
|
||||
decode_threads = 4;
|
||||
} else if (mDisplay.width >= 320) {
|
||||
decode_threads = 2;
|
||||
}
|
||||
|
||||
decode_threads = std::min(decode_threads, PR_GetNumberOfProcessors());
|
||||
mCodecContext->thread_count = decode_threads;
|
||||
mCodecContext->thread_type = FF_THREAD_SLICE | FF_THREAD_FRAME;
|
||||
if (decode_threads > 1) {
|
||||
mCodecContext->thread_type = FF_THREAD_SLICE | FF_THREAD_FRAME;
|
||||
}
|
||||
|
||||
// FFmpeg will call back to this to negotiate a video pixel format.
|
||||
mCodecContext->get_format = ChoosePixelFormat;
|
||||
|
|
|
@ -14,8 +14,8 @@ extern "C" {
|
|||
#pragma GCC visibility push(default)
|
||||
#endif
|
||||
#include "libavcodec/avcodec.h"
|
||||
#include "libavformat/avformat.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libavutil/avutil.h"
|
||||
#include "libavutil/mem.h"
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC visibility pop
|
||||
#endif
|
||||
|
@ -31,7 +31,7 @@ extern "C" {
|
|||
typedef CodecID AVCodecID;
|
||||
#endif
|
||||
|
||||
enum { LIBAV_VER = LIBAVFORMAT_VERSION_MAJOR };
|
||||
enum { LIBAV_VER = LIBAVCODEC_VERSION_MAJOR };
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#if defined(XP_WIN)
|
||||
#include "libavcodec/avcodec.h"
|
||||
#include "libavutil/avutil.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla
|
||||
|
@ -31,44 +30,44 @@ public:
|
|||
|
||||
static const char* sLibs[] = {
|
||||
#if defined(XP_DARWIN)
|
||||
"libavcodec.57.dylib",
|
||||
"libavcodec.56.dylib",
|
||||
"libavcodec.55.dylib",
|
||||
"libavcodec.54.dylib",
|
||||
"libavcodec.53.dylib",
|
||||
#if defined(MOZ_FFVPX)
|
||||
"libmozavcodec.dylib"
|
||||
#endif
|
||||
#elif defined(XP_WIN)
|
||||
#if defined(MOZ_FFVPX)
|
||||
"mozavcodec.dll"
|
||||
#endif
|
||||
#else
|
||||
"libavcodec-ffmpeg.so.57",
|
||||
"libavcodec-ffmpeg.so.56",
|
||||
"libavcodec.so.57",
|
||||
"libavcodec.so.56",
|
||||
"libavcodec.so.55",
|
||||
"libavcodec.so.54",
|
||||
"libavcodec.so.53",
|
||||
#if defined(MOZ_FFVPX)
|
||||
"libmozavcodec.so"
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
PRLibrary* FFmpegRuntimeLinker::sLinkedLib = nullptr;
|
||||
PRLibrary* FFmpegRuntimeLinker::sLinkedUtilLib = nullptr;
|
||||
const char* FFmpegRuntimeLinker::sLib = nullptr;
|
||||
static unsigned (*avcodec_version)() = nullptr;
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define AV_FUNC(func, ver) void (*func)();
|
||||
#define LIBAVCODEC_ALLVERSION
|
||||
#else
|
||||
#define AV_FUNC(func, ver) decltype(func)* func;
|
||||
#endif
|
||||
#define LIBAVCODEC_ALLVERSION
|
||||
#include "FFmpegFunctionList.h"
|
||||
#undef LIBAVCODEC_ALLVERSION
|
||||
#undef AV_FUNC
|
||||
|
||||
static PRLibrary*
|
||||
MozAVLink(const char* aName)
|
||||
{
|
||||
PRLibSpec lspec;
|
||||
lspec.type = PR_LibSpec_Pathname;
|
||||
lspec.value.pathname = aName;
|
||||
return PR_LoadLibraryWithFlags(lspec, PR_LD_NOW | PR_LD_LOCAL);
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
FFmpegRuntimeLinker::Link()
|
||||
{
|
||||
|
@ -80,24 +79,10 @@ FFmpegRuntimeLinker::Link()
|
|||
|
||||
for (size_t i = 0; i < ArrayLength(sLibs); i++) {
|
||||
const char* lib = sLibs[i];
|
||||
PRLibSpec lspec;
|
||||
lspec.type = PR_LibSpec_Pathname;
|
||||
lspec.value.pathname = lib;
|
||||
sLinkedLib = PR_LoadLibraryWithFlags(lspec, PR_LD_NOW | PR_LD_LOCAL);
|
||||
#if defined(XP_WIN) && defined(MOZ_FFVPX)
|
||||
// Unlike Unix, Linux and Mac ; loading libavcodec doesn't automatically
|
||||
// load libavutil even though libavcodec depends on it.
|
||||
// So manually load it.
|
||||
PRLibSpec lspec2;
|
||||
lspec2.type = PR_LibSpec_Pathname;
|
||||
lspec2.value.pathname = "mozavutil.dll";
|
||||
sLinkedUtilLib = PR_LoadLibraryWithFlags(lspec2, PR_LD_NOW | PR_LD_LOCAL);
|
||||
#else
|
||||
sLinkedUtilLib = sLinkedLib;
|
||||
#endif
|
||||
if (sLinkedLib && sLinkedUtilLib) {
|
||||
sLinkedLib = MozAVLink(lib);
|
||||
if (sLinkedLib) {
|
||||
sLinkedUtilLib = sLinkedLib;
|
||||
if (Bind(lib)) {
|
||||
sLib = lib;
|
||||
sLinkStatus = LinkStatus_SUCCEEDED;
|
||||
return true;
|
||||
}
|
||||
|
@ -112,6 +97,25 @@ FFmpegRuntimeLinker::Link()
|
|||
}
|
||||
FFMPEG_LOG(" ]\n");
|
||||
|
||||
#ifdef MOZ_FFVPX
|
||||
char* libname = NULL;
|
||||
/* Get the platform-dependent library name of the module */
|
||||
libname = PR_GetLibraryName(nullptr, "mozavutil");
|
||||
MOZ_ASSERT(libname);
|
||||
sLinkedUtilLib = MozAVLink(libname);
|
||||
PR_FreeLibraryName(libname);
|
||||
libname = PR_GetLibraryName(nullptr, "mozavcodec");
|
||||
MOZ_ASSERT(libname);
|
||||
sLinkedLib = MozAVLink(libname);
|
||||
PR_FreeLibraryName(libname);
|
||||
if (sLinkedLib && sLinkedUtilLib) {
|
||||
if (Bind("mozavcodec")) {
|
||||
sLinkStatus = LinkStatus_SUCCEEDED;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Unlink();
|
||||
|
||||
sLinkStatus = LinkStatus_FAILED;
|
||||
|
@ -123,26 +127,49 @@ FFmpegRuntimeLinker::Bind(const char* aLibName)
|
|||
{
|
||||
avcodec_version = (decltype(avcodec_version))PR_FindSymbol(sLinkedLib,
|
||||
"avcodec_version");
|
||||
uint32_t major, minor;
|
||||
if (!GetVersion(major, minor)) {
|
||||
uint32_t major, minor, micro;
|
||||
if (!GetVersion(major, minor, micro)) {
|
||||
return false;
|
||||
}
|
||||
if (major > 55) {
|
||||
// All major greater than 56 currently use the same ABI as 55.
|
||||
major = 55;
|
||||
|
||||
int version;
|
||||
switch (major) {
|
||||
case 53:
|
||||
version = AV_FUNC_53;
|
||||
break;
|
||||
case 54:
|
||||
version = AV_FUNC_54;
|
||||
break;
|
||||
case 56:
|
||||
// We use libavcodec 55 code instead. Fallback
|
||||
case 55:
|
||||
version = AV_FUNC_55;
|
||||
break;
|
||||
case 57:
|
||||
if (micro != 100) {
|
||||
// a micro version of 100 indicates that it's FFmpeg (as opposed to LibAV.
|
||||
// Due to current AVCodecContext binary incompatibility we can only
|
||||
// support FFmpeg at this stage.
|
||||
return false;
|
||||
}
|
||||
version = AV_FUNC_57;
|
||||
break;
|
||||
default:
|
||||
// Not supported at this stage.
|
||||
return false;
|
||||
}
|
||||
|
||||
#define LIBAVCODEC_ALLVERSION
|
||||
#define AV_FUNC(func, ver) \
|
||||
if (ver <= 0 || ver == major) { \
|
||||
if (!(func = (decltype(func))PR_FindSymbol(ver != 0 ? sLinkedUtilLib : sLinkedLib, #func))) { \
|
||||
if ((ver) & version) { \
|
||||
if (!(func = (decltype(func))PR_FindSymbol(((ver) & AV_FUNC_AVUTIL_MASK) ? sLinkedUtilLib : sLinkedLib, #func))) { \
|
||||
FFMPEG_LOG("Couldn't load function " #func " from %s.", aLibName); \
|
||||
return false; \
|
||||
} \
|
||||
} else { \
|
||||
func = (decltype(func))nullptr; \
|
||||
}
|
||||
#include "FFmpegFunctionList.h"
|
||||
#undef AV_FUNC
|
||||
#undef LIBAVCODEC_ALLVERSION
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -152,8 +179,8 @@ FFmpegRuntimeLinker::CreateDecoderModule()
|
|||
if (!Link()) {
|
||||
return nullptr;
|
||||
}
|
||||
uint32_t major, minor;
|
||||
if (!GetVersion(major, minor)) {
|
||||
uint32_t major, minor, micro;
|
||||
if (!GetVersion(major, minor, micro)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -162,9 +189,11 @@ FFmpegRuntimeLinker::CreateDecoderModule()
|
|||
#ifndef XP_WIN
|
||||
case 53: module = FFmpegDecoderModule<53>::Create(); break;
|
||||
case 54: module = FFmpegDecoderModule<54>::Create(); break;
|
||||
#endif
|
||||
case 55:
|
||||
default: module = FFmpegDecoderModule<55>::Create(); break;
|
||||
case 56: module = FFmpegDecoderModule<55>::Create(); break;
|
||||
#endif
|
||||
case 57: module = FFmpegDecoderModule<57>::Create(); break;
|
||||
default: module = nullptr;
|
||||
}
|
||||
return module.forget();
|
||||
}
|
||||
|
@ -178,7 +207,6 @@ FFmpegRuntimeLinker::Unlink()
|
|||
if (sLinkedLib) {
|
||||
PR_UnloadLibrary(sLinkedLib);
|
||||
sLinkedLib = nullptr;
|
||||
sLib = nullptr;
|
||||
sLinkStatus = LinkStatus_INIT;
|
||||
avcodec_version = nullptr;
|
||||
}
|
||||
|
@ -186,7 +214,7 @@ FFmpegRuntimeLinker::Unlink()
|
|||
}
|
||||
|
||||
/* static */ bool
|
||||
FFmpegRuntimeLinker::GetVersion(uint32_t& aMajor, uint32_t& aMinor)
|
||||
FFmpegRuntimeLinker::GetVersion(uint32_t& aMajor, uint32_t& aMinor, uint32_t& aMicro)
|
||||
{
|
||||
if (!avcodec_version) {
|
||||
return false;
|
||||
|
@ -194,7 +222,9 @@ FFmpegRuntimeLinker::GetVersion(uint32_t& aMajor, uint32_t& aMinor)
|
|||
uint32_t version = avcodec_version();
|
||||
aMajor = (version >> 16) & 0xff;
|
||||
aMinor = (version >> 8) & 0xff;
|
||||
aMicro = version & 0xff;
|
||||
return true;
|
||||
}
|
||||
|
||||
#undef LIBAVCODEC_ALLVERSION
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -15,18 +15,33 @@ struct PRLibrary;
|
|||
namespace mozilla
|
||||
{
|
||||
|
||||
enum {
|
||||
AV_FUNC_AVUTIL_MASK = 1 << 8,
|
||||
AV_FUNC_53 = 1 << 0,
|
||||
AV_FUNC_54 = 1 << 1,
|
||||
AV_FUNC_55 = 1 << 2,
|
||||
AV_FUNC_56 = 1 << 3,
|
||||
AV_FUNC_57 = 1 << 4,
|
||||
AV_FUNC_AVUTIL_53 = AV_FUNC_53 | AV_FUNC_AVUTIL_MASK,
|
||||
AV_FUNC_AVUTIL_54 = AV_FUNC_54 | AV_FUNC_AVUTIL_MASK,
|
||||
AV_FUNC_AVUTIL_55 = AV_FUNC_55 | AV_FUNC_AVUTIL_MASK,
|
||||
AV_FUNC_AVUTIL_56 = AV_FUNC_56 | AV_FUNC_AVUTIL_MASK,
|
||||
AV_FUNC_AVUTIL_57 = AV_FUNC_57 | AV_FUNC_AVUTIL_MASK,
|
||||
AV_FUNC_AVCODEC_ALL = AV_FUNC_53 | AV_FUNC_54 | AV_FUNC_55 | AV_FUNC_56 | AV_FUNC_57,
|
||||
AV_FUNC_AVUTIL_ALL = AV_FUNC_AVCODEC_ALL | AV_FUNC_AVUTIL_MASK
|
||||
};
|
||||
|
||||
class FFmpegRuntimeLinker
|
||||
{
|
||||
public:
|
||||
static bool Link();
|
||||
static void Unlink();
|
||||
static already_AddRefed<PlatformDecoderModule> CreateDecoderModule();
|
||||
static bool GetVersion(uint32_t& aMajor, uint32_t& aMinor);
|
||||
static bool GetVersion(uint32_t& aMajor, uint32_t& aMinor, uint32_t& aMicro);
|
||||
|
||||
private:
|
||||
static PRLibrary* sLinkedLib;
|
||||
static PRLibrary* sLinkedUtilLib;
|
||||
static const char* sLib;
|
||||
|
||||
static bool Bind(const char* aLibName);
|
||||
|
||||
|
|
|
@ -0,0 +1,504 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
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 and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, 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 library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete 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 distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
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 Library or any portion
|
||||
of it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
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 Library, 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 Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you 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.
|
||||
|
||||
If distribution of 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 satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be 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.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library 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.
|
||||
|
||||
9. 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 Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
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 with
|
||||
this License.
|
||||
|
||||
11. 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 Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library 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 Library.
|
||||
|
||||
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.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library 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.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser 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 Library
|
||||
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 Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
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
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "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
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. 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 LIBRARY 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
|
||||
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), 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 Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. 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 library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,189 @@
|
|||
/*
|
||||
* Video Acceleration API (shared data between FFmpeg and the video player)
|
||||
* HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1
|
||||
*
|
||||
* Copyright (C) 2008-2009 Splitted-Desktop Systems
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_VAAPI_H
|
||||
#define AVCODEC_VAAPI_H
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @ingroup lavc_codec_hwaccel_vaapi
|
||||
* Public libavcodec VA API header.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "libavutil/attributes.h"
|
||||
#include "version.h"
|
||||
|
||||
/**
|
||||
* @defgroup lavc_codec_hwaccel_vaapi VA API Decoding
|
||||
* @ingroup lavc_codec_hwaccel
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* This structure is used to share data between the FFmpeg library and
|
||||
* the client video application.
|
||||
* This shall be zero-allocated and available as
|
||||
* AVCodecContext.hwaccel_context. All user members can be set once
|
||||
* during initialization or through each AVCodecContext.get_buffer()
|
||||
* function call. In any case, they must be valid prior to calling
|
||||
* decoding functions.
|
||||
*/
|
||||
struct vaapi_context {
|
||||
/**
|
||||
* Window system dependent data
|
||||
*
|
||||
* - encoding: unused
|
||||
* - decoding: Set by user
|
||||
*/
|
||||
void *display;
|
||||
|
||||
/**
|
||||
* Configuration ID
|
||||
*
|
||||
* - encoding: unused
|
||||
* - decoding: Set by user
|
||||
*/
|
||||
uint32_t config_id;
|
||||
|
||||
/**
|
||||
* Context ID (video decode pipeline)
|
||||
*
|
||||
* - encoding: unused
|
||||
* - decoding: Set by user
|
||||
*/
|
||||
uint32_t context_id;
|
||||
|
||||
#if FF_API_VAAPI_CONTEXT
|
||||
/**
|
||||
* VAPictureParameterBuffer ID
|
||||
*
|
||||
* - encoding: unused
|
||||
* - decoding: Set by libavcodec
|
||||
*/
|
||||
attribute_deprecated
|
||||
uint32_t pic_param_buf_id;
|
||||
|
||||
/**
|
||||
* VAIQMatrixBuffer ID
|
||||
*
|
||||
* - encoding: unused
|
||||
* - decoding: Set by libavcodec
|
||||
*/
|
||||
attribute_deprecated
|
||||
uint32_t iq_matrix_buf_id;
|
||||
|
||||
/**
|
||||
* VABitPlaneBuffer ID (for VC-1 decoding)
|
||||
*
|
||||
* - encoding: unused
|
||||
* - decoding: Set by libavcodec
|
||||
*/
|
||||
attribute_deprecated
|
||||
uint32_t bitplane_buf_id;
|
||||
|
||||
/**
|
||||
* Slice parameter/data buffer IDs
|
||||
*
|
||||
* - encoding: unused
|
||||
* - decoding: Set by libavcodec
|
||||
*/
|
||||
attribute_deprecated
|
||||
uint32_t *slice_buf_ids;
|
||||
|
||||
/**
|
||||
* Number of effective slice buffer IDs to send to the HW
|
||||
*
|
||||
* - encoding: unused
|
||||
* - decoding: Set by libavcodec
|
||||
*/
|
||||
attribute_deprecated
|
||||
unsigned int n_slice_buf_ids;
|
||||
|
||||
/**
|
||||
* Size of pre-allocated slice_buf_ids
|
||||
*
|
||||
* - encoding: unused
|
||||
* - decoding: Set by libavcodec
|
||||
*/
|
||||
attribute_deprecated
|
||||
unsigned int slice_buf_ids_alloc;
|
||||
|
||||
/**
|
||||
* Pointer to VASliceParameterBuffers
|
||||
*
|
||||
* - encoding: unused
|
||||
* - decoding: Set by libavcodec
|
||||
*/
|
||||
attribute_deprecated
|
||||
void *slice_params;
|
||||
|
||||
/**
|
||||
* Size of a VASliceParameterBuffer element
|
||||
*
|
||||
* - encoding: unused
|
||||
* - decoding: Set by libavcodec
|
||||
*/
|
||||
attribute_deprecated
|
||||
unsigned int slice_param_size;
|
||||
|
||||
/**
|
||||
* Size of pre-allocated slice_params
|
||||
*
|
||||
* - encoding: unused
|
||||
* - decoding: Set by libavcodec
|
||||
*/
|
||||
attribute_deprecated
|
||||
unsigned int slice_params_alloc;
|
||||
|
||||
/**
|
||||
* Number of slices currently filled in
|
||||
*
|
||||
* - encoding: unused
|
||||
* - decoding: Set by libavcodec
|
||||
*/
|
||||
attribute_deprecated
|
||||
unsigned int slice_count;
|
||||
|
||||
/**
|
||||
* Pointer to slice data buffer base
|
||||
* - encoding: unused
|
||||
* - decoding: Set by libavcodec
|
||||
*/
|
||||
attribute_deprecated
|
||||
const uint8_t *slice_data;
|
||||
|
||||
/**
|
||||
* Current size of slice data
|
||||
*
|
||||
* - encoding: unused
|
||||
* - decoding: Set by libavcodec
|
||||
*/
|
||||
attribute_deprecated
|
||||
uint32_t slice_data_size;
|
||||
#endif
|
||||
};
|
||||
|
||||
/* @} */
|
||||
|
||||
#endif /* AVCODEC_VAAPI_H */
|
|
@ -0,0 +1,253 @@
|
|||
/*
|
||||
* The Video Decode and Presentation API for UNIX (VDPAU) is used for
|
||||
* hardware-accelerated decoding of MPEG-1/2, H.264 and VC-1.
|
||||
*
|
||||
* Copyright (C) 2008 NVIDIA
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_VDPAU_H
|
||||
#define AVCODEC_VDPAU_H
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @ingroup lavc_codec_hwaccel_vdpau
|
||||
* Public libavcodec VDPAU header.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup lavc_codec_hwaccel_vdpau VDPAU Decoder and Renderer
|
||||
* @ingroup lavc_codec_hwaccel
|
||||
*
|
||||
* VDPAU hardware acceleration has two modules
|
||||
* - VDPAU decoding
|
||||
* - VDPAU presentation
|
||||
*
|
||||
* The VDPAU decoding module parses all headers using FFmpeg
|
||||
* parsing mechanisms and uses VDPAU for the actual decoding.
|
||||
*
|
||||
* As per the current implementation, the actual decoding
|
||||
* and rendering (API calls) are done as part of the VDPAU
|
||||
* presentation (vo_vdpau.c) module.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include <vdpau/vdpau.h>
|
||||
#include <vdpau/vdpau_x11.h>
|
||||
#include "libavutil/avconfig.h"
|
||||
#include "libavutil/attributes.h"
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "version.h"
|
||||
|
||||
#if FF_API_BUFS_VDPAU
|
||||
union AVVDPAUPictureInfo {
|
||||
VdpPictureInfoH264 h264;
|
||||
VdpPictureInfoMPEG1Or2 mpeg;
|
||||
VdpPictureInfoVC1 vc1;
|
||||
VdpPictureInfoMPEG4Part2 mpeg4;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct AVCodecContext;
|
||||
struct AVFrame;
|
||||
|
||||
typedef int (*AVVDPAU_Render2)(struct AVCodecContext *, struct AVFrame *,
|
||||
const VdpPictureInfo *, uint32_t,
|
||||
const VdpBitstreamBuffer *);
|
||||
|
||||
/**
|
||||
* This structure is used to share data between the libavcodec library and
|
||||
* the client video application.
|
||||
* The user shall allocate the structure via the av_alloc_vdpau_hwaccel
|
||||
* function and make it available as
|
||||
* AVCodecContext.hwaccel_context. Members can be set by the user once
|
||||
* during initialization or through each AVCodecContext.get_buffer()
|
||||
* function call. In any case, they must be valid prior to calling
|
||||
* decoding functions.
|
||||
*
|
||||
* The size of this structure is not a part of the public ABI and must not
|
||||
* be used outside of libavcodec. Use av_vdpau_alloc_context() to allocate an
|
||||
* AVVDPAUContext.
|
||||
*/
|
||||
typedef struct AVVDPAUContext {
|
||||
/**
|
||||
* VDPAU decoder handle
|
||||
*
|
||||
* Set by user.
|
||||
*/
|
||||
VdpDecoder decoder;
|
||||
|
||||
/**
|
||||
* VDPAU decoder render callback
|
||||
*
|
||||
* Set by the user.
|
||||
*/
|
||||
VdpDecoderRender *render;
|
||||
|
||||
#if FF_API_BUFS_VDPAU
|
||||
/**
|
||||
* VDPAU picture information
|
||||
*
|
||||
* Set by libavcodec.
|
||||
*/
|
||||
attribute_deprecated
|
||||
union AVVDPAUPictureInfo info;
|
||||
|
||||
/**
|
||||
* Allocated size of the bitstream_buffers table.
|
||||
*
|
||||
* Set by libavcodec.
|
||||
*/
|
||||
attribute_deprecated
|
||||
int bitstream_buffers_allocated;
|
||||
|
||||
/**
|
||||
* Useful bitstream buffers in the bitstream buffers table.
|
||||
*
|
||||
* Set by libavcodec.
|
||||
*/
|
||||
attribute_deprecated
|
||||
int bitstream_buffers_used;
|
||||
|
||||
/**
|
||||
* Table of bitstream buffers.
|
||||
* The user is responsible for freeing this buffer using av_freep().
|
||||
*
|
||||
* Set by libavcodec.
|
||||
*/
|
||||
attribute_deprecated
|
||||
VdpBitstreamBuffer *bitstream_buffers;
|
||||
#endif
|
||||
AVVDPAU_Render2 render2;
|
||||
} AVVDPAUContext;
|
||||
|
||||
/**
|
||||
* @brief allocation function for AVVDPAUContext
|
||||
*
|
||||
* Allows extending the struct without breaking API/ABI
|
||||
*/
|
||||
AVVDPAUContext *av_alloc_vdpaucontext(void);
|
||||
|
||||
AVVDPAU_Render2 av_vdpau_hwaccel_get_render2(const AVVDPAUContext *);
|
||||
void av_vdpau_hwaccel_set_render2(AVVDPAUContext *, AVVDPAU_Render2);
|
||||
|
||||
/**
|
||||
* Associate a VDPAU device with a codec context for hardware acceleration.
|
||||
* This function is meant to be called from the get_format() codec callback,
|
||||
* or earlier. It can also be called after avcodec_flush_buffers() to change
|
||||
* the underlying VDPAU device mid-stream (e.g. to recover from non-transparent
|
||||
* display preemption).
|
||||
*
|
||||
* @note get_format() must return AV_PIX_FMT_VDPAU if this function completes
|
||||
* successfully.
|
||||
*
|
||||
* @param avctx decoding context whose get_format() callback is invoked
|
||||
* @param device VDPAU device handle to use for hardware acceleration
|
||||
* @param get_proc_address VDPAU device driver
|
||||
* @param flags zero of more OR'd AV_HWACCEL_FLAG_* flags
|
||||
*
|
||||
* @return 0 on success, an AVERROR code on failure.
|
||||
*/
|
||||
int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device,
|
||||
VdpGetProcAddress *get_proc_address, unsigned flags);
|
||||
|
||||
/**
|
||||
* Gets the parameters to create an adequate VDPAU video surface for the codec
|
||||
* context using VDPAU hardware decoding acceleration.
|
||||
*
|
||||
* @note Behavior is undefined if the context was not successfully bound to a
|
||||
* VDPAU device using av_vdpau_bind_context().
|
||||
*
|
||||
* @param avctx the codec context being used for decoding the stream
|
||||
* @param type storage space for the VDPAU video surface chroma type
|
||||
* (or NULL to ignore)
|
||||
* @param width storage space for the VDPAU video surface pixel width
|
||||
* (or NULL to ignore)
|
||||
* @param height storage space for the VDPAU video surface pixel height
|
||||
* (or NULL to ignore)
|
||||
*
|
||||
* @return 0 on success, a negative AVERROR code on failure.
|
||||
*/
|
||||
int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type,
|
||||
uint32_t *width, uint32_t *height);
|
||||
|
||||
/**
|
||||
* Allocate an AVVDPAUContext.
|
||||
*
|
||||
* @return Newly-allocated AVVDPAUContext or NULL on failure.
|
||||
*/
|
||||
AVVDPAUContext *av_vdpau_alloc_context(void);
|
||||
|
||||
#if FF_API_VDPAU_PROFILE
|
||||
/**
|
||||
* Get a decoder profile that should be used for initializing a VDPAU decoder.
|
||||
* Should be called from the AVCodecContext.get_format() callback.
|
||||
*
|
||||
* @deprecated Use av_vdpau_bind_context() instead.
|
||||
*
|
||||
* @param avctx the codec context being used for decoding the stream
|
||||
* @param profile a pointer into which the result will be written on success.
|
||||
* The contents of profile are undefined if this function returns
|
||||
* an error.
|
||||
*
|
||||
* @return 0 on success (non-negative), a negative AVERROR on failure.
|
||||
*/
|
||||
attribute_deprecated
|
||||
int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile);
|
||||
#endif
|
||||
|
||||
#if FF_API_CAP_VDPAU
|
||||
/** @brief The videoSurface is used for rendering. */
|
||||
#define FF_VDPAU_STATE_USED_FOR_RENDER 1
|
||||
|
||||
/**
|
||||
* @brief The videoSurface is needed for reference/prediction.
|
||||
* The codec manipulates this.
|
||||
*/
|
||||
#define FF_VDPAU_STATE_USED_FOR_REFERENCE 2
|
||||
|
||||
/**
|
||||
* @brief This structure is used as a callback between the FFmpeg
|
||||
* decoder (vd_) and presentation (vo_) module.
|
||||
* This is used for defining a video frame containing surface,
|
||||
* picture parameter, bitstream information etc which are passed
|
||||
* between the FFmpeg decoder and its clients.
|
||||
*/
|
||||
struct vdpau_render_state {
|
||||
VdpVideoSurface surface; ///< Used as rendered surface, never changed.
|
||||
|
||||
int state; ///< Holds FF_VDPAU_STATE_* values.
|
||||
|
||||
/** picture parameter information for all supported codecs */
|
||||
union AVVDPAUPictureInfo info;
|
||||
|
||||
/** Describe size/location of the compressed video data.
|
||||
Set to 0 when freeing bitstream_buffers. */
|
||||
int bitstream_buffers_allocated;
|
||||
int bitstream_buffers_used;
|
||||
/** The user is responsible for freeing this buffer using av_freep(). */
|
||||
VdpBitstreamBuffer *bitstream_buffers;
|
||||
};
|
||||
#endif
|
||||
|
||||
/* @}*/
|
||||
|
||||
#endif /* AVCODEC_VDPAU_H */
|
|
@ -0,0 +1,210 @@
|
|||
/*
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_VERSION_H
|
||||
#define AVCODEC_VERSION_H
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @ingroup libavc
|
||||
* Libavcodec version macros.
|
||||
*/
|
||||
|
||||
#include "libavutil/version.h"
|
||||
|
||||
#define LIBAVCODEC_VERSION_MAJOR 57
|
||||
#define LIBAVCODEC_VERSION_MINOR 22
|
||||
#define LIBAVCODEC_VERSION_MICRO 100
|
||||
|
||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
||||
LIBAVCODEC_VERSION_MINOR, \
|
||||
LIBAVCODEC_VERSION_MICRO)
|
||||
#define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \
|
||||
LIBAVCODEC_VERSION_MINOR, \
|
||||
LIBAVCODEC_VERSION_MICRO)
|
||||
#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT
|
||||
|
||||
#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
|
||||
|
||||
/**
|
||||
* FF_API_* defines may be placed below to indicate public API that will be
|
||||
* dropped at a future version bump. The defines themselves are not part of
|
||||
* the public API and may change, break or disappear at any time.
|
||||
*
|
||||
* @note, when bumping the major version it is recommended to manually
|
||||
* disable each FF_API_* in its own commit instead of disabling them all
|
||||
* at once through the bump. This improves the git bisect-ability of the change.
|
||||
*/
|
||||
|
||||
#ifndef FF_API_VIMA_DECODER
|
||||
#define FF_API_VIMA_DECODER (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_AUDIO_CONVERT
|
||||
#define FF_API_AUDIO_CONVERT (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_AVCODEC_RESAMPLE
|
||||
#define FF_API_AVCODEC_RESAMPLE FF_API_AUDIO_CONVERT
|
||||
#endif
|
||||
#ifndef FF_API_MISSING_SAMPLE
|
||||
#define FF_API_MISSING_SAMPLE (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_LOWRES
|
||||
#define FF_API_LOWRES (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_CAP_VDPAU
|
||||
#define FF_API_CAP_VDPAU (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_BUFS_VDPAU
|
||||
#define FF_API_BUFS_VDPAU (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_VOXWARE
|
||||
#define FF_API_VOXWARE (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_SET_DIMENSIONS
|
||||
#define FF_API_SET_DIMENSIONS (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_DEBUG_MV
|
||||
#define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_AC_VLC
|
||||
#define FF_API_AC_VLC (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_OLD_MSMPEG4
|
||||
#define FF_API_OLD_MSMPEG4 (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_ASPECT_EXTENDED
|
||||
#define FF_API_ASPECT_EXTENDED (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_ARCH_ALPHA
|
||||
#define FF_API_ARCH_ALPHA (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_XVMC
|
||||
#define FF_API_XVMC (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_ERROR_RATE
|
||||
#define FF_API_ERROR_RATE (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_QSCALE_TYPE
|
||||
#define FF_API_QSCALE_TYPE (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_MB_TYPE
|
||||
#define FF_API_MB_TYPE (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_MAX_BFRAMES
|
||||
#define FF_API_MAX_BFRAMES (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_NEG_LINESIZES
|
||||
#define FF_API_NEG_LINESIZES (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_EMU_EDGE
|
||||
#define FF_API_EMU_EDGE (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_ARCH_SH4
|
||||
#define FF_API_ARCH_SH4 (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_ARCH_SPARC
|
||||
#define FF_API_ARCH_SPARC (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_UNUSED_MEMBERS
|
||||
#define FF_API_UNUSED_MEMBERS (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_IDCT_XVIDMMX
|
||||
#define FF_API_IDCT_XVIDMMX (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_INPUT_PRESERVED
|
||||
#define FF_API_INPUT_PRESERVED (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_NORMALIZE_AQP
|
||||
#define FF_API_NORMALIZE_AQP (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_GMC
|
||||
#define FF_API_GMC (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_MV0
|
||||
#define FF_API_MV0 (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_CODEC_NAME
|
||||
#define FF_API_CODEC_NAME (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_AFD
|
||||
#define FF_API_AFD (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_VISMV
|
||||
/* XXX: don't forget to drop the -vismv documentation */
|
||||
#define FF_API_VISMV (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_AUDIOENC_DELAY
|
||||
#define FF_API_AUDIOENC_DELAY (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_VAAPI_CONTEXT
|
||||
#define FF_API_VAAPI_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_AVCTX_TIMEBASE
|
||||
#define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_MPV_OPT
|
||||
#define FF_API_MPV_OPT (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_STREAM_CODEC_TAG
|
||||
#define FF_API_STREAM_CODEC_TAG (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_QUANT_BIAS
|
||||
#define FF_API_QUANT_BIAS (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_RC_STRATEGY
|
||||
#define FF_API_RC_STRATEGY (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_CODED_FRAME
|
||||
#define FF_API_CODED_FRAME (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_MOTION_EST
|
||||
#define FF_API_MOTION_EST (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_WITHOUT_PREFIX
|
||||
#define FF_API_WITHOUT_PREFIX (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_SIDEDATA_ONLY_PKT
|
||||
#define FF_API_SIDEDATA_ONLY_PKT (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_VDPAU_PROFILE
|
||||
#define FF_API_VDPAU_PROFILE (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_CONVERGENCE_DURATION
|
||||
#define FF_API_CONVERGENCE_DURATION (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_AVPICTURE
|
||||
#define FF_API_AVPICTURE (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_AVPACKET_OLD_API
|
||||
#define FF_API_AVPACKET_OLD_API (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_RTP_CALLBACK
|
||||
#define FF_API_RTP_CALLBACK (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_VBV_DELAY
|
||||
#define FF_API_VBV_DELAY (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_CODER_TYPE
|
||||
#define FF_API_CODER_TYPE (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_STAT_BITS
|
||||
#define FF_API_STAT_BITS (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
|
||||
#endif /* AVCODEC_VERSION_H */
|
|
@ -0,0 +1,168 @@
|
|||
/*
|
||||
* copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Macro definitions for various function/variable attributes
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_ATTRIBUTES_H
|
||||
#define AVUTIL_ATTRIBUTES_H
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y))
|
||||
# define AV_GCC_VERSION_AT_MOST(x,y) (__GNUC__ < (x) || __GNUC__ == (x) && __GNUC_MINOR__ <= (y))
|
||||
#else
|
||||
# define AV_GCC_VERSION_AT_LEAST(x,y) 0
|
||||
# define AV_GCC_VERSION_AT_MOST(x,y) 0
|
||||
#endif
|
||||
|
||||
#ifndef av_always_inline
|
||||
#if AV_GCC_VERSION_AT_LEAST(3,1)
|
||||
# define av_always_inline __attribute__((always_inline)) inline
|
||||
#elif defined(_MSC_VER)
|
||||
# define av_always_inline __forceinline
|
||||
#else
|
||||
# define av_always_inline inline
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef av_extern_inline
|
||||
#if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__)
|
||||
# define av_extern_inline extern inline
|
||||
#else
|
||||
# define av_extern_inline inline
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if AV_GCC_VERSION_AT_LEAST(3,4)
|
||||
# define av_warn_unused_result __attribute__((warn_unused_result))
|
||||
#else
|
||||
# define av_warn_unused_result
|
||||
#endif
|
||||
|
||||
#if AV_GCC_VERSION_AT_LEAST(3,1)
|
||||
# define av_noinline __attribute__((noinline))
|
||||
#elif defined(_MSC_VER)
|
||||
# define av_noinline __declspec(noinline)
|
||||
#else
|
||||
# define av_noinline
|
||||
#endif
|
||||
|
||||
#if AV_GCC_VERSION_AT_LEAST(3,1)
|
||||
# define av_pure __attribute__((pure))
|
||||
#else
|
||||
# define av_pure
|
||||
#endif
|
||||
|
||||
#if AV_GCC_VERSION_AT_LEAST(2,6)
|
||||
# define av_const __attribute__((const))
|
||||
#else
|
||||
# define av_const
|
||||
#endif
|
||||
|
||||
#if AV_GCC_VERSION_AT_LEAST(4,3)
|
||||
# define av_cold __attribute__((cold))
|
||||
#else
|
||||
# define av_cold
|
||||
#endif
|
||||
|
||||
#if AV_GCC_VERSION_AT_LEAST(4,1) && !defined(__llvm__)
|
||||
# define av_flatten __attribute__((flatten))
|
||||
#else
|
||||
# define av_flatten
|
||||
#endif
|
||||
|
||||
#if AV_GCC_VERSION_AT_LEAST(3,1)
|
||||
# define attribute_deprecated __attribute__((deprecated))
|
||||
#elif defined(_MSC_VER)
|
||||
# define attribute_deprecated __declspec(deprecated)
|
||||
#else
|
||||
# define attribute_deprecated
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Disable warnings about deprecated features
|
||||
* This is useful for sections of code kept for backward compatibility and
|
||||
* scheduled for removal.
|
||||
*/
|
||||
#ifndef AV_NOWARN_DEPRECATED
|
||||
#if AV_GCC_VERSION_AT_LEAST(4,6)
|
||||
# define AV_NOWARN_DEPRECATED(code) \
|
||||
_Pragma("GCC diagnostic push") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
|
||||
code \
|
||||
_Pragma("GCC diagnostic pop")
|
||||
#elif defined(_MSC_VER)
|
||||
# define AV_NOWARN_DEPRECATED(code) \
|
||||
__pragma(warning(push)) \
|
||||
__pragma(warning(disable : 4996)) \
|
||||
code; \
|
||||
__pragma(warning(pop))
|
||||
#else
|
||||
# define AV_NOWARN_DEPRECATED(code) code
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# define av_unused __attribute__((unused))
|
||||
#else
|
||||
# define av_unused
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Mark a variable as used and prevent the compiler from optimizing it
|
||||
* away. This is useful for variables accessed only from inline
|
||||
* assembler without the compiler being aware.
|
||||
*/
|
||||
#if AV_GCC_VERSION_AT_LEAST(3,1)
|
||||
# define av_used __attribute__((used))
|
||||
#else
|
||||
# define av_used
|
||||
#endif
|
||||
|
||||
#if AV_GCC_VERSION_AT_LEAST(3,3)
|
||||
# define av_alias __attribute__((may_alias))
|
||||
#else
|
||||
# define av_alias
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__)
|
||||
# define av_uninit(x) x=x
|
||||
#else
|
||||
# define av_uninit(x) x
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define av_builtin_constant_p __builtin_constant_p
|
||||
# define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos)))
|
||||
#else
|
||||
# define av_builtin_constant_p(x) 0
|
||||
# define av_printf_format(fmtpos, attrpos)
|
||||
#endif
|
||||
|
||||
#if AV_GCC_VERSION_AT_LEAST(2,5)
|
||||
# define av_noreturn __attribute__((noreturn))
|
||||
#else
|
||||
# define av_noreturn
|
||||
#endif
|
||||
|
||||
#endif /* AVUTIL_ATTRIBUTES_H */
|
|
@ -0,0 +1,7 @@
|
|||
/* Generated by ffconf */
|
||||
#ifndef AVUTIL_AVCONFIG_H
|
||||
#define AVUTIL_AVCONFIG_H
|
||||
#define AV_HAVE_BIGENDIAN 0
|
||||
#define AV_HAVE_FAST_UNALIGNED 1
|
||||
#define AV_HAVE_INCOMPATIBLE_LIBAV_ABI 0
|
||||
#endif /* AVUTIL_AVCONFIG_H */
|
|
@ -0,0 +1,343 @@
|
|||
/*
|
||||
* copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_AVUTIL_H
|
||||
#define AVUTIL_AVUTIL_H
|
||||
|
||||
/**
|
||||
* @file
|
||||
* external API header
|
||||
*/
|
||||
|
||||
/**
|
||||
* @mainpage
|
||||
*
|
||||
* @section ffmpeg_intro Introduction
|
||||
*
|
||||
* This document describes the usage of the different libraries
|
||||
* provided by FFmpeg.
|
||||
*
|
||||
* @li @ref libavc "libavcodec" encoding/decoding library
|
||||
* @li @ref lavfi "libavfilter" graph-based frame editing library
|
||||
* @li @ref libavf "libavformat" I/O and muxing/demuxing library
|
||||
* @li @ref lavd "libavdevice" special devices muxing/demuxing library
|
||||
* @li @ref lavu "libavutil" common utility library
|
||||
* @li @ref lswr "libswresample" audio resampling, format conversion and mixing
|
||||
* @li @ref lpp "libpostproc" post processing library
|
||||
* @li @ref libsws "libswscale" color conversion and scaling library
|
||||
*
|
||||
* @section ffmpeg_versioning Versioning and compatibility
|
||||
*
|
||||
* Each of the FFmpeg libraries contains a version.h header, which defines a
|
||||
* major, minor and micro version number with the
|
||||
* <em>LIBRARYNAME_VERSION_{MAJOR,MINOR,MICRO}</em> macros. The major version
|
||||
* number is incremented with backward incompatible changes - e.g. removing
|
||||
* parts of the public API, reordering public struct members, etc. The minor
|
||||
* version number is incremented for backward compatible API changes or major
|
||||
* new features - e.g. adding a new public function or a new decoder. The micro
|
||||
* version number is incremented for smaller changes that a calling program
|
||||
* might still want to check for - e.g. changing behavior in a previously
|
||||
* unspecified situation.
|
||||
*
|
||||
* FFmpeg guarantees backward API and ABI compatibility for each library as long
|
||||
* as its major version number is unchanged. This means that no public symbols
|
||||
* will be removed or renamed. Types and names of the public struct members and
|
||||
* values of public macros and enums will remain the same (unless they were
|
||||
* explicitly declared as not part of the public API). Documented behavior will
|
||||
* not change.
|
||||
*
|
||||
* In other words, any correct program that works with a given FFmpeg snapshot
|
||||
* should work just as well without any changes with any later snapshot with the
|
||||
* same major versions. This applies to both rebuilding the program against new
|
||||
* FFmpeg versions or to replacing the dynamic FFmpeg libraries that a program
|
||||
* links against.
|
||||
*
|
||||
* However, new public symbols may be added and new members may be appended to
|
||||
* public structs whose size is not part of public ABI (most public structs in
|
||||
* FFmpeg). New macros and enum values may be added. Behavior in undocumented
|
||||
* situations may change slightly (and be documented). All those are accompanied
|
||||
* by an entry in doc/APIchanges and incrementing either the minor or micro
|
||||
* version number.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup lavu Common utility functions
|
||||
*
|
||||
* @brief
|
||||
* libavutil contains the code shared across all the other FFmpeg
|
||||
* libraries
|
||||
*
|
||||
* @note In order to use the functions provided by avutil you must include
|
||||
* the specific header.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* @defgroup lavu_crypto Crypto and Hashing
|
||||
*
|
||||
* @{
|
||||
* @}
|
||||
*
|
||||
* @defgroup lavu_math Maths
|
||||
* @{
|
||||
*
|
||||
* @}
|
||||
*
|
||||
* @defgroup lavu_string String Manipulation
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* @}
|
||||
*
|
||||
* @defgroup lavu_mem Memory Management
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* @}
|
||||
*
|
||||
* @defgroup lavu_data Data Structures
|
||||
* @{
|
||||
*
|
||||
* @}
|
||||
*
|
||||
* @defgroup lavu_audio Audio related
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* @}
|
||||
*
|
||||
* @defgroup lavu_error Error Codes
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* @}
|
||||
*
|
||||
* @defgroup lavu_log Logging Facility
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* @}
|
||||
*
|
||||
* @defgroup lavu_misc Other
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* @defgroup preproc_misc Preprocessor String Macros
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* @}
|
||||
*
|
||||
* @defgroup version_utils Library Version Macros
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @addtogroup lavu_ver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Return the LIBAVUTIL_VERSION_INT constant.
|
||||
*/
|
||||
unsigned avutil_version(void);
|
||||
|
||||
/**
|
||||
* Return an informative version string. This usually is the actual release
|
||||
* version number or a git commit description. This string has no fixed format
|
||||
* and can change any time. It should never be parsed by code.
|
||||
*/
|
||||
const char *av_version_info(void);
|
||||
|
||||
/**
|
||||
* Return the libavutil build-time configuration.
|
||||
*/
|
||||
const char *avutil_configuration(void);
|
||||
|
||||
/**
|
||||
* Return the libavutil license.
|
||||
*/
|
||||
const char *avutil_license(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup lavu_media Media Type
|
||||
* @brief Media Type
|
||||
*/
|
||||
|
||||
enum AVMediaType {
|
||||
AVMEDIA_TYPE_UNKNOWN = -1, ///< Usually treated as AVMEDIA_TYPE_DATA
|
||||
AVMEDIA_TYPE_VIDEO,
|
||||
AVMEDIA_TYPE_AUDIO,
|
||||
AVMEDIA_TYPE_DATA, ///< Opaque data information usually continuous
|
||||
AVMEDIA_TYPE_SUBTITLE,
|
||||
AVMEDIA_TYPE_ATTACHMENT, ///< Opaque data information usually sparse
|
||||
AVMEDIA_TYPE_NB
|
||||
};
|
||||
|
||||
/**
|
||||
* Return a string describing the media_type enum, NULL if media_type
|
||||
* is unknown.
|
||||
*/
|
||||
const char *av_get_media_type_string(enum AVMediaType media_type);
|
||||
|
||||
/**
|
||||
* @defgroup lavu_const Constants
|
||||
* @{
|
||||
*
|
||||
* @defgroup lavu_enc Encoding specific
|
||||
*
|
||||
* @note those definition should move to avcodec
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define FF_LAMBDA_SHIFT 7
|
||||
#define FF_LAMBDA_SCALE (1<<FF_LAMBDA_SHIFT)
|
||||
#define FF_QP2LAMBDA 118 ///< factor to convert from H.263 QP to lambda
|
||||
#define FF_LAMBDA_MAX (256*128-1)
|
||||
|
||||
#define FF_QUALITY_SCALE FF_LAMBDA_SCALE //FIXME maybe remove
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @defgroup lavu_time Timestamp specific
|
||||
*
|
||||
* FFmpeg internal timebase and timestamp definitions
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Undefined timestamp value
|
||||
*
|
||||
* Usually reported by demuxer that work on containers that do not provide
|
||||
* either pts or dts.
|
||||
*/
|
||||
|
||||
#define AV_NOPTS_VALUE ((int64_t)UINT64_C(0x8000000000000000))
|
||||
|
||||
/**
|
||||
* Internal time base represented as integer
|
||||
*/
|
||||
|
||||
#define AV_TIME_BASE 1000000
|
||||
|
||||
/**
|
||||
* Internal time base represented as fractional value
|
||||
*/
|
||||
|
||||
#define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE}
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
* @defgroup lavu_picture Image related
|
||||
*
|
||||
* AVPicture types, pixel formats and basic image planes manipulation.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
enum AVPictureType {
|
||||
AV_PICTURE_TYPE_NONE = 0, ///< Undefined
|
||||
AV_PICTURE_TYPE_I, ///< Intra
|
||||
AV_PICTURE_TYPE_P, ///< Predicted
|
||||
AV_PICTURE_TYPE_B, ///< Bi-dir predicted
|
||||
AV_PICTURE_TYPE_S, ///< S(GMC)-VOP MPEG4
|
||||
AV_PICTURE_TYPE_SI, ///< Switching Intra
|
||||
AV_PICTURE_TYPE_SP, ///< Switching Predicted
|
||||
AV_PICTURE_TYPE_BI, ///< BI type
|
||||
};
|
||||
|
||||
/**
|
||||
* Return a single letter to describe the given picture type
|
||||
* pict_type.
|
||||
*
|
||||
* @param[in] pict_type the picture type @return a single character
|
||||
* representing the picture type, '?' if pict_type is unknown
|
||||
*/
|
||||
char av_get_picture_type_char(enum AVPictureType pict_type);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "error.h"
|
||||
#include "rational.h"
|
||||
#include "version.h"
|
||||
#include "macros.h"
|
||||
#include "mathematics.h"
|
||||
#include "log.h"
|
||||
#include "pixfmt.h"
|
||||
|
||||
/**
|
||||
* Return x default pointer in case p is NULL.
|
||||
*/
|
||||
static inline void *av_x_if_null(const void *p, const void *x)
|
||||
{
|
||||
return (void *)(intptr_t)(p ? p : x);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the length of an integer list.
|
||||
*
|
||||
* @param elsize size in bytes of each list element (only 1, 2, 4 or 8)
|
||||
* @param term list terminator (usually 0 or -1)
|
||||
* @param list pointer to the list
|
||||
* @return length of the list, in elements, not counting the terminator
|
||||
*/
|
||||
unsigned av_int_list_length_for_size(unsigned elsize,
|
||||
const void *list, uint64_t term) av_pure;
|
||||
|
||||
/**
|
||||
* Compute the length of an integer list.
|
||||
*
|
||||
* @param term list terminator (usually 0 or -1)
|
||||
* @param list pointer to the list
|
||||
* @return length of the list, in elements, not counting the terminator
|
||||
*/
|
||||
#define av_int_list_length(list, term) \
|
||||
av_int_list_length_for_size(sizeof(*(list)), list, term)
|
||||
|
||||
/**
|
||||
* Open a file using a UTF-8 filename.
|
||||
* The API of this function matches POSIX fopen(), errors are returned through
|
||||
* errno.
|
||||
*/
|
||||
FILE *av_fopen_utf8(const char *path, const char *mode);
|
||||
|
||||
/**
|
||||
* Return the fractional representation of the internal time base.
|
||||
*/
|
||||
AVRational av_get_time_base_q(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* AVUTIL_AVUTIL_H */
|
|
@ -0,0 +1,274 @@
|
|||
/*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @ingroup lavu_buffer
|
||||
* refcounted data buffer API
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_BUFFER_H
|
||||
#define AVUTIL_BUFFER_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* @defgroup lavu_buffer AVBuffer
|
||||
* @ingroup lavu_data
|
||||
*
|
||||
* @{
|
||||
* AVBuffer is an API for reference-counted data buffers.
|
||||
*
|
||||
* There are two core objects in this API -- AVBuffer and AVBufferRef. AVBuffer
|
||||
* represents the data buffer itself; it is opaque and not meant to be accessed
|
||||
* by the caller directly, but only through AVBufferRef. However, the caller may
|
||||
* e.g. compare two AVBuffer pointers to check whether two different references
|
||||
* are describing the same data buffer. AVBufferRef represents a single
|
||||
* reference to an AVBuffer and it is the object that may be manipulated by the
|
||||
* caller directly.
|
||||
*
|
||||
* There are two functions provided for creating a new AVBuffer with a single
|
||||
* reference -- av_buffer_alloc() to just allocate a new buffer, and
|
||||
* av_buffer_create() to wrap an existing array in an AVBuffer. From an existing
|
||||
* reference, additional references may be created with av_buffer_ref().
|
||||
* Use av_buffer_unref() to free a reference (this will automatically free the
|
||||
* data once all the references are freed).
|
||||
*
|
||||
* The convention throughout this API and the rest of FFmpeg is such that the
|
||||
* buffer is considered writable if there exists only one reference to it (and
|
||||
* it has not been marked as read-only). The av_buffer_is_writable() function is
|
||||
* provided to check whether this is true and av_buffer_make_writable() will
|
||||
* automatically create a new writable buffer when necessary.
|
||||
* Of course nothing prevents the calling code from violating this convention,
|
||||
* however that is safe only when all the existing references are under its
|
||||
* control.
|
||||
*
|
||||
* @note Referencing and unreferencing the buffers is thread-safe and thus
|
||||
* may be done from multiple threads simultaneously without any need for
|
||||
* additional locking.
|
||||
*
|
||||
* @note Two different references to the same buffer can point to different
|
||||
* parts of the buffer (i.e. their AVBufferRef.data will not be equal).
|
||||
*/
|
||||
|
||||
/**
|
||||
* A reference counted buffer type. It is opaque and is meant to be used through
|
||||
* references (AVBufferRef).
|
||||
*/
|
||||
typedef struct AVBuffer AVBuffer;
|
||||
|
||||
/**
|
||||
* A reference to a data buffer.
|
||||
*
|
||||
* The size of this struct is not a part of the public ABI and it is not meant
|
||||
* to be allocated directly.
|
||||
*/
|
||||
typedef struct AVBufferRef {
|
||||
AVBuffer *buffer;
|
||||
|
||||
/**
|
||||
* The data buffer. It is considered writable if and only if
|
||||
* this is the only reference to the buffer, in which case
|
||||
* av_buffer_is_writable() returns 1.
|
||||
*/
|
||||
uint8_t *data;
|
||||
/**
|
||||
* Size of data in bytes.
|
||||
*/
|
||||
int size;
|
||||
} AVBufferRef;
|
||||
|
||||
/**
|
||||
* Allocate an AVBuffer of the given size using av_malloc().
|
||||
*
|
||||
* @return an AVBufferRef of given size or NULL when out of memory
|
||||
*/
|
||||
AVBufferRef *av_buffer_alloc(int size);
|
||||
|
||||
/**
|
||||
* Same as av_buffer_alloc(), except the returned buffer will be initialized
|
||||
* to zero.
|
||||
*/
|
||||
AVBufferRef *av_buffer_allocz(int size);
|
||||
|
||||
/**
|
||||
* Always treat the buffer as read-only, even when it has only one
|
||||
* reference.
|
||||
*/
|
||||
#define AV_BUFFER_FLAG_READONLY (1 << 0)
|
||||
|
||||
/**
|
||||
* Create an AVBuffer from an existing array.
|
||||
*
|
||||
* If this function is successful, data is owned by the AVBuffer. The caller may
|
||||
* only access data through the returned AVBufferRef and references derived from
|
||||
* it.
|
||||
* If this function fails, data is left untouched.
|
||||
* @param data data array
|
||||
* @param size size of data in bytes
|
||||
* @param free a callback for freeing this buffer's data
|
||||
* @param opaque parameter to be got for processing or passed to free
|
||||
* @param flags a combination of AV_BUFFER_FLAG_*
|
||||
*
|
||||
* @return an AVBufferRef referring to data on success, NULL on failure.
|
||||
*/
|
||||
AVBufferRef *av_buffer_create(uint8_t *data, int size,
|
||||
void (*free)(void *opaque, uint8_t *data),
|
||||
void *opaque, int flags);
|
||||
|
||||
/**
|
||||
* Default free callback, which calls av_free() on the buffer data.
|
||||
* This function is meant to be passed to av_buffer_create(), not called
|
||||
* directly.
|
||||
*/
|
||||
void av_buffer_default_free(void *opaque, uint8_t *data);
|
||||
|
||||
/**
|
||||
* Create a new reference to an AVBuffer.
|
||||
*
|
||||
* @return a new AVBufferRef referring to the same AVBuffer as buf or NULL on
|
||||
* failure.
|
||||
*/
|
||||
AVBufferRef *av_buffer_ref(AVBufferRef *buf);
|
||||
|
||||
/**
|
||||
* Free a given reference and automatically free the buffer if there are no more
|
||||
* references to it.
|
||||
*
|
||||
* @param buf the reference to be freed. The pointer is set to NULL on return.
|
||||
*/
|
||||
void av_buffer_unref(AVBufferRef **buf);
|
||||
|
||||
/**
|
||||
* @return 1 if the caller may write to the data referred to by buf (which is
|
||||
* true if and only if buf is the only reference to the underlying AVBuffer).
|
||||
* Return 0 otherwise.
|
||||
* A positive answer is valid until av_buffer_ref() is called on buf.
|
||||
*/
|
||||
int av_buffer_is_writable(const AVBufferRef *buf);
|
||||
|
||||
/**
|
||||
* @return the opaque parameter set by av_buffer_create.
|
||||
*/
|
||||
void *av_buffer_get_opaque(const AVBufferRef *buf);
|
||||
|
||||
int av_buffer_get_ref_count(const AVBufferRef *buf);
|
||||
|
||||
/**
|
||||
* Create a writable reference from a given buffer reference, avoiding data copy
|
||||
* if possible.
|
||||
*
|
||||
* @param buf buffer reference to make writable. On success, buf is either left
|
||||
* untouched, or it is unreferenced and a new writable AVBufferRef is
|
||||
* written in its place. On failure, buf is left untouched.
|
||||
* @return 0 on success, a negative AVERROR on failure.
|
||||
*/
|
||||
int av_buffer_make_writable(AVBufferRef **buf);
|
||||
|
||||
/**
|
||||
* Reallocate a given buffer.
|
||||
*
|
||||
* @param buf a buffer reference to reallocate. On success, buf will be
|
||||
* unreferenced and a new reference with the required size will be
|
||||
* written in its place. On failure buf will be left untouched. *buf
|
||||
* may be NULL, then a new buffer is allocated.
|
||||
* @param size required new buffer size.
|
||||
* @return 0 on success, a negative AVERROR on failure.
|
||||
*
|
||||
* @note the buffer is actually reallocated with av_realloc() only if it was
|
||||
* initially allocated through av_buffer_realloc(NULL) and there is only one
|
||||
* reference to it (i.e. the one passed to this function). In all other cases
|
||||
* a new buffer is allocated and the data is copied.
|
||||
*/
|
||||
int av_buffer_realloc(AVBufferRef **buf, int size);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup lavu_bufferpool AVBufferPool
|
||||
* @ingroup lavu_data
|
||||
*
|
||||
* @{
|
||||
* AVBufferPool is an API for a lock-free thread-safe pool of AVBuffers.
|
||||
*
|
||||
* Frequently allocating and freeing large buffers may be slow. AVBufferPool is
|
||||
* meant to solve this in cases when the caller needs a set of buffers of the
|
||||
* same size (the most obvious use case being buffers for raw video or audio
|
||||
* frames).
|
||||
*
|
||||
* At the beginning, the user must call av_buffer_pool_init() to create the
|
||||
* buffer pool. Then whenever a buffer is needed, call av_buffer_pool_get() to
|
||||
* get a reference to a new buffer, similar to av_buffer_alloc(). This new
|
||||
* reference works in all aspects the same way as the one created by
|
||||
* av_buffer_alloc(). However, when the last reference to this buffer is
|
||||
* unreferenced, it is returned to the pool instead of being freed and will be
|
||||
* reused for subsequent av_buffer_pool_get() calls.
|
||||
*
|
||||
* When the caller is done with the pool and no longer needs to allocate any new
|
||||
* buffers, av_buffer_pool_uninit() must be called to mark the pool as freeable.
|
||||
* Once all the buffers are released, it will automatically be freed.
|
||||
*
|
||||
* Allocating and releasing buffers with this API is thread-safe as long as
|
||||
* either the default alloc callback is used, or the user-supplied one is
|
||||
* thread-safe.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The buffer pool. This structure is opaque and not meant to be accessed
|
||||
* directly. It is allocated with av_buffer_pool_init() and freed with
|
||||
* av_buffer_pool_uninit().
|
||||
*/
|
||||
typedef struct AVBufferPool AVBufferPool;
|
||||
|
||||
/**
|
||||
* Allocate and initialize a buffer pool.
|
||||
*
|
||||
* @param size size of each buffer in this pool
|
||||
* @param alloc a function that will be used to allocate new buffers when the
|
||||
* pool is empty. May be NULL, then the default allocator will be used
|
||||
* (av_buffer_alloc()).
|
||||
* @return newly created buffer pool on success, NULL on error.
|
||||
*/
|
||||
AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size));
|
||||
|
||||
/**
|
||||
* Mark the pool as being available for freeing. It will actually be freed only
|
||||
* once all the allocated buffers associated with the pool are released. Thus it
|
||||
* is safe to call this function while some of the allocated buffers are still
|
||||
* in use.
|
||||
*
|
||||
* @param pool pointer to the pool to be freed. It will be set to NULL.
|
||||
* @see av_buffer_pool_can_uninit()
|
||||
*/
|
||||
void av_buffer_pool_uninit(AVBufferPool **pool);
|
||||
|
||||
/**
|
||||
* Allocate a new AVBuffer, reusing an old buffer from the pool when available.
|
||||
* This function may be called simultaneously from multiple threads.
|
||||
*
|
||||
* @return a reference to the new buffer on success, NULL on error.
|
||||
*/
|
||||
AVBufferRef *av_buffer_pool_get(AVBufferPool *pool);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* AVUTIL_BUFFER_H */
|
|
@ -0,0 +1,223 @@
|
|||
/*
|
||||
* Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
|
||||
* Copyright (c) 2008 Peter Ross
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_CHANNEL_LAYOUT_H
|
||||
#define AVUTIL_CHANNEL_LAYOUT_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* audio channel layout utility functions
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup lavu_audio
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup channel_masks Audio channel masks
|
||||
*
|
||||
* A channel layout is a 64-bits integer with a bit set for every channel.
|
||||
* The number of bits set must be equal to the number of channels.
|
||||
* The value 0 means that the channel layout is not known.
|
||||
* @note this data structure is not powerful enough to handle channels
|
||||
* combinations that have the same channel multiple times, such as
|
||||
* dual-mono.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
#define AV_CH_FRONT_LEFT 0x00000001
|
||||
#define AV_CH_FRONT_RIGHT 0x00000002
|
||||
#define AV_CH_FRONT_CENTER 0x00000004
|
||||
#define AV_CH_LOW_FREQUENCY 0x00000008
|
||||
#define AV_CH_BACK_LEFT 0x00000010
|
||||
#define AV_CH_BACK_RIGHT 0x00000020
|
||||
#define AV_CH_FRONT_LEFT_OF_CENTER 0x00000040
|
||||
#define AV_CH_FRONT_RIGHT_OF_CENTER 0x00000080
|
||||
#define AV_CH_BACK_CENTER 0x00000100
|
||||
#define AV_CH_SIDE_LEFT 0x00000200
|
||||
#define AV_CH_SIDE_RIGHT 0x00000400
|
||||
#define AV_CH_TOP_CENTER 0x00000800
|
||||
#define AV_CH_TOP_FRONT_LEFT 0x00001000
|
||||
#define AV_CH_TOP_FRONT_CENTER 0x00002000
|
||||
#define AV_CH_TOP_FRONT_RIGHT 0x00004000
|
||||
#define AV_CH_TOP_BACK_LEFT 0x00008000
|
||||
#define AV_CH_TOP_BACK_CENTER 0x00010000
|
||||
#define AV_CH_TOP_BACK_RIGHT 0x00020000
|
||||
#define AV_CH_STEREO_LEFT 0x20000000 ///< Stereo downmix.
|
||||
#define AV_CH_STEREO_RIGHT 0x40000000 ///< See AV_CH_STEREO_LEFT.
|
||||
#define AV_CH_WIDE_LEFT 0x0000000080000000ULL
|
||||
#define AV_CH_WIDE_RIGHT 0x0000000100000000ULL
|
||||
#define AV_CH_SURROUND_DIRECT_LEFT 0x0000000200000000ULL
|
||||
#define AV_CH_SURROUND_DIRECT_RIGHT 0x0000000400000000ULL
|
||||
#define AV_CH_LOW_FREQUENCY_2 0x0000000800000000ULL
|
||||
|
||||
/** Channel mask value used for AVCodecContext.request_channel_layout
|
||||
to indicate that the user requests the channel order of the decoder output
|
||||
to be the native codec channel order. */
|
||||
#define AV_CH_LAYOUT_NATIVE 0x8000000000000000ULL
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @defgroup channel_mask_c Audio channel layouts
|
||||
* @{
|
||||
* */
|
||||
#define AV_CH_LAYOUT_MONO (AV_CH_FRONT_CENTER)
|
||||
#define AV_CH_LAYOUT_STEREO (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT)
|
||||
#define AV_CH_LAYOUT_2POINT1 (AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY)
|
||||
#define AV_CH_LAYOUT_2_1 (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER)
|
||||
#define AV_CH_LAYOUT_SURROUND (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER)
|
||||
#define AV_CH_LAYOUT_3POINT1 (AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY)
|
||||
#define AV_CH_LAYOUT_4POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER)
|
||||
#define AV_CH_LAYOUT_4POINT1 (AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY)
|
||||
#define AV_CH_LAYOUT_2_2 (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
|
||||
#define AV_CH_LAYOUT_QUAD (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
|
||||
#define AV_CH_LAYOUT_5POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
|
||||
#define AV_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY)
|
||||
#define AV_CH_LAYOUT_5POINT0_BACK (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
|
||||
#define AV_CH_LAYOUT_5POINT1_BACK (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY)
|
||||
#define AV_CH_LAYOUT_6POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER)
|
||||
#define AV_CH_LAYOUT_6POINT0_FRONT (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
|
||||
#define AV_CH_LAYOUT_HEXAGONAL (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER)
|
||||
#define AV_CH_LAYOUT_6POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER)
|
||||
#define AV_CH_LAYOUT_6POINT1_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER)
|
||||
#define AV_CH_LAYOUT_6POINT1_FRONT (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY)
|
||||
#define AV_CH_LAYOUT_7POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
|
||||
#define AV_CH_LAYOUT_7POINT0_FRONT (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
|
||||
#define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
|
||||
#define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
|
||||
#define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
|
||||
#define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT)
|
||||
#define AV_CH_LAYOUT_HEXADECAGONAL (AV_CH_LAYOUT_OCTAGONAL|AV_CH_WIDE_LEFT|AV_CH_WIDE_RIGHT|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT|AV_CH_TOP_BACK_CENTER|AV_CH_TOP_FRONT_CENTER|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT)
|
||||
#define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT)
|
||||
|
||||
enum AVMatrixEncoding {
|
||||
AV_MATRIX_ENCODING_NONE,
|
||||
AV_MATRIX_ENCODING_DOLBY,
|
||||
AV_MATRIX_ENCODING_DPLII,
|
||||
AV_MATRIX_ENCODING_DPLIIX,
|
||||
AV_MATRIX_ENCODING_DPLIIZ,
|
||||
AV_MATRIX_ENCODING_DOLBYEX,
|
||||
AV_MATRIX_ENCODING_DOLBYHEADPHONE,
|
||||
AV_MATRIX_ENCODING_NB
|
||||
};
|
||||
|
||||
/**
|
||||
* Return a channel layout id that matches name, or 0 if no match is found.
|
||||
*
|
||||
* name can be one or several of the following notations,
|
||||
* separated by '+' or '|':
|
||||
* - the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0,
|
||||
* 5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix);
|
||||
* - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC,
|
||||
* SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR);
|
||||
* - a number of channels, in decimal, optionally followed by 'c', yielding
|
||||
* the default channel layout for that number of channels (@see
|
||||
* av_get_default_channel_layout);
|
||||
* - a channel layout mask, in hexadecimal starting with "0x" (see the
|
||||
* AV_CH_* macros).
|
||||
*
|
||||
* @warning Starting from the next major bump the trailing character
|
||||
* 'c' to specify a number of channels will be required, while a
|
||||
* channel layout mask could also be specified as a decimal number
|
||||
* (if and only if not followed by "c").
|
||||
*
|
||||
* Example: "stereo+FC" = "2c+FC" = "2c+1c" = "0x7"
|
||||
*/
|
||||
uint64_t av_get_channel_layout(const char *name);
|
||||
|
||||
/**
|
||||
* Return a description of a channel layout.
|
||||
* If nb_channels is <= 0, it is guessed from the channel_layout.
|
||||
*
|
||||
* @param buf put here the string containing the channel layout
|
||||
* @param buf_size size in bytes of the buffer
|
||||
*/
|
||||
void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout);
|
||||
|
||||
struct AVBPrint;
|
||||
/**
|
||||
* Append a description of a channel layout to a bprint buffer.
|
||||
*/
|
||||
void av_bprint_channel_layout(struct AVBPrint *bp, int nb_channels, uint64_t channel_layout);
|
||||
|
||||
/**
|
||||
* Return the number of channels in the channel layout.
|
||||
*/
|
||||
int av_get_channel_layout_nb_channels(uint64_t channel_layout);
|
||||
|
||||
/**
|
||||
* Return default channel layout for a given number of channels.
|
||||
*/
|
||||
int64_t av_get_default_channel_layout(int nb_channels);
|
||||
|
||||
/**
|
||||
* Get the index of a channel in channel_layout.
|
||||
*
|
||||
* @param channel a channel layout describing exactly one channel which must be
|
||||
* present in channel_layout.
|
||||
*
|
||||
* @return index of channel in channel_layout on success, a negative AVERROR
|
||||
* on error.
|
||||
*/
|
||||
int av_get_channel_layout_channel_index(uint64_t channel_layout,
|
||||
uint64_t channel);
|
||||
|
||||
/**
|
||||
* Get the channel with the given index in channel_layout.
|
||||
*/
|
||||
uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index);
|
||||
|
||||
/**
|
||||
* Get the name of a given channel.
|
||||
*
|
||||
* @return channel name on success, NULL on error.
|
||||
*/
|
||||
const char *av_get_channel_name(uint64_t channel);
|
||||
|
||||
/**
|
||||
* Get the description of a given channel.
|
||||
*
|
||||
* @param channel a channel layout with a single channel
|
||||
* @return channel description on success, NULL on error
|
||||
*/
|
||||
const char *av_get_channel_description(uint64_t channel);
|
||||
|
||||
/**
|
||||
* Get the value and name of a standard channel layout.
|
||||
*
|
||||
* @param[in] index index in an internal list, starting at 0
|
||||
* @param[out] layout channel layout mask
|
||||
* @param[out] name name of the layout
|
||||
* @return 0 if the layout exists,
|
||||
* <0 if index is beyond the limits
|
||||
*/
|
||||
int av_get_standard_channel_layout(unsigned index, uint64_t *layout,
|
||||
const char **name);
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* AVUTIL_CHANNEL_LAYOUT_H */
|
|
@ -0,0 +1,519 @@
|
|||
/*
|
||||
* copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* common internal and external API header
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_COMMON_H
|
||||
#define AVUTIL_COMMON_H
|
||||
|
||||
#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS) && !defined(UINT64_C)
|
||||
#error missing -D__STDC_CONSTANT_MACROS / #define __STDC_CONSTANT_MACROS
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "attributes.h"
|
||||
#include "macros.h"
|
||||
#include "version.h"
|
||||
#include "libavutil/avconfig.h"
|
||||
|
||||
#if AV_HAVE_BIGENDIAN
|
||||
# define AV_NE(be, le) (be)
|
||||
#else
|
||||
# define AV_NE(be, le) (le)
|
||||
#endif
|
||||
|
||||
//rounded division & shift
|
||||
#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))
|
||||
/* assume b>0 */
|
||||
#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
|
||||
/* assume a>0 and b>0 */
|
||||
#define FF_CEIL_RSHIFT(a,b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \
|
||||
: ((a) + (1<<(b)) - 1) >> (b))
|
||||
#define FFUDIV(a,b) (((a)>0 ?(a):(a)-(b)+1) / (b))
|
||||
#define FFUMOD(a,b) ((a)-(b)*FFUDIV(a,b))
|
||||
|
||||
/**
|
||||
* Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they
|
||||
* are not representable as absolute values of their type. This is the same
|
||||
* as with *abs()
|
||||
* @see FFNABS()
|
||||
*/
|
||||
#define FFABS(a) ((a) >= 0 ? (a) : (-(a)))
|
||||
#define FFSIGN(a) ((a) > 0 ? 1 : -1)
|
||||
|
||||
/**
|
||||
* Negative Absolute value.
|
||||
* this works for all integers of all types.
|
||||
* As with many macros, this evaluates its argument twice, it thus must not have
|
||||
* a sideeffect, that is FFNABS(x++) has undefined behavior.
|
||||
*/
|
||||
#define FFNABS(a) ((a) <= 0 ? (a) : (-(a)))
|
||||
|
||||
/**
|
||||
* Comparator.
|
||||
* For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0
|
||||
* if x == y. This is useful for instance in a qsort comparator callback.
|
||||
* Furthermore, compilers are able to optimize this to branchless code, and
|
||||
* there is no risk of overflow with signed types.
|
||||
* As with many macros, this evaluates its argument multiple times, it thus
|
||||
* must not have a side-effect.
|
||||
*/
|
||||
#define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y)))
|
||||
|
||||
#define FFMAX(a,b) ((a) > (b) ? (a) : (b))
|
||||
#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c)
|
||||
#define FFMIN(a,b) ((a) > (b) ? (b) : (a))
|
||||
#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c)
|
||||
|
||||
#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
|
||||
#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
|
||||
|
||||
/* misc math functions */
|
||||
|
||||
#ifdef HAVE_AV_CONFIG_H
|
||||
# include "config.h"
|
||||
# include "intmath.h"
|
||||
#endif
|
||||
|
||||
/* Pull in unguarded fallback defines at the end of this file. */
|
||||
#include "common.h"
|
||||
|
||||
#ifndef av_log2
|
||||
av_const int av_log2(unsigned v);
|
||||
#endif
|
||||
|
||||
#ifndef av_log2_16bit
|
||||
av_const int av_log2_16bit(unsigned v);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Clip a signed integer value into the amin-amax range.
|
||||
* @param a value to clip
|
||||
* @param amin minimum value of the clip range
|
||||
* @param amax maximum value of the clip range
|
||||
* @return clipped value
|
||||
*/
|
||||
static av_always_inline av_const int av_clip_c(int a, int amin, int amax)
|
||||
{
|
||||
#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
|
||||
if (amin > amax) abort();
|
||||
#endif
|
||||
if (a < amin) return amin;
|
||||
else if (a > amax) return amax;
|
||||
else return a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clip a signed 64bit integer value into the amin-amax range.
|
||||
* @param a value to clip
|
||||
* @param amin minimum value of the clip range
|
||||
* @param amax maximum value of the clip range
|
||||
* @return clipped value
|
||||
*/
|
||||
static av_always_inline av_const int64_t av_clip64_c(int64_t a, int64_t amin, int64_t amax)
|
||||
{
|
||||
#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
|
||||
if (amin > amax) abort();
|
||||
#endif
|
||||
if (a < amin) return amin;
|
||||
else if (a > amax) return amax;
|
||||
else return a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clip a signed integer value into the 0-255 range.
|
||||
* @param a value to clip
|
||||
* @return clipped value
|
||||
*/
|
||||
static av_always_inline av_const uint8_t av_clip_uint8_c(int a)
|
||||
{
|
||||
if (a&(~0xFF)) return (-a)>>31;
|
||||
else return a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clip a signed integer value into the -128,127 range.
|
||||
* @param a value to clip
|
||||
* @return clipped value
|
||||
*/
|
||||
static av_always_inline av_const int8_t av_clip_int8_c(int a)
|
||||
{
|
||||
if ((a+0x80U) & ~0xFF) return (a>>31) ^ 0x7F;
|
||||
else return a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clip a signed integer value into the 0-65535 range.
|
||||
* @param a value to clip
|
||||
* @return clipped value
|
||||
*/
|
||||
static av_always_inline av_const uint16_t av_clip_uint16_c(int a)
|
||||
{
|
||||
if (a&(~0xFFFF)) return (-a)>>31;
|
||||
else return a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clip a signed integer value into the -32768,32767 range.
|
||||
* @param a value to clip
|
||||
* @return clipped value
|
||||
*/
|
||||
static av_always_inline av_const int16_t av_clip_int16_c(int a)
|
||||
{
|
||||
if ((a+0x8000U) & ~0xFFFF) return (a>>31) ^ 0x7FFF;
|
||||
else return a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clip a signed 64-bit integer value into the -2147483648,2147483647 range.
|
||||
* @param a value to clip
|
||||
* @return clipped value
|
||||
*/
|
||||
static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a)
|
||||
{
|
||||
if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (int32_t)((a>>63) ^ 0x7FFFFFFF);
|
||||
else return (int32_t)a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clip a signed integer into the -(2^p),(2^p-1) range.
|
||||
* @param a value to clip
|
||||
* @param p bit position to clip at
|
||||
* @return clipped value
|
||||
*/
|
||||
static av_always_inline av_const int av_clip_intp2_c(int a, int p)
|
||||
{
|
||||
if ((a + (1 << p)) & ~((2 << p) - 1))
|
||||
return (a >> 31) ^ ((1 << p) - 1);
|
||||
else
|
||||
return a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clip a signed integer to an unsigned power of two range.
|
||||
* @param a value to clip
|
||||
* @param p bit position to clip at
|
||||
* @return clipped value
|
||||
*/
|
||||
static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
|
||||
{
|
||||
if (a & ~((1<<p) - 1)) return -a >> 31 & ((1<<p) - 1);
|
||||
else return a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear high bits from an unsigned integer starting with specific bit position
|
||||
* @param a value to clip
|
||||
* @param p bit position to clip at
|
||||
* @return clipped value
|
||||
*/
|
||||
static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p)
|
||||
{
|
||||
return a & ((1 << p) - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add two signed 32-bit values with saturation.
|
||||
*
|
||||
* @param a one value
|
||||
* @param b another value
|
||||
* @return sum with signed saturation
|
||||
*/
|
||||
static av_always_inline int av_sat_add32_c(int a, int b)
|
||||
{
|
||||
return av_clipl_int32((int64_t)a + b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a doubled value to another value with saturation at both stages.
|
||||
*
|
||||
* @param a first value
|
||||
* @param b value doubled and added to a
|
||||
* @return sum with signed saturation
|
||||
*/
|
||||
static av_always_inline int av_sat_dadd32_c(int a, int b)
|
||||
{
|
||||
return av_sat_add32(a, av_sat_add32(b, b));
|
||||
}
|
||||
|
||||
/**
|
||||
* Clip a float value into the amin-amax range.
|
||||
* @param a value to clip
|
||||
* @param amin minimum value of the clip range
|
||||
* @param amax maximum value of the clip range
|
||||
* @return clipped value
|
||||
*/
|
||||
static av_always_inline av_const float av_clipf_c(float a, float amin, float amax)
|
||||
{
|
||||
#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
|
||||
if (amin > amax) abort();
|
||||
#endif
|
||||
if (a < amin) return amin;
|
||||
else if (a > amax) return amax;
|
||||
else return a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clip a double value into the amin-amax range.
|
||||
* @param a value to clip
|
||||
* @param amin minimum value of the clip range
|
||||
* @param amax maximum value of the clip range
|
||||
* @return clipped value
|
||||
*/
|
||||
static av_always_inline av_const double av_clipd_c(double a, double amin, double amax)
|
||||
{
|
||||
#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
|
||||
if (amin > amax) abort();
|
||||
#endif
|
||||
if (a < amin) return amin;
|
||||
else if (a > amax) return amax;
|
||||
else return a;
|
||||
}
|
||||
|
||||
/** Compute ceil(log2(x)).
|
||||
* @param x value used to compute ceil(log2(x))
|
||||
* @return computed ceiling of log2(x)
|
||||
*/
|
||||
static av_always_inline av_const int av_ceil_log2_c(int x)
|
||||
{
|
||||
return av_log2((x - 1) << 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Count number of bits set to one in x
|
||||
* @param x value to count bits of
|
||||
* @return the number of bits set to one in x
|
||||
*/
|
||||
static av_always_inline av_const int av_popcount_c(uint32_t x)
|
||||
{
|
||||
x -= (x >> 1) & 0x55555555;
|
||||
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
|
||||
x = (x + (x >> 4)) & 0x0F0F0F0F;
|
||||
x += x >> 8;
|
||||
return (x + (x >> 16)) & 0x3F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count number of bits set to one in x
|
||||
* @param x value to count bits of
|
||||
* @return the number of bits set to one in x
|
||||
*/
|
||||
static av_always_inline av_const int av_popcount64_c(uint64_t x)
|
||||
{
|
||||
return av_popcount((uint32_t)x) + av_popcount((uint32_t)(x >> 32));
|
||||
}
|
||||
|
||||
#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24))
|
||||
#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24))
|
||||
|
||||
/**
|
||||
* Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form.
|
||||
*
|
||||
* @param val Output value, must be an lvalue of type uint32_t.
|
||||
* @param GET_BYTE Expression reading one byte from the input.
|
||||
* Evaluated up to 7 times (4 for the currently
|
||||
* assigned Unicode range). With a memory buffer
|
||||
* input, this could be *ptr++.
|
||||
* @param ERROR Expression to be evaluated on invalid input,
|
||||
* typically a goto statement.
|
||||
*
|
||||
* @warning ERROR should not contain a loop control statement which
|
||||
* could interact with the internal while loop, and should force an
|
||||
* exit from the macro code (e.g. through a goto or a return) in order
|
||||
* to prevent undefined results.
|
||||
*/
|
||||
#define GET_UTF8(val, GET_BYTE, ERROR)\
|
||||
val= GET_BYTE;\
|
||||
{\
|
||||
uint32_t top = (val & 128) >> 1;\
|
||||
if ((val & 0xc0) == 0x80 || val >= 0xFE)\
|
||||
ERROR\
|
||||
while (val & top) {\
|
||||
int tmp= GET_BYTE - 128;\
|
||||
if(tmp>>6)\
|
||||
ERROR\
|
||||
val= (val<<6) + tmp;\
|
||||
top <<= 5;\
|
||||
}\
|
||||
val &= (top << 1) - 1;\
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form.
|
||||
*
|
||||
* @param val Output value, must be an lvalue of type uint32_t.
|
||||
* @param GET_16BIT Expression returning two bytes of UTF-16 data converted
|
||||
* to native byte order. Evaluated one or two times.
|
||||
* @param ERROR Expression to be evaluated on invalid input,
|
||||
* typically a goto statement.
|
||||
*/
|
||||
#define GET_UTF16(val, GET_16BIT, ERROR)\
|
||||
val = GET_16BIT;\
|
||||
{\
|
||||
unsigned int hi = val - 0xD800;\
|
||||
if (hi < 0x800) {\
|
||||
val = GET_16BIT - 0xDC00;\
|
||||
if (val > 0x3FFU || hi > 0x3FFU)\
|
||||
ERROR\
|
||||
val += (hi<<10) + 0x10000;\
|
||||
}\
|
||||
}\
|
||||
|
||||
/**
|
||||
* @def PUT_UTF8(val, tmp, PUT_BYTE)
|
||||
* Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long).
|
||||
* @param val is an input-only argument and should be of type uint32_t. It holds
|
||||
* a UCS-4 encoded Unicode character that is to be converted to UTF-8. If
|
||||
* val is given as a function it is executed only once.
|
||||
* @param tmp is a temporary variable and should be of type uint8_t. It
|
||||
* represents an intermediate value during conversion that is to be
|
||||
* output by PUT_BYTE.
|
||||
* @param PUT_BYTE writes the converted UTF-8 bytes to any proper destination.
|
||||
* It could be a function or a statement, and uses tmp as the input byte.
|
||||
* For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be
|
||||
* executed up to 4 times for values in the valid UTF-8 range and up to
|
||||
* 7 times in the general case, depending on the length of the converted
|
||||
* Unicode character.
|
||||
*/
|
||||
#define PUT_UTF8(val, tmp, PUT_BYTE)\
|
||||
{\
|
||||
int bytes, shift;\
|
||||
uint32_t in = val;\
|
||||
if (in < 0x80) {\
|
||||
tmp = in;\
|
||||
PUT_BYTE\
|
||||
} else {\
|
||||
bytes = (av_log2(in) + 4) / 5;\
|
||||
shift = (bytes - 1) * 6;\
|
||||
tmp = (256 - (256 >> bytes)) | (in >> shift);\
|
||||
PUT_BYTE\
|
||||
while (shift >= 6) {\
|
||||
shift -= 6;\
|
||||
tmp = 0x80 | ((in >> shift) & 0x3f);\
|
||||
PUT_BYTE\
|
||||
}\
|
||||
}\
|
||||
}
|
||||
|
||||
/**
|
||||
* @def PUT_UTF16(val, tmp, PUT_16BIT)
|
||||
* Convert a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes).
|
||||
* @param val is an input-only argument and should be of type uint32_t. It holds
|
||||
* a UCS-4 encoded Unicode character that is to be converted to UTF-16. If
|
||||
* val is given as a function it is executed only once.
|
||||
* @param tmp is a temporary variable and should be of type uint16_t. It
|
||||
* represents an intermediate value during conversion that is to be
|
||||
* output by PUT_16BIT.
|
||||
* @param PUT_16BIT writes the converted UTF-16 data to any proper destination
|
||||
* in desired endianness. It could be a function or a statement, and uses tmp
|
||||
* as the input byte. For example, PUT_BYTE could be "*output++ = tmp;"
|
||||
* PUT_BYTE will be executed 1 or 2 times depending on input character.
|
||||
*/
|
||||
#define PUT_UTF16(val, tmp, PUT_16BIT)\
|
||||
{\
|
||||
uint32_t in = val;\
|
||||
if (in < 0x10000) {\
|
||||
tmp = in;\
|
||||
PUT_16BIT\
|
||||
} else {\
|
||||
tmp = 0xD800 | ((in - 0x10000) >> 10);\
|
||||
PUT_16BIT\
|
||||
tmp = 0xDC00 | ((in - 0x10000) & 0x3FF);\
|
||||
PUT_16BIT\
|
||||
}\
|
||||
}\
|
||||
|
||||
|
||||
|
||||
#include "mem.h"
|
||||
|
||||
#ifdef HAVE_AV_CONFIG_H
|
||||
# include "internal.h"
|
||||
#endif /* HAVE_AV_CONFIG_H */
|
||||
|
||||
#endif /* AVUTIL_COMMON_H */
|
||||
|
||||
/*
|
||||
* The following definitions are outside the multiple inclusion guard
|
||||
* to ensure they are immediately available in intmath.h.
|
||||
*/
|
||||
|
||||
#ifndef av_ceil_log2
|
||||
# define av_ceil_log2 av_ceil_log2_c
|
||||
#endif
|
||||
#ifndef av_clip
|
||||
# define av_clip av_clip_c
|
||||
#endif
|
||||
#ifndef av_clip64
|
||||
# define av_clip64 av_clip64_c
|
||||
#endif
|
||||
#ifndef av_clip_uint8
|
||||
# define av_clip_uint8 av_clip_uint8_c
|
||||
#endif
|
||||
#ifndef av_clip_int8
|
||||
# define av_clip_int8 av_clip_int8_c
|
||||
#endif
|
||||
#ifndef av_clip_uint16
|
||||
# define av_clip_uint16 av_clip_uint16_c
|
||||
#endif
|
||||
#ifndef av_clip_int16
|
||||
# define av_clip_int16 av_clip_int16_c
|
||||
#endif
|
||||
#ifndef av_clipl_int32
|
||||
# define av_clipl_int32 av_clipl_int32_c
|
||||
#endif
|
||||
#ifndef av_clip_intp2
|
||||
# define av_clip_intp2 av_clip_intp2_c
|
||||
#endif
|
||||
#ifndef av_clip_uintp2
|
||||
# define av_clip_uintp2 av_clip_uintp2_c
|
||||
#endif
|
||||
#ifndef av_mod_uintp2
|
||||
# define av_mod_uintp2 av_mod_uintp2_c
|
||||
#endif
|
||||
#ifndef av_sat_add32
|
||||
# define av_sat_add32 av_sat_add32_c
|
||||
#endif
|
||||
#ifndef av_sat_dadd32
|
||||
# define av_sat_dadd32 av_sat_dadd32_c
|
||||
#endif
|
||||
#ifndef av_clipf
|
||||
# define av_clipf av_clipf_c
|
||||
#endif
|
||||
#ifndef av_clipd
|
||||
# define av_clipd av_clipd_c
|
||||
#endif
|
||||
#ifndef av_popcount
|
||||
# define av_popcount av_popcount_c
|
||||
#endif
|
||||
#ifndef av_popcount64
|
||||
# define av_popcount64 av_popcount64_c
|
||||
#endif
|
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
* Copyright (c) 2000, 2001, 2002 Fabrice Bellard
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_CPU_H
|
||||
#define AVUTIL_CPU_H
|
||||
|
||||
#include "attributes.h"
|
||||
|
||||
#define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */
|
||||
|
||||
/* lower 16 bits - CPU features */
|
||||
#define AV_CPU_FLAG_MMX 0x0001 ///< standard MMX
|
||||
#define AV_CPU_FLAG_MMXEXT 0x0002 ///< SSE integer functions or AMD MMX ext
|
||||
#define AV_CPU_FLAG_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext
|
||||
#define AV_CPU_FLAG_3DNOW 0x0004 ///< AMD 3DNOW
|
||||
#define AV_CPU_FLAG_SSE 0x0008 ///< SSE functions
|
||||
#define AV_CPU_FLAG_SSE2 0x0010 ///< PIV SSE2 functions
|
||||
#define AV_CPU_FLAG_SSE2SLOW 0x40000000 ///< SSE2 supported, but usually not faster
|
||||
///< than regular MMX/SSE (e.g. Core1)
|
||||
#define AV_CPU_FLAG_3DNOWEXT 0x0020 ///< AMD 3DNowExt
|
||||
#define AV_CPU_FLAG_SSE3 0x0040 ///< Prescott SSE3 functions
|
||||
#define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster
|
||||
///< than regular MMX/SSE (e.g. Core1)
|
||||
#define AV_CPU_FLAG_SSSE3 0x0080 ///< Conroe SSSE3 functions
|
||||
#define AV_CPU_FLAG_ATOM 0x10000000 ///< Atom processor, some SSSE3 instructions are slower
|
||||
#define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions
|
||||
#define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions
|
||||
#define AV_CPU_FLAG_AESNI 0x80000 ///< Advanced Encryption Standard functions
|
||||
#define AV_CPU_FLAG_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used
|
||||
#define AV_CPU_FLAG_AVXSLOW 0x8000000 ///< AVX supported, but slow when using YMM registers (e.g. Bulldozer)
|
||||
#define AV_CPU_FLAG_XOP 0x0400 ///< Bulldozer XOP functions
|
||||
#define AV_CPU_FLAG_FMA4 0x0800 ///< Bulldozer FMA4 functions
|
||||
#define AV_CPU_FLAG_CMOV 0x1000 ///< supports cmov instruction
|
||||
#define AV_CPU_FLAG_AVX2 0x8000 ///< AVX2 functions: requires OS support even if YMM registers aren't used
|
||||
#define AV_CPU_FLAG_FMA3 0x10000 ///< Haswell FMA3 functions
|
||||
#define AV_CPU_FLAG_BMI1 0x20000 ///< Bit Manipulation Instruction Set 1
|
||||
#define AV_CPU_FLAG_BMI2 0x40000 ///< Bit Manipulation Instruction Set 2
|
||||
|
||||
#define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard
|
||||
#define AV_CPU_FLAG_VSX 0x0002 ///< ISA 2.06
|
||||
#define AV_CPU_FLAG_POWER8 0x0004 ///< ISA 2.07
|
||||
|
||||
#define AV_CPU_FLAG_ARMV5TE (1 << 0)
|
||||
#define AV_CPU_FLAG_ARMV6 (1 << 1)
|
||||
#define AV_CPU_FLAG_ARMV6T2 (1 << 2)
|
||||
#define AV_CPU_FLAG_VFP (1 << 3)
|
||||
#define AV_CPU_FLAG_VFPV3 (1 << 4)
|
||||
#define AV_CPU_FLAG_NEON (1 << 5)
|
||||
#define AV_CPU_FLAG_ARMV8 (1 << 6)
|
||||
#define AV_CPU_FLAG_VFP_VM (1 << 7) ///< VFPv2 vector mode, deprecated in ARMv7-A and unavailable in various CPUs implementations
|
||||
#define AV_CPU_FLAG_SETEND (1 <<16)
|
||||
|
||||
/**
|
||||
* Return the flags which specify extensions supported by the CPU.
|
||||
* The returned value is affected by av_force_cpu_flags() if that was used
|
||||
* before. So av_get_cpu_flags() can easily be used in a application to
|
||||
* detect the enabled cpu flags.
|
||||
*/
|
||||
int av_get_cpu_flags(void);
|
||||
|
||||
/**
|
||||
* Disables cpu detection and forces the specified flags.
|
||||
* -1 is a special case that disables forcing of specific flags.
|
||||
*/
|
||||
void av_force_cpu_flags(int flags);
|
||||
|
||||
/**
|
||||
* Set a mask on flags returned by av_get_cpu_flags().
|
||||
* This function is mainly useful for testing.
|
||||
* Please use av_force_cpu_flags() and av_get_cpu_flags() instead which are more flexible
|
||||
*
|
||||
* @warning this function is not thread safe.
|
||||
*/
|
||||
attribute_deprecated void av_set_cpu_flags_mask(int mask);
|
||||
|
||||
/**
|
||||
* Parse CPU flags from a string.
|
||||
*
|
||||
* The returned flags contain the specified flags as well as related unspecified flags.
|
||||
*
|
||||
* This function exists only for compatibility with libav.
|
||||
* Please use av_parse_cpu_caps() when possible.
|
||||
* @return a combination of AV_CPU_* flags, negative on error.
|
||||
*/
|
||||
attribute_deprecated
|
||||
int av_parse_cpu_flags(const char *s);
|
||||
|
||||
/**
|
||||
* Parse CPU caps from a string and update the given AV_CPU_* flags based on that.
|
||||
*
|
||||
* @return negative on error.
|
||||
*/
|
||||
int av_parse_cpu_caps(unsigned *flags, const char *s);
|
||||
|
||||
/**
|
||||
* @return the number of logical CPU cores present.
|
||||
*/
|
||||
int av_cpu_count(void);
|
||||
|
||||
#endif /* AVUTIL_CPU_H */
|
|
@ -0,0 +1,198 @@
|
|||
/*
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Public dictionary API.
|
||||
* @deprecated
|
||||
* AVDictionary is provided for compatibility with libav. It is both in
|
||||
* implementation as well as API inefficient. It does not scale and is
|
||||
* extremely slow with large dictionaries.
|
||||
* It is recommended that new code uses our tree container from tree.c/h
|
||||
* where applicable, which uses AVL trees to achieve O(log n) performance.
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_DICT_H
|
||||
#define AVUTIL_DICT_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "version.h"
|
||||
|
||||
/**
|
||||
* @addtogroup lavu_dict AVDictionary
|
||||
* @ingroup lavu_data
|
||||
*
|
||||
* @brief Simple key:value store
|
||||
*
|
||||
* @{
|
||||
* Dictionaries are used for storing key:value pairs. To create
|
||||
* an AVDictionary, simply pass an address of a NULL pointer to
|
||||
* av_dict_set(). NULL can be used as an empty dictionary wherever
|
||||
* a pointer to an AVDictionary is required.
|
||||
* Use av_dict_get() to retrieve an entry or iterate over all
|
||||
* entries and finally av_dict_free() to free the dictionary
|
||||
* and all its contents.
|
||||
*
|
||||
@code
|
||||
AVDictionary *d = NULL; // "create" an empty dictionary
|
||||
AVDictionaryEntry *t = NULL;
|
||||
|
||||
av_dict_set(&d, "foo", "bar", 0); // add an entry
|
||||
|
||||
char *k = av_strdup("key"); // if your strings are already allocated,
|
||||
char *v = av_strdup("value"); // you can avoid copying them like this
|
||||
av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL);
|
||||
|
||||
while (t = av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX)) {
|
||||
<....> // iterate over all entries in d
|
||||
}
|
||||
av_dict_free(&d);
|
||||
@endcode
|
||||
*
|
||||
*/
|
||||
|
||||
#define AV_DICT_MATCH_CASE 1 /**< Only get an entry with exact-case key match. Only relevant in av_dict_get(). */
|
||||
#define AV_DICT_IGNORE_SUFFIX 2 /**< Return first entry in a dictionary whose first part corresponds to the search key,
|
||||
ignoring the suffix of the found key string. Only relevant in av_dict_get(). */
|
||||
#define AV_DICT_DONT_STRDUP_KEY 4 /**< Take ownership of a key that's been
|
||||
allocated with av_malloc() or another memory allocation function. */
|
||||
#define AV_DICT_DONT_STRDUP_VAL 8 /**< Take ownership of a value that's been
|
||||
allocated with av_malloc() or another memory allocation function. */
|
||||
#define AV_DICT_DONT_OVERWRITE 16 ///< Don't overwrite existing entries.
|
||||
#define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no
|
||||
delimiter is added, the strings are simply concatenated. */
|
||||
|
||||
typedef struct AVDictionaryEntry {
|
||||
char *key;
|
||||
char *value;
|
||||
} AVDictionaryEntry;
|
||||
|
||||
typedef struct AVDictionary AVDictionary;
|
||||
|
||||
/**
|
||||
* Get a dictionary entry with matching key.
|
||||
*
|
||||
* The returned entry key or value must not be changed, or it will
|
||||
* cause undefined behavior.
|
||||
*
|
||||
* To iterate through all the dictionary entries, you can set the matching key
|
||||
* to the null string "" and set the AV_DICT_IGNORE_SUFFIX flag.
|
||||
*
|
||||
* @param prev Set to the previous matching element to find the next.
|
||||
* If set to NULL the first matching element is returned.
|
||||
* @param key matching key
|
||||
* @param flags a collection of AV_DICT_* flags controlling how the entry is retrieved
|
||||
* @return found entry or NULL in case no matching entry was found in the dictionary
|
||||
*/
|
||||
AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key,
|
||||
const AVDictionaryEntry *prev, int flags);
|
||||
|
||||
/**
|
||||
* Get number of entries in dictionary.
|
||||
*
|
||||
* @param m dictionary
|
||||
* @return number of entries in dictionary
|
||||
*/
|
||||
int av_dict_count(const AVDictionary *m);
|
||||
|
||||
/**
|
||||
* Set the given entry in *pm, overwriting an existing entry.
|
||||
*
|
||||
* Note: If AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL is set,
|
||||
* these arguments will be freed on error.
|
||||
*
|
||||
* @param pm pointer to a pointer to a dictionary struct. If *pm is NULL
|
||||
* a dictionary struct is allocated and put in *pm.
|
||||
* @param key entry key to add to *pm (will be av_strduped depending on flags)
|
||||
* @param value entry value to add to *pm (will be av_strduped depending on flags).
|
||||
* Passing a NULL value will cause an existing entry to be deleted.
|
||||
* @return >= 0 on success otherwise an error code <0
|
||||
*/
|
||||
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags);
|
||||
|
||||
/**
|
||||
* Convenience wrapper for av_dict_set that converts the value to a string
|
||||
* and stores it.
|
||||
*
|
||||
* Note: If AV_DICT_DONT_STRDUP_KEY is set, key will be freed on error.
|
||||
*/
|
||||
int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags);
|
||||
|
||||
/**
|
||||
* Parse the key/value pairs list and add the parsed entries to a dictionary.
|
||||
*
|
||||
* In case of failure, all the successfully set entries are stored in
|
||||
* *pm. You may need to manually free the created dictionary.
|
||||
*
|
||||
* @param key_val_sep a 0-terminated list of characters used to separate
|
||||
* key from value
|
||||
* @param pairs_sep a 0-terminated list of characters used to separate
|
||||
* two pairs from each other
|
||||
* @param flags flags to use when adding to dictionary.
|
||||
* AV_DICT_DONT_STRDUP_KEY and AV_DICT_DONT_STRDUP_VAL
|
||||
* are ignored since the key/value tokens will always
|
||||
* be duplicated.
|
||||
* @return 0 on success, negative AVERROR code on failure
|
||||
*/
|
||||
int av_dict_parse_string(AVDictionary **pm, const char *str,
|
||||
const char *key_val_sep, const char *pairs_sep,
|
||||
int flags);
|
||||
|
||||
/**
|
||||
* Copy entries from one AVDictionary struct into another.
|
||||
* @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL,
|
||||
* this function will allocate a struct for you and put it in *dst
|
||||
* @param src pointer to source AVDictionary struct
|
||||
* @param flags flags to use when setting entries in *dst
|
||||
* @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag
|
||||
* @return 0 on success, negative AVERROR code on failure. If dst was allocated
|
||||
* by this function, callers should free the associated memory.
|
||||
*/
|
||||
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags);
|
||||
|
||||
/**
|
||||
* Free all the memory allocated for an AVDictionary struct
|
||||
* and all keys and values.
|
||||
*/
|
||||
void av_dict_free(AVDictionary **m);
|
||||
|
||||
/**
|
||||
* Get dictionary entries as a string.
|
||||
*
|
||||
* Create a string containing dictionary's entries.
|
||||
* Such string may be passed back to av_dict_parse_string().
|
||||
* @note String is escaped with backslashes ('\').
|
||||
*
|
||||
* @param[in] m dictionary
|
||||
* @param[out] buffer Pointer to buffer that will be allocated with string containg entries.
|
||||
* Buffer must be freed by the caller when is no longer needed.
|
||||
* @param[in] key_val_sep character used to separate key from value
|
||||
* @param[in] pairs_sep character used to separate two pairs from each other
|
||||
* @return >= 0 on success, negative on error
|
||||
* @warning Separators cannot be neither '\\' nor '\0'. They also cannot be the same.
|
||||
*/
|
||||
int av_dict_get_string(const AVDictionary *m, char **buffer,
|
||||
const char key_val_sep, const char pairs_sep);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* AVUTIL_DICT_H */
|
|
@ -0,0 +1,126 @@
|
|||
/*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* error code definitions
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_ERROR_H
|
||||
#define AVUTIL_ERROR_H
|
||||
|
||||
#include <errno.h>
|
||||
#include <stddef.h>
|
||||
|
||||
/**
|
||||
* @addtogroup lavu_error
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/* error handling */
|
||||
#if EDOM > 0
|
||||
#define AVERROR(e) (-(e)) ///< Returns a negative error code from a POSIX error code, to return from library functions.
|
||||
#define AVUNERROR(e) (-(e)) ///< Returns a POSIX error code from a library function error return value.
|
||||
#else
|
||||
/* Some platforms have E* and errno already negated. */
|
||||
#define AVERROR(e) (e)
|
||||
#define AVUNERROR(e) (e)
|
||||
#endif
|
||||
|
||||
#define FFERRTAG(a, b, c, d) (-(int)MKTAG(a, b, c, d))
|
||||
|
||||
#define AVERROR_BSF_NOT_FOUND FFERRTAG(0xF8,'B','S','F') ///< Bitstream filter not found
|
||||
#define AVERROR_BUG FFERRTAG( 'B','U','G','!') ///< Internal bug, also see AVERROR_BUG2
|
||||
#define AVERROR_BUFFER_TOO_SMALL FFERRTAG( 'B','U','F','S') ///< Buffer too small
|
||||
#define AVERROR_DECODER_NOT_FOUND FFERRTAG(0xF8,'D','E','C') ///< Decoder not found
|
||||
#define AVERROR_DEMUXER_NOT_FOUND FFERRTAG(0xF8,'D','E','M') ///< Demuxer not found
|
||||
#define AVERROR_ENCODER_NOT_FOUND FFERRTAG(0xF8,'E','N','C') ///< Encoder not found
|
||||
#define AVERROR_EOF FFERRTAG( 'E','O','F',' ') ///< End of file
|
||||
#define AVERROR_EXIT FFERRTAG( 'E','X','I','T') ///< Immediate exit was requested; the called function should not be restarted
|
||||
#define AVERROR_EXTERNAL FFERRTAG( 'E','X','T',' ') ///< Generic error in an external library
|
||||
#define AVERROR_FILTER_NOT_FOUND FFERRTAG(0xF8,'F','I','L') ///< Filter not found
|
||||
#define AVERROR_INVALIDDATA FFERRTAG( 'I','N','D','A') ///< Invalid data found when processing input
|
||||
#define AVERROR_MUXER_NOT_FOUND FFERRTAG(0xF8,'M','U','X') ///< Muxer not found
|
||||
#define AVERROR_OPTION_NOT_FOUND FFERRTAG(0xF8,'O','P','T') ///< Option not found
|
||||
#define AVERROR_PATCHWELCOME FFERRTAG( 'P','A','W','E') ///< Not yet implemented in FFmpeg, patches welcome
|
||||
#define AVERROR_PROTOCOL_NOT_FOUND FFERRTAG(0xF8,'P','R','O') ///< Protocol not found
|
||||
|
||||
#define AVERROR_STREAM_NOT_FOUND FFERRTAG(0xF8,'S','T','R') ///< Stream not found
|
||||
/**
|
||||
* This is semantically identical to AVERROR_BUG
|
||||
* it has been introduced in Libav after our AVERROR_BUG and with a modified value.
|
||||
*/
|
||||
#define AVERROR_BUG2 FFERRTAG( 'B','U','G',' ')
|
||||
#define AVERROR_UNKNOWN FFERRTAG( 'U','N','K','N') ///< Unknown error, typically from an external library
|
||||
#define AVERROR_EXPERIMENTAL (-0x2bb2afa8) ///< Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it.
|
||||
#define AVERROR_INPUT_CHANGED (-0x636e6701) ///< Input changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_OUTPUT_CHANGED)
|
||||
#define AVERROR_OUTPUT_CHANGED (-0x636e6702) ///< Output changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_INPUT_CHANGED)
|
||||
/* HTTP & RTSP errors */
|
||||
#define AVERROR_HTTP_BAD_REQUEST FFERRTAG(0xF8,'4','0','0')
|
||||
#define AVERROR_HTTP_UNAUTHORIZED FFERRTAG(0xF8,'4','0','1')
|
||||
#define AVERROR_HTTP_FORBIDDEN FFERRTAG(0xF8,'4','0','3')
|
||||
#define AVERROR_HTTP_NOT_FOUND FFERRTAG(0xF8,'4','0','4')
|
||||
#define AVERROR_HTTP_OTHER_4XX FFERRTAG(0xF8,'4','X','X')
|
||||
#define AVERROR_HTTP_SERVER_ERROR FFERRTAG(0xF8,'5','X','X')
|
||||
|
||||
#define AV_ERROR_MAX_STRING_SIZE 64
|
||||
|
||||
/**
|
||||
* Put a description of the AVERROR code errnum in errbuf.
|
||||
* In case of failure the global variable errno is set to indicate the
|
||||
* error. Even in case of failure av_strerror() will print a generic
|
||||
* error message indicating the errnum provided to errbuf.
|
||||
*
|
||||
* @param errnum error code to describe
|
||||
* @param errbuf buffer to which description is written
|
||||
* @param errbuf_size the size in bytes of errbuf
|
||||
* @return 0 on success, a negative value if a description for errnum
|
||||
* cannot be found
|
||||
*/
|
||||
int av_strerror(int errnum, char *errbuf, size_t errbuf_size);
|
||||
|
||||
/**
|
||||
* Fill the provided buffer with a string containing an error string
|
||||
* corresponding to the AVERROR code errnum.
|
||||
*
|
||||
* @param errbuf a buffer
|
||||
* @param errbuf_size size in bytes of errbuf
|
||||
* @param errnum error code to describe
|
||||
* @return the buffer in input, filled with the error description
|
||||
* @see av_strerror()
|
||||
*/
|
||||
static inline char *av_make_error_string(char *errbuf, size_t errbuf_size, int errnum)
|
||||
{
|
||||
av_strerror(errnum, errbuf, errbuf_size);
|
||||
return errbuf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience macro, the return value should be used only directly in
|
||||
* function arguments but never stand-alone.
|
||||
*/
|
||||
#define av_err2str(errnum) \
|
||||
av_make_error_string((char[AV_ERROR_MAX_STRING_SIZE]){0}, AV_ERROR_MAX_STRING_SIZE, errnum)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* AVUTIL_ERROR_H */
|
|
@ -0,0 +1,713 @@
|
|||
/*
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @ingroup lavu_frame
|
||||
* reference-counted frame API
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_FRAME_H
|
||||
#define AVUTIL_FRAME_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "avutil.h"
|
||||
#include "buffer.h"
|
||||
#include "dict.h"
|
||||
#include "rational.h"
|
||||
#include "samplefmt.h"
|
||||
#include "pixfmt.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup lavu_frame AVFrame
|
||||
* @ingroup lavu_data
|
||||
*
|
||||
* @{
|
||||
* AVFrame is an abstraction for reference-counted raw multimedia data.
|
||||
*/
|
||||
|
||||
enum AVFrameSideDataType {
|
||||
/**
|
||||
* The data is the AVPanScan struct defined in libavcodec.
|
||||
*/
|
||||
AV_FRAME_DATA_PANSCAN,
|
||||
/**
|
||||
* ATSC A53 Part 4 Closed Captions.
|
||||
* A53 CC bitstream is stored as uint8_t in AVFrameSideData.data.
|
||||
* The number of bytes of CC data is AVFrameSideData.size.
|
||||
*/
|
||||
AV_FRAME_DATA_A53_CC,
|
||||
/**
|
||||
* Stereoscopic 3d metadata.
|
||||
* The data is the AVStereo3D struct defined in libavutil/stereo3d.h.
|
||||
*/
|
||||
AV_FRAME_DATA_STEREO3D,
|
||||
/**
|
||||
* The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h.
|
||||
*/
|
||||
AV_FRAME_DATA_MATRIXENCODING,
|
||||
/**
|
||||
* Metadata relevant to a downmix procedure.
|
||||
* The data is the AVDownmixInfo struct defined in libavutil/downmix_info.h.
|
||||
*/
|
||||
AV_FRAME_DATA_DOWNMIX_INFO,
|
||||
/**
|
||||
* ReplayGain information in the form of the AVReplayGain struct.
|
||||
*/
|
||||
AV_FRAME_DATA_REPLAYGAIN,
|
||||
/**
|
||||
* This side data contains a 3x3 transformation matrix describing an affine
|
||||
* transformation that needs to be applied to the frame for correct
|
||||
* presentation.
|
||||
*
|
||||
* See libavutil/display.h for a detailed description of the data.
|
||||
*/
|
||||
AV_FRAME_DATA_DISPLAYMATRIX,
|
||||
/**
|
||||
* Active Format Description data consisting of a single byte as specified
|
||||
* in ETSI TS 101 154 using AVActiveFormatDescription enum.
|
||||
*/
|
||||
AV_FRAME_DATA_AFD,
|
||||
/**
|
||||
* Motion vectors exported by some codecs (on demand through the export_mvs
|
||||
* flag set in the libavcodec AVCodecContext flags2 option).
|
||||
* The data is the AVMotionVector struct defined in
|
||||
* libavutil/motion_vector.h.
|
||||
*/
|
||||
AV_FRAME_DATA_MOTION_VECTORS,
|
||||
/**
|
||||
* Recommmends skipping the specified number of samples. This is exported
|
||||
* only if the "skip_manual" AVOption is set in libavcodec.
|
||||
* This has the same format as AV_PKT_DATA_SKIP_SAMPLES.
|
||||
* @code
|
||||
* u32le number of samples to skip from start of this packet
|
||||
* u32le number of samples to skip from end of this packet
|
||||
* u8 reason for start skip
|
||||
* u8 reason for end skip (0=padding silence, 1=convergence)
|
||||
* @endcode
|
||||
*/
|
||||
AV_FRAME_DATA_SKIP_SAMPLES,
|
||||
|
||||
/**
|
||||
* This side data must be associated with an audio frame and corresponds to
|
||||
* enum AVAudioServiceType defined in avcodec.h.
|
||||
*/
|
||||
AV_FRAME_DATA_AUDIO_SERVICE_TYPE,
|
||||
};
|
||||
|
||||
enum AVActiveFormatDescription {
|
||||
AV_AFD_SAME = 8,
|
||||
AV_AFD_4_3 = 9,
|
||||
AV_AFD_16_9 = 10,
|
||||
AV_AFD_14_9 = 11,
|
||||
AV_AFD_4_3_SP_14_9 = 13,
|
||||
AV_AFD_16_9_SP_14_9 = 14,
|
||||
AV_AFD_SP_4_3 = 15,
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Structure to hold side data for an AVFrame.
|
||||
*
|
||||
* sizeof(AVFrameSideData) is not a part of the public ABI, so new fields may be added
|
||||
* to the end with a minor bump.
|
||||
*/
|
||||
typedef struct AVFrameSideData {
|
||||
enum AVFrameSideDataType type;
|
||||
uint8_t *data;
|
||||
int size;
|
||||
AVDictionary *metadata;
|
||||
AVBufferRef *buf;
|
||||
} AVFrameSideData;
|
||||
|
||||
/**
|
||||
* This structure describes decoded (raw) audio or video data.
|
||||
*
|
||||
* AVFrame must be allocated using av_frame_alloc(). Note that this only
|
||||
* allocates the AVFrame itself, the buffers for the data must be managed
|
||||
* through other means (see below).
|
||||
* AVFrame must be freed with av_frame_free().
|
||||
*
|
||||
* AVFrame is typically allocated once and then reused multiple times to hold
|
||||
* different data (e.g. a single AVFrame to hold frames received from a
|
||||
* decoder). In such a case, av_frame_unref() will free any references held by
|
||||
* the frame and reset it to its original clean state before it
|
||||
* is reused again.
|
||||
*
|
||||
* The data described by an AVFrame is usually reference counted through the
|
||||
* AVBuffer API. The underlying buffer references are stored in AVFrame.buf /
|
||||
* AVFrame.extended_buf. An AVFrame is considered to be reference counted if at
|
||||
* least one reference is set, i.e. if AVFrame.buf[0] != NULL. In such a case,
|
||||
* every single data plane must be contained in one of the buffers in
|
||||
* AVFrame.buf or AVFrame.extended_buf.
|
||||
* There may be a single buffer for all the data, or one separate buffer for
|
||||
* each plane, or anything in between.
|
||||
*
|
||||
* sizeof(AVFrame) is not a part of the public ABI, so new fields may be added
|
||||
* to the end with a minor bump.
|
||||
* Similarly fields that are marked as to be only accessed by
|
||||
* av_opt_ptr() can be reordered. This allows 2 forks to add fields
|
||||
* without breaking compatibility with each other.
|
||||
*/
|
||||
typedef struct AVFrame {
|
||||
#define AV_NUM_DATA_POINTERS 8
|
||||
/**
|
||||
* pointer to the picture/channel planes.
|
||||
* This might be different from the first allocated byte
|
||||
*
|
||||
* Some decoders access areas outside 0,0 - width,height, please
|
||||
* see avcodec_align_dimensions2(). Some filters and swscale can read
|
||||
* up to 16 bytes beyond the planes, if these filters are to be used,
|
||||
* then 16 extra bytes must be allocated.
|
||||
*/
|
||||
uint8_t *data[AV_NUM_DATA_POINTERS];
|
||||
|
||||
/**
|
||||
* For video, size in bytes of each picture line.
|
||||
* For audio, size in bytes of each plane.
|
||||
*
|
||||
* For audio, only linesize[0] may be set. For planar audio, each channel
|
||||
* plane must be the same size.
|
||||
*
|
||||
* For video the linesizes should be multiples of the CPUs alignment
|
||||
* preference, this is 16 or 32 for modern desktop CPUs.
|
||||
* Some code requires such alignment other code can be slower without
|
||||
* correct alignment, for yet other it makes no difference.
|
||||
*
|
||||
* @note The linesize may be larger than the size of usable data -- there
|
||||
* may be extra padding present for performance reasons.
|
||||
*/
|
||||
int linesize[AV_NUM_DATA_POINTERS];
|
||||
|
||||
/**
|
||||
* pointers to the data planes/channels.
|
||||
*
|
||||
* For video, this should simply point to data[].
|
||||
*
|
||||
* For planar audio, each channel has a separate data pointer, and
|
||||
* linesize[0] contains the size of each channel buffer.
|
||||
* For packed audio, there is just one data pointer, and linesize[0]
|
||||
* contains the total size of the buffer for all channels.
|
||||
*
|
||||
* Note: Both data and extended_data should always be set in a valid frame,
|
||||
* but for planar audio with more channels that can fit in data,
|
||||
* extended_data must be used in order to access all channels.
|
||||
*/
|
||||
uint8_t **extended_data;
|
||||
|
||||
/**
|
||||
* width and height of the video frame
|
||||
*/
|
||||
int width, height;
|
||||
|
||||
/**
|
||||
* number of audio samples (per channel) described by this frame
|
||||
*/
|
||||
int nb_samples;
|
||||
|
||||
/**
|
||||
* format of the frame, -1 if unknown or unset
|
||||
* Values correspond to enum AVPixelFormat for video frames,
|
||||
* enum AVSampleFormat for audio)
|
||||
*/
|
||||
int format;
|
||||
|
||||
/**
|
||||
* 1 -> keyframe, 0-> not
|
||||
*/
|
||||
int key_frame;
|
||||
|
||||
/**
|
||||
* Picture type of the frame.
|
||||
*/
|
||||
enum AVPictureType pict_type;
|
||||
|
||||
/**
|
||||
* Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
|
||||
*/
|
||||
AVRational sample_aspect_ratio;
|
||||
|
||||
/**
|
||||
* Presentation timestamp in time_base units (time when frame should be shown to user).
|
||||
*/
|
||||
int64_t pts;
|
||||
|
||||
/**
|
||||
* PTS copied from the AVPacket that was decoded to produce this frame.
|
||||
*/
|
||||
int64_t pkt_pts;
|
||||
|
||||
/**
|
||||
* DTS copied from the AVPacket that triggered returning this frame. (if frame threading isn't used)
|
||||
* This is also the Presentation time of this AVFrame calculated from
|
||||
* only AVPacket.dts values without pts values.
|
||||
*/
|
||||
int64_t pkt_dts;
|
||||
|
||||
/**
|
||||
* picture number in bitstream order
|
||||
*/
|
||||
int coded_picture_number;
|
||||
/**
|
||||
* picture number in display order
|
||||
*/
|
||||
int display_picture_number;
|
||||
|
||||
/**
|
||||
* quality (between 1 (good) and FF_LAMBDA_MAX (bad))
|
||||
*/
|
||||
int quality;
|
||||
|
||||
/**
|
||||
* for some private data of the user
|
||||
*/
|
||||
void *opaque;
|
||||
|
||||
#if FF_API_ERROR_FRAME
|
||||
/**
|
||||
* @deprecated unused
|
||||
*/
|
||||
attribute_deprecated
|
||||
uint64_t error[AV_NUM_DATA_POINTERS];
|
||||
#endif
|
||||
|
||||
/**
|
||||
* When decoding, this signals how much the picture must be delayed.
|
||||
* extra_delay = repeat_pict / (2*fps)
|
||||
*/
|
||||
int repeat_pict;
|
||||
|
||||
/**
|
||||
* The content of the picture is interlaced.
|
||||
*/
|
||||
int interlaced_frame;
|
||||
|
||||
/**
|
||||
* If the content is interlaced, is top field displayed first.
|
||||
*/
|
||||
int top_field_first;
|
||||
|
||||
/**
|
||||
* Tell user application that palette has changed from previous frame.
|
||||
*/
|
||||
int palette_has_changed;
|
||||
|
||||
/**
|
||||
* reordered opaque 64bit (generally an integer or a double precision float
|
||||
* PTS but can be anything).
|
||||
* The user sets AVCodecContext.reordered_opaque to represent the input at
|
||||
* that time,
|
||||
* the decoder reorders values as needed and sets AVFrame.reordered_opaque
|
||||
* to exactly one of the values provided by the user through AVCodecContext.reordered_opaque
|
||||
* @deprecated in favor of pkt_pts
|
||||
*/
|
||||
int64_t reordered_opaque;
|
||||
|
||||
/**
|
||||
* Sample rate of the audio data.
|
||||
*/
|
||||
int sample_rate;
|
||||
|
||||
/**
|
||||
* Channel layout of the audio data.
|
||||
*/
|
||||
uint64_t channel_layout;
|
||||
|
||||
/**
|
||||
* AVBuffer references backing the data for this frame. If all elements of
|
||||
* this array are NULL, then this frame is not reference counted. This array
|
||||
* must be filled contiguously -- if buf[i] is non-NULL then buf[j] must
|
||||
* also be non-NULL for all j < i.
|
||||
*
|
||||
* There may be at most one AVBuffer per data plane, so for video this array
|
||||
* always contains all the references. For planar audio with more than
|
||||
* AV_NUM_DATA_POINTERS channels, there may be more buffers than can fit in
|
||||
* this array. Then the extra AVBufferRef pointers are stored in the
|
||||
* extended_buf array.
|
||||
*/
|
||||
AVBufferRef *buf[AV_NUM_DATA_POINTERS];
|
||||
|
||||
/**
|
||||
* For planar audio which requires more than AV_NUM_DATA_POINTERS
|
||||
* AVBufferRef pointers, this array will hold all the references which
|
||||
* cannot fit into AVFrame.buf.
|
||||
*
|
||||
* Note that this is different from AVFrame.extended_data, which always
|
||||
* contains all the pointers. This array only contains the extra pointers,
|
||||
* which cannot fit into AVFrame.buf.
|
||||
*
|
||||
* This array is always allocated using av_malloc() by whoever constructs
|
||||
* the frame. It is freed in av_frame_unref().
|
||||
*/
|
||||
AVBufferRef **extended_buf;
|
||||
/**
|
||||
* Number of elements in extended_buf.
|
||||
*/
|
||||
int nb_extended_buf;
|
||||
|
||||
AVFrameSideData **side_data;
|
||||
int nb_side_data;
|
||||
|
||||
/**
|
||||
* @defgroup lavu_frame_flags AV_FRAME_FLAGS
|
||||
* Flags describing additional frame properties.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* The frame data may be corrupted, e.g. due to decoding errors.
|
||||
*/
|
||||
#define AV_FRAME_FLAG_CORRUPT (1 << 0)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Frame flags, a combination of @ref lavu_frame_flags
|
||||
*/
|
||||
int flags;
|
||||
|
||||
/**
|
||||
* MPEG vs JPEG YUV range.
|
||||
* It must be accessed using av_frame_get_color_range() and
|
||||
* av_frame_set_color_range().
|
||||
* - encoding: Set by user
|
||||
* - decoding: Set by libavcodec
|
||||
*/
|
||||
enum AVColorRange color_range;
|
||||
|
||||
enum AVColorPrimaries color_primaries;
|
||||
|
||||
enum AVColorTransferCharacteristic color_trc;
|
||||
|
||||
/**
|
||||
* YUV colorspace type.
|
||||
* It must be accessed using av_frame_get_colorspace() and
|
||||
* av_frame_set_colorspace().
|
||||
* - encoding: Set by user
|
||||
* - decoding: Set by libavcodec
|
||||
*/
|
||||
enum AVColorSpace colorspace;
|
||||
|
||||
enum AVChromaLocation chroma_location;
|
||||
|
||||
/**
|
||||
* frame timestamp estimated using various heuristics, in stream time base
|
||||
* Code outside libavutil should access this field using:
|
||||
* av_frame_get_best_effort_timestamp(frame)
|
||||
* - encoding: unused
|
||||
* - decoding: set by libavcodec, read by user.
|
||||
*/
|
||||
int64_t best_effort_timestamp;
|
||||
|
||||
/**
|
||||
* reordered pos from the last AVPacket that has been input into the decoder
|
||||
* Code outside libavutil should access this field using:
|
||||
* av_frame_get_pkt_pos(frame)
|
||||
* - encoding: unused
|
||||
* - decoding: Read by user.
|
||||
*/
|
||||
int64_t pkt_pos;
|
||||
|
||||
/**
|
||||
* duration of the corresponding packet, expressed in
|
||||
* AVStream->time_base units, 0 if unknown.
|
||||
* Code outside libavutil should access this field using:
|
||||
* av_frame_get_pkt_duration(frame)
|
||||
* - encoding: unused
|
||||
* - decoding: Read by user.
|
||||
*/
|
||||
int64_t pkt_duration;
|
||||
|
||||
/**
|
||||
* metadata.
|
||||
* Code outside libavutil should access this field using:
|
||||
* av_frame_get_metadata(frame)
|
||||
* - encoding: Set by user.
|
||||
* - decoding: Set by libavcodec.
|
||||
*/
|
||||
AVDictionary *metadata;
|
||||
|
||||
/**
|
||||
* decode error flags of the frame, set to a combination of
|
||||
* FF_DECODE_ERROR_xxx flags if the decoder produced a frame, but there
|
||||
* were errors during the decoding.
|
||||
* Code outside libavutil should access this field using:
|
||||
* av_frame_get_decode_error_flags(frame)
|
||||
* - encoding: unused
|
||||
* - decoding: set by libavcodec, read by user.
|
||||
*/
|
||||
int decode_error_flags;
|
||||
#define FF_DECODE_ERROR_INVALID_BITSTREAM 1
|
||||
#define FF_DECODE_ERROR_MISSING_REFERENCE 2
|
||||
|
||||
/**
|
||||
* number of audio channels, only used for audio.
|
||||
* Code outside libavutil should access this field using:
|
||||
* av_frame_get_channels(frame)
|
||||
* - encoding: unused
|
||||
* - decoding: Read by user.
|
||||
*/
|
||||
int channels;
|
||||
|
||||
/**
|
||||
* size of the corresponding packet containing the compressed
|
||||
* frame. It must be accessed using av_frame_get_pkt_size() and
|
||||
* av_frame_set_pkt_size().
|
||||
* It is set to a negative value if unknown.
|
||||
* - encoding: unused
|
||||
* - decoding: set by libavcodec, read by user.
|
||||
*/
|
||||
int pkt_size;
|
||||
|
||||
#if FF_API_FRAME_QP
|
||||
/**
|
||||
* QP table
|
||||
* Not to be accessed directly from outside libavutil
|
||||
*/
|
||||
attribute_deprecated
|
||||
int8_t *qscale_table;
|
||||
/**
|
||||
* QP store stride
|
||||
* Not to be accessed directly from outside libavutil
|
||||
*/
|
||||
attribute_deprecated
|
||||
int qstride;
|
||||
|
||||
attribute_deprecated
|
||||
int qscale_type;
|
||||
|
||||
/**
|
||||
* Not to be accessed directly from outside libavutil
|
||||
*/
|
||||
AVBufferRef *qp_table_buf;
|
||||
#endif
|
||||
} AVFrame;
|
||||
|
||||
/**
|
||||
* Accessors for some AVFrame fields.
|
||||
* The position of these field in the structure is not part of the ABI,
|
||||
* they should not be accessed directly outside libavutil.
|
||||
*/
|
||||
int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame);
|
||||
void av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val);
|
||||
int64_t av_frame_get_pkt_duration (const AVFrame *frame);
|
||||
void av_frame_set_pkt_duration (AVFrame *frame, int64_t val);
|
||||
int64_t av_frame_get_pkt_pos (const AVFrame *frame);
|
||||
void av_frame_set_pkt_pos (AVFrame *frame, int64_t val);
|
||||
int64_t av_frame_get_channel_layout (const AVFrame *frame);
|
||||
void av_frame_set_channel_layout (AVFrame *frame, int64_t val);
|
||||
int av_frame_get_channels (const AVFrame *frame);
|
||||
void av_frame_set_channels (AVFrame *frame, int val);
|
||||
int av_frame_get_sample_rate (const AVFrame *frame);
|
||||
void av_frame_set_sample_rate (AVFrame *frame, int val);
|
||||
AVDictionary *av_frame_get_metadata (const AVFrame *frame);
|
||||
void av_frame_set_metadata (AVFrame *frame, AVDictionary *val);
|
||||
int av_frame_get_decode_error_flags (const AVFrame *frame);
|
||||
void av_frame_set_decode_error_flags (AVFrame *frame, int val);
|
||||
int av_frame_get_pkt_size(const AVFrame *frame);
|
||||
void av_frame_set_pkt_size(AVFrame *frame, int val);
|
||||
AVDictionary **avpriv_frame_get_metadatap(AVFrame *frame);
|
||||
#if FF_API_FRAME_QP
|
||||
int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type);
|
||||
int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type);
|
||||
#endif
|
||||
enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame);
|
||||
void av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val);
|
||||
enum AVColorRange av_frame_get_color_range(const AVFrame *frame);
|
||||
void av_frame_set_color_range(AVFrame *frame, enum AVColorRange val);
|
||||
|
||||
/**
|
||||
* Get the name of a colorspace.
|
||||
* @return a static string identifying the colorspace; can be NULL.
|
||||
*/
|
||||
const char *av_get_colorspace_name(enum AVColorSpace val);
|
||||
|
||||
/**
|
||||
* Allocate an AVFrame and set its fields to default values. The resulting
|
||||
* struct must be freed using av_frame_free().
|
||||
*
|
||||
* @return An AVFrame filled with default values or NULL on failure.
|
||||
*
|
||||
* @note this only allocates the AVFrame itself, not the data buffers. Those
|
||||
* must be allocated through other means, e.g. with av_frame_get_buffer() or
|
||||
* manually.
|
||||
*/
|
||||
AVFrame *av_frame_alloc(void);
|
||||
|
||||
/**
|
||||
* Free the frame and any dynamically allocated objects in it,
|
||||
* e.g. extended_data. If the frame is reference counted, it will be
|
||||
* unreferenced first.
|
||||
*
|
||||
* @param frame frame to be freed. The pointer will be set to NULL.
|
||||
*/
|
||||
void av_frame_free(AVFrame **frame);
|
||||
|
||||
/**
|
||||
* Set up a new reference to the data described by the source frame.
|
||||
*
|
||||
* Copy frame properties from src to dst and create a new reference for each
|
||||
* AVBufferRef from src.
|
||||
*
|
||||
* If src is not reference counted, new buffers are allocated and the data is
|
||||
* copied.
|
||||
*
|
||||
* @return 0 on success, a negative AVERROR on error
|
||||
*/
|
||||
int av_frame_ref(AVFrame *dst, const AVFrame *src);
|
||||
|
||||
/**
|
||||
* Create a new frame that references the same data as src.
|
||||
*
|
||||
* This is a shortcut for av_frame_alloc()+av_frame_ref().
|
||||
*
|
||||
* @return newly created AVFrame on success, NULL on error.
|
||||
*/
|
||||
AVFrame *av_frame_clone(const AVFrame *src);
|
||||
|
||||
/**
|
||||
* Unreference all the buffers referenced by frame and reset the frame fields.
|
||||
*/
|
||||
void av_frame_unref(AVFrame *frame);
|
||||
|
||||
/**
|
||||
* Move everything contained in src to dst and reset src.
|
||||
*/
|
||||
void av_frame_move_ref(AVFrame *dst, AVFrame *src);
|
||||
|
||||
/**
|
||||
* Allocate new buffer(s) for audio or video data.
|
||||
*
|
||||
* The following fields must be set on frame before calling this function:
|
||||
* - format (pixel format for video, sample format for audio)
|
||||
* - width and height for video
|
||||
* - nb_samples and channel_layout for audio
|
||||
*
|
||||
* This function will fill AVFrame.data and AVFrame.buf arrays and, if
|
||||
* necessary, allocate and fill AVFrame.extended_data and AVFrame.extended_buf.
|
||||
* For planar formats, one buffer will be allocated for each plane.
|
||||
*
|
||||
* @param frame frame in which to store the new buffers.
|
||||
* @param align required buffer size alignment
|
||||
*
|
||||
* @return 0 on success, a negative AVERROR on error.
|
||||
*/
|
||||
int av_frame_get_buffer(AVFrame *frame, int align);
|
||||
|
||||
/**
|
||||
* Check if the frame data is writable.
|
||||
*
|
||||
* @return A positive value if the frame data is writable (which is true if and
|
||||
* only if each of the underlying buffers has only one reference, namely the one
|
||||
* stored in this frame). Return 0 otherwise.
|
||||
*
|
||||
* If 1 is returned the answer is valid until av_buffer_ref() is called on any
|
||||
* of the underlying AVBufferRefs (e.g. through av_frame_ref() or directly).
|
||||
*
|
||||
* @see av_frame_make_writable(), av_buffer_is_writable()
|
||||
*/
|
||||
int av_frame_is_writable(AVFrame *frame);
|
||||
|
||||
/**
|
||||
* Ensure that the frame data is writable, avoiding data copy if possible.
|
||||
*
|
||||
* Do nothing if the frame is writable, allocate new buffers and copy the data
|
||||
* if it is not.
|
||||
*
|
||||
* @return 0 on success, a negative AVERROR on error.
|
||||
*
|
||||
* @see av_frame_is_writable(), av_buffer_is_writable(),
|
||||
* av_buffer_make_writable()
|
||||
*/
|
||||
int av_frame_make_writable(AVFrame *frame);
|
||||
|
||||
/**
|
||||
* Copy the frame data from src to dst.
|
||||
*
|
||||
* This function does not allocate anything, dst must be already initialized and
|
||||
* allocated with the same parameters as src.
|
||||
*
|
||||
* This function only copies the frame data (i.e. the contents of the data /
|
||||
* extended data arrays), not any other properties.
|
||||
*
|
||||
* @return >= 0 on success, a negative AVERROR on error.
|
||||
*/
|
||||
int av_frame_copy(AVFrame *dst, const AVFrame *src);
|
||||
|
||||
/**
|
||||
* Copy only "metadata" fields from src to dst.
|
||||
*
|
||||
* Metadata for the purpose of this function are those fields that do not affect
|
||||
* the data layout in the buffers. E.g. pts, sample rate (for audio) or sample
|
||||
* aspect ratio (for video), but not width/height or channel layout.
|
||||
* Side data is also copied.
|
||||
*/
|
||||
int av_frame_copy_props(AVFrame *dst, const AVFrame *src);
|
||||
|
||||
/**
|
||||
* Get the buffer reference a given data plane is stored in.
|
||||
*
|
||||
* @param plane index of the data plane of interest in frame->extended_data.
|
||||
*
|
||||
* @return the buffer reference that contains the plane or NULL if the input
|
||||
* frame is not valid.
|
||||
*/
|
||||
AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane);
|
||||
|
||||
/**
|
||||
* Add a new side data to a frame.
|
||||
*
|
||||
* @param frame a frame to which the side data should be added
|
||||
* @param type type of the added side data
|
||||
* @param size size of the side data
|
||||
*
|
||||
* @return newly added side data on success, NULL on error
|
||||
*/
|
||||
AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
|
||||
enum AVFrameSideDataType type,
|
||||
int size);
|
||||
|
||||
/**
|
||||
* @return a pointer to the side data of a given type on success, NULL if there
|
||||
* is no side data with such type in this frame.
|
||||
*/
|
||||
AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
|
||||
enum AVFrameSideDataType type);
|
||||
|
||||
/**
|
||||
* If side data of the supplied type exists in the frame, free it and remove it
|
||||
* from the frame.
|
||||
*/
|
||||
void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type);
|
||||
|
||||
/**
|
||||
* @return a string identifying the side data type
|
||||
*/
|
||||
const char *av_frame_side_data_name(enum AVFrameSideDataType type);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* AVUTIL_FRAME_H */
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* Copyright (c) 2011 Mans Rullgard
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_INTFLOAT_H
|
||||
#define AVUTIL_INTFLOAT_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "attributes.h"
|
||||
|
||||
union av_intfloat32 {
|
||||
uint32_t i;
|
||||
float f;
|
||||
};
|
||||
|
||||
union av_intfloat64 {
|
||||
uint64_t i;
|
||||
double f;
|
||||
};
|
||||
|
||||
/**
|
||||
* Reinterpret a 32-bit integer as a float.
|
||||
*/
|
||||
static av_always_inline float av_int2float(uint32_t i)
|
||||
{
|
||||
union av_intfloat32 v;
|
||||
v.i = i;
|
||||
return v.f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reinterpret a float as a 32-bit integer.
|
||||
*/
|
||||
static av_always_inline uint32_t av_float2int(float f)
|
||||
{
|
||||
union av_intfloat32 v;
|
||||
v.f = f;
|
||||
return v.i;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reinterpret a 64-bit integer as a double.
|
||||
*/
|
||||
static av_always_inline double av_int2double(uint64_t i)
|
||||
{
|
||||
union av_intfloat64 v;
|
||||
v.i = i;
|
||||
return v.f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reinterpret a double as a 64-bit integer.
|
||||
*/
|
||||
static av_always_inline uint64_t av_double2int(double f)
|
||||
{
|
||||
union av_intfloat64 v;
|
||||
v.f = f;
|
||||
return v.i;
|
||||
}
|
||||
|
||||
#endif /* AVUTIL_INTFLOAT_H */
|
|
@ -0,0 +1,359 @@
|
|||
/*
|
||||
* copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_LOG_H
|
||||
#define AVUTIL_LOG_H
|
||||
|
||||
#include <stdarg.h>
|
||||
#include "avutil.h"
|
||||
#include "attributes.h"
|
||||
#include "version.h"
|
||||
|
||||
typedef enum {
|
||||
AV_CLASS_CATEGORY_NA = 0,
|
||||
AV_CLASS_CATEGORY_INPUT,
|
||||
AV_CLASS_CATEGORY_OUTPUT,
|
||||
AV_CLASS_CATEGORY_MUXER,
|
||||
AV_CLASS_CATEGORY_DEMUXER,
|
||||
AV_CLASS_CATEGORY_ENCODER,
|
||||
AV_CLASS_CATEGORY_DECODER,
|
||||
AV_CLASS_CATEGORY_FILTER,
|
||||
AV_CLASS_CATEGORY_BITSTREAM_FILTER,
|
||||
AV_CLASS_CATEGORY_SWSCALER,
|
||||
AV_CLASS_CATEGORY_SWRESAMPLER,
|
||||
AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT = 40,
|
||||
AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
|
||||
AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT,
|
||||
AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
|
||||
AV_CLASS_CATEGORY_DEVICE_OUTPUT,
|
||||
AV_CLASS_CATEGORY_DEVICE_INPUT,
|
||||
AV_CLASS_CATEGORY_NB, ///< not part of ABI/API
|
||||
}AVClassCategory;
|
||||
|
||||
#define AV_IS_INPUT_DEVICE(category) \
|
||||
(((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT) || \
|
||||
((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT) || \
|
||||
((category) == AV_CLASS_CATEGORY_DEVICE_INPUT))
|
||||
|
||||
#define AV_IS_OUTPUT_DEVICE(category) \
|
||||
(((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT) || \
|
||||
((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT) || \
|
||||
((category) == AV_CLASS_CATEGORY_DEVICE_OUTPUT))
|
||||
|
||||
struct AVOptionRanges;
|
||||
|
||||
/**
|
||||
* Describe the class of an AVClass context structure. That is an
|
||||
* arbitrary struct of which the first field is a pointer to an
|
||||
* AVClass struct (e.g. AVCodecContext, AVFormatContext etc.).
|
||||
*/
|
||||
typedef struct AVClass {
|
||||
/**
|
||||
* The name of the class; usually it is the same name as the
|
||||
* context structure type to which the AVClass is associated.
|
||||
*/
|
||||
const char* class_name;
|
||||
|
||||
/**
|
||||
* A pointer to a function which returns the name of a context
|
||||
* instance ctx associated with the class.
|
||||
*/
|
||||
const char* (*item_name)(void* ctx);
|
||||
|
||||
/**
|
||||
* a pointer to the first option specified in the class if any or NULL
|
||||
*
|
||||
* @see av_set_default_options()
|
||||
*/
|
||||
const struct AVOption *option;
|
||||
|
||||
/**
|
||||
* LIBAVUTIL_VERSION with which this structure was created.
|
||||
* This is used to allow fields to be added without requiring major
|
||||
* version bumps everywhere.
|
||||
*/
|
||||
|
||||
int version;
|
||||
|
||||
/**
|
||||
* Offset in the structure where log_level_offset is stored.
|
||||
* 0 means there is no such variable
|
||||
*/
|
||||
int log_level_offset_offset;
|
||||
|
||||
/**
|
||||
* Offset in the structure where a pointer to the parent context for
|
||||
* logging is stored. For example a decoder could pass its AVCodecContext
|
||||
* to eval as such a parent context, which an av_log() implementation
|
||||
* could then leverage to display the parent context.
|
||||
* The offset can be NULL.
|
||||
*/
|
||||
int parent_log_context_offset;
|
||||
|
||||
/**
|
||||
* Return next AVOptions-enabled child or NULL
|
||||
*/
|
||||
void* (*child_next)(void *obj, void *prev);
|
||||
|
||||
/**
|
||||
* Return an AVClass corresponding to the next potential
|
||||
* AVOptions-enabled child.
|
||||
*
|
||||
* The difference between child_next and this is that
|
||||
* child_next iterates over _already existing_ objects, while
|
||||
* child_class_next iterates over _all possible_ children.
|
||||
*/
|
||||
const struct AVClass* (*child_class_next)(const struct AVClass *prev);
|
||||
|
||||
/**
|
||||
* Category used for visualization (like color)
|
||||
* This is only set if the category is equal for all objects using this class.
|
||||
* available since version (51 << 16 | 56 << 8 | 100)
|
||||
*/
|
||||
AVClassCategory category;
|
||||
|
||||
/**
|
||||
* Callback to return the category.
|
||||
* available since version (51 << 16 | 59 << 8 | 100)
|
||||
*/
|
||||
AVClassCategory (*get_category)(void* ctx);
|
||||
|
||||
/**
|
||||
* Callback to return the supported/allowed ranges.
|
||||
* available since version (52.12)
|
||||
*/
|
||||
int (*query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags);
|
||||
} AVClass;
|
||||
|
||||
/**
|
||||
* @addtogroup lavu_log
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* @defgroup lavu_log_constants Logging Constants
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Print no output.
|
||||
*/
|
||||
#define AV_LOG_QUIET -8
|
||||
|
||||
/**
|
||||
* Something went really wrong and we will crash now.
|
||||
*/
|
||||
#define AV_LOG_PANIC 0
|
||||
|
||||
/**
|
||||
* Something went wrong and recovery is not possible.
|
||||
* For example, no header was found for a format which depends
|
||||
* on headers or an illegal combination of parameters is used.
|
||||
*/
|
||||
#define AV_LOG_FATAL 8
|
||||
|
||||
/**
|
||||
* Something went wrong and cannot losslessly be recovered.
|
||||
* However, not all future data is affected.
|
||||
*/
|
||||
#define AV_LOG_ERROR 16
|
||||
|
||||
/**
|
||||
* Something somehow does not look correct. This may or may not
|
||||
* lead to problems. An example would be the use of '-vstrict -2'.
|
||||
*/
|
||||
#define AV_LOG_WARNING 24
|
||||
|
||||
/**
|
||||
* Standard information.
|
||||
*/
|
||||
#define AV_LOG_INFO 32
|
||||
|
||||
/**
|
||||
* Detailed information.
|
||||
*/
|
||||
#define AV_LOG_VERBOSE 40
|
||||
|
||||
/**
|
||||
* Stuff which is only useful for libav* developers.
|
||||
*/
|
||||
#define AV_LOG_DEBUG 48
|
||||
|
||||
/**
|
||||
* Extremely verbose debugging, useful for libav* development.
|
||||
*/
|
||||
#define AV_LOG_TRACE 56
|
||||
|
||||
#define AV_LOG_MAX_OFFSET (AV_LOG_TRACE - AV_LOG_QUIET)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sets additional colors for extended debugging sessions.
|
||||
* @code
|
||||
av_log(ctx, AV_LOG_DEBUG|AV_LOG_C(134), "Message in purple\n");
|
||||
@endcode
|
||||
* Requires 256color terminal support. Uses outside debugging is not
|
||||
* recommended.
|
||||
*/
|
||||
#define AV_LOG_C(x) ((x) << 8)
|
||||
|
||||
/**
|
||||
* Send the specified message to the log if the level is less than or equal
|
||||
* to the current av_log_level. By default, all logging messages are sent to
|
||||
* stderr. This behavior can be altered by setting a different logging callback
|
||||
* function.
|
||||
* @see av_log_set_callback
|
||||
*
|
||||
* @param avcl A pointer to an arbitrary struct of which the first field is a
|
||||
* pointer to an AVClass struct or NULL if general log.
|
||||
* @param level The importance level of the message expressed using a @ref
|
||||
* lavu_log_constants "Logging Constant".
|
||||
* @param fmt The format string (printf-compatible) that specifies how
|
||||
* subsequent arguments are converted to output.
|
||||
*/
|
||||
void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4);
|
||||
|
||||
|
||||
/**
|
||||
* Send the specified message to the log if the level is less than or equal
|
||||
* to the current av_log_level. By default, all logging messages are sent to
|
||||
* stderr. This behavior can be altered by setting a different logging callback
|
||||
* function.
|
||||
* @see av_log_set_callback
|
||||
*
|
||||
* @param avcl A pointer to an arbitrary struct of which the first field is a
|
||||
* pointer to an AVClass struct.
|
||||
* @param level The importance level of the message expressed using a @ref
|
||||
* lavu_log_constants "Logging Constant".
|
||||
* @param fmt The format string (printf-compatible) that specifies how
|
||||
* subsequent arguments are converted to output.
|
||||
* @param vl The arguments referenced by the format string.
|
||||
*/
|
||||
void av_vlog(void *avcl, int level, const char *fmt, va_list vl);
|
||||
|
||||
/**
|
||||
* Get the current log level
|
||||
*
|
||||
* @see lavu_log_constants
|
||||
*
|
||||
* @return Current log level
|
||||
*/
|
||||
int av_log_get_level(void);
|
||||
|
||||
/**
|
||||
* Set the log level
|
||||
*
|
||||
* @see lavu_log_constants
|
||||
*
|
||||
* @param level Logging level
|
||||
*/
|
||||
void av_log_set_level(int level);
|
||||
|
||||
/**
|
||||
* Set the logging callback
|
||||
*
|
||||
* @note The callback must be thread safe, even if the application does not use
|
||||
* threads itself as some codecs are multithreaded.
|
||||
*
|
||||
* @see av_log_default_callback
|
||||
*
|
||||
* @param callback A logging function with a compatible signature.
|
||||
*/
|
||||
void av_log_set_callback(void (*callback)(void*, int, const char*, va_list));
|
||||
|
||||
/**
|
||||
* Default logging callback
|
||||
*
|
||||
* It prints the message to stderr, optionally colorizing it.
|
||||
*
|
||||
* @param avcl A pointer to an arbitrary struct of which the first field is a
|
||||
* pointer to an AVClass struct.
|
||||
* @param level The importance level of the message expressed using a @ref
|
||||
* lavu_log_constants "Logging Constant".
|
||||
* @param fmt The format string (printf-compatible) that specifies how
|
||||
* subsequent arguments are converted to output.
|
||||
* @param vl The arguments referenced by the format string.
|
||||
*/
|
||||
void av_log_default_callback(void *avcl, int level, const char *fmt,
|
||||
va_list vl);
|
||||
|
||||
/**
|
||||
* Return the context name
|
||||
*
|
||||
* @param ctx The AVClass context
|
||||
*
|
||||
* @return The AVClass class_name
|
||||
*/
|
||||
const char* av_default_item_name(void* ctx);
|
||||
AVClassCategory av_default_get_category(void *ptr);
|
||||
|
||||
/**
|
||||
* Format a line of log the same way as the default callback.
|
||||
* @param line buffer to receive the formatted line
|
||||
* @param line_size size of the buffer
|
||||
* @param print_prefix used to store whether the prefix must be printed;
|
||||
* must point to a persistent integer initially set to 1
|
||||
*/
|
||||
void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl,
|
||||
char *line, int line_size, int *print_prefix);
|
||||
|
||||
#if FF_API_DLOG
|
||||
/**
|
||||
* av_dlog macros
|
||||
* @deprecated unused
|
||||
* Useful to print debug messages that shouldn't get compiled in normally.
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
# define av_dlog(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__)
|
||||
#else
|
||||
# define av_dlog(pctx, ...) do { if (0) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0)
|
||||
#endif
|
||||
#endif /* FF_API_DLOG */
|
||||
|
||||
/**
|
||||
* Skip repeated messages, this requires the user app to use av_log() instead of
|
||||
* (f)printf as the 2 would otherwise interfere and lead to
|
||||
* "Last message repeated x times" messages below (f)printf messages with some
|
||||
* bad luck.
|
||||
* Also to receive the last, "last repeated" line if any, the user app must
|
||||
* call av_log(NULL, AV_LOG_QUIET, "%s", ""); at the end
|
||||
*/
|
||||
#define AV_LOG_SKIP_REPEATED 1
|
||||
|
||||
/**
|
||||
* Include the log severity in messages originating from codecs.
|
||||
*
|
||||
* Results in messages such as:
|
||||
* [rawvideo @ 0xDEADBEEF] [error] encode did not produce valid pts
|
||||
*/
|
||||
#define AV_LOG_PRINT_LEVEL 2
|
||||
|
||||
void av_log_set_flags(int arg);
|
||||
int av_log_get_flags(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* AVUTIL_LOG_H */
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @ingroup lavu
|
||||
* Utility Preprocessor macros
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_MACROS_H
|
||||
#define AVUTIL_MACROS_H
|
||||
|
||||
/**
|
||||
* @addtogroup preproc_misc Preprocessor String Macros
|
||||
*
|
||||
* String manipulation macros
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define AV_STRINGIFY(s) AV_TOSTRING(s)
|
||||
#define AV_TOSTRING(s) #s
|
||||
|
||||
#define AV_GLUE(a, b) a ## b
|
||||
#define AV_JOIN(a, b) AV_GLUE(a, b)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#define AV_PRAGMA(s) _Pragma(#s)
|
||||
|
||||
#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1))
|
||||
|
||||
#endif /* AVUTIL_MACROS_H */
|
|
@ -0,0 +1,165 @@
|
|||
/*
|
||||
* copyright (c) 2005-2012 Michael Niedermayer <michaelni@gmx.at>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_MATHEMATICS_H
|
||||
#define AVUTIL_MATHEMATICS_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <math.h>
|
||||
#include "attributes.h"
|
||||
#include "rational.h"
|
||||
#include "intfloat.h"
|
||||
|
||||
#ifndef M_E
|
||||
#define M_E 2.7182818284590452354 /* e */
|
||||
#endif
|
||||
#ifndef M_LN2
|
||||
#define M_LN2 0.69314718055994530942 /* log_e 2 */
|
||||
#endif
|
||||
#ifndef M_LN10
|
||||
#define M_LN10 2.30258509299404568402 /* log_e 10 */
|
||||
#endif
|
||||
#ifndef M_LOG2_10
|
||||
#define M_LOG2_10 3.32192809488736234787 /* log_2 10 */
|
||||
#endif
|
||||
#ifndef M_PHI
|
||||
#define M_PHI 1.61803398874989484820 /* phi / golden ratio */
|
||||
#endif
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846 /* pi */
|
||||
#endif
|
||||
#ifndef M_PI_2
|
||||
#define M_PI_2 1.57079632679489661923 /* pi/2 */
|
||||
#endif
|
||||
#ifndef M_SQRT1_2
|
||||
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
|
||||
#endif
|
||||
#ifndef M_SQRT2
|
||||
#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
|
||||
#endif
|
||||
#ifndef NAN
|
||||
#define NAN av_int2float(0x7fc00000)
|
||||
#endif
|
||||
#ifndef INFINITY
|
||||
#define INFINITY av_int2float(0x7f800000)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup lavu_math
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
enum AVRounding {
|
||||
AV_ROUND_ZERO = 0, ///< Round toward zero.
|
||||
AV_ROUND_INF = 1, ///< Round away from zero.
|
||||
AV_ROUND_DOWN = 2, ///< Round toward -infinity.
|
||||
AV_ROUND_UP = 3, ///< Round toward +infinity.
|
||||
AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero.
|
||||
AV_ROUND_PASS_MINMAX = 8192, ///< Flag to pass INT64_MIN/MAX through instead of rescaling, this avoids special cases for AV_NOPTS_VALUE
|
||||
};
|
||||
|
||||
/**
|
||||
* Compute the greatest common divisor of a and b.
|
||||
*
|
||||
* @return gcd of a and b up to sign; if a >= 0 and b >= 0, return value is >= 0;
|
||||
* if a == 0 and b == 0, returns 0.
|
||||
*/
|
||||
int64_t av_const av_gcd(int64_t a, int64_t b);
|
||||
|
||||
/**
|
||||
* Rescale a 64-bit integer with rounding to nearest.
|
||||
* A simple a*b/c isn't possible as it can overflow.
|
||||
*/
|
||||
int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const;
|
||||
|
||||
/**
|
||||
* Rescale a 64-bit integer with specified rounding.
|
||||
* A simple a*b/c isn't possible as it can overflow.
|
||||
*
|
||||
* @return rescaled value a, or if AV_ROUND_PASS_MINMAX is set and a is
|
||||
* INT64_MIN or INT64_MAX then a is passed through unchanged.
|
||||
*/
|
||||
int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_const;
|
||||
|
||||
/**
|
||||
* Rescale a 64-bit integer by 2 rational numbers.
|
||||
*/
|
||||
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;
|
||||
|
||||
/**
|
||||
* Rescale a 64-bit integer by 2 rational numbers with specified rounding.
|
||||
*
|
||||
* @return rescaled value a, or if AV_ROUND_PASS_MINMAX is set and a is
|
||||
* INT64_MIN or INT64_MAX then a is passed through unchanged.
|
||||
*/
|
||||
int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq,
|
||||
enum AVRounding) av_const;
|
||||
|
||||
/**
|
||||
* Compare 2 timestamps each in its own timebases.
|
||||
* The result of the function is undefined if one of the timestamps
|
||||
* is outside the int64_t range when represented in the others timebase.
|
||||
* @return -1 if ts_a is before ts_b, 1 if ts_a is after ts_b or 0 if they represent the same position
|
||||
*/
|
||||
int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b);
|
||||
|
||||
/**
|
||||
* Compare 2 integers modulo mod.
|
||||
* That is we compare integers a and b for which only the least
|
||||
* significant log2(mod) bits are known.
|
||||
*
|
||||
* @param mod must be a power of 2
|
||||
* @return a negative value if a is smaller than b
|
||||
* a positive value if a is greater than b
|
||||
* 0 if a equals b
|
||||
*/
|
||||
int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod);
|
||||
|
||||
/**
|
||||
* Rescale a timestamp while preserving known durations.
|
||||
*
|
||||
* @param in_ts Input timestamp
|
||||
* @param in_tb Input timebase
|
||||
* @param fs_tb Duration and *last timebase
|
||||
* @param duration duration till the next call
|
||||
* @param out_tb Output timebase
|
||||
*/
|
||||
int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts, AVRational fs_tb, int duration, int64_t *last, AVRational out_tb);
|
||||
|
||||
/**
|
||||
* Add a value to a timestamp.
|
||||
*
|
||||
* This function guarantees that when the same value is repeatly added that
|
||||
* no accumulation of rounding errors occurs.
|
||||
*
|
||||
* @param ts Input timestamp
|
||||
* @param ts_tb Input timestamp timebase
|
||||
* @param inc value to add to ts
|
||||
* @param inc_tb inc timebase
|
||||
*/
|
||||
int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc);
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* AVUTIL_MATHEMATICS_H */
|
|
@ -0,0 +1,406 @@
|
|||
/*
|
||||
* copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* memory handling functions
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_MEM_H
|
||||
#define AVUTIL_MEM_H
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "attributes.h"
|
||||
#include "error.h"
|
||||
#include "avutil.h"
|
||||
|
||||
/**
|
||||
* @addtogroup lavu_mem
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C)
|
||||
#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
|
||||
#define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v
|
||||
#elif defined(__TI_COMPILER_VERSION__)
|
||||
#define DECLARE_ALIGNED(n,t,v) \
|
||||
AV_PRAGMA(DATA_ALIGN(v,n)) \
|
||||
t __attribute__((aligned(n))) v
|
||||
#define DECLARE_ASM_CONST(n,t,v) \
|
||||
AV_PRAGMA(DATA_ALIGN(v,n)) \
|
||||
static const t __attribute__((aligned(n))) v
|
||||
#elif defined(__GNUC__)
|
||||
#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
|
||||
#define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (n))) v
|
||||
#elif defined(_MSC_VER)
|
||||
#define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v
|
||||
#define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v
|
||||
#else
|
||||
#define DECLARE_ALIGNED(n,t,v) t v
|
||||
#define DECLARE_ASM_CONST(n,t,v) static const t v
|
||||
#endif
|
||||
|
||||
#if AV_GCC_VERSION_AT_LEAST(3,1)
|
||||
#define av_malloc_attrib __attribute__((__malloc__))
|
||||
#else
|
||||
#define av_malloc_attrib
|
||||
#endif
|
||||
|
||||
#if AV_GCC_VERSION_AT_LEAST(4,3)
|
||||
#define av_alloc_size(...) __attribute__((alloc_size(__VA_ARGS__)))
|
||||
#else
|
||||
#define av_alloc_size(...)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Allocate a block of size bytes with alignment suitable for all
|
||||
* memory accesses (including vectors if available on the CPU).
|
||||
* @param size Size in bytes for the memory block to be allocated.
|
||||
* @return Pointer to the allocated block, NULL if the block cannot
|
||||
* be allocated.
|
||||
* @see av_mallocz()
|
||||
*/
|
||||
void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1);
|
||||
|
||||
/**
|
||||
* Allocate a block of size * nmemb bytes with av_malloc().
|
||||
* @param nmemb Number of elements
|
||||
* @param size Size of the single element
|
||||
* @return Pointer to the allocated block, NULL if the block cannot
|
||||
* be allocated.
|
||||
* @see av_malloc()
|
||||
*/
|
||||
av_alloc_size(1, 2) static inline void *av_malloc_array(size_t nmemb, size_t size)
|
||||
{
|
||||
if (!size || nmemb >= INT_MAX / size)
|
||||
return NULL;
|
||||
return av_malloc(nmemb * size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocate or reallocate a block of memory.
|
||||
* If ptr is NULL and size > 0, allocate a new block. If
|
||||
* size is zero, free the memory block pointed to by ptr.
|
||||
* @param ptr Pointer to a memory block already allocated with
|
||||
* av_realloc() or NULL.
|
||||
* @param size Size in bytes of the memory block to be allocated or
|
||||
* reallocated.
|
||||
* @return Pointer to a newly-reallocated block or NULL if the block
|
||||
* cannot be reallocated or the function is used to free the memory block.
|
||||
* @warning Pointers originating from the av_malloc() family of functions must
|
||||
* not be passed to av_realloc(). The former can be implemented using
|
||||
* memalign() (or other functions), and there is no guarantee that
|
||||
* pointers from such functions can be passed to realloc() at all.
|
||||
* The situation is undefined according to POSIX and may crash with
|
||||
* some libc implementations.
|
||||
* @see av_fast_realloc()
|
||||
*/
|
||||
void *av_realloc(void *ptr, size_t size) av_alloc_size(2);
|
||||
|
||||
/**
|
||||
* Allocate or reallocate a block of memory.
|
||||
* This function does the same thing as av_realloc, except:
|
||||
* - It takes two arguments and checks the result of the multiplication for
|
||||
* integer overflow.
|
||||
* - It frees the input block in case of failure, thus avoiding the memory
|
||||
* leak with the classic "buf = realloc(buf); if (!buf) return -1;".
|
||||
*/
|
||||
void *av_realloc_f(void *ptr, size_t nelem, size_t elsize);
|
||||
|
||||
/**
|
||||
* Allocate or reallocate a block of memory.
|
||||
* If *ptr is NULL and size > 0, allocate a new block. If
|
||||
* size is zero, free the memory block pointed to by ptr.
|
||||
* @param ptr Pointer to a pointer to a memory block already allocated
|
||||
* with av_realloc(), or pointer to a pointer to NULL.
|
||||
* The pointer is updated on success, or freed on failure.
|
||||
* @param size Size in bytes for the memory block to be allocated or
|
||||
* reallocated
|
||||
* @return Zero on success, an AVERROR error code on failure.
|
||||
* @warning Pointers originating from the av_malloc() family of functions must
|
||||
* not be passed to av_reallocp(). The former can be implemented using
|
||||
* memalign() (or other functions), and there is no guarantee that
|
||||
* pointers from such functions can be passed to realloc() at all.
|
||||
* The situation is undefined according to POSIX and may crash with
|
||||
* some libc implementations.
|
||||
*/
|
||||
av_warn_unused_result
|
||||
int av_reallocp(void *ptr, size_t size);
|
||||
|
||||
/**
|
||||
* Allocate or reallocate an array.
|
||||
* If ptr is NULL and nmemb > 0, allocate a new block. If
|
||||
* nmemb is zero, free the memory block pointed to by ptr.
|
||||
* @param ptr Pointer to a memory block already allocated with
|
||||
* av_realloc() or NULL.
|
||||
* @param nmemb Number of elements
|
||||
* @param size Size of the single element
|
||||
* @return Pointer to a newly-reallocated block or NULL if the block
|
||||
* cannot be reallocated or the function is used to free the memory block.
|
||||
* @warning Pointers originating from the av_malloc() family of functions must
|
||||
* not be passed to av_realloc(). The former can be implemented using
|
||||
* memalign() (or other functions), and there is no guarantee that
|
||||
* pointers from such functions can be passed to realloc() at all.
|
||||
* The situation is undefined according to POSIX and may crash with
|
||||
* some libc implementations.
|
||||
*/
|
||||
av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size);
|
||||
|
||||
/**
|
||||
* Allocate or reallocate an array through a pointer to a pointer.
|
||||
* If *ptr is NULL and nmemb > 0, allocate a new block. If
|
||||
* nmemb is zero, free the memory block pointed to by ptr.
|
||||
* @param ptr Pointer to a pointer to a memory block already allocated
|
||||
* with av_realloc(), or pointer to a pointer to NULL.
|
||||
* The pointer is updated on success, or freed on failure.
|
||||
* @param nmemb Number of elements
|
||||
* @param size Size of the single element
|
||||
* @return Zero on success, an AVERROR error code on failure.
|
||||
* @warning Pointers originating from the av_malloc() family of functions must
|
||||
* not be passed to av_realloc(). The former can be implemented using
|
||||
* memalign() (or other functions), and there is no guarantee that
|
||||
* pointers from such functions can be passed to realloc() at all.
|
||||
* The situation is undefined according to POSIX and may crash with
|
||||
* some libc implementations.
|
||||
*/
|
||||
av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
|
||||
|
||||
/**
|
||||
* Free a memory block which has been allocated with av_malloc(z)() or
|
||||
* av_realloc().
|
||||
* @param ptr Pointer to the memory block which should be freed.
|
||||
* @note ptr = NULL is explicitly allowed.
|
||||
* @note It is recommended that you use av_freep() instead.
|
||||
* @see av_freep()
|
||||
*/
|
||||
void av_free(void *ptr);
|
||||
|
||||
/**
|
||||
* Allocate a block of size bytes with alignment suitable for all
|
||||
* memory accesses (including vectors if available on the CPU) and
|
||||
* zero all the bytes of the block.
|
||||
* @param size Size in bytes for the memory block to be allocated.
|
||||
* @return Pointer to the allocated block, NULL if it cannot be allocated.
|
||||
* @see av_malloc()
|
||||
*/
|
||||
void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1);
|
||||
|
||||
/**
|
||||
* Allocate a block of nmemb * size bytes with alignment suitable for all
|
||||
* memory accesses (including vectors if available on the CPU) and
|
||||
* zero all the bytes of the block.
|
||||
* The allocation will fail if nmemb * size is greater than or equal
|
||||
* to INT_MAX.
|
||||
* @param nmemb
|
||||
* @param size
|
||||
* @return Pointer to the allocated block, NULL if it cannot be allocated.
|
||||
*/
|
||||
void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib;
|
||||
|
||||
/**
|
||||
* Allocate a block of size * nmemb bytes with av_mallocz().
|
||||
* @param nmemb Number of elements
|
||||
* @param size Size of the single element
|
||||
* @return Pointer to the allocated block, NULL if the block cannot
|
||||
* be allocated.
|
||||
* @see av_mallocz()
|
||||
* @see av_malloc_array()
|
||||
*/
|
||||
av_alloc_size(1, 2) static inline void *av_mallocz_array(size_t nmemb, size_t size)
|
||||
{
|
||||
if (!size || nmemb >= INT_MAX / size)
|
||||
return NULL;
|
||||
return av_mallocz(nmemb * size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicate the string s.
|
||||
* @param s string to be duplicated
|
||||
* @return Pointer to a newly-allocated string containing a
|
||||
* copy of s or NULL if the string cannot be allocated.
|
||||
*/
|
||||
char *av_strdup(const char *s) av_malloc_attrib;
|
||||
|
||||
/**
|
||||
* Duplicate a substring of the string s.
|
||||
* @param s string to be duplicated
|
||||
* @param len the maximum length of the resulting string (not counting the
|
||||
* terminating byte).
|
||||
* @return Pointer to a newly-allocated string containing a
|
||||
* copy of s or NULL if the string cannot be allocated.
|
||||
*/
|
||||
char *av_strndup(const char *s, size_t len) av_malloc_attrib;
|
||||
|
||||
/**
|
||||
* Duplicate the buffer p.
|
||||
* @param p buffer to be duplicated
|
||||
* @return Pointer to a newly allocated buffer containing a
|
||||
* copy of p or NULL if the buffer cannot be allocated.
|
||||
*/
|
||||
void *av_memdup(const void *p, size_t size);
|
||||
|
||||
/**
|
||||
* Free a memory block which has been allocated with av_malloc(z)() or
|
||||
* av_realloc() and set the pointer pointing to it to NULL.
|
||||
* @param ptr Pointer to the pointer to the memory block which should
|
||||
* be freed.
|
||||
* @note passing a pointer to a NULL pointer is safe and leads to no action.
|
||||
* @see av_free()
|
||||
*/
|
||||
void av_freep(void *ptr);
|
||||
|
||||
/**
|
||||
* Add an element to a dynamic array.
|
||||
*
|
||||
* The array to grow is supposed to be an array of pointers to
|
||||
* structures, and the element to add must be a pointer to an already
|
||||
* allocated structure.
|
||||
*
|
||||
* The array is reallocated when its size reaches powers of 2.
|
||||
* Therefore, the amortized cost of adding an element is constant.
|
||||
*
|
||||
* In case of success, the pointer to the array is updated in order to
|
||||
* point to the new grown array, and the number pointed to by nb_ptr
|
||||
* is incremented.
|
||||
* In case of failure, the array is freed, *tab_ptr is set to NULL and
|
||||
* *nb_ptr is set to 0.
|
||||
*
|
||||
* @param tab_ptr pointer to the array to grow
|
||||
* @param nb_ptr pointer to the number of elements in the array
|
||||
* @param elem element to add
|
||||
* @see av_dynarray_add_nofree(), av_dynarray2_add()
|
||||
*/
|
||||
void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem);
|
||||
|
||||
/**
|
||||
* Add an element to a dynamic array.
|
||||
*
|
||||
* Function has the same functionality as av_dynarray_add(),
|
||||
* but it doesn't free memory on fails. It returns error code
|
||||
* instead and leave current buffer untouched.
|
||||
*
|
||||
* @param tab_ptr pointer to the array to grow
|
||||
* @param nb_ptr pointer to the number of elements in the array
|
||||
* @param elem element to add
|
||||
* @return >=0 on success, negative otherwise.
|
||||
* @see av_dynarray_add(), av_dynarray2_add()
|
||||
*/
|
||||
av_warn_unused_result
|
||||
int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem);
|
||||
|
||||
/**
|
||||
* Add an element of size elem_size to a dynamic array.
|
||||
*
|
||||
* The array is reallocated when its number of elements reaches powers of 2.
|
||||
* Therefore, the amortized cost of adding an element is constant.
|
||||
*
|
||||
* In case of success, the pointer to the array is updated in order to
|
||||
* point to the new grown array, and the number pointed to by nb_ptr
|
||||
* is incremented.
|
||||
* In case of failure, the array is freed, *tab_ptr is set to NULL and
|
||||
* *nb_ptr is set to 0.
|
||||
*
|
||||
* @param tab_ptr pointer to the array to grow
|
||||
* @param nb_ptr pointer to the number of elements in the array
|
||||
* @param elem_size size in bytes of the elements in the array
|
||||
* @param elem_data pointer to the data of the element to add. If NULL, the space of
|
||||
* the new added element is not filled.
|
||||
* @return pointer to the data of the element to copy in the new allocated space.
|
||||
* If NULL, the new allocated space is left uninitialized."
|
||||
* @see av_dynarray_add(), av_dynarray_add_nofree()
|
||||
*/
|
||||
void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size,
|
||||
const uint8_t *elem_data);
|
||||
|
||||
/**
|
||||
* Multiply two size_t values checking for overflow.
|
||||
* @return 0 if success, AVERROR(EINVAL) if overflow.
|
||||
*/
|
||||
static inline int av_size_mult(size_t a, size_t b, size_t *r)
|
||||
{
|
||||
size_t t = a * b;
|
||||
/* Hack inspired from glibc: only try the division if nelem and elsize
|
||||
* are both greater than sqrt(SIZE_MAX). */
|
||||
if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b)
|
||||
return AVERROR(EINVAL);
|
||||
*r = t;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the maximum size that may me allocated in one block.
|
||||
*/
|
||||
void av_max_alloc(size_t max);
|
||||
|
||||
/**
|
||||
* deliberately overlapping memcpy implementation
|
||||
* @param dst destination buffer
|
||||
* @param back how many bytes back we start (the initial size of the overlapping window), must be > 0
|
||||
* @param cnt number of bytes to copy, must be >= 0
|
||||
*
|
||||
* cnt > back is valid, this will copy the bytes we just copied,
|
||||
* thus creating a repeating pattern with a period length of back.
|
||||
*/
|
||||
void av_memcpy_backptr(uint8_t *dst, int back, int cnt);
|
||||
|
||||
/**
|
||||
* Reallocate the given block if it is not large enough, otherwise do nothing.
|
||||
*
|
||||
* @see av_realloc
|
||||
*/
|
||||
void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
|
||||
|
||||
/**
|
||||
* Allocate a buffer, reusing the given one if large enough.
|
||||
*
|
||||
* Contrary to av_fast_realloc the current buffer contents might not be
|
||||
* preserved and on error the old buffer is freed, thus no special
|
||||
* handling to avoid memleaks is necessary.
|
||||
*
|
||||
* @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer
|
||||
* @param size size of the buffer *ptr points to
|
||||
* @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and
|
||||
* *size 0 if an error occurred.
|
||||
*/
|
||||
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
|
||||
|
||||
/**
|
||||
* Allocate a buffer, reusing the given one if large enough.
|
||||
*
|
||||
* All newly allocated space is initially cleared
|
||||
* Contrary to av_fast_realloc the current buffer contents might not be
|
||||
* preserved and on error the old buffer is freed, thus no special
|
||||
* handling to avoid memleaks is necessary.
|
||||
*
|
||||
* @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer
|
||||
* @param size size of the buffer *ptr points to
|
||||
* @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and
|
||||
* *size 0 if an error occurred.
|
||||
*/
|
||||
void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* AVUTIL_MEM_H */
|
|
@ -0,0 +1,469 @@
|
|||
/*
|
||||
* copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_PIXFMT_H
|
||||
#define AVUTIL_PIXFMT_H
|
||||
|
||||
/**
|
||||
* @file
|
||||
* pixel format definitions
|
||||
*
|
||||
*/
|
||||
|
||||
#include "libavutil/avconfig.h"
|
||||
#include "version.h"
|
||||
|
||||
#define AVPALETTE_SIZE 1024
|
||||
#define AVPALETTE_COUNT 256
|
||||
|
||||
/**
|
||||
* Pixel format.
|
||||
*
|
||||
* @note
|
||||
* AV_PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA
|
||||
* color is put together as:
|
||||
* (A << 24) | (R << 16) | (G << 8) | B
|
||||
* This is stored as BGRA on little-endian CPU architectures and ARGB on
|
||||
* big-endian CPUs.
|
||||
*
|
||||
* @par
|
||||
* When the pixel format is palettized RGB32 (AV_PIX_FMT_PAL8), the palettized
|
||||
* image data is stored in AVFrame.data[0]. The palette is transported in
|
||||
* AVFrame.data[1], is 1024 bytes long (256 4-byte entries) and is
|
||||
* formatted the same as in AV_PIX_FMT_RGB32 described above (i.e., it is
|
||||
* also endian-specific). Note also that the individual RGB32 palette
|
||||
* components stored in AVFrame.data[1] should be in the range 0..255.
|
||||
* This is important as many custom PAL8 video codecs that were designed
|
||||
* to run on the IBM VGA graphics adapter use 6-bit palette components.
|
||||
*
|
||||
* @par
|
||||
* For all the 8bit per pixel formats, an RGB32 palette is in data[1] like
|
||||
* for pal8. This palette is filled in automatically by the function
|
||||
* allocating the picture.
|
||||
*/
|
||||
enum AVPixelFormat {
|
||||
AV_PIX_FMT_NONE = -1,
|
||||
AV_PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
|
||||
AV_PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
|
||||
AV_PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB...
|
||||
AV_PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR...
|
||||
AV_PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
|
||||
AV_PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
|
||||
AV_PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
|
||||
AV_PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
|
||||
AV_PIX_FMT_GRAY8, ///< Y , 8bpp
|
||||
AV_PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb
|
||||
AV_PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb
|
||||
AV_PIX_FMT_PAL8, ///< 8 bit with AV_PIX_FMT_RGB32 palette
|
||||
AV_PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting color_range
|
||||
AV_PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting color_range
|
||||
AV_PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting color_range
|
||||
#if FF_API_XVMC
|
||||
AV_PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing
|
||||
AV_PIX_FMT_XVMC_MPEG2_IDCT,
|
||||
#define AV_PIX_FMT_XVMC AV_PIX_FMT_XVMC_MPEG2_IDCT
|
||||
#endif /* FF_API_XVMC */
|
||||
AV_PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
|
||||
AV_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
|
||||
AV_PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
|
||||
AV_PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
|
||||
AV_PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
|
||||
AV_PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
|
||||
AV_PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
|
||||
AV_PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
|
||||
AV_PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V)
|
||||
AV_PIX_FMT_NV21, ///< as above, but U and V bytes are swapped
|
||||
|
||||
AV_PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
|
||||
AV_PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
|
||||
AV_PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
|
||||
AV_PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
|
||||
|
||||
AV_PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian
|
||||
AV_PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian
|
||||
AV_PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
|
||||
AV_PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
|
||||
AV_PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
|
||||
#if FF_API_VDPAU
|
||||
AV_PIX_FMT_VDPAU_H264,///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
|
||||
AV_PIX_FMT_VDPAU_MPEG1,///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
|
||||
AV_PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
|
||||
AV_PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
|
||||
AV_PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
|
||||
#endif
|
||||
AV_PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian
|
||||
AV_PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian
|
||||
|
||||
AV_PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
|
||||
AV_PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
|
||||
AV_PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), big-endian , X=unused/undefined
|
||||
AV_PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined
|
||||
|
||||
AV_PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
|
||||
AV_PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
|
||||
AV_PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined
|
||||
AV_PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined
|
||||
|
||||
#if FF_API_VAAPI
|
||||
/** @name Deprecated pixel formats */
|
||||
/**@{*/
|
||||
AV_PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers
|
||||
AV_PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers
|
||||
AV_PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
|
||||
/**@}*/
|
||||
AV_PIX_FMT_VAAPI = AV_PIX_FMT_VAAPI_VLD,
|
||||
#else
|
||||
/**
|
||||
* Hardware acceleration through VA-API, data[3] contains a
|
||||
* VASurfaceID.
|
||||
*/
|
||||
AV_PIX_FMT_VAAPI,
|
||||
#endif
|
||||
|
||||
AV_PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
|
||||
AV_PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
|
||||
AV_PIX_FMT_YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
|
||||
AV_PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
|
||||
AV_PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
|
||||
AV_PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
|
||||
#if FF_API_VDPAU
|
||||
AV_PIX_FMT_VDPAU_MPEG4, ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
|
||||
#endif
|
||||
AV_PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer
|
||||
|
||||
AV_PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), little-endian, X=unused/undefined
|
||||
AV_PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), big-endian, X=unused/undefined
|
||||
AV_PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), little-endian, X=unused/undefined
|
||||
AV_PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), big-endian, X=unused/undefined
|
||||
AV_PIX_FMT_YA8, ///< 8bit gray, 8bit alpha
|
||||
|
||||
AV_PIX_FMT_Y400A = AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8
|
||||
AV_PIX_FMT_GRAY8A= AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8
|
||||
|
||||
AV_PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian
|
||||
AV_PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian
|
||||
|
||||
/**
|
||||
* The following 12 formats have the disadvantage of needing 1 format for each bit depth.
|
||||
* Notice that each 9/10 bits sample is stored in 16 bits with extra padding.
|
||||
* If you want to support multiple bit depths, then using AV_PIX_FMT_YUV420P16* with the bpp stored separately is better.
|
||||
*/
|
||||
AV_PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
|
||||
AV_PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
|
||||
AV_PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
|
||||
AV_PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
|
||||
AV_PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
|
||||
AV_PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
|
||||
AV_PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
|
||||
AV_PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
|
||||
AV_PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
|
||||
AV_PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
|
||||
AV_PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
|
||||
AV_PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
|
||||
AV_PIX_FMT_VDA_VLD, ///< hardware decoding through VDA
|
||||
AV_PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp
|
||||
AV_PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big-endian
|
||||
AV_PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little-endian
|
||||
AV_PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big-endian
|
||||
AV_PIX_FMT_GBRP10LE, ///< planar GBR 4:4:4 30bpp, little-endian
|
||||
AV_PIX_FMT_GBRP16BE, ///< planar GBR 4:4:4 48bpp, big-endian
|
||||
AV_PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little-endian
|
||||
AV_PIX_FMT_YUVA422P, ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
|
||||
AV_PIX_FMT_YUVA444P, ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
|
||||
AV_PIX_FMT_YUVA420P9BE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian
|
||||
AV_PIX_FMT_YUVA420P9LE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian
|
||||
AV_PIX_FMT_YUVA422P9BE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian
|
||||
AV_PIX_FMT_YUVA422P9LE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian
|
||||
AV_PIX_FMT_YUVA444P9BE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
|
||||
AV_PIX_FMT_YUVA444P9LE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
|
||||
AV_PIX_FMT_YUVA420P10BE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
|
||||
AV_PIX_FMT_YUVA420P10LE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
|
||||
AV_PIX_FMT_YUVA422P10BE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
|
||||
AV_PIX_FMT_YUVA422P10LE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
|
||||
AV_PIX_FMT_YUVA444P10BE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
|
||||
AV_PIX_FMT_YUVA444P10LE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
|
||||
AV_PIX_FMT_YUVA420P16BE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
|
||||
AV_PIX_FMT_YUVA420P16LE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
|
||||
AV_PIX_FMT_YUVA422P16BE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
|
||||
AV_PIX_FMT_YUVA422P16LE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
|
||||
AV_PIX_FMT_YUVA444P16BE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
|
||||
AV_PIX_FMT_YUVA444P16LE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
|
||||
|
||||
AV_PIX_FMT_VDPAU, ///< HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface
|
||||
|
||||
AV_PIX_FMT_XYZ12LE, ///< packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as little-endian, the 4 lower bits are set to 0
|
||||
AV_PIX_FMT_XYZ12BE, ///< packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as big-endian, the 4 lower bits are set to 0
|
||||
AV_PIX_FMT_NV16, ///< interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
|
||||
AV_PIX_FMT_NV20LE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
|
||||
AV_PIX_FMT_NV20BE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
|
||||
|
||||
AV_PIX_FMT_RGBA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian
|
||||
AV_PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian
|
||||
AV_PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian
|
||||
AV_PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian
|
||||
|
||||
AV_PIX_FMT_YVYU422, ///< packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb
|
||||
|
||||
AV_PIX_FMT_VDA, ///< HW acceleration through VDA, data[3] contains a CVPixelBufferRef
|
||||
|
||||
AV_PIX_FMT_YA16BE, ///< 16bit gray, 16bit alpha (big-endian)
|
||||
AV_PIX_FMT_YA16LE, ///< 16bit gray, 16bit alpha (little-endian)
|
||||
|
||||
AV_PIX_FMT_GBRAP, ///< planar GBRA 4:4:4:4 32bpp
|
||||
AV_PIX_FMT_GBRAP16BE, ///< planar GBRA 4:4:4:4 64bpp, big-endian
|
||||
AV_PIX_FMT_GBRAP16LE, ///< planar GBRA 4:4:4:4 64bpp, little-endian
|
||||
/**
|
||||
* HW acceleration through QSV, data[3] contains a pointer to the
|
||||
* mfxFrameSurface1 structure.
|
||||
*/
|
||||
AV_PIX_FMT_QSV,
|
||||
/**
|
||||
* HW acceleration though MMAL, data[3] contains a pointer to the
|
||||
* MMAL_BUFFER_HEADER_T structure.
|
||||
*/
|
||||
AV_PIX_FMT_MMAL,
|
||||
|
||||
AV_PIX_FMT_D3D11VA_VLD, ///< HW decoding through Direct3D11, Picture.data[3] contains a ID3D11VideoDecoderOutputView pointer
|
||||
|
||||
AV_PIX_FMT_0RGB=0x123+4,///< packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
|
||||
AV_PIX_FMT_RGB0, ///< packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
|
||||
AV_PIX_FMT_0BGR, ///< packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
|
||||
AV_PIX_FMT_BGR0, ///< packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
|
||||
|
||||
AV_PIX_FMT_YUV420P12BE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
|
||||
AV_PIX_FMT_YUV420P12LE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
|
||||
AV_PIX_FMT_YUV420P14BE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
|
||||
AV_PIX_FMT_YUV420P14LE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
|
||||
AV_PIX_FMT_YUV422P12BE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
|
||||
AV_PIX_FMT_YUV422P12LE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
|
||||
AV_PIX_FMT_YUV422P14BE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
|
||||
AV_PIX_FMT_YUV422P14LE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
|
||||
AV_PIX_FMT_YUV444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
|
||||
AV_PIX_FMT_YUV444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
|
||||
AV_PIX_FMT_YUV444P14BE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
|
||||
AV_PIX_FMT_YUV444P14LE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
|
||||
AV_PIX_FMT_GBRP12BE, ///< planar GBR 4:4:4 36bpp, big-endian
|
||||
AV_PIX_FMT_GBRP12LE, ///< planar GBR 4:4:4 36bpp, little-endian
|
||||
AV_PIX_FMT_GBRP14BE, ///< planar GBR 4:4:4 42bpp, big-endian
|
||||
AV_PIX_FMT_GBRP14LE, ///< planar GBR 4:4:4 42bpp, little-endian
|
||||
AV_PIX_FMT_YUVJ411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV411P and setting color_range
|
||||
|
||||
AV_PIX_FMT_BAYER_BGGR8, ///< bayer, BGBG..(odd line), GRGR..(even line), 8-bit samples */
|
||||
AV_PIX_FMT_BAYER_RGGB8, ///< bayer, RGRG..(odd line), GBGB..(even line), 8-bit samples */
|
||||
AV_PIX_FMT_BAYER_GBRG8, ///< bayer, GBGB..(odd line), RGRG..(even line), 8-bit samples */
|
||||
AV_PIX_FMT_BAYER_GRBG8, ///< bayer, GRGR..(odd line), BGBG..(even line), 8-bit samples */
|
||||
AV_PIX_FMT_BAYER_BGGR16LE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, little-endian */
|
||||
AV_PIX_FMT_BAYER_BGGR16BE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, big-endian */
|
||||
AV_PIX_FMT_BAYER_RGGB16LE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, little-endian */
|
||||
AV_PIX_FMT_BAYER_RGGB16BE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, big-endian */
|
||||
AV_PIX_FMT_BAYER_GBRG16LE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, little-endian */
|
||||
AV_PIX_FMT_BAYER_GBRG16BE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, big-endian */
|
||||
AV_PIX_FMT_BAYER_GRBG16LE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian */
|
||||
AV_PIX_FMT_BAYER_GRBG16BE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian */
|
||||
#if !FF_API_XVMC
|
||||
AV_PIX_FMT_XVMC,///< XVideo Motion Acceleration via common packet passing
|
||||
#endif /* !FF_API_XVMC */
|
||||
AV_PIX_FMT_YUV440P10LE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
|
||||
AV_PIX_FMT_YUV440P10BE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
|
||||
AV_PIX_FMT_YUV440P12LE, ///< planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
|
||||
AV_PIX_FMT_YUV440P12BE, ///< planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
|
||||
AV_PIX_FMT_AYUV64LE, ///< packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
|
||||
AV_PIX_FMT_AYUV64BE, ///< packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
|
||||
|
||||
AV_PIX_FMT_VIDEOTOOLBOX, ///< hardware decoding through Videotoolbox
|
||||
|
||||
AV_PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
|
||||
};
|
||||
|
||||
#define AV_PIX_FMT_Y400A AV_PIX_FMT_GRAY8A
|
||||
#define AV_PIX_FMT_GBR24P AV_PIX_FMT_GBRP
|
||||
|
||||
#if AV_HAVE_BIGENDIAN
|
||||
# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##be
|
||||
#else
|
||||
# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##le
|
||||
#endif
|
||||
|
||||
#define AV_PIX_FMT_RGB32 AV_PIX_FMT_NE(ARGB, BGRA)
|
||||
#define AV_PIX_FMT_RGB32_1 AV_PIX_FMT_NE(RGBA, ABGR)
|
||||
#define AV_PIX_FMT_BGR32 AV_PIX_FMT_NE(ABGR, RGBA)
|
||||
#define AV_PIX_FMT_BGR32_1 AV_PIX_FMT_NE(BGRA, ARGB)
|
||||
#define AV_PIX_FMT_0RGB32 AV_PIX_FMT_NE(0RGB, BGR0)
|
||||
#define AV_PIX_FMT_0BGR32 AV_PIX_FMT_NE(0BGR, RGB0)
|
||||
|
||||
#define AV_PIX_FMT_GRAY16 AV_PIX_FMT_NE(GRAY16BE, GRAY16LE)
|
||||
#define AV_PIX_FMT_YA16 AV_PIX_FMT_NE(YA16BE, YA16LE)
|
||||
#define AV_PIX_FMT_RGB48 AV_PIX_FMT_NE(RGB48BE, RGB48LE)
|
||||
#define AV_PIX_FMT_RGB565 AV_PIX_FMT_NE(RGB565BE, RGB565LE)
|
||||
#define AV_PIX_FMT_RGB555 AV_PIX_FMT_NE(RGB555BE, RGB555LE)
|
||||
#define AV_PIX_FMT_RGB444 AV_PIX_FMT_NE(RGB444BE, RGB444LE)
|
||||
#define AV_PIX_FMT_RGBA64 AV_PIX_FMT_NE(RGBA64BE, RGBA64LE)
|
||||
#define AV_PIX_FMT_BGR48 AV_PIX_FMT_NE(BGR48BE, BGR48LE)
|
||||
#define AV_PIX_FMT_BGR565 AV_PIX_FMT_NE(BGR565BE, BGR565LE)
|
||||
#define AV_PIX_FMT_BGR555 AV_PIX_FMT_NE(BGR555BE, BGR555LE)
|
||||
#define AV_PIX_FMT_BGR444 AV_PIX_FMT_NE(BGR444BE, BGR444LE)
|
||||
#define AV_PIX_FMT_BGRA64 AV_PIX_FMT_NE(BGRA64BE, BGRA64LE)
|
||||
|
||||
#define AV_PIX_FMT_YUV420P9 AV_PIX_FMT_NE(YUV420P9BE , YUV420P9LE)
|
||||
#define AV_PIX_FMT_YUV422P9 AV_PIX_FMT_NE(YUV422P9BE , YUV422P9LE)
|
||||
#define AV_PIX_FMT_YUV444P9 AV_PIX_FMT_NE(YUV444P9BE , YUV444P9LE)
|
||||
#define AV_PIX_FMT_YUV420P10 AV_PIX_FMT_NE(YUV420P10BE, YUV420P10LE)
|
||||
#define AV_PIX_FMT_YUV422P10 AV_PIX_FMT_NE(YUV422P10BE, YUV422P10LE)
|
||||
#define AV_PIX_FMT_YUV440P10 AV_PIX_FMT_NE(YUV440P10BE, YUV440P10LE)
|
||||
#define AV_PIX_FMT_YUV444P10 AV_PIX_FMT_NE(YUV444P10BE, YUV444P10LE)
|
||||
#define AV_PIX_FMT_YUV420P12 AV_PIX_FMT_NE(YUV420P12BE, YUV420P12LE)
|
||||
#define AV_PIX_FMT_YUV422P12 AV_PIX_FMT_NE(YUV422P12BE, YUV422P12LE)
|
||||
#define AV_PIX_FMT_YUV440P12 AV_PIX_FMT_NE(YUV440P12BE, YUV440P12LE)
|
||||
#define AV_PIX_FMT_YUV444P12 AV_PIX_FMT_NE(YUV444P12BE, YUV444P12LE)
|
||||
#define AV_PIX_FMT_YUV420P14 AV_PIX_FMT_NE(YUV420P14BE, YUV420P14LE)
|
||||
#define AV_PIX_FMT_YUV422P14 AV_PIX_FMT_NE(YUV422P14BE, YUV422P14LE)
|
||||
#define AV_PIX_FMT_YUV444P14 AV_PIX_FMT_NE(YUV444P14BE, YUV444P14LE)
|
||||
#define AV_PIX_FMT_YUV420P16 AV_PIX_FMT_NE(YUV420P16BE, YUV420P16LE)
|
||||
#define AV_PIX_FMT_YUV422P16 AV_PIX_FMT_NE(YUV422P16BE, YUV422P16LE)
|
||||
#define AV_PIX_FMT_YUV444P16 AV_PIX_FMT_NE(YUV444P16BE, YUV444P16LE)
|
||||
|
||||
#define AV_PIX_FMT_GBRP9 AV_PIX_FMT_NE(GBRP9BE , GBRP9LE)
|
||||
#define AV_PIX_FMT_GBRP10 AV_PIX_FMT_NE(GBRP10BE, GBRP10LE)
|
||||
#define AV_PIX_FMT_GBRP12 AV_PIX_FMT_NE(GBRP12BE, GBRP12LE)
|
||||
#define AV_PIX_FMT_GBRP14 AV_PIX_FMT_NE(GBRP14BE, GBRP14LE)
|
||||
#define AV_PIX_FMT_GBRP16 AV_PIX_FMT_NE(GBRP16BE, GBRP16LE)
|
||||
#define AV_PIX_FMT_GBRAP16 AV_PIX_FMT_NE(GBRAP16BE, GBRAP16LE)
|
||||
|
||||
#define AV_PIX_FMT_BAYER_BGGR16 AV_PIX_FMT_NE(BAYER_BGGR16BE, BAYER_BGGR16LE)
|
||||
#define AV_PIX_FMT_BAYER_RGGB16 AV_PIX_FMT_NE(BAYER_RGGB16BE, BAYER_RGGB16LE)
|
||||
#define AV_PIX_FMT_BAYER_GBRG16 AV_PIX_FMT_NE(BAYER_GBRG16BE, BAYER_GBRG16LE)
|
||||
#define AV_PIX_FMT_BAYER_GRBG16 AV_PIX_FMT_NE(BAYER_GRBG16BE, BAYER_GRBG16LE)
|
||||
|
||||
|
||||
#define AV_PIX_FMT_YUVA420P9 AV_PIX_FMT_NE(YUVA420P9BE , YUVA420P9LE)
|
||||
#define AV_PIX_FMT_YUVA422P9 AV_PIX_FMT_NE(YUVA422P9BE , YUVA422P9LE)
|
||||
#define AV_PIX_FMT_YUVA444P9 AV_PIX_FMT_NE(YUVA444P9BE , YUVA444P9LE)
|
||||
#define AV_PIX_FMT_YUVA420P10 AV_PIX_FMT_NE(YUVA420P10BE, YUVA420P10LE)
|
||||
#define AV_PIX_FMT_YUVA422P10 AV_PIX_FMT_NE(YUVA422P10BE, YUVA422P10LE)
|
||||
#define AV_PIX_FMT_YUVA444P10 AV_PIX_FMT_NE(YUVA444P10BE, YUVA444P10LE)
|
||||
#define AV_PIX_FMT_YUVA420P16 AV_PIX_FMT_NE(YUVA420P16BE, YUVA420P16LE)
|
||||
#define AV_PIX_FMT_YUVA422P16 AV_PIX_FMT_NE(YUVA422P16BE, YUVA422P16LE)
|
||||
#define AV_PIX_FMT_YUVA444P16 AV_PIX_FMT_NE(YUVA444P16BE, YUVA444P16LE)
|
||||
|
||||
#define AV_PIX_FMT_XYZ12 AV_PIX_FMT_NE(XYZ12BE, XYZ12LE)
|
||||
#define AV_PIX_FMT_NV20 AV_PIX_FMT_NE(NV20BE, NV20LE)
|
||||
#define AV_PIX_FMT_AYUV64 AV_PIX_FMT_NE(AYUV64BE, AYUV64LE)
|
||||
|
||||
/**
|
||||
* Chromaticity coordinates of the source primaries.
|
||||
*/
|
||||
enum AVColorPrimaries {
|
||||
AVCOL_PRI_RESERVED0 = 0,
|
||||
AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
|
||||
AVCOL_PRI_UNSPECIFIED = 2,
|
||||
AVCOL_PRI_RESERVED = 3,
|
||||
AVCOL_PRI_BT470M = 4, ///< also FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
|
||||
|
||||
AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
|
||||
AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
|
||||
AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above
|
||||
AVCOL_PRI_FILM = 8, ///< colour filters using Illuminant C
|
||||
AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020
|
||||
AVCOL_PRI_SMPTEST428_1= 10, ///< SMPTE ST 428-1 (CIE 1931 XYZ)
|
||||
AVCOL_PRI_NB, ///< Not part of ABI
|
||||
};
|
||||
|
||||
/**
|
||||
* Color Transfer Characteristic.
|
||||
*/
|
||||
enum AVColorTransferCharacteristic {
|
||||
AVCOL_TRC_RESERVED0 = 0,
|
||||
AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361
|
||||
AVCOL_TRC_UNSPECIFIED = 2,
|
||||
AVCOL_TRC_RESERVED = 3,
|
||||
AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
|
||||
AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG
|
||||
AVCOL_TRC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
|
||||
AVCOL_TRC_SMPTE240M = 7,
|
||||
AVCOL_TRC_LINEAR = 8, ///< "Linear transfer characteristics"
|
||||
AVCOL_TRC_LOG = 9, ///< "Logarithmic transfer characteristic (100:1 range)"
|
||||
AVCOL_TRC_LOG_SQRT = 10, ///< "Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)"
|
||||
AVCOL_TRC_IEC61966_2_4 = 11, ///< IEC 61966-2-4
|
||||
AVCOL_TRC_BT1361_ECG = 12, ///< ITU-R BT1361 Extended Colour Gamut
|
||||
AVCOL_TRC_IEC61966_2_1 = 13, ///< IEC 61966-2-1 (sRGB or sYCC)
|
||||
AVCOL_TRC_BT2020_10 = 14, ///< ITU-R BT2020 for 10 bit system
|
||||
AVCOL_TRC_BT2020_12 = 15, ///< ITU-R BT2020 for 12 bit system
|
||||
AVCOL_TRC_SMPTEST2084 = 16, ///< SMPTE ST 2084 for 10, 12, 14 and 16 bit systems
|
||||
AVCOL_TRC_SMPTEST428_1 = 17, ///< SMPTE ST 428-1
|
||||
AVCOL_TRC_NB, ///< Not part of ABI
|
||||
};
|
||||
|
||||
/**
|
||||
* YUV colorspace type.
|
||||
*/
|
||||
enum AVColorSpace {
|
||||
AVCOL_SPC_RGB = 0, ///< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
|
||||
AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
|
||||
AVCOL_SPC_UNSPECIFIED = 2,
|
||||
AVCOL_SPC_RESERVED = 3,
|
||||
AVCOL_SPC_FCC = 4, ///< FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
|
||||
AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
|
||||
AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
|
||||
AVCOL_SPC_SMPTE240M = 7,
|
||||
AVCOL_SPC_YCOCG = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
|
||||
AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system
|
||||
AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system
|
||||
AVCOL_SPC_NB, ///< Not part of ABI
|
||||
};
|
||||
#define AVCOL_SPC_YCGCO AVCOL_SPC_YCOCG
|
||||
|
||||
|
||||
/**
|
||||
* MPEG vs JPEG YUV range.
|
||||
*/
|
||||
enum AVColorRange {
|
||||
AVCOL_RANGE_UNSPECIFIED = 0,
|
||||
AVCOL_RANGE_MPEG = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges
|
||||
AVCOL_RANGE_JPEG = 2, ///< the normal 2^n-1 "JPEG" YUV ranges
|
||||
AVCOL_RANGE_NB, ///< Not part of ABI
|
||||
};
|
||||
|
||||
/**
|
||||
* Location of chroma samples.
|
||||
*
|
||||
* Illustration showing the location of the first (top left) chroma sample of the
|
||||
* image, the left shows only luma, the right
|
||||
* shows the location of the chroma sample, the 2 could be imagined to overlay
|
||||
* each other but are drawn separately due to limitations of ASCII
|
||||
*
|
||||
* 1st 2nd 1st 2nd horizontal luma sample positions
|
||||
* v v v v
|
||||
* ______ ______
|
||||
*1st luma line > |X X ... |3 4 X ... X are luma samples,
|
||||
* | |1 2 1-6 are possible chroma positions
|
||||
*2nd luma line > |X X ... |5 6 X ... 0 is undefined/unknown position
|
||||
*/
|
||||
enum AVChromaLocation {
|
||||
AVCHROMA_LOC_UNSPECIFIED = 0,
|
||||
AVCHROMA_LOC_LEFT = 1, ///< mpeg2/4 4:2:0, h264 default for 4:2:0
|
||||
AVCHROMA_LOC_CENTER = 2, ///< mpeg1 4:2:0, jpeg 4:2:0, h263 4:2:0
|
||||
AVCHROMA_LOC_TOPLEFT = 3, ///< ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2
|
||||
AVCHROMA_LOC_TOP = 4,
|
||||
AVCHROMA_LOC_BOTTOMLEFT = 5,
|
||||
AVCHROMA_LOC_BOTTOM = 6,
|
||||
AVCHROMA_LOC_NB, ///< Not part of ABI
|
||||
};
|
||||
|
||||
#endif /* AVUTIL_PIXFMT_H */
|
|
@ -0,0 +1,173 @@
|
|||
/*
|
||||
* rational numbers
|
||||
* Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* rational numbers
|
||||
* @author Michael Niedermayer <michaelni@gmx.at>
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_RATIONAL_H
|
||||
#define AVUTIL_RATIONAL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <limits.h>
|
||||
#include "attributes.h"
|
||||
|
||||
/**
|
||||
* @addtogroup lavu_math
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* rational number numerator/denominator
|
||||
*/
|
||||
typedef struct AVRational{
|
||||
int num; ///< numerator
|
||||
int den; ///< denominator
|
||||
} AVRational;
|
||||
|
||||
/**
|
||||
* Create a rational.
|
||||
* Useful for compilers that do not support compound literals.
|
||||
* @note The return value is not reduced.
|
||||
*/
|
||||
static inline AVRational av_make_q(int num, int den)
|
||||
{
|
||||
AVRational r = { num, den };
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare two rationals.
|
||||
* @param a first rational
|
||||
* @param b second rational
|
||||
* @return 0 if a==b, 1 if a>b, -1 if a<b, and INT_MIN if one of the
|
||||
* values is of the form 0/0
|
||||
*/
|
||||
static inline int av_cmp_q(AVRational a, AVRational b){
|
||||
const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den;
|
||||
|
||||
if(tmp) return (int)((tmp ^ a.den ^ b.den)>>63)|1;
|
||||
else if(b.den && a.den) return 0;
|
||||
else if(a.num && b.num) return (a.num>>31) - (b.num>>31);
|
||||
else return INT_MIN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert rational to double.
|
||||
* @param a rational to convert
|
||||
* @return (double) a
|
||||
*/
|
||||
static inline double av_q2d(AVRational a){
|
||||
return a.num / (double) a.den;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reduce a fraction.
|
||||
* This is useful for framerate calculations.
|
||||
* @param dst_num destination numerator
|
||||
* @param dst_den destination denominator
|
||||
* @param num source numerator
|
||||
* @param den source denominator
|
||||
* @param max the maximum allowed for dst_num & dst_den
|
||||
* @return 1 if exact, 0 otherwise
|
||||
*/
|
||||
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max);
|
||||
|
||||
/**
|
||||
* Multiply two rationals.
|
||||
* @param b first rational
|
||||
* @param c second rational
|
||||
* @return b*c
|
||||
*/
|
||||
AVRational av_mul_q(AVRational b, AVRational c) av_const;
|
||||
|
||||
/**
|
||||
* Divide one rational by another.
|
||||
* @param b first rational
|
||||
* @param c second rational
|
||||
* @return b/c
|
||||
*/
|
||||
AVRational av_div_q(AVRational b, AVRational c) av_const;
|
||||
|
||||
/**
|
||||
* Add two rationals.
|
||||
* @param b first rational
|
||||
* @param c second rational
|
||||
* @return b+c
|
||||
*/
|
||||
AVRational av_add_q(AVRational b, AVRational c) av_const;
|
||||
|
||||
/**
|
||||
* Subtract one rational from another.
|
||||
* @param b first rational
|
||||
* @param c second rational
|
||||
* @return b-c
|
||||
*/
|
||||
AVRational av_sub_q(AVRational b, AVRational c) av_const;
|
||||
|
||||
/**
|
||||
* Invert a rational.
|
||||
* @param q value
|
||||
* @return 1 / q
|
||||
*/
|
||||
static av_always_inline AVRational av_inv_q(AVRational q)
|
||||
{
|
||||
AVRational r = { q.den, q.num };
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a double precision floating point number to a rational.
|
||||
* inf is expressed as {1,0} or {-1,0} depending on the sign.
|
||||
*
|
||||
* @param d double to convert
|
||||
* @param max the maximum allowed numerator and denominator
|
||||
* @return (AVRational) d
|
||||
*/
|
||||
AVRational av_d2q(double d, int max) av_const;
|
||||
|
||||
/**
|
||||
* @return 1 if q1 is nearer to q than q2, -1 if q2 is nearer
|
||||
* than q1, 0 if they have the same distance.
|
||||
*/
|
||||
int av_nearer_q(AVRational q, AVRational q1, AVRational q2);
|
||||
|
||||
/**
|
||||
* Find the nearest value in q_list to q.
|
||||
* @param q_list an array of rationals terminated by {0, 0}
|
||||
* @return the index of the nearest value found in the array
|
||||
*/
|
||||
int av_find_nearest_q_idx(AVRational q, const AVRational* q_list);
|
||||
|
||||
/**
|
||||
* Converts a AVRational to a IEEE 32bit float.
|
||||
*
|
||||
* The float is returned in a uint32_t and its value is platform indepenant.
|
||||
*/
|
||||
uint32_t av_q2intfloat(AVRational q);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* AVUTIL_RATIONAL_H */
|
|
@ -0,0 +1,271 @@
|
|||
/*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_SAMPLEFMT_H
|
||||
#define AVUTIL_SAMPLEFMT_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "avutil.h"
|
||||
#include "attributes.h"
|
||||
|
||||
/**
|
||||
* @addtogroup lavu_audio
|
||||
* @{
|
||||
*
|
||||
* @defgroup lavu_sampfmts Audio sample formats
|
||||
*
|
||||
* Audio sample format enumeration and related convenience functions.
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Audio sample formats
|
||||
*
|
||||
* - The data described by the sample format is always in native-endian order.
|
||||
* Sample values can be expressed by native C types, hence the lack of a signed
|
||||
* 24-bit sample format even though it is a common raw audio data format.
|
||||
*
|
||||
* - The floating-point formats are based on full volume being in the range
|
||||
* [-1.0, 1.0]. Any values outside this range are beyond full volume level.
|
||||
*
|
||||
* - The data layout as used in av_samples_fill_arrays() and elsewhere in FFmpeg
|
||||
* (such as AVFrame in libavcodec) is as follows:
|
||||
*
|
||||
* @par
|
||||
* For planar sample formats, each audio channel is in a separate data plane,
|
||||
* and linesize is the buffer size, in bytes, for a single plane. All data
|
||||
* planes must be the same size. For packed sample formats, only the first data
|
||||
* plane is used, and samples for each channel are interleaved. In this case,
|
||||
* linesize is the buffer size, in bytes, for the 1 plane.
|
||||
*
|
||||
*/
|
||||
enum AVSampleFormat {
|
||||
AV_SAMPLE_FMT_NONE = -1,
|
||||
AV_SAMPLE_FMT_U8, ///< unsigned 8 bits
|
||||
AV_SAMPLE_FMT_S16, ///< signed 16 bits
|
||||
AV_SAMPLE_FMT_S32, ///< signed 32 bits
|
||||
AV_SAMPLE_FMT_FLT, ///< float
|
||||
AV_SAMPLE_FMT_DBL, ///< double
|
||||
|
||||
AV_SAMPLE_FMT_U8P, ///< unsigned 8 bits, planar
|
||||
AV_SAMPLE_FMT_S16P, ///< signed 16 bits, planar
|
||||
AV_SAMPLE_FMT_S32P, ///< signed 32 bits, planar
|
||||
AV_SAMPLE_FMT_FLTP, ///< float, planar
|
||||
AV_SAMPLE_FMT_DBLP, ///< double, planar
|
||||
|
||||
AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the name of sample_fmt, or NULL if sample_fmt is not
|
||||
* recognized.
|
||||
*/
|
||||
const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt);
|
||||
|
||||
/**
|
||||
* Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE
|
||||
* on error.
|
||||
*/
|
||||
enum AVSampleFormat av_get_sample_fmt(const char *name);
|
||||
|
||||
/**
|
||||
* Return the planar<->packed alternative form of the given sample format, or
|
||||
* AV_SAMPLE_FMT_NONE on error. If the passed sample_fmt is already in the
|
||||
* requested planar/packed format, the format returned is the same as the
|
||||
* input.
|
||||
*/
|
||||
enum AVSampleFormat av_get_alt_sample_fmt(enum AVSampleFormat sample_fmt, int planar);
|
||||
|
||||
/**
|
||||
* Get the packed alternative form of the given sample format.
|
||||
*
|
||||
* If the passed sample_fmt is already in packed format, the format returned is
|
||||
* the same as the input.
|
||||
*
|
||||
* @return the packed alternative form of the given sample format or
|
||||
AV_SAMPLE_FMT_NONE on error.
|
||||
*/
|
||||
enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt);
|
||||
|
||||
/**
|
||||
* Get the planar alternative form of the given sample format.
|
||||
*
|
||||
* If the passed sample_fmt is already in planar format, the format returned is
|
||||
* the same as the input.
|
||||
*
|
||||
* @return the planar alternative form of the given sample format or
|
||||
AV_SAMPLE_FMT_NONE on error.
|
||||
*/
|
||||
enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt);
|
||||
|
||||
/**
|
||||
* Generate a string corresponding to the sample format with
|
||||
* sample_fmt, or a header if sample_fmt is negative.
|
||||
*
|
||||
* @param buf the buffer where to write the string
|
||||
* @param buf_size the size of buf
|
||||
* @param sample_fmt the number of the sample format to print the
|
||||
* corresponding info string, or a negative value to print the
|
||||
* corresponding header.
|
||||
* @return the pointer to the filled buffer or NULL if sample_fmt is
|
||||
* unknown or in case of other errors
|
||||
*/
|
||||
char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt);
|
||||
|
||||
/**
|
||||
* Return number of bytes per sample.
|
||||
*
|
||||
* @param sample_fmt the sample format
|
||||
* @return number of bytes per sample or zero if unknown for the given
|
||||
* sample format
|
||||
*/
|
||||
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt);
|
||||
|
||||
/**
|
||||
* Check if the sample format is planar.
|
||||
*
|
||||
* @param sample_fmt the sample format to inspect
|
||||
* @return 1 if the sample format is planar, 0 if it is interleaved
|
||||
*/
|
||||
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt);
|
||||
|
||||
/**
|
||||
* Get the required buffer size for the given audio parameters.
|
||||
*
|
||||
* @param[out] linesize calculated linesize, may be NULL
|
||||
* @param nb_channels the number of channels
|
||||
* @param nb_samples the number of samples in a single channel
|
||||
* @param sample_fmt the sample format
|
||||
* @param align buffer size alignment (0 = default, 1 = no alignment)
|
||||
* @return required buffer size, or negative error code on failure
|
||||
*/
|
||||
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
|
||||
enum AVSampleFormat sample_fmt, int align);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
* @defgroup lavu_sampmanip Samples manipulation
|
||||
*
|
||||
* Functions that manipulate audio samples
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fill plane data pointers and linesize for samples with sample
|
||||
* format sample_fmt.
|
||||
*
|
||||
* The audio_data array is filled with the pointers to the samples data planes:
|
||||
* for planar, set the start point of each channel's data within the buffer,
|
||||
* for packed, set the start point of the entire buffer only.
|
||||
*
|
||||
* The value pointed to by linesize is set to the aligned size of each
|
||||
* channel's data buffer for planar layout, or to the aligned size of the
|
||||
* buffer for all channels for packed layout.
|
||||
*
|
||||
* The buffer in buf must be big enough to contain all the samples
|
||||
* (use av_samples_get_buffer_size() to compute its minimum size),
|
||||
* otherwise the audio_data pointers will point to invalid data.
|
||||
*
|
||||
* @see enum AVSampleFormat
|
||||
* The documentation for AVSampleFormat describes the data layout.
|
||||
*
|
||||
* @param[out] audio_data array to be filled with the pointer for each channel
|
||||
* @param[out] linesize calculated linesize, may be NULL
|
||||
* @param buf the pointer to a buffer containing the samples
|
||||
* @param nb_channels the number of channels
|
||||
* @param nb_samples the number of samples in a single channel
|
||||
* @param sample_fmt the sample format
|
||||
* @param align buffer size alignment (0 = default, 1 = no alignment)
|
||||
* @return >=0 on success or a negative error code on failure
|
||||
* @todo return minimum size in bytes required for the buffer in case
|
||||
* of success at the next bump
|
||||
*/
|
||||
int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,
|
||||
const uint8_t *buf,
|
||||
int nb_channels, int nb_samples,
|
||||
enum AVSampleFormat sample_fmt, int align);
|
||||
|
||||
/**
|
||||
* Allocate a samples buffer for nb_samples samples, and fill data pointers and
|
||||
* linesize accordingly.
|
||||
* The allocated samples buffer can be freed by using av_freep(&audio_data[0])
|
||||
* Allocated data will be initialized to silence.
|
||||
*
|
||||
* @see enum AVSampleFormat
|
||||
* The documentation for AVSampleFormat describes the data layout.
|
||||
*
|
||||
* @param[out] audio_data array to be filled with the pointer for each channel
|
||||
* @param[out] linesize aligned size for audio buffer(s), may be NULL
|
||||
* @param nb_channels number of audio channels
|
||||
* @param nb_samples number of samples per channel
|
||||
* @param align buffer size alignment (0 = default, 1 = no alignment)
|
||||
* @return >=0 on success or a negative error code on failure
|
||||
* @todo return the size of the allocated buffer in case of success at the next bump
|
||||
* @see av_samples_fill_arrays()
|
||||
* @see av_samples_alloc_array_and_samples()
|
||||
*/
|
||||
int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,
|
||||
int nb_samples, enum AVSampleFormat sample_fmt, int align);
|
||||
|
||||
/**
|
||||
* Allocate a data pointers array, samples buffer for nb_samples
|
||||
* samples, and fill data pointers and linesize accordingly.
|
||||
*
|
||||
* This is the same as av_samples_alloc(), but also allocates the data
|
||||
* pointers array.
|
||||
*
|
||||
* @see av_samples_alloc()
|
||||
*/
|
||||
int av_samples_alloc_array_and_samples(uint8_t ***audio_data, int *linesize, int nb_channels,
|
||||
int nb_samples, enum AVSampleFormat sample_fmt, int align);
|
||||
|
||||
/**
|
||||
* Copy samples from src to dst.
|
||||
*
|
||||
* @param dst destination array of pointers to data planes
|
||||
* @param src source array of pointers to data planes
|
||||
* @param dst_offset offset in samples at which the data will be written to dst
|
||||
* @param src_offset offset in samples at which the data will be read from src
|
||||
* @param nb_samples number of samples to be copied
|
||||
* @param nb_channels number of audio channels
|
||||
* @param sample_fmt audio sample format
|
||||
*/
|
||||
int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset,
|
||||
int src_offset, int nb_samples, int nb_channels,
|
||||
enum AVSampleFormat sample_fmt);
|
||||
|
||||
/**
|
||||
* Fill an audio buffer with silence.
|
||||
*
|
||||
* @param audio_data array of pointers to data planes
|
||||
* @param offset offset in samples at which to start filling
|
||||
* @param nb_samples number of samples to fill
|
||||
* @param nb_channels number of audio channels
|
||||
* @param sample_fmt audio sample format
|
||||
*/
|
||||
int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples,
|
||||
int nb_channels, enum AVSampleFormat sample_fmt);
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
#endif /* AVUTIL_SAMPLEFMT_H */
|
|
@ -0,0 +1,129 @@
|
|||
/*
|
||||
* copyright (c) 2003 Fabrice Bellard
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_VERSION_H
|
||||
#define AVUTIL_VERSION_H
|
||||
|
||||
#include "macros.h"
|
||||
|
||||
/**
|
||||
* @addtogroup version_utils
|
||||
*
|
||||
* Useful to check and match library version in order to maintain
|
||||
* backward compatibility.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define AV_VERSION_INT(a, b, c) ((a)<<16 | (b)<<8 | (c))
|
||||
#define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c
|
||||
#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
|
||||
|
||||
/**
|
||||
* Extract version components from the full ::AV_VERSION_INT int as returned
|
||||
* by functions like ::avformat_version() and ::avcodec_version()
|
||||
*/
|
||||
#define AV_VERSION_MAJOR(a) ((a) >> 16)
|
||||
#define AV_VERSION_MINOR(a) (((a) & 0x00FF00) >> 8)
|
||||
#define AV_VERSION_MICRO(a) ((a) & 0xFF)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @ingroup lavu
|
||||
* Libavutil version macros
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup lavu_ver Version and Build diagnostics
|
||||
*
|
||||
* Macros and function useful to check at compiletime and at runtime
|
||||
* which version of libavutil is in use.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define LIBAVUTIL_VERSION_MAJOR 55
|
||||
#define LIBAVUTIL_VERSION_MINOR 12
|
||||
#define LIBAVUTIL_VERSION_MICRO 100
|
||||
|
||||
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
||||
LIBAVUTIL_VERSION_MINOR, \
|
||||
LIBAVUTIL_VERSION_MICRO)
|
||||
#define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \
|
||||
LIBAVUTIL_VERSION_MINOR, \
|
||||
LIBAVUTIL_VERSION_MICRO)
|
||||
#define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT
|
||||
|
||||
#define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
* @defgroup depr_guards Deprecation guards
|
||||
* FF_API_* defines may be placed below to indicate public API that will be
|
||||
* dropped at a future version bump. The defines themselves are not part of
|
||||
* the public API and may change, break or disappear at any time.
|
||||
*
|
||||
* @note, when bumping the major version it is recommended to manually
|
||||
* disable each FF_API_* in its own commit instead of disabling them all
|
||||
* at once through the bump. This improves the git bisect-ability of the change.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef FF_API_VDPAU
|
||||
#define FF_API_VDPAU (LIBAVUTIL_VERSION_MAJOR < 56)
|
||||
#endif
|
||||
#ifndef FF_API_XVMC
|
||||
#define FF_API_XVMC (LIBAVUTIL_VERSION_MAJOR < 56)
|
||||
#endif
|
||||
#ifndef FF_API_OPT_TYPE_METADATA
|
||||
#define FF_API_OPT_TYPE_METADATA (LIBAVUTIL_VERSION_MAJOR < 56)
|
||||
#endif
|
||||
#ifndef FF_API_DLOG
|
||||
#define FF_API_DLOG (LIBAVUTIL_VERSION_MAJOR < 56)
|
||||
#endif
|
||||
#ifndef FF_API_VAAPI
|
||||
#define FF_API_VAAPI (LIBAVUTIL_VERSION_MAJOR < 56)
|
||||
#endif
|
||||
#ifndef FF_API_FRAME_QP
|
||||
#define FF_API_FRAME_QP (LIBAVUTIL_VERSION_MAJOR < 56)
|
||||
#endif
|
||||
#ifndef FF_API_PLUS1_MINUS1
|
||||
#define FF_API_PLUS1_MINUS1 (LIBAVUTIL_VERSION_MAJOR < 56)
|
||||
#endif
|
||||
#ifndef FF_API_ERROR_FRAME
|
||||
#define FF_API_ERROR_FRAME (LIBAVUTIL_VERSION_MAJOR < 56)
|
||||
#endif
|
||||
#ifndef FF_API_CRC_BIG_TABLE
|
||||
#define FF_API_CRC_BIG_TABLE (LIBAVUTIL_VERSION_MAJOR < 56)
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* AVUTIL_VERSION_H */
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'../FFmpegAudioDecoder.cpp',
|
||||
'../FFmpegDataDecoder.cpp',
|
||||
'../FFmpegDecoderModule.cpp',
|
||||
'../FFmpegH264Decoder.cpp',
|
||||
]
|
||||
LOCAL_INCLUDES += [
|
||||
'..',
|
||||
'include',
|
||||
]
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += [ '-Wno-deprecated-declarations' ]
|
||||
if CONFIG['CLANG_CXX']:
|
||||
CXXFLAGS += [
|
||||
'-Wno-unknown-attributes',
|
||||
]
|
||||
if CONFIG['_MSC_VER']:
|
||||
CXXFLAGS += [
|
||||
'-wd4996', # deprecated declaration
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,688 +0,0 @@
|
|||
/*
|
||||
* copyright (c) 2001 Fabrice Bellard
|
||||
*
|
||||
* This file is part of Libav.
|
||||
*
|
||||
* Libav is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Libav 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with Libav; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#ifndef AVFORMAT_AVIO_H
|
||||
#define AVFORMAT_AVIO_H
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @ingroup lavf_io
|
||||
* Buffered I/O operations
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "libavutil/common.h"
|
||||
#include "libavutil/dict.h"
|
||||
#include "libavutil/log.h"
|
||||
|
||||
#include "libavformat/version.h"
|
||||
|
||||
|
||||
#define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */
|
||||
|
||||
/**
|
||||
* Callback for checking whether to abort blocking functions.
|
||||
* AVERROR_EXIT is returned in this case by the interrupted
|
||||
* function. During blocking operations, callback is called with
|
||||
* opaque as parameter. If the callback returns 1, the
|
||||
* blocking operation will be aborted.
|
||||
*
|
||||
* No members can be added to this struct without a major bump, if
|
||||
* new elements have been added after this struct in AVFormatContext
|
||||
* or AVIOContext.
|
||||
*/
|
||||
typedef struct {
|
||||
int (*callback)(void*);
|
||||
void *opaque;
|
||||
} AVIOInterruptCB;
|
||||
|
||||
/**
|
||||
* Bytestream IO Context.
|
||||
* New fields can be added to the end with minor version bumps.
|
||||
* Removal, reordering and changes to existing fields require a major
|
||||
* version bump.
|
||||
* sizeof(AVIOContext) must not be used outside libav*.
|
||||
*
|
||||
* @note None of the function pointers in AVIOContext should be called
|
||||
* directly, they should only be set by the client application
|
||||
* when implementing custom I/O. Normally these are set to the
|
||||
* function pointers specified in avio_alloc_context()
|
||||
*/
|
||||
typedef struct {
|
||||
#if !FF_API_OLD_AVIO
|
||||
/**
|
||||
* A class for private options.
|
||||
*
|
||||
* If this AVIOContext is created by avio_open2(), av_class is set and
|
||||
* passes the options down to protocols.
|
||||
*
|
||||
* If this AVIOContext is manually allocated, then av_class may be set by
|
||||
* the caller.
|
||||
*
|
||||
* warning -- this field can be NULL, be sure to not pass this AVIOContext
|
||||
* to any av_opt_* functions in that case.
|
||||
*/
|
||||
AVClass *av_class;
|
||||
#endif
|
||||
unsigned char *buffer; /**< Start of the buffer. */
|
||||
int buffer_size; /**< Maximum buffer size */
|
||||
unsigned char *buf_ptr; /**< Current position in the buffer */
|
||||
unsigned char *buf_end; /**< End of the data, may be less than
|
||||
buffer+buffer_size if the read function returned
|
||||
less data than requested, e.g. for streams where
|
||||
no more data has been received yet. */
|
||||
void *opaque; /**< A private pointer, passed to the read/write/seek/...
|
||||
functions. */
|
||||
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size);
|
||||
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size);
|
||||
int64_t (*seek)(void *opaque, int64_t offset, int whence);
|
||||
int64_t pos; /**< position in the file of the current buffer */
|
||||
int must_flush; /**< true if the next seek should flush */
|
||||
int eof_reached; /**< true if eof reached */
|
||||
int write_flag; /**< true if open for writing */
|
||||
#if FF_API_OLD_AVIO
|
||||
attribute_deprecated int is_streamed;
|
||||
#endif
|
||||
int max_packet_size;
|
||||
unsigned long checksum;
|
||||
unsigned char *checksum_ptr;
|
||||
unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size);
|
||||
int error; /**< contains the error code or 0 if no error happened */
|
||||
/**
|
||||
* Pause or resume playback for network streaming protocols - e.g. MMS.
|
||||
*/
|
||||
int (*read_pause)(void *opaque, int pause);
|
||||
/**
|
||||
* Seek to a given timestamp in stream with the specified stream_index.
|
||||
* Needed for some network streaming protocols which don't support seeking
|
||||
* to byte position.
|
||||
*/
|
||||
int64_t (*read_seek)(void *opaque, int stream_index,
|
||||
int64_t timestamp, int flags);
|
||||
/**
|
||||
* A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
|
||||
*/
|
||||
int seekable;
|
||||
} AVIOContext;
|
||||
|
||||
/* unbuffered I/O */
|
||||
|
||||
#if FF_API_OLD_AVIO
|
||||
/**
|
||||
* URL Context.
|
||||
* New fields can be added to the end with minor version bumps.
|
||||
* Removal, reordering and changes to existing fields require a major
|
||||
* version bump.
|
||||
* sizeof(URLContext) must not be used outside libav*.
|
||||
* @deprecated This struct will be made private
|
||||
*/
|
||||
typedef struct URLContext {
|
||||
const AVClass *av_class; ///< information for av_log(). Set by url_open().
|
||||
struct URLProtocol *prot;
|
||||
int flags;
|
||||
int is_streamed; /**< true if streamed (no seek possible), default = false */
|
||||
int max_packet_size; /**< if non zero, the stream is packetized with this max packet size */
|
||||
void *priv_data;
|
||||
char *filename; /**< specified URL */
|
||||
int is_connected;
|
||||
AVIOInterruptCB interrupt_callback;
|
||||
} URLContext;
|
||||
|
||||
#define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */
|
||||
#define URL_PROTOCOL_FLAG_NETWORK 2 /*< The protocol uses network */
|
||||
|
||||
/**
|
||||
* @deprecated This struct is to be made private. Use the higher-level
|
||||
* AVIOContext-based API instead.
|
||||
*/
|
||||
typedef struct URLProtocol {
|
||||
const char *name;
|
||||
int (*url_open)(URLContext *h, const char *url, int flags);
|
||||
int (*url_read)(URLContext *h, unsigned char *buf, int size);
|
||||
int (*url_write)(URLContext *h, const unsigned char *buf, int size);
|
||||
int64_t (*url_seek)(URLContext *h, int64_t pos, int whence);
|
||||
int (*url_close)(URLContext *h);
|
||||
struct URLProtocol *next;
|
||||
int (*url_read_pause)(URLContext *h, int pause);
|
||||
int64_t (*url_read_seek)(URLContext *h, int stream_index,
|
||||
int64_t timestamp, int flags);
|
||||
int (*url_get_file_handle)(URLContext *h);
|
||||
int priv_data_size;
|
||||
const AVClass *priv_data_class;
|
||||
int flags;
|
||||
int (*url_check)(URLContext *h, int mask);
|
||||
} URLProtocol;
|
||||
|
||||
typedef struct URLPollEntry {
|
||||
URLContext *handle;
|
||||
int events;
|
||||
int revents;
|
||||
} URLPollEntry;
|
||||
|
||||
/* not implemented */
|
||||
attribute_deprecated int url_poll(URLPollEntry *poll_table, int n, int timeout);
|
||||
|
||||
/**
|
||||
* @name URL open modes
|
||||
* The flags argument to url_open and cosins must be one of the following
|
||||
* constants, optionally ORed with other flags.
|
||||
* @{
|
||||
*/
|
||||
#define URL_RDONLY 1 /**< read-only */
|
||||
#define URL_WRONLY 2 /**< write-only */
|
||||
#define URL_RDWR (URL_RDONLY|URL_WRONLY) /**< read-write */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Use non-blocking mode.
|
||||
* If this flag is set, operations on the context will return
|
||||
* AVERROR(EAGAIN) if they can not be performed immediately.
|
||||
* If this flag is not set, operations on the context will never return
|
||||
* AVERROR(EAGAIN).
|
||||
* Note that this flag does not affect the opening/connecting of the
|
||||
* context. Connecting a protocol will always block if necessary (e.g. on
|
||||
* network protocols) but never hang (e.g. on busy devices).
|
||||
* Warning: non-blocking protocols is work-in-progress; this flag may be
|
||||
* silently ignored.
|
||||
*/
|
||||
#define URL_FLAG_NONBLOCK 8
|
||||
|
||||
typedef int URLInterruptCB(void);
|
||||
extern URLInterruptCB *url_interrupt_cb;
|
||||
|
||||
/**
|
||||
* @defgroup old_url_funcs Old url_* functions
|
||||
* The following functions are deprecated. Use the buffered API based on #AVIOContext instead.
|
||||
* @{
|
||||
* @ingroup lavf_io
|
||||
*/
|
||||
attribute_deprecated int url_open_protocol (URLContext **puc, struct URLProtocol *up,
|
||||
const char *url, int flags);
|
||||
attribute_deprecated int url_alloc(URLContext **h, const char *url, int flags);
|
||||
attribute_deprecated int url_connect(URLContext *h);
|
||||
attribute_deprecated int url_open(URLContext **h, const char *url, int flags);
|
||||
attribute_deprecated int url_read(URLContext *h, unsigned char *buf, int size);
|
||||
attribute_deprecated int url_read_complete(URLContext *h, unsigned char *buf, int size);
|
||||
attribute_deprecated int url_write(URLContext *h, const unsigned char *buf, int size);
|
||||
attribute_deprecated int64_t url_seek(URLContext *h, int64_t pos, int whence);
|
||||
attribute_deprecated int url_close(URLContext *h);
|
||||
attribute_deprecated int64_t url_filesize(URLContext *h);
|
||||
attribute_deprecated int url_get_file_handle(URLContext *h);
|
||||
attribute_deprecated int url_get_max_packet_size(URLContext *h);
|
||||
attribute_deprecated void url_get_filename(URLContext *h, char *buf, int buf_size);
|
||||
attribute_deprecated int av_url_read_pause(URLContext *h, int pause);
|
||||
attribute_deprecated int64_t av_url_read_seek(URLContext *h, int stream_index,
|
||||
int64_t timestamp, int flags);
|
||||
attribute_deprecated void url_set_interrupt_cb(int (*interrupt_cb)(void));
|
||||
/**
|
||||
* If protocol is NULL, returns the first registered protocol,
|
||||
* if protocol is non-NULL, returns the next registered protocol after protocol,
|
||||
* or NULL if protocol is the last one.
|
||||
*/
|
||||
attribute_deprecated URLProtocol *av_protocol_next(URLProtocol *p);
|
||||
/**
|
||||
* Register the URLProtocol protocol.
|
||||
*
|
||||
* @param size the size of the URLProtocol struct referenced
|
||||
*/
|
||||
attribute_deprecated int av_register_protocol2(URLProtocol *protocol, int size);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
typedef attribute_deprecated AVIOContext ByteIOContext;
|
||||
|
||||
attribute_deprecated int init_put_byte(AVIOContext *s,
|
||||
unsigned char *buffer,
|
||||
int buffer_size,
|
||||
int write_flag,
|
||||
void *opaque,
|
||||
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
|
||||
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
|
||||
int64_t (*seek)(void *opaque, int64_t offset, int whence));
|
||||
attribute_deprecated AVIOContext *av_alloc_put_byte(
|
||||
unsigned char *buffer,
|
||||
int buffer_size,
|
||||
int write_flag,
|
||||
void *opaque,
|
||||
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
|
||||
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
|
||||
int64_t (*seek)(void *opaque, int64_t offset, int whence));
|
||||
|
||||
/**
|
||||
* @defgroup old_avio_funcs Old put_/get_*() functions
|
||||
* The following functions are deprecated. Use the "avio_"-prefixed functions instead.
|
||||
* @{
|
||||
* @ingroup lavf_io
|
||||
*/
|
||||
attribute_deprecated int get_buffer(AVIOContext *s, unsigned char *buf, int size);
|
||||
attribute_deprecated int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size);
|
||||
attribute_deprecated int get_byte(AVIOContext *s);
|
||||
attribute_deprecated unsigned int get_le16(AVIOContext *s);
|
||||
attribute_deprecated unsigned int get_le24(AVIOContext *s);
|
||||
attribute_deprecated unsigned int get_le32(AVIOContext *s);
|
||||
attribute_deprecated uint64_t get_le64(AVIOContext *s);
|
||||
attribute_deprecated unsigned int get_be16(AVIOContext *s);
|
||||
attribute_deprecated unsigned int get_be24(AVIOContext *s);
|
||||
attribute_deprecated unsigned int get_be32(AVIOContext *s);
|
||||
attribute_deprecated uint64_t get_be64(AVIOContext *s);
|
||||
|
||||
attribute_deprecated void put_byte(AVIOContext *s, int b);
|
||||
attribute_deprecated void put_nbyte(AVIOContext *s, int b, int count);
|
||||
attribute_deprecated void put_buffer(AVIOContext *s, const unsigned char *buf, int size);
|
||||
attribute_deprecated void put_le64(AVIOContext *s, uint64_t val);
|
||||
attribute_deprecated void put_be64(AVIOContext *s, uint64_t val);
|
||||
attribute_deprecated void put_le32(AVIOContext *s, unsigned int val);
|
||||
attribute_deprecated void put_be32(AVIOContext *s, unsigned int val);
|
||||
attribute_deprecated void put_le24(AVIOContext *s, unsigned int val);
|
||||
attribute_deprecated void put_be24(AVIOContext *s, unsigned int val);
|
||||
attribute_deprecated void put_le16(AVIOContext *s, unsigned int val);
|
||||
attribute_deprecated void put_be16(AVIOContext *s, unsigned int val);
|
||||
attribute_deprecated void put_tag(AVIOContext *s, const char *tag);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
attribute_deprecated int av_url_read_fpause(AVIOContext *h, int pause);
|
||||
attribute_deprecated int64_t av_url_read_fseek (AVIOContext *h, int stream_index,
|
||||
int64_t timestamp, int flags);
|
||||
|
||||
/**
|
||||
* @defgroup old_url_f_funcs Old url_f* functions
|
||||
* The following functions are deprecated, use the "avio_"-prefixed functions instead.
|
||||
* @{
|
||||
* @ingroup lavf_io
|
||||
*/
|
||||
attribute_deprecated int url_fopen( AVIOContext **s, const char *url, int flags);
|
||||
attribute_deprecated int url_fclose(AVIOContext *s);
|
||||
attribute_deprecated int64_t url_fseek(AVIOContext *s, int64_t offset, int whence);
|
||||
attribute_deprecated int url_fskip(AVIOContext *s, int64_t offset);
|
||||
attribute_deprecated int64_t url_ftell(AVIOContext *s);
|
||||
attribute_deprecated int64_t url_fsize(AVIOContext *s);
|
||||
#define URL_EOF (-1)
|
||||
attribute_deprecated int url_fgetc(AVIOContext *s);
|
||||
attribute_deprecated int url_setbufsize(AVIOContext *s, int buf_size);
|
||||
attribute_deprecated int url_fprintf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3);
|
||||
attribute_deprecated void put_flush_packet(AVIOContext *s);
|
||||
attribute_deprecated int url_open_dyn_buf(AVIOContext **s);
|
||||
attribute_deprecated int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size);
|
||||
attribute_deprecated int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
|
||||
attribute_deprecated int url_fdopen(AVIOContext **s, URLContext *h);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @deprecated use AVIOContext.eof_reached
|
||||
*/
|
||||
attribute_deprecated int url_feof(AVIOContext *s);
|
||||
attribute_deprecated int url_ferror(AVIOContext *s);
|
||||
|
||||
attribute_deprecated int udp_set_remote_url(URLContext *h, const char *uri);
|
||||
attribute_deprecated int udp_get_local_port(URLContext *h);
|
||||
|
||||
attribute_deprecated void init_checksum(AVIOContext *s,
|
||||
unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
|
||||
unsigned long checksum);
|
||||
attribute_deprecated unsigned long get_checksum(AVIOContext *s);
|
||||
attribute_deprecated void put_strz(AVIOContext *s, const char *buf);
|
||||
/** @note unlike fgets, the EOL character is not returned and a whole
|
||||
line is parsed. return NULL if first char read was EOF */
|
||||
attribute_deprecated char *url_fgets(AVIOContext *s, char *buf, int buf_size);
|
||||
/**
|
||||
* @deprecated use avio_get_str instead
|
||||
*/
|
||||
attribute_deprecated char *get_strz(AVIOContext *s, char *buf, int maxlen);
|
||||
/**
|
||||
* @deprecated Use AVIOContext.seekable field directly.
|
||||
*/
|
||||
attribute_deprecated static inline int url_is_streamed(AVIOContext *s)
|
||||
{
|
||||
return !s->seekable;
|
||||
}
|
||||
attribute_deprecated URLContext *url_fileno(AVIOContext *s);
|
||||
|
||||
/**
|
||||
* @deprecated use AVIOContext.max_packet_size directly.
|
||||
*/
|
||||
attribute_deprecated int url_fget_max_packet_size(AVIOContext *s);
|
||||
|
||||
attribute_deprecated int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags);
|
||||
|
||||
/** return the written or read size */
|
||||
attribute_deprecated int url_close_buf(AVIOContext *s);
|
||||
|
||||
/**
|
||||
* Return a non-zero value if the resource indicated by url
|
||||
* exists, 0 otherwise.
|
||||
* @deprecated Use avio_check instead.
|
||||
*/
|
||||
attribute_deprecated int url_exist(const char *url);
|
||||
#endif // FF_API_OLD_AVIO
|
||||
|
||||
/**
|
||||
* Return AVIO_FLAG_* access flags corresponding to the access permissions
|
||||
* of the resource in url, or a negative value corresponding to an
|
||||
* AVERROR code in case of failure. The returned access flags are
|
||||
* masked by the value in flags.
|
||||
*
|
||||
* @note This function is intrinsically unsafe, in the sense that the
|
||||
* checked resource may change its existence or permission status from
|
||||
* one call to another. Thus you should not trust the returned value,
|
||||
* unless you are sure that no other processes are accessing the
|
||||
* checked resource.
|
||||
*/
|
||||
int avio_check(const char *url, int flags);
|
||||
|
||||
#if FF_API_OLD_INTERRUPT_CB
|
||||
/**
|
||||
* The callback is called in blocking functions to test regulary if
|
||||
* asynchronous interruption is needed. AVERROR_EXIT is returned
|
||||
* in this case by the interrupted function. 'NULL' means no interrupt
|
||||
* callback is given.
|
||||
* @deprecated Use interrupt_callback in AVFormatContext/avio_open2
|
||||
* instead.
|
||||
*/
|
||||
attribute_deprecated void avio_set_interrupt_cb(int (*interrupt_cb)(void));
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Allocate and initialize an AVIOContext for buffered I/O. It must be later
|
||||
* freed with av_free().
|
||||
*
|
||||
* @param buffer Memory block for input/output operations via AVIOContext.
|
||||
* The buffer must be allocated with av_malloc() and friends.
|
||||
* @param buffer_size The buffer size is very important for performance.
|
||||
* For protocols with fixed blocksize it should be set to this blocksize.
|
||||
* For others a typical size is a cache page, e.g. 4kb.
|
||||
* @param write_flag Set to 1 if the buffer should be writable, 0 otherwise.
|
||||
* @param opaque An opaque pointer to user-specific data.
|
||||
* @param read_packet A function for refilling the buffer, may be NULL.
|
||||
* @param write_packet A function for writing the buffer contents, may be NULL.
|
||||
* @param seek A function for seeking to specified byte position, may be NULL.
|
||||
*
|
||||
* @return Allocated AVIOContext or NULL on failure.
|
||||
*/
|
||||
AVIOContext *avio_alloc_context(
|
||||
unsigned char *buffer,
|
||||
int buffer_size,
|
||||
int write_flag,
|
||||
void *opaque,
|
||||
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
|
||||
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
|
||||
int64_t (*seek)(void *opaque, int64_t offset, int whence));
|
||||
|
||||
void avio_w8(AVIOContext *s, int b);
|
||||
void avio_write(AVIOContext *s, const unsigned char *buf, int size);
|
||||
void avio_wl64(AVIOContext *s, uint64_t val);
|
||||
void avio_wb64(AVIOContext *s, uint64_t val);
|
||||
void avio_wl32(AVIOContext *s, unsigned int val);
|
||||
void avio_wb32(AVIOContext *s, unsigned int val);
|
||||
void avio_wl24(AVIOContext *s, unsigned int val);
|
||||
void avio_wb24(AVIOContext *s, unsigned int val);
|
||||
void avio_wl16(AVIOContext *s, unsigned int val);
|
||||
void avio_wb16(AVIOContext *s, unsigned int val);
|
||||
|
||||
/**
|
||||
* Write a NULL-terminated string.
|
||||
* @return number of bytes written.
|
||||
*/
|
||||
int avio_put_str(AVIOContext *s, const char *str);
|
||||
|
||||
/**
|
||||
* Convert an UTF-8 string to UTF-16LE and write it.
|
||||
* @return number of bytes written.
|
||||
*/
|
||||
int avio_put_str16le(AVIOContext *s, const char *str);
|
||||
|
||||
/**
|
||||
* Passing this as the "whence" parameter to a seek function causes it to
|
||||
* return the filesize without seeking anywhere. Supporting this is optional.
|
||||
* If it is not supported then the seek function will return <0.
|
||||
*/
|
||||
#define AVSEEK_SIZE 0x10000
|
||||
|
||||
/**
|
||||
* Oring this flag as into the "whence" parameter to a seek function causes it to
|
||||
* seek by any means (like reopening and linear reading) or other normally unreasonble
|
||||
* means that can be extreemly slow.
|
||||
* This may be ignored by the seek code.
|
||||
*/
|
||||
#define AVSEEK_FORCE 0x20000
|
||||
|
||||
/**
|
||||
* fseek() equivalent for AVIOContext.
|
||||
* @return new position or AVERROR.
|
||||
*/
|
||||
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence);
|
||||
|
||||
/**
|
||||
* Skip given number of bytes forward
|
||||
* @return new position or AVERROR.
|
||||
*/
|
||||
static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
|
||||
{
|
||||
return avio_seek(s, offset, SEEK_CUR);
|
||||
}
|
||||
|
||||
/**
|
||||
* ftell() equivalent for AVIOContext.
|
||||
* @return position or AVERROR.
|
||||
*/
|
||||
static av_always_inline int64_t avio_tell(AVIOContext *s)
|
||||
{
|
||||
return avio_seek(s, 0, SEEK_CUR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filesize.
|
||||
* @return filesize or AVERROR
|
||||
*/
|
||||
int64_t avio_size(AVIOContext *s);
|
||||
|
||||
/** @warning currently size is limited */
|
||||
int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3);
|
||||
|
||||
void avio_flush(AVIOContext *s);
|
||||
|
||||
|
||||
/**
|
||||
* Read size bytes from AVIOContext into buf.
|
||||
* @return number of bytes read or AVERROR
|
||||
*/
|
||||
int avio_read(AVIOContext *s, unsigned char *buf, int size);
|
||||
|
||||
/**
|
||||
* @name Functions for reading from AVIOContext
|
||||
* @{
|
||||
*
|
||||
* @note return 0 if EOF, so you cannot use it if EOF handling is
|
||||
* necessary
|
||||
*/
|
||||
int avio_r8 (AVIOContext *s);
|
||||
unsigned int avio_rl16(AVIOContext *s);
|
||||
unsigned int avio_rl24(AVIOContext *s);
|
||||
unsigned int avio_rl32(AVIOContext *s);
|
||||
uint64_t avio_rl64(AVIOContext *s);
|
||||
unsigned int avio_rb16(AVIOContext *s);
|
||||
unsigned int avio_rb24(AVIOContext *s);
|
||||
unsigned int avio_rb32(AVIOContext *s);
|
||||
uint64_t avio_rb64(AVIOContext *s);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Read a string from pb into buf. The reading will terminate when either
|
||||
* a NULL character was encountered, maxlen bytes have been read, or nothing
|
||||
* more can be read from pb. The result is guaranteed to be NULL-terminated, it
|
||||
* will be truncated if buf is too small.
|
||||
* Note that the string is not interpreted or validated in any way, it
|
||||
* might get truncated in the middle of a sequence for multi-byte encodings.
|
||||
*
|
||||
* @return number of bytes read (is always <= maxlen).
|
||||
* If reading ends on EOF or error, the return value will be one more than
|
||||
* bytes actually read.
|
||||
*/
|
||||
int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen);
|
||||
|
||||
/**
|
||||
* Read a UTF-16 string from pb and convert it to UTF-8.
|
||||
* The reading will terminate when either a null or invalid character was
|
||||
* encountered or maxlen bytes have been read.
|
||||
* @return number of bytes read (is always <= maxlen)
|
||||
*/
|
||||
int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen);
|
||||
int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen);
|
||||
|
||||
|
||||
/**
|
||||
* @name URL open modes
|
||||
* The flags argument to avio_open must be one of the following
|
||||
* constants, optionally ORed with other flags.
|
||||
* @{
|
||||
*/
|
||||
#define AVIO_FLAG_READ 1 /**< read-only */
|
||||
#define AVIO_FLAG_WRITE 2 /**< write-only */
|
||||
#define AVIO_FLAG_READ_WRITE (AVIO_FLAG_READ|AVIO_FLAG_WRITE) /**< read-write pseudo flag */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Use non-blocking mode.
|
||||
* If this flag is set, operations on the context will return
|
||||
* AVERROR(EAGAIN) if they can not be performed immediately.
|
||||
* If this flag is not set, operations on the context will never return
|
||||
* AVERROR(EAGAIN).
|
||||
* Note that this flag does not affect the opening/connecting of the
|
||||
* context. Connecting a protocol will always block if necessary (e.g. on
|
||||
* network protocols) but never hang (e.g. on busy devices).
|
||||
* Warning: non-blocking protocols is work-in-progress; this flag may be
|
||||
* silently ignored.
|
||||
*/
|
||||
#define AVIO_FLAG_NONBLOCK 8
|
||||
|
||||
/**
|
||||
* Create and initialize a AVIOContext for accessing the
|
||||
* resource indicated by url.
|
||||
* @note When the resource indicated by url has been opened in
|
||||
* read+write mode, the AVIOContext can be used only for writing.
|
||||
*
|
||||
* @param s Used to return the pointer to the created AVIOContext.
|
||||
* In case of failure the pointed to value is set to NULL.
|
||||
* @param flags flags which control how the resource indicated by url
|
||||
* is to be opened
|
||||
* @return 0 in case of success, a negative value corresponding to an
|
||||
* AVERROR code in case of failure
|
||||
*/
|
||||
int avio_open(AVIOContext **s, const char *url, int flags);
|
||||
|
||||
/**
|
||||
* Create and initialize a AVIOContext for accessing the
|
||||
* resource indicated by url.
|
||||
* @note When the resource indicated by url has been opened in
|
||||
* read+write mode, the AVIOContext can be used only for writing.
|
||||
*
|
||||
* @param s Used to return the pointer to the created AVIOContext.
|
||||
* In case of failure the pointed to value is set to NULL.
|
||||
* @param flags flags which control how the resource indicated by url
|
||||
* is to be opened
|
||||
* @param int_cb an interrupt callback to be used at the protocols level
|
||||
* @param options A dictionary filled with protocol-private options. On return
|
||||
* this parameter will be destroyed and replaced with a dict containing options
|
||||
* that were not found. May be NULL.
|
||||
* @return 0 in case of success, a negative value corresponding to an
|
||||
* AVERROR code in case of failure
|
||||
*/
|
||||
int avio_open2(AVIOContext **s, const char *url, int flags,
|
||||
const AVIOInterruptCB *int_cb, AVDictionary **options);
|
||||
|
||||
/**
|
||||
* Close the resource accessed by the AVIOContext s and free it.
|
||||
* This function can only be used if s was opened by avio_open().
|
||||
*
|
||||
* @return 0 on success, an AVERROR < 0 on error.
|
||||
*/
|
||||
int avio_close(AVIOContext *s);
|
||||
|
||||
/**
|
||||
* Open a write only memory stream.
|
||||
*
|
||||
* @param s new IO context
|
||||
* @return zero if no error.
|
||||
*/
|
||||
int avio_open_dyn_buf(AVIOContext **s);
|
||||
|
||||
/**
|
||||
* Return the written size and a pointer to the buffer. The buffer
|
||||
* must be freed with av_free().
|
||||
* Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer.
|
||||
*
|
||||
* @param s IO context
|
||||
* @param pbuffer pointer to a byte buffer
|
||||
* @return the length of the byte buffer
|
||||
*/
|
||||
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
|
||||
|
||||
/**
|
||||
* Iterate through names of available protocols.
|
||||
*
|
||||
* @param opaque A private pointer representing current protocol.
|
||||
* It must be a pointer to NULL on first iteration and will
|
||||
* be updated by successive calls to avio_enum_protocols.
|
||||
* @param output If set to 1, iterate over output protocols,
|
||||
* otherwise over input protocols.
|
||||
*
|
||||
* @return A static string containing the name of current protocol or NULL
|
||||
*/
|
||||
const char *avio_enum_protocols(void **opaque, int output);
|
||||
|
||||
/**
|
||||
* Pause and resume playing - only meaningful if using a network streaming
|
||||
* protocol (e.g. MMS).
|
||||
* @param pause 1 for pause, 0 for resume
|
||||
*/
|
||||
int avio_pause(AVIOContext *h, int pause);
|
||||
|
||||
/**
|
||||
* Seek to a given timestamp relative to some component stream.
|
||||
* Only meaningful if using a network streaming protocol (e.g. MMS.).
|
||||
* @param stream_index The stream index that the timestamp is relative to.
|
||||
* If stream_index is (-1) the timestamp should be in AV_TIME_BASE
|
||||
* units from the beginning of the presentation.
|
||||
* If a stream_index >= 0 is used and the protocol does not support
|
||||
* seeking based on component streams, the call will fail with ENOTSUP.
|
||||
* @param timestamp timestamp in AVStream.time_base units
|
||||
* or if there is no stream specified then in AV_TIME_BASE units.
|
||||
* @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE
|
||||
* and AVSEEK_FLAG_ANY. The protocol may silently ignore
|
||||
* AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will
|
||||
* fail with ENOTSUP if used and not supported.
|
||||
* @return >= 0 on success
|
||||
* @see AVInputFormat::read_seek
|
||||
*/
|
||||
int64_t avio_seek_time(AVIOContext *h, int stream_index,
|
||||
int64_t timestamp, int flags);
|
||||
|
||||
#endif /* AVFORMAT_AVIO_H */
|
|
@ -1,126 +0,0 @@
|
|||
/*
|
||||
* Version macros.
|
||||
*
|
||||
* This file is part of Libav.
|
||||
*
|
||||
* Libav is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Libav 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with Libav; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVFORMAT_VERSION_H
|
||||
#define AVFORMAT_VERSION_H
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @ingroup libavf
|
||||
* Libavformat version macros
|
||||
*/
|
||||
|
||||
#include "libavutil/avutil.h"
|
||||
|
||||
#define LIBAVFORMAT_VERSION_MAJOR 53
|
||||
#define LIBAVFORMAT_VERSION_MINOR 21
|
||||
#define LIBAVFORMAT_VERSION_MICRO 1
|
||||
|
||||
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
||||
LIBAVFORMAT_VERSION_MINOR, \
|
||||
LIBAVFORMAT_VERSION_MICRO)
|
||||
#define LIBAVFORMAT_VERSION AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, \
|
||||
LIBAVFORMAT_VERSION_MINOR, \
|
||||
LIBAVFORMAT_VERSION_MICRO)
|
||||
#define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT
|
||||
|
||||
#define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION)
|
||||
|
||||
/**
|
||||
* Those FF_API_* defines are not part of public API.
|
||||
* They may change, break or disappear at any time.
|
||||
*/
|
||||
#ifndef FF_API_OLD_METADATA2
|
||||
#define FF_API_OLD_METADATA2 (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_OLD_AVIO
|
||||
#define FF_API_OLD_AVIO (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_DUMP_FORMAT
|
||||
#define FF_API_DUMP_FORMAT (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_PARSE_DATE
|
||||
#define FF_API_PARSE_DATE (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_FIND_INFO_TAG
|
||||
#define FF_API_FIND_INFO_TAG (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_PKT_DUMP
|
||||
#define FF_API_PKT_DUMP (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_GUESS_IMG2_CODEC
|
||||
#define FF_API_GUESS_IMG2_CODEC (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_SDP_CREATE
|
||||
#define FF_API_SDP_CREATE (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_FORMAT_PARAMETERS
|
||||
#define FF_API_FORMAT_PARAMETERS (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_FLAG_RTP_HINT
|
||||
#define FF_API_FLAG_RTP_HINT (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_AVSTREAM_QUALITY
|
||||
#define FF_API_AVSTREAM_QUALITY (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_LOOP_INPUT
|
||||
#define FF_API_LOOP_INPUT (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_LOOP_OUTPUT
|
||||
#define FF_API_LOOP_OUTPUT (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_TIMESTAMP
|
||||
#define FF_API_TIMESTAMP (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_FILESIZE
|
||||
#define FF_API_FILESIZE (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_MUXRATE
|
||||
#define FF_API_MUXRATE (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_RTSP_URL_OPTIONS
|
||||
#define FF_API_RTSP_URL_OPTIONS (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_NEW_STREAM
|
||||
#define FF_API_NEW_STREAM (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_PRELOAD
|
||||
#define FF_API_PRELOAD (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_STREAM_COPY
|
||||
#define FF_API_STREAM_COPY (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_SEEK_PUBLIC
|
||||
#define FF_API_SEEK_PUBLIC (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_REORDER_PRIVATE
|
||||
#define FF_API_REORDER_PRIVATE (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_OLD_INTERRUPT_CB
|
||||
#define FF_API_OLD_INTERRUPT_CB (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_SET_PTS_INFO
|
||||
#define FF_API_SET_PTS_INFO (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
#ifndef FF_API_CLOSE_INPUT_FILE
|
||||
#define FF_API_CLOSE_INPUT_FILE (LIBAVFORMAT_VERSION_MAJOR < 54)
|
||||
#endif
|
||||
|
||||
#endif /* AVFORMAT_VERSION_H */
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,433 +0,0 @@
|
|||
/*
|
||||
* copyright (c) 2001 Fabrice Bellard
|
||||
*
|
||||
* This file is part of Libav.
|
||||
*
|
||||
* Libav is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Libav 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with Libav; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#ifndef AVFORMAT_AVIO_H
|
||||
#define AVFORMAT_AVIO_H
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @ingroup lavf_io
|
||||
* Buffered I/O operations
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "libavutil/common.h"
|
||||
#include "libavutil/dict.h"
|
||||
#include "libavutil/log.h"
|
||||
|
||||
#include "libavformat/version.h"
|
||||
|
||||
|
||||
#define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */
|
||||
|
||||
/**
|
||||
* Callback for checking whether to abort blocking functions.
|
||||
* AVERROR_EXIT is returned in this case by the interrupted
|
||||
* function. During blocking operations, callback is called with
|
||||
* opaque as parameter. If the callback returns 1, the
|
||||
* blocking operation will be aborted.
|
||||
*
|
||||
* No members can be added to this struct without a major bump, if
|
||||
* new elements have been added after this struct in AVFormatContext
|
||||
* or AVIOContext.
|
||||
*/
|
||||
typedef struct AVIOInterruptCB {
|
||||
int (*callback)(void*);
|
||||
void *opaque;
|
||||
} AVIOInterruptCB;
|
||||
|
||||
/**
|
||||
* Bytestream IO Context.
|
||||
* New fields can be added to the end with minor version bumps.
|
||||
* Removal, reordering and changes to existing fields require a major
|
||||
* version bump.
|
||||
* sizeof(AVIOContext) must not be used outside libav*.
|
||||
*
|
||||
* @note None of the function pointers in AVIOContext should be called
|
||||
* directly, they should only be set by the client application
|
||||
* when implementing custom I/O. Normally these are set to the
|
||||
* function pointers specified in avio_alloc_context()
|
||||
*/
|
||||
typedef struct AVIOContext {
|
||||
/**
|
||||
* A class for private options.
|
||||
*
|
||||
* If this AVIOContext is created by avio_open2(), av_class is set and
|
||||
* passes the options down to protocols.
|
||||
*
|
||||
* If this AVIOContext is manually allocated, then av_class may be set by
|
||||
* the caller.
|
||||
*
|
||||
* warning -- this field can be NULL, be sure to not pass this AVIOContext
|
||||
* to any av_opt_* functions in that case.
|
||||
*/
|
||||
const AVClass *av_class;
|
||||
unsigned char *buffer; /**< Start of the buffer. */
|
||||
int buffer_size; /**< Maximum buffer size */
|
||||
unsigned char *buf_ptr; /**< Current position in the buffer */
|
||||
unsigned char *buf_end; /**< End of the data, may be less than
|
||||
buffer+buffer_size if the read function returned
|
||||
less data than requested, e.g. for streams where
|
||||
no more data has been received yet. */
|
||||
void *opaque; /**< A private pointer, passed to the read/write/seek/...
|
||||
functions. */
|
||||
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size);
|
||||
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size);
|
||||
int64_t (*seek)(void *opaque, int64_t offset, int whence);
|
||||
int64_t pos; /**< position in the file of the current buffer */
|
||||
int must_flush; /**< true if the next seek should flush */
|
||||
int eof_reached; /**< true if eof reached */
|
||||
int write_flag; /**< true if open for writing */
|
||||
int max_packet_size;
|
||||
unsigned long checksum;
|
||||
unsigned char *checksum_ptr;
|
||||
unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size);
|
||||
int error; /**< contains the error code or 0 if no error happened */
|
||||
/**
|
||||
* Pause or resume playback for network streaming protocols - e.g. MMS.
|
||||
*/
|
||||
int (*read_pause)(void *opaque, int pause);
|
||||
/**
|
||||
* Seek to a given timestamp in stream with the specified stream_index.
|
||||
* Needed for some network streaming protocols which don't support seeking
|
||||
* to byte position.
|
||||
*/
|
||||
int64_t (*read_seek)(void *opaque, int stream_index,
|
||||
int64_t timestamp, int flags);
|
||||
/**
|
||||
* A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
|
||||
*/
|
||||
int seekable;
|
||||
} AVIOContext;
|
||||
|
||||
/* unbuffered I/O */
|
||||
|
||||
/**
|
||||
* Return AVIO_FLAG_* access flags corresponding to the access permissions
|
||||
* of the resource in url, or a negative value corresponding to an
|
||||
* AVERROR code in case of failure. The returned access flags are
|
||||
* masked by the value in flags.
|
||||
*
|
||||
* @note This function is intrinsically unsafe, in the sense that the
|
||||
* checked resource may change its existence or permission status from
|
||||
* one call to another. Thus you should not trust the returned value,
|
||||
* unless you are sure that no other processes are accessing the
|
||||
* checked resource.
|
||||
*/
|
||||
int avio_check(const char *url, int flags);
|
||||
|
||||
/**
|
||||
* Allocate and initialize an AVIOContext for buffered I/O. It must be later
|
||||
* freed with av_free().
|
||||
*
|
||||
* @param buffer Memory block for input/output operations via AVIOContext.
|
||||
* The buffer must be allocated with av_malloc() and friends.
|
||||
* @param buffer_size The buffer size is very important for performance.
|
||||
* For protocols with fixed blocksize it should be set to this blocksize.
|
||||
* For others a typical size is a cache page, e.g. 4kb.
|
||||
* @param write_flag Set to 1 if the buffer should be writable, 0 otherwise.
|
||||
* @param opaque An opaque pointer to user-specific data.
|
||||
* @param read_packet A function for refilling the buffer, may be NULL.
|
||||
* @param write_packet A function for writing the buffer contents, may be NULL.
|
||||
* @param seek A function for seeking to specified byte position, may be NULL.
|
||||
*
|
||||
* @return Allocated AVIOContext or NULL on failure.
|
||||
*/
|
||||
AVIOContext *avio_alloc_context(
|
||||
unsigned char *buffer,
|
||||
int buffer_size,
|
||||
int write_flag,
|
||||
void *opaque,
|
||||
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
|
||||
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
|
||||
int64_t (*seek)(void *opaque, int64_t offset, int whence));
|
||||
|
||||
void avio_w8(AVIOContext *s, int b);
|
||||
void avio_write(AVIOContext *s, const unsigned char *buf, int size);
|
||||
void avio_wl64(AVIOContext *s, uint64_t val);
|
||||
void avio_wb64(AVIOContext *s, uint64_t val);
|
||||
void avio_wl32(AVIOContext *s, unsigned int val);
|
||||
void avio_wb32(AVIOContext *s, unsigned int val);
|
||||
void avio_wl24(AVIOContext *s, unsigned int val);
|
||||
void avio_wb24(AVIOContext *s, unsigned int val);
|
||||
void avio_wl16(AVIOContext *s, unsigned int val);
|
||||
void avio_wb16(AVIOContext *s, unsigned int val);
|
||||
|
||||
/**
|
||||
* Write a NULL-terminated string.
|
||||
* @return number of bytes written.
|
||||
*/
|
||||
int avio_put_str(AVIOContext *s, const char *str);
|
||||
|
||||
/**
|
||||
* Convert an UTF-8 string to UTF-16LE and write it.
|
||||
* @return number of bytes written.
|
||||
*/
|
||||
int avio_put_str16le(AVIOContext *s, const char *str);
|
||||
|
||||
/**
|
||||
* Passing this as the "whence" parameter to a seek function causes it to
|
||||
* return the filesize without seeking anywhere. Supporting this is optional.
|
||||
* If it is not supported then the seek function will return <0.
|
||||
*/
|
||||
#define AVSEEK_SIZE 0x10000
|
||||
|
||||
/**
|
||||
* Oring this flag as into the "whence" parameter to a seek function causes it to
|
||||
* seek by any means (like reopening and linear reading) or other normally unreasonble
|
||||
* means that can be extreemly slow.
|
||||
* This may be ignored by the seek code.
|
||||
*/
|
||||
#define AVSEEK_FORCE 0x20000
|
||||
|
||||
/**
|
||||
* fseek() equivalent for AVIOContext.
|
||||
* @return new position or AVERROR.
|
||||
*/
|
||||
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence);
|
||||
|
||||
/**
|
||||
* Skip given number of bytes forward
|
||||
* @return new position or AVERROR.
|
||||
*/
|
||||
static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
|
||||
{
|
||||
return avio_seek(s, offset, SEEK_CUR);
|
||||
}
|
||||
|
||||
/**
|
||||
* ftell() equivalent for AVIOContext.
|
||||
* @return position or AVERROR.
|
||||
*/
|
||||
static av_always_inline int64_t avio_tell(AVIOContext *s)
|
||||
{
|
||||
return avio_seek(s, 0, SEEK_CUR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filesize.
|
||||
* @return filesize or AVERROR
|
||||
*/
|
||||
int64_t avio_size(AVIOContext *s);
|
||||
|
||||
/** @warning currently size is limited */
|
||||
int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3);
|
||||
|
||||
void avio_flush(AVIOContext *s);
|
||||
|
||||
|
||||
/**
|
||||
* Read size bytes from AVIOContext into buf.
|
||||
* @return number of bytes read or AVERROR
|
||||
*/
|
||||
int avio_read(AVIOContext *s, unsigned char *buf, int size);
|
||||
|
||||
/**
|
||||
* @name Functions for reading from AVIOContext
|
||||
* @{
|
||||
*
|
||||
* @note return 0 if EOF, so you cannot use it if EOF handling is
|
||||
* necessary
|
||||
*/
|
||||
int avio_r8 (AVIOContext *s);
|
||||
unsigned int avio_rl16(AVIOContext *s);
|
||||
unsigned int avio_rl24(AVIOContext *s);
|
||||
unsigned int avio_rl32(AVIOContext *s);
|
||||
uint64_t avio_rl64(AVIOContext *s);
|
||||
unsigned int avio_rb16(AVIOContext *s);
|
||||
unsigned int avio_rb24(AVIOContext *s);
|
||||
unsigned int avio_rb32(AVIOContext *s);
|
||||
uint64_t avio_rb64(AVIOContext *s);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Read a string from pb into buf. The reading will terminate when either
|
||||
* a NULL character was encountered, maxlen bytes have been read, or nothing
|
||||
* more can be read from pb. The result is guaranteed to be NULL-terminated, it
|
||||
* will be truncated if buf is too small.
|
||||
* Note that the string is not interpreted or validated in any way, it
|
||||
* might get truncated in the middle of a sequence for multi-byte encodings.
|
||||
*
|
||||
* @return number of bytes read (is always <= maxlen).
|
||||
* If reading ends on EOF or error, the return value will be one more than
|
||||
* bytes actually read.
|
||||
*/
|
||||
int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen);
|
||||
|
||||
/**
|
||||
* Read a UTF-16 string from pb and convert it to UTF-8.
|
||||
* The reading will terminate when either a null or invalid character was
|
||||
* encountered or maxlen bytes have been read.
|
||||
* @return number of bytes read (is always <= maxlen)
|
||||
*/
|
||||
int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen);
|
||||
int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen);
|
||||
|
||||
|
||||
/**
|
||||
* @name URL open modes
|
||||
* The flags argument to avio_open must be one of the following
|
||||
* constants, optionally ORed with other flags.
|
||||
* @{
|
||||
*/
|
||||
#define AVIO_FLAG_READ 1 /**< read-only */
|
||||
#define AVIO_FLAG_WRITE 2 /**< write-only */
|
||||
#define AVIO_FLAG_READ_WRITE (AVIO_FLAG_READ|AVIO_FLAG_WRITE) /**< read-write pseudo flag */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Use non-blocking mode.
|
||||
* If this flag is set, operations on the context will return
|
||||
* AVERROR(EAGAIN) if they can not be performed immediately.
|
||||
* If this flag is not set, operations on the context will never return
|
||||
* AVERROR(EAGAIN).
|
||||
* Note that this flag does not affect the opening/connecting of the
|
||||
* context. Connecting a protocol will always block if necessary (e.g. on
|
||||
* network protocols) but never hang (e.g. on busy devices).
|
||||
* Warning: non-blocking protocols is work-in-progress; this flag may be
|
||||
* silently ignored.
|
||||
*/
|
||||
#define AVIO_FLAG_NONBLOCK 8
|
||||
|
||||
/**
|
||||
* Create and initialize a AVIOContext for accessing the
|
||||
* resource indicated by url.
|
||||
* @note When the resource indicated by url has been opened in
|
||||
* read+write mode, the AVIOContext can be used only for writing.
|
||||
*
|
||||
* @param s Used to return the pointer to the created AVIOContext.
|
||||
* In case of failure the pointed to value is set to NULL.
|
||||
* @param flags flags which control how the resource indicated by url
|
||||
* is to be opened
|
||||
* @return 0 in case of success, a negative value corresponding to an
|
||||
* AVERROR code in case of failure
|
||||
*/
|
||||
int avio_open(AVIOContext **s, const char *url, int flags);
|
||||
|
||||
/**
|
||||
* Create and initialize a AVIOContext for accessing the
|
||||
* resource indicated by url.
|
||||
* @note When the resource indicated by url has been opened in
|
||||
* read+write mode, the AVIOContext can be used only for writing.
|
||||
*
|
||||
* @param s Used to return the pointer to the created AVIOContext.
|
||||
* In case of failure the pointed to value is set to NULL.
|
||||
* @param flags flags which control how the resource indicated by url
|
||||
* is to be opened
|
||||
* @param int_cb an interrupt callback to be used at the protocols level
|
||||
* @param options A dictionary filled with protocol-private options. On return
|
||||
* this parameter will be destroyed and replaced with a dict containing options
|
||||
* that were not found. May be NULL.
|
||||
* @return 0 in case of success, a negative value corresponding to an
|
||||
* AVERROR code in case of failure
|
||||
*/
|
||||
int avio_open2(AVIOContext **s, const char *url, int flags,
|
||||
const AVIOInterruptCB *int_cb, AVDictionary **options);
|
||||
|
||||
/**
|
||||
* Close the resource accessed by the AVIOContext s and free it.
|
||||
* This function can only be used if s was opened by avio_open().
|
||||
*
|
||||
* The internal buffer is automatically flushed before closing the
|
||||
* resource.
|
||||
*
|
||||
* @return 0 on success, an AVERROR < 0 on error.
|
||||
* @see avio_closep
|
||||
*/
|
||||
int avio_close(AVIOContext *s);
|
||||
|
||||
/**
|
||||
* Close the resource accessed by the AVIOContext *s, free it
|
||||
* and set the pointer pointing to it to NULL.
|
||||
* This function can only be used if s was opened by avio_open().
|
||||
*
|
||||
* The internal buffer is automatically flushed before closing the
|
||||
* resource.
|
||||
*
|
||||
* @return 0 on success, an AVERROR < 0 on error.
|
||||
* @see avio_close
|
||||
*/
|
||||
int avio_closep(AVIOContext **s);
|
||||
|
||||
|
||||
/**
|
||||
* Open a write only memory stream.
|
||||
*
|
||||
* @param s new IO context
|
||||
* @return zero if no error.
|
||||
*/
|
||||
int avio_open_dyn_buf(AVIOContext **s);
|
||||
|
||||
/**
|
||||
* Return the written size and a pointer to the buffer. The buffer
|
||||
* must be freed with av_free().
|
||||
* Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer.
|
||||
*
|
||||
* @param s IO context
|
||||
* @param pbuffer pointer to a byte buffer
|
||||
* @return the length of the byte buffer
|
||||
*/
|
||||
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
|
||||
|
||||
/**
|
||||
* Iterate through names of available protocols.
|
||||
*
|
||||
* @param opaque A private pointer representing current protocol.
|
||||
* It must be a pointer to NULL on first iteration and will
|
||||
* be updated by successive calls to avio_enum_protocols.
|
||||
* @param output If set to 1, iterate over output protocols,
|
||||
* otherwise over input protocols.
|
||||
*
|
||||
* @return A static string containing the name of current protocol or NULL
|
||||
*/
|
||||
const char *avio_enum_protocols(void **opaque, int output);
|
||||
|
||||
/**
|
||||
* Pause and resume playing - only meaningful if using a network streaming
|
||||
* protocol (e.g. MMS).
|
||||
* @param pause 1 for pause, 0 for resume
|
||||
*/
|
||||
int avio_pause(AVIOContext *h, int pause);
|
||||
|
||||
/**
|
||||
* Seek to a given timestamp relative to some component stream.
|
||||
* Only meaningful if using a network streaming protocol (e.g. MMS.).
|
||||
* @param stream_index The stream index that the timestamp is relative to.
|
||||
* If stream_index is (-1) the timestamp should be in AV_TIME_BASE
|
||||
* units from the beginning of the presentation.
|
||||
* If a stream_index >= 0 is used and the protocol does not support
|
||||
* seeking based on component streams, the call will fail with ENOTSUP.
|
||||
* @param timestamp timestamp in AVStream.time_base units
|
||||
* or if there is no stream specified then in AV_TIME_BASE units.
|
||||
* @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE
|
||||
* and AVSEEK_FLAG_ANY. The protocol may silently ignore
|
||||
* AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will
|
||||
* fail with ENOTSUP if used and not supported.
|
||||
* @return >= 0 on success
|
||||
* @see AVInputFormat::read_seek
|
||||
*/
|
||||
int64_t avio_seek_time(AVIOContext *h, int stream_index,
|
||||
int64_t timestamp, int flags);
|
||||
|
||||
#endif /* AVFORMAT_AVIO_H */
|
|
@ -1,71 +0,0 @@
|
|||
/*
|
||||
* Version macros.
|
||||
*
|
||||
* This file is part of Libav.
|
||||
*
|
||||
* Libav is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Libav 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with Libav; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVFORMAT_VERSION_H
|
||||
#define AVFORMAT_VERSION_H
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @ingroup libavf
|
||||
* Libavformat version macros
|
||||
*/
|
||||
|
||||
#include "libavutil/avutil.h"
|
||||
|
||||
#define LIBAVFORMAT_VERSION_MAJOR 54
|
||||
#define LIBAVFORMAT_VERSION_MINOR 20
|
||||
#define LIBAVFORMAT_VERSION_MICRO 4
|
||||
|
||||
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
||||
LIBAVFORMAT_VERSION_MINOR, \
|
||||
LIBAVFORMAT_VERSION_MICRO)
|
||||
#define LIBAVFORMAT_VERSION AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, \
|
||||
LIBAVFORMAT_VERSION_MINOR, \
|
||||
LIBAVFORMAT_VERSION_MICRO)
|
||||
#define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT
|
||||
|
||||
#define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION)
|
||||
|
||||
/**
|
||||
* FF_API_* defines may be placed below to indicate public API that will be
|
||||
* dropped at a future version bump. The defines themselves are not part of
|
||||
* the public API and may change, break or disappear at any time.
|
||||
*/
|
||||
|
||||
#ifndef FF_API_CLOSE_INPUT_FILE
|
||||
#define FF_API_CLOSE_INPUT_FILE (LIBAVFORMAT_VERSION_MAJOR < 55)
|
||||
#endif
|
||||
#ifndef FF_API_APPLEHTTP_PROTO
|
||||
#define FF_API_APPLEHTTP_PROTO (LIBAVFORMAT_VERSION_MAJOR < 55)
|
||||
#endif
|
||||
#ifndef FF_API_READ_PACKET
|
||||
#define FF_API_READ_PACKET (LIBAVFORMAT_VERSION_MAJOR < 55)
|
||||
#endif
|
||||
#ifndef FF_API_INTERLEAVE_PACKET
|
||||
#define FF_API_INTERLEAVE_PACKET (LIBAVFORMAT_VERSION_MAJOR < 55)
|
||||
#endif
|
||||
#ifndef FF_API_AV_GETTIME
|
||||
#define FF_API_AV_GETTIME (LIBAVFORMAT_VERSION_MAJOR < 55)
|
||||
#endif
|
||||
#ifndef FF_API_R_FRAME_RATE
|
||||
#define FF_API_R_FRAME_RATE (LIBAVFORMAT_VERSION_MAJOR < 55)
|
||||
#endif
|
||||
|
||||
#endif /* AVFORMAT_VERSION_H */
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,439 +0,0 @@
|
|||
/*
|
||||
* copyright (c) 2001 Fabrice Bellard
|
||||
*
|
||||
* This file is part of Libav.
|
||||
*
|
||||
* Libav is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Libav 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with Libav; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#ifndef AVFORMAT_AVIO_H
|
||||
#define AVFORMAT_AVIO_H
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @ingroup lavf_io
|
||||
* Buffered I/O operations
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "libavutil/common.h"
|
||||
#include "libavutil/dict.h"
|
||||
#include "libavutil/log.h"
|
||||
|
||||
#include "libavformat/version.h"
|
||||
|
||||
|
||||
#define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */
|
||||
|
||||
/**
|
||||
* Callback for checking whether to abort blocking functions.
|
||||
* AVERROR_EXIT is returned in this case by the interrupted
|
||||
* function. During blocking operations, callback is called with
|
||||
* opaque as parameter. If the callback returns 1, the
|
||||
* blocking operation will be aborted.
|
||||
*
|
||||
* No members can be added to this struct without a major bump, if
|
||||
* new elements have been added after this struct in AVFormatContext
|
||||
* or AVIOContext.
|
||||
*/
|
||||
typedef struct AVIOInterruptCB {
|
||||
int (*callback)(void*);
|
||||
void *opaque;
|
||||
} AVIOInterruptCB;
|
||||
|
||||
/**
|
||||
* Bytestream IO Context.
|
||||
* New fields can be added to the end with minor version bumps.
|
||||
* Removal, reordering and changes to existing fields require a major
|
||||
* version bump.
|
||||
* sizeof(AVIOContext) must not be used outside libav*.
|
||||
*
|
||||
* @note None of the function pointers in AVIOContext should be called
|
||||
* directly, they should only be set by the client application
|
||||
* when implementing custom I/O. Normally these are set to the
|
||||
* function pointers specified in avio_alloc_context()
|
||||
*/
|
||||
typedef struct AVIOContext {
|
||||
/**
|
||||
* A class for private options.
|
||||
*
|
||||
* If this AVIOContext is created by avio_open2(), av_class is set and
|
||||
* passes the options down to protocols.
|
||||
*
|
||||
* If this AVIOContext is manually allocated, then av_class may be set by
|
||||
* the caller.
|
||||
*
|
||||
* warning -- this field can be NULL, be sure to not pass this AVIOContext
|
||||
* to any av_opt_* functions in that case.
|
||||
*/
|
||||
const AVClass *av_class;
|
||||
unsigned char *buffer; /**< Start of the buffer. */
|
||||
int buffer_size; /**< Maximum buffer size */
|
||||
unsigned char *buf_ptr; /**< Current position in the buffer */
|
||||
unsigned char *buf_end; /**< End of the data, may be less than
|
||||
buffer+buffer_size if the read function returned
|
||||
less data than requested, e.g. for streams where
|
||||
no more data has been received yet. */
|
||||
void *opaque; /**< A private pointer, passed to the read/write/seek/...
|
||||
functions. */
|
||||
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size);
|
||||
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size);
|
||||
int64_t (*seek)(void *opaque, int64_t offset, int whence);
|
||||
int64_t pos; /**< position in the file of the current buffer */
|
||||
int must_flush; /**< true if the next seek should flush */
|
||||
int eof_reached; /**< true if eof reached */
|
||||
int write_flag; /**< true if open for writing */
|
||||
int max_packet_size;
|
||||
unsigned long checksum;
|
||||
unsigned char *checksum_ptr;
|
||||
unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size);
|
||||
int error; /**< contains the error code or 0 if no error happened */
|
||||
/**
|
||||
* Pause or resume playback for network streaming protocols - e.g. MMS.
|
||||
*/
|
||||
int (*read_pause)(void *opaque, int pause);
|
||||
/**
|
||||
* Seek to a given timestamp in stream with the specified stream_index.
|
||||
* Needed for some network streaming protocols which don't support seeking
|
||||
* to byte position.
|
||||
*/
|
||||
int64_t (*read_seek)(void *opaque, int stream_index,
|
||||
int64_t timestamp, int flags);
|
||||
/**
|
||||
* A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
|
||||
*/
|
||||
int seekable;
|
||||
} AVIOContext;
|
||||
|
||||
/* unbuffered I/O */
|
||||
|
||||
/**
|
||||
* Return AVIO_FLAG_* access flags corresponding to the access permissions
|
||||
* of the resource in url, or a negative value corresponding to an
|
||||
* AVERROR code in case of failure. The returned access flags are
|
||||
* masked by the value in flags.
|
||||
*
|
||||
* @note This function is intrinsically unsafe, in the sense that the
|
||||
* checked resource may change its existence or permission status from
|
||||
* one call to another. Thus you should not trust the returned value,
|
||||
* unless you are sure that no other processes are accessing the
|
||||
* checked resource.
|
||||
*/
|
||||
int avio_check(const char *url, int flags);
|
||||
|
||||
/**
|
||||
* Allocate and initialize an AVIOContext for buffered I/O. It must be later
|
||||
* freed with av_free().
|
||||
*
|
||||
* @param buffer Memory block for input/output operations via AVIOContext.
|
||||
* The buffer must be allocated with av_malloc() and friends.
|
||||
* @param buffer_size The buffer size is very important for performance.
|
||||
* For protocols with fixed blocksize it should be set to this blocksize.
|
||||
* For others a typical size is a cache page, e.g. 4kb.
|
||||
* @param write_flag Set to 1 if the buffer should be writable, 0 otherwise.
|
||||
* @param opaque An opaque pointer to user-specific data.
|
||||
* @param read_packet A function for refilling the buffer, may be NULL.
|
||||
* @param write_packet A function for writing the buffer contents, may be NULL.
|
||||
* @param seek A function for seeking to specified byte position, may be NULL.
|
||||
*
|
||||
* @return Allocated AVIOContext or NULL on failure.
|
||||
*/
|
||||
AVIOContext *avio_alloc_context(
|
||||
unsigned char *buffer,
|
||||
int buffer_size,
|
||||
int write_flag,
|
||||
void *opaque,
|
||||
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
|
||||
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
|
||||
int64_t (*seek)(void *opaque, int64_t offset, int whence));
|
||||
|
||||
void avio_w8(AVIOContext *s, int b);
|
||||
void avio_write(AVIOContext *s, const unsigned char *buf, int size);
|
||||
void avio_wl64(AVIOContext *s, uint64_t val);
|
||||
void avio_wb64(AVIOContext *s, uint64_t val);
|
||||
void avio_wl32(AVIOContext *s, unsigned int val);
|
||||
void avio_wb32(AVIOContext *s, unsigned int val);
|
||||
void avio_wl24(AVIOContext *s, unsigned int val);
|
||||
void avio_wb24(AVIOContext *s, unsigned int val);
|
||||
void avio_wl16(AVIOContext *s, unsigned int val);
|
||||
void avio_wb16(AVIOContext *s, unsigned int val);
|
||||
|
||||
/**
|
||||
* Write a NULL-terminated string.
|
||||
* @return number of bytes written.
|
||||
*/
|
||||
int avio_put_str(AVIOContext *s, const char *str);
|
||||
|
||||
/**
|
||||
* Convert an UTF-8 string to UTF-16LE and write it.
|
||||
* @return number of bytes written.
|
||||
*/
|
||||
int avio_put_str16le(AVIOContext *s, const char *str);
|
||||
|
||||
/**
|
||||
* Passing this as the "whence" parameter to a seek function causes it to
|
||||
* return the filesize without seeking anywhere. Supporting this is optional.
|
||||
* If it is not supported then the seek function will return <0.
|
||||
*/
|
||||
#define AVSEEK_SIZE 0x10000
|
||||
|
||||
/**
|
||||
* Oring this flag as into the "whence" parameter to a seek function causes it to
|
||||
* seek by any means (like reopening and linear reading) or other normally unreasonble
|
||||
* means that can be extreemly slow.
|
||||
* This may be ignored by the seek code.
|
||||
*/
|
||||
#define AVSEEK_FORCE 0x20000
|
||||
|
||||
/**
|
||||
* fseek() equivalent for AVIOContext.
|
||||
* @return new position or AVERROR.
|
||||
*/
|
||||
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence);
|
||||
|
||||
/**
|
||||
* Skip given number of bytes forward
|
||||
* @return new position or AVERROR.
|
||||
*/
|
||||
static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
|
||||
{
|
||||
return avio_seek(s, offset, SEEK_CUR);
|
||||
}
|
||||
|
||||
/**
|
||||
* ftell() equivalent for AVIOContext.
|
||||
* @return position or AVERROR.
|
||||
*/
|
||||
static av_always_inline int64_t avio_tell(AVIOContext *s)
|
||||
{
|
||||
return avio_seek(s, 0, SEEK_CUR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filesize.
|
||||
* @return filesize or AVERROR
|
||||
*/
|
||||
int64_t avio_size(AVIOContext *s);
|
||||
|
||||
/** @warning currently size is limited */
|
||||
int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3);
|
||||
|
||||
void avio_flush(AVIOContext *s);
|
||||
|
||||
|
||||
/**
|
||||
* Read size bytes from AVIOContext into buf.
|
||||
* @return number of bytes read or AVERROR
|
||||
*/
|
||||
int avio_read(AVIOContext *s, unsigned char *buf, int size);
|
||||
|
||||
/**
|
||||
* @name Functions for reading from AVIOContext
|
||||
* @{
|
||||
*
|
||||
* @note return 0 if EOF, so you cannot use it if EOF handling is
|
||||
* necessary
|
||||
*/
|
||||
int avio_r8 (AVIOContext *s);
|
||||
unsigned int avio_rl16(AVIOContext *s);
|
||||
unsigned int avio_rl24(AVIOContext *s);
|
||||
unsigned int avio_rl32(AVIOContext *s);
|
||||
uint64_t avio_rl64(AVIOContext *s);
|
||||
unsigned int avio_rb16(AVIOContext *s);
|
||||
unsigned int avio_rb24(AVIOContext *s);
|
||||
unsigned int avio_rb32(AVIOContext *s);
|
||||
uint64_t avio_rb64(AVIOContext *s);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Read a string from pb into buf. The reading will terminate when either
|
||||
* a NULL character was encountered, maxlen bytes have been read, or nothing
|
||||
* more can be read from pb. The result is guaranteed to be NULL-terminated, it
|
||||
* will be truncated if buf is too small.
|
||||
* Note that the string is not interpreted or validated in any way, it
|
||||
* might get truncated in the middle of a sequence for multi-byte encodings.
|
||||
*
|
||||
* @return number of bytes read (is always <= maxlen).
|
||||
* If reading ends on EOF or error, the return value will be one more than
|
||||
* bytes actually read.
|
||||
*/
|
||||
int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen);
|
||||
|
||||
/**
|
||||
* Read a UTF-16 string from pb and convert it to UTF-8.
|
||||
* The reading will terminate when either a null or invalid character was
|
||||
* encountered or maxlen bytes have been read.
|
||||
* @return number of bytes read (is always <= maxlen)
|
||||
*/
|
||||
int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen);
|
||||
int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen);
|
||||
|
||||
|
||||
/**
|
||||
* @name URL open modes
|
||||
* The flags argument to avio_open must be one of the following
|
||||
* constants, optionally ORed with other flags.
|
||||
* @{
|
||||
*/
|
||||
#define AVIO_FLAG_READ 1 /**< read-only */
|
||||
#define AVIO_FLAG_WRITE 2 /**< write-only */
|
||||
#define AVIO_FLAG_READ_WRITE (AVIO_FLAG_READ|AVIO_FLAG_WRITE) /**< read-write pseudo flag */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Use non-blocking mode.
|
||||
* If this flag is set, operations on the context will return
|
||||
* AVERROR(EAGAIN) if they can not be performed immediately.
|
||||
* If this flag is not set, operations on the context will never return
|
||||
* AVERROR(EAGAIN).
|
||||
* Note that this flag does not affect the opening/connecting of the
|
||||
* context. Connecting a protocol will always block if necessary (e.g. on
|
||||
* network protocols) but never hang (e.g. on busy devices).
|
||||
* Warning: non-blocking protocols is work-in-progress; this flag may be
|
||||
* silently ignored.
|
||||
*/
|
||||
#define AVIO_FLAG_NONBLOCK 8
|
||||
|
||||
/**
|
||||
* Create and initialize a AVIOContext for accessing the
|
||||
* resource indicated by url.
|
||||
* @note When the resource indicated by url has been opened in
|
||||
* read+write mode, the AVIOContext can be used only for writing.
|
||||
*
|
||||
* @param s Used to return the pointer to the created AVIOContext.
|
||||
* In case of failure the pointed to value is set to NULL.
|
||||
* @param url resource to access
|
||||
* @param flags flags which control how the resource indicated by url
|
||||
* is to be opened
|
||||
* @return 0 in case of success, a negative value corresponding to an
|
||||
* AVERROR code in case of failure
|
||||
*/
|
||||
int avio_open(AVIOContext **s, const char *url, int flags);
|
||||
|
||||
/**
|
||||
* Create and initialize a AVIOContext for accessing the
|
||||
* resource indicated by url.
|
||||
* @note When the resource indicated by url has been opened in
|
||||
* read+write mode, the AVIOContext can be used only for writing.
|
||||
*
|
||||
* @param s Used to return the pointer to the created AVIOContext.
|
||||
* In case of failure the pointed to value is set to NULL.
|
||||
* @param url resource to access
|
||||
* @param flags flags which control how the resource indicated by url
|
||||
* is to be opened
|
||||
* @param int_cb an interrupt callback to be used at the protocols level
|
||||
* @param options A dictionary filled with protocol-private options. On return
|
||||
* this parameter will be destroyed and replaced with a dict containing options
|
||||
* that were not found. May be NULL.
|
||||
* @return 0 in case of success, a negative value corresponding to an
|
||||
* AVERROR code in case of failure
|
||||
*/
|
||||
int avio_open2(AVIOContext **s, const char *url, int flags,
|
||||
const AVIOInterruptCB *int_cb, AVDictionary **options);
|
||||
|
||||
/**
|
||||
* Close the resource accessed by the AVIOContext s and free it.
|
||||
* This function can only be used if s was opened by avio_open().
|
||||
*
|
||||
* The internal buffer is automatically flushed before closing the
|
||||
* resource.
|
||||
*
|
||||
* @return 0 on success, an AVERROR < 0 on error.
|
||||
* @see avio_closep
|
||||
*/
|
||||
int avio_close(AVIOContext *s);
|
||||
|
||||
/**
|
||||
* Close the resource accessed by the AVIOContext *s, free it
|
||||
* and set the pointer pointing to it to NULL.
|
||||
* This function can only be used if s was opened by avio_open().
|
||||
*
|
||||
* The internal buffer is automatically flushed before closing the
|
||||
* resource.
|
||||
*
|
||||
* @return 0 on success, an AVERROR < 0 on error.
|
||||
* @see avio_close
|
||||
*/
|
||||
int avio_closep(AVIOContext **s);
|
||||
|
||||
|
||||
/**
|
||||
* Open a write only memory stream.
|
||||
*
|
||||
* @param s new IO context
|
||||
* @return zero if no error.
|
||||
*/
|
||||
int avio_open_dyn_buf(AVIOContext **s);
|
||||
|
||||
/**
|
||||
* Return the written size and a pointer to the buffer. The buffer
|
||||
* must be freed with av_free().
|
||||
* Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer.
|
||||
*
|
||||
* @param s IO context
|
||||
* @param pbuffer pointer to a byte buffer
|
||||
* @return the length of the byte buffer
|
||||
*/
|
||||
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
|
||||
|
||||
/**
|
||||
* Iterate through names of available protocols.
|
||||
*
|
||||
* @param opaque A private pointer representing current protocol.
|
||||
* It must be a pointer to NULL on first iteration and will
|
||||
* be updated by successive calls to avio_enum_protocols.
|
||||
* @param output If set to 1, iterate over output protocols,
|
||||
* otherwise over input protocols.
|
||||
*
|
||||
* @return A static string containing the name of current protocol or NULL
|
||||
*/
|
||||
const char *avio_enum_protocols(void **opaque, int output);
|
||||
|
||||
/**
|
||||
* Pause and resume playing - only meaningful if using a network streaming
|
||||
* protocol (e.g. MMS).
|
||||
*
|
||||
* @param h IO context from which to call the read_pause function pointer
|
||||
* @param pause 1 for pause, 0 for resume
|
||||
*/
|
||||
int avio_pause(AVIOContext *h, int pause);
|
||||
|
||||
/**
|
||||
* Seek to a given timestamp relative to some component stream.
|
||||
* Only meaningful if using a network streaming protocol (e.g. MMS.).
|
||||
*
|
||||
* @param h IO context from which to call the seek function pointers
|
||||
* @param stream_index The stream index that the timestamp is relative to.
|
||||
* If stream_index is (-1) the timestamp should be in AV_TIME_BASE
|
||||
* units from the beginning of the presentation.
|
||||
* If a stream_index >= 0 is used and the protocol does not support
|
||||
* seeking based on component streams, the call will fail with ENOTSUP.
|
||||
* @param timestamp timestamp in AVStream.time_base units
|
||||
* or if there is no stream specified then in AV_TIME_BASE units.
|
||||
* @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE
|
||||
* and AVSEEK_FLAG_ANY. The protocol may silently ignore
|
||||
* AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will
|
||||
* fail with ENOTSUP if used and not supported.
|
||||
* @return >= 0 on success
|
||||
* @see AVInputFormat::read_seek
|
||||
*/
|
||||
int64_t avio_seek_time(AVIOContext *h, int stream_index,
|
||||
int64_t timestamp, int flags);
|
||||
|
||||
#endif /* AVFORMAT_AVIO_H */
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче