【正文】
pCodec。// Register all formats and codecs[3]} // Codec not foundpFrame=avcodec_alloc_frame()。// of AVPictureframeFinished,av_free(buffer)。流的信息iciformatread_header如果反過來再參考我轉(zhuǎn)貼的關(guān)于ffmpeg框架的文章,是否清楚一些了呢:)[3]:簡單從AVFormatContext獲取Stream的信息,沒什么好多說的[4]:先簡單說一些ffmpeg方面的東西,從理論角度說過來,Packet可以包含frame的部分?jǐn)?shù)據(jù),但ffmpeg為了實(shí)現(xiàn)上的方便,使得對(duì)于視頻來說,每個(gè)Packet至少包含一frame,對(duì)于音頻也是相應(yīng)處理,這是實(shí)現(xiàn)方面的考慮,而非協(xié)議要求.因此,在上面的代碼實(shí)際上是這樣的:+av_read_frame_internal+av_parser_parse調(diào)用的是指定解碼器的sparserparser_parse函數(shù)以從raw packet中重構(gòu)frameavcodec_decode_video||}// Close the video fileavpicture_fill((AVPicture *)pFrameRGB, buffer, PIX_FMT_RGB24,}if(videoStream==1)if(av_open_input_file(amp。if(argc 2) {AVCodecContextint yheight。videoStream=1。pFrameRGB=avcodec_alloc_frame()。pCodecCtxheight)。// Convert the image from its native format to RGBpCodecCtxheight)。......+av_probe_input_format從first_iformat中遍歷注冊(cè)的所有demuxer以|......}這樣看來,只是做了兩件事情:1). 偵測(cè)容器文件格式2). 從容器文件獲取Stream的信息這兩件事情,實(shí)際上就是調(diào)用特定文件的demuxer以分離Stream的過程:具體流程如下:av_open_input_filefmt = av_probe_input_format(pd, 0)。// Close the codec// Save the frame to disk(AVPicture*)pFram