av_register_all() の役割は、すべてのコンポーネントを初期化することです。この関数が呼び出された場合にのみ、マルチプレクサとコーデックを使用できます。このインターフェイスの内部呼び出しは次のとおりです: (1).avcodec_register_all
()、このインターフェイスの内部実行ステップ:
-
ハードウェア アクセラレータを登録します: REGISTER_HWACCEL()
-
オーディオおよびビデオエンコーダーを登録します: REGISTER_ENCODER()
-
オーディオおよびビデオ デコーダを登録します: REGISTER_DECODER()
-
パッケージ登録: REGISTER_ENCDEC()
-
レジスタパーサー: REGISTER_PARSER()
(2). マルチプレクサとデマルチプレクサの登録を実行します。
-
マルチプレクサーを登録します: REGISTER_MUXER()
-
レジスタデマルチプレクサ: REGISTER_DEMUXER()
-
パッケージ登録: REGISTER_MUXDEMUX()
av_malloc、av_free() : av_malloc は、すべてのメモリ アクセス (CPU で使用可能なベクトルを含む) に適したアライメントを持つメモリ ブロックを割り当てます。 av_free (void *ptr) : av_malloc および av_realoc()f を使用して割り当てられたメモリ領域を解放します。 , void * av_realoc(void *ptr, size_t size), 拡張された prt メモリのサイズは size で示されるサイズになります。
ffmpeg には多くのデータ構造があり、一般的なデータ構造には次の部分が含まれます。
- ソリューションプロトコル (http、rtmp、mms)
AVIOContext、URLProtocol、URLContext は、主にオーディオとビデオで使用されるプロトコルの種類と状態を保存するために使用され、URLProtocolは主に次の目的で使用されます。
入力を保存するために使用されるカプセル化形式、各プロトコルは URLProtocal 構造に対応します。
- カプセル化解除 (flv、avi、rmvb、MP4)
AVFormatContext は主にオーディオおよびビデオ パッケージに含まれる情報を格納します。 AVInputFormat : 入力オーディオで使用されるパッケージ形式、各オーディオおよびビデオ パッケージ形式を格納します。
すべて AVInputFormat 構造体に対応します。
- デコード(h264、mpeg2、mp3、aac)
各AVstream はビデオ/オーディオ ストリームの関連データ情報を格納し、各AVStream はビデオとオーディオに対応する使用法を格納するAVCodecContextに対応します。
デコード方法の関連データを使用します。各AVcodecContext は、ビデオまたはオーディオで使用されるデコーダ構造を含むAVCodecに対応し、各デコーダ
AVCode 構造に対応します。
- セーブデータ
ビデオ構造は 1 つのフレームを保存しますが、オーディオ構造は複数のフレームを保存できます。AVPacket はデコード前のデータを保存し、AVFrame はデコードされたデータを保存します。
キーワード構造の分析
- AVIOContext : FFMpeg の io 操作に関連する最上位の構造であり、avio の核心であり、FFmpeg はローカル ファイル パスの URL のオープンと Liu Ridai のプロトコルをサポートしています。
unsigned char *buffer; // buffer起始地址
int buffer_size; // 可以读取或者写入的最大的buffer size
unsigned char *buf_ptr; // 当前正在读或写操作的buffer地址
unsigned char *buf_end; // 数据结束的buffer地址,如果读取函数返回的数据小于请求数据,buf_end可能小于buffer + buffer_size
void *opaque; // 一个私有指针,传递给read / write / seek / 等函数
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size); // 读取音视频数据的函数。
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size); // 写入音视频数据的函数
int64_t (*seek)(void *opaque, int64_t offset, int whence);
int64_t pos; // 当前buffer在文件中的位置
int must_flush; // 如果下一个seek应该刷新,则为true
int eof_reached; // 如果到达eof(end of file 文件尾),则为true
int write_flag; // 如果开放写,则为true
int (*read_pause)(void *opaque, int pause); // 暂停或恢复网络流媒体协议的播放
int64_t (*read_seek)(void *opaque, int stream_index,
int64_t timestamp, int flags); // 快进到指定timestamp
int seekable; // 如果为0,表示不可seek操作。其它值查看AVIO_SEEKABLE_XXX
int64_t maxsize; // max filesize,用于限制分配空间大小
int direct; // avio_seek是否直接调用底层的seek功能。
int64_t bytes_read; // 字节读取统计数据
int seek_count; // seek计数
int writeout_count; // 写入次数统计
int orig_buffer_size; // 原始buffer大小
const char *protocol_whitelist; // 允许协议白名单,以','分隔
const char *protocol_blacklist; // 不允许的协议黑名单,以','分隔
// 用于替换write_packet的回调函数。
int (*write_data_type)(void *opaque, uint8_t *buf, int buf_size,
enum AVIODataMarkerType type, int64_t time);
} AVIOContext;
①(*read_packet): 音声・映像データを読み込む関数。自分で定義できる
②(*write_packet): 音声・映像データを書き込む関数。自分で定義できる
③(*read_pause): ネットワークストリーミングメディアプロトコルの再生を一時停止または再開します。自分で定義できる
デコード プロセス中、バッファは ffmpeg によって読み取られたデータを保存するために使用されます。ファイルを開くときは、まずデータをディスクからバッファに読み取ってから、デコーダに送信して使用する必要があります。それ
opaque は URLContext を指定します。
このうち、 avio_alloc_context() を使用して AVIOContext オブジェクトを初期化し、終了後に呼び出す必要がある av_free() を使用してオブジェクトを破棄できます。
avio_alloc_context():可以构造AVIOContext对象,
AVIOContext* avio_alloc_context ( unsigned char * buffer, //指定字符串地址
int buffer_size, //指定缓冲区大小
int write_flag, //如果缓冲区应该是可写的,则设置为 1,否则设置为 0。
void * opaque, //指向特殊数据的不透明指针
int(*)(void *opaque, uint8_t *buf, int buf_size) read_packet, //用于重新填充的缓冲区的函数为NULL
int(*)(void *opaque, uint8_t *buf, int buf_size) write_packet, //用于写入缓冲区内容的函数可能是NULL
int64_t(*)(void *opaque, int64_t offset, int whence) seek //用于寻找指定字节的位置
)
このうち、opaque は URLContext 構造体を指しており、具体的な構造は次のとおりです。
typedef struct URLContext {
const AVClass *av_class; ///< information for av_log(). Set by url_open().
//指向相应URLProtocal
struct URLProtocol *prot;
int flags;
int is_streamed; /**< true if streamed (no seek possible), default = false */
int max_packet_size; /**< if non zero, the stream is packetized with this max packet size */
void *priv_data;//一般用来指向某种具体协议的上下文信息
char *filename; /**< specified URL */
int is_connected;
AVIOInterruptCB interrupt_callback;
} URLContext;
URLContext 構造体には URLProtocol 構造体もあります。注: 各プロトコル (rtp、rtmp、file など) は URLProtocol に対応します。この構造もFFMPEGにはありません
提供されたヘッダー ファイル内。FFMPEG ソース コードからその定義を見つけます。
URLProtocol ff_file_protocol = {
.name = "file",
.url_open = file_open,
.url_read = file_read,
.url_write = file_write,
.url_seek = file_seek,
.url_close = file_close,
.url_get_file_handle = file_get_handle,
.url_check = file_check,
};
URLProtocol ff_rtmp_protocol = {
.name = "rtmp",
.url_open = rtmp_open,
.url_read = rtmp_read,
.url_write = rtmp_write,
.url_close = rtmp_close,
.url_read_pause = rtmp_read_pause,
.url_read_seek = rtmp_read_seek,
.url_get_file_handle = rtmp_get_file_handle,
.priv_data_size = sizeof(RTMP),
.flags = URL_PROTOCOL_FLAG_NETWORK,
};
URLProtocol ff_udp_protocol = {
.name = "udp",
.url_open = udp_open,
.url_read = udp_read,
.url_write = udp_write,
.url_close = udp_close,
.url_get_file_handle = udp_get_file_handle,
.priv_data_size = sizeof(UDPContext),
.flags = URL_PROTOCOL_FLAG_NETWORK,
};
- AVInputFormat: この機能はメディア ファイルを読み取り、それをデータ パケットに分割します。各データ パケットには 1 つ以上のエンコードされたフレームが含まれ、入力オーディオとビデオのカプセル化形式を保存します。
typedef struct AVInputFormat {
const char *name; // 输入格式的短名称
const char *long_name; // 格式的长名称(相对于短名称而言,更易于阅读)
/**
* Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS,
* AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH,
* AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK, AVFMT_SEEK_TO_PTS.
*/
int flags;
const char *extensions; // 如果定义了扩展,就不会进行格式探测。但因为该功能目前支持不够,不推荐使用
const struct AVCodecTag * const *codec_tag; // 见名知意
const AVClass *priv_class; ///< AVClass for the private context
const char *mime_type; // mime类型,它用于在探测时检查匹配的mime类型。
/* 此行下方的任何字段都不是公共API的一部分。 它们不能在libavformat之外使用,可以随意更改和删除。
* 应在上方添加新的公共字段。*/
struct AVInputFormat *next; // 用于链接下一个AVInputFormat
int raw_codec_id; // 原始demuxers将它们的解码器id保存在这里。
int priv_data_size; // 私有数据大小,可以用于确定需要分配多大的内存来容纳下这些数据。
/**
* 判断给定文件是否有可能被解析为此格式。 提供的缓冲区保证为AVPROBE_PADDING_SIZE字节大,因此除非您需 * 要更多,否则无需检查。
*/
int (*read_probe)(AVProbeData *);
/**
* 读取格式头,并初始化AVFormatContext结构体
* @return 0 表示操作成功
*/
int (*read_header)(struct AVFormatContext *);
/**
* 读取一个packet并存入pkt指针中。pts和flags会被同时设置。
* @return 0 表示操作成功, < 0 发生异常
* 当返回异常时,pkt可定没有allocated或者在函数返回之前被释放了。
*/
int (*read_packet)(struct AVFormatContext *, AVPacket *pkt);
// 关闭流,AVFormatContext和AVStreams并不会被这个函数释放。
int (*read_close)(struct AVFormatContext *);
/**
* 在stream_index的流中,使用一个给定的timestamp,seek到附近帧。
* @param stream_index 不能为-1
* @param flags 如果没有完全匹配,决定向前还是向后匹配。
* @return >= 0 成功
*/
int (*read_seek)(struct AVFormatContext *,
int stream_index, int64_t timestamp, int flags);
// 获取stream[stream_index]的下一个时间戳,如果发生异常返回AV_NOPTS_VALUE
int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index,
int64_t *pos, int64_t pos_limit);
// 开始或者恢复播放,只有在播放rtsp格式的网络格式才有意义。
int (*read_play)(struct AVFormatContext *);
int (*read_pause)(struct AVFormatContext *);// 暂停播放,只有在播放rtsp格式的网络格式才有意义。
/**
* 快进到指定的时间戳
* @param stream_index 需要快进操作的流
* @param ts 需要快进到的地方
* @param min_ts max_ts seek的区间,ts需要在这个范围中。
*/
int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags);
// 返回设备列表和其属性
int (*get_device_list)(struct AVFormatContext *s, struct AVDeviceInfoList *device_list);
// 初始化设备能力子模块
int (*create_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps);
// 释放设备能力子模块
int (*free_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps);
} AVInputFormat;
AVPacketは、圧縮符号化データに関する情報を格納する構造体である。
AVBufferRef * buf //buf是AVBufferRef类型指针,用来管理data指针引用的数据缓存
int64_t pts //显示时间戳
int64_t dts //解码时间戳
uint8_t * data //指向保存压缩数据的指针
int size //压缩数据的长度
int stream_index //Packets所在stream流的索引
int flags //标志,其中的最低位为1表示该数据是关键帧
AVPacketSideData * side_data //容器可以提供附加数据包
int side_data_elems //边缘数据元数的个数
int64_t duration //此数据包持续时间
int64_t pos //数据流媒体中存在的位置
void * opaque //for some private data of the user More...
AVBufferRef * opaque_ref // AVBufferRef for free use by the API user. More...
AVRational time_base //初始化时间
AVFrame は、生データ (つまり、YUV、ビデオの RGB、オーディオの PCM などの非圧縮データ) を保存するために使用され、いくつかの関連情報も含まれています。例えば、マクロブロックタイプテーブル、QPテーブル、動きベクトルテーブルなどのデータが復号化時に保存される。
uint8_t * data [AV_NUM_DATA_POINTERS] //解码手的原始数据(YUV,RGB,PCM)
int linesize [AV_NUM_DATA_POINTERS] //data中一行数据的大小。
uint8_t ** extended_data //指向数据平面的指针,对于视屏应该指向data[],对于音频
int nb_samples //音频的一个frame中可能包换多少音频帧
int format //解码手原始数据类型
int key_frame //是否是关键帧
enum AVPictureType pict_type //帧类型(IBP)
AVRational sample_aspect_ratio //宽高比
int64_t pts //显示时间戳
int64_t pkt_dts
AVRational time_base
Time base for the timestamps in this frame. More...
int coded_picture_number //编码帧序号
int display_picture_number //显示帧序号
int quality //采样质量
void * opaque
for some private data of the user More...
int repeat_pict
When decoding, this signals how much the picture must be delayed. More...
int interlaced_frame
The content of the picture is interlaced. More...
int top_field_first
If the content is interlaced, is top field displayed first. More...
int palette_has_changed
Tell user application that palette has changed from previous frame. More...
int64_t reordered_opaque
reordered opaque 64 bits (generally an integer or a double precision float PTS but can be anything). More...
int sample_rate
Sample rate of the audio data. More...
attribute_deprecated uint64_t channel_layout
Channel layout of the audio data. More...
AVBufferRef * buf [AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this frame. More...
AVBufferRef ** extended_buf
For planar audio which requires more than AV_NUM_DATA_POINTERS AVBufferRef pointers, this array will hold all the references which cannot fit into AVFrame.buf. More...
int nb_extended_buf
Number of elements in extended_buf. More...
AVFrameSideData ** side_data
int nb_side_data
int flags
Frame flags, a combination of AV_FRAME_FLAGS. More...
enum AVColorRange color_range
MPEG vs JPEG YUV range. More...
enum AVColorPrimaries color_primaries
enum AVColorTransferCharacteristic color_trc
enum AVColorSpace colorspace
YUV colorspace type. More...
enum AVChromaLocation chroma_location
int64_t best_effort_timestamp
frame timestamp estimated using various heuristics, in stream time base More...
int64_t pkt_pos
reordered pos from the last AVPacket that has been input into the decoder More...
attribute_deprecated int64_t pkt_duration
duration of the corresponding packet, expressed in AVStream->time_base units, 0 if unknown. More...
AVDictionary * metadata
metadata. More...
int decode_error_flags
decode error flags of the frame, set to a combination of FF_DECODE_ERROR_xxx flags if the decoder produced a frame, but there were errors during the decoding. More...
attribute_deprecated int channels
number of audio channels, only used for audio. More...
int pkt_size
size of the corresponding packet containing the compressed frame. More...
AVBufferRef * hw_frames_ctx
For hwaccel-format frames, this should be a reference to the AVHWFramesContext describing the frame. More...
AVBufferRef * opaque_ref
AVBufferRef for free use by the API user. More...
AVBufferRef * private_ref
AVBufferRef for internal use by a single libav* library. More...
AVChannelLayout ch_layout //音频的时间布局
int64_t duration //时间周期
avcodec_open : コーデック オブジェクトを使用して AVCodecContext オブジェクトを初期化します。 options は初期化された AVCodec オブジェクトの設定オプションです
int avcodec_open2 ( AVCodecContext * avctx, const AVCodec * codec, AVDictionary ** options )
avcodec_close : 指定された AVCodecContext を閉じ、それに関連付けられているすべてのデータを解放します。
int avodec_close(AVCodecContext *avctx)
avcodec_find_decoder() : パラメーターの ID を使用して、登録されているエンコーダーを検索します。
const AVCodec* avcodec_find_decoder ( enum AVCodecID id )
ID:表示编码器对应的解码器
avcodec_find_decoder_by_name() : デコーダーの名前で AVcodec オブジェクトを返します。
const AVCodec* avcodec_find_decoder_by_name ( const char * name )
name:解码器对应的名
avcodec_find_encoder() : パラメーターの ID を使用して、登録されているエンコーダーを検索します。
const AVCodec* avcodec_find_encoder ( enum AVCodecID id )
ID:表示编码器对应的解码器
avcodec_find_encoder_by_name() : デコーダーの名前で AVcodec オブジェクトを返します。
const AVCodec* avcodec_find_encoder_by_name ( const char * name )
name:解码器对应的名
avcodec_send_packet() : 生のパケット データを入力としてデコーダに提供します。
int avcodec_send_packet ( AVCodecContext * avctx, const AVPacket * avpkt )
avcodec_receive_frame() : デコーダキューからフレームを抽出します
int avcodec_receive_frame ( AVCodecContext * avctx, AVFrame * frame)
avctx: 编码器队列
frame:这将设置为由解码器分配的参考计数视频或音频帧(取决于解码器类型)。请注意,该函数将始终在执行任何其他操作之前调用 av_frame_unref(frame)
avformat_open_input : 出力ストリームを開いてストリームのヘッダー情報を読み取ります。エンコーダーは開いていないので、 avformat_close_input() を使用してストリームを閉じます。
int avformat_open_input ( AVFormatContext ** ps,const char * url,const AVInputFormat * fmt,AVDictionary ** options )
ps:函数调佣成功之后处理过的AVFormatContext结构体
url:打开的音视频流的URL
fmt:强制指定AVFormatContext中AVIputFormat的。这个参数一般情况下可以设置为NULL,这个FFmpeg可以自动检测AVInputformat
options:附加的一些选项,一般情况下可以设置为NULL
avformat_find_stream_info : オーディオおよびビデオ データを読み取り、関連情報を取得します
int avformat_find_stream_info ( AVFormatContext * ic , AVDictionary ** options )
ic:输入的上下文信息
AVDictionary:额外的选项
av_read_frame() : ストリーム内のビデオの 1 つまたは複数のフレームのオーディオ データを読み取ります
int av_read_frame ( AVFormatContext * s, AVPacket * pkt )
avformat_close_input() : 入力ストリームのコンテキスト情報を閉じる
void avformat_close_input ( AVFormatContext ** s )
s :输入流上下文信息
エンコーディング関連 API: オーディオおよびビデオ エンコーダに基づくアプリケーションでは、avformat_alloc_output_context2() 関数が通常呼び出される最初の関数です。使用される関数に加えて、FFmpeg で一般的に使用されるファイル操作関数も含まれています: av_write_frame() : ビデオ データの書き込みに使用され、avformat_write_header(): ビデオ ヘッダー ファイル情報の書き込みに使用され、av_frame_tailer: ビデオ ファイル末尾情報の書き込みに使用されます。
avformat_alloc_output_context2() : 通常出力に使用される AVFormatContext 構造体
int avformat_alloc_output_context2 (AVFormatContext ** ctx, const AVOutputFormat * oformat,const char * format_name,const char * filename )
ctx:函数调用成功之后创造的AVFormatContext结构结构体;
oformat:用于确定输出的AVOutputFormat,用于确定输出的格式
format_name:支出输出格式的名称
filename:指出输出文件的名称
avformat_write_heder() : ストリームのプライベート データを割り当て、ストリーム ヘッダーを出力メディア ファイルに書き込みます。
int avformat_write_header ( AVFormatContext * s,AVDictionary ** options )
s:用于输出的AVFormatContext
options :额外的选项
avcodec_send_frame (): 非圧縮ビデオまたはオーディオの AVFrame をエンコーダーに提供します。
int avcodec_send_frame ( AVCodecContext * avctx,
const AVFrame * frame
)
avcodec_receive_packet(): エンコーダからエンコードされたパケットを取得します。成功すると、圧縮フレームを含む AVPacket が返されます。
int avcodec_receive_packet ( AVCodecContext * avctx,AVPacket * avpkt )
Avcodec_send_frame ()/avcodec_receive_packet ()、使用説明:
[1] ptsの昇順に従って、元のデータ フレームがエンコーダに送信され、エンコーダはエンコードされたパケットをdts の昇順に出力します。
入力ポイントは dts には注意を払わず、受信したフレーム、バッファリング、要求に応じたエンコードのみに注意を払います。
[2]: avcodec_receive_packet() がパケットを出力すると、packet.dts が 0 から始まり、各出力パケットの dts に 1 を加算して設定されます。これは、ビデオ層の dts です。
周波数層の dts。ユーザーはそれをコンテナー層の dts に変換する必要があります。
[3]: avcodec_receive_packet がパケットを出力すると、packet.pts は対応する Frame.pts をコピーします。ビデオ スクリーン レイヤーの pts ユーザーは、それをコンテナー レイヤーの pts に変換する必要があります。
[4]: avcodec_send_frame() が NULL フレームを送信すると、エンコーダーは fflush モードに入ります。
[5]: avcodec_send_frame() は最初の NULL を送信して正常に戻り、後続の NULL は AVERROR_EOF を返します。
[6]: avcodec_send_frame() で NULL を複数回送信しても、エンコーダ バッファの内容は消えません。avcodec_flush_buffer() を使用すると、コーデックをすぐに破棄できます。
エンコーダ内のバッファの内容。したがって、エンコードが完了した後、avcodec_send_frame (NULL) を使用してコンテンツを取得する必要があります。
av_write_frame()/av_interleaved_write_frame() : ストリーミング メディア データのフレームを出力するために使用されます。
int av_write_frame ( AVFormatContext * s,AVPacket * pkt )
s:用于输出的AVFormatContext
pkt:等待输出AVPacket
av_write_trailer() : ファイルの末尾を出力するために使用されます。
int av_write_trailer ( AVFormatContext * s )
libswscale: 主に画像ピクセル データベース クラスを処理するために使用され、画像形式の置換と画像のストレッチを完了できます。
sws_getContext() : SwsContext オブジェクトを返し、割り当てます。そのプロトタイプは次のように表現できます。
struct SwsContext* sws_getContext ( int srcW, //被转化原图像的宽度
int srcH, //被转化原图像的高度
enum AVPixelFormat srcFormat, //被转化原图像的格式(RGB,BGR,YUV)
int dstW, //转化指定原图像的高度
int dstH, // 转换后指定原图像的宽度
enum AVPixelFormat dstFormat, //转化后指定的原图像的格式
int flags, //转化使用的算法
SwsFilter * srcFilter, //输入使用的滤波器
SwsFilter * dstFilter, //输出使用的滤波器
const double * param // 调整使用的缩放器的额外参数
)
sws_scale() : 画像データの処理。主にビデオのピクセル形式と解像度の変換に使用されます。
int sws_scale ( struct SwsContext * c, //使用sws_getContext()创建的缩放上下文
const uint8_t *const srcSlice[], //包含指向源切片平面的指针的数组
const int srcStride[], //包含源图像每个平面的步幅的数组
int srcSliceY, //要处理的切片在源图像中的位置
int srcSliceH, //源切片的高度,即切片中的行数
uint8_t *const dst[], //包含指向目标图像平面的指针的数组
const int dstStride[] //包含目标图像每个平面的步幅的数组
)
**sws_freeContext():** SwsContext() を解放します。
サンプリング周波数変換、チャンネルフォーマット置換、サンプルフォーマット置換の機能を実現できるリサンプリングAPI。
1. 创建上下文环境;重采样上下文环境为SwrContext数据结构
2. 参数设置:转换的参数设置到SwrContext中
3. SwrContex他初始化:swr_init()
4. 分配样本的数据内存空间:使用av_sample_alloc_array_and_sameples,av_samples_allpc等工具
5. 开启重采样操作,通过swr_convert完成
6. 重采样完成后释放相关的资源
swr_alloc(): SwrContext オブジェクトの作成
av_opt_set_*(): 入出力音声情報の設定
swr_init(): SwrContext の初期化。
av_samples_alloc_array_and_samples(): オーディオ フォーマットに従って、対応するサイズのメモリ空間を割り当てます。
av_samples_alloc: オーディオ フォーマットに従って、対応するサイズのメモリを割り当てます。これは、置換プロセス中に出力メモリ サイズを調整するために使用されます。
swr_convert: リサンプリング変換を実行します。
swr_alloc() : SwrContext オブジェクトを割り当てます。
struct SwrContext* swr_alloc ( void )
int swr_alloc_set_opts2 ( struct SwrContext ** ps, // 如果可用,则指向现有的 Swr 上下文,如果不可用,则指向 NULL
AVChannelLayout * out_ch_layout, // 输出通道布局
enum AVSampleFormat out_sample_fmt, // 输出样本格式
int out_sample_rate, // 输出采样的频率
AVChannelLayout * in_ch_layout, // 输入通道布局
enum AVSampleFormat in_sample_fmt, // 输入样本格式
int in_sample_rate, // 输入采样平率
int log_offset, // 日志界别偏移
void * log_ctx // 父日志移动上下文
)
swr_init() : パラメータを設定した後、swr_nit() を呼び出して SwrContext オブジェクトを積極的に初期化する必要があります
int swr_init ( struct SwrContext * s )
v_samples_alloc_array_and_samples()
av_find_input_format(): : 入力を検索
const AVInputFormat* av_find_input_format ( const char * short_name )