ffmpeg6.patch 708 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775
  1. Source: https://github.com/archlinux/svntogit-packages/blob/dd7a5fb35df6e31ee9591ab204fa2fe54e716155/trunk/0002-Bug-1819374-Squashed-ffmpeg-6.0-update.patch
  2. diff --git a/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp b/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp
  3. index 94b929f1..4730a0bc 100644
  4. --- a/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp
  5. +++ b/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp
  6. @@ -66,6 +66,7 @@ FFmpegLibWrapper::LinkResult FFmpegLibWrapper::Link() {
  7. AV_FUNC_57 = 1 << 4,
  8. AV_FUNC_58 = 1 << 5,
  9. AV_FUNC_59 = 1 << 6,
  10. + AV_FUNC_60 = 1 << 7,
  11. AV_FUNC_AVUTIL_53 = AV_FUNC_53 | AV_FUNC_AVUTIL_MASK,
  12. AV_FUNC_AVUTIL_54 = AV_FUNC_54 | AV_FUNC_AVUTIL_MASK,
  13. AV_FUNC_AVUTIL_55 = AV_FUNC_55 | AV_FUNC_AVUTIL_MASK,
  14. @@ -73,8 +74,9 @@ FFmpegLibWrapper::LinkResult FFmpegLibWrapper::Link() {
  15. AV_FUNC_AVUTIL_57 = AV_FUNC_57 | AV_FUNC_AVUTIL_MASK,
  16. AV_FUNC_AVUTIL_58 = AV_FUNC_58 | AV_FUNC_AVUTIL_MASK,
  17. AV_FUNC_AVUTIL_59 = AV_FUNC_59 | AV_FUNC_AVUTIL_MASK,
  18. + AV_FUNC_AVUTIL_60 = AV_FUNC_60 | AV_FUNC_AVUTIL_MASK,
  19. AV_FUNC_AVCODEC_ALL = AV_FUNC_53 | AV_FUNC_54 | AV_FUNC_55 | AV_FUNC_56 |
  20. - AV_FUNC_57 | AV_FUNC_58 | AV_FUNC_59,
  21. + AV_FUNC_57 | AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60,
  22. AV_FUNC_AVUTIL_ALL = AV_FUNC_AVCODEC_ALL | AV_FUNC_AVUTIL_MASK
  23. };
  24. @@ -100,8 +102,11 @@ FFmpegLibWrapper::LinkResult FFmpegLibWrapper::Link() {
  25. case 59:
  26. version = AV_FUNC_59;
  27. break;
  28. + case 60:
  29. + version = AV_FUNC_60;
  30. + break;
  31. default:
  32. - FFMPEG_LOG("Unknown avcodec version");
  33. + FFMPEG_LOG("Unknown avcodec version: %d", macro);
  34. Unlink();
  35. return isFFMpeg ? ((macro > 57) ? LinkResult::UnknownFutureFFMpegVersion
  36. : LinkResult::UnknownOlderFFMpegVersion)
  37. @@ -155,10 +160,10 @@ FFmpegLibWrapper::LinkResult FFmpegLibWrapper::Link() {
  38. AV_FUNC(avcodec_alloc_frame, (AV_FUNC_53 | AV_FUNC_54))
  39. AV_FUNC(avcodec_get_frame_defaults, (AV_FUNC_53 | AV_FUNC_54))
  40. AV_FUNC(avcodec_free_frame, AV_FUNC_54)
  41. - AV_FUNC(avcodec_send_packet, AV_FUNC_58 | AV_FUNC_59)
  42. - AV_FUNC(avcodec_receive_frame, AV_FUNC_58 | AV_FUNC_59)
  43. - AV_FUNC(avcodec_default_get_buffer2,
  44. - (AV_FUNC_55 | AV_FUNC_56 | AV_FUNC_57 | AV_FUNC_58 | AV_FUNC_59))
  45. + AV_FUNC(avcodec_send_packet, AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60)
  46. + AV_FUNC(avcodec_receive_frame, AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60)
  47. + AV_FUNC(avcodec_default_get_buffer2, (AV_FUNC_55 | AV_FUNC_56 | AV_FUNC_57 |
  48. + AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60))
  49. AV_FUNC_OPTION(av_rdft_init, AV_FUNC_AVCODEC_ALL)
  50. AV_FUNC_OPTION(av_rdft_calc, AV_FUNC_AVCODEC_ALL)
  51. AV_FUNC_OPTION(av_rdft_end, AV_FUNC_AVCODEC_ALL)
  52. @@ -167,49 +172,62 @@ FFmpegLibWrapper::LinkResult FFmpegLibWrapper::Link() {
  53. AV_FUNC(av_freep, AV_FUNC_AVUTIL_ALL)
  54. AV_FUNC(av_frame_alloc,
  55. (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 |
  56. - AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59))
  57. + AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59 | AV_FUNC_AVUTIL_60))
  58. AV_FUNC(av_frame_free,
  59. (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 |
  60. - AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59))
  61. + AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59 | AV_FUNC_AVUTIL_60))
  62. AV_FUNC(av_frame_unref,
  63. (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 |
  64. - AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59))
  65. + AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59 | AV_FUNC_AVUTIL_60))
  66. AV_FUNC(av_image_check_size, AV_FUNC_AVUTIL_ALL)
  67. AV_FUNC(av_image_get_buffer_size, AV_FUNC_AVUTIL_ALL)
  68. - AV_FUNC_OPTION(av_buffer_get_opaque, (AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 |
  69. - AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59))
  70. + AV_FUNC_OPTION(av_buffer_get_opaque,
  71. + (AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58 |
  72. + AV_FUNC_AVUTIL_59 | AV_FUNC_AVUTIL_60))
  73. AV_FUNC(av_buffer_create,
  74. (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 |
  75. - AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59))
  76. + AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59 | AV_FUNC_AVUTIL_60))
  77. AV_FUNC_OPTION(av_frame_get_colorspace,
  78. AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 |
  79. AV_FUNC_AVUTIL_58)
  80. AV_FUNC_OPTION(av_frame_get_color_range,
  81. AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 |
  82. AV_FUNC_AVUTIL_58)
  83. - AV_FUNC(av_strerror, AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59)
  84. + AV_FUNC(av_strerror,
  85. + AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59 | AV_FUNC_AVUTIL_60)
  86. #ifdef MOZ_WAYLAND
  87. - AV_FUNC_OPTION_SILENT(avcodec_get_hw_config, AV_FUNC_58 | AV_FUNC_59)
  88. - AV_FUNC_OPTION_SILENT(av_codec_iterate, AV_FUNC_58 | AV_FUNC_59)
  89. - AV_FUNC_OPTION_SILENT(av_codec_is_decoder, AV_FUNC_58 | AV_FUNC_59)
  90. - AV_FUNC_OPTION_SILENT(av_hwdevice_ctx_init, AV_FUNC_58 | AV_FUNC_59)
  91. - AV_FUNC_OPTION_SILENT(av_hwdevice_ctx_alloc, AV_FUNC_58 | AV_FUNC_59)
  92. - AV_FUNC_OPTION_SILENT(av_hwdevice_hwconfig_alloc, AV_FUNC_58 | AV_FUNC_59)
  93. + AV_FUNC_OPTION_SILENT(avcodec_get_hw_config,
  94. + AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60)
  95. + AV_FUNC_OPTION_SILENT(av_codec_iterate, AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60)
  96. + AV_FUNC_OPTION_SILENT(av_codec_is_decoder,
  97. + AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60)
  98. + AV_FUNC_OPTION_SILENT(av_hwdevice_ctx_init,
  99. + AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60)
  100. + AV_FUNC_OPTION_SILENT(av_hwdevice_ctx_alloc,
  101. + AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60)
  102. + AV_FUNC_OPTION_SILENT(av_hwdevice_hwconfig_alloc,
  103. + AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60)
  104. AV_FUNC_OPTION_SILENT(av_hwdevice_get_hwframe_constraints,
  105. - AV_FUNC_58 | AV_FUNC_59)
  106. - AV_FUNC_OPTION_SILENT(av_hwframe_constraints_free, AV_FUNC_58 | AV_FUNC_59)
  107. - AV_FUNC_OPTION_SILENT(av_buffer_ref, AV_FUNC_AVUTIL_58 | AV_FUNC_59)
  108. - AV_FUNC_OPTION_SILENT(av_buffer_unref, AV_FUNC_AVUTIL_58 | AV_FUNC_59)
  109. + AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60)
  110. + AV_FUNC_OPTION_SILENT(av_hwframe_constraints_free,
  111. + AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60)
  112. + AV_FUNC_OPTION_SILENT(av_buffer_ref,
  113. + AV_FUNC_AVUTIL_58 | AV_FUNC_59 | AV_FUNC_60)
  114. + AV_FUNC_OPTION_SILENT(av_buffer_unref,
  115. + AV_FUNC_AVUTIL_58 | AV_FUNC_59 | AV_FUNC_60)
  116. AV_FUNC_OPTION_SILENT(av_hwframe_transfer_get_formats,
  117. - AV_FUNC_58 | AV_FUNC_59)
  118. - AV_FUNC_OPTION_SILENT(av_hwdevice_ctx_create_derived, AV_FUNC_58 | AV_FUNC_59)
  119. - AV_FUNC_OPTION_SILENT(av_hwframe_ctx_alloc, AV_FUNC_58 | AV_FUNC_59)
  120. - AV_FUNC_OPTION_SILENT(av_dict_set, AV_FUNC_58 | AV_FUNC_59)
  121. - AV_FUNC_OPTION_SILENT(av_dict_free, AV_FUNC_58 | AV_FUNC_59)
  122. - AV_FUNC_OPTION_SILENT(avcodec_get_name, AV_FUNC_58 | AV_FUNC_59)
  123. - AV_FUNC_OPTION_SILENT(av_get_pix_fmt_string,
  124. - AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59)
  125. + AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60)
  126. + AV_FUNC_OPTION_SILENT(av_hwdevice_ctx_create_derived,
  127. + AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60)
  128. + AV_FUNC_OPTION_SILENT(av_hwframe_ctx_alloc,
  129. + AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60)
  130. + AV_FUNC_OPTION_SILENT(av_dict_set, AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60)
  131. + AV_FUNC_OPTION_SILENT(av_dict_free, AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60)
  132. + AV_FUNC_OPTION_SILENT(avcodec_get_name, AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60)
  133. + AV_FUNC_OPTION_SILENT(av_get_pix_fmt_string, AV_FUNC_AVUTIL_58 |
  134. + AV_FUNC_AVUTIL_59 |
  135. + AV_FUNC_AVUTIL_60)
  136. #endif
  137. #undef AV_FUNC
  138. #undef AV_FUNC_OPTION
  139. diff --git a/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp b/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp
  140. index 91bf38df..7716162e 100644
  141. --- a/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp
  142. +++ b/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp
  143. @@ -27,6 +27,7 @@ static FFmpegLibWrapper sLibAV;
  144. static const char* sLibs[] = {
  145. // clang-format off
  146. #if defined(XP_DARWIN)
  147. + "libavcodec.60.dylib",
  148. "libavcodec.59.dylib",
  149. "libavcodec.58.dylib",
  150. "libavcodec.57.dylib",
  151. @@ -38,6 +39,7 @@ static const char* sLibs[] = {
  152. "libavcodec.so", // OpenBSD hardly controls the major/minor library version
  153. // of ffmpeg and update it regulary on ABI/API changes
  154. #else
  155. + "libavcodec.so.60",
  156. "libavcodec.so.59",
  157. "libavcodec.so.58",
  158. "libavcodec-ffmpeg.so.58",
  159. @@ -160,6 +162,9 @@ already_AddRefed<PlatformDecoderModule> FFmpegRuntimeLinker::Create() {
  160. case 59:
  161. module = FFmpegDecoderModule<59>::Create(&sLibAV);
  162. break;
  163. + case 60:
  164. + module = FFmpegDecoderModule<60>::Create(&sLibAV);
  165. + break;
  166. default:
  167. module = nullptr;
  168. }
  169. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/COPYING.LGPLv2.1 b/dom/media/platforms/ffmpeg/ffmpeg60/include/COPYING.LGPLv2.1
  170. new file mode 100644
  171. index 00000000..00b4fedf
  172. --- /dev/null
  173. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/COPYING.LGPLv2.1
  174. @@ -0,0 +1,504 @@
  175. + GNU LESSER GENERAL PUBLIC LICENSE
  176. + Version 2.1, February 1999
  177. +
  178. + Copyright (C) 1991, 1999 Free Software Foundation, Inc.
  179. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  180. + Everyone is permitted to copy and distribute verbatim copies
  181. + of this license document, but changing it is not allowed.
  182. +
  183. +[This is the first released version of the Lesser GPL. It also counts
  184. + as the successor of the GNU Library Public License, version 2, hence
  185. + the version number 2.1.]
  186. +
  187. + Preamble
  188. +
  189. + The licenses for most software are designed to take away your
  190. +freedom to share and change it. By contrast, the GNU General Public
  191. +Licenses are intended to guarantee your freedom to share and change
  192. +free software--to make sure the software is free for all its users.
  193. +
  194. + This license, the Lesser General Public License, applies to some
  195. +specially designated software packages--typically libraries--of the
  196. +Free Software Foundation and other authors who decide to use it. You
  197. +can use it too, but we suggest you first think carefully about whether
  198. +this license or the ordinary General Public License is the better
  199. +strategy to use in any particular case, based on the explanations below.
  200. +
  201. + When we speak of free software, we are referring to freedom of use,
  202. +not price. Our General Public Licenses are designed to make sure that
  203. +you have the freedom to distribute copies of free software (and charge
  204. +for this service if you wish); that you receive source code or can get
  205. +it if you want it; that you can change the software and use pieces of
  206. +it in new free programs; and that you are informed that you can do
  207. +these things.
  208. +
  209. + To protect your rights, we need to make restrictions that forbid
  210. +distributors to deny you these rights or to ask you to surrender these
  211. +rights. These restrictions translate to certain responsibilities for
  212. +you if you distribute copies of the library or if you modify it.
  213. +
  214. + For example, if you distribute copies of the library, whether gratis
  215. +or for a fee, you must give the recipients all the rights that we gave
  216. +you. You must make sure that they, too, receive or can get the source
  217. +code. If you link other code with the library, you must provide
  218. +complete object files to the recipients, so that they can relink them
  219. +with the library after making changes to the library and recompiling
  220. +it. And you must show them these terms so they know their rights.
  221. +
  222. + We protect your rights with a two-step method: (1) we copyright the
  223. +library, and (2) we offer you this license, which gives you legal
  224. +permission to copy, distribute and/or modify the library.
  225. +
  226. + To protect each distributor, we want to make it very clear that
  227. +there is no warranty for the free library. Also, if the library is
  228. +modified by someone else and passed on, the recipients should know
  229. +that what they have is not the original version, so that the original
  230. +author's reputation will not be affected by problems that might be
  231. +introduced by others.
  232. +
  233. + Finally, software patents pose a constant threat to the existence of
  234. +any free program. We wish to make sure that a company cannot
  235. +effectively restrict the users of a free program by obtaining a
  236. +restrictive license from a patent holder. Therefore, we insist that
  237. +any patent license obtained for a version of the library must be
  238. +consistent with the full freedom of use specified in this license.
  239. +
  240. + Most GNU software, including some libraries, is covered by the
  241. +ordinary GNU General Public License. This license, the GNU Lesser
  242. +General Public License, applies to certain designated libraries, and
  243. +is quite different from the ordinary General Public License. We use
  244. +this license for certain libraries in order to permit linking those
  245. +libraries into non-free programs.
  246. +
  247. + When a program is linked with a library, whether statically or using
  248. +a shared library, the combination of the two is legally speaking a
  249. +combined work, a derivative of the original library. The ordinary
  250. +General Public License therefore permits such linking only if the
  251. +entire combination fits its criteria of freedom. The Lesser General
  252. +Public License permits more lax criteria for linking other code with
  253. +the library.
  254. +
  255. + We call this license the "Lesser" General Public License because it
  256. +does Less to protect the user's freedom than the ordinary General
  257. +Public License. It also provides other free software developers Less
  258. +of an advantage over competing non-free programs. These disadvantages
  259. +are the reason we use the ordinary General Public License for many
  260. +libraries. However, the Lesser license provides advantages in certain
  261. +special circumstances.
  262. +
  263. + For example, on rare occasions, there may be a special need to
  264. +encourage the widest possible use of a certain library, so that it becomes
  265. +a de-facto standard. To achieve this, non-free programs must be
  266. +allowed to use the library. A more frequent case is that a free
  267. +library does the same job as widely used non-free libraries. In this
  268. +case, there is little to gain by limiting the free library to free
  269. +software only, so we use the Lesser General Public License.
  270. +
  271. + In other cases, permission to use a particular library in non-free
  272. +programs enables a greater number of people to use a large body of
  273. +free software. For example, permission to use the GNU C Library in
  274. +non-free programs enables many more people to use the whole GNU
  275. +operating system, as well as its variant, the GNU/Linux operating
  276. +system.
  277. +
  278. + Although the Lesser General Public License is Less protective of the
  279. +users' freedom, it does ensure that the user of a program that is
  280. +linked with the Library has the freedom and the wherewithal to run
  281. +that program using a modified version of the Library.
  282. +
  283. + The precise terms and conditions for copying, distribution and
  284. +modification follow. Pay close attention to the difference between a
  285. +"work based on the library" and a "work that uses the library". The
  286. +former contains code derived from the library, whereas the latter must
  287. +be combined with the library in order to run.
  288. +
  289. + GNU LESSER GENERAL PUBLIC LICENSE
  290. + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  291. +
  292. + 0. This License Agreement applies to any software library or other
  293. +program which contains a notice placed by the copyright holder or
  294. +other authorized party saying it may be distributed under the terms of
  295. +this Lesser General Public License (also called "this License").
  296. +Each licensee is addressed as "you".
  297. +
  298. + A "library" means a collection of software functions and/or data
  299. +prepared so as to be conveniently linked with application programs
  300. +(which use some of those functions and data) to form executables.
  301. +
  302. + The "Library", below, refers to any such software library or work
  303. +which has been distributed under these terms. A "work based on the
  304. +Library" means either the Library or any derivative work under
  305. +copyright law: that is to say, a work containing the Library or a
  306. +portion of it, either verbatim or with modifications and/or translated
  307. +straightforwardly into another language. (Hereinafter, translation is
  308. +included without limitation in the term "modification".)
  309. +
  310. + "Source code" for a work means the preferred form of the work for
  311. +making modifications to it. For a library, complete source code means
  312. +all the source code for all modules it contains, plus any associated
  313. +interface definition files, plus the scripts used to control compilation
  314. +and installation of the library.
  315. +
  316. + Activities other than copying, distribution and modification are not
  317. +covered by this License; they are outside its scope. The act of
  318. +running a program using the Library is not restricted, and output from
  319. +such a program is covered only if its contents constitute a work based
  320. +on the Library (independent of the use of the Library in a tool for
  321. +writing it). Whether that is true depends on what the Library does
  322. +and what the program that uses the Library does.
  323. +
  324. + 1. You may copy and distribute verbatim copies of the Library's
  325. +complete source code as you receive it, in any medium, provided that
  326. +you conspicuously and appropriately publish on each copy an
  327. +appropriate copyright notice and disclaimer of warranty; keep intact
  328. +all the notices that refer to this License and to the absence of any
  329. +warranty; and distribute a copy of this License along with the
  330. +Library.
  331. +
  332. + You may charge a fee for the physical act of transferring a copy,
  333. +and you may at your option offer warranty protection in exchange for a
  334. +fee.
  335. +
  336. + 2. You may modify your copy or copies of the Library or any portion
  337. +of it, thus forming a work based on the Library, and copy and
  338. +distribute such modifications or work under the terms of Section 1
  339. +above, provided that you also meet all of these conditions:
  340. +
  341. + a) The modified work must itself be a software library.
  342. +
  343. + b) You must cause the files modified to carry prominent notices
  344. + stating that you changed the files and the date of any change.
  345. +
  346. + c) You must cause the whole of the work to be licensed at no
  347. + charge to all third parties under the terms of this License.
  348. +
  349. + d) If a facility in the modified Library refers to a function or a
  350. + table of data to be supplied by an application program that uses
  351. + the facility, other than as an argument passed when the facility
  352. + is invoked, then you must make a good faith effort to ensure that,
  353. + in the event an application does not supply such function or
  354. + table, the facility still operates, and performs whatever part of
  355. + its purpose remains meaningful.
  356. +
  357. + (For example, a function in a library to compute square roots has
  358. + a purpose that is entirely well-defined independent of the
  359. + application. Therefore, Subsection 2d requires that any
  360. + application-supplied function or table used by this function must
  361. + be optional: if the application does not supply it, the square
  362. + root function must still compute square roots.)
  363. +
  364. +These requirements apply to the modified work as a whole. If
  365. +identifiable sections of that work are not derived from the Library,
  366. +and can be reasonably considered independent and separate works in
  367. +themselves, then this License, and its terms, do not apply to those
  368. +sections when you distribute them as separate works. But when you
  369. +distribute the same sections as part of a whole which is a work based
  370. +on the Library, the distribution of the whole must be on the terms of
  371. +this License, whose permissions for other licensees extend to the
  372. +entire whole, and thus to each and every part regardless of who wrote
  373. +it.
  374. +
  375. +Thus, it is not the intent of this section to claim rights or contest
  376. +your rights to work written entirely by you; rather, the intent is to
  377. +exercise the right to control the distribution of derivative or
  378. +collective works based on the Library.
  379. +
  380. +In addition, mere aggregation of another work not based on the Library
  381. +with the Library (or with a work based on the Library) on a volume of
  382. +a storage or distribution medium does not bring the other work under
  383. +the scope of this License.
  384. +
  385. + 3. You may opt to apply the terms of the ordinary GNU General Public
  386. +License instead of this License to a given copy of the Library. To do
  387. +this, you must alter all the notices that refer to this License, so
  388. +that they refer to the ordinary GNU General Public License, version 2,
  389. +instead of to this License. (If a newer version than version 2 of the
  390. +ordinary GNU General Public License has appeared, then you can specify
  391. +that version instead if you wish.) Do not make any other change in
  392. +these notices.
  393. +
  394. + Once this change is made in a given copy, it is irreversible for
  395. +that copy, so the ordinary GNU General Public License applies to all
  396. +subsequent copies and derivative works made from that copy.
  397. +
  398. + This option is useful when you wish to copy part of the code of
  399. +the Library into a program that is not a library.
  400. +
  401. + 4. You may copy and distribute the Library (or a portion or
  402. +derivative of it, under Section 2) in object code or executable form
  403. +under the terms of Sections 1 and 2 above provided that you accompany
  404. +it with the complete corresponding machine-readable source code, which
  405. +must be distributed under the terms of Sections 1 and 2 above on a
  406. +medium customarily used for software interchange.
  407. +
  408. + If distribution of object code is made by offering access to copy
  409. +from a designated place, then offering equivalent access to copy the
  410. +source code from the same place satisfies the requirement to
  411. +distribute the source code, even though third parties are not
  412. +compelled to copy the source along with the object code.
  413. +
  414. + 5. A program that contains no derivative of any portion of the
  415. +Library, but is designed to work with the Library by being compiled or
  416. +linked with it, is called a "work that uses the Library". Such a
  417. +work, in isolation, is not a derivative work of the Library, and
  418. +therefore falls outside the scope of this License.
  419. +
  420. + However, linking a "work that uses the Library" with the Library
  421. +creates an executable that is a derivative of the Library (because it
  422. +contains portions of the Library), rather than a "work that uses the
  423. +library". The executable is therefore covered by this License.
  424. +Section 6 states terms for distribution of such executables.
  425. +
  426. + When a "work that uses the Library" uses material from a header file
  427. +that is part of the Library, the object code for the work may be a
  428. +derivative work of the Library even though the source code is not.
  429. +Whether this is true is especially significant if the work can be
  430. +linked without the Library, or if the work is itself a library. The
  431. +threshold for this to be true is not precisely defined by law.
  432. +
  433. + If such an object file uses only numerical parameters, data
  434. +structure layouts and accessors, and small macros and small inline
  435. +functions (ten lines or less in length), then the use of the object
  436. +file is unrestricted, regardless of whether it is legally a derivative
  437. +work. (Executables containing this object code plus portions of the
  438. +Library will still fall under Section 6.)
  439. +
  440. + Otherwise, if the work is a derivative of the Library, you may
  441. +distribute the object code for the work under the terms of Section 6.
  442. +Any executables containing that work also fall under Section 6,
  443. +whether or not they are linked directly with the Library itself.
  444. +
  445. + 6. As an exception to the Sections above, you may also combine or
  446. +link a "work that uses the Library" with the Library to produce a
  447. +work containing portions of the Library, and distribute that work
  448. +under terms of your choice, provided that the terms permit
  449. +modification of the work for the customer's own use and reverse
  450. +engineering for debugging such modifications.
  451. +
  452. + You must give prominent notice with each copy of the work that the
  453. +Library is used in it and that the Library and its use are covered by
  454. +this License. You must supply a copy of this License. If the work
  455. +during execution displays copyright notices, you must include the
  456. +copyright notice for the Library among them, as well as a reference
  457. +directing the user to the copy of this License. Also, you must do one
  458. +of these things:
  459. +
  460. + a) Accompany the work with the complete corresponding
  461. + machine-readable source code for the Library including whatever
  462. + changes were used in the work (which must be distributed under
  463. + Sections 1 and 2 above); and, if the work is an executable linked
  464. + with the Library, with the complete machine-readable "work that
  465. + uses the Library", as object code and/or source code, so that the
  466. + user can modify the Library and then relink to produce a modified
  467. + executable containing the modified Library. (It is understood
  468. + that the user who changes the contents of definitions files in the
  469. + Library will not necessarily be able to recompile the application
  470. + to use the modified definitions.)
  471. +
  472. + b) Use a suitable shared library mechanism for linking with the
  473. + Library. A suitable mechanism is one that (1) uses at run time a
  474. + copy of the library already present on the user's computer system,
  475. + rather than copying library functions into the executable, and (2)
  476. + will operate properly with a modified version of the library, if
  477. + the user installs one, as long as the modified version is
  478. + interface-compatible with the version that the work was made with.
  479. +
  480. + c) Accompany the work with a written offer, valid for at
  481. + least three years, to give the same user the materials
  482. + specified in Subsection 6a, above, for a charge no more
  483. + than the cost of performing this distribution.
  484. +
  485. + d) If distribution of the work is made by offering access to copy
  486. + from a designated place, offer equivalent access to copy the above
  487. + specified materials from the same place.
  488. +
  489. + e) Verify that the user has already received a copy of these
  490. + materials or that you have already sent this user a copy.
  491. +
  492. + For an executable, the required form of the "work that uses the
  493. +Library" must include any data and utility programs needed for
  494. +reproducing the executable from it. However, as a special exception,
  495. +the materials to be distributed need not include anything that is
  496. +normally distributed (in either source or binary form) with the major
  497. +components (compiler, kernel, and so on) of the operating system on
  498. +which the executable runs, unless that component itself accompanies
  499. +the executable.
  500. +
  501. + It may happen that this requirement contradicts the license
  502. +restrictions of other proprietary libraries that do not normally
  503. +accompany the operating system. Such a contradiction means you cannot
  504. +use both them and the Library together in an executable that you
  505. +distribute.
  506. +
  507. + 7. You may place library facilities that are a work based on the
  508. +Library side-by-side in a single library together with other library
  509. +facilities not covered by this License, and distribute such a combined
  510. +library, provided that the separate distribution of the work based on
  511. +the Library and of the other library facilities is otherwise
  512. +permitted, and provided that you do these two things:
  513. +
  514. + a) Accompany the combined library with a copy of the same work
  515. + based on the Library, uncombined with any other library
  516. + facilities. This must be distributed under the terms of the
  517. + Sections above.
  518. +
  519. + b) Give prominent notice with the combined library of the fact
  520. + that part of it is a work based on the Library, and explaining
  521. + where to find the accompanying uncombined form of the same work.
  522. +
  523. + 8. You may not copy, modify, sublicense, link with, or distribute
  524. +the Library except as expressly provided under this License. Any
  525. +attempt otherwise to copy, modify, sublicense, link with, or
  526. +distribute the Library is void, and will automatically terminate your
  527. +rights under this License. However, parties who have received copies,
  528. +or rights, from you under this License will not have their licenses
  529. +terminated so long as such parties remain in full compliance.
  530. +
  531. + 9. You are not required to accept this License, since you have not
  532. +signed it. However, nothing else grants you permission to modify or
  533. +distribute the Library or its derivative works. These actions are
  534. +prohibited by law if you do not accept this License. Therefore, by
  535. +modifying or distributing the Library (or any work based on the
  536. +Library), you indicate your acceptance of this License to do so, and
  537. +all its terms and conditions for copying, distributing or modifying
  538. +the Library or works based on it.
  539. +
  540. + 10. Each time you redistribute the Library (or any work based on the
  541. +Library), the recipient automatically receives a license from the
  542. +original licensor to copy, distribute, link with or modify the Library
  543. +subject to these terms and conditions. You may not impose any further
  544. +restrictions on the recipients' exercise of the rights granted herein.
  545. +You are not responsible for enforcing compliance by third parties with
  546. +this License.
  547. +
  548. + 11. If, as a consequence of a court judgment or allegation of patent
  549. +infringement or for any other reason (not limited to patent issues),
  550. +conditions are imposed on you (whether by court order, agreement or
  551. +otherwise) that contradict the conditions of this License, they do not
  552. +excuse you from the conditions of this License. If you cannot
  553. +distribute so as to satisfy simultaneously your obligations under this
  554. +License and any other pertinent obligations, then as a consequence you
  555. +may not distribute the Library at all. For example, if a patent
  556. +license would not permit royalty-free redistribution of the Library by
  557. +all those who receive copies directly or indirectly through you, then
  558. +the only way you could satisfy both it and this License would be to
  559. +refrain entirely from distribution of the Library.
  560. +
  561. +If any portion of this section is held invalid or unenforceable under any
  562. +particular circumstance, the balance of the section is intended to apply,
  563. +and the section as a whole is intended to apply in other circumstances.
  564. +
  565. +It is not the purpose of this section to induce you to infringe any
  566. +patents or other property right claims or to contest validity of any
  567. +such claims; this section has the sole purpose of protecting the
  568. +integrity of the free software distribution system which is
  569. +implemented by public license practices. Many people have made
  570. +generous contributions to the wide range of software distributed
  571. +through that system in reliance on consistent application of that
  572. +system; it is up to the author/donor to decide if he or she is willing
  573. +to distribute software through any other system and a licensee cannot
  574. +impose that choice.
  575. +
  576. +This section is intended to make thoroughly clear what is believed to
  577. +be a consequence of the rest of this License.
  578. +
  579. + 12. If the distribution and/or use of the Library is restricted in
  580. +certain countries either by patents or by copyrighted interfaces, the
  581. +original copyright holder who places the Library under this License may add
  582. +an explicit geographical distribution limitation excluding those countries,
  583. +so that distribution is permitted only in or among countries not thus
  584. +excluded. In such case, this License incorporates the limitation as if
  585. +written in the body of this License.
  586. +
  587. + 13. The Free Software Foundation may publish revised and/or new
  588. +versions of the Lesser General Public License from time to time.
  589. +Such new versions will be similar in spirit to the present version,
  590. +but may differ in detail to address new problems or concerns.
  591. +
  592. +Each version is given a distinguishing version number. If the Library
  593. +specifies a version number of this License which applies to it and
  594. +"any later version", you have the option of following the terms and
  595. +conditions either of that version or of any later version published by
  596. +the Free Software Foundation. If the Library does not specify a
  597. +license version number, you may choose any version ever published by
  598. +the Free Software Foundation.
  599. +
  600. + 14. If you wish to incorporate parts of the Library into other free
  601. +programs whose distribution conditions are incompatible with these,
  602. +write to the author to ask for permission. For software which is
  603. +copyrighted by the Free Software Foundation, write to the Free
  604. +Software Foundation; we sometimes make exceptions for this. Our
  605. +decision will be guided by the two goals of preserving the free status
  606. +of all derivatives of our free software and of promoting the sharing
  607. +and reuse of software generally.
  608. +
  609. + NO WARRANTY
  610. +
  611. + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
  612. +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
  613. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
  614. +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
  615. +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
  616. +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  617. +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
  618. +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
  619. +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
  620. +
  621. + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
  622. +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
  623. +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
  624. +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
  625. +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
  626. +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
  627. +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
  628. +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
  629. +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
  630. +DAMAGES.
  631. +
  632. + END OF TERMS AND CONDITIONS
  633. +
  634. + How to Apply These Terms to Your New Libraries
  635. +
  636. + If you develop a new library, and you want it to be of the greatest
  637. +possible use to the public, we recommend making it free software that
  638. +everyone can redistribute and change. You can do so by permitting
  639. +redistribution under these terms (or, alternatively, under the terms of the
  640. +ordinary General Public License).
  641. +
  642. + To apply these terms, attach the following notices to the library. It is
  643. +safest to attach them to the start of each source file to most effectively
  644. +convey the exclusion of warranty; and each file should have at least the
  645. +"copyright" line and a pointer to where the full notice is found.
  646. +
  647. + <one line to give the library's name and a brief idea of what it does.>
  648. + Copyright (C) <year> <name of author>
  649. +
  650. + This library is free software; you can redistribute it and/or
  651. + modify it under the terms of the GNU Lesser General Public
  652. + License as published by the Free Software Foundation; either
  653. + version 2.1 of the License, or (at your option) any later version.
  654. +
  655. + This library is distributed in the hope that it will be useful,
  656. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  657. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  658. + Lesser General Public License for more details.
  659. +
  660. + You should have received a copy of the GNU Lesser General Public
  661. + License along with this library; if not, write to the Free Software
  662. + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  663. +
  664. +Also add information on how to contact you by electronic and paper mail.
  665. +
  666. +You should also get your employer (if you work as a programmer) or your
  667. +school, if any, to sign a "copyright disclaimer" for the library, if
  668. +necessary. Here is a sample; alter the names:
  669. +
  670. + Yoyodyne, Inc., hereby disclaims all copyright interest in the
  671. + library `Frob' (a library for tweaking knobs) written by James Random Hacker.
  672. +
  673. + <signature of Ty Coon>, 1 April 1990
  674. + Ty Coon, President of Vice
  675. +
  676. +That's all there is to it!
  677. +
  678. +
  679. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/avcodec.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/avcodec.h
  680. new file mode 100644
  681. index 00000000..c7e6b609
  682. --- /dev/null
  683. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/avcodec.h
  684. @@ -0,0 +1,3230 @@
  685. +/*
  686. + * copyright (c) 2001 Fabrice Bellard
  687. + *
  688. + * This file is part of FFmpeg.
  689. + *
  690. + * FFmpeg is free software; you can redistribute it and/or
  691. + * modify it under the terms of the GNU Lesser General Public
  692. + * License as published by the Free Software Foundation; either
  693. + * version 2.1 of the License, or (at your option) any later version.
  694. + *
  695. + * FFmpeg is distributed in the hope that it will be useful,
  696. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  697. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  698. + * Lesser General Public License for more details.
  699. + *
  700. + * You should have received a copy of the GNU Lesser General Public
  701. + * License along with FFmpeg; if not, write to the Free Software
  702. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  703. + */
  704. +
  705. +#ifndef AVCODEC_AVCODEC_H
  706. +#define AVCODEC_AVCODEC_H
  707. +
  708. +/**
  709. + * @file
  710. + * @ingroup libavc
  711. + * Libavcodec external API header
  712. + */
  713. +
  714. +#include "libavutil/samplefmt.h"
  715. +#include "libavutil/attributes.h"
  716. +#include "libavutil/avutil.h"
  717. +#include "libavutil/buffer.h"
  718. +#include "libavutil/dict.h"
  719. +#include "libavutil/frame.h"
  720. +#include "libavutil/log.h"
  721. +#include "libavutil/pixfmt.h"
  722. +#include "libavutil/rational.h"
  723. +
  724. +#include "codec.h"
  725. +#include "codec_desc.h"
  726. +#include "codec_par.h"
  727. +#include "codec_id.h"
  728. +#include "defs.h"
  729. +#include "packet.h"
  730. +#include "version_major.h"
  731. +#ifndef HAVE_AV_CONFIG_H
  732. +/* When included as part of the ffmpeg build, only include the major version
  733. + * to avoid unnecessary rebuilds. When included externally, keep including
  734. + * the full version information. */
  735. +# include "version.h"
  736. +#endif
  737. +
  738. +/**
  739. + * @defgroup libavc libavcodec
  740. + * Encoding/Decoding Library
  741. + *
  742. + * @{
  743. + *
  744. + * @defgroup lavc_decoding Decoding
  745. + * @{
  746. + * @}
  747. + *
  748. + * @defgroup lavc_encoding Encoding
  749. + * @{
  750. + * @}
  751. + *
  752. + * @defgroup lavc_codec Codecs
  753. + * @{
  754. + * @defgroup lavc_codec_native Native Codecs
  755. + * @{
  756. + * @}
  757. + * @defgroup lavc_codec_wrappers External library wrappers
  758. + * @{
  759. + * @}
  760. + * @defgroup lavc_codec_hwaccel Hardware Accelerators bridge
  761. + * @{
  762. + * @}
  763. + * @}
  764. + * @defgroup lavc_internal Internal
  765. + * @{
  766. + * @}
  767. + * @}
  768. + */
  769. +
  770. +/**
  771. + * @ingroup libavc
  772. + * @defgroup lavc_encdec send/receive encoding and decoding API overview
  773. + * @{
  774. + *
  775. + * The avcodec_send_packet()/avcodec_receive_frame()/avcodec_send_frame()/
  776. + * avcodec_receive_packet() functions provide an encode/decode API, which
  777. + * decouples input and output.
  778. + *
  779. + * The API is very similar for encoding/decoding and audio/video, and works as
  780. + * follows:
  781. + * - Set up and open the AVCodecContext as usual.
  782. + * - Send valid input:
  783. + * - For decoding, call avcodec_send_packet() to give the decoder raw
  784. + * compressed data in an AVPacket.
  785. + * - For encoding, call avcodec_send_frame() to give the encoder an AVFrame
  786. + * containing uncompressed audio or video.
  787. + *
  788. + * In both cases, it is recommended that AVPackets and AVFrames are
  789. + * refcounted, or libavcodec might have to copy the input data. (libavformat
  790. + * always returns refcounted AVPackets, and av_frame_get_buffer() allocates
  791. + * refcounted AVFrames.)
  792. + * - Receive output in a loop. Periodically call one of the avcodec_receive_*()
  793. + * functions and process their output:
  794. + * - For decoding, call avcodec_receive_frame(). On success, it will return
  795. + * an AVFrame containing uncompressed audio or video data.
  796. + * - For encoding, call avcodec_receive_packet(). On success, it will return
  797. + * an AVPacket with a compressed frame.
  798. + *
  799. + * Repeat this call until it returns AVERROR(EAGAIN) or an error. The
  800. + * AVERROR(EAGAIN) return value means that new input data is required to
  801. + * return new output. In this case, continue with sending input. For each
  802. + * input frame/packet, the codec will typically return 1 output frame/packet,
  803. + * but it can also be 0 or more than 1.
  804. + *
  805. + * At the beginning of decoding or encoding, the codec might accept multiple
  806. + * input frames/packets without returning a frame, until its internal buffers
  807. + * are filled. This situation is handled transparently if you follow the steps
  808. + * outlined above.
  809. + *
  810. + * In theory, sending input can result in EAGAIN - this should happen only if
  811. + * not all output was received. You can use this to structure alternative decode
  812. + * or encode loops other than the one suggested above. For example, you could
  813. + * try sending new input on each iteration, and try to receive output if that
  814. + * returns EAGAIN.
  815. + *
  816. + * End of stream situations. These require "flushing" (aka draining) the codec,
  817. + * as the codec might buffer multiple frames or packets internally for
  818. + * performance or out of necessity (consider B-frames).
  819. + * This is handled as follows:
  820. + * - Instead of valid input, send NULL to the avcodec_send_packet() (decoding)
  821. + * or avcodec_send_frame() (encoding) functions. This will enter draining
  822. + * mode.
  823. + * - Call avcodec_receive_frame() (decoding) or avcodec_receive_packet()
  824. + * (encoding) in a loop until AVERROR_EOF is returned. The functions will
  825. + * not return AVERROR(EAGAIN), unless you forgot to enter draining mode.
  826. + * - Before decoding can be resumed again, the codec has to be reset with
  827. + * avcodec_flush_buffers().
  828. + *
  829. + * Using the API as outlined above is highly recommended. But it is also
  830. + * possible to call functions outside of this rigid schema. For example, you can
  831. + * call avcodec_send_packet() repeatedly without calling
  832. + * avcodec_receive_frame(). In this case, avcodec_send_packet() will succeed
  833. + * until the codec's internal buffer has been filled up (which is typically of
  834. + * size 1 per output frame, after initial input), and then reject input with
  835. + * AVERROR(EAGAIN). Once it starts rejecting input, you have no choice but to
  836. + * read at least some output.
  837. + *
  838. + * Not all codecs will follow a rigid and predictable dataflow; the only
  839. + * guarantee is that an AVERROR(EAGAIN) return value on a send/receive call on
  840. + * one end implies that a receive/send call on the other end will succeed, or
  841. + * at least will not fail with AVERROR(EAGAIN). In general, no codec will
  842. + * permit unlimited buffering of input or output.
  843. + *
  844. + * A codec is not allowed to return AVERROR(EAGAIN) for both sending and
  845. + * receiving. This would be an invalid state, which could put the codec user
  846. + * into an endless loop. The API has no concept of time either: it cannot happen
  847. + * that trying to do avcodec_send_packet() results in AVERROR(EAGAIN), but a
  848. + * repeated call 1 second later accepts the packet (with no other receive/flush
  849. + * API calls involved). The API is a strict state machine, and the passage of
  850. + * time is not supposed to influence it. Some timing-dependent behavior might
  851. + * still be deemed acceptable in certain cases. But it must never result in both
  852. + * send/receive returning EAGAIN at the same time at any point. It must also
  853. + * absolutely be avoided that the current state is "unstable" and can
  854. + * "flip-flop" between the send/receive APIs allowing progress. For example,
  855. + * it's not allowed that the codec randomly decides that it actually wants to
  856. + * consume a packet now instead of returning a frame, after it just returned
  857. + * AVERROR(EAGAIN) on an avcodec_send_packet() call.
  858. + * @}
  859. + */
  860. +
  861. +/**
  862. + * @defgroup lavc_core Core functions/structures.
  863. + * @ingroup libavc
  864. + *
  865. + * Basic definitions, functions for querying libavcodec capabilities,
  866. + * allocating core structures, etc.
  867. + * @{
  868. + */
  869. +
  870. +/**
  871. + * @ingroup lavc_encoding
  872. + * minimum encoding buffer size
  873. + * Used to avoid some checks during header writing.
  874. + */
  875. +#define AV_INPUT_BUFFER_MIN_SIZE 16384
  876. +
  877. +/**
  878. + * @ingroup lavc_encoding
  879. + */
  880. +typedef struct RcOverride {
  881. + int start_frame;
  882. + int end_frame;
  883. + int qscale; // If this is 0 then quality_factor will be used instead.
  884. + float quality_factor;
  885. +} RcOverride;
  886. +
  887. +/* encoding support
  888. + These flags can be passed in AVCodecContext.flags before initialization.
  889. + Note: Not everything is supported yet.
  890. +*/
  891. +
  892. +/**
  893. + * Allow decoders to produce frames with data planes that are not aligned
  894. + * to CPU requirements (e.g. due to cropping).
  895. + */
  896. +#define AV_CODEC_FLAG_UNALIGNED (1 << 0)
  897. +/**
  898. + * Use fixed qscale.
  899. + */
  900. +#define AV_CODEC_FLAG_QSCALE (1 << 1)
  901. +/**
  902. + * 4 MV per MB allowed / advanced prediction for H.263.
  903. + */
  904. +#define AV_CODEC_FLAG_4MV (1 << 2)
  905. +/**
  906. + * Output even those frames that might be corrupted.
  907. + */
  908. +#define AV_CODEC_FLAG_OUTPUT_CORRUPT (1 << 3)
  909. +/**
  910. + * Use qpel MC.
  911. + */
  912. +#define AV_CODEC_FLAG_QPEL (1 << 4)
  913. +/**
  914. + * Don't output frames whose parameters differ from first
  915. + * decoded frame in stream.
  916. + */
  917. +#define AV_CODEC_FLAG_DROPCHANGED (1 << 5)
  918. +/**
  919. + * Request the encoder to output reconstructed frames, i.e.\ frames that would
  920. + * be produced by decoding the encoded bistream. These frames may be retrieved
  921. + * by calling avcodec_receive_frame() immediately after a successful call to
  922. + * avcodec_receive_packet().
  923. + *
  924. + * Should only be used with encoders flagged with the
  925. + * @ref AV_CODEC_CAP_ENCODER_RECON_FRAME capability.
  926. + */
  927. +#define AV_CODEC_FLAG_RECON_FRAME (1 << 6)
  928. +/**
  929. + * @par decoding
  930. + * Request the decoder to propagate each packets AVPacket.opaque and
  931. + * AVPacket.opaque_ref to its corresponding output AVFrame.
  932. + *
  933. + * @par encoding:
  934. + * Request the encoder to propagate each frame's AVFrame.opaque and
  935. + * AVFrame.opaque_ref values to its corresponding output AVPacket.
  936. + *
  937. + * @par
  938. + * May only be set on encoders that have the
  939. + * @ref AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE capability flag.
  940. + *
  941. + * @note
  942. + * While in typical cases one input frame produces exactly one output packet
  943. + * (perhaps after a delay), in general the mapping of frames to packets is
  944. + * M-to-N, so
  945. + * - Any number of input frames may be associated with any given output packet.
  946. + * This includes zero - e.g. some encoders may output packets that carry only
  947. + * metadata about the whole stream.
  948. + * - A given input frame may be associated with any number of output packets.
  949. + * Again this includes zero - e.g. some encoders may drop frames under certain
  950. + * conditions.
  951. + * .
  952. + * This implies that when using this flag, the caller must NOT assume that
  953. + * - a given input frame's opaques will necessarily appear on some output
  954. + * packet;
  955. + * - every output packet will have some non-NULL opaque value.
  956. + * .
  957. + * When an output packet contains multiple frames, the opaque values will be
  958. + * taken from the first of those.
  959. + *
  960. + * @note
  961. + * The converse holds for decoders, with frames and packets switched.
  962. + */
  963. +#define AV_CODEC_FLAG_COPY_OPAQUE (1 << 7)
  964. +/**
  965. + * Signal to the encoder that the values of AVFrame.duration are valid and
  966. + * should be used (typically for transferring them to output packets).
  967. + *
  968. + * If this flag is not set, frame durations are ignored.
  969. + */
  970. +#define AV_CODEC_FLAG_FRAME_DURATION (1 << 8)
  971. +/**
  972. + * Use internal 2pass ratecontrol in first pass mode.
  973. + */
  974. +#define AV_CODEC_FLAG_PASS1 (1 << 9)
  975. +/**
  976. + * Use internal 2pass ratecontrol in second pass mode.
  977. + */
  978. +#define AV_CODEC_FLAG_PASS2 (1 << 10)
  979. +/**
  980. + * loop filter.
  981. + */
  982. +#define AV_CODEC_FLAG_LOOP_FILTER (1 << 11)
  983. +/**
  984. + * Only decode/encode grayscale.
  985. + */
  986. +#define AV_CODEC_FLAG_GRAY (1 << 13)
  987. +/**
  988. + * error[?] variables will be set during encoding.
  989. + */
  990. +#define AV_CODEC_FLAG_PSNR (1 << 15)
  991. +/**
  992. + * Use interlaced DCT.
  993. + */
  994. +#define AV_CODEC_FLAG_INTERLACED_DCT (1 << 18)
  995. +/**
  996. + * Force low delay.
  997. + */
  998. +#define AV_CODEC_FLAG_LOW_DELAY (1 << 19)
  999. +/**
  1000. + * Place global headers in extradata instead of every keyframe.
  1001. + */
  1002. +#define AV_CODEC_FLAG_GLOBAL_HEADER (1 << 22)
  1003. +/**
  1004. + * Use only bitexact stuff (except (I)DCT).
  1005. + */
  1006. +#define AV_CODEC_FLAG_BITEXACT (1 << 23)
  1007. +/* Fx : Flag for H.263+ extra options */
  1008. +/**
  1009. + * H.263 advanced intra coding / MPEG-4 AC prediction
  1010. + */
  1011. +#define AV_CODEC_FLAG_AC_PRED (1 << 24)
  1012. +/**
  1013. + * interlaced motion estimation
  1014. + */
  1015. +#define AV_CODEC_FLAG_INTERLACED_ME (1 << 29)
  1016. +#define AV_CODEC_FLAG_CLOSED_GOP (1U << 31)
  1017. +
  1018. +/**
  1019. + * Allow non spec compliant speedup tricks.
  1020. + */
  1021. +#define AV_CODEC_FLAG2_FAST (1 << 0)
  1022. +/**
  1023. + * Skip bitstream encoding.
  1024. + */
  1025. +#define AV_CODEC_FLAG2_NO_OUTPUT (1 << 2)
  1026. +/**
  1027. + * Place global headers at every keyframe instead of in extradata.
  1028. + */
  1029. +#define AV_CODEC_FLAG2_LOCAL_HEADER (1 << 3)
  1030. +
  1031. +/**
  1032. + * Input bitstream might be truncated at a packet boundaries
  1033. + * instead of only at frame boundaries.
  1034. + */
  1035. +#define AV_CODEC_FLAG2_CHUNKS (1 << 15)
  1036. +/**
  1037. + * Discard cropping information from SPS.
  1038. + */
  1039. +#define AV_CODEC_FLAG2_IGNORE_CROP (1 << 16)
  1040. +
  1041. +/**
  1042. + * Show all frames before the first keyframe
  1043. + */
  1044. +#define AV_CODEC_FLAG2_SHOW_ALL (1 << 22)
  1045. +/**
  1046. + * Export motion vectors through frame side data
  1047. + */
  1048. +#define AV_CODEC_FLAG2_EXPORT_MVS (1 << 28)
  1049. +/**
  1050. + * Do not skip samples and export skip information as frame side data
  1051. + */
  1052. +#define AV_CODEC_FLAG2_SKIP_MANUAL (1 << 29)
  1053. +/**
  1054. + * Do not reset ASS ReadOrder field on flush (subtitles decoding)
  1055. + */
  1056. +#define AV_CODEC_FLAG2_RO_FLUSH_NOOP (1 << 30)
  1057. +/**
  1058. + * Generate/parse ICC profiles on encode/decode, as appropriate for the type of
  1059. + * file. No effect on codecs which cannot contain embedded ICC profiles, or
  1060. + * when compiled without support for lcms2.
  1061. + */
  1062. +#define AV_CODEC_FLAG2_ICC_PROFILES (1U << 31)
  1063. +
  1064. +/* Exported side data.
  1065. + These flags can be passed in AVCodecContext.export_side_data before
  1066. + initialization.
  1067. +*/
  1068. +/**
  1069. + * Export motion vectors through frame side data
  1070. + */
  1071. +#define AV_CODEC_EXPORT_DATA_MVS (1 << 0)
  1072. +/**
  1073. + * Export encoder Producer Reference Time through packet side data
  1074. + */
  1075. +#define AV_CODEC_EXPORT_DATA_PRFT (1 << 1)
  1076. +/**
  1077. + * Decoding only.
  1078. + * Export the AVVideoEncParams structure through frame side data.
  1079. + */
  1080. +#define AV_CODEC_EXPORT_DATA_VIDEO_ENC_PARAMS (1 << 2)
  1081. +/**
  1082. + * Decoding only.
  1083. + * Do not apply film grain, export it instead.
  1084. + */
  1085. +#define AV_CODEC_EXPORT_DATA_FILM_GRAIN (1 << 3)
  1086. +
  1087. +/**
  1088. + * The decoder will keep a reference to the frame and may reuse it later.
  1089. + */
  1090. +#define AV_GET_BUFFER_FLAG_REF (1 << 0)
  1091. +
  1092. +/**
  1093. + * The encoder will keep a reference to the packet and may reuse it later.
  1094. + */
  1095. +#define AV_GET_ENCODE_BUFFER_FLAG_REF (1 << 0)
  1096. +
  1097. +struct AVCodecInternal;
  1098. +
  1099. +/**
  1100. + * main external API structure.
  1101. + * New fields can be added to the end with minor version bumps.
  1102. + * Removal, reordering and changes to existing fields require a major
  1103. + * version bump.
  1104. + * You can use AVOptions (av_opt* / av_set/get*()) to access these fields from
  1105. + * user applications. The name string for AVOptions options matches the
  1106. + * associated command line parameter name and can be found in
  1107. + * libavcodec/options_table.h The AVOption/command line parameter names differ
  1108. + * in some cases from the C structure field names for historic reasons or
  1109. + * brevity. sizeof(AVCodecContext) must not be used outside libav*.
  1110. + */
  1111. +typedef struct AVCodecContext {
  1112. + /**
  1113. + * information on struct for av_log
  1114. + * - set by avcodec_alloc_context3
  1115. + */
  1116. + const AVClass* av_class;
  1117. + int log_level_offset;
  1118. +
  1119. + enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */
  1120. + const struct AVCodec* codec;
  1121. + enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */
  1122. +
  1123. + /**
  1124. + * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
  1125. + * This is used to work around some encoder bugs.
  1126. + * A demuxer should set this to what is stored in the field used to identify
  1127. + * the codec. If there are multiple such fields in a container then the
  1128. + * demuxer should choose the one which maximizes the information about the
  1129. + * used codec. If the codec tag field in a container is larger than 32 bits
  1130. + * then the demuxer should remap the longer ID to 32 bits with a table or
  1131. + * other structure. Alternatively a new extra_codec_tag + size could be added
  1132. + * but for this a clear advantage must be demonstrated first.
  1133. + * - encoding: Set by user, if not then the default based on codec_id will be
  1134. + * used.
  1135. + * - decoding: Set by user, will be converted to uppercase by libavcodec
  1136. + * during init.
  1137. + */
  1138. + unsigned int codec_tag;
  1139. +
  1140. + void* priv_data;
  1141. +
  1142. + /**
  1143. + * Private context used for internal data.
  1144. + *
  1145. + * Unlike priv_data, this is not codec-specific. It is used in general
  1146. + * libavcodec functions.
  1147. + */
  1148. + struct AVCodecInternal* internal;
  1149. +
  1150. + /**
  1151. + * Private data of the user, can be used to carry app specific stuff.
  1152. + * - encoding: Set by user.
  1153. + * - decoding: Set by user.
  1154. + */
  1155. + void* opaque;
  1156. +
  1157. + /**
  1158. + * the average bitrate
  1159. + * - encoding: Set by user; unused for constant quantizer encoding.
  1160. + * - decoding: Set by user, may be overwritten by libavcodec
  1161. + * if this info is available in the stream
  1162. + */
  1163. + int64_t bit_rate;
  1164. +
  1165. + /**
  1166. + * number of bits the bitstream is allowed to diverge from the reference.
  1167. + * the reference can be CBR (for CBR pass1) or VBR (for pass2)
  1168. + * - encoding: Set by user; unused for constant quantizer encoding.
  1169. + * - decoding: unused
  1170. + */
  1171. + int bit_rate_tolerance;
  1172. +
  1173. + /**
  1174. + * Global quality for codecs which cannot change it per frame.
  1175. + * This should be proportional to MPEG-1/2/4 qscale.
  1176. + * - encoding: Set by user.
  1177. + * - decoding: unused
  1178. + */
  1179. + int global_quality;
  1180. +
  1181. + /**
  1182. + * - encoding: Set by user.
  1183. + * - decoding: unused
  1184. + */
  1185. + int compression_level;
  1186. +#define FF_COMPRESSION_DEFAULT -1
  1187. +
  1188. + /**
  1189. + * AV_CODEC_FLAG_*.
  1190. + * - encoding: Set by user.
  1191. + * - decoding: Set by user.
  1192. + */
  1193. + int flags;
  1194. +
  1195. + /**
  1196. + * AV_CODEC_FLAG2_*
  1197. + * - encoding: Set by user.
  1198. + * - decoding: Set by user.
  1199. + */
  1200. + int flags2;
  1201. +
  1202. + /**
  1203. + * some codecs need / can use extradata like Huffman tables.
  1204. + * MJPEG: Huffman tables
  1205. + * rv10: additional flags
  1206. + * MPEG-4: global headers (they can be in the bitstream or here)
  1207. + * The allocated memory should be AV_INPUT_BUFFER_PADDING_SIZE bytes larger
  1208. + * than extradata_size to avoid problems if it is read with the bitstream
  1209. + * reader. The bytewise contents of extradata must not depend on the
  1210. + * architecture or CPU endianness. Must be allocated with the av_malloc()
  1211. + * family of functions.
  1212. + * - encoding: Set/allocated/freed by libavcodec.
  1213. + * - decoding: Set/allocated/freed by user.
  1214. + */
  1215. + uint8_t* extradata;
  1216. + int extradata_size;
  1217. +
  1218. + /**
  1219. + * This is the fundamental unit of time (in seconds) in terms
  1220. + * of which frame timestamps are represented. For fixed-fps content,
  1221. + * timebase should be 1/framerate and timestamp increments should be
  1222. + * identically 1.
  1223. + * This often, but not always is the inverse of the frame rate or field rate
  1224. + * for video. 1/time_base is not the average frame rate if the frame rate is
  1225. + * not constant.
  1226. + *
  1227. + * Like containers, elementary streams also can store timestamps, 1/time_base
  1228. + * is the unit in which these timestamps are specified.
  1229. + * As example of such codec time base see ISO/IEC 14496-2:2001(E)
  1230. + * vop_time_increment_resolution and fixed_vop_rate
  1231. + * (fixed_vop_rate == 0 implies that it is different from the framerate)
  1232. + *
  1233. + * - encoding: MUST be set by user.
  1234. + * - decoding: unused.
  1235. + */
  1236. + AVRational time_base;
  1237. +
  1238. + /**
  1239. + * For some codecs, the time base is closer to the field rate than the frame
  1240. + * rate. Most notably, H.264 and MPEG-2 specify time_base as half of frame
  1241. + * duration if no telecine is used ...
  1242. + *
  1243. + * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it
  1244. + * to 2.
  1245. + */
  1246. + int ticks_per_frame;
  1247. +
  1248. + /**
  1249. + * Codec delay.
  1250. + *
  1251. + * Encoding: Number of frames delay there will be from the encoder input to
  1252. + * the decoder output. (we assume the decoder matches the spec)
  1253. + * Decoding: Number of frames delay in addition to what a standard decoder
  1254. + * as specified in the spec would produce.
  1255. + *
  1256. + * Video:
  1257. + * Number of frames the decoded output will be delayed relative to the
  1258. + * encoded input.
  1259. + *
  1260. + * Audio:
  1261. + * For encoding, this field is unused (see initial_padding).
  1262. + *
  1263. + * For decoding, this is the number of samples the decoder needs to
  1264. + * output before the decoder's output is valid. When seeking, you should
  1265. + * start decoding this many samples prior to your desired seek point.
  1266. + *
  1267. + * - encoding: Set by libavcodec.
  1268. + * - decoding: Set by libavcodec.
  1269. + */
  1270. + int delay;
  1271. +
  1272. + /* video only */
  1273. + /**
  1274. + * picture width / height.
  1275. + *
  1276. + * @note Those fields may not match the values of the last
  1277. + * AVFrame output by avcodec_receive_frame() due frame
  1278. + * reordering.
  1279. + *
  1280. + * - encoding: MUST be set by user.
  1281. + * - decoding: May be set by the user before opening the decoder if known e.g.
  1282. + * from the container. Some decoders will require the dimensions
  1283. + * to be set by the caller. During decoding, the decoder may
  1284. + * overwrite those values as required while parsing the data.
  1285. + */
  1286. + int width, height;
  1287. +
  1288. + /**
  1289. + * Bitstream width / height, may be different from width/height e.g. when
  1290. + * the decoded frame is cropped before being output or lowres is enabled.
  1291. + *
  1292. + * @note Those field may not match the value of the last
  1293. + * AVFrame output by avcodec_receive_frame() due frame
  1294. + * reordering.
  1295. + *
  1296. + * - encoding: unused
  1297. + * - decoding: May be set by the user before opening the decoder if known
  1298. + * e.g. from the container. During decoding, the decoder may
  1299. + * overwrite those values as required while parsing the data.
  1300. + */
  1301. + int coded_width, coded_height;
  1302. +
  1303. + /**
  1304. + * the number of pictures in a group of pictures, or 0 for intra_only
  1305. + * - encoding: Set by user.
  1306. + * - decoding: unused
  1307. + */
  1308. + int gop_size;
  1309. +
  1310. + /**
  1311. + * Pixel format, see AV_PIX_FMT_xxx.
  1312. + * May be set by the demuxer if known from headers.
  1313. + * May be overridden by the decoder if it knows better.
  1314. + *
  1315. + * @note This field may not match the value of the last
  1316. + * AVFrame output by avcodec_receive_frame() due frame
  1317. + * reordering.
  1318. + *
  1319. + * - encoding: Set by user.
  1320. + * - decoding: Set by user if known, overridden by libavcodec while
  1321. + * parsing the data.
  1322. + */
  1323. + enum AVPixelFormat pix_fmt;
  1324. +
  1325. + /**
  1326. + * If non NULL, 'draw_horiz_band' is called by the libavcodec
  1327. + * decoder to draw a horizontal band. It improves cache usage. Not
  1328. + * all codecs can do that. You must check the codec capabilities
  1329. + * beforehand.
  1330. + * When multithreading is used, it may be called from multiple threads
  1331. + * at the same time; threads might draw different parts of the same AVFrame,
  1332. + * or multiple AVFrames, and there is no guarantee that slices will be drawn
  1333. + * in order.
  1334. + * The function is also used by hardware acceleration APIs.
  1335. + * It is called at least once during frame decoding to pass
  1336. + * the data needed for hardware render.
  1337. + * In that mode instead of pixel data, AVFrame points to
  1338. + * a structure specific to the acceleration API. The application
  1339. + * reads the structure and can change some fields to indicate progress
  1340. + * or mark state.
  1341. + * - encoding: unused
  1342. + * - decoding: Set by user.
  1343. + * @param height the height of the slice
  1344. + * @param y the y position of the slice
  1345. + * @param type 1->top field, 2->bottom field, 3->frame
  1346. + * @param offset offset into the AVFrame.data from which the slice should be
  1347. + * read
  1348. + */
  1349. + void (*draw_horiz_band)(struct AVCodecContext* s, const AVFrame* src,
  1350. + int offset[AV_NUM_DATA_POINTERS], int y, int type,
  1351. + int height);
  1352. +
  1353. + /**
  1354. + * Callback to negotiate the pixel format. Decoding only, may be set by the
  1355. + * caller before avcodec_open2().
  1356. + *
  1357. + * Called by some decoders to select the pixel format that will be used for
  1358. + * the output frames. This is mainly used to set up hardware acceleration,
  1359. + * then the provided format list contains the corresponding hwaccel pixel
  1360. + * formats alongside the "software" one. The software pixel format may also
  1361. + * be retrieved from \ref sw_pix_fmt.
  1362. + *
  1363. + * This callback will be called when the coded frame properties (such as
  1364. + * resolution, pixel format, etc.) change and more than one output format is
  1365. + * supported for those new properties. If a hardware pixel format is chosen
  1366. + * and initialization for it fails, the callback may be called again
  1367. + * immediately.
  1368. + *
  1369. + * This callback may be called from different threads if the decoder is
  1370. + * multi-threaded, but not from more than one thread simultaneously.
  1371. + *
  1372. + * @param fmt list of formats which may be used in the current
  1373. + * configuration, terminated by AV_PIX_FMT_NONE.
  1374. + * @warning Behavior is undefined if the callback returns a value other
  1375. + * than one of the formats in fmt or AV_PIX_FMT_NONE.
  1376. + * @return the chosen format or AV_PIX_FMT_NONE
  1377. + */
  1378. + enum AVPixelFormat (*get_format)(struct AVCodecContext* s,
  1379. + const enum AVPixelFormat* fmt);
  1380. +
  1381. + /**
  1382. + * maximum number of B-frames between non-B-frames
  1383. + * Note: The output will be delayed by max_b_frames+1 relative to the input.
  1384. + * - encoding: Set by user.
  1385. + * - decoding: unused
  1386. + */
  1387. + int max_b_frames;
  1388. +
  1389. + /**
  1390. + * qscale factor between IP and B-frames
  1391. + * If > 0 then the last P-frame quantizer will be used (q=
  1392. + * lastp_q*factor+offset). If < 0 then normal ratecontrol will be done (q=
  1393. + * -normal_q*factor+offset).
  1394. + * - encoding: Set by user.
  1395. + * - decoding: unused
  1396. + */
  1397. + float b_quant_factor;
  1398. +
  1399. + /**
  1400. + * qscale offset between IP and B-frames
  1401. + * - encoding: Set by user.
  1402. + * - decoding: unused
  1403. + */
  1404. + float b_quant_offset;
  1405. +
  1406. + /**
  1407. + * Size of the frame reordering buffer in the decoder.
  1408. + * For MPEG-2 it is 1 IPB or 0 low delay IP.
  1409. + * - encoding: Set by libavcodec.
  1410. + * - decoding: Set by libavcodec.
  1411. + */
  1412. + int has_b_frames;
  1413. +
  1414. + /**
  1415. + * qscale factor between P- and I-frames
  1416. + * If > 0 then the last P-frame quantizer will be used (q = lastp_q * factor +
  1417. + * offset). If < 0 then normal ratecontrol will be done (q=
  1418. + * -normal_q*factor+offset).
  1419. + * - encoding: Set by user.
  1420. + * - decoding: unused
  1421. + */
  1422. + float i_quant_factor;
  1423. +
  1424. + /**
  1425. + * qscale offset between P and I-frames
  1426. + * - encoding: Set by user.
  1427. + * - decoding: unused
  1428. + */
  1429. + float i_quant_offset;
  1430. +
  1431. + /**
  1432. + * luminance masking (0-> disabled)
  1433. + * - encoding: Set by user.
  1434. + * - decoding: unused
  1435. + */
  1436. + float lumi_masking;
  1437. +
  1438. + /**
  1439. + * temporary complexity masking (0-> disabled)
  1440. + * - encoding: Set by user.
  1441. + * - decoding: unused
  1442. + */
  1443. + float temporal_cplx_masking;
  1444. +
  1445. + /**
  1446. + * spatial complexity masking (0-> disabled)
  1447. + * - encoding: Set by user.
  1448. + * - decoding: unused
  1449. + */
  1450. + float spatial_cplx_masking;
  1451. +
  1452. + /**
  1453. + * p block masking (0-> disabled)
  1454. + * - encoding: Set by user.
  1455. + * - decoding: unused
  1456. + */
  1457. + float p_masking;
  1458. +
  1459. + /**
  1460. + * darkness masking (0-> disabled)
  1461. + * - encoding: Set by user.
  1462. + * - decoding: unused
  1463. + */
  1464. + float dark_masking;
  1465. +
  1466. + /**
  1467. + * slice count
  1468. + * - encoding: Set by libavcodec.
  1469. + * - decoding: Set by user (or 0).
  1470. + */
  1471. + int slice_count;
  1472. +
  1473. + /**
  1474. + * slice offsets in the frame in bytes
  1475. + * - encoding: Set/allocated by libavcodec.
  1476. + * - decoding: Set/allocated by user (or NULL).
  1477. + */
  1478. + int* slice_offset;
  1479. +
  1480. + /**
  1481. + * sample aspect ratio (0 if unknown)
  1482. + * That is the width of a pixel divided by the height of the pixel.
  1483. + * Numerator and denominator must be relatively prime and smaller than 256 for
  1484. + * some video standards.
  1485. + * - encoding: Set by user.
  1486. + * - decoding: Set by libavcodec.
  1487. + */
  1488. + AVRational sample_aspect_ratio;
  1489. +
  1490. + /**
  1491. + * motion estimation comparison function
  1492. + * - encoding: Set by user.
  1493. + * - decoding: unused
  1494. + */
  1495. + int me_cmp;
  1496. + /**
  1497. + * subpixel motion estimation comparison function
  1498. + * - encoding: Set by user.
  1499. + * - decoding: unused
  1500. + */
  1501. + int me_sub_cmp;
  1502. + /**
  1503. + * macroblock comparison function (not supported yet)
  1504. + * - encoding: Set by user.
  1505. + * - decoding: unused
  1506. + */
  1507. + int mb_cmp;
  1508. + /**
  1509. + * interlaced DCT comparison function
  1510. + * - encoding: Set by user.
  1511. + * - decoding: unused
  1512. + */
  1513. + int ildct_cmp;
  1514. +#define FF_CMP_SAD 0
  1515. +#define FF_CMP_SSE 1
  1516. +#define FF_CMP_SATD 2
  1517. +#define FF_CMP_DCT 3
  1518. +#define FF_CMP_PSNR 4
  1519. +#define FF_CMP_BIT 5
  1520. +#define FF_CMP_RD 6
  1521. +#define FF_CMP_ZERO 7
  1522. +#define FF_CMP_VSAD 8
  1523. +#define FF_CMP_VSSE 9
  1524. +#define FF_CMP_NSSE 10
  1525. +#define FF_CMP_W53 11
  1526. +#define FF_CMP_W97 12
  1527. +#define FF_CMP_DCTMAX 13
  1528. +#define FF_CMP_DCT264 14
  1529. +#define FF_CMP_MEDIAN_SAD 15
  1530. +#define FF_CMP_CHROMA 256
  1531. +
  1532. + /**
  1533. + * ME diamond size & shape
  1534. + * - encoding: Set by user.
  1535. + * - decoding: unused
  1536. + */
  1537. + int dia_size;
  1538. +
  1539. + /**
  1540. + * amount of previous MV predictors (2a+1 x 2a+1 square)
  1541. + * - encoding: Set by user.
  1542. + * - decoding: unused
  1543. + */
  1544. + int last_predictor_count;
  1545. +
  1546. + /**
  1547. + * motion estimation prepass comparison function
  1548. + * - encoding: Set by user.
  1549. + * - decoding: unused
  1550. + */
  1551. + int me_pre_cmp;
  1552. +
  1553. + /**
  1554. + * ME prepass diamond size & shape
  1555. + * - encoding: Set by user.
  1556. + * - decoding: unused
  1557. + */
  1558. + int pre_dia_size;
  1559. +
  1560. + /**
  1561. + * subpel ME quality
  1562. + * - encoding: Set by user.
  1563. + * - decoding: unused
  1564. + */
  1565. + int me_subpel_quality;
  1566. +
  1567. + /**
  1568. + * maximum motion estimation search range in subpel units
  1569. + * If 0 then no limit.
  1570. + *
  1571. + * - encoding: Set by user.
  1572. + * - decoding: unused
  1573. + */
  1574. + int me_range;
  1575. +
  1576. + /**
  1577. + * slice flags
  1578. + * - encoding: unused
  1579. + * - decoding: Set by user.
  1580. + */
  1581. + int slice_flags;
  1582. +#define SLICE_FLAG_CODED_ORDER \
  1583. + 0x0001 ///< draw_horiz_band() is called in coded order instead of display
  1584. +#define SLICE_FLAG_ALLOW_FIELD \
  1585. + 0x0002 ///< allow draw_horiz_band() with field slices (MPEG-2 field pics)
  1586. +#define SLICE_FLAG_ALLOW_PLANE \
  1587. + 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
  1588. +
  1589. + /**
  1590. + * macroblock decision mode
  1591. + * - encoding: Set by user.
  1592. + * - decoding: unused
  1593. + */
  1594. + int mb_decision;
  1595. +#define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp
  1596. +#define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits
  1597. +#define FF_MB_DECISION_RD 2 ///< rate distortion
  1598. +
  1599. + /**
  1600. + * custom intra quantization matrix
  1601. + * Must be allocated with the av_malloc() family of functions, and will be
  1602. + * freed in avcodec_free_context().
  1603. + * - encoding: Set/allocated by user, freed by libavcodec. Can be NULL.
  1604. + * - decoding: Set/allocated/freed by libavcodec.
  1605. + */
  1606. + uint16_t* intra_matrix;
  1607. +
  1608. + /**
  1609. + * custom inter quantization matrix
  1610. + * Must be allocated with the av_malloc() family of functions, and will be
  1611. + * freed in avcodec_free_context().
  1612. + * - encoding: Set/allocated by user, freed by libavcodec. Can be NULL.
  1613. + * - decoding: Set/allocated/freed by libavcodec.
  1614. + */
  1615. + uint16_t* inter_matrix;
  1616. +
  1617. + /**
  1618. + * precision of the intra DC coefficient - 8
  1619. + * - encoding: Set by user.
  1620. + * - decoding: Set by libavcodec
  1621. + */
  1622. + int intra_dc_precision;
  1623. +
  1624. + /**
  1625. + * Number of macroblock rows at the top which are skipped.
  1626. + * - encoding: unused
  1627. + * - decoding: Set by user.
  1628. + */
  1629. + int skip_top;
  1630. +
  1631. + /**
  1632. + * Number of macroblock rows at the bottom which are skipped.
  1633. + * - encoding: unused
  1634. + * - decoding: Set by user.
  1635. + */
  1636. + int skip_bottom;
  1637. +
  1638. + /**
  1639. + * minimum MB Lagrange multiplier
  1640. + * - encoding: Set by user.
  1641. + * - decoding: unused
  1642. + */
  1643. + int mb_lmin;
  1644. +
  1645. + /**
  1646. + * maximum MB Lagrange multiplier
  1647. + * - encoding: Set by user.
  1648. + * - decoding: unused
  1649. + */
  1650. + int mb_lmax;
  1651. +
  1652. + /**
  1653. + * - encoding: Set by user.
  1654. + * - decoding: unused
  1655. + */
  1656. + int bidir_refine;
  1657. +
  1658. + /**
  1659. + * minimum GOP size
  1660. + * - encoding: Set by user.
  1661. + * - decoding: unused
  1662. + */
  1663. + int keyint_min;
  1664. +
  1665. + /**
  1666. + * number of reference frames
  1667. + * - encoding: Set by user.
  1668. + * - decoding: Set by lavc.
  1669. + */
  1670. + int refs;
  1671. +
  1672. + /**
  1673. + * Note: Value depends upon the compare function used for fullpel ME.
  1674. + * - encoding: Set by user.
  1675. + * - decoding: unused
  1676. + */
  1677. + int mv0_threshold;
  1678. +
  1679. + /**
  1680. + * Chromaticity coordinates of the source primaries.
  1681. + * - encoding: Set by user
  1682. + * - decoding: Set by libavcodec
  1683. + */
  1684. + enum AVColorPrimaries color_primaries;
  1685. +
  1686. + /**
  1687. + * Color Transfer Characteristic.
  1688. + * - encoding: Set by user
  1689. + * - decoding: Set by libavcodec
  1690. + */
  1691. + enum AVColorTransferCharacteristic color_trc;
  1692. +
  1693. + /**
  1694. + * YUV colorspace type.
  1695. + * - encoding: Set by user
  1696. + * - decoding: Set by libavcodec
  1697. + */
  1698. + enum AVColorSpace colorspace;
  1699. +
  1700. + /**
  1701. + * MPEG vs JPEG YUV range.
  1702. + * - encoding: Set by user
  1703. + * - decoding: Set by libavcodec
  1704. + */
  1705. + enum AVColorRange color_range;
  1706. +
  1707. + /**
  1708. + * This defines the location of chroma samples.
  1709. + * - encoding: Set by user
  1710. + * - decoding: Set by libavcodec
  1711. + */
  1712. + enum AVChromaLocation chroma_sample_location;
  1713. +
  1714. + /**
  1715. + * Number of slices.
  1716. + * Indicates number of picture subdivisions. Used for parallelized
  1717. + * decoding.
  1718. + * - encoding: Set by user
  1719. + * - decoding: unused
  1720. + */
  1721. + int slices;
  1722. +
  1723. + /** Field order
  1724. + * - encoding: set by libavcodec
  1725. + * - decoding: Set by user.
  1726. + */
  1727. + enum AVFieldOrder field_order;
  1728. +
  1729. + /* audio only */
  1730. + int sample_rate; ///< samples per second
  1731. +
  1732. +#if FF_API_OLD_CHANNEL_LAYOUT
  1733. + /**
  1734. + * number of audio channels
  1735. + * @deprecated use ch_layout.nb_channels
  1736. + */
  1737. + attribute_deprecated int channels;
  1738. +#endif
  1739. +
  1740. + /**
  1741. + * audio sample format
  1742. + * - encoding: Set by user.
  1743. + * - decoding: Set by libavcodec.
  1744. + */
  1745. + enum AVSampleFormat sample_fmt; ///< sample format
  1746. +
  1747. + /* The following data should not be initialized. */
  1748. + /**
  1749. + * Number of samples per channel in an audio frame.
  1750. + *
  1751. + * - encoding: set by libavcodec in avcodec_open2(). Each submitted frame
  1752. + * except the last must contain exactly frame_size samples per channel.
  1753. + * May be 0 when the codec has AV_CODEC_CAP_VARIABLE_FRAME_SIZE set, then
  1754. + * the frame size is not restricted.
  1755. + * - decoding: may be set by some decoders to indicate constant frame size
  1756. + */
  1757. + int frame_size;
  1758. +
  1759. +#if FF_API_AVCTX_FRAME_NUMBER
  1760. + /**
  1761. + * Frame counter, set by libavcodec.
  1762. + *
  1763. + * - decoding: total number of frames returned from the decoder so far.
  1764. + * - encoding: total number of frames passed to the encoder so far.
  1765. + *
  1766. + * @note the counter is not incremented if encoding/decoding resulted in
  1767. + * an error.
  1768. + * @deprecated use frame_num instead
  1769. + */
  1770. + attribute_deprecated int frame_number;
  1771. +#endif
  1772. +
  1773. + /**
  1774. + * number of bytes per packet if constant and known or 0
  1775. + * Used by some WAV based audio codecs.
  1776. + */
  1777. + int block_align;
  1778. +
  1779. + /**
  1780. + * Audio cutoff bandwidth (0 means "automatic")
  1781. + * - encoding: Set by user.
  1782. + * - decoding: unused
  1783. + */
  1784. + int cutoff;
  1785. +
  1786. +#if FF_API_OLD_CHANNEL_LAYOUT
  1787. + /**
  1788. + * Audio channel layout.
  1789. + * - encoding: set by user.
  1790. + * - decoding: set by user, may be overwritten by libavcodec.
  1791. + * @deprecated use ch_layout
  1792. + */
  1793. + attribute_deprecated uint64_t channel_layout;
  1794. +
  1795. + /**
  1796. + * Request decoder to use this channel layout if it can (0 for default)
  1797. + * - encoding: unused
  1798. + * - decoding: Set by user.
  1799. + * @deprecated use "downmix" codec private option
  1800. + */
  1801. + attribute_deprecated uint64_t request_channel_layout;
  1802. +#endif
  1803. +
  1804. + /**
  1805. + * Type of service that the audio stream conveys.
  1806. + * - encoding: Set by user.
  1807. + * - decoding: Set by libavcodec.
  1808. + */
  1809. + enum AVAudioServiceType audio_service_type;
  1810. +
  1811. + /**
  1812. + * desired sample format
  1813. + * - encoding: Not used.
  1814. + * - decoding: Set by user.
  1815. + * Decoder will decode to this format if it can.
  1816. + */
  1817. + enum AVSampleFormat request_sample_fmt;
  1818. +
  1819. + /**
  1820. + * This callback is called at the beginning of each frame to get data
  1821. + * buffer(s) for it. There may be one contiguous buffer for all the data or
  1822. + * there may be a buffer per each data plane or anything in between. What
  1823. + * this means is, you may set however many entries in buf[] you feel
  1824. + * necessary. Each buffer must be reference-counted using the AVBuffer API
  1825. + * (see description of buf[] below).
  1826. + *
  1827. + * The following fields will be set in the frame before this callback is
  1828. + * called:
  1829. + * - format
  1830. + * - width, height (video only)
  1831. + * - sample_rate, channel_layout, nb_samples (audio only)
  1832. + * Their values may differ from the corresponding values in
  1833. + * AVCodecContext. This callback must use the frame values, not the codec
  1834. + * context values, to calculate the required buffer size.
  1835. + *
  1836. + * This callback must fill the following fields in the frame:
  1837. + * - data[]
  1838. + * - linesize[]
  1839. + * - extended_data:
  1840. + * * if the data is planar audio with more than 8 channels, then this
  1841. + * callback must allocate and fill extended_data to contain all pointers
  1842. + * to all data planes. data[] must hold as many pointers as it can.
  1843. + * extended_data must be allocated with av_malloc() and will be freed in
  1844. + * av_frame_unref().
  1845. + * * otherwise extended_data must point to data
  1846. + * - buf[] must contain one or more pointers to AVBufferRef structures. Each
  1847. + * of the frame's data and extended_data pointers must be contained in these.
  1848. + * That is, one AVBufferRef for each allocated chunk of memory, not
  1849. + * necessarily one AVBufferRef per data[] entry. See: av_buffer_create(),
  1850. + * av_buffer_alloc(), and av_buffer_ref().
  1851. + * - extended_buf and nb_extended_buf must be allocated with av_malloc() by
  1852. + * this callback and filled with the extra buffers if there are more
  1853. + * buffers than buf[] can hold. extended_buf will be freed in
  1854. + * av_frame_unref().
  1855. + *
  1856. + * If AV_CODEC_CAP_DR1 is not set then get_buffer2() must call
  1857. + * avcodec_default_get_buffer2() instead of providing buffers allocated by
  1858. + * some other means.
  1859. + *
  1860. + * Each data plane must be aligned to the maximum required by the target
  1861. + * CPU.
  1862. + *
  1863. + * @see avcodec_default_get_buffer2()
  1864. + *
  1865. + * Video:
  1866. + *
  1867. + * If AV_GET_BUFFER_FLAG_REF is set in flags then the frame may be reused
  1868. + * (read and/or written to if it is writable) later by libavcodec.
  1869. + *
  1870. + * avcodec_align_dimensions2() should be used to find the required width and
  1871. + * height, as they normally need to be rounded up to the next multiple of 16.
  1872. + *
  1873. + * Some decoders do not support linesizes changing between frames.
  1874. + *
  1875. + * If frame multithreading is used, this callback may be called from a
  1876. + * different thread, but not from more than one at once. Does not need to be
  1877. + * reentrant.
  1878. + *
  1879. + * @see avcodec_align_dimensions2()
  1880. + *
  1881. + * Audio:
  1882. + *
  1883. + * Decoders request a buffer of a particular size by setting
  1884. + * AVFrame.nb_samples prior to calling get_buffer2(). The decoder may,
  1885. + * however, utilize only part of the buffer by setting AVFrame.nb_samples
  1886. + * to a smaller value in the output frame.
  1887. + *
  1888. + * As a convenience, av_samples_get_buffer_size() and
  1889. + * av_samples_fill_arrays() in libavutil may be used by custom get_buffer2()
  1890. + * functions to find the required data size and to fill data pointers and
  1891. + * linesize. In AVFrame.linesize, only linesize[0] may be set for audio
  1892. + * since all planes must be the same size.
  1893. + *
  1894. + * @see av_samples_get_buffer_size(), av_samples_fill_arrays()
  1895. + *
  1896. + * - encoding: unused
  1897. + * - decoding: Set by libavcodec, user can override.
  1898. + */
  1899. + int (*get_buffer2)(struct AVCodecContext* s, AVFrame* frame, int flags);
  1900. +
  1901. + /* - encoding parameters */
  1902. + float qcompress; ///< amount of qscale change between easy & hard scenes
  1903. + ///< (0.0-1.0)
  1904. + float qblur; ///< amount of qscale smoothing over time (0.0-1.0)
  1905. +
  1906. + /**
  1907. + * minimum quantizer
  1908. + * - encoding: Set by user.
  1909. + * - decoding: unused
  1910. + */
  1911. + int qmin;
  1912. +
  1913. + /**
  1914. + * maximum quantizer
  1915. + * - encoding: Set by user.
  1916. + * - decoding: unused
  1917. + */
  1918. + int qmax;
  1919. +
  1920. + /**
  1921. + * maximum quantizer difference between frames
  1922. + * - encoding: Set by user.
  1923. + * - decoding: unused
  1924. + */
  1925. + int max_qdiff;
  1926. +
  1927. + /**
  1928. + * decoder bitstream buffer size
  1929. + * - encoding: Set by user.
  1930. + * - decoding: unused
  1931. + */
  1932. + int rc_buffer_size;
  1933. +
  1934. + /**
  1935. + * ratecontrol override, see RcOverride
  1936. + * - encoding: Allocated/set/freed by user.
  1937. + * - decoding: unused
  1938. + */
  1939. + int rc_override_count;
  1940. + RcOverride* rc_override;
  1941. +
  1942. + /**
  1943. + * maximum bitrate
  1944. + * - encoding: Set by user.
  1945. + * - decoding: Set by user, may be overwritten by libavcodec.
  1946. + */
  1947. + int64_t rc_max_rate;
  1948. +
  1949. + /**
  1950. + * minimum bitrate
  1951. + * - encoding: Set by user.
  1952. + * - decoding: unused
  1953. + */
  1954. + int64_t rc_min_rate;
  1955. +
  1956. + /**
  1957. + * Ratecontrol attempt to use, at maximum, <value> of what can be used without
  1958. + * an underflow.
  1959. + * - encoding: Set by user.
  1960. + * - decoding: unused.
  1961. + */
  1962. + float rc_max_available_vbv_use;
  1963. +
  1964. + /**
  1965. + * Ratecontrol attempt to use, at least, <value> times the amount needed to
  1966. + * prevent a vbv overflow.
  1967. + * - encoding: Set by user.
  1968. + * - decoding: unused.
  1969. + */
  1970. + float rc_min_vbv_overflow_use;
  1971. +
  1972. + /**
  1973. + * Number of bits which should be loaded into the rc buffer before decoding
  1974. + * starts.
  1975. + * - encoding: Set by user.
  1976. + * - decoding: unused
  1977. + */
  1978. + int rc_initial_buffer_occupancy;
  1979. +
  1980. + /**
  1981. + * trellis RD quantization
  1982. + * - encoding: Set by user.
  1983. + * - decoding: unused
  1984. + */
  1985. + int trellis;
  1986. +
  1987. + /**
  1988. + * pass1 encoding statistics output buffer
  1989. + * - encoding: Set by libavcodec.
  1990. + * - decoding: unused
  1991. + */
  1992. + char* stats_out;
  1993. +
  1994. + /**
  1995. + * pass2 encoding statistics input buffer
  1996. + * Concatenated stuff from stats_out of pass1 should be placed here.
  1997. + * - encoding: Allocated/set/freed by user.
  1998. + * - decoding: unused
  1999. + */
  2000. + char* stats_in;
  2001. +
  2002. + /**
  2003. + * Work around bugs in encoders which sometimes cannot be detected
  2004. + * automatically.
  2005. + * - encoding: Set by user
  2006. + * - decoding: Set by user
  2007. + */
  2008. + int workaround_bugs;
  2009. +#define FF_BUG_AUTODETECT 1 ///< autodetection
  2010. +#define FF_BUG_XVID_ILACE 4
  2011. +#define FF_BUG_UMP4 8
  2012. +#define FF_BUG_NO_PADDING 16
  2013. +#define FF_BUG_AMV 32
  2014. +#define FF_BUG_QPEL_CHROMA 64
  2015. +#define FF_BUG_STD_QPEL 128
  2016. +#define FF_BUG_QPEL_CHROMA2 256
  2017. +#define FF_BUG_DIRECT_BLOCKSIZE 512
  2018. +#define FF_BUG_EDGE 1024
  2019. +#define FF_BUG_HPEL_CHROMA 2048
  2020. +#define FF_BUG_DC_CLIP 4096
  2021. +#define FF_BUG_MS \
  2022. + 8192 ///< Work around various bugs in Microsoft's broken decoders.
  2023. +#define FF_BUG_TRUNCATED 16384
  2024. +#define FF_BUG_IEDGE 32768
  2025. +
  2026. + /**
  2027. + * strictly follow the standard (MPEG-4, ...).
  2028. + * - encoding: Set by user.
  2029. + * - decoding: Set by user.
  2030. + * Setting this to STRICT or higher means the encoder and decoder will
  2031. + * generally do stupid things, whereas setting it to unofficial or lower
  2032. + * will mean the encoder might produce output that is not supported by all
  2033. + * spec-compliant decoders. Decoders don't differentiate between normal,
  2034. + * unofficial and experimental (that is, they always try to decode things
  2035. + * when they can) unless they are explicitly asked to behave stupidly
  2036. + * (=strictly conform to the specs)
  2037. + * This may only be set to one of the FF_COMPLIANCE_* values in defs.h.
  2038. + */
  2039. + int strict_std_compliance;
  2040. +
  2041. + /**
  2042. + * error concealment flags
  2043. + * - encoding: unused
  2044. + * - decoding: Set by user.
  2045. + */
  2046. + int error_concealment;
  2047. +#define FF_EC_GUESS_MVS 1
  2048. +#define FF_EC_DEBLOCK 2
  2049. +#define FF_EC_FAVOR_INTER 256
  2050. +
  2051. + /**
  2052. + * debug
  2053. + * - encoding: Set by user.
  2054. + * - decoding: Set by user.
  2055. + */
  2056. + int debug;
  2057. +#define FF_DEBUG_PICT_INFO 1
  2058. +#define FF_DEBUG_RC 2
  2059. +#define FF_DEBUG_BITSTREAM 4
  2060. +#define FF_DEBUG_MB_TYPE 8
  2061. +#define FF_DEBUG_QP 16
  2062. +#define FF_DEBUG_DCT_COEFF 0x00000040
  2063. +#define FF_DEBUG_SKIP 0x00000080
  2064. +#define FF_DEBUG_STARTCODE 0x00000100
  2065. +#define FF_DEBUG_ER 0x00000400
  2066. +#define FF_DEBUG_MMCO 0x00000800
  2067. +#define FF_DEBUG_BUGS 0x00001000
  2068. +#define FF_DEBUG_BUFFERS 0x00008000
  2069. +#define FF_DEBUG_THREADS 0x00010000
  2070. +#define FF_DEBUG_GREEN_MD 0x00800000
  2071. +#define FF_DEBUG_NOMC 0x01000000
  2072. +
  2073. + /**
  2074. + * Error recognition; may misdetect some more or less valid parts as errors.
  2075. + * This is a bitfield of the AV_EF_* values defined in defs.h.
  2076. + *
  2077. + * - encoding: Set by user.
  2078. + * - decoding: Set by user.
  2079. + */
  2080. + int err_recognition;
  2081. +
  2082. +#if FF_API_REORDERED_OPAQUE
  2083. + /**
  2084. + * opaque 64-bit number (generally a PTS) that will be reordered and
  2085. + * output in AVFrame.reordered_opaque
  2086. + * - encoding: Set by libavcodec to the reordered_opaque of the input
  2087. + * frame corresponding to the last returned packet. Only
  2088. + * supported by encoders with the
  2089. + * AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE capability.
  2090. + * - decoding: Set by user.
  2091. + *
  2092. + * @deprecated Use AV_CODEC_FLAG_COPY_OPAQUE instead
  2093. + */
  2094. + attribute_deprecated int64_t reordered_opaque;
  2095. +#endif
  2096. +
  2097. + /**
  2098. + * Hardware accelerator in use
  2099. + * - encoding: unused.
  2100. + * - decoding: Set by libavcodec
  2101. + */
  2102. + const struct AVHWAccel* hwaccel;
  2103. +
  2104. + /**
  2105. + * Legacy hardware accelerator context.
  2106. + *
  2107. + * For some hardware acceleration methods, the caller may use this field to
  2108. + * signal hwaccel-specific data to the codec. The struct pointed to by this
  2109. + * pointer is hwaccel-dependent and defined in the respective header. Please
  2110. + * refer to the FFmpeg HW accelerator documentation to know how to fill
  2111. + * this.
  2112. + *
  2113. + * In most cases this field is optional - the necessary information may also
  2114. + * be provided to libavcodec through @ref hw_frames_ctx or @ref
  2115. + * hw_device_ctx (see avcodec_get_hw_config()). However, in some cases it
  2116. + * may be the only method of signalling some (optional) information.
  2117. + *
  2118. + * The struct and its contents are owned by the caller.
  2119. + *
  2120. + * - encoding: May be set by the caller before avcodec_open2(). Must remain
  2121. + * valid until avcodec_free_context().
  2122. + * - decoding: May be set by the caller in the get_format() callback.
  2123. + * Must remain valid until the next get_format() call,
  2124. + * or avcodec_free_context() (whichever comes first).
  2125. + */
  2126. + void* hwaccel_context;
  2127. +
  2128. + /**
  2129. + * error
  2130. + * - encoding: Set by libavcodec if flags & AV_CODEC_FLAG_PSNR.
  2131. + * - decoding: unused
  2132. + */
  2133. + uint64_t error[AV_NUM_DATA_POINTERS];
  2134. +
  2135. + /**
  2136. + * DCT algorithm, see FF_DCT_* below
  2137. + * - encoding: Set by user.
  2138. + * - decoding: unused
  2139. + */
  2140. + int dct_algo;
  2141. +#define FF_DCT_AUTO 0
  2142. +#define FF_DCT_FASTINT 1
  2143. +#define FF_DCT_INT 2
  2144. +#define FF_DCT_MMX 3
  2145. +#define FF_DCT_ALTIVEC 5
  2146. +#define FF_DCT_FAAN 6
  2147. +
  2148. + /**
  2149. + * IDCT algorithm, see FF_IDCT_* below.
  2150. + * - encoding: Set by user.
  2151. + * - decoding: Set by user.
  2152. + */
  2153. + int idct_algo;
  2154. +#define FF_IDCT_AUTO 0
  2155. +#define FF_IDCT_INT 1
  2156. +#define FF_IDCT_SIMPLE 2
  2157. +#define FF_IDCT_SIMPLEMMX 3
  2158. +#define FF_IDCT_ARM 7
  2159. +#define FF_IDCT_ALTIVEC 8
  2160. +#define FF_IDCT_SIMPLEARM 10
  2161. +#define FF_IDCT_XVID 14
  2162. +#define FF_IDCT_SIMPLEARMV5TE 16
  2163. +#define FF_IDCT_SIMPLEARMV6 17
  2164. +#define FF_IDCT_FAAN 20
  2165. +#define FF_IDCT_SIMPLENEON 22
  2166. +#if FF_API_IDCT_NONE
  2167. +// formerly used by xvmc
  2168. +# define FF_IDCT_NONE 24
  2169. +#endif
  2170. +#define FF_IDCT_SIMPLEAUTO 128
  2171. +
  2172. + /**
  2173. + * bits per sample/pixel from the demuxer (needed for huffyuv).
  2174. + * - encoding: Set by libavcodec.
  2175. + * - decoding: Set by user.
  2176. + */
  2177. + int bits_per_coded_sample;
  2178. +
  2179. + /**
  2180. + * Bits per sample/pixel of internal libavcodec pixel/sample format.
  2181. + * - encoding: set by user.
  2182. + * - decoding: set by libavcodec.
  2183. + */
  2184. + int bits_per_raw_sample;
  2185. +
  2186. + /**
  2187. + * low resolution decoding, 1-> 1/2 size, 2->1/4 size
  2188. + * - encoding: unused
  2189. + * - decoding: Set by user.
  2190. + */
  2191. + int lowres;
  2192. +
  2193. + /**
  2194. + * thread count
  2195. + * is used to decide how many independent tasks should be passed to execute()
  2196. + * - encoding: Set by user.
  2197. + * - decoding: Set by user.
  2198. + */
  2199. + int thread_count;
  2200. +
  2201. + /**
  2202. + * Which multithreading methods to use.
  2203. + * Use of FF_THREAD_FRAME will increase decoding delay by one frame per
  2204. + * thread, so clients which cannot provide future frames should not use it.
  2205. + *
  2206. + * - encoding: Set by user, otherwise the default is used.
  2207. + * - decoding: Set by user, otherwise the default is used.
  2208. + */
  2209. + int thread_type;
  2210. +#define FF_THREAD_FRAME 1 ///< Decode more than one frame at once
  2211. +#define FF_THREAD_SLICE \
  2212. + 2 ///< Decode more than one part of a single frame at once
  2213. +
  2214. + /**
  2215. + * Which multithreading methods are in use by the codec.
  2216. + * - encoding: Set by libavcodec.
  2217. + * - decoding: Set by libavcodec.
  2218. + */
  2219. + int active_thread_type;
  2220. +
  2221. + /**
  2222. + * The codec may call this to execute several independent things.
  2223. + * It will return only after finishing all tasks.
  2224. + * The user may replace this with some multithreaded implementation,
  2225. + * the default implementation will execute the parts serially.
  2226. + * @param count the number of things to execute
  2227. + * - encoding: Set by libavcodec, user can override.
  2228. + * - decoding: Set by libavcodec, user can override.
  2229. + */
  2230. + int (*execute)(struct AVCodecContext* c,
  2231. + int (*func)(struct AVCodecContext* c2, void* arg), void* arg2,
  2232. + int* ret, int count, int size);
  2233. +
  2234. + /**
  2235. + * The codec may call this to execute several independent things.
  2236. + * It will return only after finishing all tasks.
  2237. + * The user may replace this with some multithreaded implementation,
  2238. + * the default implementation will execute the parts serially.
  2239. + * @param c context passed also to func
  2240. + * @param count the number of things to execute
  2241. + * @param arg2 argument passed unchanged to func
  2242. + * @param ret return values of executed functions, must have space for "count"
  2243. + * values. May be NULL.
  2244. + * @param func function that will be called count times, with jobnr from 0 to
  2245. + * count-1. threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS
  2246. + * and so that no two instances of func executing at the same time will have
  2247. + * the same threadnr.
  2248. + * @return always 0 currently, but code should handle a future improvement
  2249. + * where when any call to func returns < 0 no further calls to func may be
  2250. + * done and < 0 is returned.
  2251. + * - encoding: Set by libavcodec, user can override.
  2252. + * - decoding: Set by libavcodec, user can override.
  2253. + */
  2254. + int (*execute2)(struct AVCodecContext* c,
  2255. + int (*func)(struct AVCodecContext* c2, void* arg, int jobnr,
  2256. + int threadnr),
  2257. + void* arg2, int* ret, int count);
  2258. +
  2259. + /**
  2260. + * noise vs. sse weight for the nsse comparison function
  2261. + * - encoding: Set by user.
  2262. + * - decoding: unused
  2263. + */
  2264. + int nsse_weight;
  2265. +
  2266. + /**
  2267. + * profile
  2268. + * - encoding: Set by user.
  2269. + * - decoding: Set by libavcodec.
  2270. + */
  2271. + int profile;
  2272. +#define FF_PROFILE_UNKNOWN -99
  2273. +#define FF_PROFILE_RESERVED -100
  2274. +
  2275. +#define FF_PROFILE_AAC_MAIN 0
  2276. +#define FF_PROFILE_AAC_LOW 1
  2277. +#define FF_PROFILE_AAC_SSR 2
  2278. +#define FF_PROFILE_AAC_LTP 3
  2279. +#define FF_PROFILE_AAC_HE 4
  2280. +#define FF_PROFILE_AAC_HE_V2 28
  2281. +#define FF_PROFILE_AAC_LD 22
  2282. +#define FF_PROFILE_AAC_ELD 38
  2283. +#define FF_PROFILE_MPEG2_AAC_LOW 128
  2284. +#define FF_PROFILE_MPEG2_AAC_HE 131
  2285. +
  2286. +#define FF_PROFILE_DNXHD 0
  2287. +#define FF_PROFILE_DNXHR_LB 1
  2288. +#define FF_PROFILE_DNXHR_SQ 2
  2289. +#define FF_PROFILE_DNXHR_HQ 3
  2290. +#define FF_PROFILE_DNXHR_HQX 4
  2291. +#define FF_PROFILE_DNXHR_444 5
  2292. +
  2293. +#define FF_PROFILE_DTS 20
  2294. +#define FF_PROFILE_DTS_ES 30
  2295. +#define FF_PROFILE_DTS_96_24 40
  2296. +#define FF_PROFILE_DTS_HD_HRA 50
  2297. +#define FF_PROFILE_DTS_HD_MA 60
  2298. +#define FF_PROFILE_DTS_EXPRESS 70
  2299. +
  2300. +#define FF_PROFILE_MPEG2_422 0
  2301. +#define FF_PROFILE_MPEG2_HIGH 1
  2302. +#define FF_PROFILE_MPEG2_SS 2
  2303. +#define FF_PROFILE_MPEG2_SNR_SCALABLE 3
  2304. +#define FF_PROFILE_MPEG2_MAIN 4
  2305. +#define FF_PROFILE_MPEG2_SIMPLE 5
  2306. +
  2307. +#define FF_PROFILE_H264_CONSTRAINED (1 << 9) // 8+1; constraint_set1_flag
  2308. +#define FF_PROFILE_H264_INTRA (1 << 11) // 8+3; constraint_set3_flag
  2309. +
  2310. +#define FF_PROFILE_H264_BASELINE 66
  2311. +#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66 | FF_PROFILE_H264_CONSTRAINED)
  2312. +#define FF_PROFILE_H264_MAIN 77
  2313. +#define FF_PROFILE_H264_EXTENDED 88
  2314. +#define FF_PROFILE_H264_HIGH 100
  2315. +#define FF_PROFILE_H264_HIGH_10 110
  2316. +#define FF_PROFILE_H264_HIGH_10_INTRA (110 | FF_PROFILE_H264_INTRA)
  2317. +#define FF_PROFILE_H264_MULTIVIEW_HIGH 118
  2318. +#define FF_PROFILE_H264_HIGH_422 122
  2319. +#define FF_PROFILE_H264_HIGH_422_INTRA (122 | FF_PROFILE_H264_INTRA)
  2320. +#define FF_PROFILE_H264_STEREO_HIGH 128
  2321. +#define FF_PROFILE_H264_HIGH_444 144
  2322. +#define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244
  2323. +#define FF_PROFILE_H264_HIGH_444_INTRA (244 | FF_PROFILE_H264_INTRA)
  2324. +#define FF_PROFILE_H264_CAVLC_444 44
  2325. +
  2326. +#define FF_PROFILE_VC1_SIMPLE 0
  2327. +#define FF_PROFILE_VC1_MAIN 1
  2328. +#define FF_PROFILE_VC1_COMPLEX 2
  2329. +#define FF_PROFILE_VC1_ADVANCED 3
  2330. +
  2331. +#define FF_PROFILE_MPEG4_SIMPLE 0
  2332. +#define FF_PROFILE_MPEG4_SIMPLE_SCALABLE 1
  2333. +#define FF_PROFILE_MPEG4_CORE 2
  2334. +#define FF_PROFILE_MPEG4_MAIN 3
  2335. +#define FF_PROFILE_MPEG4_N_BIT 4
  2336. +#define FF_PROFILE_MPEG4_SCALABLE_TEXTURE 5
  2337. +#define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6
  2338. +#define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7
  2339. +#define FF_PROFILE_MPEG4_HYBRID 8
  2340. +#define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME 9
  2341. +#define FF_PROFILE_MPEG4_CORE_SCALABLE 10
  2342. +#define FF_PROFILE_MPEG4_ADVANCED_CODING 11
  2343. +#define FF_PROFILE_MPEG4_ADVANCED_CORE 12
  2344. +#define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13
  2345. +#define FF_PROFILE_MPEG4_SIMPLE_STUDIO 14
  2346. +#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE 15
  2347. +
  2348. +#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0 1
  2349. +#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1 2
  2350. +#define FF_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION 32768
  2351. +#define FF_PROFILE_JPEG2000_DCINEMA_2K 3
  2352. +#define FF_PROFILE_JPEG2000_DCINEMA_4K 4
  2353. +
  2354. +#define FF_PROFILE_VP9_0 0
  2355. +#define FF_PROFILE_VP9_1 1
  2356. +#define FF_PROFILE_VP9_2 2
  2357. +#define FF_PROFILE_VP9_3 3
  2358. +
  2359. +#define FF_PROFILE_HEVC_MAIN 1
  2360. +#define FF_PROFILE_HEVC_MAIN_10 2
  2361. +#define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3
  2362. +#define FF_PROFILE_HEVC_REXT 4
  2363. +#define FF_PROFILE_HEVC_SCC 9
  2364. +
  2365. +#define FF_PROFILE_VVC_MAIN_10 1
  2366. +#define FF_PROFILE_VVC_MAIN_10_444 33
  2367. +
  2368. +#define FF_PROFILE_AV1_MAIN 0
  2369. +#define FF_PROFILE_AV1_HIGH 1
  2370. +#define FF_PROFILE_AV1_PROFESSIONAL 2
  2371. +
  2372. +#define FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT 0xc0
  2373. +#define FF_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT 0xc1
  2374. +#define FF_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT 0xc2
  2375. +#define FF_PROFILE_MJPEG_HUFFMAN_LOSSLESS 0xc3
  2376. +#define FF_PROFILE_MJPEG_JPEG_LS 0xf7
  2377. +
  2378. +#define FF_PROFILE_SBC_MSBC 1
  2379. +
  2380. +#define FF_PROFILE_PRORES_PROXY 0
  2381. +#define FF_PROFILE_PRORES_LT 1
  2382. +#define FF_PROFILE_PRORES_STANDARD 2
  2383. +#define FF_PROFILE_PRORES_HQ 3
  2384. +#define FF_PROFILE_PRORES_4444 4
  2385. +#define FF_PROFILE_PRORES_XQ 5
  2386. +
  2387. +#define FF_PROFILE_ARIB_PROFILE_A 0
  2388. +#define FF_PROFILE_ARIB_PROFILE_C 1
  2389. +
  2390. +#define FF_PROFILE_KLVA_SYNC 0
  2391. +#define FF_PROFILE_KLVA_ASYNC 1
  2392. +
  2393. + /**
  2394. + * level
  2395. + * - encoding: Set by user.
  2396. + * - decoding: Set by libavcodec.
  2397. + */
  2398. + int level;
  2399. +#define FF_LEVEL_UNKNOWN -99
  2400. +
  2401. + /**
  2402. + * Skip loop filtering for selected frames.
  2403. + * - encoding: unused
  2404. + * - decoding: Set by user.
  2405. + */
  2406. + enum AVDiscard skip_loop_filter;
  2407. +
  2408. + /**
  2409. + * Skip IDCT/dequantization for selected frames.
  2410. + * - encoding: unused
  2411. + * - decoding: Set by user.
  2412. + */
  2413. + enum AVDiscard skip_idct;
  2414. +
  2415. + /**
  2416. + * Skip decoding for selected frames.
  2417. + * - encoding: unused
  2418. + * - decoding: Set by user.
  2419. + */
  2420. + enum AVDiscard skip_frame;
  2421. +
  2422. + /**
  2423. + * Header containing style information for text subtitles.
  2424. + * For SUBTITLE_ASS subtitle type, it should contain the whole ASS
  2425. + * [Script Info] and [V4+ Styles] section, plus the [Events] line and
  2426. + * the Format line following. It shouldn't include any Dialogue line.
  2427. + * - encoding: Set/allocated/freed by user (before avcodec_open2())
  2428. + * - decoding: Set/allocated/freed by libavcodec (by avcodec_open2())
  2429. + */
  2430. + uint8_t* subtitle_header;
  2431. + int subtitle_header_size;
  2432. +
  2433. + /**
  2434. + * Audio only. The number of "priming" samples (padding) inserted by the
  2435. + * encoder at the beginning of the audio. I.e. this number of leading
  2436. + * decoded samples must be discarded by the caller to get the original audio
  2437. + * without leading padding.
  2438. + *
  2439. + * - decoding: unused
  2440. + * - encoding: Set by libavcodec. The timestamps on the output packets are
  2441. + * adjusted by the encoder so that they always refer to the
  2442. + * first sample of the data actually contained in the packet,
  2443. + * including any added padding. E.g. if the timebase is
  2444. + * 1/samplerate and the timestamp of the first input sample is
  2445. + * 0, the timestamp of the first output packet will be
  2446. + * -initial_padding.
  2447. + */
  2448. + int initial_padding;
  2449. +
  2450. + /**
  2451. + * - decoding: For codecs that store a framerate value in the compressed
  2452. + * bitstream, the decoder may export it here. { 0, 1} when
  2453. + * unknown.
  2454. + * - encoding: May be used to signal the framerate of CFR content to an
  2455. + * encoder.
  2456. + */
  2457. + AVRational framerate;
  2458. +
  2459. + /**
  2460. + * Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
  2461. + * - encoding: unused.
  2462. + * - decoding: Set by libavcodec before calling get_format()
  2463. + */
  2464. + enum AVPixelFormat sw_pix_fmt;
  2465. +
  2466. + /**
  2467. + * Timebase in which pkt_dts/pts and AVPacket.dts/pts are.
  2468. + * - encoding unused.
  2469. + * - decoding set by user.
  2470. + */
  2471. + AVRational pkt_timebase;
  2472. +
  2473. + /**
  2474. + * AVCodecDescriptor
  2475. + * - encoding: unused.
  2476. + * - decoding: set by libavcodec.
  2477. + */
  2478. + const AVCodecDescriptor* codec_descriptor;
  2479. +
  2480. + /**
  2481. + * Current statistics for PTS correction.
  2482. + * - decoding: maintained and used by libavcodec, not intended to be used by
  2483. + * user apps
  2484. + * - encoding: unused
  2485. + */
  2486. + int64_t
  2487. + pts_correction_num_faulty_pts; /// Number of incorrect PTS values so far
  2488. + int64_t
  2489. + pts_correction_num_faulty_dts; /// Number of incorrect DTS values so far
  2490. + int64_t pts_correction_last_pts; /// PTS of the last frame
  2491. + int64_t pts_correction_last_dts; /// DTS of the last frame
  2492. +
  2493. + /**
  2494. + * Character encoding of the input subtitles file.
  2495. + * - decoding: set by user
  2496. + * - encoding: unused
  2497. + */
  2498. + char* sub_charenc;
  2499. +
  2500. + /**
  2501. + * Subtitles character encoding mode. Formats or codecs might be adjusting
  2502. + * this setting (if they are doing the conversion themselves for instance).
  2503. + * - decoding: set by libavcodec
  2504. + * - encoding: unused
  2505. + */
  2506. + int sub_charenc_mode;
  2507. +#define FF_SUB_CHARENC_MODE_DO_NOTHING \
  2508. + -1 ///< do nothing (demuxer outputs a stream supposed to be already in UTF-8,
  2509. + ///< or the codec is bitmap for instance)
  2510. +#define FF_SUB_CHARENC_MODE_AUTOMATIC \
  2511. + 0 ///< libavcodec will select the mode itself
  2512. +#define FF_SUB_CHARENC_MODE_PRE_DECODER \
  2513. + 1 ///< the AVPacket data needs to be recoded to UTF-8 before being fed to the
  2514. + ///< decoder, requires iconv
  2515. +#define FF_SUB_CHARENC_MODE_IGNORE \
  2516. + 2 ///< neither convert the subtitles, nor check them for valid UTF-8
  2517. +
  2518. + /**
  2519. + * Skip processing alpha if supported by codec.
  2520. + * Note that if the format uses pre-multiplied alpha (common with VP6,
  2521. + * and recommended due to better video quality/compression)
  2522. + * the image will look as if alpha-blended onto a black background.
  2523. + * However for formats that do not use pre-multiplied alpha
  2524. + * there might be serious artefacts (though e.g. libswscale currently
  2525. + * assumes pre-multiplied alpha anyway).
  2526. + *
  2527. + * - decoding: set by user
  2528. + * - encoding: unused
  2529. + */
  2530. + int skip_alpha;
  2531. +
  2532. + /**
  2533. + * Number of samples to skip after a discontinuity
  2534. + * - decoding: unused
  2535. + * - encoding: set by libavcodec
  2536. + */
  2537. + int seek_preroll;
  2538. +
  2539. + /**
  2540. + * custom intra quantization matrix
  2541. + * - encoding: Set by user, can be NULL.
  2542. + * - decoding: unused.
  2543. + */
  2544. + uint16_t* chroma_intra_matrix;
  2545. +
  2546. + /**
  2547. + * dump format separator.
  2548. + * can be ", " or "\n " or anything else
  2549. + * - encoding: Set by user.
  2550. + * - decoding: Set by user.
  2551. + */
  2552. + uint8_t* dump_separator;
  2553. +
  2554. + /**
  2555. + * ',' separated list of allowed decoders.
  2556. + * If NULL then all are allowed
  2557. + * - encoding: unused
  2558. + * - decoding: set by user
  2559. + */
  2560. + char* codec_whitelist;
  2561. +
  2562. + /**
  2563. + * Properties of the stream that gets decoded
  2564. + * - encoding: unused
  2565. + * - decoding: set by libavcodec
  2566. + */
  2567. + unsigned properties;
  2568. +#define FF_CODEC_PROPERTY_LOSSLESS 0x00000001
  2569. +#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x00000002
  2570. +#define FF_CODEC_PROPERTY_FILM_GRAIN 0x00000004
  2571. +
  2572. + /**
  2573. + * Additional data associated with the entire coded stream.
  2574. + *
  2575. + * - decoding: unused
  2576. + * - encoding: may be set by libavcodec after avcodec_open2().
  2577. + */
  2578. + AVPacketSideData* coded_side_data;
  2579. + int nb_coded_side_data;
  2580. +
  2581. + /**
  2582. + * A reference to the AVHWFramesContext describing the input (for encoding)
  2583. + * or output (decoding) frames. The reference is set by the caller and
  2584. + * afterwards owned (and freed) by libavcodec - it should never be read by
  2585. + * the caller after being set.
  2586. + *
  2587. + * - decoding: This field should be set by the caller from the get_format()
  2588. + * callback. The previous reference (if any) will always be
  2589. + * unreffed by libavcodec before the get_format() call.
  2590. + *
  2591. + * If the default get_buffer2() is used with a hwaccel pixel
  2592. + * format, then this AVHWFramesContext will be used for
  2593. + * allocating the frame buffers.
  2594. + *
  2595. + * - encoding: For hardware encoders configured to use a hwaccel pixel
  2596. + * format, this field should be set by the caller to a reference
  2597. + * to the AVHWFramesContext describing input frames.
  2598. + * AVHWFramesContext.format must be equal to
  2599. + * AVCodecContext.pix_fmt.
  2600. + *
  2601. + * This field should be set before avcodec_open2() is called.
  2602. + */
  2603. + AVBufferRef* hw_frames_ctx;
  2604. +
  2605. + /**
  2606. + * Audio only. The amount of padding (in samples) appended by the encoder to
  2607. + * the end of the audio. I.e. this number of decoded samples must be
  2608. + * discarded by the caller from the end of the stream to get the original
  2609. + * audio without any trailing padding.
  2610. + *
  2611. + * - decoding: unused
  2612. + * - encoding: unused
  2613. + */
  2614. + int trailing_padding;
  2615. +
  2616. + /**
  2617. + * The number of pixels per image to maximally accept.
  2618. + *
  2619. + * - decoding: set by user
  2620. + * - encoding: set by user
  2621. + */
  2622. + int64_t max_pixels;
  2623. +
  2624. + /**
  2625. + * A reference to the AVHWDeviceContext describing the device which will
  2626. + * be used by a hardware encoder/decoder. The reference is set by the
  2627. + * caller and afterwards owned (and freed) by libavcodec.
  2628. + *
  2629. + * This should be used if either the codec device does not require
  2630. + * hardware frames or any that are used are to be allocated internally by
  2631. + * libavcodec. If the user wishes to supply any of the frames used as
  2632. + * encoder input or decoder output then hw_frames_ctx should be used
  2633. + * instead. When hw_frames_ctx is set in get_format() for a decoder, this
  2634. + * field will be ignored while decoding the associated stream segment, but
  2635. + * may again be used on a following one after another get_format() call.
  2636. + *
  2637. + * For both encoders and decoders this field should be set before
  2638. + * avcodec_open2() is called and must not be written to thereafter.
  2639. + *
  2640. + * Note that some decoders may require this field to be set initially in
  2641. + * order to support hw_frames_ctx at all - in that case, all frames
  2642. + * contexts used must be created on the same device.
  2643. + */
  2644. + AVBufferRef* hw_device_ctx;
  2645. +
  2646. + /**
  2647. + * Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated
  2648. + * decoding (if active).
  2649. + * - encoding: unused
  2650. + * - decoding: Set by user (either before avcodec_open2(), or in the
  2651. + * AVCodecContext.get_format callback)
  2652. + */
  2653. + int hwaccel_flags;
  2654. +
  2655. + /**
  2656. + * Video decoding only. Certain video codecs support cropping, meaning that
  2657. + * only a sub-rectangle of the decoded frame is intended for display. This
  2658. + * option controls how cropping is handled by libavcodec.
  2659. + *
  2660. + * When set to 1 (the default), libavcodec will apply cropping internally.
  2661. + * I.e. it will modify the output frame width/height fields and offset the
  2662. + * data pointers (only by as much as possible while preserving alignment, or
  2663. + * by the full amount if the AV_CODEC_FLAG_UNALIGNED flag is set) so that
  2664. + * the frames output by the decoder refer only to the cropped area. The
  2665. + * crop_* fields of the output frames will be zero.
  2666. + *
  2667. + * When set to 0, the width/height fields of the output frames will be set
  2668. + * to the coded dimensions and the crop_* fields will describe the cropping
  2669. + * rectangle. Applying the cropping is left to the caller.
  2670. + *
  2671. + * @warning When hardware acceleration with opaque output frames is used,
  2672. + * libavcodec is unable to apply cropping from the top/left border.
  2673. + *
  2674. + * @note when this option is set to zero, the width/height fields of the
  2675. + * AVCodecContext and output AVFrames have different meanings. The codec
  2676. + * context fields store display dimensions (with the coded dimensions in
  2677. + * coded_width/height), while the frame fields store the coded dimensions
  2678. + * (with the display dimensions being determined by the crop_* fields).
  2679. + */
  2680. + int apply_cropping;
  2681. +
  2682. + /*
  2683. + * Video decoding only. Sets the number of extra hardware frames which
  2684. + * the decoder will allocate for use by the caller. This must be set
  2685. + * before avcodec_open2() is called.
  2686. + *
  2687. + * Some hardware decoders require all frames that they will use for
  2688. + * output to be defined in advance before decoding starts. For such
  2689. + * decoders, the hardware frame pool must therefore be of a fixed size.
  2690. + * The extra frames set here are on top of any number that the decoder
  2691. + * needs internally in order to operate normally (for example, frames
  2692. + * used as reference pictures).
  2693. + */
  2694. + int extra_hw_frames;
  2695. +
  2696. + /**
  2697. + * The percentage of damaged samples to discard a frame.
  2698. + *
  2699. + * - decoding: set by user
  2700. + * - encoding: unused
  2701. + */
  2702. + int discard_damaged_percentage;
  2703. +
  2704. + /**
  2705. + * The number of samples per frame to maximally accept.
  2706. + *
  2707. + * - decoding: set by user
  2708. + * - encoding: set by user
  2709. + */
  2710. + int64_t max_samples;
  2711. +
  2712. + /**
  2713. + * Bit set of AV_CODEC_EXPORT_DATA_* flags, which affects the kind of
  2714. + * metadata exported in frame, packet, or coded stream side data by
  2715. + * decoders and encoders.
  2716. + *
  2717. + * - decoding: set by user
  2718. + * - encoding: set by user
  2719. + */
  2720. + int export_side_data;
  2721. +
  2722. + /**
  2723. + * This callback is called at the beginning of each packet to get a data
  2724. + * buffer for it.
  2725. + *
  2726. + * The following field will be set in the packet before this callback is
  2727. + * called:
  2728. + * - size
  2729. + * This callback must use the above value to calculate the required buffer
  2730. + * size, which must padded by at least AV_INPUT_BUFFER_PADDING_SIZE bytes.
  2731. + *
  2732. + * In some specific cases, the encoder may not use the entire buffer allocated
  2733. + * by this callback. This will be reflected in the size value in the packet
  2734. + * once returned by avcodec_receive_packet().
  2735. + *
  2736. + * This callback must fill the following fields in the packet:
  2737. + * - data: alignment requirements for AVPacket apply, if any. Some
  2738. + * architectures and encoders may benefit from having aligned data.
  2739. + * - buf: must contain a pointer to an AVBufferRef structure. The packet's
  2740. + * data pointer must be contained in it. See: av_buffer_create(),
  2741. + * av_buffer_alloc(), and av_buffer_ref().
  2742. + *
  2743. + * If AV_CODEC_CAP_DR1 is not set then get_encode_buffer() must call
  2744. + * avcodec_default_get_encode_buffer() instead of providing a buffer allocated
  2745. + * by some other means.
  2746. + *
  2747. + * The flags field may contain a combination of AV_GET_ENCODE_BUFFER_FLAG_
  2748. + * flags. They may be used for example to hint what use the buffer may get
  2749. + * after being created. Implementations of this callback may ignore flags they
  2750. + * don't understand. If AV_GET_ENCODE_BUFFER_FLAG_REF is set in flags then the
  2751. + * packet may be reused (read and/or written to if it is writable) later by
  2752. + * libavcodec.
  2753. + *
  2754. + * This callback must be thread-safe, as when frame threading is used, it may
  2755. + * be called from multiple threads simultaneously.
  2756. + *
  2757. + * @see avcodec_default_get_encode_buffer()
  2758. + *
  2759. + * - encoding: Set by libavcodec, user can override.
  2760. + * - decoding: unused
  2761. + */
  2762. + int (*get_encode_buffer)(struct AVCodecContext* s, AVPacket* pkt, int flags);
  2763. +
  2764. + /**
  2765. + * Audio channel layout.
  2766. + * - encoding: must be set by the caller, to one of AVCodec.ch_layouts.
  2767. + * - decoding: may be set by the caller if known e.g. from the container.
  2768. + * The decoder can then override during decoding as needed.
  2769. + */
  2770. + AVChannelLayout ch_layout;
  2771. +
  2772. + /**
  2773. + * Frame counter, set by libavcodec.
  2774. + *
  2775. + * - decoding: total number of frames returned from the decoder so far.
  2776. + * - encoding: total number of frames passed to the encoder so far.
  2777. + *
  2778. + * @note the counter is not incremented if encoding/decoding resulted in
  2779. + * an error.
  2780. + */
  2781. + int64_t frame_num;
  2782. +} AVCodecContext;
  2783. +
  2784. +/**
  2785. + * @defgroup lavc_hwaccel AVHWAccel
  2786. + *
  2787. + * @note Nothing in this structure should be accessed by the user. At some
  2788. + * point in future it will not be externally visible at all.
  2789. + *
  2790. + * @{
  2791. + */
  2792. +typedef struct AVHWAccel {
  2793. + /**
  2794. + * Name of the hardware accelerated codec.
  2795. + * The name is globally unique among encoders and among decoders (but an
  2796. + * encoder and a decoder can share the same name).
  2797. + */
  2798. + const char* name;
  2799. +
  2800. + /**
  2801. + * Type of codec implemented by the hardware accelerator.
  2802. + *
  2803. + * See AVMEDIA_TYPE_xxx
  2804. + */
  2805. + enum AVMediaType type;
  2806. +
  2807. + /**
  2808. + * Codec implemented by the hardware accelerator.
  2809. + *
  2810. + * See AV_CODEC_ID_xxx
  2811. + */
  2812. + enum AVCodecID id;
  2813. +
  2814. + /**
  2815. + * Supported pixel format.
  2816. + *
  2817. + * Only hardware accelerated formats are supported here.
  2818. + */
  2819. + enum AVPixelFormat pix_fmt;
  2820. +
  2821. + /**
  2822. + * Hardware accelerated codec capabilities.
  2823. + * see AV_HWACCEL_CODEC_CAP_*
  2824. + */
  2825. + int capabilities;
  2826. +
  2827. + /*****************************************************************
  2828. + * No fields below this line are part of the public API. They
  2829. + * may not be used outside of libavcodec and can be changed and
  2830. + * removed at will.
  2831. + * New public fields should be added right above.
  2832. + *****************************************************************
  2833. + */
  2834. +
  2835. + /**
  2836. + * Allocate a custom buffer
  2837. + */
  2838. + int (*alloc_frame)(AVCodecContext* avctx, AVFrame* frame);
  2839. +
  2840. + /**
  2841. + * Called at the beginning of each frame or field picture.
  2842. + *
  2843. + * Meaningful frame information (codec specific) is guaranteed to
  2844. + * be parsed at this point. This function is mandatory.
  2845. + *
  2846. + * Note that buf can be NULL along with buf_size set to 0.
  2847. + * Otherwise, this means the whole frame is available at this point.
  2848. + *
  2849. + * @param avctx the codec context
  2850. + * @param buf the frame data buffer base
  2851. + * @param buf_size the size of the frame in bytes
  2852. + * @return zero if successful, a negative value otherwise
  2853. + */
  2854. + int (*start_frame)(AVCodecContext* avctx, const uint8_t* buf,
  2855. + uint32_t buf_size);
  2856. +
  2857. + /**
  2858. + * Callback for parameter data (SPS/PPS/VPS etc).
  2859. + *
  2860. + * Useful for hardware decoders which keep persistent state about the
  2861. + * video parameters, and need to receive any changes to update that state.
  2862. + *
  2863. + * @param avctx the codec context
  2864. + * @param type the nal unit type
  2865. + * @param buf the nal unit data buffer
  2866. + * @param buf_size the size of the nal unit in bytes
  2867. + * @return zero if successful, a negative value otherwise
  2868. + */
  2869. + int (*decode_params)(AVCodecContext* avctx, int type, const uint8_t* buf,
  2870. + uint32_t buf_size);
  2871. +
  2872. + /**
  2873. + * Callback for each slice.
  2874. + *
  2875. + * Meaningful slice information (codec specific) is guaranteed to
  2876. + * be parsed at this point. This function is mandatory.
  2877. + *
  2878. + * @param avctx the codec context
  2879. + * @param buf the slice data buffer base
  2880. + * @param buf_size the size of the slice in bytes
  2881. + * @return zero if successful, a negative value otherwise
  2882. + */
  2883. + int (*decode_slice)(AVCodecContext* avctx, const uint8_t* buf,
  2884. + uint32_t buf_size);
  2885. +
  2886. + /**
  2887. + * Called at the end of each frame or field picture.
  2888. + *
  2889. + * The whole picture is parsed at this point and can now be sent
  2890. + * to the hardware accelerator. This function is mandatory.
  2891. + *
  2892. + * @param avctx the codec context
  2893. + * @return zero if successful, a negative value otherwise
  2894. + */
  2895. + int (*end_frame)(AVCodecContext* avctx);
  2896. +
  2897. + /**
  2898. + * Size of per-frame hardware accelerator private data.
  2899. + *
  2900. + * Private data is allocated with av_mallocz() before
  2901. + * AVCodecContext.get_buffer() and deallocated after
  2902. + * AVCodecContext.release_buffer().
  2903. + */
  2904. + int frame_priv_data_size;
  2905. +
  2906. + /**
  2907. + * Initialize the hwaccel private data.
  2908. + *
  2909. + * This will be called from ff_get_format(), after hwaccel and
  2910. + * hwaccel_context are set and the hwaccel private data in AVCodecInternal
  2911. + * is allocated.
  2912. + */
  2913. + int (*init)(AVCodecContext* avctx);
  2914. +
  2915. + /**
  2916. + * Uninitialize the hwaccel private data.
  2917. + *
  2918. + * This will be called from get_format() or avcodec_close(), after hwaccel
  2919. + * and hwaccel_context are already uninitialized.
  2920. + */
  2921. + int (*uninit)(AVCodecContext* avctx);
  2922. +
  2923. + /**
  2924. + * Size of the private data to allocate in
  2925. + * AVCodecInternal.hwaccel_priv_data.
  2926. + */
  2927. + int priv_data_size;
  2928. +
  2929. + /**
  2930. + * Internal hwaccel capabilities.
  2931. + */
  2932. + int caps_internal;
  2933. +
  2934. + /**
  2935. + * Fill the given hw_frames context with current codec parameters. Called
  2936. + * from get_format. Refer to avcodec_get_hw_frames_parameters() for
  2937. + * details.
  2938. + *
  2939. + * This CAN be called before AVHWAccel.init is called, and you must assume
  2940. + * that avctx->hwaccel_priv_data is invalid.
  2941. + */
  2942. + int (*frame_params)(AVCodecContext* avctx, AVBufferRef* hw_frames_ctx);
  2943. +} AVHWAccel;
  2944. +
  2945. +/**
  2946. + * HWAccel is experimental and is thus avoided in favor of non experimental
  2947. + * codecs
  2948. + */
  2949. +#define AV_HWACCEL_CODEC_CAP_EXPERIMENTAL 0x0200
  2950. +
  2951. +/**
  2952. + * Hardware acceleration should be used for decoding even if the codec level
  2953. + * used is unknown or higher than the maximum supported level reported by the
  2954. + * hardware driver.
  2955. + *
  2956. + * It's generally a good idea to pass this flag unless you have a specific
  2957. + * reason not to, as hardware tends to under-report supported levels.
  2958. + */
  2959. +#define AV_HWACCEL_FLAG_IGNORE_LEVEL (1 << 0)
  2960. +
  2961. +/**
  2962. + * Hardware acceleration can output YUV pixel formats with a different chroma
  2963. + * sampling than 4:2:0 and/or other than 8 bits per component.
  2964. + */
  2965. +#define AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH (1 << 1)
  2966. +
  2967. +/**
  2968. + * Hardware acceleration should still be attempted for decoding when the
  2969. + * codec profile does not match the reported capabilities of the hardware.
  2970. + *
  2971. + * For example, this can be used to try to decode baseline profile H.264
  2972. + * streams in hardware - it will often succeed, because many streams marked
  2973. + * as baseline profile actually conform to constrained baseline profile.
  2974. + *
  2975. + * @warning If the stream is actually not supported then the behaviour is
  2976. + * undefined, and may include returning entirely incorrect output
  2977. + * while indicating success.
  2978. + */
  2979. +#define AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH (1 << 2)
  2980. +
  2981. +/**
  2982. + * Some hardware decoders (namely nvdec) can either output direct decoder
  2983. + * surfaces, or make an on-device copy and return said copy.
  2984. + * There is a hard limit on how many decoder surfaces there can be, and it
  2985. + * cannot be accurately guessed ahead of time.
  2986. + * For some processing chains, this can be okay, but others will run into the
  2987. + * limit and in turn produce very confusing errors that require fine tuning of
  2988. + * more or less obscure options by the user, or in extreme cases cannot be
  2989. + * resolved at all without inserting an avfilter that forces a copy.
  2990. + *
  2991. + * Thus, the hwaccel will by default make a copy for safety and resilience.
  2992. + * If a users really wants to minimize the amount of copies, they can set this
  2993. + * flag and ensure their processing chain does not exhaust the surface pool.
  2994. + */
  2995. +#define AV_HWACCEL_FLAG_UNSAFE_OUTPUT (1 << 3)
  2996. +
  2997. +/**
  2998. + * @}
  2999. + */
  3000. +
  3001. +enum AVSubtitleType {
  3002. + SUBTITLE_NONE,
  3003. +
  3004. + SUBTITLE_BITMAP, ///< A bitmap, pict will be set
  3005. +
  3006. + /**
  3007. + * Plain text, the text field must be set by the decoder and is
  3008. + * authoritative. ass and pict fields may contain approximations.
  3009. + */
  3010. + SUBTITLE_TEXT,
  3011. +
  3012. + /**
  3013. + * Formatted text, the ass field must be set by the decoder and is
  3014. + * authoritative. pict and text fields may contain approximations.
  3015. + */
  3016. + SUBTITLE_ASS,
  3017. +};
  3018. +
  3019. +#define AV_SUBTITLE_FLAG_FORCED 0x00000001
  3020. +
  3021. +typedef struct AVSubtitleRect {
  3022. + int x; ///< top left corner of pict, undefined when pict is not set
  3023. + int y; ///< top left corner of pict, undefined when pict is not set
  3024. + int w; ///< width of pict, undefined when pict is not set
  3025. + int h; ///< height of pict, undefined when pict is not set
  3026. + int nb_colors; ///< number of colors in pict, undefined when pict is not set
  3027. +
  3028. + /**
  3029. + * data+linesize for the bitmap of this subtitle.
  3030. + * Can be set for text/ass as well once they are rendered.
  3031. + */
  3032. + uint8_t* data[4];
  3033. + int linesize[4];
  3034. +
  3035. + enum AVSubtitleType type;
  3036. +
  3037. + char* text; ///< 0 terminated plain UTF-8 text
  3038. +
  3039. + /**
  3040. + * 0 terminated ASS/SSA compatible event line.
  3041. + * The presentation of this is unaffected by the other values in this
  3042. + * struct.
  3043. + */
  3044. + char* ass;
  3045. +
  3046. + int flags;
  3047. +} AVSubtitleRect;
  3048. +
  3049. +typedef struct AVSubtitle {
  3050. + uint16_t format; /* 0 = graphics */
  3051. + uint32_t start_display_time; /* relative to packet pts, in ms */
  3052. + uint32_t end_display_time; /* relative to packet pts, in ms */
  3053. + unsigned num_rects;
  3054. + AVSubtitleRect** rects;
  3055. + int64_t pts; ///< Same as packet pts, in AV_TIME_BASE
  3056. +} AVSubtitle;
  3057. +
  3058. +/**
  3059. + * Return the LIBAVCODEC_VERSION_INT constant.
  3060. + */
  3061. +unsigned avcodec_version(void);
  3062. +
  3063. +/**
  3064. + * Return the libavcodec build-time configuration.
  3065. + */
  3066. +const char* avcodec_configuration(void);
  3067. +
  3068. +/**
  3069. + * Return the libavcodec license.
  3070. + */
  3071. +const char* avcodec_license(void);
  3072. +
  3073. +/**
  3074. + * Allocate an AVCodecContext and set its fields to default values. The
  3075. + * resulting struct should be freed with avcodec_free_context().
  3076. + *
  3077. + * @param codec if non-NULL, allocate private data and initialize defaults
  3078. + * for the given codec. It is illegal to then call avcodec_open2()
  3079. + * with a different codec.
  3080. + * If NULL, then the codec-specific defaults won't be initialized,
  3081. + * which may result in suboptimal default settings (this is
  3082. + * important mainly for encoders, e.g. libx264).
  3083. + *
  3084. + * @return An AVCodecContext filled with default values or NULL on failure.
  3085. + */
  3086. +AVCodecContext* avcodec_alloc_context3(const AVCodec* codec);
  3087. +
  3088. +/**
  3089. + * Free the codec context and everything associated with it and write NULL to
  3090. + * the provided pointer.
  3091. + */
  3092. +void avcodec_free_context(AVCodecContext** avctx);
  3093. +
  3094. +/**
  3095. + * Get the AVClass for AVCodecContext. It can be used in combination with
  3096. + * AV_OPT_SEARCH_FAKE_OBJ for examining options.
  3097. + *
  3098. + * @see av_opt_find().
  3099. + */
  3100. +const AVClass* avcodec_get_class(void);
  3101. +
  3102. +/**
  3103. + * Get the AVClass for AVSubtitleRect. It can be used in combination with
  3104. + * AV_OPT_SEARCH_FAKE_OBJ for examining options.
  3105. + *
  3106. + * @see av_opt_find().
  3107. + */
  3108. +const AVClass* avcodec_get_subtitle_rect_class(void);
  3109. +
  3110. +/**
  3111. + * Fill the parameters struct based on the values from the supplied codec
  3112. + * context. Any allocated fields in par are freed and replaced with duplicates
  3113. + * of the corresponding fields in codec.
  3114. + *
  3115. + * @return >= 0 on success, a negative AVERROR code on failure
  3116. + */
  3117. +int avcodec_parameters_from_context(AVCodecParameters* par,
  3118. + const AVCodecContext* codec);
  3119. +
  3120. +/**
  3121. + * Fill the codec context based on the values from the supplied codec
  3122. + * parameters. Any allocated fields in codec that have a corresponding field in
  3123. + * par are freed and replaced with duplicates of the corresponding field in par.
  3124. + * Fields in codec that do not have a counterpart in par are not touched.
  3125. + *
  3126. + * @return >= 0 on success, a negative AVERROR code on failure.
  3127. + */
  3128. +int avcodec_parameters_to_context(AVCodecContext* codec,
  3129. + const AVCodecParameters* par);
  3130. +
  3131. +/**
  3132. + * Initialize the AVCodecContext to use the given AVCodec. Prior to using this
  3133. + * function the context has to be allocated with avcodec_alloc_context3().
  3134. + *
  3135. + * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
  3136. + * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
  3137. + * retrieving a codec.
  3138. + *
  3139. + * @note Always call this function before using decoding routines (such as
  3140. + * @ref avcodec_receive_frame()).
  3141. + *
  3142. + * @code
  3143. + * av_dict_set(&opts, "b", "2.5M", 0);
  3144. + * codec = avcodec_find_decoder(AV_CODEC_ID_H264);
  3145. + * if (!codec)
  3146. + * exit(1);
  3147. + *
  3148. + * context = avcodec_alloc_context3(codec);
  3149. + *
  3150. + * if (avcodec_open2(context, codec, opts) < 0)
  3151. + * exit(1);
  3152. + * @endcode
  3153. + *
  3154. + * @param avctx The context to initialize.
  3155. + * @param codec The codec to open this context for. If a non-NULL codec has been
  3156. + * previously passed to avcodec_alloc_context3() or
  3157. + * for this context, then this parameter MUST be either NULL or
  3158. + * equal to the previously passed codec.
  3159. + * @param options A dictionary filled with AVCodecContext and codec-private
  3160. + * options. On return this object will be filled with options that were not
  3161. + * found.
  3162. + *
  3163. + * @return zero on success, a negative value on error
  3164. + * @see avcodec_alloc_context3(), avcodec_find_decoder(),
  3165. + * avcodec_find_encoder(), av_dict_set(), av_opt_find().
  3166. + */
  3167. +int avcodec_open2(AVCodecContext* avctx, const AVCodec* codec,
  3168. + AVDictionary** options);
  3169. +
  3170. +/**
  3171. + * Close a given AVCodecContext and free all the data associated with it
  3172. + * (but not the AVCodecContext itself).
  3173. + *
  3174. + * Calling this function on an AVCodecContext that hasn't been opened will free
  3175. + * the codec-specific data allocated in avcodec_alloc_context3() with a non-NULL
  3176. + * codec. Subsequent calls will do nothing.
  3177. + *
  3178. + * @note Do not use this function. Use avcodec_free_context() to destroy a
  3179. + * codec context (either open or closed). Opening and closing a codec context
  3180. + * multiple times is not supported anymore -- use multiple codec contexts
  3181. + * instead.
  3182. + */
  3183. +int avcodec_close(AVCodecContext* avctx);
  3184. +
  3185. +/**
  3186. + * Free all allocated data in the given subtitle struct.
  3187. + *
  3188. + * @param sub AVSubtitle to free.
  3189. + */
  3190. +void avsubtitle_free(AVSubtitle* sub);
  3191. +
  3192. +/**
  3193. + * @}
  3194. + */
  3195. +
  3196. +/**
  3197. + * @addtogroup lavc_decoding
  3198. + * @{
  3199. + */
  3200. +
  3201. +/**
  3202. + * The default callback for AVCodecContext.get_buffer2(). It is made public so
  3203. + * it can be called by custom get_buffer2() implementations for decoders without
  3204. + * AV_CODEC_CAP_DR1 set.
  3205. + */
  3206. +int avcodec_default_get_buffer2(AVCodecContext* s, AVFrame* frame, int flags);
  3207. +
  3208. +/**
  3209. + * The default callback for AVCodecContext.get_encode_buffer(). It is made
  3210. + * public so it can be called by custom get_encode_buffer() implementations for
  3211. + * encoders without AV_CODEC_CAP_DR1 set.
  3212. + */
  3213. +int avcodec_default_get_encode_buffer(AVCodecContext* s, AVPacket* pkt,
  3214. + int flags);
  3215. +
  3216. +/**
  3217. + * Modify width and height values so that they will result in a memory
  3218. + * buffer that is acceptable for the codec if you do not use any horizontal
  3219. + * padding.
  3220. + *
  3221. + * May only be used if a codec with AV_CODEC_CAP_DR1 has been opened.
  3222. + */
  3223. +void avcodec_align_dimensions(AVCodecContext* s, int* width, int* height);
  3224. +
  3225. +/**
  3226. + * Modify width and height values so that they will result in a memory
  3227. + * buffer that is acceptable for the codec if you also ensure that all
  3228. + * line sizes are a multiple of the respective linesize_align[i].
  3229. + *
  3230. + * May only be used if a codec with AV_CODEC_CAP_DR1 has been opened.
  3231. + */
  3232. +void avcodec_align_dimensions2(AVCodecContext* s, int* width, int* height,
  3233. + int linesize_align[AV_NUM_DATA_POINTERS]);
  3234. +
  3235. +#ifdef FF_API_AVCODEC_CHROMA_POS
  3236. +/**
  3237. + * Converts AVChromaLocation to swscale x/y chroma position.
  3238. + *
  3239. + * The positions represent the chroma (0,0) position in a coordinates system
  3240. + * with luma (0,0) representing the origin and luma(1,1) representing 256,256
  3241. + *
  3242. + * @param xpos horizontal chroma sample position
  3243. + * @param ypos vertical chroma sample position
  3244. + * @deprecated Use av_chroma_location_enum_to_pos() instead.
  3245. + */
  3246. +attribute_deprecated int avcodec_enum_to_chroma_pos(int* xpos, int* ypos,
  3247. + enum AVChromaLocation pos);
  3248. +
  3249. +/**
  3250. + * Converts swscale x/y chroma position to AVChromaLocation.
  3251. + *
  3252. + * The positions represent the chroma (0,0) position in a coordinates system
  3253. + * with luma (0,0) representing the origin and luma(1,1) representing 256,256
  3254. + *
  3255. + * @param xpos horizontal chroma sample position
  3256. + * @param ypos vertical chroma sample position
  3257. + * @deprecated Use av_chroma_location_pos_to_enum() instead.
  3258. + */
  3259. +attribute_deprecated enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos,
  3260. + int ypos);
  3261. +#endif
  3262. +
  3263. +/**
  3264. + * Decode a subtitle message.
  3265. + * Return a negative value on error, otherwise return the number of bytes used.
  3266. + * If no subtitle could be decompressed, got_sub_ptr is zero.
  3267. + * Otherwise, the subtitle is stored in *sub.
  3268. + * Note that AV_CODEC_CAP_DR1 is not available for subtitle codecs. This is for
  3269. + * simplicity, because the performance difference is expected to be negligible
  3270. + * and reusing a get_buffer written for video codecs would probably perform
  3271. + * badly due to a potentially very different allocation pattern.
  3272. + *
  3273. + * Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between
  3274. + * input and output. This means that for some packets they will not immediately
  3275. + * produce decoded output and need to be flushed at the end of decoding to get
  3276. + * all the decoded data. Flushing is done by calling this function with packets
  3277. + * with avpkt->data set to NULL and avpkt->size set to 0 until it stops
  3278. + * returning subtitles. It is safe to flush even those decoders that are not
  3279. + * marked with AV_CODEC_CAP_DELAY, then no subtitles will be returned.
  3280. + *
  3281. + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
  3282. + * before packets may be fed to the decoder.
  3283. + *
  3284. + * @param avctx the codec context
  3285. + * @param[out] sub The preallocated AVSubtitle in which the decoded subtitle
  3286. + * will be stored, must be freed with avsubtitle_free if *got_sub_ptr is set.
  3287. + * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed,
  3288. + * otherwise, it is nonzero.
  3289. + * @param[in] avpkt The input AVPacket containing the input buffer.
  3290. + */
  3291. +int avcodec_decode_subtitle2(AVCodecContext* avctx, AVSubtitle* sub,
  3292. + int* got_sub_ptr, const AVPacket* avpkt);
  3293. +
  3294. +/**
  3295. + * Supply raw packet data as input to a decoder.
  3296. + *
  3297. + * Internally, this call will copy relevant AVCodecContext fields, which can
  3298. + * influence decoding per-packet, and apply them when the packet is actually
  3299. + * decoded. (For example AVCodecContext.skip_frame, which might direct the
  3300. + * decoder to drop the frame contained by the packet sent with this function.)
  3301. + *
  3302. + * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE
  3303. + * larger than the actual read bytes because some optimized bitstream
  3304. + * readers read 32 or 64 bits at once and could read over the end.
  3305. + *
  3306. + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
  3307. + * before packets may be fed to the decoder.
  3308. + *
  3309. + * @param avctx codec context
  3310. + * @param[in] avpkt The input AVPacket. Usually, this will be a single video
  3311. + * frame, or several complete audio frames.
  3312. + * Ownership of the packet remains with the caller, and the
  3313. + * decoder will not write to the packet. The decoder may create
  3314. + * a reference to the packet data (or copy it if the packet is
  3315. + * not reference-counted).
  3316. + * Unlike with older APIs, the packet is always fully consumed,
  3317. + * and if it contains multiple frames (e.g. some audio codecs),
  3318. + * will require you to call avcodec_receive_frame() multiple
  3319. + * times afterwards before you can send a new packet.
  3320. + * It can be NULL (or an AVPacket with data set to NULL and
  3321. + * size set to 0); in this case, it is considered a flush
  3322. + * packet, which signals the end of the stream. Sending the
  3323. + * first flush packet will return success. Subsequent ones are
  3324. + * unnecessary and will return AVERROR_EOF. If the decoder
  3325. + * still has frames buffered, it will return them after sending
  3326. + * a flush packet.
  3327. + *
  3328. + * @retval 0 success
  3329. + * @retval AVERROR(EAGAIN) input is not accepted in the current state - user
  3330. + * must read output with avcodec_receive_frame() (once
  3331. + * all output is read, the packet should be resent,
  3332. + * and the call will not fail with EAGAIN).
  3333. + * @retval AVERROR_EOF the decoder has been flushed, and no new packets
  3334. + * can be sent to it (also returned if more than 1 flush packet is sent)
  3335. + * @retval AVERROR(EINVAL) codec not opened, it is an encoder, or requires
  3336. + * flush
  3337. + * @retval AVERROR(ENOMEM) failed to add packet to internal queue, or similar
  3338. + * @retval "another negative error code" legitimate decoding errors
  3339. + */
  3340. +int avcodec_send_packet(AVCodecContext* avctx, const AVPacket* avpkt);
  3341. +
  3342. +/**
  3343. + * Return decoded output data from a decoder or encoder (when the
  3344. + * AV_CODEC_FLAG_RECON_FRAME flag is used).
  3345. + *
  3346. + * @param avctx codec context
  3347. + * @param frame This will be set to a reference-counted video or audio
  3348. + * frame (depending on the decoder type) allocated by the
  3349. + * codec. Note that the function will always call
  3350. + * av_frame_unref(frame) before doing anything else.
  3351. + *
  3352. + * @retval 0 success, a frame was returned
  3353. + * @retval AVERROR(EAGAIN) output is not available in this state - user must
  3354. + * try to send new input
  3355. + * @retval AVERROR_EOF the codec has been fully flushed, and there will be
  3356. + * no more output frames
  3357. + * @retval AVERROR(EINVAL) codec not opened, or it is an encoder without the
  3358. + * AV_CODEC_FLAG_RECON_FRAME flag enabled
  3359. + * @retval AVERROR_INPUT_CHANGED current decoded frame has changed parameters
  3360. + * with respect to first decoded frame. Applicable when flag
  3361. + * AV_CODEC_FLAG_DROPCHANGED is set.
  3362. + * @retval "other negative error code" legitimate decoding errors
  3363. + */
  3364. +int avcodec_receive_frame(AVCodecContext* avctx, AVFrame* frame);
  3365. +
  3366. +/**
  3367. + * Supply a raw video or audio frame to the encoder. Use
  3368. + * avcodec_receive_packet() to retrieve buffered output packets.
  3369. + *
  3370. + * @param avctx codec context
  3371. + * @param[in] frame AVFrame containing the raw audio or video frame to be
  3372. + * encoded. Ownership of the frame remains with the caller, and the encoder will
  3373. + * not write to the frame. The encoder may create a reference to the frame data
  3374. + * (or copy it if the frame is not reference-counted). It can be NULL, in which
  3375. + * case it is considered a flush packet. This signals the end of the stream. If
  3376. + * the encoder still has packets buffered, it will return them after this call.
  3377. + * Once flushing mode has been entered, additional flush packets are ignored,
  3378. + * and sending frames will return AVERROR_EOF.
  3379. + *
  3380. + * For audio:
  3381. + * If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame
  3382. + * can have any number of samples.
  3383. + * If it is not set, frame->nb_samples must be equal to
  3384. + * avctx->frame_size for all frames except the last.
  3385. + * The final frame may be smaller than avctx->frame_size.
  3386. + * @retval 0 success
  3387. + * @retval AVERROR(EAGAIN) input is not accepted in the current state - user
  3388. + * must read output with avcodec_receive_packet() (once all output is read, the
  3389. + * packet should be resent, and the call will not fail with EAGAIN).
  3390. + * @retval AVERROR_EOF the encoder has been flushed, and no new frames can
  3391. + * be sent to it
  3392. + * @retval AVERROR(EINVAL) codec not opened, it is a decoder, or requires
  3393. + * flush
  3394. + * @retval AVERROR(ENOMEM) failed to add packet to internal queue, or similar
  3395. + * @retval "another negative error code" legitimate encoding errors
  3396. + */
  3397. +int avcodec_send_frame(AVCodecContext* avctx, const AVFrame* frame);
  3398. +
  3399. +/**
  3400. + * Read encoded data from the encoder.
  3401. + *
  3402. + * @param avctx codec context
  3403. + * @param avpkt This will be set to a reference-counted packet allocated by the
  3404. + * encoder. Note that the function will always call
  3405. + * av_packet_unref(avpkt) before doing anything else.
  3406. + * @retval 0 success
  3407. + * @retval AVERROR(EAGAIN) output is not available in the current state - user
  3408. + * must try to send input
  3409. + * @retval AVERROR_EOF the encoder has been fully flushed, and there will be
  3410. + * no more output packets
  3411. + * @retval AVERROR(EINVAL) codec not opened, or it is a decoder
  3412. + * @retval "another negative error code" legitimate encoding errors
  3413. + */
  3414. +int avcodec_receive_packet(AVCodecContext* avctx, AVPacket* avpkt);
  3415. +
  3416. +/**
  3417. + * Create and return a AVHWFramesContext with values adequate for hardware
  3418. + * decoding. This is meant to get called from the get_format callback, and is
  3419. + * a helper for preparing a AVHWFramesContext for AVCodecContext.hw_frames_ctx.
  3420. + * This API is for decoding with certain hardware acceleration modes/APIs only.
  3421. + *
  3422. + * The returned AVHWFramesContext is not initialized. The caller must do this
  3423. + * with av_hwframe_ctx_init().
  3424. + *
  3425. + * Calling this function is not a requirement, but makes it simpler to avoid
  3426. + * codec or hardware API specific details when manually allocating frames.
  3427. + *
  3428. + * Alternatively to this, an API user can set AVCodecContext.hw_device_ctx,
  3429. + * which sets up AVCodecContext.hw_frames_ctx fully automatically, and makes
  3430. + * it unnecessary to call this function or having to care about
  3431. + * AVHWFramesContext initialization at all.
  3432. + *
  3433. + * There are a number of requirements for calling this function:
  3434. + *
  3435. + * - It must be called from get_format with the same avctx parameter that was
  3436. + * passed to get_format. Calling it outside of get_format is not allowed, and
  3437. + * can trigger undefined behavior.
  3438. + * - The function is not always supported (see description of return values).
  3439. + * Even if this function returns successfully, hwaccel initialization could
  3440. + * fail later. (The degree to which implementations check whether the stream
  3441. + * is actually supported varies. Some do this check only after the user's
  3442. + * get_format callback returns.)
  3443. + * - The hw_pix_fmt must be one of the choices suggested by get_format. If the
  3444. + * user decides to use a AVHWFramesContext prepared with this API function,
  3445. + * the user must return the same hw_pix_fmt from get_format.
  3446. + * - The device_ref passed to this function must support the given hw_pix_fmt.
  3447. + * - After calling this API function, it is the user's responsibility to
  3448. + * initialize the AVHWFramesContext (returned by the out_frames_ref
  3449. + * parameter), and to set AVCodecContext.hw_frames_ctx to it. If done, this must
  3450. + * be done before returning from get_format (this is implied by the normal
  3451. + * AVCodecContext.hw_frames_ctx API rules).
  3452. + * - The AVHWFramesContext parameters may change every time time get_format is
  3453. + * called. Also, AVCodecContext.hw_frames_ctx is reset before get_format. So
  3454. + * you are inherently required to go through this process again on every
  3455. + * get_format call.
  3456. + * - It is perfectly possible to call this function without actually using
  3457. + * the resulting AVHWFramesContext. One use-case might be trying to reuse a
  3458. + * previously initialized AVHWFramesContext, and calling this API function
  3459. + * only to test whether the required frame parameters have changed.
  3460. + * - Fields that use dynamically allocated values of any kind must not be set
  3461. + * by the user unless setting them is explicitly allowed by the documentation.
  3462. + * If the user sets AVHWFramesContext.free and AVHWFramesContext.user_opaque,
  3463. + * the new free callback must call the potentially set previous free callback.
  3464. + * This API call may set any dynamically allocated fields, including the free
  3465. + * callback.
  3466. + *
  3467. + * The function will set at least the following fields on AVHWFramesContext
  3468. + * (potentially more, depending on hwaccel API):
  3469. + *
  3470. + * - All fields set by av_hwframe_ctx_alloc().
  3471. + * - Set the format field to hw_pix_fmt.
  3472. + * - Set the sw_format field to the most suited and most versatile format. (An
  3473. + * implication is that this will prefer generic formats over opaque formats
  3474. + * with arbitrary restrictions, if possible.)
  3475. + * - Set the width/height fields to the coded frame size, rounded up to the
  3476. + * API-specific minimum alignment.
  3477. + * - Only _if_ the hwaccel requires a pre-allocated pool: set the
  3478. + * initial_pool_size field to the number of maximum reference surfaces possible
  3479. + * with the codec, plus 1 surface for the user to work (meaning the user can
  3480. + * safely reference at most 1 decoded surface at a time), plus additional
  3481. + * buffering introduced by frame threading. If the hwaccel does not require
  3482. + * pre-allocation, the field is left to 0, and the decoder will allocate new
  3483. + * surfaces on demand during decoding.
  3484. + * - Possibly AVHWFramesContext.hwctx fields, depending on the underlying
  3485. + * hardware API.
  3486. + *
  3487. + * Essentially, out_frames_ref returns the same as av_hwframe_ctx_alloc(), but
  3488. + * with basic frame parameters set.
  3489. + *
  3490. + * The function is stateless, and does not change the AVCodecContext or the
  3491. + * device_ref AVHWDeviceContext.
  3492. + *
  3493. + * @param avctx The context which is currently calling get_format, and which
  3494. + * implicitly contains all state needed for filling the returned
  3495. + * AVHWFramesContext properly.
  3496. + * @param device_ref A reference to the AVHWDeviceContext describing the device
  3497. + * which will be used by the hardware decoder.
  3498. + * @param hw_pix_fmt The hwaccel format you are going to return from get_format.
  3499. + * @param out_frames_ref On success, set to a reference to an _uninitialized_
  3500. + * AVHWFramesContext, created from the given device_ref.
  3501. + * Fields will be set to values required for decoding.
  3502. + * Not changed if an error is returned.
  3503. + * @return zero on success, a negative value on error. The following error codes
  3504. + * have special semantics:
  3505. + * AVERROR(ENOENT): the decoder does not support this functionality. Setup
  3506. + * is always manual, or it is a decoder which does not
  3507. + * support setting AVCodecContext.hw_frames_ctx at all,
  3508. + * or it is a software format.
  3509. + * AVERROR(EINVAL): it is known that hardware decoding is not supported for
  3510. + * this configuration, or the device_ref is not supported
  3511. + * for the hwaccel referenced by hw_pix_fmt.
  3512. + */
  3513. +int avcodec_get_hw_frames_parameters(AVCodecContext* avctx,
  3514. + AVBufferRef* device_ref,
  3515. + enum AVPixelFormat hw_pix_fmt,
  3516. + AVBufferRef** out_frames_ref);
  3517. +
  3518. +/**
  3519. + * @defgroup lavc_parsing Frame parsing
  3520. + * @{
  3521. + */
  3522. +
  3523. +enum AVPictureStructure {
  3524. + AV_PICTURE_STRUCTURE_UNKNOWN, ///< unknown
  3525. + AV_PICTURE_STRUCTURE_TOP_FIELD, ///< coded as top field
  3526. + AV_PICTURE_STRUCTURE_BOTTOM_FIELD, ///< coded as bottom field
  3527. + AV_PICTURE_STRUCTURE_FRAME, ///< coded as frame
  3528. +};
  3529. +
  3530. +typedef struct AVCodecParserContext {
  3531. + void* priv_data;
  3532. + const struct AVCodecParser* parser;
  3533. + int64_t frame_offset; /* offset of the current frame */
  3534. + int64_t cur_offset; /* current offset
  3535. + (incremented by each av_parser_parse()) */
  3536. + int64_t next_frame_offset; /* offset of the next frame */
  3537. + /* video info */
  3538. + int pict_type; /* XXX: Put it back in AVCodecContext. */
  3539. + /**
  3540. + * This field is used for proper frame duration computation in lavf.
  3541. + * It signals, how much longer the frame duration of the current frame
  3542. + * is compared to normal frame duration.
  3543. + *
  3544. + * frame_duration = (1 + repeat_pict) * time_base
  3545. + *
  3546. + * It is used by codecs like H.264 to display telecined material.
  3547. + */
  3548. + int repeat_pict; /* XXX: Put it back in AVCodecContext. */
  3549. + int64_t pts; /* pts of the current frame */
  3550. + int64_t dts; /* dts of the current frame */
  3551. +
  3552. + /* private data */
  3553. + int64_t last_pts;
  3554. + int64_t last_dts;
  3555. + int fetch_timestamp;
  3556. +
  3557. +#define AV_PARSER_PTS_NB 4
  3558. + int cur_frame_start_index;
  3559. + int64_t cur_frame_offset[AV_PARSER_PTS_NB];
  3560. + int64_t cur_frame_pts[AV_PARSER_PTS_NB];
  3561. + int64_t cur_frame_dts[AV_PARSER_PTS_NB];
  3562. +
  3563. + int flags;
  3564. +#define PARSER_FLAG_COMPLETE_FRAMES 0x0001
  3565. +#define PARSER_FLAG_ONCE 0x0002
  3566. +/// Set if the parser has a valid file offset
  3567. +#define PARSER_FLAG_FETCHED_OFFSET 0x0004
  3568. +#define PARSER_FLAG_USE_CODEC_TS 0x1000
  3569. +
  3570. + int64_t offset; ///< byte offset from starting packet start
  3571. + int64_t cur_frame_end[AV_PARSER_PTS_NB];
  3572. +
  3573. + /**
  3574. + * Set by parser to 1 for key frames and 0 for non-key frames.
  3575. + * It is initialized to -1, so if the parser doesn't set this flag,
  3576. + * old-style fallback using AV_PICTURE_TYPE_I picture type as key frames
  3577. + * will be used.
  3578. + */
  3579. + int key_frame;
  3580. +
  3581. + // Timestamp generation support:
  3582. + /**
  3583. + * Synchronization point for start of timestamp generation.
  3584. + *
  3585. + * Set to >0 for sync point, 0 for no sync point and <0 for undefined
  3586. + * (default).
  3587. + *
  3588. + * For example, this corresponds to presence of H.264 buffering period
  3589. + * SEI message.
  3590. + */
  3591. + int dts_sync_point;
  3592. +
  3593. + /**
  3594. + * Offset of the current timestamp against last timestamp sync point in
  3595. + * units of AVCodecContext.time_base.
  3596. + *
  3597. + * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
  3598. + * contain a valid timestamp offset.
  3599. + *
  3600. + * Note that the timestamp of sync point has usually a nonzero
  3601. + * dts_ref_dts_delta, which refers to the previous sync point. Offset of
  3602. + * the next frame after timestamp sync point will be usually 1.
  3603. + *
  3604. + * For example, this corresponds to H.264 cpb_removal_delay.
  3605. + */
  3606. + int dts_ref_dts_delta;
  3607. +
  3608. + /**
  3609. + * Presentation delay of current frame in units of AVCodecContext.time_base.
  3610. + *
  3611. + * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
  3612. + * contain valid non-negative timestamp delta (presentation time of a frame
  3613. + * must not lie in the past).
  3614. + *
  3615. + * This delay represents the difference between decoding and presentation
  3616. + * time of the frame.
  3617. + *
  3618. + * For example, this corresponds to H.264 dpb_output_delay.
  3619. + */
  3620. + int pts_dts_delta;
  3621. +
  3622. + /**
  3623. + * Position of the packet in file.
  3624. + *
  3625. + * Analogous to cur_frame_pts/dts
  3626. + */
  3627. + int64_t cur_frame_pos[AV_PARSER_PTS_NB];
  3628. +
  3629. + /**
  3630. + * Byte position of currently parsed frame in stream.
  3631. + */
  3632. + int64_t pos;
  3633. +
  3634. + /**
  3635. + * Previous frame byte position.
  3636. + */
  3637. + int64_t last_pos;
  3638. +
  3639. + /**
  3640. + * Duration of the current frame.
  3641. + * For audio, this is in units of 1 / AVCodecContext.sample_rate.
  3642. + * For all other types, this is in units of AVCodecContext.time_base.
  3643. + */
  3644. + int duration;
  3645. +
  3646. + enum AVFieldOrder field_order;
  3647. +
  3648. + /**
  3649. + * Indicate whether a picture is coded as a frame, top field or bottom field.
  3650. + *
  3651. + * For example, H.264 field_pic_flag equal to 0 corresponds to
  3652. + * AV_PICTURE_STRUCTURE_FRAME. An H.264 picture with field_pic_flag
  3653. + * equal to 1 and bottom_field_flag equal to 0 corresponds to
  3654. + * AV_PICTURE_STRUCTURE_TOP_FIELD.
  3655. + */
  3656. + enum AVPictureStructure picture_structure;
  3657. +
  3658. + /**
  3659. + * Picture number incremented in presentation or output order.
  3660. + * This field may be reinitialized at the first picture of a new sequence.
  3661. + *
  3662. + * For example, this corresponds to H.264 PicOrderCnt.
  3663. + */
  3664. + int output_picture_number;
  3665. +
  3666. + /**
  3667. + * Dimensions of the decoded video intended for presentation.
  3668. + */
  3669. + int width;
  3670. + int height;
  3671. +
  3672. + /**
  3673. + * Dimensions of the coded video.
  3674. + */
  3675. + int coded_width;
  3676. + int coded_height;
  3677. +
  3678. + /**
  3679. + * The format of the coded data, corresponds to enum AVPixelFormat for video
  3680. + * and for enum AVSampleFormat for audio.
  3681. + *
  3682. + * Note that a decoder can have considerable freedom in how exactly it
  3683. + * decodes the data, so the format reported here might be different from the
  3684. + * one returned by a decoder.
  3685. + */
  3686. + int format;
  3687. +} AVCodecParserContext;
  3688. +
  3689. +typedef struct AVCodecParser {
  3690. + int codec_ids[7]; /* several codec IDs are permitted */
  3691. + int priv_data_size;
  3692. + int (*parser_init)(AVCodecParserContext* s);
  3693. + /* This callback never returns an error, a negative value means that
  3694. + * the frame start was in a previous packet. */
  3695. + int (*parser_parse)(AVCodecParserContext* s, AVCodecContext* avctx,
  3696. + const uint8_t** poutbuf, int* poutbuf_size,
  3697. + const uint8_t* buf, int buf_size);
  3698. + void (*parser_close)(AVCodecParserContext* s);
  3699. + int (*split)(AVCodecContext* avctx, const uint8_t* buf, int buf_size);
  3700. +} AVCodecParser;
  3701. +
  3702. +/**
  3703. + * Iterate over all registered codec parsers.
  3704. + *
  3705. + * @param opaque a pointer where libavcodec will store the iteration state. Must
  3706. + * point to NULL to start the iteration.
  3707. + *
  3708. + * @return the next registered codec parser or NULL when the iteration is
  3709. + * finished
  3710. + */
  3711. +const AVCodecParser* av_parser_iterate(void** opaque);
  3712. +
  3713. +AVCodecParserContext* av_parser_init(int codec_id);
  3714. +
  3715. +/**
  3716. + * Parse a packet.
  3717. + *
  3718. + * @param s parser context.
  3719. + * @param avctx codec context.
  3720. + * @param poutbuf set to pointer to parsed buffer or NULL if not yet
  3721. + finished.
  3722. + * @param poutbuf_size set to size of parsed buffer or zero if not yet
  3723. + finished.
  3724. + * @param buf input buffer.
  3725. + * @param buf_size buffer size in bytes without the padding. I.e. the full
  3726. + buffer size is assumed to be buf_size + AV_INPUT_BUFFER_PADDING_SIZE. To signal
  3727. + EOF, this should be 0 (so that the last frame can be output).
  3728. + * @param pts input presentation timestamp.
  3729. + * @param dts input decoding timestamp.
  3730. + * @param pos input byte position in stream.
  3731. + * @return the number of bytes of the input bitstream used.
  3732. + *
  3733. + * Example:
  3734. + * @code
  3735. + * while(in_len){
  3736. + * len = av_parser_parse2(myparser, AVCodecContext, &data, &size,
  3737. + * in_data, in_len,
  3738. + * pts, dts, pos);
  3739. + * in_data += len;
  3740. + * in_len -= len;
  3741. + *
  3742. + * if(size)
  3743. + * decode_frame(data, size);
  3744. + * }
  3745. + * @endcode
  3746. + */
  3747. +int av_parser_parse2(AVCodecParserContext* s, AVCodecContext* avctx,
  3748. + uint8_t** poutbuf, int* poutbuf_size, const uint8_t* buf,
  3749. + int buf_size, int64_t pts, int64_t dts, int64_t pos);
  3750. +
  3751. +void av_parser_close(AVCodecParserContext* s);
  3752. +
  3753. +/**
  3754. + * @}
  3755. + * @}
  3756. + */
  3757. +
  3758. +/**
  3759. + * @addtogroup lavc_encoding
  3760. + * @{
  3761. + */
  3762. +
  3763. +int avcodec_encode_subtitle(AVCodecContext* avctx, uint8_t* buf, int buf_size,
  3764. + const AVSubtitle* sub);
  3765. +
  3766. +/**
  3767. + * @}
  3768. + */
  3769. +
  3770. +/**
  3771. + * @defgroup lavc_misc Utility functions
  3772. + * @ingroup libavc
  3773. + *
  3774. + * Miscellaneous utility functions related to both encoding and decoding
  3775. + * (or neither).
  3776. + * @{
  3777. + */
  3778. +
  3779. +/**
  3780. + * @defgroup lavc_misc_pixfmt Pixel formats
  3781. + *
  3782. + * Functions for working with pixel formats.
  3783. + * @{
  3784. + */
  3785. +
  3786. +/**
  3787. + * Return a value representing the fourCC code associated to the
  3788. + * pixel format pix_fmt, or 0 if no associated fourCC code can be
  3789. + * found.
  3790. + */
  3791. +unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat pix_fmt);
  3792. +
  3793. +/**
  3794. + * Find the best pixel format to convert to given a certain source pixel
  3795. + * format. When converting from one pixel format to another, information loss
  3796. + * may occur. For example, when converting from RGB24 to GRAY, the color
  3797. + * information will be lost. Similarly, other losses occur when converting from
  3798. + * some formats to other formats. avcodec_find_best_pix_fmt_of_2() searches
  3799. + * which of the given pixel formats should be used to suffer the least amount of
  3800. + * loss. The pixel formats from which it chooses one, are determined by the
  3801. + * pix_fmt_list parameter.
  3802. + *
  3803. + *
  3804. + * @param[in] pix_fmt_list AV_PIX_FMT_NONE terminated array of pixel formats to
  3805. + * choose from
  3806. + * @param[in] src_pix_fmt source pixel format
  3807. + * @param[in] has_alpha Whether the source pixel format alpha channel is used.
  3808. + * @param[out] loss_ptr Combination of flags informing you what kind of losses
  3809. + * will occur.
  3810. + * @return The best pixel format to convert to or -1 if none was found.
  3811. + */
  3812. +enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(
  3813. + const enum AVPixelFormat* pix_fmt_list, enum AVPixelFormat src_pix_fmt,
  3814. + int has_alpha, int* loss_ptr);
  3815. +
  3816. +enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext* s,
  3817. + const enum AVPixelFormat* fmt);
  3818. +
  3819. +/**
  3820. + * @}
  3821. + */
  3822. +
  3823. +void avcodec_string(char* buf, int buf_size, AVCodecContext* enc, int encode);
  3824. +
  3825. +int avcodec_default_execute(AVCodecContext* c,
  3826. + int (*func)(AVCodecContext* c2, void* arg2),
  3827. + void* arg, int* ret, int count, int size);
  3828. +int avcodec_default_execute2(AVCodecContext* c,
  3829. + int (*func)(AVCodecContext* c2, void* arg2, int,
  3830. + int),
  3831. + void* arg, int* ret, int count);
  3832. +// FIXME func typedef
  3833. +
  3834. +/**
  3835. + * Fill AVFrame audio data and linesize pointers.
  3836. + *
  3837. + * The buffer buf must be a preallocated buffer with a size big enough
  3838. + * to contain the specified samples amount. The filled AVFrame data
  3839. + * pointers will point to this buffer.
  3840. + *
  3841. + * AVFrame extended_data channel pointers are allocated if necessary for
  3842. + * planar audio.
  3843. + *
  3844. + * @param frame the AVFrame
  3845. + * frame->nb_samples must be set prior to calling the
  3846. + * function. This function fills in frame->data,
  3847. + * frame->extended_data, frame->linesize[0].
  3848. + * @param nb_channels channel count
  3849. + * @param sample_fmt sample format
  3850. + * @param buf buffer to use for frame data
  3851. + * @param buf_size size of buffer
  3852. + * @param align plane size sample alignment (0 = default)
  3853. + * @return >=0 on success, negative error code on failure
  3854. + * @todo return the size in bytes required to store the samples in
  3855. + * case of success, at the next libavutil bump
  3856. + */
  3857. +int avcodec_fill_audio_frame(AVFrame* frame, int nb_channels,
  3858. + enum AVSampleFormat sample_fmt, const uint8_t* buf,
  3859. + int buf_size, int align);
  3860. +
  3861. +/**
  3862. + * Reset the internal codec state / flush internal buffers. Should be called
  3863. + * e.g. when seeking or when switching to a different stream.
  3864. + *
  3865. + * @note for decoders, this function just releases any references the decoder
  3866. + * might keep internally, but the caller's references remain valid.
  3867. + *
  3868. + * @note for encoders, this function will only do something if the encoder
  3869. + * declares support for AV_CODEC_CAP_ENCODER_FLUSH. When called, the encoder
  3870. + * will drain any remaining packets, and can then be re-used for a different
  3871. + * stream (as opposed to sending a null frame which will leave the encoder
  3872. + * in a permanent EOF state after draining). This can be desirable if the
  3873. + * cost of tearing down and replacing the encoder instance is high.
  3874. + */
  3875. +void avcodec_flush_buffers(AVCodecContext* avctx);
  3876. +
  3877. +/**
  3878. + * Return audio frame duration.
  3879. + *
  3880. + * @param avctx codec context
  3881. + * @param frame_bytes size of the frame, or 0 if unknown
  3882. + * @return frame duration, in samples, if known. 0 if not able to
  3883. + * determine.
  3884. + */
  3885. +int av_get_audio_frame_duration(AVCodecContext* avctx, int frame_bytes);
  3886. +
  3887. +/* memory */
  3888. +
  3889. +/**
  3890. + * Same behaviour av_fast_malloc but the buffer has additional
  3891. + * AV_INPUT_BUFFER_PADDING_SIZE at the end which will always be 0.
  3892. + *
  3893. + * In addition the whole buffer will initially and after resizes
  3894. + * be 0-initialized so that no uninitialized data will ever appear.
  3895. + */
  3896. +void av_fast_padded_malloc(void* ptr, unsigned int* size, size_t min_size);
  3897. +
  3898. +/**
  3899. + * Same behaviour av_fast_padded_malloc except that buffer will always
  3900. + * be 0-initialized after call.
  3901. + */
  3902. +void av_fast_padded_mallocz(void* ptr, unsigned int* size, size_t min_size);
  3903. +
  3904. +/**
  3905. + * @return a positive value if s is open (i.e. avcodec_open2() was called on it
  3906. + * with no corresponding avcodec_close()), 0 otherwise.
  3907. + */
  3908. +int avcodec_is_open(AVCodecContext* s);
  3909. +
  3910. +/**
  3911. + * @}
  3912. + */
  3913. +
  3914. +#endif /* AVCODEC_AVCODEC_H */
  3915. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/avdct.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/avdct.h
  3916. new file mode 100644
  3917. index 00000000..9edf4c18
  3918. --- /dev/null
  3919. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/avdct.h
  3920. @@ -0,0 +1,85 @@
  3921. +/*
  3922. + * This file is part of FFmpeg.
  3923. + *
  3924. + * FFmpeg is free software; you can redistribute it and/or
  3925. + * modify it under the terms of the GNU Lesser General Public
  3926. + * License as published by the Free Software Foundation; either
  3927. + * version 2.1 of the License, or (at your option) any later version.
  3928. + *
  3929. + * FFmpeg is distributed in the hope that it will be useful,
  3930. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  3931. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  3932. + * Lesser General Public License for more details.
  3933. + *
  3934. + * You should have received a copy of the GNU Lesser General Public
  3935. + * License along with FFmpeg; if not, write to the Free Software
  3936. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  3937. + */
  3938. +
  3939. +#ifndef AVCODEC_AVDCT_H
  3940. +#define AVCODEC_AVDCT_H
  3941. +
  3942. +#include "libavutil/opt.h"
  3943. +
  3944. +/**
  3945. + * AVDCT context.
  3946. + * @note function pointers can be NULL if the specific features have been
  3947. + * disabled at build time.
  3948. + */
  3949. +typedef struct AVDCT {
  3950. + const AVClass* av_class;
  3951. +
  3952. + void (*idct)(int16_t* block /* align 16 */);
  3953. +
  3954. + /**
  3955. + * IDCT input permutation.
  3956. + * Several optimized IDCTs need a permutated input (relative to the
  3957. + * normal order of the reference IDCT).
  3958. + * This permutation must be performed before the idct_put/add.
  3959. + * Note, normally this can be merged with the zigzag/alternate scan<br>
  3960. + * An example to avoid confusion:
  3961. + * - (->decode coeffs -> zigzag reorder -> dequant -> reference IDCT -> ...)
  3962. + * - (x -> reference DCT -> reference IDCT -> x)
  3963. + * - (x -> reference DCT -> simple_mmx_perm = idct_permutation
  3964. + * -> simple_idct_mmx -> x)
  3965. + * - (-> decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant
  3966. + * -> simple_idct_mmx -> ...)
  3967. + */
  3968. + uint8_t idct_permutation[64];
  3969. +
  3970. + void (*fdct)(int16_t* block /* align 16 */);
  3971. +
  3972. + /**
  3973. + * DCT algorithm.
  3974. + * must use AVOptions to set this field.
  3975. + */
  3976. + int dct_algo;
  3977. +
  3978. + /**
  3979. + * IDCT algorithm.
  3980. + * must use AVOptions to set this field.
  3981. + */
  3982. + int idct_algo;
  3983. +
  3984. + void (*get_pixels)(int16_t* block /* align 16 */,
  3985. + const uint8_t* pixels /* align 8 */, ptrdiff_t line_size);
  3986. +
  3987. + int bits_per_sample;
  3988. +
  3989. + void (*get_pixels_unaligned)(int16_t* block /* align 16 */,
  3990. + const uint8_t* pixels, ptrdiff_t line_size);
  3991. +} AVDCT;
  3992. +
  3993. +/**
  3994. + * Allocates a AVDCT context.
  3995. + * This needs to be initialized with avcodec_dct_init() after optionally
  3996. + * configuring it with AVOptions.
  3997. + *
  3998. + * To free it use av_free()
  3999. + */
  4000. +AVDCT* avcodec_dct_alloc(void);
  4001. +int avcodec_dct_init(AVDCT*);
  4002. +
  4003. +const AVClass* avcodec_dct_get_class(void);
  4004. +
  4005. +#endif /* AVCODEC_AVDCT_H */
  4006. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/avfft.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/avfft.h
  4007. new file mode 100644
  4008. index 00000000..115370eb
  4009. --- /dev/null
  4010. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/avfft.h
  4011. @@ -0,0 +1,119 @@
  4012. +/*
  4013. + * This file is part of FFmpeg.
  4014. + *
  4015. + * FFmpeg is free software; you can redistribute it and/or
  4016. + * modify it under the terms of the GNU Lesser General Public
  4017. + * License as published by the Free Software Foundation; either
  4018. + * version 2.1 of the License, or (at your option) any later version.
  4019. + *
  4020. + * FFmpeg is distributed in the hope that it will be useful,
  4021. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  4022. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  4023. + * Lesser General Public License for more details.
  4024. + *
  4025. + * You should have received a copy of the GNU Lesser General Public
  4026. + * License along with FFmpeg; if not, write to the Free Software
  4027. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  4028. + */
  4029. +
  4030. +#ifndef AVCODEC_AVFFT_H
  4031. +#define AVCODEC_AVFFT_H
  4032. +
  4033. +/**
  4034. + * @file
  4035. + * @ingroup lavc_fft
  4036. + * FFT functions
  4037. + */
  4038. +
  4039. +/**
  4040. + * @defgroup lavc_fft FFT functions
  4041. + * @ingroup lavc_misc
  4042. + *
  4043. + * @{
  4044. + */
  4045. +
  4046. +typedef float FFTSample;
  4047. +
  4048. +typedef struct FFTComplex {
  4049. + FFTSample re, im;
  4050. +} FFTComplex;
  4051. +
  4052. +typedef struct FFTContext FFTContext;
  4053. +
  4054. +/**
  4055. + * Set up a complex FFT.
  4056. + * @param nbits log2 of the length of the input array
  4057. + * @param inverse if 0 perform the forward transform, if 1 perform the
  4058. + * inverse
  4059. + */
  4060. +FFTContext* av_fft_init(int nbits, int inverse);
  4061. +
  4062. +/**
  4063. + * Do the permutation needed BEFORE calling ff_fft_calc().
  4064. + */
  4065. +void av_fft_permute(FFTContext* s, FFTComplex* z);
  4066. +
  4067. +/**
  4068. + * Do a complex FFT with the parameters defined in av_fft_init(). The
  4069. + * input data must be permuted before. No 1.0/sqrt(n) normalization is done.
  4070. + */
  4071. +void av_fft_calc(FFTContext* s, FFTComplex* z);
  4072. +
  4073. +void av_fft_end(FFTContext* s);
  4074. +
  4075. +FFTContext* av_mdct_init(int nbits, int inverse, double scale);
  4076. +void av_imdct_calc(FFTContext* s, FFTSample* output, const FFTSample* input);
  4077. +void av_imdct_half(FFTContext* s, FFTSample* output, const FFTSample* input);
  4078. +void av_mdct_calc(FFTContext* s, FFTSample* output, const FFTSample* input);
  4079. +void av_mdct_end(FFTContext* s);
  4080. +
  4081. +/* Real Discrete Fourier Transform */
  4082. +
  4083. +enum RDFTransformType {
  4084. + DFT_R2C,
  4085. + IDFT_C2R,
  4086. + IDFT_R2C,
  4087. + DFT_C2R,
  4088. +};
  4089. +
  4090. +typedef struct RDFTContext RDFTContext;
  4091. +
  4092. +/**
  4093. + * Set up a real FFT.
  4094. + * @param nbits log2 of the length of the input array
  4095. + * @param trans the type of transform
  4096. + */
  4097. +RDFTContext* av_rdft_init(int nbits, enum RDFTransformType trans);
  4098. +void av_rdft_calc(RDFTContext* s, FFTSample* data);
  4099. +void av_rdft_end(RDFTContext* s);
  4100. +
  4101. +/* Discrete Cosine Transform */
  4102. +
  4103. +typedef struct DCTContext DCTContext;
  4104. +
  4105. +enum DCTTransformType {
  4106. + DCT_II = 0,
  4107. + DCT_III,
  4108. + DCT_I,
  4109. + DST_I,
  4110. +};
  4111. +
  4112. +/**
  4113. + * Set up DCT.
  4114. + *
  4115. + * @param nbits size of the input array:
  4116. + * (1 << nbits) for DCT-II, DCT-III and DST-I
  4117. + * (1 << nbits) + 1 for DCT-I
  4118. + * @param type the type of transform
  4119. + *
  4120. + * @note the first element of the input of DST-I is ignored
  4121. + */
  4122. +DCTContext* av_dct_init(int nbits, enum DCTTransformType type);
  4123. +void av_dct_calc(DCTContext* s, FFTSample* data);
  4124. +void av_dct_end(DCTContext* s);
  4125. +
  4126. +/**
  4127. + * @}
  4128. + */
  4129. +
  4130. +#endif /* AVCODEC_AVFFT_H */
  4131. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/bsf.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/bsf.h
  4132. new file mode 100644
  4133. index 00000000..044a0597
  4134. --- /dev/null
  4135. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/bsf.h
  4136. @@ -0,0 +1,335 @@
  4137. +/*
  4138. + * Bitstream filters public API
  4139. + *
  4140. + * This file is part of FFmpeg.
  4141. + *
  4142. + * FFmpeg is free software; you can redistribute it and/or
  4143. + * modify it under the terms of the GNU Lesser General Public
  4144. + * License as published by the Free Software Foundation; either
  4145. + * version 2.1 of the License, or (at your option) any later version.
  4146. + *
  4147. + * FFmpeg is distributed in the hope that it will be useful,
  4148. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  4149. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  4150. + * Lesser General Public License for more details.
  4151. + *
  4152. + * You should have received a copy of the GNU Lesser General Public
  4153. + * License along with FFmpeg; if not, write to the Free Software
  4154. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  4155. + */
  4156. +
  4157. +#ifndef AVCODEC_BSF_H
  4158. +#define AVCODEC_BSF_H
  4159. +
  4160. +#include "libavutil/dict.h"
  4161. +#include "libavutil/log.h"
  4162. +#include "libavutil/rational.h"
  4163. +
  4164. +#include "codec_id.h"
  4165. +#include "codec_par.h"
  4166. +#include "packet.h"
  4167. +
  4168. +/**
  4169. + * @defgroup lavc_bsf Bitstream filters
  4170. + * @ingroup libavc
  4171. + *
  4172. + * Bitstream filters transform encoded media data without decoding it. This
  4173. + * allows e.g. manipulating various header values. Bitstream filters operate on
  4174. + * @ref AVPacket "AVPackets".
  4175. + *
  4176. + * The bitstream filtering API is centered around two structures:
  4177. + * AVBitStreamFilter and AVBSFContext. The former represents a bitstream filter
  4178. + * in abstract, the latter a specific filtering process. Obtain an
  4179. + * AVBitStreamFilter using av_bsf_get_by_name() or av_bsf_iterate(), then pass
  4180. + * it to av_bsf_alloc() to create an AVBSFContext. Fill in the user-settable
  4181. + * AVBSFContext fields, as described in its documentation, then call
  4182. + * av_bsf_init() to prepare the filter context for use.
  4183. + *
  4184. + * Submit packets for filtering using av_bsf_send_packet(), obtain filtered
  4185. + * results with av_bsf_receive_packet(). When no more input packets will be
  4186. + * sent, submit a NULL AVPacket to signal the end of the stream to the filter.
  4187. + * av_bsf_receive_packet() will then return trailing packets, if any are
  4188. + * produced by the filter.
  4189. + *
  4190. + * Finally, free the filter context with av_bsf_free().
  4191. + * @{
  4192. + */
  4193. +
  4194. +/**
  4195. + * The bitstream filter state.
  4196. + *
  4197. + * This struct must be allocated with av_bsf_alloc() and freed with
  4198. + * av_bsf_free().
  4199. + *
  4200. + * The fields in the struct will only be changed (by the caller or by the
  4201. + * filter) as described in their documentation, and are to be considered
  4202. + * immutable otherwise.
  4203. + */
  4204. +typedef struct AVBSFContext {
  4205. + /**
  4206. + * A class for logging and AVOptions
  4207. + */
  4208. + const AVClass* av_class;
  4209. +
  4210. + /**
  4211. + * The bitstream filter this context is an instance of.
  4212. + */
  4213. + const struct AVBitStreamFilter* filter;
  4214. +
  4215. + /**
  4216. + * Opaque filter-specific private data. If filter->priv_class is non-NULL,
  4217. + * this is an AVOptions-enabled struct.
  4218. + */
  4219. + void* priv_data;
  4220. +
  4221. + /**
  4222. + * Parameters of the input stream. This field is allocated in
  4223. + * av_bsf_alloc(), it needs to be filled by the caller before
  4224. + * av_bsf_init().
  4225. + */
  4226. + AVCodecParameters* par_in;
  4227. +
  4228. + /**
  4229. + * Parameters of the output stream. This field is allocated in
  4230. + * av_bsf_alloc(), it is set by the filter in av_bsf_init().
  4231. + */
  4232. + AVCodecParameters* par_out;
  4233. +
  4234. + /**
  4235. + * The timebase used for the timestamps of the input packets. Set by the
  4236. + * caller before av_bsf_init().
  4237. + */
  4238. + AVRational time_base_in;
  4239. +
  4240. + /**
  4241. + * The timebase used for the timestamps of the output packets. Set by the
  4242. + * filter in av_bsf_init().
  4243. + */
  4244. + AVRational time_base_out;
  4245. +} AVBSFContext;
  4246. +
  4247. +typedef struct AVBitStreamFilter {
  4248. + const char* name;
  4249. +
  4250. + /**
  4251. + * A list of codec ids supported by the filter, terminated by
  4252. + * AV_CODEC_ID_NONE.
  4253. + * May be NULL, in that case the bitstream filter works with any codec id.
  4254. + */
  4255. + const enum AVCodecID* codec_ids;
  4256. +
  4257. + /**
  4258. + * A class for the private data, used to declare bitstream filter private
  4259. + * AVOptions. This field is NULL for bitstream filters that do not declare
  4260. + * any options.
  4261. + *
  4262. + * If this field is non-NULL, the first member of the filter private data
  4263. + * must be a pointer to AVClass, which will be set by libavcodec generic
  4264. + * code to this class.
  4265. + */
  4266. + const AVClass* priv_class;
  4267. +} AVBitStreamFilter;
  4268. +
  4269. +/**
  4270. + * @return a bitstream filter with the specified name or NULL if no such
  4271. + * bitstream filter exists.
  4272. + */
  4273. +const AVBitStreamFilter* av_bsf_get_by_name(const char* name);
  4274. +
  4275. +/**
  4276. + * Iterate over all registered bitstream filters.
  4277. + *
  4278. + * @param opaque a pointer where libavcodec will store the iteration state. Must
  4279. + * point to NULL to start the iteration.
  4280. + *
  4281. + * @return the next registered bitstream filter or NULL when the iteration is
  4282. + * finished
  4283. + */
  4284. +const AVBitStreamFilter* av_bsf_iterate(void** opaque);
  4285. +
  4286. +/**
  4287. + * Allocate a context for a given bitstream filter. The caller must fill in the
  4288. + * context parameters as described in the documentation and then call
  4289. + * av_bsf_init() before sending any data to the filter.
  4290. + *
  4291. + * @param filter the filter for which to allocate an instance.
  4292. + * @param[out] ctx a pointer into which the pointer to the newly-allocated
  4293. + * context will be written. It must be freed with av_bsf_free() after the
  4294. + * filtering is done.
  4295. + *
  4296. + * @return 0 on success, a negative AVERROR code on failure
  4297. + */
  4298. +int av_bsf_alloc(const AVBitStreamFilter* filter, AVBSFContext** ctx);
  4299. +
  4300. +/**
  4301. + * Prepare the filter for use, after all the parameters and options have been
  4302. + * set.
  4303. + *
  4304. + * @param ctx a AVBSFContext previously allocated with av_bsf_alloc()
  4305. + */
  4306. +int av_bsf_init(AVBSFContext* ctx);
  4307. +
  4308. +/**
  4309. + * Submit a packet for filtering.
  4310. + *
  4311. + * After sending each packet, the filter must be completely drained by calling
  4312. + * av_bsf_receive_packet() repeatedly until it returns AVERROR(EAGAIN) or
  4313. + * AVERROR_EOF.
  4314. + *
  4315. + * @param ctx an initialized AVBSFContext
  4316. + * @param pkt the packet to filter. The bitstream filter will take ownership of
  4317. + * the packet and reset the contents of pkt. pkt is not touched if an error
  4318. + * occurs. If pkt is empty (i.e. NULL, or pkt->data is NULL and
  4319. + * pkt->side_data_elems zero), it signals the end of the stream (i.e. no more
  4320. + * non-empty packets will be sent; sending more empty packets does nothing) and
  4321. + * will cause the filter to output any packets it may have buffered internally.
  4322. + *
  4323. + * @return
  4324. + * - 0 on success.
  4325. + * - AVERROR(EAGAIN) if packets need to be retrieved from the filter (using
  4326. + * av_bsf_receive_packet()) before new input can be consumed.
  4327. + * - Another negative AVERROR value if an error occurs.
  4328. + */
  4329. +int av_bsf_send_packet(AVBSFContext* ctx, AVPacket* pkt);
  4330. +
  4331. +/**
  4332. + * Retrieve a filtered packet.
  4333. + *
  4334. + * @param ctx an initialized AVBSFContext
  4335. + * @param[out] pkt this struct will be filled with the contents of the filtered
  4336. + * packet. It is owned by the caller and must be freed using
  4337. + * av_packet_unref() when it is no longer needed.
  4338. + * This parameter should be "clean" (i.e. freshly allocated
  4339. + * with av_packet_alloc() or unreffed with av_packet_unref())
  4340. + * when this function is called. If this function returns
  4341. + * successfully, the contents of pkt will be completely
  4342. + * overwritten by the returned data. On failure, pkt is not
  4343. + * touched.
  4344. + *
  4345. + * @return
  4346. + * - 0 on success.
  4347. + * - AVERROR(EAGAIN) if more packets need to be sent to the filter (using
  4348. + * av_bsf_send_packet()) to get more output.
  4349. + * - AVERROR_EOF if there will be no further output from the filter.
  4350. + * - Another negative AVERROR value if an error occurs.
  4351. + *
  4352. + * @note one input packet may result in several output packets, so after sending
  4353. + * a packet with av_bsf_send_packet(), this function needs to be called
  4354. + * repeatedly until it stops returning 0. It is also possible for a filter to
  4355. + * output fewer packets than were sent to it, so this function may return
  4356. + * AVERROR(EAGAIN) immediately after a successful av_bsf_send_packet() call.
  4357. + */
  4358. +int av_bsf_receive_packet(AVBSFContext* ctx, AVPacket* pkt);
  4359. +
  4360. +/**
  4361. + * Reset the internal bitstream filter state. Should be called e.g. when
  4362. + * seeking.
  4363. + */
  4364. +void av_bsf_flush(AVBSFContext* ctx);
  4365. +
  4366. +/**
  4367. + * Free a bitstream filter context and everything associated with it; write NULL
  4368. + * into the supplied pointer.
  4369. + */
  4370. +void av_bsf_free(AVBSFContext** ctx);
  4371. +
  4372. +/**
  4373. + * Get the AVClass for AVBSFContext. It can be used in combination with
  4374. + * AV_OPT_SEARCH_FAKE_OBJ for examining options.
  4375. + *
  4376. + * @see av_opt_find().
  4377. + */
  4378. +const AVClass* av_bsf_get_class(void);
  4379. +
  4380. +/**
  4381. + * Structure for chain/list of bitstream filters.
  4382. + * Empty list can be allocated by av_bsf_list_alloc().
  4383. + */
  4384. +typedef struct AVBSFList AVBSFList;
  4385. +
  4386. +/**
  4387. + * Allocate empty list of bitstream filters.
  4388. + * The list must be later freed by av_bsf_list_free()
  4389. + * or finalized by av_bsf_list_finalize().
  4390. + *
  4391. + * @return Pointer to @ref AVBSFList on success, NULL in case of failure
  4392. + */
  4393. +AVBSFList* av_bsf_list_alloc(void);
  4394. +
  4395. +/**
  4396. + * Free list of bitstream filters.
  4397. + *
  4398. + * @param lst Pointer to pointer returned by av_bsf_list_alloc()
  4399. + */
  4400. +void av_bsf_list_free(AVBSFList** lst);
  4401. +
  4402. +/**
  4403. + * Append bitstream filter to the list of bitstream filters.
  4404. + *
  4405. + * @param lst List to append to
  4406. + * @param bsf Filter context to be appended
  4407. + *
  4408. + * @return >=0 on success, negative AVERROR in case of failure
  4409. + */
  4410. +int av_bsf_list_append(AVBSFList* lst, AVBSFContext* bsf);
  4411. +
  4412. +/**
  4413. + * Construct new bitstream filter context given it's name and options
  4414. + * and append it to the list of bitstream filters.
  4415. + *
  4416. + * @param lst List to append to
  4417. + * @param bsf_name Name of the bitstream filter
  4418. + * @param options Options for the bitstream filter, can be set to NULL
  4419. + *
  4420. + * @return >=0 on success, negative AVERROR in case of failure
  4421. + */
  4422. +int av_bsf_list_append2(AVBSFList* lst, const char* bsf_name,
  4423. + AVDictionary** options);
  4424. +/**
  4425. + * Finalize list of bitstream filters.
  4426. + *
  4427. + * This function will transform @ref AVBSFList to single @ref AVBSFContext,
  4428. + * so the whole chain of bitstream filters can be treated as single filter
  4429. + * freshly allocated by av_bsf_alloc().
  4430. + * If the call is successful, @ref AVBSFList structure is freed and lst
  4431. + * will be set to NULL. In case of failure, caller is responsible for
  4432. + * freeing the structure by av_bsf_list_free()
  4433. + *
  4434. + * @param lst Filter list structure to be transformed
  4435. + * @param[out] bsf Pointer to be set to newly created @ref AVBSFContext
  4436. + * structure representing the chain of bitstream filters
  4437. + *
  4438. + * @return >=0 on success, negative AVERROR in case of failure
  4439. + */
  4440. +int av_bsf_list_finalize(AVBSFList** lst, AVBSFContext** bsf);
  4441. +
  4442. +/**
  4443. + * Parse string describing list of bitstream filters and create single
  4444. + * @ref AVBSFContext describing the whole chain of bitstream filters.
  4445. + * Resulting @ref AVBSFContext can be treated as any other @ref AVBSFContext
  4446. + * freshly allocated by av_bsf_alloc().
  4447. + *
  4448. + * @param str String describing chain of bitstream filters in format
  4449. + * `bsf1[=opt1=val1:opt2=val2][,bsf2]`
  4450. + * @param[out] bsf Pointer to be set to newly created @ref AVBSFContext
  4451. + * structure representing the chain of bitstream filters
  4452. + *
  4453. + * @return >=0 on success, negative AVERROR in case of failure
  4454. + */
  4455. +int av_bsf_list_parse_str(const char* str, AVBSFContext** bsf);
  4456. +
  4457. +/**
  4458. + * Get null/pass-through bitstream filter.
  4459. + *
  4460. + * @param[out] bsf Pointer to be set to new instance of pass-through bitstream
  4461. + * filter
  4462. + *
  4463. + * @return
  4464. + */
  4465. +int av_bsf_get_null_filter(AVBSFContext** bsf);
  4466. +
  4467. +/**
  4468. + * @}
  4469. + */
  4470. +
  4471. +#endif // AVCODEC_BSF_H
  4472. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/codec.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/codec.h
  4473. new file mode 100644
  4474. index 00000000..4340d850
  4475. --- /dev/null
  4476. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/codec.h
  4477. @@ -0,0 +1,387 @@
  4478. +/*
  4479. + * AVCodec public API
  4480. + *
  4481. + * This file is part of FFmpeg.
  4482. + *
  4483. + * FFmpeg is free software; you can redistribute it and/or
  4484. + * modify it under the terms of the GNU Lesser General Public
  4485. + * License as published by the Free Software Foundation; either
  4486. + * version 2.1 of the License, or (at your option) any later version.
  4487. + *
  4488. + * FFmpeg is distributed in the hope that it will be useful,
  4489. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  4490. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  4491. + * Lesser General Public License for more details.
  4492. + *
  4493. + * You should have received a copy of the GNU Lesser General Public
  4494. + * License along with FFmpeg; if not, write to the Free Software
  4495. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  4496. + */
  4497. +
  4498. +#ifndef AVCODEC_CODEC_H
  4499. +#define AVCODEC_CODEC_H
  4500. +
  4501. +#include <stdint.h>
  4502. +
  4503. +#include "libavutil/avutil.h"
  4504. +#include "libavutil/hwcontext.h"
  4505. +#include "libavutil/log.h"
  4506. +#include "libavutil/pixfmt.h"
  4507. +#include "libavutil/rational.h"
  4508. +#include "libavutil/samplefmt.h"
  4509. +
  4510. +#include "libavcodec/codec_id.h"
  4511. +#include "libavcodec/version_major.h"
  4512. +
  4513. +/**
  4514. + * @addtogroup lavc_core
  4515. + * @{
  4516. + */
  4517. +
  4518. +/**
  4519. + * Decoder can use draw_horiz_band callback.
  4520. + */
  4521. +#define AV_CODEC_CAP_DRAW_HORIZ_BAND (1 << 0)
  4522. +/**
  4523. + * Codec uses get_buffer() or get_encode_buffer() for allocating buffers and
  4524. + * supports custom allocators.
  4525. + * If not set, it might not use get_buffer() or get_encode_buffer() at all, or
  4526. + * use operations that assume the buffer was allocated by
  4527. + * avcodec_default_get_buffer2 or avcodec_default_get_encode_buffer.
  4528. + */
  4529. +#define AV_CODEC_CAP_DR1 (1 << 1)
  4530. +/**
  4531. + * Encoder or decoder requires flushing with NULL input at the end in order to
  4532. + * give the complete and correct output.
  4533. + *
  4534. + * NOTE: If this flag is not set, the codec is guaranteed to never be fed with
  4535. + * with NULL data. The user can still send NULL data to the public encode
  4536. + * or decode function, but libavcodec will not pass it along to the codec
  4537. + * unless this flag is set.
  4538. + *
  4539. + * Decoders:
  4540. + * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL,
  4541. + * avpkt->size=0 at the end to get the delayed data until the decoder no longer
  4542. + * returns frames.
  4543. + *
  4544. + * Encoders:
  4545. + * The encoder needs to be fed with NULL data at the end of encoding until the
  4546. + * encoder no longer returns data.
  4547. + *
  4548. + * NOTE: For encoders implementing the AVCodec.encode2() function, setting this
  4549. + * flag also means that the encoder must set the pts and duration for
  4550. + * each output packet. If this flag is not set, the pts and duration will
  4551. + * be determined by libavcodec from the input frame.
  4552. + */
  4553. +#define AV_CODEC_CAP_DELAY (1 << 5)
  4554. +/**
  4555. + * Codec can be fed a final frame with a smaller size.
  4556. + * This can be used to prevent truncation of the last audio samples.
  4557. + */
  4558. +#define AV_CODEC_CAP_SMALL_LAST_FRAME (1 << 6)
  4559. +
  4560. +/**
  4561. + * Codec can output multiple frames per AVPacket
  4562. + * Normally demuxers return one frame at a time, demuxers which do not do
  4563. + * are connected to a parser to split what they return into proper frames.
  4564. + * This flag is reserved to the very rare category of codecs which have a
  4565. + * bitstream that cannot be split into frames without timeconsuming
  4566. + * operations like full decoding. Demuxers carrying such bitstreams thus
  4567. + * may return multiple frames in a packet. This has many disadvantages like
  4568. + * prohibiting stream copy in many cases thus it should only be considered
  4569. + * as a last resort.
  4570. + */
  4571. +#define AV_CODEC_CAP_SUBFRAMES (1 << 8)
  4572. +/**
  4573. + * Codec is experimental and is thus avoided in favor of non experimental
  4574. + * encoders
  4575. + */
  4576. +#define AV_CODEC_CAP_EXPERIMENTAL (1 << 9)
  4577. +/**
  4578. + * Codec should fill in channel configuration and samplerate instead of
  4579. + * container
  4580. + */
  4581. +#define AV_CODEC_CAP_CHANNEL_CONF (1 << 10)
  4582. +/**
  4583. + * Codec supports frame-level multithreading.
  4584. + */
  4585. +#define AV_CODEC_CAP_FRAME_THREADS (1 << 12)
  4586. +/**
  4587. + * Codec supports slice-based (or partition-based) multithreading.
  4588. + */
  4589. +#define AV_CODEC_CAP_SLICE_THREADS (1 << 13)
  4590. +/**
  4591. + * Codec supports changed parameters at any point.
  4592. + */
  4593. +#define AV_CODEC_CAP_PARAM_CHANGE (1 << 14)
  4594. +/**
  4595. + * Codec supports multithreading through a method other than slice- or
  4596. + * frame-level multithreading. Typically this marks wrappers around
  4597. + * multithreading-capable external libraries.
  4598. + */
  4599. +#define AV_CODEC_CAP_OTHER_THREADS (1 << 15)
  4600. +/**
  4601. + * Audio encoder supports receiving a different number of samples in each call.
  4602. + */
  4603. +#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE (1 << 16)
  4604. +/**
  4605. + * Decoder is not a preferred choice for probing.
  4606. + * This indicates that the decoder is not a good choice for probing.
  4607. + * It could for example be an expensive to spin up hardware decoder,
  4608. + * or it could simply not provide a lot of useful information about
  4609. + * the stream.
  4610. + * A decoder marked with this flag should only be used as last resort
  4611. + * choice for probing.
  4612. + */
  4613. +#define AV_CODEC_CAP_AVOID_PROBING (1 << 17)
  4614. +
  4615. +/**
  4616. + * Codec is backed by a hardware implementation. Typically used to
  4617. + * identify a non-hwaccel hardware decoder. For information about hwaccels, use
  4618. + * avcodec_get_hw_config() instead.
  4619. + */
  4620. +#define AV_CODEC_CAP_HARDWARE (1 << 18)
  4621. +
  4622. +/**
  4623. + * Codec is potentially backed by a hardware implementation, but not
  4624. + * necessarily. This is used instead of AV_CODEC_CAP_HARDWARE, if the
  4625. + * implementation provides some sort of internal fallback.
  4626. + */
  4627. +#define AV_CODEC_CAP_HYBRID (1 << 19)
  4628. +
  4629. +/**
  4630. + * This encoder can reorder user opaque values from input AVFrames and return
  4631. + * them with corresponding output packets.
  4632. + * @see AV_CODEC_FLAG_COPY_OPAQUE
  4633. + */
  4634. +#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE (1 << 20)
  4635. +
  4636. +/**
  4637. + * This encoder can be flushed using avcodec_flush_buffers(). If this flag is
  4638. + * not set, the encoder must be closed and reopened to ensure that no frames
  4639. + * remain pending.
  4640. + */
  4641. +#define AV_CODEC_CAP_ENCODER_FLUSH (1 << 21)
  4642. +
  4643. +/**
  4644. + * The encoder is able to output reconstructed frame data, i.e. raw frames that
  4645. + * would be produced by decoding the encoded bitstream.
  4646. + *
  4647. + * Reconstructed frame output is enabled by the AV_CODEC_FLAG_RECON_FRAME flag.
  4648. + */
  4649. +#define AV_CODEC_CAP_ENCODER_RECON_FRAME (1 << 22)
  4650. +
  4651. +/**
  4652. + * AVProfile.
  4653. + */
  4654. +typedef struct AVProfile {
  4655. + int profile;
  4656. + const char* name; ///< short name for the profile
  4657. +} AVProfile;
  4658. +
  4659. +/**
  4660. + * AVCodec.
  4661. + */
  4662. +typedef struct AVCodec {
  4663. + /**
  4664. + * Name of the codec implementation.
  4665. + * The name is globally unique among encoders and among decoders (but an
  4666. + * encoder and a decoder can share the same name).
  4667. + * This is the primary way to find a codec from the user perspective.
  4668. + */
  4669. + const char* name;
  4670. + /**
  4671. + * Descriptive name for the codec, meant to be more human readable than name.
  4672. + * You should use the NULL_IF_CONFIG_SMALL() macro to define it.
  4673. + */
  4674. + const char* long_name;
  4675. + enum AVMediaType type;
  4676. + enum AVCodecID id;
  4677. + /**
  4678. + * Codec capabilities.
  4679. + * see AV_CODEC_CAP_*
  4680. + */
  4681. + int capabilities;
  4682. + uint8_t max_lowres; ///< maximum value for lowres supported by the decoder
  4683. + const AVRational*
  4684. + supported_framerates; ///< array of supported framerates, or NULL if any,
  4685. + ///< array is terminated by {0,0}
  4686. + const enum AVPixelFormat*
  4687. + pix_fmts; ///< array of supported pixel formats, or NULL if unknown,
  4688. + ///< array is terminated by -1
  4689. + const int*
  4690. + supported_samplerates; ///< array of supported audio samplerates, or NULL
  4691. + ///< if unknown, array is terminated by 0
  4692. + const enum AVSampleFormat*
  4693. + sample_fmts; ///< array of supported sample formats, or NULL if unknown,
  4694. + ///< array is terminated by -1
  4695. +#if FF_API_OLD_CHANNEL_LAYOUT
  4696. + /**
  4697. + * @deprecated use ch_layouts instead
  4698. + */
  4699. + attribute_deprecated const uint64_t*
  4700. + channel_layouts; ///< array of support channel layouts, or NULL if
  4701. + ///< unknown. array is terminated by 0
  4702. +#endif
  4703. + const AVClass* priv_class; ///< AVClass for the private context
  4704. + const AVProfile*
  4705. + profiles; ///< array of recognized profiles, or NULL if unknown, array is
  4706. + ///< terminated by {FF_PROFILE_UNKNOWN}
  4707. +
  4708. + /**
  4709. + * Group name of the codec implementation.
  4710. + * This is a short symbolic name of the wrapper backing this codec. A
  4711. + * wrapper uses some kind of external implementation for the codec, such
  4712. + * as an external library, or a codec implementation provided by the OS or
  4713. + * the hardware.
  4714. + * If this field is NULL, this is a builtin, libavcodec native codec.
  4715. + * If non-NULL, this will be the suffix in AVCodec.name in most cases
  4716. + * (usually AVCodec.name will be of the form "<codec_name>_<wrapper_name>").
  4717. + */
  4718. + const char* wrapper_name;
  4719. +
  4720. + /**
  4721. + * Array of supported channel layouts, terminated with a zeroed layout.
  4722. + */
  4723. + const AVChannelLayout* ch_layouts;
  4724. +} AVCodec;
  4725. +
  4726. +/**
  4727. + * Iterate over all registered codecs.
  4728. + *
  4729. + * @param opaque a pointer where libavcodec will store the iteration state. Must
  4730. + * point to NULL to start the iteration.
  4731. + *
  4732. + * @return the next registered codec or NULL when the iteration is
  4733. + * finished
  4734. + */
  4735. +const AVCodec* av_codec_iterate(void** opaque);
  4736. +
  4737. +/**
  4738. + * Find a registered decoder with a matching codec ID.
  4739. + *
  4740. + * @param id AVCodecID of the requested decoder
  4741. + * @return A decoder if one was found, NULL otherwise.
  4742. + */
  4743. +const AVCodec* avcodec_find_decoder(enum AVCodecID id);
  4744. +
  4745. +/**
  4746. + * Find a registered decoder with the specified name.
  4747. + *
  4748. + * @param name name of the requested decoder
  4749. + * @return A decoder if one was found, NULL otherwise.
  4750. + */
  4751. +const AVCodec* avcodec_find_decoder_by_name(const char* name);
  4752. +
  4753. +/**
  4754. + * Find a registered encoder with a matching codec ID.
  4755. + *
  4756. + * @param id AVCodecID of the requested encoder
  4757. + * @return An encoder if one was found, NULL otherwise.
  4758. + */
  4759. +const AVCodec* avcodec_find_encoder(enum AVCodecID id);
  4760. +
  4761. +/**
  4762. + * Find a registered encoder with the specified name.
  4763. + *
  4764. + * @param name name of the requested encoder
  4765. + * @return An encoder if one was found, NULL otherwise.
  4766. + */
  4767. +const AVCodec* avcodec_find_encoder_by_name(const char* name);
  4768. +/**
  4769. + * @return a non-zero number if codec is an encoder, zero otherwise
  4770. + */
  4771. +int av_codec_is_encoder(const AVCodec* codec);
  4772. +
  4773. +/**
  4774. + * @return a non-zero number if codec is a decoder, zero otherwise
  4775. + */
  4776. +int av_codec_is_decoder(const AVCodec* codec);
  4777. +
  4778. +/**
  4779. + * Return a name for the specified profile, if available.
  4780. + *
  4781. + * @param codec the codec that is searched for the given profile
  4782. + * @param profile the profile value for which a name is requested
  4783. + * @return A name for the profile if found, NULL otherwise.
  4784. + */
  4785. +const char* av_get_profile_name(const AVCodec* codec, int profile);
  4786. +
  4787. +enum {
  4788. + /**
  4789. + * The codec supports this format via the hw_device_ctx interface.
  4790. + *
  4791. + * When selecting this format, AVCodecContext.hw_device_ctx should
  4792. + * have been set to a device of the specified type before calling
  4793. + * avcodec_open2().
  4794. + */
  4795. + AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX = 0x01,
  4796. + /**
  4797. + * The codec supports this format via the hw_frames_ctx interface.
  4798. + *
  4799. + * When selecting this format for a decoder,
  4800. + * AVCodecContext.hw_frames_ctx should be set to a suitable frames
  4801. + * context inside the get_format() callback. The frames context
  4802. + * must have been created on a device of the specified type.
  4803. + *
  4804. + * When selecting this format for an encoder,
  4805. + * AVCodecContext.hw_frames_ctx should be set to the context which
  4806. + * will be used for the input frames before calling avcodec_open2().
  4807. + */
  4808. + AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX = 0x02,
  4809. + /**
  4810. + * The codec supports this format by some internal method.
  4811. + *
  4812. + * This format can be selected without any additional configuration -
  4813. + * no device or frames context is required.
  4814. + */
  4815. + AV_CODEC_HW_CONFIG_METHOD_INTERNAL = 0x04,
  4816. + /**
  4817. + * The codec supports this format by some ad-hoc method.
  4818. + *
  4819. + * Additional settings and/or function calls are required. See the
  4820. + * codec-specific documentation for details. (Methods requiring
  4821. + * this sort of configuration are deprecated and others should be
  4822. + * used in preference.)
  4823. + */
  4824. + AV_CODEC_HW_CONFIG_METHOD_AD_HOC = 0x08,
  4825. +};
  4826. +
  4827. +typedef struct AVCodecHWConfig {
  4828. + /**
  4829. + * For decoders, a hardware pixel format which that decoder may be
  4830. + * able to decode to if suitable hardware is available.
  4831. + *
  4832. + * For encoders, a pixel format which the encoder may be able to
  4833. + * accept. If set to AV_PIX_FMT_NONE, this applies to all pixel
  4834. + * formats supported by the codec.
  4835. + */
  4836. + enum AVPixelFormat pix_fmt;
  4837. + /**
  4838. + * Bit set of AV_CODEC_HW_CONFIG_METHOD_* flags, describing the possible
  4839. + * setup methods which can be used with this configuration.
  4840. + */
  4841. + int methods;
  4842. + /**
  4843. + * The device type associated with the configuration.
  4844. + *
  4845. + * Must be set for AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX and
  4846. + * AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX, otherwise unused.
  4847. + */
  4848. + enum AVHWDeviceType device_type;
  4849. +} AVCodecHWConfig;
  4850. +
  4851. +/**
  4852. + * Retrieve supported hardware configurations for a codec.
  4853. + *
  4854. + * Values of index from zero to some maximum return the indexed configuration
  4855. + * descriptor; all other values return NULL. If the codec does not support
  4856. + * any hardware configurations then it will always return NULL.
  4857. + */
  4858. +const AVCodecHWConfig* avcodec_get_hw_config(const AVCodec* codec, int index);
  4859. +
  4860. +/**
  4861. + * @}
  4862. + */
  4863. +
  4864. +#endif /* AVCODEC_CODEC_H */
  4865. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/codec_desc.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/codec_desc.h
  4866. new file mode 100644
  4867. index 00000000..0884491d
  4868. --- /dev/null
  4869. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/codec_desc.h
  4870. @@ -0,0 +1,128 @@
  4871. +/*
  4872. + * Codec descriptors public API
  4873. + *
  4874. + * This file is part of FFmpeg.
  4875. + *
  4876. + * FFmpeg is free software; you can redistribute it and/or
  4877. + * modify it under the terms of the GNU Lesser General Public
  4878. + * License as published by the Free Software Foundation; either
  4879. + * version 2.1 of the License, or (at your option) any later version.
  4880. + *
  4881. + * FFmpeg is distributed in the hope that it will be useful,
  4882. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  4883. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  4884. + * Lesser General Public License for more details.
  4885. + *
  4886. + * You should have received a copy of the GNU Lesser General Public
  4887. + * License along with FFmpeg; if not, write to the Free Software
  4888. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  4889. + */
  4890. +
  4891. +#ifndef AVCODEC_CODEC_DESC_H
  4892. +#define AVCODEC_CODEC_DESC_H
  4893. +
  4894. +#include "libavutil/avutil.h"
  4895. +
  4896. +#include "codec_id.h"
  4897. +
  4898. +/**
  4899. + * @addtogroup lavc_core
  4900. + * @{
  4901. + */
  4902. +
  4903. +/**
  4904. + * This struct describes the properties of a single codec described by an
  4905. + * AVCodecID.
  4906. + * @see avcodec_descriptor_get()
  4907. + */
  4908. +typedef struct AVCodecDescriptor {
  4909. + enum AVCodecID id;
  4910. + enum AVMediaType type;
  4911. + /**
  4912. + * Name of the codec described by this descriptor. It is non-empty and
  4913. + * unique for each codec descriptor. It should contain alphanumeric
  4914. + * characters and '_' only.
  4915. + */
  4916. + const char* name;
  4917. + /**
  4918. + * A more descriptive name for this codec. May be NULL.
  4919. + */
  4920. + const char* long_name;
  4921. + /**
  4922. + * Codec properties, a combination of AV_CODEC_PROP_* flags.
  4923. + */
  4924. + int props;
  4925. + /**
  4926. + * MIME type(s) associated with the codec.
  4927. + * May be NULL; if not, a NULL-terminated array of MIME types.
  4928. + * The first item is always non-NULL and is the preferred MIME type.
  4929. + */
  4930. + const char* const* mime_types;
  4931. + /**
  4932. + * If non-NULL, an array of profiles recognized for this codec.
  4933. + * Terminated with FF_PROFILE_UNKNOWN.
  4934. + */
  4935. + const struct AVProfile* profiles;
  4936. +} AVCodecDescriptor;
  4937. +
  4938. +/**
  4939. + * Codec uses only intra compression.
  4940. + * Video and audio codecs only.
  4941. + */
  4942. +#define AV_CODEC_PROP_INTRA_ONLY (1 << 0)
  4943. +/**
  4944. + * Codec supports lossy compression. Audio and video codecs only.
  4945. + * @note a codec may support both lossy and lossless
  4946. + * compression modes
  4947. + */
  4948. +#define AV_CODEC_PROP_LOSSY (1 << 1)
  4949. +/**
  4950. + * Codec supports lossless compression. Audio and video codecs only.
  4951. + */
  4952. +#define AV_CODEC_PROP_LOSSLESS (1 << 2)
  4953. +/**
  4954. + * Codec supports frame reordering. That is, the coded order (the order in which
  4955. + * the encoded packets are output by the encoders / stored / input to the
  4956. + * decoders) may be different from the presentation order of the corresponding
  4957. + * frames.
  4958. + *
  4959. + * For codecs that do not have this property set, PTS and DTS should always be
  4960. + * equal.
  4961. + */
  4962. +#define AV_CODEC_PROP_REORDER (1 << 3)
  4963. +/**
  4964. + * Subtitle codec is bitmap based
  4965. + * Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field.
  4966. + */
  4967. +#define AV_CODEC_PROP_BITMAP_SUB (1 << 16)
  4968. +/**
  4969. + * Subtitle codec is text based.
  4970. + * Decoded AVSubtitle data can be read from the AVSubtitleRect->ass field.
  4971. + */
  4972. +#define AV_CODEC_PROP_TEXT_SUB (1 << 17)
  4973. +
  4974. +/**
  4975. + * @return descriptor for given codec ID or NULL if no descriptor exists.
  4976. + */
  4977. +const AVCodecDescriptor* avcodec_descriptor_get(enum AVCodecID id);
  4978. +
  4979. +/**
  4980. + * Iterate over all codec descriptors known to libavcodec.
  4981. + *
  4982. + * @param prev previous descriptor. NULL to get the first descriptor.
  4983. + *
  4984. + * @return next descriptor or NULL after the last descriptor
  4985. + */
  4986. +const AVCodecDescriptor* avcodec_descriptor_next(const AVCodecDescriptor* prev);
  4987. +
  4988. +/**
  4989. + * @return codec descriptor with the given name or NULL if no such descriptor
  4990. + * exists.
  4991. + */
  4992. +const AVCodecDescriptor* avcodec_descriptor_get_by_name(const char* name);
  4993. +
  4994. +/**
  4995. + * @}
  4996. + */
  4997. +
  4998. +#endif // AVCODEC_CODEC_DESC_H
  4999. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/codec_id.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/codec_id.h
  5000. new file mode 100644
  5001. index 00000000..b3dd07ea
  5002. --- /dev/null
  5003. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/codec_id.h
  5004. @@ -0,0 +1,669 @@
  5005. +/*
  5006. + * Codec IDs
  5007. + *
  5008. + * This file is part of FFmpeg.
  5009. + *
  5010. + * FFmpeg is free software; you can redistribute it and/or
  5011. + * modify it under the terms of the GNU Lesser General Public
  5012. + * License as published by the Free Software Foundation; either
  5013. + * version 2.1 of the License, or (at your option) any later version.
  5014. + *
  5015. + * FFmpeg is distributed in the hope that it will be useful,
  5016. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  5017. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  5018. + * Lesser General Public License for more details.
  5019. + *
  5020. + * You should have received a copy of the GNU Lesser General Public
  5021. + * License along with FFmpeg; if not, write to the Free Software
  5022. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  5023. + */
  5024. +
  5025. +#ifndef AVCODEC_CODEC_ID_H
  5026. +#define AVCODEC_CODEC_ID_H
  5027. +
  5028. +#include "libavutil/avutil.h"
  5029. +#include "libavutil/samplefmt.h"
  5030. +
  5031. +#include "version_major.h"
  5032. +
  5033. +/**
  5034. + * @addtogroup lavc_core
  5035. + * @{
  5036. + */
  5037. +
  5038. +/**
  5039. + * Identify the syntax and semantics of the bitstream.
  5040. + * The principle is roughly:
  5041. + * Two decoders with the same ID can decode the same streams.
  5042. + * Two encoders with the same ID can encode compatible streams.
  5043. + * There may be slight deviations from the principle due to implementation
  5044. + * details.
  5045. + *
  5046. + * If you add a codec ID to this list, add it so that
  5047. + * 1. no value of an existing codec ID changes (that would break ABI),
  5048. + * 2. it is as close as possible to similar codecs
  5049. + *
  5050. + * After adding new codec IDs, do not forget to add an entry to the codec
  5051. + * descriptor list and bump libavcodec minor version.
  5052. + */
  5053. +enum AVCodecID {
  5054. + AV_CODEC_ID_NONE,
  5055. +
  5056. + /* video codecs */
  5057. + AV_CODEC_ID_MPEG1VIDEO,
  5058. + AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
  5059. + AV_CODEC_ID_H261,
  5060. + AV_CODEC_ID_H263,
  5061. + AV_CODEC_ID_RV10,
  5062. + AV_CODEC_ID_RV20,
  5063. + AV_CODEC_ID_MJPEG,
  5064. + AV_CODEC_ID_MJPEGB,
  5065. + AV_CODEC_ID_LJPEG,
  5066. + AV_CODEC_ID_SP5X,
  5067. + AV_CODEC_ID_JPEGLS,
  5068. + AV_CODEC_ID_MPEG4,
  5069. + AV_CODEC_ID_RAWVIDEO,
  5070. + AV_CODEC_ID_MSMPEG4V1,
  5071. + AV_CODEC_ID_MSMPEG4V2,
  5072. + AV_CODEC_ID_MSMPEG4V3,
  5073. + AV_CODEC_ID_WMV1,
  5074. + AV_CODEC_ID_WMV2,
  5075. + AV_CODEC_ID_H263P,
  5076. + AV_CODEC_ID_H263I,
  5077. + AV_CODEC_ID_FLV1,
  5078. + AV_CODEC_ID_SVQ1,
  5079. + AV_CODEC_ID_SVQ3,
  5080. + AV_CODEC_ID_DVVIDEO,
  5081. + AV_CODEC_ID_HUFFYUV,
  5082. + AV_CODEC_ID_CYUV,
  5083. + AV_CODEC_ID_H264,
  5084. + AV_CODEC_ID_INDEO3,
  5085. + AV_CODEC_ID_VP3,
  5086. + AV_CODEC_ID_THEORA,
  5087. + AV_CODEC_ID_ASV1,
  5088. + AV_CODEC_ID_ASV2,
  5089. + AV_CODEC_ID_FFV1,
  5090. + AV_CODEC_ID_4XM,
  5091. + AV_CODEC_ID_VCR1,
  5092. + AV_CODEC_ID_CLJR,
  5093. + AV_CODEC_ID_MDEC,
  5094. + AV_CODEC_ID_ROQ,
  5095. + AV_CODEC_ID_INTERPLAY_VIDEO,
  5096. + AV_CODEC_ID_XAN_WC3,
  5097. + AV_CODEC_ID_XAN_WC4,
  5098. + AV_CODEC_ID_RPZA,
  5099. + AV_CODEC_ID_CINEPAK,
  5100. + AV_CODEC_ID_WS_VQA,
  5101. + AV_CODEC_ID_MSRLE,
  5102. + AV_CODEC_ID_MSVIDEO1,
  5103. + AV_CODEC_ID_IDCIN,
  5104. + AV_CODEC_ID_8BPS,
  5105. + AV_CODEC_ID_SMC,
  5106. + AV_CODEC_ID_FLIC,
  5107. + AV_CODEC_ID_TRUEMOTION1,
  5108. + AV_CODEC_ID_VMDVIDEO,
  5109. + AV_CODEC_ID_MSZH,
  5110. + AV_CODEC_ID_ZLIB,
  5111. + AV_CODEC_ID_QTRLE,
  5112. + AV_CODEC_ID_TSCC,
  5113. + AV_CODEC_ID_ULTI,
  5114. + AV_CODEC_ID_QDRAW,
  5115. + AV_CODEC_ID_VIXL,
  5116. + AV_CODEC_ID_QPEG,
  5117. + AV_CODEC_ID_PNG,
  5118. + AV_CODEC_ID_PPM,
  5119. + AV_CODEC_ID_PBM,
  5120. + AV_CODEC_ID_PGM,
  5121. + AV_CODEC_ID_PGMYUV,
  5122. + AV_CODEC_ID_PAM,
  5123. + AV_CODEC_ID_FFVHUFF,
  5124. + AV_CODEC_ID_RV30,
  5125. + AV_CODEC_ID_RV40,
  5126. + AV_CODEC_ID_VC1,
  5127. + AV_CODEC_ID_WMV3,
  5128. + AV_CODEC_ID_LOCO,
  5129. + AV_CODEC_ID_WNV1,
  5130. + AV_CODEC_ID_AASC,
  5131. + AV_CODEC_ID_INDEO2,
  5132. + AV_CODEC_ID_FRAPS,
  5133. + AV_CODEC_ID_TRUEMOTION2,
  5134. + AV_CODEC_ID_BMP,
  5135. + AV_CODEC_ID_CSCD,
  5136. + AV_CODEC_ID_MMVIDEO,
  5137. + AV_CODEC_ID_ZMBV,
  5138. + AV_CODEC_ID_AVS,
  5139. + AV_CODEC_ID_SMACKVIDEO,
  5140. + AV_CODEC_ID_NUV,
  5141. + AV_CODEC_ID_KMVC,
  5142. + AV_CODEC_ID_FLASHSV,
  5143. + AV_CODEC_ID_CAVS,
  5144. + AV_CODEC_ID_JPEG2000,
  5145. + AV_CODEC_ID_VMNC,
  5146. + AV_CODEC_ID_VP5,
  5147. + AV_CODEC_ID_VP6,
  5148. + AV_CODEC_ID_VP6F,
  5149. + AV_CODEC_ID_TARGA,
  5150. + AV_CODEC_ID_DSICINVIDEO,
  5151. + AV_CODEC_ID_TIERTEXSEQVIDEO,
  5152. + AV_CODEC_ID_TIFF,
  5153. + AV_CODEC_ID_GIF,
  5154. + AV_CODEC_ID_DXA,
  5155. + AV_CODEC_ID_DNXHD,
  5156. + AV_CODEC_ID_THP,
  5157. + AV_CODEC_ID_SGI,
  5158. + AV_CODEC_ID_C93,
  5159. + AV_CODEC_ID_BETHSOFTVID,
  5160. + AV_CODEC_ID_PTX,
  5161. + AV_CODEC_ID_TXD,
  5162. + AV_CODEC_ID_VP6A,
  5163. + AV_CODEC_ID_AMV,
  5164. + AV_CODEC_ID_VB,
  5165. + AV_CODEC_ID_PCX,
  5166. + AV_CODEC_ID_SUNRAST,
  5167. + AV_CODEC_ID_INDEO4,
  5168. + AV_CODEC_ID_INDEO5,
  5169. + AV_CODEC_ID_MIMIC,
  5170. + AV_CODEC_ID_RL2,
  5171. + AV_CODEC_ID_ESCAPE124,
  5172. + AV_CODEC_ID_DIRAC,
  5173. + AV_CODEC_ID_BFI,
  5174. + AV_CODEC_ID_CMV,
  5175. + AV_CODEC_ID_MOTIONPIXELS,
  5176. + AV_CODEC_ID_TGV,
  5177. + AV_CODEC_ID_TGQ,
  5178. + AV_CODEC_ID_TQI,
  5179. + AV_CODEC_ID_AURA,
  5180. + AV_CODEC_ID_AURA2,
  5181. + AV_CODEC_ID_V210X,
  5182. + AV_CODEC_ID_TMV,
  5183. + AV_CODEC_ID_V210,
  5184. + AV_CODEC_ID_DPX,
  5185. + AV_CODEC_ID_MAD,
  5186. + AV_CODEC_ID_FRWU,
  5187. + AV_CODEC_ID_FLASHSV2,
  5188. + AV_CODEC_ID_CDGRAPHICS,
  5189. + AV_CODEC_ID_R210,
  5190. + AV_CODEC_ID_ANM,
  5191. + AV_CODEC_ID_BINKVIDEO,
  5192. + AV_CODEC_ID_IFF_ILBM,
  5193. +#define AV_CODEC_ID_IFF_BYTERUN1 AV_CODEC_ID_IFF_ILBM
  5194. + AV_CODEC_ID_KGV1,
  5195. + AV_CODEC_ID_YOP,
  5196. + AV_CODEC_ID_VP8,
  5197. + AV_CODEC_ID_PICTOR,
  5198. + AV_CODEC_ID_ANSI,
  5199. + AV_CODEC_ID_A64_MULTI,
  5200. + AV_CODEC_ID_A64_MULTI5,
  5201. + AV_CODEC_ID_R10K,
  5202. + AV_CODEC_ID_MXPEG,
  5203. + AV_CODEC_ID_LAGARITH,
  5204. + AV_CODEC_ID_PRORES,
  5205. + AV_CODEC_ID_JV,
  5206. + AV_CODEC_ID_DFA,
  5207. + AV_CODEC_ID_WMV3IMAGE,
  5208. + AV_CODEC_ID_VC1IMAGE,
  5209. + AV_CODEC_ID_UTVIDEO,
  5210. + AV_CODEC_ID_BMV_VIDEO,
  5211. + AV_CODEC_ID_VBLE,
  5212. + AV_CODEC_ID_DXTORY,
  5213. + AV_CODEC_ID_V410,
  5214. + AV_CODEC_ID_XWD,
  5215. + AV_CODEC_ID_CDXL,
  5216. + AV_CODEC_ID_XBM,
  5217. + AV_CODEC_ID_ZEROCODEC,
  5218. + AV_CODEC_ID_MSS1,
  5219. + AV_CODEC_ID_MSA1,
  5220. + AV_CODEC_ID_TSCC2,
  5221. + AV_CODEC_ID_MTS2,
  5222. + AV_CODEC_ID_CLLC,
  5223. + AV_CODEC_ID_MSS2,
  5224. + AV_CODEC_ID_VP9,
  5225. + AV_CODEC_ID_AIC,
  5226. + AV_CODEC_ID_ESCAPE130,
  5227. + AV_CODEC_ID_G2M,
  5228. + AV_CODEC_ID_WEBP,
  5229. + AV_CODEC_ID_HNM4_VIDEO,
  5230. + AV_CODEC_ID_HEVC,
  5231. +#define AV_CODEC_ID_H265 AV_CODEC_ID_HEVC
  5232. + AV_CODEC_ID_FIC,
  5233. + AV_CODEC_ID_ALIAS_PIX,
  5234. + AV_CODEC_ID_BRENDER_PIX,
  5235. + AV_CODEC_ID_PAF_VIDEO,
  5236. + AV_CODEC_ID_EXR,
  5237. + AV_CODEC_ID_VP7,
  5238. + AV_CODEC_ID_SANM,
  5239. + AV_CODEC_ID_SGIRLE,
  5240. + AV_CODEC_ID_MVC1,
  5241. + AV_CODEC_ID_MVC2,
  5242. + AV_CODEC_ID_HQX,
  5243. + AV_CODEC_ID_TDSC,
  5244. + AV_CODEC_ID_HQ_HQA,
  5245. + AV_CODEC_ID_HAP,
  5246. + AV_CODEC_ID_DDS,
  5247. + AV_CODEC_ID_DXV,
  5248. + AV_CODEC_ID_SCREENPRESSO,
  5249. + AV_CODEC_ID_RSCC,
  5250. + AV_CODEC_ID_AVS2,
  5251. + AV_CODEC_ID_PGX,
  5252. + AV_CODEC_ID_AVS3,
  5253. + AV_CODEC_ID_MSP2,
  5254. + AV_CODEC_ID_VVC,
  5255. +#define AV_CODEC_ID_H266 AV_CODEC_ID_VVC
  5256. + AV_CODEC_ID_Y41P,
  5257. + AV_CODEC_ID_AVRP,
  5258. + AV_CODEC_ID_012V,
  5259. + AV_CODEC_ID_AVUI,
  5260. +#if FF_API_AYUV_CODECID
  5261. + AV_CODEC_ID_AYUV,
  5262. +#endif
  5263. + AV_CODEC_ID_TARGA_Y216,
  5264. + AV_CODEC_ID_V308,
  5265. + AV_CODEC_ID_V408,
  5266. + AV_CODEC_ID_YUV4,
  5267. + AV_CODEC_ID_AVRN,
  5268. + AV_CODEC_ID_CPIA,
  5269. + AV_CODEC_ID_XFACE,
  5270. + AV_CODEC_ID_SNOW,
  5271. + AV_CODEC_ID_SMVJPEG,
  5272. + AV_CODEC_ID_APNG,
  5273. + AV_CODEC_ID_DAALA,
  5274. + AV_CODEC_ID_CFHD,
  5275. + AV_CODEC_ID_TRUEMOTION2RT,
  5276. + AV_CODEC_ID_M101,
  5277. + AV_CODEC_ID_MAGICYUV,
  5278. + AV_CODEC_ID_SHEERVIDEO,
  5279. + AV_CODEC_ID_YLC,
  5280. + AV_CODEC_ID_PSD,
  5281. + AV_CODEC_ID_PIXLET,
  5282. + AV_CODEC_ID_SPEEDHQ,
  5283. + AV_CODEC_ID_FMVC,
  5284. + AV_CODEC_ID_SCPR,
  5285. + AV_CODEC_ID_CLEARVIDEO,
  5286. + AV_CODEC_ID_XPM,
  5287. + AV_CODEC_ID_AV1,
  5288. + AV_CODEC_ID_BITPACKED,
  5289. + AV_CODEC_ID_MSCC,
  5290. + AV_CODEC_ID_SRGC,
  5291. + AV_CODEC_ID_SVG,
  5292. + AV_CODEC_ID_GDV,
  5293. + AV_CODEC_ID_FITS,
  5294. + AV_CODEC_ID_IMM4,
  5295. + AV_CODEC_ID_PROSUMER,
  5296. + AV_CODEC_ID_MWSC,
  5297. + AV_CODEC_ID_WCMV,
  5298. + AV_CODEC_ID_RASC,
  5299. + AV_CODEC_ID_HYMT,
  5300. + AV_CODEC_ID_ARBC,
  5301. + AV_CODEC_ID_AGM,
  5302. + AV_CODEC_ID_LSCR,
  5303. + AV_CODEC_ID_VP4,
  5304. + AV_CODEC_ID_IMM5,
  5305. + AV_CODEC_ID_MVDV,
  5306. + AV_CODEC_ID_MVHA,
  5307. + AV_CODEC_ID_CDTOONS,
  5308. + AV_CODEC_ID_MV30,
  5309. + AV_CODEC_ID_NOTCHLC,
  5310. + AV_CODEC_ID_PFM,
  5311. + AV_CODEC_ID_MOBICLIP,
  5312. + AV_CODEC_ID_PHOTOCD,
  5313. + AV_CODEC_ID_IPU,
  5314. + AV_CODEC_ID_ARGO,
  5315. + AV_CODEC_ID_CRI,
  5316. + AV_CODEC_ID_SIMBIOSIS_IMX,
  5317. + AV_CODEC_ID_SGA_VIDEO,
  5318. + AV_CODEC_ID_GEM,
  5319. + AV_CODEC_ID_VBN,
  5320. + AV_CODEC_ID_JPEGXL,
  5321. + AV_CODEC_ID_QOI,
  5322. + AV_CODEC_ID_PHM,
  5323. + AV_CODEC_ID_RADIANCE_HDR,
  5324. + AV_CODEC_ID_WBMP,
  5325. + AV_CODEC_ID_MEDIA100,
  5326. + AV_CODEC_ID_VQC,
  5327. +
  5328. + /* various PCM "codecs" */
  5329. + AV_CODEC_ID_FIRST_AUDIO =
  5330. + 0x10000, ///< A dummy id pointing at the start of audio codecs
  5331. + AV_CODEC_ID_PCM_S16LE = 0x10000,
  5332. + AV_CODEC_ID_PCM_S16BE,
  5333. + AV_CODEC_ID_PCM_U16LE,
  5334. + AV_CODEC_ID_PCM_U16BE,
  5335. + AV_CODEC_ID_PCM_S8,
  5336. + AV_CODEC_ID_PCM_U8,
  5337. + AV_CODEC_ID_PCM_MULAW,
  5338. + AV_CODEC_ID_PCM_ALAW,
  5339. + AV_CODEC_ID_PCM_S32LE,
  5340. + AV_CODEC_ID_PCM_S32BE,
  5341. + AV_CODEC_ID_PCM_U32LE,
  5342. + AV_CODEC_ID_PCM_U32BE,
  5343. + AV_CODEC_ID_PCM_S24LE,
  5344. + AV_CODEC_ID_PCM_S24BE,
  5345. + AV_CODEC_ID_PCM_U24LE,
  5346. + AV_CODEC_ID_PCM_U24BE,
  5347. + AV_CODEC_ID_PCM_S24DAUD,
  5348. + AV_CODEC_ID_PCM_ZORK,
  5349. + AV_CODEC_ID_PCM_S16LE_PLANAR,
  5350. + AV_CODEC_ID_PCM_DVD,
  5351. + AV_CODEC_ID_PCM_F32BE,
  5352. + AV_CODEC_ID_PCM_F32LE,
  5353. + AV_CODEC_ID_PCM_F64BE,
  5354. + AV_CODEC_ID_PCM_F64LE,
  5355. + AV_CODEC_ID_PCM_BLURAY,
  5356. + AV_CODEC_ID_PCM_LXF,
  5357. + AV_CODEC_ID_S302M,
  5358. + AV_CODEC_ID_PCM_S8_PLANAR,
  5359. + AV_CODEC_ID_PCM_S24LE_PLANAR,
  5360. + AV_CODEC_ID_PCM_S32LE_PLANAR,
  5361. + AV_CODEC_ID_PCM_S16BE_PLANAR,
  5362. + AV_CODEC_ID_PCM_S64LE,
  5363. + AV_CODEC_ID_PCM_S64BE,
  5364. + AV_CODEC_ID_PCM_F16LE,
  5365. + AV_CODEC_ID_PCM_F24LE,
  5366. + AV_CODEC_ID_PCM_VIDC,
  5367. + AV_CODEC_ID_PCM_SGA,
  5368. +
  5369. + /* various ADPCM codecs */
  5370. + AV_CODEC_ID_ADPCM_IMA_QT = 0x11000,
  5371. + AV_CODEC_ID_ADPCM_IMA_WAV,
  5372. + AV_CODEC_ID_ADPCM_IMA_DK3,
  5373. + AV_CODEC_ID_ADPCM_IMA_DK4,
  5374. + AV_CODEC_ID_ADPCM_IMA_WS,
  5375. + AV_CODEC_ID_ADPCM_IMA_SMJPEG,
  5376. + AV_CODEC_ID_ADPCM_MS,
  5377. + AV_CODEC_ID_ADPCM_4XM,
  5378. + AV_CODEC_ID_ADPCM_XA,
  5379. + AV_CODEC_ID_ADPCM_ADX,
  5380. + AV_CODEC_ID_ADPCM_EA,
  5381. + AV_CODEC_ID_ADPCM_G726,
  5382. + AV_CODEC_ID_ADPCM_CT,
  5383. + AV_CODEC_ID_ADPCM_SWF,
  5384. + AV_CODEC_ID_ADPCM_YAMAHA,
  5385. + AV_CODEC_ID_ADPCM_SBPRO_4,
  5386. + AV_CODEC_ID_ADPCM_SBPRO_3,
  5387. + AV_CODEC_ID_ADPCM_SBPRO_2,
  5388. + AV_CODEC_ID_ADPCM_THP,
  5389. + AV_CODEC_ID_ADPCM_IMA_AMV,
  5390. + AV_CODEC_ID_ADPCM_EA_R1,
  5391. + AV_CODEC_ID_ADPCM_EA_R3,
  5392. + AV_CODEC_ID_ADPCM_EA_R2,
  5393. + AV_CODEC_ID_ADPCM_IMA_EA_SEAD,
  5394. + AV_CODEC_ID_ADPCM_IMA_EA_EACS,
  5395. + AV_CODEC_ID_ADPCM_EA_XAS,
  5396. + AV_CODEC_ID_ADPCM_EA_MAXIS_XA,
  5397. + AV_CODEC_ID_ADPCM_IMA_ISS,
  5398. + AV_CODEC_ID_ADPCM_G722,
  5399. + AV_CODEC_ID_ADPCM_IMA_APC,
  5400. + AV_CODEC_ID_ADPCM_VIMA,
  5401. + AV_CODEC_ID_ADPCM_AFC,
  5402. + AV_CODEC_ID_ADPCM_IMA_OKI,
  5403. + AV_CODEC_ID_ADPCM_DTK,
  5404. + AV_CODEC_ID_ADPCM_IMA_RAD,
  5405. + AV_CODEC_ID_ADPCM_G726LE,
  5406. + AV_CODEC_ID_ADPCM_THP_LE,
  5407. + AV_CODEC_ID_ADPCM_PSX,
  5408. + AV_CODEC_ID_ADPCM_AICA,
  5409. + AV_CODEC_ID_ADPCM_IMA_DAT4,
  5410. + AV_CODEC_ID_ADPCM_MTAF,
  5411. + AV_CODEC_ID_ADPCM_AGM,
  5412. + AV_CODEC_ID_ADPCM_ARGO,
  5413. + AV_CODEC_ID_ADPCM_IMA_SSI,
  5414. + AV_CODEC_ID_ADPCM_ZORK,
  5415. + AV_CODEC_ID_ADPCM_IMA_APM,
  5416. + AV_CODEC_ID_ADPCM_IMA_ALP,
  5417. + AV_CODEC_ID_ADPCM_IMA_MTF,
  5418. + AV_CODEC_ID_ADPCM_IMA_CUNNING,
  5419. + AV_CODEC_ID_ADPCM_IMA_MOFLEX,
  5420. + AV_CODEC_ID_ADPCM_IMA_ACORN,
  5421. + AV_CODEC_ID_ADPCM_XMD,
  5422. +
  5423. + /* AMR */
  5424. + AV_CODEC_ID_AMR_NB = 0x12000,
  5425. + AV_CODEC_ID_AMR_WB,
  5426. +
  5427. + /* RealAudio codecs*/
  5428. + AV_CODEC_ID_RA_144 = 0x13000,
  5429. + AV_CODEC_ID_RA_288,
  5430. +
  5431. + /* various DPCM codecs */
  5432. + AV_CODEC_ID_ROQ_DPCM = 0x14000,
  5433. + AV_CODEC_ID_INTERPLAY_DPCM,
  5434. + AV_CODEC_ID_XAN_DPCM,
  5435. + AV_CODEC_ID_SOL_DPCM,
  5436. + AV_CODEC_ID_SDX2_DPCM,
  5437. + AV_CODEC_ID_GREMLIN_DPCM,
  5438. + AV_CODEC_ID_DERF_DPCM,
  5439. + AV_CODEC_ID_WADY_DPCM,
  5440. + AV_CODEC_ID_CBD2_DPCM,
  5441. +
  5442. + /* audio codecs */
  5443. + AV_CODEC_ID_MP2 = 0x15000,
  5444. + AV_CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
  5445. + AV_CODEC_ID_AAC,
  5446. + AV_CODEC_ID_AC3,
  5447. + AV_CODEC_ID_DTS,
  5448. + AV_CODEC_ID_VORBIS,
  5449. + AV_CODEC_ID_DVAUDIO,
  5450. + AV_CODEC_ID_WMAV1,
  5451. + AV_CODEC_ID_WMAV2,
  5452. + AV_CODEC_ID_MACE3,
  5453. + AV_CODEC_ID_MACE6,
  5454. + AV_CODEC_ID_VMDAUDIO,
  5455. + AV_CODEC_ID_FLAC,
  5456. + AV_CODEC_ID_MP3ADU,
  5457. + AV_CODEC_ID_MP3ON4,
  5458. + AV_CODEC_ID_SHORTEN,
  5459. + AV_CODEC_ID_ALAC,
  5460. + AV_CODEC_ID_WESTWOOD_SND1,
  5461. + AV_CODEC_ID_GSM, ///< as in Berlin toast format
  5462. + AV_CODEC_ID_QDM2,
  5463. + AV_CODEC_ID_COOK,
  5464. + AV_CODEC_ID_TRUESPEECH,
  5465. + AV_CODEC_ID_TTA,
  5466. + AV_CODEC_ID_SMACKAUDIO,
  5467. + AV_CODEC_ID_QCELP,
  5468. + AV_CODEC_ID_WAVPACK,
  5469. + AV_CODEC_ID_DSICINAUDIO,
  5470. + AV_CODEC_ID_IMC,
  5471. + AV_CODEC_ID_MUSEPACK7,
  5472. + AV_CODEC_ID_MLP,
  5473. + AV_CODEC_ID_GSM_MS, /* as found in WAV */
  5474. + AV_CODEC_ID_ATRAC3,
  5475. + AV_CODEC_ID_APE,
  5476. + AV_CODEC_ID_NELLYMOSER,
  5477. + AV_CODEC_ID_MUSEPACK8,
  5478. + AV_CODEC_ID_SPEEX,
  5479. + AV_CODEC_ID_WMAVOICE,
  5480. + AV_CODEC_ID_WMAPRO,
  5481. + AV_CODEC_ID_WMALOSSLESS,
  5482. + AV_CODEC_ID_ATRAC3P,
  5483. + AV_CODEC_ID_EAC3,
  5484. + AV_CODEC_ID_SIPR,
  5485. + AV_CODEC_ID_MP1,
  5486. + AV_CODEC_ID_TWINVQ,
  5487. + AV_CODEC_ID_TRUEHD,
  5488. + AV_CODEC_ID_MP4ALS,
  5489. + AV_CODEC_ID_ATRAC1,
  5490. + AV_CODEC_ID_BINKAUDIO_RDFT,
  5491. + AV_CODEC_ID_BINKAUDIO_DCT,
  5492. + AV_CODEC_ID_AAC_LATM,
  5493. + AV_CODEC_ID_QDMC,
  5494. + AV_CODEC_ID_CELT,
  5495. + AV_CODEC_ID_G723_1,
  5496. + AV_CODEC_ID_G729,
  5497. + AV_CODEC_ID_8SVX_EXP,
  5498. + AV_CODEC_ID_8SVX_FIB,
  5499. + AV_CODEC_ID_BMV_AUDIO,
  5500. + AV_CODEC_ID_RALF,
  5501. + AV_CODEC_ID_IAC,
  5502. + AV_CODEC_ID_ILBC,
  5503. + AV_CODEC_ID_OPUS,
  5504. + AV_CODEC_ID_COMFORT_NOISE,
  5505. + AV_CODEC_ID_TAK,
  5506. + AV_CODEC_ID_METASOUND,
  5507. + AV_CODEC_ID_PAF_AUDIO,
  5508. + AV_CODEC_ID_ON2AVC,
  5509. + AV_CODEC_ID_DSS_SP,
  5510. + AV_CODEC_ID_CODEC2,
  5511. + AV_CODEC_ID_FFWAVESYNTH,
  5512. + AV_CODEC_ID_SONIC,
  5513. + AV_CODEC_ID_SONIC_LS,
  5514. + AV_CODEC_ID_EVRC,
  5515. + AV_CODEC_ID_SMV,
  5516. + AV_CODEC_ID_DSD_LSBF,
  5517. + AV_CODEC_ID_DSD_MSBF,
  5518. + AV_CODEC_ID_DSD_LSBF_PLANAR,
  5519. + AV_CODEC_ID_DSD_MSBF_PLANAR,
  5520. + AV_CODEC_ID_4GV,
  5521. + AV_CODEC_ID_INTERPLAY_ACM,
  5522. + AV_CODEC_ID_XMA1,
  5523. + AV_CODEC_ID_XMA2,
  5524. + AV_CODEC_ID_DST,
  5525. + AV_CODEC_ID_ATRAC3AL,
  5526. + AV_CODEC_ID_ATRAC3PAL,
  5527. + AV_CODEC_ID_DOLBY_E,
  5528. + AV_CODEC_ID_APTX,
  5529. + AV_CODEC_ID_APTX_HD,
  5530. + AV_CODEC_ID_SBC,
  5531. + AV_CODEC_ID_ATRAC9,
  5532. + AV_CODEC_ID_HCOM,
  5533. + AV_CODEC_ID_ACELP_KELVIN,
  5534. + AV_CODEC_ID_MPEGH_3D_AUDIO,
  5535. + AV_CODEC_ID_SIREN,
  5536. + AV_CODEC_ID_HCA,
  5537. + AV_CODEC_ID_FASTAUDIO,
  5538. + AV_CODEC_ID_MSNSIREN,
  5539. + AV_CODEC_ID_DFPWM,
  5540. + AV_CODEC_ID_BONK,
  5541. + AV_CODEC_ID_MISC4,
  5542. + AV_CODEC_ID_APAC,
  5543. + AV_CODEC_ID_FTR,
  5544. + AV_CODEC_ID_WAVARC,
  5545. + AV_CODEC_ID_RKA,
  5546. +
  5547. + /* subtitle codecs */
  5548. + AV_CODEC_ID_FIRST_SUBTITLE =
  5549. + 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
  5550. + AV_CODEC_ID_DVD_SUBTITLE = 0x17000,
  5551. + AV_CODEC_ID_DVB_SUBTITLE,
  5552. + AV_CODEC_ID_TEXT, ///< raw UTF-8 text
  5553. + AV_CODEC_ID_XSUB,
  5554. + AV_CODEC_ID_SSA,
  5555. + AV_CODEC_ID_MOV_TEXT,
  5556. + AV_CODEC_ID_HDMV_PGS_SUBTITLE,
  5557. + AV_CODEC_ID_DVB_TELETEXT,
  5558. + AV_CODEC_ID_SRT,
  5559. + AV_CODEC_ID_MICRODVD,
  5560. + AV_CODEC_ID_EIA_608,
  5561. + AV_CODEC_ID_JACOSUB,
  5562. + AV_CODEC_ID_SAMI,
  5563. + AV_CODEC_ID_REALTEXT,
  5564. + AV_CODEC_ID_STL,
  5565. + AV_CODEC_ID_SUBVIEWER1,
  5566. + AV_CODEC_ID_SUBVIEWER,
  5567. + AV_CODEC_ID_SUBRIP,
  5568. + AV_CODEC_ID_WEBVTT,
  5569. + AV_CODEC_ID_MPL2,
  5570. + AV_CODEC_ID_VPLAYER,
  5571. + AV_CODEC_ID_PJS,
  5572. + AV_CODEC_ID_ASS,
  5573. + AV_CODEC_ID_HDMV_TEXT_SUBTITLE,
  5574. + AV_CODEC_ID_TTML,
  5575. + AV_CODEC_ID_ARIB_CAPTION,
  5576. +
  5577. + /* other specific kind of codecs (generally used for attachments) */
  5578. + AV_CODEC_ID_FIRST_UNKNOWN =
  5579. + 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
  5580. + AV_CODEC_ID_TTF = 0x18000,
  5581. +
  5582. + AV_CODEC_ID_SCTE_35, ///< Contain timestamp estimated through PCR of program
  5583. + ///< stream.
  5584. + AV_CODEC_ID_EPG,
  5585. + AV_CODEC_ID_BINTEXT,
  5586. + AV_CODEC_ID_XBIN,
  5587. + AV_CODEC_ID_IDF,
  5588. + AV_CODEC_ID_OTF,
  5589. + AV_CODEC_ID_SMPTE_KLV,
  5590. + AV_CODEC_ID_DVD_NAV,
  5591. + AV_CODEC_ID_TIMED_ID3,
  5592. + AV_CODEC_ID_BIN_DATA,
  5593. +
  5594. + AV_CODEC_ID_PROBE =
  5595. + 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf
  5596. + ///< should attempt to identify it
  5597. +
  5598. + AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
  5599. + * stream (only used by libavformat) */
  5600. + AV_CODEC_ID_MPEG4SYSTEMS =
  5601. + 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems
  5602. + * stream (only used by libavformat) */
  5603. + AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing
  5604. + ///< only metadata information.
  5605. + AV_CODEC_ID_WRAPPED_AVFRAME =
  5606. + 0x21001, ///< Passthrough codec, AVFrames wrapped in AVPacket
  5607. + /**
  5608. + * Dummy null video codec, useful mainly for development and debugging.
  5609. + * Null encoder/decoder discard all input and never return any output.
  5610. + */
  5611. + AV_CODEC_ID_VNULL,
  5612. + /**
  5613. + * Dummy null audio codec, useful mainly for development and debugging.
  5614. + * Null encoder/decoder discard all input and never return any output.
  5615. + */
  5616. + AV_CODEC_ID_ANULL,
  5617. +};
  5618. +
  5619. +/**
  5620. + * Get the type of the given codec.
  5621. + */
  5622. +enum AVMediaType avcodec_get_type(enum AVCodecID codec_id);
  5623. +
  5624. +/**
  5625. + * Get the name of a codec.
  5626. + * @return a static string identifying the codec; never NULL
  5627. + */
  5628. +const char* avcodec_get_name(enum AVCodecID id);
  5629. +
  5630. +/**
  5631. + * Return codec bits per sample.
  5632. + *
  5633. + * @param[in] codec_id the codec
  5634. + * @return Number of bits per sample or zero if unknown for the given codec.
  5635. + */
  5636. +int av_get_bits_per_sample(enum AVCodecID codec_id);
  5637. +
  5638. +/**
  5639. + * Return codec bits per sample.
  5640. + * Only return non-zero if the bits per sample is exactly correct, not an
  5641. + * approximation.
  5642. + *
  5643. + * @param[in] codec_id the codec
  5644. + * @return Number of bits per sample or zero if unknown for the given codec.
  5645. + */
  5646. +int av_get_exact_bits_per_sample(enum AVCodecID codec_id);
  5647. +
  5648. +/**
  5649. + * Return a name for the specified profile, if available.
  5650. + *
  5651. + * @param codec_id the ID of the codec to which the requested profile belongs
  5652. + * @param profile the profile value for which a name is requested
  5653. + * @return A name for the profile if found, NULL otherwise.
  5654. + *
  5655. + * @note unlike av_get_profile_name(), which searches a list of profiles
  5656. + * supported by a specific decoder or encoder implementation, this
  5657. + * function searches the list of profiles from the AVCodecDescriptor
  5658. + */
  5659. +const char* avcodec_profile_name(enum AVCodecID codec_id, int profile);
  5660. +
  5661. +/**
  5662. + * Return the PCM codec associated with a sample format.
  5663. + * @param be endianness, 0 for little, 1 for big,
  5664. + * -1 (or anything else) for native
  5665. + * @return AV_CODEC_ID_PCM_* or AV_CODEC_ID_NONE
  5666. + */
  5667. +enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be);
  5668. +
  5669. +/**
  5670. + * @}
  5671. + */
  5672. +
  5673. +#endif // AVCODEC_CODEC_ID_H
  5674. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/codec_par.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/codec_par.h
  5675. new file mode 100644
  5676. index 00000000..dd9e40d0
  5677. --- /dev/null
  5678. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/codec_par.h
  5679. @@ -0,0 +1,247 @@
  5680. +/*
  5681. + * Codec parameters public API
  5682. + *
  5683. + * This file is part of FFmpeg.
  5684. + *
  5685. + * FFmpeg is free software; you can redistribute it and/or
  5686. + * modify it under the terms of the GNU Lesser General Public
  5687. + * License as published by the Free Software Foundation; either
  5688. + * version 2.1 of the License, or (at your option) any later version.
  5689. + *
  5690. + * FFmpeg is distributed in the hope that it will be useful,
  5691. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  5692. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  5693. + * Lesser General Public License for more details.
  5694. + *
  5695. + * You should have received a copy of the GNU Lesser General Public
  5696. + * License along with FFmpeg; if not, write to the Free Software
  5697. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  5698. + */
  5699. +
  5700. +#ifndef AVCODEC_CODEC_PAR_H
  5701. +#define AVCODEC_CODEC_PAR_H
  5702. +
  5703. +#include <stdint.h>
  5704. +
  5705. +#include "libavutil/avutil.h"
  5706. +#include "libavutil/channel_layout.h"
  5707. +#include "libavutil/rational.h"
  5708. +#include "libavutil/pixfmt.h"
  5709. +
  5710. +#include "codec_id.h"
  5711. +
  5712. +/**
  5713. + * @addtogroup lavc_core
  5714. + * @{
  5715. + */
  5716. +
  5717. +enum AVFieldOrder {
  5718. + AV_FIELD_UNKNOWN,
  5719. + AV_FIELD_PROGRESSIVE,
  5720. + AV_FIELD_TT, ///< Top coded_first, top displayed first
  5721. + AV_FIELD_BB, ///< Bottom coded first, bottom displayed first
  5722. + AV_FIELD_TB, ///< Top coded first, bottom displayed first
  5723. + AV_FIELD_BT, ///< Bottom coded first, top displayed first
  5724. +};
  5725. +
  5726. +/**
  5727. + * This struct describes the properties of an encoded stream.
  5728. + *
  5729. + * sizeof(AVCodecParameters) is not a part of the public ABI, this struct must
  5730. + * be allocated with avcodec_parameters_alloc() and freed with
  5731. + * avcodec_parameters_free().
  5732. + */
  5733. +typedef struct AVCodecParameters {
  5734. + /**
  5735. + * General type of the encoded data.
  5736. + */
  5737. + enum AVMediaType codec_type;
  5738. + /**
  5739. + * Specific type of the encoded data (the codec used).
  5740. + */
  5741. + enum AVCodecID codec_id;
  5742. + /**
  5743. + * Additional information about the codec (corresponds to the AVI FOURCC).
  5744. + */
  5745. + uint32_t codec_tag;
  5746. +
  5747. + /**
  5748. + * Extra binary data needed for initializing the decoder, codec-dependent.
  5749. + *
  5750. + * Must be allocated with av_malloc() and will be freed by
  5751. + * avcodec_parameters_free(). The allocated size of extradata must be at
  5752. + * least extradata_size + AV_INPUT_BUFFER_PADDING_SIZE, with the padding
  5753. + * bytes zeroed.
  5754. + */
  5755. + uint8_t* extradata;
  5756. + /**
  5757. + * Size of the extradata content in bytes.
  5758. + */
  5759. + int extradata_size;
  5760. +
  5761. + /**
  5762. + * - video: the pixel format, the value corresponds to enum AVPixelFormat.
  5763. + * - audio: the sample format, the value corresponds to enum AVSampleFormat.
  5764. + */
  5765. + int format;
  5766. +
  5767. + /**
  5768. + * The average bitrate of the encoded data (in bits per second).
  5769. + */
  5770. + int64_t bit_rate;
  5771. +
  5772. + /**
  5773. + * The number of bits per sample in the codedwords.
  5774. + *
  5775. + * This is basically the bitrate per sample. It is mandatory for a bunch of
  5776. + * formats to actually decode them. It's the number of bits for one sample in
  5777. + * the actual coded bitstream.
  5778. + *
  5779. + * This could be for example 4 for ADPCM
  5780. + * For PCM formats this matches bits_per_raw_sample
  5781. + * Can be 0
  5782. + */
  5783. + int bits_per_coded_sample;
  5784. +
  5785. + /**
  5786. + * This is the number of valid bits in each output sample. If the
  5787. + * sample format has more bits, the least significant bits are additional
  5788. + * padding bits, which are always 0. Use right shifts to reduce the sample
  5789. + * to its actual size. For example, audio formats with 24 bit samples will
  5790. + * have bits_per_raw_sample set to 24, and format set to AV_SAMPLE_FMT_S32.
  5791. + * To get the original sample use "(int32_t)sample >> 8"."
  5792. + *
  5793. + * For ADPCM this might be 12 or 16 or similar
  5794. + * Can be 0
  5795. + */
  5796. + int bits_per_raw_sample;
  5797. +
  5798. + /**
  5799. + * Codec-specific bitstream restrictions that the stream conforms to.
  5800. + */
  5801. + int profile;
  5802. + int level;
  5803. +
  5804. + /**
  5805. + * Video only. The dimensions of the video frame in pixels.
  5806. + */
  5807. + int width;
  5808. + int height;
  5809. +
  5810. + /**
  5811. + * Video only. The aspect ratio (width / height) which a single pixel
  5812. + * should have when displayed.
  5813. + *
  5814. + * When the aspect ratio is unknown / undefined, the numerator should be
  5815. + * set to 0 (the denominator may have any value).
  5816. + */
  5817. + AVRational sample_aspect_ratio;
  5818. +
  5819. + /**
  5820. + * Video only. The order of the fields in interlaced video.
  5821. + */
  5822. + enum AVFieldOrder field_order;
  5823. +
  5824. + /**
  5825. + * Video only. Additional colorspace characteristics.
  5826. + */
  5827. + enum AVColorRange color_range;
  5828. + enum AVColorPrimaries color_primaries;
  5829. + enum AVColorTransferCharacteristic color_trc;
  5830. + enum AVColorSpace color_space;
  5831. + enum AVChromaLocation chroma_location;
  5832. +
  5833. + /**
  5834. + * Video only. Number of delayed frames.
  5835. + */
  5836. + int video_delay;
  5837. +
  5838. +#if FF_API_OLD_CHANNEL_LAYOUT
  5839. + /**
  5840. + * Audio only. The channel layout bitmask. May be 0 if the channel layout is
  5841. + * unknown or unspecified, otherwise the number of bits set must be equal to
  5842. + * the channels field.
  5843. + * @deprecated use ch_layout
  5844. + */
  5845. + attribute_deprecated uint64_t channel_layout;
  5846. + /**
  5847. + * Audio only. The number of audio channels.
  5848. + * @deprecated use ch_layout.nb_channels
  5849. + */
  5850. + attribute_deprecated int channels;
  5851. +#endif
  5852. + /**
  5853. + * Audio only. The number of audio samples per second.
  5854. + */
  5855. + int sample_rate;
  5856. + /**
  5857. + * Audio only. The number of bytes per coded audio frame, required by some
  5858. + * formats.
  5859. + *
  5860. + * Corresponds to nBlockAlign in WAVEFORMATEX.
  5861. + */
  5862. + int block_align;
  5863. + /**
  5864. + * Audio only. Audio frame size, if known. Required by some formats to be
  5865. + * static.
  5866. + */
  5867. + int frame_size;
  5868. +
  5869. + /**
  5870. + * Audio only. The amount of padding (in samples) inserted by the encoder at
  5871. + * the beginning of the audio. I.e. this number of leading decoded samples
  5872. + * must be discarded by the caller to get the original audio without leading
  5873. + * padding.
  5874. + */
  5875. + int initial_padding;
  5876. + /**
  5877. + * Audio only. The amount of padding (in samples) appended by the encoder to
  5878. + * the end of the audio. I.e. this number of decoded samples must be
  5879. + * discarded by the caller from the end of the stream to get the original
  5880. + * audio without any trailing padding.
  5881. + */
  5882. + int trailing_padding;
  5883. + /**
  5884. + * Audio only. Number of samples to skip after a discontinuity.
  5885. + */
  5886. + int seek_preroll;
  5887. +
  5888. + /**
  5889. + * Audio only. The channel layout and number of channels.
  5890. + */
  5891. + AVChannelLayout ch_layout;
  5892. +} AVCodecParameters;
  5893. +
  5894. +/**
  5895. + * Allocate a new AVCodecParameters and set its fields to default values
  5896. + * (unknown/invalid/0). The returned struct must be freed with
  5897. + * avcodec_parameters_free().
  5898. + */
  5899. +AVCodecParameters* avcodec_parameters_alloc(void);
  5900. +
  5901. +/**
  5902. + * Free an AVCodecParameters instance and everything associated with it and
  5903. + * write NULL to the supplied pointer.
  5904. + */
  5905. +void avcodec_parameters_free(AVCodecParameters** par);
  5906. +
  5907. +/**
  5908. + * Copy the contents of src to dst. Any allocated fields in dst are freed and
  5909. + * replaced with newly allocated duplicates of the corresponding fields in src.
  5910. + *
  5911. + * @return >= 0 on success, a negative AVERROR code on failure.
  5912. + */
  5913. +int avcodec_parameters_copy(AVCodecParameters* dst,
  5914. + const AVCodecParameters* src);
  5915. +
  5916. +/**
  5917. + * This function is the same as av_get_audio_frame_duration(), except it works
  5918. + * with AVCodecParameters instead of an AVCodecContext.
  5919. + */
  5920. +int av_get_audio_frame_duration2(AVCodecParameters* par, int frame_bytes);
  5921. +
  5922. +/**
  5923. + * @}
  5924. + */
  5925. +
  5926. +#endif // AVCODEC_CODEC_PAR_H
  5927. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/defs.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/defs.h
  5928. new file mode 100644
  5929. index 00000000..9a4632ce
  5930. --- /dev/null
  5931. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/defs.h
  5932. @@ -0,0 +1,203 @@
  5933. +/*
  5934. + *
  5935. + * This file is part of FFmpeg.
  5936. + *
  5937. + * FFmpeg is free software; you can redistribute it and/or
  5938. + * modify it under the terms of the GNU Lesser General Public
  5939. + * License as published by the Free Software Foundation; either
  5940. + * version 2.1 of the License, or (at your option) any later version.
  5941. + *
  5942. + * FFmpeg is distributed in the hope that it will be useful,
  5943. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  5944. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  5945. + * Lesser General Public License for more details.
  5946. + *
  5947. + * You should have received a copy of the GNU Lesser General Public
  5948. + * License along with FFmpeg; if not, write to the Free Software
  5949. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  5950. + */
  5951. +
  5952. +#ifndef AVCODEC_DEFS_H
  5953. +#define AVCODEC_DEFS_H
  5954. +
  5955. +/**
  5956. + * @file
  5957. + * @ingroup libavc
  5958. + * Misc types and constants that do not belong anywhere else.
  5959. + */
  5960. +
  5961. +#include <stdint.h>
  5962. +#include <stdlib.h>
  5963. +
  5964. +/**
  5965. + * @ingroup lavc_decoding
  5966. + * Required number of additionally allocated bytes at the end of the input
  5967. + * bitstream for decoding. This is mainly needed because some optimized
  5968. + * bitstream readers read 32 or 64 bit at once and could read over the end.<br>
  5969. + * Note: If the first 23 bits of the additional bytes are not 0, then damaged
  5970. + * MPEG bitstreams could cause overread and segfault.
  5971. + */
  5972. +#define AV_INPUT_BUFFER_PADDING_SIZE 64
  5973. +
  5974. +/**
  5975. + * Verify checksums embedded in the bitstream (could be of either encoded or
  5976. + * decoded data, depending on the format) and print an error message on
  5977. + * mismatch. If AV_EF_EXPLODE is also set, a mismatching checksum will result in
  5978. + * the decoder/demuxer returning an error.
  5979. + */
  5980. +#define AV_EF_CRCCHECK (1 << 0)
  5981. +#define AV_EF_BITSTREAM (1 << 1) ///< detect bitstream specification deviations
  5982. +#define AV_EF_BUFFER (1 << 2) ///< detect improper bitstream length
  5983. +#define AV_EF_EXPLODE (1 << 3) ///< abort decoding on minor error detection
  5984. +
  5985. +#define AV_EF_IGNORE_ERR (1 << 15) ///< ignore errors and continue
  5986. +#define AV_EF_CAREFUL \
  5987. + (1 << 16) ///< consider things that violate the spec, are fast to calculate
  5988. + ///< and have not been seen in the wild as errors
  5989. +#define AV_EF_COMPLIANT \
  5990. + (1 << 17) ///< consider all spec non compliances as errors
  5991. +#define AV_EF_AGGRESSIVE \
  5992. + (1 << 18) ///< consider things that a sane encoder/muxer should not do as an
  5993. + ///< error
  5994. +
  5995. +#define FF_COMPLIANCE_VERY_STRICT \
  5996. + 2 ///< Strictly conform to an older more strict version of the spec or
  5997. + ///< reference software.
  5998. +#define FF_COMPLIANCE_STRICT \
  5999. + 1 ///< Strictly conform to all the things in the spec no matter what
  6000. + ///< consequences.
  6001. +#define FF_COMPLIANCE_NORMAL 0
  6002. +#define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions
  6003. +#define FF_COMPLIANCE_EXPERIMENTAL \
  6004. + -2 ///< Allow nonstandardized experimental things.
  6005. +
  6006. +/**
  6007. + * @ingroup lavc_decoding
  6008. + */
  6009. +enum AVDiscard {
  6010. + /* We leave some space between them for extensions (drop some
  6011. + * keyframes for intra-only or drop just some bidir frames). */
  6012. + AVDISCARD_NONE = -16, ///< discard nothing
  6013. + AVDISCARD_DEFAULT =
  6014. + 0, ///< discard useless packets like 0 size packets in avi
  6015. + AVDISCARD_NONREF = 8, ///< discard all non reference
  6016. + AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames
  6017. + AVDISCARD_NONINTRA = 24, ///< discard all non intra frames
  6018. + AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes
  6019. + AVDISCARD_ALL = 48, ///< discard all
  6020. +};
  6021. +
  6022. +enum AVAudioServiceType {
  6023. + AV_AUDIO_SERVICE_TYPE_MAIN = 0,
  6024. + AV_AUDIO_SERVICE_TYPE_EFFECTS = 1,
  6025. + AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2,
  6026. + AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3,
  6027. + AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4,
  6028. + AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5,
  6029. + AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6,
  6030. + AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7,
  6031. + AV_AUDIO_SERVICE_TYPE_KARAOKE = 8,
  6032. + AV_AUDIO_SERVICE_TYPE_NB, ///< Not part of ABI
  6033. +};
  6034. +
  6035. +/**
  6036. + * Pan Scan area.
  6037. + * This specifies the area which should be displayed.
  6038. + * Note there may be multiple such areas for one frame.
  6039. + */
  6040. +typedef struct AVPanScan {
  6041. + /**
  6042. + * id
  6043. + * - encoding: Set by user.
  6044. + * - decoding: Set by libavcodec.
  6045. + */
  6046. + int id;
  6047. +
  6048. + /**
  6049. + * width and height in 1/16 pel
  6050. + * - encoding: Set by user.
  6051. + * - decoding: Set by libavcodec.
  6052. + */
  6053. + int width;
  6054. + int height;
  6055. +
  6056. + /**
  6057. + * position of the top left corner in 1/16 pel for up to 3 fields/frames
  6058. + * - encoding: Set by user.
  6059. + * - decoding: Set by libavcodec.
  6060. + */
  6061. + int16_t position[3][2];
  6062. +} AVPanScan;
  6063. +
  6064. +/**
  6065. + * This structure describes the bitrate properties of an encoded bitstream. It
  6066. + * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD
  6067. + * parameters for H.264/HEVC.
  6068. + */
  6069. +typedef struct AVCPBProperties {
  6070. + /**
  6071. + * Maximum bitrate of the stream, in bits per second.
  6072. + * Zero if unknown or unspecified.
  6073. + */
  6074. + int64_t max_bitrate;
  6075. + /**
  6076. + * Minimum bitrate of the stream, in bits per second.
  6077. + * Zero if unknown or unspecified.
  6078. + */
  6079. + int64_t min_bitrate;
  6080. + /**
  6081. + * Average bitrate of the stream, in bits per second.
  6082. + * Zero if unknown or unspecified.
  6083. + */
  6084. + int64_t avg_bitrate;
  6085. +
  6086. + /**
  6087. + * The size of the buffer to which the ratecontrol is applied, in bits.
  6088. + * Zero if unknown or unspecified.
  6089. + */
  6090. + int64_t buffer_size;
  6091. +
  6092. + /**
  6093. + * The delay between the time the packet this structure is associated with
  6094. + * is received and the time when it should be decoded, in periods of a 27MHz
  6095. + * clock.
  6096. + *
  6097. + * UINT64_MAX when unknown or unspecified.
  6098. + */
  6099. + uint64_t vbv_delay;
  6100. +} AVCPBProperties;
  6101. +
  6102. +/**
  6103. + * Allocate a CPB properties structure and initialize its fields to default
  6104. + * values.
  6105. + *
  6106. + * @param size if non-NULL, the size of the allocated struct will be written
  6107. + * here. This is useful for embedding it in side data.
  6108. + *
  6109. + * @return the newly allocated struct or NULL on failure
  6110. + */
  6111. +AVCPBProperties* av_cpb_properties_alloc(size_t* size);
  6112. +
  6113. +/**
  6114. + * This structure supplies correlation between a packet timestamp and a wall
  6115. + * clock production time. The definition follows the Producer Reference Time
  6116. + * ('prft') as defined in ISO/IEC 14496-12
  6117. + */
  6118. +typedef struct AVProducerReferenceTime {
  6119. + /**
  6120. + * A UTC timestamp, in microseconds, since Unix epoch (e.g, av_gettime()).
  6121. + */
  6122. + int64_t wallclock;
  6123. + int flags;
  6124. +} AVProducerReferenceTime;
  6125. +
  6126. +/**
  6127. + * Encode extradata length to a buffer. Used by xiph codecs.
  6128. + *
  6129. + * @param s buffer to write to; must be at least (v/255+1) bytes long
  6130. + * @param v size of extradata in bytes
  6131. + * @return number of bytes written to the buffer.
  6132. + */
  6133. +unsigned int av_xiphlacing(unsigned char* s, unsigned int v);
  6134. +
  6135. +#endif // AVCODEC_DEFS_H
  6136. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/packet.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/packet.h
  6137. new file mode 100644
  6138. index 00000000..d85cf6a8
  6139. --- /dev/null
  6140. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/packet.h
  6141. @@ -0,0 +1,730 @@
  6142. +/*
  6143. + * AVPacket public API
  6144. + *
  6145. + * This file is part of FFmpeg.
  6146. + *
  6147. + * FFmpeg is free software; you can redistribute it and/or
  6148. + * modify it under the terms of the GNU Lesser General Public
  6149. + * License as published by the Free Software Foundation; either
  6150. + * version 2.1 of the License, or (at your option) any later version.
  6151. + *
  6152. + * FFmpeg is distributed in the hope that it will be useful,
  6153. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  6154. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  6155. + * Lesser General Public License for more details.
  6156. + *
  6157. + * You should have received a copy of the GNU Lesser General Public
  6158. + * License along with FFmpeg; if not, write to the Free Software
  6159. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  6160. + */
  6161. +
  6162. +#ifndef AVCODEC_PACKET_H
  6163. +#define AVCODEC_PACKET_H
  6164. +
  6165. +#include <stddef.h>
  6166. +#include <stdint.h>
  6167. +
  6168. +#include "libavutil/attributes.h"
  6169. +#include "libavutil/buffer.h"
  6170. +#include "libavutil/dict.h"
  6171. +#include "libavutil/rational.h"
  6172. +#include "libavutil/version.h"
  6173. +
  6174. +#include "libavcodec/version_major.h"
  6175. +
  6176. +/**
  6177. + * @defgroup lavc_packet AVPacket
  6178. + *
  6179. + * Types and functions for working with AVPacket.
  6180. + * @{
  6181. + */
  6182. +enum AVPacketSideDataType {
  6183. + /**
  6184. + * An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE
  6185. + * bytes worth of palette. This side data signals that a new palette is
  6186. + * present.
  6187. + */
  6188. + AV_PKT_DATA_PALETTE,
  6189. +
  6190. + /**
  6191. + * The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format
  6192. + * that the extradata buffer was changed and the receiving side should
  6193. + * act upon it appropriately. The new extradata is embedded in the side
  6194. + * data buffer and should be immediately used for processing the current
  6195. + * frame or packet.
  6196. + */
  6197. + AV_PKT_DATA_NEW_EXTRADATA,
  6198. +
  6199. + /**
  6200. + * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
  6201. + * @code
  6202. + * u32le param_flags
  6203. + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT)
  6204. + * s32le channel_count
  6205. + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT)
  6206. + * u64le channel_layout
  6207. + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE)
  6208. + * s32le sample_rate
  6209. + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS)
  6210. + * s32le width
  6211. + * s32le height
  6212. + * @endcode
  6213. + */
  6214. + AV_PKT_DATA_PARAM_CHANGE,
  6215. +
  6216. + /**
  6217. + * An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of
  6218. + * structures with info about macroblocks relevant to splitting the
  6219. + * packet into smaller packets on macroblock edges (e.g. as for RFC 2190).
  6220. + * That is, it does not necessarily contain info about all macroblocks,
  6221. + * as long as the distance between macroblocks in the info is smaller
  6222. + * than the target payload size.
  6223. + * Each MB info structure is 12 bytes, and is laid out as follows:
  6224. + * @code
  6225. + * u32le bit offset from the start of the packet
  6226. + * u8 current quantizer at the start of the macroblock
  6227. + * u8 GOB number
  6228. + * u16le macroblock address within the GOB
  6229. + * u8 horizontal MV predictor
  6230. + * u8 vertical MV predictor
  6231. + * u8 horizontal MV predictor for block number 3
  6232. + * u8 vertical MV predictor for block number 3
  6233. + * @endcode
  6234. + */
  6235. + AV_PKT_DATA_H263_MB_INFO,
  6236. +
  6237. + /**
  6238. + * This side data should be associated with an audio stream and contains
  6239. + * ReplayGain information in form of the AVReplayGain struct.
  6240. + */
  6241. + AV_PKT_DATA_REPLAYGAIN,
  6242. +
  6243. + /**
  6244. + * This side data contains a 3x3 transformation matrix describing an affine
  6245. + * transformation that needs to be applied to the decoded video frames for
  6246. + * correct presentation.
  6247. + *
  6248. + * See libavutil/display.h for a detailed description of the data.
  6249. + */
  6250. + AV_PKT_DATA_DISPLAYMATRIX,
  6251. +
  6252. + /**
  6253. + * This side data should be associated with a video stream and contains
  6254. + * Stereoscopic 3D information in form of the AVStereo3D struct.
  6255. + */
  6256. + AV_PKT_DATA_STEREO3D,
  6257. +
  6258. + /**
  6259. + * This side data should be associated with an audio stream and corresponds
  6260. + * to enum AVAudioServiceType.
  6261. + */
  6262. + AV_PKT_DATA_AUDIO_SERVICE_TYPE,
  6263. +
  6264. + /**
  6265. + * This side data contains quality related information from the encoder.
  6266. + * @code
  6267. + * u32le quality factor of the compressed frame. Allowed range is between 1
  6268. + * (good) and FF_LAMBDA_MAX (bad). u8 picture type u8 error count u16
  6269. + * reserved u64le[error count] sum of squared differences between encoder in
  6270. + * and output
  6271. + * @endcode
  6272. + */
  6273. + AV_PKT_DATA_QUALITY_STATS,
  6274. +
  6275. + /**
  6276. + * This side data contains an integer value representing the stream index
  6277. + * of a "fallback" track. A fallback track indicates an alternate
  6278. + * track to use when the current track can not be decoded for some reason.
  6279. + * e.g. no decoder available for codec.
  6280. + */
  6281. + AV_PKT_DATA_FALLBACK_TRACK,
  6282. +
  6283. + /**
  6284. + * This side data corresponds to the AVCPBProperties struct.
  6285. + */
  6286. + AV_PKT_DATA_CPB_PROPERTIES,
  6287. +
  6288. + /**
  6289. + * Recommmends skipping the specified number of samples
  6290. + * @code
  6291. + * u32le number of samples to skip from start of this packet
  6292. + * u32le number of samples to skip from end of this packet
  6293. + * u8 reason for start skip
  6294. + * u8 reason for end skip (0=padding silence, 1=convergence)
  6295. + * @endcode
  6296. + */
  6297. + AV_PKT_DATA_SKIP_SAMPLES,
  6298. +
  6299. + /**
  6300. + * An AV_PKT_DATA_JP_DUALMONO side data packet indicates that
  6301. + * the packet may contain "dual mono" audio specific to Japanese DTV
  6302. + * and if it is true, recommends only the selected channel to be used.
  6303. + * @code
  6304. + * u8 selected channels (0=main/left, 1=sub/right, 2=both)
  6305. + * @endcode
  6306. + */
  6307. + AV_PKT_DATA_JP_DUALMONO,
  6308. +
  6309. + /**
  6310. + * A list of zero terminated key/value strings. There is no end marker for
  6311. + * the list, so it is required to rely on the side data size to stop.
  6312. + */
  6313. + AV_PKT_DATA_STRINGS_METADATA,
  6314. +
  6315. + /**
  6316. + * Subtitle event position
  6317. + * @code
  6318. + * u32le x1
  6319. + * u32le y1
  6320. + * u32le x2
  6321. + * u32le y2
  6322. + * @endcode
  6323. + */
  6324. + AV_PKT_DATA_SUBTITLE_POSITION,
  6325. +
  6326. + /**
  6327. + * Data found in BlockAdditional element of matroska container. There is
  6328. + * no end marker for the data, so it is required to rely on the side data
  6329. + * size to recognize the end. 8 byte id (as found in BlockAddId) followed
  6330. + * by data.
  6331. + */
  6332. + AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
  6333. +
  6334. + /**
  6335. + * The optional first identifier line of a WebVTT cue.
  6336. + */
  6337. + AV_PKT_DATA_WEBVTT_IDENTIFIER,
  6338. +
  6339. + /**
  6340. + * The optional settings (rendering instructions) that immediately
  6341. + * follow the timestamp specifier of a WebVTT cue.
  6342. + */
  6343. + AV_PKT_DATA_WEBVTT_SETTINGS,
  6344. +
  6345. + /**
  6346. + * A list of zero terminated key/value strings. There is no end marker for
  6347. + * the list, so it is required to rely on the side data size to stop. This
  6348. + * side data includes updated metadata which appeared in the stream.
  6349. + */
  6350. + AV_PKT_DATA_METADATA_UPDATE,
  6351. +
  6352. + /**
  6353. + * MPEGTS stream ID as uint8_t, this is required to pass the stream ID
  6354. + * information from the demuxer to the corresponding muxer.
  6355. + */
  6356. + AV_PKT_DATA_MPEGTS_STREAM_ID,
  6357. +
  6358. + /**
  6359. + * Mastering display metadata (based on SMPTE-2086:2014). This metadata
  6360. + * should be associated with a video stream and contains data in the form
  6361. + * of the AVMasteringDisplayMetadata struct.
  6362. + */
  6363. + AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
  6364. +
  6365. + /**
  6366. + * This side data should be associated with a video stream and corresponds
  6367. + * to the AVSphericalMapping structure.
  6368. + */
  6369. + AV_PKT_DATA_SPHERICAL,
  6370. +
  6371. + /**
  6372. + * Content light level (based on CTA-861.3). This metadata should be
  6373. + * associated with a video stream and contains data in the form of the
  6374. + * AVContentLightMetadata struct.
  6375. + */
  6376. + AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
  6377. +
  6378. + /**
  6379. + * ATSC A53 Part 4 Closed Captions. This metadata should be associated with
  6380. + * a video stream. A53 CC bitstream is stored as uint8_t in
  6381. + * AVPacketSideData.data. The number of bytes of CC data is
  6382. + * AVPacketSideData.size.
  6383. + */
  6384. + AV_PKT_DATA_A53_CC,
  6385. +
  6386. + /**
  6387. + * This side data is encryption initialization data.
  6388. + * The format is not part of ABI, use av_encryption_init_info_* methods to
  6389. + * access.
  6390. + */
  6391. + AV_PKT_DATA_ENCRYPTION_INIT_INFO,
  6392. +
  6393. + /**
  6394. + * This side data contains encryption info for how to decrypt the packet.
  6395. + * The format is not part of ABI, use av_encryption_info_* methods to access.
  6396. + */
  6397. + AV_PKT_DATA_ENCRYPTION_INFO,
  6398. +
  6399. + /**
  6400. + * Active Format Description data consisting of a single byte as specified
  6401. + * in ETSI TS 101 154 using AVActiveFormatDescription enum.
  6402. + */
  6403. + AV_PKT_DATA_AFD,
  6404. +
  6405. + /**
  6406. + * Producer Reference Time data corresponding to the AVProducerReferenceTime
  6407. + * struct, usually exported by some encoders (on demand through the prft flag
  6408. + * set in the AVCodecContext export_side_data field).
  6409. + */
  6410. + AV_PKT_DATA_PRFT,
  6411. +
  6412. + /**
  6413. + * ICC profile data consisting of an opaque octet buffer following the
  6414. + * format described by ISO 15076-1.
  6415. + */
  6416. + AV_PKT_DATA_ICC_PROFILE,
  6417. +
  6418. + /**
  6419. + * DOVI configuration
  6420. + * ref:
  6421. + * dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2.1.2,
  6422. + * section 2.2
  6423. + * dolby-vision-bitstreams-in-mpeg-2-transport-stream-multiplex-v1.2,
  6424. + * section 3.3 Tags are stored in struct AVDOVIDecoderConfigurationRecord.
  6425. + */
  6426. + AV_PKT_DATA_DOVI_CONF,
  6427. +
  6428. + /**
  6429. + * Timecode which conforms to SMPTE ST 12-1:2014. The data is an array of 4
  6430. + * uint32_t where the first uint32_t describes how many (1-3) of the other
  6431. + * timecodes are used. The timecode format is described in the documentation
  6432. + * of av_timecode_get_smpte_from_framenum() function in libavutil/timecode.h.
  6433. + */
  6434. + AV_PKT_DATA_S12M_TIMECODE,
  6435. +
  6436. + /**
  6437. + * HDR10+ dynamic metadata associated with a video frame. The metadata is in
  6438. + * the form of the AVDynamicHDRPlus struct and contains
  6439. + * information for color volume transform - application 4 of
  6440. + * SMPTE 2094-40:2016 standard.
  6441. + */
  6442. + AV_PKT_DATA_DYNAMIC_HDR10_PLUS,
  6443. +
  6444. + /**
  6445. + * The number of side data types.
  6446. + * This is not part of the public API/ABI in the sense that it may
  6447. + * change when new side data types are added.
  6448. + * This must stay the last enum value.
  6449. + * If its value becomes huge, some code using it
  6450. + * needs to be updated as it assumes it to be smaller than other limits.
  6451. + */
  6452. + AV_PKT_DATA_NB
  6453. +};
  6454. +
  6455. +#define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS // DEPRECATED
  6456. +
  6457. +typedef struct AVPacketSideData {
  6458. + uint8_t* data;
  6459. + size_t size;
  6460. + enum AVPacketSideDataType type;
  6461. +} AVPacketSideData;
  6462. +
  6463. +/**
  6464. + * This structure stores compressed data. It is typically exported by demuxers
  6465. + * and then passed as input to decoders, or received as output from encoders and
  6466. + * then passed to muxers.
  6467. + *
  6468. + * For video, it should typically contain one compressed frame. For audio it may
  6469. + * contain several compressed frames. Encoders are allowed to output empty
  6470. + * packets, with no compressed data, containing only side data
  6471. + * (e.g. to update some stream parameters at the end of encoding).
  6472. + *
  6473. + * The semantics of data ownership depends on the buf field.
  6474. + * If it is set, the packet data is dynamically allocated and is
  6475. + * valid indefinitely until a call to av_packet_unref() reduces the
  6476. + * reference count to 0.
  6477. + *
  6478. + * If the buf field is not set av_packet_ref() would make a copy instead
  6479. + * of increasing the reference count.
  6480. + *
  6481. + * The side data is always allocated with av_malloc(), copied by
  6482. + * av_packet_ref() and freed by av_packet_unref().
  6483. + *
  6484. + * sizeof(AVPacket) being a part of the public ABI is deprecated. once
  6485. + * av_init_packet() is removed, new packets will only be able to be allocated
  6486. + * with av_packet_alloc(), and new fields may be added to the end of the struct
  6487. + * with a minor bump.
  6488. + *
  6489. + * @see av_packet_alloc
  6490. + * @see av_packet_ref
  6491. + * @see av_packet_unref
  6492. + */
  6493. +typedef struct AVPacket {
  6494. + /**
  6495. + * A reference to the reference-counted buffer where the packet data is
  6496. + * stored.
  6497. + * May be NULL, then the packet data is not reference-counted.
  6498. + */
  6499. + AVBufferRef* buf;
  6500. + /**
  6501. + * Presentation timestamp in AVStream->time_base units; the time at which
  6502. + * the decompressed packet will be presented to the user.
  6503. + * Can be AV_NOPTS_VALUE if it is not stored in the file.
  6504. + * pts MUST be larger or equal to dts as presentation cannot happen before
  6505. + * decompression, unless one wants to view hex dumps. Some formats misuse
  6506. + * the terms dts and pts/cts to mean something different. Such timestamps
  6507. + * must be converted to true pts/dts before they are stored in AVPacket.
  6508. + */
  6509. + int64_t pts;
  6510. + /**
  6511. + * Decompression timestamp in AVStream->time_base units; the time at which
  6512. + * the packet is decompressed.
  6513. + * Can be AV_NOPTS_VALUE if it is not stored in the file.
  6514. + */
  6515. + int64_t dts;
  6516. + uint8_t* data;
  6517. + int size;
  6518. + int stream_index;
  6519. + /**
  6520. + * A combination of AV_PKT_FLAG values
  6521. + */
  6522. + int flags;
  6523. + /**
  6524. + * Additional packet data that can be provided by the container.
  6525. + * Packet can contain several types of side information.
  6526. + */
  6527. + AVPacketSideData* side_data;
  6528. + int side_data_elems;
  6529. +
  6530. + /**
  6531. + * Duration of this packet in AVStream->time_base units, 0 if unknown.
  6532. + * Equals next_pts - this_pts in presentation order.
  6533. + */
  6534. + int64_t duration;
  6535. +
  6536. + int64_t pos; ///< byte position in stream, -1 if unknown
  6537. +
  6538. + /**
  6539. + * for some private data of the user
  6540. + */
  6541. + void* opaque;
  6542. +
  6543. + /**
  6544. + * AVBufferRef for free use by the API user. FFmpeg will never check the
  6545. + * contents of the buffer ref. FFmpeg calls av_buffer_unref() on it when
  6546. + * the packet is unreferenced. av_packet_copy_props() calls create a new
  6547. + * reference with av_buffer_ref() for the target packet's opaque_ref field.
  6548. + *
  6549. + * This is unrelated to the opaque field, although it serves a similar
  6550. + * purpose.
  6551. + */
  6552. + AVBufferRef* opaque_ref;
  6553. +
  6554. + /**
  6555. + * Time base of the packet's timestamps.
  6556. + * In the future, this field may be set on packets output by encoders or
  6557. + * demuxers, but its value will be by default ignored on input to decoders
  6558. + * or muxers.
  6559. + */
  6560. + AVRational time_base;
  6561. +} AVPacket;
  6562. +
  6563. +#if FF_API_INIT_PACKET
  6564. +attribute_deprecated typedef struct AVPacketList {
  6565. + AVPacket pkt;
  6566. + struct AVPacketList* next;
  6567. +} AVPacketList;
  6568. +#endif
  6569. +
  6570. +#define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe
  6571. +#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted
  6572. +/**
  6573. + * Flag is used to discard packets which are required to maintain valid
  6574. + * decoder state but are not required for output and should be dropped
  6575. + * after decoding.
  6576. + **/
  6577. +#define AV_PKT_FLAG_DISCARD 0x0004
  6578. +/**
  6579. + * The packet comes from a trusted source.
  6580. + *
  6581. + * Otherwise-unsafe constructs such as arbitrary pointers to data
  6582. + * outside the packet may be followed.
  6583. + */
  6584. +#define AV_PKT_FLAG_TRUSTED 0x0008
  6585. +/**
  6586. + * Flag is used to indicate packets that contain frames that can
  6587. + * be discarded by the decoder. I.e. Non-reference frames.
  6588. + */
  6589. +#define AV_PKT_FLAG_DISPOSABLE 0x0010
  6590. +
  6591. +enum AVSideDataParamChangeFlags {
  6592. +#if FF_API_OLD_CHANNEL_LAYOUT
  6593. + /**
  6594. + * @deprecated those are not used by any decoder
  6595. + */
  6596. + AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001,
  6597. + AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002,
  6598. +#endif
  6599. + AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004,
  6600. + AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008,
  6601. +};
  6602. +
  6603. +/**
  6604. + * Allocate an AVPacket and set its fields to default values. The resulting
  6605. + * struct must be freed using av_packet_free().
  6606. + *
  6607. + * @return An AVPacket filled with default values or NULL on failure.
  6608. + *
  6609. + * @note this only allocates the AVPacket itself, not the data buffers. Those
  6610. + * must be allocated through other means such as av_new_packet.
  6611. + *
  6612. + * @see av_new_packet
  6613. + */
  6614. +AVPacket* av_packet_alloc(void);
  6615. +
  6616. +/**
  6617. + * Create a new packet that references the same data as src.
  6618. + *
  6619. + * This is a shortcut for av_packet_alloc()+av_packet_ref().
  6620. + *
  6621. + * @return newly created AVPacket on success, NULL on error.
  6622. + *
  6623. + * @see av_packet_alloc
  6624. + * @see av_packet_ref
  6625. + */
  6626. +AVPacket* av_packet_clone(const AVPacket* src);
  6627. +
  6628. +/**
  6629. + * Free the packet, if the packet is reference counted, it will be
  6630. + * unreferenced first.
  6631. + *
  6632. + * @param pkt packet to be freed. The pointer will be set to NULL.
  6633. + * @note passing NULL is a no-op.
  6634. + */
  6635. +void av_packet_free(AVPacket** pkt);
  6636. +
  6637. +#if FF_API_INIT_PACKET
  6638. +/**
  6639. + * Initialize optional fields of a packet with default values.
  6640. + *
  6641. + * Note, this does not touch the data and size members, which have to be
  6642. + * initialized separately.
  6643. + *
  6644. + * @param pkt packet
  6645. + *
  6646. + * @see av_packet_alloc
  6647. + * @see av_packet_unref
  6648. + *
  6649. + * @deprecated This function is deprecated. Once it's removed,
  6650. + sizeof(AVPacket) will not be a part of the ABI anymore.
  6651. + */
  6652. +attribute_deprecated void av_init_packet(AVPacket* pkt);
  6653. +#endif
  6654. +
  6655. +/**
  6656. + * Allocate the payload of a packet and initialize its fields with
  6657. + * default values.
  6658. + *
  6659. + * @param pkt packet
  6660. + * @param size wanted payload size
  6661. + * @return 0 if OK, AVERROR_xxx otherwise
  6662. + */
  6663. +int av_new_packet(AVPacket* pkt, int size);
  6664. +
  6665. +/**
  6666. + * Reduce packet size, correctly zeroing padding
  6667. + *
  6668. + * @param pkt packet
  6669. + * @param size new size
  6670. + */
  6671. +void av_shrink_packet(AVPacket* pkt, int size);
  6672. +
  6673. +/**
  6674. + * Increase packet size, correctly zeroing padding
  6675. + *
  6676. + * @param pkt packet
  6677. + * @param grow_by number of bytes by which to increase the size of the packet
  6678. + */
  6679. +int av_grow_packet(AVPacket* pkt, int grow_by);
  6680. +
  6681. +/**
  6682. + * Initialize a reference-counted packet from av_malloc()ed data.
  6683. + *
  6684. + * @param pkt packet to be initialized. This function will set the data, size,
  6685. + * and buf fields, all others are left untouched.
  6686. + * @param data Data allocated by av_malloc() to be used as packet data. If this
  6687. + * function returns successfully, the data is owned by the underlying
  6688. + * AVBuffer. The caller may not access the data through other means.
  6689. + * @param size size of data in bytes, without the padding. I.e. the full buffer
  6690. + * size is assumed to be size + AV_INPUT_BUFFER_PADDING_SIZE.
  6691. + *
  6692. + * @return 0 on success, a negative AVERROR on error
  6693. + */
  6694. +int av_packet_from_data(AVPacket* pkt, uint8_t* data, int size);
  6695. +
  6696. +/**
  6697. + * Allocate new information of a packet.
  6698. + *
  6699. + * @param pkt packet
  6700. + * @param type side information type
  6701. + * @param size side information size
  6702. + * @return pointer to fresh allocated data or NULL otherwise
  6703. + */
  6704. +uint8_t* av_packet_new_side_data(AVPacket* pkt, enum AVPacketSideDataType type,
  6705. + size_t size);
  6706. +
  6707. +/**
  6708. + * Wrap an existing array as a packet side data.
  6709. + *
  6710. + * @param pkt packet
  6711. + * @param type side information type
  6712. + * @param data the side data array. It must be allocated with the av_malloc()
  6713. + * family of functions. The ownership of the data is transferred to
  6714. + * pkt.
  6715. + * @param size side information size
  6716. + * @return a non-negative number on success, a negative AVERROR code on
  6717. + * failure. On failure, the packet is unchanged and the data remains
  6718. + * owned by the caller.
  6719. + */
  6720. +int av_packet_add_side_data(AVPacket* pkt, enum AVPacketSideDataType type,
  6721. + uint8_t* data, size_t size);
  6722. +
  6723. +/**
  6724. + * Shrink the already allocated side data buffer
  6725. + *
  6726. + * @param pkt packet
  6727. + * @param type side information type
  6728. + * @param size new side information size
  6729. + * @return 0 on success, < 0 on failure
  6730. + */
  6731. +int av_packet_shrink_side_data(AVPacket* pkt, enum AVPacketSideDataType type,
  6732. + size_t size);
  6733. +
  6734. +/**
  6735. + * Get side information from packet.
  6736. + *
  6737. + * @param pkt packet
  6738. + * @param type desired side information type
  6739. + * @param size If supplied, *size will be set to the size of the side data
  6740. + * or to zero if the desired side data is not present.
  6741. + * @return pointer to data if present or NULL otherwise
  6742. + */
  6743. +uint8_t* av_packet_get_side_data(const AVPacket* pkt,
  6744. + enum AVPacketSideDataType type, size_t* size);
  6745. +
  6746. +const char* av_packet_side_data_name(enum AVPacketSideDataType type);
  6747. +
  6748. +/**
  6749. + * Pack a dictionary for use in side_data.
  6750. + *
  6751. + * @param dict The dictionary to pack.
  6752. + * @param size pointer to store the size of the returned data
  6753. + * @return pointer to data if successful, NULL otherwise
  6754. + */
  6755. +uint8_t* av_packet_pack_dictionary(AVDictionary* dict, size_t* size);
  6756. +/**
  6757. + * Unpack a dictionary from side_data.
  6758. + *
  6759. + * @param data data from side_data
  6760. + * @param size size of the data
  6761. + * @param dict the metadata storage dictionary
  6762. + * @return 0 on success, < 0 on failure
  6763. + */
  6764. +int av_packet_unpack_dictionary(const uint8_t* data, size_t size,
  6765. + AVDictionary** dict);
  6766. +
  6767. +/**
  6768. + * Convenience function to free all the side data stored.
  6769. + * All the other fields stay untouched.
  6770. + *
  6771. + * @param pkt packet
  6772. + */
  6773. +void av_packet_free_side_data(AVPacket* pkt);
  6774. +
  6775. +/**
  6776. + * Setup a new reference to the data described by a given packet
  6777. + *
  6778. + * If src is reference-counted, setup dst as a new reference to the
  6779. + * buffer in src. Otherwise allocate a new buffer in dst and copy the
  6780. + * data from src into it.
  6781. + *
  6782. + * All the other fields are copied from src.
  6783. + *
  6784. + * @see av_packet_unref
  6785. + *
  6786. + * @param dst Destination packet. Will be completely overwritten.
  6787. + * @param src Source packet
  6788. + *
  6789. + * @return 0 on success, a negative AVERROR on error. On error, dst
  6790. + * will be blank (as if returned by av_packet_alloc()).
  6791. + */
  6792. +int av_packet_ref(AVPacket* dst, const AVPacket* src);
  6793. +
  6794. +/**
  6795. + * Wipe the packet.
  6796. + *
  6797. + * Unreference the buffer referenced by the packet and reset the
  6798. + * remaining packet fields to their default values.
  6799. + *
  6800. + * @param pkt The packet to be unreferenced.
  6801. + */
  6802. +void av_packet_unref(AVPacket* pkt);
  6803. +
  6804. +/**
  6805. + * Move every field in src to dst and reset src.
  6806. + *
  6807. + * @see av_packet_unref
  6808. + *
  6809. + * @param src Source packet, will be reset
  6810. + * @param dst Destination packet
  6811. + */
  6812. +void av_packet_move_ref(AVPacket* dst, AVPacket* src);
  6813. +
  6814. +/**
  6815. + * Copy only "properties" fields from src to dst.
  6816. + *
  6817. + * Properties for the purpose of this function are all the fields
  6818. + * beside those related to the packet data (buf, data, size)
  6819. + *
  6820. + * @param dst Destination packet
  6821. + * @param src Source packet
  6822. + *
  6823. + * @return 0 on success AVERROR on failure.
  6824. + */
  6825. +int av_packet_copy_props(AVPacket* dst, const AVPacket* src);
  6826. +
  6827. +/**
  6828. + * Ensure the data described by a given packet is reference counted.
  6829. + *
  6830. + * @note This function does not ensure that the reference will be writable.
  6831. + * Use av_packet_make_writable instead for that purpose.
  6832. + *
  6833. + * @see av_packet_ref
  6834. + * @see av_packet_make_writable
  6835. + *
  6836. + * @param pkt packet whose data should be made reference counted.
  6837. + *
  6838. + * @return 0 on success, a negative AVERROR on error. On failure, the
  6839. + * packet is unchanged.
  6840. + */
  6841. +int av_packet_make_refcounted(AVPacket* pkt);
  6842. +
  6843. +/**
  6844. + * Create a writable reference for the data described by a given packet,
  6845. + * avoiding data copy if possible.
  6846. + *
  6847. + * @param pkt Packet whose data should be made writable.
  6848. + *
  6849. + * @return 0 on success, a negative AVERROR on failure. On failure, the
  6850. + * packet is unchanged.
  6851. + */
  6852. +int av_packet_make_writable(AVPacket* pkt);
  6853. +
  6854. +/**
  6855. + * Convert valid timing fields (timestamps / durations) in a packet from one
  6856. + * timebase to another. Timestamps with unknown values (AV_NOPTS_VALUE) will be
  6857. + * ignored.
  6858. + *
  6859. + * @param pkt packet on which the conversion will be performed
  6860. + * @param tb_src source timebase, in which the timing fields in pkt are
  6861. + * expressed
  6862. + * @param tb_dst destination timebase, to which the timing fields will be
  6863. + * converted
  6864. + */
  6865. +void av_packet_rescale_ts(AVPacket* pkt, AVRational tb_src, AVRational tb_dst);
  6866. +
  6867. +/**
  6868. + * @}
  6869. + */
  6870. +
  6871. +#endif // AVCODEC_PACKET_H
  6872. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/vdpau.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/vdpau.h
  6873. new file mode 100644
  6874. index 00000000..0b91baec
  6875. --- /dev/null
  6876. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/vdpau.h
  6877. @@ -0,0 +1,156 @@
  6878. +/*
  6879. + * The Video Decode and Presentation API for UNIX (VDPAU) is used for
  6880. + * hardware-accelerated decoding of MPEG-1/2, H.264 and VC-1.
  6881. + *
  6882. + * Copyright (C) 2008 NVIDIA
  6883. + *
  6884. + * This file is part of FFmpeg.
  6885. + *
  6886. + * FFmpeg is free software; you can redistribute it and/or
  6887. + * modify it under the terms of the GNU Lesser General Public
  6888. + * License as published by the Free Software Foundation; either
  6889. + * version 2.1 of the License, or (at your option) any later version.
  6890. + *
  6891. + * FFmpeg is distributed in the hope that it will be useful,
  6892. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  6893. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  6894. + * Lesser General Public License for more details.
  6895. + *
  6896. + * You should have received a copy of the GNU Lesser General Public
  6897. + * License along with FFmpeg; if not, write to the Free Software
  6898. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  6899. + */
  6900. +
  6901. +#ifndef AVCODEC_VDPAU_H
  6902. +#define AVCODEC_VDPAU_H
  6903. +
  6904. +/**
  6905. + * @file
  6906. + * @ingroup lavc_codec_hwaccel_vdpau
  6907. + * Public libavcodec VDPAU header.
  6908. + */
  6909. +
  6910. +/**
  6911. + * @defgroup lavc_codec_hwaccel_vdpau VDPAU Decoder and Renderer
  6912. + * @ingroup lavc_codec_hwaccel
  6913. + *
  6914. + * VDPAU hardware acceleration has two modules
  6915. + * - VDPAU decoding
  6916. + * - VDPAU presentation
  6917. + *
  6918. + * The VDPAU decoding module parses all headers using FFmpeg
  6919. + * parsing mechanisms and uses VDPAU for the actual decoding.
  6920. + *
  6921. + * As per the current implementation, the actual decoding
  6922. + * and rendering (API calls) are done as part of the VDPAU
  6923. + * presentation (vo_vdpau.c) module.
  6924. + *
  6925. + * @{
  6926. + */
  6927. +
  6928. +#include <vdpau/vdpau.h>
  6929. +
  6930. +#include "libavutil/avconfig.h"
  6931. +#include "libavutil/attributes.h"
  6932. +
  6933. +#include "avcodec.h"
  6934. +
  6935. +struct AVCodecContext;
  6936. +struct AVFrame;
  6937. +
  6938. +typedef int (*AVVDPAU_Render2)(struct AVCodecContext*, struct AVFrame*,
  6939. + const VdpPictureInfo*, uint32_t,
  6940. + const VdpBitstreamBuffer*);
  6941. +
  6942. +/**
  6943. + * This structure is used to share data between the libavcodec library and
  6944. + * the client video application.
  6945. + * The user shall allocate the structure via the av_alloc_vdpau_hwaccel
  6946. + * function and make it available as
  6947. + * AVCodecContext.hwaccel_context. Members can be set by the user once
  6948. + * during initialization or through each AVCodecContext.get_buffer()
  6949. + * function call. In any case, they must be valid prior to calling
  6950. + * decoding functions.
  6951. + *
  6952. + * The size of this structure is not a part of the public ABI and must not
  6953. + * be used outside of libavcodec. Use av_vdpau_alloc_context() to allocate an
  6954. + * AVVDPAUContext.
  6955. + */
  6956. +typedef struct AVVDPAUContext {
  6957. + /**
  6958. + * VDPAU decoder handle
  6959. + *
  6960. + * Set by user.
  6961. + */
  6962. + VdpDecoder decoder;
  6963. +
  6964. + /**
  6965. + * VDPAU decoder render callback
  6966. + *
  6967. + * Set by the user.
  6968. + */
  6969. + VdpDecoderRender* render;
  6970. +
  6971. + AVVDPAU_Render2 render2;
  6972. +} AVVDPAUContext;
  6973. +
  6974. +/**
  6975. + * @brief allocation function for AVVDPAUContext
  6976. + *
  6977. + * Allows extending the struct without breaking API/ABI
  6978. + */
  6979. +AVVDPAUContext* av_alloc_vdpaucontext(void);
  6980. +
  6981. +AVVDPAU_Render2 av_vdpau_hwaccel_get_render2(const AVVDPAUContext*);
  6982. +void av_vdpau_hwaccel_set_render2(AVVDPAUContext*, AVVDPAU_Render2);
  6983. +
  6984. +/**
  6985. + * Associate a VDPAU device with a codec context for hardware acceleration.
  6986. + * This function is meant to be called from the get_format() codec callback,
  6987. + * or earlier. It can also be called after avcodec_flush_buffers() to change
  6988. + * the underlying VDPAU device mid-stream (e.g. to recover from non-transparent
  6989. + * display preemption).
  6990. + *
  6991. + * @note get_format() must return AV_PIX_FMT_VDPAU if this function completes
  6992. + * successfully.
  6993. + *
  6994. + * @param avctx decoding context whose get_format() callback is invoked
  6995. + * @param device VDPAU device handle to use for hardware acceleration
  6996. + * @param get_proc_address VDPAU device driver
  6997. + * @param flags zero of more OR'd AV_HWACCEL_FLAG_* flags
  6998. + *
  6999. + * @return 0 on success, an AVERROR code on failure.
  7000. + */
  7001. +int av_vdpau_bind_context(AVCodecContext* avctx, VdpDevice device,
  7002. + VdpGetProcAddress* get_proc_address, unsigned flags);
  7003. +
  7004. +/**
  7005. + * Gets the parameters to create an adequate VDPAU video surface for the codec
  7006. + * context using VDPAU hardware decoding acceleration.
  7007. + *
  7008. + * @note Behavior is undefined if the context was not successfully bound to a
  7009. + * VDPAU device using av_vdpau_bind_context().
  7010. + *
  7011. + * @param avctx the codec context being used for decoding the stream
  7012. + * @param type storage space for the VDPAU video surface chroma type
  7013. + * (or NULL to ignore)
  7014. + * @param width storage space for the VDPAU video surface pixel width
  7015. + * (or NULL to ignore)
  7016. + * @param height storage space for the VDPAU video surface pixel height
  7017. + * (or NULL to ignore)
  7018. + *
  7019. + * @return 0 on success, a negative AVERROR code on failure.
  7020. + */
  7021. +int av_vdpau_get_surface_parameters(AVCodecContext* avctx, VdpChromaType* type,
  7022. + uint32_t* width, uint32_t* height);
  7023. +
  7024. +/**
  7025. + * Allocate an AVVDPAUContext.
  7026. + *
  7027. + * @return Newly-allocated AVVDPAUContext or NULL on failure.
  7028. + */
  7029. +AVVDPAUContext* av_vdpau_alloc_context(void);
  7030. +
  7031. +/** @} */
  7032. +
  7033. +#endif /* AVCODEC_VDPAU_H */
  7034. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/version.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/version.h
  7035. new file mode 100644
  7036. index 00000000..d3f6020c
  7037. --- /dev/null
  7038. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/version.h
  7039. @@ -0,0 +1,45 @@
  7040. +/*
  7041. + * This file is part of FFmpeg.
  7042. + *
  7043. + * FFmpeg is free software; you can redistribute it and/or
  7044. + * modify it under the terms of the GNU Lesser General Public
  7045. + * License as published by the Free Software Foundation; either
  7046. + * version 2.1 of the License, or (at your option) any later version.
  7047. + *
  7048. + * FFmpeg is distributed in the hope that it will be useful,
  7049. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  7050. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  7051. + * Lesser General Public License for more details.
  7052. + *
  7053. + * You should have received a copy of the GNU Lesser General Public
  7054. + * License along with FFmpeg; if not, write to the Free Software
  7055. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  7056. + */
  7057. +
  7058. +#ifndef AVCODEC_VERSION_H
  7059. +#define AVCODEC_VERSION_H
  7060. +
  7061. +/**
  7062. + * @file
  7063. + * @ingroup libavc
  7064. + * Libavcodec version macros.
  7065. + */
  7066. +
  7067. +#include "libavutil/version.h"
  7068. +
  7069. +#include "version_major.h"
  7070. +
  7071. +#define LIBAVCODEC_VERSION_MINOR 5
  7072. +#define LIBAVCODEC_VERSION_MICRO 100
  7073. +
  7074. +#define LIBAVCODEC_VERSION_INT \
  7075. + AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, LIBAVCODEC_VERSION_MINOR, \
  7076. + LIBAVCODEC_VERSION_MICRO)
  7077. +#define LIBAVCODEC_VERSION \
  7078. + AV_VERSION(LIBAVCODEC_VERSION_MAJOR, LIBAVCODEC_VERSION_MINOR, \
  7079. + LIBAVCODEC_VERSION_MICRO)
  7080. +#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT
  7081. +
  7082. +#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
  7083. +
  7084. +#endif /* AVCODEC_VERSION_H */
  7085. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/version_major.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/version_major.h
  7086. new file mode 100644
  7087. index 00000000..e9cd92cb
  7088. --- /dev/null
  7089. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavcodec/version_major.h
  7090. @@ -0,0 +1,52 @@
  7091. +/*
  7092. + * This file is part of FFmpeg.
  7093. + *
  7094. + * FFmpeg is free software; you can redistribute it and/or
  7095. + * modify it under the terms of the GNU Lesser General Public
  7096. + * License as published by the Free Software Foundation; either
  7097. + * version 2.1 of the License, or (at your option) any later version.
  7098. + *
  7099. + * FFmpeg is distributed in the hope that it will be useful,
  7100. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  7101. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  7102. + * Lesser General Public License for more details.
  7103. + *
  7104. + * You should have received a copy of the GNU Lesser General Public
  7105. + * License along with FFmpeg; if not, write to the Free Software
  7106. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  7107. + */
  7108. +
  7109. +#ifndef AVCODEC_VERSION_MAJOR_H
  7110. +#define AVCODEC_VERSION_MAJOR_H
  7111. +
  7112. +/**
  7113. + * @file
  7114. + * @ingroup libavc
  7115. + * Libavcodec version macros.
  7116. + */
  7117. +
  7118. +#define LIBAVCODEC_VERSION_MAJOR 60
  7119. +
  7120. +/**
  7121. + * FF_API_* defines may be placed below to indicate public API that will be
  7122. + * dropped at a future version bump. The defines themselves are not part of
  7123. + * the public API and may change, break or disappear at any time.
  7124. + *
  7125. + * @note, when bumping the major version it is recommended to manually
  7126. + * disable each FF_API_* in its own commit instead of disabling them all
  7127. + * at once through the bump. This improves the git bisect-ability of the change.
  7128. + */
  7129. +
  7130. +#define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 61)
  7131. +#define FF_API_IDCT_NONE (LIBAVCODEC_VERSION_MAJOR < 61)
  7132. +#define FF_API_SVTAV1_OPTS (LIBAVCODEC_VERSION_MAJOR < 61)
  7133. +#define FF_API_AYUV_CODECID (LIBAVCODEC_VERSION_MAJOR < 61)
  7134. +#define FF_API_VT_OUTPUT_CALLBACK (LIBAVCODEC_VERSION_MAJOR < 61)
  7135. +#define FF_API_AVCODEC_CHROMA_POS (LIBAVCODEC_VERSION_MAJOR < 61)
  7136. +#define FF_API_VT_HWACCEL_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 61)
  7137. +#define FF_API_AVCTX_FRAME_NUMBER (LIBAVCODEC_VERSION_MAJOR < 61)
  7138. +
  7139. +// reminder to remove CrystalHD decoders on next major bump
  7140. +#define FF_CODEC_CRYSTAL_HD (LIBAVCODEC_VERSION_MAJOR < 61)
  7141. +
  7142. +#endif /* AVCODEC_VERSION_MAJOR_H */
  7143. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/attributes.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/attributes.h
  7144. new file mode 100644
  7145. index 00000000..774d1fe9
  7146. --- /dev/null
  7147. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/attributes.h
  7148. @@ -0,0 +1,173 @@
  7149. +/*
  7150. + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
  7151. + *
  7152. + * This file is part of FFmpeg.
  7153. + *
  7154. + * FFmpeg is free software; you can redistribute it and/or
  7155. + * modify it under the terms of the GNU Lesser General Public
  7156. + * License as published by the Free Software Foundation; either
  7157. + * version 2.1 of the License, or (at your option) any later version.
  7158. + *
  7159. + * FFmpeg is distributed in the hope that it will be useful,
  7160. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  7161. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  7162. + * Lesser General Public License for more details.
  7163. + *
  7164. + * You should have received a copy of the GNU Lesser General Public
  7165. + * License along with FFmpeg; if not, write to the Free Software
  7166. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  7167. + */
  7168. +
  7169. +/**
  7170. + * @file
  7171. + * Macro definitions for various function/variable attributes
  7172. + */
  7173. +
  7174. +#ifndef AVUTIL_ATTRIBUTES_H
  7175. +#define AVUTIL_ATTRIBUTES_H
  7176. +
  7177. +#ifdef __GNUC__
  7178. +# define AV_GCC_VERSION_AT_LEAST(x, y) \
  7179. + (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y))
  7180. +# define AV_GCC_VERSION_AT_MOST(x, y) \
  7181. + (__GNUC__ < (x) || __GNUC__ == (x) && __GNUC_MINOR__ <= (y))
  7182. +#else
  7183. +# define AV_GCC_VERSION_AT_LEAST(x, y) 0
  7184. +# define AV_GCC_VERSION_AT_MOST(x, y) 0
  7185. +#endif
  7186. +
  7187. +#ifdef __has_builtin
  7188. +# define AV_HAS_BUILTIN(x) __has_builtin(x)
  7189. +#else
  7190. +# define AV_HAS_BUILTIN(x) 0
  7191. +#endif
  7192. +
  7193. +#ifndef av_always_inline
  7194. +# if AV_GCC_VERSION_AT_LEAST(3, 1)
  7195. +# define av_always_inline __attribute__((always_inline)) inline
  7196. +# elif defined(_MSC_VER)
  7197. +# define av_always_inline __forceinline
  7198. +# else
  7199. +# define av_always_inline inline
  7200. +# endif
  7201. +#endif
  7202. +
  7203. +#ifndef av_extern_inline
  7204. +# if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__)
  7205. +# define av_extern_inline extern inline
  7206. +# else
  7207. +# define av_extern_inline inline
  7208. +# endif
  7209. +#endif
  7210. +
  7211. +#if AV_GCC_VERSION_AT_LEAST(3, 4)
  7212. +# define av_warn_unused_result __attribute__((warn_unused_result))
  7213. +#else
  7214. +# define av_warn_unused_result
  7215. +#endif
  7216. +
  7217. +#if AV_GCC_VERSION_AT_LEAST(3, 1)
  7218. +# define av_noinline __attribute__((noinline))
  7219. +#elif defined(_MSC_VER)
  7220. +# define av_noinline __declspec(noinline)
  7221. +#else
  7222. +# define av_noinline
  7223. +#endif
  7224. +
  7225. +#if AV_GCC_VERSION_AT_LEAST(3, 1) || defined(__clang__)
  7226. +# define av_pure __attribute__((pure))
  7227. +#else
  7228. +# define av_pure
  7229. +#endif
  7230. +
  7231. +#if AV_GCC_VERSION_AT_LEAST(2, 6) || defined(__clang__)
  7232. +# define av_const __attribute__((const))
  7233. +#else
  7234. +# define av_const
  7235. +#endif
  7236. +
  7237. +#if AV_GCC_VERSION_AT_LEAST(4, 3) || defined(__clang__)
  7238. +# define av_cold __attribute__((cold))
  7239. +#else
  7240. +# define av_cold
  7241. +#endif
  7242. +
  7243. +#if AV_GCC_VERSION_AT_LEAST(4, 1) && !defined(__llvm__)
  7244. +# define av_flatten __attribute__((flatten))
  7245. +#else
  7246. +# define av_flatten
  7247. +#endif
  7248. +
  7249. +#if AV_GCC_VERSION_AT_LEAST(3, 1)
  7250. +# define attribute_deprecated __attribute__((deprecated))
  7251. +#elif defined(_MSC_VER)
  7252. +# define attribute_deprecated __declspec(deprecated)
  7253. +#else
  7254. +# define attribute_deprecated
  7255. +#endif
  7256. +
  7257. +/**
  7258. + * Disable warnings about deprecated features
  7259. + * This is useful for sections of code kept for backward compatibility and
  7260. + * scheduled for removal.
  7261. + */
  7262. +#ifndef AV_NOWARN_DEPRECATED
  7263. +# if AV_GCC_VERSION_AT_LEAST(4, 6) || defined(__clang__)
  7264. +# define AV_NOWARN_DEPRECATED(code) \
  7265. + _Pragma("GCC diagnostic push") \
  7266. + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
  7267. + code _Pragma("GCC diagnostic pop")
  7268. +# elif defined(_MSC_VER)
  7269. +# define AV_NOWARN_DEPRECATED(code) \
  7270. + __pragma(warning(push)) __pragma(warning(disable : 4996)) code; \
  7271. + __pragma(warning(pop))
  7272. +# else
  7273. +# define AV_NOWARN_DEPRECATED(code) code
  7274. +# endif
  7275. +#endif
  7276. +
  7277. +#if defined(__GNUC__) || defined(__clang__)
  7278. +# define av_unused __attribute__((unused))
  7279. +#else
  7280. +# define av_unused
  7281. +#endif
  7282. +
  7283. +/**
  7284. + * Mark a variable as used and prevent the compiler from optimizing it
  7285. + * away. This is useful for variables accessed only from inline
  7286. + * assembler without the compiler being aware.
  7287. + */
  7288. +#if AV_GCC_VERSION_AT_LEAST(3, 1) || defined(__clang__)
  7289. +# define av_used __attribute__((used))
  7290. +#else
  7291. +# define av_used
  7292. +#endif
  7293. +
  7294. +#if AV_GCC_VERSION_AT_LEAST(3, 3) || defined(__clang__)
  7295. +# define av_alias __attribute__((may_alias))
  7296. +#else
  7297. +# define av_alias
  7298. +#endif
  7299. +
  7300. +#if (defined(__GNUC__) || defined(__clang__)) && !defined(__INTEL_COMPILER)
  7301. +# define av_uninit(x) x = x
  7302. +#else
  7303. +# define av_uninit(x) x
  7304. +#endif
  7305. +
  7306. +#if defined(__GNUC__) || defined(__clang__)
  7307. +# define av_builtin_constant_p __builtin_constant_p
  7308. +# define av_printf_format(fmtpos, attrpos) \
  7309. + __attribute__((__format__(__printf__, fmtpos, attrpos)))
  7310. +#else
  7311. +# define av_builtin_constant_p(x) 0
  7312. +# define av_printf_format(fmtpos, attrpos)
  7313. +#endif
  7314. +
  7315. +#if AV_GCC_VERSION_AT_LEAST(2, 5) || defined(__clang__)
  7316. +# define av_noreturn __attribute__((noreturn))
  7317. +#else
  7318. +# define av_noreturn
  7319. +#endif
  7320. +
  7321. +#endif /* AVUTIL_ATTRIBUTES_H */
  7322. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/avconfig.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/avconfig.h
  7323. new file mode 100644
  7324. index 00000000..c289fbb5
  7325. --- /dev/null
  7326. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/avconfig.h
  7327. @@ -0,0 +1,6 @@
  7328. +/* Generated by ffmpeg configure */
  7329. +#ifndef AVUTIL_AVCONFIG_H
  7330. +#define AVUTIL_AVCONFIG_H
  7331. +#define AV_HAVE_BIGENDIAN 0
  7332. +#define AV_HAVE_FAST_UNALIGNED 1
  7333. +#endif /* AVUTIL_AVCONFIG_H */
  7334. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/avutil.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/avutil.h
  7335. new file mode 100644
  7336. index 00000000..8f8343bd
  7337. --- /dev/null
  7338. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/avutil.h
  7339. @@ -0,0 +1,371 @@
  7340. +/*
  7341. + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
  7342. + *
  7343. + * This file is part of FFmpeg.
  7344. + *
  7345. + * FFmpeg is free software; you can redistribute it and/or
  7346. + * modify it under the terms of the GNU Lesser General Public
  7347. + * License as published by the Free Software Foundation; either
  7348. + * version 2.1 of the License, or (at your option) any later version.
  7349. + *
  7350. + * FFmpeg is distributed in the hope that it will be useful,
  7351. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  7352. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  7353. + * Lesser General Public License for more details.
  7354. + *
  7355. + * You should have received a copy of the GNU Lesser General Public
  7356. + * License along with FFmpeg; if not, write to the Free Software
  7357. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  7358. + */
  7359. +
  7360. +#ifndef AVUTIL_AVUTIL_H
  7361. +#define AVUTIL_AVUTIL_H
  7362. +
  7363. +/**
  7364. + * @file
  7365. + * @ingroup lavu
  7366. + * Convenience header that includes @ref lavu "libavutil"'s core.
  7367. + */
  7368. +
  7369. +/**
  7370. + * @mainpage
  7371. + *
  7372. + * @section ffmpeg_intro Introduction
  7373. + *
  7374. + * This document describes the usage of the different libraries
  7375. + * provided by FFmpeg.
  7376. + *
  7377. + * @li @ref libavc "libavcodec" encoding/decoding library
  7378. + * @li @ref lavfi "libavfilter" graph-based frame editing library
  7379. + * @li @ref libavf "libavformat" I/O and muxing/demuxing library
  7380. + * @li @ref lavd "libavdevice" special devices muxing/demuxing library
  7381. + * @li @ref lavu "libavutil" common utility library
  7382. + * @li @ref lswr "libswresample" audio resampling, format conversion and mixing
  7383. + * @li @ref lpp "libpostproc" post processing library
  7384. + * @li @ref libsws "libswscale" color conversion and scaling library
  7385. + *
  7386. + * @section ffmpeg_versioning Versioning and compatibility
  7387. + *
  7388. + * Each of the FFmpeg libraries contains a version.h header, which defines a
  7389. + * major, minor and micro version number with the
  7390. + * <em>LIBRARYNAME_VERSION_{MAJOR,MINOR,MICRO}</em> macros. The major version
  7391. + * number is incremented with backward incompatible changes - e.g. removing
  7392. + * parts of the public API, reordering public struct members, etc. The minor
  7393. + * version number is incremented for backward compatible API changes or major
  7394. + * new features - e.g. adding a new public function or a new decoder. The micro
  7395. + * version number is incremented for smaller changes that a calling program
  7396. + * might still want to check for - e.g. changing behavior in a previously
  7397. + * unspecified situation.
  7398. + *
  7399. + * FFmpeg guarantees backward API and ABI compatibility for each library as long
  7400. + * as its major version number is unchanged. This means that no public symbols
  7401. + * will be removed or renamed. Types and names of the public struct members and
  7402. + * values of public macros and enums will remain the same (unless they were
  7403. + * explicitly declared as not part of the public API). Documented behavior will
  7404. + * not change.
  7405. + *
  7406. + * In other words, any correct program that works with a given FFmpeg snapshot
  7407. + * should work just as well without any changes with any later snapshot with the
  7408. + * same major versions. This applies to both rebuilding the program against new
  7409. + * FFmpeg versions or to replacing the dynamic FFmpeg libraries that a program
  7410. + * links against.
  7411. + *
  7412. + * However, new public symbols may be added and new members may be appended to
  7413. + * public structs whose size is not part of public ABI (most public structs in
  7414. + * FFmpeg). New macros and enum values may be added. Behavior in undocumented
  7415. + * situations may change slightly (and be documented). All those are accompanied
  7416. + * by an entry in doc/APIchanges and incrementing either the minor or micro
  7417. + * version number.
  7418. + */
  7419. +
  7420. +/**
  7421. + * @defgroup lavu libavutil
  7422. + * Common code shared across all FFmpeg libraries.
  7423. + *
  7424. + * @note
  7425. + * libavutil is designed to be modular. In most cases, in order to use the
  7426. + * functions provided by one component of libavutil you must explicitly include
  7427. + * the specific header containing that feature. If you are only using
  7428. + * media-related components, you could simply include libavutil/avutil.h, which
  7429. + * brings in most of the "core" components.
  7430. + *
  7431. + * @{
  7432. + *
  7433. + * @defgroup lavu_crypto Crypto and Hashing
  7434. + *
  7435. + * @{
  7436. + * @}
  7437. + *
  7438. + * @defgroup lavu_math Mathematics
  7439. + * @{
  7440. + *
  7441. + * @}
  7442. + *
  7443. + * @defgroup lavu_string String Manipulation
  7444. + *
  7445. + * @{
  7446. + *
  7447. + * @}
  7448. + *
  7449. + * @defgroup lavu_mem Memory Management
  7450. + *
  7451. + * @{
  7452. + *
  7453. + * @}
  7454. + *
  7455. + * @defgroup lavu_data Data Structures
  7456. + * @{
  7457. + *
  7458. + * @}
  7459. + *
  7460. + * @defgroup lavu_video Video related
  7461. + *
  7462. + * @{
  7463. + *
  7464. + * @}
  7465. + *
  7466. + * @defgroup lavu_audio Audio related
  7467. + *
  7468. + * @{
  7469. + *
  7470. + * @}
  7471. + *
  7472. + * @defgroup lavu_error Error Codes
  7473. + *
  7474. + * @{
  7475. + *
  7476. + * @}
  7477. + *
  7478. + * @defgroup lavu_log Logging Facility
  7479. + *
  7480. + * @{
  7481. + *
  7482. + * @}
  7483. + *
  7484. + * @defgroup lavu_misc Other
  7485. + *
  7486. + * @{
  7487. + *
  7488. + * @defgroup preproc_misc Preprocessor String Macros
  7489. + *
  7490. + * @{
  7491. + *
  7492. + * @}
  7493. + *
  7494. + * @defgroup version_utils Library Version Macros
  7495. + *
  7496. + * @{
  7497. + *
  7498. + * @}
  7499. + */
  7500. +
  7501. +/**
  7502. + * @addtogroup lavu_ver
  7503. + * @{
  7504. + */
  7505. +
  7506. +/**
  7507. + * Return the LIBAVUTIL_VERSION_INT constant.
  7508. + */
  7509. +unsigned avutil_version(void);
  7510. +
  7511. +/**
  7512. + * Return an informative version string. This usually is the actual release
  7513. + * version number or a git commit description. This string has no fixed format
  7514. + * and can change any time. It should never be parsed by code.
  7515. + */
  7516. +const char* av_version_info(void);
  7517. +
  7518. +/**
  7519. + * Return the libavutil build-time configuration.
  7520. + */
  7521. +const char* avutil_configuration(void);
  7522. +
  7523. +/**
  7524. + * Return the libavutil license.
  7525. + */
  7526. +const char* avutil_license(void);
  7527. +
  7528. +/**
  7529. + * @}
  7530. + */
  7531. +
  7532. +/**
  7533. + * @addtogroup lavu_media Media Type
  7534. + * @brief Media Type
  7535. + */
  7536. +
  7537. +enum AVMediaType {
  7538. + AVMEDIA_TYPE_UNKNOWN = -1, ///< Usually treated as AVMEDIA_TYPE_DATA
  7539. + AVMEDIA_TYPE_VIDEO,
  7540. + AVMEDIA_TYPE_AUDIO,
  7541. + AVMEDIA_TYPE_DATA, ///< Opaque data information usually continuous
  7542. + AVMEDIA_TYPE_SUBTITLE,
  7543. + AVMEDIA_TYPE_ATTACHMENT, ///< Opaque data information usually sparse
  7544. + AVMEDIA_TYPE_NB
  7545. +};
  7546. +
  7547. +/**
  7548. + * Return a string describing the media_type enum, NULL if media_type
  7549. + * is unknown.
  7550. + */
  7551. +const char* av_get_media_type_string(enum AVMediaType media_type);
  7552. +
  7553. +/**
  7554. + * @defgroup lavu_const Constants
  7555. + * @{
  7556. + *
  7557. + * @defgroup lavu_enc Encoding specific
  7558. + *
  7559. + * @note those definition should move to avcodec
  7560. + * @{
  7561. + */
  7562. +
  7563. +#define FF_LAMBDA_SHIFT 7
  7564. +#define FF_LAMBDA_SCALE (1 << FF_LAMBDA_SHIFT)
  7565. +#define FF_QP2LAMBDA 118 ///< factor to convert from H.263 QP to lambda
  7566. +#define FF_LAMBDA_MAX (256 * 128 - 1)
  7567. +
  7568. +#define FF_QUALITY_SCALE FF_LAMBDA_SCALE // FIXME maybe remove
  7569. +
  7570. +/**
  7571. + * @}
  7572. + * @defgroup lavu_time Timestamp specific
  7573. + *
  7574. + * FFmpeg internal timebase and timestamp definitions
  7575. + *
  7576. + * @{
  7577. + */
  7578. +
  7579. +/**
  7580. + * @brief Undefined timestamp value
  7581. + *
  7582. + * Usually reported by demuxer that work on containers that do not provide
  7583. + * either pts or dts.
  7584. + */
  7585. +
  7586. +#define AV_NOPTS_VALUE ((int64_t)UINT64_C(0x8000000000000000))
  7587. +
  7588. +/**
  7589. + * Internal time base represented as integer
  7590. + */
  7591. +
  7592. +#define AV_TIME_BASE 1000000
  7593. +
  7594. +/**
  7595. + * Internal time base represented as fractional value
  7596. + */
  7597. +
  7598. +#define AV_TIME_BASE_Q \
  7599. + (AVRational) { 1, AV_TIME_BASE }
  7600. +
  7601. +/**
  7602. + * @}
  7603. + * @}
  7604. + * @defgroup lavu_picture Image related
  7605. + *
  7606. + * AVPicture types, pixel formats and basic image planes manipulation.
  7607. + *
  7608. + * @{
  7609. + */
  7610. +
  7611. +enum AVPictureType {
  7612. + AV_PICTURE_TYPE_NONE = 0, ///< Undefined
  7613. + AV_PICTURE_TYPE_I, ///< Intra
  7614. + AV_PICTURE_TYPE_P, ///< Predicted
  7615. + AV_PICTURE_TYPE_B, ///< Bi-dir predicted
  7616. + AV_PICTURE_TYPE_S, ///< S(GMC)-VOP MPEG-4
  7617. + AV_PICTURE_TYPE_SI, ///< Switching Intra
  7618. + AV_PICTURE_TYPE_SP, ///< Switching Predicted
  7619. + AV_PICTURE_TYPE_BI, ///< BI type
  7620. +};
  7621. +
  7622. +/**
  7623. + * Return a single letter to describe the given picture type
  7624. + * pict_type.
  7625. + *
  7626. + * @param[in] pict_type the picture type @return a single character
  7627. + * representing the picture type, '?' if pict_type is unknown
  7628. + */
  7629. +char av_get_picture_type_char(enum AVPictureType pict_type);
  7630. +
  7631. +/**
  7632. + * @}
  7633. + */
  7634. +
  7635. +#include "common.h"
  7636. +#include "error.h"
  7637. +#include "rational.h"
  7638. +#include "version.h"
  7639. +#include "macros.h"
  7640. +#include "mathematics.h"
  7641. +#include "log.h"
  7642. +#include "pixfmt.h"
  7643. +
  7644. +/**
  7645. + * Return x default pointer in case p is NULL.
  7646. + */
  7647. +static inline void* av_x_if_null(const void* p, const void* x) {
  7648. + return (void*)(intptr_t)(p ? p : x);
  7649. +}
  7650. +
  7651. +/**
  7652. + * Compute the length of an integer list.
  7653. + *
  7654. + * @param elsize size in bytes of each list element (only 1, 2, 4 or 8)
  7655. + * @param term list terminator (usually 0 or -1)
  7656. + * @param list pointer to the list
  7657. + * @return length of the list, in elements, not counting the terminator
  7658. + */
  7659. +unsigned av_int_list_length_for_size(unsigned elsize, const void* list,
  7660. + uint64_t term) av_pure;
  7661. +
  7662. +/**
  7663. + * Compute the length of an integer list.
  7664. + *
  7665. + * @param term list terminator (usually 0 or -1)
  7666. + * @param list pointer to the list
  7667. + * @return length of the list, in elements, not counting the terminator
  7668. + */
  7669. +#define av_int_list_length(list, term) \
  7670. + av_int_list_length_for_size(sizeof(*(list)), list, term)
  7671. +
  7672. +#if FF_API_AV_FOPEN_UTF8
  7673. +/**
  7674. + * Open a file using a UTF-8 filename.
  7675. + * The API of this function matches POSIX fopen(), errors are returned through
  7676. + * errno.
  7677. + * @deprecated Avoid using it, as on Windows, the FILE* allocated by this
  7678. + * function may be allocated with a different CRT than the caller
  7679. + * who uses the FILE*. No replacement provided in public API.
  7680. + */
  7681. +attribute_deprecated FILE* av_fopen_utf8(const char* path, const char* mode);
  7682. +#endif
  7683. +
  7684. +/**
  7685. + * Return the fractional representation of the internal time base.
  7686. + */
  7687. +AVRational av_get_time_base_q(void);
  7688. +
  7689. +#define AV_FOURCC_MAX_STRING_SIZE 32
  7690. +
  7691. +#define av_fourcc2str(fourcc) \
  7692. + av_fourcc_make_string((char[AV_FOURCC_MAX_STRING_SIZE]){0}, fourcc)
  7693. +
  7694. +/**
  7695. + * Fill the provided buffer with a string containing a FourCC (four-character
  7696. + * code) representation.
  7697. + *
  7698. + * @param buf a buffer with size in bytes of at least
  7699. + * AV_FOURCC_MAX_STRING_SIZE
  7700. + * @param fourcc the fourcc to represent
  7701. + * @return the buffer in input
  7702. + */
  7703. +char* av_fourcc_make_string(char* buf, uint32_t fourcc);
  7704. +
  7705. +/**
  7706. + * @}
  7707. + * @}
  7708. + */
  7709. +
  7710. +#endif /* AVUTIL_AVUTIL_H */
  7711. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/buffer.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/buffer.h
  7712. new file mode 100644
  7713. index 00000000..372de093
  7714. --- /dev/null
  7715. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/buffer.h
  7716. @@ -0,0 +1,324 @@
  7717. +/*
  7718. + * This file is part of FFmpeg.
  7719. + *
  7720. + * FFmpeg is free software; you can redistribute it and/or
  7721. + * modify it under the terms of the GNU Lesser General Public
  7722. + * License as published by the Free Software Foundation; either
  7723. + * version 2.1 of the License, or (at your option) any later version.
  7724. + *
  7725. + * FFmpeg is distributed in the hope that it will be useful,
  7726. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  7727. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  7728. + * Lesser General Public License for more details.
  7729. + *
  7730. + * You should have received a copy of the GNU Lesser General Public
  7731. + * License along with FFmpeg; if not, write to the Free Software
  7732. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  7733. + */
  7734. +
  7735. +/**
  7736. + * @file
  7737. + * @ingroup lavu_buffer
  7738. + * refcounted data buffer API
  7739. + */
  7740. +
  7741. +#ifndef AVUTIL_BUFFER_H
  7742. +#define AVUTIL_BUFFER_H
  7743. +
  7744. +#include <stddef.h>
  7745. +#include <stdint.h>
  7746. +
  7747. +/**
  7748. + * @defgroup lavu_buffer AVBuffer
  7749. + * @ingroup lavu_data
  7750. + *
  7751. + * @{
  7752. + * AVBuffer is an API for reference-counted data buffers.
  7753. + *
  7754. + * There are two core objects in this API -- AVBuffer and AVBufferRef. AVBuffer
  7755. + * represents the data buffer itself; it is opaque and not meant to be accessed
  7756. + * by the caller directly, but only through AVBufferRef. However, the caller may
  7757. + * e.g. compare two AVBuffer pointers to check whether two different references
  7758. + * are describing the same data buffer. AVBufferRef represents a single
  7759. + * reference to an AVBuffer and it is the object that may be manipulated by the
  7760. + * caller directly.
  7761. + *
  7762. + * There are two functions provided for creating a new AVBuffer with a single
  7763. + * reference -- av_buffer_alloc() to just allocate a new buffer, and
  7764. + * av_buffer_create() to wrap an existing array in an AVBuffer. From an existing
  7765. + * reference, additional references may be created with av_buffer_ref().
  7766. + * Use av_buffer_unref() to free a reference (this will automatically free the
  7767. + * data once all the references are freed).
  7768. + *
  7769. + * The convention throughout this API and the rest of FFmpeg is such that the
  7770. + * buffer is considered writable if there exists only one reference to it (and
  7771. + * it has not been marked as read-only). The av_buffer_is_writable() function is
  7772. + * provided to check whether this is true and av_buffer_make_writable() will
  7773. + * automatically create a new writable buffer when necessary.
  7774. + * Of course nothing prevents the calling code from violating this convention,
  7775. + * however that is safe only when all the existing references are under its
  7776. + * control.
  7777. + *
  7778. + * @note Referencing and unreferencing the buffers is thread-safe and thus
  7779. + * may be done from multiple threads simultaneously without any need for
  7780. + * additional locking.
  7781. + *
  7782. + * @note Two different references to the same buffer can point to different
  7783. + * parts of the buffer (i.e. their AVBufferRef.data will not be equal).
  7784. + */
  7785. +
  7786. +/**
  7787. + * A reference counted buffer type. It is opaque and is meant to be used through
  7788. + * references (AVBufferRef).
  7789. + */
  7790. +typedef struct AVBuffer AVBuffer;
  7791. +
  7792. +/**
  7793. + * A reference to a data buffer.
  7794. + *
  7795. + * The size of this struct is not a part of the public ABI and it is not meant
  7796. + * to be allocated directly.
  7797. + */
  7798. +typedef struct AVBufferRef {
  7799. + AVBuffer* buffer;
  7800. +
  7801. + /**
  7802. + * The data buffer. It is considered writable if and only if
  7803. + * this is the only reference to the buffer, in which case
  7804. + * av_buffer_is_writable() returns 1.
  7805. + */
  7806. + uint8_t* data;
  7807. + /**
  7808. + * Size of data in bytes.
  7809. + */
  7810. + size_t size;
  7811. +} AVBufferRef;
  7812. +
  7813. +/**
  7814. + * Allocate an AVBuffer of the given size using av_malloc().
  7815. + *
  7816. + * @return an AVBufferRef of given size or NULL when out of memory
  7817. + */
  7818. +AVBufferRef* av_buffer_alloc(size_t size);
  7819. +
  7820. +/**
  7821. + * Same as av_buffer_alloc(), except the returned buffer will be initialized
  7822. + * to zero.
  7823. + */
  7824. +AVBufferRef* av_buffer_allocz(size_t size);
  7825. +
  7826. +/**
  7827. + * Always treat the buffer as read-only, even when it has only one
  7828. + * reference.
  7829. + */
  7830. +#define AV_BUFFER_FLAG_READONLY (1 << 0)
  7831. +
  7832. +/**
  7833. + * Create an AVBuffer from an existing array.
  7834. + *
  7835. + * If this function is successful, data is owned by the AVBuffer. The caller may
  7836. + * only access data through the returned AVBufferRef and references derived from
  7837. + * it.
  7838. + * If this function fails, data is left untouched.
  7839. + * @param data data array
  7840. + * @param size size of data in bytes
  7841. + * @param free a callback for freeing this buffer's data
  7842. + * @param opaque parameter to be got for processing or passed to free
  7843. + * @param flags a combination of AV_BUFFER_FLAG_*
  7844. + *
  7845. + * @return an AVBufferRef referring to data on success, NULL on failure.
  7846. + */
  7847. +AVBufferRef* av_buffer_create(uint8_t* data, size_t size,
  7848. + void (*free)(void* opaque, uint8_t* data),
  7849. + void* opaque, int flags);
  7850. +
  7851. +/**
  7852. + * Default free callback, which calls av_free() on the buffer data.
  7853. + * This function is meant to be passed to av_buffer_create(), not called
  7854. + * directly.
  7855. + */
  7856. +void av_buffer_default_free(void* opaque, uint8_t* data);
  7857. +
  7858. +/**
  7859. + * Create a new reference to an AVBuffer.
  7860. + *
  7861. + * @return a new AVBufferRef referring to the same AVBuffer as buf or NULL on
  7862. + * failure.
  7863. + */
  7864. +AVBufferRef* av_buffer_ref(const AVBufferRef* buf);
  7865. +
  7866. +/**
  7867. + * Free a given reference and automatically free the buffer if there are no more
  7868. + * references to it.
  7869. + *
  7870. + * @param buf the reference to be freed. The pointer is set to NULL on return.
  7871. + */
  7872. +void av_buffer_unref(AVBufferRef** buf);
  7873. +
  7874. +/**
  7875. + * @return 1 if the caller may write to the data referred to by buf (which is
  7876. + * true if and only if buf is the only reference to the underlying AVBuffer).
  7877. + * Return 0 otherwise.
  7878. + * A positive answer is valid until av_buffer_ref() is called on buf.
  7879. + */
  7880. +int av_buffer_is_writable(const AVBufferRef* buf);
  7881. +
  7882. +/**
  7883. + * @return the opaque parameter set by av_buffer_create.
  7884. + */
  7885. +void* av_buffer_get_opaque(const AVBufferRef* buf);
  7886. +
  7887. +int av_buffer_get_ref_count(const AVBufferRef* buf);
  7888. +
  7889. +/**
  7890. + * Create a writable reference from a given buffer reference, avoiding data copy
  7891. + * if possible.
  7892. + *
  7893. + * @param buf buffer reference to make writable. On success, buf is either left
  7894. + * untouched, or it is unreferenced and a new writable AVBufferRef is
  7895. + * written in its place. On failure, buf is left untouched.
  7896. + * @return 0 on success, a negative AVERROR on failure.
  7897. + */
  7898. +int av_buffer_make_writable(AVBufferRef** buf);
  7899. +
  7900. +/**
  7901. + * Reallocate a given buffer.
  7902. + *
  7903. + * @param buf a buffer reference to reallocate. On success, buf will be
  7904. + * unreferenced and a new reference with the required size will be
  7905. + * written in its place. On failure buf will be left untouched. *buf
  7906. + * may be NULL, then a new buffer is allocated.
  7907. + * @param size required new buffer size.
  7908. + * @return 0 on success, a negative AVERROR on failure.
  7909. + *
  7910. + * @note the buffer is actually reallocated with av_realloc() only if it was
  7911. + * initially allocated through av_buffer_realloc(NULL) and there is only one
  7912. + * reference to it (i.e. the one passed to this function). In all other cases
  7913. + * a new buffer is allocated and the data is copied.
  7914. + */
  7915. +int av_buffer_realloc(AVBufferRef** buf, size_t size);
  7916. +
  7917. +/**
  7918. + * Ensure dst refers to the same data as src.
  7919. + *
  7920. + * When *dst is already equivalent to src, do nothing. Otherwise unreference dst
  7921. + * and replace it with a new reference to src.
  7922. + *
  7923. + * @param dst Pointer to either a valid buffer reference or NULL. On success,
  7924. + * this will point to a buffer reference equivalent to src. On
  7925. + * failure, dst will be left untouched.
  7926. + * @param src A buffer reference to replace dst with. May be NULL, then this
  7927. + * function is equivalent to av_buffer_unref(dst).
  7928. + * @return 0 on success
  7929. + * AVERROR(ENOMEM) on memory allocation failure.
  7930. + */
  7931. +int av_buffer_replace(AVBufferRef** dst, const AVBufferRef* src);
  7932. +
  7933. +/**
  7934. + * @}
  7935. + */
  7936. +
  7937. +/**
  7938. + * @defgroup lavu_bufferpool AVBufferPool
  7939. + * @ingroup lavu_data
  7940. + *
  7941. + * @{
  7942. + * AVBufferPool is an API for a lock-free thread-safe pool of AVBuffers.
  7943. + *
  7944. + * Frequently allocating and freeing large buffers may be slow. AVBufferPool is
  7945. + * meant to solve this in cases when the caller needs a set of buffers of the
  7946. + * same size (the most obvious use case being buffers for raw video or audio
  7947. + * frames).
  7948. + *
  7949. + * At the beginning, the user must call av_buffer_pool_init() to create the
  7950. + * buffer pool. Then whenever a buffer is needed, call av_buffer_pool_get() to
  7951. + * get a reference to a new buffer, similar to av_buffer_alloc(). This new
  7952. + * reference works in all aspects the same way as the one created by
  7953. + * av_buffer_alloc(). However, when the last reference to this buffer is
  7954. + * unreferenced, it is returned to the pool instead of being freed and will be
  7955. + * reused for subsequent av_buffer_pool_get() calls.
  7956. + *
  7957. + * When the caller is done with the pool and no longer needs to allocate any new
  7958. + * buffers, av_buffer_pool_uninit() must be called to mark the pool as freeable.
  7959. + * Once all the buffers are released, it will automatically be freed.
  7960. + *
  7961. + * Allocating and releasing buffers with this API is thread-safe as long as
  7962. + * either the default alloc callback is used, or the user-supplied one is
  7963. + * thread-safe.
  7964. + */
  7965. +
  7966. +/**
  7967. + * The buffer pool. This structure is opaque and not meant to be accessed
  7968. + * directly. It is allocated with av_buffer_pool_init() and freed with
  7969. + * av_buffer_pool_uninit().
  7970. + */
  7971. +typedef struct AVBufferPool AVBufferPool;
  7972. +
  7973. +/**
  7974. + * Allocate and initialize a buffer pool.
  7975. + *
  7976. + * @param size size of each buffer in this pool
  7977. + * @param alloc a function that will be used to allocate new buffers when the
  7978. + * pool is empty. May be NULL, then the default allocator will be used
  7979. + * (av_buffer_alloc()).
  7980. + * @return newly created buffer pool on success, NULL on error.
  7981. + */
  7982. +AVBufferPool* av_buffer_pool_init(size_t size,
  7983. + AVBufferRef* (*alloc)(size_t size));
  7984. +
  7985. +/**
  7986. + * Allocate and initialize a buffer pool with a more complex allocator.
  7987. + *
  7988. + * @param size size of each buffer in this pool
  7989. + * @param opaque arbitrary user data used by the allocator
  7990. + * @param alloc a function that will be used to allocate new buffers when the
  7991. + * pool is empty. May be NULL, then the default allocator will be
  7992. + * used (av_buffer_alloc()).
  7993. + * @param pool_free a function that will be called immediately before the pool
  7994. + * is freed. I.e. after av_buffer_pool_uninit() is called
  7995. + * by the caller and all the frames are returned to the pool
  7996. + * and freed. It is intended to uninitialize the user opaque
  7997. + * data. May be NULL.
  7998. + * @return newly created buffer pool on success, NULL on error.
  7999. + */
  8000. +AVBufferPool* av_buffer_pool_init2(size_t size, void* opaque,
  8001. + AVBufferRef* (*alloc)(void* opaque,
  8002. + size_t size),
  8003. + void (*pool_free)(void* opaque));
  8004. +
  8005. +/**
  8006. + * Mark the pool as being available for freeing. It will actually be freed only
  8007. + * once all the allocated buffers associated with the pool are released. Thus it
  8008. + * is safe to call this function while some of the allocated buffers are still
  8009. + * in use.
  8010. + *
  8011. + * @param pool pointer to the pool to be freed. It will be set to NULL.
  8012. + */
  8013. +void av_buffer_pool_uninit(AVBufferPool** pool);
  8014. +
  8015. +/**
  8016. + * Allocate a new AVBuffer, reusing an old buffer from the pool when available.
  8017. + * This function may be called simultaneously from multiple threads.
  8018. + *
  8019. + * @return a reference to the new buffer on success, NULL on error.
  8020. + */
  8021. +AVBufferRef* av_buffer_pool_get(AVBufferPool* pool);
  8022. +
  8023. +/**
  8024. + * Query the original opaque parameter of an allocated buffer in the pool.
  8025. + *
  8026. + * @param ref a buffer reference to a buffer returned by av_buffer_pool_get.
  8027. + * @return the opaque parameter set by the buffer allocator function of the
  8028. + * buffer pool.
  8029. + *
  8030. + * @note the opaque parameter of ref is used by the buffer pool implementation,
  8031. + * therefore you have to use this function to access the original opaque
  8032. + * parameter of an allocated buffer.
  8033. + */
  8034. +void* av_buffer_pool_buffer_get_opaque(const AVBufferRef* ref);
  8035. +
  8036. +/**
  8037. + * @}
  8038. + */
  8039. +
  8040. +#endif /* AVUTIL_BUFFER_H */
  8041. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/channel_layout.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/channel_layout.h
  8042. new file mode 100644
  8043. index 00000000..1ce5bb32
  8044. --- /dev/null
  8045. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/channel_layout.h
  8046. @@ -0,0 +1,842 @@
  8047. +/*
  8048. + * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
  8049. + * Copyright (c) 2008 Peter Ross
  8050. + *
  8051. + * This file is part of FFmpeg.
  8052. + *
  8053. + * FFmpeg is free software; you can redistribute it and/or
  8054. + * modify it under the terms of the GNU Lesser General Public
  8055. + * License as published by the Free Software Foundation; either
  8056. + * version 2.1 of the License, or (at your option) any later version.
  8057. + *
  8058. + * FFmpeg is distributed in the hope that it will be useful,
  8059. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8060. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  8061. + * Lesser General Public License for more details.
  8062. + *
  8063. + * You should have received a copy of the GNU Lesser General Public
  8064. + * License along with FFmpeg; if not, write to the Free Software
  8065. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  8066. + */
  8067. +
  8068. +#ifndef AVUTIL_CHANNEL_LAYOUT_H
  8069. +#define AVUTIL_CHANNEL_LAYOUT_H
  8070. +
  8071. +#include <stdint.h>
  8072. +#include <stdlib.h>
  8073. +
  8074. +#include "version.h"
  8075. +#include "attributes.h"
  8076. +
  8077. +/**
  8078. + * @file
  8079. + * @ingroup lavu_audio_channels
  8080. + * Public libavutil channel layout APIs header.
  8081. + */
  8082. +
  8083. +/**
  8084. + * @defgroup lavu_audio_channels Audio channels
  8085. + * @ingroup lavu_audio
  8086. + *
  8087. + * Audio channel layout utility functions
  8088. + *
  8089. + * @{
  8090. + */
  8091. +
  8092. +enum AVChannel {
  8093. + ///< Invalid channel index
  8094. + AV_CHAN_NONE = -1,
  8095. + AV_CHAN_FRONT_LEFT,
  8096. + AV_CHAN_FRONT_RIGHT,
  8097. + AV_CHAN_FRONT_CENTER,
  8098. + AV_CHAN_LOW_FREQUENCY,
  8099. + AV_CHAN_BACK_LEFT,
  8100. + AV_CHAN_BACK_RIGHT,
  8101. + AV_CHAN_FRONT_LEFT_OF_CENTER,
  8102. + AV_CHAN_FRONT_RIGHT_OF_CENTER,
  8103. + AV_CHAN_BACK_CENTER,
  8104. + AV_CHAN_SIDE_LEFT,
  8105. + AV_CHAN_SIDE_RIGHT,
  8106. + AV_CHAN_TOP_CENTER,
  8107. + AV_CHAN_TOP_FRONT_LEFT,
  8108. + AV_CHAN_TOP_FRONT_CENTER,
  8109. + AV_CHAN_TOP_FRONT_RIGHT,
  8110. + AV_CHAN_TOP_BACK_LEFT,
  8111. + AV_CHAN_TOP_BACK_CENTER,
  8112. + AV_CHAN_TOP_BACK_RIGHT,
  8113. + /** Stereo downmix. */
  8114. + AV_CHAN_STEREO_LEFT = 29,
  8115. + /** See above. */
  8116. + AV_CHAN_STEREO_RIGHT,
  8117. + AV_CHAN_WIDE_LEFT,
  8118. + AV_CHAN_WIDE_RIGHT,
  8119. + AV_CHAN_SURROUND_DIRECT_LEFT,
  8120. + AV_CHAN_SURROUND_DIRECT_RIGHT,
  8121. + AV_CHAN_LOW_FREQUENCY_2,
  8122. + AV_CHAN_TOP_SIDE_LEFT,
  8123. + AV_CHAN_TOP_SIDE_RIGHT,
  8124. + AV_CHAN_BOTTOM_FRONT_CENTER,
  8125. + AV_CHAN_BOTTOM_FRONT_LEFT,
  8126. + AV_CHAN_BOTTOM_FRONT_RIGHT,
  8127. +
  8128. + /** Channel is empty can be safely skipped. */
  8129. + AV_CHAN_UNUSED = 0x200,
  8130. +
  8131. + /** Channel contains data, but its position is unknown. */
  8132. + AV_CHAN_UNKNOWN = 0x300,
  8133. +
  8134. + /**
  8135. + * Range of channels between AV_CHAN_AMBISONIC_BASE and
  8136. + * AV_CHAN_AMBISONIC_END represent Ambisonic components using the ACN system.
  8137. + *
  8138. + * Given a channel id `<i>` between AV_CHAN_AMBISONIC_BASE and
  8139. + * AV_CHAN_AMBISONIC_END (inclusive), the ACN index of the channel `<n>` is
  8140. + * `<n> = <i> - AV_CHAN_AMBISONIC_BASE`.
  8141. + *
  8142. + * @note these values are only used for AV_CHANNEL_ORDER_CUSTOM channel
  8143. + * orderings, the AV_CHANNEL_ORDER_AMBISONIC ordering orders the channels
  8144. + * implicitly by their position in the stream.
  8145. + */
  8146. + AV_CHAN_AMBISONIC_BASE = 0x400,
  8147. + // leave space for 1024 ids, which correspond to maximum order-32 harmonics,
  8148. + // which should be enough for the foreseeable use cases
  8149. + AV_CHAN_AMBISONIC_END = 0x7ff,
  8150. +};
  8151. +
  8152. +enum AVChannelOrder {
  8153. + /**
  8154. + * Only the channel count is specified, without any further information
  8155. + * about the channel order.
  8156. + */
  8157. + AV_CHANNEL_ORDER_UNSPEC,
  8158. + /**
  8159. + * The native channel order, i.e. the channels are in the same order in
  8160. + * which they are defined in the AVChannel enum. This supports up to 63
  8161. + * different channels.
  8162. + */
  8163. + AV_CHANNEL_ORDER_NATIVE,
  8164. + /**
  8165. + * The channel order does not correspond to any other predefined order and
  8166. + * is stored as an explicit map. For example, this could be used to support
  8167. + * layouts with 64 or more channels, or with empty/skipped (AV_CHAN_SILENCE)
  8168. + * channels at arbitrary positions.
  8169. + */
  8170. + AV_CHANNEL_ORDER_CUSTOM,
  8171. + /**
  8172. + * The audio is represented as the decomposition of the sound field into
  8173. + * spherical harmonics. Each channel corresponds to a single expansion
  8174. + * component. Channels are ordered according to ACN (Ambisonic Channel
  8175. + * Number).
  8176. + *
  8177. + * The channel with the index n in the stream contains the spherical
  8178. + * harmonic of degree l and order m given by
  8179. + * @code{.unparsed}
  8180. + * l = floor(sqrt(n)),
  8181. + * m = n - l * (l + 1).
  8182. + * @endcode
  8183. + *
  8184. + * Conversely given a spherical harmonic of degree l and order m, the
  8185. + * corresponding channel index n is given by
  8186. + * @code{.unparsed}
  8187. + * n = l * (l + 1) + m.
  8188. + * @endcode
  8189. + *
  8190. + * Normalization is assumed to be SN3D (Schmidt Semi-Normalization)
  8191. + * as defined in AmbiX format $ 2.1.
  8192. + */
  8193. + AV_CHANNEL_ORDER_AMBISONIC,
  8194. +};
  8195. +
  8196. +/**
  8197. + * @defgroup channel_masks Audio channel masks
  8198. + *
  8199. + * A channel layout is a 64-bits integer with a bit set for every channel.
  8200. + * The number of bits set must be equal to the number of channels.
  8201. + * The value 0 means that the channel layout is not known.
  8202. + * @note this data structure is not powerful enough to handle channels
  8203. + * combinations that have the same channel multiple times, such as
  8204. + * dual-mono.
  8205. + *
  8206. + * @{
  8207. + */
  8208. +#define AV_CH_FRONT_LEFT (1ULL << AV_CHAN_FRONT_LEFT)
  8209. +#define AV_CH_FRONT_RIGHT (1ULL << AV_CHAN_FRONT_RIGHT)
  8210. +#define AV_CH_FRONT_CENTER (1ULL << AV_CHAN_FRONT_CENTER)
  8211. +#define AV_CH_LOW_FREQUENCY (1ULL << AV_CHAN_LOW_FREQUENCY)
  8212. +#define AV_CH_BACK_LEFT (1ULL << AV_CHAN_BACK_LEFT)
  8213. +#define AV_CH_BACK_RIGHT (1ULL << AV_CHAN_BACK_RIGHT)
  8214. +#define AV_CH_FRONT_LEFT_OF_CENTER (1ULL << AV_CHAN_FRONT_LEFT_OF_CENTER)
  8215. +#define AV_CH_FRONT_RIGHT_OF_CENTER (1ULL << AV_CHAN_FRONT_RIGHT_OF_CENTER)
  8216. +#define AV_CH_BACK_CENTER (1ULL << AV_CHAN_BACK_CENTER)
  8217. +#define AV_CH_SIDE_LEFT (1ULL << AV_CHAN_SIDE_LEFT)
  8218. +#define AV_CH_SIDE_RIGHT (1ULL << AV_CHAN_SIDE_RIGHT)
  8219. +#define AV_CH_TOP_CENTER (1ULL << AV_CHAN_TOP_CENTER)
  8220. +#define AV_CH_TOP_FRONT_LEFT (1ULL << AV_CHAN_TOP_FRONT_LEFT)
  8221. +#define AV_CH_TOP_FRONT_CENTER (1ULL << AV_CHAN_TOP_FRONT_CENTER)
  8222. +#define AV_CH_TOP_FRONT_RIGHT (1ULL << AV_CHAN_TOP_FRONT_RIGHT)
  8223. +#define AV_CH_TOP_BACK_LEFT (1ULL << AV_CHAN_TOP_BACK_LEFT)
  8224. +#define AV_CH_TOP_BACK_CENTER (1ULL << AV_CHAN_TOP_BACK_CENTER)
  8225. +#define AV_CH_TOP_BACK_RIGHT (1ULL << AV_CHAN_TOP_BACK_RIGHT)
  8226. +#define AV_CH_STEREO_LEFT (1ULL << AV_CHAN_STEREO_LEFT)
  8227. +#define AV_CH_STEREO_RIGHT (1ULL << AV_CHAN_STEREO_RIGHT)
  8228. +#define AV_CH_WIDE_LEFT (1ULL << AV_CHAN_WIDE_LEFT)
  8229. +#define AV_CH_WIDE_RIGHT (1ULL << AV_CHAN_WIDE_RIGHT)
  8230. +#define AV_CH_SURROUND_DIRECT_LEFT (1ULL << AV_CHAN_SURROUND_DIRECT_LEFT)
  8231. +#define AV_CH_SURROUND_DIRECT_RIGHT (1ULL << AV_CHAN_SURROUND_DIRECT_RIGHT)
  8232. +#define AV_CH_LOW_FREQUENCY_2 (1ULL << AV_CHAN_LOW_FREQUENCY_2)
  8233. +#define AV_CH_TOP_SIDE_LEFT (1ULL << AV_CHAN_TOP_SIDE_LEFT)
  8234. +#define AV_CH_TOP_SIDE_RIGHT (1ULL << AV_CHAN_TOP_SIDE_RIGHT)
  8235. +#define AV_CH_BOTTOM_FRONT_CENTER (1ULL << AV_CHAN_BOTTOM_FRONT_CENTER)
  8236. +#define AV_CH_BOTTOM_FRONT_LEFT (1ULL << AV_CHAN_BOTTOM_FRONT_LEFT)
  8237. +#define AV_CH_BOTTOM_FRONT_RIGHT (1ULL << AV_CHAN_BOTTOM_FRONT_RIGHT)
  8238. +
  8239. +#if FF_API_OLD_CHANNEL_LAYOUT
  8240. +/** Channel mask value used for AVCodecContext.request_channel_layout
  8241. + to indicate that the user requests the channel order of the decoder output
  8242. + to be the native codec channel order.
  8243. + @deprecated channel order is now indicated in a special field in
  8244. + AVChannelLayout
  8245. + */
  8246. +# define AV_CH_LAYOUT_NATIVE 0x8000000000000000ULL
  8247. +#endif
  8248. +
  8249. +/**
  8250. + * @}
  8251. + * @defgroup channel_mask_c Audio channel layouts
  8252. + * @{
  8253. + * */
  8254. +#define AV_CH_LAYOUT_MONO (AV_CH_FRONT_CENTER)
  8255. +#define AV_CH_LAYOUT_STEREO (AV_CH_FRONT_LEFT | AV_CH_FRONT_RIGHT)
  8256. +#define AV_CH_LAYOUT_2POINT1 (AV_CH_LAYOUT_STEREO | AV_CH_LOW_FREQUENCY)
  8257. +#define AV_CH_LAYOUT_2_1 (AV_CH_LAYOUT_STEREO | AV_CH_BACK_CENTER)
  8258. +#define AV_CH_LAYOUT_SURROUND (AV_CH_LAYOUT_STEREO | AV_CH_FRONT_CENTER)
  8259. +#define AV_CH_LAYOUT_3POINT1 (AV_CH_LAYOUT_SURROUND | AV_CH_LOW_FREQUENCY)
  8260. +#define AV_CH_LAYOUT_4POINT0 (AV_CH_LAYOUT_SURROUND | AV_CH_BACK_CENTER)
  8261. +#define AV_CH_LAYOUT_4POINT1 (AV_CH_LAYOUT_4POINT0 | AV_CH_LOW_FREQUENCY)
  8262. +#define AV_CH_LAYOUT_2_2 \
  8263. + (AV_CH_LAYOUT_STEREO | AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT)
  8264. +#define AV_CH_LAYOUT_QUAD \
  8265. + (AV_CH_LAYOUT_STEREO | AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT)
  8266. +#define AV_CH_LAYOUT_5POINT0 \
  8267. + (AV_CH_LAYOUT_SURROUND | AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT)
  8268. +#define AV_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT0 | AV_CH_LOW_FREQUENCY)
  8269. +#define AV_CH_LAYOUT_5POINT0_BACK \
  8270. + (AV_CH_LAYOUT_SURROUND | AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT)
  8271. +#define AV_CH_LAYOUT_5POINT1_BACK \
  8272. + (AV_CH_LAYOUT_5POINT0_BACK | AV_CH_LOW_FREQUENCY)
  8273. +#define AV_CH_LAYOUT_6POINT0 (AV_CH_LAYOUT_5POINT0 | AV_CH_BACK_CENTER)
  8274. +#define AV_CH_LAYOUT_6POINT0_FRONT \
  8275. + (AV_CH_LAYOUT_2_2 | AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER)
  8276. +#define AV_CH_LAYOUT_HEXAGONAL (AV_CH_LAYOUT_5POINT0_BACK | AV_CH_BACK_CENTER)
  8277. +#define AV_CH_LAYOUT_6POINT1 (AV_CH_LAYOUT_5POINT1 | AV_CH_BACK_CENTER)
  8278. +#define AV_CH_LAYOUT_6POINT1_BACK \
  8279. + (AV_CH_LAYOUT_5POINT1_BACK | AV_CH_BACK_CENTER)
  8280. +#define AV_CH_LAYOUT_6POINT1_FRONT \
  8281. + (AV_CH_LAYOUT_6POINT0_FRONT | AV_CH_LOW_FREQUENCY)
  8282. +#define AV_CH_LAYOUT_7POINT0 \
  8283. + (AV_CH_LAYOUT_5POINT0 | AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT)
  8284. +#define AV_CH_LAYOUT_7POINT0_FRONT \
  8285. + (AV_CH_LAYOUT_5POINT0 | AV_CH_FRONT_LEFT_OF_CENTER | \
  8286. + AV_CH_FRONT_RIGHT_OF_CENTER)
  8287. +#define AV_CH_LAYOUT_7POINT1 \
  8288. + (AV_CH_LAYOUT_5POINT1 | AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT)
  8289. +#define AV_CH_LAYOUT_7POINT1_WIDE \
  8290. + (AV_CH_LAYOUT_5POINT1 | AV_CH_FRONT_LEFT_OF_CENTER | \
  8291. + AV_CH_FRONT_RIGHT_OF_CENTER)
  8292. +#define AV_CH_LAYOUT_7POINT1_WIDE_BACK \
  8293. + (AV_CH_LAYOUT_5POINT1_BACK | AV_CH_FRONT_LEFT_OF_CENTER | \
  8294. + AV_CH_FRONT_RIGHT_OF_CENTER)
  8295. +#define AV_CH_LAYOUT_7POINT1_TOP_BACK \
  8296. + (AV_CH_LAYOUT_5POINT1_BACK | AV_CH_TOP_FRONT_LEFT | AV_CH_TOP_FRONT_RIGHT)
  8297. +#define AV_CH_LAYOUT_OCTAGONAL \
  8298. + (AV_CH_LAYOUT_5POINT0 | AV_CH_BACK_LEFT | AV_CH_BACK_CENTER | \
  8299. + AV_CH_BACK_RIGHT)
  8300. +#define AV_CH_LAYOUT_CUBE \
  8301. + (AV_CH_LAYOUT_QUAD | AV_CH_TOP_FRONT_LEFT | AV_CH_TOP_FRONT_RIGHT | \
  8302. + AV_CH_TOP_BACK_LEFT | AV_CH_TOP_BACK_RIGHT)
  8303. +#define AV_CH_LAYOUT_HEXADECAGONAL \
  8304. + (AV_CH_LAYOUT_OCTAGONAL | AV_CH_WIDE_LEFT | AV_CH_WIDE_RIGHT | \
  8305. + AV_CH_TOP_BACK_LEFT | AV_CH_TOP_BACK_RIGHT | AV_CH_TOP_BACK_CENTER | \
  8306. + AV_CH_TOP_FRONT_CENTER | AV_CH_TOP_FRONT_LEFT | AV_CH_TOP_FRONT_RIGHT)
  8307. +#define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT | AV_CH_STEREO_RIGHT)
  8308. +#define AV_CH_LAYOUT_22POINT2 \
  8309. + (AV_CH_LAYOUT_5POINT1_BACK | AV_CH_FRONT_LEFT_OF_CENTER | \
  8310. + AV_CH_FRONT_RIGHT_OF_CENTER | AV_CH_BACK_CENTER | AV_CH_LOW_FREQUENCY_2 | \
  8311. + AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT | AV_CH_TOP_FRONT_LEFT | \
  8312. + AV_CH_TOP_FRONT_RIGHT | AV_CH_TOP_FRONT_CENTER | AV_CH_TOP_CENTER | \
  8313. + AV_CH_TOP_BACK_LEFT | AV_CH_TOP_BACK_RIGHT | AV_CH_TOP_SIDE_LEFT | \
  8314. + AV_CH_TOP_SIDE_RIGHT | AV_CH_TOP_BACK_CENTER | AV_CH_BOTTOM_FRONT_CENTER | \
  8315. + AV_CH_BOTTOM_FRONT_LEFT | AV_CH_BOTTOM_FRONT_RIGHT)
  8316. +
  8317. +enum AVMatrixEncoding {
  8318. + AV_MATRIX_ENCODING_NONE,
  8319. + AV_MATRIX_ENCODING_DOLBY,
  8320. + AV_MATRIX_ENCODING_DPLII,
  8321. + AV_MATRIX_ENCODING_DPLIIX,
  8322. + AV_MATRIX_ENCODING_DPLIIZ,
  8323. + AV_MATRIX_ENCODING_DOLBYEX,
  8324. + AV_MATRIX_ENCODING_DOLBYHEADPHONE,
  8325. + AV_MATRIX_ENCODING_NB
  8326. +};
  8327. +
  8328. +/**
  8329. + * @}
  8330. + */
  8331. +
  8332. +/**
  8333. + * An AVChannelCustom defines a single channel within a custom order layout
  8334. + *
  8335. + * Unlike most structures in FFmpeg, sizeof(AVChannelCustom) is a part of the
  8336. + * public ABI.
  8337. + *
  8338. + * No new fields may be added to it without a major version bump.
  8339. + */
  8340. +typedef struct AVChannelCustom {
  8341. + enum AVChannel id;
  8342. + char name[16];
  8343. + void* opaque;
  8344. +} AVChannelCustom;
  8345. +
  8346. +/**
  8347. + * An AVChannelLayout holds information about the channel layout of audio data.
  8348. + *
  8349. + * A channel layout here is defined as a set of channels ordered in a specific
  8350. + * way (unless the channel order is AV_CHANNEL_ORDER_UNSPEC, in which case an
  8351. + * AVChannelLayout carries only the channel count).
  8352. + * All orders may be treated as if they were AV_CHANNEL_ORDER_UNSPEC by
  8353. + * ignoring everything but the channel count, as long as
  8354. + * av_channel_layout_check() considers they are valid.
  8355. + *
  8356. + * Unlike most structures in FFmpeg, sizeof(AVChannelLayout) is a part of the
  8357. + * public ABI and may be used by the caller. E.g. it may be allocated on stack
  8358. + * or embedded in caller-defined structs.
  8359. + *
  8360. + * AVChannelLayout can be initialized as follows:
  8361. + * - default initialization with {0}, followed by setting all used fields
  8362. + * correctly;
  8363. + * - by assigning one of the predefined AV_CHANNEL_LAYOUT_* initializers;
  8364. + * - with a constructor function, such as av_channel_layout_default(),
  8365. + * av_channel_layout_from_mask() or av_channel_layout_from_string().
  8366. + *
  8367. + * The channel layout must be unitialized with av_channel_layout_uninit()
  8368. + *
  8369. + * Copying an AVChannelLayout via assigning is forbidden,
  8370. + * av_channel_layout_copy() must be used instead (and its return value should
  8371. + * be checked)
  8372. + *
  8373. + * No new fields may be added to it without a major version bump, except for
  8374. + * new elements of the union fitting in sizeof(uint64_t).
  8375. + */
  8376. +typedef struct AVChannelLayout {
  8377. + /**
  8378. + * Channel order used in this layout.
  8379. + * This is a mandatory field.
  8380. + */
  8381. + enum AVChannelOrder order;
  8382. +
  8383. + /**
  8384. + * Number of channels in this layout. Mandatory field.
  8385. + */
  8386. + int nb_channels;
  8387. +
  8388. + /**
  8389. + * Details about which channels are present in this layout.
  8390. + * For AV_CHANNEL_ORDER_UNSPEC, this field is undefined and must not be
  8391. + * used.
  8392. + */
  8393. + union {
  8394. + /**
  8395. + * This member must be used for AV_CHANNEL_ORDER_NATIVE, and may be used
  8396. + * for AV_CHANNEL_ORDER_AMBISONIC to signal non-diegetic channels.
  8397. + * It is a bitmask, where the position of each set bit means that the
  8398. + * AVChannel with the corresponding value is present.
  8399. + *
  8400. + * I.e. when (mask & (1 << AV_CHAN_FOO)) is non-zero, then AV_CHAN_FOO
  8401. + * is present in the layout. Otherwise it is not present.
  8402. + *
  8403. + * @note when a channel layout using a bitmask is constructed or
  8404. + * modified manually (i.e. not using any of the av_channel_layout_*
  8405. + * functions), the code doing it must ensure that the number of set bits
  8406. + * is equal to nb_channels.
  8407. + */
  8408. + uint64_t mask;
  8409. + /**
  8410. + * This member must be used when the channel order is
  8411. + * AV_CHANNEL_ORDER_CUSTOM. It is a nb_channels-sized array, with each
  8412. + * element signalling the presence of the AVChannel with the
  8413. + * corresponding value in map[i].id.
  8414. + *
  8415. + * I.e. when map[i].id is equal to AV_CHAN_FOO, then AV_CH_FOO is the
  8416. + * i-th channel in the audio data.
  8417. + *
  8418. + * When map[i].id is in the range between AV_CHAN_AMBISONIC_BASE and
  8419. + * AV_CHAN_AMBISONIC_END (inclusive), the channel contains an ambisonic
  8420. + * component with ACN index (as defined above)
  8421. + * n = map[i].id - AV_CHAN_AMBISONIC_BASE.
  8422. + *
  8423. + * map[i].name may be filled with a 0-terminated string, in which case
  8424. + * it will be used for the purpose of identifying the channel with the
  8425. + * convenience functions below. Otherise it must be zeroed.
  8426. + */
  8427. + AVChannelCustom* map;
  8428. + } u;
  8429. +
  8430. + /**
  8431. + * For some private data of the user.
  8432. + */
  8433. + void* opaque;
  8434. +} AVChannelLayout;
  8435. +
  8436. +#define AV_CHANNEL_LAYOUT_MASK(nb, m) \
  8437. + { \
  8438. + .order = AV_CHANNEL_ORDER_NATIVE, .nb_channels = (nb), .u = {.mask = (m) } \
  8439. + }
  8440. +
  8441. +/**
  8442. + * @name Common pre-defined channel layouts
  8443. + * @{
  8444. + */
  8445. +#define AV_CHANNEL_LAYOUT_MONO AV_CHANNEL_LAYOUT_MASK(1, AV_CH_LAYOUT_MONO)
  8446. +#define AV_CHANNEL_LAYOUT_STEREO AV_CHANNEL_LAYOUT_MASK(2, AV_CH_LAYOUT_STEREO)
  8447. +#define AV_CHANNEL_LAYOUT_2POINT1 \
  8448. + AV_CHANNEL_LAYOUT_MASK(3, AV_CH_LAYOUT_2POINT1)
  8449. +#define AV_CHANNEL_LAYOUT_2_1 AV_CHANNEL_LAYOUT_MASK(3, AV_CH_LAYOUT_2_1)
  8450. +#define AV_CHANNEL_LAYOUT_SURROUND \
  8451. + AV_CHANNEL_LAYOUT_MASK(3, AV_CH_LAYOUT_SURROUND)
  8452. +#define AV_CHANNEL_LAYOUT_3POINT1 \
  8453. + AV_CHANNEL_LAYOUT_MASK(4, AV_CH_LAYOUT_3POINT1)
  8454. +#define AV_CHANNEL_LAYOUT_4POINT0 \
  8455. + AV_CHANNEL_LAYOUT_MASK(4, AV_CH_LAYOUT_4POINT0)
  8456. +#define AV_CHANNEL_LAYOUT_4POINT1 \
  8457. + AV_CHANNEL_LAYOUT_MASK(5, AV_CH_LAYOUT_4POINT1)
  8458. +#define AV_CHANNEL_LAYOUT_2_2 AV_CHANNEL_LAYOUT_MASK(4, AV_CH_LAYOUT_2_2)
  8459. +#define AV_CHANNEL_LAYOUT_QUAD AV_CHANNEL_LAYOUT_MASK(4, AV_CH_LAYOUT_QUAD)
  8460. +#define AV_CHANNEL_LAYOUT_5POINT0 \
  8461. + AV_CHANNEL_LAYOUT_MASK(5, AV_CH_LAYOUT_5POINT0)
  8462. +#define AV_CHANNEL_LAYOUT_5POINT1 \
  8463. + AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_5POINT1)
  8464. +#define AV_CHANNEL_LAYOUT_5POINT0_BACK \
  8465. + AV_CHANNEL_LAYOUT_MASK(5, AV_CH_LAYOUT_5POINT0_BACK)
  8466. +#define AV_CHANNEL_LAYOUT_5POINT1_BACK \
  8467. + AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_5POINT1_BACK)
  8468. +#define AV_CHANNEL_LAYOUT_6POINT0 \
  8469. + AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_6POINT0)
  8470. +#define AV_CHANNEL_LAYOUT_6POINT0_FRONT \
  8471. + AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_6POINT0_FRONT)
  8472. +#define AV_CHANNEL_LAYOUT_HEXAGONAL \
  8473. + AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_HEXAGONAL)
  8474. +#define AV_CHANNEL_LAYOUT_6POINT1 \
  8475. + AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_6POINT1)
  8476. +#define AV_CHANNEL_LAYOUT_6POINT1_BACK \
  8477. + AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_6POINT1_BACK)
  8478. +#define AV_CHANNEL_LAYOUT_6POINT1_FRONT \
  8479. + AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_6POINT1_FRONT)
  8480. +#define AV_CHANNEL_LAYOUT_7POINT0 \
  8481. + AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_7POINT0)
  8482. +#define AV_CHANNEL_LAYOUT_7POINT0_FRONT \
  8483. + AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_7POINT0_FRONT)
  8484. +#define AV_CHANNEL_LAYOUT_7POINT1 \
  8485. + AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1)
  8486. +#define AV_CHANNEL_LAYOUT_7POINT1_WIDE \
  8487. + AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_WIDE)
  8488. +#define AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK \
  8489. + AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_WIDE_BACK)
  8490. +#define AV_CHANNEL_LAYOUT_7POINT1_TOP_BACK \
  8491. + AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_TOP_BACK)
  8492. +#define AV_CHANNEL_LAYOUT_OCTAGONAL \
  8493. + AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_OCTAGONAL)
  8494. +#define AV_CHANNEL_LAYOUT_CUBE AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_CUBE)
  8495. +#define AV_CHANNEL_LAYOUT_HEXADECAGONAL \
  8496. + AV_CHANNEL_LAYOUT_MASK(16, AV_CH_LAYOUT_HEXADECAGONAL)
  8497. +#define AV_CHANNEL_LAYOUT_STEREO_DOWNMIX \
  8498. + AV_CHANNEL_LAYOUT_MASK(2, AV_CH_LAYOUT_STEREO_DOWNMIX)
  8499. +#define AV_CHANNEL_LAYOUT_22POINT2 \
  8500. + AV_CHANNEL_LAYOUT_MASK(24, AV_CH_LAYOUT_22POINT2)
  8501. +#define AV_CHANNEL_LAYOUT_AMBISONIC_FIRST_ORDER \
  8502. + { \
  8503. + .order = AV_CHANNEL_ORDER_AMBISONIC, .nb_channels = 4, .u = {.mask = 0 } \
  8504. + }
  8505. +/** @} */
  8506. +
  8507. +struct AVBPrint;
  8508. +
  8509. +#if FF_API_OLD_CHANNEL_LAYOUT
  8510. +/**
  8511. + * @name Deprecated Functions
  8512. + * @{
  8513. + */
  8514. +
  8515. +/**
  8516. + * Return a channel layout id that matches name, or 0 if no match is found.
  8517. + *
  8518. + * name can be one or several of the following notations,
  8519. + * separated by '+' or '|':
  8520. + * - the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0,
  8521. + * 5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix);
  8522. + * - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC,
  8523. + * SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR);
  8524. + * - a number of channels, in decimal, followed by 'c', yielding
  8525. + * the default channel layout for that number of channels (@see
  8526. + * av_get_default_channel_layout);
  8527. + * - a channel layout mask, in hexadecimal starting with "0x" (see the
  8528. + * AV_CH_* macros).
  8529. + *
  8530. + * Example: "stereo+FC" = "2c+FC" = "2c+1c" = "0x7"
  8531. + *
  8532. + * @deprecated use av_channel_layout_from_string()
  8533. + */
  8534. +attribute_deprecated uint64_t av_get_channel_layout(const char* name);
  8535. +
  8536. +/**
  8537. + * Return a channel layout and the number of channels based on the specified
  8538. + * name.
  8539. + *
  8540. + * This function is similar to (@see av_get_channel_layout), but can also parse
  8541. + * unknown channel layout specifications.
  8542. + *
  8543. + * @param[in] name channel layout specification string
  8544. + * @param[out] channel_layout parsed channel layout (0 if unknown)
  8545. + * @param[out] nb_channels number of channels
  8546. + *
  8547. + * @return 0 on success, AVERROR(EINVAL) if the parsing fails.
  8548. + * @deprecated use av_channel_layout_from_string()
  8549. + */
  8550. +attribute_deprecated int av_get_extended_channel_layout(
  8551. + const char* name, uint64_t* channel_layout, int* nb_channels);
  8552. +
  8553. +/**
  8554. + * Return a description of a channel layout.
  8555. + * If nb_channels is <= 0, it is guessed from the channel_layout.
  8556. + *
  8557. + * @param buf put here the string containing the channel layout
  8558. + * @param buf_size size in bytes of the buffer
  8559. + * @param nb_channels number of channels
  8560. + * @param channel_layout channel layout bitset
  8561. + * @deprecated use av_channel_layout_describe()
  8562. + */
  8563. +attribute_deprecated void av_get_channel_layout_string(char* buf, int buf_size,
  8564. + int nb_channels,
  8565. + uint64_t channel_layout);
  8566. +
  8567. +/**
  8568. + * Append a description of a channel layout to a bprint buffer.
  8569. + * @deprecated use av_channel_layout_describe()
  8570. + */
  8571. +attribute_deprecated void av_bprint_channel_layout(struct AVBPrint* bp,
  8572. + int nb_channels,
  8573. + uint64_t channel_layout);
  8574. +
  8575. +/**
  8576. + * Return the number of channels in the channel layout.
  8577. + * @deprecated use AVChannelLayout.nb_channels
  8578. + */
  8579. +attribute_deprecated int av_get_channel_layout_nb_channels(
  8580. + uint64_t channel_layout);
  8581. +
  8582. +/**
  8583. + * Return default channel layout for a given number of channels.
  8584. + *
  8585. + * @deprecated use av_channel_layout_default()
  8586. + */
  8587. +attribute_deprecated int64_t av_get_default_channel_layout(int nb_channels);
  8588. +
  8589. +/**
  8590. + * Get the index of a channel in channel_layout.
  8591. + *
  8592. + * @param channel_layout channel layout bitset
  8593. + * @param channel a channel layout describing exactly one channel which must be
  8594. + * present in channel_layout.
  8595. + *
  8596. + * @return index of channel in channel_layout on success, a negative AVERROR
  8597. + * on error.
  8598. + *
  8599. + * @deprecated use av_channel_layout_index_from_channel()
  8600. + */
  8601. +attribute_deprecated int av_get_channel_layout_channel_index(
  8602. + uint64_t channel_layout, uint64_t channel);
  8603. +
  8604. +/**
  8605. + * Get the channel with the given index in channel_layout.
  8606. + * @deprecated use av_channel_layout_channel_from_index()
  8607. + */
  8608. +attribute_deprecated uint64_t
  8609. +av_channel_layout_extract_channel(uint64_t channel_layout, int index);
  8610. +
  8611. +/**
  8612. + * Get the name of a given channel.
  8613. + *
  8614. + * @return channel name on success, NULL on error.
  8615. + *
  8616. + * @deprecated use av_channel_name()
  8617. + */
  8618. +attribute_deprecated const char* av_get_channel_name(uint64_t channel);
  8619. +
  8620. +/**
  8621. + * Get the description of a given channel.
  8622. + *
  8623. + * @param channel a channel layout with a single channel
  8624. + * @return channel description on success, NULL on error
  8625. + * @deprecated use av_channel_description()
  8626. + */
  8627. +attribute_deprecated const char* av_get_channel_description(uint64_t channel);
  8628. +
  8629. +/**
  8630. + * Get the value and name of a standard channel layout.
  8631. + *
  8632. + * @param[in] index index in an internal list, starting at 0
  8633. + * @param[out] layout channel layout mask
  8634. + * @param[out] name name of the layout
  8635. + * @return 0 if the layout exists,
  8636. + * <0 if index is beyond the limits
  8637. + * @deprecated use av_channel_layout_standard()
  8638. + */
  8639. +attribute_deprecated int av_get_standard_channel_layout(unsigned index,
  8640. + uint64_t* layout,
  8641. + const char** name);
  8642. +/**
  8643. + * @}
  8644. + */
  8645. +#endif
  8646. +
  8647. +/**
  8648. + * Get a human readable string in an abbreviated form describing a given
  8649. + * channel. This is the inverse function of @ref av_channel_from_string().
  8650. + *
  8651. + * @param buf pre-allocated buffer where to put the generated string
  8652. + * @param buf_size size in bytes of the buffer.
  8653. + * @param channel the AVChannel whose name to get
  8654. + * @return amount of bytes needed to hold the output string, or a negative
  8655. + * AVERROR on failure. If the returned value is bigger than buf_size, then the
  8656. + * string was truncated.
  8657. + */
  8658. +int av_channel_name(char* buf, size_t buf_size, enum AVChannel channel);
  8659. +
  8660. +/**
  8661. + * bprint variant of av_channel_name().
  8662. + *
  8663. + * @note the string will be appended to the bprint buffer.
  8664. + */
  8665. +void av_channel_name_bprint(struct AVBPrint* bp, enum AVChannel channel_id);
  8666. +
  8667. +/**
  8668. + * Get a human readable string describing a given channel.
  8669. + *
  8670. + * @param buf pre-allocated buffer where to put the generated string
  8671. + * @param buf_size size in bytes of the buffer.
  8672. + * @param channel the AVChannel whose description to get
  8673. + * @return amount of bytes needed to hold the output string, or a negative
  8674. + * AVERROR on failure. If the returned value is bigger than buf_size, then the
  8675. + * string was truncated.
  8676. + */
  8677. +int av_channel_description(char* buf, size_t buf_size, enum AVChannel channel);
  8678. +
  8679. +/**
  8680. + * bprint variant of av_channel_description().
  8681. + *
  8682. + * @note the string will be appended to the bprint buffer.
  8683. + */
  8684. +void av_channel_description_bprint(struct AVBPrint* bp,
  8685. + enum AVChannel channel_id);
  8686. +
  8687. +/**
  8688. + * This is the inverse function of @ref av_channel_name().
  8689. + *
  8690. + * @return the channel with the given name
  8691. + * AV_CHAN_NONE when name does not identify a known channel
  8692. + */
  8693. +enum AVChannel av_channel_from_string(const char* name);
  8694. +
  8695. +/**
  8696. + * Initialize a native channel layout from a bitmask indicating which channels
  8697. + * are present.
  8698. + *
  8699. + * @param channel_layout the layout structure to be initialized
  8700. + * @param mask bitmask describing the channel layout
  8701. + *
  8702. + * @return 0 on success
  8703. + * AVERROR(EINVAL) for invalid mask values
  8704. + */
  8705. +int av_channel_layout_from_mask(AVChannelLayout* channel_layout, uint64_t mask);
  8706. +
  8707. +/**
  8708. + * Initialize a channel layout from a given string description.
  8709. + * The input string can be represented by:
  8710. + * - the formal channel layout name (returned by av_channel_layout_describe())
  8711. + * - single or multiple channel names (returned by av_channel_name(), eg. "FL",
  8712. + * or concatenated with "+", each optionally containing a custom name after
  8713. + * a "@", eg. "FL@Left+FR@Right+LFE")
  8714. + * - a decimal or hexadecimal value of a native channel layout (eg. "4" or
  8715. + * "0x4")
  8716. + * - the number of channels with default layout (eg. "4c")
  8717. + * - the number of unordered channels (eg. "4C" or "4 channels")
  8718. + * - the ambisonic order followed by optional non-diegetic channels (eg.
  8719. + * "ambisonic 2+stereo")
  8720. + *
  8721. + * @param channel_layout input channel layout
  8722. + * @param str string describing the channel layout
  8723. + * @return 0 channel layout was detected, AVERROR_INVALIDATATA otherwise
  8724. + */
  8725. +int av_channel_layout_from_string(AVChannelLayout* channel_layout,
  8726. + const char* str);
  8727. +
  8728. +/**
  8729. + * Get the default channel layout for a given number of channels.
  8730. + *
  8731. + * @param ch_layout the layout structure to be initialized
  8732. + * @param nb_channels number of channels
  8733. + */
  8734. +void av_channel_layout_default(AVChannelLayout* ch_layout, int nb_channels);
  8735. +
  8736. +/**
  8737. + * Iterate over all standard channel layouts.
  8738. + *
  8739. + * @param opaque a pointer where libavutil will store the iteration state. Must
  8740. + * point to NULL to start the iteration.
  8741. + *
  8742. + * @return the standard channel layout or NULL when the iteration is
  8743. + * finished
  8744. + */
  8745. +const AVChannelLayout* av_channel_layout_standard(void** opaque);
  8746. +
  8747. +/**
  8748. + * Free any allocated data in the channel layout and reset the channel
  8749. + * count to 0.
  8750. + *
  8751. + * @param channel_layout the layout structure to be uninitialized
  8752. + */
  8753. +void av_channel_layout_uninit(AVChannelLayout* channel_layout);
  8754. +
  8755. +/**
  8756. + * Make a copy of a channel layout. This differs from just assigning src to dst
  8757. + * in that it allocates and copies the map for AV_CHANNEL_ORDER_CUSTOM.
  8758. + *
  8759. + * @note the destination channel_layout will be always uninitialized before
  8760. + * copy.
  8761. + *
  8762. + * @param dst destination channel layout
  8763. + * @param src source channel layout
  8764. + * @return 0 on success, a negative AVERROR on error.
  8765. + */
  8766. +int av_channel_layout_copy(AVChannelLayout* dst, const AVChannelLayout* src);
  8767. +
  8768. +/**
  8769. + * Get a human-readable string describing the channel layout properties.
  8770. + * The string will be in the same format that is accepted by
  8771. + * @ref av_channel_layout_from_string(), allowing to rebuild the same
  8772. + * channel layout, except for opaque pointers.
  8773. + *
  8774. + * @param channel_layout channel layout to be described
  8775. + * @param buf pre-allocated buffer where to put the generated string
  8776. + * @param buf_size size in bytes of the buffer.
  8777. + * @return amount of bytes needed to hold the output string, or a negative
  8778. + * AVERROR on failure. If the returned value is bigger than buf_size, then the
  8779. + * string was truncated.
  8780. + */
  8781. +int av_channel_layout_describe(const AVChannelLayout* channel_layout, char* buf,
  8782. + size_t buf_size);
  8783. +
  8784. +/**
  8785. + * bprint variant of av_channel_layout_describe().
  8786. + *
  8787. + * @note the string will be appended to the bprint buffer.
  8788. + * @return 0 on success, or a negative AVERROR value on failure.
  8789. + */
  8790. +int av_channel_layout_describe_bprint(const AVChannelLayout* channel_layout,
  8791. + struct AVBPrint* bp);
  8792. +
  8793. +/**
  8794. + * Get the channel with the given index in a channel layout.
  8795. + *
  8796. + * @param channel_layout input channel layout
  8797. + * @param idx index of the channel
  8798. + * @return channel with the index idx in channel_layout on success or
  8799. + * AV_CHAN_NONE on failure (if idx is not valid or the channel order is
  8800. + * unspecified)
  8801. + */
  8802. +enum AVChannel av_channel_layout_channel_from_index(
  8803. + const AVChannelLayout* channel_layout, unsigned int idx);
  8804. +
  8805. +/**
  8806. + * Get the index of a given channel in a channel layout. In case multiple
  8807. + * channels are found, only the first match will be returned.
  8808. + *
  8809. + * @param channel_layout input channel layout
  8810. + * @param channel the channel whose index to obtain
  8811. + * @return index of channel in channel_layout on success or a negative number if
  8812. + * channel is not present in channel_layout.
  8813. + */
  8814. +int av_channel_layout_index_from_channel(const AVChannelLayout* channel_layout,
  8815. + enum AVChannel channel);
  8816. +
  8817. +/**
  8818. + * Get the index in a channel layout of a channel described by the given string.
  8819. + * In case multiple channels are found, only the first match will be returned.
  8820. + *
  8821. + * This function accepts channel names in the same format as
  8822. + * @ref av_channel_from_string().
  8823. + *
  8824. + * @param channel_layout input channel layout
  8825. + * @param name string describing the channel whose index to obtain
  8826. + * @return a channel index described by the given string, or a negative AVERROR
  8827. + * value.
  8828. + */
  8829. +int av_channel_layout_index_from_string(const AVChannelLayout* channel_layout,
  8830. + const char* name);
  8831. +
  8832. +/**
  8833. + * Get a channel described by the given string.
  8834. + *
  8835. + * This function accepts channel names in the same format as
  8836. + * @ref av_channel_from_string().
  8837. + *
  8838. + * @param channel_layout input channel layout
  8839. + * @param name string describing the channel to obtain
  8840. + * @return a channel described by the given string in channel_layout on success
  8841. + * or AV_CHAN_NONE on failure (if the string is not valid or the channel
  8842. + * order is unspecified)
  8843. + */
  8844. +enum AVChannel av_channel_layout_channel_from_string(
  8845. + const AVChannelLayout* channel_layout, const char* name);
  8846. +
  8847. +/**
  8848. + * Find out what channels from a given set are present in a channel layout,
  8849. + * without regard for their positions.
  8850. + *
  8851. + * @param channel_layout input channel layout
  8852. + * @param mask a combination of AV_CH_* representing a set of channels
  8853. + * @return a bitfield representing all the channels from mask that are present
  8854. + * in channel_layout
  8855. + */
  8856. +uint64_t av_channel_layout_subset(const AVChannelLayout* channel_layout,
  8857. + uint64_t mask);
  8858. +
  8859. +/**
  8860. + * Check whether a channel layout is valid, i.e. can possibly describe audio
  8861. + * data.
  8862. + *
  8863. + * @param channel_layout input channel layout
  8864. + * @return 1 if channel_layout is valid, 0 otherwise.
  8865. + */
  8866. +int av_channel_layout_check(const AVChannelLayout* channel_layout);
  8867. +
  8868. +/**
  8869. + * Check whether two channel layouts are semantically the same, i.e. the same
  8870. + * channels are present on the same positions in both.
  8871. + *
  8872. + * If one of the channel layouts is AV_CHANNEL_ORDER_UNSPEC, while the other is
  8873. + * not, they are considered to be unequal. If both are AV_CHANNEL_ORDER_UNSPEC,
  8874. + * they are considered equal iff the channel counts are the same in both.
  8875. + *
  8876. + * @param chl input channel layout
  8877. + * @param chl1 input channel layout
  8878. + * @return 0 if chl and chl1 are equal, 1 if they are not equal. A negative
  8879. + * AVERROR code if one or both are invalid.
  8880. + */
  8881. +int av_channel_layout_compare(const AVChannelLayout* chl,
  8882. + const AVChannelLayout* chl1);
  8883. +
  8884. +/**
  8885. + * @}
  8886. + */
  8887. +
  8888. +#endif /* AVUTIL_CHANNEL_LAYOUT_H */
  8889. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/common.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/common.h
  8890. new file mode 100644
  8891. index 00000000..6c09e40b
  8892. --- /dev/null
  8893. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/common.h
  8894. @@ -0,0 +1,589 @@
  8895. +/*
  8896. + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
  8897. + *
  8898. + * This file is part of FFmpeg.
  8899. + *
  8900. + * FFmpeg is free software; you can redistribute it and/or
  8901. + * modify it under the terms of the GNU Lesser General Public
  8902. + * License as published by the Free Software Foundation; either
  8903. + * version 2.1 of the License, or (at your option) any later version.
  8904. + *
  8905. + * FFmpeg is distributed in the hope that it will be useful,
  8906. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8907. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  8908. + * Lesser General Public License for more details.
  8909. + *
  8910. + * You should have received a copy of the GNU Lesser General Public
  8911. + * License along with FFmpeg; if not, write to the Free Software
  8912. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  8913. + */
  8914. +
  8915. +/**
  8916. + * @file
  8917. + * common internal and external API header
  8918. + */
  8919. +
  8920. +#ifndef AVUTIL_COMMON_H
  8921. +#define AVUTIL_COMMON_H
  8922. +
  8923. +#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS) && \
  8924. + !defined(UINT64_C)
  8925. +# error missing -D__STDC_CONSTANT_MACROS / #define __STDC_CONSTANT_MACROS
  8926. +#endif
  8927. +
  8928. +#include <errno.h>
  8929. +#include <inttypes.h>
  8930. +#include <limits.h>
  8931. +#include <math.h>
  8932. +#include <stdint.h>
  8933. +#include <stdio.h>
  8934. +#include <stdlib.h>
  8935. +#include <string.h>
  8936. +
  8937. +#include "attributes.h"
  8938. +#include "macros.h"
  8939. +
  8940. +// rounded division & shift
  8941. +#define RSHIFT(a, b) \
  8942. + ((a) > 0 ? ((a) + ((1 << (b)) >> 1)) >> (b) \
  8943. + : ((a) + ((1 << (b)) >> 1) - 1) >> (b))
  8944. +/* assume b>0 */
  8945. +#define ROUNDED_DIV(a, b) \
  8946. + (((a) >= 0 ? (a) + ((b) >> 1) : (a) - ((b) >> 1)) / (b))
  8947. +/* Fast a/(1<<b) rounded toward +inf. Assume a>=0 and b>=0 */
  8948. +#define AV_CEIL_RSHIFT(a, b) \
  8949. + (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) : ((a) + (1 << (b)) - 1) >> (b))
  8950. +/* Backwards compat. */
  8951. +#define FF_CEIL_RSHIFT AV_CEIL_RSHIFT
  8952. +
  8953. +#define FFUDIV(a, b) (((a) > 0 ? (a) : (a) - (b) + 1) / (b))
  8954. +#define FFUMOD(a, b) ((a) - (b)*FFUDIV(a, b))
  8955. +
  8956. +/**
  8957. + * Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as
  8958. + * they are not representable as absolute values of their type. This is the same
  8959. + * as with *abs()
  8960. + * @see FFNABS()
  8961. + */
  8962. +#define FFABS(a) ((a) >= 0 ? (a) : (-(a)))
  8963. +#define FFSIGN(a) ((a) > 0 ? 1 : -1)
  8964. +
  8965. +/**
  8966. + * Negative Absolute value.
  8967. + * this works for all integers of all types.
  8968. + * As with many macros, this evaluates its argument twice, it thus must not have
  8969. + * a sideeffect, that is FFNABS(x++) has undefined behavior.
  8970. + */
  8971. +#define FFNABS(a) ((a) <= 0 ? (a) : (-(a)))
  8972. +
  8973. +/**
  8974. + * Unsigned Absolute value.
  8975. + * This takes the absolute value of a signed int and returns it as a unsigned.
  8976. + * This also works with INT_MIN which would otherwise not be representable
  8977. + * As with many macros, this evaluates its argument twice.
  8978. + */
  8979. +#define FFABSU(a) ((a) <= 0 ? -(unsigned)(a) : (unsigned)(a))
  8980. +#define FFABS64U(a) ((a) <= 0 ? -(uint64_t)(a) : (uint64_t)(a))
  8981. +
  8982. +/* misc math functions */
  8983. +
  8984. +#ifdef HAVE_AV_CONFIG_H
  8985. +# include "config.h"
  8986. +# include "intmath.h"
  8987. +#endif
  8988. +
  8989. +#ifndef av_ceil_log2
  8990. +# define av_ceil_log2 av_ceil_log2_c
  8991. +#endif
  8992. +#ifndef av_clip
  8993. +# define av_clip av_clip_c
  8994. +#endif
  8995. +#ifndef av_clip64
  8996. +# define av_clip64 av_clip64_c
  8997. +#endif
  8998. +#ifndef av_clip_uint8
  8999. +# define av_clip_uint8 av_clip_uint8_c
  9000. +#endif
  9001. +#ifndef av_clip_int8
  9002. +# define av_clip_int8 av_clip_int8_c
  9003. +#endif
  9004. +#ifndef av_clip_uint16
  9005. +# define av_clip_uint16 av_clip_uint16_c
  9006. +#endif
  9007. +#ifndef av_clip_int16
  9008. +# define av_clip_int16 av_clip_int16_c
  9009. +#endif
  9010. +#ifndef av_clipl_int32
  9011. +# define av_clipl_int32 av_clipl_int32_c
  9012. +#endif
  9013. +#ifndef av_clip_intp2
  9014. +# define av_clip_intp2 av_clip_intp2_c
  9015. +#endif
  9016. +#ifndef av_clip_uintp2
  9017. +# define av_clip_uintp2 av_clip_uintp2_c
  9018. +#endif
  9019. +#ifndef av_mod_uintp2
  9020. +# define av_mod_uintp2 av_mod_uintp2_c
  9021. +#endif
  9022. +#ifndef av_sat_add32
  9023. +# define av_sat_add32 av_sat_add32_c
  9024. +#endif
  9025. +#ifndef av_sat_dadd32
  9026. +# define av_sat_dadd32 av_sat_dadd32_c
  9027. +#endif
  9028. +#ifndef av_sat_sub32
  9029. +# define av_sat_sub32 av_sat_sub32_c
  9030. +#endif
  9031. +#ifndef av_sat_dsub32
  9032. +# define av_sat_dsub32 av_sat_dsub32_c
  9033. +#endif
  9034. +#ifndef av_sat_add64
  9035. +# define av_sat_add64 av_sat_add64_c
  9036. +#endif
  9037. +#ifndef av_sat_sub64
  9038. +# define av_sat_sub64 av_sat_sub64_c
  9039. +#endif
  9040. +#ifndef av_clipf
  9041. +# define av_clipf av_clipf_c
  9042. +#endif
  9043. +#ifndef av_clipd
  9044. +# define av_clipd av_clipd_c
  9045. +#endif
  9046. +#ifndef av_popcount
  9047. +# define av_popcount av_popcount_c
  9048. +#endif
  9049. +#ifndef av_popcount64
  9050. +# define av_popcount64 av_popcount64_c
  9051. +#endif
  9052. +#ifndef av_parity
  9053. +# define av_parity av_parity_c
  9054. +#endif
  9055. +
  9056. +#ifndef av_log2
  9057. +av_const int av_log2(unsigned v);
  9058. +#endif
  9059. +
  9060. +#ifndef av_log2_16bit
  9061. +av_const int av_log2_16bit(unsigned v);
  9062. +#endif
  9063. +
  9064. +/**
  9065. + * Clip a signed integer value into the amin-amax range.
  9066. + * @param a value to clip
  9067. + * @param amin minimum value of the clip range
  9068. + * @param amax maximum value of the clip range
  9069. + * @return clipped value
  9070. + */
  9071. +static av_always_inline av_const int av_clip_c(int a, int amin, int amax) {
  9072. +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
  9073. + if (amin > amax) abort();
  9074. +#endif
  9075. + if (a < amin)
  9076. + return amin;
  9077. + else if (a > amax)
  9078. + return amax;
  9079. + else
  9080. + return a;
  9081. +}
  9082. +
  9083. +/**
  9084. + * Clip a signed 64bit integer value into the amin-amax range.
  9085. + * @param a value to clip
  9086. + * @param amin minimum value of the clip range
  9087. + * @param amax maximum value of the clip range
  9088. + * @return clipped value
  9089. + */
  9090. +static av_always_inline av_const int64_t av_clip64_c(int64_t a, int64_t amin,
  9091. + int64_t amax) {
  9092. +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
  9093. + if (amin > amax) abort();
  9094. +#endif
  9095. + if (a < amin)
  9096. + return amin;
  9097. + else if (a > amax)
  9098. + return amax;
  9099. + else
  9100. + return a;
  9101. +}
  9102. +
  9103. +/**
  9104. + * Clip a signed integer value into the 0-255 range.
  9105. + * @param a value to clip
  9106. + * @return clipped value
  9107. + */
  9108. +static av_always_inline av_const uint8_t av_clip_uint8_c(int a) {
  9109. + if (a & (~0xFF))
  9110. + return (~a) >> 31;
  9111. + else
  9112. + return a;
  9113. +}
  9114. +
  9115. +/**
  9116. + * Clip a signed integer value into the -128,127 range.
  9117. + * @param a value to clip
  9118. + * @return clipped value
  9119. + */
  9120. +static av_always_inline av_const int8_t av_clip_int8_c(int a) {
  9121. + if ((a + 0x80U) & ~0xFF)
  9122. + return (a >> 31) ^ 0x7F;
  9123. + else
  9124. + return a;
  9125. +}
  9126. +
  9127. +/**
  9128. + * Clip a signed integer value into the 0-65535 range.
  9129. + * @param a value to clip
  9130. + * @return clipped value
  9131. + */
  9132. +static av_always_inline av_const uint16_t av_clip_uint16_c(int a) {
  9133. + if (a & (~0xFFFF))
  9134. + return (~a) >> 31;
  9135. + else
  9136. + return a;
  9137. +}
  9138. +
  9139. +/**
  9140. + * Clip a signed integer value into the -32768,32767 range.
  9141. + * @param a value to clip
  9142. + * @return clipped value
  9143. + */
  9144. +static av_always_inline av_const int16_t av_clip_int16_c(int a) {
  9145. + if ((a + 0x8000U) & ~0xFFFF)
  9146. + return (a >> 31) ^ 0x7FFF;
  9147. + else
  9148. + return a;
  9149. +}
  9150. +
  9151. +/**
  9152. + * Clip a signed 64-bit integer value into the -2147483648,2147483647 range.
  9153. + * @param a value to clip
  9154. + * @return clipped value
  9155. + */
  9156. +static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a) {
  9157. + if ((a + 0x80000000u) & ~UINT64_C(0xFFFFFFFF))
  9158. + return (int32_t)((a >> 63) ^ 0x7FFFFFFF);
  9159. + else
  9160. + return (int32_t)a;
  9161. +}
  9162. +
  9163. +/**
  9164. + * Clip a signed integer into the -(2^p),(2^p-1) range.
  9165. + * @param a value to clip
  9166. + * @param p bit position to clip at
  9167. + * @return clipped value
  9168. + */
  9169. +static av_always_inline av_const int av_clip_intp2_c(int a, int p) {
  9170. + if (((unsigned)a + (1 << p)) & ~((2 << p) - 1))
  9171. + return (a >> 31) ^ ((1 << p) - 1);
  9172. + else
  9173. + return a;
  9174. +}
  9175. +
  9176. +/**
  9177. + * Clip a signed integer to an unsigned power of two range.
  9178. + * @param a value to clip
  9179. + * @param p bit position to clip at
  9180. + * @return clipped value
  9181. + */
  9182. +static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p) {
  9183. + if (a & ~((1 << p) - 1))
  9184. + return (~a) >> 31 & ((1 << p) - 1);
  9185. + else
  9186. + return a;
  9187. +}
  9188. +
  9189. +/**
  9190. + * Clear high bits from an unsigned integer starting with specific bit position
  9191. + * @param a value to clip
  9192. + * @param p bit position to clip at
  9193. + * @return clipped value
  9194. + */
  9195. +static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a,
  9196. + unsigned p) {
  9197. + return a & ((1U << p) - 1);
  9198. +}
  9199. +
  9200. +/**
  9201. + * Add two signed 32-bit values with saturation.
  9202. + *
  9203. + * @param a one value
  9204. + * @param b another value
  9205. + * @return sum with signed saturation
  9206. + */
  9207. +static av_always_inline int av_sat_add32_c(int a, int b) {
  9208. + return av_clipl_int32((int64_t)a + b);
  9209. +}
  9210. +
  9211. +/**
  9212. + * Add a doubled value to another value with saturation at both stages.
  9213. + *
  9214. + * @param a first value
  9215. + * @param b value doubled and added to a
  9216. + * @return sum sat(a + sat(2*b)) with signed saturation
  9217. + */
  9218. +static av_always_inline int av_sat_dadd32_c(int a, int b) {
  9219. + return av_sat_add32(a, av_sat_add32(b, b));
  9220. +}
  9221. +
  9222. +/**
  9223. + * Subtract two signed 32-bit values with saturation.
  9224. + *
  9225. + * @param a one value
  9226. + * @param b another value
  9227. + * @return difference with signed saturation
  9228. + */
  9229. +static av_always_inline int av_sat_sub32_c(int a, int b) {
  9230. + return av_clipl_int32((int64_t)a - b);
  9231. +}
  9232. +
  9233. +/**
  9234. + * Subtract a doubled value from another value with saturation at both stages.
  9235. + *
  9236. + * @param a first value
  9237. + * @param b value doubled and subtracted from a
  9238. + * @return difference sat(a - sat(2*b)) with signed saturation
  9239. + */
  9240. +static av_always_inline int av_sat_dsub32_c(int a, int b) {
  9241. + return av_sat_sub32(a, av_sat_add32(b, b));
  9242. +}
  9243. +
  9244. +/**
  9245. + * Add two signed 64-bit values with saturation.
  9246. + *
  9247. + * @param a one value
  9248. + * @param b another value
  9249. + * @return sum with signed saturation
  9250. + */
  9251. +static av_always_inline int64_t av_sat_add64_c(int64_t a, int64_t b) {
  9252. +#if (!defined(__INTEL_COMPILER) && AV_GCC_VERSION_AT_LEAST(5, 1)) || \
  9253. + AV_HAS_BUILTIN(__builtin_add_overflow)
  9254. + int64_t tmp;
  9255. + return !__builtin_add_overflow(a, b, &tmp)
  9256. + ? tmp
  9257. + : (tmp < 0 ? INT64_MAX : INT64_MIN);
  9258. +#else
  9259. + int64_t s = a + (uint64_t)b;
  9260. + if ((int64_t)(a ^ b | ~s ^ b) >= 0) return INT64_MAX ^ (b >> 63);
  9261. + return s;
  9262. +#endif
  9263. +}
  9264. +
  9265. +/**
  9266. + * Subtract two signed 64-bit values with saturation.
  9267. + *
  9268. + * @param a one value
  9269. + * @param b another value
  9270. + * @return difference with signed saturation
  9271. + */
  9272. +static av_always_inline int64_t av_sat_sub64_c(int64_t a, int64_t b) {
  9273. +#if (!defined(__INTEL_COMPILER) && AV_GCC_VERSION_AT_LEAST(5, 1)) || \
  9274. + AV_HAS_BUILTIN(__builtin_sub_overflow)
  9275. + int64_t tmp;
  9276. + return !__builtin_sub_overflow(a, b, &tmp)
  9277. + ? tmp
  9278. + : (tmp < 0 ? INT64_MAX : INT64_MIN);
  9279. +#else
  9280. + if (b <= 0 && a >= INT64_MAX + b) return INT64_MAX;
  9281. + if (b >= 0 && a <= INT64_MIN + b) return INT64_MIN;
  9282. + return a - b;
  9283. +#endif
  9284. +}
  9285. +
  9286. +/**
  9287. + * Clip a float value into the amin-amax range.
  9288. + * If a is nan or -inf amin will be returned.
  9289. + * If a is +inf amax will be returned.
  9290. + * @param a value to clip
  9291. + * @param amin minimum value of the clip range
  9292. + * @param amax maximum value of the clip range
  9293. + * @return clipped value
  9294. + */
  9295. +static av_always_inline av_const float av_clipf_c(float a, float amin,
  9296. + float amax) {
  9297. +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
  9298. + if (amin > amax) abort();
  9299. +#endif
  9300. + return FFMIN(FFMAX(a, amin), amax);
  9301. +}
  9302. +
  9303. +/**
  9304. + * Clip a double value into the amin-amax range.
  9305. + * If a is nan or -inf amin will be returned.
  9306. + * If a is +inf amax will be returned.
  9307. + * @param a value to clip
  9308. + * @param amin minimum value of the clip range
  9309. + * @param amax maximum value of the clip range
  9310. + * @return clipped value
  9311. + */
  9312. +static av_always_inline av_const double av_clipd_c(double a, double amin,
  9313. + double amax) {
  9314. +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
  9315. + if (amin > amax) abort();
  9316. +#endif
  9317. + return FFMIN(FFMAX(a, amin), amax);
  9318. +}
  9319. +
  9320. +/** Compute ceil(log2(x)).
  9321. + * @param x value used to compute ceil(log2(x))
  9322. + * @return computed ceiling of log2(x)
  9323. + */
  9324. +static av_always_inline av_const int av_ceil_log2_c(int x) {
  9325. + return av_log2((x - 1U) << 1);
  9326. +}
  9327. +
  9328. +/**
  9329. + * Count number of bits set to one in x
  9330. + * @param x value to count bits of
  9331. + * @return the number of bits set to one in x
  9332. + */
  9333. +static av_always_inline av_const int av_popcount_c(uint32_t x) {
  9334. + x -= (x >> 1) & 0x55555555;
  9335. + x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
  9336. + x = (x + (x >> 4)) & 0x0F0F0F0F;
  9337. + x += x >> 8;
  9338. + return (x + (x >> 16)) & 0x3F;
  9339. +}
  9340. +
  9341. +/**
  9342. + * Count number of bits set to one in x
  9343. + * @param x value to count bits of
  9344. + * @return the number of bits set to one in x
  9345. + */
  9346. +static av_always_inline av_const int av_popcount64_c(uint64_t x) {
  9347. + return av_popcount((uint32_t)x) + av_popcount((uint32_t)(x >> 32));
  9348. +}
  9349. +
  9350. +static av_always_inline av_const int av_parity_c(uint32_t v) {
  9351. + return av_popcount(v) & 1;
  9352. +}
  9353. +
  9354. +/**
  9355. + * Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form.
  9356. + *
  9357. + * @param val Output value, must be an lvalue of type uint32_t.
  9358. + * @param GET_BYTE Expression reading one byte from the input.
  9359. + * Evaluated up to 7 times (4 for the currently
  9360. + * assigned Unicode range). With a memory buffer
  9361. + * input, this could be *ptr++, or if you want to make sure
  9362. + * that *ptr stops at the end of a NULL terminated string then
  9363. + * *ptr ? *ptr++ : 0
  9364. + * @param ERROR Expression to be evaluated on invalid input,
  9365. + * typically a goto statement.
  9366. + *
  9367. + * @warning ERROR should not contain a loop control statement which
  9368. + * could interact with the internal while loop, and should force an
  9369. + * exit from the macro code (e.g. through a goto or a return) in order
  9370. + * to prevent undefined results.
  9371. + */
  9372. +#define GET_UTF8(val, GET_BYTE, ERROR) \
  9373. + val = (GET_BYTE); \
  9374. + { \
  9375. + uint32_t top = (val & 128) >> 1; \
  9376. + if ((val & 0xc0) == 0x80 || val >= 0xFE) { \
  9377. + ERROR \
  9378. + } \
  9379. + while (val & top) { \
  9380. + unsigned int tmp = (GET_BYTE)-128; \
  9381. + if (tmp >> 6) { \
  9382. + ERROR \
  9383. + } \
  9384. + val = (val << 6) + tmp; \
  9385. + top <<= 5; \
  9386. + } \
  9387. + val &= (top << 1) - 1; \
  9388. + }
  9389. +
  9390. +/**
  9391. + * Convert a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form.
  9392. + *
  9393. + * @param val Output value, must be an lvalue of type uint32_t.
  9394. + * @param GET_16BIT Expression returning two bytes of UTF-16 data converted
  9395. + * to native byte order. Evaluated one or two times.
  9396. + * @param ERROR Expression to be evaluated on invalid input,
  9397. + * typically a goto statement.
  9398. + */
  9399. +#define GET_UTF16(val, GET_16BIT, ERROR) \
  9400. + val = (GET_16BIT); \
  9401. + { \
  9402. + unsigned int hi = val - 0xD800; \
  9403. + if (hi < 0x800) { \
  9404. + val = (GET_16BIT)-0xDC00; \
  9405. + if (val > 0x3FFU || hi > 0x3FFU) { \
  9406. + ERROR \
  9407. + } \
  9408. + val += (hi << 10) + 0x10000; \
  9409. + } \
  9410. + }
  9411. +
  9412. +/**
  9413. + * @def PUT_UTF8(val, tmp, PUT_BYTE)
  9414. + * Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes
  9415. + * long).
  9416. + * @param val is an input-only argument and should be of type uint32_t. It holds
  9417. + * a UCS-4 encoded Unicode character that is to be converted to UTF-8. If
  9418. + * val is given as a function it is executed only once.
  9419. + * @param tmp is a temporary variable and should be of type uint8_t. It
  9420. + * represents an intermediate value during conversion that is to be
  9421. + * output by PUT_BYTE.
  9422. + * @param PUT_BYTE writes the converted UTF-8 bytes to any proper destination.
  9423. + * It could be a function or a statement, and uses tmp as the input byte.
  9424. + * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be
  9425. + * executed up to 4 times for values in the valid UTF-8 range and up to
  9426. + * 7 times in the general case, depending on the length of the converted
  9427. + * Unicode character.
  9428. + */
  9429. +#define PUT_UTF8(val, tmp, PUT_BYTE) \
  9430. + { \
  9431. + int bytes, shift; \
  9432. + uint32_t in = val; \
  9433. + if (in < 0x80) { \
  9434. + tmp = in; \
  9435. + PUT_BYTE \
  9436. + } else { \
  9437. + bytes = (av_log2(in) + 4) / 5; \
  9438. + shift = (bytes - 1) * 6; \
  9439. + tmp = (256 - (256 >> bytes)) | (in >> shift); \
  9440. + PUT_BYTE \
  9441. + while (shift >= 6) { \
  9442. + shift -= 6; \
  9443. + tmp = 0x80 | ((in >> shift) & 0x3f); \
  9444. + PUT_BYTE \
  9445. + } \
  9446. + } \
  9447. + }
  9448. +
  9449. +/**
  9450. + * @def PUT_UTF16(val, tmp, PUT_16BIT)
  9451. + * Convert a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes).
  9452. + * @param val is an input-only argument and should be of type uint32_t. It holds
  9453. + * a UCS-4 encoded Unicode character that is to be converted to UTF-16. If
  9454. + * val is given as a function it is executed only once.
  9455. + * @param tmp is a temporary variable and should be of type uint16_t. It
  9456. + * represents an intermediate value during conversion that is to be
  9457. + * output by PUT_16BIT.
  9458. + * @param PUT_16BIT writes the converted UTF-16 data to any proper destination
  9459. + * in desired endianness. It could be a function or a statement, and uses tmp
  9460. + * as the input byte. For example, PUT_BYTE could be "*output++ = tmp;"
  9461. + * PUT_BYTE will be executed 1 or 2 times depending on input character.
  9462. + */
  9463. +#define PUT_UTF16(val, tmp, PUT_16BIT) \
  9464. + { \
  9465. + uint32_t in = val; \
  9466. + if (in < 0x10000) { \
  9467. + tmp = in; \
  9468. + PUT_16BIT \
  9469. + } else { \
  9470. + tmp = 0xD800 | ((in - 0x10000) >> 10); \
  9471. + PUT_16BIT \
  9472. + tmp = 0xDC00 | ((in - 0x10000) & 0x3FF); \
  9473. + PUT_16BIT \
  9474. + } \
  9475. + }
  9476. +
  9477. +#include "mem.h"
  9478. +
  9479. +#ifdef HAVE_AV_CONFIG_H
  9480. +# include "internal.h"
  9481. +#endif /* HAVE_AV_CONFIG_H */
  9482. +
  9483. +#endif /* AVUTIL_COMMON_H */
  9484. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/cpu.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/cpu.h
  9485. new file mode 100644
  9486. index 00000000..8a48d944
  9487. --- /dev/null
  9488. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/cpu.h
  9489. @@ -0,0 +1,150 @@
  9490. +/*
  9491. + * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  9492. + *
  9493. + * This file is part of FFmpeg.
  9494. + *
  9495. + * FFmpeg is free software; you can redistribute it and/or
  9496. + * modify it under the terms of the GNU Lesser General Public
  9497. + * License as published by the Free Software Foundation; either
  9498. + * version 2.1 of the License, or (at your option) any later version.
  9499. + *
  9500. + * FFmpeg is distributed in the hope that it will be useful,
  9501. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9502. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  9503. + * Lesser General Public License for more details.
  9504. + *
  9505. + * You should have received a copy of the GNU Lesser General Public
  9506. + * License along with FFmpeg; if not, write to the Free Software
  9507. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  9508. + */
  9509. +
  9510. +#ifndef AVUTIL_CPU_H
  9511. +#define AVUTIL_CPU_H
  9512. +
  9513. +#include <stddef.h>
  9514. +
  9515. +#define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */
  9516. +
  9517. +/* lower 16 bits - CPU features */
  9518. +#define AV_CPU_FLAG_MMX 0x0001 ///< standard MMX
  9519. +#define AV_CPU_FLAG_MMXEXT 0x0002 ///< SSE integer functions or AMD MMX ext
  9520. +#define AV_CPU_FLAG_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext
  9521. +#define AV_CPU_FLAG_3DNOW 0x0004 ///< AMD 3DNOW
  9522. +#define AV_CPU_FLAG_SSE 0x0008 ///< SSE functions
  9523. +#define AV_CPU_FLAG_SSE2 0x0010 ///< PIV SSE2 functions
  9524. +#define AV_CPU_FLAG_SSE2SLOW \
  9525. + 0x40000000 ///< SSE2 supported, but usually not faster
  9526. + ///< than regular MMX/SSE (e.g. Core1)
  9527. +#define AV_CPU_FLAG_3DNOWEXT 0x0020 ///< AMD 3DNowExt
  9528. +#define AV_CPU_FLAG_SSE3 0x0040 ///< Prescott SSE3 functions
  9529. +#define AV_CPU_FLAG_SSE3SLOW \
  9530. + 0x20000000 ///< SSE3 supported, but usually not faster
  9531. + ///< than regular MMX/SSE (e.g. Core1)
  9532. +#define AV_CPU_FLAG_SSSE3 0x0080 ///< Conroe SSSE3 functions
  9533. +#define AV_CPU_FLAG_SSSE3SLOW \
  9534. + 0x4000000 ///< SSSE3 supported, but usually not faster
  9535. +#define AV_CPU_FLAG_ATOM \
  9536. + 0x10000000 ///< Atom processor, some SSSE3 instructions are slower
  9537. +#define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions
  9538. +#define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions
  9539. +#define AV_CPU_FLAG_AESNI 0x80000 ///< Advanced Encryption Standard functions
  9540. +#define AV_CPU_FLAG_AVX \
  9541. + 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't
  9542. + ///< used
  9543. +#define AV_CPU_FLAG_AVXSLOW \
  9544. + 0x8000000 ///< AVX supported, but slow when using YMM registers (e.g.
  9545. + ///< Bulldozer)
  9546. +#define AV_CPU_FLAG_XOP 0x0400 ///< Bulldozer XOP functions
  9547. +#define AV_CPU_FLAG_FMA4 0x0800 ///< Bulldozer FMA4 functions
  9548. +#define AV_CPU_FLAG_CMOV 0x1000 ///< supports cmov instruction
  9549. +#define AV_CPU_FLAG_AVX2 \
  9550. + 0x8000 ///< AVX2 functions: requires OS support even if YMM registers aren't
  9551. + ///< used
  9552. +#define AV_CPU_FLAG_FMA3 0x10000 ///< Haswell FMA3 functions
  9553. +#define AV_CPU_FLAG_BMI1 0x20000 ///< Bit Manipulation Instruction Set 1
  9554. +#define AV_CPU_FLAG_BMI2 0x40000 ///< Bit Manipulation Instruction Set 2
  9555. +#define AV_CPU_FLAG_AVX512 \
  9556. + 0x100000 ///< AVX-512 functions: requires OS support even if YMM/ZMM
  9557. + ///< registers aren't used
  9558. +#define AV_CPU_FLAG_AVX512ICL \
  9559. + 0x200000 ///< F/CD/BW/DQ/VL/VNNI/IFMA/VBMI/VBMI2/VPOPCNTDQ/BITALG/GFNI/VAES/VPCLMULQDQ
  9560. +#define AV_CPU_FLAG_SLOW_GATHER 0x2000000 ///< CPU has slow gathers.
  9561. +
  9562. +#define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard
  9563. +#define AV_CPU_FLAG_VSX 0x0002 ///< ISA 2.06
  9564. +#define AV_CPU_FLAG_POWER8 0x0004 ///< ISA 2.07
  9565. +
  9566. +#define AV_CPU_FLAG_ARMV5TE (1 << 0)
  9567. +#define AV_CPU_FLAG_ARMV6 (1 << 1)
  9568. +#define AV_CPU_FLAG_ARMV6T2 (1 << 2)
  9569. +#define AV_CPU_FLAG_VFP (1 << 3)
  9570. +#define AV_CPU_FLAG_VFPV3 (1 << 4)
  9571. +#define AV_CPU_FLAG_NEON (1 << 5)
  9572. +#define AV_CPU_FLAG_ARMV8 (1 << 6)
  9573. +#define AV_CPU_FLAG_VFP_VM \
  9574. + (1 << 7) ///< VFPv2 vector mode, deprecated in ARMv7-A and unavailable in
  9575. + ///< various CPUs implementations
  9576. +#define AV_CPU_FLAG_SETEND (1 << 16)
  9577. +
  9578. +#define AV_CPU_FLAG_MMI (1 << 0)
  9579. +#define AV_CPU_FLAG_MSA (1 << 1)
  9580. +
  9581. +// Loongarch SIMD extension.
  9582. +#define AV_CPU_FLAG_LSX (1 << 0)
  9583. +#define AV_CPU_FLAG_LASX (1 << 1)
  9584. +
  9585. +// RISC-V extensions
  9586. +#define AV_CPU_FLAG_RVI (1 << 0) ///< I (full GPR bank)
  9587. +#define AV_CPU_FLAG_RVF (1 << 1) ///< F (single precision FP)
  9588. +#define AV_CPU_FLAG_RVD (1 << 2) ///< D (double precision FP)
  9589. +#define AV_CPU_FLAG_RVV_I32 (1 << 3) ///< Vectors of 8/16/32-bit int's */
  9590. +#define AV_CPU_FLAG_RVV_F32 (1 << 4) ///< Vectors of float's */
  9591. +#define AV_CPU_FLAG_RVV_I64 (1 << 5) ///< Vectors of 64-bit int's */
  9592. +#define AV_CPU_FLAG_RVV_F64 (1 << 6) ///< Vectors of double's
  9593. +#define AV_CPU_FLAG_RVB_BASIC (1 << 7) ///< Basic bit-manipulations
  9594. +
  9595. +/**
  9596. + * Return the flags which specify extensions supported by the CPU.
  9597. + * The returned value is affected by av_force_cpu_flags() if that was used
  9598. + * before. So av_get_cpu_flags() can easily be used in an application to
  9599. + * detect the enabled cpu flags.
  9600. + */
  9601. +int av_get_cpu_flags(void);
  9602. +
  9603. +/**
  9604. + * Disables cpu detection and forces the specified flags.
  9605. + * -1 is a special case that disables forcing of specific flags.
  9606. + */
  9607. +void av_force_cpu_flags(int flags);
  9608. +
  9609. +/**
  9610. + * Parse CPU caps from a string and update the given AV_CPU_* flags based on
  9611. + * that.
  9612. + *
  9613. + * @return negative on error.
  9614. + */
  9615. +int av_parse_cpu_caps(unsigned* flags, const char* s);
  9616. +
  9617. +/**
  9618. + * @return the number of logical CPU cores present.
  9619. + */
  9620. +int av_cpu_count(void);
  9621. +
  9622. +/**
  9623. + * Overrides cpu count detection and forces the specified count.
  9624. + * Count < 1 disables forcing of specific count.
  9625. + */
  9626. +void av_cpu_force_count(int count);
  9627. +
  9628. +/**
  9629. + * Get the maximum data alignment that may be required by FFmpeg.
  9630. + *
  9631. + * Note that this is affected by the build configuration and the CPU flags mask,
  9632. + * so e.g. if the CPU supports AVX, but libavutil has been built with
  9633. + * --disable-avx or the AV_CPU_FLAG_AVX flag has been disabled through
  9634. + * av_set_cpu_flags_mask(), then this function will behave as if AVX is not
  9635. + * present.
  9636. + */
  9637. +size_t av_cpu_max_align(void);
  9638. +
  9639. +#endif /* AVUTIL_CPU_H */
  9640. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/dict.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/dict.h
  9641. new file mode 100644
  9642. index 00000000..967a1c80
  9643. --- /dev/null
  9644. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/dict.h
  9645. @@ -0,0 +1,259 @@
  9646. +/*
  9647. + * This file is part of FFmpeg.
  9648. + *
  9649. + * FFmpeg is free software; you can redistribute it and/or
  9650. + * modify it under the terms of the GNU Lesser General Public
  9651. + * License as published by the Free Software Foundation; either
  9652. + * version 2.1 of the License, or (at your option) any later version.
  9653. + *
  9654. + * FFmpeg is distributed in the hope that it will be useful,
  9655. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9656. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  9657. + * Lesser General Public License for more details.
  9658. + *
  9659. + * You should have received a copy of the GNU Lesser General Public
  9660. + * License along with FFmpeg; if not, write to the Free Software
  9661. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  9662. + */
  9663. +
  9664. +/**
  9665. + * @file
  9666. + * Public dictionary API.
  9667. + * @deprecated
  9668. + * AVDictionary is provided for compatibility with libav. It is both in
  9669. + * implementation as well as API inefficient. It does not scale and is
  9670. + * extremely slow with large dictionaries.
  9671. + * It is recommended that new code uses our tree container from tree.c/h
  9672. + * where applicable, which uses AVL trees to achieve O(log n) performance.
  9673. + */
  9674. +
  9675. +#ifndef AVUTIL_DICT_H
  9676. +#define AVUTIL_DICT_H
  9677. +
  9678. +#include <stdint.h>
  9679. +
  9680. +/**
  9681. + * @addtogroup lavu_dict AVDictionary
  9682. + * @ingroup lavu_data
  9683. + *
  9684. + * @brief Simple key:value store
  9685. + *
  9686. + * @{
  9687. + * Dictionaries are used for storing key-value pairs.
  9688. + *
  9689. + * - To **create an AVDictionary**, simply pass an address of a NULL
  9690. + * pointer to av_dict_set(). NULL can be used as an empty dictionary
  9691. + * wherever a pointer to an AVDictionary is required.
  9692. + * - To **insert an entry**, use av_dict_set().
  9693. + * - Use av_dict_get() to **retrieve an entry**.
  9694. + * - To **iterate over all entries**, use av_dict_iterate().
  9695. + * - In order to **free the dictionary and all its contents**, use
  9696. + av_dict_free().
  9697. + *
  9698. + @code
  9699. + AVDictionary *d = NULL; // "create" an empty dictionary
  9700. + AVDictionaryEntry *t = NULL;
  9701. +
  9702. + av_dict_set(&d, "foo", "bar", 0); // add an entry
  9703. +
  9704. + char *k = av_strdup("key"); // if your strings are already allocated,
  9705. + char *v = av_strdup("value"); // you can avoid copying them like this
  9706. + av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL);
  9707. +
  9708. + while ((t = av_dict_iterate(d, t))) {
  9709. + <....> // iterate over all entries in d
  9710. + }
  9711. + av_dict_free(&d);
  9712. + @endcode
  9713. + */
  9714. +
  9715. +/**
  9716. + * @name AVDictionary Flags
  9717. + * Flags that influence behavior of the matching of keys or insertion to the
  9718. + * dictionary.
  9719. + * @{
  9720. + */
  9721. +#define AV_DICT_MATCH_CASE \
  9722. + 1 /**< Only get an entry with exact-case key match. Only relevant in \
  9723. + av_dict_get(). */
  9724. +#define AV_DICT_IGNORE_SUFFIX \
  9725. + 2 /**< Return first entry in a dictionary whose first part corresponds to \
  9726. + the search key, ignoring the suffix of the found key string. Only \
  9727. + relevant in av_dict_get(). */
  9728. +#define AV_DICT_DONT_STRDUP_KEY \
  9729. + 4 /**< Take ownership of a key that's been \
  9730. + allocated with av_malloc() or another memory allocation function. */
  9731. +#define AV_DICT_DONT_STRDUP_VAL \
  9732. + 8 /**< Take ownership of a value that's been \
  9733. + allocated with av_malloc() or another memory allocation function. */
  9734. +#define AV_DICT_DONT_OVERWRITE 16 /**< Don't overwrite existing entries. */
  9735. +#define AV_DICT_APPEND \
  9736. + 32 /**< If the entry already exists, append to it. Note that no \
  9737. + delimiter is added, the strings are simply concatenated. */
  9738. +#define AV_DICT_MULTIKEY \
  9739. + 64 /**< Allow to store several equal keys in the dictionary */
  9740. +/**
  9741. + * @}
  9742. + */
  9743. +
  9744. +typedef struct AVDictionaryEntry {
  9745. + char* key;
  9746. + char* value;
  9747. +} AVDictionaryEntry;
  9748. +
  9749. +typedef struct AVDictionary AVDictionary;
  9750. +
  9751. +/**
  9752. + * Get a dictionary entry with matching key.
  9753. + *
  9754. + * The returned entry key or value must not be changed, or it will
  9755. + * cause undefined behavior.
  9756. + *
  9757. + * @param prev Set to the previous matching element to find the next.
  9758. + * If set to NULL the first matching element is returned.
  9759. + * @param key Matching key
  9760. + * @param flags A collection of AV_DICT_* flags controlling how the
  9761. + * entry is retrieved
  9762. + *
  9763. + * @return Found entry or NULL in case no matching entry was found in the
  9764. + * dictionary
  9765. + */
  9766. +AVDictionaryEntry* av_dict_get(const AVDictionary* m, const char* key,
  9767. + const AVDictionaryEntry* prev, int flags);
  9768. +
  9769. +/**
  9770. + * Iterate over a dictionary
  9771. + *
  9772. + * Iterates through all entries in the dictionary.
  9773. + *
  9774. + * @warning The returned AVDictionaryEntry key/value must not be changed.
  9775. + *
  9776. + * @warning As av_dict_set() invalidates all previous entries returned
  9777. + * by this function, it must not be called while iterating over the dict.
  9778. + *
  9779. + * Typical usage:
  9780. + * @code
  9781. + * const AVDictionaryEntry *e = NULL;
  9782. + * while ((e = av_dict_iterate(m, e))) {
  9783. + * // ...
  9784. + * }
  9785. + * @endcode
  9786. + *
  9787. + * @param m The dictionary to iterate over
  9788. + * @param prev Pointer to the previous AVDictionaryEntry, NULL initially
  9789. + *
  9790. + * @retval AVDictionaryEntry* The next element in the dictionary
  9791. + * @retval NULL No more elements in the dictionary
  9792. + */
  9793. +const AVDictionaryEntry* av_dict_iterate(const AVDictionary* m,
  9794. + const AVDictionaryEntry* prev);
  9795. +
  9796. +/**
  9797. + * Get number of entries in dictionary.
  9798. + *
  9799. + * @param m dictionary
  9800. + * @return number of entries in dictionary
  9801. + */
  9802. +int av_dict_count(const AVDictionary* m);
  9803. +
  9804. +/**
  9805. + * Set the given entry in *pm, overwriting an existing entry.
  9806. + *
  9807. + * Note: If AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL is set,
  9808. + * these arguments will be freed on error.
  9809. + *
  9810. + * @warning Adding a new entry to a dictionary invalidates all existing entries
  9811. + * previously returned with av_dict_get() or av_dict_iterate().
  9812. + *
  9813. + * @param pm Pointer to a pointer to a dictionary struct. If *pm is NULL
  9814. + * a dictionary struct is allocated and put in *pm.
  9815. + * @param key Entry key to add to *pm (will either be av_strduped or added
  9816. + * as a new key depending on flags)
  9817. + * @param value Entry value to add to *pm (will be av_strduped or added as a
  9818. + * new key depending on flags). Passing a NULL value will cause an existing
  9819. + * entry to be deleted.
  9820. + *
  9821. + * @return >= 0 on success otherwise an error code <0
  9822. + */
  9823. +int av_dict_set(AVDictionary** pm, const char* key, const char* value,
  9824. + int flags);
  9825. +
  9826. +/**
  9827. + * Convenience wrapper for av_dict_set() that converts the value to a string
  9828. + * and stores it.
  9829. + *
  9830. + * Note: If ::AV_DICT_DONT_STRDUP_KEY is set, key will be freed on error.
  9831. + */
  9832. +int av_dict_set_int(AVDictionary** pm, const char* key, int64_t value,
  9833. + int flags);
  9834. +
  9835. +/**
  9836. + * Parse the key/value pairs list and add the parsed entries to a dictionary.
  9837. + *
  9838. + * In case of failure, all the successfully set entries are stored in
  9839. + * *pm. You may need to manually free the created dictionary.
  9840. + *
  9841. + * @param key_val_sep A 0-terminated list of characters used to separate
  9842. + * key from value
  9843. + * @param pairs_sep A 0-terminated list of characters used to separate
  9844. + * two pairs from each other
  9845. + * @param flags Flags to use when adding to the dictionary.
  9846. + * ::AV_DICT_DONT_STRDUP_KEY and ::AV_DICT_DONT_STRDUP_VAL
  9847. + * are ignored since the key/value tokens will always
  9848. + * be duplicated.
  9849. + *
  9850. + * @return 0 on success, negative AVERROR code on failure
  9851. + */
  9852. +int av_dict_parse_string(AVDictionary** pm, const char* str,
  9853. + const char* key_val_sep, const char* pairs_sep,
  9854. + int flags);
  9855. +
  9856. +/**
  9857. + * Copy entries from one AVDictionary struct into another.
  9858. + *
  9859. + * @note Metadata is read using the ::AV_DICT_IGNORE_SUFFIX flag
  9860. + *
  9861. + * @param dst Pointer to a pointer to a AVDictionary struct to copy into. If
  9862. + * *dst is NULL, this function will allocate a struct for you and put it in *dst
  9863. + * @param src Pointer to the source AVDictionary struct to copy items from.
  9864. + * @param flags Flags to use when setting entries in *dst
  9865. + *
  9866. + * @return 0 on success, negative AVERROR code on failure. If dst was allocated
  9867. + * by this function, callers should free the associated memory.
  9868. + */
  9869. +int av_dict_copy(AVDictionary** dst, const AVDictionary* src, int flags);
  9870. +
  9871. +/**
  9872. + * Free all the memory allocated for an AVDictionary struct
  9873. + * and all keys and values.
  9874. + */
  9875. +void av_dict_free(AVDictionary** m);
  9876. +
  9877. +/**
  9878. + * Get dictionary entries as a string.
  9879. + *
  9880. + * Create a string containing dictionary's entries.
  9881. + * Such string may be passed back to av_dict_parse_string().
  9882. + * @note String is escaped with backslashes ('\').
  9883. + *
  9884. + * @warning Separators cannot be neither '\\' nor '\0'. They also cannot be the
  9885. + * same.
  9886. + *
  9887. + * @param[in] m The dictionary
  9888. + * @param[out] buffer Pointer to buffer that will be allocated with
  9889. + * string containg entries. Buffer must be freed by the caller when is no longer
  9890. + * needed.
  9891. + * @param[in] key_val_sep Character used to separate key from value
  9892. + * @param[in] pairs_sep Character used to separate two pairs from each
  9893. + * other
  9894. + *
  9895. + * @return >= 0 on success, negative on error
  9896. + */
  9897. +int av_dict_get_string(const AVDictionary* m, char** buffer,
  9898. + const char key_val_sep, const char pairs_sep);
  9899. +
  9900. +/**
  9901. + * @}
  9902. + */
  9903. +
  9904. +#endif /* AVUTIL_DICT_H */
  9905. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/error.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/error.h
  9906. new file mode 100644
  9907. index 00000000..74af5b15
  9908. --- /dev/null
  9909. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/error.h
  9910. @@ -0,0 +1,158 @@
  9911. +/*
  9912. + * This file is part of FFmpeg.
  9913. + *
  9914. + * FFmpeg is free software; you can redistribute it and/or
  9915. + * modify it under the terms of the GNU Lesser General Public
  9916. + * License as published by the Free Software Foundation; either
  9917. + * version 2.1 of the License, or (at your option) any later version.
  9918. + *
  9919. + * FFmpeg is distributed in the hope that it will be useful,
  9920. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9921. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  9922. + * Lesser General Public License for more details.
  9923. + *
  9924. + * You should have received a copy of the GNU Lesser General Public
  9925. + * License along with FFmpeg; if not, write to the Free Software
  9926. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  9927. + */
  9928. +
  9929. +/**
  9930. + * @file
  9931. + * error code definitions
  9932. + */
  9933. +
  9934. +#ifndef AVUTIL_ERROR_H
  9935. +#define AVUTIL_ERROR_H
  9936. +
  9937. +#include <errno.h>
  9938. +#include <stddef.h>
  9939. +
  9940. +#include "macros.h"
  9941. +
  9942. +/**
  9943. + * @addtogroup lavu_error
  9944. + *
  9945. + * @{
  9946. + */
  9947. +
  9948. +/* error handling */
  9949. +#if EDOM > 0
  9950. +# define AVERROR(e) \
  9951. + (-(e)) ///< Returns a negative error code from a POSIX error code, to
  9952. + ///< return from library functions.
  9953. +# define AVUNERROR(e) \
  9954. + (-(e)) ///< Returns a POSIX error code from a library function error return
  9955. + ///< value.
  9956. +#else
  9957. +/* Some platforms have E* and errno already negated. */
  9958. +# define AVERROR(e) (e)
  9959. +# define AVUNERROR(e) (e)
  9960. +#endif
  9961. +
  9962. +#define FFERRTAG(a, b, c, d) (-(int)MKTAG(a, b, c, d))
  9963. +
  9964. +#define AVERROR_BSF_NOT_FOUND \
  9965. + FFERRTAG(0xF8, 'B', 'S', 'F') ///< Bitstream filter not found
  9966. +#define AVERROR_BUG \
  9967. + FFERRTAG('B', 'U', 'G', '!') ///< Internal bug, also see AVERROR_BUG2
  9968. +#define AVERROR_BUFFER_TOO_SMALL \
  9969. + FFERRTAG('B', 'U', 'F', 'S') ///< Buffer too small
  9970. +#define AVERROR_DECODER_NOT_FOUND \
  9971. + FFERRTAG(0xF8, 'D', 'E', 'C') ///< Decoder not found
  9972. +#define AVERROR_DEMUXER_NOT_FOUND \
  9973. + FFERRTAG(0xF8, 'D', 'E', 'M') ///< Demuxer not found
  9974. +#define AVERROR_ENCODER_NOT_FOUND \
  9975. + FFERRTAG(0xF8, 'E', 'N', 'C') ///< Encoder not found
  9976. +#define AVERROR_EOF FFERRTAG('E', 'O', 'F', ' ') ///< End of file
  9977. +#define AVERROR_EXIT \
  9978. + FFERRTAG('E', 'X', 'I', 'T') ///< Immediate exit was requested; the called
  9979. + ///< function should not be restarted
  9980. +#define AVERROR_EXTERNAL \
  9981. + FFERRTAG('E', 'X', 'T', ' ') ///< Generic error in an external library
  9982. +#define AVERROR_FILTER_NOT_FOUND \
  9983. + FFERRTAG(0xF8, 'F', 'I', 'L') ///< Filter not found
  9984. +#define AVERROR_INVALIDDATA \
  9985. + FFERRTAG('I', 'N', 'D', 'A') ///< Invalid data found when processing input
  9986. +#define AVERROR_MUXER_NOT_FOUND \
  9987. + FFERRTAG(0xF8, 'M', 'U', 'X') ///< Muxer not found
  9988. +#define AVERROR_OPTION_NOT_FOUND \
  9989. + FFERRTAG(0xF8, 'O', 'P', 'T') ///< Option not found
  9990. +#define AVERROR_PATCHWELCOME \
  9991. + FFERRTAG('P', 'A', 'W', \
  9992. + 'E') ///< Not yet implemented in FFmpeg, patches welcome
  9993. +#define AVERROR_PROTOCOL_NOT_FOUND \
  9994. + FFERRTAG(0xF8, 'P', 'R', 'O') ///< Protocol not found
  9995. +
  9996. +#define AVERROR_STREAM_NOT_FOUND \
  9997. + FFERRTAG(0xF8, 'S', 'T', 'R') ///< Stream not found
  9998. +/**
  9999. + * This is semantically identical to AVERROR_BUG
  10000. + * it has been introduced in Libav after our AVERROR_BUG and with a modified
  10001. + * value.
  10002. + */
  10003. +#define AVERROR_BUG2 FFERRTAG('B', 'U', 'G', ' ')
  10004. +#define AVERROR_UNKNOWN \
  10005. + FFERRTAG('U', 'N', 'K', \
  10006. + 'N') ///< Unknown error, typically from an external library
  10007. +#define AVERROR_EXPERIMENTAL \
  10008. + (-0x2bb2afa8) ///< Requested feature is flagged experimental. Set
  10009. + ///< strict_std_compliance if you really want to use it.
  10010. +#define AVERROR_INPUT_CHANGED \
  10011. + (-0x636e6701) ///< Input changed between calls. Reconfiguration is required.
  10012. + ///< (can be OR-ed with AVERROR_OUTPUT_CHANGED)
  10013. +#define AVERROR_OUTPUT_CHANGED \
  10014. + (-0x636e6702) ///< Output changed between calls. Reconfiguration is required.
  10015. + ///< (can be OR-ed with AVERROR_INPUT_CHANGED)
  10016. +/* HTTP & RTSP errors */
  10017. +#define AVERROR_HTTP_BAD_REQUEST FFERRTAG(0xF8, '4', '0', '0')
  10018. +#define AVERROR_HTTP_UNAUTHORIZED FFERRTAG(0xF8, '4', '0', '1')
  10019. +#define AVERROR_HTTP_FORBIDDEN FFERRTAG(0xF8, '4', '0', '3')
  10020. +#define AVERROR_HTTP_NOT_FOUND FFERRTAG(0xF8, '4', '0', '4')
  10021. +#define AVERROR_HTTP_OTHER_4XX FFERRTAG(0xF8, '4', 'X', 'X')
  10022. +#define AVERROR_HTTP_SERVER_ERROR FFERRTAG(0xF8, '5', 'X', 'X')
  10023. +
  10024. +#define AV_ERROR_MAX_STRING_SIZE 64
  10025. +
  10026. +/**
  10027. + * Put a description of the AVERROR code errnum in errbuf.
  10028. + * In case of failure the global variable errno is set to indicate the
  10029. + * error. Even in case of failure av_strerror() will print a generic
  10030. + * error message indicating the errnum provided to errbuf.
  10031. + *
  10032. + * @param errnum error code to describe
  10033. + * @param errbuf buffer to which description is written
  10034. + * @param errbuf_size the size in bytes of errbuf
  10035. + * @return 0 on success, a negative value if a description for errnum
  10036. + * cannot be found
  10037. + */
  10038. +int av_strerror(int errnum, char* errbuf, size_t errbuf_size);
  10039. +
  10040. +/**
  10041. + * Fill the provided buffer with a string containing an error string
  10042. + * corresponding to the AVERROR code errnum.
  10043. + *
  10044. + * @param errbuf a buffer
  10045. + * @param errbuf_size size in bytes of errbuf
  10046. + * @param errnum error code to describe
  10047. + * @return the buffer in input, filled with the error description
  10048. + * @see av_strerror()
  10049. + */
  10050. +static inline char* av_make_error_string(char* errbuf, size_t errbuf_size,
  10051. + int errnum) {
  10052. + av_strerror(errnum, errbuf, errbuf_size);
  10053. + return errbuf;
  10054. +}
  10055. +
  10056. +/**
  10057. + * Convenience macro, the return value should be used only directly in
  10058. + * function arguments but never stand-alone.
  10059. + */
  10060. +#define av_err2str(errnum) \
  10061. + av_make_error_string((char[AV_ERROR_MAX_STRING_SIZE]){0}, \
  10062. + AV_ERROR_MAX_STRING_SIZE, errnum)
  10063. +
  10064. +/**
  10065. + * @}
  10066. + */
  10067. +
  10068. +#endif /* AVUTIL_ERROR_H */
  10069. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/frame.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/frame.h
  10070. new file mode 100644
  10071. index 00000000..3b4f1e84
  10072. --- /dev/null
  10073. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/frame.h
  10074. @@ -0,0 +1,960 @@
  10075. +/*
  10076. + * This file is part of FFmpeg.
  10077. + *
  10078. + * FFmpeg is free software; you can redistribute it and/or
  10079. + * modify it under the terms of the GNU Lesser General Public
  10080. + * License as published by the Free Software Foundation; either
  10081. + * version 2.1 of the License, or (at your option) any later version.
  10082. + *
  10083. + * FFmpeg is distributed in the hope that it will be useful,
  10084. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10085. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10086. + * Lesser General Public License for more details.
  10087. + *
  10088. + * You should have received a copy of the GNU Lesser General Public
  10089. + * License along with FFmpeg; if not, write to the Free Software
  10090. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  10091. + */
  10092. +
  10093. +/**
  10094. + * @file
  10095. + * @ingroup lavu_frame
  10096. + * reference-counted frame API
  10097. + */
  10098. +
  10099. +#ifndef AVUTIL_FRAME_H
  10100. +#define AVUTIL_FRAME_H
  10101. +
  10102. +#include <stddef.h>
  10103. +#include <stdint.h>
  10104. +
  10105. +#include "avutil.h"
  10106. +#include "buffer.h"
  10107. +#include "channel_layout.h"
  10108. +#include "dict.h"
  10109. +#include "rational.h"
  10110. +#include "samplefmt.h"
  10111. +#include "pixfmt.h"
  10112. +#include "version.h"
  10113. +
  10114. +/**
  10115. + * @defgroup lavu_frame AVFrame
  10116. + * @ingroup lavu_data
  10117. + *
  10118. + * @{
  10119. + * AVFrame is an abstraction for reference-counted raw multimedia data.
  10120. + */
  10121. +
  10122. +enum AVFrameSideDataType {
  10123. + /**
  10124. + * The data is the AVPanScan struct defined in libavcodec.
  10125. + */
  10126. + AV_FRAME_DATA_PANSCAN,
  10127. + /**
  10128. + * ATSC A53 Part 4 Closed Captions.
  10129. + * A53 CC bitstream is stored as uint8_t in AVFrameSideData.data.
  10130. + * The number of bytes of CC data is AVFrameSideData.size.
  10131. + */
  10132. + AV_FRAME_DATA_A53_CC,
  10133. + /**
  10134. + * Stereoscopic 3d metadata.
  10135. + * The data is the AVStereo3D struct defined in libavutil/stereo3d.h.
  10136. + */
  10137. + AV_FRAME_DATA_STEREO3D,
  10138. + /**
  10139. + * The data is the AVMatrixEncoding enum defined in
  10140. + * libavutil/channel_layout.h.
  10141. + */
  10142. + AV_FRAME_DATA_MATRIXENCODING,
  10143. + /**
  10144. + * Metadata relevant to a downmix procedure.
  10145. + * The data is the AVDownmixInfo struct defined in libavutil/downmix_info.h.
  10146. + */
  10147. + AV_FRAME_DATA_DOWNMIX_INFO,
  10148. + /**
  10149. + * ReplayGain information in the form of the AVReplayGain struct.
  10150. + */
  10151. + AV_FRAME_DATA_REPLAYGAIN,
  10152. + /**
  10153. + * This side data contains a 3x3 transformation matrix describing an affine
  10154. + * transformation that needs to be applied to the frame for correct
  10155. + * presentation.
  10156. + *
  10157. + * See libavutil/display.h for a detailed description of the data.
  10158. + */
  10159. + AV_FRAME_DATA_DISPLAYMATRIX,
  10160. + /**
  10161. + * Active Format Description data consisting of a single byte as specified
  10162. + * in ETSI TS 101 154 using AVActiveFormatDescription enum.
  10163. + */
  10164. + AV_FRAME_DATA_AFD,
  10165. + /**
  10166. + * Motion vectors exported by some codecs (on demand through the export_mvs
  10167. + * flag set in the libavcodec AVCodecContext flags2 option).
  10168. + * The data is the AVMotionVector struct defined in
  10169. + * libavutil/motion_vector.h.
  10170. + */
  10171. + AV_FRAME_DATA_MOTION_VECTORS,
  10172. + /**
  10173. + * Recommmends skipping the specified number of samples. This is exported
  10174. + * only if the "skip_manual" AVOption is set in libavcodec.
  10175. + * This has the same format as AV_PKT_DATA_SKIP_SAMPLES.
  10176. + * @code
  10177. + * u32le number of samples to skip from start of this packet
  10178. + * u32le number of samples to skip from end of this packet
  10179. + * u8 reason for start skip
  10180. + * u8 reason for end skip (0=padding silence, 1=convergence)
  10181. + * @endcode
  10182. + */
  10183. + AV_FRAME_DATA_SKIP_SAMPLES,
  10184. + /**
  10185. + * This side data must be associated with an audio frame and corresponds to
  10186. + * enum AVAudioServiceType defined in avcodec.h.
  10187. + */
  10188. + AV_FRAME_DATA_AUDIO_SERVICE_TYPE,
  10189. + /**
  10190. + * Mastering display metadata associated with a video frame. The payload is
  10191. + * an AVMasteringDisplayMetadata type and contains information about the
  10192. + * mastering display color volume.
  10193. + */
  10194. + AV_FRAME_DATA_MASTERING_DISPLAY_METADATA,
  10195. + /**
  10196. + * The GOP timecode in 25 bit timecode format. Data format is 64-bit integer.
  10197. + * This is set on the first frame of a GOP that has a temporal reference of 0.
  10198. + */
  10199. + AV_FRAME_DATA_GOP_TIMECODE,
  10200. +
  10201. + /**
  10202. + * The data represents the AVSphericalMapping structure defined in
  10203. + * libavutil/spherical.h.
  10204. + */
  10205. + AV_FRAME_DATA_SPHERICAL,
  10206. +
  10207. + /**
  10208. + * Content light level (based on CTA-861.3). This payload contains data in
  10209. + * the form of the AVContentLightMetadata struct.
  10210. + */
  10211. + AV_FRAME_DATA_CONTENT_LIGHT_LEVEL,
  10212. +
  10213. + /**
  10214. + * The data contains an ICC profile as an opaque octet buffer following the
  10215. + * format described by ISO 15076-1 with an optional name defined in the
  10216. + * metadata key entry "name".
  10217. + */
  10218. + AV_FRAME_DATA_ICC_PROFILE,
  10219. +
  10220. + /**
  10221. + * Timecode which conforms to SMPTE ST 12-1. The data is an array of 4
  10222. + * uint32_t where the first uint32_t describes how many (1-3) of the other
  10223. + * timecodes are used. The timecode format is described in the documentation
  10224. + * of av_timecode_get_smpte_from_framenum() function in libavutil/timecode.h.
  10225. + */
  10226. + AV_FRAME_DATA_S12M_TIMECODE,
  10227. +
  10228. + /**
  10229. + * HDR dynamic metadata associated with a video frame. The payload is
  10230. + * an AVDynamicHDRPlus type and contains information for color
  10231. + * volume transform - application 4 of SMPTE 2094-40:2016 standard.
  10232. + */
  10233. + AV_FRAME_DATA_DYNAMIC_HDR_PLUS,
  10234. +
  10235. + /**
  10236. + * Regions Of Interest, the data is an array of AVRegionOfInterest type, the
  10237. + * number of array element is implied by AVFrameSideData.size /
  10238. + * AVRegionOfInterest.self_size.
  10239. + */
  10240. + AV_FRAME_DATA_REGIONS_OF_INTEREST,
  10241. +
  10242. + /**
  10243. + * Encoding parameters for a video frame, as described by AVVideoEncParams.
  10244. + */
  10245. + AV_FRAME_DATA_VIDEO_ENC_PARAMS,
  10246. +
  10247. + /**
  10248. + * User data unregistered metadata associated with a video frame.
  10249. + * This is the H.26[45] UDU SEI message, and shouldn't be used for any other
  10250. + * purpose The data is stored as uint8_t in AVFrameSideData.data which is 16
  10251. + * bytes of uuid_iso_iec_11578 followed by AVFrameSideData.size - 16 bytes of
  10252. + * user_data_payload_byte.
  10253. + */
  10254. + AV_FRAME_DATA_SEI_UNREGISTERED,
  10255. +
  10256. + /**
  10257. + * Film grain parameters for a frame, described by AVFilmGrainParams.
  10258. + * Must be present for every frame which should have film grain applied.
  10259. + */
  10260. + AV_FRAME_DATA_FILM_GRAIN_PARAMS,
  10261. +
  10262. + /**
  10263. + * Bounding boxes for object detection and classification,
  10264. + * as described by AVDetectionBBoxHeader.
  10265. + */
  10266. + AV_FRAME_DATA_DETECTION_BBOXES,
  10267. +
  10268. + /**
  10269. + * Dolby Vision RPU raw data, suitable for passing to x265
  10270. + * or other libraries. Array of uint8_t, with NAL emulation
  10271. + * bytes intact.
  10272. + */
  10273. + AV_FRAME_DATA_DOVI_RPU_BUFFER,
  10274. +
  10275. + /**
  10276. + * Parsed Dolby Vision metadata, suitable for passing to a software
  10277. + * implementation. The payload is the AVDOVIMetadata struct defined in
  10278. + * libavutil/dovi_meta.h.
  10279. + */
  10280. + AV_FRAME_DATA_DOVI_METADATA,
  10281. +
  10282. + /**
  10283. + * HDR Vivid dynamic metadata associated with a video frame. The payload is
  10284. + * an AVDynamicHDRVivid type and contains information for color
  10285. + * volume transform - CUVA 005.1-2021.
  10286. + */
  10287. + AV_FRAME_DATA_DYNAMIC_HDR_VIVID,
  10288. +
  10289. + /**
  10290. + * Ambient viewing environment metadata, as defined by H.274.
  10291. + */
  10292. + AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT,
  10293. +};
  10294. +
  10295. +enum AVActiveFormatDescription {
  10296. + AV_AFD_SAME = 8,
  10297. + AV_AFD_4_3 = 9,
  10298. + AV_AFD_16_9 = 10,
  10299. + AV_AFD_14_9 = 11,
  10300. + AV_AFD_4_3_SP_14_9 = 13,
  10301. + AV_AFD_16_9_SP_14_9 = 14,
  10302. + AV_AFD_SP_4_3 = 15,
  10303. +};
  10304. +
  10305. +/**
  10306. + * Structure to hold side data for an AVFrame.
  10307. + *
  10308. + * sizeof(AVFrameSideData) is not a part of the public ABI, so new fields may be
  10309. + * added to the end with a minor bump.
  10310. + */
  10311. +typedef struct AVFrameSideData {
  10312. + enum AVFrameSideDataType type;
  10313. + uint8_t* data;
  10314. + size_t size;
  10315. + AVDictionary* metadata;
  10316. + AVBufferRef* buf;
  10317. +} AVFrameSideData;
  10318. +
  10319. +/**
  10320. + * Structure describing a single Region Of Interest.
  10321. + *
  10322. + * When multiple regions are defined in a single side-data block, they
  10323. + * should be ordered from most to least important - some encoders are only
  10324. + * capable of supporting a limited number of distinct regions, so will have
  10325. + * to truncate the list.
  10326. + *
  10327. + * When overlapping regions are defined, the first region containing a given
  10328. + * area of the frame applies.
  10329. + */
  10330. +typedef struct AVRegionOfInterest {
  10331. + /**
  10332. + * Must be set to the size of this data structure (that is,
  10333. + * sizeof(AVRegionOfInterest)).
  10334. + */
  10335. + uint32_t self_size;
  10336. + /**
  10337. + * Distance in pixels from the top edge of the frame to the top and
  10338. + * bottom edges and from the left edge of the frame to the left and
  10339. + * right edges of the rectangle defining this region of interest.
  10340. + *
  10341. + * The constraints on a region are encoder dependent, so the region
  10342. + * actually affected may be slightly larger for alignment or other
  10343. + * reasons.
  10344. + */
  10345. + int top;
  10346. + int bottom;
  10347. + int left;
  10348. + int right;
  10349. + /**
  10350. + * Quantisation offset.
  10351. + *
  10352. + * Must be in the range -1 to +1. A value of zero indicates no quality
  10353. + * change. A negative value asks for better quality (less quantisation),
  10354. + * while a positive value asks for worse quality (greater quantisation).
  10355. + *
  10356. + * The range is calibrated so that the extreme values indicate the
  10357. + * largest possible offset - if the rest of the frame is encoded with the
  10358. + * worst possible quality, an offset of -1 indicates that this region
  10359. + * should be encoded with the best possible quality anyway. Intermediate
  10360. + * values are then interpolated in some codec-dependent way.
  10361. + *
  10362. + * For example, in 10-bit H.264 the quantisation parameter varies between
  10363. + * -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  10364. + * this region should be encoded with a QP around one-tenth of the full
  10365. + * range better than the rest of the frame. So, if most of the frame
  10366. + * were to be encoded with a QP of around 30, this region would get a QP
  10367. + * of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  10368. + * An extreme value of -1 would indicate that this region should be
  10369. + * encoded with the best possible quality regardless of the treatment of
  10370. + * the rest of the frame - that is, should be encoded at a QP of -12.
  10371. + */
  10372. + AVRational qoffset;
  10373. +} AVRegionOfInterest;
  10374. +
  10375. +/**
  10376. + * This structure describes decoded (raw) audio or video data.
  10377. + *
  10378. + * AVFrame must be allocated using av_frame_alloc(). Note that this only
  10379. + * allocates the AVFrame itself, the buffers for the data must be managed
  10380. + * through other means (see below).
  10381. + * AVFrame must be freed with av_frame_free().
  10382. + *
  10383. + * AVFrame is typically allocated once and then reused multiple times to hold
  10384. + * different data (e.g. a single AVFrame to hold frames received from a
  10385. + * decoder). In such a case, av_frame_unref() will free any references held by
  10386. + * the frame and reset it to its original clean state before it
  10387. + * is reused again.
  10388. + *
  10389. + * The data described by an AVFrame is usually reference counted through the
  10390. + * AVBuffer API. The underlying buffer references are stored in AVFrame.buf /
  10391. + * AVFrame.extended_buf. An AVFrame is considered to be reference counted if at
  10392. + * least one reference is set, i.e. if AVFrame.buf[0] != NULL. In such a case,
  10393. + * every single data plane must be contained in one of the buffers in
  10394. + * AVFrame.buf or AVFrame.extended_buf.
  10395. + * There may be a single buffer for all the data, or one separate buffer for
  10396. + * each plane, or anything in between.
  10397. + *
  10398. + * sizeof(AVFrame) is not a part of the public ABI, so new fields may be added
  10399. + * to the end with a minor bump.
  10400. + *
  10401. + * Fields can be accessed through AVOptions, the name string used, matches the
  10402. + * C structure field name for fields accessible through AVOptions. The AVClass
  10403. + * for AVFrame can be obtained from avcodec_get_frame_class()
  10404. + */
  10405. +typedef struct AVFrame {
  10406. +#define AV_NUM_DATA_POINTERS 8
  10407. + /**
  10408. + * pointer to the picture/channel planes.
  10409. + * This might be different from the first allocated byte. For video,
  10410. + * it could even point to the end of the image data.
  10411. + *
  10412. + * All pointers in data and extended_data must point into one of the
  10413. + * AVBufferRef in buf or extended_buf.
  10414. + *
  10415. + * Some decoders access areas outside 0,0 - width,height, please
  10416. + * see avcodec_align_dimensions2(). Some filters and swscale can read
  10417. + * up to 16 bytes beyond the planes, if these filters are to be used,
  10418. + * then 16 extra bytes must be allocated.
  10419. + *
  10420. + * NOTE: Pointers not needed by the format MUST be set to NULL.
  10421. + *
  10422. + * @attention In case of video, the data[] pointers can point to the
  10423. + * end of image data in order to reverse line order, when used in
  10424. + * combination with negative values in the linesize[] array.
  10425. + */
  10426. + uint8_t* data[AV_NUM_DATA_POINTERS];
  10427. +
  10428. + /**
  10429. + * For video, a positive or negative value, which is typically indicating
  10430. + * the size in bytes of each picture line, but it can also be:
  10431. + * - the negative byte size of lines for vertical flipping
  10432. + * (with data[n] pointing to the end of the data
  10433. + * - a positive or negative multiple of the byte size as for accessing
  10434. + * even and odd fields of a frame (possibly flipped)
  10435. + *
  10436. + * For audio, only linesize[0] may be set. For planar audio, each channel
  10437. + * plane must be the same size.
  10438. + *
  10439. + * For video the linesizes should be multiples of the CPUs alignment
  10440. + * preference, this is 16 or 32 for modern desktop CPUs.
  10441. + * Some code requires such alignment other code can be slower without
  10442. + * correct alignment, for yet other it makes no difference.
  10443. + *
  10444. + * @note The linesize may be larger than the size of usable data -- there
  10445. + * may be extra padding present for performance reasons.
  10446. + *
  10447. + * @attention In case of video, line size values can be negative to achieve
  10448. + * a vertically inverted iteration over image lines.
  10449. + */
  10450. + int linesize[AV_NUM_DATA_POINTERS];
  10451. +
  10452. + /**
  10453. + * pointers to the data planes/channels.
  10454. + *
  10455. + * For video, this should simply point to data[].
  10456. + *
  10457. + * For planar audio, each channel has a separate data pointer, and
  10458. + * linesize[0] contains the size of each channel buffer.
  10459. + * For packed audio, there is just one data pointer, and linesize[0]
  10460. + * contains the total size of the buffer for all channels.
  10461. + *
  10462. + * Note: Both data and extended_data should always be set in a valid frame,
  10463. + * but for planar audio with more channels that can fit in data,
  10464. + * extended_data must be used in order to access all channels.
  10465. + */
  10466. + uint8_t** extended_data;
  10467. +
  10468. + /**
  10469. + * @name Video dimensions
  10470. + * Video frames only. The coded dimensions (in pixels) of the video frame,
  10471. + * i.e. the size of the rectangle that contains some well-defined values.
  10472. + *
  10473. + * @note The part of the frame intended for display/presentation is further
  10474. + * restricted by the @ref cropping "Cropping rectangle".
  10475. + * @{
  10476. + */
  10477. + int width, height;
  10478. + /**
  10479. + * @}
  10480. + */
  10481. +
  10482. + /**
  10483. + * number of audio samples (per channel) described by this frame
  10484. + */
  10485. + int nb_samples;
  10486. +
  10487. + /**
  10488. + * format of the frame, -1 if unknown or unset
  10489. + * Values correspond to enum AVPixelFormat for video frames,
  10490. + * enum AVSampleFormat for audio)
  10491. + */
  10492. + int format;
  10493. +
  10494. + /**
  10495. + * 1 -> keyframe, 0-> not
  10496. + */
  10497. + int key_frame;
  10498. +
  10499. + /**
  10500. + * Picture type of the frame.
  10501. + */
  10502. + enum AVPictureType pict_type;
  10503. +
  10504. + /**
  10505. + * Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
  10506. + */
  10507. + AVRational sample_aspect_ratio;
  10508. +
  10509. + /**
  10510. + * Presentation timestamp in time_base units (time when frame should be shown
  10511. + * to user).
  10512. + */
  10513. + int64_t pts;
  10514. +
  10515. + /**
  10516. + * DTS copied from the AVPacket that triggered returning this frame. (if frame
  10517. + * threading isn't used) This is also the Presentation time of this AVFrame
  10518. + * calculated from only AVPacket.dts values without pts values.
  10519. + */
  10520. + int64_t pkt_dts;
  10521. +
  10522. + /**
  10523. + * Time base for the timestamps in this frame.
  10524. + * In the future, this field may be set on frames output by decoders or
  10525. + * filters, but its value will be by default ignored on input to encoders
  10526. + * or filters.
  10527. + */
  10528. + AVRational time_base;
  10529. +
  10530. +#if FF_API_FRAME_PICTURE_NUMBER
  10531. + /**
  10532. + * picture number in bitstream order
  10533. + */
  10534. + attribute_deprecated int coded_picture_number;
  10535. + /**
  10536. + * picture number in display order
  10537. + */
  10538. + attribute_deprecated int display_picture_number;
  10539. +#endif
  10540. +
  10541. + /**
  10542. + * quality (between 1 (good) and FF_LAMBDA_MAX (bad))
  10543. + */
  10544. + int quality;
  10545. +
  10546. + /**
  10547. + * for some private data of the user
  10548. + */
  10549. + void* opaque;
  10550. +
  10551. + /**
  10552. + * When decoding, this signals how much the picture must be delayed.
  10553. + * extra_delay = repeat_pict / (2*fps)
  10554. + */
  10555. + int repeat_pict;
  10556. +
  10557. + /**
  10558. + * The content of the picture is interlaced.
  10559. + */
  10560. + int interlaced_frame;
  10561. +
  10562. + /**
  10563. + * If the content is interlaced, is top field displayed first.
  10564. + */
  10565. + int top_field_first;
  10566. +
  10567. + /**
  10568. + * Tell user application that palette has changed from previous frame.
  10569. + */
  10570. + int palette_has_changed;
  10571. +
  10572. +#if FF_API_REORDERED_OPAQUE
  10573. + /**
  10574. + * reordered opaque 64 bits (generally an integer or a double precision float
  10575. + * PTS but can be anything).
  10576. + * The user sets AVCodecContext.reordered_opaque to represent the input at
  10577. + * that time,
  10578. + * the decoder reorders values as needed and sets AVFrame.reordered_opaque
  10579. + * to exactly one of the values provided by the user through
  10580. + * AVCodecContext.reordered_opaque
  10581. + *
  10582. + * @deprecated Use AV_CODEC_FLAG_COPY_OPAQUE instead
  10583. + */
  10584. + attribute_deprecated int64_t reordered_opaque;
  10585. +#endif
  10586. +
  10587. + /**
  10588. + * Sample rate of the audio data.
  10589. + */
  10590. + int sample_rate;
  10591. +
  10592. +#if FF_API_OLD_CHANNEL_LAYOUT
  10593. + /**
  10594. + * Channel layout of the audio data.
  10595. + * @deprecated use ch_layout instead
  10596. + */
  10597. + attribute_deprecated uint64_t channel_layout;
  10598. +#endif
  10599. +
  10600. + /**
  10601. + * AVBuffer references backing the data for this frame. All the pointers in
  10602. + * data and extended_data must point inside one of the buffers in buf or
  10603. + * extended_buf. This array must be filled contiguously -- if buf[i] is
  10604. + * non-NULL then buf[j] must also be non-NULL for all j < i.
  10605. + *
  10606. + * There may be at most one AVBuffer per data plane, so for video this array
  10607. + * always contains all the references. For planar audio with more than
  10608. + * AV_NUM_DATA_POINTERS channels, there may be more buffers than can fit in
  10609. + * this array. Then the extra AVBufferRef pointers are stored in the
  10610. + * extended_buf array.
  10611. + */
  10612. + AVBufferRef* buf[AV_NUM_DATA_POINTERS];
  10613. +
  10614. + /**
  10615. + * For planar audio which requires more than AV_NUM_DATA_POINTERS
  10616. + * AVBufferRef pointers, this array will hold all the references which
  10617. + * cannot fit into AVFrame.buf.
  10618. + *
  10619. + * Note that this is different from AVFrame.extended_data, which always
  10620. + * contains all the pointers. This array only contains the extra pointers,
  10621. + * which cannot fit into AVFrame.buf.
  10622. + *
  10623. + * This array is always allocated using av_malloc() by whoever constructs
  10624. + * the frame. It is freed in av_frame_unref().
  10625. + */
  10626. + AVBufferRef** extended_buf;
  10627. + /**
  10628. + * Number of elements in extended_buf.
  10629. + */
  10630. + int nb_extended_buf;
  10631. +
  10632. + AVFrameSideData** side_data;
  10633. + int nb_side_data;
  10634. +
  10635. +/**
  10636. + * @defgroup lavu_frame_flags AV_FRAME_FLAGS
  10637. + * @ingroup lavu_frame
  10638. + * Flags describing additional frame properties.
  10639. + *
  10640. + * @{
  10641. + */
  10642. +
  10643. +/**
  10644. + * The frame data may be corrupted, e.g. due to decoding errors.
  10645. + */
  10646. +#define AV_FRAME_FLAG_CORRUPT (1 << 0)
  10647. +/**
  10648. + * A flag to mark the frames which need to be decoded, but shouldn't be output.
  10649. + */
  10650. +#define AV_FRAME_FLAG_DISCARD (1 << 2)
  10651. + /**
  10652. + * @}
  10653. + */
  10654. +
  10655. + /**
  10656. + * Frame flags, a combination of @ref lavu_frame_flags
  10657. + */
  10658. + int flags;
  10659. +
  10660. + /**
  10661. + * MPEG vs JPEG YUV range.
  10662. + * - encoding: Set by user
  10663. + * - decoding: Set by libavcodec
  10664. + */
  10665. + enum AVColorRange color_range;
  10666. +
  10667. + enum AVColorPrimaries color_primaries;
  10668. +
  10669. + enum AVColorTransferCharacteristic color_trc;
  10670. +
  10671. + /**
  10672. + * YUV colorspace type.
  10673. + * - encoding: Set by user
  10674. + * - decoding: Set by libavcodec
  10675. + */
  10676. + enum AVColorSpace colorspace;
  10677. +
  10678. + enum AVChromaLocation chroma_location;
  10679. +
  10680. + /**
  10681. + * frame timestamp estimated using various heuristics, in stream time base
  10682. + * - encoding: unused
  10683. + * - decoding: set by libavcodec, read by user.
  10684. + */
  10685. + int64_t best_effort_timestamp;
  10686. +
  10687. + /**
  10688. + * reordered pos from the last AVPacket that has been input into the decoder
  10689. + * - encoding: unused
  10690. + * - decoding: Read by user.
  10691. + */
  10692. + int64_t pkt_pos;
  10693. +
  10694. +#if FF_API_PKT_DURATION
  10695. + /**
  10696. + * duration of the corresponding packet, expressed in
  10697. + * AVStream->time_base units, 0 if unknown.
  10698. + * - encoding: unused
  10699. + * - decoding: Read by user.
  10700. + *
  10701. + * @deprecated use duration instead
  10702. + */
  10703. + attribute_deprecated int64_t pkt_duration;
  10704. +#endif
  10705. +
  10706. + /**
  10707. + * metadata.
  10708. + * - encoding: Set by user.
  10709. + * - decoding: Set by libavcodec.
  10710. + */
  10711. + AVDictionary* metadata;
  10712. +
  10713. + /**
  10714. + * decode error flags of the frame, set to a combination of
  10715. + * FF_DECODE_ERROR_xxx flags if the decoder produced a frame, but there
  10716. + * were errors during the decoding.
  10717. + * - encoding: unused
  10718. + * - decoding: set by libavcodec, read by user.
  10719. + */
  10720. + int decode_error_flags;
  10721. +#define FF_DECODE_ERROR_INVALID_BITSTREAM 1
  10722. +#define FF_DECODE_ERROR_MISSING_REFERENCE 2
  10723. +#define FF_DECODE_ERROR_CONCEALMENT_ACTIVE 4
  10724. +#define FF_DECODE_ERROR_DECODE_SLICES 8
  10725. +
  10726. +#if FF_API_OLD_CHANNEL_LAYOUT
  10727. + /**
  10728. + * number of audio channels, only used for audio.
  10729. + * - encoding: unused
  10730. + * - decoding: Read by user.
  10731. + * @deprecated use ch_layout instead
  10732. + */
  10733. + attribute_deprecated int channels;
  10734. +#endif
  10735. +
  10736. + /**
  10737. + * size of the corresponding packet containing the compressed
  10738. + * frame.
  10739. + * It is set to a negative value if unknown.
  10740. + * - encoding: unused
  10741. + * - decoding: set by libavcodec, read by user.
  10742. + */
  10743. + int pkt_size;
  10744. +
  10745. + /**
  10746. + * For hwaccel-format frames, this should be a reference to the
  10747. + * AVHWFramesContext describing the frame.
  10748. + */
  10749. + AVBufferRef* hw_frames_ctx;
  10750. +
  10751. + /**
  10752. + * AVBufferRef for free use by the API user. FFmpeg will never check the
  10753. + * contents of the buffer ref. FFmpeg calls av_buffer_unref() on it when
  10754. + * the frame is unreferenced. av_frame_copy_props() calls create a new
  10755. + * reference with av_buffer_ref() for the target frame's opaque_ref field.
  10756. + *
  10757. + * This is unrelated to the opaque field, although it serves a similar
  10758. + * purpose.
  10759. + */
  10760. + AVBufferRef* opaque_ref;
  10761. +
  10762. + /**
  10763. + * @anchor cropping
  10764. + * @name Cropping
  10765. + * Video frames only. The number of pixels to discard from the the
  10766. + * top/bottom/left/right border of the frame to obtain the sub-rectangle of
  10767. + * the frame intended for presentation.
  10768. + * @{
  10769. + */
  10770. + size_t crop_top;
  10771. + size_t crop_bottom;
  10772. + size_t crop_left;
  10773. + size_t crop_right;
  10774. + /**
  10775. + * @}
  10776. + */
  10777. +
  10778. + /**
  10779. + * AVBufferRef for internal use by a single libav* library.
  10780. + * Must not be used to transfer data between libraries.
  10781. + * Has to be NULL when ownership of the frame leaves the respective library.
  10782. + *
  10783. + * Code outside the FFmpeg libs should never check or change the contents of
  10784. + * the buffer ref.
  10785. + *
  10786. + * FFmpeg calls av_buffer_unref() on it when the frame is unreferenced.
  10787. + * av_frame_copy_props() calls create a new reference with av_buffer_ref()
  10788. + * for the target frame's private_ref field.
  10789. + */
  10790. + AVBufferRef* private_ref;
  10791. +
  10792. + /**
  10793. + * Channel layout of the audio data.
  10794. + */
  10795. + AVChannelLayout ch_layout;
  10796. +
  10797. + /**
  10798. + * Duration of the frame, in the same units as pts. 0 if unknown.
  10799. + */
  10800. + int64_t duration;
  10801. +} AVFrame;
  10802. +
  10803. +/**
  10804. + * Allocate an AVFrame and set its fields to default values. The resulting
  10805. + * struct must be freed using av_frame_free().
  10806. + *
  10807. + * @return An AVFrame filled with default values or NULL on failure.
  10808. + *
  10809. + * @note this only allocates the AVFrame itself, not the data buffers. Those
  10810. + * must be allocated through other means, e.g. with av_frame_get_buffer() or
  10811. + * manually.
  10812. + */
  10813. +AVFrame* av_frame_alloc(void);
  10814. +
  10815. +/**
  10816. + * Free the frame and any dynamically allocated objects in it,
  10817. + * e.g. extended_data. If the frame is reference counted, it will be
  10818. + * unreferenced first.
  10819. + *
  10820. + * @param frame frame to be freed. The pointer will be set to NULL.
  10821. + */
  10822. +void av_frame_free(AVFrame** frame);
  10823. +
  10824. +/**
  10825. + * Set up a new reference to the data described by the source frame.
  10826. + *
  10827. + * Copy frame properties from src to dst and create a new reference for each
  10828. + * AVBufferRef from src.
  10829. + *
  10830. + * If src is not reference counted, new buffers are allocated and the data is
  10831. + * copied.
  10832. + *
  10833. + * @warning: dst MUST have been either unreferenced with av_frame_unref(dst),
  10834. + * or newly allocated with av_frame_alloc() before calling this
  10835. + * function, or undefined behavior will occur.
  10836. + *
  10837. + * @return 0 on success, a negative AVERROR on error
  10838. + */
  10839. +int av_frame_ref(AVFrame* dst, const AVFrame* src);
  10840. +
  10841. +/**
  10842. + * Create a new frame that references the same data as src.
  10843. + *
  10844. + * This is a shortcut for av_frame_alloc()+av_frame_ref().
  10845. + *
  10846. + * @return newly created AVFrame on success, NULL on error.
  10847. + */
  10848. +AVFrame* av_frame_clone(const AVFrame* src);
  10849. +
  10850. +/**
  10851. + * Unreference all the buffers referenced by frame and reset the frame fields.
  10852. + */
  10853. +void av_frame_unref(AVFrame* frame);
  10854. +
  10855. +/**
  10856. + * Move everything contained in src to dst and reset src.
  10857. + *
  10858. + * @warning: dst is not unreferenced, but directly overwritten without reading
  10859. + * or deallocating its contents. Call av_frame_unref(dst) manually
  10860. + * before calling this function to ensure that no memory is leaked.
  10861. + */
  10862. +void av_frame_move_ref(AVFrame* dst, AVFrame* src);
  10863. +
  10864. +/**
  10865. + * Allocate new buffer(s) for audio or video data.
  10866. + *
  10867. + * The following fields must be set on frame before calling this function:
  10868. + * - format (pixel format for video, sample format for audio)
  10869. + * - width and height for video
  10870. + * - nb_samples and ch_layout for audio
  10871. + *
  10872. + * This function will fill AVFrame.data and AVFrame.buf arrays and, if
  10873. + * necessary, allocate and fill AVFrame.extended_data and AVFrame.extended_buf.
  10874. + * For planar formats, one buffer will be allocated for each plane.
  10875. + *
  10876. + * @warning: if frame already has been allocated, calling this function will
  10877. + * leak memory. In addition, undefined behavior can occur in certain
  10878. + * cases.
  10879. + *
  10880. + * @param frame frame in which to store the new buffers.
  10881. + * @param align Required buffer size alignment. If equal to 0, alignment will be
  10882. + * chosen automatically for the current CPU. It is highly
  10883. + * recommended to pass 0 here unless you know what you are doing.
  10884. + *
  10885. + * @return 0 on success, a negative AVERROR on error.
  10886. + */
  10887. +int av_frame_get_buffer(AVFrame* frame, int align);
  10888. +
  10889. +/**
  10890. + * Check if the frame data is writable.
  10891. + *
  10892. + * @return A positive value if the frame data is writable (which is true if and
  10893. + * only if each of the underlying buffers has only one reference, namely the one
  10894. + * stored in this frame). Return 0 otherwise.
  10895. + *
  10896. + * If 1 is returned the answer is valid until av_buffer_ref() is called on any
  10897. + * of the underlying AVBufferRefs (e.g. through av_frame_ref() or directly).
  10898. + *
  10899. + * @see av_frame_make_writable(), av_buffer_is_writable()
  10900. + */
  10901. +int av_frame_is_writable(AVFrame* frame);
  10902. +
  10903. +/**
  10904. + * Ensure that the frame data is writable, avoiding data copy if possible.
  10905. + *
  10906. + * Do nothing if the frame is writable, allocate new buffers and copy the data
  10907. + * if it is not. Non-refcounted frames behave as non-writable, i.e. a copy
  10908. + * is always made.
  10909. + *
  10910. + * @return 0 on success, a negative AVERROR on error.
  10911. + *
  10912. + * @see av_frame_is_writable(), av_buffer_is_writable(),
  10913. + * av_buffer_make_writable()
  10914. + */
  10915. +int av_frame_make_writable(AVFrame* frame);
  10916. +
  10917. +/**
  10918. + * Copy the frame data from src to dst.
  10919. + *
  10920. + * This function does not allocate anything, dst must be already initialized and
  10921. + * allocated with the same parameters as src.
  10922. + *
  10923. + * This function only copies the frame data (i.e. the contents of the data /
  10924. + * extended data arrays), not any other properties.
  10925. + *
  10926. + * @return >= 0 on success, a negative AVERROR on error.
  10927. + */
  10928. +int av_frame_copy(AVFrame* dst, const AVFrame* src);
  10929. +
  10930. +/**
  10931. + * Copy only "metadata" fields from src to dst.
  10932. + *
  10933. + * Metadata for the purpose of this function are those fields that do not affect
  10934. + * the data layout in the buffers. E.g. pts, sample rate (for audio) or sample
  10935. + * aspect ratio (for video), but not width/height or channel layout.
  10936. + * Side data is also copied.
  10937. + */
  10938. +int av_frame_copy_props(AVFrame* dst, const AVFrame* src);
  10939. +
  10940. +/**
  10941. + * Get the buffer reference a given data plane is stored in.
  10942. + *
  10943. + * @param frame the frame to get the plane's buffer from
  10944. + * @param plane index of the data plane of interest in frame->extended_data.
  10945. + *
  10946. + * @return the buffer reference that contains the plane or NULL if the input
  10947. + * frame is not valid.
  10948. + */
  10949. +AVBufferRef* av_frame_get_plane_buffer(AVFrame* frame, int plane);
  10950. +
  10951. +/**
  10952. + * Add a new side data to a frame.
  10953. + *
  10954. + * @param frame a frame to which the side data should be added
  10955. + * @param type type of the added side data
  10956. + * @param size size of the side data
  10957. + *
  10958. + * @return newly added side data on success, NULL on error
  10959. + */
  10960. +AVFrameSideData* av_frame_new_side_data(AVFrame* frame,
  10961. + enum AVFrameSideDataType type,
  10962. + size_t size);
  10963. +
  10964. +/**
  10965. + * Add a new side data to a frame from an existing AVBufferRef
  10966. + *
  10967. + * @param frame a frame to which the side data should be added
  10968. + * @param type the type of the added side data
  10969. + * @param buf an AVBufferRef to add as side data. The ownership of
  10970. + * the reference is transferred to the frame.
  10971. + *
  10972. + * @return newly added side data on success, NULL on error. On failure
  10973. + * the frame is unchanged and the AVBufferRef remains owned by
  10974. + * the caller.
  10975. + */
  10976. +AVFrameSideData* av_frame_new_side_data_from_buf(AVFrame* frame,
  10977. + enum AVFrameSideDataType type,
  10978. + AVBufferRef* buf);
  10979. +
  10980. +/**
  10981. + * @return a pointer to the side data of a given type on success, NULL if there
  10982. + * is no side data with such type in this frame.
  10983. + */
  10984. +AVFrameSideData* av_frame_get_side_data(const AVFrame* frame,
  10985. + enum AVFrameSideDataType type);
  10986. +
  10987. +/**
  10988. + * Remove and free all side data instances of the given type.
  10989. + */
  10990. +void av_frame_remove_side_data(AVFrame* frame, enum AVFrameSideDataType type);
  10991. +
  10992. +/**
  10993. + * Flags for frame cropping.
  10994. + */
  10995. +enum {
  10996. + /**
  10997. + * Apply the maximum possible cropping, even if it requires setting the
  10998. + * AVFrame.data[] entries to unaligned pointers. Passing unaligned data
  10999. + * to FFmpeg API is generally not allowed, and causes undefined behavior
  11000. + * (such as crashes). You can pass unaligned data only to FFmpeg APIs that
  11001. + * are explicitly documented to accept it. Use this flag only if you
  11002. + * absolutely know what you are doing.
  11003. + */
  11004. + AV_FRAME_CROP_UNALIGNED = 1 << 0,
  11005. +};
  11006. +
  11007. +/**
  11008. + * Crop the given video AVFrame according to its crop_left/crop_top/crop_right/
  11009. + * crop_bottom fields. If cropping is successful, the function will adjust the
  11010. + * data pointers and the width/height fields, and set the crop fields to 0.
  11011. + *
  11012. + * In all cases, the cropping boundaries will be rounded to the inherent
  11013. + * alignment of the pixel format. In some cases, such as for opaque hwaccel
  11014. + * formats, the left/top cropping is ignored. The crop fields are set to 0 even
  11015. + * if the cropping was rounded or ignored.
  11016. + *
  11017. + * @param frame the frame which should be cropped
  11018. + * @param flags Some combination of AV_FRAME_CROP_* flags, or 0.
  11019. + *
  11020. + * @return >= 0 on success, a negative AVERROR on error. If the cropping fields
  11021. + * were invalid, AVERROR(ERANGE) is returned, and nothing is changed.
  11022. + */
  11023. +int av_frame_apply_cropping(AVFrame* frame, int flags);
  11024. +
  11025. +/**
  11026. + * @return a string identifying the side data type
  11027. + */
  11028. +const char* av_frame_side_data_name(enum AVFrameSideDataType type);
  11029. +
  11030. +/**
  11031. + * @}
  11032. + */
  11033. +
  11034. +#endif /* AVUTIL_FRAME_H */
  11035. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/hwcontext.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/hwcontext.h
  11036. new file mode 100644
  11037. index 00000000..fb376ce4
  11038. --- /dev/null
  11039. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/hwcontext.h
  11040. @@ -0,0 +1,606 @@
  11041. +/*
  11042. + * This file is part of FFmpeg.
  11043. + *
  11044. + * FFmpeg is free software; you can redistribute it and/or
  11045. + * modify it under the terms of the GNU Lesser General Public
  11046. + * License as published by the Free Software Foundation; either
  11047. + * version 2.1 of the License, or (at your option) any later version.
  11048. + *
  11049. + * FFmpeg is distributed in the hope that it will be useful,
  11050. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11051. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11052. + * Lesser General Public License for more details.
  11053. + *
  11054. + * You should have received a copy of the GNU Lesser General Public
  11055. + * License along with FFmpeg; if not, write to the Free Software
  11056. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  11057. + */
  11058. +
  11059. +#ifndef AVUTIL_HWCONTEXT_H
  11060. +#define AVUTIL_HWCONTEXT_H
  11061. +
  11062. +#include "buffer.h"
  11063. +#include "frame.h"
  11064. +#include "log.h"
  11065. +#include "pixfmt.h"
  11066. +
  11067. +enum AVHWDeviceType {
  11068. + AV_HWDEVICE_TYPE_NONE,
  11069. + AV_HWDEVICE_TYPE_VDPAU,
  11070. + AV_HWDEVICE_TYPE_CUDA,
  11071. + AV_HWDEVICE_TYPE_VAAPI,
  11072. + AV_HWDEVICE_TYPE_DXVA2,
  11073. + AV_HWDEVICE_TYPE_QSV,
  11074. + AV_HWDEVICE_TYPE_VIDEOTOOLBOX,
  11075. + AV_HWDEVICE_TYPE_D3D11VA,
  11076. + AV_HWDEVICE_TYPE_DRM,
  11077. + AV_HWDEVICE_TYPE_OPENCL,
  11078. + AV_HWDEVICE_TYPE_MEDIACODEC,
  11079. + AV_HWDEVICE_TYPE_VULKAN,
  11080. +};
  11081. +
  11082. +typedef struct AVHWDeviceInternal AVHWDeviceInternal;
  11083. +
  11084. +/**
  11085. + * This struct aggregates all the (hardware/vendor-specific) "high-level" state,
  11086. + * i.e. state that is not tied to a concrete processing configuration.
  11087. + * E.g., in an API that supports hardware-accelerated encoding and decoding,
  11088. + * this struct will (if possible) wrap the state that is common to both encoding
  11089. + * and decoding and from which specific instances of encoders or decoders can be
  11090. + * derived.
  11091. + *
  11092. + * This struct is reference-counted with the AVBuffer mechanism. The
  11093. + * av_hwdevice_ctx_alloc() constructor yields a reference, whose data field
  11094. + * points to the actual AVHWDeviceContext. Further objects derived from
  11095. + * AVHWDeviceContext (such as AVHWFramesContext, describing a frame pool with
  11096. + * specific properties) will hold an internal reference to it. After all the
  11097. + * references are released, the AVHWDeviceContext itself will be freed,
  11098. + * optionally invoking a user-specified callback for uninitializing the hardware
  11099. + * state.
  11100. + */
  11101. +typedef struct AVHWDeviceContext {
  11102. + /**
  11103. + * A class for logging. Set by av_hwdevice_ctx_alloc().
  11104. + */
  11105. + const AVClass* av_class;
  11106. +
  11107. + /**
  11108. + * Private data used internally by libavutil. Must not be accessed in any
  11109. + * way by the caller.
  11110. + */
  11111. + AVHWDeviceInternal* internal;
  11112. +
  11113. + /**
  11114. + * This field identifies the underlying API used for hardware access.
  11115. + *
  11116. + * This field is set when this struct is allocated and never changed
  11117. + * afterwards.
  11118. + */
  11119. + enum AVHWDeviceType type;
  11120. +
  11121. + /**
  11122. + * The format-specific data, allocated and freed by libavutil along with
  11123. + * this context.
  11124. + *
  11125. + * Should be cast by the user to the format-specific context defined in the
  11126. + * corresponding header (hwcontext_*.h) and filled as described in the
  11127. + * documentation before calling av_hwdevice_ctx_init().
  11128. + *
  11129. + * After calling av_hwdevice_ctx_init() this struct should not be modified
  11130. + * by the caller.
  11131. + */
  11132. + void* hwctx;
  11133. +
  11134. + /**
  11135. + * This field may be set by the caller before calling av_hwdevice_ctx_init().
  11136. + *
  11137. + * If non-NULL, this callback will be called when the last reference to
  11138. + * this context is unreferenced, immediately before it is freed.
  11139. + *
  11140. + * @note when other objects (e.g an AVHWFramesContext) are derived from this
  11141. + * struct, this callback will be invoked after all such child objects
  11142. + * are fully uninitialized and their respective destructors invoked.
  11143. + */
  11144. + void (*free)(struct AVHWDeviceContext* ctx);
  11145. +
  11146. + /**
  11147. + * Arbitrary user data, to be used e.g. by the free() callback.
  11148. + */
  11149. + void* user_opaque;
  11150. +} AVHWDeviceContext;
  11151. +
  11152. +typedef struct AVHWFramesInternal AVHWFramesInternal;
  11153. +
  11154. +/**
  11155. + * This struct describes a set or pool of "hardware" frames (i.e. those with
  11156. + * data not located in normal system memory). All the frames in the pool are
  11157. + * assumed to be allocated in the same way and interchangeable.
  11158. + *
  11159. + * This struct is reference-counted with the AVBuffer mechanism and tied to a
  11160. + * given AVHWDeviceContext instance. The av_hwframe_ctx_alloc() constructor
  11161. + * yields a reference, whose data field points to the actual AVHWFramesContext
  11162. + * struct.
  11163. + */
  11164. +typedef struct AVHWFramesContext {
  11165. + /**
  11166. + * A class for logging.
  11167. + */
  11168. + const AVClass* av_class;
  11169. +
  11170. + /**
  11171. + * Private data used internally by libavutil. Must not be accessed in any
  11172. + * way by the caller.
  11173. + */
  11174. + AVHWFramesInternal* internal;
  11175. +
  11176. + /**
  11177. + * A reference to the parent AVHWDeviceContext. This reference is owned and
  11178. + * managed by the enclosing AVHWFramesContext, but the caller may derive
  11179. + * additional references from it.
  11180. + */
  11181. + AVBufferRef* device_ref;
  11182. +
  11183. + /**
  11184. + * The parent AVHWDeviceContext. This is simply a pointer to
  11185. + * device_ref->data provided for convenience.
  11186. + *
  11187. + * Set by libavutil in av_hwframe_ctx_init().
  11188. + */
  11189. + AVHWDeviceContext* device_ctx;
  11190. +
  11191. + /**
  11192. + * The format-specific data, allocated and freed automatically along with
  11193. + * this context.
  11194. + *
  11195. + * Should be cast by the user to the format-specific context defined in the
  11196. + * corresponding header (hwframe_*.h) and filled as described in the
  11197. + * documentation before calling av_hwframe_ctx_init().
  11198. + *
  11199. + * After any frames using this context are created, the contents of this
  11200. + * struct should not be modified by the caller.
  11201. + */
  11202. + void* hwctx;
  11203. +
  11204. + /**
  11205. + * This field may be set by the caller before calling av_hwframe_ctx_init().
  11206. + *
  11207. + * If non-NULL, this callback will be called when the last reference to
  11208. + * this context is unreferenced, immediately before it is freed.
  11209. + */
  11210. + void (*free)(struct AVHWFramesContext* ctx);
  11211. +
  11212. + /**
  11213. + * Arbitrary user data, to be used e.g. by the free() callback.
  11214. + */
  11215. + void* user_opaque;
  11216. +
  11217. + /**
  11218. + * A pool from which the frames are allocated by av_hwframe_get_buffer().
  11219. + * This field may be set by the caller before calling av_hwframe_ctx_init().
  11220. + * The buffers returned by calling av_buffer_pool_get() on this pool must
  11221. + * have the properties described in the documentation in the corresponding hw
  11222. + * type's header (hwcontext_*.h). The pool will be freed strictly before
  11223. + * this struct's free() callback is invoked.
  11224. + *
  11225. + * This field may be NULL, then libavutil will attempt to allocate a pool
  11226. + * internally. Note that certain device types enforce pools allocated at
  11227. + * fixed size (frame count), which cannot be extended dynamically. In such a
  11228. + * case, initial_pool_size must be set appropriately.
  11229. + */
  11230. + AVBufferPool* pool;
  11231. +
  11232. + /**
  11233. + * Initial size of the frame pool. If a device type does not support
  11234. + * dynamically resizing the pool, then this is also the maximum pool size.
  11235. + *
  11236. + * May be set by the caller before calling av_hwframe_ctx_init(). Must be
  11237. + * set if pool is NULL and the device type does not support dynamic pools.
  11238. + */
  11239. + int initial_pool_size;
  11240. +
  11241. + /**
  11242. + * The pixel format identifying the underlying HW surface type.
  11243. + *
  11244. + * Must be a hwaccel format, i.e. the corresponding descriptor must have the
  11245. + * AV_PIX_FMT_FLAG_HWACCEL flag set.
  11246. + *
  11247. + * Must be set by the user before calling av_hwframe_ctx_init().
  11248. + */
  11249. + enum AVPixelFormat format;
  11250. +
  11251. + /**
  11252. + * The pixel format identifying the actual data layout of the hardware
  11253. + * frames.
  11254. + *
  11255. + * Must be set by the caller before calling av_hwframe_ctx_init().
  11256. + *
  11257. + * @note when the underlying API does not provide the exact data layout, but
  11258. + * only the colorspace/bit depth, this field should be set to the fully
  11259. + * planar version of that format (e.g. for 8-bit 420 YUV it should be
  11260. + * AV_PIX_FMT_YUV420P, not AV_PIX_FMT_NV12 or anything else).
  11261. + */
  11262. + enum AVPixelFormat sw_format;
  11263. +
  11264. + /**
  11265. + * The allocated dimensions of the frames in this pool.
  11266. + *
  11267. + * Must be set by the user before calling av_hwframe_ctx_init().
  11268. + */
  11269. + int width, height;
  11270. +} AVHWFramesContext;
  11271. +
  11272. +/**
  11273. + * Look up an AVHWDeviceType by name.
  11274. + *
  11275. + * @param name String name of the device type (case-insensitive).
  11276. + * @return The type from enum AVHWDeviceType, or AV_HWDEVICE_TYPE_NONE if
  11277. + * not found.
  11278. + */
  11279. +enum AVHWDeviceType av_hwdevice_find_type_by_name(const char* name);
  11280. +
  11281. +/** Get the string name of an AVHWDeviceType.
  11282. + *
  11283. + * @param type Type from enum AVHWDeviceType.
  11284. + * @return Pointer to a static string containing the name, or NULL if the type
  11285. + * is not valid.
  11286. + */
  11287. +const char* av_hwdevice_get_type_name(enum AVHWDeviceType type);
  11288. +
  11289. +/**
  11290. + * Iterate over supported device types.
  11291. + *
  11292. + * @param prev AV_HWDEVICE_TYPE_NONE initially, then the previous type
  11293. + * returned by this function in subsequent iterations.
  11294. + * @return The next usable device type from enum AVHWDeviceType, or
  11295. + * AV_HWDEVICE_TYPE_NONE if there are no more.
  11296. + */
  11297. +enum AVHWDeviceType av_hwdevice_iterate_types(enum AVHWDeviceType prev);
  11298. +
  11299. +/**
  11300. + * Allocate an AVHWDeviceContext for a given hardware type.
  11301. + *
  11302. + * @param type the type of the hardware device to allocate.
  11303. + * @return a reference to the newly created AVHWDeviceContext on success or NULL
  11304. + * on failure.
  11305. + */
  11306. +AVBufferRef* av_hwdevice_ctx_alloc(enum AVHWDeviceType type);
  11307. +
  11308. +/**
  11309. + * Finalize the device context before use. This function must be called after
  11310. + * the context is filled with all the required information and before it is
  11311. + * used in any way.
  11312. + *
  11313. + * @param ref a reference to the AVHWDeviceContext
  11314. + * @return 0 on success, a negative AVERROR code on failure
  11315. + */
  11316. +int av_hwdevice_ctx_init(AVBufferRef* ref);
  11317. +
  11318. +/**
  11319. + * Open a device of the specified type and create an AVHWDeviceContext for it.
  11320. + *
  11321. + * This is a convenience function intended to cover the simple cases. Callers
  11322. + * who need to fine-tune device creation/management should open the device
  11323. + * manually and then wrap it in an AVHWDeviceContext using
  11324. + * av_hwdevice_ctx_alloc()/av_hwdevice_ctx_init().
  11325. + *
  11326. + * The returned context is already initialized and ready for use, the caller
  11327. + * should not call av_hwdevice_ctx_init() on it. The user_opaque/free fields of
  11328. + * the created AVHWDeviceContext are set by this function and should not be
  11329. + * touched by the caller.
  11330. + *
  11331. + * @param device_ctx On success, a reference to the newly-created device context
  11332. + * will be written here. The reference is owned by the caller
  11333. + * and must be released with av_buffer_unref() when no longer
  11334. + * needed. On failure, NULL will be written to this pointer.
  11335. + * @param type The type of the device to create.
  11336. + * @param device A type-specific string identifying the device to open.
  11337. + * @param opts A dictionary of additional (type-specific) options to use in
  11338. + * opening the device. The dictionary remains owned by the caller.
  11339. + * @param flags currently unused
  11340. + *
  11341. + * @return 0 on success, a negative AVERROR code on failure.
  11342. + */
  11343. +int av_hwdevice_ctx_create(AVBufferRef** device_ctx, enum AVHWDeviceType type,
  11344. + const char* device, AVDictionary* opts, int flags);
  11345. +
  11346. +/**
  11347. + * Create a new device of the specified type from an existing device.
  11348. + *
  11349. + * If the source device is a device of the target type or was originally
  11350. + * derived from such a device (possibly through one or more intermediate
  11351. + * devices of other types), then this will return a reference to the
  11352. + * existing device of the same type as is requested.
  11353. + *
  11354. + * Otherwise, it will attempt to derive a new device from the given source
  11355. + * device. If direct derivation to the new type is not implemented, it will
  11356. + * attempt the same derivation from each ancestor of the source device in
  11357. + * turn looking for an implemented derivation method.
  11358. + *
  11359. + * @param dst_ctx On success, a reference to the newly-created
  11360. + * AVHWDeviceContext.
  11361. + * @param type The type of the new device to create.
  11362. + * @param src_ctx A reference to an existing AVHWDeviceContext which will be
  11363. + * used to create the new device.
  11364. + * @param flags Currently unused; should be set to zero.
  11365. + * @return Zero on success, a negative AVERROR code on failure.
  11366. + */
  11367. +int av_hwdevice_ctx_create_derived(AVBufferRef** dst_ctx,
  11368. + enum AVHWDeviceType type,
  11369. + AVBufferRef* src_ctx, int flags);
  11370. +
  11371. +/**
  11372. + * Create a new device of the specified type from an existing device.
  11373. + *
  11374. + * This function performs the same action as av_hwdevice_ctx_create_derived,
  11375. + * however, it is able to set options for the new device to be derived.
  11376. + *
  11377. + * @param dst_ctx On success, a reference to the newly-created
  11378. + * AVHWDeviceContext.
  11379. + * @param type The type of the new device to create.
  11380. + * @param src_ctx A reference to an existing AVHWDeviceContext which will be
  11381. + * used to create the new device.
  11382. + * @param options Options for the new device to create, same format as in
  11383. + * av_hwdevice_ctx_create.
  11384. + * @param flags Currently unused; should be set to zero.
  11385. + * @return Zero on success, a negative AVERROR code on failure.
  11386. + */
  11387. +int av_hwdevice_ctx_create_derived_opts(AVBufferRef** dst_ctx,
  11388. + enum AVHWDeviceType type,
  11389. + AVBufferRef* src_ctx,
  11390. + AVDictionary* options, int flags);
  11391. +
  11392. +/**
  11393. + * Allocate an AVHWFramesContext tied to a given device context.
  11394. + *
  11395. + * @param device_ctx a reference to a AVHWDeviceContext. This function will make
  11396. + * a new reference for internal use, the one passed to the
  11397. + * function remains owned by the caller.
  11398. + * @return a reference to the newly created AVHWFramesContext on success or NULL
  11399. + * on failure.
  11400. + */
  11401. +AVBufferRef* av_hwframe_ctx_alloc(AVBufferRef* device_ctx);
  11402. +
  11403. +/**
  11404. + * Finalize the context before use. This function must be called after the
  11405. + * context is filled with all the required information and before it is attached
  11406. + * to any frames.
  11407. + *
  11408. + * @param ref a reference to the AVHWFramesContext
  11409. + * @return 0 on success, a negative AVERROR code on failure
  11410. + */
  11411. +int av_hwframe_ctx_init(AVBufferRef* ref);
  11412. +
  11413. +/**
  11414. + * Allocate a new frame attached to the given AVHWFramesContext.
  11415. + *
  11416. + * @param hwframe_ctx a reference to an AVHWFramesContext
  11417. + * @param frame an empty (freshly allocated or unreffed) frame to be filled with
  11418. + * newly allocated buffers.
  11419. + * @param flags currently unused, should be set to zero
  11420. + * @return 0 on success, a negative AVERROR code on failure
  11421. + */
  11422. +int av_hwframe_get_buffer(AVBufferRef* hwframe_ctx, AVFrame* frame, int flags);
  11423. +
  11424. +/**
  11425. + * Copy data to or from a hw surface. At least one of dst/src must have an
  11426. + * AVHWFramesContext attached.
  11427. + *
  11428. + * If src has an AVHWFramesContext attached, then the format of dst (if set)
  11429. + * must use one of the formats returned by av_hwframe_transfer_get_formats(src,
  11430. + * AV_HWFRAME_TRANSFER_DIRECTION_FROM).
  11431. + * If dst has an AVHWFramesContext attached, then the format of src must use one
  11432. + * of the formats returned by av_hwframe_transfer_get_formats(dst,
  11433. + * AV_HWFRAME_TRANSFER_DIRECTION_TO)
  11434. + *
  11435. + * dst may be "clean" (i.e. with data/buf pointers unset), in which case the
  11436. + * data buffers will be allocated by this function using av_frame_get_buffer().
  11437. + * If dst->format is set, then this format will be used, otherwise (when
  11438. + * dst->format is AV_PIX_FMT_NONE) the first acceptable format will be chosen.
  11439. + *
  11440. + * The two frames must have matching allocated dimensions (i.e. equal to
  11441. + * AVHWFramesContext.width/height), since not all device types support
  11442. + * transferring a sub-rectangle of the whole surface. The display dimensions
  11443. + * (i.e. AVFrame.width/height) may be smaller than the allocated dimensions, but
  11444. + * also have to be equal for both frames. When the display dimensions are
  11445. + * smaller than the allocated dimensions, the content of the padding in the
  11446. + * destination frame is unspecified.
  11447. + *
  11448. + * @param dst the destination frame. dst is not touched on failure.
  11449. + * @param src the source frame.
  11450. + * @param flags currently unused, should be set to zero
  11451. + * @return 0 on success, a negative AVERROR error code on failure.
  11452. + */
  11453. +int av_hwframe_transfer_data(AVFrame* dst, const AVFrame* src, int flags);
  11454. +
  11455. +enum AVHWFrameTransferDirection {
  11456. + /**
  11457. + * Transfer the data from the queried hw frame.
  11458. + */
  11459. + AV_HWFRAME_TRANSFER_DIRECTION_FROM,
  11460. +
  11461. + /**
  11462. + * Transfer the data to the queried hw frame.
  11463. + */
  11464. + AV_HWFRAME_TRANSFER_DIRECTION_TO,
  11465. +};
  11466. +
  11467. +/**
  11468. + * Get a list of possible source or target formats usable in
  11469. + * av_hwframe_transfer_data().
  11470. + *
  11471. + * @param hwframe_ctx the frame context to obtain the information for
  11472. + * @param dir the direction of the transfer
  11473. + * @param formats the pointer to the output format list will be written here.
  11474. + * The list is terminated with AV_PIX_FMT_NONE and must be freed
  11475. + * by the caller when no longer needed using av_free().
  11476. + * If this function returns successfully, the format list will
  11477. + * have at least one item (not counting the terminator).
  11478. + * On failure, the contents of this pointer are unspecified.
  11479. + * @param flags currently unused, should be set to zero
  11480. + * @return 0 on success, a negative AVERROR code on failure.
  11481. + */
  11482. +int av_hwframe_transfer_get_formats(AVBufferRef* hwframe_ctx,
  11483. + enum AVHWFrameTransferDirection dir,
  11484. + enum AVPixelFormat** formats, int flags);
  11485. +
  11486. +/**
  11487. + * This struct describes the constraints on hardware frames attached to
  11488. + * a given device with a hardware-specific configuration. This is returned
  11489. + * by av_hwdevice_get_hwframe_constraints() and must be freed by
  11490. + * av_hwframe_constraints_free() after use.
  11491. + */
  11492. +typedef struct AVHWFramesConstraints {
  11493. + /**
  11494. + * A list of possible values for format in the hw_frames_ctx,
  11495. + * terminated by AV_PIX_FMT_NONE. This member will always be filled.
  11496. + */
  11497. + enum AVPixelFormat* valid_hw_formats;
  11498. +
  11499. + /**
  11500. + * A list of possible values for sw_format in the hw_frames_ctx,
  11501. + * terminated by AV_PIX_FMT_NONE. Can be NULL if this information is
  11502. + * not known.
  11503. + */
  11504. + enum AVPixelFormat* valid_sw_formats;
  11505. +
  11506. + /**
  11507. + * The minimum size of frames in this hw_frames_ctx.
  11508. + * (Zero if not known.)
  11509. + */
  11510. + int min_width;
  11511. + int min_height;
  11512. +
  11513. + /**
  11514. + * The maximum size of frames in this hw_frames_ctx.
  11515. + * (INT_MAX if not known / no limit.)
  11516. + */
  11517. + int max_width;
  11518. + int max_height;
  11519. +} AVHWFramesConstraints;
  11520. +
  11521. +/**
  11522. + * Allocate a HW-specific configuration structure for a given HW device.
  11523. + * After use, the user must free all members as required by the specific
  11524. + * hardware structure being used, then free the structure itself with
  11525. + * av_free().
  11526. + *
  11527. + * @param device_ctx a reference to the associated AVHWDeviceContext.
  11528. + * @return The newly created HW-specific configuration structure on
  11529. + * success or NULL on failure.
  11530. + */
  11531. +void* av_hwdevice_hwconfig_alloc(AVBufferRef* device_ctx);
  11532. +
  11533. +/**
  11534. + * Get the constraints on HW frames given a device and the HW-specific
  11535. + * configuration to be used with that device. If no HW-specific
  11536. + * configuration is provided, returns the maximum possible capabilities
  11537. + * of the device.
  11538. + *
  11539. + * @param ref a reference to the associated AVHWDeviceContext.
  11540. + * @param hwconfig a filled HW-specific configuration structure, or NULL
  11541. + * to return the maximum possible capabilities of the device.
  11542. + * @return AVHWFramesConstraints structure describing the constraints
  11543. + * on the device, or NULL if not available.
  11544. + */
  11545. +AVHWFramesConstraints* av_hwdevice_get_hwframe_constraints(
  11546. + AVBufferRef* ref, const void* hwconfig);
  11547. +
  11548. +/**
  11549. + * Free an AVHWFrameConstraints structure.
  11550. + *
  11551. + * @param constraints The (filled or unfilled) AVHWFrameConstraints structure.
  11552. + */
  11553. +void av_hwframe_constraints_free(AVHWFramesConstraints** constraints);
  11554. +
  11555. +/**
  11556. + * Flags to apply to frame mappings.
  11557. + */
  11558. +enum {
  11559. + /**
  11560. + * The mapping must be readable.
  11561. + */
  11562. + AV_HWFRAME_MAP_READ = 1 << 0,
  11563. + /**
  11564. + * The mapping must be writeable.
  11565. + */
  11566. + AV_HWFRAME_MAP_WRITE = 1 << 1,
  11567. + /**
  11568. + * The mapped frame will be overwritten completely in subsequent
  11569. + * operations, so the current frame data need not be loaded. Any values
  11570. + * which are not overwritten are unspecified.
  11571. + */
  11572. + AV_HWFRAME_MAP_OVERWRITE = 1 << 2,
  11573. + /**
  11574. + * The mapping must be direct. That is, there must not be any copying in
  11575. + * the map or unmap steps. Note that performance of direct mappings may
  11576. + * be much lower than normal memory.
  11577. + */
  11578. + AV_HWFRAME_MAP_DIRECT = 1 << 3,
  11579. +};
  11580. +
  11581. +/**
  11582. + * Map a hardware frame.
  11583. + *
  11584. + * This has a number of different possible effects, depending on the format
  11585. + * and origin of the src and dst frames. On input, src should be a usable
  11586. + * frame with valid buffers and dst should be blank (typically as just created
  11587. + * by av_frame_alloc()). src should have an associated hwframe context, and
  11588. + * dst may optionally have a format and associated hwframe context.
  11589. + *
  11590. + * If src was created by mapping a frame from the hwframe context of dst,
  11591. + * then this function undoes the mapping - dst is replaced by a reference to
  11592. + * the frame that src was originally mapped from.
  11593. + *
  11594. + * If both src and dst have an associated hwframe context, then this function
  11595. + * attempts to map the src frame from its hardware context to that of dst and
  11596. + * then fill dst with appropriate data to be usable there. This will only be
  11597. + * possible if the hwframe contexts and associated devices are compatible -
  11598. + * given compatible devices, av_hwframe_ctx_create_derived() can be used to
  11599. + * create a hwframe context for dst in which mapping should be possible.
  11600. + *
  11601. + * If src has a hwframe context but dst does not, then the src frame is
  11602. + * mapped to normal memory and should thereafter be usable as a normal frame.
  11603. + * If the format is set on dst, then the mapping will attempt to create dst
  11604. + * with that format and fail if it is not possible. If format is unset (is
  11605. + * AV_PIX_FMT_NONE) then dst will be mapped with whatever the most appropriate
  11606. + * format to use is (probably the sw_format of the src hwframe context).
  11607. + *
  11608. + * A return value of AVERROR(ENOSYS) indicates that the mapping is not
  11609. + * possible with the given arguments and hwframe setup, while other return
  11610. + * values indicate that it failed somehow.
  11611. + *
  11612. + * On failure, the destination frame will be left blank, except for the
  11613. + * hw_frames_ctx/format fields thay may have been set by the caller - those will
  11614. + * be preserved as they were.
  11615. + *
  11616. + * @param dst Destination frame, to contain the mapping.
  11617. + * @param src Source frame, to be mapped.
  11618. + * @param flags Some combination of AV_HWFRAME_MAP_* flags.
  11619. + * @return Zero on success, negative AVERROR code on failure.
  11620. + */
  11621. +int av_hwframe_map(AVFrame* dst, const AVFrame* src, int flags);
  11622. +
  11623. +/**
  11624. + * Create and initialise an AVHWFramesContext as a mapping of another existing
  11625. + * AVHWFramesContext on a different device.
  11626. + *
  11627. + * av_hwframe_ctx_init() should not be called after this.
  11628. + *
  11629. + * @param derived_frame_ctx On success, a reference to the newly created
  11630. + * AVHWFramesContext.
  11631. + * @param format The AVPixelFormat for the derived context.
  11632. + * @param derived_device_ctx A reference to the device to create the new
  11633. + * AVHWFramesContext on.
  11634. + * @param source_frame_ctx A reference to an existing AVHWFramesContext
  11635. + * which will be mapped to the derived context.
  11636. + * @param flags Some combination of AV_HWFRAME_MAP_* flags, defining the
  11637. + * mapping parameters to apply to frames which are allocated
  11638. + * in the derived device.
  11639. + * @return Zero on success, negative AVERROR code on failure.
  11640. + */
  11641. +int av_hwframe_ctx_create_derived(AVBufferRef** derived_frame_ctx,
  11642. + enum AVPixelFormat format,
  11643. + AVBufferRef* derived_device_ctx,
  11644. + AVBufferRef* source_frame_ctx, int flags);
  11645. +
  11646. +#endif /* AVUTIL_HWCONTEXT_H */
  11647. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/hwcontext_vaapi.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/hwcontext_vaapi.h
  11648. new file mode 100644
  11649. index 00000000..058b5f11
  11650. --- /dev/null
  11651. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/hwcontext_vaapi.h
  11652. @@ -0,0 +1,117 @@
  11653. +/*
  11654. + * This file is part of FFmpeg.
  11655. + *
  11656. + * FFmpeg is free software; you can redistribute it and/or
  11657. + * modify it under the terms of the GNU Lesser General Public
  11658. + * License as published by the Free Software Foundation; either
  11659. + * version 2.1 of the License, or (at your option) any later version.
  11660. + *
  11661. + * FFmpeg is distributed in the hope that it will be useful,
  11662. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11663. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11664. + * Lesser General Public License for more details.
  11665. + *
  11666. + * You should have received a copy of the GNU Lesser General Public
  11667. + * License along with FFmpeg; if not, write to the Free Software
  11668. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  11669. + */
  11670. +
  11671. +#ifndef AVUTIL_HWCONTEXT_VAAPI_H
  11672. +#define AVUTIL_HWCONTEXT_VAAPI_H
  11673. +
  11674. +#include <va/va.h>
  11675. +
  11676. +/**
  11677. + * @file
  11678. + * API-specific header for AV_HWDEVICE_TYPE_VAAPI.
  11679. + *
  11680. + * Dynamic frame pools are supported, but note that any pool used as a render
  11681. + * target is required to be of fixed size in order to be be usable as an
  11682. + * argument to vaCreateContext().
  11683. + *
  11684. + * For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs
  11685. + * with the data pointer set to a VASurfaceID.
  11686. + */
  11687. +
  11688. +enum {
  11689. + /**
  11690. + * The quirks field has been set by the user and should not be detected
  11691. + * automatically by av_hwdevice_ctx_init().
  11692. + */
  11693. + AV_VAAPI_DRIVER_QUIRK_USER_SET = (1 << 0),
  11694. + /**
  11695. + * The driver does not destroy parameter buffers when they are used by
  11696. + * vaRenderPicture(). Additional code will be required to destroy them
  11697. + * separately afterwards.
  11698. + */
  11699. + AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS = (1 << 1),
  11700. +
  11701. + /**
  11702. + * The driver does not support the VASurfaceAttribMemoryType attribute,
  11703. + * so the surface allocation code will not try to use it.
  11704. + */
  11705. + AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE = (1 << 2),
  11706. +
  11707. + /**
  11708. + * The driver does not support surface attributes at all.
  11709. + * The surface allocation code will never pass them to surface allocation,
  11710. + * and the results of the vaQuerySurfaceAttributes() call will be faked.
  11711. + */
  11712. + AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES = (1 << 3),
  11713. +};
  11714. +
  11715. +/**
  11716. + * VAAPI connection details.
  11717. + *
  11718. + * Allocated as AVHWDeviceContext.hwctx
  11719. + */
  11720. +typedef struct AVVAAPIDeviceContext {
  11721. + /**
  11722. + * The VADisplay handle, to be filled by the user.
  11723. + */
  11724. + VADisplay display;
  11725. + /**
  11726. + * Driver quirks to apply - this is filled by av_hwdevice_ctx_init(),
  11727. + * with reference to a table of known drivers, unless the
  11728. + * AV_VAAPI_DRIVER_QUIRK_USER_SET bit is already present. The user
  11729. + * may need to refer to this field when performing any later
  11730. + * operations using VAAPI with the same VADisplay.
  11731. + */
  11732. + unsigned int driver_quirks;
  11733. +} AVVAAPIDeviceContext;
  11734. +
  11735. +/**
  11736. + * VAAPI-specific data associated with a frame pool.
  11737. + *
  11738. + * Allocated as AVHWFramesContext.hwctx.
  11739. + */
  11740. +typedef struct AVVAAPIFramesContext {
  11741. + /**
  11742. + * Set by the user to apply surface attributes to all surfaces in
  11743. + * the frame pool. If null, default settings are used.
  11744. + */
  11745. + VASurfaceAttrib* attributes;
  11746. + int nb_attributes;
  11747. + /**
  11748. + * The surfaces IDs of all surfaces in the pool after creation.
  11749. + * Only valid if AVHWFramesContext.initial_pool_size was positive.
  11750. + * These are intended to be used as the render_targets arguments to
  11751. + * vaCreateContext().
  11752. + */
  11753. + VASurfaceID* surface_ids;
  11754. + int nb_surfaces;
  11755. +} AVVAAPIFramesContext;
  11756. +
  11757. +/**
  11758. + * VAAPI hardware pipeline configuration details.
  11759. + *
  11760. + * Allocated with av_hwdevice_hwconfig_alloc().
  11761. + */
  11762. +typedef struct AVVAAPIHWConfig {
  11763. + /**
  11764. + * ID of a VAAPI pipeline configuration.
  11765. + */
  11766. + VAConfigID config_id;
  11767. +} AVVAAPIHWConfig;
  11768. +
  11769. +#endif /* AVUTIL_HWCONTEXT_VAAPI_H */
  11770. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/intfloat.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/intfloat.h
  11771. new file mode 100644
  11772. index 00000000..f373c977
  11773. --- /dev/null
  11774. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/intfloat.h
  11775. @@ -0,0 +1,73 @@
  11776. +/*
  11777. + * Copyright (c) 2011 Mans Rullgard
  11778. + *
  11779. + * This file is part of FFmpeg.
  11780. + *
  11781. + * FFmpeg is free software; you can redistribute it and/or
  11782. + * modify it under the terms of the GNU Lesser General Public
  11783. + * License as published by the Free Software Foundation; either
  11784. + * version 2.1 of the License, or (at your option) any later version.
  11785. + *
  11786. + * FFmpeg is distributed in the hope that it will be useful,
  11787. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11788. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11789. + * Lesser General Public License for more details.
  11790. + *
  11791. + * You should have received a copy of the GNU Lesser General Public
  11792. + * License along with FFmpeg; if not, write to the Free Software
  11793. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  11794. + */
  11795. +
  11796. +#ifndef AVUTIL_INTFLOAT_H
  11797. +#define AVUTIL_INTFLOAT_H
  11798. +
  11799. +#include <stdint.h>
  11800. +#include "attributes.h"
  11801. +
  11802. +union av_intfloat32 {
  11803. + uint32_t i;
  11804. + float f;
  11805. +};
  11806. +
  11807. +union av_intfloat64 {
  11808. + uint64_t i;
  11809. + double f;
  11810. +};
  11811. +
  11812. +/**
  11813. + * Reinterpret a 32-bit integer as a float.
  11814. + */
  11815. +static av_always_inline float av_int2float(uint32_t i) {
  11816. + union av_intfloat32 v;
  11817. + v.i = i;
  11818. + return v.f;
  11819. +}
  11820. +
  11821. +/**
  11822. + * Reinterpret a float as a 32-bit integer.
  11823. + */
  11824. +static av_always_inline uint32_t av_float2int(float f) {
  11825. + union av_intfloat32 v;
  11826. + v.f = f;
  11827. + return v.i;
  11828. +}
  11829. +
  11830. +/**
  11831. + * Reinterpret a 64-bit integer as a double.
  11832. + */
  11833. +static av_always_inline double av_int2double(uint64_t i) {
  11834. + union av_intfloat64 v;
  11835. + v.i = i;
  11836. + return v.f;
  11837. +}
  11838. +
  11839. +/**
  11840. + * Reinterpret a double as a 64-bit integer.
  11841. + */
  11842. +static av_always_inline uint64_t av_double2int(double f) {
  11843. + union av_intfloat64 v;
  11844. + v.f = f;
  11845. + return v.i;
  11846. +}
  11847. +
  11848. +#endif /* AVUTIL_INTFLOAT_H */
  11849. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/log.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/log.h
  11850. new file mode 100644
  11851. index 00000000..e1f2af7b
  11852. --- /dev/null
  11853. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/log.h
  11854. @@ -0,0 +1,388 @@
  11855. +/*
  11856. + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
  11857. + *
  11858. + * This file is part of FFmpeg.
  11859. + *
  11860. + * FFmpeg is free software; you can redistribute it and/or
  11861. + * modify it under the terms of the GNU Lesser General Public
  11862. + * License as published by the Free Software Foundation; either
  11863. + * version 2.1 of the License, or (at your option) any later version.
  11864. + *
  11865. + * FFmpeg is distributed in the hope that it will be useful,
  11866. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11867. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11868. + * Lesser General Public License for more details.
  11869. + *
  11870. + * You should have received a copy of the GNU Lesser General Public
  11871. + * License along with FFmpeg; if not, write to the Free Software
  11872. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  11873. + */
  11874. +
  11875. +#ifndef AVUTIL_LOG_H
  11876. +#define AVUTIL_LOG_H
  11877. +
  11878. +#include <stdarg.h>
  11879. +#include "attributes.h"
  11880. +#include "version.h"
  11881. +
  11882. +typedef enum {
  11883. + AV_CLASS_CATEGORY_NA = 0,
  11884. + AV_CLASS_CATEGORY_INPUT,
  11885. + AV_CLASS_CATEGORY_OUTPUT,
  11886. + AV_CLASS_CATEGORY_MUXER,
  11887. + AV_CLASS_CATEGORY_DEMUXER,
  11888. + AV_CLASS_CATEGORY_ENCODER,
  11889. + AV_CLASS_CATEGORY_DECODER,
  11890. + AV_CLASS_CATEGORY_FILTER,
  11891. + AV_CLASS_CATEGORY_BITSTREAM_FILTER,
  11892. + AV_CLASS_CATEGORY_SWSCALER,
  11893. + AV_CLASS_CATEGORY_SWRESAMPLER,
  11894. + AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT = 40,
  11895. + AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
  11896. + AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT,
  11897. + AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
  11898. + AV_CLASS_CATEGORY_DEVICE_OUTPUT,
  11899. + AV_CLASS_CATEGORY_DEVICE_INPUT,
  11900. + AV_CLASS_CATEGORY_NB ///< not part of ABI/API
  11901. +} AVClassCategory;
  11902. +
  11903. +#define AV_IS_INPUT_DEVICE(category) \
  11904. + (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT) || \
  11905. + ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT) || \
  11906. + ((category) == AV_CLASS_CATEGORY_DEVICE_INPUT))
  11907. +
  11908. +#define AV_IS_OUTPUT_DEVICE(category) \
  11909. + (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT) || \
  11910. + ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT) || \
  11911. + ((category) == AV_CLASS_CATEGORY_DEVICE_OUTPUT))
  11912. +
  11913. +struct AVOptionRanges;
  11914. +
  11915. +/**
  11916. + * Describe the class of an AVClass context structure. That is an
  11917. + * arbitrary struct of which the first field is a pointer to an
  11918. + * AVClass struct (e.g. AVCodecContext, AVFormatContext etc.).
  11919. + */
  11920. +typedef struct AVClass {
  11921. + /**
  11922. + * The name of the class; usually it is the same name as the
  11923. + * context structure type to which the AVClass is associated.
  11924. + */
  11925. + const char* class_name;
  11926. +
  11927. + /**
  11928. + * A pointer to a function which returns the name of a context
  11929. + * instance ctx associated with the class.
  11930. + */
  11931. + const char* (*item_name)(void* ctx);
  11932. +
  11933. + /**
  11934. + * a pointer to the first option specified in the class if any or NULL
  11935. + *
  11936. + * @see av_set_default_options()
  11937. + */
  11938. + const struct AVOption* option;
  11939. +
  11940. + /**
  11941. + * LIBAVUTIL_VERSION with which this structure was created.
  11942. + * This is used to allow fields to be added without requiring major
  11943. + * version bumps everywhere.
  11944. + */
  11945. +
  11946. + int version;
  11947. +
  11948. + /**
  11949. + * Offset in the structure where log_level_offset is stored.
  11950. + * 0 means there is no such variable
  11951. + */
  11952. + int log_level_offset_offset;
  11953. +
  11954. + /**
  11955. + * Offset in the structure where a pointer to the parent context for
  11956. + * logging is stored. For example a decoder could pass its AVCodecContext
  11957. + * to eval as such a parent context, which an av_log() implementation
  11958. + * could then leverage to display the parent context.
  11959. + * The offset can be NULL.
  11960. + */
  11961. + int parent_log_context_offset;
  11962. +
  11963. + /**
  11964. + * Category used for visualization (like color)
  11965. + * This is only set if the category is equal for all objects using this class.
  11966. + * available since version (51 << 16 | 56 << 8 | 100)
  11967. + */
  11968. + AVClassCategory category;
  11969. +
  11970. + /**
  11971. + * Callback to return the category.
  11972. + * available since version (51 << 16 | 59 << 8 | 100)
  11973. + */
  11974. + AVClassCategory (*get_category)(void* ctx);
  11975. +
  11976. + /**
  11977. + * Callback to return the supported/allowed ranges.
  11978. + * available since version (52.12)
  11979. + */
  11980. + int (*query_ranges)(struct AVOptionRanges**, void* obj, const char* key,
  11981. + int flags);
  11982. +
  11983. + /**
  11984. + * Return next AVOptions-enabled child or NULL
  11985. + */
  11986. + void* (*child_next)(void* obj, void* prev);
  11987. +
  11988. + /**
  11989. + * Iterate over the AVClasses corresponding to potential AVOptions-enabled
  11990. + * children.
  11991. + *
  11992. + * @param iter pointer to opaque iteration state. The caller must initialize
  11993. + * *iter to NULL before the first call.
  11994. + * @return AVClass for the next AVOptions-enabled child or NULL if there are
  11995. + * no more such children.
  11996. + *
  11997. + * @note The difference between child_next and this is that child_next
  11998. + * iterates over _already existing_ objects, while child_class_iterate
  11999. + * iterates over _all possible_ children.
  12000. + */
  12001. + const struct AVClass* (*child_class_iterate)(void** iter);
  12002. +} AVClass;
  12003. +
  12004. +/**
  12005. + * @addtogroup lavu_log
  12006. + *
  12007. + * @{
  12008. + *
  12009. + * @defgroup lavu_log_constants Logging Constants
  12010. + *
  12011. + * @{
  12012. + */
  12013. +
  12014. +/**
  12015. + * Print no output.
  12016. + */
  12017. +#define AV_LOG_QUIET -8
  12018. +
  12019. +/**
  12020. + * Something went really wrong and we will crash now.
  12021. + */
  12022. +#define AV_LOG_PANIC 0
  12023. +
  12024. +/**
  12025. + * Something went wrong and recovery is not possible.
  12026. + * For example, no header was found for a format which depends
  12027. + * on headers or an illegal combination of parameters is used.
  12028. + */
  12029. +#define AV_LOG_FATAL 8
  12030. +
  12031. +/**
  12032. + * Something went wrong and cannot losslessly be recovered.
  12033. + * However, not all future data is affected.
  12034. + */
  12035. +#define AV_LOG_ERROR 16
  12036. +
  12037. +/**
  12038. + * Something somehow does not look correct. This may or may not
  12039. + * lead to problems. An example would be the use of '-vstrict -2'.
  12040. + */
  12041. +#define AV_LOG_WARNING 24
  12042. +
  12043. +/**
  12044. + * Standard information.
  12045. + */
  12046. +#define AV_LOG_INFO 32
  12047. +
  12048. +/**
  12049. + * Detailed information.
  12050. + */
  12051. +#define AV_LOG_VERBOSE 40
  12052. +
  12053. +/**
  12054. + * Stuff which is only useful for libav* developers.
  12055. + */
  12056. +#define AV_LOG_DEBUG 48
  12057. +
  12058. +/**
  12059. + * Extremely verbose debugging, useful for libav* development.
  12060. + */
  12061. +#define AV_LOG_TRACE 56
  12062. +
  12063. +#define AV_LOG_MAX_OFFSET (AV_LOG_TRACE - AV_LOG_QUIET)
  12064. +
  12065. +/**
  12066. + * @}
  12067. + */
  12068. +
  12069. +/**
  12070. + * Sets additional colors for extended debugging sessions.
  12071. + * @code
  12072. + av_log(ctx, AV_LOG_DEBUG|AV_LOG_C(134), "Message in purple\n");
  12073. + @endcode
  12074. + * Requires 256color terminal support. Uses outside debugging is not
  12075. + * recommended.
  12076. + */
  12077. +#define AV_LOG_C(x) ((x) << 8)
  12078. +
  12079. +/**
  12080. + * Send the specified message to the log if the level is less than or equal
  12081. + * to the current av_log_level. By default, all logging messages are sent to
  12082. + * stderr. This behavior can be altered by setting a different logging callback
  12083. + * function.
  12084. + * @see av_log_set_callback
  12085. + *
  12086. + * @param avcl A pointer to an arbitrary struct of which the first field is a
  12087. + * pointer to an AVClass struct or NULL if general log.
  12088. + * @param level The importance level of the message expressed using a @ref
  12089. + * lavu_log_constants "Logging Constant".
  12090. + * @param fmt The format string (printf-compatible) that specifies how
  12091. + * subsequent arguments are converted to output.
  12092. + */
  12093. +void av_log(void* avcl, int level, const char* fmt, ...) av_printf_format(3, 4);
  12094. +
  12095. +/**
  12096. + * Send the specified message to the log once with the initial_level and then
  12097. + * with the subsequent_level. By default, all logging messages are sent to
  12098. + * stderr. This behavior can be altered by setting a different logging callback
  12099. + * function.
  12100. + * @see av_log
  12101. + *
  12102. + * @param avcl A pointer to an arbitrary struct of which the first field is a
  12103. + * pointer to an AVClass struct or NULL if general log.
  12104. + * @param initial_level importance level of the message expressed using a @ref
  12105. + * lavu_log_constants "Logging Constant" for the first occurance.
  12106. + * @param subsequent_level importance level of the message expressed using a
  12107. + * @ref lavu_log_constants "Logging Constant" after the first occurance.
  12108. + * @param fmt The format string (printf-compatible) that specifies how
  12109. + * subsequent arguments are converted to output.
  12110. + * @param state a variable to keep trak of if a message has already been printed
  12111. + * this must be initialized to 0 before the first use. The same state
  12112. + * must not be accessed by 2 Threads simultaneously.
  12113. + */
  12114. +void av_log_once(void* avcl, int initial_level, int subsequent_level,
  12115. + int* state, const char* fmt, ...) av_printf_format(5, 6);
  12116. +
  12117. +/**
  12118. + * Send the specified message to the log if the level is less than or equal
  12119. + * to the current av_log_level. By default, all logging messages are sent to
  12120. + * stderr. This behavior can be altered by setting a different logging callback
  12121. + * function.
  12122. + * @see av_log_set_callback
  12123. + *
  12124. + * @param avcl A pointer to an arbitrary struct of which the first field is a
  12125. + * pointer to an AVClass struct.
  12126. + * @param level The importance level of the message expressed using a @ref
  12127. + * lavu_log_constants "Logging Constant".
  12128. + * @param fmt The format string (printf-compatible) that specifies how
  12129. + * subsequent arguments are converted to output.
  12130. + * @param vl The arguments referenced by the format string.
  12131. + */
  12132. +void av_vlog(void* avcl, int level, const char* fmt, va_list vl);
  12133. +
  12134. +/**
  12135. + * Get the current log level
  12136. + *
  12137. + * @see lavu_log_constants
  12138. + *
  12139. + * @return Current log level
  12140. + */
  12141. +int av_log_get_level(void);
  12142. +
  12143. +/**
  12144. + * Set the log level
  12145. + *
  12146. + * @see lavu_log_constants
  12147. + *
  12148. + * @param level Logging level
  12149. + */
  12150. +void av_log_set_level(int level);
  12151. +
  12152. +/**
  12153. + * Set the logging callback
  12154. + *
  12155. + * @note The callback must be thread safe, even if the application does not use
  12156. + * threads itself as some codecs are multithreaded.
  12157. + *
  12158. + * @see av_log_default_callback
  12159. + *
  12160. + * @param callback A logging function with a compatible signature.
  12161. + */
  12162. +void av_log_set_callback(void (*callback)(void*, int, const char*, va_list));
  12163. +
  12164. +/**
  12165. + * Default logging callback
  12166. + *
  12167. + * It prints the message to stderr, optionally colorizing it.
  12168. + *
  12169. + * @param avcl A pointer to an arbitrary struct of which the first field is a
  12170. + * pointer to an AVClass struct.
  12171. + * @param level The importance level of the message expressed using a @ref
  12172. + * lavu_log_constants "Logging Constant".
  12173. + * @param fmt The format string (printf-compatible) that specifies how
  12174. + * subsequent arguments are converted to output.
  12175. + * @param vl The arguments referenced by the format string.
  12176. + */
  12177. +void av_log_default_callback(void* avcl, int level, const char* fmt,
  12178. + va_list vl);
  12179. +
  12180. +/**
  12181. + * Return the context name
  12182. + *
  12183. + * @param ctx The AVClass context
  12184. + *
  12185. + * @return The AVClass class_name
  12186. + */
  12187. +const char* av_default_item_name(void* ctx);
  12188. +AVClassCategory av_default_get_category(void* ptr);
  12189. +
  12190. +/**
  12191. + * Format a line of log the same way as the default callback.
  12192. + * @param line buffer to receive the formatted line
  12193. + * @param line_size size of the buffer
  12194. + * @param print_prefix used to store whether the prefix must be printed;
  12195. + * must point to a persistent integer initially set to 1
  12196. + */
  12197. +void av_log_format_line(void* ptr, int level, const char* fmt, va_list vl,
  12198. + char* line, int line_size, int* print_prefix);
  12199. +
  12200. +/**
  12201. + * Format a line of log the same way as the default callback.
  12202. + * @param line buffer to receive the formatted line;
  12203. + * may be NULL if line_size is 0
  12204. + * @param line_size size of the buffer; at most line_size-1 characters will
  12205. + * be written to the buffer, plus one null terminator
  12206. + * @param print_prefix used to store whether the prefix must be printed;
  12207. + * must point to a persistent integer initially set to 1
  12208. + * @return Returns a negative value if an error occurred, otherwise returns
  12209. + * the number of characters that would have been written for a
  12210. + * sufficiently large buffer, not including the terminating null
  12211. + * character. If the return value is not less than line_size, it means
  12212. + * that the log message was truncated to fit the buffer.
  12213. + */
  12214. +int av_log_format_line2(void* ptr, int level, const char* fmt, va_list vl,
  12215. + char* line, int line_size, int* print_prefix);
  12216. +
  12217. +/**
  12218. + * Skip repeated messages, this requires the user app to use av_log() instead of
  12219. + * (f)printf as the 2 would otherwise interfere and lead to
  12220. + * "Last message repeated x times" messages below (f)printf messages with some
  12221. + * bad luck.
  12222. + * Also to receive the last, "last repeated" line if any, the user app must
  12223. + * call av_log(NULL, AV_LOG_QUIET, "%s", ""); at the end
  12224. + */
  12225. +#define AV_LOG_SKIP_REPEATED 1
  12226. +
  12227. +/**
  12228. + * Include the log severity in messages originating from codecs.
  12229. + *
  12230. + * Results in messages such as:
  12231. + * [rawvideo @ 0xDEADBEEF] [error] encode did not produce valid pts
  12232. + */
  12233. +#define AV_LOG_PRINT_LEVEL 2
  12234. +
  12235. +void av_log_set_flags(int arg);
  12236. +int av_log_get_flags(void);
  12237. +
  12238. +/**
  12239. + * @}
  12240. + */
  12241. +
  12242. +#endif /* AVUTIL_LOG_H */
  12243. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/macros.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/macros.h
  12244. new file mode 100644
  12245. index 00000000..1578d1a3
  12246. --- /dev/null
  12247. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/macros.h
  12248. @@ -0,0 +1,87 @@
  12249. +/*
  12250. + * This file is part of FFmpeg.
  12251. + *
  12252. + * FFmpeg is free software; you can redistribute it and/or
  12253. + * modify it under the terms of the GNU Lesser General Public
  12254. + * License as published by the Free Software Foundation; either
  12255. + * version 2.1 of the License, or (at your option) any later version.
  12256. + *
  12257. + * FFmpeg is distributed in the hope that it will be useful,
  12258. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12259. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12260. + * Lesser General Public License for more details.
  12261. + *
  12262. + * You should have received a copy of the GNU Lesser General Public
  12263. + * License along with FFmpeg; if not, write to the Free Software
  12264. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  12265. + */
  12266. +
  12267. +/**
  12268. + * @file
  12269. + * @ingroup lavu
  12270. + * Utility Preprocessor macros
  12271. + */
  12272. +
  12273. +#ifndef AVUTIL_MACROS_H
  12274. +#define AVUTIL_MACROS_H
  12275. +
  12276. +#include "libavutil/avconfig.h"
  12277. +
  12278. +#if AV_HAVE_BIGENDIAN
  12279. +# define AV_NE(be, le) (be)
  12280. +#else
  12281. +# define AV_NE(be, le) (le)
  12282. +#endif
  12283. +
  12284. +/**
  12285. + * Comparator.
  12286. + * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0
  12287. + * if x == y. This is useful for instance in a qsort comparator callback.
  12288. + * Furthermore, compilers are able to optimize this to branchless code, and
  12289. + * there is no risk of overflow with signed types.
  12290. + * As with many macros, this evaluates its argument multiple times, it thus
  12291. + * must not have a side-effect.
  12292. + */
  12293. +#define FFDIFFSIGN(x, y) (((x) > (y)) - ((x) < (y)))
  12294. +
  12295. +#define FFMAX(a, b) ((a) > (b) ? (a) : (b))
  12296. +#define FFMAX3(a, b, c) FFMAX(FFMAX(a, b), c)
  12297. +#define FFMIN(a, b) ((a) > (b) ? (b) : (a))
  12298. +#define FFMIN3(a, b, c) FFMIN(FFMIN(a, b), c)
  12299. +
  12300. +#define FFSWAP(type, a, b) \
  12301. + do { \
  12302. + type SWAP_tmp = b; \
  12303. + b = a; \
  12304. + a = SWAP_tmp; \
  12305. + } while (0)
  12306. +#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
  12307. +
  12308. +#define MKTAG(a, b, c, d) \
  12309. + ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24))
  12310. +#define MKBETAG(a, b, c, d) \
  12311. + ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24))
  12312. +
  12313. +/**
  12314. + * @addtogroup preproc_misc Preprocessor String Macros
  12315. + *
  12316. + * String manipulation macros
  12317. + *
  12318. + * @{
  12319. + */
  12320. +
  12321. +#define AV_STRINGIFY(s) AV_TOSTRING(s)
  12322. +#define AV_TOSTRING(s) #s
  12323. +
  12324. +#define AV_GLUE(a, b) a##b
  12325. +#define AV_JOIN(a, b) AV_GLUE(a, b)
  12326. +
  12327. +/**
  12328. + * @}
  12329. + */
  12330. +
  12331. +#define AV_PRAGMA(s) _Pragma(#s)
  12332. +
  12333. +#define FFALIGN(x, a) (((x) + (a)-1) & ~((a)-1))
  12334. +
  12335. +#endif /* AVUTIL_MACROS_H */
  12336. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/mathematics.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/mathematics.h
  12337. new file mode 100644
  12338. index 00000000..5ebf81e6
  12339. --- /dev/null
  12340. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/mathematics.h
  12341. @@ -0,0 +1,249 @@
  12342. +/*
  12343. + * copyright (c) 2005-2012 Michael Niedermayer <michaelni@gmx.at>
  12344. + *
  12345. + * This file is part of FFmpeg.
  12346. + *
  12347. + * FFmpeg is free software; you can redistribute it and/or
  12348. + * modify it under the terms of the GNU Lesser General Public
  12349. + * License as published by the Free Software Foundation; either
  12350. + * version 2.1 of the License, or (at your option) any later version.
  12351. + *
  12352. + * FFmpeg is distributed in the hope that it will be useful,
  12353. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12354. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12355. + * Lesser General Public License for more details.
  12356. + *
  12357. + * You should have received a copy of the GNU Lesser General Public
  12358. + * License along with FFmpeg; if not, write to the Free Software
  12359. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  12360. + */
  12361. +
  12362. +/**
  12363. + * @file
  12364. + * @addtogroup lavu_math
  12365. + * Mathematical utilities for working with timestamp and time base.
  12366. + */
  12367. +
  12368. +#ifndef AVUTIL_MATHEMATICS_H
  12369. +#define AVUTIL_MATHEMATICS_H
  12370. +
  12371. +#include <stdint.h>
  12372. +#include <math.h>
  12373. +#include "attributes.h"
  12374. +#include "rational.h"
  12375. +#include "intfloat.h"
  12376. +
  12377. +#ifndef M_E
  12378. +# define M_E 2.7182818284590452354 /* e */
  12379. +#endif
  12380. +#ifndef M_LN2
  12381. +# define M_LN2 0.69314718055994530942 /* log_e 2 */
  12382. +#endif
  12383. +#ifndef M_LN10
  12384. +# define M_LN10 2.30258509299404568402 /* log_e 10 */
  12385. +#endif
  12386. +#ifndef M_LOG2_10
  12387. +# define M_LOG2_10 3.32192809488736234787 /* log_2 10 */
  12388. +#endif
  12389. +#ifndef M_PHI
  12390. +# define M_PHI 1.61803398874989484820 /* phi / golden ratio */
  12391. +#endif
  12392. +#ifndef M_PI
  12393. +# define M_PI 3.14159265358979323846 /* pi */
  12394. +#endif
  12395. +#ifndef M_PI_2
  12396. +# define M_PI_2 1.57079632679489661923 /* pi/2 */
  12397. +#endif
  12398. +#ifndef M_SQRT1_2
  12399. +# define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
  12400. +#endif
  12401. +#ifndef M_SQRT2
  12402. +# define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
  12403. +#endif
  12404. +#ifndef NAN
  12405. +# define NAN av_int2float(0x7fc00000)
  12406. +#endif
  12407. +#ifndef INFINITY
  12408. +# define INFINITY av_int2float(0x7f800000)
  12409. +#endif
  12410. +
  12411. +/**
  12412. + * @addtogroup lavu_math
  12413. + *
  12414. + * @{
  12415. + */
  12416. +
  12417. +/**
  12418. + * Rounding methods.
  12419. + */
  12420. +enum AVRounding {
  12421. + AV_ROUND_ZERO = 0, ///< Round toward zero.
  12422. + AV_ROUND_INF = 1, ///< Round away from zero.
  12423. + AV_ROUND_DOWN = 2, ///< Round toward -infinity.
  12424. + AV_ROUND_UP = 3, ///< Round toward +infinity.
  12425. + AV_ROUND_NEAR_INF =
  12426. + 5, ///< Round to nearest and halfway cases away from zero.
  12427. + /**
  12428. + * Flag telling rescaling functions to pass `INT64_MIN`/`MAX` through
  12429. + * unchanged, avoiding special cases for #AV_NOPTS_VALUE.
  12430. + *
  12431. + * Unlike other values of the enumeration AVRounding, this value is a
  12432. + * bitmask that must be used in conjunction with another value of the
  12433. + * enumeration through a bitwise OR, in order to set behavior for normal
  12434. + * cases.
  12435. + *
  12436. + * @code{.c}
  12437. + * av_rescale_rnd(3, 1, 2, AV_ROUND_UP | AV_ROUND_PASS_MINMAX);
  12438. + * // Rescaling 3:
  12439. + * // Calculating 3 * 1 / 2
  12440. + * // 3 / 2 is rounded up to 2
  12441. + * // => 2
  12442. + *
  12443. + * av_rescale_rnd(AV_NOPTS_VALUE, 1, 2, AV_ROUND_UP | AV_ROUND_PASS_MINMAX);
  12444. + * // Rescaling AV_NOPTS_VALUE:
  12445. + * // AV_NOPTS_VALUE == INT64_MIN
  12446. + * // AV_NOPTS_VALUE is passed through
  12447. + * // => AV_NOPTS_VALUE
  12448. + * @endcode
  12449. + */
  12450. + AV_ROUND_PASS_MINMAX = 8192,
  12451. +};
  12452. +
  12453. +/**
  12454. + * Compute the greatest common divisor of two integer operands.
  12455. + *
  12456. + * @param a Operand
  12457. + * @param b Operand
  12458. + * @return GCD of a and b up to sign; if a >= 0 and b >= 0, return value is >=
  12459. + * 0; if a == 0 and b == 0, returns 0.
  12460. + */
  12461. +int64_t av_const av_gcd(int64_t a, int64_t b);
  12462. +
  12463. +/**
  12464. + * Rescale a 64-bit integer with rounding to nearest.
  12465. + *
  12466. + * The operation is mathematically equivalent to `a * b / c`, but writing that
  12467. + * directly can overflow.
  12468. + *
  12469. + * This function is equivalent to av_rescale_rnd() with #AV_ROUND_NEAR_INF.
  12470. + *
  12471. + * @see av_rescale_rnd(), av_rescale_q(), av_rescale_q_rnd()
  12472. + */
  12473. +int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const;
  12474. +
  12475. +/**
  12476. + * Rescale a 64-bit integer with specified rounding.
  12477. + *
  12478. + * The operation is mathematically equivalent to `a * b / c`, but writing that
  12479. + * directly can overflow, and does not support different rounding methods.
  12480. + * If the result is not representable then INT64_MIN is returned.
  12481. + *
  12482. + * @see av_rescale(), av_rescale_q(), av_rescale_q_rnd()
  12483. + */
  12484. +int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c,
  12485. + enum AVRounding rnd) av_const;
  12486. +
  12487. +/**
  12488. + * Rescale a 64-bit integer by 2 rational numbers.
  12489. + *
  12490. + * The operation is mathematically equivalent to `a * bq / cq`.
  12491. + *
  12492. + * This function is equivalent to av_rescale_q_rnd() with #AV_ROUND_NEAR_INF.
  12493. + *
  12494. + * @see av_rescale(), av_rescale_rnd(), av_rescale_q_rnd()
  12495. + */
  12496. +int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;
  12497. +
  12498. +/**
  12499. + * Rescale a 64-bit integer by 2 rational numbers with specified rounding.
  12500. + *
  12501. + * The operation is mathematically equivalent to `a * bq / cq`.
  12502. + *
  12503. + * @see av_rescale(), av_rescale_rnd(), av_rescale_q()
  12504. + */
  12505. +int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq,
  12506. + enum AVRounding rnd) av_const;
  12507. +
  12508. +/**
  12509. + * Compare two timestamps each in its own time base.
  12510. + *
  12511. + * @return One of the following values:
  12512. + * - -1 if `ts_a` is before `ts_b`
  12513. + * - 1 if `ts_a` is after `ts_b`
  12514. + * - 0 if they represent the same position
  12515. + *
  12516. + * @warning
  12517. + * The result of the function is undefined if one of the timestamps is outside
  12518. + * the `int64_t` range when represented in the other's timebase.
  12519. + */
  12520. +int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b);
  12521. +
  12522. +/**
  12523. + * Compare the remainders of two integer operands divided by a common divisor.
  12524. + *
  12525. + * In other words, compare the least significant `log2(mod)` bits of integers
  12526. + * `a` and `b`.
  12527. + *
  12528. + * @code{.c}
  12529. + * av_compare_mod(0x11, 0x02, 0x10) < 0 // since 0x11 % 0x10 (0x1) < 0x02 %
  12530. + * 0x10 (0x2) av_compare_mod(0x11, 0x02, 0x20) > 0 // since 0x11 % 0x20 (0x11)
  12531. + * > 0x02 % 0x20 (0x02)
  12532. + * @endcode
  12533. + *
  12534. + * @param a Operand
  12535. + * @param b Operand
  12536. + * @param mod Divisor; must be a power of 2
  12537. + * @return
  12538. + * - a negative value if `a % mod < b % mod`
  12539. + * - a positive value if `a % mod > b % mod`
  12540. + * - zero if `a % mod == b % mod`
  12541. + */
  12542. +int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod);
  12543. +
  12544. +/**
  12545. + * Rescale a timestamp while preserving known durations.
  12546. + *
  12547. + * This function is designed to be called per audio packet to scale the input
  12548. + * timestamp to a different time base. Compared to a simple av_rescale_q()
  12549. + * call, this function is robust against possible inconsistent frame durations.
  12550. + *
  12551. + * The `last` parameter is a state variable that must be preserved for all
  12552. + * subsequent calls for the same stream. For the first call, `*last` should be
  12553. + * initialized to #AV_NOPTS_VALUE.
  12554. + *
  12555. + * @param[in] in_tb Input time base
  12556. + * @param[in] in_ts Input timestamp
  12557. + * @param[in] fs_tb Duration time base; typically this is finer-grained
  12558. + * (greater) than `in_tb` and `out_tb`
  12559. + * @param[in] duration Duration till the next call to this function (i.e.
  12560. + * duration of the current packet/frame)
  12561. + * @param[in,out] last Pointer to a timestamp expressed in terms of
  12562. + * `fs_tb`, acting as a state variable
  12563. + * @param[in] out_tb Output timebase
  12564. + * @return Timestamp expressed in terms of `out_tb`
  12565. + *
  12566. + * @note In the context of this function, "duration" is in term of samples, not
  12567. + * seconds.
  12568. + */
  12569. +int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts, AVRational fs_tb,
  12570. + int duration, int64_t* last, AVRational out_tb);
  12571. +
  12572. +/**
  12573. + * Add a value to a timestamp.
  12574. + *
  12575. + * This function guarantees that when the same value is repeatly added that
  12576. + * no accumulation of rounding errors occurs.
  12577. + *
  12578. + * @param[in] ts Input timestamp
  12579. + * @param[in] ts_tb Input timestamp time base
  12580. + * @param[in] inc Value to be added
  12581. + * @param[in] inc_tb Time base of `inc`
  12582. + */
  12583. +int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb,
  12584. + int64_t inc);
  12585. +
  12586. +/**
  12587. + * @}
  12588. + */
  12589. +
  12590. +#endif /* AVUTIL_MATHEMATICS_H */
  12591. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/mem.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/mem.h
  12592. new file mode 100644
  12593. index 00000000..8f5d8c75
  12594. --- /dev/null
  12595. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/mem.h
  12596. @@ -0,0 +1,613 @@
  12597. +/*
  12598. + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
  12599. + *
  12600. + * This file is part of FFmpeg.
  12601. + *
  12602. + * FFmpeg is free software; you can redistribute it and/or
  12603. + * modify it under the terms of the GNU Lesser General Public
  12604. + * License as published by the Free Software Foundation; either
  12605. + * version 2.1 of the License, or (at your option) any later version.
  12606. + *
  12607. + * FFmpeg is distributed in the hope that it will be useful,
  12608. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12609. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12610. + * Lesser General Public License for more details.
  12611. + *
  12612. + * You should have received a copy of the GNU Lesser General Public
  12613. + * License along with FFmpeg; if not, write to the Free Software
  12614. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  12615. + */
  12616. +
  12617. +/**
  12618. + * @file
  12619. + * @ingroup lavu_mem
  12620. + * Memory handling functions
  12621. + */
  12622. +
  12623. +#ifndef AVUTIL_MEM_H
  12624. +#define AVUTIL_MEM_H
  12625. +
  12626. +#include <limits.h>
  12627. +#include <stdint.h>
  12628. +
  12629. +#include "attributes.h"
  12630. +#include "avutil.h"
  12631. +#include "version.h"
  12632. +
  12633. +/**
  12634. + * @addtogroup lavu_mem
  12635. + * Utilities for manipulating memory.
  12636. + *
  12637. + * FFmpeg has several applications of memory that are not required of a typical
  12638. + * program. For example, the computing-heavy components like video decoding and
  12639. + * encoding can be sped up significantly through the use of aligned memory.
  12640. + *
  12641. + * However, for each of FFmpeg's applications of memory, there might not be a
  12642. + * recognized or standardized API for that specific use. Memory alignment, for
  12643. + * instance, varies wildly depending on operating systems, architectures, and
  12644. + * compilers. Hence, this component of @ref libavutil is created to make
  12645. + * dealing with memory consistently possible on all platforms.
  12646. + *
  12647. + * @{
  12648. + */
  12649. +
  12650. +/**
  12651. + * @defgroup lavu_mem_attrs Function Attributes
  12652. + * Function attributes applicable to memory handling functions.
  12653. + *
  12654. + * These function attributes can help compilers emit more useful warnings, or
  12655. + * generate better code.
  12656. + * @{
  12657. + */
  12658. +
  12659. +/**
  12660. + * @def av_malloc_attrib
  12661. + * Function attribute denoting a malloc-like function.
  12662. + *
  12663. + * @see <a
  12664. + * href="https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-g_t_0040code_007bmalloc_007d-function-attribute-3251">Function
  12665. + * attribute `malloc` in GCC's documentation</a>
  12666. + */
  12667. +
  12668. +#if AV_GCC_VERSION_AT_LEAST(3, 1)
  12669. +# define av_malloc_attrib __attribute__((__malloc__))
  12670. +#else
  12671. +# define av_malloc_attrib
  12672. +#endif
  12673. +
  12674. +/**
  12675. + * @def av_alloc_size(...)
  12676. + * Function attribute used on a function that allocates memory, whose size is
  12677. + * given by the specified parameter(s).
  12678. + *
  12679. + * @code{.c}
  12680. + * void *av_malloc(size_t size) av_alloc_size(1);
  12681. + * void *av_calloc(size_t nmemb, size_t size) av_alloc_size(1, 2);
  12682. + * @endcode
  12683. + *
  12684. + * @param ... One or two parameter indexes, separated by a comma
  12685. + *
  12686. + * @see <a
  12687. + * href="https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-g_t_0040code_007balloc_005fsize_007d-function-attribute-3220">Function
  12688. + * attribute `alloc_size` in GCC's documentation</a>
  12689. + */
  12690. +
  12691. +#if AV_GCC_VERSION_AT_LEAST(4, 3)
  12692. +# define av_alloc_size(...) __attribute__((alloc_size(__VA_ARGS__)))
  12693. +#else
  12694. +# define av_alloc_size(...)
  12695. +#endif
  12696. +
  12697. +/**
  12698. + * @}
  12699. + */
  12700. +
  12701. +/**
  12702. + * @defgroup lavu_mem_funcs Heap Management
  12703. + * Functions responsible for allocating, freeing, and copying memory.
  12704. + *
  12705. + * All memory allocation functions have a built-in upper limit of `INT_MAX`
  12706. + * bytes. This may be changed with av_max_alloc(), although exercise extreme
  12707. + * caution when doing so.
  12708. + *
  12709. + * @{
  12710. + */
  12711. +
  12712. +/**
  12713. + * Allocate a memory block with alignment suitable for all memory accesses
  12714. + * (including vectors if available on the CPU).
  12715. + *
  12716. + * @param size Size in bytes for the memory block to be allocated
  12717. + * @return Pointer to the allocated block, or `NULL` if the block cannot
  12718. + * be allocated
  12719. + * @see av_mallocz()
  12720. + */
  12721. +void* av_malloc(size_t size) av_malloc_attrib av_alloc_size(1);
  12722. +
  12723. +/**
  12724. + * Allocate a memory block with alignment suitable for all memory accesses
  12725. + * (including vectors if available on the CPU) and zero all the bytes of the
  12726. + * block.
  12727. + *
  12728. + * @param size Size in bytes for the memory block to be allocated
  12729. + * @return Pointer to the allocated block, or `NULL` if it cannot be allocated
  12730. + * @see av_malloc()
  12731. + */
  12732. +void* av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1);
  12733. +
  12734. +/**
  12735. + * Allocate a memory block for an array with av_malloc().
  12736. + *
  12737. + * The allocated memory will have size `size * nmemb` bytes.
  12738. + *
  12739. + * @param nmemb Number of element
  12740. + * @param size Size of a single element
  12741. + * @return Pointer to the allocated block, or `NULL` if the block cannot
  12742. + * be allocated
  12743. + * @see av_malloc()
  12744. + */
  12745. +av_alloc_size(1, 2) void* av_malloc_array(size_t nmemb, size_t size);
  12746. +
  12747. +/**
  12748. + * Allocate a memory block for an array with av_mallocz().
  12749. + *
  12750. + * The allocated memory will have size `size * nmemb` bytes.
  12751. + *
  12752. + * @param nmemb Number of elements
  12753. + * @param size Size of the single element
  12754. + * @return Pointer to the allocated block, or `NULL` if the block cannot
  12755. + * be allocated
  12756. + *
  12757. + * @see av_mallocz()
  12758. + * @see av_malloc_array()
  12759. + */
  12760. +void* av_calloc(size_t nmemb, size_t size) av_malloc_attrib av_alloc_size(1, 2);
  12761. +
  12762. +/**
  12763. + * Allocate, reallocate, or free a block of memory.
  12764. + *
  12765. + * If `ptr` is `NULL` and `size` > 0, allocate a new block. Otherwise, expand or
  12766. + * shrink that block of memory according to `size`.
  12767. + *
  12768. + * @param ptr Pointer to a memory block already allocated with
  12769. + * av_realloc() or `NULL`
  12770. + * @param size Size in bytes of the memory block to be allocated or
  12771. + * reallocated
  12772. + *
  12773. + * @return Pointer to a newly-reallocated block or `NULL` if the block
  12774. + * cannot be reallocated
  12775. + *
  12776. + * @warning Unlike av_malloc(), the returned pointer is not guaranteed to be
  12777. + * correctly aligned. The returned pointer must be freed after even
  12778. + * if size is zero.
  12779. + * @see av_fast_realloc()
  12780. + * @see av_reallocp()
  12781. + */
  12782. +void* av_realloc(void* ptr, size_t size) av_alloc_size(2);
  12783. +
  12784. +/**
  12785. + * Allocate, reallocate, or free a block of memory through a pointer to a
  12786. + * pointer.
  12787. + *
  12788. + * If `*ptr` is `NULL` and `size` > 0, allocate a new block. If `size` is
  12789. + * zero, free the memory block pointed to by `*ptr`. Otherwise, expand or
  12790. + * shrink that block of memory according to `size`.
  12791. + *
  12792. + * @param[in,out] ptr Pointer to a pointer to a memory block already allocated
  12793. + * with av_realloc(), or a pointer to `NULL`. The pointer
  12794. + * is updated on success, or freed on failure.
  12795. + * @param[in] size Size in bytes for the memory block to be allocated or
  12796. + * reallocated
  12797. + *
  12798. + * @return Zero on success, an AVERROR error code on failure
  12799. + *
  12800. + * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
  12801. + * correctly aligned.
  12802. + */
  12803. +av_warn_unused_result int av_reallocp(void* ptr, size_t size);
  12804. +
  12805. +/**
  12806. + * Allocate, reallocate, or free a block of memory.
  12807. + *
  12808. + * This function does the same thing as av_realloc(), except:
  12809. + * - It takes two size arguments and allocates `nelem * elsize` bytes,
  12810. + * after checking the result of the multiplication for integer overflow.
  12811. + * - It frees the input block in case of failure, thus avoiding the memory
  12812. + * leak with the classic
  12813. + * @code{.c}
  12814. + * buf = realloc(buf);
  12815. + * if (!buf)
  12816. + * return -1;
  12817. + * @endcode
  12818. + * pattern.
  12819. + */
  12820. +void* av_realloc_f(void* ptr, size_t nelem, size_t elsize);
  12821. +
  12822. +/**
  12823. + * Allocate, reallocate, or free an array.
  12824. + *
  12825. + * If `ptr` is `NULL` and `nmemb` > 0, allocate a new block.
  12826. + *
  12827. + * @param ptr Pointer to a memory block already allocated with
  12828. + * av_realloc() or `NULL`
  12829. + * @param nmemb Number of elements in the array
  12830. + * @param size Size of the single element of the array
  12831. + *
  12832. + * @return Pointer to a newly-reallocated block or NULL if the block
  12833. + * cannot be reallocated
  12834. + *
  12835. + * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
  12836. + * correctly aligned. The returned pointer must be freed after even if
  12837. + * nmemb is zero.
  12838. + * @see av_reallocp_array()
  12839. + */
  12840. +av_alloc_size(2, 3) void* av_realloc_array(void* ptr, size_t nmemb,
  12841. + size_t size);
  12842. +
  12843. +/**
  12844. + * Allocate, reallocate an array through a pointer to a pointer.
  12845. + *
  12846. + * If `*ptr` is `NULL` and `nmemb` > 0, allocate a new block.
  12847. + *
  12848. + * @param[in,out] ptr Pointer to a pointer to a memory block already
  12849. + * allocated with av_realloc(), or a pointer to `NULL`.
  12850. + * The pointer is updated on success, or freed on failure.
  12851. + * @param[in] nmemb Number of elements
  12852. + * @param[in] size Size of the single element
  12853. + *
  12854. + * @return Zero on success, an AVERROR error code on failure
  12855. + *
  12856. + * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
  12857. + * correctly aligned. *ptr must be freed after even if nmemb is zero.
  12858. + */
  12859. +int av_reallocp_array(void* ptr, size_t nmemb, size_t size);
  12860. +
  12861. +/**
  12862. + * Reallocate the given buffer if it is not large enough, otherwise do nothing.
  12863. + *
  12864. + * If the given buffer is `NULL`, then a new uninitialized buffer is allocated.
  12865. + *
  12866. + * If the given buffer is not large enough, and reallocation fails, `NULL` is
  12867. + * returned and `*size` is set to 0, but the original buffer is not changed or
  12868. + * freed.
  12869. + *
  12870. + * A typical use pattern follows:
  12871. + *
  12872. + * @code{.c}
  12873. + * uint8_t *buf = ...;
  12874. + * uint8_t *new_buf = av_fast_realloc(buf, &current_size, size_needed);
  12875. + * if (!new_buf) {
  12876. + * // Allocation failed; clean up original buffer
  12877. + * av_freep(&buf);
  12878. + * return AVERROR(ENOMEM);
  12879. + * }
  12880. + * @endcode
  12881. + *
  12882. + * @param[in,out] ptr Already allocated buffer, or `NULL`
  12883. + * @param[in,out] size Pointer to the size of buffer `ptr`. `*size` is
  12884. + * updated to the new allocated size, in particular 0
  12885. + * in case of failure.
  12886. + * @param[in] min_size Desired minimal size of buffer `ptr`
  12887. + * @return `ptr` if the buffer is large enough, a pointer to newly reallocated
  12888. + * buffer if the buffer was not large enough, or `NULL` in case of
  12889. + * error
  12890. + * @see av_realloc()
  12891. + * @see av_fast_malloc()
  12892. + */
  12893. +void* av_fast_realloc(void* ptr, unsigned int* size, size_t min_size);
  12894. +
  12895. +/**
  12896. + * Allocate a buffer, reusing the given one if large enough.
  12897. + *
  12898. + * Contrary to av_fast_realloc(), the current buffer contents might not be
  12899. + * preserved and on error the old buffer is freed, thus no special handling to
  12900. + * avoid memleaks is necessary.
  12901. + *
  12902. + * `*ptr` is allowed to be `NULL`, in which case allocation always happens if
  12903. + * `size_needed` is greater than 0.
  12904. + *
  12905. + * @code{.c}
  12906. + * uint8_t *buf = ...;
  12907. + * av_fast_malloc(&buf, &current_size, size_needed);
  12908. + * if (!buf) {
  12909. + * // Allocation failed; buf already freed
  12910. + * return AVERROR(ENOMEM);
  12911. + * }
  12912. + * @endcode
  12913. + *
  12914. + * @param[in,out] ptr Pointer to pointer to an already allocated buffer.
  12915. + * `*ptr` will be overwritten with pointer to new
  12916. + * buffer on success or `NULL` on failure
  12917. + * @param[in,out] size Pointer to the size of buffer `*ptr`. `*size` is
  12918. + * updated to the new allocated size, in particular 0
  12919. + * in case of failure.
  12920. + * @param[in] min_size Desired minimal size of buffer `*ptr`
  12921. + * @see av_realloc()
  12922. + * @see av_fast_mallocz()
  12923. + */
  12924. +void av_fast_malloc(void* ptr, unsigned int* size, size_t min_size);
  12925. +
  12926. +/**
  12927. + * Allocate and clear a buffer, reusing the given one if large enough.
  12928. + *
  12929. + * Like av_fast_malloc(), but all newly allocated space is initially cleared.
  12930. + * Reused buffer is not cleared.
  12931. + *
  12932. + * `*ptr` is allowed to be `NULL`, in which case allocation always happens if
  12933. + * `size_needed` is greater than 0.
  12934. + *
  12935. + * @param[in,out] ptr Pointer to pointer to an already allocated buffer.
  12936. + * `*ptr` will be overwritten with pointer to new
  12937. + * buffer on success or `NULL` on failure
  12938. + * @param[in,out] size Pointer to the size of buffer `*ptr`. `*size` is
  12939. + * updated to the new allocated size, in particular 0
  12940. + * in case of failure.
  12941. + * @param[in] min_size Desired minimal size of buffer `*ptr`
  12942. + * @see av_fast_malloc()
  12943. + */
  12944. +void av_fast_mallocz(void* ptr, unsigned int* size, size_t min_size);
  12945. +
  12946. +/**
  12947. + * Free a memory block which has been allocated with a function of av_malloc()
  12948. + * or av_realloc() family.
  12949. + *
  12950. + * @param ptr Pointer to the memory block which should be freed.
  12951. + *
  12952. + * @note `ptr = NULL` is explicitly allowed.
  12953. + * @note It is recommended that you use av_freep() instead, to prevent leaving
  12954. + * behind dangling pointers.
  12955. + * @see av_freep()
  12956. + */
  12957. +void av_free(void* ptr);
  12958. +
  12959. +/**
  12960. + * Free a memory block which has been allocated with a function of av_malloc()
  12961. + * or av_realloc() family, and set the pointer pointing to it to `NULL`.
  12962. + *
  12963. + * @code{.c}
  12964. + * uint8_t *buf = av_malloc(16);
  12965. + * av_free(buf);
  12966. + * // buf now contains a dangling pointer to freed memory, and accidental
  12967. + * // dereference of buf will result in a use-after-free, which may be a
  12968. + * // security risk.
  12969. + *
  12970. + * uint8_t *buf = av_malloc(16);
  12971. + * av_freep(&buf);
  12972. + * // buf is now NULL, and accidental dereference will only result in a
  12973. + * // NULL-pointer dereference.
  12974. + * @endcode
  12975. + *
  12976. + * @param ptr Pointer to the pointer to the memory block which should be freed
  12977. + * @note `*ptr = NULL` is safe and leads to no action.
  12978. + * @see av_free()
  12979. + */
  12980. +void av_freep(void* ptr);
  12981. +
  12982. +/**
  12983. + * Duplicate a string.
  12984. + *
  12985. + * @param s String to be duplicated
  12986. + * @return Pointer to a newly-allocated string containing a
  12987. + * copy of `s` or `NULL` if the string cannot be allocated
  12988. + * @see av_strndup()
  12989. + */
  12990. +char* av_strdup(const char* s) av_malloc_attrib;
  12991. +
  12992. +/**
  12993. + * Duplicate a substring of a string.
  12994. + *
  12995. + * @param s String to be duplicated
  12996. + * @param len Maximum length of the resulting string (not counting the
  12997. + * terminating byte)
  12998. + * @return Pointer to a newly-allocated string containing a
  12999. + * substring of `s` or `NULL` if the string cannot be allocated
  13000. + */
  13001. +char* av_strndup(const char* s, size_t len) av_malloc_attrib;
  13002. +
  13003. +/**
  13004. + * Duplicate a buffer with av_malloc().
  13005. + *
  13006. + * @param p Buffer to be duplicated
  13007. + * @param size Size in bytes of the buffer copied
  13008. + * @return Pointer to a newly allocated buffer containing a
  13009. + * copy of `p` or `NULL` if the buffer cannot be allocated
  13010. + */
  13011. +void* av_memdup(const void* p, size_t size);
  13012. +
  13013. +/**
  13014. + * Overlapping memcpy() implementation.
  13015. + *
  13016. + * @param dst Destination buffer
  13017. + * @param back Number of bytes back to start copying (i.e. the initial size of
  13018. + * the overlapping window); must be > 0
  13019. + * @param cnt Number of bytes to copy; must be >= 0
  13020. + *
  13021. + * @note `cnt > back` is valid, this will copy the bytes we just copied,
  13022. + * thus creating a repeating pattern with a period length of `back`.
  13023. + */
  13024. +void av_memcpy_backptr(uint8_t* dst, int back, int cnt);
  13025. +
  13026. +/**
  13027. + * @}
  13028. + */
  13029. +
  13030. +/**
  13031. + * @defgroup lavu_mem_dynarray Dynamic Array
  13032. + *
  13033. + * Utilities to make an array grow when needed.
  13034. + *
  13035. + * Sometimes, the programmer would want to have an array that can grow when
  13036. + * needed. The libavutil dynamic array utilities fill that need.
  13037. + *
  13038. + * libavutil supports two systems of appending elements onto a dynamically
  13039. + * allocated array, the first one storing the pointer to the value in the
  13040. + * array, and the second storing the value directly. In both systems, the
  13041. + * caller is responsible for maintaining a variable containing the length of
  13042. + * the array, as well as freeing of the array after use.
  13043. + *
  13044. + * The first system stores pointers to values in a block of dynamically
  13045. + * allocated memory. Since only pointers are stored, the function does not need
  13046. + * to know the size of the type. Both av_dynarray_add() and
  13047. + * av_dynarray_add_nofree() implement this system.
  13048. + *
  13049. + * @code
  13050. + * type **array = NULL; //< an array of pointers to values
  13051. + * int nb = 0; //< a variable to keep track of the length of the array
  13052. + *
  13053. + * type to_be_added = ...;
  13054. + * type to_be_added2 = ...;
  13055. + *
  13056. + * av_dynarray_add(&array, &nb, &to_be_added);
  13057. + * if (nb == 0)
  13058. + * return AVERROR(ENOMEM);
  13059. + *
  13060. + * av_dynarray_add(&array, &nb, &to_be_added2);
  13061. + * if (nb == 0)
  13062. + * return AVERROR(ENOMEM);
  13063. + *
  13064. + * // Now:
  13065. + * // nb == 2
  13066. + * // &to_be_added == array[0]
  13067. + * // &to_be_added2 == array[1]
  13068. + *
  13069. + * av_freep(&array);
  13070. + * @endcode
  13071. + *
  13072. + * The second system stores the value directly in a block of memory. As a
  13073. + * result, the function has to know the size of the type. av_dynarray2_add()
  13074. + * implements this mechanism.
  13075. + *
  13076. + * @code
  13077. + * type *array = NULL; //< an array of values
  13078. + * int nb = 0; //< a variable to keep track of the length of the array
  13079. + *
  13080. + * type to_be_added = ...;
  13081. + * type to_be_added2 = ...;
  13082. + *
  13083. + * type *addr = av_dynarray2_add((void **)&array, &nb, sizeof(*array), NULL);
  13084. + * if (!addr)
  13085. + * return AVERROR(ENOMEM);
  13086. + * memcpy(addr, &to_be_added, sizeof(to_be_added));
  13087. + *
  13088. + * // Shortcut of the above.
  13089. + * type *addr = av_dynarray2_add((void **)&array, &nb, sizeof(*array),
  13090. + * (const void *)&to_be_added2);
  13091. + * if (!addr)
  13092. + * return AVERROR(ENOMEM);
  13093. + *
  13094. + * // Now:
  13095. + * // nb == 2
  13096. + * // to_be_added == array[0]
  13097. + * // to_be_added2 == array[1]
  13098. + *
  13099. + * av_freep(&array);
  13100. + * @endcode
  13101. + *
  13102. + * @{
  13103. + */
  13104. +
  13105. +/**
  13106. + * Add the pointer to an element to a dynamic array.
  13107. + *
  13108. + * The array to grow is supposed to be an array of pointers to
  13109. + * structures, and the element to add must be a pointer to an already
  13110. + * allocated structure.
  13111. + *
  13112. + * The array is reallocated when its size reaches powers of 2.
  13113. + * Therefore, the amortized cost of adding an element is constant.
  13114. + *
  13115. + * In case of success, the pointer to the array is updated in order to
  13116. + * point to the new grown array, and the number pointed to by `nb_ptr`
  13117. + * is incremented.
  13118. + * In case of failure, the array is freed, `*tab_ptr` is set to `NULL` and
  13119. + * `*nb_ptr` is set to 0.
  13120. + *
  13121. + * @param[in,out] tab_ptr Pointer to the array to grow
  13122. + * @param[in,out] nb_ptr Pointer to the number of elements in the array
  13123. + * @param[in] elem Element to add
  13124. + * @see av_dynarray_add_nofree(), av_dynarray2_add()
  13125. + */
  13126. +void av_dynarray_add(void* tab_ptr, int* nb_ptr, void* elem);
  13127. +
  13128. +/**
  13129. + * Add an element to a dynamic array.
  13130. + *
  13131. + * Function has the same functionality as av_dynarray_add(),
  13132. + * but it doesn't free memory on fails. It returns error code
  13133. + * instead and leave current buffer untouched.
  13134. + *
  13135. + * @return >=0 on success, negative otherwise
  13136. + * @see av_dynarray_add(), av_dynarray2_add()
  13137. + */
  13138. +av_warn_unused_result int av_dynarray_add_nofree(void* tab_ptr, int* nb_ptr,
  13139. + void* elem);
  13140. +
  13141. +/**
  13142. + * Add an element of size `elem_size` to a dynamic array.
  13143. + *
  13144. + * The array is reallocated when its number of elements reaches powers of 2.
  13145. + * Therefore, the amortized cost of adding an element is constant.
  13146. + *
  13147. + * In case of success, the pointer to the array is updated in order to
  13148. + * point to the new grown array, and the number pointed to by `nb_ptr`
  13149. + * is incremented.
  13150. + * In case of failure, the array is freed, `*tab_ptr` is set to `NULL` and
  13151. + * `*nb_ptr` is set to 0.
  13152. + *
  13153. + * @param[in,out] tab_ptr Pointer to the array to grow
  13154. + * @param[in,out] nb_ptr Pointer to the number of elements in the array
  13155. + * @param[in] elem_size Size in bytes of an element in the array
  13156. + * @param[in] elem_data Pointer to the data of the element to add. If
  13157. + * `NULL`, the space of the newly added element is
  13158. + * allocated but left uninitialized.
  13159. + *
  13160. + * @return Pointer to the data of the element to copy in the newly allocated
  13161. + * space
  13162. + * @see av_dynarray_add(), av_dynarray_add_nofree()
  13163. + */
  13164. +void* av_dynarray2_add(void** tab_ptr, int* nb_ptr, size_t elem_size,
  13165. + const uint8_t* elem_data);
  13166. +
  13167. +/**
  13168. + * @}
  13169. + */
  13170. +
  13171. +/**
  13172. + * @defgroup lavu_mem_misc Miscellaneous Functions
  13173. + *
  13174. + * Other functions related to memory allocation.
  13175. + *
  13176. + * @{
  13177. + */
  13178. +
  13179. +/**
  13180. + * Multiply two `size_t` values checking for overflow.
  13181. + *
  13182. + * @param[in] a Operand of multiplication
  13183. + * @param[in] b Operand of multiplication
  13184. + * @param[out] r Pointer to the result of the operation
  13185. + * @return 0 on success, AVERROR(EINVAL) on overflow
  13186. + */
  13187. +int av_size_mult(size_t a, size_t b, size_t* r);
  13188. +
  13189. +/**
  13190. + * Set the maximum size that may be allocated in one block.
  13191. + *
  13192. + * The value specified with this function is effective for all libavutil's @ref
  13193. + * lavu_mem_funcs "heap management functions."
  13194. + *
  13195. + * By default, the max value is defined as `INT_MAX`.
  13196. + *
  13197. + * @param max Value to be set as the new maximum size
  13198. + *
  13199. + * @warning Exercise extreme caution when using this function. Don't touch
  13200. + * this if you do not understand the full consequence of doing so.
  13201. + */
  13202. +void av_max_alloc(size_t max);
  13203. +
  13204. +/**
  13205. + * @}
  13206. + * @}
  13207. + */
  13208. +
  13209. +#endif /* AVUTIL_MEM_H */
  13210. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/pixfmt.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/pixfmt.h
  13211. new file mode 100644
  13212. index 00000000..b7516d9e
  13213. --- /dev/null
  13214. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/pixfmt.h
  13215. @@ -0,0 +1,891 @@
  13216. +/*
  13217. + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
  13218. + *
  13219. + * This file is part of FFmpeg.
  13220. + *
  13221. + * FFmpeg is free software; you can redistribute it and/or
  13222. + * modify it under the terms of the GNU Lesser General Public
  13223. + * License as published by the Free Software Foundation; either
  13224. + * version 2.1 of the License, or (at your option) any later version.
  13225. + *
  13226. + * FFmpeg is distributed in the hope that it will be useful,
  13227. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13228. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13229. + * Lesser General Public License for more details.
  13230. + *
  13231. + * You should have received a copy of the GNU Lesser General Public
  13232. + * License along with FFmpeg; if not, write to the Free Software
  13233. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  13234. + */
  13235. +
  13236. +#ifndef AVUTIL_PIXFMT_H
  13237. +#define AVUTIL_PIXFMT_H
  13238. +
  13239. +/**
  13240. + * @file
  13241. + * pixel format definitions
  13242. + */
  13243. +
  13244. +#include "libavutil/avconfig.h"
  13245. +#include "version.h"
  13246. +
  13247. +#define AVPALETTE_SIZE 1024
  13248. +#define AVPALETTE_COUNT 256
  13249. +
  13250. +/**
  13251. + * Pixel format.
  13252. + *
  13253. + * @note
  13254. + * AV_PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA
  13255. + * color is put together as:
  13256. + * (A << 24) | (R << 16) | (G << 8) | B
  13257. + * This is stored as BGRA on little-endian CPU architectures and ARGB on
  13258. + * big-endian CPUs.
  13259. + *
  13260. + * @note
  13261. + * If the resolution is not a multiple of the chroma subsampling factor
  13262. + * then the chroma plane resolution must be rounded up.
  13263. + *
  13264. + * @par
  13265. + * When the pixel format is palettized RGB32 (AV_PIX_FMT_PAL8), the palettized
  13266. + * image data is stored in AVFrame.data[0]. The palette is transported in
  13267. + * AVFrame.data[1], is 1024 bytes long (256 4-byte entries) and is
  13268. + * formatted the same as in AV_PIX_FMT_RGB32 described above (i.e., it is
  13269. + * also endian-specific). Note also that the individual RGB32 palette
  13270. + * components stored in AVFrame.data[1] should be in the range 0..255.
  13271. + * This is important as many custom PAL8 video codecs that were designed
  13272. + * to run on the IBM VGA graphics adapter use 6-bit palette components.
  13273. + *
  13274. + * @par
  13275. + * For all the 8 bits per pixel formats, an RGB32 palette is in data[1] like
  13276. + * for pal8. This palette is filled in automatically by the function
  13277. + * allocating the picture.
  13278. + */
  13279. +enum AVPixelFormat {
  13280. + AV_PIX_FMT_NONE = -1,
  13281. + AV_PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y
  13282. + ///< samples)
  13283. + AV_PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
  13284. + AV_PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB...
  13285. + AV_PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR...
  13286. + AV_PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y
  13287. + ///< samples)
  13288. + AV_PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y
  13289. + ///< samples)
  13290. + AV_PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y
  13291. + ///< samples)
  13292. + AV_PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y
  13293. + ///< samples)
  13294. + AV_PIX_FMT_GRAY8, ///< Y , 8bpp
  13295. + AV_PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black,
  13296. + ///< in each byte pixels are ordered from the
  13297. + ///< msb to the lsb
  13298. + AV_PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white,
  13299. + ///< in each byte pixels are ordered from the
  13300. + ///< msb to the lsb
  13301. + AV_PIX_FMT_PAL8, ///< 8 bits with AV_PIX_FMT_RGB32 palette
  13302. + AV_PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG),
  13303. + ///< deprecated in favor of AV_PIX_FMT_YUV420P and
  13304. + ///< setting color_range
  13305. + AV_PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG),
  13306. + ///< deprecated in favor of AV_PIX_FMT_YUV422P and
  13307. + ///< setting color_range
  13308. + AV_PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG),
  13309. + ///< deprecated in favor of AV_PIX_FMT_YUV444P and
  13310. + ///< setting color_range
  13311. + AV_PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
  13312. + AV_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
  13313. + AV_PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
  13314. + AV_PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb),
  13315. + ///< a byte contains two pixels, the first pixel in the byte
  13316. + ///< is the one composed by the 4 msb bits
  13317. + AV_PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
  13318. + AV_PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
  13319. + AV_PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb),
  13320. + ///< a byte contains two pixels, the first pixel in the byte
  13321. + ///< is the one composed by the 4 msb bits
  13322. + AV_PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
  13323. + AV_PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for
  13324. + ///< the UV components, which are interleaved (first byte U
  13325. + ///< and the following byte V)
  13326. + AV_PIX_FMT_NV21, ///< as above, but U and V bytes are swapped
  13327. +
  13328. + AV_PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
  13329. + AV_PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
  13330. + AV_PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
  13331. + AV_PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
  13332. +
  13333. + AV_PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian
  13334. + AV_PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian
  13335. + AV_PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y
  13336. + ///< samples)
  13337. + AV_PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in
  13338. + ///< favor of AV_PIX_FMT_YUV440P and setting color_range
  13339. + AV_PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2
  13340. + ///< Y & A samples)
  13341. + AV_PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the
  13342. + ///< 2-byte value for each R/G/B component is stored as
  13343. + ///< big-endian
  13344. + AV_PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the
  13345. + ///< 2-byte value for each R/G/B component is stored as
  13346. + ///< little-endian
  13347. +
  13348. + AV_PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb),
  13349. + ///< big-endian
  13350. + AV_PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb),
  13351. + ///< little-endian
  13352. + AV_PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb),
  13353. + ///< big-endian , X=unused/undefined
  13354. + AV_PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb),
  13355. + ///< little-endian, X=unused/undefined
  13356. +
  13357. + AV_PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb),
  13358. + ///< big-endian
  13359. + AV_PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb),
  13360. + ///< little-endian
  13361. + AV_PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb),
  13362. + ///< big-endian , X=unused/undefined
  13363. + AV_PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb),
  13364. + ///< little-endian, X=unused/undefined
  13365. +
  13366. + /**
  13367. + * Hardware acceleration through VA-API, data[3] contains a
  13368. + * VASurfaceID.
  13369. + */
  13370. + AV_PIX_FMT_VAAPI,
  13371. +
  13372. + AV_PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per
  13373. + ///< 2x2 Y samples), little-endian
  13374. + AV_PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per
  13375. + ///< 2x2 Y samples), big-endian
  13376. + AV_PIX_FMT_YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per
  13377. + ///< 2x1 Y samples), little-endian
  13378. + AV_PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per
  13379. + ///< 2x1 Y samples), big-endian
  13380. + AV_PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per
  13381. + ///< 1x1 Y samples), little-endian
  13382. + AV_PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per
  13383. + ///< 1x1 Y samples), big-endian
  13384. + AV_PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3]
  13385. + ///< contains a LPDIRECT3DSURFACE9 pointer
  13386. +
  13387. + AV_PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb),
  13388. + ///< little-endian, X=unused/undefined
  13389. + AV_PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb),
  13390. + ///< big-endian, X=unused/undefined
  13391. + AV_PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb),
  13392. + ///< little-endian, X=unused/undefined
  13393. + AV_PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb),
  13394. + ///< big-endian, X=unused/undefined
  13395. + AV_PIX_FMT_YA8, ///< 8 bits gray, 8 bits alpha
  13396. +
  13397. + AV_PIX_FMT_Y400A = AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8
  13398. + AV_PIX_FMT_GRAY8A = AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8
  13399. +
  13400. + AV_PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the
  13401. + ///< 2-byte value for each R/G/B component is stored as
  13402. + ///< big-endian
  13403. + AV_PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the
  13404. + ///< 2-byte value for each R/G/B component is stored as
  13405. + ///< little-endian
  13406. +
  13407. + /**
  13408. + * The following 12 formats have the disadvantage of needing 1 format for each
  13409. + * bit depth. Notice that each 9/10 bits sample is stored in 16 bits with
  13410. + * extra padding. If you want to support multiple bit depths, then using
  13411. + * AV_PIX_FMT_YUV420P16* with the bpp stored separately is better.
  13412. + */
  13413. + AV_PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per
  13414. + ///< 2x2 Y samples), big-endian
  13415. + AV_PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per
  13416. + ///< 2x2 Y samples), little-endian
  13417. + AV_PIX_FMT_YUV420P10BE, ///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per
  13418. + ///< 2x2 Y samples), big-endian
  13419. + AV_PIX_FMT_YUV420P10LE, ///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per
  13420. + ///< 2x2 Y samples), little-endian
  13421. + AV_PIX_FMT_YUV422P10BE, ///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per
  13422. + ///< 2x1 Y samples), big-endian
  13423. + AV_PIX_FMT_YUV422P10LE, ///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per
  13424. + ///< 2x1 Y samples), little-endian
  13425. + AV_PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per
  13426. + ///< 1x1 Y samples), big-endian
  13427. + AV_PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per
  13428. + ///< 1x1 Y samples), little-endian
  13429. + AV_PIX_FMT_YUV444P10BE, ///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per
  13430. + ///< 1x1 Y samples), big-endian
  13431. + AV_PIX_FMT_YUV444P10LE, ///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per
  13432. + ///< 1x1 Y samples), little-endian
  13433. + AV_PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per
  13434. + ///< 2x1 Y samples), big-endian
  13435. + AV_PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per
  13436. + ///< 2x1 Y samples), little-endian
  13437. + AV_PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp
  13438. + AV_PIX_FMT_GBR24P = AV_PIX_FMT_GBRP, // alias for #AV_PIX_FMT_GBRP
  13439. + AV_PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big-endian
  13440. + AV_PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little-endian
  13441. + AV_PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big-endian
  13442. + AV_PIX_FMT_GBRP10LE, ///< planar GBR 4:4:4 30bpp, little-endian
  13443. + AV_PIX_FMT_GBRP16BE, ///< planar GBR 4:4:4 48bpp, big-endian
  13444. + AV_PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little-endian
  13445. + AV_PIX_FMT_YUVA422P, ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y
  13446. + ///< & A samples)
  13447. + AV_PIX_FMT_YUVA444P, ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y
  13448. + ///< & A samples)
  13449. + AV_PIX_FMT_YUVA420P9BE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per
  13450. + ///< 2x2 Y & A samples), big-endian
  13451. + AV_PIX_FMT_YUVA420P9LE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per
  13452. + ///< 2x2 Y & A samples), little-endian
  13453. + AV_PIX_FMT_YUVA422P9BE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per
  13454. + ///< 2x1 Y & A samples), big-endian
  13455. + AV_PIX_FMT_YUVA422P9LE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per
  13456. + ///< 2x1 Y & A samples), little-endian
  13457. + AV_PIX_FMT_YUVA444P9BE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per
  13458. + ///< 1x1 Y & A samples), big-endian
  13459. + AV_PIX_FMT_YUVA444P9LE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per
  13460. + ///< 1x1 Y & A samples), little-endian
  13461. + AV_PIX_FMT_YUVA420P10BE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per
  13462. + ///< 2x2 Y & A samples, big-endian)
  13463. + AV_PIX_FMT_YUVA420P10LE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per
  13464. + ///< 2x2 Y & A samples, little-endian)
  13465. + AV_PIX_FMT_YUVA422P10BE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per
  13466. + ///< 2x1 Y & A samples, big-endian)
  13467. + AV_PIX_FMT_YUVA422P10LE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per
  13468. + ///< 2x1 Y & A samples, little-endian)
  13469. + AV_PIX_FMT_YUVA444P10BE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per
  13470. + ///< 1x1 Y & A samples, big-endian)
  13471. + AV_PIX_FMT_YUVA444P10LE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per
  13472. + ///< 1x1 Y & A samples, little-endian)
  13473. + AV_PIX_FMT_YUVA420P16BE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per
  13474. + ///< 2x2 Y & A samples, big-endian)
  13475. + AV_PIX_FMT_YUVA420P16LE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per
  13476. + ///< 2x2 Y & A samples, little-endian)
  13477. + AV_PIX_FMT_YUVA422P16BE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per
  13478. + ///< 2x1 Y & A samples, big-endian)
  13479. + AV_PIX_FMT_YUVA422P16LE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per
  13480. + ///< 2x1 Y & A samples, little-endian)
  13481. + AV_PIX_FMT_YUVA444P16BE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per
  13482. + ///< 1x1 Y & A samples, big-endian)
  13483. + AV_PIX_FMT_YUVA444P16LE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per
  13484. + ///< 1x1 Y & A samples, little-endian)
  13485. +
  13486. + AV_PIX_FMT_VDPAU, ///< HW acceleration through VDPAU, Picture.data[3]
  13487. + ///< contains a VdpVideoSurface
  13488. +
  13489. + AV_PIX_FMT_XYZ12LE, ///< packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb),
  13490. + ///< the 2-byte value for each X/Y/Z is stored as
  13491. + ///< little-endian, the 4 lower bits are set to 0
  13492. + AV_PIX_FMT_XYZ12BE, ///< packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb),
  13493. + ///< the 2-byte value for each X/Y/Z is stored as
  13494. + ///< big-endian, the 4 lower bits are set to 0
  13495. + AV_PIX_FMT_NV16, ///< interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample
  13496. + ///< per 2x1 Y samples)
  13497. + AV_PIX_FMT_NV20LE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb
  13498. + ///< sample per 2x1 Y samples), little-endian
  13499. + AV_PIX_FMT_NV20BE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb
  13500. + ///< sample per 2x1 Y samples), big-endian
  13501. +
  13502. + AV_PIX_FMT_RGBA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A,
  13503. + ///< the 2-byte value for each R/G/B/A component is
  13504. + ///< stored as big-endian
  13505. + AV_PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A,
  13506. + ///< the 2-byte value for each R/G/B/A component is
  13507. + ///< stored as little-endian
  13508. + AV_PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A,
  13509. + ///< the 2-byte value for each R/G/B/A component is
  13510. + ///< stored as big-endian
  13511. + AV_PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A,
  13512. + ///< the 2-byte value for each R/G/B/A component is
  13513. + ///< stored as little-endian
  13514. +
  13515. + AV_PIX_FMT_YVYU422, ///< packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb
  13516. +
  13517. + AV_PIX_FMT_YA16BE, ///< 16 bits gray, 16 bits alpha (big-endian)
  13518. + AV_PIX_FMT_YA16LE, ///< 16 bits gray, 16 bits alpha (little-endian)
  13519. +
  13520. + AV_PIX_FMT_GBRAP, ///< planar GBRA 4:4:4:4 32bpp
  13521. + AV_PIX_FMT_GBRAP16BE, ///< planar GBRA 4:4:4:4 64bpp, big-endian
  13522. + AV_PIX_FMT_GBRAP16LE, ///< planar GBRA 4:4:4:4 64bpp, little-endian
  13523. + /**
  13524. + * HW acceleration through QSV, data[3] contains a pointer to the
  13525. + * mfxFrameSurface1 structure.
  13526. + *
  13527. + * Before FFmpeg 5.0:
  13528. + * mfxFrameSurface1.Data.MemId contains a pointer when importing
  13529. + * the following frames as QSV frames:
  13530. + *
  13531. + * VAAPI:
  13532. + * mfxFrameSurface1.Data.MemId contains a pointer to VASurfaceID
  13533. + *
  13534. + * DXVA2:
  13535. + * mfxFrameSurface1.Data.MemId contains a pointer to IDirect3DSurface9
  13536. + *
  13537. + * FFmpeg 5.0 and above:
  13538. + * mfxFrameSurface1.Data.MemId contains a pointer to the mfxHDLPair
  13539. + * structure when importing the following frames as QSV frames:
  13540. + *
  13541. + * VAAPI:
  13542. + * mfxHDLPair.first contains a VASurfaceID pointer.
  13543. + * mfxHDLPair.second is always MFX_INFINITE.
  13544. + *
  13545. + * DXVA2:
  13546. + * mfxHDLPair.first contains IDirect3DSurface9 pointer.
  13547. + * mfxHDLPair.second is always MFX_INFINITE.
  13548. + *
  13549. + * D3D11:
  13550. + * mfxHDLPair.first contains a ID3D11Texture2D pointer.
  13551. + * mfxHDLPair.second contains the texture array index of the frame if the
  13552. + * ID3D11Texture2D is an array texture, or always MFX_INFINITE if it is a
  13553. + * normal texture.
  13554. + */
  13555. + AV_PIX_FMT_QSV,
  13556. + /**
  13557. + * HW acceleration though MMAL, data[3] contains a pointer to the
  13558. + * MMAL_BUFFER_HEADER_T structure.
  13559. + */
  13560. + AV_PIX_FMT_MMAL,
  13561. +
  13562. + AV_PIX_FMT_D3D11VA_VLD, ///< HW decoding through Direct3D11 via old API,
  13563. + ///< Picture.data[3] contains a
  13564. + ///< ID3D11VideoDecoderOutputView pointer
  13565. +
  13566. + /**
  13567. + * HW acceleration through CUDA. data[i] contain CUdeviceptr pointers
  13568. + * exactly as for system memory frames.
  13569. + */
  13570. + AV_PIX_FMT_CUDA,
  13571. +
  13572. + AV_PIX_FMT_0RGB, ///< packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
  13573. + AV_PIX_FMT_RGB0, ///< packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
  13574. + AV_PIX_FMT_0BGR, ///< packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
  13575. + AV_PIX_FMT_BGR0, ///< packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
  13576. +
  13577. + AV_PIX_FMT_YUV420P12BE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per
  13578. + ///< 2x2 Y samples), big-endian
  13579. + AV_PIX_FMT_YUV420P12LE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per
  13580. + ///< 2x2 Y samples), little-endian
  13581. + AV_PIX_FMT_YUV420P14BE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per
  13582. + ///< 2x2 Y samples), big-endian
  13583. + AV_PIX_FMT_YUV420P14LE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per
  13584. + ///< 2x2 Y samples), little-endian
  13585. + AV_PIX_FMT_YUV422P12BE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per
  13586. + ///< 2x1 Y samples), big-endian
  13587. + AV_PIX_FMT_YUV422P12LE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per
  13588. + ///< 2x1 Y samples), little-endian
  13589. + AV_PIX_FMT_YUV422P14BE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per
  13590. + ///< 2x1 Y samples), big-endian
  13591. + AV_PIX_FMT_YUV422P14LE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per
  13592. + ///< 2x1 Y samples), little-endian
  13593. + AV_PIX_FMT_YUV444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per
  13594. + ///< 1x1 Y samples), big-endian
  13595. + AV_PIX_FMT_YUV444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per
  13596. + ///< 1x1 Y samples), little-endian
  13597. + AV_PIX_FMT_YUV444P14BE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per
  13598. + ///< 1x1 Y samples), big-endian
  13599. + AV_PIX_FMT_YUV444P14LE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per
  13600. + ///< 1x1 Y samples), little-endian
  13601. + AV_PIX_FMT_GBRP12BE, ///< planar GBR 4:4:4 36bpp, big-endian
  13602. + AV_PIX_FMT_GBRP12LE, ///< planar GBR 4:4:4 36bpp, little-endian
  13603. + AV_PIX_FMT_GBRP14BE, ///< planar GBR 4:4:4 42bpp, big-endian
  13604. + AV_PIX_FMT_GBRP14LE, ///< planar GBR 4:4:4 42bpp, little-endian
  13605. + AV_PIX_FMT_YUVJ411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1
  13606. + ///< Y samples) full scale (JPEG), deprecated in favor
  13607. + ///< of AV_PIX_FMT_YUV411P and setting color_range
  13608. +
  13609. + AV_PIX_FMT_BAYER_BGGR8, ///< bayer, BGBG..(odd line), GRGR..(even line),
  13610. + ///< 8-bit samples
  13611. + AV_PIX_FMT_BAYER_RGGB8, ///< bayer, RGRG..(odd line), GBGB..(even line),
  13612. + ///< 8-bit samples
  13613. + AV_PIX_FMT_BAYER_GBRG8, ///< bayer, GBGB..(odd line), RGRG..(even line),
  13614. + ///< 8-bit samples
  13615. + AV_PIX_FMT_BAYER_GRBG8, ///< bayer, GRGR..(odd line), BGBG..(even line),
  13616. + ///< 8-bit samples
  13617. + AV_PIX_FMT_BAYER_BGGR16LE, ///< bayer, BGBG..(odd line), GRGR..(even line),
  13618. + ///< 16-bit samples, little-endian
  13619. + AV_PIX_FMT_BAYER_BGGR16BE, ///< bayer, BGBG..(odd line), GRGR..(even line),
  13620. + ///< 16-bit samples, big-endian
  13621. + AV_PIX_FMT_BAYER_RGGB16LE, ///< bayer, RGRG..(odd line), GBGB..(even line),
  13622. + ///< 16-bit samples, little-endian
  13623. + AV_PIX_FMT_BAYER_RGGB16BE, ///< bayer, RGRG..(odd line), GBGB..(even line),
  13624. + ///< 16-bit samples, big-endian
  13625. + AV_PIX_FMT_BAYER_GBRG16LE, ///< bayer, GBGB..(odd line), RGRG..(even line),
  13626. + ///< 16-bit samples, little-endian
  13627. + AV_PIX_FMT_BAYER_GBRG16BE, ///< bayer, GBGB..(odd line), RGRG..(even line),
  13628. + ///< 16-bit samples, big-endian
  13629. + AV_PIX_FMT_BAYER_GRBG16LE, ///< bayer, GRGR..(odd line), BGBG..(even line),
  13630. + ///< 16-bit samples, little-endian
  13631. + AV_PIX_FMT_BAYER_GRBG16BE, ///< bayer, GRGR..(odd line), BGBG..(even line),
  13632. + ///< 16-bit samples, big-endian
  13633. +
  13634. +#if FF_API_XVMC
  13635. + AV_PIX_FMT_XVMC, ///< XVideo Motion Acceleration via common packet passing
  13636. +#endif
  13637. +
  13638. + AV_PIX_FMT_YUV440P10LE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per
  13639. + ///< 1x2 Y samples), little-endian
  13640. + AV_PIX_FMT_YUV440P10BE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per
  13641. + ///< 1x2 Y samples), big-endian
  13642. + AV_PIX_FMT_YUV440P12LE, ///< planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per
  13643. + ///< 1x2 Y samples), little-endian
  13644. + AV_PIX_FMT_YUV440P12BE, ///< planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per
  13645. + ///< 1x2 Y samples), big-endian
  13646. + AV_PIX_FMT_AYUV64LE, ///< packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y
  13647. + ///< & A samples), little-endian
  13648. + AV_PIX_FMT_AYUV64BE, ///< packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y
  13649. + ///< & A samples), big-endian
  13650. +
  13651. + AV_PIX_FMT_VIDEOTOOLBOX, ///< hardware decoding through Videotoolbox
  13652. +
  13653. + AV_PIX_FMT_P010LE, ///< like NV12, with 10bpp per component, data in the high
  13654. + ///< bits, zeros in the low bits, little-endian
  13655. + AV_PIX_FMT_P010BE, ///< like NV12, with 10bpp per component, data in the high
  13656. + ///< bits, zeros in the low bits, big-endian
  13657. +
  13658. + AV_PIX_FMT_GBRAP12BE, ///< planar GBR 4:4:4:4 48bpp, big-endian
  13659. + AV_PIX_FMT_GBRAP12LE, ///< planar GBR 4:4:4:4 48bpp, little-endian
  13660. +
  13661. + AV_PIX_FMT_GBRAP10BE, ///< planar GBR 4:4:4:4 40bpp, big-endian
  13662. + AV_PIX_FMT_GBRAP10LE, ///< planar GBR 4:4:4:4 40bpp, little-endian
  13663. +
  13664. + AV_PIX_FMT_MEDIACODEC, ///< hardware decoding through MediaCodec
  13665. +
  13666. + AV_PIX_FMT_GRAY12BE, ///< Y , 12bpp, big-endian
  13667. + AV_PIX_FMT_GRAY12LE, ///< Y , 12bpp, little-endian
  13668. + AV_PIX_FMT_GRAY10BE, ///< Y , 10bpp, big-endian
  13669. + AV_PIX_FMT_GRAY10LE, ///< Y , 10bpp, little-endian
  13670. +
  13671. + AV_PIX_FMT_P016LE, ///< like NV12, with 16bpp per component, little-endian
  13672. + AV_PIX_FMT_P016BE, ///< like NV12, with 16bpp per component, big-endian
  13673. +
  13674. + /**
  13675. + * Hardware surfaces for Direct3D11.
  13676. + *
  13677. + * This is preferred over the legacy AV_PIX_FMT_D3D11VA_VLD. The new D3D11
  13678. + * hwaccel API and filtering support AV_PIX_FMT_D3D11 only.
  13679. + *
  13680. + * data[0] contains a ID3D11Texture2D pointer, and data[1] contains the
  13681. + * texture array index of the frame as intptr_t if the ID3D11Texture2D is
  13682. + * an array texture (or always 0 if it's a normal texture).
  13683. + */
  13684. + AV_PIX_FMT_D3D11,
  13685. +
  13686. + AV_PIX_FMT_GRAY9BE, ///< Y , 9bpp, big-endian
  13687. + AV_PIX_FMT_GRAY9LE, ///< Y , 9bpp, little-endian
  13688. +
  13689. + AV_PIX_FMT_GBRPF32BE, ///< IEEE-754 single precision planar GBR 4:4:4, 96bpp,
  13690. + ///< big-endian
  13691. + AV_PIX_FMT_GBRPF32LE, ///< IEEE-754 single precision planar GBR 4:4:4, 96bpp,
  13692. + ///< little-endian
  13693. + AV_PIX_FMT_GBRAPF32BE, ///< IEEE-754 single precision planar GBRA 4:4:4:4,
  13694. + ///< 128bpp, big-endian
  13695. + AV_PIX_FMT_GBRAPF32LE, ///< IEEE-754 single precision planar GBRA 4:4:4:4,
  13696. + ///< 128bpp, little-endian
  13697. +
  13698. + /**
  13699. + * DRM-managed buffers exposed through PRIME buffer sharing.
  13700. + *
  13701. + * data[0] points to an AVDRMFrameDescriptor.
  13702. + */
  13703. + AV_PIX_FMT_DRM_PRIME,
  13704. + /**
  13705. + * Hardware surfaces for OpenCL.
  13706. + *
  13707. + * data[i] contain 2D image objects (typed in C as cl_mem, used
  13708. + * in OpenCL as image2d_t) for each plane of the surface.
  13709. + */
  13710. + AV_PIX_FMT_OPENCL,
  13711. +
  13712. + AV_PIX_FMT_GRAY14BE, ///< Y , 14bpp, big-endian
  13713. + AV_PIX_FMT_GRAY14LE, ///< Y , 14bpp, little-endian
  13714. +
  13715. + AV_PIX_FMT_GRAYF32BE, ///< IEEE-754 single precision Y, 32bpp, big-endian
  13716. + AV_PIX_FMT_GRAYF32LE, ///< IEEE-754 single precision Y, 32bpp, little-endian
  13717. +
  13718. + AV_PIX_FMT_YUVA422P12BE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per
  13719. + ///< 2x1 Y samples), 12b alpha, big-endian
  13720. + AV_PIX_FMT_YUVA422P12LE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per
  13721. + ///< 2x1 Y samples), 12b alpha, little-endian
  13722. + AV_PIX_FMT_YUVA444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per
  13723. + ///< 1x1 Y samples), 12b alpha, big-endian
  13724. + AV_PIX_FMT_YUVA444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per
  13725. + ///< 1x1 Y samples), 12b alpha, little-endian
  13726. +
  13727. + AV_PIX_FMT_NV24, ///< planar YUV 4:4:4, 24bpp, 1 plane for Y and 1 plane for
  13728. + ///< the UV components, which are interleaved (first byte U
  13729. + ///< and the following byte V)
  13730. + AV_PIX_FMT_NV42, ///< as above, but U and V bytes are swapped
  13731. +
  13732. + /**
  13733. + * Vulkan hardware images.
  13734. + *
  13735. + * data[0] points to an AVVkFrame
  13736. + */
  13737. + AV_PIX_FMT_VULKAN,
  13738. +
  13739. + AV_PIX_FMT_Y210BE, ///< packed YUV 4:2:2 like YUYV422, 20bpp, data in the
  13740. + ///< high bits, big-endian
  13741. + AV_PIX_FMT_Y210LE, ///< packed YUV 4:2:2 like YUYV422, 20bpp, data in the
  13742. + ///< high bits, little-endian
  13743. +
  13744. + AV_PIX_FMT_X2RGB10LE, ///< packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G
  13745. + ///< 10B(lsb), little-endian, X=unused/undefined
  13746. + AV_PIX_FMT_X2RGB10BE, ///< packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G
  13747. + ///< 10B(lsb), big-endian, X=unused/undefined
  13748. + AV_PIX_FMT_X2BGR10LE, ///< packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G
  13749. + ///< 10R(lsb), little-endian, X=unused/undefined
  13750. + AV_PIX_FMT_X2BGR10BE, ///< packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G
  13751. + ///< 10R(lsb), big-endian, X=unused/undefined
  13752. +
  13753. + AV_PIX_FMT_P210BE, ///< interleaved chroma YUV 4:2:2, 20bpp, data in the high
  13754. + ///< bits, big-endian
  13755. + AV_PIX_FMT_P210LE, ///< interleaved chroma YUV 4:2:2, 20bpp, data in the high
  13756. + ///< bits, little-endian
  13757. +
  13758. + AV_PIX_FMT_P410BE, ///< interleaved chroma YUV 4:4:4, 30bpp, data in the high
  13759. + ///< bits, big-endian
  13760. + AV_PIX_FMT_P410LE, ///< interleaved chroma YUV 4:4:4, 30bpp, data in the high
  13761. + ///< bits, little-endian
  13762. +
  13763. + AV_PIX_FMT_P216BE, ///< interleaved chroma YUV 4:2:2, 32bpp, big-endian
  13764. + AV_PIX_FMT_P216LE, ///< interleaved chroma YUV 4:2:2, 32bpp, little-endian
  13765. +
  13766. + AV_PIX_FMT_P416BE, ///< interleaved chroma YUV 4:4:4, 48bpp, big-endian
  13767. + AV_PIX_FMT_P416LE, ///< interleaved chroma YUV 4:4:4, 48bpp, little-endian
  13768. +
  13769. + AV_PIX_FMT_VUYA, ///< packed VUYA 4:4:4, 32bpp, VUYAVUYA...
  13770. +
  13771. + AV_PIX_FMT_RGBAF16BE, ///< IEEE-754 half precision packed RGBA 16:16:16:16,
  13772. + ///< 64bpp, RGBARGBA..., big-endian
  13773. + AV_PIX_FMT_RGBAF16LE, ///< IEEE-754 half precision packed RGBA 16:16:16:16,
  13774. + ///< 64bpp, RGBARGBA..., little-endian
  13775. +
  13776. + AV_PIX_FMT_VUYX, ///< packed VUYX 4:4:4, 32bpp, Variant of VUYA where alpha
  13777. + ///< channel is left undefined
  13778. +
  13779. + AV_PIX_FMT_P012LE, ///< like NV12, with 12bpp per component, data in the high
  13780. + ///< bits, zeros in the low bits, little-endian
  13781. + AV_PIX_FMT_P012BE, ///< like NV12, with 12bpp per component, data in the high
  13782. + ///< bits, zeros in the low bits, big-endian
  13783. +
  13784. + AV_PIX_FMT_Y212BE, ///< packed YUV 4:2:2 like YUYV422, 24bpp, data in the
  13785. + ///< high bits, zeros in the low bits, big-endian
  13786. + AV_PIX_FMT_Y212LE, ///< packed YUV 4:2:2 like YUYV422, 24bpp, data in the
  13787. + ///< high bits, zeros in the low bits, little-endian
  13788. +
  13789. + AV_PIX_FMT_XV30BE, ///< packed XVYU 4:4:4, 32bpp, (msb)2X 10V 10Y 10U(lsb),
  13790. + ///< big-endian, variant of Y410 where alpha channel is
  13791. + ///< left undefined
  13792. + AV_PIX_FMT_XV30LE, ///< packed XVYU 4:4:4, 32bpp, (msb)2X 10V 10Y 10U(lsb),
  13793. + ///< little-endian, variant of Y410 where alpha channel is
  13794. + ///< left undefined
  13795. +
  13796. + AV_PIX_FMT_XV36BE, ///< packed XVYU 4:4:4, 48bpp, data in the high bits,
  13797. + ///< zeros in the low bits, big-endian, variant of Y412
  13798. + ///< where alpha channel is left undefined
  13799. + AV_PIX_FMT_XV36LE, ///< packed XVYU 4:4:4, 48bpp, data in the high bits,
  13800. + ///< zeros in the low bits, little-endian, variant of Y412
  13801. + ///< where alpha channel is left undefined
  13802. +
  13803. + AV_PIX_FMT_RGBF32BE, ///< IEEE-754 single precision packed RGB 32:32:32,
  13804. + ///< 96bpp, RGBRGB..., big-endian
  13805. + AV_PIX_FMT_RGBF32LE, ///< IEEE-754 single precision packed RGB 32:32:32,
  13806. + ///< 96bpp, RGBRGB..., little-endian
  13807. +
  13808. + AV_PIX_FMT_RGBAF32BE, ///< IEEE-754 single precision packed RGBA 32:32:32:32,
  13809. + ///< 128bpp, RGBARGBA..., big-endian
  13810. + AV_PIX_FMT_RGBAF32LE, ///< IEEE-754 single precision packed RGBA 32:32:32:32,
  13811. + ///< 128bpp, RGBARGBA..., little-endian
  13812. +
  13813. + AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to
  13814. + ///< link with shared libav* because the number of formats
  13815. + ///< might differ between versions
  13816. +};
  13817. +
  13818. +#if AV_HAVE_BIGENDIAN
  13819. +# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##be
  13820. +#else
  13821. +# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##le
  13822. +#endif
  13823. +
  13824. +#define AV_PIX_FMT_RGB32 AV_PIX_FMT_NE(ARGB, BGRA)
  13825. +#define AV_PIX_FMT_RGB32_1 AV_PIX_FMT_NE(RGBA, ABGR)
  13826. +#define AV_PIX_FMT_BGR32 AV_PIX_FMT_NE(ABGR, RGBA)
  13827. +#define AV_PIX_FMT_BGR32_1 AV_PIX_FMT_NE(BGRA, ARGB)
  13828. +#define AV_PIX_FMT_0RGB32 AV_PIX_FMT_NE(0RGB, BGR0)
  13829. +#define AV_PIX_FMT_0BGR32 AV_PIX_FMT_NE(0BGR, RGB0)
  13830. +
  13831. +#define AV_PIX_FMT_GRAY9 AV_PIX_FMT_NE(GRAY9BE, GRAY9LE)
  13832. +#define AV_PIX_FMT_GRAY10 AV_PIX_FMT_NE(GRAY10BE, GRAY10LE)
  13833. +#define AV_PIX_FMT_GRAY12 AV_PIX_FMT_NE(GRAY12BE, GRAY12LE)
  13834. +#define AV_PIX_FMT_GRAY14 AV_PIX_FMT_NE(GRAY14BE, GRAY14LE)
  13835. +#define AV_PIX_FMT_GRAY16 AV_PIX_FMT_NE(GRAY16BE, GRAY16LE)
  13836. +#define AV_PIX_FMT_YA16 AV_PIX_FMT_NE(YA16BE, YA16LE)
  13837. +#define AV_PIX_FMT_RGB48 AV_PIX_FMT_NE(RGB48BE, RGB48LE)
  13838. +#define AV_PIX_FMT_RGB565 AV_PIX_FMT_NE(RGB565BE, RGB565LE)
  13839. +#define AV_PIX_FMT_RGB555 AV_PIX_FMT_NE(RGB555BE, RGB555LE)
  13840. +#define AV_PIX_FMT_RGB444 AV_PIX_FMT_NE(RGB444BE, RGB444LE)
  13841. +#define AV_PIX_FMT_RGBA64 AV_PIX_FMT_NE(RGBA64BE, RGBA64LE)
  13842. +#define AV_PIX_FMT_BGR48 AV_PIX_FMT_NE(BGR48BE, BGR48LE)
  13843. +#define AV_PIX_FMT_BGR565 AV_PIX_FMT_NE(BGR565BE, BGR565LE)
  13844. +#define AV_PIX_FMT_BGR555 AV_PIX_FMT_NE(BGR555BE, BGR555LE)
  13845. +#define AV_PIX_FMT_BGR444 AV_PIX_FMT_NE(BGR444BE, BGR444LE)
  13846. +#define AV_PIX_FMT_BGRA64 AV_PIX_FMT_NE(BGRA64BE, BGRA64LE)
  13847. +
  13848. +#define AV_PIX_FMT_YUV420P9 AV_PIX_FMT_NE(YUV420P9BE, YUV420P9LE)
  13849. +#define AV_PIX_FMT_YUV422P9 AV_PIX_FMT_NE(YUV422P9BE, YUV422P9LE)
  13850. +#define AV_PIX_FMT_YUV444P9 AV_PIX_FMT_NE(YUV444P9BE, YUV444P9LE)
  13851. +#define AV_PIX_FMT_YUV420P10 AV_PIX_FMT_NE(YUV420P10BE, YUV420P10LE)
  13852. +#define AV_PIX_FMT_YUV422P10 AV_PIX_FMT_NE(YUV422P10BE, YUV422P10LE)
  13853. +#define AV_PIX_FMT_YUV440P10 AV_PIX_FMT_NE(YUV440P10BE, YUV440P10LE)
  13854. +#define AV_PIX_FMT_YUV444P10 AV_PIX_FMT_NE(YUV444P10BE, YUV444P10LE)
  13855. +#define AV_PIX_FMT_YUV420P12 AV_PIX_FMT_NE(YUV420P12BE, YUV420P12LE)
  13856. +#define AV_PIX_FMT_YUV422P12 AV_PIX_FMT_NE(YUV422P12BE, YUV422P12LE)
  13857. +#define AV_PIX_FMT_YUV440P12 AV_PIX_FMT_NE(YUV440P12BE, YUV440P12LE)
  13858. +#define AV_PIX_FMT_YUV444P12 AV_PIX_FMT_NE(YUV444P12BE, YUV444P12LE)
  13859. +#define AV_PIX_FMT_YUV420P14 AV_PIX_FMT_NE(YUV420P14BE, YUV420P14LE)
  13860. +#define AV_PIX_FMT_YUV422P14 AV_PIX_FMT_NE(YUV422P14BE, YUV422P14LE)
  13861. +#define AV_PIX_FMT_YUV444P14 AV_PIX_FMT_NE(YUV444P14BE, YUV444P14LE)
  13862. +#define AV_PIX_FMT_YUV420P16 AV_PIX_FMT_NE(YUV420P16BE, YUV420P16LE)
  13863. +#define AV_PIX_FMT_YUV422P16 AV_PIX_FMT_NE(YUV422P16BE, YUV422P16LE)
  13864. +#define AV_PIX_FMT_YUV444P16 AV_PIX_FMT_NE(YUV444P16BE, YUV444P16LE)
  13865. +
  13866. +#define AV_PIX_FMT_GBRP9 AV_PIX_FMT_NE(GBRP9BE, GBRP9LE)
  13867. +#define AV_PIX_FMT_GBRP10 AV_PIX_FMT_NE(GBRP10BE, GBRP10LE)
  13868. +#define AV_PIX_FMT_GBRP12 AV_PIX_FMT_NE(GBRP12BE, GBRP12LE)
  13869. +#define AV_PIX_FMT_GBRP14 AV_PIX_FMT_NE(GBRP14BE, GBRP14LE)
  13870. +#define AV_PIX_FMT_GBRP16 AV_PIX_FMT_NE(GBRP16BE, GBRP16LE)
  13871. +#define AV_PIX_FMT_GBRAP10 AV_PIX_FMT_NE(GBRAP10BE, GBRAP10LE)
  13872. +#define AV_PIX_FMT_GBRAP12 AV_PIX_FMT_NE(GBRAP12BE, GBRAP12LE)
  13873. +#define AV_PIX_FMT_GBRAP16 AV_PIX_FMT_NE(GBRAP16BE, GBRAP16LE)
  13874. +
  13875. +#define AV_PIX_FMT_BAYER_BGGR16 AV_PIX_FMT_NE(BAYER_BGGR16BE, BAYER_BGGR16LE)
  13876. +#define AV_PIX_FMT_BAYER_RGGB16 AV_PIX_FMT_NE(BAYER_RGGB16BE, BAYER_RGGB16LE)
  13877. +#define AV_PIX_FMT_BAYER_GBRG16 AV_PIX_FMT_NE(BAYER_GBRG16BE, BAYER_GBRG16LE)
  13878. +#define AV_PIX_FMT_BAYER_GRBG16 AV_PIX_FMT_NE(BAYER_GRBG16BE, BAYER_GRBG16LE)
  13879. +
  13880. +#define AV_PIX_FMT_GBRPF32 AV_PIX_FMT_NE(GBRPF32BE, GBRPF32LE)
  13881. +#define AV_PIX_FMT_GBRAPF32 AV_PIX_FMT_NE(GBRAPF32BE, GBRAPF32LE)
  13882. +
  13883. +#define AV_PIX_FMT_GRAYF32 AV_PIX_FMT_NE(GRAYF32BE, GRAYF32LE)
  13884. +
  13885. +#define AV_PIX_FMT_YUVA420P9 AV_PIX_FMT_NE(YUVA420P9BE, YUVA420P9LE)
  13886. +#define AV_PIX_FMT_YUVA422P9 AV_PIX_FMT_NE(YUVA422P9BE, YUVA422P9LE)
  13887. +#define AV_PIX_FMT_YUVA444P9 AV_PIX_FMT_NE(YUVA444P9BE, YUVA444P9LE)
  13888. +#define AV_PIX_FMT_YUVA420P10 AV_PIX_FMT_NE(YUVA420P10BE, YUVA420P10LE)
  13889. +#define AV_PIX_FMT_YUVA422P10 AV_PIX_FMT_NE(YUVA422P10BE, YUVA422P10LE)
  13890. +#define AV_PIX_FMT_YUVA444P10 AV_PIX_FMT_NE(YUVA444P10BE, YUVA444P10LE)
  13891. +#define AV_PIX_FMT_YUVA422P12 AV_PIX_FMT_NE(YUVA422P12BE, YUVA422P12LE)
  13892. +#define AV_PIX_FMT_YUVA444P12 AV_PIX_FMT_NE(YUVA444P12BE, YUVA444P12LE)
  13893. +#define AV_PIX_FMT_YUVA420P16 AV_PIX_FMT_NE(YUVA420P16BE, YUVA420P16LE)
  13894. +#define AV_PIX_FMT_YUVA422P16 AV_PIX_FMT_NE(YUVA422P16BE, YUVA422P16LE)
  13895. +#define AV_PIX_FMT_YUVA444P16 AV_PIX_FMT_NE(YUVA444P16BE, YUVA444P16LE)
  13896. +
  13897. +#define AV_PIX_FMT_XYZ12 AV_PIX_FMT_NE(XYZ12BE, XYZ12LE)
  13898. +#define AV_PIX_FMT_NV20 AV_PIX_FMT_NE(NV20BE, NV20LE)
  13899. +#define AV_PIX_FMT_AYUV64 AV_PIX_FMT_NE(AYUV64BE, AYUV64LE)
  13900. +#define AV_PIX_FMT_P010 AV_PIX_FMT_NE(P010BE, P010LE)
  13901. +#define AV_PIX_FMT_P012 AV_PIX_FMT_NE(P012BE, P012LE)
  13902. +#define AV_PIX_FMT_P016 AV_PIX_FMT_NE(P016BE, P016LE)
  13903. +
  13904. +#define AV_PIX_FMT_Y210 AV_PIX_FMT_NE(Y210BE, Y210LE)
  13905. +#define AV_PIX_FMT_Y212 AV_PIX_FMT_NE(Y212BE, Y212LE)
  13906. +#define AV_PIX_FMT_XV30 AV_PIX_FMT_NE(XV30BE, XV30LE)
  13907. +#define AV_PIX_FMT_XV36 AV_PIX_FMT_NE(XV36BE, XV36LE)
  13908. +#define AV_PIX_FMT_X2RGB10 AV_PIX_FMT_NE(X2RGB10BE, X2RGB10LE)
  13909. +#define AV_PIX_FMT_X2BGR10 AV_PIX_FMT_NE(X2BGR10BE, X2BGR10LE)
  13910. +
  13911. +#define AV_PIX_FMT_P210 AV_PIX_FMT_NE(P210BE, P210LE)
  13912. +#define AV_PIX_FMT_P410 AV_PIX_FMT_NE(P410BE, P410LE)
  13913. +#define AV_PIX_FMT_P216 AV_PIX_FMT_NE(P216BE, P216LE)
  13914. +#define AV_PIX_FMT_P416 AV_PIX_FMT_NE(P416BE, P416LE)
  13915. +
  13916. +#define AV_PIX_FMT_RGBAF16 AV_PIX_FMT_NE(RGBAF16BE, RGBAF16LE)
  13917. +
  13918. +#define AV_PIX_FMT_RGBF32 AV_PIX_FMT_NE(RGBF32BE, RGBF32LE)
  13919. +#define AV_PIX_FMT_RGBAF32 AV_PIX_FMT_NE(RGBAF32BE, RGBAF32LE)
  13920. +
  13921. +/**
  13922. + * Chromaticity coordinates of the source primaries.
  13923. + * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.1 and
  13924. + * ITU-T H.273.
  13925. + */
  13926. +enum AVColorPrimaries {
  13927. + AVCOL_PRI_RESERVED0 = 0,
  13928. + AVCOL_PRI_BT709 =
  13929. + 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP 177 Annex B
  13930. + AVCOL_PRI_UNSPECIFIED = 2,
  13931. + AVCOL_PRI_RESERVED = 3,
  13932. + AVCOL_PRI_BT470M =
  13933. + 4, ///< also FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
  13934. +
  13935. + AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R
  13936. + ///< BT1700 625 PAL & SECAM
  13937. + AVCOL_PRI_SMPTE170M =
  13938. + 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
  13939. + AVCOL_PRI_SMPTE240M =
  13940. + 7, ///< identical to above, also called "SMPTE C" even though it uses D65
  13941. + AVCOL_PRI_FILM = 8, ///< colour filters using Illuminant C
  13942. + AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020
  13943. + AVCOL_PRI_SMPTE428 = 10, ///< SMPTE ST 428-1 (CIE 1931 XYZ)
  13944. + AVCOL_PRI_SMPTEST428_1 = AVCOL_PRI_SMPTE428,
  13945. + AVCOL_PRI_SMPTE431 = 11, ///< SMPTE ST 431-2 (2011) / DCI P3
  13946. + AVCOL_PRI_SMPTE432 = 12, ///< SMPTE ST 432-1 (2010) / P3 D65 / Display P3
  13947. + AVCOL_PRI_EBU3213 = 22, ///< EBU Tech. 3213-E (nothing there) / one of JEDEC
  13948. + ///< P22 group phosphors
  13949. + AVCOL_PRI_JEDEC_P22 = AVCOL_PRI_EBU3213,
  13950. + AVCOL_PRI_NB ///< Not part of ABI
  13951. +};
  13952. +
  13953. +/**
  13954. + * Color Transfer Characteristic.
  13955. + * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.2.
  13956. + */
  13957. +enum AVColorTransferCharacteristic {
  13958. + AVCOL_TRC_RESERVED0 = 0,
  13959. + AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361
  13960. + AVCOL_TRC_UNSPECIFIED = 2,
  13961. + AVCOL_TRC_RESERVED = 3,
  13962. + AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
  13963. + AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG
  13964. + AVCOL_TRC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 or 625 / ITU-R BT1358
  13965. + ///< 525 or 625 / ITU-R BT1700 NTSC
  13966. + AVCOL_TRC_SMPTE240M = 7,
  13967. + AVCOL_TRC_LINEAR = 8, ///< "Linear transfer characteristics"
  13968. + AVCOL_TRC_LOG = 9, ///< "Logarithmic transfer characteristic (100:1 range)"
  13969. + AVCOL_TRC_LOG_SQRT =
  13970. + 10, ///< "Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)"
  13971. + AVCOL_TRC_IEC61966_2_4 = 11, ///< IEC 61966-2-4
  13972. + AVCOL_TRC_BT1361_ECG = 12, ///< ITU-R BT1361 Extended Colour Gamut
  13973. + AVCOL_TRC_IEC61966_2_1 = 13, ///< IEC 61966-2-1 (sRGB or sYCC)
  13974. + AVCOL_TRC_BT2020_10 = 14, ///< ITU-R BT2020 for 10-bit system
  13975. + AVCOL_TRC_BT2020_12 = 15, ///< ITU-R BT2020 for 12-bit system
  13976. + AVCOL_TRC_SMPTE2084 =
  13977. + 16, ///< SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems
  13978. + AVCOL_TRC_SMPTEST2084 = AVCOL_TRC_SMPTE2084,
  13979. + AVCOL_TRC_SMPTE428 = 17, ///< SMPTE ST 428-1
  13980. + AVCOL_TRC_SMPTEST428_1 = AVCOL_TRC_SMPTE428,
  13981. + AVCOL_TRC_ARIB_STD_B67 = 18, ///< ARIB STD-B67, known as "Hybrid log-gamma"
  13982. + AVCOL_TRC_NB ///< Not part of ABI
  13983. +};
  13984. +
  13985. +/**
  13986. + * YUV colorspace type.
  13987. + * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.3.
  13988. + */
  13989. +enum AVColorSpace {
  13990. + AVCOL_SPC_RGB = 0, ///< order of coefficients is actually GBR, also IEC
  13991. + ///< 61966-2-1 (sRGB), YZX and ST 428-1
  13992. + AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 /
  13993. + ///< derived in SMPTE RP 177 Annex B
  13994. + AVCOL_SPC_UNSPECIFIED = 2,
  13995. + AVCOL_SPC_RESERVED =
  13996. + 3, ///< reserved for future use by ITU-T and ISO/IEC just like 15-255 are
  13997. + AVCOL_SPC_FCC =
  13998. + 4, ///< FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
  13999. + AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R
  14000. + ///< BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
  14001. + AVCOL_SPC_SMPTE170M =
  14002. + 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC /
  14003. + ///< functionally identical to above
  14004. + AVCOL_SPC_SMPTE240M =
  14005. + 7, ///< derived from 170M primaries and D65 white point, 170M is derived
  14006. + ///< from BT470 System M's primaries
  14007. + AVCOL_SPC_YCGCO =
  14008. + 8, ///< used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
  14009. + AVCOL_SPC_YCOCG = AVCOL_SPC_YCGCO,
  14010. + AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system
  14011. + AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system
  14012. + AVCOL_SPC_SMPTE2085 = 11, ///< SMPTE 2085, Y'D'zD'x
  14013. + AVCOL_SPC_CHROMA_DERIVED_NCL =
  14014. + 12, ///< Chromaticity-derived non-constant luminance system
  14015. + AVCOL_SPC_CHROMA_DERIVED_CL =
  14016. + 13, ///< Chromaticity-derived constant luminance system
  14017. + AVCOL_SPC_ICTCP = 14, ///< ITU-R BT.2100-0, ICtCp
  14018. + AVCOL_SPC_NB ///< Not part of ABI
  14019. +};
  14020. +
  14021. +/**
  14022. + * Visual content value range.
  14023. + *
  14024. + * These values are based on definitions that can be found in multiple
  14025. + * specifications, such as ITU-T BT.709 (3.4 - Quantization of RGB, luminance
  14026. + * and colour-difference signals), ITU-T BT.2020 (Table 5 - Digital
  14027. + * Representation) as well as ITU-T BT.2100 (Table 9 - Digital 10- and 12-bit
  14028. + * integer representation). At the time of writing, the BT.2100 one is
  14029. + * recommended, as it also defines the full range representation.
  14030. + *
  14031. + * Common definitions:
  14032. + * - For RGB and luma planes such as Y in YCbCr and I in ICtCp,
  14033. + * 'E' is the original value in range of 0.0 to 1.0.
  14034. + * - For chroma planes such as Cb,Cr and Ct,Cp, 'E' is the original
  14035. + * value in range of -0.5 to 0.5.
  14036. + * - 'n' is the output bit depth.
  14037. + * - For additional definitions such as rounding and clipping to valid n
  14038. + * bit unsigned integer range, please refer to BT.2100 (Table 9).
  14039. + */
  14040. +enum AVColorRange {
  14041. + AVCOL_RANGE_UNSPECIFIED = 0,
  14042. +
  14043. + /**
  14044. + * Narrow or limited range content.
  14045. + *
  14046. + * - For luma planes:
  14047. + *
  14048. + * (219 * E + 16) * 2^(n-8)
  14049. + *
  14050. + * F.ex. the range of 16-235 for 8 bits
  14051. + *
  14052. + * - For chroma planes:
  14053. + *
  14054. + * (224 * E + 128) * 2^(n-8)
  14055. + *
  14056. + * F.ex. the range of 16-240 for 8 bits
  14057. + */
  14058. + AVCOL_RANGE_MPEG = 1,
  14059. +
  14060. + /**
  14061. + * Full range content.
  14062. + *
  14063. + * - For RGB and luma planes:
  14064. + *
  14065. + * (2^n - 1) * E
  14066. + *
  14067. + * F.ex. the range of 0-255 for 8 bits
  14068. + *
  14069. + * - For chroma planes:
  14070. + *
  14071. + * (2^n - 1) * E + 2^(n - 1)
  14072. + *
  14073. + * F.ex. the range of 1-255 for 8 bits
  14074. + */
  14075. + AVCOL_RANGE_JPEG = 2,
  14076. + AVCOL_RANGE_NB ///< Not part of ABI
  14077. +};
  14078. +
  14079. +/**
  14080. + * Location of chroma samples.
  14081. + *
  14082. + * Illustration showing the location of the first (top left) chroma sample of
  14083. + *the image, the left shows only luma, the right shows the location of the
  14084. + *chroma sample, the 2 could be imagined to overlay each other but are drawn
  14085. + *separately due to limitations of ASCII
  14086. + *
  14087. + * 1st 2nd 1st 2nd horizontal luma sample positions
  14088. + * v v v v
  14089. + * ______ ______
  14090. + *1st luma line > |X X ... |3 4 X ... X are luma samples,
  14091. + * | |1 2 1-6 are possible chroma positions
  14092. + *2nd luma line > |X X ... |5 6 X ... 0 is undefined/unknown position
  14093. + */
  14094. +enum AVChromaLocation {
  14095. + AVCHROMA_LOC_UNSPECIFIED = 0,
  14096. + AVCHROMA_LOC_LEFT = 1, ///< MPEG-2/4 4:2:0, H.264 default for 4:2:0
  14097. + AVCHROMA_LOC_CENTER = 2, ///< MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0
  14098. + AVCHROMA_LOC_TOPLEFT =
  14099. + 3, ///< ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2
  14100. + AVCHROMA_LOC_TOP = 4,
  14101. + AVCHROMA_LOC_BOTTOMLEFT = 5,
  14102. + AVCHROMA_LOC_BOTTOM = 6,
  14103. + AVCHROMA_LOC_NB ///< Not part of ABI
  14104. +};
  14105. +
  14106. +#endif /* AVUTIL_PIXFMT_H */
  14107. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/rational.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/rational.h
  14108. new file mode 100644
  14109. index 00000000..1ce38d09
  14110. --- /dev/null
  14111. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/rational.h
  14112. @@ -0,0 +1,222 @@
  14113. +/*
  14114. + * rational numbers
  14115. + * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
  14116. + *
  14117. + * This file is part of FFmpeg.
  14118. + *
  14119. + * FFmpeg is free software; you can redistribute it and/or
  14120. + * modify it under the terms of the GNU Lesser General Public
  14121. + * License as published by the Free Software Foundation; either
  14122. + * version 2.1 of the License, or (at your option) any later version.
  14123. + *
  14124. + * FFmpeg is distributed in the hope that it will be useful,
  14125. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14126. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14127. + * Lesser General Public License for more details.
  14128. + *
  14129. + * You should have received a copy of the GNU Lesser General Public
  14130. + * License along with FFmpeg; if not, write to the Free Software
  14131. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  14132. + */
  14133. +
  14134. +/**
  14135. + * @file
  14136. + * @ingroup lavu_math_rational
  14137. + * Utilties for rational number calculation.
  14138. + * @author Michael Niedermayer <michaelni@gmx.at>
  14139. + */
  14140. +
  14141. +#ifndef AVUTIL_RATIONAL_H
  14142. +#define AVUTIL_RATIONAL_H
  14143. +
  14144. +#include <stdint.h>
  14145. +#include <limits.h>
  14146. +#include "attributes.h"
  14147. +
  14148. +/**
  14149. + * @defgroup lavu_math_rational AVRational
  14150. + * @ingroup lavu_math
  14151. + * Rational number calculation.
  14152. + *
  14153. + * While rational numbers can be expressed as floating-point numbers, the
  14154. + * conversion process is a lossy one, so are floating-point operations. On the
  14155. + * other hand, the nature of FFmpeg demands highly accurate calculation of
  14156. + * timestamps. This set of rational number utilities serves as a generic
  14157. + * interface for manipulating rational numbers as pairs of numerators and
  14158. + * denominators.
  14159. + *
  14160. + * Many of the functions that operate on AVRational's have the suffix `_q`, in
  14161. + * reference to the mathematical symbol "ℚ" (Q) which denotes the set of all
  14162. + * rational numbers.
  14163. + *
  14164. + * @{
  14165. + */
  14166. +
  14167. +/**
  14168. + * Rational number (pair of numerator and denominator).
  14169. + */
  14170. +typedef struct AVRational {
  14171. + int num; ///< Numerator
  14172. + int den; ///< Denominator
  14173. +} AVRational;
  14174. +
  14175. +/**
  14176. + * Create an AVRational.
  14177. + *
  14178. + * Useful for compilers that do not support compound literals.
  14179. + *
  14180. + * @note The return value is not reduced.
  14181. + * @see av_reduce()
  14182. + */
  14183. +static inline AVRational av_make_q(int num, int den) {
  14184. + AVRational r = {num, den};
  14185. + return r;
  14186. +}
  14187. +
  14188. +/**
  14189. + * Compare two rationals.
  14190. + *
  14191. + * @param a First rational
  14192. + * @param b Second rational
  14193. + *
  14194. + * @return One of the following values:
  14195. + * - 0 if `a == b`
  14196. + * - 1 if `a > b`
  14197. + * - -1 if `a < b`
  14198. + * - `INT_MIN` if one of the values is of the form `0 / 0`
  14199. + */
  14200. +static inline int av_cmp_q(AVRational a, AVRational b) {
  14201. + const int64_t tmp = a.num * (int64_t)b.den - b.num * (int64_t)a.den;
  14202. +
  14203. + if (tmp)
  14204. + return (int)((tmp ^ a.den ^ b.den) >> 63) | 1;
  14205. + else if (b.den && a.den)
  14206. + return 0;
  14207. + else if (a.num && b.num)
  14208. + return (a.num >> 31) - (b.num >> 31);
  14209. + else
  14210. + return INT_MIN;
  14211. +}
  14212. +
  14213. +/**
  14214. + * Convert an AVRational to a `double`.
  14215. + * @param a AVRational to convert
  14216. + * @return `a` in floating-point form
  14217. + * @see av_d2q()
  14218. + */
  14219. +static inline double av_q2d(AVRational a) { return a.num / (double)a.den; }
  14220. +
  14221. +/**
  14222. + * Reduce a fraction.
  14223. + *
  14224. + * This is useful for framerate calculations.
  14225. + *
  14226. + * @param[out] dst_num Destination numerator
  14227. + * @param[out] dst_den Destination denominator
  14228. + * @param[in] num Source numerator
  14229. + * @param[in] den Source denominator
  14230. + * @param[in] max Maximum allowed values for `dst_num` & `dst_den`
  14231. + * @return 1 if the operation is exact, 0 otherwise
  14232. + */
  14233. +int av_reduce(int* dst_num, int* dst_den, int64_t num, int64_t den,
  14234. + int64_t max);
  14235. +
  14236. +/**
  14237. + * Multiply two rationals.
  14238. + * @param b First rational
  14239. + * @param c Second rational
  14240. + * @return b*c
  14241. + */
  14242. +AVRational av_mul_q(AVRational b, AVRational c) av_const;
  14243. +
  14244. +/**
  14245. + * Divide one rational by another.
  14246. + * @param b First rational
  14247. + * @param c Second rational
  14248. + * @return b/c
  14249. + */
  14250. +AVRational av_div_q(AVRational b, AVRational c) av_const;
  14251. +
  14252. +/**
  14253. + * Add two rationals.
  14254. + * @param b First rational
  14255. + * @param c Second rational
  14256. + * @return b+c
  14257. + */
  14258. +AVRational av_add_q(AVRational b, AVRational c) av_const;
  14259. +
  14260. +/**
  14261. + * Subtract one rational from another.
  14262. + * @param b First rational
  14263. + * @param c Second rational
  14264. + * @return b-c
  14265. + */
  14266. +AVRational av_sub_q(AVRational b, AVRational c) av_const;
  14267. +
  14268. +/**
  14269. + * Invert a rational.
  14270. + * @param q value
  14271. + * @return 1 / q
  14272. + */
  14273. +static av_always_inline AVRational av_inv_q(AVRational q) {
  14274. + AVRational r = {q.den, q.num};
  14275. + return r;
  14276. +}
  14277. +
  14278. +/**
  14279. + * Convert a double precision floating point number to a rational.
  14280. + *
  14281. + * In case of infinity, the returned value is expressed as `{1, 0}` or
  14282. + * `{-1, 0}` depending on the sign.
  14283. + *
  14284. + * @param d `double` to convert
  14285. + * @param max Maximum allowed numerator and denominator
  14286. + * @return `d` in AVRational form
  14287. + * @see av_q2d()
  14288. + */
  14289. +AVRational av_d2q(double d, int max) av_const;
  14290. +
  14291. +/**
  14292. + * Find which of the two rationals is closer to another rational.
  14293. + *
  14294. + * @param q Rational to be compared against
  14295. + * @param q1 Rational to be tested
  14296. + * @param q2 Rational to be tested
  14297. + * @return One of the following values:
  14298. + * - 1 if `q1` is nearer to `q` than `q2`
  14299. + * - -1 if `q2` is nearer to `q` than `q1`
  14300. + * - 0 if they have the same distance
  14301. + */
  14302. +int av_nearer_q(AVRational q, AVRational q1, AVRational q2);
  14303. +
  14304. +/**
  14305. + * Find the value in a list of rationals nearest a given reference rational.
  14306. + *
  14307. + * @param q Reference rational
  14308. + * @param q_list Array of rationals terminated by `{0, 0}`
  14309. + * @return Index of the nearest value found in the array
  14310. + */
  14311. +int av_find_nearest_q_idx(AVRational q, const AVRational* q_list);
  14312. +
  14313. +/**
  14314. + * Convert an AVRational to a IEEE 32-bit `float` expressed in fixed-point
  14315. + * format.
  14316. + *
  14317. + * @param q Rational to be converted
  14318. + * @return Equivalent floating-point value, expressed as an unsigned 32-bit
  14319. + * integer.
  14320. + * @note The returned value is platform-indepedant.
  14321. + */
  14322. +uint32_t av_q2intfloat(AVRational q);
  14323. +
  14324. +/**
  14325. + * Return the best rational so that a and b are multiple of it.
  14326. + * If the resulting denominator is larger than max_den, return def.
  14327. + */
  14328. +AVRational av_gcd_q(AVRational a, AVRational b, int max_den, AVRational def);
  14329. +
  14330. +/**
  14331. + * @}
  14332. + */
  14333. +
  14334. +#endif /* AVUTIL_RATIONAL_H */
  14335. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/samplefmt.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/samplefmt.h
  14336. new file mode 100644
  14337. index 00000000..31cbca76
  14338. --- /dev/null
  14339. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/samplefmt.h
  14340. @@ -0,0 +1,274 @@
  14341. +/*
  14342. + * This file is part of FFmpeg.
  14343. + *
  14344. + * FFmpeg is free software; you can redistribute it and/or
  14345. + * modify it under the terms of the GNU Lesser General Public
  14346. + * License as published by the Free Software Foundation; either
  14347. + * version 2.1 of the License, or (at your option) any later version.
  14348. + *
  14349. + * FFmpeg is distributed in the hope that it will be useful,
  14350. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14351. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14352. + * Lesser General Public License for more details.
  14353. + *
  14354. + * You should have received a copy of the GNU Lesser General Public
  14355. + * License along with FFmpeg; if not, write to the Free Software
  14356. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  14357. + */
  14358. +
  14359. +#ifndef AVUTIL_SAMPLEFMT_H
  14360. +#define AVUTIL_SAMPLEFMT_H
  14361. +
  14362. +#include <stdint.h>
  14363. +
  14364. +/**
  14365. + * @addtogroup lavu_audio
  14366. + * @{
  14367. + *
  14368. + * @defgroup lavu_sampfmts Audio sample formats
  14369. + *
  14370. + * Audio sample format enumeration and related convenience functions.
  14371. + * @{
  14372. + */
  14373. +
  14374. +/**
  14375. + * Audio sample formats
  14376. + *
  14377. + * - The data described by the sample format is always in native-endian order.
  14378. + * Sample values can be expressed by native C types, hence the lack of a
  14379. + * signed 24-bit sample format even though it is a common raw audio data format.
  14380. + *
  14381. + * - The floating-point formats are based on full volume being in the range
  14382. + * [-1.0, 1.0]. Any values outside this range are beyond full volume level.
  14383. + *
  14384. + * - The data layout as used in av_samples_fill_arrays() and elsewhere in FFmpeg
  14385. + * (such as AVFrame in libavcodec) is as follows:
  14386. + *
  14387. + * @par
  14388. + * For planar sample formats, each audio channel is in a separate data plane,
  14389. + * and linesize is the buffer size, in bytes, for a single plane. All data
  14390. + * planes must be the same size. For packed sample formats, only the first data
  14391. + * plane is used, and samples for each channel are interleaved. In this case,
  14392. + * linesize is the buffer size, in bytes, for the 1 plane.
  14393. + *
  14394. + */
  14395. +enum AVSampleFormat {
  14396. + AV_SAMPLE_FMT_NONE = -1,
  14397. + AV_SAMPLE_FMT_U8, ///< unsigned 8 bits
  14398. + AV_SAMPLE_FMT_S16, ///< signed 16 bits
  14399. + AV_SAMPLE_FMT_S32, ///< signed 32 bits
  14400. + AV_SAMPLE_FMT_FLT, ///< float
  14401. + AV_SAMPLE_FMT_DBL, ///< double
  14402. +
  14403. + AV_SAMPLE_FMT_U8P, ///< unsigned 8 bits, planar
  14404. + AV_SAMPLE_FMT_S16P, ///< signed 16 bits, planar
  14405. + AV_SAMPLE_FMT_S32P, ///< signed 32 bits, planar
  14406. + AV_SAMPLE_FMT_FLTP, ///< float, planar
  14407. + AV_SAMPLE_FMT_DBLP, ///< double, planar
  14408. + AV_SAMPLE_FMT_S64, ///< signed 64 bits
  14409. + AV_SAMPLE_FMT_S64P, ///< signed 64 bits, planar
  14410. +
  14411. + AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking
  14412. + ///< dynamically
  14413. +};
  14414. +
  14415. +/**
  14416. + * Return the name of sample_fmt, or NULL if sample_fmt is not
  14417. + * recognized.
  14418. + */
  14419. +const char* av_get_sample_fmt_name(enum AVSampleFormat sample_fmt);
  14420. +
  14421. +/**
  14422. + * Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE
  14423. + * on error.
  14424. + */
  14425. +enum AVSampleFormat av_get_sample_fmt(const char* name);
  14426. +
  14427. +/**
  14428. + * Return the planar<->packed alternative form of the given sample format, or
  14429. + * AV_SAMPLE_FMT_NONE on error. If the passed sample_fmt is already in the
  14430. + * requested planar/packed format, the format returned is the same as the
  14431. + * input.
  14432. + */
  14433. +enum AVSampleFormat av_get_alt_sample_fmt(enum AVSampleFormat sample_fmt,
  14434. + int planar);
  14435. +
  14436. +/**
  14437. + * Get the packed alternative form of the given sample format.
  14438. + *
  14439. + * If the passed sample_fmt is already in packed format, the format returned is
  14440. + * the same as the input.
  14441. + *
  14442. + * @return the packed alternative form of the given sample format or
  14443. + AV_SAMPLE_FMT_NONE on error.
  14444. + */
  14445. +enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt);
  14446. +
  14447. +/**
  14448. + * Get the planar alternative form of the given sample format.
  14449. + *
  14450. + * If the passed sample_fmt is already in planar format, the format returned is
  14451. + * the same as the input.
  14452. + *
  14453. + * @return the planar alternative form of the given sample format or
  14454. + AV_SAMPLE_FMT_NONE on error.
  14455. + */
  14456. +enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt);
  14457. +
  14458. +/**
  14459. + * Generate a string corresponding to the sample format with
  14460. + * sample_fmt, or a header if sample_fmt is negative.
  14461. + *
  14462. + * @param buf the buffer where to write the string
  14463. + * @param buf_size the size of buf
  14464. + * @param sample_fmt the number of the sample format to print the
  14465. + * corresponding info string, or a negative value to print the
  14466. + * corresponding header.
  14467. + * @return the pointer to the filled buffer or NULL if sample_fmt is
  14468. + * unknown or in case of other errors
  14469. + */
  14470. +char* av_get_sample_fmt_string(char* buf, int buf_size,
  14471. + enum AVSampleFormat sample_fmt);
  14472. +
  14473. +/**
  14474. + * Return number of bytes per sample.
  14475. + *
  14476. + * @param sample_fmt the sample format
  14477. + * @return number of bytes per sample or zero if unknown for the given
  14478. + * sample format
  14479. + */
  14480. +int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt);
  14481. +
  14482. +/**
  14483. + * Check if the sample format is planar.
  14484. + *
  14485. + * @param sample_fmt the sample format to inspect
  14486. + * @return 1 if the sample format is planar, 0 if it is interleaved
  14487. + */
  14488. +int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt);
  14489. +
  14490. +/**
  14491. + * Get the required buffer size for the given audio parameters.
  14492. + *
  14493. + * @param[out] linesize calculated linesize, may be NULL
  14494. + * @param nb_channels the number of channels
  14495. + * @param nb_samples the number of samples in a single channel
  14496. + * @param sample_fmt the sample format
  14497. + * @param align buffer size alignment (0 = default, 1 = no alignment)
  14498. + * @return required buffer size, or negative error code on failure
  14499. + */
  14500. +int av_samples_get_buffer_size(int* linesize, int nb_channels, int nb_samples,
  14501. + enum AVSampleFormat sample_fmt, int align);
  14502. +
  14503. +/**
  14504. + * @}
  14505. + *
  14506. + * @defgroup lavu_sampmanip Samples manipulation
  14507. + *
  14508. + * Functions that manipulate audio samples
  14509. + * @{
  14510. + */
  14511. +
  14512. +/**
  14513. + * Fill plane data pointers and linesize for samples with sample
  14514. + * format sample_fmt.
  14515. + *
  14516. + * The audio_data array is filled with the pointers to the samples data planes:
  14517. + * for planar, set the start point of each channel's data within the buffer,
  14518. + * for packed, set the start point of the entire buffer only.
  14519. + *
  14520. + * The value pointed to by linesize is set to the aligned size of each
  14521. + * channel's data buffer for planar layout, or to the aligned size of the
  14522. + * buffer for all channels for packed layout.
  14523. + *
  14524. + * The buffer in buf must be big enough to contain all the samples
  14525. + * (use av_samples_get_buffer_size() to compute its minimum size),
  14526. + * otherwise the audio_data pointers will point to invalid data.
  14527. + *
  14528. + * @see enum AVSampleFormat
  14529. + * The documentation for AVSampleFormat describes the data layout.
  14530. + *
  14531. + * @param[out] audio_data array to be filled with the pointer for each channel
  14532. + * @param[out] linesize calculated linesize, may be NULL
  14533. + * @param buf the pointer to a buffer containing the samples
  14534. + * @param nb_channels the number of channels
  14535. + * @param nb_samples the number of samples in a single channel
  14536. + * @param sample_fmt the sample format
  14537. + * @param align buffer size alignment (0 = default, 1 = no alignment)
  14538. + * @return minimum size in bytes required for the buffer on
  14539. + * success, or a negative error code on failure
  14540. + */
  14541. +int av_samples_fill_arrays(uint8_t** audio_data, int* linesize,
  14542. + const uint8_t* buf, int nb_channels, int nb_samples,
  14543. + enum AVSampleFormat sample_fmt, int align);
  14544. +
  14545. +/**
  14546. + * Allocate a samples buffer for nb_samples samples, and fill data pointers and
  14547. + * linesize accordingly.
  14548. + * The allocated samples buffer can be freed by using av_freep(&audio_data[0])
  14549. + * Allocated data will be initialized to silence.
  14550. + *
  14551. + * @see enum AVSampleFormat
  14552. + * The documentation for AVSampleFormat describes the data layout.
  14553. + *
  14554. + * @param[out] audio_data array to be filled with the pointer for each channel
  14555. + * @param[out] linesize aligned size for audio buffer(s), may be NULL
  14556. + * @param nb_channels number of audio channels
  14557. + * @param nb_samples number of samples per channel
  14558. + * @param sample_fmt the sample format
  14559. + * @param align buffer size alignment (0 = default, 1 = no alignment)
  14560. + * @return >=0 on success or a negative error code on failure
  14561. + * @todo return the size of the allocated buffer in case of success at the next
  14562. + * bump
  14563. + * @see av_samples_fill_arrays()
  14564. + * @see av_samples_alloc_array_and_samples()
  14565. + */
  14566. +int av_samples_alloc(uint8_t** audio_data, int* linesize, int nb_channels,
  14567. + int nb_samples, enum AVSampleFormat sample_fmt, int align);
  14568. +
  14569. +/**
  14570. + * Allocate a data pointers array, samples buffer for nb_samples
  14571. + * samples, and fill data pointers and linesize accordingly.
  14572. + *
  14573. + * This is the same as av_samples_alloc(), but also allocates the data
  14574. + * pointers array.
  14575. + *
  14576. + * @see av_samples_alloc()
  14577. + */
  14578. +int av_samples_alloc_array_and_samples(uint8_t*** audio_data, int* linesize,
  14579. + int nb_channels, int nb_samples,
  14580. + enum AVSampleFormat sample_fmt,
  14581. + int align);
  14582. +
  14583. +/**
  14584. + * Copy samples from src to dst.
  14585. + *
  14586. + * @param dst destination array of pointers to data planes
  14587. + * @param src source array of pointers to data planes
  14588. + * @param dst_offset offset in samples at which the data will be written to dst
  14589. + * @param src_offset offset in samples at which the data will be read from src
  14590. + * @param nb_samples number of samples to be copied
  14591. + * @param nb_channels number of audio channels
  14592. + * @param sample_fmt audio sample format
  14593. + */
  14594. +int av_samples_copy(uint8_t** dst, uint8_t* const* src, int dst_offset,
  14595. + int src_offset, int nb_samples, int nb_channels,
  14596. + enum AVSampleFormat sample_fmt);
  14597. +
  14598. +/**
  14599. + * Fill an audio buffer with silence.
  14600. + *
  14601. + * @param audio_data array of pointers to data planes
  14602. + * @param offset offset in samples at which to start filling
  14603. + * @param nb_samples number of samples to fill
  14604. + * @param nb_channels number of audio channels
  14605. + * @param sample_fmt audio sample format
  14606. + */
  14607. +int av_samples_set_silence(uint8_t** audio_data, int offset, int nb_samples,
  14608. + int nb_channels, enum AVSampleFormat sample_fmt);
  14609. +
  14610. +/**
  14611. + * @}
  14612. + * @}
  14613. + */
  14614. +#endif /* AVUTIL_SAMPLEFMT_H */
  14615. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/version.h b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/version.h
  14616. new file mode 100644
  14617. index 00000000..ae72840c
  14618. --- /dev/null
  14619. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/include/libavutil/version.h
  14620. @@ -0,0 +1,122 @@
  14621. +/*
  14622. + * copyright (c) 2003 Fabrice Bellard
  14623. + *
  14624. + * This file is part of FFmpeg.
  14625. + *
  14626. + * FFmpeg is free software; you can redistribute it and/or
  14627. + * modify it under the terms of the GNU Lesser General Public
  14628. + * License as published by the Free Software Foundation; either
  14629. + * version 2.1 of the License, or (at your option) any later version.
  14630. + *
  14631. + * FFmpeg is distributed in the hope that it will be useful,
  14632. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14633. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14634. + * Lesser General Public License for more details.
  14635. + *
  14636. + * You should have received a copy of the GNU Lesser General Public
  14637. + * License along with FFmpeg; if not, write to the Free Software
  14638. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  14639. + */
  14640. +
  14641. +/**
  14642. + * @file
  14643. + * @ingroup lavu
  14644. + * Libavutil version macros
  14645. + */
  14646. +
  14647. +#ifndef AVUTIL_VERSION_H
  14648. +#define AVUTIL_VERSION_H
  14649. +
  14650. +#include "macros.h"
  14651. +
  14652. +/**
  14653. + * @addtogroup version_utils
  14654. + *
  14655. + * Useful to check and match library version in order to maintain
  14656. + * backward compatibility.
  14657. + *
  14658. + * The FFmpeg libraries follow a versioning sheme very similar to
  14659. + * Semantic Versioning (http://semver.org/)
  14660. + * The difference is that the component called PATCH is called MICRO in FFmpeg
  14661. + * and its value is reset to 100 instead of 0 to keep it above or equal to 100.
  14662. + * Also we do not increase MICRO for every bugfix or change in git master.
  14663. + *
  14664. + * Prior to FFmpeg 3.2 point releases did not change any lib version number to
  14665. + * avoid aliassing different git master checkouts.
  14666. + * Starting with FFmpeg 3.2, the released library versions will occupy
  14667. + * a separate MAJOR.MINOR that is not used on the master development branch.
  14668. + * That is if we branch a release of master 55.10.123 we will bump to 55.11.100
  14669. + * for the release and master will continue at 55.12.100 after it. Each new
  14670. + * point release will then bump the MICRO improving the usefulness of the lib
  14671. + * versions.
  14672. + *
  14673. + * @{
  14674. + */
  14675. +
  14676. +#define AV_VERSION_INT(a, b, c) ((a) << 16 | (b) << 8 | (c))
  14677. +#define AV_VERSION_DOT(a, b, c) a##.##b##.##c
  14678. +#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
  14679. +
  14680. +/**
  14681. + * Extract version components from the full ::AV_VERSION_INT int as returned
  14682. + * by functions like ::avformat_version() and ::avcodec_version()
  14683. + */
  14684. +#define AV_VERSION_MAJOR(a) ((a) >> 16)
  14685. +#define AV_VERSION_MINOR(a) (((a)&0x00FF00) >> 8)
  14686. +#define AV_VERSION_MICRO(a) ((a)&0xFF)
  14687. +
  14688. +/**
  14689. + * @}
  14690. + */
  14691. +
  14692. +/**
  14693. + * @defgroup lavu_ver Version and Build diagnostics
  14694. + *
  14695. + * Macros and function useful to check at compiletime and at runtime
  14696. + * which version of libavutil is in use.
  14697. + *
  14698. + * @{
  14699. + */
  14700. +
  14701. +#define LIBAVUTIL_VERSION_MAJOR 58
  14702. +#define LIBAVUTIL_VERSION_MINOR 3
  14703. +#define LIBAVUTIL_VERSION_MICRO 100
  14704. +
  14705. +#define LIBAVUTIL_VERSION_INT \
  14706. + AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, LIBAVUTIL_VERSION_MINOR, \
  14707. + LIBAVUTIL_VERSION_MICRO)
  14708. +#define LIBAVUTIL_VERSION \
  14709. + AV_VERSION(LIBAVUTIL_VERSION_MAJOR, LIBAVUTIL_VERSION_MINOR, \
  14710. + LIBAVUTIL_VERSION_MICRO)
  14711. +#define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT
  14712. +
  14713. +#define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION)
  14714. +
  14715. +/**
  14716. + * @defgroup lavu_depr_guards Deprecation Guards
  14717. + * FF_API_* defines may be placed below to indicate public API that will be
  14718. + * dropped at a future version bump. The defines themselves are not part of
  14719. + * the public API and may change, break or disappear at any time.
  14720. + *
  14721. + * @note, when bumping the major version it is recommended to manually
  14722. + * disable each FF_API_* in its own commit instead of disabling them all
  14723. + * at once through the bump. This improves the git bisect-ability of the change.
  14724. + *
  14725. + * @{
  14726. + */
  14727. +
  14728. +#define FF_API_FIFO_PEEK2 (LIBAVUTIL_VERSION_MAJOR < 59)
  14729. +#define FF_API_FIFO_OLD_API (LIBAVUTIL_VERSION_MAJOR < 59)
  14730. +#define FF_API_XVMC (LIBAVUTIL_VERSION_MAJOR < 59)
  14731. +#define FF_API_OLD_CHANNEL_LAYOUT (LIBAVUTIL_VERSION_MAJOR < 59)
  14732. +#define FF_API_AV_FOPEN_UTF8 (LIBAVUTIL_VERSION_MAJOR < 59)
  14733. +#define FF_API_PKT_DURATION (LIBAVUTIL_VERSION_MAJOR < 59)
  14734. +#define FF_API_REORDERED_OPAQUE (LIBAVUTIL_VERSION_MAJOR < 59)
  14735. +#define FF_API_FRAME_PICTURE_NUMBER (LIBAVUTIL_VERSION_MAJOR < 59)
  14736. +
  14737. +/**
  14738. + * @}
  14739. + * @}
  14740. + */
  14741. +
  14742. +#endif /* AVUTIL_VERSION_H */
  14743. diff --git a/dom/media/platforms/ffmpeg/ffmpeg60/moz.build b/dom/media/platforms/ffmpeg/ffmpeg60/moz.build
  14744. new file mode 100644
  14745. index 00000000..1da28a15
  14746. --- /dev/null
  14747. +++ b/dom/media/platforms/ffmpeg/ffmpeg60/moz.build
  14748. @@ -0,0 +1,39 @@
  14749. +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
  14750. +# vim: set filetype=python:
  14751. +# This Source Code Form is subject to the terms of the Mozilla Public
  14752. +# License, v. 2.0. If a copy of the MPL was not distributed with this
  14753. +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
  14754. +
  14755. +UNIFIED_SOURCES += [
  14756. + "../FFmpegAudioDecoder.cpp",
  14757. + "../FFmpegDataDecoder.cpp",
  14758. + "../FFmpegDecoderModule.cpp",
  14759. + "../FFmpegVideoDecoder.cpp",
  14760. +]
  14761. +LOCAL_INCLUDES += [
  14762. + "..",
  14763. + "/media/mozva",
  14764. + "include",
  14765. +]
  14766. +
  14767. +if CONFIG["CC_TYPE"] in ("clang", "gcc"):
  14768. + CXXFLAGS += ["-Wno-deprecated-declarations"]
  14769. +if CONFIG["CC_TYPE"] == "clang":
  14770. + CXXFLAGS += [
  14771. + "-Wno-unknown-attributes",
  14772. + ]
  14773. +if CONFIG["CC_TYPE"] == "gcc":
  14774. + CXXFLAGS += [
  14775. + "-Wno-attributes",
  14776. + ]
  14777. +if CONFIG["MOZ_WAYLAND"]:
  14778. + CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
  14779. + DEFINES["MOZ_WAYLAND_USE_VAAPI"] = 1
  14780. + USE_LIBS += ["mozva"]
  14781. + UNIFIED_SOURCES += [
  14782. + "../FFmpegVideoFramePool.cpp",
  14783. + ]
  14784. +
  14785. +include("/ipc/chromium/chromium-config.mozbuild")
  14786. +
  14787. +FINAL_LIBRARY = "xul"
  14788. diff --git a/dom/media/platforms/ffmpeg/moz.build b/dom/media/platforms/ffmpeg/moz.build
  14789. index aa3b505d..f87dd006 100644
  14790. --- a/dom/media/platforms/ffmpeg/moz.build
  14791. +++ b/dom/media/platforms/ffmpeg/moz.build
  14792. @@ -15,6 +15,7 @@ DIRS += [
  14793. "ffmpeg57",
  14794. "ffmpeg58",
  14795. "ffmpeg59",
  14796. + "ffmpeg60",
  14797. ]
  14798. UNIFIED_SOURCES += [
  14799. diff --git a/media/ffvpx/README_MOZILLA b/media/ffvpx/README_MOZILLA
  14800. index b90d6020..fdd0bc35 100644
  14801. --- a/media/ffvpx/README_MOZILLA
  14802. +++ b/media/ffvpx/README_MOZILLA
  14803. @@ -32,6 +32,14 @@ Then, make sure the files:
  14804. include conditional compilation directives, by probably reverting them (or
  14805. reverting and adjusting them if new codecs are added).
  14806. +## Add headers for a new major ffmpeg version
  14807. +
  14808. +If a new major version of ffmpeg is being imported in the tree, it's necessary
  14809. +to vendor the new ffmpeg headers in `dom/media/platforms/ffmpeg/ffmpegxx` where
  14810. +xx is the new ffmpeg major version number, and to modify the dynamic linker
  14811. +wrapper in
  14812. +`dom/media/platforms/dom/media/platforms/ffmpeg/{FFmpegLibWrapper.cpp,FFmpegRungtimeLinker.cpp}` with the new version and the new API in this new version.
  14813. +
  14814. ## `config.h` generation
  14815. Configuration files are generated as follow using the configure script (here
  14816. diff --git a/media/ffvpx/changes.patch b/media/ffvpx/changes.patch
  14817. index da7561f2..af2aa208 100644
  14818. --- a/media/ffvpx/changes.patch
  14819. +++ b/media/ffvpx/changes.patch
  14820. @@ -46,29 +46,6 @@ index 9fb8d0a..97ad3b9 100644
  14821. rgba_color[0] = rgba >> 24;
  14822. rgba_color[1] = rgba >> 16;
  14823. rgba_color[2] = rgba >> 8;
  14824. -diff --git a/media/ffvpx/libavutil/hwcontext_vaapi.c b/media/ffvpx/libavutil/hwcontext_vaapi.c
  14825. ---- a/media/ffvpx/libavutil/hwcontext_vaapi.c
  14826. -+++ b/media/ffvpx/libavutil/hwcontext_vaapi.c
  14827. -@@ -39,17 +39,19 @@
  14828. - # include <unistd.h>
  14829. - #endif
  14830. -
  14831. -
  14832. - #include "avassert.h"
  14833. - #include "buffer.h"
  14834. - #include "common.h"
  14835. - #include "hwcontext.h"
  14836. -+#if CONFIG_LIBDRM
  14837. - #include "hwcontext_drm.h"
  14838. -+#endif
  14839. - #include "hwcontext_internal.h"
  14840. - #include "hwcontext_vaapi.h"
  14841. - #include "mem.h"
  14842. - #include "pixdesc.h"
  14843. - #include "pixfmt.h"
  14844. -
  14845. -
  14846. - typedef struct VAAPIDevicePriv {
  14847. diff -up media/ffvpx/libavutil/fftime.h media/ffvpx/libavutil/fftime.h
  14848. --- media/ffvpx/libavutil/fftime.h 2021-12-06 14:51:40.378642713 +0100
  14849. +++ media/ffvpx/libavutil/fftime.h 2021-12-06 14:51:54.618098212 +0100
  14850. diff --git a/media/ffvpx/libavcodec/allcodecs.c b/media/ffvpx/libavcodec/allcodecs.c
  14851. index 4f1d66cb..e593ad19 100644
  14852. --- a/media/ffvpx/libavcodec/allcodecs.c
  14853. +++ b/media/ffvpx/libavcodec/allcodecs.c
  14854. @@ -154,6 +154,7 @@ extern const FFCodec ff_h264_decoder;
  14855. extern const FFCodec ff_h264_crystalhd_decoder;
  14856. extern const FFCodec ff_h264_v4l2m2m_decoder;
  14857. extern const FFCodec ff_h264_mediacodec_decoder;
  14858. +extern const FFCodec ff_h264_mediacodec_encoder;
  14859. extern const FFCodec ff_h264_mmal_decoder;
  14860. extern const FFCodec ff_h264_qsv_decoder;
  14861. extern const FFCodec ff_h264_rkmpp_decoder;
  14862. @@ -286,6 +287,7 @@ extern const FFCodec ff_r210_decoder;
  14863. extern const FFCodec ff_rasc_decoder;
  14864. extern const FFCodec ff_rawvideo_encoder;
  14865. extern const FFCodec ff_rawvideo_decoder;
  14866. +extern const FFCodec ff_rka_decoder;
  14867. extern const FFCodec ff_rl2_decoder;
  14868. extern const FFCodec ff_roq_encoder;
  14869. extern const FFCodec ff_roq_decoder;
  14870. @@ -537,6 +539,7 @@ extern const FFCodec ff_twinvq_decoder;
  14871. extern const FFCodec ff_vmdaudio_decoder;
  14872. extern const FFCodec ff_vorbis_encoder;
  14873. extern const FFCodec ff_vorbis_decoder;
  14874. +extern const FFCodec ff_wavarc_decoder;
  14875. extern const FFCodec ff_wavpack_encoder;
  14876. extern const FFCodec ff_wavpack_decoder;
  14877. extern const FFCodec ff_wmalossless_decoder;
  14878. @@ -619,6 +622,7 @@ extern const FFCodec ff_pcm_vidc_encoder;
  14879. extern const FFCodec ff_pcm_vidc_decoder;
  14880. /* DPCM codecs */
  14881. +extern const FFCodec ff_cbd2_dpcm_decoder;
  14882. extern const FFCodec ff_derf_dpcm_decoder;
  14883. extern const FFCodec ff_gremlin_dpcm_decoder;
  14884. extern const FFCodec ff_interplay_dpcm_decoder;
  14885. @@ -627,6 +631,7 @@ extern const FFCodec ff_roq_dpcm_decoder;
  14886. extern const FFCodec ff_sdx2_dpcm_decoder;
  14887. extern const FFCodec ff_sol_dpcm_decoder;
  14888. extern const FFCodec ff_xan_dpcm_decoder;
  14889. +extern const FFCodec ff_wady_dpcm_decoder;
  14890. /* ADPCM codecs */
  14891. extern const FFCodec ff_adpcm_4xm_decoder;
  14892. @@ -692,6 +697,7 @@ extern const FFCodec ff_adpcm_thp_decoder;
  14893. extern const FFCodec ff_adpcm_thp_le_decoder;
  14894. extern const FFCodec ff_adpcm_vima_decoder;
  14895. extern const FFCodec ff_adpcm_xa_decoder;
  14896. +extern const FFCodec ff_adpcm_xmd_decoder;
  14897. extern const FFCodec ff_adpcm_yamaha_encoder;
  14898. extern const FFCodec ff_adpcm_yamaha_decoder;
  14899. extern const FFCodec ff_adpcm_zork_decoder;
  14900. @@ -827,8 +833,11 @@ extern const FFCodec ff_libaom_av1_decoder;
  14901. /* hwaccel hooks only, so prefer external decoders */
  14902. extern const FFCodec ff_av1_decoder;
  14903. extern const FFCodec ff_av1_cuvid_decoder;
  14904. +extern const FFCodec ff_av1_mediacodec_decoder;
  14905. +extern const FFCodec ff_av1_nvenc_encoder;
  14906. extern const FFCodec ff_av1_qsv_decoder;
  14907. extern const FFCodec ff_av1_qsv_encoder;
  14908. +extern const FFCodec ff_av1_amf_encoder;
  14909. extern const FFCodec ff_libopenh264_encoder;
  14910. extern const FFCodec ff_libopenh264_decoder;
  14911. extern const FFCodec ff_h264_amf_encoder;
  14912. @@ -843,6 +852,7 @@ extern const FFCodec ff_h264_videotoolbox_encoder;
  14913. extern const FFCodec ff_hevc_amf_encoder;
  14914. extern const FFCodec ff_hevc_cuvid_decoder;
  14915. extern const FFCodec ff_hevc_mediacodec_decoder;
  14916. +extern const FFCodec ff_hevc_mediacodec_encoder;
  14917. extern const FFCodec ff_hevc_mf_encoder;
  14918. extern const FFCodec ff_hevc_nvenc_encoder;
  14919. extern const FFCodec ff_hevc_qsv_encoder;
  14920. @@ -876,6 +886,12 @@ extern const FFCodec ff_vp9_qsv_decoder;
  14921. extern const FFCodec ff_vp9_vaapi_encoder;
  14922. extern const FFCodec ff_vp9_qsv_encoder;
  14923. +// null codecs
  14924. +extern const FFCodec ff_vnull_decoder;
  14925. +extern const FFCodec ff_vnull_encoder;
  14926. +extern const FFCodec ff_anull_decoder;
  14927. +extern const FFCodec ff_anull_encoder;
  14928. +
  14929. // The iterate API is not usable with ossfuzz due to the excessive size of binaries created
  14930. #if CONFIG_OSSFUZZ
  14931. const FFCodec * codec_list[] = {
  14932. diff --git a/media/ffvpx/libavcodec/av1_parser.c b/media/ffvpx/libavcodec/av1_parser.c
  14933. index 4cbd7408..14dae92f 100644
  14934. --- a/media/ffvpx/libavcodec/av1_parser.c
  14935. +++ b/media/ffvpx/libavcodec/av1_parser.c
  14936. @@ -162,8 +162,11 @@ static int av1_parser_parse(AVCodecParserContext *ctx,
  14937. avctx->color_trc = (enum AVColorTransferCharacteristic) color->transfer_characteristics;
  14938. avctx->color_range = color->color_range ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
  14939. - if (avctx->framerate.num)
  14940. - avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1}));
  14941. + if (seq->timing_info_present_flag) {
  14942. + const AV1RawTimingInfo *timing = &seq->timing_info;
  14943. + av_reduce(&avctx->framerate.den, &avctx->framerate.num,
  14944. + timing->num_units_in_display_tick, timing->time_scale, INT_MAX);
  14945. + }
  14946. end:
  14947. ff_cbs_fragment_reset(td);
  14948. diff --git a/media/ffvpx/libavcodec/av1dec.c b/media/ffvpx/libavcodec/av1dec.c
  14949. index 0c24eac8..d83c902f 100644
  14950. --- a/media/ffvpx/libavcodec/av1dec.c
  14951. +++ b/media/ffvpx/libavcodec/av1dec.c
  14952. @@ -194,7 +194,7 @@ static uint8_t get_shear_params_valid(AV1DecContext *s, int idx)
  14953. }
  14954. /**
  14955. -* update gm type/params, since cbs already implemented part of this funcation,
  14956. +* update gm type/params, since cbs already implemented part of this function,
  14957. * so we don't need to full implement spec.
  14958. */
  14959. static void global_motion_params(AV1DecContext *s)
  14960. @@ -567,7 +567,7 @@ static int get_pixel_format(AVCodecContext *avctx)
  14961. * implemented in the future, need remove this check.
  14962. */
  14963. if (!avctx->hwaccel) {
  14964. - av_log(avctx, AV_LOG_ERROR, "Your platform doesn't suppport"
  14965. + av_log(avctx, AV_LOG_ERROR, "Your platform doesn't support"
  14966. " hardware accelerated AV1 decoding.\n");
  14967. return AVERROR(ENOSYS);
  14968. }
  14969. diff --git a/media/ffvpx/libavcodec/avcodec.c b/media/ffvpx/libavcodec/avcodec.c
  14970. index a85d3c23..fb136229 100644
  14971. --- a/media/ffvpx/libavcodec/avcodec.c
  14972. +++ b/media/ffvpx/libavcodec/avcodec.c
  14973. @@ -266,7 +266,12 @@ FF_ENABLE_DEPRECATION_WARNINGS
  14974. goto free_and_end;
  14975. }
  14976. - avctx->frame_number = 0;
  14977. + avctx->frame_num = 0;
  14978. +#if FF_API_AVCTX_FRAME_NUMBER
  14979. +FF_DISABLE_DEPRECATION_WARNINGS
  14980. + avctx->frame_number = avctx->frame_num;
  14981. +FF_ENABLE_DEPRECATION_WARNINGS
  14982. +#endif
  14983. avctx->codec_descriptor = avcodec_descriptor_get(avctx->codec_id);
  14984. if ((avctx->codec->capabilities & AV_CODEC_CAP_EXPERIMENTAL) &&
  14985. @@ -349,11 +354,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
  14986. ret = AVERROR(EINVAL);
  14987. goto free_and_end;
  14988. }
  14989. -
  14990. -#if FF_API_AVCTX_TIMEBASE
  14991. - if (avctx->framerate.num > 0 && avctx->framerate.den > 0)
  14992. - avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1}));
  14993. -#endif
  14994. }
  14995. if (codec->priv_class)
  14996. av_assert0(*(const AVClass **)avctx->priv_data == codec->priv_class);
  14997. @@ -386,9 +386,6 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
  14998. av_frame_unref(avci->recon_frame);
  14999. } else {
  15000. av_packet_unref(avci->last_pkt_props);
  15001. - while (av_fifo_read(avci->pkt_props, avci->last_pkt_props, 1) >= 0)
  15002. - av_packet_unref(avci->last_pkt_props);
  15003. -
  15004. av_packet_unref(avci->in_pkt);
  15005. avctx->pts_correction_last_pts =
  15006. @@ -453,13 +450,6 @@ av_cold int avcodec_close(AVCodecContext *avctx)
  15007. av_freep(&avci->byte_buffer);
  15008. av_frame_free(&avci->buffer_frame);
  15009. av_packet_free(&avci->buffer_pkt);
  15010. - if (avci->pkt_props) {
  15011. - while (av_fifo_can_read(avci->pkt_props)) {
  15012. - av_packet_unref(avci->last_pkt_props);
  15013. - av_fifo_read(avci->pkt_props, avci->last_pkt_props, 1);
  15014. - }
  15015. - av_fifo_freep2(&avci->pkt_props);
  15016. - }
  15017. av_packet_free(&avci->last_pkt_props);
  15018. av_packet_free(&avci->in_pkt);
  15019. diff --git a/media/ffvpx/libavcodec/avcodec.h b/media/ffvpx/libavcodec/avcodec.h
  15020. index 3edd8e26..9a0fe97c 100644
  15021. --- a/media/ffvpx/libavcodec/avcodec.h
  15022. +++ b/media/ffvpx/libavcodec/avcodec.h
  15023. @@ -232,15 +232,57 @@ typedef struct RcOverride{
  15024. */
  15025. #define AV_CODEC_FLAG_DROPCHANGED (1 << 5)
  15026. /**
  15027. - * Request the encoder to output reconstructed frames, i.e. frames that would be
  15028. - * produced by decoding the encoded bistream. These frames may be retrieved by
  15029. - * calling avcodec_receive_frame() immediately after a successful call to
  15030. + * Request the encoder to output reconstructed frames, i.e.\ frames that would
  15031. + * be produced by decoding the encoded bistream. These frames may be retrieved
  15032. + * by calling avcodec_receive_frame() immediately after a successful call to
  15033. * avcodec_receive_packet().
  15034. *
  15035. * Should only be used with encoders flagged with the
  15036. - * AV_CODEC_CAP_ENCODER_RECON_FRAME capability.
  15037. + * @ref AV_CODEC_CAP_ENCODER_RECON_FRAME capability.
  15038. */
  15039. #define AV_CODEC_FLAG_RECON_FRAME (1 << 6)
  15040. +/**
  15041. + * @par decoding
  15042. + * Request the decoder to propagate each packets AVPacket.opaque and
  15043. + * AVPacket.opaque_ref to its corresponding output AVFrame.
  15044. + *
  15045. + * @par encoding:
  15046. + * Request the encoder to propagate each frame's AVFrame.opaque and
  15047. + * AVFrame.opaque_ref values to its corresponding output AVPacket.
  15048. + *
  15049. + * @par
  15050. + * May only be set on encoders that have the
  15051. + * @ref AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE capability flag.
  15052. + *
  15053. + * @note
  15054. + * While in typical cases one input frame produces exactly one output packet
  15055. + * (perhaps after a delay), in general the mapping of frames to packets is
  15056. + * M-to-N, so
  15057. + * - Any number of input frames may be associated with any given output packet.
  15058. + * This includes zero - e.g. some encoders may output packets that carry only
  15059. + * metadata about the whole stream.
  15060. + * - A given input frame may be associated with any number of output packets.
  15061. + * Again this includes zero - e.g. some encoders may drop frames under certain
  15062. + * conditions.
  15063. + * .
  15064. + * This implies that when using this flag, the caller must NOT assume that
  15065. + * - a given input frame's opaques will necessarily appear on some output packet;
  15066. + * - every output packet will have some non-NULL opaque value.
  15067. + * .
  15068. + * When an output packet contains multiple frames, the opaque values will be
  15069. + * taken from the first of those.
  15070. + *
  15071. + * @note
  15072. + * The converse holds for decoders, with frames and packets switched.
  15073. + */
  15074. +#define AV_CODEC_FLAG_COPY_OPAQUE (1 << 7)
  15075. +/**
  15076. + * Signal to the encoder that the values of AVFrame.duration are valid and
  15077. + * should be used (typically for transferring them to output packets).
  15078. + *
  15079. + * If this flag is not set, frame durations are ignored.
  15080. + */
  15081. +#define AV_CODEC_FLAG_FRAME_DURATION (1 << 8)
  15082. /**
  15083. * Use internal 2pass ratecontrol in first pass mode.
  15084. */
  15085. @@ -261,15 +303,6 @@ typedef struct RcOverride{
  15086. * error[?] variables will be set during encoding.
  15087. */
  15088. #define AV_CODEC_FLAG_PSNR (1 << 15)
  15089. -#if FF_API_FLAG_TRUNCATED
  15090. -/**
  15091. - * Input bitstream might be truncated at a random location
  15092. - * instead of only at frame boundaries.
  15093. - *
  15094. - * @deprecated use codec parsers for packetizing input
  15095. - */
  15096. -#define AV_CODEC_FLAG_TRUNCATED (1 << 16)
  15097. -#endif
  15098. /**
  15099. * Use interlaced DCT.
  15100. */
  15101. @@ -310,11 +343,6 @@ typedef struct RcOverride{
  15102. */
  15103. #define AV_CODEC_FLAG2_LOCAL_HEADER (1 << 3)
  15104. -/**
  15105. - * timecode is in drop frame format. DEPRECATED!!!!
  15106. - */
  15107. -#define AV_CODEC_FLAG2_DROP_FRAME_TIMECODE (1 << 13)
  15108. -
  15109. /**
  15110. * Input bitstream might be truncated at a packet boundaries
  15111. * instead of only at frame boundaries.
  15112. @@ -515,8 +543,7 @@ typedef struct AVCodecContext {
  15113. * (fixed_vop_rate == 0 implies that it is different from the framerate)
  15114. *
  15115. * - encoding: MUST be set by user.
  15116. - * - decoding: the use of this field for decoding is deprecated.
  15117. - * Use framerate instead.
  15118. + * - decoding: unused.
  15119. */
  15120. AVRational time_base;
  15121. @@ -1034,6 +1061,7 @@ typedef struct AVCodecContext {
  15122. */
  15123. int frame_size;
  15124. +#if FF_API_AVCTX_FRAME_NUMBER
  15125. /**
  15126. * Frame counter, set by libavcodec.
  15127. *
  15128. @@ -1042,8 +1070,11 @@ typedef struct AVCodecContext {
  15129. *
  15130. * @note the counter is not incremented if encoding/decoding resulted in
  15131. * an error.
  15132. + * @deprecated use frame_num instead
  15133. */
  15134. + attribute_deprecated
  15135. int frame_number;
  15136. +#endif
  15137. /**
  15138. * number of bytes per packet if constant and known or 0
  15139. @@ -1350,6 +1381,7 @@ typedef struct AVCodecContext {
  15140. */
  15141. int err_recognition;
  15142. +#if FF_API_REORDERED_OPAQUE
  15143. /**
  15144. * opaque 64-bit number (generally a PTS) that will be reordered and
  15145. * output in AVFrame.reordered_opaque
  15146. @@ -1358,8 +1390,12 @@ typedef struct AVCodecContext {
  15147. * supported by encoders with the
  15148. * AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE capability.
  15149. * - decoding: Set by user.
  15150. + *
  15151. + * @deprecated Use AV_CODEC_FLAG_COPY_OPAQUE instead
  15152. */
  15153. + attribute_deprecated
  15154. int64_t reordered_opaque;
  15155. +#endif
  15156. /**
  15157. * Hardware accelerator in use
  15158. @@ -1484,27 +1520,6 @@ typedef struct AVCodecContext {
  15159. */
  15160. int active_thread_type;
  15161. -#if FF_API_THREAD_SAFE_CALLBACKS
  15162. - /**
  15163. - * Set by the client if its custom get_buffer() callback can be called
  15164. - * synchronously from another thread, which allows faster multithreaded decoding.
  15165. - * draw_horiz_band() will be called from other threads regardless of this setting.
  15166. - * Ignored if the default get_buffer() is used.
  15167. - * - encoding: Set by user.
  15168. - * - decoding: Set by user.
  15169. - *
  15170. - * @deprecated the custom get_buffer2() callback should always be
  15171. - * thread-safe. Thread-unsafe get_buffer2() implementations will be
  15172. - * invalid starting with LIBAVCODEC_VERSION_MAJOR=60; in other words,
  15173. - * libavcodec will behave as if this field was always set to 1.
  15174. - * Callers that want to be forward compatible with future libavcodec
  15175. - * versions should wrap access to this field in
  15176. - * `#if LIBAVCODEC_VERSION_MAJOR < 60`
  15177. - */
  15178. - attribute_deprecated
  15179. - int thread_safe_callbacks;
  15180. -#endif
  15181. -
  15182. /**
  15183. * The codec may call this to execute several independent things.
  15184. * It will return only after finishing all tasks.
  15185. @@ -1639,6 +1654,7 @@ typedef struct AVCodecContext {
  15186. #define FF_PROFILE_HEVC_MAIN_10 2
  15187. #define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3
  15188. #define FF_PROFILE_HEVC_REXT 4
  15189. +#define FF_PROFILE_HEVC_SCC 9
  15190. #define FF_PROFILE_VVC_MAIN_10 1
  15191. #define FF_PROFILE_VVC_MAIN_10_444 33
  15192. @@ -1805,17 +1821,6 @@ typedef struct AVCodecContext {
  15193. */
  15194. int seek_preroll;
  15195. -#if FF_API_DEBUG_MV
  15196. - /**
  15197. - * @deprecated unused
  15198. - */
  15199. - attribute_deprecated
  15200. - int debug_mv;
  15201. -#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames
  15202. -#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames
  15203. -#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
  15204. -#endif
  15205. -
  15206. /**
  15207. * custom intra quantization matrix
  15208. * - encoding: Set by user, can be NULL.
  15209. @@ -1882,15 +1887,6 @@ typedef struct AVCodecContext {
  15210. */
  15211. AVBufferRef *hw_frames_ctx;
  15212. -#if FF_API_SUB_TEXT_FORMAT
  15213. - /**
  15214. - * @deprecated unused
  15215. - */
  15216. - attribute_deprecated
  15217. - int sub_text_format;
  15218. -#define FF_SUB_TEXT_FMT_ASS 0
  15219. -#endif
  15220. -
  15221. /**
  15222. * Audio only. The amount of padding (in samples) appended by the encoder to
  15223. * the end of the audio. I.e. this number of decoded samples must be
  15224. @@ -2057,6 +2053,17 @@ typedef struct AVCodecContext {
  15225. * The decoder can then override during decoding as needed.
  15226. */
  15227. AVChannelLayout ch_layout;
  15228. +
  15229. + /**
  15230. + * Frame counter, set by libavcodec.
  15231. + *
  15232. + * - decoding: total number of frames returned from the decoder so far.
  15233. + * - encoding: total number of frames passed to the encoder so far.
  15234. + *
  15235. + * @note the counter is not incremented if encoding/decoding resulted in
  15236. + * an error.
  15237. + */
  15238. + int64_t frame_num;
  15239. } AVCodecContext;
  15240. /**
  15241. @@ -2253,6 +2260,22 @@ typedef struct AVHWAccel {
  15242. */
  15243. #define AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH (1 << 2)
  15244. +/**
  15245. + * Some hardware decoders (namely nvdec) can either output direct decoder
  15246. + * surfaces, or make an on-device copy and return said copy.
  15247. + * There is a hard limit on how many decoder surfaces there can be, and it
  15248. + * cannot be accurately guessed ahead of time.
  15249. + * For some processing chains, this can be okay, but others will run into the
  15250. + * limit and in turn produce very confusing errors that require fine tuning of
  15251. + * more or less obscure options by the user, or in extreme cases cannot be
  15252. + * resolved at all without inserting an avfilter that forces a copy.
  15253. + *
  15254. + * Thus, the hwaccel will by default make a copy for safety and resilience.
  15255. + * If a users really wants to minimize the amount of copies, they can set this
  15256. + * flag and ensure their processing chain does not exhaust the surface pool.
  15257. + */
  15258. +#define AV_HWACCEL_FLAG_UNSAFE_OUTPUT (1 << 3)
  15259. +
  15260. /**
  15261. * @}
  15262. */
  15263. @@ -2358,14 +2381,6 @@ void avcodec_free_context(AVCodecContext **avctx);
  15264. */
  15265. const AVClass *avcodec_get_class(void);
  15266. -#if FF_API_GET_FRAME_CLASS
  15267. -/**
  15268. - * @deprecated This function should not be used.
  15269. - */
  15270. -attribute_deprecated
  15271. -const AVClass *avcodec_get_frame_class(void);
  15272. -#endif
  15273. -
  15274. /**
  15275. * Get the AVClass for AVSubtitleRect. It can be used in combination with
  15276. * AV_OPT_SEARCH_FAKE_OBJ for examining options.
  15277. @@ -2552,8 +2567,7 @@ enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos);
  15278. * @param[in] avpkt The input AVPacket containing the input buffer.
  15279. */
  15280. int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
  15281. - int *got_sub_ptr,
  15282. - AVPacket *avpkt);
  15283. + int *got_sub_ptr, const AVPacket *avpkt);
  15284. /**
  15285. * Supply raw packet data as input to a decoder.
  15286. @@ -2589,17 +2603,17 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
  15287. * still has frames buffered, it will return them after sending
  15288. * a flush packet.
  15289. *
  15290. - * @return 0 on success, otherwise negative error code:
  15291. - * AVERROR(EAGAIN): input is not accepted in the current state - user
  15292. - * must read output with avcodec_receive_frame() (once
  15293. - * all output is read, the packet should be resent, and
  15294. - * the call will not fail with EAGAIN).
  15295. - * AVERROR_EOF: the decoder has been flushed, and no new packets can
  15296. - * be sent to it (also returned if more than 1 flush
  15297. - * packet is sent)
  15298. - * AVERROR(EINVAL): codec not opened, it is an encoder, or requires flush
  15299. - * AVERROR(ENOMEM): failed to add packet to internal queue, or similar
  15300. - * other errors: legitimate decoding errors
  15301. + * @retval 0 success
  15302. + * @retval AVERROR(EAGAIN) input is not accepted in the current state - user
  15303. + * must read output with avcodec_receive_frame() (once
  15304. + * all output is read, the packet should be resent,
  15305. + * and the call will not fail with EAGAIN).
  15306. + * @retval AVERROR_EOF the decoder has been flushed, and no new packets can be
  15307. + * sent to it (also returned if more than 1 flush
  15308. + * packet is sent)
  15309. + * @retval AVERROR(EINVAL) codec not opened, it is an encoder, or requires flush
  15310. + * @retval AVERROR(ENOMEM) failed to add packet to internal queue, or similar
  15311. + * @retval "another negative error code" legitimate decoding errors
  15312. */
  15313. int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt);
  15314. @@ -2613,18 +2627,17 @@ int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt);
  15315. * codec. Note that the function will always call
  15316. * av_frame_unref(frame) before doing anything else.
  15317. *
  15318. - * @return
  15319. - * 0: success, a frame was returned
  15320. - * AVERROR(EAGAIN): output is not available in this state - user must try
  15321. - * to send new input
  15322. - * AVERROR_EOF: the codec has been fully flushed, and there will be
  15323. - * no more output frames
  15324. - * AVERROR(EINVAL): codec not opened, or it is an encoder without
  15325. - * the AV_CODEC_FLAG_RECON_FRAME flag enabled
  15326. - * AVERROR_INPUT_CHANGED: current decoded frame has changed parameters
  15327. - * with respect to first decoded frame. Applicable
  15328. - * when flag AV_CODEC_FLAG_DROPCHANGED is set.
  15329. - * other negative values: legitimate decoding errors
  15330. + * @retval 0 success, a frame was returned
  15331. + * @retval AVERROR(EAGAIN) output is not available in this state - user must
  15332. + * try to send new input
  15333. + * @retval AVERROR_EOF the codec has been fully flushed, and there will be
  15334. + * no more output frames
  15335. + * @retval AVERROR(EINVAL) codec not opened, or it is an encoder without the
  15336. + * AV_CODEC_FLAG_RECON_FRAME flag enabled
  15337. + * @retval AVERROR_INPUT_CHANGED current decoded frame has changed parameters with
  15338. + * respect to first decoded frame. Applicable when flag
  15339. + * AV_CODEC_FLAG_DROPCHANGED is set.
  15340. + * @retval "other negative error code" legitimate decoding errors
  15341. */
  15342. int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame);
  15343. @@ -2651,16 +2664,16 @@ int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame);
  15344. * If it is not set, frame->nb_samples must be equal to
  15345. * avctx->frame_size for all frames except the last.
  15346. * The final frame may be smaller than avctx->frame_size.
  15347. - * @return 0 on success, otherwise negative error code:
  15348. - * AVERROR(EAGAIN): input is not accepted in the current state - user
  15349. - * must read output with avcodec_receive_packet() (once
  15350. - * all output is read, the packet should be resent, and
  15351. - * the call will not fail with EAGAIN).
  15352. - * AVERROR_EOF: the encoder has been flushed, and no new frames can
  15353. - * be sent to it
  15354. - * AVERROR(EINVAL): codec not opened, it is a decoder, or requires flush
  15355. - * AVERROR(ENOMEM): failed to add packet to internal queue, or similar
  15356. - * other errors: legitimate encoding errors
  15357. + * @retval 0 success
  15358. + * @retval AVERROR(EAGAIN) input is not accepted in the current state - user must
  15359. + * read output with avcodec_receive_packet() (once all
  15360. + * output is read, the packet should be resent, and the
  15361. + * call will not fail with EAGAIN).
  15362. + * @retval AVERROR_EOF the encoder has been flushed, and no new frames can
  15363. + * be sent to it
  15364. + * @retval AVERROR(EINVAL) codec not opened, it is a decoder, or requires flush
  15365. + * @retval AVERROR(ENOMEM) failed to add packet to internal queue, or similar
  15366. + * @retval "another negative error code" legitimate encoding errors
  15367. */
  15368. int avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame);
  15369. @@ -2671,13 +2684,13 @@ int avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame);
  15370. * @param avpkt This will be set to a reference-counted packet allocated by the
  15371. * encoder. Note that the function will always call
  15372. * av_packet_unref(avpkt) before doing anything else.
  15373. - * @return 0 on success, otherwise negative error code:
  15374. - * AVERROR(EAGAIN): output is not available in the current state - user
  15375. - * must try to send input
  15376. - * AVERROR_EOF: the encoder has been fully flushed, and there will be
  15377. - * no more output packets
  15378. - * AVERROR(EINVAL): codec not opened, or it is a decoder
  15379. - * other errors: legitimate encoding errors
  15380. + * @retval 0 success
  15381. + * @retval AVERROR(EAGAIN) output is not available in the current state - user must
  15382. + * try to send input
  15383. + * @retval AVERROR_EOF the encoder has been fully flushed, and there will be no
  15384. + * more output packets
  15385. + * @retval AVERROR(EINVAL) codec not opened, or it is a decoder
  15386. + * @retval "another negative error code" legitimate encoding errors
  15387. */
  15388. int avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt);
  15389. diff --git a/media/ffvpx/libavcodec/avcodec.symbols b/media/ffvpx/libavcodec/avcodec.symbols
  15390. index 491ce320..b15862fa 100644
  15391. --- a/media/ffvpx/libavcodec/avcodec.symbols
  15392. +++ b/media/ffvpx/libavcodec/avcodec.symbols
  15393. @@ -63,7 +63,6 @@ avcodec_find_encoder_by_name
  15394. avcodec_flush_buffers
  15395. avcodec_free_context
  15396. avcodec_get_class
  15397. -avcodec_get_frame_class
  15398. avcodec_get_hw_config
  15399. avcodec_get_name
  15400. avcodec_get_subtitle_rect_class
  15401. diff --git a/media/ffvpx/libavcodec/avpacket.c b/media/ffvpx/libavcodec/avpacket.c
  15402. index bcbc4166..5fef65e9 100644
  15403. --- a/media/ffvpx/libavcodec/avpacket.c
  15404. +++ b/media/ffvpx/libavcodec/avpacket.c
  15405. @@ -316,7 +316,7 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size)
  15406. const AVDictionaryEntry *t = NULL;
  15407. size_t total_length = 0;
  15408. - while ((t = av_dict_get(dict, "", t, AV_DICT_IGNORE_SUFFIX))) {
  15409. + while ((t = av_dict_iterate(dict, t))) {
  15410. for (int i = 0; i < 2; i++) {
  15411. const char *str = i ? t->value : t->key;
  15412. const size_t len = strlen(str) + 1;
  15413. diff --git a/media/ffvpx/libavcodec/bitstream_filters.c b/media/ffvpx/libavcodec/bitstream_filters.c
  15414. index a3bebefe..e8216819 100644
  15415. --- a/media/ffvpx/libavcodec/bitstream_filters.c
  15416. +++ b/media/ffvpx/libavcodec/bitstream_filters.c
  15417. @@ -43,6 +43,7 @@ extern const FFBitStreamFilter ff_hapqa_extract_bsf;
  15418. extern const FFBitStreamFilter ff_hevc_metadata_bsf;
  15419. extern const FFBitStreamFilter ff_hevc_mp4toannexb_bsf;
  15420. extern const FFBitStreamFilter ff_imx_dump_header_bsf;
  15421. +extern const FFBitStreamFilter ff_media100_to_mjpegb_bsf;
  15422. extern const FFBitStreamFilter ff_mjpeg2jpeg_bsf;
  15423. extern const FFBitStreamFilter ff_mjpega_dump_header_bsf;
  15424. extern const FFBitStreamFilter ff_mp3_header_decompress_bsf;
  15425. diff --git a/media/ffvpx/libavcodec/cbs_av1_syntax_template.c b/media/ffvpx/libavcodec/cbs_av1_syntax_template.c
  15426. index d98d3d42..e95925a4 100644
  15427. --- a/media/ffvpx/libavcodec/cbs_av1_syntax_template.c
  15428. +++ b/media/ffvpx/libavcodec/cbs_av1_syntax_template.c
  15429. @@ -1862,11 +1862,8 @@ static int FUNC(metadata_hdr_mdcv)(CodedBitstreamContext *ctx, RWContext *rw,
  15430. fb(16, white_point_chromaticity_x);
  15431. fb(16, white_point_chromaticity_y);
  15432. - fc(32, luminance_max, 1, MAX_UINT_BITS(32));
  15433. - // luminance_min must be lower than luminance_max. Convert luminance_max from
  15434. - // 24.8 fixed point to 18.14 fixed point in order to compare them.
  15435. - fc(32, luminance_min, 0, FFMIN(((uint64_t)current->luminance_max << 6) - 1,
  15436. - MAX_UINT_BITS(32)));
  15437. + fb(32, luminance_max);
  15438. + fb(32, luminance_min);
  15439. return 0;
  15440. }
  15441. diff --git a/media/ffvpx/libavcodec/codec.h b/media/ffvpx/libavcodec/codec.h
  15442. index 77a1a3f5..3b1995bc 100644
  15443. --- a/media/ffvpx/libavcodec/codec.h
  15444. +++ b/media/ffvpx/libavcodec/codec.h
  15445. @@ -50,12 +50,6 @@
  15446. * avcodec_default_get_buffer2 or avcodec_default_get_encode_buffer.
  15447. */
  15448. #define AV_CODEC_CAP_DR1 (1 << 1)
  15449. -#if FF_API_FLAG_TRUNCATED
  15450. -/**
  15451. - * @deprecated Use parsers to always send proper frames.
  15452. - */
  15453. -#define AV_CODEC_CAP_TRUNCATED (1 << 3)
  15454. -#endif
  15455. /**
  15456. * Encoder or decoder requires flushing with NULL input at the end in order to
  15457. * give the complete and correct output.
  15458. @@ -125,9 +119,6 @@
  15459. * multithreading-capable external libraries.
  15460. */
  15461. #define AV_CODEC_CAP_OTHER_THREADS (1 << 15)
  15462. -#if FF_API_AUTO_THREADS
  15463. -#define AV_CODEC_CAP_AUTO_THREADS AV_CODEC_CAP_OTHER_THREADS
  15464. -#endif
  15465. /**
  15466. * Audio encoder supports receiving a different number of samples in each call.
  15467. */
  15468. @@ -143,17 +134,6 @@
  15469. */
  15470. #define AV_CODEC_CAP_AVOID_PROBING (1 << 17)
  15471. -#if FF_API_UNUSED_CODEC_CAPS
  15472. -/**
  15473. - * Deprecated and unused. Use AVCodecDescriptor.props instead
  15474. - */
  15475. -#define AV_CODEC_CAP_INTRA_ONLY 0x40000000
  15476. -/**
  15477. - * Deprecated and unused. Use AVCodecDescriptor.props instead
  15478. - */
  15479. -#define AV_CODEC_CAP_LOSSLESS 0x80000000
  15480. -#endif
  15481. -
  15482. /**
  15483. * Codec is backed by a hardware implementation. Typically used to
  15484. * identify a non-hwaccel hardware decoder. For information about hwaccels, use
  15485. @@ -169,9 +149,9 @@
  15486. #define AV_CODEC_CAP_HYBRID (1 << 19)
  15487. /**
  15488. - * This codec takes the reordered_opaque field from input AVFrames
  15489. - * and returns it in the corresponding field in AVCodecContext after
  15490. - * encoding.
  15491. + * This encoder can reorder user opaque values from input AVFrames and return
  15492. + * them with corresponding output packets.
  15493. + * @see AV_CODEC_FLAG_COPY_OPAQUE
  15494. */
  15495. #define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE (1 << 20)
  15496. diff --git a/media/ffvpx/libavcodec/codec_desc.c b/media/ffvpx/libavcodec/codec_desc.c
  15497. index 24a0433d..199f62df 100644
  15498. --- a/media/ffvpx/libavcodec/codec_desc.c
  15499. +++ b/media/ffvpx/libavcodec/codec_desc.c
  15500. @@ -2536,6 +2536,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
  15501. .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Acorn Replay"),
  15502. .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
  15503. },
  15504. + {
  15505. + .id = AV_CODEC_ID_ADPCM_XMD,
  15506. + .type = AVMEDIA_TYPE_AUDIO,
  15507. + .name = "adpcm_xmd",
  15508. + .long_name = NULL_IF_CONFIG_SMALL("ADPCM Konami XMD"),
  15509. + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
  15510. + },
  15511. /* AMR */
  15512. {
  15513. @@ -2619,6 +2626,20 @@ static const AVCodecDescriptor codec_descriptors[] = {
  15514. .long_name = NULL_IF_CONFIG_SMALL("DPCM Xilam DERF"),
  15515. .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
  15516. },
  15517. + {
  15518. + .id = AV_CODEC_ID_WADY_DPCM,
  15519. + .type = AVMEDIA_TYPE_AUDIO,
  15520. + .name = "wady_dpcm",
  15521. + .long_name = NULL_IF_CONFIG_SMALL("DPCM Marble WADY"),
  15522. + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
  15523. + },
  15524. + {
  15525. + .id = AV_CODEC_ID_CBD2_DPCM,
  15526. + .type = AVMEDIA_TYPE_AUDIO,
  15527. + .name = "cbd2_dpcm",
  15528. + .long_name = NULL_IF_CONFIG_SMALL("DPCM Cuberoot-Delta-Exact"),
  15529. + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
  15530. + },
  15531. /* audio codecs */
  15532. {
  15533. @@ -3332,6 +3353,20 @@ static const AVCodecDescriptor codec_descriptors[] = {
  15534. .long_name = NULL_IF_CONFIG_SMALL("FTR Voice"),
  15535. .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
  15536. },
  15537. + {
  15538. + .id = AV_CODEC_ID_WAVARC,
  15539. + .type = AVMEDIA_TYPE_AUDIO,
  15540. + .name = "wavarc",
  15541. + .long_name = NULL_IF_CONFIG_SMALL("Waveform Archiver"),
  15542. + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
  15543. + },
  15544. + {
  15545. + .id = AV_CODEC_ID_RKA,
  15546. + .type = AVMEDIA_TYPE_AUDIO,
  15547. + .name = "rka",
  15548. + .long_name = NULL_IF_CONFIG_SMALL("RKA (RK Audio)"),
  15549. + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS,
  15550. + },
  15551. /* subtitle codecs */
  15552. {
  15553. @@ -3604,6 +3639,18 @@ static const AVCodecDescriptor codec_descriptors[] = {
  15554. .long_name = NULL_IF_CONFIG_SMALL("AVFrame to AVPacket passthrough"),
  15555. .props = AV_CODEC_PROP_LOSSLESS,
  15556. },
  15557. + {
  15558. + .id = AV_CODEC_ID_VNULL,
  15559. + .type = AVMEDIA_TYPE_VIDEO,
  15560. + .name = "vnull",
  15561. + .long_name = NULL_IF_CONFIG_SMALL("Null video codec"),
  15562. + },
  15563. + {
  15564. + .id = AV_CODEC_ID_ANULL,
  15565. + .type = AVMEDIA_TYPE_AUDIO,
  15566. + .name = "anull",
  15567. + .long_name = NULL_IF_CONFIG_SMALL("Null audio codec"),
  15568. + },
  15569. };
  15570. static int descriptor_compare(const void *key, const void *member)
  15571. diff --git a/media/ffvpx/libavcodec/codec_id.h b/media/ffvpx/libavcodec/codec_id.h
  15572. index f436a2b6..89a4a0cb 100644
  15573. --- a/media/ffvpx/libavcodec/codec_id.h
  15574. +++ b/media/ffvpx/libavcodec/codec_id.h
  15575. @@ -413,6 +413,7 @@ enum AVCodecID {
  15576. AV_CODEC_ID_ADPCM_IMA_CUNNING,
  15577. AV_CODEC_ID_ADPCM_IMA_MOFLEX,
  15578. AV_CODEC_ID_ADPCM_IMA_ACORN,
  15579. + AV_CODEC_ID_ADPCM_XMD,
  15580. /* AMR */
  15581. AV_CODEC_ID_AMR_NB = 0x12000,
  15582. @@ -430,6 +431,8 @@ enum AVCodecID {
  15583. AV_CODEC_ID_SDX2_DPCM,
  15584. AV_CODEC_ID_GREMLIN_DPCM,
  15585. AV_CODEC_ID_DERF_DPCM,
  15586. + AV_CODEC_ID_WADY_DPCM,
  15587. + AV_CODEC_ID_CBD2_DPCM,
  15588. /* audio codecs */
  15589. AV_CODEC_ID_MP2 = 0x15000,
  15590. @@ -533,6 +536,8 @@ enum AVCodecID {
  15591. AV_CODEC_ID_MISC4,
  15592. AV_CODEC_ID_APAC,
  15593. AV_CODEC_ID_FTR,
  15594. + AV_CODEC_ID_WAVARC,
  15595. + AV_CODEC_ID_RKA,
  15596. /* subtitle codecs */
  15597. AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
  15598. @@ -587,6 +592,16 @@ enum AVCodecID {
  15599. * stream (only used by libavformat) */
  15600. AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information.
  15601. AV_CODEC_ID_WRAPPED_AVFRAME = 0x21001, ///< Passthrough codec, AVFrames wrapped in AVPacket
  15602. + /**
  15603. + * Dummy null video codec, useful mainly for development and debugging.
  15604. + * Null encoder/decoder discard all input and never return any output.
  15605. + */
  15606. + AV_CODEC_ID_VNULL,
  15607. + /**
  15608. + * Dummy null audio codec, useful mainly for development and debugging.
  15609. + * Null encoder/decoder discard all input and never return any output.
  15610. + */
  15611. + AV_CODEC_ID_ANULL,
  15612. };
  15613. /**
  15614. diff --git a/media/ffvpx/libavcodec/codec_internal.h b/media/ffvpx/libavcodec/codec_internal.h
  15615. index e3b77e6d..130a7dc3 100644
  15616. --- a/media/ffvpx/libavcodec/codec_internal.h
  15617. +++ b/media/ffvpx/libavcodec/codec_internal.h
  15618. @@ -80,6 +80,14 @@
  15619. * Codec supports embedded ICC profiles (AV_FRAME_DATA_ICC_PROFILE).
  15620. */
  15621. #define FF_CODEC_CAP_ICC_PROFILES (1 << 9)
  15622. +/**
  15623. + * The encoder has AV_CODEC_CAP_DELAY set, but does not actually have delay - it
  15624. + * only wants to be flushed at the end to update some context variables (e.g.
  15625. + * 2pass stats) or produce a trailing packet. Besides that it immediately
  15626. + * produces exactly one output packet per each input frame, just as no-delay
  15627. + * encoders do.
  15628. + */
  15629. +#define FF_CODEC_CAP_EOF_FLUSH (1 << 10)
  15630. /**
  15631. * FFCodec.codec_tags termination value
  15632. diff --git a/media/ffvpx/libavcodec/decode.c b/media/ffvpx/libavcodec/decode.c
  15633. index 6be2d3d6..be2be810 100644
  15634. --- a/media/ffvpx/libavcodec/decode.c
  15635. +++ b/media/ffvpx/libavcodec/decode.c
  15636. @@ -132,38 +132,16 @@ fail2:
  15637. return 0;
  15638. }
  15639. -#define IS_EMPTY(pkt) (!(pkt)->data)
  15640. -
  15641. -static int copy_packet_props(AVPacket *dst, const AVPacket *src)
  15642. -{
  15643. - int ret = av_packet_copy_props(dst, src);
  15644. - if (ret < 0)
  15645. - return ret;
  15646. -
  15647. - dst->size = src->size; // HACK: Needed for ff_decode_frame_props().
  15648. - dst->data = (void*)1; // HACK: Needed for IS_EMPTY().
  15649. -
  15650. - return 0;
  15651. -}
  15652. -
  15653. static int extract_packet_props(AVCodecInternal *avci, const AVPacket *pkt)
  15654. {
  15655. - AVPacket tmp = { 0 };
  15656. int ret = 0;
  15657. - if (IS_EMPTY(avci->last_pkt_props)) {
  15658. - if (av_fifo_read(avci->pkt_props, avci->last_pkt_props, 1) < 0)
  15659. - return copy_packet_props(avci->last_pkt_props, pkt);
  15660. + av_packet_unref(avci->last_pkt_props);
  15661. + if (pkt) {
  15662. + ret = av_packet_copy_props(avci->last_pkt_props, pkt);
  15663. + if (!ret)
  15664. + avci->last_pkt_props->opaque = (void *)(intptr_t)pkt->size; // Needed for ff_decode_frame_props().
  15665. }
  15666. -
  15667. - ret = copy_packet_props(&tmp, pkt);
  15668. - if (ret < 0)
  15669. - return ret;
  15670. -
  15671. - ret = av_fifo_write(avci->pkt_props, &tmp, 1);
  15672. - if (ret < 0)
  15673. - av_packet_unref(&tmp);
  15674. -
  15675. return ret;
  15676. }
  15677. @@ -449,18 +427,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
  15678. if (!got_frame)
  15679. av_frame_unref(frame);
  15680. -#if FF_API_FLAG_TRUNCATED
  15681. - if (ret >= 0 && avctx->codec->type == AVMEDIA_TYPE_VIDEO && !(avctx->flags & AV_CODEC_FLAG_TRUNCATED))
  15682. -#else
  15683. if (ret >= 0 && avctx->codec->type == AVMEDIA_TYPE_VIDEO)
  15684. -#endif
  15685. ret = pkt->size;
  15686. -#if FF_API_AVCTX_TIMEBASE
  15687. - if (avctx->framerate.num > 0 && avctx->framerate.den > 0)
  15688. - avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1}));
  15689. -#endif
  15690. -
  15691. /* do not stop draining when actual_got_frame != 0 or ret < 0 */
  15692. /* got_frame == 0 but actual_got_frame != 0 when frame is discarded */
  15693. if (avci->draining && !actual_got_frame) {
  15694. @@ -483,7 +452,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
  15695. if (ret >= pkt->size || ret < 0) {
  15696. av_packet_unref(pkt);
  15697. - av_packet_unref(avci->last_pkt_props);
  15698. } else {
  15699. int consumed = ret;
  15700. @@ -492,7 +460,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
  15701. pkt->pts = AV_NOPTS_VALUE;
  15702. pkt->dts = AV_NOPTS_VALUE;
  15703. if (!(codec->caps_internal & FF_CODEC_CAP_SETS_FRAME_PROPS)) {
  15704. - avci->last_pkt_props->size -= consumed; // See extract_packet_props() comment.
  15705. + // See extract_packet_props() comment.
  15706. + avci->last_pkt_props->opaque = (void *)((intptr_t)avci->last_pkt_props->opaque - consumed);
  15707. avci->last_pkt_props->pts = AV_NOPTS_VALUE;
  15708. avci->last_pkt_props->dts = AV_NOPTS_VALUE;
  15709. }
  15710. @@ -578,8 +547,6 @@ static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
  15711. if (codec->cb_type == FF_CODEC_CB_TYPE_RECEIVE_FRAME) {
  15712. ret = codec->cb.receive_frame(avctx, frame);
  15713. - if (ret != AVERROR(EAGAIN))
  15714. - av_packet_unref(avci->last_pkt_props);
  15715. } else
  15716. ret = decode_simple_receive_frame(avctx, frame);
  15717. @@ -593,12 +560,6 @@ static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
  15718. return ok;
  15719. }
  15720. - if (!(codec->caps_internal & FF_CODEC_CAP_SETS_FRAME_PROPS) &&
  15721. - IS_EMPTY(avci->last_pkt_props)) {
  15722. - // May fail if the FIFO is empty.
  15723. - av_fifo_read(avci->pkt_props, avci->last_pkt_props, 1);
  15724. - }
  15725. -
  15726. if (!ret) {
  15727. frame->best_effort_timestamp = guess_correct_pts(avctx,
  15728. frame->pts,
  15729. @@ -697,6 +658,33 @@ static int apply_cropping(AVCodecContext *avctx, AVFrame *frame)
  15730. AV_FRAME_CROP_UNALIGNED : 0);
  15731. }
  15732. +// make sure frames returned to the caller are valid
  15733. +static int frame_validate(AVCodecContext *avctx, AVFrame *frame)
  15734. +{
  15735. + if (!frame->buf[0] || frame->format < 0)
  15736. + goto fail;
  15737. +
  15738. + switch (avctx->codec_type) {
  15739. + case AVMEDIA_TYPE_VIDEO:
  15740. + if (frame->width <= 0 || frame->height <= 0)
  15741. + goto fail;
  15742. + break;
  15743. + case AVMEDIA_TYPE_AUDIO:
  15744. + if (!av_channel_layout_check(&frame->ch_layout) ||
  15745. + frame->sample_rate <= 0)
  15746. + goto fail;
  15747. +
  15748. + break;
  15749. + default: av_assert0(0);
  15750. + }
  15751. +
  15752. + return 0;
  15753. +fail:
  15754. + av_log(avctx, AV_LOG_ERROR, "An invalid frame was output by a decoder. "
  15755. + "This is a bug, please report it.\n");
  15756. + return AVERROR_BUG;
  15757. +}
  15758. +
  15759. int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame)
  15760. {
  15761. AVCodecInternal *avci = avctx->internal;
  15762. @@ -713,19 +701,26 @@ int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame)
  15763. return ret;
  15764. }
  15765. + ret = frame_validate(avctx, frame);
  15766. + if (ret < 0)
  15767. + goto fail;
  15768. +
  15769. if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
  15770. ret = apply_cropping(avctx, frame);
  15771. - if (ret < 0) {
  15772. - av_frame_unref(frame);
  15773. - return ret;
  15774. - }
  15775. + if (ret < 0)
  15776. + goto fail;
  15777. }
  15778. - avctx->frame_number++;
  15779. + avctx->frame_num++;
  15780. +#if FF_API_AVCTX_FRAME_NUMBER
  15781. +FF_DISABLE_DEPRECATION_WARNINGS
  15782. + avctx->frame_number = avctx->frame_num;
  15783. +FF_ENABLE_DEPRECATION_WARNINGS
  15784. +#endif
  15785. if (avctx->flags & AV_CODEC_FLAG_DROPCHANGED) {
  15786. - if (avctx->frame_number == 1) {
  15787. + if (avctx->frame_num == 1) {
  15788. avci->initial_format = frame->format;
  15789. switch(avctx->codec_type) {
  15790. case AVMEDIA_TYPE_VIDEO:
  15791. @@ -736,15 +731,13 @@ int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame)
  15792. avci->initial_sample_rate = frame->sample_rate ? frame->sample_rate :
  15793. avctx->sample_rate;
  15794. ret = av_channel_layout_copy(&avci->initial_ch_layout, &frame->ch_layout);
  15795. - if (ret < 0) {
  15796. - av_frame_unref(frame);
  15797. - return ret;
  15798. - }
  15799. + if (ret < 0)
  15800. + goto fail;
  15801. break;
  15802. }
  15803. }
  15804. - if (avctx->frame_number > 1) {
  15805. + if (avctx->frame_num > 1) {
  15806. changed = avci->initial_format != frame->format;
  15807. switch(avctx->codec_type) {
  15808. @@ -761,16 +754,19 @@ int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame)
  15809. if (changed) {
  15810. avci->changed_frames_dropped++;
  15811. - av_log(avctx, AV_LOG_INFO, "dropped changed frame #%d pts %"PRId64
  15812. + av_log(avctx, AV_LOG_INFO, "dropped changed frame #%"PRId64" pts %"PRId64
  15813. " drop count: %d \n",
  15814. - avctx->frame_number, frame->pts,
  15815. + avctx->frame_num, frame->pts,
  15816. avci->changed_frames_dropped);
  15817. - av_frame_unref(frame);
  15818. - return AVERROR_INPUT_CHANGED;
  15819. + ret = AVERROR_INPUT_CHANGED;
  15820. + goto fail;
  15821. }
  15822. }
  15823. }
  15824. return 0;
  15825. +fail:
  15826. + av_frame_unref(frame);
  15827. + return ret;
  15828. }
  15829. static void get_subtitle_defaults(AVSubtitle *sub)
  15830. @@ -780,8 +776,8 @@ static void get_subtitle_defaults(AVSubtitle *sub)
  15831. }
  15832. #define UTF8_MAX_BYTES 4 /* 5 and 6 bytes sequences should not be used */
  15833. -static int recode_subtitle(AVCodecContext *avctx, AVPacket **outpkt,
  15834. - AVPacket *inpkt, AVPacket *buf_pkt)
  15835. +static int recode_subtitle(AVCodecContext *avctx, const AVPacket **outpkt,
  15836. + const AVPacket *inpkt, AVPacket *buf_pkt)
  15837. {
  15838. #if CONFIG_ICONV
  15839. iconv_t cd = (iconv_t)-1;
  15840. @@ -861,8 +857,7 @@ static int utf8_check(const uint8_t *str)
  15841. }
  15842. int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
  15843. - int *got_sub_ptr,
  15844. - AVPacket *avpkt)
  15845. + int *got_sub_ptr, const AVPacket *avpkt)
  15846. {
  15847. int ret = 0;
  15848. @@ -882,7 +877,7 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
  15849. if ((avctx->codec->capabilities & AV_CODEC_CAP_DELAY) || avpkt->size) {
  15850. AVCodecInternal *avci = avctx->internal;
  15851. - AVPacket *pkt;
  15852. + const AVPacket *pkt;
  15853. ret = recode_subtitle(avctx, &pkt, avpkt, avci->buffer_pkt);
  15854. if (ret < 0)
  15855. @@ -926,7 +921,12 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
  15856. }
  15857. if (*got_sub_ptr)
  15858. - avctx->frame_number++;
  15859. + avctx->frame_num++;
  15860. +#if FF_API_AVCTX_FRAME_NUMBER
  15861. +FF_DISABLE_DEPRECATION_WARNINGS
  15862. + avctx->frame_number = avctx->frame_num;
  15863. +FF_ENABLE_DEPRECATION_WARNINGS
  15864. +#endif
  15865. }
  15866. return ret;
  15867. @@ -1291,9 +1291,9 @@ static int add_metadata_from_side_data(const AVPacket *avpkt, AVFrame *frame)
  15868. return av_packet_unpack_dictionary(side_metadata, size, frame_md);
  15869. }
  15870. -int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
  15871. +int ff_decode_frame_props_from_pkt(const AVCodecContext *avctx,
  15872. + AVFrame *frame, const AVPacket *pkt)
  15873. {
  15874. - AVPacket *pkt = avctx->internal->last_pkt_props;
  15875. static const struct {
  15876. enum AVPacketSideDataType packet;
  15877. enum AVFrameSideDataType frame;
  15878. @@ -1311,34 +1311,57 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
  15879. { AV_PKT_DATA_DYNAMIC_HDR10_PLUS, AV_FRAME_DATA_DYNAMIC_HDR_PLUS },
  15880. };
  15881. - if (!(ffcodec(avctx->codec)->caps_internal & FF_CODEC_CAP_SETS_FRAME_PROPS)) {
  15882. - frame->pts = pkt->pts;
  15883. - frame->pkt_pos = pkt->pos;
  15884. - frame->duration = pkt->duration;
  15885. - frame->pkt_size = pkt->size;
  15886. -
  15887. - for (int i = 0; i < FF_ARRAY_ELEMS(sd); i++) {
  15888. - size_t size;
  15889. - uint8_t *packet_sd = av_packet_get_side_data(pkt, sd[i].packet, &size);
  15890. - if (packet_sd) {
  15891. - AVFrameSideData *frame_sd = av_frame_new_side_data(frame,
  15892. - sd[i].frame,
  15893. - size);
  15894. - if (!frame_sd)
  15895. - return AVERROR(ENOMEM);
  15896. -
  15897. - memcpy(frame_sd->data, packet_sd, size);
  15898. - }
  15899. + frame->pts = pkt->pts;
  15900. + frame->pkt_pos = pkt->pos;
  15901. + frame->duration = pkt->duration;
  15902. + frame->pkt_size = pkt->size;
  15903. +
  15904. + for (int i = 0; i < FF_ARRAY_ELEMS(sd); i++) {
  15905. + size_t size;
  15906. + uint8_t *packet_sd = av_packet_get_side_data(pkt, sd[i].packet, &size);
  15907. + if (packet_sd) {
  15908. + AVFrameSideData *frame_sd = av_frame_new_side_data(frame,
  15909. + sd[i].frame,
  15910. + size);
  15911. + if (!frame_sd)
  15912. + return AVERROR(ENOMEM);
  15913. +
  15914. + memcpy(frame_sd->data, packet_sd, size);
  15915. }
  15916. - add_metadata_from_side_data(pkt, frame);
  15917. + }
  15918. + add_metadata_from_side_data(pkt, frame);
  15919. - if (pkt->flags & AV_PKT_FLAG_DISCARD) {
  15920. - frame->flags |= AV_FRAME_FLAG_DISCARD;
  15921. - } else {
  15922. - frame->flags = (frame->flags & ~AV_FRAME_FLAG_DISCARD);
  15923. - }
  15924. + if (pkt->flags & AV_PKT_FLAG_DISCARD) {
  15925. + frame->flags |= AV_FRAME_FLAG_DISCARD;
  15926. + } else {
  15927. + frame->flags = (frame->flags & ~AV_FRAME_FLAG_DISCARD);
  15928. }
  15929. +
  15930. + if (avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) {
  15931. + int ret = av_buffer_replace(&frame->opaque_ref, pkt->opaque_ref);
  15932. + if (ret < 0)
  15933. + return ret;
  15934. + frame->opaque = pkt->opaque;
  15935. + }
  15936. +
  15937. + return 0;
  15938. +}
  15939. +
  15940. +int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
  15941. +{
  15942. + const AVPacket *pkt = avctx->internal->last_pkt_props;
  15943. +
  15944. + if (!(ffcodec(avctx->codec)->caps_internal & FF_CODEC_CAP_SETS_FRAME_PROPS)) {
  15945. + int ret = ff_decode_frame_props_from_pkt(avctx, frame, pkt);
  15946. + if (ret < 0)
  15947. + return ret;
  15948. + frame->pkt_size = (int)(intptr_t)pkt->opaque;
  15949. + }
  15950. +#if FF_API_REORDERED_OPAQUE
  15951. +FF_DISABLE_DEPRECATION_WARNINGS
  15952. frame->reordered_opaque = avctx->reordered_opaque;
  15953. +FF_ENABLE_DEPRECATION_WARNINGS
  15954. +#endif
  15955. if (frame->color_primaries == AVCOL_PRI_UNSPECIFIED)
  15956. frame->color_primaries = avctx->color_primaries;
  15957. @@ -1582,19 +1605,6 @@ int ff_decode_preinit(AVCodecContext *avctx)
  15958. * free the already allocated subtitle_header before overwriting it */
  15959. av_freep(&avctx->subtitle_header);
  15960. -#if FF_API_THREAD_SAFE_CALLBACKS
  15961. -FF_DISABLE_DEPRECATION_WARNINGS
  15962. - if ((avctx->thread_type & FF_THREAD_FRAME) &&
  15963. - avctx->get_buffer2 != avcodec_default_get_buffer2 &&
  15964. - !avctx->thread_safe_callbacks) {
  15965. - av_log(avctx, AV_LOG_WARNING, "Requested frame threading with a "
  15966. - "custom get_buffer2() implementation which is not marked as "
  15967. - "thread safe. This is not supported anymore, make your "
  15968. - "callback thread-safe.\n");
  15969. - }
  15970. -FF_ENABLE_DEPRECATION_WARNINGS
  15971. -#endif
  15972. -
  15973. if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) {
  15974. av_log(avctx, AV_LOG_WARNING, "The maximum value for lowres supported by the decoder is %d\n",
  15975. avctx->codec->max_lowres);
  15976. @@ -1651,9 +1661,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
  15977. avci->in_pkt = av_packet_alloc();
  15978. avci->last_pkt_props = av_packet_alloc();
  15979. - avci->pkt_props = av_fifo_alloc2(1, sizeof(*avci->last_pkt_props),
  15980. - AV_FIFO_FLAG_AUTO_GROW);
  15981. - if (!avci->in_pkt || !avci->last_pkt_props || !avci->pkt_props)
  15982. + if (!avci->in_pkt || !avci->last_pkt_props)
  15983. return AVERROR(ENOMEM);
  15984. ret = decode_bsfs_init(avctx);
  15985. diff --git a/media/ffvpx/libavcodec/decode.h b/media/ffvpx/libavcodec/decode.h
  15986. index 5d95369b..8430ffbd 100644
  15987. --- a/media/ffvpx/libavcodec/decode.h
  15988. +++ b/media/ffvpx/libavcodec/decode.h
  15989. @@ -69,6 +69,12 @@ int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame);
  15990. */
  15991. int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt);
  15992. +/**
  15993. + * Set various frame properties from the provided packet.
  15994. + */
  15995. +int ff_decode_frame_props_from_pkt(const AVCodecContext *avctx,
  15996. + AVFrame *frame, const AVPacket *pkt);
  15997. +
  15998. /**
  15999. * Set various frame properties from the codec context / packet data.
  16000. */
  16001. diff --git a/media/ffvpx/libavcodec/encode.c b/media/ffvpx/libavcodec/encode.c
  16002. index fbe2c97c..041fc767 100644
  16003. --- a/media/ffvpx/libavcodec/encode.c
  16004. +++ b/media/ffvpx/libavcodec/encode.c
  16005. @@ -171,7 +171,12 @@ int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
  16006. }
  16007. ret = ffcodec(avctx->codec)->cb.encode_sub(avctx, buf, buf_size, sub);
  16008. - avctx->frame_number++;
  16009. + avctx->frame_num++;
  16010. +#if FF_API_AVCTX_FRAME_NUMBER
  16011. +FF_DISABLE_DEPRECATION_WARNINGS
  16012. + avctx->frame_number = avctx->frame_num;
  16013. +FF_ENABLE_DEPRECATION_WARNINGS
  16014. +#endif
  16015. return ret;
  16016. }
  16017. @@ -190,6 +195,25 @@ int ff_encode_get_frame(AVCodecContext *avctx, AVFrame *frame)
  16018. return 0;
  16019. }
  16020. +int ff_encode_reordered_opaque(AVCodecContext *avctx,
  16021. + AVPacket *pkt, const AVFrame *frame)
  16022. +{
  16023. +#if FF_API_REORDERED_OPAQUE
  16024. +FF_DISABLE_DEPRECATION_WARNINGS
  16025. + avctx->reordered_opaque = frame->reordered_opaque;
  16026. +FF_ENABLE_DEPRECATION_WARNINGS
  16027. +#endif
  16028. +
  16029. + if (avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) {
  16030. + int ret = av_buffer_replace(&pkt->opaque_ref, frame->opaque_ref);
  16031. + if (ret < 0)
  16032. + return ret;
  16033. + pkt->opaque = frame->opaque;
  16034. + }
  16035. +
  16036. + return 0;
  16037. +}
  16038. +
  16039. int ff_encode_encode_cb(AVCodecContext *avctx, AVPacket *avpkt,
  16040. AVFrame *frame, int *got_packet)
  16041. {
  16042. @@ -211,30 +235,38 @@ int ff_encode_encode_cb(AVCodecContext *avctx, AVPacket *avpkt,
  16043. // set the timestamps for the simple no-delay case
  16044. // encoders with delay have to set the timestamps themselves
  16045. - if (!(avctx->codec->capabilities & AV_CODEC_CAP_DELAY)) {
  16046. + if (!(avctx->codec->capabilities & AV_CODEC_CAP_DELAY) ||
  16047. + (frame && (codec->caps_internal & FF_CODEC_CAP_EOF_FLUSH))) {
  16048. if (avpkt->pts == AV_NOPTS_VALUE)
  16049. avpkt->pts = frame->pts;
  16050. - if (avctx->codec->type == AVMEDIA_TYPE_AUDIO) {
  16051. - if (!avpkt->duration)
  16052. + if (!avpkt->duration) {
  16053. + if (frame->duration)
  16054. + avpkt->duration = frame->duration;
  16055. + else if (avctx->codec->type == AVMEDIA_TYPE_AUDIO) {
  16056. avpkt->duration = ff_samples_to_time_base(avctx,
  16057. frame->nb_samples);
  16058. + }
  16059. }
  16060. +
  16061. + ret = ff_encode_reordered_opaque(avctx, avpkt, frame);
  16062. + if (ret < 0)
  16063. + goto unref;
  16064. }
  16065. // dts equals pts unless there is reordering
  16066. // there can be no reordering if there is no encoder delay
  16067. if (!(avctx->codec_descriptor->props & AV_CODEC_PROP_REORDER) ||
  16068. - !(avctx->codec->capabilities & AV_CODEC_CAP_DELAY))
  16069. + !(avctx->codec->capabilities & AV_CODEC_CAP_DELAY) ||
  16070. + (codec->caps_internal & FF_CODEC_CAP_EOF_FLUSH))
  16071. avpkt->dts = avpkt->pts;
  16072. } else {
  16073. unref:
  16074. av_packet_unref(avpkt);
  16075. }
  16076. -#if !FF_API_THREAD_SAFE_CALLBACKS
  16077. +
  16078. if (frame)
  16079. av_frame_unref(frame);
  16080. -#endif
  16081. return ret;
  16082. }
  16083. @@ -275,10 +307,6 @@ static int encode_simple_internal(AVCodecContext *avctx, AVPacket *avpkt)
  16084. ret = ff_thread_video_encode_frame(avctx, avpkt, frame, &got_packet);
  16085. else {
  16086. ret = ff_encode_encode_cb(avctx, avpkt, frame, &got_packet);
  16087. -#if FF_API_THREAD_SAFE_CALLBACKS
  16088. - if (frame)
  16089. - av_frame_unref(frame);
  16090. -#endif
  16091. }
  16092. if (avci->draining && !got_packet)
  16093. @@ -442,6 +470,13 @@ FF_ENABLE_DEPRECATION_WARNINGS
  16094. return ret;
  16095. }
  16096. + // unset frame duration unless AV_CODEC_FLAG_FRAME_DURATION is set,
  16097. + // since otherwise we cannot be sure that whatever value it has is in the
  16098. + // right timebase, so we would produce an incorrect value, which is worse
  16099. + // than none at all
  16100. + if (!(avctx->flags & AV_CODEC_FLAG_FRAME_DURATION))
  16101. + dst->duration = 0;
  16102. +
  16103. return 0;
  16104. }
  16105. @@ -473,7 +508,12 @@ int attribute_align_arg avcodec_send_frame(AVCodecContext *avctx, const AVFrame
  16106. return ret;
  16107. }
  16108. - avctx->frame_number++;
  16109. + avctx->frame_num++;
  16110. +#if FF_API_AVCTX_FRAME_NUMBER
  16111. +FF_DISABLE_DEPRECATION_WARNINGS
  16112. + avctx->frame_number = avctx->frame_num;
  16113. +FF_ENABLE_DEPRECATION_WARNINGS
  16114. +#endif
  16115. return 0;
  16116. }
  16117. @@ -634,6 +674,13 @@ int ff_encode_preinit(AVCodecContext *avctx)
  16118. return AVERROR(EINVAL);
  16119. }
  16120. + if (avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE &&
  16121. + !(avctx->codec->capabilities & AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE)) {
  16122. + av_log(avctx, AV_LOG_ERROR, "The copy_opaque flag is set, but the "
  16123. + "encoder does not support it.\n");
  16124. + return AVERROR(EINVAL);
  16125. + }
  16126. +
  16127. switch (avctx->codec_type) {
  16128. case AVMEDIA_TYPE_VIDEO: ret = encode_preinit_video(avctx); break;
  16129. case AVMEDIA_TYPE_AUDIO: ret = encode_preinit_audio(avctx); break;
  16130. diff --git a/media/ffvpx/libavcodec/encode.h b/media/ffvpx/libavcodec/encode.h
  16131. index 81d18d6e..26a33040 100644
  16132. --- a/media/ffvpx/libavcodec/encode.h
  16133. +++ b/media/ffvpx/libavcodec/encode.h
  16134. @@ -69,6 +69,12 @@ int ff_encode_alloc_frame(AVCodecContext *avctx, AVFrame *frame);
  16135. */
  16136. int ff_alloc_packet(AVCodecContext *avctx, AVPacket *avpkt, int64_t size);
  16137. +/**
  16138. + * Propagate user opaque values from the frame to avctx/pkt as needed.
  16139. + */
  16140. +int ff_encode_reordered_opaque(AVCodecContext *avctx,
  16141. + AVPacket *pkt, const AVFrame *frame);
  16142. +
  16143. /*
  16144. * Perform encoder initialization and validation.
  16145. * Called when opening the encoder, before the FFCodec.init() call.
  16146. diff --git a/media/ffvpx/libavcodec/flac.c b/media/ffvpx/libavcodec/flac.c
  16147. index 352d663c..174b4801 100644
  16148. --- a/media/ffvpx/libavcodec/flac.c
  16149. +++ b/media/ffvpx/libavcodec/flac.c
  16150. @@ -28,7 +28,7 @@
  16151. #include "flacdata.h"
  16152. #include "flac_parse.h"
  16153. -static const int8_t sample_size_table[] = { 0, 8, 12, 0, 16, 20, 24, 0 };
  16154. +static const int8_t sample_size_table[] = { 0, 8, 12, 0, 16, 20, 24, 32 };
  16155. static const AVChannelLayout flac_channel_layouts[8] = {
  16156. AV_CHANNEL_LAYOUT_MONO,
  16157. @@ -82,7 +82,7 @@ int ff_flac_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb,
  16158. /* bits per sample */
  16159. bps_code = get_bits(gb, 3);
  16160. - if (bps_code == 3 || bps_code == 7) {
  16161. + if (bps_code == 3) {
  16162. av_log(avctx, AV_LOG_ERROR + log_level_offset,
  16163. "invalid sample size code (%d)\n",
  16164. bps_code);
  16165. diff --git a/media/ffvpx/libavcodec/flacdec.c b/media/ffvpx/libavcodec/flacdec.c
  16166. index 5b8547a9..cc778a8d 100644
  16167. --- a/media/ffvpx/libavcodec/flacdec.c
  16168. +++ b/media/ffvpx/libavcodec/flacdec.c
  16169. @@ -64,6 +64,9 @@ typedef struct FLACContext {
  16170. int32_t *decoded[FLAC_MAX_CHANNELS]; ///< decoded samples
  16171. uint8_t *decoded_buffer;
  16172. unsigned int decoded_buffer_size;
  16173. + int64_t *decoded_33bps; ///< decoded samples for a 33 bps subframe
  16174. + uint8_t *decoded_buffer_33bps;
  16175. + unsigned int decoded_buffer_size_33bps;
  16176. int buggy_lpc; ///< use workaround for old lavc encoded files
  16177. FLACDSPContext dsp;
  16178. @@ -154,6 +157,24 @@ static int allocate_buffers(FLACContext *s)
  16179. s->stream_info.channels,
  16180. s->stream_info.max_blocksize,
  16181. AV_SAMPLE_FMT_S32P, 0);
  16182. + if (ret >= 0 && s->stream_info.bps == 32 && s->stream_info.channels == 2) {
  16183. + buf_size = av_samples_get_buffer_size(NULL, 1,
  16184. + s->stream_info.max_blocksize,
  16185. + AV_SAMPLE_FMT_S64P, 0);
  16186. + if (buf_size < 0)
  16187. + return buf_size;
  16188. +
  16189. + av_fast_malloc(&s->decoded_buffer_33bps, &s->decoded_buffer_size_33bps, buf_size);
  16190. + if (!s->decoded_buffer_33bps)
  16191. + return AVERROR(ENOMEM);
  16192. +
  16193. + ret = av_samples_fill_arrays((uint8_t **)&s->decoded_33bps, NULL,
  16194. + s->decoded_buffer_33bps,
  16195. + 1,
  16196. + s->stream_info.max_blocksize,
  16197. + AV_SAMPLE_FMT_S64P, 0);
  16198. +
  16199. + }
  16200. return ret < 0 ? ret : 0;
  16201. }
  16202. @@ -331,6 +352,62 @@ static int decode_subframe_fixed(FLACContext *s, int32_t *decoded,
  16203. return 0;
  16204. }
  16205. +#define DECODER_SUBFRAME_FIXED_WIDE(residual) { \
  16206. + const int blocksize = s->blocksize; \
  16207. + int ret; \
  16208. + \
  16209. + if ((ret = decode_residuals(s, residual, pred_order)) < 0) \
  16210. + return ret; \
  16211. + \
  16212. + switch (pred_order) { \
  16213. + case 0: \
  16214. + for (int i = pred_order; i < blocksize; i++) \
  16215. + decoded[i] = residual[i]; \
  16216. + break; \
  16217. + case 1: \
  16218. + for (int i = pred_order; i < blocksize; i++) \
  16219. + decoded[i] = (int64_t)residual[i] + (int64_t)decoded[i-1];\
  16220. + break; \
  16221. + case 2: \
  16222. + for (int i = pred_order; i < blocksize; i++) \
  16223. + decoded[i] = (int64_t)residual[i] + 2*(int64_t)decoded[i-1] - (int64_t)decoded[i-2]; \
  16224. + break; \
  16225. + case 3: \
  16226. + for (int i = pred_order; i < blocksize; i++) \
  16227. + decoded[i] = (int64_t)residual[i] + 3*(int64_t)decoded[i-1] - 3*(int64_t)decoded[i-2] + (int64_t)decoded[i-3]; \
  16228. + break; \
  16229. + case 4: \
  16230. + for (int i = pred_order; i < blocksize; i++) \
  16231. + decoded[i] = (int64_t)residual[i] + 4*(int64_t)decoded[i-1] - 6*(int64_t)decoded[i-2] + 4*(int64_t)decoded[i-3] - (int64_t)decoded[i-4]; \
  16232. + break; \
  16233. + default: \
  16234. + av_log(s->avctx, AV_LOG_ERROR, "illegal pred order %d\n", pred_order); \
  16235. + return AVERROR_INVALIDDATA; \
  16236. + } \
  16237. + return 0; \
  16238. +}
  16239. +
  16240. +static int decode_subframe_fixed_wide(FLACContext *s, int32_t *decoded,
  16241. + int pred_order, int bps)
  16242. +{
  16243. + /* warm up samples */
  16244. + for (int i = 0; i < pred_order; i++) {
  16245. + decoded[i] = get_sbits_long(&s->gb, bps);
  16246. + }
  16247. + DECODER_SUBFRAME_FIXED_WIDE(decoded);
  16248. +}
  16249. +
  16250. +
  16251. +static int decode_subframe_fixed_33bps(FLACContext *s, int64_t *decoded,
  16252. + int32_t *residual, int pred_order)
  16253. +{
  16254. + /* warm up samples */ \
  16255. + for (int i = 0; i < pred_order; i++) { \
  16256. + decoded[i] = get_sbits64(&s->gb, 33); \
  16257. + } \
  16258. + DECODER_SUBFRAME_FIXED_WIDE(residual);
  16259. +}
  16260. +
  16261. static void lpc_analyze_remodulate(SUINT32 *decoded, const int coeffs[32],
  16262. int order, int qlevel, int len, int bps)
  16263. {
  16264. @@ -402,12 +479,53 @@ static int decode_subframe_lpc(FLACContext *s, int32_t *decoded, int pred_order,
  16265. return 0;
  16266. }
  16267. +static int decode_subframe_lpc_33bps(FLACContext *s, int64_t *decoded,
  16268. + int32_t *residual, int pred_order)
  16269. +{
  16270. + int i, j, ret;
  16271. + int coeff_prec, qlevel;
  16272. + int coeffs[32];
  16273. +
  16274. + /* warm up samples */
  16275. + for (i = 0; i < pred_order; i++) {
  16276. + decoded[i] = get_sbits64(&s->gb, 33);
  16277. + }
  16278. +
  16279. + coeff_prec = get_bits(&s->gb, 4) + 1;
  16280. + if (coeff_prec == 16) {
  16281. + av_log(s->avctx, AV_LOG_ERROR, "invalid coeff precision\n");
  16282. + return AVERROR_INVALIDDATA;
  16283. + }
  16284. + qlevel = get_sbits(&s->gb, 5);
  16285. + if (qlevel < 0) {
  16286. + av_log(s->avctx, AV_LOG_ERROR, "qlevel %d not supported, maybe buggy stream\n",
  16287. + qlevel);
  16288. + return AVERROR_INVALIDDATA;
  16289. + }
  16290. +
  16291. + for (i = 0; i < pred_order; i++) {
  16292. + coeffs[pred_order - i - 1] = get_sbits(&s->gb, coeff_prec);
  16293. + }
  16294. +
  16295. + if ((ret = decode_residuals(s, residual, pred_order)) < 0)
  16296. + return ret;
  16297. +
  16298. + for (i = pred_order; i < s->blocksize; i++, decoded++) {
  16299. + int64_t sum = 0;
  16300. + for (j = 0; j < pred_order; j++)
  16301. + sum += (int64_t)coeffs[j] * decoded[j];
  16302. + decoded[j] = residual[i] + (sum >> qlevel);
  16303. + }
  16304. +
  16305. + return 0;
  16306. +}
  16307. +
  16308. static inline int decode_subframe(FLACContext *s, int channel)
  16309. {
  16310. int32_t *decoded = s->decoded[channel];
  16311. int type, wasted = 0;
  16312. int bps = s->stream_info.bps;
  16313. - int i, tmp, ret;
  16314. + int i, ret;
  16315. if (channel == 0) {
  16316. if (s->ch_mode == FLAC_CHMODE_RIGHT_SIDE)
  16317. @@ -427,7 +545,7 @@ static inline int decode_subframe(FLACContext *s, int channel)
  16318. int left = get_bits_left(&s->gb);
  16319. if ( left <= 0 ||
  16320. (left < bps && !show_bits_long(&s->gb, left)) ||
  16321. - !show_bits_long(&s->gb, bps)) {
  16322. + !show_bits_long(&s->gb, bps-1)) {
  16323. av_log(s->avctx, AV_LOG_ERROR,
  16324. "Invalid number of wasted bits > available bits (%d) - left=%d\n",
  16325. bps, left);
  16326. @@ -436,34 +554,63 @@ static inline int decode_subframe(FLACContext *s, int channel)
  16327. wasted = 1 + get_unary(&s->gb, 1, get_bits_left(&s->gb));
  16328. bps -= wasted;
  16329. }
  16330. - if (bps > 32) {
  16331. - avpriv_report_missing_feature(s->avctx, "Decorrelated bit depth > 32");
  16332. - return AVERROR_PATCHWELCOME;
  16333. - }
  16334. //FIXME use av_log2 for types
  16335. if (type == 0) {
  16336. - tmp = get_sbits_long(&s->gb, bps);
  16337. - for (i = 0; i < s->blocksize; i++)
  16338. - decoded[i] = tmp;
  16339. + if (bps < 33) {
  16340. + int32_t tmp = get_sbits_long(&s->gb, bps);
  16341. + for (i = 0; i < s->blocksize; i++)
  16342. + decoded[i] = tmp;
  16343. + } else {
  16344. + int64_t tmp = get_sbits64(&s->gb, 33);
  16345. + for (i = 0; i < s->blocksize; i++)
  16346. + s->decoded_33bps[i] = tmp;
  16347. + }
  16348. } else if (type == 1) {
  16349. - for (i = 0; i < s->blocksize; i++)
  16350. - decoded[i] = get_sbits_long(&s->gb, bps);
  16351. + if (bps < 33) {
  16352. + for (i = 0; i < s->blocksize; i++)
  16353. + decoded[i] = get_sbits_long(&s->gb, bps);
  16354. + } else {
  16355. + for (i = 0; i < s->blocksize; i++)
  16356. + s->decoded_33bps[i] = get_sbits64(&s->gb, 33);
  16357. + }
  16358. } else if ((type >= 8) && (type <= 12)) {
  16359. - if ((ret = decode_subframe_fixed(s, decoded, type & ~0x8, bps)) < 0)
  16360. - return ret;
  16361. + int order = type & ~0x8;
  16362. + if (bps < 33) {
  16363. + if (bps + order <= 32) {
  16364. + if ((ret = decode_subframe_fixed(s, decoded, order, bps)) < 0)
  16365. + return ret;
  16366. + } else {
  16367. + if ((ret = decode_subframe_fixed_wide(s, decoded, order, bps)) < 0)
  16368. + return ret;
  16369. + }
  16370. + } else {
  16371. + if ((ret = decode_subframe_fixed_33bps(s, s->decoded_33bps, decoded, order)) < 0)
  16372. + return ret;
  16373. + }
  16374. } else if (type >= 32) {
  16375. - if ((ret = decode_subframe_lpc(s, decoded, (type & ~0x20)+1, bps)) < 0)
  16376. - return ret;
  16377. + if (bps < 33) {
  16378. + if ((ret = decode_subframe_lpc(s, decoded, (type & ~0x20)+1, bps)) < 0)
  16379. + return ret;
  16380. + } else {
  16381. + if ((ret = decode_subframe_lpc_33bps(s, s->decoded_33bps, decoded, (type & ~0x20)+1)) < 0)
  16382. + return ret;
  16383. + }
  16384. } else {
  16385. av_log(s->avctx, AV_LOG_ERROR, "invalid coding type\n");
  16386. return AVERROR_INVALIDDATA;
  16387. }
  16388. - if (wasted && wasted < 32) {
  16389. - int i;
  16390. - for (i = 0; i < s->blocksize; i++)
  16391. - decoded[i] = (unsigned)decoded[i] << wasted;
  16392. + if (wasted) {
  16393. + if (wasted+bps == 33) {
  16394. + int i;
  16395. + for (i = 0; i < s->blocksize; i++)
  16396. + s->decoded_33bps[i] = (uint64_t)decoded[i] << wasted;
  16397. + } else if (wasted < 32) {
  16398. + int i;
  16399. + for (i = 0; i < s->blocksize; i++)
  16400. + decoded[i] = (unsigned)decoded[i] << wasted;
  16401. + }
  16402. }
  16403. return 0;
  16404. @@ -554,6 +701,26 @@ static int decode_frame(FLACContext *s)
  16405. return 0;
  16406. }
  16407. +static void decorrelate_33bps(int ch_mode, int32_t **decoded, int64_t *decoded_33bps, int len)
  16408. +{
  16409. + int i;
  16410. + if (ch_mode == FLAC_CHMODE_LEFT_SIDE ) {
  16411. + for (i = 0; i < len; i++)
  16412. + decoded[1][i] = decoded[0][i] - decoded_33bps[i];
  16413. + } else if (ch_mode == FLAC_CHMODE_RIGHT_SIDE ) {
  16414. + for (i = 0; i < len; i++)
  16415. + decoded[0][i] = decoded[1][i] + decoded_33bps[i];
  16416. + } else if (ch_mode == FLAC_CHMODE_MID_SIDE ) {
  16417. + for (i = 0; i < len; i++) {
  16418. + uint64_t a = decoded[0][i];
  16419. + int64_t b = decoded_33bps[i];
  16420. + a -= b >> 1;
  16421. + decoded[0][i] = (a + b);
  16422. + decoded[1][i] = a;
  16423. + }
  16424. + }
  16425. +}
  16426. +
  16427. static int flac_decode_frame(AVCodecContext *avctx, AVFrame *frame,
  16428. int *got_frame_ptr, AVPacket *avpkt)
  16429. {
  16430. @@ -612,9 +779,15 @@ static int flac_decode_frame(AVCodecContext *avctx, AVFrame *frame,
  16431. if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0)
  16432. return ret;
  16433. - s->dsp.decorrelate[s->ch_mode](frame->data, s->decoded,
  16434. - s->stream_info.channels,
  16435. - s->blocksize, s->sample_shift);
  16436. + if (s->stream_info.bps == 32 && s->ch_mode > 0) {
  16437. + decorrelate_33bps(s->ch_mode, s->decoded, s->decoded_33bps, s->blocksize);
  16438. + s->dsp.decorrelate[0](frame->data, s->decoded, s->stream_info.channels,
  16439. + s->blocksize, s->sample_shift);
  16440. + } else {
  16441. + s->dsp.decorrelate[s->ch_mode](frame->data, s->decoded,
  16442. + s->stream_info.channels,
  16443. + s->blocksize, s->sample_shift);
  16444. + }
  16445. if (bytes_read > buf_size) {
  16446. av_log(s->avctx, AV_LOG_ERROR, "overread: %d\n", bytes_read - buf_size);
  16447. @@ -635,6 +808,7 @@ static av_cold int flac_decode_close(AVCodecContext *avctx)
  16448. FLACContext *s = avctx->priv_data;
  16449. av_freep(&s->decoded_buffer);
  16450. + av_freep(&s->decoded_buffer_33bps);
  16451. return 0;
  16452. }
  16453. diff --git a/media/ffvpx/libavcodec/get_bits.h b/media/ffvpx/libavcodec/get_bits.h
  16454. index 992765dc..65dc080d 100644
  16455. --- a/media/ffvpx/libavcodec/get_bits.h
  16456. +++ b/media/ffvpx/libavcodec/get_bits.h
  16457. @@ -1,6 +1,5 @@
  16458. /*
  16459. * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at>
  16460. - * Copyright (c) 2016 Alexandra Hájková
  16461. *
  16462. * This file is part of FFmpeg.
  16463. *
  16464. @@ -58,12 +57,55 @@
  16465. #define CACHED_BITSTREAM_READER 0
  16466. #endif
  16467. -typedef struct GetBitContext {
  16468. - const uint8_t *buffer, *buffer_end;
  16469. #if CACHED_BITSTREAM_READER
  16470. - uint64_t cache;
  16471. - unsigned bits_left;
  16472. +
  16473. +// we always want the LE implementation, to provide get_bits_le()
  16474. +#define BITSTREAM_LE
  16475. +
  16476. +#ifndef BITSTREAM_READER_LE
  16477. +# define BITSTREAM_BE
  16478. +# define BITSTREAM_DEFAULT_BE
  16479. #endif
  16480. +
  16481. +#include "bitstream.h"
  16482. +
  16483. +#undef BITSTREAM_LE
  16484. +#undef BITSTREAM_BE
  16485. +#undef BITSTREAM_DEFAULT_BE
  16486. +
  16487. +typedef BitstreamContext GetBitContext;
  16488. +
  16489. +#define get_bits_count bits_tell
  16490. +#define get_bits_left bits_left
  16491. +#define skip_bits_long bits_skip
  16492. +#define skip_bits bits_skip
  16493. +#define get_bits bits_read_nz
  16494. +#define get_bitsz bits_read
  16495. +#define get_bits_long bits_read
  16496. +#define get_bits1 bits_read_bit
  16497. +#define get_bits64 bits_read_64
  16498. +#define get_xbits bits_read_xbits
  16499. +#define get_sbits bits_read_signed_nz
  16500. +#define get_sbits_long bits_read_signed
  16501. +#define show_bits bits_peek
  16502. +#define show_bits_long bits_peek
  16503. +#define init_get_bits bits_init
  16504. +#define init_get_bits8 bits_init8
  16505. +#define align_get_bits bits_align
  16506. +#define get_vlc2 bits_read_vlc
  16507. +
  16508. +#define init_get_bits8_le(s, buffer, byte_size) bits_init8_le((BitstreamContextLE*)s, buffer, byte_size)
  16509. +#define get_bits_le(s, n) bits_read_le((BitstreamContextLE*)s, n)
  16510. +
  16511. +#define show_bits1(s) bits_peek(s, 1)
  16512. +#define skip_bits1(s) bits_skip(s, 1)
  16513. +
  16514. +#define skip_1stop_8data_bits bits_skip_1stop_8data
  16515. +
  16516. +#else // CACHED_BITSTREAM_READER
  16517. +
  16518. +typedef struct GetBitContext {
  16519. + const uint8_t *buffer, *buffer_end;
  16520. int index;
  16521. int size_in_bits;
  16522. int size_in_bits_plus8;
  16523. @@ -120,16 +162,12 @@ static inline unsigned int show_bits(GetBitContext *s, int n);
  16524. * For examples see get_bits, show_bits, skip_bits, get_vlc.
  16525. */
  16526. -#if CACHED_BITSTREAM_READER
  16527. -# define MIN_CACHE_BITS 64
  16528. -#elif defined LONG_BITSTREAM_READER
  16529. +#if defined LONG_BITSTREAM_READER
  16530. # define MIN_CACHE_BITS 32
  16531. #else
  16532. # define MIN_CACHE_BITS 25
  16533. #endif
  16534. -#if !CACHED_BITSTREAM_READER
  16535. -
  16536. #define OPEN_READER_NOSIZE(name, gb) \
  16537. unsigned int name ## _index = (gb)->index; \
  16538. unsigned int av_unused name ## _cache
  16539. @@ -214,73 +252,12 @@ static inline unsigned int show_bits(GetBitContext *s, int n);
  16540. #define GET_CACHE(name, gb) ((uint32_t) name ## _cache)
  16541. -#endif
  16542. static inline int get_bits_count(const GetBitContext *s)
  16543. {
  16544. -#if CACHED_BITSTREAM_READER
  16545. - return s->index - s->bits_left;
  16546. -#else
  16547. return s->index;
  16548. -#endif
  16549. -}
  16550. -
  16551. -#if CACHED_BITSTREAM_READER
  16552. -static inline void refill_32(GetBitContext *s, int is_le)
  16553. -{
  16554. -#if !UNCHECKED_BITSTREAM_READER
  16555. - if (s->index >> 3 >= s->buffer_end - s->buffer)
  16556. - return;
  16557. -#endif
  16558. -
  16559. - if (is_le)
  16560. - s->cache = (uint64_t)AV_RL32(s->buffer + (s->index >> 3)) << s->bits_left | s->cache;
  16561. - else
  16562. - s->cache = s->cache | (uint64_t)AV_RB32(s->buffer + (s->index >> 3)) << (32 - s->bits_left);
  16563. - s->index += 32;
  16564. - s->bits_left += 32;
  16565. -}
  16566. -
  16567. -static inline void refill_64(GetBitContext *s, int is_le)
  16568. -{
  16569. -#if !UNCHECKED_BITSTREAM_READER
  16570. - if (s->index >> 3 >= s->buffer_end - s->buffer)
  16571. - return;
  16572. -#endif
  16573. -
  16574. - if (is_le)
  16575. - s->cache = AV_RL64(s->buffer + (s->index >> 3));
  16576. - else
  16577. - s->cache = AV_RB64(s->buffer + (s->index >> 3));
  16578. - s->index += 64;
  16579. - s->bits_left = 64;
  16580. -}
  16581. -
  16582. -static inline uint64_t get_val(GetBitContext *s, unsigned n, int is_le)
  16583. -{
  16584. - uint64_t ret;
  16585. - av_assert2(n>0 && n<=63);
  16586. - if (is_le) {
  16587. - ret = s->cache & ((UINT64_C(1) << n) - 1);
  16588. - s->cache >>= n;
  16589. - } else {
  16590. - ret = s->cache >> (64 - n);
  16591. - s->cache <<= n;
  16592. - }
  16593. - s->bits_left -= n;
  16594. - return ret;
  16595. }
  16596. -static inline unsigned show_val(const GetBitContext *s, unsigned n)
  16597. -{
  16598. -#ifdef BITSTREAM_READER_LE
  16599. - return s->cache & ((UINT64_C(1) << n) - 1);
  16600. -#else
  16601. - return s->cache >> (64 - n);
  16602. -#endif
  16603. -}
  16604. -#endif
  16605. -
  16606. /**
  16607. * Skips the specified number of bits.
  16608. * @param n the number of bits to skip,
  16609. @@ -290,29 +267,13 @@ static inline unsigned show_val(const GetBitContext *s, unsigned n)
  16610. */
  16611. static inline void skip_bits_long(GetBitContext *s, int n)
  16612. {
  16613. -#if CACHED_BITSTREAM_READER
  16614. - skip_bits(s, n);
  16615. -#else
  16616. #if UNCHECKED_BITSTREAM_READER
  16617. s->index += n;
  16618. #else
  16619. s->index += av_clip(n, -s->index, s->size_in_bits_plus8 - s->index);
  16620. #endif
  16621. -#endif
  16622. }
  16623. -#if CACHED_BITSTREAM_READER
  16624. -static inline void skip_remaining(GetBitContext *s, unsigned n)
  16625. -{
  16626. -#ifdef BITSTREAM_READER_LE
  16627. - s->cache >>= n;
  16628. -#else
  16629. - s->cache <<= n;
  16630. -#endif
  16631. - s->bits_left -= n;
  16632. -}
  16633. -#endif
  16634. -
  16635. /**
  16636. * Read MPEG-1 dc-style VLC (sign bit + mantissa with no MSB).
  16637. * if MSB not set it is negative
  16638. @@ -320,13 +281,6 @@ static inline void skip_remaining(GetBitContext *s, unsigned n)
  16639. */
  16640. static inline int get_xbits(GetBitContext *s, int n)
  16641. {
  16642. -#if CACHED_BITSTREAM_READER
  16643. - int32_t cache = show_bits(s, 32);
  16644. - int sign = ~cache >> 31;
  16645. - skip_remaining(s, n);
  16646. -
  16647. - return ((((uint32_t)(sign ^ cache)) >> (32 - n)) ^ sign) - sign;
  16648. -#else
  16649. register int sign;
  16650. register int32_t cache;
  16651. OPEN_READER(re, s);
  16652. @@ -337,10 +291,8 @@ static inline int get_xbits(GetBitContext *s, int n)
  16653. LAST_SKIP_BITS(re, s, n);
  16654. CLOSE_READER(re, s);
  16655. return (NEG_USR32(sign ^ cache, n) ^ sign) - sign;
  16656. -#endif
  16657. }
  16658. -#if !CACHED_BITSTREAM_READER
  16659. static inline int get_xbits_le(GetBitContext *s, int n)
  16660. {
  16661. register int sign;
  16662. @@ -354,22 +306,16 @@ static inline int get_xbits_le(GetBitContext *s, int n)
  16663. CLOSE_READER(re, s);
  16664. return (zero_extend(sign ^ cache, n) ^ sign) - sign;
  16665. }
  16666. -#endif
  16667. static inline int get_sbits(GetBitContext *s, int n)
  16668. {
  16669. register int tmp;
  16670. -#if CACHED_BITSTREAM_READER
  16671. - av_assert2(n>0 && n<=25);
  16672. - tmp = sign_extend(get_bits(s, n), n);
  16673. -#else
  16674. OPEN_READER(re, s);
  16675. av_assert2(n>0 && n<=25);
  16676. UPDATE_CACHE(re, s);
  16677. tmp = SHOW_SBITS(re, s, n);
  16678. LAST_SKIP_BITS(re, s, n);
  16679. CLOSE_READER(re, s);
  16680. -#endif
  16681. return tmp;
  16682. }
  16683. @@ -379,32 +325,12 @@ static inline int get_sbits(GetBitContext *s, int n)
  16684. static inline unsigned int get_bits(GetBitContext *s, int n)
  16685. {
  16686. register unsigned int tmp;
  16687. -#if CACHED_BITSTREAM_READER
  16688. -
  16689. - av_assert2(n>0 && n<=32);
  16690. - if (n > s->bits_left) {
  16691. -#ifdef BITSTREAM_READER_LE
  16692. - refill_32(s, 1);
  16693. -#else
  16694. - refill_32(s, 0);
  16695. -#endif
  16696. - if (s->bits_left < 32)
  16697. - s->bits_left = n;
  16698. - }
  16699. -
  16700. -#ifdef BITSTREAM_READER_LE
  16701. - tmp = get_val(s, n, 1);
  16702. -#else
  16703. - tmp = get_val(s, n, 0);
  16704. -#endif
  16705. -#else
  16706. OPEN_READER(re, s);
  16707. av_assert2(n>0 && n<=25);
  16708. UPDATE_CACHE(re, s);
  16709. tmp = SHOW_UBITS(re, s, n);
  16710. LAST_SKIP_BITS(re, s, n);
  16711. CLOSE_READER(re, s);
  16712. -#endif
  16713. av_assert2(tmp < UINT64_C(1) << n);
  16714. return tmp;
  16715. }
  16716. @@ -419,16 +345,6 @@ static av_always_inline int get_bitsz(GetBitContext *s, int n)
  16717. static inline unsigned int get_bits_le(GetBitContext *s, int n)
  16718. {
  16719. -#if CACHED_BITSTREAM_READER
  16720. - av_assert2(n>0 && n<=32);
  16721. - if (n > s->bits_left) {
  16722. - refill_32(s, 1);
  16723. - if (s->bits_left < 32)
  16724. - s->bits_left = n;
  16725. - }
  16726. -
  16727. - return get_val(s, n, 1);
  16728. -#else
  16729. register int tmp;
  16730. OPEN_READER(re, s);
  16731. av_assert2(n>0 && n<=25);
  16732. @@ -437,7 +353,6 @@ static inline unsigned int get_bits_le(GetBitContext *s, int n)
  16733. LAST_SKIP_BITS(re, s, n);
  16734. CLOSE_READER(re, s);
  16735. return tmp;
  16736. -#endif
  16737. }
  16738. /**
  16739. @@ -446,71 +361,22 @@ static inline unsigned int get_bits_le(GetBitContext *s, int n)
  16740. static inline unsigned int show_bits(GetBitContext *s, int n)
  16741. {
  16742. register unsigned int tmp;
  16743. -#if CACHED_BITSTREAM_READER
  16744. - if (n > s->bits_left)
  16745. -#ifdef BITSTREAM_READER_LE
  16746. - refill_32(s, 1);
  16747. -#else
  16748. - refill_32(s, 0);
  16749. -#endif
  16750. -
  16751. - tmp = show_val(s, n);
  16752. -#else
  16753. OPEN_READER_NOSIZE(re, s);
  16754. av_assert2(n>0 && n<=25);
  16755. UPDATE_CACHE(re, s);
  16756. tmp = SHOW_UBITS(re, s, n);
  16757. -#endif
  16758. return tmp;
  16759. }
  16760. static inline void skip_bits(GetBitContext *s, int n)
  16761. {
  16762. -#if CACHED_BITSTREAM_READER
  16763. - if (n < s->bits_left)
  16764. - skip_remaining(s, n);
  16765. - else {
  16766. - n -= s->bits_left;
  16767. - s->cache = 0;
  16768. - s->bits_left = 0;
  16769. -
  16770. - if (n >= 64) {
  16771. - unsigned skip = (n / 8) * 8;
  16772. -
  16773. - n -= skip;
  16774. - s->index += skip;
  16775. - }
  16776. -#ifdef BITSTREAM_READER_LE
  16777. - refill_64(s, 1);
  16778. -#else
  16779. - refill_64(s, 0);
  16780. -#endif
  16781. - if (n)
  16782. - skip_remaining(s, n);
  16783. - }
  16784. -#else
  16785. OPEN_READER(re, s);
  16786. LAST_SKIP_BITS(re, s, n);
  16787. CLOSE_READER(re, s);
  16788. -#endif
  16789. }
  16790. static inline unsigned int get_bits1(GetBitContext *s)
  16791. {
  16792. -#if CACHED_BITSTREAM_READER
  16793. - if (!s->bits_left)
  16794. -#ifdef BITSTREAM_READER_LE
  16795. - refill_64(s, 1);
  16796. -#else
  16797. - refill_64(s, 0);
  16798. -#endif
  16799. -
  16800. -#ifdef BITSTREAM_READER_LE
  16801. - return get_val(s, 1, 1);
  16802. -#else
  16803. - return get_val(s, 1, 0);
  16804. -#endif
  16805. -#else
  16806. unsigned int index = s->index;
  16807. uint8_t result = s->buffer[index >> 3];
  16808. #ifdef BITSTREAM_READER_LE
  16809. @@ -527,7 +393,6 @@ static inline unsigned int get_bits1(GetBitContext *s)
  16810. s->index = index;
  16811. return result;
  16812. -#endif
  16813. }
  16814. static inline unsigned int show_bits1(GetBitContext *s)
  16815. @@ -548,10 +413,6 @@ static inline unsigned int get_bits_long(GetBitContext *s, int n)
  16816. av_assert2(n>=0 && n<=32);
  16817. if (!n) {
  16818. return 0;
  16819. -#if CACHED_BITSTREAM_READER
  16820. - }
  16821. - return get_bits(s, n);
  16822. -#else
  16823. } else if (n <= MIN_CACHE_BITS) {
  16824. return get_bits(s, n);
  16825. } else {
  16826. @@ -563,7 +424,6 @@ static inline unsigned int get_bits_long(GetBitContext *s, int n)
  16827. return ret | get_bits(s, n - 16);
  16828. #endif
  16829. }
  16830. -#endif
  16831. }
  16832. /**
  16833. @@ -596,6 +456,18 @@ static inline int get_sbits_long(GetBitContext *s, int n)
  16834. return sign_extend(get_bits_long(s, n), n);
  16835. }
  16836. +/**
  16837. + * Read 0-64 bits as a signed integer.
  16838. + */
  16839. +static inline int64_t get_sbits64(GetBitContext *s, int n)
  16840. +{
  16841. + // sign_extend(x, 0) is undefined
  16842. + if (!n)
  16843. + return 0;
  16844. +
  16845. + return sign_extend64(get_bits64(s, n), n);
  16846. +}
  16847. +
  16848. /**
  16849. * Show 0-32 bits.
  16850. */
  16851. @@ -609,8 +481,17 @@ static inline unsigned int show_bits_long(GetBitContext *s, int n)
  16852. }
  16853. }
  16854. -static inline int init_get_bits_xe(GetBitContext *s, const uint8_t *buffer,
  16855. - int bit_size, int is_le)
  16856. +
  16857. +/**
  16858. + * Initialize GetBitContext.
  16859. + * @param buffer bitstream buffer, must be AV_INPUT_BUFFER_PADDING_SIZE bytes
  16860. + * larger than the actual read bits because some optimized bitstream
  16861. + * readers read 32 or 64 bit at once and could read over the end
  16862. + * @param bit_size the size of the buffer in bits
  16863. + * @return 0 on success, AVERROR_INVALIDDATA if the buffer_size would overflow.
  16864. + */
  16865. +static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer,
  16866. + int bit_size)
  16867. {
  16868. int buffer_size;
  16869. int ret = 0;
  16870. @@ -629,33 +510,9 @@ static inline int init_get_bits_xe(GetBitContext *s, const uint8_t *buffer,
  16871. s->buffer_end = buffer + buffer_size;
  16872. s->index = 0;
  16873. -#if CACHED_BITSTREAM_READER
  16874. - s->cache = 0;
  16875. - s->bits_left = 0;
  16876. - refill_64(s, is_le);
  16877. -#endif
  16878. -
  16879. return ret;
  16880. }
  16881. -/**
  16882. - * Initialize GetBitContext.
  16883. - * @param buffer bitstream buffer, must be AV_INPUT_BUFFER_PADDING_SIZE bytes
  16884. - * larger than the actual read bits because some optimized bitstream
  16885. - * readers read 32 or 64 bit at once and could read over the end
  16886. - * @param bit_size the size of the buffer in bits
  16887. - * @return 0 on success, AVERROR_INVALIDDATA if the buffer_size would overflow.
  16888. - */
  16889. -static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer,
  16890. - int bit_size)
  16891. -{
  16892. -#ifdef BITSTREAM_READER_LE
  16893. - return init_get_bits_xe(s, buffer, bit_size, 1);
  16894. -#else
  16895. - return init_get_bits_xe(s, buffer, bit_size, 0);
  16896. -#endif
  16897. -}
  16898. -
  16899. /**
  16900. * Initialize GetBitContext.
  16901. * @param buffer bitstream buffer, must be AV_INPUT_BUFFER_PADDING_SIZE bytes
  16902. @@ -677,7 +534,7 @@ static inline int init_get_bits8_le(GetBitContext *s, const uint8_t *buffer,
  16903. {
  16904. if (byte_size > INT_MAX / 8 || byte_size < 0)
  16905. byte_size = -1;
  16906. - return init_get_bits_xe(s, buffer, byte_size * 8, 1);
  16907. + return init_get_bits(s, buffer, byte_size * 8);
  16908. }
  16909. static inline const uint8_t *align_get_bits(GetBitContext *s)
  16910. @@ -762,19 +619,6 @@ static inline const uint8_t *align_get_bits(GetBitContext *s)
  16911. SKIP_BITS(name, gb, n); \
  16912. } while (0)
  16913. -/* Return the LUT element for the given bitstream configuration. */
  16914. -static inline int set_idx(GetBitContext *s, int code, int *n, int *nb_bits,
  16915. - const VLCElem *table)
  16916. -{
  16917. - unsigned idx;
  16918. -
  16919. - *nb_bits = -*n;
  16920. - idx = show_bits(s, *nb_bits) + code;
  16921. - *n = table[idx].len;
  16922. -
  16923. - return table[idx].sym;
  16924. -}
  16925. -
  16926. /**
  16927. * Parse a vlc code.
  16928. * @param bits is the number of bits which will be read at once, must be
  16929. @@ -787,24 +631,6 @@ static inline int set_idx(GetBitContext *s, int code, int *n, int *nb_bits,
  16930. static av_always_inline int get_vlc2(GetBitContext *s, const VLCElem *table,
  16931. int bits, int max_depth)
  16932. {
  16933. -#if CACHED_BITSTREAM_READER
  16934. - int nb_bits;
  16935. - unsigned idx = show_bits(s, bits);
  16936. - int code = table[idx].sym;
  16937. - int n = table[idx].len;
  16938. -
  16939. - if (max_depth > 1 && n < 0) {
  16940. - skip_remaining(s, bits);
  16941. - code = set_idx(s, code, &n, &nb_bits, table);
  16942. - if (max_depth > 2 && n < 0) {
  16943. - skip_remaining(s, nb_bits);
  16944. - code = set_idx(s, code, &n, &nb_bits, table);
  16945. - }
  16946. - }
  16947. - skip_remaining(s, n);
  16948. -
  16949. - return code;
  16950. -#else
  16951. int code;
  16952. OPEN_READER(re, s);
  16953. @@ -815,7 +641,6 @@ static av_always_inline int get_vlc2(GetBitContext *s, const VLCElem *table,
  16954. CLOSE_READER(re, s);
  16955. return code;
  16956. -#endif
  16957. }
  16958. static inline int decode012(GetBitContext *gb)
  16959. @@ -855,4 +680,6 @@ static inline int skip_1stop_8data_bits(GetBitContext *gb)
  16960. return 0;
  16961. }
  16962. +#endif // CACHED_BITSTREAM_READER
  16963. +
  16964. #endif /* AVCODEC_GET_BITS_H */
  16965. diff --git a/media/ffvpx/libavcodec/internal.h b/media/ffvpx/libavcodec/internal.h
  16966. index 76a6ea6b..a283c52e 100644
  16967. --- a/media/ffvpx/libavcodec/internal.h
  16968. +++ b/media/ffvpx/libavcodec/internal.h
  16969. @@ -88,7 +88,6 @@ typedef struct AVCodecInternal {
  16970. * for decoding.
  16971. */
  16972. AVPacket *last_pkt_props;
  16973. - struct AVFifo *pkt_props;
  16974. /**
  16975. * temporary buffer used for encoders to store their bitstream
  16976. diff --git a/media/ffvpx/libavcodec/libdav1d.c b/media/ffvpx/libavcodec/libdav1d.c
  16977. index 02892940..2488a709 100644
  16978. --- a/media/ffvpx/libavcodec/libdav1d.c
  16979. +++ b/media/ffvpx/libavcodec/libdav1d.c
  16980. @@ -41,9 +41,6 @@
  16981. typedef struct Libdav1dContext {
  16982. AVClass *class;
  16983. Dav1dContext *c;
  16984. - /* This packet coincides with AVCodecInternal.in_pkt
  16985. - * and is not owned by us. */
  16986. - AVPacket *pkt;
  16987. AVBufferPool *pool;
  16988. int pool_size;
  16989. @@ -219,8 +216,6 @@ static av_cold int libdav1d_init(AVCodecContext *c)
  16990. #endif
  16991. int res;
  16992. - dav1d->pkt = c->internal->in_pkt;
  16993. -
  16994. av_log(c, AV_LOG_INFO, "libdav1d %s\n", dav1d_version());
  16995. dav1d_default_settings(&s);
  16996. @@ -265,6 +260,15 @@ static av_cold int libdav1d_init(AVCodecContext *c)
  16997. s.n_frame_threads, s.n_tile_threads);
  16998. #endif
  16999. +#if FF_DAV1D_VERSION_AT_LEAST(6,8)
  17000. + if (c->skip_frame >= AVDISCARD_NONKEY)
  17001. + s.decode_frame_type = DAV1D_DECODEFRAMETYPE_KEY;
  17002. + else if (c->skip_frame >= AVDISCARD_NONINTRA)
  17003. + s.decode_frame_type = DAV1D_DECODEFRAMETYPE_INTRA;
  17004. + else if (c->skip_frame >= AVDISCARD_NONREF)
  17005. + s.decode_frame_type = DAV1D_DECODEFRAMETYPE_REFERENCE;
  17006. +#endif
  17007. +
  17008. res = libdav1d_parse_extradata(c);
  17009. if (res < 0)
  17010. return res;
  17011. @@ -284,6 +288,13 @@ static void libdav1d_flush(AVCodecContext *c)
  17012. dav1d_flush(dav1d->c);
  17013. }
  17014. +typedef struct OpaqueData {
  17015. + void *pkt_orig_opaque;
  17016. +#if FF_API_REORDERED_OPAQUE
  17017. + int64_t reordered_opaque;
  17018. +#endif
  17019. +} OpaqueData;
  17020. +
  17021. static void libdav1d_data_free(const uint8_t *data, void *opaque) {
  17022. AVBufferRef *buf = opaque;
  17023. @@ -291,8 +302,10 @@ static void libdav1d_data_free(const uint8_t *data, void *opaque) {
  17024. }
  17025. static void libdav1d_user_data_free(const uint8_t *data, void *opaque) {
  17026. + AVPacket *pkt = opaque;
  17027. av_assert0(data == opaque);
  17028. - av_free(opaque);
  17029. + av_free(pkt->opaque);
  17030. + av_packet_free(&pkt);
  17031. }
  17032. static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
  17033. @@ -300,52 +313,68 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
  17034. Libdav1dContext *dav1d = c->priv_data;
  17035. Dav1dData *data = &dav1d->data;
  17036. Dav1dPicture pic = { 0 }, *p = &pic;
  17037. + AVPacket *pkt;
  17038. + OpaqueData *od = NULL;
  17039. #if FF_DAV1D_VERSION_AT_LEAST(5,1)
  17040. enum Dav1dEventFlags event_flags = 0;
  17041. #endif
  17042. int res;
  17043. if (!data->sz) {
  17044. - AVPacket *const pkt = dav1d->pkt;
  17045. + pkt = av_packet_alloc();
  17046. +
  17047. + if (!pkt)
  17048. + return AVERROR(ENOMEM);
  17049. res = ff_decode_get_packet(c, pkt);
  17050. - if (res < 0 && res != AVERROR_EOF)
  17051. + if (res < 0 && res != AVERROR_EOF) {
  17052. + av_packet_free(&pkt);
  17053. return res;
  17054. + }
  17055. if (pkt->size) {
  17056. res = dav1d_data_wrap(data, pkt->data, pkt->size,
  17057. libdav1d_data_free, pkt->buf);
  17058. if (res < 0) {
  17059. - av_packet_unref(pkt);
  17060. + av_packet_free(&pkt);
  17061. return res;
  17062. }
  17063. - data->m.timestamp = pkt->pts;
  17064. - data->m.offset = pkt->pos;
  17065. - data->m.duration = pkt->duration;
  17066. -
  17067. pkt->buf = NULL;
  17068. - av_packet_unref(pkt);
  17069. - if (c->reordered_opaque != AV_NOPTS_VALUE) {
  17070. - uint8_t *reordered_opaque = av_memdup(&c->reordered_opaque,
  17071. - sizeof(c->reordered_opaque));
  17072. - if (!reordered_opaque) {
  17073. +FF_DISABLE_DEPRECATION_WARNINGS
  17074. + if (
  17075. +#if FF_API_REORDERED_OPAQUE
  17076. + c->reordered_opaque != AV_NOPTS_VALUE ||
  17077. +#endif
  17078. + (pkt->opaque && (c->flags & AV_CODEC_FLAG_COPY_OPAQUE))) {
  17079. + od = av_mallocz(sizeof(*od));
  17080. + if (!od) {
  17081. + av_packet_free(&pkt);
  17082. dav1d_data_unref(data);
  17083. return AVERROR(ENOMEM);
  17084. }
  17085. + od->pkt_orig_opaque = pkt->opaque;
  17086. +#if FF_API_REORDERED_OPAQUE
  17087. + od->reordered_opaque = c->reordered_opaque;
  17088. +#endif
  17089. +FF_ENABLE_DEPRECATION_WARNINGS
  17090. + }
  17091. + pkt->opaque = od;
  17092. - res = dav1d_data_wrap_user_data(data, reordered_opaque,
  17093. - libdav1d_user_data_free, reordered_opaque);
  17094. - if (res < 0) {
  17095. - av_free(reordered_opaque);
  17096. - dav1d_data_unref(data);
  17097. - return res;
  17098. - }
  17099. + res = dav1d_data_wrap_user_data(data, (const uint8_t *)pkt,
  17100. + libdav1d_user_data_free, pkt);
  17101. + if (res < 0) {
  17102. + av_free(pkt->opaque);
  17103. + av_packet_free(&pkt);
  17104. + dav1d_data_unref(data);
  17105. + return res;
  17106. }
  17107. - } else if (res >= 0) {
  17108. - av_packet_unref(pkt);
  17109. - return AVERROR(EAGAIN);
  17110. + pkt = NULL;
  17111. + } else {
  17112. + av_packet_free(&pkt);
  17113. + if (res >= 0)
  17114. + return AVERROR(EAGAIN);
  17115. }
  17116. }
  17117. @@ -410,17 +439,29 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
  17118. INT_MAX);
  17119. ff_set_sar(c, frame->sample_aspect_ratio);
  17120. - if (p->m.user_data.data)
  17121. - memcpy(&frame->reordered_opaque, p->m.user_data.data, sizeof(frame->reordered_opaque));
  17122. + pkt = (AVPacket *)p->m.user_data.data;
  17123. + od = pkt->opaque;
  17124. +#if FF_API_REORDERED_OPAQUE
  17125. +FF_DISABLE_DEPRECATION_WARNINGS
  17126. + if (od && od->reordered_opaque != AV_NOPTS_VALUE)
  17127. + frame->reordered_opaque = od->reordered_opaque;
  17128. else
  17129. frame->reordered_opaque = AV_NOPTS_VALUE;
  17130. +FF_ENABLE_DEPRECATION_WARNINGS
  17131. +#endif
  17132. +
  17133. + // restore the original user opaque value for
  17134. + // ff_decode_frame_props_from_pkt()
  17135. + pkt->opaque = od ? od->pkt_orig_opaque : NULL;
  17136. + av_freep(&od);
  17137. // match timestamps and packet size
  17138. - frame->pts = p->m.timestamp;
  17139. - frame->pkt_dts = p->m.timestamp;
  17140. - frame->pkt_pos = p->m.offset;
  17141. - frame->pkt_size = p->m.size;
  17142. - frame->duration = p->m.duration;
  17143. + res = ff_decode_frame_props_from_pkt(c, frame, pkt);
  17144. + pkt->opaque = NULL;
  17145. + if (res < 0)
  17146. + goto fail;
  17147. +
  17148. + frame->pkt_dts = pkt->pts;
  17149. frame->key_frame = p->frame_hdr->frame_type == DAV1D_FRAME_TYPE_KEY;
  17150. switch (p->frame_hdr->frame_type) {
  17151. @@ -594,7 +635,7 @@ const FFCodec ff_libdav1d_decoder = {
  17152. .flush = libdav1d_flush,
  17153. FF_CODEC_RECEIVE_FRAME_CB(libdav1d_receive_frame),
  17154. .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS,
  17155. - .caps_internal = FF_CODEC_CAP_SETS_PKT_DTS |
  17156. + .caps_internal = FF_CODEC_CAP_SETS_PKT_DTS | FF_CODEC_CAP_SETS_FRAME_PROPS |
  17157. FF_CODEC_CAP_AUTO_THREADS,
  17158. .p.priv_class = &libdav1d_class,
  17159. .p.wrapper_name = "libdav1d",
  17160. diff --git a/media/ffvpx/libavcodec/mathops.h b/media/ffvpx/libavcodec/mathops.h
  17161. index c89054d6..a1dc3233 100644
  17162. --- a/media/ffvpx/libavcodec/mathops.h
  17163. +++ b/media/ffvpx/libavcodec/mathops.h
  17164. @@ -138,6 +138,15 @@ static inline av_const int sign_extend(int val, unsigned bits)
  17165. }
  17166. #endif
  17167. +#ifndef sign_extend64
  17168. +static inline av_const int64_t sign_extend64(int64_t val, unsigned bits)
  17169. +{
  17170. + unsigned shift = 8 * sizeof(int64_t) - bits;
  17171. + union { uint64_t u; int64_t s; } v = { (uint64_t) val << shift };
  17172. + return v.s >> shift;
  17173. +}
  17174. +#endif
  17175. +
  17176. #ifndef zero_extend
  17177. static inline av_const unsigned zero_extend(unsigned val, unsigned bits)
  17178. {
  17179. diff --git a/media/ffvpx/libavcodec/motion_est.h b/media/ffvpx/libavcodec/motion_est.h
  17180. index b20cdabb..f6a563b0 100644
  17181. --- a/media/ffvpx/libavcodec/motion_est.h
  17182. +++ b/media/ffvpx/libavcodec/motion_est.h
  17183. @@ -52,7 +52,6 @@ typedef struct MotionEstContext {
  17184. uint8_t *scratchpad; /**< data area for the ME algo, so that
  17185. * the ME does not need to malloc/free. */
  17186. uint8_t *temp;
  17187. - int best_bits;
  17188. uint32_t *map; ///< map to avoid duplicate evaluations
  17189. uint32_t *score_map; ///< map to store the scores
  17190. unsigned map_generation;
  17191. diff --git a/media/ffvpx/libavcodec/mpegpicture.h b/media/ffvpx/libavcodec/mpegpicture.h
  17192. index a1455ee1..7919aa40 100644
  17193. --- a/media/ffvpx/libavcodec/mpegpicture.h
  17194. +++ b/media/ffvpx/libavcodec/mpegpicture.h
  17195. @@ -76,6 +76,9 @@ typedef struct Picture {
  17196. int reference;
  17197. int shared;
  17198. +
  17199. + int display_picture_number;
  17200. + int coded_picture_number;
  17201. } Picture;
  17202. /**
  17203. diff --git a/media/ffvpx/libavcodec/mpegvideo.h b/media/ffvpx/libavcodec/mpegvideo.h
  17204. index ccec0dd7..55828e61 100644
  17205. --- a/media/ffvpx/libavcodec/mpegvideo.h
  17206. +++ b/media/ffvpx/libavcodec/mpegvideo.h
  17207. @@ -44,9 +44,6 @@
  17208. #include "pixblockdsp.h"
  17209. #include "put_bits.h"
  17210. #include "ratecontrol.h"
  17211. -#if FF_API_FLAG_TRUNCATED
  17212. -#include "parser.h"
  17213. -#endif
  17214. #include "mpegutils.h"
  17215. #include "qpeldsp.h"
  17216. #include "videodsp.h"
  17217. @@ -117,6 +114,7 @@ typedef struct MpegEncContext {
  17218. int input_picture_number; ///< used to set pic->display_picture_number, should not be used for/by anything else
  17219. int coded_picture_number; ///< used to set pic->coded_picture_number, should not be used for/by anything else
  17220. int picture_number; //FIXME remove, unclear definition
  17221. + int extradata_parsed;
  17222. int picture_in_gop_number; ///< 0-> first pic in gop, ...
  17223. int mb_width, mb_height; ///< number of MBs horizontally & vertically
  17224. int mb_stride; ///< mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11
  17225. @@ -174,6 +172,7 @@ typedef struct MpegEncContext {
  17226. Picture *last_picture_ptr; ///< pointer to the previous picture.
  17227. Picture *next_picture_ptr; ///< pointer to the next picture (for bidir pred)
  17228. Picture *current_picture_ptr; ///< pointer to the current picture
  17229. + int skipped_last_frame;
  17230. int last_dc[3]; ///< last DC values for MPEG-1
  17231. int16_t *dc_val_base;
  17232. int16_t *dc_val[3]; ///< used for MPEG-4 DC prediction, all 3 arrays must be continuous
  17233. @@ -351,10 +350,6 @@ typedef struct MpegEncContext {
  17234. GetBitContext last_resync_gb; ///< used to search for the next resync marker
  17235. int mb_num_left; ///< number of MBs left in this video packet (for partitioned Slices only)
  17236. -#if FF_API_FLAG_TRUNCATED
  17237. - ParseContext parse_context;
  17238. -#endif
  17239. -
  17240. /* H.263 specific */
  17241. int gob_index;
  17242. int obmc; ///< overlapped block motion compensation
  17243. diff --git a/media/ffvpx/libavcodec/options.c b/media/ffvpx/libavcodec/options.c
  17244. index 2e05d29e..a9b35ee1 100644
  17245. --- a/media/ffvpx/libavcodec/options.c
  17246. +++ b/media/ffvpx/libavcodec/options.c
  17247. @@ -124,7 +124,11 @@ static int init_context_defaults(AVCodecContext *s, const AVCodec *codec)
  17248. s->sw_pix_fmt = AV_PIX_FMT_NONE;
  17249. s->sample_fmt = AV_SAMPLE_FMT_NONE;
  17250. +#if FF_API_REORDERED_OPAQUE
  17251. +FF_DISABLE_DEPRECATION_WARNINGS
  17252. s->reordered_opaque = AV_NOPTS_VALUE;
  17253. +FF_ENABLE_DEPRECATION_WARNINGS
  17254. +#endif
  17255. if(codec && codec2->priv_data_size){
  17256. s->priv_data = av_mallocz(codec2->priv_data_size);
  17257. if (!s->priv_data)
  17258. @@ -185,39 +189,6 @@ const AVClass *avcodec_get_class(void)
  17259. return &av_codec_context_class;
  17260. }
  17261. -#if FF_API_GET_FRAME_CLASS
  17262. -FF_DISABLE_DEPRECATION_WARNINGS
  17263. -#define FOFFSET(x) offsetof(AVFrame,x)
  17264. -
  17265. -static const AVOption frame_options[]={
  17266. -{"best_effort_timestamp", "", FOFFSET(best_effort_timestamp), AV_OPT_TYPE_INT64, {.i64 = AV_NOPTS_VALUE }, INT64_MIN, INT64_MAX, 0},
  17267. -{"pkt_pos", "", FOFFSET(pkt_pos), AV_OPT_TYPE_INT64, {.i64 = -1 }, INT64_MIN, INT64_MAX, 0},
  17268. -{"pkt_size", "", FOFFSET(pkt_size), AV_OPT_TYPE_INT64, {.i64 = -1 }, INT64_MIN, INT64_MAX, 0},
  17269. -{"sample_aspect_ratio", "", FOFFSET(sample_aspect_ratio), AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, 0, INT_MAX, 0},
  17270. -{"width", "", FOFFSET(width), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, 0},
  17271. -{"height", "", FOFFSET(height), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, 0},
  17272. -{"format", "", FOFFSET(format), AV_OPT_TYPE_INT, {.i64 = -1 }, 0, INT_MAX, 0},
  17273. -#if FF_API_OLD_CHANNEL_LAYOUT
  17274. -{"channel_layout", "", FOFFSET(channel_layout), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, INT64_MAX, 0},
  17275. -#endif
  17276. -{"sample_rate", "", FOFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, 0},
  17277. -{NULL},
  17278. -};
  17279. -
  17280. -static const AVClass av_frame_class = {
  17281. - .class_name = "AVFrame",
  17282. - .item_name = NULL,
  17283. - .option = frame_options,
  17284. - .version = LIBAVUTIL_VERSION_INT,
  17285. -};
  17286. -
  17287. -const AVClass *avcodec_get_frame_class(void)
  17288. -{
  17289. - return &av_frame_class;
  17290. -}
  17291. -FF_ENABLE_DEPRECATION_WARNINGS
  17292. -#endif
  17293. -
  17294. #define SROFFSET(x) offsetof(AVSubtitleRect,x)
  17295. static const AVOption subtitle_rect_options[]={
  17296. diff --git a/media/ffvpx/libavcodec/options_table.h b/media/ffvpx/libavcodec/options_table.h
  17297. index cd02f509..4fea5767 100644
  17298. --- a/media/ffvpx/libavcodec/options_table.h
  17299. +++ b/media/ffvpx/libavcodec/options_table.h
  17300. @@ -58,13 +58,12 @@ static const AVOption avcodec_options[] = {
  17301. {"loop", "use loop filter", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_LOOP_FILTER }, INT_MIN, INT_MAX, V|E, "flags"},
  17302. {"qscale", "use fixed qscale", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_QSCALE }, INT_MIN, INT_MAX, 0, "flags"},
  17303. {"recon_frame", "export reconstructed frames", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_RECON_FRAME}, .unit = "flags"},
  17304. +{"copy_opaque", "propagate opaque values", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_COPY_OPAQUE}, .unit = "flags"},
  17305. +{"frame_duration", "use frame durations", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_FRAME_DURATION}, .unit = "flags"},
  17306. {"pass1", "use internal 2-pass ratecontrol in first pass mode", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_PASS1 }, INT_MIN, INT_MAX, 0, "flags"},
  17307. {"pass2", "use internal 2-pass ratecontrol in second pass mode", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_PASS2 }, INT_MIN, INT_MAX, 0, "flags"},
  17308. {"gray", "only decode/encode grayscale", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_GRAY }, INT_MIN, INT_MAX, V|E|D, "flags"},
  17309. {"psnr", "error[?] variables will be set during encoding", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_PSNR }, INT_MIN, INT_MAX, V|E, "flags"},
  17310. -#if FF_API_FLAG_TRUNCATED
  17311. -{"truncated", "(Deprecated, use parsers instead.) Input bitstream might be randomly truncated", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_TRUNCATED }, INT_MIN, INT_MAX, V|D | AV_OPT_FLAG_DEPRECATED, "flags"},
  17312. -#endif
  17313. {"ildct", "use interlaced DCT", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_INTERLACED_DCT }, INT_MIN, INT_MAX, V|E, "flags"},
  17314. {"low_delay", "force low delay", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_LOW_DELAY }, INT_MIN, INT_MAX, V|D|E, "flags"},
  17315. {"global_header", "place global headers in extradata instead of every keyframe", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_GLOBAL_HEADER }, INT_MIN, INT_MAX, V|A|E, "flags"},
  17316. @@ -98,7 +97,7 @@ static const AVOption avcodec_options[] = {
  17317. #endif
  17318. {"cutoff", "set cutoff bandwidth", OFFSET(cutoff), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|E},
  17319. {"frame_size", NULL, OFFSET(frame_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|E},
  17320. -{"frame_number", NULL, OFFSET(frame_number), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
  17321. +{"frame_number", NULL, OFFSET(frame_num), AV_OPT_TYPE_INT64, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
  17322. {"delay", NULL, OFFSET(delay), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
  17323. {"qcomp", "video quantizer scale compression (VBR). Constant of ratecontrol equation. "
  17324. "Recommended range for default rc_eq: 0.0-1.0",
  17325. @@ -377,10 +376,6 @@ static const AVOption avcodec_options[] = {
  17326. {"auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_CHARENC_MODE_AUTOMATIC}, INT_MIN, INT_MAX, S|D, "sub_charenc_mode"},
  17327. {"pre_decoder", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_CHARENC_MODE_PRE_DECODER}, INT_MIN, INT_MAX, S|D, "sub_charenc_mode"},
  17328. {"ignore", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_CHARENC_MODE_IGNORE}, INT_MIN, INT_MAX, S|D, "sub_charenc_mode"},
  17329. -#if FF_API_SUB_TEXT_FORMAT
  17330. -{"sub_text_format", "Deprecated, does nothing", OFFSET(sub_text_format), AV_OPT_TYPE_INT, {.i64 = FF_SUB_TEXT_FMT_ASS}, 0, 1, S|D | AV_OPT_FLAG_DEPRECATED, "sub_text_format"},
  17331. -{"ass", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_TEXT_FMT_ASS}, INT_MIN, INT_MAX, S|D, "sub_text_format"},
  17332. -#endif
  17333. {"apply_cropping", NULL, OFFSET(apply_cropping), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, V | D },
  17334. {"skip_alpha", "Skip processing alpha", OFFSET(skip_alpha), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, V|D },
  17335. {"field_order", "Field order", OFFSET(field_order), AV_OPT_TYPE_INT, {.i64 = AV_FIELD_UNKNOWN }, 0, 5, V|D|E, "field_order" },
  17336. @@ -399,6 +394,7 @@ static const AVOption avcodec_options[] = {
  17337. {"ignore_level", "ignore level even if the codec level used is unknown or higher than the maximum supported level reported by the hardware driver", 0, AV_OPT_TYPE_CONST, { .i64 = AV_HWACCEL_FLAG_IGNORE_LEVEL }, INT_MIN, INT_MAX, V | D, "hwaccel_flags" },
  17338. {"allow_high_depth", "allow to output YUV pixel formats with a different chroma sampling than 4:2:0 and/or other than 8 bits per component", 0, AV_OPT_TYPE_CONST, {.i64 = AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH }, INT_MIN, INT_MAX, V | D, "hwaccel_flags"},
  17339. {"allow_profile_mismatch", "attempt to decode anyway if HW accelerated decoder's supported profiles do not exactly match the stream", 0, AV_OPT_TYPE_CONST, {.i64 = AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH }, INT_MIN, INT_MAX, V | D, "hwaccel_flags"},
  17340. +{"unsafe_output", "allow potentially unsafe hwaccel frame output that might require special care to process successfully", 0, AV_OPT_TYPE_CONST, {.i64 = AV_HWACCEL_FLAG_UNSAFE_OUTPUT }, INT_MIN, INT_MAX, V | D, "hwaccel_flags"},
  17341. {"extra_hw_frames", "Number of extra hardware frames to allocate for the user", OFFSET(extra_hw_frames), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, V|D },
  17342. {"discard_damaged_percentage", "Percentage of damaged samples to discard a frame", OFFSET(discard_damaged_percentage), AV_OPT_TYPE_INT, {.i64 = 95 }, 0, 100, V|D },
  17343. {NULL},
  17344. diff --git a/media/ffvpx/libavcodec/profiles.c b/media/ffvpx/libavcodec/profiles.c
  17345. index 7af7fbeb..2230fc54 100644
  17346. --- a/media/ffvpx/libavcodec/profiles.c
  17347. +++ b/media/ffvpx/libavcodec/profiles.c
  17348. @@ -85,6 +85,7 @@ const AVProfile ff_hevc_profiles[] = {
  17349. { FF_PROFILE_HEVC_MAIN_10, "Main 10" },
  17350. { FF_PROFILE_HEVC_MAIN_STILL_PICTURE, "Main Still Picture" },
  17351. { FF_PROFILE_HEVC_REXT, "Rext" },
  17352. + { FF_PROFILE_HEVC_SCC, "Scc" },
  17353. { FF_PROFILE_UNKNOWN },
  17354. };
  17355. diff --git a/media/ffvpx/libavcodec/pthread.c b/media/ffvpx/libavcodec/pthread.c
  17356. index 60ba87da..ca84b813 100644
  17357. --- a/media/ffvpx/libavcodec/pthread.c
  17358. +++ b/media/ffvpx/libavcodec/pthread.c
  17359. @@ -48,9 +48,6 @@
  17360. static void validate_thread_parameters(AVCodecContext *avctx)
  17361. {
  17362. int frame_threading_supported = (avctx->codec->capabilities & AV_CODEC_CAP_FRAME_THREADS)
  17363. -#if FF_API_FLAG_TRUNCATED
  17364. - && !(avctx->flags & AV_CODEC_FLAG_TRUNCATED)
  17365. -#endif
  17366. && !(avctx->flags & AV_CODEC_FLAG_LOW_DELAY)
  17367. && !(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS);
  17368. if (avctx->thread_count == 1) {
  17369. diff --git a/media/ffvpx/libavcodec/pthread_frame.c b/media/ffvpx/libavcodec/pthread_frame.c
  17370. index df82a412..d9d5afaa 100644
  17371. --- a/media/ffvpx/libavcodec/pthread_frame.c
  17372. +++ b/media/ffvpx/libavcodec/pthread_frame.c
  17373. @@ -99,22 +99,6 @@ typedef struct PerThreadContext {
  17374. atomic_int state;
  17375. -#if FF_API_THREAD_SAFE_CALLBACKS
  17376. - /**
  17377. - * Array of frames passed to ff_thread_release_buffer().
  17378. - * Frames are released after all threads referencing them are finished.
  17379. - */
  17380. - AVFrame **released_buffers;
  17381. - int num_released_buffers;
  17382. - int released_buffers_allocated;
  17383. -
  17384. - AVFrame *requested_frame; ///< AVFrame the codec passed to get_buffer()
  17385. - int requested_flags; ///< flags passed to get_buffer() for requested_frame
  17386. -
  17387. - const enum AVPixelFormat *available_formats; ///< Format array for get_format()
  17388. - enum AVPixelFormat result_format; ///< get_format() result
  17389. -#endif
  17390. -
  17391. int die; ///< Set when the thread should exit.
  17392. int hwaccel_serializing;
  17393. @@ -156,11 +140,6 @@ typedef struct FrameThreadContext {
  17394. void *stash_hwaccel_priv;
  17395. } FrameThreadContext;
  17396. -#if FF_API_THREAD_SAFE_CALLBACKS
  17397. -#define THREAD_SAFE_CALLBACKS(avctx) \
  17398. -((avctx)->thread_safe_callbacks || (avctx)->get_buffer2 == avcodec_default_get_buffer2)
  17399. -#endif
  17400. -
  17401. static void async_lock(FrameThreadContext *fctx)
  17402. {
  17403. pthread_mutex_lock(&fctx->async_mutex);
  17404. @@ -212,14 +191,8 @@ static attribute_align_arg void *frame_worker_thread(void *arg)
  17405. if (p->die) break;
  17406. -FF_DISABLE_DEPRECATION_WARNINGS
  17407. - if (!codec->update_thread_context
  17408. -#if FF_API_THREAD_SAFE_CALLBACKS
  17409. - && THREAD_SAFE_CALLBACKS(avctx)
  17410. -#endif
  17411. - )
  17412. + if (!codec->update_thread_context)
  17413. ff_thread_finish_setup(avctx);
  17414. -FF_ENABLE_DEPRECATION_WARNINGS
  17415. /* If a decoder supports hwaccel, then it must call ff_get_format().
  17416. * Since that call must happen before ff_thread_finish_setup(), the
  17417. @@ -371,6 +344,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
  17418. */
  17419. static int update_context_from_user(AVCodecContext *dst, AVCodecContext *src)
  17420. {
  17421. + int err;
  17422. +
  17423. dst->flags = src->flags;
  17424. dst->draw_horiz_band= src->draw_horiz_band;
  17425. @@ -387,11 +362,15 @@ static int update_context_from_user(AVCodecContext *dst, AVCodecContext *src)
  17426. dst->skip_idct = src->skip_idct;
  17427. dst->skip_frame = src->skip_frame;
  17428. + dst->frame_num = src->frame_num;
  17429. +#if FF_API_AVCTX_FRAME_NUMBER
  17430. +FF_DISABLE_DEPRECATION_WARNINGS
  17431. dst->frame_number = src->frame_number;
  17432. - dst->reordered_opaque = src->reordered_opaque;
  17433. -#if FF_API_THREAD_SAFE_CALLBACKS
  17434. +FF_ENABLE_DEPRECATION_WARNINGS
  17435. +#endif
  17436. +#if FF_API_REORDERED_OPAQUE
  17437. FF_DISABLE_DEPRECATION_WARNINGS
  17438. - dst->thread_safe_callbacks = src->thread_safe_callbacks;
  17439. + dst->reordered_opaque = src->reordered_opaque;
  17440. FF_ENABLE_DEPRECATION_WARNINGS
  17441. #endif
  17442. @@ -406,31 +385,14 @@ FF_ENABLE_DEPRECATION_WARNINGS
  17443. src->slice_count * sizeof(*dst->slice_offset));
  17444. }
  17445. dst->slice_count = src->slice_count;
  17446. - return 0;
  17447. -}
  17448. -
  17449. -#if FF_API_THREAD_SAFE_CALLBACKS
  17450. -/// Releases the buffers that this decoding thread was the last user of.
  17451. -static void release_delayed_buffers(PerThreadContext *p)
  17452. -{
  17453. - FrameThreadContext *fctx = p->parent;
  17454. -
  17455. - while (p->num_released_buffers > 0) {
  17456. - AVFrame *f;
  17457. -
  17458. - pthread_mutex_lock(&fctx->buffer_mutex);
  17459. - // fix extended data in case the caller screwed it up
  17460. - av_assert0(p->avctx->codec_type == AVMEDIA_TYPE_VIDEO ||
  17461. - p->avctx->codec_type == AVMEDIA_TYPE_AUDIO);
  17462. - f = p->released_buffers[--p->num_released_buffers];
  17463. - f->extended_data = f->data;
  17464. - av_frame_unref(f);
  17465. + av_packet_unref(dst->internal->last_pkt_props);
  17466. + err = av_packet_copy_props(dst->internal->last_pkt_props, src->internal->last_pkt_props);
  17467. + if (err < 0)
  17468. + return err;
  17469. - pthread_mutex_unlock(&fctx->buffer_mutex);
  17470. - }
  17471. + return 0;
  17472. }
  17473. -#endif
  17474. static int submit_packet(PerThreadContext *p, AVCodecContext *user_avctx,
  17475. AVPacket *avpkt)
  17476. @@ -454,10 +416,6 @@ static int submit_packet(PerThreadContext *p, AVCodecContext *user_avctx,
  17477. (p->avctx->debug & FF_DEBUG_THREADS) != 0,
  17478. memory_order_relaxed);
  17479. -#if FF_API_THREAD_SAFE_CALLBACKS
  17480. - release_delayed_buffers(p);
  17481. -#endif
  17482. -
  17483. if (prev_thread) {
  17484. int err;
  17485. if (atomic_load(&prev_thread->state) == STATE_SETTING_UP) {
  17486. @@ -492,44 +450,6 @@ static int submit_packet(PerThreadContext *p, AVCodecContext *user_avctx,
  17487. pthread_cond_signal(&p->input_cond);
  17488. pthread_mutex_unlock(&p->mutex);
  17489. -#if FF_API_THREAD_SAFE_CALLBACKS
  17490. -FF_DISABLE_DEPRECATION_WARNINGS
  17491. - /*
  17492. - * If the client doesn't have a thread-safe get_buffer(),
  17493. - * then decoding threads call back to the main thread,
  17494. - * and it calls back to the client here.
  17495. - */
  17496. -
  17497. - if (!p->avctx->thread_safe_callbacks && (
  17498. - p->avctx->get_format != avcodec_default_get_format ||
  17499. - p->avctx->get_buffer2 != avcodec_default_get_buffer2)) {
  17500. - while (atomic_load(&p->state) != STATE_SETUP_FINISHED && atomic_load(&p->state) != STATE_INPUT_READY) {
  17501. - int call_done = 1;
  17502. - pthread_mutex_lock(&p->progress_mutex);
  17503. - while (atomic_load(&p->state) == STATE_SETTING_UP)
  17504. - pthread_cond_wait(&p->progress_cond, &p->progress_mutex);
  17505. -
  17506. - switch (atomic_load_explicit(&p->state, memory_order_acquire)) {
  17507. - case STATE_GET_BUFFER:
  17508. - p->result = ff_get_buffer(p->avctx, p->requested_frame, p->requested_flags);
  17509. - break;
  17510. - case STATE_GET_FORMAT:
  17511. - p->result_format = ff_get_format(p->avctx, p->available_formats);
  17512. - break;
  17513. - default:
  17514. - call_done = 0;
  17515. - break;
  17516. - }
  17517. - if (call_done) {
  17518. - atomic_store(&p->state, STATE_SETTING_UP);
  17519. - pthread_cond_signal(&p->progress_cond);
  17520. - }
  17521. - pthread_mutex_unlock(&p->progress_mutex);
  17522. - }
  17523. - }
  17524. -FF_ENABLE_DEPRECATION_WARNINGS
  17525. -#endif
  17526. -
  17527. fctx->prev_thread = p;
  17528. fctx->next_decoding++;
  17529. @@ -760,12 +680,6 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count)
  17530. if (codec->close && p->thread_init != UNINITIALIZED)
  17531. codec->close(ctx);
  17532. -#if FF_API_THREAD_SAFE_CALLBACKS
  17533. - release_delayed_buffers(p);
  17534. - for (int j = 0; j < p->released_buffers_allocated; j++)
  17535. - av_frame_free(&p->released_buffers[j]);
  17536. - av_freep(&p->released_buffers);
  17537. -#endif
  17538. if (ctx->priv_data) {
  17539. if (codec->p.priv_class)
  17540. av_opt_free(ctx->priv_data);
  17541. @@ -775,6 +689,7 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count)
  17542. av_freep(&ctx->slice_offset);
  17543. av_buffer_unref(&ctx->internal->pool);
  17544. + av_packet_free(&ctx->internal->last_pkt_props);
  17545. av_freep(&ctx->internal);
  17546. av_buffer_unref(&ctx->hw_frames_ctx);
  17547. }
  17548. @@ -848,11 +763,14 @@ static av_cold int init_thread(PerThreadContext *p, int *threads_to_free,
  17549. if (!(p->frame = av_frame_alloc()) ||
  17550. !(p->avpkt = av_packet_alloc()))
  17551. return AVERROR(ENOMEM);
  17552. - copy->internal->last_pkt_props = p->avpkt;
  17553. if (!first)
  17554. copy->internal->is_copy = 1;
  17555. + copy->internal->last_pkt_props = av_packet_alloc();
  17556. + if (!copy->internal->last_pkt_props)
  17557. + return AVERROR(ENOMEM);
  17558. +
  17559. if (codec->init) {
  17560. err = codec->init(copy);
  17561. if (err < 0) {
  17562. @@ -959,10 +877,6 @@ void ff_thread_flush(AVCodecContext *avctx)
  17563. av_frame_unref(p->frame);
  17564. p->result = 0;
  17565. -#if FF_API_THREAD_SAFE_CALLBACKS
  17566. - release_delayed_buffers(p);
  17567. -#endif
  17568. -
  17569. if (ffcodec(avctx->codec)->flush)
  17570. ffcodec(avctx->codec)->flush(p->avctx);
  17571. }
  17572. @@ -971,16 +885,12 @@ void ff_thread_flush(AVCodecContext *avctx)
  17573. int ff_thread_can_start_frame(AVCodecContext *avctx)
  17574. {
  17575. PerThreadContext *p = avctx->internal->thread_ctx;
  17576. -FF_DISABLE_DEPRECATION_WARNINGS
  17577. +
  17578. if ((avctx->active_thread_type&FF_THREAD_FRAME) && atomic_load(&p->state) != STATE_SETTING_UP &&
  17579. - (ffcodec(avctx->codec)->update_thread_context
  17580. -#if FF_API_THREAD_SAFE_CALLBACKS
  17581. - || !THREAD_SAFE_CALLBACKS(avctx)
  17582. -#endif
  17583. - )) {
  17584. + ffcodec(avctx->codec)->update_thread_context) {
  17585. return 0;
  17586. }
  17587. -FF_ENABLE_DEPRECATION_WARNINGS
  17588. +
  17589. return 1;
  17590. }
  17591. @@ -995,80 +905,20 @@ static int thread_get_buffer_internal(AVCodecContext *avctx, AVFrame *f, int fla
  17592. p = avctx->internal->thread_ctx;
  17593. FF_DISABLE_DEPRECATION_WARNINGS
  17594. if (atomic_load(&p->state) != STATE_SETTING_UP &&
  17595. - (ffcodec(avctx->codec)->update_thread_context
  17596. -#if FF_API_THREAD_SAFE_CALLBACKS
  17597. - || !THREAD_SAFE_CALLBACKS(avctx)
  17598. -#endif
  17599. - )) {
  17600. + ffcodec(avctx->codec)->update_thread_context) {
  17601. FF_ENABLE_DEPRECATION_WARNINGS
  17602. av_log(avctx, AV_LOG_ERROR, "get_buffer() cannot be called after ff_thread_finish_setup()\n");
  17603. return -1;
  17604. }
  17605. pthread_mutex_lock(&p->parent->buffer_mutex);
  17606. -#if !FF_API_THREAD_SAFE_CALLBACKS
  17607. err = ff_get_buffer(avctx, f, flags);
  17608. -#else
  17609. -FF_DISABLE_DEPRECATION_WARNINGS
  17610. - if (THREAD_SAFE_CALLBACKS(avctx)) {
  17611. - err = ff_get_buffer(avctx, f, flags);
  17612. - } else {
  17613. - pthread_mutex_lock(&p->progress_mutex);
  17614. - p->requested_frame = f;
  17615. - p->requested_flags = flags;
  17616. - atomic_store_explicit(&p->state, STATE_GET_BUFFER, memory_order_release);
  17617. - pthread_cond_broadcast(&p->progress_cond);
  17618. -
  17619. - while (atomic_load(&p->state) != STATE_SETTING_UP)
  17620. - pthread_cond_wait(&p->progress_cond, &p->progress_mutex);
  17621. -
  17622. - err = p->result;
  17623. -
  17624. - pthread_mutex_unlock(&p->progress_mutex);
  17625. -
  17626. - }
  17627. - if (!THREAD_SAFE_CALLBACKS(avctx) && !ffcodec(avctx->codec)->update_thread_context)
  17628. - ff_thread_finish_setup(avctx);
  17629. -FF_ENABLE_DEPRECATION_WARNINGS
  17630. -#endif
  17631. pthread_mutex_unlock(&p->parent->buffer_mutex);
  17632. return err;
  17633. }
  17634. -#if FF_API_THREAD_SAFE_CALLBACKS
  17635. -FF_DISABLE_DEPRECATION_WARNINGS
  17636. -enum AVPixelFormat ff_thread_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
  17637. -{
  17638. - enum AVPixelFormat res;
  17639. - PerThreadContext *p;
  17640. - if (!(avctx->active_thread_type & FF_THREAD_FRAME) || avctx->thread_safe_callbacks ||
  17641. - avctx->get_format == avcodec_default_get_format)
  17642. - return ff_get_format(avctx, fmt);
  17643. -
  17644. - p = avctx->internal->thread_ctx;
  17645. - if (atomic_load(&p->state) != STATE_SETTING_UP) {
  17646. - av_log(avctx, AV_LOG_ERROR, "get_format() cannot be called after ff_thread_finish_setup()\n");
  17647. - return -1;
  17648. - }
  17649. - pthread_mutex_lock(&p->progress_mutex);
  17650. - p->available_formats = fmt;
  17651. - atomic_store(&p->state, STATE_GET_FORMAT);
  17652. - pthread_cond_broadcast(&p->progress_cond);
  17653. -
  17654. - while (atomic_load(&p->state) != STATE_SETTING_UP)
  17655. - pthread_cond_wait(&p->progress_cond, &p->progress_mutex);
  17656. -
  17657. - res = p->result_format;
  17658. -
  17659. - pthread_mutex_unlock(&p->progress_mutex);
  17660. -
  17661. - return res;
  17662. -}
  17663. -FF_ENABLE_DEPRECATION_WARNINGS
  17664. -#endif
  17665. -
  17666. int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags)
  17667. {
  17668. int ret = thread_get_buffer_internal(avctx, f, flags);
  17669. @@ -1110,69 +960,13 @@ int ff_thread_get_ext_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
  17670. void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f)
  17671. {
  17672. -#if FF_API_THREAD_SAFE_CALLBACKS
  17673. -FF_DISABLE_DEPRECATION_WARNINGS
  17674. - PerThreadContext *p;
  17675. - FrameThreadContext *fctx;
  17676. - AVFrame *dst;
  17677. - int ret = 0;
  17678. - int can_direct_free = !(avctx->active_thread_type & FF_THREAD_FRAME) ||
  17679. - THREAD_SAFE_CALLBACKS(avctx);
  17680. -FF_ENABLE_DEPRECATION_WARNINGS
  17681. -#endif
  17682. -
  17683. if (!f)
  17684. return;
  17685. if (avctx->debug & FF_DEBUG_BUFFERS)
  17686. av_log(avctx, AV_LOG_DEBUG, "thread_release_buffer called on pic %p\n", f);
  17687. -#if !FF_API_THREAD_SAFE_CALLBACKS
  17688. av_frame_unref(f);
  17689. -#else
  17690. - // when the frame buffers are not allocated, just reset it to clean state
  17691. - if (can_direct_free || !f->buf[0]) {
  17692. - av_frame_unref(f);
  17693. - return;
  17694. - }
  17695. -
  17696. - p = avctx->internal->thread_ctx;
  17697. - fctx = p->parent;
  17698. - pthread_mutex_lock(&fctx->buffer_mutex);
  17699. -
  17700. - if (p->num_released_buffers == p->released_buffers_allocated) {
  17701. - AVFrame **tmp = av_realloc_array(p->released_buffers, p->released_buffers_allocated + 1,
  17702. - sizeof(*p->released_buffers));
  17703. - if (tmp) {
  17704. - tmp[p->released_buffers_allocated] = av_frame_alloc();
  17705. - p->released_buffers = tmp;
  17706. - }
  17707. -
  17708. - if (!tmp || !tmp[p->released_buffers_allocated]) {
  17709. - ret = AVERROR(ENOMEM);
  17710. - goto fail;
  17711. - }
  17712. - p->released_buffers_allocated++;
  17713. - }
  17714. -
  17715. - dst = p->released_buffers[p->num_released_buffers];
  17716. - av_frame_move_ref(dst, f);
  17717. -
  17718. - p->num_released_buffers++;
  17719. -
  17720. -fail:
  17721. - pthread_mutex_unlock(&fctx->buffer_mutex);
  17722. -
  17723. - // make sure the frame is clean even if we fail to free it
  17724. - // this leaks, but it is better than crashing
  17725. - if (ret < 0) {
  17726. - av_log(avctx, AV_LOG_ERROR, "Could not queue a frame for freeing, this will leak\n");
  17727. - memset(f->buf, 0, sizeof(f->buf));
  17728. - if (f->extended_buf)
  17729. - memset(f->extended_buf, 0, f->nb_extended_buf * sizeof(*f->extended_buf));
  17730. - av_frame_unref(f);
  17731. - }
  17732. -#endif
  17733. }
  17734. void ff_thread_release_ext_buffer(AVCodecContext *avctx, ThreadFrame *f)
  17735. diff --git a/media/ffvpx/libavcodec/put_bits.h b/media/ffvpx/libavcodec/put_bits.h
  17736. index 4b4f977a..4561dc13 100644
  17737. --- a/media/ffvpx/libavcodec/put_bits.h
  17738. +++ b/media/ffvpx/libavcodec/put_bits.h
  17739. @@ -363,6 +363,13 @@ static inline void put_bits64(PutBitContext *s, int n, uint64_t value)
  17740. }
  17741. }
  17742. +static inline void put_sbits63(PutBitContext *pb, int n, int64_t value)
  17743. +{
  17744. + av_assert2(n >= 0 && n < 64);
  17745. +
  17746. + put_bits64(pb, n, (uint64_t)(value) & (~(UINT64_MAX << n)));
  17747. +}
  17748. +
  17749. /**
  17750. * Return the pointer to the byte where the bitstream writer will put
  17751. * the next bit.
  17752. diff --git a/media/ffvpx/libavcodec/ratecontrol.h b/media/ffvpx/libavcodec/ratecontrol.h
  17753. index 2a7aaec6..4de80fad 100644
  17754. --- a/media/ffvpx/libavcodec/ratecontrol.h
  17755. +++ b/media/ffvpx/libavcodec/ratecontrol.h
  17756. @@ -80,9 +80,6 @@ typedef struct RateControlContext{
  17757. int frame_count[5];
  17758. int last_non_b_pict_type;
  17759. - void *non_lavc_opaque; ///< context for non lavc rc code (for example xvid)
  17760. - float dry_run_qscale; ///< for xvid rc
  17761. - int last_picture_number; ///< for xvid rc
  17762. AVExpr * rc_eq_eval;
  17763. }RateControlContext;
  17764. diff --git a/media/ffvpx/libavcodec/thread.h b/media/ffvpx/libavcodec/thread.h
  17765. index d5673f25..88a14cfe 100644
  17766. --- a/media/ffvpx/libavcodec/thread.h
  17767. +++ b/media/ffvpx/libavcodec/thread.h
  17768. @@ -62,19 +62,7 @@ int ff_thread_decode_frame(AVCodecContext *avctx, AVFrame *picture,
  17769. */
  17770. void ff_thread_finish_setup(AVCodecContext *avctx);
  17771. -#if FF_API_THREAD_SAFE_CALLBACKS
  17772. -/**
  17773. - * Wrapper around get_format() for frame-multithreaded codecs.
  17774. - * Call this function instead of avctx->get_format().
  17775. - * Cannot be called after the codec has called ff_thread_finish_setup().
  17776. - *
  17777. - * @param avctx The current context.
  17778. - * @param fmt The list of available formats.
  17779. - */
  17780. -enum AVPixelFormat ff_thread_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt);
  17781. -#else
  17782. #define ff_thread_get_format ff_get_format
  17783. -#endif
  17784. /**
  17785. * Wrapper around get_buffer() for frame-multithreaded codecs.
  17786. diff --git a/media/ffvpx/libavcodec/utils.c b/media/ffvpx/libavcodec/utils.c
  17787. index 2b63a498..599da21d 100644
  17788. --- a/media/ffvpx/libavcodec/utils.c
  17789. +++ b/media/ffvpx/libavcodec/utils.c
  17790. @@ -243,6 +243,8 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
  17791. case AV_PIX_FMT_GBRAP16BE:
  17792. w_align = 16; //FIXME assume 16 pixel per macroblock
  17793. h_align = 16 * 2; // interlaced needs 2 macroblocks height
  17794. + if (s->codec_id == AV_CODEC_ID_BINKVIDEO)
  17795. + w_align = 16*2;
  17796. break;
  17797. case AV_PIX_FMT_YUV411P:
  17798. case AV_PIX_FMT_YUVJ411P:
  17799. @@ -321,6 +323,7 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
  17800. *width = FFALIGN(*width, w_align);
  17801. *height = FFALIGN(*height, h_align);
  17802. if (s->codec_id == AV_CODEC_ID_H264 || s->lowres ||
  17803. + s->codec_id == AV_CODEC_ID_VC1 || s->codec_id == AV_CODEC_ID_WMV3 ||
  17804. s->codec_id == AV_CODEC_ID_VP5 || s->codec_id == AV_CODEC_ID_VP6 ||
  17805. s->codec_id == AV_CODEC_ID_VP6F || s->codec_id == AV_CODEC_ID_VP6A
  17806. ) {
  17807. @@ -334,6 +337,9 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
  17808. // the next rounded up width is 32
  17809. *width = FFMAX(*width, 32);
  17810. }
  17811. + if (s->codec_id == AV_CODEC_ID_SVQ3) {
  17812. + *width = FFMAX(*width, 32);
  17813. + }
  17814. for (i = 0; i < 4; i++)
  17815. linesize_align[i] = STRIDE_ALIGN;
  17816. @@ -514,7 +520,9 @@ int av_get_exact_bits_per_sample(enum AVCodecID codec_id)
  17817. case AV_CODEC_ID_PCM_SGA:
  17818. case AV_CODEC_ID_PCM_U8:
  17819. case AV_CODEC_ID_SDX2_DPCM:
  17820. + case AV_CODEC_ID_CBD2_DPCM:
  17821. case AV_CODEC_ID_DERF_DPCM:
  17822. + case AV_CODEC_ID_WADY_DPCM:
  17823. return 8;
  17824. case AV_CODEC_ID_PCM_S16BE:
  17825. case AV_CODEC_ID_PCM_S16BE_PLANAR:
  17826. @@ -765,6 +773,9 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba,
  17827. case AV_CODEC_ID_ADPCM_MTAF:
  17828. tmp = blocks * (ba - 16LL) * 2 / ch;
  17829. break;
  17830. + case AV_CODEC_ID_ADPCM_XMD:
  17831. + tmp = blocks * 32;
  17832. + break;
  17833. }
  17834. if (tmp) {
  17835. if (tmp != (int)tmp)
  17836. @@ -906,11 +917,6 @@ int ff_thread_ref_frame(ThreadFrame *dst, const ThreadFrame *src)
  17837. #if !HAVE_THREADS
  17838. -enum AVPixelFormat ff_thread_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
  17839. -{
  17840. - return ff_get_format(avctx, fmt);
  17841. -}
  17842. -
  17843. int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags)
  17844. {
  17845. return ff_get_buffer(avctx, f, flags);
  17846. diff --git a/media/ffvpx/libavcodec/vaapi_av1.c b/media/ffvpx/libavcodec/vaapi_av1.c
  17847. index 63374c31..d0339b27 100644
  17848. --- a/media/ffvpx/libavcodec/vaapi_av1.c
  17849. +++ b/media/ffvpx/libavcodec/vaapi_av1.c
  17850. @@ -274,7 +274,7 @@ static int vaapi_av1_start_frame(AVCodecContext *avctx,
  17851. };
  17852. for (int i = 0; i < AV1_NUM_REF_FRAMES; i++) {
  17853. - if (pic_param.pic_info_fields.bits.frame_type == AV1_FRAME_KEY)
  17854. + if (pic_param.pic_info_fields.bits.frame_type == AV1_FRAME_KEY && frame_header->show_frame)
  17855. pic_param.ref_frame_map[i] = VA_INVALID_ID;
  17856. else
  17857. pic_param.ref_frame_map[i] = ctx->ref_tab[i].valid ?
  17858. diff --git a/media/ffvpx/libavcodec/vaapi_decode.c b/media/ffvpx/libavcodec/vaapi_decode.c
  17859. index 134f10ec..ab8c12e3 100644
  17860. --- a/media/ffvpx/libavcodec/vaapi_decode.c
  17861. +++ b/media/ffvpx/libavcodec/vaapi_decode.c
  17862. @@ -410,7 +410,9 @@ static const struct {
  17863. #endif
  17864. #if VA_CHECK_VERSION(1, 2, 0) && CONFIG_HEVC_VAAPI_HWACCEL
  17865. MAP(HEVC, HEVC_REXT, None,
  17866. - ff_vaapi_parse_hevc_rext_profile ),
  17867. + ff_vaapi_parse_hevc_rext_scc_profile ),
  17868. + MAP(HEVC, HEVC_SCC, None,
  17869. + ff_vaapi_parse_hevc_rext_scc_profile ),
  17870. #endif
  17871. MAP(MJPEG, MJPEG_HUFFMAN_BASELINE_DCT,
  17872. JPEGBaseline),
  17873. diff --git a/media/ffvpx/libavcodec/vaapi_hevc.h b/media/ffvpx/libavcodec/vaapi_hevc.h
  17874. index b3b0e6fc..449635d0 100644
  17875. --- a/media/ffvpx/libavcodec/vaapi_hevc.h
  17876. +++ b/media/ffvpx/libavcodec/vaapi_hevc.h
  17877. @@ -22,6 +22,6 @@
  17878. #include <va/va.h>
  17879. #include "avcodec.h"
  17880. -VAProfile ff_vaapi_parse_hevc_rext_profile(AVCodecContext *avctx);
  17881. +VAProfile ff_vaapi_parse_hevc_rext_scc_profile(AVCodecContext *avctx);
  17882. #endif /* AVCODEC_VAAPI_HEVC_H */
  17883. diff --git a/media/ffvpx/libavcodec/version.h b/media/ffvpx/libavcodec/version.h
  17884. index 43d0d9a9..7aa95fc3 100644
  17885. --- a/media/ffvpx/libavcodec/version.h
  17886. +++ b/media/ffvpx/libavcodec/version.h
  17887. @@ -29,8 +29,8 @@
  17888. #include "version_major.h"
  17889. -#define LIBAVCODEC_VERSION_MINOR 51
  17890. -#define LIBAVCODEC_VERSION_MICRO 101
  17891. +#define LIBAVCODEC_VERSION_MINOR 5
  17892. +#define LIBAVCODEC_VERSION_MICRO 100
  17893. #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
  17894. LIBAVCODEC_VERSION_MINOR, \
  17895. diff --git a/media/ffvpx/libavcodec/version_major.h b/media/ffvpx/libavcodec/version_major.h
  17896. index 12f863de..c2f118b2 100644
  17897. --- a/media/ffvpx/libavcodec/version_major.h
  17898. +++ b/media/ffvpx/libavcodec/version_major.h
  17899. @@ -25,7 +25,7 @@
  17900. * Libavcodec version macros.
  17901. */
  17902. -#define LIBAVCODEC_VERSION_MAJOR 59
  17903. +#define LIBAVCODEC_VERSION_MAJOR 60
  17904. /**
  17905. * FF_API_* defines may be placed below to indicate public API that will be
  17906. @@ -37,21 +37,16 @@
  17907. * at once through the bump. This improves the git bisect-ability of the change.
  17908. */
  17909. -#define FF_API_OPENH264_SLICE_MODE (LIBAVCODEC_VERSION_MAJOR < 60)
  17910. -#define FF_API_OPENH264_CABAC (LIBAVCODEC_VERSION_MAJOR < 60)
  17911. -#define FF_API_UNUSED_CODEC_CAPS (LIBAVCODEC_VERSION_MAJOR < 60)
  17912. -#define FF_API_THREAD_SAFE_CALLBACKS (LIBAVCODEC_VERSION_MAJOR < 60)
  17913. -#define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 60)
  17914. -#define FF_API_GET_FRAME_CLASS (LIBAVCODEC_VERSION_MAJOR < 60)
  17915. -#define FF_API_AUTO_THREADS (LIBAVCODEC_VERSION_MAJOR < 60)
  17916. -#define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 60)
  17917. -#define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 60)
  17918. -#define FF_API_FLAG_TRUNCATED (LIBAVCODEC_VERSION_MAJOR < 60)
  17919. -#define FF_API_SUB_TEXT_FORMAT (LIBAVCODEC_VERSION_MAJOR < 60)
  17920. -#define FF_API_IDCT_NONE (LIBAVCODEC_VERSION_MAJOR < 60)
  17921. -#define FF_API_SVTAV1_OPTS (LIBAVCODEC_VERSION_MAJOR < 60)
  17922. -#define FF_API_AYUV_CODECID (LIBAVCODEC_VERSION_MAJOR < 60)
  17923. -#define FF_API_VT_OUTPUT_CALLBACK (LIBAVCODEC_VERSION_MAJOR < 60)
  17924. -#define FF_API_AVCODEC_CHROMA_POS (LIBAVCODEC_VERSION_MAJOR < 60)
  17925. +#define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 61)
  17926. +#define FF_API_IDCT_NONE (LIBAVCODEC_VERSION_MAJOR < 61)
  17927. +#define FF_API_SVTAV1_OPTS (LIBAVCODEC_VERSION_MAJOR < 61)
  17928. +#define FF_API_AYUV_CODECID (LIBAVCODEC_VERSION_MAJOR < 61)
  17929. +#define FF_API_VT_OUTPUT_CALLBACK (LIBAVCODEC_VERSION_MAJOR < 61)
  17930. +#define FF_API_AVCODEC_CHROMA_POS (LIBAVCODEC_VERSION_MAJOR < 61)
  17931. +#define FF_API_VT_HWACCEL_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 61)
  17932. +#define FF_API_AVCTX_FRAME_NUMBER (LIBAVCODEC_VERSION_MAJOR < 61)
  17933. +
  17934. +// reminder to remove CrystalHD decoders on next major bump
  17935. +#define FF_CODEC_CRYSTAL_HD (LIBAVCODEC_VERSION_MAJOR < 61)
  17936. #endif /* AVCODEC_VERSION_MAJOR_H */
  17937. diff --git a/media/ffvpx/libavcodec/videodsp_template.c b/media/ffvpx/libavcodec/videodsp_template.c
  17938. index 324d70f2..d653f4d5 100644
  17939. --- a/media/ffvpx/libavcodec/videodsp_template.c
  17940. +++ b/media/ffvpx/libavcodec/videodsp_template.c
  17941. @@ -64,7 +64,7 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
  17942. av_assert2(start_x < end_x && block_w);
  17943. w = end_x - start_x;
  17944. - src += start_y * src_linesize + start_x * sizeof(pixel);
  17945. + src += start_y * src_linesize + start_x * (ptrdiff_t)sizeof(pixel);
  17946. buf += start_x * sizeof(pixel);
  17947. // top
  17948. @@ -87,7 +87,7 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
  17949. buf += buf_linesize;
  17950. }
  17951. - buf -= block_h * buf_linesize + start_x * sizeof(pixel);
  17952. + buf -= block_h * buf_linesize + start_x * (ptrdiff_t)sizeof(pixel);
  17953. while (block_h--) {
  17954. pixel *bufp = (pixel *) buf;
  17955. diff --git a/media/ffvpx/libavcodec/vp8.c b/media/ffvpx/libavcodec/vp8.c
  17956. index 67f36d89..db2419de 100644
  17957. --- a/media/ffvpx/libavcodec/vp8.c
  17958. +++ b/media/ffvpx/libavcodec/vp8.c
  17959. @@ -2404,7 +2404,8 @@ static av_always_inline int decode_mb_row_no_filter(AVCodecContext *avctx, void
  17960. int num_jobs = s->num_jobs;
  17961. const VP8Frame *prev_frame = s->prev_frame;
  17962. VP8Frame *curframe = s->curframe;
  17963. - VPXRangeCoder *c = &s->coeff_partition[mb_y & (s->num_coeff_partitions - 1)];
  17964. + VPXRangeCoder *coeff_c = &s->coeff_partition[mb_y & (s->num_coeff_partitions - 1)];
  17965. +
  17966. VP8Macroblock *mb;
  17967. uint8_t *dst[3] = {
  17968. curframe->tf.f->data[0] + 16 * mb_y * s->linesize,
  17969. @@ -2412,7 +2413,7 @@ static av_always_inline int decode_mb_row_no_filter(AVCodecContext *avctx, void
  17970. curframe->tf.f->data[2] + 8 * mb_y * s->uvlinesize
  17971. };
  17972. - if (vpx_rac_is_end(c))
  17973. + if (vpx_rac_is_end(&s->c))
  17974. return AVERROR_INVALIDDATA;
  17975. if (mb_y == 0)
  17976. @@ -2443,7 +2444,7 @@ static av_always_inline int decode_mb_row_no_filter(AVCodecContext *avctx, void
  17977. td->mv_bounds.mv_max.x = ((s->mb_width - 1) << 6) + MARGIN;
  17978. for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb_xy++, mb++) {
  17979. - if (vpx_rac_is_end(c))
  17980. + if (vpx_rac_is_end(&s->c))
  17981. return AVERROR_INVALIDDATA;
  17982. // Wait for previous thread to read mb_x+2, and reach mb_y-1.
  17983. if (prev_td != td) {
  17984. @@ -2470,8 +2471,11 @@ static av_always_inline int decode_mb_row_no_filter(AVCodecContext *avctx, void
  17985. prefetch_motion(s, mb, mb_x, mb_y, mb_xy, VP8_FRAME_PREVIOUS);
  17986. - if (!mb->skip)
  17987. - decode_mb_coeffs(s, td, c, mb, s->top_nnz[mb_x], td->left_nnz, is_vp7);
  17988. + if (!mb->skip) {
  17989. + if (vpx_rac_is_end(coeff_c))
  17990. + return AVERROR_INVALIDDATA;
  17991. + decode_mb_coeffs(s, td, coeff_c, mb, s->top_nnz[mb_x], td->left_nnz, is_vp7);
  17992. + }
  17993. if (mb->mode <= MODE_I4x4)
  17994. intra_predict(s, td, dst, mb, mb_x, mb_y, is_vp7);
  17995. diff --git a/media/ffvpx/libavcodec/x86/fft.asm b/media/ffvpx/libavcodec/x86/fft.asm
  17996. index a44596e5..34c3fc9a 100644
  17997. --- a/media/ffvpx/libavcodec/x86/fft.asm
  17998. +++ b/media/ffvpx/libavcodec/x86/fft.asm
  17999. @@ -475,7 +475,7 @@ cglobal fft_calc, 2,5,8
  18000. mov r0, r1
  18001. mov r1, r3
  18002. FFT_DISPATCH _interleave %+ SUFFIX, r1
  18003. - REP_RET
  18004. + RET
  18005. %endif
  18006. @@ -510,7 +510,7 @@ cglobal fft_calc, 2,5,8
  18007. add r2, mmsize*2
  18008. jl .loop
  18009. .end:
  18010. - REP_RET
  18011. + RET
  18012. cglobal fft_permute, 2,7,1
  18013. mov r4, [r0 + FFTContext.revtab]
  18014. @@ -543,7 +543,7 @@ cglobal fft_permute, 2,7,1
  18015. movaps [r1 + r2 + 16], xmm1
  18016. add r2, 32
  18017. jl .loopcopy
  18018. - REP_RET
  18019. + RET
  18020. INIT_XMM sse
  18021. cglobal imdct_calc, 3,5,3
  18022. @@ -583,7 +583,7 @@ cglobal imdct_calc, 3,5,3
  18023. sub r3, mmsize
  18024. add r2, mmsize
  18025. jl .loop
  18026. - REP_RET
  18027. + RET
  18028. %ifdef PIC
  18029. %define SECTION_REL - $$
  18030. diff --git a/media/ffvpx/libavcodec/x86/flacdsp.asm b/media/ffvpx/libavcodec/x86/flacdsp.asm
  18031. index 6d755f49..44416e4d 100644
  18032. --- a/media/ffvpx/libavcodec/x86/flacdsp.asm
  18033. +++ b/media/ffvpx/libavcodec/x86/flacdsp.asm
  18034. @@ -79,7 +79,7 @@ ALIGN 16
  18035. movd [decodedq+4], m1
  18036. jg .loop_sample
  18037. .ret:
  18038. - REP_RET
  18039. + RET
  18040. %endmacro
  18041. %if HAVE_XOP_EXTERNAL
  18042. @@ -133,7 +133,7 @@ align 16
  18043. mova [outq + lenq], m%2
  18044. add lenq, 16
  18045. jl .loop
  18046. - REP_RET
  18047. + RET
  18048. %endmacro
  18049. INIT_XMM sse2
  18050. @@ -177,7 +177,7 @@ align 16
  18051. add outq, mmsize*2
  18052. sub lend, mmsize/4
  18053. jg .loop
  18054. - REP_RET
  18055. + RET
  18056. %endmacro
  18057. INIT_XMM sse2
  18058. @@ -302,7 +302,7 @@ align 16
  18059. add outq, mmsize*REPCOUNT
  18060. sub lend, mmsize/4
  18061. jg .loop
  18062. - REP_RET
  18063. + RET
  18064. %endmacro
  18065. INIT_XMM ssse3
  18066. diff --git a/media/ffvpx/libavcodec/x86/h264_intrapred.asm b/media/ffvpx/libavcodec/x86/h264_intrapred.asm
  18067. index 31840a14..8a38ba2b 100644
  18068. --- a/media/ffvpx/libavcodec/x86/h264_intrapred.asm
  18069. +++ b/media/ffvpx/libavcodec/x86/h264_intrapred.asm
  18070. @@ -62,7 +62,7 @@ cglobal pred16x16_vertical_8, 2,3
  18071. lea r0, [r0+r1*2]
  18072. dec r2
  18073. jg .loop
  18074. - REP_RET
  18075. + RET
  18076. ;-----------------------------------------------------------------------------
  18077. ; void ff_pred16x16_horizontal_8(uint8_t *src, ptrdiff_t stride)
  18078. @@ -95,7 +95,7 @@ cglobal pred16x16_horizontal_8, 2,3
  18079. lea r0, [r0+r1*2]
  18080. dec r2
  18081. jg .loop
  18082. - REP_RET
  18083. + RET
  18084. %endmacro
  18085. INIT_MMX mmxext
  18086. @@ -146,7 +146,7 @@ cglobal pred16x16_dc_8, 2,7
  18087. lea r4, [r4+r1*2]
  18088. dec r3d
  18089. jg .loop
  18090. - REP_RET
  18091. + RET
  18092. %endmacro
  18093. INIT_XMM sse2
  18094. @@ -192,7 +192,7 @@ cglobal pred16x16_tm_vp8_8, 2,6,6
  18095. lea r0, [r0+r1*2]
  18096. dec r5d
  18097. jg .loop
  18098. - REP_RET
  18099. + RET
  18100. %if HAVE_AVX2_EXTERNAL
  18101. INIT_YMM avx2
  18102. @@ -228,7 +228,7 @@ cglobal pred16x16_tm_vp8_8, 2, 4, 5, dst, stride, stride3, iteration
  18103. lea dstq, [dstq+strideq*4]
  18104. dec iterationd
  18105. jg .loop
  18106. - REP_RET
  18107. + RET
  18108. %endif
  18109. ;-----------------------------------------------------------------------------
  18110. @@ -427,7 +427,7 @@ cglobal pred16x16_plane_%1_8, 2,9,7
  18111. lea r0, [r0+r2*2]
  18112. dec r4
  18113. jg .loop
  18114. - REP_RET
  18115. + RET
  18116. %endmacro
  18117. INIT_XMM sse2
  18118. @@ -556,7 +556,7 @@ ALIGN 16
  18119. lea r0, [r0+r2*2]
  18120. dec r4
  18121. jg .loop
  18122. - REP_RET
  18123. + RET
  18124. %endmacro
  18125. INIT_XMM sse2
  18126. @@ -599,7 +599,7 @@ cglobal pred8x8_horizontal_8, 2,3
  18127. lea r0, [r0+r1*2]
  18128. dec r2
  18129. jg .loop
  18130. - REP_RET
  18131. + RET
  18132. %endmacro
  18133. INIT_MMX mmxext
  18134. @@ -737,7 +737,7 @@ cglobal pred8x8_dc_rv40_8, 2,7
  18135. lea r4, [r4+r1*2]
  18136. dec r3d
  18137. jg .loop
  18138. - REP_RET
  18139. + RET
  18140. ;-----------------------------------------------------------------------------
  18141. ; void ff_pred8x8_tm_vp8_8(uint8_t *src, ptrdiff_t stride)
  18142. @@ -770,7 +770,7 @@ cglobal pred8x8_tm_vp8_8, 2,6,4
  18143. lea r0, [r0+r1*2]
  18144. dec r5d
  18145. jg .loop
  18146. - REP_RET
  18147. + RET
  18148. INIT_XMM ssse3
  18149. cglobal pred8x8_tm_vp8_8, 2,3,6
  18150. @@ -797,7 +797,7 @@ cglobal pred8x8_tm_vp8_8, 2,3,6
  18151. lea r0, [r0+r1*2]
  18152. dec r2d
  18153. jg .loop
  18154. - REP_RET
  18155. + RET
  18156. ; dest, left, right, src, tmp
  18157. ; output: %1 = (t[n-1] + t[n]*2 + t[n+1] + 2) >> 2
  18158. @@ -1802,7 +1802,7 @@ cglobal pred4x4_tm_vp8_8, 3,6
  18159. lea r0, [r0+r2*2]
  18160. dec r5d
  18161. jg .loop
  18162. - REP_RET
  18163. + RET
  18164. INIT_XMM ssse3
  18165. cglobal pred4x4_tm_vp8_8, 3,3
  18166. diff --git a/media/ffvpx/libavcodec/x86/h264_intrapred_10bit.asm b/media/ffvpx/libavcodec/x86/h264_intrapred_10bit.asm
  18167. index c4645d43..2f308073 100644
  18168. --- a/media/ffvpx/libavcodec/x86/h264_intrapred_10bit.asm
  18169. +++ b/media/ffvpx/libavcodec/x86/h264_intrapred_10bit.asm
  18170. @@ -327,7 +327,7 @@ cglobal pred8x8_horizontal_10, 2, 3
  18171. lea r0, [r0+r1*2]
  18172. dec r2d
  18173. jg .loop
  18174. - REP_RET
  18175. + RET
  18176. ;-----------------------------------------------------------------------------
  18177. ; void ff_predict_8x8_dc_10(pixel *src, ptrdiff_t stride)
  18178. @@ -481,7 +481,7 @@ cglobal pred8x8_plane_10, 2, 7, 7
  18179. add r0, r1
  18180. dec r2d
  18181. jg .loop
  18182. - REP_RET
  18183. + RET
  18184. ;-----------------------------------------------------------------------------
  18185. @@ -994,7 +994,7 @@ cglobal pred16x16_vertical_10, 2, 3
  18186. lea r0, [r0+r1*2]
  18187. dec r2d
  18188. jg .loop
  18189. - REP_RET
  18190. + RET
  18191. ;-----------------------------------------------------------------------------
  18192. ; void ff_pred16x16_horizontal_10(pixel *src, ptrdiff_t stride)
  18193. @@ -1012,7 +1012,7 @@ cglobal pred16x16_horizontal_10, 2, 3
  18194. lea r0, [r0+r1*2]
  18195. dec r2d
  18196. jg .vloop
  18197. - REP_RET
  18198. + RET
  18199. ;-----------------------------------------------------------------------------
  18200. ; void ff_pred16x16_dc_10(pixel *src, ptrdiff_t stride)
  18201. @@ -1048,7 +1048,7 @@ cglobal pred16x16_dc_10, 2, 6
  18202. lea r5, [r5+r1*2]
  18203. dec r3d
  18204. jg .loop
  18205. - REP_RET
  18206. + RET
  18207. ;-----------------------------------------------------------------------------
  18208. ; void ff_pred16x16_top_dc_10(pixel *src, ptrdiff_t stride)
  18209. @@ -1070,7 +1070,7 @@ cglobal pred16x16_top_dc_10, 2, 3
  18210. lea r0, [r0+r1*2]
  18211. dec r2d
  18212. jg .loop
  18213. - REP_RET
  18214. + RET
  18215. ;-----------------------------------------------------------------------------
  18216. ; void ff_pred16x16_left_dc_10(pixel *src, ptrdiff_t stride)
  18217. @@ -1101,7 +1101,7 @@ cglobal pred16x16_left_dc_10, 2, 6
  18218. lea r5, [r5+r1*2]
  18219. dec r3d
  18220. jg .loop
  18221. - REP_RET
  18222. + RET
  18223. ;-----------------------------------------------------------------------------
  18224. ; void ff_pred16x16_128_dc_10(pixel *src, ptrdiff_t stride)
  18225. @@ -1116,4 +1116,4 @@ cglobal pred16x16_128_dc_10, 2,3
  18226. lea r0, [r0+r1*2]
  18227. dec r2d
  18228. jg .loop
  18229. - REP_RET
  18230. + RET
  18231. diff --git a/media/ffvpx/libavcodec/x86/videodsp.asm b/media/ffvpx/libavcodec/x86/videodsp.asm
  18232. index b19a8300..3cc07878 100644
  18233. --- a/media/ffvpx/libavcodec/x86/videodsp.asm
  18234. +++ b/media/ffvpx/libavcodec/x86/videodsp.asm
  18235. @@ -433,4 +433,4 @@ cglobal prefetch, 3, 3, 0, buf, stride, h
  18236. add bufq, strideq
  18237. dec hd
  18238. jg .loop
  18239. - REP_RET
  18240. + RET
  18241. diff --git a/media/ffvpx/libavcodec/x86/vp8dsp.asm b/media/ffvpx/libavcodec/x86/vp8dsp.asm
  18242. index 33d488bf..6ac5a772 100644
  18243. --- a/media/ffvpx/libavcodec/x86/vp8dsp.asm
  18244. +++ b/media/ffvpx/libavcodec/x86/vp8dsp.asm
  18245. @@ -200,7 +200,7 @@ cglobal put_vp8_epel%1_h6, 6, 6 + npicregs, 8, dst, dststride, src, srcstride, h
  18246. add srcq, srcstrideq
  18247. dec heightd ; next row
  18248. jg .nextrow
  18249. - REP_RET
  18250. + RET
  18251. cglobal put_vp8_epel%1_h4, 6, 6 + npicregs, 7, dst, dststride, src, srcstride, height, mx, picreg
  18252. shl mxd, 4
  18253. @@ -230,7 +230,7 @@ cglobal put_vp8_epel%1_h4, 6, 6 + npicregs, 7, dst, dststride, src, srcstride, h
  18254. add srcq, srcstrideq
  18255. dec heightd ; next row
  18256. jg .nextrow
  18257. - REP_RET
  18258. + RET
  18259. cglobal put_vp8_epel%1_v4, 7, 7, 8, dst, dststride, src, srcstride, height, picreg, my
  18260. shl myd, 4
  18261. @@ -268,7 +268,7 @@ cglobal put_vp8_epel%1_v4, 7, 7, 8, dst, dststride, src, srcstride, height, picr
  18262. add srcq, srcstrideq
  18263. dec heightd ; next row
  18264. jg .nextrow
  18265. - REP_RET
  18266. + RET
  18267. cglobal put_vp8_epel%1_v6, 7, 7, 8, dst, dststride, src, srcstride, height, picreg, my
  18268. lea myd, [myq*3]
  18269. @@ -314,7 +314,7 @@ cglobal put_vp8_epel%1_v6, 7, 7, 8, dst, dststride, src, srcstride, height, picr
  18270. add srcq, srcstrideq
  18271. dec heightd ; next row
  18272. jg .nextrow
  18273. - REP_RET
  18274. + RET
  18275. %endmacro
  18276. INIT_MMX ssse3
  18277. @@ -368,7 +368,7 @@ cglobal put_vp8_epel4_h4, 6, 6 + npicregs, 0, dst, dststride, src, srcstride, he
  18278. add srcq, srcstrideq
  18279. dec heightd ; next row
  18280. jg .nextrow
  18281. - REP_RET
  18282. + RET
  18283. ; 4x4 block, H-only 6-tap filter
  18284. INIT_MMX mmxext
  18285. @@ -426,7 +426,7 @@ cglobal put_vp8_epel4_h6, 6, 6 + npicregs, 0, dst, dststride, src, srcstride, he
  18286. add srcq, srcstrideq
  18287. dec heightd ; next row
  18288. jg .nextrow
  18289. - REP_RET
  18290. + RET
  18291. INIT_XMM sse2
  18292. cglobal put_vp8_epel8_h4, 6, 6 + npicregs, 10, dst, dststride, src, srcstride, height, mx, picreg
  18293. @@ -474,7 +474,7 @@ cglobal put_vp8_epel8_h4, 6, 6 + npicregs, 10, dst, dststride, src, srcstride, h
  18294. add srcq, srcstrideq
  18295. dec heightd ; next row
  18296. jg .nextrow
  18297. - REP_RET
  18298. + RET
  18299. INIT_XMM sse2
  18300. cglobal put_vp8_epel8_h6, 6, 6 + npicregs, 14, dst, dststride, src, srcstride, height, mx, picreg
  18301. @@ -537,7 +537,7 @@ cglobal put_vp8_epel8_h6, 6, 6 + npicregs, 14, dst, dststride, src, srcstride, h
  18302. add srcq, srcstrideq
  18303. dec heightd ; next row
  18304. jg .nextrow
  18305. - REP_RET
  18306. + RET
  18307. %macro FILTER_V 1
  18308. ; 4x4 block, V-only 4-tap filter
  18309. @@ -590,7 +590,7 @@ cglobal put_vp8_epel%1_v4, 7, 7, 8, dst, dststride, src, srcstride, height, picr
  18310. add srcq, srcstrideq
  18311. dec heightd ; next row
  18312. jg .nextrow
  18313. - REP_RET
  18314. + RET
  18315. ; 4x4 block, V-only 6-tap filter
  18316. @@ -655,7 +655,7 @@ cglobal put_vp8_epel%1_v6, 7, 7, 8, dst, dststride, src, srcstride, height, picr
  18317. add srcq, srcstrideq
  18318. dec heightd ; next row
  18319. jg .nextrow
  18320. - REP_RET
  18321. + RET
  18322. %endmacro
  18323. INIT_MMX mmxext
  18324. @@ -738,7 +738,7 @@ cglobal put_vp8_bilinear%1_v, 7, 7, 7, dst, dststride, src, srcstride, height, p
  18325. lea srcq, [srcq+srcstrideq*2]
  18326. sub heightd, 2
  18327. jg .nextrow
  18328. - REP_RET
  18329. + RET
  18330. %if cpuflag(ssse3)
  18331. cglobal put_vp8_bilinear%1_h, 6, 6 + npicregs, 5, dst, dststride, src, srcstride, height, mx, picreg
  18332. @@ -815,7 +815,7 @@ cglobal put_vp8_bilinear%1_h, 6, 6 + npicregs, 7, dst, dststride, src, srcstride
  18333. lea srcq, [srcq+srcstrideq*2]
  18334. sub heightd, 2
  18335. jg .nextrow
  18336. - REP_RET
  18337. + RET
  18338. %endmacro
  18339. INIT_MMX mmxext
  18340. @@ -838,7 +838,7 @@ cglobal put_vp8_pixels8, 5, 5, 0, dst, dststride, src, srcstride, height
  18341. lea dstq, [dstq+dststrideq*2]
  18342. sub heightd, 2
  18343. jg .nextrow
  18344. - REP_RET
  18345. + RET
  18346. INIT_XMM sse
  18347. cglobal put_vp8_pixels16, 5, 5, 2, dst, dststride, src, srcstride, height
  18348. @@ -851,7 +851,7 @@ cglobal put_vp8_pixels16, 5, 5, 2, dst, dststride, src, srcstride, height
  18349. lea dstq, [dstq+dststrideq*2]
  18350. sub heightd, 2
  18351. jg .nextrow
  18352. - REP_RET
  18353. + RET
  18354. ;-----------------------------------------------------------------------------
  18355. ; void ff_vp8_idct_dc_add_<opt>(uint8_t *dst, int16_t block[16], ptrdiff_t stride);
  18356. diff --git a/media/ffvpx/libavutil/avstring.c b/media/ffvpx/libavutil/avstring.c
  18357. index 5ddbe921..e460b5be 100644
  18358. --- a/media/ffvpx/libavutil/avstring.c
  18359. +++ b/media/ffvpx/libavutil/avstring.c
  18360. @@ -139,16 +139,6 @@ end:
  18361. return p;
  18362. }
  18363. -#if FF_API_D2STR
  18364. -char *av_d2str(double d)
  18365. -{
  18366. - char *str = av_malloc(16);
  18367. - if (str)
  18368. - snprintf(str, 16, "%f", d);
  18369. - return str;
  18370. -}
  18371. -#endif
  18372. -
  18373. #define WHITESPACES " \n\t\r"
  18374. char *av_get_token(const char **buf, const char *term)
  18375. diff --git a/media/ffvpx/libavutil/avstring.h b/media/ffvpx/libavutil/avstring.h
  18376. index 74aa4cd0..e2602637 100644
  18377. --- a/media/ffvpx/libavutil/avstring.h
  18378. +++ b/media/ffvpx/libavutil/avstring.h
  18379. @@ -157,15 +157,6 @@ static inline size_t av_strnlen(const char *s, size_t len)
  18380. */
  18381. char *av_asprintf(const char *fmt, ...) av_printf_format(1, 2);
  18382. -#if FF_API_D2STR
  18383. -/**
  18384. - * Convert a number to an av_malloced string.
  18385. - * @deprecated use av_asprintf() with "%f" or a more specific format
  18386. - */
  18387. -attribute_deprecated
  18388. -char *av_d2str(double d);
  18389. -#endif
  18390. -
  18391. /**
  18392. * Unescape the given string until a non escaped terminating char,
  18393. * and return the token corresponding to the unescaped string.
  18394. diff --git a/media/ffvpx/libavutil/avutil.symbols b/media/ffvpx/libavutil/avutil.symbols
  18395. index f3081a02..aefd9b73 100644
  18396. --- a/media/ffvpx/libavutil/avutil.symbols
  18397. +++ b/media/ffvpx/libavutil/avutil.symbols
  18398. @@ -54,7 +54,6 @@ av_crc
  18399. av_crc_get_table
  18400. av_crc_init
  18401. av_d2q
  18402. -av_d2str
  18403. av_default_get_category
  18404. av_default_item_name
  18405. av_dict_copy
  18406. @@ -62,6 +61,7 @@ av_dict_count
  18407. av_dict_free
  18408. av_dict_get
  18409. av_dict_get_string
  18410. +av_dict_iterate
  18411. av_dict_parse_string
  18412. av_dict_set
  18413. av_dict_set_int
  18414. @@ -134,7 +134,6 @@ av_get_channel_layout_channel_index
  18415. av_get_channel_layout_nb_channels
  18416. av_get_channel_layout_string
  18417. av_get_channel_name
  18418. -av_get_colorspace_name
  18419. av_get_cpu_flags
  18420. av_get_default_channel_layout
  18421. av_get_known_color_name
  18422. @@ -325,4 +324,3 @@ av_hwdevice_ctx_init
  18423. av_hwframe_transfer_get_formats
  18424. av_hwdevice_ctx_create_derived
  18425. av_malloc_array
  18426. -av_mallocz_array
  18427. diff --git a/media/ffvpx/libavutil/channel_layout.c b/media/ffvpx/libavutil/channel_layout.c
  18428. index 5af7ea0e..e2f75122 100644
  18429. --- a/media/ffvpx/libavutil/channel_layout.c
  18430. +++ b/media/ffvpx/libavutil/channel_layout.c
  18431. @@ -196,6 +196,7 @@ static const struct channel_layout_name channel_layout_map[] = {
  18432. { "7.1", AV_CHANNEL_LAYOUT_7POINT1 },
  18433. { "7.1(wide)", AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK },
  18434. { "7.1(wide-side)", AV_CHANNEL_LAYOUT_7POINT1_WIDE },
  18435. + { "7.1(top)", AV_CHANNEL_LAYOUT_7POINT1_TOP_BACK },
  18436. { "octagonal", AV_CHANNEL_LAYOUT_OCTAGONAL },
  18437. { "cube", AV_CHANNEL_LAYOUT_CUBE },
  18438. { "hexadecagonal", AV_CHANNEL_LAYOUT_HEXADECAGONAL },
  18439. diff --git a/media/ffvpx/libavutil/channel_layout.h b/media/ffvpx/libavutil/channel_layout.h
  18440. index 3e691633..f345415c 100644
  18441. --- a/media/ffvpx/libavutil/channel_layout.h
  18442. +++ b/media/ffvpx/libavutil/channel_layout.h
  18443. @@ -232,6 +232,7 @@ enum AVChannelOrder {
  18444. #define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
  18445. #define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
  18446. #define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
  18447. +#define AV_CH_LAYOUT_7POINT1_TOP_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT)
  18448. #define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT)
  18449. #define AV_CH_LAYOUT_CUBE (AV_CH_LAYOUT_QUAD|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT)
  18450. #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)
  18451. @@ -389,6 +390,7 @@ typedef struct AVChannelLayout {
  18452. #define AV_CHANNEL_LAYOUT_7POINT1 AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1)
  18453. #define AV_CHANNEL_LAYOUT_7POINT1_WIDE AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_WIDE)
  18454. #define AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_WIDE_BACK)
  18455. +#define AV_CHANNEL_LAYOUT_7POINT1_TOP_BACK AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_TOP_BACK)
  18456. #define AV_CHANNEL_LAYOUT_OCTAGONAL AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_OCTAGONAL)
  18457. #define AV_CHANNEL_LAYOUT_CUBE AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_CUBE)
  18458. #define AV_CHANNEL_LAYOUT_HEXADECAGONAL AV_CHANNEL_LAYOUT_MASK(16, AV_CH_LAYOUT_HEXADECAGONAL)
  18459. diff --git a/media/ffvpx/libavutil/dict.c b/media/ffvpx/libavutil/dict.c
  18460. index 14ad780a..f673977a 100644
  18461. --- a/media/ffvpx/libavutil/dict.c
  18462. +++ b/media/ffvpx/libavutil/dict.c
  18463. @@ -20,6 +20,7 @@
  18464. #include <string.h>
  18465. +#include "avassert.h"
  18466. #include "avstring.h"
  18467. #include "dict.h"
  18468. #include "dict_internal.h"
  18469. @@ -38,21 +39,35 @@ int av_dict_count(const AVDictionary *m)
  18470. return m ? m->count : 0;
  18471. }
  18472. -AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key,
  18473. - const AVDictionaryEntry *prev, int flags)
  18474. +const AVDictionaryEntry *av_dict_iterate(const AVDictionary *m,
  18475. + const AVDictionaryEntry *prev)
  18476. {
  18477. - unsigned int i, j;
  18478. + int i = 0;
  18479. - if (!m || !key)
  18480. + if (!m)
  18481. return NULL;
  18482. if (prev)
  18483. i = prev - m->elems + 1;
  18484. - else
  18485. - i = 0;
  18486. - for (; i < m->count; i++) {
  18487. - const char *s = m->elems[i].key;
  18488. + av_assert2(i >= 0);
  18489. + if (i >= m->count)
  18490. + return NULL;
  18491. +
  18492. + return &m->elems[i];
  18493. +}
  18494. +
  18495. +AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key,
  18496. + const AVDictionaryEntry *prev, int flags)
  18497. +{
  18498. + const AVDictionaryEntry *entry = prev;
  18499. + unsigned int j;
  18500. +
  18501. + if (!key)
  18502. + return NULL;
  18503. +
  18504. + while ((entry = av_dict_iterate(m, entry))) {
  18505. + const char *s = entry->key;
  18506. if (flags & AV_DICT_MATCH_CASE)
  18507. for (j = 0; s[j] == key[j] && key[j]; j++)
  18508. ;
  18509. @@ -63,7 +78,7 @@ AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key,
  18510. continue;
  18511. if (s[j] && !(flags & AV_DICT_IGNORE_SUFFIX))
  18512. continue;
  18513. - return &m->elems[i];
  18514. + return (AVDictionaryEntry *)entry;
  18515. }
  18516. return NULL;
  18517. }
  18518. @@ -221,9 +236,9 @@ void av_dict_free(AVDictionary **pm)
  18519. int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
  18520. {
  18521. - AVDictionaryEntry *t = NULL;
  18522. + const AVDictionaryEntry *t = NULL;
  18523. - while ((t = av_dict_get(src, "", t, AV_DICT_IGNORE_SUFFIX))) {
  18524. + while ((t = av_dict_iterate(src, t))) {
  18525. int ret = av_dict_set(dst, t->key, t->value, flags);
  18526. if (ret < 0)
  18527. return ret;
  18528. @@ -235,7 +250,7 @@ int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
  18529. int av_dict_get_string(const AVDictionary *m, char **buffer,
  18530. const char key_val_sep, const char pairs_sep)
  18531. {
  18532. - AVDictionaryEntry *t = NULL;
  18533. + const AVDictionaryEntry *t = NULL;
  18534. AVBPrint bprint;
  18535. int cnt = 0;
  18536. char special_chars[] = {pairs_sep, key_val_sep, '\0'};
  18537. @@ -250,7 +265,7 @@ int av_dict_get_string(const AVDictionary *m, char **buffer,
  18538. }
  18539. av_bprint_init(&bprint, 64, AV_BPRINT_SIZE_UNLIMITED);
  18540. - while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX))) {
  18541. + while ((t = av_dict_iterate(m, t))) {
  18542. if (cnt++)
  18543. av_bprint_append_data(&bprint, &pairs_sep, 1);
  18544. av_bprint_escape(&bprint, t->key, special_chars, AV_ESCAPE_MODE_BACKSLASH, 0);
  18545. diff --git a/media/ffvpx/libavutil/dict.h b/media/ffvpx/libavutil/dict.h
  18546. index 0d1afc6c..713c9e36 100644
  18547. --- a/media/ffvpx/libavutil/dict.h
  18548. +++ b/media/ffvpx/libavutil/dict.h
  18549. @@ -39,13 +39,15 @@
  18550. * @brief Simple key:value store
  18551. *
  18552. * @{
  18553. - * Dictionaries are used for storing key:value pairs. To create
  18554. - * an AVDictionary, simply pass an address of a NULL pointer to
  18555. - * av_dict_set(). NULL can be used as an empty dictionary wherever
  18556. - * a pointer to an AVDictionary is required.
  18557. - * Use av_dict_get() to retrieve an entry or iterate over all
  18558. - * entries and finally av_dict_free() to free the dictionary
  18559. - * and all its contents.
  18560. + * Dictionaries are used for storing key-value pairs.
  18561. + *
  18562. + * - To **create an AVDictionary**, simply pass an address of a NULL
  18563. + * pointer to av_dict_set(). NULL can be used as an empty dictionary
  18564. + * wherever a pointer to an AVDictionary is required.
  18565. + * - To **insert an entry**, use av_dict_set().
  18566. + * - Use av_dict_get() to **retrieve an entry**.
  18567. + * - To **iterate over all entries**, use av_dict_iterate().
  18568. + * - In order to **free the dictionary and all its contents**, use av_dict_free().
  18569. *
  18570. @code
  18571. AVDictionary *d = NULL; // "create" an empty dictionary
  18572. @@ -57,13 +59,18 @@
  18573. char *v = av_strdup("value"); // you can avoid copying them like this
  18574. av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL);
  18575. - while (t = av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX)) {
  18576. - <....> // iterate over all entries in d
  18577. + while ((t = av_dict_iterate(d, t))) {
  18578. + <....> // iterate over all entries in d
  18579. }
  18580. av_dict_free(&d);
  18581. @endcode
  18582. */
  18583. +/**
  18584. + * @name AVDictionary Flags
  18585. + * Flags that influence behavior of the matching of keys or insertion to the dictionary.
  18586. + * @{
  18587. + */
  18588. #define AV_DICT_MATCH_CASE 1 /**< Only get an entry with exact-case key match. Only relevant in av_dict_get(). */
  18589. #define AV_DICT_IGNORE_SUFFIX 2 /**< Return first entry in a dictionary whose first part corresponds to the search key,
  18590. ignoring the suffix of the found key string. Only relevant in av_dict_get(). */
  18591. @@ -71,10 +78,13 @@
  18592. allocated with av_malloc() or another memory allocation function. */
  18593. #define AV_DICT_DONT_STRDUP_VAL 8 /**< Take ownership of a value that's been
  18594. allocated with av_malloc() or another memory allocation function. */
  18595. -#define AV_DICT_DONT_OVERWRITE 16 ///< Don't overwrite existing entries.
  18596. +#define AV_DICT_DONT_OVERWRITE 16 /**< Don't overwrite existing entries. */
  18597. #define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no
  18598. - delimiter is added, the strings are simply concatenated. */
  18599. + delimiter is added, the strings are simply concatenated. */
  18600. #define AV_DICT_MULTIKEY 64 /**< Allow to store several equal keys in the dictionary */
  18601. +/**
  18602. + * @}
  18603. + */
  18604. typedef struct AVDictionaryEntry {
  18605. char *key;
  18606. @@ -89,18 +99,44 @@ typedef struct AVDictionary AVDictionary;
  18607. * The returned entry key or value must not be changed, or it will
  18608. * cause undefined behavior.
  18609. *
  18610. - * To iterate through all the dictionary entries, you can set the matching key
  18611. - * to the null string "" and set the AV_DICT_IGNORE_SUFFIX flag.
  18612. + * @param prev Set to the previous matching element to find the next.
  18613. + * If set to NULL the first matching element is returned.
  18614. + * @param key Matching key
  18615. + * @param flags A collection of AV_DICT_* flags controlling how the
  18616. + * entry is retrieved
  18617. *
  18618. - * @param prev Set to the previous matching element to find the next.
  18619. - * If set to NULL the first matching element is returned.
  18620. - * @param key matching key
  18621. - * @param flags a collection of AV_DICT_* flags controlling how the entry is retrieved
  18622. - * @return found entry or NULL in case no matching entry was found in the dictionary
  18623. + * @return Found entry or NULL in case no matching entry was found in the dictionary
  18624. */
  18625. AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key,
  18626. const AVDictionaryEntry *prev, int flags);
  18627. +/**
  18628. + * Iterate over a dictionary
  18629. + *
  18630. + * Iterates through all entries in the dictionary.
  18631. + *
  18632. + * @warning The returned AVDictionaryEntry key/value must not be changed.
  18633. + *
  18634. + * @warning As av_dict_set() invalidates all previous entries returned
  18635. + * by this function, it must not be called while iterating over the dict.
  18636. + *
  18637. + * Typical usage:
  18638. + * @code
  18639. + * const AVDictionaryEntry *e = NULL;
  18640. + * while ((e = av_dict_iterate(m, e))) {
  18641. + * // ...
  18642. + * }
  18643. + * @endcode
  18644. + *
  18645. + * @param m The dictionary to iterate over
  18646. + * @param prev Pointer to the previous AVDictionaryEntry, NULL initially
  18647. + *
  18648. + * @retval AVDictionaryEntry* The next element in the dictionary
  18649. + * @retval NULL No more elements in the dictionary
  18650. + */
  18651. +const AVDictionaryEntry *av_dict_iterate(const AVDictionary *m,
  18652. + const AVDictionaryEntry *prev);
  18653. +
  18654. /**
  18655. * Get number of entries in dictionary.
  18656. *
  18657. @@ -115,23 +151,24 @@ int av_dict_count(const AVDictionary *m);
  18658. * Note: If AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL is set,
  18659. * these arguments will be freed on error.
  18660. *
  18661. - * Warning: Adding a new entry to a dictionary invalidates all existing entries
  18662. - * previously returned with av_dict_get.
  18663. + * @warning Adding a new entry to a dictionary invalidates all existing entries
  18664. + * previously returned with av_dict_get() or av_dict_iterate().
  18665. *
  18666. - * @param pm pointer to a pointer to a dictionary struct. If *pm is NULL
  18667. - * a dictionary struct is allocated and put in *pm.
  18668. - * @param key entry key to add to *pm (will either be av_strduped or added as a new key depending on flags)
  18669. - * @param value entry value to add to *pm (will be av_strduped or added as a new key depending on flags).
  18670. - * Passing a NULL value will cause an existing entry to be deleted.
  18671. - * @return >= 0 on success otherwise an error code <0
  18672. + * @param pm Pointer to a pointer to a dictionary struct. If *pm is NULL
  18673. + * a dictionary struct is allocated and put in *pm.
  18674. + * @param key Entry key to add to *pm (will either be av_strduped or added as a new key depending on flags)
  18675. + * @param value Entry value to add to *pm (will be av_strduped or added as a new key depending on flags).
  18676. + * Passing a NULL value will cause an existing entry to be deleted.
  18677. + *
  18678. + * @return >= 0 on success otherwise an error code <0
  18679. */
  18680. int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags);
  18681. /**
  18682. - * Convenience wrapper for av_dict_set that converts the value to a string
  18683. + * Convenience wrapper for av_dict_set() that converts the value to a string
  18684. * and stores it.
  18685. *
  18686. - * Note: If AV_DICT_DONT_STRDUP_KEY is set, key will be freed on error.
  18687. + * Note: If ::AV_DICT_DONT_STRDUP_KEY is set, key will be freed on error.
  18688. */
  18689. int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags);
  18690. @@ -141,14 +178,15 @@ int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags
  18691. * In case of failure, all the successfully set entries are stored in
  18692. * *pm. You may need to manually free the created dictionary.
  18693. *
  18694. - * @param key_val_sep a 0-terminated list of characters used to separate
  18695. + * @param key_val_sep A 0-terminated list of characters used to separate
  18696. * key from value
  18697. - * @param pairs_sep a 0-terminated list of characters used to separate
  18698. + * @param pairs_sep A 0-terminated list of characters used to separate
  18699. * two pairs from each other
  18700. - * @param flags flags to use when adding to dictionary.
  18701. - * AV_DICT_DONT_STRDUP_KEY and AV_DICT_DONT_STRDUP_VAL
  18702. + * @param flags Flags to use when adding to the dictionary.
  18703. + * ::AV_DICT_DONT_STRDUP_KEY and ::AV_DICT_DONT_STRDUP_VAL
  18704. * are ignored since the key/value tokens will always
  18705. * be duplicated.
  18706. + *
  18707. * @return 0 on success, negative AVERROR code on failure
  18708. */
  18709. int av_dict_parse_string(AVDictionary **pm, const char *str,
  18710. @@ -157,11 +195,14 @@ int av_dict_parse_string(AVDictionary **pm, const char *str,
  18711. /**
  18712. * Copy entries from one AVDictionary struct into another.
  18713. - * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL,
  18714. - * this function will allocate a struct for you and put it in *dst
  18715. - * @param src pointer to source AVDictionary struct
  18716. - * @param flags flags to use when setting entries in *dst
  18717. - * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag
  18718. + *
  18719. + * @note Metadata is read using the ::AV_DICT_IGNORE_SUFFIX flag
  18720. + *
  18721. + * @param dst Pointer to a pointer to a AVDictionary struct to copy into. If *dst is NULL,
  18722. + * this function will allocate a struct for you and put it in *dst
  18723. + * @param src Pointer to the source AVDictionary struct to copy items from.
  18724. + * @param flags Flags to use when setting entries in *dst
  18725. + *
  18726. * @return 0 on success, negative AVERROR code on failure. If dst was allocated
  18727. * by this function, callers should free the associated memory.
  18728. */
  18729. @@ -180,13 +221,15 @@ void av_dict_free(AVDictionary **m);
  18730. * Such string may be passed back to av_dict_parse_string().
  18731. * @note String is escaped with backslashes ('\').
  18732. *
  18733. - * @param[in] m dictionary
  18734. + * @warning Separators cannot be neither '\\' nor '\0'. They also cannot be the same.
  18735. + *
  18736. + * @param[in] m The dictionary
  18737. * @param[out] buffer Pointer to buffer that will be allocated with string containg entries.
  18738. * Buffer must be freed by the caller when is no longer needed.
  18739. - * @param[in] key_val_sep character used to separate key from value
  18740. - * @param[in] pairs_sep character used to separate two pairs from each other
  18741. + * @param[in] key_val_sep Character used to separate key from value
  18742. + * @param[in] pairs_sep Character used to separate two pairs from each other
  18743. + *
  18744. * @return >= 0 on success, negative on error
  18745. - * @warning Separators cannot be neither '\\' nor '\0'. They also cannot be the same.
  18746. */
  18747. int av_dict_get_string(const AVDictionary *m, char **buffer,
  18748. const char key_val_sep, const char pairs_sep);
  18749. diff --git a/media/ffvpx/libavutil/ffversion.h b/media/ffvpx/libavutil/ffversion.h
  18750. index 05d052c9..21f6614f 100644
  18751. --- a/media/ffvpx/libavutil/ffversion.h
  18752. +++ b/media/ffvpx/libavutil/ffversion.h
  18753. @@ -1,5 +1,5 @@
  18754. /* Automatically generated by version.sh, do not manually edit! */
  18755. #ifndef AVUTIL_FFVERSION_H
  18756. #define AVUTIL_FFVERSION_H
  18757. -#define FFMPEG_VERSION "N-107213-gfed07efcde"
  18758. +#define FFMPEG_VERSION "N-109117-g6a3e174ad1"
  18759. #endif /* AVUTIL_FFVERSION_H */
  18760. diff --git a/media/ffvpx/libavutil/frame.c b/media/ffvpx/libavutil/frame.c
  18761. index de4ad1f9..9545477a 100644
  18762. --- a/media/ffvpx/libavutil/frame.c
  18763. +++ b/media/ffvpx/libavutil/frame.c
  18764. @@ -35,23 +35,6 @@
  18765. av_get_channel_layout_nb_channels((frame)->channel_layout))
  18766. #endif
  18767. -#if FF_API_COLORSPACE_NAME
  18768. -const char *av_get_colorspace_name(enum AVColorSpace val)
  18769. -{
  18770. - static const char * const name[] = {
  18771. - [AVCOL_SPC_RGB] = "GBR",
  18772. - [AVCOL_SPC_BT709] = "bt709",
  18773. - [AVCOL_SPC_FCC] = "fcc",
  18774. - [AVCOL_SPC_BT470BG] = "bt470bg",
  18775. - [AVCOL_SPC_SMPTE170M] = "smpte170m",
  18776. - [AVCOL_SPC_SMPTE240M] = "smpte240m",
  18777. - [AVCOL_SPC_YCOCG] = "YCgCo",
  18778. - };
  18779. - if ((unsigned)val >= FF_ARRAY_ELEMS(name))
  18780. - return NULL;
  18781. - return name[val];
  18782. -}
  18783. -#endif
  18784. static void get_frame_defaults(AVFrame *frame)
  18785. {
  18786. memset(frame, 0, sizeof(*frame));
  18787. @@ -304,11 +287,19 @@ FF_DISABLE_DEPRECATION_WARNINGS
  18788. FF_ENABLE_DEPRECATION_WARNINGS
  18789. #endif
  18790. dst->time_base = src->time_base;
  18791. +#if FF_API_REORDERED_OPAQUE
  18792. +FF_DISABLE_DEPRECATION_WARNINGS
  18793. dst->reordered_opaque = src->reordered_opaque;
  18794. +FF_ENABLE_DEPRECATION_WARNINGS
  18795. +#endif
  18796. dst->quality = src->quality;
  18797. dst->best_effort_timestamp = src->best_effort_timestamp;
  18798. +#if FF_API_FRAME_PICTURE_NUMBER
  18799. +FF_DISABLE_DEPRECATION_WARNINGS
  18800. dst->coded_picture_number = src->coded_picture_number;
  18801. dst->display_picture_number = src->display_picture_number;
  18802. +FF_ENABLE_DEPRECATION_WARNINGS
  18803. +#endif
  18804. dst->flags = src->flags;
  18805. dst->decode_error_flags = src->decode_error_flags;
  18806. dst->color_primaries = src->color_primaries;
  18807. @@ -831,6 +822,7 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type)
  18808. case AV_FRAME_DATA_DETECTION_BBOXES: return "Bounding boxes for object detection and classification";
  18809. case AV_FRAME_DATA_DOVI_RPU_BUFFER: return "Dolby Vision RPU Data";
  18810. case AV_FRAME_DATA_DOVI_METADATA: return "Dolby Vision Metadata";
  18811. + case AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT: return "Ambient viewing environment";
  18812. }
  18813. return NULL;
  18814. }
  18815. diff --git a/media/ffvpx/libavutil/frame.h b/media/ffvpx/libavutil/frame.h
  18816. index e60a82f6..25802695 100644
  18817. --- a/media/ffvpx/libavutil/frame.h
  18818. +++ b/media/ffvpx/libavutil/frame.h
  18819. @@ -209,6 +209,11 @@ enum AVFrameSideDataType {
  18820. * volume transform - CUVA 005.1-2021.
  18821. */
  18822. AV_FRAME_DATA_DYNAMIC_HDR_VIVID,
  18823. +
  18824. + /**
  18825. + * Ambient viewing environment metadata, as defined by H.274.
  18826. + */
  18827. + AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT,
  18828. };
  18829. enum AVActiveFormatDescription {
  18830. @@ -446,14 +451,18 @@ typedef struct AVFrame {
  18831. */
  18832. AVRational time_base;
  18833. +#if FF_API_FRAME_PICTURE_NUMBER
  18834. /**
  18835. * picture number in bitstream order
  18836. */
  18837. + attribute_deprecated
  18838. int coded_picture_number;
  18839. /**
  18840. * picture number in display order
  18841. */
  18842. + attribute_deprecated
  18843. int display_picture_number;
  18844. +#endif
  18845. /**
  18846. * quality (between 1 (good) and FF_LAMBDA_MAX (bad))
  18847. @@ -486,6 +495,7 @@ typedef struct AVFrame {
  18848. */
  18849. int palette_has_changed;
  18850. +#if FF_API_REORDERED_OPAQUE
  18851. /**
  18852. * reordered opaque 64 bits (generally an integer or a double precision float
  18853. * PTS but can be anything).
  18854. @@ -493,8 +503,12 @@ typedef struct AVFrame {
  18855. * that time,
  18856. * the decoder reorders values as needed and sets AVFrame.reordered_opaque
  18857. * to exactly one of the values provided by the user through AVCodecContext.reordered_opaque
  18858. + *
  18859. + * @deprecated Use AV_CODEC_FLAG_COPY_OPAQUE instead
  18860. */
  18861. + attribute_deprecated
  18862. int64_t reordered_opaque;
  18863. +#endif
  18864. /**
  18865. * Sample rate of the audio data.
  18866. @@ -715,15 +729,6 @@ typedef struct AVFrame {
  18867. } AVFrame;
  18868. -#if FF_API_COLORSPACE_NAME
  18869. -/**
  18870. - * Get the name of a colorspace.
  18871. - * @return a static string identifying the colorspace; can be NULL.
  18872. - * @deprecated use av_color_space_name()
  18873. - */
  18874. -attribute_deprecated
  18875. -const char *av_get_colorspace_name(enum AVColorSpace val);
  18876. -#endif
  18877. /**
  18878. * Allocate an AVFrame and set its fields to default values. The resulting
  18879. * struct must be freed using av_frame_free().
  18880. diff --git a/media/ffvpx/libavutil/hwcontext.c b/media/ffvpx/libavutil/hwcontext.c
  18881. index ab9ad370..33965982 100644
  18882. --- a/media/ffvpx/libavutil/hwcontext.c
  18883. +++ b/media/ffvpx/libavutil/hwcontext.c
  18884. @@ -397,10 +397,14 @@ int av_hwframe_transfer_get_formats(AVBufferRef *hwframe_ref,
  18885. static int transfer_data_alloc(AVFrame *dst, const AVFrame *src, int flags)
  18886. {
  18887. - AVHWFramesContext *ctx = (AVHWFramesContext*)src->hw_frames_ctx->data;
  18888. + AVHWFramesContext *ctx;
  18889. AVFrame *frame_tmp;
  18890. int ret = 0;
  18891. + if (!src->hw_frames_ctx)
  18892. + return AVERROR(EINVAL);
  18893. + ctx = (AVHWFramesContext*)src->hw_frames_ctx->data;
  18894. +
  18895. frame_tmp = av_frame_alloc();
  18896. if (!frame_tmp)
  18897. return AVERROR(ENOMEM);
  18898. diff --git a/media/ffvpx/libavutil/hwcontext_vaapi.c b/media/ffvpx/libavutil/hwcontext_vaapi.c
  18899. index 997c0033..de30a919 100644
  18900. --- a/media/ffvpx/libavutil/hwcontext_vaapi.c
  18901. +++ b/media/ffvpx/libavutil/hwcontext_vaapi.c
  18902. @@ -1321,8 +1321,17 @@ static int vaapi_map_to_drm_esh(AVHWFramesContext *hwfc, AVFrame *dst,
  18903. surface_id = (VASurfaceID)(uintptr_t)src->data[3];
  18904. export_flags = VA_EXPORT_SURFACE_SEPARATE_LAYERS;
  18905. - if (flags & AV_HWFRAME_MAP_READ)
  18906. + if (flags & AV_HWFRAME_MAP_READ) {
  18907. export_flags |= VA_EXPORT_SURFACE_READ_ONLY;
  18908. +
  18909. + vas = vaSyncSurface(hwctx->display, surface_id);
  18910. + if (vas != VA_STATUS_SUCCESS) {
  18911. + av_log(hwfc, AV_LOG_ERROR, "Failed to sync surface "
  18912. + "%#x: %d (%s).\n", surface_id, vas, vaErrorStr(vas));
  18913. + return AVERROR(EIO);
  18914. + }
  18915. + }
  18916. +
  18917. if (flags & AV_HWFRAME_MAP_WRITE)
  18918. export_flags |= VA_EXPORT_SURFACE_WRITE_ONLY;
  18919. @@ -1702,6 +1711,7 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device,
  18920. char path[64];
  18921. int n, max_devices = 8;
  18922. #if CONFIG_LIBDRM
  18923. + drmVersion *info;
  18924. const AVDictionaryEntry *kernel_driver;
  18925. kernel_driver = av_dict_get(opts, "kernel_driver", NULL, 0);
  18926. #endif
  18927. @@ -1715,9 +1725,15 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device,
  18928. break;
  18929. }
  18930. #if CONFIG_LIBDRM
  18931. + info = drmGetVersion(priv->drm_fd);
  18932. + if (!info) {
  18933. + av_log(ctx, AV_LOG_VERBOSE,
  18934. + "Failed to get DRM version for device %d.\n", n);
  18935. + close(priv->drm_fd);
  18936. + priv->drm_fd = -1;
  18937. + continue;
  18938. + }
  18939. if (kernel_driver) {
  18940. - drmVersion *info;
  18941. - info = drmGetVersion(priv->drm_fd);
  18942. if (strcmp(kernel_driver->value, info->name)) {
  18943. av_log(ctx, AV_LOG_VERBOSE, "Ignoring device %d "
  18944. "with non-matching kernel driver (%s).\n",
  18945. @@ -1732,12 +1748,20 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device,
  18946. "with matching kernel driver (%s).\n",
  18947. n, info->name);
  18948. drmFreeVersion(info);
  18949. - } else
  18950. -#endif
  18951. - {
  18952. - av_log(ctx, AV_LOG_VERBOSE, "Trying to use "
  18953. - "DRM render node for device %d.\n", n);
  18954. + break;
  18955. + // drmGetVersion() ensures |info->name| is 0-terminated.
  18956. + } else if (!strcmp(info->name, "vgem")) {
  18957. + av_log(ctx, AV_LOG_VERBOSE,
  18958. + "Skipping vgem node for device %d.\n", n);
  18959. + drmFreeVersion(info);
  18960. + close(priv->drm_fd);
  18961. + priv->drm_fd = -1;
  18962. + continue;
  18963. }
  18964. + drmFreeVersion(info);
  18965. +#endif
  18966. + av_log(ctx, AV_LOG_VERBOSE, "Trying to use "
  18967. + "DRM render node for device %d.\n", n);
  18968. break;
  18969. }
  18970. if (n >= max_devices)
  18971. diff --git a/media/ffvpx/libavutil/mem.c b/media/ffvpx/libavutil/mem.c
  18972. index 18aff529..36b8940a 100644
  18973. --- a/media/ffvpx/libavutil/mem.c
  18974. +++ b/media/ffvpx/libavutil/mem.c
  18975. @@ -212,16 +212,6 @@ void *av_malloc_array(size_t nmemb, size_t size)
  18976. return av_malloc(result);
  18977. }
  18978. -#if FF_API_AV_MALLOCZ_ARRAY
  18979. -void *av_mallocz_array(size_t nmemb, size_t size)
  18980. -{
  18981. - size_t result;
  18982. - if (size_mult(nmemb, size, &result) < 0)
  18983. - return NULL;
  18984. - return av_mallocz(result);
  18985. -}
  18986. -#endif
  18987. -
  18988. void *av_realloc_array(void *ptr, size_t nmemb, size_t size)
  18989. {
  18990. size_t result;
  18991. diff --git a/media/ffvpx/libavutil/mem.h b/media/ffvpx/libavutil/mem.h
  18992. index c9c4fcf1..62b4ca6e 100644
  18993. --- a/media/ffvpx/libavutil/mem.h
  18994. +++ b/media/ffvpx/libavutil/mem.h
  18995. @@ -51,86 +51,6 @@
  18996. * @{
  18997. */
  18998. -#if FF_API_DECLARE_ALIGNED
  18999. -/**
  19000. - *
  19001. - * @defgroup lavu_mem_macros Alignment Macros
  19002. - * Helper macros for declaring aligned variables.
  19003. - * @{
  19004. - */
  19005. -
  19006. -/**
  19007. - * @def DECLARE_ALIGNED(n,t,v)
  19008. - * Declare a variable that is aligned in memory.
  19009. - *
  19010. - * @code{.c}
  19011. - * DECLARE_ALIGNED(16, uint16_t, aligned_int) = 42;
  19012. - * DECLARE_ALIGNED(32, uint8_t, aligned_array)[128];
  19013. - *
  19014. - * // The default-alignment equivalent would be
  19015. - * uint16_t aligned_int = 42;
  19016. - * uint8_t aligned_array[128];
  19017. - * @endcode
  19018. - *
  19019. - * @param n Minimum alignment in bytes
  19020. - * @param t Type of the variable (or array element)
  19021. - * @param v Name of the variable
  19022. - */
  19023. -
  19024. -/**
  19025. - * @def DECLARE_ASM_ALIGNED(n,t,v)
  19026. - * Declare an aligned variable appropriate for use in inline assembly code.
  19027. - *
  19028. - * @code{.c}
  19029. - * DECLARE_ASM_ALIGNED(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008);
  19030. - * @endcode
  19031. - *
  19032. - * @param n Minimum alignment in bytes
  19033. - * @param t Type of the variable (or array element)
  19034. - * @param v Name of the variable
  19035. - */
  19036. -
  19037. -/**
  19038. - * @def DECLARE_ASM_CONST(n,t,v)
  19039. - * Declare a static constant aligned variable appropriate for use in inline
  19040. - * assembly code.
  19041. - *
  19042. - * @code{.c}
  19043. - * DECLARE_ASM_CONST(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008);
  19044. - * @endcode
  19045. - *
  19046. - * @param n Minimum alignment in bytes
  19047. - * @param t Type of the variable (or array element)
  19048. - * @param v Name of the variable
  19049. - */
  19050. -
  19051. -#if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C)
  19052. - #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
  19053. - #define DECLARE_ASM_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
  19054. - #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v
  19055. -#elif defined(__DJGPP__)
  19056. - #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (FFMIN(n, 16)))) v
  19057. - #define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v
  19058. - #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v
  19059. -#elif defined(__GNUC__) || defined(__clang__)
  19060. - #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
  19061. - #define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (n))) v
  19062. - #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (n))) v
  19063. -#elif defined(_MSC_VER)
  19064. - #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v
  19065. - #define DECLARE_ASM_ALIGNED(n,t,v) __declspec(align(n)) t v
  19066. - #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v
  19067. -#else
  19068. - #define DECLARE_ALIGNED(n,t,v) t v
  19069. - #define DECLARE_ASM_ALIGNED(n,t,v) t v
  19070. - #define DECLARE_ASM_CONST(n,t,v) static const t v
  19071. -#endif
  19072. -
  19073. -/**
  19074. - * @}
  19075. - */
  19076. -#endif
  19077. -
  19078. /**
  19079. * @defgroup lavu_mem_attrs Function Attributes
  19080. * Function attributes applicable to memory handling functions.
  19081. @@ -239,14 +159,6 @@ av_alloc_size(1, 2) void *av_malloc_array(size_t nmemb, size_t size);
  19082. */
  19083. void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib av_alloc_size(1, 2);
  19084. -#if FF_API_AV_MALLOCZ_ARRAY
  19085. -/**
  19086. - * @deprecated use av_calloc()
  19087. - */
  19088. -attribute_deprecated
  19089. -void *av_mallocz_array(size_t nmemb, size_t size) av_malloc_attrib av_alloc_size(1, 2);
  19090. -#endif
  19091. -
  19092. /**
  19093. * Allocate, reallocate, or free a block of memory.
  19094. *
  19095. diff --git a/media/ffvpx/libavutil/mem_internal.h b/media/ffvpx/libavutil/mem_internal.h
  19096. index 955e31a6..2448c606 100644
  19097. --- a/media/ffvpx/libavutil/mem_internal.h
  19098. +++ b/media/ffvpx/libavutil/mem_internal.h
  19099. @@ -30,7 +30,6 @@
  19100. #include "mem.h"
  19101. #include "version.h"
  19102. -#if !FF_API_DECLARE_ALIGNED
  19103. /**
  19104. * @def DECLARE_ALIGNED(n,t,v)
  19105. * Declare a variable that is aligned in memory.
  19106. @@ -97,7 +96,6 @@
  19107. #define DECLARE_ASM_ALIGNED(n,t,v) t v
  19108. #define DECLARE_ASM_CONST(n,t,v) static const t v
  19109. #endif
  19110. -#endif
  19111. // Some broken preprocessors need a second expansion
  19112. // to be forced to tokenize __VA_ARGS__
  19113. diff --git a/media/ffvpx/libavutil/opt.c b/media/ffvpx/libavutil/opt.c
  19114. index a3940f47..09087517 100644
  19115. --- a/media/ffvpx/libavutil/opt.c
  19116. +++ b/media/ffvpx/libavutil/opt.c
  19117. @@ -1742,17 +1742,17 @@ void av_opt_free(void *obj)
  19118. int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
  19119. {
  19120. - AVDictionaryEntry *t = NULL;
  19121. + const AVDictionaryEntry *t = NULL;
  19122. AVDictionary *tmp = NULL;
  19123. int ret;
  19124. if (!options)
  19125. return 0;
  19126. - while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) {
  19127. + while ((t = av_dict_iterate(*options, t))) {
  19128. ret = av_opt_set(obj, t->key, t->value, search_flags);
  19129. if (ret == AVERROR_OPTION_NOT_FOUND)
  19130. - ret = av_dict_set(&tmp, t->key, t->value, 0);
  19131. + ret = av_dict_set(&tmp, t->key, t->value, AV_DICT_MULTIKEY);
  19132. if (ret < 0) {
  19133. av_log(obj, AV_LOG_ERROR, "Error setting option %s to value %s.\n", t->key, t->value);
  19134. av_dict_free(&tmp);
  19135. @@ -2137,16 +2137,16 @@ FF_ENABLE_DEPRECATION_WARNINGS
  19136. case AV_OPT_TYPE_DICT: {
  19137. AVDictionary *dict1 = NULL;
  19138. AVDictionary *dict2 = *(AVDictionary **)dst;
  19139. - AVDictionaryEntry *en1 = NULL;
  19140. - AVDictionaryEntry *en2 = NULL;
  19141. + const AVDictionaryEntry *en1 = NULL;
  19142. + const AVDictionaryEntry *en2 = NULL;
  19143. ret = av_dict_parse_string(&dict1, o->default_val.str, "=", ":", 0);
  19144. if (ret < 0) {
  19145. av_dict_free(&dict1);
  19146. return ret;
  19147. }
  19148. do {
  19149. - en1 = av_dict_get(dict1, "", en1, AV_DICT_IGNORE_SUFFIX);
  19150. - en2 = av_dict_get(dict2, "", en2, AV_DICT_IGNORE_SUFFIX);
  19151. + en1 = av_dict_iterate(dict1, en1);
  19152. + en2 = av_dict_iterate(dict2, en2);
  19153. } while (en1 && en2 && !strcmp(en1->key, en2->key) && !strcmp(en1->value, en2->value));
  19154. av_dict_free(&dict1);
  19155. return (!en1 && !en2);
  19156. diff --git a/media/ffvpx/libavutil/pixdesc.c b/media/ffvpx/libavutil/pixdesc.c
  19157. index ca3e204a..62a2ae08 100644
  19158. --- a/media/ffvpx/libavutil/pixdesc.c
  19159. +++ b/media/ffvpx/libavutil/pixdesc.c
  19160. @@ -46,19 +46,35 @@ void av_read_image_line2(void *dst,
  19161. uint32_t *dst32 = dst;
  19162. if (flags & AV_PIX_FMT_FLAG_BITSTREAM) {
  19163. - int skip = x * step + comp.offset;
  19164. - const uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
  19165. - int shift = 8 - depth - (skip & 7);
  19166. + if (depth == 10) {
  19167. + // Assume all channels are packed into a 32bit value
  19168. + const uint8_t *byte_p = data[plane] + y * linesize[plane];
  19169. + const uint32_t *p = (uint32_t *)byte_p;
  19170. - while (w--) {
  19171. - int val = (*p >> shift) & mask;
  19172. - if (read_pal_component)
  19173. - val = data[1][4*val + c];
  19174. - shift -= step;
  19175. - p -= shift >> 3;
  19176. - shift &= 7;
  19177. - if (dst_element_size == 4) *dst32++ = val;
  19178. - else *dst16++ = val;
  19179. + while (w--) {
  19180. + int val = AV_RB32(p);
  19181. + val = (val >> comp.offset) & mask;
  19182. + if (read_pal_component)
  19183. + val = data[1][4*val + c];
  19184. + if (dst_element_size == 4) *dst32++ = val;
  19185. + else *dst16++ = val;
  19186. + p++;
  19187. + }
  19188. + } else {
  19189. + int skip = x * step + comp.offset;
  19190. + const uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
  19191. + int shift = 8 - depth - (skip & 7);
  19192. +
  19193. + while (w--) {
  19194. + int val = (*p >> shift) & mask;
  19195. + if (read_pal_component)
  19196. + val = data[1][4*val + c];
  19197. + shift -= step;
  19198. + p -= shift >> 3;
  19199. + shift &= 7;
  19200. + if (dst_element_size == 4) *dst32++ = val;
  19201. + else *dst16++ = val;
  19202. + }
  19203. }
  19204. } else {
  19205. const uint8_t *p = data[plane] + y * linesize[plane] +
  19206. @@ -109,15 +125,29 @@ void av_write_image_line2(const void *src,
  19207. const uint16_t *src16 = src;
  19208. if (flags & AV_PIX_FMT_FLAG_BITSTREAM) {
  19209. - int skip = x * step + comp.offset;
  19210. - uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
  19211. - int shift = 8 - depth - (skip & 7);
  19212. + if (depth == 10) {
  19213. + // Assume all channels are packed into a 32bit value
  19214. + const uint8_t *byte_p = data[plane] + y * linesize[plane];
  19215. + uint32_t *p = (uint32_t *)byte_p;
  19216. + int offset = comp.offset;
  19217. + uint32_t mask = ((1ULL << depth) - 1) << offset;
  19218. - while (w--) {
  19219. - *p |= (src_element_size == 4 ? *src32++ : *src16++) << shift;
  19220. - shift -= step;
  19221. - p -= shift >> 3;
  19222. - shift &= 7;
  19223. + while (w--) {
  19224. + uint16_t val = src_element_size == 4 ? *src32++ : *src16++;
  19225. + AV_WB32(p, (AV_RB32(p) & ~mask) | (val << offset));
  19226. + p++;
  19227. + }
  19228. + } else {
  19229. + int skip = x * step + comp.offset;
  19230. + uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
  19231. + int shift = 8 - depth - (skip & 7);
  19232. +
  19233. + while (w--) {
  19234. + *p |= (src_element_size == 4 ? *src32++ : *src16++) << shift;
  19235. + shift -= step;
  19236. + p -= shift >> 3;
  19237. + shift &= 7;
  19238. + }
  19239. }
  19240. } else {
  19241. int shift = comp.shift;
  19242. diff --git a/media/ffvpx/libavutil/pixfmt.h b/media/ffvpx/libavutil/pixfmt.h
  19243. index 224670a7..37c2c79e 100644
  19244. --- a/media/ffvpx/libavutil/pixfmt.h
  19245. +++ b/media/ffvpx/libavutil/pixfmt.h
  19246. @@ -206,8 +206,36 @@ enum AVPixelFormat {
  19247. AV_PIX_FMT_GBRAP16BE, ///< planar GBRA 4:4:4:4 64bpp, big-endian
  19248. AV_PIX_FMT_GBRAP16LE, ///< planar GBRA 4:4:4:4 64bpp, little-endian
  19249. /**
  19250. - * HW acceleration through QSV, data[3] contains a pointer to the
  19251. - * mfxFrameSurface1 structure.
  19252. + * HW acceleration through QSV, data[3] contains a pointer to the
  19253. + * mfxFrameSurface1 structure.
  19254. + *
  19255. + * Before FFmpeg 5.0:
  19256. + * mfxFrameSurface1.Data.MemId contains a pointer when importing
  19257. + * the following frames as QSV frames:
  19258. + *
  19259. + * VAAPI:
  19260. + * mfxFrameSurface1.Data.MemId contains a pointer to VASurfaceID
  19261. + *
  19262. + * DXVA2:
  19263. + * mfxFrameSurface1.Data.MemId contains a pointer to IDirect3DSurface9
  19264. + *
  19265. + * FFmpeg 5.0 and above:
  19266. + * mfxFrameSurface1.Data.MemId contains a pointer to the mfxHDLPair
  19267. + * structure when importing the following frames as QSV frames:
  19268. + *
  19269. + * VAAPI:
  19270. + * mfxHDLPair.first contains a VASurfaceID pointer.
  19271. + * mfxHDLPair.second is always MFX_INFINITE.
  19272. + *
  19273. + * DXVA2:
  19274. + * mfxHDLPair.first contains IDirect3DSurface9 pointer.
  19275. + * mfxHDLPair.second is always MFX_INFINITE.
  19276. + *
  19277. + * D3D11:
  19278. + * mfxHDLPair.first contains a ID3D11Texture2D pointer.
  19279. + * mfxHDLPair.second contains the texture array index of the frame if the
  19280. + * ID3D11Texture2D is an array texture, or always MFX_INFINITE if it is a
  19281. + * normal texture.
  19282. */
  19283. AV_PIX_FMT_QSV,
  19284. /**
  19285. diff --git a/media/ffvpx/libavutil/version.h b/media/ffvpx/libavutil/version.h
  19286. index 2df788e5..900b7989 100644
  19287. --- a/media/ffvpx/libavutil/version.h
  19288. +++ b/media/ffvpx/libavutil/version.h
  19289. @@ -78,8 +78,8 @@
  19290. * @{
  19291. */
  19292. -#define LIBAVUTIL_VERSION_MAJOR 57
  19293. -#define LIBAVUTIL_VERSION_MINOR 40
  19294. +#define LIBAVUTIL_VERSION_MAJOR 58
  19295. +#define LIBAVUTIL_VERSION_MINOR 3
  19296. #define LIBAVUTIL_VERSION_MICRO 100
  19297. #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
  19298. @@ -105,16 +105,14 @@
  19299. * @{
  19300. */
  19301. -#define FF_API_D2STR (LIBAVUTIL_VERSION_MAJOR < 58)
  19302. -#define FF_API_DECLARE_ALIGNED (LIBAVUTIL_VERSION_MAJOR < 58)
  19303. -#define FF_API_COLORSPACE_NAME (LIBAVUTIL_VERSION_MAJOR < 58)
  19304. -#define FF_API_AV_MALLOCZ_ARRAY (LIBAVUTIL_VERSION_MAJOR < 58)
  19305. -#define FF_API_FIFO_PEEK2 (LIBAVUTIL_VERSION_MAJOR < 58)
  19306. -#define FF_API_FIFO_OLD_API (LIBAVUTIL_VERSION_MAJOR < 58)
  19307. -#define FF_API_XVMC (LIBAVUTIL_VERSION_MAJOR < 58)
  19308. -#define FF_API_OLD_CHANNEL_LAYOUT (LIBAVUTIL_VERSION_MAJOR < 58)
  19309. -#define FF_API_AV_FOPEN_UTF8 (LIBAVUTIL_VERSION_MAJOR < 58)
  19310. -#define FF_API_PKT_DURATION (LIBAVUTIL_VERSION_MAJOR < 58)
  19311. +#define FF_API_FIFO_PEEK2 (LIBAVUTIL_VERSION_MAJOR < 59)
  19312. +#define FF_API_FIFO_OLD_API (LIBAVUTIL_VERSION_MAJOR < 59)
  19313. +#define FF_API_XVMC (LIBAVUTIL_VERSION_MAJOR < 59)
  19314. +#define FF_API_OLD_CHANNEL_LAYOUT (LIBAVUTIL_VERSION_MAJOR < 59)
  19315. +#define FF_API_AV_FOPEN_UTF8 (LIBAVUTIL_VERSION_MAJOR < 59)
  19316. +#define FF_API_PKT_DURATION (LIBAVUTIL_VERSION_MAJOR < 59)
  19317. +#define FF_API_REORDERED_OPAQUE (LIBAVUTIL_VERSION_MAJOR < 59)
  19318. +#define FF_API_FRAME_PICTURE_NUMBER (LIBAVUTIL_VERSION_MAJOR < 59)
  19319. /**
  19320. * @}
  19321. diff --git a/media/ffvpx/libavutil/video_enc_params.c b/media/ffvpx/libavutil/video_enc_params.c
  19322. index 54bfed0e..33592dc1 100644
  19323. --- a/media/ffvpx/libavutil/video_enc_params.c
  19324. +++ b/media/ffvpx/libavutil/video_enc_params.c
  19325. @@ -27,11 +27,11 @@
  19326. AVVideoEncParams *av_video_enc_params_alloc(enum AVVideoEncParamsType type,
  19327. unsigned int nb_blocks, size_t *out_size)
  19328. {
  19329. - const size_t blocks_offset = offsetof(
  19330. - struct {
  19331. - AVVideoEncParams p;
  19332. - AVVideoBlockParams b;
  19333. - }, b);
  19334. + struct TestStruct {
  19335. + AVVideoEncParams p;
  19336. + AVVideoBlockParams b;
  19337. + };
  19338. + const size_t blocks_offset = offsetof(struct TestStruct, b);
  19339. size_t size = blocks_offset;
  19340. AVVideoEncParams *par;
  19341. diff --git a/media/ffvpx/libavutil/x86/float_dsp.asm b/media/ffvpx/libavutil/x86/float_dsp.asm
  19342. index ff608f5f..e84ba525 100644
  19343. --- a/media/ffvpx/libavutil/x86/float_dsp.asm
  19344. +++ b/media/ffvpx/libavutil/x86/float_dsp.asm
  19345. @@ -48,7 +48,7 @@ ALIGN 16
  19346. sub lenq, 64
  19347. jge .loop
  19348. - REP_RET
  19349. + RET
  19350. %endmacro
  19351. INIT_XMM sse
  19352. @@ -141,7 +141,7 @@ cglobal vector_fmac_scalar, 4,4,5, dst, src, mul, len
  19353. %endif ; mmsize
  19354. sub lenq, 64
  19355. jge .loop
  19356. - REP_RET
  19357. + RET
  19358. %endmacro
  19359. INIT_XMM sse
  19360. @@ -178,7 +178,7 @@ cglobal vector_fmul_scalar, 4,4,3, dst, src, mul, len
  19361. mova [dstq+lenq], m1
  19362. sub lenq, mmsize
  19363. jge .loop
  19364. - REP_RET
  19365. + RET
  19366. %endmacro
  19367. INIT_XMM sse
  19368. @@ -233,7 +233,7 @@ cglobal vector_dmac_scalar, 4,4,5, dst, src, mul, len
  19369. movaps [dstq+lenq+3*mmsize], m4
  19370. sub lenq, mmsize*4
  19371. jge .loop
  19372. - REP_RET
  19373. + RET
  19374. %endmacro
  19375. INIT_XMM sse2
  19376. @@ -280,7 +280,7 @@ cglobal vector_dmul_scalar, 4,4,3, dst, src, mul, len
  19377. movaps [dstq+lenq+mmsize], m2
  19378. sub lenq, 2*mmsize
  19379. jge .loop
  19380. - REP_RET
  19381. + RET
  19382. %endmacro
  19383. INIT_XMM sse2
  19384. @@ -323,7 +323,7 @@ cglobal vector_fmul_window, 5, 6, 6, dst, src0, src1, win, len, len1
  19385. sub len1q, mmsize
  19386. add lenq, mmsize
  19387. jl .loop
  19388. - REP_RET
  19389. + RET
  19390. ;-----------------------------------------------------------------------------
  19391. ; vector_fmul_add(float *dst, const float *src0, const float *src1,
  19392. @@ -352,7 +352,7 @@ ALIGN 16
  19393. sub lenq, 2*mmsize
  19394. jge .loop
  19395. - REP_RET
  19396. + RET
  19397. %endmacro
  19398. INIT_XMM sse
  19399. @@ -401,7 +401,7 @@ ALIGN 16
  19400. add src1q, 2*mmsize
  19401. sub lenq, 2*mmsize
  19402. jge .loop
  19403. - REP_RET
  19404. + RET
  19405. %endmacro
  19406. INIT_XMM sse
  19407. @@ -585,4 +585,4 @@ cglobal butterflies_float, 3,3,3, src0, src1, len
  19408. mova [src0q + lenq], m0
  19409. add lenq, mmsize
  19410. jl .loop
  19411. - REP_RET
  19412. + RET
  19413. diff --git a/media/ffvpx/libavutil/x86/lls.asm b/media/ffvpx/libavutil/x86/lls.asm
  19414. index d2526d1f..e8141e6c 100644
  19415. --- a/media/ffvpx/libavutil/x86/lls.asm
  19416. +++ b/media/ffvpx/libavutil/x86/lls.asm
  19417. @@ -123,7 +123,7 @@ cglobal update_lls, 2,5,8, ctx, var, i, j, covar2
  19418. test id, id
  19419. jle .loop2x1
  19420. .ret:
  19421. - REP_RET
  19422. + RET
  19423. %macro UPDATE_LLS 0
  19424. cglobal update_lls, 3,6,8, ctx, var, count, i, j, count2
  19425. @@ -240,7 +240,7 @@ cglobal update_lls, 3,6,8, ctx, var, count, i, j, count2
  19426. cmp id, countd
  19427. jle .loop2x1
  19428. .ret:
  19429. - REP_RET
  19430. + RET
  19431. %endmacro ; UPDATE_LLS
  19432. %if HAVE_AVX_EXTERNAL
  19433. diff --git a/tools/rewriting/ThirdPartyPaths.txt b/tools/rewriting/ThirdPartyPaths.txt
  19434. index c3457777..65f2af3e 100644
  19435. --- a/tools/rewriting/ThirdPartyPaths.txt
  19436. +++ b/tools/rewriting/ThirdPartyPaths.txt
  19437. @@ -31,6 +31,7 @@ dom/media/gmp/widevine-adapter/content_decryption_module_proxy.h
  19438. dom/media/platforms/ffmpeg/ffmpeg57/
  19439. dom/media/platforms/ffmpeg/ffmpeg58/
  19440. dom/media/platforms/ffmpeg/ffmpeg59/
  19441. +dom/media/platforms/ffmpeg/ffmpeg60/
  19442. dom/media/platforms/ffmpeg/libav53/
  19443. dom/media/platforms/ffmpeg/libav54/
  19444. dom/media/platforms/ffmpeg/libav55/