FFmpeg总结三AV系列结构体之AVCodecContextWord格式.docx
《FFmpeg总结三AV系列结构体之AVCodecContextWord格式.docx》由会员分享,可在线阅读,更多相关《FFmpeg总结三AV系列结构体之AVCodecContextWord格式.docx(57页珍藏版)》请在冰豆网上搜索。
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
unsignedintstream_codec_tag;
void*priv_data;
*Privatecontextusedforinternaldata.
*
*Unlikepriv_data,thisisnotcodec-specific.Itisusedingeneral
*libavcodecfunctions.
structAVCodecInternal*internal;
*Privatedataoftheuser,canbeusedtocarryappspecificstuff.
Setbyuser.
void*opaque;
*theaveragebitrate
Setbyuser;
unusedforconstantquantizerencoding.
Setbyuser,maybeoverwrittenbylibavcodec
*ifthisinfoisavailableinthestream
int64_tbit_rate;
*numberofbitsthebitstreamisallowedtodivergefromthereference.
*thereferencecanbeCBR(forCBRpass1)orVBR(forpass2)
unused
intbit_rate_tolerance;
*Globalqualityforcodecswhichcannotchangeitperframe.
*ThisshouldbeproportionaltoMPEG-1/2/4qscale.
intglobal_quality;
intcompression_level;
#defineFF_COMPRESSION_DEFAULT-1
*AV_CODEC_FLAG_*.
intflags;
*AV_CODEC_FLAG2_*
intflags2;
*somecodecsneed/canuseextradatalikeHuffmantables.
*MJPEG:
Huffmantables
*rv10:
additionalflags
*MPEG-4:
globalheaders(theycanbeinthebitstreamorhere)
*TheallocatedmemoryshouldbeAV_INPUT_BUFFER_PADDING_SIZEbyteslarger
*thanextradata_sizetoavoidproblemsifitisreadwiththebitstreamreader.
*ThebytewisecontentsofextradatamustnotdependonthearchitectureorCPUendianness.
Set/allocated/freedbylibavcodec.
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)
MUSTbesetbyuser.
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.
Setbylibavcodec.
intdelay;
/*videoonly*/
*picturewidth/height.
*@noteThosefieldsmaynotmatchthevaluesofthelast
*AVFrameoutputbyavcodec_decode_video2dueframe
*reordering.
Maybesetbytheuserbeforeopeningthedecoderifknowne.g.
*fromthecontainer.Somedecoderswillrequirethedimensions
*tobesetbythecaller.Duringdecoding,thedecodermay
*overwritethosevaluesasrequiredwhileparsingthedata.
intwidth,height;
*Bitstreamwidth/height,maybedifferentfromwidth/heighte.g.when
*thedecodedframeiscroppedbeforebeingoutputorlowresisenabled.
*@noteThosefieldmaynotmatchthevalueofthelast
*AVFrameoutputbyavcodec_receive_frame()dueframe
Maybesetbytheuserbeforeopeningthedecoderifknown
*e.g.fromthecontainer.Duringdecoding,thedecodermay
intcoded_width,coded_height;
#ifFF_API_ASPECT_EXTENDED
#defineFF_ASPECT_EXTENDED15
*thenumberofpicturesinagroupofpictures,or0forintra_only
intgop_size;
*Pixelformat,seeAV_PIX_FMT_xxx.
*Maybesetbythedemuxerifknownfromheaders.
*Maybeoverriddenbythedecoderifitknowsbetter.
*@noteThisfieldmaynotmatchthevalueofthelast
Setbyuserifknown,overriddenbylibavcodecwhile
*parsingthedata.
enumAVPixelFormatpix_fmt;
#ifFF_API_MOTION_EST
*Thisoptiondoesnothing
*@deprecatedusecodecprivateoptionsinstead
attribute_deprecatedintme_method;
*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.
*@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
Setbyuser,ifnotsetthenativeformatwillbechosen.
enumAVPixelFormat(*get_format)(structAVCodecContext*s,constenumAVPixelFormat*fmt);
*maximumnumberofB-framesbet