FFmpeg总结三AV系列结构体之AVCodecContext.docx

上传人:b****6 文档编号:8774078 上传时间:2023-02-01 格式:DOCX 页数:57 大小:101.61KB
下载 相关 举报
FFmpeg总结三AV系列结构体之AVCodecContext.docx_第1页
第1页 / 共57页
FFmpeg总结三AV系列结构体之AVCodecContext.docx_第2页
第2页 / 共57页
FFmpeg总结三AV系列结构体之AVCodecContext.docx_第3页
第3页 / 共57页
FFmpeg总结三AV系列结构体之AVCodecContext.docx_第4页
第4页 / 共57页
FFmpeg总结三AV系列结构体之AVCodecContext.docx_第5页
第5页 / 共57页
点击查看更多>>
下载资源
资源描述

FFmpeg总结三AV系列结构体之AVCodecContext.docx

《FFmpeg总结三AV系列结构体之AVCodecContext.docx》由会员分享,可在线阅读,更多相关《FFmpeg总结三AV系列结构体之AVCodecContext.docx(57页珍藏版)》请在冰豆网上搜索。

FFmpeg总结三AV系列结构体之AVCodecContext.docx

FFmpeg总结三AV系列结构体之AVCodecContext

FFmpeg总结(三)AV系列结构体之AVCodecContext

描述:

主要扩展API的结构体

Newfieldscanbeaddedtotheendwithminorversionbumps.Removal,reorderingandchangestoexistingfieldsrequireamajorversionbump.YoucanuseAVOptions(av_opt*/av_set/get*())toaccessthesefieldsfromuserapplications.ThenamestringforAVOptionsoptionsmatchestheassociatedcommandlineparameternameandcanbefoundinlibavcodec/options_table.hTheAVOption/commandlineparameternamesdifferinsomecasesfromtheCstructurefieldnamesforhistoricreasonsorbrevity.sizeof(AVCodecContext)mustnotbeusedoutsidelibav*.

typedefstructAVCodecContext{

/**

*informationonstructforav_log

*-setbyavcodec_alloc_context3

*/

constAVClass*av_class;

intlog_level_offset;

enumAVMediaTypecodec_type;/*seeAVMEDIA_TYPE_xxx*/

conststructAVCodec*codec;

#ifFF_API_CODEC_NAME

/**

*@deprecatedthisfieldisnotusedforanythinginlibavcodec

*/

attribute_deprecated

charcodec_name[32];

#endif

enumAVCodecIDcodec_id;/*seeAV_CODEC_ID_xxx*/

/**

*fourcc(LSBfirst,so"ABCD"->('D'<<24)+('C'<<16)+('B'<<8)+'A').

*Thisisusedtoworkaroundsomeencoderbugs.

*Ademuxershouldsetthistowhatisstoredinthefieldusedtoidentifythecodec.

*Iftherearemultiplesuchfieldsinacontainerthenthedemuxershouldchoosetheone

*whichmaximizestheinformationabouttheusedcodec.

*Ifthecodectagfieldinacontainerislargerthan32bitsthenthedemuxershould

*remapthelongerIDto32bitswithatableorotherstructure.Alternativelyanew

*extra_codec_tag+sizecouldbeaddedbutforthisaclearadvantagemustbedemonstrated

*first.

*-encoding:

Setbyuser,ifnotthenthedefaultbasedoncodec_idwillbeused.

*-decoding:

Setbyuser,willbeconvertedtouppercasebylibavcodecduringinit.

*/

unsignedintcodec_tag;

#ifFF_API_STREAM_CODEC_TAG

/**

*@deprecatedthisfieldisunused

*/

attribute_deprecated

unsignedintstream_codec_tag;

#endif

void*priv_data;

/**

*Privatecontextusedforinternaldata.

*

*Unlikepriv_data,thisisnotcodec-specific.Itisusedingeneral

*libavcodecfunctions.

*/

structAVCodecInternal*internal;

/**

*Privatedataoftheuser,canbeusedtocarryappspecificstuff.

*-encoding:

Setbyuser.

*-decoding:

Setbyuser.

*/

void*opaque;

/**

*theaveragebitrate

*-encoding:

Setbyuser;unusedforconstantquantizerencoding.

*-decoding:

Setbyuser,maybeoverwrittenbylibavcodec

*ifthisinfoisavailableinthestream

*/

int64_tbit_rate;

/**

*numberofbitsthebitstreamisallowedtodivergefromthereference.

*thereferencecanbeCBR(forCBRpass1)orVBR(forpass2)

*-encoding:

Setbyuser;unusedforconstantquantizerencoding.

*-decoding:

unused

*/

intbit_rate_tolerance;

/**

*Globalqualityforcodecswhichcannotchangeitperframe.

*ThisshouldbeproportionaltoMPEG-1/2/4qscale.

*-encoding:

Setbyuser.

*-decoding:

unused

*/

intglobal_quality;

/**

*-encoding:

Setbyuser.

*-decoding:

unused

*/

intcompression_level;

#defineFF_COMPRESSION_DEFAULT-1

/**

*AV_CODEC_FLAG_*.

*-encoding:

Setbyuser.

*-decoding:

Setbyuser.

*/

intflags;

/**

*AV_CODEC_FLAG2_*

*-encoding:

Setbyuser.

*-decoding:

Setbyuser.

*/

intflags2;

/**

*somecodecsneed/canuseextradatalikeHuffmantables.

*MJPEG:

Huffmantables

*rv10:

additionalflags

*MPEG-4:

globalheaders(theycanbeinthebitstreamorhere)

*TheallocatedmemoryshouldbeAV_INPUT_BUFFER_PADDING_SIZEbyteslarger

*thanextradata_sizetoavoidproblemsifitisreadwiththebitstreamreader.

*ThebytewisecontentsofextradatamustnotdependonthearchitectureorCPUendianness.

*-encoding:

Set/allocated/freedbylibavcodec.

*-decoding:

Set/allocated/freedbyuser.

*/

uint8_t*extradata;

intextradata_size;

/**

*Thisisthefundamentalunitoftime(inseconds)interms

*ofwhichframetimestampsarerepresented.Forfixed-fpscontent,

*timebaseshouldbe1/framerateandtimestampincrementsshouldbe

*identically1.

*Thisoften,butnotalwaysistheinverseoftheframerateorfieldrate

*forvideo.1/time_baseisnottheaverageframerateiftheframerateisnot

*constant.

*

*Likecontainers,elementarystreamsalsocanstoretimestamps,1/time_base

*istheunitinwhichthesetimestampsarespecified.

*AsexampleofsuchcodectimebaseseeISO/IEC14496-2:

2001(E)

*vop_time_increment_resolutionandfixed_vop_rate

*(fixed_vop_rate==0impliesthatitisdifferentfromtheframerate)

*

*-encoding:

MUSTbesetbyuser.

*-decoding:

theuseofthisfieldfordecodingisdeprecated.

*Useframerateinstead.

*/

AVRationaltime_base;

/**

*Forsomecodecs,thetimebaseisclosertothefieldratethantheframerate.

*Mostnotably,H.264andMPEG-2specifytime_baseashalfofframeduration

*ifnotelecineisused...

*

*Settotime_baseticksperframe.Default1,e.g.,H.264/MPEG-2setitto2.

*/

intticks_per_frame;

/**

*Codecdelay.

*

*Encoding:

Numberofframesdelaytherewillbefromtheencoderinputto

*thedecoderoutput.(weassumethedecodermatchesthespec)

*Decoding:

Numberofframesdelayinadditiontowhatastandarddecoder

*asspecifiedinthespecwouldproduce.

*

*Video:

*Numberofframesthedecodedoutputwillbedelayedrelativetothe

*encodedinput.

*

*Audio:

*Forencoding,thisfieldisunused(seeinitial_padding).

*

*Fordecoding,thisisthenumberofsamplesthedecoderneedsto

*outputbeforethedecoder'soutputisvalid.Whenseeking,youshould

*startdecodingthismanysamplespriortoyourdesiredseekpoint.

*

*-encoding:

Setbylibavcodec.

*-decoding:

Setbylibavcodec.

*/

intdelay;

/*videoonly*/

/**

*picturewidth/height.

*

*@noteThosefieldsmaynotmatchthevaluesofthelast

*AVFrameoutputbyavcodec_decode_video2dueframe

*reordering.

*

*-encoding:

MUSTbesetbyuser.

*-decoding:

Maybesetbytheuserbeforeopeningthedecoderifknowne.g.

*fromthecontainer.Somedecoderswillrequirethedimensions

*tobesetbythecaller.Duringdecoding,thedecodermay

*overwritethosevaluesasrequiredwhileparsingthedata.

*/

intwidth,height;

/**

*Bitstreamwidth/height,maybedifferentfromwidth/heighte.g.when

*thedecodedframeiscroppedbeforebeingoutputorlowresisenabled.

*

*@noteThosefieldmaynotmatchthevalueofthelast

*AVFrameoutputbyavcodec_receive_frame()dueframe

*reordering.

*

*-encoding:

unused

*-decoding:

Maybesetbytheuserbeforeopeningthedecoderifknown

*e.g.fromthecontainer.Duringdecoding,thedecodermay

*overwritethosevaluesasrequiredwhileparsingthedata.

*/

intcoded_width,coded_height;

#ifFF_API_ASPECT_EXTENDED

#defineFF_ASPECT_EXTENDED15

#endif

/**

*thenumberofpicturesinagroupofpictures,or0forintra_only

*-encoding:

Setbyuser.

*-decoding:

unused

*/

intgop_size;

/**

*Pixelformat,seeAV_PIX_FMT_xxx.

*Maybesetbythedemuxerifknownfromheaders.

*Maybeoverriddenbythedecoderifitknowsbetter.

*

*@noteThisfieldmaynotmatchthevalueofthelast

*AVFrameoutputbyavcodec_receive_frame()dueframe

*reordering.

*

*-encoding:

Setbyuser.

*-decoding:

Setbyuserifknown,overriddenbylibavcodecwhile

*parsingthedata.

*/

enumAVPixelFormatpix_fmt;

#ifFF_API_MOTION_EST

/**

*Thisoptiondoesnothing

*@deprecatedusecodecprivateoptionsinstead

*/

attribute_deprecatedintme_method;

#endif

/**

*IfnonNULL,'draw_horiz_band'iscalledbythelibavcodec

*decodertodrawahorizontalband.Itimprovescacheusage.Not

*allcodecscandothat.Youmustcheckthecodeccapabilities

*beforehand.

*Whenmultithreadingisused,itmaybecalledfrommultiplethreads

*atthesametime;threadsmightdrawdifferentpartsofthesameAVFrame,

*ormultipleAVFrames,andthereisnoguaranteethatsliceswillbedrawn

*inorder.

*ThefunctionisalsousedbyhardwareaccelerationAPIs.

*Itiscalledatleastonceduringframedecodingtopass

*thedataneededforhardwarerender.

*Inthatmodeinsteadofpixeldata,AVFramepointsto

*astructurespecifictotheaccelerationAPI.Theapplication

*readsthestructureandcanchangesomefieldstoindicateprogress

*ormarkstate.

*-encoding:

unused

*-decoding:

Setbyuser.

*@paramheighttheheightoftheslice

*@paramytheypositionoftheslice

*@paramtype1->topfield,2->bottomfield,3->frame

*@paramoffsetoffsetintotheAVFrame.datafromwhichthesliceshouldberead

*/

void(*draw_horiz_band)(structAVCodecContext*s,

constAVFrame*src,intoffset[AV_NUM_DATA_POINTERS],

inty,inttype,intheight);

/**

*callbacktonegotiatethepixelFormat

*@paramfmtisthelistofformatswhicharesupportedbythecodec,

*itisterminatedby-1as0isavalidformat,theformatsareorderedbyquality.

*Thefirstisalwaysthenativeone.

*@noteThecallbackmaybecalledagainimmediatelyifinitializationfor

*theselected(hardware-accelerated)pixelformatfailed.

*@warningBehaviorisundefinedifthecallbackreturnsavaluenot

*inthefmtlistofformats.

*@returnthechosenformat

*-encoding:

unused

*-decoding:

Setbyuser,ifnotsetthenativeformatwillbechosen.

*/

enumAVPixelFormat(*get_format)(structAVCodecContext*s,constenumAVPixelFormat*fmt);

/**

*maximumnumberofB-framesbet

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高等教育 > 农学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1