parent
729333f8c0
commit
97e2746d2e
@ -0,0 +1,36 @@ |
|||||||
|
/*
|
||||||
|
* AC-3 parser prototypes |
||||||
|
* Copyright (c) 2003 Fabrice Bellard |
||||||
|
* Copyright (c) 2003 Michael Niedermayer |
||||||
|
* |
||||||
|
* 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_AC3_PARSER_H |
||||||
|
#define AVCODEC_AC3_PARSER_H |
||||||
|
|
||||||
|
#include <stddef.h> |
||||||
|
#include <stdint.h> |
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract the bitstream ID and the frame size from AC-3 data. |
||||||
|
*/ |
||||||
|
int av_ac3_parse_header(const uint8_t *buf, size_t size, |
||||||
|
uint8_t *bitstream_id, uint16_t *frame_size); |
||||||
|
|
||||||
|
|
||||||
|
#endif /* AVCODEC_AC3_PARSER_H */ |
@ -0,0 +1,37 @@ |
|||||||
|
/*
|
||||||
|
* 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_ADTS_PARSER_H |
||||||
|
#define AVCODEC_ADTS_PARSER_H |
||||||
|
|
||||||
|
#include <stddef.h> |
||||||
|
#include <stdint.h> |
||||||
|
|
||||||
|
#define AV_AAC_ADTS_HEADER_SIZE 7 |
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract the number of samples and frames from AAC data. |
||||||
|
* @param[in] buf pointer to AAC data buffer |
||||||
|
* @param[out] samples Pointer to where number of samples is written |
||||||
|
* @param[out] frames Pointer to where number of frames is written |
||||||
|
* @return Returns 0 on success, error code on failure. |
||||||
|
*/ |
||||||
|
int av_adts_header_parse(const uint8_t *buf, uint32_t *samples, |
||||||
|
uint8_t *frames); |
||||||
|
|
||||||
|
#endif /* AVCODEC_ADTS_PARSER_H */ |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,6 @@ |
|||||||
/* Generated by ffconf */ |
/* Generated by ffmpeg configure */ |
||||||
#ifndef AVUTIL_AVCONFIG_H |
#ifndef AVUTIL_AVCONFIG_H |
||||||
#define AVUTIL_AVCONFIG_H |
#define AVUTIL_AVCONFIG_H |
||||||
#define AV_HAVE_BIGENDIAN 0 |
#define AV_HAVE_BIGENDIAN 0 |
||||||
#define AV_HAVE_FAST_UNALIGNED 0 |
#define AV_HAVE_FAST_UNALIGNED 1 |
||||||
#define AV_HAVE_INCOMPATIBLE_LIBAV_ABI 0 |
|
||||||
#endif /* AVUTIL_AVCONFIG_H */ |
#endif /* AVUTIL_AVCONFIG_H */ |
||||||
|
@ -0,0 +1,205 @@ |
|||||||
|
/**
|
||||||
|
* 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_ENCRYPTION_INFO_H |
||||||
|
#define AVUTIL_ENCRYPTION_INFO_H |
||||||
|
|
||||||
|
#include <stddef.h> |
||||||
|
#include <stdint.h> |
||||||
|
|
||||||
|
typedef struct AVSubsampleEncryptionInfo { |
||||||
|
/** The number of bytes that are clear. */ |
||||||
|
unsigned int bytes_of_clear_data; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of bytes that are protected. If using pattern encryption, |
||||||
|
* the pattern applies to only the protected bytes; if not using pattern |
||||||
|
* encryption, all these bytes are encrypted. |
||||||
|
*/ |
||||||
|
unsigned int bytes_of_protected_data; |
||||||
|
} AVSubsampleEncryptionInfo; |
||||||
|
|
||||||
|
/**
|
||||||
|
* This describes encryption info for a packet. This contains frame-specific |
||||||
|
* info for how to decrypt the packet before passing it to the decoder. |
||||||
|
* |
||||||
|
* The size of this struct is not part of the public ABI. |
||||||
|
*/ |
||||||
|
typedef struct AVEncryptionInfo { |
||||||
|
/** The fourcc encryption scheme, in big-endian byte order. */ |
||||||
|
uint32_t scheme; |
||||||
|
|
||||||
|
/**
|
||||||
|
* Only used for pattern encryption. This is the number of 16-byte blocks |
||||||
|
* that are encrypted. |
||||||
|
*/ |
||||||
|
uint32_t crypt_byte_block; |
||||||
|
|
||||||
|
/**
|
||||||
|
* Only used for pattern encryption. This is the number of 16-byte blocks |
||||||
|
* that are clear. |
||||||
|
*/ |
||||||
|
uint32_t skip_byte_block; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the key used to encrypt the packet. This should always be |
||||||
|
* 16 bytes long, but may be changed in the future. |
||||||
|
*/ |
||||||
|
uint8_t *key_id; |
||||||
|
uint32_t key_id_size; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The initialization vector. This may have been zero-filled to be the |
||||||
|
* correct block size. This should always be 16 bytes long, but may be |
||||||
|
* changed in the future. |
||||||
|
*/ |
||||||
|
uint8_t *iv; |
||||||
|
uint32_t iv_size; |
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of subsample encryption info specifying how parts of the sample |
||||||
|
* are encrypted. If there are no subsamples, then the whole sample is |
||||||
|
* encrypted. |
||||||
|
*/ |
||||||
|
AVSubsampleEncryptionInfo *subsamples; |
||||||
|
uint32_t subsample_count; |
||||||
|
} AVEncryptionInfo; |
||||||
|
|
||||||
|
/**
|
||||||
|
* This describes info used to initialize an encryption key system. |
||||||
|
* |
||||||
|
* The size of this struct is not part of the public ABI. |
||||||
|
*/ |
||||||
|
typedef struct AVEncryptionInitInfo { |
||||||
|
/**
|
||||||
|
* A unique identifier for the key system this is for, can be NULL if it |
||||||
|
* is not known. This should always be 16 bytes, but may change in the |
||||||
|
* future. |
||||||
|
*/ |
||||||
|
uint8_t* system_id; |
||||||
|
uint32_t system_id_size; |
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of key IDs this initialization data is for. All IDs are the |
||||||
|
* same length. Can be NULL if there are no known key IDs. |
||||||
|
*/ |
||||||
|
uint8_t** key_ids; |
||||||
|
/** The number of key IDs. */ |
||||||
|
uint32_t num_key_ids; |
||||||
|
/**
|
||||||
|
* The number of bytes in each key ID. This should always be 16, but may |
||||||
|
* change in the future. |
||||||
|
*/ |
||||||
|
uint32_t key_id_size; |
||||||
|
|
||||||
|
/**
|
||||||
|
* Key-system specific initialization data. This data is copied directly |
||||||
|
* from the file and the format depends on the specific key system. This |
||||||
|
* can be NULL if there is no initialization data; in that case, there |
||||||
|
* will be at least one key ID. |
||||||
|
*/ |
||||||
|
uint8_t* data; |
||||||
|
uint32_t data_size; |
||||||
|
|
||||||
|
/**
|
||||||
|
* An optional pointer to the next initialization info in the list. |
||||||
|
*/ |
||||||
|
struct AVEncryptionInitInfo *next; |
||||||
|
} AVEncryptionInitInfo; |
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocates an AVEncryptionInfo structure and sub-pointers to hold the given |
||||||
|
* number of subsamples. This will allocate pointers for the key ID, IV, |
||||||
|
* and subsample entries, set the size members, and zero-initialize the rest. |
||||||
|
* |
||||||
|
* @param subsample_count The number of subsamples. |
||||||
|
* @param key_id_size The number of bytes in the key ID, should be 16. |
||||||
|
* @param iv_size The number of bytes in the IV, should be 16. |
||||||
|
* |
||||||
|
* @return The new AVEncryptionInfo structure, or NULL on error. |
||||||
|
*/ |
||||||
|
AVEncryptionInfo *av_encryption_info_alloc(uint32_t subsample_count, uint32_t key_id_size, uint32_t iv_size); |
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocates an AVEncryptionInfo structure with a copy of the given data. |
||||||
|
* @return The new AVEncryptionInfo structure, or NULL on error. |
||||||
|
*/ |
||||||
|
AVEncryptionInfo *av_encryption_info_clone(const AVEncryptionInfo *info); |
||||||
|
|
||||||
|
/**
|
||||||
|
* Frees the given encryption info object. This MUST NOT be used to free the |
||||||
|
* side-data data pointer, that should use normal side-data methods. |
||||||
|
*/ |
||||||
|
void av_encryption_info_free(AVEncryptionInfo *info); |
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a copy of the AVEncryptionInfo that is contained in the given side |
||||||
|
* data. The resulting object should be passed to av_encryption_info_free() |
||||||
|
* when done. |
||||||
|
* |
||||||
|
* @return The new AVEncryptionInfo structure, or NULL on error. |
||||||
|
*/ |
||||||
|
AVEncryptionInfo *av_encryption_info_get_side_data(const uint8_t *side_data, size_t side_data_size); |
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocates and initializes side data that holds a copy of the given encryption |
||||||
|
* info. The resulting pointer should be either freed using av_free or given |
||||||
|
* to av_packet_add_side_data(). |
||||||
|
* |
||||||
|
* @return The new side-data pointer, or NULL. |
||||||
|
*/ |
||||||
|
uint8_t *av_encryption_info_add_side_data( |
||||||
|
const AVEncryptionInfo *info, size_t *side_data_size); |
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocates an AVEncryptionInitInfo structure and sub-pointers to hold the |
||||||
|
* given sizes. This will allocate pointers and set all the fields. |
||||||
|
* |
||||||
|
* @return The new AVEncryptionInitInfo structure, or NULL on error. |
||||||
|
*/ |
||||||
|
AVEncryptionInitInfo *av_encryption_init_info_alloc( |
||||||
|
uint32_t system_id_size, uint32_t num_key_ids, uint32_t key_id_size, uint32_t data_size); |
||||||
|
|
||||||
|
/**
|
||||||
|
* Frees the given encryption init info object. This MUST NOT be used to free |
||||||
|
* the side-data data pointer, that should use normal side-data methods. |
||||||
|
*/ |
||||||
|
void av_encryption_init_info_free(AVEncryptionInitInfo* info); |
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a copy of the AVEncryptionInitInfo that is contained in the given |
||||||
|
* side data. The resulting object should be passed to |
||||||
|
* av_encryption_init_info_free() when done. |
||||||
|
* |
||||||
|
* @return The new AVEncryptionInitInfo structure, or NULL on error. |
||||||
|
*/ |
||||||
|
AVEncryptionInitInfo *av_encryption_init_info_get_side_data( |
||||||
|
const uint8_t* side_data, size_t side_data_size); |
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocates and initializes side data that holds a copy of the given encryption |
||||||
|
* init info. The resulting pointer should be either freed using av_free or |
||||||
|
* given to av_packet_add_side_data(). |
||||||
|
* |
||||||
|
* @return The new side-data pointer, or NULL. |
||||||
|
*/ |
||||||
|
uint8_t *av_encryption_init_info_add_side_data( |
||||||
|
const AVEncryptionInitInfo *info, size_t *side_data_size); |
||||||
|
|
||||||
|
#endif /* AVUTIL_ENCRYPTION_INFO_H */ |
@ -1,5 +1,5 @@ |
|||||||
/* Automatically generated by version.sh, do not manually edit! */ |
/* Automatically generated by version.sh, do not manually edit! */ |
||||||
#ifndef AVUTIL_FFVERSION_H |
#ifndef AVUTIL_FFVERSION_H |
||||||
#define AVUTIL_FFVERSION_H |
#define AVUTIL_FFVERSION_H |
||||||
#define FFMPEG_VERSION "3.0.3" |
#define FFMPEG_VERSION "r2.9.6-875-g7d430423d" |
||||||
#endif /* AVUTIL_FFVERSION_H */ |
#endif /* AVUTIL_FFVERSION_H */ |
||||||
|
@ -0,0 +1,343 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Mohammad Izadi <moh.izadi at gmail.com> |
||||||
|
* |
||||||
|
* This file is part of FFmpeg. |
||||||
|
* |
||||||
|
* FFmpeg is free software; you can redistribute it and/or |
||||||
|
* modify it under the terms of the GNU Lesser General Public |
||||||
|
* License as published by the Free Software Foundation; either |
||||||
|
* version 2.1 of the License, or (at your option) any later version. |
||||||
|
* |
||||||
|
* FFmpeg is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||||||
|
* Lesser General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Lesser General Public |
||||||
|
* License along with FFmpeg; if not, write to the Free Software |
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
||||||
|
*/ |
||||||
|
|
||||||
|
#ifndef AVUTIL_HDR_DYNAMIC_METADATA_H |
||||||
|
#define AVUTIL_HDR_DYNAMIC_METADATA_H |
||||||
|
|
||||||
|
#include "frame.h" |
||||||
|
#include "rational.h" |
||||||
|
|
||||||
|
/**
|
||||||
|
* Option for overlapping elliptical pixel selectors in an image. |
||||||
|
*/ |
||||||
|
enum AVHDRPlusOverlapProcessOption { |
||||||
|
AV_HDR_PLUS_OVERLAP_PROCESS_WEIGHTED_AVERAGING = 0, |
||||||
|
AV_HDR_PLUS_OVERLAP_PROCESS_LAYERING = 1, |
||||||
|
}; |
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the percentile at a specific percentage in |
||||||
|
* a distribution. |
||||||
|
*/ |
||||||
|
typedef struct AVHDRPlusPercentile { |
||||||
|
/**
|
||||||
|
* The percentage value corresponding to a specific percentile linearized |
||||||
|
* RGB value in the processing window in the scene. The value shall be in |
||||||
|
* the range of 0 to100, inclusive. |
||||||
|
*/ |
||||||
|
uint8_t percentage; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The linearized maxRGB value at a specific percentile in the processing |
||||||
|
* window in the scene. The value shall be in the range of 0 to 1, inclusive |
||||||
|
* and in multiples of 0.00001. |
||||||
|
*/ |
||||||
|
AVRational percentile; |
||||||
|
} AVHDRPlusPercentile; |
||||||
|
|
||||||
|
/**
|
||||||
|
* Color transform parameters at a processing window in a dynamic metadata for |
||||||
|
* SMPTE 2094-40. |
||||||
|
*/ |
||||||
|
typedef struct AVHDRPlusColorTransformParams { |
||||||
|
/**
|
||||||
|
* The relative x coordinate of the top left pixel of the processing |
||||||
|
* window. The value shall be in the range of 0 and 1, inclusive and |
||||||
|
* in multiples of 1/(width of Picture - 1). The value 1 corresponds |
||||||
|
* to the absolute coordinate of width of Picture - 1. The value for |
||||||
|
* first processing window shall be 0. |
||||||
|
*/ |
||||||
|
AVRational window_upper_left_corner_x; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The relative y coordinate of the top left pixel of the processing |
||||||
|
* window. The value shall be in the range of 0 and 1, inclusive and |
||||||
|
* in multiples of 1/(height of Picture - 1). The value 1 corresponds |
||||||
|
* to the absolute coordinate of height of Picture - 1. The value for |
||||||
|
* first processing window shall be 0. |
||||||
|
*/ |
||||||
|
AVRational window_upper_left_corner_y; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The relative x coordinate of the bottom right pixel of the processing |
||||||
|
* window. The value shall be in the range of 0 and 1, inclusive and |
||||||
|
* in multiples of 1/(width of Picture - 1). The value 1 corresponds |
||||||
|
* to the absolute coordinate of width of Picture - 1. The value for |
||||||
|
* first processing window shall be 1. |
||||||
|
*/ |
||||||
|
AVRational window_lower_right_corner_x; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The relative y coordinate of the bottom right pixel of the processing |
||||||
|
* window. The value shall be in the range of 0 and 1, inclusive and |
||||||
|
* in multiples of 1/(height of Picture - 1). The value 1 corresponds |
||||||
|
* to the absolute coordinate of height of Picture - 1. The value for |
||||||
|
* first processing window shall be 1. |
||||||
|
*/ |
||||||
|
AVRational window_lower_right_corner_y; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The x coordinate of the center position of the concentric internal and |
||||||
|
* external ellipses of the elliptical pixel selector in the processing |
||||||
|
* window. The value shall be in the range of 0 to (width of Picture - 1), |
||||||
|
* inclusive and in multiples of 1 pixel. |
||||||
|
*/ |
||||||
|
uint16_t center_of_ellipse_x; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The y coordinate of the center position of the concentric internal and |
||||||
|
* external ellipses of the elliptical pixel selector in the processing |
||||||
|
* window. The value shall be in the range of 0 to (height of Picture - 1), |
||||||
|
* inclusive and in multiples of 1 pixel. |
||||||
|
*/ |
||||||
|
uint16_t center_of_ellipse_y; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The clockwise rotation angle in degree of arc with respect to the |
||||||
|
* positive direction of the x-axis of the concentric internal and external |
||||||
|
* ellipses of the elliptical pixel selector in the processing window. The |
||||||
|
* value shall be in the range of 0 to 180, inclusive and in multiples of 1. |
||||||
|
*/ |
||||||
|
uint8_t rotation_angle; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The semi-major axis value of the internal ellipse of the elliptical pixel |
||||||
|
* selector in amount of pixels in the processing window. The value shall be |
||||||
|
* in the range of 1 to 65535, inclusive and in multiples of 1 pixel. |
||||||
|
*/ |
||||||
|
uint16_t semimajor_axis_internal_ellipse; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The semi-major axis value of the external ellipse of the elliptical pixel |
||||||
|
* selector in amount of pixels in the processing window. The value |
||||||
|
* shall not be less than semimajor_axis_internal_ellipse of the current |
||||||
|
* processing window. The value shall be in the range of 1 to 65535, |
||||||
|
* inclusive and in multiples of 1 pixel. |
||||||
|
*/ |
||||||
|
uint16_t semimajor_axis_external_ellipse; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The semi-minor axis value of the external ellipse of the elliptical pixel |
||||||
|
* selector in amount of pixels in the processing window. The value shall be |
||||||
|
* in the range of 1 to 65535, inclusive and in multiples of 1 pixel. |
||||||
|
*/ |
||||||
|
uint16_t semiminor_axis_external_ellipse; |
||||||
|
|
||||||
|
/**
|
||||||
|
* Overlap process option indicates one of the two methods of combining |
||||||
|
* rendered pixels in the processing window in an image with at least one |
||||||
|
* elliptical pixel selector. For overlapping elliptical pixel selectors |
||||||
|
* in an image, overlap_process_option shall have the same value. |
||||||
|
*/ |
||||||
|
enum AVHDRPlusOverlapProcessOption overlap_process_option; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The maximum of the color components of linearized RGB values in the |
||||||
|
* processing window in the scene. The values should be in the range of 0 to |
||||||
|
* 1, inclusive and in multiples of 0.00001. maxscl[ 0 ], maxscl[ 1 ], and |
||||||
|
* maxscl[ 2 ] are corresponding to R, G, B color components respectively. |
||||||
|
*/ |
||||||
|
AVRational maxscl[3]; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The average of linearized maxRGB values in the processing window in the |
||||||
|
* scene. The value should be in the range of 0 to 1, inclusive and in |
||||||
|
* multiples of 0.00001. |
||||||
|
*/ |
||||||
|
AVRational average_maxrgb; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of linearized maxRGB values at given percentiles in the |
||||||
|
* processing window in the scene. The maximum value shall be 15. |
||||||
|
*/ |
||||||
|
uint8_t num_distribution_maxrgb_percentiles; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The linearized maxRGB values at given percentiles in the |
||||||
|
* processing window in the scene. |
||||||
|
*/ |
||||||
|
AVHDRPlusPercentile distribution_maxrgb[15]; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The fraction of selected pixels in the image that contains the brightest |
||||||
|
* pixel in the scene. The value shall be in the range of 0 to 1, inclusive |
||||||
|
* and in multiples of 0.001. |
||||||
|
*/ |
||||||
|
AVRational fraction_bright_pixels; |
||||||
|
|
||||||
|
/**
|
||||||
|
* This flag indicates that the metadata for the tone mapping function in |
||||||
|
* the processing window is present (for value of 1). |
||||||
|
*/ |
||||||
|
uint8_t tone_mapping_flag; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The x coordinate of the separation point between the linear part and the |
||||||
|
* curved part of the tone mapping function. The value shall be in the range |
||||||
|
* of 0 to 1, excluding 0 and in multiples of 1/4095. |
||||||
|
*/ |
||||||
|
AVRational knee_point_x; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The y coordinate of the separation point between the linear part and the |
||||||
|
* curved part of the tone mapping function. The value shall be in the range |
||||||
|
* of 0 to 1, excluding 0 and in multiples of 1/4095. |
||||||
|
*/ |
||||||
|
AVRational knee_point_y; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of the intermediate anchor parameters of the tone mapping |
||||||
|
* function in the processing window. The maximum value shall be 15. |
||||||
|
*/ |
||||||
|
uint8_t num_bezier_curve_anchors; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The intermediate anchor parameters of the tone mapping function in the |
||||||
|
* processing window in the scene. The values should be in the range of 0 |
||||||
|
* to 1, inclusive and in multiples of 1/1023. |
||||||
|
*/ |
||||||
|
AVRational bezier_curve_anchors[15]; |
||||||
|
|
||||||
|
/**
|
||||||
|
* This flag shall be equal to 0 in bitstreams conforming to this version of |
||||||
|
* this Specification. Other values are reserved for future use. |
||||||
|
*/ |
||||||
|
uint8_t color_saturation_mapping_flag; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The color saturation gain in the processing window in the scene. The |
||||||
|
* value shall be in the range of 0 to 63/8, inclusive and in multiples of |
||||||
|
* 1/8. The default value shall be 1. |
||||||
|
*/ |
||||||
|
AVRational color_saturation_weight; |
||||||
|
} AVHDRPlusColorTransformParams; |
||||||
|
|
||||||
|
/**
|
||||||
|
* This struct represents dynamic metadata for color volume transform - |
||||||
|
* application 4 of SMPTE 2094-40:2016 standard. |
||||||
|
* |
||||||
|
* To be used as payload of a AVFrameSideData or AVPacketSideData with the |
||||||
|
* appropriate type. |
||||||
|
* |
||||||
|
* @note The struct should be allocated with |
||||||
|
* av_dynamic_hdr_plus_alloc() and its size is not a part of |
||||||
|
* the public ABI. |
||||||
|
*/ |
||||||
|
typedef struct AVDynamicHDRPlus { |
||||||
|
/**
|
||||||
|
* Country code by Rec. ITU-T T.35 Annex A. The value shall be 0xB5. |
||||||
|
*/ |
||||||
|
uint8_t itu_t_t35_country_code; |
||||||
|
|
||||||
|
/**
|
||||||
|
* Application version in the application defining document in ST-2094 |
||||||
|
* suite. The value shall be set to 0. |
||||||
|
*/ |
||||||
|
uint8_t application_version; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of processing windows. The value shall be in the range |
||||||
|
* of 1 to 3, inclusive. |
||||||
|
*/ |
||||||
|
uint8_t num_windows; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The color transform parameters for every processing window. |
||||||
|
*/ |
||||||
|
AVHDRPlusColorTransformParams params[3]; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The nominal maximum display luminance of the targeted system display, |
||||||
|
* in units of 0.0001 candelas per square metre. The value shall be in |
||||||
|
* the range of 0 to 10000, inclusive. |
||||||
|
*/ |
||||||
|
AVRational targeted_system_display_maximum_luminance; |
||||||
|
|
||||||
|
/**
|
||||||
|
* This flag shall be equal to 0 in bit streams conforming to this version |
||||||
|
* of this Specification. The value 1 is reserved for future use. |
||||||
|
*/ |
||||||
|
uint8_t targeted_system_display_actual_peak_luminance_flag; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of rows in the targeted system_display_actual_peak_luminance |
||||||
|
* array. The value shall be in the range of 2 to 25, inclusive. |
||||||
|
*/ |
||||||
|
uint8_t num_rows_targeted_system_display_actual_peak_luminance; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of columns in the |
||||||
|
* targeted_system_display_actual_peak_luminance array. The value shall be |
||||||
|
* in the range of 2 to 25, inclusive. |
||||||
|
*/ |
||||||
|
uint8_t num_cols_targeted_system_display_actual_peak_luminance; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The normalized actual peak luminance of the targeted system display. The |
||||||
|
* values should be in the range of 0 to 1, inclusive and in multiples of |
||||||
|
* 1/15. |
||||||
|
*/ |
||||||
|
AVRational targeted_system_display_actual_peak_luminance[25][25]; |
||||||
|
|
||||||
|
/**
|
||||||
|
* This flag shall be equal to 0 in bitstreams conforming to this version of |
||||||
|
* this Specification. The value 1 is reserved for future use. |
||||||
|
*/ |
||||||
|
uint8_t mastering_display_actual_peak_luminance_flag; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of rows in the mastering_display_actual_peak_luminance array. |
||||||
|
* The value shall be in the range of 2 to 25, inclusive. |
||||||
|
*/ |
||||||
|
uint8_t num_rows_mastering_display_actual_peak_luminance; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of columns in the mastering_display_actual_peak_luminance |
||||||
|
* array. The value shall be in the range of 2 to 25, inclusive. |
||||||
|
*/ |
||||||
|
uint8_t num_cols_mastering_display_actual_peak_luminance; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The normalized actual peak luminance of the mastering display used for |
||||||
|
* mastering the image essence. The values should be in the range of 0 to 1, |
||||||
|
* inclusive and in multiples of 1/15. |
||||||
|
*/ |
||||||
|
AVRational mastering_display_actual_peak_luminance[25][25]; |
||||||
|
} AVDynamicHDRPlus; |
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocate an AVDynamicHDRPlus structure and set its fields to |
||||||
|
* default values. The resulting struct can be freed using av_freep(). |
||||||
|
* |
||||||
|
* @return An AVDynamicHDRPlus filled with default values or NULL |
||||||
|
* on failure. |
||||||
|
*/ |
||||||
|
AVDynamicHDRPlus *av_dynamic_hdr_plus_alloc(size_t *size); |
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocate a complete AVDynamicHDRPlus and add it to the frame. |
||||||
|
* @param frame The frame which side data is added to. |
||||||
|
* |
||||||
|
* @return The AVDynamicHDRPlus structure to be filled by caller or NULL |
||||||
|
* on failure. |
||||||
|
*/ |
||||||
|
AVDynamicHDRPlus *av_dynamic_hdr_plus_create_side_data(AVFrame *frame); |
||||||
|
|
||||||
|
#endif /* AVUTIL_HDR_DYNAMIC_METADATA_H */ |
@ -0,0 +1,169 @@ |
|||||||
|
/*
|
||||||
|
* 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_D3D11VA_H |
||||||
|
#define AVUTIL_HWCONTEXT_D3D11VA_H |
||||||
|
|
||||||
|
/**
|
||||||
|
* @file |
||||||
|
* An API-specific header for AV_HWDEVICE_TYPE_D3D11VA. |
||||||
|
* |
||||||
|
* The default pool implementation will be fixed-size if initial_pool_size is |
||||||
|
* set (and allocate elements from an array texture). Otherwise it will allocate |
||||||
|
* individual textures. Be aware that decoding requires a single array texture. |
||||||
|
* |
||||||
|
* Using sw_format==AV_PIX_FMT_YUV420P has special semantics, and maps to |
||||||
|
* DXGI_FORMAT_420_OPAQUE. av_hwframe_transfer_data() is not supported for |
||||||
|
* this format. Refer to MSDN for details. |
||||||
|
* |
||||||
|
* av_hwdevice_ctx_create() for this device type supports a key named "debug" |
||||||
|
* for the AVDictionary entry. If this is set to any value, the device creation |
||||||
|
* code will try to load various supported D3D debugging layers. |
||||||
|
*/ |
||||||
|
|
||||||
|
#include <d3d11.h> |
||||||
|
#include <stdint.h> |
||||||
|
|
||||||
|
/**
|
||||||
|
* This struct is allocated as AVHWDeviceContext.hwctx |
||||||
|
*/ |
||||||
|
typedef struct AVD3D11VADeviceContext { |
||||||
|
/**
|
||||||
|
* Device used for texture creation and access. This can also be used to |
||||||
|
* set the libavcodec decoding device. |
||||||
|
* |
||||||
|
* Must be set by the user. This is the only mandatory field - the other |
||||||
|
* device context fields are set from this and are available for convenience. |
||||||
|
* |
||||||
|
* Deallocating the AVHWDeviceContext will always release this interface, |
||||||
|
* and it does not matter whether it was user-allocated. |
||||||
|
*/ |
||||||
|
ID3D11Device *device; |
||||||
|
|
||||||
|
/**
|
||||||
|
* If unset, this will be set from the device field on init. |
||||||
|
* |
||||||
|
* Deallocating the AVHWDeviceContext will always release this interface, |
||||||
|
* and it does not matter whether it was user-allocated. |
||||||
|
*/ |
||||||
|
ID3D11DeviceContext *device_context; |
||||||
|
|
||||||
|
/**
|
||||||
|
* If unset, this will be set from the device field on init. |
||||||
|
* |
||||||
|
* Deallocating the AVHWDeviceContext will always release this interface, |
||||||
|
* and it does not matter whether it was user-allocated. |
||||||
|
*/ |
||||||
|
ID3D11VideoDevice *video_device; |
||||||
|
|
||||||
|
/**
|
||||||
|
* If unset, this will be set from the device_context field on init. |
||||||
|
* |
||||||
|
* Deallocating the AVHWDeviceContext will always release this interface, |
||||||
|
* and it does not matter whether it was user-allocated. |
||||||
|
*/ |
||||||
|
ID3D11VideoContext *video_context; |
||||||
|
|
||||||
|
/**
|
||||||
|
* Callbacks for locking. They protect accesses to device_context and |
||||||
|
* video_context calls. They also protect access to the internal staging |
||||||
|
* texture (for av_hwframe_transfer_data() calls). They do NOT protect |
||||||
|
* access to hwcontext or decoder state in general. |
||||||
|
* |
||||||
|
* If unset on init, the hwcontext implementation will set them to use an |
||||||
|
* internal mutex. |
||||||
|
* |
||||||
|
* The underlying lock must be recursive. lock_ctx is for free use by the |
||||||
|
* locking implementation. |
||||||
|
*/ |
||||||
|
void (*lock)(void *lock_ctx); |
||||||
|
void (*unlock)(void *lock_ctx); |
||||||
|
void *lock_ctx; |
||||||
|
} AVD3D11VADeviceContext; |
||||||
|
|
||||||
|
/**
|
||||||
|
* D3D11 frame descriptor for pool allocation. |
||||||
|
* |
||||||
|
* In user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs |
||||||
|
* with the data pointer pointing at an object of this type describing the |
||||||
|
* planes of the frame. |
||||||
|
* |
||||||
|
* This has no use outside of custom allocation, and AVFrame AVBufferRef do not |
||||||
|
* necessarily point to an instance of this struct. |
||||||
|
*/ |
||||||
|
typedef struct AVD3D11FrameDescriptor { |
||||||
|
/**
|
||||||
|
* The texture in which the frame is located. The reference count is |
||||||
|
* managed by the AVBufferRef, and destroying the reference will release |
||||||
|
* the interface. |
||||||
|
* |
||||||
|
* Normally stored in AVFrame.data[0]. |
||||||
|
*/ |
||||||
|
ID3D11Texture2D *texture; |
||||||
|
|
||||||
|
/**
|
||||||
|
* The index into the array texture element representing the frame, or 0 |
||||||
|
* if the texture is not an array texture. |
||||||
|
* |
||||||
|
* Normally stored in AVFrame.data[1] (cast from intptr_t). |
||||||
|
*/ |
||||||
|
intptr_t index; |
||||||
|
} AVD3D11FrameDescriptor; |
||||||
|
|
||||||
|
/**
|
||||||
|
* This struct is allocated as AVHWFramesContext.hwctx |
||||||
|
*/ |
||||||
|
typedef struct AVD3D11VAFramesContext { |
||||||
|
/**
|
||||||
|
* The canonical texture used for pool allocation. If this is set to NULL |
||||||
|
* on init, the hwframes implementation will allocate and set an array |
||||||
|
* texture if initial_pool_size > 0. |
||||||
|
* |
||||||
|
* The only situation when the API user should set this is: |
||||||
|
* - the user wants to do manual pool allocation (setting |
||||||
|
* AVHWFramesContext.pool), instead of letting AVHWFramesContext |
||||||
|
* allocate the pool |
||||||
|
* - of an array texture |
||||||
|
* - and wants it to use it for decoding |
||||||
|
* - this has to be done before calling av_hwframe_ctx_init() |
||||||
|
* |
||||||
|
* Deallocating the AVHWFramesContext will always release this interface, |
||||||
|
* and it does not matter whether it was user-allocated. |
||||||
|
* |
||||||
|
* This is in particular used by the libavcodec D3D11VA hwaccel, which |
||||||
|
* requires a single array texture. It will create ID3D11VideoDecoderOutputView |
||||||
|
* objects for each array texture element on decoder initialization. |
||||||
|
*/ |
||||||
|
ID3D11Texture2D *texture; |
||||||
|
|
||||||
|
/**
|
||||||
|
* D3D11_TEXTURE2D_DESC.BindFlags used for texture creation. The user must |
||||||
|
* at least set D3D11_BIND_DECODER if the frames context is to be used for |
||||||
|
* video decoding. |
||||||
|
* This field is ignored/invalid if a user-allocated texture is provided. |
||||||
|
*/ |
||||||
|
UINT BindFlags; |
||||||
|
|
||||||
|
/**
|
||||||
|
* D3D11_TEXTURE2D_DESC.MiscFlags used for texture creation. |
||||||
|
* This field is ignored/invalid if a user-allocated texture is provided. |
||||||
|
*/ |
||||||
|
UINT MiscFlags; |
||||||
|
} AVD3D11VAFramesContext; |
||||||
|
|
||||||
|
#endif /* AVUTIL_HWCONTEXT_D3D11VA_H */ |
@ -0,0 +1,169 @@ |
|||||||
|
/*
|
||||||
|
* 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_DRM_H |
||||||
|
#define AVUTIL_HWCONTEXT_DRM_H |
||||||
|
|
||||||
|
#include <stddef.h> |
||||||
|
#include <stdint.h> |
||||||
|
|
||||||
|
/**
|
||||||
|
* @file |
||||||
|
* API-specific header for AV_HWDEVICE_TYPE_DRM. |
||||||
|
* |
||||||
|
* Internal frame allocation is not currently supported - all frames |
||||||
|
* must be allocated by the user. Thus AVHWFramesContext is always |
||||||
|
* NULL, though this may change if support for frame allocation is |
||||||
|
* added in future. |
||||||
|
*/ |
||||||
|
|
||||||
|
enum { |
||||||
|
/**
|
||||||
|
* The maximum number of layers/planes in a DRM frame. |
||||||
|
*/ |
||||||
|
AV_DRM_MAX_PLANES = 4 |
||||||
|
}; |
||||||
|
|
||||||
|
/**
|
||||||
|
* DRM object descriptor. |
||||||
|
* |
||||||
|
* Describes a single DRM object, addressing it as a PRIME file |
||||||
|
* descriptor. |
||||||
|
*/ |
||||||
|
typedef struct AVDRMObjectDescriptor { |
||||||
|
/**
|
||||||
|
* DRM PRIME fd for the object. |
||||||
|
*/ |
||||||
|
int fd; |
||||||
|
/**
|
||||||
|
* Total size of the object. |
||||||
|
* |
||||||
|
* (This includes any parts not which do not contain image data.) |
||||||
|
*/ |
||||||
|
size_t size; |
||||||
|
/**
|
||||||
|
* Format modifier applied to the object (DRM_FORMAT_MOD_*). |
||||||
|
* |
||||||
|
* If the format modifier is unknown then this should be set to |
||||||
|
* DRM_FORMAT_MOD_INVALID. |
||||||
|
*/ |
||||||
|
uint64_t format_modifier; |
||||||
|
} AVDRMObjectDescriptor; |
||||||
|
|
||||||
|
/**
|
||||||
|
* DRM plane descriptor. |
||||||
|
* |
||||||
|
* Describes a single plane of a layer, which is contained within |
||||||
|
* a single object. |
||||||
|
*/ |
||||||
|
typedef struct AVDRMPlaneDescriptor { |
||||||
|
/**
|
||||||
|
* Index of the object containing this plane in the objects |
||||||
|
* array of the enclosing frame descriptor. |
||||||
|
*/ |
||||||
|
int object_index; |
||||||
|
/**
|
||||||
|
* Offset within that object of this plane. |
||||||
|
*/ |
||||||
|
ptrdiff_t offset; |
||||||
|
/**
|
||||||
|
* Pitch (linesize) of this plane. |
||||||
|
*/ |
||||||
|
ptrdiff_t pitch; |
||||||
|
} AVDRMPlaneDescriptor; |
||||||
|
|
||||||
|
/**
|
||||||
|
* DRM layer descriptor. |
||||||
|
* |
||||||
|
* Describes a single layer within a frame. This has the structure |
||||||
|
* defined by its format, and will contain one or more planes. |
||||||
|
*/ |
||||||
|
typedef struct AVDRMLayerDescriptor { |
||||||
|
/**
|
||||||
|
* Format of the layer (DRM_FORMAT_*). |
||||||
|
*/ |
||||||
|
uint32_t format; |
||||||
|
/**
|
||||||
|
* Number of planes in the layer. |
||||||
|
* |
||||||
|
* This must match the number of planes required by format. |
||||||
|
*/ |
||||||
|
int nb_planes; |
||||||
|
/**
|
||||||
|
* Array of planes in this layer. |
||||||
|
*/ |
||||||
|
AVDRMPlaneDescriptor planes[AV_DRM_MAX_PLANES]; |
||||||
|
} AVDRMLayerDescriptor; |
||||||
|
|
||||||
|
/**
|
||||||
|
* DRM frame descriptor. |
||||||
|
* |
||||||
|
* This is used as the data pointer for AV_PIX_FMT_DRM_PRIME frames. |
||||||
|
* It is also used by user-allocated frame pools - allocating in |
||||||
|
* AVHWFramesContext.pool must return AVBufferRefs which contain |
||||||
|
* an object of this type. |
||||||
|
* |
||||||
|
* The fields of this structure should be set such it can be |
||||||
|
* imported directly by EGL using the EGL_EXT_image_dma_buf_import |
||||||
|
* and EGL_EXT_image_dma_buf_import_modifiers extensions. |
||||||
|
* (Note that the exact layout of a particular format may vary between |
||||||
|
* platforms - we only specify that the same platform should be able |
||||||
|
* to import it.) |
||||||
|
* |
||||||
|
* The total number of planes must not exceed AV_DRM_MAX_PLANES, and |
||||||
|
* the order of the planes by increasing layer index followed by |
||||||
|
* increasing plane index must be the same as the order which would |
||||||
|
* be used for the data pointers in the equivalent software format. |
||||||
|
*/ |
||||||
|
typedef struct AVDRMFrameDescriptor { |
||||||
|
/**
|
||||||
|
* Number of DRM objects making up this frame. |
||||||
|
*/ |
||||||
|
int nb_objects; |
||||||
|
/**
|
||||||
|
* Array of objects making up the frame. |
||||||
|
*/ |
||||||
|
AVDRMObjectDescriptor objects[AV_DRM_MAX_PLANES]; |
||||||
|
/**
|
||||||
|
* Number of layers in the frame. |
||||||
|
*/ |
||||||
|
int nb_layers; |
||||||
|
/**
|
||||||
|
* Array of layers in the frame. |
||||||
|
*/ |
||||||
|
AVDRMLayerDescriptor layers[AV_DRM_MAX_PLANES]; |
||||||
|
} AVDRMFrameDescriptor; |
||||||
|
|
||||||
|
/**
|
||||||
|
* DRM device. |
||||||
|
* |
||||||
|
* Allocated as AVHWDeviceContext.hwctx. |
||||||
|
*/ |
||||||
|
typedef struct AVDRMDeviceContext { |
||||||
|
/**
|
||||||
|
* File descriptor of DRM device. |
||||||
|
* |
||||||
|
* This is used as the device to create frames on, and may also be |
||||||
|
* used in some derivation and mapping operations. |
||||||
|
* |
||||||
|
* If no device is required, set to -1. |
||||||
|
*/ |
||||||
|
int fd; |
||||||
|
} AVDRMDeviceContext; |
||||||
|
|
||||||
|
#endif /* AVUTIL_HWCONTEXT_DRM_H */ |
@ -0,0 +1,36 @@ |
|||||||
|
/*
|
||||||
|
* 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_MEDIACODEC_H |
||||||
|
#define AVUTIL_HWCONTEXT_MEDIACODEC_H |
||||||
|
|
||||||
|
/**
|
||||||
|
* MediaCodec details. |
||||||
|
* |
||||||
|
* Allocated as AVHWDeviceContext.hwctx |
||||||
|
*/ |
||||||
|
typedef struct AVMediaCodecDeviceContext { |
||||||
|
/**
|
||||||
|
* android/view/Surface handle, to be filled by the user. |
||||||
|
* |
||||||
|
* This is the default surface used by decoders on this device. |
||||||
|
*/ |
||||||
|
void *surface; |
||||||
|
} AVMediaCodecDeviceContext; |
||||||
|
|
||||||
|
#endif /* AVUTIL_HWCONTEXT_MEDIACODEC_H */ |
@ -0,0 +1,54 @@ |
|||||||
|
/*
|
||||||
|
* This file is part of FFmpeg. |
||||||
|
* |
||||||
|
* FFmpeg is free software; you can redistribute it and/or |
||||||
|
* modify it under the terms of the GNU Lesser General Public |
||||||
|
* License as published by the Free Software Foundation; either |
||||||
|
* version 2.1 of the License, or (at your option) any later version. |
||||||
|
* |
||||||
|
* FFmpeg is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||||||
|
* Lesser General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Lesser General Public |
||||||
|
* License along with FFmpeg; if not, write to the Free Software |
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
||||||
|
*/ |
||||||
|
|
||||||
|
#ifndef AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H |
||||||
|
#define AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H |
||||||
|
|
||||||
|
#include <stdint.h> |
||||||
|
|
||||||
|
#include <VideoToolbox/VideoToolbox.h> |
||||||
|
|
||||||
|
#include "pixfmt.h" |
||||||
|
|
||||||
|
/**
|
||||||
|
* @file |
||||||
|
* An API-specific header for AV_HWDEVICE_TYPE_VIDEOTOOLBOX. |
||||||
|
* |
||||||
|
* This API currently does not support frame allocation, as the raw VideoToolbox |
||||||
|
* API does allocation, and FFmpeg itself never has the need to allocate frames. |
||||||
|
* |
||||||
|
* If the API user sets a custom pool, AVHWFramesContext.pool must return |
||||||
|
* AVBufferRefs whose data pointer is a CVImageBufferRef or CVPixelBufferRef. |
||||||
|
* |
||||||
|
* Currently AVHWDeviceContext.hwctx and AVHWFramesContext.hwctx are always |
||||||
|
* NULL. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a VideoToolbox (actually CoreVideo) format to AVPixelFormat. |
||||||
|
* Returns AV_PIX_FMT_NONE if no known equivalent was found. |
||||||
|
*/ |
||||||
|
enum AVPixelFormat av_map_videotoolbox_format_to_pixfmt(uint32_t cv_fmt); |
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert an AVPixelFormat to a VideoToolbox (actually CoreVideo) format. |
||||||
|
* Returns 0 if no known equivalent was found. |
||||||
|
*/ |
||||||
|
uint32_t av_map_videotoolbox_format_from_pixfmt(enum AVPixelFormat pix_fmt); |
||||||
|
|
||||||
|
#endif /* AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H */ |
@ -0,0 +1,28 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at> |
||||||
|
* |
||||||
|
* This file is part of FFmpeg. |
||||||
|
* |
||||||
|
* FFmpeg is free software; you can redistribute it and/or |
||||||
|
* modify it under the terms of the GNU Lesser General Public |
||||||
|
* License as published by the Free Software Foundation; either |
||||||
|
* version 2.1 of the License, or (at your option) any later version. |
||||||
|
* |
||||||
|
* FFmpeg is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||||||
|
* Lesser General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Lesser General Public |
||||||
|
* License along with FFmpeg; if not, write to the Free Software |
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
||||||
|
*/ |
||||||
|
|
||||||
|
#ifndef AVUTIL_REVERSE_H |
||||||
|
#define AVUTIL_REVERSE_H |
||||||
|
|
||||||
|
#include <stdint.h> |
||||||
|
|
||||||
|
extern const uint8_t ff_reverse[256]; |
||||||
|
|
||||||
|
#endif /* AVUTIL_REVERSE_H */ |
@ -0,0 +1,232 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016 Vittorio Giovara <vittorio.giovara@gmail.com> |
||||||
|
* |
||||||
|
* This file is part of FFmpeg. |
||||||
|
* |
||||||
|
* FFmpeg is free software; you can redistribute it and/or |
||||||
|
* modify it under the terms of the GNU Lesser General Public |
||||||
|
* License as published by the Free Software Foundation; either |
||||||
|
* version 2.1 of the License, or (at your option) any later version. |
||||||
|
* |
||||||
|
* FFmpeg is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||||||
|
* Lesser General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Lesser General Public |
||||||
|
* License along with FFmpeg; if not, write to the Free Software |
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* @file |
||||||
|
* Spherical video |
||||||
|
*/ |
||||||
|
|
||||||
|
#ifndef AVUTIL_SPHERICAL_H |
||||||
|
#define AVUTIL_SPHERICAL_H |
||||||
|
|
||||||
|
#include <stddef.h> |
||||||
|
#include <stdint.h> |
||||||
|
|
||||||
|
/**
|
||||||
|
* @addtogroup lavu_video |
||||||
|
* @{ |
||||||
|
* |
||||||
|
* @defgroup lavu_video_spherical Spherical video mapping |
||||||
|
* @{ |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* @addtogroup lavu_video_spherical |
||||||
|
* A spherical video file contains surfaces that need to be mapped onto a |
||||||
|
* sphere. Depending on how the frame was converted, a different distortion |
||||||
|
* transformation or surface recomposition function needs to be applied before |
||||||
|
* the video should be mapped and displayed. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Projection of the video surface(s) on a sphere. |
||||||
|
*/ |
||||||
|
enum AVSphericalProjection { |
||||||
|
/**
|
||||||
|
* Video represents a sphere mapped on a flat surface using |
||||||
|
* equirectangular projection. |
||||||
|
*/ |
||||||
|
AV_SPHERICAL_EQUIRECTANGULAR, |
||||||
|
|
||||||
|
/**
|
||||||
|
* Video frame is split into 6 faces of a cube, and arranged on a |
||||||
|
* 3x2 layout. Faces are oriented upwards for the front, left, right, |
||||||
|
* and back faces. The up face is oriented so the top of the face is |
||||||
|
* forwards and the down face is oriented so the top of the face is |
||||||
|
* to the back. |
||||||
|
*/ |
||||||
|
AV_SPHERICAL_CUBEMAP, |
||||||
|
|
||||||
|
/**
|
||||||
|
* Video represents a portion of a sphere mapped on a flat surface |
||||||
|
* using equirectangular projection. The @ref bounding fields indicate |
||||||
|
* the position of the current video in a larger surface. |
||||||
|
*/ |
||||||
|
AV_SPHERICAL_EQUIRECTANGULAR_TILE, |
||||||
|
}; |
||||||
|
|
||||||
|
/**
|
||||||
|
* This structure describes how to handle spherical videos, outlining |
||||||
|
* information about projection, initial layout, and any other view modifier. |
||||||
|
* |
||||||
|
* @note The struct must be allocated with av_spherical_alloc() and |
||||||
|
* its size is not a part of the public ABI. |
||||||
|
*/ |
||||||
|
typedef struct AVSphericalMapping { |
||||||
|
/**
|
||||||
|
* Projection type. |
||||||
|
*/ |
||||||
|
enum AVSphericalProjection projection; |
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Initial orientation |
||||||
|
* @{ |
||||||
|
* There fields describe additional rotations applied to the sphere after |
||||||
|
* the video frame is mapped onto it. The sphere is rotated around the |
||||||
|
* viewer, who remains stationary. The order of transformation is always |
||||||
|
* yaw, followed by pitch, and finally by roll. |
||||||
|
* |
||||||
|
* The coordinate system matches the one defined in OpenGL, where the |
||||||
|
* forward vector (z) is coming out of screen, and it is equivalent to |
||||||
|
* a rotation matrix of R = r_y(yaw) * r_x(pitch) * r_z(roll). |
||||||
|
* |
||||||
|
* A positive yaw rotates the portion of the sphere in front of the viewer |
||||||
|
* toward their right. A positive pitch rotates the portion of the sphere |
||||||
|
* in front of the viewer upwards. A positive roll tilts the portion of |
||||||
|
* the sphere in front of the viewer to the viewer's right. |
||||||
|
* |
||||||
|
* These values are exported as 16.16 fixed point. |
||||||
|
* |
||||||
|
* See this equirectangular projection as example: |
||||||
|
* |
||||||
|
* @code{.unparsed} |
||||||
|
* Yaw |
||||||
|
* -180 0 180 |
||||||
|
* 90 +-------------+-------------+ 180 |
||||||
|
* | | | up |
||||||
|
* P | | | y| forward |
||||||
|
* i | ^ | | /z |
||||||
|
* t 0 +-------------X-------------+ 0 Roll | / |
||||||
|
* c | | | | / |
||||||
|
* h | | | 0|/_____right |
||||||
|
* | | | x |
||||||
|
* -90 +-------------+-------------+ -180 |
||||||
|
* |
||||||
|
* X - the default camera center |
||||||
|
* ^ - the default up vector |
||||||
|
* @endcode |
||||||
|
*/ |
||||||
|
int32_t yaw; ///< Rotation around the up vector [-180, 180].
|
||||||
|
int32_t pitch; ///< Rotation around the right vector [-90, 90].
|
||||||
|
int32_t roll; ///< Rotation around the forward vector [-180, 180].
|
||||||
|
/**
|
||||||
|
* @} |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Bounding rectangle |
||||||
|
* @anchor bounding |
||||||
|
* @{ |
||||||
|
* These fields indicate the location of the current tile, and where |
||||||
|
* it should be mapped relative to the original surface. They are |
||||||
|
* exported as 0.32 fixed point, and can be converted to classic |
||||||
|
* pixel values with av_spherical_bounds(). |
||||||
|
* |
||||||
|
* @code{.unparsed} |
||||||
|
* +----------------+----------+ |
||||||
|
* | |bound_top | |
||||||
|
* | +--------+ | |
||||||
|
* | bound_left |tile | | |
||||||
|
* +<---------->| |<--->+bound_right |
||||||
|
* | +--------+ | |
||||||
|
* | | | |
||||||
|
* | bound_bottom| | |
||||||
|
* +----------------+----------+ |
||||||
|
* @endcode |
||||||
|
* |
||||||
|
* If needed, the original video surface dimensions can be derived |
||||||
|
* by adding the current stream or frame size to the related bounds, |
||||||
|
* like in the following example: |
||||||
|
* |
||||||
|
* @code{c} |
||||||
|
* original_width = tile->width + bound_left + bound_right; |
||||||
|
* original_height = tile->height + bound_top + bound_bottom; |
||||||
|
* @endcode |
||||||
|
* |
||||||
|
* @note These values are valid only for the tiled equirectangular |
||||||
|
* projection type (@ref AV_SPHERICAL_EQUIRECTANGULAR_TILE), |
||||||
|
* and should be ignored in all other cases. |
||||||
|
*/ |
||||||
|
uint32_t bound_left; ///< Distance from the left edge
|
||||||
|
uint32_t bound_top; ///< Distance from the top edge
|
||||||
|
uint32_t bound_right; ///< Distance from the right edge
|
||||||
|
uint32_t bound_bottom; ///< Distance from the bottom edge
|
||||||
|
/**
|
||||||
|
* @} |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of pixels to pad from the edge of each cube face. |
||||||
|
* |
||||||
|
* @note This value is valid for only for the cubemap projection type |
||||||
|
* (@ref AV_SPHERICAL_CUBEMAP), and should be ignored in all other |
||||||
|
* cases. |
||||||
|
*/ |
||||||
|
uint32_t padding; |
||||||
|
} AVSphericalMapping; |
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocate a AVSphericalVideo structure and initialize its fields to default |
||||||
|
* values. |
||||||
|
* |
||||||
|
* @return the newly allocated struct or NULL on failure |
||||||
|
*/ |
||||||
|
AVSphericalMapping *av_spherical_alloc(size_t *size); |
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the @ref bounding fields from an AVSphericalVideo |
||||||
|
* from 0.32 fixed point to pixels. |
||||||
|
* |
||||||
|
* @param map The AVSphericalVideo map to read bound values from. |
||||||
|
* @param width Width of the current frame or stream. |
||||||
|
* @param height Height of the current frame or stream. |
||||||
|
* @param left Pixels from the left edge. |
||||||
|
* @param top Pixels from the top edge. |
||||||
|
* @param right Pixels from the right edge. |
||||||
|
* @param bottom Pixels from the bottom edge. |
||||||
|
*/ |
||||||
|
void av_spherical_tile_bounds(const AVSphericalMapping *map, |
||||||
|
size_t width, size_t height, |
||||||
|
size_t *left, size_t *top, |
||||||
|
size_t *right, size_t *bottom); |
||||||
|
|
||||||
|
/**
|
||||||
|
* Provide a human-readable name of a given AVSphericalProjection. |
||||||
|
* |
||||||
|
* @param projection The input AVSphericalProjection. |
||||||
|
* |
||||||
|
* @return The name of the AVSphericalProjection, or "unknown". |
||||||
|
*/ |
||||||
|
const char *av_spherical_projection_name(enum AVSphericalProjection projection); |
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the AVSphericalProjection form a human-readable name. |
||||||
|
* |
||||||
|
* @param name The input string. |
||||||
|
* |
||||||
|
* @return The AVSphericalProjection value, or -1 if not found. |
||||||
|
*/ |
||||||
|
int av_spherical_from_name(const char *name); |
||||||
|
/**
|
||||||
|
* @} |
||||||
|
* @} |
||||||
|
*/ |
||||||
|
|
||||||
|
#endif /* AVUTIL_SPHERICAL_H */ |
@ -0,0 +1,173 @@ |
|||||||
|
/*
|
||||||
|
* 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 |
||||||
|
*/ |
||||||
|
|
||||||
|
// This header should only be used to simplify code where
|
||||||
|
// threading is optional, not as a generic threading abstraction.
|
||||||
|
|
||||||
|
#ifndef AVUTIL_THREAD_H |
||||||
|
#define AVUTIL_THREAD_H |
||||||
|
|
||||||
|
#include "ffmpeg/config.h" |
||||||
|
|
||||||
|
#if HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS2THREADS |
||||||
|
|
||||||
|
#if HAVE_PTHREADS |
||||||
|
#include <pthread.h> |
||||||
|
|
||||||
|
#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 |
||||||
|
|
||||||
|
#include "log.h" |
||||||
|
|
||||||
|
#define ASSERT_PTHREAD_NORET(func, ...) do { \ |
||||||
|
int ret = func(__VA_ARGS__); \
|
||||||
|
if (ret) { \
|
||||||
|
char errbuf[AV_ERROR_MAX_STRING_SIZE] = ""; \
|
||||||
|
av_log(NULL, AV_LOG_FATAL, AV_STRINGIFY(func) \
|
||||||
|
" failed with error: %s\n", \
|
||||||
|
av_make_error_string(errbuf, AV_ERROR_MAX_STRING_SIZE, \
|
||||||
|
AVERROR(ret))); \
|
||||||
|
abort(); \
|
||||||
|
} \
|
||||||
|
} while (0) |
||||||
|
|
||||||
|
#define ASSERT_PTHREAD(func, ...) do { \ |
||||||
|
ASSERT_PTHREAD_NORET(func, __VA_ARGS__); \
|
||||||
|
return 0; \
|
||||||
|
} while (0) |
||||||
|
|
||||||
|
static inline int strict_pthread_join(pthread_t thread, void **value_ptr) |
||||||
|
{ |
||||||
|
ASSERT_PTHREAD(pthread_join, thread, value_ptr); |
||||||
|
} |
||||||
|
|
||||||
|
static inline int strict_pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr) |
||||||
|
{ |
||||||
|
if (attr) { |
||||||
|
ASSERT_PTHREAD_NORET(pthread_mutex_init, mutex, attr); |
||||||
|
} else { |
||||||
|
pthread_mutexattr_t local_attr; |
||||||
|
ASSERT_PTHREAD_NORET(pthread_mutexattr_init, &local_attr); |
||||||
|
ASSERT_PTHREAD_NORET(pthread_mutexattr_settype, &local_attr, PTHREAD_MUTEX_ERRORCHECK); |
||||||
|
ASSERT_PTHREAD_NORET(pthread_mutex_init, mutex, &local_attr); |
||||||
|
ASSERT_PTHREAD_NORET(pthread_mutexattr_destroy, &local_attr); |
||||||
|
} |
||||||
|
return 0; |
||||||
|
} |
||||||
|
|
||||||
|
static inline int strict_pthread_mutex_destroy(pthread_mutex_t *mutex) |
||||||
|
{ |
||||||
|
ASSERT_PTHREAD(pthread_mutex_destroy, mutex); |
||||||
|
} |
||||||
|
|
||||||
|
static inline int strict_pthread_mutex_lock(pthread_mutex_t *mutex) |
||||||
|
{ |
||||||
|
ASSERT_PTHREAD(pthread_mutex_lock, mutex); |
||||||
|
} |
||||||
|
|
||||||
|
static inline int strict_pthread_mutex_unlock(pthread_mutex_t *mutex) |
||||||
|
{ |
||||||
|
ASSERT_PTHREAD(pthread_mutex_unlock, mutex); |
||||||
|
} |
||||||
|
|
||||||
|
static inline int strict_pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr) |
||||||
|
{ |
||||||
|
ASSERT_PTHREAD(pthread_cond_init, cond, attr); |
||||||
|
} |
||||||
|
|
||||||
|
static inline int strict_pthread_cond_destroy(pthread_cond_t *cond) |
||||||
|
{ |
||||||
|
ASSERT_PTHREAD(pthread_cond_destroy, cond); |
||||||
|
} |
||||||
|
|
||||||
|
static inline int strict_pthread_cond_signal(pthread_cond_t *cond) |
||||||
|
{ |
||||||
|
ASSERT_PTHREAD(pthread_cond_signal, cond); |
||||||
|
} |
||||||
|
|
||||||
|
static inline int strict_pthread_cond_broadcast(pthread_cond_t *cond) |
||||||
|
{ |
||||||
|
ASSERT_PTHREAD(pthread_cond_broadcast, cond); |
||||||
|
} |
||||||
|
|
||||||
|
static inline int strict_pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) |
||||||
|
{ |
||||||
|
ASSERT_PTHREAD(pthread_cond_wait, cond, mutex); |
||||||
|
} |
||||||
|
|
||||||
|
static inline int strict_pthread_once(pthread_once_t *once_control, void (*init_routine)(void)) |
||||||
|
{ |
||||||
|
ASSERT_PTHREAD(pthread_once, once_control, init_routine); |
||||||
|
} |
||||||
|
|
||||||
|
#define pthread_join strict_pthread_join |
||||||
|
#define pthread_mutex_init strict_pthread_mutex_init |
||||||
|
#define pthread_mutex_destroy strict_pthread_mutex_destroy |
||||||
|
#define pthread_mutex_lock strict_pthread_mutex_lock |
||||||
|
#define pthread_mutex_unlock strict_pthread_mutex_unlock |
||||||
|
#define pthread_cond_init strict_pthread_cond_init |
||||||
|
#define pthread_cond_destroy strict_pthread_cond_destroy |
||||||
|
#define pthread_cond_signal strict_pthread_cond_signal |
||||||
|
#define pthread_cond_broadcast strict_pthread_cond_broadcast |
||||||
|
#define pthread_cond_wait strict_pthread_cond_wait |
||||||
|
#define pthread_once strict_pthread_once |
||||||
|
#endif |
||||||
|
|
||||||
|
#elif HAVE_OS2THREADS |
||||||
|
#include "compat/os2threads.h" |
||||||
|
#else |
||||||
|
#include "compat/w32pthreads.h" |
||||||
|
#endif |
||||||
|
|
||||||
|
#define AVMutex pthread_mutex_t |
||||||
|
#define AV_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER |
||||||
|
|
||||||
|
#define ff_mutex_init pthread_mutex_init |
||||||
|
#define ff_mutex_lock pthread_mutex_lock |
||||||
|
#define ff_mutex_unlock pthread_mutex_unlock |
||||||
|
#define ff_mutex_destroy pthread_mutex_destroy |
||||||
|
|
||||||
|
#define AVOnce pthread_once_t |
||||||
|
#define AV_ONCE_INIT PTHREAD_ONCE_INIT |
||||||
|
|
||||||
|
#define ff_thread_once(control, routine) pthread_once(control, routine) |
||||||
|
|
||||||
|
#else |
||||||
|
|
||||||
|
#define AVMutex char |
||||||
|
#define AV_MUTEX_INITIALIZER 0 |
||||||
|
|
||||||
|
static inline int ff_mutex_init(AVMutex *mutex, const void *attr){ return 0; } |
||||||
|
static inline int ff_mutex_lock(AVMutex *mutex){ return 0; } |
||||||
|
static inline int ff_mutex_unlock(AVMutex *mutex){ return 0; } |
||||||
|
static inline int ff_mutex_destroy(AVMutex *mutex){ return 0; } |
||||||
|
|
||||||
|
#define AVOnce char |
||||||
|
#define AV_ONCE_INIT 0 |
||||||
|
|
||||||
|
static inline int ff_thread_once(char *control, void (*routine)(void)) |
||||||
|
{ |
||||||
|
if (!*control) { |
||||||
|
routine(); |
||||||
|
*control = 1; |
||||||
|
} |
||||||
|
return 0; |
||||||
|
} |
||||||
|
|
||||||
|
#endif |
||||||
|
|
||||||
|
#endif /* AVUTIL_THREAD_H */ |
@ -0,0 +1,81 @@ |
|||||||
|
/*
|
||||||
|
* This file is part of FFmpeg. |
||||||
|
* |
||||||
|
* FFmpeg is free software; you can redistribute it and/or |
||||||
|
* modify it under the terms of the GNU Lesser General Public |
||||||
|
* License as published by the Free Software Foundation; either |
||||||
|
* version 2.1 of the License, or (at your option) any later version. |
||||||
|
* |
||||||
|
* FFmpeg is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||||||
|
* Lesser General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Lesser General Public |
||||||
|
* License along with FFmpeg; if not, write to the Free Software |
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
||||||
|
*/ |
||||||
|
|
||||||
|
#ifndef AVUTIL_TX_H |
||||||
|
#define AVUTIL_TX_H |
||||||
|
|
||||||
|
#include <stdint.h> |
||||||
|
#include <stddef.h> |
||||||
|
|
||||||
|
typedef struct AVTXContext AVTXContext; |
||||||
|
|
||||||
|
typedef struct AVComplexFloat { |
||||||
|
float re, im; |
||||||
|
} AVComplexFloat; |
||||||
|
|
||||||
|
enum AVTXType { |
||||||
|
/**
|
||||||
|
* Standard complex to complex FFT with sample data type AVComplexFloat. |
||||||
|
* Scaling currently unsupported |
||||||
|
*/ |
||||||
|
AV_TX_FLOAT_FFT = 0, |
||||||
|
/**
|
||||||
|
* Standard MDCT with sample data type of float and a scale type of |
||||||
|
* float. Length is the frame size, not the window size (which is 2x frame) |
||||||
|
*/ |
||||||
|
AV_TX_FLOAT_MDCT = 1, |
||||||
|
}; |
||||||
|
|
||||||
|
/**
|
||||||
|
* Function pointer to a function to perform the transform. |
||||||
|
* |
||||||
|
* @note Using a different context than the one allocated during av_tx_init() |
||||||
|
* is not allowed. |
||||||
|
* |
||||||
|
* @param s the transform context |
||||||
|
* @param out the output array |
||||||
|
* @param in the input array |
||||||
|
* @param stride the input or output stride (depending on transform direction) |
||||||
|
* in bytes, currently implemented for all MDCT transforms |
||||||
|
*/ |
||||||
|
typedef void (*av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride); |
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize a transform context with the given configuration |
||||||
|
* Currently power of two lengths from 4 to 131072 are supported, along with |
||||||
|
* any length decomposable to a power of two and either 3, 5 or 15. |
||||||
|
* |
||||||
|
* @param ctx the context to allocate, will be NULL on error |
||||||
|
* @param tx pointer to the transform function pointer to set |
||||||
|
* @param type type the type of transform |
||||||
|
* @param inv whether to do an inverse or a forward transform |
||||||
|
* @param len the size of the transform in samples |
||||||
|
* @param scale pointer to the value to scale the output if supported by type |
||||||
|
* @param flags currently unused |
||||||
|
* |
||||||
|
* @return 0 on success, negative error code on failure |
||||||
|
*/ |
||||||
|
int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, enum AVTXType type, |
||||||
|
int inv, int len, const void *scale, uint64_t flags); |
||||||
|
|
||||||
|
/**
|
||||||
|
* Frees a context and sets ctx to NULL, does nothing when ctx == NULL |
||||||
|
*/ |
||||||
|
void av_tx_uninit(AVTXContext **ctx); |
||||||
|
|
||||||
|
#endif /* AVUTIL_TX_H */ |
Loading…
Reference in new issue