FFMPEG: [ API ] >打开/关闭一个输入文件

它们是成对出现的.

ffmpeg 把输入文件--转换成--->AVFormatContext实例

FFMPEG: [ API ] >打开/关闭一个输入文件_第1张图片

 

◆ avformat_open_input()

int avformat_open_input ( AVFormatContext **  ps,
const char *  url,
ff_const59 AVInputFormat *  fmt,
AVDictionary **  options 
)

Open an input stream and read the header.

The codecs are not opened. The stream must be closed with avformat_close_input().

Parameters

ps

Pointer to user-supplied AVFormatContext (allocated by avformat_alloc_context). May be a pointer to NULL, in which case an AVFormatContext is allocated by this function and written into ps. Note that a user-supplied AVFormatContext will be freed on failure.

(输出参数: 返回格式上下文实例)

url URL of the stream to open.
fmt If non-NULL, this parameter forces a specific input format. Otherwise the format is autodetected.
options A dictionary filled with AVFormatContext and demuxer-private options. On return this parameter will be destroyed and replaced with a dict containing options that were not found. May be NULL.

Returns

0 on success, a negative AVERROR on failure.

◆ avformat_close_input()

void avformat_close_input ( AVFormatContext **  s )

Close an opened input AVFormatContext.

Free it and all its contents and set *s to NULL.

Examples

avio_reading.c, demuxing_decoding.c, filtering_audio.c, filtering_video.c, hw_decode.c, metadata.c, qsvdec.c, remuxing.c, transcode_aac.c, transcoding.c, and vaapi_transcode.c.

Definition at line 4498 of file utils.c.

Referenced by avi_read_close(), close_demux_for_component(), close_input_file(), concat_read_close(), concat_seek(), ff_load_image(), ff_rtsp_close_streams(), ff_wms_parse_sdp_a_line(), ffmpeg_cleanup(), free_playlist_list(), free_representation(), handle_file(), LLVMFuzzerTestOneInput(), main(), movie_uninit(), open_file(), open_input_file(), rdt_close_context(), read_thread(), sap_read_close(), seek_test(), stream_close(), video_decode(), and video_decode_example().

你可能感兴趣的:(ffmpeg,ffmpeg)