mirror of
https://github.com/jellyfin/jellyfin-ffmpeg.git
synced 2024-10-07 03:13:23 +00:00
New upstream version 5.1
This commit is contained in:
parent
6bd84bbf7e
commit
afceab7a0a
83
Changelog
83
Changelog
@ -1,65 +1,30 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version 5.0.1:
|
||||
- avcodec/exr: Avoid signed overflow in displayWindow
|
||||
- avcodec/diracdec: avoid signed integer overflow in global mv
|
||||
- avcodec/takdsp: Fix integer overflow in decorrelate_sf()
|
||||
- avcodec/apedec: fix a integer overflow in long_filter_high_3800()
|
||||
- avdevice/dshow: fix regression
|
||||
- avfilter/vf_subtitles: pass storage size to libass
|
||||
- avcodec/vp9_superframe_split_bsf: Don't read inexistent data
|
||||
- avcodec/vp9_superframe_split_bsf: Discard invalid zero-sized frames
|
||||
- avcodec/vp9_superframe_bsf: Check for existence of data before reading it
|
||||
- avcodec/vp9_raw_reorder_bsf: Check for existence of data before reading it
|
||||
- avformat/imf: fix packet pts, dts and muxing
|
||||
- avformat/imf: open resources only when first needed
|
||||
- avformat/imf: cosmetics
|
||||
- avformat/imf_cpl: do not use filesize when reading XML file
|
||||
- avformat/imfdec: Use proper logcontext
|
||||
- avformat/imfdec: do not use filesize when reading XML file
|
||||
- doc/utils: add missing 22.2 layout entry
|
||||
- avcodec/av1: only set the private context pix_fmt field if get_pixel_format() succeeds
|
||||
- avformat/aqtitledec: Skip unrepresentable durations
|
||||
- avformat/cafdec: Do not store empty keys in read_info_chunk()
|
||||
- avformat/mxfdec: Do not clear array in mxf_read_strong_ref_array() before writing
|
||||
- avformat/mxfdec: Check for avio_read() failure in mxf_read_strong_ref_array()
|
||||
- avformat/mxfdec: Check count in mxf_read_strong_ref_array()
|
||||
- avformat/hls: Check target_duration
|
||||
- avcodec/pixlet: Avoid signed integer overflow in scaling in filterfn()
|
||||
- avformat/matroskadec: Check pre_ns
|
||||
- avcodec/sonic: Use unsigned for predictor_k to avoid undefined behavior
|
||||
- avcodec/libuavs3d: Check ff_set_dimensions() for failure
|
||||
- avcodec/speexdec: Align some comments
|
||||
- avcodec/speexdec: Use correct doxygen comments
|
||||
- avcodec/mjpegbdec: Set buf_size
|
||||
- avformat/matroskadec: Use rounded down duration in get_cue_desc() check
|
||||
- avcodec/argo: Check packet size
|
||||
- avcodec/g729_parser: Check channels
|
||||
- avformat/avidec: Check height
|
||||
- avformat/rmdec: Better duplicate tags check
|
||||
- avformat/mov: Disallow empty sidx
|
||||
- avformat/argo_cvg:: Fix order of operations in error check in argo_cvg_write_trailer()
|
||||
- avformat/argo_asf: Fix order of operations in error check in argo_asf_write_trailer()
|
||||
- avcodec/movtextdec: add () to CMP() macro to avoid unexpected behavior
|
||||
- avformat/matroskadec: Check duration
|
||||
- avformat/mov: Corner case encryption error cleanup in mov_read_senc()
|
||||
- avcodec/jpeglsdec: Fix if( code style
|
||||
- avcodec/jpeglsdec: Check get_ur_golomb_jpegls() for error
|
||||
- avcodec/motion_est: fix indention of ff_get_best_fcode()
|
||||
- avcodec/motion_est: Fix xy indexing on range violation in ff_get_best_fcode()
|
||||
- avformat/hls: Use unsigned for iv computation
|
||||
- avcodec/jpeglsdec: Increase range for N in ls_get_code_runterm() by using unsigned
|
||||
- avformat/matroskadec: Check desc_bytes
|
||||
- avformat/utils: Fix invalid NULL pointer operation in ff_parse_key_value()
|
||||
- avformat/matroskadec: Fix infinite loop with bz decompression
|
||||
- avformat/utils: keep chapter monotonicity on chapter updates
|
||||
- avformat/mov: Check size before subtraction
|
||||
- avcodec/cfhd: Avoid signed integer overflow in coeff
|
||||
- avcodec/libdav1d: free the Dav1dData packet on dav1d_send_data() failure
|
||||
- avcodec/h264_parser: don't alter decoder private data
|
||||
- configure: link to libatomic when it's present
|
||||
- fate/ffmpeg: add missing samples dependency to fate-shortest
|
||||
version 5.1:
|
||||
- add ipfs/ipns protocol support
|
||||
- dialogue enhance audio filter
|
||||
- dropped obsolete XvMC hwaccel
|
||||
- pcm-bluray encoder
|
||||
- DFPWM audio encoder/decoder and raw muxer/demuxer
|
||||
- SITI filter
|
||||
- Vizrt Binary Image encoder/decoder
|
||||
- avsynctest source filter
|
||||
- feedback video filter
|
||||
- pixelize video filter
|
||||
- colormap video filter
|
||||
- colorchart video source filter
|
||||
- multiply video filter
|
||||
- PGS subtitle frame merge bitstream filter
|
||||
- blurdetect filter
|
||||
- tiltshelf audio filter
|
||||
- QOI image format support
|
||||
- ffprobe -o option
|
||||
- virtualbass audio filter
|
||||
- VDPAU AV1 hwaccel
|
||||
- PHM image format support
|
||||
- remap_opencl filter
|
||||
- added chromakey_cuda filter
|
||||
|
||||
|
||||
version 5.0:
|
||||
|
10
MAINTAINERS
10
MAINTAINERS
@ -161,6 +161,7 @@ Codecs:
|
||||
cscd.c Reimar Doeffinger
|
||||
cuviddec.c Timo Rothenpieler
|
||||
dca* foo86
|
||||
dfpwm* Jack Bruienne
|
||||
dirac* Rostislav Pehlivanov
|
||||
dnxhd* Baptiste Coudurier
|
||||
dolby_e* foo86
|
||||
@ -193,6 +194,7 @@ Codecs:
|
||||
libcodec2.c Tomas Härdin
|
||||
libdirac* David Conrad
|
||||
libdavs2.c Huiwen Ren
|
||||
libjxl*.c, libjxl.h Leo Izen
|
||||
libgsm.c Michel Bardiaux
|
||||
libkvazaar.c Arttu Ylä-Outinen
|
||||
libopenh264enc.c Martin Storsjo, Linjie Fu
|
||||
@ -266,7 +268,6 @@ Codecs:
|
||||
xan.c Mike Melanson
|
||||
xbm* Paul B Mahol
|
||||
xface Stefano Sabatini
|
||||
xvmc.c Ivan Kalvachev
|
||||
xwd* Paul B Mahol
|
||||
|
||||
Hardware acceleration:
|
||||
@ -354,6 +355,7 @@ Filters:
|
||||
vf_il.c Paul B Mahol
|
||||
vf_(t)interlace Thomas Mundt (CC <thomas.mundt@hr.de>)
|
||||
vf_lenscorrection.c Daniel Oberhoff
|
||||
vf_libplacebo.c Niklas Haas
|
||||
vf_mergeplanes.c Paul B Mahol
|
||||
vf_mestimate.c Davinder Singh
|
||||
vf_minterpolate.c Davinder Singh
|
||||
@ -416,6 +418,7 @@ Muxers/Demuxers:
|
||||
dashdec.c Steven Liu
|
||||
dashenc.c Karthick Jeyapal
|
||||
daud.c Reimar Doeffinger
|
||||
dfpwmdec.c Jack Bruienne
|
||||
dss.c Oleksij Rempel
|
||||
dtsdec.c foo86
|
||||
dtshddec.c Paul B Mahol
|
||||
@ -436,6 +439,7 @@ Muxers/Demuxers:
|
||||
ipmovie.c Mike Melanson
|
||||
ircam* Paul B Mahol
|
||||
iss.c Stefan Gehrer
|
||||
jpegxl_probe.* Leo Izen
|
||||
jvdec.c Peter Ross
|
||||
kvag.c Zane van Iperen
|
||||
libmodplug.c Clément Bœsch
|
||||
@ -515,6 +519,7 @@ Protocols:
|
||||
bluray.c Petri Hintukainen
|
||||
ftp.c Lukasz Marek
|
||||
http.c Ronald S. Bultje
|
||||
libsrt.c Zhao Zhili
|
||||
libssh.c Lukasz Marek
|
||||
libzmq.c Andriy Gelman
|
||||
mms*.c Ronald S. Bultje
|
||||
@ -541,6 +546,7 @@ Operating systems / CPU architectures
|
||||
|
||||
Alpha Falk Hueffner
|
||||
MIPS Manojkumar Bhosale, Shiyou Yin
|
||||
LoongArch Shiyou Yin
|
||||
Mac OS X / PowerPC Romain Dolbeau, Guillaume Poirier
|
||||
Amiga / PowerPC Colin Ward
|
||||
Linux / PowerPC Lauri Kasanen
|
||||
@ -615,10 +621,12 @@ Haihao Xiang (haihao) 1F0C 31E8 B4FE F7A4 4DC1 DC99 E0F5 76D4 76FC 437F
|
||||
Jaikrishnan Menon 61A1 F09F 01C9 2D45 78E1 C862 25DC 8831 AF70 D368
|
||||
James Almer 7751 2E8C FD94 A169 57E6 9A7A 1463 01AD 7376 59E0
|
||||
Jean Delvare 7CA6 9F44 60F1 BDC4 1FD2 C858 A552 6B9B B3CD 4E6A
|
||||
Leo Izen (thebombzen) B6FD 3CFC 7ACF 83FC 9137 6945 5A71 C331 FD2F A19A
|
||||
Loren Merritt ABD9 08F4 C920 3F65 D8BE 35D7 1540 DAA7 060F 56DE
|
||||
Lynne FE50 139C 6805 72CA FD52 1F8D A2FE A5F0 3F03 4464
|
||||
Michael Niedermayer 9FF2 128B 147E F673 0BAD F133 611E C787 040B 0FAB
|
||||
Nicolas George 24CE 01CE 9ACC 5CEB 74D8 8D9D B063 D997 36E5 4C93
|
||||
Niklas Haas (haasn) 1DDB 8076 B14D 5B48 32FC 99D9 EB52 DA9C 02BA 6FB4
|
||||
Nikolay Aleksandrov 8978 1D8C FB71 588E 4B27 EAA8 C4F0 B5FC E011 13B1
|
||||
Panagiotis Issaris 6571 13A3 33D9 3726 F728 AA98 F643 B12E ECF3 E029
|
||||
Peter Ross A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B
|
||||
|
12
Makefile
12
Makefile
@ -19,6 +19,8 @@ vpath %/fate_config.sh.template $(SRC_PATH)
|
||||
TESTTOOLS = audiogen videogen rotozoom tiny_psnr tiny_ssim base64 audiomatch
|
||||
HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
|
||||
|
||||
ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale swresample
|
||||
|
||||
# $(FFLIBS-yes) needs to be in linking order
|
||||
FFLIBS-$(CONFIG_AVDEVICE) += avdevice
|
||||
FFLIBS-$(CONFIG_AVFILTER) += avfilter
|
||||
@ -76,13 +78,14 @@ tools/target_dem_%_fuzzer$(EXESUF): $(FF_DEP_LIBS)
|
||||
CONFIGURABLE_COMPONENTS = \
|
||||
$(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c)) \
|
||||
$(SRC_PATH)/libavcodec/bitstream_filters.c \
|
||||
$(SRC_PATH)/libavcodec/hwaccels.h \
|
||||
$(SRC_PATH)/libavcodec/parsers.c \
|
||||
$(SRC_PATH)/libavformat/protocols.c \
|
||||
|
||||
config.h: ffbuild/.config
|
||||
config_components.h: ffbuild/.config
|
||||
ffbuild/.config: $(CONFIGURABLE_COMPONENTS)
|
||||
@-tput bold 2>/dev/null
|
||||
@-printf '\nWARNING: $(?) newer than config.h, rerun configure\n\n'
|
||||
@-printf '\nWARNING: $(?) newer than config_components.h, rerun configure\n\n'
|
||||
@-tput sgr0 2>/dev/null
|
||||
|
||||
SUBDIR_VARS := CLEANFILES FFLIBS HOSTPROGS TESTPROGS TOOLS \
|
||||
@ -113,12 +116,13 @@ include $(SRC_PATH)/fftools/Makefile
|
||||
include $(SRC_PATH)/doc/Makefile
|
||||
include $(SRC_PATH)/doc/examples/Makefile
|
||||
|
||||
libavcodec/avcodec.o libavformat/utils.o libavdevice/avdevice.o libavfilter/avfilter.o libavutil/utils.o libpostproc/postprocess.o libswresample/swresample.o libswscale/utils.o : libavutil/ffversion.h
|
||||
$(ALLFFLIBS:%=lib%/version.o): libavutil/ffversion.h
|
||||
|
||||
$(PROGS): %$(PROGSSUF)$(EXESUF): %$(PROGSSUF)_g$(EXESUF)
|
||||
ifeq ($(STRIPTYPE),direct)
|
||||
$(STRIP) -o $@ $<
|
||||
else
|
||||
$(RM) $@
|
||||
$(CP) $< $@
|
||||
$(STRIP) $@
|
||||
endif
|
||||
@ -159,7 +163,7 @@ clean::
|
||||
$(RM) -rf coverage.info coverage.info.in lcov
|
||||
|
||||
distclean:: clean
|
||||
$(RM) .version avversion.h config.asm config.h mapfile \
|
||||
$(RM) .version config.asm config.h config_components.h mapfile \
|
||||
ffbuild/.config ffbuild/config.* libavutil/avconfig.h \
|
||||
version.h libavutil/ffversion.h libavcodec/codec_names.h \
|
||||
libavcodec/bsf_list.c libavformat/protocol_list.c \
|
||||
|
@ -1,10 +1,13 @@
|
||||
|
||||
┌────────────────────────────────────────┐
|
||||
│ RELEASE NOTES for FFmpeg 5.0 "Lorentz" │
|
||||
└────────────────────────────────────────┘
|
||||
┌────────────────────────────────────────────┐
|
||||
│ RELEASE NOTES for FFmpeg 5.1 "Riemann" LTS │
|
||||
└────────────────────────────────────────────┘
|
||||
|
||||
The FFmpeg Project proudly presents FFmpeg 5.0 "Lorentz", about 9
|
||||
months after the release of FFmpeg 4.4.
|
||||
The FFmpeg Project proudly presents FFmpeg 5.1 "Riemann" LTS, about 6
|
||||
months after the release of FFmpeg 5.0, our first Long Term Support
|
||||
release. While several past FFmpeg releases have enjoyed long term
|
||||
support, this is the first release where such an intention is made
|
||||
clear at release.
|
||||
|
||||
A complete Changelog is available at the root of the project, and the
|
||||
complete Git history on https://git.ffmpeg.org/gitweb/ffmpeg.git
|
||||
|
@ -181,7 +181,9 @@ static inline __device__ double trunc(double a) { return __builtin_trunc(a); }
|
||||
static inline __device__ float fabsf(float a) { return __builtin_fabsf(a); }
|
||||
static inline __device__ float fabs(float a) { return __builtin_fabsf(a); }
|
||||
static inline __device__ double fabs(double a) { return __builtin_fabs(a); }
|
||||
static inline __device__ float sqrtf(float a) { return __builtin_sqrtf(a); }
|
||||
|
||||
static inline __device__ float __saturatef(float a) { return __nvvm_saturate_f(a); }
|
||||
static inline __device__ float __sinf(float a) { return __nvvm_sin_approx_f(a); }
|
||||
static inline __device__ float __cosf(float a) { return __nvvm_cos_approx_f(a); }
|
||||
static inline __device__ float __expf(float a) { return __nvvm_ex2_approx_f(a * (float)__builtin_log2(__builtin_exp(1))); }
|
||||
|
@ -20,11 +20,40 @@
|
||||
#define COMPAT_W32DLFCN_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <stdint.h>
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "config.h"
|
||||
#if (_WIN32_WINNT < 0x0602) || HAVE_WINRT
|
||||
#include "libavutil/macros.h"
|
||||
#include "libavutil/wchar_filename.h"
|
||||
#endif
|
||||
|
||||
static inline wchar_t *get_module_filename(HMODULE module)
|
||||
{
|
||||
wchar_t *path = NULL, *new_path;
|
||||
DWORD path_size = 0, path_len;
|
||||
|
||||
do {
|
||||
path_size = path_size ? FFMIN(2 * path_size, INT16_MAX + 1) : MAX_PATH;
|
||||
new_path = av_realloc_array(path, path_size, sizeof *path);
|
||||
if (!new_path) {
|
||||
av_free(path);
|
||||
return NULL;
|
||||
}
|
||||
path = new_path;
|
||||
// Returns path_size in case of insufficient buffer.
|
||||
// Whether the error is set or not and whether the output
|
||||
// is null-terminated or not depends on the version of Windows.
|
||||
path_len = GetModuleFileNameW(module, path, path_size);
|
||||
} while (path_len && path_size <= INT16_MAX && path_size <= path_len);
|
||||
|
||||
if (!path_len) {
|
||||
av_free(path);
|
||||
return NULL;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Safe function used to open dynamic libs. This attempts to improve program security
|
||||
* by removing the current directory from the dll search path. Only dll's found in the
|
||||
@ -34,29 +63,53 @@
|
||||
*/
|
||||
static inline HMODULE win32_dlopen(const char *name)
|
||||
{
|
||||
wchar_t *name_w;
|
||||
HMODULE module = NULL;
|
||||
if (utf8towchar(name, &name_w))
|
||||
name_w = NULL;
|
||||
#if _WIN32_WINNT < 0x0602
|
||||
// Need to check if KB2533623 is available
|
||||
// On Win7 and earlier we check if KB2533623 is available
|
||||
if (!GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "SetDefaultDllDirectories")) {
|
||||
HMODULE module = NULL;
|
||||
wchar_t *path = NULL, *name_w = NULL;
|
||||
DWORD pathlen;
|
||||
if (utf8towchar(name, &name_w))
|
||||
wchar_t *path = NULL, *new_path;
|
||||
DWORD pathlen, pathsize, namelen;
|
||||
if (!name_w)
|
||||
goto exit;
|
||||
path = (wchar_t *)av_calloc(MAX_PATH, sizeof(wchar_t));
|
||||
namelen = wcslen(name_w);
|
||||
// Try local directory first
|
||||
pathlen = GetModuleFileNameW(NULL, path, MAX_PATH);
|
||||
pathlen = wcsrchr(path, '\\') - path;
|
||||
if (pathlen == 0 || pathlen + wcslen(name_w) + 2 > MAX_PATH)
|
||||
path = get_module_filename(NULL);
|
||||
if (!path)
|
||||
goto exit;
|
||||
path[pathlen] = '\\';
|
||||
new_path = wcsrchr(path, '\\');
|
||||
if (!new_path)
|
||||
goto exit;
|
||||
pathlen = new_path - path;
|
||||
pathsize = pathlen + namelen + 2;
|
||||
new_path = av_realloc_array(path, pathsize, sizeof *path);
|
||||
if (!new_path)
|
||||
goto exit;
|
||||
path = new_path;
|
||||
wcscpy(path + pathlen + 1, name_w);
|
||||
module = LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
|
||||
if (module == NULL) {
|
||||
// Next try System32 directory
|
||||
pathlen = GetSystemDirectoryW(path, MAX_PATH);
|
||||
if (pathlen == 0 || pathlen + wcslen(name_w) + 2 > MAX_PATH)
|
||||
pathlen = GetSystemDirectoryW(path, pathsize);
|
||||
if (!pathlen)
|
||||
goto exit;
|
||||
path[pathlen] = '\\';
|
||||
// Buffer is not enough in two cases:
|
||||
// 1. system directory + \ + module name
|
||||
// 2. system directory even without the module name.
|
||||
if (pathlen + namelen + 2 > pathsize) {
|
||||
pathsize = pathlen + namelen + 2;
|
||||
new_path = av_realloc_array(path, pathsize, sizeof *path);
|
||||
if (!new_path)
|
||||
goto exit;
|
||||
path = new_path;
|
||||
// Query again to handle the case #2.
|
||||
pathlen = GetSystemDirectoryW(path, pathsize);
|
||||
if (!pathlen)
|
||||
goto exit;
|
||||
}
|
||||
path[pathlen] = L'\\';
|
||||
wcscpy(path + pathlen + 1, name_w);
|
||||
module = LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
|
||||
}
|
||||
@ -73,16 +126,19 @@ exit:
|
||||
# define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800
|
||||
#endif
|
||||
#if HAVE_WINRT
|
||||
wchar_t *name_w = NULL;
|
||||
int ret;
|
||||
if (utf8towchar(name, &name_w))
|
||||
if (!name_w)
|
||||
return NULL;
|
||||
ret = LoadPackagedLibrary(name_w, 0);
|
||||
av_free(name_w);
|
||||
return ret;
|
||||
module = LoadPackagedLibrary(name_w, 0);
|
||||
#else
|
||||
return LoadLibraryExA(name, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32);
|
||||
#define LOAD_FLAGS (LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32)
|
||||
/* filename may be be in CP_ACP */
|
||||
if (!name_w)
|
||||
return LoadLibraryExA(name, NULL, LOAD_FLAGS);
|
||||
module = LoadLibraryExW(name_w, NULL, LOAD_FLAGS);
|
||||
#undef LOAD_FLAGS
|
||||
#endif
|
||||
av_free(name_w);
|
||||
return module;
|
||||
}
|
||||
#define dlopen(name, flags) win32_dlopen(name)
|
||||
#define dlclose FreeLibrary
|
||||
|
227
configure
vendored
227
configure
vendored
@ -140,7 +140,6 @@ Component options:
|
||||
--disable-dwt disable DWT code
|
||||
--disable-error-resilience disable error resilience code
|
||||
--disable-lsp disable LSP code
|
||||
--disable-lzo disable LZO decoder code
|
||||
--disable-mdct disable MDCT code
|
||||
--disable-rdft disable RDFT code
|
||||
--disable-fft disable FFT code
|
||||
@ -216,6 +215,7 @@ External library support:
|
||||
--disable-iconv disable iconv [autodetect]
|
||||
--enable-jni enable JNI support [no]
|
||||
--enable-ladspa enable LADSPA audio filtering [no]
|
||||
--enable-lcms2 enable ICC profile support via LittleCMS 2 [no]
|
||||
--enable-libaom enable AV1 video encoding/decoding via libaom [no]
|
||||
--enable-libaribb24 enable ARIB text and caption decoding via libaribb24 [no]
|
||||
--enable-libass enable libass subtitles rendering,
|
||||
@ -241,6 +241,7 @@ External library support:
|
||||
--enable-libiec61883 enable iec61883 via libiec61883 [no]
|
||||
--enable-libilbc enable iLBC de/encoding via libilbc [no]
|
||||
--enable-libjack enable JACK audio sound server [no]
|
||||
--enable-libjxl enable JPEG XL de/encoding via libjxl [no]
|
||||
--enable-libklvanc enable Kernel Labs VANC processing [no]
|
||||
--enable-libkvazaar enable HEVC encoding via libkvazaar [no]
|
||||
--enable-liblensfun enable lensfun lens correction [no]
|
||||
@ -255,6 +256,7 @@ External library support:
|
||||
--enable-libopenvino enable OpenVINO as a DNN module backend
|
||||
for DNN based filters like dnn_processing [no]
|
||||
--enable-libopus enable Opus de/encoding via libopus [no]
|
||||
--enable-libplacebo enable libplacebo library [no]
|
||||
--enable-libpulse enable Pulseaudio input via libpulse [no]
|
||||
--enable-librabbitmq enable RabbitMQ library [no]
|
||||
--enable-librav1e enable AV1 encoding via rav1e [no]
|
||||
@ -443,6 +445,7 @@ Optimization options (experts only):
|
||||
--disable-fma4 disable FMA4 optimizations
|
||||
--disable-avx2 disable AVX2 optimizations
|
||||
--disable-avx512 disable AVX-512 optimizations
|
||||
--disable-avx512icl disable AVX-512ICL optimizations
|
||||
--disable-aesni disable AESNI optimizations
|
||||
--disable-armv5te disable armv5te optimizations
|
||||
--disable-armv6 disable armv6 optimizations
|
||||
@ -1812,6 +1815,7 @@ EXTERNAL_LIBRARY_LIST="
|
||||
gnutls
|
||||
jni
|
||||
ladspa
|
||||
lcms2
|
||||
libaom
|
||||
libass
|
||||
libbluray
|
||||
@ -1832,6 +1836,7 @@ EXTERNAL_LIBRARY_LIST="
|
||||
libiec61883
|
||||
libilbc
|
||||
libjack
|
||||
libjxl
|
||||
libklvanc
|
||||
libkvazaar
|
||||
libmodplug
|
||||
@ -1899,7 +1904,6 @@ HWACCEL_AUTODETECT_LIBRARY_LIST="
|
||||
videotoolbox
|
||||
vulkan
|
||||
v4l2_m2m
|
||||
xvmc
|
||||
"
|
||||
|
||||
# catchall list of things that require external libs to link
|
||||
@ -1975,7 +1979,6 @@ SUBSYSTEM_LIST="
|
||||
fast_unaligned
|
||||
fft
|
||||
lsp
|
||||
lzo
|
||||
mdct
|
||||
pixelutils
|
||||
network
|
||||
@ -2098,6 +2101,7 @@ ARCH_EXT_LIST_X86_SIMD="
|
||||
avx
|
||||
avx2
|
||||
avx512
|
||||
avx512icl
|
||||
fma3
|
||||
fma4
|
||||
mmx
|
||||
@ -2267,6 +2271,8 @@ SYSTEM_FUNCS="
|
||||
CommandLineToArgvW
|
||||
fcntl
|
||||
getaddrinfo
|
||||
getauxval
|
||||
getenv
|
||||
gethrtime
|
||||
getopt
|
||||
GetModuleHandle
|
||||
@ -2432,6 +2438,7 @@ CONFIG_EXTRA="
|
||||
cbs_jpeg
|
||||
cbs_mpeg2
|
||||
cbs_vp9
|
||||
deflate_wrapper
|
||||
dirac_parse
|
||||
dnn
|
||||
dovi_rpu
|
||||
@ -2460,6 +2467,7 @@ CONFIG_EXTRA="
|
||||
idctdsp
|
||||
iirfilter
|
||||
mdct15
|
||||
inflate_wrapper
|
||||
intrax8
|
||||
iso_media
|
||||
ividsp
|
||||
@ -2478,6 +2486,7 @@ CONFIG_EXTRA="
|
||||
mpegaudioheader
|
||||
mpeg4audio
|
||||
mpegvideo
|
||||
mpegvideodec
|
||||
mpegvideoenc
|
||||
mss34dsp
|
||||
pixblockdsp
|
||||
@ -2665,6 +2674,7 @@ fma3_deps="avx"
|
||||
fma4_deps="avx"
|
||||
avx2_deps="avx"
|
||||
avx512_deps="avx2"
|
||||
avx512icl_deps="avx512"
|
||||
|
||||
mmx_external_deps="x86asm"
|
||||
mmx_inline_deps="inline_asm x86"
|
||||
@ -2707,6 +2717,7 @@ cbs_jpeg_select="cbs"
|
||||
cbs_mpeg2_select="cbs"
|
||||
cbs_vp9_select="cbs"
|
||||
dct_select="rdft"
|
||||
deflate_wrapper_deps="zlib"
|
||||
dirac_parse_select="golomb"
|
||||
dovi_rpu_select="golomb"
|
||||
dnn_suggest="libtensorflow libopenvino"
|
||||
@ -2719,6 +2730,7 @@ faanidct_select="idctdsp"
|
||||
h264dsp_select="startcode"
|
||||
hevcparse_select="atsc_a53 golomb"
|
||||
frame_thread_encoder_deps="encoders threads"
|
||||
inflate_wrapper_deps="zlib"
|
||||
intrax8_select="blockdsp idctdsp"
|
||||
iso_media_select="mpeg4audio"
|
||||
mdct_select="fft"
|
||||
@ -2727,7 +2739,8 @@ me_cmp_select="fdctdsp idctdsp pixblockdsp"
|
||||
mpeg_er_select="error_resilience"
|
||||
mpegaudio_select="mpegaudiodsp mpegaudioheader"
|
||||
mpegaudiodsp_select="dct"
|
||||
mpegvideo_select="blockdsp h264chroma hpeldsp idctdsp me_cmp mpeg_er videodsp"
|
||||
mpegvideo_select="blockdsp h264chroma hpeldsp idctdsp videodsp"
|
||||
mpegvideodec_select="mpegvideo mpeg_er"
|
||||
mpegvideoenc_select="aandcttables me_cmp mpegvideo pixblockdsp qpeldsp"
|
||||
vc1dsp_select="h264chroma qpeldsp startcode"
|
||||
rdft_select="fft"
|
||||
@ -2752,9 +2765,8 @@ amrwb_decoder_select="lsp"
|
||||
amv_decoder_select="sp5x_decoder exif"
|
||||
amv_encoder_select="jpegtables mpegvideoenc"
|
||||
ape_decoder_select="bswapdsp llauddsp"
|
||||
apng_decoder_deps="zlib"
|
||||
apng_encoder_deps="zlib"
|
||||
apng_encoder_select="llvidencdsp"
|
||||
apng_decoder_select="inflate_wrapper"
|
||||
apng_encoder_select="deflate_wrapper llvidencdsp"
|
||||
aptx_decoder_select="audio_frame_queue"
|
||||
aptx_encoder_select="audio_frame_queue"
|
||||
aptx_hd_decoder_select="audio_frame_queue"
|
||||
@ -2778,7 +2790,7 @@ clearvideo_decoder_select="idctdsp"
|
||||
cllc_decoder_select="bswapdsp"
|
||||
comfortnoise_encoder_select="lpc"
|
||||
cook_decoder_select="audiodsp mdct sinewin"
|
||||
cscd_decoder_select="lzo"
|
||||
cri_decoder_select="mjpeg_decoder"
|
||||
cscd_decoder_suggest="zlib"
|
||||
dca_decoder_select="mdct"
|
||||
dca_encoder_select="mdct"
|
||||
@ -2805,9 +2817,9 @@ ffvhuff_encoder_select="huffyuv_encoder"
|
||||
fic_decoder_select="golomb"
|
||||
flac_decoder_select="flacdsp"
|
||||
flac_encoder_select="bswapdsp flacdsp lpc"
|
||||
flashsv2_decoder_deps="zlib"
|
||||
flashsv2_encoder_deps="zlib"
|
||||
flashsv_decoder_deps="zlib"
|
||||
flashsv2_decoder_select="inflate_wrapper"
|
||||
flashsv2_encoder_select="deflate_wrapper"
|
||||
flashsv_decoder_select="inflate_wrapper"
|
||||
flashsv_encoder_deps="zlib"
|
||||
flv_decoder_select="h263_decoder"
|
||||
flv_encoder_select="h263_encoder"
|
||||
@ -2816,9 +2828,9 @@ fraps_decoder_select="bswapdsp huffman"
|
||||
g2m_decoder_deps="zlib"
|
||||
g2m_decoder_select="blockdsp idctdsp jpegtables"
|
||||
g729_decoder_select="audiodsp"
|
||||
h261_decoder_select="mpegvideo"
|
||||
h261_decoder_select="mpegvideodec"
|
||||
h261_encoder_select="mpegvideoenc"
|
||||
h263_decoder_select="h263_parser h263dsp mpegvideo qpeldsp"
|
||||
h263_decoder_select="h263_parser h263dsp mpegvideodec qpeldsp"
|
||||
h263_encoder_select="h263dsp mpegvideoenc"
|
||||
h263i_decoder_select="h263_decoder"
|
||||
h263p_decoder_select="h263_decoder"
|
||||
@ -2840,12 +2852,12 @@ indeo3_decoder_select="hpeldsp"
|
||||
indeo4_decoder_select="ividsp"
|
||||
indeo5_decoder_select="ividsp"
|
||||
interplay_video_decoder_select="hpeldsp"
|
||||
ipu_decoder_select="mpegvideo"
|
||||
ipu_decoder_select="mpegvideodec"
|
||||
jpegls_decoder_select="mjpeg_decoder"
|
||||
jv_decoder_select="blockdsp"
|
||||
lagarith_decoder_select="llviddsp"
|
||||
ljpeg_encoder_select="idctdsp jpegtables"
|
||||
lscr_decoder_deps="zlib"
|
||||
lscr_decoder_select="inflate_wrapper"
|
||||
magicyuv_decoder_select="llviddsp"
|
||||
magicyuv_encoder_select="llvidencdsp"
|
||||
mdec_decoder_select="blockdsp bswapdsp idctdsp mpegvideo"
|
||||
@ -2870,38 +2882,36 @@ mp3on4_decoder_select="mpegaudio mpeg4audio"
|
||||
mp3on4float_decoder_select="mpegaudio mpeg4audio"
|
||||
mpc7_decoder_select="bswapdsp mpegaudiodsp"
|
||||
mpc8_decoder_select="mpegaudiodsp"
|
||||
mpegvideo_decoder_select="mpegvideo"
|
||||
mpeg1video_decoder_select="mpegvideo"
|
||||
mpegvideo_decoder_select="mpegvideodec"
|
||||
mpeg1video_decoder_select="mpegvideodec"
|
||||
mpeg1video_encoder_select="mpegvideoenc h263dsp"
|
||||
mpeg2video_decoder_select="mpegvideo"
|
||||
mpeg2video_decoder_select="mpegvideodec"
|
||||
mpeg2video_encoder_select="mpegvideoenc h263dsp"
|
||||
mpeg4_decoder_select="h263_decoder mpeg4video_parser"
|
||||
mpeg4_encoder_select="h263_encoder"
|
||||
msa1_decoder_select="mss34dsp"
|
||||
mscc_decoder_deps="zlib"
|
||||
mscc_decoder_select="inflate_wrapper"
|
||||
msmpeg4v1_decoder_select="h263_decoder"
|
||||
msmpeg4v2_decoder_select="h263_decoder"
|
||||
msmpeg4v2_encoder_select="h263_encoder"
|
||||
msmpeg4v3_decoder_select="h263_decoder"
|
||||
msmpeg4v3_encoder_select="h263_encoder"
|
||||
mss2_decoder_select="mpegvideo qpeldsp vc1_decoder"
|
||||
mss2_decoder_select="mpegvideodec qpeldsp vc1_decoder"
|
||||
mts2_decoder_select="jpegtables mss34dsp"
|
||||
mv30_decoder_select="aandcttables blockdsp"
|
||||
mvha_decoder_deps="zlib"
|
||||
mvha_decoder_select="llviddsp"
|
||||
mwsc_decoder_deps="zlib"
|
||||
mvha_decoder_select="inflate_wrapper llviddsp"
|
||||
mwsc_decoder_select="inflate_wrapper"
|
||||
mxpeg_decoder_select="mjpeg_decoder"
|
||||
nellymoser_decoder_select="mdct sinewin"
|
||||
nellymoser_encoder_select="audio_frame_queue mdct sinewin"
|
||||
notchlc_decoder_select="lzf"
|
||||
nuv_decoder_select="idctdsp lzo"
|
||||
nuv_decoder_select="idctdsp"
|
||||
on2avc_decoder_select="mdct"
|
||||
opus_decoder_deps="swresample"
|
||||
opus_decoder_select="mdct15"
|
||||
opus_encoder_select="audio_frame_queue mdct15"
|
||||
png_decoder_deps="zlib"
|
||||
png_encoder_deps="zlib"
|
||||
png_encoder_select="llvidencdsp"
|
||||
png_decoder_select="inflate_wrapper"
|
||||
png_encoder_select="deflate_wrapper llvidencdsp"
|
||||
prores_decoder_select="blockdsp idctdsp"
|
||||
prores_encoder_select="fdctdsp"
|
||||
qcelp_decoder_select="lsp"
|
||||
@ -2909,7 +2919,7 @@ qdm2_decoder_select="mdct rdft mpegaudiodsp"
|
||||
ra_144_decoder_select="audiodsp"
|
||||
ra_144_encoder_select="audio_frame_queue lpc audiodsp"
|
||||
ralf_decoder_select="golomb"
|
||||
rasc_decoder_deps="zlib"
|
||||
rasc_decoder_select="inflate_wrapper"
|
||||
rawvideo_decoder_select="bswapdsp"
|
||||
rscc_decoder_deps="zlib"
|
||||
rtjpeg_decoder_select="me_cmp"
|
||||
@ -2917,8 +2927,8 @@ rv10_decoder_select="h263_decoder"
|
||||
rv10_encoder_select="h263_encoder"
|
||||
rv20_decoder_select="h263_decoder"
|
||||
rv20_encoder_select="h263_encoder"
|
||||
rv30_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp"
|
||||
rv40_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp"
|
||||
rv30_decoder_select="golomb h264pred h264qpel mpegvideodec rv34dsp"
|
||||
rv40_decoder_select="golomb h264pred h264qpel mpegvideodec rv34dsp"
|
||||
screenpresso_decoder_deps="zlib"
|
||||
shorten_decoder_select="bswapdsp"
|
||||
sipr_decoder_select="lsp"
|
||||
@ -2931,7 +2941,7 @@ sonic_ls_encoder_select="golomb rangecoder"
|
||||
sp5x_decoder_select="mjpeg_decoder"
|
||||
speedhq_decoder_select="mpegvideo"
|
||||
speedhq_encoder_select="mpegvideoenc"
|
||||
srgc_decoder_deps="zlib"
|
||||
srgc_decoder_select="inflate_wrapper"
|
||||
svq1_decoder_select="hpeldsp"
|
||||
svq1_encoder_select="hpeldsp me_cmp mpegvideoenc"
|
||||
svq3_decoder_select="golomb h264dsp h264parse h264pred hpeldsp tpeldsp videodsp"
|
||||
@ -2948,13 +2958,15 @@ truehd_decoder_select="mlp_parser"
|
||||
truehd_encoder_select="lpc audio_frame_queue"
|
||||
truemotion2_decoder_select="bswapdsp"
|
||||
truespeech_decoder_select="bswapdsp"
|
||||
tscc_decoder_deps="zlib"
|
||||
tscc_decoder_select="inflate_wrapper"
|
||||
twinvq_decoder_select="mdct lsp sinewin"
|
||||
txd_decoder_select="texturedsp"
|
||||
utvideo_decoder_select="bswapdsp llviddsp"
|
||||
utvideo_encoder_select="bswapdsp huffman llvidencdsp"
|
||||
vble_decoder_select="llviddsp"
|
||||
vc1_decoder_select="blockdsp h263_decoder h264qpel intrax8 mpegvideo vc1dsp"
|
||||
vbn_decoder_select="texturedsp"
|
||||
vbn_encoder_select="texturedspenc"
|
||||
vc1_decoder_select="blockdsp h263_decoder h264qpel intrax8 mpegvideodec vc1dsp"
|
||||
vc1image_decoder_select="vc1_decoder"
|
||||
vorbis_decoder_select="mdct"
|
||||
vorbis_encoder_select="audio_frame_queue mdct"
|
||||
@ -2967,7 +2979,7 @@ vp6f_decoder_select="vp6_decoder"
|
||||
vp7_decoder_select="h264pred videodsp vp8dsp"
|
||||
vp8_decoder_select="h264pred videodsp vp8dsp"
|
||||
vp9_decoder_select="videodsp vp9_parser vp9_superframe_split_bsf"
|
||||
wcmv_decoder_deps="zlib"
|
||||
wcmv_decoder_select="inflate_wrapper"
|
||||
webp_decoder_select="vp8_decoder exif"
|
||||
wmalossless_decoder_select="llauddsp"
|
||||
wmapro_decoder_select="mdct sinewin wma_freqs"
|
||||
@ -2985,11 +2997,11 @@ wmv3image_decoder_select="wmv3_decoder"
|
||||
xma1_decoder_select="wmapro_decoder"
|
||||
xma2_decoder_select="wmapro_decoder"
|
||||
ylc_decoder_select="bswapdsp"
|
||||
zerocodec_decoder_deps="zlib"
|
||||
zlib_decoder_deps="zlib"
|
||||
zlib_encoder_deps="zlib"
|
||||
zmbv_decoder_deps="zlib"
|
||||
zmbv_encoder_deps="zlib"
|
||||
zerocodec_decoder_select="inflate_wrapper"
|
||||
zlib_decoder_select="inflate_wrapper"
|
||||
zlib_encoder_select="deflate_wrapper"
|
||||
zmbv_decoder_select="inflate_wrapper"
|
||||
zmbv_encoder_select="deflate_wrapper"
|
||||
|
||||
# hardware accelerators
|
||||
crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
|
||||
@ -3003,7 +3015,6 @@ vaapi_x11_deps="xlib_x11"
|
||||
videotoolbox_hwaccel_deps="videotoolbox pthreads"
|
||||
videotoolbox_hwaccel_extralibs="-framework QuartzCore"
|
||||
vulkan_deps_any="libdl LoadLibrary"
|
||||
xvmc_deps="X11_extensions_XvMClib_h"
|
||||
|
||||
av1_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_AV1"
|
||||
av1_d3d11va_hwaccel_select="av1_decoder"
|
||||
@ -3015,6 +3026,8 @@ av1_nvdec_hwaccel_deps="nvdec CUVIDAV1PICPARAMS"
|
||||
av1_nvdec_hwaccel_select="av1_decoder"
|
||||
av1_vaapi_hwaccel_deps="vaapi VADecPictureParameterBufferAV1_bit_depth_idx"
|
||||
av1_vaapi_hwaccel_select="av1_decoder"
|
||||
av1_vdpau_hwaccel_deps="vdpau VdpPictureInfoAV1"
|
||||
av1_vdpau_hwaccel_select="av1_decoder"
|
||||
h263_vaapi_hwaccel_deps="vaapi"
|
||||
h263_vaapi_hwaccel_select="h263_decoder"
|
||||
h263_videotoolbox_hwaccel_deps="videotoolbox"
|
||||
@ -3051,16 +3064,12 @@ mjpeg_nvdec_hwaccel_deps="nvdec"
|
||||
mjpeg_nvdec_hwaccel_select="mjpeg_decoder"
|
||||
mjpeg_vaapi_hwaccel_deps="vaapi"
|
||||
mjpeg_vaapi_hwaccel_select="mjpeg_decoder"
|
||||
mpeg_xvmc_hwaccel_deps="xvmc"
|
||||
mpeg_xvmc_hwaccel_select="mpeg2video_decoder"
|
||||
mpeg1_nvdec_hwaccel_deps="nvdec"
|
||||
mpeg1_nvdec_hwaccel_select="mpeg1video_decoder"
|
||||
mpeg1_vdpau_hwaccel_deps="vdpau"
|
||||
mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
|
||||
mpeg1_videotoolbox_hwaccel_deps="videotoolbox"
|
||||
mpeg1_videotoolbox_hwaccel_select="mpeg1video_decoder"
|
||||
mpeg1_xvmc_hwaccel_deps="xvmc"
|
||||
mpeg1_xvmc_hwaccel_select="mpeg1video_decoder"
|
||||
mpeg2_d3d11va_hwaccel_deps="d3d11va"
|
||||
mpeg2_d3d11va_hwaccel_select="mpeg2video_decoder"
|
||||
mpeg2_d3d11va2_hwaccel_deps="d3d11va"
|
||||
@ -3075,8 +3084,6 @@ mpeg2_vdpau_hwaccel_deps="vdpau"
|
||||
mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
|
||||
mpeg2_videotoolbox_hwaccel_deps="videotoolbox"
|
||||
mpeg2_videotoolbox_hwaccel_select="mpeg2video_decoder"
|
||||
mpeg2_xvmc_hwaccel_deps="xvmc"
|
||||
mpeg2_xvmc_hwaccel_select="mpeg2video_decoder"
|
||||
mpeg4_nvdec_hwaccel_deps="nvdec"
|
||||
mpeg4_nvdec_hwaccel_select="mpeg4_decoder"
|
||||
mpeg4_vaapi_hwaccel_deps="vaapi"
|
||||
@ -3126,7 +3133,6 @@ wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
|
||||
|
||||
# hardware-accelerated codecs
|
||||
mediafoundation_deps="mftransform_h MFCreateAlignedMemoryBuffer"
|
||||
mediafoundation_extralibs="-lmfplat -lmfuuid -lole32 -lstrmiids"
|
||||
omx_deps="libdl pthreads"
|
||||
omx_rpi_select="omx"
|
||||
qsv_deps="libmfx"
|
||||
@ -3136,6 +3142,8 @@ qsvvpp_select="qsv"
|
||||
vaapi_encode_deps="vaapi"
|
||||
v4l2_m2m_deps="linux_videodev2_h sem_timedwait"
|
||||
|
||||
chromakey_cuda_filter_deps="ffnvcodec"
|
||||
chromakey_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
|
||||
hwupload_cuda_filter_deps="ffnvcodec"
|
||||
scale_npp_filter_deps="ffnvcodec libnpp"
|
||||
scale2ref_npp_filter_deps="ffnvcodec libnpp"
|
||||
@ -3250,7 +3258,7 @@ h264_parser_select="atsc_a53 golomb h264dsp h264parse"
|
||||
hevc_parser_select="hevcparse"
|
||||
mpegaudio_parser_select="mpegaudioheader"
|
||||
mpegvideo_parser_select="mpegvideo"
|
||||
mpeg4video_parser_select="h263dsp mpegvideo qpeldsp"
|
||||
mpeg4video_parser_select="h263dsp mpegvideodec qpeldsp"
|
||||
vc1_parser_select="vc1dsp"
|
||||
|
||||
# bitstream_filters
|
||||
@ -3292,7 +3300,6 @@ mp2_at_decoder_select="mpegaudioheader"
|
||||
mp3_at_decoder_select="mpegaudioheader"
|
||||
pcm_alaw_at_decoder_deps="audiotoolbox"
|
||||
pcm_mulaw_at_decoder_deps="audiotoolbox"
|
||||
qdmc_decoder_select="fft"
|
||||
qdmc_at_decoder_deps="audiotoolbox"
|
||||
qdm2_at_decoder_deps="audiotoolbox"
|
||||
aac_at_encoder_deps="audiotoolbox"
|
||||
@ -3322,6 +3329,7 @@ libcodec2_encoder_deps="libcodec2"
|
||||
libdav1d_decoder_deps="libdav1d"
|
||||
libdav1d_decoder_select="atsc_a53"
|
||||
libdavs2_decoder_deps="libdavs2"
|
||||
libdavs2_decoder_select="avs2_parser"
|
||||
libfdk_aac_decoder_deps="libfdk_aac"
|
||||
libfdk_aac_encoder_deps="libfdk_aac"
|
||||
libfdk_aac_encoder_select="audio_frame_queue"
|
||||
@ -3332,6 +3340,8 @@ libgsm_ms_decoder_deps="libgsm"
|
||||
libgsm_ms_encoder_deps="libgsm"
|
||||
libilbc_decoder_deps="libilbc"
|
||||
libilbc_encoder_deps="libilbc"
|
||||
libjxl_decoder_deps="libjxl libjxl_threads"
|
||||
libjxl_encoder_deps="libjxl libjxl_threads"
|
||||
libkvazaar_encoder_deps="libkvazaar"
|
||||
libmodplug_demuxer_deps="libmodplug"
|
||||
libmp3lame_encoder_deps="libmp3lame"
|
||||
@ -3399,6 +3409,7 @@ asf_stream_muxer_select="asf_muxer"
|
||||
av1_demuxer_select="av1_frame_merge_bsf av1_parser"
|
||||
avi_demuxer_select="riffdec exif"
|
||||
avi_muxer_select="riffenc"
|
||||
avif_muxer_select="mov_muxer"
|
||||
caf_demuxer_select="iso_media"
|
||||
caf_muxer_select="iso_media"
|
||||
dash_muxer_select="mp4_muxer"
|
||||
@ -3429,13 +3440,13 @@ ivf_muxer_select="av1_metadata_bsf vp9_superframe_bsf"
|
||||
latm_muxer_select="aac_adtstoasc_bsf mpeg4audio"
|
||||
matroska_audio_muxer_select="matroska_muxer"
|
||||
matroska_demuxer_select="riffdec"
|
||||
matroska_demuxer_suggest="bzlib lzo zlib"
|
||||
matroska_muxer_select="mpeg4audio riffenc vp9_superframe_bsf aac_adtstoasc_bsf"
|
||||
matroska_demuxer_suggest="bzlib zlib"
|
||||
matroska_muxer_select="mpeg4audio riffenc aac_adtstoasc_bsf pgs_frame_merge_bsf vp9_superframe_bsf"
|
||||
mlp_demuxer_select="mlp_parser"
|
||||
mmf_muxer_select="riffenc"
|
||||
mov_demuxer_select="iso_media riffdec"
|
||||
mov_demuxer_suggest="zlib"
|
||||
mov_muxer_select="iso_media riffenc rtpenc_chain vp9_superframe_bsf aac_adtstoasc_bsf"
|
||||
mov_muxer_select="iso_media riffenc rtpenc_chain vp9_superframe_bsf aac_adtstoasc_bsf ac3_parser"
|
||||
mp3_demuxer_select="mpegaudio_parser"
|
||||
mp3_muxer_select="mpegaudioheader"
|
||||
mp4_muxer_select="mov_muxer"
|
||||
@ -3582,6 +3593,8 @@ udp_protocol_select="network"
|
||||
udplite_protocol_select="network"
|
||||
unix_protocol_deps="sys_un_h"
|
||||
unix_protocol_select="network"
|
||||
ipfs_protocol_select="https_protocol"
|
||||
ipns_protocol_select="https_protocol"
|
||||
|
||||
# external library protocols
|
||||
libamqp_protocol_deps="librabbitmq"
|
||||
@ -3602,19 +3615,16 @@ libzmq_protocol_deps="libzmq"
|
||||
libzmq_protocol_select="network"
|
||||
|
||||
# filters
|
||||
afir_filter_deps="avcodec"
|
||||
afir_filter_select="rdft"
|
||||
ametadata_filter_deps="avformat"
|
||||
amovie_filter_deps="avcodec avformat"
|
||||
aresample_filter_deps="swresample"
|
||||
asr_filter_deps="pocketsphinx"
|
||||
ass_filter_deps="libass"
|
||||
atempo_filter_deps="avcodec"
|
||||
atempo_filter_select="rdft"
|
||||
avgblur_opencl_filter_deps="opencl"
|
||||
avgblur_vulkan_filter_deps="vulkan spirv_compiler"
|
||||
azmq_filter_deps="libzmq"
|
||||
blackframe_filter_deps="gpl"
|
||||
blend_vulkan_filter_deps="vulkan spirv_compiler"
|
||||
bm3d_filter_deps="avcodec"
|
||||
bm3d_filter_select="dct"
|
||||
boxblur_filter_deps="gpl"
|
||||
@ -3646,10 +3656,6 @@ drawtext_filter_suggest="libfontconfig libfribidi"
|
||||
elbg_filter_deps="avcodec"
|
||||
eq_filter_deps="gpl"
|
||||
erosion_opencl_filter_deps="opencl"
|
||||
fftfilt_filter_deps="avcodec"
|
||||
fftfilt_filter_select="rdft"
|
||||
fftdnoiz_filter_deps="avcodec"
|
||||
fftdnoiz_filter_select="fft"
|
||||
find_rect_filter_deps="avcodec avformat gpl"
|
||||
firequalizer_filter_deps="avcodec"
|
||||
firequalizer_filter_select="rdft"
|
||||
@ -3665,6 +3671,8 @@ gblur_vulkan_filter_deps="vulkan spirv_compiler"
|
||||
hflip_vulkan_filter_deps="vulkan spirv_compiler"
|
||||
histeq_filter_deps="gpl"
|
||||
hqdn3d_filter_deps="gpl"
|
||||
iccdetect_filter_deps="lcms2"
|
||||
iccgen_filter_deps="lcms2"
|
||||
interlace_filter_deps="gpl"
|
||||
kerndeint_filter_deps="gpl"
|
||||
ladspa_filter_deps="ladspa libdl"
|
||||
@ -3687,6 +3695,7 @@ openclsrc_filter_deps="opencl"
|
||||
overlay_opencl_filter_deps="opencl"
|
||||
overlay_qsv_filter_deps="libmfx"
|
||||
overlay_qsv_filter_select="qsvvpp"
|
||||
overlay_vaapi_filter_deps="vaapi VAProcPipelineCaps_blend_flags"
|
||||
overlay_vulkan_filter_deps="vulkan spirv_compiler"
|
||||
owdenoise_filter_deps="gpl"
|
||||
pad_opencl_filter_deps="opencl"
|
||||
@ -3699,6 +3708,7 @@ prewitt_opencl_filter_deps="opencl"
|
||||
procamp_vaapi_filter_deps="vaapi"
|
||||
program_opencl_filter_deps="opencl"
|
||||
pullup_filter_deps="gpl"
|
||||
remap_opencl_filter_deps="opencl"
|
||||
removelogo_filter_deps="avcodec avformat swscale"
|
||||
repeatfields_filter_deps="gpl"
|
||||
roberts_opencl_filter_deps="opencl"
|
||||
@ -3715,8 +3725,6 @@ showcqt_filter_suggest="libfontconfig libfreetype"
|
||||
showspatial_filter_deps="avcodec"
|
||||
showspatial_filter_select="fft"
|
||||
signature_filter_deps="gpl avcodec avformat"
|
||||
sinc_filter_deps="avcodec"
|
||||
sinc_filter_select="rdft"
|
||||
smartblur_filter_deps="gpl swscale"
|
||||
sobel_opencl_filter_deps="opencl"
|
||||
sofalizer_filter_deps="libmysofa"
|
||||
@ -3728,10 +3736,6 @@ stereo3d_filter_deps="gpl"
|
||||
subtitles_filter_deps="avformat avcodec libass"
|
||||
super2xsai_filter_deps="gpl"
|
||||
pixfmts_super2xsai_test_deps="super2xsai_filter"
|
||||
superequalizer_filter_deps="avcodec"
|
||||
superequalizer_filter_select="rdft"
|
||||
surround_filter_deps="avcodec"
|
||||
surround_filter_select="rdft"
|
||||
tinterlace_filter_deps="gpl"
|
||||
tinterlace_merge_test_deps="tinterlace_filter"
|
||||
tinterlace_pad_test_deps="tinterlace_filter"
|
||||
@ -3747,7 +3751,7 @@ vaguedenoiser_filter_deps="gpl"
|
||||
vflip_vulkan_filter_deps="vulkan spirv_compiler"
|
||||
vidstabdetect_filter_deps="libvidstab"
|
||||
vidstabtransform_filter_deps="libvidstab"
|
||||
libvmaf_filter_deps="libvmaf pthreads"
|
||||
libvmaf_filter_deps="libvmaf"
|
||||
zmq_filter_deps="libzmq"
|
||||
zoompan_filter_deps="swscale"
|
||||
zscale_filter_deps="libzimg const_nan"
|
||||
@ -4000,14 +4004,14 @@ OUTDEV_LIST=$(find_things_extern muxer AVOutputFormat libavdevice/alldevices.c o
|
||||
INDEV_LIST=$(find_things_extern demuxer AVInputFormat libavdevice/alldevices.c indev)
|
||||
MUXER_LIST=$(find_things_extern muxer AVOutputFormat libavformat/allformats.c)
|
||||
DEMUXER_LIST=$(find_things_extern demuxer AVInputFormat libavformat/allformats.c)
|
||||
ENCODER_LIST=$(find_things_extern encoder AVCodec libavcodec/allcodecs.c)
|
||||
DECODER_LIST=$(find_things_extern decoder AVCodec libavcodec/allcodecs.c)
|
||||
ENCODER_LIST=$(find_things_extern encoder FFCodec libavcodec/allcodecs.c)
|
||||
DECODER_LIST=$(find_things_extern decoder FFCodec libavcodec/allcodecs.c)
|
||||
CODEC_LIST="
|
||||
$ENCODER_LIST
|
||||
$DECODER_LIST
|
||||
"
|
||||
PARSER_LIST=$(find_things_extern parser AVCodecParser libavcodec/parsers.c)
|
||||
BSF_LIST=$(find_things_extern bsf AVBitStreamFilter libavcodec/bitstream_filters.c)
|
||||
BSF_LIST=$(find_things_extern bsf FFBitStreamFilter libavcodec/bitstream_filters.c)
|
||||
HWACCEL_LIST=$(find_things_extern hwaccel AVHWAccel libavcodec/hwaccels.h)
|
||||
PROTOCOL_LIST=$(find_things_extern protocol URLProtocol libavformat/protocols.c)
|
||||
|
||||
@ -4420,11 +4424,7 @@ cc_default="${cross_prefix}${cc_default}"
|
||||
cxx_default="${cross_prefix}${cxx_default}"
|
||||
nm_default="${cross_prefix}${nm_default}"
|
||||
pkg_config_default="${cross_prefix}${pkg_config_default}"
|
||||
if ${cross_prefix}${ranlib_default} 2>&1 | grep -q "\-D "; then
|
||||
ranlib_default="${cross_prefix}${ranlib_default} -D"
|
||||
else
|
||||
ranlib_default="${cross_prefix}${ranlib_default}"
|
||||
fi
|
||||
ranlib_default="${cross_prefix}${ranlib_default}"
|
||||
strip_default="${cross_prefix}${strip_default}"
|
||||
windres_default="${cross_prefix}${windres_default}"
|
||||
|
||||
@ -4457,6 +4457,10 @@ set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \
|
||||
enabled cross_compile || host_cc_default=$cc
|
||||
set_default host_cc
|
||||
|
||||
if ${ranlib} 2>&1 | grep -q "\-D "; then
|
||||
ranlib="${ranlib} -D"
|
||||
fi
|
||||
|
||||
pkg_config_fail_message=""
|
||||
if ! $pkg_config --version >/dev/null 2>&1; then
|
||||
warn "$pkg_config not found, library detection may fail."
|
||||
@ -6146,10 +6150,11 @@ EOF
|
||||
elf*) enabled debug && append X86ASMFLAGS $x86asm_debug ;;
|
||||
esac
|
||||
|
||||
enabled avx512 && check_x86asm avx512_external "vmovdqa32 [eax]{k1}{z}, zmm0"
|
||||
enabled avx2 && check_x86asm avx2_external "vextracti128 xmm0, ymm0, 0"
|
||||
enabled xop && check_x86asm xop_external "vpmacsdd xmm0, xmm1, xmm2, xmm3"
|
||||
enabled fma4 && check_x86asm fma4_external "vfmaddps ymm0, ymm1, ymm2, ymm3"
|
||||
enabled avx512 && check_x86asm avx512_external "vmovdqa32 [eax]{k1}{z}, zmm0"
|
||||
enabled avx512icl && check_x86asm avx512icl_external "vpdpwssds zmm31{k1}{z}, zmm29, zmm28"
|
||||
enabled avx2 && check_x86asm avx2_external "vextracti128 xmm0, ymm0, 0"
|
||||
enabled xop && check_x86asm xop_external "vpmacsdd xmm0, xmm1, xmm2, xmm3"
|
||||
enabled fma4 && check_x86asm fma4_external "vfmaddps ymm0, ymm1, ymm2, ymm3"
|
||||
check_x86asm cpunop "CPU amdnop"
|
||||
fi
|
||||
|
||||
@ -6260,6 +6265,7 @@ check_func_headers lzo/lzo1x.h lzo1x_999_compress
|
||||
check_func_headers mach/mach_time.h mach_absolute_time
|
||||
check_func_headers stdlib.h getenv
|
||||
check_func_headers sys/stat.h lstat
|
||||
check_func_headers sys/auxv.h getauxval
|
||||
|
||||
check_func_headers windows.h GetModuleHandle
|
||||
check_func_headers windows.h GetProcessAffinityMask
|
||||
@ -6315,7 +6321,6 @@ check_headers unistd.h
|
||||
check_headers valgrind/valgrind.h
|
||||
check_func_headers VideoToolbox/VTCompressionSession.h VTCompressionSessionPrepareToEncodeFrames -framework VideoToolbox
|
||||
check_headers windows.h
|
||||
check_headers X11/extensions/XvMClib.h
|
||||
check_headers asm/types.h
|
||||
|
||||
# it seems there are versions of clang in some distros that try to use the
|
||||
@ -6393,6 +6398,7 @@ check_func_headers mfapi.h MFCreateAlignedMemoryBuffer -lmfplat
|
||||
|
||||
check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC"
|
||||
check_type "vdpau/vdpau.h" "VdpPictureInfoVP9"
|
||||
check_type "vdpau/vdpau.h" "VdpPictureInfoAV1"
|
||||
|
||||
if [ -z "$nvccflags" ]; then
|
||||
nvccflags=$nvccflags_default
|
||||
@ -6504,7 +6510,9 @@ for func in $COMPLEX_FUNCS; do
|
||||
done
|
||||
|
||||
# these are off by default, so fail if requested and not available
|
||||
enabled avisynth && require_headers "avisynth/avisynth_c.h"
|
||||
enabled avisynth && { require_headers "avisynth/avisynth_c.h avisynth/avs/version.h" &&
|
||||
{ test_cpp_condition avisynth/avs/version.h "AVS_MAJOR_VER >= 3 && AVS_MINOR_VER >= 7 && AVS_BUGFIX_VER >= 1 || AVS_MAJOR_VER >= 3 && AVS_MINOR_VER > 7 || AVS_MAJOR_VER > 3" ||
|
||||
die "ERROR: AviSynth+ header version must be >= 3.7.1"; } }
|
||||
enabled cuda_nvcc && { check_nvcc cuda_nvcc || die "ERROR: failed checking for nvcc."; }
|
||||
enabled chromaprint && require chromaprint chromaprint.h chromaprint_get_version -lchromaprint
|
||||
enabled decklink && { require_headers DeckLinkAPI.h &&
|
||||
@ -6514,6 +6522,7 @@ enabled gmp && require gmp gmp.h mpz_export -lgmp
|
||||
enabled gnutls && require_pkg_config gnutls gnutls gnutls/gnutls.h gnutls_global_init
|
||||
enabled jni && { [ $target_os = "android" ] && check_headers jni.h && enabled pthreads || die "ERROR: jni not found"; }
|
||||
enabled ladspa && require_headers "ladspa.h dlfcn.h"
|
||||
enabled lcms2 && require_pkg_config lcms2 "lcms2 >= 2.13" lcms2.h cmsCreateContext
|
||||
enabled libaom && require_pkg_config libaom "aom >= 1.0.0" aom/aom_codec.h aom_codec_version
|
||||
enabled libaribb24 && { check_pkg_config libaribb24 "aribb24 > 1.0.3" "aribb24/aribb24.h" arib_instance_new ||
|
||||
{ enabled gpl && require_pkg_config libaribb24 aribb24 "aribb24/aribb24.h" arib_instance_new; } ||
|
||||
@ -6553,6 +6562,8 @@ enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
|
||||
check_lib libgsm "${gsm_hdr}" gsm_create -lgsm && break;
|
||||
done || die "ERROR: libgsm not found"; }
|
||||
enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc $pthreads_extralibs
|
||||
enabled libjxl && require_pkg_config libjxl "libjxl >= 0.7.0" jxl/decode.h JxlDecoderVersion &&
|
||||
require_pkg_config libjxl_threads "libjxl_threads >= 0.7.0" jxl/thread_parallel_runner.h JxlThreadParallelRunner
|
||||
enabled libklvanc && require libklvanc libklvanc/vanc.h klvanc_context_create -lklvanc
|
||||
enabled libkvazaar && require_pkg_config libkvazaar "kvazaar >= 0.8.1" kvazaar.h kvz_api_get
|
||||
enabled liblensfun && require_pkg_config liblensfun lensfun lensfun.h lf_db_new
|
||||
@ -6562,8 +6573,11 @@ enabled liblensfun && require_pkg_config liblensfun lensfun lensfun.h lf_
|
||||
# Media SDK or Intel Media Server Studio, these don't come with
|
||||
# pkg-config support. Instead, users should make sure that the build
|
||||
# can find the libraries and headers through other means.
|
||||
enabled libmfx && { check_pkg_config libmfx libmfx "mfx/mfxvideo.h" MFXInit ||
|
||||
{ require libmfx "mfx/mfxvideo.h" MFXInit "-llibmfx $advapi32_extralibs" && warn "using libmfx without pkg-config"; } }
|
||||
enabled libmfx && { check_pkg_config libmfx "libmfx >= 1.28" "mfx/mfxvideo.h" MFXInit ||
|
||||
{ require libmfx "mfx/mfxvideo.h mfx/mfxdefs.h" MFXInit "-llibmfx $advapi32_extralibs" &&
|
||||
{ test_cpp_condition mfx/mfxdefs.h "MFX_VERSION >= 1028" || die "ERROR: libmfx version must be >= 1.28"; } &&
|
||||
warn "using libmfx without pkg-config"; } }
|
||||
|
||||
if enabled libmfx; then
|
||||
check_cc MFX_CODEC_VP9 "mfx/mfxvp9.h mfx/mfxstructures.h" "MFX_CODEC_VP9"
|
||||
fi
|
||||
@ -6598,7 +6612,7 @@ enabled libplacebo && require_pkg_config libplacebo "libplacebo >= 4.192.
|
||||
enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new
|
||||
enabled librabbitmq && require_pkg_config librabbitmq "librabbitmq >= 0.7.1" amqp.h amqp_new_connection
|
||||
enabled librav1e && require_pkg_config librav1e "rav1e >= 0.4.0" rav1e.h rav1e_context_new
|
||||
enabled librist && require_pkg_config librist "librist >= 0.2" librist/librist.h rist_receiver_create
|
||||
enabled librist && require_pkg_config librist "librist >= 0.2.7" librist/librist.h rist_receiver_create
|
||||
enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo
|
||||
enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket
|
||||
enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++"
|
||||
@ -6611,7 +6625,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
|
||||
enabled libssh && require_pkg_config libssh libssh libssh/sftp.h sftp_init
|
||||
enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
|
||||
enabled libsrt && require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket
|
||||
enabled libsvtav1 && require_pkg_config libsvtav1 "SvtAv1Enc >= 0.8.4" EbSvtAv1Enc.h svt_av1_enc_init_handle
|
||||
enabled libsvtav1 && require_pkg_config libsvtav1 "SvtAv1Enc >= 0.9.0" EbSvtAv1Enc.h svt_av1_enc_init_handle
|
||||
enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow
|
||||
enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate
|
||||
enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
|
||||
@ -6622,7 +6636,7 @@ enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame
|
||||
enabled libuavs3d && require_pkg_config libuavs3d "uavs3d >= 1.1.41" uavs3d.h uavs3d_decode
|
||||
enabled libv4l2 && require_pkg_config libv4l2 libv4l2 libv4l2.h v4l2_ioctl
|
||||
enabled libvidstab && require_pkg_config libvidstab "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit
|
||||
enabled libvmaf && require_pkg_config libvmaf "libvmaf >= 1.5.2" libvmaf.h compute_vmaf
|
||||
enabled libvmaf && require_pkg_config libvmaf "libvmaf >= 2.0.0" libvmaf.h vmaf_init
|
||||
enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
|
||||
enabled libvorbis && require_pkg_config libvorbis vorbis vorbis/codec.h vorbis_info_init &&
|
||||
require_pkg_config libvorbisenc vorbisenc vorbis/vorbisenc.h vorbis_encode_init
|
||||
@ -6652,10 +6666,10 @@ enabled libvpx && {
|
||||
enabled libwebp && {
|
||||
enabled libwebp_encoder && require_pkg_config libwebp "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion
|
||||
enabled libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
|
||||
enabled libx264 && { check_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode ||
|
||||
{ require libx264 "stdint.h x264.h" x264_encoder_encode "-lx264 $pthreads_extralibs $libm_extralibs" &&
|
||||
warn "using libx264 without pkg-config"; } } &&
|
||||
require_cpp_condition libx264 x264.h "X264_BUILD >= 118" &&
|
||||
enabled libx264 && check_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode &&
|
||||
require_cpp_condition libx264 x264.h "X264_BUILD >= 118" && {
|
||||
[ "$toolchain" != "msvc" ] ||
|
||||
require_cpp_condition libx264 x264.h "X264_BUILD >= 158"; } &&
|
||||
check_cpp_condition libx262 x264.h "X264_MPEG2"
|
||||
enabled libx265 && require_pkg_config libx265 x265 x265.h x265_api_get &&
|
||||
require_cpp_condition libx265 x265.h "X265_BUILD >= 70"
|
||||
@ -6739,12 +6753,12 @@ fi
|
||||
|
||||
if enabled sdl2; then
|
||||
SDL2_CONFIG="${cross_prefix}sdl2-config"
|
||||
test_pkg_config sdl2 "sdl2 >= 2.0.1 sdl2 < 2.1.0" SDL_events.h SDL_PollEvent
|
||||
test_pkg_config sdl2 "sdl2 >= 2.0.1 sdl2 < 3.0.0" SDL_events.h SDL_PollEvent
|
||||
if disabled sdl2 && "${SDL2_CONFIG}" --version > /dev/null 2>&1; then
|
||||
sdl2_cflags=$("${SDL2_CONFIG}" --cflags)
|
||||
sdl2_extralibs=$("${SDL2_CONFIG}" --libs)
|
||||
test_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags &&
|
||||
test_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags &&
|
||||
test_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x030000" $sdl2_cflags &&
|
||||
check_func_headers SDL_events.h SDL_PollEvent $sdl2_extralibs $sdl2_cflags &&
|
||||
enable sdl2
|
||||
fi
|
||||
@ -6872,6 +6886,9 @@ test_cpp <<EOF && enable uwp && d3d11va_extralibs="-ldxgi -ld3d11"
|
||||
#endif
|
||||
EOF
|
||||
|
||||
# mediafoundation requires linking directly to mfplat if building for uwp target
|
||||
enabled uwp && mediafoundation_extralibs="-lmfplat -lmfuuid -lole32 -lstrmiids" || mediafoundation_extralibs="-lmfuuid -lole32 -lstrmiids"
|
||||
|
||||
enabled libdrm &&
|
||||
check_pkg_config libdrm_getfb2 libdrm "xf86drmMode.h" drmModeGetFB2
|
||||
|
||||
@ -6892,6 +6909,7 @@ if enabled vaapi; then
|
||||
check_struct "va/va.h" "VADecPictureParameterBufferAV1" bit_depth_idx
|
||||
check_type "va/va.h va/va_vpp.h" "VAProcFilterParameterBufferHDRToneMapping"
|
||||
check_struct "va/va.h va/va_vpp.h" "VAProcPipelineCaps" rotation_flags
|
||||
check_struct "va/va.h va/va_vpp.h" "VAProcPipelineCaps" blend_flags
|
||||
check_type "va/va.h va/va_enc_hevc.h" "VAEncPictureParameterBufferHEVC"
|
||||
check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG"
|
||||
check_type "va/va.h va/va_enc_vp8.h" "VAEncPictureParameterBufferVP8"
|
||||
@ -7381,15 +7399,12 @@ done
|
||||
enabled zlib && add_cppflags -DZLIB_CONST
|
||||
|
||||
# conditional library dependencies, in any order
|
||||
enabled afir_filter && prepend avfilter_deps "avcodec"
|
||||
enabled amovie_filter && prepend avfilter_deps "avformat avcodec"
|
||||
enabled aresample_filter && prepend avfilter_deps "swresample"
|
||||
enabled atempo_filter && prepend avfilter_deps "avcodec"
|
||||
enabled bm3d_filter && prepend avfilter_deps "avcodec"
|
||||
enabled cover_rect_filter && prepend avfilter_deps "avformat avcodec"
|
||||
enabled ebur128_filter && enabled swresample && prepend avfilter_deps "swresample"
|
||||
enabled elbg_filter && prepend avfilter_deps "avcodec"
|
||||
enabled fftfilt_filter && prepend avfilter_deps "avcodec"
|
||||
enabled find_rect_filter && prepend avfilter_deps "avformat avcodec"
|
||||
enabled firequalizer_filter && prepend avfilter_deps "avcodec"
|
||||
enabled mcdeint_filter && prepend avfilter_deps "avcodec"
|
||||
@ -7489,6 +7504,7 @@ if enabled x86; then
|
||||
echo "AVX enabled ${avx-no}"
|
||||
echo "AVX2 enabled ${avx2-no}"
|
||||
echo "AVX-512 enabled ${avx512-no}"
|
||||
echo "AVX-512ICL enabled ${avx512icl-no}"
|
||||
echo "XOP enabled ${xop-no}"
|
||||
echo "FMA3 enabled ${fma3-no}"
|
||||
echo "FMA4 enabled ${fma4-no}"
|
||||
@ -7806,17 +7822,30 @@ print_config ARCH_ "$config_files" $ARCH_LIST
|
||||
print_config HAVE_ "$config_files" $HAVE_LIST
|
||||
print_config CONFIG_ "$config_files" $CONFIG_LIST \
|
||||
$CONFIG_EXTRA \
|
||||
$ALL_COMPONENTS \
|
||||
|
||||
echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
|
||||
echo "endif # FFMPEG_CONFIG_MAK" >> ffbuild/config.mak
|
||||
|
||||
# Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
|
||||
cp_if_changed $TMPH config.h
|
||||
touch ffbuild/.config
|
||||
|
||||
# Copy config.asm before printing ALL_COMPONENTS; that's not needed in assembly.
|
||||
enabled x86asm && cp_if_changed $TMPASM config.asm
|
||||
|
||||
# Reopen a new TMPH for config_components.h.
|
||||
cat > $TMPH <<EOF
|
||||
/* Automatically generated by configure - do not modify! */
|
||||
#ifndef FFMPEG_CONFIG_COMPONENTS_H
|
||||
#define FFMPEG_CONFIG_COMPONENTS_H
|
||||
EOF
|
||||
|
||||
print_config CONFIG_ "$config_files" $ALL_COMPONENTS
|
||||
|
||||
echo "#endif /* FFMPEG_CONFIG_COMPONENTS_H */" >> $TMPH
|
||||
echo "endif # FFMPEG_CONFIG_MAK" >> ffbuild/config.mak
|
||||
|
||||
cp_if_changed $TMPH config_components.h
|
||||
|
||||
cat > $TMPH <<EOF
|
||||
/* Generated by ffmpeg configure */
|
||||
#ifndef AVUTIL_AVCONFIG_H
|
||||
@ -7867,9 +7896,9 @@ print_enabled_components(){
|
||||
}
|
||||
|
||||
print_enabled_components libavfilter/filter_list.c AVFilter filter_list $FILTER_LIST
|
||||
print_enabled_components libavcodec/codec_list.c AVCodec codec_list $CODEC_LIST
|
||||
print_enabled_components libavcodec/codec_list.c FFCodec codec_list $CODEC_LIST
|
||||
print_enabled_components libavcodec/parser_list.c AVCodecParser parser_list $PARSER_LIST
|
||||
print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter bitstream_filters $BSF_LIST
|
||||
print_enabled_components libavcodec/bsf_list.c FFBitStreamFilter bitstream_filters $BSF_LIST
|
||||
print_enabled_components libavformat/demuxer_list.c AVInputFormat demuxer_list $DEMUXER_LIST
|
||||
print_enabled_components libavformat/muxer_list.c AVOutputFormat muxer_list $MUXER_LIST
|
||||
print_enabled_components libavdevice/indev_list.c AVInputFormat indev_list $INDEV_LIST
|
||||
|
@ -14,6 +14,92 @@ libavutil: 2021-04-27
|
||||
|
||||
API changes, most recent first:
|
||||
|
||||
-------- 8< --------- FFmpeg 5.1 was cut here -------- 8< ---------
|
||||
|
||||
2022-06-12 - 7cae3d8b76 - lavf 59.25.100 - avio.h
|
||||
Add avio_vprintf(), similar to avio_printf() but allow to use it
|
||||
from within a function taking a variable argument list as input.
|
||||
|
||||
2022-06-12 - ff59ecc4de - lavu 57.27.100 - uuid.h
|
||||
Add UUID handling functions.
|
||||
Add av_uuid_parse(), av_uuid_urn_parse(), av_uuid_parse_range(),
|
||||
av_uuid_parse_range(), av_uuid_equal(), av_uuid_copy(), and av_uuid_nil().
|
||||
|
||||
2022-06-01 - d42b410e05 - lavu 57.26.100 - csp.h
|
||||
Add public API for colorspace structs.
|
||||
Add av_csp_luma_coeffs_from_avcsp(), av_csp_primaries_desc_from_id(),
|
||||
and av_csp_primaries_id_from_desc().
|
||||
|
||||
2022-05-23 - 4cdc14aa95 - lavu 57.25.100 - avutil.h
|
||||
Deprecate av_fopen_utf8() without replacement.
|
||||
|
||||
2022-03-16 - f3a0e2ee2b - all libraries - version_major.h
|
||||
Add lib<name>/version_major.h as new installed headers, which only
|
||||
contain the major version number (and corresponding API deprecation
|
||||
defines).
|
||||
|
||||
2022-03-15 - cdba98bb80 - swr 4.5.100 - swresample.h
|
||||
Add swr_alloc_set_opts2() and swr_build_matrix2().
|
||||
Deprecate swr_alloc_set_opts() and swr_build_matrix().
|
||||
|
||||
2022-03-15 - cdba98bb80 - lavfi 8.28.100 - avfilter.h buffersink.h buffersrc.h
|
||||
Update AVFilterLink for the new channel layout API: add ch_layout,
|
||||
deprecate channel_layout.
|
||||
|
||||
Update the buffersink filter sink for the new channel layout API:
|
||||
add av_buffersink_get_ch_layout() and the ch_layouts option,
|
||||
deprecate av_buffersink_get_channel_layout() and the channel_layouts option.
|
||||
|
||||
Update AVBufferSrcParameters for the new channel layout API:
|
||||
add ch_layout, deprecate channel_layout.
|
||||
|
||||
2022-03-15 - cdba98bb80 - lavf 59.19.100 - avformat.h
|
||||
Add AV_DISPOSITION_NON_DIEGETIC.
|
||||
|
||||
2022-03-15 - cdba98bb80 - lavc 59.24.100 - avcodec.h codec_par.h
|
||||
Update AVCodecParameters for the new channel layout API: add ch_layout,
|
||||
deprecate channels/channel_layout.
|
||||
|
||||
Update AVCodecContext for the new channel layout API: add ch_layout,
|
||||
deprecate channels/channel_layout.
|
||||
|
||||
Update AVCodec for the new channel layout API: add ch_layouts,
|
||||
deprecate channel_layouts.
|
||||
|
||||
2022-03-15 - cdba98bb80 - lavu 57.24.100 - channel_layout.h frame.h opt.h
|
||||
Add new channel layout API based on the AVChannelLayout struct.
|
||||
Add support for Ambisonic audio.
|
||||
Deprecate previous channel layout API based on uint64 bitmasks.
|
||||
|
||||
Add AV_OPT_TYPE_CHLAYOUT option type, deprecate AV_OPT_TYPE_CHANNEL_LAYOUT.
|
||||
Update AVFrame for the new channel layout API: add ch_layout, deprecate
|
||||
channels/channel_layout.
|
||||
|
||||
2022-03-10 - f629ea2e18 - lavu 57.23.100 - cpu.h
|
||||
Add AV_CPU_FLAG_AVX512ICL.
|
||||
|
||||
2022-02-07 - a10f1aec1f - lavu 57.21.100 - fifo.h
|
||||
Deprecate AVFifoBuffer and the API around it, namely av_fifo_alloc(),
|
||||
av_fifo_alloc_array(), av_fifo_free(), av_fifo_freep(), av_fifo_reset(),
|
||||
av_fifo_size(), av_fifo_space(), av_fifo_generic_peek_at(),
|
||||
av_fifo_generic_peek(), av_fifo_generic_read(), av_fifo_generic_write(),
|
||||
av_fifo_realloc2(), av_fifo_grow(), av_fifo_drain() and av_fifo_peek2().
|
||||
Users should switch to the AVFifo-API.
|
||||
|
||||
2022-02-07 - 7329b22c05 - lavu 57.20.100 - fifo.h
|
||||
Add a new FIFO API, which allows setting a FIFO element size.
|
||||
This API operates on these elements rather than on bytes.
|
||||
Add av_fifo_alloc2(), av_fifo_elem_size(), av_fifo_can_read(),
|
||||
av_fifo_can_write(), av_fifo_grow2(), av_fifo_drain2(), av_fifo_write(),
|
||||
av_fifo_write_from_cb(), av_fifo_read(), av_fifo_read_to_cb(),
|
||||
av_fifo_peek(), av_fifo_peek_to_cb(), av_fifo_drain2(), av_fifo_reset2(),
|
||||
av_fifo_freep2(), av_fifo_auto_grow_limit().
|
||||
|
||||
2022-01-26 - af94ab7c7c0 - lavu 57.19.100 - tx.h
|
||||
Add AV_TX_FLOAT_RDFT, AV_TX_DOUBLE_RDFT and AV_TX_INT32_RDFT.
|
||||
|
||||
-------- 8< --------- FFmpeg 5.0 was cut here -------- 8< ---------
|
||||
|
||||
2022-01-04 - 78dc21b123e - lavu 57.16.100 - frame.h
|
||||
Add AV_FRAME_DATA_DOVI_METADATA.
|
||||
|
||||
@ -1603,7 +1689,7 @@ API changes, most recent first:
|
||||
2014-04-15 - ef818d8 - lavf 55.37.101 - avformat.h
|
||||
Add av_format_inject_global_side_data()
|
||||
|
||||
2014-04-12 - 4f698be - lavu 52.76.100 - log.h
|
||||
2014-04-12 - 4f698be8f - lavu 52.76.100 - log.h
|
||||
Add av_log_get_flags()
|
||||
|
||||
2014-04-11 - 6db42a2b - lavd 55.12.100 - avdevice.h
|
||||
|
@ -38,7 +38,7 @@ PROJECT_NAME = FFmpeg
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 5.0.1
|
||||
PROJECT_NUMBER = 5.1
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
|
@ -27,6 +27,9 @@ HTMLPAGES = $(AVPROGS-yes:%=doc/%.html) $(AVPROGS-yes:%=doc/%-all.html) $(COMP
|
||||
doc/mailing-list-faq.html \
|
||||
doc/nut.html \
|
||||
doc/platform.html \
|
||||
$(SRC_PATH)/doc/bootstrap.min.css \
|
||||
$(SRC_PATH)/doc/style.min.css \
|
||||
$(SRC_PATH)/doc/default.css \
|
||||
|
||||
TXTPAGES = doc/fate.txt \
|
||||
|
||||
|
@ -132,6 +132,36 @@ the header stored in extradata to the key packets:
|
||||
ffmpeg -i INPUT -map 0 -flags:v +global_header -c:v libx264 -bsf:v dump_extra out.ts
|
||||
@end example
|
||||
|
||||
@section dv_error_marker
|
||||
|
||||
Blocks in DV which are marked as damaged are replaced by blocks of the specified color.
|
||||
|
||||
@table @option
|
||||
@item color
|
||||
The color to replace damaged blocks by
|
||||
@item sta
|
||||
A 16 bit mask which specifies which of the 16 possible error status values are
|
||||
to be replaced by colored blocks. 0xFFFE is the default which replaces all non 0
|
||||
error status values.
|
||||
@table @samp
|
||||
@item ok
|
||||
No error, no concealment
|
||||
@item err
|
||||
Error, No concealment
|
||||
@item res
|
||||
Reserved
|
||||
@item notok
|
||||
Error or concealment
|
||||
@item notres
|
||||
Not reserved
|
||||
@item Aa, Ba, Ca, Ab, Bb, Cb, A, B, C, a, b, erri, erru
|
||||
The specific error status code
|
||||
@end table
|
||||
see page 44-46 or section 5.5 of
|
||||
@url{http://web.archive.org/web/20060927044735/http://www.smpte.org/smpte_store/standards/pdf/s314m.pdf}
|
||||
|
||||
@end table
|
||||
|
||||
@section eac3_core
|
||||
|
||||
Extract the core from a E-AC-3 stream, dropping extra channels.
|
||||
@ -217,12 +247,16 @@ Modify metadata embedded in an H.264 stream.
|
||||
Insert or remove AUD NAL units in all access units of the stream.
|
||||
|
||||
@table @samp
|
||||
@item pass
|
||||
@item insert
|
||||
@item remove
|
||||
@end table
|
||||
|
||||
Default is pass.
|
||||
|
||||
@item sample_aspect_ratio
|
||||
Set the sample aspect ratio of the stream in the VUI parameters.
|
||||
See H.264 table E-1.
|
||||
|
||||
@item overscan_appropriate_flag
|
||||
Set whether the stream is suitable for display using overscan
|
||||
@ -281,6 +315,37 @@ insert the string ``hello'' associated with the given UUID.
|
||||
@item delete_filler
|
||||
Deletes both filler NAL units and filler SEI messages.
|
||||
|
||||
@item display_orientation
|
||||
Insert, extract or remove Display orientation SEI messages.
|
||||
See H.264 section D.1.27 and D.2.27 for syntax and semantics.
|
||||
|
||||
@table @samp
|
||||
@item pass
|
||||
@item insert
|
||||
@item remove
|
||||
@item extract
|
||||
@end table
|
||||
|
||||
Default is pass.
|
||||
|
||||
Insert mode works in conjunction with @code{rotate} and @code{flip} options.
|
||||
Any pre-existing Display orientation messages will be removed in insert or remove mode.
|
||||
Extract mode attaches the display matrix to the packet as side data.
|
||||
|
||||
@item rotate
|
||||
Set rotation in display orientation SEI (anticlockwise angle in degrees).
|
||||
Range is -360 to +360. Default is NaN.
|
||||
|
||||
@item flip
|
||||
Set flip in display orientation SEI.
|
||||
|
||||
@table @samp
|
||||
@item horizontal
|
||||
@item vertical
|
||||
@end table
|
||||
|
||||
Default is unset.
|
||||
|
||||
@item level
|
||||
Set the level in the SPS. Refer to H.264 section A.3 and tables A-1
|
||||
to A-5.
|
||||
@ -630,6 +695,14 @@ for NTSC frame rate using the @option{frame_rate} option.
|
||||
ffmpeg -f lavfi -i sine=r=48000:d=1 -c pcm_s16le -bsf pcm_rechunk=r=30000/1001 -f framecrc -
|
||||
@end example
|
||||
|
||||
@section pgs_frame_merge
|
||||
|
||||
Merge a sequence of PGS Subtitle segments ending with an "end of display set"
|
||||
segment into a single packet.
|
||||
|
||||
This is required by some containers that support PGS subtitles
|
||||
(muxer @code{matroska}).
|
||||
|
||||
@section prores_metadata
|
||||
|
||||
Modify color property metadata embedded in prores stream.
|
||||
@ -736,6 +809,10 @@ It accepts the following parameters:
|
||||
@item pts
|
||||
@item dts
|
||||
Set expressions for PTS, DTS or both.
|
||||
@item duration
|
||||
Set expression for duration.
|
||||
@item time_base
|
||||
Set output time base.
|
||||
@end table
|
||||
|
||||
The expressions are evaluated through the eval API and can contain the following
|
||||
@ -759,6 +836,9 @@ The demux timestamp in input.
|
||||
@item PTS
|
||||
The presentation timestamp in input.
|
||||
|
||||
@item DURATION
|
||||
The duration in input.
|
||||
|
||||
@item STARTDTS
|
||||
The DTS of the first packet.
|
||||
|
||||
@ -771,15 +851,33 @@ The previous input DTS.
|
||||
@item PREV_INPTS
|
||||
The previous input PTS.
|
||||
|
||||
@item PREV_INDURATION
|
||||
The previous input duration.
|
||||
|
||||
@item PREV_OUTDTS
|
||||
The previous output DTS.
|
||||
|
||||
@item PREV_OUTPTS
|
||||
The previous output PTS.
|
||||
|
||||
@item PREV_OUTDURATION
|
||||
The previous output duration.
|
||||
|
||||
@item NEXT_DTS
|
||||
The next input DTS.
|
||||
|
||||
@item NEXT_PTS
|
||||
The next input PTS.
|
||||
|
||||
@item NEXT_DURATION
|
||||
The next input duration.
|
||||
|
||||
@item TB
|
||||
The timebase of stream packet belongs.
|
||||
|
||||
@item TB_OUT
|
||||
The output timebase.
|
||||
|
||||
@item SR
|
||||
The sample rate of stream packet belongs.
|
||||
|
||||
|
@ -126,6 +126,63 @@ Set amount of frame threads to use during decoding. The default value is 0 (auto
|
||||
|
||||
@end table
|
||||
|
||||
@section QSV Decoders
|
||||
|
||||
The family of Intel QuickSync Video decoders (VC1, MPEG-2, H.264, HEVC,
|
||||
JPEG/MJPEG, VP8, VP9, AV1).
|
||||
|
||||
@subsection Common Options
|
||||
|
||||
The following options are supported by all qsv decoders.
|
||||
|
||||
@table @option
|
||||
|
||||
@item @var{async_depth}
|
||||
Internal parallelization depth, the higher the value the higher the latency.
|
||||
|
||||
@item @var{gpu_copy}
|
||||
A GPU-accelerated copy between video and system memory
|
||||
@table @samp
|
||||
@item default
|
||||
@item on
|
||||
@item off
|
||||
@end table
|
||||
|
||||
@end table
|
||||
|
||||
@subsection HEVC Options
|
||||
Extra options for hevc_qsv.
|
||||
|
||||
@table @option
|
||||
|
||||
@item @var{load_plugin}
|
||||
A user plugin to load in an internal session
|
||||
@table @samp
|
||||
@item none
|
||||
@item hevc_sw
|
||||
@item hevc_hw
|
||||
@end table
|
||||
|
||||
@item @var{load_plugins}
|
||||
A :-separate list of hexadecimal plugin UIDs to load in an internal session
|
||||
|
||||
@end table
|
||||
|
||||
@section v210
|
||||
|
||||
Uncompressed 4:2:2 10-bit decoder.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@table @option
|
||||
|
||||
@item custom_stride
|
||||
Set the line size of the v210 data in bytes. The default value is 0
|
||||
(autodetect). You can use the special -1 value for a strideless v210 as seen in
|
||||
BOXX files.
|
||||
|
||||
@end table
|
||||
|
||||
@c man end VIDEO DECODERS
|
||||
|
||||
@chapter Audio Decoders
|
||||
|
@ -274,6 +274,17 @@ which streams to actually receive.
|
||||
Each stream mirrors the @code{id} and @code{bandwidth} properties from the
|
||||
@code{<Representation>} as metadata keys named "id" and "variant_bitrate" respectively.
|
||||
|
||||
@subsection Options
|
||||
|
||||
This demuxer accepts the following option:
|
||||
|
||||
@table @option
|
||||
|
||||
@item cenc_decryption_key
|
||||
16-byte key, in hex, to decrypt files encrypted using ISO Common Encryption (CENC/AES-128 CTR; ISO/IEC 23001-7).
|
||||
|
||||
@end table
|
||||
|
||||
@section imf
|
||||
|
||||
Interoperable Master Format demuxer.
|
||||
@ -362,6 +373,9 @@ It accepts the following options:
|
||||
@item live_start_index
|
||||
segment index to start live streams at (negative values are from the end).
|
||||
|
||||
@item prefer_x_start
|
||||
prefer to use #EXT-X-START if it's in playlist instead of live_start_index.
|
||||
|
||||
@item allowed_extensions
|
||||
',' separated list of file extensions that hls is allowed to access.
|
||||
|
||||
@ -775,6 +789,10 @@ disabled). Default value is -1.
|
||||
@item merge_pmt_versions
|
||||
Re-use existing streams when a PMT's version is updated and elementary
|
||||
streams move to different PIDs. Default value is 0.
|
||||
|
||||
@item max_packet_size
|
||||
Set maximum size, in bytes, of packet emitted by the demuxer. Payloads above this size
|
||||
are split across multiple packets. Range is 1 to INT_MAX/2. Default is 204800 bytes.
|
||||
@end table
|
||||
|
||||
@section mpjpeg
|
||||
|
@ -1271,6 +1271,55 @@ follows.
|
||||
|
||||
A64 / Commodore 64 multicolor charset encoder. @code{a64_multi5} is extended with 5th color (colram).
|
||||
|
||||
@section Cinepak
|
||||
|
||||
Cinepak aka CVID encoder.
|
||||
Compatible with Windows 3.1 and vintage MacOS.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@table @option
|
||||
@item g @var{integer}
|
||||
Keyframe interval.
|
||||
A keyframe is inserted at least every @code{-g} frames, sometimes sooner.
|
||||
|
||||
@item q:v @var{integer}
|
||||
Quality factor. Lower is better. Higher gives lower bitrate.
|
||||
The following table lists bitrates when encoding akiyo_cif.y4m for various values of @code{-q:v} with @code{-g 100}:
|
||||
|
||||
@table @option
|
||||
@item @code{-q:v 1} 1918 kb/s
|
||||
@item @code{-q:v 2} 1735 kb/s
|
||||
@item @code{-q:v 4} 1500 kb/s
|
||||
@item @code{-q:v 10} 1041 kb/s
|
||||
@item @code{-q:v 20} 826 kb/s
|
||||
@item @code{-q:v 40} 553 kb/s
|
||||
@item @code{-q:v 100} 394 kb/s
|
||||
@item @code{-q:v 200} 312 kb/s
|
||||
@item @code{-q:v 400} 266 kb/s
|
||||
@item @code{-q:v 1000} 237 kb/s
|
||||
@end table
|
||||
|
||||
@item max_extra_cb_iterations @var{integer}
|
||||
Max extra codebook recalculation passes, more is better and slower.
|
||||
|
||||
@item skip_empty_cb @var{boolean}
|
||||
Avoid wasting bytes, ignore vintage MacOS decoder.
|
||||
|
||||
@item max_strips @var{integer}
|
||||
@itemx min_strips @var{integer}
|
||||
The minimum and maximum number of strips to use.
|
||||
Wider range sometimes improves quality.
|
||||
More strips is generally better quality but costs more bits.
|
||||
Fewer strips tend to yield more keyframes.
|
||||
Vintage compatible is 1..3.
|
||||
|
||||
@item strip_number_adaptivity @var{integer}
|
||||
How much number of strips is allowed to change between frames.
|
||||
Higher is better but slower.
|
||||
|
||||
@end table
|
||||
|
||||
@section GIF
|
||||
|
||||
GIF image/animation encoder.
|
||||
@ -1775,28 +1824,15 @@ This is the default.
|
||||
@item high
|
||||
@end table
|
||||
|
||||
@item rc
|
||||
Set the rate control mode to use.
|
||||
|
||||
Possible modes:
|
||||
@table @option
|
||||
@item cqp
|
||||
Constant quantizer: use fixed values of qindex (dependent on the frame type)
|
||||
throughout the stream. This mode is the default.
|
||||
|
||||
@item vbr
|
||||
Variable bitrate: use a target bitrate for the whole stream.
|
||||
|
||||
@item cvbr
|
||||
Constrained variable bitrate: use a target bitrate for each GOP.
|
||||
@end table
|
||||
|
||||
@item qmax
|
||||
Set the maximum quantizer to use when using a bitrate mode.
|
||||
|
||||
@item qmin
|
||||
Set the minimum quantizer to use when using a bitrate mode.
|
||||
|
||||
@item crf
|
||||
Constant rate factor value used in crf rate control mode (0-63).
|
||||
|
||||
@item qp
|
||||
Set the quantizer used in cqp rate control mode (0-63).
|
||||
|
||||
@ -1807,8 +1843,8 @@ Enable scene change detection.
|
||||
Set number of frames to look ahead (0-120).
|
||||
|
||||
@item preset
|
||||
Set the quality-speed tradeoff, in the range 0 to 8. Higher values are
|
||||
faster but lower quality. Defaults to 8 (highest speed).
|
||||
Set the quality-speed tradeoff, in the range 0 to 13. Higher values are
|
||||
faster but lower quality.
|
||||
|
||||
@item tile_rows
|
||||
Set log2 of the number of rows of tiles to use (0-6).
|
||||
@ -1816,6 +1852,45 @@ Set log2 of the number of rows of tiles to use (0-6).
|
||||
@item tile_columns
|
||||
Set log2 of the number of columns of tiles to use (0-4).
|
||||
|
||||
@item svtav1-params
|
||||
Set SVT-AV1 options using a list of @var{key}=@var{value} pairs separated
|
||||
by ":". See the SVT-AV1 encoder user guide for a list of accepted parameters.
|
||||
|
||||
@end table
|
||||
|
||||
@section libjxl
|
||||
|
||||
libjxl JPEG XL encoder wrapper.
|
||||
|
||||
Requires the presence of the libjxl headers and library during
|
||||
configuration. You need to explicitly configure the build with
|
||||
@code{--enable-libjxl}.
|
||||
|
||||
@subsection Options
|
||||
|
||||
The libjxl wrapper supports the following options:
|
||||
|
||||
@table @option
|
||||
|
||||
@item distance
|
||||
Set the target Butteraugli distance. This is a quality setting: lower
|
||||
distance yields higher quality, with distance=1.0 roughly comparable to
|
||||
libjpeg Quality 90 for photographic content. Setting distance=0.0 yields
|
||||
true lossless encoding. Valid values range between 0.0 and 15.0, and sane
|
||||
values rarely exceed 5.0. Setting distance=0.1 usually attains
|
||||
transparency for most input. The default is 1.0.
|
||||
|
||||
@item effort
|
||||
Set the encoding effort used. Higher effort values produce more consistent
|
||||
quality and usually produces a better quality/bpp curve, at the cost of
|
||||
more CPU time required. Valid values range from 1 to 9, and the default is 7.
|
||||
|
||||
@item modular
|
||||
Force the encoder to use Modular mode instead of choosing automatically. The
|
||||
default is to use VarDCT for lossy encoding and Modular for lossless. VarDCT
|
||||
is generally superior to Modular for lossy encoding but does not support
|
||||
lossless encoding.
|
||||
|
||||
@end table
|
||||
|
||||
@section libkvazaar
|
||||
@ -2005,8 +2080,11 @@ kilobits/s.
|
||||
@item keyint_min (@emph{kf-min-dist})
|
||||
|
||||
@item qmin (@emph{min-q})
|
||||
Minimum (Best Quality) Quantizer.
|
||||
|
||||
@item qmax (@emph{max-q})
|
||||
Maximum (Worst Quality) Quantizer.
|
||||
Can be changed per-frame.
|
||||
|
||||
@item bufsize (@emph{buf-sz}, @emph{buf-optimal-sz})
|
||||
Set ratecontrol buffer size (in bits). Note @command{vpxenc}'s options are
|
||||
@ -2270,11 +2348,10 @@ and compression tools used, and varies the combination of these tools. This
|
||||
maps to the @var{method} option in libwebp. The valid range is 0 to 6.
|
||||
Default is 4.
|
||||
|
||||
@item -qscale @var{float}
|
||||
For lossy encoding, this controls image quality, 0 to 100. For lossless
|
||||
encoding, this controls the effort and time spent at compressing more. The
|
||||
default value is 75. Note that for usage via libavcodec, this option is called
|
||||
@var{global_quality} and must be multiplied by @var{FF_QP2LAMBDA}.
|
||||
@item -quality @var{float}
|
||||
For lossy encoding, this controls image quality. For lossless encoding, this
|
||||
controls the effort and time spent in compression.
|
||||
Range is 0 to 100. Default is 75.
|
||||
|
||||
@item -preset @var{type}
|
||||
Configuration preset. This does some automatic settings based on the general
|
||||
@ -3123,12 +3200,13 @@ Setting a higher @option{bits_per_mb} limit will improve the speed.
|
||||
For the fastest encoding speed set the @option{qscale} parameter (4 is the
|
||||
recommended value) and do not set a size constraint.
|
||||
|
||||
@section QSV encoders
|
||||
@section QSV Encoders
|
||||
|
||||
The family of Intel QuickSync Video encoders (MPEG-2, H.264, HEVC, JPEG/MJPEG and VP9)
|
||||
The family of Intel QuickSync Video encoders (MPEG-2, H.264, HEVC, JPEG/MJPEG
|
||||
and VP9)
|
||||
|
||||
@subsection Ratecontrol Method
|
||||
The ratecontrol method is selected as follows:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
When @option{global_quality} is specified, a quality-based mode is used.
|
||||
@ -3176,6 +3254,7 @@ Note that depending on your system, a different mode than the one you specified
|
||||
may be selected by the encoder. Set the verbosity level to @var{verbose} or
|
||||
higher to see the actual settings used by the QSV runtime.
|
||||
|
||||
@subsection Global Options -> MSDK Options
|
||||
Additional libavcodec global options are mapped to MSDK options as follows:
|
||||
|
||||
@itemize
|
||||
@ -3212,6 +3291,389 @@ encoder use CAVLC instead of CABAC.
|
||||
|
||||
@end itemize
|
||||
|
||||
@subsection Common Options
|
||||
Following options are used by all qsv encoders.
|
||||
|
||||
@table @option
|
||||
@item @var{async_depth}
|
||||
Specifies how many asynchronous operations an application performs
|
||||
before the application explicitly synchronizes the result. If zero,
|
||||
the value is not specified.
|
||||
|
||||
@item @var{avbr_accuracy}
|
||||
Accuracy of the AVBR ratecontrol (unit of tenth of percent).
|
||||
|
||||
@item @var{avbr_convergence}
|
||||
Convergence of the AVBR ratecontrol (unit of 100 frames)
|
||||
|
||||
The parameters @var{avbr_accuracy} and @var{avbr_convergence} are for the
|
||||
average variable bitrate control (AVBR) algorithm.
|
||||
The algorithm focuses on overall encoding quality while meeting the specified
|
||||
bitrate, @var{target_bitrate}, within the accuracy range @var{avbr_accuracy},
|
||||
after a @var{avbr_Convergence} period. This method does not follow HRD and the
|
||||
instant bitrate is not capped or padded.
|
||||
|
||||
@item @var{preset}
|
||||
This option itemizes a range of choices from veryfast (best speed) to veryslow
|
||||
(best quality).
|
||||
@table @samp
|
||||
@item veryfast
|
||||
@item faster
|
||||
@item fast
|
||||
@item medium
|
||||
@item slow
|
||||
@item slower
|
||||
@item veryslow
|
||||
@end table
|
||||
|
||||
@item @var{forced_idr}
|
||||
Forcing I frames as IDR frames.
|
||||
|
||||
@item @var{low_power}
|
||||
For encoders set this flag to ON to reduce power consumption and GPU usage.
|
||||
@end table
|
||||
|
||||
@subsection Runtime Options
|
||||
Following options can be used durning qsv encoding.
|
||||
|
||||
@table @option
|
||||
@item @var{qsv_config_qp}
|
||||
Supported in h264_qsv and hevc_qsv.
|
||||
This option can be set in per-frame metadata. QP parameter can be dynamically
|
||||
changed when encoding in CQP mode.
|
||||
@end table
|
||||
|
||||
@subsection H264 options
|
||||
These options are used by h264_qsv
|
||||
|
||||
@table @option
|
||||
@item @var{extbrc}
|
||||
Extended bitrate control.
|
||||
|
||||
@item @var{recovery_point_sei}
|
||||
Set this flag to insert the recovery point SEI message at the beginning of every
|
||||
intra refresh cycle.
|
||||
|
||||
@item @var{rdo}
|
||||
Enable rate distortion optimization.
|
||||
|
||||
@item @var{max_frame_size}
|
||||
Maximum encoded frame size in bytes.
|
||||
|
||||
@item @var{max_frame_size_i}
|
||||
Maximum encoded frame size for I frames in bytes. If this value is set as larger
|
||||
than zero, then for I frames the value set by max_frame_size is ignored.
|
||||
|
||||
@item @var{max_frame_size_p}
|
||||
Maximum encoded frame size for P frames in bytes. If this value is set as larger
|
||||
than zero, then for P frames the value set by max_frame_size is ignored.
|
||||
|
||||
@item @var{max_slice_size}
|
||||
Maximum encoded slice size in bytes.
|
||||
|
||||
@item @var{bitrate_limit}
|
||||
Toggle bitrate limitations.
|
||||
Modifies bitrate to be in the range imposed by the QSV encoder. Setting this
|
||||
flag off may lead to violation of HRD conformance. Mind that specifying bitrate
|
||||
below the QSV encoder range might significantly affect quality. If on this
|
||||
option takes effect in non CQP modes: if bitrate is not in the range imposed
|
||||
by the QSV encoder, it will be changed to be in the range.
|
||||
|
||||
@item @var{mbbrc}
|
||||
Setting this flag enables macroblock level bitrate control that generally
|
||||
improves subjective visual quality. Enabling this flag may have negative impact
|
||||
on performance and objective visual quality metric.
|
||||
|
||||
@item @var{low_delay_brc}
|
||||
Setting this flag turns on or off LowDelayBRC feautre in qsv plugin, which provides
|
||||
more accurate bitrate control to minimize the variance of bitstream size frame
|
||||
by frame. Value: -1-default 0-off 1-on
|
||||
|
||||
@item @var{adaptive_i}
|
||||
This flag controls insertion of I frames by the QSV encoder. Turn ON this flag
|
||||
to allow changing of frame type from P and B to I.
|
||||
|
||||
@item @var{adaptive_b}
|
||||
This flag controls changing of frame type from B to P.
|
||||
|
||||
@item @var{p_strategy}
|
||||
Enable P-pyramid: 0-default 1-simple 2-pyramid(bf need to be set to 0).
|
||||
|
||||
@item @var{b_strategy}
|
||||
This option controls usage of B frames as reference.
|
||||
|
||||
@item @var{dblk_idc}
|
||||
This option disable deblocking. It has value in range 0~2.
|
||||
|
||||
@item @var{cavlc}
|
||||
If set, CAVLC is used; if unset, CABAC is used for encoding.
|
||||
|
||||
@item @var{vcm}
|
||||
Video conferencing mode, please see ratecontrol method.
|
||||
|
||||
@item @var{idr_interval}
|
||||
Distance (in I-frames) between IDR frames.
|
||||
|
||||
@item @var{pic_timing_sei}
|
||||
Insert picture timing SEI with pic_struct_syntax element.
|
||||
|
||||
@item @var{single_sei_nal_unit}
|
||||
Put all the SEI messages into one NALU.
|
||||
|
||||
@item @var{max_dec_frame_buffering}
|
||||
Maximum number of frames buffered in the DPB.
|
||||
|
||||
@item @var{look_ahead}
|
||||
Use VBR algorithm with look ahead.
|
||||
|
||||
@item @var{look_ahead_depth}
|
||||
Depth of look ahead in number frames.
|
||||
|
||||
@item @var{look_ahead_downsampling}
|
||||
Downscaling factor for the frames saved for the lookahead analysis.
|
||||
@table @samp
|
||||
@item unknown
|
||||
@item auto
|
||||
@item off
|
||||
@item 2x
|
||||
@item 4x
|
||||
@end table
|
||||
|
||||
@item @var{int_ref_type}
|
||||
Specifies intra refresh type. The major goal of intra refresh is improvement of
|
||||
error resilience without significant impact on encoded bitstream size caused by
|
||||
I frames. The SDK encoder achieves this by encoding part of each frame in
|
||||
refresh cycle using intra MBs. @var{none} means no refresh. @var{vertical} means
|
||||
vertical refresh, by column of MBs. To enable intra refresh, B frame should be
|
||||
set to 0.
|
||||
|
||||
@item @var{int_ref_cycle_size}
|
||||
Specifies number of pictures within refresh cycle starting from 2. 0 and 1 are
|
||||
invalid values.
|
||||
|
||||
@item @var{int_ref_qp_delta}
|
||||
Specifies QP difference for inserted intra MBs. This is signed value in
|
||||
[-51, 51] range if target encoding bit-depth for luma samples is 8 and this
|
||||
range is [-63, 63] for 10 bit-depth or [-75, 75] for 12 bit-depth respectively.
|
||||
|
||||
@item @var{int_ref_cycle_dist}
|
||||
Distance between the beginnings of the intra-refresh cycles in frames.
|
||||
|
||||
@item @var{profile}
|
||||
@table @samp
|
||||
@item unknown
|
||||
@item baseline
|
||||
@item main
|
||||
@item high
|
||||
@end table
|
||||
|
||||
@item @var{a53cc}
|
||||
Use A53 Closed Captions (if available).
|
||||
|
||||
@item @var{aud}
|
||||
Insert the Access Unit Delimiter NAL.
|
||||
|
||||
@item @var{mfmode}
|
||||
Multi-Frame Mode.
|
||||
@table @samp
|
||||
@item off
|
||||
@item auto
|
||||
@end table
|
||||
|
||||
@item @var{repeat_pps}
|
||||
Repeat pps for every frame.
|
||||
|
||||
@item @var{max_qp_i}
|
||||
Maximum video quantizer scale for I frame.
|
||||
|
||||
@item @var{min_qp_i}
|
||||
Minimum video quantizer scale for I frame.
|
||||
|
||||
@item @var{max_qp_p}
|
||||
Maximum video quantizer scale for P frame.
|
||||
|
||||
@item @var{min_qp_p}
|
||||
Minimum video quantizer scale for P frame.
|
||||
|
||||
@item @var{max_qp_b}
|
||||
Maximum video quantizer scale for B frame.
|
||||
|
||||
@item @var{min_qp_b}
|
||||
Minimum video quantizer scale for B frame.
|
||||
@end table
|
||||
|
||||
@subsection HEVC Options
|
||||
These options are used by hevc_qsv
|
||||
|
||||
@table @option
|
||||
@item @var{extbrc}
|
||||
Extended bitrate control.
|
||||
|
||||
@item @var{recovery_point_sei}
|
||||
Set this flag to insert the recovery point SEI message at the beginning of every
|
||||
intra refresh cycle.
|
||||
|
||||
@item @var{rdo}
|
||||
Enable rate distortion optimization.
|
||||
|
||||
@item @var{max_frame_size}
|
||||
Maximum encoded frame size in bytes.
|
||||
|
||||
@item @var{max_frame_size_i}
|
||||
Maximum encoded frame size for I frames in bytes. If this value is set as larger
|
||||
than zero, then for I frames the value set by max_frame_size is ignored.
|
||||
|
||||
@item @var{max_frame_size_p}
|
||||
Maximum encoded frame size for P frames in bytes. If this value is set as larger
|
||||
than zero, then for P frames the value set by max_frame_size is ignored.
|
||||
|
||||
@item @var{max_slice_size}
|
||||
Maximum encoded slice size in bytes.
|
||||
|
||||
@item @var{mbbrc}
|
||||
Setting this flag enables macroblock level bitrate control that generally
|
||||
improves subjective visual quality. Enabling this flag may have negative impact
|
||||
on performance and objective visual quality metric.
|
||||
|
||||
@item @var{low_delay_brc}
|
||||
Setting this flag turns on or off LowDelayBRC feautre in qsv plugin, which provides
|
||||
more accurate bitrate control to minimize the variance of bitstream size frame
|
||||
by frame. Value: -1-default 0-off 1-on
|
||||
|
||||
@item @var{p_strategy}
|
||||
Enable P-pyramid: 0-default 1-simple 2-pyramid(bf need to be set to 0).
|
||||
|
||||
@item @var{b_strategy}
|
||||
This option controls usage of B frames as reference.
|
||||
|
||||
@item @var{dblk_idc}
|
||||
This option disable deblocking. It has value in range 0~2.
|
||||
|
||||
@item @var{idr_interval}
|
||||
Distance (in I-frames) between IDR frames.
|
||||
@table @samp
|
||||
@item begin_only
|
||||
Output an IDR-frame only at the beginning of the stream.
|
||||
@end table
|
||||
|
||||
@item @var{load_plugin}
|
||||
A user plugin to load in an internal session.
|
||||
@table @samp
|
||||
@item none
|
||||
@item hevc_sw
|
||||
@item hevc_hw
|
||||
@end table
|
||||
|
||||
@item @var{load_plugins}
|
||||
A :-separate list of hexadecimal plugin UIDs to load in
|
||||
an internal session.
|
||||
|
||||
@item @var{look_ahead_depth}
|
||||
Depth of look ahead in number frames, available when extbrc option is enabled.
|
||||
|
||||
@item @var{profile}
|
||||
Set the encoding profile (scc requires libmfx >= 1.32).
|
||||
|
||||
@table @samp
|
||||
@item unknown
|
||||
@item main
|
||||
@item main10
|
||||
@item mainsp
|
||||
@item rext
|
||||
@item scc
|
||||
@end table
|
||||
|
||||
@item @var{gpb}
|
||||
1: GPB (generalized P/B frame)
|
||||
|
||||
0: regular P frame.
|
||||
|
||||
@item @var{tile_cols}
|
||||
Number of columns for tiled encoding.
|
||||
|
||||
@item @var{tile_rows}
|
||||
Number of rows for tiled encoding.
|
||||
|
||||
@item @var{aud}
|
||||
Insert the Access Unit Delimiter NAL.
|
||||
|
||||
@item @var{pic_timing_sei}
|
||||
Insert picture timing SEI with pic_struct_syntax element.
|
||||
|
||||
@item @var{transform_skip}
|
||||
Turn this option ON to enable transformskip. It is supported on platform equal
|
||||
or newer than ICL.
|
||||
|
||||
@item @var{int_ref_type}
|
||||
Specifies intra refresh type. The major goal of intra refresh is improvement of
|
||||
error resilience without significant impact on encoded bitstream size caused by
|
||||
I frames. The SDK encoder achieves this by encoding part of each frame in
|
||||
refresh cycle using intra MBs. @var{none} means no refresh. @var{vertical} means
|
||||
vertical refresh, by column of MBs. To enable intra refresh, B frame should be
|
||||
set to 0.
|
||||
|
||||
@item @var{int_ref_cycle_size}
|
||||
Specifies number of pictures within refresh cycle starting from 2. 0 and 1 are
|
||||
invalid values.
|
||||
|
||||
@item @var{int_ref_qp_delta}
|
||||
Specifies QP difference for inserted intra MBs. This is signed value in
|
||||
[-51, 51] range if target encoding bit-depth for luma samples is 8 and this
|
||||
range is [-63, 63] for 10 bit-depth or [-75, 75] for 12 bit-depth respectively.
|
||||
|
||||
@item @var{int_ref_cycle_dist}
|
||||
Distance between the beginnings of the intra-refresh cycles in frames.
|
||||
|
||||
@item @var{max_qp_i}
|
||||
Maximum video quantizer scale for I frame.
|
||||
|
||||
@item @var{min_qp_i}
|
||||
Minimum video quantizer scale for I frame.
|
||||
|
||||
@item @var{max_qp_p}
|
||||
Maximum video quantizer scale for P frame.
|
||||
|
||||
@item @var{min_qp_p}
|
||||
Minimum video quantizer scale for P frame.
|
||||
|
||||
@item @var{max_qp_b}
|
||||
Maximum video quantizer scale for B frame.
|
||||
|
||||
@item @var{min_qp_b}
|
||||
Minimum video quantizer scale for B frame.
|
||||
@end table
|
||||
|
||||
@subsection MPEG2 Options
|
||||
These options are used by mpeg2_qsv
|
||||
@table @option
|
||||
@item @var{profile}
|
||||
@table @samp
|
||||
@item unknown
|
||||
@item simple
|
||||
@item main
|
||||
@item high
|
||||
@end table
|
||||
@end table
|
||||
|
||||
@subsection VP9 Options
|
||||
These options are used by vp9_qsv
|
||||
@table @option
|
||||
@item @var{profile}
|
||||
@table @samp
|
||||
@item unknown
|
||||
@item profile0
|
||||
@item profile1
|
||||
@item profile2
|
||||
@item profile3
|
||||
@end table
|
||||
|
||||
@item @var{tile_cols}
|
||||
Number of columns for tiled encoding (requires libmfx >= 1.29).
|
||||
|
||||
@item @var{tile_rows}
|
||||
Number of rows for tiled encoding (requires libmfx >= 1.29).
|
||||
@end table
|
||||
|
||||
@section snow
|
||||
|
||||
@subsection Options
|
||||
@ -3292,6 +3754,17 @@ will refer only to P- or I-frames. When set to greater values multiple layers
|
||||
of B-frames will be present, frames in each layer only referring to frames in
|
||||
higher layers.
|
||||
|
||||
@item async_depth
|
||||
Maximum processing parallelism. Increase this to improve single channel
|
||||
performance. This option doesn't work if driver doesn't implement vaSyncBuffer
|
||||
function. Please make sure there are enough hw_frames allocated if a large
|
||||
number of async_depth is used.
|
||||
|
||||
@item max_frame_size
|
||||
Set the allowed max size in bytes for each frame. If the frame size exceeds
|
||||
the limitation, encoder will adjust the QP value to control the frame size.
|
||||
Invalid in CQP rate control mode.
|
||||
|
||||
@item rc_mode
|
||||
Set the rate control mode to use. A given driver may only support a subset of
|
||||
modes.
|
||||
@ -3435,6 +3908,22 @@ required to produce a stream usable with all decoders.
|
||||
|
||||
@end table
|
||||
|
||||
@section vbn
|
||||
|
||||
Vizrt Binary Image encoder.
|
||||
|
||||
This format is used by the broadcast vendor Vizrt for quick texture streaming.
|
||||
Advanced features of the format such as LZW compression of texture data or
|
||||
generation of mipmaps are not supported.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@table @option
|
||||
@item format @var{string}
|
||||
Sets the texture compression used by the VBN file. Can be @var{dxt1},
|
||||
@var{dxt5} or @var{raw}. Default is @var{dxt5}.
|
||||
@end table
|
||||
|
||||
@section vc2
|
||||
|
||||
SMPTE VC-2 (previously BBC Dirac Pro). This codec was primarily aimed at
|
||||
|
@ -97,7 +97,7 @@ static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame,
|
||||
exit(1);
|
||||
}
|
||||
for (i = 0; i < frame->nb_samples; i++)
|
||||
for (ch = 0; ch < dec_ctx->channels; ch++)
|
||||
for (ch = 0; ch < dec_ctx->ch_layout.nb_channels; ch++)
|
||||
fwrite(frame->data[ch] + data_size*i, 1, data_size, outfile);
|
||||
}
|
||||
}
|
||||
@ -215,7 +215,7 @@ int main(int argc, char **argv)
|
||||
sfmt = av_get_packed_sample_fmt(sfmt);
|
||||
}
|
||||
|
||||
n_channels = c->channels;
|
||||
n_channels = c->ch_layout.nb_channels;
|
||||
if ((ret = get_format_from_sample_fmt(&fmt, sfmt)) < 0)
|
||||
goto end;
|
||||
|
||||
|
@ -92,6 +92,7 @@ int main(int argc, char **argv)
|
||||
uint8_t *data;
|
||||
size_t data_size;
|
||||
int ret;
|
||||
int eof;
|
||||
AVPacket *pkt;
|
||||
|
||||
if (argc <= 2) {
|
||||
@ -150,15 +151,16 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
while (!feof(f)) {
|
||||
do {
|
||||
/* read raw data from the input file */
|
||||
data_size = fread(inbuf, 1, INBUF_SIZE, f);
|
||||
if (!data_size)
|
||||
if (ferror(f))
|
||||
break;
|
||||
eof = !data_size;
|
||||
|
||||
/* use the parser to split the data into frames */
|
||||
data = inbuf;
|
||||
while (data_size > 0) {
|
||||
while (data_size > 0 || eof) {
|
||||
ret = av_parser_parse2(parser, c, &pkt->data, &pkt->size,
|
||||
data, data_size, AV_NOPTS_VALUE, AV_NOPTS_VALUE, 0);
|
||||
if (ret < 0) {
|
||||
@ -170,8 +172,10 @@ int main(int argc, char **argv)
|
||||
|
||||
if (pkt->size)
|
||||
decode(c, frame, pkt, outfilename);
|
||||
else if (eof)
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (!eof);
|
||||
|
||||
/* flush the decoder */
|
||||
decode(c, frame, NULL, outfilename);
|
||||
|
@ -345,7 +345,7 @@ int main (int argc, char **argv)
|
||||
|
||||
if (audio_stream) {
|
||||
enum AVSampleFormat sfmt = audio_dec_ctx->sample_fmt;
|
||||
int n_channels = audio_dec_ctx->channels;
|
||||
int n_channels = audio_dec_ctx->ch_layout.nb_channels;
|
||||
const char *fmt;
|
||||
|
||||
if (av_sample_fmt_is_planar(sfmt)) {
|
||||
|
@ -70,26 +70,25 @@ static int select_sample_rate(const AVCodec *codec)
|
||||
}
|
||||
|
||||
/* select layout with the highest channel count */
|
||||
static int select_channel_layout(const AVCodec *codec)
|
||||
static int select_channel_layout(const AVCodec *codec, AVChannelLayout *dst)
|
||||
{
|
||||
const uint64_t *p;
|
||||
uint64_t best_ch_layout = 0;
|
||||
const AVChannelLayout *p, *best_ch_layout;
|
||||
int best_nb_channels = 0;
|
||||
|
||||
if (!codec->channel_layouts)
|
||||
return AV_CH_LAYOUT_STEREO;
|
||||
if (!codec->ch_layouts)
|
||||
return av_channel_layout_copy(dst, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO);
|
||||
|
||||
p = codec->channel_layouts;
|
||||
while (*p) {
|
||||
int nb_channels = av_get_channel_layout_nb_channels(*p);
|
||||
p = codec->ch_layouts;
|
||||
while (p->nb_channels) {
|
||||
int nb_channels = p->nb_channels;
|
||||
|
||||
if (nb_channels > best_nb_channels) {
|
||||
best_ch_layout = *p;
|
||||
best_ch_layout = p;
|
||||
best_nb_channels = nb_channels;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
return best_ch_layout;
|
||||
return av_channel_layout_copy(dst, best_ch_layout);
|
||||
}
|
||||
|
||||
static void encode(AVCodecContext *ctx, AVFrame *frame, AVPacket *pkt,
|
||||
@ -164,8 +163,9 @@ int main(int argc, char **argv)
|
||||
|
||||
/* select other audio parameters supported by the encoder */
|
||||
c->sample_rate = select_sample_rate(codec);
|
||||
c->channel_layout = select_channel_layout(codec);
|
||||
c->channels = av_get_channel_layout_nb_channels(c->channel_layout);
|
||||
ret = select_channel_layout(codec, &c->ch_layout);
|
||||
if (ret < 0)
|
||||
exit(1);
|
||||
|
||||
/* open it */
|
||||
if (avcodec_open2(c, codec, NULL) < 0) {
|
||||
@ -195,7 +195,9 @@ int main(int argc, char **argv)
|
||||
|
||||
frame->nb_samples = c->frame_size;
|
||||
frame->format = c->sample_fmt;
|
||||
frame->channel_layout = c->channel_layout;
|
||||
ret = av_channel_layout_copy(&frame->ch_layout, &c->ch_layout);
|
||||
if (ret < 0)
|
||||
exit(1);
|
||||
|
||||
/* allocate the data buffers */
|
||||
ret = av_frame_get_buffer(frame, 0);
|
||||
@ -218,7 +220,7 @@ int main(int argc, char **argv)
|
||||
for (j = 0; j < c->frame_size; j++) {
|
||||
samples[2*j] = (int)(sin(t) * 10000);
|
||||
|
||||
for (k = 1; k < c->channels; k++)
|
||||
for (k = 1; k < c->ch_layout.nb_channels; k++)
|
||||
samples[2*j + k] = samples[2*j];
|
||||
t += tincr;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@
|
||||
|
||||
#define INPUT_SAMPLERATE 48000
|
||||
#define INPUT_FORMAT AV_SAMPLE_FMT_FLTP
|
||||
#define INPUT_CHANNEL_LAYOUT AV_CH_LAYOUT_5POINT0
|
||||
#define INPUT_CHANNEL_LAYOUT (AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT0
|
||||
|
||||
#define VOLUME_VAL 0.90
|
||||
|
||||
@ -100,7 +100,7 @@ static int init_filter_graph(AVFilterGraph **graph, AVFilterContext **src,
|
||||
}
|
||||
|
||||
/* Set the filter options through the AVOptions API. */
|
||||
av_get_channel_layout_string(ch_layout, sizeof(ch_layout), 0, INPUT_CHANNEL_LAYOUT);
|
||||
av_channel_layout_describe(&INPUT_CHANNEL_LAYOUT, ch_layout, sizeof(ch_layout));
|
||||
av_opt_set (abuffer_ctx, "channel_layout", ch_layout, AV_OPT_SEARCH_CHILDREN);
|
||||
av_opt_set (abuffer_ctx, "sample_fmt", av_get_sample_fmt_name(INPUT_FORMAT), AV_OPT_SEARCH_CHILDREN);
|
||||
av_opt_set_q (abuffer_ctx, "time_base", (AVRational){ 1, INPUT_SAMPLERATE }, AV_OPT_SEARCH_CHILDREN);
|
||||
@ -154,9 +154,8 @@ static int init_filter_graph(AVFilterGraph **graph, AVFilterContext **src,
|
||||
/* A third way of passing the options is in a string of the form
|
||||
* key1=value1:key2=value2.... */
|
||||
snprintf(options_str, sizeof(options_str),
|
||||
"sample_fmts=%s:sample_rates=%d:channel_layouts=0x%"PRIx64,
|
||||
av_get_sample_fmt_name(AV_SAMPLE_FMT_S16), 44100,
|
||||
(uint64_t)AV_CH_LAYOUT_STEREO);
|
||||
"sample_fmts=%s:sample_rates=%d:channel_layouts=stereo",
|
||||
av_get_sample_fmt_name(AV_SAMPLE_FMT_S16), 44100);
|
||||
err = avfilter_init_str(aformat_ctx, options_str);
|
||||
if (err < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Could not initialize the aformat filter.\n");
|
||||
@ -215,7 +214,7 @@ static int init_filter_graph(AVFilterGraph **graph, AVFilterContext **src,
|
||||
static int process_output(struct AVMD5 *md5, AVFrame *frame)
|
||||
{
|
||||
int planar = av_sample_fmt_is_planar(frame->format);
|
||||
int channels = av_get_channel_layout_nb_channels(frame->channel_layout);
|
||||
int channels = frame->ch_layout.nb_channels;
|
||||
int planes = planar ? channels : 1;
|
||||
int bps = av_get_bytes_per_sample(frame->format);
|
||||
int plane_size = bps * frame->nb_samples * (planar ? 1 : channels);
|
||||
@ -248,7 +247,7 @@ static int get_input(AVFrame *frame, int frame_num)
|
||||
/* Set up the frame properties and allocate the buffer for the data. */
|
||||
frame->sample_rate = INPUT_SAMPLERATE;
|
||||
frame->format = INPUT_FORMAT;
|
||||
frame->channel_layout = INPUT_CHANNEL_LAYOUT;
|
||||
av_channel_layout_copy(&frame->ch_layout, &INPUT_CHANNEL_LAYOUT);
|
||||
frame->nb_samples = FRAME_SIZE;
|
||||
frame->pts = frame_num * FRAME_SIZE;
|
||||
|
||||
|
@ -94,7 +94,6 @@ static int init_filters(const char *filters_descr)
|
||||
AVFilterInOut *outputs = avfilter_inout_alloc();
|
||||
AVFilterInOut *inputs = avfilter_inout_alloc();
|
||||
static const enum AVSampleFormat out_sample_fmts[] = { AV_SAMPLE_FMT_S16, -1 };
|
||||
static const int64_t out_channel_layouts[] = { AV_CH_LAYOUT_MONO, -1 };
|
||||
static const int out_sample_rates[] = { 8000, -1 };
|
||||
const AVFilterLink *outlink;
|
||||
AVRational time_base = fmt_ctx->streams[audio_stream_index]->time_base;
|
||||
@ -106,12 +105,13 @@ static int init_filters(const char *filters_descr)
|
||||
}
|
||||
|
||||
/* buffer audio source: the decoded frames from the decoder will be inserted here. */
|
||||
if (!dec_ctx->channel_layout)
|
||||
dec_ctx->channel_layout = av_get_default_channel_layout(dec_ctx->channels);
|
||||
snprintf(args, sizeof(args),
|
||||
"time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=0x%"PRIx64,
|
||||
if (dec_ctx->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC)
|
||||
av_channel_layout_default(&dec_ctx->ch_layout, dec_ctx->ch_layout.nb_channels);
|
||||
ret = snprintf(args, sizeof(args),
|
||||
"time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=",
|
||||
time_base.num, time_base.den, dec_ctx->sample_rate,
|
||||
av_get_sample_fmt_name(dec_ctx->sample_fmt), dec_ctx->channel_layout);
|
||||
av_get_sample_fmt_name(dec_ctx->sample_fmt));
|
||||
av_channel_layout_describe(&dec_ctx->ch_layout, args + ret, sizeof(args) - ret);
|
||||
ret = avfilter_graph_create_filter(&buffersrc_ctx, abuffersrc, "in",
|
||||
args, NULL, filter_graph);
|
||||
if (ret < 0) {
|
||||
@ -134,7 +134,7 @@ static int init_filters(const char *filters_descr)
|
||||
goto end;
|
||||
}
|
||||
|
||||
ret = av_opt_set_int_list(buffersink_ctx, "channel_layouts", out_channel_layouts, -1,
|
||||
ret = av_opt_set(buffersink_ctx, "ch_layouts", "mono",
|
||||
AV_OPT_SEARCH_CHILDREN);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Cannot set output channel layout\n");
|
||||
@ -185,7 +185,7 @@ static int init_filters(const char *filters_descr)
|
||||
/* Print summary of the sink buffer
|
||||
* Note: args buffer is reused to store channel layout string */
|
||||
outlink = buffersink_ctx->inputs[0];
|
||||
av_get_channel_layout_string(args, sizeof(args), -1, outlink->channel_layout);
|
||||
av_channel_layout_describe(&outlink->ch_layout, args, sizeof(args));
|
||||
av_log(NULL, AV_LOG_INFO, "Output: srate:%dHz fmt:%s chlayout:%s\n",
|
||||
(int)outlink->sample_rate,
|
||||
(char *)av_x_if_null(av_get_sample_fmt_name(outlink->format), "?"),
|
||||
@ -200,7 +200,7 @@ end:
|
||||
|
||||
static void print_frame(const AVFrame *frame)
|
||||
{
|
||||
const int n = frame->nb_samples * av_get_channel_layout_nb_channels(frame->channel_layout);
|
||||
const int n = frame->nb_samples * frame->ch_layout.nb_channels;
|
||||
const uint16_t *p = (uint16_t*)frame->data[0];
|
||||
const uint16_t *p_end = p + n;
|
||||
|
||||
|
@ -170,16 +170,7 @@ static void add_stream(OutputStream *ost, AVFormatContext *oc,
|
||||
c->sample_rate = 44100;
|
||||
}
|
||||
}
|
||||
c->channels = av_get_channel_layout_nb_channels(c->channel_layout);
|
||||
c->channel_layout = AV_CH_LAYOUT_STEREO;
|
||||
if ((*codec)->channel_layouts) {
|
||||
c->channel_layout = (*codec)->channel_layouts[0];
|
||||
for (i = 0; (*codec)->channel_layouts[i]; i++) {
|
||||
if ((*codec)->channel_layouts[i] == AV_CH_LAYOUT_STEREO)
|
||||
c->channel_layout = AV_CH_LAYOUT_STEREO;
|
||||
}
|
||||
}
|
||||
c->channels = av_get_channel_layout_nb_channels(c->channel_layout);
|
||||
av_channel_layout_copy(&c->ch_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO);
|
||||
ost->st->time_base = (AVRational){ 1, c->sample_rate };
|
||||
break;
|
||||
|
||||
@ -224,7 +215,7 @@ static void add_stream(OutputStream *ost, AVFormatContext *oc,
|
||||
/* audio output */
|
||||
|
||||
static AVFrame *alloc_audio_frame(enum AVSampleFormat sample_fmt,
|
||||
uint64_t channel_layout,
|
||||
const AVChannelLayout *channel_layout,
|
||||
int sample_rate, int nb_samples)
|
||||
{
|
||||
AVFrame *frame = av_frame_alloc();
|
||||
@ -236,7 +227,7 @@ static AVFrame *alloc_audio_frame(enum AVSampleFormat sample_fmt,
|
||||
}
|
||||
|
||||
frame->format = sample_fmt;
|
||||
frame->channel_layout = channel_layout;
|
||||
av_channel_layout_copy(&frame->ch_layout, channel_layout);
|
||||
frame->sample_rate = sample_rate;
|
||||
frame->nb_samples = nb_samples;
|
||||
|
||||
@ -281,9 +272,9 @@ static void open_audio(AVFormatContext *oc, const AVCodec *codec,
|
||||
else
|
||||
nb_samples = c->frame_size;
|
||||
|
||||
ost->frame = alloc_audio_frame(c->sample_fmt, c->channel_layout,
|
||||
ost->frame = alloc_audio_frame(c->sample_fmt, &c->ch_layout,
|
||||
c->sample_rate, nb_samples);
|
||||
ost->tmp_frame = alloc_audio_frame(AV_SAMPLE_FMT_S16, c->channel_layout,
|
||||
ost->tmp_frame = alloc_audio_frame(AV_SAMPLE_FMT_S16, &c->ch_layout,
|
||||
c->sample_rate, nb_samples);
|
||||
|
||||
/* copy the stream parameters to the muxer */
|
||||
@ -301,10 +292,10 @@ static void open_audio(AVFormatContext *oc, const AVCodec *codec,
|
||||
}
|
||||
|
||||
/* set options */
|
||||
av_opt_set_int (ost->swr_ctx, "in_channel_count", c->channels, 0);
|
||||
av_opt_set_chlayout (ost->swr_ctx, "in_chlayout", &c->ch_layout, 0);
|
||||
av_opt_set_int (ost->swr_ctx, "in_sample_rate", c->sample_rate, 0);
|
||||
av_opt_set_sample_fmt(ost->swr_ctx, "in_sample_fmt", AV_SAMPLE_FMT_S16, 0);
|
||||
av_opt_set_int (ost->swr_ctx, "out_channel_count", c->channels, 0);
|
||||
av_opt_set_chlayout (ost->swr_ctx, "out_chlayout", &c->ch_layout, 0);
|
||||
av_opt_set_int (ost->swr_ctx, "out_sample_rate", c->sample_rate, 0);
|
||||
av_opt_set_sample_fmt(ost->swr_ctx, "out_sample_fmt", c->sample_fmt, 0);
|
||||
|
||||
@ -330,7 +321,7 @@ static AVFrame *get_audio_frame(OutputStream *ost)
|
||||
|
||||
for (j = 0; j <frame->nb_samples; j++) {
|
||||
v = (int)(sin(ost->t) * 10000);
|
||||
for (i = 0; i < ost->enc->channels; i++)
|
||||
for (i = 0; i < ost->enc->ch_layout.nb_channels; i++)
|
||||
*q++ = v;
|
||||
ost->t += ost->tincr;
|
||||
ost->tincr += ost->tincr2;
|
||||
@ -638,10 +629,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
/* Write the trailer, if any. The trailer must be written before you
|
||||
* close the CodecContexts open when you wrote the header; otherwise
|
||||
* av_write_trailer() may try to use memory that was freed on
|
||||
* av_codec_close(). */
|
||||
av_write_trailer(oc);
|
||||
|
||||
/* Close each codec. */
|
||||
|
@ -80,7 +80,7 @@ static void fill_samples(double *dst, int nb_samples, int nb_channels, int sampl
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int64_t src_ch_layout = AV_CH_LAYOUT_STEREO, dst_ch_layout = AV_CH_LAYOUT_SURROUND;
|
||||
AVChannelLayout src_ch_layout = AV_CHANNEL_LAYOUT_STEREO, dst_ch_layout = AV_CHANNEL_LAYOUT_SURROUND;
|
||||
int src_rate = 48000, dst_rate = 44100;
|
||||
uint8_t **src_data = NULL, **dst_data = NULL;
|
||||
int src_nb_channels = 0, dst_nb_channels = 0;
|
||||
@ -92,6 +92,7 @@ int main(int argc, char **argv)
|
||||
int dst_bufsize;
|
||||
const char *fmt;
|
||||
struct SwrContext *swr_ctx;
|
||||
char buf[64];
|
||||
double t;
|
||||
int ret;
|
||||
|
||||
@ -120,11 +121,11 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* set options */
|
||||
av_opt_set_int(swr_ctx, "in_channel_layout", src_ch_layout, 0);
|
||||
av_opt_set_chlayout(swr_ctx, "in_chlayout", &src_ch_layout, 0);
|
||||
av_opt_set_int(swr_ctx, "in_sample_rate", src_rate, 0);
|
||||
av_opt_set_sample_fmt(swr_ctx, "in_sample_fmt", src_sample_fmt, 0);
|
||||
|
||||
av_opt_set_int(swr_ctx, "out_channel_layout", dst_ch_layout, 0);
|
||||
av_opt_set_chlayout(swr_ctx, "out_chlayout", &dst_ch_layout, 0);
|
||||
av_opt_set_int(swr_ctx, "out_sample_rate", dst_rate, 0);
|
||||
av_opt_set_sample_fmt(swr_ctx, "out_sample_fmt", dst_sample_fmt, 0);
|
||||
|
||||
@ -136,7 +137,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* allocate source and destination samples buffers */
|
||||
|
||||
src_nb_channels = av_get_channel_layout_nb_channels(src_ch_layout);
|
||||
src_nb_channels = src_ch_layout.nb_channels;
|
||||
ret = av_samples_alloc_array_and_samples(&src_data, &src_linesize, src_nb_channels,
|
||||
src_nb_samples, src_sample_fmt, 0);
|
||||
if (ret < 0) {
|
||||
@ -151,7 +152,7 @@ int main(int argc, char **argv)
|
||||
av_rescale_rnd(src_nb_samples, dst_rate, src_rate, AV_ROUND_UP);
|
||||
|
||||
/* buffer is going to be directly written to a rawaudio file, no alignment */
|
||||
dst_nb_channels = av_get_channel_layout_nb_channels(dst_ch_layout);
|
||||
dst_nb_channels = dst_ch_layout.nb_channels;
|
||||
ret = av_samples_alloc_array_and_samples(&dst_data, &dst_linesize, dst_nb_channels,
|
||||
dst_nb_samples, dst_sample_fmt, 0);
|
||||
if (ret < 0) {
|
||||
@ -194,9 +195,10 @@ int main(int argc, char **argv)
|
||||
|
||||
if ((ret = get_format_from_sample_fmt(&fmt, dst_sample_fmt)) < 0)
|
||||
goto end;
|
||||
av_channel_layout_describe(&dst_ch_layout, buf, sizeof(buf));
|
||||
fprintf(stderr, "Resampling succeeded. Play the output file with the command:\n"
|
||||
"ffplay -f %s -channel_layout %"PRId64" -channels %d -ar %d %s\n",
|
||||
fmt, dst_ch_layout, dst_nb_channels, dst_rate, dst_filename);
|
||||
"ffplay -f %s -channel_layout %s -channels %d -ar %d %s\n",
|
||||
fmt, buf, dst_nb_channels, dst_rate, dst_filename);
|
||||
|
||||
end:
|
||||
fclose(dst_file);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2018 Andreas Unterweger
|
||||
* Copyright (c) 2013-2022 Andreas Unterweger
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
@ -62,6 +62,7 @@ static int open_input_file(const char *filename,
|
||||
{
|
||||
AVCodecContext *avctx;
|
||||
const AVCodec *input_codec;
|
||||
const AVStream *stream;
|
||||
int error;
|
||||
|
||||
/* Open the input file to read from it. */
|
||||
@ -89,8 +90,10 @@ static int open_input_file(const char *filename,
|
||||
return AVERROR_EXIT;
|
||||
}
|
||||
|
||||
stream = (*input_format_context)->streams[0];
|
||||
|
||||
/* Find a decoder for the audio stream. */
|
||||
if (!(input_codec = avcodec_find_decoder((*input_format_context)->streams[0]->codecpar->codec_id))) {
|
||||
if (!(input_codec = avcodec_find_decoder(stream->codecpar->codec_id))) {
|
||||
fprintf(stderr, "Could not find input codec\n");
|
||||
avformat_close_input(input_format_context);
|
||||
return AVERROR_EXIT;
|
||||
@ -105,7 +108,7 @@ static int open_input_file(const char *filename,
|
||||
}
|
||||
|
||||
/* Initialize the stream parameters with demuxer information. */
|
||||
error = avcodec_parameters_to_context(avctx, (*input_format_context)->streams[0]->codecpar);
|
||||
error = avcodec_parameters_to_context(avctx, stream->codecpar);
|
||||
if (error < 0) {
|
||||
avformat_close_input(input_format_context);
|
||||
avcodec_free_context(&avctx);
|
||||
@ -121,6 +124,9 @@ static int open_input_file(const char *filename,
|
||||
return error;
|
||||
}
|
||||
|
||||
/* Set the packet timebase for the decoder. */
|
||||
avctx->pkt_timebase = stream->time_base;
|
||||
|
||||
/* Save the decoder context for easier access later. */
|
||||
*input_codec_context = avctx;
|
||||
|
||||
@ -200,15 +206,11 @@ static int open_output_file(const char *filename,
|
||||
|
||||
/* Set the basic encoder parameters.
|
||||
* The input file's sample rate is used to avoid a sample rate conversion. */
|
||||
avctx->channels = OUTPUT_CHANNELS;
|
||||
avctx->channel_layout = av_get_default_channel_layout(OUTPUT_CHANNELS);
|
||||
av_channel_layout_default(&avctx->ch_layout, OUTPUT_CHANNELS);
|
||||
avctx->sample_rate = input_codec_context->sample_rate;
|
||||
avctx->sample_fmt = output_codec->sample_fmts[0];
|
||||
avctx->bit_rate = OUTPUT_BIT_RATE;
|
||||
|
||||
/* Allow the use of the experimental AAC encoder. */
|
||||
avctx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
|
||||
|
||||
/* Set the sample rate for the container. */
|
||||
stream->time_base.den = input_codec_context->sample_rate;
|
||||
stream->time_base.num = 1;
|
||||
@ -290,21 +292,18 @@ static int init_resampler(AVCodecContext *input_codec_context,
|
||||
/*
|
||||
* Create a resampler context for the conversion.
|
||||
* Set the conversion parameters.
|
||||
* Default channel layouts based on the number of channels
|
||||
* are assumed for simplicity (they are sometimes not detected
|
||||
* properly by the demuxer and/or decoder).
|
||||
*/
|
||||
*resample_context = swr_alloc_set_opts(NULL,
|
||||
av_get_default_channel_layout(output_codec_context->channels),
|
||||
error = swr_alloc_set_opts2(resample_context,
|
||||
&output_codec_context->ch_layout,
|
||||
output_codec_context->sample_fmt,
|
||||
output_codec_context->sample_rate,
|
||||
av_get_default_channel_layout(input_codec_context->channels),
|
||||
&input_codec_context->ch_layout,
|
||||
input_codec_context->sample_fmt,
|
||||
input_codec_context->sample_rate,
|
||||
0, NULL);
|
||||
if (!*resample_context) {
|
||||
if (error < 0) {
|
||||
fprintf(stderr, "Could not allocate resample context\n");
|
||||
return AVERROR(ENOMEM);
|
||||
return error;
|
||||
}
|
||||
/*
|
||||
* Perform a sanity check so that the number of converted samples is
|
||||
@ -332,7 +331,7 @@ static int init_fifo(AVAudioFifo **fifo, AVCodecContext *output_codec_context)
|
||||
{
|
||||
/* Create the FIFO buffer based on the specified output sample format. */
|
||||
if (!(*fifo = av_audio_fifo_alloc(output_codec_context->sample_fmt,
|
||||
output_codec_context->channels, 1))) {
|
||||
output_codec_context->ch_layout.nb_channels, 1))) {
|
||||
fprintf(stderr, "Could not allocate FIFO\n");
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
@ -381,6 +380,8 @@ static int decode_audio_frame(AVFrame *frame,
|
||||
if (error < 0)
|
||||
return error;
|
||||
|
||||
*data_present = 0;
|
||||
*finished = 0;
|
||||
/* Read one audio frame from the input file into a temporary packet. */
|
||||
if ((error = av_read_frame(input_format_context, input_packet)) < 0) {
|
||||
/* If we are at the end of the file, flush the decoder below. */
|
||||
@ -450,7 +451,7 @@ static int init_converted_samples(uint8_t ***converted_input_samples,
|
||||
* Each pointer will later point to the audio samples of the corresponding
|
||||
* channels (although it may be NULL for interleaved formats).
|
||||
*/
|
||||
if (!(*converted_input_samples = calloc(output_codec_context->channels,
|
||||
if (!(*converted_input_samples = calloc(output_codec_context->ch_layout.nb_channels,
|
||||
sizeof(**converted_input_samples)))) {
|
||||
fprintf(stderr, "Could not allocate converted input sample pointers\n");
|
||||
return AVERROR(ENOMEM);
|
||||
@ -459,7 +460,7 @@ static int init_converted_samples(uint8_t ***converted_input_samples,
|
||||
/* Allocate memory for the samples of all channels in one consecutive
|
||||
* block for convenience. */
|
||||
if ((error = av_samples_alloc(*converted_input_samples, NULL,
|
||||
output_codec_context->channels,
|
||||
output_codec_context->ch_layout.nb_channels,
|
||||
frame_size,
|
||||
output_codec_context->sample_fmt, 0)) < 0) {
|
||||
fprintf(stderr,
|
||||
@ -559,7 +560,7 @@ static int read_decode_convert_and_store(AVAudioFifo *fifo,
|
||||
AVFrame *input_frame = NULL;
|
||||
/* Temporary storage for the converted input samples. */
|
||||
uint8_t **converted_input_samples = NULL;
|
||||
int data_present = 0;
|
||||
int data_present;
|
||||
int ret = AVERROR_EXIT;
|
||||
|
||||
/* Initialize temporary storage for one input frame. */
|
||||
@ -633,7 +634,7 @@ static int init_output_frame(AVFrame **frame,
|
||||
* Default channel layouts based on the number of channels
|
||||
* are assumed for simplicity. */
|
||||
(*frame)->nb_samples = frame_size;
|
||||
(*frame)->channel_layout = output_codec_context->channel_layout;
|
||||
av_channel_layout_copy(&(*frame)->ch_layout, &output_codec_context->ch_layout);
|
||||
(*frame)->format = output_codec_context->sample_fmt;
|
||||
(*frame)->sample_rate = output_codec_context->sample_rate;
|
||||
|
||||
@ -680,17 +681,16 @@ static int encode_audio_frame(AVFrame *frame,
|
||||
pts += frame->nb_samples;
|
||||
}
|
||||
|
||||
*data_present = 0;
|
||||
/* Send the audio frame stored in the temporary packet to the encoder.
|
||||
* The output audio stream encoder is used to do this. */
|
||||
error = avcodec_send_frame(output_codec_context, frame);
|
||||
/* The encoder signals that it has nothing more to encode. */
|
||||
if (error == AVERROR_EOF) {
|
||||
error = 0;
|
||||
goto cleanup;
|
||||
} else if (error < 0) {
|
||||
fprintf(stderr, "Could not send packet for encoding (error '%s')\n",
|
||||
av_err2str(error));
|
||||
goto cleanup;
|
||||
/* Check for errors, but proceed with fetching encoded samples if the
|
||||
* encoder signals that it has nothing more to encode. */
|
||||
if (error < 0 && error != AVERROR_EOF) {
|
||||
fprintf(stderr, "Could not send packet for encoding (error '%s')\n",
|
||||
av_err2str(error));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Receive one encoded frame from the encoder. */
|
||||
@ -861,7 +861,6 @@ int main(int argc, char **argv)
|
||||
int data_written;
|
||||
/* Flush the encoder as it may have delayed frames. */
|
||||
do {
|
||||
data_written = 0;
|
||||
if (encode_audio_frame(NULL, output_format_context,
|
||||
output_codec_context, &data_written))
|
||||
goto cleanup;
|
||||
|
@ -175,8 +175,9 @@ static int open_output_file(const char *filename)
|
||||
enc_ctx->time_base = av_inv_q(dec_ctx->framerate);
|
||||
} else {
|
||||
enc_ctx->sample_rate = dec_ctx->sample_rate;
|
||||
enc_ctx->channel_layout = dec_ctx->channel_layout;
|
||||
enc_ctx->channels = av_get_channel_layout_nb_channels(enc_ctx->channel_layout);
|
||||
ret = av_channel_layout_copy(&enc_ctx->ch_layout, &dec_ctx->ch_layout);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
/* take first format from list of supported formats */
|
||||
enc_ctx->sample_fmt = encoder->sample_fmts[0];
|
||||
enc_ctx->time_base = (AVRational){1, enc_ctx->sample_rate};
|
||||
@ -289,6 +290,7 @@ static int init_filter(FilteringContext* fctx, AVCodecContext *dec_ctx,
|
||||
goto end;
|
||||
}
|
||||
} else if (dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {
|
||||
char buf[64];
|
||||
buffersrc = avfilter_get_by_name("abuffer");
|
||||
buffersink = avfilter_get_by_name("abuffersink");
|
||||
if (!buffersrc || !buffersink) {
|
||||
@ -297,14 +299,14 @@ static int init_filter(FilteringContext* fctx, AVCodecContext *dec_ctx,
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!dec_ctx->channel_layout)
|
||||
dec_ctx->channel_layout =
|
||||
av_get_default_channel_layout(dec_ctx->channels);
|
||||
if (dec_ctx->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC)
|
||||
av_channel_layout_default(&dec_ctx->ch_layout, dec_ctx->ch_layout.nb_channels);
|
||||
av_channel_layout_describe(&dec_ctx->ch_layout, buf, sizeof(buf));
|
||||
snprintf(args, sizeof(args),
|
||||
"time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=0x%"PRIx64,
|
||||
"time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=%s",
|
||||
dec_ctx->time_base.num, dec_ctx->time_base.den, dec_ctx->sample_rate,
|
||||
av_get_sample_fmt_name(dec_ctx->sample_fmt),
|
||||
dec_ctx->channel_layout);
|
||||
buf);
|
||||
ret = avfilter_graph_create_filter(&buffersrc_ctx, buffersrc, "in",
|
||||
args, NULL, filter_graph);
|
||||
if (ret < 0) {
|
||||
@ -327,9 +329,9 @@ static int init_filter(FilteringContext* fctx, AVCodecContext *dec_ctx,
|
||||
goto end;
|
||||
}
|
||||
|
||||
ret = av_opt_set_bin(buffersink_ctx, "channel_layouts",
|
||||
(uint8_t*)&enc_ctx->channel_layout,
|
||||
sizeof(enc_ctx->channel_layout), AV_OPT_SEARCH_CHILDREN);
|
||||
av_channel_layout_describe(&enc_ctx->ch_layout, buf, sizeof(buf));
|
||||
ret = av_opt_set(buffersink_ctx, "ch_layouts",
|
||||
buf, AV_OPT_SEARCH_CHILDREN);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Cannot set output channel layout\n");
|
||||
goto end;
|
||||
|
@ -79,6 +79,21 @@ Do not put a '~' character in the samples path to indicate a home
|
||||
directory. Because of shell nuances, this will cause FATE to fail.
|
||||
@end float
|
||||
|
||||
To get the complete list of tests, run the command:
|
||||
@example
|
||||
make fate-list
|
||||
@end example
|
||||
|
||||
You can specify a subset of tests to run by specifying the
|
||||
corresponding elements from the list with the @code{fate-} prefix,
|
||||
e.g. as in:
|
||||
@example
|
||||
make fate-ffprobe_compact fate-ffprobe_xml
|
||||
@end example
|
||||
|
||||
This makes it easier to run a few tests in case of failure without
|
||||
running the complete test suite.
|
||||
|
||||
To use a custom wrapper to run the test, pass @option{--target-exec} to
|
||||
@command{configure} or set the @var{TARGET_EXEC} Make variable.
|
||||
|
||||
|
@ -518,6 +518,21 @@ see @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1)
|
||||
Like the @code{-ss} option but relative to the "end of file". That is negative
|
||||
values are earlier in the file, 0 is at EOF.
|
||||
|
||||
@item -isync @var{input_index} (@emph{input})
|
||||
Assign an input as a sync source.
|
||||
|
||||
This will take the difference between the start times of the target and reference inputs and
|
||||
offset the timestamps of the target file by that difference. The source timestamps of the two
|
||||
inputs should derive from the same clock source for expected results. If @code{copyts} is set
|
||||
then @code{start_at_zero} must also be set. If either of the inputs has no starting timestamp
|
||||
then no sync adjustment is made.
|
||||
|
||||
Acceptable values are those that refer to a valid ffmpeg input index. If the sync reference is
|
||||
the target index itself or @var{-1}, then no adjustment is made to target timestamps. A sync
|
||||
reference may not itself be synced to any other input.
|
||||
|
||||
Default value is @var{-1}.
|
||||
|
||||
@item -itsoffset @var{offset} (@emph{input})
|
||||
Set the input time offset.
|
||||
|
||||
@ -624,21 +639,21 @@ The parameters set for each target are as follows.
|
||||
@var{pal}:
|
||||
-f vcd -muxrate 1411200 -muxpreload 0.44 -packetsize 2324
|
||||
-s 352x288 -r 25
|
||||
-codec:v mpeg1video -g 15 -b:v 1150k -maxrate:v 1150v -minrate:v 1150k -bufsize:v 327680
|
||||
-codec:v mpeg1video -g 15 -b:v 1150k -maxrate:v 1150k -minrate:v 1150k -bufsize:v 327680
|
||||
-ar 44100 -ac 2
|
||||
-codec:a mp2 -b:a 224k
|
||||
|
||||
@var{ntsc}:
|
||||
-f vcd -muxrate 1411200 -muxpreload 0.44 -packetsize 2324
|
||||
-s 352x240 -r 30000/1001
|
||||
-codec:v mpeg1video -g 18 -b:v 1150k -maxrate:v 1150v -minrate:v 1150k -bufsize:v 327680
|
||||
-codec:v mpeg1video -g 18 -b:v 1150k -maxrate:v 1150k -minrate:v 1150k -bufsize:v 327680
|
||||
-ar 44100 -ac 2
|
||||
-codec:a mp2 -b:a 224k
|
||||
|
||||
@var{film}:
|
||||
-f vcd -muxrate 1411200 -muxpreload 0.44 -packetsize 2324
|
||||
-s 352x240 -r 24000/1001
|
||||
-codec:v mpeg1video -g 18 -b:v 1150k -maxrate:v 1150v -minrate:v 1150k -bufsize:v 327680
|
||||
-codec:v mpeg1video -g 18 -b:v 1150k -maxrate:v 1150k -minrate:v 1150k -bufsize:v 327680
|
||||
-ar 44100 -ac 2
|
||||
-codec:a mp2 -b:a 224k
|
||||
@end example
|
||||
@ -1618,12 +1633,14 @@ it may cause packet loss.
|
||||
It is useful for when flow speed of output packets is important, such as live streaming.
|
||||
@item -re (@emph{input})
|
||||
Read input at native frame rate. This is equivalent to setting @code{-readrate 1}.
|
||||
@item -vsync @var{parameter}
|
||||
Video sync method.
|
||||
@item -vsync @var{parameter} (@emph{global})
|
||||
@itemx -fps_mode[:@var{stream_specifier}] @var{parameter} (@emph{output,per-stream})
|
||||
Set video sync method / framerate mode. vsync is applied to all output video streams
|
||||
but can be overridden for a stream by setting fps_mode. vsync is deprecated and will be
|
||||
removed in the future.
|
||||
|
||||
For compatibility reasons some of the values can be specified as numbers (shown
|
||||
in parentheses in the following table). This is deprecated and will stop working
|
||||
in the future.
|
||||
For compatibility reasons some of the values for vsync can be specified as numbers (shown
|
||||
in parentheses in the following table).
|
||||
|
||||
@table @option
|
||||
@item passthrough (0)
|
||||
@ -1747,7 +1764,7 @@ Default value is 0.
|
||||
@item -bitexact (@emph{input/output})
|
||||
Enable bitexact mode for (de)muxer and (de/en)coder
|
||||
@item -shortest (@emph{output})
|
||||
Finish encoding when the shortest input stream ends.
|
||||
Finish encoding when the shortest output stream ends.
|
||||
@item -dts_delta_threshold
|
||||
Timestamp discontinuity delta threshold.
|
||||
@item -dts_error_threshold @var{seconds}
|
||||
@ -1887,7 +1904,7 @@ This option sets the maximum number of queued packets when reading from the
|
||||
file or device. With low latency / high rate live streams, packets may be
|
||||
discarded if they are not read in a timely manner; setting this value can
|
||||
force ffmpeg to use a separate input thread and read packets as soon as they
|
||||
arrive. By default ffmpeg only do this if multiple inputs are specified.
|
||||
arrive. By default ffmpeg only does this if multiple inputs are specified.
|
||||
|
||||
@item -sdp_file @var{file} (@emph{global})
|
||||
Print sdp information for an output stream to @var{file}.
|
||||
|
@ -34,10 +34,6 @@ various FFmpeg APIs.
|
||||
Force displayed width.
|
||||
@item -y @var{height}
|
||||
Force displayed height.
|
||||
@item -s @var{size}
|
||||
Set frame size (WxH or abbreviation), needed for videos which do
|
||||
not contain a header with the frame size like raw YUV. This option
|
||||
has been deprecated in favor of private options, try -video_size.
|
||||
@item -fs
|
||||
Start in fullscreen mode.
|
||||
@item -an
|
||||
@ -126,10 +122,6 @@ Read @var{input_url}.
|
||||
|
||||
@section Advanced options
|
||||
@table @option
|
||||
@item -pix_fmt @var{format}
|
||||
Set pixel format.
|
||||
This option has been deprecated in favor of private options, try -pixel_format.
|
||||
|
||||
@item -stats
|
||||
Print several playback statistics, in particular show the stream
|
||||
duration, the codec parameters, the current position in the stream and
|
||||
@ -222,8 +214,6 @@ Pause.
|
||||
Toggle mute.
|
||||
|
||||
@item 9, 0
|
||||
Decrease and increase volume respectively.
|
||||
|
||||
@item /, *
|
||||
Decrease and increase volume respectively.
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
@chapter Synopsis
|
||||
|
||||
ffprobe [@var{options}] [@file{input_url}]
|
||||
ffprobe [@var{options}] @file{input_url}
|
||||
|
||||
@chapter Description
|
||||
@c man begin DESCRIPTION
|
||||
@ -28,6 +28,9 @@ If a url is specified in input, ffprobe will try to open and
|
||||
probe the url content. If the url cannot be opened or recognized as
|
||||
a multimedia file, a positive exit code is returned.
|
||||
|
||||
If no output is specified as output with @option{o} ffprobe will write
|
||||
to stdout.
|
||||
|
||||
ffprobe may be employed both as a standalone application or in
|
||||
combination with a textual filter, which may perform more
|
||||
sophisticated processing, e.g. statistical processing or plotting.
|
||||
@ -348,6 +351,10 @@ on the specific build.
|
||||
@item -i @var{input_url}
|
||||
Read @var{input_url}.
|
||||
|
||||
@item -o @var{output_url}
|
||||
Write output to @var{output_url}. If not specified, the output is sent
|
||||
to stdout.
|
||||
|
||||
@end table
|
||||
@c man end
|
||||
|
||||
|
1664
doc/filters.texi
1664
doc/filters.texi
File diff suppressed because it is too large
Load Diff
@ -171,6 +171,13 @@ Go to @url{https://github.com/TimothyGu/libilbc} and follow the instructions for
|
||||
installing the library. Then pass @code{--enable-libilbc} to configure to
|
||||
enable it.
|
||||
|
||||
@section libjxl
|
||||
|
||||
JPEG XL is an image format intended to fully replace legacy JPEG for an extended
|
||||
period of life. See @url{https://jpegxl.info/} for more information, and see
|
||||
@url{https://github.com/libjxl/libjxl} for the library source. You can pass
|
||||
@code{--enable-libjxl} to configure in order enable the libjxl wrapper.
|
||||
|
||||
@section libvpx
|
||||
|
||||
FFmpeg can make use of the libvpx library for VP8/VP9 decoding and encoding.
|
||||
@ -578,6 +585,7 @@ library:
|
||||
@item raw aptX @tab X @tab X
|
||||
@item raw aptX HD @tab X @tab X
|
||||
@item raw Chinese AVS video @tab X @tab X
|
||||
@item raw DFPWM @tab X @tab X
|
||||
@item raw Dirac @tab X @tab X
|
||||
@item raw DNxHD @tab X @tab X
|
||||
@item raw DTS @tab X @tab X
|
||||
@ -767,6 +775,8 @@ following image formats are supported:
|
||||
@tab PGM with U and V components in YUV 4:2:0
|
||||
@item PGX @tab @tab X
|
||||
@tab PGX file decoder
|
||||
@item PHM @tab X @tab X
|
||||
@tab Portable HalfFloatMap image
|
||||
@item PIC @tab @tab X
|
||||
@tab Pictor/PC Paint
|
||||
@item PNG @tab X @tab X
|
||||
@ -777,6 +787,8 @@ following image formats are supported:
|
||||
@tab Photoshop
|
||||
@item PTX @tab @tab X
|
||||
@tab V.Flash PTX format
|
||||
@item QOI @tab X @tab X
|
||||
@tab Quite OK Image format
|
||||
@item SGI @tab X @tab X
|
||||
@tab SGI RGB image format
|
||||
@item Sun Rasterfile @tab X @tab X
|
||||
@ -785,6 +797,8 @@ following image formats are supported:
|
||||
@tab YUV, JPEG and some extension is not supported yet.
|
||||
@item Truevision Targa @tab X @tab X
|
||||
@tab Targa (.TGA) image format
|
||||
@item VBN @tab X @tab X
|
||||
@tab Vizrt Binary Image format
|
||||
@item WebP @tab E @tab X
|
||||
@tab WebP image format, encoding supported through external library libwebp
|
||||
@item XBM @tab X @tab X
|
||||
@ -1194,6 +1208,7 @@ following image formats are supported:
|
||||
@item CRI HCA @tab @tab X
|
||||
@item Delphine Software International CIN audio @tab @tab X
|
||||
@tab Codec used in Delphine Software International games.
|
||||
@item DFPWM @tab X @tab X
|
||||
@item Digital Speech Standard - Standard Play mode (DSS SP) @tab @tab X
|
||||
@item Discworld II BMV Audio @tab @tab X
|
||||
@item COOK @tab @tab X
|
||||
|
@ -1289,11 +1289,11 @@ Specify the samplerate in Hz, by default 48kHz is used.
|
||||
Specify the channels in use, by default 2 (stereo) is set.
|
||||
|
||||
@item frame_size
|
||||
Specify the number of bytes per frame, by default it is set to 1024.
|
||||
This option does nothing and is deprecated.
|
||||
|
||||
@item fragment_size
|
||||
Specify the minimal buffering fragment in PulseAudio, it will affect the
|
||||
audio latency. By default it is unset.
|
||||
Specify the size in bytes of the minimal buffering fragment in PulseAudio, it
|
||||
will affect the audio latency. By default it is set to 50 ms amount of data.
|
||||
|
||||
@item wallclock
|
||||
Set the initial PTS using the current time. Default is 1.
|
||||
|
@ -1060,6 +1060,8 @@ and remove the @code{#EXT-X-ENDLIST} from the old segment list.
|
||||
@item round_durations
|
||||
Round the duration info in the playlist file segment info to integer
|
||||
values, instead of using floating point.
|
||||
If there are no other features requiring higher HLS versions be used,
|
||||
then this will allow ffmpeg to output a HLS version 2 m3u8.
|
||||
|
||||
@item discont_start
|
||||
Add the @code{#EXT-X-DISCONTINUITY} tag to the playlist, before the
|
||||
@ -1567,6 +1569,15 @@ A safe size for most use cases should be about 50kB per hour of video.
|
||||
|
||||
Note that cues are only written if the output is seekable and this option will
|
||||
have no effect if it is not.
|
||||
|
||||
@item cues_to_front
|
||||
If set, the muxer will write the index at the beginning of the file
|
||||
by shifting the main data if necessary. This can be combined with
|
||||
reserve_index_space in which case the data is only shifted if
|
||||
the initially reserved space turns out to be insufficient.
|
||||
|
||||
This option is ignored if the output is unseekable.
|
||||
|
||||
@item default_mode
|
||||
This option controls how the FlagDefault of the output tracks will be set.
|
||||
It influences which tracks players should play by default. The default mode
|
||||
@ -1722,6 +1733,14 @@ B-frames. Additionally, eases conformance with the DASH-IF interoperability
|
||||
guidelines.
|
||||
|
||||
This option is implicitly set when writing ismv (Smooth Streaming) files.
|
||||
|
||||
@item -write_btrt @var{bool}
|
||||
Force or disable writing bitrate box inside stsd box of a track.
|
||||
The box contains decoding buffer size (in bytes), maximum bitrate and
|
||||
average bitrate for the track. The box will be skipped if none of these values
|
||||
can be computed.
|
||||
Default is @code{-1} or @code{auto}, which will write the box only in MP4 mode.
|
||||
|
||||
@item -write_prft
|
||||
Write producer time reference box (PRFT) with a specified time source for the
|
||||
NTP field in the PRFT box. Set value as @samp{wallclock} to specify timesource
|
||||
@ -1733,10 +1752,18 @@ where PTS values are set as as wallclock time at the source. For example, an
|
||||
encoding use case with decklink capture source where @option{video_pts} and
|
||||
@option{audio_pts} are set to @samp{abs_wallclock}.
|
||||
|
||||
@item -empty_hdlr_name @var{bool}
|
||||
Enable to skip writing the name inside a @code{hdlr} box.
|
||||
Default is @code{false}.
|
||||
|
||||
@item -movie_timescale @var{scale}
|
||||
Set the timescale written in the movie header box (@code{mvhd}).
|
||||
Range is 1 to INT_MAX. Default is 1000.
|
||||
|
||||
@item -video_track_timescale @var{scale}
|
||||
Set the timescale used for video tracks. Range is 0 to INT_MAX.
|
||||
If set to @code{0}, the timescale is automatically set based on
|
||||
the native stream time base. Default is 0.
|
||||
@end table
|
||||
|
||||
@subsection Example
|
||||
|
@ -614,6 +614,38 @@ Establish a TLS (HTTPS) connection to Icecast.
|
||||
icecast://[@var{username}[:@var{password}]@@]@var{server}:@var{port}/@var{mountpoint}
|
||||
@end example
|
||||
|
||||
@section ipfs
|
||||
|
||||
InterPlanetary File System (IPFS) protocol support. One can access files stored
|
||||
on the IPFS network through so-called gateways. These are http(s) endpoints.
|
||||
This protocol wraps the IPFS native protocols (ipfs:// and ipns://) to be sent
|
||||
to such a gateway. Users can (and should) host their own node which means this
|
||||
protocol will use one's local gateway to access files on the IPFS network.
|
||||
|
||||
If a user doesn't have a node of their own then the public gateway @code{https://dweb.link}
|
||||
is used by default.
|
||||
|
||||
This protocol accepts the following options:
|
||||
|
||||
@table @option
|
||||
|
||||
@item gateway
|
||||
Defines the gateway to use. When not set, the protocol will first try
|
||||
locating the local gateway by looking at @code{$IPFS_GATEWAY}, @code{$IPFS_PATH}
|
||||
and @code{$HOME/.ipfs/}, in that order. If that fails @code{https://dweb.link} will be used.
|
||||
|
||||
@end table
|
||||
|
||||
One can use this protocol in 2 ways. Using IPFS:
|
||||
@example
|
||||
ffplay ipfs://QmbGtJg23skhvFmu9mJiePVByhfzu5rwo74MEkVDYAmF5T
|
||||
@end example
|
||||
|
||||
Or the IPNS protocol (IPNS is mutable IPFS):
|
||||
@example
|
||||
ffplay ipns://QmbGtJg23skhvFmu9mJiePVByhfzu5rwo74MEkVDYAmF5T
|
||||
@end example
|
||||
|
||||
@section mmst
|
||||
|
||||
MMS (Microsoft Media Server) protocol over TCP.
|
||||
@ -745,6 +777,14 @@ Set internal RIST buffer size in milliseconds for retransmission of data.
|
||||
Default value is 0 which means the librist default (1 sec). Maximum value is 30
|
||||
seconds.
|
||||
|
||||
@item fifo_size
|
||||
Size of the librist receiver output fifo in number of packets. This must be a
|
||||
power of 2.
|
||||
Defaults to 8192 (vs the librist default of 1024).
|
||||
|
||||
@item overrun_nonfatal=@var{1|0}
|
||||
Survive in case of librist fifo buffer overrun. Default value is 0.
|
||||
|
||||
@item pkt_size
|
||||
Set maximum packet size for sending data. 1316 by default.
|
||||
|
||||
@ -2025,5 +2065,4 @@ decoding errors.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@c man end PROTOCOLS
|
||||
|
@ -723,20 +723,28 @@ DL+DR
|
||||
FL+FR+FC+LFE+BL+BR+FLC+FRC+BC+SL+SR+TC+TFL+TFC+TFR+TBL+TBC+TBR+LFE2+TSL+TSR+BFC+BFL+BFR
|
||||
@end table
|
||||
|
||||
A custom channel layout can be specified as a sequence of terms, separated by
|
||||
'+' or '|'. Each term can be:
|
||||
A custom channel layout can be specified as a sequence of terms, separated by '+'.
|
||||
Each term can be:
|
||||
@itemize
|
||||
@item
|
||||
the name of a single channel (e.g. @samp{FL}, @samp{FR}, @samp{FC}, @samp{LFE}, etc.),
|
||||
each optionally containing a custom name after a '@@', (e.g. @samp{FL@@Left},
|
||||
@samp{FR@@Right}, @samp{FC@@Center}, @samp{LFE@@Low_Frequency}, etc.)
|
||||
@end itemize
|
||||
|
||||
A standard channel layout can be specified by the following:
|
||||
@itemize
|
||||
@item
|
||||
the name of a single channel (e.g. @samp{FL}, @samp{FR}, @samp{FC}, @samp{LFE}, etc.)
|
||||
|
||||
@item
|
||||
the name of a standard channel layout (e.g. @samp{mono},
|
||||
@samp{stereo}, @samp{4.0}, @samp{quad}, @samp{5.0}, etc.)
|
||||
|
||||
@item
|
||||
the name of a single channel (e.g. @samp{FL}, @samp{FR}, @samp{FC}, @samp{LFE}, etc.)
|
||||
|
||||
@item
|
||||
a number of channels, in decimal, followed by 'c', yielding the default channel
|
||||
layout for that number of channels (see the function
|
||||
@code{av_get_default_channel_layout}). Note that not all channel counts have a
|
||||
@code{av_channel_layout_default}). Note that not all channel counts have a
|
||||
default layout.
|
||||
|
||||
@item
|
||||
@ -753,7 +761,7 @@ Before libavutil version 53 the trailing character "c" to specify a number of
|
||||
channels was optional, but now it is required, while a channel layout mask can
|
||||
also be specified as a decimal number (if and only if not followed by "c" or "C").
|
||||
|
||||
See also the function @code{av_get_channel_layout} defined in
|
||||
See also the function @code{av_channel_layout_from_string} defined in
|
||||
@file{libavutil/channel_layout.h}.
|
||||
@c man end SYNTAX
|
||||
|
||||
|
@ -29,7 +29,8 @@ $(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR))))
|
||||
$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_DIR)/%=%)); $(INSTALL))
|
||||
endif
|
||||
|
||||
ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale swresample
|
||||
# Prepend to a recursively expanded variable without making it simply expanded.
|
||||
PREPEND = $(eval $(1) = $(patsubst %,$$(%), $(2)) $(value $(1)))
|
||||
|
||||
# NASM requires -I path terminated with /
|
||||
IFLAGS := -I. -I$(SRC_LINK)/
|
||||
@ -39,7 +40,9 @@ CCFLAGS = $(CPPFLAGS) $(CFLAGS)
|
||||
OBJCFLAGS += $(EOBJCFLAGS)
|
||||
OBJCCFLAGS = $(CPPFLAGS) $(CFLAGS) $(OBJCFLAGS)
|
||||
ASFLAGS := $(CPPFLAGS) $(ASFLAGS)
|
||||
CXXFLAGS := $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS)
|
||||
# Use PREPEND here so that later (target-dependent) additions to CPPFLAGS
|
||||
# end up in CXXFLAGS.
|
||||
$(call PREPEND,CXXFLAGS, CPPFLAGS CFLAGS)
|
||||
X86ASMFLAGS += $(IFLAGS:%=%/) -I$(<D)/ -Pconfig.asm
|
||||
|
||||
HOSTCCFLAGS = $(IFLAGS) $(HOSTCPPFLAGS) $(HOSTCFLAGS)
|
||||
|
@ -52,8 +52,8 @@ $(LIBOBJS): CPPFLAGS += -DBUILDING_$(NAME)
|
||||
$(TESTPROGS) $(TOOLS): %$(EXESUF): %.o
|
||||
$$(LD) $(LDFLAGS) $(LDEXEFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) $(FFEXTRALIBS) $$(EXTRALIBS-$$(*F)) $$(ELIBS)
|
||||
|
||||
$(SUBDIR)lib$(NAME).version: $(SUBDIR)version.h | $(SUBDIR)
|
||||
$$(M) $$(SRC_PATH)/ffbuild/libversion.sh $(NAME) $$< > $$@
|
||||
$(SUBDIR)lib$(NAME).version: $(SUBDIR)version.h $(SUBDIR)version_major.h | $(SUBDIR)
|
||||
$$(M) $$(SRC_PATH)/ffbuild/libversion.sh $(NAME) $$^ > $$@
|
||||
|
||||
$(SUBDIR)lib$(FULLNAME).pc: $(SUBDIR)version.h ffbuild/config.sh | $(SUBDIR)
|
||||
$$(M) $$(SRC_PATH)/ffbuild/pkgconfig_generate.sh $(NAME) "$(DESC)"
|
||||
|
@ -5,8 +5,12 @@ toupper(){
|
||||
name=lib$1
|
||||
ucname=$(toupper ${name})
|
||||
file=$2
|
||||
file2=$3
|
||||
|
||||
eval $(awk "/#define ${ucname}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file")
|
||||
if [ -f "$file2" ]; then
|
||||
eval $(awk "/#define ${ucname}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file2")
|
||||
fi
|
||||
eval ${ucname}_VERSION=\$${ucname}_VERSION_MAJOR.\$${ucname}_VERSION_MINOR.\$${ucname}_VERSION_MICRO
|
||||
eval echo "${name}_VERSION=\$${ucname}_VERSION"
|
||||
eval echo "${name}_VERSION_MAJOR=\$${ucname}_VERSION_MAJOR"
|
||||
|
@ -9,10 +9,14 @@ AVBASENAMES = ffmpeg ffplay ffprobe
|
||||
ALLAVPROGS = $(AVBASENAMES:%=%$(PROGSSUF)$(EXESUF))
|
||||
ALLAVPROGS_G = $(AVBASENAMES:%=%$(PROGSSUF)_g$(EXESUF))
|
||||
|
||||
OBJS-ffmpeg += fftools/ffmpeg_opt.o fftools/ffmpeg_filter.o fftools/ffmpeg_hw.o
|
||||
OBJS-ffmpeg += \
|
||||
fftools/ffmpeg_filter.o \
|
||||
fftools/ffmpeg_hw.o \
|
||||
fftools/ffmpeg_mux.o \
|
||||
fftools/ffmpeg_opt.o \
|
||||
|
||||
define DOFFTOOL
|
||||
OBJS-$(1) += fftools/cmdutils.o fftools/$(1).o $(OBJS-$(1)-yes)
|
||||
OBJS-$(1) += fftools/cmdutils.o fftools/opt_common.o fftools/$(1).o $(OBJS-$(1)-yes)
|
||||
$(1)$(PROGSSUF)_g$(EXESUF): $$(OBJS-$(1))
|
||||
$$(OBJS-$(1)): | fftools
|
||||
$$(OBJS-$(1)): CFLAGS += $(CFLAGS-$(1))
|
||||
|
1493
fftools/cmdutils.c
1493
fftools/cmdutils.c
File diff suppressed because it is too large
Load Diff
@ -44,8 +44,6 @@ extern const char program_name[];
|
||||
*/
|
||||
extern const int program_birth_year;
|
||||
|
||||
extern AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB];
|
||||
extern AVFormatContext *avformat_opts;
|
||||
extern AVDictionary *sws_dict;
|
||||
extern AVDictionary *swr_opts;
|
||||
extern AVDictionary *format_opts, *codec_opts;
|
||||
@ -66,11 +64,6 @@ void exit_program(int ret) av_noreturn;
|
||||
*/
|
||||
void init_dynload(void);
|
||||
|
||||
/**
|
||||
* Initialize the cmdutils option system, in particular
|
||||
* allocate the *_opts contexts.
|
||||
*/
|
||||
void init_opts(void);
|
||||
/**
|
||||
* Uninitialize the cmdutils option system, in particular
|
||||
* free the *_opts contexts and their contents.
|
||||
@ -83,33 +76,12 @@ void uninit_opts(void);
|
||||
*/
|
||||
void log_callback_help(void* ptr, int level, const char* fmt, va_list vl);
|
||||
|
||||
/**
|
||||
* Override the cpuflags.
|
||||
*/
|
||||
int opt_cpuflags(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Override the cpucount.
|
||||
*/
|
||||
int opt_cpucount(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Fallback for options that are not explicitly handled, these will be
|
||||
* parsed through AVOptions.
|
||||
*/
|
||||
int opt_default(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Set the libav* libraries log level.
|
||||
*/
|
||||
int opt_loglevel(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
int opt_report(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
int opt_max_alloc(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
int opt_codec_debug(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Limit the execution time.
|
||||
*/
|
||||
@ -206,49 +178,6 @@ typedef struct OptionDef {
|
||||
void show_help_options(const OptionDef *options, const char *msg, int req_flags,
|
||||
int rej_flags, int alt_flags);
|
||||
|
||||
#if CONFIG_AVDEVICE
|
||||
#define CMDUTILS_COMMON_OPTIONS_AVDEVICE \
|
||||
{ "sources" , OPT_EXIT | HAS_ARG, { .func_arg = show_sources }, \
|
||||
"list sources of the input device", "device" }, \
|
||||
{ "sinks" , OPT_EXIT | HAS_ARG, { .func_arg = show_sinks }, \
|
||||
"list sinks of the output device", "device" }, \
|
||||
|
||||
#else
|
||||
#define CMDUTILS_COMMON_OPTIONS_AVDEVICE
|
||||
#endif
|
||||
|
||||
#define CMDUTILS_COMMON_OPTIONS \
|
||||
{ "L", OPT_EXIT, { .func_arg = show_license }, "show license" }, \
|
||||
{ "h", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
|
||||
{ "?", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
|
||||
{ "help", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
|
||||
{ "-help", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
|
||||
{ "version", OPT_EXIT, { .func_arg = show_version }, "show version" }, \
|
||||
{ "buildconf", OPT_EXIT, { .func_arg = show_buildconf }, "show build configuration" }, \
|
||||
{ "formats", OPT_EXIT, { .func_arg = show_formats }, "show available formats" }, \
|
||||
{ "muxers", OPT_EXIT, { .func_arg = show_muxers }, "show available muxers" }, \
|
||||
{ "demuxers", OPT_EXIT, { .func_arg = show_demuxers }, "show available demuxers" }, \
|
||||
{ "devices", OPT_EXIT, { .func_arg = show_devices }, "show available devices" }, \
|
||||
{ "codecs", OPT_EXIT, { .func_arg = show_codecs }, "show available codecs" }, \
|
||||
{ "decoders", OPT_EXIT, { .func_arg = show_decoders }, "show available decoders" }, \
|
||||
{ "encoders", OPT_EXIT, { .func_arg = show_encoders }, "show available encoders" }, \
|
||||
{ "bsfs", OPT_EXIT, { .func_arg = show_bsfs }, "show available bit stream filters" }, \
|
||||
{ "protocols", OPT_EXIT, { .func_arg = show_protocols }, "show available protocols" }, \
|
||||
{ "filters", OPT_EXIT, { .func_arg = show_filters }, "show available filters" }, \
|
||||
{ "pix_fmts", OPT_EXIT, { .func_arg = show_pix_fmts }, "show available pixel formats" }, \
|
||||
{ "layouts", OPT_EXIT, { .func_arg = show_layouts }, "show standard channel layouts" }, \
|
||||
{ "sample_fmts", OPT_EXIT, { .func_arg = show_sample_fmts }, "show available audio sample formats" }, \
|
||||
{ "dispositions", OPT_EXIT, { .func_arg = show_dispositions}, "show available stream dispositions" }, \
|
||||
{ "colors", OPT_EXIT, { .func_arg = show_colors }, "show available color names" }, \
|
||||
{ "loglevel", HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
|
||||
{ "v", HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
|
||||
{ "report", 0, { .func_arg = opt_report }, "generate a report" }, \
|
||||
{ "max_alloc", HAS_ARG, { .func_arg = opt_max_alloc }, "set maximum size of a single allocated block", "bytes" }, \
|
||||
{ "cpuflags", HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" }, \
|
||||
{ "cpucount", HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpucount }, "force specific cpu count", "count" }, \
|
||||
{ "hide_banner", OPT_BOOL | OPT_EXPERT, {&hide_banner}, "do not show program banner", "hide_banner" }, \
|
||||
CMDUTILS_COMMON_OPTIONS_AVDEVICE \
|
||||
|
||||
/**
|
||||
* Show help for all options with given flags in class and all its
|
||||
* children.
|
||||
@ -261,11 +190,6 @@ void show_help_children(const AVClass *class, int flags);
|
||||
*/
|
||||
void show_help_default(const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Generic -h handler common to all fftools.
|
||||
*/
|
||||
int show_help(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Parse the command line arguments.
|
||||
*
|
||||
@ -454,141 +378,6 @@ void print_error(const char *filename, int err);
|
||||
*/
|
||||
void show_banner(int argc, char **argv, const OptionDef *options);
|
||||
|
||||
/**
|
||||
* Print the version of the program to stdout. The version message
|
||||
* depends on the current versions of the repository and of the libav*
|
||||
* libraries.
|
||||
* This option processing function does not utilize the arguments.
|
||||
*/
|
||||
int show_version(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print the build configuration of the program to stdout. The contents
|
||||
* depend on the definition of FFMPEG_CONFIGURATION.
|
||||
* This option processing function does not utilize the arguments.
|
||||
*/
|
||||
int show_buildconf(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print the license of the program to stdout. The license depends on
|
||||
* the license of the libraries compiled into the program.
|
||||
* This option processing function does not utilize the arguments.
|
||||
*/
|
||||
int show_license(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the formats supported by the
|
||||
* program (including devices).
|
||||
* This option processing function does not utilize the arguments.
|
||||
*/
|
||||
int show_formats(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the muxers supported by the
|
||||
* program (including devices).
|
||||
* This option processing function does not utilize the arguments.
|
||||
*/
|
||||
int show_muxers(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the demuxer supported by the
|
||||
* program (including devices).
|
||||
* This option processing function does not utilize the arguments.
|
||||
*/
|
||||
int show_demuxers(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the devices supported by the
|
||||
* program.
|
||||
* This option processing function does not utilize the arguments.
|
||||
*/
|
||||
int show_devices(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
#if CONFIG_AVDEVICE
|
||||
/**
|
||||
* Print a listing containing autodetected sinks of the output device.
|
||||
* Device name with options may be passed as an argument to limit results.
|
||||
*/
|
||||
int show_sinks(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing autodetected sources of the input device.
|
||||
* Device name with options may be passed as an argument to limit results.
|
||||
*/
|
||||
int show_sources(void *optctx, const char *opt, const char *arg);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Print a listing containing all the codecs supported by the
|
||||
* program.
|
||||
* This option processing function does not utilize the arguments.
|
||||
*/
|
||||
int show_codecs(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the decoders supported by the
|
||||
* program.
|
||||
*/
|
||||
int show_decoders(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the encoders supported by the
|
||||
* program.
|
||||
*/
|
||||
int show_encoders(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the filters supported by the
|
||||
* program.
|
||||
* This option processing function does not utilize the arguments.
|
||||
*/
|
||||
int show_filters(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the bit stream filters supported by the
|
||||
* program.
|
||||
* This option processing function does not utilize the arguments.
|
||||
*/
|
||||
int show_bsfs(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the protocols supported by the
|
||||
* program.
|
||||
* This option processing function does not utilize the arguments.
|
||||
*/
|
||||
int show_protocols(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the pixel formats supported by the
|
||||
* program.
|
||||
* This option processing function does not utilize the arguments.
|
||||
*/
|
||||
int show_pix_fmts(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the standard channel layouts supported by
|
||||
* the program.
|
||||
* This option processing function does not utilize the arguments.
|
||||
*/
|
||||
int show_layouts(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the sample formats supported by the
|
||||
* program.
|
||||
*/
|
||||
int show_sample_fmts(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all supported stream dispositions.
|
||||
*/
|
||||
int show_dispositions(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the color names and values recognized
|
||||
* by the program.
|
||||
*/
|
||||
int show_colors(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Return a positive value if a line read from standard input
|
||||
* starts with [yY], otherwise return 0.
|
||||
@ -642,8 +431,6 @@ void *grow_array(void *array, int elem_size, int *size, int new_size);
|
||||
*/
|
||||
void *allocate_array_elem(void *array, size_t elem_size, int *nb_elems);
|
||||
|
||||
#define media_type_string av_get_media_type_string
|
||||
|
||||
#define GROW_ARRAY(array, nb_elems)\
|
||||
array = grow_array(array, sizeof(*array), &nb_elems, nb_elems + 1)
|
||||
|
||||
@ -663,14 +450,6 @@ void *allocate_array_elem(void *array, size_t elem_size, int *nb_elems);
|
||||
char name[16];\
|
||||
snprintf(name, sizeof(name), "%d", rate);
|
||||
|
||||
#define GET_CH_LAYOUT_NAME(ch_layout)\
|
||||
char name[16];\
|
||||
snprintf(name, sizeof(name), "0x%"PRIx64, ch_layout);
|
||||
|
||||
#define GET_CH_LAYOUT_DESC(ch_layout)\
|
||||
char name[128];\
|
||||
av_get_channel_layout_string(name, sizeof(name), 0, ch_layout);
|
||||
|
||||
double get_rotation(int32_t *displaymatrix);
|
||||
|
||||
#endif /* FFTOOLS_CMDUTILS_H */
|
||||
|
868
fftools/ffmpeg.c
868
fftools/ffmpeg.c
File diff suppressed because it is too large
Load Diff
@ -96,6 +96,8 @@ typedef struct OptionsContext {
|
||||
|
||||
SpecifierOpt *codec_names;
|
||||
int nb_codec_names;
|
||||
SpecifierOpt *audio_ch_layouts;
|
||||
int nb_audio_ch_layouts;
|
||||
SpecifierOpt *audio_channels;
|
||||
int nb_audio_channels;
|
||||
SpecifierOpt *audio_sample_rate;
|
||||
@ -116,6 +118,7 @@ typedef struct OptionsContext {
|
||||
float readrate;
|
||||
int accurate_seek;
|
||||
int thread_queue_size;
|
||||
int input_sync_ref;
|
||||
|
||||
SpecifierOpt *ts_scale;
|
||||
int nb_ts_scale;
|
||||
@ -174,6 +177,8 @@ typedef struct OptionsContext {
|
||||
int nb_qscale;
|
||||
SpecifierOpt *forced_key_frames;
|
||||
int nb_forced_key_frames;
|
||||
SpecifierOpt *fps_mode;
|
||||
int nb_fps_mode;
|
||||
SpecifierOpt *force_fps;
|
||||
int nb_force_fps;
|
||||
SpecifierOpt *frame_aspect_ratios;
|
||||
@ -241,7 +246,7 @@ typedef struct InputFilter {
|
||||
uint8_t *name;
|
||||
enum AVMediaType type; // AVMEDIA_TYPE_SUBTITLE for sub2video
|
||||
|
||||
AVFifoBuffer *frame_queue;
|
||||
AVFifo *frame_queue;
|
||||
|
||||
// parameters configured for this input
|
||||
int format;
|
||||
@ -250,8 +255,7 @@ typedef struct InputFilter {
|
||||
AVRational sample_aspect_ratio;
|
||||
|
||||
int sample_rate;
|
||||
int channels;
|
||||
uint64_t channel_layout;
|
||||
AVChannelLayout ch_layout;
|
||||
|
||||
AVBufferRef *hw_frames_ctx;
|
||||
int32_t *displaymatrix;
|
||||
@ -274,12 +278,12 @@ typedef struct OutputFilter {
|
||||
AVRational frame_rate;
|
||||
int format;
|
||||
int sample_rate;
|
||||
uint64_t channel_layout;
|
||||
AVChannelLayout ch_layout;
|
||||
|
||||
// those are only set if no format is specified and the encoder gives us multiple options
|
||||
// They point directly to the relevant lists of the encoder.
|
||||
const int *formats;
|
||||
const uint64_t *channel_layouts;
|
||||
const AVChannelLayout *ch_layouts;
|
||||
const int *sample_rates;
|
||||
} OutputFilter;
|
||||
|
||||
@ -307,6 +311,7 @@ typedef struct InputStream {
|
||||
int decoding_needed; /* non zero if the packets must be decoded in 'raw_fifo', see DECODING_FOR_* */
|
||||
#define DECODING_FOR_OST 1
|
||||
#define DECODING_FOR_FILTER 2
|
||||
int processing_needed; /* non zero if the packets must be processed */
|
||||
|
||||
AVCodecContext *dec_ctx;
|
||||
const AVCodec *dec;
|
||||
@ -355,7 +360,7 @@ typedef struct InputStream {
|
||||
struct sub2video {
|
||||
int64_t last_pts;
|
||||
int64_t end_pts;
|
||||
AVFifoBuffer *sub_queue; ///< queue of AVSubtitle* before filter init
|
||||
AVFifo *sub_queue; ///< queue of AVSubtitle* before filter init
|
||||
AVFrame *frame;
|
||||
int w, h;
|
||||
unsigned int initialize; ///< marks if sub2video_update should force an initialization
|
||||
@ -406,6 +411,7 @@ typedef struct InputFile {
|
||||
at the moment when looping happens */
|
||||
AVRational time_base; /* time base of the duration */
|
||||
int64_t input_ts_offset;
|
||||
int input_sync_ref;
|
||||
|
||||
int64_t ts_offset;
|
||||
int64_t last_ts;
|
||||
@ -454,7 +460,7 @@ typedef struct OutputStream {
|
||||
int source_index; /* InputStream index */
|
||||
AVStream *st; /* stream in the output file */
|
||||
int encoding_needed; /* true if encoding needed for this stream */
|
||||
int frame_number;
|
||||
int64_t frame_number;
|
||||
/* input pts and corresponding output pts
|
||||
for A/V sync */
|
||||
struct InputStream *sync_ist; /* input stream to sync against */
|
||||
@ -477,8 +483,8 @@ typedef struct OutputStream {
|
||||
AVFrame *filtered_frame;
|
||||
AVFrame *last_frame;
|
||||
AVPacket *pkt;
|
||||
int last_dropped;
|
||||
int last_nb0_frames[3];
|
||||
int64_t last_dropped;
|
||||
int64_t last_nb0_frames[3];
|
||||
|
||||
void *hwaccel_ctx;
|
||||
|
||||
@ -487,6 +493,7 @@ typedef struct OutputStream {
|
||||
AVRational max_frame_rate;
|
||||
enum VideoSyncMethod vsync_method;
|
||||
int is_cfr;
|
||||
const char *fps_mode;
|
||||
int force_fps;
|
||||
int top_field_first;
|
||||
int rotate_overridden;
|
||||
@ -534,6 +541,7 @@ typedef struct OutputStream {
|
||||
int inputs_done;
|
||||
|
||||
const char *attachment_filename;
|
||||
int streamcopy_started;
|
||||
int copy_initial_nonkeyframes;
|
||||
int copy_prior_start;
|
||||
char *disposition;
|
||||
@ -548,6 +556,8 @@ typedef struct OutputStream {
|
||||
// number of frames/samples sent to the encoder
|
||||
uint64_t frames_encoded;
|
||||
uint64_t samples_encoded;
|
||||
// number of packets received from the encoder
|
||||
uint64_t packets_encoded;
|
||||
|
||||
/* packet quality factor */
|
||||
int quality;
|
||||
@ -555,7 +565,7 @@ typedef struct OutputStream {
|
||||
int max_muxing_queue_size;
|
||||
|
||||
/* the packets are buffered here until the muxer is ready to be initialized */
|
||||
AVFifoBuffer *muxing_queue;
|
||||
AVFifo *muxing_queue;
|
||||
|
||||
/*
|
||||
* The size of the AVPackets' buffers in queue.
|
||||
@ -574,6 +584,10 @@ typedef struct OutputStream {
|
||||
} OutputStream;
|
||||
|
||||
typedef struct OutputFile {
|
||||
int index;
|
||||
|
||||
const AVOutputFormat *format;
|
||||
|
||||
AVFormatContext *ctx;
|
||||
AVDictionary *opts;
|
||||
int ost_index; /* index of the first stream in output_streams */
|
||||
@ -642,6 +656,10 @@ extern char *qsv_device;
|
||||
#endif
|
||||
extern HWDevice *filter_hw_device;
|
||||
|
||||
extern int want_sdp;
|
||||
extern unsigned nb_output_dumped;
|
||||
extern int main_return_code;
|
||||
|
||||
|
||||
void term_init(void);
|
||||
void term_exit(void);
|
||||
@ -678,4 +696,12 @@ int hw_device_setup_for_filter(FilterGraph *fg);
|
||||
|
||||
int hwaccel_decode_init(AVCodecContext *avctx);
|
||||
|
||||
/* open the muxer when all the streams are initialized */
|
||||
int of_check_init(OutputFile *of);
|
||||
int of_write_trailer(OutputFile *of);
|
||||
void of_close(OutputFile **pof);
|
||||
|
||||
void of_write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost,
|
||||
int unqueue);
|
||||
|
||||
#endif /* FFTOOLS_FFMPEG_H */
|
||||
|
@ -153,8 +153,25 @@ DEF_CHOOSE_FORMAT(sample_fmts, enum AVSampleFormat, format, formats,
|
||||
DEF_CHOOSE_FORMAT(sample_rates, int, sample_rate, sample_rates, 0,
|
||||
"%d", )
|
||||
|
||||
DEF_CHOOSE_FORMAT(channel_layouts, uint64_t, channel_layout, channel_layouts, 0,
|
||||
"0x%"PRIx64, )
|
||||
static void choose_channel_layouts(OutputFilter *ofilter, AVBPrint *bprint)
|
||||
{
|
||||
if (av_channel_layout_check(&ofilter->ch_layout)) {
|
||||
av_bprintf(bprint, "channel_layouts=");
|
||||
av_channel_layout_describe_bprint(&ofilter->ch_layout, bprint);
|
||||
} else if (ofilter->ch_layouts) {
|
||||
const AVChannelLayout *p;
|
||||
|
||||
av_bprintf(bprint, "channel_layouts=");
|
||||
for (p = ofilter->ch_layouts; p->nb_channels; p++) {
|
||||
av_channel_layout_describe_bprint(p, bprint);
|
||||
av_bprintf(bprint, "|");
|
||||
}
|
||||
if (bprint->len > 0)
|
||||
bprint->str[--bprint->len] = '\0';
|
||||
} else
|
||||
return;
|
||||
av_bprint_chars(bprint, ':', 1);
|
||||
}
|
||||
|
||||
int init_simple_filtergraph(InputStream *ist, OutputStream *ost)
|
||||
{
|
||||
@ -178,7 +195,7 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost)
|
||||
ifilter->graph = fg;
|
||||
ifilter->format = -1;
|
||||
|
||||
ifilter->frame_queue = av_fifo_alloc(8 * sizeof(AVFrame*));
|
||||
ifilter->frame_queue = av_fifo_alloc2(8, sizeof(AVFrame*), AV_FIFO_FLAG_AUTO_GROW);
|
||||
if (!ifilter->frame_queue)
|
||||
exit_program(1);
|
||||
|
||||
@ -277,6 +294,7 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in)
|
||||
|
||||
ist->discard = 0;
|
||||
ist->decoding_needed |= DECODING_FOR_FILTER;
|
||||
ist->processing_needed = 1;
|
||||
ist->st->discard = AVDISCARD_NONE;
|
||||
|
||||
ifilter = ALLOC_ARRAY_ELEM(fg->inputs, fg->nb_inputs);
|
||||
@ -286,7 +304,7 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in)
|
||||
ifilter->type = ist->st->codecpar->codec_type;
|
||||
ifilter->name = describe_filter_link(fg, in, 1);
|
||||
|
||||
ifilter->frame_queue = av_fifo_alloc(8 * sizeof(AVFrame*));
|
||||
ifilter->frame_queue = av_fifo_alloc2(8, sizeof(AVFrame*), AV_FIFO_FLAG_AUTO_GROW);
|
||||
if (!ifilter->frame_queue)
|
||||
exit_program(1);
|
||||
|
||||
@ -541,9 +559,10 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter,
|
||||
} while (0)
|
||||
av_bprint_init(&args, 0, AV_BPRINT_SIZE_UNLIMITED);
|
||||
if (ost->audio_channels_mapped) {
|
||||
AVChannelLayout mapped_layout = { 0 };
|
||||
int i;
|
||||
av_bprintf(&args, "0x%"PRIx64,
|
||||
av_get_default_channel_layout(ost->audio_channels_mapped));
|
||||
av_channel_layout_default(&mapped_layout, ost->audio_channels_mapped);
|
||||
av_channel_layout_describe_bprint(&mapped_layout, &args);
|
||||
for (i = 0; i < ost->audio_channels_mapped; i++)
|
||||
if (ost->audio_channels_map[i] != -1)
|
||||
av_bprintf(&args, "|c%d=c%d", i, ost->audio_channels_map[i]);
|
||||
@ -552,8 +571,8 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter,
|
||||
av_bprint_clear(&args);
|
||||
}
|
||||
|
||||
if (codec->channels && !codec->channel_layout)
|
||||
codec->channel_layout = av_get_default_channel_layout(codec->channels);
|
||||
if (codec->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC)
|
||||
av_channel_layout_default(&codec->ch_layout, codec->ch_layout.nb_channels);
|
||||
|
||||
choose_sample_fmts(ofilter, &args);
|
||||
choose_sample_rates(ofilter, &args);
|
||||
@ -832,11 +851,12 @@ static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter,
|
||||
1, ifilter->sample_rate,
|
||||
ifilter->sample_rate,
|
||||
av_get_sample_fmt_name(ifilter->format));
|
||||
if (ifilter->channel_layout)
|
||||
av_bprintf(&args, ":channel_layout=0x%"PRIx64,
|
||||
ifilter->channel_layout);
|
||||
else
|
||||
av_bprintf(&args, ":channels=%d", ifilter->channels);
|
||||
if (av_channel_layout_check(&ifilter->ch_layout) &&
|
||||
ifilter->ch_layout.order != AV_CHANNEL_ORDER_UNSPEC) {
|
||||
av_bprintf(&args, ":channel_layout=");
|
||||
av_channel_layout_describe_bprint(&ifilter->ch_layout, &args);
|
||||
} else
|
||||
av_bprintf(&args, ":channels=%d", ifilter->ch_layout.nb_channels);
|
||||
snprintf(name, sizeof(name), "graph_%d_in_%d_%d", fg->index,
|
||||
ist->file_index, ist->st->index);
|
||||
|
||||
@ -949,8 +969,8 @@ static void cleanup_filtergraph(FilterGraph *fg)
|
||||
static int filter_is_buffersrc(const AVFilterContext *f)
|
||||
{
|
||||
return f->nb_inputs == 0 &&
|
||||
(!strcmp(f->filter->name, "buffersrc") ||
|
||||
!strcmp(f->filter->name, "abuffersrc"));
|
||||
(!strcmp(f->filter->name, "buffer") ||
|
||||
!strcmp(f->filter->name, "abuffer"));
|
||||
}
|
||||
|
||||
static int graph_is_meta(AVFilterGraph *graph)
|
||||
@ -1084,7 +1104,10 @@ int configure_filtergraph(FilterGraph *fg)
|
||||
ofilter->height = av_buffersink_get_h(sink);
|
||||
|
||||
ofilter->sample_rate = av_buffersink_get_sample_rate(sink);
|
||||
ofilter->channel_layout = av_buffersink_get_channel_layout(sink);
|
||||
av_channel_layout_uninit(&ofilter->ch_layout);
|
||||
ret = av_buffersink_get_ch_layout(sink, &ofilter->ch_layout);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
fg->reconfiguration = 1;
|
||||
@ -1106,9 +1129,8 @@ int configure_filtergraph(FilterGraph *fg)
|
||||
}
|
||||
|
||||
for (i = 0; i < fg->nb_inputs; i++) {
|
||||
while (av_fifo_size(fg->inputs[i]->frame_queue)) {
|
||||
AVFrame *tmp;
|
||||
av_fifo_generic_read(fg->inputs[i]->frame_queue, &tmp, sizeof(tmp), NULL);
|
||||
AVFrame *tmp;
|
||||
while (av_fifo_read(fg->inputs[i]->frame_queue, &tmp, 1) >= 0) {
|
||||
ret = av_buffersrc_add_frame(fg->inputs[i]->filter, tmp);
|
||||
av_frame_free(&tmp);
|
||||
if (ret < 0)
|
||||
@ -1129,9 +1151,8 @@ int configure_filtergraph(FilterGraph *fg)
|
||||
for (i = 0; i < fg->nb_inputs; i++) {
|
||||
InputStream *ist = fg->inputs[i]->ist;
|
||||
if (ist->sub2video.sub_queue && ist->sub2video.frame) {
|
||||
while (av_fifo_size(ist->sub2video.sub_queue)) {
|
||||
AVSubtitle tmp;
|
||||
av_fifo_generic_read(ist->sub2video.sub_queue, &tmp, sizeof(tmp), NULL);
|
||||
AVSubtitle tmp;
|
||||
while (av_fifo_read(ist->sub2video.sub_queue, &tmp, 1) >= 0) {
|
||||
sub2video_update(ist, INT64_MIN, &tmp);
|
||||
avsubtitle_free(&tmp);
|
||||
}
|
||||
@ -1148,6 +1169,7 @@ fail:
|
||||
int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *frame)
|
||||
{
|
||||
AVFrameSideData *sd;
|
||||
int ret;
|
||||
|
||||
av_buffer_unref(&ifilter->hw_frames_ctx);
|
||||
|
||||
@ -1158,8 +1180,9 @@ int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *frame)
|
||||
ifilter->sample_aspect_ratio = frame->sample_aspect_ratio;
|
||||
|
||||
ifilter->sample_rate = frame->sample_rate;
|
||||
ifilter->channels = frame->channels;
|
||||
ifilter->channel_layout = frame->channel_layout;
|
||||
ret = av_channel_layout_copy(&ifilter->ch_layout, &frame->ch_layout);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
av_freep(&ifilter->displaymatrix);
|
||||
sd = av_frame_get_side_data(frame, AV_FRAME_DATA_DISPLAYMATRIX);
|
||||
|
317
fftools/ffmpeg_mux.c
Normal file
317
fftools/ffmpeg_mux.c
Normal file
@ -0,0 +1,317 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "ffmpeg.h"
|
||||
|
||||
#include "libavutil/fifo.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavutil/log.h"
|
||||
#include "libavutil/mem.h"
|
||||
#include "libavutil/timestamp.h"
|
||||
|
||||
#include "libavcodec/packet.h"
|
||||
|
||||
#include "libavformat/avformat.h"
|
||||
#include "libavformat/avio.h"
|
||||
|
||||
static void close_all_output_streams(OutputStream *ost, OSTFinished this_stream, OSTFinished others)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < nb_output_streams; i++) {
|
||||
OutputStream *ost2 = output_streams[i];
|
||||
ost2->finished |= ost == ost2 ? this_stream : others;
|
||||
}
|
||||
}
|
||||
|
||||
void of_write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost,
|
||||
int unqueue)
|
||||
{
|
||||
AVFormatContext *s = of->ctx;
|
||||
AVStream *st = ost->st;
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* Audio encoders may split the packets -- #frames in != #packets out.
|
||||
* But there is no reordering, so we can limit the number of output packets
|
||||
* by simply dropping them here.
|
||||
* Counting encoded video frames needs to be done separately because of
|
||||
* reordering, see do_video_out().
|
||||
* Do not count the packet when unqueued because it has been counted when queued.
|
||||
*/
|
||||
if (!(st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && ost->encoding_needed) && !unqueue) {
|
||||
if (ost->frame_number >= ost->max_frames) {
|
||||
av_packet_unref(pkt);
|
||||
return;
|
||||
}
|
||||
ost->frame_number++;
|
||||
}
|
||||
|
||||
if (!of->header_written) {
|
||||
AVPacket *tmp_pkt;
|
||||
/* the muxer is not initialized yet, buffer the packet */
|
||||
if (!av_fifo_can_write(ost->muxing_queue)) {
|
||||
size_t cur_size = av_fifo_can_read(ost->muxing_queue);
|
||||
unsigned int are_we_over_size =
|
||||
(ost->muxing_queue_data_size + pkt->size) > ost->muxing_queue_data_threshold;
|
||||
size_t limit = are_we_over_size ? ost->max_muxing_queue_size : SIZE_MAX;
|
||||
size_t new_size = FFMIN(2 * cur_size, limit);
|
||||
|
||||
if (new_size <= cur_size) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"Too many packets buffered for output stream %d:%d.\n",
|
||||
ost->file_index, ost->st->index);
|
||||
exit_program(1);
|
||||
}
|
||||
ret = av_fifo_grow2(ost->muxing_queue, new_size - cur_size);
|
||||
if (ret < 0)
|
||||
exit_program(1);
|
||||
}
|
||||
ret = av_packet_make_refcounted(pkt);
|
||||
if (ret < 0)
|
||||
exit_program(1);
|
||||
tmp_pkt = av_packet_alloc();
|
||||
if (!tmp_pkt)
|
||||
exit_program(1);
|
||||
av_packet_move_ref(tmp_pkt, pkt);
|
||||
ost->muxing_queue_data_size += tmp_pkt->size;
|
||||
av_fifo_write(ost->muxing_queue, &tmp_pkt, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && ost->vsync_method == VSYNC_DROP) ||
|
||||
(st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && audio_sync_method < 0))
|
||||
pkt->pts = pkt->dts = AV_NOPTS_VALUE;
|
||||
|
||||
if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||
if (ost->frame_rate.num && ost->is_cfr) {
|
||||
if (pkt->duration > 0)
|
||||
av_log(NULL, AV_LOG_WARNING, "Overriding packet duration by frame rate, this should not happen\n");
|
||||
pkt->duration = av_rescale_q(1, av_inv_q(ost->frame_rate),
|
||||
ost->mux_timebase);
|
||||
}
|
||||
}
|
||||
|
||||
av_packet_rescale_ts(pkt, ost->mux_timebase, ost->st->time_base);
|
||||
|
||||
if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) {
|
||||
if (pkt->dts != AV_NOPTS_VALUE &&
|
||||
pkt->pts != AV_NOPTS_VALUE &&
|
||||
pkt->dts > pkt->pts) {
|
||||
av_log(s, AV_LOG_WARNING, "Invalid DTS: %"PRId64" PTS: %"PRId64" in output stream %d:%d, replacing by guess\n",
|
||||
pkt->dts, pkt->pts,
|
||||
ost->file_index, ost->st->index);
|
||||
pkt->pts =
|
||||
pkt->dts = pkt->pts + pkt->dts + ost->last_mux_dts + 1
|
||||
- FFMIN3(pkt->pts, pkt->dts, ost->last_mux_dts + 1)
|
||||
- FFMAX3(pkt->pts, pkt->dts, ost->last_mux_dts + 1);
|
||||
}
|
||||
if ((st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO || st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) &&
|
||||
pkt->dts != AV_NOPTS_VALUE &&
|
||||
ost->last_mux_dts != AV_NOPTS_VALUE) {
|
||||
int64_t max = ost->last_mux_dts + !(s->oformat->flags & AVFMT_TS_NONSTRICT);
|
||||
if (pkt->dts < max) {
|
||||
int loglevel = max - pkt->dts > 2 || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO ? AV_LOG_WARNING : AV_LOG_DEBUG;
|
||||
if (exit_on_error)
|
||||
loglevel = AV_LOG_ERROR;
|
||||
av_log(s, loglevel, "Non-monotonous DTS in output stream "
|
||||
"%d:%d; previous: %"PRId64", current: %"PRId64"; ",
|
||||
ost->file_index, ost->st->index, ost->last_mux_dts, pkt->dts);
|
||||
if (exit_on_error) {
|
||||
av_log(NULL, AV_LOG_FATAL, "aborting.\n");
|
||||
exit_program(1);
|
||||
}
|
||||
av_log(s, loglevel, "changing to %"PRId64". This may result "
|
||||
"in incorrect timestamps in the output file.\n",
|
||||
max);
|
||||
if (pkt->pts >= pkt->dts)
|
||||
pkt->pts = FFMAX(pkt->pts, max);
|
||||
pkt->dts = max;
|
||||
}
|
||||
}
|
||||
}
|
||||
ost->last_mux_dts = pkt->dts;
|
||||
|
||||
ost->data_size += pkt->size;
|
||||
ost->packets_written++;
|
||||
|
||||
pkt->stream_index = ost->index;
|
||||
|
||||
if (debug_ts) {
|
||||
av_log(NULL, AV_LOG_INFO, "muxer <- type:%s "
|
||||
"pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s duration:%s duration_time:%s size:%d\n",
|
||||
av_get_media_type_string(ost->enc_ctx->codec_type),
|
||||
av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &ost->st->time_base),
|
||||
av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &ost->st->time_base),
|
||||
av_ts2str(pkt->duration), av_ts2timestr(pkt->duration, &ost->st->time_base),
|
||||
pkt->size
|
||||
);
|
||||
}
|
||||
|
||||
ret = av_interleaved_write_frame(s, pkt);
|
||||
if (ret < 0) {
|
||||
print_error("av_interleaved_write_frame()", ret);
|
||||
main_return_code = 1;
|
||||
close_all_output_streams(ost, MUXER_FINISHED | ENCODER_FINISHED, ENCODER_FINISHED);
|
||||
}
|
||||
}
|
||||
|
||||
static int print_sdp(void)
|
||||
{
|
||||
char sdp[16384];
|
||||
int i;
|
||||
int j, ret;
|
||||
AVIOContext *sdp_pb;
|
||||
AVFormatContext **avc;
|
||||
|
||||
for (i = 0; i < nb_output_files; i++) {
|
||||
if (!output_files[i]->header_written)
|
||||
return 0;
|
||||
}
|
||||
|
||||
avc = av_malloc_array(nb_output_files, sizeof(*avc));
|
||||
if (!avc)
|
||||
exit_program(1);
|
||||
for (i = 0, j = 0; i < nb_output_files; i++) {
|
||||
if (!strcmp(output_files[i]->ctx->oformat->name, "rtp")) {
|
||||
avc[j] = output_files[i]->ctx;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!j) {
|
||||
av_log(NULL, AV_LOG_ERROR, "No output streams in the SDP.\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ret = av_sdp_create(avc, j, sdp, sizeof(sdp));
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
if (!sdp_filename) {
|
||||
printf("SDP:\n%s\n", sdp);
|
||||
fflush(stdout);
|
||||
} else {
|
||||
ret = avio_open2(&sdp_pb, sdp_filename, AVIO_FLAG_WRITE, &int_cb, NULL);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Failed to open sdp file '%s'\n", sdp_filename);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
avio_print(sdp_pb, sdp);
|
||||
avio_closep(&sdp_pb);
|
||||
av_freep(&sdp_filename);
|
||||
}
|
||||
|
||||
fail:
|
||||
av_freep(&avc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* open the muxer when all the streams are initialized */
|
||||
int of_check_init(OutputFile *of)
|
||||
{
|
||||
int ret, i;
|
||||
|
||||
for (i = 0; i < of->ctx->nb_streams; i++) {
|
||||
OutputStream *ost = output_streams[of->ost_index + i];
|
||||
if (!ost->initialized)
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = avformat_write_header(of->ctx, &of->opts);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"Could not write header for output file #%d "
|
||||
"(incorrect codec parameters ?): %s\n",
|
||||
of->index, av_err2str(ret));
|
||||
return ret;
|
||||
}
|
||||
//assert_avoptions(of->opts);
|
||||
of->header_written = 1;
|
||||
|
||||
av_dump_format(of->ctx, of->index, of->ctx->url, 1);
|
||||
nb_output_dumped++;
|
||||
|
||||
if (sdp_filename || want_sdp) {
|
||||
ret = print_sdp();
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Error writing the SDP.\n");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/* flush the muxing queues */
|
||||
for (i = 0; i < of->ctx->nb_streams; i++) {
|
||||
OutputStream *ost = output_streams[of->ost_index + i];
|
||||
AVPacket *pkt;
|
||||
|
||||
/* try to improve muxing time_base (only possible if nothing has been written yet) */
|
||||
if (!av_fifo_can_read(ost->muxing_queue))
|
||||
ost->mux_timebase = ost->st->time_base;
|
||||
|
||||
while (av_fifo_read(ost->muxing_queue, &pkt, 1) >= 0) {
|
||||
ost->muxing_queue_data_size -= pkt->size;
|
||||
of_write_packet(of, pkt, ost, 1);
|
||||
av_packet_free(&pkt);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int of_write_trailer(OutputFile *of)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!of->header_written) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"Nothing was written into output file %d (%s), because "
|
||||
"at least one of its streams received no packets.\n",
|
||||
of->index, of->ctx->url);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
ret = av_write_trailer(of->ctx);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Error writing trailer of %s: %s\n", of->ctx->url, av_err2str(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void of_close(OutputFile **pof)
|
||||
{
|
||||
OutputFile *of = *pof;
|
||||
AVFormatContext *s;
|
||||
|
||||
if (!of)
|
||||
return;
|
||||
|
||||
s = of->ctx;
|
||||
if (s && s->oformat && !(s->oformat->flags & AVFMT_NOFILE))
|
||||
avio_closep(&s->pb);
|
||||
avformat_free_context(s);
|
||||
av_dict_free(&of->opts);
|
||||
|
||||
av_freep(pof);
|
||||
}
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* ffmpeg option parsing
|
||||
*
|
||||
@ -19,10 +18,19 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#if HAVE_SYS_RESOURCE_H
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#include "ffmpeg.h"
|
||||
#include "fopen_utf8.h"
|
||||
#include "cmdutils.h"
|
||||
#include "opt_common.h"
|
||||
|
||||
#include "libavformat/avformat.h"
|
||||
|
||||
@ -36,6 +44,7 @@
|
||||
#include "libavutil/avutil.h"
|
||||
#include "libavutil/bprint.h"
|
||||
#include "libavutil/channel_layout.h"
|
||||
#include "libavutil/getenv_utf8.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavutil/fifo.h"
|
||||
#include "libavutil/mathematics.h"
|
||||
@ -55,6 +64,7 @@
|
||||
|
||||
static const char *const opt_name_codec_names[] = {"c", "codec", "acodec", "vcodec", "scodec", "dcodec", NULL};
|
||||
static const char *const opt_name_audio_channels[] = {"ac", NULL};
|
||||
static const char *const opt_name_audio_ch_layouts[] = {"channel_layout", "ch_layout", NULL};
|
||||
static const char *const opt_name_audio_sample_rate[] = {"ar", NULL};
|
||||
static const char *const opt_name_frame_rates[] = {"r", NULL};
|
||||
static const char *const opt_name_max_frame_rates[] = {"fpsmax", NULL};
|
||||
@ -72,6 +82,7 @@ static const char *const opt_name_codec_tags[] = {"tag", "atag",
|
||||
static const char *const opt_name_sample_fmts[] = {"sample_fmt", NULL};
|
||||
static const char *const opt_name_qscale[] = {"q", "qscale", NULL};
|
||||
static const char *const opt_name_forced_key_frames[] = {"forced_key_frames", NULL};
|
||||
static const char *const opt_name_fps_mode[] = {"fps_mode", NULL};
|
||||
static const char *const opt_name_force_fps[] = {"force_fps", NULL};
|
||||
static const char *const opt_name_frame_aspect_ratios[] = {"aspect", NULL};
|
||||
static const char *const opt_name_rc_overrides[] = {"rc_override", NULL};
|
||||
@ -224,6 +235,7 @@ static void init_options(OptionsContext *o)
|
||||
o->chapters_input_file = INT_MAX;
|
||||
o->accurate_seek = 1;
|
||||
o->thread_queue_size = -1;
|
||||
o->input_sync_ref = -1;
|
||||
}
|
||||
|
||||
static int show_hwaccels(void *optctx, const char *opt, const char *arg)
|
||||
@ -256,6 +268,78 @@ static AVDictionary *strip_specifiers(AVDictionary *dict)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_idx, int is_global)
|
||||
{
|
||||
if (!av_strcasecmp(arg, "cfr")) *vsync_var = VSYNC_CFR;
|
||||
else if (!av_strcasecmp(arg, "vfr")) *vsync_var = VSYNC_VFR;
|
||||
else if (!av_strcasecmp(arg, "passthrough")) *vsync_var = VSYNC_PASSTHROUGH;
|
||||
else if (!av_strcasecmp(arg, "drop")) *vsync_var = VSYNC_DROP;
|
||||
else if (!is_global && !av_strcasecmp(arg, "auto")) *vsync_var = VSYNC_AUTO;
|
||||
else if (!is_global) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Invalid value %s specified for fps_mode of #%d:%d.\n", arg, file_idx, st_idx);
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
if (is_global && *vsync_var == VSYNC_AUTO) {
|
||||
video_sync_method = parse_number_or_die("vsync", arg, OPT_INT, VSYNC_AUTO, VSYNC_VFR);
|
||||
av_log(NULL, AV_LOG_WARNING, "Passing a number to -vsync is deprecated,"
|
||||
" use a string argument as described in the manual.\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int apply_sync_offsets(void)
|
||||
{
|
||||
for (int i = 0; i < nb_input_files; i++) {
|
||||
InputFile *ref, *self = input_files[i];
|
||||
int64_t adjustment;
|
||||
int64_t self_start_time, ref_start_time, self_seek_start, ref_seek_start;
|
||||
int start_times_set = 1;
|
||||
|
||||
if (self->input_sync_ref == -1 || self->input_sync_ref == i) continue;
|
||||
if (self->input_sync_ref >= nb_input_files || self->input_sync_ref < -1) {
|
||||
av_log(NULL, AV_LOG_FATAL, "-isync for input %d references non-existent input %d.\n", i, self->input_sync_ref);
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
if (copy_ts && !start_at_zero) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Use of -isync requires that start_at_zero be set if copyts is set.\n");
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
ref = input_files[self->input_sync_ref];
|
||||
if (ref->input_sync_ref != -1 && ref->input_sync_ref != self->input_sync_ref) {
|
||||
av_log(NULL, AV_LOG_ERROR, "-isync for input %d references a resynced input %d. Sync not set.\n", i, self->input_sync_ref);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (self->ctx->start_time_realtime != AV_NOPTS_VALUE && ref->ctx->start_time_realtime != AV_NOPTS_VALUE) {
|
||||
self_start_time = self->ctx->start_time_realtime;
|
||||
ref_start_time = ref->ctx->start_time_realtime;
|
||||
} else if (self->ctx->start_time != AV_NOPTS_VALUE && ref->ctx->start_time != AV_NOPTS_VALUE) {
|
||||
self_start_time = self->ctx->start_time;
|
||||
ref_start_time = ref->ctx->start_time;
|
||||
} else {
|
||||
start_times_set = 0;
|
||||
}
|
||||
|
||||
if (start_times_set) {
|
||||
self_seek_start = self->start_time == AV_NOPTS_VALUE ? 0 : self->start_time;
|
||||
ref_seek_start = ref->start_time == AV_NOPTS_VALUE ? 0 : ref->start_time;
|
||||
|
||||
adjustment = (self_start_time - ref_start_time) + !copy_ts*(self_seek_start - ref_seek_start) + ref->input_ts_offset;
|
||||
|
||||
self->ts_offset += adjustment;
|
||||
|
||||
av_log(NULL, AV_LOG_INFO, "Adjusted ts offset for Input #%d by %"PRId64" us to sync with Input #%d.\n", i, adjustment, self->input_sync_ref);
|
||||
} else {
|
||||
av_log(NULL, AV_LOG_INFO, "Unable to identify start times for Inputs #%d and %d both. No sync adjustment made.\n", i, self->input_sync_ref);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int opt_filter_threads(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
av_free(filter_nbthreads);
|
||||
@ -507,7 +591,7 @@ static int opt_map_channel(void *optctx, const char *opt, const char *arg)
|
||||
/* allow trailing ? to map_channel */
|
||||
if (allow_unused = strchr(mapchan, '?'))
|
||||
*allow_unused = 0;
|
||||
if (m->channel_idx < 0 || m->channel_idx >= st->codecpar->channels ||
|
||||
if (m->channel_idx < 0 || m->channel_idx >= st->codecpar->ch_layout.nb_channels ||
|
||||
input_streams[input_files[m->file_idx]->ist_index + m->stream_idx]->user_set_discard == AVDISCARD_ALL) {
|
||||
if (allow_unused) {
|
||||
av_log(NULL, AV_LOG_VERBOSE, "mapchan: invalid audio channel #%d.%d.%d\n",
|
||||
@ -784,7 +868,7 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
|
||||
for (i = 0; i < ic->nb_streams; i++) {
|
||||
AVStream *st = ic->streams[i];
|
||||
AVCodecParameters *par = st->codecpar;
|
||||
InputStream *ist = av_mallocz(sizeof(*ist));
|
||||
InputStream *ist;
|
||||
char *framerate = NULL, *hwaccel_device = NULL;
|
||||
const char *hwaccel = NULL;
|
||||
char *hwaccel_output_format = NULL;
|
||||
@ -795,12 +879,7 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
|
||||
const AVOption *discard_opt = av_opt_find(&cc, "skip_frame", NULL,
|
||||
0, AV_OPT_SEARCH_FAKE_OBJ);
|
||||
|
||||
if (!ist)
|
||||
exit_program(1);
|
||||
|
||||
GROW_ARRAY(input_streams, nb_input_streams);
|
||||
input_streams[nb_input_streams - 1] = ist;
|
||||
|
||||
ist = ALLOC_ARRAY_ELEM(input_streams, nb_input_streams);
|
||||
ist->st = st;
|
||||
ist->file_index = nb_input_files;
|
||||
ist->discard = 1;
|
||||
@ -1120,13 +1199,20 @@ static int open_input_file(OptionsContext *o, const char *filename)
|
||||
}
|
||||
if (o->nb_audio_channels) {
|
||||
const AVClass *priv_class;
|
||||
/* because we set audio_channels based on both the "ac" and
|
||||
* "channel_layout" options, we need to check that the specified
|
||||
* demuxer actually has the "channels" option before setting it */
|
||||
if (file_iformat && (priv_class = file_iformat->priv_class) &&
|
||||
av_opt_find(&priv_class, "channels", NULL, 0,
|
||||
av_opt_find(&priv_class, "ch_layout", NULL, 0,
|
||||
AV_OPT_SEARCH_FAKE_OBJ)) {
|
||||
av_dict_set_int(&o->g->format_opts, "channels", o->audio_channels[o->nb_audio_channels - 1].u.i, 0);
|
||||
char buf[32];
|
||||
snprintf(buf, sizeof(buf), "%dC", o->audio_channels[o->nb_audio_channels - 1].u.i);
|
||||
av_dict_set(&o->g->format_opts, "ch_layout", buf, 0);
|
||||
}
|
||||
}
|
||||
if (o->nb_audio_ch_layouts) {
|
||||
const AVClass *priv_class;
|
||||
if (file_iformat && (priv_class = file_iformat->priv_class) &&
|
||||
av_opt_find(&priv_class, "ch_layout", NULL, 0,
|
||||
AV_OPT_SEARCH_FAKE_OBJ)) {
|
||||
av_dict_set(&o->g->format_opts, "ch_layout", o->audio_ch_layouts[o->nb_audio_ch_layouts - 1].u.str, 0);
|
||||
}
|
||||
}
|
||||
if (o->nb_frame_rates) {
|
||||
@ -1272,6 +1358,7 @@ static int open_input_file(OptionsContext *o, const char *filename)
|
||||
f->ist_index = nb_input_streams - ic->nb_streams;
|
||||
f->start_time = o->start_time;
|
||||
f->recording_time = o->recording_time;
|
||||
f->input_sync_ref = o->input_sync_ref;
|
||||
f->input_ts_offset = o->input_ts_offset;
|
||||
f->ts_offset = o->input_ts_offset - (copy_ts ? (start_at_zero && ic->start_time != AV_NOPTS_VALUE ? ic->start_time : 0) : timestamp);
|
||||
f->nb_streams = ic->nb_streams;
|
||||
@ -1370,8 +1457,10 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV
|
||||
{
|
||||
int i, ret = -1;
|
||||
char filename[1000];
|
||||
const char *base[3] = { getenv("AVCONV_DATADIR"),
|
||||
getenv("HOME"),
|
||||
char *env_avconv_datadir = getenv_utf8("AVCONV_DATADIR");
|
||||
char *env_home = getenv_utf8("HOME");
|
||||
const char *base[3] = { env_avconv_datadir,
|
||||
env_home,
|
||||
AVCONV_DATADIR,
|
||||
};
|
||||
|
||||
@ -1389,6 +1478,8 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV
|
||||
ret = avio_open2(s, filename, AVIO_FLAG_READ, &int_cb, NULL);
|
||||
}
|
||||
}
|
||||
freeenv_utf8(env_home);
|
||||
freeenv_utf8(env_avconv_datadir);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1445,10 +1536,7 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
|
||||
if (oc->nb_streams - 1 < o->nb_streamid_map)
|
||||
st->id = o->streamid_map[oc->nb_streams - 1];
|
||||
|
||||
GROW_ARRAY(output_streams, nb_output_streams);
|
||||
if (!(ost = av_mallocz(sizeof(*ost))))
|
||||
exit_program(1);
|
||||
output_streams[nb_output_streams - 1] = ost;
|
||||
ost = ALLOC_ARRAY_ELEM(output_streams, nb_output_streams);
|
||||
|
||||
ost->file_index = nb_output_files - 1;
|
||||
ost->index = idx;
|
||||
@ -1589,8 +1677,6 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
|
||||
|
||||
ost->max_muxing_queue_size = 128;
|
||||
MATCH_PER_STREAM_OPT(max_muxing_queue_size, i, ost->max_muxing_queue_size, oc, st);
|
||||
ost->max_muxing_queue_size = FFMIN(ost->max_muxing_queue_size, INT_MAX / sizeof(ost->pkt));
|
||||
ost->max_muxing_queue_size *= sizeof(ost->pkt);
|
||||
|
||||
ost->muxing_queue_data_size = 0;
|
||||
|
||||
@ -1617,10 +1703,13 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
|
||||
}
|
||||
ost->last_mux_dts = AV_NOPTS_VALUE;
|
||||
|
||||
ost->muxing_queue = av_fifo_alloc(8 * sizeof(AVPacket));
|
||||
ost->muxing_queue = av_fifo_alloc2(8, sizeof(AVPacket*), 0);
|
||||
if (!ost->muxing_queue)
|
||||
exit_program(1);
|
||||
|
||||
MATCH_PER_STREAM_OPT(copy_initial_nonkeyframes, i,
|
||||
ost->copy_initial_nonkeyframes, oc, st);
|
||||
|
||||
return ost;
|
||||
}
|
||||
|
||||
@ -1859,7 +1948,7 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
|
||||
snprintf(logfilename, sizeof(logfilename), "%s-%d.log",
|
||||
ost->logfile_prefix ? ost->logfile_prefix :
|
||||
DEFAULT_PASS_LOGFILENAME_PREFIX,
|
||||
i);
|
||||
nb_output_streams - 1);
|
||||
if (!strcmp(ost->enc->name, "libx264")) {
|
||||
av_dict_set(&ost->encoder_opts, "stats", logfilename, AV_DICT_DONT_OVERWRITE);
|
||||
} else {
|
||||
@ -1874,7 +1963,7 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
|
||||
video_enc->stats_in = logbuffer;
|
||||
}
|
||||
if (video_enc->flags & AV_CODEC_FLAG_PASS1) {
|
||||
f = av_fopen_utf8(logfilename, "wb");
|
||||
f = fopen_utf8(logfilename, "wb");
|
||||
if (!f) {
|
||||
av_log(NULL, AV_LOG_FATAL,
|
||||
"Cannot write log file '%s' for pass-1 encoding: %s\n",
|
||||
@ -1896,6 +1985,10 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
|
||||
MATCH_PER_STREAM_OPT(top_field_first, i, ost->top_field_first, oc, st);
|
||||
|
||||
ost->vsync_method = video_sync_method;
|
||||
MATCH_PER_STREAM_OPT(fps_mode, str, ost->fps_mode, oc, st);
|
||||
if (ost->fps_mode)
|
||||
parse_and_set_vsync(ost->fps_mode, &ost->vsync_method, ost->file_index, ost->index, 0);
|
||||
|
||||
if (ost->vsync_method == VSYNC_AUTO) {
|
||||
if (!strcmp(oc->oformat->name, "avi")) {
|
||||
ost->vsync_method = VSYNC_VFR;
|
||||
@ -1927,8 +2020,6 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
|
||||
ost->last_frame = av_frame_alloc();
|
||||
if (!ost->last_frame)
|
||||
exit_program(1);
|
||||
} else {
|
||||
MATCH_PER_STREAM_OPT(copy_initial_nonkeyframes, i, ost->copy_initial_nonkeyframes, oc ,st);
|
||||
}
|
||||
|
||||
if (ost->stream_copy)
|
||||
@ -1954,9 +2045,36 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, in
|
||||
MATCH_PER_STREAM_OPT(filters, str, ost->filters, oc, st);
|
||||
|
||||
if (!ost->stream_copy) {
|
||||
int channels = 0;
|
||||
char *layout = NULL;
|
||||
char *sample_fmt = NULL;
|
||||
|
||||
MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, oc, st);
|
||||
MATCH_PER_STREAM_OPT(audio_channels, i, channels, oc, st);
|
||||
if (channels) {
|
||||
audio_enc->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
|
||||
audio_enc->ch_layout.nb_channels = channels;
|
||||
}
|
||||
|
||||
MATCH_PER_STREAM_OPT(audio_ch_layouts, str, layout, oc, st);
|
||||
if (layout) {
|
||||
if (av_channel_layout_from_string(&audio_enc->ch_layout, layout) < 0) {
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
uint64_t mask;
|
||||
AV_NOWARN_DEPRECATED({
|
||||
mask = av_get_channel_layout(layout);
|
||||
})
|
||||
if (!mask) {
|
||||
#endif
|
||||
av_log(NULL, AV_LOG_FATAL, "Unknown channel layout: %s\n", layout);
|
||||
exit_program(1);
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
}
|
||||
av_log(NULL, AV_LOG_WARNING, "Channel layout '%s' uses a deprecated syntax.\n",
|
||||
layout);
|
||||
av_channel_layout_from_mask(&audio_enc->ch_layout, mask);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
MATCH_PER_STREAM_OPT(sample_fmts, str, sample_fmt, oc, st);
|
||||
if (sample_fmt &&
|
||||
@ -2056,8 +2174,6 @@ static OutputStream *new_subtitle_stream(OptionsContext *o, AVFormatContext *oc,
|
||||
|
||||
subtitle_enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
|
||||
|
||||
MATCH_PER_STREAM_OPT(copy_initial_nonkeyframes, i, ost->copy_initial_nonkeyframes, oc, st);
|
||||
|
||||
if (!ost->stream_copy) {
|
||||
char *frame_size = NULL;
|
||||
|
||||
@ -2094,10 +2210,10 @@ static int opt_streamid(void *optctx, const char *opt, const char *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int copy_chapters(InputFile *ifile, OutputFile *ofile, int copy_metadata)
|
||||
static int copy_chapters(InputFile *ifile, OutputFile *ofile, AVFormatContext *os,
|
||||
int copy_metadata)
|
||||
{
|
||||
AVFormatContext *is = ifile->ctx;
|
||||
AVFormatContext *os = ofile->ctx;
|
||||
AVChapter **tmp;
|
||||
int i;
|
||||
|
||||
@ -2137,14 +2253,14 @@ static int copy_chapters(InputFile *ifile, OutputFile *ofile, int copy_metadata)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_dispositions(OutputFile *of)
|
||||
static int set_dispositions(OutputFile *of, AVFormatContext *ctx)
|
||||
{
|
||||
int nb_streams[AVMEDIA_TYPE_NB] = { 0 };
|
||||
int have_default[AVMEDIA_TYPE_NB] = { 0 };
|
||||
int have_manual = 0;
|
||||
|
||||
// first, copy the input dispositions
|
||||
for (int i = 0; i< of->ctx->nb_streams; i++) {
|
||||
for (int i = 0; i < ctx->nb_streams; i++) {
|
||||
OutputStream *ost = output_streams[of->ost_index + i];
|
||||
|
||||
nb_streams[ost->st->codecpar->codec_type]++;
|
||||
@ -2161,7 +2277,7 @@ static int set_dispositions(OutputFile *of)
|
||||
|
||||
if (have_manual) {
|
||||
// process manually set dispositions - they override the above copy
|
||||
for (int i = 0; i< of->ctx->nb_streams; i++) {
|
||||
for (int i = 0; i < ctx->nb_streams; i++) {
|
||||
OutputStream *ost = output_streams[of->ost_index + i];
|
||||
int ret;
|
||||
|
||||
@ -2187,7 +2303,7 @@ static int set_dispositions(OutputFile *of)
|
||||
// For each media type with more than one stream, find a suitable stream to
|
||||
// mark as default, unless one is already marked default.
|
||||
// "Suitable" means the first of that type, skipping attached pictures.
|
||||
for (int i = 0; i< of->ctx->nb_streams; i++) {
|
||||
for (int i = 0; i < ctx->nb_streams; i++) {
|
||||
OutputStream *ost = output_streams[of->ost_index + i];
|
||||
enum AVMediaType type = ost->st->codecpar->codec_type;
|
||||
|
||||
@ -2283,6 +2399,7 @@ static int open_output_file(OptionsContext *o, const char *filename)
|
||||
|
||||
of = ALLOC_ARRAY_ELEM(output_files, nb_output_files);
|
||||
|
||||
of->index = nb_output_files - 1;
|
||||
of->ost_index = nb_output_streams;
|
||||
of->recording_time = o->recording_time;
|
||||
of->start_time = o->start_time;
|
||||
@ -2300,6 +2417,7 @@ static int open_output_file(OptionsContext *o, const char *filename)
|
||||
}
|
||||
|
||||
of->ctx = oc;
|
||||
of->format = oc->oformat;
|
||||
if (o->recording_time != INT64_MAX)
|
||||
oc->duration = o->recording_time;
|
||||
|
||||
@ -2378,7 +2496,7 @@ static int open_output_file(OptionsContext *o, const char *filename)
|
||||
for (i = 0; i < ifile->nb_streams; i++) {
|
||||
int score;
|
||||
ist = input_streams[ifile->ist_index + i];
|
||||
score = ist->st->codecpar->channels
|
||||
score = ist->st->codecpar->ch_layout.nb_channels
|
||||
+ 100000000 * !!(ist->st->event_flags & AVSTREAM_EVENT_FLAG_NEW_PACKETS)
|
||||
+ 5000000*!!(ist->st->disposition & AV_DISPOSITION_DEFAULT);
|
||||
if (ist->user_set_discard == AVDISCARD_ALL)
|
||||
@ -2612,6 +2730,7 @@ loop_end:
|
||||
if (ost->encoding_needed && ost->source_index >= 0) {
|
||||
InputStream *ist = input_streams[ost->source_index];
|
||||
ist->decoding_needed |= DECODING_FOR_OST;
|
||||
ist->processing_needed = 1;
|
||||
|
||||
if (ost->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO ||
|
||||
ost->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
|
||||
@ -2624,6 +2743,9 @@ loop_end:
|
||||
exit_program(1);
|
||||
}
|
||||
}
|
||||
} else if (ost->stream_copy && ost->source_index >= 0) {
|
||||
InputStream *ist = input_streams[ost->source_index];
|
||||
ist->processing_needed = 1;
|
||||
}
|
||||
|
||||
/* set the filter output constraints */
|
||||
@ -2651,10 +2773,10 @@ loop_end:
|
||||
} else {
|
||||
f->sample_rates = ost->enc->supported_samplerates;
|
||||
}
|
||||
if (ost->enc_ctx->channels) {
|
||||
f->channel_layout = av_get_default_channel_layout(ost->enc_ctx->channels);
|
||||
} else {
|
||||
f->channel_layouts = ost->enc->channel_layouts;
|
||||
if (ost->enc_ctx->ch_layout.nb_channels) {
|
||||
av_channel_layout_default(&f->ch_layout, ost->enc_ctx->ch_layout.nb_channels);
|
||||
} else if (ost->enc->ch_layouts) {
|
||||
f->ch_layouts = ost->enc->ch_layouts;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -2725,7 +2847,7 @@ loop_end:
|
||||
}
|
||||
}
|
||||
if (o->chapters_input_file >= 0)
|
||||
copy_chapters(input_files[o->chapters_input_file], of,
|
||||
copy_chapters(input_files[o->chapters_input_file], of, oc,
|
||||
!o->metadata_chapters_manual);
|
||||
|
||||
/* copy global metadata by default */
|
||||
@ -2878,7 +3000,7 @@ loop_end:
|
||||
}
|
||||
}
|
||||
|
||||
err = set_dispositions(of);
|
||||
err = set_dispositions(of, oc);
|
||||
if (err < 0) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Error setting output stream dispositions\n");
|
||||
exit_program(1);
|
||||
@ -3210,16 +3332,8 @@ static int opt_audio_filters(void *optctx, const char *opt, const char *arg)
|
||||
|
||||
static int opt_vsync(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
if (!av_strcasecmp(arg, "cfr")) video_sync_method = VSYNC_CFR;
|
||||
else if (!av_strcasecmp(arg, "vfr")) video_sync_method = VSYNC_VFR;
|
||||
else if (!av_strcasecmp(arg, "passthrough")) video_sync_method = VSYNC_PASSTHROUGH;
|
||||
else if (!av_strcasecmp(arg, "drop")) video_sync_method = VSYNC_DROP;
|
||||
|
||||
if (video_sync_method == VSYNC_AUTO) {
|
||||
video_sync_method = parse_number_or_die("vsync", arg, OPT_INT, VSYNC_AUTO, VSYNC_VFR);
|
||||
av_log(NULL, AV_LOG_WARNING, "Passing a number to -vsync is deprecated,"
|
||||
" use a string argument as described in the manual.\n");
|
||||
}
|
||||
av_log(NULL, AV_LOG_WARNING, "-vsync is deprecated. Use -fps_mode\n");
|
||||
parse_and_set_vsync(arg, &video_sync_method, -1, -1, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3237,42 +3351,6 @@ static int opt_timecode(void *optctx, const char *opt, const char *arg)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int opt_channel_layout(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
OptionsContext *o = optctx;
|
||||
char layout_str[32];
|
||||
char *stream_str;
|
||||
char *ac_str;
|
||||
int ret, channels, ac_str_size;
|
||||
uint64_t layout;
|
||||
|
||||
layout = av_get_channel_layout(arg);
|
||||
if (!layout) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Unknown channel layout: %s\n", arg);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
snprintf(layout_str, sizeof(layout_str), "%"PRIu64, layout);
|
||||
ret = opt_default_new(o, opt, layout_str);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* set 'ac' option based on channel layout */
|
||||
channels = av_get_channel_layout_nb_channels(layout);
|
||||
snprintf(layout_str, sizeof(layout_str), "%d", channels);
|
||||
stream_str = strchr(opt, ':');
|
||||
ac_str_size = 3 + (stream_str ? strlen(stream_str) : 0);
|
||||
ac_str = av_mallocz(ac_str_size);
|
||||
if (!ac_str)
|
||||
return AVERROR(ENOMEM);
|
||||
av_strlcpy(ac_str, "ac", 3);
|
||||
if (stream_str)
|
||||
av_strlcat(ac_str, stream_str, ac_str_size);
|
||||
ret = parse_option(o, ac_str, layout_str, options);
|
||||
av_free(ac_str);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int opt_audio_qscale(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
OptionsContext *o = optctx;
|
||||
@ -3281,9 +3359,8 @@ static int opt_audio_qscale(void *optctx, const char *opt, const char *arg)
|
||||
|
||||
static int opt_filter_complex(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
FilterGraph *fg;
|
||||
ALLOC_ARRAY_ELEM(filtergraphs, nb_filtergraphs);
|
||||
fg = filtergraphs[nb_filtergraphs - 1];
|
||||
FilterGraph *fg = ALLOC_ARRAY_ELEM(filtergraphs, nb_filtergraphs);
|
||||
|
||||
fg->index = nb_filtergraphs - 1;
|
||||
fg->graph_desc = av_strdup(arg);
|
||||
if (!fg->graph_desc)
|
||||
@ -3466,6 +3543,8 @@ int ffmpeg_parse_options(int argc, char **argv)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
apply_sync_offsets();
|
||||
|
||||
/* create the complex filtergraphs */
|
||||
ret = init_complex_filters();
|
||||
if (ret < 0) {
|
||||
@ -3508,6 +3587,19 @@ static int opt_progress(void *optctx, const char *opt, const char *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int opt_timelimit(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
#if HAVE_SETRLIMIT
|
||||
int lim = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);
|
||||
struct rlimit rl = { lim, lim + 1 };
|
||||
if (setrlimit(RLIMIT_CPU, &rl))
|
||||
perror("setrlimit");
|
||||
#else
|
||||
av_log(NULL, AV_LOG_WARNING, "-%s not implemented on this OS\n", opt);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define OFFSET(x) offsetof(OptionsContext, x)
|
||||
const OptionDef options[] = {
|
||||
/* main options */
|
||||
@ -3567,6 +3659,9 @@ const OptionDef options[] = {
|
||||
{ "accurate_seek", OPT_BOOL | OPT_OFFSET | OPT_EXPERT |
|
||||
OPT_INPUT, { .off = OFFSET(accurate_seek) },
|
||||
"enable/disable accurate seeking with -ss" },
|
||||
{ "isync", HAS_ARG | OPT_INT | OPT_OFFSET |
|
||||
OPT_EXPERT | OPT_INPUT, { .off = OFFSET(input_sync_ref) },
|
||||
"Indicate the input index for sync reference", "sync ref" },
|
||||
{ "itsoffset", HAS_ARG | OPT_TIME | OPT_OFFSET |
|
||||
OPT_EXPERT | OPT_INPUT, { .off = OFFSET(input_ts_offset) },
|
||||
"set the input ts offset", "time_off" },
|
||||
@ -3606,7 +3701,7 @@ const OptionDef options[] = {
|
||||
"specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\" or \"dv50\" "
|
||||
"with optional prefixes \"pal-\", \"ntsc-\" or \"film-\")", "type" },
|
||||
{ "vsync", HAS_ARG | OPT_EXPERT, { .func_arg = opt_vsync },
|
||||
"video sync method", "" },
|
||||
"set video sync method globally; deprecated, use -fps_mode", "" },
|
||||
{ "frame_drop_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, { &frame_drop_threshold },
|
||||
"frame drop threshold", "" },
|
||||
{ "async", HAS_ARG | OPT_INT | OPT_EXPERT, { &audio_sync_method },
|
||||
@ -3763,6 +3858,9 @@ const OptionDef options[] = {
|
||||
"force video tag/fourcc", "fourcc/tag" },
|
||||
{ "qphist", OPT_VIDEO | OPT_BOOL | OPT_EXPERT , { &qp_hist },
|
||||
"show QP histogram" },
|
||||
{ "fps_mode", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_EXPERT |
|
||||
OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(fps_mode) },
|
||||
"set framerate mode for matching video streams; overrides vsync" },
|
||||
{ "force_fps", OPT_VIDEO | OPT_BOOL | OPT_EXPERT | OPT_SPEC |
|
||||
OPT_OUTPUT, { .off = OFFSET(force_fps) },
|
||||
"force the selected framerate, disable the best supported framerate selection" },
|
||||
@ -3818,8 +3916,11 @@ const OptionDef options[] = {
|
||||
{ "sample_fmt", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_SPEC |
|
||||
OPT_STRING | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(sample_fmts) },
|
||||
"set sample format", "format" },
|
||||
{ "channel_layout", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_PERFILE |
|
||||
OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_channel_layout },
|
||||
{ "channel_layout", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_SPEC |
|
||||
OPT_STRING | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(audio_ch_layouts) },
|
||||
"set channel layout", "layout" },
|
||||
{ "ch_layout", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_SPEC |
|
||||
OPT_STRING | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(audio_ch_layouts) },
|
||||
"set channel layout", "layout" },
|
||||
{ "af", OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_audio_filters },
|
||||
"set audio filters", "filter_graph" },
|
||||
|
193
fftools/ffplay.c
193
fftools/ffplay.c
@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "config_components.h"
|
||||
#include <inttypes.h>
|
||||
#include <math.h>
|
||||
#include <limits.h>
|
||||
@ -59,6 +60,7 @@
|
||||
#include <SDL_thread.h>
|
||||
|
||||
#include "cmdutils.h"
|
||||
#include "opt_common.h"
|
||||
|
||||
const char program_name[] = "ffplay";
|
||||
const int program_birth_year = 2003;
|
||||
@ -115,7 +117,7 @@ typedef struct MyAVPacketList {
|
||||
} MyAVPacketList;
|
||||
|
||||
typedef struct PacketQueue {
|
||||
AVFifoBuffer *pkt_list;
|
||||
AVFifo *pkt_list;
|
||||
int nb_packets;
|
||||
int size;
|
||||
int64_t duration;
|
||||
@ -132,8 +134,7 @@ typedef struct PacketQueue {
|
||||
|
||||
typedef struct AudioParams {
|
||||
int freq;
|
||||
int channels;
|
||||
int64_t channel_layout;
|
||||
AVChannelLayout ch_layout;
|
||||
enum AVSampleFormat fmt;
|
||||
int frame_size;
|
||||
int bytes_per_sec;
|
||||
@ -412,31 +413,21 @@ int cmp_audio_fmts(enum AVSampleFormat fmt1, int64_t channel_count1,
|
||||
return channel_count1 != channel_count2 || fmt1 != fmt2;
|
||||
}
|
||||
|
||||
static inline
|
||||
int64_t get_valid_channel_layout(int64_t channel_layout, int channels)
|
||||
{
|
||||
if (channel_layout && av_get_channel_layout_nb_channels(channel_layout) == channels)
|
||||
return channel_layout;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int packet_queue_put_private(PacketQueue *q, AVPacket *pkt)
|
||||
{
|
||||
MyAVPacketList pkt1;
|
||||
int ret;
|
||||
|
||||
if (q->abort_request)
|
||||
return -1;
|
||||
|
||||
if (av_fifo_space(q->pkt_list) < sizeof(pkt1)) {
|
||||
if (av_fifo_grow(q->pkt_list, sizeof(pkt1)) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
pkt1.pkt = pkt;
|
||||
pkt1.serial = q->serial;
|
||||
|
||||
av_fifo_generic_write(q->pkt_list, &pkt1, sizeof(pkt1), NULL);
|
||||
ret = av_fifo_write(q->pkt_list, &pkt1, 1);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
q->nb_packets++;
|
||||
q->size += pkt1.pkt->size + sizeof(pkt1);
|
||||
q->duration += pkt1.pkt->duration;
|
||||
@ -477,7 +468,7 @@ static int packet_queue_put_nullpacket(PacketQueue *q, AVPacket *pkt, int stream
|
||||
static int packet_queue_init(PacketQueue *q)
|
||||
{
|
||||
memset(q, 0, sizeof(PacketQueue));
|
||||
q->pkt_list = av_fifo_alloc(sizeof(MyAVPacketList));
|
||||
q->pkt_list = av_fifo_alloc2(1, sizeof(MyAVPacketList), AV_FIFO_FLAG_AUTO_GROW);
|
||||
if (!q->pkt_list)
|
||||
return AVERROR(ENOMEM);
|
||||
q->mutex = SDL_CreateMutex();
|
||||
@ -499,10 +490,8 @@ static void packet_queue_flush(PacketQueue *q)
|
||||
MyAVPacketList pkt1;
|
||||
|
||||
SDL_LockMutex(q->mutex);
|
||||
while (av_fifo_size(q->pkt_list) >= sizeof(pkt1)) {
|
||||
av_fifo_generic_read(q->pkt_list, &pkt1, sizeof(pkt1), NULL);
|
||||
while (av_fifo_read(q->pkt_list, &pkt1, 1) >= 0)
|
||||
av_packet_free(&pkt1.pkt);
|
||||
}
|
||||
q->nb_packets = 0;
|
||||
q->size = 0;
|
||||
q->duration = 0;
|
||||
@ -513,7 +502,7 @@ static void packet_queue_flush(PacketQueue *q)
|
||||
static void packet_queue_destroy(PacketQueue *q)
|
||||
{
|
||||
packet_queue_flush(q);
|
||||
av_fifo_freep(&q->pkt_list);
|
||||
av_fifo_freep2(&q->pkt_list);
|
||||
SDL_DestroyMutex(q->mutex);
|
||||
SDL_DestroyCond(q->cond);
|
||||
}
|
||||
@ -551,8 +540,7 @@ static int packet_queue_get(PacketQueue *q, AVPacket *pkt, int block, int *seria
|
||||
break;
|
||||
}
|
||||
|
||||
if (av_fifo_size(q->pkt_list) >= sizeof(pkt1)) {
|
||||
av_fifo_generic_read(q->pkt_list, &pkt1, sizeof(pkt1), NULL);
|
||||
if (av_fifo_read(q->pkt_list, &pkt1, 1) >= 0) {
|
||||
q->nb_packets--;
|
||||
q->size -= pkt1.pkt->size + sizeof(pkt1);
|
||||
q->duration -= pkt1.pkt->duration;
|
||||
@ -1023,15 +1011,17 @@ static void video_image_display(VideoState *is)
|
||||
}
|
||||
|
||||
calculate_display_rect(&rect, is->xleft, is->ytop, is->width, is->height, vp->width, vp->height, vp->sar);
|
||||
set_sdl_yuv_conversion_mode(vp->frame);
|
||||
|
||||
if (!vp->uploaded) {
|
||||
if (upload_texture(&is->vid_texture, vp->frame, &is->img_convert_ctx) < 0)
|
||||
if (upload_texture(&is->vid_texture, vp->frame, &is->img_convert_ctx) < 0) {
|
||||
set_sdl_yuv_conversion_mode(NULL);
|
||||
return;
|
||||
}
|
||||
vp->uploaded = 1;
|
||||
vp->flip_v = vp->frame->linesize[0] < 0;
|
||||
}
|
||||
|
||||
set_sdl_yuv_conversion_mode(vp->frame);
|
||||
SDL_RenderCopyEx(renderer, is->vid_texture, NULL, &rect, 0, NULL, vp->flip_v ? SDL_FLIP_VERTICAL : 0);
|
||||
set_sdl_yuv_conversion_mode(NULL);
|
||||
if (sp) {
|
||||
@ -1070,7 +1060,7 @@ static void video_audio_display(VideoState *s)
|
||||
nb_freq = 1 << (rdft_bits - 1);
|
||||
|
||||
/* compute display index : center on currently output samples */
|
||||
channels = s->audio_tgt.channels;
|
||||
channels = s->audio_tgt.ch_layout.nb_channels;
|
||||
nb_display_channels = channels;
|
||||
if (!s->paused) {
|
||||
int data_used= s->show_mode == SHOW_MODE_WAVES ? s->width : (2*nb_freq);
|
||||
@ -1468,13 +1458,13 @@ static void check_external_clock_speed(VideoState *is) {
|
||||
}
|
||||
|
||||
/* seek in the stream */
|
||||
static void stream_seek(VideoState *is, int64_t pos, int64_t rel, int seek_by_bytes)
|
||||
static void stream_seek(VideoState *is, int64_t pos, int64_t rel, int by_bytes)
|
||||
{
|
||||
if (!is->seek_req) {
|
||||
is->seek_pos = pos;
|
||||
is->seek_rel = rel;
|
||||
is->seek_flags &= ~AVSEEK_FLAG_BYTE;
|
||||
if (seek_by_bytes)
|
||||
if (by_bytes)
|
||||
is->seek_flags |= AVSEEK_FLAG_BYTE;
|
||||
is->seek_req = 1;
|
||||
SDL_CondSignal(is->continue_read_thread);
|
||||
@ -1956,11 +1946,10 @@ static int configure_audio_filters(VideoState *is, const char *afilters, int for
|
||||
{
|
||||
static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE };
|
||||
int sample_rates[2] = { 0, -1 };
|
||||
int64_t channel_layouts[2] = { 0, -1 };
|
||||
int channels[2] = { 0, -1 };
|
||||
AVFilterContext *filt_asrc = NULL, *filt_asink = NULL;
|
||||
char aresample_swr_opts[512] = "";
|
||||
const AVDictionaryEntry *e = NULL;
|
||||
AVBPrint bp;
|
||||
char asrc_args[256];
|
||||
int ret;
|
||||
|
||||
@ -1969,20 +1958,20 @@ static int configure_audio_filters(VideoState *is, const char *afilters, int for
|
||||
return AVERROR(ENOMEM);
|
||||
is->agraph->nb_threads = filter_nbthreads;
|
||||
|
||||
av_bprint_init(&bp, 0, AV_BPRINT_SIZE_AUTOMATIC);
|
||||
|
||||
while ((e = av_dict_get(swr_opts, "", e, AV_DICT_IGNORE_SUFFIX)))
|
||||
av_strlcatf(aresample_swr_opts, sizeof(aresample_swr_opts), "%s=%s:", e->key, e->value);
|
||||
if (strlen(aresample_swr_opts))
|
||||
aresample_swr_opts[strlen(aresample_swr_opts)-1] = '\0';
|
||||
av_opt_set(is->agraph, "aresample_swr_opts", aresample_swr_opts, 0);
|
||||
|
||||
av_channel_layout_describe_bprint(&is->audio_filter_src.ch_layout, &bp);
|
||||
|
||||
ret = snprintf(asrc_args, sizeof(asrc_args),
|
||||
"sample_rate=%d:sample_fmt=%s:channels=%d:time_base=%d/%d",
|
||||
"sample_rate=%d:sample_fmt=%s:time_base=%d/%d:channel_layout=%s",
|
||||
is->audio_filter_src.freq, av_get_sample_fmt_name(is->audio_filter_src.fmt),
|
||||
is->audio_filter_src.channels,
|
||||
1, is->audio_filter_src.freq);
|
||||
if (is->audio_filter_src.channel_layout)
|
||||
snprintf(asrc_args + ret, sizeof(asrc_args) - ret,
|
||||
":channel_layout=0x%"PRIx64, is->audio_filter_src.channel_layout);
|
||||
1, is->audio_filter_src.freq, bp.str);
|
||||
|
||||
ret = avfilter_graph_create_filter(&filt_asrc,
|
||||
avfilter_get_by_name("abuffer"), "ffplay_abuffer",
|
||||
@ -2003,14 +1992,10 @@ static int configure_audio_filters(VideoState *is, const char *afilters, int for
|
||||
goto end;
|
||||
|
||||
if (force_output_format) {
|
||||
channel_layouts[0] = is->audio_tgt.channel_layout;
|
||||
channels [0] = is->audio_tgt.channel_layout ? -1 : is->audio_tgt.channels;
|
||||
sample_rates [0] = is->audio_tgt.freq;
|
||||
if ((ret = av_opt_set_int(filt_asink, "all_channel_counts", 0, AV_OPT_SEARCH_CHILDREN)) < 0)
|
||||
goto end;
|
||||
if ((ret = av_opt_set_int_list(filt_asink, "channel_layouts", channel_layouts, -1, AV_OPT_SEARCH_CHILDREN)) < 0)
|
||||
goto end;
|
||||
if ((ret = av_opt_set_int_list(filt_asink, "channel_counts" , channels , -1, AV_OPT_SEARCH_CHILDREN)) < 0)
|
||||
if ((ret = av_opt_set(filt_asink, "ch_layouts", bp.str, AV_OPT_SEARCH_CHILDREN)) < 0)
|
||||
goto end;
|
||||
if ((ret = av_opt_set_int_list(filt_asink, "sample_rates" , sample_rates , -1, AV_OPT_SEARCH_CHILDREN)) < 0)
|
||||
goto end;
|
||||
@ -2026,6 +2011,8 @@ static int configure_audio_filters(VideoState *is, const char *afilters, int for
|
||||
end:
|
||||
if (ret < 0)
|
||||
avfilter_graph_free(&is->agraph);
|
||||
av_bprint_finalize(&bp, NULL);
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif /* CONFIG_AVFILTER */
|
||||
@ -2037,7 +2024,6 @@ static int audio_thread(void *arg)
|
||||
Frame *af;
|
||||
#if CONFIG_AVFILTER
|
||||
int last_serial = -1;
|
||||
int64_t dec_channel_layout;
|
||||
int reconfigure;
|
||||
#endif
|
||||
int got_frame = 0;
|
||||
@ -2055,27 +2041,26 @@ static int audio_thread(void *arg)
|
||||
tb = (AVRational){1, frame->sample_rate};
|
||||
|
||||
#if CONFIG_AVFILTER
|
||||
dec_channel_layout = get_valid_channel_layout(frame->channel_layout, frame->channels);
|
||||
|
||||
reconfigure =
|
||||
cmp_audio_fmts(is->audio_filter_src.fmt, is->audio_filter_src.channels,
|
||||
frame->format, frame->channels) ||
|
||||
is->audio_filter_src.channel_layout != dec_channel_layout ||
|
||||
cmp_audio_fmts(is->audio_filter_src.fmt, is->audio_filter_src.ch_layout.nb_channels,
|
||||
frame->format, frame->ch_layout.nb_channels) ||
|
||||
av_channel_layout_compare(&is->audio_filter_src.ch_layout, &frame->ch_layout) ||
|
||||
is->audio_filter_src.freq != frame->sample_rate ||
|
||||
is->auddec.pkt_serial != last_serial;
|
||||
|
||||
if (reconfigure) {
|
||||
char buf1[1024], buf2[1024];
|
||||
av_get_channel_layout_string(buf1, sizeof(buf1), -1, is->audio_filter_src.channel_layout);
|
||||
av_get_channel_layout_string(buf2, sizeof(buf2), -1, dec_channel_layout);
|
||||
av_channel_layout_describe(&is->audio_filter_src.ch_layout, buf1, sizeof(buf1));
|
||||
av_channel_layout_describe(&frame->ch_layout, buf2, sizeof(buf2));
|
||||
av_log(NULL, AV_LOG_DEBUG,
|
||||
"Audio frame changed from rate:%d ch:%d fmt:%s layout:%s serial:%d to rate:%d ch:%d fmt:%s layout:%s serial:%d\n",
|
||||
is->audio_filter_src.freq, is->audio_filter_src.channels, av_get_sample_fmt_name(is->audio_filter_src.fmt), buf1, last_serial,
|
||||
frame->sample_rate, frame->channels, av_get_sample_fmt_name(frame->format), buf2, is->auddec.pkt_serial);
|
||||
is->audio_filter_src.freq, is->audio_filter_src.ch_layout.nb_channels, av_get_sample_fmt_name(is->audio_filter_src.fmt), buf1, last_serial,
|
||||
frame->sample_rate, frame->ch_layout.nb_channels, av_get_sample_fmt_name(frame->format), buf2, is->auddec.pkt_serial);
|
||||
|
||||
is->audio_filter_src.fmt = frame->format;
|
||||
is->audio_filter_src.channels = frame->channels;
|
||||
is->audio_filter_src.channel_layout = dec_channel_layout;
|
||||
ret = av_channel_layout_copy(&is->audio_filter_src.ch_layout, &frame->ch_layout);
|
||||
if (ret < 0)
|
||||
goto the_end;
|
||||
is->audio_filter_src.freq = frame->sample_rate;
|
||||
last_serial = is->auddec.pkt_serial;
|
||||
|
||||
@ -2341,7 +2326,6 @@ static int synchronize_audio(VideoState *is, int nb_samples)
|
||||
static int audio_decode_frame(VideoState *is)
|
||||
{
|
||||
int data_size, resampled_data_size;
|
||||
int64_t dec_channel_layout;
|
||||
av_unused double audio_clock0;
|
||||
int wanted_nb_samples;
|
||||
Frame *af;
|
||||
@ -2362,34 +2346,31 @@ static int audio_decode_frame(VideoState *is)
|
||||
frame_queue_next(&is->sampq);
|
||||
} while (af->serial != is->audioq.serial);
|
||||
|
||||
data_size = av_samples_get_buffer_size(NULL, af->frame->channels,
|
||||
data_size = av_samples_get_buffer_size(NULL, af->frame->ch_layout.nb_channels,
|
||||
af->frame->nb_samples,
|
||||
af->frame->format, 1);
|
||||
|
||||
dec_channel_layout =
|
||||
(af->frame->channel_layout && af->frame->channels == av_get_channel_layout_nb_channels(af->frame->channel_layout)) ?
|
||||
af->frame->channel_layout : av_get_default_channel_layout(af->frame->channels);
|
||||
wanted_nb_samples = synchronize_audio(is, af->frame->nb_samples);
|
||||
|
||||
if (af->frame->format != is->audio_src.fmt ||
|
||||
dec_channel_layout != is->audio_src.channel_layout ||
|
||||
av_channel_layout_compare(&af->frame->ch_layout, &is->audio_src.ch_layout) ||
|
||||
af->frame->sample_rate != is->audio_src.freq ||
|
||||
(wanted_nb_samples != af->frame->nb_samples && !is->swr_ctx)) {
|
||||
swr_free(&is->swr_ctx);
|
||||
is->swr_ctx = swr_alloc_set_opts(NULL,
|
||||
is->audio_tgt.channel_layout, is->audio_tgt.fmt, is->audio_tgt.freq,
|
||||
dec_channel_layout, af->frame->format, af->frame->sample_rate,
|
||||
0, NULL);
|
||||
swr_alloc_set_opts2(&is->swr_ctx,
|
||||
&is->audio_tgt.ch_layout, is->audio_tgt.fmt, is->audio_tgt.freq,
|
||||
&af->frame->ch_layout, af->frame->format, af->frame->sample_rate,
|
||||
0, NULL);
|
||||
if (!is->swr_ctx || swr_init(is->swr_ctx) < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"Cannot create sample rate converter for conversion of %d Hz %s %d channels to %d Hz %s %d channels!\n",
|
||||
af->frame->sample_rate, av_get_sample_fmt_name(af->frame->format), af->frame->channels,
|
||||
is->audio_tgt.freq, av_get_sample_fmt_name(is->audio_tgt.fmt), is->audio_tgt.channels);
|
||||
af->frame->sample_rate, av_get_sample_fmt_name(af->frame->format), af->frame->ch_layout.nb_channels,
|
||||
is->audio_tgt.freq, av_get_sample_fmt_name(is->audio_tgt.fmt), is->audio_tgt.ch_layout.nb_channels);
|
||||
swr_free(&is->swr_ctx);
|
||||
return -1;
|
||||
}
|
||||
is->audio_src.channel_layout = dec_channel_layout;
|
||||
is->audio_src.channels = af->frame->channels;
|
||||
if (av_channel_layout_copy(&is->audio_src.ch_layout, &af->frame->ch_layout) < 0)
|
||||
return -1;
|
||||
is->audio_src.freq = af->frame->sample_rate;
|
||||
is->audio_src.fmt = af->frame->format;
|
||||
}
|
||||
@ -2398,7 +2379,7 @@ static int audio_decode_frame(VideoState *is)
|
||||
const uint8_t **in = (const uint8_t **)af->frame->extended_data;
|
||||
uint8_t **out = &is->audio_buf1;
|
||||
int out_count = (int64_t)wanted_nb_samples * is->audio_tgt.freq / af->frame->sample_rate + 256;
|
||||
int out_size = av_samples_get_buffer_size(NULL, is->audio_tgt.channels, out_count, is->audio_tgt.fmt, 0);
|
||||
int out_size = av_samples_get_buffer_size(NULL, is->audio_tgt.ch_layout.nb_channels, out_count, is->audio_tgt.fmt, 0);
|
||||
int len2;
|
||||
if (out_size < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "av_samples_get_buffer_size() failed\n");
|
||||
@ -2425,7 +2406,7 @@ static int audio_decode_frame(VideoState *is)
|
||||
swr_free(&is->swr_ctx);
|
||||
}
|
||||
is->audio_buf = is->audio_buf1;
|
||||
resampled_data_size = len2 * is->audio_tgt.channels * av_get_bytes_per_sample(is->audio_tgt.fmt);
|
||||
resampled_data_size = len2 * is->audio_tgt.ch_layout.nb_channels * av_get_bytes_per_sample(is->audio_tgt.fmt);
|
||||
} else {
|
||||
is->audio_buf = af->frame->data[0];
|
||||
resampled_data_size = data_size;
|
||||
@ -2494,24 +2475,26 @@ static void sdl_audio_callback(void *opaque, Uint8 *stream, int len)
|
||||
}
|
||||
}
|
||||
|
||||
static int audio_open(void *opaque, int64_t wanted_channel_layout, int wanted_nb_channels, int wanted_sample_rate, struct AudioParams *audio_hw_params)
|
||||
static int audio_open(void *opaque, AVChannelLayout *wanted_channel_layout, int wanted_sample_rate, struct AudioParams *audio_hw_params)
|
||||
{
|
||||
SDL_AudioSpec wanted_spec, spec;
|
||||
const char *env;
|
||||
static const int next_nb_channels[] = {0, 0, 1, 6, 2, 6, 4, 6};
|
||||
static const int next_sample_rates[] = {0, 44100, 48000, 96000, 192000};
|
||||
int next_sample_rate_idx = FF_ARRAY_ELEMS(next_sample_rates) - 1;
|
||||
int wanted_nb_channels = wanted_channel_layout->nb_channels;
|
||||
|
||||
env = SDL_getenv("SDL_AUDIO_CHANNELS");
|
||||
if (env) {
|
||||
wanted_nb_channels = atoi(env);
|
||||
wanted_channel_layout = av_get_default_channel_layout(wanted_nb_channels);
|
||||
av_channel_layout_uninit(wanted_channel_layout);
|
||||
av_channel_layout_default(wanted_channel_layout, wanted_nb_channels);
|
||||
}
|
||||
if (!wanted_channel_layout || wanted_nb_channels != av_get_channel_layout_nb_channels(wanted_channel_layout)) {
|
||||
wanted_channel_layout = av_get_default_channel_layout(wanted_nb_channels);
|
||||
wanted_channel_layout &= ~AV_CH_LAYOUT_STEREO_DOWNMIX;
|
||||
if (wanted_channel_layout->order != AV_CHANNEL_ORDER_NATIVE) {
|
||||
av_channel_layout_uninit(wanted_channel_layout);
|
||||
av_channel_layout_default(wanted_channel_layout, wanted_nb_channels);
|
||||
}
|
||||
wanted_nb_channels = av_get_channel_layout_nb_channels(wanted_channel_layout);
|
||||
wanted_nb_channels = wanted_channel_layout->nb_channels;
|
||||
wanted_spec.channels = wanted_nb_channels;
|
||||
wanted_spec.freq = wanted_sample_rate;
|
||||
if (wanted_spec.freq <= 0 || wanted_spec.channels <= 0) {
|
||||
@ -2538,7 +2521,7 @@ static int audio_open(void *opaque, int64_t wanted_channel_layout, int wanted_nb
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
wanted_channel_layout = av_get_default_channel_layout(wanted_spec.channels);
|
||||
av_channel_layout_default(wanted_channel_layout, wanted_spec.channels);
|
||||
}
|
||||
if (spec.format != AUDIO_S16SYS) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
@ -2546,8 +2529,9 @@ static int audio_open(void *opaque, int64_t wanted_channel_layout, int wanted_nb
|
||||
return -1;
|
||||
}
|
||||
if (spec.channels != wanted_spec.channels) {
|
||||
wanted_channel_layout = av_get_default_channel_layout(spec.channels);
|
||||
if (!wanted_channel_layout) {
|
||||
av_channel_layout_uninit(wanted_channel_layout);
|
||||
av_channel_layout_default(wanted_channel_layout, spec.channels);
|
||||
if (wanted_channel_layout->order != AV_CHANNEL_ORDER_NATIVE) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"SDL advised channel count %d is not supported!\n", spec.channels);
|
||||
return -1;
|
||||
@ -2556,10 +2540,10 @@ static int audio_open(void *opaque, int64_t wanted_channel_layout, int wanted_nb
|
||||
|
||||
audio_hw_params->fmt = AV_SAMPLE_FMT_S16;
|
||||
audio_hw_params->freq = spec.freq;
|
||||
audio_hw_params->channel_layout = wanted_channel_layout;
|
||||
audio_hw_params->channels = spec.channels;
|
||||
audio_hw_params->frame_size = av_samples_get_buffer_size(NULL, audio_hw_params->channels, 1, audio_hw_params->fmt, 1);
|
||||
audio_hw_params->bytes_per_sec = av_samples_get_buffer_size(NULL, audio_hw_params->channels, audio_hw_params->freq, audio_hw_params->fmt, 1);
|
||||
if (av_channel_layout_copy(&audio_hw_params->ch_layout, wanted_channel_layout) < 0)
|
||||
return -1;
|
||||
audio_hw_params->frame_size = av_samples_get_buffer_size(NULL, audio_hw_params->ch_layout.nb_channels, 1, audio_hw_params->fmt, 1);
|
||||
audio_hw_params->bytes_per_sec = av_samples_get_buffer_size(NULL, audio_hw_params->ch_layout.nb_channels, audio_hw_params->freq, audio_hw_params->fmt, 1);
|
||||
if (audio_hw_params->bytes_per_sec <= 0 || audio_hw_params->frame_size <= 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "av_samples_get_buffer_size failed\n");
|
||||
return -1;
|
||||
@ -2576,8 +2560,8 @@ static int stream_component_open(VideoState *is, int stream_index)
|
||||
const char *forced_codec_name = NULL;
|
||||
AVDictionary *opts = NULL;
|
||||
const AVDictionaryEntry *t = NULL;
|
||||
int sample_rate, nb_channels;
|
||||
int64_t channel_layout;
|
||||
int sample_rate;
|
||||
AVChannelLayout ch_layout = { 0 };
|
||||
int ret = 0;
|
||||
int stream_lowres = lowres;
|
||||
|
||||
@ -2645,24 +2629,27 @@ static int stream_component_open(VideoState *is, int stream_index)
|
||||
AVFilterContext *sink;
|
||||
|
||||
is->audio_filter_src.freq = avctx->sample_rate;
|
||||
is->audio_filter_src.channels = avctx->channels;
|
||||
is->audio_filter_src.channel_layout = get_valid_channel_layout(avctx->channel_layout, avctx->channels);
|
||||
ret = av_channel_layout_copy(&is->audio_filter_src.ch_layout, &avctx->ch_layout);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
is->audio_filter_src.fmt = avctx->sample_fmt;
|
||||
if ((ret = configure_audio_filters(is, afilters, 0)) < 0)
|
||||
goto fail;
|
||||
sink = is->out_audio_filter;
|
||||
sample_rate = av_buffersink_get_sample_rate(sink);
|
||||
nb_channels = av_buffersink_get_channels(sink);
|
||||
channel_layout = av_buffersink_get_channel_layout(sink);
|
||||
ret = av_buffersink_get_ch_layout(sink, &ch_layout);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
}
|
||||
#else
|
||||
sample_rate = avctx->sample_rate;
|
||||
nb_channels = avctx->channels;
|
||||
channel_layout = avctx->channel_layout;
|
||||
ret = av_channel_layout_copy(&ch_layout, &avctx->ch_layout);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
#endif
|
||||
|
||||
/* prepare audio output */
|
||||
if ((ret = audio_open(is, channel_layout, nb_channels, sample_rate, &is->audio_tgt)) < 0)
|
||||
if ((ret = audio_open(is, &ch_layout, sample_rate, &is->audio_tgt)) < 0)
|
||||
goto fail;
|
||||
is->audio_hw_buf_size = ret;
|
||||
is->audio_src = is->audio_tgt;
|
||||
@ -2716,6 +2703,7 @@ static int stream_component_open(VideoState *is, int stream_index)
|
||||
fail:
|
||||
avcodec_free_context(&avctx);
|
||||
out:
|
||||
av_channel_layout_uninit(&ch_layout);
|
||||
av_dict_free(&opts);
|
||||
|
||||
return ret;
|
||||
@ -2835,7 +2823,9 @@ static int read_thread(void *arg)
|
||||
ic->pb->eof_reached = 0; // FIXME hack, ffplay maybe should not use avio_feof() to test for the end
|
||||
|
||||
if (seek_by_bytes < 0)
|
||||
seek_by_bytes = !!(ic->iformat->flags & AVFMT_TS_DISCONT) && strcmp("ogg", ic->iformat->name);
|
||||
seek_by_bytes = !(ic->iformat->flags & AVFMT_NO_BYTE_SEEK) &&
|
||||
!!(ic->iformat->flags & AVFMT_TS_DISCONT) &&
|
||||
strcmp("ogg", ic->iformat->name);
|
||||
|
||||
is->max_frame_duration = (ic->iformat->flags & AVFMT_TS_DISCONT) ? 10.0 : 3600.0;
|
||||
|
||||
@ -3188,7 +3178,7 @@ static void stream_cycle_channel(VideoState *is, int codec_type)
|
||||
switch (codec_type) {
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
if (st->codecpar->sample_rate != 0 &&
|
||||
st->codecpar->channels != 0)
|
||||
st->codecpar->ch_layout.nb_channels != 0)
|
||||
goto the_end;
|
||||
break;
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
@ -3474,12 +3464,6 @@ static void event_loop(VideoState *cur_stream)
|
||||
}
|
||||
}
|
||||
|
||||
static int opt_frame_size(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
av_log(NULL, AV_LOG_WARNING, "Option -s is deprecated, use -video_size.\n");
|
||||
return opt_default(NULL, "video_size", arg);
|
||||
}
|
||||
|
||||
static int opt_width(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
screen_width = parse_number_or_die(opt, arg, OPT_INT64, 1, INT_MAX);
|
||||
@ -3502,12 +3486,6 @@ static int opt_format(void *optctx, const char *opt, const char *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int opt_frame_pix_fmt(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
av_log(NULL, AV_LOG_WARNING, "Option -pix_fmt is deprecated, use -pixel_format.\n");
|
||||
return opt_default(NULL, "pixel_format", arg);
|
||||
}
|
||||
|
||||
static int opt_sync(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
if (!strcmp(arg, "audio"))
|
||||
@ -3585,7 +3563,6 @@ static const OptionDef options[] = {
|
||||
CMDUTILS_COMMON_OPTIONS
|
||||
{ "x", HAS_ARG, { .func_arg = opt_width }, "force displayed width", "width" },
|
||||
{ "y", HAS_ARG, { .func_arg = opt_height }, "force displayed height", "height" },
|
||||
{ "s", HAS_ARG | OPT_VIDEO, { .func_arg = opt_frame_size }, "set frame size (WxH or abbreviation)", "size" },
|
||||
{ "fs", OPT_BOOL, { &is_full_screen }, "force full screen" },
|
||||
{ "an", OPT_BOOL, { &audio_disable }, "disable audio" },
|
||||
{ "vn", OPT_BOOL, { &video_disable }, "disable video" },
|
||||
@ -3602,7 +3579,6 @@ static const OptionDef options[] = {
|
||||
{ "alwaysontop", OPT_BOOL, { &alwaysontop }, "window always on top" },
|
||||
{ "volume", OPT_INT | HAS_ARG, { &startup_volume}, "set startup volume 0=min 100=max", "volume" },
|
||||
{ "f", HAS_ARG, { .func_arg = opt_format }, "force format", "fmt" },
|
||||
{ "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO, { .func_arg = opt_frame_pix_fmt }, "set pixel format", "format" },
|
||||
{ "stats", OPT_BOOL | OPT_EXPERT, { &show_status }, "show status", "" },
|
||||
{ "fast", OPT_BOOL | OPT_EXPERT, { &fast }, "non spec compliant optimizations", "" },
|
||||
{ "genpts", OPT_BOOL | OPT_EXPERT, { &genpts }, "generate pts", "" },
|
||||
@ -3624,7 +3600,6 @@ static const OptionDef options[] = {
|
||||
#endif
|
||||
{ "rdftspeed", OPT_INT | HAS_ARG| OPT_AUDIO | OPT_EXPERT, { &rdftspeed }, "rdft speed", "msecs" },
|
||||
{ "showmode", HAS_ARG, { .func_arg = opt_show_mode}, "select show mode (0 = video, 1 = waves, 2 = RDFT)", "mode" },
|
||||
{ "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, { .func_arg = opt_default }, "generic catch all option", "" },
|
||||
{ "i", OPT_BOOL, { &dummy}, "read specified file", "input_file"},
|
||||
{ "codec", HAS_ARG, { .func_arg = opt_codec}, "force decoder", "decoder_name" },
|
||||
{ "acodec", HAS_ARG | OPT_STRING | OPT_EXPERT, { &audio_codec_name }, "force audio decoder", "decoder_name" },
|
||||
|
@ -29,7 +29,9 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "libavformat/avformat.h"
|
||||
#include "libavformat/version.h"
|
||||
#include "libavcodec/avcodec.h"
|
||||
#include "libavcodec/version.h"
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/avstring.h"
|
||||
#include "libavutil/bprint.h"
|
||||
@ -38,6 +40,7 @@
|
||||
#include "libavutil/hash.h"
|
||||
#include "libavutil/hdr_dynamic_metadata.h"
|
||||
#include "libavutil/mastering_display_metadata.h"
|
||||
#include "libavutil/hdr_dynamic_vivid_metadata.h"
|
||||
#include "libavutil/dovi_meta.h"
|
||||
#include "libavutil/opt.h"
|
||||
#include "libavutil/pixdesc.h"
|
||||
@ -50,10 +53,16 @@
|
||||
#include "libavutil/timecode.h"
|
||||
#include "libavutil/timestamp.h"
|
||||
#include "libavdevice/avdevice.h"
|
||||
#include "libavdevice/version.h"
|
||||
#include "libswscale/swscale.h"
|
||||
#include "libswscale/version.h"
|
||||
#include "libswresample/swresample.h"
|
||||
#include "libswresample/version.h"
|
||||
#include "libpostproc/postprocess.h"
|
||||
#include "libpostproc/version.h"
|
||||
#include "libavfilter/version.h"
|
||||
#include "cmdutils.h"
|
||||
#include "opt_common.h"
|
||||
|
||||
#include "libavutil/thread.h"
|
||||
|
||||
@ -223,7 +232,7 @@ static struct section sections[] = {
|
||||
[SECTION_ID_FRAME] = { SECTION_ID_FRAME, "frame", 0, { SECTION_ID_FRAME_TAGS, SECTION_ID_FRAME_SIDE_DATA_LIST, SECTION_ID_FRAME_LOGS, -1 } },
|
||||
[SECTION_ID_FRAME_TAGS] = { SECTION_ID_FRAME_TAGS, "tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "frame_tags" },
|
||||
[SECTION_ID_FRAME_SIDE_DATA_LIST] ={ SECTION_ID_FRAME_SIDE_DATA_LIST, "side_data_list", SECTION_FLAG_IS_ARRAY, { SECTION_ID_FRAME_SIDE_DATA, -1 }, .element_name = "side_data", .unique_name = "frame_side_data_list" },
|
||||
[SECTION_ID_FRAME_SIDE_DATA] = { SECTION_ID_FRAME_SIDE_DATA, "side_data", 0, { SECTION_ID_FRAME_SIDE_DATA_TIMECODE_LIST, SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST, -1 } },
|
||||
[SECTION_ID_FRAME_SIDE_DATA] = { SECTION_ID_FRAME_SIDE_DATA, "side_data", 0, { SECTION_ID_FRAME_SIDE_DATA_TIMECODE_LIST, SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST, -1 }, .unique_name = "frame_side_data" },
|
||||
[SECTION_ID_FRAME_SIDE_DATA_TIMECODE_LIST] = { SECTION_ID_FRAME_SIDE_DATA_TIMECODE_LIST, "timecodes", SECTION_FLAG_IS_ARRAY, { SECTION_ID_FRAME_SIDE_DATA_TIMECODE, -1 } },
|
||||
[SECTION_ID_FRAME_SIDE_DATA_TIMECODE] = { SECTION_ID_FRAME_SIDE_DATA_TIMECODE, "timecode", 0, { -1 } },
|
||||
[SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST] = { SECTION_ID_FRAME_SIDE_DATA_COMPONENT_LIST, "components", SECTION_FLAG_IS_ARRAY, { SECTION_ID_FRAME_SIDE_DATA_COMPONENT, -1 } },
|
||||
@ -239,7 +248,7 @@ static struct section sections[] = {
|
||||
[SECTION_ID_PACKET] = { SECTION_ID_PACKET, "packet", 0, { SECTION_ID_PACKET_TAGS, SECTION_ID_PACKET_SIDE_DATA_LIST, -1 } },
|
||||
[SECTION_ID_PACKET_TAGS] = { SECTION_ID_PACKET_TAGS, "tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "packet_tags" },
|
||||
[SECTION_ID_PACKET_SIDE_DATA_LIST] ={ SECTION_ID_PACKET_SIDE_DATA_LIST, "side_data_list", SECTION_FLAG_IS_ARRAY, { SECTION_ID_PACKET_SIDE_DATA, -1 }, .element_name = "side_data", .unique_name = "packet_side_data_list" },
|
||||
[SECTION_ID_PACKET_SIDE_DATA] = { SECTION_ID_PACKET_SIDE_DATA, "side_data", 0, { -1 } },
|
||||
[SECTION_ID_PACKET_SIDE_DATA] = { SECTION_ID_PACKET_SIDE_DATA, "side_data", 0, { -1 }, .unique_name = "packet_side_data" },
|
||||
[SECTION_ID_PIXEL_FORMATS] = { SECTION_ID_PIXEL_FORMATS, "pixel_formats", SECTION_FLAG_IS_ARRAY, { SECTION_ID_PIXEL_FORMAT, -1 } },
|
||||
[SECTION_ID_PIXEL_FORMAT] = { SECTION_ID_PIXEL_FORMAT, "pixel_format", 0, { SECTION_ID_PIXEL_FORMAT_FLAGS, SECTION_ID_PIXEL_FORMAT_COMPONENTS, -1 } },
|
||||
[SECTION_ID_PIXEL_FORMAT_FLAGS] = { SECTION_ID_PIXEL_FORMAT_FLAGS, "flags", 0, { -1 }, .unique_name = "pixel_format_flags" },
|
||||
@ -262,7 +271,7 @@ static struct section sections[] = {
|
||||
[SECTION_ID_STREAM_DISPOSITION] = { SECTION_ID_STREAM_DISPOSITION, "disposition", 0, { -1 }, .unique_name = "stream_disposition" },
|
||||
[SECTION_ID_STREAM_TAGS] = { SECTION_ID_STREAM_TAGS, "tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "stream_tags" },
|
||||
[SECTION_ID_STREAM_SIDE_DATA_LIST] ={ SECTION_ID_STREAM_SIDE_DATA_LIST, "side_data_list", SECTION_FLAG_IS_ARRAY, { SECTION_ID_STREAM_SIDE_DATA, -1 }, .element_name = "side_data", .unique_name = "stream_side_data_list" },
|
||||
[SECTION_ID_STREAM_SIDE_DATA] = { SECTION_ID_STREAM_SIDE_DATA, "side_data", 0, { -1 } },
|
||||
[SECTION_ID_STREAM_SIDE_DATA] = { SECTION_ID_STREAM_SIDE_DATA, "side_data", 0, { -1 }, .unique_name = "stream_side_data" },
|
||||
[SECTION_ID_SUBTITLE] = { SECTION_ID_SUBTITLE, "subtitle", 0, { -1 } },
|
||||
};
|
||||
|
||||
@ -272,6 +281,7 @@ static const OptionDef *options;
|
||||
static const char *input_filename;
|
||||
static const char *print_input_filename;
|
||||
static const AVInputFormat *iformat = NULL;
|
||||
static const char *output_filename = NULL;
|
||||
|
||||
static struct AVHashContext *hash;
|
||||
|
||||
@ -467,6 +477,12 @@ typedef struct Writer {
|
||||
struct WriterContext {
|
||||
const AVClass *class; ///< class of the writer
|
||||
const Writer *writer; ///< the Writer of which this is an instance
|
||||
AVIOContext *avio; ///< the I/O context used to write
|
||||
|
||||
void (* writer_w8)(WriterContext *wctx, int b);
|
||||
void (* writer_put_str)(WriterContext *wctx, const char *str);
|
||||
void (* writer_printf)(WriterContext *wctx, const char *fmt, ...);
|
||||
|
||||
char *name; ///< name of this writer instance
|
||||
void *priv; ///< private data for use by the filter
|
||||
|
||||
@ -529,12 +545,13 @@ static const AVClass writer_class = {
|
||||
.child_next = writer_child_next,
|
||||
};
|
||||
|
||||
static void writer_close(WriterContext **wctx)
|
||||
static int writer_close(WriterContext **wctx)
|
||||
{
|
||||
int i;
|
||||
int ret = 0;
|
||||
|
||||
if (!*wctx)
|
||||
return;
|
||||
return -1;
|
||||
|
||||
if ((*wctx)->writer->uninit)
|
||||
(*wctx)->writer->uninit(*wctx);
|
||||
@ -544,7 +561,12 @@ static void writer_close(WriterContext **wctx)
|
||||
av_opt_free((*wctx)->priv);
|
||||
av_freep(&((*wctx)->priv));
|
||||
av_opt_free(*wctx);
|
||||
if ((*wctx)->avio) {
|
||||
avio_flush((*wctx)->avio);
|
||||
ret = avio_close((*wctx)->avio);
|
||||
}
|
||||
av_freep(wctx);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void bprint_bytes(AVBPrint *bp, const uint8_t *ubuf, size_t ubuf_size)
|
||||
@ -555,9 +577,46 @@ static void bprint_bytes(AVBPrint *bp, const uint8_t *ubuf, size_t ubuf_size)
|
||||
av_bprintf(bp, "%02X", ubuf[i]);
|
||||
}
|
||||
|
||||
static inline void writer_w8_avio(WriterContext *wctx, int b)
|
||||
{
|
||||
avio_w8(wctx->avio, b);
|
||||
}
|
||||
|
||||
static inline void writer_put_str_avio(WriterContext *wctx, const char *str)
|
||||
{
|
||||
avio_write(wctx->avio, str, strlen(str));
|
||||
}
|
||||
|
||||
static inline void writer_printf_avio(WriterContext *wctx, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
avio_vprintf(wctx->avio, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
static inline void writer_w8_printf(WriterContext *wctx, int b)
|
||||
{
|
||||
printf("%c", b);
|
||||
}
|
||||
|
||||
static inline void writer_put_str_printf(WriterContext *wctx, const char *str)
|
||||
{
|
||||
printf("%s", str);
|
||||
}
|
||||
|
||||
static inline void writer_printf_printf(WriterContext *wctx, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
static int writer_open(WriterContext **wctx, const Writer *writer, const char *args,
|
||||
const struct section *sections, int nb_sections)
|
||||
const struct section *sections, int nb_sections, const char *output)
|
||||
{
|
||||
int i, ret = 0;
|
||||
|
||||
@ -628,6 +687,21 @@ static int writer_open(WriterContext **wctx, const Writer *writer, const char *a
|
||||
}
|
||||
}
|
||||
|
||||
if (!output_filename) {
|
||||
(*wctx)->writer_w8 = writer_w8_printf;
|
||||
(*wctx)->writer_put_str = writer_put_str_printf;
|
||||
(*wctx)->writer_printf = writer_printf_printf;
|
||||
} else {
|
||||
if ((ret = avio_open(&(*wctx)->avio, output, AVIO_FLAG_WRITE)) < 0) {
|
||||
av_log(*wctx, AV_LOG_ERROR,
|
||||
"Failed to open output '%s' with error: %s\n", output, av_err2str(ret));
|
||||
goto fail;
|
||||
}
|
||||
(*wctx)->writer_w8 = writer_w8_avio;
|
||||
(*wctx)->writer_put_str = writer_put_str_avio;
|
||||
(*wctx)->writer_printf = writer_printf_avio;
|
||||
}
|
||||
|
||||
for (i = 0; i < SECTION_MAX_NB_LEVELS; i++)
|
||||
av_bprint_init(&(*wctx)->section_pbuf[i], 1, AV_BPRINT_SIZE_UNLIMITED);
|
||||
|
||||
@ -827,7 +901,7 @@ static void writer_print_ts(WriterContext *wctx, const char *key, int64_t ts, in
|
||||
}
|
||||
|
||||
static void writer_print_data(WriterContext *wctx, const char *name,
|
||||
uint8_t *data, int size)
|
||||
const uint8_t *data, int size)
|
||||
{
|
||||
AVBPrint bp;
|
||||
int offset = 0, l, i;
|
||||
@ -855,7 +929,7 @@ static void writer_print_data(WriterContext *wctx, const char *name,
|
||||
}
|
||||
|
||||
static void writer_print_data_hash(WriterContext *wctx, const char *name,
|
||||
uint8_t *data, int size)
|
||||
const uint8_t *data, int size)
|
||||
{
|
||||
char *p, buf[AV_HASH_MAX_SIZE * 2 + 64] = { 0 };
|
||||
|
||||
@ -895,6 +969,10 @@ static void writer_print_integers(WriterContext *wctx, const char *name,
|
||||
av_bprint_finalize(&bp, NULL);
|
||||
}
|
||||
|
||||
#define writer_w8(wctx_, b_) (wctx_)->writer_w8(wctx_, b_)
|
||||
#define writer_put_str(wctx_, str_) (wctx_)->writer_put_str(wctx_, str_)
|
||||
#define writer_printf(wctx_, fmt_, ...) (wctx_)->writer_printf(wctx_, fmt_, __VA_ARGS__)
|
||||
|
||||
#define MAX_REGISTERED_WRITERS_NB 64
|
||||
|
||||
static const Writer *registered_writers[MAX_REGISTERED_WRITERS_NB + 1];
|
||||
@ -989,7 +1067,7 @@ static void default_print_section_header(WriterContext *wctx)
|
||||
return;
|
||||
|
||||
if (!(section->flags & (SECTION_FLAG_IS_WRAPPER|SECTION_FLAG_IS_ARRAY)))
|
||||
printf("[%s]\n", upcase_string(buf, sizeof(buf), section->name));
|
||||
writer_printf(wctx, "[%s]\n", upcase_string(buf, sizeof(buf), section->name));
|
||||
}
|
||||
|
||||
static void default_print_section_footer(WriterContext *wctx)
|
||||
@ -1002,7 +1080,7 @@ static void default_print_section_footer(WriterContext *wctx)
|
||||
return;
|
||||
|
||||
if (!(section->flags & (SECTION_FLAG_IS_WRAPPER|SECTION_FLAG_IS_ARRAY)))
|
||||
printf("[/%s]\n", upcase_string(buf, sizeof(buf), section->name));
|
||||
writer_printf(wctx, "[/%s]\n", upcase_string(buf, sizeof(buf), section->name));
|
||||
}
|
||||
|
||||
static void default_print_str(WriterContext *wctx, const char *key, const char *value)
|
||||
@ -1010,8 +1088,8 @@ static void default_print_str(WriterContext *wctx, const char *key, const char *
|
||||
DefaultContext *def = wctx->priv;
|
||||
|
||||
if (!def->nokey)
|
||||
printf("%s%s=", wctx->section_pbuf[wctx->level].str, key);
|
||||
printf("%s\n", value);
|
||||
writer_printf(wctx, "%s%s=", wctx->section_pbuf[wctx->level].str, key);
|
||||
writer_printf(wctx, "%s\n", value);
|
||||
}
|
||||
|
||||
static void default_print_int(WriterContext *wctx, const char *key, long long int value)
|
||||
@ -1019,8 +1097,8 @@ static void default_print_int(WriterContext *wctx, const char *key, long long in
|
||||
DefaultContext *def = wctx->priv;
|
||||
|
||||
if (!def->nokey)
|
||||
printf("%s%s=", wctx->section_pbuf[wctx->level].str, key);
|
||||
printf("%lld\n", value);
|
||||
writer_printf(wctx, "%s%s=", wctx->section_pbuf[wctx->level].str, key);
|
||||
writer_printf(wctx, "%lld\n", value);
|
||||
}
|
||||
|
||||
static const Writer default_writer = {
|
||||
@ -1162,10 +1240,10 @@ static void compact_print_section_header(WriterContext *wctx)
|
||||
}
|
||||
if (parent_section && !(parent_section->flags & (SECTION_FLAG_IS_WRAPPER|SECTION_FLAG_IS_ARRAY)) &&
|
||||
wctx->level && wctx->nb_item[wctx->level-1])
|
||||
printf("%c", compact->item_sep);
|
||||
writer_w8(wctx, compact->item_sep);
|
||||
if (compact->print_section &&
|
||||
!(section->flags & (SECTION_FLAG_IS_WRAPPER|SECTION_FLAG_IS_ARRAY)))
|
||||
printf("%s%c", section->name, compact->item_sep);
|
||||
writer_printf(wctx, "%s%c", section->name, compact->item_sep);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1176,7 +1254,7 @@ static void compact_print_section_footer(WriterContext *wctx)
|
||||
if (!compact->nested_section[wctx->level] &&
|
||||
compact->terminate_line[wctx->level] &&
|
||||
!(wctx->section[wctx->level]->flags & (SECTION_FLAG_IS_WRAPPER|SECTION_FLAG_IS_ARRAY)))
|
||||
printf("\n");
|
||||
writer_w8(wctx, '\n');
|
||||
}
|
||||
|
||||
static void compact_print_str(WriterContext *wctx, const char *key, const char *value)
|
||||
@ -1184,11 +1262,11 @@ static void compact_print_str(WriterContext *wctx, const char *key, const char *
|
||||
CompactContext *compact = wctx->priv;
|
||||
AVBPrint buf;
|
||||
|
||||
if (wctx->nb_item[wctx->level]) printf("%c", compact->item_sep);
|
||||
if (wctx->nb_item[wctx->level]) writer_w8(wctx, compact->item_sep);
|
||||
if (!compact->nokey)
|
||||
printf("%s%s=", wctx->section_pbuf[wctx->level].str, key);
|
||||
writer_printf(wctx, "%s%s=", wctx->section_pbuf[wctx->level].str, key);
|
||||
av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED);
|
||||
printf("%s", compact->escape_str(&buf, value, compact->item_sep, wctx));
|
||||
writer_put_str(wctx, compact->escape_str(&buf, value, compact->item_sep, wctx));
|
||||
av_bprint_finalize(&buf, NULL);
|
||||
}
|
||||
|
||||
@ -1196,10 +1274,10 @@ static void compact_print_int(WriterContext *wctx, const char *key, long long in
|
||||
{
|
||||
CompactContext *compact = wctx->priv;
|
||||
|
||||
if (wctx->nb_item[wctx->level]) printf("%c", compact->item_sep);
|
||||
if (wctx->nb_item[wctx->level]) writer_w8(wctx, compact->item_sep);
|
||||
if (!compact->nokey)
|
||||
printf("%s%s=", wctx->section_pbuf[wctx->level].str, key);
|
||||
printf("%lld", value);
|
||||
writer_printf(wctx, "%s%s=", wctx->section_pbuf[wctx->level].str, key);
|
||||
writer_printf(wctx, "%lld", value);
|
||||
}
|
||||
|
||||
static const Writer compact_writer = {
|
||||
@ -1342,7 +1420,7 @@ static void flat_print_section_header(WriterContext *wctx)
|
||||
|
||||
static void flat_print_int(WriterContext *wctx, const char *key, long long int value)
|
||||
{
|
||||
printf("%s%s=%lld\n", wctx->section_pbuf[wctx->level].str, key, value);
|
||||
writer_printf(wctx, "%s%s=%lld\n", wctx->section_pbuf[wctx->level].str, key, value);
|
||||
}
|
||||
|
||||
static void flat_print_str(WriterContext *wctx, const char *key, const char *value)
|
||||
@ -1350,11 +1428,11 @@ static void flat_print_str(WriterContext *wctx, const char *key, const char *val
|
||||
FlatContext *flat = wctx->priv;
|
||||
AVBPrint buf;
|
||||
|
||||
printf("%s", wctx->section_pbuf[wctx->level].str);
|
||||
writer_put_str(wctx, wctx->section_pbuf[wctx->level].str);
|
||||
av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED);
|
||||
printf("%s=", flat_escape_key_str(&buf, key, flat->sep));
|
||||
writer_printf(wctx, "%s=", flat_escape_key_str(&buf, key, flat->sep));
|
||||
av_bprint_clear(&buf);
|
||||
printf("\"%s\"\n", flat_escape_value_str(&buf, value));
|
||||
writer_printf(wctx, "\"%s\"\n", flat_escape_value_str(&buf, value));
|
||||
av_bprint_finalize(&buf, NULL);
|
||||
}
|
||||
|
||||
@ -1424,12 +1502,12 @@ static void ini_print_section_header(WriterContext *wctx)
|
||||
|
||||
av_bprint_clear(buf);
|
||||
if (!parent_section) {
|
||||
printf("# ffprobe output\n\n");
|
||||
writer_put_str(wctx, "# ffprobe output\n\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (wctx->nb_item[wctx->level-1])
|
||||
printf("\n");
|
||||
writer_w8(wctx, '\n');
|
||||
|
||||
av_bprintf(buf, "%s", wctx->section_pbuf[wctx->level-1].str);
|
||||
if (ini->hierarchical ||
|
||||
@ -1444,7 +1522,7 @@ static void ini_print_section_header(WriterContext *wctx)
|
||||
}
|
||||
|
||||
if (!(section->flags & (SECTION_FLAG_IS_ARRAY|SECTION_FLAG_IS_WRAPPER)))
|
||||
printf("[%s]\n", buf->str);
|
||||
writer_printf(wctx, "[%s]\n", buf->str);
|
||||
}
|
||||
|
||||
static void ini_print_str(WriterContext *wctx, const char *key, const char *value)
|
||||
@ -1452,15 +1530,15 @@ static void ini_print_str(WriterContext *wctx, const char *key, const char *valu
|
||||
AVBPrint buf;
|
||||
|
||||
av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED);
|
||||
printf("%s=", ini_escape_str(&buf, key));
|
||||
writer_printf(wctx, "%s=", ini_escape_str(&buf, key));
|
||||
av_bprint_clear(&buf);
|
||||
printf("%s\n", ini_escape_str(&buf, value));
|
||||
writer_printf(wctx, "%s\n", ini_escape_str(&buf, value));
|
||||
av_bprint_finalize(&buf, NULL);
|
||||
}
|
||||
|
||||
static void ini_print_int(WriterContext *wctx, const char *key, long long int value)
|
||||
{
|
||||
printf("%s=%lld\n", key, value);
|
||||
writer_printf(wctx, "%s=%lld\n", key, value);
|
||||
}
|
||||
|
||||
static const Writer ini_writer = {
|
||||
@ -1523,7 +1601,7 @@ static const char *json_escape_str(AVBPrint *dst, const char *src, void *log_ctx
|
||||
return dst->str;
|
||||
}
|
||||
|
||||
#define JSON_INDENT() printf("%*c", json->indent_level * 4, ' ')
|
||||
#define JSON_INDENT() writer_printf(wctx, "%*c", json->indent_level * 4, ' ')
|
||||
|
||||
static void json_print_section_header(WriterContext *wctx)
|
||||
{
|
||||
@ -1534,10 +1612,10 @@ static void json_print_section_header(WriterContext *wctx)
|
||||
wctx->section[wctx->level-1] : NULL;
|
||||
|
||||
if (wctx->level && wctx->nb_item[wctx->level-1])
|
||||
printf(",\n");
|
||||
writer_put_str(wctx, ",\n");
|
||||
|
||||
if (section->flags & SECTION_FLAG_IS_WRAPPER) {
|
||||
printf("{\n");
|
||||
writer_put_str(wctx, "{\n");
|
||||
json->indent_level++;
|
||||
} else {
|
||||
av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED);
|
||||
@ -1546,17 +1624,18 @@ static void json_print_section_header(WriterContext *wctx)
|
||||
|
||||
json->indent_level++;
|
||||
if (section->flags & SECTION_FLAG_IS_ARRAY) {
|
||||
printf("\"%s\": [\n", buf.str);
|
||||
writer_printf(wctx, "\"%s\": [\n", buf.str);
|
||||
} else if (parent_section && !(parent_section->flags & SECTION_FLAG_IS_ARRAY)) {
|
||||
printf("\"%s\": {%s", buf.str, json->item_start_end);
|
||||
writer_printf(wctx, "\"%s\": {%s", buf.str, json->item_start_end);
|
||||
} else {
|
||||
printf("{%s", json->item_start_end);
|
||||
writer_printf(wctx, "{%s", json->item_start_end);
|
||||
|
||||
/* this is required so the parser can distinguish between packets and frames */
|
||||
if (parent_section && parent_section->id == SECTION_ID_PACKETS_AND_FRAMES) {
|
||||
if (!json->compact)
|
||||
JSON_INDENT();
|
||||
printf("\"type\": \"%s\"", section->name);
|
||||
writer_printf(wctx, "\"type\": \"%s\"", section->name);
|
||||
wctx->nb_item[wctx->level]++;
|
||||
}
|
||||
}
|
||||
av_bprint_finalize(&buf, NULL);
|
||||
@ -1570,18 +1649,18 @@ static void json_print_section_footer(WriterContext *wctx)
|
||||
|
||||
if (wctx->level == 0) {
|
||||
json->indent_level--;
|
||||
printf("\n}\n");
|
||||
writer_put_str(wctx, "\n}\n");
|
||||
} else if (section->flags & SECTION_FLAG_IS_ARRAY) {
|
||||
printf("\n");
|
||||
writer_w8(wctx, '\n');
|
||||
json->indent_level--;
|
||||
JSON_INDENT();
|
||||
printf("]");
|
||||
writer_w8(wctx, ']');
|
||||
} else {
|
||||
printf("%s", json->item_start_end);
|
||||
writer_put_str(wctx, json->item_start_end);
|
||||
json->indent_level--;
|
||||
if (!json->compact)
|
||||
JSON_INDENT();
|
||||
printf("}");
|
||||
writer_w8(wctx, '}');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1591,9 +1670,9 @@ static inline void json_print_item_str(WriterContext *wctx,
|
||||
AVBPrint buf;
|
||||
|
||||
av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED);
|
||||
printf("\"%s\":", json_escape_str(&buf, key, wctx));
|
||||
writer_printf(wctx, "\"%s\":", json_escape_str(&buf, key, wctx));
|
||||
av_bprint_clear(&buf);
|
||||
printf(" \"%s\"", json_escape_str(&buf, value, wctx));
|
||||
writer_printf(wctx, " \"%s\"", json_escape_str(&buf, value, wctx));
|
||||
av_bprint_finalize(&buf, NULL);
|
||||
}
|
||||
|
||||
@ -1604,7 +1683,7 @@ static void json_print_str(WriterContext *wctx, const char *key, const char *val
|
||||
wctx->section[wctx->level-1] : NULL;
|
||||
|
||||
if (wctx->nb_item[wctx->level] || (parent_section && parent_section->id == SECTION_ID_PACKETS_AND_FRAMES))
|
||||
printf("%s", json->item_sep);
|
||||
writer_put_str(wctx, json->item_sep);
|
||||
if (!json->compact)
|
||||
JSON_INDENT();
|
||||
json_print_item_str(wctx, key, value);
|
||||
@ -1618,12 +1697,12 @@ static void json_print_int(WriterContext *wctx, const char *key, long long int v
|
||||
AVBPrint buf;
|
||||
|
||||
if (wctx->nb_item[wctx->level] || (parent_section && parent_section->id == SECTION_ID_PACKETS_AND_FRAMES))
|
||||
printf("%s", json->item_sep);
|
||||
writer_put_str(wctx, json->item_sep);
|
||||
if (!json->compact)
|
||||
JSON_INDENT();
|
||||
|
||||
av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED);
|
||||
printf("\"%s\": %lld", json_escape_str(&buf, key, wctx), value);
|
||||
writer_printf(wctx, "\"%s\": %lld", json_escape_str(&buf, key, wctx), value);
|
||||
av_bprint_finalize(&buf, NULL);
|
||||
}
|
||||
|
||||
@ -1683,7 +1762,7 @@ static av_cold int xml_init(WriterContext *wctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define XML_INDENT() printf("%*c", xml->indent_level * 4, ' ')
|
||||
#define XML_INDENT() writer_printf(wctx, "%*c", xml->indent_level * 4, ' ')
|
||||
|
||||
static void xml_print_section_header(WriterContext *wctx)
|
||||
{
|
||||
@ -1697,8 +1776,8 @@ static void xml_print_section_header(WriterContext *wctx)
|
||||
"xmlns:ffprobe=\"http://www.ffmpeg.org/schema/ffprobe\" "
|
||||
"xsi:schemaLocation=\"http://www.ffmpeg.org/schema/ffprobe ffprobe.xsd\"";
|
||||
|
||||
printf("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
|
||||
printf("<%sffprobe%s>\n",
|
||||
writer_put_str(wctx, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
|
||||
writer_printf(wctx, "<%sffprobe%s>\n",
|
||||
xml->fully_qualified ? "ffprobe:" : "",
|
||||
xml->fully_qualified ? qual : "");
|
||||
return;
|
||||
@ -1706,20 +1785,20 @@ static void xml_print_section_header(WriterContext *wctx)
|
||||
|
||||
if (xml->within_tag) {
|
||||
xml->within_tag = 0;
|
||||
printf(">\n");
|
||||
writer_put_str(wctx, ">\n");
|
||||
}
|
||||
if (section->flags & SECTION_FLAG_HAS_VARIABLE_FIELDS) {
|
||||
xml->indent_level++;
|
||||
} else {
|
||||
if (parent_section && (parent_section->flags & SECTION_FLAG_IS_WRAPPER) &&
|
||||
wctx->level && wctx->nb_item[wctx->level-1])
|
||||
printf("\n");
|
||||
writer_w8(wctx, '\n');
|
||||
xml->indent_level++;
|
||||
|
||||
if (section->flags & SECTION_FLAG_IS_ARRAY) {
|
||||
XML_INDENT(); printf("<%s>\n", section->name);
|
||||
XML_INDENT(); writer_printf(wctx, "<%s>\n", section->name);
|
||||
} else {
|
||||
XML_INDENT(); printf("<%s ", section->name);
|
||||
XML_INDENT(); writer_printf(wctx, "<%s ", section->name);
|
||||
xml->within_tag = 1;
|
||||
}
|
||||
}
|
||||
@ -1731,15 +1810,15 @@ static void xml_print_section_footer(WriterContext *wctx)
|
||||
const struct section *section = wctx->section[wctx->level];
|
||||
|
||||
if (wctx->level == 0) {
|
||||
printf("</%sffprobe>\n", xml->fully_qualified ? "ffprobe:" : "");
|
||||
writer_printf(wctx, "</%sffprobe>\n", xml->fully_qualified ? "ffprobe:" : "");
|
||||
} else if (xml->within_tag) {
|
||||
xml->within_tag = 0;
|
||||
printf("/>\n");
|
||||
writer_put_str(wctx, "/>\n");
|
||||
xml->indent_level--;
|
||||
} else if (section->flags & SECTION_FLAG_HAS_VARIABLE_FIELDS) {
|
||||
xml->indent_level--;
|
||||
} else {
|
||||
XML_INDENT(); printf("</%s>\n", section->name);
|
||||
XML_INDENT(); writer_printf(wctx, "</%s>\n", section->name);
|
||||
xml->indent_level--;
|
||||
}
|
||||
}
|
||||
@ -1756,20 +1835,20 @@ static void xml_print_str(WriterContext *wctx, const char *key, const char *valu
|
||||
XML_INDENT();
|
||||
av_bprint_escape(&buf, key, NULL,
|
||||
AV_ESCAPE_MODE_XML, AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES);
|
||||
printf("<%s key=\"%s\"",
|
||||
section->element_name, buf.str);
|
||||
writer_printf(wctx, "<%s key=\"%s\"",
|
||||
section->element_name, buf.str);
|
||||
av_bprint_clear(&buf);
|
||||
|
||||
av_bprint_escape(&buf, value, NULL,
|
||||
AV_ESCAPE_MODE_XML, AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES);
|
||||
printf(" value=\"%s\"/>\n", buf.str);
|
||||
writer_printf(wctx, " value=\"%s\"/>\n", buf.str);
|
||||
} else {
|
||||
if (wctx->nb_item[wctx->level])
|
||||
printf(" ");
|
||||
writer_w8(wctx, ' ');
|
||||
|
||||
av_bprint_escape(&buf, value, NULL,
|
||||
AV_ESCAPE_MODE_XML, AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES);
|
||||
printf("%s=\"%s\"", key, buf.str);
|
||||
writer_printf(wctx, "%s=\"%s\"", key, buf.str);
|
||||
}
|
||||
|
||||
av_bprint_finalize(&buf, NULL);
|
||||
@ -1778,8 +1857,8 @@ static void xml_print_str(WriterContext *wctx, const char *key, const char *valu
|
||||
static void xml_print_int(WriterContext *wctx, const char *key, long long int value)
|
||||
{
|
||||
if (wctx->nb_item[wctx->level])
|
||||
printf(" ");
|
||||
printf("%s=\"%lld\"", key, value);
|
||||
writer_w8(wctx, ' ');
|
||||
writer_printf(wctx, "%s=\"%lld\"", key, value);
|
||||
}
|
||||
|
||||
static Writer xml_writer = {
|
||||
@ -2118,6 +2197,74 @@ static void print_dynamic_hdr10_plus(WriterContext *w, const AVDynamicHDRPlus *m
|
||||
}
|
||||
}
|
||||
|
||||
static void print_dynamic_hdr_vivid(WriterContext *w, const AVDynamicHDRVivid *metadata)
|
||||
{
|
||||
if (!metadata)
|
||||
return;
|
||||
print_int("system_start_code", metadata->system_start_code);
|
||||
print_int("num_windows", metadata->num_windows);
|
||||
|
||||
for (int n = 0; n < metadata->num_windows; n++) {
|
||||
const AVHDRVividColorTransformParams *params = &metadata->params[n];
|
||||
|
||||
print_q("minimum_maxrgb", params->minimum_maxrgb, '/');
|
||||
print_q("average_maxrgb", params->average_maxrgb, '/');
|
||||
print_q("variance_maxrgb", params->variance_maxrgb, '/');
|
||||
print_q("maximum_maxrgb", params->maximum_maxrgb, '/');
|
||||
}
|
||||
|
||||
for (int n = 0; n < metadata->num_windows; n++) {
|
||||
const AVHDRVividColorTransformParams *params = &metadata->params[n];
|
||||
|
||||
print_int("tone_mapping_mode_flag", params->tone_mapping_mode_flag);
|
||||
print_int("tone_mapping_param_num", params->tone_mapping_param_num);
|
||||
if (params->tone_mapping_mode_flag) {
|
||||
for (int i = 0; i < params->tone_mapping_param_num; i++) {
|
||||
const AVHDRVividColorToneMappingParams *tm_params = ¶ms->tm_params[i];
|
||||
|
||||
print_q("targeted_system_display_maximum_luminance",
|
||||
tm_params->targeted_system_display_maximum_luminance, '/');
|
||||
print_int("base_enable_flag", tm_params->base_enable_flag);
|
||||
if (tm_params->base_enable_flag) {
|
||||
print_q("base_param_m_p", tm_params->base_param_m_p, '/');
|
||||
print_q("base_param_m_m", tm_params->base_param_m_m, '/');
|
||||
print_q("base_param_m_a", tm_params->base_param_m_a, '/');
|
||||
print_q("base_param_m_b", tm_params->base_param_m_b, '/');
|
||||
print_q("base_param_m_n", tm_params->base_param_m_n, '/');
|
||||
|
||||
print_int("base_param_k1", tm_params->base_param_k1);
|
||||
print_int("base_param_k2", tm_params->base_param_k2);
|
||||
print_int("base_param_k3", tm_params->base_param_k3);
|
||||
print_int("base_param_Delta_enable_mode",
|
||||
tm_params->base_param_Delta_enable_mode);
|
||||
print_q("base_param_Delta", tm_params->base_param_Delta, '/');
|
||||
}
|
||||
print_int("3Spline_enable_flag", tm_params->three_Spline_enable_flag);
|
||||
if (tm_params->three_Spline_enable_flag) {
|
||||
print_int("3Spline_num", tm_params->three_Spline_num);
|
||||
print_int("3Spline_TH_mode", tm_params->three_Spline_TH_mode);
|
||||
|
||||
for (int j = 0; j < tm_params->three_Spline_num; j++) {
|
||||
print_q("3Spline_TH_enable_MB", tm_params->three_Spline_TH_enable_MB, '/');
|
||||
print_q("3Spline_TH_enable", tm_params->three_Spline_TH_enable, '/');
|
||||
print_q("3Spline_TH_Delta1", tm_params->three_Spline_TH_Delta1, '/');
|
||||
print_q("3Spline_TH_Delta2", tm_params->three_Spline_TH_Delta2, '/');
|
||||
print_q("3Spline_enable_Strength", tm_params->three_Spline_enable_Strength, '/');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print_int("color_saturation_mapping_flag", params->color_saturation_mapping_flag);
|
||||
if (params->color_saturation_mapping_flag) {
|
||||
print_int("color_saturation_num", params->color_saturation_num);
|
||||
for (int i = 0; i < params->color_saturation_num; i++) {
|
||||
print_q("color_saturation_gain", params->color_saturation_gain[i], '/');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void print_pkt_side_data(WriterContext *w,
|
||||
AVCodecParameters *par,
|
||||
const AVPacketSideData *side_data,
|
||||
@ -2214,6 +2361,8 @@ static void print_pkt_side_data(WriterContext *w,
|
||||
if (do_show_data)
|
||||
writer_print_data(w, "data", sd->data, sd->size);
|
||||
writer_print_data_hash(w, "data_hash", sd->data, sd->size);
|
||||
} else if (sd->type == AV_PKT_DATA_AFD && sd->size > 0) {
|
||||
print_int("active_format", *sd->data);
|
||||
}
|
||||
writer_print_section_footer(w);
|
||||
}
|
||||
@ -2462,12 +2611,10 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
|
||||
if (s) print_str ("sample_fmt", s);
|
||||
else print_str_opt("sample_fmt", "unknown");
|
||||
print_int("nb_samples", frame->nb_samples);
|
||||
print_int("channels", frame->channels);
|
||||
if (frame->channel_layout) {
|
||||
av_bprint_clear(&pbuf);
|
||||
av_bprint_channel_layout(&pbuf, frame->channels,
|
||||
frame->channel_layout);
|
||||
print_str ("channel_layout", pbuf.str);
|
||||
print_int("channels", frame->ch_layout.nb_channels);
|
||||
if (frame->ch_layout.order != AV_CHANNEL_ORDER_UNSPEC) {
|
||||
av_channel_layout_describe(&frame->ch_layout, val_str, sizeof(val_str));
|
||||
print_str ("channel_layout", val_str);
|
||||
} else
|
||||
print_str_opt("channel_layout", "unknown");
|
||||
break;
|
||||
@ -2488,6 +2635,8 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
|
||||
if (sd->type == AV_FRAME_DATA_DISPLAYMATRIX && sd->size >= 9*4) {
|
||||
writer_print_integers(w, "displaymatrix", sd->data, 9, " %11d", 3, 4, 1);
|
||||
print_int("rotation", av_display_rotation_get((int32_t *)sd->data));
|
||||
} else if (sd->type == AV_FRAME_DATA_AFD && sd->size > 0) {
|
||||
print_int("active_format", *sd->data);
|
||||
} else if (sd->type == AV_FRAME_DATA_GOP_TIMECODE && sd->size >= 8) {
|
||||
char tcbuf[AV_TIMECODE_STR_SIZE];
|
||||
av_timecode_make_mpeg_tc_string(tcbuf, *(int64_t *)(sd->data));
|
||||
@ -2537,6 +2686,9 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
|
||||
print_int("size", sd->size);
|
||||
} else if (sd->type == AV_FRAME_DATA_DOVI_METADATA) {
|
||||
print_dovi_metadata(w, (const AVDOVIMetadata *)sd->data);
|
||||
} else if (sd->type == AV_FRAME_DATA_DYNAMIC_HDR_VIVID) {
|
||||
AVDynamicHDRVivid *metadata = (AVDynamicHDRVivid *)sd->data;
|
||||
print_dynamic_hdr_vivid(w, metadata);
|
||||
}
|
||||
writer_print_section_footer(w);
|
||||
}
|
||||
@ -2561,7 +2713,7 @@ static av_always_inline int process_frame(WriterContext *w,
|
||||
int ret = 0, got_frame = 0;
|
||||
|
||||
clear_log(1);
|
||||
if (dec_ctx && dec_ctx->codec) {
|
||||
if (dec_ctx) {
|
||||
switch (par->codec_type) {
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
@ -2730,8 +2882,11 @@ static int read_interval_packets(WriterContext *w, InputFile *ifile,
|
||||
//Flush remaining frames that are cached in the decoder
|
||||
for (i = 0; i < fmt_ctx->nb_streams; i++) {
|
||||
pkt->stream_index = i;
|
||||
if (do_read_frames)
|
||||
if (do_read_frames) {
|
||||
while (process_frame(w, ifile, frame, pkt, &(int){1}) > 0);
|
||||
if (ifile->streams[i].dec_ctx)
|
||||
avcodec_flush_buffers(ifile->streams[i].dec_ctx);
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
@ -2873,12 +3028,11 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
|
||||
if (s) print_str ("sample_fmt", s);
|
||||
else print_str_opt("sample_fmt", "unknown");
|
||||
print_val("sample_rate", par->sample_rate, unit_hertz_str);
|
||||
print_int("channels", par->channels);
|
||||
print_int("channels", par->ch_layout.nb_channels);
|
||||
|
||||
if (par->channel_layout) {
|
||||
av_bprint_clear(&pbuf);
|
||||
av_bprint_channel_layout(&pbuf, par->channels, par->channel_layout);
|
||||
print_str ("channel_layout", pbuf.str);
|
||||
if (par->ch_layout.order != AV_CHANNEL_ORDER_UNSPEC) {
|
||||
av_channel_layout_describe(&par->ch_layout, val_str, sizeof(val_str));
|
||||
print_str ("channel_layout", val_str);
|
||||
} else {
|
||||
print_str_opt("channel_layout", "unknown");
|
||||
}
|
||||
@ -2898,7 +3052,7 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
|
||||
break;
|
||||
}
|
||||
|
||||
if (dec_ctx && dec_ctx->codec && dec_ctx->codec->priv_class && show_private_data) {
|
||||
if (dec_ctx && dec_ctx->codec->priv_class && show_private_data) {
|
||||
const AVOption *opt = NULL;
|
||||
while (opt = av_opt_next(dec_ctx->priv_data,opt)) {
|
||||
uint8_t *str;
|
||||
@ -3337,7 +3491,7 @@ end:
|
||||
static void show_usage(void)
|
||||
{
|
||||
av_log(NULL, AV_LOG_INFO, "Simple multimedia streams analyzer\n");
|
||||
av_log(NULL, AV_LOG_INFO, "usage: %s [OPTIONS] [INPUT_FILE]\n", program_name);
|
||||
av_log(NULL, AV_LOG_INFO, "usage: %s [OPTIONS] INPUT_FILE\n", program_name);
|
||||
av_log(NULL, AV_LOG_INFO, "\n");
|
||||
}
|
||||
|
||||
@ -3542,22 +3696,6 @@ static int opt_show_entries(void *optctx, const char *opt, const char *arg)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int opt_show_format_entry(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
char *buf = av_asprintf("format=%s", arg);
|
||||
int ret;
|
||||
|
||||
if (!buf)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
av_log(NULL, AV_LOG_WARNING,
|
||||
"Option '%s' is deprecated, use '-show_entries format=%s' instead\n",
|
||||
opt, arg);
|
||||
ret = opt_show_entries(optctx, opt, buf);
|
||||
av_free(buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void opt_input_file(void *optctx, const char *arg)
|
||||
{
|
||||
if (input_filename) {
|
||||
@ -3577,6 +3715,25 @@ static int opt_input_file_i(void *optctx, const char *opt, const char *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void opt_output_file(void *optctx, const char *arg)
|
||||
{
|
||||
if (output_filename) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"Argument '%s' provided as output filename, but '%s' was already specified.\n",
|
||||
arg, output_filename);
|
||||
exit_program(1);
|
||||
}
|
||||
if (!strcmp(arg, "-"))
|
||||
arg = "pipe:";
|
||||
output_filename = arg;
|
||||
}
|
||||
|
||||
static int opt_output_file_o(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
opt_output_file(optctx, arg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int opt_print_filename(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
print_input_filename = arg;
|
||||
@ -3818,8 +3975,6 @@ static const OptionDef real_options[] = {
|
||||
{ "show_error", 0, { .func_arg = &opt_show_error }, "show probing error" },
|
||||
{ "show_format", 0, { .func_arg = &opt_show_format }, "show format/container info" },
|
||||
{ "show_frames", 0, { .func_arg = &opt_show_frames }, "show frames info" },
|
||||
{ "show_format_entry", HAS_ARG, {.func_arg = opt_show_format_entry},
|
||||
"show a particular entry from the format/container info", "entry" },
|
||||
{ "show_entries", HAS_ARG, {.func_arg = opt_show_entries},
|
||||
"show a set of specified entries", "entry_list" },
|
||||
#if HAVE_THREADS
|
||||
@ -3840,8 +3995,8 @@ static const OptionDef real_options[] = {
|
||||
{ "private", OPT_BOOL, { &show_private_data }, "same as show_private_data" },
|
||||
{ "bitexact", OPT_BOOL, {&do_bitexact}, "force bitexact output" },
|
||||
{ "read_intervals", HAS_ARG, {.func_arg = opt_read_intervals}, "set read intervals", "read_intervals" },
|
||||
{ "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {.func_arg = opt_default}, "generic catch all option", "" },
|
||||
{ "i", HAS_ARG, {.func_arg = opt_input_file_i}, "read specified file", "input_file"},
|
||||
{ "o", HAS_ARG, {.func_arg = opt_output_file_o}, "write to specified output", "output_file"},
|
||||
{ "print_filename", HAS_ARG, {.func_arg = opt_print_filename}, "override the printed input filename", "print_file"},
|
||||
{ "find_stream_info", OPT_BOOL | OPT_INPUT | OPT_EXPERT, { &find_stream_info },
|
||||
"read and decode the streams to fill missing information with heuristics" },
|
||||
@ -3969,7 +4124,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if ((ret = writer_open(&wctx, w, w_args,
|
||||
sections, FF_ARRAY_ELEMS(sections))) >= 0) {
|
||||
sections, FF_ARRAY_ELEMS(sections), output_filename)) >= 0) {
|
||||
if (w == &xml_writer)
|
||||
wctx->string_validation_utf8_flags |= AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES;
|
||||
|
||||
@ -3996,7 +4151,9 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
writer_print_section_footer(wctx);
|
||||
writer_close(&wctx);
|
||||
ret = writer_close(&wctx);
|
||||
if (ret < 0)
|
||||
av_log(NULL, AV_LOG_ERROR, "Writing output failed: %s\n", av_err2str(ret));
|
||||
}
|
||||
|
||||
end:
|
||||
|
71
fftools/fopen_utf8.h
Normal file
71
fftools/fopen_utf8.h
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* 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 FFTOOLS_FOPEN_UTF8_H
|
||||
#define FFTOOLS_FOPEN_UTF8_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* The fopen_utf8 function here is essentially equivalent to avpriv_fopen_utf8,
|
||||
* except that it doesn't set O_CLOEXEC, and that it isn't exported
|
||||
* from a different library. (On Windows, each DLL might use a different
|
||||
* CRT, and FILE* handles can't be shared across them.) */
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "libavutil/wchar_filename.h"
|
||||
|
||||
static inline FILE *fopen_utf8(const char *path_utf8, const char *mode)
|
||||
{
|
||||
wchar_t *path_w, *mode_w;
|
||||
FILE *f;
|
||||
|
||||
/* convert UTF-8 to wide chars */
|
||||
if (get_extended_win32_path(path_utf8, &path_w)) /* This sets errno on error. */
|
||||
return NULL;
|
||||
if (!path_w)
|
||||
goto fallback;
|
||||
|
||||
if (utf8towchar(mode, &mode_w))
|
||||
return NULL;
|
||||
if (!mode_w) {
|
||||
/* If failing to interpret the mode string as utf8, it is an invalid
|
||||
* parameter. */
|
||||
av_freep(&path_w);
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
f = _wfopen(path_w, mode_w);
|
||||
av_freep(&path_w);
|
||||
av_freep(&mode_w);
|
||||
|
||||
return f;
|
||||
fallback:
|
||||
/* path may be in CP_ACP */
|
||||
return fopen(path_utf8, mode);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static inline FILE *fopen_utf8(const char *path, const char *mode)
|
||||
{
|
||||
return fopen(path, mode);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FFTOOLS_FOPEN_UTF8_H */
|
1465
fftools/opt_common.c
Normal file
1465
fftools/opt_common.c
Normal file
File diff suppressed because it is too large
Load Diff
231
fftools/opt_common.h
Normal file
231
fftools/opt_common.h
Normal file
@ -0,0 +1,231 @@
|
||||
/*
|
||||
* Option handlers shared between the tools.
|
||||
*
|
||||
* 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 FFTOOLS_OPT_COMMON_H
|
||||
#define FFTOOLS_OPT_COMMON_H
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "cmdutils.h"
|
||||
|
||||
#if CONFIG_AVDEVICE
|
||||
/**
|
||||
* Print a listing containing autodetected sinks of the output device.
|
||||
* Device name with options may be passed as an argument to limit results.
|
||||
*/
|
||||
int show_sinks(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing autodetected sources of the input device.
|
||||
* Device name with options may be passed as an argument to limit results.
|
||||
*/
|
||||
int show_sources(void *optctx, const char *opt, const char *arg);
|
||||
#endif
|
||||
|
||||
#if CONFIG_AVDEVICE
|
||||
#define CMDUTILS_COMMON_OPTIONS_AVDEVICE \
|
||||
{ "sources" , OPT_EXIT | HAS_ARG, { .func_arg = show_sources }, \
|
||||
"list sources of the input device", "device" }, \
|
||||
{ "sinks" , OPT_EXIT | HAS_ARG, { .func_arg = show_sinks }, \
|
||||
"list sinks of the output device", "device" }, \
|
||||
|
||||
#else
|
||||
#define CMDUTILS_COMMON_OPTIONS_AVDEVICE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Print the license of the program to stdout. The license depends on
|
||||
* the license of the libraries compiled into the program.
|
||||
* This option processing function does not utilize the arguments.
|
||||
*/
|
||||
int show_license(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Generic -h handler common to all fftools.
|
||||
*/
|
||||
int show_help(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print the version of the program to stdout. The version message
|
||||
* depends on the current versions of the repository and of the libav*
|
||||
* libraries.
|
||||
* This option processing function does not utilize the arguments.
|
||||
*/
|
||||
int show_version(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print the build configuration of the program to stdout. The contents
|
||||
* depend on the definition of FFMPEG_CONFIGURATION.
|
||||
* This option processing function does not utilize the arguments.
|
||||
*/
|
||||
int show_buildconf(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the formats supported by the
|
||||
* program (including devices).
|
||||
* This option processing function does not utilize the arguments.
|
||||
*/
|
||||
int show_formats(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the muxers supported by the
|
||||
* program (including devices).
|
||||
* This option processing function does not utilize the arguments.
|
||||
*/
|
||||
int show_muxers(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the demuxer supported by the
|
||||
* program (including devices).
|
||||
* This option processing function does not utilize the arguments.
|
||||
*/
|
||||
int show_demuxers(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the devices supported by the
|
||||
* program.
|
||||
* This option processing function does not utilize the arguments.
|
||||
*/
|
||||
int show_devices(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the codecs supported by the
|
||||
* program.
|
||||
* This option processing function does not utilize the arguments.
|
||||
*/
|
||||
int show_codecs(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the decoders supported by the
|
||||
* program.
|
||||
*/
|
||||
int show_decoders(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the encoders supported by the
|
||||
* program.
|
||||
*/
|
||||
int show_encoders(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the bit stream filters supported by the
|
||||
* program.
|
||||
* This option processing function does not utilize the arguments.
|
||||
*/
|
||||
int show_bsfs(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the protocols supported by the
|
||||
* program.
|
||||
* This option processing function does not utilize the arguments.
|
||||
*/
|
||||
int show_protocols(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the filters supported by the
|
||||
* program.
|
||||
* This option processing function does not utilize the arguments.
|
||||
*/
|
||||
int show_filters(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the pixel formats supported by the
|
||||
* program.
|
||||
* This option processing function does not utilize the arguments.
|
||||
*/
|
||||
int show_pix_fmts(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the standard channel layouts supported by
|
||||
* the program.
|
||||
* This option processing function does not utilize the arguments.
|
||||
*/
|
||||
int show_layouts(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the sample formats supported by the
|
||||
* program.
|
||||
*/
|
||||
int show_sample_fmts(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all supported stream dispositions.
|
||||
*/
|
||||
int show_dispositions(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Print a listing containing all the color names and values recognized
|
||||
* by the program.
|
||||
*/
|
||||
int show_colors(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Set the libav* libraries log level.
|
||||
*/
|
||||
int opt_loglevel(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
int opt_report(void *optctx, const char *opt, const char *arg);
|
||||
int init_report(const char *env, FILE **file);
|
||||
|
||||
int opt_max_alloc(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Override the cpuflags.
|
||||
*/
|
||||
int opt_cpuflags(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Override the cpucount.
|
||||
*/
|
||||
int opt_cpucount(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
#define CMDUTILS_COMMON_OPTIONS \
|
||||
{ "L", OPT_EXIT, { .func_arg = show_license }, "show license" }, \
|
||||
{ "h", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
|
||||
{ "?", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
|
||||
{ "help", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
|
||||
{ "-help", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
|
||||
{ "version", OPT_EXIT, { .func_arg = show_version }, "show version" }, \
|
||||
{ "buildconf", OPT_EXIT, { .func_arg = show_buildconf }, "show build configuration" }, \
|
||||
{ "formats", OPT_EXIT, { .func_arg = show_formats }, "show available formats" }, \
|
||||
{ "muxers", OPT_EXIT, { .func_arg = show_muxers }, "show available muxers" }, \
|
||||
{ "demuxers", OPT_EXIT, { .func_arg = show_demuxers }, "show available demuxers" }, \
|
||||
{ "devices", OPT_EXIT, { .func_arg = show_devices }, "show available devices" }, \
|
||||
{ "codecs", OPT_EXIT, { .func_arg = show_codecs }, "show available codecs" }, \
|
||||
{ "decoders", OPT_EXIT, { .func_arg = show_decoders }, "show available decoders" }, \
|
||||
{ "encoders", OPT_EXIT, { .func_arg = show_encoders }, "show available encoders" }, \
|
||||
{ "bsfs", OPT_EXIT, { .func_arg = show_bsfs }, "show available bit stream filters" }, \
|
||||
{ "protocols", OPT_EXIT, { .func_arg = show_protocols }, "show available protocols" }, \
|
||||
{ "filters", OPT_EXIT, { .func_arg = show_filters }, "show available filters" }, \
|
||||
{ "pix_fmts", OPT_EXIT, { .func_arg = show_pix_fmts }, "show available pixel formats" }, \
|
||||
{ "layouts", OPT_EXIT, { .func_arg = show_layouts }, "show standard channel layouts" }, \
|
||||
{ "sample_fmts", OPT_EXIT, { .func_arg = show_sample_fmts }, "show available audio sample formats" }, \
|
||||
{ "dispositions", OPT_EXIT, { .func_arg = show_dispositions}, "show available stream dispositions" }, \
|
||||
{ "colors", OPT_EXIT, { .func_arg = show_colors }, "show available color names" }, \
|
||||
{ "loglevel", HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
|
||||
{ "v", HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
|
||||
{ "report", 0, { .func_arg = opt_report }, "generate a report" }, \
|
||||
{ "max_alloc", HAS_ARG, { .func_arg = opt_max_alloc }, "set maximum size of a single allocated block", "bytes" }, \
|
||||
{ "cpuflags", HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" }, \
|
||||
{ "cpucount", HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpucount }, "force specific cpu count", "count" }, \
|
||||
{ "hide_banner", OPT_BOOL | OPT_EXPERT, {&hide_banner}, "do not show program banner", "hide_banner" }, \
|
||||
CMDUTILS_COMMON_OPTIONS_AVDEVICE \
|
||||
|
||||
#endif /* FFTOOLS_OPT_COMMON_H */
|
@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "codec_internal.h"
|
||||
#include "internal.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
|
||||
@ -35,12 +36,11 @@ static av_cold int zero12v_decode_init(AVCodecContext *avctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int zero12v_decode_frame(AVCodecContext *avctx, void *data,
|
||||
static int zero12v_decode_frame(AVCodecContext *avctx, AVFrame *pic,
|
||||
int *got_frame, AVPacket *avpkt)
|
||||
{
|
||||
int line, ret;
|
||||
const int width = avctx->width;
|
||||
AVFrame *pic = data;
|
||||
uint16_t *y, *u, *v;
|
||||
const uint8_t *line_end, *src = avpkt->data;
|
||||
int stride = avctx->width * 8 / 3;
|
||||
@ -144,13 +144,13 @@ static int zero12v_decode_frame(AVCodecContext *avctx, void *data,
|
||||
return avpkt->size;
|
||||
}
|
||||
|
||||
const AVCodec ff_zero12v_decoder = {
|
||||
.name = "012v",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"),
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.id = AV_CODEC_ID_012V,
|
||||
const FFCodec ff_zero12v_decoder = {
|
||||
.p.name = "012v",
|
||||
.p.long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"),
|
||||
.p.type = AVMEDIA_TYPE_VIDEO,
|
||||
.p.id = AV_CODEC_ID_012V,
|
||||
.init = zero12v_decode_init,
|
||||
.decode = zero12v_decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_DR1,
|
||||
FF_CODEC_DECODE_CB(zero12v_decode_frame),
|
||||
.p.capabilities = AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
|
||||
};
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "blockdsp.h"
|
||||
#include "bswapdsp.h"
|
||||
#include "bytestream.h"
|
||||
#include "codec_internal.h"
|
||||
#include "get_bits.h"
|
||||
#include "internal.h"
|
||||
|
||||
@ -249,7 +250,7 @@ static void idct(int16_t block[64])
|
||||
|
||||
static av_cold void init_vlcs(void)
|
||||
{
|
||||
static VLC_TYPE table[2][4][32][2];
|
||||
static VLCElem table[2][4][32];
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
@ -833,13 +834,12 @@ static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
static int decode_frame(AVCodecContext *avctx, AVFrame *picture,
|
||||
int *got_frame, AVPacket *avpkt)
|
||||
{
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int buf_size = avpkt->size;
|
||||
FourXContext *const f = avctx->priv_data;
|
||||
AVFrame *picture = data;
|
||||
int i, frame_4cc, frame_size, ret;
|
||||
|
||||
if (buf_size < 20)
|
||||
@ -1008,10 +1008,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
|
||||
f->frame_buffer = av_mallocz(avctx->width * avctx->height * 2);
|
||||
f->last_frame_buffer = av_mallocz(avctx->width * avctx->height * 2);
|
||||
if (!f->frame_buffer || !f->last_frame_buffer) {
|
||||
decode_end(avctx);
|
||||
if (!f->frame_buffer || !f->last_frame_buffer)
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
f->version = AV_RL32(avctx->extradata) >> 16;
|
||||
ff_blockdsp_init(&f->bdsp, avctx);
|
||||
@ -1028,15 +1026,15 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const AVCodec ff_fourxm_decoder = {
|
||||
.name = "4xm",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("4X Movie"),
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.id = AV_CODEC_ID_4XM,
|
||||
const FFCodec ff_fourxm_decoder = {
|
||||
.p.name = "4xm",
|
||||
.p.long_name = NULL_IF_CONFIG_SMALL("4X Movie"),
|
||||
.p.type = AVMEDIA_TYPE_VIDEO,
|
||||
.p.id = AV_CODEC_ID_4XM,
|
||||
.priv_data_size = sizeof(FourXContext),
|
||||
.init = decode_init,
|
||||
.close = decode_end,
|
||||
.decode = decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
|
||||
FF_CODEC_DECODE_CB(decode_frame),
|
||||
.p.capabilities = AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
};
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "libavutil/internal.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "avcodec.h"
|
||||
#include "codec_internal.h"
|
||||
#include "decode.h"
|
||||
#include "internal.h"
|
||||
|
||||
@ -53,10 +54,9 @@ typedef struct EightBpsContext {
|
||||
uint32_t pal[256];
|
||||
} EightBpsContext;
|
||||
|
||||
static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
int *got_frame, AVPacket *avpkt)
|
||||
{
|
||||
AVFrame *frame = data;
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int buf_size = avpkt->size;
|
||||
EightBpsContext * const c = avctx->priv_data;
|
||||
@ -173,13 +173,14 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const AVCodec ff_eightbps_decoder = {
|
||||
.name = "8bps",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("QuickTime 8BPS video"),
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.id = AV_CODEC_ID_8BPS,
|
||||
const FFCodec ff_eightbps_decoder = {
|
||||
.p.name = "8bps",
|
||||
.p.long_name = NULL_IF_CONFIG_SMALL("QuickTime 8BPS video"),
|
||||
.p.type = AVMEDIA_TYPE_VIDEO,
|
||||
.p.id = AV_CODEC_ID_8BPS,
|
||||
.priv_data_size = sizeof(EightBpsContext),
|
||||
.init = decode_init,
|
||||
.decode = decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_DR1,
|
||||
FF_CODEC_DECODE_CB(decode_frame),
|
||||
.p.capabilities = AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
|
||||
};
|
||||
|
@ -37,8 +37,11 @@
|
||||
* http://aminet.net/mods/smpl/
|
||||
*/
|
||||
|
||||
#include "config_components.h"
|
||||
|
||||
#include "libavutil/avassert.h"
|
||||
#include "avcodec.h"
|
||||
#include "codec_internal.h"
|
||||
#include "internal.h"
|
||||
#include "libavutil/common.h"
|
||||
|
||||
@ -83,43 +86,43 @@ static void delta_decode(uint8_t *dst, const uint8_t *src, int src_size,
|
||||
}
|
||||
|
||||
/** decode a frame */
|
||||
static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
|
||||
static int eightsvx_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
int *got_frame_ptr, AVPacket *avpkt)
|
||||
{
|
||||
EightSvxContext *esc = avctx->priv_data;
|
||||
AVFrame *frame = data;
|
||||
int channels = avctx->ch_layout.nb_channels;
|
||||
int buf_size;
|
||||
int ch, ret;
|
||||
int hdr_size = 2;
|
||||
|
||||
/* decode and interleave the first packet */
|
||||
if (!esc->data[0] && avpkt) {
|
||||
int chan_size = avpkt->size / avctx->channels - hdr_size;
|
||||
int chan_size = avpkt->size / channels - hdr_size;
|
||||
|
||||
if (avpkt->size % avctx->channels) {
|
||||
if (avpkt->size % channels) {
|
||||
av_log(avctx, AV_LOG_WARNING, "Packet with odd size, ignoring last byte\n");
|
||||
}
|
||||
if (avpkt->size < (hdr_size + 1) * avctx->channels) {
|
||||
if (avpkt->size < (hdr_size + 1) * channels) {
|
||||
av_log(avctx, AV_LOG_ERROR, "packet size is too small\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
esc->fib_acc[0] = avpkt->data[1] + 128;
|
||||
if (avctx->channels == 2)
|
||||
if (channels == 2)
|
||||
esc->fib_acc[1] = avpkt->data[2+chan_size+1] + 128;
|
||||
|
||||
esc->data_idx = 0;
|
||||
esc->data_size = chan_size;
|
||||
if (!(esc->data[0] = av_malloc(chan_size)))
|
||||
return AVERROR(ENOMEM);
|
||||
if (avctx->channels == 2) {
|
||||
if (channels == 2) {
|
||||
if (!(esc->data[1] = av_malloc(chan_size))) {
|
||||
av_freep(&esc->data[0]);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
}
|
||||
memcpy(esc->data[0], &avpkt->data[hdr_size], chan_size);
|
||||
if (avctx->channels == 2)
|
||||
if (channels == 2)
|
||||
memcpy(esc->data[1], &avpkt->data[2*hdr_size+chan_size], chan_size);
|
||||
}
|
||||
if (!esc->data[0]) {
|
||||
@ -139,7 +142,7 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
|
||||
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
for (ch = 0; ch < avctx->channels; ch++) {
|
||||
for (ch = 0; ch < channels; ch++) {
|
||||
delta_decode(frame->data[ch], &esc->data[ch][esc->data_idx],
|
||||
buf_size, &esc->fib_acc[ch], esc->table);
|
||||
}
|
||||
@ -148,14 +151,14 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
|
||||
|
||||
*got_frame_ptr = 1;
|
||||
|
||||
return ((avctx->frame_number == 0)*hdr_size + buf_size)*avctx->channels;
|
||||
return ((avctx->frame_number == 0) * hdr_size + buf_size) * channels;
|
||||
}
|
||||
|
||||
static av_cold int eightsvx_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
EightSvxContext *esc = avctx->priv_data;
|
||||
|
||||
if (avctx->channels < 1 || avctx->channels > 2) {
|
||||
if (avctx->ch_layout.nb_channels < 1 || avctx->ch_layout.nb_channels > 2) {
|
||||
av_log(avctx, AV_LOG_ERROR, "8SVX does not support more than 2 channels\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@ -184,33 +187,33 @@ static av_cold int eightsvx_decode_close(AVCodecContext *avctx)
|
||||
}
|
||||
|
||||
#if CONFIG_EIGHTSVX_FIB_DECODER
|
||||
const AVCodec ff_eightsvx_fib_decoder = {
|
||||
.name = "8svx_fib",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("8SVX fibonacci"),
|
||||
.type = AVMEDIA_TYPE_AUDIO,
|
||||
.id = AV_CODEC_ID_8SVX_FIB,
|
||||
const FFCodec ff_eightsvx_fib_decoder = {
|
||||
.p.name = "8svx_fib",
|
||||
.p.long_name = NULL_IF_CONFIG_SMALL("8SVX fibonacci"),
|
||||
.p.type = AVMEDIA_TYPE_AUDIO,
|
||||
.p.id = AV_CODEC_ID_8SVX_FIB,
|
||||
.priv_data_size = sizeof (EightSvxContext),
|
||||
.init = eightsvx_decode_init,
|
||||
.decode = eightsvx_decode_frame,
|
||||
FF_CODEC_DECODE_CB(eightsvx_decode_frame),
|
||||
.close = eightsvx_decode_close,
|
||||
.capabilities = AV_CODEC_CAP_DR1,
|
||||
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P,
|
||||
.p.capabilities = AV_CODEC_CAP_DR1,
|
||||
.p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P,
|
||||
AV_SAMPLE_FMT_NONE },
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
|
||||
};
|
||||
#endif
|
||||
#if CONFIG_EIGHTSVX_EXP_DECODER
|
||||
const AVCodec ff_eightsvx_exp_decoder = {
|
||||
.name = "8svx_exp",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("8SVX exponential"),
|
||||
.type = AVMEDIA_TYPE_AUDIO,
|
||||
.id = AV_CODEC_ID_8SVX_EXP,
|
||||
const FFCodec ff_eightsvx_exp_decoder = {
|
||||
.p.name = "8svx_exp",
|
||||
.p.long_name = NULL_IF_CONFIG_SMALL("8SVX exponential"),
|
||||
.p.type = AVMEDIA_TYPE_AUDIO,
|
||||
.p.id = AV_CODEC_ID_8SVX_EXP,
|
||||
.priv_data_size = sizeof (EightSvxContext),
|
||||
.init = eightsvx_decode_init,
|
||||
.decode = eightsvx_decode_frame,
|
||||
FF_CODEC_DECODE_CB(eightsvx_decode_frame),
|
||||
.close = eightsvx_decode_close,
|
||||
.capabilities = AV_CODEC_CAP_DR1,
|
||||
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P,
|
||||
.p.capabilities = AV_CODEC_CAP_DR1,
|
||||
.p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P,
|
||||
AV_SAMPLE_FMT_NONE },
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
|
||||
};
|
||||
|
@ -22,6 +22,7 @@ HEADERS = ac3_parser.h \
|
||||
qsv.h \
|
||||
vdpau.h \
|
||||
version.h \
|
||||
version_major.h \
|
||||
videotoolbox.h \
|
||||
vorbis_parser.h \
|
||||
xvmc.h \
|
||||
@ -42,6 +43,7 @@ OBJS = ac3_parser.o \
|
||||
dirac.o \
|
||||
dv_profile.o \
|
||||
encode.o \
|
||||
get_buffer.o \
|
||||
imgconvert.o \
|
||||
jni.o \
|
||||
mathtables.o \
|
||||
@ -54,6 +56,8 @@ OBJS = ac3_parser.o \
|
||||
qsv_api.o \
|
||||
raw.o \
|
||||
utils.o \
|
||||
version.o \
|
||||
vlc.o \
|
||||
vorbis_parser.o \
|
||||
xiph.o \
|
||||
|
||||
@ -77,6 +81,7 @@ OBJS-$(CONFIG_CBS_MPEG2) += cbs_mpeg2.o
|
||||
OBJS-$(CONFIG_CBS_VP9) += cbs_vp9.o
|
||||
OBJS-$(CONFIG_CRYSTALHD) += crystalhd.o
|
||||
OBJS-$(CONFIG_DCT) += dct.o dct32_fixed.o dct32_float.o
|
||||
OBJS-$(CONFIG_DEFLATE_WRAPPER) += zlib_wrapper.o
|
||||
OBJS-$(CONFIG_DOVI_RPU) += dovi_rpu.o
|
||||
OBJS-$(CONFIG_ERROR_RESILIENCE) += error_resilience.o
|
||||
OBJS-$(CONFIG_EXIF) += exif.o tiff_common.o
|
||||
@ -96,7 +101,7 @@ OBJS-$(CONFIG_H264PARSE) += h264_parse.o h2645_parse.o h264_ps.o
|
||||
OBJS-$(CONFIG_H264PRED) += h264pred.o
|
||||
OBJS-$(CONFIG_H264QPEL) += h264qpel.o
|
||||
OBJS-$(CONFIG_HEVCPARSE) += hevc_parse.o h2645_parse.o hevc_ps.o hevc_sei.o hevc_data.o \
|
||||
dynamic_hdr10_plus.o
|
||||
dynamic_hdr10_plus.o dynamic_hdr_vivid.o
|
||||
OBJS-$(CONFIG_HPELDSP) += hpeldsp.o
|
||||
OBJS-$(CONFIG_HUFFMAN) += huffman.o
|
||||
OBJS-$(CONFIG_HUFFYUVDSP) += huffyuvdsp.o
|
||||
@ -104,6 +109,7 @@ OBJS-$(CONFIG_HUFFYUVENCDSP) += huffyuvencdsp.o
|
||||
OBJS-$(CONFIG_IDCTDSP) += idctdsp.o simple_idct.o jrevdct.o
|
||||
OBJS-$(CONFIG_IIRFILTER) += iirfilter.o
|
||||
OBJS-$(CONFIG_MDCT15) += mdct15.o
|
||||
OBJS-$(CONFIG_INFLATE_WRAPPER) += zlib_wrapper.o
|
||||
OBJS-$(CONFIG_INTRAX8) += intrax8.o intrax8dsp.o msmpeg4data.o
|
||||
OBJS-$(CONFIG_IVIDSP) += ivi_dsp.o
|
||||
OBJS-$(CONFIG_JNI) += ffjni.o jni.o
|
||||
@ -127,9 +133,10 @@ OBJS-$(CONFIG_MPEGAUDIODSP) += mpegaudiodsp.o \
|
||||
OBJS-$(CONFIG_MPEGAUDIOHEADER) += mpegaudiodecheader.o mpegaudiotabs.o
|
||||
OBJS-$(CONFIG_MPEG4AUDIO) += mpeg4audio.o mpeg4audio_sample_rates.o
|
||||
OBJS-$(CONFIG_MPEGVIDEO) += mpegvideo.o mpegvideodsp.o rl.o \
|
||||
mpegvideo_motion.o mpegutils.o \
|
||||
mpegvideo_motion.o \
|
||||
mpegvideodata.o mpegpicture.o \
|
||||
to_upper4.o
|
||||
OBJS-$(CONFIG_MPEGVIDEODEC) += mpegvideo_dec.o mpegutils.o
|
||||
OBJS-$(CONFIG_MPEGVIDEOENC) += mpegvideo_enc.o mpeg12data.o \
|
||||
motion_est.o ratecontrol.o \
|
||||
mpegvideoencdsp.o
|
||||
@ -288,6 +295,8 @@ OBJS-$(CONFIG_DERF_DPCM_DECODER) += dpcm.o
|
||||
OBJS-$(CONFIG_DIRAC_DECODER) += diracdec.o dirac.o diracdsp.o diractab.o \
|
||||
dirac_arith.o dirac_dwt.o dirac_vlc.o
|
||||
OBJS-$(CONFIG_DFA_DECODER) += dfa.o
|
||||
OBJS-$(CONFIG_DFPWM_DECODER) += dfpwmdec.o
|
||||
OBJS-$(CONFIG_DFPWM_ENCODER) += dfpwmenc.o
|
||||
OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o dnxhddata.o
|
||||
OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o
|
||||
OBJS-$(CONFIG_DOLBY_E_DECODER) += dolby_e.o dolby_e_parse.o kbdwin.o
|
||||
@ -562,6 +571,8 @@ OBJS-$(CONFIG_PGMYUV_DECODER) += pnmdec.o pnm.o
|
||||
OBJS-$(CONFIG_PGMYUV_ENCODER) += pnmenc.o
|
||||
OBJS-$(CONFIG_PGSSUB_DECODER) += pgssubdec.o
|
||||
OBJS-$(CONFIG_PGX_DECODER) += pgxdec.o
|
||||
OBJS-$(CONFIG_PHM_DECODER) += pnmdec.o pnm.o
|
||||
OBJS-$(CONFIG_PHM_ENCODER) += pnmenc.o
|
||||
OBJS-$(CONFIG_PHOTOCD_DECODER) += photocd.o
|
||||
OBJS-$(CONFIG_PICTOR_DECODER) += pictordec.o cga_data.o
|
||||
OBJS-$(CONFIG_PIXLET_DECODER) += pixlet.o
|
||||
@ -584,6 +595,8 @@ OBJS-$(CONFIG_QCELP_DECODER) += qcelpdec.o \
|
||||
OBJS-$(CONFIG_QDM2_DECODER) += qdm2.o
|
||||
OBJS-$(CONFIG_QDMC_DECODER) += qdmc.o
|
||||
OBJS-$(CONFIG_QDRAW_DECODER) += qdrw.o
|
||||
OBJS-$(CONFIG_QOI_DECODER) += qoidec.o
|
||||
OBJS-$(CONFIG_QOI_ENCODER) += qoienc.o
|
||||
OBJS-$(CONFIG_QPEG_DECODER) += qpeg.o
|
||||
OBJS-$(CONFIG_QTRLE_DECODER) += qtrle.o
|
||||
OBJS-$(CONFIG_QTRLE_ENCODER) += qtrleenc.o
|
||||
@ -701,6 +714,8 @@ OBJS-$(CONFIG_V408_ENCODER) += v408enc.o
|
||||
OBJS-$(CONFIG_V410_DECODER) += v410dec.o
|
||||
OBJS-$(CONFIG_V410_ENCODER) += v410enc.o
|
||||
OBJS-$(CONFIG_VB_DECODER) += vb.o
|
||||
OBJS-$(CONFIG_VBN_DECODER) += vbndec.o
|
||||
OBJS-$(CONFIG_VBN_ENCODER) += vbnenc.o
|
||||
OBJS-$(CONFIG_VBLE_DECODER) += vble.o
|
||||
OBJS-$(CONFIG_VC1_DECODER) += vc1dec.o vc1_block.o vc1_loopfilter.o \
|
||||
vc1_mc.o vc1_pred.o vc1.o vc1data.o \
|
||||
@ -799,6 +814,7 @@ OBJS-$(CONFIG_ZMBV_ENCODER) += zmbvenc.o
|
||||
# (AD)PCM decoders/encoders
|
||||
OBJS-$(CONFIG_PCM_ALAW_DECODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_ALAW_ENCODER) += pcm.o
|
||||
OBJS-$(CONFIG_PCM_BLURAY_ENCODER) += pcm-blurayenc.o
|
||||
OBJS-$(CONFIG_PCM_BLURAY_DECODER) += pcm-bluray.o
|
||||
OBJS-$(CONFIG_PCM_DVD_DECODER) += pcm-dvd.o
|
||||
OBJS-$(CONFIG_PCM_DVD_ENCODER) += pcm-dvdenc.o
|
||||
@ -942,6 +958,7 @@ OBJS-$(CONFIG_AV1_D3D11VA_HWACCEL) += dxva2_av1.o
|
||||
OBJS-$(CONFIG_AV1_DXVA2_HWACCEL) += dxva2_av1.o
|
||||
OBJS-$(CONFIG_AV1_NVDEC_HWACCEL) += nvdec_av1.o
|
||||
OBJS-$(CONFIG_AV1_VAAPI_HWACCEL) += vaapi_av1.o
|
||||
OBJS-$(CONFIG_AV1_VDPAU_HWACCEL) += vdpau_av1.o
|
||||
OBJS-$(CONFIG_H263_VAAPI_HWACCEL) += vaapi_mpeg4.o
|
||||
OBJS-$(CONFIG_H263_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o
|
||||
OBJS-$(CONFIG_H264_D3D11VA_HWACCEL) += dxva2_h264.o
|
||||
@ -962,7 +979,6 @@ OBJS-$(CONFIG_MJPEG_VAAPI_HWACCEL) += vaapi_mjpeg.o
|
||||
OBJS-$(CONFIG_MPEG1_NVDEC_HWACCEL) += nvdec_mpeg12.o
|
||||
OBJS-$(CONFIG_MPEG1_VDPAU_HWACCEL) += vdpau_mpeg12.o
|
||||
OBJS-$(CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o
|
||||
OBJS-$(CONFIG_MPEG1_XVMC_HWACCEL) += mpegvideo_xvmc.o
|
||||
OBJS-$(CONFIG_MPEG2_D3D11VA_HWACCEL) += dxva2_mpeg2.o
|
||||
OBJS-$(CONFIG_MPEG2_DXVA2_HWACCEL) += dxva2_mpeg2.o
|
||||
OBJS-$(CONFIG_MPEG2_NVDEC_HWACCEL) += nvdec_mpeg12.o
|
||||
@ -970,7 +986,6 @@ OBJS-$(CONFIG_MPEG2_QSV_HWACCEL) += qsvdec.o
|
||||
OBJS-$(CONFIG_MPEG2_VAAPI_HWACCEL) += vaapi_mpeg2.o
|
||||
OBJS-$(CONFIG_MPEG2_VDPAU_HWACCEL) += vdpau_mpeg12.o
|
||||
OBJS-$(CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o
|
||||
OBJS-$(CONFIG_MPEG2_XVMC_HWACCEL) += mpegvideo_xvmc.o
|
||||
OBJS-$(CONFIG_MPEG4_NVDEC_HWACCEL) += nvdec_mpeg4.o
|
||||
OBJS-$(CONFIG_MPEG4_VAAPI_HWACCEL) += vaapi_mpeg4.o
|
||||
OBJS-$(CONFIG_MPEG4_VDPAU_HWACCEL) += vdpau_mpeg4.o
|
||||
@ -1053,6 +1068,8 @@ OBJS-$(CONFIG_LIBGSM_MS_DECODER) += libgsmdec.o
|
||||
OBJS-$(CONFIG_LIBGSM_MS_ENCODER) += libgsmenc.o
|
||||
OBJS-$(CONFIG_LIBILBC_DECODER) += libilbc.o
|
||||
OBJS-$(CONFIG_LIBILBC_ENCODER) += libilbc.o
|
||||
OBJS-$(CONFIG_LIBJXL_DECODER) += libjxldec.o libjxl.o
|
||||
OBJS-$(CONFIG_LIBJXL_ENCODER) += libjxlenc.o libjxl.o
|
||||
OBJS-$(CONFIG_LIBKVAZAAR_ENCODER) += libkvazaar.o
|
||||
OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o
|
||||
OBJS-$(CONFIG_LIBOPENCORE_AMRNB_DECODER) += libopencore-amr.o
|
||||
@ -1100,7 +1117,7 @@ OBJS-$(CONFIG_AC3_PARSER) += aac_ac3_parser.o ac3tab.o \
|
||||
OBJS-$(CONFIG_ADX_PARSER) += adx_parser.o adx.o
|
||||
OBJS-$(CONFIG_AMR_PARSER) += amr_parser.o
|
||||
OBJS-$(CONFIG_AV1_PARSER) += av1_parser.o
|
||||
OBJS-$(CONFIG_AVS2_PARSER) += avs2_parser.o
|
||||
OBJS-$(CONFIG_AVS2_PARSER) += avs2.o avs2_parser.o
|
||||
OBJS-$(CONFIG_AVS3_PARSER) += avs3_parser.o
|
||||
OBJS-$(CONFIG_BMP_PARSER) += bmp_parser.o
|
||||
OBJS-$(CONFIG_CAVSVIDEO_PARSER) += cavs_parser.o
|
||||
@ -1139,6 +1156,7 @@ OBJS-$(CONFIG_OPUS_PARSER) += opus_parser.o opus.o opustab.o \
|
||||
opus_rc.o vorbis_data.o
|
||||
OBJS-$(CONFIG_PNG_PARSER) += png_parser.o
|
||||
OBJS-$(CONFIG_PNM_PARSER) += pnm_parser.o pnm.o
|
||||
OBJS-$(CONFIG_QOI_PARSER) += qoi_parser.o
|
||||
OBJS-$(CONFIG_RV30_PARSER) += rv34_parser.o
|
||||
OBJS-$(CONFIG_RV40_PARSER) += rv34_parser.o
|
||||
OBJS-$(CONFIG_SBC_PARSER) += sbc_parser.o
|
||||
@ -1161,6 +1179,7 @@ OBJS-$(CONFIG_AV1_FRAME_SPLIT_BSF) += av1_frame_split_bsf.o
|
||||
OBJS-$(CONFIG_CHOMP_BSF) += chomp_bsf.o
|
||||
OBJS-$(CONFIG_DUMP_EXTRADATA_BSF) += dump_extradata_bsf.o
|
||||
OBJS-$(CONFIG_DCA_CORE_BSF) += dca_core_bsf.o
|
||||
OBJS-$(CONFIG_DV_ERROR_MARKER_BSF) += dv_error_marker_bsf.o
|
||||
OBJS-$(CONFIG_EAC3_CORE_BSF) += eac3_core_bsf.o
|
||||
OBJS-$(CONFIG_EXTRACT_EXTRADATA_BSF) += extract_extradata_bsf.o \
|
||||
av1_parse.o h2645_parse.o
|
||||
@ -1183,6 +1202,7 @@ OBJS-$(CONFIG_NOISE_BSF) += noise_bsf.o
|
||||
OBJS-$(CONFIG_NULL_BSF) += null_bsf.o
|
||||
OBJS-$(CONFIG_OPUS_METADATA_BSF) += opus_metadata_bsf.o
|
||||
OBJS-$(CONFIG_PCM_RECHUNK_BSF) += pcm_rechunk_bsf.o
|
||||
OBJS-$(CONFIG_PGS_FRAME_MERGE_BSF) += pgs_frame_merge_bsf.o
|
||||
OBJS-$(CONFIG_PRORES_METADATA_BSF) += prores_metadata_bsf.o
|
||||
OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF) += remove_extradata_bsf.o av1_parse.o
|
||||
OBJS-$(CONFIG_SETTS_BSF) += setts_bsf.o
|
||||
@ -1217,6 +1237,7 @@ SKIPHEADERS-$(CONFIG_AMF) += amfenc.h
|
||||
SKIPHEADERS-$(CONFIG_D3D11VA) += d3d11va.h dxva2_internal.h
|
||||
SKIPHEADERS-$(CONFIG_DXVA2) += dxva2.h dxva2_internal.h
|
||||
SKIPHEADERS-$(CONFIG_JNI) += ffjni.h
|
||||
SKIPHEADERS-$(CONFIG_LIBJXL) += libjxl.h
|
||||
SKIPHEADERS-$(CONFIG_LIBVPX) += libvpx.h
|
||||
SKIPHEADERS-$(CONFIG_LIBWEBP_ENCODER) += libwebpenc_common.h
|
||||
SKIPHEADERS-$(CONFIG_MEDIACODEC) += mediacodecdec_common.h mediacodec_surface.h mediacodec_wrapper.h mediacodec_sw_buffer.h
|
||||
|
@ -24,11 +24,13 @@
|
||||
* a64 video encoder - multicolor modes
|
||||
*/
|
||||
|
||||
#include "config_components.h"
|
||||
|
||||
#include "a64colors.h"
|
||||
#include "a64tables.h"
|
||||
#include "codec_internal.h"
|
||||
#include "elbg.h"
|
||||
#include "encode.h"
|
||||
#include "internal.h"
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/common.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
@ -391,32 +393,32 @@ static int a64multi_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
}
|
||||
|
||||
#if CONFIG_A64MULTI_ENCODER
|
||||
const AVCodec ff_a64multi_encoder = {
|
||||
.name = "a64multi",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64"),
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.id = AV_CODEC_ID_A64_MULTI,
|
||||
.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
|
||||
const FFCodec ff_a64multi_encoder = {
|
||||
.p.name = "a64multi",
|
||||
.p.long_name = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64"),
|
||||
.p.type = AVMEDIA_TYPE_VIDEO,
|
||||
.p.id = AV_CODEC_ID_A64_MULTI,
|
||||
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
|
||||
.priv_data_size = sizeof(A64Context),
|
||||
.init = a64multi_encode_init,
|
||||
.encode2 = a64multi_encode_frame,
|
||||
FF_CODEC_ENCODE_CB(a64multi_encode_frame),
|
||||
.close = a64multi_close_encoder,
|
||||
.pix_fmts = (const enum AVPixelFormat[]) {AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE},
|
||||
.p.pix_fmts = (const enum AVPixelFormat[]) {AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE},
|
||||
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_INIT_THREADSAFE,
|
||||
};
|
||||
#endif
|
||||
#if CONFIG_A64MULTI5_ENCODER
|
||||
const AVCodec ff_a64multi5_encoder = {
|
||||
.name = "a64multi5",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64, extended with 5th color (colram)"),
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.id = AV_CODEC_ID_A64_MULTI5,
|
||||
.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
|
||||
const FFCodec ff_a64multi5_encoder = {
|
||||
.p.name = "a64multi5",
|
||||
.p.long_name = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64, extended with 5th color (colram)"),
|
||||
.p.type = AVMEDIA_TYPE_VIDEO,
|
||||
.p.id = AV_CODEC_ID_A64_MULTI5,
|
||||
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
|
||||
.priv_data_size = sizeof(A64Context),
|
||||
.init = a64multi_encode_init,
|
||||
.encode2 = a64multi_encode_frame,
|
||||
FF_CODEC_ENCODE_CB(a64multi_encode_frame),
|
||||
.close = a64multi_close_encoder,
|
||||
.pix_fmts = (const enum AVPixelFormat[]) {AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE},
|
||||
.p.pix_fmts = (const enum AVPixelFormat[]) {AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE},
|
||||
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_INIT_THREADSAFE,
|
||||
};
|
||||
#endif
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
|
||||
#include "aac_defines.h"
|
||||
#include "libavutil/channel_layout.h"
|
||||
#include "libavutil/float_dsp.h"
|
||||
#include "libavutil/fixed_dsp.h"
|
||||
#include "libavutil/mem_internal.h"
|
||||
@ -125,8 +126,7 @@ typedef struct OutputConfiguration {
|
||||
MPEG4AudioConfig m4ac;
|
||||
uint8_t layout_map[MAX_ELEM_ID*4][3];
|
||||
int layout_map_tags;
|
||||
int channels;
|
||||
uint64_t channel_layout;
|
||||
AVChannelLayout ch_layout;
|
||||
enum OCStatus status;
|
||||
} OutputConfiguration;
|
||||
|
||||
@ -288,6 +288,11 @@ typedef struct ChannelElement {
|
||||
SpectralBandReplication sbr;
|
||||
} ChannelElement;
|
||||
|
||||
enum AACOutputChannelOrder {
|
||||
CHANNEL_ORDER_DEFAULT,
|
||||
CHANNEL_ORDER_CODED,
|
||||
};
|
||||
|
||||
/**
|
||||
* main AAC context
|
||||
*/
|
||||
@ -352,6 +357,8 @@ struct AACContext {
|
||||
int dmono_mode; ///< 0->not dmono, 1->use first channel, 2->use second channel
|
||||
/** @} */
|
||||
|
||||
enum AACOutputChannelOrder output_channel_order;
|
||||
|
||||
DECLARE_ALIGNED(32, INTFLOAT, temp)[128];
|
||||
|
||||
OutputConfiguration oc[2];
|
||||
|
@ -20,6 +20,8 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "config_components.h"
|
||||
|
||||
#include "libavutil/channel_layout.h"
|
||||
#include "libavutil/common.h"
|
||||
#include "parser.h"
|
||||
@ -90,8 +92,19 @@ get_next:
|
||||
if (avctx->codec_id != AV_CODEC_ID_AAC) {
|
||||
avctx->sample_rate = s->sample_rate;
|
||||
if (!CONFIG_EAC3_DECODER || avctx->codec_id != AV_CODEC_ID_EAC3) {
|
||||
avctx->channels = s->channels;
|
||||
av_channel_layout_uninit(&avctx->ch_layout);
|
||||
if (s->channel_layout) {
|
||||
av_channel_layout_from_mask(&avctx->ch_layout, s->channel_layout);
|
||||
} else {
|
||||
avctx->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
|
||||
avctx->ch_layout.nb_channels = s->channels;
|
||||
}
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
avctx->channels = avctx->ch_layout.nb_channels;
|
||||
avctx->channel_layout = s->channel_layout;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
}
|
||||
s1->duration = s->samples;
|
||||
avctx->audio_service_type = s->service_type;
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "put_bits.h"
|
||||
#include "get_bits.h"
|
||||
#include "mpeg4audio.h"
|
||||
#include "internal.h"
|
||||
|
||||
typedef struct AACBSFContext {
|
||||
int first_frame_done;
|
||||
@ -149,10 +148,10 @@ static const enum AVCodecID codec_ids[] = {
|
||||
AV_CODEC_ID_AAC, AV_CODEC_ID_NONE,
|
||||
};
|
||||
|
||||
const AVBitStreamFilter ff_aac_adtstoasc_bsf = {
|
||||
.name = "aac_adtstoasc",
|
||||
const FFBitStreamFilter ff_aac_adtstoasc_bsf = {
|
||||
.p.name = "aac_adtstoasc",
|
||||
.p.codec_ids = codec_ids,
|
||||
.priv_data_size = sizeof(AACBSFContext),
|
||||
.init = aac_adtstoasc_init,
|
||||
.filter = aac_adtstoasc_filter,
|
||||
.codec_ids = codec_ids,
|
||||
};
|
||||
|
@ -397,7 +397,7 @@ static void search_for_quantizers_fast(AVCodecContext *avctx, AACEncContext *s,
|
||||
const float lambda)
|
||||
{
|
||||
int start = 0, i, w, w2, g;
|
||||
int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels * (lambda / 120.f);
|
||||
int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->ch_layout.nb_channels * (lambda / 120.f);
|
||||
float dists[128] = { 0 }, uplims[128] = { 0 };
|
||||
float maxvals[128];
|
||||
int fflag, minscaler;
|
||||
@ -556,7 +556,7 @@ static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChanne
|
||||
const float pns_transient_energy_r = FFMIN(0.7f, lambda / 140.f);
|
||||
|
||||
int refbits = avctx->bit_rate * 1024.0 / avctx->sample_rate
|
||||
/ ((avctx->flags & AV_CODEC_FLAG_QSCALE) ? 2.0f : avctx->channels)
|
||||
/ ((avctx->flags & AV_CODEC_FLAG_QSCALE) ? 2.0f : avctx->ch_layout.nb_channels)
|
||||
* (lambda / 120.f);
|
||||
|
||||
/** Keep this in sync with twoloop's cutoff selection */
|
||||
@ -564,7 +564,7 @@ static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChanne
|
||||
int prev = -1000, prev_sf = -1;
|
||||
int frame_bit_rate = (avctx->flags & AV_CODEC_FLAG_QSCALE)
|
||||
? (refbits * rate_bandwidth_multiplier * avctx->sample_rate / 1024)
|
||||
: (avctx->bit_rate / avctx->channels);
|
||||
: (avctx->bit_rate / avctx->ch_layout.nb_channels);
|
||||
|
||||
frame_bit_rate *= 1.15f;
|
||||
|
||||
@ -693,14 +693,14 @@ static void mark_pns(AACEncContext *s, AVCodecContext *avctx, SingleChannelEleme
|
||||
const float pns_transient_energy_r = FFMIN(0.7f, lambda / 140.f);
|
||||
|
||||
int refbits = avctx->bit_rate * 1024.0 / avctx->sample_rate
|
||||
/ ((avctx->flags & AV_CODEC_FLAG_QSCALE) ? 2.0f : avctx->channels)
|
||||
/ ((avctx->flags & AV_CODEC_FLAG_QSCALE) ? 2.0f : avctx->ch_layout.nb_channels)
|
||||
* (lambda / 120.f);
|
||||
|
||||
/** Keep this in sync with twoloop's cutoff selection */
|
||||
float rate_bandwidth_multiplier = 1.5f;
|
||||
int frame_bit_rate = (avctx->flags & AV_CODEC_FLAG_QSCALE)
|
||||
? (refbits * rate_bandwidth_multiplier * avctx->sample_rate / 1024)
|
||||
: (avctx->bit_rate / avctx->channels);
|
||||
: (avctx->bit_rate / avctx->ch_layout.nb_channels);
|
||||
|
||||
frame_bit_rate *= 1.15f;
|
||||
|
||||
|
@ -71,7 +71,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
|
||||
{
|
||||
int start = 0, i, w, w2, g, recomprd;
|
||||
int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate
|
||||
/ ((avctx->flags & AV_CODEC_FLAG_QSCALE) ? 2.0f : avctx->channels)
|
||||
/ ((avctx->flags & AV_CODEC_FLAG_QSCALE) ? 2.0f : avctx->ch_layout.nb_channels)
|
||||
* (lambda / 120.f);
|
||||
int refbits = destbits;
|
||||
int toomanybits, toofewbits;
|
||||
@ -186,7 +186,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
|
||||
float rate_bandwidth_multiplier = 1.5f;
|
||||
int frame_bit_rate = (avctx->flags & AV_CODEC_FLAG_QSCALE)
|
||||
? (refbits * rate_bandwidth_multiplier * avctx->sample_rate / 1024)
|
||||
: (avctx->bit_rate / avctx->channels);
|
||||
: (avctx->bit_rate / avctx->ch_layout.nb_channels);
|
||||
|
||||
/** Compensate for extensions that increase efficiency */
|
||||
if (s->options.pns || s->options.intensity_stereo)
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include "libavutil/float_dsp.h"
|
||||
#include "libavutil/opt.h"
|
||||
#include "avcodec.h"
|
||||
#include "internal.h"
|
||||
#include "codec_internal.h"
|
||||
#include "get_bits.h"
|
||||
#include "fft.h"
|
||||
#include "mdct15.h"
|
||||
@ -480,7 +480,7 @@ static int read_audio_mux_element(struct LATMContext *latmctx,
|
||||
}
|
||||
|
||||
|
||||
static int latm_decode_frame(AVCodecContext *avctx, void *out,
|
||||
static int latm_decode_frame(AVCodecContext *avctx, AVFrame *out,
|
||||
int *got_frame_ptr, AVPacket *avpkt)
|
||||
{
|
||||
struct LATMContext *latmctx = avctx->priv_data;
|
||||
@ -552,24 +552,27 @@ static av_cold int latm_decode_init(AVCodecContext *avctx)
|
||||
return ret;
|
||||
}
|
||||
|
||||
const AVCodec ff_aac_decoder = {
|
||||
.name = "aac",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"),
|
||||
.type = AVMEDIA_TYPE_AUDIO,
|
||||
.id = AV_CODEC_ID_AAC,
|
||||
const FFCodec ff_aac_decoder = {
|
||||
.p.name = "aac",
|
||||
.p.long_name = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"),
|
||||
.p.type = AVMEDIA_TYPE_AUDIO,
|
||||
.p.id = AV_CODEC_ID_AAC,
|
||||
.priv_data_size = sizeof(AACContext),
|
||||
.init = aac_decode_init,
|
||||
.close = aac_decode_close,
|
||||
.decode = aac_decode_frame,
|
||||
.sample_fmts = (const enum AVSampleFormat[]) {
|
||||
FF_CODEC_DECODE_CB(aac_decode_frame),
|
||||
.p.sample_fmts = (const enum AVSampleFormat[]) {
|
||||
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE
|
||||
},
|
||||
.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
|
||||
.p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.channel_layouts = aac_channel_layout,
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
.p.channel_layouts = aac_channel_layout,
|
||||
#endif
|
||||
.p.ch_layouts = aac_ch_layout,
|
||||
.flush = flush,
|
||||
.priv_class = &aac_decoder_class,
|
||||
.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
|
||||
.p.priv_class = &aac_decoder_class,
|
||||
.p.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
|
||||
};
|
||||
|
||||
/*
|
||||
@ -577,21 +580,24 @@ const AVCodec ff_aac_decoder = {
|
||||
in MPEG transport streams which only contain one program.
|
||||
To do a more complex LATM demuxing a separate LATM demuxer should be used.
|
||||
*/
|
||||
const AVCodec ff_aac_latm_decoder = {
|
||||
.name = "aac_latm",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Coding LATM syntax)"),
|
||||
.type = AVMEDIA_TYPE_AUDIO,
|
||||
.id = AV_CODEC_ID_AAC_LATM,
|
||||
const FFCodec ff_aac_latm_decoder = {
|
||||
.p.name = "aac_latm",
|
||||
.p.long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Coding LATM syntax)"),
|
||||
.p.type = AVMEDIA_TYPE_AUDIO,
|
||||
.p.id = AV_CODEC_ID_AAC_LATM,
|
||||
.priv_data_size = sizeof(struct LATMContext),
|
||||
.init = latm_decode_init,
|
||||
.close = aac_decode_close,
|
||||
.decode = latm_decode_frame,
|
||||
.sample_fmts = (const enum AVSampleFormat[]) {
|
||||
FF_CODEC_DECODE_CB(latm_decode_frame),
|
||||
.p.sample_fmts = (const enum AVSampleFormat[]) {
|
||||
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE
|
||||
},
|
||||
.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
|
||||
.p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.channel_layouts = aac_channel_layout,
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
.p.channel_layouts = aac_channel_layout,
|
||||
#endif
|
||||
.p.ch_layouts = aac_ch_layout,
|
||||
.flush = flush,
|
||||
.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
|
||||
.p.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
|
||||
};
|
||||
|
@ -64,7 +64,7 @@
|
||||
#include "libavutil/fixed_dsp.h"
|
||||
#include "libavutil/opt.h"
|
||||
#include "avcodec.h"
|
||||
#include "internal.h"
|
||||
#include "codec_internal.h"
|
||||
#include "get_bits.h"
|
||||
#include "fft.h"
|
||||
#include "lpc.h"
|
||||
@ -450,21 +450,24 @@ static void apply_independent_coupling_fixed(AACContext *ac,
|
||||
|
||||
#include "aacdec_template.c"
|
||||
|
||||
const AVCodec ff_aac_fixed_decoder = {
|
||||
.name = "aac_fixed",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"),
|
||||
.type = AVMEDIA_TYPE_AUDIO,
|
||||
.id = AV_CODEC_ID_AAC,
|
||||
const FFCodec ff_aac_fixed_decoder = {
|
||||
.p.name = "aac_fixed",
|
||||
.p.long_name = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"),
|
||||
.p.type = AVMEDIA_TYPE_AUDIO,
|
||||
.p.id = AV_CODEC_ID_AAC,
|
||||
.priv_data_size = sizeof(AACContext),
|
||||
.init = aac_decode_init,
|
||||
.close = aac_decode_close,
|
||||
.decode = aac_decode_frame,
|
||||
.sample_fmts = (const enum AVSampleFormat[]) {
|
||||
FF_CODEC_DECODE_CB(aac_decode_frame),
|
||||
.p.sample_fmts = (const enum AVSampleFormat[]) {
|
||||
AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_NONE
|
||||
},
|
||||
.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
|
||||
.p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.channel_layouts = aac_channel_layout,
|
||||
.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
.p.channel_layouts = aac_channel_layout,
|
||||
#endif
|
||||
.p.ch_layouts = aac_ch_layout,
|
||||
.p.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
|
||||
.flush = flush,
|
||||
};
|
||||
|
@ -91,6 +91,7 @@
|
||||
|
||||
#include "libavutil/channel_layout.h"
|
||||
#include "libavutil/thread.h"
|
||||
#include "internal.h"
|
||||
|
||||
static VLC vlc_scalefactors;
|
||||
static VLC vlc_spectral[11];
|
||||
@ -174,7 +175,7 @@ static int frame_configure_elements(AVCodecContext *avctx)
|
||||
|
||||
/* get output buffer */
|
||||
av_frame_unref(ac->frame);
|
||||
if (!avctx->channels)
|
||||
if (!avctx->ch_layout.nb_channels)
|
||||
return 1;
|
||||
|
||||
ac->frame->nb_samples = 2048;
|
||||
@ -182,7 +183,7 @@ static int frame_configure_elements(AVCodecContext *avctx)
|
||||
return ret;
|
||||
|
||||
/* map output channel pointers to AVFrame data */
|
||||
for (ch = 0; ch < avctx->channels; ch++) {
|
||||
for (ch = 0; ch < avctx->ch_layout.nb_channels; ch++) {
|
||||
if (ac->output_element[ch])
|
||||
ac->output_element[ch]->ret = (INTFLOAT *)ac->frame->extended_data[ch];
|
||||
}
|
||||
@ -517,8 +518,7 @@ static int push_output_configuration(AACContext *ac) {
|
||||
static void pop_output_configuration(AACContext *ac) {
|
||||
if (ac->oc[1].status != OC_LOCKED && ac->oc[0].status != OC_NONE) {
|
||||
ac->oc[1] = ac->oc[0];
|
||||
ac->avctx->channels = ac->oc[1].channels;
|
||||
ac->avctx->channel_layout = ac->oc[1].channel_layout;
|
||||
ac->avctx->ch_layout = ac->oc[1].ch_layout;
|
||||
output_configure(ac, ac->oc[1].layout_map, ac->oc[1].layout_map_tags,
|
||||
ac->oc[1].status, 0);
|
||||
}
|
||||
@ -555,7 +555,14 @@ static int output_configure(AACContext *ac,
|
||||
}
|
||||
// Try to sniff a reasonable channel order, otherwise output the
|
||||
// channels in the order the PCE declared them.
|
||||
if (avctx->request_channel_layout != AV_CH_LAYOUT_NATIVE)
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
if (avctx->request_channel_layout == AV_CH_LAYOUT_NATIVE)
|
||||
ac->output_channel_order = CHANNEL_ORDER_CODED;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
||||
if (ac->output_channel_order == CHANNEL_ORDER_DEFAULT)
|
||||
layout = sniff_channel_order(layout_map, tags);
|
||||
for (i = 0; i < tags; i++) {
|
||||
int type = layout_map[i][0];
|
||||
@ -577,9 +584,15 @@ static int output_configure(AACContext *ac,
|
||||
}
|
||||
}
|
||||
|
||||
if (layout) avctx->channel_layout = layout;
|
||||
ac->oc[1].channel_layout = layout;
|
||||
avctx->channels = ac->oc[1].channels = channels;
|
||||
av_channel_layout_uninit(&ac->oc[1].ch_layout);
|
||||
if (layout)
|
||||
av_channel_layout_from_mask(&ac->oc[1].ch_layout, layout);
|
||||
else {
|
||||
ac->oc[1].ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
|
||||
ac->oc[1].ch_layout.nb_channels = channels;
|
||||
}
|
||||
|
||||
av_channel_layout_copy(&avctx->ch_layout, &ac->oc[1].ch_layout);
|
||||
ac->oc[1].status = oc_type;
|
||||
|
||||
if (get_new_frame) {
|
||||
@ -688,14 +701,15 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
|
||||
|
||||
av_log(ac->avctx, AV_LOG_DEBUG, "stereo with SCE\n");
|
||||
|
||||
if (set_default_channel_config(ac, ac->avctx, layout_map,
|
||||
&layout_map_tags, 1) < 0)
|
||||
return NULL;
|
||||
layout_map_tags = 2;
|
||||
layout_map[0][0] = layout_map[1][0] = TYPE_SCE;
|
||||
layout_map[0][2] = layout_map[1][2] = AAC_CHANNEL_FRONT;
|
||||
layout_map[0][1] = 0;
|
||||
layout_map[1][1] = 1;
|
||||
if (output_configure(ac, layout_map, layout_map_tags,
|
||||
OC_TRIAL_FRAME, 1) < 0)
|
||||
return NULL;
|
||||
|
||||
ac->oc[1].m4ac.chan_config = 1;
|
||||
if (ac->oc[1].m4ac.sbr)
|
||||
ac->oc[1].m4ac.ps = -1;
|
||||
}
|
||||
@ -773,8 +787,10 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
|
||||
type == TYPE_CPE) {
|
||||
ac->tags_mapped++;
|
||||
return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][0];
|
||||
} else if (ac->oc[1].m4ac.chan_config == 2) {
|
||||
return NULL;
|
||||
} else if (ac->tags_mapped == 1 && ac->oc[1].m4ac.chan_config == 2 &&
|
||||
type == TYPE_SCE) {
|
||||
ac->tags_mapped++;
|
||||
return ac->tag_che_map[TYPE_SCE][elem_id] = ac->che[TYPE_SCE][1];
|
||||
}
|
||||
case 1:
|
||||
if (!ac->tags_mapped && type == TYPE_SCE) {
|
||||
@ -1208,8 +1224,8 @@ static void aacdec_init(AACContext *ac);
|
||||
|
||||
static av_cold void aac_static_table_init(void)
|
||||
{
|
||||
static VLC_TYPE vlc_buf[304 + 270 + 550 + 300 + 328 +
|
||||
294 + 306 + 268 + 510 + 366 + 462][2];
|
||||
static VLCElem vlc_buf[304 + 270 + 550 + 300 + 328 +
|
||||
294 + 306 + 268 + 510 + 366 + 462];
|
||||
for (unsigned i = 0, offset = 0; i < 11; i++) {
|
||||
vlc_spectral[i].table = &vlc_buf[offset];
|
||||
vlc_spectral[i].table_allocated = FF_ARRAY_ELEMS(vlc_buf) - offset;
|
||||
@ -1292,12 +1308,12 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
|
||||
|
||||
sr = sample_rate_idx(avctx->sample_rate);
|
||||
ac->oc[1].m4ac.sampling_index = sr;
|
||||
ac->oc[1].m4ac.channels = avctx->channels;
|
||||
ac->oc[1].m4ac.channels = avctx->ch_layout.nb_channels;
|
||||
ac->oc[1].m4ac.sbr = -1;
|
||||
ac->oc[1].m4ac.ps = -1;
|
||||
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(ff_mpeg4audio_channels); i++)
|
||||
if (ff_mpeg4audio_channels[i] == avctx->channels)
|
||||
if (ff_mpeg4audio_channels[i] == avctx->ch_layout.nb_channels)
|
||||
break;
|
||||
if (i == FF_ARRAY_ELEMS(ff_mpeg4audio_channels)) {
|
||||
i = 0;
|
||||
@ -1315,7 +1331,7 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
|
||||
}
|
||||
}
|
||||
|
||||
if (avctx->channels > MAX_CHANNELS) {
|
||||
if (avctx->ch_layout.nb_channels > MAX_CHANNELS) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Too many channels\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@ -1808,7 +1824,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, INTFLOAT coef[1024],
|
||||
#if !USE_FIXED
|
||||
const float *vq = ff_aac_codebook_vector_vals[cbt_m1];
|
||||
#endif /* !USE_FIXED */
|
||||
VLC_TYPE (*vlc_tab)[2] = vlc_spectral[cbt_m1].table;
|
||||
const VLCElem *vlc_tab = vlc_spectral[cbt_m1].table;
|
||||
OPEN_READER(re, gb);
|
||||
|
||||
switch (cbt_m1 >> 1) {
|
||||
@ -2556,7 +2572,8 @@ static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt,
|
||||
av_log(ac->avctx, AV_LOG_ERROR, "Implicit SBR was found with a first occurrence after the first frame.\n");
|
||||
skip_bits_long(gb, 8 * cnt - 4);
|
||||
return res;
|
||||
} else if (ac->oc[1].m4ac.ps == -1 && ac->oc[1].status < OC_LOCKED && ac->avctx->channels == 1) {
|
||||
} else if (ac->oc[1].m4ac.ps == -1 && ac->oc[1].status < OC_LOCKED &&
|
||||
ac->avctx->ch_layout.nb_channels == 1) {
|
||||
ac->oc[1].m4ac.sbr = 1;
|
||||
ac->oc[1].m4ac.ps = 1;
|
||||
ac->avctx->profile = FF_PROFILE_AAC_HE_V2;
|
||||
@ -3221,7 +3238,7 @@ static int aac_decode_er_frame(AVCodecContext *avctx, void *data,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
|
||||
static int aac_decode_frame_int(AVCodecContext *avctx, AVFrame *frame,
|
||||
int *got_frame_ptr, GetBitContext *gb,
|
||||
const AVPacket *avpkt)
|
||||
{
|
||||
@ -3234,7 +3251,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
|
||||
int payload_alignment;
|
||||
uint8_t che_presence[4][MAX_ELEM_ID] = {{0}};
|
||||
|
||||
ac->frame = data;
|
||||
ac->frame = frame;
|
||||
|
||||
if (show_bits(gb, 12) == 0xfff) {
|
||||
if ((err = parse_adts_frame_header(ac, gb)) < 0) {
|
||||
@ -3264,7 +3281,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
|
||||
if (avctx->debug & FF_DEBUG_STARTCODE)
|
||||
av_log(avctx, AV_LOG_DEBUG, "Elem type:%x id:%x\n", elem_type, elem_id);
|
||||
|
||||
if (!avctx->channels && elem_type != TYPE_PCE) {
|
||||
if (!avctx->ch_layout.nb_channels && elem_type != TYPE_PCE) {
|
||||
err = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
@ -3385,7 +3402,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
|
||||
}
|
||||
}
|
||||
|
||||
if (!avctx->channels) {
|
||||
if (!avctx->ch_layout.nb_channels) {
|
||||
*got_frame_ptr = 0;
|
||||
return 0;
|
||||
}
|
||||
@ -3419,12 +3436,13 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
|
||||
|
||||
/* for dual-mono audio (SCE + SCE) */
|
||||
is_dmono = ac->dmono_mode && sce_count == 2 &&
|
||||
ac->oc[1].channel_layout == (AV_CH_FRONT_LEFT | AV_CH_FRONT_RIGHT);
|
||||
!av_channel_layout_compare(&ac->oc[1].ch_layout,
|
||||
&(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO);
|
||||
if (is_dmono) {
|
||||
if (ac->dmono_mode == 1)
|
||||
((AVFrame *)data)->data[1] =((AVFrame *)data)->data[0];
|
||||
frame->data[1] = frame->data[0];
|
||||
else if (ac->dmono_mode == 2)
|
||||
((AVFrame *)data)->data[0] =((AVFrame *)data)->data[1];
|
||||
frame->data[0] = frame->data[1];
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -3433,7 +3451,7 @@ fail:
|
||||
return err;
|
||||
}
|
||||
|
||||
static int aac_decode_frame(AVCodecContext *avctx, void *data,
|
||||
static int aac_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
int *got_frame_ptr, AVPacket *avpkt)
|
||||
{
|
||||
AACContext *ac = avctx->priv_data;
|
||||
@ -3480,10 +3498,10 @@ static int aac_decode_frame(AVCodecContext *avctx, void *data,
|
||||
case AOT_ER_AAC_LTP:
|
||||
case AOT_ER_AAC_LD:
|
||||
case AOT_ER_AAC_ELD:
|
||||
err = aac_decode_er_frame(avctx, data, got_frame_ptr, &gb);
|
||||
err = aac_decode_er_frame(avctx, frame, got_frame_ptr, &gb);
|
||||
break;
|
||||
default:
|
||||
err = aac_decode_frame_int(avctx, data, got_frame_ptr, &gb, avpkt);
|
||||
err = aac_decode_frame_int(avctx, frame, got_frame_ptr, &gb, avpkt);
|
||||
}
|
||||
if (err < 0)
|
||||
return err;
|
||||
@ -3535,8 +3553,9 @@ static void aacdec_init(AACContext *c)
|
||||
#endif
|
||||
|
||||
#if !USE_FIXED
|
||||
if(ARCH_MIPS)
|
||||
ff_aacdec_init_mips(c);
|
||||
#if ARCH_MIPS
|
||||
ff_aacdec_init_mips(c);
|
||||
#endif
|
||||
#endif /* !USE_FIXED */
|
||||
}
|
||||
/**
|
||||
@ -3553,6 +3572,14 @@ static const AVOption options[] = {
|
||||
{"sub" , "Select Sub/Right channel", 0, AV_OPT_TYPE_CONST, {.i64= 2}, INT_MIN, INT_MAX, AACDEC_FLAGS, "dual_mono_mode"},
|
||||
{"both", "Select both channels", 0, AV_OPT_TYPE_CONST, {.i64= 0}, INT_MIN, INT_MAX, AACDEC_FLAGS, "dual_mono_mode"},
|
||||
|
||||
{ "channel_order", "Order in which the channels are to be exported",
|
||||
offsetof(AACContext, output_channel_order), AV_OPT_TYPE_INT,
|
||||
{ .i64 = CHANNEL_ORDER_DEFAULT }, 0, 1, AACDEC_FLAGS, "channel_order" },
|
||||
{ "default", "normal libavcodec channel order", 0, AV_OPT_TYPE_CONST,
|
||||
{ .i64 = CHANNEL_ORDER_DEFAULT }, .flags = AACDEC_FLAGS, "channel_order" },
|
||||
{ "coded", "order in which the channels are coded in the bitstream",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = CHANNEL_ORDER_CODED }, .flags = AACDEC_FLAGS, "channel_order" },
|
||||
|
||||
{NULL},
|
||||
};
|
||||
|
||||
|
@ -72,6 +72,7 @@ static const uint8_t aac_channel_layout_map[16][16][3] = {
|
||||
/* TODO: Add 7+1 TOP configuration */
|
||||
};
|
||||
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
static const uint64_t aac_channel_layout[16] = {
|
||||
AV_CH_LAYOUT_MONO,
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
@ -89,5 +90,24 @@ static const uint64_t aac_channel_layout[16] = {
|
||||
0,
|
||||
/* AV_CH_LAYOUT_7POINT1_TOP, */
|
||||
};
|
||||
#endif
|
||||
|
||||
static const AVChannelLayout aac_ch_layout[16] = {
|
||||
AV_CHANNEL_LAYOUT_MONO,
|
||||
AV_CHANNEL_LAYOUT_STEREO,
|
||||
AV_CHANNEL_LAYOUT_SURROUND,
|
||||
AV_CHANNEL_LAYOUT_4POINT0,
|
||||
AV_CHANNEL_LAYOUT_5POINT0_BACK,
|
||||
AV_CHANNEL_LAYOUT_5POINT1_BACK,
|
||||
AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK,
|
||||
{ 0 },
|
||||
{ 0 },
|
||||
{ 0 },
|
||||
AV_CHANNEL_LAYOUT_6POINT1,
|
||||
AV_CHANNEL_LAYOUT_7POINT1,
|
||||
AV_CHANNEL_LAYOUT_22POINT2,
|
||||
{ 0 },
|
||||
/* AV_CHANNEL_LAYOUT_7POINT1_TOP, */
|
||||
};
|
||||
|
||||
#endif /* AVCODEC_AACDECTAB_H */
|
||||
|
@ -35,12 +35,13 @@
|
||||
#include "libavutil/float_dsp.h"
|
||||
#include "libavutil/opt.h"
|
||||
#include "avcodec.h"
|
||||
#include "codec_internal.h"
|
||||
#include "encode.h"
|
||||
#include "put_bits.h"
|
||||
#include "internal.h"
|
||||
#include "mpeg4audio.h"
|
||||
#include "sinewin.h"
|
||||
#include "profiles.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "aac.h"
|
||||
#include "aactab.h"
|
||||
@ -962,11 +963,11 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
|
||||
s->lambda = avctx->global_quality > 0 ? avctx->global_quality : 120;
|
||||
|
||||
/* Channel map and unspecified bitrate guessing */
|
||||
s->channels = avctx->channels;
|
||||
s->channels = avctx->ch_layout.nb_channels;
|
||||
|
||||
s->needs_pce = 1;
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(aac_normal_chan_layouts); i++) {
|
||||
if (avctx->channel_layout == aac_normal_chan_layouts[i]) {
|
||||
if (!av_channel_layout_compare(&avctx->ch_layout, &aac_normal_chan_layouts[i])) {
|
||||
s->needs_pce = s->options.pce;
|
||||
break;
|
||||
}
|
||||
@ -975,10 +976,13 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
|
||||
if (s->needs_pce) {
|
||||
char buf[64];
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(aac_pce_configs); i++)
|
||||
if (avctx->channel_layout == aac_pce_configs[i].layout)
|
||||
if (!av_channel_layout_compare(&avctx->ch_layout, &aac_pce_configs[i].layout))
|
||||
break;
|
||||
av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout);
|
||||
ERROR_IF(i == FF_ARRAY_ELEMS(aac_pce_configs), "Unsupported channel layout \"%s\"\n", buf);
|
||||
av_channel_layout_describe(&avctx->ch_layout, buf, sizeof(buf));
|
||||
if (i == FF_ARRAY_ELEMS(aac_pce_configs)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Unsupported channel layout \"%s\"\n", buf);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
av_log(avctx, AV_LOG_INFO, "Using a PCE to encode channel layout \"%s\"\n", buf);
|
||||
s->pce = aac_pce_configs[i];
|
||||
s->reorder_map = s->pce.reorder_map;
|
||||
@ -1092,11 +1096,13 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
|
||||
s->abs_pow34 = abs_pow34_v;
|
||||
s->quant_bands = quantize_bands;
|
||||
|
||||
if (ARCH_X86)
|
||||
ff_aac_dsp_init_x86(s);
|
||||
#if ARCH_X86
|
||||
ff_aac_dsp_init_x86(s);
|
||||
#endif
|
||||
|
||||
if (HAVE_MIPSDSP)
|
||||
ff_aac_coder_init_mips(s);
|
||||
#if HAVE_MIPSDSP
|
||||
ff_aac_coder_init_mips(s);
|
||||
#endif
|
||||
|
||||
ff_af_queue_init(avctx, &s->afq);
|
||||
ff_aac_tableinit();
|
||||
@ -1128,25 +1134,25 @@ static const AVClass aacenc_class = {
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
};
|
||||
|
||||
static const AVCodecDefault aac_encode_defaults[] = {
|
||||
static const FFCodecDefault aac_encode_defaults[] = {
|
||||
{ "b", "0" },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
const AVCodec ff_aac_encoder = {
|
||||
.name = "aac",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"),
|
||||
.type = AVMEDIA_TYPE_AUDIO,
|
||||
.id = AV_CODEC_ID_AAC,
|
||||
const FFCodec ff_aac_encoder = {
|
||||
.p.name = "aac",
|
||||
.p.long_name = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"),
|
||||
.p.type = AVMEDIA_TYPE_AUDIO,
|
||||
.p.id = AV_CODEC_ID_AAC,
|
||||
.priv_data_size = sizeof(AACEncContext),
|
||||
.init = aac_encode_init,
|
||||
.encode2 = aac_encode_frame,
|
||||
FF_CODEC_ENCODE_CB(aac_encode_frame),
|
||||
.close = aac_encode_end,
|
||||
.defaults = aac_encode_defaults,
|
||||
.supported_samplerates = ff_mpeg4audio_sample_rates,
|
||||
.p.supported_samplerates = ff_mpeg4audio_sample_rates,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.capabilities = AV_CODEC_CAP_SMALL_LAST_FRAME | AV_CODEC_CAP_DELAY,
|
||||
.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLTP,
|
||||
.p.capabilities = AV_CODEC_CAP_SMALL_LAST_FRAME | AV_CODEC_CAP_DELAY,
|
||||
.p.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLTP,
|
||||
AV_SAMPLE_FMT_NONE },
|
||||
.priv_class = &aacenc_class,
|
||||
.p.priv_class = &aacenc_class,
|
||||
};
|
||||
|
@ -94,7 +94,7 @@ typedef struct AACQuantizeBandCostCacheEntry {
|
||||
} AACQuantizeBandCostCacheEntry;
|
||||
|
||||
typedef struct AACPCEInfo {
|
||||
int64_t layout;
|
||||
AVChannelLayout layout;
|
||||
int num_ele[4]; ///< front, side, back, lfe
|
||||
int pairing[3][8]; ///< front, side, back
|
||||
int index[4][8]; ///< front, side, back, lfe
|
||||
@ -139,7 +139,7 @@ typedef struct AACPCEInfo {
|
||||
*/
|
||||
static const AACPCEInfo aac_pce_configs[] = {
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_MONO,
|
||||
.layout = AV_CHANNEL_LAYOUT_MONO,
|
||||
.num_ele = { 1, 0, 0, 0 },
|
||||
.pairing = { { 0 }, },
|
||||
.index = { { 0 }, },
|
||||
@ -147,7 +147,7 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0 },
|
||||
},
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_STEREO,
|
||||
.layout = AV_CHANNEL_LAYOUT_STEREO,
|
||||
.num_ele = { 1, 0, 0, 0 },
|
||||
.pairing = { { 1 }, },
|
||||
.index = { { 0 }, },
|
||||
@ -155,7 +155,7 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1 },
|
||||
},
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_2POINT1,
|
||||
.layout = AV_CHANNEL_LAYOUT_2POINT1,
|
||||
.num_ele = { 1, 0, 0, 1 },
|
||||
.pairing = { { 1 }, },
|
||||
.index = { { 0 },{ 0 },{ 0 },{ 0 } },
|
||||
@ -163,7 +163,7 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1, 2 },
|
||||
},
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_2_1,
|
||||
.layout = AV_CHANNEL_LAYOUT_2_1,
|
||||
.num_ele = { 1, 0, 1, 0 },
|
||||
.pairing = { { 1 },{ 0 },{ 0 } },
|
||||
.index = { { 0 },{ 0 },{ 0 }, },
|
||||
@ -171,7 +171,7 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1, 2 },
|
||||
},
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_SURROUND,
|
||||
.layout = AV_CHANNEL_LAYOUT_SURROUND,
|
||||
.num_ele = { 2, 0, 0, 0 },
|
||||
.pairing = { { 1, 0 }, },
|
||||
.index = { { 0, 0 }, },
|
||||
@ -179,7 +179,7 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1, 2 },
|
||||
},
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_3POINT1,
|
||||
.layout = AV_CHANNEL_LAYOUT_3POINT1,
|
||||
.num_ele = { 2, 0, 0, 1 },
|
||||
.pairing = { { 1, 0 }, },
|
||||
.index = { { 0, 0 }, { 0 }, { 0 }, { 0 }, },
|
||||
@ -187,7 +187,7 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1, 2, 3 },
|
||||
},
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_4POINT0,
|
||||
.layout = AV_CHANNEL_LAYOUT_4POINT0,
|
||||
.num_ele = { 2, 0, 1, 0 },
|
||||
.pairing = { { 1, 0 }, { 0 }, { 0 }, },
|
||||
.index = { { 0, 0 }, { 0 }, { 1 } },
|
||||
@ -195,7 +195,7 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1, 2, 3 },
|
||||
},
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_4POINT1,
|
||||
.layout = AV_CHANNEL_LAYOUT_4POINT1,
|
||||
.num_ele = { 2, 1, 1, 0 },
|
||||
.pairing = { { 1, 0 }, { 0 }, { 0 }, },
|
||||
.index = { { 0, 0 }, { 1 }, { 2 }, { 0 } },
|
||||
@ -203,7 +203,7 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1, 2, 3, 4 },
|
||||
},
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_2_2,
|
||||
.layout = AV_CHANNEL_LAYOUT_2_2,
|
||||
.num_ele = { 1, 1, 0, 0 },
|
||||
.pairing = { { 1 }, { 1 }, },
|
||||
.index = { { 0 }, { 1 }, },
|
||||
@ -211,7 +211,7 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1, 2, 3 },
|
||||
},
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_QUAD,
|
||||
.layout = AV_CHANNEL_LAYOUT_QUAD,
|
||||
.num_ele = { 1, 0, 1, 0 },
|
||||
.pairing = { { 1 }, { 0 }, { 1 }, },
|
||||
.index = { { 0 }, { 0 }, { 1 } },
|
||||
@ -219,7 +219,7 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1, 2, 3 },
|
||||
},
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_5POINT0,
|
||||
.layout = AV_CHANNEL_LAYOUT_5POINT0,
|
||||
.num_ele = { 2, 1, 0, 0 },
|
||||
.pairing = { { 1, 0 }, { 1 }, },
|
||||
.index = { { 0, 0 }, { 1 } },
|
||||
@ -227,7 +227,7 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1, 2, 3, 4 },
|
||||
},
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_5POINT1,
|
||||
.layout = AV_CHANNEL_LAYOUT_5POINT1,
|
||||
.num_ele = { 2, 1, 1, 0 },
|
||||
.pairing = { { 1, 0 }, { 0 }, { 1 }, },
|
||||
.index = { { 0, 0 }, { 1 }, { 1 } },
|
||||
@ -235,7 +235,7 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1, 2, 3, 4, 5 },
|
||||
},
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_5POINT0_BACK,
|
||||
.layout = AV_CHANNEL_LAYOUT_5POINT0_BACK,
|
||||
.num_ele = { 2, 0, 1, 0 },
|
||||
.pairing = { { 1, 0 }, { 0 }, { 1 } },
|
||||
.index = { { 0, 0 }, { 0 }, { 1 } },
|
||||
@ -243,7 +243,7 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1, 2, 3, 4 },
|
||||
},
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_5POINT1_BACK,
|
||||
.layout = AV_CHANNEL_LAYOUT_5POINT1_BACK,
|
||||
.num_ele = { 2, 1, 1, 0 },
|
||||
.pairing = { { 1, 0 }, { 0 }, { 1 }, },
|
||||
.index = { { 0, 0 }, { 1 }, { 1 } },
|
||||
@ -251,7 +251,7 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1, 2, 3, 4, 5 },
|
||||
},
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_6POINT0,
|
||||
.layout = AV_CHANNEL_LAYOUT_6POINT0,
|
||||
.num_ele = { 2, 1, 1, 0 },
|
||||
.pairing = { { 1, 0 }, { 1 }, { 0 }, },
|
||||
.index = { { 0, 0 }, { 1 }, { 1 } },
|
||||
@ -259,7 +259,7 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1, 2, 3, 4, 5 },
|
||||
},
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_6POINT0_FRONT,
|
||||
.layout = AV_CHANNEL_LAYOUT_6POINT0_FRONT,
|
||||
.num_ele = { 2, 1, 0, 0 },
|
||||
.pairing = { { 1, 1 }, { 1 } },
|
||||
.index = { { 1, 0 }, { 2 }, },
|
||||
@ -267,7 +267,7 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1, 2, 3, 4, 5 },
|
||||
},
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_HEXAGONAL,
|
||||
.layout = AV_CHANNEL_LAYOUT_HEXAGONAL,
|
||||
.num_ele = { 2, 0, 2, 0 },
|
||||
.pairing = { { 1, 0 },{ 0 },{ 1, 0 }, },
|
||||
.index = { { 0, 0 },{ 0 },{ 1, 1 } },
|
||||
@ -275,7 +275,7 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1, 2, 3, 4, 5 },
|
||||
},
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_6POINT1,
|
||||
.layout = AV_CHANNEL_LAYOUT_6POINT1,
|
||||
.num_ele = { 2, 1, 2, 0 },
|
||||
.pairing = { { 1, 0 },{ 0 },{ 1, 0 }, },
|
||||
.index = { { 0, 0 },{ 1 },{ 1, 2 } },
|
||||
@ -283,7 +283,7 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
|
||||
},
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_6POINT1_BACK,
|
||||
.layout = AV_CHANNEL_LAYOUT_6POINT1_BACK,
|
||||
.num_ele = { 2, 1, 2, 0 },
|
||||
.pairing = { { 1, 0 }, { 0 }, { 1, 0 }, },
|
||||
.index = { { 0, 0 }, { 1 }, { 1, 2 } },
|
||||
@ -291,7 +291,7 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
|
||||
},
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_6POINT1_FRONT,
|
||||
.layout = AV_CHANNEL_LAYOUT_6POINT1_FRONT,
|
||||
.num_ele = { 2, 1, 2, 0 },
|
||||
.pairing = { { 1, 0 }, { 0 }, { 1, 0 }, },
|
||||
.index = { { 0, 0 }, { 1 }, { 1, 2 } },
|
||||
@ -299,7 +299,7 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
|
||||
},
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_7POINT0,
|
||||
.layout = AV_CHANNEL_LAYOUT_7POINT0,
|
||||
.num_ele = { 2, 1, 1, 0 },
|
||||
.pairing = { { 1, 0 }, { 1 }, { 1 }, },
|
||||
.index = { { 0, 0 }, { 1 }, { 2 }, },
|
||||
@ -307,7 +307,7 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
|
||||
},
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_7POINT0_FRONT,
|
||||
.layout = AV_CHANNEL_LAYOUT_7POINT0_FRONT,
|
||||
.num_ele = { 2, 1, 1, 0 },
|
||||
.pairing = { { 1, 0 }, { 1 }, { 1 }, },
|
||||
.index = { { 0, 0 }, { 1 }, { 2 }, },
|
||||
@ -315,7 +315,7 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
|
||||
},
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_7POINT1,
|
||||
.layout = AV_CHANNEL_LAYOUT_7POINT1,
|
||||
.num_ele = { 2, 1, 2, 0 },
|
||||
.pairing = { { 1, 0 }, { 0 }, { 1, 1 }, },
|
||||
.index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } },
|
||||
@ -323,7 +323,7 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 },
|
||||
},
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_7POINT1_WIDE,
|
||||
.layout = AV_CHANNEL_LAYOUT_7POINT1_WIDE,
|
||||
.num_ele = { 2, 1, 2, 0 },
|
||||
.pairing = { { 1, 0 }, { 0 },{ 1, 1 }, },
|
||||
.index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } },
|
||||
@ -331,7 +331,7 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 },
|
||||
},
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_7POINT1_WIDE_BACK,
|
||||
.layout = AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK,
|
||||
.num_ele = { 2, 1, 2, 0 },
|
||||
.pairing = { { 1, 0 }, { 0 }, { 1, 1 }, },
|
||||
.index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } },
|
||||
@ -339,7 +339,7 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 },
|
||||
},
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_OCTAGONAL,
|
||||
.layout = AV_CHANNEL_LAYOUT_OCTAGONAL,
|
||||
.num_ele = { 2, 1, 2, 0 },
|
||||
.pairing = { { 1, 0 }, { 1 }, { 1, 0 }, },
|
||||
.index = { { 0, 0 }, { 1 }, { 2, 1 } },
|
||||
@ -347,7 +347,8 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 },
|
||||
},
|
||||
{ /* Meant for order 2/mixed ambisonics */
|
||||
.layout = AV_CH_LAYOUT_OCTAGONAL | AV_CH_TOP_CENTER,
|
||||
.layout = { .order = AV_CHANNEL_ORDER_NATIVE, .nb_channels = 9,
|
||||
.u.mask = AV_CH_LAYOUT_OCTAGONAL | AV_CH_TOP_CENTER },
|
||||
.num_ele = { 2, 2, 2, 0 },
|
||||
.pairing = { { 1, 0 }, { 1, 0 }, { 1, 0 }, },
|
||||
.index = { { 0, 0 }, { 1, 1 }, { 2, 2 } },
|
||||
@ -355,8 +356,9 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7, 8 },
|
||||
},
|
||||
{ /* Meant for order 2/mixed ambisonics */
|
||||
.layout = AV_CH_LAYOUT_6POINT0_FRONT | AV_CH_BACK_CENTER |
|
||||
AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT | AV_CH_TOP_CENTER,
|
||||
.layout = { .order = AV_CHANNEL_ORDER_NATIVE, .nb_channels = 10,
|
||||
.u.mask = AV_CH_LAYOUT_6POINT0_FRONT | AV_CH_BACK_CENTER |
|
||||
AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT | AV_CH_TOP_CENTER },
|
||||
.num_ele = { 2, 2, 2, 0 },
|
||||
.pairing = { { 1, 1 }, { 1, 0 }, { 1, 0 }, },
|
||||
.index = { { 0, 1 }, { 2, 0 }, { 3, 1 } },
|
||||
@ -364,7 +366,7 @@ static const AACPCEInfo aac_pce_configs[] = {
|
||||
.reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 },
|
||||
},
|
||||
{
|
||||
.layout = AV_CH_LAYOUT_HEXADECAGONAL,
|
||||
.layout = AV_CHANNEL_LAYOUT_HEXADECAGONAL,
|
||||
.num_ele = { 4, 2, 4, 0 },
|
||||
.pairing = { { 1, 0, 1, 0 }, { 1, 1 }, { 1, 0, 1, 0 }, },
|
||||
.index = { { 0, 0, 1, 1 }, { 2, 3 }, { 4, 2, 5, 3 } },
|
||||
|
@ -45,14 +45,14 @@ extern const uint8_t *const ff_aac_swb_size_128[];
|
||||
extern const int ff_aac_swb_size_128_len;
|
||||
|
||||
/* Supported layouts without using a PCE */
|
||||
static const int64_t aac_normal_chan_layouts[7] = {
|
||||
AV_CH_LAYOUT_MONO,
|
||||
AV_CH_LAYOUT_STEREO,
|
||||
AV_CH_LAYOUT_SURROUND,
|
||||
AV_CH_LAYOUT_4POINT0,
|
||||
AV_CH_LAYOUT_5POINT0_BACK,
|
||||
AV_CH_LAYOUT_5POINT1_BACK,
|
||||
AV_CH_LAYOUT_7POINT1,
|
||||
static const AVChannelLayout aac_normal_chan_layouts[7] = {
|
||||
AV_CHANNEL_LAYOUT_MONO,
|
||||
AV_CHANNEL_LAYOUT_STEREO,
|
||||
AV_CHANNEL_LAYOUT_SURROUND,
|
||||
AV_CHANNEL_LAYOUT_4POINT0,
|
||||
AV_CHANNEL_LAYOUT_5POINT0_BACK,
|
||||
AV_CHANNEL_LAYOUT_5POINT1_BACK,
|
||||
AV_CHANNEL_LAYOUT_7POINT1,
|
||||
};
|
||||
|
||||
/** default channel configurations */
|
||||
|
@ -78,7 +78,7 @@ static int read_ ## PAR ## _data(AVCodecContext *avctx, GetBitContext *gb, PSCom
|
||||
int8_t (*PAR)[PS_MAX_NR_IIDICC], int table_idx, int e, int dt) \
|
||||
{ \
|
||||
int b, num = ps->nr_ ## PAR ## _par; \
|
||||
VLC_TYPE (*vlc_table)[2] = vlc_ps[table_idx].table; \
|
||||
const VLCElem *vlc_table = vlc_ps[table_idx].table; \
|
||||
if (dt) { \
|
||||
int e_prev = e ? e - 1 : ps->num_env_old - 1; \
|
||||
e_prev = FFMAX(e_prev, 0); \
|
||||
|
@ -221,13 +221,14 @@ av_cold void AAC_RENAME(ff_psdsp_init)(PSDSPContext *s)
|
||||
s->stereo_interpolate[1] = ps_stereo_interpolate_ipdopd_c;
|
||||
|
||||
#if !USE_FIXED
|
||||
if (ARCH_ARM)
|
||||
ff_psdsp_init_arm(s);
|
||||
if (ARCH_AARCH64)
|
||||
ff_psdsp_init_aarch64(s);
|
||||
if (ARCH_MIPS)
|
||||
ff_psdsp_init_mips(s);
|
||||
if (ARCH_X86)
|
||||
ff_psdsp_init_x86(s);
|
||||
#if ARCH_ARM
|
||||
ff_psdsp_init_arm(s);
|
||||
#elif ARCH_AARCH64
|
||||
ff_psdsp_init_aarch64(s);
|
||||
#elif ARCH_MIPS
|
||||
ff_psdsp_init_mips(s);
|
||||
#elif ARCH_X86
|
||||
ff_psdsp_init_x86(s);
|
||||
#endif
|
||||
#endif /* !USE_FIXED */
|
||||
}
|
||||
|
@ -263,13 +263,13 @@ static av_cold void lame_window_init(AacPsyContext *ctx, AVCodecContext *avctx)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < avctx->channels; i++) {
|
||||
for (i = 0; i < avctx->ch_layout.nb_channels; i++) {
|
||||
AacPsyChannel *pch = &ctx->ch[i];
|
||||
|
||||
if (avctx->flags & AV_CODEC_FLAG_QSCALE)
|
||||
pch->attack_threshold = psy_vbr_map[avctx->global_quality / FF_QP2LAMBDA].st_lrm;
|
||||
else
|
||||
pch->attack_threshold = lame_calc_attack_threshold(avctx->bit_rate / avctx->channels / 1000);
|
||||
pch->attack_threshold = lame_calc_attack_threshold(avctx->bit_rate / avctx->ch_layout.nb_channels / 1000);
|
||||
|
||||
for (j = 0; j < AAC_NUM_BLOCKS_SHORT * PSY_LAME_NUM_SUBBLOCKS; j++)
|
||||
pch->prev_energy_subshort[j] = 10.0f;
|
||||
@ -303,7 +303,7 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) {
|
||||
float bark;
|
||||
int i, j, g, start;
|
||||
float prev, minscale, minath, minsnr, pe_min;
|
||||
int chan_bitrate = ctx->avctx->bit_rate / ((ctx->avctx->flags & AV_CODEC_FLAG_QSCALE) ? 2.0f : ctx->avctx->channels);
|
||||
int chan_bitrate = ctx->avctx->bit_rate / ((ctx->avctx->flags & AV_CODEC_FLAG_QSCALE) ? 2.0f : ctx->avctx->ch_layout.nb_channels);
|
||||
|
||||
const int bandwidth = ctx->cutoff ? ctx->cutoff : AAC_CUTOFF(ctx->avctx);
|
||||
const float num_bark = calc_bark((float)bandwidth);
|
||||
@ -370,7 +370,7 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) {
|
||||
}
|
||||
}
|
||||
|
||||
pctx->ch = av_calloc(ctx->avctx->channels, sizeof(*pctx->ch));
|
||||
pctx->ch = av_calloc(ctx->avctx->ch_layout.nb_channels, sizeof(*pctx->ch));
|
||||
if (!pctx->ch) {
|
||||
av_freep(&ctx->model_priv_data);
|
||||
return AVERROR(ENOMEM);
|
||||
|
@ -811,7 +811,7 @@ static int read_sbr_envelope(AACContext *ac, SpectralBandReplication *sbr, GetBi
|
||||
{
|
||||
int bits;
|
||||
int i, j, k;
|
||||
VLC_TYPE (*t_huff)[2], (*f_huff)[2];
|
||||
const VLCElem *t_huff, *f_huff;
|
||||
int t_lav, f_lav;
|
||||
const int delta = (ch == 1 && sbr->bs_coupling == 1) + 1;
|
||||
const int odd = sbr->n[1] & 1;
|
||||
@ -899,7 +899,7 @@ static int read_sbr_noise(AACContext *ac, SpectralBandReplication *sbr, GetBitCo
|
||||
SBRData *ch_data, int ch)
|
||||
{
|
||||
int i, j;
|
||||
VLC_TYPE (*t_huff)[2], (*f_huff)[2];
|
||||
const VLCElem *t_huff, *f_huff;
|
||||
int t_lav, f_lav;
|
||||
int delta = (ch == 1 && sbr->bs_coupling == 1) + 1;
|
||||
|
||||
@ -1573,7 +1573,8 @@ static void aacsbr_func_ptr_init(AACSBRContext *c)
|
||||
c->sbr_hf_inverse_filter = sbr_hf_inverse_filter;
|
||||
|
||||
#if !USE_FIXED
|
||||
if(ARCH_MIPS)
|
||||
ff_aacsbr_func_ptr_init_mips(c);
|
||||
#if ARCH_MIPS
|
||||
ff_aacsbr_func_ptr_init_mips(c);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "config_components.h"
|
||||
#include "libavutil/mem_internal.h"
|
||||
#include "libavutil/thread.h"
|
||||
#include "aac.h"
|
||||
|
@ -7,6 +7,7 @@ OBJS-$(CONFIG_H264PRED) += aarch64/h264pred_init.o
|
||||
OBJS-$(CONFIG_H264QPEL) += aarch64/h264qpel_init_aarch64.o
|
||||
OBJS-$(CONFIG_HPELDSP) += aarch64/hpeldsp_init_aarch64.o
|
||||
OBJS-$(CONFIG_IDCTDSP) += aarch64/idctdsp_init_aarch64.o
|
||||
OBJS-$(CONFIG_ME_CMP) += aarch64/me_cmp_init_aarch64.o
|
||||
OBJS-$(CONFIG_MPEGAUDIODSP) += aarch64/mpegaudiodsp_init.o
|
||||
OBJS-$(CONFIG_NEON_CLOBBER_TEST) += aarch64/neontest.o
|
||||
OBJS-$(CONFIG_PIXBLOCKDSP) += aarch64/pixblockdsp_init_aarch64.o
|
||||
@ -44,10 +45,13 @@ NEON-OBJS-$(CONFIG_H264PRED) += aarch64/h264pred_neon.o
|
||||
NEON-OBJS-$(CONFIG_H264QPEL) += aarch64/h264qpel_neon.o \
|
||||
aarch64/hpeldsp_neon.o
|
||||
NEON-OBJS-$(CONFIG_HPELDSP) += aarch64/hpeldsp_neon.o
|
||||
NEON-OBJS-$(CONFIG_IDCTDSP) += aarch64/simple_idct_neon.o
|
||||
NEON-OBJS-$(CONFIG_IDCTDSP) += aarch64/idctdsp_neon.o \
|
||||
aarch64/simple_idct_neon.o
|
||||
NEON-OBJS-$(CONFIG_MDCT) += aarch64/mdct_neon.o
|
||||
NEON-OBJS-$(CONFIG_ME_CMP) += aarch64/me_cmp_neon.o
|
||||
NEON-OBJS-$(CONFIG_MPEGAUDIODSP) += aarch64/mpegaudiodsp_neon.o
|
||||
NEON-OBJS-$(CONFIG_PIXBLOCKDSP) += aarch64/pixblockdsp_neon.o
|
||||
NEON-OBJS-$(CONFIG_VC1DSP) += aarch64/vc1dsp_neon.o
|
||||
NEON-OBJS-$(CONFIG_VP8DSP) += aarch64/vp8dsp_neon.o
|
||||
|
||||
# decoders/encoders
|
||||
|
@ -341,6 +341,7 @@ endfunc
|
||||
.macro def_fft n, n2, n4
|
||||
function fft\n\()_neon, align=6
|
||||
AARCH64_VALID_JUMP_TARGET
|
||||
AARCH64_SIGN_LINK_REGISTER
|
||||
sub sp, sp, #16
|
||||
stp x28, x30, [sp]
|
||||
add x28, x0, #\n4*2*8
|
||||
@ -351,6 +352,7 @@ function fft\n\()_neon, align=6
|
||||
bl fft\n4\()_neon
|
||||
sub x0, x28, #\n4*2*8
|
||||
ldp x28, x30, [sp], #16
|
||||
AARCH64_VALIDATE_LINK_REGISTER
|
||||
movrel x4, X(ff_cos_\n)
|
||||
mov x2, #\n4>>1
|
||||
b fft_pass_neon
|
||||
|
@ -19,6 +19,8 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "config_components.h"
|
||||
|
||||
#include "libavutil/aarch64/asm.S"
|
||||
|
||||
/* chroma_mc8(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int h, int x, int y) */
|
||||
|
@ -960,117 +960,117 @@ function ff_h264_h_loop_filter_chroma422_neon_10, export=1
|
||||
endfunc
|
||||
|
||||
.macro h264_loop_filter_chroma_intra_10
|
||||
uabd v26.8h, v16.8h, v17.8h // abs(p0 - q0)
|
||||
uabd v27.8h, v18.8h, v16.8h // abs(p1 - p0)
|
||||
uabd v28.8h, v19.8h, v17.8h // abs(q1 - q0)
|
||||
cmhi v26.8h, v30.8h, v26.8h // < alpha
|
||||
cmhi v27.8h, v31.8h, v27.8h // < beta
|
||||
cmhi v28.8h, v31.8h, v28.8h // < beta
|
||||
and v26.16b, v26.16b, v27.16b
|
||||
and v26.16b, v26.16b, v28.16b
|
||||
mov x2, v26.d[0]
|
||||
mov x3, v26.d[1]
|
||||
uabd v26.8h, v16.8h, v17.8h // abs(p0 - q0)
|
||||
uabd v27.8h, v18.8h, v16.8h // abs(p1 - p0)
|
||||
uabd v28.8h, v19.8h, v17.8h // abs(q1 - q0)
|
||||
cmhi v26.8h, v30.8h, v26.8h // < alpha
|
||||
cmhi v27.8h, v31.8h, v27.8h // < beta
|
||||
cmhi v28.8h, v31.8h, v28.8h // < beta
|
||||
and v26.16b, v26.16b, v27.16b
|
||||
and v26.16b, v26.16b, v28.16b
|
||||
mov x2, v26.d[0]
|
||||
mov x3, v26.d[1]
|
||||
|
||||
shl v4.8h, v18.8h, #1
|
||||
shl v6.8h, v19.8h, #1
|
||||
shl v4.8h, v18.8h, #1
|
||||
shl v6.8h, v19.8h, #1
|
||||
|
||||
adds x2, x2, x3
|
||||
b.eq 9f
|
||||
adds x2, x2, x3
|
||||
b.eq 9f
|
||||
|
||||
add v20.8h, v16.8h, v19.8h
|
||||
add v22.8h, v17.8h, v18.8h
|
||||
add v20.8h, v20.8h, v4.8h
|
||||
add v22.8h, v22.8h, v6.8h
|
||||
urshr v24.8h, v20.8h, #2
|
||||
urshr v25.8h, v22.8h, #2
|
||||
bit v16.16b, v24.16b, v26.16b
|
||||
bit v17.16b, v25.16b, v26.16b
|
||||
add v20.8h, v16.8h, v19.8h
|
||||
add v22.8h, v17.8h, v18.8h
|
||||
add v20.8h, v20.8h, v4.8h
|
||||
add v22.8h, v22.8h, v6.8h
|
||||
urshr v24.8h, v20.8h, #2
|
||||
urshr v25.8h, v22.8h, #2
|
||||
bit v16.16b, v24.16b, v26.16b
|
||||
bit v17.16b, v25.16b, v26.16b
|
||||
.endm
|
||||
|
||||
function ff_h264_v_loop_filter_chroma_intra_neon_10, export=1
|
||||
h264_loop_filter_start_intra_10
|
||||
mov x9, x0
|
||||
sub x0, x0, x1, lsl #1
|
||||
ld1 {v18.8h}, [x0], x1
|
||||
ld1 {v17.8h}, [x9], x1
|
||||
ld1 {v16.8h}, [x0], x1
|
||||
ld1 {v19.8h}, [x9]
|
||||
h264_loop_filter_start_intra_10
|
||||
mov x9, x0
|
||||
sub x0, x0, x1, lsl #1
|
||||
ld1 {v18.8h}, [x0], x1
|
||||
ld1 {v17.8h}, [x9], x1
|
||||
ld1 {v16.8h}, [x0], x1
|
||||
ld1 {v19.8h}, [x9]
|
||||
|
||||
h264_loop_filter_chroma_intra_10
|
||||
h264_loop_filter_chroma_intra_10
|
||||
|
||||
sub x0, x9, x1, lsl #1
|
||||
st1 {v16.8h}, [x0], x1
|
||||
st1 {v17.8h}, [x0], x1
|
||||
sub x0, x9, x1, lsl #1
|
||||
st1 {v16.8h}, [x0], x1
|
||||
st1 {v17.8h}, [x0], x1
|
||||
|
||||
9:
|
||||
ret
|
||||
ret
|
||||
endfunc
|
||||
|
||||
function ff_h264_h_loop_filter_chroma_mbaff_intra_neon_10, export=1
|
||||
h264_loop_filter_start_intra_10
|
||||
h264_loop_filter_start_intra_10
|
||||
|
||||
sub x4, x0, #4
|
||||
sub x0, x0, #2
|
||||
add x9, x4, x1, lsl #1
|
||||
ld1 {v18.8h}, [x4], x1
|
||||
ld1 {v17.8h}, [x9], x1
|
||||
ld1 {v16.8h}, [x4], x1
|
||||
ld1 {v19.8h}, [x9], x1
|
||||
sub x4, x0, #4
|
||||
sub x0, x0, #2
|
||||
add x9, x4, x1, lsl #1
|
||||
ld1 {v18.8h}, [x4], x1
|
||||
ld1 {v17.8h}, [x9], x1
|
||||
ld1 {v16.8h}, [x4], x1
|
||||
ld1 {v19.8h}, [x9], x1
|
||||
|
||||
transpose_4x8H v18, v16, v17, v19, v26, v27, v28, v29
|
||||
transpose_4x8H v18, v16, v17, v19, v26, v27, v28, v29
|
||||
|
||||
h264_loop_filter_chroma_intra_10
|
||||
h264_loop_filter_chroma_intra_10
|
||||
|
||||
st2 {v16.h,v17.h}[0], [x0], x1
|
||||
st2 {v16.h,v17.h}[1], [x0], x1
|
||||
st2 {v16.h,v17.h}[2], [x0], x1
|
||||
st2 {v16.h,v17.h}[3], [x0], x1
|
||||
st2 {v16.h,v17.h}[0], [x0], x1
|
||||
st2 {v16.h,v17.h}[1], [x0], x1
|
||||
st2 {v16.h,v17.h}[2], [x0], x1
|
||||
st2 {v16.h,v17.h}[3], [x0], x1
|
||||
|
||||
9:
|
||||
ret
|
||||
ret
|
||||
endfunc
|
||||
|
||||
function ff_h264_h_loop_filter_chroma_intra_neon_10, export=1
|
||||
h264_loop_filter_start_intra_10
|
||||
sub x4, x0, #4
|
||||
sub x0, x0, #2
|
||||
h264_loop_filter_start_intra_10
|
||||
sub x4, x0, #4
|
||||
sub x0, x0, #2
|
||||
h_loop_filter_chroma420_intra_10:
|
||||
add x9, x4, x1, lsl #2
|
||||
ld1 {v18.4h}, [x4], x1
|
||||
ld1 {v18.d}[1], [x9], x1
|
||||
ld1 {v16.4h}, [x4], x1
|
||||
ld1 {v16.d}[1], [x9], x1
|
||||
ld1 {v17.4h}, [x4], x1
|
||||
ld1 {v17.d}[1], [x9], x1
|
||||
ld1 {v19.4h}, [x4], x1
|
||||
ld1 {v19.d}[1], [x9], x1
|
||||
add x9, x4, x1, lsl #2
|
||||
ld1 {v18.4h}, [x4], x1
|
||||
ld1 {v18.d}[1], [x9], x1
|
||||
ld1 {v16.4h}, [x4], x1
|
||||
ld1 {v16.d}[1], [x9], x1
|
||||
ld1 {v17.4h}, [x4], x1
|
||||
ld1 {v17.d}[1], [x9], x1
|
||||
ld1 {v19.4h}, [x4], x1
|
||||
ld1 {v19.d}[1], [x9], x1
|
||||
|
||||
transpose_4x8H v18, v16, v17, v19, v26, v27, v28, v29
|
||||
transpose_4x8H v18, v16, v17, v19, v26, v27, v28, v29
|
||||
|
||||
h264_loop_filter_chroma_intra_10
|
||||
h264_loop_filter_chroma_intra_10
|
||||
|
||||
st2 {v16.h,v17.h}[0], [x0], x1
|
||||
st2 {v16.h,v17.h}[1], [x0], x1
|
||||
st2 {v16.h,v17.h}[2], [x0], x1
|
||||
st2 {v16.h,v17.h}[3], [x0], x1
|
||||
st2 {v16.h,v17.h}[4], [x0], x1
|
||||
st2 {v16.h,v17.h}[5], [x0], x1
|
||||
st2 {v16.h,v17.h}[6], [x0], x1
|
||||
st2 {v16.h,v17.h}[7], [x0], x1
|
||||
st2 {v16.h,v17.h}[0], [x0], x1
|
||||
st2 {v16.h,v17.h}[1], [x0], x1
|
||||
st2 {v16.h,v17.h}[2], [x0], x1
|
||||
st2 {v16.h,v17.h}[3], [x0], x1
|
||||
st2 {v16.h,v17.h}[4], [x0], x1
|
||||
st2 {v16.h,v17.h}[5], [x0], x1
|
||||
st2 {v16.h,v17.h}[6], [x0], x1
|
||||
st2 {v16.h,v17.h}[7], [x0], x1
|
||||
|
||||
9:
|
||||
ret
|
||||
ret
|
||||
endfunc
|
||||
|
||||
function ff_h264_h_loop_filter_chroma422_intra_neon_10, export=1
|
||||
h264_loop_filter_start_intra_10
|
||||
sub x4, x0, #4
|
||||
add x5, x0, x1, lsl #3
|
||||
sub x0, x0, #2
|
||||
mov x7, x30
|
||||
bl h_loop_filter_chroma420_intra_10
|
||||
mov x4, x9
|
||||
sub x0, x5, #2
|
||||
mov x30, x7
|
||||
b h_loop_filter_chroma420_intra_10
|
||||
h264_loop_filter_start_intra_10
|
||||
sub x4, x0, #4
|
||||
add x5, x0, x1, lsl #3
|
||||
sub x0, x0, #2
|
||||
mov x7, x30
|
||||
bl h_loop_filter_chroma420_intra_10
|
||||
mov x4, x9
|
||||
sub x0, x5, #2
|
||||
mov x30, x7
|
||||
b h_loop_filter_chroma420_intra_10
|
||||
endfunc
|
||||
|
@ -57,8 +57,10 @@ void ff_hevc_sao_band_filter_8x8_8_neon(uint8_t *_dst, uint8_t *_src,
|
||||
ptrdiff_t stride_dst, ptrdiff_t stride_src,
|
||||
int16_t *sao_offset_val, int sao_left_class,
|
||||
int width, int height);
|
||||
|
||||
|
||||
void ff_hevc_sao_edge_filter_16x16_8_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride_dst,
|
||||
int16_t *sao_offset_val, int eo, int width, int height);
|
||||
void ff_hevc_sao_edge_filter_8x8_8_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride_dst,
|
||||
int16_t *sao_offset_val, int eo, int width, int height);
|
||||
|
||||
av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth)
|
||||
{
|
||||
@ -75,11 +77,16 @@ av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth)
|
||||
c->idct_dc[1] = ff_hevc_idct_8x8_dc_8_neon;
|
||||
c->idct_dc[2] = ff_hevc_idct_16x16_dc_8_neon;
|
||||
c->idct_dc[3] = ff_hevc_idct_32x32_dc_8_neon;
|
||||
// This function is disabled, as it doesn't handle widths that aren't
|
||||
// an even multiple of 8 correctly. fate-hevc doesn't exercise that
|
||||
// for the current size, but if enabled for bigger sizes, the cases
|
||||
// of non-multiple of 8 seem to arise.
|
||||
// c->sao_band_filter[0] = ff_hevc_sao_band_filter_8x8_8_neon;
|
||||
c->sao_band_filter[0] =
|
||||
c->sao_band_filter[1] =
|
||||
c->sao_band_filter[2] =
|
||||
c->sao_band_filter[3] =
|
||||
c->sao_band_filter[4] = ff_hevc_sao_band_filter_8x8_8_neon;
|
||||
c->sao_edge_filter[0] = ff_hevc_sao_edge_filter_8x8_8_neon;
|
||||
c->sao_edge_filter[1] =
|
||||
c->sao_edge_filter[2] =
|
||||
c->sao_edge_filter[3] =
|
||||
c->sao_edge_filter[4] = ff_hevc_sao_edge_filter_16x16_8_neon;
|
||||
}
|
||||
if (bit_depth == 10) {
|
||||
c->add_residual[0] = ff_hevc_add_residual_4x4_10_neon;
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* AArch64 NEON optimised SAO functions for HEVC decoding
|
||||
*
|
||||
* Copyright (c) 2020 Josh Dekker <josh@itanimul.li>
|
||||
* Copyright (c) 2022 J. Dekker <jdek@itanimul.li>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
@ -24,30 +24,35 @@
|
||||
|
||||
#include "libavutil/aarch64/asm.S"
|
||||
|
||||
#define MAX_PB_SIZE 64
|
||||
#define AV_INPUT_BUFFER_PADDING_SIZE 64
|
||||
#define SAO_STRIDE (2*MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE)
|
||||
|
||||
// void sao_band_filter(uint8_t *_dst, uint8_t *_src,
|
||||
// ptrdiff_t stride_dst, ptrdiff_t stride_src,
|
||||
// int16_t *sao_offset_val, int sao_left_class,
|
||||
// int width, int height)
|
||||
function ff_hevc_sao_band_filter_8x8_8_neon, export=1
|
||||
sub sp, sp, #64
|
||||
stp xzr, xzr, [sp]
|
||||
stp xzr, xzr, [sp, #16]
|
||||
stp xzr, xzr, [sp, #32]
|
||||
stp xzr, xzr, [sp, #48]
|
||||
stp xzr, xzr, [sp]
|
||||
stp xzr, xzr, [sp, #16]
|
||||
stp xzr, xzr, [sp, #32]
|
||||
stp xzr, xzr, [sp, #48]
|
||||
mov w8, #4
|
||||
0:
|
||||
ldrsh x9, [x4, x8, lsl #1] // x9 = sao_offset_val[k+1]
|
||||
0: ldrsh x9, [x4, x8, lsl #1] // sao_offset_val[k+1]
|
||||
subs w8, w8, #1
|
||||
add w10, w8, w5 // x10 = k + sao_left_class
|
||||
and w10, w10, #0x1F
|
||||
add w10, w8, w5 // k + sao_left_class
|
||||
and w10, w10, #0x1F
|
||||
strh w9, [sp, x10, lsl #1]
|
||||
bne 0b
|
||||
ld1 {v16.16b-v19.16b}, [sp], #64
|
||||
movi v20.8h, #1
|
||||
1: // beginning of line
|
||||
mov w8, w6
|
||||
2:
|
||||
// Simple layout for accessing 16bit values
|
||||
add w6, w6, #7
|
||||
bic w6, w6, #7
|
||||
ld1 {v16.16b-v19.16b}, [sp], #64
|
||||
sub x2, x2, x6
|
||||
sub x3, x3, x6
|
||||
movi v20.8h, #1
|
||||
1: mov w8, w6 // beginning of line
|
||||
2: // Simple layout for accessing 16bit values
|
||||
// with 8bit LUT.
|
||||
//
|
||||
// 00 01 02 03 04 05 06 07
|
||||
@ -55,33 +60,138 @@ function ff_hevc_sao_band_filter_8x8_8_neon, export=1
|
||||
// |xDE#xAD|xCA#xFE|xBE#xEF|xFE#xED|....
|
||||
// +----------------------------------->
|
||||
// i-0 i-1 i-2 i-3
|
||||
// dst[x] = av_clip_pixel(src[x] + offset_table[src[x] >> shift]);
|
||||
ld1 {v2.8b}, [x1]
|
||||
// load src[x]
|
||||
uxtl v0.8h, v2.8b
|
||||
// >> shift
|
||||
ushr v2.8h, v0.8h, #3 // BIT_DEPTH - 3
|
||||
// x2 (access lower short)
|
||||
shl v1.8h, v2.8h, #1 // low (x2, accessing short)
|
||||
// +1 access upper short
|
||||
add v3.8h, v1.8h, v20.8h
|
||||
// shift insert index to upper byte
|
||||
sli v1.8h, v3.8h, #8
|
||||
// table
|
||||
tbx v2.16b, {v16.16b-v19.16b}, v1.16b
|
||||
// src[x] + table
|
||||
add v1.8h, v0.8h, v2.8h
|
||||
// clip + narrow
|
||||
sqxtun v4.8b, v1.8h
|
||||
// store
|
||||
st1 {v4.8b}, [x0]
|
||||
// done 8 pixels
|
||||
ld1 {v2.8b}, [x1], #8 // dst[x] = av_clip_pixel(src[x] + offset_table[src[x] >> shift]);
|
||||
subs w8, w8, #8
|
||||
uxtl v0.8h, v2.8b // load src[x]
|
||||
ushr v2.8h, v0.8h, #3 // >> BIT_DEPTH - 3
|
||||
shl v1.8h, v2.8h, #1 // low (x2, accessing short)
|
||||
add v3.8h, v1.8h, v20.8h // +1 access upper short
|
||||
sli v1.8h, v3.8h, #8 // shift insert index to upper byte
|
||||
tbx v2.16b, {v16.16b-v19.16b}, v1.16b // table
|
||||
add v1.8h, v0.8h, v2.8h // src[x] + table
|
||||
sqxtun v4.8b, v1.8h // clip + narrow
|
||||
st1 {v4.8b}, [x0], #8 // store
|
||||
// done 8 pixels
|
||||
bne 2b
|
||||
// finished line
|
||||
subs w7, w7, #1
|
||||
add x0, x0, x2 // dst += stride_dst
|
||||
add x1, x1, x3 // src += stride_src
|
||||
subs w7, w7, #1 // finished line, prep. new
|
||||
add x0, x0, x2 // dst += stride_dst
|
||||
add x1, x1, x3 // src += stride_src
|
||||
bne 1b
|
||||
ret
|
||||
endfunc
|
||||
|
||||
.Lsao_edge_pos:
|
||||
.word 1 // horizontal
|
||||
.word SAO_STRIDE // vertical
|
||||
.word SAO_STRIDE + 1 // 45 degree
|
||||
.word SAO_STRIDE - 1 // 135 degree
|
||||
|
||||
// ff_hevc_sao_edge_filter_16x16_8_neon(char *dst, char *src, ptrdiff stride_dst,
|
||||
// int16 *sao_offset_val, int eo, int width, int height)
|
||||
function ff_hevc_sao_edge_filter_16x16_8_neon, export=1
|
||||
adr x7, .Lsao_edge_pos
|
||||
ld1 {v3.8h}, [x3] // load sao_offset_val
|
||||
add w5, w5, #0xF
|
||||
bic w5, w5, #0xF
|
||||
ldr w4, [x7, w4, uxtw #2] // stride_src
|
||||
mov v3.h[7], v3.h[0] // reorder to [1,2,0,3,4]
|
||||
mov v3.h[0], v3.h[1]
|
||||
mov v3.h[1], v3.h[2]
|
||||
mov v3.h[2], v3.h[7]
|
||||
// split 16bit values into two tables
|
||||
uzp2 v1.16b, v3.16b, v3.16b // sao_offset_val -> upper
|
||||
uzp1 v0.16b, v3.16b, v3.16b // sao_offset_val -> lower
|
||||
movi v2.16b, #2
|
||||
mov x15, #SAO_STRIDE
|
||||
// strides between end of line and next src/dst
|
||||
sub x15, x15, x5 // stride_src - width
|
||||
sub x16, x2, x5 // stride_dst - width
|
||||
mov x11, x1 // copy base src
|
||||
1: // new line
|
||||
mov x14, x5 // copy width
|
||||
sub x12, x11, x4 // src_a (prev) = src - sao_edge_pos
|
||||
add x13, x11, x4 // src_b (next) = src + sao_edge_pos
|
||||
2: // process 16 bytes
|
||||
ld1 {v3.16b}, [x11], #16 // load src
|
||||
ld1 {v4.16b}, [x12], #16 // load src_a (prev)
|
||||
ld1 {v5.16b}, [x13], #16 // load src_b (next)
|
||||
subs x14, x14, #16
|
||||
cmhi v16.16b, v4.16b, v3.16b // (prev > cur)
|
||||
cmhi v17.16b, v3.16b, v4.16b // (cur > prev)
|
||||
cmhi v18.16b, v5.16b, v3.16b // (next > cur)
|
||||
cmhi v19.16b, v3.16b, v5.16b // (cur > next)
|
||||
sub v20.16b, v16.16b, v17.16b // diff0 = CMP(cur, prev) = (cur > prev) - (cur < prev)
|
||||
sub v21.16b, v18.16b, v19.16b // diff1 = CMP(cur, next) = (cur > next) - (cur < next)
|
||||
add v20.16b, v20.16b, v21.16b // diff = diff0 + diff1
|
||||
add v20.16b, v20.16b, v2.16b // offset_val = diff + 2
|
||||
tbl v16.16b, {v0.16b}, v20.16b
|
||||
tbl v17.16b, {v1.16b}, v20.16b
|
||||
uxtl v20.8h, v3.8b // src[0:7]
|
||||
uxtl2 v21.8h, v3.16b // src[7:15]
|
||||
zip1 v18.16b, v16.16b, v17.16b // sao_offset_val lower ->
|
||||
zip2 v19.16b, v16.16b, v17.16b // sao_offset_val upper ->
|
||||
sqadd v20.8h, v18.8h, v20.8h // + sao_offset_val
|
||||
sqadd v21.8h, v19.8h, v21.8h
|
||||
sqxtun v3.8b, v20.8h
|
||||
sqxtun2 v3.16b, v21.8h
|
||||
st1 {v3.16b}, [x0], #16
|
||||
// filtered 16 bytes
|
||||
b.ne 2b // do we have width to filter?
|
||||
// no width to filter, setup next line
|
||||
subs w6, w6, #1 // filtered line
|
||||
add x11, x11, x15 // stride src to next line
|
||||
add x0, x0, x16 // stride dst to next line
|
||||
b.ne 1b // do we have lines to process?
|
||||
// no lines to filter
|
||||
ret
|
||||
endfunc
|
||||
|
||||
// ff_hevc_sao_edge_filter_8x8_8_neon(char *dst, char *src, ptrdiff stride_dst,
|
||||
// int16 *sao_offset_val, int eo, int width, int height)
|
||||
function ff_hevc_sao_edge_filter_8x8_8_neon, export=1
|
||||
adr x7, .Lsao_edge_pos
|
||||
ldr w4, [x7, w4, uxtw #2]
|
||||
ld1 {v3.8h}, [x3]
|
||||
mov v3.h[7], v3.h[0]
|
||||
mov v3.h[0], v3.h[1]
|
||||
mov v3.h[1], v3.h[2]
|
||||
mov v3.h[2], v3.h[7]
|
||||
uzp2 v1.16b, v3.16b, v3.16b
|
||||
uzp1 v0.16b, v3.16b, v3.16b
|
||||
movi v2.16b, #2
|
||||
add x16, x0, x2
|
||||
lsl x2, x2, #1
|
||||
mov x15, #SAO_STRIDE
|
||||
mov x8, x1
|
||||
sub x9, x1, x4
|
||||
add x10, x1, x4
|
||||
1: ld1 {v3.d}[0], [ x8], x15
|
||||
ld1 {v4.d}[0], [ x9], x15
|
||||
ld1 {v5.d}[0], [x10], x15
|
||||
ld1 {v3.d}[1], [ x8], x15
|
||||
ld1 {v4.d}[1], [ x9], x15
|
||||
ld1 {v5.d}[1], [x10], x15
|
||||
subs w6, w6, #2
|
||||
cmhi v16.16b, v4.16b, v3.16b
|
||||
cmhi v17.16b, v3.16b, v4.16b
|
||||
cmhi v18.16b, v5.16b, v3.16b
|
||||
cmhi v19.16b, v3.16b, v5.16b
|
||||
sub v20.16b, v16.16b, v17.16b
|
||||
sub v21.16b, v18.16b, v19.16b
|
||||
add v20.16b, v20.16b, v21.16b
|
||||
add v20.16b, v20.16b, v2.16b
|
||||
tbl v16.16b, {v0.16b}, v20.16b
|
||||
tbl v17.16b, {v1.16b}, v20.16b
|
||||
uxtl v20.8h, v3.8b
|
||||
uxtl2 v21.8h, v3.16b
|
||||
zip1 v18.16b, v16.16b, v17.16b
|
||||
zip2 v19.16b, v16.16b, v17.16b
|
||||
sqadd v20.8h, v18.8h, v20.8h
|
||||
sqadd v21.8h, v19.8h, v21.8h
|
||||
sqxtun v6.8b, v20.8h
|
||||
sqxtun v7.8b, v21.8h
|
||||
st1 {v6.8b}, [ x0], x2
|
||||
st1 {v7.8b}, [x16], x2
|
||||
b.ne 1b
|
||||
ret
|
||||
endfunc
|
||||
|
@ -19,6 +19,7 @@
|
||||
#ifndef AVCODEC_AARCH64_IDCT_H
|
||||
#define AVCODEC_AARCH64_IDCT_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
void ff_simple_idct_neon(int16_t *data);
|
||||
|
@ -27,19 +27,29 @@
|
||||
#include "libavcodec/idctdsp.h"
|
||||
#include "idct.h"
|
||||
|
||||
void ff_put_pixels_clamped_neon(const int16_t *, uint8_t *, ptrdiff_t);
|
||||
void ff_put_signed_pixels_clamped_neon(const int16_t *, uint8_t *, ptrdiff_t);
|
||||
void ff_add_pixels_clamped_neon(const int16_t *, uint8_t *, ptrdiff_t);
|
||||
|
||||
av_cold void ff_idctdsp_init_aarch64(IDCTDSPContext *c, AVCodecContext *avctx,
|
||||
unsigned high_bit_depth)
|
||||
{
|
||||
int cpu_flags = av_get_cpu_flags();
|
||||
|
||||
if (have_neon(cpu_flags) && !avctx->lowres && !high_bit_depth) {
|
||||
if (avctx->idct_algo == FF_IDCT_AUTO ||
|
||||
avctx->idct_algo == FF_IDCT_SIMPLEAUTO ||
|
||||
avctx->idct_algo == FF_IDCT_SIMPLENEON) {
|
||||
c->idct_put = ff_simple_idct_put_neon;
|
||||
c->idct_add = ff_simple_idct_add_neon;
|
||||
c->idct = ff_simple_idct_neon;
|
||||
c->perm_type = FF_IDCT_PERM_PARTTRANS;
|
||||
if (have_neon(cpu_flags)) {
|
||||
if (!avctx->lowres && !high_bit_depth) {
|
||||
if (avctx->idct_algo == FF_IDCT_AUTO ||
|
||||
avctx->idct_algo == FF_IDCT_SIMPLEAUTO ||
|
||||
avctx->idct_algo == FF_IDCT_SIMPLENEON) {
|
||||
c->idct_put = ff_simple_idct_put_neon;
|
||||
c->idct_add = ff_simple_idct_add_neon;
|
||||
c->idct = ff_simple_idct_neon;
|
||||
c->perm_type = FF_IDCT_PERM_PARTTRANS;
|
||||
}
|
||||
}
|
||||
|
||||
c->add_pixels_clamped = ff_add_pixels_clamped_neon;
|
||||
c->put_pixels_clamped = ff_put_pixels_clamped_neon;
|
||||
c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_neon;
|
||||
}
|
||||
}
|
||||
|
130
libavcodec/aarch64/idctdsp_neon.S
Normal file
130
libavcodec/aarch64/idctdsp_neon.S
Normal file
@ -0,0 +1,130 @@
|
||||
/*
|
||||
* IDCT AArch64 NEON optimisations
|
||||
*
|
||||
* Copyright (c) 2022 Ben Avison <bavison@riscosopen.org>
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include "libavutil/aarch64/asm.S"
|
||||
|
||||
// Clamp 16-bit signed block coefficients to unsigned 8-bit
|
||||
// On entry:
|
||||
// x0 -> array of 64x 16-bit coefficients
|
||||
// x1 -> 8-bit results
|
||||
// x2 = row stride for results, bytes
|
||||
function ff_put_pixels_clamped_neon, export=1
|
||||
ld1 {v0.16b, v1.16b, v2.16b, v3.16b}, [x0], #64
|
||||
ld1 {v4.16b, v5.16b, v6.16b, v7.16b}, [x0]
|
||||
sqxtun v0.8b, v0.8h
|
||||
sqxtun v1.8b, v1.8h
|
||||
sqxtun v2.8b, v2.8h
|
||||
sqxtun v3.8b, v3.8h
|
||||
sqxtun v4.8b, v4.8h
|
||||
st1 {v0.8b}, [x1], x2
|
||||
sqxtun v0.8b, v5.8h
|
||||
st1 {v1.8b}, [x1], x2
|
||||
sqxtun v1.8b, v6.8h
|
||||
st1 {v2.8b}, [x1], x2
|
||||
sqxtun v2.8b, v7.8h
|
||||
st1 {v3.8b}, [x1], x2
|
||||
st1 {v4.8b}, [x1], x2
|
||||
st1 {v0.8b}, [x1], x2
|
||||
st1 {v1.8b}, [x1], x2
|
||||
st1 {v2.8b}, [x1]
|
||||
ret
|
||||
endfunc
|
||||
|
||||
// Clamp 16-bit signed block coefficients to signed 8-bit (biased by 128)
|
||||
// On entry:
|
||||
// x0 -> array of 64x 16-bit coefficients
|
||||
// x1 -> 8-bit results
|
||||
// x2 = row stride for results, bytes
|
||||
function ff_put_signed_pixels_clamped_neon, export=1
|
||||
ld1 {v0.16b, v1.16b, v2.16b, v3.16b}, [x0], #64
|
||||
movi v4.8b, #128
|
||||
ld1 {v16.16b, v17.16b, v18.16b, v19.16b}, [x0]
|
||||
sqxtn v0.8b, v0.8h
|
||||
sqxtn v1.8b, v1.8h
|
||||
sqxtn v2.8b, v2.8h
|
||||
sqxtn v3.8b, v3.8h
|
||||
sqxtn v5.8b, v16.8h
|
||||
add v0.8b, v0.8b, v4.8b
|
||||
sqxtn v6.8b, v17.8h
|
||||
add v1.8b, v1.8b, v4.8b
|
||||
sqxtn v7.8b, v18.8h
|
||||
add v2.8b, v2.8b, v4.8b
|
||||
sqxtn v16.8b, v19.8h
|
||||
add v3.8b, v3.8b, v4.8b
|
||||
st1 {v0.8b}, [x1], x2
|
||||
add v0.8b, v5.8b, v4.8b
|
||||
st1 {v1.8b}, [x1], x2
|
||||
add v1.8b, v6.8b, v4.8b
|
||||
st1 {v2.8b}, [x1], x2
|
||||
add v2.8b, v7.8b, v4.8b
|
||||
st1 {v3.8b}, [x1], x2
|
||||
add v3.8b, v16.8b, v4.8b
|
||||
st1 {v0.8b}, [x1], x2
|
||||
st1 {v1.8b}, [x1], x2
|
||||
st1 {v2.8b}, [x1], x2
|
||||
st1 {v3.8b}, [x1]
|
||||
ret
|
||||
endfunc
|
||||
|
||||
// Add 16-bit signed block coefficients to unsigned 8-bit
|
||||
// On entry:
|
||||
// x0 -> array of 64x 16-bit coefficients
|
||||
// x1 -> 8-bit input and results
|
||||
// x2 = row stride for 8-bit input and results, bytes
|
||||
function ff_add_pixels_clamped_neon, export=1
|
||||
ld1 {v0.16b, v1.16b, v2.16b, v3.16b}, [x0], #64
|
||||
mov x3, x1
|
||||
ld1 {v4.8b}, [x1], x2
|
||||
ld1 {v5.8b}, [x1], x2
|
||||
ld1 {v6.8b}, [x1], x2
|
||||
ld1 {v7.8b}, [x1], x2
|
||||
ld1 {v16.16b, v17.16b, v18.16b, v19.16b}, [x0]
|
||||
uaddw v0.8h, v0.8h, v4.8b
|
||||
uaddw v1.8h, v1.8h, v5.8b
|
||||
uaddw v2.8h, v2.8h, v6.8b
|
||||
ld1 {v4.8b}, [x1], x2
|
||||
uaddw v3.8h, v3.8h, v7.8b
|
||||
ld1 {v5.8b}, [x1], x2
|
||||
sqxtun v0.8b, v0.8h
|
||||
ld1 {v6.8b}, [x1], x2
|
||||
sqxtun v1.8b, v1.8h
|
||||
ld1 {v7.8b}, [x1]
|
||||
sqxtun v2.8b, v2.8h
|
||||
sqxtun v3.8b, v3.8h
|
||||
uaddw v4.8h, v16.8h, v4.8b
|
||||
st1 {v0.8b}, [x3], x2
|
||||
uaddw v0.8h, v17.8h, v5.8b
|
||||
st1 {v1.8b}, [x3], x2
|
||||
uaddw v1.8h, v18.8h, v6.8b
|
||||
st1 {v2.8b}, [x3], x2
|
||||
uaddw v2.8h, v19.8h, v7.8b
|
||||
sqxtun v4.8b, v4.8h
|
||||
sqxtun v0.8b, v0.8h
|
||||
st1 {v3.8b}, [x3], x2
|
||||
sqxtun v1.8b, v1.8h
|
||||
sqxtun v2.8b, v2.8h
|
||||
st1 {v4.8b}, [x3], x2
|
||||
st1 {v0.8b}, [x3], x2
|
||||
st1 {v1.8b}, [x3], x2
|
||||
st1 {v2.8b}, [x3]
|
||||
ret
|
||||
endfunc
|
@ -25,6 +25,7 @@
|
||||
function ff_imdct_half_neon, export=1
|
||||
sub sp, sp, #32
|
||||
stp x19, x20, [sp]
|
||||
AARCH64_SIGN_LINK_REGISTER
|
||||
str x30, [sp, #16]
|
||||
mov x12, #1
|
||||
ldr w14, [x0, #28] // mdct_bits
|
||||
@ -121,6 +122,7 @@ function ff_imdct_half_neon, export=1
|
||||
|
||||
ldp x19, x20, [sp]
|
||||
ldr x30, [sp, #16]
|
||||
AARCH64_VALIDATE_LINK_REGISTER
|
||||
add sp, sp, #32
|
||||
|
||||
ret
|
||||
@ -129,6 +131,7 @@ endfunc
|
||||
function ff_imdct_calc_neon, export=1
|
||||
sub sp, sp, #32
|
||||
stp x19, x20, [sp]
|
||||
AARCH64_SIGN_LINK_REGISTER
|
||||
str x30, [sp, #16]
|
||||
ldr w3, [x0, #28] // mdct_bits
|
||||
mov x19, #1
|
||||
@ -160,8 +163,10 @@ function ff_imdct_calc_neon, export=1
|
||||
subs x19, x19, #16
|
||||
b.gt 1b
|
||||
|
||||
ldp x19, x20, [sp], #16
|
||||
ldr x30, [sp], #16
|
||||
ldp x19, x20, [sp]
|
||||
ldr x30, [sp, #16]
|
||||
AARCH64_VALIDATE_LINK_REGISTER
|
||||
add sp, sp, #32
|
||||
|
||||
ret
|
||||
endfunc
|
||||
@ -170,6 +175,7 @@ endfunc
|
||||
function ff_mdct_calc_neon, export=1
|
||||
sub sp, sp, #32
|
||||
stp x19, x20, [sp]
|
||||
AARCH64_SIGN_LINK_REGISTER
|
||||
str x30, [sp, #16]
|
||||
|
||||
mov x12, #1
|
||||
@ -317,7 +323,10 @@ function ff_mdct_calc_neon, export=1
|
||||
st2 {v4.2s,v5.2s}, [x0]
|
||||
st2 {v6.2s,v7.2s}, [x8]
|
||||
|
||||
ldp x19, x20, [sp], #16
|
||||
ldr x30, [sp], #16
|
||||
ldp x19, x20, [sp]
|
||||
ldr x30, [sp, #16]
|
||||
AARCH64_VALIDATE_LINK_REGISTER
|
||||
add sp, sp, #32
|
||||
|
||||
ret
|
||||
endfunc
|
||||
|
41
libavcodec/aarch64/me_cmp_init_aarch64.c
Normal file
41
libavcodec/aarch64/me_cmp_init_aarch64.c
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "libavutil/attributes.h"
|
||||
#include "libavutil/aarch64/cpu.h"
|
||||
#include "libavcodec/mpegvideo.h"
|
||||
|
||||
int ff_pix_abs16_neon(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2,
|
||||
ptrdiff_t stride, int h);
|
||||
int ff_pix_abs16_xy2_neon(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2,
|
||||
ptrdiff_t stride, int h);
|
||||
|
||||
av_cold void ff_me_cmp_init_aarch64(MECmpContext *c, AVCodecContext *avctx)
|
||||
{
|
||||
int cpu_flags = av_get_cpu_flags();
|
||||
|
||||
if (have_neon(cpu_flags)) {
|
||||
c->pix_abs[0][0] = ff_pix_abs16_neon;
|
||||
c->pix_abs[0][3] = ff_pix_abs16_xy2_neon;
|
||||
|
||||
c->sad[0] = ff_pix_abs16_neon;
|
||||
}
|
||||
}
|
205
libavcodec/aarch64/me_cmp_neon.S
Normal file
205
libavcodec/aarch64/me_cmp_neon.S
Normal file
@ -0,0 +1,205 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Jonathan Swinney <jswinney@amazon.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
|
||||
*/
|
||||
|
||||
#include "libavutil/aarch64/asm.S"
|
||||
|
||||
function ff_pix_abs16_neon, export=1
|
||||
// x0 unused
|
||||
// x1 uint8_t *pix1
|
||||
// x2 uint8_t *pix2
|
||||
// x3 ptrdiff_t stride
|
||||
// w4 int h
|
||||
cmp w4, #4 // if h < 4, jump to completion section
|
||||
movi v18.4S, #0 // clear result accumulator
|
||||
b.lt 2f
|
||||
1:
|
||||
ld1 {v0.16b}, [x1], x3 // load pix1
|
||||
ld1 {v4.16b}, [x2], x3 // load pix2
|
||||
ld1 {v1.16b}, [x1], x3 // load pix1
|
||||
ld1 {v5.16b}, [x2], x3 // load pix2
|
||||
uabdl v16.8h, v0.8b, v4.8b // absolute difference accumulate
|
||||
uabdl2 v17.8h, v0.16b, v4.16b
|
||||
ld1 {v2.16b}, [x1], x3 // load pix1
|
||||
ld1 {v6.16b}, [x2], x3 // load pix2
|
||||
uabal v16.8h, v1.8b, v5.8b // absolute difference accumulate
|
||||
uabal2 v17.8h, v1.16b, v5.16b
|
||||
ld1 {v3.16b}, [x1], x3
|
||||
ld1 {v7.16b}, [x2], x3
|
||||
uabal v16.8h, v2.8b, v6.8b
|
||||
uabal2 v17.8h, v2.16b, v6.16b
|
||||
sub w4, w4, #4 // h -= 4
|
||||
uabal v16.8h, v3.8b, v7.8b
|
||||
uabal2 v17.8h, v3.16b, v7.16b
|
||||
cmp w4, #4 // if h >= 4, loop
|
||||
add v16.8h, v16.8h, v17.8h
|
||||
uaddlv s16, v16.8h // add up everything in v16 accumulator
|
||||
add d18, d16, d18 // add to the end result register
|
||||
|
||||
b.ge 1b
|
||||
cbnz w4, 2f // if iterations remain, jump to completion section
|
||||
|
||||
fmov w0, s18 // copy result to general purpose register
|
||||
ret
|
||||
|
||||
2:
|
||||
ld1 {v0.16b}, [x1], x3 // load pix1
|
||||
ld1 {v4.16b}, [x2], x3 // load pix2
|
||||
uabdl v16.8h, v0.8b, v4.8b // absolute difference accumulate
|
||||
uabal2 v16.8h, v0.16b, v4.16b
|
||||
subs w4, w4, #1 // h -= 1
|
||||
addv h16, v16.8h // add up v16
|
||||
add d18, d16, d18 // add to result
|
||||
b.ne 2b
|
||||
|
||||
fmov w0, s18 // copy result to general purpose register
|
||||
ret
|
||||
endfunc
|
||||
|
||||
function ff_pix_abs16_xy2_neon, export=1
|
||||
// x0 unused
|
||||
// x1 uint8_t *pix1
|
||||
// x2 uint8_t *pix2
|
||||
// x3 ptrdiff_t stride
|
||||
// w4 int h
|
||||
|
||||
add x5, x2, x3 // use x5 to hold uint8_t *pix3
|
||||
movi v0.2d, #0 // initialize the result register
|
||||
|
||||
// Load initial pix2 values for either the unrolled version or completion version.
|
||||
ldur q4, [x2, #1] // load pix2+1
|
||||
ldr q3, [x2] // load pix2
|
||||
uaddl v2.8h, v4.8b, v3.8b // pix2 + pix2+1 0..7
|
||||
uaddl2 v3.8h, v4.16b, v3.16b // pix2 + pix2+1 8..15
|
||||
cmp w4, #4 // if h < 4 jump to the completion version
|
||||
b.lt 2f
|
||||
1:
|
||||
// This is an unrolled implementation. It completes 4 iterations of the C for each branch.
|
||||
// In each iteration, pix2[i+1] == pix3[i]. This means we need only three loads per iteration,
|
||||
// plus two at the beginning to start.
|
||||
ldur q5, [x5, #1] // load pix3+1
|
||||
ld1 {v4.16b}, [x5], x3 // load pix3
|
||||
ld1 {v1.16b}, [x1], x3 // load pix1
|
||||
|
||||
ldur q7, [x5, #1] // load pix3+1
|
||||
ld1 {v6.16b}, [x5], x3 // load pix3
|
||||
ld1 {v16.16b}, [x1], x3 // load pix1
|
||||
|
||||
ldur q19, [x5, #1] // load pix3+1
|
||||
ld1 {v18.16b}, [x5], x3 // load pix3
|
||||
ld1 {v17.16b}, [x1], x3 // load pix1
|
||||
|
||||
ldur q22, [x5, #1] // load pix3+1
|
||||
ld1 {v21.16b}, [x5], x3 // load pix3
|
||||
ld1 {v20.16b}, [x1], x3 // load pix1
|
||||
|
||||
// These blocks compute the average: avg(pix2[n], pix2[n+1], pix3[n], pix3[n+1])
|
||||
uaddl v30.8h, v4.8b, v5.8b // pix3 + pix3+1 0..7
|
||||
uaddl2 v31.8h, v4.16b, v5.16b // pix3 + pix3+1 8..15
|
||||
add v23.8h, v2.8h, v30.8h // add up 0..7, using pix2 + pix2+1 values from previous iteration
|
||||
add v24.8h, v3.8h, v31.8h // add up 8..15, using pix2 + pix2+1 values from previous iteration
|
||||
rshrn v23.8b, v23.8h, #2 // shift right 2 0..7 (rounding shift right)
|
||||
rshrn2 v23.16b, v24.8h, #2 // shift right 2 8..15
|
||||
|
||||
uaddl v2.8h, v6.8b, v7.8b // pix3 + pix3+1 0..7
|
||||
uaddl2 v3.8h, v6.16b, v7.16b // pix3 + pix3+1 8..15
|
||||
add v26.8h, v30.8h, v2.8h // add up 0..7, using pix2 + pix2+1 values from pix3 above
|
||||
add v27.8h, v31.8h, v3.8h // add up 8..15, using pix2 + pix2+1 values from pix3 above
|
||||
rshrn v26.8b, v26.8h, #2 // shift right 2 0..7 (rounding shift right)
|
||||
rshrn2 v26.16b, v27.8h, #2 // shift right 2 8..15
|
||||
|
||||
uaddl v4.8h, v18.8b, v19.8b // pix3 + pix3+1 0..7
|
||||
uaddl2 v5.8h, v18.16b, v19.16b // pix3 + pix3+1 8..15
|
||||
add v28.8h, v2.8h, v4.8h // add up 0..7, using pix2 + pix2+1 values from pix3 above
|
||||
add v29.8h, v3.8h, v5.8h // add up 8..15, using pix2 + pix2+1 values from pix3 above
|
||||
rshrn v28.8b, v28.8h, #2 // shift right 2 0..7 (rounding shift right)
|
||||
rshrn2 v28.16b, v29.8h, #2 // shift right 2 8..15
|
||||
|
||||
uaddl v2.8h, v21.8b, v22.8b // pix3 + pix3+1 0..7
|
||||
uaddl2 v3.8h, v21.16b, v22.16b // pix3 + pix3+1 8..15
|
||||
add v30.8h, v4.8h, v2.8h // add up 0..7, using pix2 + pix2+1 values from pix3 above
|
||||
add v31.8h, v5.8h, v3.8h // add up 8..15, using pix2 + pix2+1 values from pix3 above
|
||||
rshrn v30.8b, v30.8h, #2 // shift right 2 0..7 (rounding shift right)
|
||||
rshrn2 v30.16b, v31.8h, #2 // shift right 2 8..15
|
||||
|
||||
// Averages are now stored in these registers:
|
||||
// v23, v16, v28, v30
|
||||
// pix1 values in these registers:
|
||||
// v1, v16, v17, v20
|
||||
// available:
|
||||
// v4, v5, v7, v18, v19, v24, v25, v27, v29, v31
|
||||
|
||||
sub w4, w4, #4 // h -= 4
|
||||
|
||||
// Using absolute-difference instructions instead of absolute-difference-accumulate allows
|
||||
// us to keep the results in 16b vectors instead of widening values with twice the instructions.
|
||||
// This approach also has fewer data dependencies, allowing better instruction level parallelism.
|
||||
uabd v4.16b, v1.16b, v23.16b // absolute difference 0..15, i=0
|
||||
uabd v5.16b, v16.16b, v26.16b // absolute difference 0..15, i=1
|
||||
uabd v6.16b, v17.16b, v28.16b // absolute difference 0..15, i=2
|
||||
uabd v7.16b, v20.16b, v30.16b // absolute difference 0..15, i=3
|
||||
|
||||
cmp w4, #4 // loop if h >= 4
|
||||
|
||||
// Now add up all the values in each vector, v4-v7 with widening adds
|
||||
uaddl v19.8h, v4.8b, v5.8b
|
||||
uaddl2 v18.8h, v4.16b, v5.16b
|
||||
uaddl v4.8h, v6.8b, v7.8b
|
||||
uaddl2 v5.8h, v6.16b, v7.16b
|
||||
add v4.8h, v4.8h, v5.8h
|
||||
add v4.8h, v4.8h, v18.8h
|
||||
add v4.8h, v4.8h, v19.8h
|
||||
uaddlv s4, v4.8h // finish adding up accumulated values
|
||||
add d0, d0, d4 // add the value to the top level accumulator
|
||||
|
||||
b.ge 1b
|
||||
cbnz w4, 2f // if iterations remain jump to completion section
|
||||
|
||||
fmov w0, s0 // copy result to general purpose register
|
||||
ret
|
||||
2:
|
||||
// v2 and v3 are set either at the end of this loop or at from the unrolled version
|
||||
// which branches here to complete iterations when h % 4 != 0.
|
||||
ldur q5, [x5, #1] // load pix3+1
|
||||
ld1 {v4.16b}, [x5], x3 // load pix3
|
||||
ld1 {v1.16b}, [x1], x3 // load pix1
|
||||
subs w4, w4, #1 // decrement h
|
||||
|
||||
uaddl v18.8h, v4.8b, v5.8b // pix3 + pix3+1 0..7
|
||||
uaddl2 v19.8h, v4.16b, v5.16b // pix3 + pix3+1 8..15
|
||||
add v16.8h, v2.8h, v18.8h // add up 0..7, using pix2 + pix2+1 values from previous iteration
|
||||
add v17.8h, v3.8h, v19.8h // add up 8..15, using pix2 + pix2+1 values from previous iteration
|
||||
// divide by 4 to compute the average of values summed above
|
||||
urshr v16.8h, v16.8h, #2 // shift right by 2 0..7 (rounding shift right)
|
||||
urshr v17.8h, v17.8h, #2 // shift right by 2 8..15
|
||||
|
||||
uxtl2 v8.8h, v1.16b // 8->16 bits pix1 8..15
|
||||
uxtl v1.8h, v1.8b // 8->16 bits pix1 0..7
|
||||
|
||||
uabd v6.8h, v1.8h, v16.8h // absolute difference 0..7
|
||||
uaba v6.8h, v8.8h, v17.8h // absolute difference accumulate 8..15
|
||||
mov v2.16b, v18.16b // pix3 -> pix2
|
||||
mov v3.16b, v19.16b // pix3+1 -> pix2+1
|
||||
uaddlv s6, v6.8h // add up accumulator in v6
|
||||
add d0, d0, d6 // add to the final result
|
||||
|
||||
b.ne 2b // loop if h > 0
|
||||
fmov w0, s0 // copy result to general purpose register
|
||||
ret
|
||||
endfunc
|
@ -52,6 +52,7 @@ function ff_synth_filter_float_neon, export=1
|
||||
stp x5, x1, [sp, #16]
|
||||
and x7, x7, #~63
|
||||
and w8, w8, #511
|
||||
AARCH64_SIGN_LINK_REGISTER
|
||||
stp x7, x30, [sp, #32]
|
||||
str w8, [x2]
|
||||
str s0, [sp, #48]
|
||||
@ -63,6 +64,7 @@ function ff_synth_filter_float_neon, export=1
|
||||
ldp x2, x4, [sp] // synct_buf_2, window
|
||||
ldp x13, x9, [sp, #16] // out, synth_buf
|
||||
ldp x0, x30, [sp, #32] // *synth_buf_offset
|
||||
AARCH64_VALIDATE_LINK_REGISTER
|
||||
ldr s0, [sp, #48]
|
||||
|
||||
add x3, x2, #16*4 // synct_buf_2 + 16
|
||||
|
@ -21,10 +21,28 @@
|
||||
#include "libavutil/attributes.h"
|
||||
#include "libavutil/cpu.h"
|
||||
#include "libavutil/aarch64/cpu.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavcodec/vc1dsp.h"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
void ff_vc1_inv_trans_8x8_neon(int16_t *block);
|
||||
void ff_vc1_inv_trans_8x4_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block);
|
||||
void ff_vc1_inv_trans_4x8_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block);
|
||||
void ff_vc1_inv_trans_4x4_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block);
|
||||
|
||||
void ff_vc1_inv_trans_8x8_dc_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block);
|
||||
void ff_vc1_inv_trans_8x4_dc_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block);
|
||||
void ff_vc1_inv_trans_4x8_dc_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block);
|
||||
void ff_vc1_inv_trans_4x4_dc_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block);
|
||||
|
||||
void ff_vc1_v_loop_filter4_neon(uint8_t *src, ptrdiff_t stride, int pq);
|
||||
void ff_vc1_h_loop_filter4_neon(uint8_t *src, ptrdiff_t stride, int pq);
|
||||
void ff_vc1_v_loop_filter8_neon(uint8_t *src, ptrdiff_t stride, int pq);
|
||||
void ff_vc1_h_loop_filter8_neon(uint8_t *src, ptrdiff_t stride, int pq);
|
||||
void ff_vc1_v_loop_filter16_neon(uint8_t *src, ptrdiff_t stride, int pq);
|
||||
void ff_vc1_h_loop_filter16_neon(uint8_t *src, ptrdiff_t stride, int pq);
|
||||
|
||||
void ff_put_vc1_chroma_mc8_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
|
||||
int h, int x, int y);
|
||||
void ff_avg_vc1_chroma_mc8_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
|
||||
@ -34,14 +52,90 @@ void ff_put_vc1_chroma_mc4_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
|
||||
void ff_avg_vc1_chroma_mc4_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
|
||||
int h, int x, int y);
|
||||
|
||||
int ff_vc1_unescape_buffer_helper_neon(const uint8_t *src, int size, uint8_t *dst);
|
||||
|
||||
static int vc1_unescape_buffer_neon(const uint8_t *src, int size, uint8_t *dst)
|
||||
{
|
||||
/* Dealing with starting and stopping, and removing escape bytes, are
|
||||
* comparatively less time-sensitive, so are more clearly expressed using
|
||||
* a C wrapper around the assembly inner loop. Note that we assume a
|
||||
* little-endian machine that supports unaligned loads. */
|
||||
int dsize = 0;
|
||||
while (size >= 4)
|
||||
{
|
||||
int found = 0;
|
||||
while (!found && (((uintptr_t) dst) & 7) && size >= 4)
|
||||
{
|
||||
found = (AV_RL32(src) &~ 0x03000000) == 0x00030000;
|
||||
if (!found)
|
||||
{
|
||||
*dst++ = *src++;
|
||||
--size;
|
||||
++dsize;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
int skip = size - ff_vc1_unescape_buffer_helper_neon(src, size, dst);
|
||||
dst += skip;
|
||||
src += skip;
|
||||
size -= skip;
|
||||
dsize += skip;
|
||||
while (!found && size >= 4)
|
||||
{
|
||||
found = (AV_RL32(src) &~ 0x03000000) == 0x00030000;
|
||||
if (!found)
|
||||
{
|
||||
*dst++ = *src++;
|
||||
--size;
|
||||
++dsize;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
*dst++ = *src++;
|
||||
*dst++ = *src++;
|
||||
++src;
|
||||
size -= 3;
|
||||
dsize += 2;
|
||||
}
|
||||
}
|
||||
while (size > 0)
|
||||
{
|
||||
*dst++ = *src++;
|
||||
--size;
|
||||
++dsize;
|
||||
}
|
||||
return dsize;
|
||||
}
|
||||
|
||||
av_cold void ff_vc1dsp_init_aarch64(VC1DSPContext *dsp)
|
||||
{
|
||||
int cpu_flags = av_get_cpu_flags();
|
||||
|
||||
if (have_neon(cpu_flags)) {
|
||||
dsp->vc1_inv_trans_8x8 = ff_vc1_inv_trans_8x8_neon;
|
||||
dsp->vc1_inv_trans_8x4 = ff_vc1_inv_trans_8x4_neon;
|
||||
dsp->vc1_inv_trans_4x8 = ff_vc1_inv_trans_4x8_neon;
|
||||
dsp->vc1_inv_trans_4x4 = ff_vc1_inv_trans_4x4_neon;
|
||||
dsp->vc1_inv_trans_8x8_dc = ff_vc1_inv_trans_8x8_dc_neon;
|
||||
dsp->vc1_inv_trans_8x4_dc = ff_vc1_inv_trans_8x4_dc_neon;
|
||||
dsp->vc1_inv_trans_4x8_dc = ff_vc1_inv_trans_4x8_dc_neon;
|
||||
dsp->vc1_inv_trans_4x4_dc = ff_vc1_inv_trans_4x4_dc_neon;
|
||||
|
||||
dsp->vc1_v_loop_filter4 = ff_vc1_v_loop_filter4_neon;
|
||||
dsp->vc1_h_loop_filter4 = ff_vc1_h_loop_filter4_neon;
|
||||
dsp->vc1_v_loop_filter8 = ff_vc1_v_loop_filter8_neon;
|
||||
dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_neon;
|
||||
dsp->vc1_v_loop_filter16 = ff_vc1_v_loop_filter16_neon;
|
||||
dsp->vc1_h_loop_filter16 = ff_vc1_h_loop_filter16_neon;
|
||||
|
||||
dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = ff_put_vc1_chroma_mc8_neon;
|
||||
dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = ff_avg_vc1_chroma_mc8_neon;
|
||||
dsp->put_no_rnd_vc1_chroma_pixels_tab[1] = ff_put_vc1_chroma_mc4_neon;
|
||||
dsp->avg_no_rnd_vc1_chroma_pixels_tab[1] = ff_avg_vc1_chroma_mc4_neon;
|
||||
|
||||
dsp->vc1_unescape_buffer = vc1_unescape_buffer_neon;
|
||||
}
|
||||
}
|
||||
|
1546
libavcodec/aarch64/vc1dsp_neon.S
Normal file
1546
libavcodec/aarch64/vc1dsp_neon.S
Normal file
File diff suppressed because it is too large
Load Diff
@ -29,6 +29,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "codec_internal.h"
|
||||
#include "internal.h"
|
||||
#include "msrledec.h"
|
||||
|
||||
@ -77,9 +78,8 @@ static av_cold int aasc_decode_init(AVCodecContext *avctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int aasc_decode_frame(AVCodecContext *avctx,
|
||||
void *data, int *got_frame,
|
||||
AVPacket *avpkt)
|
||||
static int aasc_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
|
||||
int *got_frame, AVPacket *avpkt)
|
||||
{
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int buf_size = avpkt->size;
|
||||
@ -104,26 +104,26 @@ static int aasc_decode_frame(AVCodecContext *avctx,
|
||||
ff_msrle_decode(avctx, s->frame, 8, &s->gb);
|
||||
break;
|
||||
case MKTAG('A', 'A', 'S', 'C'):
|
||||
switch (compr) {
|
||||
case 0:
|
||||
stride = (avctx->width * psize + psize) & ~psize;
|
||||
if (buf_size < stride * avctx->height)
|
||||
switch (compr) {
|
||||
case 0:
|
||||
stride = (avctx->width * psize + psize) & ~psize;
|
||||
if (buf_size < stride * avctx->height)
|
||||
return AVERROR_INVALIDDATA;
|
||||
for (i = avctx->height - 1; i >= 0; i--) {
|
||||
memcpy(s->frame->data[0] + i * s->frame->linesize[0], buf, avctx->width * psize);
|
||||
buf += stride;
|
||||
buf_size -= stride;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
bytestream2_init(&s->gb, buf, buf_size);
|
||||
ff_msrle_decode(avctx, s->frame, 8, &s->gb);
|
||||
break;
|
||||
default:
|
||||
av_log(avctx, AV_LOG_ERROR, "Unknown compression type %d\n", compr);
|
||||
return AVERROR_INVALIDDATA;
|
||||
for (i = avctx->height - 1; i >= 0; i--) {
|
||||
memcpy(s->frame->data[0] + i * s->frame->linesize[0], buf, avctx->width * psize);
|
||||
buf += stride;
|
||||
buf_size -= stride;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
bytestream2_init(&s->gb, buf, buf_size);
|
||||
ff_msrle_decode(avctx, s->frame, 8, &s->gb);
|
||||
break;
|
||||
default:
|
||||
av_log(avctx, AV_LOG_ERROR, "Unknown compression type %d\n", compr);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
av_log(avctx, AV_LOG_ERROR, "Unknown FourCC: %X\n", avctx->codec_tag);
|
||||
return -1;
|
||||
@ -133,7 +133,7 @@ static int aasc_decode_frame(AVCodecContext *avctx,
|
||||
memcpy(s->frame->data[1], s->palette, s->palette_size);
|
||||
|
||||
*got_frame = 1;
|
||||
if ((ret = av_frame_ref(data, s->frame)) < 0)
|
||||
if ((ret = av_frame_ref(rframe, s->frame)) < 0)
|
||||
return ret;
|
||||
|
||||
/* report that the buffer was completely consumed */
|
||||
@ -149,15 +149,15 @@ static av_cold int aasc_decode_end(AVCodecContext *avctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const AVCodec ff_aasc_decoder = {
|
||||
.name = "aasc",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("Autodesk RLE"),
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.id = AV_CODEC_ID_AASC,
|
||||
const FFCodec ff_aasc_decoder = {
|
||||
.p.name = "aasc",
|
||||
.p.long_name = NULL_IF_CONFIG_SMALL("Autodesk RLE"),
|
||||
.p.type = AVMEDIA_TYPE_VIDEO,
|
||||
.p.id = AV_CODEC_ID_AASC,
|
||||
.priv_data_size = sizeof(AascContext),
|
||||
.init = aasc_decode_init,
|
||||
.close = aasc_decode_end,
|
||||
.decode = aasc_decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_DR1,
|
||||
FF_CODEC_DECODE_CB(aasc_decode_frame),
|
||||
.p.capabilities = AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
|
||||
};
|
||||
|
@ -24,9 +24,11 @@
|
||||
* Common code between the AC-3 encoder and decoder.
|
||||
*/
|
||||
|
||||
#include "libavutil/common.h"
|
||||
#include "libavutil/error.h"
|
||||
#include "libavutil/macros.h"
|
||||
|
||||
#include "ac3.h"
|
||||
#include "ac3defs.h"
|
||||
|
||||
/**
|
||||
* Starting frequency coefficient bin for each critical band.
|
||||
@ -67,6 +69,88 @@ const uint8_t ff_ac3_bin_to_band_tab[253] = {
|
||||
49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49
|
||||
};
|
||||
|
||||
static const uint8_t ac3_log_add_tab[260]= {
|
||||
0x40,0x3f,0x3e,0x3d,0x3c,0x3b,0x3a,0x39,0x38,0x37,
|
||||
0x36,0x35,0x34,0x34,0x33,0x32,0x31,0x30,0x2f,0x2f,
|
||||
0x2e,0x2d,0x2c,0x2c,0x2b,0x2a,0x29,0x29,0x28,0x27,
|
||||
0x26,0x26,0x25,0x24,0x24,0x23,0x23,0x22,0x21,0x21,
|
||||
0x20,0x20,0x1f,0x1e,0x1e,0x1d,0x1d,0x1c,0x1c,0x1b,
|
||||
0x1b,0x1a,0x1a,0x19,0x19,0x18,0x18,0x17,0x17,0x16,
|
||||
0x16,0x15,0x15,0x15,0x14,0x14,0x13,0x13,0x13,0x12,
|
||||
0x12,0x12,0x11,0x11,0x11,0x10,0x10,0x10,0x0f,0x0f,
|
||||
0x0f,0x0e,0x0e,0x0e,0x0d,0x0d,0x0d,0x0d,0x0c,0x0c,
|
||||
0x0c,0x0c,0x0b,0x0b,0x0b,0x0b,0x0a,0x0a,0x0a,0x0a,
|
||||
0x0a,0x09,0x09,0x09,0x09,0x09,0x08,0x08,0x08,0x08,
|
||||
0x08,0x08,0x07,0x07,0x07,0x07,0x07,0x07,0x06,0x06,
|
||||
0x06,0x06,0x06,0x06,0x06,0x06,0x05,0x05,0x05,0x05,
|
||||
0x05,0x05,0x05,0x05,0x04,0x04,0x04,0x04,0x04,0x04,
|
||||
0x04,0x04,0x04,0x04,0x04,0x03,0x03,0x03,0x03,0x03,
|
||||
0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x02,
|
||||
0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
|
||||
0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x01,
|
||||
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
|
||||
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
|
||||
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
};
|
||||
|
||||
static const uint16_t ac3_hearing_threshold_tab[AC3_CRITICAL_BANDS][3]= {
|
||||
{ 0x04d0,0x04f0,0x0580 },
|
||||
{ 0x04d0,0x04f0,0x0580 },
|
||||
{ 0x0440,0x0460,0x04b0 },
|
||||
{ 0x0400,0x0410,0x0450 },
|
||||
{ 0x03e0,0x03e0,0x0420 },
|
||||
{ 0x03c0,0x03d0,0x03f0 },
|
||||
{ 0x03b0,0x03c0,0x03e0 },
|
||||
{ 0x03b0,0x03b0,0x03d0 },
|
||||
{ 0x03a0,0x03b0,0x03c0 },
|
||||
{ 0x03a0,0x03a0,0x03b0 },
|
||||
{ 0x03a0,0x03a0,0x03b0 },
|
||||
{ 0x03a0,0x03a0,0x03b0 },
|
||||
{ 0x03a0,0x03a0,0x03a0 },
|
||||
{ 0x0390,0x03a0,0x03a0 },
|
||||
{ 0x0390,0x0390,0x03a0 },
|
||||
{ 0x0390,0x0390,0x03a0 },
|
||||
{ 0x0380,0x0390,0x03a0 },
|
||||
{ 0x0380,0x0380,0x03a0 },
|
||||
{ 0x0370,0x0380,0x03a0 },
|
||||
{ 0x0370,0x0380,0x03a0 },
|
||||
{ 0x0360,0x0370,0x0390 },
|
||||
{ 0x0360,0x0370,0x0390 },
|
||||
{ 0x0350,0x0360,0x0390 },
|
||||
{ 0x0350,0x0360,0x0390 },
|
||||
{ 0x0340,0x0350,0x0380 },
|
||||
{ 0x0340,0x0350,0x0380 },
|
||||
{ 0x0330,0x0340,0x0380 },
|
||||
{ 0x0320,0x0340,0x0370 },
|
||||
{ 0x0310,0x0320,0x0360 },
|
||||
{ 0x0300,0x0310,0x0350 },
|
||||
{ 0x02f0,0x0300,0x0340 },
|
||||
{ 0x02f0,0x02f0,0x0330 },
|
||||
{ 0x02f0,0x02f0,0x0320 },
|
||||
{ 0x02f0,0x02f0,0x0310 },
|
||||
{ 0x0300,0x02f0,0x0300 },
|
||||
{ 0x0310,0x0300,0x02f0 },
|
||||
{ 0x0340,0x0320,0x02f0 },
|
||||
{ 0x0390,0x0350,0x02f0 },
|
||||
{ 0x03e0,0x0390,0x0300 },
|
||||
{ 0x0420,0x03e0,0x0310 },
|
||||
{ 0x0460,0x0420,0x0330 },
|
||||
{ 0x0490,0x0450,0x0350 },
|
||||
{ 0x04a0,0x04a0,0x03c0 },
|
||||
{ 0x0460,0x0490,0x0410 },
|
||||
{ 0x0440,0x0460,0x0470 },
|
||||
{ 0x0440,0x0440,0x04a0 },
|
||||
{ 0x0520,0x0480,0x0460 },
|
||||
{ 0x0800,0x0630,0x0440 },
|
||||
{ 0x0840,0x0840,0x0450 },
|
||||
{ 0x0840,0x0840,0x04e0 },
|
||||
};
|
||||
|
||||
static inline int calc_lowcomp1(int a, int b0, int b1, int c)
|
||||
{
|
||||
if ((b0 + 256) == b1) {
|
||||
@ -108,7 +192,7 @@ void ff_ac3_bit_alloc_calc_psd(int8_t *exp, int start, int end, int16_t *psd,
|
||||
int max = FFMAX(v, psd[bin]);
|
||||
/* logadd */
|
||||
int adr = FFMIN(max - ((v + psd[bin] + 1) >> 1), 255);
|
||||
v = max + ff_ac3_log_add_tab[adr];
|
||||
v = max + ac3_log_add_tab[adr];
|
||||
}
|
||||
band_psd[band++] = v;
|
||||
} while (end > ff_ac3_band_start_tab[band]);
|
||||
@ -182,7 +266,7 @@ int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd,
|
||||
if (tmp > 0) {
|
||||
excite[band] += tmp >> 2;
|
||||
}
|
||||
mask[band] = FFMAX(ff_ac3_hearing_threshold_tab[band >> s->sr_shift][s->sr_code], excite[band]);
|
||||
mask[band] = FFMAX(ac3_hearing_threshold_tab[band >> s->sr_shift][s->sr_code], excite[band]);
|
||||
}
|
||||
|
||||
/* delta bit allocation */
|
||||
|
118
libavcodec/ac3.h
118
libavcodec/ac3.h
@ -30,28 +30,8 @@
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define EAC3_MAX_CHANNELS 16 /**< maximum number of channels in EAC3 */
|
||||
#define AC3_MAX_CHANNELS 7 /**< maximum number of channels, including coupling channel */
|
||||
#define CPL_CH 0 /**< coupling channel index */
|
||||
|
||||
#define AC3_MAX_COEFS 256
|
||||
#define AC3_BLOCK_SIZE 256
|
||||
#define AC3_MAX_BLOCKS 6
|
||||
#define AC3_FRAME_SIZE (AC3_MAX_BLOCKS * 256)
|
||||
#define AC3_WINDOW_SIZE (AC3_BLOCK_SIZE * 2)
|
||||
#define AC3_CRITICAL_BANDS 50
|
||||
#define AC3_MAX_CPL_BANDS 18
|
||||
|
||||
#include "ac3tab.h"
|
||||
|
||||
/* exponent encoding strategy */
|
||||
#define EXP_REUSE 0
|
||||
#define EXP_NEW 1
|
||||
|
||||
#define EXP_D15 1
|
||||
#define EXP_D25 2
|
||||
#define EXP_D45 3
|
||||
|
||||
#ifndef USE_FIXED
|
||||
#define USE_FIXED 0
|
||||
#endif
|
||||
@ -78,6 +58,7 @@ typedef int INTFLOAT;
|
||||
typedef int16_t SHORTFLOAT;
|
||||
|
||||
#else /* USE_FIXED */
|
||||
#include "libavutil/libm.h"
|
||||
|
||||
#define FIXR(x) ((float)(x))
|
||||
#define FIXR12(x) ((float)(x))
|
||||
@ -111,58 +92,6 @@ typedef float SHORTFLOAT;
|
||||
#define LEVEL_ZERO 0.0000000000000000
|
||||
#define LEVEL_ONE 1.0000000000000000
|
||||
|
||||
/** Delta bit allocation strategy */
|
||||
typedef enum {
|
||||
DBA_REUSE = 0,
|
||||
DBA_NEW,
|
||||
DBA_NONE,
|
||||
DBA_RESERVED
|
||||
} AC3DeltaStrategy;
|
||||
|
||||
/** Channel mode (audio coding mode) */
|
||||
typedef enum {
|
||||
AC3_CHMODE_DUALMONO = 0,
|
||||
AC3_CHMODE_MONO,
|
||||
AC3_CHMODE_STEREO,
|
||||
AC3_CHMODE_3F,
|
||||
AC3_CHMODE_2F1R,
|
||||
AC3_CHMODE_3F1R,
|
||||
AC3_CHMODE_2F2R,
|
||||
AC3_CHMODE_3F2R
|
||||
} AC3ChannelMode;
|
||||
|
||||
/** Dolby Surround mode */
|
||||
typedef enum AC3DolbySurroundMode {
|
||||
AC3_DSURMOD_NOTINDICATED = 0,
|
||||
AC3_DSURMOD_OFF,
|
||||
AC3_DSURMOD_ON,
|
||||
AC3_DSURMOD_RESERVED
|
||||
} AC3DolbySurroundMode;
|
||||
|
||||
/** Dolby Surround EX mode */
|
||||
typedef enum AC3DolbySurroundEXMode {
|
||||
AC3_DSUREXMOD_NOTINDICATED = 0,
|
||||
AC3_DSUREXMOD_OFF,
|
||||
AC3_DSUREXMOD_ON,
|
||||
AC3_DSUREXMOD_PLIIZ
|
||||
} AC3DolbySurroundEXMode;
|
||||
|
||||
/** Dolby Headphone mode */
|
||||
typedef enum AC3DolbyHeadphoneMode {
|
||||
AC3_DHEADPHONMOD_NOTINDICATED = 0,
|
||||
AC3_DHEADPHONMOD_OFF,
|
||||
AC3_DHEADPHONMOD_ON,
|
||||
AC3_DHEADPHONMOD_RESERVED
|
||||
} AC3DolbyHeadphoneMode;
|
||||
|
||||
/** Preferred Stereo Downmix mode */
|
||||
typedef enum AC3PreferredStereoDownmixMode {
|
||||
AC3_DMIXMOD_NOTINDICATED = 0,
|
||||
AC3_DMIXMOD_LTRT,
|
||||
AC3_DMIXMOD_LORO,
|
||||
AC3_DMIXMOD_DPLII // reserved value in A/52, but used by encoders to indicate DPL2
|
||||
} AC3PreferredStereoDownmixMode;
|
||||
|
||||
typedef struct AC3BitAllocParameters {
|
||||
int sr_code;
|
||||
int sr_shift;
|
||||
@ -170,51 +99,6 @@ typedef struct AC3BitAllocParameters {
|
||||
int cpl_fast_leak, cpl_slow_leak;
|
||||
} AC3BitAllocParameters;
|
||||
|
||||
/**
|
||||
* @struct AC3HeaderInfo
|
||||
* Coded AC-3 header values up to the lfeon element, plus derived values.
|
||||
*/
|
||||
typedef struct AC3HeaderInfo {
|
||||
/** @name Coded elements
|
||||
* @{
|
||||
*/
|
||||
uint16_t sync_word;
|
||||
uint16_t crc1;
|
||||
uint8_t sr_code;
|
||||
uint8_t bitstream_id;
|
||||
uint8_t bitstream_mode;
|
||||
uint8_t channel_mode;
|
||||
uint8_t lfe_on;
|
||||
uint8_t frame_type;
|
||||
int substreamid; ///< substream identification
|
||||
int center_mix_level; ///< Center mix level index
|
||||
int surround_mix_level; ///< Surround mix level index
|
||||
uint16_t channel_map;
|
||||
int num_blocks; ///< number of audio blocks
|
||||
int dolby_surround_mode;
|
||||
/** @} */
|
||||
|
||||
/** @name Derived values
|
||||
* @{
|
||||
*/
|
||||
uint8_t sr_shift;
|
||||
uint16_t sample_rate;
|
||||
uint32_t bit_rate;
|
||||
uint8_t channels;
|
||||
uint16_t frame_size;
|
||||
uint64_t channel_layout;
|
||||
/** @} */
|
||||
} AC3HeaderInfo;
|
||||
|
||||
typedef enum {
|
||||
EAC3_FRAME_TYPE_INDEPENDENT = 0,
|
||||
EAC3_FRAME_TYPE_DEPENDENT,
|
||||
EAC3_FRAME_TYPE_AC3_CONVERT,
|
||||
EAC3_FRAME_TYPE_RESERVED
|
||||
} EAC3FrameType;
|
||||
|
||||
void ff_ac3_common_init(void);
|
||||
|
||||
/**
|
||||
* Calculate the log power-spectral density of the input signal.
|
||||
* This gives a rough estimate of signal power in the frequency domain by using
|
||||
|
@ -21,9 +21,12 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "config_components.h"
|
||||
|
||||
#include "libavutil/channel_layout.h"
|
||||
#include "parser.h"
|
||||
#include "ac3defs.h"
|
||||
#include "ac3tab.h"
|
||||
#include "ac3_parser.h"
|
||||
#include "ac3_parser_internal.h"
|
||||
#include "aac_ac3_parser.h"
|
||||
@ -67,6 +70,7 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
|
||||
return AAC_AC3_PARSE_ERROR_BSID;
|
||||
|
||||
hdr->num_blocks = 6;
|
||||
hdr->ac3_bit_rate_code = -1;
|
||||
|
||||
/* set default mix levels */
|
||||
hdr->center_mix_level = 5; // -4.5dB
|
||||
@ -86,6 +90,8 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
|
||||
if(frame_size_code > 37)
|
||||
return AAC_AC3_PARSE_ERROR_FRAME_SIZE;
|
||||
|
||||
hdr->ac3_bit_rate_code = (frame_size_code >> 1);
|
||||
|
||||
skip_bits(gbc, 5); // skip bsid, already got it
|
||||
|
||||
hdr->bitstream_mode = get_bits(gbc, 3);
|
||||
@ -103,7 +109,7 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
|
||||
|
||||
hdr->sr_shift = FFMAX(hdr->bitstream_id, 8) - 8;
|
||||
hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code] >> hdr->sr_shift;
|
||||
hdr->bit_rate = (ff_ac3_bitrate_tab[frame_size_code>>1] * 1000) >> hdr->sr_shift;
|
||||
hdr->bit_rate = (ff_ac3_bitrate_tab[hdr->ac3_bit_rate_code] * 1000) >> hdr->sr_shift;
|
||||
hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on;
|
||||
hdr->frame_size = ff_ac3_frame_size_tab[frame_size_code][hdr->sr_code] * 2;
|
||||
hdr->frame_type = EAC3_FRAME_TYPE_AC3_CONVERT; //EAC3_FRAME_TYPE_INDEPENDENT;
|
||||
|
@ -21,9 +21,49 @@
|
||||
#ifndef AVCODEC_AC3_PARSER_INTERNAL_H
|
||||
#define AVCODEC_AC3_PARSER_INTERNAL_H
|
||||
|
||||
#include "ac3.h"
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "ac3defs.h"
|
||||
#include "get_bits.h"
|
||||
|
||||
/**
|
||||
* @struct AC3HeaderInfo
|
||||
* Coded AC-3 header values up to the lfeon element, plus derived values.
|
||||
*/
|
||||
typedef struct AC3HeaderInfo {
|
||||
/** @name Coded elements
|
||||
* @{
|
||||
*/
|
||||
uint16_t sync_word;
|
||||
uint16_t crc1;
|
||||
uint8_t sr_code;
|
||||
uint8_t bitstream_id;
|
||||
uint8_t bitstream_mode;
|
||||
uint8_t channel_mode;
|
||||
uint8_t lfe_on;
|
||||
uint8_t frame_type;
|
||||
int substreamid; ///< substream identification
|
||||
int center_mix_level; ///< Center mix level index
|
||||
int surround_mix_level; ///< Surround mix level index
|
||||
uint16_t channel_map;
|
||||
int num_blocks; ///< number of audio blocks
|
||||
int dolby_surround_mode;
|
||||
/** @} */
|
||||
|
||||
/** @name Derived values
|
||||
* @{
|
||||
*/
|
||||
uint8_t sr_shift;
|
||||
uint16_t sample_rate;
|
||||
uint32_t bit_rate;
|
||||
uint8_t channels;
|
||||
uint16_t frame_size;
|
||||
uint64_t channel_layout;
|
||||
int8_t ac3_bit_rate_code;
|
||||
/** @} */
|
||||
} AC3HeaderInfo;
|
||||
|
||||
/**
|
||||
* Parse AC-3 frame header.
|
||||
* Parse the header up to the lfeon element, which is the first 52 or 54 bits
|
||||
|
@ -24,6 +24,8 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "config_components.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <math.h>
|
||||
@ -32,6 +34,7 @@
|
||||
#include "libavutil/channel_layout.h"
|
||||
#include "libavutil/crc.h"
|
||||
#include "libavutil/downmix_info.h"
|
||||
#include "libavutil/intmath.h"
|
||||
#include "libavutil/opt.h"
|
||||
#include "libavutil/thread.h"
|
||||
#include "bswapdsp.h"
|
||||
@ -40,6 +43,7 @@
|
||||
#include "ac3_parser_internal.h"
|
||||
#include "ac3dec.h"
|
||||
#include "ac3dec_data.h"
|
||||
#include "ac3defs.h"
|
||||
#include "kbdwin.h"
|
||||
|
||||
/**
|
||||
@ -186,6 +190,8 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
static AVOnce init_static_once = AV_ONCE_INIT;
|
||||
AC3DecodeContext *s = avctx->priv_data;
|
||||
const AVChannelLayout mono = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
|
||||
const AVChannelLayout stereo = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO;
|
||||
int i, ret;
|
||||
|
||||
s->avctx = avctx;
|
||||
@ -214,12 +220,23 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
|
||||
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
|
||||
|
||||
/* allow downmixing to stereo or mono */
|
||||
if (avctx->channels > 1 &&
|
||||
avctx->request_channel_layout == AV_CH_LAYOUT_MONO)
|
||||
avctx->channels = 1;
|
||||
else if (avctx->channels > 2 &&
|
||||
avctx->request_channel_layout == AV_CH_LAYOUT_STEREO)
|
||||
avctx->channels = 2;
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
if (avctx->request_channel_layout) {
|
||||
av_channel_layout_uninit(&s->downmix_layout);
|
||||
av_channel_layout_from_mask(&s->downmix_layout, avctx->request_channel_layout);
|
||||
}
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
if (avctx->ch_layout.nb_channels > 1 &&
|
||||
!av_channel_layout_compare(&s->downmix_layout, &mono)) {
|
||||
av_channel_layout_uninit(&avctx->ch_layout);
|
||||
avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
|
||||
} else if (avctx->ch_layout.nb_channels > 2 &&
|
||||
!av_channel_layout_compare(&s->downmix_layout, &stereo)) {
|
||||
av_channel_layout_uninit(&avctx->ch_layout);
|
||||
avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO;
|
||||
}
|
||||
s->downmixed = 1;
|
||||
|
||||
for (i = 0; i < AC3_MAX_CHANNELS; i++) {
|
||||
@ -1465,10 +1482,9 @@ static int decode_audio_block(AC3DecodeContext *s, int blk, int offset)
|
||||
/**
|
||||
* Decode a single AC-3 frame.
|
||||
*/
|
||||
static int ac3_decode_frame(AVCodecContext * avctx, void *data,
|
||||
static int ac3_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
int *got_frame_ptr, AVPacket *avpkt)
|
||||
{
|
||||
AVFrame *frame = data;
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int buf_size, full_buf_size = avpkt->size;
|
||||
AC3DecodeContext *s = avctx->priv_data;
|
||||
@ -1480,6 +1496,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
|
||||
const SHORTFLOAT *output[AC3_MAX_CHANNELS];
|
||||
enum AVMatrixEncoding matrix_encoding;
|
||||
AVDownmixInfo *downmix_info;
|
||||
uint64_t mask;
|
||||
|
||||
s->superframe_size = 0;
|
||||
|
||||
@ -1590,11 +1607,11 @@ dependent_frame:
|
||||
if (s->lfe_on)
|
||||
s->output_mode |= AC3_OUTPUT_LFEON;
|
||||
if (s->channels > 1 &&
|
||||
avctx->request_channel_layout == AV_CH_LAYOUT_MONO) {
|
||||
!av_channel_layout_compare(&s->downmix_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_MONO)) {
|
||||
s->out_channels = 1;
|
||||
s->output_mode = AC3_CHMODE_MONO;
|
||||
} else if (s->channels > 2 &&
|
||||
avctx->request_channel_layout == AV_CH_LAYOUT_STEREO) {
|
||||
!av_channel_layout_compare(&s->downmix_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO)) {
|
||||
s->out_channels = 2;
|
||||
s->output_mode = AC3_CHMODE_STEREO;
|
||||
}
|
||||
@ -1615,10 +1632,13 @@ dependent_frame:
|
||||
av_log(avctx, AV_LOG_ERROR, "unable to determine channel mode\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
avctx->channels = s->out_channels;
|
||||
avctx->channel_layout = ff_ac3_channel_layout_tab[s->output_mode & ~AC3_OUTPUT_LFEON];
|
||||
|
||||
mask = ff_ac3_channel_layout_tab[s->output_mode & ~AC3_OUTPUT_LFEON];
|
||||
if (s->output_mode & AC3_OUTPUT_LFEON)
|
||||
avctx->channel_layout |= AV_CH_LOW_FREQUENCY;
|
||||
mask |= AV_CH_LOW_FREQUENCY;
|
||||
|
||||
av_channel_layout_uninit(&avctx->ch_layout);
|
||||
av_channel_layout_from_mask(&avctx->ch_layout, mask);
|
||||
|
||||
/* set audio service type based on bitstream mode for AC-3 */
|
||||
avctx->audio_service_type = s->bitstream_mode;
|
||||
@ -1714,20 +1734,20 @@ skip:
|
||||
channel_layout |= ff_eac3_custom_channel_map_locations[ch][1];
|
||||
}
|
||||
}
|
||||
if (av_get_channel_layout_nb_channels(channel_layout) > EAC3_MAX_CHANNELS) {
|
||||
if (av_popcount64(channel_layout) > EAC3_MAX_CHANNELS) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Too many channels (%d) coded\n",
|
||||
av_get_channel_layout_nb_channels(channel_layout));
|
||||
av_popcount64(channel_layout));
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
avctx->channel_layout = channel_layout;
|
||||
avctx->channels = av_get_channel_layout_nb_channels(channel_layout);
|
||||
av_channel_layout_uninit(&avctx->ch_layout);
|
||||
av_channel_layout_from_mask(&avctx->ch_layout, channel_layout);
|
||||
|
||||
for (ch = 0; ch < EAC3_MAX_CHANNELS; ch++) {
|
||||
if (s->channel_map & (1 << (EAC3_MAX_CHANNELS - ch - 1))) {
|
||||
if (ff_eac3_custom_channel_map_locations[ch][0]) {
|
||||
int index = av_get_channel_layout_channel_index(channel_layout,
|
||||
ff_eac3_custom_channel_map_locations[ch][1]);
|
||||
int index = av_channel_layout_index_from_channel(&avctx->ch_layout,
|
||||
ff_ctzll(ff_eac3_custom_channel_map_locations[ch][1]));
|
||||
if (index < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (extend >= channel_map_size)
|
||||
@ -1739,8 +1759,7 @@ skip:
|
||||
|
||||
for (i = 0; i < 64; i++) {
|
||||
if ((1ULL << i) & ff_eac3_custom_channel_map_locations[ch][1]) {
|
||||
int index = av_get_channel_layout_channel_index(channel_layout,
|
||||
1ULL << i);
|
||||
int index = av_channel_layout_index_from_channel(&avctx->ch_layout, i);
|
||||
if (index < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (extend >= channel_map_size)
|
||||
@ -1759,7 +1778,7 @@ skip:
|
||||
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
for (ch = 0; ch < avctx->channels; ch++) {
|
||||
for (ch = 0; ch < avctx->ch_layout.nb_channels; ch++) {
|
||||
int map = extended_channel_map[ch];
|
||||
av_assert0(ch>=AV_NUM_DATA_POINTERS || frame->extended_data[ch] == frame->data[ch]);
|
||||
memcpy((SHORTFLOAT *)frame->extended_data[ch],
|
||||
|
@ -251,6 +251,8 @@ typedef struct AC3DecodeContext {
|
||||
DECLARE_ALIGNED(32, uint8_t, input_buffer)[AC3_FRAME_BUFFER_SIZE + AV_INPUT_BUFFER_PADDING_SIZE]; ///< temp buffer to prevent overread
|
||||
DECLARE_ALIGNED(32, SHORTFLOAT, output_buffer)[EAC3_MAX_CHANNELS][AC3_BLOCK_SIZE * 6]; ///< final output buffer
|
||||
///@}
|
||||
|
||||
AVChannelLayout downmix_layout;
|
||||
} AC3DecodeContext;
|
||||
|
||||
/**
|
||||
|
@ -25,7 +25,6 @@
|
||||
*/
|
||||
|
||||
#include "ac3dec_data.h"
|
||||
#include "ac3.h"
|
||||
|
||||
/**
|
||||
* Table used to ungroup 3 values stored in 5 bits.
|
||||
|
@ -50,6 +50,7 @@
|
||||
#define FFT_FLOAT 0
|
||||
#define USE_FIXED 1
|
||||
#include "ac3dec.h"
|
||||
#include "codec_internal.h"
|
||||
|
||||
|
||||
static const int end_freq_inv_tab[8] =
|
||||
@ -157,6 +158,7 @@ static const AVOption options[] = {
|
||||
{ "cons_noisegen", "enable consistent noise generation", OFFSET(consistent_noise_generation), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, PAR },
|
||||
{ "drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, 0.0, 6.0, PAR },
|
||||
{ "heavy_compr", "enable heavy dynamic range compression", OFFSET(heavy_compression), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, PAR },
|
||||
{ "downmix", "Request a specific channel layout from the decoder", OFFSET(downmix_layout), AV_OPT_TYPE_CHLAYOUT, {.str = NULL}, .flags = PAR },
|
||||
{ NULL},
|
||||
};
|
||||
|
||||
@ -167,19 +169,19 @@ static const AVClass ac3_decoder_class = {
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
};
|
||||
|
||||
const AVCodec ff_ac3_fixed_decoder = {
|
||||
.name = "ac3_fixed",
|
||||
.type = AVMEDIA_TYPE_AUDIO,
|
||||
.id = AV_CODEC_ID_AC3,
|
||||
const FFCodec ff_ac3_fixed_decoder = {
|
||||
.p.name = "ac3_fixed",
|
||||
.p.long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
|
||||
.p.type = AVMEDIA_TYPE_AUDIO,
|
||||
.p.id = AV_CODEC_ID_AC3,
|
||||
.p.priv_class = &ac3_decoder_class,
|
||||
.priv_data_size = sizeof (AC3DecodeContext),
|
||||
.init = ac3_decode_init,
|
||||
.close = ac3_decode_end,
|
||||
.decode = ac3_decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_CHANNEL_CONF |
|
||||
FF_CODEC_DECODE_CB(ac3_decode_frame),
|
||||
.p.capabilities = AV_CODEC_CAP_CHANNEL_CONF |
|
||||
AV_CODEC_CAP_DR1,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
|
||||
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
|
||||
.p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
|
||||
AV_SAMPLE_FMT_NONE },
|
||||
.priv_class = &ac3_decoder_class,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
};
|
||||
|
@ -27,7 +27,11 @@
|
||||
/**
|
||||
* Upmix delay samples from stereo to original channel layout.
|
||||
*/
|
||||
|
||||
#include "config_components.h"
|
||||
|
||||
#include "ac3dec.h"
|
||||
#include "codec_internal.h"
|
||||
#include "eac3dec.c"
|
||||
#include "ac3dec.c"
|
||||
|
||||
@ -43,6 +47,8 @@ static const AVOption options[] = {
|
||||
{"loro_cmixlev", "Lo/Ro Center Mix Level", OFFSET(loro_center_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0},
|
||||
{"loro_surmixlev", "Lo/Ro Surround Mix Level", OFFSET(loro_surround_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0},
|
||||
|
||||
{ "downmix", "Request a specific channel layout from the decoder", OFFSET(downmix_layout), AV_OPT_TYPE_CHLAYOUT, {.str = NULL}, .flags = PAR },
|
||||
|
||||
{ NULL},
|
||||
};
|
||||
|
||||
@ -53,38 +59,38 @@ static const AVClass ac3_eac3_decoder_class = {
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
};
|
||||
|
||||
const AVCodec ff_ac3_decoder = {
|
||||
.name = "ac3",
|
||||
.type = AVMEDIA_TYPE_AUDIO,
|
||||
.id = AV_CODEC_ID_AC3,
|
||||
const FFCodec ff_ac3_decoder = {
|
||||
.p.name = "ac3",
|
||||
.p.type = AVMEDIA_TYPE_AUDIO,
|
||||
.p.id = AV_CODEC_ID_AC3,
|
||||
.priv_data_size = sizeof (AC3DecodeContext),
|
||||
.init = ac3_decode_init,
|
||||
.close = ac3_decode_end,
|
||||
.decode = ac3_decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_CHANNEL_CONF |
|
||||
FF_CODEC_DECODE_CB(ac3_decode_frame),
|
||||
.p.capabilities = AV_CODEC_CAP_CHANNEL_CONF |
|
||||
AV_CODEC_CAP_DR1,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
|
||||
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
|
||||
.p.long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
|
||||
.p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
|
||||
AV_SAMPLE_FMT_NONE },
|
||||
.priv_class = &ac3_eac3_decoder_class,
|
||||
.p.priv_class = &ac3_eac3_decoder_class,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
};
|
||||
|
||||
#if CONFIG_EAC3_DECODER
|
||||
const AVCodec ff_eac3_decoder = {
|
||||
.name = "eac3",
|
||||
.type = AVMEDIA_TYPE_AUDIO,
|
||||
.id = AV_CODEC_ID_EAC3,
|
||||
const FFCodec ff_eac3_decoder = {
|
||||
.p.name = "eac3",
|
||||
.p.type = AVMEDIA_TYPE_AUDIO,
|
||||
.p.id = AV_CODEC_ID_EAC3,
|
||||
.priv_data_size = sizeof (AC3DecodeContext),
|
||||
.init = ac3_decode_init,
|
||||
.close = ac3_decode_end,
|
||||
.decode = ac3_decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_CHANNEL_CONF |
|
||||
FF_CODEC_DECODE_CB(ac3_decode_frame),
|
||||
.p.capabilities = AV_CODEC_CAP_CHANNEL_CONF |
|
||||
AV_CODEC_CAP_DR1,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("ATSC A/52B (AC-3, E-AC-3)"),
|
||||
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
|
||||
.p.long_name = NULL_IF_CONFIG_SMALL("ATSC A/52B (AC-3, E-AC-3)"),
|
||||
.p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
|
||||
AV_SAMPLE_FMT_NONE },
|
||||
.priv_class = &ac3_eac3_decoder_class,
|
||||
.p.priv_class = &ac3_eac3_decoder_class,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
};
|
||||
#endif
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user