patch-bug1435212 491 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603
  1. diff --git dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
  2. index 4600ad6d247c..a9c7089fa880 100644
  3. --- mozilla/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
  4. +++ mozilla/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
  5. @@ -77,15 +77,21 @@ FFmpegDataDecoder<LIBAV_VER>::InitDecoder()
  6. mCodecContext->extradata_size = mExtraData->Length();
  7. // FFmpeg may use SIMD instructions to access the data which reads the
  8. // data in 32 bytes block. Must ensure we have enough data to read.
  9. +#if LIBAVCODEC_VERSION_MAJOR >= 58
  10. + mExtraData->AppendElements(AV_INPUT_BUFFER_PADDING_SIZE);
  11. +#else
  12. mExtraData->AppendElements(FF_INPUT_BUFFER_PADDING_SIZE);
  13. +#endif
  14. mCodecContext->extradata = mExtraData->Elements();
  15. } else {
  16. mCodecContext->extradata_size = 0;
  17. }
  18. +#if LIBAVCODEC_VERSION_MAJOR < 57
  19. if (codec->capabilities & CODEC_CAP_DR1) {
  20. mCodecContext->flags |= CODEC_FLAG_EMU_EDGE;
  21. }
  22. +#endif
  23. if (mLib->avcodec_open2(mCodecContext, codec, nullptr) < 0) {
  24. mLib->avcodec_close(mCodecContext);
  25. diff --git dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp
  26. index 6b8b38487d56..d08eee3fc8e8 100644
  27. --- mozilla/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp
  28. +++ mozilla/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp
  29. @@ -63,12 +63,14 @@ FFmpegLibWrapper::Link()
  30. AV_FUNC_55 = 1 << 2,
  31. AV_FUNC_56 = 1 << 3,
  32. AV_FUNC_57 = 1 << 4,
  33. + AV_FUNC_58 = 1 << 5,
  34. AV_FUNC_AVUTIL_53 = AV_FUNC_53 | AV_FUNC_AVUTIL_MASK,
  35. AV_FUNC_AVUTIL_54 = AV_FUNC_54 | AV_FUNC_AVUTIL_MASK,
  36. AV_FUNC_AVUTIL_55 = AV_FUNC_55 | AV_FUNC_AVUTIL_MASK,
  37. AV_FUNC_AVUTIL_56 = AV_FUNC_56 | AV_FUNC_AVUTIL_MASK,
  38. AV_FUNC_AVUTIL_57 = AV_FUNC_57 | AV_FUNC_AVUTIL_MASK,
  39. - AV_FUNC_AVCODEC_ALL = AV_FUNC_53 | AV_FUNC_54 | AV_FUNC_55 | AV_FUNC_56 | AV_FUNC_57,
  40. + AV_FUNC_AVUTIL_58 = AV_FUNC_58 | AV_FUNC_AVUTIL_MASK,
  41. + AV_FUNC_AVCODEC_ALL = AV_FUNC_53 | AV_FUNC_54 | AV_FUNC_55 | AV_FUNC_56 | AV_FUNC_57 | AV_FUNC_58,
  42. AV_FUNC_AVUTIL_ALL = AV_FUNC_AVCODEC_ALL | AV_FUNC_AVUTIL_MASK
  43. };
  44. @@ -88,6 +90,9 @@ FFmpegLibWrapper::Link()
  45. case 57:
  46. version = AV_FUNC_57;
  47. break;
  48. + case 58:
  49. + version = AV_FUNC_58;
  50. + break;
  51. default:
  52. FFMPEG_LOG("Unknown avcodec version");
  53. Unlink();
  54. @@ -136,9 +141,9 @@ FFmpegLibWrapper::Link()
  55. AV_FUNC(av_log_set_level, AV_FUNC_AVUTIL_ALL)
  56. AV_FUNC(av_malloc, AV_FUNC_AVUTIL_ALL)
  57. AV_FUNC(av_freep, AV_FUNC_AVUTIL_ALL)
  58. - AV_FUNC(av_frame_alloc, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57))
  59. - AV_FUNC(av_frame_free, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57))
  60. - AV_FUNC(av_frame_unref, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57))
  61. + AV_FUNC(av_frame_alloc, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58))
  62. + AV_FUNC(av_frame_free, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58))
  63. + AV_FUNC(av_frame_unref, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58))
  64. AV_FUNC_OPTION(av_frame_get_colorspace, AV_FUNC_AVUTIL_ALL)
  65. #undef AV_FUNC
  66. #undef AV_FUNC_OPTION
  67. diff --git dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp
  68. index f671e6e61bc4..b7ab49329502 100644
  69. --- mozilla/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp
  70. +++ mozilla/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp
  71. @@ -26,12 +26,15 @@ static FFmpegLibWrapper sLibAV;
  72. static const char* sLibs[] = {
  73. #if defined(XP_DARWIN)
  74. + "libavcodec.58.dylib",
  75. "libavcodec.57.dylib",
  76. "libavcodec.56.dylib",
  77. "libavcodec.55.dylib",
  78. "libavcodec.54.dylib",
  79. "libavcodec.53.dylib",
  80. #else
  81. + "libavcodec.so.58",
  82. + "libavcodec-ffmpeg.so.58",
  83. "libavcodec-ffmpeg.so.57",
  84. "libavcodec-ffmpeg.so.56",
  85. "libavcodec.so.57",
  86. @@ -134,6 +137,7 @@ FFmpegRuntimeLinker::CreateDecoderModule()
  87. case 55:
  88. case 56: module = FFmpegDecoderModule<55>::Create(&sLibAV); break;
  89. case 57: module = FFmpegDecoderModule<57>::Create(&sLibAV); break;
  90. + case 58: module = FFmpegDecoderModule<58>::Create(&sLibAV); break;
  91. default: module = nullptr;
  92. }
  93. return module.forget();
  94. diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/COPYING.LGPLv2.1 dom/media/platforms/ffmpeg/ffmpeg58/include/COPYING.LGPLv2.1
  95. new file mode 100644
  96. index 000000000000..00b4fedfe7e7
  97. --- /dev/null
  98. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/include/COPYING.LGPLv2.1
  99. @@ -0,0 +1,504 @@
  100. + GNU LESSER GENERAL PUBLIC LICENSE
  101. + Version 2.1, February 1999
  102. +
  103. + Copyright (C) 1991, 1999 Free Software Foundation, Inc.
  104. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  105. + Everyone is permitted to copy and distribute verbatim copies
  106. + of this license document, but changing it is not allowed.
  107. +
  108. +[This is the first released version of the Lesser GPL. It also counts
  109. + as the successor of the GNU Library Public License, version 2, hence
  110. + the version number 2.1.]
  111. +
  112. + Preamble
  113. +
  114. + The licenses for most software are designed to take away your
  115. +freedom to share and change it. By contrast, the GNU General Public
  116. +Licenses are intended to guarantee your freedom to share and change
  117. +free software--to make sure the software is free for all its users.
  118. +
  119. + This license, the Lesser General Public License, applies to some
  120. +specially designated software packages--typically libraries--of the
  121. +Free Software Foundation and other authors who decide to use it. You
  122. +can use it too, but we suggest you first think carefully about whether
  123. +this license or the ordinary General Public License is the better
  124. +strategy to use in any particular case, based on the explanations below.
  125. +
  126. + When we speak of free software, we are referring to freedom of use,
  127. +not price. Our General Public Licenses are designed to make sure that
  128. +you have the freedom to distribute copies of free software (and charge
  129. +for this service if you wish); that you receive source code or can get
  130. +it if you want it; that you can change the software and use pieces of
  131. +it in new free programs; and that you are informed that you can do
  132. +these things.
  133. +
  134. + To protect your rights, we need to make restrictions that forbid
  135. +distributors to deny you these rights or to ask you to surrender these
  136. +rights. These restrictions translate to certain responsibilities for
  137. +you if you distribute copies of the library or if you modify it.
  138. +
  139. + For example, if you distribute copies of the library, whether gratis
  140. +or for a fee, you must give the recipients all the rights that we gave
  141. +you. You must make sure that they, too, receive or can get the source
  142. +code. If you link other code with the library, you must provide
  143. +complete object files to the recipients, so that they can relink them
  144. +with the library after making changes to the library and recompiling
  145. +it. And you must show them these terms so they know their rights.
  146. +
  147. + We protect your rights with a two-step method: (1) we copyright the
  148. +library, and (2) we offer you this license, which gives you legal
  149. +permission to copy, distribute and/or modify the library.
  150. +
  151. + To protect each distributor, we want to make it very clear that
  152. +there is no warranty for the free library. Also, if the library is
  153. +modified by someone else and passed on, the recipients should know
  154. +that what they have is not the original version, so that the original
  155. +author's reputation will not be affected by problems that might be
  156. +introduced by others.
  157. +
  158. + Finally, software patents pose a constant threat to the existence of
  159. +any free program. We wish to make sure that a company cannot
  160. +effectively restrict the users of a free program by obtaining a
  161. +restrictive license from a patent holder. Therefore, we insist that
  162. +any patent license obtained for a version of the library must be
  163. +consistent with the full freedom of use specified in this license.
  164. +
  165. + Most GNU software, including some libraries, is covered by the
  166. +ordinary GNU General Public License. This license, the GNU Lesser
  167. +General Public License, applies to certain designated libraries, and
  168. +is quite different from the ordinary General Public License. We use
  169. +this license for certain libraries in order to permit linking those
  170. +libraries into non-free programs.
  171. +
  172. + When a program is linked with a library, whether statically or using
  173. +a shared library, the combination of the two is legally speaking a
  174. +combined work, a derivative of the original library. The ordinary
  175. +General Public License therefore permits such linking only if the
  176. +entire combination fits its criteria of freedom. The Lesser General
  177. +Public License permits more lax criteria for linking other code with
  178. +the library.
  179. +
  180. + We call this license the "Lesser" General Public License because it
  181. +does Less to protect the user's freedom than the ordinary General
  182. +Public License. It also provides other free software developers Less
  183. +of an advantage over competing non-free programs. These disadvantages
  184. +are the reason we use the ordinary General Public License for many
  185. +libraries. However, the Lesser license provides advantages in certain
  186. +special circumstances.
  187. +
  188. + For example, on rare occasions, there may be a special need to
  189. +encourage the widest possible use of a certain library, so that it becomes
  190. +a de-facto standard. To achieve this, non-free programs must be
  191. +allowed to use the library. A more frequent case is that a free
  192. +library does the same job as widely used non-free libraries. In this
  193. +case, there is little to gain by limiting the free library to free
  194. +software only, so we use the Lesser General Public License.
  195. +
  196. + In other cases, permission to use a particular library in non-free
  197. +programs enables a greater number of people to use a large body of
  198. +free software. For example, permission to use the GNU C Library in
  199. +non-free programs enables many more people to use the whole GNU
  200. +operating system, as well as its variant, the GNU/Linux operating
  201. +system.
  202. +
  203. + Although the Lesser General Public License is Less protective of the
  204. +users' freedom, it does ensure that the user of a program that is
  205. +linked with the Library has the freedom and the wherewithal to run
  206. +that program using a modified version of the Library.
  207. +
  208. + The precise terms and conditions for copying, distribution and
  209. +modification follow. Pay close attention to the difference between a
  210. +"work based on the library" and a "work that uses the library". The
  211. +former contains code derived from the library, whereas the latter must
  212. +be combined with the library in order to run.
  213. +
  214. + GNU LESSER GENERAL PUBLIC LICENSE
  215. + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  216. +
  217. + 0. This License Agreement applies to any software library or other
  218. +program which contains a notice placed by the copyright holder or
  219. +other authorized party saying it may be distributed under the terms of
  220. +this Lesser General Public License (also called "this License").
  221. +Each licensee is addressed as "you".
  222. +
  223. + A "library" means a collection of software functions and/or data
  224. +prepared so as to be conveniently linked with application programs
  225. +(which use some of those functions and data) to form executables.
  226. +
  227. + The "Library", below, refers to any such software library or work
  228. +which has been distributed under these terms. A "work based on the
  229. +Library" means either the Library or any derivative work under
  230. +copyright law: that is to say, a work containing the Library or a
  231. +portion of it, either verbatim or with modifications and/or translated
  232. +straightforwardly into another language. (Hereinafter, translation is
  233. +included without limitation in the term "modification".)
  234. +
  235. + "Source code" for a work means the preferred form of the work for
  236. +making modifications to it. For a library, complete source code means
  237. +all the source code for all modules it contains, plus any associated
  238. +interface definition files, plus the scripts used to control compilation
  239. +and installation of the library.
  240. +
  241. + Activities other than copying, distribution and modification are not
  242. +covered by this License; they are outside its scope. The act of
  243. +running a program using the Library is not restricted, and output from
  244. +such a program is covered only if its contents constitute a work based
  245. +on the Library (independent of the use of the Library in a tool for
  246. +writing it). Whether that is true depends on what the Library does
  247. +and what the program that uses the Library does.
  248. +
  249. + 1. You may copy and distribute verbatim copies of the Library's
  250. +complete source code as you receive it, in any medium, provided that
  251. +you conspicuously and appropriately publish on each copy an
  252. +appropriate copyright notice and disclaimer of warranty; keep intact
  253. +all the notices that refer to this License and to the absence of any
  254. +warranty; and distribute a copy of this License along with the
  255. +Library.
  256. +
  257. + You may charge a fee for the physical act of transferring a copy,
  258. +and you may at your option offer warranty protection in exchange for a
  259. +fee.
  260. +
  261. + 2. You may modify your copy or copies of the Library or any portion
  262. +of it, thus forming a work based on the Library, and copy and
  263. +distribute such modifications or work under the terms of Section 1
  264. +above, provided that you also meet all of these conditions:
  265. +
  266. + a) The modified work must itself be a software library.
  267. +
  268. + b) You must cause the files modified to carry prominent notices
  269. + stating that you changed the files and the date of any change.
  270. +
  271. + c) You must cause the whole of the work to be licensed at no
  272. + charge to all third parties under the terms of this License.
  273. +
  274. + d) If a facility in the modified Library refers to a function or a
  275. + table of data to be supplied by an application program that uses
  276. + the facility, other than as an argument passed when the facility
  277. + is invoked, then you must make a good faith effort to ensure that,
  278. + in the event an application does not supply such function or
  279. + table, the facility still operates, and performs whatever part of
  280. + its purpose remains meaningful.
  281. +
  282. + (For example, a function in a library to compute square roots has
  283. + a purpose that is entirely well-defined independent of the
  284. + application. Therefore, Subsection 2d requires that any
  285. + application-supplied function or table used by this function must
  286. + be optional: if the application does not supply it, the square
  287. + root function must still compute square roots.)
  288. +
  289. +These requirements apply to the modified work as a whole. If
  290. +identifiable sections of that work are not derived from the Library,
  291. +and can be reasonably considered independent and separate works in
  292. +themselves, then this License, and its terms, do not apply to those
  293. +sections when you distribute them as separate works. But when you
  294. +distribute the same sections as part of a whole which is a work based
  295. +on the Library, the distribution of the whole must be on the terms of
  296. +this License, whose permissions for other licensees extend to the
  297. +entire whole, and thus to each and every part regardless of who wrote
  298. +it.
  299. +
  300. +Thus, it is not the intent of this section to claim rights or contest
  301. +your rights to work written entirely by you; rather, the intent is to
  302. +exercise the right to control the distribution of derivative or
  303. +collective works based on the Library.
  304. +
  305. +In addition, mere aggregation of another work not based on the Library
  306. +with the Library (or with a work based on the Library) on a volume of
  307. +a storage or distribution medium does not bring the other work under
  308. +the scope of this License.
  309. +
  310. + 3. You may opt to apply the terms of the ordinary GNU General Public
  311. +License instead of this License to a given copy of the Library. To do
  312. +this, you must alter all the notices that refer to this License, so
  313. +that they refer to the ordinary GNU General Public License, version 2,
  314. +instead of to this License. (If a newer version than version 2 of the
  315. +ordinary GNU General Public License has appeared, then you can specify
  316. +that version instead if you wish.) Do not make any other change in
  317. +these notices.
  318. +
  319. + Once this change is made in a given copy, it is irreversible for
  320. +that copy, so the ordinary GNU General Public License applies to all
  321. +subsequent copies and derivative works made from that copy.
  322. +
  323. + This option is useful when you wish to copy part of the code of
  324. +the Library into a program that is not a library.
  325. +
  326. + 4. You may copy and distribute the Library (or a portion or
  327. +derivative of it, under Section 2) in object code or executable form
  328. +under the terms of Sections 1 and 2 above provided that you accompany
  329. +it with the complete corresponding machine-readable source code, which
  330. +must be distributed under the terms of Sections 1 and 2 above on a
  331. +medium customarily used for software interchange.
  332. +
  333. + If distribution of object code is made by offering access to copy
  334. +from a designated place, then offering equivalent access to copy the
  335. +source code from the same place satisfies the requirement to
  336. +distribute the source code, even though third parties are not
  337. +compelled to copy the source along with the object code.
  338. +
  339. + 5. A program that contains no derivative of any portion of the
  340. +Library, but is designed to work with the Library by being compiled or
  341. +linked with it, is called a "work that uses the Library". Such a
  342. +work, in isolation, is not a derivative work of the Library, and
  343. +therefore falls outside the scope of this License.
  344. +
  345. + However, linking a "work that uses the Library" with the Library
  346. +creates an executable that is a derivative of the Library (because it
  347. +contains portions of the Library), rather than a "work that uses the
  348. +library". The executable is therefore covered by this License.
  349. +Section 6 states terms for distribution of such executables.
  350. +
  351. + When a "work that uses the Library" uses material from a header file
  352. +that is part of the Library, the object code for the work may be a
  353. +derivative work of the Library even though the source code is not.
  354. +Whether this is true is especially significant if the work can be
  355. +linked without the Library, or if the work is itself a library. The
  356. +threshold for this to be true is not precisely defined by law.
  357. +
  358. + If such an object file uses only numerical parameters, data
  359. +structure layouts and accessors, and small macros and small inline
  360. +functions (ten lines or less in length), then the use of the object
  361. +file is unrestricted, regardless of whether it is legally a derivative
  362. +work. (Executables containing this object code plus portions of the
  363. +Library will still fall under Section 6.)
  364. +
  365. + Otherwise, if the work is a derivative of the Library, you may
  366. +distribute the object code for the work under the terms of Section 6.
  367. +Any executables containing that work also fall under Section 6,
  368. +whether or not they are linked directly with the Library itself.
  369. +
  370. + 6. As an exception to the Sections above, you may also combine or
  371. +link a "work that uses the Library" with the Library to produce a
  372. +work containing portions of the Library, and distribute that work
  373. +under terms of your choice, provided that the terms permit
  374. +modification of the work for the customer's own use and reverse
  375. +engineering for debugging such modifications.
  376. +
  377. + You must give prominent notice with each copy of the work that the
  378. +Library is used in it and that the Library and its use are covered by
  379. +this License. You must supply a copy of this License. If the work
  380. +during execution displays copyright notices, you must include the
  381. +copyright notice for the Library among them, as well as a reference
  382. +directing the user to the copy of this License. Also, you must do one
  383. +of these things:
  384. +
  385. + a) Accompany the work with the complete corresponding
  386. + machine-readable source code for the Library including whatever
  387. + changes were used in the work (which must be distributed under
  388. + Sections 1 and 2 above); and, if the work is an executable linked
  389. + with the Library, with the complete machine-readable "work that
  390. + uses the Library", as object code and/or source code, so that the
  391. + user can modify the Library and then relink to produce a modified
  392. + executable containing the modified Library. (It is understood
  393. + that the user who changes the contents of definitions files in the
  394. + Library will not necessarily be able to recompile the application
  395. + to use the modified definitions.)
  396. +
  397. + b) Use a suitable shared library mechanism for linking with the
  398. + Library. A suitable mechanism is one that (1) uses at run time a
  399. + copy of the library already present on the user's computer system,
  400. + rather than copying library functions into the executable, and (2)
  401. + will operate properly with a modified version of the library, if
  402. + the user installs one, as long as the modified version is
  403. + interface-compatible with the version that the work was made with.
  404. +
  405. + c) Accompany the work with a written offer, valid for at
  406. + least three years, to give the same user the materials
  407. + specified in Subsection 6a, above, for a charge no more
  408. + than the cost of performing this distribution.
  409. +
  410. + d) If distribution of the work is made by offering access to copy
  411. + from a designated place, offer equivalent access to copy the above
  412. + specified materials from the same place.
  413. +
  414. + e) Verify that the user has already received a copy of these
  415. + materials or that you have already sent this user a copy.
  416. +
  417. + For an executable, the required form of the "work that uses the
  418. +Library" must include any data and utility programs needed for
  419. +reproducing the executable from it. However, as a special exception,
  420. +the materials to be distributed need not include anything that is
  421. +normally distributed (in either source or binary form) with the major
  422. +components (compiler, kernel, and so on) of the operating system on
  423. +which the executable runs, unless that component itself accompanies
  424. +the executable.
  425. +
  426. + It may happen that this requirement contradicts the license
  427. +restrictions of other proprietary libraries that do not normally
  428. +accompany the operating system. Such a contradiction means you cannot
  429. +use both them and the Library together in an executable that you
  430. +distribute.
  431. +
  432. + 7. You may place library facilities that are a work based on the
  433. +Library side-by-side in a single library together with other library
  434. +facilities not covered by this License, and distribute such a combined
  435. +library, provided that the separate distribution of the work based on
  436. +the Library and of the other library facilities is otherwise
  437. +permitted, and provided that you do these two things:
  438. +
  439. + a) Accompany the combined library with a copy of the same work
  440. + based on the Library, uncombined with any other library
  441. + facilities. This must be distributed under the terms of the
  442. + Sections above.
  443. +
  444. + b) Give prominent notice with the combined library of the fact
  445. + that part of it is a work based on the Library, and explaining
  446. + where to find the accompanying uncombined form of the same work.
  447. +
  448. + 8. You may not copy, modify, sublicense, link with, or distribute
  449. +the Library except as expressly provided under this License. Any
  450. +attempt otherwise to copy, modify, sublicense, link with, or
  451. +distribute the Library is void, and will automatically terminate your
  452. +rights under this License. However, parties who have received copies,
  453. +or rights, from you under this License will not have their licenses
  454. +terminated so long as such parties remain in full compliance.
  455. +
  456. + 9. You are not required to accept this License, since you have not
  457. +signed it. However, nothing else grants you permission to modify or
  458. +distribute the Library or its derivative works. These actions are
  459. +prohibited by law if you do not accept this License. Therefore, by
  460. +modifying or distributing the Library (or any work based on the
  461. +Library), you indicate your acceptance of this License to do so, and
  462. +all its terms and conditions for copying, distributing or modifying
  463. +the Library or works based on it.
  464. +
  465. + 10. Each time you redistribute the Library (or any work based on the
  466. +Library), the recipient automatically receives a license from the
  467. +original licensor to copy, distribute, link with or modify the Library
  468. +subject to these terms and conditions. You may not impose any further
  469. +restrictions on the recipients' exercise of the rights granted herein.
  470. +You are not responsible for enforcing compliance by third parties with
  471. +this License.
  472. +
  473. + 11. If, as a consequence of a court judgment or allegation of patent
  474. +infringement or for any other reason (not limited to patent issues),
  475. +conditions are imposed on you (whether by court order, agreement or
  476. +otherwise) that contradict the conditions of this License, they do not
  477. +excuse you from the conditions of this License. If you cannot
  478. +distribute so as to satisfy simultaneously your obligations under this
  479. +License and any other pertinent obligations, then as a consequence you
  480. +may not distribute the Library at all. For example, if a patent
  481. +license would not permit royalty-free redistribution of the Library by
  482. +all those who receive copies directly or indirectly through you, then
  483. +the only way you could satisfy both it and this License would be to
  484. +refrain entirely from distribution of the Library.
  485. +
  486. +If any portion of this section is held invalid or unenforceable under any
  487. +particular circumstance, the balance of the section is intended to apply,
  488. +and the section as a whole is intended to apply in other circumstances.
  489. +
  490. +It is not the purpose of this section to induce you to infringe any
  491. +patents or other property right claims or to contest validity of any
  492. +such claims; this section has the sole purpose of protecting the
  493. +integrity of the free software distribution system which is
  494. +implemented by public license practices. Many people have made
  495. +generous contributions to the wide range of software distributed
  496. +through that system in reliance on consistent application of that
  497. +system; it is up to the author/donor to decide if he or she is willing
  498. +to distribute software through any other system and a licensee cannot
  499. +impose that choice.
  500. +
  501. +This section is intended to make thoroughly clear what is believed to
  502. +be a consequence of the rest of this License.
  503. +
  504. + 12. If the distribution and/or use of the Library is restricted in
  505. +certain countries either by patents or by copyrighted interfaces, the
  506. +original copyright holder who places the Library under this License may add
  507. +an explicit geographical distribution limitation excluding those countries,
  508. +so that distribution is permitted only in or among countries not thus
  509. +excluded. In such case, this License incorporates the limitation as if
  510. +written in the body of this License.
  511. +
  512. + 13. The Free Software Foundation may publish revised and/or new
  513. +versions of the Lesser General Public License from time to time.
  514. +Such new versions will be similar in spirit to the present version,
  515. +but may differ in detail to address new problems or concerns.
  516. +
  517. +Each version is given a distinguishing version number. If the Library
  518. +specifies a version number of this License which applies to it and
  519. +"any later version", you have the option of following the terms and
  520. +conditions either of that version or of any later version published by
  521. +the Free Software Foundation. If the Library does not specify a
  522. +license version number, you may choose any version ever published by
  523. +the Free Software Foundation.
  524. +
  525. + 14. If you wish to incorporate parts of the Library into other free
  526. +programs whose distribution conditions are incompatible with these,
  527. +write to the author to ask for permission. For software which is
  528. +copyrighted by the Free Software Foundation, write to the Free
  529. +Software Foundation; we sometimes make exceptions for this. Our
  530. +decision will be guided by the two goals of preserving the free status
  531. +of all derivatives of our free software and of promoting the sharing
  532. +and reuse of software generally.
  533. +
  534. + NO WARRANTY
  535. +
  536. + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
  537. +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
  538. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
  539. +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
  540. +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
  541. +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  542. +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
  543. +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
  544. +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
  545. +
  546. + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
  547. +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
  548. +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
  549. +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
  550. +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
  551. +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
  552. +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
  553. +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
  554. +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
  555. +DAMAGES.
  556. +
  557. + END OF TERMS AND CONDITIONS
  558. +
  559. + How to Apply These Terms to Your New Libraries
  560. +
  561. + If you develop a new library, and you want it to be of the greatest
  562. +possible use to the public, we recommend making it free software that
  563. +everyone can redistribute and change. You can do so by permitting
  564. +redistribution under these terms (or, alternatively, under the terms of the
  565. +ordinary General Public License).
  566. +
  567. + To apply these terms, attach the following notices to the library. It is
  568. +safest to attach them to the start of each source file to most effectively
  569. +convey the exclusion of warranty; and each file should have at least the
  570. +"copyright" line and a pointer to where the full notice is found.
  571. +
  572. + <one line to give the library's name and a brief idea of what it does.>
  573. + Copyright (C) <year> <name of author>
  574. +
  575. + This library is free software; you can redistribute it and/or
  576. + modify it under the terms of the GNU Lesser General Public
  577. + License as published by the Free Software Foundation; either
  578. + version 2.1 of the License, or (at your option) any later version.
  579. +
  580. + This library is distributed in the hope that it will be useful,
  581. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  582. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  583. + Lesser General Public License for more details.
  584. +
  585. + You should have received a copy of the GNU Lesser General Public
  586. + License along with this library; if not, write to the Free Software
  587. + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  588. +
  589. +Also add information on how to contact you by electronic and paper mail.
  590. +
  591. +You should also get your employer (if you work as a programmer) or your
  592. +school, if any, to sign a "copyright disclaimer" for the library, if
  593. +necessary. Here is a sample; alter the names:
  594. +
  595. + Yoyodyne, Inc., hereby disclaims all copyright interest in the
  596. + library `Frob' (a library for tweaking knobs) written by James Random Hacker.
  597. +
  598. + <signature of Ty Coon>, 1 April 1990
  599. + Ty Coon, President of Vice
  600. +
  601. +That's all there is to it!
  602. +
  603. +
  604. diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avcodec.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avcodec.h
  605. new file mode 100644
  606. index 000000000000..fb0c6fae70b3
  607. --- /dev/null
  608. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avcodec.h
  609. @@ -0,0 +1,6146 @@
  610. +/*
  611. + * copyright (c) 2001 Fabrice Bellard
  612. + *
  613. + * This file is part of FFmpeg.
  614. + *
  615. + * FFmpeg is free software; you can redistribute it and/or
  616. + * modify it under the terms of the GNU Lesser General Public
  617. + * License as published by the Free Software Foundation; either
  618. + * version 2.1 of the License, or (at your option) any later version.
  619. + *
  620. + * FFmpeg is distributed in the hope that it will be useful,
  621. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  622. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  623. + * Lesser General Public License for more details.
  624. + *
  625. + * You should have received a copy of the GNU Lesser General Public
  626. + * License along with FFmpeg; if not, write to the Free Software
  627. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  628. + */
  629. +
  630. +#ifndef AVCODEC_AVCODEC_H
  631. +#define AVCODEC_AVCODEC_H
  632. +
  633. +/**
  634. + * @file
  635. + * @ingroup libavc
  636. + * Libavcodec external API header
  637. + */
  638. +
  639. +#include <errno.h>
  640. +#include "libavutil/samplefmt.h"
  641. +#include "libavutil/attributes.h"
  642. +#include "libavutil/avutil.h"
  643. +#include "libavutil/buffer.h"
  644. +#include "libavutil/cpu.h"
  645. +#include "libavutil/channel_layout.h"
  646. +#include "libavutil/dict.h"
  647. +#include "libavutil/frame.h"
  648. +#include "libavutil/hwcontext.h"
  649. +#include "libavutil/log.h"
  650. +#include "libavutil/pixfmt.h"
  651. +#include "libavutil/rational.h"
  652. +
  653. +#include "version.h"
  654. +
  655. +/**
  656. + * @defgroup libavc libavcodec
  657. + * Encoding/Decoding Library
  658. + *
  659. + * @{
  660. + *
  661. + * @defgroup lavc_decoding Decoding
  662. + * @{
  663. + * @}
  664. + *
  665. + * @defgroup lavc_encoding Encoding
  666. + * @{
  667. + * @}
  668. + *
  669. + * @defgroup lavc_codec Codecs
  670. + * @{
  671. + * @defgroup lavc_codec_native Native Codecs
  672. + * @{
  673. + * @}
  674. + * @defgroup lavc_codec_wrappers External library wrappers
  675. + * @{
  676. + * @}
  677. + * @defgroup lavc_codec_hwaccel Hardware Accelerators bridge
  678. + * @{
  679. + * @}
  680. + * @}
  681. + * @defgroup lavc_internal Internal
  682. + * @{
  683. + * @}
  684. + * @}
  685. + */
  686. +
  687. +/**
  688. + * @ingroup libavc
  689. + * @defgroup lavc_encdec send/receive encoding and decoding API overview
  690. + * @{
  691. + *
  692. + * The avcodec_send_packet()/avcodec_receive_frame()/avcodec_send_frame()/
  693. + * avcodec_receive_packet() functions provide an encode/decode API, which
  694. + * decouples input and output.
  695. + *
  696. + * The API is very similar for encoding/decoding and audio/video, and works as
  697. + * follows:
  698. + * - Set up and open the AVCodecContext as usual.
  699. + * - Send valid input:
  700. + * - For decoding, call avcodec_send_packet() to give the decoder raw
  701. + * compressed data in an AVPacket.
  702. + * - For encoding, call avcodec_send_frame() to give the encoder an AVFrame
  703. + * containing uncompressed audio or video.
  704. + * In both cases, it is recommended that AVPackets and AVFrames are
  705. + * refcounted, or libavcodec might have to copy the input data. (libavformat
  706. + * always returns refcounted AVPackets, and av_frame_get_buffer() allocates
  707. + * refcounted AVFrames.)
  708. + * - Receive output in a loop. Periodically call one of the avcodec_receive_*()
  709. + * functions and process their output:
  710. + * - For decoding, call avcodec_receive_frame(). On success, it will return
  711. + * an AVFrame containing uncompressed audio or video data.
  712. + * - For encoding, call avcodec_receive_packet(). On success, it will return
  713. + * an AVPacket with a compressed frame.
  714. + * Repeat this call until it returns AVERROR(EAGAIN) or an error. The
  715. + * AVERROR(EAGAIN) return value means that new input data is required to
  716. + * return new output. In this case, continue with sending input. For each
  717. + * input frame/packet, the codec will typically return 1 output frame/packet,
  718. + * but it can also be 0 or more than 1.
  719. + *
  720. + * At the beginning of decoding or encoding, the codec might accept multiple
  721. + * input frames/packets without returning a frame, until its internal buffers
  722. + * are filled. This situation is handled transparently if you follow the steps
  723. + * outlined above.
  724. + *
  725. + * In theory, sending input can result in EAGAIN - this should happen only if
  726. + * not all output was received. You can use this to structure alternative decode
  727. + * or encode loops other than the one suggested above. For example, you could
  728. + * try sending new input on each iteration, and try to receive output if that
  729. + * returns EAGAIN.
  730. + *
  731. + * End of stream situations. These require "flushing" (aka draining) the codec,
  732. + * as the codec might buffer multiple frames or packets internally for
  733. + * performance or out of necessity (consider B-frames).
  734. + * This is handled as follows:
  735. + * - Instead of valid input, send NULL to the avcodec_send_packet() (decoding)
  736. + * or avcodec_send_frame() (encoding) functions. This will enter draining
  737. + * mode.
  738. + * - Call avcodec_receive_frame() (decoding) or avcodec_receive_packet()
  739. + * (encoding) in a loop until AVERROR_EOF is returned. The functions will
  740. + * not return AVERROR(EAGAIN), unless you forgot to enter draining mode.
  741. + * - Before decoding can be resumed again, the codec has to be reset with
  742. + * avcodec_flush_buffers().
  743. + *
  744. + * Using the API as outlined above is highly recommended. But it is also
  745. + * possible to call functions outside of this rigid schema. For example, you can
  746. + * call avcodec_send_packet() repeatedly without calling
  747. + * avcodec_receive_frame(). In this case, avcodec_send_packet() will succeed
  748. + * until the codec's internal buffer has been filled up (which is typically of
  749. + * size 1 per output frame, after initial input), and then reject input with
  750. + * AVERROR(EAGAIN). Once it starts rejecting input, you have no choice but to
  751. + * read at least some output.
  752. + *
  753. + * Not all codecs will follow a rigid and predictable dataflow; the only
  754. + * guarantee is that an AVERROR(EAGAIN) return value on a send/receive call on
  755. + * one end implies that a receive/send call on the other end will succeed, or
  756. + * at least will not fail with AVERROR(EAGAIN). In general, no codec will
  757. + * permit unlimited buffering of input or output.
  758. + *
  759. + * This API replaces the following legacy functions:
  760. + * - avcodec_decode_video2() and avcodec_decode_audio4():
  761. + * Use avcodec_send_packet() to feed input to the decoder, then use
  762. + * avcodec_receive_frame() to receive decoded frames after each packet.
  763. + * Unlike with the old video decoding API, multiple frames might result from
  764. + * a packet. For audio, splitting the input packet into frames by partially
  765. + * decoding packets becomes transparent to the API user. You never need to
  766. + * feed an AVPacket to the API twice (unless it is rejected with AVERROR(EAGAIN) - then
  767. + * no data was read from the packet).
  768. + * Additionally, sending a flush/draining packet is required only once.
  769. + * - avcodec_encode_video2()/avcodec_encode_audio2():
  770. + * Use avcodec_send_frame() to feed input to the encoder, then use
  771. + * avcodec_receive_packet() to receive encoded packets.
  772. + * Providing user-allocated buffers for avcodec_receive_packet() is not
  773. + * possible.
  774. + * - The new API does not handle subtitles yet.
  775. + *
  776. + * Mixing new and old function calls on the same AVCodecContext is not allowed,
  777. + * and will result in undefined behavior.
  778. + *
  779. + * Some codecs might require using the new API; using the old API will return
  780. + * an error when calling it. All codecs support the new API.
  781. + *
  782. + * A codec is not allowed to return AVERROR(EAGAIN) for both sending and receiving. This
  783. + * would be an invalid state, which could put the codec user into an endless
  784. + * loop. The API has no concept of time either: it cannot happen that trying to
  785. + * do avcodec_send_packet() results in AVERROR(EAGAIN), but a repeated call 1 second
  786. + * later accepts the packet (with no other receive/flush API calls involved).
  787. + * The API is a strict state machine, and the passage of time is not supposed
  788. + * to influence it. Some timing-dependent behavior might still be deemed
  789. + * acceptable in certain cases. But it must never result in both send/receive
  790. + * returning EAGAIN at the same time at any point. It must also absolutely be
  791. + * avoided that the current state is "unstable" and can "flip-flop" between
  792. + * the send/receive APIs allowing progress. For example, it's not allowed that
  793. + * the codec randomly decides that it actually wants to consume a packet now
  794. + * instead of returning a frame, after it just returned AVERROR(EAGAIN) on an
  795. + * avcodec_send_packet() call.
  796. + * @}
  797. + */
  798. +
  799. +/**
  800. + * @defgroup lavc_core Core functions/structures.
  801. + * @ingroup libavc
  802. + *
  803. + * Basic definitions, functions for querying libavcodec capabilities,
  804. + * allocating core structures, etc.
  805. + * @{
  806. + */
  807. +
  808. +
  809. +/**
  810. + * Identify the syntax and semantics of the bitstream.
  811. + * The principle is roughly:
  812. + * Two decoders with the same ID can decode the same streams.
  813. + * Two encoders with the same ID can encode compatible streams.
  814. + * There may be slight deviations from the principle due to implementation
  815. + * details.
  816. + *
  817. + * If you add a codec ID to this list, add it so that
  818. + * 1. no value of an existing codec ID changes (that would break ABI),
  819. + * 2. it is as close as possible to similar codecs
  820. + *
  821. + * After adding new codec IDs, do not forget to add an entry to the codec
  822. + * descriptor list and bump libavcodec minor version.
  823. + */
  824. +enum AVCodecID {
  825. + AV_CODEC_ID_NONE,
  826. +
  827. + /* video codecs */
  828. + AV_CODEC_ID_MPEG1VIDEO,
  829. + AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
  830. + AV_CODEC_ID_H261,
  831. + AV_CODEC_ID_H263,
  832. + AV_CODEC_ID_RV10,
  833. + AV_CODEC_ID_RV20,
  834. + AV_CODEC_ID_MJPEG,
  835. + AV_CODEC_ID_MJPEGB,
  836. + AV_CODEC_ID_LJPEG,
  837. + AV_CODEC_ID_SP5X,
  838. + AV_CODEC_ID_JPEGLS,
  839. + AV_CODEC_ID_MPEG4,
  840. + AV_CODEC_ID_RAWVIDEO,
  841. + AV_CODEC_ID_MSMPEG4V1,
  842. + AV_CODEC_ID_MSMPEG4V2,
  843. + AV_CODEC_ID_MSMPEG4V3,
  844. + AV_CODEC_ID_WMV1,
  845. + AV_CODEC_ID_WMV2,
  846. + AV_CODEC_ID_H263P,
  847. + AV_CODEC_ID_H263I,
  848. + AV_CODEC_ID_FLV1,
  849. + AV_CODEC_ID_SVQ1,
  850. + AV_CODEC_ID_SVQ3,
  851. + AV_CODEC_ID_DVVIDEO,
  852. + AV_CODEC_ID_HUFFYUV,
  853. + AV_CODEC_ID_CYUV,
  854. + AV_CODEC_ID_H264,
  855. + AV_CODEC_ID_INDEO3,
  856. + AV_CODEC_ID_VP3,
  857. + AV_CODEC_ID_THEORA,
  858. + AV_CODEC_ID_ASV1,
  859. + AV_CODEC_ID_ASV2,
  860. + AV_CODEC_ID_FFV1,
  861. + AV_CODEC_ID_4XM,
  862. + AV_CODEC_ID_VCR1,
  863. + AV_CODEC_ID_CLJR,
  864. + AV_CODEC_ID_MDEC,
  865. + AV_CODEC_ID_ROQ,
  866. + AV_CODEC_ID_INTERPLAY_VIDEO,
  867. + AV_CODEC_ID_XAN_WC3,
  868. + AV_CODEC_ID_XAN_WC4,
  869. + AV_CODEC_ID_RPZA,
  870. + AV_CODEC_ID_CINEPAK,
  871. + AV_CODEC_ID_WS_VQA,
  872. + AV_CODEC_ID_MSRLE,
  873. + AV_CODEC_ID_MSVIDEO1,
  874. + AV_CODEC_ID_IDCIN,
  875. + AV_CODEC_ID_8BPS,
  876. + AV_CODEC_ID_SMC,
  877. + AV_CODEC_ID_FLIC,
  878. + AV_CODEC_ID_TRUEMOTION1,
  879. + AV_CODEC_ID_VMDVIDEO,
  880. + AV_CODEC_ID_MSZH,
  881. + AV_CODEC_ID_ZLIB,
  882. + AV_CODEC_ID_QTRLE,
  883. + AV_CODEC_ID_TSCC,
  884. + AV_CODEC_ID_ULTI,
  885. + AV_CODEC_ID_QDRAW,
  886. + AV_CODEC_ID_VIXL,
  887. + AV_CODEC_ID_QPEG,
  888. + AV_CODEC_ID_PNG,
  889. + AV_CODEC_ID_PPM,
  890. + AV_CODEC_ID_PBM,
  891. + AV_CODEC_ID_PGM,
  892. + AV_CODEC_ID_PGMYUV,
  893. + AV_CODEC_ID_PAM,
  894. + AV_CODEC_ID_FFVHUFF,
  895. + AV_CODEC_ID_RV30,
  896. + AV_CODEC_ID_RV40,
  897. + AV_CODEC_ID_VC1,
  898. + AV_CODEC_ID_WMV3,
  899. + AV_CODEC_ID_LOCO,
  900. + AV_CODEC_ID_WNV1,
  901. + AV_CODEC_ID_AASC,
  902. + AV_CODEC_ID_INDEO2,
  903. + AV_CODEC_ID_FRAPS,
  904. + AV_CODEC_ID_TRUEMOTION2,
  905. + AV_CODEC_ID_BMP,
  906. + AV_CODEC_ID_CSCD,
  907. + AV_CODEC_ID_MMVIDEO,
  908. + AV_CODEC_ID_ZMBV,
  909. + AV_CODEC_ID_AVS,
  910. + AV_CODEC_ID_SMACKVIDEO,
  911. + AV_CODEC_ID_NUV,
  912. + AV_CODEC_ID_KMVC,
  913. + AV_CODEC_ID_FLASHSV,
  914. + AV_CODEC_ID_CAVS,
  915. + AV_CODEC_ID_JPEG2000,
  916. + AV_CODEC_ID_VMNC,
  917. + AV_CODEC_ID_VP5,
  918. + AV_CODEC_ID_VP6,
  919. + AV_CODEC_ID_VP6F,
  920. + AV_CODEC_ID_TARGA,
  921. + AV_CODEC_ID_DSICINVIDEO,
  922. + AV_CODEC_ID_TIERTEXSEQVIDEO,
  923. + AV_CODEC_ID_TIFF,
  924. + AV_CODEC_ID_GIF,
  925. + AV_CODEC_ID_DXA,
  926. + AV_CODEC_ID_DNXHD,
  927. + AV_CODEC_ID_THP,
  928. + AV_CODEC_ID_SGI,
  929. + AV_CODEC_ID_C93,
  930. + AV_CODEC_ID_BETHSOFTVID,
  931. + AV_CODEC_ID_PTX,
  932. + AV_CODEC_ID_TXD,
  933. + AV_CODEC_ID_VP6A,
  934. + AV_CODEC_ID_AMV,
  935. + AV_CODEC_ID_VB,
  936. + AV_CODEC_ID_PCX,
  937. + AV_CODEC_ID_SUNRAST,
  938. + AV_CODEC_ID_INDEO4,
  939. + AV_CODEC_ID_INDEO5,
  940. + AV_CODEC_ID_MIMIC,
  941. + AV_CODEC_ID_RL2,
  942. + AV_CODEC_ID_ESCAPE124,
  943. + AV_CODEC_ID_DIRAC,
  944. + AV_CODEC_ID_BFI,
  945. + AV_CODEC_ID_CMV,
  946. + AV_CODEC_ID_MOTIONPIXELS,
  947. + AV_CODEC_ID_TGV,
  948. + AV_CODEC_ID_TGQ,
  949. + AV_CODEC_ID_TQI,
  950. + AV_CODEC_ID_AURA,
  951. + AV_CODEC_ID_AURA2,
  952. + AV_CODEC_ID_V210X,
  953. + AV_CODEC_ID_TMV,
  954. + AV_CODEC_ID_V210,
  955. + AV_CODEC_ID_DPX,
  956. + AV_CODEC_ID_MAD,
  957. + AV_CODEC_ID_FRWU,
  958. + AV_CODEC_ID_FLASHSV2,
  959. + AV_CODEC_ID_CDGRAPHICS,
  960. + AV_CODEC_ID_R210,
  961. + AV_CODEC_ID_ANM,
  962. + AV_CODEC_ID_BINKVIDEO,
  963. + AV_CODEC_ID_IFF_ILBM,
  964. +#define AV_CODEC_ID_IFF_BYTERUN1 AV_CODEC_ID_IFF_ILBM
  965. + AV_CODEC_ID_KGV1,
  966. + AV_CODEC_ID_YOP,
  967. + AV_CODEC_ID_VP8,
  968. + AV_CODEC_ID_PICTOR,
  969. + AV_CODEC_ID_ANSI,
  970. + AV_CODEC_ID_A64_MULTI,
  971. + AV_CODEC_ID_A64_MULTI5,
  972. + AV_CODEC_ID_R10K,
  973. + AV_CODEC_ID_MXPEG,
  974. + AV_CODEC_ID_LAGARITH,
  975. + AV_CODEC_ID_PRORES,
  976. + AV_CODEC_ID_JV,
  977. + AV_CODEC_ID_DFA,
  978. + AV_CODEC_ID_WMV3IMAGE,
  979. + AV_CODEC_ID_VC1IMAGE,
  980. + AV_CODEC_ID_UTVIDEO,
  981. + AV_CODEC_ID_BMV_VIDEO,
  982. + AV_CODEC_ID_VBLE,
  983. + AV_CODEC_ID_DXTORY,
  984. + AV_CODEC_ID_V410,
  985. + AV_CODEC_ID_XWD,
  986. + AV_CODEC_ID_CDXL,
  987. + AV_CODEC_ID_XBM,
  988. + AV_CODEC_ID_ZEROCODEC,
  989. + AV_CODEC_ID_MSS1,
  990. + AV_CODEC_ID_MSA1,
  991. + AV_CODEC_ID_TSCC2,
  992. + AV_CODEC_ID_MTS2,
  993. + AV_CODEC_ID_CLLC,
  994. + AV_CODEC_ID_MSS2,
  995. + AV_CODEC_ID_VP9,
  996. + AV_CODEC_ID_AIC,
  997. + AV_CODEC_ID_ESCAPE130,
  998. + AV_CODEC_ID_G2M,
  999. + AV_CODEC_ID_WEBP,
  1000. + AV_CODEC_ID_HNM4_VIDEO,
  1001. + AV_CODEC_ID_HEVC,
  1002. +#define AV_CODEC_ID_H265 AV_CODEC_ID_HEVC
  1003. + AV_CODEC_ID_FIC,
  1004. + AV_CODEC_ID_ALIAS_PIX,
  1005. + AV_CODEC_ID_BRENDER_PIX,
  1006. + AV_CODEC_ID_PAF_VIDEO,
  1007. + AV_CODEC_ID_EXR,
  1008. + AV_CODEC_ID_VP7,
  1009. + AV_CODEC_ID_SANM,
  1010. + AV_CODEC_ID_SGIRLE,
  1011. + AV_CODEC_ID_MVC1,
  1012. + AV_CODEC_ID_MVC2,
  1013. + AV_CODEC_ID_HQX,
  1014. + AV_CODEC_ID_TDSC,
  1015. + AV_CODEC_ID_HQ_HQA,
  1016. + AV_CODEC_ID_HAP,
  1017. + AV_CODEC_ID_DDS,
  1018. + AV_CODEC_ID_DXV,
  1019. + AV_CODEC_ID_SCREENPRESSO,
  1020. + AV_CODEC_ID_RSCC,
  1021. +
  1022. + AV_CODEC_ID_Y41P = 0x8000,
  1023. + AV_CODEC_ID_AVRP,
  1024. + AV_CODEC_ID_012V,
  1025. + AV_CODEC_ID_AVUI,
  1026. + AV_CODEC_ID_AYUV,
  1027. + AV_CODEC_ID_TARGA_Y216,
  1028. + AV_CODEC_ID_V308,
  1029. + AV_CODEC_ID_V408,
  1030. + AV_CODEC_ID_YUV4,
  1031. + AV_CODEC_ID_AVRN,
  1032. + AV_CODEC_ID_CPIA,
  1033. + AV_CODEC_ID_XFACE,
  1034. + AV_CODEC_ID_SNOW,
  1035. + AV_CODEC_ID_SMVJPEG,
  1036. + AV_CODEC_ID_APNG,
  1037. + AV_CODEC_ID_DAALA,
  1038. + AV_CODEC_ID_CFHD,
  1039. + AV_CODEC_ID_TRUEMOTION2RT,
  1040. + AV_CODEC_ID_M101,
  1041. + AV_CODEC_ID_MAGICYUV,
  1042. + AV_CODEC_ID_SHEERVIDEO,
  1043. + AV_CODEC_ID_YLC,
  1044. + AV_CODEC_ID_PSD,
  1045. + AV_CODEC_ID_PIXLET,
  1046. + AV_CODEC_ID_SPEEDHQ,
  1047. + AV_CODEC_ID_FMVC,
  1048. + AV_CODEC_ID_SCPR,
  1049. + AV_CODEC_ID_CLEARVIDEO,
  1050. + AV_CODEC_ID_XPM,
  1051. + AV_CODEC_ID_AV1,
  1052. + AV_CODEC_ID_BITPACKED,
  1053. + AV_CODEC_ID_MSCC,
  1054. + AV_CODEC_ID_SRGC,
  1055. + AV_CODEC_ID_SVG,
  1056. + AV_CODEC_ID_GDV,
  1057. + AV_CODEC_ID_FITS,
  1058. +
  1059. + /* various PCM "codecs" */
  1060. + AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
  1061. + AV_CODEC_ID_PCM_S16LE = 0x10000,
  1062. + AV_CODEC_ID_PCM_S16BE,
  1063. + AV_CODEC_ID_PCM_U16LE,
  1064. + AV_CODEC_ID_PCM_U16BE,
  1065. + AV_CODEC_ID_PCM_S8,
  1066. + AV_CODEC_ID_PCM_U8,
  1067. + AV_CODEC_ID_PCM_MULAW,
  1068. + AV_CODEC_ID_PCM_ALAW,
  1069. + AV_CODEC_ID_PCM_S32LE,
  1070. + AV_CODEC_ID_PCM_S32BE,
  1071. + AV_CODEC_ID_PCM_U32LE,
  1072. + AV_CODEC_ID_PCM_U32BE,
  1073. + AV_CODEC_ID_PCM_S24LE,
  1074. + AV_CODEC_ID_PCM_S24BE,
  1075. + AV_CODEC_ID_PCM_U24LE,
  1076. + AV_CODEC_ID_PCM_U24BE,
  1077. + AV_CODEC_ID_PCM_S24DAUD,
  1078. + AV_CODEC_ID_PCM_ZORK,
  1079. + AV_CODEC_ID_PCM_S16LE_PLANAR,
  1080. + AV_CODEC_ID_PCM_DVD,
  1081. + AV_CODEC_ID_PCM_F32BE,
  1082. + AV_CODEC_ID_PCM_F32LE,
  1083. + AV_CODEC_ID_PCM_F64BE,
  1084. + AV_CODEC_ID_PCM_F64LE,
  1085. + AV_CODEC_ID_PCM_BLURAY,
  1086. + AV_CODEC_ID_PCM_LXF,
  1087. + AV_CODEC_ID_S302M,
  1088. + AV_CODEC_ID_PCM_S8_PLANAR,
  1089. + AV_CODEC_ID_PCM_S24LE_PLANAR,
  1090. + AV_CODEC_ID_PCM_S32LE_PLANAR,
  1091. + AV_CODEC_ID_PCM_S16BE_PLANAR,
  1092. +
  1093. + AV_CODEC_ID_PCM_S64LE = 0x10800,
  1094. + AV_CODEC_ID_PCM_S64BE,
  1095. + AV_CODEC_ID_PCM_F16LE,
  1096. + AV_CODEC_ID_PCM_F24LE,
  1097. +
  1098. + /* various ADPCM codecs */
  1099. + AV_CODEC_ID_ADPCM_IMA_QT = 0x11000,
  1100. + AV_CODEC_ID_ADPCM_IMA_WAV,
  1101. + AV_CODEC_ID_ADPCM_IMA_DK3,
  1102. + AV_CODEC_ID_ADPCM_IMA_DK4,
  1103. + AV_CODEC_ID_ADPCM_IMA_WS,
  1104. + AV_CODEC_ID_ADPCM_IMA_SMJPEG,
  1105. + AV_CODEC_ID_ADPCM_MS,
  1106. + AV_CODEC_ID_ADPCM_4XM,
  1107. + AV_CODEC_ID_ADPCM_XA,
  1108. + AV_CODEC_ID_ADPCM_ADX,
  1109. + AV_CODEC_ID_ADPCM_EA,
  1110. + AV_CODEC_ID_ADPCM_G726,
  1111. + AV_CODEC_ID_ADPCM_CT,
  1112. + AV_CODEC_ID_ADPCM_SWF,
  1113. + AV_CODEC_ID_ADPCM_YAMAHA,
  1114. + AV_CODEC_ID_ADPCM_SBPRO_4,
  1115. + AV_CODEC_ID_ADPCM_SBPRO_3,
  1116. + AV_CODEC_ID_ADPCM_SBPRO_2,
  1117. + AV_CODEC_ID_ADPCM_THP,
  1118. + AV_CODEC_ID_ADPCM_IMA_AMV,
  1119. + AV_CODEC_ID_ADPCM_EA_R1,
  1120. + AV_CODEC_ID_ADPCM_EA_R3,
  1121. + AV_CODEC_ID_ADPCM_EA_R2,
  1122. + AV_CODEC_ID_ADPCM_IMA_EA_SEAD,
  1123. + AV_CODEC_ID_ADPCM_IMA_EA_EACS,
  1124. + AV_CODEC_ID_ADPCM_EA_XAS,
  1125. + AV_CODEC_ID_ADPCM_EA_MAXIS_XA,
  1126. + AV_CODEC_ID_ADPCM_IMA_ISS,
  1127. + AV_CODEC_ID_ADPCM_G722,
  1128. + AV_CODEC_ID_ADPCM_IMA_APC,
  1129. + AV_CODEC_ID_ADPCM_VIMA,
  1130. +
  1131. + AV_CODEC_ID_ADPCM_AFC = 0x11800,
  1132. + AV_CODEC_ID_ADPCM_IMA_OKI,
  1133. + AV_CODEC_ID_ADPCM_DTK,
  1134. + AV_CODEC_ID_ADPCM_IMA_RAD,
  1135. + AV_CODEC_ID_ADPCM_G726LE,
  1136. + AV_CODEC_ID_ADPCM_THP_LE,
  1137. + AV_CODEC_ID_ADPCM_PSX,
  1138. + AV_CODEC_ID_ADPCM_AICA,
  1139. + AV_CODEC_ID_ADPCM_IMA_DAT4,
  1140. + AV_CODEC_ID_ADPCM_MTAF,
  1141. +
  1142. + /* AMR */
  1143. + AV_CODEC_ID_AMR_NB = 0x12000,
  1144. + AV_CODEC_ID_AMR_WB,
  1145. +
  1146. + /* RealAudio codecs*/
  1147. + AV_CODEC_ID_RA_144 = 0x13000,
  1148. + AV_CODEC_ID_RA_288,
  1149. +
  1150. + /* various DPCM codecs */
  1151. + AV_CODEC_ID_ROQ_DPCM = 0x14000,
  1152. + AV_CODEC_ID_INTERPLAY_DPCM,
  1153. + AV_CODEC_ID_XAN_DPCM,
  1154. + AV_CODEC_ID_SOL_DPCM,
  1155. +
  1156. + AV_CODEC_ID_SDX2_DPCM = 0x14800,
  1157. + AV_CODEC_ID_GREMLIN_DPCM,
  1158. +
  1159. + /* audio codecs */
  1160. + AV_CODEC_ID_MP2 = 0x15000,
  1161. + AV_CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
  1162. + AV_CODEC_ID_AAC,
  1163. + AV_CODEC_ID_AC3,
  1164. + AV_CODEC_ID_DTS,
  1165. + AV_CODEC_ID_VORBIS,
  1166. + AV_CODEC_ID_DVAUDIO,
  1167. + AV_CODEC_ID_WMAV1,
  1168. + AV_CODEC_ID_WMAV2,
  1169. + AV_CODEC_ID_MACE3,
  1170. + AV_CODEC_ID_MACE6,
  1171. + AV_CODEC_ID_VMDAUDIO,
  1172. + AV_CODEC_ID_FLAC,
  1173. + AV_CODEC_ID_MP3ADU,
  1174. + AV_CODEC_ID_MP3ON4,
  1175. + AV_CODEC_ID_SHORTEN,
  1176. + AV_CODEC_ID_ALAC,
  1177. + AV_CODEC_ID_WESTWOOD_SND1,
  1178. + AV_CODEC_ID_GSM, ///< as in Berlin toast format
  1179. + AV_CODEC_ID_QDM2,
  1180. + AV_CODEC_ID_COOK,
  1181. + AV_CODEC_ID_TRUESPEECH,
  1182. + AV_CODEC_ID_TTA,
  1183. + AV_CODEC_ID_SMACKAUDIO,
  1184. + AV_CODEC_ID_QCELP,
  1185. + AV_CODEC_ID_WAVPACK,
  1186. + AV_CODEC_ID_DSICINAUDIO,
  1187. + AV_CODEC_ID_IMC,
  1188. + AV_CODEC_ID_MUSEPACK7,
  1189. + AV_CODEC_ID_MLP,
  1190. + AV_CODEC_ID_GSM_MS, /* as found in WAV */
  1191. + AV_CODEC_ID_ATRAC3,
  1192. + AV_CODEC_ID_APE,
  1193. + AV_CODEC_ID_NELLYMOSER,
  1194. + AV_CODEC_ID_MUSEPACK8,
  1195. + AV_CODEC_ID_SPEEX,
  1196. + AV_CODEC_ID_WMAVOICE,
  1197. + AV_CODEC_ID_WMAPRO,
  1198. + AV_CODEC_ID_WMALOSSLESS,
  1199. + AV_CODEC_ID_ATRAC3P,
  1200. + AV_CODEC_ID_EAC3,
  1201. + AV_CODEC_ID_SIPR,
  1202. + AV_CODEC_ID_MP1,
  1203. + AV_CODEC_ID_TWINVQ,
  1204. + AV_CODEC_ID_TRUEHD,
  1205. + AV_CODEC_ID_MP4ALS,
  1206. + AV_CODEC_ID_ATRAC1,
  1207. + AV_CODEC_ID_BINKAUDIO_RDFT,
  1208. + AV_CODEC_ID_BINKAUDIO_DCT,
  1209. + AV_CODEC_ID_AAC_LATM,
  1210. + AV_CODEC_ID_QDMC,
  1211. + AV_CODEC_ID_CELT,
  1212. + AV_CODEC_ID_G723_1,
  1213. + AV_CODEC_ID_G729,
  1214. + AV_CODEC_ID_8SVX_EXP,
  1215. + AV_CODEC_ID_8SVX_FIB,
  1216. + AV_CODEC_ID_BMV_AUDIO,
  1217. + AV_CODEC_ID_RALF,
  1218. + AV_CODEC_ID_IAC,
  1219. + AV_CODEC_ID_ILBC,
  1220. + AV_CODEC_ID_OPUS,
  1221. + AV_CODEC_ID_COMFORT_NOISE,
  1222. + AV_CODEC_ID_TAK,
  1223. + AV_CODEC_ID_METASOUND,
  1224. + AV_CODEC_ID_PAF_AUDIO,
  1225. + AV_CODEC_ID_ON2AVC,
  1226. + AV_CODEC_ID_DSS_SP,
  1227. + AV_CODEC_ID_CODEC2,
  1228. +
  1229. + AV_CODEC_ID_FFWAVESYNTH = 0x15800,
  1230. + AV_CODEC_ID_SONIC,
  1231. + AV_CODEC_ID_SONIC_LS,
  1232. + AV_CODEC_ID_EVRC,
  1233. + AV_CODEC_ID_SMV,
  1234. + AV_CODEC_ID_DSD_LSBF,
  1235. + AV_CODEC_ID_DSD_MSBF,
  1236. + AV_CODEC_ID_DSD_LSBF_PLANAR,
  1237. + AV_CODEC_ID_DSD_MSBF_PLANAR,
  1238. + AV_CODEC_ID_4GV,
  1239. + AV_CODEC_ID_INTERPLAY_ACM,
  1240. + AV_CODEC_ID_XMA1,
  1241. + AV_CODEC_ID_XMA2,
  1242. + AV_CODEC_ID_DST,
  1243. + AV_CODEC_ID_ATRAC3AL,
  1244. + AV_CODEC_ID_ATRAC3PAL,
  1245. + AV_CODEC_ID_DOLBY_E,
  1246. + AV_CODEC_ID_APTX,
  1247. + AV_CODEC_ID_APTX_HD,
  1248. + AV_CODEC_ID_SBC,
  1249. +
  1250. + /* subtitle codecs */
  1251. + AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
  1252. + AV_CODEC_ID_DVD_SUBTITLE = 0x17000,
  1253. + AV_CODEC_ID_DVB_SUBTITLE,
  1254. + AV_CODEC_ID_TEXT, ///< raw UTF-8 text
  1255. + AV_CODEC_ID_XSUB,
  1256. + AV_CODEC_ID_SSA,
  1257. + AV_CODEC_ID_MOV_TEXT,
  1258. + AV_CODEC_ID_HDMV_PGS_SUBTITLE,
  1259. + AV_CODEC_ID_DVB_TELETEXT,
  1260. + AV_CODEC_ID_SRT,
  1261. +
  1262. + AV_CODEC_ID_MICRODVD = 0x17800,
  1263. + AV_CODEC_ID_EIA_608,
  1264. + AV_CODEC_ID_JACOSUB,
  1265. + AV_CODEC_ID_SAMI,
  1266. + AV_CODEC_ID_REALTEXT,
  1267. + AV_CODEC_ID_STL,
  1268. + AV_CODEC_ID_SUBVIEWER1,
  1269. + AV_CODEC_ID_SUBVIEWER,
  1270. + AV_CODEC_ID_SUBRIP,
  1271. + AV_CODEC_ID_WEBVTT,
  1272. + AV_CODEC_ID_MPL2,
  1273. + AV_CODEC_ID_VPLAYER,
  1274. + AV_CODEC_ID_PJS,
  1275. + AV_CODEC_ID_ASS,
  1276. + AV_CODEC_ID_HDMV_TEXT_SUBTITLE,
  1277. +
  1278. + /* other specific kind of codecs (generally used for attachments) */
  1279. + AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
  1280. + AV_CODEC_ID_TTF = 0x18000,
  1281. +
  1282. + AV_CODEC_ID_SCTE_35, ///< Contain timestamp estimated through PCR of program stream.
  1283. + AV_CODEC_ID_BINTEXT = 0x18800,
  1284. + AV_CODEC_ID_XBIN,
  1285. + AV_CODEC_ID_IDF,
  1286. + AV_CODEC_ID_OTF,
  1287. + AV_CODEC_ID_SMPTE_KLV,
  1288. + AV_CODEC_ID_DVD_NAV,
  1289. + AV_CODEC_ID_TIMED_ID3,
  1290. + AV_CODEC_ID_BIN_DATA,
  1291. +
  1292. +
  1293. + AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it
  1294. +
  1295. + AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
  1296. + * stream (only used by libavformat) */
  1297. + AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems
  1298. + * stream (only used by libavformat) */
  1299. + AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information.
  1300. + AV_CODEC_ID_WRAPPED_AVFRAME = 0x21001, ///< Passthrough codec, AVFrames wrapped in AVPacket
  1301. +};
  1302. +
  1303. +/**
  1304. + * This struct describes the properties of a single codec described by an
  1305. + * AVCodecID.
  1306. + * @see avcodec_descriptor_get()
  1307. + */
  1308. +typedef struct AVCodecDescriptor {
  1309. + enum AVCodecID id;
  1310. + enum AVMediaType type;
  1311. + /**
  1312. + * Name of the codec described by this descriptor. It is non-empty and
  1313. + * unique for each codec descriptor. It should contain alphanumeric
  1314. + * characters and '_' only.
  1315. + */
  1316. + const char *name;
  1317. + /**
  1318. + * A more descriptive name for this codec. May be NULL.
  1319. + */
  1320. + const char *long_name;
  1321. + /**
  1322. + * Codec properties, a combination of AV_CODEC_PROP_* flags.
  1323. + */
  1324. + int props;
  1325. + /**
  1326. + * MIME type(s) associated with the codec.
  1327. + * May be NULL; if not, a NULL-terminated array of MIME types.
  1328. + * The first item is always non-NULL and is the preferred MIME type.
  1329. + */
  1330. + const char *const *mime_types;
  1331. + /**
  1332. + * If non-NULL, an array of profiles recognized for this codec.
  1333. + * Terminated with FF_PROFILE_UNKNOWN.
  1334. + */
  1335. + const struct AVProfile *profiles;
  1336. +} AVCodecDescriptor;
  1337. +
  1338. +/**
  1339. + * Codec uses only intra compression.
  1340. + * Video and audio codecs only.
  1341. + */
  1342. +#define AV_CODEC_PROP_INTRA_ONLY (1 << 0)
  1343. +/**
  1344. + * Codec supports lossy compression. Audio and video codecs only.
  1345. + * @note a codec may support both lossy and lossless
  1346. + * compression modes
  1347. + */
  1348. +#define AV_CODEC_PROP_LOSSY (1 << 1)
  1349. +/**
  1350. + * Codec supports lossless compression. Audio and video codecs only.
  1351. + */
  1352. +#define AV_CODEC_PROP_LOSSLESS (1 << 2)
  1353. +/**
  1354. + * Codec supports frame reordering. That is, the coded order (the order in which
  1355. + * the encoded packets are output by the encoders / stored / input to the
  1356. + * decoders) may be different from the presentation order of the corresponding
  1357. + * frames.
  1358. + *
  1359. + * For codecs that do not have this property set, PTS and DTS should always be
  1360. + * equal.
  1361. + */
  1362. +#define AV_CODEC_PROP_REORDER (1 << 3)
  1363. +/**
  1364. + * Subtitle codec is bitmap based
  1365. + * Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field.
  1366. + */
  1367. +#define AV_CODEC_PROP_BITMAP_SUB (1 << 16)
  1368. +/**
  1369. + * Subtitle codec is text based.
  1370. + * Decoded AVSubtitle data can be read from the AVSubtitleRect->ass field.
  1371. + */
  1372. +#define AV_CODEC_PROP_TEXT_SUB (1 << 17)
  1373. +
  1374. +/**
  1375. + * @ingroup lavc_decoding
  1376. + * Required number of additionally allocated bytes at the end of the input bitstream for decoding.
  1377. + * This is mainly needed because some optimized bitstream readers read
  1378. + * 32 or 64 bit at once and could read over the end.<br>
  1379. + * Note: If the first 23 bits of the additional bytes are not 0, then damaged
  1380. + * MPEG bitstreams could cause overread and segfault.
  1381. + */
  1382. +#define AV_INPUT_BUFFER_PADDING_SIZE 64
  1383. +
  1384. +/**
  1385. + * @ingroup lavc_encoding
  1386. + * minimum encoding buffer size
  1387. + * Used to avoid some checks during header writing.
  1388. + */
  1389. +#define AV_INPUT_BUFFER_MIN_SIZE 16384
  1390. +
  1391. +/**
  1392. + * @ingroup lavc_decoding
  1393. + */
  1394. +enum AVDiscard{
  1395. + /* We leave some space between them for extensions (drop some
  1396. + * keyframes for intra-only or drop just some bidir frames). */
  1397. + AVDISCARD_NONE =-16, ///< discard nothing
  1398. + AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi
  1399. + AVDISCARD_NONREF = 8, ///< discard all non reference
  1400. + AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames
  1401. + AVDISCARD_NONINTRA= 24, ///< discard all non intra frames
  1402. + AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes
  1403. + AVDISCARD_ALL = 48, ///< discard all
  1404. +};
  1405. +
  1406. +enum AVAudioServiceType {
  1407. + AV_AUDIO_SERVICE_TYPE_MAIN = 0,
  1408. + AV_AUDIO_SERVICE_TYPE_EFFECTS = 1,
  1409. + AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2,
  1410. + AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3,
  1411. + AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4,
  1412. + AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5,
  1413. + AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6,
  1414. + AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7,
  1415. + AV_AUDIO_SERVICE_TYPE_KARAOKE = 8,
  1416. + AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI
  1417. +};
  1418. +
  1419. +/**
  1420. + * @ingroup lavc_encoding
  1421. + */
  1422. +typedef struct RcOverride{
  1423. + int start_frame;
  1424. + int end_frame;
  1425. + int qscale; // If this is 0 then quality_factor will be used instead.
  1426. + float quality_factor;
  1427. +} RcOverride;
  1428. +
  1429. +/* encoding support
  1430. + These flags can be passed in AVCodecContext.flags before initialization.
  1431. + Note: Not everything is supported yet.
  1432. +*/
  1433. +
  1434. +/**
  1435. + * Allow decoders to produce frames with data planes that are not aligned
  1436. + * to CPU requirements (e.g. due to cropping).
  1437. + */
  1438. +#define AV_CODEC_FLAG_UNALIGNED (1 << 0)
  1439. +/**
  1440. + * Use fixed qscale.
  1441. + */
  1442. +#define AV_CODEC_FLAG_QSCALE (1 << 1)
  1443. +/**
  1444. + * 4 MV per MB allowed / advanced prediction for H.263.
  1445. + */
  1446. +#define AV_CODEC_FLAG_4MV (1 << 2)
  1447. +/**
  1448. + * Output even those frames that might be corrupted.
  1449. + */
  1450. +#define AV_CODEC_FLAG_OUTPUT_CORRUPT (1 << 3)
  1451. +/**
  1452. + * Use qpel MC.
  1453. + */
  1454. +#define AV_CODEC_FLAG_QPEL (1 << 4)
  1455. +/**
  1456. + * Use internal 2pass ratecontrol in first pass mode.
  1457. + */
  1458. +#define AV_CODEC_FLAG_PASS1 (1 << 9)
  1459. +/**
  1460. + * Use internal 2pass ratecontrol in second pass mode.
  1461. + */
  1462. +#define AV_CODEC_FLAG_PASS2 (1 << 10)
  1463. +/**
  1464. + * loop filter.
  1465. + */
  1466. +#define AV_CODEC_FLAG_LOOP_FILTER (1 << 11)
  1467. +/**
  1468. + * Only decode/encode grayscale.
  1469. + */
  1470. +#define AV_CODEC_FLAG_GRAY (1 << 13)
  1471. +/**
  1472. + * error[?] variables will be set during encoding.
  1473. + */
  1474. +#define AV_CODEC_FLAG_PSNR (1 << 15)
  1475. +/**
  1476. + * Input bitstream might be truncated at a random location
  1477. + * instead of only at frame boundaries.
  1478. + */
  1479. +#define AV_CODEC_FLAG_TRUNCATED (1 << 16)
  1480. +/**
  1481. + * Use interlaced DCT.
  1482. + */
  1483. +#define AV_CODEC_FLAG_INTERLACED_DCT (1 << 18)
  1484. +/**
  1485. + * Force low delay.
  1486. + */
  1487. +#define AV_CODEC_FLAG_LOW_DELAY (1 << 19)
  1488. +/**
  1489. + * Place global headers in extradata instead of every keyframe.
  1490. + */
  1491. +#define AV_CODEC_FLAG_GLOBAL_HEADER (1 << 22)
  1492. +/**
  1493. + * Use only bitexact stuff (except (I)DCT).
  1494. + */
  1495. +#define AV_CODEC_FLAG_BITEXACT (1 << 23)
  1496. +/* Fx : Flag for H.263+ extra options */
  1497. +/**
  1498. + * H.263 advanced intra coding / MPEG-4 AC prediction
  1499. + */
  1500. +#define AV_CODEC_FLAG_AC_PRED (1 << 24)
  1501. +/**
  1502. + * interlaced motion estimation
  1503. + */
  1504. +#define AV_CODEC_FLAG_INTERLACED_ME (1 << 29)
  1505. +#define AV_CODEC_FLAG_CLOSED_GOP (1U << 31)
  1506. +
  1507. +/**
  1508. + * Allow non spec compliant speedup tricks.
  1509. + */
  1510. +#define AV_CODEC_FLAG2_FAST (1 << 0)
  1511. +/**
  1512. + * Skip bitstream encoding.
  1513. + */
  1514. +#define AV_CODEC_FLAG2_NO_OUTPUT (1 << 2)
  1515. +/**
  1516. + * Place global headers at every keyframe instead of in extradata.
  1517. + */
  1518. +#define AV_CODEC_FLAG2_LOCAL_HEADER (1 << 3)
  1519. +
  1520. +/**
  1521. + * timecode is in drop frame format. DEPRECATED!!!!
  1522. + */
  1523. +#define AV_CODEC_FLAG2_DROP_FRAME_TIMECODE (1 << 13)
  1524. +
  1525. +/**
  1526. + * Input bitstream might be truncated at a packet boundaries
  1527. + * instead of only at frame boundaries.
  1528. + */
  1529. +#define AV_CODEC_FLAG2_CHUNKS (1 << 15)
  1530. +/**
  1531. + * Discard cropping information from SPS.
  1532. + */
  1533. +#define AV_CODEC_FLAG2_IGNORE_CROP (1 << 16)
  1534. +
  1535. +/**
  1536. + * Show all frames before the first keyframe
  1537. + */
  1538. +#define AV_CODEC_FLAG2_SHOW_ALL (1 << 22)
  1539. +/**
  1540. + * Export motion vectors through frame side data
  1541. + */
  1542. +#define AV_CODEC_FLAG2_EXPORT_MVS (1 << 28)
  1543. +/**
  1544. + * Do not skip samples and export skip information as frame side data
  1545. + */
  1546. +#define AV_CODEC_FLAG2_SKIP_MANUAL (1 << 29)
  1547. +/**
  1548. + * Do not reset ASS ReadOrder field on flush (subtitles decoding)
  1549. + */
  1550. +#define AV_CODEC_FLAG2_RO_FLUSH_NOOP (1 << 30)
  1551. +
  1552. +/* Unsupported options :
  1553. + * Syntax Arithmetic coding (SAC)
  1554. + * Reference Picture Selection
  1555. + * Independent Segment Decoding */
  1556. +/* /Fx */
  1557. +/* codec capabilities */
  1558. +
  1559. +/**
  1560. + * Decoder can use draw_horiz_band callback.
  1561. + */
  1562. +#define AV_CODEC_CAP_DRAW_HORIZ_BAND (1 << 0)
  1563. +/**
  1564. + * Codec uses get_buffer() for allocating buffers and supports custom allocators.
  1565. + * If not set, it might not use get_buffer() at all or use operations that
  1566. + * assume the buffer was allocated by avcodec_default_get_buffer.
  1567. + */
  1568. +#define AV_CODEC_CAP_DR1 (1 << 1)
  1569. +#define AV_CODEC_CAP_TRUNCATED (1 << 3)
  1570. +/**
  1571. + * Encoder or decoder requires flushing with NULL input at the end in order to
  1572. + * give the complete and correct output.
  1573. + *
  1574. + * NOTE: If this flag is not set, the codec is guaranteed to never be fed with
  1575. + * with NULL data. The user can still send NULL data to the public encode
  1576. + * or decode function, but libavcodec will not pass it along to the codec
  1577. + * unless this flag is set.
  1578. + *
  1579. + * Decoders:
  1580. + * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL,
  1581. + * avpkt->size=0 at the end to get the delayed data until the decoder no longer
  1582. + * returns frames.
  1583. + *
  1584. + * Encoders:
  1585. + * The encoder needs to be fed with NULL data at the end of encoding until the
  1586. + * encoder no longer returns data.
  1587. + *
  1588. + * NOTE: For encoders implementing the AVCodec.encode2() function, setting this
  1589. + * flag also means that the encoder must set the pts and duration for
  1590. + * each output packet. If this flag is not set, the pts and duration will
  1591. + * be determined by libavcodec from the input frame.
  1592. + */
  1593. +#define AV_CODEC_CAP_DELAY (1 << 5)
  1594. +/**
  1595. + * Codec can be fed a final frame with a smaller size.
  1596. + * This can be used to prevent truncation of the last audio samples.
  1597. + */
  1598. +#define AV_CODEC_CAP_SMALL_LAST_FRAME (1 << 6)
  1599. +
  1600. +/**
  1601. + * Codec can output multiple frames per AVPacket
  1602. + * Normally demuxers return one frame at a time, demuxers which do not do
  1603. + * are connected to a parser to split what they return into proper frames.
  1604. + * This flag is reserved to the very rare category of codecs which have a
  1605. + * bitstream that cannot be split into frames without timeconsuming
  1606. + * operations like full decoding. Demuxers carrying such bitstreams thus
  1607. + * may return multiple frames in a packet. This has many disadvantages like
  1608. + * prohibiting stream copy in many cases thus it should only be considered
  1609. + * as a last resort.
  1610. + */
  1611. +#define AV_CODEC_CAP_SUBFRAMES (1 << 8)
  1612. +/**
  1613. + * Codec is experimental and is thus avoided in favor of non experimental
  1614. + * encoders
  1615. + */
  1616. +#define AV_CODEC_CAP_EXPERIMENTAL (1 << 9)
  1617. +/**
  1618. + * Codec should fill in channel configuration and samplerate instead of container
  1619. + */
  1620. +#define AV_CODEC_CAP_CHANNEL_CONF (1 << 10)
  1621. +/**
  1622. + * Codec supports frame-level multithreading.
  1623. + */
  1624. +#define AV_CODEC_CAP_FRAME_THREADS (1 << 12)
  1625. +/**
  1626. + * Codec supports slice-based (or partition-based) multithreading.
  1627. + */
  1628. +#define AV_CODEC_CAP_SLICE_THREADS (1 << 13)
  1629. +/**
  1630. + * Codec supports changed parameters at any point.
  1631. + */
  1632. +#define AV_CODEC_CAP_PARAM_CHANGE (1 << 14)
  1633. +/**
  1634. + * Codec supports avctx->thread_count == 0 (auto).
  1635. + */
  1636. +#define AV_CODEC_CAP_AUTO_THREADS (1 << 15)
  1637. +/**
  1638. + * Audio encoder supports receiving a different number of samples in each call.
  1639. + */
  1640. +#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE (1 << 16)
  1641. +/**
  1642. + * Decoder is not a preferred choice for probing.
  1643. + * This indicates that the decoder is not a good choice for probing.
  1644. + * It could for example be an expensive to spin up hardware decoder,
  1645. + * or it could simply not provide a lot of useful information about
  1646. + * the stream.
  1647. + * A decoder marked with this flag should only be used as last resort
  1648. + * choice for probing.
  1649. + */
  1650. +#define AV_CODEC_CAP_AVOID_PROBING (1 << 17)
  1651. +/**
  1652. + * Codec is intra only.
  1653. + */
  1654. +#define AV_CODEC_CAP_INTRA_ONLY 0x40000000
  1655. +/**
  1656. + * Codec is lossless.
  1657. + */
  1658. +#define AV_CODEC_CAP_LOSSLESS 0x80000000
  1659. +
  1660. +/**
  1661. + * Codec is backed by a hardware implementation. Typically used to
  1662. + * identify a non-hwaccel hardware decoder. For information about hwaccels, use
  1663. + * avcodec_get_hw_config() instead.
  1664. + */
  1665. +#define AV_CODEC_CAP_HARDWARE (1 << 18)
  1666. +
  1667. +/**
  1668. + * Codec is potentially backed by a hardware implementation, but not
  1669. + * necessarily. This is used instead of AV_CODEC_CAP_HARDWARE, if the
  1670. + * implementation provides some sort of internal fallback.
  1671. + */
  1672. +#define AV_CODEC_CAP_HYBRID (1 << 19)
  1673. +
  1674. +/**
  1675. + * Pan Scan area.
  1676. + * This specifies the area which should be displayed.
  1677. + * Note there may be multiple such areas for one frame.
  1678. + */
  1679. +typedef struct AVPanScan {
  1680. + /**
  1681. + * id
  1682. + * - encoding: Set by user.
  1683. + * - decoding: Set by libavcodec.
  1684. + */
  1685. + int id;
  1686. +
  1687. + /**
  1688. + * width and height in 1/16 pel
  1689. + * - encoding: Set by user.
  1690. + * - decoding: Set by libavcodec.
  1691. + */
  1692. + int width;
  1693. + int height;
  1694. +
  1695. + /**
  1696. + * position of the top left corner in 1/16 pel for up to 3 fields/frames
  1697. + * - encoding: Set by user.
  1698. + * - decoding: Set by libavcodec.
  1699. + */
  1700. + int16_t position[3][2];
  1701. +} AVPanScan;
  1702. +
  1703. +/**
  1704. + * This structure describes the bitrate properties of an encoded bitstream. It
  1705. + * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD
  1706. + * parameters for H.264/HEVC.
  1707. + */
  1708. +typedef struct AVCPBProperties {
  1709. + /**
  1710. + * Maximum bitrate of the stream, in bits per second.
  1711. + * Zero if unknown or unspecified.
  1712. + */
  1713. + int max_bitrate;
  1714. + /**
  1715. + * Minimum bitrate of the stream, in bits per second.
  1716. + * Zero if unknown or unspecified.
  1717. + */
  1718. + int min_bitrate;
  1719. + /**
  1720. + * Average bitrate of the stream, in bits per second.
  1721. + * Zero if unknown or unspecified.
  1722. + */
  1723. + int avg_bitrate;
  1724. +
  1725. + /**
  1726. + * The size of the buffer to which the ratecontrol is applied, in bits.
  1727. + * Zero if unknown or unspecified.
  1728. + */
  1729. + int buffer_size;
  1730. +
  1731. + /**
  1732. + * The delay between the time the packet this structure is associated with
  1733. + * is received and the time when it should be decoded, in periods of a 27MHz
  1734. + * clock.
  1735. + *
  1736. + * UINT64_MAX when unknown or unspecified.
  1737. + */
  1738. + uint64_t vbv_delay;
  1739. +} AVCPBProperties;
  1740. +
  1741. +/**
  1742. + * The decoder will keep a reference to the frame and may reuse it later.
  1743. + */
  1744. +#define AV_GET_BUFFER_FLAG_REF (1 << 0)
  1745. +
  1746. +/**
  1747. + * @defgroup lavc_packet AVPacket
  1748. + *
  1749. + * Types and functions for working with AVPacket.
  1750. + * @{
  1751. + */
  1752. +enum AVPacketSideDataType {
  1753. + /**
  1754. + * An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE
  1755. + * bytes worth of palette. This side data signals that a new palette is
  1756. + * present.
  1757. + */
  1758. + AV_PKT_DATA_PALETTE,
  1759. +
  1760. + /**
  1761. + * The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format
  1762. + * that the extradata buffer was changed and the receiving side should
  1763. + * act upon it appropriately. The new extradata is embedded in the side
  1764. + * data buffer and should be immediately used for processing the current
  1765. + * frame or packet.
  1766. + */
  1767. + AV_PKT_DATA_NEW_EXTRADATA,
  1768. +
  1769. + /**
  1770. + * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
  1771. + * @code
  1772. + * u32le param_flags
  1773. + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT)
  1774. + * s32le channel_count
  1775. + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT)
  1776. + * u64le channel_layout
  1777. + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE)
  1778. + * s32le sample_rate
  1779. + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS)
  1780. + * s32le width
  1781. + * s32le height
  1782. + * @endcode
  1783. + */
  1784. + AV_PKT_DATA_PARAM_CHANGE,
  1785. +
  1786. + /**
  1787. + * An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of
  1788. + * structures with info about macroblocks relevant to splitting the
  1789. + * packet into smaller packets on macroblock edges (e.g. as for RFC 2190).
  1790. + * That is, it does not necessarily contain info about all macroblocks,
  1791. + * as long as the distance between macroblocks in the info is smaller
  1792. + * than the target payload size.
  1793. + * Each MB info structure is 12 bytes, and is laid out as follows:
  1794. + * @code
  1795. + * u32le bit offset from the start of the packet
  1796. + * u8 current quantizer at the start of the macroblock
  1797. + * u8 GOB number
  1798. + * u16le macroblock address within the GOB
  1799. + * u8 horizontal MV predictor
  1800. + * u8 vertical MV predictor
  1801. + * u8 horizontal MV predictor for block number 3
  1802. + * u8 vertical MV predictor for block number 3
  1803. + * @endcode
  1804. + */
  1805. + AV_PKT_DATA_H263_MB_INFO,
  1806. +
  1807. + /**
  1808. + * This side data should be associated with an audio stream and contains
  1809. + * ReplayGain information in form of the AVReplayGain struct.
  1810. + */
  1811. + AV_PKT_DATA_REPLAYGAIN,
  1812. +
  1813. + /**
  1814. + * This side data contains a 3x3 transformation matrix describing an affine
  1815. + * transformation that needs to be applied to the decoded video frames for
  1816. + * correct presentation.
  1817. + *
  1818. + * See libavutil/display.h for a detailed description of the data.
  1819. + */
  1820. + AV_PKT_DATA_DISPLAYMATRIX,
  1821. +
  1822. + /**
  1823. + * This side data should be associated with a video stream and contains
  1824. + * Stereoscopic 3D information in form of the AVStereo3D struct.
  1825. + */
  1826. + AV_PKT_DATA_STEREO3D,
  1827. +
  1828. + /**
  1829. + * This side data should be associated with an audio stream and corresponds
  1830. + * to enum AVAudioServiceType.
  1831. + */
  1832. + AV_PKT_DATA_AUDIO_SERVICE_TYPE,
  1833. +
  1834. + /**
  1835. + * This side data contains quality related information from the encoder.
  1836. + * @code
  1837. + * u32le quality factor of the compressed frame. Allowed range is between 1 (good) and FF_LAMBDA_MAX (bad).
  1838. + * u8 picture type
  1839. + * u8 error count
  1840. + * u16 reserved
  1841. + * u64le[error count] sum of squared differences between encoder in and output
  1842. + * @endcode
  1843. + */
  1844. + AV_PKT_DATA_QUALITY_STATS,
  1845. +
  1846. + /**
  1847. + * This side data contains an integer value representing the stream index
  1848. + * of a "fallback" track. A fallback track indicates an alternate
  1849. + * track to use when the current track can not be decoded for some reason.
  1850. + * e.g. no decoder available for codec.
  1851. + */
  1852. + AV_PKT_DATA_FALLBACK_TRACK,
  1853. +
  1854. + /**
  1855. + * This side data corresponds to the AVCPBProperties struct.
  1856. + */
  1857. + AV_PKT_DATA_CPB_PROPERTIES,
  1858. +
  1859. + /**
  1860. + * Recommmends skipping the specified number of samples
  1861. + * @code
  1862. + * u32le number of samples to skip from start of this packet
  1863. + * u32le number of samples to skip from end of this packet
  1864. + * u8 reason for start skip
  1865. + * u8 reason for end skip (0=padding silence, 1=convergence)
  1866. + * @endcode
  1867. + */
  1868. + AV_PKT_DATA_SKIP_SAMPLES,
  1869. +
  1870. + /**
  1871. + * An AV_PKT_DATA_JP_DUALMONO side data packet indicates that
  1872. + * the packet may contain "dual mono" audio specific to Japanese DTV
  1873. + * and if it is true, recommends only the selected channel to be used.
  1874. + * @code
  1875. + * u8 selected channels (0=mail/left, 1=sub/right, 2=both)
  1876. + * @endcode
  1877. + */
  1878. + AV_PKT_DATA_JP_DUALMONO,
  1879. +
  1880. + /**
  1881. + * A list of zero terminated key/value strings. There is no end marker for
  1882. + * the list, so it is required to rely on the side data size to stop.
  1883. + */
  1884. + AV_PKT_DATA_STRINGS_METADATA,
  1885. +
  1886. + /**
  1887. + * Subtitle event position
  1888. + * @code
  1889. + * u32le x1
  1890. + * u32le y1
  1891. + * u32le x2
  1892. + * u32le y2
  1893. + * @endcode
  1894. + */
  1895. + AV_PKT_DATA_SUBTITLE_POSITION,
  1896. +
  1897. + /**
  1898. + * Data found in BlockAdditional element of matroska container. There is
  1899. + * no end marker for the data, so it is required to rely on the side data
  1900. + * size to recognize the end. 8 byte id (as found in BlockAddId) followed
  1901. + * by data.
  1902. + */
  1903. + AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
  1904. +
  1905. + /**
  1906. + * The optional first identifier line of a WebVTT cue.
  1907. + */
  1908. + AV_PKT_DATA_WEBVTT_IDENTIFIER,
  1909. +
  1910. + /**
  1911. + * The optional settings (rendering instructions) that immediately
  1912. + * follow the timestamp specifier of a WebVTT cue.
  1913. + */
  1914. + AV_PKT_DATA_WEBVTT_SETTINGS,
  1915. +
  1916. + /**
  1917. + * A list of zero terminated key/value strings. There is no end marker for
  1918. + * the list, so it is required to rely on the side data size to stop. This
  1919. + * side data includes updated metadata which appeared in the stream.
  1920. + */
  1921. + AV_PKT_DATA_METADATA_UPDATE,
  1922. +
  1923. + /**
  1924. + * MPEGTS stream ID, this is required to pass the stream ID
  1925. + * information from the demuxer to the corresponding muxer.
  1926. + */
  1927. + AV_PKT_DATA_MPEGTS_STREAM_ID,
  1928. +
  1929. + /**
  1930. + * Mastering display metadata (based on SMPTE-2086:2014). This metadata
  1931. + * should be associated with a video stream and contains data in the form
  1932. + * of the AVMasteringDisplayMetadata struct.
  1933. + */
  1934. + AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
  1935. +
  1936. + /**
  1937. + * This side data should be associated with a video stream and corresponds
  1938. + * to the AVSphericalMapping structure.
  1939. + */
  1940. + AV_PKT_DATA_SPHERICAL,
  1941. +
  1942. + /**
  1943. + * Content light level (based on CTA-861.3). This metadata should be
  1944. + * associated with a video stream and contains data in the form of the
  1945. + * AVContentLightMetadata struct.
  1946. + */
  1947. + AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
  1948. +
  1949. + /**
  1950. + * ATSC A53 Part 4 Closed Captions. This metadata should be associated with
  1951. + * a video stream. A53 CC bitstream is stored as uint8_t in AVPacketSideData.data.
  1952. + * The number of bytes of CC data is AVPacketSideData.size.
  1953. + */
  1954. + AV_PKT_DATA_A53_CC,
  1955. +
  1956. + /**
  1957. + * This side data is encryption initialization data.
  1958. + * The format is not part of ABI, use av_encryption_init_info_* methods to
  1959. + * access.
  1960. + */
  1961. + AV_PKT_DATA_ENCRYPTION_INIT_INFO,
  1962. +
  1963. + /**
  1964. + * This side data contains encryption info for how to decrypt the packet.
  1965. + * The format is not part of ABI, use av_encryption_info_* methods to access.
  1966. + */
  1967. + AV_PKT_DATA_ENCRYPTION_INFO,
  1968. +
  1969. + /**
  1970. + * The number of side data types.
  1971. + * This is not part of the public API/ABI in the sense that it may
  1972. + * change when new side data types are added.
  1973. + * This must stay the last enum value.
  1974. + * If its value becomes huge, some code using it
  1975. + * needs to be updated as it assumes it to be smaller than other limits.
  1976. + */
  1977. + AV_PKT_DATA_NB
  1978. +};
  1979. +
  1980. +#define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS //DEPRECATED
  1981. +
  1982. +typedef struct AVPacketSideData {
  1983. + uint8_t *data;
  1984. + int size;
  1985. + enum AVPacketSideDataType type;
  1986. +} AVPacketSideData;
  1987. +
  1988. +/**
  1989. + * This structure stores compressed data. It is typically exported by demuxers
  1990. + * and then passed as input to decoders, or received as output from encoders and
  1991. + * then passed to muxers.
  1992. + *
  1993. + * For video, it should typically contain one compressed frame. For audio it may
  1994. + * contain several compressed frames. Encoders are allowed to output empty
  1995. + * packets, with no compressed data, containing only side data
  1996. + * (e.g. to update some stream parameters at the end of encoding).
  1997. + *
  1998. + * AVPacket is one of the few structs in FFmpeg, whose size is a part of public
  1999. + * ABI. Thus it may be allocated on stack and no new fields can be added to it
  2000. + * without libavcodec and libavformat major bump.
  2001. + *
  2002. + * The semantics of data ownership depends on the buf field.
  2003. + * If it is set, the packet data is dynamically allocated and is
  2004. + * valid indefinitely until a call to av_packet_unref() reduces the
  2005. + * reference count to 0.
  2006. + *
  2007. + * If the buf field is not set av_packet_ref() would make a copy instead
  2008. + * of increasing the reference count.
  2009. + *
  2010. + * The side data is always allocated with av_malloc(), copied by
  2011. + * av_packet_ref() and freed by av_packet_unref().
  2012. + *
  2013. + * @see av_packet_ref
  2014. + * @see av_packet_unref
  2015. + */
  2016. +typedef struct AVPacket {
  2017. + /**
  2018. + * A reference to the reference-counted buffer where the packet data is
  2019. + * stored.
  2020. + * May be NULL, then the packet data is not reference-counted.
  2021. + */
  2022. + AVBufferRef *buf;
  2023. + /**
  2024. + * Presentation timestamp in AVStream->time_base units; the time at which
  2025. + * the decompressed packet will be presented to the user.
  2026. + * Can be AV_NOPTS_VALUE if it is not stored in the file.
  2027. + * pts MUST be larger or equal to dts as presentation cannot happen before
  2028. + * decompression, unless one wants to view hex dumps. Some formats misuse
  2029. + * the terms dts and pts/cts to mean something different. Such timestamps
  2030. + * must be converted to true pts/dts before they are stored in AVPacket.
  2031. + */
  2032. + int64_t pts;
  2033. + /**
  2034. + * Decompression timestamp in AVStream->time_base units; the time at which
  2035. + * the packet is decompressed.
  2036. + * Can be AV_NOPTS_VALUE if it is not stored in the file.
  2037. + */
  2038. + int64_t dts;
  2039. + uint8_t *data;
  2040. + int size;
  2041. + int stream_index;
  2042. + /**
  2043. + * A combination of AV_PKT_FLAG values
  2044. + */
  2045. + int flags;
  2046. + /**
  2047. + * Additional packet data that can be provided by the container.
  2048. + * Packet can contain several types of side information.
  2049. + */
  2050. + AVPacketSideData *side_data;
  2051. + int side_data_elems;
  2052. +
  2053. + /**
  2054. + * Duration of this packet in AVStream->time_base units, 0 if unknown.
  2055. + * Equals next_pts - this_pts in presentation order.
  2056. + */
  2057. + int64_t duration;
  2058. +
  2059. + int64_t pos; ///< byte position in stream, -1 if unknown
  2060. +
  2061. +#if FF_API_CONVERGENCE_DURATION
  2062. + /**
  2063. + * @deprecated Same as the duration field, but as int64_t. This was required
  2064. + * for Matroska subtitles, whose duration values could overflow when the
  2065. + * duration field was still an int.
  2066. + */
  2067. + attribute_deprecated
  2068. + int64_t convergence_duration;
  2069. +#endif
  2070. +} AVPacket;
  2071. +#define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe
  2072. +#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted
  2073. +/**
  2074. + * Flag is used to discard packets which are required to maintain valid
  2075. + * decoder state but are not required for output and should be dropped
  2076. + * after decoding.
  2077. + **/
  2078. +#define AV_PKT_FLAG_DISCARD 0x0004
  2079. +/**
  2080. + * The packet comes from a trusted source.
  2081. + *
  2082. + * Otherwise-unsafe constructs such as arbitrary pointers to data
  2083. + * outside the packet may be followed.
  2084. + */
  2085. +#define AV_PKT_FLAG_TRUSTED 0x0008
  2086. +/**
  2087. + * Flag is used to indicate packets that contain frames that can
  2088. + * be discarded by the decoder. I.e. Non-reference frames.
  2089. + */
  2090. +#define AV_PKT_FLAG_DISPOSABLE 0x0010
  2091. +
  2092. +
  2093. +enum AVSideDataParamChangeFlags {
  2094. + AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001,
  2095. + AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002,
  2096. + AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004,
  2097. + AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008,
  2098. +};
  2099. +/**
  2100. + * @}
  2101. + */
  2102. +
  2103. +struct AVCodecInternal;
  2104. +
  2105. +enum AVFieldOrder {
  2106. + AV_FIELD_UNKNOWN,
  2107. + AV_FIELD_PROGRESSIVE,
  2108. + AV_FIELD_TT, //< Top coded_first, top displayed first
  2109. + AV_FIELD_BB, //< Bottom coded first, bottom displayed first
  2110. + AV_FIELD_TB, //< Top coded first, bottom displayed first
  2111. + AV_FIELD_BT, //< Bottom coded first, top displayed first
  2112. +};
  2113. +
  2114. +/**
  2115. + * main external API structure.
  2116. + * New fields can be added to the end with minor version bumps.
  2117. + * Removal, reordering and changes to existing fields require a major
  2118. + * version bump.
  2119. + * You can use AVOptions (av_opt* / av_set/get*()) to access these fields from user
  2120. + * applications.
  2121. + * The name string for AVOptions options matches the associated command line
  2122. + * parameter name and can be found in libavcodec/options_table.h
  2123. + * The AVOption/command line parameter names differ in some cases from the C
  2124. + * structure field names for historic reasons or brevity.
  2125. + * sizeof(AVCodecContext) must not be used outside libav*.
  2126. + */
  2127. +typedef struct AVCodecContext {
  2128. + /**
  2129. + * information on struct for av_log
  2130. + * - set by avcodec_alloc_context3
  2131. + */
  2132. + const AVClass *av_class;
  2133. + int log_level_offset;
  2134. +
  2135. + enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */
  2136. + const struct AVCodec *codec;
  2137. + enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */
  2138. +
  2139. + /**
  2140. + * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
  2141. + * This is used to work around some encoder bugs.
  2142. + * A demuxer should set this to what is stored in the field used to identify the codec.
  2143. + * If there are multiple such fields in a container then the demuxer should choose the one
  2144. + * which maximizes the information about the used codec.
  2145. + * If the codec tag field in a container is larger than 32 bits then the demuxer should
  2146. + * remap the longer ID to 32 bits with a table or other structure. Alternatively a new
  2147. + * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated
  2148. + * first.
  2149. + * - encoding: Set by user, if not then the default based on codec_id will be used.
  2150. + * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
  2151. + */
  2152. + unsigned int codec_tag;
  2153. +
  2154. + void *priv_data;
  2155. +
  2156. + /**
  2157. + * Private context used for internal data.
  2158. + *
  2159. + * Unlike priv_data, this is not codec-specific. It is used in general
  2160. + * libavcodec functions.
  2161. + */
  2162. + struct AVCodecInternal *internal;
  2163. +
  2164. + /**
  2165. + * Private data of the user, can be used to carry app specific stuff.
  2166. + * - encoding: Set by user.
  2167. + * - decoding: Set by user.
  2168. + */
  2169. + void *opaque;
  2170. +
  2171. + /**
  2172. + * the average bitrate
  2173. + * - encoding: Set by user; unused for constant quantizer encoding.
  2174. + * - decoding: Set by user, may be overwritten by libavcodec
  2175. + * if this info is available in the stream
  2176. + */
  2177. + int64_t bit_rate;
  2178. +
  2179. + /**
  2180. + * number of bits the bitstream is allowed to diverge from the reference.
  2181. + * the reference can be CBR (for CBR pass1) or VBR (for pass2)
  2182. + * - encoding: Set by user; unused for constant quantizer encoding.
  2183. + * - decoding: unused
  2184. + */
  2185. + int bit_rate_tolerance;
  2186. +
  2187. + /**
  2188. + * Global quality for codecs which cannot change it per frame.
  2189. + * This should be proportional to MPEG-1/2/4 qscale.
  2190. + * - encoding: Set by user.
  2191. + * - decoding: unused
  2192. + */
  2193. + int global_quality;
  2194. +
  2195. + /**
  2196. + * - encoding: Set by user.
  2197. + * - decoding: unused
  2198. + */
  2199. + int compression_level;
  2200. +#define FF_COMPRESSION_DEFAULT -1
  2201. +
  2202. + /**
  2203. + * AV_CODEC_FLAG_*.
  2204. + * - encoding: Set by user.
  2205. + * - decoding: Set by user.
  2206. + */
  2207. + int flags;
  2208. +
  2209. + /**
  2210. + * AV_CODEC_FLAG2_*
  2211. + * - encoding: Set by user.
  2212. + * - decoding: Set by user.
  2213. + */
  2214. + int flags2;
  2215. +
  2216. + /**
  2217. + * some codecs need / can use extradata like Huffman tables.
  2218. + * MJPEG: Huffman tables
  2219. + * rv10: additional flags
  2220. + * MPEG-4: global headers (they can be in the bitstream or here)
  2221. + * The allocated memory should be AV_INPUT_BUFFER_PADDING_SIZE bytes larger
  2222. + * than extradata_size to avoid problems if it is read with the bitstream reader.
  2223. + * The bytewise contents of extradata must not depend on the architecture or CPU endianness.
  2224. + * - encoding: Set/allocated/freed by libavcodec.
  2225. + * - decoding: Set/allocated/freed by user.
  2226. + */
  2227. + uint8_t *extradata;
  2228. + int extradata_size;
  2229. +
  2230. + /**
  2231. + * This is the fundamental unit of time (in seconds) in terms
  2232. + * of which frame timestamps are represented. For fixed-fps content,
  2233. + * timebase should be 1/framerate and timestamp increments should be
  2234. + * identically 1.
  2235. + * This often, but not always is the inverse of the frame rate or field rate
  2236. + * for video. 1/time_base is not the average frame rate if the frame rate is not
  2237. + * constant.
  2238. + *
  2239. + * Like containers, elementary streams also can store timestamps, 1/time_base
  2240. + * is the unit in which these timestamps are specified.
  2241. + * As example of such codec time base see ISO/IEC 14496-2:2001(E)
  2242. + * vop_time_increment_resolution and fixed_vop_rate
  2243. + * (fixed_vop_rate == 0 implies that it is different from the framerate)
  2244. + *
  2245. + * - encoding: MUST be set by user.
  2246. + * - decoding: the use of this field for decoding is deprecated.
  2247. + * Use framerate instead.
  2248. + */
  2249. + AVRational time_base;
  2250. +
  2251. + /**
  2252. + * For some codecs, the time base is closer to the field rate than the frame rate.
  2253. + * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration
  2254. + * if no telecine is used ...
  2255. + *
  2256. + * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2.
  2257. + */
  2258. + int ticks_per_frame;
  2259. +
  2260. + /**
  2261. + * Codec delay.
  2262. + *
  2263. + * Encoding: Number of frames delay there will be from the encoder input to
  2264. + * the decoder output. (we assume the decoder matches the spec)
  2265. + * Decoding: Number of frames delay in addition to what a standard decoder
  2266. + * as specified in the spec would produce.
  2267. + *
  2268. + * Video:
  2269. + * Number of frames the decoded output will be delayed relative to the
  2270. + * encoded input.
  2271. + *
  2272. + * Audio:
  2273. + * For encoding, this field is unused (see initial_padding).
  2274. + *
  2275. + * For decoding, this is the number of samples the decoder needs to
  2276. + * output before the decoder's output is valid. When seeking, you should
  2277. + * start decoding this many samples prior to your desired seek point.
  2278. + *
  2279. + * - encoding: Set by libavcodec.
  2280. + * - decoding: Set by libavcodec.
  2281. + */
  2282. + int delay;
  2283. +
  2284. +
  2285. + /* video only */
  2286. + /**
  2287. + * picture width / height.
  2288. + *
  2289. + * @note Those fields may not match the values of the last
  2290. + * AVFrame output by avcodec_decode_video2 due frame
  2291. + * reordering.
  2292. + *
  2293. + * - encoding: MUST be set by user.
  2294. + * - decoding: May be set by the user before opening the decoder if known e.g.
  2295. + * from the container. Some decoders will require the dimensions
  2296. + * to be set by the caller. During decoding, the decoder may
  2297. + * overwrite those values as required while parsing the data.
  2298. + */
  2299. + int width, height;
  2300. +
  2301. + /**
  2302. + * Bitstream width / height, may be different from width/height e.g. when
  2303. + * the decoded frame is cropped before being output or lowres is enabled.
  2304. + *
  2305. + * @note Those field may not match the value of the last
  2306. + * AVFrame output by avcodec_receive_frame() due frame
  2307. + * reordering.
  2308. + *
  2309. + * - encoding: unused
  2310. + * - decoding: May be set by the user before opening the decoder if known
  2311. + * e.g. from the container. During decoding, the decoder may
  2312. + * overwrite those values as required while parsing the data.
  2313. + */
  2314. + int coded_width, coded_height;
  2315. +
  2316. + /**
  2317. + * the number of pictures in a group of pictures, or 0 for intra_only
  2318. + * - encoding: Set by user.
  2319. + * - decoding: unused
  2320. + */
  2321. + int gop_size;
  2322. +
  2323. + /**
  2324. + * Pixel format, see AV_PIX_FMT_xxx.
  2325. + * May be set by the demuxer if known from headers.
  2326. + * May be overridden by the decoder if it knows better.
  2327. + *
  2328. + * @note This field may not match the value of the last
  2329. + * AVFrame output by avcodec_receive_frame() due frame
  2330. + * reordering.
  2331. + *
  2332. + * - encoding: Set by user.
  2333. + * - decoding: Set by user if known, overridden by libavcodec while
  2334. + * parsing the data.
  2335. + */
  2336. + enum AVPixelFormat pix_fmt;
  2337. +
  2338. + /**
  2339. + * If non NULL, 'draw_horiz_band' is called by the libavcodec
  2340. + * decoder to draw a horizontal band. It improves cache usage. Not
  2341. + * all codecs can do that. You must check the codec capabilities
  2342. + * beforehand.
  2343. + * When multithreading is used, it may be called from multiple threads
  2344. + * at the same time; threads might draw different parts of the same AVFrame,
  2345. + * or multiple AVFrames, and there is no guarantee that slices will be drawn
  2346. + * in order.
  2347. + * The function is also used by hardware acceleration APIs.
  2348. + * It is called at least once during frame decoding to pass
  2349. + * the data needed for hardware render.
  2350. + * In that mode instead of pixel data, AVFrame points to
  2351. + * a structure specific to the acceleration API. The application
  2352. + * reads the structure and can change some fields to indicate progress
  2353. + * or mark state.
  2354. + * - encoding: unused
  2355. + * - decoding: Set by user.
  2356. + * @param height the height of the slice
  2357. + * @param y the y position of the slice
  2358. + * @param type 1->top field, 2->bottom field, 3->frame
  2359. + * @param offset offset into the AVFrame.data from which the slice should be read
  2360. + */
  2361. + void (*draw_horiz_band)(struct AVCodecContext *s,
  2362. + const AVFrame *src, int offset[AV_NUM_DATA_POINTERS],
  2363. + int y, int type, int height);
  2364. +
  2365. + /**
  2366. + * callback to negotiate the pixelFormat
  2367. + * @param fmt is the list of formats which are supported by the codec,
  2368. + * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality.
  2369. + * The first is always the native one.
  2370. + * @note The callback may be called again immediately if initialization for
  2371. + * the selected (hardware-accelerated) pixel format failed.
  2372. + * @warning Behavior is undefined if the callback returns a value not
  2373. + * in the fmt list of formats.
  2374. + * @return the chosen format
  2375. + * - encoding: unused
  2376. + * - decoding: Set by user, if not set the native format will be chosen.
  2377. + */
  2378. + enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat * fmt);
  2379. +
  2380. + /**
  2381. + * maximum number of B-frames between non-B-frames
  2382. + * Note: The output will be delayed by max_b_frames+1 relative to the input.
  2383. + * - encoding: Set by user.
  2384. + * - decoding: unused
  2385. + */
  2386. + int max_b_frames;
  2387. +
  2388. + /**
  2389. + * qscale factor between IP and B-frames
  2390. + * If > 0 then the last P-frame quantizer will be used (q= lastp_q*factor+offset).
  2391. + * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
  2392. + * - encoding: Set by user.
  2393. + * - decoding: unused
  2394. + */
  2395. + float b_quant_factor;
  2396. +
  2397. +#if FF_API_PRIVATE_OPT
  2398. + /** @deprecated use encoder private options instead */
  2399. + attribute_deprecated
  2400. + int b_frame_strategy;
  2401. +#endif
  2402. +
  2403. + /**
  2404. + * qscale offset between IP and B-frames
  2405. + * - encoding: Set by user.
  2406. + * - decoding: unused
  2407. + */
  2408. + float b_quant_offset;
  2409. +
  2410. + /**
  2411. + * Size of the frame reordering buffer in the decoder.
  2412. + * For MPEG-2 it is 1 IPB or 0 low delay IP.
  2413. + * - encoding: Set by libavcodec.
  2414. + * - decoding: Set by libavcodec.
  2415. + */
  2416. + int has_b_frames;
  2417. +
  2418. +#if FF_API_PRIVATE_OPT
  2419. + /** @deprecated use encoder private options instead */
  2420. + attribute_deprecated
  2421. + int mpeg_quant;
  2422. +#endif
  2423. +
  2424. + /**
  2425. + * qscale factor between P- and I-frames
  2426. + * If > 0 then the last P-frame quantizer will be used (q = lastp_q * factor + offset).
  2427. + * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
  2428. + * - encoding: Set by user.
  2429. + * - decoding: unused
  2430. + */
  2431. + float i_quant_factor;
  2432. +
  2433. + /**
  2434. + * qscale offset between P and I-frames
  2435. + * - encoding: Set by user.
  2436. + * - decoding: unused
  2437. + */
  2438. + float i_quant_offset;
  2439. +
  2440. + /**
  2441. + * luminance masking (0-> disabled)
  2442. + * - encoding: Set by user.
  2443. + * - decoding: unused
  2444. + */
  2445. + float lumi_masking;
  2446. +
  2447. + /**
  2448. + * temporary complexity masking (0-> disabled)
  2449. + * - encoding: Set by user.
  2450. + * - decoding: unused
  2451. + */
  2452. + float temporal_cplx_masking;
  2453. +
  2454. + /**
  2455. + * spatial complexity masking (0-> disabled)
  2456. + * - encoding: Set by user.
  2457. + * - decoding: unused
  2458. + */
  2459. + float spatial_cplx_masking;
  2460. +
  2461. + /**
  2462. + * p block masking (0-> disabled)
  2463. + * - encoding: Set by user.
  2464. + * - decoding: unused
  2465. + */
  2466. + float p_masking;
  2467. +
  2468. + /**
  2469. + * darkness masking (0-> disabled)
  2470. + * - encoding: Set by user.
  2471. + * - decoding: unused
  2472. + */
  2473. + float dark_masking;
  2474. +
  2475. + /**
  2476. + * slice count
  2477. + * - encoding: Set by libavcodec.
  2478. + * - decoding: Set by user (or 0).
  2479. + */
  2480. + int slice_count;
  2481. +
  2482. +#if FF_API_PRIVATE_OPT
  2483. + /** @deprecated use encoder private options instead */
  2484. + attribute_deprecated
  2485. + int prediction_method;
  2486. +#define FF_PRED_LEFT 0
  2487. +#define FF_PRED_PLANE 1
  2488. +#define FF_PRED_MEDIAN 2
  2489. +#endif
  2490. +
  2491. + /**
  2492. + * slice offsets in the frame in bytes
  2493. + * - encoding: Set/allocated by libavcodec.
  2494. + * - decoding: Set/allocated by user (or NULL).
  2495. + */
  2496. + int *slice_offset;
  2497. +
  2498. + /**
  2499. + * sample aspect ratio (0 if unknown)
  2500. + * That is the width of a pixel divided by the height of the pixel.
  2501. + * Numerator and denominator must be relatively prime and smaller than 256 for some video standards.
  2502. + * - encoding: Set by user.
  2503. + * - decoding: Set by libavcodec.
  2504. + */
  2505. + AVRational sample_aspect_ratio;
  2506. +
  2507. + /**
  2508. + * motion estimation comparison function
  2509. + * - encoding: Set by user.
  2510. + * - decoding: unused
  2511. + */
  2512. + int me_cmp;
  2513. + /**
  2514. + * subpixel motion estimation comparison function
  2515. + * - encoding: Set by user.
  2516. + * - decoding: unused
  2517. + */
  2518. + int me_sub_cmp;
  2519. + /**
  2520. + * macroblock comparison function (not supported yet)
  2521. + * - encoding: Set by user.
  2522. + * - decoding: unused
  2523. + */
  2524. + int mb_cmp;
  2525. + /**
  2526. + * interlaced DCT comparison function
  2527. + * - encoding: Set by user.
  2528. + * - decoding: unused
  2529. + */
  2530. + int ildct_cmp;
  2531. +#define FF_CMP_SAD 0
  2532. +#define FF_CMP_SSE 1
  2533. +#define FF_CMP_SATD 2
  2534. +#define FF_CMP_DCT 3
  2535. +#define FF_CMP_PSNR 4
  2536. +#define FF_CMP_BIT 5
  2537. +#define FF_CMP_RD 6
  2538. +#define FF_CMP_ZERO 7
  2539. +#define FF_CMP_VSAD 8
  2540. +#define FF_CMP_VSSE 9
  2541. +#define FF_CMP_NSSE 10
  2542. +#define FF_CMP_W53 11
  2543. +#define FF_CMP_W97 12
  2544. +#define FF_CMP_DCTMAX 13
  2545. +#define FF_CMP_DCT264 14
  2546. +#define FF_CMP_MEDIAN_SAD 15
  2547. +#define FF_CMP_CHROMA 256
  2548. +
  2549. + /**
  2550. + * ME diamond size & shape
  2551. + * - encoding: Set by user.
  2552. + * - decoding: unused
  2553. + */
  2554. + int dia_size;
  2555. +
  2556. + /**
  2557. + * amount of previous MV predictors (2a+1 x 2a+1 square)
  2558. + * - encoding: Set by user.
  2559. + * - decoding: unused
  2560. + */
  2561. + int last_predictor_count;
  2562. +
  2563. +#if FF_API_PRIVATE_OPT
  2564. + /** @deprecated use encoder private options instead */
  2565. + attribute_deprecated
  2566. + int pre_me;
  2567. +#endif
  2568. +
  2569. + /**
  2570. + * motion estimation prepass comparison function
  2571. + * - encoding: Set by user.
  2572. + * - decoding: unused
  2573. + */
  2574. + int me_pre_cmp;
  2575. +
  2576. + /**
  2577. + * ME prepass diamond size & shape
  2578. + * - encoding: Set by user.
  2579. + * - decoding: unused
  2580. + */
  2581. + int pre_dia_size;
  2582. +
  2583. + /**
  2584. + * subpel ME quality
  2585. + * - encoding: Set by user.
  2586. + * - decoding: unused
  2587. + */
  2588. + int me_subpel_quality;
  2589. +
  2590. + /**
  2591. + * maximum motion estimation search range in subpel units
  2592. + * If 0 then no limit.
  2593. + *
  2594. + * - encoding: Set by user.
  2595. + * - decoding: unused
  2596. + */
  2597. + int me_range;
  2598. +
  2599. + /**
  2600. + * slice flags
  2601. + * - encoding: unused
  2602. + * - decoding: Set by user.
  2603. + */
  2604. + int slice_flags;
  2605. +#define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display
  2606. +#define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG-2 field pics)
  2607. +#define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
  2608. +
  2609. + /**
  2610. + * macroblock decision mode
  2611. + * - encoding: Set by user.
  2612. + * - decoding: unused
  2613. + */
  2614. + int mb_decision;
  2615. +#define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp
  2616. +#define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits
  2617. +#define FF_MB_DECISION_RD 2 ///< rate distortion
  2618. +
  2619. + /**
  2620. + * custom intra quantization matrix
  2621. + * - encoding: Set by user, can be NULL.
  2622. + * - decoding: Set by libavcodec.
  2623. + */
  2624. + uint16_t *intra_matrix;
  2625. +
  2626. + /**
  2627. + * custom inter quantization matrix
  2628. + * - encoding: Set by user, can be NULL.
  2629. + * - decoding: Set by libavcodec.
  2630. + */
  2631. + uint16_t *inter_matrix;
  2632. +
  2633. +#if FF_API_PRIVATE_OPT
  2634. + /** @deprecated use encoder private options instead */
  2635. + attribute_deprecated
  2636. + int scenechange_threshold;
  2637. +
  2638. + /** @deprecated use encoder private options instead */
  2639. + attribute_deprecated
  2640. + int noise_reduction;
  2641. +#endif
  2642. +
  2643. + /**
  2644. + * precision of the intra DC coefficient - 8
  2645. + * - encoding: Set by user.
  2646. + * - decoding: Set by libavcodec
  2647. + */
  2648. + int intra_dc_precision;
  2649. +
  2650. + /**
  2651. + * Number of macroblock rows at the top which are skipped.
  2652. + * - encoding: unused
  2653. + * - decoding: Set by user.
  2654. + */
  2655. + int skip_top;
  2656. +
  2657. + /**
  2658. + * Number of macroblock rows at the bottom which are skipped.
  2659. + * - encoding: unused
  2660. + * - decoding: Set by user.
  2661. + */
  2662. + int skip_bottom;
  2663. +
  2664. + /**
  2665. + * minimum MB Lagrange multiplier
  2666. + * - encoding: Set by user.
  2667. + * - decoding: unused
  2668. + */
  2669. + int mb_lmin;
  2670. +
  2671. + /**
  2672. + * maximum MB Lagrange multiplier
  2673. + * - encoding: Set by user.
  2674. + * - decoding: unused
  2675. + */
  2676. + int mb_lmax;
  2677. +
  2678. +#if FF_API_PRIVATE_OPT
  2679. + /**
  2680. + * @deprecated use encoder private options instead
  2681. + */
  2682. + attribute_deprecated
  2683. + int me_penalty_compensation;
  2684. +#endif
  2685. +
  2686. + /**
  2687. + * - encoding: Set by user.
  2688. + * - decoding: unused
  2689. + */
  2690. + int bidir_refine;
  2691. +
  2692. +#if FF_API_PRIVATE_OPT
  2693. + /** @deprecated use encoder private options instead */
  2694. + attribute_deprecated
  2695. + int brd_scale;
  2696. +#endif
  2697. +
  2698. + /**
  2699. + * minimum GOP size
  2700. + * - encoding: Set by user.
  2701. + * - decoding: unused
  2702. + */
  2703. + int keyint_min;
  2704. +
  2705. + /**
  2706. + * number of reference frames
  2707. + * - encoding: Set by user.
  2708. + * - decoding: Set by lavc.
  2709. + */
  2710. + int refs;
  2711. +
  2712. +#if FF_API_PRIVATE_OPT
  2713. + /** @deprecated use encoder private options instead */
  2714. + attribute_deprecated
  2715. + int chromaoffset;
  2716. +#endif
  2717. +
  2718. + /**
  2719. + * Note: Value depends upon the compare function used for fullpel ME.
  2720. + * - encoding: Set by user.
  2721. + * - decoding: unused
  2722. + */
  2723. + int mv0_threshold;
  2724. +
  2725. +#if FF_API_PRIVATE_OPT
  2726. + /** @deprecated use encoder private options instead */
  2727. + attribute_deprecated
  2728. + int b_sensitivity;
  2729. +#endif
  2730. +
  2731. + /**
  2732. + * Chromaticity coordinates of the source primaries.
  2733. + * - encoding: Set by user
  2734. + * - decoding: Set by libavcodec
  2735. + */
  2736. + enum AVColorPrimaries color_primaries;
  2737. +
  2738. + /**
  2739. + * Color Transfer Characteristic.
  2740. + * - encoding: Set by user
  2741. + * - decoding: Set by libavcodec
  2742. + */
  2743. + enum AVColorTransferCharacteristic color_trc;
  2744. +
  2745. + /**
  2746. + * YUV colorspace type.
  2747. + * - encoding: Set by user
  2748. + * - decoding: Set by libavcodec
  2749. + */
  2750. + enum AVColorSpace colorspace;
  2751. +
  2752. + /**
  2753. + * MPEG vs JPEG YUV range.
  2754. + * - encoding: Set by user
  2755. + * - decoding: Set by libavcodec
  2756. + */
  2757. + enum AVColorRange color_range;
  2758. +
  2759. + /**
  2760. + * This defines the location of chroma samples.
  2761. + * - encoding: Set by user
  2762. + * - decoding: Set by libavcodec
  2763. + */
  2764. + enum AVChromaLocation chroma_sample_location;
  2765. +
  2766. + /**
  2767. + * Number of slices.
  2768. + * Indicates number of picture subdivisions. Used for parallelized
  2769. + * decoding.
  2770. + * - encoding: Set by user
  2771. + * - decoding: unused
  2772. + */
  2773. + int slices;
  2774. +
  2775. + /** Field order
  2776. + * - encoding: set by libavcodec
  2777. + * - decoding: Set by user.
  2778. + */
  2779. + enum AVFieldOrder field_order;
  2780. +
  2781. + /* audio only */
  2782. + int sample_rate; ///< samples per second
  2783. + int channels; ///< number of audio channels
  2784. +
  2785. + /**
  2786. + * audio sample format
  2787. + * - encoding: Set by user.
  2788. + * - decoding: Set by libavcodec.
  2789. + */
  2790. + enum AVSampleFormat sample_fmt; ///< sample format
  2791. +
  2792. + /* The following data should not be initialized. */
  2793. + /**
  2794. + * Number of samples per channel in an audio frame.
  2795. + *
  2796. + * - encoding: set by libavcodec in avcodec_open2(). Each submitted frame
  2797. + * except the last must contain exactly frame_size samples per channel.
  2798. + * May be 0 when the codec has AV_CODEC_CAP_VARIABLE_FRAME_SIZE set, then the
  2799. + * frame size is not restricted.
  2800. + * - decoding: may be set by some decoders to indicate constant frame size
  2801. + */
  2802. + int frame_size;
  2803. +
  2804. + /**
  2805. + * Frame counter, set by libavcodec.
  2806. + *
  2807. + * - decoding: total number of frames returned from the decoder so far.
  2808. + * - encoding: total number of frames passed to the encoder so far.
  2809. + *
  2810. + * @note the counter is not incremented if encoding/decoding resulted in
  2811. + * an error.
  2812. + */
  2813. + int frame_number;
  2814. +
  2815. + /**
  2816. + * number of bytes per packet if constant and known or 0
  2817. + * Used by some WAV based audio codecs.
  2818. + */
  2819. + int block_align;
  2820. +
  2821. + /**
  2822. + * Audio cutoff bandwidth (0 means "automatic")
  2823. + * - encoding: Set by user.
  2824. + * - decoding: unused
  2825. + */
  2826. + int cutoff;
  2827. +
  2828. + /**
  2829. + * Audio channel layout.
  2830. + * - encoding: set by user.
  2831. + * - decoding: set by user, may be overwritten by libavcodec.
  2832. + */
  2833. + uint64_t channel_layout;
  2834. +
  2835. + /**
  2836. + * Request decoder to use this channel layout if it can (0 for default)
  2837. + * - encoding: unused
  2838. + * - decoding: Set by user.
  2839. + */
  2840. + uint64_t request_channel_layout;
  2841. +
  2842. + /**
  2843. + * Type of service that the audio stream conveys.
  2844. + * - encoding: Set by user.
  2845. + * - decoding: Set by libavcodec.
  2846. + */
  2847. + enum AVAudioServiceType audio_service_type;
  2848. +
  2849. + /**
  2850. + * desired sample format
  2851. + * - encoding: Not used.
  2852. + * - decoding: Set by user.
  2853. + * Decoder will decode to this format if it can.
  2854. + */
  2855. + enum AVSampleFormat request_sample_fmt;
  2856. +
  2857. + /**
  2858. + * This callback is called at the beginning of each frame to get data
  2859. + * buffer(s) for it. There may be one contiguous buffer for all the data or
  2860. + * there may be a buffer per each data plane or anything in between. What
  2861. + * this means is, you may set however many entries in buf[] you feel necessary.
  2862. + * Each buffer must be reference-counted using the AVBuffer API (see description
  2863. + * of buf[] below).
  2864. + *
  2865. + * The following fields will be set in the frame before this callback is
  2866. + * called:
  2867. + * - format
  2868. + * - width, height (video only)
  2869. + * - sample_rate, channel_layout, nb_samples (audio only)
  2870. + * Their values may differ from the corresponding values in
  2871. + * AVCodecContext. This callback must use the frame values, not the codec
  2872. + * context values, to calculate the required buffer size.
  2873. + *
  2874. + * This callback must fill the following fields in the frame:
  2875. + * - data[]
  2876. + * - linesize[]
  2877. + * - extended_data:
  2878. + * * if the data is planar audio with more than 8 channels, then this
  2879. + * callback must allocate and fill extended_data to contain all pointers
  2880. + * to all data planes. data[] must hold as many pointers as it can.
  2881. + * extended_data must be allocated with av_malloc() and will be freed in
  2882. + * av_frame_unref().
  2883. + * * otherwise extended_data must point to data
  2884. + * - buf[] must contain one or more pointers to AVBufferRef structures. Each of
  2885. + * the frame's data and extended_data pointers must be contained in these. That
  2886. + * is, one AVBufferRef for each allocated chunk of memory, not necessarily one
  2887. + * AVBufferRef per data[] entry. See: av_buffer_create(), av_buffer_alloc(),
  2888. + * and av_buffer_ref().
  2889. + * - extended_buf and nb_extended_buf must be allocated with av_malloc() by
  2890. + * this callback and filled with the extra buffers if there are more
  2891. + * buffers than buf[] can hold. extended_buf will be freed in
  2892. + * av_frame_unref().
  2893. + *
  2894. + * If AV_CODEC_CAP_DR1 is not set then get_buffer2() must call
  2895. + * avcodec_default_get_buffer2() instead of providing buffers allocated by
  2896. + * some other means.
  2897. + *
  2898. + * Each data plane must be aligned to the maximum required by the target
  2899. + * CPU.
  2900. + *
  2901. + * @see avcodec_default_get_buffer2()
  2902. + *
  2903. + * Video:
  2904. + *
  2905. + * If AV_GET_BUFFER_FLAG_REF is set in flags then the frame may be reused
  2906. + * (read and/or written to if it is writable) later by libavcodec.
  2907. + *
  2908. + * avcodec_align_dimensions2() should be used to find the required width and
  2909. + * height, as they normally need to be rounded up to the next multiple of 16.
  2910. + *
  2911. + * Some decoders do not support linesizes changing between frames.
  2912. + *
  2913. + * If frame multithreading is used and thread_safe_callbacks is set,
  2914. + * this callback may be called from a different thread, but not from more
  2915. + * than one at once. Does not need to be reentrant.
  2916. + *
  2917. + * @see avcodec_align_dimensions2()
  2918. + *
  2919. + * Audio:
  2920. + *
  2921. + * Decoders request a buffer of a particular size by setting
  2922. + * AVFrame.nb_samples prior to calling get_buffer2(). The decoder may,
  2923. + * however, utilize only part of the buffer by setting AVFrame.nb_samples
  2924. + * to a smaller value in the output frame.
  2925. + *
  2926. + * As a convenience, av_samples_get_buffer_size() and
  2927. + * av_samples_fill_arrays() in libavutil may be used by custom get_buffer2()
  2928. + * functions to find the required data size and to fill data pointers and
  2929. + * linesize. In AVFrame.linesize, only linesize[0] may be set for audio
  2930. + * since all planes must be the same size.
  2931. + *
  2932. + * @see av_samples_get_buffer_size(), av_samples_fill_arrays()
  2933. + *
  2934. + * - encoding: unused
  2935. + * - decoding: Set by libavcodec, user can override.
  2936. + */
  2937. + int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags);
  2938. +
  2939. + /**
  2940. + * If non-zero, the decoded audio and video frames returned from
  2941. + * avcodec_decode_video2() and avcodec_decode_audio4() are reference-counted
  2942. + * and are valid indefinitely. The caller must free them with
  2943. + * av_frame_unref() when they are not needed anymore.
  2944. + * Otherwise, the decoded frames must not be freed by the caller and are
  2945. + * only valid until the next decode call.
  2946. + *
  2947. + * This is always automatically enabled if avcodec_receive_frame() is used.
  2948. + *
  2949. + * - encoding: unused
  2950. + * - decoding: set by the caller before avcodec_open2().
  2951. + */
  2952. + attribute_deprecated
  2953. + int refcounted_frames;
  2954. +
  2955. + /* - encoding parameters */
  2956. + float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0)
  2957. + float qblur; ///< amount of qscale smoothing over time (0.0-1.0)
  2958. +
  2959. + /**
  2960. + * minimum quantizer
  2961. + * - encoding: Set by user.
  2962. + * - decoding: unused
  2963. + */
  2964. + int qmin;
  2965. +
  2966. + /**
  2967. + * maximum quantizer
  2968. + * - encoding: Set by user.
  2969. + * - decoding: unused
  2970. + */
  2971. + int qmax;
  2972. +
  2973. + /**
  2974. + * maximum quantizer difference between frames
  2975. + * - encoding: Set by user.
  2976. + * - decoding: unused
  2977. + */
  2978. + int max_qdiff;
  2979. +
  2980. + /**
  2981. + * decoder bitstream buffer size
  2982. + * - encoding: Set by user.
  2983. + * - decoding: unused
  2984. + */
  2985. + int rc_buffer_size;
  2986. +
  2987. + /**
  2988. + * ratecontrol override, see RcOverride
  2989. + * - encoding: Allocated/set/freed by user.
  2990. + * - decoding: unused
  2991. + */
  2992. + int rc_override_count;
  2993. + RcOverride *rc_override;
  2994. +
  2995. + /**
  2996. + * maximum bitrate
  2997. + * - encoding: Set by user.
  2998. + * - decoding: Set by user, may be overwritten by libavcodec.
  2999. + */
  3000. + int64_t rc_max_rate;
  3001. +
  3002. + /**
  3003. + * minimum bitrate
  3004. + * - encoding: Set by user.
  3005. + * - decoding: unused
  3006. + */
  3007. + int64_t rc_min_rate;
  3008. +
  3009. + /**
  3010. + * Ratecontrol attempt to use, at maximum, <value> of what can be used without an underflow.
  3011. + * - encoding: Set by user.
  3012. + * - decoding: unused.
  3013. + */
  3014. + float rc_max_available_vbv_use;
  3015. +
  3016. + /**
  3017. + * Ratecontrol attempt to use, at least, <value> times the amount needed to prevent a vbv overflow.
  3018. + * - encoding: Set by user.
  3019. + * - decoding: unused.
  3020. + */
  3021. + float rc_min_vbv_overflow_use;
  3022. +
  3023. + /**
  3024. + * Number of bits which should be loaded into the rc buffer before decoding starts.
  3025. + * - encoding: Set by user.
  3026. + * - decoding: unused
  3027. + */
  3028. + int rc_initial_buffer_occupancy;
  3029. +
  3030. +#if FF_API_CODER_TYPE
  3031. +#define FF_CODER_TYPE_VLC 0
  3032. +#define FF_CODER_TYPE_AC 1
  3033. +#define FF_CODER_TYPE_RAW 2
  3034. +#define FF_CODER_TYPE_RLE 3
  3035. + /**
  3036. + * @deprecated use encoder private options instead
  3037. + */
  3038. + attribute_deprecated
  3039. + int coder_type;
  3040. +#endif /* FF_API_CODER_TYPE */
  3041. +
  3042. +#if FF_API_PRIVATE_OPT
  3043. + /** @deprecated use encoder private options instead */
  3044. + attribute_deprecated
  3045. + int context_model;
  3046. +#endif
  3047. +
  3048. +#if FF_API_PRIVATE_OPT
  3049. + /** @deprecated use encoder private options instead */
  3050. + attribute_deprecated
  3051. + int frame_skip_threshold;
  3052. +
  3053. + /** @deprecated use encoder private options instead */
  3054. + attribute_deprecated
  3055. + int frame_skip_factor;
  3056. +
  3057. + /** @deprecated use encoder private options instead */
  3058. + attribute_deprecated
  3059. + int frame_skip_exp;
  3060. +
  3061. + /** @deprecated use encoder private options instead */
  3062. + attribute_deprecated
  3063. + int frame_skip_cmp;
  3064. +#endif /* FF_API_PRIVATE_OPT */
  3065. +
  3066. + /**
  3067. + * trellis RD quantization
  3068. + * - encoding: Set by user.
  3069. + * - decoding: unused
  3070. + */
  3071. + int trellis;
  3072. +
  3073. +#if FF_API_PRIVATE_OPT
  3074. + /** @deprecated use encoder private options instead */
  3075. + attribute_deprecated
  3076. + int min_prediction_order;
  3077. +
  3078. + /** @deprecated use encoder private options instead */
  3079. + attribute_deprecated
  3080. + int max_prediction_order;
  3081. +
  3082. + /** @deprecated use encoder private options instead */
  3083. + attribute_deprecated
  3084. + int64_t timecode_frame_start;
  3085. +#endif
  3086. +
  3087. +#if FF_API_RTP_CALLBACK
  3088. + /**
  3089. + * @deprecated unused
  3090. + */
  3091. + /* The RTP callback: This function is called */
  3092. + /* every time the encoder has a packet to send. */
  3093. + /* It depends on the encoder if the data starts */
  3094. + /* with a Start Code (it should). H.263 does. */
  3095. + /* mb_nb contains the number of macroblocks */
  3096. + /* encoded in the RTP payload. */
  3097. + attribute_deprecated
  3098. + void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
  3099. +#endif
  3100. +
  3101. +#if FF_API_PRIVATE_OPT
  3102. + /** @deprecated use encoder private options instead */
  3103. + attribute_deprecated
  3104. + int rtp_payload_size; /* The size of the RTP payload: the coder will */
  3105. + /* do its best to deliver a chunk with size */
  3106. + /* below rtp_payload_size, the chunk will start */
  3107. + /* with a start code on some codecs like H.263. */
  3108. + /* This doesn't take account of any particular */
  3109. + /* headers inside the transmitted RTP payload. */
  3110. +#endif
  3111. +
  3112. +#if FF_API_STAT_BITS
  3113. + /* statistics, used for 2-pass encoding */
  3114. + attribute_deprecated
  3115. + int mv_bits;
  3116. + attribute_deprecated
  3117. + int header_bits;
  3118. + attribute_deprecated
  3119. + int i_tex_bits;
  3120. + attribute_deprecated
  3121. + int p_tex_bits;
  3122. + attribute_deprecated
  3123. + int i_count;
  3124. + attribute_deprecated
  3125. + int p_count;
  3126. + attribute_deprecated
  3127. + int skip_count;
  3128. + attribute_deprecated
  3129. + int misc_bits;
  3130. +
  3131. + /** @deprecated this field is unused */
  3132. + attribute_deprecated
  3133. + int frame_bits;
  3134. +#endif
  3135. +
  3136. + /**
  3137. + * pass1 encoding statistics output buffer
  3138. + * - encoding: Set by libavcodec.
  3139. + * - decoding: unused
  3140. + */
  3141. + char *stats_out;
  3142. +
  3143. + /**
  3144. + * pass2 encoding statistics input buffer
  3145. + * Concatenated stuff from stats_out of pass1 should be placed here.
  3146. + * - encoding: Allocated/set/freed by user.
  3147. + * - decoding: unused
  3148. + */
  3149. + char *stats_in;
  3150. +
  3151. + /**
  3152. + * Work around bugs in encoders which sometimes cannot be detected automatically.
  3153. + * - encoding: Set by user
  3154. + * - decoding: Set by user
  3155. + */
  3156. + int workaround_bugs;
  3157. +#define FF_BUG_AUTODETECT 1 ///< autodetection
  3158. +#define FF_BUG_XVID_ILACE 4
  3159. +#define FF_BUG_UMP4 8
  3160. +#define FF_BUG_NO_PADDING 16
  3161. +#define FF_BUG_AMV 32
  3162. +#define FF_BUG_QPEL_CHROMA 64
  3163. +#define FF_BUG_STD_QPEL 128
  3164. +#define FF_BUG_QPEL_CHROMA2 256
  3165. +#define FF_BUG_DIRECT_BLOCKSIZE 512
  3166. +#define FF_BUG_EDGE 1024
  3167. +#define FF_BUG_HPEL_CHROMA 2048
  3168. +#define FF_BUG_DC_CLIP 4096
  3169. +#define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders.
  3170. +#define FF_BUG_TRUNCATED 16384
  3171. +#define FF_BUG_IEDGE 32768
  3172. +
  3173. + /**
  3174. + * strictly follow the standard (MPEG-4, ...).
  3175. + * - encoding: Set by user.
  3176. + * - decoding: Set by user.
  3177. + * Setting this to STRICT or higher means the encoder and decoder will
  3178. + * generally do stupid things, whereas setting it to unofficial or lower
  3179. + * will mean the encoder might produce output that is not supported by all
  3180. + * spec-compliant decoders. Decoders don't differentiate between normal,
  3181. + * unofficial and experimental (that is, they always try to decode things
  3182. + * when they can) unless they are explicitly asked to behave stupidly
  3183. + * (=strictly conform to the specs)
  3184. + */
  3185. + int strict_std_compliance;
  3186. +#define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software.
  3187. +#define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences.
  3188. +#define FF_COMPLIANCE_NORMAL 0
  3189. +#define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions
  3190. +#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
  3191. +
  3192. + /**
  3193. + * error concealment flags
  3194. + * - encoding: unused
  3195. + * - decoding: Set by user.
  3196. + */
  3197. + int error_concealment;
  3198. +#define FF_EC_GUESS_MVS 1
  3199. +#define FF_EC_DEBLOCK 2
  3200. +#define FF_EC_FAVOR_INTER 256
  3201. +
  3202. + /**
  3203. + * debug
  3204. + * - encoding: Set by user.
  3205. + * - decoding: Set by user.
  3206. + */
  3207. + int debug;
  3208. +#define FF_DEBUG_PICT_INFO 1
  3209. +#define FF_DEBUG_RC 2
  3210. +#define FF_DEBUG_BITSTREAM 4
  3211. +#define FF_DEBUG_MB_TYPE 8
  3212. +#define FF_DEBUG_QP 16
  3213. +#if FF_API_DEBUG_MV
  3214. +/**
  3215. + * @deprecated this option does nothing
  3216. + */
  3217. +#define FF_DEBUG_MV 32
  3218. +#endif
  3219. +#define FF_DEBUG_DCT_COEFF 0x00000040
  3220. +#define FF_DEBUG_SKIP 0x00000080
  3221. +#define FF_DEBUG_STARTCODE 0x00000100
  3222. +#define FF_DEBUG_ER 0x00000400
  3223. +#define FF_DEBUG_MMCO 0x00000800
  3224. +#define FF_DEBUG_BUGS 0x00001000
  3225. +#if FF_API_DEBUG_MV
  3226. +#define FF_DEBUG_VIS_QP 0x00002000
  3227. +#define FF_DEBUG_VIS_MB_TYPE 0x00004000
  3228. +#endif
  3229. +#define FF_DEBUG_BUFFERS 0x00008000
  3230. +#define FF_DEBUG_THREADS 0x00010000
  3231. +#define FF_DEBUG_GREEN_MD 0x00800000
  3232. +#define FF_DEBUG_NOMC 0x01000000
  3233. +
  3234. +#if FF_API_DEBUG_MV
  3235. + /**
  3236. + * debug
  3237. + * - encoding: Set by user.
  3238. + * - decoding: Set by user.
  3239. + */
  3240. + int debug_mv;
  3241. +#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 // visualize forward predicted MVs of P-frames
  3242. +#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 // visualize forward predicted MVs of B-frames
  3243. +#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 // visualize backward predicted MVs of B-frames
  3244. +#endif
  3245. +
  3246. + /**
  3247. + * Error recognition; may misdetect some more or less valid parts as errors.
  3248. + * - encoding: unused
  3249. + * - decoding: Set by user.
  3250. + */
  3251. + int err_recognition;
  3252. +
  3253. +/**
  3254. + * Verify checksums embedded in the bitstream (could be of either encoded or
  3255. + * decoded data, depending on the codec) and print an error message on mismatch.
  3256. + * If AV_EF_EXPLODE is also set, a mismatching checksum will result in the
  3257. + * decoder returning an error.
  3258. + */
  3259. +#define AV_EF_CRCCHECK (1<<0)
  3260. +#define AV_EF_BITSTREAM (1<<1) ///< detect bitstream specification deviations
  3261. +#define AV_EF_BUFFER (1<<2) ///< detect improper bitstream length
  3262. +#define AV_EF_EXPLODE (1<<3) ///< abort decoding on minor error detection
  3263. +
  3264. +#define AV_EF_IGNORE_ERR (1<<15) ///< ignore errors and continue
  3265. +#define AV_EF_CAREFUL (1<<16) ///< consider things that violate the spec, are fast to calculate and have not been seen in the wild as errors
  3266. +#define AV_EF_COMPLIANT (1<<17) ///< consider all spec non compliances as errors
  3267. +#define AV_EF_AGGRESSIVE (1<<18) ///< consider things that a sane encoder should not do as an error
  3268. +
  3269. +
  3270. + /**
  3271. + * opaque 64-bit number (generally a PTS) that will be reordered and
  3272. + * output in AVFrame.reordered_opaque
  3273. + * - encoding: unused
  3274. + * - decoding: Set by user.
  3275. + */
  3276. + int64_t reordered_opaque;
  3277. +
  3278. + /**
  3279. + * Hardware accelerator in use
  3280. + * - encoding: unused.
  3281. + * - decoding: Set by libavcodec
  3282. + */
  3283. + const struct AVHWAccel *hwaccel;
  3284. +
  3285. + /**
  3286. + * Hardware accelerator context.
  3287. + * For some hardware accelerators, a global context needs to be
  3288. + * provided by the user. In that case, this holds display-dependent
  3289. + * data FFmpeg cannot instantiate itself. Please refer to the
  3290. + * FFmpeg HW accelerator documentation to know how to fill this
  3291. + * is. e.g. for VA API, this is a struct vaapi_context.
  3292. + * - encoding: unused
  3293. + * - decoding: Set by user
  3294. + */
  3295. + void *hwaccel_context;
  3296. +
  3297. + /**
  3298. + * error
  3299. + * - encoding: Set by libavcodec if flags & AV_CODEC_FLAG_PSNR.
  3300. + * - decoding: unused
  3301. + */
  3302. + uint64_t error[AV_NUM_DATA_POINTERS];
  3303. +
  3304. + /**
  3305. + * DCT algorithm, see FF_DCT_* below
  3306. + * - encoding: Set by user.
  3307. + * - decoding: unused
  3308. + */
  3309. + int dct_algo;
  3310. +#define FF_DCT_AUTO 0
  3311. +#define FF_DCT_FASTINT 1
  3312. +#define FF_DCT_INT 2
  3313. +#define FF_DCT_MMX 3
  3314. +#define FF_DCT_ALTIVEC 5
  3315. +#define FF_DCT_FAAN 6
  3316. +
  3317. + /**
  3318. + * IDCT algorithm, see FF_IDCT_* below.
  3319. + * - encoding: Set by user.
  3320. + * - decoding: Set by user.
  3321. + */
  3322. + int idct_algo;
  3323. +#define FF_IDCT_AUTO 0
  3324. +#define FF_IDCT_INT 1
  3325. +#define FF_IDCT_SIMPLE 2
  3326. +#define FF_IDCT_SIMPLEMMX 3
  3327. +#define FF_IDCT_ARM 7
  3328. +#define FF_IDCT_ALTIVEC 8
  3329. +#define FF_IDCT_SIMPLEARM 10
  3330. +#define FF_IDCT_XVID 14
  3331. +#define FF_IDCT_SIMPLEARMV5TE 16
  3332. +#define FF_IDCT_SIMPLEARMV6 17
  3333. +#define FF_IDCT_FAAN 20
  3334. +#define FF_IDCT_SIMPLENEON 22
  3335. +#define FF_IDCT_NONE 24 /* Used by XvMC to extract IDCT coefficients with FF_IDCT_PERM_NONE */
  3336. +#define FF_IDCT_SIMPLEAUTO 128
  3337. +
  3338. + /**
  3339. + * bits per sample/pixel from the demuxer (needed for huffyuv).
  3340. + * - encoding: Set by libavcodec.
  3341. + * - decoding: Set by user.
  3342. + */
  3343. + int bits_per_coded_sample;
  3344. +
  3345. + /**
  3346. + * Bits per sample/pixel of internal libavcodec pixel/sample format.
  3347. + * - encoding: set by user.
  3348. + * - decoding: set by libavcodec.
  3349. + */
  3350. + int bits_per_raw_sample;
  3351. +
  3352. +#if FF_API_LOWRES
  3353. + /**
  3354. + * low resolution decoding, 1-> 1/2 size, 2->1/4 size
  3355. + * - encoding: unused
  3356. + * - decoding: Set by user.
  3357. + */
  3358. + int lowres;
  3359. +#endif
  3360. +
  3361. +#if FF_API_CODED_FRAME
  3362. + /**
  3363. + * the picture in the bitstream
  3364. + * - encoding: Set by libavcodec.
  3365. + * - decoding: unused
  3366. + *
  3367. + * @deprecated use the quality factor packet side data instead
  3368. + */
  3369. + attribute_deprecated AVFrame *coded_frame;
  3370. +#endif
  3371. +
  3372. + /**
  3373. + * thread count
  3374. + * is used to decide how many independent tasks should be passed to execute()
  3375. + * - encoding: Set by user.
  3376. + * - decoding: Set by user.
  3377. + */
  3378. + int thread_count;
  3379. +
  3380. + /**
  3381. + * Which multithreading methods to use.
  3382. + * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread,
  3383. + * so clients which cannot provide future frames should not use it.
  3384. + *
  3385. + * - encoding: Set by user, otherwise the default is used.
  3386. + * - decoding: Set by user, otherwise the default is used.
  3387. + */
  3388. + int thread_type;
  3389. +#define FF_THREAD_FRAME 1 ///< Decode more than one frame at once
  3390. +#define FF_THREAD_SLICE 2 ///< Decode more than one part of a single frame at once
  3391. +
  3392. + /**
  3393. + * Which multithreading methods are in use by the codec.
  3394. + * - encoding: Set by libavcodec.
  3395. + * - decoding: Set by libavcodec.
  3396. + */
  3397. + int active_thread_type;
  3398. +
  3399. + /**
  3400. + * Set by the client if its custom get_buffer() callback can be called
  3401. + * synchronously from another thread, which allows faster multithreaded decoding.
  3402. + * draw_horiz_band() will be called from other threads regardless of this setting.
  3403. + * Ignored if the default get_buffer() is used.
  3404. + * - encoding: Set by user.
  3405. + * - decoding: Set by user.
  3406. + */
  3407. + int thread_safe_callbacks;
  3408. +
  3409. + /**
  3410. + * The codec may call this to execute several independent things.
  3411. + * It will return only after finishing all tasks.
  3412. + * The user may replace this with some multithreaded implementation,
  3413. + * the default implementation will execute the parts serially.
  3414. + * @param count the number of things to execute
  3415. + * - encoding: Set by libavcodec, user can override.
  3416. + * - decoding: Set by libavcodec, user can override.
  3417. + */
  3418. + int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size);
  3419. +
  3420. + /**
  3421. + * The codec may call this to execute several independent things.
  3422. + * It will return only after finishing all tasks.
  3423. + * The user may replace this with some multithreaded implementation,
  3424. + * the default implementation will execute the parts serially.
  3425. + * Also see avcodec_thread_init and e.g. the --enable-pthread configure option.
  3426. + * @param c context passed also to func
  3427. + * @param count the number of things to execute
  3428. + * @param arg2 argument passed unchanged to func
  3429. + * @param ret return values of executed functions, must have space for "count" values. May be NULL.
  3430. + * @param func function that will be called count times, with jobnr from 0 to count-1.
  3431. + * threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS and so that no
  3432. + * two instances of func executing at the same time will have the same threadnr.
  3433. + * @return always 0 currently, but code should handle a future improvement where when any call to func
  3434. + * returns < 0 no further calls to func may be done and < 0 is returned.
  3435. + * - encoding: Set by libavcodec, user can override.
  3436. + * - decoding: Set by libavcodec, user can override.
  3437. + */
  3438. + int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count);
  3439. +
  3440. + /**
  3441. + * noise vs. sse weight for the nsse comparison function
  3442. + * - encoding: Set by user.
  3443. + * - decoding: unused
  3444. + */
  3445. + int nsse_weight;
  3446. +
  3447. + /**
  3448. + * profile
  3449. + * - encoding: Set by user.
  3450. + * - decoding: Set by libavcodec.
  3451. + */
  3452. + int profile;
  3453. +#define FF_PROFILE_UNKNOWN -99
  3454. +#define FF_PROFILE_RESERVED -100
  3455. +
  3456. +#define FF_PROFILE_AAC_MAIN 0
  3457. +#define FF_PROFILE_AAC_LOW 1
  3458. +#define FF_PROFILE_AAC_SSR 2
  3459. +#define FF_PROFILE_AAC_LTP 3
  3460. +#define FF_PROFILE_AAC_HE 4
  3461. +#define FF_PROFILE_AAC_HE_V2 28
  3462. +#define FF_PROFILE_AAC_LD 22
  3463. +#define FF_PROFILE_AAC_ELD 38
  3464. +#define FF_PROFILE_MPEG2_AAC_LOW 128
  3465. +#define FF_PROFILE_MPEG2_AAC_HE 131
  3466. +
  3467. +#define FF_PROFILE_DNXHD 0
  3468. +#define FF_PROFILE_DNXHR_LB 1
  3469. +#define FF_PROFILE_DNXHR_SQ 2
  3470. +#define FF_PROFILE_DNXHR_HQ 3
  3471. +#define FF_PROFILE_DNXHR_HQX 4
  3472. +#define FF_PROFILE_DNXHR_444 5
  3473. +
  3474. +#define FF_PROFILE_DTS 20
  3475. +#define FF_PROFILE_DTS_ES 30
  3476. +#define FF_PROFILE_DTS_96_24 40
  3477. +#define FF_PROFILE_DTS_HD_HRA 50
  3478. +#define FF_PROFILE_DTS_HD_MA 60
  3479. +#define FF_PROFILE_DTS_EXPRESS 70
  3480. +
  3481. +#define FF_PROFILE_MPEG2_422 0
  3482. +#define FF_PROFILE_MPEG2_HIGH 1
  3483. +#define FF_PROFILE_MPEG2_SS 2
  3484. +#define FF_PROFILE_MPEG2_SNR_SCALABLE 3
  3485. +#define FF_PROFILE_MPEG2_MAIN 4
  3486. +#define FF_PROFILE_MPEG2_SIMPLE 5
  3487. +
  3488. +#define FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag
  3489. +#define FF_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag
  3490. +
  3491. +#define FF_PROFILE_H264_BASELINE 66
  3492. +#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED)
  3493. +#define FF_PROFILE_H264_MAIN 77
  3494. +#define FF_PROFILE_H264_EXTENDED 88
  3495. +#define FF_PROFILE_H264_HIGH 100
  3496. +#define FF_PROFILE_H264_HIGH_10 110
  3497. +#define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA)
  3498. +#define FF_PROFILE_H264_MULTIVIEW_HIGH 118
  3499. +#define FF_PROFILE_H264_HIGH_422 122
  3500. +#define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA)
  3501. +#define FF_PROFILE_H264_STEREO_HIGH 128
  3502. +#define FF_PROFILE_H264_HIGH_444 144
  3503. +#define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244
  3504. +#define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA)
  3505. +#define FF_PROFILE_H264_CAVLC_444 44
  3506. +
  3507. +#define FF_PROFILE_VC1_SIMPLE 0
  3508. +#define FF_PROFILE_VC1_MAIN 1
  3509. +#define FF_PROFILE_VC1_COMPLEX 2
  3510. +#define FF_PROFILE_VC1_ADVANCED 3
  3511. +
  3512. +#define FF_PROFILE_MPEG4_SIMPLE 0
  3513. +#define FF_PROFILE_MPEG4_SIMPLE_SCALABLE 1
  3514. +#define FF_PROFILE_MPEG4_CORE 2
  3515. +#define FF_PROFILE_MPEG4_MAIN 3
  3516. +#define FF_PROFILE_MPEG4_N_BIT 4
  3517. +#define FF_PROFILE_MPEG4_SCALABLE_TEXTURE 5
  3518. +#define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6
  3519. +#define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7
  3520. +#define FF_PROFILE_MPEG4_HYBRID 8
  3521. +#define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME 9
  3522. +#define FF_PROFILE_MPEG4_CORE_SCALABLE 10
  3523. +#define FF_PROFILE_MPEG4_ADVANCED_CODING 11
  3524. +#define FF_PROFILE_MPEG4_ADVANCED_CORE 12
  3525. +#define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13
  3526. +#define FF_PROFILE_MPEG4_SIMPLE_STUDIO 14
  3527. +#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE 15
  3528. +
  3529. +#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0 1
  3530. +#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1 2
  3531. +#define FF_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION 32768
  3532. +#define FF_PROFILE_JPEG2000_DCINEMA_2K 3
  3533. +#define FF_PROFILE_JPEG2000_DCINEMA_4K 4
  3534. +
  3535. +#define FF_PROFILE_VP9_0 0
  3536. +#define FF_PROFILE_VP9_1 1
  3537. +#define FF_PROFILE_VP9_2 2
  3538. +#define FF_PROFILE_VP9_3 3
  3539. +
  3540. +#define FF_PROFILE_HEVC_MAIN 1
  3541. +#define FF_PROFILE_HEVC_MAIN_10 2
  3542. +#define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3
  3543. +#define FF_PROFILE_HEVC_REXT 4
  3544. +
  3545. +#define FF_PROFILE_AV1_MAIN 0
  3546. +#define FF_PROFILE_AV1_HIGH 1
  3547. +#define FF_PROFILE_AV1_PROFESSIONAL 2
  3548. +
  3549. +#define FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT 0xc0
  3550. +#define FF_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT 0xc1
  3551. +#define FF_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT 0xc2
  3552. +#define FF_PROFILE_MJPEG_HUFFMAN_LOSSLESS 0xc3
  3553. +#define FF_PROFILE_MJPEG_JPEG_LS 0xf7
  3554. +
  3555. +#define FF_PROFILE_SBC_MSBC 1
  3556. +
  3557. + /**
  3558. + * level
  3559. + * - encoding: Set by user.
  3560. + * - decoding: Set by libavcodec.
  3561. + */
  3562. + int level;
  3563. +#define FF_LEVEL_UNKNOWN -99
  3564. +
  3565. + /**
  3566. + * Skip loop filtering for selected frames.
  3567. + * - encoding: unused
  3568. + * - decoding: Set by user.
  3569. + */
  3570. + enum AVDiscard skip_loop_filter;
  3571. +
  3572. + /**
  3573. + * Skip IDCT/dequantization for selected frames.
  3574. + * - encoding: unused
  3575. + * - decoding: Set by user.
  3576. + */
  3577. + enum AVDiscard skip_idct;
  3578. +
  3579. + /**
  3580. + * Skip decoding for selected frames.
  3581. + * - encoding: unused
  3582. + * - decoding: Set by user.
  3583. + */
  3584. + enum AVDiscard skip_frame;
  3585. +
  3586. + /**
  3587. + * Header containing style information for text subtitles.
  3588. + * For SUBTITLE_ASS subtitle type, it should contain the whole ASS
  3589. + * [Script Info] and [V4+ Styles] section, plus the [Events] line and
  3590. + * the Format line following. It shouldn't include any Dialogue line.
  3591. + * - encoding: Set/allocated/freed by user (before avcodec_open2())
  3592. + * - decoding: Set/allocated/freed by libavcodec (by avcodec_open2())
  3593. + */
  3594. + uint8_t *subtitle_header;
  3595. + int subtitle_header_size;
  3596. +
  3597. +#if FF_API_VBV_DELAY
  3598. + /**
  3599. + * VBV delay coded in the last frame (in periods of a 27 MHz clock).
  3600. + * Used for compliant TS muxing.
  3601. + * - encoding: Set by libavcodec.
  3602. + * - decoding: unused.
  3603. + * @deprecated this value is now exported as a part of
  3604. + * AV_PKT_DATA_CPB_PROPERTIES packet side data
  3605. + */
  3606. + attribute_deprecated
  3607. + uint64_t vbv_delay;
  3608. +#endif
  3609. +
  3610. +#if FF_API_SIDEDATA_ONLY_PKT
  3611. + /**
  3612. + * Encoding only and set by default. Allow encoders to output packets
  3613. + * that do not contain any encoded data, only side data.
  3614. + *
  3615. + * Some encoders need to output such packets, e.g. to update some stream
  3616. + * parameters at the end of encoding.
  3617. + *
  3618. + * @deprecated this field disables the default behaviour and
  3619. + * it is kept only for compatibility.
  3620. + */
  3621. + attribute_deprecated
  3622. + int side_data_only_packets;
  3623. +#endif
  3624. +
  3625. + /**
  3626. + * Audio only. The number of "priming" samples (padding) inserted by the
  3627. + * encoder at the beginning of the audio. I.e. this number of leading
  3628. + * decoded samples must be discarded by the caller to get the original audio
  3629. + * without leading padding.
  3630. + *
  3631. + * - decoding: unused
  3632. + * - encoding: Set by libavcodec. The timestamps on the output packets are
  3633. + * adjusted by the encoder so that they always refer to the
  3634. + * first sample of the data actually contained in the packet,
  3635. + * including any added padding. E.g. if the timebase is
  3636. + * 1/samplerate and the timestamp of the first input sample is
  3637. + * 0, the timestamp of the first output packet will be
  3638. + * -initial_padding.
  3639. + */
  3640. + int initial_padding;
  3641. +
  3642. + /**
  3643. + * - decoding: For codecs that store a framerate value in the compressed
  3644. + * bitstream, the decoder may export it here. { 0, 1} when
  3645. + * unknown.
  3646. + * - encoding: May be used to signal the framerate of CFR content to an
  3647. + * encoder.
  3648. + */
  3649. + AVRational framerate;
  3650. +
  3651. + /**
  3652. + * Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
  3653. + * - encoding: unused.
  3654. + * - decoding: Set by libavcodec before calling get_format()
  3655. + */
  3656. + enum AVPixelFormat sw_pix_fmt;
  3657. +
  3658. + /**
  3659. + * Timebase in which pkt_dts/pts and AVPacket.dts/pts are.
  3660. + * - encoding unused.
  3661. + * - decoding set by user.
  3662. + */
  3663. + AVRational pkt_timebase;
  3664. +
  3665. + /**
  3666. + * AVCodecDescriptor
  3667. + * - encoding: unused.
  3668. + * - decoding: set by libavcodec.
  3669. + */
  3670. + const AVCodecDescriptor *codec_descriptor;
  3671. +
  3672. +#if !FF_API_LOWRES
  3673. + /**
  3674. + * low resolution decoding, 1-> 1/2 size, 2->1/4 size
  3675. + * - encoding: unused
  3676. + * - decoding: Set by user.
  3677. + */
  3678. + int lowres;
  3679. +#endif
  3680. +
  3681. + /**
  3682. + * Current statistics for PTS correction.
  3683. + * - decoding: maintained and used by libavcodec, not intended to be used by user apps
  3684. + * - encoding: unused
  3685. + */
  3686. + int64_t pts_correction_num_faulty_pts; /// Number of incorrect PTS values so far
  3687. + int64_t pts_correction_num_faulty_dts; /// Number of incorrect DTS values so far
  3688. + int64_t pts_correction_last_pts; /// PTS of the last frame
  3689. + int64_t pts_correction_last_dts; /// DTS of the last frame
  3690. +
  3691. + /**
  3692. + * Character encoding of the input subtitles file.
  3693. + * - decoding: set by user
  3694. + * - encoding: unused
  3695. + */
  3696. + char *sub_charenc;
  3697. +
  3698. + /**
  3699. + * Subtitles character encoding mode. Formats or codecs might be adjusting
  3700. + * this setting (if they are doing the conversion themselves for instance).
  3701. + * - decoding: set by libavcodec
  3702. + * - encoding: unused
  3703. + */
  3704. + int sub_charenc_mode;
  3705. +#define FF_SUB_CHARENC_MODE_DO_NOTHING -1 ///< do nothing (demuxer outputs a stream supposed to be already in UTF-8, or the codec is bitmap for instance)
  3706. +#define FF_SUB_CHARENC_MODE_AUTOMATIC 0 ///< libavcodec will select the mode itself
  3707. +#define FF_SUB_CHARENC_MODE_PRE_DECODER 1 ///< the AVPacket data needs to be recoded to UTF-8 before being fed to the decoder, requires iconv
  3708. +#define FF_SUB_CHARENC_MODE_IGNORE 2 ///< neither convert the subtitles, nor check them for valid UTF-8
  3709. +
  3710. + /**
  3711. + * Skip processing alpha if supported by codec.
  3712. + * Note that if the format uses pre-multiplied alpha (common with VP6,
  3713. + * and recommended due to better video quality/compression)
  3714. + * the image will look as if alpha-blended onto a black background.
  3715. + * However for formats that do not use pre-multiplied alpha
  3716. + * there might be serious artefacts (though e.g. libswscale currently
  3717. + * assumes pre-multiplied alpha anyway).
  3718. + *
  3719. + * - decoding: set by user
  3720. + * - encoding: unused
  3721. + */
  3722. + int skip_alpha;
  3723. +
  3724. + /**
  3725. + * Number of samples to skip after a discontinuity
  3726. + * - decoding: unused
  3727. + * - encoding: set by libavcodec
  3728. + */
  3729. + int seek_preroll;
  3730. +
  3731. +#if !FF_API_DEBUG_MV
  3732. + /**
  3733. + * debug motion vectors
  3734. + * - encoding: Set by user.
  3735. + * - decoding: Set by user.
  3736. + */
  3737. + int debug_mv;
  3738. +#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames
  3739. +#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames
  3740. +#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
  3741. +#endif
  3742. +
  3743. + /**
  3744. + * custom intra quantization matrix
  3745. + * - encoding: Set by user, can be NULL.
  3746. + * - decoding: unused.
  3747. + */
  3748. + uint16_t *chroma_intra_matrix;
  3749. +
  3750. + /**
  3751. + * dump format separator.
  3752. + * can be ", " or "\n " or anything else
  3753. + * - encoding: Set by user.
  3754. + * - decoding: Set by user.
  3755. + */
  3756. + uint8_t *dump_separator;
  3757. +
  3758. + /**
  3759. + * ',' separated list of allowed decoders.
  3760. + * If NULL then all are allowed
  3761. + * - encoding: unused
  3762. + * - decoding: set by user
  3763. + */
  3764. + char *codec_whitelist;
  3765. +
  3766. + /**
  3767. + * Properties of the stream that gets decoded
  3768. + * - encoding: unused
  3769. + * - decoding: set by libavcodec
  3770. + */
  3771. + unsigned properties;
  3772. +#define FF_CODEC_PROPERTY_LOSSLESS 0x00000001
  3773. +#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x00000002
  3774. +
  3775. + /**
  3776. + * Additional data associated with the entire coded stream.
  3777. + *
  3778. + * - decoding: unused
  3779. + * - encoding: may be set by libavcodec after avcodec_open2().
  3780. + */
  3781. + AVPacketSideData *coded_side_data;
  3782. + int nb_coded_side_data;
  3783. +
  3784. + /**
  3785. + * A reference to the AVHWFramesContext describing the input (for encoding)
  3786. + * or output (decoding) frames. The reference is set by the caller and
  3787. + * afterwards owned (and freed) by libavcodec - it should never be read by
  3788. + * the caller after being set.
  3789. + *
  3790. + * - decoding: This field should be set by the caller from the get_format()
  3791. + * callback. The previous reference (if any) will always be
  3792. + * unreffed by libavcodec before the get_format() call.
  3793. + *
  3794. + * If the default get_buffer2() is used with a hwaccel pixel
  3795. + * format, then this AVHWFramesContext will be used for
  3796. + * allocating the frame buffers.
  3797. + *
  3798. + * - encoding: For hardware encoders configured to use a hwaccel pixel
  3799. + * format, this field should be set by the caller to a reference
  3800. + * to the AVHWFramesContext describing input frames.
  3801. + * AVHWFramesContext.format must be equal to
  3802. + * AVCodecContext.pix_fmt.
  3803. + *
  3804. + * This field should be set before avcodec_open2() is called.
  3805. + */
  3806. + AVBufferRef *hw_frames_ctx;
  3807. +
  3808. + /**
  3809. + * Control the form of AVSubtitle.rects[N]->ass
  3810. + * - decoding: set by user
  3811. + * - encoding: unused
  3812. + */
  3813. + int sub_text_format;
  3814. +#define FF_SUB_TEXT_FMT_ASS 0
  3815. +#if FF_API_ASS_TIMING
  3816. +#define FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS 1
  3817. +#endif
  3818. +
  3819. + /**
  3820. + * Audio only. The amount of padding (in samples) appended by the encoder to
  3821. + * the end of the audio. I.e. this number of decoded samples must be
  3822. + * discarded by the caller from the end of the stream to get the original
  3823. + * audio without any trailing padding.
  3824. + *
  3825. + * - decoding: unused
  3826. + * - encoding: unused
  3827. + */
  3828. + int trailing_padding;
  3829. +
  3830. + /**
  3831. + * The number of pixels per image to maximally accept.
  3832. + *
  3833. + * - decoding: set by user
  3834. + * - encoding: set by user
  3835. + */
  3836. + int64_t max_pixels;
  3837. +
  3838. + /**
  3839. + * A reference to the AVHWDeviceContext describing the device which will
  3840. + * be used by a hardware encoder/decoder. The reference is set by the
  3841. + * caller and afterwards owned (and freed) by libavcodec.
  3842. + *
  3843. + * This should be used if either the codec device does not require
  3844. + * hardware frames or any that are used are to be allocated internally by
  3845. + * libavcodec. If the user wishes to supply any of the frames used as
  3846. + * encoder input or decoder output then hw_frames_ctx should be used
  3847. + * instead. When hw_frames_ctx is set in get_format() for a decoder, this
  3848. + * field will be ignored while decoding the associated stream segment, but
  3849. + * may again be used on a following one after another get_format() call.
  3850. + *
  3851. + * For both encoders and decoders this field should be set before
  3852. + * avcodec_open2() is called and must not be written to thereafter.
  3853. + *
  3854. + * Note that some decoders may require this field to be set initially in
  3855. + * order to support hw_frames_ctx at all - in that case, all frames
  3856. + * contexts used must be created on the same device.
  3857. + */
  3858. + AVBufferRef *hw_device_ctx;
  3859. +
  3860. + /**
  3861. + * Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated
  3862. + * decoding (if active).
  3863. + * - encoding: unused
  3864. + * - decoding: Set by user (either before avcodec_open2(), or in the
  3865. + * AVCodecContext.get_format callback)
  3866. + */
  3867. + int hwaccel_flags;
  3868. +
  3869. + /**
  3870. + * Video decoding only. Certain video codecs support cropping, meaning that
  3871. + * only a sub-rectangle of the decoded frame is intended for display. This
  3872. + * option controls how cropping is handled by libavcodec.
  3873. + *
  3874. + * When set to 1 (the default), libavcodec will apply cropping internally.
  3875. + * I.e. it will modify the output frame width/height fields and offset the
  3876. + * data pointers (only by as much as possible while preserving alignment, or
  3877. + * by the full amount if the AV_CODEC_FLAG_UNALIGNED flag is set) so that
  3878. + * the frames output by the decoder refer only to the cropped area. The
  3879. + * crop_* fields of the output frames will be zero.
  3880. + *
  3881. + * When set to 0, the width/height fields of the output frames will be set
  3882. + * to the coded dimensions and the crop_* fields will describe the cropping
  3883. + * rectangle. Applying the cropping is left to the caller.
  3884. + *
  3885. + * @warning When hardware acceleration with opaque output frames is used,
  3886. + * libavcodec is unable to apply cropping from the top/left border.
  3887. + *
  3888. + * @note when this option is set to zero, the width/height fields of the
  3889. + * AVCodecContext and output AVFrames have different meanings. The codec
  3890. + * context fields store display dimensions (with the coded dimensions in
  3891. + * coded_width/height), while the frame fields store the coded dimensions
  3892. + * (with the display dimensions being determined by the crop_* fields).
  3893. + */
  3894. + int apply_cropping;
  3895. +
  3896. + /*
  3897. + * Video decoding only. Sets the number of extra hardware frames which
  3898. + * the decoder will allocate for use by the caller. This must be set
  3899. + * before avcodec_open2() is called.
  3900. + *
  3901. + * Some hardware decoders require all frames that they will use for
  3902. + * output to be defined in advance before decoding starts. For such
  3903. + * decoders, the hardware frame pool must therefore be of a fixed size.
  3904. + * The extra frames set here are on top of any number that the decoder
  3905. + * needs internally in order to operate normally (for example, frames
  3906. + * used as reference pictures).
  3907. + */
  3908. + int extra_hw_frames;
  3909. +} AVCodecContext;
  3910. +
  3911. +#if FF_API_CODEC_GET_SET
  3912. +/**
  3913. + * Accessors for some AVCodecContext fields. These used to be provided for ABI
  3914. + * compatibility, and do not need to be used anymore.
  3915. + */
  3916. +attribute_deprecated
  3917. +AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx);
  3918. +attribute_deprecated
  3919. +void av_codec_set_pkt_timebase (AVCodecContext *avctx, AVRational val);
  3920. +
  3921. +attribute_deprecated
  3922. +const AVCodecDescriptor *av_codec_get_codec_descriptor(const AVCodecContext *avctx);
  3923. +attribute_deprecated
  3924. +void av_codec_set_codec_descriptor(AVCodecContext *avctx, const AVCodecDescriptor *desc);
  3925. +
  3926. +attribute_deprecated
  3927. +unsigned av_codec_get_codec_properties(const AVCodecContext *avctx);
  3928. +
  3929. +#if FF_API_LOWRES
  3930. +attribute_deprecated
  3931. +int av_codec_get_lowres(const AVCodecContext *avctx);
  3932. +attribute_deprecated
  3933. +void av_codec_set_lowres(AVCodecContext *avctx, int val);
  3934. +#endif
  3935. +
  3936. +attribute_deprecated
  3937. +int av_codec_get_seek_preroll(const AVCodecContext *avctx);
  3938. +attribute_deprecated
  3939. +void av_codec_set_seek_preroll(AVCodecContext *avctx, int val);
  3940. +
  3941. +attribute_deprecated
  3942. +uint16_t *av_codec_get_chroma_intra_matrix(const AVCodecContext *avctx);
  3943. +attribute_deprecated
  3944. +void av_codec_set_chroma_intra_matrix(AVCodecContext *avctx, uint16_t *val);
  3945. +#endif
  3946. +
  3947. +/**
  3948. + * AVProfile.
  3949. + */
  3950. +typedef struct AVProfile {
  3951. + int profile;
  3952. + const char *name; ///< short name for the profile
  3953. +} AVProfile;
  3954. +
  3955. +enum {
  3956. + /**
  3957. + * The codec supports this format via the hw_device_ctx interface.
  3958. + *
  3959. + * When selecting this format, AVCodecContext.hw_device_ctx should
  3960. + * have been set to a device of the specified type before calling
  3961. + * avcodec_open2().
  3962. + */
  3963. + AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX = 0x01,
  3964. + /**
  3965. + * The codec supports this format via the hw_frames_ctx interface.
  3966. + *
  3967. + * When selecting this format for a decoder,
  3968. + * AVCodecContext.hw_frames_ctx should be set to a suitable frames
  3969. + * context inside the get_format() callback. The frames context
  3970. + * must have been created on a device of the specified type.
  3971. + */
  3972. + AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX = 0x02,
  3973. + /**
  3974. + * The codec supports this format by some internal method.
  3975. + *
  3976. + * This format can be selected without any additional configuration -
  3977. + * no device or frames context is required.
  3978. + */
  3979. + AV_CODEC_HW_CONFIG_METHOD_INTERNAL = 0x04,
  3980. + /**
  3981. + * The codec supports this format by some ad-hoc method.
  3982. + *
  3983. + * Additional settings and/or function calls are required. See the
  3984. + * codec-specific documentation for details. (Methods requiring
  3985. + * this sort of configuration are deprecated and others should be
  3986. + * used in preference.)
  3987. + */
  3988. + AV_CODEC_HW_CONFIG_METHOD_AD_HOC = 0x08,
  3989. +};
  3990. +
  3991. +typedef struct AVCodecHWConfig {
  3992. + /**
  3993. + * A hardware pixel format which the codec can use.
  3994. + */
  3995. + enum AVPixelFormat pix_fmt;
  3996. + /**
  3997. + * Bit set of AV_CODEC_HW_CONFIG_METHOD_* flags, describing the possible
  3998. + * setup methods which can be used with this configuration.
  3999. + */
  4000. + int methods;
  4001. + /**
  4002. + * The device type associated with the configuration.
  4003. + *
  4004. + * Must be set for AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX and
  4005. + * AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX, otherwise unused.
  4006. + */
  4007. + enum AVHWDeviceType device_type;
  4008. +} AVCodecHWConfig;
  4009. +
  4010. +typedef struct AVCodecDefault AVCodecDefault;
  4011. +
  4012. +struct AVSubtitle;
  4013. +
  4014. +/**
  4015. + * AVCodec.
  4016. + */
  4017. +typedef struct AVCodec {
  4018. + /**
  4019. + * Name of the codec implementation.
  4020. + * The name is globally unique among encoders and among decoders (but an
  4021. + * encoder and a decoder can share the same name).
  4022. + * This is the primary way to find a codec from the user perspective.
  4023. + */
  4024. + const char *name;
  4025. + /**
  4026. + * Descriptive name for the codec, meant to be more human readable than name.
  4027. + * You should use the NULL_IF_CONFIG_SMALL() macro to define it.
  4028. + */
  4029. + const char *long_name;
  4030. + enum AVMediaType type;
  4031. + enum AVCodecID id;
  4032. + /**
  4033. + * Codec capabilities.
  4034. + * see AV_CODEC_CAP_*
  4035. + */
  4036. + int capabilities;
  4037. + const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0}
  4038. + const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1
  4039. + const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
  4040. + const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
  4041. + const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
  4042. + uint8_t max_lowres; ///< maximum value for lowres supported by the decoder
  4043. + const AVClass *priv_class; ///< AVClass for the private context
  4044. + const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
  4045. +
  4046. + /**
  4047. + * Group name of the codec implementation.
  4048. + * This is a short symbolic name of the wrapper backing this codec. A
  4049. + * wrapper uses some kind of external implementation for the codec, such
  4050. + * as an external library, or a codec implementation provided by the OS or
  4051. + * the hardware.
  4052. + * If this field is NULL, this is a builtin, libavcodec native codec.
  4053. + * If non-NULL, this will be the suffix in AVCodec.name in most cases
  4054. + * (usually AVCodec.name will be of the form "<codec_name>_<wrapper_name>").
  4055. + */
  4056. + const char *wrapper_name;
  4057. +
  4058. + /*****************************************************************
  4059. + * No fields below this line are part of the public API. They
  4060. + * may not be used outside of libavcodec and can be changed and
  4061. + * removed at will.
  4062. + * New public fields should be added right above.
  4063. + *****************************************************************
  4064. + */
  4065. + int priv_data_size;
  4066. + struct AVCodec *next;
  4067. + /**
  4068. + * @name Frame-level threading support functions
  4069. + * @{
  4070. + */
  4071. + /**
  4072. + * If defined, called on thread contexts when they are created.
  4073. + * If the codec allocates writable tables in init(), re-allocate them here.
  4074. + * priv_data will be set to a copy of the original.
  4075. + */
  4076. + int (*init_thread_copy)(AVCodecContext *);
  4077. + /**
  4078. + * Copy necessary context variables from a previous thread context to the current one.
  4079. + * If not defined, the next thread will start automatically; otherwise, the codec
  4080. + * must call ff_thread_finish_setup().
  4081. + *
  4082. + * dst and src will (rarely) point to the same context, in which case memcpy should be skipped.
  4083. + */
  4084. + int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src);
  4085. + /** @} */
  4086. +
  4087. + /**
  4088. + * Private codec-specific defaults.
  4089. + */
  4090. + const AVCodecDefault *defaults;
  4091. +
  4092. + /**
  4093. + * Initialize codec static data, called from avcodec_register().
  4094. + *
  4095. + * This is not intended for time consuming operations as it is
  4096. + * run for every codec regardless of that codec being used.
  4097. + */
  4098. + void (*init_static_data)(struct AVCodec *codec);
  4099. +
  4100. + int (*init)(AVCodecContext *);
  4101. + int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size,
  4102. + const struct AVSubtitle *sub);
  4103. + /**
  4104. + * Encode data to an AVPacket.
  4105. + *
  4106. + * @param avctx codec context
  4107. + * @param avpkt output AVPacket (may contain a user-provided buffer)
  4108. + * @param[in] frame AVFrame containing the raw data to be encoded
  4109. + * @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a
  4110. + * non-empty packet was returned in avpkt.
  4111. + * @return 0 on success, negative error code on failure
  4112. + */
  4113. + int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame,
  4114. + int *got_packet_ptr);
  4115. + int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt);
  4116. + int (*close)(AVCodecContext *);
  4117. + /**
  4118. + * Encode API with decoupled packet/frame dataflow. The API is the
  4119. + * same as the avcodec_ prefixed APIs (avcodec_send_frame() etc.), except
  4120. + * that:
  4121. + * - never called if the codec is closed or the wrong type,
  4122. + * - if AV_CODEC_CAP_DELAY is not set, drain frames are never sent,
  4123. + * - only one drain frame is ever passed down,
  4124. + */
  4125. + int (*send_frame)(AVCodecContext *avctx, const AVFrame *frame);
  4126. + int (*receive_packet)(AVCodecContext *avctx, AVPacket *avpkt);
  4127. +
  4128. + /**
  4129. + * Decode API with decoupled packet/frame dataflow. This function is called
  4130. + * to get one output frame. It should call ff_decode_get_packet() to obtain
  4131. + * input data.
  4132. + */
  4133. + int (*receive_frame)(AVCodecContext *avctx, AVFrame *frame);
  4134. + /**
  4135. + * Flush buffers.
  4136. + * Will be called when seeking
  4137. + */
  4138. + void (*flush)(AVCodecContext *);
  4139. + /**
  4140. + * Internal codec capabilities.
  4141. + * See FF_CODEC_CAP_* in internal.h
  4142. + */
  4143. + int caps_internal;
  4144. +
  4145. + /**
  4146. + * Decoding only, a comma-separated list of bitstream filters to apply to
  4147. + * packets before decoding.
  4148. + */
  4149. + const char *bsfs;
  4150. +
  4151. + /**
  4152. + * Array of pointers to hardware configurations supported by the codec,
  4153. + * or NULL if no hardware supported. The array is terminated by a NULL
  4154. + * pointer.
  4155. + *
  4156. + * The user can only access this field via avcodec_get_hw_config().
  4157. + */
  4158. + const struct AVCodecHWConfigInternal **hw_configs;
  4159. +} AVCodec;
  4160. +
  4161. +#if FF_API_CODEC_GET_SET
  4162. +attribute_deprecated
  4163. +int av_codec_get_max_lowres(const AVCodec *codec);
  4164. +#endif
  4165. +
  4166. +struct MpegEncContext;
  4167. +
  4168. +/**
  4169. + * Retrieve supported hardware configurations for a codec.
  4170. + *
  4171. + * Values of index from zero to some maximum return the indexed configuration
  4172. + * descriptor; all other values return NULL. If the codec does not support
  4173. + * any hardware configurations then it will always return NULL.
  4174. + */
  4175. +const AVCodecHWConfig *avcodec_get_hw_config(const AVCodec *codec, int index);
  4176. +
  4177. +/**
  4178. + * @defgroup lavc_hwaccel AVHWAccel
  4179. + *
  4180. + * @note Nothing in this structure should be accessed by the user. At some
  4181. + * point in future it will not be externally visible at all.
  4182. + *
  4183. + * @{
  4184. + */
  4185. +typedef struct AVHWAccel {
  4186. + /**
  4187. + * Name of the hardware accelerated codec.
  4188. + * The name is globally unique among encoders and among decoders (but an
  4189. + * encoder and a decoder can share the same name).
  4190. + */
  4191. + const char *name;
  4192. +
  4193. + /**
  4194. + * Type of codec implemented by the hardware accelerator.
  4195. + *
  4196. + * See AVMEDIA_TYPE_xxx
  4197. + */
  4198. + enum AVMediaType type;
  4199. +
  4200. + /**
  4201. + * Codec implemented by the hardware accelerator.
  4202. + *
  4203. + * See AV_CODEC_ID_xxx
  4204. + */
  4205. + enum AVCodecID id;
  4206. +
  4207. + /**
  4208. + * Supported pixel format.
  4209. + *
  4210. + * Only hardware accelerated formats are supported here.
  4211. + */
  4212. + enum AVPixelFormat pix_fmt;
  4213. +
  4214. + /**
  4215. + * Hardware accelerated codec capabilities.
  4216. + * see AV_HWACCEL_CODEC_CAP_*
  4217. + */
  4218. + int capabilities;
  4219. +
  4220. + /*****************************************************************
  4221. + * No fields below this line are part of the public API. They
  4222. + * may not be used outside of libavcodec and can be changed and
  4223. + * removed at will.
  4224. + * New public fields should be added right above.
  4225. + *****************************************************************
  4226. + */
  4227. +
  4228. + /**
  4229. + * Allocate a custom buffer
  4230. + */
  4231. + int (*alloc_frame)(AVCodecContext *avctx, AVFrame *frame);
  4232. +
  4233. + /**
  4234. + * Called at the beginning of each frame or field picture.
  4235. + *
  4236. + * Meaningful frame information (codec specific) is guaranteed to
  4237. + * be parsed at this point. This function is mandatory.
  4238. + *
  4239. + * Note that buf can be NULL along with buf_size set to 0.
  4240. + * Otherwise, this means the whole frame is available at this point.
  4241. + *
  4242. + * @param avctx the codec context
  4243. + * @param buf the frame data buffer base
  4244. + * @param buf_size the size of the frame in bytes
  4245. + * @return zero if successful, a negative value otherwise
  4246. + */
  4247. + int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
  4248. +
  4249. + /**
  4250. + * Callback for parameter data (SPS/PPS/VPS etc).
  4251. + *
  4252. + * Useful for hardware decoders which keep persistent state about the
  4253. + * video parameters, and need to receive any changes to update that state.
  4254. + *
  4255. + * @param avctx the codec context
  4256. + * @param type the nal unit type
  4257. + * @param buf the nal unit data buffer
  4258. + * @param buf_size the size of the nal unit in bytes
  4259. + * @return zero if successful, a negative value otherwise
  4260. + */
  4261. + int (*decode_params)(AVCodecContext *avctx, int type, const uint8_t *buf, uint32_t buf_size);
  4262. +
  4263. + /**
  4264. + * Callback for each slice.
  4265. + *
  4266. + * Meaningful slice information (codec specific) is guaranteed to
  4267. + * be parsed at this point. This function is mandatory.
  4268. + * The only exception is XvMC, that works on MB level.
  4269. + *
  4270. + * @param avctx the codec context
  4271. + * @param buf the slice data buffer base
  4272. + * @param buf_size the size of the slice in bytes
  4273. + * @return zero if successful, a negative value otherwise
  4274. + */
  4275. + int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
  4276. +
  4277. + /**
  4278. + * Called at the end of each frame or field picture.
  4279. + *
  4280. + * The whole picture is parsed at this point and can now be sent
  4281. + * to the hardware accelerator. This function is mandatory.
  4282. + *
  4283. + * @param avctx the codec context
  4284. + * @return zero if successful, a negative value otherwise
  4285. + */
  4286. + int (*end_frame)(AVCodecContext *avctx);
  4287. +
  4288. + /**
  4289. + * Size of per-frame hardware accelerator private data.
  4290. + *
  4291. + * Private data is allocated with av_mallocz() before
  4292. + * AVCodecContext.get_buffer() and deallocated after
  4293. + * AVCodecContext.release_buffer().
  4294. + */
  4295. + int frame_priv_data_size;
  4296. +
  4297. + /**
  4298. + * Called for every Macroblock in a slice.
  4299. + *
  4300. + * XvMC uses it to replace the ff_mpv_reconstruct_mb().
  4301. + * Instead of decoding to raw picture, MB parameters are
  4302. + * stored in an array provided by the video driver.
  4303. + *
  4304. + * @param s the mpeg context
  4305. + */
  4306. + void (*decode_mb)(struct MpegEncContext *s);
  4307. +
  4308. + /**
  4309. + * Initialize the hwaccel private data.
  4310. + *
  4311. + * This will be called from ff_get_format(), after hwaccel and
  4312. + * hwaccel_context are set and the hwaccel private data in AVCodecInternal
  4313. + * is allocated.
  4314. + */
  4315. + int (*init)(AVCodecContext *avctx);
  4316. +
  4317. + /**
  4318. + * Uninitialize the hwaccel private data.
  4319. + *
  4320. + * This will be called from get_format() or avcodec_close(), after hwaccel
  4321. + * and hwaccel_context are already uninitialized.
  4322. + */
  4323. + int (*uninit)(AVCodecContext *avctx);
  4324. +
  4325. + /**
  4326. + * Size of the private data to allocate in
  4327. + * AVCodecInternal.hwaccel_priv_data.
  4328. + */
  4329. + int priv_data_size;
  4330. +
  4331. + /**
  4332. + * Internal hwaccel capabilities.
  4333. + */
  4334. + int caps_internal;
  4335. +
  4336. + /**
  4337. + * Fill the given hw_frames context with current codec parameters. Called
  4338. + * from get_format. Refer to avcodec_get_hw_frames_parameters() for
  4339. + * details.
  4340. + *
  4341. + * This CAN be called before AVHWAccel.init is called, and you must assume
  4342. + * that avctx->hwaccel_priv_data is invalid.
  4343. + */
  4344. + int (*frame_params)(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx);
  4345. +} AVHWAccel;
  4346. +
  4347. +/**
  4348. + * HWAccel is experimental and is thus avoided in favor of non experimental
  4349. + * codecs
  4350. + */
  4351. +#define AV_HWACCEL_CODEC_CAP_EXPERIMENTAL 0x0200
  4352. +
  4353. +/**
  4354. + * Hardware acceleration should be used for decoding even if the codec level
  4355. + * used is unknown or higher than the maximum supported level reported by the
  4356. + * hardware driver.
  4357. + *
  4358. + * It's generally a good idea to pass this flag unless you have a specific
  4359. + * reason not to, as hardware tends to under-report supported levels.
  4360. + */
  4361. +#define AV_HWACCEL_FLAG_IGNORE_LEVEL (1 << 0)
  4362. +
  4363. +/**
  4364. + * Hardware acceleration can output YUV pixel formats with a different chroma
  4365. + * sampling than 4:2:0 and/or other than 8 bits per component.
  4366. + */
  4367. +#define AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH (1 << 1)
  4368. +
  4369. +/**
  4370. + * Hardware acceleration should still be attempted for decoding when the
  4371. + * codec profile does not match the reported capabilities of the hardware.
  4372. + *
  4373. + * For example, this can be used to try to decode baseline profile H.264
  4374. + * streams in hardware - it will often succeed, because many streams marked
  4375. + * as baseline profile actually conform to constrained baseline profile.
  4376. + *
  4377. + * @warning If the stream is actually not supported then the behaviour is
  4378. + * undefined, and may include returning entirely incorrect output
  4379. + * while indicating success.
  4380. + */
  4381. +#define AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH (1 << 2)
  4382. +
  4383. +/**
  4384. + * @}
  4385. + */
  4386. +
  4387. +#if FF_API_AVPICTURE
  4388. +/**
  4389. + * @defgroup lavc_picture AVPicture
  4390. + *
  4391. + * Functions for working with AVPicture
  4392. + * @{
  4393. + */
  4394. +
  4395. +/**
  4396. + * Picture data structure.
  4397. + *
  4398. + * Up to four components can be stored into it, the last component is
  4399. + * alpha.
  4400. + * @deprecated use AVFrame or imgutils functions instead
  4401. + */
  4402. +typedef struct AVPicture {
  4403. + attribute_deprecated
  4404. + uint8_t *data[AV_NUM_DATA_POINTERS]; ///< pointers to the image data planes
  4405. + attribute_deprecated
  4406. + int linesize[AV_NUM_DATA_POINTERS]; ///< number of bytes per line
  4407. +} AVPicture;
  4408. +
  4409. +/**
  4410. + * @}
  4411. + */
  4412. +#endif
  4413. +
  4414. +enum AVSubtitleType {
  4415. + SUBTITLE_NONE,
  4416. +
  4417. + SUBTITLE_BITMAP, ///< A bitmap, pict will be set
  4418. +
  4419. + /**
  4420. + * Plain text, the text field must be set by the decoder and is
  4421. + * authoritative. ass and pict fields may contain approximations.
  4422. + */
  4423. + SUBTITLE_TEXT,
  4424. +
  4425. + /**
  4426. + * Formatted text, the ass field must be set by the decoder and is
  4427. + * authoritative. pict and text fields may contain approximations.
  4428. + */
  4429. + SUBTITLE_ASS,
  4430. +};
  4431. +
  4432. +#define AV_SUBTITLE_FLAG_FORCED 0x00000001
  4433. +
  4434. +typedef struct AVSubtitleRect {
  4435. + int x; ///< top left corner of pict, undefined when pict is not set
  4436. + int y; ///< top left corner of pict, undefined when pict is not set
  4437. + int w; ///< width of pict, undefined when pict is not set
  4438. + int h; ///< height of pict, undefined when pict is not set
  4439. + int nb_colors; ///< number of colors in pict, undefined when pict is not set
  4440. +
  4441. +#if FF_API_AVPICTURE
  4442. + /**
  4443. + * @deprecated unused
  4444. + */
  4445. + attribute_deprecated
  4446. + AVPicture pict;
  4447. +#endif
  4448. + /**
  4449. + * data+linesize for the bitmap of this subtitle.
  4450. + * Can be set for text/ass as well once they are rendered.
  4451. + */
  4452. + uint8_t *data[4];
  4453. + int linesize[4];
  4454. +
  4455. + enum AVSubtitleType type;
  4456. +
  4457. + char *text; ///< 0 terminated plain UTF-8 text
  4458. +
  4459. + /**
  4460. + * 0 terminated ASS/SSA compatible event line.
  4461. + * The presentation of this is unaffected by the other values in this
  4462. + * struct.
  4463. + */
  4464. + char *ass;
  4465. +
  4466. + int flags;
  4467. +} AVSubtitleRect;
  4468. +
  4469. +typedef struct AVSubtitle {
  4470. + uint16_t format; /* 0 = graphics */
  4471. + uint32_t start_display_time; /* relative to packet pts, in ms */
  4472. + uint32_t end_display_time; /* relative to packet pts, in ms */
  4473. + unsigned num_rects;
  4474. + AVSubtitleRect **rects;
  4475. + int64_t pts; ///< Same as packet pts, in AV_TIME_BASE
  4476. +} AVSubtitle;
  4477. +
  4478. +/**
  4479. + * This struct describes the properties of an encoded stream.
  4480. + *
  4481. + * sizeof(AVCodecParameters) is not a part of the public ABI, this struct must
  4482. + * be allocated with avcodec_parameters_alloc() and freed with
  4483. + * avcodec_parameters_free().
  4484. + */
  4485. +typedef struct AVCodecParameters {
  4486. + /**
  4487. + * General type of the encoded data.
  4488. + */
  4489. + enum AVMediaType codec_type;
  4490. + /**
  4491. + * Specific type of the encoded data (the codec used).
  4492. + */
  4493. + enum AVCodecID codec_id;
  4494. + /**
  4495. + * Additional information about the codec (corresponds to the AVI FOURCC).
  4496. + */
  4497. + uint32_t codec_tag;
  4498. +
  4499. + /**
  4500. + * Extra binary data needed for initializing the decoder, codec-dependent.
  4501. + *
  4502. + * Must be allocated with av_malloc() and will be freed by
  4503. + * avcodec_parameters_free(). The allocated size of extradata must be at
  4504. + * least extradata_size + AV_INPUT_BUFFER_PADDING_SIZE, with the padding
  4505. + * bytes zeroed.
  4506. + */
  4507. + uint8_t *extradata;
  4508. + /**
  4509. + * Size of the extradata content in bytes.
  4510. + */
  4511. + int extradata_size;
  4512. +
  4513. + /**
  4514. + * - video: the pixel format, the value corresponds to enum AVPixelFormat.
  4515. + * - audio: the sample format, the value corresponds to enum AVSampleFormat.
  4516. + */
  4517. + int format;
  4518. +
  4519. + /**
  4520. + * The average bitrate of the encoded data (in bits per second).
  4521. + */
  4522. + int64_t bit_rate;
  4523. +
  4524. + /**
  4525. + * The number of bits per sample in the codedwords.
  4526. + *
  4527. + * This is basically the bitrate per sample. It is mandatory for a bunch of
  4528. + * formats to actually decode them. It's the number of bits for one sample in
  4529. + * the actual coded bitstream.
  4530. + *
  4531. + * This could be for example 4 for ADPCM
  4532. + * For PCM formats this matches bits_per_raw_sample
  4533. + * Can be 0
  4534. + */
  4535. + int bits_per_coded_sample;
  4536. +
  4537. + /**
  4538. + * This is the number of valid bits in each output sample. If the
  4539. + * sample format has more bits, the least significant bits are additional
  4540. + * padding bits, which are always 0. Use right shifts to reduce the sample
  4541. + * to its actual size. For example, audio formats with 24 bit samples will
  4542. + * have bits_per_raw_sample set to 24, and format set to AV_SAMPLE_FMT_S32.
  4543. + * To get the original sample use "(int32_t)sample >> 8"."
  4544. + *
  4545. + * For ADPCM this might be 12 or 16 or similar
  4546. + * Can be 0
  4547. + */
  4548. + int bits_per_raw_sample;
  4549. +
  4550. + /**
  4551. + * Codec-specific bitstream restrictions that the stream conforms to.
  4552. + */
  4553. + int profile;
  4554. + int level;
  4555. +
  4556. + /**
  4557. + * Video only. The dimensions of the video frame in pixels.
  4558. + */
  4559. + int width;
  4560. + int height;
  4561. +
  4562. + /**
  4563. + * Video only. The aspect ratio (width / height) which a single pixel
  4564. + * should have when displayed.
  4565. + *
  4566. + * When the aspect ratio is unknown / undefined, the numerator should be
  4567. + * set to 0 (the denominator may have any value).
  4568. + */
  4569. + AVRational sample_aspect_ratio;
  4570. +
  4571. + /**
  4572. + * Video only. The order of the fields in interlaced video.
  4573. + */
  4574. + enum AVFieldOrder field_order;
  4575. +
  4576. + /**
  4577. + * Video only. Additional colorspace characteristics.
  4578. + */
  4579. + enum AVColorRange color_range;
  4580. + enum AVColorPrimaries color_primaries;
  4581. + enum AVColorTransferCharacteristic color_trc;
  4582. + enum AVColorSpace color_space;
  4583. + enum AVChromaLocation chroma_location;
  4584. +
  4585. + /**
  4586. + * Video only. Number of delayed frames.
  4587. + */
  4588. + int video_delay;
  4589. +
  4590. + /**
  4591. + * Audio only. The channel layout bitmask. May be 0 if the channel layout is
  4592. + * unknown or unspecified, otherwise the number of bits set must be equal to
  4593. + * the channels field.
  4594. + */
  4595. + uint64_t channel_layout;
  4596. + /**
  4597. + * Audio only. The number of audio channels.
  4598. + */
  4599. + int channels;
  4600. + /**
  4601. + * Audio only. The number of audio samples per second.
  4602. + */
  4603. + int sample_rate;
  4604. + /**
  4605. + * Audio only. The number of bytes per coded audio frame, required by some
  4606. + * formats.
  4607. + *
  4608. + * Corresponds to nBlockAlign in WAVEFORMATEX.
  4609. + */
  4610. + int block_align;
  4611. + /**
  4612. + * Audio only. Audio frame size, if known. Required by some formats to be static.
  4613. + */
  4614. + int frame_size;
  4615. +
  4616. + /**
  4617. + * Audio only. The amount of padding (in samples) inserted by the encoder at
  4618. + * the beginning of the audio. I.e. this number of leading decoded samples
  4619. + * must be discarded by the caller to get the original audio without leading
  4620. + * padding.
  4621. + */
  4622. + int initial_padding;
  4623. + /**
  4624. + * Audio only. The amount of padding (in samples) appended by the encoder to
  4625. + * the end of the audio. I.e. this number of decoded samples must be
  4626. + * discarded by the caller from the end of the stream to get the original
  4627. + * audio without any trailing padding.
  4628. + */
  4629. + int trailing_padding;
  4630. + /**
  4631. + * Audio only. Number of samples to skip after a discontinuity.
  4632. + */
  4633. + int seek_preroll;
  4634. +} AVCodecParameters;
  4635. +
  4636. +/**
  4637. + * Iterate over all registered codecs.
  4638. + *
  4639. + * @param opaque a pointer where libavcodec will store the iteration state. Must
  4640. + * point to NULL to start the iteration.
  4641. + *
  4642. + * @return the next registered codec or NULL when the iteration is
  4643. + * finished
  4644. + */
  4645. +const AVCodec *av_codec_iterate(void **opaque);
  4646. +
  4647. +#if FF_API_NEXT
  4648. +/**
  4649. + * If c is NULL, returns the first registered codec,
  4650. + * if c is non-NULL, returns the next registered codec after c,
  4651. + * or NULL if c is the last one.
  4652. + */
  4653. +attribute_deprecated
  4654. +AVCodec *av_codec_next(const AVCodec *c);
  4655. +#endif
  4656. +
  4657. +/**
  4658. + * Return the LIBAVCODEC_VERSION_INT constant.
  4659. + */
  4660. +unsigned avcodec_version(void);
  4661. +
  4662. +/**
  4663. + * Return the libavcodec build-time configuration.
  4664. + */
  4665. +const char *avcodec_configuration(void);
  4666. +
  4667. +/**
  4668. + * Return the libavcodec license.
  4669. + */
  4670. +const char *avcodec_license(void);
  4671. +
  4672. +#if FF_API_NEXT
  4673. +/**
  4674. + * Register the codec codec and initialize libavcodec.
  4675. + *
  4676. + * @warning either this function or avcodec_register_all() must be called
  4677. + * before any other libavcodec functions.
  4678. + *
  4679. + * @see avcodec_register_all()
  4680. + */
  4681. +attribute_deprecated
  4682. +void avcodec_register(AVCodec *codec);
  4683. +
  4684. +/**
  4685. + * Register all the codecs, parsers and bitstream filters which were enabled at
  4686. + * configuration time. If you do not call this function you can select exactly
  4687. + * which formats you want to support, by using the individual registration
  4688. + * functions.
  4689. + *
  4690. + * @see avcodec_register
  4691. + * @see av_register_codec_parser
  4692. + * @see av_register_bitstream_filter
  4693. + */
  4694. +attribute_deprecated
  4695. +void avcodec_register_all(void);
  4696. +#endif
  4697. +
  4698. +/**
  4699. + * Allocate an AVCodecContext and set its fields to default values. The
  4700. + * resulting struct should be freed with avcodec_free_context().
  4701. + *
  4702. + * @param codec if non-NULL, allocate private data and initialize defaults
  4703. + * for the given codec. It is illegal to then call avcodec_open2()
  4704. + * with a different codec.
  4705. + * If NULL, then the codec-specific defaults won't be initialized,
  4706. + * which may result in suboptimal default settings (this is
  4707. + * important mainly for encoders, e.g. libx264).
  4708. + *
  4709. + * @return An AVCodecContext filled with default values or NULL on failure.
  4710. + */
  4711. +AVCodecContext *avcodec_alloc_context3(const AVCodec *codec);
  4712. +
  4713. +/**
  4714. + * Free the codec context and everything associated with it and write NULL to
  4715. + * the provided pointer.
  4716. + */
  4717. +void avcodec_free_context(AVCodecContext **avctx);
  4718. +
  4719. +#if FF_API_GET_CONTEXT_DEFAULTS
  4720. +/**
  4721. + * @deprecated This function should not be used, as closing and opening a codec
  4722. + * context multiple time is not supported. A new codec context should be
  4723. + * allocated for each new use.
  4724. + */
  4725. +int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec);
  4726. +#endif
  4727. +
  4728. +/**
  4729. + * Get the AVClass for AVCodecContext. It can be used in combination with
  4730. + * AV_OPT_SEARCH_FAKE_OBJ for examining options.
  4731. + *
  4732. + * @see av_opt_find().
  4733. + */
  4734. +const AVClass *avcodec_get_class(void);
  4735. +
  4736. +#if FF_API_COPY_CONTEXT
  4737. +/**
  4738. + * Get the AVClass for AVFrame. It can be used in combination with
  4739. + * AV_OPT_SEARCH_FAKE_OBJ for examining options.
  4740. + *
  4741. + * @see av_opt_find().
  4742. + */
  4743. +const AVClass *avcodec_get_frame_class(void);
  4744. +
  4745. +/**
  4746. + * Get the AVClass for AVSubtitleRect. It can be used in combination with
  4747. + * AV_OPT_SEARCH_FAKE_OBJ for examining options.
  4748. + *
  4749. + * @see av_opt_find().
  4750. + */
  4751. +const AVClass *avcodec_get_subtitle_rect_class(void);
  4752. +
  4753. +/**
  4754. + * Copy the settings of the source AVCodecContext into the destination
  4755. + * AVCodecContext. The resulting destination codec context will be
  4756. + * unopened, i.e. you are required to call avcodec_open2() before you
  4757. + * can use this AVCodecContext to decode/encode video/audio data.
  4758. + *
  4759. + * @param dest target codec context, should be initialized with
  4760. + * avcodec_alloc_context3(NULL), but otherwise uninitialized
  4761. + * @param src source codec context
  4762. + * @return AVERROR() on error (e.g. memory allocation error), 0 on success
  4763. + *
  4764. + * @deprecated The semantics of this function are ill-defined and it should not
  4765. + * be used. If you need to transfer the stream parameters from one codec context
  4766. + * to another, use an intermediate AVCodecParameters instance and the
  4767. + * avcodec_parameters_from_context() / avcodec_parameters_to_context()
  4768. + * functions.
  4769. + */
  4770. +attribute_deprecated
  4771. +int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src);
  4772. +#endif
  4773. +
  4774. +/**
  4775. + * Allocate a new AVCodecParameters and set its fields to default values
  4776. + * (unknown/invalid/0). The returned struct must be freed with
  4777. + * avcodec_parameters_free().
  4778. + */
  4779. +AVCodecParameters *avcodec_parameters_alloc(void);
  4780. +
  4781. +/**
  4782. + * Free an AVCodecParameters instance and everything associated with it and
  4783. + * write NULL to the supplied pointer.
  4784. + */
  4785. +void avcodec_parameters_free(AVCodecParameters **par);
  4786. +
  4787. +/**
  4788. + * Copy the contents of src to dst. Any allocated fields in dst are freed and
  4789. + * replaced with newly allocated duplicates of the corresponding fields in src.
  4790. + *
  4791. + * @return >= 0 on success, a negative AVERROR code on failure.
  4792. + */
  4793. +int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src);
  4794. +
  4795. +/**
  4796. + * Fill the parameters struct based on the values from the supplied codec
  4797. + * context. Any allocated fields in par are freed and replaced with duplicates
  4798. + * of the corresponding fields in codec.
  4799. + *
  4800. + * @return >= 0 on success, a negative AVERROR code on failure
  4801. + */
  4802. +int avcodec_parameters_from_context(AVCodecParameters *par,
  4803. + const AVCodecContext *codec);
  4804. +
  4805. +/**
  4806. + * Fill the codec context based on the values from the supplied codec
  4807. + * parameters. Any allocated fields in codec that have a corresponding field in
  4808. + * par are freed and replaced with duplicates of the corresponding field in par.
  4809. + * Fields in codec that do not have a counterpart in par are not touched.
  4810. + *
  4811. + * @return >= 0 on success, a negative AVERROR code on failure.
  4812. + */
  4813. +int avcodec_parameters_to_context(AVCodecContext *codec,
  4814. + const AVCodecParameters *par);
  4815. +
  4816. +/**
  4817. + * Initialize the AVCodecContext to use the given AVCodec. Prior to using this
  4818. + * function the context has to be allocated with avcodec_alloc_context3().
  4819. + *
  4820. + * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
  4821. + * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
  4822. + * retrieving a codec.
  4823. + *
  4824. + * @warning This function is not thread safe!
  4825. + *
  4826. + * @note Always call this function before using decoding routines (such as
  4827. + * @ref avcodec_receive_frame()).
  4828. + *
  4829. + * @code
  4830. + * avcodec_register_all();
  4831. + * av_dict_set(&opts, "b", "2.5M", 0);
  4832. + * codec = avcodec_find_decoder(AV_CODEC_ID_H264);
  4833. + * if (!codec)
  4834. + * exit(1);
  4835. + *
  4836. + * context = avcodec_alloc_context3(codec);
  4837. + *
  4838. + * if (avcodec_open2(context, codec, opts) < 0)
  4839. + * exit(1);
  4840. + * @endcode
  4841. + *
  4842. + * @param avctx The context to initialize.
  4843. + * @param codec The codec to open this context for. If a non-NULL codec has been
  4844. + * previously passed to avcodec_alloc_context3() or
  4845. + * for this context, then this parameter MUST be either NULL or
  4846. + * equal to the previously passed codec.
  4847. + * @param options A dictionary filled with AVCodecContext and codec-private options.
  4848. + * On return this object will be filled with options that were not found.
  4849. + *
  4850. + * @return zero on success, a negative value on error
  4851. + * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(),
  4852. + * av_dict_set(), av_opt_find().
  4853. + */
  4854. +int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options);
  4855. +
  4856. +/**
  4857. + * Close a given AVCodecContext and free all the data associated with it
  4858. + * (but not the AVCodecContext itself).
  4859. + *
  4860. + * Calling this function on an AVCodecContext that hasn't been opened will free
  4861. + * the codec-specific data allocated in avcodec_alloc_context3() with a non-NULL
  4862. + * codec. Subsequent calls will do nothing.
  4863. + *
  4864. + * @note Do not use this function. Use avcodec_free_context() to destroy a
  4865. + * codec context (either open or closed). Opening and closing a codec context
  4866. + * multiple times is not supported anymore -- use multiple codec contexts
  4867. + * instead.
  4868. + */
  4869. +int avcodec_close(AVCodecContext *avctx);
  4870. +
  4871. +/**
  4872. + * Free all allocated data in the given subtitle struct.
  4873. + *
  4874. + * @param sub AVSubtitle to free.
  4875. + */
  4876. +void avsubtitle_free(AVSubtitle *sub);
  4877. +
  4878. +/**
  4879. + * @}
  4880. + */
  4881. +
  4882. +/**
  4883. + * @addtogroup lavc_packet
  4884. + * @{
  4885. + */
  4886. +
  4887. +/**
  4888. + * Allocate an AVPacket and set its fields to default values. The resulting
  4889. + * struct must be freed using av_packet_free().
  4890. + *
  4891. + * @return An AVPacket filled with default values or NULL on failure.
  4892. + *
  4893. + * @note this only allocates the AVPacket itself, not the data buffers. Those
  4894. + * must be allocated through other means such as av_new_packet.
  4895. + *
  4896. + * @see av_new_packet
  4897. + */
  4898. +AVPacket *av_packet_alloc(void);
  4899. +
  4900. +/**
  4901. + * Create a new packet that references the same data as src.
  4902. + *
  4903. + * This is a shortcut for av_packet_alloc()+av_packet_ref().
  4904. + *
  4905. + * @return newly created AVPacket on success, NULL on error.
  4906. + *
  4907. + * @see av_packet_alloc
  4908. + * @see av_packet_ref
  4909. + */
  4910. +AVPacket *av_packet_clone(const AVPacket *src);
  4911. +
  4912. +/**
  4913. + * Free the packet, if the packet is reference counted, it will be
  4914. + * unreferenced first.
  4915. + *
  4916. + * @param pkt packet to be freed. The pointer will be set to NULL.
  4917. + * @note passing NULL is a no-op.
  4918. + */
  4919. +void av_packet_free(AVPacket **pkt);
  4920. +
  4921. +/**
  4922. + * Initialize optional fields of a packet with default values.
  4923. + *
  4924. + * Note, this does not touch the data and size members, which have to be
  4925. + * initialized separately.
  4926. + *
  4927. + * @param pkt packet
  4928. + */
  4929. +void av_init_packet(AVPacket *pkt);
  4930. +
  4931. +/**
  4932. + * Allocate the payload of a packet and initialize its fields with
  4933. + * default values.
  4934. + *
  4935. + * @param pkt packet
  4936. + * @param size wanted payload size
  4937. + * @return 0 if OK, AVERROR_xxx otherwise
  4938. + */
  4939. +int av_new_packet(AVPacket *pkt, int size);
  4940. +
  4941. +/**
  4942. + * Reduce packet size, correctly zeroing padding
  4943. + *
  4944. + * @param pkt packet
  4945. + * @param size new size
  4946. + */
  4947. +void av_shrink_packet(AVPacket *pkt, int size);
  4948. +
  4949. +/**
  4950. + * Increase packet size, correctly zeroing padding
  4951. + *
  4952. + * @param pkt packet
  4953. + * @param grow_by number of bytes by which to increase the size of the packet
  4954. + */
  4955. +int av_grow_packet(AVPacket *pkt, int grow_by);
  4956. +
  4957. +/**
  4958. + * Initialize a reference-counted packet from av_malloc()ed data.
  4959. + *
  4960. + * @param pkt packet to be initialized. This function will set the data, size,
  4961. + * buf and destruct fields, all others are left untouched.
  4962. + * @param data Data allocated by av_malloc() to be used as packet data. If this
  4963. + * function returns successfully, the data is owned by the underlying AVBuffer.
  4964. + * The caller may not access the data through other means.
  4965. + * @param size size of data in bytes, without the padding. I.e. the full buffer
  4966. + * size is assumed to be size + AV_INPUT_BUFFER_PADDING_SIZE.
  4967. + *
  4968. + * @return 0 on success, a negative AVERROR on error
  4969. + */
  4970. +int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size);
  4971. +
  4972. +#if FF_API_AVPACKET_OLD_API
  4973. +/**
  4974. + * @warning This is a hack - the packet memory allocation stuff is broken. The
  4975. + * packet is allocated if it was not really allocated.
  4976. + *
  4977. + * @deprecated Use av_packet_ref or av_packet_make_refcounted
  4978. + */
  4979. +attribute_deprecated
  4980. +int av_dup_packet(AVPacket *pkt);
  4981. +/**
  4982. + * Copy packet, including contents
  4983. + *
  4984. + * @return 0 on success, negative AVERROR on fail
  4985. + *
  4986. + * @deprecated Use av_packet_ref
  4987. + */
  4988. +attribute_deprecated
  4989. +int av_copy_packet(AVPacket *dst, const AVPacket *src);
  4990. +
  4991. +/**
  4992. + * Copy packet side data
  4993. + *
  4994. + * @return 0 on success, negative AVERROR on fail
  4995. + *
  4996. + * @deprecated Use av_packet_copy_props
  4997. + */
  4998. +attribute_deprecated
  4999. +int av_copy_packet_side_data(AVPacket *dst, const AVPacket *src);
  5000. +
  5001. +/**
  5002. + * Free a packet.
  5003. + *
  5004. + * @deprecated Use av_packet_unref
  5005. + *
  5006. + * @param pkt packet to free
  5007. + */
  5008. +attribute_deprecated
  5009. +void av_free_packet(AVPacket *pkt);
  5010. +#endif
  5011. +/**
  5012. + * Allocate new information of a packet.
  5013. + *
  5014. + * @param pkt packet
  5015. + * @param type side information type
  5016. + * @param size side information size
  5017. + * @return pointer to fresh allocated data or NULL otherwise
  5018. + */
  5019. +uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
  5020. + int size);
  5021. +
  5022. +/**
  5023. + * Wrap an existing array as a packet side data.
  5024. + *
  5025. + * @param pkt packet
  5026. + * @param type side information type
  5027. + * @param data the side data array. It must be allocated with the av_malloc()
  5028. + * family of functions. The ownership of the data is transferred to
  5029. + * pkt.
  5030. + * @param size side information size
  5031. + * @return a non-negative number on success, a negative AVERROR code on
  5032. + * failure. On failure, the packet is unchanged and the data remains
  5033. + * owned by the caller.
  5034. + */
  5035. +int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
  5036. + uint8_t *data, size_t size);
  5037. +
  5038. +/**
  5039. + * Shrink the already allocated side data buffer
  5040. + *
  5041. + * @param pkt packet
  5042. + * @param type side information type
  5043. + * @param size new side information size
  5044. + * @return 0 on success, < 0 on failure
  5045. + */
  5046. +int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
  5047. + int size);
  5048. +
  5049. +/**
  5050. + * Get side information from packet.
  5051. + *
  5052. + * @param pkt packet
  5053. + * @param type desired side information type
  5054. + * @param size pointer for side information size to store (optional)
  5055. + * @return pointer to data if present or NULL otherwise
  5056. + */
  5057. +uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,
  5058. + int *size);
  5059. +
  5060. +#if FF_API_MERGE_SD_API
  5061. +attribute_deprecated
  5062. +int av_packet_merge_side_data(AVPacket *pkt);
  5063. +
  5064. +attribute_deprecated
  5065. +int av_packet_split_side_data(AVPacket *pkt);
  5066. +#endif
  5067. +
  5068. +const char *av_packet_side_data_name(enum AVPacketSideDataType type);
  5069. +
  5070. +/**
  5071. + * Pack a dictionary for use in side_data.
  5072. + *
  5073. + * @param dict The dictionary to pack.
  5074. + * @param size pointer to store the size of the returned data
  5075. + * @return pointer to data if successful, NULL otherwise
  5076. + */
  5077. +uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size);
  5078. +/**
  5079. + * Unpack a dictionary from side_data.
  5080. + *
  5081. + * @param data data from side_data
  5082. + * @param size size of the data
  5083. + * @param dict the metadata storage dictionary
  5084. + * @return 0 on success, < 0 on failure
  5085. + */
  5086. +int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict);
  5087. +
  5088. +
  5089. +/**
  5090. + * Convenience function to free all the side data stored.
  5091. + * All the other fields stay untouched.
  5092. + *
  5093. + * @param pkt packet
  5094. + */
  5095. +void av_packet_free_side_data(AVPacket *pkt);
  5096. +
  5097. +/**
  5098. + * Setup a new reference to the data described by a given packet
  5099. + *
  5100. + * If src is reference-counted, setup dst as a new reference to the
  5101. + * buffer in src. Otherwise allocate a new buffer in dst and copy the
  5102. + * data from src into it.
  5103. + *
  5104. + * All the other fields are copied from src.
  5105. + *
  5106. + * @see av_packet_unref
  5107. + *
  5108. + * @param dst Destination packet
  5109. + * @param src Source packet
  5110. + *
  5111. + * @return 0 on success, a negative AVERROR on error.
  5112. + */
  5113. +int av_packet_ref(AVPacket *dst, const AVPacket *src);
  5114. +
  5115. +/**
  5116. + * Wipe the packet.
  5117. + *
  5118. + * Unreference the buffer referenced by the packet and reset the
  5119. + * remaining packet fields to their default values.
  5120. + *
  5121. + * @param pkt The packet to be unreferenced.
  5122. + */
  5123. +void av_packet_unref(AVPacket *pkt);
  5124. +
  5125. +/**
  5126. + * Move every field in src to dst and reset src.
  5127. + *
  5128. + * @see av_packet_unref
  5129. + *
  5130. + * @param src Source packet, will be reset
  5131. + * @param dst Destination packet
  5132. + */
  5133. +void av_packet_move_ref(AVPacket *dst, AVPacket *src);
  5134. +
  5135. +/**
  5136. + * Copy only "properties" fields from src to dst.
  5137. + *
  5138. + * Properties for the purpose of this function are all the fields
  5139. + * beside those related to the packet data (buf, data, size)
  5140. + *
  5141. + * @param dst Destination packet
  5142. + * @param src Source packet
  5143. + *
  5144. + * @return 0 on success AVERROR on failure.
  5145. + */
  5146. +int av_packet_copy_props(AVPacket *dst, const AVPacket *src);
  5147. +
  5148. +/**
  5149. + * Ensure the data described by a given packet is reference counted.
  5150. + *
  5151. + * @note This function does not ensure that the reference will be writable.
  5152. + * Use av_packet_make_writable instead for that purpose.
  5153. + *
  5154. + * @see av_packet_ref
  5155. + * @see av_packet_make_writable
  5156. + *
  5157. + * @param pkt packet whose data should be made reference counted.
  5158. + *
  5159. + * @return 0 on success, a negative AVERROR on error. On failure, the
  5160. + * packet is unchanged.
  5161. + */
  5162. +int av_packet_make_refcounted(AVPacket *pkt);
  5163. +
  5164. +/**
  5165. + * Create a writable reference for the data described by a given packet,
  5166. + * avoiding data copy if possible.
  5167. + *
  5168. + * @param pkt Packet whose data should be made writable.
  5169. + *
  5170. + * @return 0 on success, a negative AVERROR on failure. On failure, the
  5171. + * packet is unchanged.
  5172. + */
  5173. +int av_packet_make_writable(AVPacket *pkt);
  5174. +
  5175. +/**
  5176. + * Convert valid timing fields (timestamps / durations) in a packet from one
  5177. + * timebase to another. Timestamps with unknown values (AV_NOPTS_VALUE) will be
  5178. + * ignored.
  5179. + *
  5180. + * @param pkt packet on which the conversion will be performed
  5181. + * @param tb_src source timebase, in which the timing fields in pkt are
  5182. + * expressed
  5183. + * @param tb_dst destination timebase, to which the timing fields will be
  5184. + * converted
  5185. + */
  5186. +void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst);
  5187. +
  5188. +/**
  5189. + * @}
  5190. + */
  5191. +
  5192. +/**
  5193. + * @addtogroup lavc_decoding
  5194. + * @{
  5195. + */
  5196. +
  5197. +/**
  5198. + * Find a registered decoder with a matching codec ID.
  5199. + *
  5200. + * @param id AVCodecID of the requested decoder
  5201. + * @return A decoder if one was found, NULL otherwise.
  5202. + */
  5203. +AVCodec *avcodec_find_decoder(enum AVCodecID id);
  5204. +
  5205. +/**
  5206. + * Find a registered decoder with the specified name.
  5207. + *
  5208. + * @param name name of the requested decoder
  5209. + * @return A decoder if one was found, NULL otherwise.
  5210. + */
  5211. +AVCodec *avcodec_find_decoder_by_name(const char *name);
  5212. +
  5213. +/**
  5214. + * The default callback for AVCodecContext.get_buffer2(). It is made public so
  5215. + * it can be called by custom get_buffer2() implementations for decoders without
  5216. + * AV_CODEC_CAP_DR1 set.
  5217. + */
  5218. +int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags);
  5219. +
  5220. +/**
  5221. + * Modify width and height values so that they will result in a memory
  5222. + * buffer that is acceptable for the codec if you do not use any horizontal
  5223. + * padding.
  5224. + *
  5225. + * May only be used if a codec with AV_CODEC_CAP_DR1 has been opened.
  5226. + */
  5227. +void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
  5228. +
  5229. +/**
  5230. + * Modify width and height values so that they will result in a memory
  5231. + * buffer that is acceptable for the codec if you also ensure that all
  5232. + * line sizes are a multiple of the respective linesize_align[i].
  5233. + *
  5234. + * May only be used if a codec with AV_CODEC_CAP_DR1 has been opened.
  5235. + */
  5236. +void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
  5237. + int linesize_align[AV_NUM_DATA_POINTERS]);
  5238. +
  5239. +/**
  5240. + * Converts AVChromaLocation to swscale x/y chroma position.
  5241. + *
  5242. + * The positions represent the chroma (0,0) position in a coordinates system
  5243. + * with luma (0,0) representing the origin and luma(1,1) representing 256,256
  5244. + *
  5245. + * @param xpos horizontal chroma sample position
  5246. + * @param ypos vertical chroma sample position
  5247. + */
  5248. +int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos);
  5249. +
  5250. +/**
  5251. + * Converts swscale x/y chroma position to AVChromaLocation.
  5252. + *
  5253. + * The positions represent the chroma (0,0) position in a coordinates system
  5254. + * with luma (0,0) representing the origin and luma(1,1) representing 256,256
  5255. + *
  5256. + * @param xpos horizontal chroma sample position
  5257. + * @param ypos vertical chroma sample position
  5258. + */
  5259. +enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos);
  5260. +
  5261. +/**
  5262. + * Decode the audio frame of size avpkt->size from avpkt->data into frame.
  5263. + *
  5264. + * Some decoders may support multiple frames in a single AVPacket. Such
  5265. + * decoders would then just decode the first frame and the return value would be
  5266. + * less than the packet size. In this case, avcodec_decode_audio4 has to be
  5267. + * called again with an AVPacket containing the remaining data in order to
  5268. + * decode the second frame, etc... Even if no frames are returned, the packet
  5269. + * needs to be fed to the decoder with remaining data until it is completely
  5270. + * consumed or an error occurs.
  5271. + *
  5272. + * Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input
  5273. + * and output. This means that for some packets they will not immediately
  5274. + * produce decoded output and need to be flushed at the end of decoding to get
  5275. + * all the decoded data. Flushing is done by calling this function with packets
  5276. + * with avpkt->data set to NULL and avpkt->size set to 0 until it stops
  5277. + * returning samples. It is safe to flush even those decoders that are not
  5278. + * marked with AV_CODEC_CAP_DELAY, then no samples will be returned.
  5279. + *
  5280. + * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE
  5281. + * larger than the actual read bytes because some optimized bitstream
  5282. + * readers read 32 or 64 bits at once and could read over the end.
  5283. + *
  5284. + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
  5285. + * before packets may be fed to the decoder.
  5286. + *
  5287. + * @param avctx the codec context
  5288. + * @param[out] frame The AVFrame in which to store decoded audio samples.
  5289. + * The decoder will allocate a buffer for the decoded frame by
  5290. + * calling the AVCodecContext.get_buffer2() callback.
  5291. + * When AVCodecContext.refcounted_frames is set to 1, the frame is
  5292. + * reference counted and the returned reference belongs to the
  5293. + * caller. The caller must release the frame using av_frame_unref()
  5294. + * when the frame is no longer needed. The caller may safely write
  5295. + * to the frame if av_frame_is_writable() returns 1.
  5296. + * When AVCodecContext.refcounted_frames is set to 0, the returned
  5297. + * reference belongs to the decoder and is valid only until the
  5298. + * next call to this function or until closing or flushing the
  5299. + * decoder. The caller may not write to it.
  5300. + * @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is
  5301. + * non-zero. Note that this field being set to zero
  5302. + * does not mean that an error has occurred. For
  5303. + * decoders with AV_CODEC_CAP_DELAY set, no given decode
  5304. + * call is guaranteed to produce a frame.
  5305. + * @param[in] avpkt The input AVPacket containing the input buffer.
  5306. + * At least avpkt->data and avpkt->size should be set. Some
  5307. + * decoders might also require additional fields to be set.
  5308. + * @return A negative error code is returned if an error occurred during
  5309. + * decoding, otherwise the number of bytes consumed from the input
  5310. + * AVPacket is returned.
  5311. + *
  5312. +* @deprecated Use avcodec_send_packet() and avcodec_receive_frame().
  5313. + */
  5314. +attribute_deprecated
  5315. +int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
  5316. + int *got_frame_ptr, const AVPacket *avpkt);
  5317. +
  5318. +/**
  5319. + * Decode the video frame of size avpkt->size from avpkt->data into picture.
  5320. + * Some decoders may support multiple frames in a single AVPacket, such
  5321. + * decoders would then just decode the first frame.
  5322. + *
  5323. + * @warning The input buffer must be AV_INPUT_BUFFER_PADDING_SIZE larger than
  5324. + * the actual read bytes because some optimized bitstream readers read 32 or 64
  5325. + * bits at once and could read over the end.
  5326. + *
  5327. + * @warning The end of the input buffer buf should be set to 0 to ensure that
  5328. + * no overreading happens for damaged MPEG streams.
  5329. + *
  5330. + * @note Codecs which have the AV_CODEC_CAP_DELAY capability set have a delay
  5331. + * between input and output, these need to be fed with avpkt->data=NULL,
  5332. + * avpkt->size=0 at the end to return the remaining frames.
  5333. + *
  5334. + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
  5335. + * before packets may be fed to the decoder.
  5336. + *
  5337. + * @param avctx the codec context
  5338. + * @param[out] picture The AVFrame in which the decoded video frame will be stored.
  5339. + * Use av_frame_alloc() to get an AVFrame. The codec will
  5340. + * allocate memory for the actual bitmap by calling the
  5341. + * AVCodecContext.get_buffer2() callback.
  5342. + * When AVCodecContext.refcounted_frames is set to 1, the frame is
  5343. + * reference counted and the returned reference belongs to the
  5344. + * caller. The caller must release the frame using av_frame_unref()
  5345. + * when the frame is no longer needed. The caller may safely write
  5346. + * to the frame if av_frame_is_writable() returns 1.
  5347. + * When AVCodecContext.refcounted_frames is set to 0, the returned
  5348. + * reference belongs to the decoder and is valid only until the
  5349. + * next call to this function or until closing or flushing the
  5350. + * decoder. The caller may not write to it.
  5351. + *
  5352. + * @param[in] avpkt The input AVPacket containing the input buffer.
  5353. + * You can create such packet with av_init_packet() and by then setting
  5354. + * data and size, some decoders might in addition need other fields like
  5355. + * flags&AV_PKT_FLAG_KEY. All decoders are designed to use the least
  5356. + * fields possible.
  5357. + * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero.
  5358. + * @return On error a negative value is returned, otherwise the number of bytes
  5359. + * used or zero if no frame could be decompressed.
  5360. + *
  5361. + * @deprecated Use avcodec_send_packet() and avcodec_receive_frame().
  5362. + */
  5363. +attribute_deprecated
  5364. +int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
  5365. + int *got_picture_ptr,
  5366. + const AVPacket *avpkt);
  5367. +
  5368. +/**
  5369. + * Decode a subtitle message.
  5370. + * Return a negative value on error, otherwise return the number of bytes used.
  5371. + * If no subtitle could be decompressed, got_sub_ptr is zero.
  5372. + * Otherwise, the subtitle is stored in *sub.
  5373. + * Note that AV_CODEC_CAP_DR1 is not available for subtitle codecs. This is for
  5374. + * simplicity, because the performance difference is expect to be negligible
  5375. + * and reusing a get_buffer written for video codecs would probably perform badly
  5376. + * due to a potentially very different allocation pattern.
  5377. + *
  5378. + * Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input
  5379. + * and output. This means that for some packets they will not immediately
  5380. + * produce decoded output and need to be flushed at the end of decoding to get
  5381. + * all the decoded data. Flushing is done by calling this function with packets
  5382. + * with avpkt->data set to NULL and avpkt->size set to 0 until it stops
  5383. + * returning subtitles. It is safe to flush even those decoders that are not
  5384. + * marked with AV_CODEC_CAP_DELAY, then no subtitles will be returned.
  5385. + *
  5386. + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
  5387. + * before packets may be fed to the decoder.
  5388. + *
  5389. + * @param avctx the codec context
  5390. + * @param[out] sub The Preallocated AVSubtitle in which the decoded subtitle will be stored,
  5391. + * must be freed with avsubtitle_free if *got_sub_ptr is set.
  5392. + * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero.
  5393. + * @param[in] avpkt The input AVPacket containing the input buffer.
  5394. + */
  5395. +int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
  5396. + int *got_sub_ptr,
  5397. + AVPacket *avpkt);
  5398. +
  5399. +/**
  5400. + * Supply raw packet data as input to a decoder.
  5401. + *
  5402. + * Internally, this call will copy relevant AVCodecContext fields, which can
  5403. + * influence decoding per-packet, and apply them when the packet is actually
  5404. + * decoded. (For example AVCodecContext.skip_frame, which might direct the
  5405. + * decoder to drop the frame contained by the packet sent with this function.)
  5406. + *
  5407. + * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE
  5408. + * larger than the actual read bytes because some optimized bitstream
  5409. + * readers read 32 or 64 bits at once and could read over the end.
  5410. + *
  5411. + * @warning Do not mix this API with the legacy API (like avcodec_decode_video2())
  5412. + * on the same AVCodecContext. It will return unexpected results now
  5413. + * or in future libavcodec versions.
  5414. + *
  5415. + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
  5416. + * before packets may be fed to the decoder.
  5417. + *
  5418. + * @param avctx codec context
  5419. + * @param[in] avpkt The input AVPacket. Usually, this will be a single video
  5420. + * frame, or several complete audio frames.
  5421. + * Ownership of the packet remains with the caller, and the
  5422. + * decoder will not write to the packet. The decoder may create
  5423. + * a reference to the packet data (or copy it if the packet is
  5424. + * not reference-counted).
  5425. + * Unlike with older APIs, the packet is always fully consumed,
  5426. + * and if it contains multiple frames (e.g. some audio codecs),
  5427. + * will require you to call avcodec_receive_frame() multiple
  5428. + * times afterwards before you can send a new packet.
  5429. + * It can be NULL (or an AVPacket with data set to NULL and
  5430. + * size set to 0); in this case, it is considered a flush
  5431. + * packet, which signals the end of the stream. Sending the
  5432. + * first flush packet will return success. Subsequent ones are
  5433. + * unnecessary and will return AVERROR_EOF. If the decoder
  5434. + * still has frames buffered, it will return them after sending
  5435. + * a flush packet.
  5436. + *
  5437. + * @return 0 on success, otherwise negative error code:
  5438. + * AVERROR(EAGAIN): input is not accepted in the current state - user
  5439. + * must read output with avcodec_receive_frame() (once
  5440. + * all output is read, the packet should be resent, and
  5441. + * the call will not fail with EAGAIN).
  5442. + * AVERROR_EOF: the decoder has been flushed, and no new packets can
  5443. + * be sent to it (also returned if more than 1 flush
  5444. + * packet is sent)
  5445. + * AVERROR(EINVAL): codec not opened, it is an encoder, or requires flush
  5446. + * AVERROR(ENOMEM): failed to add packet to internal queue, or similar
  5447. + * other errors: legitimate decoding errors
  5448. + */
  5449. +int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt);
  5450. +
  5451. +/**
  5452. + * Return decoded output data from a decoder.
  5453. + *
  5454. + * @param avctx codec context
  5455. + * @param frame This will be set to a reference-counted video or audio
  5456. + * frame (depending on the decoder type) allocated by the
  5457. + * decoder. Note that the function will always call
  5458. + * av_frame_unref(frame) before doing anything else.
  5459. + *
  5460. + * @return
  5461. + * 0: success, a frame was returned
  5462. + * AVERROR(EAGAIN): output is not available in this state - user must try
  5463. + * to send new input
  5464. + * AVERROR_EOF: the decoder has been fully flushed, and there will be
  5465. + * no more output frames
  5466. + * AVERROR(EINVAL): codec not opened, or it is an encoder
  5467. + * other negative values: legitimate decoding errors
  5468. + */
  5469. +int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame);
  5470. +
  5471. +/**
  5472. + * Supply a raw video or audio frame to the encoder. Use avcodec_receive_packet()
  5473. + * to retrieve buffered output packets.
  5474. + *
  5475. + * @param avctx codec context
  5476. + * @param[in] frame AVFrame containing the raw audio or video frame to be encoded.
  5477. + * Ownership of the frame remains with the caller, and the
  5478. + * encoder will not write to the frame. The encoder may create
  5479. + * a reference to the frame data (or copy it if the frame is
  5480. + * not reference-counted).
  5481. + * It can be NULL, in which case it is considered a flush
  5482. + * packet. This signals the end of the stream. If the encoder
  5483. + * still has packets buffered, it will return them after this
  5484. + * call. Once flushing mode has been entered, additional flush
  5485. + * packets are ignored, and sending frames will return
  5486. + * AVERROR_EOF.
  5487. + *
  5488. + * For audio:
  5489. + * If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame
  5490. + * can have any number of samples.
  5491. + * If it is not set, frame->nb_samples must be equal to
  5492. + * avctx->frame_size for all frames except the last.
  5493. + * The final frame may be smaller than avctx->frame_size.
  5494. + * @return 0 on success, otherwise negative error code:
  5495. + * AVERROR(EAGAIN): input is not accepted in the current state - user
  5496. + * must read output with avcodec_receive_packet() (once
  5497. + * all output is read, the packet should be resent, and
  5498. + * the call will not fail with EAGAIN).
  5499. + * AVERROR_EOF: the encoder has been flushed, and no new frames can
  5500. + * be sent to it
  5501. + * AVERROR(EINVAL): codec not opened, refcounted_frames not set, it is a
  5502. + * decoder, or requires flush
  5503. + * AVERROR(ENOMEM): failed to add packet to internal queue, or similar
  5504. + * other errors: legitimate decoding errors
  5505. + */
  5506. +int avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame);
  5507. +
  5508. +/**
  5509. + * Read encoded data from the encoder.
  5510. + *
  5511. + * @param avctx codec context
  5512. + * @param avpkt This will be set to a reference-counted packet allocated by the
  5513. + * encoder. Note that the function will always call
  5514. + * av_frame_unref(frame) before doing anything else.
  5515. + * @return 0 on success, otherwise negative error code:
  5516. + * AVERROR(EAGAIN): output is not available in the current state - user
  5517. + * must try to send input
  5518. + * AVERROR_EOF: the encoder has been fully flushed, and there will be
  5519. + * no more output packets
  5520. + * AVERROR(EINVAL): codec not opened, or it is an encoder
  5521. + * other errors: legitimate decoding errors
  5522. + */
  5523. +int avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt);
  5524. +
  5525. +/**
  5526. + * Create and return a AVHWFramesContext with values adequate for hardware
  5527. + * decoding. This is meant to get called from the get_format callback, and is
  5528. + * a helper for preparing a AVHWFramesContext for AVCodecContext.hw_frames_ctx.
  5529. + * This API is for decoding with certain hardware acceleration modes/APIs only.
  5530. + *
  5531. + * The returned AVHWFramesContext is not initialized. The caller must do this
  5532. + * with av_hwframe_ctx_init().
  5533. + *
  5534. + * Calling this function is not a requirement, but makes it simpler to avoid
  5535. + * codec or hardware API specific details when manually allocating frames.
  5536. + *
  5537. + * Alternatively to this, an API user can set AVCodecContext.hw_device_ctx,
  5538. + * which sets up AVCodecContext.hw_frames_ctx fully automatically, and makes
  5539. + * it unnecessary to call this function or having to care about
  5540. + * AVHWFramesContext initialization at all.
  5541. + *
  5542. + * There are a number of requirements for calling this function:
  5543. + *
  5544. + * - It must be called from get_format with the same avctx parameter that was
  5545. + * passed to get_format. Calling it outside of get_format is not allowed, and
  5546. + * can trigger undefined behavior.
  5547. + * - The function is not always supported (see description of return values).
  5548. + * Even if this function returns successfully, hwaccel initialization could
  5549. + * fail later. (The degree to which implementations check whether the stream
  5550. + * is actually supported varies. Some do this check only after the user's
  5551. + * get_format callback returns.)
  5552. + * - The hw_pix_fmt must be one of the choices suggested by get_format. If the
  5553. + * user decides to use a AVHWFramesContext prepared with this API function,
  5554. + * the user must return the same hw_pix_fmt from get_format.
  5555. + * - The device_ref passed to this function must support the given hw_pix_fmt.
  5556. + * - After calling this API function, it is the user's responsibility to
  5557. + * initialize the AVHWFramesContext (returned by the out_frames_ref parameter),
  5558. + * and to set AVCodecContext.hw_frames_ctx to it. If done, this must be done
  5559. + * before returning from get_format (this is implied by the normal
  5560. + * AVCodecContext.hw_frames_ctx API rules).
  5561. + * - The AVHWFramesContext parameters may change every time time get_format is
  5562. + * called. Also, AVCodecContext.hw_frames_ctx is reset before get_format. So
  5563. + * you are inherently required to go through this process again on every
  5564. + * get_format call.
  5565. + * - It is perfectly possible to call this function without actually using
  5566. + * the resulting AVHWFramesContext. One use-case might be trying to reuse a
  5567. + * previously initialized AVHWFramesContext, and calling this API function
  5568. + * only to test whether the required frame parameters have changed.
  5569. + * - Fields that use dynamically allocated values of any kind must not be set
  5570. + * by the user unless setting them is explicitly allowed by the documentation.
  5571. + * If the user sets AVHWFramesContext.free and AVHWFramesContext.user_opaque,
  5572. + * the new free callback must call the potentially set previous free callback.
  5573. + * This API call may set any dynamically allocated fields, including the free
  5574. + * callback.
  5575. + *
  5576. + * The function will set at least the following fields on AVHWFramesContext
  5577. + * (potentially more, depending on hwaccel API):
  5578. + *
  5579. + * - All fields set by av_hwframe_ctx_alloc().
  5580. + * - Set the format field to hw_pix_fmt.
  5581. + * - Set the sw_format field to the most suited and most versatile format. (An
  5582. + * implication is that this will prefer generic formats over opaque formats
  5583. + * with arbitrary restrictions, if possible.)
  5584. + * - Set the width/height fields to the coded frame size, rounded up to the
  5585. + * API-specific minimum alignment.
  5586. + * - Only _if_ the hwaccel requires a pre-allocated pool: set the initial_pool_size
  5587. + * field to the number of maximum reference surfaces possible with the codec,
  5588. + * plus 1 surface for the user to work (meaning the user can safely reference
  5589. + * at most 1 decoded surface at a time), plus additional buffering introduced
  5590. + * by frame threading. If the hwaccel does not require pre-allocation, the
  5591. + * field is left to 0, and the decoder will allocate new surfaces on demand
  5592. + * during decoding.
  5593. + * - Possibly AVHWFramesContext.hwctx fields, depending on the underlying
  5594. + * hardware API.
  5595. + *
  5596. + * Essentially, out_frames_ref returns the same as av_hwframe_ctx_alloc(), but
  5597. + * with basic frame parameters set.
  5598. + *
  5599. + * The function is stateless, and does not change the AVCodecContext or the
  5600. + * device_ref AVHWDeviceContext.
  5601. + *
  5602. + * @param avctx The context which is currently calling get_format, and which
  5603. + * implicitly contains all state needed for filling the returned
  5604. + * AVHWFramesContext properly.
  5605. + * @param device_ref A reference to the AVHWDeviceContext describing the device
  5606. + * which will be used by the hardware decoder.
  5607. + * @param hw_pix_fmt The hwaccel format you are going to return from get_format.
  5608. + * @param out_frames_ref On success, set to a reference to an _uninitialized_
  5609. + * AVHWFramesContext, created from the given device_ref.
  5610. + * Fields will be set to values required for decoding.
  5611. + * Not changed if an error is returned.
  5612. + * @return zero on success, a negative value on error. The following error codes
  5613. + * have special semantics:
  5614. + * AVERROR(ENOENT): the decoder does not support this functionality. Setup
  5615. + * is always manual, or it is a decoder which does not
  5616. + * support setting AVCodecContext.hw_frames_ctx at all,
  5617. + * or it is a software format.
  5618. + * AVERROR(EINVAL): it is known that hardware decoding is not supported for
  5619. + * this configuration, or the device_ref is not supported
  5620. + * for the hwaccel referenced by hw_pix_fmt.
  5621. + */
  5622. +int avcodec_get_hw_frames_parameters(AVCodecContext *avctx,
  5623. + AVBufferRef *device_ref,
  5624. + enum AVPixelFormat hw_pix_fmt,
  5625. + AVBufferRef **out_frames_ref);
  5626. +
  5627. +
  5628. +
  5629. +/**
  5630. + * @defgroup lavc_parsing Frame parsing
  5631. + * @{
  5632. + */
  5633. +
  5634. +enum AVPictureStructure {
  5635. + AV_PICTURE_STRUCTURE_UNKNOWN, //< unknown
  5636. + AV_PICTURE_STRUCTURE_TOP_FIELD, //< coded as top field
  5637. + AV_PICTURE_STRUCTURE_BOTTOM_FIELD, //< coded as bottom field
  5638. + AV_PICTURE_STRUCTURE_FRAME, //< coded as frame
  5639. +};
  5640. +
  5641. +typedef struct AVCodecParserContext {
  5642. + void *priv_data;
  5643. + struct AVCodecParser *parser;
  5644. + int64_t frame_offset; /* offset of the current frame */
  5645. + int64_t cur_offset; /* current offset
  5646. + (incremented by each av_parser_parse()) */
  5647. + int64_t next_frame_offset; /* offset of the next frame */
  5648. + /* video info */
  5649. + int pict_type; /* XXX: Put it back in AVCodecContext. */
  5650. + /**
  5651. + * This field is used for proper frame duration computation in lavf.
  5652. + * It signals, how much longer the frame duration of the current frame
  5653. + * is compared to normal frame duration.
  5654. + *
  5655. + * frame_duration = (1 + repeat_pict) * time_base
  5656. + *
  5657. + * It is used by codecs like H.264 to display telecined material.
  5658. + */
  5659. + int repeat_pict; /* XXX: Put it back in AVCodecContext. */
  5660. + int64_t pts; /* pts of the current frame */
  5661. + int64_t dts; /* dts of the current frame */
  5662. +
  5663. + /* private data */
  5664. + int64_t last_pts;
  5665. + int64_t last_dts;
  5666. + int fetch_timestamp;
  5667. +
  5668. +#define AV_PARSER_PTS_NB 4
  5669. + int cur_frame_start_index;
  5670. + int64_t cur_frame_offset[AV_PARSER_PTS_NB];
  5671. + int64_t cur_frame_pts[AV_PARSER_PTS_NB];
  5672. + int64_t cur_frame_dts[AV_PARSER_PTS_NB];
  5673. +
  5674. + int flags;
  5675. +#define PARSER_FLAG_COMPLETE_FRAMES 0x0001
  5676. +#define PARSER_FLAG_ONCE 0x0002
  5677. +/// Set if the parser has a valid file offset
  5678. +#define PARSER_FLAG_FETCHED_OFFSET 0x0004
  5679. +#define PARSER_FLAG_USE_CODEC_TS 0x1000
  5680. +
  5681. + int64_t offset; ///< byte offset from starting packet start
  5682. + int64_t cur_frame_end[AV_PARSER_PTS_NB];
  5683. +
  5684. + /**
  5685. + * Set by parser to 1 for key frames and 0 for non-key frames.
  5686. + * It is initialized to -1, so if the parser doesn't set this flag,
  5687. + * old-style fallback using AV_PICTURE_TYPE_I picture type as key frames
  5688. + * will be used.
  5689. + */
  5690. + int key_frame;
  5691. +
  5692. +#if FF_API_CONVERGENCE_DURATION
  5693. + /**
  5694. + * @deprecated unused
  5695. + */
  5696. + attribute_deprecated
  5697. + int64_t convergence_duration;
  5698. +#endif
  5699. +
  5700. + // Timestamp generation support:
  5701. + /**
  5702. + * Synchronization point for start of timestamp generation.
  5703. + *
  5704. + * Set to >0 for sync point, 0 for no sync point and <0 for undefined
  5705. + * (default).
  5706. + *
  5707. + * For example, this corresponds to presence of H.264 buffering period
  5708. + * SEI message.
  5709. + */
  5710. + int dts_sync_point;
  5711. +
  5712. + /**
  5713. + * Offset of the current timestamp against last timestamp sync point in
  5714. + * units of AVCodecContext.time_base.
  5715. + *
  5716. + * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
  5717. + * contain a valid timestamp offset.
  5718. + *
  5719. + * Note that the timestamp of sync point has usually a nonzero
  5720. + * dts_ref_dts_delta, which refers to the previous sync point. Offset of
  5721. + * the next frame after timestamp sync point will be usually 1.
  5722. + *
  5723. + * For example, this corresponds to H.264 cpb_removal_delay.
  5724. + */
  5725. + int dts_ref_dts_delta;
  5726. +
  5727. + /**
  5728. + * Presentation delay of current frame in units of AVCodecContext.time_base.
  5729. + *
  5730. + * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
  5731. + * contain valid non-negative timestamp delta (presentation time of a frame
  5732. + * must not lie in the past).
  5733. + *
  5734. + * This delay represents the difference between decoding and presentation
  5735. + * time of the frame.
  5736. + *
  5737. + * For example, this corresponds to H.264 dpb_output_delay.
  5738. + */
  5739. + int pts_dts_delta;
  5740. +
  5741. + /**
  5742. + * Position of the packet in file.
  5743. + *
  5744. + * Analogous to cur_frame_pts/dts
  5745. + */
  5746. + int64_t cur_frame_pos[AV_PARSER_PTS_NB];
  5747. +
  5748. + /**
  5749. + * Byte position of currently parsed frame in stream.
  5750. + */
  5751. + int64_t pos;
  5752. +
  5753. + /**
  5754. + * Previous frame byte position.
  5755. + */
  5756. + int64_t last_pos;
  5757. +
  5758. + /**
  5759. + * Duration of the current frame.
  5760. + * For audio, this is in units of 1 / AVCodecContext.sample_rate.
  5761. + * For all other types, this is in units of AVCodecContext.time_base.
  5762. + */
  5763. + int duration;
  5764. +
  5765. + enum AVFieldOrder field_order;
  5766. +
  5767. + /**
  5768. + * Indicate whether a picture is coded as a frame, top field or bottom field.
  5769. + *
  5770. + * For example, H.264 field_pic_flag equal to 0 corresponds to
  5771. + * AV_PICTURE_STRUCTURE_FRAME. An H.264 picture with field_pic_flag
  5772. + * equal to 1 and bottom_field_flag equal to 0 corresponds to
  5773. + * AV_PICTURE_STRUCTURE_TOP_FIELD.
  5774. + */
  5775. + enum AVPictureStructure picture_structure;
  5776. +
  5777. + /**
  5778. + * Picture number incremented in presentation or output order.
  5779. + * This field may be reinitialized at the first picture of a new sequence.
  5780. + *
  5781. + * For example, this corresponds to H.264 PicOrderCnt.
  5782. + */
  5783. + int output_picture_number;
  5784. +
  5785. + /**
  5786. + * Dimensions of the decoded video intended for presentation.
  5787. + */
  5788. + int width;
  5789. + int height;
  5790. +
  5791. + /**
  5792. + * Dimensions of the coded video.
  5793. + */
  5794. + int coded_width;
  5795. + int coded_height;
  5796. +
  5797. + /**
  5798. + * The format of the coded data, corresponds to enum AVPixelFormat for video
  5799. + * and for enum AVSampleFormat for audio.
  5800. + *
  5801. + * Note that a decoder can have considerable freedom in how exactly it
  5802. + * decodes the data, so the format reported here might be different from the
  5803. + * one returned by a decoder.
  5804. + */
  5805. + int format;
  5806. +} AVCodecParserContext;
  5807. +
  5808. +typedef struct AVCodecParser {
  5809. + int codec_ids[5]; /* several codec IDs are permitted */
  5810. + int priv_data_size;
  5811. + int (*parser_init)(AVCodecParserContext *s);
  5812. + /* This callback never returns an error, a negative value means that
  5813. + * the frame start was in a previous packet. */
  5814. + int (*parser_parse)(AVCodecParserContext *s,
  5815. + AVCodecContext *avctx,
  5816. + const uint8_t **poutbuf, int *poutbuf_size,
  5817. + const uint8_t *buf, int buf_size);
  5818. + void (*parser_close)(AVCodecParserContext *s);
  5819. + int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
  5820. + struct AVCodecParser *next;
  5821. +} AVCodecParser;
  5822. +
  5823. +/**
  5824. + * Iterate over all registered codec parsers.
  5825. + *
  5826. + * @param opaque a pointer where libavcodec will store the iteration state. Must
  5827. + * point to NULL to start the iteration.
  5828. + *
  5829. + * @return the next registered codec parser or NULL when the iteration is
  5830. + * finished
  5831. + */
  5832. +const AVCodecParser *av_parser_iterate(void **opaque);
  5833. +
  5834. +attribute_deprecated
  5835. +AVCodecParser *av_parser_next(const AVCodecParser *c);
  5836. +
  5837. +attribute_deprecated
  5838. +void av_register_codec_parser(AVCodecParser *parser);
  5839. +AVCodecParserContext *av_parser_init(int codec_id);
  5840. +
  5841. +/**
  5842. + * Parse a packet.
  5843. + *
  5844. + * @param s parser context.
  5845. + * @param avctx codec context.
  5846. + * @param poutbuf set to pointer to parsed buffer or NULL if not yet finished.
  5847. + * @param poutbuf_size set to size of parsed buffer or zero if not yet finished.
  5848. + * @param buf input buffer.
  5849. + * @param buf_size buffer size in bytes without the padding. I.e. the full buffer
  5850. + size is assumed to be buf_size + AV_INPUT_BUFFER_PADDING_SIZE.
  5851. + To signal EOF, this should be 0 (so that the last frame
  5852. + can be output).
  5853. + * @param pts input presentation timestamp.
  5854. + * @param dts input decoding timestamp.
  5855. + * @param pos input byte position in stream.
  5856. + * @return the number of bytes of the input bitstream used.
  5857. + *
  5858. + * Example:
  5859. + * @code
  5860. + * while(in_len){
  5861. + * len = av_parser_parse2(myparser, AVCodecContext, &data, &size,
  5862. + * in_data, in_len,
  5863. + * pts, dts, pos);
  5864. + * in_data += len;
  5865. + * in_len -= len;
  5866. + *
  5867. + * if(size)
  5868. + * decode_frame(data, size);
  5869. + * }
  5870. + * @endcode
  5871. + */
  5872. +int av_parser_parse2(AVCodecParserContext *s,
  5873. + AVCodecContext *avctx,
  5874. + uint8_t **poutbuf, int *poutbuf_size,
  5875. + const uint8_t *buf, int buf_size,
  5876. + int64_t pts, int64_t dts,
  5877. + int64_t pos);
  5878. +
  5879. +/**
  5880. + * @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed
  5881. + * @deprecated use AVBitStreamFilter
  5882. + */
  5883. +int av_parser_change(AVCodecParserContext *s,
  5884. + AVCodecContext *avctx,
  5885. + uint8_t **poutbuf, int *poutbuf_size,
  5886. + const uint8_t *buf, int buf_size, int keyframe);
  5887. +void av_parser_close(AVCodecParserContext *s);
  5888. +
  5889. +/**
  5890. + * @}
  5891. + * @}
  5892. + */
  5893. +
  5894. +/**
  5895. + * @addtogroup lavc_encoding
  5896. + * @{
  5897. + */
  5898. +
  5899. +/**
  5900. + * Find a registered encoder with a matching codec ID.
  5901. + *
  5902. + * @param id AVCodecID of the requested encoder
  5903. + * @return An encoder if one was found, NULL otherwise.
  5904. + */
  5905. +AVCodec *avcodec_find_encoder(enum AVCodecID id);
  5906. +
  5907. +/**
  5908. + * Find a registered encoder with the specified name.
  5909. + *
  5910. + * @param name name of the requested encoder
  5911. + * @return An encoder if one was found, NULL otherwise.
  5912. + */
  5913. +AVCodec *avcodec_find_encoder_by_name(const char *name);
  5914. +
  5915. +/**
  5916. + * Encode a frame of audio.
  5917. + *
  5918. + * Takes input samples from frame and writes the next output packet, if
  5919. + * available, to avpkt. The output packet does not necessarily contain data for
  5920. + * the most recent frame, as encoders can delay, split, and combine input frames
  5921. + * internally as needed.
  5922. + *
  5923. + * @param avctx codec context
  5924. + * @param avpkt output AVPacket.
  5925. + * The user can supply an output buffer by setting
  5926. + * avpkt->data and avpkt->size prior to calling the
  5927. + * function, but if the size of the user-provided data is not
  5928. + * large enough, encoding will fail. If avpkt->data and
  5929. + * avpkt->size are set, avpkt->destruct must also be set. All
  5930. + * other AVPacket fields will be reset by the encoder using
  5931. + * av_init_packet(). If avpkt->data is NULL, the encoder will
  5932. + * allocate it. The encoder will set avpkt->size to the size
  5933. + * of the output packet.
  5934. + *
  5935. + * If this function fails or produces no output, avpkt will be
  5936. + * freed using av_packet_unref().
  5937. + * @param[in] frame AVFrame containing the raw audio data to be encoded.
  5938. + * May be NULL when flushing an encoder that has the
  5939. + * AV_CODEC_CAP_DELAY capability set.
  5940. + * If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame
  5941. + * can have any number of samples.
  5942. + * If it is not set, frame->nb_samples must be equal to
  5943. + * avctx->frame_size for all frames except the last.
  5944. + * The final frame may be smaller than avctx->frame_size.
  5945. + * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the
  5946. + * output packet is non-empty, and to 0 if it is
  5947. + * empty. If the function returns an error, the
  5948. + * packet can be assumed to be invalid, and the
  5949. + * value of got_packet_ptr is undefined and should
  5950. + * not be used.
  5951. + * @return 0 on success, negative error code on failure
  5952. + *
  5953. + * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead
  5954. + */
  5955. +attribute_deprecated
  5956. +int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt,
  5957. + const AVFrame *frame, int *got_packet_ptr);
  5958. +
  5959. +/**
  5960. + * Encode a frame of video.
  5961. + *
  5962. + * Takes input raw video data from frame and writes the next output packet, if
  5963. + * available, to avpkt. The output packet does not necessarily contain data for
  5964. + * the most recent frame, as encoders can delay and reorder input frames
  5965. + * internally as needed.
  5966. + *
  5967. + * @param avctx codec context
  5968. + * @param avpkt output AVPacket.
  5969. + * The user can supply an output buffer by setting
  5970. + * avpkt->data and avpkt->size prior to calling the
  5971. + * function, but if the size of the user-provided data is not
  5972. + * large enough, encoding will fail. All other AVPacket fields
  5973. + * will be reset by the encoder using av_init_packet(). If
  5974. + * avpkt->data is NULL, the encoder will allocate it.
  5975. + * The encoder will set avpkt->size to the size of the
  5976. + * output packet. The returned data (if any) belongs to the
  5977. + * caller, he is responsible for freeing it.
  5978. + *
  5979. + * If this function fails or produces no output, avpkt will be
  5980. + * freed using av_packet_unref().
  5981. + * @param[in] frame AVFrame containing the raw video data to be encoded.
  5982. + * May be NULL when flushing an encoder that has the
  5983. + * AV_CODEC_CAP_DELAY capability set.
  5984. + * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the
  5985. + * output packet is non-empty, and to 0 if it is
  5986. + * empty. If the function returns an error, the
  5987. + * packet can be assumed to be invalid, and the
  5988. + * value of got_packet_ptr is undefined and should
  5989. + * not be used.
  5990. + * @return 0 on success, negative error code on failure
  5991. + *
  5992. + * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead
  5993. + */
  5994. +attribute_deprecated
  5995. +int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,
  5996. + const AVFrame *frame, int *got_packet_ptr);
  5997. +
  5998. +int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
  5999. + const AVSubtitle *sub);
  6000. +
  6001. +
  6002. +/**
  6003. + * @}
  6004. + */
  6005. +
  6006. +#if FF_API_AVPICTURE
  6007. +/**
  6008. + * @addtogroup lavc_picture
  6009. + * @{
  6010. + */
  6011. +
  6012. +/**
  6013. + * @deprecated unused
  6014. + */
  6015. +attribute_deprecated
  6016. +int avpicture_alloc(AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height);
  6017. +
  6018. +/**
  6019. + * @deprecated unused
  6020. + */
  6021. +attribute_deprecated
  6022. +void avpicture_free(AVPicture *picture);
  6023. +
  6024. +/**
  6025. + * @deprecated use av_image_fill_arrays() instead.
  6026. + */
  6027. +attribute_deprecated
  6028. +int avpicture_fill(AVPicture *picture, const uint8_t *ptr,
  6029. + enum AVPixelFormat pix_fmt, int width, int height);
  6030. +
  6031. +/**
  6032. + * @deprecated use av_image_copy_to_buffer() instead.
  6033. + */
  6034. +attribute_deprecated
  6035. +int avpicture_layout(const AVPicture *src, enum AVPixelFormat pix_fmt,
  6036. + int width, int height,
  6037. + unsigned char *dest, int dest_size);
  6038. +
  6039. +/**
  6040. + * @deprecated use av_image_get_buffer_size() instead.
  6041. + */
  6042. +attribute_deprecated
  6043. +int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height);
  6044. +
  6045. +/**
  6046. + * @deprecated av_image_copy() instead.
  6047. + */
  6048. +attribute_deprecated
  6049. +void av_picture_copy(AVPicture *dst, const AVPicture *src,
  6050. + enum AVPixelFormat pix_fmt, int width, int height);
  6051. +
  6052. +/**
  6053. + * @deprecated unused
  6054. + */
  6055. +attribute_deprecated
  6056. +int av_picture_crop(AVPicture *dst, const AVPicture *src,
  6057. + enum AVPixelFormat pix_fmt, int top_band, int left_band);
  6058. +
  6059. +/**
  6060. + * @deprecated unused
  6061. + */
  6062. +attribute_deprecated
  6063. +int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum AVPixelFormat pix_fmt,
  6064. + int padtop, int padbottom, int padleft, int padright, int *color);
  6065. +
  6066. +/**
  6067. + * @}
  6068. + */
  6069. +#endif
  6070. +
  6071. +/**
  6072. + * @defgroup lavc_misc Utility functions
  6073. + * @ingroup libavc
  6074. + *
  6075. + * Miscellaneous utility functions related to both encoding and decoding
  6076. + * (or neither).
  6077. + * @{
  6078. + */
  6079. +
  6080. +/**
  6081. + * @defgroup lavc_misc_pixfmt Pixel formats
  6082. + *
  6083. + * Functions for working with pixel formats.
  6084. + * @{
  6085. + */
  6086. +
  6087. +#if FF_API_GETCHROMA
  6088. +/**
  6089. + * @deprecated Use av_pix_fmt_get_chroma_sub_sample
  6090. + */
  6091. +
  6092. +attribute_deprecated
  6093. +void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift);
  6094. +#endif
  6095. +
  6096. +/**
  6097. + * Return a value representing the fourCC code associated to the
  6098. + * pixel format pix_fmt, or 0 if no associated fourCC code can be
  6099. + * found.
  6100. + */
  6101. +unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat pix_fmt);
  6102. +
  6103. +/**
  6104. + * @deprecated see av_get_pix_fmt_loss()
  6105. + */
  6106. +int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt,
  6107. + int has_alpha);
  6108. +
  6109. +/**
  6110. + * Find the best pixel format to convert to given a certain source pixel
  6111. + * format. When converting from one pixel format to another, information loss
  6112. + * may occur. For example, when converting from RGB24 to GRAY, the color
  6113. + * information will be lost. Similarly, other losses occur when converting from
  6114. + * some formats to other formats. avcodec_find_best_pix_fmt_of_2() searches which of
  6115. + * the given pixel formats should be used to suffer the least amount of loss.
  6116. + * The pixel formats from which it chooses one, are determined by the
  6117. + * pix_fmt_list parameter.
  6118. + *
  6119. + *
  6120. + * @param[in] pix_fmt_list AV_PIX_FMT_NONE terminated array of pixel formats to choose from
  6121. + * @param[in] src_pix_fmt source pixel format
  6122. + * @param[in] has_alpha Whether the source pixel format alpha channel is used.
  6123. + * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur.
  6124. + * @return The best pixel format to convert to or -1 if none was found.
  6125. + */
  6126. +enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *pix_fmt_list,
  6127. + enum AVPixelFormat src_pix_fmt,
  6128. + int has_alpha, int *loss_ptr);
  6129. +
  6130. +/**
  6131. + * @deprecated see av_find_best_pix_fmt_of_2()
  6132. + */
  6133. +enum AVPixelFormat avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
  6134. + enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
  6135. +
  6136. +attribute_deprecated
  6137. +enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
  6138. + enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
  6139. +
  6140. +enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat * fmt);
  6141. +
  6142. +/**
  6143. + * @}
  6144. + */
  6145. +
  6146. +#if FF_API_TAG_STRING
  6147. +/**
  6148. + * Put a string representing the codec tag codec_tag in buf.
  6149. + *
  6150. + * @param buf buffer to place codec tag in
  6151. + * @param buf_size size in bytes of buf
  6152. + * @param codec_tag codec tag to assign
  6153. + * @return the length of the string that would have been generated if
  6154. + * enough space had been available, excluding the trailing null
  6155. + *
  6156. + * @deprecated see av_fourcc_make_string() and av_fourcc2str().
  6157. + */
  6158. +attribute_deprecated
  6159. +size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag);
  6160. +#endif
  6161. +
  6162. +void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
  6163. +
  6164. +/**
  6165. + * Return a name for the specified profile, if available.
  6166. + *
  6167. + * @param codec the codec that is searched for the given profile
  6168. + * @param profile the profile value for which a name is requested
  6169. + * @return A name for the profile if found, NULL otherwise.
  6170. + */
  6171. +const char *av_get_profile_name(const AVCodec *codec, int profile);
  6172. +
  6173. +/**
  6174. + * Return a name for the specified profile, if available.
  6175. + *
  6176. + * @param codec_id the ID of the codec to which the requested profile belongs
  6177. + * @param profile the profile value for which a name is requested
  6178. + * @return A name for the profile if found, NULL otherwise.
  6179. + *
  6180. + * @note unlike av_get_profile_name(), which searches a list of profiles
  6181. + * supported by a specific decoder or encoder implementation, this
  6182. + * function searches the list of profiles from the AVCodecDescriptor
  6183. + */
  6184. +const char *avcodec_profile_name(enum AVCodecID codec_id, int profile);
  6185. +
  6186. +int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);
  6187. +int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count);
  6188. +//FIXME func typedef
  6189. +
  6190. +/**
  6191. + * Fill AVFrame audio data and linesize pointers.
  6192. + *
  6193. + * The buffer buf must be a preallocated buffer with a size big enough
  6194. + * to contain the specified samples amount. The filled AVFrame data
  6195. + * pointers will point to this buffer.
  6196. + *
  6197. + * AVFrame extended_data channel pointers are allocated if necessary for
  6198. + * planar audio.
  6199. + *
  6200. + * @param frame the AVFrame
  6201. + * frame->nb_samples must be set prior to calling the
  6202. + * function. This function fills in frame->data,
  6203. + * frame->extended_data, frame->linesize[0].
  6204. + * @param nb_channels channel count
  6205. + * @param sample_fmt sample format
  6206. + * @param buf buffer to use for frame data
  6207. + * @param buf_size size of buffer
  6208. + * @param align plane size sample alignment (0 = default)
  6209. + * @return >=0 on success, negative error code on failure
  6210. + * @todo return the size in bytes required to store the samples in
  6211. + * case of success, at the next libavutil bump
  6212. + */
  6213. +int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels,
  6214. + enum AVSampleFormat sample_fmt, const uint8_t *buf,
  6215. + int buf_size, int align);
  6216. +
  6217. +/**
  6218. + * Reset the internal decoder state / flush internal buffers. Should be called
  6219. + * e.g. when seeking or when switching to a different stream.
  6220. + *
  6221. + * @note when refcounted frames are not used (i.e. avctx->refcounted_frames is 0),
  6222. + * this invalidates the frames previously returned from the decoder. When
  6223. + * refcounted frames are used, the decoder just releases any references it might
  6224. + * keep internally, but the caller's reference remains valid.
  6225. + */
  6226. +void avcodec_flush_buffers(AVCodecContext *avctx);
  6227. +
  6228. +/**
  6229. + * Return codec bits per sample.
  6230. + *
  6231. + * @param[in] codec_id the codec
  6232. + * @return Number of bits per sample or zero if unknown for the given codec.
  6233. + */
  6234. +int av_get_bits_per_sample(enum AVCodecID codec_id);
  6235. +
  6236. +/**
  6237. + * Return the PCM codec associated with a sample format.
  6238. + * @param be endianness, 0 for little, 1 for big,
  6239. + * -1 (or anything else) for native
  6240. + * @return AV_CODEC_ID_PCM_* or AV_CODEC_ID_NONE
  6241. + */
  6242. +enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be);
  6243. +
  6244. +/**
  6245. + * Return codec bits per sample.
  6246. + * Only return non-zero if the bits per sample is exactly correct, not an
  6247. + * approximation.
  6248. + *
  6249. + * @param[in] codec_id the codec
  6250. + * @return Number of bits per sample or zero if unknown for the given codec.
  6251. + */
  6252. +int av_get_exact_bits_per_sample(enum AVCodecID codec_id);
  6253. +
  6254. +/**
  6255. + * Return audio frame duration.
  6256. + *
  6257. + * @param avctx codec context
  6258. + * @param frame_bytes size of the frame, or 0 if unknown
  6259. + * @return frame duration, in samples, if known. 0 if not able to
  6260. + * determine.
  6261. + */
  6262. +int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes);
  6263. +
  6264. +/**
  6265. + * This function is the same as av_get_audio_frame_duration(), except it works
  6266. + * with AVCodecParameters instead of an AVCodecContext.
  6267. + */
  6268. +int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes);
  6269. +
  6270. +#if FF_API_OLD_BSF
  6271. +typedef struct AVBitStreamFilterContext {
  6272. + void *priv_data;
  6273. + const struct AVBitStreamFilter *filter;
  6274. + AVCodecParserContext *parser;
  6275. + struct AVBitStreamFilterContext *next;
  6276. + /**
  6277. + * Internal default arguments, used if NULL is passed to av_bitstream_filter_filter().
  6278. + * Not for access by library users.
  6279. + */
  6280. + char *args;
  6281. +} AVBitStreamFilterContext;
  6282. +#endif
  6283. +
  6284. +typedef struct AVBSFInternal AVBSFInternal;
  6285. +
  6286. +/**
  6287. + * The bitstream filter state.
  6288. + *
  6289. + * This struct must be allocated with av_bsf_alloc() and freed with
  6290. + * av_bsf_free().
  6291. + *
  6292. + * The fields in the struct will only be changed (by the caller or by the
  6293. + * filter) as described in their documentation, and are to be considered
  6294. + * immutable otherwise.
  6295. + */
  6296. +typedef struct AVBSFContext {
  6297. + /**
  6298. + * A class for logging and AVOptions
  6299. + */
  6300. + const AVClass *av_class;
  6301. +
  6302. + /**
  6303. + * The bitstream filter this context is an instance of.
  6304. + */
  6305. + const struct AVBitStreamFilter *filter;
  6306. +
  6307. + /**
  6308. + * Opaque libavcodec internal data. Must not be touched by the caller in any
  6309. + * way.
  6310. + */
  6311. + AVBSFInternal *internal;
  6312. +
  6313. + /**
  6314. + * Opaque filter-specific private data. If filter->priv_class is non-NULL,
  6315. + * this is an AVOptions-enabled struct.
  6316. + */
  6317. + void *priv_data;
  6318. +
  6319. + /**
  6320. + * Parameters of the input stream. This field is allocated in
  6321. + * av_bsf_alloc(), it needs to be filled by the caller before
  6322. + * av_bsf_init().
  6323. + */
  6324. + AVCodecParameters *par_in;
  6325. +
  6326. + /**
  6327. + * Parameters of the output stream. This field is allocated in
  6328. + * av_bsf_alloc(), it is set by the filter in av_bsf_init().
  6329. + */
  6330. + AVCodecParameters *par_out;
  6331. +
  6332. + /**
  6333. + * The timebase used for the timestamps of the input packets. Set by the
  6334. + * caller before av_bsf_init().
  6335. + */
  6336. + AVRational time_base_in;
  6337. +
  6338. + /**
  6339. + * The timebase used for the timestamps of the output packets. Set by the
  6340. + * filter in av_bsf_init().
  6341. + */
  6342. + AVRational time_base_out;
  6343. +} AVBSFContext;
  6344. +
  6345. +typedef struct AVBitStreamFilter {
  6346. + const char *name;
  6347. +
  6348. + /**
  6349. + * A list of codec ids supported by the filter, terminated by
  6350. + * AV_CODEC_ID_NONE.
  6351. + * May be NULL, in that case the bitstream filter works with any codec id.
  6352. + */
  6353. + const enum AVCodecID *codec_ids;
  6354. +
  6355. + /**
  6356. + * A class for the private data, used to declare bitstream filter private
  6357. + * AVOptions. This field is NULL for bitstream filters that do not declare
  6358. + * any options.
  6359. + *
  6360. + * If this field is non-NULL, the first member of the filter private data
  6361. + * must be a pointer to AVClass, which will be set by libavcodec generic
  6362. + * code to this class.
  6363. + */
  6364. + const AVClass *priv_class;
  6365. +
  6366. + /*****************************************************************
  6367. + * No fields below this line are part of the public API. They
  6368. + * may not be used outside of libavcodec and can be changed and
  6369. + * removed at will.
  6370. + * New public fields should be added right above.
  6371. + *****************************************************************
  6372. + */
  6373. +
  6374. + int priv_data_size;
  6375. + int (*init)(AVBSFContext *ctx);
  6376. + int (*filter)(AVBSFContext *ctx, AVPacket *pkt);
  6377. + void (*close)(AVBSFContext *ctx);
  6378. +} AVBitStreamFilter;
  6379. +
  6380. +#if FF_API_OLD_BSF
  6381. +/**
  6382. + * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext)
  6383. + * is deprecated. Use the new bitstream filtering API (using AVBSFContext).
  6384. + */
  6385. +attribute_deprecated
  6386. +void av_register_bitstream_filter(AVBitStreamFilter *bsf);
  6387. +/**
  6388. + * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext)
  6389. + * is deprecated. Use av_bsf_get_by_name(), av_bsf_alloc(), and av_bsf_init()
  6390. + * from the new bitstream filtering API (using AVBSFContext).
  6391. + */
  6392. +attribute_deprecated
  6393. +AVBitStreamFilterContext *av_bitstream_filter_init(const char *name);
  6394. +/**
  6395. + * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext)
  6396. + * is deprecated. Use av_bsf_send_packet() and av_bsf_receive_packet() from the
  6397. + * new bitstream filtering API (using AVBSFContext).
  6398. + */
  6399. +attribute_deprecated
  6400. +int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc,
  6401. + AVCodecContext *avctx, const char *args,
  6402. + uint8_t **poutbuf, int *poutbuf_size,
  6403. + const uint8_t *buf, int buf_size, int keyframe);
  6404. +/**
  6405. + * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext)
  6406. + * is deprecated. Use av_bsf_free() from the new bitstream filtering API (using
  6407. + * AVBSFContext).
  6408. + */
  6409. +attribute_deprecated
  6410. +void av_bitstream_filter_close(AVBitStreamFilterContext *bsf);
  6411. +/**
  6412. + * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext)
  6413. + * is deprecated. Use av_bsf_iterate() from the new bitstream filtering API (using
  6414. + * AVBSFContext).
  6415. + */
  6416. +attribute_deprecated
  6417. +const AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f);
  6418. +#endif
  6419. +
  6420. +/**
  6421. + * @return a bitstream filter with the specified name or NULL if no such
  6422. + * bitstream filter exists.
  6423. + */
  6424. +const AVBitStreamFilter *av_bsf_get_by_name(const char *name);
  6425. +
  6426. +/**
  6427. + * Iterate over all registered bitstream filters.
  6428. + *
  6429. + * @param opaque a pointer where libavcodec will store the iteration state. Must
  6430. + * point to NULL to start the iteration.
  6431. + *
  6432. + * @return the next registered bitstream filter or NULL when the iteration is
  6433. + * finished
  6434. + */
  6435. +const AVBitStreamFilter *av_bsf_iterate(void **opaque);
  6436. +#if FF_API_NEXT
  6437. +attribute_deprecated
  6438. +const AVBitStreamFilter *av_bsf_next(void **opaque);
  6439. +#endif
  6440. +
  6441. +/**
  6442. + * Allocate a context for a given bitstream filter. The caller must fill in the
  6443. + * context parameters as described in the documentation and then call
  6444. + * av_bsf_init() before sending any data to the filter.
  6445. + *
  6446. + * @param filter the filter for which to allocate an instance.
  6447. + * @param ctx a pointer into which the pointer to the newly-allocated context
  6448. + * will be written. It must be freed with av_bsf_free() after the
  6449. + * filtering is done.
  6450. + *
  6451. + * @return 0 on success, a negative AVERROR code on failure
  6452. + */
  6453. +int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **ctx);
  6454. +
  6455. +/**
  6456. + * Prepare the filter for use, after all the parameters and options have been
  6457. + * set.
  6458. + */
  6459. +int av_bsf_init(AVBSFContext *ctx);
  6460. +
  6461. +/**
  6462. + * Submit a packet for filtering.
  6463. + *
  6464. + * After sending each packet, the filter must be completely drained by calling
  6465. + * av_bsf_receive_packet() repeatedly until it returns AVERROR(EAGAIN) or
  6466. + * AVERROR_EOF.
  6467. + *
  6468. + * @param pkt the packet to filter. The bitstream filter will take ownership of
  6469. + * the packet and reset the contents of pkt. pkt is not touched if an error occurs.
  6470. + * This parameter may be NULL, which signals the end of the stream (i.e. no more
  6471. + * packets will be sent). That will cause the filter to output any packets it
  6472. + * may have buffered internally.
  6473. + *
  6474. + * @return 0 on success, a negative AVERROR on error.
  6475. + */
  6476. +int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt);
  6477. +
  6478. +/**
  6479. + * Retrieve a filtered packet.
  6480. + *
  6481. + * @param[out] pkt this struct will be filled with the contents of the filtered
  6482. + * packet. It is owned by the caller and must be freed using
  6483. + * av_packet_unref() when it is no longer needed.
  6484. + * This parameter should be "clean" (i.e. freshly allocated
  6485. + * with av_packet_alloc() or unreffed with av_packet_unref())
  6486. + * when this function is called. If this function returns
  6487. + * successfully, the contents of pkt will be completely
  6488. + * overwritten by the returned data. On failure, pkt is not
  6489. + * touched.
  6490. + *
  6491. + * @return 0 on success. AVERROR(EAGAIN) if more packets need to be sent to the
  6492. + * filter (using av_bsf_send_packet()) to get more output. AVERROR_EOF if there
  6493. + * will be no further output from the filter. Another negative AVERROR value if
  6494. + * an error occurs.
  6495. + *
  6496. + * @note one input packet may result in several output packets, so after sending
  6497. + * a packet with av_bsf_send_packet(), this function needs to be called
  6498. + * repeatedly until it stops returning 0. It is also possible for a filter to
  6499. + * output fewer packets than were sent to it, so this function may return
  6500. + * AVERROR(EAGAIN) immediately after a successful av_bsf_send_packet() call.
  6501. + */
  6502. +int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt);
  6503. +
  6504. +/**
  6505. + * Free a bitstream filter context and everything associated with it; write NULL
  6506. + * into the supplied pointer.
  6507. + */
  6508. +void av_bsf_free(AVBSFContext **ctx);
  6509. +
  6510. +/**
  6511. + * Get the AVClass for AVBSFContext. It can be used in combination with
  6512. + * AV_OPT_SEARCH_FAKE_OBJ for examining options.
  6513. + *
  6514. + * @see av_opt_find().
  6515. + */
  6516. +const AVClass *av_bsf_get_class(void);
  6517. +
  6518. +/**
  6519. + * Structure for chain/list of bitstream filters.
  6520. + * Empty list can be allocated by av_bsf_list_alloc().
  6521. + */
  6522. +typedef struct AVBSFList AVBSFList;
  6523. +
  6524. +/**
  6525. + * Allocate empty list of bitstream filters.
  6526. + * The list must be later freed by av_bsf_list_free()
  6527. + * or finalized by av_bsf_list_finalize().
  6528. + *
  6529. + * @return Pointer to @ref AVBSFList on success, NULL in case of failure
  6530. + */
  6531. +AVBSFList *av_bsf_list_alloc(void);
  6532. +
  6533. +/**
  6534. + * Free list of bitstream filters.
  6535. + *
  6536. + * @param lst Pointer to pointer returned by av_bsf_list_alloc()
  6537. + */
  6538. +void av_bsf_list_free(AVBSFList **lst);
  6539. +
  6540. +/**
  6541. + * Append bitstream filter to the list of bitstream filters.
  6542. + *
  6543. + * @param lst List to append to
  6544. + * @param bsf Filter context to be appended
  6545. + *
  6546. + * @return >=0 on success, negative AVERROR in case of failure
  6547. + */
  6548. +int av_bsf_list_append(AVBSFList *lst, AVBSFContext *bsf);
  6549. +
  6550. +/**
  6551. + * Construct new bitstream filter context given it's name and options
  6552. + * and append it to the list of bitstream filters.
  6553. + *
  6554. + * @param lst List to append to
  6555. + * @param bsf_name Name of the bitstream filter
  6556. + * @param options Options for the bitstream filter, can be set to NULL
  6557. + *
  6558. + * @return >=0 on success, negative AVERROR in case of failure
  6559. + */
  6560. +int av_bsf_list_append2(AVBSFList *lst, const char * bsf_name, AVDictionary **options);
  6561. +/**
  6562. + * Finalize list of bitstream filters.
  6563. + *
  6564. + * This function will transform @ref AVBSFList to single @ref AVBSFContext,
  6565. + * so the whole chain of bitstream filters can be treated as single filter
  6566. + * freshly allocated by av_bsf_alloc().
  6567. + * If the call is successful, @ref AVBSFList structure is freed and lst
  6568. + * will be set to NULL. In case of failure, caller is responsible for
  6569. + * freeing the structure by av_bsf_list_free()
  6570. + *
  6571. + * @param lst Filter list structure to be transformed
  6572. + * @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure
  6573. + * representing the chain of bitstream filters
  6574. + *
  6575. + * @return >=0 on success, negative AVERROR in case of failure
  6576. + */
  6577. +int av_bsf_list_finalize(AVBSFList **lst, AVBSFContext **bsf);
  6578. +
  6579. +/**
  6580. + * Parse string describing list of bitstream filters and create single
  6581. + * @ref AVBSFContext describing the whole chain of bitstream filters.
  6582. + * Resulting @ref AVBSFContext can be treated as any other @ref AVBSFContext freshly
  6583. + * allocated by av_bsf_alloc().
  6584. + *
  6585. + * @param str String describing chain of bitstream filters in format
  6586. + * `bsf1[=opt1=val1:opt2=val2][,bsf2]`
  6587. + * @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure
  6588. + * representing the chain of bitstream filters
  6589. + *
  6590. + * @return >=0 on success, negative AVERROR in case of failure
  6591. + */
  6592. +int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf);
  6593. +
  6594. +/**
  6595. + * Get null/pass-through bitstream filter.
  6596. + *
  6597. + * @param[out] bsf Pointer to be set to new instance of pass-through bitstream filter
  6598. + *
  6599. + * @return
  6600. + */
  6601. +int av_bsf_get_null_filter(AVBSFContext **bsf);
  6602. +
  6603. +/* memory */
  6604. +
  6605. +/**
  6606. + * Same behaviour av_fast_malloc but the buffer has additional
  6607. + * AV_INPUT_BUFFER_PADDING_SIZE at the end which will always be 0.
  6608. + *
  6609. + * In addition the whole buffer will initially and after resizes
  6610. + * be 0-initialized so that no uninitialized data will ever appear.
  6611. + */
  6612. +void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size);
  6613. +
  6614. +/**
  6615. + * Same behaviour av_fast_padded_malloc except that buffer will always
  6616. + * be 0-initialized after call.
  6617. + */
  6618. +void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size);
  6619. +
  6620. +/**
  6621. + * Encode extradata length to a buffer. Used by xiph codecs.
  6622. + *
  6623. + * @param s buffer to write to; must be at least (v/255+1) bytes long
  6624. + * @param v size of extradata in bytes
  6625. + * @return number of bytes written to the buffer.
  6626. + */
  6627. +unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
  6628. +
  6629. +#if FF_API_USER_VISIBLE_AVHWACCEL
  6630. +/**
  6631. + * Register the hardware accelerator hwaccel.
  6632. + *
  6633. + * @deprecated This function doesn't do anything.
  6634. + */
  6635. +attribute_deprecated
  6636. +void av_register_hwaccel(AVHWAccel *hwaccel);
  6637. +
  6638. +/**
  6639. + * If hwaccel is NULL, returns the first registered hardware accelerator,
  6640. + * if hwaccel is non-NULL, returns the next registered hardware accelerator
  6641. + * after hwaccel, or NULL if hwaccel is the last one.
  6642. + *
  6643. + * @deprecated AVHWaccel structures contain no user-serviceable parts, so
  6644. + * this function should not be used.
  6645. + */
  6646. +attribute_deprecated
  6647. +AVHWAccel *av_hwaccel_next(const AVHWAccel *hwaccel);
  6648. +#endif
  6649. +
  6650. +#if FF_API_LOCKMGR
  6651. +/**
  6652. + * Lock operation used by lockmgr
  6653. + *
  6654. + * @deprecated Deprecated together with av_lockmgr_register().
  6655. + */
  6656. +enum AVLockOp {
  6657. + AV_LOCK_CREATE, ///< Create a mutex
  6658. + AV_LOCK_OBTAIN, ///< Lock the mutex
  6659. + AV_LOCK_RELEASE, ///< Unlock the mutex
  6660. + AV_LOCK_DESTROY, ///< Free mutex resources
  6661. +};
  6662. +
  6663. +/**
  6664. + * Register a user provided lock manager supporting the operations
  6665. + * specified by AVLockOp. The "mutex" argument to the function points
  6666. + * to a (void *) where the lockmgr should store/get a pointer to a user
  6667. + * allocated mutex. It is NULL upon AV_LOCK_CREATE and equal to the
  6668. + * value left by the last call for all other ops. If the lock manager is
  6669. + * unable to perform the op then it should leave the mutex in the same
  6670. + * state as when it was called and return a non-zero value. However,
  6671. + * when called with AV_LOCK_DESTROY the mutex will always be assumed to
  6672. + * have been successfully destroyed. If av_lockmgr_register succeeds
  6673. + * it will return a non-negative value, if it fails it will return a
  6674. + * negative value and destroy all mutex and unregister all callbacks.
  6675. + * av_lockmgr_register is not thread-safe, it must be called from a
  6676. + * single thread before any calls which make use of locking are used.
  6677. + *
  6678. + * @param cb User defined callback. av_lockmgr_register invokes calls
  6679. + * to this callback and the previously registered callback.
  6680. + * The callback will be used to create more than one mutex
  6681. + * each of which must be backed by its own underlying locking
  6682. + * mechanism (i.e. do not use a single static object to
  6683. + * implement your lock manager). If cb is set to NULL the
  6684. + * lockmgr will be unregistered.
  6685. + *
  6686. + * @deprecated This function does nothing, and always returns 0. Be sure to
  6687. + * build with thread support to get basic thread safety.
  6688. + */
  6689. +attribute_deprecated
  6690. +int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op));
  6691. +#endif
  6692. +
  6693. +/**
  6694. + * Get the type of the given codec.
  6695. + */
  6696. +enum AVMediaType avcodec_get_type(enum AVCodecID codec_id);
  6697. +
  6698. +/**
  6699. + * Get the name of a codec.
  6700. + * @return a static string identifying the codec; never NULL
  6701. + */
  6702. +const char *avcodec_get_name(enum AVCodecID id);
  6703. +
  6704. +/**
  6705. + * @return a positive value if s is open (i.e. avcodec_open2() was called on it
  6706. + * with no corresponding avcodec_close()), 0 otherwise.
  6707. + */
  6708. +int avcodec_is_open(AVCodecContext *s);
  6709. +
  6710. +/**
  6711. + * @return a non-zero number if codec is an encoder, zero otherwise
  6712. + */
  6713. +int av_codec_is_encoder(const AVCodec *codec);
  6714. +
  6715. +/**
  6716. + * @return a non-zero number if codec is a decoder, zero otherwise
  6717. + */
  6718. +int av_codec_is_decoder(const AVCodec *codec);
  6719. +
  6720. +/**
  6721. + * @return descriptor for given codec ID or NULL if no descriptor exists.
  6722. + */
  6723. +const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id);
  6724. +
  6725. +/**
  6726. + * Iterate over all codec descriptors known to libavcodec.
  6727. + *
  6728. + * @param prev previous descriptor. NULL to get the first descriptor.
  6729. + *
  6730. + * @return next descriptor or NULL after the last descriptor
  6731. + */
  6732. +const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev);
  6733. +
  6734. +/**
  6735. + * @return codec descriptor with the given name or NULL if no such descriptor
  6736. + * exists.
  6737. + */
  6738. +const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name);
  6739. +
  6740. +/**
  6741. + * Allocate a CPB properties structure and initialize its fields to default
  6742. + * values.
  6743. + *
  6744. + * @param size if non-NULL, the size of the allocated struct will be written
  6745. + * here. This is useful for embedding it in side data.
  6746. + *
  6747. + * @return the newly allocated struct or NULL on failure
  6748. + */
  6749. +AVCPBProperties *av_cpb_properties_alloc(size_t *size);
  6750. +
  6751. +/**
  6752. + * @}
  6753. + */
  6754. +
  6755. +#endif /* AVCODEC_AVCODEC_H */
  6756. diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avfft.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avfft.h
  6757. new file mode 100644
  6758. index 000000000000..0c0f9b8d8dae
  6759. --- /dev/null
  6760. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/avfft.h
  6761. @@ -0,0 +1,118 @@
  6762. +/*
  6763. + * This file is part of FFmpeg.
  6764. + *
  6765. + * FFmpeg is free software; you can redistribute it and/or
  6766. + * modify it under the terms of the GNU Lesser General Public
  6767. + * License as published by the Free Software Foundation; either
  6768. + * version 2.1 of the License, or (at your option) any later version.
  6769. + *
  6770. + * FFmpeg is distributed in the hope that it will be useful,
  6771. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  6772. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  6773. + * Lesser General Public License for more details.
  6774. + *
  6775. + * You should have received a copy of the GNU Lesser General Public
  6776. + * License along with FFmpeg; if not, write to the Free Software
  6777. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  6778. + */
  6779. +
  6780. +#ifndef AVCODEC_AVFFT_H
  6781. +#define AVCODEC_AVFFT_H
  6782. +
  6783. +/**
  6784. + * @file
  6785. + * @ingroup lavc_fft
  6786. + * FFT functions
  6787. + */
  6788. +
  6789. +/**
  6790. + * @defgroup lavc_fft FFT functions
  6791. + * @ingroup lavc_misc
  6792. + *
  6793. + * @{
  6794. + */
  6795. +
  6796. +typedef float FFTSample;
  6797. +
  6798. +typedef struct FFTComplex {
  6799. + FFTSample re, im;
  6800. +} FFTComplex;
  6801. +
  6802. +typedef struct FFTContext FFTContext;
  6803. +
  6804. +/**
  6805. + * Set up a complex FFT.
  6806. + * @param nbits log2 of the length of the input array
  6807. + * @param inverse if 0 perform the forward transform, if 1 perform the inverse
  6808. + */
  6809. +FFTContext *av_fft_init(int nbits, int inverse);
  6810. +
  6811. +/**
  6812. + * Do the permutation needed BEFORE calling ff_fft_calc().
  6813. + */
  6814. +void av_fft_permute(FFTContext *s, FFTComplex *z);
  6815. +
  6816. +/**
  6817. + * Do a complex FFT with the parameters defined in av_fft_init(). The
  6818. + * input data must be permuted before. No 1.0/sqrt(n) normalization is done.
  6819. + */
  6820. +void av_fft_calc(FFTContext *s, FFTComplex *z);
  6821. +
  6822. +void av_fft_end(FFTContext *s);
  6823. +
  6824. +FFTContext *av_mdct_init(int nbits, int inverse, double scale);
  6825. +void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
  6826. +void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input);
  6827. +void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
  6828. +void av_mdct_end(FFTContext *s);
  6829. +
  6830. +/* Real Discrete Fourier Transform */
  6831. +
  6832. +enum RDFTransformType {
  6833. + DFT_R2C,
  6834. + IDFT_C2R,
  6835. + IDFT_R2C,
  6836. + DFT_C2R,
  6837. +};
  6838. +
  6839. +typedef struct RDFTContext RDFTContext;
  6840. +
  6841. +/**
  6842. + * Set up a real FFT.
  6843. + * @param nbits log2 of the length of the input array
  6844. + * @param trans the type of transform
  6845. + */
  6846. +RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans);
  6847. +void av_rdft_calc(RDFTContext *s, FFTSample *data);
  6848. +void av_rdft_end(RDFTContext *s);
  6849. +
  6850. +/* Discrete Cosine Transform */
  6851. +
  6852. +typedef struct DCTContext DCTContext;
  6853. +
  6854. +enum DCTTransformType {
  6855. + DCT_II = 0,
  6856. + DCT_III,
  6857. + DCT_I,
  6858. + DST_I,
  6859. +};
  6860. +
  6861. +/**
  6862. + * Set up DCT.
  6863. + *
  6864. + * @param nbits size of the input array:
  6865. + * (1 << nbits) for DCT-II, DCT-III and DST-I
  6866. + * (1 << nbits) + 1 for DCT-I
  6867. + * @param type the type of transform
  6868. + *
  6869. + * @note the first element of the input of DST-I is ignored
  6870. + */
  6871. +DCTContext *av_dct_init(int nbits, enum DCTTransformType type);
  6872. +void av_dct_calc(DCTContext *s, FFTSample *data);
  6873. +void av_dct_end (DCTContext *s);
  6874. +
  6875. +/**
  6876. + * @}
  6877. + */
  6878. +
  6879. +#endif /* AVCODEC_AVFFT_H */
  6880. diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vaapi.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vaapi.h
  6881. new file mode 100644
  6882. index 000000000000..2cf7da5889ab
  6883. --- /dev/null
  6884. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vaapi.h
  6885. @@ -0,0 +1,86 @@
  6886. +/*
  6887. + * Video Acceleration API (shared data between FFmpeg and the video player)
  6888. + * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1
  6889. + *
  6890. + * Copyright (C) 2008-2009 Splitted-Desktop Systems
  6891. + *
  6892. + * This file is part of FFmpeg.
  6893. + *
  6894. + * FFmpeg is free software; you can redistribute it and/or
  6895. + * modify it under the terms of the GNU Lesser General Public
  6896. + * License as published by the Free Software Foundation; either
  6897. + * version 2.1 of the License, or (at your option) any later version.
  6898. + *
  6899. + * FFmpeg is distributed in the hope that it will be useful,
  6900. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  6901. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  6902. + * Lesser General Public License for more details.
  6903. + *
  6904. + * You should have received a copy of the GNU Lesser General Public
  6905. + * License along with FFmpeg; if not, write to the Free Software
  6906. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  6907. + */
  6908. +
  6909. +#ifndef AVCODEC_VAAPI_H
  6910. +#define AVCODEC_VAAPI_H
  6911. +
  6912. +/**
  6913. + * @file
  6914. + * @ingroup lavc_codec_hwaccel_vaapi
  6915. + * Public libavcodec VA API header.
  6916. + */
  6917. +
  6918. +#include <stdint.h>
  6919. +#include "libavutil/attributes.h"
  6920. +#include "version.h"
  6921. +
  6922. +#if FF_API_STRUCT_VAAPI_CONTEXT
  6923. +
  6924. +/**
  6925. + * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding
  6926. + * @ingroup lavc_codec_hwaccel
  6927. + * @{
  6928. + */
  6929. +
  6930. +/**
  6931. + * This structure is used to share data between the FFmpeg library and
  6932. + * the client video application.
  6933. + * This shall be zero-allocated and available as
  6934. + * AVCodecContext.hwaccel_context. All user members can be set once
  6935. + * during initialization or through each AVCodecContext.get_buffer()
  6936. + * function call. In any case, they must be valid prior to calling
  6937. + * decoding functions.
  6938. + *
  6939. + * Deprecated: use AVCodecContext.hw_frames_ctx instead.
  6940. + */
  6941. +struct attribute_deprecated vaapi_context {
  6942. + /**
  6943. + * Window system dependent data
  6944. + *
  6945. + * - encoding: unused
  6946. + * - decoding: Set by user
  6947. + */
  6948. + void *display;
  6949. +
  6950. + /**
  6951. + * Configuration ID
  6952. + *
  6953. + * - encoding: unused
  6954. + * - decoding: Set by user
  6955. + */
  6956. + uint32_t config_id;
  6957. +
  6958. + /**
  6959. + * Context ID (video decode pipeline)
  6960. + *
  6961. + * - encoding: unused
  6962. + * - decoding: Set by user
  6963. + */
  6964. + uint32_t context_id;
  6965. +};
  6966. +
  6967. +/* @} */
  6968. +
  6969. +#endif /* FF_API_STRUCT_VAAPI_CONTEXT */
  6970. +
  6971. +#endif /* AVCODEC_VAAPI_H */
  6972. diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vdpau.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vdpau.h
  6973. new file mode 100644
  6974. index 000000000000..4d9994336911
  6975. --- /dev/null
  6976. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/vdpau.h
  6977. @@ -0,0 +1,176 @@
  6978. +/*
  6979. + * The Video Decode and Presentation API for UNIX (VDPAU) is used for
  6980. + * hardware-accelerated decoding of MPEG-1/2, H.264 and VC-1.
  6981. + *
  6982. + * Copyright (C) 2008 NVIDIA
  6983. + *
  6984. + * This file is part of FFmpeg.
  6985. + *
  6986. + * FFmpeg is free software; you can redistribute it and/or
  6987. + * modify it under the terms of the GNU Lesser General Public
  6988. + * License as published by the Free Software Foundation; either
  6989. + * version 2.1 of the License, or (at your option) any later version.
  6990. + *
  6991. + * FFmpeg is distributed in the hope that it will be useful,
  6992. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  6993. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  6994. + * Lesser General Public License for more details.
  6995. + *
  6996. + * You should have received a copy of the GNU Lesser General Public
  6997. + * License along with FFmpeg; if not, write to the Free Software
  6998. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  6999. + */
  7000. +
  7001. +#ifndef AVCODEC_VDPAU_H
  7002. +#define AVCODEC_VDPAU_H
  7003. +
  7004. +/**
  7005. + * @file
  7006. + * @ingroup lavc_codec_hwaccel_vdpau
  7007. + * Public libavcodec VDPAU header.
  7008. + */
  7009. +
  7010. +
  7011. +/**
  7012. + * @defgroup lavc_codec_hwaccel_vdpau VDPAU Decoder and Renderer
  7013. + * @ingroup lavc_codec_hwaccel
  7014. + *
  7015. + * VDPAU hardware acceleration has two modules
  7016. + * - VDPAU decoding
  7017. + * - VDPAU presentation
  7018. + *
  7019. + * The VDPAU decoding module parses all headers using FFmpeg
  7020. + * parsing mechanisms and uses VDPAU for the actual decoding.
  7021. + *
  7022. + * As per the current implementation, the actual decoding
  7023. + * and rendering (API calls) are done as part of the VDPAU
  7024. + * presentation (vo_vdpau.c) module.
  7025. + *
  7026. + * @{
  7027. + */
  7028. +
  7029. +#include <vdpau/vdpau.h>
  7030. +
  7031. +#include "libavutil/avconfig.h"
  7032. +#include "libavutil/attributes.h"
  7033. +
  7034. +#include "avcodec.h"
  7035. +#include "version.h"
  7036. +
  7037. +struct AVCodecContext;
  7038. +struct AVFrame;
  7039. +
  7040. +typedef int (*AVVDPAU_Render2)(struct AVCodecContext *, struct AVFrame *,
  7041. + const VdpPictureInfo *, uint32_t,
  7042. + const VdpBitstreamBuffer *);
  7043. +
  7044. +/**
  7045. + * This structure is used to share data between the libavcodec library and
  7046. + * the client video application.
  7047. + * The user shall allocate the structure via the av_alloc_vdpau_hwaccel
  7048. + * function and make it available as
  7049. + * AVCodecContext.hwaccel_context. Members can be set by the user once
  7050. + * during initialization or through each AVCodecContext.get_buffer()
  7051. + * function call. In any case, they must be valid prior to calling
  7052. + * decoding functions.
  7053. + *
  7054. + * The size of this structure is not a part of the public ABI and must not
  7055. + * be used outside of libavcodec. Use av_vdpau_alloc_context() to allocate an
  7056. + * AVVDPAUContext.
  7057. + */
  7058. +typedef struct AVVDPAUContext {
  7059. + /**
  7060. + * VDPAU decoder handle
  7061. + *
  7062. + * Set by user.
  7063. + */
  7064. + VdpDecoder decoder;
  7065. +
  7066. + /**
  7067. + * VDPAU decoder render callback
  7068. + *
  7069. + * Set by the user.
  7070. + */
  7071. + VdpDecoderRender *render;
  7072. +
  7073. + AVVDPAU_Render2 render2;
  7074. +} AVVDPAUContext;
  7075. +
  7076. +/**
  7077. + * @brief allocation function for AVVDPAUContext
  7078. + *
  7079. + * Allows extending the struct without breaking API/ABI
  7080. + */
  7081. +AVVDPAUContext *av_alloc_vdpaucontext(void);
  7082. +
  7083. +AVVDPAU_Render2 av_vdpau_hwaccel_get_render2(const AVVDPAUContext *);
  7084. +void av_vdpau_hwaccel_set_render2(AVVDPAUContext *, AVVDPAU_Render2);
  7085. +
  7086. +/**
  7087. + * Associate a VDPAU device with a codec context for hardware acceleration.
  7088. + * This function is meant to be called from the get_format() codec callback,
  7089. + * or earlier. It can also be called after avcodec_flush_buffers() to change
  7090. + * the underlying VDPAU device mid-stream (e.g. to recover from non-transparent
  7091. + * display preemption).
  7092. + *
  7093. + * @note get_format() must return AV_PIX_FMT_VDPAU if this function completes
  7094. + * successfully.
  7095. + *
  7096. + * @param avctx decoding context whose get_format() callback is invoked
  7097. + * @param device VDPAU device handle to use for hardware acceleration
  7098. + * @param get_proc_address VDPAU device driver
  7099. + * @param flags zero of more OR'd AV_HWACCEL_FLAG_* flags
  7100. + *
  7101. + * @return 0 on success, an AVERROR code on failure.
  7102. + */
  7103. +int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device,
  7104. + VdpGetProcAddress *get_proc_address, unsigned flags);
  7105. +
  7106. +/**
  7107. + * Gets the parameters to create an adequate VDPAU video surface for the codec
  7108. + * context using VDPAU hardware decoding acceleration.
  7109. + *
  7110. + * @note Behavior is undefined if the context was not successfully bound to a
  7111. + * VDPAU device using av_vdpau_bind_context().
  7112. + *
  7113. + * @param avctx the codec context being used for decoding the stream
  7114. + * @param type storage space for the VDPAU video surface chroma type
  7115. + * (or NULL to ignore)
  7116. + * @param width storage space for the VDPAU video surface pixel width
  7117. + * (or NULL to ignore)
  7118. + * @param height storage space for the VDPAU video surface pixel height
  7119. + * (or NULL to ignore)
  7120. + *
  7121. + * @return 0 on success, a negative AVERROR code on failure.
  7122. + */
  7123. +int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type,
  7124. + uint32_t *width, uint32_t *height);
  7125. +
  7126. +/**
  7127. + * Allocate an AVVDPAUContext.
  7128. + *
  7129. + * @return Newly-allocated AVVDPAUContext or NULL on failure.
  7130. + */
  7131. +AVVDPAUContext *av_vdpau_alloc_context(void);
  7132. +
  7133. +#if FF_API_VDPAU_PROFILE
  7134. +/**
  7135. + * Get a decoder profile that should be used for initializing a VDPAU decoder.
  7136. + * Should be called from the AVCodecContext.get_format() callback.
  7137. + *
  7138. + * @deprecated Use av_vdpau_bind_context() instead.
  7139. + *
  7140. + * @param avctx the codec context being used for decoding the stream
  7141. + * @param profile a pointer into which the result will be written on success.
  7142. + * The contents of profile are undefined if this function returns
  7143. + * an error.
  7144. + *
  7145. + * @return 0 on success (non-negative), a negative AVERROR on failure.
  7146. + */
  7147. +attribute_deprecated
  7148. +int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile);
  7149. +#endif
  7150. +
  7151. +/* @}*/
  7152. +
  7153. +#endif /* AVCODEC_VDPAU_H */
  7154. diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/version.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/version.h
  7155. new file mode 100644
  7156. index 000000000000..6895f1a461e3
  7157. --- /dev/null
  7158. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/include/libavcodec/version.h
  7159. @@ -0,0 +1,137 @@
  7160. +/*
  7161. + * This file is part of FFmpeg.
  7162. + *
  7163. + * FFmpeg is free software; you can redistribute it and/or
  7164. + * modify it under the terms of the GNU Lesser General Public
  7165. + * License as published by the Free Software Foundation; either
  7166. + * version 2.1 of the License, or (at your option) any later version.
  7167. + *
  7168. + * FFmpeg is distributed in the hope that it will be useful,
  7169. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  7170. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  7171. + * Lesser General Public License for more details.
  7172. + *
  7173. + * You should have received a copy of the GNU Lesser General Public
  7174. + * License along with FFmpeg; if not, write to the Free Software
  7175. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  7176. + */
  7177. +
  7178. +#ifndef AVCODEC_VERSION_H
  7179. +#define AVCODEC_VERSION_H
  7180. +
  7181. +/**
  7182. + * @file
  7183. + * @ingroup libavc
  7184. + * Libavcodec version macros.
  7185. + */
  7186. +
  7187. +#include "libavutil/version.h"
  7188. +
  7189. +#define LIBAVCODEC_VERSION_MAJOR 58
  7190. +#define LIBAVCODEC_VERSION_MINOR 18
  7191. +#define LIBAVCODEC_VERSION_MICRO 100
  7192. +
  7193. +#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
  7194. + LIBAVCODEC_VERSION_MINOR, \
  7195. + LIBAVCODEC_VERSION_MICRO)
  7196. +#define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \
  7197. + LIBAVCODEC_VERSION_MINOR, \
  7198. + LIBAVCODEC_VERSION_MICRO)
  7199. +#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT
  7200. +
  7201. +#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
  7202. +
  7203. +/**
  7204. + * FF_API_* defines may be placed below to indicate public API that will be
  7205. + * dropped at a future version bump. The defines themselves are not part of
  7206. + * the public API and may change, break or disappear at any time.
  7207. + *
  7208. + * @note, when bumping the major version it is recommended to manually
  7209. + * disable each FF_API_* in its own commit instead of disabling them all
  7210. + * at once through the bump. This improves the git bisect-ability of the change.
  7211. + */
  7212. +
  7213. +#ifndef FF_API_LOWRES
  7214. +#define FF_API_LOWRES (LIBAVCODEC_VERSION_MAJOR < 59)
  7215. +#endif
  7216. +#ifndef FF_API_DEBUG_MV
  7217. +#define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 58)
  7218. +#endif
  7219. +#ifndef FF_API_AVCTX_TIMEBASE
  7220. +#define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 59)
  7221. +#endif
  7222. +#ifndef FF_API_CODED_FRAME
  7223. +#define FF_API_CODED_FRAME (LIBAVCODEC_VERSION_MAJOR < 59)
  7224. +#endif
  7225. +#ifndef FF_API_SIDEDATA_ONLY_PKT
  7226. +#define FF_API_SIDEDATA_ONLY_PKT (LIBAVCODEC_VERSION_MAJOR < 59)
  7227. +#endif
  7228. +#ifndef FF_API_VDPAU_PROFILE
  7229. +#define FF_API_VDPAU_PROFILE (LIBAVCODEC_VERSION_MAJOR < 59)
  7230. +#endif
  7231. +#ifndef FF_API_CONVERGENCE_DURATION
  7232. +#define FF_API_CONVERGENCE_DURATION (LIBAVCODEC_VERSION_MAJOR < 59)
  7233. +#endif
  7234. +#ifndef FF_API_AVPICTURE
  7235. +#define FF_API_AVPICTURE (LIBAVCODEC_VERSION_MAJOR < 59)
  7236. +#endif
  7237. +#ifndef FF_API_AVPACKET_OLD_API
  7238. +#define FF_API_AVPACKET_OLD_API (LIBAVCODEC_VERSION_MAJOR < 59)
  7239. +#endif
  7240. +#ifndef FF_API_RTP_CALLBACK
  7241. +#define FF_API_RTP_CALLBACK (LIBAVCODEC_VERSION_MAJOR < 59)
  7242. +#endif
  7243. +#ifndef FF_API_VBV_DELAY
  7244. +#define FF_API_VBV_DELAY (LIBAVCODEC_VERSION_MAJOR < 59)
  7245. +#endif
  7246. +#ifndef FF_API_CODER_TYPE
  7247. +#define FF_API_CODER_TYPE (LIBAVCODEC_VERSION_MAJOR < 59)
  7248. +#endif
  7249. +#ifndef FF_API_STAT_BITS
  7250. +#define FF_API_STAT_BITS (LIBAVCODEC_VERSION_MAJOR < 59)
  7251. +#endif
  7252. +#ifndef FF_API_PRIVATE_OPT
  7253. +#define FF_API_PRIVATE_OPT (LIBAVCODEC_VERSION_MAJOR < 59)
  7254. +#endif
  7255. +#ifndef FF_API_ASS_TIMING
  7256. +#define FF_API_ASS_TIMING (LIBAVCODEC_VERSION_MAJOR < 59)
  7257. +#endif
  7258. +#ifndef FF_API_OLD_BSF
  7259. +#define FF_API_OLD_BSF (LIBAVCODEC_VERSION_MAJOR < 59)
  7260. +#endif
  7261. +#ifndef FF_API_COPY_CONTEXT
  7262. +#define FF_API_COPY_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59)
  7263. +#endif
  7264. +#ifndef FF_API_GET_CONTEXT_DEFAULTS
  7265. +#define FF_API_GET_CONTEXT_DEFAULTS (LIBAVCODEC_VERSION_MAJOR < 59)
  7266. +#endif
  7267. +#ifndef FF_API_NVENC_OLD_NAME
  7268. +#define FF_API_NVENC_OLD_NAME (LIBAVCODEC_VERSION_MAJOR < 59)
  7269. +#endif
  7270. +#ifndef FF_API_STRUCT_VAAPI_CONTEXT
  7271. +#define FF_API_STRUCT_VAAPI_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59)
  7272. +#endif
  7273. +#ifndef FF_API_MERGE_SD_API
  7274. +#define FF_API_MERGE_SD_API (LIBAVCODEC_VERSION_MAJOR < 59)
  7275. +#endif
  7276. +#ifndef FF_API_TAG_STRING
  7277. +#define FF_API_TAG_STRING (LIBAVCODEC_VERSION_MAJOR < 59)
  7278. +#endif
  7279. +#ifndef FF_API_GETCHROMA
  7280. +#define FF_API_GETCHROMA (LIBAVCODEC_VERSION_MAJOR < 59)
  7281. +#endif
  7282. +#ifndef FF_API_CODEC_GET_SET
  7283. +#define FF_API_CODEC_GET_SET (LIBAVCODEC_VERSION_MAJOR < 59)
  7284. +#endif
  7285. +#ifndef FF_API_USER_VISIBLE_AVHWACCEL
  7286. +#define FF_API_USER_VISIBLE_AVHWACCEL (LIBAVCODEC_VERSION_MAJOR < 59)
  7287. +#endif
  7288. +#ifndef FF_API_LOCKMGR
  7289. +#define FF_API_LOCKMGR (LIBAVCODEC_VERSION_MAJOR < 59)
  7290. +#endif
  7291. +#ifndef FF_API_NEXT
  7292. +#define FF_API_NEXT (LIBAVCODEC_VERSION_MAJOR < 59)
  7293. +#endif
  7294. +
  7295. +
  7296. +#endif /* AVCODEC_VERSION_H */
  7297. diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/attributes.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/attributes.h
  7298. new file mode 100644
  7299. index 000000000000..ced108aa2c75
  7300. --- /dev/null
  7301. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/attributes.h
  7302. @@ -0,0 +1,167 @@
  7303. +/*
  7304. + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
  7305. + *
  7306. + * This file is part of FFmpeg.
  7307. + *
  7308. + * FFmpeg is free software; you can redistribute it and/or
  7309. + * modify it under the terms of the GNU Lesser General Public
  7310. + * License as published by the Free Software Foundation; either
  7311. + * version 2.1 of the License, or (at your option) any later version.
  7312. + *
  7313. + * FFmpeg is distributed in the hope that it will be useful,
  7314. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  7315. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  7316. + * Lesser General Public License for more details.
  7317. + *
  7318. + * You should have received a copy of the GNU Lesser General Public
  7319. + * License along with FFmpeg; if not, write to the Free Software
  7320. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  7321. + */
  7322. +
  7323. +/**
  7324. + * @file
  7325. + * Macro definitions for various function/variable attributes
  7326. + */
  7327. +
  7328. +#ifndef AVUTIL_ATTRIBUTES_H
  7329. +#define AVUTIL_ATTRIBUTES_H
  7330. +
  7331. +#ifdef __GNUC__
  7332. +# define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y))
  7333. +# define AV_GCC_VERSION_AT_MOST(x,y) (__GNUC__ < (x) || __GNUC__ == (x) && __GNUC_MINOR__ <= (y))
  7334. +#else
  7335. +# define AV_GCC_VERSION_AT_LEAST(x,y) 0
  7336. +# define AV_GCC_VERSION_AT_MOST(x,y) 0
  7337. +#endif
  7338. +
  7339. +#ifndef av_always_inline
  7340. +#if AV_GCC_VERSION_AT_LEAST(3,1)
  7341. +# define av_always_inline __attribute__((always_inline)) inline
  7342. +#elif defined(_MSC_VER)
  7343. +# define av_always_inline __forceinline
  7344. +#else
  7345. +# define av_always_inline inline
  7346. +#endif
  7347. +#endif
  7348. +
  7349. +#ifndef av_extern_inline
  7350. +#if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__)
  7351. +# define av_extern_inline extern inline
  7352. +#else
  7353. +# define av_extern_inline inline
  7354. +#endif
  7355. +#endif
  7356. +
  7357. +#if AV_GCC_VERSION_AT_LEAST(3,4)
  7358. +# define av_warn_unused_result __attribute__((warn_unused_result))
  7359. +#else
  7360. +# define av_warn_unused_result
  7361. +#endif
  7362. +
  7363. +#if AV_GCC_VERSION_AT_LEAST(3,1)
  7364. +# define av_noinline __attribute__((noinline))
  7365. +#elif defined(_MSC_VER)
  7366. +# define av_noinline __declspec(noinline)
  7367. +#else
  7368. +# define av_noinline
  7369. +#endif
  7370. +
  7371. +#if AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__)
  7372. +# define av_pure __attribute__((pure))
  7373. +#else
  7374. +# define av_pure
  7375. +#endif
  7376. +
  7377. +#if AV_GCC_VERSION_AT_LEAST(2,6) || defined(__clang__)
  7378. +# define av_const __attribute__((const))
  7379. +#else
  7380. +# define av_const
  7381. +#endif
  7382. +
  7383. +#if AV_GCC_VERSION_AT_LEAST(4,3) || defined(__clang__)
  7384. +# define av_cold __attribute__((cold))
  7385. +#else
  7386. +# define av_cold
  7387. +#endif
  7388. +
  7389. +#if AV_GCC_VERSION_AT_LEAST(4,1) && !defined(__llvm__)
  7390. +# define av_flatten __attribute__((flatten))
  7391. +#else
  7392. +# define av_flatten
  7393. +#endif
  7394. +
  7395. +#if AV_GCC_VERSION_AT_LEAST(3,1)
  7396. +# define attribute_deprecated __attribute__((deprecated))
  7397. +#elif defined(_MSC_VER)
  7398. +# define attribute_deprecated __declspec(deprecated)
  7399. +#else
  7400. +# define attribute_deprecated
  7401. +#endif
  7402. +
  7403. +/**
  7404. + * Disable warnings about deprecated features
  7405. + * This is useful for sections of code kept for backward compatibility and
  7406. + * scheduled for removal.
  7407. + */
  7408. +#ifndef AV_NOWARN_DEPRECATED
  7409. +#if AV_GCC_VERSION_AT_LEAST(4,6)
  7410. +# define AV_NOWARN_DEPRECATED(code) \
  7411. + _Pragma("GCC diagnostic push") \
  7412. + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
  7413. + code \
  7414. + _Pragma("GCC diagnostic pop")
  7415. +#elif defined(_MSC_VER)
  7416. +# define AV_NOWARN_DEPRECATED(code) \
  7417. + __pragma(warning(push)) \
  7418. + __pragma(warning(disable : 4996)) \
  7419. + code; \
  7420. + __pragma(warning(pop))
  7421. +#else
  7422. +# define AV_NOWARN_DEPRECATED(code) code
  7423. +#endif
  7424. +#endif
  7425. +
  7426. +#if defined(__GNUC__) || defined(__clang__)
  7427. +# define av_unused __attribute__((unused))
  7428. +#else
  7429. +# define av_unused
  7430. +#endif
  7431. +
  7432. +/**
  7433. + * Mark a variable as used and prevent the compiler from optimizing it
  7434. + * away. This is useful for variables accessed only from inline
  7435. + * assembler without the compiler being aware.
  7436. + */
  7437. +#if AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__)
  7438. +# define av_used __attribute__((used))
  7439. +#else
  7440. +# define av_used
  7441. +#endif
  7442. +
  7443. +#if AV_GCC_VERSION_AT_LEAST(3,3) || defined(__clang__)
  7444. +# define av_alias __attribute__((may_alias))
  7445. +#else
  7446. +# define av_alias
  7447. +#endif
  7448. +
  7449. +#if (defined(__GNUC__) || defined(__clang__)) && !defined(__INTEL_COMPILER)
  7450. +# define av_uninit(x) x=x
  7451. +#else
  7452. +# define av_uninit(x) x
  7453. +#endif
  7454. +
  7455. +#if defined(__GNUC__) || defined(__clang__)
  7456. +# define av_builtin_constant_p __builtin_constant_p
  7457. +# define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos)))
  7458. +#else
  7459. +# define av_builtin_constant_p(x) 0
  7460. +# define av_printf_format(fmtpos, attrpos)
  7461. +#endif
  7462. +
  7463. +#if AV_GCC_VERSION_AT_LEAST(2,5) || defined(__clang__)
  7464. +# define av_noreturn __attribute__((noreturn))
  7465. +#else
  7466. +# define av_noreturn
  7467. +#endif
  7468. +
  7469. +#endif /* AVUTIL_ATTRIBUTES_H */
  7470. diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avconfig.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avconfig.h
  7471. new file mode 100644
  7472. index 000000000000..c289fbb551c1
  7473. --- /dev/null
  7474. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avconfig.h
  7475. @@ -0,0 +1,6 @@
  7476. +/* Generated by ffmpeg configure */
  7477. +#ifndef AVUTIL_AVCONFIG_H
  7478. +#define AVUTIL_AVCONFIG_H
  7479. +#define AV_HAVE_BIGENDIAN 0
  7480. +#define AV_HAVE_FAST_UNALIGNED 1
  7481. +#endif /* AVUTIL_AVCONFIG_H */
  7482. diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avutil.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avutil.h
  7483. new file mode 100644
  7484. index 000000000000..4d633156d14d
  7485. --- /dev/null
  7486. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/avutil.h
  7487. @@ -0,0 +1,365 @@
  7488. +/*
  7489. + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
  7490. + *
  7491. + * This file is part of FFmpeg.
  7492. + *
  7493. + * FFmpeg is free software; you can redistribute it and/or
  7494. + * modify it under the terms of the GNU Lesser General Public
  7495. + * License as published by the Free Software Foundation; either
  7496. + * version 2.1 of the License, or (at your option) any later version.
  7497. + *
  7498. + * FFmpeg is distributed in the hope that it will be useful,
  7499. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  7500. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  7501. + * Lesser General Public License for more details.
  7502. + *
  7503. + * You should have received a copy of the GNU Lesser General Public
  7504. + * License along with FFmpeg; if not, write to the Free Software
  7505. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  7506. + */
  7507. +
  7508. +#ifndef AVUTIL_AVUTIL_H
  7509. +#define AVUTIL_AVUTIL_H
  7510. +
  7511. +/**
  7512. + * @file
  7513. + * @ingroup lavu
  7514. + * Convenience header that includes @ref lavu "libavutil"'s core.
  7515. + */
  7516. +
  7517. +/**
  7518. + * @mainpage
  7519. + *
  7520. + * @section ffmpeg_intro Introduction
  7521. + *
  7522. + * This document describes the usage of the different libraries
  7523. + * provided by FFmpeg.
  7524. + *
  7525. + * @li @ref libavc "libavcodec" encoding/decoding library
  7526. + * @li @ref lavfi "libavfilter" graph-based frame editing library
  7527. + * @li @ref libavf "libavformat" I/O and muxing/demuxing library
  7528. + * @li @ref lavd "libavdevice" special devices muxing/demuxing library
  7529. + * @li @ref lavu "libavutil" common utility library
  7530. + * @li @ref lswr "libswresample" audio resampling, format conversion and mixing
  7531. + * @li @ref lpp "libpostproc" post processing library
  7532. + * @li @ref libsws "libswscale" color conversion and scaling library
  7533. + *
  7534. + * @section ffmpeg_versioning Versioning and compatibility
  7535. + *
  7536. + * Each of the FFmpeg libraries contains a version.h header, which defines a
  7537. + * major, minor and micro version number with the
  7538. + * <em>LIBRARYNAME_VERSION_{MAJOR,MINOR,MICRO}</em> macros. The major version
  7539. + * number is incremented with backward incompatible changes - e.g. removing
  7540. + * parts of the public API, reordering public struct members, etc. The minor
  7541. + * version number is incremented for backward compatible API changes or major
  7542. + * new features - e.g. adding a new public function or a new decoder. The micro
  7543. + * version number is incremented for smaller changes that a calling program
  7544. + * might still want to check for - e.g. changing behavior in a previously
  7545. + * unspecified situation.
  7546. + *
  7547. + * FFmpeg guarantees backward API and ABI compatibility for each library as long
  7548. + * as its major version number is unchanged. This means that no public symbols
  7549. + * will be removed or renamed. Types and names of the public struct members and
  7550. + * values of public macros and enums will remain the same (unless they were
  7551. + * explicitly declared as not part of the public API). Documented behavior will
  7552. + * not change.
  7553. + *
  7554. + * In other words, any correct program that works with a given FFmpeg snapshot
  7555. + * should work just as well without any changes with any later snapshot with the
  7556. + * same major versions. This applies to both rebuilding the program against new
  7557. + * FFmpeg versions or to replacing the dynamic FFmpeg libraries that a program
  7558. + * links against.
  7559. + *
  7560. + * However, new public symbols may be added and new members may be appended to
  7561. + * public structs whose size is not part of public ABI (most public structs in
  7562. + * FFmpeg). New macros and enum values may be added. Behavior in undocumented
  7563. + * situations may change slightly (and be documented). All those are accompanied
  7564. + * by an entry in doc/APIchanges and incrementing either the minor or micro
  7565. + * version number.
  7566. + */
  7567. +
  7568. +/**
  7569. + * @defgroup lavu libavutil
  7570. + * Common code shared across all FFmpeg libraries.
  7571. + *
  7572. + * @note
  7573. + * libavutil is designed to be modular. In most cases, in order to use the
  7574. + * functions provided by one component of libavutil you must explicitly include
  7575. + * the specific header containing that feature. If you are only using
  7576. + * media-related components, you could simply include libavutil/avutil.h, which
  7577. + * brings in most of the "core" components.
  7578. + *
  7579. + * @{
  7580. + *
  7581. + * @defgroup lavu_crypto Crypto and Hashing
  7582. + *
  7583. + * @{
  7584. + * @}
  7585. + *
  7586. + * @defgroup lavu_math Mathematics
  7587. + * @{
  7588. + *
  7589. + * @}
  7590. + *
  7591. + * @defgroup lavu_string String Manipulation
  7592. + *
  7593. + * @{
  7594. + *
  7595. + * @}
  7596. + *
  7597. + * @defgroup lavu_mem Memory Management
  7598. + *
  7599. + * @{
  7600. + *
  7601. + * @}
  7602. + *
  7603. + * @defgroup lavu_data Data Structures
  7604. + * @{
  7605. + *
  7606. + * @}
  7607. + *
  7608. + * @defgroup lavu_video Video related
  7609. + *
  7610. + * @{
  7611. + *
  7612. + * @}
  7613. + *
  7614. + * @defgroup lavu_audio Audio related
  7615. + *
  7616. + * @{
  7617. + *
  7618. + * @}
  7619. + *
  7620. + * @defgroup lavu_error Error Codes
  7621. + *
  7622. + * @{
  7623. + *
  7624. + * @}
  7625. + *
  7626. + * @defgroup lavu_log Logging Facility
  7627. + *
  7628. + * @{
  7629. + *
  7630. + * @}
  7631. + *
  7632. + * @defgroup lavu_misc Other
  7633. + *
  7634. + * @{
  7635. + *
  7636. + * @defgroup preproc_misc Preprocessor String Macros
  7637. + *
  7638. + * @{
  7639. + *
  7640. + * @}
  7641. + *
  7642. + * @defgroup version_utils Library Version Macros
  7643. + *
  7644. + * @{
  7645. + *
  7646. + * @}
  7647. + */
  7648. +
  7649. +
  7650. +/**
  7651. + * @addtogroup lavu_ver
  7652. + * @{
  7653. + */
  7654. +
  7655. +/**
  7656. + * Return the LIBAVUTIL_VERSION_INT constant.
  7657. + */
  7658. +unsigned avutil_version(void);
  7659. +
  7660. +/**
  7661. + * Return an informative version string. This usually is the actual release
  7662. + * version number or a git commit description. This string has no fixed format
  7663. + * and can change any time. It should never be parsed by code.
  7664. + */
  7665. +const char *av_version_info(void);
  7666. +
  7667. +/**
  7668. + * Return the libavutil build-time configuration.
  7669. + */
  7670. +const char *avutil_configuration(void);
  7671. +
  7672. +/**
  7673. + * Return the libavutil license.
  7674. + */
  7675. +const char *avutil_license(void);
  7676. +
  7677. +/**
  7678. + * @}
  7679. + */
  7680. +
  7681. +/**
  7682. + * @addtogroup lavu_media Media Type
  7683. + * @brief Media Type
  7684. + */
  7685. +
  7686. +enum AVMediaType {
  7687. + AVMEDIA_TYPE_UNKNOWN = -1, ///< Usually treated as AVMEDIA_TYPE_DATA
  7688. + AVMEDIA_TYPE_VIDEO,
  7689. + AVMEDIA_TYPE_AUDIO,
  7690. + AVMEDIA_TYPE_DATA, ///< Opaque data information usually continuous
  7691. + AVMEDIA_TYPE_SUBTITLE,
  7692. + AVMEDIA_TYPE_ATTACHMENT, ///< Opaque data information usually sparse
  7693. + AVMEDIA_TYPE_NB
  7694. +};
  7695. +
  7696. +/**
  7697. + * Return a string describing the media_type enum, NULL if media_type
  7698. + * is unknown.
  7699. + */
  7700. +const char *av_get_media_type_string(enum AVMediaType media_type);
  7701. +
  7702. +/**
  7703. + * @defgroup lavu_const Constants
  7704. + * @{
  7705. + *
  7706. + * @defgroup lavu_enc Encoding specific
  7707. + *
  7708. + * @note those definition should move to avcodec
  7709. + * @{
  7710. + */
  7711. +
  7712. +#define FF_LAMBDA_SHIFT 7
  7713. +#define FF_LAMBDA_SCALE (1<<FF_LAMBDA_SHIFT)
  7714. +#define FF_QP2LAMBDA 118 ///< factor to convert from H.263 QP to lambda
  7715. +#define FF_LAMBDA_MAX (256*128-1)
  7716. +
  7717. +#define FF_QUALITY_SCALE FF_LAMBDA_SCALE //FIXME maybe remove
  7718. +
  7719. +/**
  7720. + * @}
  7721. + * @defgroup lavu_time Timestamp specific
  7722. + *
  7723. + * FFmpeg internal timebase and timestamp definitions
  7724. + *
  7725. + * @{
  7726. + */
  7727. +
  7728. +/**
  7729. + * @brief Undefined timestamp value
  7730. + *
  7731. + * Usually reported by demuxer that work on containers that do not provide
  7732. + * either pts or dts.
  7733. + */
  7734. +
  7735. +#define AV_NOPTS_VALUE ((int64_t)UINT64_C(0x8000000000000000))
  7736. +
  7737. +/**
  7738. + * Internal time base represented as integer
  7739. + */
  7740. +
  7741. +#define AV_TIME_BASE 1000000
  7742. +
  7743. +/**
  7744. + * Internal time base represented as fractional value
  7745. + */
  7746. +
  7747. +#define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE}
  7748. +
  7749. +/**
  7750. + * @}
  7751. + * @}
  7752. + * @defgroup lavu_picture Image related
  7753. + *
  7754. + * AVPicture types, pixel formats and basic image planes manipulation.
  7755. + *
  7756. + * @{
  7757. + */
  7758. +
  7759. +enum AVPictureType {
  7760. + AV_PICTURE_TYPE_NONE = 0, ///< Undefined
  7761. + AV_PICTURE_TYPE_I, ///< Intra
  7762. + AV_PICTURE_TYPE_P, ///< Predicted
  7763. + AV_PICTURE_TYPE_B, ///< Bi-dir predicted
  7764. + AV_PICTURE_TYPE_S, ///< S(GMC)-VOP MPEG-4
  7765. + AV_PICTURE_TYPE_SI, ///< Switching Intra
  7766. + AV_PICTURE_TYPE_SP, ///< Switching Predicted
  7767. + AV_PICTURE_TYPE_BI, ///< BI type
  7768. +};
  7769. +
  7770. +/**
  7771. + * Return a single letter to describe the given picture type
  7772. + * pict_type.
  7773. + *
  7774. + * @param[in] pict_type the picture type @return a single character
  7775. + * representing the picture type, '?' if pict_type is unknown
  7776. + */
  7777. +char av_get_picture_type_char(enum AVPictureType pict_type);
  7778. +
  7779. +/**
  7780. + * @}
  7781. + */
  7782. +
  7783. +#include "common.h"
  7784. +#include "error.h"
  7785. +#include "rational.h"
  7786. +#include "version.h"
  7787. +#include "macros.h"
  7788. +#include "mathematics.h"
  7789. +#include "log.h"
  7790. +#include "pixfmt.h"
  7791. +
  7792. +/**
  7793. + * Return x default pointer in case p is NULL.
  7794. + */
  7795. +static inline void *av_x_if_null(const void *p, const void *x)
  7796. +{
  7797. + return (void *)(intptr_t)(p ? p : x);
  7798. +}
  7799. +
  7800. +/**
  7801. + * Compute the length of an integer list.
  7802. + *
  7803. + * @param elsize size in bytes of each list element (only 1, 2, 4 or 8)
  7804. + * @param term list terminator (usually 0 or -1)
  7805. + * @param list pointer to the list
  7806. + * @return length of the list, in elements, not counting the terminator
  7807. + */
  7808. +unsigned av_int_list_length_for_size(unsigned elsize,
  7809. + const void *list, uint64_t term) av_pure;
  7810. +
  7811. +/**
  7812. + * Compute the length of an integer list.
  7813. + *
  7814. + * @param term list terminator (usually 0 or -1)
  7815. + * @param list pointer to the list
  7816. + * @return length of the list, in elements, not counting the terminator
  7817. + */
  7818. +#define av_int_list_length(list, term) \
  7819. + av_int_list_length_for_size(sizeof(*(list)), list, term)
  7820. +
  7821. +/**
  7822. + * Open a file using a UTF-8 filename.
  7823. + * The API of this function matches POSIX fopen(), errors are returned through
  7824. + * errno.
  7825. + */
  7826. +FILE *av_fopen_utf8(const char *path, const char *mode);
  7827. +
  7828. +/**
  7829. + * Return the fractional representation of the internal time base.
  7830. + */
  7831. +AVRational av_get_time_base_q(void);
  7832. +
  7833. +#define AV_FOURCC_MAX_STRING_SIZE 32
  7834. +
  7835. +#define av_fourcc2str(fourcc) av_fourcc_make_string((char[AV_FOURCC_MAX_STRING_SIZE]){0}, fourcc)
  7836. +
  7837. +/**
  7838. + * Fill the provided buffer with a string containing a FourCC (four-character
  7839. + * code) representation.
  7840. + *
  7841. + * @param buf a buffer with size in bytes of at least AV_FOURCC_MAX_STRING_SIZE
  7842. + * @param fourcc the fourcc to represent
  7843. + * @return the buffer in input
  7844. + */
  7845. +char *av_fourcc_make_string(char *buf, uint32_t fourcc);
  7846. +
  7847. +/**
  7848. + * @}
  7849. + * @}
  7850. + */
  7851. +
  7852. +#endif /* AVUTIL_AVUTIL_H */
  7853. diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/buffer.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/buffer.h
  7854. new file mode 100644
  7855. index 000000000000..73b6bd0b148e
  7856. --- /dev/null
  7857. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/buffer.h
  7858. @@ -0,0 +1,291 @@
  7859. +/*
  7860. + * This file is part of FFmpeg.
  7861. + *
  7862. + * FFmpeg is free software; you can redistribute it and/or
  7863. + * modify it under the terms of the GNU Lesser General Public
  7864. + * License as published by the Free Software Foundation; either
  7865. + * version 2.1 of the License, or (at your option) any later version.
  7866. + *
  7867. + * FFmpeg is distributed in the hope that it will be useful,
  7868. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  7869. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  7870. + * Lesser General Public License for more details.
  7871. + *
  7872. + * You should have received a copy of the GNU Lesser General Public
  7873. + * License along with FFmpeg; if not, write to the Free Software
  7874. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  7875. + */
  7876. +
  7877. +/**
  7878. + * @file
  7879. + * @ingroup lavu_buffer
  7880. + * refcounted data buffer API
  7881. + */
  7882. +
  7883. +#ifndef AVUTIL_BUFFER_H
  7884. +#define AVUTIL_BUFFER_H
  7885. +
  7886. +#include <stdint.h>
  7887. +
  7888. +/**
  7889. + * @defgroup lavu_buffer AVBuffer
  7890. + * @ingroup lavu_data
  7891. + *
  7892. + * @{
  7893. + * AVBuffer is an API for reference-counted data buffers.
  7894. + *
  7895. + * There are two core objects in this API -- AVBuffer and AVBufferRef. AVBuffer
  7896. + * represents the data buffer itself; it is opaque and not meant to be accessed
  7897. + * by the caller directly, but only through AVBufferRef. However, the caller may
  7898. + * e.g. compare two AVBuffer pointers to check whether two different references
  7899. + * are describing the same data buffer. AVBufferRef represents a single
  7900. + * reference to an AVBuffer and it is the object that may be manipulated by the
  7901. + * caller directly.
  7902. + *
  7903. + * There are two functions provided for creating a new AVBuffer with a single
  7904. + * reference -- av_buffer_alloc() to just allocate a new buffer, and
  7905. + * av_buffer_create() to wrap an existing array in an AVBuffer. From an existing
  7906. + * reference, additional references may be created with av_buffer_ref().
  7907. + * Use av_buffer_unref() to free a reference (this will automatically free the
  7908. + * data once all the references are freed).
  7909. + *
  7910. + * The convention throughout this API and the rest of FFmpeg is such that the
  7911. + * buffer is considered writable if there exists only one reference to it (and
  7912. + * it has not been marked as read-only). The av_buffer_is_writable() function is
  7913. + * provided to check whether this is true and av_buffer_make_writable() will
  7914. + * automatically create a new writable buffer when necessary.
  7915. + * Of course nothing prevents the calling code from violating this convention,
  7916. + * however that is safe only when all the existing references are under its
  7917. + * control.
  7918. + *
  7919. + * @note Referencing and unreferencing the buffers is thread-safe and thus
  7920. + * may be done from multiple threads simultaneously without any need for
  7921. + * additional locking.
  7922. + *
  7923. + * @note Two different references to the same buffer can point to different
  7924. + * parts of the buffer (i.e. their AVBufferRef.data will not be equal).
  7925. + */
  7926. +
  7927. +/**
  7928. + * A reference counted buffer type. It is opaque and is meant to be used through
  7929. + * references (AVBufferRef).
  7930. + */
  7931. +typedef struct AVBuffer AVBuffer;
  7932. +
  7933. +/**
  7934. + * A reference to a data buffer.
  7935. + *
  7936. + * The size of this struct is not a part of the public ABI and it is not meant
  7937. + * to be allocated directly.
  7938. + */
  7939. +typedef struct AVBufferRef {
  7940. + AVBuffer *buffer;
  7941. +
  7942. + /**
  7943. + * The data buffer. It is considered writable if and only if
  7944. + * this is the only reference to the buffer, in which case
  7945. + * av_buffer_is_writable() returns 1.
  7946. + */
  7947. + uint8_t *data;
  7948. + /**
  7949. + * Size of data in bytes.
  7950. + */
  7951. + int size;
  7952. +} AVBufferRef;
  7953. +
  7954. +/**
  7955. + * Allocate an AVBuffer of the given size using av_malloc().
  7956. + *
  7957. + * @return an AVBufferRef of given size or NULL when out of memory
  7958. + */
  7959. +AVBufferRef *av_buffer_alloc(int size);
  7960. +
  7961. +/**
  7962. + * Same as av_buffer_alloc(), except the returned buffer will be initialized
  7963. + * to zero.
  7964. + */
  7965. +AVBufferRef *av_buffer_allocz(int size);
  7966. +
  7967. +/**
  7968. + * Always treat the buffer as read-only, even when it has only one
  7969. + * reference.
  7970. + */
  7971. +#define AV_BUFFER_FLAG_READONLY (1 << 0)
  7972. +
  7973. +/**
  7974. + * Create an AVBuffer from an existing array.
  7975. + *
  7976. + * If this function is successful, data is owned by the AVBuffer. The caller may
  7977. + * only access data through the returned AVBufferRef and references derived from
  7978. + * it.
  7979. + * If this function fails, data is left untouched.
  7980. + * @param data data array
  7981. + * @param size size of data in bytes
  7982. + * @param free a callback for freeing this buffer's data
  7983. + * @param opaque parameter to be got for processing or passed to free
  7984. + * @param flags a combination of AV_BUFFER_FLAG_*
  7985. + *
  7986. + * @return an AVBufferRef referring to data on success, NULL on failure.
  7987. + */
  7988. +AVBufferRef *av_buffer_create(uint8_t *data, int size,
  7989. + void (*free)(void *opaque, uint8_t *data),
  7990. + void *opaque, int flags);
  7991. +
  7992. +/**
  7993. + * Default free callback, which calls av_free() on the buffer data.
  7994. + * This function is meant to be passed to av_buffer_create(), not called
  7995. + * directly.
  7996. + */
  7997. +void av_buffer_default_free(void *opaque, uint8_t *data);
  7998. +
  7999. +/**
  8000. + * Create a new reference to an AVBuffer.
  8001. + *
  8002. + * @return a new AVBufferRef referring to the same AVBuffer as buf or NULL on
  8003. + * failure.
  8004. + */
  8005. +AVBufferRef *av_buffer_ref(AVBufferRef *buf);
  8006. +
  8007. +/**
  8008. + * Free a given reference and automatically free the buffer if there are no more
  8009. + * references to it.
  8010. + *
  8011. + * @param buf the reference to be freed. The pointer is set to NULL on return.
  8012. + */
  8013. +void av_buffer_unref(AVBufferRef **buf);
  8014. +
  8015. +/**
  8016. + * @return 1 if the caller may write to the data referred to by buf (which is
  8017. + * true if and only if buf is the only reference to the underlying AVBuffer).
  8018. + * Return 0 otherwise.
  8019. + * A positive answer is valid until av_buffer_ref() is called on buf.
  8020. + */
  8021. +int av_buffer_is_writable(const AVBufferRef *buf);
  8022. +
  8023. +/**
  8024. + * @return the opaque parameter set by av_buffer_create.
  8025. + */
  8026. +void *av_buffer_get_opaque(const AVBufferRef *buf);
  8027. +
  8028. +int av_buffer_get_ref_count(const AVBufferRef *buf);
  8029. +
  8030. +/**
  8031. + * Create a writable reference from a given buffer reference, avoiding data copy
  8032. + * if possible.
  8033. + *
  8034. + * @param buf buffer reference to make writable. On success, buf is either left
  8035. + * untouched, or it is unreferenced and a new writable AVBufferRef is
  8036. + * written in its place. On failure, buf is left untouched.
  8037. + * @return 0 on success, a negative AVERROR on failure.
  8038. + */
  8039. +int av_buffer_make_writable(AVBufferRef **buf);
  8040. +
  8041. +/**
  8042. + * Reallocate a given buffer.
  8043. + *
  8044. + * @param buf a buffer reference to reallocate. On success, buf will be
  8045. + * unreferenced and a new reference with the required size will be
  8046. + * written in its place. On failure buf will be left untouched. *buf
  8047. + * may be NULL, then a new buffer is allocated.
  8048. + * @param size required new buffer size.
  8049. + * @return 0 on success, a negative AVERROR on failure.
  8050. + *
  8051. + * @note the buffer is actually reallocated with av_realloc() only if it was
  8052. + * initially allocated through av_buffer_realloc(NULL) and there is only one
  8053. + * reference to it (i.e. the one passed to this function). In all other cases
  8054. + * a new buffer is allocated and the data is copied.
  8055. + */
  8056. +int av_buffer_realloc(AVBufferRef **buf, int size);
  8057. +
  8058. +/**
  8059. + * @}
  8060. + */
  8061. +
  8062. +/**
  8063. + * @defgroup lavu_bufferpool AVBufferPool
  8064. + * @ingroup lavu_data
  8065. + *
  8066. + * @{
  8067. + * AVBufferPool is an API for a lock-free thread-safe pool of AVBuffers.
  8068. + *
  8069. + * Frequently allocating and freeing large buffers may be slow. AVBufferPool is
  8070. + * meant to solve this in cases when the caller needs a set of buffers of the
  8071. + * same size (the most obvious use case being buffers for raw video or audio
  8072. + * frames).
  8073. + *
  8074. + * At the beginning, the user must call av_buffer_pool_init() to create the
  8075. + * buffer pool. Then whenever a buffer is needed, call av_buffer_pool_get() to
  8076. + * get a reference to a new buffer, similar to av_buffer_alloc(). This new
  8077. + * reference works in all aspects the same way as the one created by
  8078. + * av_buffer_alloc(). However, when the last reference to this buffer is
  8079. + * unreferenced, it is returned to the pool instead of being freed and will be
  8080. + * reused for subsequent av_buffer_pool_get() calls.
  8081. + *
  8082. + * When the caller is done with the pool and no longer needs to allocate any new
  8083. + * buffers, av_buffer_pool_uninit() must be called to mark the pool as freeable.
  8084. + * Once all the buffers are released, it will automatically be freed.
  8085. + *
  8086. + * Allocating and releasing buffers with this API is thread-safe as long as
  8087. + * either the default alloc callback is used, or the user-supplied one is
  8088. + * thread-safe.
  8089. + */
  8090. +
  8091. +/**
  8092. + * The buffer pool. This structure is opaque and not meant to be accessed
  8093. + * directly. It is allocated with av_buffer_pool_init() and freed with
  8094. + * av_buffer_pool_uninit().
  8095. + */
  8096. +typedef struct AVBufferPool AVBufferPool;
  8097. +
  8098. +/**
  8099. + * Allocate and initialize a buffer pool.
  8100. + *
  8101. + * @param size size of each buffer in this pool
  8102. + * @param alloc a function that will be used to allocate new buffers when the
  8103. + * pool is empty. May be NULL, then the default allocator will be used
  8104. + * (av_buffer_alloc()).
  8105. + * @return newly created buffer pool on success, NULL on error.
  8106. + */
  8107. +AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size));
  8108. +
  8109. +/**
  8110. + * Allocate and initialize a buffer pool with a more complex allocator.
  8111. + *
  8112. + * @param size size of each buffer in this pool
  8113. + * @param opaque arbitrary user data used by the allocator
  8114. + * @param alloc a function that will be used to allocate new buffers when the
  8115. + * pool is empty.
  8116. + * @param pool_free a function that will be called immediately before the pool
  8117. + * is freed. I.e. after av_buffer_pool_uninit() is called
  8118. + * by the caller and all the frames are returned to the pool
  8119. + * and freed. It is intended to uninitialize the user opaque
  8120. + * data.
  8121. + * @return newly created buffer pool on success, NULL on error.
  8122. + */
  8123. +AVBufferPool *av_buffer_pool_init2(int size, void *opaque,
  8124. + AVBufferRef* (*alloc)(void *opaque, int size),
  8125. + void (*pool_free)(void *opaque));
  8126. +
  8127. +/**
  8128. + * Mark the pool as being available for freeing. It will actually be freed only
  8129. + * once all the allocated buffers associated with the pool are released. Thus it
  8130. + * is safe to call this function while some of the allocated buffers are still
  8131. + * in use.
  8132. + *
  8133. + * @param pool pointer to the pool to be freed. It will be set to NULL.
  8134. + */
  8135. +void av_buffer_pool_uninit(AVBufferPool **pool);
  8136. +
  8137. +/**
  8138. + * Allocate a new AVBuffer, reusing an old buffer from the pool when available.
  8139. + * This function may be called simultaneously from multiple threads.
  8140. + *
  8141. + * @return a reference to the new buffer on success, NULL on error.
  8142. + */
  8143. +AVBufferRef *av_buffer_pool_get(AVBufferPool *pool);
  8144. +
  8145. +/**
  8146. + * @}
  8147. + */
  8148. +
  8149. +#endif /* AVUTIL_BUFFER_H */
  8150. diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/channel_layout.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/channel_layout.h
  8151. new file mode 100644
  8152. index 000000000000..50bb8f03c586
  8153. --- /dev/null
  8154. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/channel_layout.h
  8155. @@ -0,0 +1,232 @@
  8156. +/*
  8157. + * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
  8158. + * Copyright (c) 2008 Peter Ross
  8159. + *
  8160. + * This file is part of FFmpeg.
  8161. + *
  8162. + * FFmpeg is free software; you can redistribute it and/or
  8163. + * modify it under the terms of the GNU Lesser General Public
  8164. + * License as published by the Free Software Foundation; either
  8165. + * version 2.1 of the License, or (at your option) any later version.
  8166. + *
  8167. + * FFmpeg is distributed in the hope that it will be useful,
  8168. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8169. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  8170. + * Lesser General Public License for more details.
  8171. + *
  8172. + * You should have received a copy of the GNU Lesser General Public
  8173. + * License along with FFmpeg; if not, write to the Free Software
  8174. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  8175. + */
  8176. +
  8177. +#ifndef AVUTIL_CHANNEL_LAYOUT_H
  8178. +#define AVUTIL_CHANNEL_LAYOUT_H
  8179. +
  8180. +#include <stdint.h>
  8181. +
  8182. +/**
  8183. + * @file
  8184. + * audio channel layout utility functions
  8185. + */
  8186. +
  8187. +/**
  8188. + * @addtogroup lavu_audio
  8189. + * @{
  8190. + */
  8191. +
  8192. +/**
  8193. + * @defgroup channel_masks Audio channel masks
  8194. + *
  8195. + * A channel layout is a 64-bits integer with a bit set for every channel.
  8196. + * The number of bits set must be equal to the number of channels.
  8197. + * The value 0 means that the channel layout is not known.
  8198. + * @note this data structure is not powerful enough to handle channels
  8199. + * combinations that have the same channel multiple times, such as
  8200. + * dual-mono.
  8201. + *
  8202. + * @{
  8203. + */
  8204. +#define AV_CH_FRONT_LEFT 0x00000001
  8205. +#define AV_CH_FRONT_RIGHT 0x00000002
  8206. +#define AV_CH_FRONT_CENTER 0x00000004
  8207. +#define AV_CH_LOW_FREQUENCY 0x00000008
  8208. +#define AV_CH_BACK_LEFT 0x00000010
  8209. +#define AV_CH_BACK_RIGHT 0x00000020
  8210. +#define AV_CH_FRONT_LEFT_OF_CENTER 0x00000040
  8211. +#define AV_CH_FRONT_RIGHT_OF_CENTER 0x00000080
  8212. +#define AV_CH_BACK_CENTER 0x00000100
  8213. +#define AV_CH_SIDE_LEFT 0x00000200
  8214. +#define AV_CH_SIDE_RIGHT 0x00000400
  8215. +#define AV_CH_TOP_CENTER 0x00000800
  8216. +#define AV_CH_TOP_FRONT_LEFT 0x00001000
  8217. +#define AV_CH_TOP_FRONT_CENTER 0x00002000
  8218. +#define AV_CH_TOP_FRONT_RIGHT 0x00004000
  8219. +#define AV_CH_TOP_BACK_LEFT 0x00008000
  8220. +#define AV_CH_TOP_BACK_CENTER 0x00010000
  8221. +#define AV_CH_TOP_BACK_RIGHT 0x00020000
  8222. +#define AV_CH_STEREO_LEFT 0x20000000 ///< Stereo downmix.
  8223. +#define AV_CH_STEREO_RIGHT 0x40000000 ///< See AV_CH_STEREO_LEFT.
  8224. +#define AV_CH_WIDE_LEFT 0x0000000080000000ULL
  8225. +#define AV_CH_WIDE_RIGHT 0x0000000100000000ULL
  8226. +#define AV_CH_SURROUND_DIRECT_LEFT 0x0000000200000000ULL
  8227. +#define AV_CH_SURROUND_DIRECT_RIGHT 0x0000000400000000ULL
  8228. +#define AV_CH_LOW_FREQUENCY_2 0x0000000800000000ULL
  8229. +
  8230. +/** Channel mask value used for AVCodecContext.request_channel_layout
  8231. + to indicate that the user requests the channel order of the decoder output
  8232. + to be the native codec channel order. */
  8233. +#define AV_CH_LAYOUT_NATIVE 0x8000000000000000ULL
  8234. +
  8235. +/**
  8236. + * @}
  8237. + * @defgroup channel_mask_c Audio channel layouts
  8238. + * @{
  8239. + * */
  8240. +#define AV_CH_LAYOUT_MONO (AV_CH_FRONT_CENTER)
  8241. +#define AV_CH_LAYOUT_STEREO (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT)
  8242. +#define AV_CH_LAYOUT_2POINT1 (AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY)
  8243. +#define AV_CH_LAYOUT_2_1 (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER)
  8244. +#define AV_CH_LAYOUT_SURROUND (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER)
  8245. +#define AV_CH_LAYOUT_3POINT1 (AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY)
  8246. +#define AV_CH_LAYOUT_4POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER)
  8247. +#define AV_CH_LAYOUT_4POINT1 (AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY)
  8248. +#define AV_CH_LAYOUT_2_2 (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
  8249. +#define AV_CH_LAYOUT_QUAD (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
  8250. +#define AV_CH_LAYOUT_5POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
  8251. +#define AV_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY)
  8252. +#define AV_CH_LAYOUT_5POINT0_BACK (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
  8253. +#define AV_CH_LAYOUT_5POINT1_BACK (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY)
  8254. +#define AV_CH_LAYOUT_6POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER)
  8255. +#define AV_CH_LAYOUT_6POINT0_FRONT (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
  8256. +#define AV_CH_LAYOUT_HEXAGONAL (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER)
  8257. +#define AV_CH_LAYOUT_6POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER)
  8258. +#define AV_CH_LAYOUT_6POINT1_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER)
  8259. +#define AV_CH_LAYOUT_6POINT1_FRONT (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY)
  8260. +#define AV_CH_LAYOUT_7POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
  8261. +#define AV_CH_LAYOUT_7POINT0_FRONT (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
  8262. +#define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
  8263. +#define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
  8264. +#define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
  8265. +#define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT)
  8266. +#define AV_CH_LAYOUT_HEXADECAGONAL (AV_CH_LAYOUT_OCTAGONAL|AV_CH_WIDE_LEFT|AV_CH_WIDE_RIGHT|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT|AV_CH_TOP_BACK_CENTER|AV_CH_TOP_FRONT_CENTER|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT)
  8267. +#define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT)
  8268. +
  8269. +enum AVMatrixEncoding {
  8270. + AV_MATRIX_ENCODING_NONE,
  8271. + AV_MATRIX_ENCODING_DOLBY,
  8272. + AV_MATRIX_ENCODING_DPLII,
  8273. + AV_MATRIX_ENCODING_DPLIIX,
  8274. + AV_MATRIX_ENCODING_DPLIIZ,
  8275. + AV_MATRIX_ENCODING_DOLBYEX,
  8276. + AV_MATRIX_ENCODING_DOLBYHEADPHONE,
  8277. + AV_MATRIX_ENCODING_NB
  8278. +};
  8279. +
  8280. +/**
  8281. + * Return a channel layout id that matches name, or 0 if no match is found.
  8282. + *
  8283. + * name can be one or several of the following notations,
  8284. + * separated by '+' or '|':
  8285. + * - the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0,
  8286. + * 5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix);
  8287. + * - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC,
  8288. + * SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR);
  8289. + * - a number of channels, in decimal, followed by 'c', yielding
  8290. + * the default channel layout for that number of channels (@see
  8291. + * av_get_default_channel_layout);
  8292. + * - a channel layout mask, in hexadecimal starting with "0x" (see the
  8293. + * AV_CH_* macros).
  8294. + *
  8295. + * Example: "stereo+FC" = "2c+FC" = "2c+1c" = "0x7"
  8296. + */
  8297. +uint64_t av_get_channel_layout(const char *name);
  8298. +
  8299. +/**
  8300. + * Return a channel layout and the number of channels based on the specified name.
  8301. + *
  8302. + * This function is similar to (@see av_get_channel_layout), but can also parse
  8303. + * unknown channel layout specifications.
  8304. + *
  8305. + * @param[in] name channel layout specification string
  8306. + * @param[out] channel_layout parsed channel layout (0 if unknown)
  8307. + * @param[out] nb_channels number of channels
  8308. + *
  8309. + * @return 0 on success, AVERROR(EINVAL) if the parsing fails.
  8310. + */
  8311. +int av_get_extended_channel_layout(const char *name, uint64_t* channel_layout, int* nb_channels);
  8312. +
  8313. +/**
  8314. + * Return a description of a channel layout.
  8315. + * If nb_channels is <= 0, it is guessed from the channel_layout.
  8316. + *
  8317. + * @param buf put here the string containing the channel layout
  8318. + * @param buf_size size in bytes of the buffer
  8319. + */
  8320. +void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout);
  8321. +
  8322. +struct AVBPrint;
  8323. +/**
  8324. + * Append a description of a channel layout to a bprint buffer.
  8325. + */
  8326. +void av_bprint_channel_layout(struct AVBPrint *bp, int nb_channels, uint64_t channel_layout);
  8327. +
  8328. +/**
  8329. + * Return the number of channels in the channel layout.
  8330. + */
  8331. +int av_get_channel_layout_nb_channels(uint64_t channel_layout);
  8332. +
  8333. +/**
  8334. + * Return default channel layout for a given number of channels.
  8335. + */
  8336. +int64_t av_get_default_channel_layout(int nb_channels);
  8337. +
  8338. +/**
  8339. + * Get the index of a channel in channel_layout.
  8340. + *
  8341. + * @param channel a channel layout describing exactly one channel which must be
  8342. + * present in channel_layout.
  8343. + *
  8344. + * @return index of channel in channel_layout on success, a negative AVERROR
  8345. + * on error.
  8346. + */
  8347. +int av_get_channel_layout_channel_index(uint64_t channel_layout,
  8348. + uint64_t channel);
  8349. +
  8350. +/**
  8351. + * Get the channel with the given index in channel_layout.
  8352. + */
  8353. +uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index);
  8354. +
  8355. +/**
  8356. + * Get the name of a given channel.
  8357. + *
  8358. + * @return channel name on success, NULL on error.
  8359. + */
  8360. +const char *av_get_channel_name(uint64_t channel);
  8361. +
  8362. +/**
  8363. + * Get the description of a given channel.
  8364. + *
  8365. + * @param channel a channel layout with a single channel
  8366. + * @return channel description on success, NULL on error
  8367. + */
  8368. +const char *av_get_channel_description(uint64_t channel);
  8369. +
  8370. +/**
  8371. + * Get the value and name of a standard channel layout.
  8372. + *
  8373. + * @param[in] index index in an internal list, starting at 0
  8374. + * @param[out] layout channel layout mask
  8375. + * @param[out] name name of the layout
  8376. + * @return 0 if the layout exists,
  8377. + * <0 if index is beyond the limits
  8378. + */
  8379. +int av_get_standard_channel_layout(unsigned index, uint64_t *layout,
  8380. + const char **name);
  8381. +
  8382. +/**
  8383. + * @}
  8384. + * @}
  8385. + */
  8386. +
  8387. +#endif /* AVUTIL_CHANNEL_LAYOUT_H */
  8388. diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/common.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/common.h
  8389. new file mode 100644
  8390. index 000000000000..0fffa67714e8
  8391. --- /dev/null
  8392. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/common.h
  8393. @@ -0,0 +1,560 @@
  8394. +/*
  8395. + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
  8396. + *
  8397. + * This file is part of FFmpeg.
  8398. + *
  8399. + * FFmpeg is free software; you can redistribute it and/or
  8400. + * modify it under the terms of the GNU Lesser General Public
  8401. + * License as published by the Free Software Foundation; either
  8402. + * version 2.1 of the License, or (at your option) any later version.
  8403. + *
  8404. + * FFmpeg is distributed in the hope that it will be useful,
  8405. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8406. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  8407. + * Lesser General Public License for more details.
  8408. + *
  8409. + * You should have received a copy of the GNU Lesser General Public
  8410. + * License along with FFmpeg; if not, write to the Free Software
  8411. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  8412. + */
  8413. +
  8414. +/**
  8415. + * @file
  8416. + * common internal and external API header
  8417. + */
  8418. +
  8419. +#ifndef AVUTIL_COMMON_H
  8420. +#define AVUTIL_COMMON_H
  8421. +
  8422. +#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS) && !defined(UINT64_C)
  8423. +#error missing -D__STDC_CONSTANT_MACROS / #define __STDC_CONSTANT_MACROS
  8424. +#endif
  8425. +
  8426. +#include <errno.h>
  8427. +#include <inttypes.h>
  8428. +#include <limits.h>
  8429. +#include <math.h>
  8430. +#include <stdint.h>
  8431. +#include <stdio.h>
  8432. +#include <stdlib.h>
  8433. +#include <string.h>
  8434. +
  8435. +#include "attributes.h"
  8436. +#include "macros.h"
  8437. +#include "version.h"
  8438. +#include "libavutil/avconfig.h"
  8439. +
  8440. +#if AV_HAVE_BIGENDIAN
  8441. +# define AV_NE(be, le) (be)
  8442. +#else
  8443. +# define AV_NE(be, le) (le)
  8444. +#endif
  8445. +
  8446. +//rounded division & shift
  8447. +#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))
  8448. +/* assume b>0 */
  8449. +#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
  8450. +/* Fast a/(1<<b) rounded toward +inf. Assume a>=0 and b>=0 */
  8451. +#define AV_CEIL_RSHIFT(a,b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \
  8452. + : ((a) + (1<<(b)) - 1) >> (b))
  8453. +/* Backwards compat. */
  8454. +#define FF_CEIL_RSHIFT AV_CEIL_RSHIFT
  8455. +
  8456. +#define FFUDIV(a,b) (((a)>0 ?(a):(a)-(b)+1) / (b))
  8457. +#define FFUMOD(a,b) ((a)-(b)*FFUDIV(a,b))
  8458. +
  8459. +/**
  8460. + * Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they
  8461. + * are not representable as absolute values of their type. This is the same
  8462. + * as with *abs()
  8463. + * @see FFNABS()
  8464. + */
  8465. +#define FFABS(a) ((a) >= 0 ? (a) : (-(a)))
  8466. +#define FFSIGN(a) ((a) > 0 ? 1 : -1)
  8467. +
  8468. +/**
  8469. + * Negative Absolute value.
  8470. + * this works for all integers of all types.
  8471. + * As with many macros, this evaluates its argument twice, it thus must not have
  8472. + * a sideeffect, that is FFNABS(x++) has undefined behavior.
  8473. + */
  8474. +#define FFNABS(a) ((a) <= 0 ? (a) : (-(a)))
  8475. +
  8476. +/**
  8477. + * Comparator.
  8478. + * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0
  8479. + * if x == y. This is useful for instance in a qsort comparator callback.
  8480. + * Furthermore, compilers are able to optimize this to branchless code, and
  8481. + * there is no risk of overflow with signed types.
  8482. + * As with many macros, this evaluates its argument multiple times, it thus
  8483. + * must not have a side-effect.
  8484. + */
  8485. +#define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y)))
  8486. +
  8487. +#define FFMAX(a,b) ((a) > (b) ? (a) : (b))
  8488. +#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c)
  8489. +#define FFMIN(a,b) ((a) > (b) ? (b) : (a))
  8490. +#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c)
  8491. +
  8492. +#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
  8493. +#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
  8494. +
  8495. +/* misc math functions */
  8496. +
  8497. +#ifdef HAVE_AV_CONFIG_H
  8498. +# include "config.h"
  8499. +# include "intmath.h"
  8500. +#endif
  8501. +
  8502. +/* Pull in unguarded fallback defines at the end of this file. */
  8503. +#include "common.h"
  8504. +
  8505. +#ifndef av_log2
  8506. +av_const int av_log2(unsigned v);
  8507. +#endif
  8508. +
  8509. +#ifndef av_log2_16bit
  8510. +av_const int av_log2_16bit(unsigned v);
  8511. +#endif
  8512. +
  8513. +/**
  8514. + * Clip a signed integer value into the amin-amax range.
  8515. + * @param a value to clip
  8516. + * @param amin minimum value of the clip range
  8517. + * @param amax maximum value of the clip range
  8518. + * @return clipped value
  8519. + */
  8520. +static av_always_inline av_const int av_clip_c(int a, int amin, int amax)
  8521. +{
  8522. +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
  8523. + if (amin > amax) abort();
  8524. +#endif
  8525. + if (a < amin) return amin;
  8526. + else if (a > amax) return amax;
  8527. + else return a;
  8528. +}
  8529. +
  8530. +/**
  8531. + * Clip a signed 64bit integer value into the amin-amax range.
  8532. + * @param a value to clip
  8533. + * @param amin minimum value of the clip range
  8534. + * @param amax maximum value of the clip range
  8535. + * @return clipped value
  8536. + */
  8537. +static av_always_inline av_const int64_t av_clip64_c(int64_t a, int64_t amin, int64_t amax)
  8538. +{
  8539. +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
  8540. + if (amin > amax) abort();
  8541. +#endif
  8542. + if (a < amin) return amin;
  8543. + else if (a > amax) return amax;
  8544. + else return a;
  8545. +}
  8546. +
  8547. +/**
  8548. + * Clip a signed integer value into the 0-255 range.
  8549. + * @param a value to clip
  8550. + * @return clipped value
  8551. + */
  8552. +static av_always_inline av_const uint8_t av_clip_uint8_c(int a)
  8553. +{
  8554. + if (a&(~0xFF)) return (~a)>>31;
  8555. + else return a;
  8556. +}
  8557. +
  8558. +/**
  8559. + * Clip a signed integer value into the -128,127 range.
  8560. + * @param a value to clip
  8561. + * @return clipped value
  8562. + */
  8563. +static av_always_inline av_const int8_t av_clip_int8_c(int a)
  8564. +{
  8565. + if ((a+0x80U) & ~0xFF) return (a>>31) ^ 0x7F;
  8566. + else return a;
  8567. +}
  8568. +
  8569. +/**
  8570. + * Clip a signed integer value into the 0-65535 range.
  8571. + * @param a value to clip
  8572. + * @return clipped value
  8573. + */
  8574. +static av_always_inline av_const uint16_t av_clip_uint16_c(int a)
  8575. +{
  8576. + if (a&(~0xFFFF)) return (~a)>>31;
  8577. + else return a;
  8578. +}
  8579. +
  8580. +/**
  8581. + * Clip a signed integer value into the -32768,32767 range.
  8582. + * @param a value to clip
  8583. + * @return clipped value
  8584. + */
  8585. +static av_always_inline av_const int16_t av_clip_int16_c(int a)
  8586. +{
  8587. + if ((a+0x8000U) & ~0xFFFF) return (a>>31) ^ 0x7FFF;
  8588. + else return a;
  8589. +}
  8590. +
  8591. +/**
  8592. + * Clip a signed 64-bit integer value into the -2147483648,2147483647 range.
  8593. + * @param a value to clip
  8594. + * @return clipped value
  8595. + */
  8596. +static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a)
  8597. +{
  8598. + if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (int32_t)((a>>63) ^ 0x7FFFFFFF);
  8599. + else return (int32_t)a;
  8600. +}
  8601. +
  8602. +/**
  8603. + * Clip a signed integer into the -(2^p),(2^p-1) range.
  8604. + * @param a value to clip
  8605. + * @param p bit position to clip at
  8606. + * @return clipped value
  8607. + */
  8608. +static av_always_inline av_const int av_clip_intp2_c(int a, int p)
  8609. +{
  8610. + if (((unsigned)a + (1 << p)) & ~((2 << p) - 1))
  8611. + return (a >> 31) ^ ((1 << p) - 1);
  8612. + else
  8613. + return a;
  8614. +}
  8615. +
  8616. +/**
  8617. + * Clip a signed integer to an unsigned power of two range.
  8618. + * @param a value to clip
  8619. + * @param p bit position to clip at
  8620. + * @return clipped value
  8621. + */
  8622. +static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
  8623. +{
  8624. + if (a & ~((1<<p) - 1)) return -a >> 31 & ((1<<p) - 1);
  8625. + else return a;
  8626. +}
  8627. +
  8628. +/**
  8629. + * Clear high bits from an unsigned integer starting with specific bit position
  8630. + * @param a value to clip
  8631. + * @param p bit position to clip at
  8632. + * @return clipped value
  8633. + */
  8634. +static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p)
  8635. +{
  8636. + return a & ((1 << p) - 1);
  8637. +}
  8638. +
  8639. +/**
  8640. + * Add two signed 32-bit values with saturation.
  8641. + *
  8642. + * @param a one value
  8643. + * @param b another value
  8644. + * @return sum with signed saturation
  8645. + */
  8646. +static av_always_inline int av_sat_add32_c(int a, int b)
  8647. +{
  8648. + return av_clipl_int32((int64_t)a + b);
  8649. +}
  8650. +
  8651. +/**
  8652. + * Add a doubled value to another value with saturation at both stages.
  8653. + *
  8654. + * @param a first value
  8655. + * @param b value doubled and added to a
  8656. + * @return sum sat(a + sat(2*b)) with signed saturation
  8657. + */
  8658. +static av_always_inline int av_sat_dadd32_c(int a, int b)
  8659. +{
  8660. + return av_sat_add32(a, av_sat_add32(b, b));
  8661. +}
  8662. +
  8663. +/**
  8664. + * Subtract two signed 32-bit values with saturation.
  8665. + *
  8666. + * @param a one value
  8667. + * @param b another value
  8668. + * @return difference with signed saturation
  8669. + */
  8670. +static av_always_inline int av_sat_sub32_c(int a, int b)
  8671. +{
  8672. + return av_clipl_int32((int64_t)a - b);
  8673. +}
  8674. +
  8675. +/**
  8676. + * Subtract a doubled value from another value with saturation at both stages.
  8677. + *
  8678. + * @param a first value
  8679. + * @param b value doubled and subtracted from a
  8680. + * @return difference sat(a - sat(2*b)) with signed saturation
  8681. + */
  8682. +static av_always_inline int av_sat_dsub32_c(int a, int b)
  8683. +{
  8684. + return av_sat_sub32(a, av_sat_add32(b, b));
  8685. +}
  8686. +
  8687. +/**
  8688. + * Clip a float value into the amin-amax range.
  8689. + * @param a value to clip
  8690. + * @param amin minimum value of the clip range
  8691. + * @param amax maximum value of the clip range
  8692. + * @return clipped value
  8693. + */
  8694. +static av_always_inline av_const float av_clipf_c(float a, float amin, float amax)
  8695. +{
  8696. +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
  8697. + if (amin > amax) abort();
  8698. +#endif
  8699. + if (a < amin) return amin;
  8700. + else if (a > amax) return amax;
  8701. + else return a;
  8702. +}
  8703. +
  8704. +/**
  8705. + * Clip a double value into the amin-amax range.
  8706. + * @param a value to clip
  8707. + * @param amin minimum value of the clip range
  8708. + * @param amax maximum value of the clip range
  8709. + * @return clipped value
  8710. + */
  8711. +static av_always_inline av_const double av_clipd_c(double a, double amin, double amax)
  8712. +{
  8713. +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
  8714. + if (amin > amax) abort();
  8715. +#endif
  8716. + if (a < amin) return amin;
  8717. + else if (a > amax) return amax;
  8718. + else return a;
  8719. +}
  8720. +
  8721. +/** Compute ceil(log2(x)).
  8722. + * @param x value used to compute ceil(log2(x))
  8723. + * @return computed ceiling of log2(x)
  8724. + */
  8725. +static av_always_inline av_const int av_ceil_log2_c(int x)
  8726. +{
  8727. + return av_log2((x - 1) << 1);
  8728. +}
  8729. +
  8730. +/**
  8731. + * Count number of bits set to one in x
  8732. + * @param x value to count bits of
  8733. + * @return the number of bits set to one in x
  8734. + */
  8735. +static av_always_inline av_const int av_popcount_c(uint32_t x)
  8736. +{
  8737. + x -= (x >> 1) & 0x55555555;
  8738. + x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
  8739. + x = (x + (x >> 4)) & 0x0F0F0F0F;
  8740. + x += x >> 8;
  8741. + return (x + (x >> 16)) & 0x3F;
  8742. +}
  8743. +
  8744. +/**
  8745. + * Count number of bits set to one in x
  8746. + * @param x value to count bits of
  8747. + * @return the number of bits set to one in x
  8748. + */
  8749. +static av_always_inline av_const int av_popcount64_c(uint64_t x)
  8750. +{
  8751. + return av_popcount((uint32_t)x) + av_popcount((uint32_t)(x >> 32));
  8752. +}
  8753. +
  8754. +static av_always_inline av_const int av_parity_c(uint32_t v)
  8755. +{
  8756. + return av_popcount(v) & 1;
  8757. +}
  8758. +
  8759. +#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24))
  8760. +#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24))
  8761. +
  8762. +/**
  8763. + * Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form.
  8764. + *
  8765. + * @param val Output value, must be an lvalue of type uint32_t.
  8766. + * @param GET_BYTE Expression reading one byte from the input.
  8767. + * Evaluated up to 7 times (4 for the currently
  8768. + * assigned Unicode range). With a memory buffer
  8769. + * input, this could be *ptr++.
  8770. + * @param ERROR Expression to be evaluated on invalid input,
  8771. + * typically a goto statement.
  8772. + *
  8773. + * @warning ERROR should not contain a loop control statement which
  8774. + * could interact with the internal while loop, and should force an
  8775. + * exit from the macro code (e.g. through a goto or a return) in order
  8776. + * to prevent undefined results.
  8777. + */
  8778. +#define GET_UTF8(val, GET_BYTE, ERROR)\
  8779. + val= (GET_BYTE);\
  8780. + {\
  8781. + uint32_t top = (val & 128) >> 1;\
  8782. + if ((val & 0xc0) == 0x80 || val >= 0xFE)\
  8783. + ERROR\
  8784. + while (val & top) {\
  8785. + int tmp= (GET_BYTE) - 128;\
  8786. + if(tmp>>6)\
  8787. + ERROR\
  8788. + val= (val<<6) + tmp;\
  8789. + top <<= 5;\
  8790. + }\
  8791. + val &= (top << 1) - 1;\
  8792. + }
  8793. +
  8794. +/**
  8795. + * Convert a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form.
  8796. + *
  8797. + * @param val Output value, must be an lvalue of type uint32_t.
  8798. + * @param GET_16BIT Expression returning two bytes of UTF-16 data converted
  8799. + * to native byte order. Evaluated one or two times.
  8800. + * @param ERROR Expression to be evaluated on invalid input,
  8801. + * typically a goto statement.
  8802. + */
  8803. +#define GET_UTF16(val, GET_16BIT, ERROR)\
  8804. + val = GET_16BIT;\
  8805. + {\
  8806. + unsigned int hi = val - 0xD800;\
  8807. + if (hi < 0x800) {\
  8808. + val = GET_16BIT - 0xDC00;\
  8809. + if (val > 0x3FFU || hi > 0x3FFU)\
  8810. + ERROR\
  8811. + val += (hi<<10) + 0x10000;\
  8812. + }\
  8813. + }\
  8814. +
  8815. +/**
  8816. + * @def PUT_UTF8(val, tmp, PUT_BYTE)
  8817. + * Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long).
  8818. + * @param val is an input-only argument and should be of type uint32_t. It holds
  8819. + * a UCS-4 encoded Unicode character that is to be converted to UTF-8. If
  8820. + * val is given as a function it is executed only once.
  8821. + * @param tmp is a temporary variable and should be of type uint8_t. It
  8822. + * represents an intermediate value during conversion that is to be
  8823. + * output by PUT_BYTE.
  8824. + * @param PUT_BYTE writes the converted UTF-8 bytes to any proper destination.
  8825. + * It could be a function or a statement, and uses tmp as the input byte.
  8826. + * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be
  8827. + * executed up to 4 times for values in the valid UTF-8 range and up to
  8828. + * 7 times in the general case, depending on the length of the converted
  8829. + * Unicode character.
  8830. + */
  8831. +#define PUT_UTF8(val, tmp, PUT_BYTE)\
  8832. + {\
  8833. + int bytes, shift;\
  8834. + uint32_t in = val;\
  8835. + if (in < 0x80) {\
  8836. + tmp = in;\
  8837. + PUT_BYTE\
  8838. + } else {\
  8839. + bytes = (av_log2(in) + 4) / 5;\
  8840. + shift = (bytes - 1) * 6;\
  8841. + tmp = (256 - (256 >> bytes)) | (in >> shift);\
  8842. + PUT_BYTE\
  8843. + while (shift >= 6) {\
  8844. + shift -= 6;\
  8845. + tmp = 0x80 | ((in >> shift) & 0x3f);\
  8846. + PUT_BYTE\
  8847. + }\
  8848. + }\
  8849. + }
  8850. +
  8851. +/**
  8852. + * @def PUT_UTF16(val, tmp, PUT_16BIT)
  8853. + * Convert a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes).
  8854. + * @param val is an input-only argument and should be of type uint32_t. It holds
  8855. + * a UCS-4 encoded Unicode character that is to be converted to UTF-16. If
  8856. + * val is given as a function it is executed only once.
  8857. + * @param tmp is a temporary variable and should be of type uint16_t. It
  8858. + * represents an intermediate value during conversion that is to be
  8859. + * output by PUT_16BIT.
  8860. + * @param PUT_16BIT writes the converted UTF-16 data to any proper destination
  8861. + * in desired endianness. It could be a function or a statement, and uses tmp
  8862. + * as the input byte. For example, PUT_BYTE could be "*output++ = tmp;"
  8863. + * PUT_BYTE will be executed 1 or 2 times depending on input character.
  8864. + */
  8865. +#define PUT_UTF16(val, tmp, PUT_16BIT)\
  8866. + {\
  8867. + uint32_t in = val;\
  8868. + if (in < 0x10000) {\
  8869. + tmp = in;\
  8870. + PUT_16BIT\
  8871. + } else {\
  8872. + tmp = 0xD800 | ((in - 0x10000) >> 10);\
  8873. + PUT_16BIT\
  8874. + tmp = 0xDC00 | ((in - 0x10000) & 0x3FF);\
  8875. + PUT_16BIT\
  8876. + }\
  8877. + }\
  8878. +
  8879. +
  8880. +
  8881. +#include "mem.h"
  8882. +
  8883. +#ifdef HAVE_AV_CONFIG_H
  8884. +# include "internal.h"
  8885. +#endif /* HAVE_AV_CONFIG_H */
  8886. +
  8887. +#endif /* AVUTIL_COMMON_H */
  8888. +
  8889. +/*
  8890. + * The following definitions are outside the multiple inclusion guard
  8891. + * to ensure they are immediately available in intmath.h.
  8892. + */
  8893. +
  8894. +#ifndef av_ceil_log2
  8895. +# define av_ceil_log2 av_ceil_log2_c
  8896. +#endif
  8897. +#ifndef av_clip
  8898. +# define av_clip av_clip_c
  8899. +#endif
  8900. +#ifndef av_clip64
  8901. +# define av_clip64 av_clip64_c
  8902. +#endif
  8903. +#ifndef av_clip_uint8
  8904. +# define av_clip_uint8 av_clip_uint8_c
  8905. +#endif
  8906. +#ifndef av_clip_int8
  8907. +# define av_clip_int8 av_clip_int8_c
  8908. +#endif
  8909. +#ifndef av_clip_uint16
  8910. +# define av_clip_uint16 av_clip_uint16_c
  8911. +#endif
  8912. +#ifndef av_clip_int16
  8913. +# define av_clip_int16 av_clip_int16_c
  8914. +#endif
  8915. +#ifndef av_clipl_int32
  8916. +# define av_clipl_int32 av_clipl_int32_c
  8917. +#endif
  8918. +#ifndef av_clip_intp2
  8919. +# define av_clip_intp2 av_clip_intp2_c
  8920. +#endif
  8921. +#ifndef av_clip_uintp2
  8922. +# define av_clip_uintp2 av_clip_uintp2_c
  8923. +#endif
  8924. +#ifndef av_mod_uintp2
  8925. +# define av_mod_uintp2 av_mod_uintp2_c
  8926. +#endif
  8927. +#ifndef av_sat_add32
  8928. +# define av_sat_add32 av_sat_add32_c
  8929. +#endif
  8930. +#ifndef av_sat_dadd32
  8931. +# define av_sat_dadd32 av_sat_dadd32_c
  8932. +#endif
  8933. +#ifndef av_sat_sub32
  8934. +# define av_sat_sub32 av_sat_sub32_c
  8935. +#endif
  8936. +#ifndef av_sat_dsub32
  8937. +# define av_sat_dsub32 av_sat_dsub32_c
  8938. +#endif
  8939. +#ifndef av_clipf
  8940. +# define av_clipf av_clipf_c
  8941. +#endif
  8942. +#ifndef av_clipd
  8943. +# define av_clipd av_clipd_c
  8944. +#endif
  8945. +#ifndef av_popcount
  8946. +# define av_popcount av_popcount_c
  8947. +#endif
  8948. +#ifndef av_popcount64
  8949. +# define av_popcount64 av_popcount64_c
  8950. +#endif
  8951. +#ifndef av_parity
  8952. +# define av_parity av_parity_c
  8953. +#endif
  8954. diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/cpu.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/cpu.h
  8955. new file mode 100644
  8956. index 000000000000..8bb9eb606bf2
  8957. --- /dev/null
  8958. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/cpu.h
  8959. @@ -0,0 +1,130 @@
  8960. +/*
  8961. + * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  8962. + *
  8963. + * This file is part of FFmpeg.
  8964. + *
  8965. + * FFmpeg is free software; you can redistribute it and/or
  8966. + * modify it under the terms of the GNU Lesser General Public
  8967. + * License as published by the Free Software Foundation; either
  8968. + * version 2.1 of the License, or (at your option) any later version.
  8969. + *
  8970. + * FFmpeg is distributed in the hope that it will be useful,
  8971. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8972. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  8973. + * Lesser General Public License for more details.
  8974. + *
  8975. + * You should have received a copy of the GNU Lesser General Public
  8976. + * License along with FFmpeg; if not, write to the Free Software
  8977. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  8978. + */
  8979. +
  8980. +#ifndef AVUTIL_CPU_H
  8981. +#define AVUTIL_CPU_H
  8982. +
  8983. +#include <stddef.h>
  8984. +
  8985. +#include "attributes.h"
  8986. +
  8987. +#define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */
  8988. +
  8989. + /* lower 16 bits - CPU features */
  8990. +#define AV_CPU_FLAG_MMX 0x0001 ///< standard MMX
  8991. +#define AV_CPU_FLAG_MMXEXT 0x0002 ///< SSE integer functions or AMD MMX ext
  8992. +#define AV_CPU_FLAG_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext
  8993. +#define AV_CPU_FLAG_3DNOW 0x0004 ///< AMD 3DNOW
  8994. +#define AV_CPU_FLAG_SSE 0x0008 ///< SSE functions
  8995. +#define AV_CPU_FLAG_SSE2 0x0010 ///< PIV SSE2 functions
  8996. +#define AV_CPU_FLAG_SSE2SLOW 0x40000000 ///< SSE2 supported, but usually not faster
  8997. + ///< than regular MMX/SSE (e.g. Core1)
  8998. +#define AV_CPU_FLAG_3DNOWEXT 0x0020 ///< AMD 3DNowExt
  8999. +#define AV_CPU_FLAG_SSE3 0x0040 ///< Prescott SSE3 functions
  9000. +#define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster
  9001. + ///< than regular MMX/SSE (e.g. Core1)
  9002. +#define AV_CPU_FLAG_SSSE3 0x0080 ///< Conroe SSSE3 functions
  9003. +#define AV_CPU_FLAG_SSSE3SLOW 0x4000000 ///< SSSE3 supported, but usually not faster
  9004. +#define AV_CPU_FLAG_ATOM 0x10000000 ///< Atom processor, some SSSE3 instructions are slower
  9005. +#define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions
  9006. +#define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions
  9007. +#define AV_CPU_FLAG_AESNI 0x80000 ///< Advanced Encryption Standard functions
  9008. +#define AV_CPU_FLAG_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used
  9009. +#define AV_CPU_FLAG_AVXSLOW 0x8000000 ///< AVX supported, but slow when using YMM registers (e.g. Bulldozer)
  9010. +#define AV_CPU_FLAG_XOP 0x0400 ///< Bulldozer XOP functions
  9011. +#define AV_CPU_FLAG_FMA4 0x0800 ///< Bulldozer FMA4 functions
  9012. +#define AV_CPU_FLAG_CMOV 0x1000 ///< supports cmov instruction
  9013. +#define AV_CPU_FLAG_AVX2 0x8000 ///< AVX2 functions: requires OS support even if YMM registers aren't used
  9014. +#define AV_CPU_FLAG_FMA3 0x10000 ///< Haswell FMA3 functions
  9015. +#define AV_CPU_FLAG_BMI1 0x20000 ///< Bit Manipulation Instruction Set 1
  9016. +#define AV_CPU_FLAG_BMI2 0x40000 ///< Bit Manipulation Instruction Set 2
  9017. +#define AV_CPU_FLAG_AVX512 0x100000 ///< AVX-512 functions: requires OS support even if YMM/ZMM registers aren't used
  9018. +
  9019. +#define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard
  9020. +#define AV_CPU_FLAG_VSX 0x0002 ///< ISA 2.06
  9021. +#define AV_CPU_FLAG_POWER8 0x0004 ///< ISA 2.07
  9022. +
  9023. +#define AV_CPU_FLAG_ARMV5TE (1 << 0)
  9024. +#define AV_CPU_FLAG_ARMV6 (1 << 1)
  9025. +#define AV_CPU_FLAG_ARMV6T2 (1 << 2)
  9026. +#define AV_CPU_FLAG_VFP (1 << 3)
  9027. +#define AV_CPU_FLAG_VFPV3 (1 << 4)
  9028. +#define AV_CPU_FLAG_NEON (1 << 5)
  9029. +#define AV_CPU_FLAG_ARMV8 (1 << 6)
  9030. +#define AV_CPU_FLAG_VFP_VM (1 << 7) ///< VFPv2 vector mode, deprecated in ARMv7-A and unavailable in various CPUs implementations
  9031. +#define AV_CPU_FLAG_SETEND (1 <<16)
  9032. +
  9033. +/**
  9034. + * Return the flags which specify extensions supported by the CPU.
  9035. + * The returned value is affected by av_force_cpu_flags() if that was used
  9036. + * before. So av_get_cpu_flags() can easily be used in an application to
  9037. + * detect the enabled cpu flags.
  9038. + */
  9039. +int av_get_cpu_flags(void);
  9040. +
  9041. +/**
  9042. + * Disables cpu detection and forces the specified flags.
  9043. + * -1 is a special case that disables forcing of specific flags.
  9044. + */
  9045. +void av_force_cpu_flags(int flags);
  9046. +
  9047. +/**
  9048. + * Set a mask on flags returned by av_get_cpu_flags().
  9049. + * This function is mainly useful for testing.
  9050. + * Please use av_force_cpu_flags() and av_get_cpu_flags() instead which are more flexible
  9051. + */
  9052. +attribute_deprecated void av_set_cpu_flags_mask(int mask);
  9053. +
  9054. +/**
  9055. + * Parse CPU flags from a string.
  9056. + *
  9057. + * The returned flags contain the specified flags as well as related unspecified flags.
  9058. + *
  9059. + * This function exists only for compatibility with libav.
  9060. + * Please use av_parse_cpu_caps() when possible.
  9061. + * @return a combination of AV_CPU_* flags, negative on error.
  9062. + */
  9063. +attribute_deprecated
  9064. +int av_parse_cpu_flags(const char *s);
  9065. +
  9066. +/**
  9067. + * Parse CPU caps from a string and update the given AV_CPU_* flags based on that.
  9068. + *
  9069. + * @return negative on error.
  9070. + */
  9071. +int av_parse_cpu_caps(unsigned *flags, const char *s);
  9072. +
  9073. +/**
  9074. + * @return the number of logical CPU cores present.
  9075. + */
  9076. +int av_cpu_count(void);
  9077. +
  9078. +/**
  9079. + * Get the maximum data alignment that may be required by FFmpeg.
  9080. + *
  9081. + * Note that this is affected by the build configuration and the CPU flags mask,
  9082. + * so e.g. if the CPU supports AVX, but libavutil has been built with
  9083. + * --disable-avx or the AV_CPU_FLAG_AVX flag has been disabled through
  9084. + * av_set_cpu_flags_mask(), then this function will behave as if AVX is not
  9085. + * present.
  9086. + */
  9087. +size_t av_cpu_max_align(void);
  9088. +
  9089. +#endif /* AVUTIL_CPU_H */
  9090. diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/dict.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/dict.h
  9091. new file mode 100644
  9092. index 000000000000..118f1f00ed20
  9093. --- /dev/null
  9094. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/dict.h
  9095. @@ -0,0 +1,200 @@
  9096. +/*
  9097. + * This file is part of FFmpeg.
  9098. + *
  9099. + * FFmpeg is free software; you can redistribute it and/or
  9100. + * modify it under the terms of the GNU Lesser General Public
  9101. + * License as published by the Free Software Foundation; either
  9102. + * version 2.1 of the License, or (at your option) any later version.
  9103. + *
  9104. + * FFmpeg is distributed in the hope that it will be useful,
  9105. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9106. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  9107. + * Lesser General Public License for more details.
  9108. + *
  9109. + * You should have received a copy of the GNU Lesser General Public
  9110. + * License along with FFmpeg; if not, write to the Free Software
  9111. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  9112. + */
  9113. +
  9114. +/**
  9115. + * @file
  9116. + * Public dictionary API.
  9117. + * @deprecated
  9118. + * AVDictionary is provided for compatibility with libav. It is both in
  9119. + * implementation as well as API inefficient. It does not scale and is
  9120. + * extremely slow with large dictionaries.
  9121. + * It is recommended that new code uses our tree container from tree.c/h
  9122. + * where applicable, which uses AVL trees to achieve O(log n) performance.
  9123. + */
  9124. +
  9125. +#ifndef AVUTIL_DICT_H
  9126. +#define AVUTIL_DICT_H
  9127. +
  9128. +#include <stdint.h>
  9129. +
  9130. +#include "version.h"
  9131. +
  9132. +/**
  9133. + * @addtogroup lavu_dict AVDictionary
  9134. + * @ingroup lavu_data
  9135. + *
  9136. + * @brief Simple key:value store
  9137. + *
  9138. + * @{
  9139. + * Dictionaries are used for storing key:value pairs. To create
  9140. + * an AVDictionary, simply pass an address of a NULL pointer to
  9141. + * av_dict_set(). NULL can be used as an empty dictionary wherever
  9142. + * a pointer to an AVDictionary is required.
  9143. + * Use av_dict_get() to retrieve an entry or iterate over all
  9144. + * entries and finally av_dict_free() to free the dictionary
  9145. + * and all its contents.
  9146. + *
  9147. + @code
  9148. + AVDictionary *d = NULL; // "create" an empty dictionary
  9149. + AVDictionaryEntry *t = NULL;
  9150. +
  9151. + av_dict_set(&d, "foo", "bar", 0); // add an entry
  9152. +
  9153. + char *k = av_strdup("key"); // if your strings are already allocated,
  9154. + char *v = av_strdup("value"); // you can avoid copying them like this
  9155. + av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL);
  9156. +
  9157. + while (t = av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX)) {
  9158. + <....> // iterate over all entries in d
  9159. + }
  9160. + av_dict_free(&d);
  9161. + @endcode
  9162. + */
  9163. +
  9164. +#define AV_DICT_MATCH_CASE 1 /**< Only get an entry with exact-case key match. Only relevant in av_dict_get(). */
  9165. +#define AV_DICT_IGNORE_SUFFIX 2 /**< Return first entry in a dictionary whose first part corresponds to the search key,
  9166. + ignoring the suffix of the found key string. Only relevant in av_dict_get(). */
  9167. +#define AV_DICT_DONT_STRDUP_KEY 4 /**< Take ownership of a key that's been
  9168. + allocated with av_malloc() or another memory allocation function. */
  9169. +#define AV_DICT_DONT_STRDUP_VAL 8 /**< Take ownership of a value that's been
  9170. + allocated with av_malloc() or another memory allocation function. */
  9171. +#define AV_DICT_DONT_OVERWRITE 16 ///< Don't overwrite existing entries.
  9172. +#define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no
  9173. + delimiter is added, the strings are simply concatenated. */
  9174. +#define AV_DICT_MULTIKEY 64 /**< Allow to store several equal keys in the dictionary */
  9175. +
  9176. +typedef struct AVDictionaryEntry {
  9177. + char *key;
  9178. + char *value;
  9179. +} AVDictionaryEntry;
  9180. +
  9181. +typedef struct AVDictionary AVDictionary;
  9182. +
  9183. +/**
  9184. + * Get a dictionary entry with matching key.
  9185. + *
  9186. + * The returned entry key or value must not be changed, or it will
  9187. + * cause undefined behavior.
  9188. + *
  9189. + * To iterate through all the dictionary entries, you can set the matching key
  9190. + * to the null string "" and set the AV_DICT_IGNORE_SUFFIX flag.
  9191. + *
  9192. + * @param prev Set to the previous matching element to find the next.
  9193. + * If set to NULL the first matching element is returned.
  9194. + * @param key matching key
  9195. + * @param flags a collection of AV_DICT_* flags controlling how the entry is retrieved
  9196. + * @return found entry or NULL in case no matching entry was found in the dictionary
  9197. + */
  9198. +AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key,
  9199. + const AVDictionaryEntry *prev, int flags);
  9200. +
  9201. +/**
  9202. + * Get number of entries in dictionary.
  9203. + *
  9204. + * @param m dictionary
  9205. + * @return number of entries in dictionary
  9206. + */
  9207. +int av_dict_count(const AVDictionary *m);
  9208. +
  9209. +/**
  9210. + * Set the given entry in *pm, overwriting an existing entry.
  9211. + *
  9212. + * Note: If AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL is set,
  9213. + * these arguments will be freed on error.
  9214. + *
  9215. + * Warning: Adding a new entry to a dictionary invalidates all existing entries
  9216. + * previously returned with av_dict_get.
  9217. + *
  9218. + * @param pm pointer to a pointer to a dictionary struct. If *pm is NULL
  9219. + * a dictionary struct is allocated and put in *pm.
  9220. + * @param key entry key to add to *pm (will either be av_strduped or added as a new key depending on flags)
  9221. + * @param value entry value to add to *pm (will be av_strduped or added as a new key depending on flags).
  9222. + * Passing a NULL value will cause an existing entry to be deleted.
  9223. + * @return >= 0 on success otherwise an error code <0
  9224. + */
  9225. +int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags);
  9226. +
  9227. +/**
  9228. + * Convenience wrapper for av_dict_set that converts the value to a string
  9229. + * and stores it.
  9230. + *
  9231. + * Note: If AV_DICT_DONT_STRDUP_KEY is set, key will be freed on error.
  9232. + */
  9233. +int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags);
  9234. +
  9235. +/**
  9236. + * Parse the key/value pairs list and add the parsed entries to a dictionary.
  9237. + *
  9238. + * In case of failure, all the successfully set entries are stored in
  9239. + * *pm. You may need to manually free the created dictionary.
  9240. + *
  9241. + * @param key_val_sep a 0-terminated list of characters used to separate
  9242. + * key from value
  9243. + * @param pairs_sep a 0-terminated list of characters used to separate
  9244. + * two pairs from each other
  9245. + * @param flags flags to use when adding to dictionary.
  9246. + * AV_DICT_DONT_STRDUP_KEY and AV_DICT_DONT_STRDUP_VAL
  9247. + * are ignored since the key/value tokens will always
  9248. + * be duplicated.
  9249. + * @return 0 on success, negative AVERROR code on failure
  9250. + */
  9251. +int av_dict_parse_string(AVDictionary **pm, const char *str,
  9252. + const char *key_val_sep, const char *pairs_sep,
  9253. + int flags);
  9254. +
  9255. +/**
  9256. + * Copy entries from one AVDictionary struct into another.
  9257. + * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL,
  9258. + * this function will allocate a struct for you and put it in *dst
  9259. + * @param src pointer to source AVDictionary struct
  9260. + * @param flags flags to use when setting entries in *dst
  9261. + * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag
  9262. + * @return 0 on success, negative AVERROR code on failure. If dst was allocated
  9263. + * by this function, callers should free the associated memory.
  9264. + */
  9265. +int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags);
  9266. +
  9267. +/**
  9268. + * Free all the memory allocated for an AVDictionary struct
  9269. + * and all keys and values.
  9270. + */
  9271. +void av_dict_free(AVDictionary **m);
  9272. +
  9273. +/**
  9274. + * Get dictionary entries as a string.
  9275. + *
  9276. + * Create a string containing dictionary's entries.
  9277. + * Such string may be passed back to av_dict_parse_string().
  9278. + * @note String is escaped with backslashes ('\').
  9279. + *
  9280. + * @param[in] m dictionary
  9281. + * @param[out] buffer Pointer to buffer that will be allocated with string containg entries.
  9282. + * Buffer must be freed by the caller when is no longer needed.
  9283. + * @param[in] key_val_sep character used to separate key from value
  9284. + * @param[in] pairs_sep character used to separate two pairs from each other
  9285. + * @return >= 0 on success, negative on error
  9286. + * @warning Separators cannot be neither '\\' nor '\0'. They also cannot be the same.
  9287. + */
  9288. +int av_dict_get_string(const AVDictionary *m, char **buffer,
  9289. + const char key_val_sep, const char pairs_sep);
  9290. +
  9291. +/**
  9292. + * @}
  9293. + */
  9294. +
  9295. +#endif /* AVUTIL_DICT_H */
  9296. diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/error.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/error.h
  9297. new file mode 100644
  9298. index 000000000000..71df4da353b9
  9299. --- /dev/null
  9300. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/error.h
  9301. @@ -0,0 +1,126 @@
  9302. +/*
  9303. + * This file is part of FFmpeg.
  9304. + *
  9305. + * FFmpeg is free software; you can redistribute it and/or
  9306. + * modify it under the terms of the GNU Lesser General Public
  9307. + * License as published by the Free Software Foundation; either
  9308. + * version 2.1 of the License, or (at your option) any later version.
  9309. + *
  9310. + * FFmpeg is distributed in the hope that it will be useful,
  9311. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9312. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  9313. + * Lesser General Public License for more details.
  9314. + *
  9315. + * You should have received a copy of the GNU Lesser General Public
  9316. + * License along with FFmpeg; if not, write to the Free Software
  9317. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  9318. + */
  9319. +
  9320. +/**
  9321. + * @file
  9322. + * error code definitions
  9323. + */
  9324. +
  9325. +#ifndef AVUTIL_ERROR_H
  9326. +#define AVUTIL_ERROR_H
  9327. +
  9328. +#include <errno.h>
  9329. +#include <stddef.h>
  9330. +
  9331. +/**
  9332. + * @addtogroup lavu_error
  9333. + *
  9334. + * @{
  9335. + */
  9336. +
  9337. +
  9338. +/* error handling */
  9339. +#if EDOM > 0
  9340. +#define AVERROR(e) (-(e)) ///< Returns a negative error code from a POSIX error code, to return from library functions.
  9341. +#define AVUNERROR(e) (-(e)) ///< Returns a POSIX error code from a library function error return value.
  9342. +#else
  9343. +/* Some platforms have E* and errno already negated. */
  9344. +#define AVERROR(e) (e)
  9345. +#define AVUNERROR(e) (e)
  9346. +#endif
  9347. +
  9348. +#define FFERRTAG(a, b, c, d) (-(int)MKTAG(a, b, c, d))
  9349. +
  9350. +#define AVERROR_BSF_NOT_FOUND FFERRTAG(0xF8,'B','S','F') ///< Bitstream filter not found
  9351. +#define AVERROR_BUG FFERRTAG( 'B','U','G','!') ///< Internal bug, also see AVERROR_BUG2
  9352. +#define AVERROR_BUFFER_TOO_SMALL FFERRTAG( 'B','U','F','S') ///< Buffer too small
  9353. +#define AVERROR_DECODER_NOT_FOUND FFERRTAG(0xF8,'D','E','C') ///< Decoder not found
  9354. +#define AVERROR_DEMUXER_NOT_FOUND FFERRTAG(0xF8,'D','E','M') ///< Demuxer not found
  9355. +#define AVERROR_ENCODER_NOT_FOUND FFERRTAG(0xF8,'E','N','C') ///< Encoder not found
  9356. +#define AVERROR_EOF FFERRTAG( 'E','O','F',' ') ///< End of file
  9357. +#define AVERROR_EXIT FFERRTAG( 'E','X','I','T') ///< Immediate exit was requested; the called function should not be restarted
  9358. +#define AVERROR_EXTERNAL FFERRTAG( 'E','X','T',' ') ///< Generic error in an external library
  9359. +#define AVERROR_FILTER_NOT_FOUND FFERRTAG(0xF8,'F','I','L') ///< Filter not found
  9360. +#define AVERROR_INVALIDDATA FFERRTAG( 'I','N','D','A') ///< Invalid data found when processing input
  9361. +#define AVERROR_MUXER_NOT_FOUND FFERRTAG(0xF8,'M','U','X') ///< Muxer not found
  9362. +#define AVERROR_OPTION_NOT_FOUND FFERRTAG(0xF8,'O','P','T') ///< Option not found
  9363. +#define AVERROR_PATCHWELCOME FFERRTAG( 'P','A','W','E') ///< Not yet implemented in FFmpeg, patches welcome
  9364. +#define AVERROR_PROTOCOL_NOT_FOUND FFERRTAG(0xF8,'P','R','O') ///< Protocol not found
  9365. +
  9366. +#define AVERROR_STREAM_NOT_FOUND FFERRTAG(0xF8,'S','T','R') ///< Stream not found
  9367. +/**
  9368. + * This is semantically identical to AVERROR_BUG
  9369. + * it has been introduced in Libav after our AVERROR_BUG and with a modified value.
  9370. + */
  9371. +#define AVERROR_BUG2 FFERRTAG( 'B','U','G',' ')
  9372. +#define AVERROR_UNKNOWN FFERRTAG( 'U','N','K','N') ///< Unknown error, typically from an external library
  9373. +#define AVERROR_EXPERIMENTAL (-0x2bb2afa8) ///< Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it.
  9374. +#define AVERROR_INPUT_CHANGED (-0x636e6701) ///< Input changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_OUTPUT_CHANGED)
  9375. +#define AVERROR_OUTPUT_CHANGED (-0x636e6702) ///< Output changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_INPUT_CHANGED)
  9376. +/* HTTP & RTSP errors */
  9377. +#define AVERROR_HTTP_BAD_REQUEST FFERRTAG(0xF8,'4','0','0')
  9378. +#define AVERROR_HTTP_UNAUTHORIZED FFERRTAG(0xF8,'4','0','1')
  9379. +#define AVERROR_HTTP_FORBIDDEN FFERRTAG(0xF8,'4','0','3')
  9380. +#define AVERROR_HTTP_NOT_FOUND FFERRTAG(0xF8,'4','0','4')
  9381. +#define AVERROR_HTTP_OTHER_4XX FFERRTAG(0xF8,'4','X','X')
  9382. +#define AVERROR_HTTP_SERVER_ERROR FFERRTAG(0xF8,'5','X','X')
  9383. +
  9384. +#define AV_ERROR_MAX_STRING_SIZE 64
  9385. +
  9386. +/**
  9387. + * Put a description of the AVERROR code errnum in errbuf.
  9388. + * In case of failure the global variable errno is set to indicate the
  9389. + * error. Even in case of failure av_strerror() will print a generic
  9390. + * error message indicating the errnum provided to errbuf.
  9391. + *
  9392. + * @param errnum error code to describe
  9393. + * @param errbuf buffer to which description is written
  9394. + * @param errbuf_size the size in bytes of errbuf
  9395. + * @return 0 on success, a negative value if a description for errnum
  9396. + * cannot be found
  9397. + */
  9398. +int av_strerror(int errnum, char *errbuf, size_t errbuf_size);
  9399. +
  9400. +/**
  9401. + * Fill the provided buffer with a string containing an error string
  9402. + * corresponding to the AVERROR code errnum.
  9403. + *
  9404. + * @param errbuf a buffer
  9405. + * @param errbuf_size size in bytes of errbuf
  9406. + * @param errnum error code to describe
  9407. + * @return the buffer in input, filled with the error description
  9408. + * @see av_strerror()
  9409. + */
  9410. +static inline char *av_make_error_string(char *errbuf, size_t errbuf_size, int errnum)
  9411. +{
  9412. + av_strerror(errnum, errbuf, errbuf_size);
  9413. + return errbuf;
  9414. +}
  9415. +
  9416. +/**
  9417. + * Convenience macro, the return value should be used only directly in
  9418. + * function arguments but never stand-alone.
  9419. + */
  9420. +#define av_err2str(errnum) \
  9421. + av_make_error_string((char[AV_ERROR_MAX_STRING_SIZE]){0}, AV_ERROR_MAX_STRING_SIZE, errnum)
  9422. +
  9423. +/**
  9424. + * @}
  9425. + */
  9426. +
  9427. +#endif /* AVUTIL_ERROR_H */
  9428. diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/frame.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/frame.h
  9429. new file mode 100644
  9430. index 000000000000..9d57d6ce66ff
  9431. --- /dev/null
  9432. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/frame.h
  9433. @@ -0,0 +1,893 @@
  9434. +/*
  9435. + * This file is part of FFmpeg.
  9436. + *
  9437. + * FFmpeg is free software; you can redistribute it and/or
  9438. + * modify it under the terms of the GNU Lesser General Public
  9439. + * License as published by the Free Software Foundation; either
  9440. + * version 2.1 of the License, or (at your option) any later version.
  9441. + *
  9442. + * FFmpeg is distributed in the hope that it will be useful,
  9443. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9444. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  9445. + * Lesser General Public License for more details.
  9446. + *
  9447. + * You should have received a copy of the GNU Lesser General Public
  9448. + * License along with FFmpeg; if not, write to the Free Software
  9449. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  9450. + */
  9451. +
  9452. +/**
  9453. + * @file
  9454. + * @ingroup lavu_frame
  9455. + * reference-counted frame API
  9456. + */
  9457. +
  9458. +#ifndef AVUTIL_FRAME_H
  9459. +#define AVUTIL_FRAME_H
  9460. +
  9461. +#include <stddef.h>
  9462. +#include <stdint.h>
  9463. +
  9464. +#include "avutil.h"
  9465. +#include "buffer.h"
  9466. +#include "dict.h"
  9467. +#include "rational.h"
  9468. +#include "samplefmt.h"
  9469. +#include "pixfmt.h"
  9470. +#include "version.h"
  9471. +
  9472. +
  9473. +/**
  9474. + * @defgroup lavu_frame AVFrame
  9475. + * @ingroup lavu_data
  9476. + *
  9477. + * @{
  9478. + * AVFrame is an abstraction for reference-counted raw multimedia data.
  9479. + */
  9480. +
  9481. +enum AVFrameSideDataType {
  9482. + /**
  9483. + * The data is the AVPanScan struct defined in libavcodec.
  9484. + */
  9485. + AV_FRAME_DATA_PANSCAN,
  9486. + /**
  9487. + * ATSC A53 Part 4 Closed Captions.
  9488. + * A53 CC bitstream is stored as uint8_t in AVFrameSideData.data.
  9489. + * The number of bytes of CC data is AVFrameSideData.size.
  9490. + */
  9491. + AV_FRAME_DATA_A53_CC,
  9492. + /**
  9493. + * Stereoscopic 3d metadata.
  9494. + * The data is the AVStereo3D struct defined in libavutil/stereo3d.h.
  9495. + */
  9496. + AV_FRAME_DATA_STEREO3D,
  9497. + /**
  9498. + * The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h.
  9499. + */
  9500. + AV_FRAME_DATA_MATRIXENCODING,
  9501. + /**
  9502. + * Metadata relevant to a downmix procedure.
  9503. + * The data is the AVDownmixInfo struct defined in libavutil/downmix_info.h.
  9504. + */
  9505. + AV_FRAME_DATA_DOWNMIX_INFO,
  9506. + /**
  9507. + * ReplayGain information in the form of the AVReplayGain struct.
  9508. + */
  9509. + AV_FRAME_DATA_REPLAYGAIN,
  9510. + /**
  9511. + * This side data contains a 3x3 transformation matrix describing an affine
  9512. + * transformation that needs to be applied to the frame for correct
  9513. + * presentation.
  9514. + *
  9515. + * See libavutil/display.h for a detailed description of the data.
  9516. + */
  9517. + AV_FRAME_DATA_DISPLAYMATRIX,
  9518. + /**
  9519. + * Active Format Description data consisting of a single byte as specified
  9520. + * in ETSI TS 101 154 using AVActiveFormatDescription enum.
  9521. + */
  9522. + AV_FRAME_DATA_AFD,
  9523. + /**
  9524. + * Motion vectors exported by some codecs (on demand through the export_mvs
  9525. + * flag set in the libavcodec AVCodecContext flags2 option).
  9526. + * The data is the AVMotionVector struct defined in
  9527. + * libavutil/motion_vector.h.
  9528. + */
  9529. + AV_FRAME_DATA_MOTION_VECTORS,
  9530. + /**
  9531. + * Recommmends skipping the specified number of samples. This is exported
  9532. + * only if the "skip_manual" AVOption is set in libavcodec.
  9533. + * This has the same format as AV_PKT_DATA_SKIP_SAMPLES.
  9534. + * @code
  9535. + * u32le number of samples to skip from start of this packet
  9536. + * u32le number of samples to skip from end of this packet
  9537. + * u8 reason for start skip
  9538. + * u8 reason for end skip (0=padding silence, 1=convergence)
  9539. + * @endcode
  9540. + */
  9541. + AV_FRAME_DATA_SKIP_SAMPLES,
  9542. + /**
  9543. + * This side data must be associated with an audio frame and corresponds to
  9544. + * enum AVAudioServiceType defined in avcodec.h.
  9545. + */
  9546. + AV_FRAME_DATA_AUDIO_SERVICE_TYPE,
  9547. + /**
  9548. + * Mastering display metadata associated with a video frame. The payload is
  9549. + * an AVMasteringDisplayMetadata type and contains information about the
  9550. + * mastering display color volume.
  9551. + */
  9552. + AV_FRAME_DATA_MASTERING_DISPLAY_METADATA,
  9553. + /**
  9554. + * The GOP timecode in 25 bit timecode format. Data format is 64-bit integer.
  9555. + * This is set on the first frame of a GOP that has a temporal reference of 0.
  9556. + */
  9557. + AV_FRAME_DATA_GOP_TIMECODE,
  9558. +
  9559. + /**
  9560. + * The data represents the AVSphericalMapping structure defined in
  9561. + * libavutil/spherical.h.
  9562. + */
  9563. + AV_FRAME_DATA_SPHERICAL,
  9564. +
  9565. + /**
  9566. + * Content light level (based on CTA-861.3). This payload contains data in
  9567. + * the form of the AVContentLightMetadata struct.
  9568. + */
  9569. + AV_FRAME_DATA_CONTENT_LIGHT_LEVEL,
  9570. +
  9571. + /**
  9572. + * The data contains an ICC profile as an opaque octet buffer following the
  9573. + * format described by ISO 15076-1 with an optional name defined in the
  9574. + * metadata key entry "name".
  9575. + */
  9576. + AV_FRAME_DATA_ICC_PROFILE,
  9577. +
  9578. +#if FF_API_FRAME_QP
  9579. + /**
  9580. + * Implementation-specific description of the format of AV_FRAME_QP_TABLE_DATA.
  9581. + * The contents of this side data are undocumented and internal; use
  9582. + * av_frame_set_qp_table() and av_frame_get_qp_table() to access this in a
  9583. + * meaningful way instead.
  9584. + */
  9585. + AV_FRAME_DATA_QP_TABLE_PROPERTIES,
  9586. +
  9587. + /**
  9588. + * Raw QP table data. Its format is described by
  9589. + * AV_FRAME_DATA_QP_TABLE_PROPERTIES. Use av_frame_set_qp_table() and
  9590. + * av_frame_get_qp_table() to access this instead.
  9591. + */
  9592. + AV_FRAME_DATA_QP_TABLE_DATA,
  9593. +#endif
  9594. +};
  9595. +
  9596. +enum AVActiveFormatDescription {
  9597. + AV_AFD_SAME = 8,
  9598. + AV_AFD_4_3 = 9,
  9599. + AV_AFD_16_9 = 10,
  9600. + AV_AFD_14_9 = 11,
  9601. + AV_AFD_4_3_SP_14_9 = 13,
  9602. + AV_AFD_16_9_SP_14_9 = 14,
  9603. + AV_AFD_SP_4_3 = 15,
  9604. +};
  9605. +
  9606. +
  9607. +/**
  9608. + * Structure to hold side data for an AVFrame.
  9609. + *
  9610. + * sizeof(AVFrameSideData) is not a part of the public ABI, so new fields may be added
  9611. + * to the end with a minor bump.
  9612. + */
  9613. +typedef struct AVFrameSideData {
  9614. + enum AVFrameSideDataType type;
  9615. + uint8_t *data;
  9616. + int size;
  9617. + AVDictionary *metadata;
  9618. + AVBufferRef *buf;
  9619. +} AVFrameSideData;
  9620. +
  9621. +/**
  9622. + * This structure describes decoded (raw) audio or video data.
  9623. + *
  9624. + * AVFrame must be allocated using av_frame_alloc(). Note that this only
  9625. + * allocates the AVFrame itself, the buffers for the data must be managed
  9626. + * through other means (see below).
  9627. + * AVFrame must be freed with av_frame_free().
  9628. + *
  9629. + * AVFrame is typically allocated once and then reused multiple times to hold
  9630. + * different data (e.g. a single AVFrame to hold frames received from a
  9631. + * decoder). In such a case, av_frame_unref() will free any references held by
  9632. + * the frame and reset it to its original clean state before it
  9633. + * is reused again.
  9634. + *
  9635. + * The data described by an AVFrame is usually reference counted through the
  9636. + * AVBuffer API. The underlying buffer references are stored in AVFrame.buf /
  9637. + * AVFrame.extended_buf. An AVFrame is considered to be reference counted if at
  9638. + * least one reference is set, i.e. if AVFrame.buf[0] != NULL. In such a case,
  9639. + * every single data plane must be contained in one of the buffers in
  9640. + * AVFrame.buf or AVFrame.extended_buf.
  9641. + * There may be a single buffer for all the data, or one separate buffer for
  9642. + * each plane, or anything in between.
  9643. + *
  9644. + * sizeof(AVFrame) is not a part of the public ABI, so new fields may be added
  9645. + * to the end with a minor bump.
  9646. + *
  9647. + * Fields can be accessed through AVOptions, the name string used, matches the
  9648. + * C structure field name for fields accessible through AVOptions. The AVClass
  9649. + * for AVFrame can be obtained from avcodec_get_frame_class()
  9650. + */
  9651. +typedef struct AVFrame {
  9652. +#define AV_NUM_DATA_POINTERS 8
  9653. + /**
  9654. + * pointer to the picture/channel planes.
  9655. + * This might be different from the first allocated byte
  9656. + *
  9657. + * Some decoders access areas outside 0,0 - width,height, please
  9658. + * see avcodec_align_dimensions2(). Some filters and swscale can read
  9659. + * up to 16 bytes beyond the planes, if these filters are to be used,
  9660. + * then 16 extra bytes must be allocated.
  9661. + *
  9662. + * NOTE: Except for hwaccel formats, pointers not needed by the format
  9663. + * MUST be set to NULL.
  9664. + */
  9665. + uint8_t *data[AV_NUM_DATA_POINTERS];
  9666. +
  9667. + /**
  9668. + * For video, size in bytes of each picture line.
  9669. + * For audio, size in bytes of each plane.
  9670. + *
  9671. + * For audio, only linesize[0] may be set. For planar audio, each channel
  9672. + * plane must be the same size.
  9673. + *
  9674. + * For video the linesizes should be multiples of the CPUs alignment
  9675. + * preference, this is 16 or 32 for modern desktop CPUs.
  9676. + * Some code requires such alignment other code can be slower without
  9677. + * correct alignment, for yet other it makes no difference.
  9678. + *
  9679. + * @note The linesize may be larger than the size of usable data -- there
  9680. + * may be extra padding present for performance reasons.
  9681. + */
  9682. + int linesize[AV_NUM_DATA_POINTERS];
  9683. +
  9684. + /**
  9685. + * pointers to the data planes/channels.
  9686. + *
  9687. + * For video, this should simply point to data[].
  9688. + *
  9689. + * For planar audio, each channel has a separate data pointer, and
  9690. + * linesize[0] contains the size of each channel buffer.
  9691. + * For packed audio, there is just one data pointer, and linesize[0]
  9692. + * contains the total size of the buffer for all channels.
  9693. + *
  9694. + * Note: Both data and extended_data should always be set in a valid frame,
  9695. + * but for planar audio with more channels that can fit in data,
  9696. + * extended_data must be used in order to access all channels.
  9697. + */
  9698. + uint8_t **extended_data;
  9699. +
  9700. + /**
  9701. + * @name Video dimensions
  9702. + * Video frames only. The coded dimensions (in pixels) of the video frame,
  9703. + * i.e. the size of the rectangle that contains some well-defined values.
  9704. + *
  9705. + * @note The part of the frame intended for display/presentation is further
  9706. + * restricted by the @ref cropping "Cropping rectangle".
  9707. + * @{
  9708. + */
  9709. + int width, height;
  9710. + /**
  9711. + * @}
  9712. + */
  9713. +
  9714. + /**
  9715. + * number of audio samples (per channel) described by this frame
  9716. + */
  9717. + int nb_samples;
  9718. +
  9719. + /**
  9720. + * format of the frame, -1 if unknown or unset
  9721. + * Values correspond to enum AVPixelFormat for video frames,
  9722. + * enum AVSampleFormat for audio)
  9723. + */
  9724. + int format;
  9725. +
  9726. + /**
  9727. + * 1 -> keyframe, 0-> not
  9728. + */
  9729. + int key_frame;
  9730. +
  9731. + /**
  9732. + * Picture type of the frame.
  9733. + */
  9734. + enum AVPictureType pict_type;
  9735. +
  9736. + /**
  9737. + * Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
  9738. + */
  9739. + AVRational sample_aspect_ratio;
  9740. +
  9741. + /**
  9742. + * Presentation timestamp in time_base units (time when frame should be shown to user).
  9743. + */
  9744. + int64_t pts;
  9745. +
  9746. +#if FF_API_PKT_PTS
  9747. + /**
  9748. + * PTS copied from the AVPacket that was decoded to produce this frame.
  9749. + * @deprecated use the pts field instead
  9750. + */
  9751. + attribute_deprecated
  9752. + int64_t pkt_pts;
  9753. +#endif
  9754. +
  9755. + /**
  9756. + * DTS copied from the AVPacket that triggered returning this frame. (if frame threading isn't used)
  9757. + * This is also the Presentation time of this AVFrame calculated from
  9758. + * only AVPacket.dts values without pts values.
  9759. + */
  9760. + int64_t pkt_dts;
  9761. +
  9762. + /**
  9763. + * picture number in bitstream order
  9764. + */
  9765. + int coded_picture_number;
  9766. + /**
  9767. + * picture number in display order
  9768. + */
  9769. + int display_picture_number;
  9770. +
  9771. + /**
  9772. + * quality (between 1 (good) and FF_LAMBDA_MAX (bad))
  9773. + */
  9774. + int quality;
  9775. +
  9776. + /**
  9777. + * for some private data of the user
  9778. + */
  9779. + void *opaque;
  9780. +
  9781. +#if FF_API_ERROR_FRAME
  9782. + /**
  9783. + * @deprecated unused
  9784. + */
  9785. + attribute_deprecated
  9786. + uint64_t error[AV_NUM_DATA_POINTERS];
  9787. +#endif
  9788. +
  9789. + /**
  9790. + * When decoding, this signals how much the picture must be delayed.
  9791. + * extra_delay = repeat_pict / (2*fps)
  9792. + */
  9793. + int repeat_pict;
  9794. +
  9795. + /**
  9796. + * The content of the picture is interlaced.
  9797. + */
  9798. + int interlaced_frame;
  9799. +
  9800. + /**
  9801. + * If the content is interlaced, is top field displayed first.
  9802. + */
  9803. + int top_field_first;
  9804. +
  9805. + /**
  9806. + * Tell user application that palette has changed from previous frame.
  9807. + */
  9808. + int palette_has_changed;
  9809. +
  9810. + /**
  9811. + * reordered opaque 64 bits (generally an integer or a double precision float
  9812. + * PTS but can be anything).
  9813. + * The user sets AVCodecContext.reordered_opaque to represent the input at
  9814. + * that time,
  9815. + * the decoder reorders values as needed and sets AVFrame.reordered_opaque
  9816. + * to exactly one of the values provided by the user through AVCodecContext.reordered_opaque
  9817. + * @deprecated in favor of pkt_pts
  9818. + */
  9819. + int64_t reordered_opaque;
  9820. +
  9821. + /**
  9822. + * Sample rate of the audio data.
  9823. + */
  9824. + int sample_rate;
  9825. +
  9826. + /**
  9827. + * Channel layout of the audio data.
  9828. + */
  9829. + uint64_t channel_layout;
  9830. +
  9831. + /**
  9832. + * AVBuffer references backing the data for this frame. If all elements of
  9833. + * this array are NULL, then this frame is not reference counted. This array
  9834. + * must be filled contiguously -- if buf[i] is non-NULL then buf[j] must
  9835. + * also be non-NULL for all j < i.
  9836. + *
  9837. + * There may be at most one AVBuffer per data plane, so for video this array
  9838. + * always contains all the references. For planar audio with more than
  9839. + * AV_NUM_DATA_POINTERS channels, there may be more buffers than can fit in
  9840. + * this array. Then the extra AVBufferRef pointers are stored in the
  9841. + * extended_buf array.
  9842. + */
  9843. + AVBufferRef *buf[AV_NUM_DATA_POINTERS];
  9844. +
  9845. + /**
  9846. + * For planar audio which requires more than AV_NUM_DATA_POINTERS
  9847. + * AVBufferRef pointers, this array will hold all the references which
  9848. + * cannot fit into AVFrame.buf.
  9849. + *
  9850. + * Note that this is different from AVFrame.extended_data, which always
  9851. + * contains all the pointers. This array only contains the extra pointers,
  9852. + * which cannot fit into AVFrame.buf.
  9853. + *
  9854. + * This array is always allocated using av_malloc() by whoever constructs
  9855. + * the frame. It is freed in av_frame_unref().
  9856. + */
  9857. + AVBufferRef **extended_buf;
  9858. + /**
  9859. + * Number of elements in extended_buf.
  9860. + */
  9861. + int nb_extended_buf;
  9862. +
  9863. + AVFrameSideData **side_data;
  9864. + int nb_side_data;
  9865. +
  9866. +/**
  9867. + * @defgroup lavu_frame_flags AV_FRAME_FLAGS
  9868. + * @ingroup lavu_frame
  9869. + * Flags describing additional frame properties.
  9870. + *
  9871. + * @{
  9872. + */
  9873. +
  9874. +/**
  9875. + * The frame data may be corrupted, e.g. due to decoding errors.
  9876. + */
  9877. +#define AV_FRAME_FLAG_CORRUPT (1 << 0)
  9878. +/**
  9879. + * A flag to mark the frames which need to be decoded, but shouldn't be output.
  9880. + */
  9881. +#define AV_FRAME_FLAG_DISCARD (1 << 2)
  9882. +/**
  9883. + * @}
  9884. + */
  9885. +
  9886. + /**
  9887. + * Frame flags, a combination of @ref lavu_frame_flags
  9888. + */
  9889. + int flags;
  9890. +
  9891. + /**
  9892. + * MPEG vs JPEG YUV range.
  9893. + * - encoding: Set by user
  9894. + * - decoding: Set by libavcodec
  9895. + */
  9896. + enum AVColorRange color_range;
  9897. +
  9898. + enum AVColorPrimaries color_primaries;
  9899. +
  9900. + enum AVColorTransferCharacteristic color_trc;
  9901. +
  9902. + /**
  9903. + * YUV colorspace type.
  9904. + * - encoding: Set by user
  9905. + * - decoding: Set by libavcodec
  9906. + */
  9907. + enum AVColorSpace colorspace;
  9908. +
  9909. + enum AVChromaLocation chroma_location;
  9910. +
  9911. + /**
  9912. + * frame timestamp estimated using various heuristics, in stream time base
  9913. + * - encoding: unused
  9914. + * - decoding: set by libavcodec, read by user.
  9915. + */
  9916. + int64_t best_effort_timestamp;
  9917. +
  9918. + /**
  9919. + * reordered pos from the last AVPacket that has been input into the decoder
  9920. + * - encoding: unused
  9921. + * - decoding: Read by user.
  9922. + */
  9923. + int64_t pkt_pos;
  9924. +
  9925. + /**
  9926. + * duration of the corresponding packet, expressed in
  9927. + * AVStream->time_base units, 0 if unknown.
  9928. + * - encoding: unused
  9929. + * - decoding: Read by user.
  9930. + */
  9931. + int64_t pkt_duration;
  9932. +
  9933. + /**
  9934. + * metadata.
  9935. + * - encoding: Set by user.
  9936. + * - decoding: Set by libavcodec.
  9937. + */
  9938. + AVDictionary *metadata;
  9939. +
  9940. + /**
  9941. + * decode error flags of the frame, set to a combination of
  9942. + * FF_DECODE_ERROR_xxx flags if the decoder produced a frame, but there
  9943. + * were errors during the decoding.
  9944. + * - encoding: unused
  9945. + * - decoding: set by libavcodec, read by user.
  9946. + */
  9947. + int decode_error_flags;
  9948. +#define FF_DECODE_ERROR_INVALID_BITSTREAM 1
  9949. +#define FF_DECODE_ERROR_MISSING_REFERENCE 2
  9950. +
  9951. + /**
  9952. + * number of audio channels, only used for audio.
  9953. + * - encoding: unused
  9954. + * - decoding: Read by user.
  9955. + */
  9956. + int channels;
  9957. +
  9958. + /**
  9959. + * size of the corresponding packet containing the compressed
  9960. + * frame.
  9961. + * It is set to a negative value if unknown.
  9962. + * - encoding: unused
  9963. + * - decoding: set by libavcodec, read by user.
  9964. + */
  9965. + int pkt_size;
  9966. +
  9967. +#if FF_API_FRAME_QP
  9968. + /**
  9969. + * QP table
  9970. + */
  9971. + attribute_deprecated
  9972. + int8_t *qscale_table;
  9973. + /**
  9974. + * QP store stride
  9975. + */
  9976. + attribute_deprecated
  9977. + int qstride;
  9978. +
  9979. + attribute_deprecated
  9980. + int qscale_type;
  9981. +
  9982. + attribute_deprecated
  9983. + AVBufferRef *qp_table_buf;
  9984. +#endif
  9985. + /**
  9986. + * For hwaccel-format frames, this should be a reference to the
  9987. + * AVHWFramesContext describing the frame.
  9988. + */
  9989. + AVBufferRef *hw_frames_ctx;
  9990. +
  9991. + /**
  9992. + * AVBufferRef for free use by the API user. FFmpeg will never check the
  9993. + * contents of the buffer ref. FFmpeg calls av_buffer_unref() on it when
  9994. + * the frame is unreferenced. av_frame_copy_props() calls create a new
  9995. + * reference with av_buffer_ref() for the target frame's opaque_ref field.
  9996. + *
  9997. + * This is unrelated to the opaque field, although it serves a similar
  9998. + * purpose.
  9999. + */
  10000. + AVBufferRef *opaque_ref;
  10001. +
  10002. + /**
  10003. + * @anchor cropping
  10004. + * @name Cropping
  10005. + * Video frames only. The number of pixels to discard from the the
  10006. + * top/bottom/left/right border of the frame to obtain the sub-rectangle of
  10007. + * the frame intended for presentation.
  10008. + * @{
  10009. + */
  10010. + size_t crop_top;
  10011. + size_t crop_bottom;
  10012. + size_t crop_left;
  10013. + size_t crop_right;
  10014. + /**
  10015. + * @}
  10016. + */
  10017. +
  10018. + /**
  10019. + * AVBufferRef for internal use by a single libav* library.
  10020. + * Must not be used to transfer data between libraries.
  10021. + * Has to be NULL when ownership of the frame leaves the respective library.
  10022. + *
  10023. + * Code outside the FFmpeg libs should never check or change the contents of the buffer ref.
  10024. + *
  10025. + * FFmpeg calls av_buffer_unref() on it when the frame is unreferenced.
  10026. + * av_frame_copy_props() calls create a new reference with av_buffer_ref()
  10027. + * for the target frame's private_ref field.
  10028. + */
  10029. + AVBufferRef *private_ref;
  10030. +} AVFrame;
  10031. +
  10032. +#if FF_API_FRAME_GET_SET
  10033. +/**
  10034. + * Accessors for some AVFrame fields. These used to be provided for ABI
  10035. + * compatibility, and do not need to be used anymore.
  10036. + */
  10037. +attribute_deprecated
  10038. +int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame);
  10039. +attribute_deprecated
  10040. +void av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val);
  10041. +attribute_deprecated
  10042. +int64_t av_frame_get_pkt_duration (const AVFrame *frame);
  10043. +attribute_deprecated
  10044. +void av_frame_set_pkt_duration (AVFrame *frame, int64_t val);
  10045. +attribute_deprecated
  10046. +int64_t av_frame_get_pkt_pos (const AVFrame *frame);
  10047. +attribute_deprecated
  10048. +void av_frame_set_pkt_pos (AVFrame *frame, int64_t val);
  10049. +attribute_deprecated
  10050. +int64_t av_frame_get_channel_layout (const AVFrame *frame);
  10051. +attribute_deprecated
  10052. +void av_frame_set_channel_layout (AVFrame *frame, int64_t val);
  10053. +attribute_deprecated
  10054. +int av_frame_get_channels (const AVFrame *frame);
  10055. +attribute_deprecated
  10056. +void av_frame_set_channels (AVFrame *frame, int val);
  10057. +attribute_deprecated
  10058. +int av_frame_get_sample_rate (const AVFrame *frame);
  10059. +attribute_deprecated
  10060. +void av_frame_set_sample_rate (AVFrame *frame, int val);
  10061. +attribute_deprecated
  10062. +AVDictionary *av_frame_get_metadata (const AVFrame *frame);
  10063. +attribute_deprecated
  10064. +void av_frame_set_metadata (AVFrame *frame, AVDictionary *val);
  10065. +attribute_deprecated
  10066. +int av_frame_get_decode_error_flags (const AVFrame *frame);
  10067. +attribute_deprecated
  10068. +void av_frame_set_decode_error_flags (AVFrame *frame, int val);
  10069. +attribute_deprecated
  10070. +int av_frame_get_pkt_size(const AVFrame *frame);
  10071. +attribute_deprecated
  10072. +void av_frame_set_pkt_size(AVFrame *frame, int val);
  10073. +#if FF_API_FRAME_QP
  10074. +attribute_deprecated
  10075. +int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type);
  10076. +attribute_deprecated
  10077. +int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type);
  10078. +#endif
  10079. +attribute_deprecated
  10080. +enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame);
  10081. +attribute_deprecated
  10082. +void av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val);
  10083. +attribute_deprecated
  10084. +enum AVColorRange av_frame_get_color_range(const AVFrame *frame);
  10085. +attribute_deprecated
  10086. +void av_frame_set_color_range(AVFrame *frame, enum AVColorRange val);
  10087. +#endif
  10088. +
  10089. +/**
  10090. + * Get the name of a colorspace.
  10091. + * @return a static string identifying the colorspace; can be NULL.
  10092. + */
  10093. +const char *av_get_colorspace_name(enum AVColorSpace val);
  10094. +
  10095. +/**
  10096. + * Allocate an AVFrame and set its fields to default values. The resulting
  10097. + * struct must be freed using av_frame_free().
  10098. + *
  10099. + * @return An AVFrame filled with default values or NULL on failure.
  10100. + *
  10101. + * @note this only allocates the AVFrame itself, not the data buffers. Those
  10102. + * must be allocated through other means, e.g. with av_frame_get_buffer() or
  10103. + * manually.
  10104. + */
  10105. +AVFrame *av_frame_alloc(void);
  10106. +
  10107. +/**
  10108. + * Free the frame and any dynamically allocated objects in it,
  10109. + * e.g. extended_data. If the frame is reference counted, it will be
  10110. + * unreferenced first.
  10111. + *
  10112. + * @param frame frame to be freed. The pointer will be set to NULL.
  10113. + */
  10114. +void av_frame_free(AVFrame **frame);
  10115. +
  10116. +/**
  10117. + * Set up a new reference to the data described by the source frame.
  10118. + *
  10119. + * Copy frame properties from src to dst and create a new reference for each
  10120. + * AVBufferRef from src.
  10121. + *
  10122. + * If src is not reference counted, new buffers are allocated and the data is
  10123. + * copied.
  10124. + *
  10125. + * @warning: dst MUST have been either unreferenced with av_frame_unref(dst),
  10126. + * or newly allocated with av_frame_alloc() before calling this
  10127. + * function, or undefined behavior will occur.
  10128. + *
  10129. + * @return 0 on success, a negative AVERROR on error
  10130. + */
  10131. +int av_frame_ref(AVFrame *dst, const AVFrame *src);
  10132. +
  10133. +/**
  10134. + * Create a new frame that references the same data as src.
  10135. + *
  10136. + * This is a shortcut for av_frame_alloc()+av_frame_ref().
  10137. + *
  10138. + * @return newly created AVFrame on success, NULL on error.
  10139. + */
  10140. +AVFrame *av_frame_clone(const AVFrame *src);
  10141. +
  10142. +/**
  10143. + * Unreference all the buffers referenced by frame and reset the frame fields.
  10144. + */
  10145. +void av_frame_unref(AVFrame *frame);
  10146. +
  10147. +/**
  10148. + * Move everything contained in src to dst and reset src.
  10149. + *
  10150. + * @warning: dst is not unreferenced, but directly overwritten without reading
  10151. + * or deallocating its contents. Call av_frame_unref(dst) manually
  10152. + * before calling this function to ensure that no memory is leaked.
  10153. + */
  10154. +void av_frame_move_ref(AVFrame *dst, AVFrame *src);
  10155. +
  10156. +/**
  10157. + * Allocate new buffer(s) for audio or video data.
  10158. + *
  10159. + * The following fields must be set on frame before calling this function:
  10160. + * - format (pixel format for video, sample format for audio)
  10161. + * - width and height for video
  10162. + * - nb_samples and channel_layout for audio
  10163. + *
  10164. + * This function will fill AVFrame.data and AVFrame.buf arrays and, if
  10165. + * necessary, allocate and fill AVFrame.extended_data and AVFrame.extended_buf.
  10166. + * For planar formats, one buffer will be allocated for each plane.
  10167. + *
  10168. + * @warning: if frame already has been allocated, calling this function will
  10169. + * leak memory. In addition, undefined behavior can occur in certain
  10170. + * cases.
  10171. + *
  10172. + * @param frame frame in which to store the new buffers.
  10173. + * @param align Required buffer size alignment. If equal to 0, alignment will be
  10174. + * chosen automatically for the current CPU. It is highly
  10175. + * recommended to pass 0 here unless you know what you are doing.
  10176. + *
  10177. + * @return 0 on success, a negative AVERROR on error.
  10178. + */
  10179. +int av_frame_get_buffer(AVFrame *frame, int align);
  10180. +
  10181. +/**
  10182. + * Check if the frame data is writable.
  10183. + *
  10184. + * @return A positive value if the frame data is writable (which is true if and
  10185. + * only if each of the underlying buffers has only one reference, namely the one
  10186. + * stored in this frame). Return 0 otherwise.
  10187. + *
  10188. + * If 1 is returned the answer is valid until av_buffer_ref() is called on any
  10189. + * of the underlying AVBufferRefs (e.g. through av_frame_ref() or directly).
  10190. + *
  10191. + * @see av_frame_make_writable(), av_buffer_is_writable()
  10192. + */
  10193. +int av_frame_is_writable(AVFrame *frame);
  10194. +
  10195. +/**
  10196. + * Ensure that the frame data is writable, avoiding data copy if possible.
  10197. + *
  10198. + * Do nothing if the frame is writable, allocate new buffers and copy the data
  10199. + * if it is not.
  10200. + *
  10201. + * @return 0 on success, a negative AVERROR on error.
  10202. + *
  10203. + * @see av_frame_is_writable(), av_buffer_is_writable(),
  10204. + * av_buffer_make_writable()
  10205. + */
  10206. +int av_frame_make_writable(AVFrame *frame);
  10207. +
  10208. +/**
  10209. + * Copy the frame data from src to dst.
  10210. + *
  10211. + * This function does not allocate anything, dst must be already initialized and
  10212. + * allocated with the same parameters as src.
  10213. + *
  10214. + * This function only copies the frame data (i.e. the contents of the data /
  10215. + * extended data arrays), not any other properties.
  10216. + *
  10217. + * @return >= 0 on success, a negative AVERROR on error.
  10218. + */
  10219. +int av_frame_copy(AVFrame *dst, const AVFrame *src);
  10220. +
  10221. +/**
  10222. + * Copy only "metadata" fields from src to dst.
  10223. + *
  10224. + * Metadata for the purpose of this function are those fields that do not affect
  10225. + * the data layout in the buffers. E.g. pts, sample rate (for audio) or sample
  10226. + * aspect ratio (for video), but not width/height or channel layout.
  10227. + * Side data is also copied.
  10228. + */
  10229. +int av_frame_copy_props(AVFrame *dst, const AVFrame *src);
  10230. +
  10231. +/**
  10232. + * Get the buffer reference a given data plane is stored in.
  10233. + *
  10234. + * @param plane index of the data plane of interest in frame->extended_data.
  10235. + *
  10236. + * @return the buffer reference that contains the plane or NULL if the input
  10237. + * frame is not valid.
  10238. + */
  10239. +AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane);
  10240. +
  10241. +/**
  10242. + * Add a new side data to a frame.
  10243. + *
  10244. + * @param frame a frame to which the side data should be added
  10245. + * @param type type of the added side data
  10246. + * @param size size of the side data
  10247. + *
  10248. + * @return newly added side data on success, NULL on error
  10249. + */
  10250. +AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
  10251. + enum AVFrameSideDataType type,
  10252. + int size);
  10253. +
  10254. +/**
  10255. + * Add a new side data to a frame from an existing AVBufferRef
  10256. + *
  10257. + * @param frame a frame to which the side data should be added
  10258. + * @param type the type of the added side data
  10259. + * @param buf an AVBufferRef to add as side data. The ownership of
  10260. + * the reference is transferred to the frame.
  10261. + *
  10262. + * @return newly added side data on success, NULL on error. On failure
  10263. + * the frame is unchanged and the AVBufferRef remains owned by
  10264. + * the caller.
  10265. + */
  10266. +AVFrameSideData *av_frame_new_side_data_from_buf(AVFrame *frame,
  10267. + enum AVFrameSideDataType type,
  10268. + AVBufferRef *buf);
  10269. +
  10270. +/**
  10271. + * @return a pointer to the side data of a given type on success, NULL if there
  10272. + * is no side data with such type in this frame.
  10273. + */
  10274. +AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
  10275. + enum AVFrameSideDataType type);
  10276. +
  10277. +/**
  10278. + * If side data of the supplied type exists in the frame, free it and remove it
  10279. + * from the frame.
  10280. + */
  10281. +void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type);
  10282. +
  10283. +
  10284. +/**
  10285. + * Flags for frame cropping.
  10286. + */
  10287. +enum {
  10288. + /**
  10289. + * Apply the maximum possible cropping, even if it requires setting the
  10290. + * AVFrame.data[] entries to unaligned pointers. Passing unaligned data
  10291. + * to FFmpeg API is generally not allowed, and causes undefined behavior
  10292. + * (such as crashes). You can pass unaligned data only to FFmpeg APIs that
  10293. + * are explicitly documented to accept it. Use this flag only if you
  10294. + * absolutely know what you are doing.
  10295. + */
  10296. + AV_FRAME_CROP_UNALIGNED = 1 << 0,
  10297. +};
  10298. +
  10299. +/**
  10300. + * Crop the given video AVFrame according to its crop_left/crop_top/crop_right/
  10301. + * crop_bottom fields. If cropping is successful, the function will adjust the
  10302. + * data pointers and the width/height fields, and set the crop fields to 0.
  10303. + *
  10304. + * In all cases, the cropping boundaries will be rounded to the inherent
  10305. + * alignment of the pixel format. In some cases, such as for opaque hwaccel
  10306. + * formats, the left/top cropping is ignored. The crop fields are set to 0 even
  10307. + * if the cropping was rounded or ignored.
  10308. + *
  10309. + * @param frame the frame which should be cropped
  10310. + * @param flags Some combination of AV_FRAME_CROP_* flags, or 0.
  10311. + *
  10312. + * @return >= 0 on success, a negative AVERROR on error. If the cropping fields
  10313. + * were invalid, AVERROR(ERANGE) is returned, and nothing is changed.
  10314. + */
  10315. +int av_frame_apply_cropping(AVFrame *frame, int flags);
  10316. +
  10317. +/**
  10318. + * @return a string identifying the side data type
  10319. + */
  10320. +const char *av_frame_side_data_name(enum AVFrameSideDataType type);
  10321. +
  10322. +/**
  10323. + * @}
  10324. + */
  10325. +
  10326. +#endif /* AVUTIL_FRAME_H */
  10327. diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/hwcontext.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/hwcontext.h
  10328. new file mode 100644
  10329. index 000000000000..f5a4b6238774
  10330. --- /dev/null
  10331. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/hwcontext.h
  10332. @@ -0,0 +1,584 @@
  10333. +/*
  10334. + * This file is part of FFmpeg.
  10335. + *
  10336. + * FFmpeg is free software; you can redistribute it and/or
  10337. + * modify it under the terms of the GNU Lesser General Public
  10338. + * License as published by the Free Software Foundation; either
  10339. + * version 2.1 of the License, or (at your option) any later version.
  10340. + *
  10341. + * FFmpeg is distributed in the hope that it will be useful,
  10342. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10343. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10344. + * Lesser General Public License for more details.
  10345. + *
  10346. + * You should have received a copy of the GNU Lesser General Public
  10347. + * License along with FFmpeg; if not, write to the Free Software
  10348. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  10349. + */
  10350. +
  10351. +#ifndef AVUTIL_HWCONTEXT_H
  10352. +#define AVUTIL_HWCONTEXT_H
  10353. +
  10354. +#include "buffer.h"
  10355. +#include "frame.h"
  10356. +#include "log.h"
  10357. +#include "pixfmt.h"
  10358. +
  10359. +enum AVHWDeviceType {
  10360. + AV_HWDEVICE_TYPE_NONE,
  10361. + AV_HWDEVICE_TYPE_VDPAU,
  10362. + AV_HWDEVICE_TYPE_CUDA,
  10363. + AV_HWDEVICE_TYPE_VAAPI,
  10364. + AV_HWDEVICE_TYPE_DXVA2,
  10365. + AV_HWDEVICE_TYPE_QSV,
  10366. + AV_HWDEVICE_TYPE_VIDEOTOOLBOX,
  10367. + AV_HWDEVICE_TYPE_D3D11VA,
  10368. + AV_HWDEVICE_TYPE_DRM,
  10369. + AV_HWDEVICE_TYPE_OPENCL,
  10370. + AV_HWDEVICE_TYPE_MEDIACODEC,
  10371. +};
  10372. +
  10373. +typedef struct AVHWDeviceInternal AVHWDeviceInternal;
  10374. +
  10375. +/**
  10376. + * This struct aggregates all the (hardware/vendor-specific) "high-level" state,
  10377. + * i.e. state that is not tied to a concrete processing configuration.
  10378. + * E.g., in an API that supports hardware-accelerated encoding and decoding,
  10379. + * this struct will (if possible) wrap the state that is common to both encoding
  10380. + * and decoding and from which specific instances of encoders or decoders can be
  10381. + * derived.
  10382. + *
  10383. + * This struct is reference-counted with the AVBuffer mechanism. The
  10384. + * av_hwdevice_ctx_alloc() constructor yields a reference, whose data field
  10385. + * points to the actual AVHWDeviceContext. Further objects derived from
  10386. + * AVHWDeviceContext (such as AVHWFramesContext, describing a frame pool with
  10387. + * specific properties) will hold an internal reference to it. After all the
  10388. + * references are released, the AVHWDeviceContext itself will be freed,
  10389. + * optionally invoking a user-specified callback for uninitializing the hardware
  10390. + * state.
  10391. + */
  10392. +typedef struct AVHWDeviceContext {
  10393. + /**
  10394. + * A class for logging. Set by av_hwdevice_ctx_alloc().
  10395. + */
  10396. + const AVClass *av_class;
  10397. +
  10398. + /**
  10399. + * Private data used internally by libavutil. Must not be accessed in any
  10400. + * way by the caller.
  10401. + */
  10402. + AVHWDeviceInternal *internal;
  10403. +
  10404. + /**
  10405. + * This field identifies the underlying API used for hardware access.
  10406. + *
  10407. + * This field is set when this struct is allocated and never changed
  10408. + * afterwards.
  10409. + */
  10410. + enum AVHWDeviceType type;
  10411. +
  10412. + /**
  10413. + * The format-specific data, allocated and freed by libavutil along with
  10414. + * this context.
  10415. + *
  10416. + * Should be cast by the user to the format-specific context defined in the
  10417. + * corresponding header (hwcontext_*.h) and filled as described in the
  10418. + * documentation before calling av_hwdevice_ctx_init().
  10419. + *
  10420. + * After calling av_hwdevice_ctx_init() this struct should not be modified
  10421. + * by the caller.
  10422. + */
  10423. + void *hwctx;
  10424. +
  10425. + /**
  10426. + * This field may be set by the caller before calling av_hwdevice_ctx_init().
  10427. + *
  10428. + * If non-NULL, this callback will be called when the last reference to
  10429. + * this context is unreferenced, immediately before it is freed.
  10430. + *
  10431. + * @note when other objects (e.g an AVHWFramesContext) are derived from this
  10432. + * struct, this callback will be invoked after all such child objects
  10433. + * are fully uninitialized and their respective destructors invoked.
  10434. + */
  10435. + void (*free)(struct AVHWDeviceContext *ctx);
  10436. +
  10437. + /**
  10438. + * Arbitrary user data, to be used e.g. by the free() callback.
  10439. + */
  10440. + void *user_opaque;
  10441. +} AVHWDeviceContext;
  10442. +
  10443. +typedef struct AVHWFramesInternal AVHWFramesInternal;
  10444. +
  10445. +/**
  10446. + * This struct describes a set or pool of "hardware" frames (i.e. those with
  10447. + * data not located in normal system memory). All the frames in the pool are
  10448. + * assumed to be allocated in the same way and interchangeable.
  10449. + *
  10450. + * This struct is reference-counted with the AVBuffer mechanism and tied to a
  10451. + * given AVHWDeviceContext instance. The av_hwframe_ctx_alloc() constructor
  10452. + * yields a reference, whose data field points to the actual AVHWFramesContext
  10453. + * struct.
  10454. + */
  10455. +typedef struct AVHWFramesContext {
  10456. + /**
  10457. + * A class for logging.
  10458. + */
  10459. + const AVClass *av_class;
  10460. +
  10461. + /**
  10462. + * Private data used internally by libavutil. Must not be accessed in any
  10463. + * way by the caller.
  10464. + */
  10465. + AVHWFramesInternal *internal;
  10466. +
  10467. + /**
  10468. + * A reference to the parent AVHWDeviceContext. This reference is owned and
  10469. + * managed by the enclosing AVHWFramesContext, but the caller may derive
  10470. + * additional references from it.
  10471. + */
  10472. + AVBufferRef *device_ref;
  10473. +
  10474. + /**
  10475. + * The parent AVHWDeviceContext. This is simply a pointer to
  10476. + * device_ref->data provided for convenience.
  10477. + *
  10478. + * Set by libavutil in av_hwframe_ctx_init().
  10479. + */
  10480. + AVHWDeviceContext *device_ctx;
  10481. +
  10482. + /**
  10483. + * The format-specific data, allocated and freed automatically along with
  10484. + * this context.
  10485. + *
  10486. + * Should be cast by the user to the format-specific context defined in the
  10487. + * corresponding header (hwframe_*.h) and filled as described in the
  10488. + * documentation before calling av_hwframe_ctx_init().
  10489. + *
  10490. + * After any frames using this context are created, the contents of this
  10491. + * struct should not be modified by the caller.
  10492. + */
  10493. + void *hwctx;
  10494. +
  10495. + /**
  10496. + * This field may be set by the caller before calling av_hwframe_ctx_init().
  10497. + *
  10498. + * If non-NULL, this callback will be called when the last reference to
  10499. + * this context is unreferenced, immediately before it is freed.
  10500. + */
  10501. + void (*free)(struct AVHWFramesContext *ctx);
  10502. +
  10503. + /**
  10504. + * Arbitrary user data, to be used e.g. by the free() callback.
  10505. + */
  10506. + void *user_opaque;
  10507. +
  10508. + /**
  10509. + * A pool from which the frames are allocated by av_hwframe_get_buffer().
  10510. + * This field may be set by the caller before calling av_hwframe_ctx_init().
  10511. + * The buffers returned by calling av_buffer_pool_get() on this pool must
  10512. + * have the properties described in the documentation in the corresponding hw
  10513. + * type's header (hwcontext_*.h). The pool will be freed strictly before
  10514. + * this struct's free() callback is invoked.
  10515. + *
  10516. + * This field may be NULL, then libavutil will attempt to allocate a pool
  10517. + * internally. Note that certain device types enforce pools allocated at
  10518. + * fixed size (frame count), which cannot be extended dynamically. In such a
  10519. + * case, initial_pool_size must be set appropriately.
  10520. + */
  10521. + AVBufferPool *pool;
  10522. +
  10523. + /**
  10524. + * Initial size of the frame pool. If a device type does not support
  10525. + * dynamically resizing the pool, then this is also the maximum pool size.
  10526. + *
  10527. + * May be set by the caller before calling av_hwframe_ctx_init(). Must be
  10528. + * set if pool is NULL and the device type does not support dynamic pools.
  10529. + */
  10530. + int initial_pool_size;
  10531. +
  10532. + /**
  10533. + * The pixel format identifying the underlying HW surface type.
  10534. + *
  10535. + * Must be a hwaccel format, i.e. the corresponding descriptor must have the
  10536. + * AV_PIX_FMT_FLAG_HWACCEL flag set.
  10537. + *
  10538. + * Must be set by the user before calling av_hwframe_ctx_init().
  10539. + */
  10540. + enum AVPixelFormat format;
  10541. +
  10542. + /**
  10543. + * The pixel format identifying the actual data layout of the hardware
  10544. + * frames.
  10545. + *
  10546. + * Must be set by the caller before calling av_hwframe_ctx_init().
  10547. + *
  10548. + * @note when the underlying API does not provide the exact data layout, but
  10549. + * only the colorspace/bit depth, this field should be set to the fully
  10550. + * planar version of that format (e.g. for 8-bit 420 YUV it should be
  10551. + * AV_PIX_FMT_YUV420P, not AV_PIX_FMT_NV12 or anything else).
  10552. + */
  10553. + enum AVPixelFormat sw_format;
  10554. +
  10555. + /**
  10556. + * The allocated dimensions of the frames in this pool.
  10557. + *
  10558. + * Must be set by the user before calling av_hwframe_ctx_init().
  10559. + */
  10560. + int width, height;
  10561. +} AVHWFramesContext;
  10562. +
  10563. +/**
  10564. + * Look up an AVHWDeviceType by name.
  10565. + *
  10566. + * @param name String name of the device type (case-insensitive).
  10567. + * @return The type from enum AVHWDeviceType, or AV_HWDEVICE_TYPE_NONE if
  10568. + * not found.
  10569. + */
  10570. +enum AVHWDeviceType av_hwdevice_find_type_by_name(const char *name);
  10571. +
  10572. +/** Get the string name of an AVHWDeviceType.
  10573. + *
  10574. + * @param type Type from enum AVHWDeviceType.
  10575. + * @return Pointer to a static string containing the name, or NULL if the type
  10576. + * is not valid.
  10577. + */
  10578. +const char *av_hwdevice_get_type_name(enum AVHWDeviceType type);
  10579. +
  10580. +/**
  10581. + * Iterate over supported device types.
  10582. + *
  10583. + * @param type AV_HWDEVICE_TYPE_NONE initially, then the previous type
  10584. + * returned by this function in subsequent iterations.
  10585. + * @return The next usable device type from enum AVHWDeviceType, or
  10586. + * AV_HWDEVICE_TYPE_NONE if there are no more.
  10587. + */
  10588. +enum AVHWDeviceType av_hwdevice_iterate_types(enum AVHWDeviceType prev);
  10589. +
  10590. +/**
  10591. + * Allocate an AVHWDeviceContext for a given hardware type.
  10592. + *
  10593. + * @param type the type of the hardware device to allocate.
  10594. + * @return a reference to the newly created AVHWDeviceContext on success or NULL
  10595. + * on failure.
  10596. + */
  10597. +AVBufferRef *av_hwdevice_ctx_alloc(enum AVHWDeviceType type);
  10598. +
  10599. +/**
  10600. + * Finalize the device context before use. This function must be called after
  10601. + * the context is filled with all the required information and before it is
  10602. + * used in any way.
  10603. + *
  10604. + * @param ref a reference to the AVHWDeviceContext
  10605. + * @return 0 on success, a negative AVERROR code on failure
  10606. + */
  10607. +int av_hwdevice_ctx_init(AVBufferRef *ref);
  10608. +
  10609. +/**
  10610. + * Open a device of the specified type and create an AVHWDeviceContext for it.
  10611. + *
  10612. + * This is a convenience function intended to cover the simple cases. Callers
  10613. + * who need to fine-tune device creation/management should open the device
  10614. + * manually and then wrap it in an AVHWDeviceContext using
  10615. + * av_hwdevice_ctx_alloc()/av_hwdevice_ctx_init().
  10616. + *
  10617. + * The returned context is already initialized and ready for use, the caller
  10618. + * should not call av_hwdevice_ctx_init() on it. The user_opaque/free fields of
  10619. + * the created AVHWDeviceContext are set by this function and should not be
  10620. + * touched by the caller.
  10621. + *
  10622. + * @param device_ctx On success, a reference to the newly-created device context
  10623. + * will be written here. The reference is owned by the caller
  10624. + * and must be released with av_buffer_unref() when no longer
  10625. + * needed. On failure, NULL will be written to this pointer.
  10626. + * @param type The type of the device to create.
  10627. + * @param device A type-specific string identifying the device to open.
  10628. + * @param opts A dictionary of additional (type-specific) options to use in
  10629. + * opening the device. The dictionary remains owned by the caller.
  10630. + * @param flags currently unused
  10631. + *
  10632. + * @return 0 on success, a negative AVERROR code on failure.
  10633. + */
  10634. +int av_hwdevice_ctx_create(AVBufferRef **device_ctx, enum AVHWDeviceType type,
  10635. + const char *device, AVDictionary *opts, int flags);
  10636. +
  10637. +/**
  10638. + * Create a new device of the specified type from an existing device.
  10639. + *
  10640. + * If the source device is a device of the target type or was originally
  10641. + * derived from such a device (possibly through one or more intermediate
  10642. + * devices of other types), then this will return a reference to the
  10643. + * existing device of the same type as is requested.
  10644. + *
  10645. + * Otherwise, it will attempt to derive a new device from the given source
  10646. + * device. If direct derivation to the new type is not implemented, it will
  10647. + * attempt the same derivation from each ancestor of the source device in
  10648. + * turn looking for an implemented derivation method.
  10649. + *
  10650. + * @param dst_ctx On success, a reference to the newly-created
  10651. + * AVHWDeviceContext.
  10652. + * @param type The type of the new device to create.
  10653. + * @param src_ctx A reference to an existing AVHWDeviceContext which will be
  10654. + * used to create the new device.
  10655. + * @param flags Currently unused; should be set to zero.
  10656. + * @return Zero on success, a negative AVERROR code on failure.
  10657. + */
  10658. +int av_hwdevice_ctx_create_derived(AVBufferRef **dst_ctx,
  10659. + enum AVHWDeviceType type,
  10660. + AVBufferRef *src_ctx, int flags);
  10661. +
  10662. +
  10663. +/**
  10664. + * Allocate an AVHWFramesContext tied to a given device context.
  10665. + *
  10666. + * @param device_ctx a reference to a AVHWDeviceContext. This function will make
  10667. + * a new reference for internal use, the one passed to the
  10668. + * function remains owned by the caller.
  10669. + * @return a reference to the newly created AVHWFramesContext on success or NULL
  10670. + * on failure.
  10671. + */
  10672. +AVBufferRef *av_hwframe_ctx_alloc(AVBufferRef *device_ctx);
  10673. +
  10674. +/**
  10675. + * Finalize the context before use. This function must be called after the
  10676. + * context is filled with all the required information and before it is attached
  10677. + * to any frames.
  10678. + *
  10679. + * @param ref a reference to the AVHWFramesContext
  10680. + * @return 0 on success, a negative AVERROR code on failure
  10681. + */
  10682. +int av_hwframe_ctx_init(AVBufferRef *ref);
  10683. +
  10684. +/**
  10685. + * Allocate a new frame attached to the given AVHWFramesContext.
  10686. + *
  10687. + * @param hwframe_ctx a reference to an AVHWFramesContext
  10688. + * @param frame an empty (freshly allocated or unreffed) frame to be filled with
  10689. + * newly allocated buffers.
  10690. + * @param flags currently unused, should be set to zero
  10691. + * @return 0 on success, a negative AVERROR code on failure
  10692. + */
  10693. +int av_hwframe_get_buffer(AVBufferRef *hwframe_ctx, AVFrame *frame, int flags);
  10694. +
  10695. +/**
  10696. + * Copy data to or from a hw surface. At least one of dst/src must have an
  10697. + * AVHWFramesContext attached.
  10698. + *
  10699. + * If src has an AVHWFramesContext attached, then the format of dst (if set)
  10700. + * must use one of the formats returned by av_hwframe_transfer_get_formats(src,
  10701. + * AV_HWFRAME_TRANSFER_DIRECTION_FROM).
  10702. + * If dst has an AVHWFramesContext attached, then the format of src must use one
  10703. + * of the formats returned by av_hwframe_transfer_get_formats(dst,
  10704. + * AV_HWFRAME_TRANSFER_DIRECTION_TO)
  10705. + *
  10706. + * dst may be "clean" (i.e. with data/buf pointers unset), in which case the
  10707. + * data buffers will be allocated by this function using av_frame_get_buffer().
  10708. + * If dst->format is set, then this format will be used, otherwise (when
  10709. + * dst->format is AV_PIX_FMT_NONE) the first acceptable format will be chosen.
  10710. + *
  10711. + * The two frames must have matching allocated dimensions (i.e. equal to
  10712. + * AVHWFramesContext.width/height), since not all device types support
  10713. + * transferring a sub-rectangle of the whole surface. The display dimensions
  10714. + * (i.e. AVFrame.width/height) may be smaller than the allocated dimensions, but
  10715. + * also have to be equal for both frames. When the display dimensions are
  10716. + * smaller than the allocated dimensions, the content of the padding in the
  10717. + * destination frame is unspecified.
  10718. + *
  10719. + * @param dst the destination frame. dst is not touched on failure.
  10720. + * @param src the source frame.
  10721. + * @param flags currently unused, should be set to zero
  10722. + * @return 0 on success, a negative AVERROR error code on failure.
  10723. + */
  10724. +int av_hwframe_transfer_data(AVFrame *dst, const AVFrame *src, int flags);
  10725. +
  10726. +enum AVHWFrameTransferDirection {
  10727. + /**
  10728. + * Transfer the data from the queried hw frame.
  10729. + */
  10730. + AV_HWFRAME_TRANSFER_DIRECTION_FROM,
  10731. +
  10732. + /**
  10733. + * Transfer the data to the queried hw frame.
  10734. + */
  10735. + AV_HWFRAME_TRANSFER_DIRECTION_TO,
  10736. +};
  10737. +
  10738. +/**
  10739. + * Get a list of possible source or target formats usable in
  10740. + * av_hwframe_transfer_data().
  10741. + *
  10742. + * @param hwframe_ctx the frame context to obtain the information for
  10743. + * @param dir the direction of the transfer
  10744. + * @param formats the pointer to the output format list will be written here.
  10745. + * The list is terminated with AV_PIX_FMT_NONE and must be freed
  10746. + * by the caller when no longer needed using av_free().
  10747. + * If this function returns successfully, the format list will
  10748. + * have at least one item (not counting the terminator).
  10749. + * On failure, the contents of this pointer are unspecified.
  10750. + * @param flags currently unused, should be set to zero
  10751. + * @return 0 on success, a negative AVERROR code on failure.
  10752. + */
  10753. +int av_hwframe_transfer_get_formats(AVBufferRef *hwframe_ctx,
  10754. + enum AVHWFrameTransferDirection dir,
  10755. + enum AVPixelFormat **formats, int flags);
  10756. +
  10757. +
  10758. +/**
  10759. + * This struct describes the constraints on hardware frames attached to
  10760. + * a given device with a hardware-specific configuration. This is returned
  10761. + * by av_hwdevice_get_hwframe_constraints() and must be freed by
  10762. + * av_hwframe_constraints_free() after use.
  10763. + */
  10764. +typedef struct AVHWFramesConstraints {
  10765. + /**
  10766. + * A list of possible values for format in the hw_frames_ctx,
  10767. + * terminated by AV_PIX_FMT_NONE. This member will always be filled.
  10768. + */
  10769. + enum AVPixelFormat *valid_hw_formats;
  10770. +
  10771. + /**
  10772. + * A list of possible values for sw_format in the hw_frames_ctx,
  10773. + * terminated by AV_PIX_FMT_NONE. Can be NULL if this information is
  10774. + * not known.
  10775. + */
  10776. + enum AVPixelFormat *valid_sw_formats;
  10777. +
  10778. + /**
  10779. + * The minimum size of frames in this hw_frames_ctx.
  10780. + * (Zero if not known.)
  10781. + */
  10782. + int min_width;
  10783. + int min_height;
  10784. +
  10785. + /**
  10786. + * The maximum size of frames in this hw_frames_ctx.
  10787. + * (INT_MAX if not known / no limit.)
  10788. + */
  10789. + int max_width;
  10790. + int max_height;
  10791. +} AVHWFramesConstraints;
  10792. +
  10793. +/**
  10794. + * Allocate a HW-specific configuration structure for a given HW device.
  10795. + * After use, the user must free all members as required by the specific
  10796. + * hardware structure being used, then free the structure itself with
  10797. + * av_free().
  10798. + *
  10799. + * @param device_ctx a reference to the associated AVHWDeviceContext.
  10800. + * @return The newly created HW-specific configuration structure on
  10801. + * success or NULL on failure.
  10802. + */
  10803. +void *av_hwdevice_hwconfig_alloc(AVBufferRef *device_ctx);
  10804. +
  10805. +/**
  10806. + * Get the constraints on HW frames given a device and the HW-specific
  10807. + * configuration to be used with that device. If no HW-specific
  10808. + * configuration is provided, returns the maximum possible capabilities
  10809. + * of the device.
  10810. + *
  10811. + * @param ref a reference to the associated AVHWDeviceContext.
  10812. + * @param hwconfig a filled HW-specific configuration structure, or NULL
  10813. + * to return the maximum possible capabilities of the device.
  10814. + * @return AVHWFramesConstraints structure describing the constraints
  10815. + * on the device, or NULL if not available.
  10816. + */
  10817. +AVHWFramesConstraints *av_hwdevice_get_hwframe_constraints(AVBufferRef *ref,
  10818. + const void *hwconfig);
  10819. +
  10820. +/**
  10821. + * Free an AVHWFrameConstraints structure.
  10822. + *
  10823. + * @param constraints The (filled or unfilled) AVHWFrameConstraints structure.
  10824. + */
  10825. +void av_hwframe_constraints_free(AVHWFramesConstraints **constraints);
  10826. +
  10827. +
  10828. +/**
  10829. + * Flags to apply to frame mappings.
  10830. + */
  10831. +enum {
  10832. + /**
  10833. + * The mapping must be readable.
  10834. + */
  10835. + AV_HWFRAME_MAP_READ = 1 << 0,
  10836. + /**
  10837. + * The mapping must be writeable.
  10838. + */
  10839. + AV_HWFRAME_MAP_WRITE = 1 << 1,
  10840. + /**
  10841. + * The mapped frame will be overwritten completely in subsequent
  10842. + * operations, so the current frame data need not be loaded. Any values
  10843. + * which are not overwritten are unspecified.
  10844. + */
  10845. + AV_HWFRAME_MAP_OVERWRITE = 1 << 2,
  10846. + /**
  10847. + * The mapping must be direct. That is, there must not be any copying in
  10848. + * the map or unmap steps. Note that performance of direct mappings may
  10849. + * be much lower than normal memory.
  10850. + */
  10851. + AV_HWFRAME_MAP_DIRECT = 1 << 3,
  10852. +};
  10853. +
  10854. +/**
  10855. + * Map a hardware frame.
  10856. + *
  10857. + * This has a number of different possible effects, depending on the format
  10858. + * and origin of the src and dst frames. On input, src should be a usable
  10859. + * frame with valid buffers and dst should be blank (typically as just created
  10860. + * by av_frame_alloc()). src should have an associated hwframe context, and
  10861. + * dst may optionally have a format and associated hwframe context.
  10862. + *
  10863. + * If src was created by mapping a frame from the hwframe context of dst,
  10864. + * then this function undoes the mapping - dst is replaced by a reference to
  10865. + * the frame that src was originally mapped from.
  10866. + *
  10867. + * If both src and dst have an associated hwframe context, then this function
  10868. + * attempts to map the src frame from its hardware context to that of dst and
  10869. + * then fill dst with appropriate data to be usable there. This will only be
  10870. + * possible if the hwframe contexts and associated devices are compatible -
  10871. + * given compatible devices, av_hwframe_ctx_create_derived() can be used to
  10872. + * create a hwframe context for dst in which mapping should be possible.
  10873. + *
  10874. + * If src has a hwframe context but dst does not, then the src frame is
  10875. + * mapped to normal memory and should thereafter be usable as a normal frame.
  10876. + * If the format is set on dst, then the mapping will attempt to create dst
  10877. + * with that format and fail if it is not possible. If format is unset (is
  10878. + * AV_PIX_FMT_NONE) then dst will be mapped with whatever the most appropriate
  10879. + * format to use is (probably the sw_format of the src hwframe context).
  10880. + *
  10881. + * A return value of AVERROR(ENOSYS) indicates that the mapping is not
  10882. + * possible with the given arguments and hwframe setup, while other return
  10883. + * values indicate that it failed somehow.
  10884. + *
  10885. + * @param dst Destination frame, to contain the mapping.
  10886. + * @param src Source frame, to be mapped.
  10887. + * @param flags Some combination of AV_HWFRAME_MAP_* flags.
  10888. + * @return Zero on success, negative AVERROR code on failure.
  10889. + */
  10890. +int av_hwframe_map(AVFrame *dst, const AVFrame *src, int flags);
  10891. +
  10892. +
  10893. +/**
  10894. + * Create and initialise an AVHWFramesContext as a mapping of another existing
  10895. + * AVHWFramesContext on a different device.
  10896. + *
  10897. + * av_hwframe_ctx_init() should not be called after this.
  10898. + *
  10899. + * @param derived_frame_ctx On success, a reference to the newly created
  10900. + * AVHWFramesContext.
  10901. + * @param derived_device_ctx A reference to the device to create the new
  10902. + * AVHWFramesContext on.
  10903. + * @param source_frame_ctx A reference to an existing AVHWFramesContext
  10904. + * which will be mapped to the derived context.
  10905. + * @param flags Some combination of AV_HWFRAME_MAP_* flags, defining the
  10906. + * mapping parameters to apply to frames which are allocated
  10907. + * in the derived device.
  10908. + * @return Zero on success, negative AVERROR code on failure.
  10909. + */
  10910. +int av_hwframe_ctx_create_derived(AVBufferRef **derived_frame_ctx,
  10911. + enum AVPixelFormat format,
  10912. + AVBufferRef *derived_device_ctx,
  10913. + AVBufferRef *source_frame_ctx,
  10914. + int flags);
  10915. +
  10916. +#endif /* AVUTIL_HWCONTEXT_H */
  10917. diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/intfloat.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/intfloat.h
  10918. new file mode 100644
  10919. index 000000000000..fe3d7ec4a5b6
  10920. --- /dev/null
  10921. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/intfloat.h
  10922. @@ -0,0 +1,77 @@
  10923. +/*
  10924. + * Copyright (c) 2011 Mans Rullgard
  10925. + *
  10926. + * This file is part of FFmpeg.
  10927. + *
  10928. + * FFmpeg is free software; you can redistribute it and/or
  10929. + * modify it under the terms of the GNU Lesser General Public
  10930. + * License as published by the Free Software Foundation; either
  10931. + * version 2.1 of the License, or (at your option) any later version.
  10932. + *
  10933. + * FFmpeg is distributed in the hope that it will be useful,
  10934. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10935. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10936. + * Lesser General Public License for more details.
  10937. + *
  10938. + * You should have received a copy of the GNU Lesser General Public
  10939. + * License along with FFmpeg; if not, write to the Free Software
  10940. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  10941. + */
  10942. +
  10943. +#ifndef AVUTIL_INTFLOAT_H
  10944. +#define AVUTIL_INTFLOAT_H
  10945. +
  10946. +#include <stdint.h>
  10947. +#include "attributes.h"
  10948. +
  10949. +union av_intfloat32 {
  10950. + uint32_t i;
  10951. + float f;
  10952. +};
  10953. +
  10954. +union av_intfloat64 {
  10955. + uint64_t i;
  10956. + double f;
  10957. +};
  10958. +
  10959. +/**
  10960. + * Reinterpret a 32-bit integer as a float.
  10961. + */
  10962. +static av_always_inline float av_int2float(uint32_t i)
  10963. +{
  10964. + union av_intfloat32 v;
  10965. + v.i = i;
  10966. + return v.f;
  10967. +}
  10968. +
  10969. +/**
  10970. + * Reinterpret a float as a 32-bit integer.
  10971. + */
  10972. +static av_always_inline uint32_t av_float2int(float f)
  10973. +{
  10974. + union av_intfloat32 v;
  10975. + v.f = f;
  10976. + return v.i;
  10977. +}
  10978. +
  10979. +/**
  10980. + * Reinterpret a 64-bit integer as a double.
  10981. + */
  10982. +static av_always_inline double av_int2double(uint64_t i)
  10983. +{
  10984. + union av_intfloat64 v;
  10985. + v.i = i;
  10986. + return v.f;
  10987. +}
  10988. +
  10989. +/**
  10990. + * Reinterpret a double as a 64-bit integer.
  10991. + */
  10992. +static av_always_inline uint64_t av_double2int(double f)
  10993. +{
  10994. + union av_intfloat64 v;
  10995. + v.f = f;
  10996. + return v.i;
  10997. +}
  10998. +
  10999. +#endif /* AVUTIL_INTFLOAT_H */
  11000. diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/log.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/log.h
  11001. new file mode 100644
  11002. index 000000000000..d9554e609d40
  11003. --- /dev/null
  11004. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/log.h
  11005. @@ -0,0 +1,362 @@
  11006. +/*
  11007. + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
  11008. + *
  11009. + * This file is part of FFmpeg.
  11010. + *
  11011. + * FFmpeg is free software; you can redistribute it and/or
  11012. + * modify it under the terms of the GNU Lesser General Public
  11013. + * License as published by the Free Software Foundation; either
  11014. + * version 2.1 of the License, or (at your option) any later version.
  11015. + *
  11016. + * FFmpeg is distributed in the hope that it will be useful,
  11017. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11018. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11019. + * Lesser General Public License for more details.
  11020. + *
  11021. + * You should have received a copy of the GNU Lesser General Public
  11022. + * License along with FFmpeg; if not, write to the Free Software
  11023. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  11024. + */
  11025. +
  11026. +#ifndef AVUTIL_LOG_H
  11027. +#define AVUTIL_LOG_H
  11028. +
  11029. +#include <stdarg.h>
  11030. +#include "avutil.h"
  11031. +#include "attributes.h"
  11032. +#include "version.h"
  11033. +
  11034. +typedef enum {
  11035. + AV_CLASS_CATEGORY_NA = 0,
  11036. + AV_CLASS_CATEGORY_INPUT,
  11037. + AV_CLASS_CATEGORY_OUTPUT,
  11038. + AV_CLASS_CATEGORY_MUXER,
  11039. + AV_CLASS_CATEGORY_DEMUXER,
  11040. + AV_CLASS_CATEGORY_ENCODER,
  11041. + AV_CLASS_CATEGORY_DECODER,
  11042. + AV_CLASS_CATEGORY_FILTER,
  11043. + AV_CLASS_CATEGORY_BITSTREAM_FILTER,
  11044. + AV_CLASS_CATEGORY_SWSCALER,
  11045. + AV_CLASS_CATEGORY_SWRESAMPLER,
  11046. + AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT = 40,
  11047. + AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
  11048. + AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT,
  11049. + AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
  11050. + AV_CLASS_CATEGORY_DEVICE_OUTPUT,
  11051. + AV_CLASS_CATEGORY_DEVICE_INPUT,
  11052. + AV_CLASS_CATEGORY_NB ///< not part of ABI/API
  11053. +}AVClassCategory;
  11054. +
  11055. +#define AV_IS_INPUT_DEVICE(category) \
  11056. + (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT) || \
  11057. + ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT) || \
  11058. + ((category) == AV_CLASS_CATEGORY_DEVICE_INPUT))
  11059. +
  11060. +#define AV_IS_OUTPUT_DEVICE(category) \
  11061. + (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT) || \
  11062. + ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT) || \
  11063. + ((category) == AV_CLASS_CATEGORY_DEVICE_OUTPUT))
  11064. +
  11065. +struct AVOptionRanges;
  11066. +
  11067. +/**
  11068. + * Describe the class of an AVClass context structure. That is an
  11069. + * arbitrary struct of which the first field is a pointer to an
  11070. + * AVClass struct (e.g. AVCodecContext, AVFormatContext etc.).
  11071. + */
  11072. +typedef struct AVClass {
  11073. + /**
  11074. + * The name of the class; usually it is the same name as the
  11075. + * context structure type to which the AVClass is associated.
  11076. + */
  11077. + const char* class_name;
  11078. +
  11079. + /**
  11080. + * A pointer to a function which returns the name of a context
  11081. + * instance ctx associated with the class.
  11082. + */
  11083. + const char* (*item_name)(void* ctx);
  11084. +
  11085. + /**
  11086. + * a pointer to the first option specified in the class if any or NULL
  11087. + *
  11088. + * @see av_set_default_options()
  11089. + */
  11090. + const struct AVOption *option;
  11091. +
  11092. + /**
  11093. + * LIBAVUTIL_VERSION with which this structure was created.
  11094. + * This is used to allow fields to be added without requiring major
  11095. + * version bumps everywhere.
  11096. + */
  11097. +
  11098. + int version;
  11099. +
  11100. + /**
  11101. + * Offset in the structure where log_level_offset is stored.
  11102. + * 0 means there is no such variable
  11103. + */
  11104. + int log_level_offset_offset;
  11105. +
  11106. + /**
  11107. + * Offset in the structure where a pointer to the parent context for
  11108. + * logging is stored. For example a decoder could pass its AVCodecContext
  11109. + * to eval as such a parent context, which an av_log() implementation
  11110. + * could then leverage to display the parent context.
  11111. + * The offset can be NULL.
  11112. + */
  11113. + int parent_log_context_offset;
  11114. +
  11115. + /**
  11116. + * Return next AVOptions-enabled child or NULL
  11117. + */
  11118. + void* (*child_next)(void *obj, void *prev);
  11119. +
  11120. + /**
  11121. + * Return an AVClass corresponding to the next potential
  11122. + * AVOptions-enabled child.
  11123. + *
  11124. + * The difference between child_next and this is that
  11125. + * child_next iterates over _already existing_ objects, while
  11126. + * child_class_next iterates over _all possible_ children.
  11127. + */
  11128. + const struct AVClass* (*child_class_next)(const struct AVClass *prev);
  11129. +
  11130. + /**
  11131. + * Category used for visualization (like color)
  11132. + * This is only set if the category is equal for all objects using this class.
  11133. + * available since version (51 << 16 | 56 << 8 | 100)
  11134. + */
  11135. + AVClassCategory category;
  11136. +
  11137. + /**
  11138. + * Callback to return the category.
  11139. + * available since version (51 << 16 | 59 << 8 | 100)
  11140. + */
  11141. + AVClassCategory (*get_category)(void* ctx);
  11142. +
  11143. + /**
  11144. + * Callback to return the supported/allowed ranges.
  11145. + * available since version (52.12)
  11146. + */
  11147. + int (*query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags);
  11148. +} AVClass;
  11149. +
  11150. +/**
  11151. + * @addtogroup lavu_log
  11152. + *
  11153. + * @{
  11154. + *
  11155. + * @defgroup lavu_log_constants Logging Constants
  11156. + *
  11157. + * @{
  11158. + */
  11159. +
  11160. +/**
  11161. + * Print no output.
  11162. + */
  11163. +#define AV_LOG_QUIET -8
  11164. +
  11165. +/**
  11166. + * Something went really wrong and we will crash now.
  11167. + */
  11168. +#define AV_LOG_PANIC 0
  11169. +
  11170. +/**
  11171. + * Something went wrong and recovery is not possible.
  11172. + * For example, no header was found for a format which depends
  11173. + * on headers or an illegal combination of parameters is used.
  11174. + */
  11175. +#define AV_LOG_FATAL 8
  11176. +
  11177. +/**
  11178. + * Something went wrong and cannot losslessly be recovered.
  11179. + * However, not all future data is affected.
  11180. + */
  11181. +#define AV_LOG_ERROR 16
  11182. +
  11183. +/**
  11184. + * Something somehow does not look correct. This may or may not
  11185. + * lead to problems. An example would be the use of '-vstrict -2'.
  11186. + */
  11187. +#define AV_LOG_WARNING 24
  11188. +
  11189. +/**
  11190. + * Standard information.
  11191. + */
  11192. +#define AV_LOG_INFO 32
  11193. +
  11194. +/**
  11195. + * Detailed information.
  11196. + */
  11197. +#define AV_LOG_VERBOSE 40
  11198. +
  11199. +/**
  11200. + * Stuff which is only useful for libav* developers.
  11201. + */
  11202. +#define AV_LOG_DEBUG 48
  11203. +
  11204. +/**
  11205. + * Extremely verbose debugging, useful for libav* development.
  11206. + */
  11207. +#define AV_LOG_TRACE 56
  11208. +
  11209. +#define AV_LOG_MAX_OFFSET (AV_LOG_TRACE - AV_LOG_QUIET)
  11210. +
  11211. +/**
  11212. + * @}
  11213. + */
  11214. +
  11215. +/**
  11216. + * Sets additional colors for extended debugging sessions.
  11217. + * @code
  11218. + av_log(ctx, AV_LOG_DEBUG|AV_LOG_C(134), "Message in purple\n");
  11219. + @endcode
  11220. + * Requires 256color terminal support. Uses outside debugging is not
  11221. + * recommended.
  11222. + */
  11223. +#define AV_LOG_C(x) ((x) << 8)
  11224. +
  11225. +/**
  11226. + * Send the specified message to the log if the level is less than or equal
  11227. + * to the current av_log_level. By default, all logging messages are sent to
  11228. + * stderr. This behavior can be altered by setting a different logging callback
  11229. + * function.
  11230. + * @see av_log_set_callback
  11231. + *
  11232. + * @param avcl A pointer to an arbitrary struct of which the first field is a
  11233. + * pointer to an AVClass struct or NULL if general log.
  11234. + * @param level The importance level of the message expressed using a @ref
  11235. + * lavu_log_constants "Logging Constant".
  11236. + * @param fmt The format string (printf-compatible) that specifies how
  11237. + * subsequent arguments are converted to output.
  11238. + */
  11239. +void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4);
  11240. +
  11241. +
  11242. +/**
  11243. + * Send the specified message to the log if the level is less than or equal
  11244. + * to the current av_log_level. By default, all logging messages are sent to
  11245. + * stderr. This behavior can be altered by setting a different logging callback
  11246. + * function.
  11247. + * @see av_log_set_callback
  11248. + *
  11249. + * @param avcl A pointer to an arbitrary struct of which the first field is a
  11250. + * pointer to an AVClass struct.
  11251. + * @param level The importance level of the message expressed using a @ref
  11252. + * lavu_log_constants "Logging Constant".
  11253. + * @param fmt The format string (printf-compatible) that specifies how
  11254. + * subsequent arguments are converted to output.
  11255. + * @param vl The arguments referenced by the format string.
  11256. + */
  11257. +void av_vlog(void *avcl, int level, const char *fmt, va_list vl);
  11258. +
  11259. +/**
  11260. + * Get the current log level
  11261. + *
  11262. + * @see lavu_log_constants
  11263. + *
  11264. + * @return Current log level
  11265. + */
  11266. +int av_log_get_level(void);
  11267. +
  11268. +/**
  11269. + * Set the log level
  11270. + *
  11271. + * @see lavu_log_constants
  11272. + *
  11273. + * @param level Logging level
  11274. + */
  11275. +void av_log_set_level(int level);
  11276. +
  11277. +/**
  11278. + * Set the logging callback
  11279. + *
  11280. + * @note The callback must be thread safe, even if the application does not use
  11281. + * threads itself as some codecs are multithreaded.
  11282. + *
  11283. + * @see av_log_default_callback
  11284. + *
  11285. + * @param callback A logging function with a compatible signature.
  11286. + */
  11287. +void av_log_set_callback(void (*callback)(void*, int, const char*, va_list));
  11288. +
  11289. +/**
  11290. + * Default logging callback
  11291. + *
  11292. + * It prints the message to stderr, optionally colorizing it.
  11293. + *
  11294. + * @param avcl A pointer to an arbitrary struct of which the first field is a
  11295. + * pointer to an AVClass struct.
  11296. + * @param level The importance level of the message expressed using a @ref
  11297. + * lavu_log_constants "Logging Constant".
  11298. + * @param fmt The format string (printf-compatible) that specifies how
  11299. + * subsequent arguments are converted to output.
  11300. + * @param vl The arguments referenced by the format string.
  11301. + */
  11302. +void av_log_default_callback(void *avcl, int level, const char *fmt,
  11303. + va_list vl);
  11304. +
  11305. +/**
  11306. + * Return the context name
  11307. + *
  11308. + * @param ctx The AVClass context
  11309. + *
  11310. + * @return The AVClass class_name
  11311. + */
  11312. +const char* av_default_item_name(void* ctx);
  11313. +AVClassCategory av_default_get_category(void *ptr);
  11314. +
  11315. +/**
  11316. + * Format a line of log the same way as the default callback.
  11317. + * @param line buffer to receive the formatted line
  11318. + * @param line_size size of the buffer
  11319. + * @param print_prefix used to store whether the prefix must be printed;
  11320. + * must point to a persistent integer initially set to 1
  11321. + */
  11322. +void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl,
  11323. + char *line, int line_size, int *print_prefix);
  11324. +
  11325. +/**
  11326. + * Format a line of log the same way as the default callback.
  11327. + * @param line buffer to receive the formatted line;
  11328. + * may be NULL if line_size is 0
  11329. + * @param line_size size of the buffer; at most line_size-1 characters will
  11330. + * be written to the buffer, plus one null terminator
  11331. + * @param print_prefix used to store whether the prefix must be printed;
  11332. + * must point to a persistent integer initially set to 1
  11333. + * @return Returns a negative value if an error occurred, otherwise returns
  11334. + * the number of characters that would have been written for a
  11335. + * sufficiently large buffer, not including the terminating null
  11336. + * character. If the return value is not less than line_size, it means
  11337. + * that the log message was truncated to fit the buffer.
  11338. + */
  11339. +int av_log_format_line2(void *ptr, int level, const char *fmt, va_list vl,
  11340. + char *line, int line_size, int *print_prefix);
  11341. +
  11342. +/**
  11343. + * Skip repeated messages, this requires the user app to use av_log() instead of
  11344. + * (f)printf as the 2 would otherwise interfere and lead to
  11345. + * "Last message repeated x times" messages below (f)printf messages with some
  11346. + * bad luck.
  11347. + * Also to receive the last, "last repeated" line if any, the user app must
  11348. + * call av_log(NULL, AV_LOG_QUIET, "%s", ""); at the end
  11349. + */
  11350. +#define AV_LOG_SKIP_REPEATED 1
  11351. +
  11352. +/**
  11353. + * Include the log severity in messages originating from codecs.
  11354. + *
  11355. + * Results in messages such as:
  11356. + * [rawvideo @ 0xDEADBEEF] [error] encode did not produce valid pts
  11357. + */
  11358. +#define AV_LOG_PRINT_LEVEL 2
  11359. +
  11360. +void av_log_set_flags(int arg);
  11361. +int av_log_get_flags(void);
  11362. +
  11363. +/**
  11364. + * @}
  11365. + */
  11366. +
  11367. +#endif /* AVUTIL_LOG_H */
  11368. diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/macros.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/macros.h
  11369. new file mode 100644
  11370. index 000000000000..2007ee561987
  11371. --- /dev/null
  11372. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/macros.h
  11373. @@ -0,0 +1,50 @@
  11374. +/*
  11375. + * This file is part of FFmpeg.
  11376. + *
  11377. + * FFmpeg is free software; you can redistribute it and/or
  11378. + * modify it under the terms of the GNU Lesser General Public
  11379. + * License as published by the Free Software Foundation; either
  11380. + * version 2.1 of the License, or (at your option) any later version.
  11381. + *
  11382. + * FFmpeg is distributed in the hope that it will be useful,
  11383. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11384. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11385. + * Lesser General Public License for more details.
  11386. + *
  11387. + * You should have received a copy of the GNU Lesser General Public
  11388. + * License along with FFmpeg; if not, write to the Free Software
  11389. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  11390. + */
  11391. +
  11392. +/**
  11393. + * @file
  11394. + * @ingroup lavu
  11395. + * Utility Preprocessor macros
  11396. + */
  11397. +
  11398. +#ifndef AVUTIL_MACROS_H
  11399. +#define AVUTIL_MACROS_H
  11400. +
  11401. +/**
  11402. + * @addtogroup preproc_misc Preprocessor String Macros
  11403. + *
  11404. + * String manipulation macros
  11405. + *
  11406. + * @{
  11407. + */
  11408. +
  11409. +#define AV_STRINGIFY(s) AV_TOSTRING(s)
  11410. +#define AV_TOSTRING(s) #s
  11411. +
  11412. +#define AV_GLUE(a, b) a ## b
  11413. +#define AV_JOIN(a, b) AV_GLUE(a, b)
  11414. +
  11415. +/**
  11416. + * @}
  11417. + */
  11418. +
  11419. +#define AV_PRAGMA(s) _Pragma(#s)
  11420. +
  11421. +#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1))
  11422. +
  11423. +#endif /* AVUTIL_MACROS_H */
  11424. diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mathematics.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mathematics.h
  11425. new file mode 100644
  11426. index 000000000000..54901800ba6a
  11427. --- /dev/null
  11428. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mathematics.h
  11429. @@ -0,0 +1,242 @@
  11430. +/*
  11431. + * copyright (c) 2005-2012 Michael Niedermayer <michaelni@gmx.at>
  11432. + *
  11433. + * This file is part of FFmpeg.
  11434. + *
  11435. + * FFmpeg is free software; you can redistribute it and/or
  11436. + * modify it under the terms of the GNU Lesser General Public
  11437. + * License as published by the Free Software Foundation; either
  11438. + * version 2.1 of the License, or (at your option) any later version.
  11439. + *
  11440. + * FFmpeg is distributed in the hope that it will be useful,
  11441. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11442. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11443. + * Lesser General Public License for more details.
  11444. + *
  11445. + * You should have received a copy of the GNU Lesser General Public
  11446. + * License along with FFmpeg; if not, write to the Free Software
  11447. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  11448. + */
  11449. +
  11450. +/**
  11451. + * @file
  11452. + * @addtogroup lavu_math
  11453. + * Mathematical utilities for working with timestamp and time base.
  11454. + */
  11455. +
  11456. +#ifndef AVUTIL_MATHEMATICS_H
  11457. +#define AVUTIL_MATHEMATICS_H
  11458. +
  11459. +#include <stdint.h>
  11460. +#include <math.h>
  11461. +#include "attributes.h"
  11462. +#include "rational.h"
  11463. +#include "intfloat.h"
  11464. +
  11465. +#ifndef M_E
  11466. +#define M_E 2.7182818284590452354 /* e */
  11467. +#endif
  11468. +#ifndef M_LN2
  11469. +#define M_LN2 0.69314718055994530942 /* log_e 2 */
  11470. +#endif
  11471. +#ifndef M_LN10
  11472. +#define M_LN10 2.30258509299404568402 /* log_e 10 */
  11473. +#endif
  11474. +#ifndef M_LOG2_10
  11475. +#define M_LOG2_10 3.32192809488736234787 /* log_2 10 */
  11476. +#endif
  11477. +#ifndef M_PHI
  11478. +#define M_PHI 1.61803398874989484820 /* phi / golden ratio */
  11479. +#endif
  11480. +#ifndef M_PI
  11481. +#define M_PI 3.14159265358979323846 /* pi */
  11482. +#endif
  11483. +#ifndef M_PI_2
  11484. +#define M_PI_2 1.57079632679489661923 /* pi/2 */
  11485. +#endif
  11486. +#ifndef M_SQRT1_2
  11487. +#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
  11488. +#endif
  11489. +#ifndef M_SQRT2
  11490. +#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
  11491. +#endif
  11492. +#ifndef NAN
  11493. +#define NAN av_int2float(0x7fc00000)
  11494. +#endif
  11495. +#ifndef INFINITY
  11496. +#define INFINITY av_int2float(0x7f800000)
  11497. +#endif
  11498. +
  11499. +/**
  11500. + * @addtogroup lavu_math
  11501. + *
  11502. + * @{
  11503. + */
  11504. +
  11505. +/**
  11506. + * Rounding methods.
  11507. + */
  11508. +enum AVRounding {
  11509. + AV_ROUND_ZERO = 0, ///< Round toward zero.
  11510. + AV_ROUND_INF = 1, ///< Round away from zero.
  11511. + AV_ROUND_DOWN = 2, ///< Round toward -infinity.
  11512. + AV_ROUND_UP = 3, ///< Round toward +infinity.
  11513. + AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero.
  11514. + /**
  11515. + * Flag telling rescaling functions to pass `INT64_MIN`/`MAX` through
  11516. + * unchanged, avoiding special cases for #AV_NOPTS_VALUE.
  11517. + *
  11518. + * Unlike other values of the enumeration AVRounding, this value is a
  11519. + * bitmask that must be used in conjunction with another value of the
  11520. + * enumeration through a bitwise OR, in order to set behavior for normal
  11521. + * cases.
  11522. + *
  11523. + * @code{.c}
  11524. + * av_rescale_rnd(3, 1, 2, AV_ROUND_UP | AV_ROUND_PASS_MINMAX);
  11525. + * // Rescaling 3:
  11526. + * // Calculating 3 * 1 / 2
  11527. + * // 3 / 2 is rounded up to 2
  11528. + * // => 2
  11529. + *
  11530. + * av_rescale_rnd(AV_NOPTS_VALUE, 1, 2, AV_ROUND_UP | AV_ROUND_PASS_MINMAX);
  11531. + * // Rescaling AV_NOPTS_VALUE:
  11532. + * // AV_NOPTS_VALUE == INT64_MIN
  11533. + * // AV_NOPTS_VALUE is passed through
  11534. + * // => AV_NOPTS_VALUE
  11535. + * @endcode
  11536. + */
  11537. + AV_ROUND_PASS_MINMAX = 8192,
  11538. +};
  11539. +
  11540. +/**
  11541. + * Compute the greatest common divisor of two integer operands.
  11542. + *
  11543. + * @param a,b Operands
  11544. + * @return GCD of a and b up to sign; if a >= 0 and b >= 0, return value is >= 0;
  11545. + * if a == 0 and b == 0, returns 0.
  11546. + */
  11547. +int64_t av_const av_gcd(int64_t a, int64_t b);
  11548. +
  11549. +/**
  11550. + * Rescale a 64-bit integer with rounding to nearest.
  11551. + *
  11552. + * The operation is mathematically equivalent to `a * b / c`, but writing that
  11553. + * directly can overflow.
  11554. + *
  11555. + * This function is equivalent to av_rescale_rnd() with #AV_ROUND_NEAR_INF.
  11556. + *
  11557. + * @see av_rescale_rnd(), av_rescale_q(), av_rescale_q_rnd()
  11558. + */
  11559. +int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const;
  11560. +
  11561. +/**
  11562. + * Rescale a 64-bit integer with specified rounding.
  11563. + *
  11564. + * The operation is mathematically equivalent to `a * b / c`, but writing that
  11565. + * directly can overflow, and does not support different rounding methods.
  11566. + *
  11567. + * @see av_rescale(), av_rescale_q(), av_rescale_q_rnd()
  11568. + */
  11569. +int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd) av_const;
  11570. +
  11571. +/**
  11572. + * Rescale a 64-bit integer by 2 rational numbers.
  11573. + *
  11574. + * The operation is mathematically equivalent to `a * bq / cq`.
  11575. + *
  11576. + * This function is equivalent to av_rescale_q_rnd() with #AV_ROUND_NEAR_INF.
  11577. + *
  11578. + * @see av_rescale(), av_rescale_rnd(), av_rescale_q_rnd()
  11579. + */
  11580. +int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;
  11581. +
  11582. +/**
  11583. + * Rescale a 64-bit integer by 2 rational numbers with specified rounding.
  11584. + *
  11585. + * The operation is mathematically equivalent to `a * bq / cq`.
  11586. + *
  11587. + * @see av_rescale(), av_rescale_rnd(), av_rescale_q()
  11588. + */
  11589. +int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq,
  11590. + enum AVRounding rnd) av_const;
  11591. +
  11592. +/**
  11593. + * Compare two timestamps each in its own time base.
  11594. + *
  11595. + * @return One of the following values:
  11596. + * - -1 if `ts_a` is before `ts_b`
  11597. + * - 1 if `ts_a` is after `ts_b`
  11598. + * - 0 if they represent the same position
  11599. + *
  11600. + * @warning
  11601. + * The result of the function is undefined if one of the timestamps is outside
  11602. + * the `int64_t` range when represented in the other's timebase.
  11603. + */
  11604. +int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b);
  11605. +
  11606. +/**
  11607. + * Compare the remainders of two integer operands divided by a common divisor.
  11608. + *
  11609. + * In other words, compare the least significant `log2(mod)` bits of integers
  11610. + * `a` and `b`.
  11611. + *
  11612. + * @code{.c}
  11613. + * av_compare_mod(0x11, 0x02, 0x10) < 0 // since 0x11 % 0x10 (0x1) < 0x02 % 0x10 (0x2)
  11614. + * av_compare_mod(0x11, 0x02, 0x20) > 0 // since 0x11 % 0x20 (0x11) > 0x02 % 0x20 (0x02)
  11615. + * @endcode
  11616. + *
  11617. + * @param a,b Operands
  11618. + * @param mod Divisor; must be a power of 2
  11619. + * @return
  11620. + * - a negative value if `a % mod < b % mod`
  11621. + * - a positive value if `a % mod > b % mod`
  11622. + * - zero if `a % mod == b % mod`
  11623. + */
  11624. +int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod);
  11625. +
  11626. +/**
  11627. + * Rescale a timestamp while preserving known durations.
  11628. + *
  11629. + * This function is designed to be called per audio packet to scale the input
  11630. + * timestamp to a different time base. Compared to a simple av_rescale_q()
  11631. + * call, this function is robust against possible inconsistent frame durations.
  11632. + *
  11633. + * The `last` parameter is a state variable that must be preserved for all
  11634. + * subsequent calls for the same stream. For the first call, `*last` should be
  11635. + * initialized to #AV_NOPTS_VALUE.
  11636. + *
  11637. + * @param[in] in_tb Input time base
  11638. + * @param[in] in_ts Input timestamp
  11639. + * @param[in] fs_tb Duration time base; typically this is finer-grained
  11640. + * (greater) than `in_tb` and `out_tb`
  11641. + * @param[in] duration Duration till the next call to this function (i.e.
  11642. + * duration of the current packet/frame)
  11643. + * @param[in,out] last Pointer to a timestamp expressed in terms of
  11644. + * `fs_tb`, acting as a state variable
  11645. + * @param[in] out_tb Output timebase
  11646. + * @return Timestamp expressed in terms of `out_tb`
  11647. + *
  11648. + * @note In the context of this function, "duration" is in term of samples, not
  11649. + * seconds.
  11650. + */
  11651. +int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts, AVRational fs_tb, int duration, int64_t *last, AVRational out_tb);
  11652. +
  11653. +/**
  11654. + * Add a value to a timestamp.
  11655. + *
  11656. + * This function guarantees that when the same value is repeatly added that
  11657. + * no accumulation of rounding errors occurs.
  11658. + *
  11659. + * @param[in] ts Input timestamp
  11660. + * @param[in] ts_tb Input timestamp time base
  11661. + * @param[in] inc Value to be added
  11662. + * @param[in] inc_tb Time base of `inc`
  11663. + */
  11664. +int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc);
  11665. +
  11666. +
  11667. +/**
  11668. + * @}
  11669. + */
  11670. +
  11671. +#endif /* AVUTIL_MATHEMATICS_H */
  11672. diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mem.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mem.h
  11673. new file mode 100644
  11674. index 000000000000..7e0b12a8a782
  11675. --- /dev/null
  11676. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/mem.h
  11677. @@ -0,0 +1,700 @@
  11678. +/*
  11679. + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
  11680. + *
  11681. + * This file is part of FFmpeg.
  11682. + *
  11683. + * FFmpeg is free software; you can redistribute it and/or
  11684. + * modify it under the terms of the GNU Lesser General Public
  11685. + * License as published by the Free Software Foundation; either
  11686. + * version 2.1 of the License, or (at your option) any later version.
  11687. + *
  11688. + * FFmpeg is distributed in the hope that it will be useful,
  11689. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11690. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11691. + * Lesser General Public License for more details.
  11692. + *
  11693. + * You should have received a copy of the GNU Lesser General Public
  11694. + * License along with FFmpeg; if not, write to the Free Software
  11695. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  11696. + */
  11697. +
  11698. +/**
  11699. + * @file
  11700. + * @ingroup lavu_mem
  11701. + * Memory handling functions
  11702. + */
  11703. +
  11704. +#ifndef AVUTIL_MEM_H
  11705. +#define AVUTIL_MEM_H
  11706. +
  11707. +#include <limits.h>
  11708. +#include <stdint.h>
  11709. +
  11710. +#include "attributes.h"
  11711. +#include "error.h"
  11712. +#include "avutil.h"
  11713. +
  11714. +/**
  11715. + * @addtogroup lavu_mem
  11716. + * Utilities for manipulating memory.
  11717. + *
  11718. + * FFmpeg has several applications of memory that are not required of a typical
  11719. + * program. For example, the computing-heavy components like video decoding and
  11720. + * encoding can be sped up significantly through the use of aligned memory.
  11721. + *
  11722. + * However, for each of FFmpeg's applications of memory, there might not be a
  11723. + * recognized or standardized API for that specific use. Memory alignment, for
  11724. + * instance, varies wildly depending on operating systems, architectures, and
  11725. + * compilers. Hence, this component of @ref libavutil is created to make
  11726. + * dealing with memory consistently possible on all platforms.
  11727. + *
  11728. + * @{
  11729. + *
  11730. + * @defgroup lavu_mem_macros Alignment Macros
  11731. + * Helper macros for declaring aligned variables.
  11732. + * @{
  11733. + */
  11734. +
  11735. +/**
  11736. + * @def DECLARE_ALIGNED(n,t,v)
  11737. + * Declare a variable that is aligned in memory.
  11738. + *
  11739. + * @code{.c}
  11740. + * DECLARE_ALIGNED(16, uint16_t, aligned_int) = 42;
  11741. + * DECLARE_ALIGNED(32, uint8_t, aligned_array)[128];
  11742. + *
  11743. + * // The default-alignment equivalent would be
  11744. + * uint16_t aligned_int = 42;
  11745. + * uint8_t aligned_array[128];
  11746. + * @endcode
  11747. + *
  11748. + * @param n Minimum alignment in bytes
  11749. + * @param t Type of the variable (or array element)
  11750. + * @param v Name of the variable
  11751. + */
  11752. +
  11753. +/**
  11754. + * @def DECLARE_ASM_ALIGNED(n,t,v)
  11755. + * Declare an aligned variable appropriate for use in inline assembly code.
  11756. + *
  11757. + * @code{.c}
  11758. + * DECLARE_ASM_ALIGNED(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008);
  11759. + * @endcode
  11760. + *
  11761. + * @param n Minimum alignment in bytes
  11762. + * @param t Type of the variable (or array element)
  11763. + * @param v Name of the variable
  11764. + */
  11765. +
  11766. +/**
  11767. + * @def DECLARE_ASM_CONST(n,t,v)
  11768. + * Declare a static constant aligned variable appropriate for use in inline
  11769. + * assembly code.
  11770. + *
  11771. + * @code{.c}
  11772. + * DECLARE_ASM_CONST(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008);
  11773. + * @endcode
  11774. + *
  11775. + * @param n Minimum alignment in bytes
  11776. + * @param t Type of the variable (or array element)
  11777. + * @param v Name of the variable
  11778. + */
  11779. +
  11780. +#if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C)
  11781. + #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
  11782. + #define DECLARE_ASM_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
  11783. + #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v
  11784. +#elif defined(__DJGPP__)
  11785. + #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (FFMIN(n, 16)))) v
  11786. + #define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v
  11787. + #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v
  11788. +#elif defined(__GNUC__) || defined(__clang__)
  11789. + #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
  11790. + #define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (n))) v
  11791. + #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (n))) v
  11792. +#elif defined(_MSC_VER)
  11793. + #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v
  11794. + #define DECLARE_ASM_ALIGNED(n,t,v) __declspec(align(n)) t v
  11795. + #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v
  11796. +#else
  11797. + #define DECLARE_ALIGNED(n,t,v) t v
  11798. + #define DECLARE_ASM_ALIGNED(n,t,v) t v
  11799. + #define DECLARE_ASM_CONST(n,t,v) static const t v
  11800. +#endif
  11801. +
  11802. +/**
  11803. + * @}
  11804. + */
  11805. +
  11806. +/**
  11807. + * @defgroup lavu_mem_attrs Function Attributes
  11808. + * Function attributes applicable to memory handling functions.
  11809. + *
  11810. + * These function attributes can help compilers emit more useful warnings, or
  11811. + * generate better code.
  11812. + * @{
  11813. + */
  11814. +
  11815. +/**
  11816. + * @def av_malloc_attrib
  11817. + * Function attribute denoting a malloc-like function.
  11818. + *
  11819. + * @see <a href="https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-g_t_0040code_007bmalloc_007d-function-attribute-3251">Function attribute `malloc` in GCC's documentation</a>
  11820. + */
  11821. +
  11822. +#if AV_GCC_VERSION_AT_LEAST(3,1)
  11823. + #define av_malloc_attrib __attribute__((__malloc__))
  11824. +#else
  11825. + #define av_malloc_attrib
  11826. +#endif
  11827. +
  11828. +/**
  11829. + * @def av_alloc_size(...)
  11830. + * Function attribute used on a function that allocates memory, whose size is
  11831. + * given by the specified parameter(s).
  11832. + *
  11833. + * @code{.c}
  11834. + * void *av_malloc(size_t size) av_alloc_size(1);
  11835. + * void *av_calloc(size_t nmemb, size_t size) av_alloc_size(1, 2);
  11836. + * @endcode
  11837. + *
  11838. + * @param ... One or two parameter indexes, separated by a comma
  11839. + *
  11840. + * @see <a href="https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-g_t_0040code_007balloc_005fsize_007d-function-attribute-3220">Function attribute `alloc_size` in GCC's documentation</a>
  11841. + */
  11842. +
  11843. +#if AV_GCC_VERSION_AT_LEAST(4,3)
  11844. + #define av_alloc_size(...) __attribute__((alloc_size(__VA_ARGS__)))
  11845. +#else
  11846. + #define av_alloc_size(...)
  11847. +#endif
  11848. +
  11849. +/**
  11850. + * @}
  11851. + */
  11852. +
  11853. +/**
  11854. + * @defgroup lavu_mem_funcs Heap Management
  11855. + * Functions responsible for allocating, freeing, and copying memory.
  11856. + *
  11857. + * All memory allocation functions have a built-in upper limit of `INT_MAX`
  11858. + * bytes. This may be changed with av_max_alloc(), although exercise extreme
  11859. + * caution when doing so.
  11860. + *
  11861. + * @{
  11862. + */
  11863. +
  11864. +/**
  11865. + * Allocate a memory block with alignment suitable for all memory accesses
  11866. + * (including vectors if available on the CPU).
  11867. + *
  11868. + * @param size Size in bytes for the memory block to be allocated
  11869. + * @return Pointer to the allocated block, or `NULL` if the block cannot
  11870. + * be allocated
  11871. + * @see av_mallocz()
  11872. + */
  11873. +void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1);
  11874. +
  11875. +/**
  11876. + * Allocate a memory block with alignment suitable for all memory accesses
  11877. + * (including vectors if available on the CPU) and zero all the bytes of the
  11878. + * block.
  11879. + *
  11880. + * @param size Size in bytes for the memory block to be allocated
  11881. + * @return Pointer to the allocated block, or `NULL` if it cannot be allocated
  11882. + * @see av_malloc()
  11883. + */
  11884. +void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1);
  11885. +
  11886. +/**
  11887. + * Allocate a memory block for an array with av_malloc().
  11888. + *
  11889. + * The allocated memory will have size `size * nmemb` bytes.
  11890. + *
  11891. + * @param nmemb Number of element
  11892. + * @param size Size of a single element
  11893. + * @return Pointer to the allocated block, or `NULL` if the block cannot
  11894. + * be allocated
  11895. + * @see av_malloc()
  11896. + */
  11897. +av_alloc_size(1, 2) void *av_malloc_array(size_t nmemb, size_t size);
  11898. +
  11899. +/**
  11900. + * Allocate a memory block for an array with av_mallocz().
  11901. + *
  11902. + * The allocated memory will have size `size * nmemb` bytes.
  11903. + *
  11904. + * @param nmemb Number of elements
  11905. + * @param size Size of the single element
  11906. + * @return Pointer to the allocated block, or `NULL` if the block cannot
  11907. + * be allocated
  11908. + *
  11909. + * @see av_mallocz()
  11910. + * @see av_malloc_array()
  11911. + */
  11912. +av_alloc_size(1, 2) void *av_mallocz_array(size_t nmemb, size_t size);
  11913. +
  11914. +/**
  11915. + * Non-inlined equivalent of av_mallocz_array().
  11916. + *
  11917. + * Created for symmetry with the calloc() C function.
  11918. + */
  11919. +void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib;
  11920. +
  11921. +/**
  11922. + * Allocate, reallocate, or free a block of memory.
  11923. + *
  11924. + * If `ptr` is `NULL` and `size` > 0, allocate a new block. If `size` is
  11925. + * zero, free the memory block pointed to by `ptr`. Otherwise, expand or
  11926. + * shrink that block of memory according to `size`.
  11927. + *
  11928. + * @param ptr Pointer to a memory block already allocated with
  11929. + * av_realloc() or `NULL`
  11930. + * @param size Size in bytes of the memory block to be allocated or
  11931. + * reallocated
  11932. + *
  11933. + * @return Pointer to a newly-reallocated block or `NULL` if the block
  11934. + * cannot be reallocated or the function is used to free the memory block
  11935. + *
  11936. + * @warning Unlike av_malloc(), the returned pointer is not guaranteed to be
  11937. + * correctly aligned.
  11938. + * @see av_fast_realloc()
  11939. + * @see av_reallocp()
  11940. + */
  11941. +void *av_realloc(void *ptr, size_t size) av_alloc_size(2);
  11942. +
  11943. +/**
  11944. + * Allocate, reallocate, or free a block of memory through a pointer to a
  11945. + * pointer.
  11946. + *
  11947. + * If `*ptr` is `NULL` and `size` > 0, allocate a new block. If `size` is
  11948. + * zero, free the memory block pointed to by `*ptr`. Otherwise, expand or
  11949. + * shrink that block of memory according to `size`.
  11950. + *
  11951. + * @param[in,out] ptr Pointer to a pointer to a memory block already allocated
  11952. + * with av_realloc(), or a pointer to `NULL`. The pointer
  11953. + * is updated on success, or freed on failure.
  11954. + * @param[in] size Size in bytes for the memory block to be allocated or
  11955. + * reallocated
  11956. + *
  11957. + * @return Zero on success, an AVERROR error code on failure
  11958. + *
  11959. + * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
  11960. + * correctly aligned.
  11961. + */
  11962. +av_warn_unused_result
  11963. +int av_reallocp(void *ptr, size_t size);
  11964. +
  11965. +/**
  11966. + * Allocate, reallocate, or free a block of memory.
  11967. + *
  11968. + * This function does the same thing as av_realloc(), except:
  11969. + * - It takes two size arguments and allocates `nelem * elsize` bytes,
  11970. + * after checking the result of the multiplication for integer overflow.
  11971. + * - It frees the input block in case of failure, thus avoiding the memory
  11972. + * leak with the classic
  11973. + * @code{.c}
  11974. + * buf = realloc(buf);
  11975. + * if (!buf)
  11976. + * return -1;
  11977. + * @endcode
  11978. + * pattern.
  11979. + */
  11980. +void *av_realloc_f(void *ptr, size_t nelem, size_t elsize);
  11981. +
  11982. +/**
  11983. + * Allocate, reallocate, or free an array.
  11984. + *
  11985. + * If `ptr` is `NULL` and `nmemb` > 0, allocate a new block. If
  11986. + * `nmemb` is zero, free the memory block pointed to by `ptr`.
  11987. + *
  11988. + * @param ptr Pointer to a memory block already allocated with
  11989. + * av_realloc() or `NULL`
  11990. + * @param nmemb Number of elements in the array
  11991. + * @param size Size of the single element of the array
  11992. + *
  11993. + * @return Pointer to a newly-reallocated block or NULL if the block
  11994. + * cannot be reallocated or the function is used to free the memory block
  11995. + *
  11996. + * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
  11997. + * correctly aligned.
  11998. + * @see av_reallocp_array()
  11999. + */
  12000. +av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size);
  12001. +
  12002. +/**
  12003. + * Allocate, reallocate, or free an array through a pointer to a pointer.
  12004. + *
  12005. + * If `*ptr` is `NULL` and `nmemb` > 0, allocate a new block. If `nmemb` is
  12006. + * zero, free the memory block pointed to by `*ptr`.
  12007. + *
  12008. + * @param[in,out] ptr Pointer to a pointer to a memory block already
  12009. + * allocated with av_realloc(), or a pointer to `NULL`.
  12010. + * The pointer is updated on success, or freed on failure.
  12011. + * @param[in] nmemb Number of elements
  12012. + * @param[in] size Size of the single element
  12013. + *
  12014. + * @return Zero on success, an AVERROR error code on failure
  12015. + *
  12016. + * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
  12017. + * correctly aligned.
  12018. + */
  12019. +av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
  12020. +
  12021. +/**
  12022. + * Reallocate the given buffer if it is not large enough, otherwise do nothing.
  12023. + *
  12024. + * If the given buffer is `NULL`, then a new uninitialized buffer is allocated.
  12025. + *
  12026. + * If the given buffer is not large enough, and reallocation fails, `NULL` is
  12027. + * returned and `*size` is set to 0, but the original buffer is not changed or
  12028. + * freed.
  12029. + *
  12030. + * A typical use pattern follows:
  12031. + *
  12032. + * @code{.c}
  12033. + * uint8_t *buf = ...;
  12034. + * uint8_t *new_buf = av_fast_realloc(buf, &current_size, size_needed);
  12035. + * if (!new_buf) {
  12036. + * // Allocation failed; clean up original buffer
  12037. + * av_freep(&buf);
  12038. + * return AVERROR(ENOMEM);
  12039. + * }
  12040. + * @endcode
  12041. + *
  12042. + * @param[in,out] ptr Already allocated buffer, or `NULL`
  12043. + * @param[in,out] size Pointer to current size of buffer `ptr`. `*size` is
  12044. + * changed to `min_size` in case of success or 0 in
  12045. + * case of failure
  12046. + * @param[in] min_size New size of buffer `ptr`
  12047. + * @return `ptr` if the buffer is large enough, a pointer to newly reallocated
  12048. + * buffer if the buffer was not large enough, or `NULL` in case of
  12049. + * error
  12050. + * @see av_realloc()
  12051. + * @see av_fast_malloc()
  12052. + */
  12053. +void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
  12054. +
  12055. +/**
  12056. + * Allocate a buffer, reusing the given one if large enough.
  12057. + *
  12058. + * Contrary to av_fast_realloc(), the current buffer contents might not be
  12059. + * preserved and on error the old buffer is freed, thus no special handling to
  12060. + * avoid memleaks is necessary.
  12061. + *
  12062. + * `*ptr` is allowed to be `NULL`, in which case allocation always happens if
  12063. + * `size_needed` is greater than 0.
  12064. + *
  12065. + * @code{.c}
  12066. + * uint8_t *buf = ...;
  12067. + * av_fast_malloc(&buf, &current_size, size_needed);
  12068. + * if (!buf) {
  12069. + * // Allocation failed; buf already freed
  12070. + * return AVERROR(ENOMEM);
  12071. + * }
  12072. + * @endcode
  12073. + *
  12074. + * @param[in,out] ptr Pointer to pointer to an already allocated buffer.
  12075. + * `*ptr` will be overwritten with pointer to new
  12076. + * buffer on success or `NULL` on failure
  12077. + * @param[in,out] size Pointer to current size of buffer `*ptr`. `*size` is
  12078. + * changed to `min_size` in case of success or 0 in
  12079. + * case of failure
  12080. + * @param[in] min_size New size of buffer `*ptr`
  12081. + * @see av_realloc()
  12082. + * @see av_fast_mallocz()
  12083. + */
  12084. +void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
  12085. +
  12086. +/**
  12087. + * Allocate and clear a buffer, reusing the given one if large enough.
  12088. + *
  12089. + * Like av_fast_malloc(), but all newly allocated space is initially cleared.
  12090. + * Reused buffer is not cleared.
  12091. + *
  12092. + * `*ptr` is allowed to be `NULL`, in which case allocation always happens if
  12093. + * `size_needed` is greater than 0.
  12094. + *
  12095. + * @param[in,out] ptr Pointer to pointer to an already allocated buffer.
  12096. + * `*ptr` will be overwritten with pointer to new
  12097. + * buffer on success or `NULL` on failure
  12098. + * @param[in,out] size Pointer to current size of buffer `*ptr`. `*size` is
  12099. + * changed to `min_size` in case of success or 0 in
  12100. + * case of failure
  12101. + * @param[in] min_size New size of buffer `*ptr`
  12102. + * @see av_fast_malloc()
  12103. + */
  12104. +void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size);
  12105. +
  12106. +/**
  12107. + * Free a memory block which has been allocated with a function of av_malloc()
  12108. + * or av_realloc() family.
  12109. + *
  12110. + * @param ptr Pointer to the memory block which should be freed.
  12111. + *
  12112. + * @note `ptr = NULL` is explicitly allowed.
  12113. + * @note It is recommended that you use av_freep() instead, to prevent leaving
  12114. + * behind dangling pointers.
  12115. + * @see av_freep()
  12116. + */
  12117. +void av_free(void *ptr);
  12118. +
  12119. +/**
  12120. + * Free a memory block which has been allocated with a function of av_malloc()
  12121. + * or av_realloc() family, and set the pointer pointing to it to `NULL`.
  12122. + *
  12123. + * @code{.c}
  12124. + * uint8_t *buf = av_malloc(16);
  12125. + * av_free(buf);
  12126. + * // buf now contains a dangling pointer to freed memory, and accidental
  12127. + * // dereference of buf will result in a use-after-free, which may be a
  12128. + * // security risk.
  12129. + *
  12130. + * uint8_t *buf = av_malloc(16);
  12131. + * av_freep(&buf);
  12132. + * // buf is now NULL, and accidental dereference will only result in a
  12133. + * // NULL-pointer dereference.
  12134. + * @endcode
  12135. + *
  12136. + * @param ptr Pointer to the pointer to the memory block which should be freed
  12137. + * @note `*ptr = NULL` is safe and leads to no action.
  12138. + * @see av_free()
  12139. + */
  12140. +void av_freep(void *ptr);
  12141. +
  12142. +/**
  12143. + * Duplicate a string.
  12144. + *
  12145. + * @param s String to be duplicated
  12146. + * @return Pointer to a newly-allocated string containing a
  12147. + * copy of `s` or `NULL` if the string cannot be allocated
  12148. + * @see av_strndup()
  12149. + */
  12150. +char *av_strdup(const char *s) av_malloc_attrib;
  12151. +
  12152. +/**
  12153. + * Duplicate a substring of a string.
  12154. + *
  12155. + * @param s String to be duplicated
  12156. + * @param len Maximum length of the resulting string (not counting the
  12157. + * terminating byte)
  12158. + * @return Pointer to a newly-allocated string containing a
  12159. + * substring of `s` or `NULL` if the string cannot be allocated
  12160. + */
  12161. +char *av_strndup(const char *s, size_t len) av_malloc_attrib;
  12162. +
  12163. +/**
  12164. + * Duplicate a buffer with av_malloc().
  12165. + *
  12166. + * @param p Buffer to be duplicated
  12167. + * @param size Size in bytes of the buffer copied
  12168. + * @return Pointer to a newly allocated buffer containing a
  12169. + * copy of `p` or `NULL` if the buffer cannot be allocated
  12170. + */
  12171. +void *av_memdup(const void *p, size_t size);
  12172. +
  12173. +/**
  12174. + * Overlapping memcpy() implementation.
  12175. + *
  12176. + * @param dst Destination buffer
  12177. + * @param back Number of bytes back to start copying (i.e. the initial size of
  12178. + * the overlapping window); must be > 0
  12179. + * @param cnt Number of bytes to copy; must be >= 0
  12180. + *
  12181. + * @note `cnt > back` is valid, this will copy the bytes we just copied,
  12182. + * thus creating a repeating pattern with a period length of `back`.
  12183. + */
  12184. +void av_memcpy_backptr(uint8_t *dst, int back, int cnt);
  12185. +
  12186. +/**
  12187. + * @}
  12188. + */
  12189. +
  12190. +/**
  12191. + * @defgroup lavu_mem_dynarray Dynamic Array
  12192. + *
  12193. + * Utilities to make an array grow when needed.
  12194. + *
  12195. + * Sometimes, the programmer would want to have an array that can grow when
  12196. + * needed. The libavutil dynamic array utilities fill that need.
  12197. + *
  12198. + * libavutil supports two systems of appending elements onto a dynamically
  12199. + * allocated array, the first one storing the pointer to the value in the
  12200. + * array, and the second storing the value directly. In both systems, the
  12201. + * caller is responsible for maintaining a variable containing the length of
  12202. + * the array, as well as freeing of the array after use.
  12203. + *
  12204. + * The first system stores pointers to values in a block of dynamically
  12205. + * allocated memory. Since only pointers are stored, the function does not need
  12206. + * to know the size of the type. Both av_dynarray_add() and
  12207. + * av_dynarray_add_nofree() implement this system.
  12208. + *
  12209. + * @code
  12210. + * type **array = NULL; //< an array of pointers to values
  12211. + * int nb = 0; //< a variable to keep track of the length of the array
  12212. + *
  12213. + * type to_be_added = ...;
  12214. + * type to_be_added2 = ...;
  12215. + *
  12216. + * av_dynarray_add(&array, &nb, &to_be_added);
  12217. + * if (nb == 0)
  12218. + * return AVERROR(ENOMEM);
  12219. + *
  12220. + * av_dynarray_add(&array, &nb, &to_be_added2);
  12221. + * if (nb == 0)
  12222. + * return AVERROR(ENOMEM);
  12223. + *
  12224. + * // Now:
  12225. + * // nb == 2
  12226. + * // &to_be_added == array[0]
  12227. + * // &to_be_added2 == array[1]
  12228. + *
  12229. + * av_freep(&array);
  12230. + * @endcode
  12231. + *
  12232. + * The second system stores the value directly in a block of memory. As a
  12233. + * result, the function has to know the size of the type. av_dynarray2_add()
  12234. + * implements this mechanism.
  12235. + *
  12236. + * @code
  12237. + * type *array = NULL; //< an array of values
  12238. + * int nb = 0; //< a variable to keep track of the length of the array
  12239. + *
  12240. + * type to_be_added = ...;
  12241. + * type to_be_added2 = ...;
  12242. + *
  12243. + * type *addr = av_dynarray2_add((void **)&array, &nb, sizeof(*array), NULL);
  12244. + * if (!addr)
  12245. + * return AVERROR(ENOMEM);
  12246. + * memcpy(addr, &to_be_added, sizeof(to_be_added));
  12247. + *
  12248. + * // Shortcut of the above.
  12249. + * type *addr = av_dynarray2_add((void **)&array, &nb, sizeof(*array),
  12250. + * (const void *)&to_be_added2);
  12251. + * if (!addr)
  12252. + * return AVERROR(ENOMEM);
  12253. + *
  12254. + * // Now:
  12255. + * // nb == 2
  12256. + * // to_be_added == array[0]
  12257. + * // to_be_added2 == array[1]
  12258. + *
  12259. + * av_freep(&array);
  12260. + * @endcode
  12261. + *
  12262. + * @{
  12263. + */
  12264. +
  12265. +/**
  12266. + * Add the pointer to an element to a dynamic array.
  12267. + *
  12268. + * The array to grow is supposed to be an array of pointers to
  12269. + * structures, and the element to add must be a pointer to an already
  12270. + * allocated structure.
  12271. + *
  12272. + * The array is reallocated when its size reaches powers of 2.
  12273. + * Therefore, the amortized cost of adding an element is constant.
  12274. + *
  12275. + * In case of success, the pointer to the array is updated in order to
  12276. + * point to the new grown array, and the number pointed to by `nb_ptr`
  12277. + * is incremented.
  12278. + * In case of failure, the array is freed, `*tab_ptr` is set to `NULL` and
  12279. + * `*nb_ptr` is set to 0.
  12280. + *
  12281. + * @param[in,out] tab_ptr Pointer to the array to grow
  12282. + * @param[in,out] nb_ptr Pointer to the number of elements in the array
  12283. + * @param[in] elem Element to add
  12284. + * @see av_dynarray_add_nofree(), av_dynarray2_add()
  12285. + */
  12286. +void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem);
  12287. +
  12288. +/**
  12289. + * Add an element to a dynamic array.
  12290. + *
  12291. + * Function has the same functionality as av_dynarray_add(),
  12292. + * but it doesn't free memory on fails. It returns error code
  12293. + * instead and leave current buffer untouched.
  12294. + *
  12295. + * @return >=0 on success, negative otherwise
  12296. + * @see av_dynarray_add(), av_dynarray2_add()
  12297. + */
  12298. +av_warn_unused_result
  12299. +int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem);
  12300. +
  12301. +/**
  12302. + * Add an element of size `elem_size` to a dynamic array.
  12303. + *
  12304. + * The array is reallocated when its number of elements reaches powers of 2.
  12305. + * Therefore, the amortized cost of adding an element is constant.
  12306. + *
  12307. + * In case of success, the pointer to the array is updated in order to
  12308. + * point to the new grown array, and the number pointed to by `nb_ptr`
  12309. + * is incremented.
  12310. + * In case of failure, the array is freed, `*tab_ptr` is set to `NULL` and
  12311. + * `*nb_ptr` is set to 0.
  12312. + *
  12313. + * @param[in,out] tab_ptr Pointer to the array to grow
  12314. + * @param[in,out] nb_ptr Pointer to the number of elements in the array
  12315. + * @param[in] elem_size Size in bytes of an element in the array
  12316. + * @param[in] elem_data Pointer to the data of the element to add. If
  12317. + * `NULL`, the space of the newly added element is
  12318. + * allocated but left uninitialized.
  12319. + *
  12320. + * @return Pointer to the data of the element to copy in the newly allocated
  12321. + * space
  12322. + * @see av_dynarray_add(), av_dynarray_add_nofree()
  12323. + */
  12324. +void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size,
  12325. + const uint8_t *elem_data);
  12326. +
  12327. +/**
  12328. + * @}
  12329. + */
  12330. +
  12331. +/**
  12332. + * @defgroup lavu_mem_misc Miscellaneous Functions
  12333. + *
  12334. + * Other functions related to memory allocation.
  12335. + *
  12336. + * @{
  12337. + */
  12338. +
  12339. +/**
  12340. + * Multiply two `size_t` values checking for overflow.
  12341. + *
  12342. + * @param[in] a,b Operands of multiplication
  12343. + * @param[out] r Pointer to the result of the operation
  12344. + * @return 0 on success, AVERROR(EINVAL) on overflow
  12345. + */
  12346. +static inline int av_size_mult(size_t a, size_t b, size_t *r)
  12347. +{
  12348. + size_t t = a * b;
  12349. + /* Hack inspired from glibc: don't try the division if nelem and elsize
  12350. + * are both less than sqrt(SIZE_MAX). */
  12351. + if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b)
  12352. + return AVERROR(EINVAL);
  12353. + *r = t;
  12354. + return 0;
  12355. +}
  12356. +
  12357. +/**
  12358. + * Set the maximum size that may be allocated in one block.
  12359. + *
  12360. + * The value specified with this function is effective for all libavutil's @ref
  12361. + * lavu_mem_funcs "heap management functions."
  12362. + *
  12363. + * By default, the max value is defined as `INT_MAX`.
  12364. + *
  12365. + * @param max Value to be set as the new maximum size
  12366. + *
  12367. + * @warning Exercise extreme caution when using this function. Don't touch
  12368. + * this if you do not understand the full consequence of doing so.
  12369. + */
  12370. +void av_max_alloc(size_t max);
  12371. +
  12372. +/**
  12373. + * @}
  12374. + * @}
  12375. + */
  12376. +
  12377. +#endif /* AVUTIL_MEM_H */
  12378. diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/pixfmt.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/pixfmt.h
  12379. new file mode 100644
  12380. index 000000000000..e184a56672dc
  12381. --- /dev/null
  12382. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/pixfmt.h
  12383. @@ -0,0 +1,529 @@
  12384. +/*
  12385. + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
  12386. + *
  12387. + * This file is part of FFmpeg.
  12388. + *
  12389. + * FFmpeg is free software; you can redistribute it and/or
  12390. + * modify it under the terms of the GNU Lesser General Public
  12391. + * License as published by the Free Software Foundation; either
  12392. + * version 2.1 of the License, or (at your option) any later version.
  12393. + *
  12394. + * FFmpeg is distributed in the hope that it will be useful,
  12395. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12396. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12397. + * Lesser General Public License for more details.
  12398. + *
  12399. + * You should have received a copy of the GNU Lesser General Public
  12400. + * License along with FFmpeg; if not, write to the Free Software
  12401. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  12402. + */
  12403. +
  12404. +#ifndef AVUTIL_PIXFMT_H
  12405. +#define AVUTIL_PIXFMT_H
  12406. +
  12407. +/**
  12408. + * @file
  12409. + * pixel format definitions
  12410. + */
  12411. +
  12412. +#include "libavutil/avconfig.h"
  12413. +#include "version.h"
  12414. +
  12415. +#define AVPALETTE_SIZE 1024
  12416. +#define AVPALETTE_COUNT 256
  12417. +
  12418. +/**
  12419. + * Pixel format.
  12420. + *
  12421. + * @note
  12422. + * AV_PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA
  12423. + * color is put together as:
  12424. + * (A << 24) | (R << 16) | (G << 8) | B
  12425. + * This is stored as BGRA on little-endian CPU architectures and ARGB on
  12426. + * big-endian CPUs.
  12427. + *
  12428. + * @par
  12429. + * When the pixel format is palettized RGB32 (AV_PIX_FMT_PAL8), the palettized
  12430. + * image data is stored in AVFrame.data[0]. The palette is transported in
  12431. + * AVFrame.data[1], is 1024 bytes long (256 4-byte entries) and is
  12432. + * formatted the same as in AV_PIX_FMT_RGB32 described above (i.e., it is
  12433. + * also endian-specific). Note also that the individual RGB32 palette
  12434. + * components stored in AVFrame.data[1] should be in the range 0..255.
  12435. + * This is important as many custom PAL8 video codecs that were designed
  12436. + * to run on the IBM VGA graphics adapter use 6-bit palette components.
  12437. + *
  12438. + * @par
  12439. + * For all the 8 bits per pixel formats, an RGB32 palette is in data[1] like
  12440. + * for pal8. This palette is filled in automatically by the function
  12441. + * allocating the picture.
  12442. + */
  12443. +enum AVPixelFormat {
  12444. + AV_PIX_FMT_NONE = -1,
  12445. + AV_PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
  12446. + AV_PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
  12447. + AV_PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB...
  12448. + AV_PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR...
  12449. + AV_PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
  12450. + AV_PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
  12451. + AV_PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
  12452. + AV_PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
  12453. + AV_PIX_FMT_GRAY8, ///< Y , 8bpp
  12454. + AV_PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb
  12455. + AV_PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb
  12456. + AV_PIX_FMT_PAL8, ///< 8 bits with AV_PIX_FMT_RGB32 palette
  12457. + AV_PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting color_range
  12458. + AV_PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting color_range
  12459. + AV_PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting color_range
  12460. + AV_PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
  12461. + AV_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
  12462. + AV_PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
  12463. + AV_PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
  12464. + AV_PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
  12465. + AV_PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
  12466. + AV_PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
  12467. + AV_PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
  12468. + AV_PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V)
  12469. + AV_PIX_FMT_NV21, ///< as above, but U and V bytes are swapped
  12470. +
  12471. + AV_PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
  12472. + AV_PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
  12473. + AV_PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
  12474. + AV_PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
  12475. +
  12476. + AV_PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian
  12477. + AV_PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian
  12478. + AV_PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
  12479. + AV_PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
  12480. + AV_PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
  12481. + AV_PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian
  12482. + AV_PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian
  12483. +
  12484. + AV_PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
  12485. + AV_PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
  12486. + AV_PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), big-endian , X=unused/undefined
  12487. + AV_PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined
  12488. +
  12489. + AV_PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
  12490. + AV_PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
  12491. + AV_PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined
  12492. + AV_PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined
  12493. +
  12494. +#if FF_API_VAAPI
  12495. + /** @name Deprecated pixel formats */
  12496. + /**@{*/
  12497. + AV_PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers
  12498. + AV_PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers
  12499. + AV_PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a VASurfaceID
  12500. + /**@}*/
  12501. + AV_PIX_FMT_VAAPI = AV_PIX_FMT_VAAPI_VLD,
  12502. +#else
  12503. + /**
  12504. + * Hardware acceleration through VA-API, data[3] contains a
  12505. + * VASurfaceID.
  12506. + */
  12507. + AV_PIX_FMT_VAAPI,
  12508. +#endif
  12509. +
  12510. + AV_PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
  12511. + AV_PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
  12512. + AV_PIX_FMT_YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
  12513. + AV_PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
  12514. + AV_PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
  12515. + AV_PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
  12516. + AV_PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer
  12517. +
  12518. + AV_PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), little-endian, X=unused/undefined
  12519. + AV_PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), big-endian, X=unused/undefined
  12520. + AV_PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), little-endian, X=unused/undefined
  12521. + AV_PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), big-endian, X=unused/undefined
  12522. + AV_PIX_FMT_YA8, ///< 8 bits gray, 8 bits alpha
  12523. +
  12524. + AV_PIX_FMT_Y400A = AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8
  12525. + AV_PIX_FMT_GRAY8A= AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8
  12526. +
  12527. + AV_PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian
  12528. + AV_PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian
  12529. +
  12530. + /**
  12531. + * The following 12 formats have the disadvantage of needing 1 format for each bit depth.
  12532. + * Notice that each 9/10 bits sample is stored in 16 bits with extra padding.
  12533. + * If you want to support multiple bit depths, then using AV_PIX_FMT_YUV420P16* with the bpp stored separately is better.
  12534. + */
  12535. + AV_PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
  12536. + AV_PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
  12537. + AV_PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
  12538. + AV_PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
  12539. + AV_PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
  12540. + AV_PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
  12541. + AV_PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
  12542. + AV_PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
  12543. + AV_PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
  12544. + AV_PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
  12545. + AV_PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
  12546. + AV_PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
  12547. + AV_PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp
  12548. + AV_PIX_FMT_GBR24P = AV_PIX_FMT_GBRP, // alias for #AV_PIX_FMT_GBRP
  12549. + AV_PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big-endian
  12550. + AV_PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little-endian
  12551. + AV_PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big-endian
  12552. + AV_PIX_FMT_GBRP10LE, ///< planar GBR 4:4:4 30bpp, little-endian
  12553. + AV_PIX_FMT_GBRP16BE, ///< planar GBR 4:4:4 48bpp, big-endian
  12554. + AV_PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little-endian
  12555. + AV_PIX_FMT_YUVA422P, ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
  12556. + AV_PIX_FMT_YUVA444P, ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
  12557. + AV_PIX_FMT_YUVA420P9BE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian
  12558. + AV_PIX_FMT_YUVA420P9LE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian
  12559. + AV_PIX_FMT_YUVA422P9BE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian
  12560. + AV_PIX_FMT_YUVA422P9LE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian
  12561. + AV_PIX_FMT_YUVA444P9BE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
  12562. + AV_PIX_FMT_YUVA444P9LE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
  12563. + AV_PIX_FMT_YUVA420P10BE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
  12564. + AV_PIX_FMT_YUVA420P10LE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
  12565. + AV_PIX_FMT_YUVA422P10BE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
  12566. + AV_PIX_FMT_YUVA422P10LE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
  12567. + AV_PIX_FMT_YUVA444P10BE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
  12568. + AV_PIX_FMT_YUVA444P10LE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
  12569. + AV_PIX_FMT_YUVA420P16BE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
  12570. + AV_PIX_FMT_YUVA420P16LE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
  12571. + AV_PIX_FMT_YUVA422P16BE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
  12572. + AV_PIX_FMT_YUVA422P16LE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
  12573. + AV_PIX_FMT_YUVA444P16BE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
  12574. + AV_PIX_FMT_YUVA444P16LE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
  12575. +
  12576. + AV_PIX_FMT_VDPAU, ///< HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface
  12577. +
  12578. + AV_PIX_FMT_XYZ12LE, ///< packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as little-endian, the 4 lower bits are set to 0
  12579. + AV_PIX_FMT_XYZ12BE, ///< packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as big-endian, the 4 lower bits are set to 0
  12580. + AV_PIX_FMT_NV16, ///< interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
  12581. + AV_PIX_FMT_NV20LE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
  12582. + AV_PIX_FMT_NV20BE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
  12583. +
  12584. + AV_PIX_FMT_RGBA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian
  12585. + AV_PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian
  12586. + AV_PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian
  12587. + AV_PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian
  12588. +
  12589. + AV_PIX_FMT_YVYU422, ///< packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb
  12590. +
  12591. + AV_PIX_FMT_YA16BE, ///< 16 bits gray, 16 bits alpha (big-endian)
  12592. + AV_PIX_FMT_YA16LE, ///< 16 bits gray, 16 bits alpha (little-endian)
  12593. +
  12594. + AV_PIX_FMT_GBRAP, ///< planar GBRA 4:4:4:4 32bpp
  12595. + AV_PIX_FMT_GBRAP16BE, ///< planar GBRA 4:4:4:4 64bpp, big-endian
  12596. + AV_PIX_FMT_GBRAP16LE, ///< planar GBRA 4:4:4:4 64bpp, little-endian
  12597. + /**
  12598. + * HW acceleration through QSV, data[3] contains a pointer to the
  12599. + * mfxFrameSurface1 structure.
  12600. + */
  12601. + AV_PIX_FMT_QSV,
  12602. + /**
  12603. + * HW acceleration though MMAL, data[3] contains a pointer to the
  12604. + * MMAL_BUFFER_HEADER_T structure.
  12605. + */
  12606. + AV_PIX_FMT_MMAL,
  12607. +
  12608. + AV_PIX_FMT_D3D11VA_VLD, ///< HW decoding through Direct3D11 via old API, Picture.data[3] contains a ID3D11VideoDecoderOutputView pointer
  12609. +
  12610. + /**
  12611. + * HW acceleration through CUDA. data[i] contain CUdeviceptr pointers
  12612. + * exactly as for system memory frames.
  12613. + */
  12614. + AV_PIX_FMT_CUDA,
  12615. +
  12616. + AV_PIX_FMT_0RGB, ///< packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
  12617. + AV_PIX_FMT_RGB0, ///< packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
  12618. + AV_PIX_FMT_0BGR, ///< packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
  12619. + AV_PIX_FMT_BGR0, ///< packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
  12620. +
  12621. + AV_PIX_FMT_YUV420P12BE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
  12622. + AV_PIX_FMT_YUV420P12LE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
  12623. + AV_PIX_FMT_YUV420P14BE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
  12624. + AV_PIX_FMT_YUV420P14LE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
  12625. + AV_PIX_FMT_YUV422P12BE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
  12626. + AV_PIX_FMT_YUV422P12LE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
  12627. + AV_PIX_FMT_YUV422P14BE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
  12628. + AV_PIX_FMT_YUV422P14LE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
  12629. + AV_PIX_FMT_YUV444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
  12630. + AV_PIX_FMT_YUV444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
  12631. + AV_PIX_FMT_YUV444P14BE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
  12632. + AV_PIX_FMT_YUV444P14LE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
  12633. + AV_PIX_FMT_GBRP12BE, ///< planar GBR 4:4:4 36bpp, big-endian
  12634. + AV_PIX_FMT_GBRP12LE, ///< planar GBR 4:4:4 36bpp, little-endian
  12635. + AV_PIX_FMT_GBRP14BE, ///< planar GBR 4:4:4 42bpp, big-endian
  12636. + AV_PIX_FMT_GBRP14LE, ///< planar GBR 4:4:4 42bpp, little-endian
  12637. + AV_PIX_FMT_YUVJ411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV411P and setting color_range
  12638. +
  12639. + AV_PIX_FMT_BAYER_BGGR8, ///< bayer, BGBG..(odd line), GRGR..(even line), 8-bit samples */
  12640. + AV_PIX_FMT_BAYER_RGGB8, ///< bayer, RGRG..(odd line), GBGB..(even line), 8-bit samples */
  12641. + AV_PIX_FMT_BAYER_GBRG8, ///< bayer, GBGB..(odd line), RGRG..(even line), 8-bit samples */
  12642. + AV_PIX_FMT_BAYER_GRBG8, ///< bayer, GRGR..(odd line), BGBG..(even line), 8-bit samples */
  12643. + AV_PIX_FMT_BAYER_BGGR16LE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, little-endian */
  12644. + AV_PIX_FMT_BAYER_BGGR16BE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, big-endian */
  12645. + AV_PIX_FMT_BAYER_RGGB16LE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, little-endian */
  12646. + AV_PIX_FMT_BAYER_RGGB16BE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, big-endian */
  12647. + AV_PIX_FMT_BAYER_GBRG16LE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, little-endian */
  12648. + AV_PIX_FMT_BAYER_GBRG16BE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, big-endian */
  12649. + AV_PIX_FMT_BAYER_GRBG16LE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian */
  12650. + AV_PIX_FMT_BAYER_GRBG16BE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian */
  12651. +
  12652. + AV_PIX_FMT_XVMC,///< XVideo Motion Acceleration via common packet passing
  12653. +
  12654. + AV_PIX_FMT_YUV440P10LE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
  12655. + AV_PIX_FMT_YUV440P10BE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
  12656. + AV_PIX_FMT_YUV440P12LE, ///< planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
  12657. + AV_PIX_FMT_YUV440P12BE, ///< planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
  12658. + AV_PIX_FMT_AYUV64LE, ///< packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
  12659. + AV_PIX_FMT_AYUV64BE, ///< packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
  12660. +
  12661. + AV_PIX_FMT_VIDEOTOOLBOX, ///< hardware decoding through Videotoolbox
  12662. +
  12663. + AV_PIX_FMT_P010LE, ///< like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, little-endian
  12664. + AV_PIX_FMT_P010BE, ///< like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, big-endian
  12665. +
  12666. + AV_PIX_FMT_GBRAP12BE, ///< planar GBR 4:4:4:4 48bpp, big-endian
  12667. + AV_PIX_FMT_GBRAP12LE, ///< planar GBR 4:4:4:4 48bpp, little-endian
  12668. +
  12669. + AV_PIX_FMT_GBRAP10BE, ///< planar GBR 4:4:4:4 40bpp, big-endian
  12670. + AV_PIX_FMT_GBRAP10LE, ///< planar GBR 4:4:4:4 40bpp, little-endian
  12671. +
  12672. + AV_PIX_FMT_MEDIACODEC, ///< hardware decoding through MediaCodec
  12673. +
  12674. + AV_PIX_FMT_GRAY12BE, ///< Y , 12bpp, big-endian
  12675. + AV_PIX_FMT_GRAY12LE, ///< Y , 12bpp, little-endian
  12676. + AV_PIX_FMT_GRAY10BE, ///< Y , 10bpp, big-endian
  12677. + AV_PIX_FMT_GRAY10LE, ///< Y , 10bpp, little-endian
  12678. +
  12679. + AV_PIX_FMT_P016LE, ///< like NV12, with 16bpp per component, little-endian
  12680. + AV_PIX_FMT_P016BE, ///< like NV12, with 16bpp per component, big-endian
  12681. +
  12682. + /**
  12683. + * Hardware surfaces for Direct3D11.
  12684. + *
  12685. + * This is preferred over the legacy AV_PIX_FMT_D3D11VA_VLD. The new D3D11
  12686. + * hwaccel API and filtering support AV_PIX_FMT_D3D11 only.
  12687. + *
  12688. + * data[0] contains a ID3D11Texture2D pointer, and data[1] contains the
  12689. + * texture array index of the frame as intptr_t if the ID3D11Texture2D is
  12690. + * an array texture (or always 0 if it's a normal texture).
  12691. + */
  12692. + AV_PIX_FMT_D3D11,
  12693. +
  12694. + AV_PIX_FMT_GRAY9BE, ///< Y , 9bpp, big-endian
  12695. + AV_PIX_FMT_GRAY9LE, ///< Y , 9bpp, little-endian
  12696. +
  12697. + AV_PIX_FMT_GBRPF32BE, ///< IEEE-754 single precision planar GBR 4:4:4, 96bpp, big-endian
  12698. + AV_PIX_FMT_GBRPF32LE, ///< IEEE-754 single precision planar GBR 4:4:4, 96bpp, little-endian
  12699. + AV_PIX_FMT_GBRAPF32BE, ///< IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, big-endian
  12700. + AV_PIX_FMT_GBRAPF32LE, ///< IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, little-endian
  12701. +
  12702. + /**
  12703. + * DRM-managed buffers exposed through PRIME buffer sharing.
  12704. + *
  12705. + * data[0] points to an AVDRMFrameDescriptor.
  12706. + */
  12707. + AV_PIX_FMT_DRM_PRIME,
  12708. + /**
  12709. + * Hardware surfaces for OpenCL.
  12710. + *
  12711. + * data[i] contain 2D image objects (typed in C as cl_mem, used
  12712. + * in OpenCL as image2d_t) for each plane of the surface.
  12713. + */
  12714. + AV_PIX_FMT_OPENCL,
  12715. +
  12716. + AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
  12717. +};
  12718. +
  12719. +#if AV_HAVE_BIGENDIAN
  12720. +# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##be
  12721. +#else
  12722. +# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##le
  12723. +#endif
  12724. +
  12725. +#define AV_PIX_FMT_RGB32 AV_PIX_FMT_NE(ARGB, BGRA)
  12726. +#define AV_PIX_FMT_RGB32_1 AV_PIX_FMT_NE(RGBA, ABGR)
  12727. +#define AV_PIX_FMT_BGR32 AV_PIX_FMT_NE(ABGR, RGBA)
  12728. +#define AV_PIX_FMT_BGR32_1 AV_PIX_FMT_NE(BGRA, ARGB)
  12729. +#define AV_PIX_FMT_0RGB32 AV_PIX_FMT_NE(0RGB, BGR0)
  12730. +#define AV_PIX_FMT_0BGR32 AV_PIX_FMT_NE(0BGR, RGB0)
  12731. +
  12732. +#define AV_PIX_FMT_GRAY9 AV_PIX_FMT_NE(GRAY9BE, GRAY9LE)
  12733. +#define AV_PIX_FMT_GRAY10 AV_PIX_FMT_NE(GRAY10BE, GRAY10LE)
  12734. +#define AV_PIX_FMT_GRAY12 AV_PIX_FMT_NE(GRAY12BE, GRAY12LE)
  12735. +#define AV_PIX_FMT_GRAY16 AV_PIX_FMT_NE(GRAY16BE, GRAY16LE)
  12736. +#define AV_PIX_FMT_YA16 AV_PIX_FMT_NE(YA16BE, YA16LE)
  12737. +#define AV_PIX_FMT_RGB48 AV_PIX_FMT_NE(RGB48BE, RGB48LE)
  12738. +#define AV_PIX_FMT_RGB565 AV_PIX_FMT_NE(RGB565BE, RGB565LE)
  12739. +#define AV_PIX_FMT_RGB555 AV_PIX_FMT_NE(RGB555BE, RGB555LE)
  12740. +#define AV_PIX_FMT_RGB444 AV_PIX_FMT_NE(RGB444BE, RGB444LE)
  12741. +#define AV_PIX_FMT_RGBA64 AV_PIX_FMT_NE(RGBA64BE, RGBA64LE)
  12742. +#define AV_PIX_FMT_BGR48 AV_PIX_FMT_NE(BGR48BE, BGR48LE)
  12743. +#define AV_PIX_FMT_BGR565 AV_PIX_FMT_NE(BGR565BE, BGR565LE)
  12744. +#define AV_PIX_FMT_BGR555 AV_PIX_FMT_NE(BGR555BE, BGR555LE)
  12745. +#define AV_PIX_FMT_BGR444 AV_PIX_FMT_NE(BGR444BE, BGR444LE)
  12746. +#define AV_PIX_FMT_BGRA64 AV_PIX_FMT_NE(BGRA64BE, BGRA64LE)
  12747. +
  12748. +#define AV_PIX_FMT_YUV420P9 AV_PIX_FMT_NE(YUV420P9BE , YUV420P9LE)
  12749. +#define AV_PIX_FMT_YUV422P9 AV_PIX_FMT_NE(YUV422P9BE , YUV422P9LE)
  12750. +#define AV_PIX_FMT_YUV444P9 AV_PIX_FMT_NE(YUV444P9BE , YUV444P9LE)
  12751. +#define AV_PIX_FMT_YUV420P10 AV_PIX_FMT_NE(YUV420P10BE, YUV420P10LE)
  12752. +#define AV_PIX_FMT_YUV422P10 AV_PIX_FMT_NE(YUV422P10BE, YUV422P10LE)
  12753. +#define AV_PIX_FMT_YUV440P10 AV_PIX_FMT_NE(YUV440P10BE, YUV440P10LE)
  12754. +#define AV_PIX_FMT_YUV444P10 AV_PIX_FMT_NE(YUV444P10BE, YUV444P10LE)
  12755. +#define AV_PIX_FMT_YUV420P12 AV_PIX_FMT_NE(YUV420P12BE, YUV420P12LE)
  12756. +#define AV_PIX_FMT_YUV422P12 AV_PIX_FMT_NE(YUV422P12BE, YUV422P12LE)
  12757. +#define AV_PIX_FMT_YUV440P12 AV_PIX_FMT_NE(YUV440P12BE, YUV440P12LE)
  12758. +#define AV_PIX_FMT_YUV444P12 AV_PIX_FMT_NE(YUV444P12BE, YUV444P12LE)
  12759. +#define AV_PIX_FMT_YUV420P14 AV_PIX_FMT_NE(YUV420P14BE, YUV420P14LE)
  12760. +#define AV_PIX_FMT_YUV422P14 AV_PIX_FMT_NE(YUV422P14BE, YUV422P14LE)
  12761. +#define AV_PIX_FMT_YUV444P14 AV_PIX_FMT_NE(YUV444P14BE, YUV444P14LE)
  12762. +#define AV_PIX_FMT_YUV420P16 AV_PIX_FMT_NE(YUV420P16BE, YUV420P16LE)
  12763. +#define AV_PIX_FMT_YUV422P16 AV_PIX_FMT_NE(YUV422P16BE, YUV422P16LE)
  12764. +#define AV_PIX_FMT_YUV444P16 AV_PIX_FMT_NE(YUV444P16BE, YUV444P16LE)
  12765. +
  12766. +#define AV_PIX_FMT_GBRP9 AV_PIX_FMT_NE(GBRP9BE , GBRP9LE)
  12767. +#define AV_PIX_FMT_GBRP10 AV_PIX_FMT_NE(GBRP10BE, GBRP10LE)
  12768. +#define AV_PIX_FMT_GBRP12 AV_PIX_FMT_NE(GBRP12BE, GBRP12LE)
  12769. +#define AV_PIX_FMT_GBRP14 AV_PIX_FMT_NE(GBRP14BE, GBRP14LE)
  12770. +#define AV_PIX_FMT_GBRP16 AV_PIX_FMT_NE(GBRP16BE, GBRP16LE)
  12771. +#define AV_PIX_FMT_GBRAP10 AV_PIX_FMT_NE(GBRAP10BE, GBRAP10LE)
  12772. +#define AV_PIX_FMT_GBRAP12 AV_PIX_FMT_NE(GBRAP12BE, GBRAP12LE)
  12773. +#define AV_PIX_FMT_GBRAP16 AV_PIX_FMT_NE(GBRAP16BE, GBRAP16LE)
  12774. +
  12775. +#define AV_PIX_FMT_BAYER_BGGR16 AV_PIX_FMT_NE(BAYER_BGGR16BE, BAYER_BGGR16LE)
  12776. +#define AV_PIX_FMT_BAYER_RGGB16 AV_PIX_FMT_NE(BAYER_RGGB16BE, BAYER_RGGB16LE)
  12777. +#define AV_PIX_FMT_BAYER_GBRG16 AV_PIX_FMT_NE(BAYER_GBRG16BE, BAYER_GBRG16LE)
  12778. +#define AV_PIX_FMT_BAYER_GRBG16 AV_PIX_FMT_NE(BAYER_GRBG16BE, BAYER_GRBG16LE)
  12779. +
  12780. +#define AV_PIX_FMT_GBRPF32 AV_PIX_FMT_NE(GBRPF32BE, GBRPF32LE)
  12781. +#define AV_PIX_FMT_GBRAPF32 AV_PIX_FMT_NE(GBRAPF32BE, GBRAPF32LE)
  12782. +
  12783. +#define AV_PIX_FMT_YUVA420P9 AV_PIX_FMT_NE(YUVA420P9BE , YUVA420P9LE)
  12784. +#define AV_PIX_FMT_YUVA422P9 AV_PIX_FMT_NE(YUVA422P9BE , YUVA422P9LE)
  12785. +#define AV_PIX_FMT_YUVA444P9 AV_PIX_FMT_NE(YUVA444P9BE , YUVA444P9LE)
  12786. +#define AV_PIX_FMT_YUVA420P10 AV_PIX_FMT_NE(YUVA420P10BE, YUVA420P10LE)
  12787. +#define AV_PIX_FMT_YUVA422P10 AV_PIX_FMT_NE(YUVA422P10BE, YUVA422P10LE)
  12788. +#define AV_PIX_FMT_YUVA444P10 AV_PIX_FMT_NE(YUVA444P10BE, YUVA444P10LE)
  12789. +#define AV_PIX_FMT_YUVA420P16 AV_PIX_FMT_NE(YUVA420P16BE, YUVA420P16LE)
  12790. +#define AV_PIX_FMT_YUVA422P16 AV_PIX_FMT_NE(YUVA422P16BE, YUVA422P16LE)
  12791. +#define AV_PIX_FMT_YUVA444P16 AV_PIX_FMT_NE(YUVA444P16BE, YUVA444P16LE)
  12792. +
  12793. +#define AV_PIX_FMT_XYZ12 AV_PIX_FMT_NE(XYZ12BE, XYZ12LE)
  12794. +#define AV_PIX_FMT_NV20 AV_PIX_FMT_NE(NV20BE, NV20LE)
  12795. +#define AV_PIX_FMT_AYUV64 AV_PIX_FMT_NE(AYUV64BE, AYUV64LE)
  12796. +#define AV_PIX_FMT_P010 AV_PIX_FMT_NE(P010BE, P010LE)
  12797. +#define AV_PIX_FMT_P016 AV_PIX_FMT_NE(P016BE, P016LE)
  12798. +
  12799. +/**
  12800. + * Chromaticity coordinates of the source primaries.
  12801. + * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.1.
  12802. + */
  12803. +enum AVColorPrimaries {
  12804. + AVCOL_PRI_RESERVED0 = 0,
  12805. + AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
  12806. + AVCOL_PRI_UNSPECIFIED = 2,
  12807. + AVCOL_PRI_RESERVED = 3,
  12808. + AVCOL_PRI_BT470M = 4, ///< also FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
  12809. +
  12810. + AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
  12811. + AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
  12812. + AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above
  12813. + AVCOL_PRI_FILM = 8, ///< colour filters using Illuminant C
  12814. + AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020
  12815. + AVCOL_PRI_SMPTE428 = 10, ///< SMPTE ST 428-1 (CIE 1931 XYZ)
  12816. + AVCOL_PRI_SMPTEST428_1 = AVCOL_PRI_SMPTE428,
  12817. + AVCOL_PRI_SMPTE431 = 11, ///< SMPTE ST 431-2 (2011) / DCI P3
  12818. + AVCOL_PRI_SMPTE432 = 12, ///< SMPTE ST 432-1 (2010) / P3 D65 / Display P3
  12819. + AVCOL_PRI_JEDEC_P22 = 22, ///< JEDEC P22 phosphors
  12820. + AVCOL_PRI_NB ///< Not part of ABI
  12821. +};
  12822. +
  12823. +/**
  12824. + * Color Transfer Characteristic.
  12825. + * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.2.
  12826. + */
  12827. +enum AVColorTransferCharacteristic {
  12828. + AVCOL_TRC_RESERVED0 = 0,
  12829. + AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361
  12830. + AVCOL_TRC_UNSPECIFIED = 2,
  12831. + AVCOL_TRC_RESERVED = 3,
  12832. + AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
  12833. + AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG
  12834. + AVCOL_TRC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
  12835. + AVCOL_TRC_SMPTE240M = 7,
  12836. + AVCOL_TRC_LINEAR = 8, ///< "Linear transfer characteristics"
  12837. + AVCOL_TRC_LOG = 9, ///< "Logarithmic transfer characteristic (100:1 range)"
  12838. + AVCOL_TRC_LOG_SQRT = 10, ///< "Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)"
  12839. + AVCOL_TRC_IEC61966_2_4 = 11, ///< IEC 61966-2-4
  12840. + AVCOL_TRC_BT1361_ECG = 12, ///< ITU-R BT1361 Extended Colour Gamut
  12841. + AVCOL_TRC_IEC61966_2_1 = 13, ///< IEC 61966-2-1 (sRGB or sYCC)
  12842. + AVCOL_TRC_BT2020_10 = 14, ///< ITU-R BT2020 for 10-bit system
  12843. + AVCOL_TRC_BT2020_12 = 15, ///< ITU-R BT2020 for 12-bit system
  12844. + AVCOL_TRC_SMPTE2084 = 16, ///< SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems
  12845. + AVCOL_TRC_SMPTEST2084 = AVCOL_TRC_SMPTE2084,
  12846. + AVCOL_TRC_SMPTE428 = 17, ///< SMPTE ST 428-1
  12847. + AVCOL_TRC_SMPTEST428_1 = AVCOL_TRC_SMPTE428,
  12848. + AVCOL_TRC_ARIB_STD_B67 = 18, ///< ARIB STD-B67, known as "Hybrid log-gamma"
  12849. + AVCOL_TRC_NB ///< Not part of ABI
  12850. +};
  12851. +
  12852. +/**
  12853. + * YUV colorspace type.
  12854. + * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.3.
  12855. + */
  12856. +enum AVColorSpace {
  12857. + AVCOL_SPC_RGB = 0, ///< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
  12858. + AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
  12859. + AVCOL_SPC_UNSPECIFIED = 2,
  12860. + AVCOL_SPC_RESERVED = 3,
  12861. + AVCOL_SPC_FCC = 4, ///< FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
  12862. + AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
  12863. + AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
  12864. + AVCOL_SPC_SMPTE240M = 7, ///< functionally identical to above
  12865. + AVCOL_SPC_YCGCO = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
  12866. + AVCOL_SPC_YCOCG = AVCOL_SPC_YCGCO,
  12867. + AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system
  12868. + AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system
  12869. + AVCOL_SPC_SMPTE2085 = 11, ///< SMPTE 2085, Y'D'zD'x
  12870. + AVCOL_SPC_CHROMA_DERIVED_NCL = 12, ///< Chromaticity-derived non-constant luminance system
  12871. + AVCOL_SPC_CHROMA_DERIVED_CL = 13, ///< Chromaticity-derived constant luminance system
  12872. + AVCOL_SPC_ICTCP = 14, ///< ITU-R BT.2100-0, ICtCp
  12873. + AVCOL_SPC_NB ///< Not part of ABI
  12874. +};
  12875. +
  12876. +/**
  12877. + * MPEG vs JPEG YUV range.
  12878. + */
  12879. +enum AVColorRange {
  12880. + AVCOL_RANGE_UNSPECIFIED = 0,
  12881. + AVCOL_RANGE_MPEG = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges
  12882. + AVCOL_RANGE_JPEG = 2, ///< the normal 2^n-1 "JPEG" YUV ranges
  12883. + AVCOL_RANGE_NB ///< Not part of ABI
  12884. +};
  12885. +
  12886. +/**
  12887. + * Location of chroma samples.
  12888. + *
  12889. + * Illustration showing the location of the first (top left) chroma sample of the
  12890. + * image, the left shows only luma, the right
  12891. + * shows the location of the chroma sample, the 2 could be imagined to overlay
  12892. + * each other but are drawn separately due to limitations of ASCII
  12893. + *
  12894. + * 1st 2nd 1st 2nd horizontal luma sample positions
  12895. + * v v v v
  12896. + * ______ ______
  12897. + *1st luma line > |X X ... |3 4 X ... X are luma samples,
  12898. + * | |1 2 1-6 are possible chroma positions
  12899. + *2nd luma line > |X X ... |5 6 X ... 0 is undefined/unknown position
  12900. + */
  12901. +enum AVChromaLocation {
  12902. + AVCHROMA_LOC_UNSPECIFIED = 0,
  12903. + AVCHROMA_LOC_LEFT = 1, ///< MPEG-2/4 4:2:0, H.264 default for 4:2:0
  12904. + AVCHROMA_LOC_CENTER = 2, ///< MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0
  12905. + AVCHROMA_LOC_TOPLEFT = 3, ///< ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2
  12906. + AVCHROMA_LOC_TOP = 4,
  12907. + AVCHROMA_LOC_BOTTOMLEFT = 5,
  12908. + AVCHROMA_LOC_BOTTOM = 6,
  12909. + AVCHROMA_LOC_NB ///< Not part of ABI
  12910. +};
  12911. +
  12912. +#endif /* AVUTIL_PIXFMT_H */
  12913. diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/rational.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/rational.h
  12914. new file mode 100644
  12915. index 000000000000..5c6b67b4e9f8
  12916. --- /dev/null
  12917. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/rational.h
  12918. @@ -0,0 +1,214 @@
  12919. +/*
  12920. + * rational numbers
  12921. + * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
  12922. + *
  12923. + * This file is part of FFmpeg.
  12924. + *
  12925. + * FFmpeg is free software; you can redistribute it and/or
  12926. + * modify it under the terms of the GNU Lesser General Public
  12927. + * License as published by the Free Software Foundation; either
  12928. + * version 2.1 of the License, or (at your option) any later version.
  12929. + *
  12930. + * FFmpeg is distributed in the hope that it will be useful,
  12931. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12932. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12933. + * Lesser General Public License for more details.
  12934. + *
  12935. + * You should have received a copy of the GNU Lesser General Public
  12936. + * License along with FFmpeg; if not, write to the Free Software
  12937. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  12938. + */
  12939. +
  12940. +/**
  12941. + * @file
  12942. + * @ingroup lavu_math_rational
  12943. + * Utilties for rational number calculation.
  12944. + * @author Michael Niedermayer <michaelni@gmx.at>
  12945. + */
  12946. +
  12947. +#ifndef AVUTIL_RATIONAL_H
  12948. +#define AVUTIL_RATIONAL_H
  12949. +
  12950. +#include <stdint.h>
  12951. +#include <limits.h>
  12952. +#include "attributes.h"
  12953. +
  12954. +/**
  12955. + * @defgroup lavu_math_rational AVRational
  12956. + * @ingroup lavu_math
  12957. + * Rational number calculation.
  12958. + *
  12959. + * While rational numbers can be expressed as floating-point numbers, the
  12960. + * conversion process is a lossy one, so are floating-point operations. On the
  12961. + * other hand, the nature of FFmpeg demands highly accurate calculation of
  12962. + * timestamps. This set of rational number utilities serves as a generic
  12963. + * interface for manipulating rational numbers as pairs of numerators and
  12964. + * denominators.
  12965. + *
  12966. + * Many of the functions that operate on AVRational's have the suffix `_q`, in
  12967. + * reference to the mathematical symbol "ℚ" (Q) which denotes the set of all
  12968. + * rational numbers.
  12969. + *
  12970. + * @{
  12971. + */
  12972. +
  12973. +/**
  12974. + * Rational number (pair of numerator and denominator).
  12975. + */
  12976. +typedef struct AVRational{
  12977. + int num; ///< Numerator
  12978. + int den; ///< Denominator
  12979. +} AVRational;
  12980. +
  12981. +/**
  12982. + * Create an AVRational.
  12983. + *
  12984. + * Useful for compilers that do not support compound literals.
  12985. + *
  12986. + * @note The return value is not reduced.
  12987. + * @see av_reduce()
  12988. + */
  12989. +static inline AVRational av_make_q(int num, int den)
  12990. +{
  12991. + AVRational r = { num, den };
  12992. + return r;
  12993. +}
  12994. +
  12995. +/**
  12996. + * Compare two rationals.
  12997. + *
  12998. + * @param a First rational
  12999. + * @param b Second rational
  13000. + *
  13001. + * @return One of the following values:
  13002. + * - 0 if `a == b`
  13003. + * - 1 if `a > b`
  13004. + * - -1 if `a < b`
  13005. + * - `INT_MIN` if one of the values is of the form `0 / 0`
  13006. + */
  13007. +static inline int av_cmp_q(AVRational a, AVRational b){
  13008. + const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den;
  13009. +
  13010. + if(tmp) return (int)((tmp ^ a.den ^ b.den)>>63)|1;
  13011. + else if(b.den && a.den) return 0;
  13012. + else if(a.num && b.num) return (a.num>>31) - (b.num>>31);
  13013. + else return INT_MIN;
  13014. +}
  13015. +
  13016. +/**
  13017. + * Convert an AVRational to a `double`.
  13018. + * @param a AVRational to convert
  13019. + * @return `a` in floating-point form
  13020. + * @see av_d2q()
  13021. + */
  13022. +static inline double av_q2d(AVRational a){
  13023. + return a.num / (double) a.den;
  13024. +}
  13025. +
  13026. +/**
  13027. + * Reduce a fraction.
  13028. + *
  13029. + * This is useful for framerate calculations.
  13030. + *
  13031. + * @param[out] dst_num Destination numerator
  13032. + * @param[out] dst_den Destination denominator
  13033. + * @param[in] num Source numerator
  13034. + * @param[in] den Source denominator
  13035. + * @param[in] max Maximum allowed values for `dst_num` & `dst_den`
  13036. + * @return 1 if the operation is exact, 0 otherwise
  13037. + */
  13038. +int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max);
  13039. +
  13040. +/**
  13041. + * Multiply two rationals.
  13042. + * @param b First rational
  13043. + * @param c Second rational
  13044. + * @return b*c
  13045. + */
  13046. +AVRational av_mul_q(AVRational b, AVRational c) av_const;
  13047. +
  13048. +/**
  13049. + * Divide one rational by another.
  13050. + * @param b First rational
  13051. + * @param c Second rational
  13052. + * @return b/c
  13053. + */
  13054. +AVRational av_div_q(AVRational b, AVRational c) av_const;
  13055. +
  13056. +/**
  13057. + * Add two rationals.
  13058. + * @param b First rational
  13059. + * @param c Second rational
  13060. + * @return b+c
  13061. + */
  13062. +AVRational av_add_q(AVRational b, AVRational c) av_const;
  13063. +
  13064. +/**
  13065. + * Subtract one rational from another.
  13066. + * @param b First rational
  13067. + * @param c Second rational
  13068. + * @return b-c
  13069. + */
  13070. +AVRational av_sub_q(AVRational b, AVRational c) av_const;
  13071. +
  13072. +/**
  13073. + * Invert a rational.
  13074. + * @param q value
  13075. + * @return 1 / q
  13076. + */
  13077. +static av_always_inline AVRational av_inv_q(AVRational q)
  13078. +{
  13079. + AVRational r = { q.den, q.num };
  13080. + return r;
  13081. +}
  13082. +
  13083. +/**
  13084. + * Convert a double precision floating point number to a rational.
  13085. + *
  13086. + * In case of infinity, the returned value is expressed as `{1, 0}` or
  13087. + * `{-1, 0}` depending on the sign.
  13088. + *
  13089. + * @param d `double` to convert
  13090. + * @param max Maximum allowed numerator and denominator
  13091. + * @return `d` in AVRational form
  13092. + * @see av_q2d()
  13093. + */
  13094. +AVRational av_d2q(double d, int max) av_const;
  13095. +
  13096. +/**
  13097. + * Find which of the two rationals is closer to another rational.
  13098. + *
  13099. + * @param q Rational to be compared against
  13100. + * @param q1,q2 Rationals to be tested
  13101. + * @return One of the following values:
  13102. + * - 1 if `q1` is nearer to `q` than `q2`
  13103. + * - -1 if `q2` is nearer to `q` than `q1`
  13104. + * - 0 if they have the same distance
  13105. + */
  13106. +int av_nearer_q(AVRational q, AVRational q1, AVRational q2);
  13107. +
  13108. +/**
  13109. + * Find the value in a list of rationals nearest a given reference rational.
  13110. + *
  13111. + * @param q Reference rational
  13112. + * @param q_list Array of rationals terminated by `{0, 0}`
  13113. + * @return Index of the nearest value found in the array
  13114. + */
  13115. +int av_find_nearest_q_idx(AVRational q, const AVRational* q_list);
  13116. +
  13117. +/**
  13118. + * Convert an AVRational to a IEEE 32-bit `float` expressed in fixed-point
  13119. + * format.
  13120. + *
  13121. + * @param q Rational to be converted
  13122. + * @return Equivalent floating-point value, expressed as an unsigned 32-bit
  13123. + * integer.
  13124. + * @note The returned value is platform-indepedant.
  13125. + */
  13126. +uint32_t av_q2intfloat(AVRational q);
  13127. +
  13128. +/**
  13129. + * @}
  13130. + */
  13131. +
  13132. +#endif /* AVUTIL_RATIONAL_H */
  13133. diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/samplefmt.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/samplefmt.h
  13134. new file mode 100644
  13135. index 000000000000..8cd43ae8568a
  13136. --- /dev/null
  13137. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/samplefmt.h
  13138. @@ -0,0 +1,272 @@
  13139. +/*
  13140. + * This file is part of FFmpeg.
  13141. + *
  13142. + * FFmpeg is free software; you can redistribute it and/or
  13143. + * modify it under the terms of the GNU Lesser General Public
  13144. + * License as published by the Free Software Foundation; either
  13145. + * version 2.1 of the License, or (at your option) any later version.
  13146. + *
  13147. + * FFmpeg is distributed in the hope that it will be useful,
  13148. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13149. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13150. + * Lesser General Public License for more details.
  13151. + *
  13152. + * You should have received a copy of the GNU Lesser General Public
  13153. + * License along with FFmpeg; if not, write to the Free Software
  13154. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  13155. + */
  13156. +
  13157. +#ifndef AVUTIL_SAMPLEFMT_H
  13158. +#define AVUTIL_SAMPLEFMT_H
  13159. +
  13160. +#include <stdint.h>
  13161. +
  13162. +#include "avutil.h"
  13163. +#include "attributes.h"
  13164. +
  13165. +/**
  13166. + * @addtogroup lavu_audio
  13167. + * @{
  13168. + *
  13169. + * @defgroup lavu_sampfmts Audio sample formats
  13170. + *
  13171. + * Audio sample format enumeration and related convenience functions.
  13172. + * @{
  13173. + */
  13174. +
  13175. +/**
  13176. + * Audio sample formats
  13177. + *
  13178. + * - The data described by the sample format is always in native-endian order.
  13179. + * Sample values can be expressed by native C types, hence the lack of a signed
  13180. + * 24-bit sample format even though it is a common raw audio data format.
  13181. + *
  13182. + * - The floating-point formats are based on full volume being in the range
  13183. + * [-1.0, 1.0]. Any values outside this range are beyond full volume level.
  13184. + *
  13185. + * - The data layout as used in av_samples_fill_arrays() and elsewhere in FFmpeg
  13186. + * (such as AVFrame in libavcodec) is as follows:
  13187. + *
  13188. + * @par
  13189. + * For planar sample formats, each audio channel is in a separate data plane,
  13190. + * and linesize is the buffer size, in bytes, for a single plane. All data
  13191. + * planes must be the same size. For packed sample formats, only the first data
  13192. + * plane is used, and samples for each channel are interleaved. In this case,
  13193. + * linesize is the buffer size, in bytes, for the 1 plane.
  13194. + *
  13195. + */
  13196. +enum AVSampleFormat {
  13197. + AV_SAMPLE_FMT_NONE = -1,
  13198. + AV_SAMPLE_FMT_U8, ///< unsigned 8 bits
  13199. + AV_SAMPLE_FMT_S16, ///< signed 16 bits
  13200. + AV_SAMPLE_FMT_S32, ///< signed 32 bits
  13201. + AV_SAMPLE_FMT_FLT, ///< float
  13202. + AV_SAMPLE_FMT_DBL, ///< double
  13203. +
  13204. + AV_SAMPLE_FMT_U8P, ///< unsigned 8 bits, planar
  13205. + AV_SAMPLE_FMT_S16P, ///< signed 16 bits, planar
  13206. + AV_SAMPLE_FMT_S32P, ///< signed 32 bits, planar
  13207. + AV_SAMPLE_FMT_FLTP, ///< float, planar
  13208. + AV_SAMPLE_FMT_DBLP, ///< double, planar
  13209. + AV_SAMPLE_FMT_S64, ///< signed 64 bits
  13210. + AV_SAMPLE_FMT_S64P, ///< signed 64 bits, planar
  13211. +
  13212. + AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically
  13213. +};
  13214. +
  13215. +/**
  13216. + * Return the name of sample_fmt, or NULL if sample_fmt is not
  13217. + * recognized.
  13218. + */
  13219. +const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt);
  13220. +
  13221. +/**
  13222. + * Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE
  13223. + * on error.
  13224. + */
  13225. +enum AVSampleFormat av_get_sample_fmt(const char *name);
  13226. +
  13227. +/**
  13228. + * Return the planar<->packed alternative form of the given sample format, or
  13229. + * AV_SAMPLE_FMT_NONE on error. If the passed sample_fmt is already in the
  13230. + * requested planar/packed format, the format returned is the same as the
  13231. + * input.
  13232. + */
  13233. +enum AVSampleFormat av_get_alt_sample_fmt(enum AVSampleFormat sample_fmt, int planar);
  13234. +
  13235. +/**
  13236. + * Get the packed alternative form of the given sample format.
  13237. + *
  13238. + * If the passed sample_fmt is already in packed format, the format returned is
  13239. + * the same as the input.
  13240. + *
  13241. + * @return the packed alternative form of the given sample format or
  13242. + AV_SAMPLE_FMT_NONE on error.
  13243. + */
  13244. +enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt);
  13245. +
  13246. +/**
  13247. + * Get the planar alternative form of the given sample format.
  13248. + *
  13249. + * If the passed sample_fmt is already in planar format, the format returned is
  13250. + * the same as the input.
  13251. + *
  13252. + * @return the planar alternative form of the given sample format or
  13253. + AV_SAMPLE_FMT_NONE on error.
  13254. + */
  13255. +enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt);
  13256. +
  13257. +/**
  13258. + * Generate a string corresponding to the sample format with
  13259. + * sample_fmt, or a header if sample_fmt is negative.
  13260. + *
  13261. + * @param buf the buffer where to write the string
  13262. + * @param buf_size the size of buf
  13263. + * @param sample_fmt the number of the sample format to print the
  13264. + * corresponding info string, or a negative value to print the
  13265. + * corresponding header.
  13266. + * @return the pointer to the filled buffer or NULL if sample_fmt is
  13267. + * unknown or in case of other errors
  13268. + */
  13269. +char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt);
  13270. +
  13271. +/**
  13272. + * Return number of bytes per sample.
  13273. + *
  13274. + * @param sample_fmt the sample format
  13275. + * @return number of bytes per sample or zero if unknown for the given
  13276. + * sample format
  13277. + */
  13278. +int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt);
  13279. +
  13280. +/**
  13281. + * Check if the sample format is planar.
  13282. + *
  13283. + * @param sample_fmt the sample format to inspect
  13284. + * @return 1 if the sample format is planar, 0 if it is interleaved
  13285. + */
  13286. +int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt);
  13287. +
  13288. +/**
  13289. + * Get the required buffer size for the given audio parameters.
  13290. + *
  13291. + * @param[out] linesize calculated linesize, may be NULL
  13292. + * @param nb_channels the number of channels
  13293. + * @param nb_samples the number of samples in a single channel
  13294. + * @param sample_fmt the sample format
  13295. + * @param align buffer size alignment (0 = default, 1 = no alignment)
  13296. + * @return required buffer size, or negative error code on failure
  13297. + */
  13298. +int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
  13299. + enum AVSampleFormat sample_fmt, int align);
  13300. +
  13301. +/**
  13302. + * @}
  13303. + *
  13304. + * @defgroup lavu_sampmanip Samples manipulation
  13305. + *
  13306. + * Functions that manipulate audio samples
  13307. + * @{
  13308. + */
  13309. +
  13310. +/**
  13311. + * Fill plane data pointers and linesize for samples with sample
  13312. + * format sample_fmt.
  13313. + *
  13314. + * The audio_data array is filled with the pointers to the samples data planes:
  13315. + * for planar, set the start point of each channel's data within the buffer,
  13316. + * for packed, set the start point of the entire buffer only.
  13317. + *
  13318. + * The value pointed to by linesize is set to the aligned size of each
  13319. + * channel's data buffer for planar layout, or to the aligned size of the
  13320. + * buffer for all channels for packed layout.
  13321. + *
  13322. + * The buffer in buf must be big enough to contain all the samples
  13323. + * (use av_samples_get_buffer_size() to compute its minimum size),
  13324. + * otherwise the audio_data pointers will point to invalid data.
  13325. + *
  13326. + * @see enum AVSampleFormat
  13327. + * The documentation for AVSampleFormat describes the data layout.
  13328. + *
  13329. + * @param[out] audio_data array to be filled with the pointer for each channel
  13330. + * @param[out] linesize calculated linesize, may be NULL
  13331. + * @param buf the pointer to a buffer containing the samples
  13332. + * @param nb_channels the number of channels
  13333. + * @param nb_samples the number of samples in a single channel
  13334. + * @param sample_fmt the sample format
  13335. + * @param align buffer size alignment (0 = default, 1 = no alignment)
  13336. + * @return >=0 on success or a negative error code on failure
  13337. + * @todo return minimum size in bytes required for the buffer in case
  13338. + * of success at the next bump
  13339. + */
  13340. +int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,
  13341. + const uint8_t *buf,
  13342. + int nb_channels, int nb_samples,
  13343. + enum AVSampleFormat sample_fmt, int align);
  13344. +
  13345. +/**
  13346. + * Allocate a samples buffer for nb_samples samples, and fill data pointers and
  13347. + * linesize accordingly.
  13348. + * The allocated samples buffer can be freed by using av_freep(&audio_data[0])
  13349. + * Allocated data will be initialized to silence.
  13350. + *
  13351. + * @see enum AVSampleFormat
  13352. + * The documentation for AVSampleFormat describes the data layout.
  13353. + *
  13354. + * @param[out] audio_data array to be filled with the pointer for each channel
  13355. + * @param[out] linesize aligned size for audio buffer(s), may be NULL
  13356. + * @param nb_channels number of audio channels
  13357. + * @param nb_samples number of samples per channel
  13358. + * @param align buffer size alignment (0 = default, 1 = no alignment)
  13359. + * @return >=0 on success or a negative error code on failure
  13360. + * @todo return the size of the allocated buffer in case of success at the next bump
  13361. + * @see av_samples_fill_arrays()
  13362. + * @see av_samples_alloc_array_and_samples()
  13363. + */
  13364. +int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,
  13365. + int nb_samples, enum AVSampleFormat sample_fmt, int align);
  13366. +
  13367. +/**
  13368. + * Allocate a data pointers array, samples buffer for nb_samples
  13369. + * samples, and fill data pointers and linesize accordingly.
  13370. + *
  13371. + * This is the same as av_samples_alloc(), but also allocates the data
  13372. + * pointers array.
  13373. + *
  13374. + * @see av_samples_alloc()
  13375. + */
  13376. +int av_samples_alloc_array_and_samples(uint8_t ***audio_data, int *linesize, int nb_channels,
  13377. + int nb_samples, enum AVSampleFormat sample_fmt, int align);
  13378. +
  13379. +/**
  13380. + * Copy samples from src to dst.
  13381. + *
  13382. + * @param dst destination array of pointers to data planes
  13383. + * @param src source array of pointers to data planes
  13384. + * @param dst_offset offset in samples at which the data will be written to dst
  13385. + * @param src_offset offset in samples at which the data will be read from src
  13386. + * @param nb_samples number of samples to be copied
  13387. + * @param nb_channels number of audio channels
  13388. + * @param sample_fmt audio sample format
  13389. + */
  13390. +int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset,
  13391. + int src_offset, int nb_samples, int nb_channels,
  13392. + enum AVSampleFormat sample_fmt);
  13393. +
  13394. +/**
  13395. + * Fill an audio buffer with silence.
  13396. + *
  13397. + * @param audio_data array of pointers to data planes
  13398. + * @param offset offset in samples at which to start filling
  13399. + * @param nb_samples number of samples to fill
  13400. + * @param nb_channels number of audio channels
  13401. + * @param sample_fmt audio sample format
  13402. + */
  13403. +int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples,
  13404. + int nb_channels, enum AVSampleFormat sample_fmt);
  13405. +
  13406. +/**
  13407. + * @}
  13408. + * @}
  13409. + */
  13410. +#endif /* AVUTIL_SAMPLEFMT_H */
  13411. diff --git dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/version.h dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/version.h
  13412. new file mode 100644
  13413. index 000000000000..3a63e6355f84
  13414. --- /dev/null
  13415. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/include/libavutil/version.h
  13416. @@ -0,0 +1,139 @@
  13417. +/*
  13418. + * copyright (c) 2003 Fabrice Bellard
  13419. + *
  13420. + * This file is part of FFmpeg.
  13421. + *
  13422. + * FFmpeg is free software; you can redistribute it and/or
  13423. + * modify it under the terms of the GNU Lesser General Public
  13424. + * License as published by the Free Software Foundation; either
  13425. + * version 2.1 of the License, or (at your option) any later version.
  13426. + *
  13427. + * FFmpeg is distributed in the hope that it will be useful,
  13428. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13429. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13430. + * Lesser General Public License for more details.
  13431. + *
  13432. + * You should have received a copy of the GNU Lesser General Public
  13433. + * License along with FFmpeg; if not, write to the Free Software
  13434. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  13435. + */
  13436. +
  13437. +/**
  13438. + * @file
  13439. + * @ingroup lavu
  13440. + * Libavutil version macros
  13441. + */
  13442. +
  13443. +#ifndef AVUTIL_VERSION_H
  13444. +#define AVUTIL_VERSION_H
  13445. +
  13446. +#include "macros.h"
  13447. +
  13448. +/**
  13449. + * @addtogroup version_utils
  13450. + *
  13451. + * Useful to check and match library version in order to maintain
  13452. + * backward compatibility.
  13453. + *
  13454. + * The FFmpeg libraries follow a versioning sheme very similar to
  13455. + * Semantic Versioning (http://semver.org/)
  13456. + * The difference is that the component called PATCH is called MICRO in FFmpeg
  13457. + * and its value is reset to 100 instead of 0 to keep it above or equal to 100.
  13458. + * Also we do not increase MICRO for every bugfix or change in git master.
  13459. + *
  13460. + * Prior to FFmpeg 3.2 point releases did not change any lib version number to
  13461. + * avoid aliassing different git master checkouts.
  13462. + * Starting with FFmpeg 3.2, the released library versions will occupy
  13463. + * a separate MAJOR.MINOR that is not used on the master development branch.
  13464. + * That is if we branch a release of master 55.10.123 we will bump to 55.11.100
  13465. + * for the release and master will continue at 55.12.100 after it. Each new
  13466. + * point release will then bump the MICRO improving the usefulness of the lib
  13467. + * versions.
  13468. + *
  13469. + * @{
  13470. + */
  13471. +
  13472. +#define AV_VERSION_INT(a, b, c) ((a)<<16 | (b)<<8 | (c))
  13473. +#define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c
  13474. +#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
  13475. +
  13476. +/**
  13477. + * Extract version components from the full ::AV_VERSION_INT int as returned
  13478. + * by functions like ::avformat_version() and ::avcodec_version()
  13479. + */
  13480. +#define AV_VERSION_MAJOR(a) ((a) >> 16)
  13481. +#define AV_VERSION_MINOR(a) (((a) & 0x00FF00) >> 8)
  13482. +#define AV_VERSION_MICRO(a) ((a) & 0xFF)
  13483. +
  13484. +/**
  13485. + * @}
  13486. + */
  13487. +
  13488. +/**
  13489. + * @defgroup lavu_ver Version and Build diagnostics
  13490. + *
  13491. + * Macros and function useful to check at compiletime and at runtime
  13492. + * which version of libavutil is in use.
  13493. + *
  13494. + * @{
  13495. + */
  13496. +
  13497. +#define LIBAVUTIL_VERSION_MAJOR 56
  13498. +#define LIBAVUTIL_VERSION_MINOR 14
  13499. +#define LIBAVUTIL_VERSION_MICRO 100
  13500. +
  13501. +#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
  13502. + LIBAVUTIL_VERSION_MINOR, \
  13503. + LIBAVUTIL_VERSION_MICRO)
  13504. +#define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \
  13505. + LIBAVUTIL_VERSION_MINOR, \
  13506. + LIBAVUTIL_VERSION_MICRO)
  13507. +#define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT
  13508. +
  13509. +#define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION)
  13510. +
  13511. +/**
  13512. + * @defgroup lavu_depr_guards Deprecation Guards
  13513. + * FF_API_* defines may be placed below to indicate public API that will be
  13514. + * dropped at a future version bump. The defines themselves are not part of
  13515. + * the public API and may change, break or disappear at any time.
  13516. + *
  13517. + * @note, when bumping the major version it is recommended to manually
  13518. + * disable each FF_API_* in its own commit instead of disabling them all
  13519. + * at once through the bump. This improves the git bisect-ability of the change.
  13520. + *
  13521. + * @{
  13522. + */
  13523. +
  13524. +#ifndef FF_API_VAAPI
  13525. +#define FF_API_VAAPI (LIBAVUTIL_VERSION_MAJOR < 57)
  13526. +#endif
  13527. +#ifndef FF_API_FRAME_QP
  13528. +#define FF_API_FRAME_QP (LIBAVUTIL_VERSION_MAJOR < 57)
  13529. +#endif
  13530. +#ifndef FF_API_PLUS1_MINUS1
  13531. +#define FF_API_PLUS1_MINUS1 (LIBAVUTIL_VERSION_MAJOR < 57)
  13532. +#endif
  13533. +#ifndef FF_API_ERROR_FRAME
  13534. +#define FF_API_ERROR_FRAME (LIBAVUTIL_VERSION_MAJOR < 57)
  13535. +#endif
  13536. +#ifndef FF_API_PKT_PTS
  13537. +#define FF_API_PKT_PTS (LIBAVUTIL_VERSION_MAJOR < 57)
  13538. +#endif
  13539. +#ifndef FF_API_CRYPTO_SIZE_T
  13540. +#define FF_API_CRYPTO_SIZE_T (LIBAVUTIL_VERSION_MAJOR < 57)
  13541. +#endif
  13542. +#ifndef FF_API_FRAME_GET_SET
  13543. +#define FF_API_FRAME_GET_SET (LIBAVUTIL_VERSION_MAJOR < 57)
  13544. +#endif
  13545. +#ifndef FF_API_PSEUDOPAL
  13546. +#define FF_API_PSEUDOPAL (LIBAVUTIL_VERSION_MAJOR < 57)
  13547. +#endif
  13548. +
  13549. +
  13550. +/**
  13551. + * @}
  13552. + * @}
  13553. + */
  13554. +
  13555. +#endif /* AVUTIL_VERSION_H */
  13556. diff --git dom/media/platforms/ffmpeg/ffmpeg58/moz.build dom/media/platforms/ffmpeg/ffmpeg58/moz.build
  13557. new file mode 100644
  13558. index 000000000000..c757ed6fad04
  13559. --- /dev/null
  13560. +++ mozilla/dom/media/platforms/ffmpeg/ffmpeg58/moz.build
  13561. @@ -0,0 +1,25 @@
  13562. +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
  13563. +# vim: set filetype=python:
  13564. +# This Source Code Form is subject to the terms of the Mozilla Public
  13565. +# License, v. 2.0. If a copy of the MPL was not distributed with this
  13566. +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
  13567. +
  13568. +UNIFIED_SOURCES += [
  13569. + '../FFmpegAudioDecoder.cpp',
  13570. + '../FFmpegDataDecoder.cpp',
  13571. + '../FFmpegDecoderModule.cpp',
  13572. + '../FFmpegVideoDecoder.cpp',
  13573. +]
  13574. +LOCAL_INCLUDES += [
  13575. + '..',
  13576. + 'include',
  13577. +]
  13578. +
  13579. +if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
  13580. + CXXFLAGS += [ '-Wno-deprecated-declarations' ]
  13581. +if CONFIG['CC_TYPE'] == 'clang':
  13582. + CXXFLAGS += [
  13583. + '-Wno-unknown-attributes',
  13584. + ]
  13585. +
  13586. +FINAL_LIBRARY = 'xul'
  13587. diff --git dom/media/platforms/ffmpeg/moz.build dom/media/platforms/ffmpeg/moz.build
  13588. index 604e445aa4d9..af96fb521e3d 100644
  13589. --- mozilla/dom/media/platforms/ffmpeg/moz.build
  13590. +++ mozilla/dom/media/platforms/ffmpeg/moz.build
  13591. @@ -13,6 +13,7 @@ DIRS += [
  13592. 'libav54',
  13593. 'libav55',
  13594. 'ffmpeg57',
  13595. + 'ffmpeg58',
  13596. ]
  13597. UNIFIED_SOURCES += [