【正文】
解碼|AVInputFormat *fmt,if(++i=5)pCodecCtxwidth,if(frameFinished) {// Determine required buffer size and allocate buffer// Find the decoder for the video streamfor(y=0。intintintuint8_tprintf(Please provide a movie file\n)。return 1。if(pCodec==NULL) {if(avcodec_open(pCodecCtx, pCodec)0)+av_open_input_stream調(diào)用指定demuxer的read_header函數(shù)以獲取相關(guān)do something()。解復(fù)用av_read_frame()|}// Assign appropriate parts of buffer to image planes in pFrameRGBreturn 1。// Retrieve stream information*pFrame。fclose(pFile)。fprintf(pFile, P6\n%d %d\n255\n, width, height)。 FFMpeg的解碼流程(20090618 14:50:32)標(biāo)簽:雜談sprintf(szFilename, frame%, iFrame)。AVPacketreturn 1。break。// Get a pointer to the codec context for the video stream // Could not open codecpCodecCtxwidth, pCodecCtxheight)。packet)=0) {// Did we get a video frame?我們來看看如何獲取Packet,又如何從Packet中解碼frame的。if (!fmt) {return 0。// Free the YUV frameSaveFrame(pFrameRGB, pCodecCtxwidth, pCodecCtxheight,i=0。 // Didn39。return 1。AVCodecfwrite(pFramedata[0]+y*pFramelinesize[0], 1, width*3, pFile)。return。FILE *pFile。pFile=fopen(szFilename, wb)。*