ffmpeg中MP4的解复用过程
2017-05-14 本文已影响0人
奔向火星005
主要流程
1.在s->io_open()中创建了URLContext和它的prot成员(URLProtcol)。其中URLProtcol对应的协议为file:
MP4解复用00.PNG其中MP4的URLProtcol为:
const 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,
.url_delete = file_delete,
.url_move = file_move,
.priv_data_size = sizeof(FileContext),
.priv_data_class = &file_class,
.url_open_dir = file_open_dir,
.url_read_dir = file_read_dir,
.url_close_dir = file_close_dir,
.default_whitelist = "file,crypto"
};
在libformate/file.c文件中。
2.在av_probe_input_buffer2()中判断出AVInputFormat:
av_probe_input_buffer2().PNG3.av_probe_input_format3()函数:
这里写图片描述
4.mp4对应的read_probe为mov_probe(),在mov.c文件中;
MP4对应的AVFormatContext
AVInputFormat ff_mov_demuxer = {
.name = "mov,mp4,m4a,3gp,3g2,mj2",
.long_name = NULL_IF_CONFIG_SMALL("QuickTime / MOV"),
.priv_class = &mov_class,
.priv_data_size = sizeof(MOVContext),
.extensions = "mov,mp4,m4a,3gp,3g2,mj2",
.read_probe = mov_probe,
.read_header = mov_read_header,
.read_packet = mov_read_packet,
.read_close = mov_read_close,
.read_seek = mov_read_seek,
.flags = AVFMT_NO_BYTE_SEEK,
};
4.在s->iformat->read_header(s),实际为mov_read_header()中,创建MP4文件的AVStream: