Updated FFmpeg to version 3.1.1, and enabled assembly optimizations.

CQTexperiment
Chris Moeller 2016-07-15 09:26:18 -07:00
parent ded21370b5
commit b89c68a768
47 changed files with 1880 additions and 660 deletions

View File

@ -19,7 +19,6 @@
8352D49B1CDDB8B2009D16AA /* VideoToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8352D49A1CDDB8B2009D16AA /* VideoToolbox.framework */; };
8352D49D1CDDB8C0009D16AA /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8352D49C1CDDB8C0009D16AA /* CoreMedia.framework */; };
8352D49F1CDDB8D7009D16AA /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8352D49E1CDDB8D7009D16AA /* CoreVideo.framework */; };
8352D4A21CDDC0BC009D16AA /* FFMPEGFileProtocols.m in Sources */ = {isa = PBXBuildFile; fileRef = 8352D4A11CDDC0BC009D16AA /* FFMPEGFileProtocols.m */; };
8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; };
B09E942F0D747F410064F138 /* FFMPEGDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = B09E942E0D747F410064F138 /* FFMPEGDecoder.m */; };
/* End PBXBuildFile section */
@ -41,8 +40,6 @@
8352D49A1CDDB8B2009D16AA /* VideoToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = VideoToolbox.framework; path = System/Library/Frameworks/VideoToolbox.framework; sourceTree = SDKROOT; };
8352D49C1CDDB8C0009D16AA /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; };
8352D49E1CDDB8D7009D16AA /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; };
8352D4A01CDDC0BC009D16AA /* FFMPEGFileProtocols.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FFMPEGFileProtocols.h; sourceTree = "<group>"; };
8352D4A11CDDC0BC009D16AA /* FFMPEGFileProtocols.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FFMPEGFileProtocols.m; sourceTree = "<group>"; };
8384913818081F6C00E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = "<group>"; };
8D5B49B6048680CD000E48DA /* FFMPEG.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FFMPEG.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@ -119,8 +116,6 @@
B09E94370D747FAD0064F138 /* Plugin.h */,
B09E942D0D747F410064F138 /* FFMPEGDecoder.h */,
B09E942E0D747F410064F138 /* FFMPEGDecoder.m */,
8352D4A01CDDC0BC009D16AA /* FFMPEGFileProtocols.h */,
8352D4A11CDDC0BC009D16AA /* FFMPEGFileProtocols.m */,
);
name = Classes;
sourceTree = "<group>";
@ -226,7 +221,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8352D4A21CDDC0BC009D16AA /* FFMPEGFileProtocols.m in Sources */,
B09E942F0D747F410064F138 /* FFMPEGDecoder.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;

View File

@ -14,6 +14,7 @@
@interface FFMPEGDecoder : NSObject <CogDecoder>
{
id<CogSource> source;
BOOL seekable;
int channels;
int bitsPerSample;
@ -24,6 +25,8 @@
int bitrate;
@private
unsigned char *buffer;
AVIOContext *ioCtx;
int streamIndex;
AVFormatContext *formatCtx;
AVCodecContext *codecCtx;

View File

@ -8,7 +8,6 @@
// test
#import "FFMPEGDecoder.h"
#import "FFMPEGFileProtocols.h"
#include <pthread.h>
@ -16,6 +15,23 @@
#define ST_BUFF 2048
int ffmpeg_read(void *opaque, uint8_t *buf, int buf_size)
{
id source = (__bridge id) opaque;
return (int) [source read:buf amount:buf_size];
}
int ffmpeg_write(void *opaque, uint8_t *buf, int buf_size)
{
return -1;
}
int64_t ffmpeg_seek(void *opaque, int64_t offset, int whence)
{
id source = (__bridge id) opaque;
return [source seek:offset whence:whence] ? [source tell] : -1;
}
@implementation FFMPEGDecoder
@ -52,7 +68,6 @@ int lockmgr_callback(void ** mutex, enum AVLockOp op)
av_log_set_flags(AV_LOG_SKIP_REPEATED);
av_log_set_level(AV_LOG_ERROR);
av_register_all();
registerCogProtocols();
av_lockmgr_register(lockmgr_callback);
}
}
@ -65,6 +80,8 @@ int lockmgr_callback(void ** mutex, enum AVLockOp op)
lastDecodedFrame = NULL;
codecCtx = NULL;
formatCtx = NULL;
ioCtx = NULL;
buffer = NULL;
}
return self;
}
@ -72,32 +89,60 @@ int lockmgr_callback(void ** mutex, enum AVLockOp op)
- (BOOL)open:(id<CogSource>)s
{
int errcode, i;
const char *filename = [[[[s url] absoluteString] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding] UTF8String];
source = s;
formatCtx = NULL;
totalFrames = 0;
framesRead = 0;
// register all available codecs
buffer = av_malloc(128 * 1024);
if (!buffer)
{
ALog(@"Out of memory!");
return NO;
}
ioCtx = avio_alloc_context(buffer, 128 * 1024, 0, (__bridge void *)source, ffmpeg_read, ffmpeg_write, ffmpeg_seek);
if (!ioCtx)
{
ALog(@"Unable to create AVIO context");
return NO;
}
formatCtx = avformat_alloc_context();
if (!formatCtx)
{
ALog(@"Unable to allocate AVFormat context");
return NO;
}
formatCtx->pb = ioCtx;
if ((errcode = avformat_open_input(&formatCtx, filename, NULL, NULL)) < 0)
if ((errcode = avformat_open_input(&formatCtx, "", NULL, NULL)) < 0)
{
char errDescr[4096];
av_strerror(errcode, errDescr, 4096);
ALog(@"ERROR OPENING FILE, errcode = %d, error = %s", errcode, errDescr);
ALog(@"Error opening file, errcode = %d, error = %s", errcode, errDescr);
return NO;
}
if(avformat_find_stream_info(formatCtx, NULL) < 0)
if((errcode = avformat_find_stream_info(formatCtx, NULL)) < 0)
{
ALog(@"CAN'T FIND STREAM INFO!");
char errDescr[4096];
av_strerror(errcode, errDescr, 4096);
ALog(@"Can't find stream info, errcode = %d, error = %s", errcode, errDescr);
return NO;
}
streamIndex = -1;
AVCodecParameters *codecPar;
for(i = 0; i < formatCtx->nb_streams; i++) {
codecCtx = formatCtx->streams[i]->codec;
if(codecCtx->codec_type == AVMEDIA_TYPE_AUDIO)
codecPar = formatCtx->streams[i]->codecpar;
if(codecPar->codec_type == AVMEDIA_TYPE_AUDIO)
{
DLog(@"audio codec found");
streamIndex = i;
@ -109,6 +154,23 @@ int lockmgr_callback(void ** mutex, enum AVLockOp op)
ALog(@"no audio codec found");
return NO;
}
codecCtx = avcodec_alloc_context3(NULL);
if (!codecCtx)
{
ALog(@"could not allocate codec context");
return NO;
}
if ( (errcode = avcodec_parameters_to_context(codecCtx, codecPar)) < 0 )
{
char errDescr[4096];
av_strerror(errcode, errDescr, 4096);
ALog(@"Can't copy codec parameters to context, errcode = %d, error = %s", errcode, errDescr);
return NO;
}
av_codec_set_pkt_timebase(codecCtx, formatCtx->streams[streamIndex]->time_base);
AVCodec * codec = avcodec_find_decoder(codecCtx->codec_id);
if (!codec) {
@ -116,8 +178,10 @@ int lockmgr_callback(void ** mutex, enum AVLockOp op)
return NO;
}
if (avcodec_open2(codecCtx, codec, NULL) < 0) {
ALog(@"could not open codec");
if ( (errcode = avcodec_open2(codecCtx, codec, NULL)) < 0) {
char errDescr[4096];
av_strerror(errcode, errDescr, 4096);
ALog(@"could not open codec, errcode = %d, error = %s", errcode, errDescr);
return NO;
}
@ -165,7 +229,7 @@ int lockmgr_callback(void ** mutex, enum AVLockOp op)
}
totalFrames = codecCtx->sample_rate * ((float)formatCtx->duration/AV_TIME_BASE);
bitrate = (codecCtx->bit_rate) / 1000;
bitrate = (int)((codecCtx->bit_rate) / 1000);
framesRead = 0;
endOfStream = NO;
@ -188,9 +252,13 @@ int lockmgr_callback(void ** mutex, enum AVLockOp op)
if (lastDecodedFrame) { av_free(lastDecodedFrame); lastDecodedFrame = NULL; }
if (codecCtx) { avcodec_close(codecCtx); codecCtx = NULL; }
if (codecCtx) { avcodec_close(codecCtx); avcodec_free_context(&codecCtx); codecCtx = NULL; }
if (formatCtx) { avformat_close_input(&(formatCtx)); formatCtx = NULL; }
if (ioCtx) { av_free(ioCtx); ioCtx = NULL; buffer = NULL; }
if (buffer) { av_free(buffer); buffer = NULL; }
}
- (void)dealloc
@ -210,6 +278,8 @@ int lockmgr_callback(void ** mutex, enum AVLockOp op)
int bytesToRead = frames * frameSize;
int bytesRead = 0;
int errcode;
int8_t* targetBuf = (int8_t*) buf;
memset(buf, 0, bytesToRead);
@ -230,10 +300,14 @@ int lockmgr_callback(void ** mutex, enum AVLockOp op)
{
// consume next chunk of encoded data from input stream
av_packet_unref(lastReadPacket);
if(av_read_frame(formatCtx, lastReadPacket) < 0)
if((errcode = av_read_frame(formatCtx, lastReadPacket)) < 0)
{
DLog(@"End of stream");
endOfStream = YES;
if (errcode == AVERROR_EOF)
{
DLog(@"End of stream");
endOfStream = YES;
}
if (formatCtx->pb && formatCtx->pb->error) break;
}
if (lastReadPacket->stream_index != streamIndex)
@ -269,10 +343,9 @@ int lockmgr_callback(void ** mutex, enum AVLockOp op)
} while (!gotFrame && len > 0);
if (len < 0)
{
char errbuf[4096];
av_strerror(len, errbuf, 4096);
ALog(@"Error decoding: len = %d, gotFrame = %d, strerr = %s", len, gotFrame, errbuf);
char errDescr[4096];
av_strerror(len, errDescr, 4096);
ALog(@"Error decoding packet, gotFrame = %d, errcode = %d, error = %s", gotFrame, len, errDescr);
dataSize = 0;
readNextPacket = YES;
}
@ -313,7 +386,7 @@ int lockmgr_callback(void ** mutex, enum AVLockOp op)
int framesReadNow = bytesRead / frameSize;
if ( totalFrames && ( framesRead + framesReadNow > totalFrames ) )
framesReadNow = totalFrames - framesRead;
framesReadNow = (int)(totalFrames - framesRead);
framesRead += framesReadNow;
@ -361,7 +434,7 @@ int lockmgr_callback(void ** mutex, enum AVLockOp op)
+ (NSArray *)fileTypes
{
return [NSArray arrayWithObjects:@"wma", @"asf", @"xwma", @"tak", @"mp3", @"mp2", @"m2a", @"mpa", @"ape", @"ac3", @"dts", @"dtshd", @"at3", @"wav", @"tta", @"vqf", @"vqe", @"vql", nil];
return [NSArray arrayWithObjects:@"wma", @"asf", @"xwma", @"xma", @"tak", @"mp3", @"mp2", @"m2a", @"mpa", @"ape", @"ac3", @"dts", @"dtshd", @"at3", @"wav", @"tta", @"vqf", @"vqe", @"vql", nil];
}
+ (NSArray *)mimeTypes

View File

@ -1,15 +0,0 @@
//
// FFMPEGFileProtocols.h
// FFMPEG
//
// Created by Christopher Snowhill on 10/4/13.
// Copyright 2013 __NoWork, Inc__. All rights reserved.
//
#ifdef __cplusplus
extern "C" {
#endif
extern void registerCogProtocols();
#ifdef __cplusplus
};
#endif

View File

@ -1,150 +0,0 @@
//
// FFMPEGFileProtocols.m
// FFMPEG
//
// Created by Christopher Snowhill on 10/4/13.
// Copyright 2013 __NoWork, Inc__. All rights reserved.
//
#include "Plugin.h"
#include <libavformat/avformat.h>
#include <libavformat/url.h> // INTERNAL
#include <libavutil/opt.h>
/* standard file protocol */
typedef struct FileContext {
const AVClass *class;
void *fd;
} FileContext;
static const AVOption file_options[] = {
{ NULL }
};
static const AVClass file_class = {
.class_name = "file",
.item_name = av_default_item_name,
.option = file_options,
.version = LIBAVUTIL_VERSION_INT,
};
static const AVClass http_class = {
.class_name = "http",
.item_name = av_default_item_name,
.option = file_options,
.version = LIBAVUTIL_VERSION_INT,
};
static const AVClass unpack_class = {
.class_name = "unpack",
.item_name = av_default_item_name,
.option = file_options,
.version = LIBAVUTIL_VERSION_INT,
};
static int file_read(URLContext *h, unsigned char *buf, int size)
{
FileContext *c = h->priv_data;
NSObject* _fd = (__bridge NSObject *)(c->fd);
id<CogSource> __unsafe_unretained fd = (id) _fd;
return [fd read:buf amount:size];
}
static int file_check(URLContext *h, int mask)
{
return mask & AVIO_FLAG_READ;
}
static int file_open(URLContext *h, const char *filename, int flags)
{
FileContext *c = h->priv_data;
id<CogSource> fd;
if (flags & AVIO_FLAG_WRITE) {
return -1;
}
NSString * urlString = [NSString stringWithUTF8String:filename];
NSURL * url = [NSURL URLWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
id audioSourceClass = NSClassFromString(@"AudioSource");
fd = [audioSourceClass audioSourceForURL:url];
if (![fd open:url])
return -1;
c->fd = (void*)CFBridgingRetain(fd);
return 0;
}
static int http_open(URLContext *h, const char *filename, int flags)
{
int rval = file_open( h, filename, flags );
h->is_streamed = 1;
return rval;
}
/* XXX: use llseek */
static int64_t file_seek(URLContext *h, int64_t pos, int whence)
{
FileContext *c = h->priv_data;
NSObject* _fd = (__bridge NSObject *)(c->fd);
id<CogSource> __unsafe_unretained fd = (id) _fd;
return [fd seek:pos whence:whence] ? [fd tell] : -1;
}
static int64_t http_seek(URLContext *h, int64_t pos, int whence)
{
return -1;
}
static int file_close(URLContext *h)
{
FileContext *c = h->priv_data;
CFBridgingRelease(c->fd);
return 0;
}
static URLProtocol ff_file_protocol = {
.name = "file",
.url_open = file_open,
.url_read = file_read,
.url_seek = file_seek,
.url_close = file_close,
.url_check = file_check,
.priv_data_size = sizeof(FileContext),
.priv_data_class = &file_class,
};
static URLProtocol ff_http_protocol = {
.name = "http",
.url_open = http_open,
.url_read = file_read,
.url_seek = http_seek,
.url_close = file_close,
.url_check = file_check,
.priv_data_size = sizeof(FileContext),
.flags = URL_PROTOCOL_FLAG_NETWORK,
.priv_data_class = &http_class,
};
static URLProtocol ff_unpack_protocol = {
.name = "unpack",
.url_open = file_open,
.url_read = file_read,
.url_seek = file_seek,
.url_close = file_close,
.url_check = file_check,
.priv_data_size = sizeof(FileContext),
.priv_data_class = &unpack_class,
};
void registerCogProtocols()
{
ffurl_register_protocol(&ff_file_protocol);
ffurl_register_protocol(&ff_http_protocol);
ffurl_register_protocol(&ff_unpack_protocol);
}

View File

@ -8,13 +8,14 @@
--disable-dxva2 --enable-hwaccels\
--disable-encoders --disable-muxers --disable-indevs --disable-outdevs\
--disable-devices --disable-filters --disable-parsers --enable-parser=ac3\
--enable-parser=mpegaudio\
--enable-demuxer=ac3 --disable-bsfs --disable-bzlib --disable-protocols\
--disable-decoders --disable-decoder=libopus --disable-libopus\
--enable-decoder=wmapro --enable-decoder=wmav1 --enable-decoder=wmav2\
--enable-decoder=wmavoice --enable-decoder=wmalossless --enable-decoder=xma1\
--enable-decoder=xma2 --enable-decoder=dca --enable-decoder=ac3\
--disable-decoder=amrnb\
--disable-demuxers --enable-demuxer=asf\
--disable-demuxers --enable-demuxer=asf --enable-demuxer=xwma\
--enable-demuxer=mov --enable-demuxer=oma --enable-demuxer=ac3\
--disable-demuxer=amr --enable-demuxer=ogg\
--enable-demuxer=tak --enable-decoder=tak\
@ -26,7 +27,6 @@
--enable-demuxer=dts --enable-demuxer=dtshd\
--enable-demuxer=mp3 --enable-decoder=mp3float\
--disable-libopencore-amrnb --disable-libopencore-amrwb\
--disable-version3 --disable-mmx\
--disable-yasm
--disable-version3
make -j8

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,46 @@
/*
* JNI public API functions
*
* Copyright (c) 2015-2016 Matthieu Bouron <matthieu.bouron stupeflix.com>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_JNI_H
#define AVCODEC_JNI_H
/*
* Manually set a Java virtual machine which will be used to retrieve the JNI
* environment. Once a Java VM is set it cannot be changed afterwards, meaning
* you can call multiple times av_jni_set_java_vm with the same Java VM pointer
* however it will error out if you try to set a different Java VM.
*
* @param vm Java virtual machine
* @param log_ctx context used for logging, can be NULL
* @return 0 on success, < 0 otherwise
*/
int av_jni_set_java_vm(void *vm, void *log_ctx);
/*
* Get the Java virtual machine which has been set with av_jni_set_java_vm.
*
* @param vm Java virtual machine
* @return a pointer to the Java virtual machine
*/
void *av_jni_get_java_vm(void *log_ctx);
#endif /* AVCODEC_JNI_H */

View File

@ -1,5 +1,4 @@
/*
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
@ -29,8 +28,8 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 57
#define LIBAVCODEC_VERSION_MINOR 24
#define LIBAVCODEC_VERSION_MICRO 102
#define LIBAVCODEC_VERSION_MINOR 48
#define LIBAVCODEC_VERSION_MICRO 101
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
@ -212,5 +211,20 @@
#ifndef FF_API_PRIVATE_OPT
#define FF_API_PRIVATE_OPT (LIBAVCODEC_VERSION_MAJOR < 59)
#endif
#ifndef FF_API_ASS_TIMING
#define FF_API_ASS_TIMING (LIBAVCODEC_VERSION_MAJOR < 59)
#endif
#ifndef FF_API_OLD_BSF
#define FF_API_OLD_BSF (LIBAVCODEC_VERSION_MAJOR < 59)
#endif
#ifndef FF_API_COPY_CONTEXT
#define FF_API_COPY_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59)
#endif
#ifndef FF_API_GET_CONTEXT_DEFAULTS
#define FF_API_GET_CONTEXT_DEFAULTS (LIBAVCODEC_VERSION_MAJOR < 59)
#endif
#ifndef FF_API_NVENC_OLD_NAME
#define FF_API_NVENC_OLD_NAME (LIBAVCODEC_VERSION_MAJOR < 59)
#endif
#endif /* AVCODEC_VERSION_H */

View File

@ -1,5 +1,4 @@
/*
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or

View File

@ -161,8 +161,8 @@
* av_read_frame() on it. Each call, if successful, will return an AVPacket
* containing encoded data for one AVStream, identified by
* AVPacket.stream_index. This packet may be passed straight into the libavcodec
* decoding functions avcodec_decode_video2(), avcodec_decode_audio4() or
* avcodec_decode_subtitle2() if the caller wishes to decode the data.
* decoding functions avcodec_send_packet() or avcodec_decode_subtitle2() if the
* caller wishes to decode the data.
*
* AVPacket.pts, AVPacket.dts and AVPacket.duration timing information will be
* set if known. They may also be unset (i.e. AV_NOPTS_VALUE for
@ -203,15 +203,15 @@
* avio_open2() or a custom one.
* - Unless the format is of the AVFMT_NOSTREAMS type, at least one stream must
* be created with the avformat_new_stream() function. The caller should fill
* the @ref AVStream.codec "stream codec context" information, such as the
* codec @ref AVCodecContext.codec_type "type", @ref AVCodecContext.codec_id
* the @ref AVStream.codecpar "stream codec parameters" information, such as the
* codec @ref AVCodecParameters.codec_type "type", @ref AVCodecParameters.codec_id
* "id" and other parameters (e.g. width / height, the pixel or sample format,
* etc.) as known. The @ref AVStream.time_base "stream timebase" should
* be set to the timebase that the caller desires to use for this stream (note
* that the timebase actually used by the muxer can be different, as will be
* described later).
* - It is advised to manually initialize only the relevant fields in
* AVCodecContext, rather than using @ref avcodec_copy_context() during
* AVCodecParameters, rather than using @ref avcodec_parameters_copy() during
* remuxing: there is no guarantee that the codec context values remain valid
* for both input and output format contexts.
* - The caller may fill in additional information, such as @ref
@ -310,7 +310,6 @@
* @{
* @}
* @}
*
*/
#include <time.h>
@ -528,7 +527,7 @@ typedef struct AVOutputFormat {
* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER,
* AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS,
* AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH,
* AVFMT_TS_NONSTRICT
* AVFMT_TS_NONSTRICT, AVFMT_TS_NEGATIVE
*/
int flags;
@ -873,18 +872,13 @@ typedef struct AVStream {
* encoding: set by the user, replaced by libavformat if left unset
*/
int id;
#if FF_API_LAVF_AVCTX
/**
* Codec context associated with this stream. Allocated and freed by
* libavformat.
*
* - decoding: The demuxer exports codec information stored in the headers
* here.
* - encoding: The user sets codec information, the muxer writes it to the
* output. Mandatory fields as specified in AVCodecContext
* documentation must be set even if this AVCodecContext is
* not actually used for encoding.
* @deprecated use the codecpar struct instead
*/
attribute_deprecated
AVCodecContext *codec;
#endif
void *priv_data;
#if FF_API_LAVF_FRAC
@ -1212,6 +1206,17 @@ typedef struct AVStream {
* Must not be accessed in any way by callers.
*/
AVStreamInternal *internal;
/*
* Codec parameters associated with this stream. Allocated and freed by
* libavformat in avformat_new_stream() and avformat_free_context()
* respectively.
*
* - demuxing: filled by libavformat on stream creation or in
* avformat_find_stream_info()
* - muxing: filled by the caller before avformat_write_header()
*/
AVCodecParameters *codecpar;
} AVStream;
AVRational av_stream_get_r_frame_rate(const AVStream *s);
@ -1300,6 +1305,12 @@ typedef struct AVFormatInternal AVFormatInternal;
* version bump.
* sizeof(AVFormatContext) must not be used outside libav*, use
* avformat_alloc_context() to create an AVFormatContext.
*
* Fields can be accessed through AVOptions (av_opt*),
* the name string used matches the associated command line parameter name and
* can be found in libavformat/options_table.h.
* The AVOption/command line parameter names differ in some cases from the C
* structure field names for historic reasons or brevity.
*/
typedef struct AVFormatContext {
/**
@ -1842,9 +1853,9 @@ typedef struct AVFormatContext {
/*
* A callback for opening new IO streams.
*
* Certain muxers or demuxers (e.g. for various playlist-based formats) need
* to open additional files during muxing or demuxing. This callback allows
* the caller to provide custom IO in such cases.
* Whenever a muxer or a demuxer needs to open an IO stream (typically from
* avformat_open_input() for demuxers, but for certain formats can happen at
* other times as well), it will call this callback to obtain an IO context.
*
* @param s the format context
* @param pb on success, the newly opened IO context should be returned here
@ -1866,6 +1877,13 @@ typedef struct AVFormatContext {
* A callback for closing the streams opened with AVFormatContext.io_open().
*/
void (*io_close)(struct AVFormatContext *s, AVIOContext *pb);
/**
* ',' separated list of disallowed protocols.
* - encoding: unused
* - decoding: set by user through AVOptions (NO direct access)
*/
char *protocol_blacklist;
} AVFormatContext;
int av_format_get_probe_score(const AVFormatContext *s);
@ -2409,6 +2427,10 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt);
* increasing dts. Callers doing their own interleaving should call
* av_write_frame() instead of this function.
*
* Using this function instead of av_write_frame() can give muxers advance
* knowledge of future packets, improving e.g. the behaviour of the mp4
* muxer for VFR content in fragmenting mode.
*
* @param s media file handle
* @param pkt The packet containing the data to be written.
* <br>
@ -2443,7 +2465,7 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt);
int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt);
/**
* Write a uncoded frame to an output media file.
* Write an uncoded frame to an output media file.
*
* The frame must be correctly interleaved according to the container
* specification; if not, then av_interleaved_write_frame() must be used.
@ -2454,7 +2476,7 @@ int av_write_uncoded_frame(AVFormatContext *s, int stream_index,
AVFrame *frame);
/**
* Write a uncoded frame to an output media file.
* Write an uncoded frame to an output media file.
*
* If the muxer supports it, this function makes it possible to write an AVFrame
* structure directly, without encoding it into a packet.
@ -2844,13 +2866,18 @@ int avformat_queue_attached_pictures(AVFormatContext *s);
* Apply a list of bitstream filters to a packet.
*
* @param codec AVCodecContext, usually from an AVStream
* @param pkt the packet to apply filters to
* @param pkt the packet to apply filters to. If, on success, the returned
* packet has size == 0 and side_data_elems == 0, it indicates that
* the packet should be dropped
* @param bsfc a NULL-terminated list of filters to apply
* @return >=0 on success;
* AVERROR code on failure
*/
#if FF_API_OLD_BSF
attribute_deprecated
int av_apply_bitstream_filters(AVCodecContext *codec, AVPacket *pkt,
AVBitStreamFilterContext *bsfc);
#endif
/**
* @}

View File

@ -96,6 +96,42 @@ typedef struct AVIODirContext {
struct URLContext *url_context;
} AVIODirContext;
/**
* Different data types that can be returned via the AVIO
* write_data_type callback.
*/
enum AVIODataMarkerType {
/**
* Header data; this needs to be present for the stream to be decodeable.
*/
AVIO_DATA_MARKER_HEADER,
/**
* A point in the output bytestream where a decoder can start decoding
* (i.e. a keyframe). A demuxer/decoder given the data flagged with
* AVIO_DATA_MARKER_HEADER, followed by any AVIO_DATA_MARKER_SYNC_POINT,
* should give decodeable results.
*/
AVIO_DATA_MARKER_SYNC_POINT,
/**
* A point in the output bytestream where a demuxer can start parsing
* (for non self synchronizing bytestream formats). That is, any
* non-keyframe packet start point.
*/
AVIO_DATA_MARKER_BOUNDARY_POINT,
/**
* This is any, unlabelled data. It can either be a muxer not marking
* any positions at all, it can be an actual boundary/sync point
* that the muxer chooses not to mark, or a later part of a packet/fragment
* that is cut into multiple write callbacks due to limited IO buffer size.
*/
AVIO_DATA_MARKER_UNKNOWN,
/**
* Trailer data, which doesn't contain actual content, but only for
* finalizing the output file.
*/
AVIO_DATA_MARKER_TRAILER
};
/**
* Bytestream IO Context.
* New fields can be added to the end with minor version bumps.
@ -254,9 +290,30 @@ typedef struct AVIOContext {
* ',' separated list of allowed protocols.
*/
const char *protocol_whitelist;
} AVIOContext;
/* unbuffered I/O */
/**
* ',' separated list of disallowed protocols.
*/
const char *protocol_blacklist;
/**
* A callback that is used instead of write_packet.
*/
int (*write_data_type)(void *opaque, uint8_t *buf, int buf_size,
enum AVIODataMarkerType type, int64_t time);
/**
* If set, don't call write_data_type separately for AVIO_DATA_MARKER_BOUNDARY_POINT,
* but ignore them and treat them as AVIO_DATA_MARKER_UNKNOWN (to avoid needlessly
* small chunks of data returned from the callback).
*/
int ignore_boundary_point;
/**
* Internal, not meant to be used from outside of AVIOContext.
*/
enum AVIODataMarkerType current_type;
int64_t last_time;
} AVIOContext;
/**
* Return the name of the protocol that will handle the passed URL.
@ -409,14 +466,26 @@ int avio_put_str16le(AVIOContext *s, const char *str);
int avio_put_str16be(AVIOContext *s, const char *str);
/**
* Passing this as the "whence" parameter to a seek function causes it to
* Mark the written bytestream as a specific type.
*
* Zero-length ranges are omitted from the output.
*
* @param time the stream time the current bytestream pos corresponds to
* (in AV_TIME_BASE units), or AV_NOPTS_VALUE if unknown or not
* applicable
* @param type the kind of data written starting at the current pos
*/
void avio_write_marker(AVIOContext *s, int64_t time, enum AVIODataMarkerType type);
/**
* ORing this as the "whence" parameter to a seek function causes it to
* return the filesize without seeking anywhere. Supporting this is optional.
* If it is not supported then the seek function will return <0.
*/
#define AVSEEK_SIZE 0x10000
/**
* Oring this flag as into the "whence" parameter to a seek function causes it to
* Passing this flag as the "whence" parameter to a seek function causes it to
* seek by any means (like reopening and linear reading) or other normally unreasonable
* means that can be extremely slow.
* This may be ignored by the seek code.

View File

@ -1,327 +0,0 @@
/*
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* unbuffered private I/O API
*/
#ifndef AVFORMAT_URL_H
#define AVFORMAT_URL_H
#include "avio.h"
#include "libavformat/version.h"
#include "libavutil/dict.h"
#include "libavutil/log.h"
#define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */
#define URL_PROTOCOL_FLAG_NETWORK 2 /*< The protocol uses network */
extern const AVClass ffurl_context_class;
typedef struct URLContext {
const AVClass *av_class; /**< information for av_log(). Set by url_open(). */
struct URLProtocol *prot;
void *priv_data;
char *filename; /**< specified URL */
int flags;
int max_packet_size; /**< if non zero, the stream is packetized with this max packet size */
int is_streamed; /**< true if streamed (no seek possible), default = false */
int is_connected;
AVIOInterruptCB interrupt_callback;
int64_t rw_timeout; /**< maximum time to wait for (network) read/write operation completion, in mcs */
const char *protocol_whitelist;
} URLContext;
typedef struct URLProtocol {
const char *name;
int (*url_open)( URLContext *h, const char *url, int flags);
/**
* This callback is to be used by protocols which open further nested
* protocols. options are then to be passed to ffurl_open()/ffurl_connect()
* for those nested protocols.
*/
int (*url_open2)(URLContext *h, const char *url, int flags, AVDictionary **options);
int (*url_accept)(URLContext *s, URLContext **c);
int (*url_handshake)(URLContext *c);
/**
* Read data from the protocol.
* If data is immediately available (even less than size), EOF is
* reached or an error occurs (including EINTR), return immediately.
* Otherwise:
* In non-blocking mode, return AVERROR(EAGAIN) immediately.
* In blocking mode, wait for data/EOF/error with a short timeout (0.1s),
* and return AVERROR(EAGAIN) on timeout.
* Checking interrupt_callback, looping on EINTR and EAGAIN and until
* enough data has been read is left to the calling function; see
* retry_transfer_wrapper in avio.c.
*/
int (*url_read)( URLContext *h, unsigned char *buf, int size);
int (*url_write)(URLContext *h, const unsigned char *buf, int size);
int64_t (*url_seek)( URLContext *h, int64_t pos, int whence);
int (*url_close)(URLContext *h);
struct URLProtocol *next;
int (*url_read_pause)(URLContext *h, int pause);
int64_t (*url_read_seek)(URLContext *h, int stream_index,
int64_t timestamp, int flags);
int (*url_get_file_handle)(URLContext *h);
int (*url_get_multi_file_handle)(URLContext *h, int **handles,
int *numhandles);
int (*url_shutdown)(URLContext *h, int flags);
int priv_data_size;
const AVClass *priv_data_class;
int flags;
int (*url_check)(URLContext *h, int mask);
int (*url_open_dir)(URLContext *h);
int (*url_read_dir)(URLContext *h, AVIODirEntry **next);
int (*url_close_dir)(URLContext *h);
int (*url_delete)(URLContext *h);
int (*url_move)(URLContext *h_src, URLContext *h_dst);
const char *default_whitelist;
} URLProtocol;
/**
* Create a URLContext for accessing to the resource indicated by
* url, but do not initiate the connection yet.
*
* @param puc pointer to the location where, in case of success, the
* function puts the pointer to the created URLContext
* @param flags flags which control how the resource indicated by url
* is to be opened
* @param int_cb interrupt callback to use for the URLContext, may be
* NULL
* @return >= 0 in case of success, a negative value corresponding to an
* AVERROR code in case of failure
*/
int ffurl_alloc(URLContext **puc, const char *filename, int flags,
const AVIOInterruptCB *int_cb);
/**
* Connect an URLContext that has been allocated by ffurl_alloc
*
* @param options A dictionary filled with options for nested protocols,
* i.e. it will be passed to url_open2() for protocols implementing it.
* This parameter will be destroyed and replaced with a dict containing options
* that were not found. May be NULL.
*/
int ffurl_connect(URLContext *uc, AVDictionary **options);
/**
* Create an URLContext for accessing to the resource indicated by
* url, and open it.
*
* @param puc pointer to the location where, in case of success, the
* function puts the pointer to the created URLContext
* @param flags flags which control how the resource indicated by url
* is to be opened
* @param int_cb interrupt callback to use for the URLContext, may be
* NULL
* @param options A dictionary filled with protocol-private options. On return
* this parameter will be destroyed and replaced with a dict containing options
* that were not found. May be NULL.
* @return >= 0 in case of success, a negative value corresponding to an
* AVERROR code in case of failure
*/
int ffurl_open_whitelist(URLContext **puc, const char *filename, int flags,
const AVIOInterruptCB *int_cb, AVDictionary **options,
const char *whitelist);
int ffurl_open(URLContext **puc, const char *filename, int flags,
const AVIOInterruptCB *int_cb, AVDictionary **options);
/**
* Accept an URLContext c on an URLContext s
*
* @param s server context
* @param c client context, must be unallocated.
* @return >= 0 on success, ff_neterrno() on failure.
*/
int ffurl_accept(URLContext *s, URLContext **c);
/**
* Perform one step of the protocol handshake to accept a new client.
* See avio_handshake() for details.
* Implementations should try to return decreasing values.
* If the protocol uses an underlying protocol, the underlying handshake is
* usually the first step, and the return value can be:
* (largest value for this protocol) + (return value from other protocol)
*
* @param c the client context
* @return >= 0 on success or a negative value corresponding
* to an AVERROR code on failure
*/
int ffurl_handshake(URLContext *c);
/**
* Read up to size bytes from the resource accessed by h, and store
* the read bytes in buf.
*
* @return The number of bytes actually read, or a negative value
* corresponding to an AVERROR code in case of error. A value of zero
* indicates that it is not possible to read more from the accessed
* resource (except if the value of the size argument is also zero).
*/
int ffurl_read(URLContext *h, unsigned char *buf, int size);
/**
* Read as many bytes as possible (up to size), calling the
* read function multiple times if necessary.
* This makes special short-read handling in applications
* unnecessary, if the return value is < size then it is
* certain there was either an error or the end of file was reached.
*/
int ffurl_read_complete(URLContext *h, unsigned char *buf, int size);
/**
* Write size bytes from buf to the resource accessed by h.
*
* @return the number of bytes actually written, or a negative value
* corresponding to an AVERROR code in case of failure
*/
int ffurl_write(URLContext *h, const unsigned char *buf, int size);
/**
* Change the position that will be used by the next read/write
* operation on the resource accessed by h.
*
* @param pos specifies the new position to set
* @param whence specifies how pos should be interpreted, it must be
* one of SEEK_SET (seek from the beginning), SEEK_CUR (seek from the
* current position), SEEK_END (seek from the end), or AVSEEK_SIZE
* (return the filesize of the requested resource, pos is ignored).
* @return a negative value corresponding to an AVERROR code in case
* of failure, or the resulting file position, measured in bytes from
* the beginning of the file. You can use this feature together with
* SEEK_CUR to read the current file position.
*/
int64_t ffurl_seek(URLContext *h, int64_t pos, int whence);
/**
* Close the resource accessed by the URLContext h, and free the
* memory used by it. Also set the URLContext pointer to NULL.
*
* @return a negative value if an error condition occurred, 0
* otherwise
*/
int ffurl_closep(URLContext **h);
int ffurl_close(URLContext *h);
/**
* Return the filesize of the resource accessed by h, AVERROR(ENOSYS)
* if the operation is not supported by h, or another negative value
* corresponding to an AVERROR error code in case of failure.
*/
int64_t ffurl_size(URLContext *h);
/**
* Return the file descriptor associated with this URL. For RTP, this
* will return only the RTP file descriptor, not the RTCP file descriptor.
*
* @return the file descriptor associated with this URL, or <0 on error.
*/
int ffurl_get_file_handle(URLContext *h);
/**
* Return the file descriptors associated with this URL.
*
* @return 0 on success or <0 on error.
*/
int ffurl_get_multi_file_handle(URLContext *h, int **handles, int *numhandles);
/**
* Signal the URLContext that we are done reading or writing the stream.
*
* @param h pointer to the resource
* @param flags flags which control how the resource indicated by url
* is to be shutdown
*
* @return a negative value if an error condition occurred, 0
* otherwise
*/
int ffurl_shutdown(URLContext *h, int flags);
/**
* Register the URLProtocol protocol.
*/
int ffurl_register_protocol(URLProtocol *protocol);
/**
* Check if the user has requested to interrup a blocking function
* associated with cb.
*/
int ff_check_interrupt(AVIOInterruptCB *cb);
/**
* Iterate over all available protocols.
*
* @param prev result of the previous call to this functions or NULL.
*/
URLProtocol *ffurl_protocol_next(const URLProtocol *prev);
/* udp.c */
int ff_udp_set_remote_url(URLContext *h, const char *uri);
int ff_udp_get_local_port(URLContext *h);
/**
* Assemble a URL string from components. This is the reverse operation
* of av_url_split.
*
* Note, this requires networking to be initialized, so the caller must
* ensure ff_network_init has been called.
*
* @see av_url_split
*
* @param str the buffer to fill with the url
* @param size the size of the str buffer
* @param proto the protocol identifier, if null, the separator
* after the identifier is left out, too
* @param authorization an optional authorization string, may be null.
* An empty string is treated the same as a null string.
* @param hostname the host name string
* @param port the port number, left out from the string if negative
* @param fmt a generic format string for everything to add after the
* host/port, may be null
* @return the number of characters written to the destination buffer
*/
int ff_url_join(char *str, int size, const char *proto,
const char *authorization, const char *hostname,
int port, const char *fmt, ...) av_printf_format(7, 8);
/**
* Convert a relative url into an absolute url, given a base url.
*
* @param buf the buffer where output absolute url is written
* @param size the size of buf
* @param base the base url, may be equal to buf.
* @param rel the new url, which is interpreted relative to base
*/
void ff_make_absolute_url(char *buf, int size, const char *base,
const char *rel);
/**
* Allocate directory entry with default values.
*
* @return entry or NULL on error
*/
AVIODirEntry *ff_alloc_dir_entry(void);
#endif /* AVFORMAT_URL_H */

View File

@ -29,8 +29,10 @@
#include "libavutil/version.h"
// Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
// Also please add any ticket numbers that you belive might be affected here
#define LIBAVFORMAT_VERSION_MAJOR 57
#define LIBAVFORMAT_VERSION_MINOR 25
#define LIBAVFORMAT_VERSION_MINOR 41
#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
@ -74,6 +76,9 @@
#ifndef FF_API_OLD_OPEN_CALLBACKS
#define FF_API_OLD_OPEN_CALLBACKS (LIBAVFORMAT_VERSION_MAJOR < 58)
#endif
#ifndef FF_API_LAVF_AVCTX
#define FF_API_LAVF_AVCTX (LIBAVFORMAT_VERSION_MAJOR < 58)
#endif
#ifndef FF_API_R_FRAME_RATE
#define FF_API_R_FRAME_RATE 1

View File

@ -110,6 +110,23 @@ int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples);
*/
int av_audio_fifo_peek(AVAudioFifo *af, void **data, int nb_samples);
/**
* Peek data from an AVAudioFifo.
*
* @see enum AVSampleFormat
* The documentation for AVSampleFormat describes the data layout.
*
* @param af AVAudioFifo to read from
* @param data audio data plane pointers
* @param nb_samples number of samples to peek
* @param offset offset from current read position
* @return number of samples actually peek, or negative AVERROR code
* on failure. The number of samples actually peek will not
* be greater than nb_samples, and will only be less than
* nb_samples if av_audio_fifo_size is less than nb_samples.
*/
int av_audio_fifo_peek_at(AVAudioFifo *af, void **data, int nb_samples, int offset);
/**
* Read data from an AVAudioFifo.
*

View File

@ -45,7 +45,7 @@
/**
* assert() equivalent, that does not lie in speed critical code.
* These asserts() thus can be enabled without fearing speedloss.
* These asserts() thus can be enabled without fearing speed loss.
*/
#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0
#define av_assert1(cond) av_assert0(cond)

View File

@ -156,7 +156,7 @@ static inline size_t av_strnlen(const char *s, size_t len)
char *av_asprintf(const char *fmt, ...) av_printf_format(1, 2);
/**
* Convert a number to a av_malloced string.
* Convert a number to an av_malloced string.
*/
char *av_d2str(double d);

View File

@ -266,7 +266,7 @@ enum AVPictureType {
AV_PICTURE_TYPE_I, ///< Intra
AV_PICTURE_TYPE_P, ///< Predicted
AV_PICTURE_TYPE_B, ///< Bi-dir predicted
AV_PICTURE_TYPE_S, ///< S(GMC)-VOP MPEG4
AV_PICTURE_TYPE_S, ///< S(GMC)-VOP MPEG-4
AV_PICTURE_TYPE_SI, ///< Switching Intra
AV_PICTURE_TYPE_SP, ///< Switching Predicted
AV_PICTURE_TYPE_BI, ///< BI type

View File

@ -29,19 +29,24 @@
* @{
*/
/**
* Decode a base64-encoded string.
*
* @param out buffer for decoded data
* @param in null-terminated input string
* @param out_size size in bytes of the out buffer, must be at
* least 3/4 of the length of in
* least 3/4 of the length of in, that is AV_BASE64_DECODE_SIZE(strlen(in))
* @return number of bytes written, or a negative value in case of
* invalid input
*/
int av_base64_decode(uint8_t *out, const char *in, int out_size);
/**
* Calculate the output size in bytes needed to decode a base64 string
* with length x to a data buffer.
*/
#define AV_BASE64_DECODE_SIZE(x) ((x) * 3LL / 4)
/**
* Encode data to base64 and null-terminate.
*

View File

@ -248,6 +248,23 @@ typedef struct AVBufferPool AVBufferPool;
*/
AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size));
/**
* Allocate and initialize a buffer pool with a more complex allocator.
*
* @param size size of each buffer in this pool
* @param opaque arbitrary user data used by the allocator
* @param alloc a function that will be used to allocate new buffers when the
* pool is empty.
* @param pool_free a function that will be called immediately before the pool
* is freed. I.e. after av_buffer_pool_can_uninit() is called
* by the pool and all the frames are returned to the pool and
* freed. It is intended to uninitialize the user opaque data.
* @return newly created buffer pool on success, NULL on error.
*/
AVBufferPool *av_buffer_pool_init2(int size, void *opaque,
AVBufferRef* (*alloc)(void *opaque, int size),
void (*pool_free)(void *opaque));
/**
* Mark the pool as being available for freeing. It will actually be freed only
* once all the allocated buffers associated with the pool are released. Thus it
@ -255,7 +272,6 @@ AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size));
* in use.
*
* @param pool pointer to the pool to be freed. It will be set to NULL.
* @see av_buffer_pool_can_uninit()
*/
void av_buffer_pool_uninit(AVBufferPool **pool);

View File

@ -70,7 +70,7 @@
/**
* Return the flags which specify extensions supported by the CPU.
* The returned value is affected by av_force_cpu_flags() if that was used
* before. So av_get_cpu_flags() can easily be used in a application to
* before. So av_get_cpu_flags() can easily be used in an application to
* detect the enabled cpu flags.
*/
int av_get_cpu_flags(void);

View File

@ -1,5 +1,4 @@
/*
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
@ -65,7 +64,6 @@
}
av_dict_free(&d);
@endcode
*
*/
#define AV_DICT_MATCH_CASE 1 /**< Only get an entry with exact-case key match. Only relevant in av_dict_get(). */
@ -78,6 +76,7 @@
#define AV_DICT_DONT_OVERWRITE 16 ///< Don't overwrite existing entries.
#define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no
delimiter is added, the strings are simply concatenated. */
#define AV_DICT_MULTIKEY 64 /**< Allow to store several equal keys in the dictionary */
typedef struct AVDictionaryEntry {
char *key;
@ -118,10 +117,13 @@ int av_dict_count(const AVDictionary *m);
* Note: If AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL is set,
* these arguments will be freed on error.
*
* Warning: Adding a new entry to a dictionary invalidates all existing entries
* previously returned with av_dict_get.
*
* @param pm pointer to a pointer to a dictionary struct. If *pm is NULL
* a dictionary struct is allocated and put in *pm.
* @param key entry key to add to *pm (will be av_strduped depending on flags)
* @param value entry value to add to *pm (will be av_strduped depending on flags).
* @param key entry key to add to *pm (will either be av_strduped or added as a new key depending on flags)
* @param value entry value to add to *pm (will be av_strduped or added as a new key depending on flags).
* Passing a NULL value will cause an existing entry to be deleted.
* @return >= 0 on success otherwise an error code <0
*/

View File

@ -22,6 +22,7 @@
#define AVUTIL_DISPLAY_H
#include <stdint.h>
#include "common.h"
/**
* The display transformation matrix specifies an affine transformation that

View File

@ -1,5 +1,5 @@
/* Automatically generated by version.sh, do not manually edit! */
#ifndef AVUTIL_FFVERSION_H
#define AVUTIL_FFVERSION_H
#define FFMPEG_VERSION "n3.0.2"
#define FFMPEG_VERSION "n3.1.1"
#endif /* AVUTIL_FFVERSION_H */

View File

@ -62,6 +62,7 @@ void av_file_unmap(uint8_t *bufptr, size_t size);
* @note On very old libcs it is necessary to set a secure umask before
* calling this, av_tempfile() can't call umask itself as it is used in
* libraries and could interfere with the calling application.
* @deprecated as fd numbers cannot be passed saftely between libs on some platforms
*/
int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx);

View File

@ -1,5 +1,4 @@
/*
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
@ -177,6 +176,10 @@ typedef struct AVFrameSideData {
* Similarly fields that are marked as to be only accessed by
* av_opt_ptr() can be reordered. This allows 2 forks to add fields
* without breaking compatibility with each other.
*
* Fields can be accessed through AVOptions, the name string used, matches the
* C structure field name for fields accessable through AVOptions. The AVClass
* for AVFrame can be obtained from avcodec_get_frame_class()
*/
typedef struct AVFrame {
#define AV_NUM_DATA_POINTERS 8
@ -188,6 +191,9 @@ typedef struct AVFrame {
* see avcodec_align_dimensions2(). Some filters and swscale can read
* up to 16 bytes beyond the planes, if these filters are to be used,
* then 16 extra bytes must be allocated.
*
* NOTE: Except for hwaccel formats, pointers not needed by the format
* MUST be set to NULL.
*/
uint8_t *data[AV_NUM_DATA_POINTERS];
@ -322,7 +328,7 @@ typedef struct AVFrame {
int palette_has_changed;
/**
* reordered opaque 64bit (generally an integer or a double precision float
* reordered opaque 64 bits (generally an integer or a double precision float
* PTS but can be anything).
* The user sets AVCodecContext.reordered_opaque to represent the input at
* that time,
@ -512,6 +518,11 @@ typedef struct AVFrame {
*/
AVBufferRef *qp_table_buf;
#endif
/**
* For hwaccel-format frames, this should be a reference to the
* AVHWFramesContext describing the frame.
*/
AVBufferRef *hw_frames_ctx;
} AVFrame;
/**
@ -583,6 +594,10 @@ void av_frame_free(AVFrame **frame);
* If src is not reference counted, new buffers are allocated and the data is
* copied.
*
* @warning: dst MUST have been either unreferenced with av_frame_unref(dst),
* or newly allocated with av_frame_alloc() before calling this
* function, or undefined behavior will occur.
*
* @return 0 on success, a negative AVERROR on error
*/
int av_frame_ref(AVFrame *dst, const AVFrame *src);
@ -603,6 +618,10 @@ void av_frame_unref(AVFrame *frame);
/**
* Move everything contained in src to dst and reset src.
*
* @warning: dst is not unreferenced, but directly overwritten without reading
* or deallocating its contents. Call av_frame_unref(dst) manually
* before calling this function to ensure that no memory is leaked.
*/
void av_frame_move_ref(AVFrame *dst, AVFrame *src);
@ -618,6 +637,10 @@ void av_frame_move_ref(AVFrame *dst, AVFrame *src);
* necessary, allocate and fill AVFrame.extended_data and AVFrame.extended_buf.
* For planar formats, one buffer will be allocated for each plane.
*
* @warning: if frame already has been allocated, calling this function will
* leak memory. In addition, undefined behavior can occur in certain
* cases.
*
* @param frame frame in which to store the new buffers.
* @param align required buffer size alignment
*

View File

@ -0,0 +1,428 @@
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVUTIL_HWCONTEXT_H
#define AVUTIL_HWCONTEXT_H
#include "buffer.h"
#include "frame.h"
#include "log.h"
#include "pixfmt.h"
enum AVHWDeviceType {
AV_HWDEVICE_TYPE_VDPAU,
AV_HWDEVICE_TYPE_CUDA,
AV_HWDEVICE_TYPE_VAAPI,
AV_HWDEVICE_TYPE_DXVA2,
};
typedef struct AVHWDeviceInternal AVHWDeviceInternal;
/**
* This struct aggregates all the (hardware/vendor-specific) "high-level" state,
* i.e. state that is not tied to a concrete processing configuration.
* E.g., in an API that supports hardware-accelerated encoding and decoding,
* this struct will (if possible) wrap the state that is common to both encoding
* and decoding and from which specific instances of encoders or decoders can be
* derived.
*
* This struct is reference-counted with the AVBuffer mechanism. The
* av_hwdevice_ctx_alloc() constructor yields a reference, whose data field
* points to the actual AVHWDeviceContext. Further objects derived from
* AVHWDeviceContext (such as AVHWFramesContext, describing a frame pool with
* specific properties) will hold an internal reference to it. After all the
* references are released, the AVHWDeviceContext itself will be freed,
* optionally invoking a user-specified callback for uninitializing the hardware
* state.
*/
typedef struct AVHWDeviceContext {
/**
* A class for logging. Set by av_hwdevice_ctx_alloc().
*/
const AVClass *av_class;
/**
* Private data used internally by libavutil. Must not be accessed in any
* way by the caller.
*/
AVHWDeviceInternal *internal;
/**
* This field identifies the underlying API used for hardware access.
*
* This field is set when this struct is allocated and never changed
* afterwards.
*/
enum AVHWDeviceType type;
/**
* The format-specific data, allocated and freed by libavutil along with
* this context.
*
* Should be cast by the user to the format-specific context defined in the
* corresponding header (hwcontext_*.h) and filled as described in the
* documentation before calling av_hwdevice_ctx_init().
*
* After calling av_hwdevice_ctx_init() this struct should not be modified
* by the caller.
*/
void *hwctx;
/**
* This field may be set by the caller before calling av_hwdevice_ctx_init().
*
* If non-NULL, this callback will be called when the last reference to
* this context is unreferenced, immediately before it is freed.
*
* @note when other objects (e.g an AVHWFramesContext) are derived from this
* struct, this callback will be invoked after all such child objects
* are fully uninitialized and their respective destructors invoked.
*/
void (*free)(struct AVHWDeviceContext *ctx);
/**
* Arbitrary user data, to be used e.g. by the free() callback.
*/
void *user_opaque;
} AVHWDeviceContext;
typedef struct AVHWFramesInternal AVHWFramesInternal;
/**
* This struct describes a set or pool of "hardware" frames (i.e. those with
* data not located in normal system memory). All the frames in the pool are
* assumed to be allocated in the same way and interchangeable.
*
* This struct is reference-counted with the AVBuffer mechanism and tied to a
* given AVHWDeviceContext instance. The av_hwframe_ctx_alloc() constructor
* yields a reference, whose data field points to the actual AVHWFramesContext
* struct.
*/
typedef struct AVHWFramesContext {
/**
* A class for logging.
*/
const AVClass *av_class;
/**
* Private data used internally by libavutil. Must not be accessed in any
* way by the caller.
*/
AVHWFramesInternal *internal;
/**
* A reference to the parent AVHWDeviceContext. This reference is owned and
* managed by the enclosing AVHWFramesContext, but the caller may derive
* additional references from it.
*/
AVBufferRef *device_ref;
/**
* The parent AVHWDeviceContext. This is simply a pointer to
* device_ref->data provided for convenience.
*
* Set by libavutil in av_hwframe_ctx_init().
*/
AVHWDeviceContext *device_ctx;
/**
* The format-specific data, allocated and freed automatically along with
* this context.
*
* Should be cast by the user to the format-specific context defined in the
* corresponding header (hwframe_*.h) and filled as described in the
* documentation before calling av_hwframe_ctx_init().
*
* After any frames using this context are created, the contents of this
* struct should not be modified by the caller.
*/
void *hwctx;
/**
* This field may be set by the caller before calling av_hwframe_ctx_init().
*
* If non-NULL, this callback will be called when the last reference to
* this context is unreferenced, immediately before it is freed.
*/
void (*free)(struct AVHWFramesContext *ctx);
/**
* Arbitrary user data, to be used e.g. by the free() callback.
*/
void *user_opaque;
/**
* A pool from which the frames are allocated by av_hwframe_get_buffer().
* This field may be set by the caller before calling av_hwframe_ctx_init().
* The buffers returned by calling av_buffer_pool_get() on this pool must
* have the properties described in the documentation in the corresponding hw
* type's header (hwcontext_*.h). The pool will be freed strictly before
* this struct's free() callback is invoked.
*
* This field may be NULL, then libavutil will attempt to allocate a pool
* internally. Note that certain device types enforce pools allocated at
* fixed size (frame count), which cannot be extended dynamically. In such a
* case, initial_pool_size must be set appropriately.
*/
AVBufferPool *pool;
/**
* Initial size of the frame pool. If a device type does not support
* dynamically resizing the pool, then this is also the maximum pool size.
*
* May be set by the caller before calling av_hwframe_ctx_init(). Must be
* set if pool is NULL and the device type does not support dynamic pools.
*/
int initial_pool_size;
/**
* The pixel format identifying the underlying HW surface type.
*
* Must be a hwaccel format, i.e. the corresponding descriptor must have the
* AV_PIX_FMT_FLAG_HWACCEL flag set.
*
* Must be set by the user before calling av_hwframe_ctx_init().
*/
enum AVPixelFormat format;
/**
* The pixel format identifying the actual data layout of the hardware
* frames.
*
* Must be set by the caller before calling av_hwframe_ctx_init().
*
* @note when the underlying API does not provide the exact data layout, but
* only the colorspace/bit depth, this field should be set to the fully
* planar version of that format (e.g. for 8-bit 420 YUV it should be
* AV_PIX_FMT_YUV420P, not AV_PIX_FMT_NV12 or anything else).
*/
enum AVPixelFormat sw_format;
/**
* The allocated dimensions of the frames in this pool.
*
* Must be set by the user before calling av_hwframe_ctx_init().
*/
int width, height;
} AVHWFramesContext;
/**
* Allocate an AVHWDeviceContext for a given pixel format.
*
* @param format a hwaccel pixel format (AV_PIX_FMT_FLAG_HWACCEL must be set
* on the corresponding format descriptor)
* @return a reference to the newly created AVHWDeviceContext on success or NULL
* on failure.
*/
AVBufferRef *av_hwdevice_ctx_alloc(enum AVHWDeviceType type);
/**
* Finalize the device context before use. This function must be called after
* the context is filled with all the required information and before it is
* used in any way.
*
* @param ref a reference to the AVHWDeviceContext
* @return 0 on success, a negative AVERROR code on failure
*/
int av_hwdevice_ctx_init(AVBufferRef *ref);
/**
* Open a device of the specified type and create an AVHWDeviceContext for it.
*
* This is a convenience function intended to cover the simple cases. Callers
* who need to fine-tune device creation/management should open the device
* manually and then wrap it in an AVHWDeviceContext using
* av_hwdevice_ctx_alloc()/av_hwdevice_ctx_init().
*
* The returned context is already initialized and ready for use, the caller
* should not call av_hwdevice_ctx_init() on it. The user_opaque/free fields of
* the created AVHWDeviceContext are set by this function and should not be
* touched by the caller.
*
* @param device_ctx On success, a reference to the newly-created device context
* will be written here. The reference is owned by the caller
* and must be released with av_buffer_unref() when no longer
* needed. On failure, NULL will be written to this pointer.
* @param type The type of the device to create.
* @param device A type-specific string identifying the device to open.
* @param opts A dictionary of additional (type-specific) options to use in
* opening the device. The dictionary remains owned by the caller.
* @param flags currently unused
*
* @return 0 on success, a negative AVERROR code on failure.
*/
int av_hwdevice_ctx_create(AVBufferRef **device_ctx, enum AVHWDeviceType type,
const char *device, AVDictionary *opts, int flags);
/**
* Allocate an AVHWFramesContext tied to a given device context.
*
* @param device_ctx a reference to a AVHWDeviceContext. This function will make
* a new reference for internal use, the one passed to the
* function remains owned by the caller.
* @return a reference to the newly created AVHWFramesContext on success or NULL
* on failure.
*/
AVBufferRef *av_hwframe_ctx_alloc(AVBufferRef *device_ctx);
/**
* Finalize the context before use. This function must be called after the
* context is filled with all the required information and before it is attached
* to any frames.
*
* @param ref a reference to the AVHWFramesContext
* @return 0 on success, a negative AVERROR code on failure
*/
int av_hwframe_ctx_init(AVBufferRef *ref);
/**
* Allocate a new frame attached to the given AVHWFramesContext.
*
* @param hwframe_ctx a reference to an AVHWFramesContext
* @param frame an empty (freshly allocated or unreffed) frame to be filled with
* newly allocated buffers.
* @param flags currently unused, should be set to zero
* @return 0 on success, a negative AVERROR code on failure
*/
int av_hwframe_get_buffer(AVBufferRef *hwframe_ctx, AVFrame *frame, int flags);
/**
* Copy data to or from a hw surface. At least one of dst/src must have an
* AVHWFramesContext attached.
*
* If src has an AVHWFramesContext attached, then the format of dst (if set)
* must use one of the formats returned by av_hwframe_transfer_get_formats(src,
* AV_HWFRAME_TRANSFER_DIRECTION_FROM).
* If dst has an AVHWFramesContext attached, then the format of src must use one
* of the formats returned by av_hwframe_transfer_get_formats(dst,
* AV_HWFRAME_TRANSFER_DIRECTION_TO)
*
* dst may be "clean" (i.e. with data/buf pointers unset), in which case the
* data buffers will be allocated by this function using av_frame_get_buffer().
* If dst->format is set, then this format will be used, otherwise (when
* dst->format is AV_PIX_FMT_NONE) the first acceptable format will be chosen.
*
* @param dst the destination frame. dst is not touched on failure.
* @param src the source frame.
* @param flags currently unused, should be set to zero
* @return 0 on success, a negative AVERROR error code on failure.
*/
int av_hwframe_transfer_data(AVFrame *dst, const AVFrame *src, int flags);
enum AVHWFrameTransferDirection {
/**
* Transfer the data from the queried hw frame.
*/
AV_HWFRAME_TRANSFER_DIRECTION_FROM,
/**
* Transfer the data to the queried hw frame.
*/
AV_HWFRAME_TRANSFER_DIRECTION_TO,
};
/**
* Get a list of possible source or target formats usable in
* av_hwframe_transfer_data().
*
* @param hwframe_ctx the frame context to obtain the information for
* @param dir the direction of the transfer
* @param formats the pointer to the output format list will be written here.
* The list is terminated with AV_PIX_FMT_NONE and must be freed
* by the caller when no longer needed using av_free().
* If this function returns successfully, the format list will
* have at least one item (not counting the terminator).
* On failure, the contents of this pointer are unspecified.
* @param flags currently unused, should be set to zero
* @return 0 on success, a negative AVERROR code on failure.
*/
int av_hwframe_transfer_get_formats(AVBufferRef *hwframe_ctx,
enum AVHWFrameTransferDirection dir,
enum AVPixelFormat **formats, int flags);
/**
* This struct describes the constraints on hardware frames attached to
* a given device with a hardware-specific configuration. This is returned
* by av_hwdevice_get_hwframe_constraints() and must be freed by
* av_hwframe_constraints_free() after use.
*/
typedef struct AVHWFramesConstraints {
/**
* A list of possible values for format in the hw_frames_ctx,
* terminated by AV_PIX_FMT_NONE. This member will always be filled.
*/
enum AVPixelFormat *valid_hw_formats;
/**
* A list of possible values for sw_format in the hw_frames_ctx,
* terminated by AV_PIX_FMT_NONE. Can be NULL if this information is
* not known.
*/
enum AVPixelFormat *valid_sw_formats;
/**
* The minimum size of frames in this hw_frames_ctx.
* (Zero if not known.)
*/
int min_width;
int min_height;
/**
* The maximum size of frames in this hw_frames_ctx.
* (INT_MAX if not known / no limit.)
*/
int max_width;
int max_height;
} AVHWFramesConstraints;
/**
* Allocate a HW-specific configuration structure for a given HW device.
* After use, the user must free all members as required by the specific
* hardware structure being used, then free the structure itself with
* av_free().
*
* @param device_ctx a reference to the associated AVHWDeviceContext.
* @return The newly created HW-specific configuration structure on
* success or NULL on failure.
*/
void *av_hwdevice_hwconfig_alloc(AVBufferRef *device_ctx);
/**
* Get the constraints on HW frames given a device and the HW-specific
* configuration to be used with that device. If no HW-specific
* configuration is provided, returns the maximum possible capabilities
* of the device.
*
* @param device_ctx a reference to the associated AVHWDeviceContext.
* @param hwconfig a filled HW-specific configuration structure, or NULL
* to return the maximum possible capabilities of the device.
* @return AVHWFramesConstraints structure describing the constraints
* on the device, or NULL if not available.
*/
AVHWFramesConstraints *av_hwdevice_get_hwframe_constraints(AVBufferRef *ref,
const void *hwconfig);
/**
* Free an AVHWFrameConstraints structure.
*
* @param constraints The (filled or unfilled) AVHWFrameConstraints structure.
*/
void av_hwframe_constraints_free(AVHWFramesConstraints **constraints);
#endif /* AVUTIL_HWCONTEXT_H */

View File

@ -0,0 +1,46 @@
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVUTIL_HWCONTEXT_CUDA_H
#define AVUTIL_HWCONTEXT_CUDA_H
#include <cuda.h>
#include "pixfmt.h"
/**
* @file
* An API-specific header for AV_HWDEVICE_TYPE_CUDA.
*
* This API supports dynamic frame pools. AVHWFramesContext.pool must return
* AVBufferRefs whose data pointer is a CUdeviceptr.
*/
/**
* This struct is allocated as AVHWDeviceContext.hwctx
*/
typedef struct AVCUDADeviceContext {
CUcontext cuda_ctx;
} AVCUDADeviceContext;
/**
* AVHWFramesContext.hwctx is currently not used
*/
#endif /* AVUTIL_HWCONTEXT_CUDA_H */

View File

@ -0,0 +1,72 @@
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVUTIL_HWCONTEXT_DXVA2_H
#define AVUTIL_HWCONTEXT_DXVA2_H
/**
* @file
* An API-specific header for AV_HWDEVICE_TYPE_DXVA2.
*
* Only fixed-size pools are supported.
*
* For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs
* with the data pointer set to a pointer to IDirect3DSurface9.
*/
#include <d3d9.h>
#include <dxva2api.h>
/**
* This struct is allocated as AVHWDeviceContext.hwctx
*/
typedef struct AVDXVA2DeviceContext {
IDirect3DDeviceManager9 *devmgr;
} AVDXVA2DeviceContext;
/**
* This struct is allocated as AVHWFramesContext.hwctx
*/
typedef struct AVDXVA2FramesContext {
/**
* The surface type (e.g. DXVA2_VideoProcessorRenderTarget or
* DXVA2_VideoDecoderRenderTarget). Must be set by the caller.
*/
DWORD surface_type;
/**
* The surface pool. When an external pool is not provided by the caller,
* this will be managed (allocated and filled on init, freed on uninit) by
* libavutil.
*/
IDirect3DSurface9 **surfaces;
int nb_surfaces;
/**
* Certain drivers require the decoder to be destroyed before the surfaces.
* To allow internally managed pools to work properly in such cases, this
* field is provided.
*
* If it is non-NULL, libavutil will call IDirectXVideoDecoder_Release() on
* it just before the internal surface pool is freed.
*/
IDirectXVideoDecoder *decoder_to_release;
} AVDXVA2FramesContext;
#endif /* AVUTIL_HWCONTEXT_DXVA2_H */

View File

@ -0,0 +1,82 @@
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVUTIL_HWCONTEXT_VAAPI_H
#define AVUTIL_HWCONTEXT_VAAPI_H
#include <va/va.h>
/**
* @file
* API-specific header for AV_HWDEVICE_TYPE_VAAPI.
*
* Dynamic frame pools are supported, but note that any pool used as a render
* target is required to be of fixed size in order to be be usable as an
* argument to vaCreateContext().
*
* For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs
* with the data pointer set to a VASurfaceID.
*/
/**
* VAAPI connection details.
*
* Allocated as AVHWDeviceContext.hwctx
*/
typedef struct AVVAAPIDeviceContext {
/**
* The VADisplay handle, to be filled by the user.
*/
VADisplay display;
} AVVAAPIDeviceContext;
/**
* VAAPI-specific data associated with a frame pool.
*
* Allocated as AVHWFramesContext.hwctx.
*/
typedef struct AVVAAPIFramesContext {
/**
* Set by the user to apply surface attributes to all surfaces in
* the frame pool. If null, default settings are used.
*/
VASurfaceAttrib *attributes;
int nb_attributes;
/**
* The surfaces IDs of all surfaces in the pool after creation.
* Only valid if AVHWFramesContext.initial_pool_size was positive.
* These are intended to be used as the render_targets arguments to
* vaCreateContext().
*/
VASurfaceID *surface_ids;
int nb_surfaces;
} AVVAAPIFramesContext;
/**
* VAAPI hardware pipeline configuration details.
*
* Allocated with av_hwdevice_hwconfig_alloc().
*/
typedef struct AVVAAPIHWConfig {
/**
* ID of a VAAPI pipeline configuration.
*/
VAConfigID config_id;
} AVVAAPIHWConfig;
#endif /* AVUTIL_HWCONTEXT_VAAPI_H */

View File

@ -0,0 +1,44 @@
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVUTIL_HWCONTEXT_VDPAU_H
#define AVUTIL_HWCONTEXT_VDPAU_H
#include <vdpau/vdpau.h>
/**
* @file
* An API-specific header for AV_HWDEVICE_TYPE_VDPAU.
*
* This API supports dynamic frame pools. AVHWFramesContext.pool must return
* AVBufferRefs whose data pointer is a VdpVideoSurface.
*/
/**
* This struct is allocated as AVHWDeviceContext.hwctx
*/
typedef struct AVVDPAUDeviceContext {
VdpDevice device;
VdpGetProcAddress *get_proc_address;
} AVVDPAUDeviceContext;
/**
* AVHWFramesContext.hwctx is currently not used
*/
#endif /* AVUTIL_HWCONTEXT_VDPAU_H */

View File

@ -317,6 +317,23 @@ AVClassCategory av_default_get_category(void *ptr);
void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl,
char *line, int line_size, int *print_prefix);
/**
* Format a line of log the same way as the default callback.
* @param line buffer to receive the formatted line;
* may be NULL if line_size is 0
* @param line_size size of the buffer; at most line_size-1 characters will
* be written to the buffer, plus one null terminator
* @param print_prefix used to store whether the prefix must be printed;
* must point to a persistent integer initially set to 1
* @return Returns a negative value if an error occurred, otherwise returns
* the number of characters that would have been written for a
* sufficiently large buffer, not including the terminating null
* character. If the return value is not less than line_size, it means
* that the log message was truncated to fit the buffer.
*/
int av_log_format_line2(void *ptr, int level, const char *fmt, va_list vl,
char *line, int line_size, int *print_prefix);
#if FF_API_DLOG
/**
* av_dlog macros

View File

@ -281,7 +281,7 @@ typedef struct AVOption {
#define AV_OPT_FLAG_VIDEO_PARAM 16
#define AV_OPT_FLAG_SUBTITLE_PARAM 32
/**
* The option is inteded for exporting values to the caller.
* The option is intended for exporting values to the caller.
*/
#define AV_OPT_FLAG_EXPORT 64
/**

View File

@ -85,16 +85,16 @@ typedef struct AVPixFmtDescriptor {
/**
* Amount to shift the luma width right to find the chroma width.
* For YV12 this is 1 for example.
* chroma_width = -((-luma_width) >> log2_chroma_w)
* chroma_width = AV_CEIL_RSHIFT(luma_width, log2_chroma_w)
* The note above is needed to ensure rounding up.
* This value only refers to the chroma components.
*/
uint8_t log2_chroma_w; ///< chroma_width = -((-luma_width )>>log2_chroma_w)
uint8_t log2_chroma_w;
/**
* Amount to shift the luma height right to find the chroma height.
* For YV12 this is 1 for example.
* chroma_height= -((-luma_height) >> log2_chroma_h)
* chroma_height= AV_CEIL_RSHIFT(luma_height, log2_chroma_h)
* The note above is needed to ensure rounding up.
* This value only refers to the chroma components.
*/

View File

@ -24,7 +24,6 @@
/**
* @file
* pixel format definitions
*
*/
#include "libavutil/avconfig.h"
@ -54,7 +53,7 @@
* to run on the IBM VGA graphics adapter use 6-bit palette components.
*
* @par
* For all the 8bit per pixel formats, an RGB32 palette is in data[1] like
* For all the 8 bits per pixel formats, an RGB32 palette is in data[1] like
* for pal8. This palette is filled in automatically by the function
* allocating the picture.
*/
@ -71,7 +70,7 @@ enum AVPixelFormat {
AV_PIX_FMT_GRAY8, ///< Y , 8bpp
AV_PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb
AV_PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb
AV_PIX_FMT_PAL8, ///< 8 bit with AV_PIX_FMT_RGB32 palette
AV_PIX_FMT_PAL8, ///< 8 bits with AV_PIX_FMT_RGB32 palette
AV_PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting color_range
AV_PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting color_range
AV_PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting color_range
@ -126,7 +125,7 @@ enum AVPixelFormat {
/**@{*/
AV_PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers
AV_PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers
AV_PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
AV_PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a VASurfaceID
/**@}*/
AV_PIX_FMT_VAAPI = AV_PIX_FMT_VAAPI_VLD,
#else
@ -144,7 +143,7 @@ enum AVPixelFormat {
AV_PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
AV_PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
#if FF_API_VDPAU
AV_PIX_FMT_VDPAU_MPEG4, ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
AV_PIX_FMT_VDPAU_MPEG4, ///< MPEG-4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
#endif
AV_PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer
@ -152,7 +151,7 @@ enum AVPixelFormat {
AV_PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), big-endian, X=unused/undefined
AV_PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), little-endian, X=unused/undefined
AV_PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), big-endian, X=unused/undefined
AV_PIX_FMT_YA8, ///< 8bit gray, 8bit alpha
AV_PIX_FMT_YA8, ///< 8 bits gray, 8 bits alpha
AV_PIX_FMT_Y400A = AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8
AV_PIX_FMT_GRAY8A= AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8
@ -223,8 +222,8 @@ enum AVPixelFormat {
AV_PIX_FMT_VDA, ///< HW acceleration through VDA, data[3] contains a CVPixelBufferRef
AV_PIX_FMT_YA16BE, ///< 16bit gray, 16bit alpha (big-endian)
AV_PIX_FMT_YA16LE, ///< 16bit gray, 16bit alpha (little-endian)
AV_PIX_FMT_YA16BE, ///< 16 bits gray, 16 bits alpha (big-endian)
AV_PIX_FMT_YA16LE, ///< 16 bits gray, 16 bits alpha (little-endian)
AV_PIX_FMT_GBRAP, ///< planar GBRA 4:4:4:4 32bpp
AV_PIX_FMT_GBRAP16BE, ///< planar GBRA 4:4:4:4 64bpp, big-endian
@ -242,6 +241,12 @@ enum AVPixelFormat {
AV_PIX_FMT_D3D11VA_VLD, ///< HW decoding through Direct3D11, Picture.data[3] contains a ID3D11VideoDecoderOutputView pointer
/**
* HW acceleration through CUDA. data[i] contain CUdeviceptr pointers
* exactly as for system memory frames.
*/
AV_PIX_FMT_CUDA,
AV_PIX_FMT_0RGB=0x123+4,///< packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
AV_PIX_FMT_RGB0, ///< packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
AV_PIX_FMT_0BGR, ///< packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
@ -292,6 +297,12 @@ enum AVPixelFormat {
AV_PIX_FMT_P010LE, ///< like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, little-endian
AV_PIX_FMT_P010BE, ///< like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, big-endian
AV_PIX_FMT_GBRAP12BE, ///< planar GBR 4:4:4:4 48bpp, big-endian
AV_PIX_FMT_GBRAP12LE, ///< planar GBR 4:4:4:4 48bpp, little-endian
AV_PIX_FMT_GBRAP10BE, ///< planar GBR 4:4:4:4 40bpp, big-endian
AV_PIX_FMT_GBRAP10LE, ///< planar GBR 4:4:4:4 40bpp, little-endian
AV_PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
};
@ -347,6 +358,8 @@ enum AVPixelFormat {
#define AV_PIX_FMT_GBRP12 AV_PIX_FMT_NE(GBRP12BE, GBRP12LE)
#define AV_PIX_FMT_GBRP14 AV_PIX_FMT_NE(GBRP14BE, GBRP14LE)
#define AV_PIX_FMT_GBRP16 AV_PIX_FMT_NE(GBRP16BE, GBRP16LE)
#define AV_PIX_FMT_GBRAP10 AV_PIX_FMT_NE(GBRAP10BE, GBRAP10LE)
#define AV_PIX_FMT_GBRAP12 AV_PIX_FMT_NE(GBRAP12BE, GBRAP12LE)
#define AV_PIX_FMT_GBRAP16 AV_PIX_FMT_NE(GBRAP16BE, GBRAP16LE)
#define AV_PIX_FMT_BAYER_BGGR16 AV_PIX_FMT_NE(BAYER_BGGR16BE, BAYER_BGGR16LE)
@ -407,10 +420,11 @@ enum AVColorTransferCharacteristic {
AVCOL_TRC_IEC61966_2_4 = 11, ///< IEC 61966-2-4
AVCOL_TRC_BT1361_ECG = 12, ///< ITU-R BT1361 Extended Colour Gamut
AVCOL_TRC_IEC61966_2_1 = 13, ///< IEC 61966-2-1 (sRGB or sYCC)
AVCOL_TRC_BT2020_10 = 14, ///< ITU-R BT2020 for 10 bit system
AVCOL_TRC_BT2020_12 = 15, ///< ITU-R BT2020 for 12 bit system
AVCOL_TRC_SMPTEST2084 = 16, ///< SMPTE ST 2084 for 10, 12, 14 and 16 bit systems
AVCOL_TRC_BT2020_10 = 14, ///< ITU-R BT2020 for 10-bit system
AVCOL_TRC_BT2020_12 = 15, ///< ITU-R BT2020 for 12-bit system
AVCOL_TRC_SMPTEST2084 = 16, ///< SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems
AVCOL_TRC_SMPTEST428_1 = 17, ///< SMPTE ST 428-1
AVCOL_TRC_ARIB_STD_B67 = 18, ///< ARIB STD-B67, known as "Hybrid log-gamma"
AVCOL_TRC_NB, ///< Not part of ABI
};
@ -424,8 +438,8 @@ enum AVColorSpace {
AVCOL_SPC_RESERVED = 3,
AVCOL_SPC_FCC = 4, ///< FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
AVCOL_SPC_SMPTE240M = 7,
AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
AVCOL_SPC_SMPTE240M = 7, ///< functionally identical to above
AVCOL_SPC_YCOCG = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system
AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system
@ -461,8 +475,8 @@ enum AVColorRange {
*/
enum AVChromaLocation {
AVCHROMA_LOC_UNSPECIFIED = 0,
AVCHROMA_LOC_LEFT = 1, ///< mpeg2/4 4:2:0, h264 default for 4:2:0
AVCHROMA_LOC_CENTER = 2, ///< mpeg1 4:2:0, jpeg 4:2:0, h263 4:2:0
AVCHROMA_LOC_LEFT = 1, ///< MPEG-2/4 4:2:0, H.264 default for 4:2:0
AVCHROMA_LOC_CENTER = 2, ///< MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0
AVCHROMA_LOC_TOPLEFT = 3, ///< ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2
AVCHROMA_LOC_TOP = 4,
AVCHROMA_LOC_BOTTOMLEFT = 5,

View File

@ -1,5 +1,4 @@
/*
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or

View File

@ -32,7 +32,6 @@
*
* Audio sample format enumeration and related convenience functions.
* @{
*
*/
/**

View File

@ -149,4 +149,22 @@ AVStereo3D *av_stereo3d_alloc(void);
*/
AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame);
/**
* Provide a human-readable name of a given stereo3d type.
*
* @param type The input stereo3d type value.
*
* @return The name of the stereo3d value, or "unknown".
*/
const char *av_stereo3d_type_name(unsigned int type);
/**
* Get the AVStereo3DType form a human-readable name.
*
* @param type The input string.
*
* @return The AVStereo3DType value, or -1 if not found.
*/
int av_stereo3d_from_name(const char *name);
#endif /* AVUTIL_STEREO3D_H */

View File

@ -69,10 +69,10 @@ int av_thread_message_queue_recv(AVThreadMessageQueue *mq,
/**
* Set the sending error code.
*
* If the error code is set to non-zero, av_thread_message_queue_recv() will
* return it immediately when there are no longer available messages.
* Conventional values, such as AVERROR_EOF or AVERROR(EAGAIN), can be used
* to cause the receiving thread to stop or suspend its operation.
* If the error code is set to non-zero, av_thread_message_queue_send() will
* return it immediately. Conventional values, such as AVERROR_EOF or
* AVERROR(EAGAIN), can be used to cause the sending thread to stop or
* suspend its operation.
*/
void av_thread_message_queue_set_err_send(AVThreadMessageQueue *mq,
int err);
@ -80,10 +80,10 @@ void av_thread_message_queue_set_err_send(AVThreadMessageQueue *mq,
/**
* Set the receiving error code.
*
* If the error code is set to non-zero, av_thread_message_queue_send() will
* return it immediately. Conventional values, such as AVERROR_EOF or
* AVERROR(EAGAIN), can be used to cause the sending thread to stop or
* suspend its operation.
* If the error code is set to non-zero, av_thread_message_queue_recv() will
* return it immediately when there are no longer available messages.
* Conventional values, such as AVERROR_EOF or AVERROR(EAGAIN), can be used
* to cause the receiving thread to stop or suspend its operation.
*/
void av_thread_message_queue_set_err_recv(AVThreadMessageQueue *mq,
int err);

View File

@ -120,8 +120,8 @@ void av_tree_destroy(struct AVTreeNode *t);
/**
* Apply enu(opaque, &elem) to all the elements in the tree in a given range.
*
* @param cmp a comparison function that returns < 0 for a element below the
* range, > 0 for a element above the range and == 0 for a
* @param cmp a comparison function that returns < 0 for an element below the
* range, > 0 for an element above the range and == 0 for an
* element inside the range
*
* @note The cmp function should use the same ordering used to construct the

View File

@ -64,8 +64,8 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 55
#define LIBAVUTIL_VERSION_MINOR 17
#define LIBAVUTIL_VERSION_MICRO 103
#define LIBAVUTIL_VERSION_MINOR 28
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -5,10 +5,10 @@ includedir=${prefix}/include
Name: libavcodec
Description: FFmpeg codec library
Version: 57.24.102
Requires: libavutil >= 55.17.103
Version: 57.48.101
Requires: libavutil >= 55.28.100
Requires.private:
Conflicts:
Libs: -L${libdir} -lavcodec -framework CoreFoundation -framework VideoToolbox -framework CoreMedia -framework QuartzCore -framework CoreVideo -framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore -liconv -Wl,-framework,CoreFoundation -Wl,-framework,Security -L/usr/local/lib -lSDLmain -lSDL -Wl,-framework,Cocoa -L/usr/local/Cellar/dcadec/0.2.0/lib -ldcadec -lm -lz -pthread -framework CoreServices
Libs: -L${libdir} -lavcodec -framework QuartzCore -framework CoreFoundation -framework VideoToolbox -framework CoreMedia -framework CoreVideo -framework CoreFoundation -framework AudioToolbox -framework CoreMedia -framework VideoDecodeAcceleration -framework CoreFoundation -framework QuartzCore -liconv -Wl,-framework,CoreFoundation -Wl,-framework,Security -L/usr/local/lib -lSDLmain -lSDL -Wl,-framework,Cocoa -lm -lz -pthread -framework CoreServices
Libs.private:
Cflags: -I${includedir}

View File

@ -5,10 +5,10 @@ includedir=${prefix}/include
Name: libavformat
Description: FFmpeg container format library
Version: 57.25.100
Requires: libavcodec >= 57.24.102, libavutil >= 55.17.103
Version: 57.41.100
Requires: libavcodec >= 57.48.101, libavutil >= 55.28.100
Requires.private:
Conflicts:
Libs: -L${libdir} -lavformat -framework CoreFoundation -framework VideoToolbox -framework CoreMedia -framework QuartzCore -framework CoreVideo -framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore -liconv -Wl,-framework,CoreFoundation -Wl,-framework,Security -L/usr/local/lib -lSDLmain -lSDL -Wl,-framework,Cocoa -L/usr/local/Cellar/dcadec/0.2.0/lib -ldcadec -lm -lz -pthread -framework CoreServices
Libs: -L${libdir} -lavformat -framework QuartzCore -framework CoreFoundation -framework VideoToolbox -framework CoreMedia -framework CoreVideo -framework CoreFoundation -framework AudioToolbox -framework CoreMedia -framework VideoDecodeAcceleration -framework CoreFoundation -framework QuartzCore -liconv -Wl,-framework,CoreFoundation -Wl,-framework,Security -L/usr/local/lib -lSDLmain -lSDL -Wl,-framework,Cocoa -lm -lz -pthread -framework CoreServices
Libs.private:
Cflags: -I${includedir}

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: libavutil
Description: FFmpeg utility library
Version: 55.17.103
Version: 55.28.100
Requires:
Requires.private:
Conflicts: