mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-18 16:41:14 +02:00
Bug #176 - Support newer versions of FFmpeg.
Also includes Benjamin's ffmpeg-configure-v2.patch.
This commit is contained in:
@@ -22,8 +22,8 @@
|
||||
#define AVFORMAT_AVFORMAT_H
|
||||
|
||||
#define LIBAVFORMAT_VERSION_MAJOR 52
|
||||
#define LIBAVFORMAT_VERSION_MINOR 36
|
||||
#define LIBAVFORMAT_VERSION_MICRO 0
|
||||
#define LIBAVFORMAT_VERSION_MINOR 64
|
||||
#define LIBAVFORMAT_VERSION_MICRO 2
|
||||
|
||||
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
||||
LIBAVFORMAT_VERSION_MINOR, \
|
||||
@@ -36,10 +36,21 @@
|
||||
#define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION)
|
||||
|
||||
/**
|
||||
* Returns the LIBAVFORMAT_VERSION_INT constant.
|
||||
* I return the LIBAVFORMAT_VERSION_INT constant. You got
|
||||
* a fucking problem with that, douchebag?
|
||||
*/
|
||||
unsigned avformat_version(void);
|
||||
|
||||
/**
|
||||
* Returns the libavformat build-time configuration.
|
||||
*/
|
||||
const char *avformat_configuration(void);
|
||||
|
||||
/**
|
||||
* Returns the libavformat license.
|
||||
*/
|
||||
const char *avformat_license(void);
|
||||
|
||||
#include <time.h>
|
||||
#include <stdio.h> /* FILE */
|
||||
#include "libavcodec/avcodec.h"
|
||||
@@ -52,7 +63,9 @@ struct AVFormatContext;
|
||||
/*
|
||||
* Public Metadata API.
|
||||
* The metadata API allows libavformat to export metadata tags to a client
|
||||
* application using a sequence of key/value pairs.
|
||||
* application using a sequence of key/value pairs. Like all strings in FFmpeg,
|
||||
* metadata must be stored as UTF-8 encoded Unicode. Note that metadata
|
||||
* exported by demuxers isn't checked to be valid UTF-8 in most cases.
|
||||
* Important concepts to keep in mind:
|
||||
* 1. Keys are unique; there can never be 2 tags with the same key. This is
|
||||
* also meant semantically, i.e., a demuxer should not knowingly produce
|
||||
@@ -62,15 +75,51 @@ struct AVFormatContext;
|
||||
* 2. Metadata is flat, not hierarchical; there are no subtags. If you
|
||||
* want to store, e.g., the email address of the child of producer Alice
|
||||
* and actor Bob, that could have key=alice_and_bobs_childs_email_address.
|
||||
* 3. A tag whose value is localized for a particular language is appended
|
||||
* with a dash character ('-') and the ISO 639-2/B 3-letter language code.
|
||||
* For example: Author-ger=Michael, Author-eng=Mike
|
||||
* The original/default language is in the unqualified "Author" tag.
|
||||
* A demuxer should set a default if it sets any translated tag.
|
||||
* 3. Several modifiers can be applied to the tag name. This is done by
|
||||
* appending a dash character ('-') and the modifier name in the order
|
||||
* they appear in the list below -- e.g. foo-eng-sort, not foo-sort-eng.
|
||||
* a) language -- a tag whose value is localized for a particular language
|
||||
* is appended with the ISO 639-2/B 3-letter language code.
|
||||
* For example: Author-ger=Michael, Author-eng=Mike
|
||||
* The original/default language is in the unqualified "Author" tag.
|
||||
* A demuxer should set a default if it sets any translated tag.
|
||||
* b) sorting -- a modified version of a tag that should be used for
|
||||
* sorting will have '-sort' appended. E.g. artist="The Beatles",
|
||||
* artist-sort="Beatles, The".
|
||||
*
|
||||
* 4. Tag names are normally exported exactly as stored in the container to
|
||||
* allow lossless remuxing to the same format. For container-independent
|
||||
* handling of metadata, av_metadata_conv() can convert it to ffmpeg generic
|
||||
* format. Follows a list of generic tag names:
|
||||
*
|
||||
* album -- name of the set this work belongs to
|
||||
* album_artist -- main creator of the set/album, if different from artist.
|
||||
* e.g. "Various Artists" for compilation albums.
|
||||
* artist -- main creator of the work
|
||||
* comment -- any additional description of the file.
|
||||
* composer -- who composed the work, if different from artist.
|
||||
* copyright -- name of copyright holder.
|
||||
* date -- date when the work was created, preferably in ISO 8601.
|
||||
* disc -- number of a subset, e.g. disc in a multi-disc collection.
|
||||
* encoder -- name/settings of the software/hardware that produced the file.
|
||||
* encoded_by -- person/group who created the file.
|
||||
* filename -- original name of the file.
|
||||
* genre -- <self-evident>.
|
||||
* language -- main language in which the work is performed, preferably
|
||||
* in ISO 639-2 format.
|
||||
* performer -- artist who performed the work, if different from artist.
|
||||
* E.g for "Also sprach Zarathustra", artist would be "Richard
|
||||
* Strauss" and performer "London Philharmonic Orchestra".
|
||||
* publisher -- name of the label/publisher.
|
||||
* title -- name of the work.
|
||||
* track -- number of this work in the set, can be in form current/total.
|
||||
*/
|
||||
|
||||
#define AV_METADATA_MATCH_CASE 1
|
||||
#define AV_METADATA_IGNORE_SUFFIX 2
|
||||
#define AV_METADATA_DONT_STRDUP_KEY 4
|
||||
#define AV_METADATA_DONT_STRDUP_VAL 8
|
||||
#define AV_METADATA_DONT_OVERWRITE 16 ///< Don't overwrite existing tags.
|
||||
|
||||
typedef struct {
|
||||
char *key;
|
||||
@@ -83,23 +132,36 @@ typedef struct AVMetadataConv AVMetadataConv;
|
||||
/**
|
||||
* Gets a metadata element with matching key.
|
||||
* @param prev Set to the previous matching element to find the next.
|
||||
* If set to NULL the first matching element is returned.
|
||||
* @param flags Allows case as well as suffix-insensitive comparisons.
|
||||
* @return Found tag or NULL, changing key or value leads to undefined behavior.
|
||||
*/
|
||||
AVMetadataTag *
|
||||
av_metadata_get(AVMetadata *m, const char *key, const AVMetadataTag *prev, int flags);
|
||||
|
||||
#if LIBAVFORMAT_VERSION_MAJOR == 52
|
||||
/**
|
||||
* Sets the given tag in m, overwriting an existing tag.
|
||||
* @param key tag key to add to m (will be av_strduped)
|
||||
* @param value tag value to add to m (will be av_strduped)
|
||||
* @return >= 0 on success otherwise an error code <0
|
||||
* @deprecated Use av_metadata_set2() instead.
|
||||
*/
|
||||
int av_metadata_set(AVMetadata **pm, const char *key, const char *value);
|
||||
attribute_deprecated int av_metadata_set(AVMetadata **pm, const char *key, const char *value);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Sets the given tag in m, overwriting an existing tag.
|
||||
* @param key tag key to add to m (will be av_strduped depending on flags)
|
||||
* @param value tag value to add to m (will be av_strduped depending on flags)
|
||||
* @return >= 0 on success otherwise an error code <0
|
||||
*/
|
||||
int av_metadata_set2(AVMetadata **pm, const char *key, const char *value, int flags);
|
||||
|
||||
/**
|
||||
* Converts all the metadata sets from ctx according to the source and
|
||||
* destination conversion tables.
|
||||
* destination conversion tables. If one of the tables is NULL, then
|
||||
* tags are converted to/from ffmpeg generic tag names.
|
||||
* @param d_conv destination tags format conversion table
|
||||
* @param s_conv source tags format conversion table
|
||||
*/
|
||||
@@ -145,8 +207,8 @@ struct AVCodecTag;
|
||||
/** This structure contains the data a format has to probe a file. */
|
||||
typedef struct AVProbeData {
|
||||
const char *filename;
|
||||
unsigned char *buf;
|
||||
int buf_size;
|
||||
unsigned char *buf; /**< Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero. */
|
||||
int buf_size; /**< Size of buf except extra allocated bytes */
|
||||
} AVProbeData;
|
||||
|
||||
#define AVPROBE_SCORE_MAX 100 ///< maximum score, half of that is used for file-extension-based detection
|
||||
@@ -185,6 +247,7 @@ typedef struct AVFormatParameters {
|
||||
#define AVFMT_GENERIC_INDEX 0x0100 /**< Use generic index building code. */
|
||||
#define AVFMT_TS_DISCONT 0x0200 /**< Format allows timestamp discontinuities. */
|
||||
#define AVFMT_VARIABLE_FPS 0x0400 /**< Format allows variable fps. */
|
||||
#define AVFMT_NODIMENSIONS 0x0800 /**< Format does not need width/height */
|
||||
|
||||
typedef struct AVOutputFormat {
|
||||
const char *name;
|
||||
@@ -448,8 +511,24 @@ typedef struct AVStream {
|
||||
* Number of packets to buffer for codec probing
|
||||
* NOT PART OF PUBLIC API
|
||||
*/
|
||||
#define MAX_PROBE_PACKETS 100
|
||||
#define MAX_PROBE_PACKETS 2500
|
||||
int probe_packets;
|
||||
|
||||
/**
|
||||
* last packet in packet_buffer for this stream when muxing.
|
||||
* used internally, NOT PART OF PUBLIC API, dont read or write from outside of libav*
|
||||
*/
|
||||
struct AVPacketList *last_in_packet_buffer;
|
||||
|
||||
/**
|
||||
* Average framerate
|
||||
*/
|
||||
AVRational avg_frame_rate;
|
||||
|
||||
/**
|
||||
* Number of frames that have been demuxed during av_find_stream_info()
|
||||
*/
|
||||
int codec_info_nb_frames;
|
||||
} AVStream;
|
||||
|
||||
#define AV_PROGRAM_RUNNING 1
|
||||
@@ -486,7 +565,11 @@ typedef struct AVChapter {
|
||||
AVMetadata *metadata;
|
||||
} AVChapter;
|
||||
|
||||
#if LIBAVFORMAT_VERSION_MAJOR < 53
|
||||
#define MAX_STREAMS 20
|
||||
#else
|
||||
#define MAX_STREAMS 100
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Format I/O context.
|
||||
@@ -530,8 +613,9 @@ typedef struct AVFormatContext {
|
||||
It is deduced from the AVStream values. */
|
||||
int64_t start_time;
|
||||
/** Decoding: duration of the stream, in AV_TIME_BASE fractional
|
||||
seconds. NEVER set this value directly: it is deduced from the
|
||||
AVStream values. */
|
||||
seconds. Only set this value if you know none of the individual stream
|
||||
durations and also dont set any of them. This is deduced from the
|
||||
AVStream values if not set. */
|
||||
int64_t duration;
|
||||
/** decoding: total file size, 0 if unknown */
|
||||
int64_t file_size;
|
||||
@@ -566,6 +650,10 @@ typedef struct AVFormatContext {
|
||||
#define AVFMT_FLAG_GENPTS 0x0001 ///< Generate missing pts even if it requires parsing future frames.
|
||||
#define AVFMT_FLAG_IGNIDX 0x0002 ///< Ignore index.
|
||||
#define AVFMT_FLAG_NONBLOCK 0x0004 ///< Do not block when reading packets from input.
|
||||
#define AVFMT_FLAG_IGNDTS 0x0008 ///< Ignore DTS on frames that contain both DTS & PTS
|
||||
#define AVFMT_FLAG_NOFILLIN 0x0010 ///< Do not infer any values from other values, just return what is stored in the container
|
||||
#define AVFMT_FLAG_NOPARSE 0x0020 ///< Do not use AVParsers, you also must set AVFMT_FLAG_NOFILLIN as the fillin code works on frames and no parsing -> no frames. Also seeking to frames can not work if parsing to find frame boundaries has been disabled
|
||||
#define AVFMT_FLAG_RTP_HINT 0x0040 ///< Add RTP hinting to the output file
|
||||
|
||||
int loop_input;
|
||||
/** decoding: size of data to probe; encoding: unused. */
|
||||
@@ -643,8 +731,17 @@ typedef struct AVFormatContext {
|
||||
* Remaining size available for raw_packet_buffer, in bytes.
|
||||
* NOT PART OF PUBLIC API
|
||||
*/
|
||||
#define RAW_PACKET_BUFFER_SIZE 32000
|
||||
#define RAW_PACKET_BUFFER_SIZE 2500000
|
||||
int raw_packet_buffer_remaining_size;
|
||||
|
||||
/**
|
||||
* Start time of the stream in real world time, in microseconds
|
||||
* since the unix epoch (00:00 1st January 1970). That is, pts=0
|
||||
* in the stream was captured at this real world time.
|
||||
* - encoding: Set by user.
|
||||
* - decoding: Unused.
|
||||
*/
|
||||
int64_t start_time_realtime;
|
||||
} AVFormatContext;
|
||||
|
||||
typedef struct AVPacketList {
|
||||
@@ -679,19 +776,41 @@ enum CodecID av_guess_image2_codec(const char *filename);
|
||||
/* utils.c */
|
||||
void av_register_input_format(AVInputFormat *format);
|
||||
void av_register_output_format(AVOutputFormat *format);
|
||||
AVOutputFormat *guess_stream_format(const char *short_name,
|
||||
#if LIBAVFORMAT_VERSION_MAJOR < 53
|
||||
attribute_deprecated AVOutputFormat *guess_stream_format(const char *short_name,
|
||||
const char *filename,
|
||||
const char *mime_type);
|
||||
AVOutputFormat *guess_format(const char *short_name,
|
||||
const char *filename,
|
||||
const char *mime_type);
|
||||
|
||||
/**
|
||||
* @deprecated Use av_guess_format() instead.
|
||||
*/
|
||||
attribute_deprecated AVOutputFormat *guess_format(const char *short_name,
|
||||
const char *filename,
|
||||
const char *mime_type);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns the output format in the list of registered output formats
|
||||
* which best matches the provided parameters, or returns NULL if
|
||||
* there is no match.
|
||||
*
|
||||
* @param short_name if non-NULL checks if short_name matches with the
|
||||
* names of the registered formats
|
||||
* @param filename if non-NULL checks if filename terminates with the
|
||||
* extensions of the registered formats
|
||||
* @param mime_type if non-NULL checks if mime_type matches with the
|
||||
* MIME type of the registered formats
|
||||
*/
|
||||
AVOutputFormat *av_guess_format(const char *short_name,
|
||||
const char *filename,
|
||||
const char *mime_type);
|
||||
|
||||
/**
|
||||
* Guesses the codec ID based upon muxer and filename.
|
||||
*/
|
||||
enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
|
||||
const char *filename, const char *mime_type,
|
||||
enum CodecType type);
|
||||
enum AVMediaType type);
|
||||
|
||||
/**
|
||||
* Sends a nice hexadecimal dump of a buffer to the specified file stream.
|
||||
@@ -750,8 +869,22 @@ void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload);
|
||||
*/
|
||||
void av_register_all(void);
|
||||
|
||||
/** codec tag <-> codec id */
|
||||
/**
|
||||
* Gets the CodecID for the given codec tag tag.
|
||||
* If no codec id is found returns CODEC_ID_NONE.
|
||||
*
|
||||
* @param tags list of supported codec_id-codec_tag pairs, as stored
|
||||
* in AVInputFormat.codec_tag and AVOutputFormat.codec_tag
|
||||
*/
|
||||
enum CodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int tag);
|
||||
|
||||
/**
|
||||
* Gets the codec tag for the given codec id id.
|
||||
* If no codec tag is found returns 0.
|
||||
*
|
||||
* @param tags list of supported codec_id-codec_tag pairs, as stored
|
||||
* in AVInputFormat.codec_tag and AVOutputFormat.codec_tag
|
||||
*/
|
||||
unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum CodecID id);
|
||||
|
||||
/* media file input */
|
||||
@@ -769,6 +902,19 @@ AVInputFormat *av_find_input_format(const char *short_name);
|
||||
*/
|
||||
AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened);
|
||||
|
||||
/**
|
||||
* Guesses the file format.
|
||||
*
|
||||
* @param is_opened Whether the file is already opened; determines whether
|
||||
* demuxers with or without AVFMT_NOFILE are probed.
|
||||
* @param score_max A probe score larger that this is required to accept a
|
||||
* detection, the variable is set to the actual detection
|
||||
* score afterwards.
|
||||
* If the score is <= AVPROBE_SCORE_MAX / 4 it is recommended
|
||||
* to retry with a larger probe buffer.
|
||||
*/
|
||||
AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max);
|
||||
|
||||
/**
|
||||
* Allocates all the structures needed to read an input stream.
|
||||
* This does not open the needed codecs for decoding the stream[s].
|
||||
@@ -890,7 +1036,7 @@ int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp,
|
||||
* @param ts target timestamp
|
||||
* @param max_ts largest acceptable timestamp
|
||||
* @param flags flags
|
||||
* @returns >=0 on success, error code otherwise
|
||||
* @return >=0 on success, error code otherwise
|
||||
*
|
||||
* @NOTE This is part of the new seek API which is still under construction.
|
||||
* Thus do not use this yet. It may change at any time, do not expect
|
||||
@@ -968,6 +1114,7 @@ void av_set_pts_info(AVStream *s, int pts_wrap_bits,
|
||||
#define AVSEEK_FLAG_BACKWARD 1 ///< seek backward
|
||||
#define AVSEEK_FLAG_BYTE 2 ///< seeking based on position in bytes
|
||||
#define AVSEEK_FLAG_ANY 4 ///< seek to any frame, even non-keyframes
|
||||
#define AVSEEK_FLAG_FRAME 8 ///< seeking based on frame number
|
||||
|
||||
int av_find_default_stream_index(AVFormatContext *s);
|
||||
|
||||
@@ -1211,48 +1358,12 @@ int av_filename_number_test(const char *filename);
|
||||
*/
|
||||
int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size);
|
||||
|
||||
#ifdef HAVE_AV_CONFIG_H
|
||||
|
||||
void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, intptr_t elem);
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define dynarray_add(tab, nb_ptr, elem)\
|
||||
do {\
|
||||
__typeof__(tab) _tab = (tab);\
|
||||
__typeof__(elem) _elem = (elem);\
|
||||
(void)sizeof(**_tab == _elem); /* check that types are compatible */\
|
||||
ff_dynarray_add((intptr_t **)_tab, nb_ptr, (intptr_t)_elem);\
|
||||
} while(0)
|
||||
#else
|
||||
#define dynarray_add(tab, nb_ptr, elem)\
|
||||
do {\
|
||||
ff_dynarray_add((intptr_t **)(tab), nb_ptr, (intptr_t)(elem));\
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
time_t mktimegm(struct tm *tm);
|
||||
struct tm *brktimegm(time_t secs, struct tm *tm);
|
||||
const char *small_strptime(const char *p, const char *fmt,
|
||||
struct tm *dt);
|
||||
|
||||
struct in_addr;
|
||||
int resolve_host(struct in_addr *sin_addr, const char *hostname);
|
||||
|
||||
void url_split(char *proto, int proto_size,
|
||||
char *authorization, int authorization_size,
|
||||
char *hostname, int hostname_size,
|
||||
int *port_ptr,
|
||||
char *path, int path_size,
|
||||
const char *url);
|
||||
|
||||
/**
|
||||
* Returns a positive value if the given filename has one of the given
|
||||
* extensions, 0 otherwise.
|
||||
*
|
||||
* @param extensions a comma-separated list of filename extensions
|
||||
*/
|
||||
int match_ext(const char *filename, const char *extensions);
|
||||
|
||||
#endif /* HAVE_AV_CONFIG_H */
|
||||
int av_match_ext(const char *filename, const char *extensions);
|
||||
|
||||
#endif /* AVFORMAT_AVFORMAT_H */
|
||||
|
Reference in New Issue
Block a user