mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-14 10:37:38 +01:00
Merge pull request #1285 from bnnm/builds
- update all DLLs - rename test.exe to vgmstream-cli.exe - fix various ffmpeg issues with latest dll - Add .binka extension (via FFmpeg) - various build tweaks - remove fake split .rxw (use .xwh+xwb) - remove fake split PS3 .baf (use proper .baf) - remove fake format .ccc (use .txth) - remove raw .tra (use .txth) - Add .snb extension [Def Jam Rapstar (X360)] - Fix Valve XWV .wav [Portal 2 (PS3), The Orange Box (X360)]
This commit is contained in:
commit
de3bd9fb31
4
.github/workflows/cmake-lx.yml
vendored
4
.github/workflows/cmake-lx.yml
vendored
@ -139,9 +139,9 @@ jobs:
|
||||
# TODO: Add vgmstream123 to the archive and upload the Audacious plugin when it is supported
|
||||
run: |
|
||||
cd cli
|
||||
tar cvfz vgmstream-cli.tar.gz vgmstream-cli
|
||||
tar cvfz vgmstream-linux-cli.tar.gz vgmstream-cli
|
||||
cd ..
|
||||
aws s3 cp cli/vgmstream-cli.tar.gz s3://vgmstream-builds/${{github.sha}}/linux/vgmstream-cli.tar.gz --acl public-read
|
||||
aws s3 cp cli/vgmstream-linux-cli.tar.gz s3://vgmstream-builds/${{github.sha}}/linux/vgmstream-linux-cli.tar.gz --acl public-read
|
||||
cd ${{runner.workspace}}
|
||||
echo ${{github.sha}} | tee latest_id_lx
|
||||
aws s3 cp latest_id_lx s3://vgmstream-builds/ --acl public-read
|
||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -30,10 +30,6 @@ Release
|
||||
/ext_libs/Release
|
||||
/ext_libs/*.exp
|
||||
/ext_libs/*.lib
|
||||
/ext_libs/libspeex/Debug
|
||||
/ext_libs/libspeex/Release
|
||||
/ext_libs/libspeex/*.exp
|
||||
/ext_libs/libspeex/*.lib
|
||||
/ext_libs/Getopt/Debug
|
||||
/ext_libs/Getopt/Release
|
||||
/fb2k/Debug
|
||||
|
@ -58,7 +58,6 @@ set_mpeg(ON FALSE)
|
||||
set_vorbis(ON FALSE)
|
||||
set_ffmpeg(ON FALSE)
|
||||
|
||||
option(USE_MAIATRAC3PLUS "Use MAIATRAC3+ for support of ATRAC3+" OFF)
|
||||
option(USE_G7221 "Use G7221 for support of ITU-T G.722.1 annex C" ON)
|
||||
option(USE_G719 "Use libg719_decode for support ITU-T G.719" ON)
|
||||
option(USE_ATRAC9 "Use LibAtrac9 for support of ATRAC9" ON)
|
||||
@ -68,7 +67,6 @@ if(NOT WIN32)
|
||||
option(USE_JANSSON "Use jansson for JSON dumping" ON)
|
||||
endif()
|
||||
|
||||
set(MAIATRAC3PLUS_PATH CACHE PATH "Path to MAIATRAC3+")
|
||||
if(NOT WIN32)
|
||||
set(MPEG_PATH CACHE PATH "Path to mpg123")
|
||||
set(OGG_PATH CACHE PATH "Path to Ogg")
|
||||
@ -156,7 +154,6 @@ include(dependencies/mpg123)
|
||||
include(dependencies/ogg)
|
||||
include(dependencies/vorbis)
|
||||
include(dependencies/libao)
|
||||
include(dependencies/maitrac3plus)
|
||||
include(dependencies/g719)
|
||||
include(dependencies/atrac9)
|
||||
include(dependencies/celt)
|
||||
@ -269,7 +266,6 @@ message(STATUS "=================")
|
||||
message(STATUS " MPEG: ${USE_MPEG} ${MPEG_SOURCE}")
|
||||
message(STATUS " Vorbis: ${USE_VORBIS} ${VORBIS_SOURCE}")
|
||||
message(STATUS " FFmpeg: ${USE_FFMPEG} ${FFMPEG_SOURCE}")
|
||||
message(STATUS " MAIATRAC3+: ${USE_MAIATRAC3PLUS} ${MAIATRAC3PLUS_SOURCE}")
|
||||
message(STATUS " G.722.1: ${USE_G7221} ${G7221_SOURCE}")
|
||||
message(STATUS " G.719: ${USE_G719} ${G719_SOURCE}")
|
||||
message(STATUS " ATRAC9: ${USE_ATRAC9} ${ATRAC9_SOURCE}")
|
||||
|
58
Makefile
58
Makefile
@ -10,9 +10,11 @@ else
|
||||
endif
|
||||
DEF_CFLAGS += -DVGMSTREAM_VERSION_AUTO -DVGM_LOG_OUTPUT
|
||||
|
||||
VGM_X64=0
|
||||
|
||||
###############################################################################
|
||||
### external defs
|
||||
# currently aimed to WIN32 builds but vgmstream_cli should work for others (or use autotools instead)
|
||||
# currently aimed to WIN32 builds but vgmstream-cli should work for others (or use autotools instead)
|
||||
export TARGET_OS = $(OS)
|
||||
|
||||
#for Win builds with vgmstream123
|
||||
@ -28,6 +30,13 @@ ifeq ($(TARGET_OS),Windows_NT)
|
||||
STRIP = strip
|
||||
WINDRES = windres
|
||||
DLLTOOL = dlltool
|
||||
|
||||
DLL_DIR = .
|
||||
export DLL_DIR
|
||||
ifneq ($(VGM_X64),0)
|
||||
DLLTOOL = dlltool -m i386:x86-64 --as-flags --64
|
||||
DLL_DIR = dll-x64
|
||||
endif
|
||||
|
||||
# same thing, the above should be available
|
||||
#CC = i686-w64-mingw32-gcc
|
||||
@ -85,6 +94,15 @@ LIBS_CFLAGS=
|
||||
LIBS_LDFLAGS=
|
||||
LIBS_TARGET_EXT_LIBS=
|
||||
|
||||
### bit stuff
|
||||
# TODO: some targets don't work with X64 (Winamp, etc), detect
|
||||
#ifneq ($(VGM_X86),0)
|
||||
# DEF_CFLAGS += -m32
|
||||
#endif
|
||||
ifneq ($(VGM_X64),0)
|
||||
DEF_CFLAGS += -m64
|
||||
endif
|
||||
|
||||
# config libs
|
||||
VGM_G7221 = 1
|
||||
ifneq ($(VGM_G7221),0)
|
||||
@ -101,56 +119,49 @@ ifeq ($(TARGET_OS),Windows_NT)
|
||||
ifneq ($(VGM_VORBIS),0)
|
||||
LIBS_CFLAGS += -DVGM_USE_VORBIS
|
||||
LIBS_LDFLAGS += -lvorbis
|
||||
LIBS_TARGET_EXT_LIBS += libvorbis.a
|
||||
LIBS_TARGET_EXT_LIBS += libvorbis.dll.a
|
||||
endif
|
||||
|
||||
VGM_MPEG = 1
|
||||
ifneq ($(VGM_MPEG),0)
|
||||
LIBS_CFLAGS += -DVGM_USE_MPEG
|
||||
LIBS_LDFLAGS += -lmpg123-0
|
||||
LIBS_TARGET_EXT_LIBS += libmpg123-0.a
|
||||
LIBS_TARGET_EXT_LIBS += libmpg123-0.dll.a
|
||||
endif
|
||||
|
||||
VGM_G719 = 1
|
||||
ifneq ($(VGM_G719),0)
|
||||
LIBS_CFLAGS += -DVGM_USE_G719
|
||||
LIBS_LDFLAGS += -lg719_decode
|
||||
LIBS_TARGET_EXT_LIBS += libg719_decode.a
|
||||
endif
|
||||
|
||||
VGM_MAT3P = 0
|
||||
ifneq ($(VGM_MAT3P),0)
|
||||
LIBS_CFLAGS += -DVGM_USE_MAIATRAC3PLUS
|
||||
LIBS_LDFLAGS += -lat3plusdecoder
|
||||
LIBS_TARGET_EXT_LIBS += libat3plusdecoder.a
|
||||
LIBS_TARGET_EXT_LIBS += libg719_decode.dll.a
|
||||
endif
|
||||
|
||||
VGM_FFMPEG = 1
|
||||
ifneq ($(VGM_FFMPEG),0)
|
||||
LIBS_CFLAGS += -DVGM_USE_FFMPEG -I../ext_includes/ffmpeg
|
||||
LIBS_LDFLAGS += -lavcodec -lavformat -lavutil -lswresample
|
||||
LIBS_TARGET_EXT_LIBS += libavcodec.a libavformat.a libavutil.a libswresample.a
|
||||
LIBS_LDFLAGS += -lavcodec-vgmstream-59 -lavformat-vgmstream-59 -lavutil-vgmstream-57 -lswresample-vgmstream-4
|
||||
LIBS_TARGET_EXT_LIBS += avcodec-vgmstream-59.dll.a avformat-vgmstream-59.dll.a avutil-vgmstream-57.dll.a swresample-vgmstream-4.dll.a
|
||||
endif
|
||||
|
||||
VGM_ATRAC9 = 1
|
||||
ifneq ($(VGM_ATRAC9),0)
|
||||
LIBS_CFLAGS += -DVGM_USE_ATRAC9
|
||||
LIBS_LDFLAGS += -latrac9
|
||||
LIBS_TARGET_EXT_LIBS += libatrac9.a
|
||||
LIBS_TARGET_EXT_LIBS += libatrac9.dll.a
|
||||
endif
|
||||
|
||||
VGM_CELT = 1
|
||||
ifneq ($(VGM_CELT),0)
|
||||
LIBS_CFLAGS += -DVGM_USE_CELT
|
||||
LIBS_LDFLAGS += -lcelt-0061 -lcelt-0110
|
||||
LIBS_TARGET_EXT_LIBS += libcelt-0061.a libcelt-0110.a
|
||||
LIBS_TARGET_EXT_LIBS += libcelt-0061.dll.a libcelt-0110.dll.a
|
||||
endif
|
||||
|
||||
VGM_SPEEX = 1
|
||||
ifneq ($(VGM_SPEEX),0)
|
||||
LIBS_CFLAGS += -DVGM_USE_SPEEX
|
||||
LIBS_LDFLAGS += -L../ext_libs/libspeex -lspeex
|
||||
LIBS_TARGET_EXT_LIBS += libspeex/libspeex.a
|
||||
LIBS_LDFLAGS += -lspeex-1
|
||||
LIBS_TARGET_EXT_LIBS += libspeex-1.dll.a
|
||||
endif
|
||||
|
||||
else
|
||||
@ -174,12 +185,6 @@ else
|
||||
LIBS_LDFLAGS += -lg719_decode
|
||||
endif
|
||||
|
||||
VGM_MAT3P = 0
|
||||
ifneq ($(VGM_MAT3P),0)
|
||||
LIBS_CFLAGS += -DVGM_USE_MAIATRAC3PLUS
|
||||
LIBS_LDFLAGS += -lat3plusdecoder
|
||||
endif
|
||||
|
||||
VGM_FFMPEG = 0
|
||||
ifneq ($(VGM_FFMPEG),0)
|
||||
LIBS_CFLAGS += -DVGM_USE_FFMPEG
|
||||
@ -225,11 +230,10 @@ ifeq ($(TARGET_OS),Windows_NT)
|
||||
ZIP_FILES = COPYING
|
||||
ZIP_FILES += README.md
|
||||
ZIP_FILES += doc/USAGE.md
|
||||
ZIP_FILES += cli/test.exe
|
||||
ZIP_FILES += cli/vgmstream-cli.exe
|
||||
ZIP_FILES += winamp/in_vgmstream.dll
|
||||
ZIP_FILES += xmplay/xmp-vgmstream.dll
|
||||
ZIP_FILES += ext_libs/*.dll
|
||||
ZIP_FILES += ext_libs/libspeex/*.dll
|
||||
ZIP_FILES_AO = cli/vgmstream123.exe
|
||||
ZIP_FILES_AO += $(LIBAO_DLL_PATH)/*.dll
|
||||
else
|
||||
@ -268,9 +272,9 @@ bin-ex: vgmstream-cli winamp xmplay vgmstream123
|
||||
mkdir -p bin
|
||||
zip -FS -j "bin/$(BIN_FILE)" $(ZIP_FILES) $(ZIP_FILES_AO)
|
||||
|
||||
vgmstream_cli: vgmstream-cli
|
||||
vgmstream-cli: vgmstream_cli
|
||||
|
||||
vgmstream-cli: version
|
||||
vgmstream_cli: version
|
||||
$(MAKE) -C cli vgmstream_cli
|
||||
|
||||
vgmstream123: version
|
||||
|
@ -28,7 +28,7 @@ More documentation: https://github.com/vgmstream/vgmstream/tree/master/doc
|
||||
|
||||
## Getting vgmstream
|
||||
There are multiple end-user components:
|
||||
- [test.exe/vgmstream-cli](doc/USAGE.md#testexevgmstream-cli-command-line-decoder): A command-line decoder.
|
||||
- [vgmstream-cli](doc/USAGE.md#testexevgmstream-cli-command-line-decoder): A command-line decoder.
|
||||
- [in_vgmstream](doc/USAGE.md#in_vgmstream-winamp-plugin): A Winamp plugin.
|
||||
- [foo_input_vgmstream](doc/USAGE.md#foo_input_vgmstream-foobar2000-plugin): A foobar2000 component.
|
||||
- [xmp-vgmstream](doc/USAGE.md#xmp-vgmstream-xmplay-plugin): An XMPlay plugin.
|
||||
@ -38,7 +38,7 @@ There are multiple end-user components:
|
||||
The main library (plain *vgmstream*) is the code that handles the internal conversion, while the
|
||||
above components are what you use to get sound.
|
||||
|
||||
If you just want to convert game audio to `.wav`, easiest would be getting *test.exe/vgmstream-cli* (see
|
||||
If you just want to convert game audio to `.wav`, easiest would be getting *vgmstream-cli* (see
|
||||
below) then drag-and-drop one or more files to the executable. This should create `(file.extension).wav`,
|
||||
if the format is supported. More usable would be installing a music player like *foobar2000* (for
|
||||
Windows) or *Audacious* (for Linux) then the appropriate component, so you can listen to VGM without
|
||||
|
@ -3,15 +3,9 @@
|
||||
add_executable(vgmstream_cli
|
||||
vgmstream_cli.c)
|
||||
|
||||
if(WIN32)
|
||||
set_target_properties(vgmstream_cli PROPERTIES
|
||||
PREFIX ""
|
||||
OUTPUT_NAME "test")
|
||||
else()
|
||||
set_target_properties(vgmstream_cli PROPERTIES
|
||||
PREFIX ""
|
||||
OUTPUT_NAME "vgmstream-cli")
|
||||
endif()
|
||||
set_target_properties(vgmstream_cli PROPERTIES
|
||||
PREFIX ""
|
||||
OUTPUT_NAME "vgmstream-cli")
|
||||
|
||||
# Link to the vgmstream library
|
||||
target_link_libraries(vgmstream_cli libvgmstream)
|
||||
|
@ -13,12 +13,11 @@ LDFLAGS += -L../src -lvgmstream -lm $(EXTRA_LDFLAGS)
|
||||
TARGET_EXT_LIBS =
|
||||
|
||||
ifeq ($(TARGET_OS),Windows_NT)
|
||||
OUTPUT_CLI = test.exe
|
||||
OUTPUT_CLI = vgmstream-cli.exe
|
||||
OUTPUT_123 = vgmstream123.exe
|
||||
|
||||
# -DUSE_ALLOCA
|
||||
CFLAGS += -DWIN32 -I../ext_includes -I../ext_libs/Getopt
|
||||
LDFLAGS += -L../ext_libs
|
||||
LDFLAGS += -L../ext_libs/$(DLL_DIR)
|
||||
|
||||
LIBAO_INC = -I$(LIBAO_IPATH)
|
||||
LIBAO_LIB = -L$(LIBAO_LPATH) -lao
|
||||
@ -58,6 +57,6 @@ $(TARGET_EXT_LIBS):
|
||||
$(MAKE) -C ../ext_libs $@
|
||||
|
||||
clean:
|
||||
$(RMF) $(OUTPUT_CLI)
|
||||
$(RMF) $(OUTPUT_CLI) $(OUTPUT_123)
|
||||
|
||||
.PHONY: clean vgmstream_cli libvgmstream.a $(TARGET_EXT_LIBS)
|
||||
|
@ -508,8 +508,8 @@ class App(object):
|
||||
if self.cfg.cli:
|
||||
clis.append(self.cfg.cli)
|
||||
else:
|
||||
clis.append('vgmstream_cli')
|
||||
clis.append('test.exe')
|
||||
clis.append('vgmstream-cli')
|
||||
clis.append('test.exe') #for old CLIs
|
||||
|
||||
for cli in clis:
|
||||
try:
|
||||
|
509
cli/tools/vrts.py
Normal file
509
cli/tools/vrts.py
Normal file
@ -0,0 +1,509 @@
|
||||
# VRTS - VGMSTREAM REGRESSION TESTING SCRIPT
|
||||
#
|
||||
# Searches for files in a directory (or optionally subdirs) and compares
|
||||
# the output of two CLI versions, both wav and stdout, for regression
|
||||
# testing. This creates and deletes temp files, trying to process all
|
||||
# extensions found unless specified (except a few).
|
||||
|
||||
# TODO reject some .wav but not all (detect created by v)
|
||||
# TODO capture stdout and enable fuzzy depending on codec
|
||||
# TODO fix -l option, add decode reset option
|
||||
import os, argparse, time, datetime, glob, subprocess, struct
|
||||
|
||||
|
||||
# don't try to decode common stuff
|
||||
IGNORED_EXTENSIONS = ['.exe', '.dll', '.zip', '.7z', '.rar', '.bat', '.sh', '.txt', '.lnk', '.wav', '.py', '.md', '.idb']
|
||||
#TODO others
|
||||
FUZZY_CODECS = ['ffmpeg', 'vorbis', 'mpeg', 'speex', 'celt']
|
||||
|
||||
DEFAULT_CLI_NEW = 'vgmstream-cli'
|
||||
DEFAULT_CLI_OLD = 'vgmstream-cli_old'
|
||||
|
||||
# result codes, where >= 0: ok (acceptable), <0: ko (not good)
|
||||
RESULT_SAME = 0 # no diffs
|
||||
RESULT_FUZZY = 1 # no duffs allowing +-N
|
||||
RESULT_NONE = 2 # neither exists
|
||||
RESULT_DIFFS = -3 # different
|
||||
RESULT_SIZES = -4 # different sizes
|
||||
RESULT_MISSING_NEW = -5 # new does not exist
|
||||
RESULT_MISSING_OLD = 6 # old does not exist
|
||||
|
||||
###############################################################################
|
||||
|
||||
def parse_args():
|
||||
description = (
|
||||
"Compares new vs old vgmstream CLI output, for regression testing"
|
||||
)
|
||||
epilog = (
|
||||
"examples:\n"
|
||||
"%(prog)s *.ogg -r -n\n"
|
||||
"- checks for differences in ogg of this and subfolders\n"
|
||||
"%(prog)s *.adx -nd\n"
|
||||
"- checks for differences in adx and doesn't delete wav output\n"
|
||||
"%(prog)s -p\n"
|
||||
"- compares performance performance of all files\n"
|
||||
)
|
||||
|
||||
ap = argparse.ArgumentParser(description=description, epilog=epilog, formatter_class=argparse.RawTextHelpFormatter)
|
||||
ap.add_argument("files", help="files to match", nargs='*', default=["*.*"])
|
||||
ap.add_argument("-r","--recursive", help="search files in subfolders", action='store_true')
|
||||
ap.add_argument("-z","--fuzzy", help="fuzzy threshold of +-N PCM16LE", type=int, default=1)
|
||||
ap.add_argument("-nd","--no-delete", help="don't delete output", action='store_true')
|
||||
ap.add_argument("-rd","--result-diffs", help="only report full diffs", action='store_true')
|
||||
ap.add_argument("-rz","--result-fuzzy", help="only report full and fuzzy diffs", action='store_true')
|
||||
ap.add_argument("-p","--performance-both", help="compare decode performance", action='store_true')
|
||||
ap.add_argument("-pn","--performance-new", help="test performance of new CLI", action='store_true')
|
||||
ap.add_argument("-po","--performance-old", help="test performance of old CLI", action='store_true')
|
||||
ap.add_argument("-pw","--performance-write", help="compare decode+write performance", action='store_true')
|
||||
ap.add_argument("-pr","--performance-repeat", help="repeat decoding files N times\n(more files makes easier to see performance changes)", type=int, default=0)
|
||||
ap.add_argument("-l","--looping", help="compare looping files (slower)", action='store_true')
|
||||
ap.add_argument("-cn","--cli-new", help="sets name of new CLI (can be a path)")
|
||||
ap.add_argument("-co","--cli-old", help="sets name of old CLI (can be a path)")
|
||||
|
||||
args = ap.parse_args()
|
||||
|
||||
# derived defaults to simplify
|
||||
args.performance = args.performance_both or args.performance_new or args.performance_old or args.performance_write
|
||||
args.compare = not args.performance
|
||||
if args.performance_both:
|
||||
args.performance_new = True
|
||||
args.performance_old = True
|
||||
|
||||
return args
|
||||
|
||||
###############################################################################
|
||||
|
||||
S16_UNPACK = struct.Struct('<h').unpack_from
|
||||
|
||||
# Compares 2 files and returns if contents are the same.
|
||||
# If fuzzy is set detects +- PCM changes (slower).
|
||||
class VrtsComparator:
|
||||
CHUNK_HEADER = 0x50
|
||||
CHUNK_SIZE = 0x00100000
|
||||
|
||||
def __init__(self, path1, path2, fuzzy_max=0):
|
||||
self._path1 = path1
|
||||
self._path2 = path2
|
||||
self._fuzzy_max = fuzzy_max
|
||||
self._offset = 0
|
||||
self.fuzzy_count = 0
|
||||
self.fuzzy_diff = 0
|
||||
self.fuzzy_offset = 0
|
||||
|
||||
def _compare_fuzzy(self, b1, b2):
|
||||
len1 = len(b1)
|
||||
len2 = len(b2)
|
||||
if len1 != len2:
|
||||
return RESULT_SAME
|
||||
|
||||
# compares PCM16LE bytes allowing +-N diffs between PCM bytes
|
||||
# useful when comparing output from floats, that can change slightly due to compiler optimizations
|
||||
max = self._fuzzy_max
|
||||
pos = 0
|
||||
while pos < len1:
|
||||
# slower than struct unpack
|
||||
#pcm1 = b1[pos+0] | (b1[pos+1] << 8)
|
||||
#if pcm1 & 0x8000:
|
||||
# pcm1 -= 0x10000
|
||||
#pcm2 = b2[pos+0] | (b2[pos+1] << 8)
|
||||
#if pcm2 & 0x8000:
|
||||
# pcm2 -= 0x10000
|
||||
|
||||
pcm1, = S16_UNPACK(b1, pos)
|
||||
pcm2, = S16_UNPACK(b2, pos)
|
||||
|
||||
if not (pcm1 >= pcm2 - max and pcm1 <= pcm2 + max):
|
||||
#print("%i vs %i +- %i at %x" % (pcm1, pcm2, max, self._offset + pos))
|
||||
self.fuzzy_diff = pcm1 - pcm2
|
||||
self.fuzzy_offset = self._offset + pos
|
||||
return RESULT_DIFFS
|
||||
|
||||
pos += 2
|
||||
|
||||
self.fuzzy_count = 1
|
||||
return 0
|
||||
|
||||
def _compare_bytes(self, b1, b2):
|
||||
# even though python is much slower than C this test is reasonably fast
|
||||
if b1 == b2:
|
||||
return RESULT_SAME
|
||||
|
||||
# different: fuzzy check if same
|
||||
if self._fuzzy_max:
|
||||
return self._compare_fuzzy(b1, b2)
|
||||
|
||||
return RESULT_DIFFS
|
||||
|
||||
def _compare_files(self, f1, f2):
|
||||
|
||||
# header not part of fuzzyness (no need to get exact with sizes)
|
||||
if self._fuzzy_max:
|
||||
b1 = f1.read(self.CHUNK_HEADER)
|
||||
b2 = f2.read(self.CHUNK_HEADER)
|
||||
cmp = self._compare_bytes(b1, b2)
|
||||
if cmp < 0:
|
||||
return cmp
|
||||
self._offset += self.CHUNK_HEADER
|
||||
|
||||
while True:
|
||||
b1 = f1.read(self.CHUNK_SIZE)
|
||||
b2 = f2.read(self.CHUNK_SIZE)
|
||||
if not b1 or not b2:
|
||||
break
|
||||
|
||||
cmp = self._compare_bytes(b1, b2)
|
||||
if cmp < 0:
|
||||
return cmp
|
||||
self._offset += self.CHUNK_SIZE
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
def compare(self):
|
||||
try:
|
||||
f1_len = os.path.getsize(self._path1)
|
||||
except FileNotFoundError:
|
||||
f1_len = -1
|
||||
try:
|
||||
f2_len = os.path.getsize(self._path2)
|
||||
except FileNotFoundError:
|
||||
f2_len = -1
|
||||
|
||||
if f1_len < 0 and f2_len < 0:
|
||||
return RESULT_NONE
|
||||
|
||||
if f1_len < 0:
|
||||
return RESULT_MISSING_NEW
|
||||
if f2_len < 0:
|
||||
return RESULT_MISSING_OLD
|
||||
|
||||
if f1_len != f2_len:
|
||||
return RESULT_SIZES
|
||||
|
||||
with open(self._path1, 'rb') as f1, open(self._path2, 'rb') as f2:
|
||||
cmp = self._compare_files(f1, f2)
|
||||
if cmp < 0:
|
||||
return cmp
|
||||
|
||||
if self.fuzzy_count > 0:
|
||||
return RESULT_FUZZY
|
||||
return RESULT_SAME
|
||||
|
||||
|
||||
###############################################################################
|
||||
|
||||
# prints colored text in CLI
|
||||
# https://pkg.go.dev/github.com/whitedevops/colors
|
||||
# https://stackoverflow.com/questions/287871/
|
||||
class VrtsPrinter:
|
||||
RESET = '\033[0m'
|
||||
BOLD = '\033[1m'
|
||||
|
||||
LIGHT_RED = '\033[91m'
|
||||
LIGHT_GREEN = '\033[92m'
|
||||
LIGHT_YELLOW = '\033[93m'
|
||||
LIGHT_BLUE = '\033[94m'
|
||||
LIGHT_CYAN = '\033[96m'
|
||||
WHITE = '\033[97m'
|
||||
LIGHT_GRAY = "\033[37m"
|
||||
DARK_GRAY = "\033[90m"
|
||||
|
||||
COLOR_RESULT = {
|
||||
RESULT_SAME: WHITE,
|
||||
RESULT_FUZZY: LIGHT_CYAN,
|
||||
RESULT_NONE: LIGHT_YELLOW,
|
||||
RESULT_DIFFS: LIGHT_RED,
|
||||
RESULT_SIZES: LIGHT_RED,
|
||||
RESULT_MISSING_NEW: LIGHT_RED,
|
||||
RESULT_MISSING_OLD: LIGHT_YELLOW,
|
||||
}
|
||||
TEXT_RESULT = {
|
||||
RESULT_SAME: 'same',
|
||||
RESULT_FUZZY: 'fuzzy same',
|
||||
RESULT_NONE: 'neither works',
|
||||
RESULT_DIFFS: 'diffs',
|
||||
RESULT_SIZES: 'wrong sizes',
|
||||
RESULT_MISSING_NEW: 'missing new',
|
||||
RESULT_MISSING_OLD: 'missing old',
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
try:
|
||||
os.system('color') #win only?
|
||||
except:
|
||||
pass
|
||||
|
||||
def _print(self, msg, color=None):
|
||||
if color:
|
||||
print("%s%s%s" % (color, msg, self.RESET))
|
||||
else:
|
||||
print(msg)
|
||||
|
||||
|
||||
def result(self, msg, code, fuzzy_diff, fuzzy_offset):
|
||||
text = self.TEXT_RESULT.get(code)
|
||||
color = self.COLOR_RESULT.get(code)
|
||||
if not text:
|
||||
text = code
|
||||
msg = "%s: %s" % (msg, text)
|
||||
if fuzzy_diff != 0:
|
||||
msg += " (%s @0x%x)" % (fuzzy_diff, fuzzy_offset)
|
||||
self._print(msg, color)
|
||||
|
||||
|
||||
def info(self, msg):
|
||||
msg = "%s (%s)" % (msg, self._get_date())
|
||||
self._print(msg, self.DARK_GRAY)
|
||||
pass
|
||||
|
||||
def _get_date(self):
|
||||
return datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
###############################################################################
|
||||
|
||||
class VrtsFiles:
|
||||
def __init__(self, args):
|
||||
self._args = args
|
||||
self.filenames = []
|
||||
|
||||
def prepare(self):
|
||||
for fpattern in self._args.files:
|
||||
|
||||
recursive = self._args.recursive
|
||||
if recursive:
|
||||
fpattern = '**/' + fpattern
|
||||
|
||||
files = glob.glob(fpattern, recursive=recursive)
|
||||
for file in files:
|
||||
if not os.path.isfile(file):
|
||||
continue
|
||||
|
||||
# ignores non useful files
|
||||
_, ext = os.path.splitext(file)
|
||||
if ext.lower() in IGNORED_EXTENSIONS:
|
||||
continue
|
||||
|
||||
self.filenames.append(file)
|
||||
|
||||
# same file N times
|
||||
if self._args.performance and self._args.performance_repeat:
|
||||
for i in range(self._args.performance_repeat):
|
||||
self.filenames.append(file)
|
||||
|
||||
|
||||
# calling subprocess with python:
|
||||
# - os.system(command)
|
||||
# - not recommended by docs (less flexible and spawns a new process?)
|
||||
# - subprocess.call
|
||||
# - wait till complete and returns code
|
||||
# - subprocess.check_call
|
||||
# - wait till complete and raise CalledProcessError on nonzero return code
|
||||
# - subprocess.check_output
|
||||
# - call without wait, raise CalledProcessError on nonzero return code
|
||||
# - subprocess.run
|
||||
# - recommended but python 3.5+
|
||||
# (check=True: raise exceptions like check_*, capture_output: return STDOUT/STDERR)
|
||||
class VrtsProcess:
|
||||
|
||||
def call(self, args, stdout=False):
|
||||
try:
|
||||
#with open(os.devnull, 'wb') as DEVNULL: #python2
|
||||
# res = subprocess.check_call(args, stdout=DEVNULL, stderr=DEVNULL)
|
||||
|
||||
res = subprocess.run(args, check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) #capture_output=stdout,
|
||||
#print("result:", res.returncode)
|
||||
#print("result:", res.strout, res.strerr)
|
||||
|
||||
if stdout:
|
||||
return res.stdout
|
||||
|
||||
return True #exists and returns ok
|
||||
|
||||
except subprocess.CalledProcessError as e:
|
||||
#print("call error: ", e) #, e.stderr: disable DEVNULL
|
||||
return False #non-zero, exists but returns strerr (ex. ran with no args)
|
||||
|
||||
except FileNotFoundError as e:
|
||||
#print("file error: ", e)
|
||||
return None #doesn't exists/etc
|
||||
|
||||
|
||||
class VrtsApp:
|
||||
|
||||
def __init__(self, args):
|
||||
self._args = args
|
||||
self._files = VrtsFiles(args)
|
||||
self._prc = VrtsProcess()
|
||||
self._p = VrtsPrinter()
|
||||
self._cli_new = None
|
||||
self._cli_old = None
|
||||
|
||||
def _find_cli(self, arg_cli, default_cli):
|
||||
|
||||
if arg_cli and os.path.isdir(arg_cli):
|
||||
cli = os.path.join(arg_cli, default_cli)
|
||||
|
||||
elif arg_cli: #is file
|
||||
cli = arg_cli
|
||||
|
||||
else:
|
||||
cli = default_cli
|
||||
|
||||
args = [cli] #plain call to see if program is in PATH
|
||||
res = self._prc.call(args)
|
||||
if res is not None:
|
||||
return cli
|
||||
|
||||
return None
|
||||
|
||||
# detects CLI location:
|
||||
# - defaults to (cli) [new] + (cli)_old [old] assumed to be in PATH
|
||||
# - can be passed a dir or file for old/new
|
||||
# - old is optional in performance mode
|
||||
def _detect_cli(self):
|
||||
cli = self._find_cli(self._args.cli_new, DEFAULT_CLI_NEW)
|
||||
if cli:
|
||||
self._cli_new = cli
|
||||
|
||||
cli = self._find_cli(self._args.cli_old, DEFAULT_CLI_OLD)
|
||||
if cli:
|
||||
self._cli_old = cli
|
||||
|
||||
if not self._cli_new and (self._args.compare or self._args.performance_new):
|
||||
raise ValueError("new CLI not found")
|
||||
if not self._cli_old and (self._args.compare or self._args.performance_old):
|
||||
raise ValueError("old CLI not found")
|
||||
|
||||
def _get_performance_args(self, cli):
|
||||
args = [cli, '-O'] #flag to not write files
|
||||
if self._args.looping:
|
||||
args.append('-i')
|
||||
args.extend(self._files.filenames)
|
||||
return args
|
||||
|
||||
def _performance(self):
|
||||
flag_looping = ''
|
||||
if self._args.looping:
|
||||
flag_looping = '-i'
|
||||
|
||||
# pases all files at once, as it's faster than 1 by 1 (that has to init program every time)
|
||||
if self._performance_new:
|
||||
self._p.info("testing new performance")
|
||||
ts_st = time.time()
|
||||
|
||||
args = self._get_performance_args(self._cli_new)
|
||||
res = self._prc.call(args)
|
||||
|
||||
ts_ed = time.time()
|
||||
self._p.info("done: elapsed %ss" % (ts_ed - ts_st))
|
||||
|
||||
if self._performance_old:
|
||||
self._p.info("testing old performance")
|
||||
ts_st = time.time()
|
||||
|
||||
args = self._get_performance_args(self._cli_old)
|
||||
res = self._prc.call(args)
|
||||
|
||||
ts_ed = time.time()
|
||||
self._p.info("done: elapsed %ss (%s)" % (ts_ed - ts_st))
|
||||
|
||||
#if self._performance_both:
|
||||
# ...
|
||||
|
||||
|
||||
# returns max fuzzy count, except for non-fuzzable files (that use int math)
|
||||
def _get_fuzzy_count(self, stdout):
|
||||
fuzzy = self._args.fuzzy
|
||||
if self._args.fuzzy <= 0:
|
||||
return 0
|
||||
|
||||
if not stdout:
|
||||
return fuzzy
|
||||
|
||||
try:
|
||||
pos = stdout.index(b'encoding:')
|
||||
codec_line = stdout[0:].split('\n', 1)[0]
|
||||
for fuzzy_codec in FUZZY_CODECS:
|
||||
if fuzzy_codec in codec_line:
|
||||
return fuzzy
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
return 0 #non-fuzable
|
||||
|
||||
def _get_compare_args(self, cli, outwav, filename):
|
||||
args = [cli, '-o', outwav] #flag to not write files
|
||||
if self._args.looping:
|
||||
args.append('-i')
|
||||
args.append(filename)
|
||||
return args
|
||||
|
||||
def _compare(self):
|
||||
ts_st = time.time()
|
||||
self._p.info("comparing files")
|
||||
|
||||
flag_looping = ''
|
||||
if self._args.looping:
|
||||
flag_looping = '-i'
|
||||
|
||||
total_ok = 0
|
||||
total_ko = 0
|
||||
for filename in self._files.filenames:
|
||||
filename_newwav = filename + ".new.wav"
|
||||
filename_oldwav = filename + ".old.wav"
|
||||
|
||||
# main decode (ignores errors, comparator already checks them)
|
||||
args = self._get_compare_args(self._cli_new, filename_newwav, filename)
|
||||
stdout = self._prc.call(args, stdout=True)
|
||||
|
||||
args = self._get_compare_args(self._cli_old, filename_oldwav, filename)
|
||||
self._prc.call(args, stdout=False)
|
||||
|
||||
# test results
|
||||
fuzzy = self._get_fuzzy_count(stdout)
|
||||
cmp = VrtsComparator(filename_newwav, filename_oldwav, fuzzy)
|
||||
code = cmp.compare()
|
||||
|
||||
self._p.result(filename, code, cmp.fuzzy_diff, cmp.fuzzy_offset)
|
||||
|
||||
if code < 0:
|
||||
total_ko += 1
|
||||
else:
|
||||
total_ok += 1
|
||||
|
||||
# post cleanup
|
||||
if not self._args.no_delete:
|
||||
try:
|
||||
os.remove(filename_newwav)
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
os.remove(filename_oldwav)
|
||||
except:
|
||||
pass
|
||||
|
||||
ts_ed = time.time()
|
||||
self._p.info("done: ok=%s, ko=%s, elapsed %ss" % (total_ok, total_ko, ts_ed - ts_st))
|
||||
|
||||
|
||||
def start(self):
|
||||
self._detect_cli()
|
||||
self._files.prepare()
|
||||
if self._args.performance:
|
||||
self._performance()
|
||||
else:
|
||||
self._compare()
|
||||
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
if not args:
|
||||
return
|
||||
|
||||
try:
|
||||
VrtsApp(args).start()
|
||||
except ValueError as e:
|
||||
print(e)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
@ -9,24 +9,12 @@
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Template|Win32">
|
||||
<Configuration>Template</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{AF7D88A0-3CB1-4CD8-BAD1-0305EB996D69}</ProjectGuid>
|
||||
<RootNamespace>test</RootNamespace>
|
||||
<RootNamespace>vgmstream-cli</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<SccProjectName>
|
||||
</SccProjectName>
|
||||
<SccAuxPath>
|
||||
</SccAuxPath>
|
||||
<SccLocalPath>
|
||||
</SccLocalPath>
|
||||
<SccProvider>
|
||||
</SccProvider>
|
||||
<TargetName>test</TargetName>
|
||||
<TargetName>vgmstream-cli</TargetName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
@ -40,9 +28,6 @@
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
@ -63,9 +48,6 @@
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Template|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Template|Win32'" />
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
@ -80,7 +62,7 @@
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>../ext_libs/libvorbis.lib;../ext_libs/libmpg123-0.lib;../ext_libs/libg719_decode.lib;../ext_libs/avcodec.lib;../ext_libs/avformat.lib;../ext_libs/avutil.lib;../ext_libs/swresample.lib;../ext_libs/libatrac9.lib;../ext_libs/libcelt-0061.lib;../ext_libs/libcelt-0110.lib;../ext_libs/jansson.lib;../ext_libs/libspeex/libspeex.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>../ext_libs/libvorbis.lib;../ext_libs/libmpg123-0.lib;../ext_libs/libg719_decode.lib;../ext_libs/avcodec.lib;../ext_libs/avformat.lib;../ext_libs/avutil.lib;../ext_libs/swresample.lib;../ext_libs/libatrac9.lib;../ext_libs/libcelt-0061.lib;../ext_libs/libcelt-0110.lib;../ext_libs/jansson.lib;../ext_libs/libspeex-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
@ -104,7 +86,7 @@
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>../ext_libs/libvorbis.lib;../ext_libs/libmpg123-0.lib;../ext_libs/libg719_decode.lib;../ext_libs/avcodec.lib;../ext_libs/avformat.lib;../ext_libs/avutil.lib;../ext_libs/swresample.lib;../ext_libs/libatrac9.lib;../ext_libs/libcelt-0061.lib;../ext_libs/libcelt-0110.lib;../ext_libs/jansson.lib;../ext_libs/libspeex/libspeex.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>../ext_libs/libvorbis.lib;../ext_libs/libmpg123-0.lib;../ext_libs/libg719_decode.lib;../ext_libs/avcodec.lib;../ext_libs/avformat.lib;../ext_libs/avutil.lib;../ext_libs/swresample.lib;../ext_libs/libatrac9.lib;../ext_libs/libcelt-0061.lib;../ext_libs/libcelt-0110.lib;../ext_libs/jansson.lib;../ext_libs/libspeex-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
|
285
cli/vrts.bat
285
cli/vrts.bat
@ -1,285 +0,0 @@
|
||||
@echo off
|
||||
chcp 65001
|
||||
REM #-------------------------------------------------------------------------
|
||||
REM # VGMSTREAM REGRESSION TESTING SCRIPT
|
||||
REM #
|
||||
REM # Searches for files in a directory (or optionally subdirs) and compares
|
||||
REM # the output of two test.exe versions, both wav and stdout, for regression
|
||||
REM # testing. This creates and deletes temp files, trying to process all
|
||||
REM # extensions found unless specified (except a few).
|
||||
REM #
|
||||
REM # Options: see below.
|
||||
REM #-------------------------------------------------------------------------
|
||||
|
||||
|
||||
REM #-------------------------------------------------------------------------
|
||||
REM #options
|
||||
REM #-------------------------------------------------------------------------
|
||||
REM # -vo <exe> -vn <exe>: path to old/new exe
|
||||
set OP_CMD_OLD=test_old.exe
|
||||
set OP_CMD_NEW=test.exe
|
||||
REM # -f <filename>: search wildcard (ex. -f "*.adx")
|
||||
set OP_SEARCH="*.*"
|
||||
REM # -r: recursive subfolders
|
||||
set OP_RECURSIVE=
|
||||
REM # -nd: don't delete compared files
|
||||
set OP_NODELETE=
|
||||
REM # -nc: don't report correct files
|
||||
set OP_NOCORRECT=
|
||||
REM # -p: performance test new (decode with new exe and no comparison done)
|
||||
REM # -P: performance test new (same but also don't write file)
|
||||
REM # -po: performance test old (decode with new old and no comparison done)
|
||||
REM # -Po: performance test old (same but also don't write file)
|
||||
REM # -Pm: performance test new (only parse meta)
|
||||
REM # -Pmo: performance test old (only parse meta)
|
||||
set OP_PERFORMANCE=
|
||||
REM # -fc <exe>: file comparer
|
||||
REM # Windows's FC is slow, try -fc ffc.exe (https://github.com/bnnm/vgm-tools/tree/master/misc/ffc)
|
||||
set OP_CMD_FC=fc /a /b
|
||||
|
||||
|
||||
REM # parse options
|
||||
:set_options
|
||||
if "%~1"=="" goto end_options
|
||||
if "%~1"=="-vo" set OP_CMD_OLD=%2
|
||||
if "%~1"=="-vn" set OP_CMD_NEW=%2
|
||||
if "%~1"=="-f" set OP_SEARCH=%2
|
||||
if "%~1"=="-r" set OP_RECURSIVE=/s
|
||||
if "%~1"=="-nd" set OP_NODELETE=true
|
||||
if "%~1"=="-nc" set OP_NOCORRECT=true
|
||||
if "%~1"=="-p" set OP_PERFORMANCE=1
|
||||
if "%~1"=="-P" set OP_PERFORMANCE=2
|
||||
if "%~1"=="-po" set OP_PERFORMANCE=3
|
||||
if "%~1"=="-Po" set OP_PERFORMANCE=4
|
||||
if "%~1"=="-Pm" set OP_PERFORMANCE=5
|
||||
if "%~1"=="-Pmo" set OP_PERFORMANCE=6
|
||||
if "%~1"=="-fc" set OP_CMD_FC=%2
|
||||
shift
|
||||
goto set_options
|
||||
:end_options
|
||||
|
||||
REM # output color defs
|
||||
set COLOR_WN=0e
|
||||
set COLOR_ER=0c
|
||||
set COLOR_OK=0f
|
||||
|
||||
REM # remove command options and possibly "
|
||||
for /f "tokens=1-1 delims= " %%A in ("%OP_CMD_OLD%") do set CHECK_OLD=%%A
|
||||
for /f "tokens=1-1 delims= " %%A in ("%OP_CMD_NEW%") do set CHECK_NEW=%%A
|
||||
set CHECK_OLD=%CHECK_OLD:"=%
|
||||
set CHECK_NEW=%CHECK_NEW:"=%
|
||||
|
||||
REM # check exe
|
||||
set CMD_CHECK=where "%CHECK_OLD%" "%CHECK_NEW%"
|
||||
%CMD_CHECK% > nul
|
||||
if %ERRORLEVEL% NEQ 0 (
|
||||
echo Old/new exe not found
|
||||
goto error
|
||||
)
|
||||
|
||||
if %OP_SEARCH%=="" (
|
||||
echo Search wildcard not specified
|
||||
goto error
|
||||
)
|
||||
|
||||
REM # process start
|
||||
set TIME_START=%time%
|
||||
set FILES_OK=0
|
||||
set FILES_KO=0
|
||||
echo VRTS: start @%TIME_START%
|
||||
|
||||
REM # search for files
|
||||
set CMD_DIR=dir /a:-d /b %OP_RECURSIVE% %OP_SEARCH%
|
||||
set CMD_FIND=findstr /i /v "\.exe$ \.dll$ \.zip$ \.7z$ \.rar$ \.bat$ \.sh$ \.txt$ \.lnk$ \.wav$"
|
||||
|
||||
REM # process files
|
||||
for /f "delims=" %%x in ('%CMD_DIR% ^| %CMD_FIND%') do (
|
||||
set CMD_FILE=%%x
|
||||
|
||||
REM # must enable/disable after setting CMD as ! & in dir names would become expanded/removed otherwise
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
if "%OP_PERFORMANCE%" == "" (
|
||||
call :process_file "!CMD_FILE!"
|
||||
) else (
|
||||
call :performance_file "!CMD_FILE!"
|
||||
)
|
||||
|
||||
REM this doesn't seem to properly disable it and will error out after N files
|
||||
REM but using endlocal will remove vars and counters won't work
|
||||
REM setlocal DisableDelayedExpansion
|
||||
endlocal
|
||||
)
|
||||
|
||||
REM # find time elapsed
|
||||
set TIME_END=%time%
|
||||
for /F "tokens=1-4 delims=:.," %%a in ("%TIME_START%") do (
|
||||
set /A "TIME_START_S=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
|
||||
)
|
||||
for /F "tokens=1-4 delims=:.," %%a in ("%TIME_END%") do (
|
||||
set /A "TIME_END_S=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
|
||||
)
|
||||
set /A TIME_ELAPSED_S=(TIME_END_S-TIME_START_S)/100
|
||||
set /A TIME_ELAPSED_C=(TIME_END_S-TIME_START_S)%%100
|
||||
|
||||
|
||||
REM # process end (ok)
|
||||
echo VRTS: done @%TIME_END% (%TIME_ELAPSED_S%,%TIME_ELAPSED_C%s)
|
||||
echo VRTS: ok=%FILES_OK%, ko=%FILES_KO%
|
||||
|
||||
goto exit
|
||||
|
||||
|
||||
REM # ########################################################################
|
||||
REM # test a single file
|
||||
REM # ########################################################################
|
||||
:process_file outer
|
||||
REM # ignore files starting with dot (no filename)
|
||||
set CMD_SHORTNAME=%~n1
|
||||
if "%CMD_SHORTNAME%" == "" goto process_file_continue
|
||||
|
||||
|
||||
REM # get file (not from arg %1)
|
||||
set CMD_FILE=!CMD_FILE!
|
||||
set CMD_FILE=!CMD_FILE:"=!
|
||||
REM echo VTRS: file !CMD_FILE!
|
||||
|
||||
REM # old/new temp output
|
||||
set WAV_OLD=!CMD_FILE!.old.wav
|
||||
set TXT_OLD=!CMD_FILE!.old.txt
|
||||
set CMD_VGM_OLD="%OP_CMD_OLD%" -o "!WAV_OLD!" "!CMD_FILE!"
|
||||
!CMD_VGM_OLD! 1> "!TXT_OLD!" 2>&1 & REM || goto error
|
||||
|
||||
set WAV_NEW=!CMD_FILE!.new.wav
|
||||
set TXT_NEW=!CMD_FILE!.new.txt
|
||||
set CMD_VGM_NEW="%OP_CMD_NEW%" -o "!WAV_NEW!" "!CMD_FILE!"
|
||||
!CMD_VGM_NEW! 1> "!TXT_NEW!" 2>&1 & REM || goto error
|
||||
|
||||
REM # ignore if no files are created (unsupported formats)
|
||||
if not exist "!WAV_NEW!" (
|
||||
if not exist "!WAV_OLD!" (
|
||||
REM echo VRTS: nothing created for file !CMD_FILE!
|
||||
if exist "!TXT_NEW!" del /a:a "!TXT_NEW!"
|
||||
if exist "!TXT_OLD!" del /a:a "!TXT_OLD!"
|
||||
goto process_file_continue
|
||||
)
|
||||
)
|
||||
|
||||
REM # compare files (without /b may to be faster for small files?)
|
||||
set CMP_WAV=%OP_CMD_FC% "!WAV_OLD!" "!WAV_NEW!"
|
||||
set CMP_TXT=%OP_CMD_FC% "!TXT_OLD!" "!TXT_NEW!"
|
||||
|
||||
!CMP_WAV! 1> nul 2>&1
|
||||
set CMP_WAV_ERROR=0
|
||||
if %ERRORLEVEL% NEQ 0 set CMP_WAV_ERROR=1
|
||||
|
||||
!CMP_TXT! 1> nul 2>&1
|
||||
set CMP_TXT_ERROR=0
|
||||
if %ERRORLEVEL% NEQ 0 set CMP_TXT_ERROR=1
|
||||
|
||||
REM # print output
|
||||
if %CMP_WAV_ERROR% EQU 1 (
|
||||
if %CMP_TXT_ERROR% EQU 1 (
|
||||
call :echo_color %COLOR_ER% "!CMD_FILE!" "wav and txt diffs"
|
||||
) else (
|
||||
call :echo_color %COLOR_ER% "!CMD_FILE!" "wav diffs"
|
||||
)
|
||||
set /a FILES_KO=FILES_KO + 1
|
||||
) else (
|
||||
if %CMP_TXT_ERROR% EQU 1 (
|
||||
call :echo_color %COLOR_WN% "!CMD_FILE!" "txt diffs"
|
||||
) else (
|
||||
if "%OP_NOCORRECT%" == "" (
|
||||
call :echo_color %COLOR_OK% "!CMD_FILE!" "no diffs"
|
||||
)
|
||||
)
|
||||
|
||||
set /a FILES_OK=FILES_OK + 1
|
||||
)
|
||||
|
||||
REM # delete temp files
|
||||
if "%OP_NODELETE%" == "" (
|
||||
if exist "!WAV_OLD!" del /a:a "!WAV_OLD!"
|
||||
if exist "!TXT_OLD!" del /a:a "!TXT_OLD!"
|
||||
if exist "!WAV_NEW!" del /a:a "!WAV_NEW!"
|
||||
if exist "!TXT_NEW!" del /a:a "!TXT_NEW!"
|
||||
)
|
||||
|
||||
:process_file_continue
|
||||
exit /B
|
||||
REM :process_file end, continue from last call
|
||||
|
||||
|
||||
REM # ########################################################################
|
||||
REM # decode only (no comparisons done), for performance testing
|
||||
REM # ########################################################################
|
||||
:performance_file outer
|
||||
REM # ignore files starting with dot (no filename)
|
||||
set CMD_SHORTNAME=%~n1
|
||||
if "%CMD_SHORTNAME%" == "" goto performance_file_continue
|
||||
|
||||
REM # get file (not from arg %1)
|
||||
set CMD_FILE=!CMD_FILE!
|
||||
set CMD_FILE=!CMD_FILE:"=!
|
||||
REM echo VTRS: file !CMD_FILE!
|
||||
|
||||
set WAV_NEW=!CMD_FILE!.test.wav
|
||||
if "%OP_PERFORMANCE%" == "1" (
|
||||
set CMD_VGM="%OP_CMD_NEW%" -o "!WAV_NEW!" "!CMD_FILE!"
|
||||
)
|
||||
if "%OP_PERFORMANCE%" == "2" (
|
||||
set CMD_VGM="%OP_CMD_NEW%" -O "!CMD_FILE!"
|
||||
)
|
||||
if "%OP_PERFORMANCE%" == "3" (
|
||||
set CMD_VGM="%OP_CMD_OLD%" -o "!WAV_OLD!" "!CMD_FILE!"
|
||||
)
|
||||
if "%OP_PERFORMANCE%" == "4" (
|
||||
set CMD_VGM="%OP_CMD_OLD%" -O "!CMD_FILE!"
|
||||
)
|
||||
if "%OP_PERFORMANCE%" == "5" (
|
||||
set CMD_VGM="%OP_CMD_NEW%" -m "!CMD_FILE!"
|
||||
)
|
||||
if "%OP_PERFORMANCE%" == "6" (
|
||||
set CMD_VGM="%OP_CMD_OLD%" -m "!CMD_FILE!"
|
||||
)
|
||||
|
||||
!CMD_VGM! 1> nul 2>&1 & REM || goto error
|
||||
set CMP_WAV_ERROR=0
|
||||
if %ERRORLEVEL% NEQ 0 set CMP_WAV_ERROR=1
|
||||
|
||||
call :echo_color %COLOR_OK% "!CMD_FILE!" "done"
|
||||
|
||||
REM # ignore output
|
||||
if exist "!WAV_NEW!" del /a:a "!WAV_NEW!"
|
||||
|
||||
:performance_file_continue
|
||||
exit /B
|
||||
REM :performance_file end, continue from last call
|
||||
|
||||
|
||||
REM # ########################################################################
|
||||
REM # hack to get colored output in Windows CMD using findstr + temp file
|
||||
REM # ########################################################################
|
||||
:echo_color
|
||||
REM # don't use %2 but !CMD_FILE!
|
||||
set TEMP_FILE=!CMD_FILE!-result
|
||||
set TEMP_FILE=!TEMP_FILE:"=!
|
||||
set TEMP_TEXT=%3
|
||||
set TEMP_TEXT=!TEMP_TEXT:"=!
|
||||
echo !TEMP_TEXT! > "!TEMP_FILE!"
|
||||
|
||||
REM # show colored filename + any text in temp file
|
||||
findstr /a:%1 /r ".*" "!TEMP_FILE!" nul
|
||||
del "!TEMP_FILE!"
|
||||
|
||||
exit /B
|
||||
REM :echo_color end, continue from last call
|
||||
|
||||
|
||||
REM # ########################################################################
|
||||
|
||||
:error
|
||||
echo VRTS: error
|
||||
goto exit
|
||||
|
||||
:exit
|
@ -24,7 +24,7 @@ if(NOT WIN32 AND USE_CELT)
|
||||
set(CELT_0110_LINK_PATH ${CELT_0110_BIN}/libcelt/.libs/libcelt0.a)
|
||||
|
||||
configure_file(
|
||||
${VGM_SOURCE_DIR}/ext_libs/celt-0110/ecintrin.h
|
||||
${VGM_SOURCE_DIR}/ext_libs/extra/celt-0110/ecintrin.h
|
||||
${CELT_0110_PATH}/libcelt/ecintrin.h
|
||||
COPYONLY)
|
||||
|
||||
@ -100,11 +100,7 @@ if(NOT WIN32 AND USE_CELT)
|
||||
|
||||
foreach(ver 0061 0110)
|
||||
foreach(source ${CELT_CFLAGS})
|
||||
string(REGEX REPLACE "^([^_]+)" "\\1_${ver}" target ${source})
|
||||
if(source STREQUAL ${target})
|
||||
set(target "${source}_${ver}")
|
||||
endif()
|
||||
list(APPEND CELT_${ver}_CFLAGS "-D${source}=${target}")
|
||||
list(APPEND CELT_${ver}_CFLAGS "-D${source}=${source}_${ver}")
|
||||
endforeach()
|
||||
list(APPEND CELT_${ver}_CFLAGS "-fPIC")
|
||||
|
||||
|
@ -68,67 +68,55 @@ if(USE_FFMPEG)
|
||||
if(FFMPEG_PATH)
|
||||
set(FFMPEG_COMPILE YES)
|
||||
|
||||
set(FFMPEG_CONF_DEMUXER
|
||||
ac3 eac3 spdif asf xwma mov oma xmv ogg flac wav aac mp3 smacker bink binka caf mpc mpc8 tak ape
|
||||
)
|
||||
set(FFMPEG_CONF_PARSER
|
||||
ac3 mpegaudio xma vorbis opus
|
||||
)
|
||||
set(FFMPEG_CONF_DEMUXER
|
||||
ac3 asf xwma mov oma ogg tak dsf wav aac dts dtshd mp3 bink flac msf xmv caf ape smacker pcm_s8 spdif mpc mpc8
|
||||
)
|
||||
set(FFMPEG_CONF_DECODER
|
||||
ac3 wmapro wmav1 wmav2 wmavoice wmalossless xma1 xma2 dca tak dsd_lsbf dsd_lsbf_planar dsd_mbf dsd_msbf_planar aac atrac3 atrac3p mp1float mp2float mp3float binkaudio_dct binkaudio_rdft flac pcm_s16be pcm_s16be_planar pcm_s16le pcm_s16le_planar vorbis ape adpcm_ima_qt smackaud pcm_s8 pcm_s8_planar mpc7 mpc8 alac adpcm_ima_dk3 adpcm_ima_dk4
|
||||
ac3 eac3 wmapro wmav1 wmav2 xma1 xma2 aac atrac3 atrac3p mp2float mp3float smackaud binkaudio_dct binkaudio_rdft pcm_s16be pcm_s16be_planar pcm_s16le pcm_s16le_planar pcm_s8 pcm_s8_planar flac vorbis mpc7 mpc8 alac adpcm_ima_qt adpcm_ima_dk3 adpcm_ima_dk4 tak ape
|
||||
)
|
||||
if(USE_FFMPEG_LIBOPUS)
|
||||
list(APPEND FFMPEG_CONF_DECODER libopus)
|
||||
else()
|
||||
list(APPEND FFMPEG_CONF_DECODER opus)
|
||||
endif()
|
||||
set(FFMPEG_CONF_DISABLE_PARSER
|
||||
mpeg4video h263
|
||||
)
|
||||
set(FFMPEG_CONF_DISABLE_DECODER
|
||||
mpeg2video h263 h264 mpeg1video mpeg2video mpeg4 hevc vp9
|
||||
)
|
||||
string(REPLACE ";" "," FFMPEG_CONF_PARSER "${FFMPEG_CONF_PARSER}")
|
||||
string(REPLACE ";" "," FFMPEG_CONF_DEMUXER "${FFMPEG_CONF_DEMUXER}")
|
||||
string(REPLACE ";" "," FFMPEG_CONF_DECODER "${FFMPEG_CONF_DECODER}")
|
||||
string(REPLACE ";" "," FFMPEG_CONF_DISABLE_PARSER "${FFMPEG_CONF_DISABLE_PARSER}")
|
||||
string(REPLACE ";" "," FFMPEG_CONF_DISABLE_DECODER "${FFMPEG_CONF_DISABLE_DECODER}")
|
||||
set(FFMPEG_CONF_ARGS
|
||||
--enable-static
|
||||
--disable-shared
|
||||
--enable-gpl
|
||||
--disable-version3
|
||||
--disable-programs
|
||||
--disable-doc
|
||||
--disable-ffplay
|
||||
--disable-ffprobe
|
||||
--disable-avdevice
|
||||
--disable-ffmpeg
|
||||
--disable-swscale
|
||||
--disable-postproc
|
||||
--disable-avfilter
|
||||
--disable-swscale
|
||||
--disable-network
|
||||
--disable-everything
|
||||
--disable-iconv
|
||||
--disable-mediafoundation
|
||||
--disable-schannel
|
||||
--disable-sdl2
|
||||
--disable-zlib
|
||||
--disable-swscale-alpha
|
||||
--disable-vdpau
|
||||
--disable-dxva2
|
||||
--disable-amf
|
||||
--disable-cuda
|
||||
--disable-cuvid
|
||||
--disable-dxva2
|
||||
--disable-d3d11va
|
||||
--disable-ffnvcodec
|
||||
--disable-nvenc
|
||||
--disable-nvdec
|
||||
--disable-hwaccels
|
||||
--disable-sdl2
|
||||
--disable-iconv
|
||||
--disable-everything
|
||||
--enable-hwaccels
|
||||
--enable-swresample
|
||||
--disable-vdpau
|
||||
--enable-parser=${FFMPEG_CONF_PARSER}
|
||||
--enable-demuxer=${FFMPEG_CONF_DEMUXER}
|
||||
--enable-decoder=${FFMPEG_CONF_DECODER}
|
||||
--disable-parser=${FFMPEG_CONF_DISABLE_PARSER}
|
||||
--disable-decoder=${FFMPEG_CONF_DISABLE_DECODER}
|
||||
--disable-cuvid
|
||||
--disable-version3
|
||||
--disable-zlib
|
||||
--enable-swresample
|
||||
--extra-libs=-static
|
||||
--extra-cflags=--static
|
||||
--pkg-config-flags=--static
|
||||
|
@ -2,14 +2,14 @@ if(NOT WIN32 AND USE_G719)
|
||||
FetchDependency(G719
|
||||
DIR libg719_decode
|
||||
GIT_REPOSITORY https://github.com/kode54/libg719_decode
|
||||
GIT_TAG 9bd89f89df4a5c0e9f178c173fc55d373f039bcf
|
||||
GIT_TAG da90ad8a676876c6c47889bcea6a753f9bbf7a73
|
||||
)
|
||||
|
||||
if(G719_PATH)
|
||||
set(G719_LINK_PATH ${G719_BIN}/libg719_decode.a)
|
||||
|
||||
configure_file(
|
||||
${VGM_SOURCE_DIR}/ext_libs/libg719_decode/CMakeLists.txt
|
||||
${VGM_SOURCE_DIR}/ext_libs/extra/libg719_decode/CMakeLists.txt
|
||||
${G719_PATH}/CMakeLists.txt
|
||||
COPYONLY)
|
||||
|
||||
|
@ -1,26 +0,0 @@
|
||||
if(USE_MAIATRAC3PLUS)
|
||||
FetchDependency(MAIATRAC3PLUS
|
||||
DIR maiatrac3plus
|
||||
)
|
||||
|
||||
if(MAIATRAC3PLUS_PATH)
|
||||
configure_file(
|
||||
${VGM_SOURCE_DIR}/ext_libs/maiatrac3plus/CMakeLists.txt
|
||||
${MAIATRAC3PLUS_PATH}/MaiAT3PlusDecoder/CMakeLists.txt
|
||||
COPYONLY)
|
||||
configure_file(
|
||||
${VGM_SOURCE_DIR}/ext_libs/maiatrac3plus/maiatrac3plus.h
|
||||
${MAIATRAC3PLUS_PATH}/MaiAT3PlusDecoder/maiatrac3plus.h
|
||||
COPYONLY)
|
||||
configure_file(
|
||||
${MAIATRAC3PLUS_PATH}/MaiAT3PlusDecoder/src/base/Mai_mem.cc
|
||||
${MAIATRAC3PLUS_PATH}/MaiAT3PlusDecoder/src/base/Mai_Mem.cc
|
||||
COPYONLY)
|
||||
add_subdirectory(${MAIATRAC3PLUS_PATH}/MaiAT3PlusDecoder ${MAIATRAC3PLUS_BIN} EXCLUDE_FROM_ALL)
|
||||
else()
|
||||
message(FATAL_ERROR "Path to MAIATRAC3+ must be set. (Use MAIATRAC3PLUS_PATH)")
|
||||
endif()
|
||||
endif()
|
||||
if(NOT USE_MAIATRAC3PLUS)
|
||||
unset(MAIATRAC3PLUS_SOURCE)
|
||||
endif()
|
@ -11,16 +11,17 @@ if(NOT WIN32 AND USE_MPEG)
|
||||
DIR mpg123
|
||||
FETCH_PRIORITY file svn git
|
||||
|
||||
FILE_DOWNLOAD https://downloads.sourceforge.net/mpg123/mpg123-1.28.2.tar.bz2
|
||||
FILE_SUBDIR mpg123-1.28.2
|
||||
FILE_DOWNLOAD https://downloads.sourceforge.net/mpg123/mpg123-1.31.1.tar.bz2
|
||||
FILE_SUBDIR mpg123-1.31.1
|
||||
|
||||
SVN_REPOSITORY svn://scm.orgis.org/mpg123/trunk
|
||||
SVN_REVISION -r4968
|
||||
# unknown current version, to be fixed
|
||||
#SVN_REPOSITORY svn://scm.orgis.org/mpg123/trunk
|
||||
#SVN_REVISION -r4968 ?
|
||||
|
||||
# "official" git repo: https://www.mpg123.de/trunk/.git/ but *very* slow (HTTP emulation)
|
||||
# "official" git mirror (default branch is not master), works too
|
||||
GIT_REPOSITORY https://github.com/madebr/mpg123
|
||||
GIT_TAG efedb989a4d300199f09757815409d3a89b8bc63
|
||||
GIT_TAG aec901b7a636b6eb61e03a87ff3547c787e8c693
|
||||
GIT_UNSHALLOW ON
|
||||
)
|
||||
|
||||
|
@ -10,7 +10,7 @@ if(NOT WIN32 AND USE_SPEEX)
|
||||
FetchDependency(SPEEX
|
||||
DIR speex
|
||||
GIT_REPOSITORY https://gitlab.xiph.org/xiph/speex
|
||||
GIT_TAG Speex-1.2.0
|
||||
GIT_TAG Speex-1.2.1
|
||||
)
|
||||
|
||||
if(SPEEX_PATH)
|
||||
|
@ -100,14 +100,6 @@ macro(setup_target TARGET)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_MAIATRAC3PLUS)
|
||||
target_compile_definitions(${TARGET} PRIVATE VGM_USE_MAIATRAC3PLUS)
|
||||
target_include_directories(${TARGET} PRIVATE ${MAIATRAC3PLUS_PATH}/MaiAT3PlusDecoder)
|
||||
if(LINK)
|
||||
target_link_libraries(${TARGET} at3plusdecoder)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_ATRAC9)
|
||||
target_compile_definitions(${TARGET} PRIVATE VGM_USE_ATRAC9)
|
||||
if(WIN32 AND LINK)
|
||||
@ -136,7 +128,7 @@ macro(setup_target TARGET)
|
||||
target_compile_definitions(${TARGET} PRIVATE VGM_USE_SPEEX)
|
||||
if(WIN32 AND LINK)
|
||||
add_dependencies(${TARGET} libspeex)
|
||||
target_link_libraries(${TARGET} ${VGM_BINARY_DIR}/ext_libs/libspeex/libspeex.lib)
|
||||
target_link_libraries(${TARGET} ${VGM_BINARY_DIR}/ext_libs/libspeex-1.lib)
|
||||
endif()
|
||||
if(NOT WIN32 AND LINK)
|
||||
target_link_libraries(${TARGET} speex m)
|
||||
@ -151,15 +143,15 @@ macro(install_dlls INSTALL_PREFIX)
|
||||
set(VORBIS_DLL ${VGM_SOURCE_DIR}/ext_libs/libvorbis.dll)
|
||||
set(G719_DLL ${VGM_SOURCE_DIR}/ext_libs/libg719_decode.dll)
|
||||
set(FFMPEG_DLL
|
||||
${VGM_SOURCE_DIR}/ext_libs/avcodec-vgmstream-58.dll
|
||||
${VGM_SOURCE_DIR}/ext_libs/avformat-vgmstream-58.dll
|
||||
${VGM_SOURCE_DIR}/ext_libs/avutil-vgmstream-56.dll
|
||||
${VGM_SOURCE_DIR}/ext_libs/swresample-vgmstream-3.dll)
|
||||
${VGM_SOURCE_DIR}/ext_libs/avcodec-vgmstream-59.dll
|
||||
${VGM_SOURCE_DIR}/ext_libs/avformat-vgmstream-59.dll
|
||||
${VGM_SOURCE_DIR}/ext_libs/avutil-vgmstream-57.dll
|
||||
${VGM_SOURCE_DIR}/ext_libs/swresample-vgmstream-4.dll)
|
||||
set(ATRAC9_DLL ${VGM_SOURCE_DIR}/ext_libs/libatrac9.dll)
|
||||
set(CELT_DLL
|
||||
${VGM_SOURCE_DIR}/ext_libs/libcelt-0061.dll
|
||||
${VGM_SOURCE_DIR}/ext_libs/libcelt-0110.dll)
|
||||
set(SPEEX_DLL ${VGM_SOURCE_DIR}/ext_libs/libspeex/libspeex.dll)
|
||||
set(SPEEX_DLL ${VGM_SOURCE_DIR}/ext_libs/libspeex-1.dll)
|
||||
|
||||
# List of DLLs to check for install
|
||||
set(DLLS
|
||||
|
635
doc/BUILD-LIB.md
Normal file
635
doc/BUILD-LIB.md
Normal file
@ -0,0 +1,635 @@
|
||||
# vgmstream lib build help
|
||||
This document explains how to build various external dependencies used in vgmstream. Like *vgmstream*, most external libs use C and need to be compiled as such.
|
||||
|
||||
See [BUILD](BUILD.md#external-libraries) for a description of each lib first.
|
||||
|
||||
## Intro
|
||||
Guide is mainly geared towards **Windows** DLLs, as a reference for later updates. For **Linux/Mac**, libs are already included when using *CMake*, but you can mostly follow this with minor tweaks (like using default install folders) to create linkable `.so` libs, should you need to.
|
||||
|
||||
Unless mentioned, their latest version should be ok to use, though included DLLs may be a bit older. Each lib is compiled using a *recommended version*, but most should work with recent versions (FFMpeg may rarely change the *API* though). Most libs don't provide official pre-compiled *binaries*, or only for certain versions, so we need to compile them ourselves.
|
||||
|
||||
### Requirements
|
||||
Guide assumes you followed the steps above to install Git, GCC (MingW or MSYS2) or Visual Studio, but you'll need GCC most of the time. This guide uses the command line to describe repeatable steps, though for MSVC DLLs you may open `.sln` and compile manually. Both MSVC's and GCC's DLLs should work fine and with comparable performance.
|
||||
|
||||
MSVC commands use `msbuild.exe`, which can be called by opening VS's *x86 Native Tools for VS 20xx* console, found on Windows start menu. It can also be added to regular `PATH` for CMD/MSYS2 as well, but since location changes around you may need to download *vswhere* (locator) to find it:
|
||||
```bat
|
||||
curl --location https://github.com/Microsoft/vswhere/releases/download/2.6.7/vswhere.exe --output vswhere.exe
|
||||
REM #path to MSBuild
|
||||
vswhere.exe -latest -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe
|
||||
REM set PATH=%PATH%;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin
|
||||
```
|
||||
|
||||
On Windows 10, `curl` is included by default but you may need to get it first (or just manually download and unzip files).
|
||||
|
||||
### Tools and PATHs
|
||||
When using Mingw+Git you may add their location to Windows' `PATH` variable, so programs like `gcc.exe` work as-is in Windows CMD without writting the full path. This can be done temporarily by writting in the command line: `set PATH=C:\(path-to-mingw)\mingw32\bin;C:\Git\usr\bin;%PATH%` (for example), or in Windows' system variables panel.
|
||||
|
||||
For MSYS2 commands should work (after installing relevant programs) by opening the `msys2/mingw32.exe` console.
|
||||
|
||||
**Important** though is that some libs (like mpg123) only work properly when GCC/MSYS2 paths goes *before* Windows default path, since some program names conflict otherwise.
|
||||
|
||||
### standalone MinGW tweaks
|
||||
MinGW has `mingw32-make.exe` but most scripts expect plain `make`. Generally you can pass a `MAKE=mingw32-make` variable with the full name, but may be easier to clone/rename it to `make.exe`.
|
||||
|
||||
Also for autotool-based buils, it's best to put files (and dev tools) in folders paths *without spaces* as some scripts still get tripped by that. For the sake of the steps below you for (for example) run commands in `C:\vgmstream-dlls\sources`.
|
||||
|
||||
### autotools
|
||||
Several libs use *autotools* (a collection of scripts that guess system's config), that typically works by doing:
|
||||
```sh
|
||||
# creates a custom Makefile(s) based on current system
|
||||
sh ./configure [params]
|
||||
|
||||
# default, compiles code using generated Makefile(s) (resulting .dll/files in some internal folder)
|
||||
make [params]
|
||||
|
||||
# copies resulting files to some pre-defined dir, and compiles if plain make wasn't called first
|
||||
# optionally, "make install-strip" does the same, but "strips" binaries (good)
|
||||
make install
|
||||
make install-strip
|
||||
|
||||
# cleans compiled code (important when changing ./configure options)
|
||||
make clean
|
||||
```
|
||||
|
||||
While mainly geared towards *Linux* using GCC-like compilers, works on *Windows* as long as typical *Linux* utils and compilers can be found `PATH`. Not all *configure* are created equal so there is some fiddling around depending on lib.
|
||||
|
||||
Usually, *autoconf* DLLs are generated with *debug symbols* by default. This can be fixed by calling's GCC `strip (dll)`, generally done automatically or when using `make install-strip`.
|
||||
|
||||
On Linux `install` is used to actually *install* libs on system dirs (so `--prefix` is rarely used), while on Windows is just to copy DLLs, `.h` (used in C code), linker libs (not needed) and other stuff to final dir.
|
||||
|
||||
You can call multiple *targets* in a single line `make clean install-strip` is the same as `make clean` and `make install` (which in turn calls plain `make` / default). That's the theory, but at some libs don't properly handle this.
|
||||
|
||||
### autotools config
|
||||
*autotools* are **very** fragile and picky, beware when changing stuff.Check other flags by calling `sh ./configure --help`, but changing some of the steps will likely cause odd issues, *autotools are not consistent between libs*.
|
||||
|
||||
Common *configure*/Makefile params:
|
||||
- `--build=...`: current compilation environment (autodetected, but may fail in outdated libs)
|
||||
- `--host=...`: target system (same as build by default), can be forced for cross-compilation.
|
||||
- `--target=...`: target binary (same as host by default). Not really needed.
|
||||
- how much `build/host/target` matter depends on lib, included always by default.
|
||||
- `--target-os/--arch/--etc`: depending on script, to ease config
|
||||
- `--disable-static --enable-shared`: only needed config as appropriate (varies)
|
||||
- `--prefix=/c/vgmstream-dlls/(varies)/`: *make install* dir (where libs are copied), to simplify we'll use a fixed one
|
||||
- defaults to `/c/Git/usr/local` (standalone) or MSYS2's `/usr/local` folders if not set
|
||||
- if you don't call *make install* DLLs will be still there, inside `.libs` subdirs usually (will need to `strip`)
|
||||
- most projects (except FFmpeg only?) need a full path (`/path/...`) and won't accept a relative one (`./subdir/...`)
|
||||
- `MAKE=mingw32-make`: may be passed for mingw32 to work properly (otherwise rename `mingw32-make.exe` to `make.exe`)
|
||||
- `CFLAGS` / `AM_CFLAGS` / `LDFLAGS` / `AM_LDFLAGS`: extra compiler/linker flags
|
||||
|
||||
Compiler/linker flags are very important yet have big gotchas:
|
||||
- pass `-m32`/`-64` to the compiler for 32/64-bit output
|
||||
- this may be autodetected and set in some environments
|
||||
- pass `-static-libgcc` to the linker to remove Mingw-w64 DLL dependencies (not needed in 64-bit DLLs?)
|
||||
- `CFLAGS` / `LDFLAGS` on *configure* will usually (**not always**) *add* to the default ones
|
||||
- `CFLAGS` on `make` will usually *overwrite* default ones (such as `-O2` optimizations)
|
||||
- `AM_CFLAGS` on `make` should work together with `CFLAGS`, but actually aren't always passed to all `.c`
|
||||
- `LDFLAGS` on `make` may *overwrite* default ones, but often aren't set
|
||||
- `AM_LDFLAGS` on `make` should work together with `LDFLAGS`, but some libs don't support them, or *libtool* (hellspawn script that internally generates final `.dll`) sometimes only reads `LDFLAGS`
|
||||
However, *those flags aren't consistent between libs*, meaning in one using *configure* + `CFLAGS` adds to existing CFLAGS, other overwrites them. So, scripts below may look inconsistent, but they certain flags for a reason.
|
||||
|
||||
### Xiph's releases and exports
|
||||
Sometimes we use "official releases" sources rather than using Git's sources. Both should be the same, but releases have pre-generated *./configure*, while Git needs to call `autogen.sh` that calls `autoreconf` that generates a base `configure` script. Since getting `autoreconf` working on **Windows** without MSYS2 requires extra steps (not described), Xiph's releases are recommended.
|
||||
|
||||
When building a DLL/lib compiler sets *exported symbols* (functions). Xiph's *autoconf* may generate DLLs correctly, butdon't detect Mingw/Win config properly and export all symbols by default. This is fixed manually, but there may be better ways to handle it (to be researched).
|
||||
|
||||
### Shared libs details
|
||||
Roughly, a `.dll` is a Windows "shared library"; Linux equivalent would be a `.so` file. First, `.c` files are compiled into objects (`.o` in GCC, `.obj` in MSCV), then can be made into a `.dll`. Later, when a program needs that DLL (or rather, it's functions), a compiler can use it as long as some conditions are met.
|
||||
|
||||
DLL must *export symbols* (functions), which on a Windows's DLL is done with:
|
||||
- adding `__declspec(dllexport)` to a function (usually done with `#define EXPORT ...` and similar ways)
|
||||
- using a `.def` module definition file
|
||||
- if neither of the above is used, GCC exports every function by default (not great=
|
||||
|
||||
Then, to *link* (refer to) a DLL compiler usually needs helper files (`.dll.a` in GCC, `.lib` in MSVC). DLL's are copied to vgmstream's source, while helper files are created on compile time from `.dll`+`.def` (see *ext_libs/Makefile* for GCC and `ext_libs.vcxproj` for MSVC).
|
||||
|
||||
DLLs also *links* to standard C lib (MingW: `msvcrt.dll`, MSVC: `msvcrt(version).dll`). On Windows there are multiple versions of this *runtime*, but DLLs may include (part of) it with certain compiler/linker flags. This means there are subtle differences between compiler's generated DLLs, but for libs (that only do limited stuff) they don't matter much.
|
||||
|
||||
### Static libs details
|
||||
*vgmstream* uses external DLLs to support extra codecs, but it's clunkier and less user-friendly needing a bunch of extra DLLs around. Ideally *vgmstream* could use *static libs* instead (eliminating the need of DLLs), but it's complex and not done at the moment.
|
||||
|
||||
To make static libs, all objects (`.o`/`.obj`) are integrated to an archive (`.a` in GCC, `.lib` in MSVC) then this can use used by compiler. However, unlike DLLs, mixing static libs from one compiler with another is harder due to compiler dependencies that aren't a problem with DLLs. For example, by default Mingw's static libs may depend on `libmingwex.a` and would need that lib if used with MSVC.
|
||||
|
||||
One could have static libs for each compiler, but not all projects can be compiled with MSVC or GCC, also being a lot of extra work. Incidentally, C++ DLLs/libs can't be easily shared between MSVC and GCC (unless carefully prepared to be so), unlike plain C libs that are mostly compatible.
|
||||
|
||||
### 32 and 64-bit
|
||||
Maybe obvious, but programs and DLLs can be compiled as 32-bit or 64-bit, but you can't mix 64-bit programs and 32-bit DLLs (on **Windows** mixing DLLs will usually result on error `0xc00007b`). Compilers, being programs, can be 32 or 64-bit as well.
|
||||
|
||||
Both 32/64-bit GCC can compile 32-bit or 64-bit without issues, using the `-m32`/`-m64` flags (because GCC is able to create win32/win64/arm32/arm64/etc executables regardless of itself being 32/64-bit), while MSVC probably does as well, but just in case install the 64-bit version that handles both and decides what to generate based on info from `.vcxproj` files.
|
||||
|
||||
|
||||
## Compiling external libs
|
||||
|
||||
### mpg123
|
||||
Must use *autotools*, though some scripts may simplify the process (`makedll.sh`, `windows-builds.sh x86/x86-64`).
|
||||
|
||||
#### Source
|
||||
```bat
|
||||
curl --location https://sourceforge.net/projects/mpg123/files/mpg123/1.31.1/mpg123-1.31.1.tar.bz2 --output mpg123-1.31.1.tar.bz2
|
||||
tar -xf mpg123-1.31.1.tar.bz2
|
||||
cd mpg123-1.31.1
|
||||
```
|
||||
|
||||
#### With GCC
|
||||
*Notes*:
|
||||
- if `make` ends with a libtool message of "syntax error near token", make sure GCC/MSYS2/Linux utils go *first* in `PATH` (`set PATH=C:\(...);%PATH%`).
|
||||
- `make install-strip` throws an error and fails to copy `.h` but seems to properly strip DLLs (regular `install` is used to copy `.h`).
|
||||
|
||||
```bat
|
||||
REM # 32-bit DLL
|
||||
sh ./configure --host=mingw32 --disable-static --enable-shared --with-cpu=x86 --prefix=/c/vgmstream-dlls/out/mpg123-32 CFLAGS="-m32" LDFLAGS="-static-libgcc"
|
||||
make clean install install-strip
|
||||
|
||||
REM # 64-bit DLL
|
||||
sh ./configure --host=mingw64 --disable-static --enable-shared --with-cpu=x86-64 --prefix=/c/vgmstream-dlls/out/mpg123-64 CFLAGS="-m64" LDFLAGS="-static-libgcc"
|
||||
make clean install install-strip
|
||||
```
|
||||
|
||||
#### With MSVC
|
||||
Untested/not possible.
|
||||
|
||||
|
||||
### libg719_decode
|
||||
Use MSVC and `g719.sln`, or GCC and the Makefile included.
|
||||
|
||||
#### Source
|
||||
```bat
|
||||
git clone https://github.com/kode54/libg719_decode
|
||||
git -C libg719_decode checkout da90ad8a676876c6c47889bcea6a753f9bbf7a73
|
||||
cd libg719_decode
|
||||
```
|
||||
|
||||
#### With GCC
|
||||
```bat
|
||||
REM # 32-bit DLL
|
||||
mkdir C:\vgmstream-dlls\out\g719-32\
|
||||
make clean shared EXTRA_CFLAGS="-m32" EXTRA_LDFLAGS="-m32 -static-libgcc" OUTPUT_DIR=C:\vgmstream-dlls\out\g719-32\
|
||||
|
||||
REM # 64-bit DLL
|
||||
mkdir C:\vgmstream-dlls\out\g719-64\
|
||||
make clean shared EXTRA_CFLAGS="-m64" EXTRA_LDFLAGS="-m64 -static-libgcc" OUTPUT_DIR=C:\vgmstream-dlls\out\g719-64\
|
||||
```
|
||||
|
||||
#### With MSVC
|
||||
```bat
|
||||
REM # 32-bit DLL
|
||||
MSBuild.exe g719.sln /p:Platform=Win32 /p:Configuration=Release /p:WindowsTargetPlatformVersion=10.0 /p:PlatformToolset=v142
|
||||
mkdir C:\vgmstream-dlls\out\g719-32
|
||||
copy /B .\Release\libg719_decode.dll C:\vgmstream-dlls\out\g719-32\libg719_decode.dll
|
||||
|
||||
REM # 64-bit DLL
|
||||
MSBuild.exe g719.sln /p:Platform=x64 /p:Configuration=Release /p:WindowsTargetPlatformVersion=10.0 /p:PlatformToolset=v142
|
||||
mkdir C:\vgmstream-dlls\out\g719-64
|
||||
copy /B .\x64\Release\libg719_decode.dll C:\vgmstream-dlls\out\g719-64\libg719_decode.dll
|
||||
|
||||
REM add /t:Clean to the above to clean up compilation
|
||||
```
|
||||
|
||||
|
||||
### LibAtrac9
|
||||
Use MSCV and `libatrac9.sln`, or GCC and the Makefile included.
|
||||
|
||||
#### Source
|
||||
```bat
|
||||
git clone https://github.com/Thealexbarney/LibAtrac9
|
||||
git -C LibAtrac9 checkout 6a9e00f6c7abd74d037fd210b6670d3cdb313049
|
||||
cd LibAtrac9/C
|
||||
```
|
||||
|
||||
#### With GCC
|
||||
|
||||
**NOTE**: on Windows `mkdir` clashes and needs full path
|
||||
```bat
|
||||
REM # 32-bit DLL
|
||||
make clean shared SFLAGS="-O2 -m32" MKDIR="/Git/usr/bin/mkdir -p" BINDIR=C:\vgmstream-dlls\out\atrac9-32 SHARED_NAME=C:\vgmstream-dlls\out\atrac9-32\libatrac9.dll
|
||||
|
||||
REM make clean shared SFLAGS="-O2 -m32" MKDIR="/Git/usr/bin/mkdir -p" BINDIR=C:\vgmstream-dlls\out\atrac9-32 SHARED_FILENAME=libatrac9.dll
|
||||
|
||||
REM # 64-bit DLL
|
||||
make clean shared SFLAGS="-O2 -m64" MKDIR="/Git/usr/bin/mkdir -p" BINDIR=C:\vgmstream-dlls\out\atrac9-64 SHARED_NAME=C:\vgmstream-dlls\out\atrac9-64\libatrac9.dll
|
||||
```
|
||||
|
||||
#### With MSVC
|
||||
```bat
|
||||
REM # 32-bit DLL
|
||||
MSBuild.exe libatrac9.sln /p:Platform=x86 /p:Configuration=Release /p:WindowsTargetPlatformVersion=10.0 /p:PlatformToolset=v142
|
||||
mkdir C:\vgmstream-dlls\out\atrac9-32
|
||||
copy /B .\Release\libatrac9.dll C:\vgmstream-dlls\out\atrac9-32\libatrac9.dll
|
||||
|
||||
REM # 64-bit DLL
|
||||
MSBuild.exe libatrac9.sln /p:Platform=x64 /p:Configuration=Release /p:WindowsTargetPlatformVersion=10.0 /p:PlatformToolset=v142
|
||||
mkdir C:\vgmstream-dlls\out\atrac9-64
|
||||
copy /B .\x64\Release\libatrac9.dll C:\vgmstream-dlls\out\atrac9-64\libatrac9.dll
|
||||
|
||||
REM add /t:Clean to the above to clean up compilation
|
||||
```
|
||||
**NOTE**
|
||||
|
||||
Some `libatrac9.vcxproj` x64 config may be outdated. In MSBuild +15 (VS +2017) you can force changes by creating a file named `Directory.Build.props` nearby. Also possible to pass this with /p:ForceImportBeforeCppTargets=(file.prop), but only works with full paths. There is no command line support to change CL (MSVC's compile) options other than this.
|
||||
```
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
</Project>
|
||||
```
|
||||
|
||||
|
||||
### libvorbis
|
||||
Should be buildable with *autotools* (Git releases need to use `autogen.sh` first) or MSVC (projects in `./win32/`, may not be up to date). *CMake* may work as well.
|
||||
|
||||
Methods below create 3 DLL: `libogg.dll`, `libvorbis.dll` and `libvorbisfile.dll` (also `libvorbisenc.dll`, unneeded), plus static libs (`.a`). However Vorbis/Ogg DLL support in vgmstream was originally added using a combined DLL from *RareWares* (https://www.rarewares.org/ogg-libraries.php) simply called `libvorbis.dll`, so separate DLLs can't be used at the moment and we'll need to fix that.
|
||||
|
||||
**TODO**: should restrict exported symbols (unsure how libvorbis does it, here it's manually done on last step)
|
||||
|
||||
#### Sources
|
||||
``` bat
|
||||
curl --location http://downloads.xiph.org/releases/ogg/libogg-1.3.5.zip --output libogg-1.3.5.zip
|
||||
tar -xf libogg-1.3.5.zip
|
||||
cd libogg-1.3.5
|
||||
```
|
||||
```
|
||||
curl --location http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.7.zip --output libvorbis-1.3.7.zip
|
||||
tar -xf libvorbis-1.3.7.zip
|
||||
cd libvorbis-1.3.7
|
||||
```
|
||||
#### With GCC
|
||||
*Notes*:
|
||||
- `-ffast-math` isn't enabled by default but seems safe and commonly done elsewhere
|
||||
|
||||
**libogg**
|
||||
```bat
|
||||
REM # 32-bit DLL + static lib
|
||||
sh ./configure --build=mingw32 --enable-static --enable-shared --prefix=/c/vgmstream-dlls/out/ogg-32 CFLAGS="-m32" LDFLAGS="-static-libgcc"
|
||||
make clean install-strip
|
||||
|
||||
REM # 64-bit DLL + static lib
|
||||
sh ./configure --build=mingw64 --enable-static --enable-shared --prefix=/c/vgmstream-dlls/out/ogg-64 CFLAGS="-m64" LDFLAGS="-static-libgcc"
|
||||
make clean install-strip
|
||||
```
|
||||
|
||||
**libvorbis/libvorbisfile**
|
||||
```bat
|
||||
REM # 32-bit DLL + static lib
|
||||
sh ./configure --host=mingw32 --enable-static --enable-shared --disable-docs --prefix=/c/vgmstream-dlls/out/vorbis-32 --with-ogg=/c/vgmstream-dlls/out/ogg-32 CFLAGS="-m32 -ffast-math" LDFLAGS="-static-libgcc"
|
||||
make clean install-strip
|
||||
|
||||
sh ./configure --host=mingw64 --enable-static --enable-shared --disable-docs --prefix=/c/vgmstream-dlls/out/vorbis-64 --with-ogg=/c/vgmstream-dlls/out/ogg-64 CFLAGS="-m64 -ffast-math" LDFLAGS="-static-libgcc"
|
||||
make clean install-strip
|
||||
```
|
||||
|
||||
**libvorbix mix**
|
||||
There no official (autoconf) way to bundle all 3 libs above into one DLL, as we need, but we can do it manually (ugly but what can you do).
|
||||
|
||||
Commands, based on how generated makefile creates dlls (-Wl are 'linker' commands):
|
||||
- `-shared`: create a .so/.dll
|
||||
- `(file).def`: limits exported DLL symbols/functions (no dllexports so gcc can't tell otherwise)
|
||||
- `-s`: strips DLL (removes symbols)
|
||||
- `-o (name)`: output
|
||||
- `-Wl,--whole-archive (multiple .a) -Wl,--no-whole-archive`: adds all `.o` inside those `.a` (archives)
|
||||
- otherwise could use `ar xo (archive.s)` to unzip and manually pass all `.o` inside to gcc
|
||||
- `-Wl,--enable-auto-image-base`: for DLLs, improves loading?
|
||||
- `-Wl,--out-implib=(name).dll.a`: creates a helper link .lib, though we don't really need it
|
||||
- `-Wl,--output-def=(name).def`: can be included to create a final export file (to compare)
|
||||
|
||||
This needs `libvorbis.def` from *vgmstream/ext_libs*, and doesn't include `libvorbisenc` code.
|
||||
```bat
|
||||
cd C:\vgmstream-dlls\out
|
||||
|
||||
REM # 32-bit DLL
|
||||
gcc -m32 -shared -s libvorbis.def -o vorbis-32/libvorbis.dll -Wl,--whole-archive ogg-32/lib/libogg.a vorbis-32/lib/libvorbisfile.a vorbis-32/lib/libvorbis.a -Wl,--no-whole-archive -Wl,--enable-auto-image-base
|
||||
|
||||
REM # 64-bit DLL
|
||||
gcc -m64 -shared -s libvorbis.def -o vorbis-64/libvorbis.dll -Wl,--whole-archive ogg-64/lib/libogg.a vorbis-64/lib/libvorbisfile.a vorbis-64/lib/libvorbis.a -Wl,--no-whole-archive -Wl,--enable-auto-image-base
|
||||
```
|
||||
|
||||
#### With MSVC/CMake
|
||||
Untested.
|
||||
|
||||
|
||||
### libcelt
|
||||
FSB uses two incompatible, older libcelt versions. Both libraries export the same symbols so normally can't coexist together. To get them working we need to make sure symbols are renamed first. This may be solved in various ways:
|
||||
- using dynamic loading (LoadLibrary) but for portability it isn't an option
|
||||
- may be possible to link+rename using .def files, but those are mainly used on **Windows**
|
||||
- Linux/Mingw's objcopy to (supposedly) rename DLL symbols
|
||||
- Use GCC's preprocessor to rename functions on compile
|
||||
- Directly rename functions in source code
|
||||
|
||||
We'll use autotools with GCC preprocessor renaming. On **Windows** steps are described below; on **Linux** you can use CMake that patch celt libs automatically (or follow the steps removing Windows-only config).
|
||||
|
||||
#### Source
|
||||
|
||||
**celt-0.6.1**
|
||||
```bat
|
||||
curl --location http://downloads.us.xiph.org/releases/celt/celt-0.6.1.tar.gz --output celt-0.6.1.tar.gz
|
||||
tar -xf celt-0.6.1.tar.gz
|
||||
cd celt-0.6.1
|
||||
```
|
||||
|
||||
**celt-0.11.0**
|
||||
```bat
|
||||
curl --location http://downloads.us.xiph.org/releases/celt/celt-0.11.0.tar.gz --output celt-0.11.0.tar.gz
|
||||
tar -xf celt-0.11.0.tar.gz
|
||||
cd celt-0.11.0
|
||||
```
|
||||
|
||||
#### With GCC
|
||||
*Notes*:
|
||||
- on **Windows** exports need to be fixed (undefines `CELT_BUILD` and defines `WIN32` to allow `dllexport`)
|
||||
- uses `sed` (Linux text replacer) to change `#define`
|
||||
- despite the name, `CELT_BUILD` seems to be used only to detect shared builds
|
||||
- on **Windows** *celt-0.6.1*'s *libtool* somehow removes `-static-libgcc` from `LDFLAGS`, meaning DLLs depend on Mingw's libs
|
||||
- partially fixed using `-Wc,-static-libgcc`, but will cause various errors
|
||||
- uses `sed` (Linux text replacer) to insert `-static-libgcc` into *libtool* calls
|
||||
- detects build environment incorrectly (outdated scripts)
|
||||
- uses `mingw32` even on 64-bit due to older *configure*
|
||||
- `CFLAGS` on *configure* overwrite defaults, also no `AM_LDFLAGS`
|
||||
- in theory passing `--enable-custom-modes` in *configure* would be equivalent to `-DCUSTOM_MODES=1` in 0.11.0 but doesn't seem to work?
|
||||
- `SUBDIRS="libcelt" DIST_SUBDIRS="libcelt"` forces Makefile to compile libcelt only and ignore tests (no other way to disable)
|
||||
- otherwise (buggy?) *configure* may detect *libogg* + compiles extra stuff (not an issue on Windows but for completeness)
|
||||
- `--disable-oggtest`: oggtest are test utils, not related to *libogg* detection
|
||||
- when compiling GCC may complain about missing `ec_log`, but it seems correctly defined in `entcode.c`and included in the lib and not a cause of issues.
|
||||
- `-no-undefined` is necessary for this or the DLL won't be created
|
||||
- uses preprocessor renaming (encoder functions aren't needed but for completion)
|
||||
|
||||
**TODO**: would be better to rename DLL output (since it's part of the DLL and makes .def simpler) but who knows what exact command is used
|
||||
|
||||
**celt-0.6.1**
|
||||
```bat
|
||||
REM # 32-bit DLL
|
||||
sh ./configure --build=mingw32 --disable-static --enable-shared --disable-oggtest --prefix=/c/vgmstream-dlls/out/celt0061-32
|
||||
sed -i -e "s/#define CELT_BUILD.*/#undef CELT_BUILD/g" config.h
|
||||
sed -i -e "s/compiler_flags -o/compiler_flags -static-libgcc -o/g" libtool
|
||||
make clean
|
||||
make SUBDIRS="libcelt" DIST_SUBDIRS="libcelt" LDFLAGS="-m32 -static-libgcc -no-undefined" AM_CFLAGS="-m32 -DWIN32 -Dcelt_decode=celt_decode_0061 -Dcelt_decoder_create=celt_decoder_create_0061 -Dcelt_decoder_destroy=celt_decoder_destroy_0061 -Dcelt_mode_create=celt_mode_create_0061 -Dcelt_mode_destroy=celt_mode_destroy_0061 -Dcelt_mode_info=celt_mode_info_0061 -Dcelt_decode_float=celt_decode_float_0061 -Dcelt_decoder_ctl=celt_decoder_ctl_0061 -Dcelt_encode=celt_encode_0061 -Dcelt_encode_float=celt_encode_float_0061 -Dcelt_encoder_create=celt_encoder_create_0061 -Dcelt_encoder_ctl=celt_encoder_ctl_0061 -Dcelt_encoder_destroy=celt_encoder_destroy_0061 -Dcelt_header_from_packet=celt_header_from_packet_0061 -Dcelt_header_init=celt_header_init_0061 -Dcelt_header_to_packet=celt_header_to_packet_0061"
|
||||
make install-strip SUBDIRS="libcelt" DIST_SUBDIRS="libcelt"
|
||||
|
||||
REM # 64-bit DLL
|
||||
sh ./configure --build=mingw32 --disable-static --enable-shared --disable-oggtest --prefix=/c/vgmstream-dlls/out/celt0061-64
|
||||
sed -i -e "s/#define CELT_BUILD.*/#undef CELT_BUILD/g" config.h
|
||||
sed -i -e "s/compiler_flags -o/compiler_flags -static-libgcc -o/g" libtool
|
||||
make clean
|
||||
make SUBDIRS="libcelt" DIST_SUBDIRS="libcelt" LDFLAGS="-m64 -static-libgcc -no-undefined" AM_CFLAGS="-m64 -DWIN32 -Dcelt_decode=celt_decode_0061 -Dcelt_decoder_create=celt_decoder_create_0061 -Dcelt_decoder_destroy=celt_decoder_destroy_0061 -Dcelt_mode_create=celt_mode_create_0061 -Dcelt_mode_destroy=celt_mode_destroy_0061 -Dcelt_mode_info=celt_mode_info_0061 -Dcelt_decode_float=celt_decode_float_0061 -Dcelt_decoder_ctl=celt_decoder_ctl_0061 -Dcelt_encode=celt_encode_0061 -Dcelt_encode_float=celt_encode_float_0061 -Dcelt_encoder_create=celt_encoder_create_0061 -Dcelt_encoder_ctl=celt_encoder_ctl_0061 -Dcelt_encoder_destroy=celt_encoder_destroy_0061 -Dcelt_header_from_packet=celt_header_from_packet_0061 -Dcelt_header_init=celt_header_init_0061 -Dcelt_header_to_packet=celt_header_to_packet_0061"
|
||||
make install-strip SUBDIRS="libcelt" DIST_SUBDIRS="libcelt"
|
||||
```
|
||||
|
||||
**celt-0.11.0**
|
||||
```bat
|
||||
REM # 32-bit DLL
|
||||
sh ./configure --build=mingw32 --disable-static --enable-shared --disable-oggtest --prefix=/c/vgmstream-dlls/out/celt0110-32
|
||||
sed -i -e "s/#define CELT_BUILD.*/#undef CELT_BUILD/g" config.h
|
||||
make clean
|
||||
make SUBDIRS="libcelt" DIST_SUBDIRS="libcelt" LDFLAGS="-m32 -static-libgcc -no-undefined" AM_CFLAGS="-m32 -DWIN32 -DCUSTOM_MODES=1 -Dcelt_decode=celt_decode_0110 -Dcelt_decoder_create_custom=celt_decoder_create_custom_0110 -Dcelt_decoder_destroy=celt_decoder_destroy_0110 -Dcelt_mode_create=celt_mode_create_0110 -Dcelt_mode_destroy=celt_mode_destroy_0110 -Dcelt_mode_info=celt_mode_info_0110 -Dcelt_decode_float=celt_decode_float_0110 -Dcelt_decoder_create=celt_decoder_create_0110 -Dcelt_decoder_ctl=celt_decoder_ctl_0110 -Dcelt_decoder_get_size=celt_decoder_get_size_0110 -Dcelt_decoder_get_size_custom=celt_decoder_get_size_custom_0110 -Dcelt_decoder_init=celt_decoder_init_0110 -Dcelt_decoder_init_custom=celt_decoder_init_custom_0110 -Dcelt_encode=celt_encode_0110 -Dcelt_encode_float=celt_encode_float_0110 -Dcelt_encoder_create=celt_encoder_create_0110 -Dcelt_encoder_create_custom=celt_encoder_create_custom_0110 -Dcelt_encoder_ctl=celt_encoder_ctl_0110 -Dcelt_encoder_destroy=celt_encoder_destroy_0110 -Dcelt_encoder_get_size=celt_encoder_get_size_0110 -Dcelt_encoder_get_size_custom=celt_encoder_get_size_custom_0110 -Dcelt_encoder_init=celt_encoder_init_0110 -Dcelt_encoder_init_custom=celt_encoder_init_custom_0110 -Dcelt_header_from_packet=celt_header_from_packet_0110 -Dcelt_header_init=celt_header_init_0110 -Dcelt_header_to_packet=celt_header_to_packet_0110 -Dcelt_strerror=celt_strerror_0110"
|
||||
make install-strip SUBDIRS="libcelt" DIST_SUBDIRS="libcelt"
|
||||
|
||||
REM # 64-bit DLL
|
||||
sh ./configure --build=mingw32 --disable-static --enable-shared --disable-oggtest --prefix=/c/vgmstream-dlls/out/celt0110-64
|
||||
sed -i -e "s/#define CELT_BUILD.*/#undef CELT_BUILD/g" config.h
|
||||
make clean
|
||||
make SUBDIRS="libcelt" DIST_SUBDIRS="libcelt" LDFLAGS="-m64 -static-libgcc -no-undefined" AM_CFLAGS="-m64 -DWIN32 -DCUSTOM_MODES=1 -Dcelt_decode=celt_decode_0110 -Dcelt_decoder_create_custom=celt_decoder_create_custom_0110 -Dcelt_decoder_destroy=celt_decoder_destroy_0110 -Dcelt_mode_create=celt_mode_create_0110 -Dcelt_mode_destroy=celt_mode_destroy_0110 -Dcelt_mode_info=celt_mode_info_0110 -Dcelt_decode_float=celt_decode_float_0110 -Dcelt_decoder_create=celt_decoder_create_0110 -Dcelt_decoder_ctl=celt_decoder_ctl_0110 -Dcelt_decoder_get_size=celt_decoder_get_size_0110 -Dcelt_decoder_get_size_custom=celt_decoder_get_size_custom_0110 -Dcelt_decoder_init=celt_decoder_init_0110 -Dcelt_decoder_init_custom=celt_decoder_init_custom_0110 -Dcelt_encode=celt_encode_0110 -Dcelt_encode_float=celt_encode_float_0110 -Dcelt_encoder_create=celt_encoder_create_0110 -Dcelt_encoder_create_custom=celt_encoder_create_custom_0110 -Dcelt_encoder_ctl=celt_encoder_ctl_0110 -Dcelt_encoder_destroy=celt_encoder_destroy_0110 -Dcelt_encoder_get_size=celt_encoder_get_size_0110 -Dcelt_encoder_get_size_custom=celt_encoder_get_size_custom_0110 -Dcelt_encoder_init=celt_encoder_init_0110 -Dcelt_encoder_init_custom=celt_encoder_init_custom_0110 -Dcelt_header_from_packet=celt_header_from_packet_0110 -Dcelt_header_init=celt_header_init_0110 -Dcelt_header_to_packet=celt_header_to_packet_0110 -Dcelt_strerror=celt_strerror_0110"
|
||||
make install-strip
|
||||
```
|
||||
|
||||
Resulting DLLs need to be renamed to `libcelt-0061.dll` and `libcelt-0110.dll`, and may need to create a `.def` file with `gendef (name).dll` (in theory this is done by passing `-Wl,--output-def=libcelt.def` to `AM_FLAGS` but seems to fail). vgmstream also needs `celt.h`, `celt_types.h`, `celt_header.h` with renamed functions, but a custom `.h` with minimal symbols is already included in source.
|
||||
|
||||
#### With MSVC
|
||||
Untested/not possible.
|
||||
|
||||
|
||||
### libspeex
|
||||
Should be buildable with *autotools* (Git releases need to use `autogen.sh` first) or MSVC (projects in `./win32/`, may not be up to date).
|
||||
|
||||
#### Source
|
||||
```bat
|
||||
curl --location http://downloads.us.xiph.org/releases/speex/speex-1.2.1.tar.gz --output speex-1.2.1.tar.gz
|
||||
tar -xf speex-1.2.1.tar.gz
|
||||
cd speex-1.2.1
|
||||
```
|
||||
|
||||
#### With GCC
|
||||
*Notes*:
|
||||
- on **Windows** exports need to be fixed (swaps Linux exports with Windows' `dllexport`)
|
||||
- `CFLAGS` on *configure* overwrite defaults
|
||||
```bat
|
||||
REM # 32-bit DLL
|
||||
sh ./configure --host=mingw32 --disable-static --enable-shared --prefix=/c/vgmstream-dlls/out/speex-32
|
||||
sed -i -e "s/#define EXPORT .*/#define EXPORT __declspec(dllexport)/g" config.h
|
||||
make clean install-strip LDFLAGS="-m32 -static-libgcc" AM_CFLAGS="-m32"
|
||||
|
||||
REM # 64-bit DLL
|
||||
sh ./configure --host=mingw64 --disable-static --enable-shared --prefix=/c/vgmstream-dlls/out/speex-64
|
||||
sed -i -e "s/#define EXPORT .*/#define EXPORT __declspec(dllexport)/g" config.h
|
||||
make clean install-strip LDFLAGS="-m64 -static-libgcc" AM_CFLAGS="-m64"
|
||||
```
|
||||
|
||||
#### With MSVC
|
||||
Untested/outdated.
|
||||
|
||||
|
||||
### libopus
|
||||
This is used below by FFmpeg (but can be disabled), as a static lib (`.a`/`.lib`) rather than DLL.
|
||||
|
||||
If you wonder why use it through FFmpeg instead of directly, all work was already done for FFmpeg's opus so it was faster easier this way.
|
||||
|
||||
#### Source
|
||||
```bat
|
||||
curl --location https://archive.mozilla.org/pub/opus/opus-1.3.1.tar.gz --output opus-1.3.1.tar.gz
|
||||
tar -xf opus-1.3.1.tar.gz
|
||||
cd opus-1.3.1
|
||||
```
|
||||
|
||||
#### With GCC
|
||||
**Notes**
|
||||
- `CFLAGS` on *configure* overwrite defaults
|
||||
- remove `--prefix` for pkg-config to work properly?
|
||||
|
||||
```bat
|
||||
REM # 32-bit lib
|
||||
sh ./configure --host=mingw32 --enable-static --disable-shared --disable-doc --disable-extra-programs --prefix=/c/vgmstream-dlls/out/opus-32
|
||||
make clean install-strip LDFLAGS="-m32 -static-libgcc" AM_CFLAGS="-m32"
|
||||
|
||||
REM # 64-bit lib
|
||||
sh ./configure --host=mingw32 --enable-static --disable-shared --disable-doc --disable-extra-programs --prefix=/c/vgmstream-dlls/out/opus-64
|
||||
make clean install-strip LDFLAGS="-m64 -static-libgcc" AM_CFLAGS="-m64"
|
||||
```
|
||||
|
||||
#### With MSVC
|
||||
**Notes**:
|
||||
- if you have called *configure* first, delete `config.h` on root or you may get odd errors
|
||||
|
||||
```bat
|
||||
del config.h
|
||||
cd win32/VS2015
|
||||
|
||||
REM # 32-bit lib
|
||||
MSBuild.exe opus.sln /p:Platform=Win32 /p:Configuration=Release /p:WindowsTargetPlatformVersion=10.0 /p:PlatformToolset=v142
|
||||
|
||||
REM # 64-bit lib
|
||||
MSBuild.exe opus.sln /p:Platform=x64 /p:Configuration=Release /p:WindowsTargetPlatformVersion=10.0 /p:PlatformToolset=v142
|
||||
```
|
||||
|
||||
### FFmpeg
|
||||
vgmstream's FFmpeg builds for **Windows** and static builds for **Linux** remove many unnecessary parts of FFmpeg to trim down its gigantic size, and, on Windows, are also built with the "-vgmstream" suffix to prevent clashing with other plugins. Current options can be seen in `ffmpeg_options.txt`. Shared **Linux** builds usually link to system FFmpeg without issues, while standard FFmpeg DLLs may work (renamed to -vgmstream).
|
||||
|
||||
FFmpeg can be compiled with *libopus* (external lib) rather than internal *opus*. This is used because FFmpeg decodes incorrectly Opus files used some in games (mostly low bitrate). In older versions this was audibly wrong, but currently the difference shouldn't be that much, but still not that accurate compared with *libopus* (PCM sample diffs of +5000), so *vgmstream* enables it. Getting *libopus* recognized can be unwieldly, so internal *opus* is a decent enough substitute (remove `--enable-libopus` and change `libopus` to `opus` in `--enable-decoder`).
|
||||
|
||||
GCC and MSVC need `yasm.exe` somewhere in `PATH` to properly compile/optimize: https://yasm.tortall.net (add `--disable-yasm` to *configure* options to disable, may decrease performance).
|
||||
|
||||
FFmpeg uses separates DLLs, that depend on each other like this:
|
||||
- avutil: none (uses bcrypt only in Win7+, could be be patched out)
|
||||
- swresample: avutil
|
||||
- avformat: avcodec, avutil
|
||||
- avcodec: avutil, swresample
|
||||
|
||||
Note that *vgmstream* applies various patches in real time to fix several FFmpeg quirks (including infinite loops). Could be done with *git* patches, but not currently since users on Linux may link to system's libs and/or use different versions. Updating FFmpeg version without testing carefully is not recommended.
|
||||
|
||||
#### Source
|
||||
```bat
|
||||
# clone only current tag's "depth" as otherwise FFmpeg history is pretty big
|
||||
git clone https://git.ffmpeg.org/ffmpeg.git --depth 1 --branch n5.1.2
|
||||
cd ffmpeg
|
||||
```
|
||||
|
||||
#### libopus and pkg-config
|
||||
FFmpeg uses *pkg-config* (a kind of "installed lib manager") to detect pre-compiled *libopus*. On Linux it should detect *libopus* after `make install` with default `--prefix`, or adding opus's `--prefix` path to `PKG_CONFIG_PATH`. On Windows, MSYS2 *probably* works the same.
|
||||
|
||||
However when compiling with MSVC it's not clear how to mix Windows-style `.lib` and *pkg-config*, though should be possible (*media-autobuild_suite* project does it?). For now as a temp hack, we can force FFmpeg to skip pkg-config and manually pass lib's location. But if you can get *pkg-config* to work ignore "pkg-config hack" steps (**TODO**: to be researched).
|
||||
|
||||
#### With GCC
|
||||
**Notes**:
|
||||
- *do not* call `make install` directly without `make` first, doesn't properly execute needed dependencies (won't have version numbers)
|
||||
|
||||
```sh
|
||||
# read current options (removing comments and line breaks); change file path if needed (or manually copy options below)
|
||||
FFMPEG_OPTIONS=`sed -e '/^#/d' ../vgmstream/ext_libs/ffmpeg_options.txt`
|
||||
echo $FFMPEG_OPTIONS
|
||||
|
||||
# PKG-CONFIG HACK: disables pkg-config in FFmpeg's configure (use only if *configure* throws a pkg-config error)
|
||||
sed -i -e "s/require_pkg_config libopus/: #require_pkg_config libopus/g" configure
|
||||
|
||||
# PKG-CONFIG HACK (untested): pass the following to configure
|
||||
# --extra-cflags="-I(path to opus's /include)" --extra-ldflags="-L(path to opus's /lib) -lopus -static-libgc"
|
||||
|
||||
# 32-bit DLL
|
||||
sh ./configure $FFMPEG_OPTIONS --target-os=mingw32 --arch=x86 --enable-custom-modes --extra-ldflags="-static-libgcc" --prefix=/c/vgmstream-dlls/out/ffmpeg-32
|
||||
make clean
|
||||
make
|
||||
make install
|
||||
|
||||
# 64-bit DLL
|
||||
sh ./configure $FFMPEG_OPTIONS --target-os=mingw32 --arch=x86_64 --enable-custom-modes --extra-ldflags="-static-libgcc" --prefix=/c/vgmstream-dlls/out/ffmpeg-64
|
||||
make clean
|
||||
make
|
||||
make install
|
||||
```
|
||||
|
||||
#### With MSVC
|
||||
Supported but also needs *autotools* with MSYS2, and several hoops:
|
||||
- have MSVC's `cl.exe`/`link.exe` compiler/linker in `PATH` (`cl.exe` returns info)
|
||||
- it's kinda hard to find out so best would be opening VS's *x86 Native Tools for VS 20xx* console, found on Windows start menu
|
||||
- (libopus only) temp add opus's include and lib paths into MSVC's `INCLUDE` and `LIB` console variables
|
||||
- `set INCLUDE=%LIB%;C:\(path to include)`
|
||||
- `set LIB=%LIB%;C:\(path to lib)`
|
||||
- open MSYS2's ming32 console keeping PATH:
|
||||
- `C:\msys64\msys2_shell.cmd -mingw32 -use-full-path` (32-bit)
|
||||
- `C:\msys64\msys2_shell.cmd -mingw64 -use-full-path` (64-bit)
|
||||
- a new console should open, you can close *x86 Native Tools Command Prompt* now
|
||||
- check `which cl` is found (shows VS's path)
|
||||
- check `which link` is MSVC's and not `/usr/bin/link.exe`
|
||||
- temp rename wrong `link.exe` if needed: `mv /usr/bin/link.exe /usr/bin/link.exe.bak`
|
||||
- beware as *mingw32* and *ming64* consoles may have different settings/links
|
||||
- make sure git/gcc/make/autotools/mingw/pkg-config(pkgconf?)/mingw-w64 are installed in MSYS2
|
||||
- make sure yasm is installed (`pacman -S yasm`)
|
||||
- (libopus only but kinda optional) install pkg-config
|
||||
- get *libopus*, compile it with VS (to get a `.lib`) as described before
|
||||
- get FFmpeg's source and enter it
|
||||
- call *configure/make/make install* with options described above, changing:
|
||||
- `--target-os=mingw32` to `--target-os=win32 --toolchain=msvc`
|
||||
- if you get "*compiler cannot create executables*" errors make sure that:
|
||||
- you have open the *mingw32* (32-bit) or *mingw64* (64-bit) console
|
||||
- `which link` is properly set
|
||||
- *libopus*'s `opus.lib` path ib `LIB` is correctly set
|
||||
- if you get pkg-config errors, try hack to disable it (see below)
|
||||
- if you still get errors, try disabling libopus (remove `--enable-libopus` and change `libopus` to `opus` in `--enable-decoder`)
|
||||
- if you still get errors, try deleting opusffmpeg dirs and *carefully* redo the steps
|
||||
- missing a single step or changing stuff will likely cause issues!
|
||||
After a while (+5-10min) you should get DLLs. When compiling 64-bit DLLs, open *x64 Native Tools for VS 20xx* console instead, compile *libopus* 64-bit and set `--target-os=win64`.
|
||||
|
||||
Reportedly this helper project works (automates all of the above):
|
||||
- https://github.com/m-ab-s/media-autobuild_suite
|
||||
`ffmpeg_options.txt` and `media-autobuild_suite.ini` (outdated?) for it can be found in *vgmstream* source.
|
||||
|
||||
In theory adding Git+Mingw+yasm in `PATH` inside the VS console would work (temp include: `set PATH=%PATH%;C:\Git\usr\bin;C:\(mingw-path)\mingw32\bin;C:\yasm`), but seems to have issues with existing `awk`.
|
||||
|
||||
Extra info:
|
||||
- http://ffmpeg.org/platform.html
|
||||
- https://trac.ffmpeg.org/wiki/CompilationGuide/MSVC
|
||||
- https://github.com/OpenChemistry/tomviz-superbuild/blob/master/projects/win32/BuildFFMPEG.md
|
||||
|
||||
##### 32-bit scripts
|
||||
**x86 Native Tools Command Prompt**
|
||||
```bat
|
||||
REM compile libopus first: download, enter win32/VS2015, call MSBuild.exe, etc (detailed above)
|
||||
|
||||
set INCLUDE=%INCLUDE%;C:\vgmstream-dlls\sources\opus-1.3.1\include
|
||||
set LIB=%LIB%;C:\vgmstream-dlls\sources\opus-1.3.1\win32\VS2015\Win32\Release
|
||||
|
||||
C:\msys64\msys2_shell.cmd -mingw32 -use-full-path
|
||||
```
|
||||
|
||||
**MSYS2's mingw32 console**
|
||||
```sh
|
||||
# download FFmpeg first, etc
|
||||
cd /c/vgmstream-dlls/sources/ffmpeg
|
||||
|
||||
# read current options (removing comments and line breaks); change file path if needed (or manually copy options below)
|
||||
FFMPEG_OPTIONS=`sed -e '/^#/d' ../vgmstream/ext_libs/ffmpeg_options.txt`
|
||||
echo $FFMPEG_OPTIONS
|
||||
|
||||
# PKG-CONFIG HACK: disables pkg-config in FFmpeg's configure (use only if *configure* throws a pkg-config error)
|
||||
sed -i -e "s/require_pkg_config libopus/: #require_pkg_config libopus/g" configure
|
||||
|
||||
# opus should be on INCLUDE/LIB path now, otherwise try:
|
||||
# --extra-cflags="-I."-I(full windows-style path)
|
||||
# --extra-ldflags="(full windows-style path)\opus.lib"
|
||||
sh ./configure $FFMPEG_OPTIONS --target-os=win32 --toolchain=msvc --arch=x86 --extra-ldflags="opus.lib" --prefix=/c/vgmstream-dlls/out/ffmpeg-32
|
||||
make clean
|
||||
make
|
||||
make install
|
||||
```
|
||||
|
||||
##### 64-bit scripts
|
||||
**x64 Native Tools Command Prompt**
|
||||
```bat
|
||||
REM compile libopus first: download, enter win32/VS2015, call MSBuild.exe, etc (detailed above)
|
||||
|
||||
set INCLUDE=%INCLUDE%;C:\vgmstream-dlls\sources\opus-1.3.1\include
|
||||
set LIB=%LIB%;C:\vgmstream-dlls\sources\opus-1.3.1\win32\VS2015\x64\Release
|
||||
|
||||
C:\msys64\msys2_shell.cmd -mingw64 -use-full-path
|
||||
```
|
||||
|
||||
**MSYS2's mingw32 console**
|
||||
```sh
|
||||
# download FFmpeg first, etc
|
||||
cd /c/vgmstream-dlls/sources/ffmpeg
|
||||
|
||||
# read current options (removing comments and line breaks); change file path if needed (or manually copy options below)
|
||||
FFMPEG_OPTIONS=`sed -e '/^#/d' ../vgmstream/ext_libs/ffmpeg_options.txt`
|
||||
echo $FFMPEG_OPTIONS
|
||||
|
||||
# PKG-CONFIG HACK: disables pkg-config in FFmpeg's configure (use only if *configure* throws a pkg-config error)
|
||||
sed -i -e "s/require_pkg_config libopus/: #require_pkg_config libopus/g" configure
|
||||
|
||||
# opus should be on INCLUDE/LIB path now, otherwise try:
|
||||
# --extra-cflags="-I."-I(full windows-style path)
|
||||
# --extra-ldflags="(full windows-style path)\opus.lib"
|
||||
sh ./configure $FFMPEG_OPTIONS --target-os=win64 --toolchain=msvc --arch=x86_64 --extra-ldflags="opus.lib" --prefix=/c/vgmstream-dlls/out/ffmpeg-64
|
||||
make clean
|
||||
make
|
||||
make install
|
||||
```
|
217
doc/BUILD.md
217
doc/BUILD.md
@ -1,7 +1,6 @@
|
||||
# vgmstream build help
|
||||
This document explains how to build each of vgmstream's components and libraries.
|
||||
|
||||
|
||||
## Compilation requirements
|
||||
vgmstream can be compiled using one of several build scripts that are available in this repository. Components are detailed below, but if you are new to development you probably want one of these:
|
||||
- **Windows**: [simple scripts](#simple-scripts-builds) + [Visual Studio 2019](#microsofts-visual-c-msvc--visual-studio--msbuild-compiler)
|
||||
@ -50,8 +49,11 @@ make
|
||||
- May try https://formulae.brew.sh/formula/vgmstream instead (not part of this project)
|
||||
|
||||
### Windows
|
||||
- Install Visual Studio: https://www.visualstudio.com/downloads/ (for C/C++, with "MFC support" and "ATL support")
|
||||
- Make a file called `msvc-build.config.ps1` in vgmstream's root, with your installed toolset and SDK:
|
||||
- Install Visual Studio (VS): https://www.visualstudio.com/downloads/ (for C/C++, include "MFC support" and "ATL support")
|
||||
- Currently defaults to VS 2019 and Win 10/11
|
||||
- If you don't have VS 2019 and Win 10/11 you'll need to change project's defaults
|
||||
- Manually open .sln and change them in Visual Studio
|
||||
- Or make a file called `msvc-build.config.ps1` in vgmstream's source root, with your installed toolset and SDK:
|
||||
```ps1
|
||||
# - toolsets: "" (default), "v140" (VS 2015), "v141" (VS 2017), "v141_xp" (XP support), "v142" (VS 2019), etc
|
||||
# - sdks: "" (default), "7.0" (Win7 SDK), "8.1" (Win8 SDK), "10.0" (Win10 SDK), etc
|
||||
@ -68,15 +70,25 @@ This guide is mainly geared towards beginner devs, introducing concepts in steps
|
||||
### GCC / Make (compiler)
|
||||
Common C compiler, most development is done with this.
|
||||
|
||||
On **Windows** you need one of these somewhere in PATH:
|
||||
- MinGW-w64 (32bit version), in any config (for example: gcc-8.1.0, i686, win32, sjlj)
|
||||
- Use this for easier standalone executables
|
||||
- [Sourceforce project](https://sourceforge.net/projects/mingw-w64/)
|
||||
- [Latest online MinGW installer](https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe/download).
|
||||
- Or download and unzip the [portable MinGW package](https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/8.1.0/threads-win32/sjlj/i686-8.1.0-release-win32-sjlj-rt_v6-rev0.7z/download)
|
||||
- Or get from [alt builds](https://github.com/niXman/mingw-builds-binaries/releases/) (may be more recent versions)
|
||||
- MSYS2 with the MinGW-w64_shell (32bit) package: https://msys2.github.io/
|
||||
- Resulting binaries may depend on `msys*.dll`.
|
||||
On **Windows** you need one of these:
|
||||
- Standalone MinGW-w64, with **MSVCRT** runtime:
|
||||
- Example config: gcc-12.2.x, **i686**/x86_64 (32-bit), **win32**/posix (threads), **dward**/sehs
|
||||
- UCRT runtime is better but only installed by default in Windows 10
|
||||
- [Sourceforce project](https://sourceforge.net/projects/mingw-w64/) (max 8.x, outdated)
|
||||
- [Alt builds](https://github.com/niXman/mingw-builds-binaries/) (12.x)
|
||||
- [Various flavors plus Clang](https://winlibs.com/) (12.x)
|
||||
- Despite the name and config used, works and creates files for 32 or 64-bit Windows as needed
|
||||
- Also get Git for Windows (described later), as it includes program that make compiling with GCC easier.
|
||||
- Make sure the following are on Windows' `PATH` variable:
|
||||
- `C:\mingw-w64\i686-12.2.0-release-win32-sjlj-rt_v10-rev0\mingw32\bin` (path to GCC compiler)
|
||||
- `C:\Git\usr\bin` (from Git, extra Linux utils for Windows)
|
||||
- You can add temp PATH vars in CMD/.bat by typing `set PATH=%PATH%;C:\(path)\`)
|
||||
- [MSYS2](https://www.msys2.org/) environment, with extra required packages
|
||||
- Open the `msys2/mingw32.exe` (or `msys2/mingw64.exe`s) console
|
||||
- using regular `msys2/msys2.exe` may create binaries that depend on `msys*.dll`?
|
||||
- may need to install dependencies using:
|
||||
- `pacman -S git gcc make autotools` (also mingw-w64-i686/mingw-w64-x86_64?)
|
||||
|
||||
|
||||
On **Linux** it should be included by default in the distribution, or can be easily installed using the distro's package manager (for example `sudo apt-get install gcc g++ make`).
|
||||
|
||||
@ -183,7 +195,15 @@ chmod +x version-get.sh version-make.sh make-build.sh
|
||||
A tool used to generate common build files (for *make*, *VS/MSBuild*, etc), that in turn can be used to compile vgmstream's modules instead of using the existing scripts and files. Needs v3.6 or later:
|
||||
- https://cmake.org/download/
|
||||
|
||||
On **Windows** you can use *cmake-gui*, that should be mostly self-explanatory. You need to set the *source dir*, *build dir*, *config options*, then hit *Configure* to set save options and build type (for example *Visual Studio* project files), then *Generate* to actually create files. If you want to change options, hit *Configure* and *Generate* again.
|
||||
On **Windows** you can use *cmake-gui*, that should be mostly self-explanatory but just in case:
|
||||
- select vgmstream's project root (vgmstream-master) in *where is the source code* (source dir)
|
||||
- select some path in *where to build binaries* (build dir), for example make a `/build` subdir
|
||||
- press *Configure* and select project "generator" type, for example *Visual Studio 16 2019*
|
||||
- if you get an error check you have it installed and selected the correct project version
|
||||
- should show options in red; check what you need and uncheck what you don't
|
||||
- press *Generate*, this creates custom project files in "build binaries" path for your tools
|
||||
- (if you are using *Visual Studio* there is a pre-made `vgmstream_full.sln` file)
|
||||
If you want to change options, hit *Configure* and *Generate* again. If you want to change project type, "delete cache" first then repeat steps.
|
||||
|
||||
On **Linux**, the CMake script can automatically download and build the source code for dependencies that it requires. It is also capable of creating a statically linked binary for distribution purposes. See `./make-build-cmake.sh` (basically install desired deps then `mkdir -p build && cd build`, `cmake ..`, `make`).
|
||||
|
||||
@ -255,7 +275,7 @@ With no extra libs (or only some) enabled vgmstream works fine, but some advance
|
||||
|
||||
## Compiling modules
|
||||
|
||||
### CLI (test.exe/vgmstream-cli) / Winamp plugin (in_vgmstream) / XMPlay plugin (xmp-vgmstream)
|
||||
### CLI (vgmstream-cli) / Winamp plugin (in_vgmstream) / XMPlay plugin (xmp-vgmstream)
|
||||
|
||||
**With GCC/Clang**: there are various ways to build it, each with some differences; you probably want CMake described below.
|
||||
|
||||
@ -274,8 +294,9 @@ You may try CMake instead as it may be simpler and handle libs better. See the b
|
||||
**Windows** CMD .bat example (with some debugging on):
|
||||
```bat
|
||||
prompt $P$G$_$S
|
||||
set PATH=C:\Program Files (x86)\Git\usr\bin;%PATH%
|
||||
set PATH=C:\Program Files (x86)\mingw-w64\i686-5.4.0-win32-sjlj-rt_v5-rev0\mingw32\bin;%PATH%
|
||||
|
||||
set PATH=%PATH%;C:\mingw\i686-12.2.0-release-win32-sjlj-rt_v10-rev0\mingw32\bin
|
||||
set PATH=%PATH%;C:\Git\usr\bin
|
||||
|
||||
cd vgmstream
|
||||
|
||||
@ -294,9 +315,6 @@ If you get build errors, remember you need to adjust compiler/SDK in the `.sln`.
|
||||
|
||||
CMake can also be used instead to create project files (no particular benefit).
|
||||
|
||||
#### Notes
|
||||
While the official name for the CLI tool is `vgmstream-cli`, on **Windows**, `test.exe` is used instead for historical reasons. If you want to reuse it for your project, it's probably better to rename it to `vgmstream-cli.exe`.
|
||||
|
||||
|
||||
### foobar2000 plugin (foo\_input\_vgmstream)
|
||||
Requires MSVC (foobar/SDK only links to MSVC C++ DLLs). To build in Visual Studio, run `./msvc-build-init.bat`, open `vgmstream_full.sln` and compile. To build from the command line, just run `./msvc-build.bat`.
|
||||
@ -320,8 +338,8 @@ You can also manually use the command line to compile with MSBuild, if you don't
|
||||
prompt $P$G$_$S
|
||||
|
||||
REM MSVC ~2015
|
||||
REM set PATH=%PATH%;C:\Program Files (x86)\MSBuild\14.0\Bin;%PATH%
|
||||
REM Latest(?) MSVC
|
||||
REM set PATH=%PATH%;C:\Program Files (x86)\MSBuild\14.0\Bin
|
||||
REM Latest(?) MSVC (may also open "Native Tools Command Prompt for VS 20xx" in Windows' start menu)
|
||||
set PATH=%PATH%;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin
|
||||
|
||||
cd vgmstream
|
||||
@ -464,149 +482,94 @@ Support for some codecs is done with external libs, instead of copying their cod
|
||||
- not all licenses used by libs may allow to copy their code
|
||||
- simplifies maintenance and updating
|
||||
|
||||
They are compiled in their own sources, and the resulting binary is linked by vgmstream using a few of their symbols.
|
||||
|
||||
Currently repo contains pre-compiled external libraries for **Windows** (32-bit Windows DLLs), while other systems link to system libraries. Ideally vgmstream could use libs compiled as static code (thus eliminating the need of DLLs), but involves a bunch of changes.
|
||||
|
||||
Below is a quick explanation of each library and how to compile binaries from them (for **Windows**). Unless mentioned, their latest version should be ok to use, though included DLLs may be a bit older.
|
||||
|
||||
MSVC needs a .lib helper to link .dll files, but libs below usually only create .dll (and maybe .def). Instead, those .lib are automatically generated during build step in `ext_libs.vcxproj` from .dll+.def, using lib.exe tool.
|
||||
They are compiled in their own sources, and the resulting binary is linked by vgmstream using a few of their symbols (see [BUILD-LIB](BUILD-LIB.md) doc).
|
||||
|
||||
Currently vgmstream's repository contains pre-compiled external DLL libraries for **Windows**, while other systems link to system libraries or include static copies using CMake.
|
||||
|
||||
### libvorbis
|
||||
Adds support for Vorbis, inside Ogg as `.ogg` (plain or encrypted) or custom variations like `.wem`, `.fsb`, `.ogl`, etc.
|
||||
- Source: http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.6.zip
|
||||
- Sources:
|
||||
- http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.7.zip (for base vorbis decoding)
|
||||
- http://downloads.xiph.org/releases/ogg/libogg-1.3.5.zip (for ogg support)
|
||||
- Official Windows binaries: none
|
||||
- Commonly used compilations: https://www.rarewares.org/ogg-libraries.php (32-bit only, fusing libogg+libvorbis+libvorbisfile)
|
||||
- Version: 1.3.7
|
||||
- DLL: `libvorbis.dll`
|
||||
- lib: `-lvorbis -lvorbisfile`
|
||||
- licensed under the 3-clause BSD license.
|
||||
|
||||
Should be buildable with MSVC (in /win32 dir are .sln files) or autotools (use `autogen.sh`).
|
||||
|
||||
- licensed under the 3-clause BSD license
|
||||
|
||||
### mpg123
|
||||
Adds support for MPEG (MP1/MP2/MP3), used in formats that may have custom MPEG like `.ahx`, `.msf`, `.xvag`, `.scd`, etc.
|
||||
- Source: https://sourceforge.net/projects/mpg123/files/mpg123/1.25.10/
|
||||
- Builds: http://www.mpg123.de/download/win32/1.25.10/
|
||||
- Source: https://sourceforge.net/projects/mpg123/files/mpg123/1.31.1/mpg123-1.31.1.tar.bz2
|
||||
- Git mirror: https://github.com/madebr/mpg123 (commit `aec901b7a636b6eb61e03a87ff3547c787e8c693`)
|
||||
- SVN repository: svn://scm.orgis.org/mpg123/trunk (version: ?)
|
||||
- Official Windows binaries:
|
||||
- https://www.mpg123.de/download/win32/1.31.0/mpg123-1.31.0-x86.zip (32-bit)
|
||||
- https://www.mpg123.de/download/win64/1.31.0/mpg123-1.31.0-x86-64.zip (64-bit)
|
||||
- Version: 1.32.0 / 1.31.1
|
||||
- DLL: `libmpg123-0.dll`
|
||||
- lib: `-lmpg123`
|
||||
- licensed under the LGPL v2.1
|
||||
|
||||
Must use autotools (sh configure, make, make install), though some scripts simplify the process: `makedll.sh`, `windows-builds.sh`.
|
||||
|
||||
|
||||
### libg719_decode
|
||||
Adds support for ITU-T G.719 (standardization of Polycom Siren 22), used in a few Namco `.bnsf` games.
|
||||
- Source: https://github.com/kode54/libg719_decode
|
||||
- Source: https://github.com/kode54/libg719_decode (commit `da90ad8a676876c6c47889bcea6a753f9bbf7a73`)
|
||||
- Official Windows binaries: none
|
||||
- Version: latest
|
||||
- DLL: `libg719_decode.dll`
|
||||
- lib: ---
|
||||
- unknown license (possibly invalid and Polycom's)
|
||||
|
||||
Use MSVC (use `g719.sln`). It can be built with GCC too, for example, using [the CMake script from this repository](../ext_libs/libg719_decode/CMakeLists.txt).
|
||||
|
||||
- unknown license (reference decoder, possibly not valid/Polycom's)
|
||||
|
||||
### FFmpeg
|
||||
Adds support for multiple codecs: ATRAC3 (`.at3`), ATRAC3plus (`.at3`), XMA1/2 (`.xma`), WMA v1 (`.wma`), WMA v2 (`.wma`), WMAPro (`.xwma`), AAC (`.mp4`, `.aac`), Bink (`.bik`), AC3/SPDIF (`.ac3`), Opus (`.opus`), Musepack (`.mpc`), FLAC (`.flac`), etc.
|
||||
- Source: https://github.com/FFmpeg/FFmpeg/
|
||||
- DLLs: `avcodec-vgmstream-58.dll`, `avformat-vgmstream-58.dll`, `avutil-vgmstream-56.dll`, `swresample-vgmstream-3.dll`
|
||||
Adds support for multiple codecs: ATRAC3 (`.at3`), ATRAC3plus (`.at3`), XMA1/2 (`.xma`), WMA v1 (`.wma`), WMA v2 (`.wma`), WMAPro (`.xwma`), AAC (`.mp4`, `.aac`), Bink (`.bik`), Smacker (`.smk`), AC3/SPDIF (`.ac3`), Opus (`.opus`), Musepack (`.mpc`), FLAC (`.flac`), etc. Vorbis, MPEG and PCM and a few others are also included for rare cases.
|
||||
- Source: https://git.ffmpeg.org/ffmpeg.git (tag `n5.1.2`)
|
||||
- Git mirror: https://github.com/FFmpeg/FFmpeg/ (tag `n5.1.2`)
|
||||
- Official Windows binaries: none
|
||||
- Version: n5.1.2
|
||||
- DLLs: `avcodec-vgmstream-59.dll`, `avformat-vgmstream-59.dll`, `avutil-vgmstream-57.dll`, `swresample-vgmstream-4.dll`
|
||||
- lib: `-lavcodec -lavformat -lavutil -lswresample`
|
||||
- primarily licensed under the LGPL v2.1 or later, with portions licensed under the GPL v2
|
||||
|
||||
vgmstream's FFmpeg builds for **Windows** and static builds for **Linux** remove many unnecessary parts of FFmpeg to trim down its gigantic size, and, on Windows, are also built with the "vgmstream-" prefix to avoid clashing with other plugins. Current options can be seen in `ffmpeg_options.txt`. Shared **Linux** builds usually link to system FFmpeg without issues.
|
||||
|
||||
Note that the options above use *libopus*, but you can use FFmpeg's *Opus* by removing `--enable-libopus` and changing `--enable-decoder`'s `libopus` to `opus`. libopus is preferable since FFmpeg's Opus decoding is buggy in some files.
|
||||
|
||||
For GCC simply use [autotools](#autotools-builds), passing to `./configure` the above options.
|
||||
|
||||
For MSCV it can be done through a helper: https://github.com/jb-alvarado/media-autobuild_suite
|
||||
|
||||
Both may need yasm somewhere in PATH to properly compile: https://yasm.tortall.net
|
||||
|
||||
### libopus
|
||||
Indirectly used by FFmpeg for improved Opus (`.opus` and variants) support.
|
||||
- Source: https://archive.mozilla.org/pub/opus/opus-1.3.1.tar.gz
|
||||
- Git mirror: https://github.com/xiph/opus (tag `v1.3.1`)
|
||||
- Official Windows binaries: none
|
||||
- Version: v1.3.1
|
||||
- DLLs: (part of FFmpeg)
|
||||
- lib: (part of FFmpeg)
|
||||
- licensed under a variant of the BSD license: https://opus-codec.org/license/
|
||||
|
||||
### LibAtrac9
|
||||
Adds support for ATRAC9, used in `.at9` and other formats for the PS4 and Vita.
|
||||
- Source: https://github.com/Thealexbarney/LibAtrac9
|
||||
- Source: https://github.com/Thealexbarney/LibAtrac9 (commit `6a9e00f6c7abd74d037fd210b6670d3cdb313049`)
|
||||
- Official Windows binaries:
|
||||
- https://github.com/Thealexbarney/LibAtrac9/releases (32-bit only, outdated)
|
||||
- Version: latest
|
||||
- DLL: `libatrac9.dll`
|
||||
- lib: `-latrac9` / `-l:libatrac9.a`
|
||||
- licensed under the MIT license
|
||||
|
||||
Use MSCV and `libatrac9.sln`, or GCC and the Makefile included.
|
||||
|
||||
|
||||
### libcelt
|
||||
Adds support for FSB CELT versions 0.6.1 and 0.11.0, used in a handful of older `.fsb`.
|
||||
- Source (0.6.1): http://downloads.us.xiph.org/releases/celt/celt-0.6.1.tar.gz
|
||||
- Git mirror: https://gitlab.xiph.org/xiph/celt (commit `8ccf148573277b983692e15d5f0753081f806bea`)
|
||||
- Source (0.11.0): http://downloads.xiph.org/releases/celt/celt-0.11.0.tar.gz
|
||||
- Git mirror: https://gitlab.xiph.org/xiph/celt (commit `0b405d1170122c859faab435405666506d52fa2e`)
|
||||
- Official Windows binaries: none
|
||||
- Versions: 0.6.1, 0.11.0
|
||||
- DLL: `libcelt-0061.dll`, `libcelt-0110.dll`
|
||||
- lib: `-lcelt-0061` `-lcelt-0110` / `-l:libcelt-0110.a` `-l:libcelt-0061.a`
|
||||
- licensed under the MIT license
|
||||
|
||||
FSB uses two incompatible, older libcelt versions. Both libraries export the same symbols so normally can't coexist together. To get them working we need to make sure symbols are renamed first. This may be solved in various ways:
|
||||
- using dynamic loading (LoadLibrary) but for portability it isn't an option
|
||||
- It may be possible to link+rename using .def files
|
||||
- Linux/Mingw's objcopy to (supposedly) rename DLL symbols
|
||||
- Use GCC's preprocessor to rename functions on compile
|
||||
- Rename functions in the source code directly.
|
||||
|
||||
To compile we'll use autotools with GCC preprocessor renaming:
|
||||
- in the celt-0.6.1 dir:
|
||||
```bat
|
||||
# creates Makefiles with Automake
|
||||
sh.exe ./configure --build=mingw32 --prefix=/c/celt0.6.1/bin/ --exec-prefix=/c/celt-0.6.1/bin/
|
||||
|
||||
# LDFLAGS are needed to create the .dll (Automake whining)
|
||||
# CFLAGS rename a few CELT functions (we don't import the rest so they won't clash)
|
||||
mingw32-make.exe clean
|
||||
mingw32-make.exe LDFLAGS="-no-undefined" AM_CFLAGS="-Dcelt_decode=celt_0061_decode -Dcelt_decoder_create=celt_0061_decoder_create -Dcelt_decoder_destroy=celt_0061_decoder_destroy -Dcelt_mode_create=celt_0061_mode_create -Dcelt_mode_destroy=celt_0061_mode_destroy -Dcelt_mode_info=celt_0061_mode_info"
|
||||
```
|
||||
- in the celt-0.11.0 dir:
|
||||
```bat
|
||||
# creates Makefiles with Automake
|
||||
sh.exe ./configure --build=mingw32 --prefix=/c/celt-0.11.0/bin/ --exec-prefix=/c/celt-0.11.0/bin/
|
||||
|
||||
# LDFLAGS are needed to create the .dll (Automake whining)
|
||||
# CFLAGS rename a few CELT functions (notice one is different vs 0.6.1), CUSTOM_MODES is also a must.
|
||||
mingw32-make.exe clean
|
||||
mingw32-make.exe LDFLAGS="-no-undefined" AM_CFLAGS="-DCUSTOM_MODES=1 -Dcelt_decode=celt_0110_decode -Dcelt_decoder_create_custom=celt_0110_decoder_create_custom -Dcelt_decoder_destroy=celt_0110_decoder_destroy -Dcelt_mode_create=celt_0110_mode_create -Dcelt_mode_destroy=celt_0110_mode_destroy -Dcelt_mode_info=celt_0110_mode_info"
|
||||
```
|
||||
- take the .dlls from ./bin/bin, and rename libcelt.dll to libcelt-0061.dll and libcelt-0110.dll respectively.
|
||||
- you need to create a .def file for those DLL with the renamed simbol names above
|
||||
- finally the includes. libcelt gives "celt.h" "celt_types.h" "celt_header.h", but since we renamed a few functions we have a simpler custom .h with minimal renamed symbols.
|
||||
|
||||
For **Linux**, you can use CMake that similarly patch celt libs automatically.
|
||||
|
||||
You can also get them from the official git (https://gitlab.xiph.org/xiph/celt) call `./autogen.sh` first, then pass call configure/make with renames (see `./make-build.sh`).
|
||||
|
||||
Instead of passing `-DCUSTOM_MODES=1` to `make` you can pass `--enable-custom-codes` to *./configure*. There is also `--disable-oggtests`, `--disable-static/shared` and typical config. Note that if *./configure* finds Ogg in your system it'll try to build encoder/decoder test `tools` (that depend on libogg). There is no official way disable that or compile `libcelt` only, but you can force it by calling `make SUBDIRS=libcelt DIST_SUBDIRS=libcelt`, in case you have dependency issues.
|
||||
|
||||
### libspeex
|
||||
Adds support for Speex (inside custom containers), used in a few *EA* formats (`.sns`, `.sps`) for voices.
|
||||
- Source: http://downloads.us.xiph.org/releases/speex/speex-1.2.0.tar.gz
|
||||
- DLL: `libspeex.dll`
|
||||
- Source: http://downloads.us.xiph.org/releases/speex/speex-1.2.1.tar.gz
|
||||
- Git: https://gitlab.xiph.org/xiph/speex (tag `Speex-1.2.1`)
|
||||
- Github: https://github.com/xiph/speex/releases/tag/Speex-1.2.1
|
||||
- Official Windows binaries:
|
||||
- http://downloads.xiph.org/releases/speex/speex-1.2beta3-win32.zip (32-bit only, outdated)
|
||||
- Version: Speex-1.2.1 (latest)
|
||||
- DLL: `libspeex-1.dll`
|
||||
- lib: `-lspeex`
|
||||
- licensed under the Xiph.Org variant of the BSD license.
|
||||
https://www.xiph.org/licenses/bsd/speex/
|
||||
|
||||
Should be buildable with MSVC (in /win32 dir are .sln files, but not up to date and may need to convert .vcproj to vcxproj) or autotools (use `autogen.sh`, or script below).
|
||||
|
||||
You can also find a release on Github (https://github.com/xiph/speex/releases/tag/Speex-1.2.0). It has newer timestamps and some different helper files vs Xiph's release, but actual lib should be the same. Notably, Github's release *needs* `autogen.sh` that calls `autoreconf` to generate a base `configure` script, while Xiph's pre-includes `configure`. Since getting autoreconf working on **Windows** can be quite involved, Xiph's release is recommended on that platform.
|
||||
|
||||
**Windows** CMD example:
|
||||
```bat
|
||||
set PATH=%PATH%;C:\mingw\i686-8.1.0-release-win32-sjlj-rt_v6-rev0\mingw32\bin
|
||||
set PATH=%PATH%;C:\Git\usr\bin
|
||||
|
||||
sh ./configure --host=mingw32 --prefix=/c/celt-0.11.0/bin/ --exec-prefix=/c/celt-0.11.0/bin/
|
||||
mingw32-make.exe LDFLAGS="-no-undefined -static-libgcc" MAKE=mingw32-make.exe
|
||||
mingw32-make.exe MAKE=mingw32-make.exe install
|
||||
```
|
||||
If all goes well, use generated .DLL in ./bin/bin (may need to rename to libspeex.dll) and ./win32/libspeex.def, and speex folder with .h in bin/include.
|
||||
|
||||
|
||||
### maiatrac3plus
|
||||
This lib was used as an alternate for ATRAC3PLUS decoding. Now this is handled by FFmpeg, though some code remains for now.
|
||||
|
||||
It was a straight-up decompilation from Sony's libs (presumably those found in SoundForge), without any clean-up or actual reverse engineering, thus legally and morally dubious.
|
||||
|
||||
It doesn't do encoder delay properly, but on the other hand decoding is 100% accurate unlike FFmpeg (probably inaudible though).
|
||||
|
||||
So, don't use it unless you have a very good reason.
|
||||
- licensed under the Xiph.Org variant of the BSD license: https://www.xiph.org/licenses/bsd/speex/
|
||||
|
@ -127,7 +127,6 @@ All of these options are of type BOOL and can be set to either `ON` or `OFF`. Mo
|
||||
- **USE_MPEG**: Chooses if you wish to use libmpg123 for support of MP1/MP2/MP3. The default is `ON`.
|
||||
- **USE_VORBIS**: Chooses if you wish to use libvorbis for support of Vorbis. The default is `ON`.
|
||||
- **USE_FFMPEG**: Chooses if you wish to use FFmpeg for support of many codecs. The default is `ON`. `FFMPEG_PATH` can also be given, so it can use official/external SDK instead of the one used in vgmstream project.
|
||||
- **USE_MAIATRAC3PLUS**: Chooses if you wish to use MAIATRAC3+ for support of ATRAC3+. The default is `OFF`. It is not recommended to enable.
|
||||
- **USE_G7221**: Chooses if you wish to use G7221 for support of ITU-T G.722.1 annex C. The default is `ON`.
|
||||
- **USE_G719**: Chooses if you wish to use libg719_decode for support ITU-T G.719. The default is `ON`.
|
||||
- **USE_ATRAC9**: Chooses if you wish to use LibAtrac9 for support of ATRAC9. The default is `ON`.
|
||||
@ -167,7 +166,6 @@ If FDK-AAC/QAAC support is enabled, the following paths are required (with more
|
||||
|
||||
- **QAAC_PATH**: The path to the QAAC library. It can be obtained at https://github.com/kode54/qaac
|
||||
- **FDK_AAC_PATH**: The path to the FDK-AAC library. It can be obtained at https://github.com/kode54/fdk-aac
|
||||
- **MAIATRAC3PLUS_PATH**: The path to the MAIATRAC3+ library. If MAIATRAC3+ support is enabled, providing this path is required. It is not recommended to use.
|
||||
- **MPEG_PATH**: The path to the mpg123 library. It can be obtained from [the mpg123 project on SourceForge.net](https://sourceforge.net/projects/mpg123/files/mpg123/1.25.10/). If not set and static building is enabled, this will be downloaded automatically.
|
||||
- **FFMPEG_PATH**: The path to the FFmpeg source directory. It can be obtained at https://git.ffmpeg.org/ffmpeg.git If not set and static building is enabled, this will be downloaded automatically.
|
||||
- **G719_PATH**: The path to the G.719 decoder library. It can be obtained at https://github.com/kode54/libg719_decode If not set, it is downloaded automatically on Linux.
|
||||
|
@ -51,7 +51,7 @@ AllowShortIfStatementsOnASingleLine: Never
|
||||
### Code quality
|
||||
There is quite a bit of code that could be improved overall, and parts can feel a bit hacked together and brittle. But given how niche the project is and how few contributors there are, priority is given to adding and improving formats.
|
||||
|
||||
For regression testing there is a simple script that compares output of a previous version of vgmstream_cli with current. Some bugs may drastically change output when fixed (for example adjusting loops or decoding) so it could be hard to automate and maintain. There isn't an automated test suite at the moment, so tests are manually done as needed.
|
||||
For regression testing there is a simple script that compares output of a previous version of vgmstream-cli with current. Some bugs may drastically change output when fixed (for example adjusting loops or decoding) so it could be hard to automate and maintain. There isn't an automated test suite at the moment, so tests are manually done as needed.
|
||||
|
||||
Code is checked for leaks from time to time using detection tools, but most of vgmstream formats are quite simple and don't need to manage memory. It's mainly useful for files using external decoders or complex segmented/layered layout combos.
|
||||
```
|
||||
@ -59,7 +59,7 @@ Code is checked for leaks from time to time using detection tools, but most of v
|
||||
make vgmstream_cli EXTRA_CFLAGS="-g" STRIP=echo
|
||||
|
||||
# find leaks
|
||||
drmemory -- vgmstream_cli -o file.ext
|
||||
drmemory -- vgmstream-cli -o file.ext
|
||||
```
|
||||
|
||||
Code is reasonably secure: some parts like IO are designed in a way should avoid segfaults, memory allocation is kept to minimum, and buffer handling is often very limited and simple making overflows unlikely. However, parts may cause division-by-zero or even infinite loops on bad data (fixed as known), no fuzz testing is done (some segfaults may remain, specially for complex codecs), and since vgmstream uses some external libraries/codecs there may be issues with old versions (updated at times).
|
||||
@ -114,7 +114,7 @@ Quick list of some audio terms used through vgmstream, applied to code. Mainly m
|
||||
vgmstream works by parsing a music stream header (*meta/*), preparing/controlling data and sample buffers (*layout/*) and decoding the compressed data into listenable PCM samples (*coding/*).
|
||||
|
||||
Very simplified it goes like this:
|
||||
- player (test.exe, plugin, etc) opens a file stream (STREAMFILE) *[plugin's main/decode]*
|
||||
- player (CLI, plugin, etc) opens a file stream (STREAMFILE) *[plugin's main/decode]*
|
||||
- init tries all parsers (metas) until one works *[init_vgmstream]*
|
||||
- parser reads header (channels, sample rate, loop points) and set ups the VGMSTREAM struct, if the format is correct *[init_vgmstream_(format-name)]*
|
||||
- player finds total_samples to play, based on the number of loops and other settings *[get_vgmstream_play_samples]*
|
||||
|
@ -10,7 +10,6 @@ This list is not complete and many other files are supported.
|
||||
- .ast
|
||||
- .bg00
|
||||
- .bmdx
|
||||
- .ccc
|
||||
- .cnk
|
||||
- .enth
|
||||
- .fag
|
||||
@ -39,7 +38,6 @@ This list is not complete and many other files are supported.
|
||||
- .rnd
|
||||
- .rstm
|
||||
- .rws
|
||||
- .rxw
|
||||
- .snd
|
||||
- .sfs
|
||||
- .sl3
|
||||
|
50
doc/USAGE.md
50
doc/USAGE.md
@ -13,17 +13,17 @@ Put the following files somewhere Windows can find them:
|
||||
- `libvorbis.dll`
|
||||
- `libmpg123-0.dll`
|
||||
- `libg719_decode.dll`
|
||||
- `avcodec-vgmstream-58.dll`
|
||||
- `avformat-vgmstream-58.dll`
|
||||
- `avutil-vgmstream-56.dll`
|
||||
- `swresample-vgmstream-3.dll`
|
||||
- `avcodec-vgmstream-59.dll`
|
||||
- `avformat-vgmstream-59.dll`
|
||||
- `avutil-vgmstream-57.dll`
|
||||
- `swresample-vgmstream-4.dll`
|
||||
- `libatrac9.dll`
|
||||
- `libcelt-0061.dll`
|
||||
- `libcelt-0110.dll`
|
||||
- `libspeex.dll`
|
||||
- `libspeex-1.dll`
|
||||
|
||||
For command line (`test.exe`) and XMPlay this means in the directory with the main `.exe`,
|
||||
or possibly a directory in the PATH variable.
|
||||
For command line (`vgmstream-cli.exe`) and XMPlay this means in the directory with the main
|
||||
`.exe`, or possibly a directory in the PATH variable.
|
||||
|
||||
For Winamp, the above `.dll` also go near main `winamp.exe`, but note that `in_vgmstream.dll`
|
||||
plugin itself goes in `Plugins`.
|
||||
@ -34,25 +34,25 @@ automatically, though not all may enabled at the moment due to build scripts iss
|
||||
|
||||
## Components
|
||||
|
||||
### test.exe/vgmstream-cli (command line decoder)
|
||||
*Windows*: unzip `test.exe` and follow the above instructions for installing needed extra files.
|
||||
`test.exe` is used for historical reasons, but you can call it `vgmstream-cli.exe`, anyway.
|
||||
### vgmstream-cli (command line decoder)
|
||||
*Windows*: unzip `vgmstream-cli` and follow the above instructions for installing needed extra files.
|
||||
This tool was called `test.exe` before for historical reasons (rename back if needed).
|
||||
|
||||
*Others*: build instructions can be found in the [BUILD.md](BUILD.md) document (can be compiled
|
||||
with CMake/Make/autotools).
|
||||
|
||||
Converts playable files to `.wav`. Typical usage would be:
|
||||
- `test.exe -o happy.wav happy.adx` to decode `happy.adx` to `happy.wav`.
|
||||
- `vgmstream-cli -o happy.wav happy.adx` to decode `happy.adx` to `happy.wav`.
|
||||
|
||||
If command-line isn't your thing you can simply drag and drop one or multiple
|
||||
files to the executable to decode them as `(filename.ext).wav`.
|
||||
|
||||
There are multiple options that alter how the file is converted, for example:
|
||||
- `test.exe -m file.adx`: print info but don't decode
|
||||
- `test.exe -i -o file_noloop.wav file.hca`: convert without looping
|
||||
- `test.exe -s 2 -F file.fsb`: write 2nd subsong + ending after 2.0 loops
|
||||
- `test.exe -l 3.0 -f 5.0 -d 3.0 file.wem`: 3 loops, 3s delay, 5s fade
|
||||
- `test.exe -o bgm_?f.wav file1.adx file2.adx`: convert multiple files to `bgm_(name).wav`
|
||||
- `vgmstream-cli -m file.adx`: print info but don't decode
|
||||
- `vgmstream-cli -i -o file_noloop.wav file.hca`: convert without looping
|
||||
- `vgmstream-cli -s 2 -F file.fsb`: write 2nd subsong + ending after 2.0 loops
|
||||
- `vgmstream-cli -l 3.0 -f 5.0 -d 3.0 file.wem`: 3 loops, 3s delay, 5s fade
|
||||
- `vgmstream-cli -o bgm_?f.wav file1.adx file2.adx`: convert multiple files to `bgm_(name).wav`
|
||||
|
||||
Available commands are printed when run with no flags. Note that you can also
|
||||
achieve similar results for other plugins using TXTP, described later.
|
||||
@ -63,7 +63,7 @@ Output filename in `-o` may use wildcards:
|
||||
- `?n`: internal stream name, or input filename if format doesn't have name
|
||||
- `?f`: input filename
|
||||
|
||||
For example `test.exe -s 2 -o ?04s_?n.wav file.fsb` could generate `0002_song1.wav`.
|
||||
For example `vgmstream-cli -s 2 -o ?04s_?n.wav file.fsb` could generate `0002_song1.wav`.
|
||||
Default output filename is `?f.wav`, or `?f#?s.wav` if you set subsongs (`-s/-S`).
|
||||
|
||||
|
||||
@ -221,17 +221,17 @@ is able to contain them. Easiest to use would be the *foobar/winamp/Audacious*
|
||||
plugins, that are able to "unpack" those subsongs automatically into the playlist.
|
||||
|
||||
With CLI tools, you can select a subsong using the `-s` flag followed by a number,
|
||||
for example: `text.exe -s 5 file.bank` or `vgmstream123 -s 5 file.bank`.
|
||||
for example: `vgmstream-cli -s 5 file.bank` or `vgmstream123 -s 5 file.bank`.
|
||||
|
||||
Using *vgmstream-cli* you can convert multiple subsongs at once using the `-S` flag.
|
||||
**WARNING, MAY TAKE A LOT OF SPACE!** Some files have been observed to contain +20000
|
||||
subsongs, so don't use this lightly. Remember to set an output name (`-o`) with subsong
|
||||
wildcards (or leave it alone for the defaults).
|
||||
- `test.exe -s 1 -S 100 file.bank`: writes from subsong 1 to subsong 100
|
||||
- `test.exe -s 101 -S 0 file.bank`: writes from subsong 101 to max subsong (automatically changes 0 to max)
|
||||
- `test.exe -S 0 file.bank`: writes from subsong 1 to max subsong
|
||||
- `test.exe -s 1 -S 5 -o bgm.wav file.bank`: writes 5 subsongs, but all overwrite the same file = wrong.
|
||||
- `test.exe -s 1 -S 5 -o bgm_?02s.wav file.bank`: writes 5 subsongs, each named differently = correct.
|
||||
- `vgmstream-cli -s 1 -S 100 file.bank`: writes from subsong 1 to subsong 100
|
||||
- `vgmstream-cli -s 101 -S 0 file.bank`: writes from subsong 101 to max subsong (automatically changes 0 to max)
|
||||
- `vgmstream-cli -S 0 file.bank`: writes from subsong 1 to max subsong
|
||||
- `vgmstream-cli -s 1 -S 5 -o bgm.wav file.bank`: writes 5 subsongs, but all overwrite the same file = wrong.
|
||||
- `vgmstream-cli -s 1 -S 5 -o bgm_?02s.wav file.bank`: writes 5 subsongs, each named differently = correct.
|
||||
|
||||
For other players without support, or to play only a few choice subsongs, you
|
||||
can create multiple `.txtp` (explained later) to select one, like `bgm.sxd#10.txtp`
|
||||
@ -239,7 +239,7 @@ can create multiple `.txtp` (explained later) to select one, like `bgm.sxd#10.tx
|
||||
|
||||
You can use this python script to autogenerate one `.txtp` per subsong:
|
||||
https://github.com/vgmstream/vgmstream/tree/master/cli/tools/txtp_maker.py
|
||||
Put in the same dir as test.exe/vgmstream_cli, then to drag-and-drop files with
|
||||
Put in the same dir as *vgmstream-cli*, then to drag-and-drop files with
|
||||
subsongs to `txtp_maker.py` (it has CLI options to control output too).
|
||||
|
||||
### Common and unknown extensions
|
||||
@ -881,7 +881,7 @@ boss2_3ningumi_ver6.adx #l 1.0 #F .txtp
|
||||
You can also use it in CLI for quick access to some txtp-exclusive functions:
|
||||
```
|
||||
# force change sample rate to 22050 (don't forget to use " with spaces)
|
||||
test.exe -o btl_koopa1_44k_lp.wav "btl_koopa1_44k_lp.brstm #h22050.txtp"
|
||||
vgmstream-cli -o btl_koopa1_44k_lp.wav "btl_koopa1_44k_lp.brstm #h22050.txtp"
|
||||
```
|
||||
|
||||
Support for this feature is limited by player itself, as foobar and Winamp allow
|
||||
|
@ -57,15 +57,15 @@
|
||||
/** State of the decoder. One decoder state is needed for each stream.
|
||||
It is initialised once at the beginning of the stream. Do *not*
|
||||
re-initialise the state for every frame */
|
||||
typedef struct CELT0061Decoder CELT0061Decoder;
|
||||
typedef struct CELT0110Decoder CELT0110Decoder;
|
||||
typedef struct CELTDecoder0061 CELTDecoder0061;
|
||||
typedef struct CELTDecoder CELTDecoder0110;
|
||||
|
||||
/** The mode contains all the information necessary to create an
|
||||
encoder. Both the encoder and decoder need to be initialised
|
||||
with exactly the same mode, otherwise the quality will be very
|
||||
bad */
|
||||
typedef struct CELT0061Mode CELT0061Mode;
|
||||
typedef struct CELT0110Mode CELT0110Mode;
|
||||
typedef struct CELTMode0061 CELTMode0061;
|
||||
typedef struct CELTMode0110 CELTMode0110;
|
||||
|
||||
|
||||
/* Mode calls */
|
||||
@ -80,19 +80,19 @@ typedef struct CELT0110Mode CELT0110Mode;
|
||||
@param error Returned error code (if NULL, no error will be returned)
|
||||
@return A newly created mode
|
||||
*/
|
||||
EXPORT CELT0061Mode *celt_0061_mode_create(celt_int32 Fs, int channels, int frame_size, int *error);
|
||||
EXPORT CELT0110Mode *celt_0110_mode_create(celt_int32 Fs, int frame_size, int *error);
|
||||
/*EXPORT*/ CELTMode0061 *celt_mode_create_0061(celt_int32 Fs, int channels, int frame_size, int *error);
|
||||
/*EXPORT*/ CELTMode0110 *celt_mode_create_0110(celt_int32 Fs, int frame_size, int *error);
|
||||
|
||||
/** Destroys a mode struct. Only call this after all encoders and
|
||||
decoders using this mode are destroyed as well.
|
||||
@param mode Mode to be destroyed
|
||||
*/
|
||||
EXPORT void celt_0061_mode_destroy(CELT0061Mode *mode);
|
||||
EXPORT void celt_0110_mode_destroy(CELT0110Mode *mode);
|
||||
/*EXPORT*/ void celt_mode_destroy_0061(CELTMode0061 *mode);
|
||||
/*EXPORT*/ void celt_mode_destroy_0110(CELTMode0110 *mode);
|
||||
|
||||
/** Query information from a mode */
|
||||
EXPORT int celt_0061_mode_info(const CELT0061Mode *mode, int request, celt_int32 *value);
|
||||
EXPORT int celt_0110_mode_info(const CELT0110Mode *mode, int request, celt_int32 *value);
|
||||
/*EXPORT*/ int celt_mode_info_0061(const CELTMode0061 *mode, int request, celt_int32 *value);
|
||||
/*EXPORT*/ int celt_mode_info_0110(const CELTMode0110 *mode, int request, celt_int32 *value);
|
||||
|
||||
|
||||
/* Decoder stuff */
|
||||
@ -105,14 +105,14 @@ EXPORT int celt_0110_mode_info(const CELT0110Mode *mode, int request, celt_int32
|
||||
@param error Returns an error code
|
||||
@return Newly created decoder state.
|
||||
*/
|
||||
EXPORT CELT0061Decoder *celt_0061_decoder_create(const CELT0061Mode *mode);
|
||||
EXPORT CELT0110Decoder *celt_0110_decoder_create_custom(const CELT0110Mode *mode, int channels, int *error);
|
||||
/*EXPORT*/ CELTDecoder0061 *celt_decoder_create_0061(const CELTMode0061 *mode);
|
||||
/*EXPORT*/ CELTDecoder0110 *celt_decoder_create_custom_0110(const CELTMode0110 *mode, int channels, int *error);
|
||||
|
||||
/** Destroys a a decoder state.
|
||||
@param st Decoder state to be destroyed
|
||||
*/
|
||||
EXPORT void celt_0061_decoder_destroy(CELT0061Decoder *st);
|
||||
EXPORT void celt_0110_decoder_destroy(CELT0110Decoder *st);
|
||||
/*EXPORT*/ void celt_decoder_destroy_0061(CELTDecoder0061 *st);
|
||||
/*EXPORT*/ void celt_decoder_destroy_0110(CELTDecoder0110 *st);
|
||||
|
||||
/** Decodes a frame of audio.
|
||||
@param st Decoder state
|
||||
@ -123,8 +123,8 @@ EXPORT void celt_0110_decoder_destroy(CELT0110Decoder *st);
|
||||
returned here in 16-bit PCM format (native endian).
|
||||
@return Error code.
|
||||
*/
|
||||
EXPORT int celt_0061_decode(CELT0061Decoder *st, const unsigned char *data, int len, celt_int16 *pcm);
|
||||
EXPORT int celt_0110_decode(CELT0110Decoder *st, const unsigned char *data, int len, celt_int16 *pcm, int frame_size);
|
||||
/*EXPORT*/ int celt_decode_0061(CELTDecoder0061 *st, const unsigned char *data, int len, celt_int16 *pcm);
|
||||
/*EXPORT*/ int celt_decode_0110(CELTDecoder0110 *st, const unsigned char *data, int len, celt_int16 *pcm, int frame_size);
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -67,6 +67,10 @@ typedef struct AVDCT {
|
||||
ptrdiff_t line_size);
|
||||
|
||||
int bits_per_sample;
|
||||
|
||||
void (*get_pixels_unaligned)(int16_t *block /* align 16 */,
|
||||
const uint8_t *pixels,
|
||||
ptrdiff_t line_size);
|
||||
} AVDCT;
|
||||
|
||||
/**
|
||||
|
328
ext_includes/ffmpeg/libavcodec/bsf.h
Normal file
328
ext_includes/ffmpeg/libavcodec/bsf.h
Normal file
@ -0,0 +1,328 @@
|
||||
/*
|
||||
* Bitstream filters public API
|
||||
*
|
||||
* 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_BSF_H
|
||||
#define AVCODEC_BSF_H
|
||||
|
||||
#include "libavutil/dict.h"
|
||||
#include "libavutil/log.h"
|
||||
#include "libavutil/rational.h"
|
||||
|
||||
#include "codec_id.h"
|
||||
#include "codec_par.h"
|
||||
#include "packet.h"
|
||||
|
||||
/**
|
||||
* @defgroup lavc_bsf Bitstream filters
|
||||
* @ingroup libavc
|
||||
*
|
||||
* Bitstream filters transform encoded media data without decoding it. This
|
||||
* allows e.g. manipulating various header values. Bitstream filters operate on
|
||||
* @ref AVPacket "AVPackets".
|
||||
*
|
||||
* The bitstream filtering API is centered around two structures:
|
||||
* AVBitStreamFilter and AVBSFContext. The former represents a bitstream filter
|
||||
* in abstract, the latter a specific filtering process. Obtain an
|
||||
* AVBitStreamFilter using av_bsf_get_by_name() or av_bsf_iterate(), then pass
|
||||
* it to av_bsf_alloc() to create an AVBSFContext. Fill in the user-settable
|
||||
* AVBSFContext fields, as described in its documentation, then call
|
||||
* av_bsf_init() to prepare the filter context for use.
|
||||
*
|
||||
* Submit packets for filtering using av_bsf_send_packet(), obtain filtered
|
||||
* results with av_bsf_receive_packet(). When no more input packets will be
|
||||
* sent, submit a NULL AVPacket to signal the end of the stream to the filter.
|
||||
* av_bsf_receive_packet() will then return trailing packets, if any are
|
||||
* produced by the filter.
|
||||
*
|
||||
* Finally, free the filter context with av_bsf_free().
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* The bitstream filter state.
|
||||
*
|
||||
* This struct must be allocated with av_bsf_alloc() and freed with
|
||||
* av_bsf_free().
|
||||
*
|
||||
* The fields in the struct will only be changed (by the caller or by the
|
||||
* filter) as described in their documentation, and are to be considered
|
||||
* immutable otherwise.
|
||||
*/
|
||||
typedef struct AVBSFContext {
|
||||
/**
|
||||
* A class for logging and AVOptions
|
||||
*/
|
||||
const AVClass *av_class;
|
||||
|
||||
/**
|
||||
* The bitstream filter this context is an instance of.
|
||||
*/
|
||||
const struct AVBitStreamFilter *filter;
|
||||
|
||||
/**
|
||||
* Opaque filter-specific private data. If filter->priv_class is non-NULL,
|
||||
* this is an AVOptions-enabled struct.
|
||||
*/
|
||||
void *priv_data;
|
||||
|
||||
/**
|
||||
* Parameters of the input stream. This field is allocated in
|
||||
* av_bsf_alloc(), it needs to be filled by the caller before
|
||||
* av_bsf_init().
|
||||
*/
|
||||
AVCodecParameters *par_in;
|
||||
|
||||
/**
|
||||
* Parameters of the output stream. This field is allocated in
|
||||
* av_bsf_alloc(), it is set by the filter in av_bsf_init().
|
||||
*/
|
||||
AVCodecParameters *par_out;
|
||||
|
||||
/**
|
||||
* The timebase used for the timestamps of the input packets. Set by the
|
||||
* caller before av_bsf_init().
|
||||
*/
|
||||
AVRational time_base_in;
|
||||
|
||||
/**
|
||||
* The timebase used for the timestamps of the output packets. Set by the
|
||||
* filter in av_bsf_init().
|
||||
*/
|
||||
AVRational time_base_out;
|
||||
} AVBSFContext;
|
||||
|
||||
typedef struct AVBitStreamFilter {
|
||||
const char *name;
|
||||
|
||||
/**
|
||||
* A list of codec ids supported by the filter, terminated by
|
||||
* AV_CODEC_ID_NONE.
|
||||
* May be NULL, in that case the bitstream filter works with any codec id.
|
||||
*/
|
||||
const enum AVCodecID *codec_ids;
|
||||
|
||||
/**
|
||||
* A class for the private data, used to declare bitstream filter private
|
||||
* AVOptions. This field is NULL for bitstream filters that do not declare
|
||||
* any options.
|
||||
*
|
||||
* If this field is non-NULL, the first member of the filter private data
|
||||
* must be a pointer to AVClass, which will be set by libavcodec generic
|
||||
* code to this class.
|
||||
*/
|
||||
const AVClass *priv_class;
|
||||
} AVBitStreamFilter;
|
||||
|
||||
/**
|
||||
* @return a bitstream filter with the specified name or NULL if no such
|
||||
* bitstream filter exists.
|
||||
*/
|
||||
const AVBitStreamFilter *av_bsf_get_by_name(const char *name);
|
||||
|
||||
/**
|
||||
* Iterate over all registered bitstream filters.
|
||||
*
|
||||
* @param opaque a pointer where libavcodec will store the iteration state. Must
|
||||
* point to NULL to start the iteration.
|
||||
*
|
||||
* @return the next registered bitstream filter or NULL when the iteration is
|
||||
* finished
|
||||
*/
|
||||
const AVBitStreamFilter *av_bsf_iterate(void **opaque);
|
||||
|
||||
/**
|
||||
* Allocate a context for a given bitstream filter. The caller must fill in the
|
||||
* context parameters as described in the documentation and then call
|
||||
* av_bsf_init() before sending any data to the filter.
|
||||
*
|
||||
* @param filter the filter for which to allocate an instance.
|
||||
* @param[out] ctx a pointer into which the pointer to the newly-allocated context
|
||||
* will be written. It must be freed with av_bsf_free() after the
|
||||
* filtering is done.
|
||||
*
|
||||
* @return 0 on success, a negative AVERROR code on failure
|
||||
*/
|
||||
int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **ctx);
|
||||
|
||||
/**
|
||||
* Prepare the filter for use, after all the parameters and options have been
|
||||
* set.
|
||||
*/
|
||||
int av_bsf_init(AVBSFContext *ctx);
|
||||
|
||||
/**
|
||||
* Submit a packet for filtering.
|
||||
*
|
||||
* After sending each packet, the filter must be completely drained by calling
|
||||
* av_bsf_receive_packet() repeatedly until it returns AVERROR(EAGAIN) or
|
||||
* AVERROR_EOF.
|
||||
*
|
||||
* @param pkt the packet to filter. The bitstream filter will take ownership of
|
||||
* the packet and reset the contents of pkt. pkt is not touched if an error occurs.
|
||||
* If pkt is empty (i.e. NULL, or pkt->data is NULL and pkt->side_data_elems zero),
|
||||
* it signals the end of the stream (i.e. no more non-empty packets will be sent;
|
||||
* sending more empty packets does nothing) and will cause the filter to output
|
||||
* any packets it may have buffered internally.
|
||||
*
|
||||
* @return
|
||||
* - 0 on success.
|
||||
* - AVERROR(EAGAIN) if packets need to be retrieved from the filter (using
|
||||
* av_bsf_receive_packet()) before new input can be consumed.
|
||||
* - Another negative AVERROR value if an error occurs.
|
||||
*/
|
||||
int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt);
|
||||
|
||||
/**
|
||||
* Retrieve a filtered packet.
|
||||
*
|
||||
* @param[out] pkt this struct will be filled with the contents of the filtered
|
||||
* packet. It is owned by the caller and must be freed using
|
||||
* av_packet_unref() when it is no longer needed.
|
||||
* This parameter should be "clean" (i.e. freshly allocated
|
||||
* with av_packet_alloc() or unreffed with av_packet_unref())
|
||||
* when this function is called. If this function returns
|
||||
* successfully, the contents of pkt will be completely
|
||||
* overwritten by the returned data. On failure, pkt is not
|
||||
* touched.
|
||||
*
|
||||
* @return
|
||||
* - 0 on success.
|
||||
* - AVERROR(EAGAIN) if more packets need to be sent to the filter (using
|
||||
* av_bsf_send_packet()) to get more output.
|
||||
* - AVERROR_EOF if there will be no further output from the filter.
|
||||
* - Another negative AVERROR value if an error occurs.
|
||||
*
|
||||
* @note one input packet may result in several output packets, so after sending
|
||||
* a packet with av_bsf_send_packet(), this function needs to be called
|
||||
* repeatedly until it stops returning 0. It is also possible for a filter to
|
||||
* output fewer packets than were sent to it, so this function may return
|
||||
* AVERROR(EAGAIN) immediately after a successful av_bsf_send_packet() call.
|
||||
*/
|
||||
int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt);
|
||||
|
||||
/**
|
||||
* Reset the internal bitstream filter state. Should be called e.g. when seeking.
|
||||
*/
|
||||
void av_bsf_flush(AVBSFContext *ctx);
|
||||
|
||||
/**
|
||||
* Free a bitstream filter context and everything associated with it; write NULL
|
||||
* into the supplied pointer.
|
||||
*/
|
||||
void av_bsf_free(AVBSFContext **ctx);
|
||||
|
||||
/**
|
||||
* Get the AVClass for AVBSFContext. It can be used in combination with
|
||||
* AV_OPT_SEARCH_FAKE_OBJ for examining options.
|
||||
*
|
||||
* @see av_opt_find().
|
||||
*/
|
||||
const AVClass *av_bsf_get_class(void);
|
||||
|
||||
/**
|
||||
* Structure for chain/list of bitstream filters.
|
||||
* Empty list can be allocated by av_bsf_list_alloc().
|
||||
*/
|
||||
typedef struct AVBSFList AVBSFList;
|
||||
|
||||
/**
|
||||
* Allocate empty list of bitstream filters.
|
||||
* The list must be later freed by av_bsf_list_free()
|
||||
* or finalized by av_bsf_list_finalize().
|
||||
*
|
||||
* @return Pointer to @ref AVBSFList on success, NULL in case of failure
|
||||
*/
|
||||
AVBSFList *av_bsf_list_alloc(void);
|
||||
|
||||
/**
|
||||
* Free list of bitstream filters.
|
||||
*
|
||||
* @param lst Pointer to pointer returned by av_bsf_list_alloc()
|
||||
*/
|
||||
void av_bsf_list_free(AVBSFList **lst);
|
||||
|
||||
/**
|
||||
* Append bitstream filter to the list of bitstream filters.
|
||||
*
|
||||
* @param lst List to append to
|
||||
* @param bsf Filter context to be appended
|
||||
*
|
||||
* @return >=0 on success, negative AVERROR in case of failure
|
||||
*/
|
||||
int av_bsf_list_append(AVBSFList *lst, AVBSFContext *bsf);
|
||||
|
||||
/**
|
||||
* Construct new bitstream filter context given it's name and options
|
||||
* and append it to the list of bitstream filters.
|
||||
*
|
||||
* @param lst List to append to
|
||||
* @param bsf_name Name of the bitstream filter
|
||||
* @param options Options for the bitstream filter, can be set to NULL
|
||||
*
|
||||
* @return >=0 on success, negative AVERROR in case of failure
|
||||
*/
|
||||
int av_bsf_list_append2(AVBSFList *lst, const char * bsf_name, AVDictionary **options);
|
||||
/**
|
||||
* Finalize list of bitstream filters.
|
||||
*
|
||||
* This function will transform @ref AVBSFList to single @ref AVBSFContext,
|
||||
* so the whole chain of bitstream filters can be treated as single filter
|
||||
* freshly allocated by av_bsf_alloc().
|
||||
* If the call is successful, @ref AVBSFList structure is freed and lst
|
||||
* will be set to NULL. In case of failure, caller is responsible for
|
||||
* freeing the structure by av_bsf_list_free()
|
||||
*
|
||||
* @param lst Filter list structure to be transformed
|
||||
* @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure
|
||||
* representing the chain of bitstream filters
|
||||
*
|
||||
* @return >=0 on success, negative AVERROR in case of failure
|
||||
*/
|
||||
int av_bsf_list_finalize(AVBSFList **lst, AVBSFContext **bsf);
|
||||
|
||||
/**
|
||||
* Parse string describing list of bitstream filters and create single
|
||||
* @ref AVBSFContext describing the whole chain of bitstream filters.
|
||||
* Resulting @ref AVBSFContext can be treated as any other @ref AVBSFContext freshly
|
||||
* allocated by av_bsf_alloc().
|
||||
*
|
||||
* @param str String describing chain of bitstream filters in format
|
||||
* `bsf1[=opt1=val1:opt2=val2][,bsf2]`
|
||||
* @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure
|
||||
* representing the chain of bitstream filters
|
||||
*
|
||||
* @return >=0 on success, negative AVERROR in case of failure
|
||||
*/
|
||||
int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf);
|
||||
|
||||
/**
|
||||
* Get null/pass-through bitstream filter.
|
||||
*
|
||||
* @param[out] bsf Pointer to be set to new instance of pass-through bitstream filter
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int av_bsf_get_null_filter(AVBSFContext **bsf);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif // AVCODEC_BSF_H
|
387
ext_includes/ffmpeg/libavcodec/codec.h
Normal file
387
ext_includes/ffmpeg/libavcodec/codec.h
Normal file
@ -0,0 +1,387 @@
|
||||
/*
|
||||
* AVCodec public API
|
||||
*
|
||||
* 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_CODEC_H
|
||||
#define AVCODEC_CODEC_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "libavutil/avutil.h"
|
||||
#include "libavutil/hwcontext.h"
|
||||
#include "libavutil/log.h"
|
||||
#include "libavutil/pixfmt.h"
|
||||
#include "libavutil/rational.h"
|
||||
#include "libavutil/samplefmt.h"
|
||||
|
||||
#include "libavcodec/codec_id.h"
|
||||
#include "libavcodec/version_major.h"
|
||||
|
||||
/**
|
||||
* @addtogroup lavc_core
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Decoder can use draw_horiz_band callback.
|
||||
*/
|
||||
#define AV_CODEC_CAP_DRAW_HORIZ_BAND (1 << 0)
|
||||
/**
|
||||
* Codec uses get_buffer() or get_encode_buffer() for allocating buffers and
|
||||
* supports custom allocators.
|
||||
* If not set, it might not use get_buffer() or get_encode_buffer() at all, or
|
||||
* use operations that assume the buffer was allocated by
|
||||
* avcodec_default_get_buffer2 or avcodec_default_get_encode_buffer.
|
||||
*/
|
||||
#define AV_CODEC_CAP_DR1 (1 << 1)
|
||||
#if FF_API_FLAG_TRUNCATED
|
||||
/**
|
||||
* @deprecated Use parsers to always send proper frames.
|
||||
*/
|
||||
#define AV_CODEC_CAP_TRUNCATED (1 << 3)
|
||||
#endif
|
||||
/**
|
||||
* Encoder or decoder requires flushing with NULL input at the end in order to
|
||||
* give the complete and correct output.
|
||||
*
|
||||
* NOTE: If this flag is not set, the codec is guaranteed to never be fed with
|
||||
* with NULL data. The user can still send NULL data to the public encode
|
||||
* or decode function, but libavcodec will not pass it along to the codec
|
||||
* unless this flag is set.
|
||||
*
|
||||
* Decoders:
|
||||
* The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL,
|
||||
* avpkt->size=0 at the end to get the delayed data until the decoder no longer
|
||||
* returns frames.
|
||||
*
|
||||
* Encoders:
|
||||
* The encoder needs to be fed with NULL data at the end of encoding until the
|
||||
* encoder no longer returns data.
|
||||
*
|
||||
* NOTE: For encoders implementing the AVCodec.encode2() function, setting this
|
||||
* flag also means that the encoder must set the pts and duration for
|
||||
* each output packet. If this flag is not set, the pts and duration will
|
||||
* be determined by libavcodec from the input frame.
|
||||
*/
|
||||
#define AV_CODEC_CAP_DELAY (1 << 5)
|
||||
/**
|
||||
* Codec can be fed a final frame with a smaller size.
|
||||
* This can be used to prevent truncation of the last audio samples.
|
||||
*/
|
||||
#define AV_CODEC_CAP_SMALL_LAST_FRAME (1 << 6)
|
||||
|
||||
/**
|
||||
* Codec can output multiple frames per AVPacket
|
||||
* Normally demuxers return one frame at a time, demuxers which do not do
|
||||
* are connected to a parser to split what they return into proper frames.
|
||||
* This flag is reserved to the very rare category of codecs which have a
|
||||
* bitstream that cannot be split into frames without timeconsuming
|
||||
* operations like full decoding. Demuxers carrying such bitstreams thus
|
||||
* may return multiple frames in a packet. This has many disadvantages like
|
||||
* prohibiting stream copy in many cases thus it should only be considered
|
||||
* as a last resort.
|
||||
*/
|
||||
#define AV_CODEC_CAP_SUBFRAMES (1 << 8)
|
||||
/**
|
||||
* Codec is experimental and is thus avoided in favor of non experimental
|
||||
* encoders
|
||||
*/
|
||||
#define AV_CODEC_CAP_EXPERIMENTAL (1 << 9)
|
||||
/**
|
||||
* Codec should fill in channel configuration and samplerate instead of container
|
||||
*/
|
||||
#define AV_CODEC_CAP_CHANNEL_CONF (1 << 10)
|
||||
/**
|
||||
* Codec supports frame-level multithreading.
|
||||
*/
|
||||
#define AV_CODEC_CAP_FRAME_THREADS (1 << 12)
|
||||
/**
|
||||
* Codec supports slice-based (or partition-based) multithreading.
|
||||
*/
|
||||
#define AV_CODEC_CAP_SLICE_THREADS (1 << 13)
|
||||
/**
|
||||
* Codec supports changed parameters at any point.
|
||||
*/
|
||||
#define AV_CODEC_CAP_PARAM_CHANGE (1 << 14)
|
||||
/**
|
||||
* Codec supports multithreading through a method other than slice- or
|
||||
* frame-level multithreading. Typically this marks wrappers around
|
||||
* multithreading-capable external libraries.
|
||||
*/
|
||||
#define AV_CODEC_CAP_OTHER_THREADS (1 << 15)
|
||||
#if FF_API_AUTO_THREADS
|
||||
#define AV_CODEC_CAP_AUTO_THREADS AV_CODEC_CAP_OTHER_THREADS
|
||||
#endif
|
||||
/**
|
||||
* Audio encoder supports receiving a different number of samples in each call.
|
||||
*/
|
||||
#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE (1 << 16)
|
||||
/**
|
||||
* Decoder is not a preferred choice for probing.
|
||||
* This indicates that the decoder is not a good choice for probing.
|
||||
* It could for example be an expensive to spin up hardware decoder,
|
||||
* or it could simply not provide a lot of useful information about
|
||||
* the stream.
|
||||
* A decoder marked with this flag should only be used as last resort
|
||||
* choice for probing.
|
||||
*/
|
||||
#define AV_CODEC_CAP_AVOID_PROBING (1 << 17)
|
||||
|
||||
#if FF_API_UNUSED_CODEC_CAPS
|
||||
/**
|
||||
* Deprecated and unused. Use AVCodecDescriptor.props instead
|
||||
*/
|
||||
#define AV_CODEC_CAP_INTRA_ONLY 0x40000000
|
||||
/**
|
||||
* Deprecated and unused. Use AVCodecDescriptor.props instead
|
||||
*/
|
||||
#define AV_CODEC_CAP_LOSSLESS 0x80000000
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Codec is backed by a hardware implementation. Typically used to
|
||||
* identify a non-hwaccel hardware decoder. For information about hwaccels, use
|
||||
* avcodec_get_hw_config() instead.
|
||||
*/
|
||||
#define AV_CODEC_CAP_HARDWARE (1 << 18)
|
||||
|
||||
/**
|
||||
* Codec is potentially backed by a hardware implementation, but not
|
||||
* necessarily. This is used instead of AV_CODEC_CAP_HARDWARE, if the
|
||||
* implementation provides some sort of internal fallback.
|
||||
*/
|
||||
#define AV_CODEC_CAP_HYBRID (1 << 19)
|
||||
|
||||
/**
|
||||
* This codec takes the reordered_opaque field from input AVFrames
|
||||
* and returns it in the corresponding field in AVCodecContext after
|
||||
* encoding.
|
||||
*/
|
||||
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE (1 << 20)
|
||||
|
||||
/**
|
||||
* This encoder can be flushed using avcodec_flush_buffers(). If this flag is
|
||||
* not set, the encoder must be closed and reopened to ensure that no frames
|
||||
* remain pending.
|
||||
*/
|
||||
#define AV_CODEC_CAP_ENCODER_FLUSH (1 << 21)
|
||||
|
||||
/**
|
||||
* AVProfile.
|
||||
*/
|
||||
typedef struct AVProfile {
|
||||
int profile;
|
||||
const char *name; ///< short name for the profile
|
||||
} AVProfile;
|
||||
|
||||
/**
|
||||
* AVCodec.
|
||||
*/
|
||||
typedef struct AVCodec {
|
||||
/**
|
||||
* Name of the codec implementation.
|
||||
* The name is globally unique among encoders and among decoders (but an
|
||||
* encoder and a decoder can share the same name).
|
||||
* This is the primary way to find a codec from the user perspective.
|
||||
*/
|
||||
const char *name;
|
||||
/**
|
||||
* Descriptive name for the codec, meant to be more human readable than name.
|
||||
* You should use the NULL_IF_CONFIG_SMALL() macro to define it.
|
||||
*/
|
||||
const char *long_name;
|
||||
enum AVMediaType type;
|
||||
enum AVCodecID id;
|
||||
/**
|
||||
* Codec capabilities.
|
||||
* see AV_CODEC_CAP_*
|
||||
*/
|
||||
int capabilities;
|
||||
uint8_t max_lowres; ///< maximum value for lowres supported by the decoder
|
||||
const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0}
|
||||
const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1
|
||||
const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
|
||||
const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
/**
|
||||
* @deprecated use ch_layouts instead
|
||||
*/
|
||||
attribute_deprecated
|
||||
const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
|
||||
#endif
|
||||
const AVClass *priv_class; ///< AVClass for the private context
|
||||
const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
|
||||
|
||||
/**
|
||||
* Group name of the codec implementation.
|
||||
* This is a short symbolic name of the wrapper backing this codec. A
|
||||
* wrapper uses some kind of external implementation for the codec, such
|
||||
* as an external library, or a codec implementation provided by the OS or
|
||||
* the hardware.
|
||||
* If this field is NULL, this is a builtin, libavcodec native codec.
|
||||
* If non-NULL, this will be the suffix in AVCodec.name in most cases
|
||||
* (usually AVCodec.name will be of the form "<codec_name>_<wrapper_name>").
|
||||
*/
|
||||
const char *wrapper_name;
|
||||
|
||||
/**
|
||||
* Array of supported channel layouts, terminated with a zeroed layout.
|
||||
*/
|
||||
const AVChannelLayout *ch_layouts;
|
||||
} AVCodec;
|
||||
|
||||
/**
|
||||
* Iterate over all registered codecs.
|
||||
*
|
||||
* @param opaque a pointer where libavcodec will store the iteration state. Must
|
||||
* point to NULL to start the iteration.
|
||||
*
|
||||
* @return the next registered codec or NULL when the iteration is
|
||||
* finished
|
||||
*/
|
||||
const AVCodec *av_codec_iterate(void **opaque);
|
||||
|
||||
/**
|
||||
* Find a registered decoder with a matching codec ID.
|
||||
*
|
||||
* @param id AVCodecID of the requested decoder
|
||||
* @return A decoder if one was found, NULL otherwise.
|
||||
*/
|
||||
const AVCodec *avcodec_find_decoder(enum AVCodecID id);
|
||||
|
||||
/**
|
||||
* Find a registered decoder with the specified name.
|
||||
*
|
||||
* @param name name of the requested decoder
|
||||
* @return A decoder if one was found, NULL otherwise.
|
||||
*/
|
||||
const AVCodec *avcodec_find_decoder_by_name(const char *name);
|
||||
|
||||
/**
|
||||
* Find a registered encoder with a matching codec ID.
|
||||
*
|
||||
* @param id AVCodecID of the requested encoder
|
||||
* @return An encoder if one was found, NULL otherwise.
|
||||
*/
|
||||
const AVCodec *avcodec_find_encoder(enum AVCodecID id);
|
||||
|
||||
/**
|
||||
* Find a registered encoder with the specified name.
|
||||
*
|
||||
* @param name name of the requested encoder
|
||||
* @return An encoder if one was found, NULL otherwise.
|
||||
*/
|
||||
const AVCodec *avcodec_find_encoder_by_name(const char *name);
|
||||
/**
|
||||
* @return a non-zero number if codec is an encoder, zero otherwise
|
||||
*/
|
||||
int av_codec_is_encoder(const AVCodec *codec);
|
||||
|
||||
/**
|
||||
* @return a non-zero number if codec is a decoder, zero otherwise
|
||||
*/
|
||||
int av_codec_is_decoder(const AVCodec *codec);
|
||||
|
||||
/**
|
||||
* Return a name for the specified profile, if available.
|
||||
*
|
||||
* @param codec the codec that is searched for the given profile
|
||||
* @param profile the profile value for which a name is requested
|
||||
* @return A name for the profile if found, NULL otherwise.
|
||||
*/
|
||||
const char *av_get_profile_name(const AVCodec *codec, int profile);
|
||||
|
||||
enum {
|
||||
/**
|
||||
* The codec supports this format via the hw_device_ctx interface.
|
||||
*
|
||||
* When selecting this format, AVCodecContext.hw_device_ctx should
|
||||
* have been set to a device of the specified type before calling
|
||||
* avcodec_open2().
|
||||
*/
|
||||
AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX = 0x01,
|
||||
/**
|
||||
* The codec supports this format via the hw_frames_ctx interface.
|
||||
*
|
||||
* When selecting this format for a decoder,
|
||||
* AVCodecContext.hw_frames_ctx should be set to a suitable frames
|
||||
* context inside the get_format() callback. The frames context
|
||||
* must have been created on a device of the specified type.
|
||||
*
|
||||
* When selecting this format for an encoder,
|
||||
* AVCodecContext.hw_frames_ctx should be set to the context which
|
||||
* will be used for the input frames before calling avcodec_open2().
|
||||
*/
|
||||
AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX = 0x02,
|
||||
/**
|
||||
* The codec supports this format by some internal method.
|
||||
*
|
||||
* This format can be selected without any additional configuration -
|
||||
* no device or frames context is required.
|
||||
*/
|
||||
AV_CODEC_HW_CONFIG_METHOD_INTERNAL = 0x04,
|
||||
/**
|
||||
* The codec supports this format by some ad-hoc method.
|
||||
*
|
||||
* Additional settings and/or function calls are required. See the
|
||||
* codec-specific documentation for details. (Methods requiring
|
||||
* this sort of configuration are deprecated and others should be
|
||||
* used in preference.)
|
||||
*/
|
||||
AV_CODEC_HW_CONFIG_METHOD_AD_HOC = 0x08,
|
||||
};
|
||||
|
||||
typedef struct AVCodecHWConfig {
|
||||
/**
|
||||
* For decoders, a hardware pixel format which that decoder may be
|
||||
* able to decode to if suitable hardware is available.
|
||||
*
|
||||
* For encoders, a pixel format which the encoder may be able to
|
||||
* accept. If set to AV_PIX_FMT_NONE, this applies to all pixel
|
||||
* formats supported by the codec.
|
||||
*/
|
||||
enum AVPixelFormat pix_fmt;
|
||||
/**
|
||||
* Bit set of AV_CODEC_HW_CONFIG_METHOD_* flags, describing the possible
|
||||
* setup methods which can be used with this configuration.
|
||||
*/
|
||||
int methods;
|
||||
/**
|
||||
* The device type associated with the configuration.
|
||||
*
|
||||
* Must be set for AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX and
|
||||
* AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX, otherwise unused.
|
||||
*/
|
||||
enum AVHWDeviceType device_type;
|
||||
} AVCodecHWConfig;
|
||||
|
||||
/**
|
||||
* Retrieve supported hardware configurations for a codec.
|
||||
*
|
||||
* Values of index from zero to some maximum return the indexed configuration
|
||||
* descriptor; all other values return NULL. If the codec does not support
|
||||
* any hardware configurations then it will always return NULL.
|
||||
*/
|
||||
const AVCodecHWConfig *avcodec_get_hw_config(const AVCodec *codec, int index);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* AVCODEC_CODEC_H */
|
128
ext_includes/ffmpeg/libavcodec/codec_desc.h
Normal file
128
ext_includes/ffmpeg/libavcodec/codec_desc.h
Normal file
@ -0,0 +1,128 @@
|
||||
/*
|
||||
* Codec descriptors public API
|
||||
*
|
||||
* 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_CODEC_DESC_H
|
||||
#define AVCODEC_CODEC_DESC_H
|
||||
|
||||
#include "libavutil/avutil.h"
|
||||
|
||||
#include "codec_id.h"
|
||||
|
||||
/**
|
||||
* @addtogroup lavc_core
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* This struct describes the properties of a single codec described by an
|
||||
* AVCodecID.
|
||||
* @see avcodec_descriptor_get()
|
||||
*/
|
||||
typedef struct AVCodecDescriptor {
|
||||
enum AVCodecID id;
|
||||
enum AVMediaType type;
|
||||
/**
|
||||
* Name of the codec described by this descriptor. It is non-empty and
|
||||
* unique for each codec descriptor. It should contain alphanumeric
|
||||
* characters and '_' only.
|
||||
*/
|
||||
const char *name;
|
||||
/**
|
||||
* A more descriptive name for this codec. May be NULL.
|
||||
*/
|
||||
const char *long_name;
|
||||
/**
|
||||
* Codec properties, a combination of AV_CODEC_PROP_* flags.
|
||||
*/
|
||||
int props;
|
||||
/**
|
||||
* MIME type(s) associated with the codec.
|
||||
* May be NULL; if not, a NULL-terminated array of MIME types.
|
||||
* The first item is always non-NULL and is the preferred MIME type.
|
||||
*/
|
||||
const char *const *mime_types;
|
||||
/**
|
||||
* If non-NULL, an array of profiles recognized for this codec.
|
||||
* Terminated with FF_PROFILE_UNKNOWN.
|
||||
*/
|
||||
const struct AVProfile *profiles;
|
||||
} AVCodecDescriptor;
|
||||
|
||||
/**
|
||||
* Codec uses only intra compression.
|
||||
* Video and audio codecs only.
|
||||
*/
|
||||
#define AV_CODEC_PROP_INTRA_ONLY (1 << 0)
|
||||
/**
|
||||
* Codec supports lossy compression. Audio and video codecs only.
|
||||
* @note a codec may support both lossy and lossless
|
||||
* compression modes
|
||||
*/
|
||||
#define AV_CODEC_PROP_LOSSY (1 << 1)
|
||||
/**
|
||||
* Codec supports lossless compression. Audio and video codecs only.
|
||||
*/
|
||||
#define AV_CODEC_PROP_LOSSLESS (1 << 2)
|
||||
/**
|
||||
* Codec supports frame reordering. That is, the coded order (the order in which
|
||||
* the encoded packets are output by the encoders / stored / input to the
|
||||
* decoders) may be different from the presentation order of the corresponding
|
||||
* frames.
|
||||
*
|
||||
* For codecs that do not have this property set, PTS and DTS should always be
|
||||
* equal.
|
||||
*/
|
||||
#define AV_CODEC_PROP_REORDER (1 << 3)
|
||||
/**
|
||||
* Subtitle codec is bitmap based
|
||||
* Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field.
|
||||
*/
|
||||
#define AV_CODEC_PROP_BITMAP_SUB (1 << 16)
|
||||
/**
|
||||
* Subtitle codec is text based.
|
||||
* Decoded AVSubtitle data can be read from the AVSubtitleRect->ass field.
|
||||
*/
|
||||
#define AV_CODEC_PROP_TEXT_SUB (1 << 17)
|
||||
|
||||
/**
|
||||
* @return descriptor for given codec ID or NULL if no descriptor exists.
|
||||
*/
|
||||
const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id);
|
||||
|
||||
/**
|
||||
* Iterate over all codec descriptors known to libavcodec.
|
||||
*
|
||||
* @param prev previous descriptor. NULL to get the first descriptor.
|
||||
*
|
||||
* @return next descriptor or NULL after the last descriptor
|
||||
*/
|
||||
const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev);
|
||||
|
||||
/**
|
||||
* @return codec descriptor with the given name or NULL if no such descriptor
|
||||
* exists.
|
||||
*/
|
||||
const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif // AVCODEC_CODEC_DESC_H
|
634
ext_includes/ffmpeg/libavcodec/codec_id.h
Normal file
634
ext_includes/ffmpeg/libavcodec/codec_id.h
Normal file
@ -0,0 +1,634 @@
|
||||
/*
|
||||
* Codec IDs
|
||||
*
|
||||
* 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_CODEC_ID_H
|
||||
#define AVCODEC_CODEC_ID_H
|
||||
|
||||
#include "libavutil/avutil.h"
|
||||
#include "libavutil/samplefmt.h"
|
||||
|
||||
/**
|
||||
* @addtogroup lavc_core
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Identify the syntax and semantics of the bitstream.
|
||||
* The principle is roughly:
|
||||
* Two decoders with the same ID can decode the same streams.
|
||||
* Two encoders with the same ID can encode compatible streams.
|
||||
* There may be slight deviations from the principle due to implementation
|
||||
* details.
|
||||
*
|
||||
* If you add a codec ID to this list, add it so that
|
||||
* 1. no value of an existing codec ID changes (that would break ABI),
|
||||
* 2. it is as close as possible to similar codecs
|
||||
*
|
||||
* After adding new codec IDs, do not forget to add an entry to the codec
|
||||
* descriptor list and bump libavcodec minor version.
|
||||
*/
|
||||
enum AVCodecID {
|
||||
AV_CODEC_ID_NONE,
|
||||
|
||||
/* video codecs */
|
||||
AV_CODEC_ID_MPEG1VIDEO,
|
||||
AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
|
||||
AV_CODEC_ID_H261,
|
||||
AV_CODEC_ID_H263,
|
||||
AV_CODEC_ID_RV10,
|
||||
AV_CODEC_ID_RV20,
|
||||
AV_CODEC_ID_MJPEG,
|
||||
AV_CODEC_ID_MJPEGB,
|
||||
AV_CODEC_ID_LJPEG,
|
||||
AV_CODEC_ID_SP5X,
|
||||
AV_CODEC_ID_JPEGLS,
|
||||
AV_CODEC_ID_MPEG4,
|
||||
AV_CODEC_ID_RAWVIDEO,
|
||||
AV_CODEC_ID_MSMPEG4V1,
|
||||
AV_CODEC_ID_MSMPEG4V2,
|
||||
AV_CODEC_ID_MSMPEG4V3,
|
||||
AV_CODEC_ID_WMV1,
|
||||
AV_CODEC_ID_WMV2,
|
||||
AV_CODEC_ID_H263P,
|
||||
AV_CODEC_ID_H263I,
|
||||
AV_CODEC_ID_FLV1,
|
||||
AV_CODEC_ID_SVQ1,
|
||||
AV_CODEC_ID_SVQ3,
|
||||
AV_CODEC_ID_DVVIDEO,
|
||||
AV_CODEC_ID_HUFFYUV,
|
||||
AV_CODEC_ID_CYUV,
|
||||
AV_CODEC_ID_H264,
|
||||
AV_CODEC_ID_INDEO3,
|
||||
AV_CODEC_ID_VP3,
|
||||
AV_CODEC_ID_THEORA,
|
||||
AV_CODEC_ID_ASV1,
|
||||
AV_CODEC_ID_ASV2,
|
||||
AV_CODEC_ID_FFV1,
|
||||
AV_CODEC_ID_4XM,
|
||||
AV_CODEC_ID_VCR1,
|
||||
AV_CODEC_ID_CLJR,
|
||||
AV_CODEC_ID_MDEC,
|
||||
AV_CODEC_ID_ROQ,
|
||||
AV_CODEC_ID_INTERPLAY_VIDEO,
|
||||
AV_CODEC_ID_XAN_WC3,
|
||||
AV_CODEC_ID_XAN_WC4,
|
||||
AV_CODEC_ID_RPZA,
|
||||
AV_CODEC_ID_CINEPAK,
|
||||
AV_CODEC_ID_WS_VQA,
|
||||
AV_CODEC_ID_MSRLE,
|
||||
AV_CODEC_ID_MSVIDEO1,
|
||||
AV_CODEC_ID_IDCIN,
|
||||
AV_CODEC_ID_8BPS,
|
||||
AV_CODEC_ID_SMC,
|
||||
AV_CODEC_ID_FLIC,
|
||||
AV_CODEC_ID_TRUEMOTION1,
|
||||
AV_CODEC_ID_VMDVIDEO,
|
||||
AV_CODEC_ID_MSZH,
|
||||
AV_CODEC_ID_ZLIB,
|
||||
AV_CODEC_ID_QTRLE,
|
||||
AV_CODEC_ID_TSCC,
|
||||
AV_CODEC_ID_ULTI,
|
||||
AV_CODEC_ID_QDRAW,
|
||||
AV_CODEC_ID_VIXL,
|
||||
AV_CODEC_ID_QPEG,
|
||||
AV_CODEC_ID_PNG,
|
||||
AV_CODEC_ID_PPM,
|
||||
AV_CODEC_ID_PBM,
|
||||
AV_CODEC_ID_PGM,
|
||||
AV_CODEC_ID_PGMYUV,
|
||||
AV_CODEC_ID_PAM,
|
||||
AV_CODEC_ID_FFVHUFF,
|
||||
AV_CODEC_ID_RV30,
|
||||
AV_CODEC_ID_RV40,
|
||||
AV_CODEC_ID_VC1,
|
||||
AV_CODEC_ID_WMV3,
|
||||
AV_CODEC_ID_LOCO,
|
||||
AV_CODEC_ID_WNV1,
|
||||
AV_CODEC_ID_AASC,
|
||||
AV_CODEC_ID_INDEO2,
|
||||
AV_CODEC_ID_FRAPS,
|
||||
AV_CODEC_ID_TRUEMOTION2,
|
||||
AV_CODEC_ID_BMP,
|
||||
AV_CODEC_ID_CSCD,
|
||||
AV_CODEC_ID_MMVIDEO,
|
||||
AV_CODEC_ID_ZMBV,
|
||||
AV_CODEC_ID_AVS,
|
||||
AV_CODEC_ID_SMACKVIDEO,
|
||||
AV_CODEC_ID_NUV,
|
||||
AV_CODEC_ID_KMVC,
|
||||
AV_CODEC_ID_FLASHSV,
|
||||
AV_CODEC_ID_CAVS,
|
||||
AV_CODEC_ID_JPEG2000,
|
||||
AV_CODEC_ID_VMNC,
|
||||
AV_CODEC_ID_VP5,
|
||||
AV_CODEC_ID_VP6,
|
||||
AV_CODEC_ID_VP6F,
|
||||
AV_CODEC_ID_TARGA,
|
||||
AV_CODEC_ID_DSICINVIDEO,
|
||||
AV_CODEC_ID_TIERTEXSEQVIDEO,
|
||||
AV_CODEC_ID_TIFF,
|
||||
AV_CODEC_ID_GIF,
|
||||
AV_CODEC_ID_DXA,
|
||||
AV_CODEC_ID_DNXHD,
|
||||
AV_CODEC_ID_THP,
|
||||
AV_CODEC_ID_SGI,
|
||||
AV_CODEC_ID_C93,
|
||||
AV_CODEC_ID_BETHSOFTVID,
|
||||
AV_CODEC_ID_PTX,
|
||||
AV_CODEC_ID_TXD,
|
||||
AV_CODEC_ID_VP6A,
|
||||
AV_CODEC_ID_AMV,
|
||||
AV_CODEC_ID_VB,
|
||||
AV_CODEC_ID_PCX,
|
||||
AV_CODEC_ID_SUNRAST,
|
||||
AV_CODEC_ID_INDEO4,
|
||||
AV_CODEC_ID_INDEO5,
|
||||
AV_CODEC_ID_MIMIC,
|
||||
AV_CODEC_ID_RL2,
|
||||
AV_CODEC_ID_ESCAPE124,
|
||||
AV_CODEC_ID_DIRAC,
|
||||
AV_CODEC_ID_BFI,
|
||||
AV_CODEC_ID_CMV,
|
||||
AV_CODEC_ID_MOTIONPIXELS,
|
||||
AV_CODEC_ID_TGV,
|
||||
AV_CODEC_ID_TGQ,
|
||||
AV_CODEC_ID_TQI,
|
||||
AV_CODEC_ID_AURA,
|
||||
AV_CODEC_ID_AURA2,
|
||||
AV_CODEC_ID_V210X,
|
||||
AV_CODEC_ID_TMV,
|
||||
AV_CODEC_ID_V210,
|
||||
AV_CODEC_ID_DPX,
|
||||
AV_CODEC_ID_MAD,
|
||||
AV_CODEC_ID_FRWU,
|
||||
AV_CODEC_ID_FLASHSV2,
|
||||
AV_CODEC_ID_CDGRAPHICS,
|
||||
AV_CODEC_ID_R210,
|
||||
AV_CODEC_ID_ANM,
|
||||
AV_CODEC_ID_BINKVIDEO,
|
||||
AV_CODEC_ID_IFF_ILBM,
|
||||
#define AV_CODEC_ID_IFF_BYTERUN1 AV_CODEC_ID_IFF_ILBM
|
||||
AV_CODEC_ID_KGV1,
|
||||
AV_CODEC_ID_YOP,
|
||||
AV_CODEC_ID_VP8,
|
||||
AV_CODEC_ID_PICTOR,
|
||||
AV_CODEC_ID_ANSI,
|
||||
AV_CODEC_ID_A64_MULTI,
|
||||
AV_CODEC_ID_A64_MULTI5,
|
||||
AV_CODEC_ID_R10K,
|
||||
AV_CODEC_ID_MXPEG,
|
||||
AV_CODEC_ID_LAGARITH,
|
||||
AV_CODEC_ID_PRORES,
|
||||
AV_CODEC_ID_JV,
|
||||
AV_CODEC_ID_DFA,
|
||||
AV_CODEC_ID_WMV3IMAGE,
|
||||
AV_CODEC_ID_VC1IMAGE,
|
||||
AV_CODEC_ID_UTVIDEO,
|
||||
AV_CODEC_ID_BMV_VIDEO,
|
||||
AV_CODEC_ID_VBLE,
|
||||
AV_CODEC_ID_DXTORY,
|
||||
AV_CODEC_ID_V410,
|
||||
AV_CODEC_ID_XWD,
|
||||
AV_CODEC_ID_CDXL,
|
||||
AV_CODEC_ID_XBM,
|
||||
AV_CODEC_ID_ZEROCODEC,
|
||||
AV_CODEC_ID_MSS1,
|
||||
AV_CODEC_ID_MSA1,
|
||||
AV_CODEC_ID_TSCC2,
|
||||
AV_CODEC_ID_MTS2,
|
||||
AV_CODEC_ID_CLLC,
|
||||
AV_CODEC_ID_MSS2,
|
||||
AV_CODEC_ID_VP9,
|
||||
AV_CODEC_ID_AIC,
|
||||
AV_CODEC_ID_ESCAPE130,
|
||||
AV_CODEC_ID_G2M,
|
||||
AV_CODEC_ID_WEBP,
|
||||
AV_CODEC_ID_HNM4_VIDEO,
|
||||
AV_CODEC_ID_HEVC,
|
||||
#define AV_CODEC_ID_H265 AV_CODEC_ID_HEVC
|
||||
AV_CODEC_ID_FIC,
|
||||
AV_CODEC_ID_ALIAS_PIX,
|
||||
AV_CODEC_ID_BRENDER_PIX,
|
||||
AV_CODEC_ID_PAF_VIDEO,
|
||||
AV_CODEC_ID_EXR,
|
||||
AV_CODEC_ID_VP7,
|
||||
AV_CODEC_ID_SANM,
|
||||
AV_CODEC_ID_SGIRLE,
|
||||
AV_CODEC_ID_MVC1,
|
||||
AV_CODEC_ID_MVC2,
|
||||
AV_CODEC_ID_HQX,
|
||||
AV_CODEC_ID_TDSC,
|
||||
AV_CODEC_ID_HQ_HQA,
|
||||
AV_CODEC_ID_HAP,
|
||||
AV_CODEC_ID_DDS,
|
||||
AV_CODEC_ID_DXV,
|
||||
AV_CODEC_ID_SCREENPRESSO,
|
||||
AV_CODEC_ID_RSCC,
|
||||
AV_CODEC_ID_AVS2,
|
||||
AV_CODEC_ID_PGX,
|
||||
AV_CODEC_ID_AVS3,
|
||||
AV_CODEC_ID_MSP2,
|
||||
AV_CODEC_ID_VVC,
|
||||
#define AV_CODEC_ID_H266 AV_CODEC_ID_VVC
|
||||
AV_CODEC_ID_Y41P,
|
||||
AV_CODEC_ID_AVRP,
|
||||
AV_CODEC_ID_012V,
|
||||
AV_CODEC_ID_AVUI,
|
||||
AV_CODEC_ID_AYUV,
|
||||
AV_CODEC_ID_TARGA_Y216,
|
||||
AV_CODEC_ID_V308,
|
||||
AV_CODEC_ID_V408,
|
||||
AV_CODEC_ID_YUV4,
|
||||
AV_CODEC_ID_AVRN,
|
||||
AV_CODEC_ID_CPIA,
|
||||
AV_CODEC_ID_XFACE,
|
||||
AV_CODEC_ID_SNOW,
|
||||
AV_CODEC_ID_SMVJPEG,
|
||||
AV_CODEC_ID_APNG,
|
||||
AV_CODEC_ID_DAALA,
|
||||
AV_CODEC_ID_CFHD,
|
||||
AV_CODEC_ID_TRUEMOTION2RT,
|
||||
AV_CODEC_ID_M101,
|
||||
AV_CODEC_ID_MAGICYUV,
|
||||
AV_CODEC_ID_SHEERVIDEO,
|
||||
AV_CODEC_ID_YLC,
|
||||
AV_CODEC_ID_PSD,
|
||||
AV_CODEC_ID_PIXLET,
|
||||
AV_CODEC_ID_SPEEDHQ,
|
||||
AV_CODEC_ID_FMVC,
|
||||
AV_CODEC_ID_SCPR,
|
||||
AV_CODEC_ID_CLEARVIDEO,
|
||||
AV_CODEC_ID_XPM,
|
||||
AV_CODEC_ID_AV1,
|
||||
AV_CODEC_ID_BITPACKED,
|
||||
AV_CODEC_ID_MSCC,
|
||||
AV_CODEC_ID_SRGC,
|
||||
AV_CODEC_ID_SVG,
|
||||
AV_CODEC_ID_GDV,
|
||||
AV_CODEC_ID_FITS,
|
||||
AV_CODEC_ID_IMM4,
|
||||
AV_CODEC_ID_PROSUMER,
|
||||
AV_CODEC_ID_MWSC,
|
||||
AV_CODEC_ID_WCMV,
|
||||
AV_CODEC_ID_RASC,
|
||||
AV_CODEC_ID_HYMT,
|
||||
AV_CODEC_ID_ARBC,
|
||||
AV_CODEC_ID_AGM,
|
||||
AV_CODEC_ID_LSCR,
|
||||
AV_CODEC_ID_VP4,
|
||||
AV_CODEC_ID_IMM5,
|
||||
AV_CODEC_ID_MVDV,
|
||||
AV_CODEC_ID_MVHA,
|
||||
AV_CODEC_ID_CDTOONS,
|
||||
AV_CODEC_ID_MV30,
|
||||
AV_CODEC_ID_NOTCHLC,
|
||||
AV_CODEC_ID_PFM,
|
||||
AV_CODEC_ID_MOBICLIP,
|
||||
AV_CODEC_ID_PHOTOCD,
|
||||
AV_CODEC_ID_IPU,
|
||||
AV_CODEC_ID_ARGO,
|
||||
AV_CODEC_ID_CRI,
|
||||
AV_CODEC_ID_SIMBIOSIS_IMX,
|
||||
AV_CODEC_ID_SGA_VIDEO,
|
||||
AV_CODEC_ID_GEM,
|
||||
AV_CODEC_ID_VBN,
|
||||
AV_CODEC_ID_JPEGXL,
|
||||
AV_CODEC_ID_QOI,
|
||||
AV_CODEC_ID_PHM,
|
||||
|
||||
/* various PCM "codecs" */
|
||||
AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
|
||||
AV_CODEC_ID_PCM_S16LE = 0x10000,
|
||||
AV_CODEC_ID_PCM_S16BE,
|
||||
AV_CODEC_ID_PCM_U16LE,
|
||||
AV_CODEC_ID_PCM_U16BE,
|
||||
AV_CODEC_ID_PCM_S8,
|
||||
AV_CODEC_ID_PCM_U8,
|
||||
AV_CODEC_ID_PCM_MULAW,
|
||||
AV_CODEC_ID_PCM_ALAW,
|
||||
AV_CODEC_ID_PCM_S32LE,
|
||||
AV_CODEC_ID_PCM_S32BE,
|
||||
AV_CODEC_ID_PCM_U32LE,
|
||||
AV_CODEC_ID_PCM_U32BE,
|
||||
AV_CODEC_ID_PCM_S24LE,
|
||||
AV_CODEC_ID_PCM_S24BE,
|
||||
AV_CODEC_ID_PCM_U24LE,
|
||||
AV_CODEC_ID_PCM_U24BE,
|
||||
AV_CODEC_ID_PCM_S24DAUD,
|
||||
AV_CODEC_ID_PCM_ZORK,
|
||||
AV_CODEC_ID_PCM_S16LE_PLANAR,
|
||||
AV_CODEC_ID_PCM_DVD,
|
||||
AV_CODEC_ID_PCM_F32BE,
|
||||
AV_CODEC_ID_PCM_F32LE,
|
||||
AV_CODEC_ID_PCM_F64BE,
|
||||
AV_CODEC_ID_PCM_F64LE,
|
||||
AV_CODEC_ID_PCM_BLURAY,
|
||||
AV_CODEC_ID_PCM_LXF,
|
||||
AV_CODEC_ID_S302M,
|
||||
AV_CODEC_ID_PCM_S8_PLANAR,
|
||||
AV_CODEC_ID_PCM_S24LE_PLANAR,
|
||||
AV_CODEC_ID_PCM_S32LE_PLANAR,
|
||||
AV_CODEC_ID_PCM_S16BE_PLANAR,
|
||||
AV_CODEC_ID_PCM_S64LE,
|
||||
AV_CODEC_ID_PCM_S64BE,
|
||||
AV_CODEC_ID_PCM_F16LE,
|
||||
AV_CODEC_ID_PCM_F24LE,
|
||||
AV_CODEC_ID_PCM_VIDC,
|
||||
AV_CODEC_ID_PCM_SGA,
|
||||
|
||||
/* various ADPCM codecs */
|
||||
AV_CODEC_ID_ADPCM_IMA_QT = 0x11000,
|
||||
AV_CODEC_ID_ADPCM_IMA_WAV,
|
||||
AV_CODEC_ID_ADPCM_IMA_DK3,
|
||||
AV_CODEC_ID_ADPCM_IMA_DK4,
|
||||
AV_CODEC_ID_ADPCM_IMA_WS,
|
||||
AV_CODEC_ID_ADPCM_IMA_SMJPEG,
|
||||
AV_CODEC_ID_ADPCM_MS,
|
||||
AV_CODEC_ID_ADPCM_4XM,
|
||||
AV_CODEC_ID_ADPCM_XA,
|
||||
AV_CODEC_ID_ADPCM_ADX,
|
||||
AV_CODEC_ID_ADPCM_EA,
|
||||
AV_CODEC_ID_ADPCM_G726,
|
||||
AV_CODEC_ID_ADPCM_CT,
|
||||
AV_CODEC_ID_ADPCM_SWF,
|
||||
AV_CODEC_ID_ADPCM_YAMAHA,
|
||||
AV_CODEC_ID_ADPCM_SBPRO_4,
|
||||
AV_CODEC_ID_ADPCM_SBPRO_3,
|
||||
AV_CODEC_ID_ADPCM_SBPRO_2,
|
||||
AV_CODEC_ID_ADPCM_THP,
|
||||
AV_CODEC_ID_ADPCM_IMA_AMV,
|
||||
AV_CODEC_ID_ADPCM_EA_R1,
|
||||
AV_CODEC_ID_ADPCM_EA_R3,
|
||||
AV_CODEC_ID_ADPCM_EA_R2,
|
||||
AV_CODEC_ID_ADPCM_IMA_EA_SEAD,
|
||||
AV_CODEC_ID_ADPCM_IMA_EA_EACS,
|
||||
AV_CODEC_ID_ADPCM_EA_XAS,
|
||||
AV_CODEC_ID_ADPCM_EA_MAXIS_XA,
|
||||
AV_CODEC_ID_ADPCM_IMA_ISS,
|
||||
AV_CODEC_ID_ADPCM_G722,
|
||||
AV_CODEC_ID_ADPCM_IMA_APC,
|
||||
AV_CODEC_ID_ADPCM_VIMA,
|
||||
AV_CODEC_ID_ADPCM_AFC,
|
||||
AV_CODEC_ID_ADPCM_IMA_OKI,
|
||||
AV_CODEC_ID_ADPCM_DTK,
|
||||
AV_CODEC_ID_ADPCM_IMA_RAD,
|
||||
AV_CODEC_ID_ADPCM_G726LE,
|
||||
AV_CODEC_ID_ADPCM_THP_LE,
|
||||
AV_CODEC_ID_ADPCM_PSX,
|
||||
AV_CODEC_ID_ADPCM_AICA,
|
||||
AV_CODEC_ID_ADPCM_IMA_DAT4,
|
||||
AV_CODEC_ID_ADPCM_MTAF,
|
||||
AV_CODEC_ID_ADPCM_AGM,
|
||||
AV_CODEC_ID_ADPCM_ARGO,
|
||||
AV_CODEC_ID_ADPCM_IMA_SSI,
|
||||
AV_CODEC_ID_ADPCM_ZORK,
|
||||
AV_CODEC_ID_ADPCM_IMA_APM,
|
||||
AV_CODEC_ID_ADPCM_IMA_ALP,
|
||||
AV_CODEC_ID_ADPCM_IMA_MTF,
|
||||
AV_CODEC_ID_ADPCM_IMA_CUNNING,
|
||||
AV_CODEC_ID_ADPCM_IMA_MOFLEX,
|
||||
AV_CODEC_ID_ADPCM_IMA_ACORN,
|
||||
|
||||
/* AMR */
|
||||
AV_CODEC_ID_AMR_NB = 0x12000,
|
||||
AV_CODEC_ID_AMR_WB,
|
||||
|
||||
/* RealAudio codecs*/
|
||||
AV_CODEC_ID_RA_144 = 0x13000,
|
||||
AV_CODEC_ID_RA_288,
|
||||
|
||||
/* various DPCM codecs */
|
||||
AV_CODEC_ID_ROQ_DPCM = 0x14000,
|
||||
AV_CODEC_ID_INTERPLAY_DPCM,
|
||||
AV_CODEC_ID_XAN_DPCM,
|
||||
AV_CODEC_ID_SOL_DPCM,
|
||||
AV_CODEC_ID_SDX2_DPCM,
|
||||
AV_CODEC_ID_GREMLIN_DPCM,
|
||||
AV_CODEC_ID_DERF_DPCM,
|
||||
|
||||
/* audio codecs */
|
||||
AV_CODEC_ID_MP2 = 0x15000,
|
||||
AV_CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
|
||||
AV_CODEC_ID_AAC,
|
||||
AV_CODEC_ID_AC3,
|
||||
AV_CODEC_ID_DTS,
|
||||
AV_CODEC_ID_VORBIS,
|
||||
AV_CODEC_ID_DVAUDIO,
|
||||
AV_CODEC_ID_WMAV1,
|
||||
AV_CODEC_ID_WMAV2,
|
||||
AV_CODEC_ID_MACE3,
|
||||
AV_CODEC_ID_MACE6,
|
||||
AV_CODEC_ID_VMDAUDIO,
|
||||
AV_CODEC_ID_FLAC,
|
||||
AV_CODEC_ID_MP3ADU,
|
||||
AV_CODEC_ID_MP3ON4,
|
||||
AV_CODEC_ID_SHORTEN,
|
||||
AV_CODEC_ID_ALAC,
|
||||
AV_CODEC_ID_WESTWOOD_SND1,
|
||||
AV_CODEC_ID_GSM, ///< as in Berlin toast format
|
||||
AV_CODEC_ID_QDM2,
|
||||
AV_CODEC_ID_COOK,
|
||||
AV_CODEC_ID_TRUESPEECH,
|
||||
AV_CODEC_ID_TTA,
|
||||
AV_CODEC_ID_SMACKAUDIO,
|
||||
AV_CODEC_ID_QCELP,
|
||||
AV_CODEC_ID_WAVPACK,
|
||||
AV_CODEC_ID_DSICINAUDIO,
|
||||
AV_CODEC_ID_IMC,
|
||||
AV_CODEC_ID_MUSEPACK7,
|
||||
AV_CODEC_ID_MLP,
|
||||
AV_CODEC_ID_GSM_MS, /* as found in WAV */
|
||||
AV_CODEC_ID_ATRAC3,
|
||||
AV_CODEC_ID_APE,
|
||||
AV_CODEC_ID_NELLYMOSER,
|
||||
AV_CODEC_ID_MUSEPACK8,
|
||||
AV_CODEC_ID_SPEEX,
|
||||
AV_CODEC_ID_WMAVOICE,
|
||||
AV_CODEC_ID_WMAPRO,
|
||||
AV_CODEC_ID_WMALOSSLESS,
|
||||
AV_CODEC_ID_ATRAC3P,
|
||||
AV_CODEC_ID_EAC3,
|
||||
AV_CODEC_ID_SIPR,
|
||||
AV_CODEC_ID_MP1,
|
||||
AV_CODEC_ID_TWINVQ,
|
||||
AV_CODEC_ID_TRUEHD,
|
||||
AV_CODEC_ID_MP4ALS,
|
||||
AV_CODEC_ID_ATRAC1,
|
||||
AV_CODEC_ID_BINKAUDIO_RDFT,
|
||||
AV_CODEC_ID_BINKAUDIO_DCT,
|
||||
AV_CODEC_ID_AAC_LATM,
|
||||
AV_CODEC_ID_QDMC,
|
||||
AV_CODEC_ID_CELT,
|
||||
AV_CODEC_ID_G723_1,
|
||||
AV_CODEC_ID_G729,
|
||||
AV_CODEC_ID_8SVX_EXP,
|
||||
AV_CODEC_ID_8SVX_FIB,
|
||||
AV_CODEC_ID_BMV_AUDIO,
|
||||
AV_CODEC_ID_RALF,
|
||||
AV_CODEC_ID_IAC,
|
||||
AV_CODEC_ID_ILBC,
|
||||
AV_CODEC_ID_OPUS,
|
||||
AV_CODEC_ID_COMFORT_NOISE,
|
||||
AV_CODEC_ID_TAK,
|
||||
AV_CODEC_ID_METASOUND,
|
||||
AV_CODEC_ID_PAF_AUDIO,
|
||||
AV_CODEC_ID_ON2AVC,
|
||||
AV_CODEC_ID_DSS_SP,
|
||||
AV_CODEC_ID_CODEC2,
|
||||
AV_CODEC_ID_FFWAVESYNTH,
|
||||
AV_CODEC_ID_SONIC,
|
||||
AV_CODEC_ID_SONIC_LS,
|
||||
AV_CODEC_ID_EVRC,
|
||||
AV_CODEC_ID_SMV,
|
||||
AV_CODEC_ID_DSD_LSBF,
|
||||
AV_CODEC_ID_DSD_MSBF,
|
||||
AV_CODEC_ID_DSD_LSBF_PLANAR,
|
||||
AV_CODEC_ID_DSD_MSBF_PLANAR,
|
||||
AV_CODEC_ID_4GV,
|
||||
AV_CODEC_ID_INTERPLAY_ACM,
|
||||
AV_CODEC_ID_XMA1,
|
||||
AV_CODEC_ID_XMA2,
|
||||
AV_CODEC_ID_DST,
|
||||
AV_CODEC_ID_ATRAC3AL,
|
||||
AV_CODEC_ID_ATRAC3PAL,
|
||||
AV_CODEC_ID_DOLBY_E,
|
||||
AV_CODEC_ID_APTX,
|
||||
AV_CODEC_ID_APTX_HD,
|
||||
AV_CODEC_ID_SBC,
|
||||
AV_CODEC_ID_ATRAC9,
|
||||
AV_CODEC_ID_HCOM,
|
||||
AV_CODEC_ID_ACELP_KELVIN,
|
||||
AV_CODEC_ID_MPEGH_3D_AUDIO,
|
||||
AV_CODEC_ID_SIREN,
|
||||
AV_CODEC_ID_HCA,
|
||||
AV_CODEC_ID_FASTAUDIO,
|
||||
AV_CODEC_ID_MSNSIREN,
|
||||
AV_CODEC_ID_DFPWM,
|
||||
|
||||
/* subtitle codecs */
|
||||
AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
|
||||
AV_CODEC_ID_DVD_SUBTITLE = 0x17000,
|
||||
AV_CODEC_ID_DVB_SUBTITLE,
|
||||
AV_CODEC_ID_TEXT, ///< raw UTF-8 text
|
||||
AV_CODEC_ID_XSUB,
|
||||
AV_CODEC_ID_SSA,
|
||||
AV_CODEC_ID_MOV_TEXT,
|
||||
AV_CODEC_ID_HDMV_PGS_SUBTITLE,
|
||||
AV_CODEC_ID_DVB_TELETEXT,
|
||||
AV_CODEC_ID_SRT,
|
||||
AV_CODEC_ID_MICRODVD,
|
||||
AV_CODEC_ID_EIA_608,
|
||||
AV_CODEC_ID_JACOSUB,
|
||||
AV_CODEC_ID_SAMI,
|
||||
AV_CODEC_ID_REALTEXT,
|
||||
AV_CODEC_ID_STL,
|
||||
AV_CODEC_ID_SUBVIEWER1,
|
||||
AV_CODEC_ID_SUBVIEWER,
|
||||
AV_CODEC_ID_SUBRIP,
|
||||
AV_CODEC_ID_WEBVTT,
|
||||
AV_CODEC_ID_MPL2,
|
||||
AV_CODEC_ID_VPLAYER,
|
||||
AV_CODEC_ID_PJS,
|
||||
AV_CODEC_ID_ASS,
|
||||
AV_CODEC_ID_HDMV_TEXT_SUBTITLE,
|
||||
AV_CODEC_ID_TTML,
|
||||
AV_CODEC_ID_ARIB_CAPTION,
|
||||
|
||||
/* other specific kind of codecs (generally used for attachments) */
|
||||
AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
|
||||
AV_CODEC_ID_TTF = 0x18000,
|
||||
|
||||
AV_CODEC_ID_SCTE_35, ///< Contain timestamp estimated through PCR of program stream.
|
||||
AV_CODEC_ID_EPG,
|
||||
AV_CODEC_ID_BINTEXT,
|
||||
AV_CODEC_ID_XBIN,
|
||||
AV_CODEC_ID_IDF,
|
||||
AV_CODEC_ID_OTF,
|
||||
AV_CODEC_ID_SMPTE_KLV,
|
||||
AV_CODEC_ID_DVD_NAV,
|
||||
AV_CODEC_ID_TIMED_ID3,
|
||||
AV_CODEC_ID_BIN_DATA,
|
||||
|
||||
|
||||
AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it
|
||||
|
||||
AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
|
||||
* stream (only used by libavformat) */
|
||||
AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems
|
||||
* stream (only used by libavformat) */
|
||||
AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information.
|
||||
AV_CODEC_ID_WRAPPED_AVFRAME = 0x21001, ///< Passthrough codec, AVFrames wrapped in AVPacket
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the type of the given codec.
|
||||
*/
|
||||
enum AVMediaType avcodec_get_type(enum AVCodecID codec_id);
|
||||
|
||||
/**
|
||||
* Get the name of a codec.
|
||||
* @return a static string identifying the codec; never NULL
|
||||
*/
|
||||
const char *avcodec_get_name(enum AVCodecID id);
|
||||
|
||||
/**
|
||||
* Return codec bits per sample.
|
||||
*
|
||||
* @param[in] codec_id the codec
|
||||
* @return Number of bits per sample or zero if unknown for the given codec.
|
||||
*/
|
||||
int av_get_bits_per_sample(enum AVCodecID codec_id);
|
||||
|
||||
/**
|
||||
* Return codec bits per sample.
|
||||
* Only return non-zero if the bits per sample is exactly correct, not an
|
||||
* approximation.
|
||||
*
|
||||
* @param[in] codec_id the codec
|
||||
* @return Number of bits per sample or zero if unknown for the given codec.
|
||||
*/
|
||||
int av_get_exact_bits_per_sample(enum AVCodecID codec_id);
|
||||
|
||||
/**
|
||||
* Return a name for the specified profile, if available.
|
||||
*
|
||||
* @param codec_id the ID of the codec to which the requested profile belongs
|
||||
* @param profile the profile value for which a name is requested
|
||||
* @return A name for the profile if found, NULL otherwise.
|
||||
*
|
||||
* @note unlike av_get_profile_name(), which searches a list of profiles
|
||||
* supported by a specific decoder or encoder implementation, this
|
||||
* function searches the list of profiles from the AVCodecDescriptor
|
||||
*/
|
||||
const char *avcodec_profile_name(enum AVCodecID codec_id, int profile);
|
||||
|
||||
/**
|
||||
* Return the PCM codec associated with a sample format.
|
||||
* @param be endianness, 0 for little, 1 for big,
|
||||
* -1 (or anything else) for native
|
||||
* @return AV_CODEC_ID_PCM_* or AV_CODEC_ID_NONE
|
||||
*/
|
||||
enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif // AVCODEC_CODEC_ID_H
|
246
ext_includes/ffmpeg/libavcodec/codec_par.h
Normal file
246
ext_includes/ffmpeg/libavcodec/codec_par.h
Normal file
@ -0,0 +1,246 @@
|
||||
/*
|
||||
* Codec parameters public API
|
||||
*
|
||||
* 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_CODEC_PAR_H
|
||||
#define AVCODEC_CODEC_PAR_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "libavutil/avutil.h"
|
||||
#include "libavutil/channel_layout.h"
|
||||
#include "libavutil/rational.h"
|
||||
#include "libavutil/pixfmt.h"
|
||||
|
||||
#include "codec_id.h"
|
||||
|
||||
/**
|
||||
* @addtogroup lavc_core
|
||||
*/
|
||||
|
||||
enum AVFieldOrder {
|
||||
AV_FIELD_UNKNOWN,
|
||||
AV_FIELD_PROGRESSIVE,
|
||||
AV_FIELD_TT, //< Top coded_first, top displayed first
|
||||
AV_FIELD_BB, //< Bottom coded first, bottom displayed first
|
||||
AV_FIELD_TB, //< Top coded first, bottom displayed first
|
||||
AV_FIELD_BT, //< Bottom coded first, top displayed first
|
||||
};
|
||||
|
||||
/**
|
||||
* This struct describes the properties of an encoded stream.
|
||||
*
|
||||
* sizeof(AVCodecParameters) is not a part of the public ABI, this struct must
|
||||
* be allocated with avcodec_parameters_alloc() and freed with
|
||||
* avcodec_parameters_free().
|
||||
*/
|
||||
typedef struct AVCodecParameters {
|
||||
/**
|
||||
* General type of the encoded data.
|
||||
*/
|
||||
enum AVMediaType codec_type;
|
||||
/**
|
||||
* Specific type of the encoded data (the codec used).
|
||||
*/
|
||||
enum AVCodecID codec_id;
|
||||
/**
|
||||
* Additional information about the codec (corresponds to the AVI FOURCC).
|
||||
*/
|
||||
uint32_t codec_tag;
|
||||
|
||||
/**
|
||||
* Extra binary data needed for initializing the decoder, codec-dependent.
|
||||
*
|
||||
* Must be allocated with av_malloc() and will be freed by
|
||||
* avcodec_parameters_free(). The allocated size of extradata must be at
|
||||
* least extradata_size + AV_INPUT_BUFFER_PADDING_SIZE, with the padding
|
||||
* bytes zeroed.
|
||||
*/
|
||||
uint8_t *extradata;
|
||||
/**
|
||||
* Size of the extradata content in bytes.
|
||||
*/
|
||||
int extradata_size;
|
||||
|
||||
/**
|
||||
* - video: the pixel format, the value corresponds to enum AVPixelFormat.
|
||||
* - audio: the sample format, the value corresponds to enum AVSampleFormat.
|
||||
*/
|
||||
int format;
|
||||
|
||||
/**
|
||||
* The average bitrate of the encoded data (in bits per second).
|
||||
*/
|
||||
int64_t bit_rate;
|
||||
|
||||
/**
|
||||
* The number of bits per sample in the codedwords.
|
||||
*
|
||||
* This is basically the bitrate per sample. It is mandatory for a bunch of
|
||||
* formats to actually decode them. It's the number of bits for one sample in
|
||||
* the actual coded bitstream.
|
||||
*
|
||||
* This could be for example 4 for ADPCM
|
||||
* For PCM formats this matches bits_per_raw_sample
|
||||
* Can be 0
|
||||
*/
|
||||
int bits_per_coded_sample;
|
||||
|
||||
/**
|
||||
* This is the number of valid bits in each output sample. If the
|
||||
* sample format has more bits, the least significant bits are additional
|
||||
* padding bits, which are always 0. Use right shifts to reduce the sample
|
||||
* to its actual size. For example, audio formats with 24 bit samples will
|
||||
* have bits_per_raw_sample set to 24, and format set to AV_SAMPLE_FMT_S32.
|
||||
* To get the original sample use "(int32_t)sample >> 8"."
|
||||
*
|
||||
* For ADPCM this might be 12 or 16 or similar
|
||||
* Can be 0
|
||||
*/
|
||||
int bits_per_raw_sample;
|
||||
|
||||
/**
|
||||
* Codec-specific bitstream restrictions that the stream conforms to.
|
||||
*/
|
||||
int profile;
|
||||
int level;
|
||||
|
||||
/**
|
||||
* Video only. The dimensions of the video frame in pixels.
|
||||
*/
|
||||
int width;
|
||||
int height;
|
||||
|
||||
/**
|
||||
* Video only. The aspect ratio (width / height) which a single pixel
|
||||
* should have when displayed.
|
||||
*
|
||||
* When the aspect ratio is unknown / undefined, the numerator should be
|
||||
* set to 0 (the denominator may have any value).
|
||||
*/
|
||||
AVRational sample_aspect_ratio;
|
||||
|
||||
/**
|
||||
* Video only. The order of the fields in interlaced video.
|
||||
*/
|
||||
enum AVFieldOrder field_order;
|
||||
|
||||
/**
|
||||
* Video only. Additional colorspace characteristics.
|
||||
*/
|
||||
enum AVColorRange color_range;
|
||||
enum AVColorPrimaries color_primaries;
|
||||
enum AVColorTransferCharacteristic color_trc;
|
||||
enum AVColorSpace color_space;
|
||||
enum AVChromaLocation chroma_location;
|
||||
|
||||
/**
|
||||
* Video only. Number of delayed frames.
|
||||
*/
|
||||
int video_delay;
|
||||
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
/**
|
||||
* Audio only. The channel layout bitmask. May be 0 if the channel layout is
|
||||
* unknown or unspecified, otherwise the number of bits set must be equal to
|
||||
* the channels field.
|
||||
* @deprecated use ch_layout
|
||||
*/
|
||||
attribute_deprecated
|
||||
uint64_t channel_layout;
|
||||
/**
|
||||
* Audio only. The number of audio channels.
|
||||
* @deprecated use ch_layout.nb_channels
|
||||
*/
|
||||
attribute_deprecated
|
||||
int channels;
|
||||
#endif
|
||||
/**
|
||||
* Audio only. The number of audio samples per second.
|
||||
*/
|
||||
int sample_rate;
|
||||
/**
|
||||
* Audio only. The number of bytes per coded audio frame, required by some
|
||||
* formats.
|
||||
*
|
||||
* Corresponds to nBlockAlign in WAVEFORMATEX.
|
||||
*/
|
||||
int block_align;
|
||||
/**
|
||||
* Audio only. Audio frame size, if known. Required by some formats to be static.
|
||||
*/
|
||||
int frame_size;
|
||||
|
||||
/**
|
||||
* Audio only. The amount of padding (in samples) inserted by the encoder at
|
||||
* the beginning of the audio. I.e. this number of leading decoded samples
|
||||
* must be discarded by the caller to get the original audio without leading
|
||||
* padding.
|
||||
*/
|
||||
int initial_padding;
|
||||
/**
|
||||
* Audio only. The amount of padding (in samples) appended by the encoder to
|
||||
* the end of the audio. I.e. this number of decoded samples must be
|
||||
* discarded by the caller from the end of the stream to get the original
|
||||
* audio without any trailing padding.
|
||||
*/
|
||||
int trailing_padding;
|
||||
/**
|
||||
* Audio only. Number of samples to skip after a discontinuity.
|
||||
*/
|
||||
int seek_preroll;
|
||||
|
||||
/**
|
||||
* Audio only. The channel layout and number of channels.
|
||||
*/
|
||||
AVChannelLayout ch_layout;
|
||||
} AVCodecParameters;
|
||||
|
||||
/**
|
||||
* Allocate a new AVCodecParameters and set its fields to default values
|
||||
* (unknown/invalid/0). The returned struct must be freed with
|
||||
* avcodec_parameters_free().
|
||||
*/
|
||||
AVCodecParameters *avcodec_parameters_alloc(void);
|
||||
|
||||
/**
|
||||
* Free an AVCodecParameters instance and everything associated with it and
|
||||
* write NULL to the supplied pointer.
|
||||
*/
|
||||
void avcodec_parameters_free(AVCodecParameters **par);
|
||||
|
||||
/**
|
||||
* Copy the contents of src to dst. Any allocated fields in dst are freed and
|
||||
* replaced with newly allocated duplicates of the corresponding fields in src.
|
||||
*
|
||||
* @return >= 0 on success, a negative AVERROR code on failure.
|
||||
*/
|
||||
int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src);
|
||||
|
||||
/**
|
||||
* This function is the same as av_get_audio_frame_duration(), except it works
|
||||
* with AVCodecParameters instead of an AVCodecContext.
|
||||
*/
|
||||
int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif // AVCODEC_CODEC_PAR_H
|
170
ext_includes/ffmpeg/libavcodec/defs.h
Normal file
170
ext_includes/ffmpeg/libavcodec/defs.h
Normal file
@ -0,0 +1,170 @@
|
||||
/*
|
||||
*
|
||||
* 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_DEFS_H
|
||||
#define AVCODEC_DEFS_H
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @ingroup libavc
|
||||
* Misc types and constants that do not belong anywhere else.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/**
|
||||
* @ingroup lavc_decoding
|
||||
* Required number of additionally allocated bytes at the end of the input bitstream for decoding.
|
||||
* This is mainly needed because some optimized bitstream readers read
|
||||
* 32 or 64 bit at once and could read over the end.<br>
|
||||
* Note: If the first 23 bits of the additional bytes are not 0, then damaged
|
||||
* MPEG bitstreams could cause overread and segfault.
|
||||
*/
|
||||
#define AV_INPUT_BUFFER_PADDING_SIZE 64
|
||||
|
||||
/**
|
||||
* @ingroup lavc_decoding
|
||||
*/
|
||||
enum AVDiscard{
|
||||
/* We leave some space between them for extensions (drop some
|
||||
* keyframes for intra-only or drop just some bidir frames). */
|
||||
AVDISCARD_NONE =-16, ///< discard nothing
|
||||
AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi
|
||||
AVDISCARD_NONREF = 8, ///< discard all non reference
|
||||
AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames
|
||||
AVDISCARD_NONINTRA= 24, ///< discard all non intra frames
|
||||
AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes
|
||||
AVDISCARD_ALL = 48, ///< discard all
|
||||
};
|
||||
|
||||
enum AVAudioServiceType {
|
||||
AV_AUDIO_SERVICE_TYPE_MAIN = 0,
|
||||
AV_AUDIO_SERVICE_TYPE_EFFECTS = 1,
|
||||
AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2,
|
||||
AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3,
|
||||
AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4,
|
||||
AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5,
|
||||
AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6,
|
||||
AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7,
|
||||
AV_AUDIO_SERVICE_TYPE_KARAOKE = 8,
|
||||
AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI
|
||||
};
|
||||
|
||||
/**
|
||||
* Pan Scan area.
|
||||
* This specifies the area which should be displayed.
|
||||
* Note there may be multiple such areas for one frame.
|
||||
*/
|
||||
typedef struct AVPanScan {
|
||||
/**
|
||||
* id
|
||||
* - encoding: Set by user.
|
||||
* - decoding: Set by libavcodec.
|
||||
*/
|
||||
int id;
|
||||
|
||||
/**
|
||||
* width and height in 1/16 pel
|
||||
* - encoding: Set by user.
|
||||
* - decoding: Set by libavcodec.
|
||||
*/
|
||||
int width;
|
||||
int height;
|
||||
|
||||
/**
|
||||
* position of the top left corner in 1/16 pel for up to 3 fields/frames
|
||||
* - encoding: Set by user.
|
||||
* - decoding: Set by libavcodec.
|
||||
*/
|
||||
int16_t position[3][2];
|
||||
} AVPanScan;
|
||||
|
||||
/**
|
||||
* This structure describes the bitrate properties of an encoded bitstream. It
|
||||
* roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD
|
||||
* parameters for H.264/HEVC.
|
||||
*/
|
||||
typedef struct AVCPBProperties {
|
||||
/**
|
||||
* Maximum bitrate of the stream, in bits per second.
|
||||
* Zero if unknown or unspecified.
|
||||
*/
|
||||
int64_t max_bitrate;
|
||||
/**
|
||||
* Minimum bitrate of the stream, in bits per second.
|
||||
* Zero if unknown or unspecified.
|
||||
*/
|
||||
int64_t min_bitrate;
|
||||
/**
|
||||
* Average bitrate of the stream, in bits per second.
|
||||
* Zero if unknown or unspecified.
|
||||
*/
|
||||
int64_t avg_bitrate;
|
||||
|
||||
/**
|
||||
* The size of the buffer to which the ratecontrol is applied, in bits.
|
||||
* Zero if unknown or unspecified.
|
||||
*/
|
||||
int64_t buffer_size;
|
||||
|
||||
/**
|
||||
* The delay between the time the packet this structure is associated with
|
||||
* is received and the time when it should be decoded, in periods of a 27MHz
|
||||
* clock.
|
||||
*
|
||||
* UINT64_MAX when unknown or unspecified.
|
||||
*/
|
||||
uint64_t vbv_delay;
|
||||
} AVCPBProperties;
|
||||
|
||||
/**
|
||||
* Allocate a CPB properties structure and initialize its fields to default
|
||||
* values.
|
||||
*
|
||||
* @param size if non-NULL, the size of the allocated struct will be written
|
||||
* here. This is useful for embedding it in side data.
|
||||
*
|
||||
* @return the newly allocated struct or NULL on failure
|
||||
*/
|
||||
AVCPBProperties *av_cpb_properties_alloc(size_t *size);
|
||||
|
||||
/**
|
||||
* This structure supplies correlation between a packet timestamp and a wall clock
|
||||
* production time. The definition follows the Producer Reference Time ('prft')
|
||||
* as defined in ISO/IEC 14496-12
|
||||
*/
|
||||
typedef struct AVProducerReferenceTime {
|
||||
/**
|
||||
* A UTC timestamp, in microseconds, since Unix epoch (e.g, av_gettime()).
|
||||
*/
|
||||
int64_t wallclock;
|
||||
int flags;
|
||||
} AVProducerReferenceTime;
|
||||
|
||||
/**
|
||||
* Encode extradata length to a buffer. Used by xiph codecs.
|
||||
*
|
||||
* @param s buffer to write to; must be at least (v/255+1) bytes long
|
||||
* @param v size of extradata in bytes
|
||||
* @return number of bytes written to the buffer.
|
||||
*/
|
||||
unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
|
||||
|
||||
#endif // AVCODEC_DEFS_H
|
@ -23,7 +23,6 @@
|
||||
|
||||
#include "libavutil/pixfmt.h"
|
||||
#include "libavutil/rational.h"
|
||||
#include "avcodec.h"
|
||||
|
||||
/* minimum number of bytes to read from a DV stream in order to
|
||||
* determine the profile */
|
||||
|
731
ext_includes/ffmpeg/libavcodec/packet.h
Normal file
731
ext_includes/ffmpeg/libavcodec/packet.h
Normal file
@ -0,0 +1,731 @@
|
||||
/*
|
||||
* AVPacket public API
|
||||
*
|
||||
* 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_PACKET_H
|
||||
#define AVCODEC_PACKET_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "libavutil/attributes.h"
|
||||
#include "libavutil/buffer.h"
|
||||
#include "libavutil/dict.h"
|
||||
#include "libavutil/rational.h"
|
||||
#include "libavutil/version.h"
|
||||
|
||||
#include "libavcodec/version_major.h"
|
||||
|
||||
/**
|
||||
* @defgroup lavc_packet AVPacket
|
||||
*
|
||||
* Types and functions for working with AVPacket.
|
||||
* @{
|
||||
*/
|
||||
enum AVPacketSideDataType {
|
||||
/**
|
||||
* An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE
|
||||
* bytes worth of palette. This side data signals that a new palette is
|
||||
* present.
|
||||
*/
|
||||
AV_PKT_DATA_PALETTE,
|
||||
|
||||
/**
|
||||
* The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format
|
||||
* that the extradata buffer was changed and the receiving side should
|
||||
* act upon it appropriately. The new extradata is embedded in the side
|
||||
* data buffer and should be immediately used for processing the current
|
||||
* frame or packet.
|
||||
*/
|
||||
AV_PKT_DATA_NEW_EXTRADATA,
|
||||
|
||||
/**
|
||||
* An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
|
||||
* @code
|
||||
* u32le param_flags
|
||||
* if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT)
|
||||
* s32le channel_count
|
||||
* if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT)
|
||||
* u64le channel_layout
|
||||
* if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE)
|
||||
* s32le sample_rate
|
||||
* if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS)
|
||||
* s32le width
|
||||
* s32le height
|
||||
* @endcode
|
||||
*/
|
||||
AV_PKT_DATA_PARAM_CHANGE,
|
||||
|
||||
/**
|
||||
* An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of
|
||||
* structures with info about macroblocks relevant to splitting the
|
||||
* packet into smaller packets on macroblock edges (e.g. as for RFC 2190).
|
||||
* That is, it does not necessarily contain info about all macroblocks,
|
||||
* as long as the distance between macroblocks in the info is smaller
|
||||
* than the target payload size.
|
||||
* Each MB info structure is 12 bytes, and is laid out as follows:
|
||||
* @code
|
||||
* u32le bit offset from the start of the packet
|
||||
* u8 current quantizer at the start of the macroblock
|
||||
* u8 GOB number
|
||||
* u16le macroblock address within the GOB
|
||||
* u8 horizontal MV predictor
|
||||
* u8 vertical MV predictor
|
||||
* u8 horizontal MV predictor for block number 3
|
||||
* u8 vertical MV predictor for block number 3
|
||||
* @endcode
|
||||
*/
|
||||
AV_PKT_DATA_H263_MB_INFO,
|
||||
|
||||
/**
|
||||
* This side data should be associated with an audio stream and contains
|
||||
* ReplayGain information in form of the AVReplayGain struct.
|
||||
*/
|
||||
AV_PKT_DATA_REPLAYGAIN,
|
||||
|
||||
/**
|
||||
* This side data contains a 3x3 transformation matrix describing an affine
|
||||
* transformation that needs to be applied to the decoded video frames for
|
||||
* correct presentation.
|
||||
*
|
||||
* See libavutil/display.h for a detailed description of the data.
|
||||
*/
|
||||
AV_PKT_DATA_DISPLAYMATRIX,
|
||||
|
||||
/**
|
||||
* This side data should be associated with a video stream and contains
|
||||
* Stereoscopic 3D information in form of the AVStereo3D struct.
|
||||
*/
|
||||
AV_PKT_DATA_STEREO3D,
|
||||
|
||||
/**
|
||||
* This side data should be associated with an audio stream and corresponds
|
||||
* to enum AVAudioServiceType.
|
||||
*/
|
||||
AV_PKT_DATA_AUDIO_SERVICE_TYPE,
|
||||
|
||||
/**
|
||||
* This side data contains quality related information from the encoder.
|
||||
* @code
|
||||
* u32le quality factor of the compressed frame. Allowed range is between 1 (good) and FF_LAMBDA_MAX (bad).
|
||||
* u8 picture type
|
||||
* u8 error count
|
||||
* u16 reserved
|
||||
* u64le[error count] sum of squared differences between encoder in and output
|
||||
* @endcode
|
||||
*/
|
||||
AV_PKT_DATA_QUALITY_STATS,
|
||||
|
||||
/**
|
||||
* This side data contains an integer value representing the stream index
|
||||
* of a "fallback" track. A fallback track indicates an alternate
|
||||
* track to use when the current track can not be decoded for some reason.
|
||||
* e.g. no decoder available for codec.
|
||||
*/
|
||||
AV_PKT_DATA_FALLBACK_TRACK,
|
||||
|
||||
/**
|
||||
* This side data corresponds to the AVCPBProperties struct.
|
||||
*/
|
||||
AV_PKT_DATA_CPB_PROPERTIES,
|
||||
|
||||
/**
|
||||
* Recommmends skipping the specified number of 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_PKT_DATA_SKIP_SAMPLES,
|
||||
|
||||
/**
|
||||
* An AV_PKT_DATA_JP_DUALMONO side data packet indicates that
|
||||
* the packet may contain "dual mono" audio specific to Japanese DTV
|
||||
* and if it is true, recommends only the selected channel to be used.
|
||||
* @code
|
||||
* u8 selected channels (0=mail/left, 1=sub/right, 2=both)
|
||||
* @endcode
|
||||
*/
|
||||
AV_PKT_DATA_JP_DUALMONO,
|
||||
|
||||
/**
|
||||
* A list of zero terminated key/value strings. There is no end marker for
|
||||
* the list, so it is required to rely on the side data size to stop.
|
||||
*/
|
||||
AV_PKT_DATA_STRINGS_METADATA,
|
||||
|
||||
/**
|
||||
* Subtitle event position
|
||||
* @code
|
||||
* u32le x1
|
||||
* u32le y1
|
||||
* u32le x2
|
||||
* u32le y2
|
||||
* @endcode
|
||||
*/
|
||||
AV_PKT_DATA_SUBTITLE_POSITION,
|
||||
|
||||
/**
|
||||
* Data found in BlockAdditional element of matroska container. There is
|
||||
* no end marker for the data, so it is required to rely on the side data
|
||||
* size to recognize the end. 8 byte id (as found in BlockAddId) followed
|
||||
* by data.
|
||||
*/
|
||||
AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
|
||||
|
||||
/**
|
||||
* The optional first identifier line of a WebVTT cue.
|
||||
*/
|
||||
AV_PKT_DATA_WEBVTT_IDENTIFIER,
|
||||
|
||||
/**
|
||||
* The optional settings (rendering instructions) that immediately
|
||||
* follow the timestamp specifier of a WebVTT cue.
|
||||
*/
|
||||
AV_PKT_DATA_WEBVTT_SETTINGS,
|
||||
|
||||
/**
|
||||
* A list of zero terminated key/value strings. There is no end marker for
|
||||
* the list, so it is required to rely on the side data size to stop. This
|
||||
* side data includes updated metadata which appeared in the stream.
|
||||
*/
|
||||
AV_PKT_DATA_METADATA_UPDATE,
|
||||
|
||||
/**
|
||||
* MPEGTS stream ID as uint8_t, this is required to pass the stream ID
|
||||
* information from the demuxer to the corresponding muxer.
|
||||
*/
|
||||
AV_PKT_DATA_MPEGTS_STREAM_ID,
|
||||
|
||||
/**
|
||||
* Mastering display metadata (based on SMPTE-2086:2014). This metadata
|
||||
* should be associated with a video stream and contains data in the form
|
||||
* of the AVMasteringDisplayMetadata struct.
|
||||
*/
|
||||
AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
|
||||
|
||||
/**
|
||||
* This side data should be associated with a video stream and corresponds
|
||||
* to the AVSphericalMapping structure.
|
||||
*/
|
||||
AV_PKT_DATA_SPHERICAL,
|
||||
|
||||
/**
|
||||
* Content light level (based on CTA-861.3). This metadata should be
|
||||
* associated with a video stream and contains data in the form of the
|
||||
* AVContentLightMetadata struct.
|
||||
*/
|
||||
AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
|
||||
|
||||
/**
|
||||
* ATSC A53 Part 4 Closed Captions. This metadata should be associated with
|
||||
* a video stream. A53 CC bitstream is stored as uint8_t in AVPacketSideData.data.
|
||||
* The number of bytes of CC data is AVPacketSideData.size.
|
||||
*/
|
||||
AV_PKT_DATA_A53_CC,
|
||||
|
||||
/**
|
||||
* This side data is encryption initialization data.
|
||||
* The format is not part of ABI, use av_encryption_init_info_* methods to
|
||||
* access.
|
||||
*/
|
||||
AV_PKT_DATA_ENCRYPTION_INIT_INFO,
|
||||
|
||||
/**
|
||||
* This side data contains encryption info for how to decrypt the packet.
|
||||
* The format is not part of ABI, use av_encryption_info_* methods to access.
|
||||
*/
|
||||
AV_PKT_DATA_ENCRYPTION_INFO,
|
||||
|
||||
/**
|
||||
* Active Format Description data consisting of a single byte as specified
|
||||
* in ETSI TS 101 154 using AVActiveFormatDescription enum.
|
||||
*/
|
||||
AV_PKT_DATA_AFD,
|
||||
|
||||
/**
|
||||
* Producer Reference Time data corresponding to the AVProducerReferenceTime struct,
|
||||
* usually exported by some encoders (on demand through the prft flag set in the
|
||||
* AVCodecContext export_side_data field).
|
||||
*/
|
||||
AV_PKT_DATA_PRFT,
|
||||
|
||||
/**
|
||||
* ICC profile data consisting of an opaque octet buffer following the
|
||||
* format described by ISO 15076-1.
|
||||
*/
|
||||
AV_PKT_DATA_ICC_PROFILE,
|
||||
|
||||
/**
|
||||
* DOVI configuration
|
||||
* ref:
|
||||
* dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2.1.2, section 2.2
|
||||
* dolby-vision-bitstreams-in-mpeg-2-transport-stream-multiplex-v1.2, section 3.3
|
||||
* Tags are stored in struct AVDOVIDecoderConfigurationRecord.
|
||||
*/
|
||||
AV_PKT_DATA_DOVI_CONF,
|
||||
|
||||
/**
|
||||
* Timecode which conforms to SMPTE ST 12-1:2014. The data is an array of 4 uint32_t
|
||||
* where the first uint32_t describes how many (1-3) of the other timecodes are used.
|
||||
* The timecode format is described in the documentation of av_timecode_get_smpte_from_framenum()
|
||||
* function in libavutil/timecode.h.
|
||||
*/
|
||||
AV_PKT_DATA_S12M_TIMECODE,
|
||||
|
||||
/**
|
||||
* HDR10+ dynamic metadata associated with a video frame. The metadata is in
|
||||
* the form of the AVDynamicHDRPlus struct and contains
|
||||
* information for color volume transform - application 4 of
|
||||
* SMPTE 2094-40:2016 standard.
|
||||
*/
|
||||
AV_PKT_DATA_DYNAMIC_HDR10_PLUS,
|
||||
|
||||
/**
|
||||
* The number of side data types.
|
||||
* This is not part of the public API/ABI in the sense that it may
|
||||
* change when new side data types are added.
|
||||
* This must stay the last enum value.
|
||||
* If its value becomes huge, some code using it
|
||||
* needs to be updated as it assumes it to be smaller than other limits.
|
||||
*/
|
||||
AV_PKT_DATA_NB
|
||||
};
|
||||
|
||||
#define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS //DEPRECATED
|
||||
|
||||
typedef struct AVPacketSideData {
|
||||
uint8_t *data;
|
||||
size_t size;
|
||||
enum AVPacketSideDataType type;
|
||||
} AVPacketSideData;
|
||||
|
||||
/**
|
||||
* This structure stores compressed data. It is typically exported by demuxers
|
||||
* and then passed as input to decoders, or received as output from encoders and
|
||||
* then passed to muxers.
|
||||
*
|
||||
* For video, it should typically contain one compressed frame. For audio it may
|
||||
* contain several compressed frames. Encoders are allowed to output empty
|
||||
* packets, with no compressed data, containing only side data
|
||||
* (e.g. to update some stream parameters at the end of encoding).
|
||||
*
|
||||
* The semantics of data ownership depends on the buf field.
|
||||
* If it is set, the packet data is dynamically allocated and is
|
||||
* valid indefinitely until a call to av_packet_unref() reduces the
|
||||
* reference count to 0.
|
||||
*
|
||||
* If the buf field is not set av_packet_ref() would make a copy instead
|
||||
* of increasing the reference count.
|
||||
*
|
||||
* The side data is always allocated with av_malloc(), copied by
|
||||
* av_packet_ref() and freed by av_packet_unref().
|
||||
*
|
||||
* sizeof(AVPacket) being a part of the public ABI is deprecated. once
|
||||
* av_init_packet() is removed, new packets will only be able to be allocated
|
||||
* with av_packet_alloc(), and new fields may be added to the end of the struct
|
||||
* with a minor bump.
|
||||
*
|
||||
* @see av_packet_alloc
|
||||
* @see av_packet_ref
|
||||
* @see av_packet_unref
|
||||
*/
|
||||
typedef struct AVPacket {
|
||||
/**
|
||||
* A reference to the reference-counted buffer where the packet data is
|
||||
* stored.
|
||||
* May be NULL, then the packet data is not reference-counted.
|
||||
*/
|
||||
AVBufferRef *buf;
|
||||
/**
|
||||
* Presentation timestamp in AVStream->time_base units; the time at which
|
||||
* the decompressed packet will be presented to the user.
|
||||
* Can be AV_NOPTS_VALUE if it is not stored in the file.
|
||||
* pts MUST be larger or equal to dts as presentation cannot happen before
|
||||
* decompression, unless one wants to view hex dumps. Some formats misuse
|
||||
* the terms dts and pts/cts to mean something different. Such timestamps
|
||||
* must be converted to true pts/dts before they are stored in AVPacket.
|
||||
*/
|
||||
int64_t pts;
|
||||
/**
|
||||
* Decompression timestamp in AVStream->time_base units; the time at which
|
||||
* the packet is decompressed.
|
||||
* Can be AV_NOPTS_VALUE if it is not stored in the file.
|
||||
*/
|
||||
int64_t dts;
|
||||
uint8_t *data;
|
||||
int size;
|
||||
int stream_index;
|
||||
/**
|
||||
* A combination of AV_PKT_FLAG values
|
||||
*/
|
||||
int flags;
|
||||
/**
|
||||
* Additional packet data that can be provided by the container.
|
||||
* Packet can contain several types of side information.
|
||||
*/
|
||||
AVPacketSideData *side_data;
|
||||
int side_data_elems;
|
||||
|
||||
/**
|
||||
* Duration of this packet in AVStream->time_base units, 0 if unknown.
|
||||
* Equals next_pts - this_pts in presentation order.
|
||||
*/
|
||||
int64_t duration;
|
||||
|
||||
int64_t pos; ///< byte position in stream, -1 if unknown
|
||||
|
||||
/**
|
||||
* for some private data of the user
|
||||
*/
|
||||
void *opaque;
|
||||
|
||||
/**
|
||||
* AVBufferRef for free use by the API user. FFmpeg will never check the
|
||||
* contents of the buffer ref. FFmpeg calls av_buffer_unref() on it when
|
||||
* the packet is unreferenced. av_packet_copy_props() calls create a new
|
||||
* reference with av_buffer_ref() for the target packet's opaque_ref field.
|
||||
*
|
||||
* This is unrelated to the opaque field, although it serves a similar
|
||||
* purpose.
|
||||
*/
|
||||
AVBufferRef *opaque_ref;
|
||||
|
||||
/**
|
||||
* Time base of the packet's timestamps.
|
||||
* In the future, this field may be set on packets output by encoders or
|
||||
* demuxers, but its value will be by default ignored on input to decoders
|
||||
* or muxers.
|
||||
*/
|
||||
AVRational time_base;
|
||||
} AVPacket;
|
||||
|
||||
#if FF_API_INIT_PACKET
|
||||
attribute_deprecated
|
||||
typedef struct AVPacketList {
|
||||
AVPacket pkt;
|
||||
struct AVPacketList *next;
|
||||
} AVPacketList;
|
||||
#endif
|
||||
|
||||
#define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe
|
||||
#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted
|
||||
/**
|
||||
* Flag is used to discard packets which are required to maintain valid
|
||||
* decoder state but are not required for output and should be dropped
|
||||
* after decoding.
|
||||
**/
|
||||
#define AV_PKT_FLAG_DISCARD 0x0004
|
||||
/**
|
||||
* The packet comes from a trusted source.
|
||||
*
|
||||
* Otherwise-unsafe constructs such as arbitrary pointers to data
|
||||
* outside the packet may be followed.
|
||||
*/
|
||||
#define AV_PKT_FLAG_TRUSTED 0x0008
|
||||
/**
|
||||
* Flag is used to indicate packets that contain frames that can
|
||||
* be discarded by the decoder. I.e. Non-reference frames.
|
||||
*/
|
||||
#define AV_PKT_FLAG_DISPOSABLE 0x0010
|
||||
|
||||
enum AVSideDataParamChangeFlags {
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
/**
|
||||
* @deprecated those are not used by any decoder
|
||||
*/
|
||||
AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001,
|
||||
AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002,
|
||||
#endif
|
||||
AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004,
|
||||
AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008,
|
||||
};
|
||||
|
||||
/**
|
||||
* Allocate an AVPacket and set its fields to default values. The resulting
|
||||
* struct must be freed using av_packet_free().
|
||||
*
|
||||
* @return An AVPacket filled with default values or NULL on failure.
|
||||
*
|
||||
* @note this only allocates the AVPacket itself, not the data buffers. Those
|
||||
* must be allocated through other means such as av_new_packet.
|
||||
*
|
||||
* @see av_new_packet
|
||||
*/
|
||||
AVPacket *av_packet_alloc(void);
|
||||
|
||||
/**
|
||||
* Create a new packet that references the same data as src.
|
||||
*
|
||||
* This is a shortcut for av_packet_alloc()+av_packet_ref().
|
||||
*
|
||||
* @return newly created AVPacket on success, NULL on error.
|
||||
*
|
||||
* @see av_packet_alloc
|
||||
* @see av_packet_ref
|
||||
*/
|
||||
AVPacket *av_packet_clone(const AVPacket *src);
|
||||
|
||||
/**
|
||||
* Free the packet, if the packet is reference counted, it will be
|
||||
* unreferenced first.
|
||||
*
|
||||
* @param pkt packet to be freed. The pointer will be set to NULL.
|
||||
* @note passing NULL is a no-op.
|
||||
*/
|
||||
void av_packet_free(AVPacket **pkt);
|
||||
|
||||
#if FF_API_INIT_PACKET
|
||||
/**
|
||||
* Initialize optional fields of a packet with default values.
|
||||
*
|
||||
* Note, this does not touch the data and size members, which have to be
|
||||
* initialized separately.
|
||||
*
|
||||
* @param pkt packet
|
||||
*
|
||||
* @see av_packet_alloc
|
||||
* @see av_packet_unref
|
||||
*
|
||||
* @deprecated This function is deprecated. Once it's removed,
|
||||
sizeof(AVPacket) will not be a part of the ABI anymore.
|
||||
*/
|
||||
attribute_deprecated
|
||||
void av_init_packet(AVPacket *pkt);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Allocate the payload of a packet and initialize its fields with
|
||||
* default values.
|
||||
*
|
||||
* @param pkt packet
|
||||
* @param size wanted payload size
|
||||
* @return 0 if OK, AVERROR_xxx otherwise
|
||||
*/
|
||||
int av_new_packet(AVPacket *pkt, int size);
|
||||
|
||||
/**
|
||||
* Reduce packet size, correctly zeroing padding
|
||||
*
|
||||
* @param pkt packet
|
||||
* @param size new size
|
||||
*/
|
||||
void av_shrink_packet(AVPacket *pkt, int size);
|
||||
|
||||
/**
|
||||
* Increase packet size, correctly zeroing padding
|
||||
*
|
||||
* @param pkt packet
|
||||
* @param grow_by number of bytes by which to increase the size of the packet
|
||||
*/
|
||||
int av_grow_packet(AVPacket *pkt, int grow_by);
|
||||
|
||||
/**
|
||||
* Initialize a reference-counted packet from av_malloc()ed data.
|
||||
*
|
||||
* @param pkt packet to be initialized. This function will set the data, size,
|
||||
* and buf fields, all others are left untouched.
|
||||
* @param data Data allocated by av_malloc() to be used as packet data. If this
|
||||
* function returns successfully, the data is owned by the underlying AVBuffer.
|
||||
* The caller may not access the data through other means.
|
||||
* @param size size of data in bytes, without the padding. I.e. the full buffer
|
||||
* size is assumed to be size + AV_INPUT_BUFFER_PADDING_SIZE.
|
||||
*
|
||||
* @return 0 on success, a negative AVERROR on error
|
||||
*/
|
||||
int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size);
|
||||
|
||||
/**
|
||||
* Allocate new information of a packet.
|
||||
*
|
||||
* @param pkt packet
|
||||
* @param type side information type
|
||||
* @param size side information size
|
||||
* @return pointer to fresh allocated data or NULL otherwise
|
||||
*/
|
||||
uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
|
||||
size_t size);
|
||||
|
||||
/**
|
||||
* Wrap an existing array as a packet side data.
|
||||
*
|
||||
* @param pkt packet
|
||||
* @param type side information type
|
||||
* @param data the side data array. It must be allocated with the av_malloc()
|
||||
* family of functions. The ownership of the data is transferred to
|
||||
* pkt.
|
||||
* @param size side information size
|
||||
* @return a non-negative number on success, a negative AVERROR code on
|
||||
* failure. On failure, the packet is unchanged and the data remains
|
||||
* owned by the caller.
|
||||
*/
|
||||
int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
|
||||
uint8_t *data, size_t size);
|
||||
|
||||
/**
|
||||
* Shrink the already allocated side data buffer
|
||||
*
|
||||
* @param pkt packet
|
||||
* @param type side information type
|
||||
* @param size new side information size
|
||||
* @return 0 on success, < 0 on failure
|
||||
*/
|
||||
int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
|
||||
size_t size);
|
||||
|
||||
/**
|
||||
* Get side information from packet.
|
||||
*
|
||||
* @param pkt packet
|
||||
* @param type desired side information type
|
||||
* @param size If supplied, *size will be set to the size of the side data
|
||||
* or to zero if the desired side data is not present.
|
||||
* @return pointer to data if present or NULL otherwise
|
||||
*/
|
||||
uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,
|
||||
size_t *size);
|
||||
|
||||
const char *av_packet_side_data_name(enum AVPacketSideDataType type);
|
||||
|
||||
/**
|
||||
* Pack a dictionary for use in side_data.
|
||||
*
|
||||
* @param dict The dictionary to pack.
|
||||
* @param size pointer to store the size of the returned data
|
||||
* @return pointer to data if successful, NULL otherwise
|
||||
*/
|
||||
uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size);
|
||||
/**
|
||||
* Unpack a dictionary from side_data.
|
||||
*
|
||||
* @param data data from side_data
|
||||
* @param size size of the data
|
||||
* @param dict the metadata storage dictionary
|
||||
* @return 0 on success, < 0 on failure
|
||||
*/
|
||||
int av_packet_unpack_dictionary(const uint8_t *data, size_t size,
|
||||
AVDictionary **dict);
|
||||
|
||||
/**
|
||||
* Convenience function to free all the side data stored.
|
||||
* All the other fields stay untouched.
|
||||
*
|
||||
* @param pkt packet
|
||||
*/
|
||||
void av_packet_free_side_data(AVPacket *pkt);
|
||||
|
||||
/**
|
||||
* Setup a new reference to the data described by a given packet
|
||||
*
|
||||
* If src is reference-counted, setup dst as a new reference to the
|
||||
* buffer in src. Otherwise allocate a new buffer in dst and copy the
|
||||
* data from src into it.
|
||||
*
|
||||
* All the other fields are copied from src.
|
||||
*
|
||||
* @see av_packet_unref
|
||||
*
|
||||
* @param dst Destination packet. Will be completely overwritten.
|
||||
* @param src Source packet
|
||||
*
|
||||
* @return 0 on success, a negative AVERROR on error. On error, dst
|
||||
* will be blank (as if returned by av_packet_alloc()).
|
||||
*/
|
||||
int av_packet_ref(AVPacket *dst, const AVPacket *src);
|
||||
|
||||
/**
|
||||
* Wipe the packet.
|
||||
*
|
||||
* Unreference the buffer referenced by the packet and reset the
|
||||
* remaining packet fields to their default values.
|
||||
*
|
||||
* @param pkt The packet to be unreferenced.
|
||||
*/
|
||||
void av_packet_unref(AVPacket *pkt);
|
||||
|
||||
/**
|
||||
* Move every field in src to dst and reset src.
|
||||
*
|
||||
* @see av_packet_unref
|
||||
*
|
||||
* @param src Source packet, will be reset
|
||||
* @param dst Destination packet
|
||||
*/
|
||||
void av_packet_move_ref(AVPacket *dst, AVPacket *src);
|
||||
|
||||
/**
|
||||
* Copy only "properties" fields from src to dst.
|
||||
*
|
||||
* Properties for the purpose of this function are all the fields
|
||||
* beside those related to the packet data (buf, data, size)
|
||||
*
|
||||
* @param dst Destination packet
|
||||
* @param src Source packet
|
||||
*
|
||||
* @return 0 on success AVERROR on failure.
|
||||
*/
|
||||
int av_packet_copy_props(AVPacket *dst, const AVPacket *src);
|
||||
|
||||
/**
|
||||
* Ensure the data described by a given packet is reference counted.
|
||||
*
|
||||
* @note This function does not ensure that the reference will be writable.
|
||||
* Use av_packet_make_writable instead for that purpose.
|
||||
*
|
||||
* @see av_packet_ref
|
||||
* @see av_packet_make_writable
|
||||
*
|
||||
* @param pkt packet whose data should be made reference counted.
|
||||
*
|
||||
* @return 0 on success, a negative AVERROR on error. On failure, the
|
||||
* packet is unchanged.
|
||||
*/
|
||||
int av_packet_make_refcounted(AVPacket *pkt);
|
||||
|
||||
/**
|
||||
* Create a writable reference for the data described by a given packet,
|
||||
* avoiding data copy if possible.
|
||||
*
|
||||
* @param pkt Packet whose data should be made writable.
|
||||
*
|
||||
* @return 0 on success, a negative AVERROR on failure. On failure, the
|
||||
* packet is unchanged.
|
||||
*/
|
||||
int av_packet_make_writable(AVPacket *pkt);
|
||||
|
||||
/**
|
||||
* Convert valid timing fields (timestamps / durations) in a packet from one
|
||||
* timebase to another. Timestamps with unknown values (AV_NOPTS_VALUE) will be
|
||||
* ignored.
|
||||
*
|
||||
* @param pkt packet on which the conversion will be performed
|
||||
* @param tb_src source timebase, in which the timing fields in pkt are
|
||||
* expressed
|
||||
* @param tb_dst destination timebase, to which the timing fields will be
|
||||
* converted
|
||||
*/
|
||||
void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif // AVCODEC_PACKET_H
|
@ -1,86 +0,0 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
#if FF_API_STRUCT_VAAPI_CONTEXT
|
||||
|
||||
/**
|
||||
* @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.
|
||||
*
|
||||
* Deprecated: use AVCodecContext.hw_frames_ctx instead.
|
||||
*/
|
||||
struct attribute_deprecated 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;
|
||||
};
|
||||
|
||||
/* @} */
|
||||
|
||||
#endif /* FF_API_STRUCT_VAAPI_CONTEXT */
|
||||
|
||||
#endif /* AVCODEC_VAAPI_H */
|
@ -55,7 +55,6 @@
|
||||
#include "libavutil/attributes.h"
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "version.h"
|
||||
|
||||
struct AVCodecContext;
|
||||
struct AVFrame;
|
||||
@ -153,24 +152,6 @@ int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type,
|
||||
*/
|
||||
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
|
||||
|
||||
/* @}*/
|
||||
|
||||
#endif /* AVCODEC_VDPAU_H */
|
||||
|
@ -27,8 +27,9 @@
|
||||
|
||||
#include "libavutil/version.h"
|
||||
|
||||
#define LIBAVCODEC_VERSION_MAJOR 58
|
||||
#define LIBAVCODEC_VERSION_MINOR 43
|
||||
#include "version_major.h"
|
||||
|
||||
#define LIBAVCODEC_VERSION_MINOR 37
|
||||
#define LIBAVCODEC_VERSION_MICRO 100
|
||||
|
||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
||||
@ -41,97 +42,4 @@
|
||||
|
||||
#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_LOWRES
|
||||
#define FF_API_LOWRES (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_DEBUG_MV
|
||||
#define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 58)
|
||||
#endif
|
||||
#ifndef FF_API_AVCTX_TIMEBASE
|
||||
#define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_CODED_FRAME
|
||||
#define FF_API_CODED_FRAME (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
|
||||
#ifndef FF_API_PRIVATE_OPT
|
||||
#define FF_API_PRIVATE_OPT (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_ASS_TIMING
|
||||
#define FF_API_ASS_TIMING (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_OLD_BSF
|
||||
#define FF_API_OLD_BSF (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_COPY_CONTEXT
|
||||
#define FF_API_COPY_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_GET_CONTEXT_DEFAULTS
|
||||
#define FF_API_GET_CONTEXT_DEFAULTS (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_NVENC_OLD_NAME
|
||||
#define FF_API_NVENC_OLD_NAME (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_STRUCT_VAAPI_CONTEXT
|
||||
#define FF_API_STRUCT_VAAPI_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_MERGE_SD_API
|
||||
#define FF_API_MERGE_SD_API (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_TAG_STRING
|
||||
#define FF_API_TAG_STRING (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_GETCHROMA
|
||||
#define FF_API_GETCHROMA (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_CODEC_GET_SET
|
||||
#define FF_API_CODEC_GET_SET (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_USER_VISIBLE_AVHWACCEL
|
||||
#define FF_API_USER_VISIBLE_AVHWACCEL (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_LOCKMGR
|
||||
#define FF_API_LOCKMGR (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_NEXT
|
||||
#define FF_API_NEXT (LIBAVCODEC_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* AVCODEC_VERSION_H */
|
||||
|
54
ext_includes/ffmpeg/libavcodec/version_major.h
Normal file
54
ext_includes/ffmpeg/libavcodec/version_major.h
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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_MAJOR_H
|
||||
#define AVCODEC_VERSION_MAJOR_H
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @ingroup libavc
|
||||
* Libavcodec version macros.
|
||||
*/
|
||||
|
||||
#define LIBAVCODEC_VERSION_MAJOR 59
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define FF_API_OPENH264_SLICE_MODE (LIBAVCODEC_VERSION_MAJOR < 60)
|
||||
#define FF_API_OPENH264_CABAC (LIBAVCODEC_VERSION_MAJOR < 60)
|
||||
#define FF_API_UNUSED_CODEC_CAPS (LIBAVCODEC_VERSION_MAJOR < 60)
|
||||
#define FF_API_THREAD_SAFE_CALLBACKS (LIBAVCODEC_VERSION_MAJOR < 60)
|
||||
#define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 60)
|
||||
#define FF_API_GET_FRAME_CLASS (LIBAVCODEC_VERSION_MAJOR < 60)
|
||||
#define FF_API_AUTO_THREADS (LIBAVCODEC_VERSION_MAJOR < 60)
|
||||
#define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 60)
|
||||
#define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 60)
|
||||
#define FF_API_FLAG_TRUNCATED (LIBAVCODEC_VERSION_MAJOR < 60)
|
||||
#define FF_API_SUB_TEXT_FORMAT (LIBAVCODEC_VERSION_MAJOR < 60)
|
||||
#define FF_API_IDCT_NONE (LIBAVCODEC_VERSION_MAJOR < 60)
|
||||
#define FF_API_SVTAV1_OPTS (LIBAVCODEC_VERSION_MAJOR < 60)
|
||||
|
||||
#endif /* AVCODEC_VERSION_MAJOR_H */
|
@ -27,10 +27,11 @@
|
||||
* Public libavcodec XvMC header.
|
||||
*/
|
||||
|
||||
#pragma message("XvMC is no longer supported; this header is deprecated and will be removed")
|
||||
|
||||
#include <X11/extensions/XvMC.h>
|
||||
|
||||
#include "libavutil/attributes.h"
|
||||
#include "version.h"
|
||||
#include "avcodec.h"
|
||||
|
||||
/**
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -27,12 +27,13 @@
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "libavutil/common.h"
|
||||
#include "libavutil/attributes.h"
|
||||
#include "libavutil/dict.h"
|
||||
#include "libavutil/log.h"
|
||||
|
||||
#include "libavformat/version.h"
|
||||
#include "libavformat/version_major.h"
|
||||
|
||||
/**
|
||||
* Seeking works like for a local file.
|
||||
@ -148,9 +149,9 @@ enum AVIODataMarkerType {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* New public fields can be added with minor version bumps.
|
||||
* Removal, reordering and changes to existing public 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
|
||||
@ -237,12 +238,14 @@ typedef struct AVIOContext {
|
||||
int64_t (*seek)(void *opaque, int64_t offset, int whence);
|
||||
int64_t pos; /**< position in the file of the current buffer */
|
||||
int eof_reached; /**< true if was unable to read due to error or eof */
|
||||
int error; /**< contains the error code or 0 if no error happened */
|
||||
int write_flag; /**< true if open for writing */
|
||||
int max_packet_size;
|
||||
int min_packet_size; /**< Try to buffer at least this amount of data
|
||||
before flushing it. */
|
||||
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.
|
||||
*/
|
||||
@ -259,12 +262,6 @@ typedef struct AVIOContext {
|
||||
*/
|
||||
int seekable;
|
||||
|
||||
/**
|
||||
* max filesize, used to limit allocations
|
||||
* This field is internal to libavformat and access from outside is not allowed.
|
||||
*/
|
||||
int64_t maxsize;
|
||||
|
||||
/**
|
||||
* avio_read and avio_write should if possible be satisfied directly
|
||||
* instead of going through a buffer, and avio_seek will always
|
||||
@ -272,37 +269,6 @@ typedef struct AVIOContext {
|
||||
*/
|
||||
int direct;
|
||||
|
||||
/**
|
||||
* Bytes read statistic
|
||||
* This field is internal to libavformat and access from outside is not allowed.
|
||||
*/
|
||||
int64_t bytes_read;
|
||||
|
||||
/**
|
||||
* seek statistic
|
||||
* This field is internal to libavformat and access from outside is not allowed.
|
||||
*/
|
||||
int seek_count;
|
||||
|
||||
/**
|
||||
* writeout statistic
|
||||
* This field is internal to libavformat and access from outside is not allowed.
|
||||
*/
|
||||
int writeout_count;
|
||||
|
||||
/**
|
||||
* Original buffer size
|
||||
* used internally after probing and ensure seekback to reset the buffer size
|
||||
* This field is internal to libavformat and access from outside is not allowed.
|
||||
*/
|
||||
int orig_buffer_size;
|
||||
|
||||
/**
|
||||
* Threshold to favor readahead over seek.
|
||||
* This is current internal only, do not use from outside.
|
||||
*/
|
||||
int short_seek_threshold;
|
||||
|
||||
/**
|
||||
* ',' separated list of allowed protocols.
|
||||
*/
|
||||
@ -325,19 +291,15 @@ typedef struct AVIOContext {
|
||||
*/
|
||||
int ignore_boundary_point;
|
||||
|
||||
#if FF_API_AVIOCONTEXT_WRITTEN
|
||||
/**
|
||||
* Internal, not meant to be used from outside of AVIOContext.
|
||||
* @deprecated field utilized privately by libavformat. For a public
|
||||
* statistic of how many bytes were written out, see
|
||||
* AVIOContext::bytes_written.
|
||||
*/
|
||||
enum AVIODataMarkerType current_type;
|
||||
int64_t last_time;
|
||||
|
||||
/**
|
||||
* A callback that is used instead of short_seek_threshold.
|
||||
* This is current internal only, do not use from outside.
|
||||
*/
|
||||
int (*short_seek_get)(void *opaque);
|
||||
|
||||
attribute_deprecated
|
||||
int64_t written;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Maximum reached position before a backward seek in the write buffer,
|
||||
@ -346,9 +308,14 @@ typedef struct AVIOContext {
|
||||
unsigned char *buf_ptr_max;
|
||||
|
||||
/**
|
||||
* Try to buffer at least this amount of data before flushing it
|
||||
* Read-only statistic of bytes read for this AVIOContext.
|
||||
*/
|
||||
int min_packet_size;
|
||||
int64_t bytes_read;
|
||||
|
||||
/**
|
||||
* Read-only statistic of bytes written for this AVIOContext.
|
||||
*/
|
||||
int64_t bytes_written;
|
||||
} AVIOContext;
|
||||
|
||||
/**
|
||||
@ -374,25 +341,6 @@ const char *avio_find_protocol_name(const char *url);
|
||||
*/
|
||||
int avio_check(const char *url, int flags);
|
||||
|
||||
/**
|
||||
* Move or rename a resource.
|
||||
*
|
||||
* @note url_src and url_dst should share the same protocol and authority.
|
||||
*
|
||||
* @param url_src url to resource to be moved
|
||||
* @param url_dst new url to resource if the operation succeeded
|
||||
* @return >=0 on success or negative on error.
|
||||
*/
|
||||
int avpriv_io_move(const char *url_src, const char *url_dst);
|
||||
|
||||
/**
|
||||
* Delete a resource.
|
||||
*
|
||||
* @param url resource to be deleted.
|
||||
* @return >=0 on success or negative on error.
|
||||
*/
|
||||
int avpriv_io_delete(const char *url);
|
||||
|
||||
/**
|
||||
* Open directory for reading.
|
||||
*
|
||||
@ -571,9 +519,35 @@ int64_t avio_size(AVIOContext *s);
|
||||
*/
|
||||
int avio_feof(AVIOContext *s);
|
||||
|
||||
/** @warning Writes up to 4 KiB per call */
|
||||
/**
|
||||
* Writes a formatted string to the context taking a va_list.
|
||||
* @return number of bytes written, < 0 on error.
|
||||
*/
|
||||
int avio_vprintf(AVIOContext *s, const char *fmt, va_list ap);
|
||||
|
||||
/**
|
||||
* Writes a formatted string to the context.
|
||||
* @return number of bytes written, < 0 on error.
|
||||
*/
|
||||
int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3);
|
||||
|
||||
/**
|
||||
* Write a NULL terminated array of strings to the context.
|
||||
* Usually you don't need to use this function directly but its macro wrapper,
|
||||
* avio_print.
|
||||
*/
|
||||
void avio_print_string_array(AVIOContext *s, const char *strings[]);
|
||||
|
||||
/**
|
||||
* Write strings (const char *) to the context.
|
||||
* This is a convenience macro around avio_print_string_array and it
|
||||
* automatically creates the string array from the variable argument list.
|
||||
* For simple string concatenations this function is more performant than using
|
||||
* avio_printf since it does not need a temporary buffer.
|
||||
*/
|
||||
#define avio_print(s, ...) \
|
||||
avio_print_string_array(s, (const char*[]){__VA_ARGS__, NULL})
|
||||
|
||||
/**
|
||||
* Force flushing of buffered data.
|
||||
*
|
||||
@ -787,6 +761,13 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
|
||||
*/
|
||||
const char *avio_enum_protocols(void **opaque, int output);
|
||||
|
||||
/**
|
||||
* Get AVClass by names of available protocols.
|
||||
*
|
||||
* @return A AVClass of input protocol name or NULL
|
||||
*/
|
||||
const AVClass *avio_protocol_get_class(const char *name);
|
||||
|
||||
/**
|
||||
* Pause and resume playing - only meaningful if using a network streaming
|
||||
* protocol (e.g. MMS).
|
||||
|
@ -29,10 +29,9 @@
|
||||
|
||||
#include "libavutil/version.h"
|
||||
|
||||
// Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
|
||||
// Also please add any ticket numbers that you believe might be affected here
|
||||
#define LIBAVFORMAT_VERSION_MAJOR 58
|
||||
#define LIBAVFORMAT_VERSION_MINOR 25
|
||||
#include "version_major.h"
|
||||
|
||||
#define LIBAVFORMAT_VERSION_MINOR 27
|
||||
#define LIBAVFORMAT_VERSION_MICRO 100
|
||||
|
||||
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
||||
@ -45,67 +44,4 @@
|
||||
|
||||
#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.
|
||||
*
|
||||
* @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_COMPUTE_PKT_FIELDS2
|
||||
#define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_OLD_OPEN_CALLBACKS
|
||||
#define FF_API_OLD_OPEN_CALLBACKS (LIBAVFORMAT_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_LAVF_AVCTX
|
||||
#define FF_API_LAVF_AVCTX (LIBAVFORMAT_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_HTTP_USER_AGENT
|
||||
#define FF_API_HTTP_USER_AGENT (LIBAVFORMAT_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_HLS_WRAP
|
||||
#define FF_API_HLS_WRAP (LIBAVFORMAT_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_HLS_USE_LOCALTIME
|
||||
#define FF_API_HLS_USE_LOCALTIME (LIBAVFORMAT_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_LAVF_KEEPSIDE_FLAG
|
||||
#define FF_API_LAVF_KEEPSIDE_FLAG (LIBAVFORMAT_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_OLD_ROTATE_API
|
||||
#define FF_API_OLD_ROTATE_API (LIBAVFORMAT_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_FORMAT_GET_SET
|
||||
#define FF_API_FORMAT_GET_SET (LIBAVFORMAT_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_OLD_AVIO_EOF_0
|
||||
#define FF_API_OLD_AVIO_EOF_0 (LIBAVFORMAT_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_LAVF_FFSERVER
|
||||
#define FF_API_LAVF_FFSERVER (LIBAVFORMAT_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_FORMAT_FILENAME
|
||||
#define FF_API_FORMAT_FILENAME (LIBAVFORMAT_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_OLD_RTSP_OPTIONS
|
||||
#define FF_API_OLD_RTSP_OPTIONS (LIBAVFORMAT_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_NEXT
|
||||
#define FF_API_NEXT (LIBAVFORMAT_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_DASH_MIN_SEG_DURATION
|
||||
#define FF_API_DASH_MIN_SEG_DURATION (LIBAVFORMAT_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
#ifndef FF_API_LAVF_MP4A_LATM
|
||||
#define FF_API_LAVF_MP4A_LATM (LIBAVFORMAT_VERSION_MAJOR < 59)
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef FF_API_R_FRAME_RATE
|
||||
#define FF_API_R_FRAME_RATE 1
|
||||
#endif
|
||||
#endif /* AVFORMAT_VERSION_H */
|
||||
|
53
ext_includes/ffmpeg/libavformat/version_major.h
Normal file
53
ext_includes/ffmpeg/libavformat/version_major.h
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Version macros.
|
||||
*
|
||||
* 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 AVFORMAT_VERSION_MAJOR_H
|
||||
#define AVFORMAT_VERSION_MAJOR_H
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @ingroup libavf
|
||||
* Libavformat version macros
|
||||
*/
|
||||
|
||||
// Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
|
||||
// Also please add any ticket numbers that you believe might be affected here
|
||||
#define LIBAVFORMAT_VERSION_MAJOR 59
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
#define FF_API_LAVF_PRIV_OPT (LIBAVFORMAT_VERSION_MAJOR < 60)
|
||||
#define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 60)
|
||||
#define FF_API_AVIOCONTEXT_WRITTEN (LIBAVFORMAT_VERSION_MAJOR < 60)
|
||||
#define FF_HLS_TS_OPTIONS (LIBAVFORMAT_VERSION_MAJOR < 60)
|
||||
#define FF_API_AVSTREAM_CLASS (LIBAVFORMAT_VERSION_MAJOR > 59)
|
||||
|
||||
|
||||
#define FF_API_R_FRAME_RATE 1
|
||||
|
||||
#endif /* AVFORMAT_VERSION_MAJOR_H */
|
@ -27,6 +27,7 @@
|
||||
#ifndef AVUTIL_ADLER32_H
|
||||
#define AVUTIL_ADLER32_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include "attributes.h"
|
||||
|
||||
@ -38,6 +39,8 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef uint32_t AVAdler;
|
||||
|
||||
/**
|
||||
* Calculate the Adler32 checksum of a buffer.
|
||||
*
|
||||
@ -50,8 +53,8 @@
|
||||
* @param len size of input buffer
|
||||
* @return updated checksum
|
||||
*/
|
||||
unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf,
|
||||
unsigned int len) av_pure;
|
||||
AVAdler av_adler32_update(AVAdler adler, const uint8_t *buf,
|
||||
size_t len) av_pure;
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "attributes.h"
|
||||
#include "version.h"
|
||||
|
||||
/**
|
||||
* @defgroup lavu_aes AES
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "attributes.h"
|
||||
#include "version.h"
|
||||
|
||||
#define AES_CTR_KEY_SIZE (16)
|
||||
#define AES_CTR_IV_SIZE (8)
|
||||
|
@ -34,6 +34,12 @@
|
||||
# define AV_GCC_VERSION_AT_MOST(x,y) 0
|
||||
#endif
|
||||
|
||||
#ifdef __has_builtin
|
||||
# define AV_HAS_BUILTIN(x) __has_builtin(x)
|
||||
#else
|
||||
# define AV_HAS_BUILTIN(x) 0
|
||||
#endif
|
||||
|
||||
#ifndef av_always_inline
|
||||
#if AV_GCC_VERSION_AT_LEAST(3,1)
|
||||
# define av_always_inline __attribute__((always_inline)) inline
|
||||
@ -104,7 +110,7 @@
|
||||
* scheduled for removal.
|
||||
*/
|
||||
#ifndef AV_NOWARN_DEPRECATED
|
||||
#if AV_GCC_VERSION_AT_LEAST(4,6)
|
||||
#if AV_GCC_VERSION_AT_LEAST(4,6) || defined(__clang__)
|
||||
# define AV_NOWARN_DEPRECATED(code) \
|
||||
_Pragma("GCC diagnostic push") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
|
||||
|
@ -27,8 +27,7 @@
|
||||
#ifndef AVUTIL_AUDIO_FIFO_H
|
||||
#define AVUTIL_AUDIO_FIFO_H
|
||||
|
||||
#include "avutil.h"
|
||||
#include "fifo.h"
|
||||
#include "attributes.h"
|
||||
#include "samplefmt.h"
|
||||
|
||||
/**
|
||||
|
@ -28,8 +28,8 @@
|
||||
#define AVUTIL_AVASSERT_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "avutil.h"
|
||||
#include "log.h"
|
||||
#include "macros.h"
|
||||
|
||||
/**
|
||||
* assert() equivalent, that is always enabled.
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include "attributes.h"
|
||||
#include "version.h"
|
||||
|
||||
/**
|
||||
* @addtogroup lavu_string
|
||||
@ -155,10 +156,14 @@ static inline size_t av_strnlen(const char *s, size_t len)
|
||||
*/
|
||||
char *av_asprintf(const char *fmt, ...) av_printf_format(1, 2);
|
||||
|
||||
#if FF_API_D2STR
|
||||
/**
|
||||
* Convert a number to an av_malloced string.
|
||||
* @deprecated use av_asprintf() with "%f" or a more specific format
|
||||
*/
|
||||
attribute_deprecated
|
||||
char *av_d2str(double d);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Unescape the given string until a non escaped terminating char,
|
||||
@ -274,16 +279,21 @@ char *av_strireplace(const char *str, const char *from, const char *to);
|
||||
|
||||
/**
|
||||
* Thread safe basename.
|
||||
* @param path the path, on DOS both \ and / are considered separators.
|
||||
* @param path the string to parse, on DOS both \ and / are considered separators.
|
||||
* @return pointer to the basename substring.
|
||||
* If path does not contain a slash, the function returns a copy of path.
|
||||
* If path is a NULL pointer or points to an empty string, a pointer
|
||||
* to a string "." is returned.
|
||||
*/
|
||||
const char *av_basename(const char *path);
|
||||
|
||||
/**
|
||||
* Thread safe dirname.
|
||||
* @param path the path, on DOS both \ and / are considered separators.
|
||||
* @return the path with the separator replaced by the string terminator or ".".
|
||||
* @note the function may change the input string.
|
||||
* @param path the string to parse, on DOS both \ and / are considered separators.
|
||||
* @return A pointer to a string that's the parent directory of path.
|
||||
* If path is a NULL pointer or points to an empty string, a pointer
|
||||
* to a string "." is returned.
|
||||
* @note the function may modify the contents of the path, so copies should be passed.
|
||||
*/
|
||||
const char *av_dirname(char *path);
|
||||
|
||||
@ -314,6 +324,7 @@ enum AVEscapeMode {
|
||||
AV_ESCAPE_MODE_AUTO, ///< Use auto-selected escaping mode.
|
||||
AV_ESCAPE_MODE_BACKSLASH, ///< Use backslash escaping.
|
||||
AV_ESCAPE_MODE_QUOTE, ///< Use single-quote escaping.
|
||||
AV_ESCAPE_MODE_XML, ///< Use XML non-markup character data escaping.
|
||||
};
|
||||
|
||||
/**
|
||||
@ -333,6 +344,19 @@ enum AVEscapeMode {
|
||||
*/
|
||||
#define AV_ESCAPE_FLAG_STRICT (1 << 1)
|
||||
|
||||
/**
|
||||
* Within AV_ESCAPE_MODE_XML, additionally escape single quotes for single
|
||||
* quoted attributes.
|
||||
*/
|
||||
#define AV_ESCAPE_FLAG_XML_SINGLE_QUOTES (1 << 2)
|
||||
|
||||
/**
|
||||
* Within AV_ESCAPE_MODE_XML, additionally escape double quotes for double
|
||||
* quoted attributes.
|
||||
*/
|
||||
#define AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES (1 << 3)
|
||||
|
||||
|
||||
/**
|
||||
* Escape string in src, and put the escaped string in an allocated
|
||||
* string in *dst, which must be freed with av_free().
|
||||
|
@ -331,12 +331,18 @@ unsigned av_int_list_length_for_size(unsigned elsize,
|
||||
#define av_int_list_length(list, term) \
|
||||
av_int_list_length_for_size(sizeof(*(list)), list, term)
|
||||
|
||||
#if FF_API_AV_FOPEN_UTF8
|
||||
/**
|
||||
* Open a file using a UTF-8 filename.
|
||||
* The API of this function matches POSIX fopen(), errors are returned through
|
||||
* errno.
|
||||
* @deprecated Avoid using it, as on Windows, the FILE* allocated by this
|
||||
* function may be allocated with a different CRT than the caller
|
||||
* who uses the FILE*. No replacement provided in public API.
|
||||
*/
|
||||
attribute_deprecated
|
||||
FILE *av_fopen_utf8(const char *path, const char *mode);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Return the fractional representation of the internal time base.
|
||||
|
@ -25,6 +25,7 @@
|
||||
#ifndef AVUTIL_BUFFER_H
|
||||
#define AVUTIL_BUFFER_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
@ -90,7 +91,7 @@ typedef struct AVBufferRef {
|
||||
/**
|
||||
* Size of data in bytes.
|
||||
*/
|
||||
int size;
|
||||
size_t size;
|
||||
} AVBufferRef;
|
||||
|
||||
/**
|
||||
@ -98,13 +99,13 @@ typedef struct AVBufferRef {
|
||||
*
|
||||
* @return an AVBufferRef of given size or NULL when out of memory
|
||||
*/
|
||||
AVBufferRef *av_buffer_alloc(int size);
|
||||
AVBufferRef *av_buffer_alloc(size_t size);
|
||||
|
||||
/**
|
||||
* Same as av_buffer_alloc(), except the returned buffer will be initialized
|
||||
* to zero.
|
||||
*/
|
||||
AVBufferRef *av_buffer_allocz(int size);
|
||||
AVBufferRef *av_buffer_allocz(size_t size);
|
||||
|
||||
/**
|
||||
* Always treat the buffer as read-only, even when it has only one
|
||||
@ -127,7 +128,7 @@ AVBufferRef *av_buffer_allocz(int size);
|
||||
*
|
||||
* @return an AVBufferRef referring to data on success, NULL on failure.
|
||||
*/
|
||||
AVBufferRef *av_buffer_create(uint8_t *data, int size,
|
||||
AVBufferRef *av_buffer_create(uint8_t *data, size_t size,
|
||||
void (*free)(void *opaque, uint8_t *data),
|
||||
void *opaque, int flags);
|
||||
|
||||
@ -144,7 +145,7 @@ void av_buffer_default_free(void *opaque, uint8_t *data);
|
||||
* @return a new AVBufferRef referring to the same AVBuffer as buf or NULL on
|
||||
* failure.
|
||||
*/
|
||||
AVBufferRef *av_buffer_ref(AVBufferRef *buf);
|
||||
AVBufferRef *av_buffer_ref(const AVBufferRef *buf);
|
||||
|
||||
/**
|
||||
* Free a given reference and automatically free the buffer if there are no more
|
||||
@ -195,7 +196,23 @@ int av_buffer_make_writable(AVBufferRef **buf);
|
||||
* 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);
|
||||
int av_buffer_realloc(AVBufferRef **buf, size_t size);
|
||||
|
||||
/**
|
||||
* Ensure dst refers to the same data as src.
|
||||
*
|
||||
* When *dst is already equivalent to src, do nothing. Otherwise unreference dst
|
||||
* and replace it with a new reference to src.
|
||||
*
|
||||
* @param dst Pointer to either a valid buffer reference or NULL. On success,
|
||||
* this will point to a buffer reference equivalent to src. On
|
||||
* failure, dst will be left untouched.
|
||||
* @param src A buffer reference to replace dst with. May be NULL, then this
|
||||
* function is equivalent to av_buffer_unref(dst).
|
||||
* @return 0 on success
|
||||
* AVERROR(ENOMEM) on memory allocation failure.
|
||||
*/
|
||||
int av_buffer_replace(AVBufferRef **dst, const AVBufferRef *src);
|
||||
|
||||
/**
|
||||
* @}
|
||||
@ -246,7 +263,7 @@ typedef struct AVBufferPool AVBufferPool;
|
||||
* (av_buffer_alloc()).
|
||||
* @return newly created buffer pool on success, NULL on error.
|
||||
*/
|
||||
AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size));
|
||||
AVBufferPool *av_buffer_pool_init(size_t size, AVBufferRef* (*alloc)(size_t size));
|
||||
|
||||
/**
|
||||
* Allocate and initialize a buffer pool with a more complex allocator.
|
||||
@ -254,16 +271,17 @@ AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size));
|
||||
* @param size size of each buffer in this pool
|
||||
* @param opaque arbitrary user data used by the allocator
|
||||
* @param alloc a function that will be used to allocate new buffers when the
|
||||
* pool is empty.
|
||||
* pool is empty. May be NULL, then the default allocator will be
|
||||
* used (av_buffer_alloc()).
|
||||
* @param pool_free a function that will be called immediately before the pool
|
||||
* is freed. I.e. after av_buffer_pool_uninit() is called
|
||||
* by the caller and all the frames are returned to the pool
|
||||
* and freed. It is intended to uninitialize the user opaque
|
||||
* data.
|
||||
* data. May be NULL.
|
||||
* @return newly created buffer pool on success, NULL on error.
|
||||
*/
|
||||
AVBufferPool *av_buffer_pool_init2(int size, void *opaque,
|
||||
AVBufferRef* (*alloc)(void *opaque, int size),
|
||||
AVBufferPool *av_buffer_pool_init2(size_t size, void *opaque,
|
||||
AVBufferRef* (*alloc)(void *opaque, size_t size),
|
||||
void (*pool_free)(void *opaque));
|
||||
|
||||
/**
|
||||
@ -284,6 +302,19 @@ void av_buffer_pool_uninit(AVBufferPool **pool);
|
||||
*/
|
||||
AVBufferRef *av_buffer_pool_get(AVBufferPool *pool);
|
||||
|
||||
/**
|
||||
* Query the original opaque parameter of an allocated buffer in the pool.
|
||||
*
|
||||
* @param ref a buffer reference to a buffer returned by av_buffer_pool_get.
|
||||
* @return the opaque parameter set by the buffer allocator function of the
|
||||
* buffer pool.
|
||||
*
|
||||
* @note the opaque parameter of ref is used by the buffer pool implementation,
|
||||
* therefore you have to use this function to access the original opaque
|
||||
* parameter of an allocated buffer.
|
||||
*/
|
||||
void *av_buffer_pool_buffer_get_opaque(const AVBufferRef *ref);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -23,6 +23,10 @@
|
||||
#define AVUTIL_CHANNEL_LAYOUT_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "version.h"
|
||||
#include "attributes.h"
|
||||
|
||||
/**
|
||||
* @file
|
||||
@ -34,6 +38,111 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
enum AVChannel {
|
||||
///< Invalid channel index
|
||||
AV_CHAN_NONE = -1,
|
||||
AV_CHAN_FRONT_LEFT,
|
||||
AV_CHAN_FRONT_RIGHT,
|
||||
AV_CHAN_FRONT_CENTER,
|
||||
AV_CHAN_LOW_FREQUENCY,
|
||||
AV_CHAN_BACK_LEFT,
|
||||
AV_CHAN_BACK_RIGHT,
|
||||
AV_CHAN_FRONT_LEFT_OF_CENTER,
|
||||
AV_CHAN_FRONT_RIGHT_OF_CENTER,
|
||||
AV_CHAN_BACK_CENTER,
|
||||
AV_CHAN_SIDE_LEFT,
|
||||
AV_CHAN_SIDE_RIGHT,
|
||||
AV_CHAN_TOP_CENTER,
|
||||
AV_CHAN_TOP_FRONT_LEFT,
|
||||
AV_CHAN_TOP_FRONT_CENTER,
|
||||
AV_CHAN_TOP_FRONT_RIGHT,
|
||||
AV_CHAN_TOP_BACK_LEFT,
|
||||
AV_CHAN_TOP_BACK_CENTER,
|
||||
AV_CHAN_TOP_BACK_RIGHT,
|
||||
/** Stereo downmix. */
|
||||
AV_CHAN_STEREO_LEFT = 29,
|
||||
/** See above. */
|
||||
AV_CHAN_STEREO_RIGHT,
|
||||
AV_CHAN_WIDE_LEFT,
|
||||
AV_CHAN_WIDE_RIGHT,
|
||||
AV_CHAN_SURROUND_DIRECT_LEFT,
|
||||
AV_CHAN_SURROUND_DIRECT_RIGHT,
|
||||
AV_CHAN_LOW_FREQUENCY_2,
|
||||
AV_CHAN_TOP_SIDE_LEFT,
|
||||
AV_CHAN_TOP_SIDE_RIGHT,
|
||||
AV_CHAN_BOTTOM_FRONT_CENTER,
|
||||
AV_CHAN_BOTTOM_FRONT_LEFT,
|
||||
AV_CHAN_BOTTOM_FRONT_RIGHT,
|
||||
|
||||
/** Channel is empty can be safely skipped. */
|
||||
AV_CHAN_UNUSED = 0x200,
|
||||
|
||||
/** Channel contains data, but its position is unknown. */
|
||||
AV_CHAN_UNKNOWN = 0x300,
|
||||
|
||||
/**
|
||||
* Range of channels between AV_CHAN_AMBISONIC_BASE and
|
||||
* AV_CHAN_AMBISONIC_END represent Ambisonic components using the ACN system.
|
||||
*
|
||||
* Given a channel id <i> between AV_CHAN_AMBISONIC_BASE and
|
||||
* AV_CHAN_AMBISONIC_END (inclusive), the ACN index of the channel <n> is
|
||||
* <n> = <i> - AV_CHAN_AMBISONIC_BASE.
|
||||
*
|
||||
* @note these values are only used for AV_CHANNEL_ORDER_CUSTOM channel
|
||||
* orderings, the AV_CHANNEL_ORDER_AMBISONIC ordering orders the channels
|
||||
* implicitly by their position in the stream.
|
||||
*/
|
||||
AV_CHAN_AMBISONIC_BASE = 0x400,
|
||||
// leave space for 1024 ids, which correspond to maximum order-32 harmonics,
|
||||
// which should be enough for the foreseeable use cases
|
||||
AV_CHAN_AMBISONIC_END = 0x7ff,
|
||||
};
|
||||
|
||||
enum AVChannelOrder {
|
||||
/**
|
||||
* Only the channel count is specified, without any further information
|
||||
* about the channel order.
|
||||
*/
|
||||
AV_CHANNEL_ORDER_UNSPEC,
|
||||
/**
|
||||
* The native channel order, i.e. the channels are in the same order in
|
||||
* which they are defined in the AVChannel enum. This supports up to 63
|
||||
* different channels.
|
||||
*/
|
||||
AV_CHANNEL_ORDER_NATIVE,
|
||||
/**
|
||||
* The channel order does not correspond to any other predefined order and
|
||||
* is stored as an explicit map. For example, this could be used to support
|
||||
* layouts with 64 or more channels, or with empty/skipped (AV_CHAN_SILENCE)
|
||||
* channels at arbitrary positions.
|
||||
*/
|
||||
AV_CHANNEL_ORDER_CUSTOM,
|
||||
/**
|
||||
* The audio is represented as the decomposition of the sound field into
|
||||
* spherical harmonics. Each channel corresponds to a single expansion
|
||||
* component. Channels are ordered according to ACN (Ambisonic Channel
|
||||
* Number).
|
||||
*
|
||||
* The channel with the index n in the stream contains the spherical
|
||||
* harmonic of degree l and order m given by
|
||||
* @code{.unparsed}
|
||||
* l = floor(sqrt(n)),
|
||||
* m = n - l * (l + 1).
|
||||
* @endcode
|
||||
*
|
||||
* Conversely given a spherical harmonic of degree l and order m, the
|
||||
* corresponding channel index n is given by
|
||||
* @code{.unparsed}
|
||||
* n = l * (l + 1) + m.
|
||||
* @endcode
|
||||
*
|
||||
* Normalization is assumed to be SN3D (Schmidt Semi-Normalization)
|
||||
* as defined in AmbiX format $ 2.1.
|
||||
*/
|
||||
AV_CHANNEL_ORDER_AMBISONIC,
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup channel_masks Audio channel masks
|
||||
*
|
||||
@ -46,36 +155,46 @@
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
#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
|
||||
#define AV_CH_FRONT_LEFT (1ULL << AV_CHAN_FRONT_LEFT )
|
||||
#define AV_CH_FRONT_RIGHT (1ULL << AV_CHAN_FRONT_RIGHT )
|
||||
#define AV_CH_FRONT_CENTER (1ULL << AV_CHAN_FRONT_CENTER )
|
||||
#define AV_CH_LOW_FREQUENCY (1ULL << AV_CHAN_LOW_FREQUENCY )
|
||||
#define AV_CH_BACK_LEFT (1ULL << AV_CHAN_BACK_LEFT )
|
||||
#define AV_CH_BACK_RIGHT (1ULL << AV_CHAN_BACK_RIGHT )
|
||||
#define AV_CH_FRONT_LEFT_OF_CENTER (1ULL << AV_CHAN_FRONT_LEFT_OF_CENTER )
|
||||
#define AV_CH_FRONT_RIGHT_OF_CENTER (1ULL << AV_CHAN_FRONT_RIGHT_OF_CENTER)
|
||||
#define AV_CH_BACK_CENTER (1ULL << AV_CHAN_BACK_CENTER )
|
||||
#define AV_CH_SIDE_LEFT (1ULL << AV_CHAN_SIDE_LEFT )
|
||||
#define AV_CH_SIDE_RIGHT (1ULL << AV_CHAN_SIDE_RIGHT )
|
||||
#define AV_CH_TOP_CENTER (1ULL << AV_CHAN_TOP_CENTER )
|
||||
#define AV_CH_TOP_FRONT_LEFT (1ULL << AV_CHAN_TOP_FRONT_LEFT )
|
||||
#define AV_CH_TOP_FRONT_CENTER (1ULL << AV_CHAN_TOP_FRONT_CENTER )
|
||||
#define AV_CH_TOP_FRONT_RIGHT (1ULL << AV_CHAN_TOP_FRONT_RIGHT )
|
||||
#define AV_CH_TOP_BACK_LEFT (1ULL << AV_CHAN_TOP_BACK_LEFT )
|
||||
#define AV_CH_TOP_BACK_CENTER (1ULL << AV_CHAN_TOP_BACK_CENTER )
|
||||
#define AV_CH_TOP_BACK_RIGHT (1ULL << AV_CHAN_TOP_BACK_RIGHT )
|
||||
#define AV_CH_STEREO_LEFT (1ULL << AV_CHAN_STEREO_LEFT )
|
||||
#define AV_CH_STEREO_RIGHT (1ULL << AV_CHAN_STEREO_RIGHT )
|
||||
#define AV_CH_WIDE_LEFT (1ULL << AV_CHAN_WIDE_LEFT )
|
||||
#define AV_CH_WIDE_RIGHT (1ULL << AV_CHAN_WIDE_RIGHT )
|
||||
#define AV_CH_SURROUND_DIRECT_LEFT (1ULL << AV_CHAN_SURROUND_DIRECT_LEFT )
|
||||
#define AV_CH_SURROUND_DIRECT_RIGHT (1ULL << AV_CHAN_SURROUND_DIRECT_RIGHT)
|
||||
#define AV_CH_LOW_FREQUENCY_2 (1ULL << AV_CHAN_LOW_FREQUENCY_2 )
|
||||
#define AV_CH_TOP_SIDE_LEFT (1ULL << AV_CHAN_TOP_SIDE_LEFT )
|
||||
#define AV_CH_TOP_SIDE_RIGHT (1ULL << AV_CHAN_TOP_SIDE_RIGHT )
|
||||
#define AV_CH_BOTTOM_FRONT_CENTER (1ULL << AV_CHAN_BOTTOM_FRONT_CENTER )
|
||||
#define AV_CH_BOTTOM_FRONT_LEFT (1ULL << AV_CHAN_BOTTOM_FRONT_LEFT )
|
||||
#define AV_CH_BOTTOM_FRONT_RIGHT (1ULL << AV_CHAN_BOTTOM_FRONT_RIGHT )
|
||||
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
/** 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. */
|
||||
to be the native codec channel order.
|
||||
@deprecated channel order is now indicated in a special field in
|
||||
AVChannelLayout
|
||||
*/
|
||||
#define AV_CH_LAYOUT_NATIVE 0x8000000000000000ULL
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
@ -110,6 +229,7 @@
|
||||
#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)
|
||||
#define AV_CH_LAYOUT_22POINT2 (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER|AV_CH_BACK_CENTER|AV_CH_LOW_FREQUENCY_2|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT|AV_CH_TOP_FRONT_CENTER|AV_CH_TOP_CENTER|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT|AV_CH_TOP_SIDE_LEFT|AV_CH_TOP_SIDE_RIGHT|AV_CH_TOP_BACK_CENTER|AV_CH_BOTTOM_FRONT_CENTER|AV_CH_BOTTOM_FRONT_LEFT|AV_CH_BOTTOM_FRONT_RIGHT)
|
||||
|
||||
enum AVMatrixEncoding {
|
||||
AV_MATRIX_ENCODING_NONE,
|
||||
@ -122,6 +242,149 @@ enum AVMatrixEncoding {
|
||||
AV_MATRIX_ENCODING_NB
|
||||
};
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* An AVChannelCustom defines a single channel within a custom order layout
|
||||
*
|
||||
* Unlike most structures in FFmpeg, sizeof(AVChannelCustom) is a part of the
|
||||
* public ABI.
|
||||
*
|
||||
* No new fields may be added to it without a major version bump.
|
||||
*/
|
||||
typedef struct AVChannelCustom {
|
||||
enum AVChannel id;
|
||||
char name[16];
|
||||
void *opaque;
|
||||
} AVChannelCustom;
|
||||
|
||||
/**
|
||||
* An AVChannelLayout holds information about the channel layout of audio data.
|
||||
*
|
||||
* A channel layout here is defined as a set of channels ordered in a specific
|
||||
* way (unless the channel order is AV_CHANNEL_ORDER_UNSPEC, in which case an
|
||||
* AVChannelLayout carries only the channel count).
|
||||
*
|
||||
* Unlike most structures in Libav, sizeof(AVChannelLayout) is a part of the
|
||||
* public ABI and may be used by the caller. E.g. it may be allocated on stack
|
||||
* or embedded in caller-defined structs.
|
||||
*
|
||||
* AVChannelLayout can be initialized as follows:
|
||||
* - default initialization with {0}, followed by setting all used fields
|
||||
* correctly;
|
||||
* - by assigning one of the predefined AV_CHANNEL_LAYOUT_* initializers;
|
||||
* - with a constructor function, such as av_channel_layout_default(),
|
||||
* av_channel_layout_from_mask() or av_channel_layout_from_string().
|
||||
*
|
||||
* The channel layout must be unitialized with av_channel_layout_uninit()
|
||||
*
|
||||
* Copying an AVChannelLayout via assigning is forbidden,
|
||||
* av_channel_layout_copy() must be used instead (and its return value should
|
||||
* be checked)
|
||||
*
|
||||
* No new fields may be added to it without a major version bump, except for
|
||||
* new elements of the union fitting in sizeof(uint64_t).
|
||||
*/
|
||||
typedef struct AVChannelLayout {
|
||||
/**
|
||||
* Channel order used in this layout.
|
||||
* This is a mandatory field.
|
||||
*/
|
||||
enum AVChannelOrder order;
|
||||
|
||||
/**
|
||||
* Number of channels in this layout. Mandatory field.
|
||||
*/
|
||||
int nb_channels;
|
||||
|
||||
/**
|
||||
* Details about which channels are present in this layout.
|
||||
* For AV_CHANNEL_ORDER_UNSPEC, this field is undefined and must not be
|
||||
* used.
|
||||
*/
|
||||
union {
|
||||
/**
|
||||
* This member must be used for AV_CHANNEL_ORDER_NATIVE, and may be used
|
||||
* for AV_CHANNEL_ORDER_AMBISONIC to signal non-diegetic channels.
|
||||
* It is a bitmask, where the position of each set bit means that the
|
||||
* AVChannel with the corresponding value is present.
|
||||
*
|
||||
* I.e. when (mask & (1 << AV_CHAN_FOO)) is non-zero, then AV_CHAN_FOO
|
||||
* is present in the layout. Otherwise it is not present.
|
||||
*
|
||||
* @note when a channel layout using a bitmask is constructed or
|
||||
* modified manually (i.e. not using any of the av_channel_layout_*
|
||||
* functions), the code doing it must ensure that the number of set bits
|
||||
* is equal to nb_channels.
|
||||
*/
|
||||
uint64_t mask;
|
||||
/**
|
||||
* This member must be used when the channel order is
|
||||
* AV_CHANNEL_ORDER_CUSTOM. It is a nb_channels-sized array, with each
|
||||
* element signalling the presence of the AVChannel with the
|
||||
* corresponding value in map[i].id.
|
||||
*
|
||||
* I.e. when map[i].id is equal to AV_CHAN_FOO, then AV_CH_FOO is the
|
||||
* i-th channel in the audio data.
|
||||
*
|
||||
* When map[i].id is in the range between AV_CHAN_AMBISONIC_BASE and
|
||||
* AV_CHAN_AMBISONIC_END (inclusive), the channel contains an ambisonic
|
||||
* component with ACN index (as defined above)
|
||||
* n = map[i].id - AV_CHAN_AMBISONIC_BASE.
|
||||
*
|
||||
* map[i].name may be filled with a 0-terminated string, in which case
|
||||
* it will be used for the purpose of identifying the channel with the
|
||||
* convenience functions below. Otherise it must be zeroed.
|
||||
*/
|
||||
AVChannelCustom *map;
|
||||
} u;
|
||||
|
||||
/**
|
||||
* For some private data of the user.
|
||||
*/
|
||||
void *opaque;
|
||||
} AVChannelLayout;
|
||||
|
||||
#define AV_CHANNEL_LAYOUT_MASK(nb, m) \
|
||||
{ .order = AV_CHANNEL_ORDER_NATIVE, .nb_channels = (nb), .u = { .mask = (m) }}
|
||||
|
||||
#define AV_CHANNEL_LAYOUT_MONO AV_CHANNEL_LAYOUT_MASK(1, AV_CH_LAYOUT_MONO)
|
||||
#define AV_CHANNEL_LAYOUT_STEREO AV_CHANNEL_LAYOUT_MASK(2, AV_CH_LAYOUT_STEREO)
|
||||
#define AV_CHANNEL_LAYOUT_2POINT1 AV_CHANNEL_LAYOUT_MASK(3, AV_CH_LAYOUT_2POINT1)
|
||||
#define AV_CHANNEL_LAYOUT_2_1 AV_CHANNEL_LAYOUT_MASK(3, AV_CH_LAYOUT_2_1)
|
||||
#define AV_CHANNEL_LAYOUT_SURROUND AV_CHANNEL_LAYOUT_MASK(3, AV_CH_LAYOUT_SURROUND)
|
||||
#define AV_CHANNEL_LAYOUT_3POINT1 AV_CHANNEL_LAYOUT_MASK(4, AV_CH_LAYOUT_3POINT1)
|
||||
#define AV_CHANNEL_LAYOUT_4POINT0 AV_CHANNEL_LAYOUT_MASK(4, AV_CH_LAYOUT_4POINT0)
|
||||
#define AV_CHANNEL_LAYOUT_4POINT1 AV_CHANNEL_LAYOUT_MASK(5, AV_CH_LAYOUT_4POINT1)
|
||||
#define AV_CHANNEL_LAYOUT_2_2 AV_CHANNEL_LAYOUT_MASK(4, AV_CH_LAYOUT_2_2)
|
||||
#define AV_CHANNEL_LAYOUT_QUAD AV_CHANNEL_LAYOUT_MASK(4, AV_CH_LAYOUT_QUAD)
|
||||
#define AV_CHANNEL_LAYOUT_5POINT0 AV_CHANNEL_LAYOUT_MASK(5, AV_CH_LAYOUT_5POINT0)
|
||||
#define AV_CHANNEL_LAYOUT_5POINT1 AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_5POINT1)
|
||||
#define AV_CHANNEL_LAYOUT_5POINT0_BACK AV_CHANNEL_LAYOUT_MASK(5, AV_CH_LAYOUT_5POINT0_BACK)
|
||||
#define AV_CHANNEL_LAYOUT_5POINT1_BACK AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_5POINT1_BACK)
|
||||
#define AV_CHANNEL_LAYOUT_6POINT0 AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_6POINT0)
|
||||
#define AV_CHANNEL_LAYOUT_6POINT0_FRONT AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_6POINT0_FRONT)
|
||||
#define AV_CHANNEL_LAYOUT_HEXAGONAL AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_HEXAGONAL)
|
||||
#define AV_CHANNEL_LAYOUT_6POINT1 AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_6POINT1)
|
||||
#define AV_CHANNEL_LAYOUT_6POINT1_BACK AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_6POINT1_BACK)
|
||||
#define AV_CHANNEL_LAYOUT_6POINT1_FRONT AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_6POINT1_FRONT)
|
||||
#define AV_CHANNEL_LAYOUT_7POINT0 AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_7POINT0)
|
||||
#define AV_CHANNEL_LAYOUT_7POINT0_FRONT AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_7POINT0_FRONT)
|
||||
#define AV_CHANNEL_LAYOUT_7POINT1 AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1)
|
||||
#define AV_CHANNEL_LAYOUT_7POINT1_WIDE AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_WIDE)
|
||||
#define AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_WIDE_BACK)
|
||||
#define AV_CHANNEL_LAYOUT_OCTAGONAL AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_OCTAGONAL)
|
||||
#define AV_CHANNEL_LAYOUT_HEXADECAGONAL AV_CHANNEL_LAYOUT_MASK(16, AV_CH_LAYOUT_HEXADECAGONAL)
|
||||
#define AV_CHANNEL_LAYOUT_STEREO_DOWNMIX AV_CHANNEL_LAYOUT_MASK(2, AV_CH_LAYOUT_STEREO_DOWNMIX)
|
||||
#define AV_CHANNEL_LAYOUT_22POINT2 AV_CHANNEL_LAYOUT_MASK(24, AV_CH_LAYOUT_22POINT2)
|
||||
#define AV_CHANNEL_LAYOUT_AMBISONIC_FIRST_ORDER \
|
||||
{ .order = AV_CHANNEL_ORDER_AMBISONIC, .nb_channels = 4, .u = { .mask = 0 }}
|
||||
|
||||
struct AVBPrint;
|
||||
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
/**
|
||||
* Return a channel layout id that matches name, or 0 if no match is found.
|
||||
*
|
||||
@ -138,7 +401,10 @@ enum AVMatrixEncoding {
|
||||
* AV_CH_* macros).
|
||||
*
|
||||
* Example: "stereo+FC" = "2c+FC" = "2c+1c" = "0x7"
|
||||
*
|
||||
* @deprecated use av_channel_layout_from_string()
|
||||
*/
|
||||
attribute_deprecated
|
||||
uint64_t av_get_channel_layout(const char *name);
|
||||
|
||||
/**
|
||||
@ -152,7 +418,9 @@ uint64_t av_get_channel_layout(const char *name);
|
||||
* @param[out] nb_channels number of channels
|
||||
*
|
||||
* @return 0 on success, AVERROR(EINVAL) if the parsing fails.
|
||||
* @deprecated use av_channel_layout_from_string()
|
||||
*/
|
||||
attribute_deprecated
|
||||
int av_get_extended_channel_layout(const char *name, uint64_t* channel_layout, int* nb_channels);
|
||||
|
||||
/**
|
||||
@ -161,23 +429,31 @@ int av_get_extended_channel_layout(const char *name, uint64_t* channel_layout, i
|
||||
*
|
||||
* @param buf put here the string containing the channel layout
|
||||
* @param buf_size size in bytes of the buffer
|
||||
* @deprecated use av_channel_layout_describe()
|
||||
*/
|
||||
attribute_deprecated
|
||||
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.
|
||||
* @deprecated use av_channel_layout_describe()
|
||||
*/
|
||||
attribute_deprecated
|
||||
void av_bprint_channel_layout(struct AVBPrint *bp, int nb_channels, uint64_t channel_layout);
|
||||
|
||||
/**
|
||||
* Return the number of channels in the channel layout.
|
||||
* @deprecated use AVChannelLayout.nb_channels
|
||||
*/
|
||||
attribute_deprecated
|
||||
int av_get_channel_layout_nb_channels(uint64_t channel_layout);
|
||||
|
||||
/**
|
||||
* Return default channel layout for a given number of channels.
|
||||
*
|
||||
* @deprecated use av_channel_layout_default()
|
||||
*/
|
||||
attribute_deprecated
|
||||
int64_t av_get_default_channel_layout(int nb_channels);
|
||||
|
||||
/**
|
||||
@ -188,20 +464,28 @@ int64_t av_get_default_channel_layout(int nb_channels);
|
||||
*
|
||||
* @return index of channel in channel_layout on success, a negative AVERROR
|
||||
* on error.
|
||||
*
|
||||
* @deprecated use av_channel_layout_index_from_channel()
|
||||
*/
|
||||
attribute_deprecated
|
||||
int av_get_channel_layout_channel_index(uint64_t channel_layout,
|
||||
uint64_t channel);
|
||||
|
||||
/**
|
||||
* Get the channel with the given index in channel_layout.
|
||||
* @deprecated use av_channel_layout_channel_from_index()
|
||||
*/
|
||||
attribute_deprecated
|
||||
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.
|
||||
*
|
||||
* @deprecated use av_channel_name()
|
||||
*/
|
||||
attribute_deprecated
|
||||
const char *av_get_channel_name(uint64_t channel);
|
||||
|
||||
/**
|
||||
@ -209,7 +493,9 @@ const char *av_get_channel_name(uint64_t channel);
|
||||
*
|
||||
* @param channel a channel layout with a single channel
|
||||
* @return channel description on success, NULL on error
|
||||
* @deprecated use av_channel_description()
|
||||
*/
|
||||
attribute_deprecated
|
||||
const char *av_get_channel_description(uint64_t channel);
|
||||
|
||||
/**
|
||||
@ -220,9 +506,240 @@ const char *av_get_channel_description(uint64_t channel);
|
||||
* @param[out] name name of the layout
|
||||
* @return 0 if the layout exists,
|
||||
* <0 if index is beyond the limits
|
||||
* @deprecated use av_channel_layout_standard()
|
||||
*/
|
||||
attribute_deprecated
|
||||
int av_get_standard_channel_layout(unsigned index, uint64_t *layout,
|
||||
const char **name);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Get a human readable string in an abbreviated form describing a given channel.
|
||||
* This is the inverse function of @ref av_channel_from_string().
|
||||
*
|
||||
* @param buf pre-allocated buffer where to put the generated string
|
||||
* @param buf_size size in bytes of the buffer.
|
||||
* @return amount of bytes needed to hold the output string, or a negative AVERROR
|
||||
* on failure. If the returned value is bigger than buf_size, then the
|
||||
* string was truncated.
|
||||
*/
|
||||
int av_channel_name(char *buf, size_t buf_size, enum AVChannel channel);
|
||||
|
||||
/**
|
||||
* bprint variant of av_channel_name().
|
||||
*
|
||||
* @note the string will be appended to the bprint buffer.
|
||||
*/
|
||||
void av_channel_name_bprint(struct AVBPrint *bp, enum AVChannel channel_id);
|
||||
|
||||
/**
|
||||
* Get a human readable string describing a given channel.
|
||||
*
|
||||
* @param buf pre-allocated buffer where to put the generated string
|
||||
* @param buf_size size in bytes of the buffer.
|
||||
* @return amount of bytes needed to hold the output string, or a negative AVERROR
|
||||
* on failure. If the returned value is bigger than buf_size, then the
|
||||
* string was truncated.
|
||||
*/
|
||||
int av_channel_description(char *buf, size_t buf_size, enum AVChannel channel);
|
||||
|
||||
/**
|
||||
* bprint variant of av_channel_description().
|
||||
*
|
||||
* @note the string will be appended to the bprint buffer.
|
||||
*/
|
||||
void av_channel_description_bprint(struct AVBPrint *bp, enum AVChannel channel_id);
|
||||
|
||||
/**
|
||||
* This is the inverse function of @ref av_channel_name().
|
||||
*
|
||||
* @return the channel with the given name
|
||||
* AV_CHAN_NONE when name does not identify a known channel
|
||||
*/
|
||||
enum AVChannel av_channel_from_string(const char *name);
|
||||
|
||||
/**
|
||||
* Initialize a native channel layout from a bitmask indicating which channels
|
||||
* are present.
|
||||
*
|
||||
* @param channel_layout the layout structure to be initialized
|
||||
* @param mask bitmask describing the channel layout
|
||||
*
|
||||
* @return 0 on success
|
||||
* AVERROR(EINVAL) for invalid mask values
|
||||
*/
|
||||
int av_channel_layout_from_mask(AVChannelLayout *channel_layout, uint64_t mask);
|
||||
|
||||
/**
|
||||
* Initialize a channel layout from a given string description.
|
||||
* The input string can be represented by:
|
||||
* - the formal channel layout name (returned by av_channel_layout_describe())
|
||||
* - single or multiple channel names (returned by av_channel_name(), eg. "FL",
|
||||
* or concatenated with "+", each optionally containing a custom name after
|
||||
* a "@", eg. "FL@Left+FR@Right+LFE")
|
||||
* - a decimal or hexadecimal value of a native channel layout (eg. "4" or "0x4")
|
||||
* - the number of channels with default layout (eg. "4c")
|
||||
* - the number of unordered channels (eg. "4C" or "4 channels")
|
||||
* - the ambisonic order followed by optional non-diegetic channels (eg.
|
||||
* "ambisonic 2+stereo")
|
||||
*
|
||||
* @param channel_layout input channel layout
|
||||
* @param str string describing the channel layout
|
||||
* @return 0 channel layout was detected, AVERROR_INVALIDATATA otherwise
|
||||
*/
|
||||
int av_channel_layout_from_string(AVChannelLayout *channel_layout,
|
||||
const char *str);
|
||||
|
||||
/**
|
||||
* Get the default channel layout for a given number of channels.
|
||||
*
|
||||
* @param channel_layout the layout structure to be initialized
|
||||
* @param nb_channels number of channels
|
||||
*/
|
||||
void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels);
|
||||
|
||||
/**
|
||||
* Iterate over all standard channel layouts.
|
||||
*
|
||||
* @param opaque a pointer where libavutil will store the iteration state. Must
|
||||
* point to NULL to start the iteration.
|
||||
*
|
||||
* @return the standard channel layout or NULL when the iteration is
|
||||
* finished
|
||||
*/
|
||||
const AVChannelLayout *av_channel_layout_standard(void **opaque);
|
||||
|
||||
/**
|
||||
* Free any allocated data in the channel layout and reset the channel
|
||||
* count to 0.
|
||||
*
|
||||
* @param channel_layout the layout structure to be uninitialized
|
||||
*/
|
||||
void av_channel_layout_uninit(AVChannelLayout *channel_layout);
|
||||
|
||||
/**
|
||||
* Make a copy of a channel layout. This differs from just assigning src to dst
|
||||
* in that it allocates and copies the map for AV_CHANNEL_ORDER_CUSTOM.
|
||||
*
|
||||
* @note the destination channel_layout will be always uninitialized before copy.
|
||||
*
|
||||
* @param dst destination channel layout
|
||||
* @param src source channel layout
|
||||
* @return 0 on success, a negative AVERROR on error.
|
||||
*/
|
||||
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src);
|
||||
|
||||
/**
|
||||
* Get a human-readable string describing the channel layout properties.
|
||||
* The string will be in the same format that is accepted by
|
||||
* @ref av_channel_layout_from_string(), allowing to rebuild the same
|
||||
* channel layout, except for opaque pointers.
|
||||
*
|
||||
* @param channel_layout channel layout to be described
|
||||
* @param buf pre-allocated buffer where to put the generated string
|
||||
* @param buf_size size in bytes of the buffer.
|
||||
* @return amount of bytes needed to hold the output string, or a negative AVERROR
|
||||
* on failure. If the returned value is bigger than buf_size, then the
|
||||
* string was truncated.
|
||||
*/
|
||||
int av_channel_layout_describe(const AVChannelLayout *channel_layout,
|
||||
char *buf, size_t buf_size);
|
||||
|
||||
/**
|
||||
* bprint variant of av_channel_layout_describe().
|
||||
*
|
||||
* @note the string will be appended to the bprint buffer.
|
||||
* @return 0 on success, or a negative AVERROR value on failure.
|
||||
*/
|
||||
int av_channel_layout_describe_bprint(const AVChannelLayout *channel_layout,
|
||||
struct AVBPrint *bp);
|
||||
|
||||
/**
|
||||
* Get the channel with the given index in a channel layout.
|
||||
*
|
||||
* @param channel_layout input channel layout
|
||||
* @return channel with the index idx in channel_layout on success or
|
||||
* AV_CHAN_NONE on failure (if idx is not valid or the channel order is
|
||||
* unspecified)
|
||||
*/
|
||||
enum AVChannel
|
||||
av_channel_layout_channel_from_index(const AVChannelLayout *channel_layout, unsigned int idx);
|
||||
|
||||
/**
|
||||
* Get the index of a given channel in a channel layout. In case multiple
|
||||
* channels are found, only the first match will be returned.
|
||||
*
|
||||
* @param channel_layout input channel layout
|
||||
* @return index of channel in channel_layout on success or a negative number if
|
||||
* channel is not present in channel_layout.
|
||||
*/
|
||||
int av_channel_layout_index_from_channel(const AVChannelLayout *channel_layout,
|
||||
enum AVChannel channel);
|
||||
|
||||
/**
|
||||
* Get the index in a channel layout of a channel described by the given string.
|
||||
* In case multiple channels are found, only the first match will be returned.
|
||||
*
|
||||
* This function accepts channel names in the same format as
|
||||
* @ref av_channel_from_string().
|
||||
*
|
||||
* @param channel_layout input channel layout
|
||||
* @return a channel index described by the given string, or a negative AVERROR
|
||||
* value.
|
||||
*/
|
||||
int av_channel_layout_index_from_string(const AVChannelLayout *channel_layout,
|
||||
const char *name);
|
||||
|
||||
/**
|
||||
* Get a channel described by the given string.
|
||||
*
|
||||
* This function accepts channel names in the same format as
|
||||
* @ref av_channel_from_string().
|
||||
*
|
||||
* @param channel_layout input channel layout
|
||||
* @return a channel described by the given string in channel_layout on success
|
||||
* or AV_CHAN_NONE on failure (if the string is not valid or the channel
|
||||
* order is unspecified)
|
||||
*/
|
||||
enum AVChannel
|
||||
av_channel_layout_channel_from_string(const AVChannelLayout *channel_layout,
|
||||
const char *name);
|
||||
|
||||
/**
|
||||
* Find out what channels from a given set are present in a channel layout,
|
||||
* without regard for their positions.
|
||||
*
|
||||
* @param channel_layout input channel layout
|
||||
* @param mask a combination of AV_CH_* representing a set of channels
|
||||
* @return a bitfield representing all the channels from mask that are present
|
||||
* in channel_layout
|
||||
*/
|
||||
uint64_t av_channel_layout_subset(const AVChannelLayout *channel_layout,
|
||||
uint64_t mask);
|
||||
|
||||
/**
|
||||
* Check whether a channel layout is valid, i.e. can possibly describe audio
|
||||
* data.
|
||||
*
|
||||
* @param channel_layout input channel layout
|
||||
* @return 1 if channel_layout is valid, 0 otherwise.
|
||||
*/
|
||||
int av_channel_layout_check(const AVChannelLayout *channel_layout);
|
||||
|
||||
/**
|
||||
* Check whether two channel layouts are semantically the same, i.e. the same
|
||||
* channels are present on the same positions in both.
|
||||
*
|
||||
* If one of the channel layouts is AV_CHANNEL_ORDER_UNSPEC, while the other is
|
||||
* not, they are considered to be unequal. If both are AV_CHANNEL_ORDER_UNSPEC,
|
||||
* they are considered equal iff the channel counts are the same in both.
|
||||
*
|
||||
* @param chl input channel layout
|
||||
* @param chl1 input channel layout
|
||||
* @return 0 if chl and chl1 are equal, 1 if they are not equal. A negative
|
||||
* AVERROR code if one or both are invalid.
|
||||
*/
|
||||
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -31,11 +31,7 @@
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
/* modification for MSVC by kode54 */
|
||||
#ifndef _MSC_VER
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
/* end modification */
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
@ -45,19 +41,11 @@
|
||||
|
||||
#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))
|
||||
#define ROUNDED_DIV(a,b) (((a)>=0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
|
||||
/* Fast a/(1<<b) rounded toward +inf. Assume a>=0 and b>=0 */
|
||||
#define AV_CEIL_RSHIFT(a,b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \
|
||||
: ((a) + (1<<(b)) - 1) >> (b))
|
||||
@ -85,23 +73,13 @@
|
||||
#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.
|
||||
* Unsigned Absolute value.
|
||||
* This takes the absolute value of a signed int and returns it as a unsigned.
|
||||
* This also works with INT_MIN which would otherwise not be representable
|
||||
* As with many macros, this evaluates its argument twice.
|
||||
*/
|
||||
#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]))
|
||||
#define FFABSU(a) ((a) <= 0 ? -(unsigned)(a) : (unsigned)(a))
|
||||
#define FFABS64U(a) ((a) <= 0 ? -(uint64_t)(a) : (uint64_t)(a))
|
||||
|
||||
/* misc math functions */
|
||||
|
||||
@ -110,8 +88,72 @@
|
||||
# include "intmath.h"
|
||||
#endif
|
||||
|
||||
/* Pull in unguarded fallback defines at the end of this file. */
|
||||
#include "common.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_sat_sub32
|
||||
# define av_sat_sub32 av_sat_sub32_c
|
||||
#endif
|
||||
#ifndef av_sat_dsub32
|
||||
# define av_sat_dsub32 av_sat_dsub32_c
|
||||
#endif
|
||||
#ifndef av_sat_add64
|
||||
# define av_sat_add64 av_sat_add64_c
|
||||
#endif
|
||||
#ifndef av_sat_sub64
|
||||
# define av_sat_sub64 av_sat_sub64_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
|
||||
#ifndef av_parity
|
||||
# define av_parity av_parity_c
|
||||
#endif
|
||||
|
||||
#ifndef av_log2
|
||||
av_const int av_log2(unsigned v);
|
||||
@ -244,7 +286,7 @@ static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
|
||||
*/
|
||||
static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p)
|
||||
{
|
||||
return a & ((1 << p) - 1);
|
||||
return a & ((1U << p) - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -295,8 +337,49 @@ static av_always_inline int av_sat_dsub32_c(int a, int b)
|
||||
return av_sat_sub32(a, av_sat_add32(b, b));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add two signed 64-bit values with saturation.
|
||||
*
|
||||
* @param a one value
|
||||
* @param b another value
|
||||
* @return sum with signed saturation
|
||||
*/
|
||||
static av_always_inline int64_t av_sat_add64_c(int64_t a, int64_t b) {
|
||||
#if (!defined(__INTEL_COMPILER) && AV_GCC_VERSION_AT_LEAST(5,1)) || AV_HAS_BUILTIN(__builtin_add_overflow)
|
||||
int64_t tmp;
|
||||
return !__builtin_add_overflow(a, b, &tmp) ? tmp : (tmp < 0 ? INT64_MAX : INT64_MIN);
|
||||
#else
|
||||
int64_t s = a+(uint64_t)b;
|
||||
if ((int64_t)(a^b | ~s^b) >= 0)
|
||||
return INT64_MAX ^ (b >> 63);
|
||||
return s;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Subtract two signed 64-bit values with saturation.
|
||||
*
|
||||
* @param a one value
|
||||
* @param b another value
|
||||
* @return difference with signed saturation
|
||||
*/
|
||||
static av_always_inline int64_t av_sat_sub64_c(int64_t a, int64_t b) {
|
||||
#if (!defined(__INTEL_COMPILER) && AV_GCC_VERSION_AT_LEAST(5,1)) || AV_HAS_BUILTIN(__builtin_sub_overflow)
|
||||
int64_t tmp;
|
||||
return !__builtin_sub_overflow(a, b, &tmp) ? tmp : (tmp < 0 ? INT64_MAX : INT64_MIN);
|
||||
#else
|
||||
if (b <= 0 && a >= INT64_MAX + b)
|
||||
return INT64_MAX;
|
||||
if (b >= 0 && a <= INT64_MIN + b)
|
||||
return INT64_MIN;
|
||||
return a - b;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Clip a float value into the amin-amax range.
|
||||
* If a is nan or -inf amin will be returned.
|
||||
* If a is +inf amax will be returned.
|
||||
* @param a value to clip
|
||||
* @param amin minimum value of the clip range
|
||||
* @param amax maximum value of the clip range
|
||||
@ -307,13 +390,13 @@ static av_always_inline av_const float av_clipf_c(float a, float amin, float ama
|
||||
#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;
|
||||
return FFMIN(FFMAX(a, amin), amax);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clip a double value into the amin-amax range.
|
||||
* If a is nan or -inf amin will be returned.
|
||||
* If a is +inf amax will be returned.
|
||||
* @param a value to clip
|
||||
* @param amin minimum value of the clip range
|
||||
* @param amax maximum value of the clip range
|
||||
@ -324,9 +407,7 @@ static av_always_inline av_const double av_clipd_c(double a, double amin, double
|
||||
#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;
|
||||
return FFMIN(FFMAX(a, amin), amax);
|
||||
}
|
||||
|
||||
/** Compute ceil(log2(x)).
|
||||
@ -335,7 +416,7 @@ static av_always_inline av_const double av_clipd_c(double a, double amin, double
|
||||
*/
|
||||
static av_always_inline av_const int av_ceil_log2_c(int x)
|
||||
{
|
||||
return av_log2((x - 1) << 1);
|
||||
return av_log2((x - 1U) << 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -367,9 +448,6 @@ static av_always_inline av_const int av_parity_c(uint32_t v)
|
||||
return av_popcount(v) & 1;
|
||||
}
|
||||
|
||||
#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.
|
||||
*
|
||||
@ -377,7 +455,9 @@ static av_always_inline av_const int av_parity_c(uint32_t v)
|
||||
* @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++.
|
||||
* input, this could be *ptr++, or if you want to make sure
|
||||
* that *ptr stops at the end of a NULL terminated string then
|
||||
* *ptr ? *ptr++ : 0
|
||||
* @param ERROR Expression to be evaluated on invalid input,
|
||||
* typically a goto statement.
|
||||
*
|
||||
@ -391,11 +471,11 @@ static av_always_inline av_const int av_parity_c(uint32_t v)
|
||||
{\
|
||||
uint32_t top = (val & 128) >> 1;\
|
||||
if ((val & 0xc0) == 0x80 || val >= 0xFE)\
|
||||
ERROR\
|
||||
{ERROR}\
|
||||
while (val & top) {\
|
||||
int tmp= (GET_BYTE) - 128;\
|
||||
unsigned int tmp = (GET_BYTE) - 128;\
|
||||
if(tmp>>6)\
|
||||
ERROR\
|
||||
{ERROR}\
|
||||
val= (val<<6) + tmp;\
|
||||
top <<= 5;\
|
||||
}\
|
||||
@ -412,13 +492,13 @@ static av_always_inline av_const int av_parity_c(uint32_t v)
|
||||
* typically a goto statement.
|
||||
*/
|
||||
#define GET_UTF16(val, GET_16BIT, ERROR)\
|
||||
val = GET_16BIT;\
|
||||
val = (GET_16BIT);\
|
||||
{\
|
||||
unsigned int hi = val - 0xD800;\
|
||||
if (hi < 0x800) {\
|
||||
val = GET_16BIT - 0xDC00;\
|
||||
val = (GET_16BIT) - 0xDC00;\
|
||||
if (val > 0x3FFU || hi > 0x3FFU)\
|
||||
ERROR\
|
||||
{ERROR}\
|
||||
val += (hi<<10) + 0x10000;\
|
||||
}\
|
||||
}\
|
||||
@ -496,69 +576,3 @@ static av_always_inline av_const int av_parity_c(uint32_t v)
|
||||
#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_sat_sub32
|
||||
# define av_sat_sub32 av_sat_sub32_c
|
||||
#endif
|
||||
#ifndef av_sat_dsub32
|
||||
# define av_sat_dsub32 av_sat_dsub32_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
|
||||
#ifndef av_parity
|
||||
# define av_parity av_parity_c
|
||||
#endif
|
||||
|
@ -23,8 +23,6 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "attributes.h"
|
||||
|
||||
#define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */
|
||||
|
||||
/* lower 16 bits - CPU features */
|
||||
@ -56,6 +54,8 @@
|
||||
#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_AVX512 0x100000 ///< AVX-512 functions: requires OS support even if YMM/ZMM registers aren't used
|
||||
#define AV_CPU_FLAG_AVX512ICL 0x200000 ///< F/CD/BW/DQ/VL/VNNI/IFMA/VBMI/VBMI2/VPOPCNTDQ/BITALG/GFNI/VAES/VPCLMULQDQ
|
||||
#define AV_CPU_FLAG_SLOW_GATHER 0x2000000 ///< CPU has slow gathers.
|
||||
|
||||
#define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard
|
||||
#define AV_CPU_FLAG_VSX 0x0002 ///< ISA 2.06
|
||||
@ -71,6 +71,13 @@
|
||||
#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)
|
||||
|
||||
#define AV_CPU_FLAG_MMI (1 << 0)
|
||||
#define AV_CPU_FLAG_MSA (1 << 1)
|
||||
|
||||
//Loongarch SIMD extension.
|
||||
#define AV_CPU_FLAG_LSX (1 << 0)
|
||||
#define AV_CPU_FLAG_LASX (1 << 1)
|
||||
|
||||
/**
|
||||
* Return the flags which specify extensions supported by the CPU.
|
||||
* The returned value is affected by av_force_cpu_flags() if that was used
|
||||
@ -85,25 +92,6 @@ int av_get_cpu_flags(void);
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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.
|
||||
*
|
||||
@ -116,6 +104,12 @@ int av_parse_cpu_caps(unsigned *flags, const char *s);
|
||||
*/
|
||||
int av_cpu_count(void);
|
||||
|
||||
/**
|
||||
* Overrides cpu count detection and forces the specified count.
|
||||
* Count < 1 disables forcing of specific count.
|
||||
*/
|
||||
void av_cpu_force_count(int count);
|
||||
|
||||
/**
|
||||
* Get the maximum data alignment that may be required by FFmpeg.
|
||||
*
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "attributes.h"
|
||||
#include "version.h"
|
||||
|
||||
/**
|
||||
* @defgroup lavu_crc32 CRC
|
||||
|
106
ext_includes/ffmpeg/libavutil/csp.h
Normal file
106
ext_includes/ffmpeg/libavutil/csp.h
Normal file
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Ronald S. Bultje <rsbultje@gmail.com>
|
||||
* 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_CSP_H
|
||||
#define AVUTIL_CSP_H
|
||||
|
||||
#include "pixfmt.h"
|
||||
#include "rational.h"
|
||||
|
||||
/**
|
||||
* @file Colorspace value utility functions for libavutil.
|
||||
* @author Ronald S. Bultje <rsbultje@gmail.com>
|
||||
* @author Leo Izen <leo.izen@gmail.com>
|
||||
* @defgroup lavu_math_csp Colorspace Utility
|
||||
* @ingroup lavu_math
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Struct containing luma coefficients to be used for RGB to YUV/YCoCg, or similar
|
||||
* calculations.
|
||||
*/
|
||||
typedef struct AVLumaCoefficients {
|
||||
AVRational cr, cg, cb;
|
||||
} AVLumaCoefficients;
|
||||
|
||||
/**
|
||||
* Struct containing chromaticity x and y values for the standard CIE 1931
|
||||
* chromaticity definition.
|
||||
*/
|
||||
typedef struct AVCIExy {
|
||||
AVRational x, y;
|
||||
} AVCIExy;
|
||||
|
||||
/**
|
||||
* Struct defining the red, green, and blue primary locations in terms of CIE
|
||||
* 1931 chromaticity x and y.
|
||||
*/
|
||||
typedef struct AVPrimaryCoefficients {
|
||||
AVCIExy r, g, b;
|
||||
} AVPrimaryCoefficients;
|
||||
|
||||
/**
|
||||
* Struct defining white point location in terms of CIE 1931 chromaticity x
|
||||
* and y.
|
||||
*/
|
||||
typedef AVCIExy AVWhitepointCoefficients;
|
||||
|
||||
/**
|
||||
* Struct that contains both white point location and primaries location, providing
|
||||
* the complete description of a color gamut.
|
||||
*/
|
||||
typedef struct AVColorPrimariesDesc {
|
||||
AVWhitepointCoefficients wp;
|
||||
AVPrimaryCoefficients prim;
|
||||
} AVColorPrimariesDesc;
|
||||
|
||||
/**
|
||||
* Retrieves the Luma coefficients necessary to construct a conversion matrix
|
||||
* from an enum constant describing the colorspace.
|
||||
* @param csp An enum constant indicating YUV or similar colorspace.
|
||||
* @return The Luma coefficients associated with that colorspace, or NULL
|
||||
* if the constant is unknown to libavutil.
|
||||
*/
|
||||
const AVLumaCoefficients *av_csp_luma_coeffs_from_avcsp(enum AVColorSpace csp);
|
||||
|
||||
/**
|
||||
* Retrieves a complete gamut description from an enum constant describing the
|
||||
* color primaries.
|
||||
* @param prm An enum constant indicating primaries
|
||||
* @return A description of the colorspace gamut associated with that enum
|
||||
* constant, or NULL if the constant is unknown to libavutil.
|
||||
*/
|
||||
const AVColorPrimariesDesc *av_csp_primaries_desc_from_id(enum AVColorPrimaries prm);
|
||||
|
||||
/**
|
||||
* Detects which enum AVColorPrimaries constant corresponds to the given complete
|
||||
* gamut description.
|
||||
* @see enum AVColorPrimaries
|
||||
* @param prm A description of the colorspace gamut
|
||||
* @return The enum constant associated with this gamut, or
|
||||
* AVCOL_PRI_UNSPECIFIED if no clear match can be idenitified.
|
||||
*/
|
||||
enum AVColorPrimaries av_csp_primaries_id_from_desc(const AVColorPrimariesDesc *prm);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* AVUTIL_CSP_H */
|
107
ext_includes/ffmpeg/libavutil/detection_bbox.h
Normal file
107
ext_includes/ffmpeg/libavutil/detection_bbox.h
Normal file
@ -0,0 +1,107 @@
|
||||
/*
|
||||
* 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_DETECTION_BBOX_H
|
||||
#define AVUTIL_DETECTION_BBOX_H
|
||||
|
||||
#include "rational.h"
|
||||
#include "avassert.h"
|
||||
#include "frame.h"
|
||||
|
||||
typedef struct AVDetectionBBox {
|
||||
/**
|
||||
* Distance in pixels from the left/top edge of the frame,
|
||||
* together with width and height, defining the bounding box.
|
||||
*/
|
||||
int x;
|
||||
int y;
|
||||
int w;
|
||||
int h;
|
||||
|
||||
#define AV_DETECTION_BBOX_LABEL_NAME_MAX_SIZE 64
|
||||
|
||||
/**
|
||||
* Detect result with confidence
|
||||
*/
|
||||
char detect_label[AV_DETECTION_BBOX_LABEL_NAME_MAX_SIZE];
|
||||
AVRational detect_confidence;
|
||||
|
||||
/**
|
||||
* At most 4 classifications based on the detected bounding box.
|
||||
* For example, we can get max 4 different attributes with 4 different
|
||||
* DNN models on one bounding box.
|
||||
* classify_count is zero if no classification.
|
||||
*/
|
||||
#define AV_NUM_DETECTION_BBOX_CLASSIFY 4
|
||||
uint32_t classify_count;
|
||||
char classify_labels[AV_NUM_DETECTION_BBOX_CLASSIFY][AV_DETECTION_BBOX_LABEL_NAME_MAX_SIZE];
|
||||
AVRational classify_confidences[AV_NUM_DETECTION_BBOX_CLASSIFY];
|
||||
} AVDetectionBBox;
|
||||
|
||||
typedef struct AVDetectionBBoxHeader {
|
||||
/**
|
||||
* Information about how the bounding box is generated.
|
||||
* for example, the DNN model name.
|
||||
*/
|
||||
char source[256];
|
||||
|
||||
/**
|
||||
* Number of bounding boxes in the array.
|
||||
*/
|
||||
uint32_t nb_bboxes;
|
||||
|
||||
/**
|
||||
* Offset in bytes from the beginning of this structure at which
|
||||
* the array of bounding boxes starts.
|
||||
*/
|
||||
size_t bboxes_offset;
|
||||
|
||||
/**
|
||||
* Size of each bounding box in bytes.
|
||||
*/
|
||||
size_t bbox_size;
|
||||
} AVDetectionBBoxHeader;
|
||||
|
||||
/*
|
||||
* Get the bounding box at the specified {@code idx}. Must be between 0 and nb_bboxes.
|
||||
*/
|
||||
static av_always_inline AVDetectionBBox *
|
||||
av_get_detection_bbox(const AVDetectionBBoxHeader *header, unsigned int idx)
|
||||
{
|
||||
av_assert0(idx < header->nb_bboxes);
|
||||
return (AVDetectionBBox *)((uint8_t *)header + header->bboxes_offset +
|
||||
idx * header->bbox_size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates memory for AVDetectionBBoxHeader, plus an array of {@code nb_bboxes}
|
||||
* AVDetectionBBox, and initializes the variables.
|
||||
* Can be freed with a normal av_free() call.
|
||||
*
|
||||
* @param out_size if non-NULL, the size in bytes of the resulting data array is
|
||||
* written here.
|
||||
*/
|
||||
AVDetectionBBoxHeader *av_detection_bbox_alloc(uint32_t nb_bboxes, size_t *out_size);
|
||||
|
||||
/**
|
||||
* Allocates memory for AVDetectionBBoxHeader, plus an array of {@code nb_bboxes}
|
||||
* AVDetectionBBox, in the given AVFrame {@code frame} as AVFrameSideData of type
|
||||
* AV_FRAME_DATA_DETECTION_BBOXES and initializes the variables.
|
||||
*/
|
||||
AVDetectionBBoxHeader *av_detection_bbox_create_side_data(AVFrame *frame, uint32_t nb_bboxes);
|
||||
#endif
|
@ -32,8 +32,6 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "version.h"
|
||||
|
||||
/**
|
||||
* @addtogroup lavu_dict AVDictionary
|
||||
* @ingroup lavu_data
|
||||
|
@ -27,7 +27,6 @@
|
||||
#define AVUTIL_DISPLAY_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "common.h"
|
||||
|
||||
/**
|
||||
* @addtogroup lavu_video
|
||||
@ -88,7 +87,7 @@
|
||||
double av_display_rotation_get(const int32_t matrix[9]);
|
||||
|
||||
/**
|
||||
* Initialize a transformation matrix describing a pure counterclockwise
|
||||
* Initialize a transformation matrix describing a pure clockwise
|
||||
* rotation by the specified angle (in degrees).
|
||||
*
|
||||
* @param matrix an allocated transformation matrix (will be fully overwritten
|
||||
|
236
ext_includes/ffmpeg/libavutil/dovi_meta.h
Normal file
236
ext_includes/ffmpeg/libavutil/dovi_meta.h
Normal file
@ -0,0 +1,236 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Vacing Fang <vacingfang@tencent.com>
|
||||
*
|
||||
* 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
|
||||
* DOVI configuration
|
||||
*/
|
||||
|
||||
|
||||
#ifndef AVUTIL_DOVI_META_H
|
||||
#define AVUTIL_DOVI_META_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "rational.h"
|
||||
|
||||
/*
|
||||
* DOVI configuration
|
||||
* ref: dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2.1.2
|
||||
dolby-vision-bitstreams-in-mpeg-2-transport-stream-multiplex-v1.2
|
||||
* @code
|
||||
* uint8_t dv_version_major, the major version number that the stream complies with
|
||||
* uint8_t dv_version_minor, the minor version number that the stream complies with
|
||||
* uint8_t dv_profile, the Dolby Vision profile
|
||||
* uint8_t dv_level, the Dolby Vision level
|
||||
* uint8_t rpu_present_flag
|
||||
* uint8_t el_present_flag
|
||||
* uint8_t bl_present_flag
|
||||
* uint8_t dv_bl_signal_compatibility_id
|
||||
* @endcode
|
||||
*
|
||||
* @note The struct must be allocated with av_dovi_alloc() and
|
||||
* its size is not a part of the public ABI.
|
||||
*/
|
||||
typedef struct AVDOVIDecoderConfigurationRecord {
|
||||
uint8_t dv_version_major;
|
||||
uint8_t dv_version_minor;
|
||||
uint8_t dv_profile;
|
||||
uint8_t dv_level;
|
||||
uint8_t rpu_present_flag;
|
||||
uint8_t el_present_flag;
|
||||
uint8_t bl_present_flag;
|
||||
uint8_t dv_bl_signal_compatibility_id;
|
||||
} AVDOVIDecoderConfigurationRecord;
|
||||
|
||||
/**
|
||||
* Allocate a AVDOVIDecoderConfigurationRecord structure and initialize its
|
||||
* fields to default values.
|
||||
*
|
||||
* @return the newly allocated struct or NULL on failure
|
||||
*/
|
||||
AVDOVIDecoderConfigurationRecord *av_dovi_alloc(size_t *size);
|
||||
|
||||
/**
|
||||
* Dolby Vision RPU data header.
|
||||
*
|
||||
* @note sizeof(AVDOVIRpuDataHeader) is not part of the public ABI.
|
||||
*/
|
||||
typedef struct AVDOVIRpuDataHeader {
|
||||
uint8_t rpu_type;
|
||||
uint16_t rpu_format;
|
||||
uint8_t vdr_rpu_profile;
|
||||
uint8_t vdr_rpu_level;
|
||||
uint8_t chroma_resampling_explicit_filter_flag;
|
||||
uint8_t coef_data_type; /* informative, lavc always converts to fixed */
|
||||
uint8_t coef_log2_denom;
|
||||
uint8_t vdr_rpu_normalized_idc;
|
||||
uint8_t bl_video_full_range_flag;
|
||||
uint8_t bl_bit_depth; /* [8, 16] */
|
||||
uint8_t el_bit_depth; /* [8, 16] */
|
||||
uint8_t vdr_bit_depth; /* [8, 16] */
|
||||
uint8_t spatial_resampling_filter_flag;
|
||||
uint8_t el_spatial_resampling_filter_flag;
|
||||
uint8_t disable_residual_flag;
|
||||
} AVDOVIRpuDataHeader;
|
||||
|
||||
enum AVDOVIMappingMethod {
|
||||
AV_DOVI_MAPPING_POLYNOMIAL = 0,
|
||||
AV_DOVI_MAPPING_MMR = 1,
|
||||
};
|
||||
|
||||
/**
|
||||
* Coefficients of a piece-wise function. The pieces of the function span the
|
||||
* value ranges between two adjacent pivot values.
|
||||
*/
|
||||
#define AV_DOVI_MAX_PIECES 8
|
||||
typedef struct AVDOVIReshapingCurve {
|
||||
uint8_t num_pivots; /* [2, 9] */
|
||||
uint16_t pivots[AV_DOVI_MAX_PIECES + 1]; /* sorted ascending */
|
||||
enum AVDOVIMappingMethod mapping_idc[AV_DOVI_MAX_PIECES];
|
||||
/* AV_DOVI_MAPPING_POLYNOMIAL */
|
||||
uint8_t poly_order[AV_DOVI_MAX_PIECES]; /* [1, 2] */
|
||||
int64_t poly_coef[AV_DOVI_MAX_PIECES][3]; /* x^0, x^1, x^2 */
|
||||
/* AV_DOVI_MAPPING_MMR */
|
||||
uint8_t mmr_order[AV_DOVI_MAX_PIECES]; /* [1, 3] */
|
||||
int64_t mmr_constant[AV_DOVI_MAX_PIECES];
|
||||
int64_t mmr_coef[AV_DOVI_MAX_PIECES][3/* order - 1 */][7];
|
||||
} AVDOVIReshapingCurve;
|
||||
|
||||
enum AVDOVINLQMethod {
|
||||
AV_DOVI_NLQ_NONE = -1,
|
||||
AV_DOVI_NLQ_LINEAR_DZ = 0,
|
||||
};
|
||||
|
||||
/**
|
||||
* Coefficients of the non-linear inverse quantization. For the interpretation
|
||||
* of these, see ETSI GS CCM 001.
|
||||
*/
|
||||
typedef struct AVDOVINLQParams {
|
||||
uint16_t nlq_offset;
|
||||
uint64_t vdr_in_max;
|
||||
/* AV_DOVI_NLQ_LINEAR_DZ */
|
||||
uint64_t linear_deadzone_slope;
|
||||
uint64_t linear_deadzone_threshold;
|
||||
} AVDOVINLQParams;
|
||||
|
||||
/**
|
||||
* Dolby Vision RPU data mapping parameters.
|
||||
*
|
||||
* @note sizeof(AVDOVIDataMapping) is not part of the public ABI.
|
||||
*/
|
||||
typedef struct AVDOVIDataMapping {
|
||||
uint8_t vdr_rpu_id;
|
||||
uint8_t mapping_color_space;
|
||||
uint8_t mapping_chroma_format_idc;
|
||||
AVDOVIReshapingCurve curves[3]; /* per component */
|
||||
|
||||
/* Non-linear inverse quantization */
|
||||
enum AVDOVINLQMethod nlq_method_idc;
|
||||
uint32_t num_x_partitions;
|
||||
uint32_t num_y_partitions;
|
||||
AVDOVINLQParams nlq[3]; /* per component */
|
||||
} AVDOVIDataMapping;
|
||||
|
||||
/**
|
||||
* Dolby Vision RPU colorspace metadata parameters.
|
||||
*
|
||||
* @note sizeof(AVDOVIColorMetadata) is not part of the public ABI.
|
||||
*/
|
||||
typedef struct AVDOVIColorMetadata {
|
||||
uint8_t dm_metadata_id;
|
||||
uint8_t scene_refresh_flag;
|
||||
|
||||
/**
|
||||
* Coefficients of the custom Dolby Vision IPT-PQ matrices. These are to be
|
||||
* used instead of the matrices indicated by the frame's colorspace tags.
|
||||
* The output of rgb_to_lms_matrix is to be fed into a BT.2020 LMS->RGB
|
||||
* matrix based on a Hunt-Pointer-Estevez transform, but without any
|
||||
* crosstalk. (See the definition of the ICtCp colorspace for more
|
||||
* information.)
|
||||
*/
|
||||
AVRational ycc_to_rgb_matrix[9]; /* before PQ linearization */
|
||||
AVRational ycc_to_rgb_offset[3]; /* input offset of neutral value */
|
||||
AVRational rgb_to_lms_matrix[9]; /* after PQ linearization */
|
||||
|
||||
/**
|
||||
* Extra signal metadata (see Dolby patents for more info).
|
||||
*/
|
||||
uint16_t signal_eotf;
|
||||
uint16_t signal_eotf_param0;
|
||||
uint16_t signal_eotf_param1;
|
||||
uint32_t signal_eotf_param2;
|
||||
uint8_t signal_bit_depth;
|
||||
uint8_t signal_color_space;
|
||||
uint8_t signal_chroma_format;
|
||||
uint8_t signal_full_range_flag; /* [0, 3] */
|
||||
uint16_t source_min_pq;
|
||||
uint16_t source_max_pq;
|
||||
uint16_t source_diagonal;
|
||||
} AVDOVIColorMetadata;
|
||||
|
||||
/**
|
||||
* Combined struct representing a combination of header, mapping and color
|
||||
* metadata, for attaching to frames as side data.
|
||||
*
|
||||
* @note The struct must be allocated with av_dovi_metadata_alloc() and
|
||||
* its size is not a part of the public ABI.
|
||||
*/
|
||||
|
||||
typedef struct AVDOVIMetadata {
|
||||
/**
|
||||
* Offset in bytes from the beginning of this structure at which the
|
||||
* respective structs start.
|
||||
*/
|
||||
size_t header_offset; /* AVDOVIRpuDataHeader */
|
||||
size_t mapping_offset; /* AVDOVIDataMapping */
|
||||
size_t color_offset; /* AVDOVIColorMetadata */
|
||||
} AVDOVIMetadata;
|
||||
|
||||
static av_always_inline AVDOVIRpuDataHeader *
|
||||
av_dovi_get_header(const AVDOVIMetadata *data)
|
||||
{
|
||||
return (AVDOVIRpuDataHeader *)((uint8_t *) data + data->header_offset);
|
||||
}
|
||||
|
||||
static av_always_inline AVDOVIDataMapping *
|
||||
av_dovi_get_mapping(const AVDOVIMetadata *data)
|
||||
{
|
||||
return (AVDOVIDataMapping *)((uint8_t *) data + data->mapping_offset);
|
||||
}
|
||||
|
||||
static av_always_inline AVDOVIColorMetadata *
|
||||
av_dovi_get_color(const AVDOVIMetadata *data)
|
||||
{
|
||||
return (AVDOVIColorMetadata *)((uint8_t *) data + data->color_offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocate an AVDOVIMetadata structure and initialize its
|
||||
* fields to default values.
|
||||
*
|
||||
* @param size If this parameter is non-NULL, the size in bytes of the
|
||||
* allocated struct will be written here on success
|
||||
*
|
||||
* @return the newly allocated struct or NULL on failure
|
||||
*/
|
||||
AVDOVIMetadata *av_dovi_metadata_alloc(size_t *size);
|
||||
|
||||
#endif /* AVUTIL_DOVI_META_H */
|
@ -27,6 +27,8 @@
|
||||
#include <errno.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "macros.h"
|
||||
|
||||
/**
|
||||
* @addtogroup lavu_error
|
||||
*
|
||||
|
@ -26,8 +26,6 @@
|
||||
#ifndef AVUTIL_EVAL_H
|
||||
#define AVUTIL_EVAL_H
|
||||
|
||||
#include "avutil.h"
|
||||
|
||||
typedef struct AVExpr AVExpr;
|
||||
|
||||
/**
|
||||
@ -86,6 +84,30 @@ int av_expr_parse(AVExpr **expr, const char *s,
|
||||
*/
|
||||
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque);
|
||||
|
||||
/**
|
||||
* Track the presence of variables and their number of occurrences in a parsed expression
|
||||
*
|
||||
* @param counter a zero-initialized array where the count of each variable will be stored
|
||||
* @param size size of array
|
||||
* @return 0 on success, a negative value indicates that no expression or array was passed
|
||||
* or size was zero
|
||||
*/
|
||||
int av_expr_count_vars(AVExpr *e, unsigned *counter, int size);
|
||||
|
||||
/**
|
||||
* Track the presence of user provided functions and their number of occurrences
|
||||
* in a parsed expression.
|
||||
*
|
||||
* @param counter a zero-initialized array where the count of each function will be stored
|
||||
* if you passed 5 functions with 2 arguments to av_expr_parse()
|
||||
* then for arg=2 this will use upto 5 entries.
|
||||
* @param size size of array
|
||||
* @param arg number of arguments the counted functions have
|
||||
* @return 0 on success, a negative value indicates that no expression or array was passed
|
||||
* or size was zero
|
||||
*/
|
||||
int av_expr_count_func(AVExpr *e, unsigned *counter, int size, int arg);
|
||||
|
||||
/**
|
||||
* Free a parsed expression previously created with av_expr_parse().
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Automatically generated by version.sh, do not manually edit! */
|
||||
#ifndef AVUTIL_FFVERSION_H
|
||||
#define AVUTIL_FFVERSION_H
|
||||
#define FFMPEG_VERSION "N-92936-ged3b64402e"
|
||||
#define FFMPEG_VERSION "n5.1.2"
|
||||
#endif /* AVUTIL_FFVERSION_H */
|
||||
|
@ -24,10 +24,205 @@
|
||||
#ifndef AVUTIL_FIFO_H
|
||||
#define AVUTIL_FIFO_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include "avutil.h"
|
||||
#include "attributes.h"
|
||||
|
||||
#include "attributes.h"
|
||||
#include "version.h"
|
||||
|
||||
typedef struct AVFifo AVFifo;
|
||||
|
||||
/**
|
||||
* Callback for writing or reading from a FIFO, passed to (and invoked from) the
|
||||
* av_fifo_*_cb() functions. It may be invoked multiple times from a single
|
||||
* av_fifo_*_cb() call and may process less data than the maximum size indicated
|
||||
* by nb_elems.
|
||||
*
|
||||
* @param opaque the opaque pointer provided to the av_fifo_*_cb() function
|
||||
* @param buf the buffer for reading or writing the data, depending on which
|
||||
* av_fifo_*_cb function is called
|
||||
* @param nb_elems On entry contains the maximum number of elements that can be
|
||||
* read from / written into buf. On success, the callback should
|
||||
* update it to contain the number of elements actually written.
|
||||
*
|
||||
* @return 0 on success, a negative error code on failure (will be returned from
|
||||
* the invoking av_fifo_*_cb() function)
|
||||
*/
|
||||
typedef int AVFifoCB(void *opaque, void *buf, size_t *nb_elems);
|
||||
|
||||
/**
|
||||
* Automatically resize the FIFO on writes, so that the data fits. This
|
||||
* automatic resizing happens up to a limit that can be modified with
|
||||
* av_fifo_auto_grow_limit().
|
||||
*/
|
||||
#define AV_FIFO_FLAG_AUTO_GROW (1 << 0)
|
||||
|
||||
/**
|
||||
* Allocate and initialize an AVFifo with a given element size.
|
||||
*
|
||||
* @param elems initial number of elements that can be stored in the FIFO
|
||||
* @param elem_size Size in bytes of a single element. Further operations on
|
||||
* the returned FIFO will implicitly use this element size.
|
||||
* @param flags a combination of AV_FIFO_FLAG_*
|
||||
*
|
||||
* @return newly-allocated AVFifo on success, a negative error code on failure
|
||||
*/
|
||||
AVFifo *av_fifo_alloc2(size_t elems, size_t elem_size,
|
||||
unsigned int flags);
|
||||
|
||||
/**
|
||||
* @return Element size for FIFO operations. This element size is set at
|
||||
* FIFO allocation and remains constant during its lifetime
|
||||
*/
|
||||
size_t av_fifo_elem_size(const AVFifo *f);
|
||||
|
||||
/**
|
||||
* Set the maximum size (in elements) to which the FIFO can be resized
|
||||
* automatically. Has no effect unless AV_FIFO_FLAG_AUTO_GROW is used.
|
||||
*/
|
||||
void av_fifo_auto_grow_limit(AVFifo *f, size_t max_elems);
|
||||
|
||||
/**
|
||||
* @return number of elements available for reading from the given FIFO.
|
||||
*/
|
||||
size_t av_fifo_can_read(const AVFifo *f);
|
||||
|
||||
/**
|
||||
* @return number of elements that can be written into the given FIFO.
|
||||
*/
|
||||
size_t av_fifo_can_write(const AVFifo *f);
|
||||
|
||||
/**
|
||||
* Enlarge an AVFifo.
|
||||
*
|
||||
* On success, the FIFO will be large enough to hold exactly
|
||||
* inc + av_fifo_can_read() + av_fifo_can_write()
|
||||
* elements. In case of failure, the old FIFO is kept unchanged.
|
||||
*
|
||||
* @param f AVFifo to resize
|
||||
* @param inc number of elements to allocate for, in addition to the current
|
||||
* allocated size
|
||||
* @return a non-negative number on success, a negative error code on failure
|
||||
*/
|
||||
int av_fifo_grow2(AVFifo *f, size_t inc);
|
||||
|
||||
/**
|
||||
* Write data into a FIFO.
|
||||
*
|
||||
* In case nb_elems > av_fifo_can_write(f), nothing is written and an error
|
||||
* is returned.
|
||||
*
|
||||
* @param f the FIFO buffer
|
||||
* @param buf Data to be written. nb_elems * av_fifo_elem_size(f) bytes will be
|
||||
* read from buf on success.
|
||||
* @param nb_elems number of elements to write into FIFO
|
||||
*
|
||||
* @return a non-negative number on success, a negative error code on failure
|
||||
*/
|
||||
int av_fifo_write(AVFifo *f, const void *buf, size_t nb_elems);
|
||||
|
||||
/**
|
||||
* Write data from a user-provided callback into a FIFO.
|
||||
*
|
||||
* @param f the FIFO buffer
|
||||
* @param read_cb Callback supplying the data to the FIFO. May be called
|
||||
* multiple times.
|
||||
* @param opaque opaque user data to be provided to read_cb
|
||||
* @param nb_elems Should point to the maximum number of elements that can be
|
||||
* written. Will be updated to contain the number of elements
|
||||
* actually written.
|
||||
*
|
||||
* @return non-negative number on success, a negative error code on failure
|
||||
*/
|
||||
int av_fifo_write_from_cb(AVFifo *f, AVFifoCB read_cb,
|
||||
void *opaque, size_t *nb_elems);
|
||||
|
||||
/**
|
||||
* Read data from a FIFO.
|
||||
*
|
||||
* In case nb_elems > av_fifo_can_read(f), nothing is read and an error
|
||||
* is returned.
|
||||
*
|
||||
* @param f the FIFO buffer
|
||||
* @param buf Buffer to store the data. nb_elems * av_fifo_elem_size(f) bytes
|
||||
* will be written into buf on success.
|
||||
* @param nb_elems number of elements to read from FIFO
|
||||
*
|
||||
* @return a non-negative number on success, a negative error code on failure
|
||||
*/
|
||||
int av_fifo_read(AVFifo *f, void *buf, size_t nb_elems);
|
||||
|
||||
/**
|
||||
* Feed data from a FIFO into a user-provided callback.
|
||||
*
|
||||
* @param f the FIFO buffer
|
||||
* @param write_cb Callback the data will be supplied to. May be called
|
||||
* multiple times.
|
||||
* @param opaque opaque user data to be provided to write_cb
|
||||
* @param nb_elems Should point to the maximum number of elements that can be
|
||||
* read. Will be updated to contain the total number of elements
|
||||
* actually sent to the callback.
|
||||
*
|
||||
* @return non-negative number on success, a negative error code on failure
|
||||
*/
|
||||
int av_fifo_read_to_cb(AVFifo *f, AVFifoCB write_cb,
|
||||
void *opaque, size_t *nb_elems);
|
||||
|
||||
/**
|
||||
* Read data from a FIFO without modifying FIFO state.
|
||||
*
|
||||
* Returns an error if an attempt is made to peek to nonexistent elements
|
||||
* (i.e. if offset + nb_elems is larger than av_fifo_can_read(f)).
|
||||
*
|
||||
* @param f the FIFO buffer
|
||||
* @param buf Buffer to store the data. nb_elems * av_fifo_elem_size(f) bytes
|
||||
* will be written into buf.
|
||||
* @param nb_elems number of elements to read from FIFO
|
||||
* @param offset number of initial elements to skip.
|
||||
*
|
||||
* @return a non-negative number on success, a negative error code on failure
|
||||
*/
|
||||
int av_fifo_peek(AVFifo *f, void *buf, size_t nb_elems, size_t offset);
|
||||
|
||||
/**
|
||||
* Feed data from a FIFO into a user-provided callback.
|
||||
*
|
||||
* @param f the FIFO buffer
|
||||
* @param write_cb Callback the data will be supplied to. May be called
|
||||
* multiple times.
|
||||
* @param opaque opaque user data to be provided to write_cb
|
||||
* @param nb_elems Should point to the maximum number of elements that can be
|
||||
* read. Will be updated to contain the total number of elements
|
||||
* actually sent to the callback.
|
||||
* @param offset number of initial elements to skip; offset + *nb_elems must not
|
||||
* be larger than av_fifo_can_read(f).
|
||||
*
|
||||
* @return a non-negative number on success, a negative error code on failure
|
||||
*/
|
||||
int av_fifo_peek_to_cb(AVFifo *f, AVFifoCB write_cb, void *opaque,
|
||||
size_t *nb_elems, size_t offset);
|
||||
|
||||
/**
|
||||
* Discard the specified amount of data from an AVFifo.
|
||||
* @param size number of elements to discard, MUST NOT be larger than
|
||||
* av_fifo_can_read(f)
|
||||
*/
|
||||
void av_fifo_drain2(AVFifo *f, size_t size);
|
||||
|
||||
/*
|
||||
* Empty the AVFifo.
|
||||
* @param f AVFifo to reset
|
||||
*/
|
||||
void av_fifo_reset2(AVFifo *f);
|
||||
|
||||
/**
|
||||
* Free an AVFifo and reset pointer to NULL.
|
||||
* @param f Pointer to an AVFifo to free. *f == NULL is allowed.
|
||||
*/
|
||||
void av_fifo_freep2(AVFifo **f);
|
||||
|
||||
|
||||
#if FF_API_FIFO_OLD_API
|
||||
typedef struct AVFifoBuffer {
|
||||
uint8_t *buffer;
|
||||
uint8_t *rptr, *wptr, *end;
|
||||
@ -38,7 +233,9 @@ typedef struct AVFifoBuffer {
|
||||
* Initialize an AVFifoBuffer.
|
||||
* @param size of FIFO
|
||||
* @return AVFifoBuffer or NULL in case of memory allocation failure
|
||||
* @deprecated use av_fifo_alloc2()
|
||||
*/
|
||||
attribute_deprecated
|
||||
AVFifoBuffer *av_fifo_alloc(unsigned int size);
|
||||
|
||||
/**
|
||||
@ -46,25 +243,33 @@ AVFifoBuffer *av_fifo_alloc(unsigned int size);
|
||||
* @param nmemb number of elements
|
||||
* @param size size of the single element
|
||||
* @return AVFifoBuffer or NULL in case of memory allocation failure
|
||||
* @deprecated use av_fifo_alloc2()
|
||||
*/
|
||||
attribute_deprecated
|
||||
AVFifoBuffer *av_fifo_alloc_array(size_t nmemb, size_t size);
|
||||
|
||||
/**
|
||||
* Free an AVFifoBuffer.
|
||||
* @param f AVFifoBuffer to free
|
||||
* @deprecated use the AVFifo API with av_fifo_freep2()
|
||||
*/
|
||||
attribute_deprecated
|
||||
void av_fifo_free(AVFifoBuffer *f);
|
||||
|
||||
/**
|
||||
* Free an AVFifoBuffer and reset pointer to NULL.
|
||||
* @param f AVFifoBuffer to free
|
||||
* @deprecated use the AVFifo API with av_fifo_freep2()
|
||||
*/
|
||||
attribute_deprecated
|
||||
void av_fifo_freep(AVFifoBuffer **f);
|
||||
|
||||
/**
|
||||
* Reset the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied.
|
||||
* @param f AVFifoBuffer to reset
|
||||
* @deprecated use av_fifo_reset2() with the new AVFifo-API
|
||||
*/
|
||||
attribute_deprecated
|
||||
void av_fifo_reset(AVFifoBuffer *f);
|
||||
|
||||
/**
|
||||
@ -72,7 +277,9 @@ void av_fifo_reset(AVFifoBuffer *f);
|
||||
* amount of data you can read from it.
|
||||
* @param f AVFifoBuffer to read from
|
||||
* @return size
|
||||
* @deprecated use av_fifo_can_read() with the new AVFifo-API
|
||||
*/
|
||||
attribute_deprecated
|
||||
int av_fifo_size(const AVFifoBuffer *f);
|
||||
|
||||
/**
|
||||
@ -80,7 +287,9 @@ int av_fifo_size(const AVFifoBuffer *f);
|
||||
* amount of data you can write into it.
|
||||
* @param f AVFifoBuffer to write into
|
||||
* @return size
|
||||
* @deprecated use av_fifo_can_write() with the new AVFifo-API
|
||||
*/
|
||||
attribute_deprecated
|
||||
int av_fifo_space(const AVFifoBuffer *f);
|
||||
|
||||
/**
|
||||
@ -91,7 +300,13 @@ int av_fifo_space(const AVFifoBuffer *f);
|
||||
* @param buf_size number of bytes to read
|
||||
* @param func generic read function
|
||||
* @param dest data destination
|
||||
*
|
||||
* @return a non-negative number on success, a negative error code on failure
|
||||
*
|
||||
* @deprecated use the new AVFifo-API with av_fifo_peek() when func == NULL,
|
||||
* av_fifo_peek_to_cb() otherwise
|
||||
*/
|
||||
attribute_deprecated
|
||||
int av_fifo_generic_peek_at(AVFifoBuffer *f, void *dest, int offset, int buf_size, void (*func)(void*, void*, int));
|
||||
|
||||
/**
|
||||
@ -101,7 +316,13 @@ int av_fifo_generic_peek_at(AVFifoBuffer *f, void *dest, int offset, int buf_siz
|
||||
* @param buf_size number of bytes to read
|
||||
* @param func generic read function
|
||||
* @param dest data destination
|
||||
*
|
||||
* @return a non-negative number on success, a negative error code on failure
|
||||
*
|
||||
* @deprecated use the new AVFifo-API with av_fifo_peek() when func == NULL,
|
||||
* av_fifo_peek_to_cb() otherwise
|
||||
*/
|
||||
attribute_deprecated
|
||||
int av_fifo_generic_peek(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int));
|
||||
|
||||
/**
|
||||
@ -110,7 +331,13 @@ int av_fifo_generic_peek(AVFifoBuffer *f, void *dest, int buf_size, void (*func)
|
||||
* @param buf_size number of bytes to read
|
||||
* @param func generic read function
|
||||
* @param dest data destination
|
||||
*
|
||||
* @return a non-negative number on success, a negative error code on failure
|
||||
*
|
||||
* @deprecated use the new AVFifo-API with av_fifo_read() when func == NULL,
|
||||
* av_fifo_read_to_cb() otherwise
|
||||
*/
|
||||
attribute_deprecated
|
||||
int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int));
|
||||
|
||||
/**
|
||||
@ -124,8 +351,12 @@ int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)
|
||||
* func must return the number of bytes written to dest_buf, or <= 0 to
|
||||
* indicate no more data available to write.
|
||||
* If func is NULL, src is interpreted as a simple byte array for source data.
|
||||
* @return the number of bytes written to the FIFO
|
||||
* @return the number of bytes written to the FIFO or a negative error code on failure
|
||||
*
|
||||
* @deprecated use the new AVFifo-API with av_fifo_write() when func == NULL,
|
||||
* av_fifo_write_from_cb() otherwise
|
||||
*/
|
||||
attribute_deprecated
|
||||
int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int));
|
||||
|
||||
/**
|
||||
@ -135,7 +366,11 @@ int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void
|
||||
* @param f AVFifoBuffer to resize
|
||||
* @param size new AVFifoBuffer size in bytes
|
||||
* @return <0 for failure, >=0 otherwise
|
||||
*
|
||||
* @deprecated use the new AVFifo-API with av_fifo_grow2() to increase FIFO size,
|
||||
* decreasing FIFO size is not supported
|
||||
*/
|
||||
attribute_deprecated
|
||||
int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size);
|
||||
|
||||
/**
|
||||
@ -146,16 +381,24 @@ int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size);
|
||||
* @param f AVFifoBuffer to resize
|
||||
* @param additional_space the amount of space in bytes to allocate in addition to av_fifo_size()
|
||||
* @return <0 for failure, >=0 otherwise
|
||||
*
|
||||
* @deprecated use the new AVFifo-API with av_fifo_grow2(); note that unlike
|
||||
* this function it adds to the allocated size, rather than to the used size
|
||||
*/
|
||||
attribute_deprecated
|
||||
int av_fifo_grow(AVFifoBuffer *f, unsigned int additional_space);
|
||||
|
||||
/**
|
||||
* Read and discard the specified amount of data from an AVFifoBuffer.
|
||||
* @param f AVFifoBuffer to read from
|
||||
* @param size amount of data to read in bytes
|
||||
*
|
||||
* @deprecated use the new AVFifo-API with av_fifo_drain2()
|
||||
*/
|
||||
attribute_deprecated
|
||||
void av_fifo_drain(AVFifoBuffer *f, int size);
|
||||
|
||||
#if FF_API_FIFO_PEEK2
|
||||
/**
|
||||
* Return a pointer to the data stored in a FIFO buffer at a certain offset.
|
||||
* The FIFO buffer is not modified.
|
||||
@ -165,7 +408,9 @@ void av_fifo_drain(AVFifoBuffer *f, int size);
|
||||
* than the used buffer size or the returned pointer will
|
||||
* point outside to the buffer data.
|
||||
* The used buffer size can be checked with av_fifo_size().
|
||||
* @deprecated use the new AVFifo-API with av_fifo_peek() or av_fifo_peek_to_cb()
|
||||
*/
|
||||
attribute_deprecated
|
||||
static inline uint8_t *av_fifo_peek2(const AVFifoBuffer *f, int offs)
|
||||
{
|
||||
uint8_t *ptr = f->rptr + offs;
|
||||
@ -175,5 +420,7 @@ static inline uint8_t *av_fifo_peek2(const AVFifoBuffer *f, int offs)
|
||||
ptr = f->end - (f->buffer - ptr);
|
||||
return ptr;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* AVUTIL_FIFO_H */
|
||||
|
@ -19,9 +19,10 @@
|
||||
#ifndef AVUTIL_FILE_H
|
||||
#define AVUTIL_FILE_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "avutil.h"
|
||||
#include "attributes.h"
|
||||
|
||||
/**
|
||||
* @file
|
||||
|
260
ext_includes/ffmpeg/libavutil/film_grain_params.h
Normal file
260
ext_includes/ffmpeg/libavutil/film_grain_params.h
Normal file
@ -0,0 +1,260 @@
|
||||
/*
|
||||
* 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_FILM_GRAIN_PARAMS_H
|
||||
#define AVUTIL_FILM_GRAIN_PARAMS_H
|
||||
|
||||
#include "frame.h"
|
||||
|
||||
enum AVFilmGrainParamsType {
|
||||
AV_FILM_GRAIN_PARAMS_NONE = 0,
|
||||
|
||||
/**
|
||||
* The union is valid when interpreted as AVFilmGrainAOMParams (codec.aom)
|
||||
*/
|
||||
AV_FILM_GRAIN_PARAMS_AV1,
|
||||
|
||||
/**
|
||||
* The union is valid when interpreted as AVFilmGrainH274Params (codec.h274)
|
||||
*/
|
||||
AV_FILM_GRAIN_PARAMS_H274,
|
||||
};
|
||||
|
||||
/**
|
||||
* This structure describes how to handle film grain synthesis for AOM codecs.
|
||||
*
|
||||
* @note The struct must be allocated as part of AVFilmGrainParams using
|
||||
* av_film_grain_params_alloc(). Its size is not a part of the public ABI.
|
||||
*/
|
||||
typedef struct AVFilmGrainAOMParams {
|
||||
/**
|
||||
* Number of points, and the scale and value for each point of the
|
||||
* piecewise linear scaling function for the uma plane.
|
||||
*/
|
||||
int num_y_points;
|
||||
uint8_t y_points[14][2 /* value, scaling */];
|
||||
|
||||
/**
|
||||
* Signals whether to derive the chroma scaling function from the luma.
|
||||
* Not equivalent to copying the luma values and scales.
|
||||
*/
|
||||
int chroma_scaling_from_luma;
|
||||
|
||||
/**
|
||||
* If chroma_scaling_from_luma is set to 0, signals the chroma scaling
|
||||
* function parameters.
|
||||
*/
|
||||
int num_uv_points[2 /* cb, cr */];
|
||||
uint8_t uv_points[2 /* cb, cr */][10][2 /* value, scaling */];
|
||||
|
||||
/**
|
||||
* Specifies the shift applied to the chroma components. For AV1, its within
|
||||
* [8; 11] and determines the range and quantization of the film grain.
|
||||
*/
|
||||
int scaling_shift;
|
||||
|
||||
/**
|
||||
* Specifies the auto-regression lag.
|
||||
*/
|
||||
int ar_coeff_lag;
|
||||
|
||||
/**
|
||||
* Luma auto-regression coefficients. The number of coefficients is given by
|
||||
* 2 * ar_coeff_lag * (ar_coeff_lag + 1).
|
||||
*/
|
||||
int8_t ar_coeffs_y[24];
|
||||
|
||||
/**
|
||||
* Chroma auto-regression coefficients. The number of coefficients is given by
|
||||
* 2 * ar_coeff_lag * (ar_coeff_lag + 1) + !!num_y_points.
|
||||
*/
|
||||
int8_t ar_coeffs_uv[2 /* cb, cr */][25];
|
||||
|
||||
/**
|
||||
* Specifies the range of the auto-regressive coefficients. Values of 6,
|
||||
* 7, 8 and so on represent a range of [-2, 2), [-1, 1), [-0.5, 0.5) and
|
||||
* so on. For AV1 must be between 6 and 9.
|
||||
*/
|
||||
int ar_coeff_shift;
|
||||
|
||||
/**
|
||||
* Signals the down shift applied to the generated gaussian numbers during
|
||||
* synthesis.
|
||||
*/
|
||||
int grain_scale_shift;
|
||||
|
||||
/**
|
||||
* Specifies the luma/chroma multipliers for the index to the component
|
||||
* scaling function.
|
||||
*/
|
||||
int uv_mult[2 /* cb, cr */];
|
||||
int uv_mult_luma[2 /* cb, cr */];
|
||||
|
||||
/**
|
||||
* Offset used for component scaling function. For AV1 its a 9-bit value
|
||||
* with a range [-256, 255]
|
||||
*/
|
||||
int uv_offset[2 /* cb, cr */];
|
||||
|
||||
/**
|
||||
* Signals whether to overlap film grain blocks.
|
||||
*/
|
||||
int overlap_flag;
|
||||
|
||||
/**
|
||||
* Signals to clip to limited color levels after film grain application.
|
||||
*/
|
||||
int limit_output_range;
|
||||
} AVFilmGrainAOMParams;
|
||||
|
||||
/**
|
||||
* This structure describes how to handle film grain synthesis for codecs using
|
||||
* the ITU-T H.274 Versatile suplemental enhancement information message.
|
||||
*
|
||||
* @note The struct must be allocated as part of AVFilmGrainParams using
|
||||
* av_film_grain_params_alloc(). Its size is not a part of the public ABI.
|
||||
*/
|
||||
typedef struct AVFilmGrainH274Params {
|
||||
/**
|
||||
* Specifies the film grain simulation mode.
|
||||
* 0 = Frequency filtering, 1 = Auto-regression
|
||||
*/
|
||||
int model_id;
|
||||
|
||||
/**
|
||||
* Specifies the bit depth used for the luma component.
|
||||
*/
|
||||
int bit_depth_luma;
|
||||
|
||||
/**
|
||||
* Specifies the bit depth used for the chroma components.
|
||||
*/
|
||||
int bit_depth_chroma;
|
||||
|
||||
enum AVColorRange color_range;
|
||||
enum AVColorPrimaries color_primaries;
|
||||
enum AVColorTransferCharacteristic color_trc;
|
||||
enum AVColorSpace color_space;
|
||||
|
||||
/**
|
||||
* Specifies the blending mode used to blend the simulated film grain
|
||||
* with the decoded images.
|
||||
*
|
||||
* 0 = Additive, 1 = Multiplicative
|
||||
*/
|
||||
int blending_mode_id;
|
||||
|
||||
/**
|
||||
* Specifies a scale factor used in the film grain characterization equations.
|
||||
*/
|
||||
int log2_scale_factor;
|
||||
|
||||
/**
|
||||
* Indicates if the modelling of film grain for a given component is present.
|
||||
*/
|
||||
int component_model_present[3 /* y, cb, cr */];
|
||||
|
||||
/**
|
||||
* Specifies the number of intensity intervals for which a specific set of
|
||||
* model values has been estimated, with a range of [1, 256].
|
||||
*/
|
||||
uint16_t num_intensity_intervals[3 /* y, cb, cr */];
|
||||
|
||||
/**
|
||||
* Specifies the number of model values present for each intensity interval
|
||||
* in which the film grain has been modelled, with a range of [1, 6].
|
||||
*/
|
||||
uint8_t num_model_values[3 /* y, cb, cr */];
|
||||
|
||||
/**
|
||||
* Specifies the lower ounds of each intensity interval for whichthe set of
|
||||
* model values applies for the component.
|
||||
*/
|
||||
uint8_t intensity_interval_lower_bound[3 /* y, cb, cr */][256 /* intensity interval */];
|
||||
|
||||
/**
|
||||
* Specifies the upper bound of each intensity interval for which the set of
|
||||
* model values applies for the component.
|
||||
*/
|
||||
uint8_t intensity_interval_upper_bound[3 /* y, cb, cr */][256 /* intensity interval */];
|
||||
|
||||
/**
|
||||
* Specifies the model values for the component for each intensity interval.
|
||||
* - When model_id == 0, the following applies:
|
||||
* For comp_model_value[y], the range of values is [0, 2^bit_depth_luma - 1]
|
||||
* For comp_model_value[cb..cr], the range of values is [0, 2^bit_depth_chroma - 1]
|
||||
* - Otherwise, the following applies:
|
||||
* For comp_model_value[y], the range of values is [-2^(bit_depth_luma - 1), 2^(bit_depth_luma - 1) - 1]
|
||||
* For comp_model_value[cb..cr], the range of values is [-2^(bit_depth_chroma - 1), 2^(bit_depth_chroma - 1) - 1]
|
||||
*/
|
||||
int16_t comp_model_value[3 /* y, cb, cr */][256 /* intensity interval */][6 /* model value */];
|
||||
} AVFilmGrainH274Params;
|
||||
|
||||
/**
|
||||
* This structure describes how to handle film grain synthesis in video
|
||||
* for specific codecs. Must be present on every frame where film grain is
|
||||
* meant to be synthesised for correct presentation.
|
||||
*
|
||||
* @note The struct must be allocated with av_film_grain_params_alloc() and
|
||||
* its size is not a part of the public ABI.
|
||||
*/
|
||||
typedef struct AVFilmGrainParams {
|
||||
/**
|
||||
* Specifies the codec for which this structure is valid.
|
||||
*/
|
||||
enum AVFilmGrainParamsType type;
|
||||
|
||||
/**
|
||||
* Seed to use for the synthesis process, if the codec allows for it.
|
||||
*
|
||||
* @note For H.264, this refers to `pic_offset` as defined in
|
||||
* SMPTE RDD 5-2006.
|
||||
*/
|
||||
uint64_t seed;
|
||||
|
||||
/**
|
||||
* Additional fields may be added both here and in any structure included.
|
||||
* If a codec's film grain structure differs slightly over another
|
||||
* codec's, fields within may change meaning depending on the type.
|
||||
*/
|
||||
union {
|
||||
AVFilmGrainAOMParams aom;
|
||||
AVFilmGrainH274Params h274;
|
||||
} codec;
|
||||
} AVFilmGrainParams;
|
||||
|
||||
/**
|
||||
* Allocate an AVFilmGrainParams structure and set its fields to
|
||||
* default values. The resulting struct can be freed using av_freep().
|
||||
* If size is not NULL it will be set to the number of bytes allocated.
|
||||
*
|
||||
* @return An AVFilmGrainParams filled with default values or NULL
|
||||
* on failure.
|
||||
*/
|
||||
AVFilmGrainParams *av_film_grain_params_alloc(size_t *size);
|
||||
|
||||
/**
|
||||
* Allocate a complete AVFilmGrainParams and add it to the frame.
|
||||
*
|
||||
* @param frame The frame which side data is added to.
|
||||
*
|
||||
* @return The AVFilmGrainParams structure to be filled by caller.
|
||||
*/
|
||||
AVFilmGrainParams *av_film_grain_params_create_side_data(AVFrame *frame);
|
||||
|
||||
#endif /* AVUTIL_FILM_GRAIN_PARAMS_H */
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include "avutil.h"
|
||||
#include "buffer.h"
|
||||
#include "channel_layout.h"
|
||||
#include "dict.h"
|
||||
#include "rational.h"
|
||||
#include "samplefmt.h"
|
||||
@ -142,28 +143,11 @@ enum AVFrameSideDataType {
|
||||
*/
|
||||
AV_FRAME_DATA_ICC_PROFILE,
|
||||
|
||||
#if FF_API_FRAME_QP
|
||||
/**
|
||||
* Implementation-specific description of the format of AV_FRAME_QP_TABLE_DATA.
|
||||
* The contents of this side data are undocumented and internal; use
|
||||
* av_frame_set_qp_table() and av_frame_get_qp_table() to access this in a
|
||||
* meaningful way instead.
|
||||
*/
|
||||
AV_FRAME_DATA_QP_TABLE_PROPERTIES,
|
||||
|
||||
/**
|
||||
* Raw QP table data. Its format is described by
|
||||
* AV_FRAME_DATA_QP_TABLE_PROPERTIES. Use av_frame_set_qp_table() and
|
||||
* av_frame_get_qp_table() to access this instead.
|
||||
*/
|
||||
AV_FRAME_DATA_QP_TABLE_DATA,
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Timecode which conforms to SMPTE ST 12-1. The data is an array of 4 uint32_t
|
||||
* where the first uint32_t describes how many (1-3) of the other timecodes are used.
|
||||
* The timecode format is described in the av_timecode_get_smpte_from_framenum()
|
||||
* function in libavutil/timecode.c.
|
||||
* The timecode format is described in the documentation of av_timecode_get_smpte_from_framenum()
|
||||
* function in libavutil/timecode.h.
|
||||
*/
|
||||
AV_FRAME_DATA_S12M_TIMECODE,
|
||||
|
||||
@ -173,6 +157,58 @@ enum AVFrameSideDataType {
|
||||
* volume transform - application 4 of SMPTE 2094-40:2016 standard.
|
||||
*/
|
||||
AV_FRAME_DATA_DYNAMIC_HDR_PLUS,
|
||||
|
||||
/**
|
||||
* Regions Of Interest, the data is an array of AVRegionOfInterest type, the number of
|
||||
* array element is implied by AVFrameSideData.size / AVRegionOfInterest.self_size.
|
||||
*/
|
||||
AV_FRAME_DATA_REGIONS_OF_INTEREST,
|
||||
|
||||
/**
|
||||
* Encoding parameters for a video frame, as described by AVVideoEncParams.
|
||||
*/
|
||||
AV_FRAME_DATA_VIDEO_ENC_PARAMS,
|
||||
|
||||
/**
|
||||
* User data unregistered metadata associated with a video frame.
|
||||
* This is the H.26[45] UDU SEI message, and shouldn't be used for any other purpose
|
||||
* The data is stored as uint8_t in AVFrameSideData.data which is 16 bytes of
|
||||
* uuid_iso_iec_11578 followed by AVFrameSideData.size - 16 bytes of user_data_payload_byte.
|
||||
*/
|
||||
AV_FRAME_DATA_SEI_UNREGISTERED,
|
||||
|
||||
/**
|
||||
* Film grain parameters for a frame, described by AVFilmGrainParams.
|
||||
* Must be present for every frame which should have film grain applied.
|
||||
*/
|
||||
AV_FRAME_DATA_FILM_GRAIN_PARAMS,
|
||||
|
||||
/**
|
||||
* Bounding boxes for object detection and classification,
|
||||
* as described by AVDetectionBBoxHeader.
|
||||
*/
|
||||
AV_FRAME_DATA_DETECTION_BBOXES,
|
||||
|
||||
/**
|
||||
* Dolby Vision RPU raw data, suitable for passing to x265
|
||||
* or other libraries. Array of uint8_t, with NAL emulation
|
||||
* bytes intact.
|
||||
*/
|
||||
AV_FRAME_DATA_DOVI_RPU_BUFFER,
|
||||
|
||||
/**
|
||||
* Parsed Dolby Vision metadata, suitable for passing to a software
|
||||
* implementation. The payload is the AVDOVIMetadata struct defined in
|
||||
* libavutil/dovi_meta.h.
|
||||
*/
|
||||
AV_FRAME_DATA_DOVI_METADATA,
|
||||
|
||||
/**
|
||||
* HDR Vivid dynamic metadata associated with a video frame. The payload is
|
||||
* an AVDynamicHDRVivid type and contains information for color
|
||||
* volume transform - CUVA 005.1-2021.
|
||||
*/
|
||||
AV_FRAME_DATA_DYNAMIC_HDR_VIVID,
|
||||
};
|
||||
|
||||
enum AVActiveFormatDescription {
|
||||
@ -195,11 +231,67 @@ enum AVActiveFormatDescription {
|
||||
typedef struct AVFrameSideData {
|
||||
enum AVFrameSideDataType type;
|
||||
uint8_t *data;
|
||||
int size;
|
||||
size_t size;
|
||||
AVDictionary *metadata;
|
||||
AVBufferRef *buf;
|
||||
} AVFrameSideData;
|
||||
|
||||
/**
|
||||
* Structure describing a single Region Of Interest.
|
||||
*
|
||||
* When multiple regions are defined in a single side-data block, they
|
||||
* should be ordered from most to least important - some encoders are only
|
||||
* capable of supporting a limited number of distinct regions, so will have
|
||||
* to truncate the list.
|
||||
*
|
||||
* When overlapping regions are defined, the first region containing a given
|
||||
* area of the frame applies.
|
||||
*/
|
||||
typedef struct AVRegionOfInterest {
|
||||
/**
|
||||
* Must be set to the size of this data structure (that is,
|
||||
* sizeof(AVRegionOfInterest)).
|
||||
*/
|
||||
uint32_t self_size;
|
||||
/**
|
||||
* Distance in pixels from the top edge of the frame to the top and
|
||||
* bottom edges and from the left edge of the frame to the left and
|
||||
* right edges of the rectangle defining this region of interest.
|
||||
*
|
||||
* The constraints on a region are encoder dependent, so the region
|
||||
* actually affected may be slightly larger for alignment or other
|
||||
* reasons.
|
||||
*/
|
||||
int top;
|
||||
int bottom;
|
||||
int left;
|
||||
int right;
|
||||
/**
|
||||
* Quantisation offset.
|
||||
*
|
||||
* Must be in the range -1 to +1. A value of zero indicates no quality
|
||||
* change. A negative value asks for better quality (less quantisation),
|
||||
* while a positive value asks for worse quality (greater quantisation).
|
||||
*
|
||||
* The range is calibrated so that the extreme values indicate the
|
||||
* largest possible offset - if the rest of the frame is encoded with the
|
||||
* worst possible quality, an offset of -1 indicates that this region
|
||||
* should be encoded with the best possible quality anyway. Intermediate
|
||||
* values are then interpolated in some codec-dependent way.
|
||||
*
|
||||
* For example, in 10-bit H.264 the quantisation parameter varies between
|
||||
* -12 and 51. A typical qoffset value of -1/10 therefore indicates that
|
||||
* this region should be encoded with a QP around one-tenth of the full
|
||||
* range better than the rest of the frame. So, if most of the frame
|
||||
* were to be encoded with a QP of around 30, this region would get a QP
|
||||
* of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
|
||||
* An extreme value of -1 would indicate that this region should be
|
||||
* encoded with the best possible quality regardless of the treatment of
|
||||
* the rest of the frame - that is, should be encoded at a QP of -12.
|
||||
*/
|
||||
AVRational qoffset;
|
||||
} AVRegionOfInterest;
|
||||
|
||||
/**
|
||||
* This structure describes decoded (raw) audio or video data.
|
||||
*
|
||||
@ -234,21 +326,32 @@ typedef struct AVFrame {
|
||||
#define AV_NUM_DATA_POINTERS 8
|
||||
/**
|
||||
* pointer to the picture/channel planes.
|
||||
* This might be different from the first allocated byte
|
||||
* This might be different from the first allocated byte. For video,
|
||||
* it could even point to the end of the image data.
|
||||
*
|
||||
* All pointers in data and extended_data must point into one of the
|
||||
* AVBufferRef in buf or extended_buf.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* NOTE: Except for hwaccel formats, pointers not needed by the format
|
||||
* MUST be set to NULL.
|
||||
* NOTE: Pointers not needed by the format MUST be set to NULL.
|
||||
*
|
||||
* @attention In case of video, the data[] pointers can point to the
|
||||
* end of image data in order to reverse line order, when used in
|
||||
* combination with negative values in the linesize[] array.
|
||||
*/
|
||||
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 video, a positive or negative value, which is typically indicating
|
||||
* the size in bytes of each picture line, but it can also be:
|
||||
* - the negative byte size of lines for vertical flipping
|
||||
* (with data[n] pointing to the end of the data
|
||||
* - a positive or negative multiple of the byte size as for accessing
|
||||
* even and odd fields of a frame (possibly flipped)
|
||||
*
|
||||
* For audio, only linesize[0] may be set. For planar audio, each channel
|
||||
* plane must be the same size.
|
||||
@ -260,6 +363,9 @@ typedef struct AVFrame {
|
||||
*
|
||||
* @note The linesize may be larger than the size of usable data -- there
|
||||
* may be extra padding present for performance reasons.
|
||||
*
|
||||
* @attention In case of video, line size values can be negative to achieve
|
||||
* a vertically inverted iteration over image lines.
|
||||
*/
|
||||
int linesize[AV_NUM_DATA_POINTERS];
|
||||
|
||||
@ -325,15 +431,6 @@ typedef struct AVFrame {
|
||||
*/
|
||||
int64_t pts;
|
||||
|
||||
#if FF_API_PKT_PTS
|
||||
/**
|
||||
* PTS copied from the AVPacket that was decoded to produce this frame.
|
||||
* @deprecated use the pts field instead
|
||||
*/
|
||||
attribute_deprecated
|
||||
int64_t pkt_pts;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* 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
|
||||
@ -341,6 +438,14 @@ typedef struct AVFrame {
|
||||
*/
|
||||
int64_t pkt_dts;
|
||||
|
||||
/**
|
||||
* Time base for the timestamps in this frame.
|
||||
* In the future, this field may be set on frames output by decoders or
|
||||
* filters, but its value will be by default ignored on input to encoders
|
||||
* or filters.
|
||||
*/
|
||||
AVRational time_base;
|
||||
|
||||
/**
|
||||
* picture number in bitstream order
|
||||
*/
|
||||
@ -360,14 +465,6 @@ typedef struct AVFrame {
|
||||
*/
|
||||
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)
|
||||
@ -404,16 +501,20 @@ typedef struct AVFrame {
|
||||
*/
|
||||
int sample_rate;
|
||||
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
/**
|
||||
* Channel layout of the audio data.
|
||||
* @deprecated use ch_layout instead
|
||||
*/
|
||||
attribute_deprecated
|
||||
uint64_t channel_layout;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* AVBuffer references backing the data for this frame. All the pointers in
|
||||
* data and extended_data must point inside one of the buffers in buf or
|
||||
* extended_buf. 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
|
||||
@ -528,13 +629,19 @@ typedef struct AVFrame {
|
||||
int decode_error_flags;
|
||||
#define FF_DECODE_ERROR_INVALID_BITSTREAM 1
|
||||
#define FF_DECODE_ERROR_MISSING_REFERENCE 2
|
||||
#define FF_DECODE_ERROR_CONCEALMENT_ACTIVE 4
|
||||
#define FF_DECODE_ERROR_DECODE_SLICES 8
|
||||
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
/**
|
||||
* number of audio channels, only used for audio.
|
||||
* - encoding: unused
|
||||
* - decoding: Read by user.
|
||||
* @deprecated use ch_layout instead
|
||||
*/
|
||||
attribute_deprecated
|
||||
int channels;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* size of the corresponding packet containing the compressed
|
||||
@ -545,24 +652,6 @@ typedef struct AVFrame {
|
||||
*/
|
||||
int pkt_size;
|
||||
|
||||
#if FF_API_FRAME_QP
|
||||
/**
|
||||
* QP table
|
||||
*/
|
||||
attribute_deprecated
|
||||
int8_t *qscale_table;
|
||||
/**
|
||||
* QP store stride
|
||||
*/
|
||||
attribute_deprecated
|
||||
int qstride;
|
||||
|
||||
attribute_deprecated
|
||||
int qscale_type;
|
||||
|
||||
attribute_deprecated
|
||||
AVBufferRef *qp_table_buf;
|
||||
#endif
|
||||
/**
|
||||
* For hwaccel-format frames, this should be a reference to the
|
||||
* AVHWFramesContext describing the frame.
|
||||
@ -608,71 +697,23 @@ typedef struct AVFrame {
|
||||
* for the target frame's private_ref field.
|
||||
*/
|
||||
AVBufferRef *private_ref;
|
||||
|
||||
/**
|
||||
* Channel layout of the audio data.
|
||||
*/
|
||||
AVChannelLayout ch_layout;
|
||||
} AVFrame;
|
||||
|
||||
#if FF_API_FRAME_GET_SET
|
||||
/**
|
||||
* Accessors for some AVFrame fields. These used to be provided for ABI
|
||||
* compatibility, and do not need to be used anymore.
|
||||
*/
|
||||
attribute_deprecated
|
||||
int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame);
|
||||
attribute_deprecated
|
||||
void av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val);
|
||||
attribute_deprecated
|
||||
int64_t av_frame_get_pkt_duration (const AVFrame *frame);
|
||||
attribute_deprecated
|
||||
void av_frame_set_pkt_duration (AVFrame *frame, int64_t val);
|
||||
attribute_deprecated
|
||||
int64_t av_frame_get_pkt_pos (const AVFrame *frame);
|
||||
attribute_deprecated
|
||||
void av_frame_set_pkt_pos (AVFrame *frame, int64_t val);
|
||||
attribute_deprecated
|
||||
int64_t av_frame_get_channel_layout (const AVFrame *frame);
|
||||
attribute_deprecated
|
||||
void av_frame_set_channel_layout (AVFrame *frame, int64_t val);
|
||||
attribute_deprecated
|
||||
int av_frame_get_channels (const AVFrame *frame);
|
||||
attribute_deprecated
|
||||
void av_frame_set_channels (AVFrame *frame, int val);
|
||||
attribute_deprecated
|
||||
int av_frame_get_sample_rate (const AVFrame *frame);
|
||||
attribute_deprecated
|
||||
void av_frame_set_sample_rate (AVFrame *frame, int val);
|
||||
attribute_deprecated
|
||||
AVDictionary *av_frame_get_metadata (const AVFrame *frame);
|
||||
attribute_deprecated
|
||||
void av_frame_set_metadata (AVFrame *frame, AVDictionary *val);
|
||||
attribute_deprecated
|
||||
int av_frame_get_decode_error_flags (const AVFrame *frame);
|
||||
attribute_deprecated
|
||||
void av_frame_set_decode_error_flags (AVFrame *frame, int val);
|
||||
attribute_deprecated
|
||||
int av_frame_get_pkt_size(const AVFrame *frame);
|
||||
attribute_deprecated
|
||||
void av_frame_set_pkt_size(AVFrame *frame, int val);
|
||||
#if FF_API_FRAME_QP
|
||||
attribute_deprecated
|
||||
int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type);
|
||||
attribute_deprecated
|
||||
int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type);
|
||||
#endif
|
||||
attribute_deprecated
|
||||
enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame);
|
||||
attribute_deprecated
|
||||
void av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val);
|
||||
attribute_deprecated
|
||||
enum AVColorRange av_frame_get_color_range(const AVFrame *frame);
|
||||
attribute_deprecated
|
||||
void av_frame_set_color_range(AVFrame *frame, enum AVColorRange val);
|
||||
#endif
|
||||
|
||||
#if FF_API_COLORSPACE_NAME
|
||||
/**
|
||||
* Get the name of a colorspace.
|
||||
* @return a static string identifying the colorspace; can be NULL.
|
||||
* @deprecated use av_color_space_name()
|
||||
*/
|
||||
attribute_deprecated
|
||||
const char *av_get_colorspace_name(enum AVColorSpace val);
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Allocate an AVFrame and set its fields to default values. The resulting
|
||||
* struct must be freed using av_frame_free().
|
||||
@ -740,7 +781,7 @@ void av_frame_move_ref(AVFrame *dst, AVFrame *src);
|
||||
* 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
|
||||
* - nb_samples and ch_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.
|
||||
@ -830,7 +871,7 @@ AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane);
|
||||
*/
|
||||
AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
|
||||
enum AVFrameSideDataType type,
|
||||
int size);
|
||||
size_t size);
|
||||
|
||||
/**
|
||||
* Add a new side data to a frame from an existing AVBufferRef
|
||||
@ -856,8 +897,7 @@ 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.
|
||||
* Remove and free all side data instances of the given type.
|
||||
*/
|
||||
void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type);
|
||||
|
||||
|
@ -27,10 +27,9 @@
|
||||
#ifndef AVUTIL_HASH_H
|
||||
#define AVUTIL_HASH_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "version.h"
|
||||
|
||||
/**
|
||||
* @defgroup lavu_hash Hash Functions
|
||||
* @ingroup lavu_crypto
|
||||
@ -181,11 +180,7 @@ void av_hash_init(struct AVHashContext *ctx);
|
||||
* @param[in] src Data to be added to the hash context
|
||||
* @param[in] len Size of the additional data
|
||||
*/
|
||||
#if FF_API_CRYPTO_SIZE_T
|
||||
void av_hash_update(struct AVHashContext *ctx, const uint8_t *src, int len);
|
||||
#else
|
||||
void av_hash_update(struct AVHashContext *ctx, const uint8_t *src, size_t len);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Finalize a hash context and compute the actual hash value.
|
||||
|
285
ext_includes/ffmpeg/libavutil/hdr_dynamic_vivid_metadata.h
Normal file
285
ext_includes/ffmpeg/libavutil/hdr_dynamic_vivid_metadata.h
Normal file
@ -0,0 +1,285 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Limin Wang <lance.lmwang at gmail.com>
|
||||
*
|
||||
* 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_HDR_DYNAMIC_VIVID_METADATA_H
|
||||
#define AVUTIL_HDR_DYNAMIC_VIVID_METADATA_H
|
||||
|
||||
#include "frame.h"
|
||||
#include "rational.h"
|
||||
|
||||
/**
|
||||
* Color tone mapping parameters at a processing window in a dynamic metadata for
|
||||
* CUVA 005.1:2021.
|
||||
*/
|
||||
typedef struct AVHDRVividColorToneMappingParams {
|
||||
/**
|
||||
* The nominal maximum display luminance of the targeted system display,
|
||||
* in multiples of 1.0/4095 candelas per square metre. The value shall be in
|
||||
* the range of 0.0 to 1.0, inclusive.
|
||||
*/
|
||||
AVRational targeted_system_display_maximum_luminance;
|
||||
|
||||
/**
|
||||
* This flag indicates that transfer the base paramter(for value of 1)
|
||||
*/
|
||||
int base_enable_flag;
|
||||
|
||||
/**
|
||||
* base_param_m_p in the base parameter,
|
||||
* in multiples of 1.0/16383. The value shall be in
|
||||
* the range of 0.0 to 1.0, inclusive.
|
||||
*/
|
||||
AVRational base_param_m_p;
|
||||
|
||||
/**
|
||||
* base_param_m_m in the base parameter,
|
||||
* in multiples of 1.0/10. The value shall be in
|
||||
* the range of 0.0 to 6.3, inclusive.
|
||||
*/
|
||||
AVRational base_param_m_m;
|
||||
|
||||
/**
|
||||
* base_param_m_a in the base parameter,
|
||||
* in multiples of 1.0/1023. The value shall be in
|
||||
* the range of 0.0 to 1.0 inclusive.
|
||||
*/
|
||||
AVRational base_param_m_a;
|
||||
|
||||
/**
|
||||
* base_param_m_b in the base parameter,
|
||||
* in multiples of 1/1023. The value shall be in
|
||||
* the range of 0.0 to 1.0, inclusive.
|
||||
*/
|
||||
AVRational base_param_m_b;
|
||||
|
||||
/**
|
||||
* base_param_m_n in the base parameter,
|
||||
* in multiples of 1.0/10. The value shall be in
|
||||
* the range of 0.0 to 6.3, inclusive.
|
||||
*/
|
||||
AVRational base_param_m_n;
|
||||
|
||||
/**
|
||||
* indicates k1_0 in the base parameter,
|
||||
* base_param_k1 <= 1: k1_0 = base_param_k1
|
||||
* base_param_k1 > 1: reserved
|
||||
*/
|
||||
int base_param_k1;
|
||||
|
||||
/**
|
||||
* indicates k2_0 in the base parameter,
|
||||
* base_param_k2 <= 1: k2_0 = base_param_k2
|
||||
* base_param_k2 > 1: reserved
|
||||
*/
|
||||
int base_param_k2;
|
||||
|
||||
/**
|
||||
* indicates k3_0 in the base parameter,
|
||||
* base_param_k3 == 1: k3_0 = base_param_k3
|
||||
* base_param_k3 == 2: k3_0 = maximum_maxrgb
|
||||
* base_param_k3 > 2: reserved
|
||||
*/
|
||||
int base_param_k3;
|
||||
|
||||
/**
|
||||
* This flag indicates that delta mode of base paramter(for value of 1)
|
||||
*/
|
||||
int base_param_Delta_enable_mode;
|
||||
|
||||
/**
|
||||
* base_param_Delta in the base parameter,
|
||||
* in multiples of 1.0/127. The value shall be in
|
||||
* the range of 0.0 to 1.0, inclusive.
|
||||
*/
|
||||
AVRational base_param_Delta;
|
||||
|
||||
/**
|
||||
* indicates 3Spline_enable_flag in the base parameter,
|
||||
* This flag indicates that transfer three Spline of base paramter(for value of 1)
|
||||
*/
|
||||
int three_Spline_enable_flag;
|
||||
|
||||
/**
|
||||
* The number of three Spline. The value shall be in the range
|
||||
* of 1 to 2, inclusive.
|
||||
*/
|
||||
int three_Spline_num;
|
||||
|
||||
/**
|
||||
* The mode of three Spline. the value shall be in the range
|
||||
* of 0 to 3, inclusive.
|
||||
*/
|
||||
int three_Spline_TH_mode;
|
||||
|
||||
/**
|
||||
* three_Spline_TH_enable_MB is in the range of 0.0 to 1.0, inclusive
|
||||
* and in multiples of 1.0/255.
|
||||
*
|
||||
*/
|
||||
AVRational three_Spline_TH_enable_MB;
|
||||
|
||||
/**
|
||||
* 3Spline_TH_enable of three Spline.
|
||||
* The value shall be in the range of 0.0 to 1.0, inclusive.
|
||||
* and in multiples of 1.0/4095.
|
||||
*/
|
||||
AVRational three_Spline_TH_enable;
|
||||
|
||||
/**
|
||||
* 3Spline_TH_Delta1 of three Spline.
|
||||
* The value shall be in the range of 0.0 to 0.25, inclusive,
|
||||
* and in multiples of 0.25/1023.
|
||||
*/
|
||||
AVRational three_Spline_TH_Delta1;
|
||||
|
||||
/**
|
||||
* 3Spline_TH_Delta2 of three Spline.
|
||||
* The value shall be in the range of 0.0 to 0.25, inclusive,
|
||||
* and in multiples of 0.25/1023.
|
||||
*/
|
||||
AVRational three_Spline_TH_Delta2;
|
||||
|
||||
/**
|
||||
* 3Spline_enable_Strength of three Spline.
|
||||
* The value shall be in the range of 0.0 to 1.0, inclusive,
|
||||
* and in multiples of 1.0/255.
|
||||
*/
|
||||
AVRational three_Spline_enable_Strength;
|
||||
} AVHDRVividColorToneMappingParams;
|
||||
|
||||
|
||||
/**
|
||||
* Color transform parameters at a processing window in a dynamic metadata for
|
||||
* CUVA 005.1:2021.
|
||||
*/
|
||||
typedef struct AVHDRVividColorTransformParams {
|
||||
/**
|
||||
* Indicates the minimum brightness of the displayed content.
|
||||
* The values should be in the range of 0.0 to 1.0,
|
||||
* inclusive and in multiples of 1/4095.
|
||||
*/
|
||||
AVRational minimum_maxrgb;
|
||||
|
||||
/**
|
||||
* Indicates the average brightness of the displayed content.
|
||||
* The values should be in the range of 0.0 to 1.0,
|
||||
* inclusive and in multiples of 1/4095.
|
||||
*/
|
||||
AVRational average_maxrgb;
|
||||
|
||||
/**
|
||||
* Indicates the variance brightness of the displayed content.
|
||||
* The values should be in the range of 0.0 to 1.0,
|
||||
* inclusive and in multiples of 1/4095.
|
||||
*/
|
||||
AVRational variance_maxrgb;
|
||||
|
||||
/**
|
||||
* Indicates the maximum brightness of the displayed content.
|
||||
* The values should be in the range of 0.0 to 1.0, inclusive
|
||||
* and in multiples of 1/4095.
|
||||
*/
|
||||
AVRational maximum_maxrgb;
|
||||
|
||||
/**
|
||||
* This flag indicates that the metadata for the tone mapping function in
|
||||
* the processing window is present (for value of 1).
|
||||
*/
|
||||
int tone_mapping_mode_flag;
|
||||
|
||||
/**
|
||||
* The number of tone mapping param. The value shall be in the range
|
||||
* of 1 to 2, inclusive.
|
||||
*/
|
||||
int tone_mapping_param_num;
|
||||
|
||||
/**
|
||||
* The color tone mapping parameters.
|
||||
*/
|
||||
AVHDRVividColorToneMappingParams tm_params[2];
|
||||
|
||||
/**
|
||||
* This flag indicates that the metadata for the color saturation mapping in
|
||||
* the processing window is present (for value of 1).
|
||||
*/
|
||||
int color_saturation_mapping_flag;
|
||||
|
||||
/**
|
||||
* The number of color saturation param. The value shall be in the range
|
||||
* of 0 to 7, inclusive.
|
||||
*/
|
||||
int color_saturation_num;
|
||||
|
||||
/**
|
||||
* Indicates the color correction strength parameter.
|
||||
* The values should be in the range of 0.0 to 2.0, inclusive
|
||||
* and in multiples of 1/128.
|
||||
*/
|
||||
AVRational color_saturation_gain[8];
|
||||
} AVHDRVividColorTransformParams;
|
||||
|
||||
/**
|
||||
* This struct represents dynamic metadata for color volume transform -
|
||||
* CUVA 005.1:2021 standard
|
||||
*
|
||||
* To be used as payload of a AVFrameSideData or AVPacketSideData with the
|
||||
* appropriate type.
|
||||
*
|
||||
* @note The struct should be allocated with
|
||||
* av_dynamic_hdr_vivid_alloc() and its size is not a part of
|
||||
* the public ABI.
|
||||
*/
|
||||
typedef struct AVDynamicHDRVivid {
|
||||
/**
|
||||
* The system start code. The value shall be set to 0x01.
|
||||
*/
|
||||
uint8_t system_start_code;
|
||||
|
||||
/**
|
||||
* The number of processing windows. The value shall be set to 0x01
|
||||
* if the system_start_code is 0x01.
|
||||
*/
|
||||
uint8_t num_windows;
|
||||
|
||||
/**
|
||||
* The color transform parameters for every processing window.
|
||||
*/
|
||||
AVHDRVividColorTransformParams params[3];
|
||||
} AVDynamicHDRVivid;
|
||||
|
||||
/**
|
||||
* Allocate an AVDynamicHDRVivid structure and set its fields to
|
||||
* default values. The resulting struct can be freed using av_freep().
|
||||
*
|
||||
* @return An AVDynamicHDRVivid filled with default values or NULL
|
||||
* on failure.
|
||||
*/
|
||||
AVDynamicHDRVivid *av_dynamic_hdr_vivid_alloc(size_t *size);
|
||||
|
||||
/**
|
||||
* Allocate a complete AVDynamicHDRVivid and add it to the frame.
|
||||
* @param frame The frame which side data is added to.
|
||||
*
|
||||
* @return The AVDynamicHDRVivid structure to be filled by caller or NULL
|
||||
* on failure.
|
||||
*/
|
||||
AVDynamicHDRVivid *av_dynamic_hdr_vivid_create_side_data(AVFrame *frame);
|
||||
|
||||
#endif /* AVUTIL_HDR_DYNAMIC_VIVID_METADATA_H */
|
@ -23,7 +23,6 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "version.h"
|
||||
/**
|
||||
* @defgroup lavu_hmac HMAC
|
||||
* @ingroup lavu_crypto
|
||||
|
@ -36,6 +36,7 @@ enum AVHWDeviceType {
|
||||
AV_HWDEVICE_TYPE_DRM,
|
||||
AV_HWDEVICE_TYPE_OPENCL,
|
||||
AV_HWDEVICE_TYPE_MEDIACODEC,
|
||||
AV_HWDEVICE_TYPE_VULKAN,
|
||||
};
|
||||
|
||||
typedef struct AVHWDeviceInternal AVHWDeviceInternal;
|
||||
@ -327,6 +328,26 @@ int av_hwdevice_ctx_create_derived(AVBufferRef **dst_ctx,
|
||||
enum AVHWDeviceType type,
|
||||
AVBufferRef *src_ctx, int flags);
|
||||
|
||||
/**
|
||||
* Create a new device of the specified type from an existing device.
|
||||
*
|
||||
* This function performs the same action as av_hwdevice_ctx_create_derived,
|
||||
* however, it is able to set options for the new device to be derived.
|
||||
*
|
||||
* @param dst_ctx On success, a reference to the newly-created
|
||||
* AVHWDeviceContext.
|
||||
* @param type The type of the new device to create.
|
||||
* @param src_ctx A reference to an existing AVHWDeviceContext which will be
|
||||
* used to create the new device.
|
||||
* @param options Options for the new device to create, same format as in
|
||||
* av_hwdevice_ctx_create.
|
||||
* @param flags Currently unused; should be set to zero.
|
||||
* @return Zero on success, a negative AVERROR code on failure.
|
||||
*/
|
||||
int av_hwdevice_ctx_create_derived_opts(AVBufferRef **dst_ctx,
|
||||
enum AVHWDeviceType type,
|
||||
AVBufferRef *src_ctx,
|
||||
AVDictionary *options, int flags);
|
||||
|
||||
/**
|
||||
* Allocate an AVHWFramesContext tied to a given device context.
|
||||
@ -550,6 +571,10 @@ enum {
|
||||
* possible with the given arguments and hwframe setup, while other return
|
||||
* values indicate that it failed somehow.
|
||||
*
|
||||
* On failure, the destination frame will be left blank, except for the
|
||||
* hw_frames_ctx/format fields thay may have been set by the caller - those will
|
||||
* be preserved as they were.
|
||||
*
|
||||
* @param dst Destination frame, to contain the mapping.
|
||||
* @param src Source frame, to be mapped.
|
||||
* @param flags Some combination of AV_HWFRAME_MAP_* flags.
|
||||
|
@ -49,4 +49,21 @@ typedef struct AVCUDADeviceContext {
|
||||
* AVHWFramesContext.hwctx is currently not used
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup hwcontext_cuda Device context creation flags
|
||||
*
|
||||
* Flags for av_hwdevice_ctx_create.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Use primary device context instead of creating a new one.
|
||||
*/
|
||||
#define AV_CUDA_USE_PRIMARY_CONTEXT (1 << 0)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* AVUTIL_HWCONTEXT_CUDA_H */
|
||||
|
@ -164,6 +164,15 @@ typedef struct AVD3D11VAFramesContext {
|
||||
* This field is ignored/invalid if a user-allocated texture is provided.
|
||||
*/
|
||||
UINT MiscFlags;
|
||||
|
||||
/**
|
||||
* In case if texture structure member above is not NULL contains the same texture
|
||||
* pointer for all elements and different indexes into the array texture.
|
||||
* In case if texture structure member above is NULL, all elements contains
|
||||
* pointers to separate non-array textures and 0 indexes.
|
||||
* This field is ignored/invalid if a user-allocated texture is provided.
|
||||
*/
|
||||
AVD3D11FrameDescriptor *texture_infos;
|
||||
} AVD3D11VAFramesContext;
|
||||
|
||||
#endif /* AVUTIL_HWCONTEXT_D3D11VA_H */
|
||||
|
100
ext_includes/ffmpeg/libavutil/hwcontext_opencl.h
Normal file
100
ext_includes/ffmpeg/libavutil/hwcontext_opencl.h
Normal file
@ -0,0 +1,100 @@
|
||||
/*
|
||||
* 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_HWCONTEXT_OPENCL_H
|
||||
#define AVUTIL_HWCONTEXT_OPENCL_H
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/cl.h>
|
||||
#else
|
||||
#include <CL/cl.h>
|
||||
#endif
|
||||
|
||||
#include "frame.h"
|
||||
|
||||
/**
|
||||
* @file
|
||||
* API-specific header for AV_HWDEVICE_TYPE_OPENCL.
|
||||
*
|
||||
* Pools allocated internally are always dynamic, and are primarily intended
|
||||
* to be used in OpenCL-only cases. If interoperation is required, it is
|
||||
* typically required to allocate frames in the other API and then map the
|
||||
* frames context to OpenCL with av_hwframe_ctx_create_derived().
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenCL frame descriptor for pool allocation.
|
||||
*
|
||||
* In user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs
|
||||
* with the data pointer pointing at an object of this type describing the
|
||||
* planes of the frame.
|
||||
*/
|
||||
typedef struct AVOpenCLFrameDescriptor {
|
||||
/**
|
||||
* Number of planes in the frame.
|
||||
*/
|
||||
int nb_planes;
|
||||
/**
|
||||
* OpenCL image2d objects for each plane of the frame.
|
||||
*/
|
||||
cl_mem planes[AV_NUM_DATA_POINTERS];
|
||||
} AVOpenCLFrameDescriptor;
|
||||
|
||||
/**
|
||||
* OpenCL device details.
|
||||
*
|
||||
* Allocated as AVHWDeviceContext.hwctx
|
||||
*/
|
||||
typedef struct AVOpenCLDeviceContext {
|
||||
/**
|
||||
* The primary device ID of the device. If multiple OpenCL devices
|
||||
* are associated with the context then this is the one which will
|
||||
* be used for all operations internal to FFmpeg.
|
||||
*/
|
||||
cl_device_id device_id;
|
||||
/**
|
||||
* The OpenCL context which will contain all operations and frames on
|
||||
* this device.
|
||||
*/
|
||||
cl_context context;
|
||||
/**
|
||||
* The default command queue for this device, which will be used by all
|
||||
* frames contexts which do not have their own command queue. If not
|
||||
* intialised by the user, a default queue will be created on the
|
||||
* primary device.
|
||||
*/
|
||||
cl_command_queue command_queue;
|
||||
} AVOpenCLDeviceContext;
|
||||
|
||||
/**
|
||||
* OpenCL-specific data associated with a frame pool.
|
||||
*
|
||||
* Allocated as AVHWFramesContext.hwctx.
|
||||
*/
|
||||
typedef struct AVOpenCLFramesContext {
|
||||
/**
|
||||
* The command queue used for internal asynchronous operations on this
|
||||
* device (av_hwframe_transfer_data(), av_hwframe_map()).
|
||||
*
|
||||
* If this is not set, the command queue from the associated device is
|
||||
* used instead.
|
||||
*/
|
||||
cl_command_queue command_queue;
|
||||
} AVOpenCLFramesContext;
|
||||
|
||||
#endif /* AVUTIL_HWCONTEXT_OPENCL_H */
|
@ -29,11 +29,14 @@
|
||||
* @file
|
||||
* An API-specific header for AV_HWDEVICE_TYPE_VIDEOTOOLBOX.
|
||||
*
|
||||
* This API currently does not support frame allocation, as the raw VideoToolbox
|
||||
* API does allocation, and FFmpeg itself never has the need to allocate frames.
|
||||
* This API supports frame allocation using a native CVPixelBufferPool
|
||||
* instead of an AVBufferPool.
|
||||
*
|
||||
* If the API user sets a custom pool, AVHWFramesContext.pool must return
|
||||
* AVBufferRefs whose data pointer is a CVImageBufferRef or CVPixelBufferRef.
|
||||
* Note that the underlying CVPixelBuffer could be retained by OS frameworks
|
||||
* depending on application usage, so it is preferable to let CoreVideo manage
|
||||
* the pool using the default implementation.
|
||||
*
|
||||
* Currently AVHWDeviceContext.hwctx and AVHWFramesContext.hwctx are always
|
||||
* NULL.
|
||||
@ -51,4 +54,42 @@ enum AVPixelFormat av_map_videotoolbox_format_to_pixfmt(uint32_t cv_fmt);
|
||||
*/
|
||||
uint32_t av_map_videotoolbox_format_from_pixfmt(enum AVPixelFormat pix_fmt);
|
||||
|
||||
/**
|
||||
* Same as av_map_videotoolbox_format_from_pixfmt function, but can map and
|
||||
* return full range pixel formats via a flag.
|
||||
*/
|
||||
uint32_t av_map_videotoolbox_format_from_pixfmt2(enum AVPixelFormat pix_fmt, bool full_range);
|
||||
|
||||
/**
|
||||
* Convert an AVChromaLocation to a VideoToolbox/CoreVideo chroma location string.
|
||||
* Returns 0 if no known equivalent was found.
|
||||
*/
|
||||
CFStringRef av_map_videotoolbox_chroma_loc_from_av(enum AVChromaLocation loc);
|
||||
|
||||
/**
|
||||
* Convert an AVColorSpace to a VideoToolbox/CoreVideo color matrix string.
|
||||
* Returns 0 if no known equivalent was found.
|
||||
*/
|
||||
CFStringRef av_map_videotoolbox_color_matrix_from_av(enum AVColorSpace space);
|
||||
|
||||
/**
|
||||
* Convert an AVColorPrimaries to a VideoToolbox/CoreVideo color primaries string.
|
||||
* Returns 0 if no known equivalent was found.
|
||||
*/
|
||||
CFStringRef av_map_videotoolbox_color_primaries_from_av(enum AVColorPrimaries pri);
|
||||
|
||||
/**
|
||||
* Convert an AVColorTransferCharacteristic to a VideoToolbox/CoreVideo color transfer
|
||||
* function string.
|
||||
* Returns 0 if no known equivalent was found.
|
||||
*/
|
||||
CFStringRef av_map_videotoolbox_color_trc_from_av(enum AVColorTransferCharacteristic trc);
|
||||
|
||||
/**
|
||||
* Update a CVPixelBufferRef's metadata to based on an AVFrame.
|
||||
* Returns 0 if no known equivalent was found.
|
||||
*/
|
||||
int av_vt_pixbuf_set_attachments(void *log_ctx,
|
||||
CVPixelBufferRef pixbuf, const struct AVFrame *src);
|
||||
|
||||
#endif /* AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H */
|
||||
|
281
ext_includes/ffmpeg/libavutil/hwcontext_vulkan.h
Normal file
281
ext_includes/ffmpeg/libavutil/hwcontext_vulkan.h
Normal file
@ -0,0 +1,281 @@
|
||||
/*
|
||||
* 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_HWCONTEXT_VULKAN_H
|
||||
#define AVUTIL_HWCONTEXT_VULKAN_H
|
||||
|
||||
#if defined(_WIN32) && !defined(VK_USE_PLATFORM_WIN32_KHR)
|
||||
#define VK_USE_PLATFORM_WIN32_KHR
|
||||
#endif
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
#include "pixfmt.h"
|
||||
#include "frame.h"
|
||||
|
||||
/**
|
||||
* @file
|
||||
* API-specific header for AV_HWDEVICE_TYPE_VULKAN.
|
||||
*
|
||||
* For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs
|
||||
* with the data pointer set to an AVVkFrame.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Main Vulkan context, allocated as AVHWDeviceContext.hwctx.
|
||||
* All of these can be set before init to change what the context uses
|
||||
*/
|
||||
typedef struct AVVulkanDeviceContext {
|
||||
/**
|
||||
* Custom memory allocator, else NULL
|
||||
*/
|
||||
const VkAllocationCallbacks *alloc;
|
||||
|
||||
/**
|
||||
* Pointer to the instance-provided vkGetInstanceProcAddr loading function.
|
||||
* If NULL, will pick either libvulkan or libvolk, depending on libavutil's
|
||||
* compilation settings, and set this field.
|
||||
*/
|
||||
PFN_vkGetInstanceProcAddr get_proc_addr;
|
||||
|
||||
/**
|
||||
* Vulkan instance. Must be at least version 1.2.
|
||||
*/
|
||||
VkInstance inst;
|
||||
|
||||
/**
|
||||
* Physical device
|
||||
*/
|
||||
VkPhysicalDevice phys_dev;
|
||||
|
||||
/**
|
||||
* Active device
|
||||
*/
|
||||
VkDevice act_dev;
|
||||
|
||||
/**
|
||||
* This structure should be set to the set of features that present and enabled
|
||||
* during device creation. When a device is created by FFmpeg, it will default to
|
||||
* enabling all that are present of the shaderImageGatherExtended,
|
||||
* fragmentStoresAndAtomics, shaderInt64 and vertexPipelineStoresAndAtomics features.
|
||||
*/
|
||||
VkPhysicalDeviceFeatures2 device_features;
|
||||
|
||||
/**
|
||||
* Enabled instance extensions.
|
||||
* If supplying your own device context, set this to an array of strings, with
|
||||
* each entry containing the specified Vulkan extension string to enable.
|
||||
* Duplicates are possible and accepted.
|
||||
* If no extensions are enabled, set these fields to NULL, and 0 respectively.
|
||||
*/
|
||||
const char * const *enabled_inst_extensions;
|
||||
int nb_enabled_inst_extensions;
|
||||
|
||||
/**
|
||||
* Enabled device extensions. By default, VK_KHR_external_memory_fd,
|
||||
* VK_EXT_external_memory_dma_buf, VK_EXT_image_drm_format_modifier,
|
||||
* VK_KHR_external_semaphore_fd and VK_EXT_external_memory_host are enabled if found.
|
||||
* If supplying your own device context, these fields takes the same format as
|
||||
* the above fields, with the same conditions that duplicates are possible
|
||||
* and accepted, and that NULL and 0 respectively means no extensions are enabled.
|
||||
*/
|
||||
const char * const *enabled_dev_extensions;
|
||||
int nb_enabled_dev_extensions;
|
||||
|
||||
/**
|
||||
* Queue family index for graphics operations, and the number of queues
|
||||
* enabled for it. If unavaiable, will be set to -1. Not required.
|
||||
* av_hwdevice_create() will attempt to find a dedicated queue for each
|
||||
* queue family, or pick the one with the least unrelated flags set.
|
||||
* Queue indices here may overlap if a queue has to share capabilities.
|
||||
*/
|
||||
int queue_family_index;
|
||||
int nb_graphics_queues;
|
||||
|
||||
/**
|
||||
* Queue family index for transfer operations and the number of queues
|
||||
* enabled. Required.
|
||||
*/
|
||||
int queue_family_tx_index;
|
||||
int nb_tx_queues;
|
||||
|
||||
/**
|
||||
* Queue family index for compute operations and the number of queues
|
||||
* enabled. Required.
|
||||
*/
|
||||
int queue_family_comp_index;
|
||||
int nb_comp_queues;
|
||||
|
||||
/**
|
||||
* Queue family index for video encode ops, and the amount of queues enabled.
|
||||
* If the device doesn't support such, queue_family_encode_index will be -1.
|
||||
* Not required.
|
||||
*/
|
||||
int queue_family_encode_index;
|
||||
int nb_encode_queues;
|
||||
|
||||
/**
|
||||
* Queue family index for video decode ops, and the amount of queues enabled.
|
||||
* If the device doesn't support such, queue_family_decode_index will be -1.
|
||||
* Not required.
|
||||
*/
|
||||
int queue_family_decode_index;
|
||||
int nb_decode_queues;
|
||||
} AVVulkanDeviceContext;
|
||||
|
||||
/**
|
||||
* Defines the behaviour of frame allocation.
|
||||
*/
|
||||
typedef enum AVVkFrameFlags {
|
||||
/* Unless this flag is set, autodetected flags will be OR'd based on the
|
||||
* device and tiling during av_hwframe_ctx_init(). */
|
||||
AV_VK_FRAME_FLAG_NONE = (1ULL << 0),
|
||||
|
||||
/* Image planes will be allocated in a single VkDeviceMemory, rather
|
||||
* than as per-plane VkDeviceMemory allocations. Required for exporting
|
||||
* to VAAPI on Intel devices. */
|
||||
AV_VK_FRAME_FLAG_CONTIGUOUS_MEMORY = (1ULL << 1),
|
||||
} AVVkFrameFlags;
|
||||
|
||||
/**
|
||||
* Allocated as AVHWFramesContext.hwctx, used to set pool-specific options
|
||||
*/
|
||||
typedef struct AVVulkanFramesContext {
|
||||
/**
|
||||
* Controls the tiling of allocated frames. If left as optimal tiling,
|
||||
* then during av_hwframe_ctx_init() will decide based on whether the device
|
||||
* supports DRM modifiers, or if the linear_images flag is set, otherwise
|
||||
* will allocate optimally-tiled images.
|
||||
*/
|
||||
VkImageTiling tiling;
|
||||
|
||||
/**
|
||||
* Defines extra usage of output frames. If left as 0, the following bits
|
||||
* are set: TRANSFER_SRC, TRANSFER_DST. SAMPLED and STORAGE.
|
||||
*/
|
||||
VkImageUsageFlagBits usage;
|
||||
|
||||
/**
|
||||
* Extension data for image creation.
|
||||
* If VkImageDrmFormatModifierListCreateInfoEXT is present in the chain,
|
||||
* and the device supports DRM modifiers, then images will be allocated
|
||||
* with the specific requested DRM modifiers.
|
||||
* Additional structures may be added at av_hwframe_ctx_init() time,
|
||||
* which will be freed automatically on uninit(), so users need only free
|
||||
* any structures they've allocated themselves.
|
||||
*/
|
||||
void *create_pnext;
|
||||
|
||||
/**
|
||||
* Extension data for memory allocation. Must have as many entries as
|
||||
* the number of planes of the sw_format.
|
||||
* This will be chained to VkExportMemoryAllocateInfo, which is used
|
||||
* to make all pool images exportable to other APIs if the necessary
|
||||
* extensions are present in enabled_dev_extensions.
|
||||
*/
|
||||
void *alloc_pnext[AV_NUM_DATA_POINTERS];
|
||||
|
||||
/**
|
||||
* A combination of AVVkFrameFlags. Unless AV_VK_FRAME_FLAG_NONE is set,
|
||||
* autodetected flags will be OR'd based on the device and tiling during
|
||||
* av_hwframe_ctx_init().
|
||||
*/
|
||||
AVVkFrameFlags flags;
|
||||
} AVVulkanFramesContext;
|
||||
|
||||
/*
|
||||
* Frame structure, the VkFormat of the image will always match
|
||||
* the pool's sw_format.
|
||||
* All frames, imported or allocated, will be created with the
|
||||
* VK_IMAGE_CREATE_ALIAS_BIT flag set, so the memory may be aliased if needed.
|
||||
*
|
||||
* If all queue family indices in the device context are the same,
|
||||
* images will be created with the EXCLUSIVE sharing mode. Otherwise, all images
|
||||
* will be created using the CONCURRENT sharing mode.
|
||||
*
|
||||
* @note the size of this structure is not part of the ABI, to allocate
|
||||
* you must use @av_vk_frame_alloc().
|
||||
*/
|
||||
typedef struct AVVkFrame {
|
||||
/**
|
||||
* Vulkan images to which the memory is bound to.
|
||||
*/
|
||||
VkImage img[AV_NUM_DATA_POINTERS];
|
||||
|
||||
/**
|
||||
* The same tiling must be used for all images in the frame.
|
||||
*/
|
||||
VkImageTiling tiling;
|
||||
|
||||
/**
|
||||
* Memory backing the images. Could be less than the amount of planes,
|
||||
* in which case the offset value will indicate the binding offset of
|
||||
* each plane in the memory.
|
||||
*/
|
||||
VkDeviceMemory mem[AV_NUM_DATA_POINTERS];
|
||||
size_t size[AV_NUM_DATA_POINTERS];
|
||||
|
||||
/**
|
||||
* OR'd flags for all memory allocated
|
||||
*/
|
||||
VkMemoryPropertyFlagBits flags;
|
||||
|
||||
/**
|
||||
* Updated after every barrier
|
||||
*/
|
||||
VkAccessFlagBits access[AV_NUM_DATA_POINTERS];
|
||||
VkImageLayout layout[AV_NUM_DATA_POINTERS];
|
||||
|
||||
/**
|
||||
* Synchronization timeline semaphores, one for each sw_format plane.
|
||||
* Must not be freed manually. Must be waited on at every submission using
|
||||
* the value in sem_value, and must be signalled at every submission,
|
||||
* using an incremented value.
|
||||
*/
|
||||
VkSemaphore sem[AV_NUM_DATA_POINTERS];
|
||||
|
||||
/**
|
||||
* Up to date semaphore value at which each image becomes accessible.
|
||||
* Clients must wait on this value when submitting a command queue,
|
||||
* and increment it when signalling.
|
||||
*/
|
||||
uint64_t sem_value[AV_NUM_DATA_POINTERS];
|
||||
|
||||
/**
|
||||
* Internal data.
|
||||
*/
|
||||
struct AVVkFrameInternal *internal;
|
||||
|
||||
/**
|
||||
* Describes the binding offset of each plane to the VkDeviceMemory.
|
||||
*/
|
||||
ptrdiff_t offset[AV_NUM_DATA_POINTERS];
|
||||
} AVVkFrame;
|
||||
|
||||
/**
|
||||
* Allocates a single AVVkFrame and initializes everything as 0.
|
||||
* @note Must be freed via av_free()
|
||||
*/
|
||||
AVVkFrame *av_vk_frame_alloc(void);
|
||||
|
||||
/**
|
||||
* Returns the format of each image up to the number of planes for a given sw_format.
|
||||
* Returns NULL on unsupported formats.
|
||||
*/
|
||||
const VkFormat *av_vkfmt_from_pixfmt(enum AVPixelFormat p);
|
||||
|
||||
#endif /* AVUTIL_HWCONTEXT_VULKAN_H */
|
@ -27,8 +27,10 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "avutil.h"
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include "pixdesc.h"
|
||||
#include "pixfmt.h"
|
||||
#include "rational.h"
|
||||
|
||||
/**
|
||||
@ -67,6 +69,20 @@ int av_image_get_linesize(enum AVPixelFormat pix_fmt, int width, int plane);
|
||||
*/
|
||||
int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width);
|
||||
|
||||
/**
|
||||
* Fill plane sizes for an image with pixel format pix_fmt and height height.
|
||||
*
|
||||
* @param size the array to be filled with the size of each image plane
|
||||
* @param linesizes the array containing the linesize for each
|
||||
* plane, should be filled by av_image_fill_linesizes()
|
||||
* @return >= 0 in case of success, a negative error code otherwise
|
||||
*
|
||||
* @note The linesize parameters have the type ptrdiff_t here, while they are
|
||||
* int for av_image_fill_linesizes().
|
||||
*/
|
||||
int av_image_fill_plane_sizes(size_t size[4], enum AVPixelFormat pix_fmt,
|
||||
int height, const ptrdiff_t linesizes[4]);
|
||||
|
||||
/**
|
||||
* Fill plane data pointers for an image with pixel format pix_fmt and
|
||||
* height height.
|
||||
@ -110,6 +126,24 @@ void av_image_copy_plane(uint8_t *dst, int dst_linesize,
|
||||
const uint8_t *src, int src_linesize,
|
||||
int bytewidth, int height);
|
||||
|
||||
/**
|
||||
* Copy image data located in uncacheable (e.g. GPU mapped) memory. Where
|
||||
* available, this function will use special functionality for reading from such
|
||||
* memory, which may result in greatly improved performance compared to plain
|
||||
* av_image_copy_plane().
|
||||
*
|
||||
* bytewidth must be contained by both absolute values of dst_linesize
|
||||
* and src_linesize, otherwise the function behavior is undefined.
|
||||
*
|
||||
* @note The linesize parameters have the type ptrdiff_t here, while they are
|
||||
* int for av_image_copy_plane().
|
||||
* @note On x86, the linesizes currently need to be aligned to the cacheline
|
||||
* size (i.e. 64) to get improved performance.
|
||||
*/
|
||||
void av_image_copy_plane_uc_from(uint8_t *dst, ptrdiff_t dst_linesize,
|
||||
const uint8_t *src, ptrdiff_t src_linesize,
|
||||
ptrdiff_t bytewidth, int height);
|
||||
|
||||
/**
|
||||
* Copy image in src_data to dst_data.
|
||||
*
|
||||
|
@ -542,6 +542,21 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
|
||||
# define AV_WN64A(p, v) AV_WNA(64, p, v)
|
||||
#endif
|
||||
|
||||
#if AV_HAVE_BIGENDIAN
|
||||
# define AV_RLA(s, p) av_bswap##s(AV_RN##s##A(p))
|
||||
# define AV_WLA(s, p, v) AV_WN##s##A(p, av_bswap##s(v))
|
||||
#else
|
||||
# define AV_RLA(s, p) AV_RN##s##A(p)
|
||||
# define AV_WLA(s, p, v) AV_WN##s##A(p, v)
|
||||
#endif
|
||||
|
||||
#ifndef AV_RL64A
|
||||
# define AV_RL64A(p) AV_RLA(64, p)
|
||||
#endif
|
||||
#ifndef AV_WL64A
|
||||
# define AV_WL64A(p, v) AV_WLA(64, p, v)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The AV_COPYxxU macros are suitable for copying data to/from unaligned
|
||||
* memory locations.
|
||||
|
@ -24,6 +24,12 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* Context structure for the Lagged Fibonacci PRNG.
|
||||
* The exact layout, types and content of this struct may change and should
|
||||
* not be accessed directly. Only its sizeof() is guranteed to stay the same
|
||||
* to allow easy instanciation.
|
||||
*/
|
||||
typedef struct AVLFG {
|
||||
unsigned int state[64];
|
||||
int index;
|
||||
@ -45,8 +51,9 @@ int av_lfg_init_from_data(AVLFG *c, const uint8_t *data, unsigned int length);
|
||||
* it may be good enough and faster for your specific use case.
|
||||
*/
|
||||
static inline unsigned int av_lfg_get(AVLFG *c){
|
||||
c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63];
|
||||
return c->state[c->index++ & 63];
|
||||
unsigned a = c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63];
|
||||
c->index += 1U;
|
||||
return a;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -57,7 +64,9 @@ static inline unsigned int av_lfg_get(AVLFG *c){
|
||||
static inline unsigned int av_mlfg_get(AVLFG *c){
|
||||
unsigned int a= c->state[(c->index-55) & 63];
|
||||
unsigned int b= c->state[(c->index-24) & 63];
|
||||
return c->state[c->index++ & 63] = 2*a*b+a+b;
|
||||
a = c->state[c->index & 63] = 2*a*b+a+b;
|
||||
c->index += 1U;
|
||||
return a;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -22,7 +22,6 @@
|
||||
#define AVUTIL_LOG_H
|
||||
|
||||
#include <stdarg.h>
|
||||
#include "avutil.h"
|
||||
#include "attributes.h"
|
||||
#include "version.h"
|
||||
|
||||
@ -107,21 +106,6 @@ typedef struct AVClass {
|
||||
*/
|
||||
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.
|
||||
@ -140,6 +124,26 @@ typedef struct AVClass {
|
||||
* available since version (52.12)
|
||||
*/
|
||||
int (*query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags);
|
||||
|
||||
/**
|
||||
* Return next AVOptions-enabled child or NULL
|
||||
*/
|
||||
void* (*child_next)(void *obj, void *prev);
|
||||
|
||||
/**
|
||||
* Iterate over the AVClasses corresponding to potential AVOptions-enabled
|
||||
* children.
|
||||
*
|
||||
* @param iter pointer to opaque iteration state. The caller must initialize
|
||||
* *iter to NULL before the first call.
|
||||
* @return AVClass for the next AVOptions-enabled child or NULL if there are
|
||||
* no more such children.
|
||||
*
|
||||
* @note The difference between child_next and this is that child_next
|
||||
* iterates over _already existing_ objects, while child_class_iterate
|
||||
* iterates over _all possible_ children.
|
||||
*/
|
||||
const struct AVClass* (*child_class_iterate)(void **iter);
|
||||
} AVClass;
|
||||
|
||||
/**
|
||||
@ -233,6 +237,27 @@ typedef struct AVClass {
|
||||
*/
|
||||
void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4);
|
||||
|
||||
/**
|
||||
* Send the specified message to the log once with the initial_level and then with
|
||||
* the subsequent_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
|
||||
*
|
||||
* @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 initial_level importance level of the message expressed using a @ref
|
||||
* lavu_log_constants "Logging Constant" for the first occurance.
|
||||
* @param subsequent_level importance level of the message expressed using a @ref
|
||||
* lavu_log_constants "Logging Constant" after the first occurance.
|
||||
* @param fmt The format string (printf-compatible) that specifies how
|
||||
* subsequent arguments are converted to output.
|
||||
* @param state a variable to keep trak of if a message has already been printed
|
||||
* this must be initialized to 0 before the first use. The same state
|
||||
* must not be accessed by 2 Threads simultaneously.
|
||||
*/
|
||||
void av_log_once(void* avcl, int initial_level, int subsequent_level, int *state, const char *fmt, ...) av_printf_format(5, 6);
|
||||
|
||||
|
||||
/**
|
||||
* Send the specified message to the log if the level is less than or equal
|
||||
|
66
ext_includes/ffmpeg/libavutil/lzo.h
Normal file
66
ext_includes/ffmpeg/libavutil/lzo.h
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* LZO 1x decompression
|
||||
* copyright (c) 2006 Reimar Doeffinger
|
||||
*
|
||||
* 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_LZO_H
|
||||
#define AVUTIL_LZO_H
|
||||
|
||||
/**
|
||||
* @defgroup lavu_lzo LZO
|
||||
* @ingroup lavu_crypto
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/** @name Error flags returned by av_lzo1x_decode
|
||||
* @{ */
|
||||
/// end of the input buffer reached before decoding finished
|
||||
#define AV_LZO_INPUT_DEPLETED 1
|
||||
/// decoded data did not fit into output buffer
|
||||
#define AV_LZO_OUTPUT_FULL 2
|
||||
/// a reference to previously decoded data was wrong
|
||||
#define AV_LZO_INVALID_BACKPTR 4
|
||||
/// a non-specific error in the compressed bitstream
|
||||
#define AV_LZO_ERROR 8
|
||||
/** @} */
|
||||
|
||||
#define AV_LZO_INPUT_PADDING 8
|
||||
#define AV_LZO_OUTPUT_PADDING 12
|
||||
|
||||
/**
|
||||
* @brief Decodes LZO 1x compressed data.
|
||||
* @param out output buffer
|
||||
* @param outlen size of output buffer, number of bytes left are returned here
|
||||
* @param in input buffer
|
||||
* @param inlen size of input buffer, number of bytes left are returned here
|
||||
* @return 0 on success, otherwise a combination of the error flags above
|
||||
*
|
||||
* Make sure all buffers are appropriately padded, in must provide
|
||||
* AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes.
|
||||
*/
|
||||
int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* AVUTIL_LZO_H */
|
@ -25,6 +25,36 @@
|
||||
#ifndef AVUTIL_MACROS_H
|
||||
#define AVUTIL_MACROS_H
|
||||
|
||||
#include "libavutil/avconfig.h"
|
||||
|
||||
#if AV_HAVE_BIGENDIAN
|
||||
# define AV_NE(be, le) (be)
|
||||
#else
|
||||
# define AV_NE(be, le) (le)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* 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]))
|
||||
|
||||
#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))
|
||||
|
||||
/**
|
||||
* @addtogroup preproc_misc Preprocessor String Macros
|
||||
*
|
||||
|
@ -134,6 +134,7 @@ int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const;
|
||||
*
|
||||
* The operation is mathematically equivalent to `a * b / c`, but writing that
|
||||
* directly can overflow, and does not support different rounding methods.
|
||||
* If the result is not representable then INT64_MIN is returned.
|
||||
*
|
||||
* @see av_rescale(), av_rescale_q(), av_rescale_q_rnd()
|
||||
*/
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "attributes.h"
|
||||
#include "version.h"
|
||||
|
||||
/**
|
||||
* @defgroup lavu_md5 MD5
|
||||
@ -64,11 +63,7 @@ void av_md5_init(struct AVMD5 *ctx);
|
||||
* @param src input data to update hash with
|
||||
* @param len input data length
|
||||
*/
|
||||
#if FF_API_CRYPTO_SIZE_T
|
||||
void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, int len);
|
||||
#else
|
||||
void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, size_t len);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Finish hashing and output digest value.
|
||||
@ -85,11 +80,7 @@ void av_md5_final(struct AVMD5 *ctx, uint8_t *dst);
|
||||
* @param src The data to hash
|
||||
* @param len The length of the data, in bytes
|
||||
*/
|
||||
#if FF_API_CRYPTO_SIZE_T
|
||||
void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len);
|
||||
#else
|
||||
void av_md5_sum(uint8_t *dst, const uint8_t *src, size_t len);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -31,8 +31,8 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "attributes.h"
|
||||
#include "error.h"
|
||||
#include "avutil.h"
|
||||
#include "version.h"
|
||||
|
||||
/**
|
||||
* @addtogroup lavu_mem
|
||||
@ -49,6 +49,10 @@
|
||||
* dealing with memory consistently possible on all platforms.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if FF_API_DECLARE_ALIGNED
|
||||
/**
|
||||
*
|
||||
* @defgroup lavu_mem_macros Alignment Macros
|
||||
* Helper macros for declaring aligned variables.
|
||||
@ -125,6 +129,7 @@
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup lavu_mem_attrs Function Attributes
|
||||
@ -232,20 +237,20 @@ av_alloc_size(1, 2) void *av_malloc_array(size_t nmemb, size_t size);
|
||||
* @see av_mallocz()
|
||||
* @see av_malloc_array()
|
||||
*/
|
||||
av_alloc_size(1, 2) void *av_mallocz_array(size_t nmemb, size_t size);
|
||||
void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib av_alloc_size(1, 2);
|
||||
|
||||
#if FF_API_AV_MALLOCZ_ARRAY
|
||||
/**
|
||||
* Non-inlined equivalent of av_mallocz_array().
|
||||
*
|
||||
* Created for symmetry with the calloc() C function.
|
||||
* @deprecated use av_calloc()
|
||||
*/
|
||||
void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib;
|
||||
attribute_deprecated
|
||||
void *av_mallocz_array(size_t nmemb, size_t size) av_malloc_attrib av_alloc_size(1, 2);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Allocate, reallocate, or free 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`. Otherwise, expand or
|
||||
* If `ptr` is `NULL` and `size` > 0, allocate a new block. Otherwise, expand or
|
||||
* shrink that block of memory according to `size`.
|
||||
*
|
||||
* @param ptr Pointer to a memory block already allocated with
|
||||
@ -254,10 +259,11 @@ void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib;
|
||||
* 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
|
||||
* cannot be reallocated
|
||||
*
|
||||
* @warning Unlike av_malloc(), the returned pointer is not guaranteed to be
|
||||
* correctly aligned.
|
||||
* correctly aligned. The returned pointer must be freed after even
|
||||
* if size is zero.
|
||||
* @see av_fast_realloc()
|
||||
* @see av_reallocp()
|
||||
*/
|
||||
@ -305,8 +311,7 @@ void *av_realloc_f(void *ptr, size_t nelem, size_t elsize);
|
||||
/**
|
||||
* Allocate, reallocate, or free 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`.
|
||||
* If `ptr` is `NULL` and `nmemb` > 0, allocate a new block.
|
||||
*
|
||||
* @param ptr Pointer to a memory block already allocated with
|
||||
* av_realloc() or `NULL`
|
||||
@ -314,19 +319,19 @@ void *av_realloc_f(void *ptr, size_t nelem, size_t elsize);
|
||||
* @param size Size of the single element of the array
|
||||
*
|
||||
* @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
|
||||
* cannot be reallocated
|
||||
*
|
||||
* @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
|
||||
* correctly aligned.
|
||||
* correctly aligned. The returned pointer must be freed after even if
|
||||
* nmemb is zero.
|
||||
* @see av_reallocp_array()
|
||||
*/
|
||||
av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size);
|
||||
|
||||
/**
|
||||
* Allocate, reallocate, or free an array through a pointer to a pointer.
|
||||
* Allocate, 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`.
|
||||
* If `*ptr` is `NULL` and `nmemb` > 0, allocate a new block.
|
||||
*
|
||||
* @param[in,out] ptr Pointer to a pointer to a memory block already
|
||||
* allocated with av_realloc(), or a pointer to `NULL`.
|
||||
@ -337,7 +342,7 @@ av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size)
|
||||
* @return Zero on success, an AVERROR error code on failure
|
||||
*
|
||||
* @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
|
||||
* correctly aligned.
|
||||
* correctly aligned. *ptr must be freed after even if nmemb is zero.
|
||||
*/
|
||||
int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
|
||||
|
||||
@ -666,16 +671,7 @@ void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size,
|
||||
* @param[out] r Pointer to the result of the operation
|
||||
* @return 0 on success, AVERROR(EINVAL) on 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: don't try the division if nelem and elsize
|
||||
* are both less 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;
|
||||
}
|
||||
int av_size_mult(size_t a, size_t b, size_t *r);
|
||||
|
||||
/**
|
||||
* Set the maximum size that may be allocated in one block.
|
||||
|
@ -27,10 +27,9 @@
|
||||
#ifndef AVUTIL_MURMUR3_H
|
||||
#define AVUTIL_MURMUR3_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "version.h"
|
||||
|
||||
/**
|
||||
* @defgroup lavu_murmur3 Murmur3
|
||||
* @ingroup lavu_hash
|
||||
@ -99,11 +98,7 @@ void av_murmur3_init(struct AVMurMur3 *c);
|
||||
* @param[in] src Input data to update hash with
|
||||
* @param[in] len Number of bytes to read from `src`
|
||||
*/
|
||||
#if FF_API_CRYPTO_SIZE_T
|
||||
void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, int len);
|
||||
#else
|
||||
void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, size_t len);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Finish hashing and output digest value.
|
||||
|
@ -29,11 +29,11 @@
|
||||
|
||||
#include "rational.h"
|
||||
#include "avutil.h"
|
||||
#include "channel_layout.h"
|
||||
#include "dict.h"
|
||||
#include "log.h"
|
||||
#include "pixfmt.h"
|
||||
#include "samplefmt.h"
|
||||
#include "version.h"
|
||||
|
||||
/**
|
||||
* @defgroup avoptions AVOptions
|
||||
@ -114,7 +114,7 @@
|
||||
* libavcodec exports generic options, while its priv_data field exports
|
||||
* codec-specific options). In such a case, it is possible to set up the
|
||||
* parent struct to export a child's options. To do that, simply
|
||||
* implement AVClass.child_next() and AVClass.child_class_next() in the
|
||||
* implement AVClass.child_next() and AVClass.child_class_iterate() in the
|
||||
* parent struct's AVClass.
|
||||
* Assuming that the test_struct from above now also contains a
|
||||
* child_struct field:
|
||||
@ -143,23 +143,25 @@
|
||||
* return t->child_struct;
|
||||
* return NULL
|
||||
* }
|
||||
* const AVClass child_class_next(const AVClass *prev)
|
||||
* const AVClass child_class_iterate(void **iter)
|
||||
* {
|
||||
* return prev ? NULL : &child_class;
|
||||
* const AVClass *c = *iter ? NULL : &child_class;
|
||||
* *iter = (void*)(uintptr_t)c;
|
||||
* return c;
|
||||
* }
|
||||
* @endcode
|
||||
* Putting child_next() and child_class_next() as defined above into
|
||||
* Putting child_next() and child_class_iterate() as defined above into
|
||||
* test_class will now make child_struct's options accessible through
|
||||
* test_struct (again, proper setup as described above needs to be done on
|
||||
* child_struct right after it is created).
|
||||
*
|
||||
* From the above example it might not be clear why both child_next()
|
||||
* and child_class_next() are needed. The distinction is that child_next()
|
||||
* iterates over actually existing objects, while child_class_next()
|
||||
* and child_class_iterate() are needed. The distinction is that child_next()
|
||||
* iterates over actually existing objects, while child_class_iterate()
|
||||
* iterates over all possible child classes. E.g. if an AVCodecContext
|
||||
* was initialized to use a codec which has private options, then its
|
||||
* child_next() will return AVCodecContext.priv_data and finish
|
||||
* iterating. OTOH child_class_next() on AVCodecContext.av_class will
|
||||
* iterating. OTOH child_class_iterate() on AVCodecContext.av_class will
|
||||
* iterate over all available codecs with private options.
|
||||
*
|
||||
* @subsection avoptions_implement_named_constants Named constants
|
||||
@ -194,7 +196,7 @@
|
||||
* For enumerating there are basically two cases. The first is when you want to
|
||||
* get all options that may potentially exist on the struct and its children
|
||||
* (e.g. when constructing documentation). In that case you should call
|
||||
* av_opt_child_class_next() recursively on the parent struct's AVClass. The
|
||||
* av_opt_child_class_iterate() recursively on the parent struct's AVClass. The
|
||||
* second case is when you have an already initialized struct with all its
|
||||
* children and you want to get all options that can be actually written or read
|
||||
* from it. In that case you should call av_opt_child_next() recursively (and
|
||||
@ -236,8 +238,11 @@ enum AVOptionType{
|
||||
AV_OPT_TYPE_VIDEO_RATE, ///< offset must point to AVRational
|
||||
AV_OPT_TYPE_DURATION,
|
||||
AV_OPT_TYPE_COLOR,
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
AV_OPT_TYPE_CHANNEL_LAYOUT,
|
||||
#endif
|
||||
AV_OPT_TYPE_BOOL,
|
||||
AV_OPT_TYPE_CHLAYOUT,
|
||||
};
|
||||
|
||||
/**
|
||||
@ -288,8 +293,10 @@ typedef struct AVOption {
|
||||
*/
|
||||
#define AV_OPT_FLAG_READONLY 128
|
||||
#define AV_OPT_FLAG_BSF_PARAM (1<<8) ///< a generic parameter which can be set by the user for bit stream filtering
|
||||
#define AV_OPT_FLAG_RUNTIME_PARAM (1<<15) ///< a generic parameter which can be set by the user at runtime
|
||||
#define AV_OPT_FLAG_FILTERING_PARAM (1<<16) ///< a generic parameter which can be set by the user for filtering
|
||||
#define AV_OPT_FLAG_DEPRECATED (1<<17) ///< set if option is deprecated, users should refer to AVOption.help text for more information
|
||||
#define AV_OPT_FLAG_CHILD_CONSTS (1<<18) ///< set if option constants can also reside in child objects
|
||||
//FIXME think about enc-audio, ... style flags
|
||||
|
||||
/**
|
||||
@ -647,10 +654,10 @@ void *av_opt_child_next(void *obj, void *prev);
|
||||
/**
|
||||
* Iterate over potential AVOptions-enabled children of parent.
|
||||
*
|
||||
* @param prev result of a previous call to this function or NULL
|
||||
* @param iter a pointer where iteration state is stored.
|
||||
* @return AVClass corresponding to next potential child or NULL
|
||||
*/
|
||||
const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev);
|
||||
const AVClass *av_opt_child_class_iterate(const AVClass *parent, void **iter);
|
||||
|
||||
/**
|
||||
* @defgroup opt_set_funcs Option setting functions
|
||||
@ -669,6 +676,9 @@ const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *pre
|
||||
* scalars or named flags separated by '+' or '-'. Prefixing a flag
|
||||
* with '+' causes it to be set without affecting the other flags;
|
||||
* similarly, '-' unsets a flag.
|
||||
* If the field is of a dictionary type, it has to be a ':' separated list of
|
||||
* key=value parameters. Values containing ':' special characters must be
|
||||
* escaped.
|
||||
* @param search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN
|
||||
* is passed here, then the option may be set on a child of obj.
|
||||
*
|
||||
@ -687,7 +697,11 @@ int av_opt_set_image_size(void *obj, const char *name, int w, int h, int search_
|
||||
int av_opt_set_pixel_fmt (void *obj, const char *name, enum AVPixelFormat fmt, int search_flags);
|
||||
int av_opt_set_sample_fmt(void *obj, const char *name, enum AVSampleFormat fmt, int search_flags);
|
||||
int av_opt_set_video_rate(void *obj, const char *name, AVRational val, int search_flags);
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
attribute_deprecated
|
||||
int av_opt_set_channel_layout(void *obj, const char *name, int64_t ch_layout, int search_flags);
|
||||
#endif
|
||||
int av_opt_set_chlayout(void *obj, const char *name, const AVChannelLayout *layout, int search_flags);
|
||||
/**
|
||||
* @note Any old dictionary present is discarded and replaced with a copy of the new one. The
|
||||
* caller still owns val is and responsible for freeing it.
|
||||
@ -729,9 +743,10 @@ int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, in
|
||||
/**
|
||||
* @note the returned string will be av_malloc()ed and must be av_free()ed by the caller
|
||||
*
|
||||
* @note if AV_OPT_ALLOW_NULL is set in search_flags in av_opt_get, and the option has
|
||||
* AV_OPT_TYPE_STRING or AV_OPT_TYPE_BINARY and is set to NULL, *out_val will be set
|
||||
* to NULL instead of an allocated empty string.
|
||||
* @note if AV_OPT_ALLOW_NULL is set in search_flags in av_opt_get, and the
|
||||
* option is of type AV_OPT_TYPE_STRING, AV_OPT_TYPE_BINARY or AV_OPT_TYPE_DICT
|
||||
* and is set to NULL, *out_val will be set to NULL instead of an allocated
|
||||
* empty string.
|
||||
*/
|
||||
int av_opt_get (void *obj, const char *name, int search_flags, uint8_t **out_val);
|
||||
int av_opt_get_int (void *obj, const char *name, int search_flags, int64_t *out_val);
|
||||
@ -741,7 +756,11 @@ int av_opt_get_image_size(void *obj, const char *name, int search_flags, int *w_
|
||||
int av_opt_get_pixel_fmt (void *obj, const char *name, int search_flags, enum AVPixelFormat *out_fmt);
|
||||
int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AVSampleFormat *out_fmt);
|
||||
int av_opt_get_video_rate(void *obj, const char *name, int search_flags, AVRational *out_val);
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
attribute_deprecated
|
||||
int av_opt_get_channel_layout(void *obj, const char *name, int search_flags, int64_t *ch_layout);
|
||||
#endif
|
||||
int av_opt_get_chlayout(void *obj, const char *name, int search_flags, AVChannelLayout *layout);
|
||||
/**
|
||||
* @param[out] out_val The returned dictionary is a copy of the actual value and must
|
||||
* be freed with av_dict_free() by the caller
|
||||
@ -783,9 +802,16 @@ int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags
|
||||
/**
|
||||
* Copy options from src object into dest object.
|
||||
*
|
||||
* The underlying AVClass of both src and dest must coincide. The guarantee
|
||||
* below does not apply if this is not fulfilled.
|
||||
*
|
||||
* Options that require memory allocation (e.g. string or binary) are malloc'ed in dest object.
|
||||
* Original memory allocated for such options is freed unless both src and dest options points to the same memory.
|
||||
*
|
||||
* Even on error it is guaranteed that allocated options from src and dest
|
||||
* no longer alias each other afterwards; in particular calling av_opt_free()
|
||||
* on both src and dest is safe afterwards if dest has been memdup'ed from src.
|
||||
*
|
||||
* @param dest Object to copy from
|
||||
* @param src Object to copy into
|
||||
* @return 0 on success, negative on error
|
||||
|
@ -22,15 +22,10 @@
|
||||
#ifndef AVUTIL_PIXDESC_H
|
||||
#define AVUTIL_PIXDESC_H
|
||||
|
||||
/* modification for MSVC by kode54 */
|
||||
#ifndef _MSC_VER
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
/* end modification */
|
||||
|
||||
#include "attributes.h"
|
||||
#include "pixfmt.h"
|
||||
#include "version.h"
|
||||
|
||||
typedef struct AVComponentDescriptor {
|
||||
/**
|
||||
@ -60,17 +55,6 @@ typedef struct AVComponentDescriptor {
|
||||
* Number of bits in the component.
|
||||
*/
|
||||
int depth;
|
||||
|
||||
#if FF_API_PLUS1_MINUS1
|
||||
/** deprecated, use step instead */
|
||||
attribute_deprecated int step_minus1;
|
||||
|
||||
/** deprecated, use depth instead */
|
||||
attribute_deprecated int depth_minus1;
|
||||
|
||||
/** deprecated, use offset instead */
|
||||
attribute_deprecated int offset_plus1;
|
||||
#endif
|
||||
} AVComponentDescriptor;
|
||||
|
||||
/**
|
||||
@ -151,24 +135,6 @@ typedef struct AVPixFmtDescriptor {
|
||||
*/
|
||||
#define AV_PIX_FMT_FLAG_RGB (1 << 5)
|
||||
|
||||
/**
|
||||
* The pixel format is "pseudo-paletted". This means that it contains a
|
||||
* fixed palette in the 2nd plane but the palette is fixed/constant for each
|
||||
* PIX_FMT. This allows interpreting the data as if it was PAL8, which can
|
||||
* in some cases be simpler. Or the data can be interpreted purely based on
|
||||
* the pixel format without using the palette.
|
||||
* An example of a pseudo-paletted format is AV_PIX_FMT_GRAY8
|
||||
*
|
||||
* @deprecated This flag is deprecated, and will be removed. When it is removed,
|
||||
* the extra palette allocation in AVFrame.data[1] is removed as well. Only
|
||||
* actual paletted formats (as indicated by AV_PIX_FMT_FLAG_PAL) will have a
|
||||
* palette. Starting with FFmpeg versions which have this flag deprecated, the
|
||||
* extra "pseudo" palette is already ignored, and API users are not required to
|
||||
* allocate a palette for AV_PIX_FMT_FLAG_PSEUDOPAL formats (it was required
|
||||
* before the deprecation, though).
|
||||
*/
|
||||
#define AV_PIX_FMT_FLAG_PSEUDOPAL (1 << 6)
|
||||
|
||||
/**
|
||||
* The pixel format has an alpha channel. This is set on all formats that
|
||||
* support alpha in some way, including AV_PIX_FMT_PAL8. The alpha is always
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include "common.h"
|
||||
|
||||
/**
|
||||
* Sum of abs(src1[x] - src2[x])
|
||||
|
@ -112,21 +112,11 @@ enum AVPixelFormat {
|
||||
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 VASurfaceID
|
||||
/**@}*/
|
||||
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
|
||||
@ -257,20 +247,22 @@ enum AVPixelFormat {
|
||||
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 */
|
||||
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
|
||||
|
||||
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
|
||||
@ -345,6 +337,36 @@ enum AVPixelFormat {
|
||||
AV_PIX_FMT_YUVA444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, big-endian
|
||||
AV_PIX_FMT_YUVA444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, little-endian
|
||||
|
||||
AV_PIX_FMT_NV24, ///< planar YUV 4:4:4, 24bpp, 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_NV42, ///< as above, but U and V bytes are swapped
|
||||
|
||||
/**
|
||||
* Vulkan hardware images.
|
||||
*
|
||||
* data[0] points to an AVVkFrame
|
||||
*/
|
||||
AV_PIX_FMT_VULKAN,
|
||||
|
||||
AV_PIX_FMT_Y210BE, ///< packed YUV 4:2:2 like YUYV422, 20bpp, data in the high bits, big-endian
|
||||
AV_PIX_FMT_Y210LE, ///< packed YUV 4:2:2 like YUYV422, 20bpp, data in the high bits, little-endian
|
||||
|
||||
AV_PIX_FMT_X2RGB10LE, ///< packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), little-endian, X=unused/undefined
|
||||
AV_PIX_FMT_X2RGB10BE, ///< packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), big-endian, X=unused/undefined
|
||||
AV_PIX_FMT_X2BGR10LE, ///< packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 10R(lsb), little-endian, X=unused/undefined
|
||||
AV_PIX_FMT_X2BGR10BE, ///< packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 10R(lsb), big-endian, X=unused/undefined
|
||||
|
||||
AV_PIX_FMT_P210BE, ///< interleaved chroma YUV 4:2:2, 20bpp, data in the high bits, big-endian
|
||||
AV_PIX_FMT_P210LE, ///< interleaved chroma YUV 4:2:2, 20bpp, data in the high bits, little-endian
|
||||
|
||||
AV_PIX_FMT_P410BE, ///< interleaved chroma YUV 4:4:4, 30bpp, data in the high bits, big-endian
|
||||
AV_PIX_FMT_P410LE, ///< interleaved chroma YUV 4:4:4, 30bpp, data in the high bits, little-endian
|
||||
|
||||
AV_PIX_FMT_P216BE, ///< interleaved chroma YUV 4:2:2, 32bpp, big-endian
|
||||
AV_PIX_FMT_P216LE, ///< interleaved chroma YUV 4:2:2, 32bpp, little-endian
|
||||
|
||||
AV_PIX_FMT_P416BE, ///< interleaved chroma YUV 4:4:4, 48bpp, big-endian
|
||||
AV_PIX_FMT_P416LE, ///< interleaved chroma YUV 4:4:4, 48bpp, little-endian
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
@ -433,33 +455,43 @@ enum AVPixelFormat {
|
||||
#define AV_PIX_FMT_P010 AV_PIX_FMT_NE(P010BE, P010LE)
|
||||
#define AV_PIX_FMT_P016 AV_PIX_FMT_NE(P016BE, P016LE)
|
||||
|
||||
#define AV_PIX_FMT_Y210 AV_PIX_FMT_NE(Y210BE, Y210LE)
|
||||
#define AV_PIX_FMT_X2RGB10 AV_PIX_FMT_NE(X2RGB10BE, X2RGB10LE)
|
||||
#define AV_PIX_FMT_X2BGR10 AV_PIX_FMT_NE(X2BGR10BE, X2BGR10LE)
|
||||
|
||||
#define AV_PIX_FMT_P210 AV_PIX_FMT_NE(P210BE, P210LE)
|
||||
#define AV_PIX_FMT_P410 AV_PIX_FMT_NE(P410BE, P410LE)
|
||||
#define AV_PIX_FMT_P216 AV_PIX_FMT_NE(P216BE, P216LE)
|
||||
#define AV_PIX_FMT_P416 AV_PIX_FMT_NE(P416BE, P416LE)
|
||||
|
||||
/**
|
||||
* Chromaticity coordinates of the source primaries.
|
||||
* These values match the ones defined by ISO/IEC 23001-8_2013 § 7.1.
|
||||
* These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.1 and ITU-T H.273.
|
||||
*/
|
||||
enum AVColorPrimaries {
|
||||
AVCOL_PRI_RESERVED0 = 0,
|
||||
AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
|
||||
AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP 177 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_SMPTE240M = 7, ///< identical to above, also called "SMPTE C" even though it uses D65
|
||||
AVCOL_PRI_FILM = 8, ///< colour filters using Illuminant C
|
||||
AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020
|
||||
AVCOL_PRI_SMPTE428 = 10, ///< SMPTE ST 428-1 (CIE 1931 XYZ)
|
||||
AVCOL_PRI_SMPTEST428_1 = AVCOL_PRI_SMPTE428,
|
||||
AVCOL_PRI_SMPTE431 = 11, ///< SMPTE ST 431-2 (2011) / DCI P3
|
||||
AVCOL_PRI_SMPTE432 = 12, ///< SMPTE ST 432-1 (2010) / P3 D65 / Display P3
|
||||
AVCOL_PRI_JEDEC_P22 = 22, ///< JEDEC P22 phosphors
|
||||
AVCOL_PRI_EBU3213 = 22, ///< EBU Tech. 3213-E (nothing there) / one of JEDEC P22 group phosphors
|
||||
AVCOL_PRI_JEDEC_P22 = AVCOL_PRI_EBU3213,
|
||||
AVCOL_PRI_NB ///< Not part of ABI
|
||||
};
|
||||
|
||||
/**
|
||||
* Color Transfer Characteristic.
|
||||
* These values match the ones defined by ISO/IEC 23001-8_2013 § 7.2.
|
||||
* These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.2.
|
||||
*/
|
||||
enum AVColorTransferCharacteristic {
|
||||
AVCOL_TRC_RESERVED0 = 0,
|
||||
@ -488,18 +520,18 @@ enum AVColorTransferCharacteristic {
|
||||
|
||||
/**
|
||||
* YUV colorspace type.
|
||||
* These values match the ones defined by ISO/IEC 23001-8_2013 § 7.3.
|
||||
* These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.3.
|
||||
*/
|
||||
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_RGB = 0, ///< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB), YZX and ST 428-1
|
||||
AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / derived in SMPTE RP 177 Annex B
|
||||
AVCOL_SPC_UNSPECIFIED = 2,
|
||||
AVCOL_SPC_RESERVED = 3,
|
||||
AVCOL_SPC_RESERVED = 3, ///< reserved for future use by ITU-T and ISO/IEC just like 15-255 are
|
||||
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
|
||||
AVCOL_SPC_SMPTE240M = 7, ///< functionally identical to above
|
||||
AVCOL_SPC_YCGCO = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
|
||||
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, ///< derived from 170M primaries and D65 white point, 170M is derived from BT470 System M's primaries
|
||||
AVCOL_SPC_YCGCO = 8, ///< used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
|
||||
AVCOL_SPC_YCOCG = AVCOL_SPC_YCGCO,
|
||||
AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system
|
||||
AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system
|
||||
@ -511,12 +543,60 @@ enum AVColorSpace {
|
||||
};
|
||||
|
||||
/**
|
||||
* MPEG vs JPEG YUV range.
|
||||
* Visual content value range.
|
||||
*
|
||||
* These values are based on definitions that can be found in multiple
|
||||
* specifications, such as ITU-T BT.709 (3.4 - Quantization of RGB, luminance
|
||||
* and colour-difference signals), ITU-T BT.2020 (Table 5 - Digital
|
||||
* Representation) as well as ITU-T BT.2100 (Table 9 - Digital 10- and 12-bit
|
||||
* integer representation). At the time of writing, the BT.2100 one is
|
||||
* recommended, as it also defines the full range representation.
|
||||
*
|
||||
* Common definitions:
|
||||
* - For RGB and luma planes such as Y in YCbCr and I in ICtCp,
|
||||
* 'E' is the original value in range of 0.0 to 1.0.
|
||||
* - For chroma planes such as Cb,Cr and Ct,Cp, 'E' is the original
|
||||
* value in range of -0.5 to 0.5.
|
||||
* - 'n' is the output bit depth.
|
||||
* - For additional definitions such as rounding and clipping to valid n
|
||||
* bit unsigned integer range, please refer to BT.2100 (Table 9).
|
||||
*/
|
||||
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
|
||||
|
||||
/**
|
||||
* Narrow or limited range content.
|
||||
*
|
||||
* - For luma planes:
|
||||
*
|
||||
* (219 * E + 16) * 2^(n-8)
|
||||
*
|
||||
* F.ex. the range of 16-235 for 8 bits
|
||||
*
|
||||
* - For chroma planes:
|
||||
*
|
||||
* (224 * E + 128) * 2^(n-8)
|
||||
*
|
||||
* F.ex. the range of 16-240 for 8 bits
|
||||
*/
|
||||
AVCOL_RANGE_MPEG = 1,
|
||||
|
||||
/**
|
||||
* Full range content.
|
||||
*
|
||||
* - For RGB and luma planes:
|
||||
*
|
||||
* (2^n - 1) * E
|
||||
*
|
||||
* F.ex. the range of 0-255 for 8 bits
|
||||
*
|
||||
* - For chroma planes:
|
||||
*
|
||||
* (2^n - 1) * E + 2^(n - 1)
|
||||
*
|
||||
* F.ex. the range of 1-255 for 8 bits
|
||||
*/
|
||||
AVCOL_RANGE_JPEG = 2,
|
||||
AVCOL_RANGE_NB ///< Not part of ABI
|
||||
};
|
||||
|
||||
|
@ -207,6 +207,12 @@ int av_find_nearest_q_idx(AVRational q, const AVRational* q_list);
|
||||
*/
|
||||
uint32_t av_q2intfloat(AVRational q);
|
||||
|
||||
/**
|
||||
* Return the best rational so that a and b are multiple of it.
|
||||
* If the resulting denominator is larger than max_den, return def.
|
||||
*/
|
||||
AVRational av_gcd_q(AVRational a, AVRational b, int max_den, AVRational def);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -28,10 +28,10 @@
|
||||
#ifndef AVUTIL_RIPEMD_H
|
||||
#define AVUTIL_RIPEMD_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "attributes.h"
|
||||
#include "version.h"
|
||||
|
||||
/**
|
||||
* @defgroup lavu_ripemd RIPEMD
|
||||
@ -66,11 +66,7 @@ int av_ripemd_init(struct AVRIPEMD* context, int bits);
|
||||
* @param data input data to update hash with
|
||||
* @param len input data length
|
||||
*/
|
||||
#if FF_API_CRYPTO_SIZE_T
|
||||
void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, unsigned int len);
|
||||
#else
|
||||
void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, size_t len);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Finish hashing and output digest value.
|
||||
|
@ -21,9 +21,6 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "avutil.h"
|
||||
#include "attributes.h"
|
||||
|
||||
/**
|
||||
* @addtogroup lavu_audio
|
||||
* @{
|
||||
@ -195,9 +192,8 @@ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
|
||||
* @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
|
||||
* @return minimum size in bytes required for the buffer on success,
|
||||
* or a negative error code on failure
|
||||
*/
|
||||
int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,
|
||||
const uint8_t *buf,
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "attributes.h"
|
||||
#include "version.h"
|
||||
|
||||
/**
|
||||
* @defgroup lavu_sha SHA
|
||||
@ -74,11 +73,7 @@ int av_sha_init(struct AVSHA* context, int bits);
|
||||
* @param data input data to update hash with
|
||||
* @param len input data length
|
||||
*/
|
||||
#if FF_API_CRYPTO_SIZE_T
|
||||
void av_sha_update(struct AVSHA *ctx, const uint8_t *data, unsigned int len);
|
||||
#else
|
||||
void av_sha_update(struct AVSHA *ctx, const uint8_t *data, size_t len);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Finish hashing and output digest value.
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "attributes.h"
|
||||
#include "version.h"
|
||||
|
||||
/**
|
||||
* @defgroup lavu_sha512 SHA-512
|
||||
@ -76,11 +75,7 @@ int av_sha512_init(struct AVSHA512* context, int bits);
|
||||
* @param data input data to update hash with
|
||||
* @param len input data length
|
||||
*/
|
||||
#if FF_API_CRYPTO_SIZE_T
|
||||
void av_sha512_update(struct AVSHA512* context, const uint8_t* data, unsigned int len);
|
||||
#else
|
||||
void av_sha512_update(struct AVSHA512* context, const uint8_t* data, size_t len);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Finish hashing and output digest value.
|
||||
|
@ -49,9 +49,9 @@ typedef struct {
|
||||
* Adjust frame number for NTSC drop frame time code.
|
||||
*
|
||||
* @param framenum frame number to adjust
|
||||
* @param fps frame per second, 30 or 60
|
||||
* @param fps frame per second, multiples of 30
|
||||
* @return adjusted frame number
|
||||
* @warning adjustment is only valid in NTSC 29.97 and 59.94
|
||||
* @warning adjustment is only valid for multiples of NTSC 29.97
|
||||
*/
|
||||
int av_timecode_adjust_ntsc_framenum2(int framenum, int fps);
|
||||
|
||||
@ -62,14 +62,39 @@ int av_timecode_adjust_ntsc_framenum2(int framenum, int fps);
|
||||
* @param framenum frame number
|
||||
* @return the SMPTE binary representation
|
||||
*
|
||||
* See SMPTE ST 314M-2005 Sec 4.4.2.2.1 "Time code pack (TC)"
|
||||
* the format description as follows:
|
||||
* bits 0-5: hours, in BCD(6bits)
|
||||
* bits 6: BGF1
|
||||
* bits 7: BGF2 (NTSC) or FIELD (PAL)
|
||||
* bits 8-14: minutes, in BCD(7bits)
|
||||
* bits 15: BGF0 (NTSC) or BGF2 (PAL)
|
||||
* bits 16-22: seconds, in BCD(7bits)
|
||||
* bits 23: FIELD (NTSC) or BGF0 (PAL)
|
||||
* bits 24-29: frames, in BCD(6bits)
|
||||
* bits 30: drop frame flag (0: non drop, 1: drop)
|
||||
* bits 31: color frame flag (0: unsync mode, 1: sync mode)
|
||||
* @note BCD numbers (6 or 7 bits): 4 or 5 lower bits for units, 2 higher bits for tens.
|
||||
* @note Frame number adjustment is automatically done in case of drop timecode,
|
||||
* you do NOT have to call av_timecode_adjust_ntsc_framenum2().
|
||||
* @note The frame number is relative to tc->start.
|
||||
* @note Color frame (CF), binary group flags (BGF) and biphase mark polarity
|
||||
* correction (PC) bits are set to zero.
|
||||
* @note Color frame (CF) and binary group flags (BGF) bits are set to zero.
|
||||
*/
|
||||
uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int framenum);
|
||||
|
||||
/**
|
||||
* Convert sei info to SMPTE 12M binary representation.
|
||||
*
|
||||
* @param rate frame rate in rational form
|
||||
* @param drop drop flag
|
||||
* @param hh hour
|
||||
* @param mm minute
|
||||
* @param ss second
|
||||
* @param ff frame number
|
||||
* @return the SMPTE binary representation
|
||||
*/
|
||||
uint32_t av_timecode_get_smpte(AVRational rate, int drop, int hh, int mm, int ss, int ff);
|
||||
|
||||
/**
|
||||
* Load timecode string in buf.
|
||||
*
|
||||
@ -84,6 +109,23 @@ uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int framenum)
|
||||
*/
|
||||
char *av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum);
|
||||
|
||||
/**
|
||||
* Get the timecode string from the SMPTE timecode format.
|
||||
*
|
||||
* In contrast to av_timecode_make_smpte_tc_string this function supports 50/60
|
||||
* fps timecodes by using the field bit.
|
||||
*
|
||||
* @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long
|
||||
* @param rate frame rate of the timecode
|
||||
* @param tcsmpte the 32-bit SMPTE timecode
|
||||
* @param prevent_df prevent the use of a drop flag when it is known the DF bit
|
||||
* is arbitrary
|
||||
* @param skip_field prevent the use of a field flag when it is known the field
|
||||
* bit is arbitrary (e.g. because it is used as PC flag)
|
||||
* @return the buf parameter
|
||||
*/
|
||||
char *av_timecode_make_smpte_tc_string2(char *buf, AVRational rate, uint32_t tcsmpte, int prevent_df, int skip_field);
|
||||
|
||||
/**
|
||||
* Get the timecode string from the SMPTE timecode format.
|
||||
*
|
||||
@ -118,6 +160,23 @@ char *av_timecode_make_mpeg_tc_string(char *buf, uint32_t tc25bit);
|
||||
*/
|
||||
int av_timecode_init(AVTimecode *tc, AVRational rate, int flags, int frame_start, void *log_ctx);
|
||||
|
||||
/**
|
||||
* Init a timecode struct from the passed timecode components.
|
||||
*
|
||||
* @param log_ctx a pointer to an arbitrary struct of which the first field
|
||||
* is a pointer to an AVClass struct (used for av_log)
|
||||
* @param tc pointer to an allocated AVTimecode
|
||||
* @param rate frame rate in rational form
|
||||
* @param flags miscellaneous flags such as drop frame, +24 hours, ...
|
||||
* (see AVTimecodeFlag)
|
||||
* @param hh hours
|
||||
* @param mm minutes
|
||||
* @param ss seconds
|
||||
* @param ff frames
|
||||
* @return 0 on success, AVERROR otherwise
|
||||
*/
|
||||
int av_timecode_init_from_components(AVTimecode *tc, AVRational rate, int flags, int hh, int mm, int ss, int ff, void *log_ctx);
|
||||
|
||||
/**
|
||||
* Parse timecode representation (hh:mm:ss[:;.]ff).
|
||||
*
|
||||
|
@ -28,7 +28,6 @@
|
||||
#define AVUTIL_TREE_H
|
||||
|
||||
#include "attributes.h"
|
||||
#include "version.h"
|
||||
|
||||
/**
|
||||
* @addtogroup lavu_tree AVTree
|
||||
|
161
ext_includes/ffmpeg/libavutil/tx.h
Normal file
161
ext_includes/ffmpeg/libavutil/tx.h
Normal file
@ -0,0 +1,161 @@
|
||||
/*
|
||||
* 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_TX_H
|
||||
#define AVUTIL_TX_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct AVTXContext AVTXContext;
|
||||
|
||||
typedef struct AVComplexFloat {
|
||||
float re, im;
|
||||
} AVComplexFloat;
|
||||
|
||||
typedef struct AVComplexDouble {
|
||||
double re, im;
|
||||
} AVComplexDouble;
|
||||
|
||||
typedef struct AVComplexInt32 {
|
||||
int32_t re, im;
|
||||
} AVComplexInt32;
|
||||
|
||||
enum AVTXType {
|
||||
/**
|
||||
* Standard complex to complex FFT with sample data type of AVComplexFloat,
|
||||
* AVComplexDouble or AVComplexInt32, for each respective variant.
|
||||
*
|
||||
* Output is not 1/len normalized. Scaling currently unsupported.
|
||||
* The stride parameter must be set to the size of a single sample in bytes.
|
||||
*/
|
||||
AV_TX_FLOAT_FFT = 0,
|
||||
AV_TX_DOUBLE_FFT = 2,
|
||||
AV_TX_INT32_FFT = 4,
|
||||
|
||||
/**
|
||||
* Standard MDCT with a sample data type of float, double or int32_t,
|
||||
* respecively. For the float and int32 variants, the scale type is
|
||||
* 'float', while for the double variant, it's 'double'.
|
||||
* If scale is NULL, 1.0 will be used as a default.
|
||||
*
|
||||
* Length is the frame size, not the window size (which is 2x frame).
|
||||
* For forward transforms, the stride specifies the spacing between each
|
||||
* sample in the output array in bytes. The input must be a flat array.
|
||||
*
|
||||
* For inverse transforms, the stride specifies the spacing between each
|
||||
* sample in the input array in bytes. The output must be a flat array.
|
||||
*
|
||||
* NOTE: the inverse transform is half-length, meaning the output will not
|
||||
* contain redundant data. This is what most codecs work with. To do a full
|
||||
* inverse transform, set the AV_TX_FULL_IMDCT flag on init.
|
||||
*/
|
||||
AV_TX_FLOAT_MDCT = 1,
|
||||
AV_TX_DOUBLE_MDCT = 3,
|
||||
AV_TX_INT32_MDCT = 5,
|
||||
|
||||
/**
|
||||
* Real to complex and complex to real DFTs.
|
||||
* For the float and int32 variants, the scale type is 'float', while for
|
||||
* the double variant, it's a 'double'. If scale is NULL, 1.0 will be used
|
||||
* as a default.
|
||||
*
|
||||
* The stride parameter must be set to the size of a single sample in bytes.
|
||||
*
|
||||
* The forward transform performs a real-to-complex DFT of N samples to
|
||||
* N/2+1 complex values.
|
||||
*
|
||||
* The inverse transform performs a complex-to-real DFT of N/2+1 complex
|
||||
* values to N real samples. The output is not normalized, but can be
|
||||
* made so by setting the scale value to 1.0/len.
|
||||
* NOTE: the inverse transform always overwrites the input.
|
||||
*/
|
||||
AV_TX_FLOAT_RDFT = 6,
|
||||
AV_TX_DOUBLE_RDFT = 7,
|
||||
AV_TX_INT32_RDFT = 8,
|
||||
|
||||
/* Not part of the API, do not use */
|
||||
AV_TX_NB,
|
||||
};
|
||||
|
||||
/**
|
||||
* Function pointer to a function to perform the transform.
|
||||
*
|
||||
* @note Using a different context than the one allocated during av_tx_init()
|
||||
* is not allowed.
|
||||
*
|
||||
* @param s the transform context
|
||||
* @param out the output array
|
||||
* @param in the input array
|
||||
* @param stride the input or output stride in bytes
|
||||
*
|
||||
* The out and in arrays must be aligned to the maximum required by the CPU
|
||||
* architecture unless the AV_TX_UNALIGNED flag was set in av_tx_init().
|
||||
* The stride must follow the constraints the transform type has specified.
|
||||
*/
|
||||
typedef void (*av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride);
|
||||
|
||||
/**
|
||||
* Flags for av_tx_init()
|
||||
*/
|
||||
enum AVTXFlags {
|
||||
/**
|
||||
* Performs an in-place transformation on the input. The output argument
|
||||
* of av_tn_fn() MUST match the input. May be unsupported or slower for some
|
||||
* transform types.
|
||||
*/
|
||||
AV_TX_INPLACE = 1ULL << 0,
|
||||
|
||||
/**
|
||||
* Relaxes alignment requirement for the in and out arrays of av_tx_fn().
|
||||
* May be slower with certain transform types.
|
||||
*/
|
||||
AV_TX_UNALIGNED = 1ULL << 1,
|
||||
|
||||
/**
|
||||
* Performs a full inverse MDCT rather than leaving out samples that can be
|
||||
* derived through symmetry. Requires an output array of 'len' floats,
|
||||
* rather than the usual 'len/2' floats.
|
||||
* Ignored for all transforms but inverse MDCTs.
|
||||
*/
|
||||
AV_TX_FULL_IMDCT = 1ULL << 2,
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize a transform context with the given configuration
|
||||
* (i)MDCTs with an odd length are currently not supported.
|
||||
*
|
||||
* @param ctx the context to allocate, will be NULL on error
|
||||
* @param tx pointer to the transform function pointer to set
|
||||
* @param type type the type of transform
|
||||
* @param inv whether to do an inverse or a forward transform
|
||||
* @param len the size of the transform in samples
|
||||
* @param scale pointer to the value to scale the output if supported by type
|
||||
* @param flags a bitmask of AVTXFlags or 0
|
||||
*
|
||||
* @return 0 on success, negative error code on failure
|
||||
*/
|
||||
int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, enum AVTXType type,
|
||||
int inv, int len, const void *scale, uint64_t flags);
|
||||
|
||||
/**
|
||||
* Frees a context and sets *ctx to NULL, does nothing when *ctx == NULL.
|
||||
*/
|
||||
void av_tx_uninit(AVTXContext **ctx);
|
||||
|
||||
#endif /* AVUTIL_TX_H */
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user