mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-08 07:49:59 +01:00
Compare commits
631 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f09bfe681 | ||
|
|
7390c2629d | ||
|
|
3d9860f68a | ||
|
|
4fde30ba9d | ||
|
|
a06432b6c3 | ||
|
|
d7470271c7 | ||
|
|
d41010b895 | ||
|
|
a63941eec2 | ||
|
|
5d6f8bab02 | ||
|
|
de7671e4c4 | ||
|
|
217f781adc | ||
|
|
9440079216 | ||
|
|
d054ec868d | ||
|
|
4d8b82160d | ||
|
|
84fdfcab99 | ||
|
|
cd01611d7b | ||
|
|
8b8d794800 | ||
|
|
9a02be3122 | ||
|
|
223ae2467e | ||
|
|
9e65065080 | ||
|
|
5111c78eab | ||
|
|
394d3c937a | ||
|
|
afcd152b97 | ||
|
|
dad7beaceb | ||
|
|
93360af0d7 | ||
|
|
4ed83378bf | ||
|
|
1579f14632 | ||
|
|
7394e53f30 | ||
|
|
9bbed55b10 | ||
|
|
9181faab68 | ||
|
|
d1c2f86b21 | ||
|
|
2bcd8f22f2 | ||
|
|
c790e31ae4 | ||
|
|
7fe5d0a78d | ||
|
|
bf219a564c | ||
|
|
871d99ef77 | ||
|
|
418e9a6113 | ||
|
|
e25e0903ab | ||
|
|
969aee07e6 | ||
|
|
76587eea64 | ||
|
|
667fe8c75b | ||
|
|
64624c5678 | ||
|
|
114e4b970e | ||
|
|
c9659dfd29 | ||
|
|
41ee9a4495 | ||
|
|
e812a089f5 | ||
|
|
9b8b35910f | ||
|
|
f00ec3307b | ||
|
|
f6499563c3 | ||
|
|
16a4aef345 | ||
|
|
6352153811 | ||
|
|
557e8bd589 | ||
|
|
45361d8aa3 | ||
|
|
81e1b5f5fe | ||
|
|
6505eb45bc | ||
|
|
17f0581e0d | ||
|
|
13b7962aae | ||
|
|
aa40f11b81 | ||
|
|
3bb4c3e74d | ||
|
|
7ac50d846c | ||
|
|
0f4c03cd63 | ||
|
|
2d1d053c5d | ||
|
|
72ed4166a6 | ||
|
|
787a6156a2 | ||
|
|
b05d355040 | ||
|
|
f253fa9552 | ||
|
|
a28c276b8d | ||
|
|
26da47a09b | ||
|
|
23fdcd3b0a | ||
|
|
653329dfcb | ||
|
|
b0964918d8 | ||
|
|
d8fda618d0 | ||
|
|
43881c7732 | ||
|
|
42bdcebf33 | ||
|
|
d1e71ecbb0 | ||
|
|
64be1a45eb | ||
|
|
f8bd98ae4d | ||
|
|
f2c6e2c3b4 | ||
|
|
8acfae6901 | ||
|
|
e5ccd894d1 | ||
|
|
6287107eae | ||
|
|
53330b30fd | ||
|
|
9726c1a5f8 | ||
|
|
f1dd343007 | ||
|
|
be894938c4 | ||
|
|
fe0fd3de22 | ||
|
|
fe12b3a7a6 | ||
|
|
a1605af9b5 | ||
|
|
b0937dd61d | ||
|
|
ac0dea5dd7 | ||
|
|
0989a120f1 | ||
|
|
c7caed88a0 | ||
|
|
5df02760dd | ||
|
|
014dee89d0 | ||
|
|
da1a8191c5 | ||
|
|
dd9b24a488 | ||
|
|
16b5df17ea | ||
|
|
99af97ea11 | ||
|
|
6c66ea5e73 | ||
|
|
252356cf06 | ||
|
|
56fb830c30 | ||
|
|
d19b55649c | ||
|
|
fd6230e8f0 | ||
|
|
9406d3c910 | ||
|
|
9e1ce9a8ee | ||
|
|
b4d2888ce8 | ||
|
|
b3f30cb6d6 | ||
|
|
0484d7ad7e | ||
|
|
85b829bff9 | ||
|
|
f1685bd31a | ||
|
|
8d10d6e127 | ||
|
|
f93f739eca | ||
|
|
1a6218954a | ||
|
|
1f8e0f7e06 | ||
|
|
6dd718e416 | ||
|
|
1aab060996 | ||
|
|
3bc5aa65bb | ||
|
|
da1dfea076 | ||
|
|
e940d15a98 | ||
|
|
481118615c | ||
|
|
4b6e46c427 | ||
|
|
516ba41f05 | ||
|
|
1a642b7217 | ||
|
|
58b5b062b8 | ||
|
|
f13f5a7d4b | ||
|
|
d14696c99c | ||
|
|
d0af7d5745 | ||
|
|
f2abf8df7a | ||
|
|
40c7613ecf | ||
|
|
1a7d1793d6 | ||
|
|
9fcc632249 | ||
|
|
f7395926f2 | ||
|
|
7bc37641e3 | ||
|
|
3ac0638d57 | ||
|
|
051ac5c0f5 | ||
|
|
5ac46a0969 | ||
|
|
8b55f67e3e | ||
|
|
bb1d75e6c5 | ||
|
|
459a84ada3 | ||
|
|
35fe089dd9 | ||
|
|
9e6d8c309f | ||
|
|
afbaf6b367 | ||
|
|
f1da6691a4 | ||
|
|
5b1a953960 | ||
|
|
37e2d574dd | ||
|
|
f25f5f8c62 | ||
|
|
a437298de5 | ||
|
|
e912b0777b | ||
|
|
b3f48a5044 | ||
|
|
ee9e966296 | ||
|
|
493a92313f | ||
|
|
1578986a0d | ||
|
|
7788297a59 | ||
|
|
23376ae2f0 | ||
|
|
8231764784 | ||
|
|
49fa398858 | ||
|
|
1ad1723c24 | ||
|
|
7740b111dd | ||
|
|
c0ad5f9333 | ||
|
|
bb7f236c7f | ||
|
|
0397d43405 | ||
|
|
ffc66ac0d6 | ||
|
|
588e7226ed | ||
|
|
0dc5868f14 | ||
|
|
723512ac71 | ||
|
|
963514ea1a | ||
|
|
c11b3010c2 | ||
|
|
3301b248b0 | ||
|
|
7b67ce9ade | ||
|
|
90a1c5e95c | ||
|
|
45a529d805 | ||
|
|
97cbad3d2c | ||
|
|
6419569a9d | ||
|
|
67134ad31f | ||
|
|
d513c6a0ee | ||
|
|
18f48e05a2 | ||
|
|
5bf5a35fb5 | ||
|
|
6598aaea1a | ||
|
|
a5992a274f | ||
|
|
1b99667005 | ||
|
|
1f4d779e87 | ||
|
|
f543d32455 | ||
|
|
2cbdbc3670 | ||
|
|
aa943bd31f | ||
|
|
bea14966e2 | ||
|
|
6be5a3c045 | ||
|
|
119131fcbf | ||
|
|
c13e38bac7 | ||
|
|
01c4fe7ee7 | ||
|
|
ad13a5c8fa | ||
|
|
ce248bf7ee | ||
|
|
8eaefbe1be | ||
|
|
81d8bad786 | ||
|
|
0aee436728 | ||
|
|
cdaf9fb2a0 | ||
|
|
cf41ff4889 | ||
|
|
6120ad315b | ||
|
|
2105f046f5 | ||
|
|
815d3225e3 | ||
|
|
51dd23c448 | ||
|
|
a4e1532ee7 | ||
|
|
f7b147548e | ||
|
|
f99b17bd32 | ||
|
|
21f6b07a97 | ||
|
|
c9f1456a41 | ||
|
|
77b789b406 | ||
|
|
9ed1aa0465 | ||
|
|
188ce941ec | ||
|
|
7fc9c7c35b | ||
|
|
07015d9f91 | ||
|
|
744b406ff3 | ||
|
|
2273e5ed99 | ||
|
|
a1f7844a11 | ||
|
|
3ef8b4322c | ||
|
|
9dc112e277 | ||
|
|
75ff0e8c50 | ||
|
|
f02221d651 | ||
|
|
92c4973752 | ||
|
|
f4e0869560 | ||
|
|
6135baa85b | ||
|
|
3573256037 | ||
|
|
d396987c30 | ||
|
|
b20a8ad619 | ||
|
|
01a550bda2 | ||
|
|
f6b3dce952 | ||
|
|
b8e57113ec | ||
|
|
407912d178 | ||
|
|
12bbd819cb | ||
|
|
f9204ec56a | ||
|
|
4ddac7199b | ||
|
|
3e78f86891 | ||
|
|
68fd80ee1c | ||
|
|
0edc799626 | ||
|
|
3cf6135729 | ||
|
|
160e91de89 | ||
|
|
9f8e3e6d12 | ||
|
|
9752ab6b9e | ||
|
|
64e069efac | ||
|
|
e064cce972 | ||
|
|
b8102ce56d | ||
|
|
f38c42b913 | ||
|
|
a770a61e6d | ||
|
|
b2111ad4df | ||
|
|
7c81afdba5 | ||
|
|
65b839e43a | ||
|
|
d47e96090c | ||
|
|
0bbd46c690 | ||
|
|
5f1f1868b5 | ||
|
|
ebf381168a | ||
|
|
0d90143972 | ||
|
|
00049f193d | ||
|
|
d832020bd8 | ||
|
|
95e91aaf33 | ||
|
|
40dd29653a | ||
|
|
52dd1a933e | ||
|
|
564c023eba | ||
|
|
771564945a | ||
|
|
16f7cbef56 | ||
|
|
4ec1acc6e4 | ||
|
|
74f6df745a | ||
|
|
46c477c2a1 | ||
|
|
fcbcc561e0 | ||
|
|
6d899d0206 | ||
|
|
e0a03d1f9c | ||
|
|
d07be523f5 | ||
|
|
e4cdde96b3 | ||
|
|
252a0ccb80 | ||
|
|
dad0c9d686 | ||
|
|
e173834af8 | ||
|
|
63e3a97815 | ||
|
|
61796a8999 | ||
|
|
7d9c059a35 | ||
|
|
52572ca1b3 | ||
|
|
220bbc44c2 | ||
|
|
f378636d90 | ||
|
|
98f33430a2 | ||
|
|
6672f672d9 | ||
|
|
3002e5976d | ||
|
|
1e8ff7d21d | ||
|
|
dae6c19995 | ||
|
|
989adf5ee5 | ||
|
|
09d406eec8 | ||
|
|
d1b62a9a07 | ||
|
|
29c8fac3f7 | ||
|
|
8c33d40a7b | ||
|
|
f406bf3fa9 | ||
|
|
54bec22a6e | ||
|
|
e1b2c93a23 | ||
|
|
e529ff52a0 | ||
|
|
fb7e76d1cf | ||
|
|
96047b3150 | ||
|
|
2545defeac | ||
|
|
2d97ad38ed | ||
|
|
f6c628f029 | ||
|
|
3f743e3e4c | ||
|
|
f2dbd64bde | ||
|
|
7bce659e18 | ||
|
|
cb9379065f | ||
|
|
4261778dbd | ||
|
|
ba88a6e4e4 | ||
|
|
e0407a7bf7 | ||
|
|
d575984dfc | ||
|
|
9ea1e82d68 | ||
|
|
5cd2cdf33f | ||
|
|
a5a6f6fec3 | ||
|
|
88544e8ceb | ||
|
|
f183eaa3ad | ||
|
|
d773d7775a | ||
|
|
f15f4cefd7 | ||
|
|
0ec75a04e5 | ||
|
|
34fb994d93 | ||
|
|
acafd1814e | ||
|
|
bb01956d67 | ||
|
|
bc0c49b83e | ||
|
|
0008a87cb1 | ||
|
|
2aa6592338 | ||
|
|
2b14d98086 | ||
|
|
a05f86ec10 | ||
|
|
9bdb254b98 | ||
|
|
358d1f6e01 | ||
|
|
ea28034f5d | ||
|
|
6452b31599 | ||
|
|
a14969253a | ||
|
|
fab9a7be76 | ||
|
|
3a67865963 | ||
|
|
3fb754712c | ||
|
|
e5294f407a | ||
|
|
ed1ad2f5eb | ||
|
|
e780c3daaf | ||
|
|
7f954ca502 | ||
|
|
8e9e57ed0c | ||
|
|
1bd6372cd3 | ||
|
|
40ffa99dfa | ||
|
|
ff79f6b35a | ||
|
|
e2a83d72da | ||
|
|
6c3985713b | ||
|
|
7d97cc8d87 | ||
|
|
a56a9e65c6 | ||
|
|
428b629eb2 | ||
|
|
194d12345d | ||
|
|
b3d8276d2d | ||
|
|
c2eb668617 | ||
|
|
c9c223ba00 | ||
|
|
9d0ff6436e | ||
|
|
02b7b125b5 | ||
|
|
5643668308 | ||
|
|
2d18e7f3ef | ||
|
|
f1b5830182 | ||
|
|
c588316555 | ||
|
|
afd1f61944 | ||
|
|
16a9c5ea9e | ||
|
|
83fb31a76d | ||
|
|
fc5b32877a | ||
|
|
10e023c4fa | ||
|
|
27a3a59428 | ||
|
|
8ab849cddc | ||
|
|
5191b00155 | ||
|
|
1131e7a1a4 | ||
|
|
26becbcd2a | ||
|
|
366cdd3548 | ||
|
|
e3b08b3ad4 | ||
|
|
fa16440659 | ||
|
|
c36fd16aaa | ||
|
|
8c5897632a | ||
|
|
b34fce9c54 | ||
|
|
742f9aa879 | ||
|
|
79041d92ee | ||
|
|
82cebc0e05 | ||
|
|
09abca6802 | ||
|
|
43d64829e6 | ||
|
|
4a479fd3e6 | ||
|
|
4f41717d01 | ||
|
|
6896dcbf5f | ||
|
|
14404170b9 | ||
|
|
e9e42beed2 | ||
|
|
abd6decd55 | ||
|
|
0385c824f1 | ||
|
|
c4e764aa69 | ||
|
|
9d02e38d3f | ||
|
|
30cf47c6f0 | ||
|
|
b45cd17d29 | ||
|
|
26b6d70c72 | ||
|
|
32919db4fb | ||
|
|
56f44c26f0 | ||
|
|
fe87a40de6 | ||
|
|
0f6e309b97 | ||
|
|
96e13c9897 | ||
|
|
e72c0a0466 | ||
|
|
dfddefa13a | ||
|
|
ce94955b3c | ||
|
|
dde95268cc | ||
|
|
d20ac551a8 | ||
|
|
352b0969e2 | ||
|
|
b479b42b26 | ||
|
|
36cab9c408 | ||
|
|
34592d04fb | ||
|
|
544accc895 | ||
|
|
f41622ecb4 | ||
|
|
fc8eb4c1f9 | ||
|
|
02bae9f013 | ||
|
|
5cb2a1c3f0 | ||
|
|
a221c9bd76 | ||
|
|
b2583c2b62 | ||
|
|
bd553941ae | ||
|
|
e0aa76d38a | ||
|
|
a014b9614e | ||
|
|
31c21d2f69 | ||
|
|
3cd1c8653b | ||
|
|
194485cfba | ||
|
|
81cfe39113 | ||
|
|
ef0c503d37 | ||
|
|
1103aec1df | ||
|
|
b40ab81d1f | ||
|
|
314f055c29 | ||
|
|
2c566744c4 | ||
|
|
adad1ba5d8 | ||
|
|
a80a7131d1 | ||
|
|
3ab63abbd4 | ||
|
|
d2c76782e0 | ||
|
|
4dc8b4d7d0 | ||
|
|
9ff0467566 | ||
|
|
4407b38b28 | ||
|
|
8caaf260a6 | ||
|
|
e1f51bbd1f | ||
|
|
4b7c149306 | ||
|
|
e8919d6522 | ||
|
|
b017785fa5 | ||
|
|
01507eb1f8 | ||
|
|
938ff93710 | ||
|
|
0c88d539f8 | ||
|
|
e39a992bd1 | ||
|
|
72a12f61ef | ||
|
|
30ae080e9d | ||
|
|
dca463b728 | ||
|
|
25b462cab9 | ||
|
|
7c6a8afa7e | ||
|
|
b052525f9b | ||
|
|
90c7bfb9be | ||
|
|
7bdd348e58 | ||
|
|
af3d003658 | ||
|
|
c00beff5e0 | ||
|
|
57a43142ba | ||
|
|
99905118a8 | ||
|
|
dcf560204c | ||
|
|
5b0e2eb041 | ||
|
|
d461e077a5 | ||
|
|
9a884b7b97 | ||
|
|
9abe0bfb7f | ||
|
|
13682b48e9 | ||
|
|
f25e6e0c25 | ||
|
|
80239a8bb1 | ||
|
|
26bbc1c242 | ||
|
|
efe259a27e | ||
|
|
49f11e12d5 | ||
|
|
d130fae519 | ||
|
|
dde996bf99 | ||
|
|
cad2958fd7 | ||
|
|
29d61d73b1 | ||
|
|
9a6a710998 | ||
|
|
daaef403d1 | ||
|
|
207f5a138a | ||
|
|
e9c8a9aaa6 | ||
|
|
7b7d8b8794 | ||
|
|
90d6b563fe | ||
|
|
dce2f820e9 | ||
|
|
4aab3f868f | ||
|
|
48609236da | ||
|
|
d8fe695779 | ||
|
|
0f42e06651 | ||
|
|
230c4c6ad9 | ||
|
|
f4489c9558 | ||
|
|
0e5d9fe2a7 | ||
|
|
9ae2aaea50 | ||
|
|
2513314912 | ||
|
|
e727cbf0be | ||
|
|
bcc25353cf | ||
|
|
6a10263f16 | ||
|
|
bcc6429c01 | ||
|
|
bdb219435e | ||
|
|
a7338ae8ac | ||
|
|
6776c2c04f | ||
|
|
facd3dbc6e | ||
|
|
8796c3b7d3 | ||
|
|
7430f3064f | ||
|
|
eac281b06c | ||
|
|
b5210f4eae | ||
|
|
10379d50be | ||
|
|
cd874cf8e6 | ||
|
|
82a3e469c6 | ||
|
|
f859fed03d | ||
|
|
991e6fa35b | ||
|
|
09dca51066 | ||
|
|
40de74d0eb | ||
|
|
e2811c2ede | ||
|
|
25d14b716a | ||
|
|
f1de93dec3 | ||
|
|
738d68de85 | ||
|
|
00ecce5c8b | ||
|
|
6ba07e9948 | ||
|
|
125bea15d1 | ||
|
|
70e3cc282b | ||
|
|
242df26b44 | ||
|
|
46c2dba20e | ||
|
|
3caa6a5a57 | ||
|
|
bf08665e2e | ||
|
|
c4f5f4dbd3 | ||
|
|
29df24252a | ||
|
|
b920c1d5ad | ||
|
|
2b9ee7d5b9 | ||
|
|
f800cacada | ||
|
|
5227eac5b0 | ||
|
|
bb40f8f5e2 | ||
|
|
ad8bf22086 | ||
|
|
7f8804296d | ||
|
|
f67e75b5dc | ||
|
|
35e63f35b0 | ||
|
|
3bfb7a2537 | ||
|
|
4a1e7a6fb7 | ||
|
|
ff1e982205 | ||
|
|
bb116e6ba3 | ||
|
|
ebe356bf1c | ||
|
|
30099413ec | ||
|
|
186e0ff067 | ||
|
|
2642ad9f55 | ||
|
|
95ddd2227b | ||
|
|
3faebed6fa | ||
|
|
3aee1fa5b6 | ||
|
|
89a9c84ebb | ||
|
|
0adde39e04 | ||
|
|
03ae616b19 | ||
|
|
830c3058ff | ||
|
|
b12c5cbbb2 | ||
|
|
82c96b5ad8 | ||
|
|
3e4b957847 | ||
|
|
cbabbe8220 | ||
|
|
80122a3af3 | ||
|
|
a475755b3a | ||
|
|
66030e8133 | ||
|
|
46f8d838b3 | ||
|
|
bc3648d4b4 | ||
|
|
27e6b4a3ff | ||
|
|
b82860caa7 | ||
|
|
3d05625136 | ||
|
|
ddd3301bad | ||
|
|
123981930f | ||
|
|
3171e2360a | ||
|
|
3533a850e7 | ||
|
|
6d56bc9a6d | ||
|
|
2c5e1d0933 | ||
|
|
b37b83214a | ||
|
|
6d7ab09788 | ||
|
|
227cfc1f10 | ||
|
|
416847d195 | ||
|
|
bd4ad1a1d5 | ||
|
|
6230de03aa | ||
|
|
45acc228a6 | ||
|
|
d37fac6dbb | ||
|
|
7940306a47 | ||
|
|
eabefe83f4 | ||
|
|
eaa79b79b2 | ||
|
|
c761379825 | ||
|
|
ea3309eba7 | ||
|
|
1c1e252cd1 | ||
|
|
ca2c9d6b9b | ||
|
|
fa6b99d351 | ||
|
|
d79cb6947e | ||
|
|
5aa4b29bbe | ||
|
|
e4cbd0d6e5 | ||
|
|
0ede7b5344 | ||
|
|
5b933be089 | ||
|
|
f2693e98b4 | ||
|
|
c3861e14ce | ||
|
|
daa5a988e2 | ||
|
|
db67b7c31b | ||
|
|
a643a47d41 | ||
|
|
23af29e882 | ||
|
|
7d995cd1b8 | ||
|
|
72a58c0772 | ||
|
|
d525423006 | ||
|
|
4b476e6aa4 | ||
|
|
124c78fd44 | ||
|
|
a1ab3300c8 | ||
|
|
1af235f6b3 | ||
|
|
82031e41f8 | ||
|
|
222e7549a7 | ||
|
|
eb2244ece9 | ||
|
|
b967c10029 | ||
|
|
7ff4cd2acc | ||
|
|
c4149c4d54 | ||
|
|
8ad2f45964 | ||
|
|
5df52b0131 | ||
|
|
596d3e20ae | ||
|
|
00d5ff6431 | ||
|
|
437179e9c8 | ||
|
|
031d3b66c2 | ||
|
|
b76871d870 | ||
|
|
15ae305007 | ||
|
|
3c72204ae0 | ||
|
|
ba21499648 | ||
|
|
7933039ade | ||
|
|
4015829acc | ||
|
|
39dc4a6bb3 | ||
|
|
a6a2d8eb8f | ||
|
|
58556826a8 | ||
|
|
bc2c9a479a | ||
|
|
9cc22be032 | ||
|
|
33e1bca651 | ||
|
|
9841617b7f | ||
|
|
2897481f64 | ||
|
|
646c564de5 | ||
|
|
cd6281abef | ||
|
|
697be8173b | ||
|
|
1853d8bb7a | ||
|
|
1779cd7695 | ||
|
|
bb4820727f | ||
|
|
affc7687d3 | ||
|
|
3569470693 | ||
|
|
1d1df82093 | ||
|
|
de187e3e9e | ||
|
|
7754d48381 | ||
|
|
63169474b3 | ||
|
|
b3f106cb1f | ||
|
|
9b6ccf0f24 | ||
|
|
298d66c8de | ||
|
|
4be1b68d52 | ||
|
|
92edc13d69 | ||
|
|
c9f015f1c6 | ||
|
|
db6b2ca0b3 | ||
|
|
3503ec8461 | ||
|
|
ecc5e42d92 | ||
|
|
f87ce262f6 |
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -1,2 +1 @@
|
|||||||
*.pnm -diff -text
|
*.pnm -diff -text
|
||||||
tests/ref/fate/sub-scc eol=crlf
|
|
||||||
|
|||||||
70
.gitignore
vendored
70
.gitignore
vendored
@@ -1,6 +1,5 @@
|
|||||||
*.a
|
*.a
|
||||||
*.o
|
*.o
|
||||||
*.o.*
|
|
||||||
*.d
|
*.d
|
||||||
*.def
|
*.def
|
||||||
*.dll
|
*.dll
|
||||||
@@ -16,24 +15,69 @@
|
|||||||
*.pdb
|
*.pdb
|
||||||
*.so
|
*.so
|
||||||
*.so.*
|
*.so.*
|
||||||
*.swp
|
|
||||||
*.ver
|
*.ver
|
||||||
*.version
|
*-example
|
||||||
*.ptx
|
*-test
|
||||||
*.ptx.c
|
|
||||||
*_g
|
*_g
|
||||||
\#*
|
|
||||||
.\#*
|
|
||||||
/.config
|
/.config
|
||||||
/.version
|
/.version
|
||||||
/ffmpeg
|
/ffmpeg
|
||||||
/ffplay
|
/ffplay
|
||||||
/ffprobe
|
/ffprobe
|
||||||
/config.asm
|
/ffserver
|
||||||
/config.h
|
/config.*
|
||||||
/coverage.info
|
/coverage.info
|
||||||
/avversion.h
|
/doc/*.1
|
||||||
|
/doc/*.3
|
||||||
|
/doc/*.html
|
||||||
|
/doc/*.pod
|
||||||
|
/doc/config.texi
|
||||||
|
/doc/avoptions_codec.texi
|
||||||
|
/doc/avoptions_format.texi
|
||||||
|
/doc/doxy/html/
|
||||||
|
/doc/examples/avio_reading
|
||||||
|
/doc/examples/avcodec
|
||||||
|
/doc/examples/demuxing_decoding
|
||||||
|
/doc/examples/filter_audio
|
||||||
|
/doc/examples/filtering_audio
|
||||||
|
/doc/examples/filtering_video
|
||||||
|
/doc/examples/metadata
|
||||||
|
/doc/examples/muxing
|
||||||
|
/doc/examples/pc-uninstalled
|
||||||
|
/doc/examples/remuxing
|
||||||
|
/doc/examples/resampling_audio
|
||||||
|
/doc/examples/scaling_video
|
||||||
|
/doc/examples/transcode_aac
|
||||||
|
/doc/fate.txt
|
||||||
|
/doc/print_options
|
||||||
/lcov/
|
/lcov/
|
||||||
/src
|
/libavcodec/*_tablegen
|
||||||
/mapfile
|
/libavcodec/*_tables.c
|
||||||
/tools/python/__pycache__/
|
/libavcodec/*_tables.h
|
||||||
|
/libavutil/avconfig.h
|
||||||
|
/libavutil/ffversion.h
|
||||||
|
/tests/audiogen
|
||||||
|
/tests/base64
|
||||||
|
/tests/data/
|
||||||
|
/tests/rotozoom
|
||||||
|
/tests/tiny_psnr
|
||||||
|
/tests/tiny_ssim
|
||||||
|
/tests/videogen
|
||||||
|
/tests/vsynth1/
|
||||||
|
/tools/aviocat
|
||||||
|
/tools/ffbisect
|
||||||
|
/tools/bisect.need
|
||||||
|
/tools/crypto_bench
|
||||||
|
/tools/cws2fws
|
||||||
|
/tools/fourcc2pixfmt
|
||||||
|
/tools/ffescape
|
||||||
|
/tools/ffeval
|
||||||
|
/tools/ffhash
|
||||||
|
/tools/graph2dot
|
||||||
|
/tools/ismindex
|
||||||
|
/tools/pktdumper
|
||||||
|
/tools/probetest
|
||||||
|
/tools/qt-faststart
|
||||||
|
/tools/trasher
|
||||||
|
/tools/seek_print
|
||||||
|
/tools/zmqsend
|
||||||
|
|||||||
25
.mailmap
25
.mailmap
@@ -1,25 +0,0 @@
|
|||||||
<james.darnley@gmail.com> <jdarnley@obe.tv>
|
|
||||||
<jeebjp@gmail.com> <jan.ekstrom@aminocom.com>
|
|
||||||
<sw@jkqxz.net> <mrt@jkqxz.net>
|
|
||||||
<u@pkh.me> <cboesch@gopro.com>
|
|
||||||
<zhilizhao@tencent.com> <quinkblack@foxmail.com>
|
|
||||||
<zhilizhao@tencent.com> <wantlamy@gmail.com>
|
|
||||||
<modmaker@google.com> <modmaker-at-google.com@ffmpeg.org>
|
|
||||||
<stebbins@jetheaddev.com> <jstebbins@jetheaddev.com>
|
|
||||||
<barryjzhao@tencent.com> <mypopydev@gmail.com>
|
|
||||||
<barryjzhao@tencent.com> <jun.zhao@intel.com>
|
|
||||||
<josh@itanimul.li> <joshdk@obe.tv>
|
|
||||||
<michael@niedermayer.cc> <michaelni@gmx.at>
|
|
||||||
<linjie.justin.fu@gmail.com> <linjie.fu@intel.com>
|
|
||||||
<linjie.justin.fu@gmail.com> <fulinjie@zju.edu.cn>
|
|
||||||
<ceffmpeg@gmail.com> <cehoyos@ag.or.at>
|
|
||||||
<ceffmpeg@gmail.com> <cehoyos@rainbow.studorg.tuwien.ac.at>
|
|
||||||
<ffmpeg@gyani.pro> <gyandoshi@gmail.com>
|
|
||||||
<atomnuker@gmail.com> <rpehlivanov@obe.tv>
|
|
||||||
<lizhong1008@gmail.com> <zhong.li@intel.com>
|
|
||||||
<lizhong1008@gmail.com> <zhongli_dev@126.com>
|
|
||||||
<andreas.rheinhardt@gmail.com> <andreas.rheinhardt@googlemail.com>
|
|
||||||
rcombs <rcombs@rcombs.me> <rodger.combs@gmail.com>
|
|
||||||
<thilo.borgmann@mail.de> <thilo.borgmann@googlemail.com>
|
|
||||||
<liuqi05@kuaishou.com> <lq@chinaffmpeg.org>
|
|
||||||
<ruiling.song83@gmail.com> <ruiling.song@intel.com>
|
|
||||||
30
.travis.yml
30
.travis.yml
@@ -1,30 +0,0 @@
|
|||||||
language: c
|
|
||||||
sudo: false
|
|
||||||
os:
|
|
||||||
- linux
|
|
||||||
- osx
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- nasm
|
|
||||||
- diffutils
|
|
||||||
compiler:
|
|
||||||
- clang
|
|
||||||
- gcc
|
|
||||||
matrix:
|
|
||||||
exclude:
|
|
||||||
- os: osx
|
|
||||||
compiler: gcc
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- ffmpeg-samples
|
|
||||||
before_install:
|
|
||||||
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; fi
|
|
||||||
install:
|
|
||||||
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install nasm; fi
|
|
||||||
script:
|
|
||||||
- mkdir -p ffmpeg-samples
|
|
||||||
- ./configure --samples=ffmpeg-samples --cc=$CC
|
|
||||||
- make -j 8
|
|
||||||
- make fate-rsync
|
|
||||||
- make check -j 8
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
# Note to Github users
|
|
||||||
Patches should be submitted to the [ffmpeg-devel mailing list](https://ffmpeg.org/mailman/listinfo/ffmpeg-devel) using `git format-patch` or `git send-email`. Github pull requests should be avoided because they are not part of our review process and **will be ignored**.
|
|
||||||
|
|
||||||
See [https://ffmpeg.org/developer.html#Contributing](https://ffmpeg.org/developer.html#Contributing) for more information.
|
|
||||||
4
CREDITS
4
CREDITS
@@ -1,6 +1,6 @@
|
|||||||
See the Git history of the project (https://git.ffmpeg.org/ffmpeg) to
|
See the Git history of the project (git://source.ffmpeg.org/ffmpeg) to
|
||||||
get the names of people who have contributed to FFmpeg.
|
get the names of people who have contributed to FFmpeg.
|
||||||
|
|
||||||
To check the log, you can type the command "git log" in the FFmpeg
|
To check the log, you can type the command "git log" in the FFmpeg
|
||||||
source directory, or browse the online repository at
|
source directory, or browse the online repository at
|
||||||
https://git.ffmpeg.org/ffmpeg
|
http://source.ffmpeg.org.
|
||||||
|
|||||||
15
INSTALL
Normal file
15
INSTALL
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
1) Type './configure' to create the configuration. A list of configure
|
||||||
|
options is printed by running 'configure --help'.
|
||||||
|
|
||||||
|
'configure' can be launched from a directory different from the FFmpeg
|
||||||
|
sources to build the objects out of tree. To do this, use an absolute
|
||||||
|
path when launching 'configure', e.g. '/ffmpegdir/ffmpeg/configure'.
|
||||||
|
|
||||||
|
2) Then type 'make' to build FFmpeg. GNU Make 3.81 or later is required.
|
||||||
|
|
||||||
|
3) Type 'make install' to install all binaries and libraries you built.
|
||||||
|
|
||||||
|
NOTICE
|
||||||
|
|
||||||
|
- Non system dependencies (e.g. libx264, libvpx) are disabled by default.
|
||||||
17
INSTALL.md
17
INSTALL.md
@@ -1,17 +0,0 @@
|
|||||||
## Installing FFmpeg
|
|
||||||
|
|
||||||
1. Type `./configure` to create the configuration. A list of configure
|
|
||||||
options is printed by running `configure --help`.
|
|
||||||
|
|
||||||
`configure` can be launched from a directory different from the FFmpeg
|
|
||||||
sources to build the objects out of tree. To do this, use an absolute
|
|
||||||
path when launching `configure`, e.g. `/ffmpegdir/ffmpeg/configure`.
|
|
||||||
|
|
||||||
2. Then type `make` to build FFmpeg. GNU Make 3.81 or later is required.
|
|
||||||
|
|
||||||
3. Type `make install` to install all binaries and libraries you built.
|
|
||||||
|
|
||||||
NOTICE
|
|
||||||
------
|
|
||||||
|
|
||||||
- Non system dependencies (e.g. libx264, libvpx) are disabled by default.
|
|
||||||
104
LICENSE
Normal file
104
LICENSE
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
FFmpeg:
|
||||||
|
|
||||||
|
Most files in FFmpeg are under the GNU Lesser General Public License version 2.1
|
||||||
|
or later (LGPL v2.1+). Read the file COPYING.LGPLv2.1 for details. Some other
|
||||||
|
files have MIT/X11/BSD-style licenses. In combination the LGPL v2.1+ applies to
|
||||||
|
FFmpeg.
|
||||||
|
|
||||||
|
Some optional parts of FFmpeg are licensed under the GNU General Public License
|
||||||
|
version 2 or later (GPL v2+). See the file COPYING.GPLv2 for details. None of
|
||||||
|
these parts are used by default, you have to explicitly pass --enable-gpl to
|
||||||
|
configure to activate them. In this case, FFmpeg's license changes to GPL v2+.
|
||||||
|
|
||||||
|
Specifically, the GPL parts of FFmpeg are
|
||||||
|
|
||||||
|
- libpostproc
|
||||||
|
- libmpcodecs
|
||||||
|
- optional x86 optimizations in the files
|
||||||
|
libavcodec/x86/idct_mmx.c
|
||||||
|
- libutvideo encoding/decoding wrappers in
|
||||||
|
libavcodec/libutvideo*.cpp
|
||||||
|
- the X11 grabber in libavdevice/x11grab.c
|
||||||
|
- the swresample test app in
|
||||||
|
libswresample/swresample-test.c
|
||||||
|
- the texi2pod.pl tool
|
||||||
|
- the following filters in libavfilter:
|
||||||
|
- f_ebur128.c
|
||||||
|
- vf_blackframe.c
|
||||||
|
- vf_boxblur.c
|
||||||
|
- vf_colormatrix.c
|
||||||
|
- vf_cropdetect.c
|
||||||
|
- vf_decimate.c
|
||||||
|
- vf_delogo.c
|
||||||
|
- vf_geq.c
|
||||||
|
- vf_histeq.c
|
||||||
|
- vf_hqdn3d.c
|
||||||
|
- vf_interlace.c
|
||||||
|
- vf_kerndeint.c
|
||||||
|
- vf_mcdeint.c
|
||||||
|
- vf_mp.c
|
||||||
|
- vf_owdenoise.c
|
||||||
|
- vf_perspective.c
|
||||||
|
- vf_phase.c
|
||||||
|
- vf_pp.c
|
||||||
|
- vf_pullup.c
|
||||||
|
- vf_sab.c
|
||||||
|
- vf_smartblur.c
|
||||||
|
- vf_spp.c
|
||||||
|
- vf_stereo3d.c
|
||||||
|
- vf_super2xsai.c
|
||||||
|
- vf_tinterlace.c
|
||||||
|
- vsrc_mptestsrc.c
|
||||||
|
|
||||||
|
Should you, for whatever reason, prefer to use version 3 of the (L)GPL, then
|
||||||
|
the configure parameter --enable-version3 will activate this licensing option
|
||||||
|
for you. Read the file COPYING.LGPLv3 or, if you have enabled GPL parts,
|
||||||
|
COPYING.GPLv3 to learn the exact legal terms that apply in this case.
|
||||||
|
|
||||||
|
There are a handful of files under other licensing terms, namely:
|
||||||
|
|
||||||
|
* The files libavcodec/jfdctfst.c, libavcodec/jfdctint_template.c and
|
||||||
|
libavcodec/jrevdct.c are taken from libjpeg, see the top of the files for
|
||||||
|
licensing details. Specifically note that you must credit the IJG in the
|
||||||
|
documentation accompanying your program if you only distribute executables.
|
||||||
|
You must also indicate any changes including additions and deletions to
|
||||||
|
those three files in the documentation.
|
||||||
|
|
||||||
|
|
||||||
|
external libraries
|
||||||
|
==================
|
||||||
|
|
||||||
|
FFmpeg can be combined with a number of external libraries, which sometimes
|
||||||
|
affect the licensing of binaries resulting from the combination.
|
||||||
|
|
||||||
|
compatible libraries
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
The following libraries are under GPL:
|
||||||
|
- frei0r
|
||||||
|
- libcdio
|
||||||
|
- libutvideo
|
||||||
|
- libvidstab
|
||||||
|
- libx264
|
||||||
|
- libx265
|
||||||
|
- libxavs
|
||||||
|
- libxvid
|
||||||
|
When combining them with FFmpeg, FFmpeg needs to be licensed as GPL as well by
|
||||||
|
passing --enable-gpl to configure.
|
||||||
|
|
||||||
|
The OpenCORE and VisualOn libraries are under the Apache License 2.0. That
|
||||||
|
license is incompatible with the LGPL v2.1 and the GPL v2, but not with
|
||||||
|
version 3 of those licenses. So to combine these libraries with FFmpeg, the
|
||||||
|
license version needs to be upgraded by passing --enable-version3 to configure.
|
||||||
|
|
||||||
|
incompatible libraries
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
The Fraunhofer AAC library, FAAC and aacplus are under licenses which
|
||||||
|
are incompatible with the GPLv2 and v3. We do not know for certain if their
|
||||||
|
licenses are compatible with the LGPL.
|
||||||
|
If you wish to enable these libraries, pass --enable-nonfree to configure.
|
||||||
|
But note that if you enable any of these libraries the resulting binary will
|
||||||
|
be under a complex license mix that is more restrictive than the LGPL and that
|
||||||
|
may result in additional obligations. It is possible that these
|
||||||
|
restrictions cause the resulting binary to be unredistributeable.
|
||||||
129
LICENSE.md
129
LICENSE.md
@@ -1,129 +0,0 @@
|
|||||||
# License
|
|
||||||
|
|
||||||
Most files in FFmpeg are under the GNU Lesser General Public License version 2.1
|
|
||||||
or later (LGPL v2.1+). Read the file `COPYING.LGPLv2.1` for details. Some other
|
|
||||||
files have MIT/X11/BSD-style licenses. In combination the LGPL v2.1+ applies to
|
|
||||||
FFmpeg.
|
|
||||||
|
|
||||||
Some optional parts of FFmpeg are licensed under the GNU General Public License
|
|
||||||
version 2 or later (GPL v2+). See the file `COPYING.GPLv2` for details. None of
|
|
||||||
these parts are used by default, you have to explicitly pass `--enable-gpl` to
|
|
||||||
configure to activate them. In this case, FFmpeg's license changes to GPL v2+.
|
|
||||||
|
|
||||||
Specifically, the GPL parts of FFmpeg are:
|
|
||||||
|
|
||||||
- libpostproc
|
|
||||||
- optional x86 optimization in the files
|
|
||||||
- `libavcodec/x86/flac_dsp_gpl.asm`
|
|
||||||
- `libavcodec/x86/idct_mmx.c`
|
|
||||||
- `libavfilter/x86/vf_removegrain.asm`
|
|
||||||
- the following building and testing tools
|
|
||||||
- `compat/solaris/make_sunver.pl`
|
|
||||||
- `doc/t2h.pm`
|
|
||||||
- `doc/texi2pod.pl`
|
|
||||||
- `libswresample/tests/swresample.c`
|
|
||||||
- `tests/checkasm/*`
|
|
||||||
- `tests/tiny_ssim.c`
|
|
||||||
- the following filters in libavfilter:
|
|
||||||
- `signature_lookup.c`
|
|
||||||
- `vf_blackframe.c`
|
|
||||||
- `vf_boxblur.c`
|
|
||||||
- `vf_colormatrix.c`
|
|
||||||
- `vf_cover_rect.c`
|
|
||||||
- `vf_cropdetect.c`
|
|
||||||
- `vf_delogo.c`
|
|
||||||
- `vf_eq.c`
|
|
||||||
- `vf_find_rect.c`
|
|
||||||
- `vf_fspp.c`
|
|
||||||
- `vf_histeq.c`
|
|
||||||
- `vf_hqdn3d.c`
|
|
||||||
- `vf_kerndeint.c`
|
|
||||||
- `vf_lensfun.c` (GPL version 3 or later)
|
|
||||||
- `vf_mcdeint.c`
|
|
||||||
- `vf_mpdecimate.c`
|
|
||||||
- `vf_nnedi.c`
|
|
||||||
- `vf_owdenoise.c`
|
|
||||||
- `vf_perspective.c`
|
|
||||||
- `vf_phase.c`
|
|
||||||
- `vf_pp.c`
|
|
||||||
- `vf_pp7.c`
|
|
||||||
- `vf_pullup.c`
|
|
||||||
- `vf_repeatfields.c`
|
|
||||||
- `vf_sab.c`
|
|
||||||
- `vf_signature.c`
|
|
||||||
- `vf_smartblur.c`
|
|
||||||
- `vf_spp.c`
|
|
||||||
- `vf_stereo3d.c`
|
|
||||||
- `vf_super2xsai.c`
|
|
||||||
- `vf_tinterlace.c`
|
|
||||||
- `vf_uspp.c`
|
|
||||||
- `vf_vaguedenoiser.c`
|
|
||||||
- `vsrc_mptestsrc.c`
|
|
||||||
|
|
||||||
Should you, for whatever reason, prefer to use version 3 of the (L)GPL, then
|
|
||||||
the configure parameter `--enable-version3` will activate this licensing option
|
|
||||||
for you. Read the file `COPYING.LGPLv3` or, if you have enabled GPL parts,
|
|
||||||
`COPYING.GPLv3` to learn the exact legal terms that apply in this case.
|
|
||||||
|
|
||||||
There are a handful of files under other licensing terms, namely:
|
|
||||||
|
|
||||||
* The files `libavcodec/jfdctfst.c`, `libavcodec/jfdctint_template.c` and
|
|
||||||
`libavcodec/jrevdct.c` are taken from libjpeg, see the top of the files for
|
|
||||||
licensing details. Specifically note that you must credit the IJG in the
|
|
||||||
documentation accompanying your program if you only distribute executables.
|
|
||||||
You must also indicate any changes including additions and deletions to
|
|
||||||
those three files in the documentation.
|
|
||||||
* `tests/reference.pnm` is under the expat license.
|
|
||||||
|
|
||||||
|
|
||||||
## External libraries
|
|
||||||
|
|
||||||
FFmpeg can be combined with a number of external libraries, which sometimes
|
|
||||||
affect the licensing of binaries resulting from the combination.
|
|
||||||
|
|
||||||
### Compatible libraries
|
|
||||||
|
|
||||||
The following libraries are under GPL version 2:
|
|
||||||
- avisynth
|
|
||||||
- frei0r
|
|
||||||
- libcdio
|
|
||||||
- libdavs2
|
|
||||||
- librubberband
|
|
||||||
- libvidstab
|
|
||||||
- libx264
|
|
||||||
- libx265
|
|
||||||
- libxavs
|
|
||||||
- libxavs2
|
|
||||||
- libxvid
|
|
||||||
|
|
||||||
When combining them with FFmpeg, FFmpeg needs to be licensed as GPL as well by
|
|
||||||
passing `--enable-gpl` to configure.
|
|
||||||
|
|
||||||
The following libraries are under LGPL version 3:
|
|
||||||
- gmp
|
|
||||||
- libaribb24
|
|
||||||
- liblensfun
|
|
||||||
|
|
||||||
When combining them with FFmpeg, use the configure option `--enable-version3` to
|
|
||||||
upgrade FFmpeg to the LGPL v3.
|
|
||||||
|
|
||||||
The VMAF, mbedTLS, RK MPI, OpenCORE and VisualOn libraries are under the Apache License
|
|
||||||
2.0. That license is incompatible with the LGPL v2.1 and the GPL v2, but not with
|
|
||||||
version 3 of those licenses. So to combine these libraries with FFmpeg, the
|
|
||||||
license version needs to be upgraded by passing `--enable-version3` to configure.
|
|
||||||
|
|
||||||
The smbclient library is under the GPL v3, to combine it with FFmpeg,
|
|
||||||
the options `--enable-gpl` and `--enable-version3` have to be passed to
|
|
||||||
configure to upgrade FFmpeg to the GPL v3.
|
|
||||||
|
|
||||||
### Incompatible libraries
|
|
||||||
|
|
||||||
There are certain libraries you can combine with FFmpeg whose licenses are not
|
|
||||||
compatible with the GPL and/or the LGPL. If you wish to enable these
|
|
||||||
libraries, even in circumstances that their license may be incompatible, pass
|
|
||||||
`--enable-nonfree` to configure. This will cause the resulting binary to be
|
|
||||||
unredistributable.
|
|
||||||
|
|
||||||
The Fraunhofer FDK AAC and OpenSSL libraries are under licenses which are
|
|
||||||
incompatible with the GPLv2 and v3. To the best of our knowledge, they are
|
|
||||||
compatible with the LGPL.
|
|
||||||
333
MAINTAINERS
333
MAINTAINERS
@@ -14,6 +14,7 @@ patches and related discussions.
|
|||||||
Project Leader
|
Project Leader
|
||||||
==============
|
==============
|
||||||
|
|
||||||
|
Michael Niedermayer
|
||||||
final design decisions
|
final design decisions
|
||||||
|
|
||||||
|
|
||||||
@@ -29,6 +30,9 @@ ffplay:
|
|||||||
ffprobe:
|
ffprobe:
|
||||||
ffprobe.c Stefano Sabatini
|
ffprobe.c Stefano Sabatini
|
||||||
|
|
||||||
|
ffserver:
|
||||||
|
ffserver.c Reynaldo H. Verdejo Pinochet
|
||||||
|
|
||||||
Commandline utility code:
|
Commandline utility code:
|
||||||
cmdutils.c, cmdutils.h Michael Niedermayer
|
cmdutils.c, cmdutils.h Michael Niedermayer
|
||||||
|
|
||||||
@@ -39,25 +43,22 @@ QuickTime faststart:
|
|||||||
Miscellaneous Areas
|
Miscellaneous Areas
|
||||||
===================
|
===================
|
||||||
|
|
||||||
documentation Stefano Sabatini, Mike Melanson, Timothy Gu, Gyan Doshi
|
documentation Stefano Sabatini, Mike Melanson, Timothy Gu
|
||||||
project server Árpád Gereöffy, Michael Niedermayer, Reimar Doeffinger, Alexander Strasser, Nikolay Aleksandrov
|
build system (configure,Makefiles) Diego Biurrun, Mans Rullgard
|
||||||
|
project server Árpád Gereöffy, Michael Niedermayer, Reimar Döffinger, Alexander Strasser
|
||||||
presets Robert Swain
|
presets Robert Swain
|
||||||
metadata subsystem Aurelien Jacobs
|
metadata subsystem Aurelien Jacobs
|
||||||
release management Michael Niedermayer
|
release management Michael Niedermayer
|
||||||
API tests Ludmila Glinskih
|
|
||||||
|
|
||||||
|
|
||||||
Communication
|
Communication
|
||||||
=============
|
=============
|
||||||
|
|
||||||
website Deby Barbara Lepage
|
website Robert Swain, Lou Logan
|
||||||
fate.ffmpeg.org Timothy Gu
|
mailinglists Michael Niedermayer, Baptiste Coudurier, Lou Logan
|
||||||
Trac bug tracker Alexander Strasser, Michael Niedermayer, Carl Eugen Hoyos
|
Google+ Paul B Mahol, Michael Niedermayer, Alexander Strasser
|
||||||
Patchwork Andriy Gelman
|
Twitter Lou Logan
|
||||||
mailing lists Baptiste Coudurier
|
|
||||||
Twitter Reynaldo H. Verdejo Pinochet
|
|
||||||
Launchpad Timothy Gu
|
Launchpad Timothy Gu
|
||||||
ffmpeg-security Andreas Cadhalpun, Carl Eugen Hoyos, Clément Bœsch, Michael Niedermayer, Reimar Doeffinger, rcombs, wm4
|
|
||||||
|
|
||||||
|
|
||||||
libavutil
|
libavutil
|
||||||
@@ -69,16 +70,12 @@ Internal Interfaces:
|
|||||||
libavutil/common.h Michael Niedermayer
|
libavutil/common.h Michael Niedermayer
|
||||||
|
|
||||||
Other:
|
Other:
|
||||||
aes_ctr.c, aes_ctr.h Eran Kornblau
|
|
||||||
bprint Nicolas George
|
bprint Nicolas George
|
||||||
bswap.h
|
bswap.h
|
||||||
des Reimar Doeffinger
|
des Reimar Doeffinger
|
||||||
dynarray.h Nicolas George
|
|
||||||
eval.c, eval.h Michael Niedermayer
|
eval.c, eval.h Michael Niedermayer
|
||||||
float_dsp Loren Merritt
|
float_dsp Loren Merritt
|
||||||
hash Reimar Doeffinger
|
hash Reimar Doeffinger
|
||||||
hwcontext_cuda* Timo Rothenpieler
|
|
||||||
hwcontext_vulkan* Lynne
|
|
||||||
intfloat* Michael Niedermayer
|
intfloat* Michael Niedermayer
|
||||||
integer.c, integer.h Michael Niedermayer
|
integer.c, integer.h Michael Niedermayer
|
||||||
lzo Reimar Doeffinger
|
lzo Reimar Doeffinger
|
||||||
@@ -89,7 +86,7 @@ Other:
|
|||||||
rational.c, rational.h Michael Niedermayer
|
rational.c, rational.h Michael Niedermayer
|
||||||
rc4 Reimar Doeffinger
|
rc4 Reimar Doeffinger
|
||||||
ripemd.c, ripemd.h James Almer
|
ripemd.c, ripemd.h James Almer
|
||||||
tx* Lynne
|
timecode Clément Bœsch
|
||||||
|
|
||||||
|
|
||||||
libavcodec
|
libavcodec
|
||||||
@@ -115,14 +112,15 @@ Generic Parts:
|
|||||||
lzw.* Michael Niedermayer
|
lzw.* Michael Niedermayer
|
||||||
floating point AAN DCT:
|
floating point AAN DCT:
|
||||||
faandct.c, faandct.h Michael Niedermayer
|
faandct.c, faandct.h Michael Niedermayer
|
||||||
Non-power-of-two MDCT:
|
|
||||||
mdct15.c, mdct15.h Rostislav Pehlivanov
|
|
||||||
Golomb coding:
|
Golomb coding:
|
||||||
golomb.c, golomb.h Michael Niedermayer
|
golomb.c, golomb.h Michael Niedermayer
|
||||||
|
LPC:
|
||||||
|
lpc.c, lpc.h Justin Ruggles
|
||||||
motion estimation:
|
motion estimation:
|
||||||
motion* Michael Niedermayer
|
motion* Michael Niedermayer
|
||||||
rate control:
|
rate control:
|
||||||
ratecontrol.c Michael Niedermayer
|
ratecontrol.c Michael Niedermayer
|
||||||
|
libxvid_rc.c Michael Niedermayer
|
||||||
simple IDCT:
|
simple IDCT:
|
||||||
simple_idct.c, simple_idct.h Michael Niedermayer
|
simple_idct.c, simple_idct.h Michael Niedermayer
|
||||||
postprocessing:
|
postprocessing:
|
||||||
@@ -131,48 +129,46 @@ Generic Parts:
|
|||||||
tableprint.c, tableprint.h Reimar Doeffinger
|
tableprint.c, tableprint.h Reimar Doeffinger
|
||||||
fixed point FFT:
|
fixed point FFT:
|
||||||
fft* Zeljko Lukac
|
fft* Zeljko Lukac
|
||||||
Text Subtitles Clément Bœsch
|
|
||||||
|
|
||||||
Codecs:
|
Codecs:
|
||||||
4xm.c Michael Niedermayer
|
4xm.c Michael Niedermayer
|
||||||
8bps.c Roberto Togni
|
8bps.c Roberto Togni
|
||||||
8svx.c Jaikrishnan Menon
|
8svx.c Jaikrishnan Menon
|
||||||
aacenc*, aaccoder.c Rostislav Pehlivanov
|
aasc.c Kostya Shishkov
|
||||||
|
ac3* Justin Ruggles
|
||||||
alacenc.c Jaikrishnan Menon
|
alacenc.c Jaikrishnan Menon
|
||||||
alsdec.c Thilo Borgmann, Umair Khan
|
alsdec.c Thilo Borgmann
|
||||||
aptx.c Aurelien Jacobs
|
apedec.c Kostya Shishkov
|
||||||
ass* Aurelien Jacobs
|
ass* Aurelien Jacobs
|
||||||
asv* Michael Niedermayer
|
asv* Michael Niedermayer
|
||||||
|
atrac3* Benjamin Larsson
|
||||||
atrac3plus* Maxim Poliakovski
|
atrac3plus* Maxim Poliakovski
|
||||||
audiotoolbox* rcombs
|
|
||||||
avs2* Huiwen Ren
|
|
||||||
bgmc.c, bgmc.h Thilo Borgmann
|
bgmc.c, bgmc.h Thilo Borgmann
|
||||||
|
bink.c Kostya Shishkov
|
||||||
binkaudio.c Peter Ross
|
binkaudio.c Peter Ross
|
||||||
|
bmp.c Mans Rullgard, Kostya Shishkov
|
||||||
cavs* Stefan Gehrer
|
cavs* Stefan Gehrer
|
||||||
cdxl.c Paul B Mahol
|
cdxl.c Paul B Mahol
|
||||||
celp_filters.* Vitor Sessak
|
celp_filters.* Vitor Sessak
|
||||||
cinepak.c Roberto Togni
|
cinepak.c Roberto Togni
|
||||||
cinepakenc.c Rl / Aetey G.T. AB
|
cinepakenc.c Rl / Aetey G.T. AB
|
||||||
ccaption_dec.c Anshul Maheshwari, Aman Gupta
|
|
||||||
cljr Alex Beregszaszi
|
cljr Alex Beregszaszi
|
||||||
|
cllc.c Derek Buitenhuis
|
||||||
|
cook.c, cookdata.h Benjamin Larsson
|
||||||
cpia.c Stephan Hilb
|
cpia.c Stephan Hilb
|
||||||
crystalhd.c Philip Langdale
|
crystalhd.c Philip Langdale
|
||||||
cscd.c Reimar Doeffinger
|
cscd.c Reimar Doeffinger
|
||||||
cuviddec.c Timo Rothenpieler
|
dca.c Kostya Shishkov, Benjamin Larsson
|
||||||
dca* foo86
|
|
||||||
dirac* Rostislav Pehlivanov
|
|
||||||
dnxhd* Baptiste Coudurier
|
dnxhd* Baptiste Coudurier
|
||||||
dolby_e* foo86
|
|
||||||
dpcm.c Mike Melanson
|
dpcm.c Mike Melanson
|
||||||
dss_sp.c Oleksij Rempel
|
|
||||||
dv.c Roman Shaposhnik
|
dv.c Roman Shaposhnik
|
||||||
dvbsubdec.c Anshul Maheshwari
|
dxa.c Kostya Shishkov
|
||||||
eacmv*, eaidct*, eat* Peter Ross
|
eacmv*, eaidct*, eat* Peter Ross
|
||||||
evrc* Paul B Mahol
|
|
||||||
exif.c, exif.h Thilo Borgmann
|
exif.c, exif.h Thilo Borgmann
|
||||||
ffv1* Michael Niedermayer
|
ffv1.c Michael Niedermayer
|
||||||
ffwavesynth.c Nicolas George
|
ffwavesynth.c Nicolas George
|
||||||
fifo.c Jan Sebechlebsky
|
flac* Justin Ruggles
|
||||||
|
flashsv* Benjamin Larsson
|
||||||
flicvideo.c Mike Melanson
|
flicvideo.c Mike Melanson
|
||||||
g722.c Martin Storsjo
|
g722.c Martin Storsjo
|
||||||
g726.c Roman Shaposhnik
|
g726.c Roman Shaposhnik
|
||||||
@@ -180,52 +176,58 @@ Codecs:
|
|||||||
h261* Michael Niedermayer
|
h261* Michael Niedermayer
|
||||||
h263* Michael Niedermayer
|
h263* Michael Niedermayer
|
||||||
h264* Loren Merritt, Michael Niedermayer
|
h264* Loren Merritt, Michael Niedermayer
|
||||||
hap* Tom Butterworth
|
huffyuv.c Michael Niedermayer
|
||||||
huffyuv* Michael Niedermayer
|
|
||||||
idcinvideo.c Mike Melanson
|
idcinvideo.c Mike Melanson
|
||||||
|
imc* Benjamin Larsson
|
||||||
|
indeo2* Kostya Shishkov
|
||||||
|
indeo5* Kostya Shishkov
|
||||||
interplayvideo.c Mike Melanson
|
interplayvideo.c Mike Melanson
|
||||||
jni*, ffjni* Matthieu Bouron
|
ivi* Kostya Shishkov
|
||||||
|
jacosub* Clément Bœsch
|
||||||
jpeg2000* Nicolas Bertrand
|
jpeg2000* Nicolas Bertrand
|
||||||
|
jpeg_ls.c Kostya Shishkov
|
||||||
jvdec.c Peter Ross
|
jvdec.c Peter Ross
|
||||||
|
kmvc.c Kostya Shishkov
|
||||||
lcl*.c Roberto Togni, Reimar Doeffinger
|
lcl*.c Roberto Togni, Reimar Doeffinger
|
||||||
libcelt_dec.c Nicolas George
|
libcelt_dec.c Nicolas George
|
||||||
libcodec2.c Tomas Härdin
|
|
||||||
libdirac* David Conrad
|
libdirac* David Conrad
|
||||||
libdavs2.c Huiwen Ren
|
|
||||||
libgsm.c Michel Bardiaux
|
libgsm.c Michel Bardiaux
|
||||||
libkvazaar.c Arttu Ylä-Outinen
|
|
||||||
libopenh264enc.c Martin Storsjo, Linjie Fu
|
|
||||||
libopenjpeg.c Jaikrishnan Menon
|
libopenjpeg.c Jaikrishnan Menon
|
||||||
libopenjpegenc.c Michael Bradshaw
|
libopenjpegenc.c Michael Bradshaw
|
||||||
|
libschroedinger* David Conrad
|
||||||
|
libspeexdec.c Justin Ruggles
|
||||||
libtheoraenc.c David Conrad
|
libtheoraenc.c David Conrad
|
||||||
|
libutvideo* Derek Buitenhuis
|
||||||
libvorbis.c David Conrad
|
libvorbis.c David Conrad
|
||||||
libvpx* James Zern
|
libvpx* James Zern
|
||||||
|
libx264.c Mans Rullgard, Jason Garrett-Glaser
|
||||||
|
libx265.c Derek Buitenhuis
|
||||||
libxavs.c Stefan Gehrer
|
libxavs.c Stefan Gehrer
|
||||||
libxavs2.c Huiwen Ren
|
|
||||||
libzvbi-teletextdec.c Marton Balint
|
libzvbi-teletextdec.c Marton Balint
|
||||||
|
loco.c Kostya Shishkov
|
||||||
lzo.h, lzo.c Reimar Doeffinger
|
lzo.h, lzo.c Reimar Doeffinger
|
||||||
mdec.c Michael Niedermayer
|
mdec.c Michael Niedermayer
|
||||||
mimic.c Ramiro Polla
|
mimic.c Ramiro Polla
|
||||||
mjpeg*.c Michael Niedermayer
|
mjpeg*.c Michael Niedermayer
|
||||||
mlp* Ramiro Polla, Jai Luthra
|
mlp* Ramiro Polla
|
||||||
mmvideo.c Peter Ross
|
mmvideo.c Peter Ross
|
||||||
|
mpc* Kostya Shishkov
|
||||||
mpeg12.c, mpeg12data.h Michael Niedermayer
|
mpeg12.c, mpeg12data.h Michael Niedermayer
|
||||||
mpegvideo.c, mpegvideo.h Michael Niedermayer
|
mpegvideo.c, mpegvideo.h Michael Niedermayer
|
||||||
mqc* Nicolas Bertrand
|
mqc* Nicolas Bertrand
|
||||||
msmpeg4.c, msmpeg4data.h Michael Niedermayer
|
msmpeg4.c, msmpeg4data.h Michael Niedermayer
|
||||||
msrle.c Mike Melanson
|
msrle.c Mike Melanson
|
||||||
msvideo1.c Mike Melanson
|
msvideo1.c Mike Melanson
|
||||||
|
nellymoserdec.c Benjamin Larsson
|
||||||
nuv.c Reimar Doeffinger
|
nuv.c Reimar Doeffinger
|
||||||
nvdec*, nvenc* Timo Rothenpieler
|
|
||||||
omx.c Martin Storsjo, Aman Gupta
|
|
||||||
opus* Rostislav Pehlivanov
|
|
||||||
paf.* Paul B Mahol
|
paf.* Paul B Mahol
|
||||||
pcx.c Ivo van Poorten
|
pcx.c Ivo van Poorten
|
||||||
pgssubdec.c Reimar Doeffinger
|
pgssubdec.c Reimar Doeffinger
|
||||||
ptx.c Ivo van Poorten
|
ptx.c Ivo van Poorten
|
||||||
qcelp* Reynaldo H. Verdejo Pinochet
|
qcelp* Reynaldo H. Verdejo Pinochet
|
||||||
qdm2.c, qdm2data.h Roberto Togni
|
qdm2.c, qdm2data.h Roberto Togni, Benjamin Larsson
|
||||||
qsv* Mark Thompson, Zhong Li
|
qdrw.c Kostya Shishkov
|
||||||
|
qpeg.c Kostya Shishkov
|
||||||
qtrle.c Mike Melanson
|
qtrle.c Mike Melanson
|
||||||
ra144.c, ra144.h, ra288.c, ra288.h Roberto Togni
|
ra144.c, ra144.h, ra288.c, ra288.h Roberto Togni
|
||||||
resample2.c Michael Niedermayer
|
resample2.c Michael Niedermayer
|
||||||
@@ -233,50 +235,65 @@ Codecs:
|
|||||||
rpza.c Roberto Togni
|
rpza.c Roberto Togni
|
||||||
rtjpeg.c, rtjpeg.h Reimar Doeffinger
|
rtjpeg.c, rtjpeg.h Reimar Doeffinger
|
||||||
rv10.c Michael Niedermayer
|
rv10.c Michael Niedermayer
|
||||||
|
rv3* Kostya Shishkov
|
||||||
|
rv4* Kostya Shishkov
|
||||||
s3tc* Ivo van Poorten
|
s3tc* Ivo van Poorten
|
||||||
|
smacker.c Kostya Shishkov
|
||||||
smc.c Mike Melanson
|
smc.c Mike Melanson
|
||||||
snow* Michael Niedermayer, Loren Merritt
|
smvjpegdec.c Ash Hughes
|
||||||
|
snow.c Michael Niedermayer, Loren Merritt
|
||||||
sonic.c Alex Beregszaszi
|
sonic.c Alex Beregszaszi
|
||||||
speedhq.c Steinar H. Gunderson
|
|
||||||
srt* Aurelien Jacobs
|
srt* Aurelien Jacobs
|
||||||
sunrast.c Ivo van Poorten
|
sunrast.c Ivo van Poorten
|
||||||
svq3.c Michael Niedermayer
|
svq3.c Michael Niedermayer
|
||||||
tak* Paul B Mahol
|
tak* Paul B Mahol
|
||||||
|
targa.c Kostya Shishkov
|
||||||
|
tiff.c Kostya Shishkov
|
||||||
truemotion1* Mike Melanson
|
truemotion1* Mike Melanson
|
||||||
|
truemotion2* Kostya Shishkov
|
||||||
|
truespeech.c Kostya Shishkov
|
||||||
|
tscc.c Kostya Shishkov
|
||||||
tta.c Alex Beregszaszi, Jaikrishnan Menon
|
tta.c Alex Beregszaszi, Jaikrishnan Menon
|
||||||
ttaenc.c Paul B Mahol
|
ttaenc.c Paul B Mahol
|
||||||
txd.c Ivo van Poorten
|
txd.c Ivo van Poorten
|
||||||
v4l2_* Jorge Ramirez-Ortiz
|
ulti* Kostya Shishkov
|
||||||
vc2* Rostislav Pehlivanov
|
v410*.c Derek Buitenhuis
|
||||||
|
vb.c Kostya Shishkov
|
||||||
|
vble.c Derek Buitenhuis
|
||||||
|
vc1* Kostya Shishkov
|
||||||
vcr1.c Michael Niedermayer
|
vcr1.c Michael Niedermayer
|
||||||
videotoolboxenc.c Rick Kern, Aman Gupta
|
vda_h264_dec.c Xidorn Quan
|
||||||
vima.c Paul B Mahol
|
vima.c Paul B Mahol
|
||||||
vorbisdec.c Denes Balatoni, David Conrad
|
vmnc.c Kostya Shishkov
|
||||||
vorbisenc.c Oded Shimon
|
vorbis_dec.c Denes Balatoni, David Conrad
|
||||||
|
vorbis_enc.c Oded Shimon
|
||||||
vp3* Mike Melanson
|
vp3* Mike Melanson
|
||||||
vp5 Aurelien Jacobs
|
vp5 Aurelien Jacobs
|
||||||
vp6 Aurelien Jacobs
|
vp6 Aurelien Jacobs
|
||||||
vp8 David Conrad, Ronald Bultje
|
vp8 David Conrad, Jason Garrett-Glaser, Ronald Bultje
|
||||||
vp9 Ronald Bultje
|
vp9 Ronald Bultje, Clément Bœsch
|
||||||
vqavideo.c Mike Melanson
|
vqavideo.c Mike Melanson
|
||||||
|
wavpack.c Kostya Shishkov
|
||||||
wmaprodec.c Sascha Sommer
|
wmaprodec.c Sascha Sommer
|
||||||
wmavoice.c Ronald S. Bultje
|
wmavoice.c Ronald S. Bultje
|
||||||
wmv2.c Michael Niedermayer
|
wmv2.c Michael Niedermayer
|
||||||
|
wnv1.c Kostya Shishkov
|
||||||
xan.c Mike Melanson
|
xan.c Mike Melanson
|
||||||
xbm* Paul B Mahol
|
xbm* Paul B Mahol
|
||||||
xface Stefano Sabatini
|
xface Stefano Sabatini
|
||||||
|
xl.c Kostya Shishkov
|
||||||
xvmc.c Ivan Kalvachev
|
xvmc.c Ivan Kalvachev
|
||||||
xwd* Paul B Mahol
|
xwd* Paul B Mahol
|
||||||
|
zerocodec.c Derek Buitenhuis
|
||||||
|
zmbv* Kostya Shishkov
|
||||||
|
|
||||||
Hardware acceleration:
|
Hardware acceleration:
|
||||||
crystalhd.c Philip Langdale
|
crystalhd.c Philip Langdale
|
||||||
dxva2* Hendrik Leppkes, Laurent Aimar, Steve Lhomme
|
dxva2* Laurent Aimar
|
||||||
d3d11va* Steve Lhomme
|
libstagefright.cpp Mohamed Naufal
|
||||||
mediacodec* Matthieu Bouron, Aman Gupta
|
|
||||||
vaapi* Gwenole Beauchesne
|
vaapi* Gwenole Beauchesne
|
||||||
vaapi_encode* Mark Thompson
|
vda* Sebastien Zwickert
|
||||||
vdpau* Philip Langdale, Carl Eugen Hoyos
|
vdpau* Carl Eugen Hoyos
|
||||||
videotoolbox* Rick Kern, Aman Gupta
|
|
||||||
|
|
||||||
|
|
||||||
libavdevice
|
libavdevice
|
||||||
@@ -285,22 +302,16 @@ libavdevice
|
|||||||
libavdevice/avdevice.h
|
libavdevice/avdevice.h
|
||||||
|
|
||||||
|
|
||||||
avfoundation.m Thilo Borgmann
|
dshow.c Roger Pack
|
||||||
android_camera.c Felix Matouschek
|
|
||||||
decklink* Marton Balint
|
|
||||||
dshow.c Roger Pack (CC rogerdpack@gmail.com)
|
|
||||||
fbdev_enc.c Lukasz Marek
|
fbdev_enc.c Lukasz Marek
|
||||||
gdigrab.c Roger Pack (CC rogerdpack@gmail.com)
|
|
||||||
iec61883.c Georg Lippitsch
|
iec61883.c Georg Lippitsch
|
||||||
lavfi Stefano Sabatini
|
lavfi Stefano Sabatini
|
||||||
libdc1394.c Roman Shaposhnik
|
libdc1394.c Roman Shaposhnik
|
||||||
opengl_enc.c Lukasz Marek
|
opengl_enc.c Lukasz Marek
|
||||||
pulse_audio_enc.c Lukasz Marek
|
pulse_audio_enc.c Lukasz Marek
|
||||||
sdl Stefano Sabatini
|
sdl Stefano Sabatini
|
||||||
sdl2.c Josh de Kock
|
v4l2.c Luca Abeni
|
||||||
v4l2.c Giorgio Vazzana
|
|
||||||
vfwcap.c Ramiro Polla
|
vfwcap.c Ramiro Polla
|
||||||
xv.c Lukasz Marek
|
|
||||||
|
|
||||||
libavfilter
|
libavfilter
|
||||||
===========
|
===========
|
||||||
@@ -308,10 +319,7 @@ libavfilter
|
|||||||
Generic parts:
|
Generic parts:
|
||||||
graphdump.c Nicolas George
|
graphdump.c Nicolas George
|
||||||
|
|
||||||
motion_estimation.c Davinder Singh
|
|
||||||
|
|
||||||
Filters:
|
Filters:
|
||||||
f_drawgraph.c Paul B Mahol
|
|
||||||
af_adelay.c Paul B Mahol
|
af_adelay.c Paul B Mahol
|
||||||
af_aecho.c Paul B Mahol
|
af_aecho.c Paul B Mahol
|
||||||
af_afade.c Paul B Mahol
|
af_afade.c Paul B Mahol
|
||||||
@@ -319,61 +327,32 @@ Filters:
|
|||||||
af_aphaser.c Paul B Mahol
|
af_aphaser.c Paul B Mahol
|
||||||
af_aresample.c Michael Niedermayer
|
af_aresample.c Michael Niedermayer
|
||||||
af_astats.c Paul B Mahol
|
af_astats.c Paul B Mahol
|
||||||
|
af_astreamsync.c Nicolas George
|
||||||
af_atempo.c Pavel Koshevoy
|
af_atempo.c Pavel Koshevoy
|
||||||
af_biquads.c Paul B Mahol
|
af_biquads.c Paul B Mahol
|
||||||
af_chorus.c Paul B Mahol
|
|
||||||
af_compand.c Paul B Mahol
|
af_compand.c Paul B Mahol
|
||||||
af_firequalizer.c Muhammad Faiz
|
|
||||||
af_hdcd.c Burt P.
|
|
||||||
af_ladspa.c Paul B Mahol
|
af_ladspa.c Paul B Mahol
|
||||||
af_loudnorm.c Kyle Swanson
|
|
||||||
af_pan.c Nicolas George
|
af_pan.c Nicolas George
|
||||||
af_sidechaincompress.c Paul B Mahol
|
|
||||||
af_silenceremove.c Paul B Mahol
|
|
||||||
avf_aphasemeter.c Paul B Mahol
|
|
||||||
avf_avectorscope.c Paul B Mahol
|
avf_avectorscope.c Paul B Mahol
|
||||||
avf_showcqt.c Muhammad Faiz
|
|
||||||
vf_blend.c Paul B Mahol
|
vf_blend.c Paul B Mahol
|
||||||
vf_bwdif Thomas Mundt (CC <thomas.mundt@hr.de>)
|
|
||||||
vf_chromakey.c Timo Rothenpieler
|
|
||||||
vf_colorchannelmixer.c Paul B Mahol
|
|
||||||
vf_colorconstancy.c Mina Sami (CC <minas.gorgy@gmail.com>)
|
|
||||||
vf_colorbalance.c Paul B Mahol
|
vf_colorbalance.c Paul B Mahol
|
||||||
vf_colorkey.c Timo Rothenpieler
|
|
||||||
vf_colorlevels.c Paul B Mahol
|
|
||||||
vf_coreimage.m Thilo Borgmann
|
|
||||||
vf_deband.c Paul B Mahol
|
|
||||||
vf_dejudder.c Nicholas Robbins
|
vf_dejudder.c Nicholas Robbins
|
||||||
vf_delogo.c Jean Delvare (CC <jdelvare@suse.com>)
|
vf_delogo.c Jean Delvare (CC <khali@linux-fr.org>)
|
||||||
vf_drawbox.c/drawgrid Andrey Utkin
|
vf_drawbox.c/drawgrid Andrey Utkin
|
||||||
vf_extractplanes.c Paul B Mahol
|
vf_extractplanes.c Paul B Mahol
|
||||||
vf_histogram.c Paul B Mahol
|
vf_histogram.c Paul B Mahol
|
||||||
vf_hqx.c Clément Bœsch
|
|
||||||
vf_idet.c Pascal Massimino
|
|
||||||
vf_il.c Paul B Mahol
|
vf_il.c Paul B Mahol
|
||||||
vf_(t)interlace Thomas Mundt (CC <thomas.mundt@hr.de>)
|
|
||||||
vf_lenscorrection.c Daniel Oberhoff
|
|
||||||
vf_mergeplanes.c Paul B Mahol
|
vf_mergeplanes.c Paul B Mahol
|
||||||
vf_mestimate.c Davinder Singh
|
|
||||||
vf_minterpolate.c Davinder Singh
|
|
||||||
vf_neighbor.c Paul B Mahol
|
|
||||||
vf_psnr.c Paul B Mahol
|
vf_psnr.c Paul B Mahol
|
||||||
vf_random.c Paul B Mahol
|
|
||||||
vf_readvitc.c Tobias Rapp (CC t.rapp at noa-archive dot com)
|
|
||||||
vf_scale.c Michael Niedermayer
|
vf_scale.c Michael Niedermayer
|
||||||
vf_separatefields.c Paul B Mahol
|
vf_separatefields.c Paul B Mahol
|
||||||
vf_ssim.c Paul B Mahol
|
|
||||||
vf_stereo3d.c Paul B Mahol
|
vf_stereo3d.c Paul B Mahol
|
||||||
vf_telecine.c Paul B Mahol
|
vf_telecine.c Paul B Mahol
|
||||||
vf_tonemap_opencl.c Ruiling Song
|
|
||||||
vf_yadif.c Michael Niedermayer
|
vf_yadif.c Michael Niedermayer
|
||||||
vf_zoompan.c Paul B Mahol
|
|
||||||
|
|
||||||
Sources:
|
Sources:
|
||||||
vsrc_mandelbrot.c Michael Niedermayer
|
vsrc_mandelbrot.c Michael Niedermayer
|
||||||
|
|
||||||
dnn Yejun Guo
|
|
||||||
|
|
||||||
libavformat
|
libavformat
|
||||||
===========
|
===========
|
||||||
|
|
||||||
@@ -382,51 +361,39 @@ Generic parts:
|
|||||||
libavformat/avformat.h Michael Niedermayer
|
libavformat/avformat.h Michael Niedermayer
|
||||||
Utility Code:
|
Utility Code:
|
||||||
libavformat/utils.c Michael Niedermayer
|
libavformat/utils.c Michael Niedermayer
|
||||||
Text Subtitles Clément Bœsch
|
|
||||||
|
|
||||||
|
|
||||||
Muxers/Demuxers:
|
Muxers/Demuxers:
|
||||||
4xm.c Mike Melanson
|
4xm.c Mike Melanson
|
||||||
aadec.c Vesselin Bontchev (vesselin.bontchev at yandex dot com)
|
|
||||||
adtsenc.c Robert Swain
|
adtsenc.c Robert Swain
|
||||||
afc.c Paul B Mahol
|
afc.c Paul B Mahol
|
||||||
aiffdec.c Baptiste Coudurier, Matthieu Bouron
|
aiffdec.c Baptiste Coudurier, Matthieu Bouron
|
||||||
aiffenc.c Baptiste Coudurier, Matthieu Bouron
|
aiffenc.c Baptiste Coudurier, Matthieu Bouron
|
||||||
alp.c Zane van Iperen
|
ape.c Kostya Shishkov
|
||||||
amvenc.c Zane van Iperen
|
|
||||||
apm.c Zane van Iperen
|
|
||||||
apngdec.c Benoit Fouet
|
|
||||||
argo_asf.c Zane van Iperen
|
|
||||||
argo_brp.c Zane van Iperen
|
|
||||||
ass* Aurelien Jacobs
|
ass* Aurelien Jacobs
|
||||||
astdec.c Paul B Mahol
|
astdec.c Paul B Mahol
|
||||||
astenc.c James Almer
|
astenc.c James Almer
|
||||||
avi* Michael Niedermayer
|
avi* Michael Niedermayer
|
||||||
avisynth.c Stephen Hutchinson
|
avisynth.c AvxSynth Team (avxsynth.testing at gmail dot com)
|
||||||
avr.c Paul B Mahol
|
avr.c Paul B Mahol
|
||||||
bink.c Peter Ross
|
bink.c Peter Ross
|
||||||
boadec.c Michael Niedermayer
|
|
||||||
brstm.c Paul B Mahol
|
brstm.c Paul B Mahol
|
||||||
caf* Peter Ross
|
caf* Peter Ross
|
||||||
cdxl.c Paul B Mahol
|
cdxl.c Paul B Mahol
|
||||||
codec2.c Tomas Härdin
|
|
||||||
crc.c Michael Niedermayer
|
crc.c Michael Niedermayer
|
||||||
dashdec.c Steven Liu
|
|
||||||
dashenc.c Karthick Jeyapal
|
|
||||||
daud.c Reimar Doeffinger
|
daud.c Reimar Doeffinger
|
||||||
dss.c Oleksij Rempel
|
|
||||||
dtsdec.c foo86
|
|
||||||
dtshddec.c Paul B Mahol
|
dtshddec.c Paul B Mahol
|
||||||
dv.c Roman Shaposhnik
|
dv.c Roman Shaposhnik
|
||||||
|
dxa.c Kostya Shishkov
|
||||||
electronicarts.c Peter Ross
|
electronicarts.c Peter Ross
|
||||||
epafdec.c Paul B Mahol
|
epafdec.c Paul B Mahol
|
||||||
ffm* Baptiste Coudurier
|
ffm* Baptiste Coudurier
|
||||||
|
flac* Justin Ruggles
|
||||||
flic.c Mike Melanson
|
flic.c Mike Melanson
|
||||||
flvdec.c Michael Niedermayer
|
flvdec.c, flvenc.c Michael Niedermayer
|
||||||
flvenc.c Michael Niedermayer, Steven Liu
|
|
||||||
gxf.c Reimar Doeffinger
|
gxf.c Reimar Doeffinger
|
||||||
gxfenc.c Baptiste Coudurier
|
gxfenc.c Baptiste Coudurier
|
||||||
hlsenc.c Christian Suloway, Steven Liu
|
hls.c Anssi Hannula
|
||||||
idcin.c Mike Melanson
|
idcin.c Mike Melanson
|
||||||
idroqdec.c Mike Melanson
|
idroqdec.c Mike Melanson
|
||||||
iff.c Jaikrishnan Menon
|
iff.c Jaikrishnan Menon
|
||||||
@@ -434,41 +401,39 @@ Muxers/Demuxers:
|
|||||||
ipmovie.c Mike Melanson
|
ipmovie.c Mike Melanson
|
||||||
ircam* Paul B Mahol
|
ircam* Paul B Mahol
|
||||||
iss.c Stefan Gehrer
|
iss.c Stefan Gehrer
|
||||||
|
jacosub* Clément Bœsch
|
||||||
jvdec.c Peter Ross
|
jvdec.c Peter Ross
|
||||||
kvag.c Zane van Iperen
|
|
||||||
libmodplug.c Clément Bœsch
|
libmodplug.c Clément Bœsch
|
||||||
libopenmpt.c Josh de Kock
|
libnut.c Oded Shimon
|
||||||
lmlm4.c Ivo van Poorten
|
lmlm4.c Ivo van Poorten
|
||||||
lvfdec.c Paul B Mahol
|
lvfdec.c Paul B Mahol
|
||||||
lxfdec.c Tomas Härdin
|
lxfdec.c Tomas Härdin
|
||||||
matroska.c Aurelien Jacobs, Andreas Rheinhardt
|
matroska.c Aurelien Jacobs
|
||||||
matroskadec.c Aurelien Jacobs, Andreas Rheinhardt
|
matroskadec.c Aurelien Jacobs
|
||||||
matroskaenc.c David Conrad, Andreas Rheinhardt
|
matroskaenc.c David Conrad
|
||||||
matroska subtitles (matroskaenc.c) John Peebles
|
|
||||||
metadata* Aurelien Jacobs
|
metadata* Aurelien Jacobs
|
||||||
mgsts.c Paul B Mahol
|
mgsts.c Paul B Mahol
|
||||||
microdvd* Aurelien Jacobs
|
microdvd* Aurelien Jacobs
|
||||||
mm.c Peter Ross
|
mm.c Peter Ross
|
||||||
mov.c Baptiste Coudurier
|
mov.c Michael Niedermayer, Baptiste Coudurier
|
||||||
movenc.c Baptiste Coudurier, Matthieu Bouron
|
movenc.c Baptiste Coudurier, Matthieu Bouron
|
||||||
movenccenc.c Eran Kornblau
|
mpc.c Kostya Shishkov
|
||||||
mpeg.c Michael Niedermayer
|
mpeg.c Michael Niedermayer
|
||||||
mpegenc.c Michael Niedermayer
|
mpegenc.c Michael Niedermayer
|
||||||
mpegts.c Marton Balint
|
mpegts* Baptiste Coudurier
|
||||||
mpegtsenc.c Baptiste Coudurier
|
|
||||||
msnwc_tcp.c Ramiro Polla
|
msnwc_tcp.c Ramiro Polla
|
||||||
mtv.c Reynaldo H. Verdejo Pinochet
|
mtv.c Reynaldo H. Verdejo Pinochet
|
||||||
mxf* Baptiste Coudurier, Tomas Härdin
|
mxf* Baptiste Coudurier
|
||||||
|
mxfdec.c Tomas Härdin
|
||||||
nistspheredec.c Paul B Mahol
|
nistspheredec.c Paul B Mahol
|
||||||
nsvdec.c Francois Revol
|
nsvdec.c Francois Revol
|
||||||
nut* Michael Niedermayer
|
nut.c Michael Niedermayer
|
||||||
nuv.c Reimar Doeffinger
|
nuv.c Reimar Doeffinger
|
||||||
oggdec.c, oggdec.h David Conrad
|
oggdec.c, oggdec.h David Conrad
|
||||||
oggenc.c Baptiste Coudurier
|
oggenc.c Baptiste Coudurier
|
||||||
oggparse*.c David Conrad
|
oggparse*.c David Conrad
|
||||||
oma.c Maxim Poliakovski
|
oma.c Maxim Poliakovski
|
||||||
paf.c Paul B Mahol
|
paf.c Paul B Mahol
|
||||||
pp_bnk.c Zane van Iperen
|
|
||||||
psxstr.c Mike Melanson
|
psxstr.c Mike Melanson
|
||||||
pva.c Ivo van Poorten
|
pva.c Ivo van Poorten
|
||||||
pvfdec.c Paul B Mahol
|
pvfdec.c Paul B Mahol
|
||||||
@@ -476,22 +441,17 @@ Muxers/Demuxers:
|
|||||||
raw.c Michael Niedermayer
|
raw.c Michael Niedermayer
|
||||||
rdt.c Ronald S. Bultje
|
rdt.c Ronald S. Bultje
|
||||||
rl2.c Sascha Sommer
|
rl2.c Sascha Sommer
|
||||||
rmdec.c, rmenc.c Ronald S. Bultje
|
rmdec.c, rmenc.c Ronald S. Bultje, Kostya Shishkov
|
||||||
|
rtmp* Kostya Shishkov
|
||||||
rtp.c, rtpenc.c Martin Storsjo
|
rtp.c, rtpenc.c Martin Storsjo
|
||||||
rtpdec_ac3.* Gilles Chanteperdrix
|
|
||||||
rtpdec_dv.* Thomas Volkert
|
|
||||||
rtpdec_h261.*, rtpenc_h261.* Thomas Volkert
|
|
||||||
rtpdec_hevc.*, rtpenc_hevc.* Thomas Volkert
|
|
||||||
rtpdec_mpa_robust.* Gilles Chanteperdrix
|
|
||||||
rtpdec_asf.* Ronald S. Bultje
|
rtpdec_asf.* Ronald S. Bultje
|
||||||
rtpdec_vc2hq.*, rtpenc_vc2hq.* Thomas Volkert
|
|
||||||
rtpdec_vp9.c Thomas Volkert
|
|
||||||
rtpenc_mpv.*, rtpenc_aac.* Martin Storsjo
|
rtpenc_mpv.*, rtpenc_aac.* Martin Storsjo
|
||||||
s337m.c foo86
|
rtsp.c Luca Barbato
|
||||||
sbgdec.c Nicolas George
|
sbgdec.c Nicolas George
|
||||||
sdp.c Martin Storsjo
|
sdp.c Martin Storsjo
|
||||||
segafilm.c Mike Melanson
|
segafilm.c Mike Melanson
|
||||||
segment.c Stefano Sabatini
|
siff.c Kostya Shishkov
|
||||||
|
smacker.c Kostya Shishkov
|
||||||
smjpeg* Paul B Mahol
|
smjpeg* Paul B Mahol
|
||||||
spdif* Anssi Hannula
|
spdif* Anssi Hannula
|
||||||
srtdec.c Aurelien Jacobs
|
srtdec.c Aurelien Jacobs
|
||||||
@@ -502,22 +462,19 @@ Muxers/Demuxers:
|
|||||||
voc.c Aurelien Jacobs
|
voc.c Aurelien Jacobs
|
||||||
wav.c Michael Niedermayer
|
wav.c Michael Niedermayer
|
||||||
wc3movie.c Mike Melanson
|
wc3movie.c Mike Melanson
|
||||||
webm dash (matroskaenc.c) Vignesh Venkatasubramanian
|
|
||||||
webvtt* Matthew J Heaney
|
webvtt* Matthew J Heaney
|
||||||
westwood.c Mike Melanson
|
westwood.c Mike Melanson
|
||||||
wtv.c Peter Ross
|
wtv.c Peter Ross
|
||||||
|
wv.c Kostya Shishkov
|
||||||
wvenc.c Paul B Mahol
|
wvenc.c Paul B Mahol
|
||||||
|
|
||||||
Protocols:
|
Protocols:
|
||||||
async.c Zhang Rui
|
|
||||||
bluray.c Petri Hintukainen
|
bluray.c Petri Hintukainen
|
||||||
ftp.c Lukasz Marek
|
ftp.c Lukasz Marek
|
||||||
http.c Ronald S. Bultje
|
http.c Ronald S. Bultje
|
||||||
libssh.c Lukasz Marek
|
libssh.c Lukasz Marek
|
||||||
libzmq.c Andriy Gelman
|
|
||||||
mms*.c Ronald S. Bultje
|
mms*.c Ronald S. Bultje
|
||||||
udp.c Luca Abeni
|
udp.c Luca Abeni
|
||||||
icecast.c Marvin Scholz
|
|
||||||
|
|
||||||
|
|
||||||
libswresample
|
libswresample
|
||||||
@@ -537,102 +494,62 @@ Resamplers:
|
|||||||
Operating systems / CPU architectures
|
Operating systems / CPU architectures
|
||||||
=====================================
|
=====================================
|
||||||
|
|
||||||
Alpha Falk Hueffner
|
Alpha Mans Rullgard, Falk Hueffner
|
||||||
MIPS Manojkumar Bhosale, Shiyou Yin
|
ARM Mans Rullgard
|
||||||
|
AVR32 Mans Rullgard
|
||||||
|
MIPS Mans Rullgard, Nedeljko Babic
|
||||||
Mac OS X / PowerPC Romain Dolbeau, Guillaume Poirier
|
Mac OS X / PowerPC Romain Dolbeau, Guillaume Poirier
|
||||||
Amiga / PowerPC Colin Ward
|
Amiga / PowerPC Colin Ward
|
||||||
Linux / PowerPC Lauri Kasanen
|
Linux / PowerPC Luca Barbato
|
||||||
Windows MinGW Alex Beregszaszi, Ramiro Polla
|
Windows MinGW Alex Beregszaszi, Ramiro Polla
|
||||||
Windows Cygwin Victor Paesa
|
Windows Cygwin Victor Paesa
|
||||||
Windows MSVC Matthew Oliver, Hendrik Leppkes
|
|
||||||
Windows ICL Matthew Oliver
|
|
||||||
ADI/Blackfin DSP Marc Hoffman
|
ADI/Blackfin DSP Marc Hoffman
|
||||||
Sparc Roman Shaposhnik
|
Sparc Roman Shaposhnik
|
||||||
OS/2 KO Myung-Hun
|
x86 Michael Niedermayer
|
||||||
|
|
||||||
|
|
||||||
Developers with git write access who are currently not maintaining any specific part
|
|
||||||
====================================================================================
|
|
||||||
Alex Converse
|
|
||||||
Andreas Cadhalpun
|
|
||||||
Anuradha Suraparaju
|
|
||||||
Ben Littler
|
|
||||||
Benjamin Larsson
|
|
||||||
Bobby Bingham
|
|
||||||
Daniel Verkamp
|
|
||||||
Derek Buitenhuis
|
|
||||||
Ganesh Ajjanagadde
|
|
||||||
Henrik Gramner
|
|
||||||
Ivan Uskov
|
|
||||||
James Darnley
|
|
||||||
Jan Ekström
|
|
||||||
Joakim Plate
|
|
||||||
Jun Zhao
|
|
||||||
Kieran Kunhya
|
|
||||||
Kirill Gavrilov
|
|
||||||
Limin Wang
|
|
||||||
Martin Storsjö
|
|
||||||
Panagiotis Issaris
|
|
||||||
Pedro Arthur
|
|
||||||
Sebastien Zwickert
|
|
||||||
Vittorio Giovara
|
|
||||||
wm4
|
|
||||||
(this list is incomplete)
|
|
||||||
|
|
||||||
|
|
||||||
Releases
|
Releases
|
||||||
========
|
========
|
||||||
|
|
||||||
2.8 Michael Niedermayer
|
2.2 Michael Niedermayer
|
||||||
2.7 Michael Niedermayer
|
2.1 Michael Niedermayer
|
||||||
2.6 Michael Niedermayer
|
1.2 Michael Niedermayer
|
||||||
2.5 Michael Niedermayer
|
|
||||||
|
|
||||||
If you want to maintain an older release, please contact us
|
If you want to maintain an older release, please contact us
|
||||||
|
|
||||||
|
|
||||||
GnuPG Fingerprints and IRC nicknames of maintainers and contributors
|
GnuPG Fingerprints of maintainers and contributors
|
||||||
====================================================================
|
==================================================
|
||||||
|
|
||||||
IRC nicknames are in parentheses. These apply
|
|
||||||
to the IRC channels listed on the website.
|
|
||||||
|
|
||||||
Alexander Strasser 1C96 78B7 83CB 8AA7 9AF5 D1EB A7D8 A57B A876 E58F
|
Alexander Strasser 1C96 78B7 83CB 8AA7 9AF5 D1EB A7D8 A57B A876 E58F
|
||||||
Anssi Hannula 1A92 FF42 2DD9 8D2E 8AF7 65A9 4278 C520 513D F3CB
|
Anssi Hannula 1A92 FF42 2DD9 8D2E 8AF7 65A9 4278 C520 513D F3CB
|
||||||
|
Anton Khirnov 6D0C 6625 56F8 65D1 E5F5 814B B50A 1241 C067 07AB
|
||||||
Ash Hughes 694D 43D2 D180 C7C7 6421 ABD3 A641 D0B7 623D 6029
|
Ash Hughes 694D 43D2 D180 C7C7 6421 ABD3 A641 D0B7 623D 6029
|
||||||
Attila Kinali 11F0 F9A6 A1D2 11F6 C745 D10C 6520 BCDD F2DF E765
|
Attila Kinali 11F0 F9A6 A1D2 11F6 C745 D10C 6520 BCDD F2DF E765
|
||||||
Baptiste Coudurier 8D77 134D 20CC 9220 201F C5DB 0AC9 325C 5C1A BAAA
|
Baptiste Coudurier 8D77 134D 20CC 9220 201F C5DB 0AC9 325C 5C1A BAAA
|
||||||
Ben Littler 3EE3 3723 E560 3214 A8CD 4DEB 2CDB FCE7 768C 8D2C
|
Ben Littler 3EE3 3723 E560 3214 A8CD 4DEB 2CDB FCE7 768C 8D2C
|
||||||
Benoit Fouet B22A 4F4F 43EF 636B BB66 FCDC 0023 AE1E 2985 49C8
|
Benoit Fouet B22A 4F4F 43EF 636B BB66 FCDC 0023 AE1E 2985 49C8
|
||||||
Clément Bœsch 52D0 3A82 D445 F194 DB8B 2B16 87EE 2CB8 F4B8 FCF9
|
Bœsch Clément 52D0 3A82 D445 F194 DB8B 2B16 87EE 2CB8 F4B8 FCF9
|
||||||
Daniel Verkamp 78A6 07ED 782C 653E C628 B8B9 F0EB 8DD8 2F0E 21C7
|
Daniel Verkamp 78A6 07ED 782C 653E C628 B8B9 F0EB 8DD8 2F0E 21C7
|
||||||
|
Diego Biurrun 8227 1E31 B6D9 4994 7427 E220 9CAE D6CC 4757 FCC5
|
||||||
FFmpeg release signing key FCF9 86EA 15E6 E293 A564 4F10 B432 2F04 D676 58D8
|
FFmpeg release signing key FCF9 86EA 15E6 E293 A564 4F10 B432 2F04 D676 58D8
|
||||||
Ganesh Ajjanagadde C96A 848E 97C3 CEA2 AB72 5CE4 45F9 6A2D 3C36 FB1B
|
|
||||||
Gwenole Beauchesne 2E63 B3A6 3E44 37E2 017D 2704 53C7 6266 B153 99C4
|
Gwenole Beauchesne 2E63 B3A6 3E44 37E2 017D 2704 53C7 6266 B153 99C4
|
||||||
Jaikrishnan Menon 61A1 F09F 01C9 2D45 78E1 C862 25DC 8831 AF70 D368
|
Jaikrishnan Menon 61A1 F09F 01C9 2D45 78E1 C862 25DC 8831 AF70 D368
|
||||||
James Almer 7751 2E8C FD94 A169 57E6 9A7A 1463 01AD 7376 59E0
|
|
||||||
Jean Delvare 7CA6 9F44 60F1 BDC4 1FD2 C858 A552 6B9B B3CD 4E6A
|
Jean Delvare 7CA6 9F44 60F1 BDC4 1FD2 C858 A552 6B9B B3CD 4E6A
|
||||||
|
Justin Ruggles 3136 ECC0 C10D 6C04 5F43 CA29 FCBE CD2A 3787 1EBF
|
||||||
Loren Merritt ABD9 08F4 C920 3F65 D8BE 35D7 1540 DAA7 060F 56DE
|
Loren Merritt ABD9 08F4 C920 3F65 D8BE 35D7 1540 DAA7 060F 56DE
|
||||||
Lynne FE50 139C 6805 72CA FD52 1F8D A2FE A5F0 3F03 4464
|
Lou Logan 7D68 DC73 CBEF EABB 671A B6CF 621C 2E28 82F8 DC3A
|
||||||
|
Luca Barbato 6677 4209 213C 8843 5B67 29E7 E84C 78C2 84E9 0E34
|
||||||
Michael Niedermayer 9FF2 128B 147E F673 0BAD F133 611E C787 040B 0FAB
|
Michael Niedermayer 9FF2 128B 147E F673 0BAD F133 611E C787 040B 0FAB
|
||||||
DD1E C9E8 DE08 5C62 9B3E 1846 B18E 8928 B394 8D64
|
|
||||||
Nicolas George 24CE 01CE 9ACC 5CEB 74D8 8D9D B063 D997 36E5 4C93
|
Nicolas George 24CE 01CE 9ACC 5CEB 74D8 8D9D B063 D997 36E5 4C93
|
||||||
Nikolay Aleksandrov 8978 1D8C FB71 588E 4B27 EAA8 C4F0 B5FC E011 13B1
|
|
||||||
Panagiotis Issaris 6571 13A3 33D9 3726 F728 AA98 F643 B12E ECF3 E029
|
Panagiotis Issaris 6571 13A3 33D9 3726 F728 AA98 F643 B12E ECF3 E029
|
||||||
Peter Ross A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B
|
Peter Ross A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B
|
||||||
Philip Langdale 5DC5 8D66 5FBA 3A43 18EC 045E F8D6 B194 6A75 682E
|
Reimar Döffinger C61D 16E5 9E2C D10C 8958 38A4 0899 A2B9 06D4 D9C7
|
||||||
Ramiro Polla 7859 C65B 751B 1179 792E DAE8 8E95 8B2F 9B6C 5700
|
|
||||||
Reimar Doeffinger C61D 16E5 9E2C D10C 8958 38A4 0899 A2B9 06D4 D9C7
|
|
||||||
Reinhard Tartler 9300 5DC2 7E87 6C37 ED7B CA9A 9808 3544 9453 48A4
|
Reinhard Tartler 9300 5DC2 7E87 6C37 ED7B CA9A 9808 3544 9453 48A4
|
||||||
Reynaldo H. Verdejo Pinochet 6E27 CD34 170C C78E 4D4F 5F40 C18E 077F 3114 452A
|
Reynaldo H. Verdejo Pinochet 6E27 CD34 170C C78E 4D4F 5F40 C18E 077F 3114 452A
|
||||||
Robert Swain EE7A 56EA 4A81 A7B5 2001 A521 67FA 362D A2FC 3E71
|
Robert Swain EE7A 56EA 4A81 A7B5 2001 A521 67FA 362D A2FC 3E71
|
||||||
Sascha Sommer 38A0 F88B 868E 9D3A 97D4 D6A0 E823 706F 1E07 0D3C
|
Sascha Sommer 38A0 F88B 868E 9D3A 97D4 D6A0 E823 706F 1E07 0D3C
|
||||||
Stefano Sabatini 0D0B AD6B 5330 BBAD D3D6 6A0C 719C 2839 FC43 2D5F
|
Stefano Sabatini 0D0B AD6B 5330 BBAD D3D6 6A0C 719C 2839 FC43 2D5F
|
||||||
Steinar H. Gunderson C2E9 004F F028 C18E 4EAD DB83 7F61 7561 7797 8F76
|
|
||||||
Stephan Hilb 4F38 0B3A 5F39 B99B F505 E562 8D5C 5554 4E17 8863
|
Stephan Hilb 4F38 0B3A 5F39 B99B F505 E562 8D5C 5554 4E17 8863
|
||||||
Thilo Borgmann (thilo) CE1D B7F4 4D20 FC3A DD9F FE5A 257C 5B8F 1D20 B92F
|
Tomas Härdin A79D 4E3D F38F 763F 91F5 8B33 A01E 8AE0 41BB 2551
|
||||||
Tiancheng "Timothy" Gu 9456 AFC0 814A 8139 E994 8351 7FE6 B095 B582 B0D4
|
|
||||||
Tim Nicholson 38CF DB09 3ED0 F607 8B67 6CED 0C0B FC44 8B0B FC83
|
|
||||||
Tomas Härdin (thardin) A79D 4E3D F38F 763F 91F5 8B33 A01E 8AE0 41BB 2551
|
|
||||||
Wei Gao 4269 7741 857A 0E60 9EC5 08D2 4744 4EFA 62C1 87B9
|
Wei Gao 4269 7741 857A 0E60 9EC5 08D2 4744 4EFA 62C1 87B9
|
||||||
Zane van Iperen (zane) 61AE D40F 368B 6F26 9DAE 3892 6861 6B2D 8AC4 DCC5
|
|
||||||
|
|||||||
188
Makefile
188
Makefile
@@ -1,94 +1,82 @@
|
|||||||
MAIN_MAKEFILE=1
|
MAIN_MAKEFILE=1
|
||||||
include ffbuild/config.mak
|
include config.mak
|
||||||
|
|
||||||
vpath %.c $(SRC_PATH)
|
vpath %.c $(SRC_PATH)
|
||||||
vpath %.cpp $(SRC_PATH)
|
vpath %.cpp $(SRC_PATH)
|
||||||
vpath %.h $(SRC_PATH)
|
vpath %.h $(SRC_PATH)
|
||||||
vpath %.inc $(SRC_PATH)
|
|
||||||
vpath %.m $(SRC_PATH)
|
|
||||||
vpath %.S $(SRC_PATH)
|
vpath %.S $(SRC_PATH)
|
||||||
vpath %.asm $(SRC_PATH)
|
vpath %.asm $(SRC_PATH)
|
||||||
vpath %.rc $(SRC_PATH)
|
vpath %.rc $(SRC_PATH)
|
||||||
vpath %.v $(SRC_PATH)
|
vpath %.v $(SRC_PATH)
|
||||||
vpath %.texi $(SRC_PATH)
|
vpath %.texi $(SRC_PATH)
|
||||||
vpath %.cu $(SRC_PATH)
|
|
||||||
vpath %.ptx $(SRC_PATH)
|
|
||||||
vpath %/fate_config.sh.template $(SRC_PATH)
|
vpath %/fate_config.sh.template $(SRC_PATH)
|
||||||
|
|
||||||
TESTTOOLS = audiogen videogen rotozoom tiny_psnr tiny_ssim base64 audiomatch
|
AVPROGS-$(CONFIG_FFMPEG) += ffmpeg
|
||||||
HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
|
AVPROGS-$(CONFIG_FFPLAY) += ffplay
|
||||||
|
AVPROGS-$(CONFIG_FFPROBE) += ffprobe
|
||||||
|
AVPROGS-$(CONFIG_FFSERVER) += ffserver
|
||||||
|
|
||||||
# $(FFLIBS-yes) needs to be in linking order
|
AVPROGS := $(AVPROGS-yes:%=%$(PROGSSUF)$(EXESUF))
|
||||||
FFLIBS-$(CONFIG_AVDEVICE) += avdevice
|
INSTPROGS = $(AVPROGS-yes:%=%$(PROGSSUF)$(EXESUF))
|
||||||
FFLIBS-$(CONFIG_AVFILTER) += avfilter
|
PROGS += $(AVPROGS)
|
||||||
FFLIBS-$(CONFIG_AVFORMAT) += avformat
|
|
||||||
FFLIBS-$(CONFIG_AVCODEC) += avcodec
|
AVBASENAMES = ffmpeg ffplay ffprobe ffserver
|
||||||
|
ALLAVPROGS = $(AVBASENAMES:%=%$(PROGSSUF)$(EXESUF))
|
||||||
|
ALLAVPROGS_G = $(AVBASENAMES:%=%$(PROGSSUF)_g$(EXESUF))
|
||||||
|
|
||||||
|
$(foreach prog,$(AVBASENAMES),$(eval OBJS-$(prog) += cmdutils.o))
|
||||||
|
$(foreach prog,$(AVBASENAMES),$(eval OBJS-$(prog)-$(CONFIG_OPENCL) += cmdutils_opencl.o))
|
||||||
|
|
||||||
|
OBJS-ffmpeg += ffmpeg_opt.o ffmpeg_filter.o
|
||||||
|
OBJS-ffmpeg-$(HAVE_VDPAU_X11) += ffmpeg_vdpau.o
|
||||||
|
TESTTOOLS = audiogen videogen rotozoom tiny_psnr tiny_ssim base64
|
||||||
|
HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
|
||||||
|
TOOLS = qt-faststart trasher uncoded_frame
|
||||||
|
TOOLS-$(CONFIG_ZLIB) += cws2fws
|
||||||
|
|
||||||
|
FFLIBS-$(CONFIG_AVDEVICE) += avdevice
|
||||||
|
FFLIBS-$(CONFIG_AVFILTER) += avfilter
|
||||||
|
FFLIBS-$(CONFIG_AVFORMAT) += avformat
|
||||||
FFLIBS-$(CONFIG_AVRESAMPLE) += avresample
|
FFLIBS-$(CONFIG_AVRESAMPLE) += avresample
|
||||||
FFLIBS-$(CONFIG_POSTPROC) += postproc
|
FFLIBS-$(CONFIG_AVCODEC) += avcodec
|
||||||
FFLIBS-$(CONFIG_SWRESAMPLE) += swresample
|
FFLIBS-$(CONFIG_POSTPROC) += postproc
|
||||||
FFLIBS-$(CONFIG_SWSCALE) += swscale
|
FFLIBS-$(CONFIG_SWRESAMPLE)+= swresample
|
||||||
|
FFLIBS-$(CONFIG_SWSCALE) += swscale
|
||||||
|
|
||||||
FFLIBS := avutil
|
FFLIBS := avutil
|
||||||
|
|
||||||
DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.ffpreset) $(SRC_PATH)/doc/ffprobe.xsd
|
DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.ffpreset) $(SRC_PATH)/doc/ffprobe.xsd
|
||||||
|
EXAMPLES_FILES := $(wildcard $(SRC_PATH)/doc/examples/*.c) $(SRC_PATH)/doc/examples/Makefile $(SRC_PATH)/doc/examples/README
|
||||||
|
|
||||||
SKIPHEADERS = compat/w32pthreads.h
|
SKIPHEADERS = cmdutils_common_opts.h compat/w32pthreads.h
|
||||||
|
|
||||||
# first so "all" becomes default target
|
include $(SRC_PATH)/common.mak
|
||||||
all: all-yes
|
|
||||||
|
|
||||||
include $(SRC_PATH)/tools/Makefile
|
|
||||||
include $(SRC_PATH)/ffbuild/common.mak
|
|
||||||
|
|
||||||
FF_EXTRALIBS := $(FFEXTRALIBS)
|
FF_EXTRALIBS := $(FFEXTRALIBS)
|
||||||
FF_DEP_LIBS := $(DEP_LIBS)
|
FF_DEP_LIBS := $(DEP_LIBS)
|
||||||
FF_STATIC_DEP_LIBS := $(STATIC_DEP_LIBS)
|
|
||||||
|
|
||||||
$(TOOLS): %$(EXESUF): %.o
|
all: $(AVPROGS)
|
||||||
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(EXTRALIBS-$(*F)) $(EXTRALIBS) $(ELIBS)
|
|
||||||
|
|
||||||
target_dec_%_fuzzer$(EXESUF): target_dec_%_fuzzer.o $(FF_DEP_LIBS)
|
$(TOOLS): %$(EXESUF): %.o $(EXEOBJS)
|
||||||
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
|
$(LD) $(LDFLAGS) $(LD_O) $^ $(ELIBS)
|
||||||
|
|
||||||
tools/target_bsf_%_fuzzer$(EXESUF): tools/target_bsf_%_fuzzer.o $(FF_DEP_LIBS)
|
tools/cws2fws$(EXESUF): ELIBS = $(ZLIB)
|
||||||
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
|
|
||||||
|
|
||||||
target_dem_%_fuzzer$(EXESUF): target_dem_%_fuzzer.o $(FF_DEP_LIBS)
|
|
||||||
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
|
|
||||||
|
|
||||||
tools/target_dem_fuzzer$(EXESUF): tools/target_dem_fuzzer.o $(FF_DEP_LIBS)
|
|
||||||
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
|
|
||||||
|
|
||||||
tools/target_io_dem_fuzzer$(EXESUF): tools/target_io_dem_fuzzer.o $(FF_DEP_LIBS)
|
|
||||||
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH)
|
|
||||||
|
|
||||||
|
|
||||||
tools/enum_options$(EXESUF): ELIBS = $(FF_EXTRALIBS)
|
|
||||||
tools/enum_options$(EXESUF): $(FF_DEP_LIBS)
|
|
||||||
tools/sofa2wavs$(EXESUF): ELIBS = $(FF_EXTRALIBS)
|
|
||||||
tools/uncoded_frame$(EXESUF): $(FF_DEP_LIBS)
|
tools/uncoded_frame$(EXESUF): $(FF_DEP_LIBS)
|
||||||
tools/uncoded_frame$(EXESUF): ELIBS = $(FF_EXTRALIBS)
|
tools/uncoded_frame$(EXESUF): ELIBS = $(FF_EXTRALIBS)
|
||||||
tools/target_dec_%_fuzzer$(EXESUF): $(FF_DEP_LIBS)
|
|
||||||
tools/target_dem_%_fuzzer$(EXESUF): $(FF_DEP_LIBS)
|
|
||||||
|
|
||||||
CONFIGURABLE_COMPONENTS = \
|
config.h: .config
|
||||||
$(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c)) \
|
.config: $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c))
|
||||||
$(SRC_PATH)/libavcodec/bitstream_filters.c \
|
|
||||||
$(SRC_PATH)/libavcodec/parsers.c \
|
|
||||||
$(SRC_PATH)/libavformat/protocols.c \
|
|
||||||
|
|
||||||
config.h: ffbuild/.config
|
|
||||||
ffbuild/.config: $(CONFIGURABLE_COMPONENTS)
|
|
||||||
@-tput bold 2>/dev/null
|
@-tput bold 2>/dev/null
|
||||||
@-printf '\nWARNING: $(?) newer than config.h, rerun configure\n\n'
|
@-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n'
|
||||||
@-tput sgr0 2>/dev/null
|
@-tput sgr0 2>/dev/null
|
||||||
|
|
||||||
SUBDIR_VARS := CLEANFILES FFLIBS HOSTPROGS TESTPROGS TOOLS \
|
SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS \
|
||||||
HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
|
HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
|
||||||
ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \
|
ARMV5TE-OBJS ARMV6-OBJS VFP-OBJS NEON-OBJS \
|
||||||
ALTIVEC-OBJS VSX-OBJS MMX-OBJS X86ASM-OBJS \
|
ALTIVEC-OBJS VIS-OBJS \
|
||||||
MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSP-OBJS MSA-OBJS \
|
MMX-OBJS YASM-OBJS \
|
||||||
MMI-OBJS OBJS SLIBOBJS HOSTOBJS TESTOBJS
|
MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSPR1-OBJS MIPS32R2-OBJS \
|
||||||
|
OBJS SLIBOBJS HOSTOBJS TESTOBJS
|
||||||
|
|
||||||
define RESET
|
define RESET
|
||||||
$(1) :=
|
$(1) :=
|
||||||
@@ -100,33 +88,41 @@ $(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
|
|||||||
SUBDIR := $(1)/
|
SUBDIR := $(1)/
|
||||||
include $(SRC_PATH)/$(1)/Makefile
|
include $(SRC_PATH)/$(1)/Makefile
|
||||||
-include $(SRC_PATH)/$(1)/$(ARCH)/Makefile
|
-include $(SRC_PATH)/$(1)/$(ARCH)/Makefile
|
||||||
-include $(SRC_PATH)/$(1)/$(INTRINSICS)/Makefile
|
include $(SRC_PATH)/library.mak
|
||||||
include $(SRC_PATH)/ffbuild/library.mak
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
|
$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
|
||||||
|
|
||||||
include $(SRC_PATH)/fftools/Makefile
|
|
||||||
include $(SRC_PATH)/doc/Makefile
|
include $(SRC_PATH)/doc/Makefile
|
||||||
include $(SRC_PATH)/doc/examples/Makefile
|
|
||||||
|
|
||||||
libavcodec/avcodec.o libavformat/utils.o libavdevice/avdevice.o libavfilter/avfilter.o libavutil/utils.o libpostproc/postprocess.o libswresample/swresample.o libswscale/utils.o : libavutil/ffversion.h
|
define DOPROG
|
||||||
|
OBJS-$(1) += $(1).o $(EXEOBJS) $(OBJS-$(1)-yes)
|
||||||
|
$(1)$(PROGSSUF)_g$(EXESUF): $$(OBJS-$(1))
|
||||||
|
$$(OBJS-$(1)): CFLAGS += $(CFLAGS-$(1))
|
||||||
|
$(1)$(PROGSSUF)_g$(EXESUF): LDFLAGS += $(LDFLAGS-$(1))
|
||||||
|
$(1)$(PROGSSUF)_g$(EXESUF): FF_EXTRALIBS += $(LIBS-$(1))
|
||||||
|
-include $$(OBJS-$(1):.o=.d)
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(foreach P,$(PROGS),$(eval $(call DOPROG,$(P:$(PROGSSUF)$(EXESUF)=))))
|
||||||
|
|
||||||
|
ffprobe.o cmdutils.o : libavutil/ffversion.h
|
||||||
|
|
||||||
$(PROGS): %$(PROGSSUF)$(EXESUF): %$(PROGSSUF)_g$(EXESUF)
|
$(PROGS): %$(PROGSSUF)$(EXESUF): %$(PROGSSUF)_g$(EXESUF)
|
||||||
ifeq ($(STRIPTYPE),direct)
|
|
||||||
$(STRIP) -o $@ $<
|
|
||||||
else
|
|
||||||
$(CP) $< $@
|
$(CP) $< $@
|
||||||
$(STRIP) $@
|
$(STRIP) $@
|
||||||
endif
|
|
||||||
|
|
||||||
%$(PROGSSUF)_g$(EXESUF): $(FF_DEP_LIBS)
|
%$(PROGSSUF)_g$(EXESUF): %.o $(FF_DEP_LIBS)
|
||||||
$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS)
|
$(LD) $(LDFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS)
|
||||||
|
|
||||||
VERSION_SH = $(SRC_PATH)/ffbuild/version.sh
|
OBJDIRS += tools
|
||||||
|
|
||||||
|
-include $(wildcard tools/*.d)
|
||||||
|
|
||||||
|
VERSION_SH = $(SRC_PATH)/version.sh
|
||||||
GIT_LOG = $(SRC_PATH)/.git/logs/HEAD
|
GIT_LOG = $(SRC_PATH)/.git/logs/HEAD
|
||||||
|
|
||||||
.version: $(wildcard $(GIT_LOG)) $(VERSION_SH) ffbuild/config.mak
|
.version: $(wildcard $(GIT_LOG)) $(VERSION_SH) config.mak
|
||||||
.version: M=@
|
.version: M=@
|
||||||
|
|
||||||
libavutil/ffversion.h .version:
|
libavutil/ffversion.h .version:
|
||||||
@@ -136,47 +132,53 @@ libavutil/ffversion.h .version:
|
|||||||
# force version.sh to run whenever version might have changed
|
# force version.sh to run whenever version might have changed
|
||||||
-include .version
|
-include .version
|
||||||
|
|
||||||
|
ifdef AVPROGS
|
||||||
|
install: install-progs install-data
|
||||||
|
endif
|
||||||
|
|
||||||
install: install-libs install-headers
|
install: install-libs install-headers
|
||||||
|
|
||||||
install-libs: install-libs-yes
|
install-libs: install-libs-yes
|
||||||
|
|
||||||
install-data: $(DATA_FILES)
|
install-progs-yes:
|
||||||
$(Q)mkdir -p "$(DATADIR)"
|
install-progs-$(CONFIG_SHARED): install-libs
|
||||||
$(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
|
|
||||||
|
|
||||||
uninstall: uninstall-data uninstall-headers uninstall-libs uninstall-pkgconfig
|
install-progs: install-progs-yes $(AVPROGS)
|
||||||
|
$(Q)mkdir -p "$(BINDIR)"
|
||||||
|
$(INSTALL) -c -m 755 $(INSTPROGS) "$(BINDIR)"
|
||||||
|
|
||||||
|
install-data: $(DATA_FILES) $(EXAMPLES_FILES)
|
||||||
|
$(Q)mkdir -p "$(DATADIR)/examples"
|
||||||
|
$(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
|
||||||
|
$(INSTALL) -m 644 $(EXAMPLES_FILES) "$(DATADIR)/examples"
|
||||||
|
|
||||||
|
uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data
|
||||||
|
|
||||||
|
uninstall-progs:
|
||||||
|
$(RM) $(addprefix "$(BINDIR)/", $(ALLAVPROGS))
|
||||||
|
|
||||||
uninstall-data:
|
uninstall-data:
|
||||||
$(RM) -r "$(DATADIR)"
|
$(RM) -r "$(DATADIR)"
|
||||||
|
|
||||||
clean::
|
clean::
|
||||||
|
$(RM) $(ALLAVPROGS) $(ALLAVPROGS_G)
|
||||||
$(RM) $(CLEANSUFFIXES)
|
$(RM) $(CLEANSUFFIXES)
|
||||||
$(RM) $(addprefix compat/,$(CLEANSUFFIXES)) $(addprefix compat/*/,$(CLEANSUFFIXES)) $(addprefix compat/*/*/,$(CLEANSUFFIXES))
|
$(RM) $(CLEANSUFFIXES:%=tools/%)
|
||||||
$(RM) -r coverage-html
|
$(RM) -r coverage-html
|
||||||
$(RM) -rf coverage.info coverage.info.in lcov
|
$(RM) -rf coverage.info lcov
|
||||||
|
|
||||||
distclean:: clean
|
distclean::
|
||||||
$(RM) .version avversion.h config.asm config.h mapfile \
|
$(RM) $(DISTCLEANSUFFIXES)
|
||||||
ffbuild/.config ffbuild/config.* libavutil/avconfig.h \
|
$(RM) config.* .config libavutil/avconfig.h .version version.h libavutil/ffversion.h libavcodec/codec_names.h
|
||||||
version.h libavutil/ffversion.h libavcodec/codec_names.h \
|
|
||||||
libavcodec/bsf_list.c libavformat/protocol_list.c \
|
|
||||||
libavcodec/codec_list.c libavcodec/parser_list.c \
|
|
||||||
libavfilter/filter_list.c libavdevice/indev_list.c libavdevice/outdev_list.c \
|
|
||||||
libavformat/muxer_list.c libavformat/demuxer_list.c
|
|
||||||
ifeq ($(SRC_LINK),src)
|
|
||||||
$(RM) src
|
|
||||||
endif
|
|
||||||
$(RM) -rf doc/examples/pc-uninstalled
|
|
||||||
|
|
||||||
config:
|
config:
|
||||||
$(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
|
$(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
|
||||||
|
|
||||||
build: all alltools examples testprogs
|
|
||||||
check: all alltools examples testprogs fate
|
check: all alltools examples testprogs fate
|
||||||
|
|
||||||
include $(SRC_PATH)/tests/Makefile
|
include $(SRC_PATH)/tests/Makefile
|
||||||
|
|
||||||
$(sort $(OUTDIRS)):
|
$(sort $(OBJDIRS)):
|
||||||
$(Q)mkdir -p $@
|
$(Q)mkdir -p $@
|
||||||
|
|
||||||
# Dummy rule to stop make trying to rebuild removed or renamed headers
|
# Dummy rule to stop make trying to rebuild removed or renamed headers
|
||||||
@@ -187,5 +189,5 @@ $(sort $(OUTDIRS)):
|
|||||||
# so this saves some time on slow systems.
|
# so this saves some time on slow systems.
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
|
|
||||||
.PHONY: all all-yes alltools build check config testprogs
|
.PHONY: all all-yes alltools check *clean config install*
|
||||||
.PHONY: *clean install* uninstall*
|
.PHONY: testprogs uninstall*
|
||||||
|
|||||||
18
README
Normal file
18
README
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
FFmpeg README
|
||||||
|
-------------
|
||||||
|
|
||||||
|
1) Documentation
|
||||||
|
----------------
|
||||||
|
|
||||||
|
* Read the documentation in the doc/ directory in git.
|
||||||
|
You can also view it online at http://ffmpeg.org/documentation.html
|
||||||
|
|
||||||
|
2) Licensing
|
||||||
|
------------
|
||||||
|
|
||||||
|
* See the LICENSE file.
|
||||||
|
|
||||||
|
3) Build and Install
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
* See the INSTALL file.
|
||||||
46
README.md
46
README.md
@@ -1,46 +0,0 @@
|
|||||||
FFmpeg README
|
|
||||||
=============
|
|
||||||
|
|
||||||
FFmpeg is a collection of libraries and tools to process multimedia content
|
|
||||||
such as audio, video, subtitles and related metadata.
|
|
||||||
|
|
||||||
## Libraries
|
|
||||||
|
|
||||||
* `libavcodec` provides implementation of a wider range of codecs.
|
|
||||||
* `libavformat` implements streaming protocols, container formats and basic I/O access.
|
|
||||||
* `libavutil` includes hashers, decompressors and miscellaneous utility functions.
|
|
||||||
* `libavfilter` provides a mean to alter decoded Audio and Video through chain of filters.
|
|
||||||
* `libavdevice` provides an abstraction to access capture and playback devices.
|
|
||||||
* `libswresample` implements audio mixing and resampling routines.
|
|
||||||
* `libswscale` implements color conversion and scaling routines.
|
|
||||||
|
|
||||||
## Tools
|
|
||||||
|
|
||||||
* [ffmpeg](https://ffmpeg.org/ffmpeg.html) is a command line toolbox to
|
|
||||||
manipulate, convert and stream multimedia content.
|
|
||||||
* [ffplay](https://ffmpeg.org/ffplay.html) is a minimalistic multimedia player.
|
|
||||||
* [ffprobe](https://ffmpeg.org/ffprobe.html) is a simple analysis tool to inspect
|
|
||||||
multimedia content.
|
|
||||||
* Additional small tools such as `aviocat`, `ismindex` and `qt-faststart`.
|
|
||||||
|
|
||||||
## Documentation
|
|
||||||
|
|
||||||
The offline documentation is available in the **doc/** directory.
|
|
||||||
|
|
||||||
The online documentation is available in the main [website](https://ffmpeg.org)
|
|
||||||
and in the [wiki](https://trac.ffmpeg.org).
|
|
||||||
|
|
||||||
### Examples
|
|
||||||
|
|
||||||
Coding examples are available in the **doc/examples** directory.
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
FFmpeg codebase is mainly LGPL-licensed with optional components licensed under
|
|
||||||
GPL. Please refer to the LICENSE file for detailed information.
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
Patches should be submitted to the ffmpeg-devel mailing list using
|
|
||||||
`git format-patch` or `git send-email`. Github pull requests should be
|
|
||||||
avoided because they are not part of our review process and will be ignored.
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
|
|
||||||
┌────────────────────────────────────┐
|
|
||||||
│ RELEASE NOTES for FFmpeg 4.4 "Rao" │
|
|
||||||
└────────────────────────────────────┘
|
|
||||||
|
|
||||||
The FFmpeg Project proudly presents FFmpeg 4.4 "Rao", about 10
|
|
||||||
months after the release of FFmpeg 4.3.
|
|
||||||
|
|
||||||
A complete Changelog is available at the root of the project, and the
|
|
||||||
complete Git history on https://git.ffmpeg.org/gitweb/ffmpeg.git
|
|
||||||
|
|
||||||
We hope you will like this release as much as we enjoyed working on it, and
|
|
||||||
as usual, if you have any questions about it, or any FFmpeg related topic,
|
|
||||||
feel free to join us on the #ffmpeg IRC channel (on irc.libera.chat) or ask
|
|
||||||
on the mailing-lists.
|
|
||||||
16
arch.mak
Normal file
16
arch.mak
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
OBJS-$(HAVE_ARMV5TE) += $(ARMV5TE-OBJS) $(ARMV5TE-OBJS-yes)
|
||||||
|
OBJS-$(HAVE_ARMV6) += $(ARMV6-OBJS) $(ARMV6-OBJS-yes)
|
||||||
|
OBJS-$(HAVE_VFP) += $(VFP-OBJS) $(VFP-OBJS-yes)
|
||||||
|
OBJS-$(HAVE_NEON) += $(NEON-OBJS) $(NEON-OBJS-yes)
|
||||||
|
|
||||||
|
OBJS-$(HAVE_MIPSFPU) += $(MIPSFPU-OBJS) $(MIPSFPU-OBJS-yes)
|
||||||
|
OBJS-$(HAVE_MIPS32R2) += $(MIPS32R2-OBJS) $(MIPS32R2-OBJS-yes)
|
||||||
|
OBJS-$(HAVE_MIPSDSPR1) += $(MIPSDSPR1-OBJS) $(MIPSDSPR1-OBJS-yes)
|
||||||
|
OBJS-$(HAVE_MIPSDSPR2) += $(MIPSDSPR2-OBJS) $(MIPSDSPR2-OBJS-yes)
|
||||||
|
|
||||||
|
OBJS-$(HAVE_ALTIVEC) += $(ALTIVEC-OBJS) $(ALTIVEC-OBJS-yes)
|
||||||
|
|
||||||
|
OBJS-$(HAVE_VIS) += $(VIS-OBJS) $(VIS-OBJS-yes)
|
||||||
|
|
||||||
|
OBJS-$(HAVE_MMX) += $(MMX-OBJS) $(MMX-OBJS-yes)
|
||||||
|
OBJS-$(HAVE_YASM) += $(YASM-OBJS) $(YASM-OBJS-yes)
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -19,18 +19,17 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef FFTOOLS_CMDUTILS_H
|
#ifndef FFMPEG_CMDUTILS_H
|
||||||
#define FFTOOLS_CMDUTILS_H
|
#define FFMPEG_CMDUTILS_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "libavcodec/avcodec.h"
|
#include "libavcodec/avcodec.h"
|
||||||
#include "libavfilter/avfilter.h"
|
#include "libavfilter/avfilter.h"
|
||||||
#include "libavformat/avformat.h"
|
#include "libavformat/avformat.h"
|
||||||
#include "libswscale/swscale.h"
|
#include "libswscale/swscale.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef __MINGW32__
|
||||||
#undef main /* We don't want SDL to override our main() */
|
#undef main /* We don't want SDL to override our main() */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -46,7 +45,7 @@ extern const int program_birth_year;
|
|||||||
|
|
||||||
extern AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB];
|
extern AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB];
|
||||||
extern AVFormatContext *avformat_opts;
|
extern AVFormatContext *avformat_opts;
|
||||||
extern AVDictionary *sws_dict;
|
extern struct SwsContext *sws_opts;
|
||||||
extern AVDictionary *swr_opts;
|
extern AVDictionary *swr_opts;
|
||||||
extern AVDictionary *format_opts, *codec_opts, *resample_opts;
|
extern AVDictionary *format_opts, *codec_opts, *resample_opts;
|
||||||
extern int hide_banner;
|
extern int hide_banner;
|
||||||
@@ -59,12 +58,7 @@ void register_exit(void (*cb)(int ret));
|
|||||||
/**
|
/**
|
||||||
* Wraps exit with a program-specific cleanup routine.
|
* Wraps exit with a program-specific cleanup routine.
|
||||||
*/
|
*/
|
||||||
void exit_program(int ret) av_noreturn;
|
void exit_program(int ret);
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize dynamic library loading
|
|
||||||
*/
|
|
||||||
void init_dynload(void);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the cmdutils option system, in particular
|
* Initialize the cmdutils option system, in particular
|
||||||
@@ -99,12 +93,18 @@ int opt_default(void *optctx, const char *opt, const char *arg);
|
|||||||
*/
|
*/
|
||||||
int opt_loglevel(void *optctx, const char *opt, const char *arg);
|
int opt_loglevel(void *optctx, const char *opt, const char *arg);
|
||||||
|
|
||||||
int opt_report(void *optctx, const char *opt, const char *arg);
|
int opt_report(const char *opt);
|
||||||
|
|
||||||
int opt_max_alloc(void *optctx, const char *opt, const char *arg);
|
int opt_max_alloc(void *optctx, const char *opt, const char *arg);
|
||||||
|
|
||||||
int opt_codec_debug(void *optctx, const char *opt, const char *arg);
|
int opt_codec_debug(void *optctx, const char *opt, const char *arg);
|
||||||
|
|
||||||
|
#if CONFIG_OPENCL
|
||||||
|
int opt_opencl(void *optctx, const char *opt, const char *arg);
|
||||||
|
|
||||||
|
int opt_opencl_bench(void *optctx, const char *opt, const char *arg);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Limit the execution time.
|
* Limit the execution time.
|
||||||
*/
|
*/
|
||||||
@@ -149,7 +149,6 @@ typedef struct SpecifierOpt {
|
|||||||
uint8_t *str;
|
uint8_t *str;
|
||||||
int i;
|
int i;
|
||||||
int64_t i64;
|
int64_t i64;
|
||||||
uint64_t ui64;
|
|
||||||
float f;
|
float f;
|
||||||
double dbl;
|
double dbl;
|
||||||
} u;
|
} u;
|
||||||
@@ -201,47 +200,6 @@ typedef struct OptionDef {
|
|||||||
void show_help_options(const OptionDef *options, const char *msg, int req_flags,
|
void show_help_options(const OptionDef *options, const char *msg, int req_flags,
|
||||||
int rej_flags, int alt_flags);
|
int rej_flags, int alt_flags);
|
||||||
|
|
||||||
#if CONFIG_AVDEVICE
|
|
||||||
#define CMDUTILS_COMMON_OPTIONS_AVDEVICE \
|
|
||||||
{ "sources" , OPT_EXIT | HAS_ARG, { .func_arg = show_sources }, \
|
|
||||||
"list sources of the input device", "device" }, \
|
|
||||||
{ "sinks" , OPT_EXIT | HAS_ARG, { .func_arg = show_sinks }, \
|
|
||||||
"list sinks of the output device", "device" }, \
|
|
||||||
|
|
||||||
#else
|
|
||||||
#define CMDUTILS_COMMON_OPTIONS_AVDEVICE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define CMDUTILS_COMMON_OPTIONS \
|
|
||||||
{ "L", OPT_EXIT, { .func_arg = show_license }, "show license" }, \
|
|
||||||
{ "h", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
|
|
||||||
{ "?", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
|
|
||||||
{ "help", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
|
|
||||||
{ "-help", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
|
|
||||||
{ "version", OPT_EXIT, { .func_arg = show_version }, "show version" }, \
|
|
||||||
{ "buildconf", OPT_EXIT, { .func_arg = show_buildconf }, "show build configuration" }, \
|
|
||||||
{ "formats", OPT_EXIT, { .func_arg = show_formats }, "show available formats" }, \
|
|
||||||
{ "muxers", OPT_EXIT, { .func_arg = show_muxers }, "show available muxers" }, \
|
|
||||||
{ "demuxers", OPT_EXIT, { .func_arg = show_demuxers }, "show available demuxers" }, \
|
|
||||||
{ "devices", OPT_EXIT, { .func_arg = show_devices }, "show available devices" }, \
|
|
||||||
{ "codecs", OPT_EXIT, { .func_arg = show_codecs }, "show available codecs" }, \
|
|
||||||
{ "decoders", OPT_EXIT, { .func_arg = show_decoders }, "show available decoders" }, \
|
|
||||||
{ "encoders", OPT_EXIT, { .func_arg = show_encoders }, "show available encoders" }, \
|
|
||||||
{ "bsfs", OPT_EXIT, { .func_arg = show_bsfs }, "show available bit stream filters" }, \
|
|
||||||
{ "protocols", OPT_EXIT, { .func_arg = show_protocols }, "show available protocols" }, \
|
|
||||||
{ "filters", OPT_EXIT, { .func_arg = show_filters }, "show available filters" }, \
|
|
||||||
{ "pix_fmts", OPT_EXIT, { .func_arg = show_pix_fmts }, "show available pixel formats" }, \
|
|
||||||
{ "layouts", OPT_EXIT, { .func_arg = show_layouts }, "show standard channel layouts" }, \
|
|
||||||
{ "sample_fmts", OPT_EXIT, { .func_arg = show_sample_fmts }, "show available audio sample formats" }, \
|
|
||||||
{ "colors", OPT_EXIT, { .func_arg = show_colors }, "show available color names" }, \
|
|
||||||
{ "loglevel", HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
|
|
||||||
{ "v", HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
|
|
||||||
{ "report", 0, { .func_arg = opt_report }, "generate a report" }, \
|
|
||||||
{ "max_alloc", HAS_ARG, { .func_arg = opt_max_alloc }, "set maximum size of a single allocated block", "bytes" }, \
|
|
||||||
{ "cpuflags", HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" }, \
|
|
||||||
{ "hide_banner", OPT_BOOL | OPT_EXPERT, {&hide_banner}, "do not show program banner", "hide_banner" }, \
|
|
||||||
CMDUTILS_COMMON_OPTIONS_AVDEVICE \
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show help for all options with given flags in class and all its
|
* Show help for all options with given flags in class and all its
|
||||||
* children.
|
* children.
|
||||||
@@ -318,7 +276,7 @@ typedef struct OptionGroup {
|
|||||||
AVDictionary *codec_opts;
|
AVDictionary *codec_opts;
|
||||||
AVDictionary *format_opts;
|
AVDictionary *format_opts;
|
||||||
AVDictionary *resample_opts;
|
AVDictionary *resample_opts;
|
||||||
AVDictionary *sws_dict;
|
struct SwsContext *sws_opts;
|
||||||
AVDictionary *swr_opts;
|
AVDictionary *swr_opts;
|
||||||
} OptionGroup;
|
} OptionGroup;
|
||||||
|
|
||||||
@@ -414,7 +372,7 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec);
|
|||||||
* @return a pointer to the created dictionary
|
* @return a pointer to the created dictionary
|
||||||
*/
|
*/
|
||||||
AVDictionary *filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id,
|
AVDictionary *filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id,
|
||||||
AVFormatContext *s, AVStream *st, const AVCodec *codec);
|
AVFormatContext *s, AVStream *st, AVCodec *codec);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup AVCodecContext options for avformat_find_stream_info().
|
* Setup AVCodecContext options for avformat_find_stream_info().
|
||||||
@@ -472,45 +430,10 @@ int show_license(void *optctx, const char *opt, const char *arg);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Print a listing containing all the formats supported by the
|
* Print a listing containing all the formats supported by the
|
||||||
* program (including devices).
|
|
||||||
* This option processing function does not utilize the arguments.
|
|
||||||
*/
|
|
||||||
int show_formats(void *optctx, const char *opt, const char *arg);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Print a listing containing all the muxers supported by the
|
|
||||||
* program (including devices).
|
|
||||||
* This option processing function does not utilize the arguments.
|
|
||||||
*/
|
|
||||||
int show_muxers(void *optctx, const char *opt, const char *arg);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Print a listing containing all the demuxer supported by the
|
|
||||||
* program (including devices).
|
|
||||||
* This option processing function does not utilize the arguments.
|
|
||||||
*/
|
|
||||||
int show_demuxers(void *optctx, const char *opt, const char *arg);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Print a listing containing all the devices supported by the
|
|
||||||
* program.
|
* program.
|
||||||
* This option processing function does not utilize the arguments.
|
* This option processing function does not utilize the arguments.
|
||||||
*/
|
*/
|
||||||
int show_devices(void *optctx, const char *opt, const char *arg);
|
int show_formats(void *optctx, const char *opt, const char *arg);
|
||||||
|
|
||||||
#if CONFIG_AVDEVICE
|
|
||||||
/**
|
|
||||||
* Print a listing containing autodetected sinks of the output device.
|
|
||||||
* Device name with options may be passed as an argument to limit results.
|
|
||||||
*/
|
|
||||||
int show_sinks(void *optctx, const char *opt, const char *arg);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Print a listing containing autodetected sources of the input device.
|
|
||||||
* Device name with options may be passed as an argument to limit results.
|
|
||||||
*/
|
|
||||||
int show_sources(void *optctx, const char *opt, const char *arg);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print a listing containing all the codecs supported by the
|
* Print a listing containing all the codecs supported by the
|
||||||
@@ -584,6 +507,18 @@ int show_colors(void *optctx, const char *opt, const char *arg);
|
|||||||
*/
|
*/
|
||||||
int read_yesno(void);
|
int read_yesno(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the file with name filename, and put its content in a newly
|
||||||
|
* allocated 0-terminated buffer.
|
||||||
|
*
|
||||||
|
* @param filename file to read from
|
||||||
|
* @param bufptr location where pointer to buffer is returned
|
||||||
|
* @param size location where size of buffer is returned
|
||||||
|
* @return >= 0 in case of success, a negative value corresponding to an
|
||||||
|
* AVERROR error code in case of failure.
|
||||||
|
*/
|
||||||
|
int cmdutils_read_file(const char *filename, char **bufptr, size_t *size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a file corresponding to a preset file.
|
* Get a file corresponding to a preset file.
|
||||||
*
|
*
|
||||||
@@ -625,9 +560,6 @@ void *grow_array(void *array, int elem_size, int *size, int new_size);
|
|||||||
#define GET_PIX_FMT_NAME(pix_fmt)\
|
#define GET_PIX_FMT_NAME(pix_fmt)\
|
||||||
const char *name = av_get_pix_fmt_name(pix_fmt);
|
const char *name = av_get_pix_fmt_name(pix_fmt);
|
||||||
|
|
||||||
#define GET_CODEC_NAME(id)\
|
|
||||||
const char *name = avcodec_descriptor_get(id)->name;
|
|
||||||
|
|
||||||
#define GET_SAMPLE_FMT_NAME(sample_fmt)\
|
#define GET_SAMPLE_FMT_NAME(sample_fmt)\
|
||||||
const char *name = av_get_sample_fmt_name(sample_fmt)
|
const char *name = av_get_sample_fmt_name(sample_fmt)
|
||||||
|
|
||||||
@@ -643,6 +575,4 @@ void *grow_array(void *array, int elem_size, int *size, int new_size);
|
|||||||
char name[128];\
|
char name[128];\
|
||||||
av_get_channel_layout_string(name, sizeof(name), 0, ch_layout);
|
av_get_channel_layout_string(name, sizeof(name), 0, ch_layout);
|
||||||
|
|
||||||
double get_rotation(AVStream *st);
|
#endif /* CMDUTILS_H */
|
||||||
|
|
||||||
#endif /* FFTOOLS_CMDUTILS_H */
|
|
||||||
28
cmdutils_common_opts.h
Normal file
28
cmdutils_common_opts.h
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{ "L" , OPT_EXIT, {.func_arg = show_license}, "show license" },
|
||||||
|
{ "h" , OPT_EXIT, {.func_arg = show_help}, "show help", "topic" },
|
||||||
|
{ "?" , OPT_EXIT, {.func_arg = show_help}, "show help", "topic" },
|
||||||
|
{ "help" , OPT_EXIT, {.func_arg = show_help}, "show help", "topic" },
|
||||||
|
{ "-help" , OPT_EXIT, {.func_arg = show_help}, "show help", "topic" },
|
||||||
|
{ "version" , OPT_EXIT, {.func_arg = show_version}, "show version" },
|
||||||
|
{ "buildconf" , OPT_EXIT, {.func_arg = show_buildconf}, "show build configuration" },
|
||||||
|
{ "formats" , OPT_EXIT, {.func_arg = show_formats }, "show available formats" },
|
||||||
|
{ "codecs" , OPT_EXIT, {.func_arg = show_codecs }, "show available codecs" },
|
||||||
|
{ "decoders" , OPT_EXIT, {.func_arg = show_decoders }, "show available decoders" },
|
||||||
|
{ "encoders" , OPT_EXIT, {.func_arg = show_encoders }, "show available encoders" },
|
||||||
|
{ "bsfs" , OPT_EXIT, {.func_arg = show_bsfs }, "show available bit stream filters" },
|
||||||
|
{ "protocols" , OPT_EXIT, {.func_arg = show_protocols}, "show available protocols" },
|
||||||
|
{ "filters" , OPT_EXIT, {.func_arg = show_filters }, "show available filters" },
|
||||||
|
{ "pix_fmts" , OPT_EXIT, {.func_arg = show_pix_fmts }, "show available pixel formats" },
|
||||||
|
{ "layouts" , OPT_EXIT, {.func_arg = show_layouts }, "show standard channel layouts" },
|
||||||
|
{ "sample_fmts", OPT_EXIT, {.func_arg = show_sample_fmts }, "show available audio sample formats" },
|
||||||
|
{ "colors" , OPT_EXIT, {.func_arg = show_colors }, "show available color names" },
|
||||||
|
{ "loglevel" , HAS_ARG, {.func_arg = opt_loglevel}, "set logging level", "loglevel" },
|
||||||
|
{ "v", HAS_ARG, {.func_arg = opt_loglevel}, "set logging level", "loglevel" },
|
||||||
|
{ "report" , 0, {(void*)opt_report}, "generate a report" },
|
||||||
|
{ "max_alloc" , HAS_ARG, {.func_arg = opt_max_alloc}, "set maximum size of a single allocated block", "bytes" },
|
||||||
|
{ "cpuflags" , HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" },
|
||||||
|
{ "hide_banner", OPT_BOOL | OPT_EXPERT, {&hide_banner}, "do not show program banner", "hide_banner" },
|
||||||
|
#if CONFIG_OPENCL
|
||||||
|
{ "opencl_bench", OPT_EXIT, {.func_arg = opt_opencl_bench}, "run benchmark on all OpenCL devices and show results" },
|
||||||
|
{ "opencl_options", HAS_ARG, {.func_arg = opt_opencl}, "set OpenCL environment options" },
|
||||||
|
#endif
|
||||||
274
cmdutils_opencl.c
Normal file
274
cmdutils_opencl.c
Normal file
@@ -0,0 +1,274 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2013 Lenny Wang
|
||||||
|
*
|
||||||
|
* This file is part of FFmpeg.
|
||||||
|
*
|
||||||
|
* FFmpeg is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* FFmpeg is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with FFmpeg; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "libavutil/opt.h"
|
||||||
|
#include "libavutil/time.h"
|
||||||
|
#include "libavutil/log.h"
|
||||||
|
#include "libavutil/opencl.h"
|
||||||
|
#include "cmdutils.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int platform_idx;
|
||||||
|
int device_idx;
|
||||||
|
char device_name[64];
|
||||||
|
int64_t runtime;
|
||||||
|
} OpenCLDeviceBenchmark;
|
||||||
|
|
||||||
|
const char *ocl_bench_source = AV_OPENCL_KERNEL(
|
||||||
|
inline unsigned char clip_uint8(int a)
|
||||||
|
{
|
||||||
|
if (a & (~0xFF))
|
||||||
|
return (-a)>>31;
|
||||||
|
else
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
kernel void unsharp_bench(
|
||||||
|
global unsigned char *src,
|
||||||
|
global unsigned char *dst,
|
||||||
|
global int *mask,
|
||||||
|
int width,
|
||||||
|
int height)
|
||||||
|
{
|
||||||
|
int i, j, local_idx, lc_idx, sum = 0;
|
||||||
|
int2 thread_idx, block_idx, global_idx, lm_idx;
|
||||||
|
thread_idx.x = get_local_id(0);
|
||||||
|
thread_idx.y = get_local_id(1);
|
||||||
|
block_idx.x = get_group_id(0);
|
||||||
|
block_idx.y = get_group_id(1);
|
||||||
|
global_idx.x = get_global_id(0);
|
||||||
|
global_idx.y = get_global_id(1);
|
||||||
|
local uchar data[32][32];
|
||||||
|
local int lc[128];
|
||||||
|
|
||||||
|
for (i = 0; i <= 1; i++) {
|
||||||
|
lm_idx.y = -8 + (block_idx.y + i) * 16 + thread_idx.y;
|
||||||
|
lm_idx.y = lm_idx.y < 0 ? 0 : lm_idx.y;
|
||||||
|
lm_idx.y = lm_idx.y >= height ? height - 1: lm_idx.y;
|
||||||
|
for (j = 0; j <= 1; j++) {
|
||||||
|
lm_idx.x = -8 + (block_idx.x + j) * 16 + thread_idx.x;
|
||||||
|
lm_idx.x = lm_idx.x < 0 ? 0 : lm_idx.x;
|
||||||
|
lm_idx.x = lm_idx.x >= width ? width - 1: lm_idx.x;
|
||||||
|
data[i*16 + thread_idx.y][j*16 + thread_idx.x] = src[lm_idx.y*width + lm_idx.x];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
local_idx = thread_idx.y*16 + thread_idx.x;
|
||||||
|
if (local_idx < 128)
|
||||||
|
lc[local_idx] = mask[local_idx];
|
||||||
|
barrier(CLK_LOCAL_MEM_FENCE);
|
||||||
|
|
||||||
|
\n#pragma unroll\n
|
||||||
|
for (i = -4; i <= 4; i++) {
|
||||||
|
lm_idx.y = 8 + i + thread_idx.y;
|
||||||
|
\n#pragma unroll\n
|
||||||
|
for (j = -4; j <= 4; j++) {
|
||||||
|
lm_idx.x = 8 + j + thread_idx.x;
|
||||||
|
lc_idx = (i + 4)*8 + j + 4;
|
||||||
|
sum += (int)data[lm_idx.y][lm_idx.x] * lc[lc_idx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int temp = (int)data[thread_idx.y + 8][thread_idx.x + 8];
|
||||||
|
int res = temp + (((temp - (int)((sum + 1<<15) >> 16))) >> 16);
|
||||||
|
if (global_idx.x < width && global_idx.y < height)
|
||||||
|
dst[global_idx.x + global_idx.y*width] = clip_uint8(res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
#define OCLCHECK(method, ... ) \
|
||||||
|
do { \
|
||||||
|
status = method(__VA_ARGS__); \
|
||||||
|
if (status != CL_SUCCESS) { \
|
||||||
|
av_log(NULL, AV_LOG_ERROR, # method " error '%s'\n", \
|
||||||
|
av_opencl_errstr(status)); \
|
||||||
|
ret = AVERROR_EXTERNAL; \
|
||||||
|
goto end; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define CREATEBUF(out, flags, size) \
|
||||||
|
do { \
|
||||||
|
out = clCreateBuffer(ext_opencl_env->context, flags, size, NULL, &status); \
|
||||||
|
if (status != CL_SUCCESS) { \
|
||||||
|
av_log(NULL, AV_LOG_ERROR, "Could not create OpenCL buffer\n"); \
|
||||||
|
ret = AVERROR_EXTERNAL; \
|
||||||
|
goto end; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
static void fill_rand_int(int *data, int n)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
srand(av_gettime());
|
||||||
|
for (i = 0; i < n; i++)
|
||||||
|
data[i] = rand();
|
||||||
|
}
|
||||||
|
|
||||||
|
#define OPENCL_NB_ITER 5
|
||||||
|
static int64_t run_opencl_bench(AVOpenCLExternalEnv *ext_opencl_env)
|
||||||
|
{
|
||||||
|
int i, arg = 0, width = 1920, height = 1088;
|
||||||
|
int64_t start, ret = 0;
|
||||||
|
cl_int status;
|
||||||
|
size_t kernel_len;
|
||||||
|
char *inbuf;
|
||||||
|
int *mask;
|
||||||
|
int buf_size = width * height * sizeof(char);
|
||||||
|
int mask_size = sizeof(uint32_t) * 128;
|
||||||
|
|
||||||
|
cl_mem cl_mask, cl_inbuf, cl_outbuf;
|
||||||
|
cl_kernel kernel = NULL;
|
||||||
|
cl_program program = NULL;
|
||||||
|
size_t local_work_size_2d[2] = {16, 16};
|
||||||
|
size_t global_work_size_2d[2] = {(size_t)width, (size_t)height};
|
||||||
|
|
||||||
|
if (!(inbuf = av_malloc(buf_size)) || !(mask = av_malloc(mask_size))) {
|
||||||
|
av_log(NULL, AV_LOG_ERROR, "Out of memory\n");
|
||||||
|
ret = AVERROR(ENOMEM);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
fill_rand_int((int*)inbuf, buf_size/4);
|
||||||
|
fill_rand_int(mask, mask_size/4);
|
||||||
|
|
||||||
|
CREATEBUF(cl_mask, CL_MEM_READ_ONLY, mask_size);
|
||||||
|
CREATEBUF(cl_inbuf, CL_MEM_READ_ONLY, buf_size);
|
||||||
|
CREATEBUF(cl_outbuf, CL_MEM_READ_WRITE, buf_size);
|
||||||
|
|
||||||
|
kernel_len = strlen(ocl_bench_source);
|
||||||
|
program = clCreateProgramWithSource(ext_opencl_env->context, 1, &ocl_bench_source,
|
||||||
|
&kernel_len, &status);
|
||||||
|
if (status != CL_SUCCESS || !program) {
|
||||||
|
av_log(NULL, AV_LOG_ERROR, "OpenCL unable to create benchmark program\n");
|
||||||
|
ret = AVERROR_EXTERNAL;
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
status = clBuildProgram(program, 1, &(ext_opencl_env->device_id), NULL, NULL, NULL);
|
||||||
|
if (status != CL_SUCCESS) {
|
||||||
|
av_log(NULL, AV_LOG_ERROR, "OpenCL unable to build benchmark program\n");
|
||||||
|
ret = AVERROR_EXTERNAL;
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
kernel = clCreateKernel(program, "unsharp_bench", &status);
|
||||||
|
if (status != CL_SUCCESS) {
|
||||||
|
av_log(NULL, AV_LOG_ERROR, "OpenCL unable to create benchmark kernel\n");
|
||||||
|
ret = AVERROR_EXTERNAL;
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
OCLCHECK(clEnqueueWriteBuffer, ext_opencl_env->command_queue, cl_inbuf, CL_TRUE, 0,
|
||||||
|
buf_size, inbuf, 0, NULL, NULL);
|
||||||
|
OCLCHECK(clEnqueueWriteBuffer, ext_opencl_env->command_queue, cl_mask, CL_TRUE, 0,
|
||||||
|
mask_size, mask, 0, NULL, NULL);
|
||||||
|
OCLCHECK(clSetKernelArg, kernel, arg++, sizeof(cl_mem), &cl_inbuf);
|
||||||
|
OCLCHECK(clSetKernelArg, kernel, arg++, sizeof(cl_mem), &cl_outbuf);
|
||||||
|
OCLCHECK(clSetKernelArg, kernel, arg++, sizeof(cl_mem), &cl_mask);
|
||||||
|
OCLCHECK(clSetKernelArg, kernel, arg++, sizeof(cl_int), &width);
|
||||||
|
OCLCHECK(clSetKernelArg, kernel, arg++, sizeof(cl_int), &height);
|
||||||
|
|
||||||
|
start = av_gettime();
|
||||||
|
for (i = 0; i < OPENCL_NB_ITER; i++)
|
||||||
|
OCLCHECK(clEnqueueNDRangeKernel, ext_opencl_env->command_queue, kernel, 2, NULL,
|
||||||
|
global_work_size_2d, local_work_size_2d, 0, NULL, NULL);
|
||||||
|
clFinish(ext_opencl_env->command_queue);
|
||||||
|
ret = (av_gettime() - start)/OPENCL_NB_ITER;
|
||||||
|
end:
|
||||||
|
if (kernel)
|
||||||
|
clReleaseKernel(kernel);
|
||||||
|
if (program)
|
||||||
|
clReleaseProgram(program);
|
||||||
|
if (cl_inbuf)
|
||||||
|
clReleaseMemObject(cl_inbuf);
|
||||||
|
if (cl_outbuf)
|
||||||
|
clReleaseMemObject(cl_outbuf);
|
||||||
|
if (cl_mask)
|
||||||
|
clReleaseMemObject(cl_mask);
|
||||||
|
av_free(inbuf);
|
||||||
|
av_free(mask);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int compare_ocl_device_desc(const void *a, const void *b)
|
||||||
|
{
|
||||||
|
return ((OpenCLDeviceBenchmark*)a)->runtime - ((OpenCLDeviceBenchmark*)b)->runtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
int opt_opencl_bench(void *optctx, const char *opt, const char *arg)
|
||||||
|
{
|
||||||
|
int i, j, nb_devices = 0, count = 0;
|
||||||
|
int64_t score = 0;
|
||||||
|
AVOpenCLDeviceList *device_list;
|
||||||
|
AVOpenCLDeviceNode *device_node = NULL;
|
||||||
|
OpenCLDeviceBenchmark *devices = NULL;
|
||||||
|
cl_platform_id platform;
|
||||||
|
|
||||||
|
av_opencl_get_device_list(&device_list);
|
||||||
|
for (i = 0; i < device_list->platform_num; i++)
|
||||||
|
nb_devices += device_list->platform_node[i]->device_num;
|
||||||
|
if (!nb_devices) {
|
||||||
|
av_log(NULL, AV_LOG_ERROR, "No OpenCL device detected!\n");
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
}
|
||||||
|
if (!(devices = av_malloc_array(nb_devices, sizeof(OpenCLDeviceBenchmark)))) {
|
||||||
|
av_log(NULL, AV_LOG_ERROR, "Could not allocate buffer\n");
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < device_list->platform_num; i++) {
|
||||||
|
for (j = 0; j < device_list->platform_node[i]->device_num; j++) {
|
||||||
|
device_node = device_list->platform_node[i]->device_node[j];
|
||||||
|
platform = device_list->platform_node[i]->platform_id;
|
||||||
|
score = av_opencl_benchmark(device_node, platform, run_opencl_bench);
|
||||||
|
if (score > 0) {
|
||||||
|
devices[count].platform_idx = i;
|
||||||
|
devices[count].device_idx = j;
|
||||||
|
devices[count].runtime = score;
|
||||||
|
strcpy(devices[count].device_name, device_node->device_name);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
qsort(devices, count, sizeof(OpenCLDeviceBenchmark), compare_ocl_device_desc);
|
||||||
|
fprintf(stderr, "platform_idx\tdevice_idx\tdevice_name\truntime\n");
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
fprintf(stdout, "%d\t%d\t%s\t%"PRId64"\n",
|
||||||
|
devices[i].platform_idx, devices[i].device_idx,
|
||||||
|
devices[i].device_name, devices[i].runtime);
|
||||||
|
|
||||||
|
av_opencl_free_device_list(&device_list);
|
||||||
|
av_free(devices);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int opt_opencl(void *optctx, const char *opt, const char *arg)
|
||||||
|
{
|
||||||
|
char *key, *value;
|
||||||
|
const char *opts = arg;
|
||||||
|
int ret = 0;
|
||||||
|
while (*opts) {
|
||||||
|
ret = av_opt_get_key_value(&opts, "=", ":", 0, &key, &value);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
ret = av_opencl_set_option(key, value);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
if (*opts)
|
||||||
|
opts++;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
151
common.mak
Normal file
151
common.mak
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
#
|
||||||
|
# common bits used by all libraries
|
||||||
|
#
|
||||||
|
|
||||||
|
# first so "all" becomes default target
|
||||||
|
all: all-yes
|
||||||
|
|
||||||
|
ifndef SUBDIR
|
||||||
|
|
||||||
|
ifndef V
|
||||||
|
Q = @
|
||||||
|
ECHO = printf "$(1)\t%s\n" $(2)
|
||||||
|
BRIEF = CC CXX HOSTCC HOSTLD AS YASM AR LD STRIP CP WINDRES
|
||||||
|
SILENT = DEPCC DEPHOSTCC DEPAS DEPYASM RANLIB RM
|
||||||
|
|
||||||
|
MSG = $@
|
||||||
|
M = @$(call ECHO,$(TAG),$@);
|
||||||
|
$(foreach VAR,$(BRIEF), \
|
||||||
|
$(eval override $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR))))
|
||||||
|
$(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR))))
|
||||||
|
$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_DIR)/%=%)); $(INSTALL))
|
||||||
|
endif
|
||||||
|
|
||||||
|
ALLFFLIBS = avcodec avdevice avfilter avformat avresample avutil postproc swscale swresample
|
||||||
|
|
||||||
|
# NASM requires -I path terminated with /
|
||||||
|
IFLAGS := -I. -I$(SRC_PATH)/
|
||||||
|
CPPFLAGS := $(IFLAGS) $(CPPFLAGS)
|
||||||
|
CFLAGS += $(ECFLAGS)
|
||||||
|
CCFLAGS = $(CPPFLAGS) $(CFLAGS)
|
||||||
|
ASFLAGS := $(CPPFLAGS) $(ASFLAGS)
|
||||||
|
CXXFLAGS += $(CPPFLAGS) $(CFLAGS)
|
||||||
|
YASMFLAGS += $(IFLAGS:%=%/) -Pconfig.asm
|
||||||
|
|
||||||
|
HOSTCCFLAGS = $(IFLAGS) $(HOSTCPPFLAGS) $(HOSTCFLAGS)
|
||||||
|
LDFLAGS := $(ALLFFLIBS:%=$(LD_PATH)lib%) $(LDFLAGS)
|
||||||
|
|
||||||
|
define COMPILE
|
||||||
|
$(call $(1)DEP,$(1))
|
||||||
|
$($(1)) $($(1)FLAGS) $($(1)_DEPFLAGS) $($(1)_C) $($(1)_O) $<
|
||||||
|
endef
|
||||||
|
|
||||||
|
COMPILE_C = $(call COMPILE,CC)
|
||||||
|
COMPILE_CXX = $(call COMPILE,CXX)
|
||||||
|
COMPILE_S = $(call COMPILE,AS)
|
||||||
|
COMPILE_HOSTC = $(call COMPILE,HOSTCC)
|
||||||
|
|
||||||
|
%.o: %.c
|
||||||
|
$(COMPILE_C)
|
||||||
|
|
||||||
|
%.o: %.cpp
|
||||||
|
$(COMPILE_CXX)
|
||||||
|
|
||||||
|
%.s: %.c
|
||||||
|
$(CC) $(CPPFLAGS) $(CFLAGS) -S -o $@ $<
|
||||||
|
|
||||||
|
%.o: %.S
|
||||||
|
$(COMPILE_S)
|
||||||
|
|
||||||
|
%_host.o: %.c
|
||||||
|
$(COMPILE_HOSTC)
|
||||||
|
|
||||||
|
%.o: %.rc
|
||||||
|
$(WINDRES) $(IFLAGS) --preprocessor "$(DEPWINDRES) -E -xc-header -DRC_INVOKED $(CC_DEPFLAGS)" -o $@ $<
|
||||||
|
|
||||||
|
%.i: %.c
|
||||||
|
$(CC) $(CCFLAGS) $(CC_E) $<
|
||||||
|
|
||||||
|
%.h.c:
|
||||||
|
$(Q)echo '#include "$*.h"' >$@
|
||||||
|
|
||||||
|
%.ver: %.v
|
||||||
|
$(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
|
||||||
|
|
||||||
|
%.c %.h: TAG = GEN
|
||||||
|
|
||||||
|
# Dummy rule to stop make trying to rebuild removed or renamed headers
|
||||||
|
%.h:
|
||||||
|
@:
|
||||||
|
|
||||||
|
# Disable suffix rules. Most of the builtin rules are suffix rules,
|
||||||
|
# so this saves some time on slow systems.
|
||||||
|
.SUFFIXES:
|
||||||
|
|
||||||
|
# Do not delete intermediate files from chains of implicit rules
|
||||||
|
$(OBJS):
|
||||||
|
endif
|
||||||
|
|
||||||
|
include $(SRC_PATH)/arch.mak
|
||||||
|
|
||||||
|
OBJS += $(OBJS-yes)
|
||||||
|
SLIBOBJS += $(SLIBOBJS-yes)
|
||||||
|
FFLIBS := $(FFLIBS-yes) $(FFLIBS)
|
||||||
|
TESTPROGS += $(TESTPROGS-yes)
|
||||||
|
|
||||||
|
LDLIBS = $(FFLIBS:%=%$(BUILDSUF))
|
||||||
|
FFEXTRALIBS := $(LDLIBS:%=$(LD_LIB)) $(EXTRALIBS)
|
||||||
|
|
||||||
|
OBJS := $(sort $(OBJS:%=$(SUBDIR)%))
|
||||||
|
SLIBOBJS := $(sort $(SLIBOBJS:%=$(SUBDIR)%))
|
||||||
|
TESTOBJS := $(TESTOBJS:%=$(SUBDIR)%) $(TESTPROGS:%=$(SUBDIR)%-test.o)
|
||||||
|
TESTPROGS := $(TESTPROGS:%=$(SUBDIR)%-test$(EXESUF))
|
||||||
|
HOSTOBJS := $(HOSTPROGS:%=$(SUBDIR)%.o)
|
||||||
|
HOSTPROGS := $(HOSTPROGS:%=$(SUBDIR)%$(HOSTEXESUF))
|
||||||
|
TOOLS += $(TOOLS-yes)
|
||||||
|
TOOLOBJS := $(TOOLS:%=tools/%.o)
|
||||||
|
TOOLS := $(TOOLS:%=tools/%$(EXESUF))
|
||||||
|
HEADERS += $(HEADERS-yes)
|
||||||
|
|
||||||
|
PATH_LIBNAME = $(foreach NAME,$(1),lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME))
|
||||||
|
DEP_LIBS := $(foreach lib,$(FFLIBS),$(call PATH_LIBNAME,$(lib)))
|
||||||
|
|
||||||
|
SRC_DIR := $(SRC_PATH)/lib$(NAME)
|
||||||
|
ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
|
||||||
|
SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-)
|
||||||
|
SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%)
|
||||||
|
HOBJS = $(filter-out $(SKIPHEADERS:.h=.h.o),$(ALLHEADERS:.h=.h.o))
|
||||||
|
checkheaders: $(HOBJS)
|
||||||
|
.SECONDARY: $(HOBJS:.o=.c)
|
||||||
|
|
||||||
|
alltools: $(TOOLS)
|
||||||
|
|
||||||
|
$(HOSTOBJS): %.o: %.c
|
||||||
|
$(COMPILE_HOSTC)
|
||||||
|
|
||||||
|
$(HOSTPROGS): %$(HOSTEXESUF): %.o
|
||||||
|
$(HOSTLD) $(HOSTLDFLAGS) $(HOSTLD_O) $^ $(HOSTLIBS)
|
||||||
|
|
||||||
|
$(OBJS): | $(sort $(dir $(OBJS)))
|
||||||
|
$(HOBJS): | $(sort $(dir $(HOBJS)))
|
||||||
|
$(HOSTOBJS): | $(sort $(dir $(HOSTOBJS)))
|
||||||
|
$(SLIBOBJS): | $(sort $(dir $(SLIBOBJS)))
|
||||||
|
$(TESTOBJS): | $(sort $(dir $(TESTOBJS)))
|
||||||
|
$(TOOLOBJS): | tools
|
||||||
|
|
||||||
|
OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(SLIBOBJS) $(TESTOBJS))
|
||||||
|
|
||||||
|
CLEANSUFFIXES = *.d *.o *~ *.h.c *.map *.ver *.ho *.gcno *.gcda
|
||||||
|
DISTCLEANSUFFIXES = *.pc
|
||||||
|
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a
|
||||||
|
|
||||||
|
define RULES
|
||||||
|
clean::
|
||||||
|
$(RM) $(OBJS) $(OBJS:.o=.d)
|
||||||
|
$(RM) $(HOSTPROGS)
|
||||||
|
$(RM) $(TOOLS)
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(RULES))
|
||||||
|
|
||||||
|
-include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d) $(HOBJS:.o=.d) $(SLIBOBJS:.o=.d))
|
||||||
@@ -19,8 +19,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef COMPAT_AIX_MATH_H
|
#ifndef FFMPEG_COMPAT_AIX_MATH_H
|
||||||
#define COMPAT_AIX_MATH_H
|
#define FFMPEG_COMPAT_AIX_MATH_H
|
||||||
|
|
||||||
#define class class_in_math_h_causes_problems
|
#define class class_in_math_h_causes_problems
|
||||||
|
|
||||||
@@ -28,4 +28,4 @@
|
|||||||
|
|
||||||
#undef class
|
#undef class
|
||||||
|
|
||||||
#endif /* COMPAT_AIX_MATH_H */
|
#endif /* FFMPEG_COMPAT_AIX_MATH_H */
|
||||||
|
|||||||
@@ -1,176 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of FFmpeg.
|
|
||||||
*
|
|
||||||
* FFmpeg is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* FFmpeg is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with FFmpeg; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* based on vlc_atomic.h from VLC
|
|
||||||
* Copyright (C) 2010 Rémi Denis-Courmont
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef COMPAT_ATOMICS_DUMMY_STDATOMIC_H
|
|
||||||
#define COMPAT_ATOMICS_DUMMY_STDATOMIC_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#define ATOMIC_FLAG_INIT 0
|
|
||||||
|
|
||||||
#define ATOMIC_VAR_INIT(value) (value)
|
|
||||||
|
|
||||||
#define atomic_init(obj, value) \
|
|
||||||
do { \
|
|
||||||
*(obj) = (value); \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define kill_dependency(y) ((void)0)
|
|
||||||
|
|
||||||
#define atomic_thread_fence(order) \
|
|
||||||
((void)0)
|
|
||||||
|
|
||||||
#define atomic_signal_fence(order) \
|
|
||||||
((void)0)
|
|
||||||
|
|
||||||
#define atomic_is_lock_free(obj) 0
|
|
||||||
|
|
||||||
typedef intptr_t atomic_flag;
|
|
||||||
typedef intptr_t atomic_bool;
|
|
||||||
typedef intptr_t atomic_char;
|
|
||||||
typedef intptr_t atomic_schar;
|
|
||||||
typedef intptr_t atomic_uchar;
|
|
||||||
typedef intptr_t atomic_short;
|
|
||||||
typedef intptr_t atomic_ushort;
|
|
||||||
typedef intptr_t atomic_int;
|
|
||||||
typedef intptr_t atomic_uint;
|
|
||||||
typedef intptr_t atomic_long;
|
|
||||||
typedef intptr_t atomic_ulong;
|
|
||||||
typedef intptr_t atomic_llong;
|
|
||||||
typedef intptr_t atomic_ullong;
|
|
||||||
typedef intptr_t atomic_wchar_t;
|
|
||||||
typedef intptr_t atomic_int_least8_t;
|
|
||||||
typedef intptr_t atomic_uint_least8_t;
|
|
||||||
typedef intptr_t atomic_int_least16_t;
|
|
||||||
typedef intptr_t atomic_uint_least16_t;
|
|
||||||
typedef intptr_t atomic_int_least32_t;
|
|
||||||
typedef intptr_t atomic_uint_least32_t;
|
|
||||||
typedef intptr_t atomic_int_least64_t;
|
|
||||||
typedef intptr_t atomic_uint_least64_t;
|
|
||||||
typedef intptr_t atomic_int_fast8_t;
|
|
||||||
typedef intptr_t atomic_uint_fast8_t;
|
|
||||||
typedef intptr_t atomic_int_fast16_t;
|
|
||||||
typedef intptr_t atomic_uint_fast16_t;
|
|
||||||
typedef intptr_t atomic_int_fast32_t;
|
|
||||||
typedef intptr_t atomic_uint_fast32_t;
|
|
||||||
typedef intptr_t atomic_int_fast64_t;
|
|
||||||
typedef intptr_t atomic_uint_fast64_t;
|
|
||||||
typedef intptr_t atomic_intptr_t;
|
|
||||||
typedef intptr_t atomic_uintptr_t;
|
|
||||||
typedef intptr_t atomic_size_t;
|
|
||||||
typedef intptr_t atomic_ptrdiff_t;
|
|
||||||
typedef intptr_t atomic_intmax_t;
|
|
||||||
typedef intptr_t atomic_uintmax_t;
|
|
||||||
|
|
||||||
#define atomic_store(object, desired) \
|
|
||||||
do { \
|
|
||||||
*(object) = (desired); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define atomic_store_explicit(object, desired, order) \
|
|
||||||
atomic_store(object, desired)
|
|
||||||
|
|
||||||
#define atomic_load(object) \
|
|
||||||
(*(object))
|
|
||||||
|
|
||||||
#define atomic_load_explicit(object, order) \
|
|
||||||
atomic_load(object)
|
|
||||||
|
|
||||||
static inline intptr_t atomic_exchange(intptr_t *object, intptr_t desired)
|
|
||||||
{
|
|
||||||
intptr_t ret = *object;
|
|
||||||
*object = desired;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define atomic_exchange_explicit(object, desired, order) \
|
|
||||||
atomic_exchange(object, desired)
|
|
||||||
|
|
||||||
static inline int atomic_compare_exchange_strong(intptr_t *object, intptr_t *expected,
|
|
||||||
intptr_t desired)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
if (*object == *expected) {
|
|
||||||
*object = desired;
|
|
||||||
ret = 1;
|
|
||||||
} else {
|
|
||||||
*expected = *object;
|
|
||||||
ret = 0;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define atomic_compare_exchange_strong_explicit(object, expected, desired, success, failure) \
|
|
||||||
atomic_compare_exchange_strong(object, expected, desired)
|
|
||||||
|
|
||||||
#define atomic_compare_exchange_weak(object, expected, desired) \
|
|
||||||
atomic_compare_exchange_strong(object, expected, desired)
|
|
||||||
|
|
||||||
#define atomic_compare_exchange_weak_explicit(object, expected, desired, success, failure) \
|
|
||||||
atomic_compare_exchange_weak(object, expected, desired)
|
|
||||||
|
|
||||||
#define FETCH_MODIFY(opname, op) \
|
|
||||||
static inline intptr_t atomic_fetch_ ## opname(intptr_t *object, intptr_t operand) \
|
|
||||||
{ \
|
|
||||||
intptr_t ret; \
|
|
||||||
ret = *object; \
|
|
||||||
*object = *object op operand; \
|
|
||||||
return ret; \
|
|
||||||
}
|
|
||||||
|
|
||||||
FETCH_MODIFY(add, +)
|
|
||||||
FETCH_MODIFY(sub, -)
|
|
||||||
FETCH_MODIFY(or, |)
|
|
||||||
FETCH_MODIFY(xor, ^)
|
|
||||||
FETCH_MODIFY(and, &)
|
|
||||||
|
|
||||||
#undef FETCH_MODIFY
|
|
||||||
|
|
||||||
#define atomic_fetch_add_explicit(object, operand, order) \
|
|
||||||
atomic_fetch_add(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_sub_explicit(object, operand, order) \
|
|
||||||
atomic_fetch_sub(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_or_explicit(object, operand, order) \
|
|
||||||
atomic_fetch_or(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_xor_explicit(object, operand, order) \
|
|
||||||
atomic_fetch_xor(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_and_explicit(object, operand, order) \
|
|
||||||
atomic_fetch_and(object, operand)
|
|
||||||
|
|
||||||
#define atomic_flag_test_and_set(object) \
|
|
||||||
atomic_exchange(object, 1)
|
|
||||||
|
|
||||||
#define atomic_flag_test_and_set_explicit(object, order) \
|
|
||||||
atomic_flag_test_and_set(object)
|
|
||||||
|
|
||||||
#define atomic_flag_clear(object) \
|
|
||||||
atomic_store(object, 0)
|
|
||||||
|
|
||||||
#define atomic_flag_clear_explicit(object, order) \
|
|
||||||
atomic_flag_clear(object)
|
|
||||||
|
|
||||||
#endif /* COMPAT_ATOMICS_DUMMY_STDATOMIC_H */
|
|
||||||
@@ -1,173 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of FFmpeg.
|
|
||||||
*
|
|
||||||
* FFmpeg is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* FFmpeg is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with FFmpeg; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* based on vlc_atomic.h from VLC
|
|
||||||
* Copyright (C) 2010 Rémi Denis-Courmont
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef COMPAT_ATOMICS_GCC_STDATOMIC_H
|
|
||||||
#define COMPAT_ATOMICS_GCC_STDATOMIC_H
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#define ATOMIC_FLAG_INIT 0
|
|
||||||
|
|
||||||
#define ATOMIC_VAR_INIT(value) (value)
|
|
||||||
|
|
||||||
#define atomic_init(obj, value) \
|
|
||||||
do { \
|
|
||||||
*(obj) = (value); \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define kill_dependency(y) ((void)0)
|
|
||||||
|
|
||||||
#define atomic_thread_fence(order) \
|
|
||||||
__sync_synchronize()
|
|
||||||
|
|
||||||
#define atomic_signal_fence(order) \
|
|
||||||
((void)0)
|
|
||||||
|
|
||||||
#define atomic_is_lock_free(obj) 0
|
|
||||||
|
|
||||||
typedef _Bool atomic_flag;
|
|
||||||
typedef _Bool atomic_bool;
|
|
||||||
typedef char atomic_char;
|
|
||||||
typedef signed char atomic_schar;
|
|
||||||
typedef unsigned char atomic_uchar;
|
|
||||||
typedef short atomic_short;
|
|
||||||
typedef unsigned short atomic_ushort;
|
|
||||||
typedef int atomic_int;
|
|
||||||
typedef unsigned int atomic_uint;
|
|
||||||
typedef long atomic_long;
|
|
||||||
typedef unsigned long atomic_ulong;
|
|
||||||
typedef long long atomic_llong;
|
|
||||||
typedef unsigned long long atomic_ullong;
|
|
||||||
typedef wchar_t atomic_wchar_t;
|
|
||||||
typedef int_least8_t atomic_int_least8_t;
|
|
||||||
typedef uint_least8_t atomic_uint_least8_t;
|
|
||||||
typedef int_least16_t atomic_int_least16_t;
|
|
||||||
typedef uint_least16_t atomic_uint_least16_t;
|
|
||||||
typedef int_least32_t atomic_int_least32_t;
|
|
||||||
typedef uint_least32_t atomic_uint_least32_t;
|
|
||||||
typedef int_least64_t atomic_int_least64_t;
|
|
||||||
typedef uint_least64_t atomic_uint_least64_t;
|
|
||||||
typedef int_fast8_t atomic_int_fast8_t;
|
|
||||||
typedef uint_fast8_t atomic_uint_fast8_t;
|
|
||||||
typedef int_fast16_t atomic_int_fast16_t;
|
|
||||||
typedef uint_fast16_t atomic_uint_fast16_t;
|
|
||||||
typedef int_fast32_t atomic_int_fast32_t;
|
|
||||||
typedef uint_fast32_t atomic_uint_fast32_t;
|
|
||||||
typedef int_fast64_t atomic_int_fast64_t;
|
|
||||||
typedef uint_fast64_t atomic_uint_fast64_t;
|
|
||||||
typedef intptr_t atomic_intptr_t;
|
|
||||||
typedef uintptr_t atomic_uintptr_t;
|
|
||||||
typedef size_t atomic_size_t;
|
|
||||||
typedef ptrdiff_t atomic_ptrdiff_t;
|
|
||||||
typedef intmax_t atomic_intmax_t;
|
|
||||||
typedef uintmax_t atomic_uintmax_t;
|
|
||||||
|
|
||||||
#define atomic_store(object, desired) \
|
|
||||||
do { \
|
|
||||||
*(object) = (desired); \
|
|
||||||
__sync_synchronize(); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define atomic_store_explicit(object, desired, order) \
|
|
||||||
atomic_store(object, desired)
|
|
||||||
|
|
||||||
#define atomic_load(object) \
|
|
||||||
(__sync_synchronize(), *(object))
|
|
||||||
|
|
||||||
#define atomic_load_explicit(object, order) \
|
|
||||||
atomic_load(object)
|
|
||||||
|
|
||||||
#define atomic_exchange(object, desired) \
|
|
||||||
({ \
|
|
||||||
__typeof__(object) _obj = (object); \
|
|
||||||
__typeof__(*object) _old; \
|
|
||||||
do \
|
|
||||||
_old = atomic_load(_obj); \
|
|
||||||
while (!__sync_bool_compare_and_swap(_obj, _old, (desired))); \
|
|
||||||
_old; \
|
|
||||||
})
|
|
||||||
|
|
||||||
#define atomic_exchange_explicit(object, desired, order) \
|
|
||||||
atomic_exchange(object, desired)
|
|
||||||
|
|
||||||
#define atomic_compare_exchange_strong(object, expected, desired) \
|
|
||||||
({ \
|
|
||||||
__typeof__(object) _exp = (expected); \
|
|
||||||
__typeof__(*object) _old = *_exp; \
|
|
||||||
*_exp = __sync_val_compare_and_swap((object), _old, (desired)); \
|
|
||||||
*_exp == _old; \
|
|
||||||
})
|
|
||||||
|
|
||||||
#define atomic_compare_exchange_strong_explicit(object, expected, desired, success, failure) \
|
|
||||||
atomic_compare_exchange_strong(object, expected, desired)
|
|
||||||
|
|
||||||
#define atomic_compare_exchange_weak(object, expected, desired) \
|
|
||||||
atomic_compare_exchange_strong(object, expected, desired)
|
|
||||||
|
|
||||||
#define atomic_compare_exchange_weak_explicit(object, expected, desired, success, failure) \
|
|
||||||
atomic_compare_exchange_weak(object, expected, desired)
|
|
||||||
|
|
||||||
#define atomic_fetch_add(object, operand) \
|
|
||||||
__sync_fetch_and_add(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_add_explicit(object, operand, order) \
|
|
||||||
atomic_fetch_add(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_sub(object, operand) \
|
|
||||||
__sync_fetch_and_sub(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_sub_explicit(object, operand, order) \
|
|
||||||
atomic_fetch_sub(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_or(object, operand) \
|
|
||||||
__sync_fetch_and_or(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_or_explicit(object, operand, order) \
|
|
||||||
atomic_fetch_or(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_xor(object, operand) \
|
|
||||||
__sync_fetch_and_xor(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_xor_explicit(object, operand, order) \
|
|
||||||
atomic_fetch_xor(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_and(object, operand) \
|
|
||||||
__sync_fetch_and_and(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_and_explicit(object, operand, order) \
|
|
||||||
atomic_fetch_and(object, operand)
|
|
||||||
|
|
||||||
#define atomic_flag_test_and_set(object) \
|
|
||||||
atomic_exchange(object, 1)
|
|
||||||
|
|
||||||
#define atomic_flag_test_and_set_explicit(object, order) \
|
|
||||||
atomic_flag_test_and_set(object)
|
|
||||||
|
|
||||||
#define atomic_flag_clear(object) \
|
|
||||||
atomic_store(object, 0)
|
|
||||||
|
|
||||||
#define atomic_flag_clear_explicit(object, order) \
|
|
||||||
atomic_flag_clear(object)
|
|
||||||
|
|
||||||
#endif /* COMPAT_ATOMICS_GCC_STDATOMIC_H */
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of FFmpeg.
|
|
||||||
*
|
|
||||||
* FFmpeg is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* FFmpeg is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with FFmpeg; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* based on vlc_atomic.h from VLC
|
|
||||||
* Copyright (C) 2010 Rémi Denis-Courmont
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <pthread.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include "stdatomic.h"
|
|
||||||
|
|
||||||
static pthread_mutex_t atomic_lock = PTHREAD_MUTEX_INITIALIZER;
|
|
||||||
|
|
||||||
void avpriv_atomic_lock(void)
|
|
||||||
{
|
|
||||||
pthread_mutex_lock(&atomic_lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
void avpriv_atomic_unlock(void)
|
|
||||||
{
|
|
||||||
pthread_mutex_unlock(&atomic_lock);
|
|
||||||
}
|
|
||||||
@@ -1,197 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of FFmpeg.
|
|
||||||
*
|
|
||||||
* FFmpeg is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* FFmpeg is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with FFmpeg; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* based on vlc_atomic.h from VLC
|
|
||||||
* Copyright (C) 2010 Rémi Denis-Courmont
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef COMPAT_ATOMICS_PTHREAD_STDATOMIC_H
|
|
||||||
#define COMPAT_ATOMICS_PTHREAD_STDATOMIC_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#define ATOMIC_FLAG_INIT 0
|
|
||||||
|
|
||||||
#define ATOMIC_VAR_INIT(value) (value)
|
|
||||||
|
|
||||||
#define atomic_init(obj, value) \
|
|
||||||
do { \
|
|
||||||
*(obj) = (value); \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define kill_dependency(y) ((void)0)
|
|
||||||
|
|
||||||
#define atomic_signal_fence(order) \
|
|
||||||
((void)0)
|
|
||||||
|
|
||||||
#define atomic_is_lock_free(obj) 0
|
|
||||||
|
|
||||||
typedef intptr_t atomic_flag;
|
|
||||||
typedef intptr_t atomic_bool;
|
|
||||||
typedef intptr_t atomic_char;
|
|
||||||
typedef intptr_t atomic_schar;
|
|
||||||
typedef intptr_t atomic_uchar;
|
|
||||||
typedef intptr_t atomic_short;
|
|
||||||
typedef intptr_t atomic_ushort;
|
|
||||||
typedef intptr_t atomic_int;
|
|
||||||
typedef intptr_t atomic_uint;
|
|
||||||
typedef intptr_t atomic_long;
|
|
||||||
typedef intptr_t atomic_ulong;
|
|
||||||
typedef intptr_t atomic_llong;
|
|
||||||
typedef intptr_t atomic_ullong;
|
|
||||||
typedef intptr_t atomic_wchar_t;
|
|
||||||
typedef intptr_t atomic_int_least8_t;
|
|
||||||
typedef intptr_t atomic_uint_least8_t;
|
|
||||||
typedef intptr_t atomic_int_least16_t;
|
|
||||||
typedef intptr_t atomic_uint_least16_t;
|
|
||||||
typedef intptr_t atomic_int_least32_t;
|
|
||||||
typedef intptr_t atomic_uint_least32_t;
|
|
||||||
typedef intptr_t atomic_int_least64_t;
|
|
||||||
typedef intptr_t atomic_uint_least64_t;
|
|
||||||
typedef intptr_t atomic_int_fast8_t;
|
|
||||||
typedef intptr_t atomic_uint_fast8_t;
|
|
||||||
typedef intptr_t atomic_int_fast16_t;
|
|
||||||
typedef intptr_t atomic_uint_fast16_t;
|
|
||||||
typedef intptr_t atomic_int_fast32_t;
|
|
||||||
typedef intptr_t atomic_uint_fast32_t;
|
|
||||||
typedef intptr_t atomic_int_fast64_t;
|
|
||||||
typedef intptr_t atomic_uint_fast64_t;
|
|
||||||
typedef intptr_t atomic_intptr_t;
|
|
||||||
typedef intptr_t atomic_uintptr_t;
|
|
||||||
typedef intptr_t atomic_size_t;
|
|
||||||
typedef intptr_t atomic_ptrdiff_t;
|
|
||||||
typedef intptr_t atomic_intmax_t;
|
|
||||||
typedef intptr_t atomic_uintmax_t;
|
|
||||||
|
|
||||||
void avpriv_atomic_lock(void);
|
|
||||||
void avpriv_atomic_unlock(void);
|
|
||||||
|
|
||||||
static inline void atomic_thread_fence(int order)
|
|
||||||
{
|
|
||||||
avpriv_atomic_lock();
|
|
||||||
avpriv_atomic_unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void atomic_store(intptr_t *object, intptr_t desired)
|
|
||||||
{
|
|
||||||
avpriv_atomic_lock();
|
|
||||||
*object = desired;
|
|
||||||
avpriv_atomic_unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
#define atomic_store_explicit(object, desired, order) \
|
|
||||||
atomic_store(object, desired)
|
|
||||||
|
|
||||||
static inline intptr_t atomic_load(intptr_t *object)
|
|
||||||
{
|
|
||||||
intptr_t ret;
|
|
||||||
avpriv_atomic_lock();
|
|
||||||
ret = *object;
|
|
||||||
avpriv_atomic_unlock();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define atomic_load_explicit(object, order) \
|
|
||||||
atomic_load(object)
|
|
||||||
|
|
||||||
static inline intptr_t atomic_exchange(intptr_t *object, intptr_t desired)
|
|
||||||
{
|
|
||||||
intptr_t ret;
|
|
||||||
avpriv_atomic_lock();
|
|
||||||
ret = *object;
|
|
||||||
*object = desired;
|
|
||||||
avpriv_atomic_unlock();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define atomic_exchange_explicit(object, desired, order) \
|
|
||||||
atomic_exchange(object, desired)
|
|
||||||
|
|
||||||
static inline int atomic_compare_exchange_strong(intptr_t *object, intptr_t *expected,
|
|
||||||
intptr_t desired)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
avpriv_atomic_lock();
|
|
||||||
if (*object == *expected) {
|
|
||||||
ret = 1;
|
|
||||||
*object = desired;
|
|
||||||
} else {
|
|
||||||
ret = 0;
|
|
||||||
*expected = *object;
|
|
||||||
}
|
|
||||||
avpriv_atomic_unlock();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define atomic_compare_exchange_strong_explicit(object, expected, desired, success, failure) \
|
|
||||||
atomic_compare_exchange_strong(object, expected, desired)
|
|
||||||
|
|
||||||
#define atomic_compare_exchange_weak(object, expected, desired) \
|
|
||||||
atomic_compare_exchange_strong(object, expected, desired)
|
|
||||||
|
|
||||||
#define atomic_compare_exchange_weak_explicit(object, expected, desired, success, failure) \
|
|
||||||
atomic_compare_exchange_weak(object, expected, desired)
|
|
||||||
|
|
||||||
#define FETCH_MODIFY(opname, op) \
|
|
||||||
static inline intptr_t atomic_fetch_ ## opname(intptr_t *object, intptr_t operand) \
|
|
||||||
{ \
|
|
||||||
intptr_t ret; \
|
|
||||||
avpriv_atomic_lock(); \
|
|
||||||
ret = *object; \
|
|
||||||
*object = *object op operand; \
|
|
||||||
avpriv_atomic_unlock(); \
|
|
||||||
return ret; \
|
|
||||||
}
|
|
||||||
|
|
||||||
FETCH_MODIFY(add, +)
|
|
||||||
FETCH_MODIFY(sub, -)
|
|
||||||
FETCH_MODIFY(or, |)
|
|
||||||
FETCH_MODIFY(xor, ^)
|
|
||||||
FETCH_MODIFY(and, &)
|
|
||||||
|
|
||||||
#undef FETCH_MODIFY
|
|
||||||
|
|
||||||
#define atomic_fetch_add_explicit(object, operand, order) \
|
|
||||||
atomic_fetch_add(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_sub_explicit(object, operand, order) \
|
|
||||||
atomic_fetch_sub(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_or_explicit(object, operand, order) \
|
|
||||||
atomic_fetch_or(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_xor_explicit(object, operand, order) \
|
|
||||||
atomic_fetch_xor(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_and_explicit(object, operand, order) \
|
|
||||||
atomic_fetch_and(object, operand)
|
|
||||||
|
|
||||||
#define atomic_flag_test_and_set(object) \
|
|
||||||
atomic_exchange(object, 1)
|
|
||||||
|
|
||||||
#define atomic_flag_test_and_set_explicit(object, order) \
|
|
||||||
atomic_flag_test_and_set(object)
|
|
||||||
|
|
||||||
#define atomic_flag_clear(object) \
|
|
||||||
atomic_store(object, 0)
|
|
||||||
|
|
||||||
#define atomic_flag_clear_explicit(object, order) \
|
|
||||||
atomic_flag_clear(object)
|
|
||||||
|
|
||||||
#endif /* COMPAT_ATOMICS_PTHREAD_STDATOMIC_H */
|
|
||||||
@@ -1,186 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of FFmpeg.
|
|
||||||
*
|
|
||||||
* FFmpeg is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* FFmpeg is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with FFmpeg; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef COMPAT_ATOMICS_SUNCC_STDATOMIC_H
|
|
||||||
#define COMPAT_ATOMICS_SUNCC_STDATOMIC_H
|
|
||||||
|
|
||||||
#include <atomic.h>
|
|
||||||
#include <mbarrier.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#define ATOMIC_FLAG_INIT 0
|
|
||||||
|
|
||||||
#define ATOMIC_VAR_INIT(value) (value)
|
|
||||||
|
|
||||||
#define atomic_init(obj, value) \
|
|
||||||
do { \
|
|
||||||
*(obj) = (value); \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define kill_dependency(y) ((void)0)
|
|
||||||
|
|
||||||
#define atomic_thread_fence(order) \
|
|
||||||
__machine_rw_barrier();
|
|
||||||
|
|
||||||
#define atomic_signal_fence(order) \
|
|
||||||
((void)0)
|
|
||||||
|
|
||||||
#define atomic_is_lock_free(obj) 0
|
|
||||||
|
|
||||||
typedef intptr_t atomic_flag;
|
|
||||||
typedef intptr_t atomic_bool;
|
|
||||||
typedef intptr_t atomic_char;
|
|
||||||
typedef intptr_t atomic_schar;
|
|
||||||
typedef intptr_t atomic_uchar;
|
|
||||||
typedef intptr_t atomic_short;
|
|
||||||
typedef intptr_t atomic_ushort;
|
|
||||||
typedef intptr_t atomic_int;
|
|
||||||
typedef intptr_t atomic_uint;
|
|
||||||
typedef intptr_t atomic_long;
|
|
||||||
typedef intptr_t atomic_ulong;
|
|
||||||
typedef intptr_t atomic_llong;
|
|
||||||
typedef intptr_t atomic_ullong;
|
|
||||||
typedef intptr_t atomic_wchar_t;
|
|
||||||
typedef intptr_t atomic_int_least8_t;
|
|
||||||
typedef intptr_t atomic_uint_least8_t;
|
|
||||||
typedef intptr_t atomic_int_least16_t;
|
|
||||||
typedef intptr_t atomic_uint_least16_t;
|
|
||||||
typedef intptr_t atomic_int_least32_t;
|
|
||||||
typedef intptr_t atomic_uint_least32_t;
|
|
||||||
typedef intptr_t atomic_int_least64_t;
|
|
||||||
typedef intptr_t atomic_uint_least64_t;
|
|
||||||
typedef intptr_t atomic_int_fast8_t;
|
|
||||||
typedef intptr_t atomic_uint_fast8_t;
|
|
||||||
typedef intptr_t atomic_int_fast16_t;
|
|
||||||
typedef intptr_t atomic_uint_fast16_t;
|
|
||||||
typedef intptr_t atomic_int_fast32_t;
|
|
||||||
typedef intptr_t atomic_uint_fast32_t;
|
|
||||||
typedef intptr_t atomic_int_fast64_t;
|
|
||||||
typedef intptr_t atomic_uint_fast64_t;
|
|
||||||
typedef intptr_t atomic_intptr_t;
|
|
||||||
typedef intptr_t atomic_uintptr_t;
|
|
||||||
typedef intptr_t atomic_size_t;
|
|
||||||
typedef intptr_t atomic_ptrdiff_t;
|
|
||||||
typedef intptr_t atomic_intmax_t;
|
|
||||||
typedef intptr_t atomic_uintmax_t;
|
|
||||||
|
|
||||||
static inline void atomic_store(intptr_t *object, intptr_t desired)
|
|
||||||
{
|
|
||||||
*object = desired;
|
|
||||||
__machine_rw_barrier();
|
|
||||||
}
|
|
||||||
|
|
||||||
#define atomic_store_explicit(object, desired, order) \
|
|
||||||
atomic_store(object, desired)
|
|
||||||
|
|
||||||
static inline intptr_t atomic_load(intptr_t *object)
|
|
||||||
{
|
|
||||||
__machine_rw_barrier();
|
|
||||||
return *object;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define atomic_load_explicit(object, order) \
|
|
||||||
atomic_load(object)
|
|
||||||
|
|
||||||
#define atomic_exchange(object, desired) \
|
|
||||||
atomic_swap_ptr(object, desired)
|
|
||||||
|
|
||||||
#define atomic_exchange_explicit(object, desired, order) \
|
|
||||||
atomic_exchange(object, desired)
|
|
||||||
|
|
||||||
static inline int atomic_compare_exchange_strong(intptr_t *object, intptr_t *expected,
|
|
||||||
intptr_t desired)
|
|
||||||
{
|
|
||||||
intptr_t old = *expected;
|
|
||||||
*expected = (intptr_t)atomic_cas_ptr(object, (void *)old, (void *)desired);
|
|
||||||
return *expected == old;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define atomic_compare_exchange_strong_explicit(object, expected, desired, success, failure) \
|
|
||||||
atomic_compare_exchange_strong(object, expected, desired)
|
|
||||||
|
|
||||||
#define atomic_compare_exchange_weak(object, expected, desired) \
|
|
||||||
atomic_compare_exchange_strong(object, expected, desired)
|
|
||||||
|
|
||||||
#define atomic_compare_exchange_weak_explicit(object, expected, desired, success, failure) \
|
|
||||||
atomic_compare_exchange_weak(object, expected, desired)
|
|
||||||
|
|
||||||
static inline intptr_t atomic_fetch_add(intptr_t *object, intptr_t operand)
|
|
||||||
{
|
|
||||||
return atomic_add_ptr_nv(object, operand) - operand;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define atomic_fetch_sub(object, operand) \
|
|
||||||
atomic_fetch_add(object, -(operand))
|
|
||||||
|
|
||||||
static inline intptr_t atomic_fetch_or(intptr_t *object, intptr_t operand)
|
|
||||||
{
|
|
||||||
intptr_t old;
|
|
||||||
do {
|
|
||||||
old = atomic_load(object);
|
|
||||||
} while (!atomic_compare_exchange_strong(object, old, old | operand));
|
|
||||||
return old;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline intptr_t atomic_fetch_xor(intptr_t *object, intptr_t operand)
|
|
||||||
{
|
|
||||||
intptr_t old;
|
|
||||||
do {
|
|
||||||
old = atomic_load(object);
|
|
||||||
} while (!atomic_compare_exchange_strong(object, old, old ^ operand));
|
|
||||||
return old;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline intptr_t atomic_fetch_and(intptr_t *object, intptr_t operand)
|
|
||||||
{
|
|
||||||
intptr_t old;
|
|
||||||
do {
|
|
||||||
old = atomic_load(object);
|
|
||||||
} while (!atomic_compare_exchange_strong(object, old, old & operand));
|
|
||||||
return old;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define atomic_fetch_add_explicit(object, operand, order) \
|
|
||||||
atomic_fetch_add(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_sub_explicit(object, operand, order) \
|
|
||||||
atomic_fetch_sub(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_or_explicit(object, operand, order) \
|
|
||||||
atomic_fetch_or(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_xor_explicit(object, operand, order) \
|
|
||||||
atomic_fetch_xor(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_and_explicit(object, operand, order) \
|
|
||||||
atomic_fetch_and(object, operand)
|
|
||||||
|
|
||||||
#define atomic_flag_test_and_set(object) \
|
|
||||||
atomic_exchange(object, 1)
|
|
||||||
|
|
||||||
#define atomic_flag_test_and_set_explicit(object, order) \
|
|
||||||
atomic_flag_test_and_set(object)
|
|
||||||
|
|
||||||
#define atomic_flag_clear(object) \
|
|
||||||
atomic_store(object, 0)
|
|
||||||
|
|
||||||
#define atomic_flag_clear_explicit(object, order) \
|
|
||||||
atomic_flag_clear(object)
|
|
||||||
|
|
||||||
#endif /* COMPAT_ATOMICS_SUNCC_STDATOMIC_H */
|
|
||||||
@@ -1,181 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of FFmpeg.
|
|
||||||
*
|
|
||||||
* FFmpeg is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* FFmpeg is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with FFmpeg; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef COMPAT_ATOMICS_WIN32_STDATOMIC_H
|
|
||||||
#define COMPAT_ATOMICS_WIN32_STDATOMIC_H
|
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#define ATOMIC_FLAG_INIT 0
|
|
||||||
|
|
||||||
#define ATOMIC_VAR_INIT(value) (value)
|
|
||||||
|
|
||||||
#define atomic_init(obj, value) \
|
|
||||||
do { \
|
|
||||||
*(obj) = (value); \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define kill_dependency(y) ((void)0)
|
|
||||||
|
|
||||||
#define atomic_thread_fence(order) \
|
|
||||||
MemoryBarrier();
|
|
||||||
|
|
||||||
#define atomic_signal_fence(order) \
|
|
||||||
((void)0)
|
|
||||||
|
|
||||||
#define atomic_is_lock_free(obj) 0
|
|
||||||
|
|
||||||
typedef intptr_t atomic_flag;
|
|
||||||
typedef intptr_t atomic_bool;
|
|
||||||
typedef intptr_t atomic_char;
|
|
||||||
typedef intptr_t atomic_schar;
|
|
||||||
typedef intptr_t atomic_uchar;
|
|
||||||
typedef intptr_t atomic_short;
|
|
||||||
typedef intptr_t atomic_ushort;
|
|
||||||
typedef intptr_t atomic_int;
|
|
||||||
typedef intptr_t atomic_uint;
|
|
||||||
typedef intptr_t atomic_long;
|
|
||||||
typedef intptr_t atomic_ulong;
|
|
||||||
typedef intptr_t atomic_llong;
|
|
||||||
typedef intptr_t atomic_ullong;
|
|
||||||
typedef intptr_t atomic_wchar_t;
|
|
||||||
typedef intptr_t atomic_int_least8_t;
|
|
||||||
typedef intptr_t atomic_uint_least8_t;
|
|
||||||
typedef intptr_t atomic_int_least16_t;
|
|
||||||
typedef intptr_t atomic_uint_least16_t;
|
|
||||||
typedef intptr_t atomic_int_least32_t;
|
|
||||||
typedef intptr_t atomic_uint_least32_t;
|
|
||||||
typedef intptr_t atomic_int_least64_t;
|
|
||||||
typedef intptr_t atomic_uint_least64_t;
|
|
||||||
typedef intptr_t atomic_int_fast8_t;
|
|
||||||
typedef intptr_t atomic_uint_fast8_t;
|
|
||||||
typedef intptr_t atomic_int_fast16_t;
|
|
||||||
typedef intptr_t atomic_uint_fast16_t;
|
|
||||||
typedef intptr_t atomic_int_fast32_t;
|
|
||||||
typedef intptr_t atomic_uint_fast32_t;
|
|
||||||
typedef intptr_t atomic_int_fast64_t;
|
|
||||||
typedef intptr_t atomic_uint_fast64_t;
|
|
||||||
typedef intptr_t atomic_intptr_t;
|
|
||||||
typedef intptr_t atomic_uintptr_t;
|
|
||||||
typedef intptr_t atomic_size_t;
|
|
||||||
typedef intptr_t atomic_ptrdiff_t;
|
|
||||||
typedef intptr_t atomic_intmax_t;
|
|
||||||
typedef intptr_t atomic_uintmax_t;
|
|
||||||
|
|
||||||
#define atomic_store(object, desired) \
|
|
||||||
do { \
|
|
||||||
*(object) = (desired); \
|
|
||||||
MemoryBarrier(); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define atomic_store_explicit(object, desired, order) \
|
|
||||||
atomic_store(object, desired)
|
|
||||||
|
|
||||||
#define atomic_load(object) \
|
|
||||||
(MemoryBarrier(), *(object))
|
|
||||||
|
|
||||||
#define atomic_load_explicit(object, order) \
|
|
||||||
atomic_load(object)
|
|
||||||
|
|
||||||
#define atomic_exchange(object, desired) \
|
|
||||||
InterlockedExchangePointer(object, desired);
|
|
||||||
|
|
||||||
#define atomic_exchange_explicit(object, desired, order) \
|
|
||||||
atomic_exchange(object, desired)
|
|
||||||
|
|
||||||
static inline int atomic_compare_exchange_strong(intptr_t *object, intptr_t *expected,
|
|
||||||
intptr_t desired)
|
|
||||||
{
|
|
||||||
intptr_t old = *expected;
|
|
||||||
*expected = (intptr_t)InterlockedCompareExchangePointer(
|
|
||||||
(PVOID *)object, (PVOID)desired, (PVOID)old);
|
|
||||||
return *expected == old;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define atomic_compare_exchange_strong_explicit(object, expected, desired, success, failure) \
|
|
||||||
atomic_compare_exchange_strong(object, expected, desired)
|
|
||||||
|
|
||||||
#define atomic_compare_exchange_weak(object, expected, desired) \
|
|
||||||
atomic_compare_exchange_strong(object, expected, desired)
|
|
||||||
|
|
||||||
#define atomic_compare_exchange_weak_explicit(object, expected, desired, success, failure) \
|
|
||||||
atomic_compare_exchange_weak(object, expected, desired)
|
|
||||||
|
|
||||||
#ifdef _WIN64
|
|
||||||
#define atomic_fetch_add(object, operand) \
|
|
||||||
InterlockedExchangeAdd64(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_sub(object, operand) \
|
|
||||||
InterlockedExchangeAdd64(object, -(operand))
|
|
||||||
|
|
||||||
#define atomic_fetch_or(object, operand) \
|
|
||||||
InterlockedOr64(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_xor(object, operand) \
|
|
||||||
InterlockedXor64(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_and(object, operand) \
|
|
||||||
InterlockedAnd64(object, operand)
|
|
||||||
#else
|
|
||||||
#define atomic_fetch_add(object, operand) \
|
|
||||||
InterlockedExchangeAdd(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_sub(object, operand) \
|
|
||||||
InterlockedExchangeAdd(object, -(operand))
|
|
||||||
|
|
||||||
#define atomic_fetch_or(object, operand) \
|
|
||||||
InterlockedOr(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_xor(object, operand) \
|
|
||||||
InterlockedXor(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_and(object, operand) \
|
|
||||||
InterlockedAnd(object, operand)
|
|
||||||
#endif /* _WIN64 */
|
|
||||||
|
|
||||||
#define atomic_fetch_add_explicit(object, operand, order) \
|
|
||||||
atomic_fetch_add(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_sub_explicit(object, operand, order) \
|
|
||||||
atomic_fetch_sub(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_or_explicit(object, operand, order) \
|
|
||||||
atomic_fetch_or(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_xor_explicit(object, operand, order) \
|
|
||||||
atomic_fetch_xor(object, operand)
|
|
||||||
|
|
||||||
#define atomic_fetch_and_explicit(object, operand, order) \
|
|
||||||
atomic_fetch_and(object, operand)
|
|
||||||
|
|
||||||
#define atomic_flag_test_and_set(object) \
|
|
||||||
atomic_exchange(object, 1)
|
|
||||||
|
|
||||||
#define atomic_flag_test_and_set_explicit(object, order) \
|
|
||||||
atomic_flag_test_and_set(object)
|
|
||||||
|
|
||||||
#define atomic_flag_clear(object) \
|
|
||||||
atomic_store(object, 0)
|
|
||||||
|
|
||||||
#define atomic_flag_clear_explicit(object, order) \
|
|
||||||
atomic_flag_clear(object)
|
|
||||||
|
|
||||||
#endif /* COMPAT_ATOMICS_WIN32_STDATOMIC_H */
|
|
||||||
880
compat/avisynth/avisynth_c.h
Normal file
880
compat/avisynth/avisynth_c.h
Normal file
@@ -0,0 +1,880 @@
|
|||||||
|
// Avisynth C Interface Version 0.20
|
||||||
|
// Copyright 2003 Kevin Atkinson
|
||||||
|
|
||||||
|
// This program is free software; you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation; either version 2 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
// MA 02110-1301 USA, or visit
|
||||||
|
// http://www.gnu.org/copyleft/gpl.html .
|
||||||
|
//
|
||||||
|
// As a special exception, I give you permission to link to the
|
||||||
|
// Avisynth C interface with independent modules that communicate with
|
||||||
|
// the Avisynth C interface solely through the interfaces defined in
|
||||||
|
// avisynth_c.h, regardless of the license terms of these independent
|
||||||
|
// modules, and to copy and distribute the resulting combined work
|
||||||
|
// under terms of your choice, provided that every copy of the
|
||||||
|
// combined work is accompanied by a complete copy of the source code
|
||||||
|
// of the Avisynth C interface and Avisynth itself (with the version
|
||||||
|
// used to produce the combined work), being distributed under the
|
||||||
|
// terms of the GNU General Public License plus this exception. An
|
||||||
|
// independent module is a module which is not derived from or based
|
||||||
|
// on Avisynth C Interface, such as 3rd-party filters, import and
|
||||||
|
// export plugins, or graphical user interfaces.
|
||||||
|
|
||||||
|
// NOTE: this is a partial update of the Avisynth C interface to recognize
|
||||||
|
// new color spaces added in Avisynth 2.60. By no means is this document
|
||||||
|
// completely Avisynth 2.60 compliant.
|
||||||
|
|
||||||
|
#ifndef __AVISYNTH_C__
|
||||||
|
#define __AVISYNTH_C__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
# define EXTERN_C extern "C"
|
||||||
|
#else
|
||||||
|
# define EXTERN_C
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define AVSC_USE_STDCALL 1
|
||||||
|
|
||||||
|
#ifndef AVSC_USE_STDCALL
|
||||||
|
# define AVSC_CC __cdecl
|
||||||
|
#else
|
||||||
|
# define AVSC_CC __stdcall
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define AVSC_INLINE static __inline
|
||||||
|
|
||||||
|
#ifdef AVISYNTH_C_EXPORTS
|
||||||
|
# define AVSC_EXPORT EXTERN_C
|
||||||
|
# define AVSC_API(ret, name) EXTERN_C __declspec(dllexport) ret AVSC_CC name
|
||||||
|
#else
|
||||||
|
# define AVSC_EXPORT EXTERN_C __declspec(dllexport)
|
||||||
|
# ifndef AVSC_NO_DECLSPEC
|
||||||
|
# define AVSC_API(ret, name) EXTERN_C __declspec(dllimport) ret AVSC_CC name
|
||||||
|
# else
|
||||||
|
# define AVSC_API(ret, name) typedef ret (AVSC_CC *name##_func)
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef unsigned char BYTE;
|
||||||
|
#ifdef __GNUC__
|
||||||
|
typedef long long int INT64;
|
||||||
|
#else
|
||||||
|
typedef __int64 INT64;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Constants
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef __AVISYNTH_H__
|
||||||
|
enum { AVISYNTH_INTERFACE_VERSION = 4 };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
enum {AVS_SAMPLE_INT8 = 1<<0,
|
||||||
|
AVS_SAMPLE_INT16 = 1<<1,
|
||||||
|
AVS_SAMPLE_INT24 = 1<<2,
|
||||||
|
AVS_SAMPLE_INT32 = 1<<3,
|
||||||
|
AVS_SAMPLE_FLOAT = 1<<4};
|
||||||
|
|
||||||
|
enum {AVS_PLANAR_Y=1<<0,
|
||||||
|
AVS_PLANAR_U=1<<1,
|
||||||
|
AVS_PLANAR_V=1<<2,
|
||||||
|
AVS_PLANAR_ALIGNED=1<<3,
|
||||||
|
AVS_PLANAR_Y_ALIGNED=AVS_PLANAR_Y|AVS_PLANAR_ALIGNED,
|
||||||
|
AVS_PLANAR_U_ALIGNED=AVS_PLANAR_U|AVS_PLANAR_ALIGNED,
|
||||||
|
AVS_PLANAR_V_ALIGNED=AVS_PLANAR_V|AVS_PLANAR_ALIGNED,
|
||||||
|
AVS_PLANAR_A=1<<4,
|
||||||
|
AVS_PLANAR_R=1<<5,
|
||||||
|
AVS_PLANAR_G=1<<6,
|
||||||
|
AVS_PLANAR_B=1<<7,
|
||||||
|
AVS_PLANAR_A_ALIGNED=AVS_PLANAR_A|AVS_PLANAR_ALIGNED,
|
||||||
|
AVS_PLANAR_R_ALIGNED=AVS_PLANAR_R|AVS_PLANAR_ALIGNED,
|
||||||
|
AVS_PLANAR_G_ALIGNED=AVS_PLANAR_G|AVS_PLANAR_ALIGNED,
|
||||||
|
AVS_PLANAR_B_ALIGNED=AVS_PLANAR_B|AVS_PLANAR_ALIGNED};
|
||||||
|
|
||||||
|
// Colorspace properties.
|
||||||
|
enum {AVS_CS_BGR = 1<<28,
|
||||||
|
AVS_CS_YUV = 1<<29,
|
||||||
|
AVS_CS_INTERLEAVED = 1<<30,
|
||||||
|
AVS_CS_PLANAR = 1<<31,
|
||||||
|
|
||||||
|
AVS_CS_SHIFT_SUB_WIDTH = 0,
|
||||||
|
AVS_CS_SHIFT_SUB_HEIGHT = 1 << 3,
|
||||||
|
AVS_CS_SHIFT_SAMPLE_BITS = 1 << 4,
|
||||||
|
|
||||||
|
AVS_CS_SUB_WIDTH_MASK = 7 << AVS_CS_SHIFT_SUB_WIDTH,
|
||||||
|
AVS_CS_SUB_WIDTH_1 = 3 << AVS_CS_SHIFT_SUB_WIDTH, // YV24
|
||||||
|
AVS_CS_SUB_WIDTH_2 = 0 << AVS_CS_SHIFT_SUB_WIDTH, // YV12, I420, YV16
|
||||||
|
AVS_CS_SUB_WIDTH_4 = 1 << AVS_CS_SHIFT_SUB_WIDTH, // YUV9, YV411
|
||||||
|
|
||||||
|
AVS_CS_VPLANEFIRST = 1 << 3, // YV12, YV16, YV24, YV411, YUV9
|
||||||
|
AVS_CS_UPLANEFIRST = 1 << 4, // I420
|
||||||
|
|
||||||
|
AVS_CS_SUB_HEIGHT_MASK = 7 << AVS_CS_SHIFT_SUB_HEIGHT,
|
||||||
|
AVS_CS_SUB_HEIGHT_1 = 3 << AVS_CS_SHIFT_SUB_HEIGHT, // YV16, YV24, YV411
|
||||||
|
AVS_CS_SUB_HEIGHT_2 = 0 << AVS_CS_SHIFT_SUB_HEIGHT, // YV12, I420
|
||||||
|
AVS_CS_SUB_HEIGHT_4 = 1 << AVS_CS_SHIFT_SUB_HEIGHT, // YUV9
|
||||||
|
|
||||||
|
AVS_CS_SAMPLE_BITS_MASK = 7 << AVS_CS_SHIFT_SAMPLE_BITS,
|
||||||
|
AVS_CS_SAMPLE_BITS_8 = 0 << AVS_CS_SHIFT_SAMPLE_BITS,
|
||||||
|
AVS_CS_SAMPLE_BITS_16 = 1 << AVS_CS_SHIFT_SAMPLE_BITS,
|
||||||
|
AVS_CS_SAMPLE_BITS_32 = 2 << AVS_CS_SHIFT_SAMPLE_BITS,
|
||||||
|
|
||||||
|
AVS_CS_PLANAR_MASK = AVS_CS_PLANAR | AVS_CS_INTERLEAVED | AVS_CS_YUV | AVS_CS_BGR | AVS_CS_SAMPLE_BITS_MASK | AVS_CS_SUB_HEIGHT_MASK | AVS_CS_SUB_WIDTH_MASK,
|
||||||
|
AVS_CS_PLANAR_FILTER = ~( AVS_CS_VPLANEFIRST | AVS_CS_UPLANEFIRST )};
|
||||||
|
|
||||||
|
// Specific colorformats
|
||||||
|
enum {
|
||||||
|
AVS_CS_UNKNOWN = 0,
|
||||||
|
AVS_CS_BGR24 = 1<<0 | AVS_CS_BGR | AVS_CS_INTERLEAVED,
|
||||||
|
AVS_CS_BGR32 = 1<<1 | AVS_CS_BGR | AVS_CS_INTERLEAVED,
|
||||||
|
AVS_CS_YUY2 = 1<<2 | AVS_CS_YUV | AVS_CS_INTERLEAVED,
|
||||||
|
// AVS_CS_YV12 = 1<<3 Reserved
|
||||||
|
// AVS_CS_I420 = 1<<4 Reserved
|
||||||
|
AVS_CS_RAW32 = 1<<5 | AVS_CS_INTERLEAVED,
|
||||||
|
|
||||||
|
AVS_CS_YV24 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_SAMPLE_BITS_8 | AVS_CS_VPLANEFIRST | AVS_CS_SUB_HEIGHT_1 | AVS_CS_SUB_WIDTH_1, // YVU 4:4:4 planar
|
||||||
|
AVS_CS_YV16 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_SAMPLE_BITS_8 | AVS_CS_VPLANEFIRST | AVS_CS_SUB_HEIGHT_1 | AVS_CS_SUB_WIDTH_2, // YVU 4:2:2 planar
|
||||||
|
AVS_CS_YV12 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_SAMPLE_BITS_8 | AVS_CS_VPLANEFIRST | AVS_CS_SUB_HEIGHT_2 | AVS_CS_SUB_WIDTH_2, // YVU 4:2:0 planar
|
||||||
|
AVS_CS_I420 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_SAMPLE_BITS_8 | AVS_CS_UPLANEFIRST | AVS_CS_SUB_HEIGHT_2 | AVS_CS_SUB_WIDTH_2, // YUV 4:2:0 planar
|
||||||
|
AVS_CS_IYUV = AVS_CS_I420,
|
||||||
|
AVS_CS_YV411 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_SAMPLE_BITS_8 | AVS_CS_VPLANEFIRST | AVS_CS_SUB_HEIGHT_1 | AVS_CS_SUB_WIDTH_4, // YVU 4:1:1 planar
|
||||||
|
AVS_CS_YUV9 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_SAMPLE_BITS_8 | AVS_CS_VPLANEFIRST | AVS_CS_SUB_HEIGHT_4 | AVS_CS_SUB_WIDTH_4, // YVU 4:1:0 planar
|
||||||
|
AVS_CS_Y8 = AVS_CS_PLANAR | AVS_CS_INTERLEAVED | AVS_CS_YUV | AVS_CS_SAMPLE_BITS_8 // Y 4:0:0 planar
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
AVS_IT_BFF = 1<<0,
|
||||||
|
AVS_IT_TFF = 1<<1,
|
||||||
|
AVS_IT_FIELDBASED = 1<<2};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
AVS_FILTER_TYPE=1,
|
||||||
|
AVS_FILTER_INPUT_COLORSPACE=2,
|
||||||
|
AVS_FILTER_OUTPUT_TYPE=9,
|
||||||
|
AVS_FILTER_NAME=4,
|
||||||
|
AVS_FILTER_AUTHOR=5,
|
||||||
|
AVS_FILTER_VERSION=6,
|
||||||
|
AVS_FILTER_ARGS=7,
|
||||||
|
AVS_FILTER_ARGS_INFO=8,
|
||||||
|
AVS_FILTER_ARGS_DESCRIPTION=10,
|
||||||
|
AVS_FILTER_DESCRIPTION=11};
|
||||||
|
|
||||||
|
enum { //SUBTYPES
|
||||||
|
AVS_FILTER_TYPE_AUDIO=1,
|
||||||
|
AVS_FILTER_TYPE_VIDEO=2,
|
||||||
|
AVS_FILTER_OUTPUT_TYPE_SAME=3,
|
||||||
|
AVS_FILTER_OUTPUT_TYPE_DIFFERENT=4};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
AVS_CACHE_NOTHING=0,
|
||||||
|
AVS_CACHE_RANGE=1,
|
||||||
|
AVS_CACHE_ALL=2,
|
||||||
|
AVS_CACHE_AUDIO=3,
|
||||||
|
AVS_CACHE_AUDIO_NONE=4,
|
||||||
|
AVS_CACHE_AUDIO_AUTO=5
|
||||||
|
};
|
||||||
|
|
||||||
|
#define AVS_FRAME_ALIGN 16
|
||||||
|
|
||||||
|
typedef struct AVS_Clip AVS_Clip;
|
||||||
|
typedef struct AVS_ScriptEnvironment AVS_ScriptEnvironment;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// AVS_VideoInfo
|
||||||
|
//
|
||||||
|
|
||||||
|
// AVS_VideoInfo is layed out identicly to VideoInfo
|
||||||
|
typedef struct AVS_VideoInfo {
|
||||||
|
int width, height; // width=0 means no video
|
||||||
|
unsigned fps_numerator, fps_denominator;
|
||||||
|
int num_frames;
|
||||||
|
|
||||||
|
int pixel_type;
|
||||||
|
|
||||||
|
int audio_samples_per_second; // 0 means no audio
|
||||||
|
int sample_type;
|
||||||
|
INT64 num_audio_samples;
|
||||||
|
int nchannels;
|
||||||
|
|
||||||
|
// Imagetype properties
|
||||||
|
|
||||||
|
int image_type;
|
||||||
|
} AVS_VideoInfo;
|
||||||
|
|
||||||
|
// useful functions of the above
|
||||||
|
AVSC_INLINE int avs_has_video(const AVS_VideoInfo * p)
|
||||||
|
{ return (p->width!=0); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_has_audio(const AVS_VideoInfo * p)
|
||||||
|
{ return (p->audio_samples_per_second!=0); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_rgb(const AVS_VideoInfo * p)
|
||||||
|
{ return !!(p->pixel_type&AVS_CS_BGR); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_rgb24(const AVS_VideoInfo * p)
|
||||||
|
{ return (p->pixel_type&AVS_CS_BGR24)==AVS_CS_BGR24; } // Clear out additional properties
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_rgb32(const AVS_VideoInfo * p)
|
||||||
|
{ return (p->pixel_type & AVS_CS_BGR32) == AVS_CS_BGR32 ; }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_yuv(const AVS_VideoInfo * p)
|
||||||
|
{ return !!(p->pixel_type&AVS_CS_YUV ); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_yuy2(const AVS_VideoInfo * p)
|
||||||
|
{ return (p->pixel_type & AVS_CS_YUY2) == AVS_CS_YUY2; }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_yv24(const AVS_VideoInfo * p)
|
||||||
|
{ return (p->pixel_type & AVS_CS_PLANAR_MASK) == (AVS_CS_YV24 & AVS_CS_PLANAR_FILTER); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_yv16(const AVS_VideoInfo * p)
|
||||||
|
{ return (p->pixel_type & AVS_CS_PLANAR_MASK) == (AVS_CS_YV16 & AVS_CS_PLANAR_FILTER); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_yv12(const AVS_VideoInfo * p)
|
||||||
|
{ return (p->pixel_type & AVS_CS_PLANAR_MASK) == (AVS_CS_YV12 & AVS_CS_PLANAR_FILTER); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_yv411(const AVS_VideoInfo * p)
|
||||||
|
{ return (p->pixel_type & AVS_CS_PLANAR_MASK) == (AVS_CS_YV411 & AVS_CS_PLANAR_FILTER); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_y8(const AVS_VideoInfo * p)
|
||||||
|
{ return (p->pixel_type & AVS_CS_PLANAR_MASK) == (AVS_CS_Y8 & AVS_CS_PLANAR_FILTER); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_property(const AVS_VideoInfo * p, int property)
|
||||||
|
{ return ((p->pixel_type & property)==property ); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_planar(const AVS_VideoInfo * p)
|
||||||
|
{ return !!(p->pixel_type & AVS_CS_PLANAR); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_color_space(const AVS_VideoInfo * p, int c_space)
|
||||||
|
{ return avs_is_planar(p) ? ((p->pixel_type & AVS_CS_PLANAR_MASK) == (c_space & AVS_CS_PLANAR_FILTER)) : ((p->pixel_type & c_space) == c_space); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_field_based(const AVS_VideoInfo * p)
|
||||||
|
{ return !!(p->image_type & AVS_IT_FIELDBASED); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_parity_known(const AVS_VideoInfo * p)
|
||||||
|
{ return ((p->image_type & AVS_IT_FIELDBASED)&&(p->image_type & (AVS_IT_BFF | AVS_IT_TFF))); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_bff(const AVS_VideoInfo * p)
|
||||||
|
{ return !!(p->image_type & AVS_IT_BFF); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_tff(const AVS_VideoInfo * p)
|
||||||
|
{ return !!(p->image_type & AVS_IT_TFF); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_bits_per_pixel(const AVS_VideoInfo * p)
|
||||||
|
{
|
||||||
|
switch (p->pixel_type) {
|
||||||
|
case AVS_CS_BGR24: return 24;
|
||||||
|
case AVS_CS_BGR32: return 32;
|
||||||
|
case AVS_CS_YUY2: return 16;
|
||||||
|
case AVS_CS_YV12:
|
||||||
|
case AVS_CS_I420: return 12;
|
||||||
|
default: return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AVSC_INLINE int avs_bytes_from_pixels(const AVS_VideoInfo * p, int pixels)
|
||||||
|
{ return pixels * (avs_bits_per_pixel(p)>>3); } // Will work on planar images, but will return only luma planes
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_row_size(const AVS_VideoInfo * p)
|
||||||
|
{ return avs_bytes_from_pixels(p,p->width); } // Also only returns first plane on planar images
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_bmp_size(const AVS_VideoInfo * vi)
|
||||||
|
{ if (avs_is_planar(vi)) {int p = vi->height * ((avs_row_size(vi)+3) & ~3); p+=p>>1; return p; } return vi->height * ((avs_row_size(vi)+3) & ~3); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_samples_per_second(const AVS_VideoInfo * p)
|
||||||
|
{ return p->audio_samples_per_second; }
|
||||||
|
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_bytes_per_channel_sample(const AVS_VideoInfo * p)
|
||||||
|
{
|
||||||
|
switch (p->sample_type) {
|
||||||
|
case AVS_SAMPLE_INT8: return sizeof(signed char);
|
||||||
|
case AVS_SAMPLE_INT16: return sizeof(signed short);
|
||||||
|
case AVS_SAMPLE_INT24: return 3;
|
||||||
|
case AVS_SAMPLE_INT32: return sizeof(signed int);
|
||||||
|
case AVS_SAMPLE_FLOAT: return sizeof(float);
|
||||||
|
default: return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AVSC_INLINE int avs_bytes_per_audio_sample(const AVS_VideoInfo * p)
|
||||||
|
{ return p->nchannels*avs_bytes_per_channel_sample(p);}
|
||||||
|
|
||||||
|
AVSC_INLINE INT64 avs_audio_samples_from_frames(const AVS_VideoInfo * p, INT64 frames)
|
||||||
|
{ return ((INT64)(frames) * p->audio_samples_per_second * p->fps_denominator / p->fps_numerator); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_frames_from_audio_samples(const AVS_VideoInfo * p, INT64 samples)
|
||||||
|
{ return (int)(samples * (INT64)p->fps_numerator / (INT64)p->fps_denominator / (INT64)p->audio_samples_per_second); }
|
||||||
|
|
||||||
|
AVSC_INLINE INT64 avs_audio_samples_from_bytes(const AVS_VideoInfo * p, INT64 bytes)
|
||||||
|
{ return bytes / avs_bytes_per_audio_sample(p); }
|
||||||
|
|
||||||
|
AVSC_INLINE INT64 avs_bytes_from_audio_samples(const AVS_VideoInfo * p, INT64 samples)
|
||||||
|
{ return samples * avs_bytes_per_audio_sample(p); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_audio_channels(const AVS_VideoInfo * p)
|
||||||
|
{ return p->nchannels; }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_sample_type(const AVS_VideoInfo * p)
|
||||||
|
{ return p->sample_type;}
|
||||||
|
|
||||||
|
// useful mutator
|
||||||
|
AVSC_INLINE void avs_set_property(AVS_VideoInfo * p, int property)
|
||||||
|
{ p->image_type|=property; }
|
||||||
|
|
||||||
|
AVSC_INLINE void avs_clear_property(AVS_VideoInfo * p, int property)
|
||||||
|
{ p->image_type&=~property; }
|
||||||
|
|
||||||
|
AVSC_INLINE void avs_set_field_based(AVS_VideoInfo * p, int isfieldbased)
|
||||||
|
{ if (isfieldbased) p->image_type|=AVS_IT_FIELDBASED; else p->image_type&=~AVS_IT_FIELDBASED; }
|
||||||
|
|
||||||
|
AVSC_INLINE void avs_set_fps(AVS_VideoInfo * p, unsigned numerator, unsigned denominator)
|
||||||
|
{
|
||||||
|
unsigned x=numerator, y=denominator;
|
||||||
|
while (y) { // find gcd
|
||||||
|
unsigned t = x%y; x = y; y = t;
|
||||||
|
}
|
||||||
|
p->fps_numerator = numerator/x;
|
||||||
|
p->fps_denominator = denominator/x;
|
||||||
|
}
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_same_colorspace(AVS_VideoInfo * x, AVS_VideoInfo * y)
|
||||||
|
{
|
||||||
|
return (x->pixel_type == y->pixel_type)
|
||||||
|
|| (avs_is_yv12(x) && avs_is_yv12(y));
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// AVS_VideoFrame
|
||||||
|
//
|
||||||
|
|
||||||
|
// VideoFrameBuffer holds information about a memory block which is used
|
||||||
|
// for video data. For efficiency, instances of this class are not deleted
|
||||||
|
// when the refcount reaches zero; instead they're stored in a linked list
|
||||||
|
// to be reused. The instances are deleted when the corresponding AVS
|
||||||
|
// file is closed.
|
||||||
|
|
||||||
|
// AVS_VideoFrameBuffer is layed out identicly to VideoFrameBuffer
|
||||||
|
// DO NOT USE THIS STRUCTURE DIRECTLY
|
||||||
|
typedef struct AVS_VideoFrameBuffer {
|
||||||
|
BYTE * data;
|
||||||
|
int data_size;
|
||||||
|
// sequence_number is incremented every time the buffer is changed, so
|
||||||
|
// that stale views can tell they're no longer valid.
|
||||||
|
volatile long sequence_number;
|
||||||
|
|
||||||
|
volatile long refcount;
|
||||||
|
} AVS_VideoFrameBuffer;
|
||||||
|
|
||||||
|
// VideoFrame holds a "window" into a VideoFrameBuffer.
|
||||||
|
|
||||||
|
// AVS_VideoFrame is layed out identicly to IVideoFrame
|
||||||
|
// DO NOT USE THIS STRUCTURE DIRECTLY
|
||||||
|
typedef struct AVS_VideoFrame {
|
||||||
|
volatile long refcount;
|
||||||
|
AVS_VideoFrameBuffer * vfb;
|
||||||
|
int offset, pitch, row_size, height, offsetU, offsetV, pitchUV; // U&V offsets are from top of picture.
|
||||||
|
int row_sizeUV, heightUV;
|
||||||
|
} AVS_VideoFrame;
|
||||||
|
|
||||||
|
// Access functions for AVS_VideoFrame
|
||||||
|
AVSC_INLINE int avs_get_pitch(const AVS_VideoFrame * p) {
|
||||||
|
return p->pitch;}
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_get_pitch_p(const AVS_VideoFrame * p, int plane) {
|
||||||
|
switch (plane) {
|
||||||
|
case AVS_PLANAR_U: case AVS_PLANAR_V: return p->pitchUV;}
|
||||||
|
return p->pitch;}
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_get_row_size(const AVS_VideoFrame * p) {
|
||||||
|
return p->row_size; }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_get_row_size_p(const AVS_VideoFrame * p, int plane) {
|
||||||
|
int r;
|
||||||
|
switch (plane) {
|
||||||
|
case AVS_PLANAR_U: case AVS_PLANAR_V:
|
||||||
|
if (p->pitchUV) return p->row_sizeUV;
|
||||||
|
else return 0;
|
||||||
|
case AVS_PLANAR_U_ALIGNED: case AVS_PLANAR_V_ALIGNED:
|
||||||
|
if (p->pitchUV) {
|
||||||
|
r = (p->row_sizeUV+AVS_FRAME_ALIGN-1)&(~(AVS_FRAME_ALIGN-1)); // Aligned rowsize
|
||||||
|
if (r < p->pitchUV)
|
||||||
|
return r;
|
||||||
|
return p->row_sizeUV;
|
||||||
|
} else return 0;
|
||||||
|
case AVS_PLANAR_Y_ALIGNED:
|
||||||
|
r = (p->row_size+AVS_FRAME_ALIGN-1)&(~(AVS_FRAME_ALIGN-1)); // Aligned rowsize
|
||||||
|
if (r <= p->pitch)
|
||||||
|
return r;
|
||||||
|
return p->row_size;
|
||||||
|
}
|
||||||
|
return p->row_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_get_height(const AVS_VideoFrame * p) {
|
||||||
|
return p->height;}
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_get_height_p(const AVS_VideoFrame * p, int plane) {
|
||||||
|
switch (plane) {
|
||||||
|
case AVS_PLANAR_U: case AVS_PLANAR_V:
|
||||||
|
if (p->pitchUV) return p->heightUV;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return p->height;}
|
||||||
|
|
||||||
|
AVSC_INLINE const BYTE* avs_get_read_ptr(const AVS_VideoFrame * p) {
|
||||||
|
return p->vfb->data + p->offset;}
|
||||||
|
|
||||||
|
AVSC_INLINE const BYTE* avs_get_read_ptr_p(const AVS_VideoFrame * p, int plane)
|
||||||
|
{
|
||||||
|
switch (plane) {
|
||||||
|
case AVS_PLANAR_U: return p->vfb->data + p->offsetU;
|
||||||
|
case AVS_PLANAR_V: return p->vfb->data + p->offsetV;
|
||||||
|
default: return p->vfb->data + p->offset;}
|
||||||
|
}
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_writable(const AVS_VideoFrame * p) {
|
||||||
|
return (p->refcount == 1 && p->vfb->refcount == 1);}
|
||||||
|
|
||||||
|
AVSC_INLINE BYTE* avs_get_write_ptr(const AVS_VideoFrame * p)
|
||||||
|
{
|
||||||
|
if (avs_is_writable(p)) {
|
||||||
|
++p->vfb->sequence_number;
|
||||||
|
return p->vfb->data + p->offset;
|
||||||
|
} else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
AVSC_INLINE BYTE* avs_get_write_ptr_p(const AVS_VideoFrame * p, int plane)
|
||||||
|
{
|
||||||
|
if (plane==AVS_PLANAR_Y && avs_is_writable(p)) {
|
||||||
|
++p->vfb->sequence_number;
|
||||||
|
return p->vfb->data + p->offset;
|
||||||
|
} else if (plane==AVS_PLANAR_Y) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
switch (plane) {
|
||||||
|
case AVS_PLANAR_U: return p->vfb->data + p->offsetU;
|
||||||
|
case AVS_PLANAR_V: return p->vfb->data + p->offsetV;
|
||||||
|
default: return p->vfb->data + p->offset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
AVSC_API(void, avs_release_video_frame)(AVS_VideoFrame *);
|
||||||
|
// makes a shallow copy of a video frame
|
||||||
|
AVSC_API(AVS_VideoFrame *, avs_copy_video_frame)(AVS_VideoFrame *);
|
||||||
|
|
||||||
|
#ifndef AVSC_NO_DECLSPEC
|
||||||
|
AVSC_INLINE void avs_release_frame(AVS_VideoFrame * f)
|
||||||
|
{avs_release_video_frame(f);}
|
||||||
|
AVSC_INLINE AVS_VideoFrame * avs_copy_frame(AVS_VideoFrame * f)
|
||||||
|
{return avs_copy_video_frame(f);}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// AVS_Value
|
||||||
|
//
|
||||||
|
|
||||||
|
// Treat AVS_Value as a fat pointer. That is use avs_copy_value
|
||||||
|
// and avs_release_value appropiaty as you would if AVS_Value was
|
||||||
|
// a pointer.
|
||||||
|
|
||||||
|
// To maintain source code compatibility with future versions of the
|
||||||
|
// avisynth_c API don't use the AVS_Value directly. Use the helper
|
||||||
|
// functions below.
|
||||||
|
|
||||||
|
// AVS_Value is layed out identicly to AVSValue
|
||||||
|
typedef struct AVS_Value AVS_Value;
|
||||||
|
struct AVS_Value {
|
||||||
|
short type; // 'a'rray, 'c'lip, 'b'ool, 'i'nt, 'f'loat, 's'tring, 'v'oid, or 'l'ong
|
||||||
|
// for some function e'rror
|
||||||
|
short array_size;
|
||||||
|
union {
|
||||||
|
void * clip; // do not use directly, use avs_take_clip
|
||||||
|
char boolean;
|
||||||
|
int integer;
|
||||||
|
float floating_pt;
|
||||||
|
const char * string;
|
||||||
|
const AVS_Value * array;
|
||||||
|
} d;
|
||||||
|
};
|
||||||
|
|
||||||
|
// AVS_Value should be initilized with avs_void.
|
||||||
|
// Should also set to avs_void after the value is released
|
||||||
|
// with avs_copy_value. Consider it the equalvent of setting
|
||||||
|
// a pointer to NULL
|
||||||
|
static const AVS_Value avs_void = {'v'};
|
||||||
|
|
||||||
|
AVSC_API(void, avs_copy_value)(AVS_Value * dest, AVS_Value src);
|
||||||
|
AVSC_API(void, avs_release_value)(AVS_Value);
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_defined(AVS_Value v) { return v.type != 'v'; }
|
||||||
|
AVSC_INLINE int avs_is_clip(AVS_Value v) { return v.type == 'c'; }
|
||||||
|
AVSC_INLINE int avs_is_bool(AVS_Value v) { return v.type == 'b'; }
|
||||||
|
AVSC_INLINE int avs_is_int(AVS_Value v) { return v.type == 'i'; }
|
||||||
|
AVSC_INLINE int avs_is_float(AVS_Value v) { return v.type == 'f' || v.type == 'i'; }
|
||||||
|
AVSC_INLINE int avs_is_string(AVS_Value v) { return v.type == 's'; }
|
||||||
|
AVSC_INLINE int avs_is_array(AVS_Value v) { return v.type == 'a'; }
|
||||||
|
AVSC_INLINE int avs_is_error(AVS_Value v) { return v.type == 'e'; }
|
||||||
|
|
||||||
|
AVSC_API(AVS_Clip *, avs_take_clip)(AVS_Value, AVS_ScriptEnvironment *);
|
||||||
|
AVSC_API(void, avs_set_to_clip)(AVS_Value *, AVS_Clip *);
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_as_bool(AVS_Value v)
|
||||||
|
{ return v.d.boolean; }
|
||||||
|
AVSC_INLINE int avs_as_int(AVS_Value v)
|
||||||
|
{ return v.d.integer; }
|
||||||
|
AVSC_INLINE const char * avs_as_string(AVS_Value v)
|
||||||
|
{ return avs_is_error(v) || avs_is_string(v) ? v.d.string : 0; }
|
||||||
|
AVSC_INLINE double avs_as_float(AVS_Value v)
|
||||||
|
{ return avs_is_int(v) ? v.d.integer : v.d.floating_pt; }
|
||||||
|
AVSC_INLINE const char * avs_as_error(AVS_Value v)
|
||||||
|
{ return avs_is_error(v) ? v.d.string : 0; }
|
||||||
|
AVSC_INLINE const AVS_Value * avs_as_array(AVS_Value v)
|
||||||
|
{ return v.d.array; }
|
||||||
|
AVSC_INLINE int avs_array_size(AVS_Value v)
|
||||||
|
{ return avs_is_array(v) ? v.array_size : 1; }
|
||||||
|
AVSC_INLINE AVS_Value avs_array_elt(AVS_Value v, int index)
|
||||||
|
{ return avs_is_array(v) ? v.d.array[index] : v; }
|
||||||
|
|
||||||
|
// only use these functions on an AVS_Value that does not already have
|
||||||
|
// an active value. Remember, treat AVS_Value as a fat pointer.
|
||||||
|
AVSC_INLINE AVS_Value avs_new_value_bool(int v0)
|
||||||
|
{ AVS_Value v; v.type = 'b'; v.d.boolean = v0 == 0 ? 0 : 1; return v; }
|
||||||
|
AVSC_INLINE AVS_Value avs_new_value_int(int v0)
|
||||||
|
{ AVS_Value v; v.type = 'i'; v.d.integer = v0; return v; }
|
||||||
|
AVSC_INLINE AVS_Value avs_new_value_string(const char * v0)
|
||||||
|
{ AVS_Value v; v.type = 's'; v.d.string = v0; return v; }
|
||||||
|
AVSC_INLINE AVS_Value avs_new_value_float(float v0)
|
||||||
|
{ AVS_Value v; v.type = 'f'; v.d.floating_pt = v0; return v;}
|
||||||
|
AVSC_INLINE AVS_Value avs_new_value_error(const char * v0)
|
||||||
|
{ AVS_Value v; v.type = 'e'; v.d.string = v0; return v; }
|
||||||
|
#ifndef AVSC_NO_DECLSPEC
|
||||||
|
AVSC_INLINE AVS_Value avs_new_value_clip(AVS_Clip * v0)
|
||||||
|
{ AVS_Value v; avs_set_to_clip(&v, v0); return v; }
|
||||||
|
#endif
|
||||||
|
AVSC_INLINE AVS_Value avs_new_value_array(AVS_Value * v0, int size)
|
||||||
|
{ AVS_Value v; v.type = 'a'; v.d.array = v0; v.array_size = size; return v; }
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// AVS_Clip
|
||||||
|
//
|
||||||
|
|
||||||
|
AVSC_API(void, avs_release_clip)(AVS_Clip *);
|
||||||
|
AVSC_API(AVS_Clip *, avs_copy_clip)(AVS_Clip *);
|
||||||
|
|
||||||
|
AVSC_API(const char *, avs_clip_get_error)(AVS_Clip *); // return 0 if no error
|
||||||
|
|
||||||
|
AVSC_API(const AVS_VideoInfo *, avs_get_video_info)(AVS_Clip *);
|
||||||
|
|
||||||
|
AVSC_API(int, avs_get_version)(AVS_Clip *);
|
||||||
|
|
||||||
|
AVSC_API(AVS_VideoFrame *, avs_get_frame)(AVS_Clip *, int n);
|
||||||
|
// The returned video frame must be released with avs_release_video_frame
|
||||||
|
|
||||||
|
AVSC_API(int, avs_get_parity)(AVS_Clip *, int n);
|
||||||
|
// return field parity if field_based, else parity of first field in frame
|
||||||
|
|
||||||
|
AVSC_API(int, avs_get_audio)(AVS_Clip *, void * buf,
|
||||||
|
INT64 start, INT64 count);
|
||||||
|
// start and count are in samples
|
||||||
|
|
||||||
|
AVSC_API(int, avs_set_cache_hints)(AVS_Clip *,
|
||||||
|
int cachehints, int frame_range);
|
||||||
|
|
||||||
|
// This is the callback type used by avs_add_function
|
||||||
|
typedef AVS_Value (AVSC_CC * AVS_ApplyFunc)
|
||||||
|
(AVS_ScriptEnvironment *, AVS_Value args, void * user_data);
|
||||||
|
|
||||||
|
typedef struct AVS_FilterInfo AVS_FilterInfo;
|
||||||
|
struct AVS_FilterInfo
|
||||||
|
{
|
||||||
|
// these members should not be modified outside of the AVS_ApplyFunc callback
|
||||||
|
AVS_Clip * child;
|
||||||
|
AVS_VideoInfo vi;
|
||||||
|
AVS_ScriptEnvironment * env;
|
||||||
|
AVS_VideoFrame * (AVSC_CC * get_frame)(AVS_FilterInfo *, int n);
|
||||||
|
int (AVSC_CC * get_parity)(AVS_FilterInfo *, int n);
|
||||||
|
int (AVSC_CC * get_audio)(AVS_FilterInfo *, void * buf,
|
||||||
|
INT64 start, INT64 count);
|
||||||
|
int (AVSC_CC * set_cache_hints)(AVS_FilterInfo *, int cachehints,
|
||||||
|
int frame_range);
|
||||||
|
void (AVSC_CC * free_filter)(AVS_FilterInfo *);
|
||||||
|
|
||||||
|
// Should be set when ever there is an error to report.
|
||||||
|
// It is cleared before any of the above methods are called
|
||||||
|
const char * error;
|
||||||
|
// this is to store whatever and may be modified at will
|
||||||
|
void * user_data;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Create a new filter
|
||||||
|
// fi is set to point to the AVS_FilterInfo so that you can
|
||||||
|
// modify it once it is initilized.
|
||||||
|
// store_child should generally be set to true. If it is not
|
||||||
|
// set than ALL methods (the function pointers) must be defined
|
||||||
|
// If it is set than you do not need to worry about freeing the child
|
||||||
|
// clip.
|
||||||
|
AVSC_API(AVS_Clip *, avs_new_c_filter)(AVS_ScriptEnvironment * e,
|
||||||
|
AVS_FilterInfo * * fi,
|
||||||
|
AVS_Value child, int store_child);
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// AVS_ScriptEnvironment
|
||||||
|
//
|
||||||
|
|
||||||
|
// For GetCPUFlags. These are backwards-compatible with those in VirtualDub.
|
||||||
|
enum {
|
||||||
|
/* slowest CPU to support extension */
|
||||||
|
AVS_CPU_FORCE = 0x01, // N/A
|
||||||
|
AVS_CPU_FPU = 0x02, // 386/486DX
|
||||||
|
AVS_CPU_MMX = 0x04, // P55C, K6, PII
|
||||||
|
AVS_CPU_INTEGER_SSE = 0x08, // PIII, Athlon
|
||||||
|
AVS_CPU_SSE = 0x10, // PIII, Athlon XP/MP
|
||||||
|
AVS_CPU_SSE2 = 0x20, // PIV, Hammer
|
||||||
|
AVS_CPU_3DNOW = 0x40, // K6-2
|
||||||
|
AVS_CPU_3DNOW_EXT = 0x80, // Athlon
|
||||||
|
AVS_CPU_X86_64 = 0xA0, // Hammer (note: equiv. to 3DNow + SSE2,
|
||||||
|
// which only Hammer will have anyway)
|
||||||
|
AVS_CPUF_SSE3 = 0x100, // PIV+, K8 Venice
|
||||||
|
AVS_CPUF_SSSE3 = 0x200, // Core 2
|
||||||
|
AVS_CPUF_SSE4 = 0x400, // Penryn, Wolfdale, Yorkfield
|
||||||
|
AVS_CPUF_SSE4_1 = 0x400,
|
||||||
|
AVS_CPUF_SSE4_2 = 0x800, // Nehalem
|
||||||
|
};
|
||||||
|
|
||||||
|
AVSC_API(const char *, avs_get_error)(AVS_ScriptEnvironment *); // return 0 if no error
|
||||||
|
|
||||||
|
AVSC_API(long, avs_get_cpu_flags)(AVS_ScriptEnvironment *);
|
||||||
|
AVSC_API(int, avs_check_version)(AVS_ScriptEnvironment *, int version);
|
||||||
|
|
||||||
|
AVSC_API(char *, avs_save_string)(AVS_ScriptEnvironment *, const char* s, int length);
|
||||||
|
AVSC_API(char *, avs_sprintf)(AVS_ScriptEnvironment *, const char * fmt, ...);
|
||||||
|
|
||||||
|
AVSC_API(char *, avs_vsprintf)(AVS_ScriptEnvironment *, const char * fmt, void* val);
|
||||||
|
// note: val is really a va_list; I hope everyone typedefs va_list to a pointer
|
||||||
|
|
||||||
|
AVSC_API(int, avs_add_function)(AVS_ScriptEnvironment *,
|
||||||
|
const char * name, const char * params,
|
||||||
|
AVS_ApplyFunc apply, void * user_data);
|
||||||
|
|
||||||
|
AVSC_API(int, avs_function_exists)(AVS_ScriptEnvironment *, const char * name);
|
||||||
|
|
||||||
|
AVSC_API(AVS_Value, avs_invoke)(AVS_ScriptEnvironment *, const char * name,
|
||||||
|
AVS_Value args, const char** arg_names);
|
||||||
|
// The returned value must be be released with avs_release_value
|
||||||
|
|
||||||
|
AVSC_API(AVS_Value, avs_get_var)(AVS_ScriptEnvironment *, const char* name);
|
||||||
|
// The returned value must be be released with avs_release_value
|
||||||
|
|
||||||
|
AVSC_API(int, avs_set_var)(AVS_ScriptEnvironment *, const char* name, AVS_Value val);
|
||||||
|
|
||||||
|
AVSC_API(int, avs_set_global_var)(AVS_ScriptEnvironment *, const char* name, const AVS_Value val);
|
||||||
|
|
||||||
|
//void avs_push_context(AVS_ScriptEnvironment *, int level=0);
|
||||||
|
//void avs_pop_context(AVS_ScriptEnvironment *);
|
||||||
|
|
||||||
|
AVSC_API(AVS_VideoFrame *, avs_new_video_frame_a)(AVS_ScriptEnvironment *,
|
||||||
|
const AVS_VideoInfo * vi, int align);
|
||||||
|
// align should be at least 16
|
||||||
|
|
||||||
|
#ifndef AVSC_NO_DECLSPEC
|
||||||
|
AVSC_INLINE
|
||||||
|
AVS_VideoFrame * avs_new_video_frame(AVS_ScriptEnvironment * env,
|
||||||
|
const AVS_VideoInfo * vi)
|
||||||
|
{return avs_new_video_frame_a(env,vi,AVS_FRAME_ALIGN);}
|
||||||
|
|
||||||
|
AVSC_INLINE
|
||||||
|
AVS_VideoFrame * avs_new_frame(AVS_ScriptEnvironment * env,
|
||||||
|
const AVS_VideoInfo * vi)
|
||||||
|
{return avs_new_video_frame_a(env,vi,AVS_FRAME_ALIGN);}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
AVSC_API(int, avs_make_writable)(AVS_ScriptEnvironment *, AVS_VideoFrame * * pvf);
|
||||||
|
|
||||||
|
AVSC_API(void, avs_bit_blt)(AVS_ScriptEnvironment *, BYTE* dstp, int dst_pitch, const BYTE* srcp, int src_pitch, int row_size, int height);
|
||||||
|
|
||||||
|
typedef void (AVSC_CC *AVS_ShutdownFunc)(void* user_data, AVS_ScriptEnvironment * env);
|
||||||
|
AVSC_API(void, avs_at_exit)(AVS_ScriptEnvironment *, AVS_ShutdownFunc function, void * user_data);
|
||||||
|
|
||||||
|
AVSC_API(AVS_VideoFrame *, avs_subframe)(AVS_ScriptEnvironment *, AVS_VideoFrame * src, int rel_offset, int new_pitch, int new_row_size, int new_height);
|
||||||
|
// The returned video frame must be be released
|
||||||
|
|
||||||
|
AVSC_API(int, avs_set_memory_max)(AVS_ScriptEnvironment *, int mem);
|
||||||
|
|
||||||
|
AVSC_API(int, avs_set_working_dir)(AVS_ScriptEnvironment *, const char * newdir);
|
||||||
|
|
||||||
|
// avisynth.dll exports this; it's a way to use it as a library, without
|
||||||
|
// writing an AVS script or without going through AVIFile.
|
||||||
|
AVSC_API(AVS_ScriptEnvironment *, avs_create_script_environment)(int version);
|
||||||
|
|
||||||
|
// this symbol is the entry point for the plugin and must
|
||||||
|
// be defined
|
||||||
|
AVSC_EXPORT
|
||||||
|
const char * AVSC_CC avisynth_c_plugin_init(AVS_ScriptEnvironment* env);
|
||||||
|
|
||||||
|
|
||||||
|
AVSC_API(void, avs_delete_script_environment)(AVS_ScriptEnvironment *);
|
||||||
|
|
||||||
|
|
||||||
|
AVSC_API(AVS_VideoFrame *, avs_subframe_planar)(AVS_ScriptEnvironment *, AVS_VideoFrame * src, int rel_offset, int new_pitch, int new_row_size, int new_height, int rel_offsetU, int rel_offsetV, int new_pitchUV);
|
||||||
|
// The returned video frame must be be released
|
||||||
|
|
||||||
|
#ifdef AVSC_NO_DECLSPEC
|
||||||
|
// use LoadLibrary and related functions to dynamically load Avisynth instead of declspec(dllimport)
|
||||||
|
/*
|
||||||
|
The following functions needs to have been declared, probably from windows.h
|
||||||
|
|
||||||
|
void* malloc(size_t)
|
||||||
|
void free(void*);
|
||||||
|
|
||||||
|
HMODULE LoadLibrary(const char*);
|
||||||
|
void* GetProcAddress(HMODULE, const char*);
|
||||||
|
FreeLibrary(HMODULE);
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct AVS_Library AVS_Library;
|
||||||
|
|
||||||
|
#define AVSC_DECLARE_FUNC(name) name##_func name
|
||||||
|
|
||||||
|
struct AVS_Library {
|
||||||
|
HMODULE handle;
|
||||||
|
|
||||||
|
AVSC_DECLARE_FUNC(avs_add_function);
|
||||||
|
AVSC_DECLARE_FUNC(avs_at_exit);
|
||||||
|
AVSC_DECLARE_FUNC(avs_bit_blt);
|
||||||
|
AVSC_DECLARE_FUNC(avs_check_version);
|
||||||
|
AVSC_DECLARE_FUNC(avs_clip_get_error);
|
||||||
|
AVSC_DECLARE_FUNC(avs_copy_clip);
|
||||||
|
AVSC_DECLARE_FUNC(avs_copy_value);
|
||||||
|
AVSC_DECLARE_FUNC(avs_copy_video_frame);
|
||||||
|
AVSC_DECLARE_FUNC(avs_create_script_environment);
|
||||||
|
AVSC_DECLARE_FUNC(avs_delete_script_environment);
|
||||||
|
AVSC_DECLARE_FUNC(avs_function_exists);
|
||||||
|
AVSC_DECLARE_FUNC(avs_get_audio);
|
||||||
|
AVSC_DECLARE_FUNC(avs_get_cpu_flags);
|
||||||
|
AVSC_DECLARE_FUNC(avs_get_error);
|
||||||
|
AVSC_DECLARE_FUNC(avs_get_frame);
|
||||||
|
AVSC_DECLARE_FUNC(avs_get_parity);
|
||||||
|
AVSC_DECLARE_FUNC(avs_get_var);
|
||||||
|
AVSC_DECLARE_FUNC(avs_get_version);
|
||||||
|
AVSC_DECLARE_FUNC(avs_get_video_info);
|
||||||
|
AVSC_DECLARE_FUNC(avs_invoke);
|
||||||
|
AVSC_DECLARE_FUNC(avs_make_writable);
|
||||||
|
AVSC_DECLARE_FUNC(avs_new_c_filter);
|
||||||
|
AVSC_DECLARE_FUNC(avs_new_video_frame_a);
|
||||||
|
AVSC_DECLARE_FUNC(avs_release_clip);
|
||||||
|
AVSC_DECLARE_FUNC(avs_release_value);
|
||||||
|
AVSC_DECLARE_FUNC(avs_release_video_frame);
|
||||||
|
AVSC_DECLARE_FUNC(avs_save_string);
|
||||||
|
AVSC_DECLARE_FUNC(avs_set_cache_hints);
|
||||||
|
AVSC_DECLARE_FUNC(avs_set_global_var);
|
||||||
|
AVSC_DECLARE_FUNC(avs_set_memory_max);
|
||||||
|
AVSC_DECLARE_FUNC(avs_set_to_clip);
|
||||||
|
AVSC_DECLARE_FUNC(avs_set_var);
|
||||||
|
AVSC_DECLARE_FUNC(avs_set_working_dir);
|
||||||
|
AVSC_DECLARE_FUNC(avs_sprintf);
|
||||||
|
AVSC_DECLARE_FUNC(avs_subframe);
|
||||||
|
AVSC_DECLARE_FUNC(avs_subframe_planar);
|
||||||
|
AVSC_DECLARE_FUNC(avs_take_clip);
|
||||||
|
AVSC_DECLARE_FUNC(avs_vsprintf);
|
||||||
|
};
|
||||||
|
|
||||||
|
#undef AVSC_DECLARE_FUNC
|
||||||
|
|
||||||
|
|
||||||
|
AVSC_INLINE AVS_Library * avs_load_library() {
|
||||||
|
AVS_Library *library = (AVS_Library *)malloc(sizeof(AVS_Library));
|
||||||
|
if (library == NULL)
|
||||||
|
return NULL;
|
||||||
|
library->handle = LoadLibrary("avisynth");
|
||||||
|
if (library->handle == NULL)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
#define __AVSC_STRINGIFY(x) #x
|
||||||
|
#define AVSC_STRINGIFY(x) __AVSC_STRINGIFY(x)
|
||||||
|
#define AVSC_LOAD_FUNC(name) {\
|
||||||
|
library->name = (name##_func) GetProcAddress(library->handle, AVSC_STRINGIFY(name));\
|
||||||
|
if (library->name == NULL)\
|
||||||
|
goto fail;\
|
||||||
|
}
|
||||||
|
|
||||||
|
AVSC_LOAD_FUNC(avs_add_function);
|
||||||
|
AVSC_LOAD_FUNC(avs_at_exit);
|
||||||
|
AVSC_LOAD_FUNC(avs_bit_blt);
|
||||||
|
AVSC_LOAD_FUNC(avs_check_version);
|
||||||
|
AVSC_LOAD_FUNC(avs_clip_get_error);
|
||||||
|
AVSC_LOAD_FUNC(avs_copy_clip);
|
||||||
|
AVSC_LOAD_FUNC(avs_copy_value);
|
||||||
|
AVSC_LOAD_FUNC(avs_copy_video_frame);
|
||||||
|
AVSC_LOAD_FUNC(avs_create_script_environment);
|
||||||
|
AVSC_LOAD_FUNC(avs_delete_script_environment);
|
||||||
|
AVSC_LOAD_FUNC(avs_function_exists);
|
||||||
|
AVSC_LOAD_FUNC(avs_get_audio);
|
||||||
|
AVSC_LOAD_FUNC(avs_get_cpu_flags);
|
||||||
|
AVSC_LOAD_FUNC(avs_get_error);
|
||||||
|
AVSC_LOAD_FUNC(avs_get_frame);
|
||||||
|
AVSC_LOAD_FUNC(avs_get_parity);
|
||||||
|
AVSC_LOAD_FUNC(avs_get_var);
|
||||||
|
AVSC_LOAD_FUNC(avs_get_version);
|
||||||
|
AVSC_LOAD_FUNC(avs_get_video_info);
|
||||||
|
AVSC_LOAD_FUNC(avs_invoke);
|
||||||
|
AVSC_LOAD_FUNC(avs_make_writable);
|
||||||
|
AVSC_LOAD_FUNC(avs_new_c_filter);
|
||||||
|
AVSC_LOAD_FUNC(avs_new_video_frame_a);
|
||||||
|
AVSC_LOAD_FUNC(avs_release_clip);
|
||||||
|
AVSC_LOAD_FUNC(avs_release_value);
|
||||||
|
AVSC_LOAD_FUNC(avs_release_video_frame);
|
||||||
|
AVSC_LOAD_FUNC(avs_save_string);
|
||||||
|
AVSC_LOAD_FUNC(avs_set_cache_hints);
|
||||||
|
AVSC_LOAD_FUNC(avs_set_global_var);
|
||||||
|
AVSC_LOAD_FUNC(avs_set_memory_max);
|
||||||
|
AVSC_LOAD_FUNC(avs_set_to_clip);
|
||||||
|
AVSC_LOAD_FUNC(avs_set_var);
|
||||||
|
AVSC_LOAD_FUNC(avs_set_working_dir);
|
||||||
|
AVSC_LOAD_FUNC(avs_sprintf);
|
||||||
|
AVSC_LOAD_FUNC(avs_subframe);
|
||||||
|
AVSC_LOAD_FUNC(avs_subframe_planar);
|
||||||
|
AVSC_LOAD_FUNC(avs_take_clip);
|
||||||
|
AVSC_LOAD_FUNC(avs_vsprintf);
|
||||||
|
|
||||||
|
#undef __AVSC_STRINGIFY
|
||||||
|
#undef AVSC_STRINGIFY
|
||||||
|
#undef AVSC_LOAD_FUNC
|
||||||
|
|
||||||
|
return library;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
free(library);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
AVSC_INLINE void avs_free_library(AVS_Library *library) {
|
||||||
|
if (library == NULL)
|
||||||
|
return;
|
||||||
|
FreeLibrary(library->handle);
|
||||||
|
free(library);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
68
compat/avisynth/avisynth_c_25.h
Normal file
68
compat/avisynth/avisynth_c_25.h
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
// Copyright (c) 2011 FFmpegSource Project
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
/* these are defines/functions that are used and were changed in the switch to 2.6
|
||||||
|
* and are needed to maintain full compatility with 2.5 */
|
||||||
|
|
||||||
|
enum {
|
||||||
|
AVS_CS_YV12_25 = 1<<3 | AVS_CS_YUV | AVS_CS_PLANAR, // y-v-u, planar
|
||||||
|
AVS_CS_I420_25 = 1<<4 | AVS_CS_YUV | AVS_CS_PLANAR, // y-u-v, planar
|
||||||
|
};
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_get_height_p_25(const AVS_VideoFrame * p, int plane) {
|
||||||
|
switch (plane)
|
||||||
|
{
|
||||||
|
case AVS_PLANAR_U: case AVS_PLANAR_V:
|
||||||
|
if (p->pitchUV)
|
||||||
|
return p->height>>1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return p->height;}
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_get_row_size_p_25(const AVS_VideoFrame * p, int plane) {
|
||||||
|
int r;
|
||||||
|
switch (plane)
|
||||||
|
{
|
||||||
|
case AVS_PLANAR_U: case AVS_PLANAR_V:
|
||||||
|
if (p->pitchUV)
|
||||||
|
return p->row_size>>1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
case AVS_PLANAR_U_ALIGNED: case AVS_PLANAR_V_ALIGNED:
|
||||||
|
if (p->pitchUV)
|
||||||
|
{
|
||||||
|
r = ((p->row_size+AVS_FRAME_ALIGN-1)&(~(AVS_FRAME_ALIGN-1)) )>>1; // Aligned rowsize
|
||||||
|
if (r < p->pitchUV)
|
||||||
|
return r;
|
||||||
|
return p->row_size>>1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
case AVS_PLANAR_Y_ALIGNED:
|
||||||
|
r = (p->row_size+AVS_FRAME_ALIGN-1)&(~(AVS_FRAME_ALIGN-1)); // Aligned rowsize
|
||||||
|
if (r <= p->pitch)
|
||||||
|
return r;
|
||||||
|
return p->row_size;
|
||||||
|
}
|
||||||
|
return p->row_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_yv12_25(const AVS_VideoInfo * p)
|
||||||
|
{ return ((p->pixel_type & AVS_CS_YV12_25) == AVS_CS_YV12_25)||((p->pixel_type & AVS_CS_I420_25) == AVS_CS_I420_25); }
|
||||||
728
compat/avisynth/avxsynth_c.h
Normal file
728
compat/avisynth/avxsynth_c.h
Normal file
@@ -0,0 +1,728 @@
|
|||||||
|
// Avisynth C Interface Version 0.20
|
||||||
|
// Copyright 2003 Kevin Atkinson
|
||||||
|
|
||||||
|
// This program is free software; you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation; either version 2 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
// MA 02110-1301 USA, or visit
|
||||||
|
// http://www.gnu.org/copyleft/gpl.html .
|
||||||
|
//
|
||||||
|
// As a special exception, I give you permission to link to the
|
||||||
|
// Avisynth C interface with independent modules that communicate with
|
||||||
|
// the Avisynth C interface solely through the interfaces defined in
|
||||||
|
// avisynth_c.h, regardless of the license terms of these independent
|
||||||
|
// modules, and to copy and distribute the resulting combined work
|
||||||
|
// under terms of your choice, provided that every copy of the
|
||||||
|
// combined work is accompanied by a complete copy of the source code
|
||||||
|
// of the Avisynth C interface and Avisynth itself (with the version
|
||||||
|
// used to produce the combined work), being distributed under the
|
||||||
|
// terms of the GNU General Public License plus this exception. An
|
||||||
|
// independent module is a module which is not derived from or based
|
||||||
|
// on Avisynth C Interface, such as 3rd-party filters, import and
|
||||||
|
// export plugins, or graphical user interfaces.
|
||||||
|
|
||||||
|
#ifndef __AVXSYNTH_C__
|
||||||
|
#define __AVXSYNTH_C__
|
||||||
|
|
||||||
|
#include "windowsPorts/windows2linux.h"
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
# define EXTERN_C extern "C"
|
||||||
|
#else
|
||||||
|
# define EXTERN_C
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define AVSC_USE_STDCALL 1
|
||||||
|
|
||||||
|
#ifndef AVSC_USE_STDCALL
|
||||||
|
# define AVSC_CC __cdecl
|
||||||
|
#else
|
||||||
|
# define AVSC_CC __stdcall
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define AVSC_INLINE static __inline
|
||||||
|
|
||||||
|
#ifdef AVISYNTH_C_EXPORTS
|
||||||
|
# define AVSC_EXPORT EXTERN_C
|
||||||
|
# define AVSC_API(ret, name) EXTERN_C __declspec(dllexport) ret AVSC_CC name
|
||||||
|
#else
|
||||||
|
# define AVSC_EXPORT EXTERN_C __declspec(dllexport)
|
||||||
|
# ifndef AVSC_NO_DECLSPEC
|
||||||
|
# define AVSC_API(ret, name) EXTERN_C __declspec(dllimport) ret AVSC_CC name
|
||||||
|
# else
|
||||||
|
# define AVSC_API(ret, name) typedef ret (AVSC_CC *name##_func)
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
typedef long long int INT64;
|
||||||
|
#else
|
||||||
|
typedef __int64 INT64;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Constants
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef __AVXSYNTH_H__
|
||||||
|
enum { AVISYNTH_INTERFACE_VERSION = 3 };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
enum {AVS_SAMPLE_INT8 = 1<<0,
|
||||||
|
AVS_SAMPLE_INT16 = 1<<1,
|
||||||
|
AVS_SAMPLE_INT24 = 1<<2,
|
||||||
|
AVS_SAMPLE_INT32 = 1<<3,
|
||||||
|
AVS_SAMPLE_FLOAT = 1<<4};
|
||||||
|
|
||||||
|
enum {AVS_PLANAR_Y=1<<0,
|
||||||
|
AVS_PLANAR_U=1<<1,
|
||||||
|
AVS_PLANAR_V=1<<2,
|
||||||
|
AVS_PLANAR_ALIGNED=1<<3,
|
||||||
|
AVS_PLANAR_Y_ALIGNED=AVS_PLANAR_Y|AVS_PLANAR_ALIGNED,
|
||||||
|
AVS_PLANAR_U_ALIGNED=AVS_PLANAR_U|AVS_PLANAR_ALIGNED,
|
||||||
|
AVS_PLANAR_V_ALIGNED=AVS_PLANAR_V|AVS_PLANAR_ALIGNED};
|
||||||
|
|
||||||
|
// Colorspace properties.
|
||||||
|
enum {AVS_CS_BGR = 1<<28,
|
||||||
|
AVS_CS_YUV = 1<<29,
|
||||||
|
AVS_CS_INTERLEAVED = 1<<30,
|
||||||
|
AVS_CS_PLANAR = 1<<31};
|
||||||
|
|
||||||
|
// Specific colorformats
|
||||||
|
enum {
|
||||||
|
AVS_CS_UNKNOWN = 0,
|
||||||
|
AVS_CS_BGR24 = 1<<0 | AVS_CS_BGR | AVS_CS_INTERLEAVED,
|
||||||
|
AVS_CS_BGR32 = 1<<1 | AVS_CS_BGR | AVS_CS_INTERLEAVED,
|
||||||
|
AVS_CS_YUY2 = 1<<2 | AVS_CS_YUV | AVS_CS_INTERLEAVED,
|
||||||
|
AVS_CS_YV12 = 1<<3 | AVS_CS_YUV | AVS_CS_PLANAR, // y-v-u, planar
|
||||||
|
AVS_CS_I420 = 1<<4 | AVS_CS_YUV | AVS_CS_PLANAR, // y-u-v, planar
|
||||||
|
AVS_CS_IYUV = 1<<4 | AVS_CS_YUV | AVS_CS_PLANAR // same as above
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
AVS_IT_BFF = 1<<0,
|
||||||
|
AVS_IT_TFF = 1<<1,
|
||||||
|
AVS_IT_FIELDBASED = 1<<2};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
AVS_FILTER_TYPE=1,
|
||||||
|
AVS_FILTER_INPUT_COLORSPACE=2,
|
||||||
|
AVS_FILTER_OUTPUT_TYPE=9,
|
||||||
|
AVS_FILTER_NAME=4,
|
||||||
|
AVS_FILTER_AUTHOR=5,
|
||||||
|
AVS_FILTER_VERSION=6,
|
||||||
|
AVS_FILTER_ARGS=7,
|
||||||
|
AVS_FILTER_ARGS_INFO=8,
|
||||||
|
AVS_FILTER_ARGS_DESCRIPTION=10,
|
||||||
|
AVS_FILTER_DESCRIPTION=11};
|
||||||
|
|
||||||
|
enum { //SUBTYPES
|
||||||
|
AVS_FILTER_TYPE_AUDIO=1,
|
||||||
|
AVS_FILTER_TYPE_VIDEO=2,
|
||||||
|
AVS_FILTER_OUTPUT_TYPE_SAME=3,
|
||||||
|
AVS_FILTER_OUTPUT_TYPE_DIFFERENT=4};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
AVS_CACHE_NOTHING=0,
|
||||||
|
AVS_CACHE_RANGE=1,
|
||||||
|
AVS_CACHE_ALL=2,
|
||||||
|
AVS_CACHE_AUDIO=3,
|
||||||
|
AVS_CACHE_AUDIO_NONE=4,
|
||||||
|
AVS_CACHE_AUDIO_AUTO=5
|
||||||
|
};
|
||||||
|
|
||||||
|
#define AVS_FRAME_ALIGN 16
|
||||||
|
|
||||||
|
typedef struct AVS_Clip AVS_Clip;
|
||||||
|
typedef struct AVS_ScriptEnvironment AVS_ScriptEnvironment;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// AVS_VideoInfo
|
||||||
|
//
|
||||||
|
|
||||||
|
// AVS_VideoInfo is layed out identicly to VideoInfo
|
||||||
|
typedef struct AVS_VideoInfo {
|
||||||
|
int width, height; // width=0 means no video
|
||||||
|
unsigned fps_numerator, fps_denominator;
|
||||||
|
int num_frames;
|
||||||
|
|
||||||
|
int pixel_type;
|
||||||
|
|
||||||
|
int audio_samples_per_second; // 0 means no audio
|
||||||
|
int sample_type;
|
||||||
|
INT64 num_audio_samples;
|
||||||
|
int nchannels;
|
||||||
|
|
||||||
|
// Imagetype properties
|
||||||
|
|
||||||
|
int image_type;
|
||||||
|
} AVS_VideoInfo;
|
||||||
|
|
||||||
|
// useful functions of the above
|
||||||
|
AVSC_INLINE int avs_has_video(const AVS_VideoInfo * p)
|
||||||
|
{ return (p->width!=0); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_has_audio(const AVS_VideoInfo * p)
|
||||||
|
{ return (p->audio_samples_per_second!=0); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_rgb(const AVS_VideoInfo * p)
|
||||||
|
{ return !!(p->pixel_type&AVS_CS_BGR); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_rgb24(const AVS_VideoInfo * p)
|
||||||
|
{ return (p->pixel_type&AVS_CS_BGR24)==AVS_CS_BGR24; } // Clear out additional properties
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_rgb32(const AVS_VideoInfo * p)
|
||||||
|
{ return (p->pixel_type & AVS_CS_BGR32) == AVS_CS_BGR32 ; }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_yuv(const AVS_VideoInfo * p)
|
||||||
|
{ return !!(p->pixel_type&AVS_CS_YUV ); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_yuy2(const AVS_VideoInfo * p)
|
||||||
|
{ return (p->pixel_type & AVS_CS_YUY2) == AVS_CS_YUY2; }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_yv12(const AVS_VideoInfo * p)
|
||||||
|
{ return ((p->pixel_type & AVS_CS_YV12) == AVS_CS_YV12)||((p->pixel_type & AVS_CS_I420) == AVS_CS_I420); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_color_space(const AVS_VideoInfo * p, int c_space)
|
||||||
|
{ return ((p->pixel_type & c_space) == c_space); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_property(const AVS_VideoInfo * p, int property)
|
||||||
|
{ return ((p->pixel_type & property)==property ); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_planar(const AVS_VideoInfo * p)
|
||||||
|
{ return !!(p->pixel_type & AVS_CS_PLANAR); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_field_based(const AVS_VideoInfo * p)
|
||||||
|
{ return !!(p->image_type & AVS_IT_FIELDBASED); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_parity_known(const AVS_VideoInfo * p)
|
||||||
|
{ return ((p->image_type & AVS_IT_FIELDBASED)&&(p->image_type & (AVS_IT_BFF | AVS_IT_TFF))); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_bff(const AVS_VideoInfo * p)
|
||||||
|
{ return !!(p->image_type & AVS_IT_BFF); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_tff(const AVS_VideoInfo * p)
|
||||||
|
{ return !!(p->image_type & AVS_IT_TFF); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_bits_per_pixel(const AVS_VideoInfo * p)
|
||||||
|
{
|
||||||
|
switch (p->pixel_type) {
|
||||||
|
case AVS_CS_BGR24: return 24;
|
||||||
|
case AVS_CS_BGR32: return 32;
|
||||||
|
case AVS_CS_YUY2: return 16;
|
||||||
|
case AVS_CS_YV12:
|
||||||
|
case AVS_CS_I420: return 12;
|
||||||
|
default: return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AVSC_INLINE int avs_bytes_from_pixels(const AVS_VideoInfo * p, int pixels)
|
||||||
|
{ return pixels * (avs_bits_per_pixel(p)>>3); } // Will work on planar images, but will return only luma planes
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_row_size(const AVS_VideoInfo * p)
|
||||||
|
{ return avs_bytes_from_pixels(p,p->width); } // Also only returns first plane on planar images
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_bmp_size(const AVS_VideoInfo * vi)
|
||||||
|
{ if (avs_is_planar(vi)) {int p = vi->height * ((avs_row_size(vi)+3) & ~3); p+=p>>1; return p; } return vi->height * ((avs_row_size(vi)+3) & ~3); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_samples_per_second(const AVS_VideoInfo * p)
|
||||||
|
{ return p->audio_samples_per_second; }
|
||||||
|
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_bytes_per_channel_sample(const AVS_VideoInfo * p)
|
||||||
|
{
|
||||||
|
switch (p->sample_type) {
|
||||||
|
case AVS_SAMPLE_INT8: return sizeof(signed char);
|
||||||
|
case AVS_SAMPLE_INT16: return sizeof(signed short);
|
||||||
|
case AVS_SAMPLE_INT24: return 3;
|
||||||
|
case AVS_SAMPLE_INT32: return sizeof(signed int);
|
||||||
|
case AVS_SAMPLE_FLOAT: return sizeof(float);
|
||||||
|
default: return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AVSC_INLINE int avs_bytes_per_audio_sample(const AVS_VideoInfo * p)
|
||||||
|
{ return p->nchannels*avs_bytes_per_channel_sample(p);}
|
||||||
|
|
||||||
|
AVSC_INLINE INT64 avs_audio_samples_from_frames(const AVS_VideoInfo * p, INT64 frames)
|
||||||
|
{ return ((INT64)(frames) * p->audio_samples_per_second * p->fps_denominator / p->fps_numerator); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_frames_from_audio_samples(const AVS_VideoInfo * p, INT64 samples)
|
||||||
|
{ return (int)(samples * (INT64)p->fps_numerator / (INT64)p->fps_denominator / (INT64)p->audio_samples_per_second); }
|
||||||
|
|
||||||
|
AVSC_INLINE INT64 avs_audio_samples_from_bytes(const AVS_VideoInfo * p, INT64 bytes)
|
||||||
|
{ return bytes / avs_bytes_per_audio_sample(p); }
|
||||||
|
|
||||||
|
AVSC_INLINE INT64 avs_bytes_from_audio_samples(const AVS_VideoInfo * p, INT64 samples)
|
||||||
|
{ return samples * avs_bytes_per_audio_sample(p); }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_audio_channels(const AVS_VideoInfo * p)
|
||||||
|
{ return p->nchannels; }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_sample_type(const AVS_VideoInfo * p)
|
||||||
|
{ return p->sample_type;}
|
||||||
|
|
||||||
|
// useful mutator
|
||||||
|
AVSC_INLINE void avs_set_property(AVS_VideoInfo * p, int property)
|
||||||
|
{ p->image_type|=property; }
|
||||||
|
|
||||||
|
AVSC_INLINE void avs_clear_property(AVS_VideoInfo * p, int property)
|
||||||
|
{ p->image_type&=~property; }
|
||||||
|
|
||||||
|
AVSC_INLINE void avs_set_field_based(AVS_VideoInfo * p, int isfieldbased)
|
||||||
|
{ if (isfieldbased) p->image_type|=AVS_IT_FIELDBASED; else p->image_type&=~AVS_IT_FIELDBASED; }
|
||||||
|
|
||||||
|
AVSC_INLINE void avs_set_fps(AVS_VideoInfo * p, unsigned numerator, unsigned denominator)
|
||||||
|
{
|
||||||
|
unsigned x=numerator, y=denominator;
|
||||||
|
while (y) { // find gcd
|
||||||
|
unsigned t = x%y; x = y; y = t;
|
||||||
|
}
|
||||||
|
p->fps_numerator = numerator/x;
|
||||||
|
p->fps_denominator = denominator/x;
|
||||||
|
}
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_same_colorspace(AVS_VideoInfo * x, AVS_VideoInfo * y)
|
||||||
|
{
|
||||||
|
return (x->pixel_type == y->pixel_type)
|
||||||
|
|| (avs_is_yv12(x) && avs_is_yv12(y));
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// AVS_VideoFrame
|
||||||
|
//
|
||||||
|
|
||||||
|
// VideoFrameBuffer holds information about a memory block which is used
|
||||||
|
// for video data. For efficiency, instances of this class are not deleted
|
||||||
|
// when the refcount reaches zero; instead they're stored in a linked list
|
||||||
|
// to be reused. The instances are deleted when the corresponding AVS
|
||||||
|
// file is closed.
|
||||||
|
|
||||||
|
// AVS_VideoFrameBuffer is layed out identicly to VideoFrameBuffer
|
||||||
|
// DO NOT USE THIS STRUCTURE DIRECTLY
|
||||||
|
typedef struct AVS_VideoFrameBuffer {
|
||||||
|
unsigned char * data;
|
||||||
|
int data_size;
|
||||||
|
// sequence_number is incremented every time the buffer is changed, so
|
||||||
|
// that stale views can tell they're no longer valid.
|
||||||
|
long sequence_number;
|
||||||
|
|
||||||
|
long refcount;
|
||||||
|
} AVS_VideoFrameBuffer;
|
||||||
|
|
||||||
|
// VideoFrame holds a "window" into a VideoFrameBuffer.
|
||||||
|
|
||||||
|
// AVS_VideoFrame is layed out identicly to IVideoFrame
|
||||||
|
// DO NOT USE THIS STRUCTURE DIRECTLY
|
||||||
|
typedef struct AVS_VideoFrame {
|
||||||
|
int refcount;
|
||||||
|
AVS_VideoFrameBuffer * vfb;
|
||||||
|
int offset, pitch, row_size, height, offsetU, offsetV, pitchUV; // U&V offsets are from top of picture.
|
||||||
|
} AVS_VideoFrame;
|
||||||
|
|
||||||
|
// Access functions for AVS_VideoFrame
|
||||||
|
AVSC_INLINE int avs_get_pitch(const AVS_VideoFrame * p) {
|
||||||
|
return p->pitch;}
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_get_pitch_p(const AVS_VideoFrame * p, int plane) {
|
||||||
|
switch (plane) {
|
||||||
|
case AVS_PLANAR_U: case AVS_PLANAR_V: return p->pitchUV;}
|
||||||
|
return p->pitch;}
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_get_row_size(const AVS_VideoFrame * p) {
|
||||||
|
return p->row_size; }
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_get_row_size_p(const AVS_VideoFrame * p, int plane) {
|
||||||
|
int r;
|
||||||
|
switch (plane) {
|
||||||
|
case AVS_PLANAR_U: case AVS_PLANAR_V:
|
||||||
|
if (p->pitchUV) return p->row_size>>1;
|
||||||
|
else return 0;
|
||||||
|
case AVS_PLANAR_U_ALIGNED: case AVS_PLANAR_V_ALIGNED:
|
||||||
|
if (p->pitchUV) {
|
||||||
|
r = ((p->row_size+AVS_FRAME_ALIGN-1)&(~(AVS_FRAME_ALIGN-1)) )>>1; // Aligned rowsize
|
||||||
|
if (r < p->pitchUV)
|
||||||
|
return r;
|
||||||
|
return p->row_size>>1;
|
||||||
|
} else return 0;
|
||||||
|
case AVS_PLANAR_Y_ALIGNED:
|
||||||
|
r = (p->row_size+AVS_FRAME_ALIGN-1)&(~(AVS_FRAME_ALIGN-1)); // Aligned rowsize
|
||||||
|
if (r <= p->pitch)
|
||||||
|
return r;
|
||||||
|
return p->row_size;
|
||||||
|
}
|
||||||
|
return p->row_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_get_height(const AVS_VideoFrame * p) {
|
||||||
|
return p->height;}
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_get_height_p(const AVS_VideoFrame * p, int plane) {
|
||||||
|
switch (plane) {
|
||||||
|
case AVS_PLANAR_U: case AVS_PLANAR_V:
|
||||||
|
if (p->pitchUV) return p->height>>1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return p->height;}
|
||||||
|
|
||||||
|
AVSC_INLINE const unsigned char* avs_get_read_ptr(const AVS_VideoFrame * p) {
|
||||||
|
return p->vfb->data + p->offset;}
|
||||||
|
|
||||||
|
AVSC_INLINE const unsigned char* avs_get_read_ptr_p(const AVS_VideoFrame * p, int plane)
|
||||||
|
{
|
||||||
|
switch (plane) {
|
||||||
|
case AVS_PLANAR_U: return p->vfb->data + p->offsetU;
|
||||||
|
case AVS_PLANAR_V: return p->vfb->data + p->offsetV;
|
||||||
|
default: return p->vfb->data + p->offset;}
|
||||||
|
}
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_is_writable(const AVS_VideoFrame * p) {
|
||||||
|
return (p->refcount == 1 && p->vfb->refcount == 1);}
|
||||||
|
|
||||||
|
AVSC_INLINE unsigned char* avs_get_write_ptr(const AVS_VideoFrame * p)
|
||||||
|
{
|
||||||
|
if (avs_is_writable(p)) {
|
||||||
|
++p->vfb->sequence_number;
|
||||||
|
return p->vfb->data + p->offset;
|
||||||
|
} else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
AVSC_INLINE unsigned char* avs_get_write_ptr_p(const AVS_VideoFrame * p, int plane)
|
||||||
|
{
|
||||||
|
if (plane==AVS_PLANAR_Y && avs_is_writable(p)) {
|
||||||
|
++p->vfb->sequence_number;
|
||||||
|
return p->vfb->data + p->offset;
|
||||||
|
} else if (plane==AVS_PLANAR_Y) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
switch (plane) {
|
||||||
|
case AVS_PLANAR_U: return p->vfb->data + p->offsetU;
|
||||||
|
case AVS_PLANAR_V: return p->vfb->data + p->offsetV;
|
||||||
|
default: return p->vfb->data + p->offset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif // __cplusplus
|
||||||
|
AVSC_API(void, avs_release_video_frame)(AVS_VideoFrame *);
|
||||||
|
// makes a shallow copy of a video frame
|
||||||
|
AVSC_API(AVS_VideoFrame *, avs_copy_video_frame)(AVS_VideoFrame *);
|
||||||
|
#if defined __cplusplus
|
||||||
|
}
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#ifndef AVSC_NO_DECLSPEC
|
||||||
|
AVSC_INLINE void avs_release_frame(AVS_VideoFrame * f)
|
||||||
|
{avs_release_video_frame(f);}
|
||||||
|
AVSC_INLINE AVS_VideoFrame * avs_copy_frame(AVS_VideoFrame * f)
|
||||||
|
{return avs_copy_video_frame(f);}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// AVS_Value
|
||||||
|
//
|
||||||
|
|
||||||
|
// Treat AVS_Value as a fat pointer. That is use avs_copy_value
|
||||||
|
// and avs_release_value appropiaty as you would if AVS_Value was
|
||||||
|
// a pointer.
|
||||||
|
|
||||||
|
// To maintain source code compatibility with future versions of the
|
||||||
|
// avisynth_c API don't use the AVS_Value directly. Use the helper
|
||||||
|
// functions below.
|
||||||
|
|
||||||
|
// AVS_Value is layed out identicly to AVSValue
|
||||||
|
typedef struct AVS_Value AVS_Value;
|
||||||
|
struct AVS_Value {
|
||||||
|
short type; // 'a'rray, 'c'lip, 'b'ool, 'i'nt, 'f'loat, 's'tring, 'v'oid, or 'l'ong
|
||||||
|
// for some function e'rror
|
||||||
|
short array_size;
|
||||||
|
union {
|
||||||
|
void * clip; // do not use directly, use avs_take_clip
|
||||||
|
char boolean;
|
||||||
|
int integer;
|
||||||
|
INT64 integer64; // match addition of __int64 to avxplugin.h
|
||||||
|
float floating_pt;
|
||||||
|
const char * string;
|
||||||
|
const AVS_Value * array;
|
||||||
|
} d;
|
||||||
|
};
|
||||||
|
|
||||||
|
// AVS_Value should be initilized with avs_void.
|
||||||
|
// Should also set to avs_void after the value is released
|
||||||
|
// with avs_copy_value. Consider it the equalvent of setting
|
||||||
|
// a pointer to NULL
|
||||||
|
static const AVS_Value avs_void = {'v'};
|
||||||
|
|
||||||
|
AVSC_API(void, avs_copy_value)(AVS_Value * dest, AVS_Value src);
|
||||||
|
AVSC_API(void, avs_release_value)(AVS_Value);
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_defined(AVS_Value v) { return v.type != 'v'; }
|
||||||
|
AVSC_INLINE int avs_is_clip(AVS_Value v) { return v.type == 'c'; }
|
||||||
|
AVSC_INLINE int avs_is_bool(AVS_Value v) { return v.type == 'b'; }
|
||||||
|
AVSC_INLINE int avs_is_int(AVS_Value v) { return v.type == 'i'; }
|
||||||
|
AVSC_INLINE int avs_is_float(AVS_Value v) { return v.type == 'f' || v.type == 'i'; }
|
||||||
|
AVSC_INLINE int avs_is_string(AVS_Value v) { return v.type == 's'; }
|
||||||
|
AVSC_INLINE int avs_is_array(AVS_Value v) { return v.type == 'a'; }
|
||||||
|
AVSC_INLINE int avs_is_error(AVS_Value v) { return v.type == 'e'; }
|
||||||
|
|
||||||
|
#if defined __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif // __cplusplus
|
||||||
|
AVSC_API(AVS_Clip *, avs_take_clip)(AVS_Value, AVS_ScriptEnvironment *);
|
||||||
|
AVSC_API(void, avs_set_to_clip)(AVS_Value *, AVS_Clip *);
|
||||||
|
#if defined __cplusplus
|
||||||
|
}
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
AVSC_INLINE int avs_as_bool(AVS_Value v)
|
||||||
|
{ return v.d.boolean; }
|
||||||
|
AVSC_INLINE int avs_as_int(AVS_Value v)
|
||||||
|
{ return v.d.integer; }
|
||||||
|
AVSC_INLINE const char * avs_as_string(AVS_Value v)
|
||||||
|
{ return avs_is_error(v) || avs_is_string(v) ? v.d.string : 0; }
|
||||||
|
AVSC_INLINE double avs_as_float(AVS_Value v)
|
||||||
|
{ return avs_is_int(v) ? v.d.integer : v.d.floating_pt; }
|
||||||
|
AVSC_INLINE const char * avs_as_error(AVS_Value v)
|
||||||
|
{ return avs_is_error(v) ? v.d.string : 0; }
|
||||||
|
AVSC_INLINE const AVS_Value * avs_as_array(AVS_Value v)
|
||||||
|
{ return v.d.array; }
|
||||||
|
AVSC_INLINE int avs_array_size(AVS_Value v)
|
||||||
|
{ return avs_is_array(v) ? v.array_size : 1; }
|
||||||
|
AVSC_INLINE AVS_Value avs_array_elt(AVS_Value v, int index)
|
||||||
|
{ return avs_is_array(v) ? v.d.array[index] : v; }
|
||||||
|
|
||||||
|
// only use these functions on am AVS_Value that does not already have
|
||||||
|
// an active value. Remember, treat AVS_Value as a fat pointer.
|
||||||
|
AVSC_INLINE AVS_Value avs_new_value_bool(int v0)
|
||||||
|
{ AVS_Value v; v.type = 'b'; v.d.boolean = v0 == 0 ? 0 : 1; return v; }
|
||||||
|
AVSC_INLINE AVS_Value avs_new_value_int(int v0)
|
||||||
|
{ AVS_Value v; v.type = 'i'; v.d.integer = v0; return v; }
|
||||||
|
AVSC_INLINE AVS_Value avs_new_value_string(const char * v0)
|
||||||
|
{ AVS_Value v; v.type = 's'; v.d.string = v0; return v; }
|
||||||
|
AVSC_INLINE AVS_Value avs_new_value_float(float v0)
|
||||||
|
{ AVS_Value v; v.type = 'f'; v.d.floating_pt = v0; return v;}
|
||||||
|
AVSC_INLINE AVS_Value avs_new_value_error(const char * v0)
|
||||||
|
{ AVS_Value v; v.type = 'e'; v.d.string = v0; return v; }
|
||||||
|
#ifndef AVSC_NO_DECLSPEC
|
||||||
|
AVSC_INLINE AVS_Value avs_new_value_clip(AVS_Clip * v0)
|
||||||
|
{ AVS_Value v; avs_set_to_clip(&v, v0); return v; }
|
||||||
|
#endif
|
||||||
|
AVSC_INLINE AVS_Value avs_new_value_array(AVS_Value * v0, int size)
|
||||||
|
{ AVS_Value v; v.type = 'a'; v.d.array = v0; v.array_size = size; return v; }
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// AVS_Clip
|
||||||
|
//
|
||||||
|
#if defined __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif // __cplusplus
|
||||||
|
AVSC_API(void, avs_release_clip)(AVS_Clip *);
|
||||||
|
AVSC_API(AVS_Clip *, avs_copy_clip)(AVS_Clip *);
|
||||||
|
|
||||||
|
AVSC_API(const char *, avs_clip_get_error)(AVS_Clip *); // return 0 if no error
|
||||||
|
|
||||||
|
AVSC_API(const AVS_VideoInfo *, avs_get_video_info)(AVS_Clip *);
|
||||||
|
|
||||||
|
AVSC_API(int, avs_get_version)(AVS_Clip *);
|
||||||
|
|
||||||
|
AVSC_API(AVS_VideoFrame *, avs_get_frame)(AVS_Clip *, int n);
|
||||||
|
// The returned video frame must be released with avs_release_video_frame
|
||||||
|
|
||||||
|
AVSC_API(int, avs_get_parity)(AVS_Clip *, int n);
|
||||||
|
// return field parity if field_based, else parity of first field in frame
|
||||||
|
|
||||||
|
AVSC_API(int, avs_get_audio)(AVS_Clip *, void * buf,
|
||||||
|
INT64 start, INT64 count);
|
||||||
|
// start and count are in samples
|
||||||
|
|
||||||
|
AVSC_API(int, avs_set_cache_hints)(AVS_Clip *,
|
||||||
|
int cachehints, size_t frame_range);
|
||||||
|
#if defined __cplusplus
|
||||||
|
}
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
// This is the callback type used by avs_add_function
|
||||||
|
typedef AVS_Value (AVSC_CC * AVS_ApplyFunc)
|
||||||
|
(AVS_ScriptEnvironment *, AVS_Value args, void * user_data);
|
||||||
|
|
||||||
|
typedef struct AVS_FilterInfo AVS_FilterInfo;
|
||||||
|
struct AVS_FilterInfo
|
||||||
|
{
|
||||||
|
// these members should not be modified outside of the AVS_ApplyFunc callback
|
||||||
|
AVS_Clip * child;
|
||||||
|
AVS_VideoInfo vi;
|
||||||
|
AVS_ScriptEnvironment * env;
|
||||||
|
AVS_VideoFrame * (AVSC_CC * get_frame)(AVS_FilterInfo *, int n);
|
||||||
|
int (AVSC_CC * get_parity)(AVS_FilterInfo *, int n);
|
||||||
|
int (AVSC_CC * get_audio)(AVS_FilterInfo *, void * buf,
|
||||||
|
INT64 start, INT64 count);
|
||||||
|
int (AVSC_CC * set_cache_hints)(AVS_FilterInfo *, int cachehints,
|
||||||
|
int frame_range);
|
||||||
|
void (AVSC_CC * free_filter)(AVS_FilterInfo *);
|
||||||
|
|
||||||
|
// Should be set when ever there is an error to report.
|
||||||
|
// It is cleared before any of the above methods are called
|
||||||
|
const char * error;
|
||||||
|
// this is to store whatever and may be modified at will
|
||||||
|
void * user_data;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Create a new filter
|
||||||
|
// fi is set to point to the AVS_FilterInfo so that you can
|
||||||
|
// modify it once it is initilized.
|
||||||
|
// store_child should generally be set to true. If it is not
|
||||||
|
// set than ALL methods (the function pointers) must be defined
|
||||||
|
// If it is set than you do not need to worry about freeing the child
|
||||||
|
// clip.
|
||||||
|
#if defined __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif // __cplusplus
|
||||||
|
AVSC_API(AVS_Clip *, avs_new_c_filter)(AVS_ScriptEnvironment * e,
|
||||||
|
AVS_FilterInfo * * fi,
|
||||||
|
AVS_Value child, int store_child);
|
||||||
|
#if defined __cplusplus
|
||||||
|
}
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// AVS_ScriptEnvironment
|
||||||
|
//
|
||||||
|
|
||||||
|
// For GetCPUFlags. These are backwards-compatible with those in VirtualDub.
|
||||||
|
enum {
|
||||||
|
/* slowest CPU to support extension */
|
||||||
|
AVS_CPU_FORCE = 0x01, // N/A
|
||||||
|
AVS_CPU_FPU = 0x02, // 386/486DX
|
||||||
|
AVS_CPU_MMX = 0x04, // P55C, K6, PII
|
||||||
|
AVS_CPU_INTEGER_SSE = 0x08, // PIII, Athlon
|
||||||
|
AVS_CPU_SSE = 0x10, // PIII, Athlon XP/MP
|
||||||
|
AVS_CPU_SSE2 = 0x20, // PIV, Hammer
|
||||||
|
AVS_CPU_3DNOW = 0x40, // K6-2
|
||||||
|
AVS_CPU_3DNOW_EXT = 0x80, // Athlon
|
||||||
|
AVS_CPU_X86_64 = 0xA0, // Hammer (note: equiv. to 3DNow + SSE2,
|
||||||
|
// which only Hammer will have anyway)
|
||||||
|
};
|
||||||
|
|
||||||
|
#if defined __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif // __cplusplus
|
||||||
|
AVSC_API(const char *, avs_get_error)(AVS_ScriptEnvironment *); // return 0 if no error
|
||||||
|
|
||||||
|
AVSC_API(long, avs_get_cpu_flags)(AVS_ScriptEnvironment *);
|
||||||
|
AVSC_API(int, avs_check_version)(AVS_ScriptEnvironment *, int version);
|
||||||
|
|
||||||
|
AVSC_API(char *, avs_save_string)(AVS_ScriptEnvironment *, const char* s, int length);
|
||||||
|
AVSC_API(char *, avs_sprintf)(AVS_ScriptEnvironment *, const char * fmt, ...);
|
||||||
|
|
||||||
|
AVSC_API(char *, avs_vsprintf)(AVS_ScriptEnvironment *, const char * fmt, va_list val);
|
||||||
|
// note: val is really a va_list; I hope everyone typedefs va_list to a pointer
|
||||||
|
|
||||||
|
AVSC_API(int, avs_add_function)(AVS_ScriptEnvironment *,
|
||||||
|
const char * name, const char * params,
|
||||||
|
AVS_ApplyFunc apply, void * user_data);
|
||||||
|
|
||||||
|
AVSC_API(int, avs_function_exists)(AVS_ScriptEnvironment *, const char * name);
|
||||||
|
|
||||||
|
AVSC_API(AVS_Value, avs_invoke)(AVS_ScriptEnvironment *, const char * name,
|
||||||
|
AVS_Value args, const char** arg_names);
|
||||||
|
// The returned value must be be released with avs_release_value
|
||||||
|
|
||||||
|
AVSC_API(AVS_Value, avs_get_var)(AVS_ScriptEnvironment *, const char* name);
|
||||||
|
// The returned value must be be released with avs_release_value
|
||||||
|
|
||||||
|
AVSC_API(int, avs_set_var)(AVS_ScriptEnvironment *, const char* name, AVS_Value val);
|
||||||
|
|
||||||
|
AVSC_API(int, avs_set_global_var)(AVS_ScriptEnvironment *, const char* name, const AVS_Value val);
|
||||||
|
|
||||||
|
//void avs_push_context(AVS_ScriptEnvironment *, int level=0);
|
||||||
|
//void avs_pop_context(AVS_ScriptEnvironment *);
|
||||||
|
|
||||||
|
AVSC_API(AVS_VideoFrame *, avs_new_video_frame_a)(AVS_ScriptEnvironment *,
|
||||||
|
const AVS_VideoInfo * vi, int align);
|
||||||
|
// align should be at least 16
|
||||||
|
#if defined __cplusplus
|
||||||
|
}
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#ifndef AVSC_NO_DECLSPEC
|
||||||
|
AVSC_INLINE
|
||||||
|
AVS_VideoFrame * avs_new_video_frame(AVS_ScriptEnvironment * env,
|
||||||
|
const AVS_VideoInfo * vi)
|
||||||
|
{return avs_new_video_frame_a(env,vi,AVS_FRAME_ALIGN);}
|
||||||
|
|
||||||
|
AVSC_INLINE
|
||||||
|
AVS_VideoFrame * avs_new_frame(AVS_ScriptEnvironment * env,
|
||||||
|
const AVS_VideoInfo * vi)
|
||||||
|
{return avs_new_video_frame_a(env,vi,AVS_FRAME_ALIGN);}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif // __cplusplus
|
||||||
|
AVSC_API(int, avs_make_writable)(AVS_ScriptEnvironment *, AVS_VideoFrame * * pvf);
|
||||||
|
|
||||||
|
AVSC_API(void, avs_bit_blt)(AVS_ScriptEnvironment *, unsigned char* dstp, int dst_pitch, const unsigned char* srcp, int src_pitch, int row_size, int height);
|
||||||
|
|
||||||
|
typedef void (AVSC_CC *AVS_ShutdownFunc)(void* user_data, AVS_ScriptEnvironment * env);
|
||||||
|
AVSC_API(void, avs_at_exit)(AVS_ScriptEnvironment *, AVS_ShutdownFunc function, void * user_data);
|
||||||
|
|
||||||
|
AVSC_API(AVS_VideoFrame *, avs_subframe)(AVS_ScriptEnvironment *, AVS_VideoFrame * src, int rel_offset, int new_pitch, int new_row_size, int new_height);
|
||||||
|
// The returned video frame must be be released
|
||||||
|
|
||||||
|
AVSC_API(int, avs_set_memory_max)(AVS_ScriptEnvironment *, int mem);
|
||||||
|
|
||||||
|
AVSC_API(int, avs_set_working_dir)(AVS_ScriptEnvironment *, const char * newdir);
|
||||||
|
|
||||||
|
// avisynth.dll exports this; it's a way to use it as a library, without
|
||||||
|
// writing an AVS script or without going through AVIFile.
|
||||||
|
AVSC_API(AVS_ScriptEnvironment *, avs_create_script_environment)(int version);
|
||||||
|
#if defined __cplusplus
|
||||||
|
}
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
// this symbol is the entry point for the plugin and must
|
||||||
|
// be defined
|
||||||
|
AVSC_EXPORT
|
||||||
|
const char * AVSC_CC avisynth_c_plugin_init(AVS_ScriptEnvironment* env);
|
||||||
|
|
||||||
|
|
||||||
|
#if defined __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif // __cplusplus
|
||||||
|
AVSC_API(void, avs_delete_script_environment)(AVS_ScriptEnvironment *);
|
||||||
|
|
||||||
|
|
||||||
|
AVSC_API(AVS_VideoFrame *, avs_subframe_planar)(AVS_ScriptEnvironment *, AVS_VideoFrame * src, int rel_offset, int new_pitch, int new_row_size, int new_height, int rel_offsetU, int rel_offsetV, int new_pitchUV);
|
||||||
|
// The returned video frame must be be released
|
||||||
|
#if defined __cplusplus
|
||||||
|
}
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#endif //__AVXSYNTH_C__
|
||||||
85
compat/avisynth/windowsPorts/basicDataTypeConversions.h
Normal file
85
compat/avisynth/windowsPorts/basicDataTypeConversions.h
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
#ifndef __DATA_TYPE_CONVERSIONS_H__
|
||||||
|
#define __DATA_TYPE_CONVERSIONS_H__
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <wchar.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
namespace avxsynth {
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
typedef int64_t __int64;
|
||||||
|
typedef int32_t __int32;
|
||||||
|
#ifdef __cplusplus
|
||||||
|
typedef bool BOOL;
|
||||||
|
#else
|
||||||
|
typedef uint32_t BOOL;
|
||||||
|
#endif // __cplusplus
|
||||||
|
typedef void* HMODULE;
|
||||||
|
typedef void* LPVOID;
|
||||||
|
typedef void* PVOID;
|
||||||
|
typedef PVOID HANDLE;
|
||||||
|
typedef HANDLE HWND;
|
||||||
|
typedef HANDLE HINSTANCE;
|
||||||
|
typedef void* HDC;
|
||||||
|
typedef void* HBITMAP;
|
||||||
|
typedef void* HICON;
|
||||||
|
typedef void* HFONT;
|
||||||
|
typedef void* HGDIOBJ;
|
||||||
|
typedef void* HBRUSH;
|
||||||
|
typedef void* HMMIO;
|
||||||
|
typedef void* HACMSTREAM;
|
||||||
|
typedef void* HACMDRIVER;
|
||||||
|
typedef void* HIC;
|
||||||
|
typedef void* HACMOBJ;
|
||||||
|
typedef HACMSTREAM* LPHACMSTREAM;
|
||||||
|
typedef void* HACMDRIVERID;
|
||||||
|
typedef void* LPHACMDRIVER;
|
||||||
|
typedef unsigned char BYTE;
|
||||||
|
typedef BYTE* LPBYTE;
|
||||||
|
typedef char TCHAR;
|
||||||
|
typedef TCHAR* LPTSTR;
|
||||||
|
typedef const TCHAR* LPCTSTR;
|
||||||
|
typedef char* LPSTR;
|
||||||
|
typedef LPSTR LPOLESTR;
|
||||||
|
typedef const char* LPCSTR;
|
||||||
|
typedef LPCSTR LPCOLESTR;
|
||||||
|
typedef wchar_t WCHAR;
|
||||||
|
typedef unsigned short WORD;
|
||||||
|
typedef unsigned int UINT;
|
||||||
|
typedef UINT MMRESULT;
|
||||||
|
typedef uint32_t DWORD;
|
||||||
|
typedef DWORD COLORREF;
|
||||||
|
typedef DWORD FOURCC;
|
||||||
|
typedef DWORD HRESULT;
|
||||||
|
typedef DWORD* LPDWORD;
|
||||||
|
typedef DWORD* DWORD_PTR;
|
||||||
|
typedef int32_t LONG;
|
||||||
|
typedef int32_t* LONG_PTR;
|
||||||
|
typedef LONG_PTR LRESULT;
|
||||||
|
typedef uint32_t ULONG;
|
||||||
|
typedef uint32_t* ULONG_PTR;
|
||||||
|
//typedef __int64_t intptr_t;
|
||||||
|
typedef uint64_t _fsize_t;
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Structures
|
||||||
|
//
|
||||||
|
|
||||||
|
typedef struct _GUID {
|
||||||
|
DWORD Data1;
|
||||||
|
WORD Data2;
|
||||||
|
WORD Data3;
|
||||||
|
BYTE Data4[8];
|
||||||
|
} GUID;
|
||||||
|
|
||||||
|
typedef GUID REFIID;
|
||||||
|
typedef GUID CLSID;
|
||||||
|
typedef CLSID* LPCLSID;
|
||||||
|
typedef GUID IID;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}; // namespace avxsynth
|
||||||
|
#endif // __cplusplus
|
||||||
|
#endif // __DATA_TYPE_CONVERSIONS_H__
|
||||||
77
compat/avisynth/windowsPorts/windows2linux.h
Normal file
77
compat/avisynth/windowsPorts/windows2linux.h
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
#ifndef __WINDOWS2LINUX_H__
|
||||||
|
#define __WINDOWS2LINUX_H__
|
||||||
|
|
||||||
|
/*
|
||||||
|
* LINUX SPECIFIC DEFINITIONS
|
||||||
|
*/
|
||||||
|
//
|
||||||
|
// Data types conversions
|
||||||
|
//
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "basicDataTypeConversions.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
namespace avxsynth {
|
||||||
|
#endif // __cplusplus
|
||||||
|
//
|
||||||
|
// purposefully define the following MSFT definitions
|
||||||
|
// to mean nothing (as they do not mean anything on Linux)
|
||||||
|
//
|
||||||
|
#define __stdcall
|
||||||
|
#define __cdecl
|
||||||
|
#define noreturn
|
||||||
|
#define __declspec(x)
|
||||||
|
#define STDAPI extern "C" HRESULT
|
||||||
|
#define STDMETHODIMP HRESULT __stdcall
|
||||||
|
#define STDMETHODIMP_(x) x __stdcall
|
||||||
|
|
||||||
|
#define STDMETHOD(x) virtual HRESULT x
|
||||||
|
#define STDMETHOD_(a, x) virtual a x
|
||||||
|
|
||||||
|
#ifndef TRUE
|
||||||
|
#define TRUE true
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FALSE
|
||||||
|
#define FALSE false
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define S_OK (0x00000000)
|
||||||
|
#define S_FALSE (0x00000001)
|
||||||
|
#define E_NOINTERFACE (0X80004002)
|
||||||
|
#define E_POINTER (0x80004003)
|
||||||
|
#define E_FAIL (0x80004005)
|
||||||
|
#define E_OUTOFMEMORY (0x8007000E)
|
||||||
|
|
||||||
|
#define INVALID_HANDLE_VALUE ((HANDLE)((LONG_PTR)-1))
|
||||||
|
#define FAILED(hr) ((hr) & 0x80000000)
|
||||||
|
#define SUCCEEDED(hr) (!FAILED(hr))
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Functions
|
||||||
|
//
|
||||||
|
#define MAKEDWORD(a,b,c,d) ((a << 24) | (b << 16) | (c << 8) | (d))
|
||||||
|
#define MAKEWORD(a,b) ((a << 8) | (b))
|
||||||
|
|
||||||
|
#define lstrlen strlen
|
||||||
|
#define lstrcpy strcpy
|
||||||
|
#define lstrcmpi strcasecmp
|
||||||
|
#define _stricmp strcasecmp
|
||||||
|
#define InterlockedIncrement(x) __sync_fetch_and_add((x), 1)
|
||||||
|
#define InterlockedDecrement(x) __sync_fetch_and_sub((x), 1)
|
||||||
|
// Windows uses (new, old) ordering but GCC has (old, new)
|
||||||
|
#define InterlockedCompareExchange(x,y,z) __sync_val_compare_and_swap(x,z,y)
|
||||||
|
|
||||||
|
#define UInt32x32To64(a, b) ( (uint64_t) ( ((uint64_t)((uint32_t)(a))) * ((uint32_t)(b)) ) )
|
||||||
|
#define Int64ShrlMod32(a, b) ( (uint64_t) ( (uint64_t)(a) >> (b) ) )
|
||||||
|
#define Int32x32To64(a, b) ((__int64)(((__int64)((long)(a))) * ((long)(b))))
|
||||||
|
|
||||||
|
#define MulDiv(nNumber, nNumerator, nDenominator) (int32_t) (((int64_t) (nNumber) * (int64_t) (nNumerator) + (int64_t) ((nDenominator)/2)) / (int64_t) (nDenominator))
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}; // namespace avxsynth
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#endif // __WINDOWS2LINUX_H__
|
||||||
@@ -1,188 +0,0 @@
|
|||||||
/*
|
|
||||||
* Minimum CUDA compatibility definitions header
|
|
||||||
*
|
|
||||||
* Copyright (c) 2019 rcombs
|
|
||||||
*
|
|
||||||
* This file is part of FFmpeg.
|
|
||||||
*
|
|
||||||
* FFmpeg is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* FFmpeg is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with FFmpeg; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef COMPAT_CUDA_CUDA_RUNTIME_H
|
|
||||||
#define COMPAT_CUDA_CUDA_RUNTIME_H
|
|
||||||
|
|
||||||
// Common macros
|
|
||||||
#define __global__ __attribute__((global))
|
|
||||||
#define __device__ __attribute__((device))
|
|
||||||
#define __device_builtin__ __attribute__((device_builtin))
|
|
||||||
#define __align__(N) __attribute__((aligned(N)))
|
|
||||||
#define __inline__ __inline__ __attribute__((always_inline))
|
|
||||||
|
|
||||||
#define max(a, b) ((a) > (b) ? (a) : (b))
|
|
||||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
|
||||||
#define abs(x) ((x) < 0 ? -(x) : (x))
|
|
||||||
|
|
||||||
#define atomicAdd(a, b) (__atomic_fetch_add(a, b, __ATOMIC_SEQ_CST))
|
|
||||||
|
|
||||||
// Basic typedefs
|
|
||||||
typedef __device_builtin__ unsigned long long cudaTextureObject_t;
|
|
||||||
|
|
||||||
typedef struct __device_builtin__ __align__(2) uchar2
|
|
||||||
{
|
|
||||||
unsigned char x, y;
|
|
||||||
} uchar2;
|
|
||||||
|
|
||||||
typedef struct __device_builtin__ __align__(4) ushort2
|
|
||||||
{
|
|
||||||
unsigned short x, y;
|
|
||||||
} ushort2;
|
|
||||||
|
|
||||||
typedef struct __device_builtin__ __align__(8) float2
|
|
||||||
{
|
|
||||||
float x, y;
|
|
||||||
} float2;
|
|
||||||
|
|
||||||
typedef struct __device_builtin__ __align__(8) int2
|
|
||||||
{
|
|
||||||
int x, y;
|
|
||||||
} int2;
|
|
||||||
|
|
||||||
typedef struct __device_builtin__ uint3
|
|
||||||
{
|
|
||||||
unsigned int x, y, z;
|
|
||||||
} uint3;
|
|
||||||
|
|
||||||
typedef struct uint3 dim3;
|
|
||||||
|
|
||||||
typedef struct __device_builtin__ __align__(4) uchar4
|
|
||||||
{
|
|
||||||
unsigned char x, y, z, w;
|
|
||||||
} uchar4;
|
|
||||||
|
|
||||||
typedef struct __device_builtin__ __align__(8) ushort4
|
|
||||||
{
|
|
||||||
unsigned short x, y, z, w;
|
|
||||||
} ushort4;
|
|
||||||
|
|
||||||
typedef struct __device_builtin__ __align__(16) int4
|
|
||||||
{
|
|
||||||
int x, y, z, w;
|
|
||||||
} int4;
|
|
||||||
|
|
||||||
typedef struct __device_builtin__ __align__(16) float4
|
|
||||||
{
|
|
||||||
float x, y, z, w;
|
|
||||||
} float4;
|
|
||||||
|
|
||||||
// Accessors for special registers
|
|
||||||
#define GETCOMP(reg, comp) \
|
|
||||||
asm("mov.u32 %0, %%" #reg "." #comp ";" : "=r"(tmp)); \
|
|
||||||
ret.comp = tmp;
|
|
||||||
|
|
||||||
#define GET(name, reg) static inline __device__ uint3 name() {\
|
|
||||||
uint3 ret; \
|
|
||||||
unsigned tmp; \
|
|
||||||
GETCOMP(reg, x) \
|
|
||||||
GETCOMP(reg, y) \
|
|
||||||
GETCOMP(reg, z) \
|
|
||||||
return ret; \
|
|
||||||
}
|
|
||||||
|
|
||||||
GET(getBlockIdx, ctaid)
|
|
||||||
GET(getBlockDim, ntid)
|
|
||||||
GET(getThreadIdx, tid)
|
|
||||||
|
|
||||||
// Instead of externs for these registers, we turn access to them into calls into trivial ASM
|
|
||||||
#define blockIdx (getBlockIdx())
|
|
||||||
#define blockDim (getBlockDim())
|
|
||||||
#define threadIdx (getThreadIdx())
|
|
||||||
|
|
||||||
// Basic initializers (simple macros rather than inline functions)
|
|
||||||
#define make_int2(a, b) ((int2){.x = a, .y = b})
|
|
||||||
#define make_uchar2(a, b) ((uchar2){.x = a, .y = b})
|
|
||||||
#define make_ushort2(a, b) ((ushort2){.x = a, .y = b})
|
|
||||||
#define make_float2(a, b) ((float2){.x = a, .y = b})
|
|
||||||
#define make_int4(a, b, c, d) ((int4){.x = a, .y = b, .z = c, .w = d})
|
|
||||||
#define make_uchar4(a, b, c, d) ((uchar4){.x = a, .y = b, .z = c, .w = d})
|
|
||||||
#define make_ushort4(a, b, c, d) ((ushort4){.x = a, .y = b, .z = c, .w = d})
|
|
||||||
#define make_float4(a, b, c, d) ((float4){.x = a, .y = b, .z = c, .w = d})
|
|
||||||
|
|
||||||
// Conversions from the tex instruction's 4-register output to various types
|
|
||||||
#define TEX2D(type, ret) static inline __device__ void conv(type* out, unsigned a, unsigned b, unsigned c, unsigned d) {*out = (ret);}
|
|
||||||
|
|
||||||
TEX2D(unsigned char, a & 0xFF)
|
|
||||||
TEX2D(unsigned short, a & 0xFFFF)
|
|
||||||
TEX2D(float, a)
|
|
||||||
TEX2D(uchar2, make_uchar2(a & 0xFF, b & 0xFF))
|
|
||||||
TEX2D(ushort2, make_ushort2(a & 0xFFFF, b & 0xFFFF))
|
|
||||||
TEX2D(float2, make_float2(a, b))
|
|
||||||
TEX2D(uchar4, make_uchar4(a & 0xFF, b & 0xFF, c & 0xFF, d & 0xFF))
|
|
||||||
TEX2D(ushort4, make_ushort4(a & 0xFFFF, b & 0xFFFF, c & 0xFFFF, d & 0xFFFF))
|
|
||||||
TEX2D(float4, make_float4(a, b, c, d))
|
|
||||||
|
|
||||||
// Template calling tex instruction and converting the output to the selected type
|
|
||||||
template<typename T>
|
|
||||||
inline __device__ T tex2D(cudaTextureObject_t texObject, float x, float y)
|
|
||||||
{
|
|
||||||
T ret;
|
|
||||||
unsigned ret1, ret2, ret3, ret4;
|
|
||||||
asm("tex.2d.v4.u32.f32 {%0, %1, %2, %3}, [%4, {%5, %6}];" :
|
|
||||||
"=r"(ret1), "=r"(ret2), "=r"(ret3), "=r"(ret4) :
|
|
||||||
"l"(texObject), "f"(x), "f"(y));
|
|
||||||
conv(&ret, ret1, ret2, ret3, ret4);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<>
|
|
||||||
inline __device__ float4 tex2D<float4>(cudaTextureObject_t texObject, float x, float y)
|
|
||||||
{
|
|
||||||
float4 ret;
|
|
||||||
asm("tex.2d.v4.f32.f32 {%0, %1, %2, %3}, [%4, {%5, %6}];" :
|
|
||||||
"=r"(ret.x), "=r"(ret.y), "=r"(ret.z), "=r"(ret.w) :
|
|
||||||
"l"(texObject), "f"(x), "f"(y));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<>
|
|
||||||
inline __device__ float tex2D<float>(cudaTextureObject_t texObject, float x, float y)
|
|
||||||
{
|
|
||||||
return tex2D<float4>(texObject, x, y).x;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<>
|
|
||||||
inline __device__ float2 tex2D<float2>(cudaTextureObject_t texObject, float x, float y)
|
|
||||||
{
|
|
||||||
float4 ret = tex2D<float4>(texObject, x, y);
|
|
||||||
return make_float2(ret.x, ret.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Math helper functions
|
|
||||||
static inline __device__ float floorf(float a) { return __builtin_floorf(a); }
|
|
||||||
static inline __device__ float floor(float a) { return __builtin_floorf(a); }
|
|
||||||
static inline __device__ double floor(double a) { return __builtin_floor(a); }
|
|
||||||
static inline __device__ float ceilf(float a) { return __builtin_ceilf(a); }
|
|
||||||
static inline __device__ float ceil(float a) { return __builtin_ceilf(a); }
|
|
||||||
static inline __device__ double ceil(double a) { return __builtin_ceil(a); }
|
|
||||||
static inline __device__ float truncf(float a) { return __builtin_truncf(a); }
|
|
||||||
static inline __device__ float trunc(float a) { return __builtin_truncf(a); }
|
|
||||||
static inline __device__ double trunc(double a) { return __builtin_trunc(a); }
|
|
||||||
static inline __device__ float fabsf(float a) { return __builtin_fabsf(a); }
|
|
||||||
static inline __device__ float fabs(float a) { return __builtin_fabsf(a); }
|
|
||||||
static inline __device__ double fabs(double a) { return __builtin_fabs(a); }
|
|
||||||
|
|
||||||
static inline __device__ float __sinf(float a) { return __nvvm_sin_approx_f(a); }
|
|
||||||
static inline __device__ float __cosf(float a) { return __nvvm_cos_approx_f(a); }
|
|
||||||
|
|
||||||
#endif /* COMPAT_CUDA_CUDA_RUNTIME_H */
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of FFmpeg.
|
|
||||||
*
|
|
||||||
* FFmpeg is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* FFmpeg is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with FFmpeg; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef COMPAT_CUDA_DYNLINK_LOADER_H
|
|
||||||
#define COMPAT_CUDA_DYNLINK_LOADER_H
|
|
||||||
|
|
||||||
#include "libavutil/log.h"
|
|
||||||
#include "compat/w32dlfcn.h"
|
|
||||||
|
|
||||||
#define FFNV_LOAD_FUNC(path) dlopen((path), RTLD_LAZY)
|
|
||||||
#define FFNV_SYM_FUNC(lib, sym) dlsym((lib), (sym))
|
|
||||||
#define FFNV_FREE_FUNC(lib) dlclose(lib)
|
|
||||||
#define FFNV_LOG_FUNC(logctx, msg, ...) av_log(logctx, AV_LOG_ERROR, msg, __VA_ARGS__)
|
|
||||||
#define FFNV_DEBUG_LOG_FUNC(logctx, msg, ...) av_log(logctx, AV_LOG_DEBUG, msg, __VA_ARGS__)
|
|
||||||
|
|
||||||
#include <ffnvcodec/dynlink_loader.h>
|
|
||||||
|
|
||||||
#endif /* COMPAT_CUDA_DYNLINK_LOADER_H */
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
# copy of this software and associated documentation files (the "Software"),
|
|
||||||
# to deal in the Software without restriction, including without limitation
|
|
||||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
# and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
# Software is furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in
|
|
||||||
# all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
# DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
OUT="$1"
|
|
||||||
IN="$2"
|
|
||||||
NAME="$(basename "$IN" | sed 's/\..*//')"
|
|
||||||
|
|
||||||
printf "const char %s_ptx[] = \\" "$NAME" > "$OUT"
|
|
||||||
echo >> "$OUT"
|
|
||||||
sed -e "$(printf 's/\r//g')" -e 's/["\\]/\\&/g' -e "$(printf 's/^/\t"/')" -e 's/$/\\n"/' < "$IN" >> "$OUT"
|
|
||||||
echo ";" >> "$OUT"
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of FFmpeg.
|
|
||||||
*
|
|
||||||
* FFmpeg is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* FFmpeg is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with FFmpeg; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef COMPAT_DISPATCH_SEMAPHORE_SEMAPHORE_H
|
|
||||||
#define COMPAT_DISPATCH_SEMAPHORE_SEMAPHORE_H
|
|
||||||
|
|
||||||
#include <dispatch/dispatch.h>
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
#define sem_t dispatch_semaphore_t
|
|
||||||
#define sem_post(psem) dispatch_semaphore_signal(*psem)
|
|
||||||
#define sem_wait(psem) dispatch_semaphore_wait(*psem, DISPATCH_TIME_FOREVER)
|
|
||||||
#define sem_timedwait(psem, val) dispatch_semaphore_wait(*psem, dispatch_walltime(val, 0))
|
|
||||||
#define sem_destroy(psem) dispatch_release(*psem)
|
|
||||||
|
|
||||||
static inline int compat_sem_init(dispatch_semaphore_t *psem,
|
|
||||||
int unused, int val)
|
|
||||||
{
|
|
||||||
int ret = !!(*psem = dispatch_semaphore_create(val)) - 1;
|
|
||||||
if (ret < 0)
|
|
||||||
errno = ENOMEM;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define sem_init compat_sem_init
|
|
||||||
|
|
||||||
#endif /* COMPAT_DISPATCH_SEMAPHORE_SEMAPHORE_H */
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of FFmpeg.
|
|
||||||
*
|
|
||||||
* FFmpeg is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* FFmpeg is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with FFmpeg; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#define FUN(name, type, op) \
|
|
||||||
type name(type x, type y) \
|
|
||||||
{ \
|
|
||||||
if (fpclassify(x) == FP_NAN) return y; \
|
|
||||||
if (fpclassify(y) == FP_NAN) return x; \
|
|
||||||
return x op y ? x : y; \
|
|
||||||
}
|
|
||||||
|
|
||||||
FUN(fmin, double, <)
|
|
||||||
FUN(fmax, double, >)
|
|
||||||
FUN(fminf, float, <)
|
|
||||||
FUN(fmaxf, float, >)
|
|
||||||
|
|
||||||
long double fmodl(long double x, long double y)
|
|
||||||
{
|
|
||||||
return fmod(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
long double scalbnl(long double x, int exp)
|
|
||||||
{
|
|
||||||
return scalbn(x, exp);
|
|
||||||
}
|
|
||||||
|
|
||||||
long double copysignl(long double x, long double y)
|
|
||||||
{
|
|
||||||
return copysign(x, y);
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of FFmpeg.
|
|
||||||
*
|
|
||||||
* FFmpeg is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* FFmpeg is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with FFmpeg; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
double fmin(double, double);
|
|
||||||
double fmax(double, double);
|
|
||||||
float fminf(float, float);
|
|
||||||
float fmaxf(float, float);
|
|
||||||
long double fmodl(long double, long double);
|
|
||||||
long double scalbnl(long double, int);
|
|
||||||
long double copysignl(long double, long double);
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* Work around broken floating point limits on some systems.
|
|
||||||
*
|
|
||||||
* This file is part of FFmpeg.
|
|
||||||
*
|
|
||||||
* FFmpeg is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* FFmpeg is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with FFmpeg; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include_next <float.h>
|
|
||||||
|
|
||||||
#ifdef FLT_MAX
|
|
||||||
#undef FLT_MAX
|
|
||||||
#define FLT_MAX 3.40282346638528859812e+38F
|
|
||||||
|
|
||||||
#undef FLT_MIN
|
|
||||||
#define FLT_MIN 1.17549435082228750797e-38F
|
|
||||||
|
|
||||||
#undef DBL_MAX
|
|
||||||
#define DBL_MAX ((double)1.79769313486231570815e+308L)
|
|
||||||
|
|
||||||
#undef DBL_MIN
|
|
||||||
#define DBL_MIN ((double)2.22507385850720138309e-308L)
|
|
||||||
#endif
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
/*
|
|
||||||
* Work around broken floating point limits on some systems.
|
|
||||||
*
|
|
||||||
* This file is part of FFmpeg.
|
|
||||||
*
|
|
||||||
* FFmpeg is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* FFmpeg is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with FFmpeg; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include_next <limits.h>
|
|
||||||
#include <float.h>
|
|
||||||
@@ -54,7 +54,7 @@ static int getopt(int argc, char *argv[], char *opts)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
optopt = c = argv[optind][sp];
|
optopt = c = argv[optind][sp];
|
||||||
if (c == ':' || !(cp = strchr(opts, c))) {
|
if (c == ':' || (cp = strchr(opts, c)) == NULL) {
|
||||||
fprintf(stderr, ": illegal option -- %c\n", c);
|
fprintf(stderr, ": illegal option -- %c\n", c);
|
||||||
if (argv[optind][++sp] == '\0') {
|
if (argv[optind][++sp] == '\0') {
|
||||||
optind++;
|
optind++;
|
||||||
|
|||||||
@@ -19,8 +19,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef COMPAT_MSVCRT_SNPRINTF_H
|
#ifndef COMPAT_SNPRINTF_H
|
||||||
#define COMPAT_MSVCRT_SNPRINTF_H
|
#define COMPAT_SNPRINTF_H
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -35,4 +35,4 @@ int avpriv_vsnprintf(char *s, size_t n, const char *fmt, va_list ap);
|
|||||||
#define _snprintf avpriv_snprintf
|
#define _snprintf avpriv_snprintf
|
||||||
#define vsnprintf avpriv_vsnprintf
|
#define vsnprintf avpriv_vsnprintf
|
||||||
|
|
||||||
#endif /* COMPAT_MSVCRT_SNPRINTF_H */
|
#endif /* COMPAT_SNPRINTF_H */
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011-2017 KO Myung-Hun <komh@chollian.net>
|
* Copyright (c) 2011 KO Myung-Hun <komh@chollian.net>
|
||||||
*
|
*
|
||||||
* This file is part of FFmpeg.
|
* This file is part of FFmpeg.
|
||||||
*
|
*
|
||||||
@@ -23,118 +23,96 @@
|
|||||||
* os2threads to pthreads wrapper
|
* os2threads to pthreads wrapper
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef COMPAT_OS2THREADS_H
|
#ifndef AVCODEC_OS2PTHREADS_H
|
||||||
#define COMPAT_OS2THREADS_H
|
#define AVCODEC_OS2PTHREADS_H
|
||||||
|
|
||||||
#define INCL_DOS
|
#define INCL_DOS
|
||||||
#define INCL_DOSERRORS
|
|
||||||
#include <os2.h>
|
#include <os2.h>
|
||||||
|
|
||||||
#undef __STRICT_ANSI__ /* for _beginthread() */
|
#undef __STRICT_ANSI__ /* for _beginthread() */
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
#include <sys/builtin.h>
|
#include "libavutil/mem.h"
|
||||||
#include <sys/fmutex.h>
|
|
||||||
|
|
||||||
#include "libavutil/attributes.h"
|
|
||||||
#include "libavutil/common.h"
|
|
||||||
#include "libavutil/time.h"
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
TID tid;
|
|
||||||
void *(*start_routine)(void *);
|
|
||||||
void *arg;
|
|
||||||
void *result;
|
|
||||||
} pthread_t;
|
|
||||||
|
|
||||||
|
typedef TID pthread_t;
|
||||||
typedef void pthread_attr_t;
|
typedef void pthread_attr_t;
|
||||||
|
|
||||||
typedef _fmutex pthread_mutex_t;
|
typedef HMTX pthread_mutex_t;
|
||||||
typedef void pthread_mutexattr_t;
|
typedef void pthread_mutexattr_t;
|
||||||
|
|
||||||
#define PTHREAD_MUTEX_INITIALIZER _FMUTEX_INITIALIZER
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
HEV event_sem;
|
HEV event_sem;
|
||||||
HEV ack_sem;
|
int wait_count;
|
||||||
volatile unsigned wait_count;
|
|
||||||
} pthread_cond_t;
|
} pthread_cond_t;
|
||||||
|
|
||||||
typedef void pthread_condattr_t;
|
typedef void pthread_condattr_t;
|
||||||
|
|
||||||
typedef struct {
|
struct thread_arg {
|
||||||
volatile int done;
|
void *(*start_routine)(void *);
|
||||||
_fmutex mtx;
|
void *arg;
|
||||||
} pthread_once_t;
|
};
|
||||||
|
|
||||||
#define PTHREAD_ONCE_INIT {0, _FMUTEX_INITIALIZER}
|
|
||||||
|
|
||||||
static void thread_entry(void *arg)
|
static void thread_entry(void *arg)
|
||||||
{
|
{
|
||||||
pthread_t *thread = arg;
|
struct thread_arg *thread_arg = arg;
|
||||||
|
|
||||||
thread->result = thread->start_routine(thread->arg);
|
thread_arg->start_routine(thread_arg->arg);
|
||||||
|
|
||||||
|
av_free(thread_arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_always_inline int pthread_create(pthread_t *thread,
|
static av_always_inline int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void*), void *arg)
|
||||||
const pthread_attr_t *attr,
|
|
||||||
void *(*start_routine)(void*),
|
|
||||||
void *arg)
|
|
||||||
{
|
{
|
||||||
thread->start_routine = start_routine;
|
struct thread_arg *thread_arg;
|
||||||
thread->arg = arg;
|
|
||||||
thread->result = NULL;
|
|
||||||
|
|
||||||
thread->tid = _beginthread(thread_entry, NULL, 1024 * 1024, thread);
|
thread_arg = av_mallocz(sizeof(struct thread_arg));
|
||||||
|
|
||||||
|
thread_arg->start_routine = start_routine;
|
||||||
|
thread_arg->arg = arg;
|
||||||
|
|
||||||
|
*thread = _beginthread(thread_entry, NULL, 256 * 1024, thread_arg);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_always_inline int pthread_join(pthread_t thread, void **value_ptr)
|
static av_always_inline int pthread_join(pthread_t thread, void **value_ptr)
|
||||||
{
|
{
|
||||||
DosWaitThread(&thread.tid, DCWW_WAIT);
|
DosWaitThread((PTID)&thread, DCWW_WAIT);
|
||||||
|
|
||||||
if (value_ptr)
|
|
||||||
*value_ptr = thread.result;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex,
|
static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
|
||||||
const pthread_mutexattr_t *attr)
|
|
||||||
{
|
{
|
||||||
_fmutex_create(mutex, 0);
|
DosCreateMutexSem(NULL, (PHMTX)mutex, 0, FALSE);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
|
static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
|
||||||
{
|
{
|
||||||
_fmutex_close(mutex);
|
DosCloseMutexSem(*(PHMTX)mutex);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_always_inline int pthread_mutex_lock(pthread_mutex_t *mutex)
|
static av_always_inline int pthread_mutex_lock(pthread_mutex_t *mutex)
|
||||||
{
|
{
|
||||||
_fmutex_request(mutex, 0);
|
DosRequestMutexSem(*(PHMTX)mutex, SEM_INDEFINITE_WAIT);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_always_inline int pthread_mutex_unlock(pthread_mutex_t *mutex)
|
static av_always_inline int pthread_mutex_unlock(pthread_mutex_t *mutex)
|
||||||
{
|
{
|
||||||
_fmutex_release(mutex);
|
DosReleaseMutexSem(*(PHMTX)mutex);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_always_inline int pthread_cond_init(pthread_cond_t *cond,
|
static av_always_inline int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
|
||||||
const pthread_condattr_t *attr)
|
|
||||||
{
|
{
|
||||||
DosCreateEventSem(NULL, &cond->event_sem, DCE_POSTONE, FALSE);
|
DosCreateEventSem(NULL, &cond->event_sem, DCE_POSTONE, FALSE);
|
||||||
DosCreateEventSem(NULL, &cond->ack_sem, DCE_POSTONE, FALSE);
|
|
||||||
|
|
||||||
cond->wait_count = 0;
|
cond->wait_count = 0;
|
||||||
|
|
||||||
@@ -144,16 +122,16 @@ static av_always_inline int pthread_cond_init(pthread_cond_t *cond,
|
|||||||
static av_always_inline int pthread_cond_destroy(pthread_cond_t *cond)
|
static av_always_inline int pthread_cond_destroy(pthread_cond_t *cond)
|
||||||
{
|
{
|
||||||
DosCloseEventSem(cond->event_sem);
|
DosCloseEventSem(cond->event_sem);
|
||||||
DosCloseEventSem(cond->ack_sem);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_always_inline int pthread_cond_signal(pthread_cond_t *cond)
|
static av_always_inline int pthread_cond_signal(pthread_cond_t *cond)
|
||||||
{
|
{
|
||||||
if (!__atomic_cmpxchg32(&cond->wait_count, 0, 0)) {
|
if (cond->wait_count > 0) {
|
||||||
DosPostEventSem(cond->event_sem);
|
DosPostEventSem(cond->event_sem);
|
||||||
DosWaitEventSem(cond->ack_sem, SEM_INDEFINITE_WAIT);
|
|
||||||
|
cond->wait_count--;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -161,69 +139,26 @@ static av_always_inline int pthread_cond_signal(pthread_cond_t *cond)
|
|||||||
|
|
||||||
static av_always_inline int pthread_cond_broadcast(pthread_cond_t *cond)
|
static av_always_inline int pthread_cond_broadcast(pthread_cond_t *cond)
|
||||||
{
|
{
|
||||||
while (!__atomic_cmpxchg32(&cond->wait_count, 0, 0))
|
while (cond->wait_count > 0) {
|
||||||
pthread_cond_signal(cond);
|
DosPostEventSem(cond->event_sem);
|
||||||
|
|
||||||
|
cond->wait_count--;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_always_inline int pthread_cond_timedwait(pthread_cond_t *cond,
|
static av_always_inline int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
|
||||||
pthread_mutex_t *mutex,
|
|
||||||
const struct timespec *abstime)
|
|
||||||
{
|
{
|
||||||
int64_t abs_milli = abstime->tv_sec * 1000LL + abstime->tv_nsec / 1000000;
|
cond->wait_count++;
|
||||||
ULONG t = av_clip64(abs_milli - av_gettime() / 1000, 0, ULONG_MAX);
|
|
||||||
|
|
||||||
__atomic_increment(&cond->wait_count);
|
|
||||||
|
|
||||||
pthread_mutex_unlock(mutex);
|
|
||||||
|
|
||||||
APIRET ret = DosWaitEventSem(cond->event_sem, t);
|
|
||||||
|
|
||||||
__atomic_decrement(&cond->wait_count);
|
|
||||||
|
|
||||||
DosPostEventSem(cond->ack_sem);
|
|
||||||
|
|
||||||
pthread_mutex_lock(mutex);
|
|
||||||
|
|
||||||
return (ret == ERROR_TIMEOUT) ? ETIMEDOUT : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static av_always_inline int pthread_cond_wait(pthread_cond_t *cond,
|
|
||||||
pthread_mutex_t *mutex)
|
|
||||||
{
|
|
||||||
__atomic_increment(&cond->wait_count);
|
|
||||||
|
|
||||||
pthread_mutex_unlock(mutex);
|
pthread_mutex_unlock(mutex);
|
||||||
|
|
||||||
DosWaitEventSem(cond->event_sem, SEM_INDEFINITE_WAIT);
|
DosWaitEventSem(cond->event_sem, SEM_INDEFINITE_WAIT);
|
||||||
|
|
||||||
__atomic_decrement(&cond->wait_count);
|
|
||||||
|
|
||||||
DosPostEventSem(cond->ack_sem);
|
|
||||||
|
|
||||||
pthread_mutex_lock(mutex);
|
pthread_mutex_lock(mutex);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_always_inline int pthread_once(pthread_once_t *once_control,
|
#endif /* AVCODEC_OS2PTHREADS_H */
|
||||||
void (*init_routine)(void))
|
|
||||||
{
|
|
||||||
if (!once_control->done)
|
|
||||||
{
|
|
||||||
_fmutex_request(&once_control->mtx, 0);
|
|
||||||
|
|
||||||
if (!once_control->done)
|
|
||||||
{
|
|
||||||
init_routine();
|
|
||||||
|
|
||||||
once_control->done = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
_fmutex_release(&once_control->mtx);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif /* COMPAT_OS2THREADS_H */
|
|
||||||
|
|||||||
10
compat/plan9/head
Executable file
10
compat/plan9/head
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
n=10
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
-n) n=$2; shift 2 ;;
|
||||||
|
-n*) n=${1#-n}; shift ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exec sed ${n}q "$@"
|
||||||
34
compat/plan9/main.c
Normal file
34
compat/plan9/main.c
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of FFmpeg.
|
||||||
|
*
|
||||||
|
* FFmpeg is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* FFmpeg is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with FFmpeg; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
int plan9_main(int argc, char **argv);
|
||||||
|
|
||||||
|
#undef main
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
/* The setfcr() function in lib9 is broken, must use asm. */
|
||||||
|
#ifdef __i386
|
||||||
|
short fcr;
|
||||||
|
__asm__ volatile ("fstcw %0 \n"
|
||||||
|
"or $63, %0 \n"
|
||||||
|
"fldcw %0 \n"
|
||||||
|
: "=m"(fcr));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return plan9_main(argc, argv);
|
||||||
|
}
|
||||||
2
compat/plan9/printf
Executable file
2
compat/plan9/printf
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
exec awk "BEGIN { for (i = 2; i < ARGC; i++) printf \"$1\", ARGV[i] }" "$@"
|
||||||
@@ -1,352 +0,0 @@
|
|||||||
#!/usr/bin/env perl
|
|
||||||
|
|
||||||
# make_sunver.pl
|
|
||||||
#
|
|
||||||
# Copyright (C) 2010, 2011, 2012, 2013
|
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
#
|
|
||||||
# This file is free software; you can redistribute it and/or modify it
|
|
||||||
# under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful, but
|
|
||||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
# General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; see the file COPYING.GPLv3. If not see
|
|
||||||
# <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This script takes at least two arguments, a GNU style version script and
|
|
||||||
# a list of object and archive files, and generates a corresponding Sun
|
|
||||||
# style version script as follows:
|
|
||||||
#
|
|
||||||
# Each glob pattern, C++ mangled pattern or literal in the input script is
|
|
||||||
# matched against all global symbols in the input objects, emitting those
|
|
||||||
# that matched (or nothing if no match was found).
|
|
||||||
# A comment with the original pattern and its type is left in the output
|
|
||||||
# file to make it easy to understand the matches.
|
|
||||||
#
|
|
||||||
# It uses elfdump when present (native), GNU readelf otherwise.
|
|
||||||
# It depends on the GNU version of c++filt, since it must understand the
|
|
||||||
# GNU mangling style.
|
|
||||||
|
|
||||||
use FileHandle;
|
|
||||||
use IPC::Open2;
|
|
||||||
|
|
||||||
# Enforce C locale.
|
|
||||||
$ENV{'LC_ALL'} = "C";
|
|
||||||
$ENV{'LANG'} = "C";
|
|
||||||
|
|
||||||
# Input version script, GNU style.
|
|
||||||
my $symvers = shift;
|
|
||||||
|
|
||||||
##########
|
|
||||||
# Get all the symbols from the library, match them, and add them to a hash.
|
|
||||||
|
|
||||||
my %sym_hash = ();
|
|
||||||
|
|
||||||
# List of objects and archives to process.
|
|
||||||
my @OBJECTS = ();
|
|
||||||
|
|
||||||
# List of shared objects to omit from processing.
|
|
||||||
my @SHAREDOBJS = ();
|
|
||||||
|
|
||||||
# Filter out those input archives that have corresponding shared objects to
|
|
||||||
# avoid adding all symbols matched in the archive to the output map.
|
|
||||||
foreach $file (@ARGV) {
|
|
||||||
if (($so = $file) =~ s/\.a$/.so/ && -e $so) {
|
|
||||||
printf STDERR "omitted $file -> $so\n";
|
|
||||||
push (@SHAREDOBJS, $so);
|
|
||||||
} else {
|
|
||||||
push (@OBJECTS, $file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# We need to detect and ignore hidden symbols. Solaris nm can only detect
|
|
||||||
# this in the harder to parse default output format, and GNU nm not at all,
|
|
||||||
# so use elfdump -s in the native case and GNU readelf -s otherwise.
|
|
||||||
# GNU objdump -t cannot be used since it produces a variable number of
|
|
||||||
# columns.
|
|
||||||
|
|
||||||
# The path to elfdump.
|
|
||||||
my $elfdump = "/usr/ccs/bin/elfdump";
|
|
||||||
|
|
||||||
if (-f $elfdump) {
|
|
||||||
open ELFDUMP,$elfdump.' -s '.(join ' ',@OBJECTS).'|' or die $!;
|
|
||||||
my $skip_arsym = 0;
|
|
||||||
|
|
||||||
while (<ELFDUMP>) {
|
|
||||||
chomp;
|
|
||||||
|
|
||||||
# Ignore empty lines.
|
|
||||||
if (/^$/) {
|
|
||||||
# End of archive symbol table, stop skipping.
|
|
||||||
$skip_arsym = 0 if $skip_arsym;
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Keep skipping until end of archive symbol table.
|
|
||||||
next if ($skip_arsym);
|
|
||||||
|
|
||||||
# Ignore object name header for individual objects and archives.
|
|
||||||
next if (/:$/);
|
|
||||||
|
|
||||||
# Ignore table header lines.
|
|
||||||
next if (/^Symbol Table Section:/);
|
|
||||||
next if (/index.*value.*size/);
|
|
||||||
|
|
||||||
# Start of archive symbol table: start skipping.
|
|
||||||
if (/^Symbol Table: \(archive/) {
|
|
||||||
$skip_arsym = 1;
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Split table.
|
|
||||||
(undef, undef, undef, undef, $bind, $oth, undef, $shndx, $name) = split;
|
|
||||||
|
|
||||||
# Error out for unknown input.
|
|
||||||
die "unknown input line:\n$_" unless defined($bind);
|
|
||||||
|
|
||||||
# Ignore local symbols.
|
|
||||||
next if ($bind eq "LOCL");
|
|
||||||
# Ignore hidden symbols.
|
|
||||||
next if ($oth eq "H");
|
|
||||||
# Ignore undefined symbols.
|
|
||||||
next if ($shndx eq "UNDEF");
|
|
||||||
# Error out for unhandled cases.
|
|
||||||
if ($bind !~ /^(GLOB|WEAK)/ or $oth ne "D") {
|
|
||||||
die "unhandled symbol:\n$_";
|
|
||||||
}
|
|
||||||
|
|
||||||
# Remember symbol.
|
|
||||||
$sym_hash{$name}++;
|
|
||||||
}
|
|
||||||
close ELFDUMP or die "$elfdump error";
|
|
||||||
} else {
|
|
||||||
open READELF, 'readelf -s -W '.(join ' ',@OBJECTS).'|' or die $!;
|
|
||||||
# Process each symbol.
|
|
||||||
while (<READELF>) {
|
|
||||||
chomp;
|
|
||||||
|
|
||||||
# Ignore empty lines.
|
|
||||||
next if (/^$/);
|
|
||||||
|
|
||||||
# Ignore object name header.
|
|
||||||
next if (/^File: .*$/);
|
|
||||||
|
|
||||||
# Ignore table header lines.
|
|
||||||
next if (/^Symbol table.*contains.*:/);
|
|
||||||
next if (/Num:.*Value.*Size/);
|
|
||||||
|
|
||||||
# Split table.
|
|
||||||
(undef, undef, undef, undef, $bind, $vis, $ndx, $name) = split;
|
|
||||||
|
|
||||||
# Error out for unknown input.
|
|
||||||
die "unknown input line:\n$_" unless defined($bind);
|
|
||||||
|
|
||||||
# Ignore local symbols.
|
|
||||||
next if ($bind eq "LOCAL");
|
|
||||||
# Ignore hidden symbols.
|
|
||||||
next if ($vis eq "HIDDEN");
|
|
||||||
# Ignore undefined symbols.
|
|
||||||
next if ($ndx eq "UND");
|
|
||||||
# Error out for unhandled cases.
|
|
||||||
if ($bind !~ /^(GLOBAL|WEAK)/ or $vis ne "DEFAULT") {
|
|
||||||
die "unhandled symbol:\n$_";
|
|
||||||
}
|
|
||||||
|
|
||||||
# Remember symbol.
|
|
||||||
$sym_hash{$name}++;
|
|
||||||
}
|
|
||||||
close READELF or die "readelf error";
|
|
||||||
}
|
|
||||||
|
|
||||||
##########
|
|
||||||
# The various types of glob patterns.
|
|
||||||
#
|
|
||||||
# A glob pattern that is to be applied to the demangled name: 'cxx'.
|
|
||||||
# A glob patterns that applies directly to the name in the .o files: 'glob'.
|
|
||||||
# This pattern is ignored; used for local variables (usually just '*'): 'ign'.
|
|
||||||
|
|
||||||
# The type of the current pattern.
|
|
||||||
my $glob = 'glob';
|
|
||||||
|
|
||||||
# We're currently inside `extern "C++"', which Sun ld doesn't understand.
|
|
||||||
my $in_extern = 0;
|
|
||||||
|
|
||||||
# The c++filt command to use. This *must* be GNU c++filt; the Sun Studio
|
|
||||||
# c++filt doesn't handle the GNU mangling style.
|
|
||||||
my $cxxfilt = $ENV{'CXXFILT'} || "c++filt";
|
|
||||||
|
|
||||||
# The current version name.
|
|
||||||
my $current_version = "";
|
|
||||||
|
|
||||||
# Was there any attempt to match a symbol to this version?
|
|
||||||
my $matches_attempted;
|
|
||||||
|
|
||||||
# The number of versions which matched this symbol.
|
|
||||||
my $matched_symbols;
|
|
||||||
|
|
||||||
open F,$symvers or die $!;
|
|
||||||
|
|
||||||
# Print information about generating this file
|
|
||||||
print "# This file was generated by make_sunver.pl. DO NOT EDIT!\n";
|
|
||||||
print "# It was generated by:\n";
|
|
||||||
printf "# %s %s %s\n", $0, $symvers, (join ' ',@ARGV);
|
|
||||||
printf "# Omitted archives with corresponding shared libraries: %s\n",
|
|
||||||
(join ' ', @SHAREDOBJS) if $#SHAREDOBJS >= 0;
|
|
||||||
print "#\n\n";
|
|
||||||
|
|
||||||
print "\$mapfile_version 2\n";
|
|
||||||
|
|
||||||
while (<F>) {
|
|
||||||
# Lines of the form '};'
|
|
||||||
if (/^([ \t]*)(\}[ \t]*;[ \t]*)$/) {
|
|
||||||
$glob = 'glob';
|
|
||||||
if ($in_extern) {
|
|
||||||
$in_extern--;
|
|
||||||
print "$1##$2\n";
|
|
||||||
} else {
|
|
||||||
print;
|
|
||||||
}
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Lines of the form '} SOME_VERSION_NAME_1.0;'
|
|
||||||
if (/^[ \t]*\}[ \tA-Z0-9_.a-z]+;[ \t]*$/) {
|
|
||||||
$glob = 'glob';
|
|
||||||
# We tried to match symbols agains this version, but none matched.
|
|
||||||
# Emit dummy hidden symbol to avoid marking this version WEAK.
|
|
||||||
if ($matches_attempted && $matched_symbols == 0) {
|
|
||||||
print " hidden:\n";
|
|
||||||
print " .force_WEAK_off_$current_version = DATA S0x0 V0x0;\n";
|
|
||||||
}
|
|
||||||
print; next;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Comment and blank lines
|
|
||||||
if (/^[ \t]*\#/) { print; next; }
|
|
||||||
if (/^[ \t]*$/) { print; next; }
|
|
||||||
|
|
||||||
# Lines of the form '{'
|
|
||||||
if (/^([ \t]*){$/) {
|
|
||||||
if ($in_extern) {
|
|
||||||
print "$1##{\n";
|
|
||||||
} else {
|
|
||||||
print;
|
|
||||||
}
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Lines of the form 'SOME_VERSION_NAME_1.1 {'
|
|
||||||
if (/^([A-Z0-9_.]+)[ \t]+{$/) {
|
|
||||||
# Record version name.
|
|
||||||
$current_version = $1;
|
|
||||||
# Reset match attempts, #matched symbols for this version.
|
|
||||||
$matches_attempted = 0;
|
|
||||||
$matched_symbols = 0;
|
|
||||||
print "SYMBOL_VERSION $1 {\n";
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Ignore 'global:'
|
|
||||||
if (/^[ \t]*global:$/) { print; next; }
|
|
||||||
|
|
||||||
# After 'local:', globs should be ignored, they won't be exported.
|
|
||||||
if (/^[ \t]*local:$/) {
|
|
||||||
$glob = 'ign';
|
|
||||||
print;
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
# After 'extern "C++"', globs are C++ patterns
|
|
||||||
if (/^([ \t]*)(extern \"C\+\+\"[ \t]*)$/) {
|
|
||||||
$in_extern++;
|
|
||||||
$glob = 'cxx';
|
|
||||||
# Need to comment, Sun ld cannot handle this.
|
|
||||||
print "$1##$2\n"; next;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Chomp newline now we're done with passing through the input file.
|
|
||||||
chomp;
|
|
||||||
|
|
||||||
# Catch globs. Note that '{}' is not allowed in globs by this script,
|
|
||||||
# so only '*' and '[]' are available.
|
|
||||||
if (/^([ \t]*)([^ \t;{}#]+);?[ \t]*$/) {
|
|
||||||
my $ws = $1;
|
|
||||||
my $ptn = $2;
|
|
||||||
# Turn the glob into a regex by replacing '*' with '.*', '?' with '.'.
|
|
||||||
# Keep $ptn so we can still print the original form.
|
|
||||||
($pattern = $ptn) =~ s/\*/\.\*/g;
|
|
||||||
$pattern =~ s/\?/\./g;
|
|
||||||
|
|
||||||
if ($glob eq 'ign') {
|
|
||||||
# We're in a local: * section; just continue.
|
|
||||||
print "$_\n";
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Print the glob commented for human readers.
|
|
||||||
print "$ws##$ptn ($glob)\n";
|
|
||||||
# We tried to match a symbol to this version.
|
|
||||||
$matches_attempted++;
|
|
||||||
|
|
||||||
if ($glob eq 'glob') {
|
|
||||||
my %ptn_syms = ();
|
|
||||||
|
|
||||||
# Match ptn against symbols in %sym_hash.
|
|
||||||
foreach my $sym (keys %sym_hash) {
|
|
||||||
# Maybe it matches one of the patterns based on the symbol in
|
|
||||||
# the .o file.
|
|
||||||
$ptn_syms{$sym}++ if ($sym =~ /^$pattern$/);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach my $sym (sort keys(%ptn_syms)) {
|
|
||||||
$matched_symbols++;
|
|
||||||
print "$ws$sym;\n";
|
|
||||||
}
|
|
||||||
} elsif ($glob eq 'cxx') {
|
|
||||||
my %dem_syms = ();
|
|
||||||
|
|
||||||
# Verify that we're actually using GNU c++filt. Other versions
|
|
||||||
# most likely cannot handle GNU style symbol mangling.
|
|
||||||
my $cxxout = `$cxxfilt --version 2>&1`;
|
|
||||||
$cxxout =~ m/GNU/ or die "$0 requires GNU c++filt to function";
|
|
||||||
|
|
||||||
# Talk to c++filt through a pair of file descriptors.
|
|
||||||
# Need to start a fresh instance per pattern, otherwise the
|
|
||||||
# process grows to 500+ MB.
|
|
||||||
my $pid = open2(*FILTIN, *FILTOUT, $cxxfilt) or die $!;
|
|
||||||
|
|
||||||
# Match ptn against symbols in %sym_hash.
|
|
||||||
foreach my $sym (keys %sym_hash) {
|
|
||||||
# No? Well, maybe its demangled form matches one of those
|
|
||||||
# patterns.
|
|
||||||
printf FILTOUT "%s\n",$sym;
|
|
||||||
my $dem = <FILTIN>;
|
|
||||||
chomp $dem;
|
|
||||||
$dem_syms{$sym}++ if ($dem =~ /^$pattern$/);
|
|
||||||
}
|
|
||||||
|
|
||||||
close FILTOUT or die "c++filt error";
|
|
||||||
close FILTIN or die "c++filt error";
|
|
||||||
# Need to wait for the c++filt process to avoid lots of zombies.
|
|
||||||
waitpid $pid, 0;
|
|
||||||
|
|
||||||
foreach my $sym (sort keys(%dem_syms)) {
|
|
||||||
$matched_symbols++;
|
|
||||||
print "$ws$sym;\n";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
# No? Well, then ignore it.
|
|
||||||
}
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
# Important sanity check. This script can't handle lots of formats
|
|
||||||
# that GNU ld can, so be sure to error out if one is seen!
|
|
||||||
die "strange line `$_'";
|
|
||||||
}
|
|
||||||
close F;
|
|
||||||
@@ -25,9 +25,9 @@
|
|||||||
#include "libavutil/avstring.h"
|
#include "libavutil/avstring.h"
|
||||||
#include "libavutil/mathematics.h"
|
#include "libavutil/mathematics.h"
|
||||||
|
|
||||||
static const char *check_nan_suffix(const char *s)
|
static char *check_nan_suffix(char *s)
|
||||||
{
|
{
|
||||||
const char *start = s;
|
char *start = s;
|
||||||
|
|
||||||
if (*s++ != '(')
|
if (*s++ != '(')
|
||||||
return start;
|
return start;
|
||||||
@@ -44,7 +44,7 @@ double strtod(const char *, char **);
|
|||||||
|
|
||||||
double avpriv_strtod(const char *nptr, char **endptr)
|
double avpriv_strtod(const char *nptr, char **endptr)
|
||||||
{
|
{
|
||||||
const char *end;
|
char *end;
|
||||||
double res;
|
double res;
|
||||||
|
|
||||||
/* Skip leading spaces */
|
/* Skip leading spaces */
|
||||||
@@ -81,13 +81,13 @@ double avpriv_strtod(const char *nptr, char **endptr)
|
|||||||
!av_strncasecmp(nptr, "+0x", 3)) {
|
!av_strncasecmp(nptr, "+0x", 3)) {
|
||||||
/* FIXME this doesn't handle exponents, non-integers (float/double)
|
/* FIXME this doesn't handle exponents, non-integers (float/double)
|
||||||
* and numbers too large for long long */
|
* and numbers too large for long long */
|
||||||
res = strtoll(nptr, (char **)&end, 16);
|
res = strtoll(nptr, &end, 16);
|
||||||
} else {
|
} else {
|
||||||
res = strtod(nptr, (char **)&end);
|
res = strtod(nptr, &end);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (endptr)
|
if (endptr)
|
||||||
*endptr = (char *)end;
|
*endptr = end;
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
30
compat/tms470/math.h
Normal file
30
compat/tms470/math.h
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of FFmpeg.
|
||||||
|
*
|
||||||
|
* FFmpeg is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* FFmpeg is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with FFmpeg; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FFMPEG_COMPAT_TMS470_MATH_H
|
||||||
|
#define FFMPEG_COMPAT_TMS470_MATH_H
|
||||||
|
|
||||||
|
#include_next <math.h>
|
||||||
|
|
||||||
|
#undef INFINITY
|
||||||
|
#undef NAN
|
||||||
|
|
||||||
|
#define INFINITY (*(const float*)((const unsigned []){ 0x7f800000 }))
|
||||||
|
#define NAN (*(const float*)((const unsigned []){ 0x7fc00000 }))
|
||||||
|
|
||||||
|
#endif /* FFMPEG_COMPAT_TMS470_MATH_H */
|
||||||
@@ -19,9 +19,6 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef COMPAT_VA_COPY_H
|
|
||||||
#define COMPAT_VA_COPY_H
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#if !defined(va_copy) && defined(_MSC_VER)
|
#if !defined(va_copy) && defined(_MSC_VER)
|
||||||
@@ -30,5 +27,3 @@
|
|||||||
#if !defined(va_copy) && defined(__GNUC__) && __GNUC__ < 3
|
#if !defined(va_copy) && defined(__GNUC__) && __GNUC__ < 3
|
||||||
#define va_copy(dst, src) __va_copy(dst, src)
|
#define va_copy(dst, src) __va_copy(dst, src)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* COMPAT_VA_COPY_H */
|
|
||||||
|
|||||||
@@ -1,94 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of FFmpeg.
|
|
||||||
*
|
|
||||||
* FFmpeg is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* FFmpeg is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with FFmpeg; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef COMPAT_W32DLFCN_H
|
|
||||||
#define COMPAT_W32DLFCN_H
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#include <windows.h>
|
|
||||||
#include "config.h"
|
|
||||||
#if (_WIN32_WINNT < 0x0602) || HAVE_WINRT
|
|
||||||
#include "libavutil/wchar_filename.h"
|
|
||||||
#endif
|
|
||||||
/**
|
|
||||||
* Safe function used to open dynamic libs. This attempts to improve program security
|
|
||||||
* by removing the current directory from the dll search path. Only dll's found in the
|
|
||||||
* executable or system directory are allowed to be loaded.
|
|
||||||
* @param name The dynamic lib name.
|
|
||||||
* @return A handle to the opened lib.
|
|
||||||
*/
|
|
||||||
static inline HMODULE win32_dlopen(const char *name)
|
|
||||||
{
|
|
||||||
#if _WIN32_WINNT < 0x0602
|
|
||||||
// Need to check if KB2533623 is available
|
|
||||||
if (!GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "SetDefaultDllDirectories")) {
|
|
||||||
HMODULE module = NULL;
|
|
||||||
wchar_t *path = NULL, *name_w = NULL;
|
|
||||||
DWORD pathlen;
|
|
||||||
if (utf8towchar(name, &name_w))
|
|
||||||
goto exit;
|
|
||||||
path = (wchar_t *)av_mallocz_array(MAX_PATH, sizeof(wchar_t));
|
|
||||||
// Try local directory first
|
|
||||||
pathlen = GetModuleFileNameW(NULL, path, MAX_PATH);
|
|
||||||
pathlen = wcsrchr(path, '\\') - path;
|
|
||||||
if (pathlen == 0 || pathlen + wcslen(name_w) + 2 > MAX_PATH)
|
|
||||||
goto exit;
|
|
||||||
path[pathlen] = '\\';
|
|
||||||
wcscpy(path + pathlen + 1, name_w);
|
|
||||||
module = LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
|
|
||||||
if (module == NULL) {
|
|
||||||
// Next try System32 directory
|
|
||||||
pathlen = GetSystemDirectoryW(path, MAX_PATH);
|
|
||||||
if (pathlen == 0 || pathlen + wcslen(name_w) + 2 > MAX_PATH)
|
|
||||||
goto exit;
|
|
||||||
path[pathlen] = '\\';
|
|
||||||
wcscpy(path + pathlen + 1, name_w);
|
|
||||||
module = LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
|
|
||||||
}
|
|
||||||
exit:
|
|
||||||
av_free(path);
|
|
||||||
av_free(name_w);
|
|
||||||
return module;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifndef LOAD_LIBRARY_SEARCH_APPLICATION_DIR
|
|
||||||
# define LOAD_LIBRARY_SEARCH_APPLICATION_DIR 0x00000200
|
|
||||||
#endif
|
|
||||||
#ifndef LOAD_LIBRARY_SEARCH_SYSTEM32
|
|
||||||
# define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800
|
|
||||||
#endif
|
|
||||||
#if HAVE_WINRT
|
|
||||||
wchar_t *name_w = NULL;
|
|
||||||
int ret;
|
|
||||||
if (utf8towchar(name, &name_w))
|
|
||||||
return NULL;
|
|
||||||
ret = LoadPackagedLibrary(name_w, 0);
|
|
||||||
av_free(name_w);
|
|
||||||
return ret;
|
|
||||||
#else
|
|
||||||
return LoadLibraryExA(name, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#define dlopen(name, flags) win32_dlopen(name)
|
|
||||||
#define dlclose FreeLibrary
|
|
||||||
#define dlsym GetProcAddress
|
|
||||||
#else
|
|
||||||
#include <dlfcn.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* COMPAT_W32DLFCN_H */
|
|
||||||
@@ -26,8 +26,8 @@
|
|||||||
* w32threads to pthreads wrapper
|
* w32threads to pthreads wrapper
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef COMPAT_W32PTHREADS_H
|
#ifndef FFMPEG_COMPAT_W32PTHREADS_H
|
||||||
#define COMPAT_W32PTHREADS_H
|
#define FFMPEG_COMPAT_W32PTHREADS_H
|
||||||
|
|
||||||
/* Build up a pthread-like API using underlying Windows API. Have only static
|
/* Build up a pthread-like API using underlying Windows API. Have only static
|
||||||
* methods so as to not conflict with a potentially linked in pthread-win32
|
* methods so as to not conflict with a potentially linked in pthread-win32
|
||||||
@@ -38,13 +38,10 @@
|
|||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
#include "libavutil/attributes.h"
|
|
||||||
#include "libavutil/common.h"
|
#include "libavutil/common.h"
|
||||||
#include "libavutil/internal.h"
|
#include "libavutil/internal.h"
|
||||||
#include "libavutil/mem.h"
|
#include "libavutil/mem.h"
|
||||||
#include "libavutil/time.h"
|
|
||||||
|
|
||||||
typedef struct pthread_t {
|
typedef struct pthread_t {
|
||||||
void *handle;
|
void *handle;
|
||||||
@@ -53,139 +50,233 @@ typedef struct pthread_t {
|
|||||||
void *ret;
|
void *ret;
|
||||||
} pthread_t;
|
} pthread_t;
|
||||||
|
|
||||||
/* use light weight mutex/condition variable API for Windows Vista and later */
|
/* the conditional variable api for windows 6.0+ uses critical sections and
|
||||||
typedef SRWLOCK pthread_mutex_t;
|
* not mutexes */
|
||||||
typedef CONDITION_VARIABLE pthread_cond_t;
|
typedef CRITICAL_SECTION pthread_mutex_t;
|
||||||
|
|
||||||
#define PTHREAD_MUTEX_INITIALIZER SRWLOCK_INIT
|
/* This is the CONDITIONAL_VARIABLE typedef for using Window's native
|
||||||
#define PTHREAD_COND_INITIALIZER CONDITION_VARIABLE_INIT
|
* conditional variables on kernels 6.0+.
|
||||||
|
* MinGW does not currently have this typedef. */
|
||||||
|
typedef struct pthread_cond_t {
|
||||||
|
void *ptr;
|
||||||
|
} pthread_cond_t;
|
||||||
|
|
||||||
#define InitializeCriticalSection(x) InitializeCriticalSectionEx(x, 0, 0)
|
/* function pointers to conditional variable API on windows 6.0+ kernels */
|
||||||
#define WaitForSingleObject(a, b) WaitForSingleObjectEx(a, b, FALSE)
|
#if _WIN32_WINNT < 0x0600
|
||||||
|
static void (WINAPI *cond_broadcast)(pthread_cond_t *cond);
|
||||||
|
static void (WINAPI *cond_init)(pthread_cond_t *cond);
|
||||||
|
static void (WINAPI *cond_signal)(pthread_cond_t *cond);
|
||||||
|
static BOOL (WINAPI *cond_wait)(pthread_cond_t *cond, pthread_mutex_t *mutex,
|
||||||
|
DWORD milliseconds);
|
||||||
|
#else
|
||||||
|
#define cond_init InitializeConditionVariable
|
||||||
|
#define cond_broadcast WakeAllConditionVariable
|
||||||
|
#define cond_signal WakeConditionVariable
|
||||||
|
#define cond_wait SleepConditionVariableCS
|
||||||
|
#endif
|
||||||
|
|
||||||
#define PTHREAD_CANCEL_ENABLE 1
|
static unsigned __stdcall attribute_align_arg win32thread_worker(void *arg)
|
||||||
#define PTHREAD_CANCEL_DISABLE 0
|
|
||||||
|
|
||||||
static av_unused unsigned __stdcall attribute_align_arg win32thread_worker(void *arg)
|
|
||||||
{
|
{
|
||||||
pthread_t *h = (pthread_t*)arg;
|
pthread_t *h = arg;
|
||||||
h->ret = h->func(h->arg);
|
h->ret = h->func(h->arg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_unused int pthread_create(pthread_t *thread, const void *unused_attr,
|
static int pthread_create(pthread_t *thread, const void *unused_attr,
|
||||||
void *(*start_routine)(void*), void *arg)
|
void *(*start_routine)(void*), void *arg)
|
||||||
{
|
{
|
||||||
thread->func = start_routine;
|
thread->func = start_routine;
|
||||||
thread->arg = arg;
|
thread->arg = arg;
|
||||||
#if HAVE_WINRT
|
|
||||||
thread->handle = (void*)CreateThread(NULL, 0, win32thread_worker, thread,
|
|
||||||
0, NULL);
|
|
||||||
#else
|
|
||||||
thread->handle = (void*)_beginthreadex(NULL, 0, win32thread_worker, thread,
|
thread->handle = (void*)_beginthreadex(NULL, 0, win32thread_worker, thread,
|
||||||
0, NULL);
|
0, NULL);
|
||||||
#endif
|
|
||||||
return !thread->handle;
|
return !thread->handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_unused int pthread_join(pthread_t thread, void **value_ptr)
|
static void pthread_join(pthread_t thread, void **value_ptr)
|
||||||
{
|
{
|
||||||
DWORD ret = WaitForSingleObject(thread.handle, INFINITE);
|
DWORD ret = WaitForSingleObject(thread.handle, INFINITE);
|
||||||
if (ret != WAIT_OBJECT_0) {
|
if (ret != WAIT_OBJECT_0)
|
||||||
if (ret == WAIT_ABANDONED)
|
return;
|
||||||
return EINVAL;
|
|
||||||
else
|
|
||||||
return EDEADLK;
|
|
||||||
}
|
|
||||||
if (value_ptr)
|
if (value_ptr)
|
||||||
*value_ptr = thread.ret;
|
*value_ptr = thread.ret;
|
||||||
CloseHandle(thread.handle);
|
CloseHandle(thread.handle);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int pthread_mutex_init(pthread_mutex_t *m, void* attr)
|
static inline int pthread_mutex_init(pthread_mutex_t *m, void* attr)
|
||||||
{
|
{
|
||||||
InitializeSRWLock(m);
|
InitializeCriticalSection(m);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static inline int pthread_mutex_destroy(pthread_mutex_t *m)
|
static inline int pthread_mutex_destroy(pthread_mutex_t *m)
|
||||||
{
|
{
|
||||||
/* Unlocked SWR locks use no resources */
|
DeleteCriticalSection(m);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static inline int pthread_mutex_lock(pthread_mutex_t *m)
|
static inline int pthread_mutex_lock(pthread_mutex_t *m)
|
||||||
{
|
{
|
||||||
AcquireSRWLockExclusive(m);
|
EnterCriticalSection(m);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static inline int pthread_mutex_unlock(pthread_mutex_t *m)
|
static inline int pthread_mutex_unlock(pthread_mutex_t *m)
|
||||||
{
|
{
|
||||||
ReleaseSRWLockExclusive(m);
|
LeaveCriticalSection(m);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef INIT_ONCE pthread_once_t;
|
/* for pre-Windows 6.0 platforms we need to define and use our own condition
|
||||||
#define PTHREAD_ONCE_INIT INIT_ONCE_STATIC_INIT
|
* variable and api */
|
||||||
|
typedef struct win32_cond_t {
|
||||||
|
pthread_mutex_t mtx_broadcast;
|
||||||
|
pthread_mutex_t mtx_waiter_count;
|
||||||
|
volatile int waiter_count;
|
||||||
|
HANDLE semaphore;
|
||||||
|
HANDLE waiters_done;
|
||||||
|
volatile int is_broadcast;
|
||||||
|
} win32_cond_t;
|
||||||
|
|
||||||
static av_unused int pthread_once(pthread_once_t *once_control, void (*init_routine)(void))
|
static void pthread_cond_init(pthread_cond_t *cond, const void *unused_attr)
|
||||||
{
|
{
|
||||||
BOOL pending = FALSE;
|
win32_cond_t *win32_cond = NULL;
|
||||||
InitOnceBeginInitialize(once_control, 0, &pending, NULL);
|
if (cond_init) {
|
||||||
if (pending)
|
cond_init(cond);
|
||||||
init_routine();
|
return;
|
||||||
InitOnceComplete(once_control, 0, NULL);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int pthread_cond_init(pthread_cond_t *cond, const void *unused_attr)
|
|
||||||
{
|
|
||||||
InitializeConditionVariable(cond);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* native condition variables do not destroy */
|
|
||||||
static inline int pthread_cond_destroy(pthread_cond_t *cond)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int pthread_cond_broadcast(pthread_cond_t *cond)
|
|
||||||
{
|
|
||||||
WakeAllConditionVariable(cond);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
|
|
||||||
{
|
|
||||||
SleepConditionVariableSRW(cond, mutex, INFINITE, 0);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
|
|
||||||
const struct timespec *abstime)
|
|
||||||
{
|
|
||||||
int64_t abs_milli = abstime->tv_sec * 1000LL + abstime->tv_nsec / 1000000;
|
|
||||||
DWORD t = av_clip64(abs_milli - av_gettime() / 1000, 0, UINT32_MAX);
|
|
||||||
|
|
||||||
if (!SleepConditionVariableSRW(cond, mutex, t, 0)) {
|
|
||||||
DWORD err = GetLastError();
|
|
||||||
if (err == ERROR_TIMEOUT)
|
|
||||||
return ETIMEDOUT;
|
|
||||||
else
|
|
||||||
return EINVAL;
|
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
|
/* non native condition variables */
|
||||||
|
win32_cond = av_mallocz(sizeof(win32_cond_t));
|
||||||
|
if (!win32_cond)
|
||||||
|
return;
|
||||||
|
cond->ptr = win32_cond;
|
||||||
|
win32_cond->semaphore = CreateSemaphore(NULL, 0, 0x7fffffff, NULL);
|
||||||
|
if (!win32_cond->semaphore)
|
||||||
|
return;
|
||||||
|
win32_cond->waiters_done = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||||
|
if (!win32_cond->waiters_done)
|
||||||
|
return;
|
||||||
|
|
||||||
|
pthread_mutex_init(&win32_cond->mtx_waiter_count, NULL);
|
||||||
|
pthread_mutex_init(&win32_cond->mtx_broadcast, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int pthread_cond_signal(pthread_cond_t *cond)
|
static void pthread_cond_destroy(pthread_cond_t *cond)
|
||||||
{
|
{
|
||||||
WakeConditionVariable(cond);
|
win32_cond_t *win32_cond = cond->ptr;
|
||||||
return 0;
|
/* native condition variables do not destroy */
|
||||||
|
if (cond_init)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* non native condition variables */
|
||||||
|
CloseHandle(win32_cond->semaphore);
|
||||||
|
CloseHandle(win32_cond->waiters_done);
|
||||||
|
pthread_mutex_destroy(&win32_cond->mtx_waiter_count);
|
||||||
|
pthread_mutex_destroy(&win32_cond->mtx_broadcast);
|
||||||
|
av_freep(&win32_cond);
|
||||||
|
cond->ptr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int pthread_setcancelstate(int state, int *oldstate)
|
static void pthread_cond_broadcast(pthread_cond_t *cond)
|
||||||
{
|
{
|
||||||
return 0;
|
win32_cond_t *win32_cond = cond->ptr;
|
||||||
|
int have_waiter;
|
||||||
|
|
||||||
|
if (cond_broadcast) {
|
||||||
|
cond_broadcast(cond);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* non native condition variables */
|
||||||
|
pthread_mutex_lock(&win32_cond->mtx_broadcast);
|
||||||
|
pthread_mutex_lock(&win32_cond->mtx_waiter_count);
|
||||||
|
have_waiter = 0;
|
||||||
|
|
||||||
|
if (win32_cond->waiter_count) {
|
||||||
|
win32_cond->is_broadcast = 1;
|
||||||
|
have_waiter = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (have_waiter) {
|
||||||
|
ReleaseSemaphore(win32_cond->semaphore, win32_cond->waiter_count, NULL);
|
||||||
|
pthread_mutex_unlock(&win32_cond->mtx_waiter_count);
|
||||||
|
WaitForSingleObject(win32_cond->waiters_done, INFINITE);
|
||||||
|
ResetEvent(win32_cond->waiters_done);
|
||||||
|
win32_cond->is_broadcast = 0;
|
||||||
|
} else
|
||||||
|
pthread_mutex_unlock(&win32_cond->mtx_waiter_count);
|
||||||
|
pthread_mutex_unlock(&win32_cond->mtx_broadcast);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* COMPAT_W32PTHREADS_H */
|
static int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
|
||||||
|
{
|
||||||
|
win32_cond_t *win32_cond = cond->ptr;
|
||||||
|
int last_waiter;
|
||||||
|
if (cond_wait) {
|
||||||
|
cond_wait(cond, mutex, INFINITE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* non native condition variables */
|
||||||
|
pthread_mutex_lock(&win32_cond->mtx_broadcast);
|
||||||
|
pthread_mutex_lock(&win32_cond->mtx_waiter_count);
|
||||||
|
win32_cond->waiter_count++;
|
||||||
|
pthread_mutex_unlock(&win32_cond->mtx_waiter_count);
|
||||||
|
pthread_mutex_unlock(&win32_cond->mtx_broadcast);
|
||||||
|
|
||||||
|
// unlock the external mutex
|
||||||
|
pthread_mutex_unlock(mutex);
|
||||||
|
WaitForSingleObject(win32_cond->semaphore, INFINITE);
|
||||||
|
|
||||||
|
pthread_mutex_lock(&win32_cond->mtx_waiter_count);
|
||||||
|
win32_cond->waiter_count--;
|
||||||
|
last_waiter = !win32_cond->waiter_count || !win32_cond->is_broadcast;
|
||||||
|
pthread_mutex_unlock(&win32_cond->mtx_waiter_count);
|
||||||
|
|
||||||
|
if (last_waiter)
|
||||||
|
SetEvent(win32_cond->waiters_done);
|
||||||
|
|
||||||
|
// lock the external mutex
|
||||||
|
return pthread_mutex_lock(mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void pthread_cond_signal(pthread_cond_t *cond)
|
||||||
|
{
|
||||||
|
win32_cond_t *win32_cond = cond->ptr;
|
||||||
|
int have_waiter;
|
||||||
|
if (cond_signal) {
|
||||||
|
cond_signal(cond);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pthread_mutex_lock(&win32_cond->mtx_broadcast);
|
||||||
|
|
||||||
|
/* non-native condition variables */
|
||||||
|
pthread_mutex_lock(&win32_cond->mtx_waiter_count);
|
||||||
|
have_waiter = win32_cond->waiter_count;
|
||||||
|
pthread_mutex_unlock(&win32_cond->mtx_waiter_count);
|
||||||
|
|
||||||
|
if (have_waiter) {
|
||||||
|
ReleaseSemaphore(win32_cond->semaphore, 1, NULL);
|
||||||
|
WaitForSingleObject(win32_cond->waiters_done, INFINITE);
|
||||||
|
ResetEvent(win32_cond->waiters_done);
|
||||||
|
}
|
||||||
|
|
||||||
|
pthread_mutex_unlock(&win32_cond->mtx_broadcast);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void w32thread_init(void)
|
||||||
|
{
|
||||||
|
#if _WIN32_WINNT < 0x0600
|
||||||
|
HANDLE kernel_dll = GetModuleHandle(TEXT("kernel32.dll"));
|
||||||
|
/* if one is available, then they should all be available */
|
||||||
|
cond_init =
|
||||||
|
(void*)GetProcAddress(kernel_dll, "InitializeConditionVariable");
|
||||||
|
cond_broadcast =
|
||||||
|
(void*)GetProcAddress(kernel_dll, "WakeAllConditionVariable");
|
||||||
|
cond_signal =
|
||||||
|
(void*)GetProcAddress(kernel_dll, "WakeConditionVariable");
|
||||||
|
cond_wait =
|
||||||
|
(void*)GetProcAddress(kernel_dll, "SleepConditionVariableCS");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* FFMPEG_COMPAT_W32PTHREADS_H */
|
||||||
|
|||||||
@@ -45,11 +45,7 @@ libname=$(mktemp -u "library").lib
|
|||||||
|
|
||||||
trap 'rm -f -- $libname' EXIT
|
trap 'rm -f -- $libname' EXIT
|
||||||
|
|
||||||
if [ -n "$AR" ]; then
|
lib -out:${libname} $@ >/dev/null
|
||||||
$AR rcs ${libname} $@ >/dev/null
|
|
||||||
else
|
|
||||||
lib.exe -out:${libname} $@ >/dev/null
|
|
||||||
fi
|
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
echo "Could not create temporary library." >&2
|
echo "Could not create temporary library." >&2
|
||||||
exit 1
|
exit 1
|
||||||
@@ -58,7 +54,23 @@ fi
|
|||||||
IFS='
|
IFS='
|
||||||
'
|
'
|
||||||
|
|
||||||
prefix="$EXTERN_PREFIX"
|
# Determine if we're building for x86 or x86_64 and
|
||||||
|
# set the symbol prefix accordingly.
|
||||||
|
prefix=""
|
||||||
|
arch=$(dumpbin -headers ${libname} |
|
||||||
|
tr '\t' ' ' |
|
||||||
|
grep '^ \+.\+machine \+(.\+)' |
|
||||||
|
head -1 |
|
||||||
|
sed -e 's/^ \{1,\}.\{1,\} \{1,\}machine \{1,\}(\(...\)).*/\1/')
|
||||||
|
|
||||||
|
if [ "${arch}" = "x86" ]; then
|
||||||
|
prefix="_"
|
||||||
|
else
|
||||||
|
if [ "${arch}" != "ARM" ] && [ "${arch}" != "x64" ]; then
|
||||||
|
echo "Unknown machine type." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
started=0
|
started=0
|
||||||
regex="none"
|
regex="none"
|
||||||
@@ -100,19 +112,7 @@ for line in $(cat ${vscript} | tr '\t' ' '); do
|
|||||||
'
|
'
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -n "$NM" ]; then
|
dump=$(dumpbin -linkermember:1 ${libname})
|
||||||
# Use eval, since NM="nm -g"
|
|
||||||
dump=$(eval "$NM --defined-only -g ${libname}" |
|
|
||||||
grep -v : |
|
|
||||||
grep -v ^$ |
|
|
||||||
cut -d' ' -f3 |
|
|
||||||
sed -e "s/^${prefix}//")
|
|
||||||
else
|
|
||||||
dump=$(dumpbin.exe -linkermember:1 ${libname} |
|
|
||||||
sed -e '/public symbols/,$!d' -e '/^ \{1,\}Summary/,$d' -e "s/ \{1,\}${prefix}/ /" -e 's/ \{1,\}/ /g' |
|
|
||||||
tail -n +2 |
|
|
||||||
cut -d' ' -f3)
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm ${libname}
|
rm ${libname}
|
||||||
|
|
||||||
@@ -121,6 +121,9 @@ list=""
|
|||||||
for exp in ${regex}; do
|
for exp in ${regex}; do
|
||||||
list="${list}"'
|
list="${list}"'
|
||||||
'$(echo "${dump}" |
|
'$(echo "${dump}" |
|
||||||
|
sed -e '/public symbols/,$!d' -e '/^ \{1,\}Summary/,$d' -e "s/ \{1,\}${prefix}/ /" -e 's/ \{1,\}/ /g' |
|
||||||
|
tail -n +2 |
|
||||||
|
cut -d' ' -f3 |
|
||||||
grep "^${exp}" |
|
grep "^${exp}" |
|
||||||
sed -e 's/^/ /')
|
sed -e 's/^/ /')
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
LINK_EXE_PATH=$(dirname "$(command -v cl)")/link
|
|
||||||
if [ -x "$LINK_EXE_PATH" ]; then
|
|
||||||
"$LINK_EXE_PATH" $@
|
|
||||||
else
|
|
||||||
link.exe $@
|
|
||||||
fi
|
|
||||||
exit $?
|
|
||||||
9
doc/.gitignore
vendored
9
doc/.gitignore
vendored
@@ -1,9 +0,0 @@
|
|||||||
/*.1
|
|
||||||
/*.3
|
|
||||||
/*.html
|
|
||||||
/*.pod
|
|
||||||
/config.texi
|
|
||||||
/avoptions_codec.texi
|
|
||||||
/avoptions_format.texi
|
|
||||||
/fate.txt
|
|
||||||
/print_options
|
|
||||||
1585
doc/APIchanges
1585
doc/APIchanges
File diff suppressed because it is too large
Load Diff
2427
doc/Doxyfile
2427
doc/Doxyfile
File diff suppressed because it is too large
Load Diff
55
doc/Makefile
55
doc/Makefile
@@ -24,7 +24,6 @@ HTMLPAGES = $(AVPROGS-yes:%=doc/%.html) $(AVPROGS-yes:%=doc/%-all.html) $(COMP
|
|||||||
doc/fate.html \
|
doc/fate.html \
|
||||||
doc/general.html \
|
doc/general.html \
|
||||||
doc/git-howto.html \
|
doc/git-howto.html \
|
||||||
doc/mailing-list-faq.html \
|
|
||||||
doc/nut.html \
|
doc/nut.html \
|
||||||
doc/platform.html \
|
doc/platform.html \
|
||||||
|
|
||||||
@@ -37,6 +36,25 @@ DOCS-$(CONFIG_MANPAGES) += $(MANPAGES)
|
|||||||
DOCS-$(CONFIG_TXTPAGES) += $(TXTPAGES)
|
DOCS-$(CONFIG_TXTPAGES) += $(TXTPAGES)
|
||||||
DOCS = $(DOCS-yes)
|
DOCS = $(DOCS-yes)
|
||||||
|
|
||||||
|
DOC_EXAMPLES-$(CONFIG_AVIO_READING_EXAMPLE) += avio_reading
|
||||||
|
DOC_EXAMPLES-$(CONFIG_AVCODEC_EXAMPLE) += avcodec
|
||||||
|
DOC_EXAMPLES-$(CONFIG_DEMUXING_DECODING_EXAMPLE) += demuxing_decoding
|
||||||
|
DOC_EXAMPLES-$(CONFIG_FILTER_AUDIO_EXAMPLE) += filter_audio
|
||||||
|
DOC_EXAMPLES-$(CONFIG_FILTERING_AUDIO_EXAMPLE) += filtering_audio
|
||||||
|
DOC_EXAMPLES-$(CONFIG_FILTERING_VIDEO_EXAMPLE) += filtering_video
|
||||||
|
DOC_EXAMPLES-$(CONFIG_METADATA_EXAMPLE) += metadata
|
||||||
|
DOC_EXAMPLES-$(CONFIG_MUXING_EXAMPLE) += muxing
|
||||||
|
DOC_EXAMPLES-$(CONFIG_REMUXING_EXAMPLE) += remuxing
|
||||||
|
DOC_EXAMPLES-$(CONFIG_RESAMPLING_AUDIO_EXAMPLE) += resampling_audio
|
||||||
|
DOC_EXAMPLES-$(CONFIG_SCALING_VIDEO_EXAMPLE) += scaling_video
|
||||||
|
DOC_EXAMPLES-$(CONFIG_TRANSCODE_AAC_EXAMPLE) += transcode_aac
|
||||||
|
ALL_DOC_EXAMPLES_LIST = $(DOC_EXAMPLES-) $(DOC_EXAMPLES-yes)
|
||||||
|
|
||||||
|
DOC_EXAMPLES := $(DOC_EXAMPLES-yes:%=doc/examples/%$(PROGSSUF)$(EXESUF))
|
||||||
|
ALL_DOC_EXAMPLES := $(ALL_DOC_EXAMPLES_LIST:%=doc/examples/%$(PROGSSUF)$(EXESUF))
|
||||||
|
ALL_DOC_EXAMPLES_G := $(ALL_DOC_EXAMPLES_LIST:%=doc/examples/%$(PROGSSUF)_g$(EXESUF))
|
||||||
|
PROGS += $(DOC_EXAMPLES)
|
||||||
|
|
||||||
all-$(CONFIG_DOC): doc
|
all-$(CONFIG_DOC): doc
|
||||||
|
|
||||||
doc: documentation
|
doc: documentation
|
||||||
@@ -44,6 +62,8 @@ doc: documentation
|
|||||||
apidoc: doc/doxy/html
|
apidoc: doc/doxy/html
|
||||||
documentation: $(DOCS)
|
documentation: $(DOCS)
|
||||||
|
|
||||||
|
examples: $(DOC_EXAMPLES)
|
||||||
|
|
||||||
TEXIDEP = perl $(SRC_PATH)/doc/texidep.pl $(SRC_PATH) $< $@ >$(@:%=%.d)
|
TEXIDEP = perl $(SRC_PATH)/doc/texidep.pl $(SRC_PATH) $< $@ >$(@:%=%.d)
|
||||||
|
|
||||||
doc/%.txt: TAG = TXT
|
doc/%.txt: TAG = TXT
|
||||||
@@ -59,25 +79,14 @@ $(GENTEXI): doc/avoptions_%.texi: doc/print_options$(HOSTEXESUF)
|
|||||||
$(M)doc/print_options $* > $@
|
$(M)doc/print_options $* > $@
|
||||||
|
|
||||||
doc/%.html: TAG = HTML
|
doc/%.html: TAG = HTML
|
||||||
doc/%-all.html: TAG = HTML
|
|
||||||
|
|
||||||
ifdef HAVE_MAKEINFO_HTML
|
|
||||||
doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.pm $(GENTEXI)
|
|
||||||
$(Q)$(TEXIDEP)
|
|
||||||
$(M)makeinfo --html -I doc --no-split -D config-not-all --init-file=$(SRC_PATH)/doc/t2h.pm --output $@ $<
|
|
||||||
|
|
||||||
doc/%-all.html: doc/%.texi $(SRC_PATH)/doc/t2h.pm $(GENTEXI)
|
|
||||||
$(Q)$(TEXIDEP)
|
|
||||||
$(M)makeinfo --html -I doc --no-split -D config-all --init-file=$(SRC_PATH)/doc/t2h.pm --output $@ $<
|
|
||||||
else
|
|
||||||
doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.init $(GENTEXI)
|
doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.init $(GENTEXI)
|
||||||
$(Q)$(TEXIDEP)
|
$(Q)$(TEXIDEP)
|
||||||
$(M)texi2html -I doc -monolithic --D=config-not-all --init-file $(SRC_PATH)/doc/t2h.init --output $@ $<
|
$(M)texi2html -I doc -monolithic --D=config-not-all --init-file $(SRC_PATH)/doc/t2h.init --output $@ $<
|
||||||
|
|
||||||
|
doc/%-all.html: TAG = HTML
|
||||||
doc/%-all.html: doc/%.texi $(SRC_PATH)/doc/t2h.init $(GENTEXI)
|
doc/%-all.html: doc/%.texi $(SRC_PATH)/doc/t2h.init $(GENTEXI)
|
||||||
$(Q)$(TEXIDEP)
|
$(Q)$(TEXIDEP)
|
||||||
$(M)texi2html -I doc -monolithic --D=config-all --init-file $(SRC_PATH)/doc/t2h.init --output $@ $<
|
$(M)texi2html -I doc -monolithic --D=config-all --init-file $(SRC_PATH)/doc/t2h.init --output $@ $<
|
||||||
endif
|
|
||||||
|
|
||||||
doc/%.pod: TAG = POD
|
doc/%.pod: TAG = POD
|
||||||
doc/%.pod: doc/%.texi $(SRC_PATH)/doc/texi2pod.pl $(GENTEXI)
|
doc/%.pod: doc/%.texi $(SRC_PATH)/doc/texi2pod.pl $(GENTEXI)
|
||||||
@@ -91,18 +100,18 @@ doc/%-all.pod: doc/%.texi $(SRC_PATH)/doc/texi2pod.pl $(GENTEXI)
|
|||||||
|
|
||||||
doc/%.1 doc/%.3: TAG = MAN
|
doc/%.1 doc/%.3: TAG = MAN
|
||||||
doc/%.1: doc/%.pod $(GENTEXI)
|
doc/%.1: doc/%.pod $(GENTEXI)
|
||||||
$(M)pod2man --section=1 --center=" " --release=" " --date=" " $< > $@
|
$(M)pod2man --section=1 --center=" " --release=" " $< > $@
|
||||||
doc/%.3: doc/%.pod $(GENTEXI)
|
doc/%.3: doc/%.pod $(GENTEXI)
|
||||||
$(M)pod2man --section=3 --center=" " --release=" " --date=" " $< > $@
|
$(M)pod2man --section=3 --center=" " --release=" " $< > $@
|
||||||
|
|
||||||
$(DOCS) doc/doxy/html: | doc/
|
$(DOCS) doc/doxy/html: | doc/
|
||||||
|
$(DOC_EXAMPLES:%$(EXESUF)=%.o): | doc/examples
|
||||||
|
OBJDIRS += doc/examples
|
||||||
|
|
||||||
DOXY_INPUT = $(INSTHEADERS)
|
DOXY_INPUT = $(addprefix $(SRC_PATH)/, $(INSTHEADERS) $(DOC_EXAMPLES:%$(EXESUF)=%.c) $(LIB_EXAMPLES:%$(EXESUF)=%.c))
|
||||||
DOXY_INPUT_DEPS = $(addprefix $(SRC_PATH)/, $(DOXY_INPUT)) ffbuild/config.mak
|
|
||||||
|
|
||||||
doc/doxy/html: TAG = DOXY
|
doc/doxy/html: $(SRC_PATH)/doc/Doxyfile $(DOXY_INPUT)
|
||||||
doc/doxy/html: $(SRC_PATH)/doc/Doxyfile $(SRC_PATH)/doc/doxy-wrapper.sh $(DOXY_INPUT_DEPS)
|
$(M)$(SRC_PATH)/doc/doxy-wrapper.sh $(SRC_PATH) $< $(DOXY_INPUT)
|
||||||
$(M)OUT_DIR=$$PWD/doc/doxy; cd $(SRC_PATH); ./doc/doxy-wrapper.sh $$OUT_DIR $< $(DOXYGEN) $(DOXY_INPUT);
|
|
||||||
|
|
||||||
install-doc: install-html install-man
|
install-doc: install-html install-man
|
||||||
|
|
||||||
@@ -144,7 +153,11 @@ clean:: docclean
|
|||||||
distclean:: docclean
|
distclean:: docclean
|
||||||
$(RM) doc/config.texi
|
$(RM) doc/config.texi
|
||||||
|
|
||||||
docclean::
|
examplesclean:
|
||||||
|
$(RM) $(ALL_DOC_EXAMPLES) $(ALL_DOC_EXAMPLES_G)
|
||||||
|
$(RM) $(CLEANSUFFIXES:%=doc/examples/%)
|
||||||
|
|
||||||
|
docclean: examplesclean
|
||||||
$(RM) $(CLEANSUFFIXES:%=doc/%)
|
$(RM) $(CLEANSUFFIXES:%=doc/%)
|
||||||
$(RM) $(TXTPAGES) doc/*.html doc/*.pod doc/*.1 doc/*.3 doc/avoptions_*.texi
|
$(RM) $(TXTPAGES) doc/*.html doc/*.pod doc/*.1 doc/*.3 doc/avoptions_*.texi
|
||||||
$(RM) -r doc/doxy/html
|
$(RM) -r doc/doxy/html
|
||||||
|
|||||||
16
doc/RELEASE_NOTES
Normal file
16
doc/RELEASE_NOTES
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
Release Notes
|
||||||
|
=============
|
||||||
|
|
||||||
|
* 2.2 "Muybridge" March, 2014
|
||||||
|
|
||||||
|
|
||||||
|
General notes
|
||||||
|
-------------
|
||||||
|
See the Changelog file for a list of significant changes. Note, there
|
||||||
|
are many more new features and bugfixes than whats listed there.
|
||||||
|
|
||||||
|
Bugreports against FFmpeg git master or the most recent FFmpeg release are
|
||||||
|
accepted. If you are experiencing issues with any formally released version of
|
||||||
|
FFmpeg, please try git master to check if the issue still exists. If it does,
|
||||||
|
make your report against the development code following the usual bug reporting
|
||||||
|
guidelines.
|
||||||
@@ -3,9 +3,9 @@
|
|||||||
The FFmpeg developers.
|
The FFmpeg developers.
|
||||||
|
|
||||||
For details about the authorship, see the Git history of the project
|
For details about the authorship, see the Git history of the project
|
||||||
(https://git.ffmpeg.org/ffmpeg), e.g. by typing the command
|
(git://source.ffmpeg.org/ffmpeg), e.g. by typing the command
|
||||||
@command{git log} in the FFmpeg source directory, or browsing the
|
@command{git log} in the FFmpeg source directory, or browsing the
|
||||||
online repository at @url{https://git.ffmpeg.org/ffmpeg}.
|
online repository at @url{http://source.ffmpeg.org}.
|
||||||
|
|
||||||
Maintainers for the specific components are listed in the file
|
Maintainers for the specific components are listed in the file
|
||||||
@file{MAINTAINERS} in the source code tree.
|
@file{MAINTAINERS} in the source code tree.
|
||||||
|
|||||||
@@ -13,114 +13,40 @@ bitstream filter using the option @code{--disable-bsf=BSF}.
|
|||||||
The option @code{-bsfs} of the ff* tools will display the list of
|
The option @code{-bsfs} of the ff* tools will display the list of
|
||||||
all the supported bitstream filters included in your build.
|
all the supported bitstream filters included in your build.
|
||||||
|
|
||||||
The ff* tools have a -bsf option applied per stream, taking a
|
Below is a description of the currently available bitstream filters.
|
||||||
comma-separated list of filters, whose parameters follow the filter
|
|
||||||
name after a '='.
|
|
||||||
|
|
||||||
@example
|
|
||||||
ffmpeg -i INPUT -c:v copy -bsf:v filter1[=opt1=str1:opt2=str2][,filter2] OUTPUT
|
|
||||||
@end example
|
|
||||||
|
|
||||||
Below is a description of the currently available bitstream filters,
|
|
||||||
with their parameters, if any.
|
|
||||||
|
|
||||||
@section aac_adtstoasc
|
@section aac_adtstoasc
|
||||||
|
|
||||||
Convert MPEG-2/4 AAC ADTS to an MPEG-4 Audio Specific Configuration
|
Convert MPEG-2/4 AAC ADTS to MPEG-4 Audio Specific Configuration
|
||||||
bitstream.
|
bitstream filter.
|
||||||
|
|
||||||
This filter creates an MPEG-4 AudioSpecificConfig from an MPEG-2/4
|
This filter creates an MPEG-4 AudioSpecificConfig from an MPEG-2/4
|
||||||
ADTS header and removes the ADTS header.
|
ADTS header and removes the ADTS header.
|
||||||
|
|
||||||
This filter is required for example when copying an AAC stream from a
|
This is required for example when copying an AAC stream from a raw
|
||||||
raw ADTS AAC or an MPEG-TS container to MP4A-LATM, to an FLV file, or
|
ADTS AAC container to a FLV or a MOV/MP4 file.
|
||||||
to MOV/MP4 files and related formats such as 3GP or M4A. Please note
|
|
||||||
that it is auto-inserted for MP4A-LATM and MOV/MP4 and related formats.
|
|
||||||
|
|
||||||
@section av1_metadata
|
|
||||||
|
|
||||||
Modify metadata embedded in an AV1 stream.
|
|
||||||
|
|
||||||
@table @option
|
|
||||||
@item td
|
|
||||||
Insert or remove temporal delimiter OBUs in all temporal units of the
|
|
||||||
stream.
|
|
||||||
|
|
||||||
@table @samp
|
|
||||||
@item insert
|
|
||||||
Insert a TD at the beginning of every TU which does not already have one.
|
|
||||||
@item remove
|
|
||||||
Remove the TD from the beginning of every TU which has one.
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@item color_primaries
|
|
||||||
@item transfer_characteristics
|
|
||||||
@item matrix_coefficients
|
|
||||||
Set the color description fields in the stream (see AV1 section 6.4.2).
|
|
||||||
|
|
||||||
@item color_range
|
|
||||||
Set the color range in the stream (see AV1 section 6.4.2; note that
|
|
||||||
this cannot be set for streams using BT.709 primaries, sRGB transfer
|
|
||||||
characteristic and identity (RGB) matrix coefficients).
|
|
||||||
@table @samp
|
|
||||||
@item tv
|
|
||||||
Limited range.
|
|
||||||
@item pc
|
|
||||||
Full range.
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@item chroma_sample_position
|
|
||||||
Set the chroma sample location in the stream (see AV1 section 6.4.2).
|
|
||||||
This can only be set for 4:2:0 streams.
|
|
||||||
|
|
||||||
@table @samp
|
|
||||||
@item vertical
|
|
||||||
Left position (matching the default in MPEG-2 and H.264).
|
|
||||||
@item colocated
|
|
||||||
Top-left position.
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@item tick_rate
|
|
||||||
Set the tick rate (@emph{num_units_in_display_tick / time_scale}) in
|
|
||||||
the timing info in the sequence header.
|
|
||||||
@item num_ticks_per_picture
|
|
||||||
Set the number of ticks in each picture, to indicate that the stream
|
|
||||||
has a fixed framerate. Ignored if @option{tick_rate} is not also set.
|
|
||||||
|
|
||||||
@item delete_padding
|
|
||||||
Deletes Padding OBUs.
|
|
||||||
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@section chomp
|
@section chomp
|
||||||
|
|
||||||
Remove zero padding at the end of a packet.
|
Remove zero padding at the end of a packet.
|
||||||
|
|
||||||
@section dca_core
|
|
||||||
|
|
||||||
Extract the core from a DCA/DTS stream, dropping extensions such as
|
|
||||||
DTS-HD.
|
|
||||||
|
|
||||||
@section dump_extra
|
@section dump_extra
|
||||||
|
|
||||||
Add extradata to the beginning of the filtered packets except when
|
Add extradata to the beginning of the filtered packets.
|
||||||
said packets already exactly begin with the extradata that is intended
|
|
||||||
to be added.
|
|
||||||
|
|
||||||
@table @option
|
|
||||||
@item freq
|
|
||||||
The additional argument specifies which packets should be filtered.
|
The additional argument specifies which packets should be filtered.
|
||||||
It accepts the values:
|
It accepts the values:
|
||||||
@table @samp
|
@table @samp
|
||||||
|
@item a
|
||||||
|
add extradata to all key packets, but only if @var{local_header} is
|
||||||
|
set in the @option{flags2} codec context field
|
||||||
|
|
||||||
@item k
|
@item k
|
||||||
@item keyframe
|
|
||||||
add extradata to all key packets
|
add extradata to all key packets
|
||||||
|
|
||||||
@item e
|
@item e
|
||||||
@item all
|
|
||||||
add extradata to all packets
|
add extradata to all packets
|
||||||
@end table
|
@end table
|
||||||
@end table
|
|
||||||
|
|
||||||
If not specified it is assumed @samp{k}.
|
If not specified it is assumed @samp{k}.
|
||||||
|
|
||||||
@@ -132,161 +58,6 @@ the header stored in extradata to the key packets:
|
|||||||
ffmpeg -i INPUT -map 0 -flags:v +global_header -c:v libx264 -bsf:v dump_extra out.ts
|
ffmpeg -i INPUT -map 0 -flags:v +global_header -c:v libx264 -bsf:v dump_extra out.ts
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@section eac3_core
|
|
||||||
|
|
||||||
Extract the core from a E-AC-3 stream, dropping extra channels.
|
|
||||||
|
|
||||||
@section extract_extradata
|
|
||||||
|
|
||||||
Extract the in-band extradata.
|
|
||||||
|
|
||||||
Certain codecs allow the long-term headers (e.g. MPEG-2 sequence headers,
|
|
||||||
or H.264/HEVC (VPS/)SPS/PPS) to be transmitted either "in-band" (i.e. as a part
|
|
||||||
of the bitstream containing the coded frames) or "out of band" (e.g. on the
|
|
||||||
container level). This latter form is called "extradata" in FFmpeg terminology.
|
|
||||||
|
|
||||||
This bitstream filter detects the in-band headers and makes them available as
|
|
||||||
extradata.
|
|
||||||
|
|
||||||
@table @option
|
|
||||||
@item remove
|
|
||||||
When this option is enabled, the long-term headers are removed from the
|
|
||||||
bitstream after extraction.
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@section filter_units
|
|
||||||
|
|
||||||
Remove units with types in or not in a given set from the stream.
|
|
||||||
|
|
||||||
@table @option
|
|
||||||
@item pass_types
|
|
||||||
List of unit types or ranges of unit types to pass through while removing
|
|
||||||
all others. This is specified as a '|'-separated list of unit type values
|
|
||||||
or ranges of values with '-'.
|
|
||||||
|
|
||||||
@item remove_types
|
|
||||||
Identical to @option{pass_types}, except the units in the given set
|
|
||||||
removed and all others passed through.
|
|
||||||
@end table
|
|
||||||
|
|
||||||
Extradata is unchanged by this transformation, but note that if the stream
|
|
||||||
contains inline parameter sets then the output may be unusable if they are
|
|
||||||
removed.
|
|
||||||
|
|
||||||
For example, to remove all non-VCL NAL units from an H.264 stream:
|
|
||||||
@example
|
|
||||||
ffmpeg -i INPUT -c:v copy -bsf:v 'filter_units=pass_types=1-5' OUTPUT
|
|
||||||
@end example
|
|
||||||
|
|
||||||
To remove all AUDs, SEI and filler from an H.265 stream:
|
|
||||||
@example
|
|
||||||
ffmpeg -i INPUT -c:v copy -bsf:v 'filter_units=remove_types=35|38-40' OUTPUT
|
|
||||||
@end example
|
|
||||||
|
|
||||||
@section hapqa_extract
|
|
||||||
|
|
||||||
Extract Rgb or Alpha part of an HAPQA file, without recompression, in order to create an HAPQ or an HAPAlphaOnly file.
|
|
||||||
|
|
||||||
@table @option
|
|
||||||
@item texture
|
|
||||||
Specifies the texture to keep.
|
|
||||||
|
|
||||||
@table @option
|
|
||||||
@item color
|
|
||||||
@item alpha
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@end table
|
|
||||||
|
|
||||||
Convert HAPQA to HAPQ
|
|
||||||
@example
|
|
||||||
ffmpeg -i hapqa_inputfile.mov -c copy -bsf:v hapqa_extract=texture=color -tag:v HapY -metadata:s:v:0 encoder="HAPQ" hapq_file.mov
|
|
||||||
@end example
|
|
||||||
|
|
||||||
Convert HAPQA to HAPAlphaOnly
|
|
||||||
@example
|
|
||||||
ffmpeg -i hapqa_inputfile.mov -c copy -bsf:v hapqa_extract=texture=alpha -tag:v HapA -metadata:s:v:0 encoder="HAPAlpha Only" hapalphaonly_file.mov
|
|
||||||
@end example
|
|
||||||
|
|
||||||
@section h264_metadata
|
|
||||||
|
|
||||||
Modify metadata embedded in an H.264 stream.
|
|
||||||
|
|
||||||
@table @option
|
|
||||||
@item aud
|
|
||||||
Insert or remove AUD NAL units in all access units of the stream.
|
|
||||||
|
|
||||||
@table @samp
|
|
||||||
@item insert
|
|
||||||
@item remove
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@item sample_aspect_ratio
|
|
||||||
Set the sample aspect ratio of the stream in the VUI parameters.
|
|
||||||
|
|
||||||
@item overscan_appropriate_flag
|
|
||||||
Set whether the stream is suitable for display using overscan
|
|
||||||
or not (see H.264 section E.2.1).
|
|
||||||
|
|
||||||
@item video_format
|
|
||||||
@item video_full_range_flag
|
|
||||||
Set the video format in the stream (see H.264 section E.2.1 and
|
|
||||||
table E-2).
|
|
||||||
|
|
||||||
@item colour_primaries
|
|
||||||
@item transfer_characteristics
|
|
||||||
@item matrix_coefficients
|
|
||||||
Set the colour description in the stream (see H.264 section E.2.1
|
|
||||||
and tables E-3, E-4 and E-5).
|
|
||||||
|
|
||||||
@item chroma_sample_loc_type
|
|
||||||
Set the chroma sample location in the stream (see H.264 section
|
|
||||||
E.2.1 and figure E-1).
|
|
||||||
|
|
||||||
@item tick_rate
|
|
||||||
Set the tick rate (num_units_in_tick / time_scale) in the VUI
|
|
||||||
parameters. This is the smallest time unit representable in the
|
|
||||||
stream, and in many cases represents the field rate of the stream
|
|
||||||
(double the frame rate).
|
|
||||||
@item fixed_frame_rate_flag
|
|
||||||
Set whether the stream has fixed framerate - typically this indicates
|
|
||||||
that the framerate is exactly half the tick rate, but the exact
|
|
||||||
meaning is dependent on interlacing and the picture structure (see
|
|
||||||
H.264 section E.2.1 and table E-6).
|
|
||||||
|
|
||||||
@item crop_left
|
|
||||||
@item crop_right
|
|
||||||
@item crop_top
|
|
||||||
@item crop_bottom
|
|
||||||
Set the frame cropping offsets in the SPS. These values will replace
|
|
||||||
the current ones if the stream is already cropped.
|
|
||||||
|
|
||||||
These fields are set in pixels. Note that some sizes may not be
|
|
||||||
representable if the chroma is subsampled or the stream is interlaced
|
|
||||||
(see H.264 section 7.4.2.1.1).
|
|
||||||
|
|
||||||
@item sei_user_data
|
|
||||||
Insert a string as SEI unregistered user data. The argument must
|
|
||||||
be of the form @emph{UUID+string}, where the UUID is as hex digits
|
|
||||||
possibly separated by hyphens, and the string can be anything.
|
|
||||||
|
|
||||||
For example, @samp{086f3693-b7b3-4f2c-9653-21492feee5b8+hello} will
|
|
||||||
insert the string ``hello'' associated with the given UUID.
|
|
||||||
|
|
||||||
@item delete_filler
|
|
||||||
Deletes both filler NAL units and filler SEI messages.
|
|
||||||
|
|
||||||
@item level
|
|
||||||
Set the level in the SPS. Refer to H.264 section A.3 and tables A-1
|
|
||||||
to A-5.
|
|
||||||
|
|
||||||
The argument must be the name of a level (for example, @samp{4.2}), a
|
|
||||||
level_idc value (for example, @samp{42}), or the special name @samp{auto}
|
|
||||||
indicating that the filter should attempt to guess the level from the
|
|
||||||
input stream properties.
|
|
||||||
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@section h264_mp4toannexb
|
@section h264_mp4toannexb
|
||||||
|
|
||||||
Convert an H.264 bitstream from length prefixed mode to start code
|
Convert an H.264 bitstream from length prefixed mode to start code
|
||||||
@@ -294,7 +65,7 @@ prefixed mode (as defined in the Annex B of the ITU-T H.264
|
|||||||
specification).
|
specification).
|
||||||
|
|
||||||
This is required by some streaming formats, typically the MPEG-2
|
This is required by some streaming formats, typically the MPEG-2
|
||||||
transport stream format (muxer @code{mpegts}).
|
transport stream format ("mpegts").
|
||||||
|
|
||||||
For example to remux an MP4 file containing an H.264 stream to mpegts
|
For example to remux an MP4 file containing an H.264 stream to mpegts
|
||||||
format with @command{ffmpeg}, you can use the command:
|
format with @command{ffmpeg}, you can use the command:
|
||||||
@@ -303,113 +74,7 @@ format with @command{ffmpeg}, you can use the command:
|
|||||||
ffmpeg -i INPUT.mp4 -codec copy -bsf:v h264_mp4toannexb OUTPUT.ts
|
ffmpeg -i INPUT.mp4 -codec copy -bsf:v h264_mp4toannexb OUTPUT.ts
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
Please note that this filter is auto-inserted for MPEG-TS (muxer
|
@section imx_dump_header
|
||||||
@code{mpegts}) and raw H.264 (muxer @code{h264}) output formats.
|
|
||||||
|
|
||||||
@section h264_redundant_pps
|
|
||||||
|
|
||||||
This applies a specific fixup to some Blu-ray streams which contain
|
|
||||||
redundant PPSs modifying irrelevant parameters of the stream which
|
|
||||||
confuse other transformations which require correct extradata.
|
|
||||||
|
|
||||||
A new single global PPS is created, and all of the redundant PPSs
|
|
||||||
within the stream are removed.
|
|
||||||
|
|
||||||
@section hevc_metadata
|
|
||||||
|
|
||||||
Modify metadata embedded in an HEVC stream.
|
|
||||||
|
|
||||||
@table @option
|
|
||||||
@item aud
|
|
||||||
Insert or remove AUD NAL units in all access units of the stream.
|
|
||||||
|
|
||||||
@table @samp
|
|
||||||
@item insert
|
|
||||||
@item remove
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@item sample_aspect_ratio
|
|
||||||
Set the sample aspect ratio in the stream in the VUI parameters.
|
|
||||||
|
|
||||||
@item video_format
|
|
||||||
@item video_full_range_flag
|
|
||||||
Set the video format in the stream (see H.265 section E.3.1 and
|
|
||||||
table E.2).
|
|
||||||
|
|
||||||
@item colour_primaries
|
|
||||||
@item transfer_characteristics
|
|
||||||
@item matrix_coefficients
|
|
||||||
Set the colour description in the stream (see H.265 section E.3.1
|
|
||||||
and tables E.3, E.4 and E.5).
|
|
||||||
|
|
||||||
@item chroma_sample_loc_type
|
|
||||||
Set the chroma sample location in the stream (see H.265 section
|
|
||||||
E.3.1 and figure E.1).
|
|
||||||
|
|
||||||
@item tick_rate
|
|
||||||
Set the tick rate in the VPS and VUI parameters (num_units_in_tick /
|
|
||||||
time_scale). Combined with @option{num_ticks_poc_diff_one}, this can
|
|
||||||
set a constant framerate in the stream. Note that it is likely to be
|
|
||||||
overridden by container parameters when the stream is in a container.
|
|
||||||
|
|
||||||
@item num_ticks_poc_diff_one
|
|
||||||
Set poc_proportional_to_timing_flag in VPS and VUI and use this value
|
|
||||||
to set num_ticks_poc_diff_one_minus1 (see H.265 sections 7.4.3.1 and
|
|
||||||
E.3.1). Ignored if @option{tick_rate} is not also set.
|
|
||||||
|
|
||||||
@item crop_left
|
|
||||||
@item crop_right
|
|
||||||
@item crop_top
|
|
||||||
@item crop_bottom
|
|
||||||
Set the conformance window cropping offsets in the SPS. These values
|
|
||||||
will replace the current ones if the stream is already cropped.
|
|
||||||
|
|
||||||
These fields are set in pixels. Note that some sizes may not be
|
|
||||||
representable if the chroma is subsampled (H.265 section 7.4.3.2.1).
|
|
||||||
|
|
||||||
@item level
|
|
||||||
Set the level in the VPS and SPS. See H.265 section A.4 and tables
|
|
||||||
A.6 and A.7.
|
|
||||||
|
|
||||||
The argument must be the name of a level (for example, @samp{5.1}), a
|
|
||||||
@emph{general_level_idc} value (for example, @samp{153} for level 5.1),
|
|
||||||
or the special name @samp{auto} indicating that the filter should
|
|
||||||
attempt to guess the level from the input stream properties.
|
|
||||||
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@section hevc_mp4toannexb
|
|
||||||
|
|
||||||
Convert an HEVC/H.265 bitstream from length prefixed mode to start code
|
|
||||||
prefixed mode (as defined in the Annex B of the ITU-T H.265
|
|
||||||
specification).
|
|
||||||
|
|
||||||
This is required by some streaming formats, typically the MPEG-2
|
|
||||||
transport stream format (muxer @code{mpegts}).
|
|
||||||
|
|
||||||
For example to remux an MP4 file containing an HEVC stream to mpegts
|
|
||||||
format with @command{ffmpeg}, you can use the command:
|
|
||||||
|
|
||||||
@example
|
|
||||||
ffmpeg -i INPUT.mp4 -codec copy -bsf:v hevc_mp4toannexb OUTPUT.ts
|
|
||||||
@end example
|
|
||||||
|
|
||||||
Please note that this filter is auto-inserted for MPEG-TS (muxer
|
|
||||||
@code{mpegts}) and raw HEVC/H.265 (muxer @code{h265} or
|
|
||||||
@code{hevc}) output formats.
|
|
||||||
|
|
||||||
@section imxdump
|
|
||||||
|
|
||||||
Modifies the bitstream to fit in MOV and to be usable by the Final Cut
|
|
||||||
Pro decoder. This filter only applies to the mpeg2video codec, and is
|
|
||||||
likely not needed for Final Cut Pro 7 and newer with the appropriate
|
|
||||||
@option{-tag:v}.
|
|
||||||
|
|
||||||
For example, to remux 30 MB/sec NTSC IMX to MOV:
|
|
||||||
|
|
||||||
@example
|
|
||||||
ffmpeg -i input.mxf -c copy -bsf:v imxdump -tag:v mx3n output.mov
|
|
||||||
@end example
|
|
||||||
|
|
||||||
@section mjpeg2jpeg
|
@section mjpeg2jpeg
|
||||||
|
|
||||||
@@ -448,352 +113,14 @@ exiftran -i -9 frame*.jpg
|
|||||||
ffmpeg -i frame_%d.jpg -c:v copy rotated.avi
|
ffmpeg -i frame_%d.jpg -c:v copy rotated.avi
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@section mjpegadump
|
@section mjpega_dump_header
|
||||||
|
|
||||||
Add an MJPEG A header to the bitstream, to enable decoding by
|
@section movsub
|
||||||
Quicktime.
|
|
||||||
|
|
||||||
@anchor{mov2textsub}
|
@section mp3_header_decompress
|
||||||
@section mov2textsub
|
|
||||||
|
|
||||||
Extract a representable text file from MOV subtitles, stripping the
|
|
||||||
metadata header from each subtitle packet.
|
|
||||||
|
|
||||||
See also the @ref{text2movsub} filter.
|
|
||||||
|
|
||||||
@section mp3decomp
|
|
||||||
|
|
||||||
Decompress non-standard compressed MP3 audio headers.
|
|
||||||
|
|
||||||
@section mpeg2_metadata
|
|
||||||
|
|
||||||
Modify metadata embedded in an MPEG-2 stream.
|
|
||||||
|
|
||||||
@table @option
|
|
||||||
@item display_aspect_ratio
|
|
||||||
Set the display aspect ratio in the stream.
|
|
||||||
|
|
||||||
The following fixed values are supported:
|
|
||||||
@table @option
|
|
||||||
@item 4/3
|
|
||||||
@item 16/9
|
|
||||||
@item 221/100
|
|
||||||
@end table
|
|
||||||
Any other value will result in square pixels being signalled instead
|
|
||||||
(see H.262 section 6.3.3 and table 6-3).
|
|
||||||
|
|
||||||
@item frame_rate
|
|
||||||
Set the frame rate in the stream. This is constructed from a table
|
|
||||||
of known values combined with a small multiplier and divisor - if
|
|
||||||
the supplied value is not exactly representable, the nearest
|
|
||||||
representable value will be used instead (see H.262 section 6.3.3
|
|
||||||
and table 6-4).
|
|
||||||
|
|
||||||
@item video_format
|
|
||||||
Set the video format in the stream (see H.262 section 6.3.6 and
|
|
||||||
table 6-6).
|
|
||||||
|
|
||||||
@item colour_primaries
|
|
||||||
@item transfer_characteristics
|
|
||||||
@item matrix_coefficients
|
|
||||||
Set the colour description in the stream (see H.262 section 6.3.6
|
|
||||||
and tables 6-7, 6-8 and 6-9).
|
|
||||||
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@section mpeg4_unpack_bframes
|
|
||||||
|
|
||||||
Unpack DivX-style packed B-frames.
|
|
||||||
|
|
||||||
DivX-style packed B-frames are not valid MPEG-4 and were only a
|
|
||||||
workaround for the broken Video for Windows subsystem.
|
|
||||||
They use more space, can cause minor AV sync issues, require more
|
|
||||||
CPU power to decode (unless the player has some decoded picture queue
|
|
||||||
to compensate the 2,0,2,0 frame per packet style) and cause
|
|
||||||
trouble if copied into a standard container like mp4 or mpeg-ps/ts,
|
|
||||||
because MPEG-4 decoders may not be able to decode them, since they are
|
|
||||||
not valid MPEG-4.
|
|
||||||
|
|
||||||
For example to fix an AVI file containing an MPEG-4 stream with
|
|
||||||
DivX-style packed B-frames using @command{ffmpeg}, you can use the command:
|
|
||||||
|
|
||||||
@example
|
|
||||||
ffmpeg -i INPUT.avi -codec copy -bsf:v mpeg4_unpack_bframes OUTPUT.avi
|
|
||||||
@end example
|
|
||||||
|
|
||||||
@section noise
|
@section noise
|
||||||
|
|
||||||
Damages the contents of packets or simply drops them without damaging the
|
|
||||||
container. Can be used for fuzzing or testing error resilience/concealment.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
@table @option
|
|
||||||
@item amount
|
|
||||||
A numeral string, whose value is related to how often output bytes will
|
|
||||||
be modified. Therefore, values below or equal to 0 are forbidden, and
|
|
||||||
the lower the more frequent bytes will be modified, with 1 meaning
|
|
||||||
every byte is modified.
|
|
||||||
@item dropamount
|
|
||||||
A numeral string, whose value is related to how often packets will be dropped.
|
|
||||||
Therefore, values below or equal to 0 are forbidden, and the lower the more
|
|
||||||
frequent packets will be dropped, with 1 meaning every packet is dropped.
|
|
||||||
@end table
|
|
||||||
|
|
||||||
The following example applies the modification to every byte but does not drop
|
|
||||||
any packets.
|
|
||||||
@example
|
|
||||||
ffmpeg -i INPUT -c copy -bsf noise[=1] output.mkv
|
|
||||||
@end example
|
|
||||||
|
|
||||||
@section null
|
|
||||||
This bitstream filter passes the packets through unchanged.
|
|
||||||
|
|
||||||
@section pcm_rechunk
|
|
||||||
|
|
||||||
Repacketize PCM audio to a fixed number of samples per packet or a fixed packet
|
|
||||||
rate per second. This is similar to the @ref{asetnsamples,,asetnsamples audio
|
|
||||||
filter,ffmpeg-filters} but works on audio packets instead of audio frames.
|
|
||||||
|
|
||||||
@table @option
|
|
||||||
@item nb_out_samples, n
|
|
||||||
Set the number of samples per each output audio packet. The number is intended
|
|
||||||
as the number of samples @emph{per each channel}. Default value is 1024.
|
|
||||||
|
|
||||||
@item pad, p
|
|
||||||
If set to 1, the filter will pad the last audio packet with silence, so that it
|
|
||||||
will contain the same number of samples (or roughly the same number of samples,
|
|
||||||
see @option{frame_rate}) as the previous ones. Default value is 1.
|
|
||||||
|
|
||||||
@item frame_rate, r
|
|
||||||
This option makes the filter output a fixed number of packets per second instead
|
|
||||||
of a fixed number of samples per packet. If the audio sample rate is not
|
|
||||||
divisible by the frame rate then the number of samples will not be constant but
|
|
||||||
will vary slightly so that each packet will start as close to the frame
|
|
||||||
boundary as possible. Using this option has precedence over @option{nb_out_samples}.
|
|
||||||
@end table
|
|
||||||
|
|
||||||
You can generate the well known 1602-1601-1602-1601-1602 pattern of 48kHz audio
|
|
||||||
for NTSC frame rate using the @option{frame_rate} option.
|
|
||||||
@example
|
|
||||||
ffmpeg -f lavfi -i sine=r=48000:d=1 -c pcm_s16le -bsf pcm_rechunk=r=30000/1001 -f framecrc -
|
|
||||||
@end example
|
|
||||||
|
|
||||||
@section prores_metadata
|
|
||||||
|
|
||||||
Modify color property metadata embedded in prores stream.
|
|
||||||
|
|
||||||
@table @option
|
|
||||||
@item color_primaries
|
|
||||||
Set the color primaries.
|
|
||||||
Available values are:
|
|
||||||
|
|
||||||
@table @samp
|
|
||||||
@item auto
|
|
||||||
Keep the same color primaries property (default).
|
|
||||||
|
|
||||||
@item unknown
|
|
||||||
@item bt709
|
|
||||||
@item bt470bg
|
|
||||||
BT601 625
|
|
||||||
|
|
||||||
@item smpte170m
|
|
||||||
BT601 525
|
|
||||||
|
|
||||||
@item bt2020
|
|
||||||
@item smpte431
|
|
||||||
DCI P3
|
|
||||||
|
|
||||||
@item smpte432
|
|
||||||
P3 D65
|
|
||||||
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@item transfer_characteristics
|
|
||||||
Set the color transfer.
|
|
||||||
Available values are:
|
|
||||||
|
|
||||||
@table @samp
|
|
||||||
@item auto
|
|
||||||
Keep the same transfer characteristics property (default).
|
|
||||||
|
|
||||||
@item unknown
|
|
||||||
@item bt709
|
|
||||||
BT 601, BT 709, BT 2020
|
|
||||||
@item smpte2084
|
|
||||||
SMPTE ST 2084
|
|
||||||
@item arib-std-b67
|
|
||||||
ARIB STD-B67
|
|
||||||
@end table
|
|
||||||
|
|
||||||
|
|
||||||
@item matrix_coefficients
|
|
||||||
Set the matrix coefficient.
|
|
||||||
Available values are:
|
|
||||||
|
|
||||||
@table @samp
|
|
||||||
@item auto
|
|
||||||
Keep the same colorspace property (default).
|
|
||||||
|
|
||||||
@item unknown
|
|
||||||
@item bt709
|
|
||||||
@item smpte170m
|
|
||||||
BT 601
|
|
||||||
|
|
||||||
@item bt2020nc
|
|
||||||
@end table
|
|
||||||
@end table
|
|
||||||
|
|
||||||
Set Rec709 colorspace for each frame of the file
|
|
||||||
@example
|
|
||||||
ffmpeg -i INPUT -c copy -bsf:v prores_metadata=color_primaries=bt709:color_trc=bt709:colorspace=bt709 output.mov
|
|
||||||
@end example
|
|
||||||
|
|
||||||
Set Hybrid Log-Gamma parameters for each frame of the file
|
|
||||||
@example
|
|
||||||
ffmpeg -i INPUT -c copy -bsf:v prores_metadata=color_primaries=bt2020:color_trc=arib-std-b67:colorspace=bt2020nc output.mov
|
|
||||||
@end example
|
|
||||||
|
|
||||||
@section remove_extra
|
@section remove_extra
|
||||||
|
|
||||||
Remove extradata from packets.
|
|
||||||
|
|
||||||
It accepts the following parameter:
|
|
||||||
@table @option
|
|
||||||
@item freq
|
|
||||||
Set which frame types to remove extradata from.
|
|
||||||
|
|
||||||
@table @samp
|
|
||||||
@item k
|
|
||||||
Remove extradata from non-keyframes only.
|
|
||||||
|
|
||||||
@item keyframe
|
|
||||||
Remove extradata from keyframes only.
|
|
||||||
|
|
||||||
@item e, all
|
|
||||||
Remove extradata from all frames.
|
|
||||||
|
|
||||||
@end table
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@section setts
|
|
||||||
Set PTS and DTS in packets.
|
|
||||||
|
|
||||||
It accepts the following parameters:
|
|
||||||
@table @option
|
|
||||||
@item ts
|
|
||||||
@item pts
|
|
||||||
@item dts
|
|
||||||
Set expressions for PTS, DTS or both.
|
|
||||||
@end table
|
|
||||||
|
|
||||||
The expressions are evaluated through the eval API and can contain the following
|
|
||||||
constants:
|
|
||||||
|
|
||||||
@table @option
|
|
||||||
@item N
|
|
||||||
The count of the input packet. Starting from 0.
|
|
||||||
|
|
||||||
@item TS
|
|
||||||
The demux timestamp in input in case of @code{ts} or @code{dts} option or presentation
|
|
||||||
timestamp in case of @code{pts} option.
|
|
||||||
|
|
||||||
@item POS
|
|
||||||
The original position in the file of the packet, or undefined if undefined
|
|
||||||
for the current packet
|
|
||||||
|
|
||||||
@item DTS
|
|
||||||
The demux timestamp in input.
|
|
||||||
|
|
||||||
@item PTS
|
|
||||||
The presentation timestamp in input.
|
|
||||||
|
|
||||||
@item STARTDTS
|
|
||||||
The DTS of the first packet.
|
|
||||||
|
|
||||||
@item STARTPTS
|
|
||||||
The PTS of the first packet.
|
|
||||||
|
|
||||||
@item PREV_INDTS
|
|
||||||
The previous input DTS.
|
|
||||||
|
|
||||||
@item PREV_INPTS
|
|
||||||
The previous input PTS.
|
|
||||||
|
|
||||||
@item PREV_OUTDTS
|
|
||||||
The previous output DTS.
|
|
||||||
|
|
||||||
@item PREV_OUTPTS
|
|
||||||
The previous output PTS.
|
|
||||||
|
|
||||||
@item TB
|
|
||||||
The timebase of stream packet belongs.
|
|
||||||
|
|
||||||
@item SR
|
|
||||||
The sample rate of stream packet belongs.
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@anchor{text2movsub}
|
|
||||||
@section text2movsub
|
|
||||||
|
|
||||||
Convert text subtitles to MOV subtitles (as used by the @code{mov_text}
|
|
||||||
codec) with metadata headers.
|
|
||||||
|
|
||||||
See also the @ref{mov2textsub} filter.
|
|
||||||
|
|
||||||
@section trace_headers
|
|
||||||
|
|
||||||
Log trace output containing all syntax elements in the coded stream
|
|
||||||
headers (everything above the level of individual coded blocks).
|
|
||||||
This can be useful for debugging low-level stream issues.
|
|
||||||
|
|
||||||
Supports AV1, H.264, H.265, (M)JPEG, MPEG-2 and VP9, but depending
|
|
||||||
on the build only a subset of these may be available.
|
|
||||||
|
|
||||||
@section truehd_core
|
|
||||||
|
|
||||||
Extract the core from a TrueHD stream, dropping ATMOS data.
|
|
||||||
|
|
||||||
@section vp9_metadata
|
|
||||||
|
|
||||||
Modify metadata embedded in a VP9 stream.
|
|
||||||
|
|
||||||
@table @option
|
|
||||||
@item color_space
|
|
||||||
Set the color space value in the frame header. Note that any frame
|
|
||||||
set to RGB will be implicitly set to PC range and that RGB is
|
|
||||||
incompatible with profiles 0 and 2.
|
|
||||||
@table @samp
|
|
||||||
@item unknown
|
|
||||||
@item bt601
|
|
||||||
@item bt709
|
|
||||||
@item smpte170
|
|
||||||
@item smpte240
|
|
||||||
@item bt2020
|
|
||||||
@item rgb
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@item color_range
|
|
||||||
Set the color range value in the frame header. Note that any value
|
|
||||||
imposed by the color space will take precedence over this value.
|
|
||||||
@table @samp
|
|
||||||
@item tv
|
|
||||||
@item pc
|
|
||||||
@end table
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@section vp9_superframe
|
|
||||||
|
|
||||||
Merge VP9 invisible (alt-ref) frames back into VP9 superframes. This
|
|
||||||
fixes merging of split/segmented VP9 streams where the alt-ref frame
|
|
||||||
was split from its visible counterpart.
|
|
||||||
|
|
||||||
@section vp9_superframe_split
|
|
||||||
|
|
||||||
Split VP9 superframes into single frames.
|
|
||||||
|
|
||||||
@section vp9_raw_reorder
|
|
||||||
|
|
||||||
Given a VP9 stream with correct timestamps but possibly out of order,
|
|
||||||
insert additional show-existing-frame packets to correct the ordering.
|
|
||||||
|
|
||||||
@c man end BITSTREAM FILTERS
|
@c man end BITSTREAM FILTERS
|
||||||
|
|||||||
5
doc/bootstrap.min.css
vendored
5
doc/bootstrap.min.css
vendored
File diff suppressed because one or more lines are too long
@@ -7,60 +7,44 @@ V
|
|||||||
Disable the default terse mode, the full command issued by make and its
|
Disable the default terse mode, the full command issued by make and its
|
||||||
output will be shown on the screen.
|
output will be shown on the screen.
|
||||||
|
|
||||||
DBG
|
|
||||||
Preprocess x86 external assembler files to a .dbg.asm file in the object
|
|
||||||
directory, which then gets compiled. Helps in developing those assembler
|
|
||||||
files.
|
|
||||||
|
|
||||||
DESTDIR
|
DESTDIR
|
||||||
Destination directory for the install targets, useful to prepare packages
|
Destination directory for the install targets, useful to prepare packages
|
||||||
or install FFmpeg in cross-environments.
|
or install FFmpeg in cross-environments.
|
||||||
|
|
||||||
GEN
|
|
||||||
Set to ‘1’ to generate the missing or mismatched references.
|
|
||||||
|
|
||||||
Makefile targets:
|
Makefile targets:
|
||||||
|
|
||||||
all
|
all
|
||||||
Default target, builds all the libraries and the executables.
|
Default target, builds all the libraries and the executables.
|
||||||
|
|
||||||
fate
|
fate
|
||||||
Run the fate test suite, note that you must have installed it.
|
Run the fate test suite, note you must have installed it
|
||||||
|
|
||||||
fate-list
|
fate-list
|
||||||
List all fate/regression test targets.
|
Will list all fate/regression test targets
|
||||||
|
|
||||||
install
|
install
|
||||||
Install headers, libraries and programs.
|
Install headers, libraries and programs.
|
||||||
|
|
||||||
examples
|
libavformat/output-example
|
||||||
Build all examples located in doc/examples.
|
Build the libavformat basic example.
|
||||||
|
|
||||||
checkheaders
|
libavcodec/api-example
|
||||||
Check headers dependencies.
|
Build the libavcodec basic example.
|
||||||
|
|
||||||
alltools
|
libswscale/swscale-test
|
||||||
Build all tools in tools directory.
|
Build the swscale self-test (useful also as example).
|
||||||
|
|
||||||
config
|
|
||||||
Reconfigure the project with the current configuration.
|
|
||||||
|
|
||||||
tools/target_dec_<decoder>_fuzzer
|
|
||||||
Build fuzzer to fuzz the specified decoder.
|
|
||||||
|
|
||||||
tools/target_bsf_<filter>_fuzzer
|
|
||||||
Build fuzzer to fuzz the specified bitstream filter.
|
|
||||||
|
|
||||||
Useful standard make commands:
|
Useful standard make commands:
|
||||||
make -t <target>
|
make -t <target>
|
||||||
Touch all files that otherwise would be built, this is useful to reduce
|
Touch all files that otherwise would be build, this is useful to reduce
|
||||||
unneeded rebuilding when changing headers, but note that you must force rebuilds
|
unneeded rebuilding when changing headers, but note you must force rebuilds
|
||||||
of files that actually need it by hand then.
|
of files that actually need it by hand then.
|
||||||
|
|
||||||
make -j<num>
|
make -j<num>
|
||||||
Rebuild with multiple jobs at the same time. Faster on multi processor systems.
|
rebuild with multiple jobs at the same time. Faster on multi processor systems
|
||||||
|
|
||||||
make -k
|
make -k
|
||||||
Continue build in case of errors, this is useful for the regression tests
|
continue build in case of errors, this is useful for the regression tests
|
||||||
sometimes but note that it will still not run all reg tests.
|
sometimes but note it will still not run all reg tests.
|
||||||
|
|
||||||
|
|||||||
462
doc/codecs.texi
462
doc/codecs.texi
@@ -7,7 +7,7 @@ all the encoders and decoders. In addition each codec may support
|
|||||||
so-called private options, which are specific for a given codec.
|
so-called private options, which are specific for a given codec.
|
||||||
|
|
||||||
Sometimes, a global option may only affect a specific kind of codec,
|
Sometimes, a global option may only affect a specific kind of codec,
|
||||||
and may be nonsensical or ignored by another, so you need to be aware
|
and may be unsensical or ignored by another, so you need to be aware
|
||||||
of the meaning of the specified options. Also some options are
|
of the meaning of the specified options. Also some options are
|
||||||
meant only for decoding or encoding.
|
meant only for decoding or encoding.
|
||||||
|
|
||||||
@@ -44,20 +44,26 @@ Use 1/4 pel motion compensation.
|
|||||||
Use loop filter.
|
Use loop filter.
|
||||||
@item qscale
|
@item qscale
|
||||||
Use fixed qscale.
|
Use fixed qscale.
|
||||||
|
@item gmc
|
||||||
|
Use gmc.
|
||||||
|
@item mv0
|
||||||
|
Always try a mb with mv=<0,0>.
|
||||||
|
@item input_preserved
|
||||||
|
|
||||||
@item pass1
|
@item pass1
|
||||||
Use internal 2pass ratecontrol in first pass mode.
|
Use internal 2pass ratecontrol in first pass mode.
|
||||||
@item pass2
|
@item pass2
|
||||||
Use internal 2pass ratecontrol in second pass mode.
|
Use internal 2pass ratecontrol in second pass mode.
|
||||||
@item gray
|
@item gray
|
||||||
Only decode/encode grayscale.
|
Only decode/encode grayscale.
|
||||||
|
@item emu_edge
|
||||||
|
Do not draw edges.
|
||||||
@item psnr
|
@item psnr
|
||||||
Set error[?] variables during encoding.
|
Set error[?] variables during encoding.
|
||||||
@item truncated
|
@item truncated
|
||||||
Input bitstream might be randomly truncated.
|
|
||||||
@item drop_changed
|
|
||||||
Don't output frames whose parameters differ from first decoded frame in stream.
|
|
||||||
Error AVERROR_INPUT_CHANGED is returned when a frame is dropped.
|
|
||||||
|
|
||||||
|
@item naq
|
||||||
|
Normalize adaptive quantization.
|
||||||
@item ildct
|
@item ildct
|
||||||
Use interlaced DCT.
|
Use interlaced DCT.
|
||||||
@item low_delay
|
@item low_delay
|
||||||
@@ -65,19 +71,53 @@ Force low delay.
|
|||||||
@item global_header
|
@item global_header
|
||||||
Place global headers in extradata instead of every keyframe.
|
Place global headers in extradata instead of every keyframe.
|
||||||
@item bitexact
|
@item bitexact
|
||||||
Only write platform-, build- and time-independent data. (except (I)DCT).
|
Use only bitexact stuff (except (I)DCT).
|
||||||
This ensures that file and data checksums are reproducible and match between
|
|
||||||
platforms. Its primary use is for regression testing.
|
|
||||||
@item aic
|
@item aic
|
||||||
Apply H263 advanced intra coding / mpeg4 ac prediction.
|
Apply H263 advanced intra coding / mpeg4 ac prediction.
|
||||||
|
@item cbp
|
||||||
|
Deprecated, use mpegvideo private options instead.
|
||||||
|
@item qprd
|
||||||
|
Deprecated, use mpegvideo private options instead.
|
||||||
@item ilme
|
@item ilme
|
||||||
Apply interlaced motion estimation.
|
Apply interlaced motion estimation.
|
||||||
@item cgop
|
@item cgop
|
||||||
Use closed gop.
|
Use closed gop.
|
||||||
@item output_corrupt
|
|
||||||
Output even potentially corrupted frames.
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
|
@item me_method @var{integer} (@emph{encoding,video})
|
||||||
|
Set motion estimation method.
|
||||||
|
|
||||||
|
Possible values:
|
||||||
|
@table @samp
|
||||||
|
@item zero
|
||||||
|
zero motion estimation (fastest)
|
||||||
|
@item full
|
||||||
|
full motion estimation (slowest)
|
||||||
|
@item epzs
|
||||||
|
EPZS motion estimation (default)
|
||||||
|
@item esa
|
||||||
|
esa motion estimation (alias for full)
|
||||||
|
@item tesa
|
||||||
|
tesa motion estimation
|
||||||
|
@item dia
|
||||||
|
dia motion estimation (alias for epzs)
|
||||||
|
@item log
|
||||||
|
log motion estimation
|
||||||
|
@item phods
|
||||||
|
phods motion estimation
|
||||||
|
@item x1
|
||||||
|
X1 motion estimation
|
||||||
|
@item hex
|
||||||
|
hex motion estimation
|
||||||
|
@item umh
|
||||||
|
umh motion estimation
|
||||||
|
@item iter
|
||||||
|
iter motion estimation
|
||||||
|
@end table
|
||||||
|
|
||||||
|
@item extradata_size @var{integer}
|
||||||
|
Set extradata size.
|
||||||
|
|
||||||
@item time_base @var{rational number}
|
@item time_base @var{rational number}
|
||||||
Set codec time base.
|
Set codec time base.
|
||||||
|
|
||||||
@@ -87,7 +127,7 @@ should be @code{1 / frame_rate} and timestamp increments should be
|
|||||||
identically 1.
|
identically 1.
|
||||||
|
|
||||||
@item g @var{integer} (@emph{encoding,video})
|
@item g @var{integer} (@emph{encoding,video})
|
||||||
Set the group of picture (GOP) size. Default value is 12.
|
Set the group of picture size. Default value is 12.
|
||||||
|
|
||||||
@item ar @var{integer} (@emph{decoding/encoding,audio})
|
@item ar @var{integer} (@emph{decoding/encoding,audio})
|
||||||
Set audio sampling rate (in Hz).
|
Set audio sampling rate (in Hz).
|
||||||
@@ -96,8 +136,7 @@ Set audio sampling rate (in Hz).
|
|||||||
Set number of audio channels.
|
Set number of audio channels.
|
||||||
|
|
||||||
@item cutoff @var{integer} (@emph{encoding,audio})
|
@item cutoff @var{integer} (@emph{encoding,audio})
|
||||||
Set cutoff bandwidth. (Supported only by selected encoders, see
|
Set cutoff bandwidth.
|
||||||
their respective documentation sections.)
|
|
||||||
|
|
||||||
@item frame_size @var{integer} (@emph{encoding,audio})
|
@item frame_size @var{integer} (@emph{encoding,audio})
|
||||||
Set audio frame size.
|
Set audio frame size.
|
||||||
@@ -144,6 +183,9 @@ Default value is 0.
|
|||||||
@item b_qfactor @var{float} (@emph{encoding,video})
|
@item b_qfactor @var{float} (@emph{encoding,video})
|
||||||
Set qp factor between P and B frames.
|
Set qp factor between P and B frames.
|
||||||
|
|
||||||
|
@item rc_strategy @var{integer} (@emph{encoding,video})
|
||||||
|
Set ratecontrol method.
|
||||||
|
|
||||||
@item b_strategy @var{integer} (@emph{encoding,video})
|
@item b_strategy @var{integer} (@emph{encoding,video})
|
||||||
Set strategy to choose between I/P/B-frames.
|
Set strategy to choose between I/P/B-frames.
|
||||||
|
|
||||||
@@ -167,6 +209,8 @@ Possible values:
|
|||||||
@table @samp
|
@table @samp
|
||||||
@item autodetect
|
@item autodetect
|
||||||
|
|
||||||
|
@item old_msmpeg4
|
||||||
|
some old lavc generated msmpeg4v3 files (no autodetection)
|
||||||
@item xvid_ilace
|
@item xvid_ilace
|
||||||
Xvid interlacing bug (autodetected if fourcc==XVIX)
|
Xvid interlacing bug (autodetected if fourcc==XVIX)
|
||||||
@item ump4
|
@item ump4
|
||||||
@@ -175,6 +219,8 @@ Xvid interlacing bug (autodetected if fourcc==XVIX)
|
|||||||
padding bug (autodetected)
|
padding bug (autodetected)
|
||||||
@item amv
|
@item amv
|
||||||
|
|
||||||
|
@item ac_vlc
|
||||||
|
illegal vlc bug (autodetected per fourcc)
|
||||||
@item qpel_chroma
|
@item qpel_chroma
|
||||||
|
|
||||||
@item std_qpel
|
@item std_qpel
|
||||||
@@ -195,13 +241,21 @@ Workaround various bugs in microsoft broken decoders.
|
|||||||
trancated frames
|
trancated frames
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
|
@item lelim @var{integer} (@emph{encoding,video})
|
||||||
|
Set single coefficient elimination threshold for luminance (negative
|
||||||
|
values also consider DC coefficient).
|
||||||
|
|
||||||
|
@item celim @var{integer} (@emph{encoding,video})
|
||||||
|
Set single coefficient elimination threshold for chrominance (negative
|
||||||
|
values also consider dc coefficient)
|
||||||
|
|
||||||
@item strict @var{integer} (@emph{decoding/encoding,audio,video})
|
@item strict @var{integer} (@emph{decoding/encoding,audio,video})
|
||||||
Specify how strictly to follow the standards.
|
Specify how strictly to follow the standards.
|
||||||
|
|
||||||
Possible values:
|
Possible values:
|
||||||
@table @samp
|
@table @samp
|
||||||
@item very
|
@item very
|
||||||
strictly conform to an older more strict version of the spec or reference software
|
strictly conform to a older more strict version of the spec or reference software
|
||||||
@item strict
|
@item strict
|
||||||
strictly conform to all the things in the spec no matter what consequences
|
strictly conform to all the things in the spec no matter what consequences
|
||||||
@item normal
|
@item normal
|
||||||
@@ -231,11 +285,6 @@ detect bitstream specification deviations
|
|||||||
detect improper bitstream length
|
detect improper bitstream length
|
||||||
@item explode
|
@item explode
|
||||||
abort decoding on minor error detection
|
abort decoding on minor error detection
|
||||||
@item ignore_err
|
|
||||||
ignore decoding errors, and continue decoding.
|
|
||||||
This is useful if you want to analyze the content of a video and thus want
|
|
||||||
everything to be decoded no matter what. This option will not result in a video
|
|
||||||
that is pleasing to watch in case of errors.
|
|
||||||
@item careful
|
@item careful
|
||||||
consider things that violate the spec and have not been seen in the wild as errors
|
consider things that violate the spec and have not been seen in the wild as errors
|
||||||
@item compliant
|
@item compliant
|
||||||
@@ -251,8 +300,26 @@ consider things that a sane encoder should not do as an error
|
|||||||
@item mpeg_quant @var{integer} (@emph{encoding,video})
|
@item mpeg_quant @var{integer} (@emph{encoding,video})
|
||||||
Use MPEG quantizers instead of H.263.
|
Use MPEG quantizers instead of H.263.
|
||||||
|
|
||||||
|
@item qsquish @var{float} (@emph{encoding,video})
|
||||||
|
How to keep quantizer between qmin and qmax (0 = clip, 1 = use
|
||||||
|
differentiable function).
|
||||||
|
|
||||||
|
@item rc_qmod_amp @var{float} (@emph{encoding,video})
|
||||||
|
Set experimental quantizer modulation.
|
||||||
|
|
||||||
|
@item rc_qmod_freq @var{integer} (@emph{encoding,video})
|
||||||
|
Set experimental quantizer modulation.
|
||||||
|
|
||||||
@item rc_override_count @var{integer}
|
@item rc_override_count @var{integer}
|
||||||
|
|
||||||
|
@item rc_eq @var{string} (@emph{encoding,video})
|
||||||
|
Set rate control equation. When computing the expression, besides the
|
||||||
|
standard functions defined in the section 'Expression Evaluation', the
|
||||||
|
following functions are available: bits2qp(bits), qp2bits(qp). Also
|
||||||
|
the following constants are available: iTex pTex tex mv fCode iCount
|
||||||
|
mcVar var isI isP isB avgQP qComp avgIITex avgPITex avgPPTex avgBPTex
|
||||||
|
avgTex.
|
||||||
|
|
||||||
@item maxrate @var{integer} (@emph{encoding,audio,video})
|
@item maxrate @var{integer} (@emph{encoding,audio,video})
|
||||||
Set max bitrate tolerance (in bits/s). Requires bufsize to be set.
|
Set max bitrate tolerance (in bits/s). Requires bufsize to be set.
|
||||||
|
|
||||||
@@ -263,12 +330,18 @@ encode. It is of little use elsewise.
|
|||||||
@item bufsize @var{integer} (@emph{encoding,audio,video})
|
@item bufsize @var{integer} (@emph{encoding,audio,video})
|
||||||
Set ratecontrol buffer size (in bits).
|
Set ratecontrol buffer size (in bits).
|
||||||
|
|
||||||
|
@item rc_buf_aggressivity @var{float} (@emph{encoding,video})
|
||||||
|
Currently useless.
|
||||||
|
|
||||||
@item i_qfactor @var{float} (@emph{encoding,video})
|
@item i_qfactor @var{float} (@emph{encoding,video})
|
||||||
Set QP factor between P and I frames.
|
Set QP factor between P and I frames.
|
||||||
|
|
||||||
@item i_qoffset @var{float} (@emph{encoding,video})
|
@item i_qoffset @var{float} (@emph{encoding,video})
|
||||||
Set QP offset between P and I frames.
|
Set QP offset between P and I frames.
|
||||||
|
|
||||||
|
@item rc_init_cplx @var{float} (@emph{encoding,video})
|
||||||
|
Set initial complexity for 1-pass encoding.
|
||||||
|
|
||||||
@item dct @var{integer} (@emph{encoding,video})
|
@item dct @var{integer} (@emph{encoding,video})
|
||||||
Set DCT algorithm.
|
Set DCT algorithm.
|
||||||
|
|
||||||
@@ -316,9 +389,6 @@ Possible values:
|
|||||||
|
|
||||||
@item simplemmx
|
@item simplemmx
|
||||||
|
|
||||||
@item simpleauto
|
|
||||||
Automatically pick a IDCT compatible with the simple one
|
|
||||||
|
|
||||||
@item arm
|
@item arm
|
||||||
|
|
||||||
@item altivec
|
@item altivec
|
||||||
@@ -333,7 +403,11 @@ Automatically pick a IDCT compatible with the simple one
|
|||||||
|
|
||||||
@item simpleneon
|
@item simpleneon
|
||||||
|
|
||||||
@item xvid
|
@item simplealpha
|
||||||
|
|
||||||
|
@item ipp
|
||||||
|
|
||||||
|
@item xvidmmx
|
||||||
|
|
||||||
@item faani
|
@item faani
|
||||||
floating point AAN IDCT
|
floating point AAN IDCT
|
||||||
@@ -350,8 +424,6 @@ Possible values:
|
|||||||
iterative motion vector (MV) search (slow)
|
iterative motion vector (MV) search (slow)
|
||||||
@item deblock
|
@item deblock
|
||||||
use strong deblock filter for damaged MBs
|
use strong deblock filter for damaged MBs
|
||||||
@item favor_inter
|
|
||||||
favor predicting from the previous frame instead of the current
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@item bits_per_coded_sample @var{integer}
|
@item bits_per_coded_sample @var{integer}
|
||||||
@@ -372,9 +444,6 @@ Possible values:
|
|||||||
@item aspect @var{rational number} (@emph{encoding,video})
|
@item aspect @var{rational number} (@emph{encoding,video})
|
||||||
Set sample aspect ratio.
|
Set sample aspect ratio.
|
||||||
|
|
||||||
@item sar @var{rational number} (@emph{encoding,video})
|
|
||||||
Set sample aspect ratio. Alias to @var{aspect}.
|
|
||||||
|
|
||||||
@item debug @var{flags} (@emph{decoding/encoding,audio,video,subtitles})
|
@item debug @var{flags} (@emph{decoding/encoding,audio,video,subtitles})
|
||||||
Print specific debug info.
|
Print specific debug info.
|
||||||
|
|
||||||
@@ -390,27 +459,43 @@ rate control
|
|||||||
macroblock (MB) type
|
macroblock (MB) type
|
||||||
@item qp
|
@item qp
|
||||||
per-block quantization parameter (QP)
|
per-block quantization parameter (QP)
|
||||||
|
@item mv
|
||||||
|
motion vector
|
||||||
@item dct_coeff
|
@item dct_coeff
|
||||||
|
|
||||||
@item green_metadata
|
|
||||||
display complexity metadata for the upcoming frame, GoP or for a given duration.
|
|
||||||
|
|
||||||
@item skip
|
@item skip
|
||||||
|
|
||||||
@item startcode
|
@item startcode
|
||||||
|
|
||||||
|
@item pts
|
||||||
|
|
||||||
@item er
|
@item er
|
||||||
error recognition
|
error recognition
|
||||||
@item mmco
|
@item mmco
|
||||||
memory management control operations (H.264)
|
memory management control operations (H.264)
|
||||||
@item bugs
|
@item bugs
|
||||||
|
|
||||||
|
@item vis_qp
|
||||||
|
visualize quantization parameter (QP), lower QP are tinted greener
|
||||||
|
@item vis_mb_type
|
||||||
|
visualize block types
|
||||||
@item buffers
|
@item buffers
|
||||||
picture buffer allocations
|
picture buffer allocations
|
||||||
@item thread_ops
|
@item thread_ops
|
||||||
threading operations
|
threading operations
|
||||||
@item nomc
|
@end table
|
||||||
skip motion compensation
|
|
||||||
|
@item vismv @var{integer} (@emph{decoding,video})
|
||||||
|
Visualize motion vectors (MVs).
|
||||||
|
|
||||||
|
Possible values:
|
||||||
|
@table @samp
|
||||||
|
@item pf
|
||||||
|
forward predicted MVs of P-frames
|
||||||
|
@item bf
|
||||||
|
forward predicted MVs of B-frames
|
||||||
|
@item bb
|
||||||
|
backward predicted MVs of B-frames
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@item cmp @var{integer} (@emph{encoding,video})
|
@item cmp @var{integer} (@emph{encoding,video})
|
||||||
@@ -563,24 +648,6 @@ noise preserving sum of squared differences
|
|||||||
|
|
||||||
@item dia_size @var{integer} (@emph{encoding,video})
|
@item dia_size @var{integer} (@emph{encoding,video})
|
||||||
Set diamond type & size for motion estimation.
|
Set diamond type & size for motion estimation.
|
||||||
@table @samp
|
|
||||||
@item (1024, INT_MAX)
|
|
||||||
full motion estimation(slowest)
|
|
||||||
@item (768, 1024]
|
|
||||||
umh motion estimation
|
|
||||||
@item (512, 768]
|
|
||||||
hex motion estimation
|
|
||||||
@item (256, 512]
|
|
||||||
l2s diamond motion estimation
|
|
||||||
@item [2,256]
|
|
||||||
var diamond motion estimation
|
|
||||||
@item (-1, 2)
|
|
||||||
small diamond motion estimation
|
|
||||||
@item -1
|
|
||||||
funny diamond motion estimation
|
|
||||||
@item (INT_MIN, -1)
|
|
||||||
sab diamond motion estimation
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@item last_pred @var{integer} (@emph{encoding,video})
|
@item last_pred @var{integer} (@emph{encoding,video})
|
||||||
Set amount of motion predictors from the previous frame.
|
Set amount of motion predictors from the previous frame.
|
||||||
@@ -631,9 +698,19 @@ Set diamond type & size for motion estimation pre-pass.
|
|||||||
@item subq @var{integer} (@emph{encoding,video})
|
@item subq @var{integer} (@emph{encoding,video})
|
||||||
Set sub pel motion estimation quality.
|
Set sub pel motion estimation quality.
|
||||||
|
|
||||||
|
@item dtg_active_format @var{integer}
|
||||||
|
|
||||||
@item me_range @var{integer} (@emph{encoding,video})
|
@item me_range @var{integer} (@emph{encoding,video})
|
||||||
Set limit motion vectors range (1023 for DivX player).
|
Set limit motion vectors range (1023 for DivX player).
|
||||||
|
|
||||||
|
@item ibias @var{integer} (@emph{encoding,video})
|
||||||
|
Set intra quant bias.
|
||||||
|
|
||||||
|
@item pbias @var{integer} (@emph{encoding,video})
|
||||||
|
Set inter quant bias.
|
||||||
|
|
||||||
|
@item color_table_id @var{integer}
|
||||||
|
|
||||||
@item global_quality @var{integer} (@emph{encoding,audio,video})
|
@item global_quality @var{integer} (@emph{encoding,audio,video})
|
||||||
|
|
||||||
@item coder @var{integer} (@emph{encoding,video})
|
@item coder @var{integer} (@emph{encoding,video})
|
||||||
@@ -648,6 +725,8 @@ arithmetic coder
|
|||||||
raw (no encoding)
|
raw (no encoding)
|
||||||
@item rle
|
@item rle
|
||||||
run-length coder
|
run-length coder
|
||||||
|
@item deflate
|
||||||
|
deflate-based coder
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@item context @var{integer} (@emph{encoding,video})
|
@item context @var{integer} (@emph{encoding,video})
|
||||||
@@ -655,6 +734,8 @@ Set context model.
|
|||||||
|
|
||||||
@item slice_flags @var{integer}
|
@item slice_flags @var{integer}
|
||||||
|
|
||||||
|
@item xvmc_acceleration @var{integer}
|
||||||
|
|
||||||
@item mbd @var{integer} (@emph{encoding,video})
|
@item mbd @var{integer} (@emph{encoding,video})
|
||||||
Set macroblock decision algorithm (high quality mode).
|
Set macroblock decision algorithm (high quality mode).
|
||||||
|
|
||||||
@@ -668,9 +749,17 @@ use fewest bits
|
|||||||
use best rate distortion
|
use best rate distortion
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
|
@item stream_codec_tag @var{integer}
|
||||||
|
|
||||||
@item sc_threshold @var{integer} (@emph{encoding,video})
|
@item sc_threshold @var{integer} (@emph{encoding,video})
|
||||||
Set scene change threshold.
|
Set scene change threshold.
|
||||||
|
|
||||||
|
@item lmin @var{integer} (@emph{encoding,video})
|
||||||
|
Set min lagrange factor (VBR).
|
||||||
|
|
||||||
|
@item lmax @var{integer} (@emph{encoding,video})
|
||||||
|
Set max lagrange factor (VBR).
|
||||||
|
|
||||||
@item nr @var{integer} (@emph{encoding,video})
|
@item nr @var{integer} (@emph{encoding,video})
|
||||||
Set noise reduction.
|
Set noise reduction.
|
||||||
|
|
||||||
@@ -678,12 +767,14 @@ Set noise reduction.
|
|||||||
Set number of bits which should be loaded into the rc buffer before
|
Set number of bits which should be loaded into the rc buffer before
|
||||||
decoding starts.
|
decoding starts.
|
||||||
|
|
||||||
@item flags2 @var{flags} (@emph{decoding/encoding,audio,video,subtitles})
|
@item flags2 @var{flags} (@emph{decoding/encoding,audio,video})
|
||||||
|
|
||||||
Possible values:
|
Possible values:
|
||||||
@table @samp
|
@table @samp
|
||||||
@item fast
|
@item fast
|
||||||
Allow non spec compliant speedup tricks.
|
Allow non spec compliant speedup tricks.
|
||||||
|
@item sgop
|
||||||
|
Deprecated, use mpegvideo private options instead.
|
||||||
@item noout
|
@item noout
|
||||||
Skip bitstream encoding.
|
Skip bitstream encoding.
|
||||||
@item ignorecrop
|
@item ignorecrop
|
||||||
@@ -694,44 +785,28 @@ Place global headers at every keyframe instead of in extradata.
|
|||||||
Frame data might be split into multiple chunks.
|
Frame data might be split into multiple chunks.
|
||||||
@item showall
|
@item showall
|
||||||
Show all frames before the first keyframe.
|
Show all frames before the first keyframe.
|
||||||
@item export_mvs
|
@item skiprd
|
||||||
Export motion vectors into frame side-data (see @code{AV_FRAME_DATA_MOTION_VECTORS})
|
Deprecated, use mpegvideo private options instead.
|
||||||
for codecs that support it. See also @file{doc/examples/export_mvs.c}.
|
|
||||||
@item skip_manual
|
|
||||||
Do not skip samples and export skip information as frame side data.
|
|
||||||
@item ass_ro_flush_noop
|
|
||||||
Do not reset ASS ReadOrder field on flush.
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@item export_side_data @var{flags} (@emph{decoding/encoding,audio,video,subtitles})
|
@item error @var{integer} (@emph{encoding,video})
|
||||||
|
|
||||||
Possible values:
|
@item qns @var{integer} (@emph{encoding,video})
|
||||||
@table @samp
|
Deprecated, use mpegvideo private options instead.
|
||||||
@item mvs
|
|
||||||
Export motion vectors into frame side-data (see @code{AV_FRAME_DATA_MOTION_VECTORS})
|
|
||||||
for codecs that support it. See also @file{doc/examples/export_mvs.c}.
|
|
||||||
@item prft
|
|
||||||
Export encoder Producer Reference Time into packet side-data (see @code{AV_PKT_DATA_PRFT})
|
|
||||||
for codecs that support it.
|
|
||||||
@item venc_params
|
|
||||||
Export video encoding parameters through frame side data (see @code{AV_FRAME_DATA_VIDEO_ENC_PARAMS})
|
|
||||||
for codecs that support it. At present, those are H.264 and VP9.
|
|
||||||
@item film_grain
|
|
||||||
Export film grain parameters through frame side data (see @code{AV_FRAME_DATA_FILM_GRAIN_PARAMS}).
|
|
||||||
Supported at present by AV1 decoders.
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@item threads @var{integer} (@emph{decoding/encoding,video})
|
@item threads @var{integer} (@emph{decoding/encoding,video})
|
||||||
Set the number of threads to be used, in case the selected codec
|
|
||||||
implementation supports multi-threading.
|
|
||||||
|
|
||||||
Possible values:
|
Possible values:
|
||||||
@table @samp
|
@table @samp
|
||||||
@item auto, 0
|
@item auto
|
||||||
automatically select the number of threads to set
|
detect a good number of threads
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
Default value is @samp{auto}.
|
@item me_threshold @var{integer} (@emph{encoding,video})
|
||||||
|
Set motion estimation threshold.
|
||||||
|
|
||||||
|
@item mb_threshold @var{integer} (@emph{encoding,video})
|
||||||
|
Set macroblock threshold.
|
||||||
|
|
||||||
@item dc @var{integer} (@emph{encoding,video})
|
@item dc @var{integer} (@emph{encoding,video})
|
||||||
Set intra_dc_precision.
|
Set intra_dc_precision.
|
||||||
@@ -747,8 +822,41 @@ Set number of macroblock rows at the bottom which are skipped.
|
|||||||
|
|
||||||
@item profile @var{integer} (@emph{encoding,audio,video})
|
@item profile @var{integer} (@emph{encoding,audio,video})
|
||||||
|
|
||||||
Set encoder codec profile. Default value is @samp{unknown}. Encoder specific
|
Possible values:
|
||||||
profiles are documented in the relevant encoder documentation.
|
@table @samp
|
||||||
|
@item unknown
|
||||||
|
|
||||||
|
@item aac_main
|
||||||
|
|
||||||
|
@item aac_low
|
||||||
|
|
||||||
|
@item aac_ssr
|
||||||
|
|
||||||
|
@item aac_ltp
|
||||||
|
|
||||||
|
@item aac_he
|
||||||
|
|
||||||
|
@item aac_he_v2
|
||||||
|
|
||||||
|
@item aac_ld
|
||||||
|
|
||||||
|
@item aac_eld
|
||||||
|
|
||||||
|
@item mpeg2_aac_low
|
||||||
|
|
||||||
|
@item mpeg2_aac_he
|
||||||
|
|
||||||
|
@item dts
|
||||||
|
|
||||||
|
@item dts_es
|
||||||
|
|
||||||
|
@item dts_96_24
|
||||||
|
|
||||||
|
@item dts_hd_hra
|
||||||
|
|
||||||
|
@item dts_hd_ma
|
||||||
|
|
||||||
|
@end table
|
||||||
|
|
||||||
@item level @var{integer} (@emph{encoding,audio,video})
|
@item level @var{integer} (@emph{encoding,audio,video})
|
||||||
|
|
||||||
@@ -771,7 +879,7 @@ Set frame skip factor.
|
|||||||
Set frame skip exponent.
|
Set frame skip exponent.
|
||||||
Negative values behave identical to the corresponding positive ones, except
|
Negative values behave identical to the corresponding positive ones, except
|
||||||
that the score is normalized.
|
that the score is normalized.
|
||||||
Positive values exist primarily for compatibility reasons and are not so useful.
|
Positive values exist primarly for compatibility reasons and are not so useful.
|
||||||
|
|
||||||
@item skipcmp @var{integer} (@emph{encoding,video})
|
@item skipcmp @var{integer} (@emph{encoding,video})
|
||||||
Set frame skip compare function.
|
Set frame skip compare function.
|
||||||
@@ -810,6 +918,9 @@ noise preserving sum of squared differences
|
|||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
|
@item border_mask @var{float} (@emph{encoding,video})
|
||||||
|
Increase the quantizer for macroblocks close to borders.
|
||||||
|
|
||||||
@item mblmin @var{integer} (@emph{encoding,video})
|
@item mblmin @var{integer} (@emph{encoding,video})
|
||||||
Set min macroblock lagrange factor (VBR).
|
Set min macroblock lagrange factor (VBR).
|
||||||
|
|
||||||
@@ -846,9 +957,6 @@ Discard all bidirectional frames.
|
|||||||
@item nokey
|
@item nokey
|
||||||
Discard all frames excepts keyframes.
|
Discard all frames excepts keyframes.
|
||||||
|
|
||||||
@item nointra
|
|
||||||
Discard all frames except I frames.
|
|
||||||
|
|
||||||
@item all
|
@item all
|
||||||
Discard all frames.
|
Discard all frames.
|
||||||
@end table
|
@end table
|
||||||
@@ -873,6 +981,10 @@ Set chroma qp offset from luma.
|
|||||||
@item trellis @var{integer} (@emph{encoding,audio,video})
|
@item trellis @var{integer} (@emph{encoding,audio,video})
|
||||||
Set rate-distortion optimal quantization.
|
Set rate-distortion optimal quantization.
|
||||||
|
|
||||||
|
@item sc_factor @var{integer} (@emph{encoding,video})
|
||||||
|
Set value multiplied by qscale for each frame and added to
|
||||||
|
scene_change_score.
|
||||||
|
|
||||||
@item mv0_threshold @var{integer} (@emph{encoding,video})
|
@item mv0_threshold @var{integer} (@emph{encoding,video})
|
||||||
@item b_sensitivity @var{integer} (@emph{encoding,video})
|
@item b_sensitivity @var{integer} (@emph{encoding,video})
|
||||||
Adjust sensitivity of b_frame_strategy 1.
|
Adjust sensitivity of b_frame_strategy 1.
|
||||||
@@ -883,6 +995,9 @@ Adjust sensitivity of b_frame_strategy 1.
|
|||||||
@item timecode_frame_start @var{integer} (@emph{encoding,video})
|
@item timecode_frame_start @var{integer} (@emph{encoding,video})
|
||||||
Set GOP timecode frame start number, in non drop frame format.
|
Set GOP timecode frame start number, in non drop frame format.
|
||||||
|
|
||||||
|
@item request_channels @var{integer} (@emph{decoding,audio})
|
||||||
|
Set desired number of audio channels.
|
||||||
|
|
||||||
@item bits_per_raw_sample @var{integer}
|
@item bits_per_raw_sample @var{integer}
|
||||||
@item channel_layout @var{integer} (@emph{decoding/encoding,audio})
|
@item channel_layout @var{integer} (@emph{decoding/encoding,audio})
|
||||||
|
|
||||||
@@ -897,142 +1012,11 @@ Possible values:
|
|||||||
@item rc_max_vbv_use @var{float} (@emph{encoding,video})
|
@item rc_max_vbv_use @var{float} (@emph{encoding,video})
|
||||||
@item rc_min_vbv_use @var{float} (@emph{encoding,video})
|
@item rc_min_vbv_use @var{float} (@emph{encoding,video})
|
||||||
@item ticks_per_frame @var{integer} (@emph{decoding/encoding,audio,video})
|
@item ticks_per_frame @var{integer} (@emph{decoding/encoding,audio,video})
|
||||||
|
|
||||||
@item color_primaries @var{integer} (@emph{decoding/encoding,video})
|
@item color_primaries @var{integer} (@emph{decoding/encoding,video})
|
||||||
Possible values:
|
|
||||||
@table @samp
|
|
||||||
@item bt709
|
|
||||||
BT.709
|
|
||||||
@item bt470m
|
|
||||||
BT.470 M
|
|
||||||
@item bt470bg
|
|
||||||
BT.470 BG
|
|
||||||
@item smpte170m
|
|
||||||
SMPTE 170 M
|
|
||||||
@item smpte240m
|
|
||||||
SMPTE 240 M
|
|
||||||
@item film
|
|
||||||
Film
|
|
||||||
@item bt2020
|
|
||||||
BT.2020
|
|
||||||
@item smpte428
|
|
||||||
@item smpte428_1
|
|
||||||
SMPTE ST 428-1
|
|
||||||
@item smpte431
|
|
||||||
SMPTE 431-2
|
|
||||||
@item smpte432
|
|
||||||
SMPTE 432-1
|
|
||||||
@item jedec-p22
|
|
||||||
JEDEC P22
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@item color_trc @var{integer} (@emph{decoding/encoding,video})
|
@item color_trc @var{integer} (@emph{decoding/encoding,video})
|
||||||
Possible values:
|
|
||||||
@table @samp
|
|
||||||
@item bt709
|
|
||||||
BT.709
|
|
||||||
@item gamma22
|
|
||||||
BT.470 M
|
|
||||||
@item gamma28
|
|
||||||
BT.470 BG
|
|
||||||
@item smpte170m
|
|
||||||
SMPTE 170 M
|
|
||||||
@item smpte240m
|
|
||||||
SMPTE 240 M
|
|
||||||
@item linear
|
|
||||||
Linear
|
|
||||||
@item log
|
|
||||||
@item log100
|
|
||||||
Log
|
|
||||||
@item log_sqrt
|
|
||||||
@item log316
|
|
||||||
Log square root
|
|
||||||
@item iec61966_2_4
|
|
||||||
@item iec61966-2-4
|
|
||||||
IEC 61966-2-4
|
|
||||||
@item bt1361
|
|
||||||
@item bt1361e
|
|
||||||
BT.1361
|
|
||||||
@item iec61966_2_1
|
|
||||||
@item iec61966-2-1
|
|
||||||
IEC 61966-2-1
|
|
||||||
@item bt2020_10
|
|
||||||
@item bt2020_10bit
|
|
||||||
BT.2020 - 10 bit
|
|
||||||
@item bt2020_12
|
|
||||||
@item bt2020_12bit
|
|
||||||
BT.2020 - 12 bit
|
|
||||||
@item smpte2084
|
|
||||||
SMPTE ST 2084
|
|
||||||
@item smpte428
|
|
||||||
@item smpte428_1
|
|
||||||
SMPTE ST 428-1
|
|
||||||
@item arib-std-b67
|
|
||||||
ARIB STD-B67
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@item colorspace @var{integer} (@emph{decoding/encoding,video})
|
@item colorspace @var{integer} (@emph{decoding/encoding,video})
|
||||||
Possible values:
|
|
||||||
@table @samp
|
|
||||||
@item rgb
|
|
||||||
RGB
|
|
||||||
@item bt709
|
|
||||||
BT.709
|
|
||||||
@item fcc
|
|
||||||
FCC
|
|
||||||
@item bt470bg
|
|
||||||
BT.470 BG
|
|
||||||
@item smpte170m
|
|
||||||
SMPTE 170 M
|
|
||||||
@item smpte240m
|
|
||||||
SMPTE 240 M
|
|
||||||
@item ycocg
|
|
||||||
YCOCG
|
|
||||||
@item bt2020nc
|
|
||||||
@item bt2020_ncl
|
|
||||||
BT.2020 NCL
|
|
||||||
@item bt2020c
|
|
||||||
@item bt2020_cl
|
|
||||||
BT.2020 CL
|
|
||||||
@item smpte2085
|
|
||||||
SMPTE 2085
|
|
||||||
@item chroma-derived-nc
|
|
||||||
Chroma-derived NCL
|
|
||||||
@item chroma-derived-c
|
|
||||||
Chroma-derived CL
|
|
||||||
@item ictcp
|
|
||||||
ICtCp
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@item color_range @var{integer} (@emph{decoding/encoding,video})
|
@item color_range @var{integer} (@emph{decoding/encoding,video})
|
||||||
If used as input parameter, it serves as a hint to the decoder, which
|
|
||||||
color_range the input has.
|
|
||||||
Possible values:
|
|
||||||
@table @samp
|
|
||||||
@item tv
|
|
||||||
@item mpeg
|
|
||||||
MPEG (219*2^(n-8))
|
|
||||||
@item pc
|
|
||||||
@item jpeg
|
|
||||||
JPEG (2^n-1)
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@item chroma_sample_location @var{integer} (@emph{decoding/encoding,video})
|
@item chroma_sample_location @var{integer} (@emph{decoding/encoding,video})
|
||||||
Possible values:
|
|
||||||
@table @samp
|
|
||||||
@item left
|
|
||||||
|
|
||||||
@item center
|
|
||||||
|
|
||||||
@item topleft
|
|
||||||
|
|
||||||
@item top
|
|
||||||
|
|
||||||
@item bottomleft
|
|
||||||
|
|
||||||
@item bottom
|
|
||||||
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@item log_level_offset @var{integer}
|
@item log_level_offset @var{integer}
|
||||||
Set the log level offset.
|
Set the log level offset.
|
||||||
@@ -1041,26 +1025,15 @@ Set the log level offset.
|
|||||||
Number of slices, used in parallelized encoding.
|
Number of slices, used in parallelized encoding.
|
||||||
|
|
||||||
@item thread_type @var{flags} (@emph{decoding/encoding,video})
|
@item thread_type @var{flags} (@emph{decoding/encoding,video})
|
||||||
Select which multithreading methods to use.
|
Select multithreading type.
|
||||||
|
|
||||||
Use of @samp{frame} will increase decoding delay by one frame per
|
|
||||||
thread, so clients which cannot provide future frames should not use
|
|
||||||
it.
|
|
||||||
|
|
||||||
Possible values:
|
Possible values:
|
||||||
@table @samp
|
@table @samp
|
||||||
@item slice
|
@item slice
|
||||||
Decode more than one part of a single frame at once.
|
|
||||||
|
|
||||||
Multithreading using slices works only when the video was encoded with
|
|
||||||
slices.
|
|
||||||
|
|
||||||
@item frame
|
@item frame
|
||||||
Decode more than one frame at once.
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
Default value is @samp{slice+frame}.
|
|
||||||
|
|
||||||
@item audio_service_type @var{integer} (@emph{encoding,audio})
|
@item audio_service_type @var{integer} (@emph{encoding,audio})
|
||||||
Set audio service type.
|
Set audio service type.
|
||||||
|
|
||||||
@@ -1111,37 +1084,10 @@ Interlaced video, top coded first, bottom displayed first
|
|||||||
Interlaced video, bottom coded first, top displayed first
|
Interlaced video, bottom coded first, top displayed first
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@item skip_alpha @var{bool} (@emph{decoding,video})
|
@item skip_alpha @var{integer} (@emph{decoding,video})
|
||||||
Set to 1 to disable processing alpha (transparency). This works like the
|
Set to 1 to disable processing alpha (transparency). This works like the
|
||||||
@samp{gray} flag in the @option{flags} option which skips chroma information
|
@samp{gray} flag in the @option{flags} option which skips chroma information
|
||||||
instead of alpha. Default is 0.
|
instead of alpha. Default is 0.
|
||||||
|
|
||||||
@item codec_whitelist @var{list} (@emph{input})
|
|
||||||
"," separated list of allowed decoders. By default all are allowed.
|
|
||||||
|
|
||||||
@item dump_separator @var{string} (@emph{input})
|
|
||||||
Separator used to separate the fields printed on the command line about the
|
|
||||||
Stream parameters.
|
|
||||||
For example, to separate the fields with newlines and indentation:
|
|
||||||
@example
|
|
||||||
ffprobe -dump_separator "
|
|
||||||
" -i ~/videos/matrixbench_mpeg2.mpg
|
|
||||||
@end example
|
|
||||||
|
|
||||||
@item max_pixels @var{integer} (@emph{decoding/encoding,video})
|
|
||||||
Maximum number of pixels per image. This value can be used to avoid out of
|
|
||||||
memory failures due to large images.
|
|
||||||
|
|
||||||
@item apply_cropping @var{bool} (@emph{decoding,video})
|
|
||||||
Enable cropping if cropping parameters are multiples of the required
|
|
||||||
alignment for the left and top parameters. If the alignment is not met the
|
|
||||||
cropping will be partially applied to maintain alignment.
|
|
||||||
Default is 1 (enabled).
|
|
||||||
Note: The required alignment depends on if @code{AV_CODEC_FLAG_UNALIGNED} is set and the
|
|
||||||
CPU. @code{AV_CODEC_FLAG_UNALIGNED} cannot be changed from the command line. Also hardware
|
|
||||||
decoders will not apply left/top Cropping.
|
|
||||||
|
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@c man end CODEC OPTIONS
|
@c man end CODEC OPTIONS
|
||||||
|
|||||||
@@ -25,19 +25,6 @@ enabled decoders.
|
|||||||
A description of some of the currently available video decoders
|
A description of some of the currently available video decoders
|
||||||
follows.
|
follows.
|
||||||
|
|
||||||
@section av1
|
|
||||||
|
|
||||||
AOMedia Video 1 (AV1) decoder.
|
|
||||||
|
|
||||||
@subsection Options
|
|
||||||
|
|
||||||
@table @option
|
|
||||||
|
|
||||||
@item operating_point
|
|
||||||
Select an operating point of a scalable AV1 bitstream (0 - 31). Default is 0.
|
|
||||||
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@section rawvideo
|
@section rawvideo
|
||||||
|
|
||||||
Raw video decoder.
|
Raw video decoder.
|
||||||
@@ -60,66 +47,6 @@ top-field-first is assumed
|
|||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@section libdav1d
|
|
||||||
|
|
||||||
dav1d AV1 decoder.
|
|
||||||
|
|
||||||
libdav1d allows libavcodec to decode the AOMedia Video 1 (AV1) codec.
|
|
||||||
Requires the presence of the libdav1d headers and library during configuration.
|
|
||||||
You need to explicitly configure the build with @code{--enable-libdav1d}.
|
|
||||||
|
|
||||||
@subsection Options
|
|
||||||
|
|
||||||
The following options are supported by the libdav1d wrapper.
|
|
||||||
|
|
||||||
@table @option
|
|
||||||
|
|
||||||
@item framethreads
|
|
||||||
Set amount of frame threads to use during decoding. The default value is 0 (autodetect).
|
|
||||||
|
|
||||||
@item tilethreads
|
|
||||||
Set amount of tile threads to use during decoding. The default value is 0 (autodetect).
|
|
||||||
|
|
||||||
@item filmgrain
|
|
||||||
Apply film grain to the decoded video if present in the bitstream. Defaults to the
|
|
||||||
internal default of the library.
|
|
||||||
|
|
||||||
@item oppoint
|
|
||||||
Select an operating point of a scalable AV1 bitstream (0 - 31). Defaults to the
|
|
||||||
internal default of the library.
|
|
||||||
|
|
||||||
@item alllayers
|
|
||||||
Output all spatial layers of a scalable AV1 bitstream. The default value is false.
|
|
||||||
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@section libdavs2
|
|
||||||
|
|
||||||
AVS2-P2/IEEE1857.4 video decoder wrapper.
|
|
||||||
|
|
||||||
This decoder allows libavcodec to decode AVS2 streams with davs2 library.
|
|
||||||
|
|
||||||
@c man end VIDEO DECODERS
|
|
||||||
|
|
||||||
@section libuavs3d
|
|
||||||
|
|
||||||
AVS3-P2/IEEE1857.10 video decoder.
|
|
||||||
|
|
||||||
libuavs3d allows libavcodec to decode AVS3 streams.
|
|
||||||
Requires the presence of the libuavs3d headers and library during configuration.
|
|
||||||
You need to explicitly configure the build with @code{--enable-libuavs3d}.
|
|
||||||
|
|
||||||
@subsection Options
|
|
||||||
|
|
||||||
The following option is supported by the libuavs3d wrapper.
|
|
||||||
|
|
||||||
@table @option
|
|
||||||
|
|
||||||
@item frame_threads
|
|
||||||
Set amount of frame threads to use during decoding. The default value is 0 (autodetect).
|
|
||||||
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@c man end VIDEO DECODERS
|
@c man end VIDEO DECODERS
|
||||||
|
|
||||||
@chapter Audio Decoders
|
@chapter Audio Decoders
|
||||||
@@ -141,7 +68,7 @@ the undocumented RealAudio 3 (a.k.a. dnet).
|
|||||||
|
|
||||||
@item -drc_scale @var{value}
|
@item -drc_scale @var{value}
|
||||||
Dynamic Range Scale Factor. The factor to apply to dynamic range values
|
Dynamic Range Scale Factor. The factor to apply to dynamic range values
|
||||||
from the AC-3 stream. This factor is applied exponentially. The default value is 1.
|
from the AC-3 stream. This factor is applied exponentially.
|
||||||
There are 3 notable scale factor ranges:
|
There are 3 notable scale factor ranges:
|
||||||
@table @option
|
@table @option
|
||||||
@item drc_scale == 0
|
@item drc_scale == 0
|
||||||
@@ -156,26 +83,9 @@ Loud sounds are fully compressed. Soft sounds are enhanced.
|
|||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@section flac
|
|
||||||
|
|
||||||
FLAC audio decoder.
|
|
||||||
|
|
||||||
This decoder aims to implement the complete FLAC specification from Xiph.
|
|
||||||
|
|
||||||
@subsection FLAC Decoder options
|
|
||||||
|
|
||||||
@table @option
|
|
||||||
|
|
||||||
@item -use_buggy_lpc
|
|
||||||
The lavc FLAC encoder used to produce buggy streams with high lpc values
|
|
||||||
(like the default value). This option makes it possible to decode such streams
|
|
||||||
correctly by using lavc's old buggy lpc logic for decoding.
|
|
||||||
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@section ffwavesynth
|
@section ffwavesynth
|
||||||
|
|
||||||
Internal wave synthesizer.
|
Internal wave synthetizer.
|
||||||
|
|
||||||
This decoder generates wave patterns according to predefined sequences. Its
|
This decoder generates wave patterns according to predefined sequences. Its
|
||||||
use is purely internal and the format of the data it accepts is not publicly
|
use is purely internal and the format of the data it accepts is not publicly
|
||||||
@@ -253,58 +163,11 @@ Requires the presence of the libopus headers and library during
|
|||||||
configuration. You need to explicitly configure the build with
|
configuration. You need to explicitly configure the build with
|
||||||
@code{--enable-libopus}.
|
@code{--enable-libopus}.
|
||||||
|
|
||||||
An FFmpeg native decoder for Opus exists, so users can decode Opus
|
|
||||||
without this library.
|
|
||||||
|
|
||||||
@c man end AUDIO DECODERS
|
@c man end AUDIO DECODERS
|
||||||
|
|
||||||
@chapter Subtitles Decoders
|
@chapter Subtitles Decoders
|
||||||
@c man begin SUBTILES DECODERS
|
@c man begin SUBTILES DECODERS
|
||||||
|
|
||||||
@section libaribb24
|
|
||||||
|
|
||||||
ARIB STD-B24 caption decoder.
|
|
||||||
|
|
||||||
Implements profiles A and C of the ARIB STD-B24 standard.
|
|
||||||
|
|
||||||
@subsection libaribb24 Decoder Options
|
|
||||||
|
|
||||||
@table @option
|
|
||||||
|
|
||||||
@item -aribb24-base-path @var{path}
|
|
||||||
Sets the base path for the libaribb24 library. This is utilized for reading of
|
|
||||||
configuration files (for custom unicode conversions), and for dumping of
|
|
||||||
non-text symbols as images under that location.
|
|
||||||
|
|
||||||
Unset by default.
|
|
||||||
|
|
||||||
@item -aribb24-skip-ruby-text @var{boolean}
|
|
||||||
Tells the decoder wrapper to skip text blocks that contain half-height ruby
|
|
||||||
text.
|
|
||||||
|
|
||||||
Enabled by default.
|
|
||||||
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@section dvbsub
|
|
||||||
|
|
||||||
@subsection Options
|
|
||||||
|
|
||||||
@table @option
|
|
||||||
@item compute_clut
|
|
||||||
@table @option
|
|
||||||
@item -1
|
|
||||||
Compute clut if no matching CLUT is in the stream.
|
|
||||||
@item 0
|
|
||||||
Never compute CLUT
|
|
||||||
@item 1
|
|
||||||
Always compute CLUT and override the one provided in the stream.
|
|
||||||
@end table
|
|
||||||
@item dvb_substream
|
|
||||||
Selects the dvb substream, or all substreams if -1 which is default.
|
|
||||||
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@section dvdsub
|
@section dvdsub
|
||||||
|
|
||||||
This codec decodes the bitmap subtitles used in DVDs; the same subtitles can
|
This codec decodes the bitmap subtitles used in DVDs; the same subtitles can
|
||||||
@@ -321,18 +184,9 @@ palette is stored in the IFO file, and therefore not available when reading
|
|||||||
from dumped VOB files.
|
from dumped VOB files.
|
||||||
|
|
||||||
The format for this option is a string containing 16 24-bits hexadecimal
|
The format for this option is a string containing 16 24-bits hexadecimal
|
||||||
numbers (without 0x prefix) separated by commas, for example @code{0d00ee,
|
numbers (without 0x prefix) separated by comas, for example @code{0d00ee,
|
||||||
ee450d, 101010, eaeaea, 0ce60b, ec14ed, ebff0b, 0d617a, 7b7b7b, d1d1d1,
|
ee450d, 101010, eaeaea, 0ce60b, ec14ed, ebff0b, 0d617a, 7b7b7b, d1d1d1,
|
||||||
7b2a0e, 0d950c, 0f007b, cf0dec, cfa80c, 7c127b}.
|
7b2a0e, 0d950c, 0f007b, cf0dec, cfa80c, 7c127b}.
|
||||||
|
|
||||||
@item ifo_palette
|
|
||||||
Specify the IFO file from which the global palette is obtained.
|
|
||||||
(experimental)
|
|
||||||
|
|
||||||
@item forced_subs_only
|
|
||||||
Only decode subtitle entries marked as forced. Some titles have forced
|
|
||||||
and non-forced subtitles in the same track. Setting this flag to @code{1}
|
|
||||||
will only keep the forced subtitles. Default value is @code{0}.
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@section libzvbi-teletext
|
@section libzvbi-teletext
|
||||||
@@ -346,30 +200,18 @@ configuration. You need to explicitly configure the build with
|
|||||||
|
|
||||||
@table @option
|
@table @option
|
||||||
@item txt_page
|
@item txt_page
|
||||||
List of teletext page numbers to decode. Pages that do not match the specified
|
List of teletext page numbers to decode. You may use the special * string to
|
||||||
list are dropped. You may use the special @code{*} string to match all pages,
|
match all pages. Pages that do not match the specified list are dropped.
|
||||||
or @code{subtitle} to match all subtitle pages.
|
|
||||||
Default value is *.
|
Default value is *.
|
||||||
@item txt_default_region
|
|
||||||
Set default character set used for decoding, a value between 0 and 87 (see
|
|
||||||
ETS 300 706, Section 15, Table 32). Default value is -1, which does not
|
|
||||||
override the libzvbi default. This option is needed for some legacy level 1.0
|
|
||||||
transmissions which cannot signal the proper charset.
|
|
||||||
@item txt_chop_top
|
@item txt_chop_top
|
||||||
Discards the top teletext line. Default value is 1.
|
Discards the top teletext line. Default value is 1.
|
||||||
@item txt_format
|
@item txt_format
|
||||||
Specifies the format of the decoded subtitles.
|
Specifies the format of the decoded subtitles. The teletext decoder is capable
|
||||||
@table @option
|
of decoding the teletext pages to bitmaps or to simple text, you should use
|
||||||
@item bitmap
|
"bitmap" for teletext pages, because certain graphics and colors cannot be
|
||||||
The default format, you should use this for teletext pages, because certain
|
expressed in simple text. You might use "text" for teletext based subtitles if
|
||||||
graphics and colors cannot be expressed in simple text or even ASS.
|
your application can handle simple text based subtitles. Default value is
|
||||||
@item text
|
bitmap.
|
||||||
Simple text based output without formatting.
|
|
||||||
@item ass
|
|
||||||
Formatted ASS output, subtitle pages and teletext pages are returned in
|
|
||||||
different styles, subtitle pages are stripped down to text, but an effort is
|
|
||||||
made to keep the text alignment and the formatting.
|
|
||||||
@end table
|
|
||||||
@item txt_left
|
@item txt_left
|
||||||
X offset of generated bitmaps, default is 0.
|
X offset of generated bitmaps, default is 0.
|
||||||
@item txt_top
|
@item txt_top
|
||||||
@@ -378,21 +220,14 @@ Y offset of generated bitmaps, default is 0.
|
|||||||
Chops leading and trailing spaces and removes empty lines from the generated
|
Chops leading and trailing spaces and removes empty lines from the generated
|
||||||
text. This option is useful for teletext based subtitles where empty spaces may
|
text. This option is useful for teletext based subtitles where empty spaces may
|
||||||
be present at the start or at the end of the lines or empty lines may be
|
be present at the start or at the end of the lines or empty lines may be
|
||||||
present between the subtitle lines because of double-sized teletext characters.
|
present between the subtitle lines because of double-sized teletext charactes.
|
||||||
Default value is 1.
|
Default value is 1.
|
||||||
@item txt_duration
|
@item txt_duration
|
||||||
Sets the display duration of the decoded teletext pages or subtitles in
|
Sets the display duration of the decoded teletext pages or subtitles in
|
||||||
milliseconds. Default value is -1 which means infinity or until the next
|
miliseconds. Default value is 30000 which is 30 seconds.
|
||||||
subtitle event comes.
|
|
||||||
@item txt_transparent
|
@item txt_transparent
|
||||||
Force transparent background of the generated teletext bitmaps. Default value
|
Force transparent background of the generated teletext bitmaps. Default value
|
||||||
is 0 which means an opaque background.
|
is 0 which means an opaque (black) background.
|
||||||
@item txt_opacity
|
|
||||||
Sets the opacity (0-255) of the teletext background. If
|
|
||||||
@option{txt_transparent} is not set, it only affects characters between a start
|
|
||||||
box and an end box, typically subtitles. Default value is 0 if
|
|
||||||
@option{txt_transparent} is set, 255 otherwise.
|
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@c man end SUBTILES DECODERS
|
@c man end SUBTILES DECODERS
|
||||||
|
|||||||
@@ -13,37 +13,21 @@ You can disable all the demuxers using the configure option
|
|||||||
the option @code{--enable-demuxer=@var{DEMUXER}}, or disable it
|
the option @code{--enable-demuxer=@var{DEMUXER}}, or disable it
|
||||||
with the option @code{--disable-demuxer=@var{DEMUXER}}.
|
with the option @code{--disable-demuxer=@var{DEMUXER}}.
|
||||||
|
|
||||||
The option @code{-demuxers} of the ff* tools will display the list of
|
The option @code{-formats} of the ff* tools will display the list of
|
||||||
enabled demuxers. Use @code{-formats} to view a combined list of
|
enabled demuxers.
|
||||||
enabled demuxers and muxers.
|
|
||||||
|
|
||||||
The description of some of the currently available demuxers follows.
|
The description of some of the currently available demuxers follows.
|
||||||
|
|
||||||
@section aa
|
@section applehttp
|
||||||
|
|
||||||
Audible Format 2, 3, and 4 demuxer.
|
Apple HTTP Live Streaming demuxer.
|
||||||
|
|
||||||
This demuxer is used to demux Audible Format 2, 3, and 4 (.aa) files.
|
This demuxer presents all AVStreams from all variant streams.
|
||||||
|
The id field is set to the bitrate variant index number. By setting
|
||||||
@section apng
|
the discard flags on AVStreams (by pressing 'a' or 'v' in ffplay),
|
||||||
|
the caller can decide which variant streams to actually receive.
|
||||||
Animated Portable Network Graphics demuxer.
|
The total bitrate of the variant that the stream belongs to is
|
||||||
|
available in a metadata key named "variant_bitrate".
|
||||||
This demuxer is used to demux APNG files.
|
|
||||||
All headers, but the PNG signature, up to (but not including) the first
|
|
||||||
fcTL chunk are transmitted as extradata.
|
|
||||||
Frames are then split as being all the chunks between two fcTL ones, or
|
|
||||||
between the last fcTL and IEND chunks.
|
|
||||||
|
|
||||||
@table @option
|
|
||||||
@item -ignore_loop @var{bool}
|
|
||||||
Ignore the loop variable in the file if set.
|
|
||||||
@item -max_fps @var{int}
|
|
||||||
Maximum framerate in frames per second (0 for no limit).
|
|
||||||
@item -default_fps @var{int}
|
|
||||||
Default framerate in frames per second when none is specified in the file
|
|
||||||
(0 meaning as fast as possible).
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@section asf
|
@section asf
|
||||||
|
|
||||||
@@ -62,7 +46,7 @@ Do not try to resynchronize by looking for a certain optional start code.
|
|||||||
Virtual concatenation script demuxer.
|
Virtual concatenation script demuxer.
|
||||||
|
|
||||||
This demuxer reads a list of files and other directives from a text file and
|
This demuxer reads a list of files and other directives from a text file and
|
||||||
demuxes them one after the other, as if all their packets had been muxed
|
demuxes them one after the other, as if all their packet had been muxed
|
||||||
together.
|
together.
|
||||||
|
|
||||||
The timestamps in the files are adjusted so that the first file starts at 0
|
The timestamps in the files are adjusted so that the first file starts at 0
|
||||||
@@ -90,14 +74,14 @@ following directive is recognized:
|
|||||||
Path to a file to read; special characters and spaces must be escaped with
|
Path to a file to read; special characters and spaces must be escaped with
|
||||||
backslash or single quotes.
|
backslash or single quotes.
|
||||||
|
|
||||||
All subsequent file-related directives apply to that file.
|
All subsequent directives apply to that file.
|
||||||
|
|
||||||
@item @code{ffconcat version 1.0}
|
@item @code{ffconcat version 1.0}
|
||||||
Identify the script type and version. It also sets the @option{safe} option
|
Identify the script type and version. It also sets the @option{safe} option
|
||||||
to 1 if it was -1.
|
to 1 if it was to its default -1.
|
||||||
|
|
||||||
To make FFmpeg recognize the format automatically, this directive must
|
To make FFmpeg recognize the format automatically, this directive must
|
||||||
appear exactly as is (no extra space or byte-order-mark) on the very first
|
appears exactly as is (no extra space or byte-order-mark) on the very first
|
||||||
line of the script.
|
line of the script.
|
||||||
|
|
||||||
@item @code{duration @var{dur}}
|
@item @code{duration @var{dur}}
|
||||||
@@ -108,63 +92,6 @@ file is not available or accurate.
|
|||||||
If the duration is set for all files, then it is possible to seek in the
|
If the duration is set for all files, then it is possible to seek in the
|
||||||
whole concatenated video.
|
whole concatenated video.
|
||||||
|
|
||||||
@item @code{inpoint @var{timestamp}}
|
|
||||||
In point of the file. When the demuxer opens the file it instantly seeks to the
|
|
||||||
specified timestamp. Seeking is done so that all streams can be presented
|
|
||||||
successfully at In point.
|
|
||||||
|
|
||||||
This directive works best with intra frame codecs, because for non-intra frame
|
|
||||||
ones you will usually get extra packets before the actual In point and the
|
|
||||||
decoded content will most likely contain frames before In point too.
|
|
||||||
|
|
||||||
For each file, packets before the file In point will have timestamps less than
|
|
||||||
the calculated start timestamp of the file (negative in case of the first
|
|
||||||
file), and the duration of the files (if not specified by the @code{duration}
|
|
||||||
directive) will be reduced based on their specified In point.
|
|
||||||
|
|
||||||
Because of potential packets before the specified In point, packet timestamps
|
|
||||||
may overlap between two concatenated files.
|
|
||||||
|
|
||||||
@item @code{outpoint @var{timestamp}}
|
|
||||||
Out point of the file. When the demuxer reaches the specified decoding
|
|
||||||
timestamp in any of the streams, it handles it as an end of file condition and
|
|
||||||
skips the current and all the remaining packets from all streams.
|
|
||||||
|
|
||||||
Out point is exclusive, which means that the demuxer will not output packets
|
|
||||||
with a decoding timestamp greater or equal to Out point.
|
|
||||||
|
|
||||||
This directive works best with intra frame codecs and formats where all streams
|
|
||||||
are tightly interleaved. For non-intra frame codecs you will usually get
|
|
||||||
additional packets with presentation timestamp after Out point therefore the
|
|
||||||
decoded content will most likely contain frames after Out point too. If your
|
|
||||||
streams are not tightly interleaved you may not get all the packets from all
|
|
||||||
streams before Out point and you may only will be able to decode the earliest
|
|
||||||
stream until Out point.
|
|
||||||
|
|
||||||
The duration of the files (if not specified by the @code{duration}
|
|
||||||
directive) will be reduced based on their specified Out point.
|
|
||||||
|
|
||||||
@item @code{file_packet_metadata @var{key=value}}
|
|
||||||
Metadata of the packets of the file. The specified metadata will be set for
|
|
||||||
each file packet. You can specify this directive multiple times to add multiple
|
|
||||||
metadata entries.
|
|
||||||
|
|
||||||
@item @code{stream}
|
|
||||||
Introduce a stream in the virtual file.
|
|
||||||
All subsequent stream-related directives apply to the last introduced
|
|
||||||
stream.
|
|
||||||
Some streams properties must be set in order to allow identifying the
|
|
||||||
matching streams in the subfiles.
|
|
||||||
If no streams are defined in the script, the streams from the first file are
|
|
||||||
copied.
|
|
||||||
|
|
||||||
@item @code{exact_stream_id @var{id}}
|
|
||||||
Set the id of the stream.
|
|
||||||
If this directive is given, the string with the corresponding id in the
|
|
||||||
subfiles will be used.
|
|
||||||
This is especially useful for MPEG-PS (VOB) files, where the order of the
|
|
||||||
streams is not reliable.
|
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@subsection Options
|
@subsection Options
|
||||||
@@ -182,171 +109,46 @@ component.
|
|||||||
|
|
||||||
If set to 0, any file name is accepted.
|
If set to 0, any file name is accepted.
|
||||||
|
|
||||||
The default is 1.
|
The default is -1, it is equivalent to 1 if the format was automatically
|
||||||
|
|
||||||
-1 is equivalent to 1 if the format was automatically
|
|
||||||
probed and 0 otherwise.
|
probed and 0 otherwise.
|
||||||
|
|
||||||
@item auto_convert
|
|
||||||
If set to 1, try to perform automatic conversions on packet data to make the
|
|
||||||
streams concatenable.
|
|
||||||
The default is 1.
|
|
||||||
|
|
||||||
Currently, the only conversion is adding the h264_mp4toannexb bitstream
|
|
||||||
filter to H.264 streams in MP4 format. This is necessary in particular if
|
|
||||||
there are resolution changes.
|
|
||||||
|
|
||||||
@item segment_time_metadata
|
|
||||||
If set to 1, every packet will contain the @var{lavf.concat.start_time} and the
|
|
||||||
@var{lavf.concat.duration} packet metadata values which are the start_time and
|
|
||||||
the duration of the respective file segments in the concatenated output
|
|
||||||
expressed in microseconds. The duration metadata is only set if it is known
|
|
||||||
based on the concat file.
|
|
||||||
The default is 0.
|
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@subsection Examples
|
@section flv
|
||||||
|
|
||||||
@itemize
|
|
||||||
@item
|
|
||||||
Use absolute filenames and include some comments:
|
|
||||||
@example
|
|
||||||
# my first filename
|
|
||||||
file /mnt/share/file-1.wav
|
|
||||||
# my second filename including whitespace
|
|
||||||
file '/mnt/share/file 2.wav'
|
|
||||||
# my third filename including whitespace plus single quote
|
|
||||||
file '/mnt/share/file 3'\''.wav'
|
|
||||||
@end example
|
|
||||||
|
|
||||||
@item
|
|
||||||
Allow for input format auto-probing, use safe filenames and set the duration of
|
|
||||||
the first file:
|
|
||||||
@example
|
|
||||||
ffconcat version 1.0
|
|
||||||
|
|
||||||
file file-1.wav
|
|
||||||
duration 20.0
|
|
||||||
|
|
||||||
file subdir/file-2.wav
|
|
||||||
@end example
|
|
||||||
@end itemize
|
|
||||||
|
|
||||||
@section dash
|
|
||||||
|
|
||||||
Dynamic Adaptive Streaming over HTTP demuxer.
|
|
||||||
|
|
||||||
This demuxer presents all AVStreams found in the manifest.
|
|
||||||
By setting the discard flags on AVStreams the caller can decide
|
|
||||||
which streams to actually receive.
|
|
||||||
Each stream mirrors the @code{id} and @code{bandwidth} properties from the
|
|
||||||
@code{<Representation>} as metadata keys named "id" and "variant_bitrate" respectively.
|
|
||||||
|
|
||||||
@section flv, live_flv
|
|
||||||
|
|
||||||
Adobe Flash Video Format demuxer.
|
Adobe Flash Video Format demuxer.
|
||||||
|
|
||||||
This demuxer is used to demux FLV files and RTMP network streams. In case of live network streams, if you force format, you may use live_flv option instead of flv to survive timestamp discontinuities.
|
This demuxer is used to demux FLV files and RTMP network streams.
|
||||||
|
|
||||||
@example
|
|
||||||
ffmpeg -f flv -i myfile.flv ...
|
|
||||||
ffmpeg -f live_flv -i rtmp://<any.server>/anything/key ....
|
|
||||||
@end example
|
|
||||||
|
|
||||||
|
|
||||||
@table @option
|
@table @option
|
||||||
@item -flv_metadata @var{bool}
|
@item -flv_metadata @var{bool}
|
||||||
Allocate the streams according to the onMetaData array content.
|
Allocate the streams according to the onMetaData array content.
|
||||||
|
|
||||||
@item -flv_ignore_prevtag @var{bool}
|
|
||||||
Ignore the size of previous tag value.
|
|
||||||
|
|
||||||
@item -flv_full_metadata @var{bool}
|
|
||||||
Output all context of the onMetadata.
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@section gif
|
@section libgme
|
||||||
|
|
||||||
Animated GIF demuxer.
|
The Game Music Emu library is a collection of video game music file emulators.
|
||||||
|
|
||||||
It accepts the following options:
|
See @url{http://code.google.com/p/game-music-emu/} for more information.
|
||||||
|
|
||||||
@table @option
|
Some files have multiple tracks. The demuxer will pick the first track by
|
||||||
@item min_delay
|
default. The @option{track_index} option can be used to select a different
|
||||||
Set the minimum valid delay between frames in hundredths of seconds.
|
track. Track indexes start at 0. The demuxer exports the number of tracks as
|
||||||
Range is 0 to 6000. Default value is 2.
|
@var{tracks} meta data entry.
|
||||||
|
|
||||||
@item max_gif_delay
|
For very large files, the @option{max_size} option may have to be adjusted.
|
||||||
Set the maximum valid delay between frames in hundredth of seconds.
|
|
||||||
Range is 0 to 65535. Default value is 65535 (nearly eleven minutes),
|
|
||||||
the maximum value allowed by the specification.
|
|
||||||
|
|
||||||
@item default_delay
|
@section libquvi
|
||||||
Set the default delay between frames in hundredths of seconds.
|
|
||||||
Range is 0 to 6000. Default value is 10.
|
|
||||||
|
|
||||||
@item ignore_loop
|
Play media from Internet services using the quvi project.
|
||||||
GIF files can contain information to loop a certain number of times (or
|
|
||||||
infinitely). If @option{ignore_loop} is set to 1, then the loop setting
|
|
||||||
from the input will be ignored and looping will not occur. If set to 0,
|
|
||||||
then looping will occur and will cycle the number of times according to
|
|
||||||
the GIF. Default value is 1.
|
|
||||||
@end table
|
|
||||||
|
|
||||||
For example, with the overlay filter, place an infinitely looping GIF
|
The demuxer accepts a @option{format} option to request a specific quality. It
|
||||||
over another video:
|
is by default set to @var{best}.
|
||||||
@example
|
|
||||||
ffmpeg -i input.mp4 -ignore_loop 0 -i input.gif -filter_complex overlay=shortest=1 out.mkv
|
|
||||||
@end example
|
|
||||||
|
|
||||||
Note that in the above example the shortest option for overlay filter is
|
See @url{http://quvi.sourceforge.net/} for more information.
|
||||||
used to end the output video at the length of the shortest input file,
|
|
||||||
which in this case is @file{input.mp4} as the GIF in this example loops
|
|
||||||
infinitely.
|
|
||||||
|
|
||||||
@section hls
|
FFmpeg needs to be built with @code{--enable-libquvi} for this demuxer to be
|
||||||
|
enabled.
|
||||||
HLS demuxer
|
|
||||||
|
|
||||||
Apple HTTP Live Streaming demuxer.
|
|
||||||
|
|
||||||
This demuxer presents all AVStreams from all variant streams.
|
|
||||||
The id field is set to the bitrate variant index number. By setting
|
|
||||||
the discard flags on AVStreams (by pressing 'a' or 'v' in ffplay),
|
|
||||||
the caller can decide which variant streams to actually receive.
|
|
||||||
The total bitrate of the variant that the stream belongs to is
|
|
||||||
available in a metadata key named "variant_bitrate".
|
|
||||||
|
|
||||||
It accepts the following options:
|
|
||||||
|
|
||||||
@table @option
|
|
||||||
@item live_start_index
|
|
||||||
segment index to start live streams at (negative values are from the end).
|
|
||||||
|
|
||||||
@item allowed_extensions
|
|
||||||
',' separated list of file extensions that hls is allowed to access.
|
|
||||||
|
|
||||||
@item max_reload
|
|
||||||
Maximum number of times a insufficient list is attempted to be reloaded.
|
|
||||||
Default value is 1000.
|
|
||||||
|
|
||||||
@item m3u8_hold_counters
|
|
||||||
The maximum number of times to load m3u8 when it refreshes without new segments.
|
|
||||||
Default value is 1000.
|
|
||||||
|
|
||||||
@item http_persistent
|
|
||||||
Use persistent HTTP connections. Applicable only for HTTP streams.
|
|
||||||
Enabled by default.
|
|
||||||
|
|
||||||
@item http_multiple
|
|
||||||
Use multiple HTTP connections for downloading HTTP segments.
|
|
||||||
Enabled by default for HTTP/1.1 servers.
|
|
||||||
|
|
||||||
@item http_seekable
|
|
||||||
Use HTTP partial requests for downloading HTTP segments.
|
|
||||||
0 = disable, 1 = enable, -1 = auto, Default is auto.
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@section image2
|
@section image2
|
||||||
|
|
||||||
@@ -373,10 +175,6 @@ Select the pattern type used to interpret the provided filename.
|
|||||||
|
|
||||||
@var{pattern_type} accepts one of the following values.
|
@var{pattern_type} accepts one of the following values.
|
||||||
@table @option
|
@table @option
|
||||||
@item none
|
|
||||||
Disable pattern matching, therefore the video will only contain the specified
|
|
||||||
image. You should use this option if you do not want to create sequences from
|
|
||||||
multiple images and your filenames may contain special pattern characters.
|
|
||||||
@item sequence
|
@item sequence
|
||||||
Select a sequence pattern type, used to specify a sequence of files
|
Select a sequence pattern type, used to specify a sequence of files
|
||||||
indexed by sequential numbers.
|
indexed by sequential numbers.
|
||||||
@@ -451,22 +249,9 @@ is 5.
|
|||||||
If set to 1, will set frame timestamp to modification time of image file. Note
|
If set to 1, will set frame timestamp to modification time of image file. Note
|
||||||
that monotonity of timestamps is not provided: images go in the same order as
|
that monotonity of timestamps is not provided: images go in the same order as
|
||||||
without this option. Default value is 0.
|
without this option. Default value is 0.
|
||||||
If set to 2, will set frame timestamp to the modification time of the image file in
|
|
||||||
nanosecond precision.
|
|
||||||
@item video_size
|
@item video_size
|
||||||
Set the video size of the images to read. If not specified the video
|
Set the video size of the images to read. If not specified the video
|
||||||
size is guessed from the first image file in the sequence.
|
size is guessed from the first image file in the sequence.
|
||||||
@item export_path_metadata
|
|
||||||
If set to 1, will add two extra fields to the metadata found in input, making them
|
|
||||||
also available for other filters (see @var{drawtext} filter for examples). Default
|
|
||||||
value is 0. The extra fields are described below:
|
|
||||||
@table @option
|
|
||||||
@item lavf.image2dec.source_path
|
|
||||||
Corresponds to the full path to the input file being read.
|
|
||||||
@item lavf.image2dec.source_basename
|
|
||||||
Corresponds to the name of the file being read.
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@subsection Examples
|
@subsection Examples
|
||||||
@@ -494,246 +279,17 @@ ffmpeg -framerate 10 -pattern_type glob -i "*.png" out.mkv
|
|||||||
@end example
|
@end example
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
@section libgme
|
|
||||||
|
|
||||||
The Game Music Emu library is a collection of video game music file emulators.
|
|
||||||
|
|
||||||
See @url{https://bitbucket.org/mpyne/game-music-emu/overview} for more information.
|
|
||||||
|
|
||||||
It accepts the following options:
|
|
||||||
|
|
||||||
@table @option
|
|
||||||
|
|
||||||
@item track_index
|
|
||||||
Set the index of which track to demux. The demuxer can only export one track.
|
|
||||||
Track indexes start at 0. Default is to pick the first track. Number of tracks
|
|
||||||
is exported as @var{tracks} metadata entry.
|
|
||||||
|
|
||||||
@item sample_rate
|
|
||||||
Set the sampling rate of the exported track. Range is 1000 to 999999. Default is 44100.
|
|
||||||
|
|
||||||
@item max_size @emph{(bytes)}
|
|
||||||
The demuxer buffers the entire file into memory. Adjust this value to set the maximum buffer size,
|
|
||||||
which in turn, acts as a ceiling for the size of files that can be read.
|
|
||||||
Default is 50 MiB.
|
|
||||||
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@section libmodplug
|
|
||||||
|
|
||||||
ModPlug based module demuxer
|
|
||||||
|
|
||||||
See @url{https://github.com/Konstanty/libmodplug}
|
|
||||||
|
|
||||||
It will export one 2-channel 16-bit 44.1 kHz audio stream.
|
|
||||||
Optionally, a @code{pal8} 16-color video stream can be exported with or without printed metadata.
|
|
||||||
|
|
||||||
It accepts the following options:
|
|
||||||
|
|
||||||
@table @option
|
|
||||||
@item noise_reduction
|
|
||||||
Apply a simple low-pass filter. Can be 1 (on) or 0 (off). Default is 0.
|
|
||||||
|
|
||||||
@item reverb_depth
|
|
||||||
Set amount of reverb. Range 0-100. Default is 0.
|
|
||||||
|
|
||||||
@item reverb_delay
|
|
||||||
Set delay in ms, clamped to 40-250 ms. Default is 0.
|
|
||||||
|
|
||||||
@item bass_amount
|
|
||||||
Apply bass expansion a.k.a. XBass or megabass. Range is 0 (quiet) to 100 (loud). Default is 0.
|
|
||||||
|
|
||||||
@item bass_range
|
|
||||||
Set cutoff i.e. upper-bound for bass frequencies. Range is 10-100 Hz. Default is 0.
|
|
||||||
|
|
||||||
@item surround_depth
|
|
||||||
Apply a Dolby Pro-Logic surround effect. Range is 0 (quiet) to 100 (heavy). Default is 0.
|
|
||||||
|
|
||||||
@item surround_delay
|
|
||||||
Set surround delay in ms, clamped to 5-40 ms. Default is 0.
|
|
||||||
|
|
||||||
@item max_size
|
|
||||||
The demuxer buffers the entire file into memory. Adjust this value to set the maximum buffer size,
|
|
||||||
which in turn, acts as a ceiling for the size of files that can be read. Range is 0 to 100 MiB.
|
|
||||||
0 removes buffer size limit (not recommended). Default is 5 MiB.
|
|
||||||
|
|
||||||
@item video_stream_expr
|
|
||||||
String which is evaluated using the eval API to assign colors to the generated video stream.
|
|
||||||
Variables which can be used are @code{x}, @code{y}, @code{w}, @code{h}, @code{t}, @code{speed},
|
|
||||||
@code{tempo}, @code{order}, @code{pattern} and @code{row}.
|
|
||||||
|
|
||||||
@item video_stream
|
|
||||||
Generate video stream. Can be 1 (on) or 0 (off). Default is 0.
|
|
||||||
|
|
||||||
@item video_stream_w
|
|
||||||
Set video frame width in 'chars' where one char indicates 8 pixels. Range is 20-512. Default is 30.
|
|
||||||
|
|
||||||
@item video_stream_h
|
|
||||||
Set video frame height in 'chars' where one char indicates 8 pixels. Range is 20-512. Default is 30.
|
|
||||||
|
|
||||||
@item video_stream_ptxt
|
|
||||||
Print metadata on video stream. Includes @code{speed}, @code{tempo}, @code{order}, @code{pattern},
|
|
||||||
@code{row} and @code{ts} (time in ms). Can be 1 (on) or 0 (off). Default is 1.
|
|
||||||
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@section libopenmpt
|
|
||||||
|
|
||||||
libopenmpt based module demuxer
|
|
||||||
|
|
||||||
See @url{https://lib.openmpt.org/libopenmpt/} for more information.
|
|
||||||
|
|
||||||
Some files have multiple subsongs (tracks) this can be set with the @option{subsong}
|
|
||||||
option.
|
|
||||||
|
|
||||||
It accepts the following options:
|
|
||||||
|
|
||||||
@table @option
|
|
||||||
@item subsong
|
|
||||||
Set the subsong index. This can be either 'all', 'auto', or the index of the
|
|
||||||
subsong. Subsong indexes start at 0. The default is 'auto'.
|
|
||||||
|
|
||||||
The default value is to let libopenmpt choose.
|
|
||||||
|
|
||||||
@item layout
|
|
||||||
Set the channel layout. Valid values are 1, 2, and 4 channel layouts.
|
|
||||||
The default value is STEREO.
|
|
||||||
|
|
||||||
@item sample_rate
|
|
||||||
Set the sample rate for libopenmpt to output.
|
|
||||||
Range is from 1000 to INT_MAX. The value default is 48000.
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@section mov/mp4/3gp
|
|
||||||
|
|
||||||
Demuxer for Quicktime File Format & ISO/IEC Base Media File Format (ISO/IEC 14496-12 or MPEG-4 Part 12, ISO/IEC 15444-12 or JPEG 2000 Part 12).
|
|
||||||
|
|
||||||
Registered extensions: mov, mp4, m4a, 3gp, 3g2, mj2, psp, m4b, ism, ismv, isma, f4v
|
|
||||||
|
|
||||||
@subsection Options
|
|
||||||
|
|
||||||
This demuxer accepts the following options:
|
|
||||||
@table @option
|
|
||||||
@item enable_drefs
|
|
||||||
Enable loading of external tracks, disabled by default.
|
|
||||||
Enabling this can theoretically leak information in some use cases.
|
|
||||||
|
|
||||||
@item use_absolute_path
|
|
||||||
Allows loading of external tracks via absolute paths, disabled by default.
|
|
||||||
Enabling this poses a security risk. It should only be enabled if the source
|
|
||||||
is known to be non-malicious.
|
|
||||||
|
|
||||||
@item seek_streams_individually
|
|
||||||
When seeking, identify the closest point in each stream individually and demux packets in
|
|
||||||
that stream from identified point. This can lead to a different sequence of packets compared
|
|
||||||
to demuxing linearly from the beginning. Default is true.
|
|
||||||
|
|
||||||
@item ignore_editlist
|
|
||||||
Ignore any edit list atoms. The demuxer, by default, modifies the stream index to reflect the
|
|
||||||
timeline described by the edit list. Default is false.
|
|
||||||
|
|
||||||
@item advanced_editlist
|
|
||||||
Modify the stream index to reflect the timeline described by the edit list. @code{ignore_editlist}
|
|
||||||
must be set to false for this option to be effective.
|
|
||||||
If both @code{ignore_editlist} and this option are set to false, then only the
|
|
||||||
start of the stream index is modified to reflect initial dwell time or starting timestamp
|
|
||||||
described by the edit list. Default is true.
|
|
||||||
|
|
||||||
@item ignore_chapters
|
|
||||||
Don't parse chapters. This includes GoPro 'HiLight' tags/moments. Note that chapters are
|
|
||||||
only parsed when input is seekable. Default is false.
|
|
||||||
|
|
||||||
@item use_mfra_for
|
|
||||||
For seekable fragmented input, set fragment's starting timestamp from media fragment random access box, if present.
|
|
||||||
|
|
||||||
Following options are available:
|
|
||||||
@table @samp
|
|
||||||
@item auto
|
|
||||||
Auto-detect whether to set mfra timestamps as PTS or DTS @emph{(default)}
|
|
||||||
|
|
||||||
@item dts
|
|
||||||
Set mfra timestamps as DTS
|
|
||||||
|
|
||||||
@item pts
|
|
||||||
Set mfra timestamps as PTS
|
|
||||||
|
|
||||||
@item 0
|
|
||||||
Don't use mfra box to set timestamps
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@item export_all
|
|
||||||
Export unrecognized boxes within the @var{udta} box as metadata entries. The first four
|
|
||||||
characters of the box type are set as the key. Default is false.
|
|
||||||
|
|
||||||
@item export_xmp
|
|
||||||
Export entire contents of @var{XMP_} box and @var{uuid} box as a string with key @code{xmp}. Note that
|
|
||||||
if @code{export_all} is set and this option isn't, the contents of @var{XMP_} box are still exported
|
|
||||||
but with key @code{XMP_}. Default is false.
|
|
||||||
|
|
||||||
@item activation_bytes
|
|
||||||
4-byte key required to decrypt Audible AAX and AAX+ files. See Audible AAX subsection below.
|
|
||||||
|
|
||||||
@item audible_fixed_key
|
|
||||||
Fixed key used for handling Audible AAX/AAX+ files. It has been pre-set so should not be necessary to
|
|
||||||
specify.
|
|
||||||
|
|
||||||
@item decryption_key
|
|
||||||
16-byte key, in hex, to decrypt files encrypted using ISO Common Encryption (CENC/AES-128 CTR; ISO/IEC 23001-7).
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@subsection Audible AAX
|
|
||||||
|
|
||||||
Audible AAX files are encrypted M4B files, and they can be decrypted by specifying a 4 byte activation secret.
|
|
||||||
@example
|
|
||||||
ffmpeg -activation_bytes 1CEB00DA -i test.aax -vn -c:a copy output.mp4
|
|
||||||
@end example
|
|
||||||
|
|
||||||
@section mpegts
|
@section mpegts
|
||||||
|
|
||||||
MPEG-2 transport stream demuxer.
|
MPEG-2 transport stream demuxer.
|
||||||
|
|
||||||
This demuxer accepts the following options:
|
|
||||||
@table @option
|
@table @option
|
||||||
@item resync_size
|
|
||||||
Set size limit for looking up a new synchronization. Default value is
|
|
||||||
65536.
|
|
||||||
|
|
||||||
@item skip_unknown_pmt
|
|
||||||
Skip PMTs for programs not defined in the PAT. Default value is 0.
|
|
||||||
|
|
||||||
@item fix_teletext_pts
|
@item fix_teletext_pts
|
||||||
Override teletext packet PTS and DTS values with the timestamps calculated
|
Overrides teletext packet PTS and DTS values with the timestamps calculated
|
||||||
from the PCR of the first program which the teletext stream is part of and is
|
from the PCR of the first program which the teletext stream is part of and is
|
||||||
not discarded. Default value is 1, set this option to 0 if you want your
|
not discarded. Default value is 1, set this option to 0 if you want your
|
||||||
teletext packet PTS and DTS values untouched.
|
teletext packet PTS and DTS values untouched.
|
||||||
|
|
||||||
@item ts_packetsize
|
|
||||||
Output option carrying the raw packet size in bytes.
|
|
||||||
Show the detected raw packet size, cannot be set by the user.
|
|
||||||
|
|
||||||
@item scan_all_pmts
|
|
||||||
Scan and combine all PMTs. The value is an integer with value from -1
|
|
||||||
to 1 (-1 means automatic setting, 1 means enabled, 0 means
|
|
||||||
disabled). Default value is -1.
|
|
||||||
|
|
||||||
@item merge_pmt_versions
|
|
||||||
Re-use existing streams when a PMT's version is updated and elementary
|
|
||||||
streams move to different PIDs. Default value is 0.
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@section mpjpeg
|
|
||||||
|
|
||||||
MJPEG encapsulated in multi-part MIME demuxer.
|
|
||||||
|
|
||||||
This demuxer allows reading of MJPEG, where each frame is represented as a part of
|
|
||||||
multipart/x-mixed-replace stream.
|
|
||||||
@table @option
|
|
||||||
|
|
||||||
@item strict_mime_boundary
|
|
||||||
Default implementation applies a relaxed standard to multi-part MIME boundary detection,
|
|
||||||
to prevent regression with numerous existing endpoints not generating a proper MIME
|
|
||||||
MJPEG stream. Turning this option on by setting it to 1 will result in a stricter check
|
|
||||||
of the boundary value.
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@section rawvideo
|
@section rawvideo
|
||||||
@@ -816,20 +372,4 @@ Example: convert the captions to a format most players understand:
|
|||||||
ffmpeg -i http://www.ted.com/talks/subtitles/id/1/lang/en talk1-en.srt
|
ffmpeg -i http://www.ted.com/talks/subtitles/id/1/lang/en talk1-en.srt
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@section vapoursynth
|
|
||||||
|
|
||||||
Vapoursynth wrapper.
|
|
||||||
|
|
||||||
Due to security concerns, Vapoursynth scripts will not
|
|
||||||
be autodetected so the input format has to be forced. For ff* CLI tools,
|
|
||||||
add @code{-f vapoursynth} before the input @code{-i yourscript.vpy}.
|
|
||||||
|
|
||||||
This demuxer accepts the following option:
|
|
||||||
@table @option
|
|
||||||
@item max_script_size
|
|
||||||
The demuxer buffers the entire script into memory. Adjust this value to set the maximum buffer size,
|
|
||||||
which in turn, acts as a ceiling for the size of scripts that can be read.
|
|
||||||
Default is 1 MiB.
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@c man end DEMUXERS
|
@c man end DEMUXERS
|
||||||
|
|||||||
@@ -1,79 +0,0 @@
|
|||||||
# FFmpeg project
|
|
||||||
|
|
||||||
## Organisation
|
|
||||||
|
|
||||||
The FFmpeg project is organized through a community working on global consensus.
|
|
||||||
|
|
||||||
Decisions are taken by the ensemble of active members, through voting and
|
|
||||||
are aided by two committees.
|
|
||||||
|
|
||||||
## General Assembly
|
|
||||||
|
|
||||||
The ensemble of active members is called the General Assembly (GA).
|
|
||||||
|
|
||||||
The General Assembly is sovereign and legitimate for all its decisions
|
|
||||||
regarding the FFmpeg project.
|
|
||||||
|
|
||||||
The General Assembly is made up of active contributors.
|
|
||||||
|
|
||||||
Contributors are considered "active contributors" if they have pushed more
|
|
||||||
than 20 patches in the last 36 months in the main FFmpeg repository, or
|
|
||||||
if they have been voted in by the GA.
|
|
||||||
|
|
||||||
Additional members are added to the General Assembly through a vote after
|
|
||||||
proposal by a member of the General Assembly.
|
|
||||||
They are part of the GA for two years, after which they need a confirmation by
|
|
||||||
the GA.
|
|
||||||
|
|
||||||
## Voting
|
|
||||||
|
|
||||||
Voting is done using a ranked voting system, currently running on https://vote.ffmpeg.org/ .
|
|
||||||
|
|
||||||
Majority vote means more than 50% of the expressed ballots.
|
|
||||||
|
|
||||||
## Technical Committee
|
|
||||||
|
|
||||||
The Technical Committee (TC) is here to arbitrate and make decisions when
|
|
||||||
technical conflicts occur in the project.
|
|
||||||
They will consider the merits of all the positions, judge them and make a
|
|
||||||
decision.
|
|
||||||
|
|
||||||
The TC resolves technical conflicts but is not a technical steering committee.
|
|
||||||
|
|
||||||
Decisions by the TC are binding for all the contributors.
|
|
||||||
|
|
||||||
Decisions made by the TC can be re-opened after 1 year or by a majority vote
|
|
||||||
of the General Assembly, requested by one of the member of the GA.
|
|
||||||
|
|
||||||
The TC is elected by the General Assembly for a duration of 1 year, and
|
|
||||||
is composed of 5 members.
|
|
||||||
Members can be re-elected if they wish. A majority vote in the General Assembly
|
|
||||||
can trigger a new election of the TC.
|
|
||||||
|
|
||||||
The members of the TC can be elected from outside of the GA.
|
|
||||||
Candidates for election can either be suggested or self-nominated.
|
|
||||||
|
|
||||||
The conflict resolution process is detailed in the [resolution process](resolution_process.md) document.
|
|
||||||
|
|
||||||
## Community committee
|
|
||||||
|
|
||||||
The Community Committee (CC) is here to arbitrage and make decisions when
|
|
||||||
inter-personal conflicts occur in the project. It will decide quickly and
|
|
||||||
take actions, for the sake of the project.
|
|
||||||
|
|
||||||
The CC can remove privileges of offending members, including removal of
|
|
||||||
commit access and temporary ban from the community.
|
|
||||||
|
|
||||||
Decisions made by the CC can be re-opened after 1 year or by a majority vote
|
|
||||||
of the General Assembly. Indefinite bans from the community must be confirmed
|
|
||||||
by the General Assembly, in a majority vote.
|
|
||||||
|
|
||||||
The CC is elected by the General Assembly for a duration of 1 year, and is
|
|
||||||
composed of 5 members.
|
|
||||||
Members can be re-elected if they wish. A majority vote in the General Assembly
|
|
||||||
can trigger a new election of the CC.
|
|
||||||
|
|
||||||
The members of the CC can be elected from outside of the GA.
|
|
||||||
Candidates for election can either be suggested or self-nominated.
|
|
||||||
|
|
||||||
The CC is governed by and responsible for enforcing the Code of Conduct.
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
# Technical Committee
|
|
||||||
|
|
||||||
_This document only makes sense with the rules from [the community document](community)_.
|
|
||||||
|
|
||||||
The Technical Committee (**TC**) is here to arbitrate and make decisions when
|
|
||||||
technical conflicts occur in the project.
|
|
||||||
|
|
||||||
The TC main role is to resolve technical conflicts.
|
|
||||||
It is therefore not a technical steering committee, but it is understood that
|
|
||||||
some decisions might impact the future of the project.
|
|
||||||
|
|
||||||
# Process
|
|
||||||
|
|
||||||
## Seizing
|
|
||||||
|
|
||||||
The TC can take possession of any technical matter that it sees fit.
|
|
||||||
|
|
||||||
To involve the TC in a matter, email tc@ or CC them on an ongoing discussion.
|
|
||||||
|
|
||||||
As members of TC are developers, they also can email tc@ to raise an issue.
|
|
||||||
|
|
||||||
## Announcement
|
|
||||||
|
|
||||||
The TC, once seized, must announce itself on the main mailing list, with a _[TC]_ tag.
|
|
||||||
|
|
||||||
The TC has 2 modes of operation: a RFC one and an internal one.
|
|
||||||
|
|
||||||
If the TC thinks it needs the input from the larger community, the TC can call
|
|
||||||
for a RFC. Else, it can decide by itself.
|
|
||||||
|
|
||||||
If the disagreement involves a member of the TC, that member should recuse
|
|
||||||
themselves from the decision.
|
|
||||||
|
|
||||||
The decision to use a RFC process or an internal discussion is a discretionary
|
|
||||||
decision of the TC.
|
|
||||||
|
|
||||||
The TC can also reject a seizure for a few reasons such as:
|
|
||||||
the matter was not discussed enough previously; it lacks expertise to reach a
|
|
||||||
beneficial decision on the matter; or the matter is too trivial.
|
|
||||||
|
|
||||||
### RFC call
|
|
||||||
|
|
||||||
In the RFC mode, one person from the TC posts on the mailing list the
|
|
||||||
technical question and will request input from the community.
|
|
||||||
|
|
||||||
The mail will have the following specification:
|
|
||||||
* a precise title
|
|
||||||
* a specific tag [TC RFC]
|
|
||||||
* a top-level email
|
|
||||||
* contain a precise question that does not exceed 100 words and that is answerable by developers
|
|
||||||
* may have an extra description, or a link to a previous discussion, if deemed necessary,
|
|
||||||
* contain a precise end date for the answers.
|
|
||||||
|
|
||||||
The answers from the community must be on the main mailing list and must have
|
|
||||||
the following specification:
|
|
||||||
* keep the tag and the title unchanged
|
|
||||||
* limited to 400 words
|
|
||||||
* a first-level, answering directly to the main email
|
|
||||||
* answering to the question.
|
|
||||||
|
|
||||||
Further replies to answers are permitted, as long as they conform to the
|
|
||||||
community standards of politeness, they are limited to 100 words, and are not
|
|
||||||
nested more than once. (max-depth=2)
|
|
||||||
|
|
||||||
After the end-date, mails on the thread will be ignored.
|
|
||||||
|
|
||||||
Violations of those rules will be escalated through the Community Committee.
|
|
||||||
|
|
||||||
After all the emails are in, the TC has 96 hours to give its final decision.
|
|
||||||
Exceptionally, the TC can request an extra delay, that will be notified on the
|
|
||||||
mailing list.
|
|
||||||
|
|
||||||
### Within TC
|
|
||||||
|
|
||||||
In the internal case, the TC has 96 hours to give its final decision.
|
|
||||||
Exceptionally, the TC can request an extra delay.
|
|
||||||
|
|
||||||
|
|
||||||
## Decisions
|
|
||||||
|
|
||||||
The decisions from the TC will be sent on the mailing list, with the _[TC]_ tag.
|
|
||||||
|
|
||||||
Internally, the TC should take decisions with a majority, or using
|
|
||||||
ranked-choice voting.
|
|
||||||
|
|
||||||
The decision from the TC should be published with a summary of the reasons that
|
|
||||||
lead to this decision.
|
|
||||||
|
|
||||||
The decisions from the TC are final, until the matters are reopened after
|
|
||||||
no less than one year.
|
|
||||||
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
\input texinfo @c -*- texinfo -*-
|
\input texinfo @c -*- texinfo -*-
|
||||||
@documentencoding UTF-8
|
|
||||||
|
|
||||||
@settitle Developer Documentation
|
@settitle Developer Documentation
|
||||||
@titlepage
|
@titlepage
|
||||||
@@ -10,7 +9,9 @@
|
|||||||
|
|
||||||
@contents
|
@contents
|
||||||
|
|
||||||
@chapter Notes for external developers
|
@chapter Developers Guide
|
||||||
|
|
||||||
|
@section Notes for external developers
|
||||||
|
|
||||||
This document is mostly useful for internal FFmpeg developers.
|
This document is mostly useful for internal FFmpeg developers.
|
||||||
External developers who need to use the API in their application should
|
External developers who need to use the API in their application should
|
||||||
@@ -26,15 +27,17 @@ this document.
|
|||||||
|
|
||||||
For more detailed legal information about the use of FFmpeg in
|
For more detailed legal information about the use of FFmpeg in
|
||||||
external programs read the @file{LICENSE} file in the source tree and
|
external programs read the @file{LICENSE} file in the source tree and
|
||||||
consult @url{https://ffmpeg.org/legal.html}.
|
consult @url{http://ffmpeg.org/legal.html}.
|
||||||
|
|
||||||
@chapter Contributing
|
@section Contributing
|
||||||
|
|
||||||
There are 2 ways by which code gets into FFmpeg:
|
There are 3 ways by which code gets into ffmpeg.
|
||||||
@itemize @bullet
|
@itemize @bullet
|
||||||
@item Submitting patches to the ffmpeg-devel mailing list.
|
@item Submitting Patches to the main developer mailing list
|
||||||
See @ref{Submitting patches} for details.
|
see @ref{Submitting patches} for details.
|
||||||
@item Directly committing changes to the main tree.
|
@item Directly committing changes to the main tree.
|
||||||
|
@item Committing changes to a git clone, for example on github.com or
|
||||||
|
gitorious.org. And asking us to merge these changes.
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
Whichever way, changes should be reviewed by the maintainer of the code
|
Whichever way, changes should be reviewed by the maintainer of the code
|
||||||
@@ -43,9 +46,9 @@ The developer making the commit and the author are responsible for their changes
|
|||||||
and should try to fix issues their commit causes.
|
and should try to fix issues their commit causes.
|
||||||
|
|
||||||
@anchor{Coding Rules}
|
@anchor{Coding Rules}
|
||||||
@chapter Coding Rules
|
@section Coding Rules
|
||||||
|
|
||||||
@section Code formatting conventions
|
@subsection Code formatting conventions
|
||||||
|
|
||||||
There are the following guidelines regarding the indentation in files:
|
There are the following guidelines regarding the indentation in files:
|
||||||
|
|
||||||
@@ -61,16 +64,13 @@ rejected by the git repository.
|
|||||||
@item
|
@item
|
||||||
You should try to limit your code lines to 80 characters; however, do so if
|
You should try to limit your code lines to 80 characters; however, do so if
|
||||||
and only if this improves readability.
|
and only if this improves readability.
|
||||||
|
|
||||||
@item
|
|
||||||
K&R coding style is used.
|
|
||||||
@end itemize
|
@end itemize
|
||||||
The presentation is one inspired by 'indent -i4 -kr -nut'.
|
The presentation is one inspired by 'indent -i4 -kr -nut'.
|
||||||
|
|
||||||
The main priority in FFmpeg is simplicity and small code size in order to
|
The main priority in FFmpeg is simplicity and small code size in order to
|
||||||
minimize the bug count.
|
minimize the bug count.
|
||||||
|
|
||||||
@section Comments
|
@subsection Comments
|
||||||
Use the JavaDoc/Doxygen format (see examples below) so that code documentation
|
Use the JavaDoc/Doxygen format (see examples below) so that code documentation
|
||||||
can be generated automatically. All nontrivial functions should have a comment
|
can be generated automatically. All nontrivial functions should have a comment
|
||||||
above them explaining what the function does, even if it is just one sentence.
|
above them explaining what the function does, even if it is just one sentence.
|
||||||
@@ -110,7 +110,7 @@ int myfunc(int my_parameter)
|
|||||||
...
|
...
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@section C language features
|
@subsection C language features
|
||||||
|
|
||||||
FFmpeg is programmed in the ISO C90 language with a few additional
|
FFmpeg is programmed in the ISO C90 language with a few additional
|
||||||
features from ISO C99, namely:
|
features from ISO C99, namely:
|
||||||
@@ -123,21 +123,10 @@ the @samp{inline} keyword;
|
|||||||
@samp{//} comments;
|
@samp{//} comments;
|
||||||
|
|
||||||
@item
|
@item
|
||||||
designated struct initializers (@samp{struct s x = @{ .i = 17 @};});
|
designated struct initializers (@samp{struct s x = @{ .i = 17 @};})
|
||||||
|
|
||||||
@item
|
@item
|
||||||
compound literals (@samp{x = (struct s) @{ 17, 23 @};}).
|
compound literals (@samp{x = (struct s) @{ 17, 23 @};})
|
||||||
|
|
||||||
@item
|
|
||||||
for loops with variable definition (@samp{for (int i = 0; i < 8; i++)});
|
|
||||||
|
|
||||||
@item
|
|
||||||
Variadic macros (@samp{#define ARRAY(nb, ...) (int[nb + 1])@{ nb, __VA_ARGS__ @}});
|
|
||||||
|
|
||||||
@item
|
|
||||||
Implementation defined behavior for signed integers is assumed to match the
|
|
||||||
expected behavior for two's complement. Non representable values in integer
|
|
||||||
casts are binary truncated. Shift right of signed values uses sign extension.
|
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
These features are supported by all compilers we care about, so we will not
|
These features are supported by all compilers we care about, so we will not
|
||||||
@@ -162,11 +151,11 @@ mixing statements and declarations;
|
|||||||
GCC statement expressions (@samp{(x = (@{ int y = 4; y; @})}).
|
GCC statement expressions (@samp{(x = (@{ int y = 4; y; @})}).
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
@section Naming conventions
|
@subsection Naming conventions
|
||||||
All names should be composed with underscores (_), not CamelCase. For example,
|
All names should be composed with underscores (_), not CamelCase. For example,
|
||||||
@samp{avfilter_get_video_buffer} is an acceptable function name and
|
@samp{avfilter_get_video_buffer} is an acceptable function name and
|
||||||
@samp{AVFilterGetVideo} is not. The exception from this are type names, like
|
@samp{AVFilterGetVideo} is not. The exception from this are type names, like
|
||||||
for example structs and enums; they should always be in CamelCase.
|
for example structs and enums; they should always be in the CamelCase
|
||||||
|
|
||||||
There are the following conventions for naming variables and functions:
|
There are the following conventions for naming variables and functions:
|
||||||
|
|
||||||
@@ -186,7 +175,7 @@ e.g. @samp{ff_w64_demuxer}.
|
|||||||
@item
|
@item
|
||||||
For variables and functions visible outside of file scope, used internally
|
For variables and functions visible outside of file scope, used internally
|
||||||
across multiple libraries, use @code{avpriv_} as prefix, for example,
|
across multiple libraries, use @code{avpriv_} as prefix, for example,
|
||||||
@samp{avpriv_report_missing_feature}.
|
@samp{avpriv_aac_parse_header}.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
Each library has its own prefix for public symbols, in addition to the
|
Each library has its own prefix for public symbols, in addition to the
|
||||||
@@ -206,7 +195,7 @@ letter as they are reserved by the C standard. Names starting with @code{_}
|
|||||||
are reserved at the file level and may not be used for externally visible
|
are reserved at the file level and may not be used for externally visible
|
||||||
symbols. If in doubt, just avoid names starting with @code{_} altogether.
|
symbols. If in doubt, just avoid names starting with @code{_} altogether.
|
||||||
|
|
||||||
@section Miscellaneous conventions
|
@subsection Miscellaneous conventions
|
||||||
|
|
||||||
@itemize @bullet
|
@itemize @bullet
|
||||||
@item
|
@item
|
||||||
@@ -218,7 +207,7 @@ Casts should be used only when necessary. Unneeded parentheses
|
|||||||
should also be avoided if they don't make the code easier to understand.
|
should also be avoided if they don't make the code easier to understand.
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
@section Editor configuration
|
@subsection Editor configuration
|
||||||
In order to configure Vim to follow FFmpeg formatting conventions, paste
|
In order to configure Vim to follow FFmpeg formatting conventions, paste
|
||||||
the following snippet into your @file{.vimrc}:
|
the following snippet into your @file{.vimrc}:
|
||||||
@example
|
@example
|
||||||
@@ -238,7 +227,7 @@ autocmd InsertEnter * match ForbiddenWhitespace /\t\|\s\+\%#\@@<!$/
|
|||||||
@end example
|
@end example
|
||||||
|
|
||||||
For Emacs, add these roughly equivalent lines to your @file{.emacs.d/init.el}:
|
For Emacs, add these roughly equivalent lines to your @file{.emacs.d/init.el}:
|
||||||
@lisp
|
@example
|
||||||
(c-add-style "ffmpeg"
|
(c-add-style "ffmpeg"
|
||||||
'("k&r"
|
'("k&r"
|
||||||
(c-basic-offset . 4)
|
(c-basic-offset . 4)
|
||||||
@@ -249,12 +238,12 @@ For Emacs, add these roughly equivalent lines to your @file{.emacs.d/init.el}:
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
(setq c-default-style "ffmpeg")
|
(setq c-default-style "ffmpeg")
|
||||||
@end lisp
|
@end example
|
||||||
|
|
||||||
@chapter Development Policy
|
@section Development Policy
|
||||||
|
|
||||||
@section Patches/Committing
|
@enumerate
|
||||||
@subheading Licenses for patches must be compatible with FFmpeg.
|
@item
|
||||||
Contributions should be licensed under the
|
Contributions should be licensed under the
|
||||||
@uref{http://www.gnu.org/licenses/lgpl-2.1.html, LGPL 2.1},
|
@uref{http://www.gnu.org/licenses/lgpl-2.1.html, LGPL 2.1},
|
||||||
including an "or any later version" clause, or, if you prefer
|
including an "or any later version" clause, or, if you prefer
|
||||||
@@ -267,15 +256,15 @@ preferred.
|
|||||||
If you add a new file, give it a proper license header. Do not copy and
|
If you add a new file, give it a proper license header. Do not copy and
|
||||||
paste it from a random place, use an existing file as template.
|
paste it from a random place, use an existing file as template.
|
||||||
|
|
||||||
@subheading You must not commit code which breaks FFmpeg!
|
@item
|
||||||
This means unfinished code which is enabled and breaks compilation,
|
You must not commit code which breaks FFmpeg! (Meaning unfinished but
|
||||||
or compiles but does not work/breaks the regression tests. Code which
|
enabled code which breaks compilation or compiles but does not work or
|
||||||
is unfinished but disabled may be permitted under-circumstances, like
|
breaks the regression tests)
|
||||||
missing samples or an implementation with a small subset of features.
|
You can commit unfinished stuff (for testing etc), but it must be disabled
|
||||||
Always check the mailing list for any reviewers with issues and test
|
(#ifdef etc) by default so it does not interfere with other developers'
|
||||||
FATE before you push.
|
work.
|
||||||
|
|
||||||
@subheading Keep the main commit message short with an extended description below.
|
@item
|
||||||
The commit message should have a short first line in the form of
|
The commit message should have a short first line in the form of
|
||||||
a @samp{topic: short description} as a header, separated by a newline
|
a @samp{topic: short description} as a header, separated by a newline
|
||||||
from the body consisting of an explanation of why the change is necessary.
|
from the body consisting of an explanation of why the change is necessary.
|
||||||
@@ -283,24 +272,30 @@ If the commit fixes a known bug on the bug tracker, the commit message
|
|||||||
should include its bug ID. Referring to the issue on the bug tracker does
|
should include its bug ID. Referring to the issue on the bug tracker does
|
||||||
not exempt you from writing an excerpt of the bug in the commit message.
|
not exempt you from writing an excerpt of the bug in the commit message.
|
||||||
|
|
||||||
@subheading Testing must be adequate but not excessive.
|
@item
|
||||||
If it works for you, others, and passes FATE then it should be OK to commit
|
You do not have to over-test things. If it works for you, and you think it
|
||||||
it, provided it fits the other committing criteria. You should not worry about
|
should work for others, then commit. If your code has problems
|
||||||
over-testing things. If your code has problems (portability, triggers
|
(portability, triggers compiler bugs, unusual environment etc) they will be
|
||||||
compiler bugs, unusual environment etc) they will be reported and eventually
|
reported and eventually fixed.
|
||||||
fixed.
|
|
||||||
|
|
||||||
@subheading Do not commit unrelated changes together.
|
@item
|
||||||
They should be split them into self-contained pieces. Also do not forget
|
Do not commit unrelated changes together, split them into self-contained
|
||||||
that if part B depends on part A, but A does not depend on B, then A can
|
pieces. Also do not forget that if part B depends on part A, but A does not
|
||||||
and should be committed first and separate from B. Keeping changes well
|
depend on B, then A can and should be committed first and separate from B.
|
||||||
split into self-contained parts makes reviewing and understanding them on
|
Keeping changes well split into self-contained parts makes reviewing and
|
||||||
the commit log mailing list easier. This also helps in case of debugging
|
understanding them on the commit log mailing list easier. This also helps
|
||||||
later on.
|
in case of debugging later on.
|
||||||
Also if you have doubts about splitting or not splitting, do not hesitate to
|
Also if you have doubts about splitting or not splitting, do not hesitate to
|
||||||
ask/discuss it on the developer mailing list.
|
ask/discuss it on the developer mailing list.
|
||||||
|
|
||||||
@subheading Ask before you change the build system (configure, etc).
|
@item
|
||||||
|
Do not change behavior of the programs (renaming options etc) or public
|
||||||
|
API or ABI without first discussing it on the ffmpeg-devel mailing list.
|
||||||
|
Do not remove functionality from the code. Just improve!
|
||||||
|
|
||||||
|
Note: Redundant code can be removed.
|
||||||
|
|
||||||
|
@item
|
||||||
Do not commit changes to the build system (Makefiles, configure script)
|
Do not commit changes to the build system (Makefiles, configure script)
|
||||||
which change behavior, defaults etc, without asking first. The same
|
which change behavior, defaults etc, without asking first. The same
|
||||||
applies to compiler warning fixes, trivial looking fixes and to code
|
applies to compiler warning fixes, trivial looking fixes and to code
|
||||||
@@ -309,7 +304,7 @@ the way we do. Send your changes as patches to the ffmpeg-devel mailing
|
|||||||
list, and if the code maintainers say OK, you may commit. This does not
|
list, and if the code maintainers say OK, you may commit. This does not
|
||||||
apply to files you wrote and/or maintain.
|
apply to files you wrote and/or maintain.
|
||||||
|
|
||||||
@subheading Cosmetic changes should be kept in separate patches.
|
@item
|
||||||
We refuse source indentation and other cosmetic changes if they are mixed
|
We refuse source indentation and other cosmetic changes if they are mixed
|
||||||
with functional changes, such commits will be rejected and removed. Every
|
with functional changes, such commits will be rejected and removed. Every
|
||||||
developer has his own indentation style, you should not change it. Of course
|
developer has his own indentation style, you should not change it. Of course
|
||||||
@@ -323,43 +318,56 @@ NOTE: If you had to put if()@{ .. @} over a large (> 5 lines) chunk of code,
|
|||||||
then either do NOT change the indentation of the inner part within (do not
|
then either do NOT change the indentation of the inner part within (do not
|
||||||
move it to the right)! or do so in a separate commit
|
move it to the right)! or do so in a separate commit
|
||||||
|
|
||||||
@subheading Commit messages should always be filled out properly.
|
@item
|
||||||
Always fill out the commit log message. Describe in a few lines what you
|
Always fill out the commit log message. Describe in a few lines what you
|
||||||
changed and why. You can refer to mailing list postings if you fix a
|
changed and why. You can refer to mailing list postings if you fix a
|
||||||
particular bug. Comments such as "fixed!" or "Changed it." are unacceptable.
|
particular bug. Comments such as "fixed!" or "Changed it." are unacceptable.
|
||||||
Recommended format:
|
Recommended format:
|
||||||
|
|
||||||
@example
|
|
||||||
area changed: Short 1 line description
|
area changed: Short 1 line description
|
||||||
|
|
||||||
details describing what and why and giving references.
|
details describing what and why and giving references.
|
||||||
@end example
|
|
||||||
|
|
||||||
@subheading Credit the author of the patch.
|
@item
|
||||||
Make sure the author of the commit is set correctly. (see git commit --author)
|
Make sure the author of the commit is set correctly. (see git commit --author)
|
||||||
If you apply a patch, send an
|
If you apply a patch, send an
|
||||||
answer to ffmpeg-devel (or wherever you got the patch from) saying that
|
answer to ffmpeg-devel (or wherever you got the patch from) saying that
|
||||||
you applied the patch.
|
you applied the patch.
|
||||||
|
|
||||||
@subheading Complex patches should refer to discussion surrounding them.
|
@item
|
||||||
When applying patches that have been discussed (at length) on the mailing
|
When applying patches that have been discussed (at length) on the mailing
|
||||||
list, reference the thread in the log message.
|
list, reference the thread in the log message.
|
||||||
|
|
||||||
@subheading Always wait long enough before pushing changes
|
@item
|
||||||
Do NOT commit to code actively maintained by others without permission.
|
Do NOT commit to code actively maintained by others without permission.
|
||||||
Send a patch to ffmpeg-devel. If no one answers within a reasonable
|
Send a patch to ffmpeg-devel instead. If no one answers within a reasonable
|
||||||
time-frame (12h for build failures and security fixes, 3 days small changes,
|
timeframe (12h for build failures and security fixes, 3 days small changes,
|
||||||
1 week for big patches) then commit your patch if you think it is OK.
|
1 week for big patches) then commit your patch if you think it is OK.
|
||||||
Also note, the maintainer can simply ask for more time to review!
|
Also note, the maintainer can simply ask for more time to review!
|
||||||
|
|
||||||
@section Code
|
@item
|
||||||
@subheading API/ABI changes should be discussed before they are made.
|
Subscribe to the ffmpeg-cvslog mailing list. The diffs of all commits
|
||||||
Do not change behavior of the programs (renaming options etc) or public
|
are sent there and reviewed by all the other developers. Bugs and possible
|
||||||
API or ABI without first discussing it on the ffmpeg-devel mailing list.
|
improvements or general questions regarding commits are discussed there. We
|
||||||
Do not remove widely used functionality or features (redundant code can be removed).
|
expect you to react if problems with your code are uncovered.
|
||||||
|
|
||||||
@subheading Remember to check if you need to bump versions for libav*.
|
@item
|
||||||
Depending on the change, you may need to change the version integer.
|
Update the documentation if you change behavior or add features. If you are
|
||||||
|
unsure how best to do this, send a patch to ffmpeg-devel, the documentation
|
||||||
|
maintainer(s) will review and commit your stuff.
|
||||||
|
|
||||||
|
@item
|
||||||
|
Try to keep important discussions and requests (also) on the public
|
||||||
|
developer mailing list, so that all developers can benefit from them.
|
||||||
|
|
||||||
|
@item
|
||||||
|
Never write to unallocated memory, never write over the end of arrays,
|
||||||
|
always check values read from some untrusted source before using them
|
||||||
|
as array index or other risky things.
|
||||||
|
|
||||||
|
@item
|
||||||
|
Remember to check if you need to bump versions for the specific libav*
|
||||||
|
parts (libavutil, libavcodec, libavformat) you are changing. You need
|
||||||
|
to change the version integer.
|
||||||
Incrementing the first component means no backward compatibility to
|
Incrementing the first component means no backward compatibility to
|
||||||
previous versions (e.g. removal of a function from the public API).
|
previous versions (e.g. removal of a function from the public API).
|
||||||
Incrementing the second component means backward compatible change
|
Incrementing the second component means backward compatible change
|
||||||
@@ -369,7 +377,7 @@ Incrementing the third component means a noteworthy binary compatible
|
|||||||
change (e.g. encoder bug fix that matters for the decoder). The third
|
change (e.g. encoder bug fix that matters for the decoder). The third
|
||||||
component always starts at 100 to distinguish FFmpeg from Libav.
|
component always starts at 100 to distinguish FFmpeg from Libav.
|
||||||
|
|
||||||
@subheading Warnings for correct code may be disabled if there is no other option.
|
@item
|
||||||
Compiler warnings indicate potential bugs or code with bad style. If a type of
|
Compiler warnings indicate potential bugs or code with bad style. If a type of
|
||||||
warning always points to correct and clean code, that warning should
|
warning always points to correct and clean code, that warning should
|
||||||
be disabled, not the code changed.
|
be disabled, not the code changed.
|
||||||
@@ -378,90 +386,24 @@ If it is a bug, the bug has to be fixed. If it is not, the code should
|
|||||||
be changed to not generate a warning unless that causes a slowdown
|
be changed to not generate a warning unless that causes a slowdown
|
||||||
or obfuscates the code.
|
or obfuscates the code.
|
||||||
|
|
||||||
@subheading Check untrusted input properly.
|
@item
|
||||||
Never write to unallocated memory, never write over the end of arrays,
|
|
||||||
always check values read from some untrusted source before using them
|
|
||||||
as array index or other risky things.
|
|
||||||
|
|
||||||
@section Documentation/Other
|
|
||||||
@subheading Subscribe to the ffmpeg-devel mailing list.
|
|
||||||
It is important to be subscribed to the
|
|
||||||
@uref{https://lists.ffmpeg.org/mailman/listinfo/ffmpeg-devel, ffmpeg-devel}
|
|
||||||
mailing list. Almost any non-trivial patch is to be sent there for review.
|
|
||||||
Other developers may have comments about your contribution. We expect you see
|
|
||||||
those comments, and to improve it if requested. (N.B. Experienced committers
|
|
||||||
have other channels, and may sometimes skip review for trivial fixes.) Also,
|
|
||||||
discussion here about bug fixes and FFmpeg improvements by other developers may
|
|
||||||
be helpful information for you. Finally, by being a list subscriber, your
|
|
||||||
contribution will be posted immediately to the list, without the moderation
|
|
||||||
hold which messages from non-subscribers experience.
|
|
||||||
|
|
||||||
However, it is more important to the project that we receive your patch than
|
|
||||||
that you be subscribed to the ffmpeg-devel list. If you have a patch, and don't
|
|
||||||
want to subscribe and discuss the patch, then please do send it to the list
|
|
||||||
anyway.
|
|
||||||
|
|
||||||
@subheading Subscribe to the ffmpeg-cvslog mailing list.
|
|
||||||
Diffs of all commits are sent to the
|
|
||||||
@uref{https://lists.ffmpeg.org/mailman/listinfo/ffmpeg-cvslog, ffmpeg-cvslog}
|
|
||||||
mailing list. Some developers read this list to review all code base changes
|
|
||||||
from all sources. Subscribing to this list is not mandatory.
|
|
||||||
|
|
||||||
@subheading Keep the documentation up to date.
|
|
||||||
Update the documentation if you change behavior or add features. If you are
|
|
||||||
unsure how best to do this, send a patch to ffmpeg-devel, the documentation
|
|
||||||
maintainer(s) will review and commit your stuff.
|
|
||||||
|
|
||||||
@subheading Important discussions should be accessible to all.
|
|
||||||
Try to keep important discussions and requests (also) on the public
|
|
||||||
developer mailing list, so that all developers can benefit from them.
|
|
||||||
|
|
||||||
@subheading Check your entries in MAINTAINERS.
|
|
||||||
Make sure that no parts of the codebase that you maintain are missing from the
|
Make sure that no parts of the codebase that you maintain are missing from the
|
||||||
@file{MAINTAINERS} file. If something that you want to maintain is missing add it with
|
@file{MAINTAINERS} file. If something that you want to maintain is missing add it with
|
||||||
your name after it.
|
your name after it.
|
||||||
If at some point you no longer want to maintain some code, then please help in
|
If at some point you no longer want to maintain some code, then please help
|
||||||
finding a new maintainer and also don't forget to update the @file{MAINTAINERS} file.
|
finding a new maintainer and also don't forget updating the @file{MAINTAINERS} file.
|
||||||
|
@end enumerate
|
||||||
|
|
||||||
We think our rules are not too hard. If you have comments, contact us.
|
We think our rules are not too hard. If you have comments, contact us.
|
||||||
|
|
||||||
@chapter Code of conduct
|
|
||||||
|
|
||||||
Be friendly and respectful towards others and third parties.
|
|
||||||
Treat others the way you yourself want to be treated.
|
|
||||||
|
|
||||||
Be considerate. Not everyone shares the same viewpoint and priorities as you do.
|
|
||||||
Different opinions and interpretations help the project.
|
|
||||||
Looking at issues from a different perspective assists development.
|
|
||||||
|
|
||||||
Do not assume malice for things that can be attributed to incompetence. Even if
|
|
||||||
it is malice, it's rarely good to start with that as initial assumption.
|
|
||||||
|
|
||||||
Stay friendly even if someone acts contrarily. Everyone has a bad day
|
|
||||||
once in a while.
|
|
||||||
If you yourself have a bad day or are angry then try to take a break and reply
|
|
||||||
once you are calm and without anger if you have to.
|
|
||||||
|
|
||||||
Try to help other team members and cooperate if you can.
|
|
||||||
|
|
||||||
The goal of software development is to create technical excellence, not for any
|
|
||||||
individual to be better and "win" against the others. Large software projects
|
|
||||||
are only possible and successful through teamwork.
|
|
||||||
|
|
||||||
If someone struggles do not put them down. Give them a helping hand
|
|
||||||
instead and point them in the right direction.
|
|
||||||
|
|
||||||
Finally, keep in mind the immortal words of Bill and Ted,
|
|
||||||
"Be excellent to each other."
|
|
||||||
|
|
||||||
@anchor{Submitting patches}
|
@anchor{Submitting patches}
|
||||||
@chapter Submitting patches
|
@section Submitting patches
|
||||||
|
|
||||||
First, read the @ref{Coding Rules} above if you did not yet, in particular
|
First, read the @ref{Coding Rules} above if you did not yet, in particular
|
||||||
the rules regarding patch submission.
|
the rules regarding patch submission.
|
||||||
|
|
||||||
When you submit your patch, please use @code{git format-patch} or
|
When you submit your patch, please use @code{git format-patch} or
|
||||||
@code{git send-email}. We cannot read other diffs :-).
|
@code{git send-email}. We cannot read other diffs :-)
|
||||||
|
|
||||||
Also please do not submit a patch which contains several unrelated changes.
|
Also please do not submit a patch which contains several unrelated changes.
|
||||||
Split it into separate, self-contained pieces. This does not mean splitting
|
Split it into separate, self-contained pieces. This does not mean splitting
|
||||||
@@ -484,15 +426,11 @@ Also please if you send several patches, send each patch as a separate mail,
|
|||||||
do not attach several unrelated patches to the same mail.
|
do not attach several unrelated patches to the same mail.
|
||||||
|
|
||||||
Patches should be posted to the
|
Patches should be posted to the
|
||||||
@uref{https://lists.ffmpeg.org/mailman/listinfo/ffmpeg-devel, ffmpeg-devel}
|
@uref{http://lists.ffmpeg.org/mailman/listinfo/ffmpeg-devel, ffmpeg-devel}
|
||||||
mailing list. Use @code{git send-email} when possible since it will properly
|
mailing list. Use @code{git send-email} when possible since it will properly
|
||||||
send patches without requiring extra care. If you cannot, then send patches
|
send patches without requiring extra care. If you cannot, then send patches
|
||||||
as base64-encoded attachments, so your patch is not trashed during
|
as base64-encoded attachments, so your patch is not trashed during
|
||||||
transmission. Also ensure the correct mime type is used
|
transmission.
|
||||||
(text/x-diff or text/x-patch or at least text/plain) and that only one
|
|
||||||
patch is inline or attached per mail.
|
|
||||||
You can check @url{https://patchwork.ffmpeg.org}, if your patch does not show up, its mime type
|
|
||||||
likely was wrong.
|
|
||||||
|
|
||||||
Your patch will be reviewed on the mailing list. You will likely be asked
|
Your patch will be reviewed on the mailing list. You will likely be asked
|
||||||
to make some changes and are expected to send in an improved version that
|
to make some changes and are expected to send in an improved version that
|
||||||
@@ -504,7 +442,7 @@ Give us a few days to react. But if some time passes without reaction,
|
|||||||
send a reminder by email. Your patch should eventually be dealt with.
|
send a reminder by email. Your patch should eventually be dealt with.
|
||||||
|
|
||||||
|
|
||||||
@chapter New codecs or formats checklist
|
@section New codecs or formats checklist
|
||||||
|
|
||||||
@enumerate
|
@enumerate
|
||||||
@item
|
@item
|
||||||
@@ -556,7 +494,7 @@ Did you make sure it compiles standalone, i.e. with
|
|||||||
@end enumerate
|
@end enumerate
|
||||||
|
|
||||||
|
|
||||||
@chapter Patch submission checklist
|
@section patch submission checklist
|
||||||
|
|
||||||
@enumerate
|
@enumerate
|
||||||
@item
|
@item
|
||||||
@@ -566,9 +504,9 @@ Does @code{make fate} pass with the patch applied?
|
|||||||
Was the patch generated with git format-patch or send-email?
|
Was the patch generated with git format-patch or send-email?
|
||||||
|
|
||||||
@item
|
@item
|
||||||
Did you sign-off your patch? (@code{git commit -s})
|
Did you sign off your patch? (git commit -s)
|
||||||
See @uref{https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/Documentation/process/submitting-patches.rst, Sign your work} for the meaning
|
See @url{http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob_plain;f=Documentation/SubmittingPatches} for the meaning
|
||||||
of @dfn{sign-off}.
|
of sign off.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
Did you provide a clear git commit log message?
|
Did you provide a clear git commit log message?
|
||||||
@@ -601,10 +539,6 @@ tools/trasher, the noise bitstream filter, and
|
|||||||
should not crash, end in a (near) infinite loop, or allocate ridiculous
|
should not crash, end in a (near) infinite loop, or allocate ridiculous
|
||||||
amounts of memory when fed damaged data.
|
amounts of memory when fed damaged data.
|
||||||
|
|
||||||
@item
|
|
||||||
Did you test your decoder or demuxer against sample files?
|
|
||||||
Samples may be obtained at @url{https://samples.ffmpeg.org}.
|
|
||||||
|
|
||||||
@item
|
@item
|
||||||
Does the patch not mix functional and cosmetic changes?
|
Does the patch not mix functional and cosmetic changes?
|
||||||
|
|
||||||
@@ -625,7 +559,7 @@ If the patch fixes a bug, did you provide a verbose analysis of the bug?
|
|||||||
If the patch fixes a bug, did you provide enough information, including
|
If the patch fixes a bug, did you provide enough information, including
|
||||||
a sample, so the bug can be reproduced and the fix can be verified?
|
a sample, so the bug can be reproduced and the fix can be verified?
|
||||||
Note please do not attach samples >100k to mails but rather provide a
|
Note please do not attach samples >100k to mails but rather provide a
|
||||||
URL, you can upload to @url{https://streams.videolan.org/upload/}.
|
URL, you can upload to ftp://upload.ffmpeg.org
|
||||||
|
|
||||||
@item
|
@item
|
||||||
Did you provide a verbose summary about what the patch does change?
|
Did you provide a verbose summary about what the patch does change?
|
||||||
@@ -654,10 +588,10 @@ Lines with similar content should be aligned vertically when doing so
|
|||||||
improves readability.
|
improves readability.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
Consider adding a regression test for your code.
|
Consider to add a regression test for your code.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
If you added YASM code please check that things still work with --disable-yasm.
|
If you added YASM code please check that things still work with --disable-yasm
|
||||||
|
|
||||||
@item
|
@item
|
||||||
Make sure you check the return values of function and return appropriate
|
Make sure you check the return values of function and return appropriate
|
||||||
@@ -669,7 +603,7 @@ Test your code with valgrind and or Address Sanitizer to ensure it's free
|
|||||||
of leaks, out of array accesses, etc.
|
of leaks, out of array accesses, etc.
|
||||||
@end enumerate
|
@end enumerate
|
||||||
|
|
||||||
@chapter Patch review process
|
@section Patch review process
|
||||||
|
|
||||||
All patches posted to ffmpeg-devel will be reviewed, unless they contain a
|
All patches posted to ffmpeg-devel will be reviewed, unless they contain a
|
||||||
clear note that the patch is not for the git master branch.
|
clear note that the patch is not for the git master branch.
|
||||||
@@ -695,12 +629,8 @@ not related to the comments received during review. Such patches will
|
|||||||
be rejected. Instead, submit significant changes or new features as
|
be rejected. Instead, submit significant changes or new features as
|
||||||
separate patches.
|
separate patches.
|
||||||
|
|
||||||
Everyone is welcome to review patches. Also if you are waiting for your patch
|
|
||||||
to be reviewed, please consider helping to review other patches, that is a great
|
|
||||||
way to get everyone's patches reviewed sooner.
|
|
||||||
|
|
||||||
@anchor{Regression tests}
|
@anchor{Regression tests}
|
||||||
@chapter Regression tests
|
@section Regression tests
|
||||||
|
|
||||||
Before submitting a patch (or committing to the repository), you should at least
|
Before submitting a patch (or committing to the repository), you should at least
|
||||||
test that you did not break anything.
|
test that you did not break anything.
|
||||||
@@ -711,18 +641,19 @@ Running 'make fate' accomplishes this, please see @url{fate.html} for details.
|
|||||||
this case, the reference results of the regression tests shall be modified
|
this case, the reference results of the regression tests shall be modified
|
||||||
accordingly].
|
accordingly].
|
||||||
|
|
||||||
@section Adding files to the fate-suite dataset
|
@subsection Adding files to the fate-suite dataset
|
||||||
|
|
||||||
When there is no muxer or encoder available to generate test media for a
|
When there is no muxer or encoder available to generate test media for a
|
||||||
specific test then the media has to be included in the fate-suite.
|
specific test then the media has to be inlcuded in the fate-suite.
|
||||||
First please make sure that the sample file is as small as possible to test the
|
First please make sure that the sample file is as small as possible to test the
|
||||||
respective decoder or demuxer sufficiently. Large files increase network
|
respective decoder or demuxer sufficiently. Large files increase network
|
||||||
bandwidth and disk space requirements.
|
bandwidth and disk space requirements.
|
||||||
Once you have a working fate test and fate sample, provide in the commit
|
Once you have a working fate test and fate sample, provide in the commit
|
||||||
message or introductory message for the patch series that you post to
|
message or introductionary message for the patch series that you post to
|
||||||
the ffmpeg-devel mailing list, a direct link to download the sample media.
|
the ffmpeg-devel mailing list, a direct link to download the sample media.
|
||||||
|
|
||||||
@section Visualizing Test Coverage
|
|
||||||
|
@subsection Visualizing Test Coverage
|
||||||
|
|
||||||
The FFmpeg build system allows visualizing the test coverage in an easy
|
The FFmpeg build system allows visualizing the test coverage in an easy
|
||||||
manner with the coverage tools @code{gcov}/@code{lcov}. This involves
|
manner with the coverage tools @code{gcov}/@code{lcov}. This involves
|
||||||
@@ -749,7 +680,7 @@ You can use the command @code{make lcov-reset} to reset the coverage
|
|||||||
measurements. You will need to rerun @code{make lcov} after running a
|
measurements. You will need to rerun @code{make lcov} after running a
|
||||||
new test.
|
new test.
|
||||||
|
|
||||||
@section Using Valgrind
|
@subsection Using Valgrind
|
||||||
|
|
||||||
The configure script provides a shortcut for using valgrind to spot bugs
|
The configure script provides a shortcut for using valgrind to spot bugs
|
||||||
related to memory handling. Just add the option
|
related to memory handling. Just add the option
|
||||||
@@ -763,13 +694,13 @@ In case you need finer control over how valgrind is invoked, use the
|
|||||||
your configure line instead.
|
your configure line instead.
|
||||||
|
|
||||||
@anchor{Release process}
|
@anchor{Release process}
|
||||||
@chapter Release process
|
@section Release process
|
||||||
|
|
||||||
FFmpeg maintains a set of @strong{release branches}, which are the
|
FFmpeg maintains a set of @strong{release branches}, which are the
|
||||||
recommended deliverable for system integrators and distributors (such as
|
recommended deliverable for system integrators and distributors (such as
|
||||||
Linux distributions, etc.). At regular times, a @strong{release
|
Linux distributions, etc.). At regular times, a @strong{release
|
||||||
manager} prepares, tests and publishes tarballs on the
|
manager} prepares, tests and publishes tarballs on the
|
||||||
@url{https://ffmpeg.org} website.
|
@url{http://ffmpeg.org} website.
|
||||||
|
|
||||||
There are two kinds of releases:
|
There are two kinds of releases:
|
||||||
|
|
||||||
@@ -795,7 +726,7 @@ adjustments to the symbol versioning file. Please discuss such changes
|
|||||||
on the @strong{ffmpeg-devel} mailing list in time to allow forward planning.
|
on the @strong{ffmpeg-devel} mailing list in time to allow forward planning.
|
||||||
|
|
||||||
@anchor{Criteria for Point Releases}
|
@anchor{Criteria for Point Releases}
|
||||||
@section Criteria for Point Releases
|
@subsection Criteria for Point Releases
|
||||||
|
|
||||||
Changes that match the following criteria are valid candidates for
|
Changes that match the following criteria are valid candidates for
|
||||||
inclusion into a point release:
|
inclusion into a point release:
|
||||||
@@ -819,7 +750,7 @@ point releases of the same release branch.
|
|||||||
The order for checking the rules is (1 OR 2 OR 3) AND 4.
|
The order for checking the rules is (1 OR 2 OR 3) AND 4.
|
||||||
|
|
||||||
|
|
||||||
@section Release Checklist
|
@subsection Release Checklist
|
||||||
|
|
||||||
The release process involves the following steps:
|
The release process involves the following steps:
|
||||||
|
|
||||||
@@ -848,7 +779,7 @@ Prepare the release tarballs in @code{bz2} and @code{gz} formats, and
|
|||||||
supplementing files that contain @code{gpg} signatures
|
supplementing files that contain @code{gpg} signatures
|
||||||
|
|
||||||
@item
|
@item
|
||||||
Publish the tarballs at @url{https://ffmpeg.org/releases}. Create and
|
Publish the tarballs at @url{http://ffmpeg.org/releases}. Create and
|
||||||
push an annotated tag in the form @code{nX}, with @code{X}
|
push an annotated tag in the form @code{nX}, with @code{X}
|
||||||
containing the version number.
|
containing the version number.
|
||||||
|
|
||||||
@@ -860,7 +791,7 @@ with a news entry for the website.
|
|||||||
Publish the news entry.
|
Publish the news entry.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
Send an announcement to the mailing list.
|
Send announcement to the mailing list.
|
||||||
@end enumerate
|
@end enumerate
|
||||||
|
|
||||||
@bye
|
@bye
|
||||||
|
|||||||
@@ -1,21 +1,12 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
OUT_DIR="${1}"
|
SRC_PATH="${1}"
|
||||||
DOXYFILE="${2}"
|
DOXYFILE="${2}"
|
||||||
DOXYGEN="${3}"
|
|
||||||
|
|
||||||
shift 3
|
shift 2
|
||||||
|
|
||||||
if [ -e "VERSION" ]; then
|
doxygen - <<EOF
|
||||||
VERSION=`cat "VERSION"`
|
|
||||||
else
|
|
||||||
VERSION=`git describe`
|
|
||||||
fi
|
|
||||||
|
|
||||||
$DOXYGEN - <<EOF
|
|
||||||
@INCLUDE = ${DOXYFILE}
|
@INCLUDE = ${DOXYFILE}
|
||||||
INPUT = $@
|
INPUT = $@
|
||||||
HTML_TIMESTAMP = NO
|
EXAMPLE_PATH = ${SRC_PATH}/doc/examples
|
||||||
PROJECT_NUMBER = $VERSION
|
|
||||||
OUTPUT_DIRECTORY = $OUT_DIR
|
|
||||||
EOF
|
EOF
|
||||||
|
|||||||
1
doc/doxy/.gitignore
vendored
1
doc/doxy/.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
/html/
|
|
||||||
2109
doc/encoders.texi
2109
doc/encoders.texi
File diff suppressed because it is too large
Load Diff
@@ -76,7 +76,7 @@ EMFILE POSIX ++++++ Too many open files
|
|||||||
EMLINK POSIX ++++++ Too many links
|
EMLINK POSIX ++++++ Too many links
|
||||||
EMSGSIZE POSIX +++..+ Message too long
|
EMSGSIZE POSIX +++..+ Message too long
|
||||||
EMULTIHOP POSIX ++4... Multihop attempted
|
EMULTIHOP POSIX ++4... Multihop attempted
|
||||||
ENAMETOOLONG POSIX - ++++++ File name too long
|
ENAMETOOLONG POSIX - ++++++ Filen ame too long
|
||||||
ENAVAIL +..... No XENIX semaphores available
|
ENAVAIL +..... No XENIX semaphores available
|
||||||
ENEEDAUTH .++... Need authenticator
|
ENEEDAUTH .++... Need authenticator
|
||||||
ENETDOWN POSIX +++..+ Network is down
|
ENETDOWN POSIX +++..+ Network is down
|
||||||
|
|||||||
24
doc/examples/.gitignore
vendored
24
doc/examples/.gitignore
vendored
@@ -1,24 +0,0 @@
|
|||||||
/avio_list_dir
|
|
||||||
/avio_reading
|
|
||||||
/decode_audio
|
|
||||||
/decode_video
|
|
||||||
/demuxing_decoding
|
|
||||||
/encode_audio
|
|
||||||
/encode_video
|
|
||||||
/extract_mvs
|
|
||||||
/filter_audio
|
|
||||||
/filtering_audio
|
|
||||||
/filtering_video
|
|
||||||
/http_multiclient
|
|
||||||
/hw_decode
|
|
||||||
/metadata
|
|
||||||
/muxing
|
|
||||||
/pc-uninstalled
|
|
||||||
/qsvdec
|
|
||||||
/remuxing
|
|
||||||
/resampling_audio
|
|
||||||
/scaling_video
|
|
||||||
/transcode_aac
|
|
||||||
/transcoding
|
|
||||||
/vaapi_encode
|
|
||||||
/vaapi_transcode
|
|
||||||
@@ -1,64 +1,41 @@
|
|||||||
EXAMPLES-$(CONFIG_AVIO_LIST_DIR_EXAMPLE) += avio_list_dir
|
# use pkg-config for getting CFLAGS and LDLIBS
|
||||||
EXAMPLES-$(CONFIG_AVIO_READING_EXAMPLE) += avio_reading
|
FFMPEG_LIBS= libavdevice \
|
||||||
EXAMPLES-$(CONFIG_DECODE_AUDIO_EXAMPLE) += decode_audio
|
libavformat \
|
||||||
EXAMPLES-$(CONFIG_DECODE_VIDEO_EXAMPLE) += decode_video
|
libavfilter \
|
||||||
EXAMPLES-$(CONFIG_DEMUXING_DECODING_EXAMPLE) += demuxing_decoding
|
libavcodec \
|
||||||
EXAMPLES-$(CONFIG_ENCODE_AUDIO_EXAMPLE) += encode_audio
|
libswresample \
|
||||||
EXAMPLES-$(CONFIG_ENCODE_VIDEO_EXAMPLE) += encode_video
|
libswscale \
|
||||||
EXAMPLES-$(CONFIG_EXTRACT_MVS_EXAMPLE) += extract_mvs
|
libavutil \
|
||||||
EXAMPLES-$(CONFIG_FILTER_AUDIO_EXAMPLE) += filter_audio
|
|
||||||
EXAMPLES-$(CONFIG_FILTERING_AUDIO_EXAMPLE) += filtering_audio
|
|
||||||
EXAMPLES-$(CONFIG_FILTERING_VIDEO_EXAMPLE) += filtering_video
|
|
||||||
EXAMPLES-$(CONFIG_HTTP_MULTICLIENT_EXAMPLE) += http_multiclient
|
|
||||||
EXAMPLES-$(CONFIG_HW_DECODE_EXAMPLE) += hw_decode
|
|
||||||
EXAMPLES-$(CONFIG_METADATA_EXAMPLE) += metadata
|
|
||||||
EXAMPLES-$(CONFIG_MUXING_EXAMPLE) += muxing
|
|
||||||
EXAMPLES-$(CONFIG_QSVDEC_EXAMPLE) += qsvdec
|
|
||||||
EXAMPLES-$(CONFIG_REMUXING_EXAMPLE) += remuxing
|
|
||||||
EXAMPLES-$(CONFIG_RESAMPLING_AUDIO_EXAMPLE) += resampling_audio
|
|
||||||
EXAMPLES-$(CONFIG_SCALING_VIDEO_EXAMPLE) += scaling_video
|
|
||||||
EXAMPLES-$(CONFIG_TRANSCODE_AAC_EXAMPLE) += transcode_aac
|
|
||||||
EXAMPLES-$(CONFIG_TRANSCODING_EXAMPLE) += transcoding
|
|
||||||
EXAMPLES-$(CONFIG_VAAPI_ENCODE_EXAMPLE) += vaapi_encode
|
|
||||||
EXAMPLES-$(CONFIG_VAAPI_TRANSCODE_EXAMPLE) += vaapi_transcode
|
|
||||||
|
|
||||||
EXAMPLES := $(EXAMPLES-yes:%=doc/examples/%$(PROGSSUF)$(EXESUF))
|
CFLAGS += -Wall -g
|
||||||
EXAMPLES_G := $(EXAMPLES-yes:%=doc/examples/%$(PROGSSUF)_g$(EXESUF))
|
CFLAGS := $(shell pkg-config --cflags $(FFMPEG_LIBS)) $(CFLAGS)
|
||||||
ALL_EXAMPLES := $(EXAMPLES) $(EXAMPLES-:%=doc/examples/%$(PROGSSUF)$(EXESUF))
|
LDLIBS := $(shell pkg-config --libs $(FFMPEG_LIBS)) $(LDLIBS)
|
||||||
ALL_EXAMPLES_G := $(EXAMPLES_G) $(EXAMPLES-:%=doc/examples/%$(PROGSSUF)_g$(EXESUF))
|
|
||||||
PROGS += $(EXAMPLES)
|
|
||||||
|
|
||||||
EXAMPLE_MAKEFILE := $(SRC_PATH)/doc/examples/Makefile
|
EXAMPLES= avio_reading \
|
||||||
EXAMPLES_FILES := $(wildcard $(SRC_PATH)/doc/examples/*.c) $(SRC_PATH)/doc/examples/README $(EXAMPLE_MAKEFILE)
|
avcodec \
|
||||||
|
demuxing_decoding \
|
||||||
|
filtering_video \
|
||||||
|
filtering_audio \
|
||||||
|
metadata \
|
||||||
|
muxing \
|
||||||
|
remuxing \
|
||||||
|
resampling_audio \
|
||||||
|
scaling_video \
|
||||||
|
transcode_aac \
|
||||||
|
|
||||||
$(foreach P,$(EXAMPLES),$(eval OBJS-$(P:%$(PROGSSUF)$(EXESUF)=%) = $(P:%$(PROGSSUF)$(EXESUF)=%).o))
|
OBJS=$(addsuffix .o,$(EXAMPLES))
|
||||||
$(EXAMPLES_G): %$(PROGSSUF)_g$(EXESUF): %.o
|
|
||||||
|
|
||||||
examples: $(EXAMPLES)
|
# the following examples make explicit use of the math library
|
||||||
|
avcodec: LDLIBS += -lm
|
||||||
|
muxing: LDLIBS += -lm
|
||||||
|
resampling_audio: LDLIBS += -lm
|
||||||
|
|
||||||
$(EXAMPLES:%$(PROGSSUF)$(EXESUF)=%.o): | doc/examples
|
.phony: all clean-test clean
|
||||||
OUTDIRS += doc/examples
|
|
||||||
|
|
||||||
DOXY_INPUT += $(EXAMPLES:%$(PROGSSUF)$(EXESUF)=%.c)
|
all: $(OBJS) $(EXAMPLES)
|
||||||
|
|
||||||
install: install-examples
|
clean-test:
|
||||||
|
$(RM) test*.pgm test.h264 test.mp2 test.sw test.mpg
|
||||||
|
|
||||||
install-examples: $(EXAMPLES_FILES)
|
clean: clean-test
|
||||||
$(Q)mkdir -p "$(DATADIR)/examples"
|
$(RM) $(EXAMPLES) $(OBJS)
|
||||||
$(INSTALL) -m 644 $(EXAMPLES_FILES) "$(DATADIR)/examples"
|
|
||||||
$(INSTALL) -m 644 $(EXAMPLE_MAKEFILE:%=%.example) "$(DATADIR)/examples/Makefile"
|
|
||||||
|
|
||||||
uninstall: uninstall-examples
|
|
||||||
|
|
||||||
uninstall-examples:
|
|
||||||
$(RM) -r "$(DATADIR)/examples"
|
|
||||||
|
|
||||||
examplesclean:
|
|
||||||
$(RM) $(ALL_EXAMPLES) $(ALL_EXAMPLES_G)
|
|
||||||
$(RM) $(CLEANSUFFIXES:%=doc/examples/%)
|
|
||||||
|
|
||||||
docclean:: examplesclean
|
|
||||||
|
|
||||||
-include $(wildcard $(EXAMPLES:%$(PROGSSUF)$(EXESUF)=%.d))
|
|
||||||
|
|
||||||
.PHONY: examples
|
|
||||||
|
|||||||
@@ -1,50 +0,0 @@
|
|||||||
# use pkg-config for getting CFLAGS and LDLIBS
|
|
||||||
FFMPEG_LIBS= libavdevice \
|
|
||||||
libavformat \
|
|
||||||
libavfilter \
|
|
||||||
libavcodec \
|
|
||||||
libswresample \
|
|
||||||
libswscale \
|
|
||||||
libavutil \
|
|
||||||
|
|
||||||
CFLAGS += -Wall -g
|
|
||||||
CFLAGS := $(shell pkg-config --cflags $(FFMPEG_LIBS)) $(CFLAGS)
|
|
||||||
LDLIBS := $(shell pkg-config --libs $(FFMPEG_LIBS)) $(LDLIBS)
|
|
||||||
|
|
||||||
EXAMPLES= avio_list_dir \
|
|
||||||
avio_reading \
|
|
||||||
decode_audio \
|
|
||||||
decode_video \
|
|
||||||
demuxing_decoding \
|
|
||||||
encode_audio \
|
|
||||||
encode_video \
|
|
||||||
extract_mvs \
|
|
||||||
filtering_video \
|
|
||||||
filtering_audio \
|
|
||||||
http_multiclient \
|
|
||||||
hw_decode \
|
|
||||||
metadata \
|
|
||||||
muxing \
|
|
||||||
remuxing \
|
|
||||||
resampling_audio \
|
|
||||||
scaling_video \
|
|
||||||
transcode_aac \
|
|
||||||
transcoding \
|
|
||||||
|
|
||||||
OBJS=$(addsuffix .o,$(EXAMPLES))
|
|
||||||
|
|
||||||
# the following examples make explicit use of the math library
|
|
||||||
avcodec: LDLIBS += -lm
|
|
||||||
encode_audio: LDLIBS += -lm
|
|
||||||
muxing: LDLIBS += -lm
|
|
||||||
resampling_audio: LDLIBS += -lm
|
|
||||||
|
|
||||||
.phony: all clean-test clean
|
|
||||||
|
|
||||||
all: $(OBJS) $(EXAMPLES)
|
|
||||||
|
|
||||||
clean-test:
|
|
||||||
$(RM) test*.pgm test.h264 test.mp2 test.sw test.mpg
|
|
||||||
|
|
||||||
clean: clean-test
|
|
||||||
$(RM) $(EXAMPLES) $(OBJS)
|
|
||||||
658
doc/examples/avcodec.c
Normal file
658
doc/examples/avcodec.c
Normal file
@@ -0,0 +1,658 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2001 Fabrice Bellard
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* libavcodec API use example.
|
||||||
|
*
|
||||||
|
* @example avcodec.c
|
||||||
|
* Note that libavcodec only handles codecs (mpeg, mpeg4, etc...),
|
||||||
|
* not file formats (avi, vob, mp4, mov, mkv, mxf, flv, mpegts, mpegps, etc...). See library 'libavformat' for the
|
||||||
|
* format handling
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include <libavutil/opt.h>
|
||||||
|
#include <libavcodec/avcodec.h>
|
||||||
|
#include <libavutil/channel_layout.h>
|
||||||
|
#include <libavutil/common.h>
|
||||||
|
#include <libavutil/imgutils.h>
|
||||||
|
#include <libavutil/mathematics.h>
|
||||||
|
#include <libavutil/samplefmt.h>
|
||||||
|
|
||||||
|
#define INBUF_SIZE 4096
|
||||||
|
#define AUDIO_INBUF_SIZE 20480
|
||||||
|
#define AUDIO_REFILL_THRESH 4096
|
||||||
|
|
||||||
|
/* check that a given sample format is supported by the encoder */
|
||||||
|
static int check_sample_fmt(AVCodec *codec, enum AVSampleFormat sample_fmt)
|
||||||
|
{
|
||||||
|
const enum AVSampleFormat *p = codec->sample_fmts;
|
||||||
|
|
||||||
|
while (*p != AV_SAMPLE_FMT_NONE) {
|
||||||
|
if (*p == sample_fmt)
|
||||||
|
return 1;
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* just pick the highest supported samplerate */
|
||||||
|
static int select_sample_rate(AVCodec *codec)
|
||||||
|
{
|
||||||
|
const int *p;
|
||||||
|
int best_samplerate = 0;
|
||||||
|
|
||||||
|
if (!codec->supported_samplerates)
|
||||||
|
return 44100;
|
||||||
|
|
||||||
|
p = codec->supported_samplerates;
|
||||||
|
while (*p) {
|
||||||
|
best_samplerate = FFMAX(*p, best_samplerate);
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
return best_samplerate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* select layout with the highest channel count */
|
||||||
|
static int select_channel_layout(AVCodec *codec)
|
||||||
|
{
|
||||||
|
const uint64_t *p;
|
||||||
|
uint64_t best_ch_layout = 0;
|
||||||
|
int best_nb_channels = 0;
|
||||||
|
|
||||||
|
if (!codec->channel_layouts)
|
||||||
|
return AV_CH_LAYOUT_STEREO;
|
||||||
|
|
||||||
|
p = codec->channel_layouts;
|
||||||
|
while (*p) {
|
||||||
|
int nb_channels = av_get_channel_layout_nb_channels(*p);
|
||||||
|
|
||||||
|
if (nb_channels > best_nb_channels) {
|
||||||
|
best_ch_layout = *p;
|
||||||
|
best_nb_channels = nb_channels;
|
||||||
|
}
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
return best_ch_layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Audio encoding example
|
||||||
|
*/
|
||||||
|
static void audio_encode_example(const char *filename)
|
||||||
|
{
|
||||||
|
AVCodec *codec;
|
||||||
|
AVCodecContext *c= NULL;
|
||||||
|
AVFrame *frame;
|
||||||
|
AVPacket pkt;
|
||||||
|
int i, j, k, ret, got_output;
|
||||||
|
int buffer_size;
|
||||||
|
FILE *f;
|
||||||
|
uint16_t *samples;
|
||||||
|
float t, tincr;
|
||||||
|
|
||||||
|
printf("Encode audio file %s\n", filename);
|
||||||
|
|
||||||
|
/* find the MP2 encoder */
|
||||||
|
codec = avcodec_find_encoder(AV_CODEC_ID_MP2);
|
||||||
|
if (!codec) {
|
||||||
|
fprintf(stderr, "Codec not found\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
c = avcodec_alloc_context3(codec);
|
||||||
|
if (!c) {
|
||||||
|
fprintf(stderr, "Could not allocate audio codec context\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* put sample parameters */
|
||||||
|
c->bit_rate = 64000;
|
||||||
|
|
||||||
|
/* check that the encoder supports s16 pcm input */
|
||||||
|
c->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
|
if (!check_sample_fmt(codec, c->sample_fmt)) {
|
||||||
|
fprintf(stderr, "Encoder does not support sample format %s",
|
||||||
|
av_get_sample_fmt_name(c->sample_fmt));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* select other audio parameters supported by the encoder */
|
||||||
|
c->sample_rate = select_sample_rate(codec);
|
||||||
|
c->channel_layout = select_channel_layout(codec);
|
||||||
|
c->channels = av_get_channel_layout_nb_channels(c->channel_layout);
|
||||||
|
|
||||||
|
/* open it */
|
||||||
|
if (avcodec_open2(c, codec, NULL) < 0) {
|
||||||
|
fprintf(stderr, "Could not open codec\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
f = fopen(filename, "wb");
|
||||||
|
if (!f) {
|
||||||
|
fprintf(stderr, "Could not open %s\n", filename);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* frame containing input raw audio */
|
||||||
|
frame = av_frame_alloc();
|
||||||
|
if (!frame) {
|
||||||
|
fprintf(stderr, "Could not allocate audio frame\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
frame->nb_samples = c->frame_size;
|
||||||
|
frame->format = c->sample_fmt;
|
||||||
|
frame->channel_layout = c->channel_layout;
|
||||||
|
|
||||||
|
/* the codec gives us the frame size, in samples,
|
||||||
|
* we calculate the size of the samples buffer in bytes */
|
||||||
|
buffer_size = av_samples_get_buffer_size(NULL, c->channels, c->frame_size,
|
||||||
|
c->sample_fmt, 0);
|
||||||
|
if (buffer_size < 0) {
|
||||||
|
fprintf(stderr, "Could not get sample buffer size\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
samples = av_malloc(buffer_size);
|
||||||
|
if (!samples) {
|
||||||
|
fprintf(stderr, "Could not allocate %d bytes for samples buffer\n",
|
||||||
|
buffer_size);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
/* setup the data pointers in the AVFrame */
|
||||||
|
ret = avcodec_fill_audio_frame(frame, c->channels, c->sample_fmt,
|
||||||
|
(const uint8_t*)samples, buffer_size, 0);
|
||||||
|
if (ret < 0) {
|
||||||
|
fprintf(stderr, "Could not setup audio frame\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* encode a single tone sound */
|
||||||
|
t = 0;
|
||||||
|
tincr = 2 * M_PI * 440.0 / c->sample_rate;
|
||||||
|
for (i = 0; i < 200; i++) {
|
||||||
|
av_init_packet(&pkt);
|
||||||
|
pkt.data = NULL; // packet data will be allocated by the encoder
|
||||||
|
pkt.size = 0;
|
||||||
|
|
||||||
|
for (j = 0; j < c->frame_size; j++) {
|
||||||
|
samples[2*j] = (int)(sin(t) * 10000);
|
||||||
|
|
||||||
|
for (k = 1; k < c->channels; k++)
|
||||||
|
samples[2*j + k] = samples[2*j];
|
||||||
|
t += tincr;
|
||||||
|
}
|
||||||
|
/* encode the samples */
|
||||||
|
ret = avcodec_encode_audio2(c, &pkt, frame, &got_output);
|
||||||
|
if (ret < 0) {
|
||||||
|
fprintf(stderr, "Error encoding audio frame\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (got_output) {
|
||||||
|
fwrite(pkt.data, 1, pkt.size, f);
|
||||||
|
av_free_packet(&pkt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get the delayed frames */
|
||||||
|
for (got_output = 1; got_output; i++) {
|
||||||
|
ret = avcodec_encode_audio2(c, &pkt, NULL, &got_output);
|
||||||
|
if (ret < 0) {
|
||||||
|
fprintf(stderr, "Error encoding frame\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (got_output) {
|
||||||
|
fwrite(pkt.data, 1, pkt.size, f);
|
||||||
|
av_free_packet(&pkt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
|
av_freep(&samples);
|
||||||
|
av_frame_free(&frame);
|
||||||
|
avcodec_close(c);
|
||||||
|
av_free(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Audio decoding.
|
||||||
|
*/
|
||||||
|
static void audio_decode_example(const char *outfilename, const char *filename)
|
||||||
|
{
|
||||||
|
AVCodec *codec;
|
||||||
|
AVCodecContext *c= NULL;
|
||||||
|
int len;
|
||||||
|
FILE *f, *outfile;
|
||||||
|
uint8_t inbuf[AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];
|
||||||
|
AVPacket avpkt;
|
||||||
|
AVFrame *decoded_frame = NULL;
|
||||||
|
|
||||||
|
av_init_packet(&avpkt);
|
||||||
|
|
||||||
|
printf("Decode audio file %s to %s\n", filename, outfilename);
|
||||||
|
|
||||||
|
/* find the mpeg audio decoder */
|
||||||
|
codec = avcodec_find_decoder(AV_CODEC_ID_MP2);
|
||||||
|
if (!codec) {
|
||||||
|
fprintf(stderr, "Codec not found\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
c = avcodec_alloc_context3(codec);
|
||||||
|
if (!c) {
|
||||||
|
fprintf(stderr, "Could not allocate audio codec context\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* open it */
|
||||||
|
if (avcodec_open2(c, codec, NULL) < 0) {
|
||||||
|
fprintf(stderr, "Could not open codec\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
f = fopen(filename, "rb");
|
||||||
|
if (!f) {
|
||||||
|
fprintf(stderr, "Could not open %s\n", filename);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
outfile = fopen(outfilename, "wb");
|
||||||
|
if (!outfile) {
|
||||||
|
av_free(c);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* decode until eof */
|
||||||
|
avpkt.data = inbuf;
|
||||||
|
avpkt.size = fread(inbuf, 1, AUDIO_INBUF_SIZE, f);
|
||||||
|
|
||||||
|
while (avpkt.size > 0) {
|
||||||
|
int got_frame = 0;
|
||||||
|
|
||||||
|
if (!decoded_frame) {
|
||||||
|
if (!(decoded_frame = av_frame_alloc())) {
|
||||||
|
fprintf(stderr, "Could not allocate audio frame\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
len = avcodec_decode_audio4(c, decoded_frame, &got_frame, &avpkt);
|
||||||
|
if (len < 0) {
|
||||||
|
fprintf(stderr, "Error while decoding\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (got_frame) {
|
||||||
|
/* if a frame has been decoded, output it */
|
||||||
|
int data_size = av_samples_get_buffer_size(NULL, c->channels,
|
||||||
|
decoded_frame->nb_samples,
|
||||||
|
c->sample_fmt, 1);
|
||||||
|
if (data_size < 0) {
|
||||||
|
/* This should not occur, checking just for paranoia */
|
||||||
|
fprintf(stderr, "Failed to calculate data size\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
fwrite(decoded_frame->data[0], 1, data_size, outfile);
|
||||||
|
}
|
||||||
|
avpkt.size -= len;
|
||||||
|
avpkt.data += len;
|
||||||
|
avpkt.dts =
|
||||||
|
avpkt.pts = AV_NOPTS_VALUE;
|
||||||
|
if (avpkt.size < AUDIO_REFILL_THRESH) {
|
||||||
|
/* Refill the input buffer, to avoid trying to decode
|
||||||
|
* incomplete frames. Instead of this, one could also use
|
||||||
|
* a parser, or use a proper container format through
|
||||||
|
* libavformat. */
|
||||||
|
memmove(inbuf, avpkt.data, avpkt.size);
|
||||||
|
avpkt.data = inbuf;
|
||||||
|
len = fread(avpkt.data + avpkt.size, 1,
|
||||||
|
AUDIO_INBUF_SIZE - avpkt.size, f);
|
||||||
|
if (len > 0)
|
||||||
|
avpkt.size += len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(outfile);
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
|
avcodec_close(c);
|
||||||
|
av_free(c);
|
||||||
|
av_frame_free(&decoded_frame);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Video encoding example
|
||||||
|
*/
|
||||||
|
static void video_encode_example(const char *filename, int codec_id)
|
||||||
|
{
|
||||||
|
AVCodec *codec;
|
||||||
|
AVCodecContext *c= NULL;
|
||||||
|
int i, ret, x, y, got_output;
|
||||||
|
FILE *f;
|
||||||
|
AVFrame *frame;
|
||||||
|
AVPacket pkt;
|
||||||
|
uint8_t endcode[] = { 0, 0, 1, 0xb7 };
|
||||||
|
|
||||||
|
printf("Encode video file %s\n", filename);
|
||||||
|
|
||||||
|
/* find the mpeg1 video encoder */
|
||||||
|
codec = avcodec_find_encoder(codec_id);
|
||||||
|
if (!codec) {
|
||||||
|
fprintf(stderr, "Codec not found\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
c = avcodec_alloc_context3(codec);
|
||||||
|
if (!c) {
|
||||||
|
fprintf(stderr, "Could not allocate video codec context\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* put sample parameters */
|
||||||
|
c->bit_rate = 400000;
|
||||||
|
/* resolution must be a multiple of two */
|
||||||
|
c->width = 352;
|
||||||
|
c->height = 288;
|
||||||
|
/* frames per second */
|
||||||
|
c->time_base = (AVRational){1,25};
|
||||||
|
c->gop_size = 10; /* emit one intra frame every ten frames */
|
||||||
|
c->max_b_frames = 1;
|
||||||
|
c->pix_fmt = AV_PIX_FMT_YUV420P;
|
||||||
|
|
||||||
|
if (codec_id == AV_CODEC_ID_H264)
|
||||||
|
av_opt_set(c->priv_data, "preset", "slow", 0);
|
||||||
|
|
||||||
|
/* open it */
|
||||||
|
if (avcodec_open2(c, codec, NULL) < 0) {
|
||||||
|
fprintf(stderr, "Could not open codec\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
f = fopen(filename, "wb");
|
||||||
|
if (!f) {
|
||||||
|
fprintf(stderr, "Could not open %s\n", filename);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
frame = av_frame_alloc();
|
||||||
|
if (!frame) {
|
||||||
|
fprintf(stderr, "Could not allocate video frame\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
frame->format = c->pix_fmt;
|
||||||
|
frame->width = c->width;
|
||||||
|
frame->height = c->height;
|
||||||
|
|
||||||
|
/* the image can be allocated by any means and av_image_alloc() is
|
||||||
|
* just the most convenient way if av_malloc() is to be used */
|
||||||
|
ret = av_image_alloc(frame->data, frame->linesize, c->width, c->height,
|
||||||
|
c->pix_fmt, 32);
|
||||||
|
if (ret < 0) {
|
||||||
|
fprintf(stderr, "Could not allocate raw picture buffer\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* encode 1 second of video */
|
||||||
|
for (i = 0; i < 25; i++) {
|
||||||
|
av_init_packet(&pkt);
|
||||||
|
pkt.data = NULL; // packet data will be allocated by the encoder
|
||||||
|
pkt.size = 0;
|
||||||
|
|
||||||
|
fflush(stdout);
|
||||||
|
/* prepare a dummy image */
|
||||||
|
/* Y */
|
||||||
|
for (y = 0; y < c->height; y++) {
|
||||||
|
for (x = 0; x < c->width; x++) {
|
||||||
|
frame->data[0][y * frame->linesize[0] + x] = x + y + i * 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Cb and Cr */
|
||||||
|
for (y = 0; y < c->height/2; y++) {
|
||||||
|
for (x = 0; x < c->width/2; x++) {
|
||||||
|
frame->data[1][y * frame->linesize[1] + x] = 128 + y + i * 2;
|
||||||
|
frame->data[2][y * frame->linesize[2] + x] = 64 + x + i * 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
frame->pts = i;
|
||||||
|
|
||||||
|
/* encode the image */
|
||||||
|
ret = avcodec_encode_video2(c, &pkt, frame, &got_output);
|
||||||
|
if (ret < 0) {
|
||||||
|
fprintf(stderr, "Error encoding frame\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (got_output) {
|
||||||
|
printf("Write frame %3d (size=%5d)\n", i, pkt.size);
|
||||||
|
fwrite(pkt.data, 1, pkt.size, f);
|
||||||
|
av_free_packet(&pkt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get the delayed frames */
|
||||||
|
for (got_output = 1; got_output; i++) {
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
|
ret = avcodec_encode_video2(c, &pkt, NULL, &got_output);
|
||||||
|
if (ret < 0) {
|
||||||
|
fprintf(stderr, "Error encoding frame\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (got_output) {
|
||||||
|
printf("Write frame %3d (size=%5d)\n", i, pkt.size);
|
||||||
|
fwrite(pkt.data, 1, pkt.size, f);
|
||||||
|
av_free_packet(&pkt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* add sequence end code to have a real mpeg file */
|
||||||
|
fwrite(endcode, 1, sizeof(endcode), f);
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
|
avcodec_close(c);
|
||||||
|
av_free(c);
|
||||||
|
av_freep(&frame->data[0]);
|
||||||
|
av_frame_free(&frame);
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Video decoding example
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void pgm_save(unsigned char *buf, int wrap, int xsize, int ysize,
|
||||||
|
char *filename)
|
||||||
|
{
|
||||||
|
FILE *f;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
f = fopen(filename,"w");
|
||||||
|
fprintf(f, "P5\n%d %d\n%d\n", xsize, ysize, 255);
|
||||||
|
for (i = 0; i < ysize; i++)
|
||||||
|
fwrite(buf + i * wrap, 1, xsize, f);
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int decode_write_frame(const char *outfilename, AVCodecContext *avctx,
|
||||||
|
AVFrame *frame, int *frame_count, AVPacket *pkt, int last)
|
||||||
|
{
|
||||||
|
int len, got_frame;
|
||||||
|
char buf[1024];
|
||||||
|
|
||||||
|
len = avcodec_decode_video2(avctx, frame, &got_frame, pkt);
|
||||||
|
if (len < 0) {
|
||||||
|
fprintf(stderr, "Error while decoding frame %d\n", *frame_count);
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
if (got_frame) {
|
||||||
|
printf("Saving %sframe %3d\n", last ? "last " : "", *frame_count);
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
|
/* the picture is allocated by the decoder, no need to free it */
|
||||||
|
snprintf(buf, sizeof(buf), outfilename, *frame_count);
|
||||||
|
pgm_save(frame->data[0], frame->linesize[0],
|
||||||
|
avctx->width, avctx->height, buf);
|
||||||
|
(*frame_count)++;
|
||||||
|
}
|
||||||
|
if (pkt->data) {
|
||||||
|
pkt->size -= len;
|
||||||
|
pkt->data += len;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void video_decode_example(const char *outfilename, const char *filename)
|
||||||
|
{
|
||||||
|
AVCodec *codec;
|
||||||
|
AVCodecContext *c= NULL;
|
||||||
|
int frame_count;
|
||||||
|
FILE *f;
|
||||||
|
AVFrame *frame;
|
||||||
|
uint8_t inbuf[INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];
|
||||||
|
AVPacket avpkt;
|
||||||
|
|
||||||
|
av_init_packet(&avpkt);
|
||||||
|
|
||||||
|
/* set end of buffer to 0 (this ensures that no overreading happens for damaged mpeg streams) */
|
||||||
|
memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE);
|
||||||
|
|
||||||
|
printf("Decode video file %s to %s\n", filename, outfilename);
|
||||||
|
|
||||||
|
/* find the mpeg1 video decoder */
|
||||||
|
codec = avcodec_find_decoder(AV_CODEC_ID_MPEG1VIDEO);
|
||||||
|
if (!codec) {
|
||||||
|
fprintf(stderr, "Codec not found\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
c = avcodec_alloc_context3(codec);
|
||||||
|
if (!c) {
|
||||||
|
fprintf(stderr, "Could not allocate video codec context\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(codec->capabilities&CODEC_CAP_TRUNCATED)
|
||||||
|
c->flags|= CODEC_FLAG_TRUNCATED; /* we do not send complete frames */
|
||||||
|
|
||||||
|
/* For some codecs, such as msmpeg4 and mpeg4, width and height
|
||||||
|
MUST be initialized there because this information is not
|
||||||
|
available in the bitstream. */
|
||||||
|
|
||||||
|
/* open it */
|
||||||
|
if (avcodec_open2(c, codec, NULL) < 0) {
|
||||||
|
fprintf(stderr, "Could not open codec\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
f = fopen(filename, "rb");
|
||||||
|
if (!f) {
|
||||||
|
fprintf(stderr, "Could not open %s\n", filename);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
frame = av_frame_alloc();
|
||||||
|
if (!frame) {
|
||||||
|
fprintf(stderr, "Could not allocate video frame\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
frame_count = 0;
|
||||||
|
for (;;) {
|
||||||
|
avpkt.size = fread(inbuf, 1, INBUF_SIZE, f);
|
||||||
|
if (avpkt.size == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* NOTE1: some codecs are stream based (mpegvideo, mpegaudio)
|
||||||
|
and this is the only method to use them because you cannot
|
||||||
|
know the compressed data size before analysing it.
|
||||||
|
|
||||||
|
BUT some other codecs (msmpeg4, mpeg4) are inherently frame
|
||||||
|
based, so you must call them with all the data for one
|
||||||
|
frame exactly. You must also initialize 'width' and
|
||||||
|
'height' before initializing them. */
|
||||||
|
|
||||||
|
/* NOTE2: some codecs allow the raw parameters (frame size,
|
||||||
|
sample rate) to be changed at any frame. We handle this, so
|
||||||
|
you should also take care of it */
|
||||||
|
|
||||||
|
/* here, we use a stream based decoder (mpeg1video), so we
|
||||||
|
feed decoder and see if it could decode a frame */
|
||||||
|
avpkt.data = inbuf;
|
||||||
|
while (avpkt.size > 0)
|
||||||
|
if (decode_write_frame(outfilename, c, frame, &frame_count, &avpkt, 0) < 0)
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* some codecs, such as MPEG, transmit the I and P frame with a
|
||||||
|
latency of one frame. You must do the following to have a
|
||||||
|
chance to get the last frame of the video */
|
||||||
|
avpkt.data = NULL;
|
||||||
|
avpkt.size = 0;
|
||||||
|
decode_write_frame(outfilename, c, frame, &frame_count, &avpkt, 1);
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
|
avcodec_close(c);
|
||||||
|
av_free(c);
|
||||||
|
av_frame_free(&frame);
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
const char *output_type;
|
||||||
|
|
||||||
|
/* register all the codecs */
|
||||||
|
avcodec_register_all();
|
||||||
|
|
||||||
|
if (argc < 2) {
|
||||||
|
printf("usage: %s output_type\n"
|
||||||
|
"API example program to decode/encode a media stream with libavcodec.\n"
|
||||||
|
"This program generates a synthetic stream and encodes it to a file\n"
|
||||||
|
"named test.h264, test.mp2 or test.mpg depending on output_type.\n"
|
||||||
|
"The encoded stream is then decoded and written to a raw data output.\n"
|
||||||
|
"output_type must be choosen between 'h264', 'mp2', 'mpg'.\n",
|
||||||
|
argv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
output_type = argv[1];
|
||||||
|
|
||||||
|
if (!strcmp(output_type, "h264")) {
|
||||||
|
video_encode_example("test.h264", AV_CODEC_ID_H264);
|
||||||
|
} else if (!strcmp(output_type, "mp2")) {
|
||||||
|
audio_encode_example("test.mp2");
|
||||||
|
audio_decode_example("test.sw", "test.mp2");
|
||||||
|
} else if (!strcmp(output_type, "mpg")) {
|
||||||
|
video_encode_example("test.mpg", AV_CODEC_ID_MPEG1VIDEO);
|
||||||
|
video_decode_example("test%02d.pgm", "test.mpg");
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "Invalid output type '%s', choose between 'h264', 'mp2', or 'mpg'\n",
|
||||||
|
output_type);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -1,130 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2014 Lukasz Marek
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <libavcodec/avcodec.h>
|
|
||||||
#include <libavformat/avformat.h>
|
|
||||||
#include <libavformat/avio.h>
|
|
||||||
|
|
||||||
static const char *type_string(int type)
|
|
||||||
{
|
|
||||||
switch (type) {
|
|
||||||
case AVIO_ENTRY_DIRECTORY:
|
|
||||||
return "<DIR>";
|
|
||||||
case AVIO_ENTRY_FILE:
|
|
||||||
return "<FILE>";
|
|
||||||
case AVIO_ENTRY_BLOCK_DEVICE:
|
|
||||||
return "<BLOCK DEVICE>";
|
|
||||||
case AVIO_ENTRY_CHARACTER_DEVICE:
|
|
||||||
return "<CHARACTER DEVICE>";
|
|
||||||
case AVIO_ENTRY_NAMED_PIPE:
|
|
||||||
return "<PIPE>";
|
|
||||||
case AVIO_ENTRY_SYMBOLIC_LINK:
|
|
||||||
return "<LINK>";
|
|
||||||
case AVIO_ENTRY_SOCKET:
|
|
||||||
return "<SOCKET>";
|
|
||||||
case AVIO_ENTRY_SERVER:
|
|
||||||
return "<SERVER>";
|
|
||||||
case AVIO_ENTRY_SHARE:
|
|
||||||
return "<SHARE>";
|
|
||||||
case AVIO_ENTRY_WORKGROUP:
|
|
||||||
return "<WORKGROUP>";
|
|
||||||
case AVIO_ENTRY_UNKNOWN:
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return "<UNKNOWN>";
|
|
||||||
}
|
|
||||||
|
|
||||||
static int list_op(const char *input_dir)
|
|
||||||
{
|
|
||||||
AVIODirEntry *entry = NULL;
|
|
||||||
AVIODirContext *ctx = NULL;
|
|
||||||
int cnt, ret;
|
|
||||||
char filemode[4], uid_and_gid[20];
|
|
||||||
|
|
||||||
if ((ret = avio_open_dir(&ctx, input_dir, NULL)) < 0) {
|
|
||||||
av_log(NULL, AV_LOG_ERROR, "Cannot open directory: %s.\n", av_err2str(ret));
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
cnt = 0;
|
|
||||||
for (;;) {
|
|
||||||
if ((ret = avio_read_dir(ctx, &entry)) < 0) {
|
|
||||||
av_log(NULL, AV_LOG_ERROR, "Cannot list directory: %s.\n", av_err2str(ret));
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
if (!entry)
|
|
||||||
break;
|
|
||||||
if (entry->filemode == -1) {
|
|
||||||
snprintf(filemode, 4, "???");
|
|
||||||
} else {
|
|
||||||
snprintf(filemode, 4, "%3"PRIo64, entry->filemode);
|
|
||||||
}
|
|
||||||
snprintf(uid_and_gid, 20, "%"PRId64"(%"PRId64")", entry->user_id, entry->group_id);
|
|
||||||
if (cnt == 0)
|
|
||||||
av_log(NULL, AV_LOG_INFO, "%-9s %12s %30s %10s %s %16s %16s %16s\n",
|
|
||||||
"TYPE", "SIZE", "NAME", "UID(GID)", "UGO", "MODIFIED",
|
|
||||||
"ACCESSED", "STATUS_CHANGED");
|
|
||||||
av_log(NULL, AV_LOG_INFO, "%-9s %12"PRId64" %30s %10s %s %16"PRId64" %16"PRId64" %16"PRId64"\n",
|
|
||||||
type_string(entry->type),
|
|
||||||
entry->size,
|
|
||||||
entry->name,
|
|
||||||
uid_and_gid,
|
|
||||||
filemode,
|
|
||||||
entry->modification_timestamp,
|
|
||||||
entry->access_timestamp,
|
|
||||||
entry->status_change_timestamp);
|
|
||||||
avio_free_directory_entry(&entry);
|
|
||||||
cnt++;
|
|
||||||
};
|
|
||||||
|
|
||||||
fail:
|
|
||||||
avio_close_dir(&ctx);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void usage(const char *program_name)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "usage: %s input_dir\n"
|
|
||||||
"API example program to show how to list files in directory "
|
|
||||||
"accessed through AVIOContext.\n", program_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
av_log_set_level(AV_LOG_DEBUG);
|
|
||||||
|
|
||||||
if (argc < 2) {
|
|
||||||
usage(argv[0]);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
avformat_network_init();
|
|
||||||
|
|
||||||
ret = list_op(argv[1]);
|
|
||||||
|
|
||||||
avformat_network_deinit();
|
|
||||||
|
|
||||||
return ret < 0 ? 1 : 0;
|
|
||||||
}
|
|
||||||
@@ -44,8 +44,6 @@ static int read_packet(void *opaque, uint8_t *buf, int buf_size)
|
|||||||
struct buffer_data *bd = (struct buffer_data *)opaque;
|
struct buffer_data *bd = (struct buffer_data *)opaque;
|
||||||
buf_size = FFMIN(buf_size, bd->size);
|
buf_size = FFMIN(buf_size, bd->size);
|
||||||
|
|
||||||
if (!buf_size)
|
|
||||||
return AVERROR_EOF;
|
|
||||||
printf("ptr:%p size:%zu\n", bd->ptr, bd->size);
|
printf("ptr:%p size:%zu\n", bd->ptr, bd->size);
|
||||||
|
|
||||||
/* copy internal buffer data to buf */
|
/* copy internal buffer data to buf */
|
||||||
@@ -74,6 +72,9 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
input_filename = argv[1];
|
input_filename = argv[1];
|
||||||
|
|
||||||
|
/* register codecs and formats and other lavf/lavc components*/
|
||||||
|
av_register_all();
|
||||||
|
|
||||||
/* slurp file content into buffer */
|
/* slurp file content into buffer */
|
||||||
ret = av_file_map(input_filename, &buffer, &buffer_size, 0, NULL);
|
ret = av_file_map(input_filename, &buffer, &buffer_size, 0, NULL);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@@ -117,12 +118,11 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
end:
|
end:
|
||||||
avformat_close_input(&fmt_ctx);
|
avformat_close_input(&fmt_ctx);
|
||||||
|
|
||||||
/* note: the internal buffer could have changed, and be != avio_ctx_buffer */
|
/* note: the internal buffer could have changed, and be != avio_ctx_buffer */
|
||||||
if (avio_ctx)
|
if (avio_ctx) {
|
||||||
av_freep(&avio_ctx->buffer);
|
av_freep(&avio_ctx->buffer);
|
||||||
avio_context_free(&avio_ctx);
|
av_freep(&avio_ctx);
|
||||||
|
}
|
||||||
av_file_unmap(buffer, buffer_size);
|
av_file_unmap(buffer, buffer_size);
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
|||||||
@@ -1,236 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2001 Fabrice Bellard
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file
|
|
||||||
* audio decoding with libavcodec API example
|
|
||||||
*
|
|
||||||
* @example decode_audio.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <libavutil/frame.h>
|
|
||||||
#include <libavutil/mem.h>
|
|
||||||
|
|
||||||
#include <libavcodec/avcodec.h>
|
|
||||||
|
|
||||||
#define AUDIO_INBUF_SIZE 20480
|
|
||||||
#define AUDIO_REFILL_THRESH 4096
|
|
||||||
|
|
||||||
static int get_format_from_sample_fmt(const char **fmt,
|
|
||||||
enum AVSampleFormat sample_fmt)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
struct sample_fmt_entry {
|
|
||||||
enum AVSampleFormat sample_fmt; const char *fmt_be, *fmt_le;
|
|
||||||
} sample_fmt_entries[] = {
|
|
||||||
{ AV_SAMPLE_FMT_U8, "u8", "u8" },
|
|
||||||
{ AV_SAMPLE_FMT_S16, "s16be", "s16le" },
|
|
||||||
{ AV_SAMPLE_FMT_S32, "s32be", "s32le" },
|
|
||||||
{ AV_SAMPLE_FMT_FLT, "f32be", "f32le" },
|
|
||||||
{ AV_SAMPLE_FMT_DBL, "f64be", "f64le" },
|
|
||||||
};
|
|
||||||
*fmt = NULL;
|
|
||||||
|
|
||||||
for (i = 0; i < FF_ARRAY_ELEMS(sample_fmt_entries); i++) {
|
|
||||||
struct sample_fmt_entry *entry = &sample_fmt_entries[i];
|
|
||||||
if (sample_fmt == entry->sample_fmt) {
|
|
||||||
*fmt = AV_NE(entry->fmt_be, entry->fmt_le);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(stderr,
|
|
||||||
"sample format %s is not supported as output format\n",
|
|
||||||
av_get_sample_fmt_name(sample_fmt));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame,
|
|
||||||
FILE *outfile)
|
|
||||||
{
|
|
||||||
int i, ch;
|
|
||||||
int ret, data_size;
|
|
||||||
|
|
||||||
/* send the packet with the compressed data to the decoder */
|
|
||||||
ret = avcodec_send_packet(dec_ctx, pkt);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Error submitting the packet to the decoder\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* read all the output frames (in general there may be any number of them */
|
|
||||||
while (ret >= 0) {
|
|
||||||
ret = avcodec_receive_frame(dec_ctx, frame);
|
|
||||||
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
|
|
||||||
return;
|
|
||||||
else if (ret < 0) {
|
|
||||||
fprintf(stderr, "Error during decoding\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
data_size = av_get_bytes_per_sample(dec_ctx->sample_fmt);
|
|
||||||
if (data_size < 0) {
|
|
||||||
/* This should not occur, checking just for paranoia */
|
|
||||||
fprintf(stderr, "Failed to calculate data size\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
for (i = 0; i < frame->nb_samples; i++)
|
|
||||||
for (ch = 0; ch < dec_ctx->channels; ch++)
|
|
||||||
fwrite(frame->data[ch] + data_size*i, 1, data_size, outfile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
const char *outfilename, *filename;
|
|
||||||
const AVCodec *codec;
|
|
||||||
AVCodecContext *c= NULL;
|
|
||||||
AVCodecParserContext *parser = NULL;
|
|
||||||
int len, ret;
|
|
||||||
FILE *f, *outfile;
|
|
||||||
uint8_t inbuf[AUDIO_INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE];
|
|
||||||
uint8_t *data;
|
|
||||||
size_t data_size;
|
|
||||||
AVPacket *pkt;
|
|
||||||
AVFrame *decoded_frame = NULL;
|
|
||||||
enum AVSampleFormat sfmt;
|
|
||||||
int n_channels = 0;
|
|
||||||
const char *fmt;
|
|
||||||
|
|
||||||
if (argc <= 2) {
|
|
||||||
fprintf(stderr, "Usage: %s <input file> <output file>\n", argv[0]);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
filename = argv[1];
|
|
||||||
outfilename = argv[2];
|
|
||||||
|
|
||||||
pkt = av_packet_alloc();
|
|
||||||
|
|
||||||
/* find the MPEG audio decoder */
|
|
||||||
codec = avcodec_find_decoder(AV_CODEC_ID_MP2);
|
|
||||||
if (!codec) {
|
|
||||||
fprintf(stderr, "Codec not found\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
parser = av_parser_init(codec->id);
|
|
||||||
if (!parser) {
|
|
||||||
fprintf(stderr, "Parser not found\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
c = avcodec_alloc_context3(codec);
|
|
||||||
if (!c) {
|
|
||||||
fprintf(stderr, "Could not allocate audio codec context\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* open it */
|
|
||||||
if (avcodec_open2(c, codec, NULL) < 0) {
|
|
||||||
fprintf(stderr, "Could not open codec\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
f = fopen(filename, "rb");
|
|
||||||
if (!f) {
|
|
||||||
fprintf(stderr, "Could not open %s\n", filename);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
outfile = fopen(outfilename, "wb");
|
|
||||||
if (!outfile) {
|
|
||||||
av_free(c);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* decode until eof */
|
|
||||||
data = inbuf;
|
|
||||||
data_size = fread(inbuf, 1, AUDIO_INBUF_SIZE, f);
|
|
||||||
|
|
||||||
while (data_size > 0) {
|
|
||||||
if (!decoded_frame) {
|
|
||||||
if (!(decoded_frame = av_frame_alloc())) {
|
|
||||||
fprintf(stderr, "Could not allocate audio frame\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = av_parser_parse2(parser, c, &pkt->data, &pkt->size,
|
|
||||||
data, data_size,
|
|
||||||
AV_NOPTS_VALUE, AV_NOPTS_VALUE, 0);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Error while parsing\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
data += ret;
|
|
||||||
data_size -= ret;
|
|
||||||
|
|
||||||
if (pkt->size)
|
|
||||||
decode(c, pkt, decoded_frame, outfile);
|
|
||||||
|
|
||||||
if (data_size < AUDIO_REFILL_THRESH) {
|
|
||||||
memmove(inbuf, data, data_size);
|
|
||||||
data = inbuf;
|
|
||||||
len = fread(data + data_size, 1,
|
|
||||||
AUDIO_INBUF_SIZE - data_size, f);
|
|
||||||
if (len > 0)
|
|
||||||
data_size += len;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* flush the decoder */
|
|
||||||
pkt->data = NULL;
|
|
||||||
pkt->size = 0;
|
|
||||||
decode(c, pkt, decoded_frame, outfile);
|
|
||||||
|
|
||||||
/* print output pcm infomations, because there have no metadata of pcm */
|
|
||||||
sfmt = c->sample_fmt;
|
|
||||||
|
|
||||||
if (av_sample_fmt_is_planar(sfmt)) {
|
|
||||||
const char *packed = av_get_sample_fmt_name(sfmt);
|
|
||||||
printf("Warning: the sample format the decoder produced is planar "
|
|
||||||
"(%s). This example will output the first channel only.\n",
|
|
||||||
packed ? packed : "?");
|
|
||||||
sfmt = av_get_packed_sample_fmt(sfmt);
|
|
||||||
}
|
|
||||||
|
|
||||||
n_channels = c->channels;
|
|
||||||
if ((ret = get_format_from_sample_fmt(&fmt, sfmt)) < 0)
|
|
||||||
goto end;
|
|
||||||
|
|
||||||
printf("Play the output audio file with the command:\n"
|
|
||||||
"ffplay -f %s -ac %d -ar %d %s\n",
|
|
||||||
fmt, n_channels, c->sample_rate,
|
|
||||||
outfilename);
|
|
||||||
end:
|
|
||||||
fclose(outfile);
|
|
||||||
fclose(f);
|
|
||||||
|
|
||||||
avcodec_free_context(&c);
|
|
||||||
av_parser_close(parser);
|
|
||||||
av_frame_free(&decoded_frame);
|
|
||||||
av_packet_free(&pkt);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1,187 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2001 Fabrice Bellard
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file
|
|
||||||
* video decoding with libavcodec API example
|
|
||||||
*
|
|
||||||
* @example decode_video.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <libavcodec/avcodec.h>
|
|
||||||
|
|
||||||
#define INBUF_SIZE 4096
|
|
||||||
|
|
||||||
static void pgm_save(unsigned char *buf, int wrap, int xsize, int ysize,
|
|
||||||
char *filename)
|
|
||||||
{
|
|
||||||
FILE *f;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
f = fopen(filename,"wb");
|
|
||||||
fprintf(f, "P5\n%d %d\n%d\n", xsize, ysize, 255);
|
|
||||||
for (i = 0; i < ysize; i++)
|
|
||||||
fwrite(buf + i * wrap, 1, xsize, f);
|
|
||||||
fclose(f);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void decode(AVCodecContext *dec_ctx, AVFrame *frame, AVPacket *pkt,
|
|
||||||
const char *filename)
|
|
||||||
{
|
|
||||||
char buf[1024];
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = avcodec_send_packet(dec_ctx, pkt);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Error sending a packet for decoding\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (ret >= 0) {
|
|
||||||
ret = avcodec_receive_frame(dec_ctx, frame);
|
|
||||||
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
|
|
||||||
return;
|
|
||||||
else if (ret < 0) {
|
|
||||||
fprintf(stderr, "Error during decoding\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("saving frame %3d\n", dec_ctx->frame_number);
|
|
||||||
fflush(stdout);
|
|
||||||
|
|
||||||
/* the picture is allocated by the decoder. no need to
|
|
||||||
free it */
|
|
||||||
snprintf(buf, sizeof(buf), "%s-%d", filename, dec_ctx->frame_number);
|
|
||||||
pgm_save(frame->data[0], frame->linesize[0],
|
|
||||||
frame->width, frame->height, buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
const char *filename, *outfilename;
|
|
||||||
const AVCodec *codec;
|
|
||||||
AVCodecParserContext *parser;
|
|
||||||
AVCodecContext *c= NULL;
|
|
||||||
FILE *f;
|
|
||||||
AVFrame *frame;
|
|
||||||
uint8_t inbuf[INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE];
|
|
||||||
uint8_t *data;
|
|
||||||
size_t data_size;
|
|
||||||
int ret;
|
|
||||||
AVPacket *pkt;
|
|
||||||
|
|
||||||
if (argc <= 2) {
|
|
||||||
fprintf(stderr, "Usage: %s <input file> <output file>\n"
|
|
||||||
"And check your input file is encoded by mpeg1video please.\n", argv[0]);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
filename = argv[1];
|
|
||||||
outfilename = argv[2];
|
|
||||||
|
|
||||||
pkt = av_packet_alloc();
|
|
||||||
if (!pkt)
|
|
||||||
exit(1);
|
|
||||||
|
|
||||||
/* set end of buffer to 0 (this ensures that no overreading happens for damaged MPEG streams) */
|
|
||||||
memset(inbuf + INBUF_SIZE, 0, AV_INPUT_BUFFER_PADDING_SIZE);
|
|
||||||
|
|
||||||
/* find the MPEG-1 video decoder */
|
|
||||||
codec = avcodec_find_decoder(AV_CODEC_ID_MPEG1VIDEO);
|
|
||||||
if (!codec) {
|
|
||||||
fprintf(stderr, "Codec not found\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
parser = av_parser_init(codec->id);
|
|
||||||
if (!parser) {
|
|
||||||
fprintf(stderr, "parser not found\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
c = avcodec_alloc_context3(codec);
|
|
||||||
if (!c) {
|
|
||||||
fprintf(stderr, "Could not allocate video codec context\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* For some codecs, such as msmpeg4 and mpeg4, width and height
|
|
||||||
MUST be initialized there because this information is not
|
|
||||||
available in the bitstream. */
|
|
||||||
|
|
||||||
/* open it */
|
|
||||||
if (avcodec_open2(c, codec, NULL) < 0) {
|
|
||||||
fprintf(stderr, "Could not open codec\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
f = fopen(filename, "rb");
|
|
||||||
if (!f) {
|
|
||||||
fprintf(stderr, "Could not open %s\n", filename);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
frame = av_frame_alloc();
|
|
||||||
if (!frame) {
|
|
||||||
fprintf(stderr, "Could not allocate video frame\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (!feof(f)) {
|
|
||||||
/* read raw data from the input file */
|
|
||||||
data_size = fread(inbuf, 1, INBUF_SIZE, f);
|
|
||||||
if (!data_size)
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* use the parser to split the data into frames */
|
|
||||||
data = inbuf;
|
|
||||||
while (data_size > 0) {
|
|
||||||
ret = av_parser_parse2(parser, c, &pkt->data, &pkt->size,
|
|
||||||
data, data_size, AV_NOPTS_VALUE, AV_NOPTS_VALUE, 0);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Error while parsing\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
data += ret;
|
|
||||||
data_size -= ret;
|
|
||||||
|
|
||||||
if (pkt->size)
|
|
||||||
decode(c, frame, pkt, outfilename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* flush the decoder */
|
|
||||||
decode(c, frame, NULL, outfilename);
|
|
||||||
|
|
||||||
fclose(f);
|
|
||||||
|
|
||||||
av_parser_close(parser);
|
|
||||||
avcodec_free_context(&c);
|
|
||||||
av_frame_free(&frame);
|
|
||||||
av_packet_free(&pkt);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -36,8 +36,6 @@
|
|||||||
|
|
||||||
static AVFormatContext *fmt_ctx = NULL;
|
static AVFormatContext *fmt_ctx = NULL;
|
||||||
static AVCodecContext *video_dec_ctx = NULL, *audio_dec_ctx;
|
static AVCodecContext *video_dec_ctx = NULL, *audio_dec_ctx;
|
||||||
static int width, height;
|
|
||||||
static enum AVPixelFormat pix_fmt;
|
|
||||||
static AVStream *video_stream = NULL, *audio_stream = NULL;
|
static AVStream *video_stream = NULL, *audio_stream = NULL;
|
||||||
static const char *src_filename = NULL;
|
static const char *src_filename = NULL;
|
||||||
static const char *video_dst_filename = NULL;
|
static const char *video_dst_filename = NULL;
|
||||||
@@ -51,104 +49,98 @@ static int video_dst_bufsize;
|
|||||||
|
|
||||||
static int video_stream_idx = -1, audio_stream_idx = -1;
|
static int video_stream_idx = -1, audio_stream_idx = -1;
|
||||||
static AVFrame *frame = NULL;
|
static AVFrame *frame = NULL;
|
||||||
static AVPacket *pkt = NULL;
|
static AVPacket pkt;
|
||||||
static int video_frame_count = 0;
|
static int video_frame_count = 0;
|
||||||
static int audio_frame_count = 0;
|
static int audio_frame_count = 0;
|
||||||
|
|
||||||
static int output_video_frame(AVFrame *frame)
|
/* The different ways of decoding and managing data memory. You are not
|
||||||
{
|
* supposed to support all the modes in your application but pick the one most
|
||||||
if (frame->width != width || frame->height != height ||
|
* appropriate to your needs. Look for the use of api_mode in this example to
|
||||||
frame->format != pix_fmt) {
|
* see what are the differences of API usage between them */
|
||||||
/* To handle this change, one could call av_image_alloc again and
|
enum {
|
||||||
* decode the following frames into another rawvideo file. */
|
API_MODE_OLD = 0, /* old method, deprecated */
|
||||||
fprintf(stderr, "Error: Width, height and pixel format have to be "
|
API_MODE_NEW_API_REF_COUNT = 1, /* new method, using the frame reference counting */
|
||||||
"constant in a rawvideo file, but the width, height or "
|
API_MODE_NEW_API_NO_REF_COUNT = 2, /* new method, without reference counting */
|
||||||
"pixel format of the input video changed:\n"
|
};
|
||||||
"old: width = %d, height = %d, format = %s\n"
|
|
||||||
"new: width = %d, height = %d, format = %s\n",
|
|
||||||
width, height, av_get_pix_fmt_name(pix_fmt),
|
|
||||||
frame->width, frame->height,
|
|
||||||
av_get_pix_fmt_name(frame->format));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("video_frame n:%d coded_n:%d\n",
|
static int api_mode = API_MODE_OLD;
|
||||||
video_frame_count++, frame->coded_picture_number);
|
|
||||||
|
|
||||||
/* copy decoded frame to destination buffer:
|
static int decode_packet(int *got_frame, int cached)
|
||||||
* this is required since rawvideo expects non aligned data */
|
|
||||||
av_image_copy(video_dst_data, video_dst_linesize,
|
|
||||||
(const uint8_t **)(frame->data), frame->linesize,
|
|
||||||
pix_fmt, width, height);
|
|
||||||
|
|
||||||
/* write to rawvideo file */
|
|
||||||
fwrite(video_dst_data[0], 1, video_dst_bufsize, video_dst_file);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int output_audio_frame(AVFrame *frame)
|
|
||||||
{
|
|
||||||
size_t unpadded_linesize = frame->nb_samples * av_get_bytes_per_sample(frame->format);
|
|
||||||
printf("audio_frame n:%d nb_samples:%d pts:%s\n",
|
|
||||||
audio_frame_count++, frame->nb_samples,
|
|
||||||
av_ts2timestr(frame->pts, &audio_dec_ctx->time_base));
|
|
||||||
|
|
||||||
/* Write the raw audio data samples of the first plane. This works
|
|
||||||
* fine for packed formats (e.g. AV_SAMPLE_FMT_S16). However,
|
|
||||||
* most audio decoders output planar audio, which uses a separate
|
|
||||||
* plane of audio samples for each channel (e.g. AV_SAMPLE_FMT_S16P).
|
|
||||||
* In other words, this code will write only the first audio channel
|
|
||||||
* in these cases.
|
|
||||||
* You should use libswresample or libavfilter to convert the frame
|
|
||||||
* to packed data. */
|
|
||||||
fwrite(frame->extended_data[0], 1, unpadded_linesize, audio_dst_file);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int decode_packet(AVCodecContext *dec, const AVPacket *pkt)
|
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
int decoded = pkt.size;
|
||||||
|
|
||||||
// submit the packet to the decoder
|
*got_frame = 0;
|
||||||
ret = avcodec_send_packet(dec, pkt);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Error submitting a packet for decoding (%s)\n", av_err2str(ret));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
// get all the available frames from the decoder
|
if (pkt.stream_index == video_stream_idx) {
|
||||||
while (ret >= 0) {
|
/* decode video frame */
|
||||||
ret = avcodec_receive_frame(dec, frame);
|
ret = avcodec_decode_video2(video_dec_ctx, frame, got_frame, &pkt);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
// those two return values are special and mean there is no output
|
fprintf(stderr, "Error decoding video frame (%s)\n", av_err2str(ret));
|
||||||
// frame available, but there were no errors during decoding
|
|
||||||
if (ret == AVERROR_EOF || ret == AVERROR(EAGAIN))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
fprintf(stderr, "Error during decoding (%s)\n", av_err2str(ret));
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// write the frame data to output file
|
if (*got_frame) {
|
||||||
if (dec->codec->type == AVMEDIA_TYPE_VIDEO)
|
printf("video_frame%s n:%d coded_n:%d pts:%s\n",
|
||||||
ret = output_video_frame(frame);
|
cached ? "(cached)" : "",
|
||||||
else
|
video_frame_count++, frame->coded_picture_number,
|
||||||
ret = output_audio_frame(frame);
|
av_ts2timestr(frame->pts, &video_dec_ctx->time_base));
|
||||||
|
|
||||||
av_frame_unref(frame);
|
/* copy decoded frame to destination buffer:
|
||||||
if (ret < 0)
|
* this is required since rawvideo expects non aligned data */
|
||||||
|
av_image_copy(video_dst_data, video_dst_linesize,
|
||||||
|
(const uint8_t **)(frame->data), frame->linesize,
|
||||||
|
video_dec_ctx->pix_fmt, video_dec_ctx->width, video_dec_ctx->height);
|
||||||
|
|
||||||
|
/* write to rawvideo file */
|
||||||
|
fwrite(video_dst_data[0], 1, video_dst_bufsize, video_dst_file);
|
||||||
|
}
|
||||||
|
} else if (pkt.stream_index == audio_stream_idx) {
|
||||||
|
/* decode audio frame */
|
||||||
|
ret = avcodec_decode_audio4(audio_dec_ctx, frame, got_frame, &pkt);
|
||||||
|
if (ret < 0) {
|
||||||
|
fprintf(stderr, "Error decoding audio frame (%s)\n", av_err2str(ret));
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
|
/* Some audio decoders decode only part of the packet, and have to be
|
||||||
|
* called again with the remainder of the packet data.
|
||||||
|
* Sample: fate-suite/lossless-audio/luckynight-partial.shn
|
||||||
|
* Also, some decoders might over-read the packet. */
|
||||||
|
decoded = FFMIN(ret, pkt.size);
|
||||||
|
|
||||||
|
if (*got_frame) {
|
||||||
|
size_t unpadded_linesize = frame->nb_samples * av_get_bytes_per_sample(frame->format);
|
||||||
|
printf("audio_frame%s n:%d nb_samples:%d pts:%s\n",
|
||||||
|
cached ? "(cached)" : "",
|
||||||
|
audio_frame_count++, frame->nb_samples,
|
||||||
|
av_ts2timestr(frame->pts, &audio_dec_ctx->time_base));
|
||||||
|
|
||||||
|
/* Write the raw audio data samples of the first plane. This works
|
||||||
|
* fine for packed formats (e.g. AV_SAMPLE_FMT_S16). However,
|
||||||
|
* most audio decoders output planar audio, which uses a separate
|
||||||
|
* plane of audio samples for each channel (e.g. AV_SAMPLE_FMT_S16P).
|
||||||
|
* In other words, this code will write only the first audio channel
|
||||||
|
* in these cases.
|
||||||
|
* You should use libswresample or libavfilter to convert the frame
|
||||||
|
* to packed data. */
|
||||||
|
fwrite(frame->extended_data[0], 1, unpadded_linesize, audio_dst_file);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
/* If we use the new API with reference counting, we own the data and need
|
||||||
|
* to de-reference it when we don't use it anymore */
|
||||||
|
if (*got_frame && api_mode == API_MODE_NEW_API_REF_COUNT)
|
||||||
|
av_frame_unref(frame);
|
||||||
|
|
||||||
|
return decoded;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int open_codec_context(int *stream_idx,
|
static int open_codec_context(int *stream_idx,
|
||||||
AVCodecContext **dec_ctx, AVFormatContext *fmt_ctx, enum AVMediaType type)
|
AVFormatContext *fmt_ctx, enum AVMediaType type)
|
||||||
{
|
{
|
||||||
int ret, stream_index;
|
int ret;
|
||||||
AVStream *st;
|
AVStream *st;
|
||||||
|
AVCodecContext *dec_ctx = NULL;
|
||||||
AVCodec *dec = NULL;
|
AVCodec *dec = NULL;
|
||||||
AVDictionary *opts = NULL;
|
AVDictionary *opts = NULL;
|
||||||
|
|
||||||
@@ -158,39 +150,26 @@ static int open_codec_context(int *stream_idx,
|
|||||||
av_get_media_type_string(type), src_filename);
|
av_get_media_type_string(type), src_filename);
|
||||||
return ret;
|
return ret;
|
||||||
} else {
|
} else {
|
||||||
stream_index = ret;
|
*stream_idx = ret;
|
||||||
st = fmt_ctx->streams[stream_index];
|
st = fmt_ctx->streams[*stream_idx];
|
||||||
|
|
||||||
/* find decoder for the stream */
|
/* find decoder for the stream */
|
||||||
dec = avcodec_find_decoder(st->codecpar->codec_id);
|
dec_ctx = st->codec;
|
||||||
|
dec = avcodec_find_decoder(dec_ctx->codec_id);
|
||||||
if (!dec) {
|
if (!dec) {
|
||||||
fprintf(stderr, "Failed to find %s codec\n",
|
fprintf(stderr, "Failed to find %s codec\n",
|
||||||
av_get_media_type_string(type));
|
av_get_media_type_string(type));
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate a codec context for the decoder */
|
/* Init the decoders, with or without reference counting */
|
||||||
*dec_ctx = avcodec_alloc_context3(dec);
|
if (api_mode == API_MODE_NEW_API_REF_COUNT)
|
||||||
if (!*dec_ctx) {
|
av_dict_set(&opts, "refcounted_frames", "1", 0);
|
||||||
fprintf(stderr, "Failed to allocate the %s codec context\n",
|
if ((ret = avcodec_open2(dec_ctx, dec, &opts)) < 0) {
|
||||||
av_get_media_type_string(type));
|
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Copy codec parameters from input stream to output codec context */
|
|
||||||
if ((ret = avcodec_parameters_to_context(*dec_ctx, st->codecpar)) < 0) {
|
|
||||||
fprintf(stderr, "Failed to copy %s codec parameters to decoder context\n",
|
|
||||||
av_get_media_type_string(type));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Init the decoders */
|
|
||||||
if ((ret = avcodec_open2(*dec_ctx, dec, &opts)) < 0) {
|
|
||||||
fprintf(stderr, "Failed to open %s codec\n",
|
fprintf(stderr, "Failed to open %s codec\n",
|
||||||
av_get_media_type_string(type));
|
av_get_media_type_string(type));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
*stream_idx = stream_index;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -227,21 +206,40 @@ static int get_format_from_sample_fmt(const char **fmt,
|
|||||||
|
|
||||||
int main (int argc, char **argv)
|
int main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0, got_frame;
|
||||||
|
|
||||||
if (argc != 4) {
|
if (argc != 4 && argc != 5) {
|
||||||
fprintf(stderr, "usage: %s input_file video_output_file audio_output_file\n"
|
fprintf(stderr, "usage: %s [-refcount=<old|new_norefcount|new_refcount>] "
|
||||||
|
"input_file video_output_file audio_output_file\n"
|
||||||
"API example program to show how to read frames from an input file.\n"
|
"API example program to show how to read frames from an input file.\n"
|
||||||
"This program reads frames from a file, decodes them, and writes decoded\n"
|
"This program reads frames from a file, decodes them, and writes decoded\n"
|
||||||
"video frames to a rawvideo file named video_output_file, and decoded\n"
|
"video frames to a rawvideo file named video_output_file, and decoded\n"
|
||||||
"audio frames to a rawaudio file named audio_output_file.\n",
|
"audio frames to a rawaudio file named audio_output_file.\n\n"
|
||||||
argv[0]);
|
"If the -refcount option is specified, the program use the\n"
|
||||||
|
"reference counting frame system which allows keeping a copy of\n"
|
||||||
|
"the data for longer than one decode call. If unset, it's using\n"
|
||||||
|
"the classic old method.\n"
|
||||||
|
"\n", argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
if (argc == 5) {
|
||||||
|
const char *mode = argv[1] + strlen("-refcount=");
|
||||||
|
if (!strcmp(mode, "old")) api_mode = API_MODE_OLD;
|
||||||
|
else if (!strcmp(mode, "new_norefcount")) api_mode = API_MODE_NEW_API_NO_REF_COUNT;
|
||||||
|
else if (!strcmp(mode, "new_refcount")) api_mode = API_MODE_NEW_API_REF_COUNT;
|
||||||
|
else {
|
||||||
|
fprintf(stderr, "unknow mode '%s'\n", mode);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
argv++;
|
||||||
|
}
|
||||||
src_filename = argv[1];
|
src_filename = argv[1];
|
||||||
video_dst_filename = argv[2];
|
video_dst_filename = argv[2];
|
||||||
audio_dst_filename = argv[3];
|
audio_dst_filename = argv[3];
|
||||||
|
|
||||||
|
/* register all formats and codecs */
|
||||||
|
av_register_all();
|
||||||
|
|
||||||
/* open input file, and allocate format context */
|
/* open input file, and allocate format context */
|
||||||
if (avformat_open_input(&fmt_ctx, src_filename, NULL, NULL) < 0) {
|
if (avformat_open_input(&fmt_ctx, src_filename, NULL, NULL) < 0) {
|
||||||
fprintf(stderr, "Could not open source file %s\n", src_filename);
|
fprintf(stderr, "Could not open source file %s\n", src_filename);
|
||||||
@@ -254,8 +252,9 @@ int main (int argc, char **argv)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (open_codec_context(&video_stream_idx, &video_dec_ctx, fmt_ctx, AVMEDIA_TYPE_VIDEO) >= 0) {
|
if (open_codec_context(&video_stream_idx, fmt_ctx, AVMEDIA_TYPE_VIDEO) >= 0) {
|
||||||
video_stream = fmt_ctx->streams[video_stream_idx];
|
video_stream = fmt_ctx->streams[video_stream_idx];
|
||||||
|
video_dec_ctx = video_stream->codec;
|
||||||
|
|
||||||
video_dst_file = fopen(video_dst_filename, "wb");
|
video_dst_file = fopen(video_dst_filename, "wb");
|
||||||
if (!video_dst_file) {
|
if (!video_dst_file) {
|
||||||
@@ -265,11 +264,9 @@ int main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* allocate image where the decoded image will be put */
|
/* allocate image where the decoded image will be put */
|
||||||
width = video_dec_ctx->width;
|
|
||||||
height = video_dec_ctx->height;
|
|
||||||
pix_fmt = video_dec_ctx->pix_fmt;
|
|
||||||
ret = av_image_alloc(video_dst_data, video_dst_linesize,
|
ret = av_image_alloc(video_dst_data, video_dst_linesize,
|
||||||
width, height, pix_fmt, 1);
|
video_dec_ctx->width, video_dec_ctx->height,
|
||||||
|
video_dec_ctx->pix_fmt, 1);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "Could not allocate raw video buffer\n");
|
fprintf(stderr, "Could not allocate raw video buffer\n");
|
||||||
goto end;
|
goto end;
|
||||||
@@ -277,11 +274,12 @@ int main (int argc, char **argv)
|
|||||||
video_dst_bufsize = ret;
|
video_dst_bufsize = ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (open_codec_context(&audio_stream_idx, &audio_dec_ctx, fmt_ctx, AVMEDIA_TYPE_AUDIO) >= 0) {
|
if (open_codec_context(&audio_stream_idx, fmt_ctx, AVMEDIA_TYPE_AUDIO) >= 0) {
|
||||||
audio_stream = fmt_ctx->streams[audio_stream_idx];
|
audio_stream = fmt_ctx->streams[audio_stream_idx];
|
||||||
|
audio_dec_ctx = audio_stream->codec;
|
||||||
audio_dst_file = fopen(audio_dst_filename, "wb");
|
audio_dst_file = fopen(audio_dst_filename, "wb");
|
||||||
if (!audio_dst_file) {
|
if (!audio_dst_file) {
|
||||||
fprintf(stderr, "Could not open destination file %s\n", audio_dst_filename);
|
fprintf(stderr, "Could not open destination file %s\n", video_dst_filename);
|
||||||
ret = 1;
|
ret = 1;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@@ -296,19 +294,22 @@ int main (int argc, char **argv)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
frame = av_frame_alloc();
|
/* When using the new API, you need to use the libavutil/frame.h API, while
|
||||||
|
* the classic frame management is available in libavcodec */
|
||||||
|
if (api_mode == API_MODE_OLD)
|
||||||
|
frame = avcodec_alloc_frame();
|
||||||
|
else
|
||||||
|
frame = av_frame_alloc();
|
||||||
if (!frame) {
|
if (!frame) {
|
||||||
fprintf(stderr, "Could not allocate frame\n");
|
fprintf(stderr, "Could not allocate frame\n");
|
||||||
ret = AVERROR(ENOMEM);
|
ret = AVERROR(ENOMEM);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
pkt = av_packet_alloc();
|
/* initialize packet, set data to NULL, let the demuxer fill it */
|
||||||
if (!pkt) {
|
av_init_packet(&pkt);
|
||||||
fprintf(stderr, "Could not allocate packet\n");
|
pkt.data = NULL;
|
||||||
ret = AVERROR(ENOMEM);
|
pkt.size = 0;
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (video_stream)
|
if (video_stream)
|
||||||
printf("Demuxing video from file '%s' into '%s'\n", src_filename, video_dst_filename);
|
printf("Demuxing video from file '%s' into '%s'\n", src_filename, video_dst_filename);
|
||||||
@@ -316,30 +317,31 @@ int main (int argc, char **argv)
|
|||||||
printf("Demuxing audio from file '%s' into '%s'\n", src_filename, audio_dst_filename);
|
printf("Demuxing audio from file '%s' into '%s'\n", src_filename, audio_dst_filename);
|
||||||
|
|
||||||
/* read frames from the file */
|
/* read frames from the file */
|
||||||
while (av_read_frame(fmt_ctx, pkt) >= 0) {
|
while (av_read_frame(fmt_ctx, &pkt) >= 0) {
|
||||||
// check if the packet belongs to a stream we are interested in, otherwise
|
AVPacket orig_pkt = pkt;
|
||||||
// skip it
|
do {
|
||||||
if (pkt->stream_index == video_stream_idx)
|
ret = decode_packet(&got_frame, 0);
|
||||||
ret = decode_packet(video_dec_ctx, pkt);
|
if (ret < 0)
|
||||||
else if (pkt->stream_index == audio_stream_idx)
|
break;
|
||||||
ret = decode_packet(audio_dec_ctx, pkt);
|
pkt.data += ret;
|
||||||
av_packet_unref(pkt);
|
pkt.size -= ret;
|
||||||
if (ret < 0)
|
} while (pkt.size > 0);
|
||||||
break;
|
av_free_packet(&orig_pkt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* flush the decoders */
|
/* flush cached frames */
|
||||||
if (video_dec_ctx)
|
pkt.data = NULL;
|
||||||
decode_packet(video_dec_ctx, NULL);
|
pkt.size = 0;
|
||||||
if (audio_dec_ctx)
|
do {
|
||||||
decode_packet(audio_dec_ctx, NULL);
|
decode_packet(&got_frame, 1);
|
||||||
|
} while (got_frame);
|
||||||
|
|
||||||
printf("Demuxing succeeded.\n");
|
printf("Demuxing succeeded.\n");
|
||||||
|
|
||||||
if (video_stream) {
|
if (video_stream) {
|
||||||
printf("Play the output video file with the command:\n"
|
printf("Play the output video file with the command:\n"
|
||||||
"ffplay -f rawvideo -pix_fmt %s -video_size %dx%d %s\n",
|
"ffplay -f rawvideo -pix_fmt %s -video_size %dx%d %s\n",
|
||||||
av_get_pix_fmt_name(pix_fmt), width, height,
|
av_get_pix_fmt_name(video_dec_ctx->pix_fmt), video_dec_ctx->width, video_dec_ctx->height,
|
||||||
video_dst_filename);
|
video_dst_filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,15 +369,17 @@ int main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
avcodec_free_context(&video_dec_ctx);
|
avcodec_close(video_dec_ctx);
|
||||||
avcodec_free_context(&audio_dec_ctx);
|
avcodec_close(audio_dec_ctx);
|
||||||
avformat_close_input(&fmt_ctx);
|
avformat_close_input(&fmt_ctx);
|
||||||
if (video_dst_file)
|
if (video_dst_file)
|
||||||
fclose(video_dst_file);
|
fclose(video_dst_file);
|
||||||
if (audio_dst_file)
|
if (audio_dst_file)
|
||||||
fclose(audio_dst_file);
|
fclose(audio_dst_file);
|
||||||
av_packet_free(&pkt);
|
if (api_mode == API_MODE_OLD)
|
||||||
av_frame_free(&frame);
|
avcodec_free_frame(&frame);
|
||||||
|
else
|
||||||
|
av_frame_free(&frame);
|
||||||
av_free(video_dst_data[0]);
|
av_free(video_dst_data[0]);
|
||||||
|
|
||||||
return ret < 0;
|
return ret < 0;
|
||||||
|
|||||||
@@ -1,238 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2001 Fabrice Bellard
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file
|
|
||||||
* audio encoding with libavcodec API example.
|
|
||||||
*
|
|
||||||
* @example encode_audio.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include <libavcodec/avcodec.h>
|
|
||||||
|
|
||||||
#include <libavutil/channel_layout.h>
|
|
||||||
#include <libavutil/common.h>
|
|
||||||
#include <libavutil/frame.h>
|
|
||||||
#include <libavutil/samplefmt.h>
|
|
||||||
|
|
||||||
/* check that a given sample format is supported by the encoder */
|
|
||||||
static int check_sample_fmt(const AVCodec *codec, enum AVSampleFormat sample_fmt)
|
|
||||||
{
|
|
||||||
const enum AVSampleFormat *p = codec->sample_fmts;
|
|
||||||
|
|
||||||
while (*p != AV_SAMPLE_FMT_NONE) {
|
|
||||||
if (*p == sample_fmt)
|
|
||||||
return 1;
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* just pick the highest supported samplerate */
|
|
||||||
static int select_sample_rate(const AVCodec *codec)
|
|
||||||
{
|
|
||||||
const int *p;
|
|
||||||
int best_samplerate = 0;
|
|
||||||
|
|
||||||
if (!codec->supported_samplerates)
|
|
||||||
return 44100;
|
|
||||||
|
|
||||||
p = codec->supported_samplerates;
|
|
||||||
while (*p) {
|
|
||||||
if (!best_samplerate || abs(44100 - *p) < abs(44100 - best_samplerate))
|
|
||||||
best_samplerate = *p;
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
return best_samplerate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* select layout with the highest channel count */
|
|
||||||
static int select_channel_layout(const AVCodec *codec)
|
|
||||||
{
|
|
||||||
const uint64_t *p;
|
|
||||||
uint64_t best_ch_layout = 0;
|
|
||||||
int best_nb_channels = 0;
|
|
||||||
|
|
||||||
if (!codec->channel_layouts)
|
|
||||||
return AV_CH_LAYOUT_STEREO;
|
|
||||||
|
|
||||||
p = codec->channel_layouts;
|
|
||||||
while (*p) {
|
|
||||||
int nb_channels = av_get_channel_layout_nb_channels(*p);
|
|
||||||
|
|
||||||
if (nb_channels > best_nb_channels) {
|
|
||||||
best_ch_layout = *p;
|
|
||||||
best_nb_channels = nb_channels;
|
|
||||||
}
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
return best_ch_layout;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void encode(AVCodecContext *ctx, AVFrame *frame, AVPacket *pkt,
|
|
||||||
FILE *output)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* send the frame for encoding */
|
|
||||||
ret = avcodec_send_frame(ctx, frame);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Error sending the frame to the encoder\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* read all the available output packets (in general there may be any
|
|
||||||
* number of them */
|
|
||||||
while (ret >= 0) {
|
|
||||||
ret = avcodec_receive_packet(ctx, pkt);
|
|
||||||
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
|
|
||||||
return;
|
|
||||||
else if (ret < 0) {
|
|
||||||
fprintf(stderr, "Error encoding audio frame\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
fwrite(pkt->data, 1, pkt->size, output);
|
|
||||||
av_packet_unref(pkt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
const char *filename;
|
|
||||||
const AVCodec *codec;
|
|
||||||
AVCodecContext *c= NULL;
|
|
||||||
AVFrame *frame;
|
|
||||||
AVPacket *pkt;
|
|
||||||
int i, j, k, ret;
|
|
||||||
FILE *f;
|
|
||||||
uint16_t *samples;
|
|
||||||
float t, tincr;
|
|
||||||
|
|
||||||
if (argc <= 1) {
|
|
||||||
fprintf(stderr, "Usage: %s <output file>\n", argv[0]);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
filename = argv[1];
|
|
||||||
|
|
||||||
/* find the MP2 encoder */
|
|
||||||
codec = avcodec_find_encoder(AV_CODEC_ID_MP2);
|
|
||||||
if (!codec) {
|
|
||||||
fprintf(stderr, "Codec not found\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
c = avcodec_alloc_context3(codec);
|
|
||||||
if (!c) {
|
|
||||||
fprintf(stderr, "Could not allocate audio codec context\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* put sample parameters */
|
|
||||||
c->bit_rate = 64000;
|
|
||||||
|
|
||||||
/* check that the encoder supports s16 pcm input */
|
|
||||||
c->sample_fmt = AV_SAMPLE_FMT_S16;
|
|
||||||
if (!check_sample_fmt(codec, c->sample_fmt)) {
|
|
||||||
fprintf(stderr, "Encoder does not support sample format %s",
|
|
||||||
av_get_sample_fmt_name(c->sample_fmt));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* select other audio parameters supported by the encoder */
|
|
||||||
c->sample_rate = select_sample_rate(codec);
|
|
||||||
c->channel_layout = select_channel_layout(codec);
|
|
||||||
c->channels = av_get_channel_layout_nb_channels(c->channel_layout);
|
|
||||||
|
|
||||||
/* open it */
|
|
||||||
if (avcodec_open2(c, codec, NULL) < 0) {
|
|
||||||
fprintf(stderr, "Could not open codec\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
f = fopen(filename, "wb");
|
|
||||||
if (!f) {
|
|
||||||
fprintf(stderr, "Could not open %s\n", filename);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* packet for holding encoded output */
|
|
||||||
pkt = av_packet_alloc();
|
|
||||||
if (!pkt) {
|
|
||||||
fprintf(stderr, "could not allocate the packet\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* frame containing input raw audio */
|
|
||||||
frame = av_frame_alloc();
|
|
||||||
if (!frame) {
|
|
||||||
fprintf(stderr, "Could not allocate audio frame\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
frame->nb_samples = c->frame_size;
|
|
||||||
frame->format = c->sample_fmt;
|
|
||||||
frame->channel_layout = c->channel_layout;
|
|
||||||
|
|
||||||
/* allocate the data buffers */
|
|
||||||
ret = av_frame_get_buffer(frame, 0);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Could not allocate audio data buffers\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* encode a single tone sound */
|
|
||||||
t = 0;
|
|
||||||
tincr = 2 * M_PI * 440.0 / c->sample_rate;
|
|
||||||
for (i = 0; i < 200; i++) {
|
|
||||||
/* make sure the frame is writable -- makes a copy if the encoder
|
|
||||||
* kept a reference internally */
|
|
||||||
ret = av_frame_make_writable(frame);
|
|
||||||
if (ret < 0)
|
|
||||||
exit(1);
|
|
||||||
samples = (uint16_t*)frame->data[0];
|
|
||||||
|
|
||||||
for (j = 0; j < c->frame_size; j++) {
|
|
||||||
samples[2*j] = (int)(sin(t) * 10000);
|
|
||||||
|
|
||||||
for (k = 1; k < c->channels; k++)
|
|
||||||
samples[2*j + k] = samples[2*j];
|
|
||||||
t += tincr;
|
|
||||||
}
|
|
||||||
encode(c, frame, pkt, f);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* flush the encoder */
|
|
||||||
encode(c, NULL, pkt, f);
|
|
||||||
|
|
||||||
fclose(f);
|
|
||||||
|
|
||||||
av_frame_free(&frame);
|
|
||||||
av_packet_free(&pkt);
|
|
||||||
avcodec_free_context(&c);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1,198 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2001 Fabrice Bellard
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file
|
|
||||||
* video encoding with libavcodec API example
|
|
||||||
*
|
|
||||||
* @example encode_video.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <libavcodec/avcodec.h>
|
|
||||||
|
|
||||||
#include <libavutil/opt.h>
|
|
||||||
#include <libavutil/imgutils.h>
|
|
||||||
|
|
||||||
static void encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt,
|
|
||||||
FILE *outfile)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* send the frame to the encoder */
|
|
||||||
if (frame)
|
|
||||||
printf("Send frame %3"PRId64"\n", frame->pts);
|
|
||||||
|
|
||||||
ret = avcodec_send_frame(enc_ctx, frame);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Error sending a frame for encoding\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (ret >= 0) {
|
|
||||||
ret = avcodec_receive_packet(enc_ctx, pkt);
|
|
||||||
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
|
|
||||||
return;
|
|
||||||
else if (ret < 0) {
|
|
||||||
fprintf(stderr, "Error during encoding\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("Write packet %3"PRId64" (size=%5d)\n", pkt->pts, pkt->size);
|
|
||||||
fwrite(pkt->data, 1, pkt->size, outfile);
|
|
||||||
av_packet_unref(pkt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
const char *filename, *codec_name;
|
|
||||||
const AVCodec *codec;
|
|
||||||
AVCodecContext *c= NULL;
|
|
||||||
int i, ret, x, y;
|
|
||||||
FILE *f;
|
|
||||||
AVFrame *frame;
|
|
||||||
AVPacket *pkt;
|
|
||||||
uint8_t endcode[] = { 0, 0, 1, 0xb7 };
|
|
||||||
|
|
||||||
if (argc <= 2) {
|
|
||||||
fprintf(stderr, "Usage: %s <output file> <codec name>\n", argv[0]);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
filename = argv[1];
|
|
||||||
codec_name = argv[2];
|
|
||||||
|
|
||||||
/* find the mpeg1video encoder */
|
|
||||||
codec = avcodec_find_encoder_by_name(codec_name);
|
|
||||||
if (!codec) {
|
|
||||||
fprintf(stderr, "Codec '%s' not found\n", codec_name);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
c = avcodec_alloc_context3(codec);
|
|
||||||
if (!c) {
|
|
||||||
fprintf(stderr, "Could not allocate video codec context\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
pkt = av_packet_alloc();
|
|
||||||
if (!pkt)
|
|
||||||
exit(1);
|
|
||||||
|
|
||||||
/* put sample parameters */
|
|
||||||
c->bit_rate = 400000;
|
|
||||||
/* resolution must be a multiple of two */
|
|
||||||
c->width = 352;
|
|
||||||
c->height = 288;
|
|
||||||
/* frames per second */
|
|
||||||
c->time_base = (AVRational){1, 25};
|
|
||||||
c->framerate = (AVRational){25, 1};
|
|
||||||
|
|
||||||
/* emit one intra frame every ten frames
|
|
||||||
* check frame pict_type before passing frame
|
|
||||||
* to encoder, if frame->pict_type is AV_PICTURE_TYPE_I
|
|
||||||
* then gop_size is ignored and the output of encoder
|
|
||||||
* will always be I frame irrespective to gop_size
|
|
||||||
*/
|
|
||||||
c->gop_size = 10;
|
|
||||||
c->max_b_frames = 1;
|
|
||||||
c->pix_fmt = AV_PIX_FMT_YUV420P;
|
|
||||||
|
|
||||||
if (codec->id == AV_CODEC_ID_H264)
|
|
||||||
av_opt_set(c->priv_data, "preset", "slow", 0);
|
|
||||||
|
|
||||||
/* open it */
|
|
||||||
ret = avcodec_open2(c, codec, NULL);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Could not open codec: %s\n", av_err2str(ret));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
f = fopen(filename, "wb");
|
|
||||||
if (!f) {
|
|
||||||
fprintf(stderr, "Could not open %s\n", filename);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
frame = av_frame_alloc();
|
|
||||||
if (!frame) {
|
|
||||||
fprintf(stderr, "Could not allocate video frame\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
frame->format = c->pix_fmt;
|
|
||||||
frame->width = c->width;
|
|
||||||
frame->height = c->height;
|
|
||||||
|
|
||||||
ret = av_frame_get_buffer(frame, 0);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Could not allocate the video frame data\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* encode 1 second of video */
|
|
||||||
for (i = 0; i < 25; i++) {
|
|
||||||
fflush(stdout);
|
|
||||||
|
|
||||||
/* make sure the frame data is writable */
|
|
||||||
ret = av_frame_make_writable(frame);
|
|
||||||
if (ret < 0)
|
|
||||||
exit(1);
|
|
||||||
|
|
||||||
/* prepare a dummy image */
|
|
||||||
/* Y */
|
|
||||||
for (y = 0; y < c->height; y++) {
|
|
||||||
for (x = 0; x < c->width; x++) {
|
|
||||||
frame->data[0][y * frame->linesize[0] + x] = x + y + i * 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Cb and Cr */
|
|
||||||
for (y = 0; y < c->height/2; y++) {
|
|
||||||
for (x = 0; x < c->width/2; x++) {
|
|
||||||
frame->data[1][y * frame->linesize[1] + x] = 128 + y + i * 2;
|
|
||||||
frame->data[2][y * frame->linesize[2] + x] = 64 + x + i * 5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
frame->pts = i;
|
|
||||||
|
|
||||||
/* encode the image */
|
|
||||||
encode(c, frame, pkt, f);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* flush the encoder */
|
|
||||||
encode(c, NULL, pkt, f);
|
|
||||||
|
|
||||||
/* add sequence end code to have a real MPEG file */
|
|
||||||
if (codec->id == AV_CODEC_ID_MPEG1VIDEO || codec->id == AV_CODEC_ID_MPEG2VIDEO)
|
|
||||||
fwrite(endcode, 1, sizeof(endcode), f);
|
|
||||||
fclose(f);
|
|
||||||
|
|
||||||
avcodec_free_context(&c);
|
|
||||||
av_frame_free(&frame);
|
|
||||||
av_packet_free(&pkt);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1,178 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2012 Stefano Sabatini
|
|
||||||
* Copyright (c) 2014 Clément Bœsch
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <libavutil/motion_vector.h>
|
|
||||||
#include <libavformat/avformat.h>
|
|
||||||
|
|
||||||
static AVFormatContext *fmt_ctx = NULL;
|
|
||||||
static AVCodecContext *video_dec_ctx = NULL;
|
|
||||||
static AVStream *video_stream = NULL;
|
|
||||||
static const char *src_filename = NULL;
|
|
||||||
|
|
||||||
static int video_stream_idx = -1;
|
|
||||||
static AVFrame *frame = NULL;
|
|
||||||
static int video_frame_count = 0;
|
|
||||||
|
|
||||||
static int decode_packet(const AVPacket *pkt)
|
|
||||||
{
|
|
||||||
int ret = avcodec_send_packet(video_dec_ctx, pkt);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Error while sending a packet to the decoder: %s\n", av_err2str(ret));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (ret >= 0) {
|
|
||||||
ret = avcodec_receive_frame(video_dec_ctx, frame);
|
|
||||||
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
|
|
||||||
break;
|
|
||||||
} else if (ret < 0) {
|
|
||||||
fprintf(stderr, "Error while receiving a frame from the decoder: %s\n", av_err2str(ret));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ret >= 0) {
|
|
||||||
int i;
|
|
||||||
AVFrameSideData *sd;
|
|
||||||
|
|
||||||
video_frame_count++;
|
|
||||||
sd = av_frame_get_side_data(frame, AV_FRAME_DATA_MOTION_VECTORS);
|
|
||||||
if (sd) {
|
|
||||||
const AVMotionVector *mvs = (const AVMotionVector *)sd->data;
|
|
||||||
for (i = 0; i < sd->size / sizeof(*mvs); i++) {
|
|
||||||
const AVMotionVector *mv = &mvs[i];
|
|
||||||
printf("%d,%2d,%2d,%2d,%4d,%4d,%4d,%4d,0x%"PRIx64"\n",
|
|
||||||
video_frame_count, mv->source,
|
|
||||||
mv->w, mv->h, mv->src_x, mv->src_y,
|
|
||||||
mv->dst_x, mv->dst_y, mv->flags);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
av_frame_unref(frame);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int open_codec_context(AVFormatContext *fmt_ctx, enum AVMediaType type)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
AVStream *st;
|
|
||||||
AVCodecContext *dec_ctx = NULL;
|
|
||||||
AVCodec *dec = NULL;
|
|
||||||
AVDictionary *opts = NULL;
|
|
||||||
|
|
||||||
ret = av_find_best_stream(fmt_ctx, type, -1, -1, &dec, 0);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Could not find %s stream in input file '%s'\n",
|
|
||||||
av_get_media_type_string(type), src_filename);
|
|
||||||
return ret;
|
|
||||||
} else {
|
|
||||||
int stream_idx = ret;
|
|
||||||
st = fmt_ctx->streams[stream_idx];
|
|
||||||
|
|
||||||
dec_ctx = avcodec_alloc_context3(dec);
|
|
||||||
if (!dec_ctx) {
|
|
||||||
fprintf(stderr, "Failed to allocate codec\n");
|
|
||||||
return AVERROR(EINVAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = avcodec_parameters_to_context(dec_ctx, st->codecpar);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Failed to copy codec parameters to codec context\n");
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Init the video decoder */
|
|
||||||
av_dict_set(&opts, "flags2", "+export_mvs", 0);
|
|
||||||
if ((ret = avcodec_open2(dec_ctx, dec, &opts)) < 0) {
|
|
||||||
fprintf(stderr, "Failed to open %s codec\n",
|
|
||||||
av_get_media_type_string(type));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
video_stream_idx = stream_idx;
|
|
||||||
video_stream = fmt_ctx->streams[video_stream_idx];
|
|
||||||
video_dec_ctx = dec_ctx;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
int ret = 0;
|
|
||||||
AVPacket pkt = { 0 };
|
|
||||||
|
|
||||||
if (argc != 2) {
|
|
||||||
fprintf(stderr, "Usage: %s <video>\n", argv[0]);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
src_filename = argv[1];
|
|
||||||
|
|
||||||
if (avformat_open_input(&fmt_ctx, src_filename, NULL, NULL) < 0) {
|
|
||||||
fprintf(stderr, "Could not open source file %s\n", src_filename);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (avformat_find_stream_info(fmt_ctx, NULL) < 0) {
|
|
||||||
fprintf(stderr, "Could not find stream information\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
open_codec_context(fmt_ctx, AVMEDIA_TYPE_VIDEO);
|
|
||||||
|
|
||||||
av_dump_format(fmt_ctx, 0, src_filename, 0);
|
|
||||||
|
|
||||||
if (!video_stream) {
|
|
||||||
fprintf(stderr, "Could not find video stream in the input, aborting\n");
|
|
||||||
ret = 1;
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
frame = av_frame_alloc();
|
|
||||||
if (!frame) {
|
|
||||||
fprintf(stderr, "Could not allocate frame\n");
|
|
||||||
ret = AVERROR(ENOMEM);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("framenum,source,blockw,blockh,srcx,srcy,dstx,dsty,flags\n");
|
|
||||||
|
|
||||||
/* read frames from the file */
|
|
||||||
while (av_read_frame(fmt_ctx, &pkt) >= 0) {
|
|
||||||
if (pkt.stream_index == video_stream_idx)
|
|
||||||
ret = decode_packet(&pkt);
|
|
||||||
av_packet_unref(&pkt);
|
|
||||||
if (ret < 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* flush cached frames */
|
|
||||||
decode_packet(NULL);
|
|
||||||
|
|
||||||
end:
|
|
||||||
avcodec_free_context(&video_dec_ctx);
|
|
||||||
avformat_close_input(&fmt_ctx);
|
|
||||||
av_frame_free(&frame);
|
|
||||||
return ret < 0;
|
|
||||||
}
|
|
||||||
@@ -45,7 +45,6 @@
|
|||||||
|
|
||||||
#include "libavutil/channel_layout.h"
|
#include "libavutil/channel_layout.h"
|
||||||
#include "libavutil/md5.h"
|
#include "libavutil/md5.h"
|
||||||
#include "libavutil/mem.h"
|
|
||||||
#include "libavutil/opt.h"
|
#include "libavutil/opt.h"
|
||||||
#include "libavutil/samplefmt.h"
|
#include "libavutil/samplefmt.h"
|
||||||
|
|
||||||
@@ -64,13 +63,13 @@ static int init_filter_graph(AVFilterGraph **graph, AVFilterContext **src,
|
|||||||
{
|
{
|
||||||
AVFilterGraph *filter_graph;
|
AVFilterGraph *filter_graph;
|
||||||
AVFilterContext *abuffer_ctx;
|
AVFilterContext *abuffer_ctx;
|
||||||
const AVFilter *abuffer;
|
AVFilter *abuffer;
|
||||||
AVFilterContext *volume_ctx;
|
AVFilterContext *volume_ctx;
|
||||||
const AVFilter *volume;
|
AVFilter *volume;
|
||||||
AVFilterContext *aformat_ctx;
|
AVFilterContext *aformat_ctx;
|
||||||
const AVFilter *aformat;
|
AVFilter *aformat;
|
||||||
AVFilterContext *abuffersink_ctx;
|
AVFilterContext *abuffersink_ctx;
|
||||||
const AVFilter *abuffersink;
|
AVFilter *abuffersink;
|
||||||
|
|
||||||
AVDictionary *options_dict = NULL;
|
AVDictionary *options_dict = NULL;
|
||||||
uint8_t options_str[1024];
|
uint8_t options_str[1024];
|
||||||
@@ -289,6 +288,8 @@ int main(int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
avfilter_register_all();
|
||||||
|
|
||||||
/* Allocate the frame we will be using to store the data. */
|
/* Allocate the frame we will be using to store the data. */
|
||||||
frame = av_frame_alloc();
|
frame = av_frame_alloc();
|
||||||
if (!frame) {
|
if (!frame) {
|
||||||
|
|||||||
@@ -32,6 +32,8 @@
|
|||||||
|
|
||||||
#include <libavcodec/avcodec.h>
|
#include <libavcodec/avcodec.h>
|
||||||
#include <libavformat/avformat.h>
|
#include <libavformat/avformat.h>
|
||||||
|
#include <libavfilter/avfiltergraph.h>
|
||||||
|
#include <libavfilter/avcodec.h>
|
||||||
#include <libavfilter/buffersink.h>
|
#include <libavfilter/buffersink.h>
|
||||||
#include <libavfilter/buffersrc.h>
|
#include <libavfilter/buffersrc.h>
|
||||||
#include <libavutil/opt.h>
|
#include <libavutil/opt.h>
|
||||||
@@ -64,16 +66,12 @@ static int open_input_file(const char *filename)
|
|||||||
/* select the audio stream */
|
/* select the audio stream */
|
||||||
ret = av_find_best_stream(fmt_ctx, AVMEDIA_TYPE_AUDIO, -1, -1, &dec, 0);
|
ret = av_find_best_stream(fmt_ctx, AVMEDIA_TYPE_AUDIO, -1, -1, &dec, 0);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
av_log(NULL, AV_LOG_ERROR, "Cannot find an audio stream in the input file\n");
|
av_log(NULL, AV_LOG_ERROR, "Cannot find a audio stream in the input file\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
audio_stream_index = ret;
|
audio_stream_index = ret;
|
||||||
|
dec_ctx = fmt_ctx->streams[audio_stream_index]->codec;
|
||||||
/* create decoding context */
|
av_opt_set_int(dec_ctx, "refcounted_frames", 1, 0);
|
||||||
dec_ctx = avcodec_alloc_context3(dec);
|
|
||||||
if (!dec_ctx)
|
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
avcodec_parameters_to_context(dec_ctx, fmt_ctx->streams[audio_stream_index]->codecpar);
|
|
||||||
|
|
||||||
/* init the audio decoder */
|
/* init the audio decoder */
|
||||||
if ((ret = avcodec_open2(dec_ctx, dec, NULL)) < 0) {
|
if ((ret = avcodec_open2(dec_ctx, dec, NULL)) < 0) {
|
||||||
@@ -88,8 +86,8 @@ static int init_filters(const char *filters_descr)
|
|||||||
{
|
{
|
||||||
char args[512];
|
char args[512];
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
const AVFilter *abuffersrc = avfilter_get_by_name("abuffer");
|
AVFilter *abuffersrc = avfilter_get_by_name("abuffer");
|
||||||
const AVFilter *abuffersink = avfilter_get_by_name("abuffersink");
|
AVFilter *abuffersink = avfilter_get_by_name("abuffersink");
|
||||||
AVFilterInOut *outputs = avfilter_inout_alloc();
|
AVFilterInOut *outputs = avfilter_inout_alloc();
|
||||||
AVFilterInOut *inputs = avfilter_inout_alloc();
|
AVFilterInOut *inputs = avfilter_inout_alloc();
|
||||||
static const enum AVSampleFormat out_sample_fmts[] = { AV_SAMPLE_FMT_S16, -1 };
|
static const enum AVSampleFormat out_sample_fmts[] = { AV_SAMPLE_FMT_S16, -1 };
|
||||||
@@ -147,28 +145,12 @@ static int init_filters(const char *filters_descr)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Endpoints for the filter graph. */
|
||||||
* Set the endpoints for the filter graph. The filter_graph will
|
|
||||||
* be linked to the graph described by filters_descr.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The buffer source output must be connected to the input pad of
|
|
||||||
* the first filter described by filters_descr; since the first
|
|
||||||
* filter input label is not specified, it is set to "in" by
|
|
||||||
* default.
|
|
||||||
*/
|
|
||||||
outputs->name = av_strdup("in");
|
outputs->name = av_strdup("in");
|
||||||
outputs->filter_ctx = buffersrc_ctx;
|
outputs->filter_ctx = buffersrc_ctx;
|
||||||
outputs->pad_idx = 0;
|
outputs->pad_idx = 0;
|
||||||
outputs->next = NULL;
|
outputs->next = NULL;
|
||||||
|
|
||||||
/*
|
|
||||||
* The buffer sink input must be connected to the output pad of
|
|
||||||
* the last filter described by filters_descr; since the last
|
|
||||||
* filter output label is not specified, it is set to "out" by
|
|
||||||
* default.
|
|
||||||
*/
|
|
||||||
inputs->name = av_strdup("out");
|
inputs->name = av_strdup("out");
|
||||||
inputs->filter_ctx = buffersink_ctx;
|
inputs->filter_ctx = buffersink_ctx;
|
||||||
inputs->pad_idx = 0;
|
inputs->pad_idx = 0;
|
||||||
@@ -199,7 +181,7 @@ end:
|
|||||||
|
|
||||||
static void print_frame(const AVFrame *frame)
|
static void print_frame(const AVFrame *frame)
|
||||||
{
|
{
|
||||||
const int n = frame->nb_samples * av_get_channel_layout_nb_channels(frame->channel_layout);
|
const int n = frame->nb_samples * av_get_channel_layout_nb_channels(av_frame_get_channel_layout(frame));
|
||||||
const uint16_t *p = (uint16_t*)frame->data[0];
|
const uint16_t *p = (uint16_t*)frame->data[0];
|
||||||
const uint16_t *p_end = p + n;
|
const uint16_t *p_end = p + n;
|
||||||
|
|
||||||
@@ -214,9 +196,10 @@ static void print_frame(const AVFrame *frame)
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
AVPacket packet;
|
AVPacket packet0, packet;
|
||||||
AVFrame *frame = av_frame_alloc();
|
AVFrame *frame = av_frame_alloc();
|
||||||
AVFrame *filt_frame = av_frame_alloc();
|
AVFrame *filt_frame = av_frame_alloc();
|
||||||
|
int got_frame;
|
||||||
|
|
||||||
if (!frame || !filt_frame) {
|
if (!frame || !filt_frame) {
|
||||||
perror("Could not allocate frame");
|
perror("Could not allocate frame");
|
||||||
@@ -227,58 +210,63 @@ int main(int argc, char **argv)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
av_register_all();
|
||||||
|
avfilter_register_all();
|
||||||
|
|
||||||
if ((ret = open_input_file(argv[1])) < 0)
|
if ((ret = open_input_file(argv[1])) < 0)
|
||||||
goto end;
|
goto end;
|
||||||
if ((ret = init_filters(filter_descr)) < 0)
|
if ((ret = init_filters(filter_descr)) < 0)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
/* read all packets */
|
/* read all packets */
|
||||||
|
packet0.data = NULL;
|
||||||
|
packet.data = NULL;
|
||||||
while (1) {
|
while (1) {
|
||||||
if ((ret = av_read_frame(fmt_ctx, &packet)) < 0)
|
if (!packet0.data) {
|
||||||
break;
|
if ((ret = av_read_frame(fmt_ctx, &packet)) < 0)
|
||||||
|
break;
|
||||||
|
packet0 = packet;
|
||||||
|
}
|
||||||
|
|
||||||
if (packet.stream_index == audio_stream_index) {
|
if (packet.stream_index == audio_stream_index) {
|
||||||
ret = avcodec_send_packet(dec_ctx, &packet);
|
got_frame = 0;
|
||||||
|
ret = avcodec_decode_audio4(dec_ctx, frame, &got_frame, &packet);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
av_log(NULL, AV_LOG_ERROR, "Error while sending a packet to the decoder\n");
|
av_log(NULL, AV_LOG_ERROR, "Error decoding audio\n");
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
|
packet.size -= ret;
|
||||||
|
packet.data += ret;
|
||||||
|
|
||||||
while (ret >= 0) {
|
if (got_frame) {
|
||||||
ret = avcodec_receive_frame(dec_ctx, frame);
|
/* push the audio data from decoded frame into the filtergraph */
|
||||||
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
|
if (av_buffersrc_add_frame_flags(buffersrc_ctx, frame, 0) < 0) {
|
||||||
|
av_log(NULL, AV_LOG_ERROR, "Error while feeding the audio filtergraph\n");
|
||||||
break;
|
break;
|
||||||
} else if (ret < 0) {
|
|
||||||
av_log(NULL, AV_LOG_ERROR, "Error while receiving a frame from the decoder\n");
|
|
||||||
goto end;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret >= 0) {
|
/* pull filtered audio from the filtergraph */
|
||||||
/* push the audio data from decoded frame into the filtergraph */
|
while (1) {
|
||||||
if (av_buffersrc_add_frame_flags(buffersrc_ctx, frame, AV_BUFFERSRC_FLAG_KEEP_REF) < 0) {
|
ret = av_buffersink_get_frame(buffersink_ctx, filt_frame);
|
||||||
av_log(NULL, AV_LOG_ERROR, "Error while feeding the audio filtergraph\n");
|
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
|
||||||
break;
|
break;
|
||||||
}
|
if (ret < 0)
|
||||||
|
goto end;
|
||||||
/* pull filtered audio from the filtergraph */
|
print_frame(filt_frame);
|
||||||
while (1) {
|
av_frame_unref(filt_frame);
|
||||||
ret = av_buffersink_get_frame(buffersink_ctx, filt_frame);
|
|
||||||
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
|
|
||||||
break;
|
|
||||||
if (ret < 0)
|
|
||||||
goto end;
|
|
||||||
print_frame(filt_frame);
|
|
||||||
av_frame_unref(filt_frame);
|
|
||||||
}
|
|
||||||
av_frame_unref(frame);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (packet.size <= 0)
|
||||||
|
av_free_packet(&packet0);
|
||||||
|
} else {
|
||||||
|
/* discard non-wanted packets */
|
||||||
|
av_free_packet(&packet0);
|
||||||
}
|
}
|
||||||
av_packet_unref(&packet);
|
|
||||||
}
|
}
|
||||||
end:
|
end:
|
||||||
avfilter_graph_free(&filter_graph);
|
avfilter_graph_free(&filter_graph);
|
||||||
avcodec_free_context(&dec_ctx);
|
avcodec_close(dec_ctx);
|
||||||
avformat_close_input(&fmt_ctx);
|
avformat_close_input(&fmt_ctx);
|
||||||
av_frame_free(&frame);
|
av_frame_free(&frame);
|
||||||
av_frame_free(&filt_frame);
|
av_frame_free(&filt_frame);
|
||||||
|
|||||||
@@ -29,19 +29,16 @@
|
|||||||
|
|
||||||
#define _XOPEN_SOURCE 600 /* for usleep */
|
#define _XOPEN_SOURCE 600 /* for usleep */
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include <libavcodec/avcodec.h>
|
#include <libavcodec/avcodec.h>
|
||||||
#include <libavformat/avformat.h>
|
#include <libavformat/avformat.h>
|
||||||
|
#include <libavfilter/avfiltergraph.h>
|
||||||
|
#include <libavfilter/avcodec.h>
|
||||||
#include <libavfilter/buffersink.h>
|
#include <libavfilter/buffersink.h>
|
||||||
#include <libavfilter/buffersrc.h>
|
#include <libavfilter/buffersrc.h>
|
||||||
#include <libavutil/opt.h>
|
#include <libavutil/opt.h>
|
||||||
|
|
||||||
const char *filter_descr = "scale=78:24,transpose=cclock";
|
const char *filter_descr = "scale=78:24";
|
||||||
/* other way:
|
|
||||||
scale=78:24 [scl]; [scl] transpose=cclock // assumes "[in]" and "[out]" to be input output pads respectively
|
|
||||||
*/
|
|
||||||
|
|
||||||
static AVFormatContext *fmt_ctx;
|
static AVFormatContext *fmt_ctx;
|
||||||
static AVCodecContext *dec_ctx;
|
static AVCodecContext *dec_ctx;
|
||||||
@@ -73,12 +70,8 @@ static int open_input_file(const char *filename)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
video_stream_index = ret;
|
video_stream_index = ret;
|
||||||
|
dec_ctx = fmt_ctx->streams[video_stream_index]->codec;
|
||||||
/* create decoding context */
|
av_opt_set_int(dec_ctx, "refcounted_frames", 1, 0);
|
||||||
dec_ctx = avcodec_alloc_context3(dec);
|
|
||||||
if (!dec_ctx)
|
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
avcodec_parameters_to_context(dec_ctx, fmt_ctx->streams[video_stream_index]->codecpar);
|
|
||||||
|
|
||||||
/* init the video decoder */
|
/* init the video decoder */
|
||||||
if ((ret = avcodec_open2(dec_ctx, dec, NULL)) < 0) {
|
if ((ret = avcodec_open2(dec_ctx, dec, NULL)) < 0) {
|
||||||
@@ -93,11 +86,10 @@ static int init_filters(const char *filters_descr)
|
|||||||
{
|
{
|
||||||
char args[512];
|
char args[512];
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
const AVFilter *buffersrc = avfilter_get_by_name("buffer");
|
AVFilter *buffersrc = avfilter_get_by_name("buffer");
|
||||||
const AVFilter *buffersink = avfilter_get_by_name("buffersink");
|
AVFilter *buffersink = avfilter_get_by_name("buffersink");
|
||||||
AVFilterInOut *outputs = avfilter_inout_alloc();
|
AVFilterInOut *outputs = avfilter_inout_alloc();
|
||||||
AVFilterInOut *inputs = avfilter_inout_alloc();
|
AVFilterInOut *inputs = avfilter_inout_alloc();
|
||||||
AVRational time_base = fmt_ctx->streams[video_stream_index]->time_base;
|
|
||||||
enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE };
|
enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE };
|
||||||
|
|
||||||
filter_graph = avfilter_graph_alloc();
|
filter_graph = avfilter_graph_alloc();
|
||||||
@@ -110,7 +102,7 @@ static int init_filters(const char *filters_descr)
|
|||||||
snprintf(args, sizeof(args),
|
snprintf(args, sizeof(args),
|
||||||
"video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d",
|
"video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d",
|
||||||
dec_ctx->width, dec_ctx->height, dec_ctx->pix_fmt,
|
dec_ctx->width, dec_ctx->height, dec_ctx->pix_fmt,
|
||||||
time_base.num, time_base.den,
|
dec_ctx->time_base.num, dec_ctx->time_base.den,
|
||||||
dec_ctx->sample_aspect_ratio.num, dec_ctx->sample_aspect_ratio.den);
|
dec_ctx->sample_aspect_ratio.num, dec_ctx->sample_aspect_ratio.den);
|
||||||
|
|
||||||
ret = avfilter_graph_create_filter(&buffersrc_ctx, buffersrc, "in",
|
ret = avfilter_graph_create_filter(&buffersrc_ctx, buffersrc, "in",
|
||||||
@@ -135,28 +127,12 @@ static int init_filters(const char *filters_descr)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Endpoints for the filter graph. */
|
||||||
* Set the endpoints for the filter graph. The filter_graph will
|
|
||||||
* be linked to the graph described by filters_descr.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The buffer source output must be connected to the input pad of
|
|
||||||
* the first filter described by filters_descr; since the first
|
|
||||||
* filter input label is not specified, it is set to "in" by
|
|
||||||
* default.
|
|
||||||
*/
|
|
||||||
outputs->name = av_strdup("in");
|
outputs->name = av_strdup("in");
|
||||||
outputs->filter_ctx = buffersrc_ctx;
|
outputs->filter_ctx = buffersrc_ctx;
|
||||||
outputs->pad_idx = 0;
|
outputs->pad_idx = 0;
|
||||||
outputs->next = NULL;
|
outputs->next = NULL;
|
||||||
|
|
||||||
/*
|
|
||||||
* The buffer sink input must be connected to the output pad of
|
|
||||||
* the last filter described by filters_descr; since the last
|
|
||||||
* filter output label is not specified, it is set to "out" by
|
|
||||||
* default.
|
|
||||||
*/
|
|
||||||
inputs->name = av_strdup("out");
|
inputs->name = av_strdup("out");
|
||||||
inputs->filter_ctx = buffersink_ctx;
|
inputs->filter_ctx = buffersink_ctx;
|
||||||
inputs->pad_idx = 0;
|
inputs->pad_idx = 0;
|
||||||
@@ -211,20 +187,21 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
AVPacket packet;
|
AVPacket packet;
|
||||||
AVFrame *frame;
|
AVFrame *frame = av_frame_alloc();
|
||||||
AVFrame *filt_frame;
|
AVFrame *filt_frame = av_frame_alloc();
|
||||||
|
int got_frame;
|
||||||
|
|
||||||
|
if (!frame || !filt_frame) {
|
||||||
|
perror("Could not allocate frame");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
fprintf(stderr, "Usage: %s file\n", argv[0]);
|
fprintf(stderr, "Usage: %s file\n", argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
frame = av_frame_alloc();
|
av_register_all();
|
||||||
filt_frame = av_frame_alloc();
|
avfilter_register_all();
|
||||||
if (!frame || !filt_frame) {
|
|
||||||
perror("Could not allocate frame");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((ret = open_input_file(argv[1])) < 0)
|
if ((ret = open_input_file(argv[1])) < 0)
|
||||||
goto end;
|
goto end;
|
||||||
@@ -237,22 +214,15 @@ int main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
if (packet.stream_index == video_stream_index) {
|
if (packet.stream_index == video_stream_index) {
|
||||||
ret = avcodec_send_packet(dec_ctx, &packet);
|
got_frame = 0;
|
||||||
|
ret = avcodec_decode_video2(dec_ctx, frame, &got_frame, &packet);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
av_log(NULL, AV_LOG_ERROR, "Error while sending a packet to the decoder\n");
|
av_log(NULL, AV_LOG_ERROR, "Error decoding video\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (ret >= 0) {
|
if (got_frame) {
|
||||||
ret = avcodec_receive_frame(dec_ctx, frame);
|
frame->pts = av_frame_get_best_effort_timestamp(frame);
|
||||||
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
|
|
||||||
break;
|
|
||||||
} else if (ret < 0) {
|
|
||||||
av_log(NULL, AV_LOG_ERROR, "Error while receiving a frame from the decoder\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
frame->pts = frame->best_effort_timestamp;
|
|
||||||
|
|
||||||
/* push the decoded frame into the filtergraph */
|
/* push the decoded frame into the filtergraph */
|
||||||
if (av_buffersrc_add_frame_flags(buffersrc_ctx, frame, AV_BUFFERSRC_FLAG_KEEP_REF) < 0) {
|
if (av_buffersrc_add_frame_flags(buffersrc_ctx, frame, AV_BUFFERSRC_FLAG_KEEP_REF) < 0) {
|
||||||
@@ -273,11 +243,11 @@ int main(int argc, char **argv)
|
|||||||
av_frame_unref(frame);
|
av_frame_unref(frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
av_packet_unref(&packet);
|
av_free_packet(&packet);
|
||||||
}
|
}
|
||||||
end:
|
end:
|
||||||
avfilter_graph_free(&filter_graph);
|
avfilter_graph_free(&filter_graph);
|
||||||
avcodec_free_context(&dec_ctx);
|
avcodec_close(dec_ctx);
|
||||||
avformat_close_input(&fmt_ctx);
|
avformat_close_input(&fmt_ctx);
|
||||||
av_frame_free(&frame);
|
av_frame_free(&frame);
|
||||||
av_frame_free(&filt_frame);
|
av_frame_free(&filt_frame);
|
||||||
|
|||||||
@@ -1,156 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 Stephan Holljes
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file
|
|
||||||
* libavformat multi-client network API usage example.
|
|
||||||
*
|
|
||||||
* @example http_multiclient.c
|
|
||||||
* This example will serve a file without decoding or demuxing it over http.
|
|
||||||
* Multiple clients can connect and will receive the same file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <libavformat/avformat.h>
|
|
||||||
#include <libavutil/opt.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
static void process_client(AVIOContext *client, const char *in_uri)
|
|
||||||
{
|
|
||||||
AVIOContext *input = NULL;
|
|
||||||
uint8_t buf[1024];
|
|
||||||
int ret, n, reply_code;
|
|
||||||
uint8_t *resource = NULL;
|
|
||||||
while ((ret = avio_handshake(client)) > 0) {
|
|
||||||
av_opt_get(client, "resource", AV_OPT_SEARCH_CHILDREN, &resource);
|
|
||||||
// check for strlen(resource) is necessary, because av_opt_get()
|
|
||||||
// may return empty string.
|
|
||||||
if (resource && strlen(resource))
|
|
||||||
break;
|
|
||||||
av_freep(&resource);
|
|
||||||
}
|
|
||||||
if (ret < 0)
|
|
||||||
goto end;
|
|
||||||
av_log(client, AV_LOG_TRACE, "resource=%p\n", resource);
|
|
||||||
if (resource && resource[0] == '/' && !strcmp((resource + 1), in_uri)) {
|
|
||||||
reply_code = 200;
|
|
||||||
} else {
|
|
||||||
reply_code = AVERROR_HTTP_NOT_FOUND;
|
|
||||||
}
|
|
||||||
if ((ret = av_opt_set_int(client, "reply_code", reply_code, AV_OPT_SEARCH_CHILDREN)) < 0) {
|
|
||||||
av_log(client, AV_LOG_ERROR, "Failed to set reply_code: %s.\n", av_err2str(ret));
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
av_log(client, AV_LOG_TRACE, "Set reply code to %d\n", reply_code);
|
|
||||||
|
|
||||||
while ((ret = avio_handshake(client)) > 0);
|
|
||||||
|
|
||||||
if (ret < 0)
|
|
||||||
goto end;
|
|
||||||
|
|
||||||
fprintf(stderr, "Handshake performed.\n");
|
|
||||||
if (reply_code != 200)
|
|
||||||
goto end;
|
|
||||||
fprintf(stderr, "Opening input file.\n");
|
|
||||||
if ((ret = avio_open2(&input, in_uri, AVIO_FLAG_READ, NULL, NULL)) < 0) {
|
|
||||||
av_log(input, AV_LOG_ERROR, "Failed to open input: %s: %s.\n", in_uri,
|
|
||||||
av_err2str(ret));
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
for(;;) {
|
|
||||||
n = avio_read(input, buf, sizeof(buf));
|
|
||||||
if (n < 0) {
|
|
||||||
if (n == AVERROR_EOF)
|
|
||||||
break;
|
|
||||||
av_log(input, AV_LOG_ERROR, "Error reading from input: %s.\n",
|
|
||||||
av_err2str(n));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
avio_write(client, buf, n);
|
|
||||||
avio_flush(client);
|
|
||||||
}
|
|
||||||
end:
|
|
||||||
fprintf(stderr, "Flushing client\n");
|
|
||||||
avio_flush(client);
|
|
||||||
fprintf(stderr, "Closing client\n");
|
|
||||||
avio_close(client);
|
|
||||||
fprintf(stderr, "Closing input\n");
|
|
||||||
avio_close(input);
|
|
||||||
av_freep(&resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
AVDictionary *options = NULL;
|
|
||||||
AVIOContext *client = NULL, *server = NULL;
|
|
||||||
const char *in_uri, *out_uri;
|
|
||||||
int ret, pid;
|
|
||||||
av_log_set_level(AV_LOG_TRACE);
|
|
||||||
if (argc < 3) {
|
|
||||||
printf("usage: %s input http://hostname[:port]\n"
|
|
||||||
"API example program to serve http to multiple clients.\n"
|
|
||||||
"\n", argv[0]);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
in_uri = argv[1];
|
|
||||||
out_uri = argv[2];
|
|
||||||
|
|
||||||
avformat_network_init();
|
|
||||||
|
|
||||||
if ((ret = av_dict_set(&options, "listen", "2", 0)) < 0) {
|
|
||||||
fprintf(stderr, "Failed to set listen mode for server: %s\n", av_err2str(ret));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
if ((ret = avio_open2(&server, out_uri, AVIO_FLAG_WRITE, NULL, &options)) < 0) {
|
|
||||||
fprintf(stderr, "Failed to open server: %s\n", av_err2str(ret));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
fprintf(stderr, "Entering main loop.\n");
|
|
||||||
for(;;) {
|
|
||||||
if ((ret = avio_accept(server, &client)) < 0)
|
|
||||||
goto end;
|
|
||||||
fprintf(stderr, "Accepted client, forking process.\n");
|
|
||||||
// XXX: Since we don't reap our children and don't ignore signals
|
|
||||||
// this produces zombie processes.
|
|
||||||
pid = fork();
|
|
||||||
if (pid < 0) {
|
|
||||||
perror("Fork failed");
|
|
||||||
ret = AVERROR(errno);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if (pid == 0) {
|
|
||||||
fprintf(stderr, "In child.\n");
|
|
||||||
process_client(client, in_uri);
|
|
||||||
avio_close(server);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
if (pid > 0)
|
|
||||||
avio_close(client);
|
|
||||||
}
|
|
||||||
end:
|
|
||||||
avio_close(server);
|
|
||||||
if (ret < 0 && ret != AVERROR_EOF) {
|
|
||||||
fprintf(stderr, "Some errors occurred: %s\n", av_err2str(ret));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1,252 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2017 Jun Zhao
|
|
||||||
* Copyright (c) 2017 Kaixuan Liu
|
|
||||||
*
|
|
||||||
* HW Acceleration API (video decoding) decode sample
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file
|
|
||||||
* HW-Accelerated decoding example.
|
|
||||||
*
|
|
||||||
* @example hw_decode.c
|
|
||||||
* This example shows how to do HW-accelerated decoding with output
|
|
||||||
* frames from the HW video surfaces.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <libavcodec/avcodec.h>
|
|
||||||
#include <libavformat/avformat.h>
|
|
||||||
#include <libavutil/pixdesc.h>
|
|
||||||
#include <libavutil/hwcontext.h>
|
|
||||||
#include <libavutil/opt.h>
|
|
||||||
#include <libavutil/avassert.h>
|
|
||||||
#include <libavutil/imgutils.h>
|
|
||||||
|
|
||||||
static AVBufferRef *hw_device_ctx = NULL;
|
|
||||||
static enum AVPixelFormat hw_pix_fmt;
|
|
||||||
static FILE *output_file = NULL;
|
|
||||||
|
|
||||||
static int hw_decoder_init(AVCodecContext *ctx, const enum AVHWDeviceType type)
|
|
||||||
{
|
|
||||||
int err = 0;
|
|
||||||
|
|
||||||
if ((err = av_hwdevice_ctx_create(&hw_device_ctx, type,
|
|
||||||
NULL, NULL, 0)) < 0) {
|
|
||||||
fprintf(stderr, "Failed to create specified HW device.\n");
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
ctx->hw_device_ctx = av_buffer_ref(hw_device_ctx);
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
static enum AVPixelFormat get_hw_format(AVCodecContext *ctx,
|
|
||||||
const enum AVPixelFormat *pix_fmts)
|
|
||||||
{
|
|
||||||
const enum AVPixelFormat *p;
|
|
||||||
|
|
||||||
for (p = pix_fmts; *p != -1; p++) {
|
|
||||||
if (*p == hw_pix_fmt)
|
|
||||||
return *p;
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(stderr, "Failed to get HW surface format.\n");
|
|
||||||
return AV_PIX_FMT_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int decode_write(AVCodecContext *avctx, AVPacket *packet)
|
|
||||||
{
|
|
||||||
AVFrame *frame = NULL, *sw_frame = NULL;
|
|
||||||
AVFrame *tmp_frame = NULL;
|
|
||||||
uint8_t *buffer = NULL;
|
|
||||||
int size;
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
ret = avcodec_send_packet(avctx, packet);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Error during decoding\n");
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
if (!(frame = av_frame_alloc()) || !(sw_frame = av_frame_alloc())) {
|
|
||||||
fprintf(stderr, "Can not alloc frame\n");
|
|
||||||
ret = AVERROR(ENOMEM);
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = avcodec_receive_frame(avctx, frame);
|
|
||||||
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
|
|
||||||
av_frame_free(&frame);
|
|
||||||
av_frame_free(&sw_frame);
|
|
||||||
return 0;
|
|
||||||
} else if (ret < 0) {
|
|
||||||
fprintf(stderr, "Error while decoding\n");
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (frame->format == hw_pix_fmt) {
|
|
||||||
/* retrieve data from GPU to CPU */
|
|
||||||
if ((ret = av_hwframe_transfer_data(sw_frame, frame, 0)) < 0) {
|
|
||||||
fprintf(stderr, "Error transferring the data to system memory\n");
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
tmp_frame = sw_frame;
|
|
||||||
} else
|
|
||||||
tmp_frame = frame;
|
|
||||||
|
|
||||||
size = av_image_get_buffer_size(tmp_frame->format, tmp_frame->width,
|
|
||||||
tmp_frame->height, 1);
|
|
||||||
buffer = av_malloc(size);
|
|
||||||
if (!buffer) {
|
|
||||||
fprintf(stderr, "Can not alloc buffer\n");
|
|
||||||
ret = AVERROR(ENOMEM);
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
ret = av_image_copy_to_buffer(buffer, size,
|
|
||||||
(const uint8_t * const *)tmp_frame->data,
|
|
||||||
(const int *)tmp_frame->linesize, tmp_frame->format,
|
|
||||||
tmp_frame->width, tmp_frame->height, 1);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Can not copy image to buffer\n");
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((ret = fwrite(buffer, 1, size, output_file)) < 0) {
|
|
||||||
fprintf(stderr, "Failed to dump raw data.\n");
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
fail:
|
|
||||||
av_frame_free(&frame);
|
|
||||||
av_frame_free(&sw_frame);
|
|
||||||
av_freep(&buffer);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
AVFormatContext *input_ctx = NULL;
|
|
||||||
int video_stream, ret;
|
|
||||||
AVStream *video = NULL;
|
|
||||||
AVCodecContext *decoder_ctx = NULL;
|
|
||||||
AVCodec *decoder = NULL;
|
|
||||||
AVPacket packet;
|
|
||||||
enum AVHWDeviceType type;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (argc < 4) {
|
|
||||||
fprintf(stderr, "Usage: %s <device type> <input file> <output file>\n", argv[0]);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
type = av_hwdevice_find_type_by_name(argv[1]);
|
|
||||||
if (type == AV_HWDEVICE_TYPE_NONE) {
|
|
||||||
fprintf(stderr, "Device type %s is not supported.\n", argv[1]);
|
|
||||||
fprintf(stderr, "Available device types:");
|
|
||||||
while((type = av_hwdevice_iterate_types(type)) != AV_HWDEVICE_TYPE_NONE)
|
|
||||||
fprintf(stderr, " %s", av_hwdevice_get_type_name(type));
|
|
||||||
fprintf(stderr, "\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* open the input file */
|
|
||||||
if (avformat_open_input(&input_ctx, argv[2], NULL, NULL) != 0) {
|
|
||||||
fprintf(stderr, "Cannot open input file '%s'\n", argv[2]);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (avformat_find_stream_info(input_ctx, NULL) < 0) {
|
|
||||||
fprintf(stderr, "Cannot find input stream information.\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* find the video stream information */
|
|
||||||
ret = av_find_best_stream(input_ctx, AVMEDIA_TYPE_VIDEO, -1, -1, &decoder, 0);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Cannot find a video stream in the input file\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
video_stream = ret;
|
|
||||||
|
|
||||||
for (i = 0;; i++) {
|
|
||||||
const AVCodecHWConfig *config = avcodec_get_hw_config(decoder, i);
|
|
||||||
if (!config) {
|
|
||||||
fprintf(stderr, "Decoder %s does not support device type %s.\n",
|
|
||||||
decoder->name, av_hwdevice_get_type_name(type));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (config->methods & AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX &&
|
|
||||||
config->device_type == type) {
|
|
||||||
hw_pix_fmt = config->pix_fmt;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(decoder_ctx = avcodec_alloc_context3(decoder)))
|
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
|
|
||||||
video = input_ctx->streams[video_stream];
|
|
||||||
if (avcodec_parameters_to_context(decoder_ctx, video->codecpar) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
decoder_ctx->get_format = get_hw_format;
|
|
||||||
|
|
||||||
if (hw_decoder_init(decoder_ctx, type) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if ((ret = avcodec_open2(decoder_ctx, decoder, NULL)) < 0) {
|
|
||||||
fprintf(stderr, "Failed to open codec for stream #%u\n", video_stream);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* open the file to dump raw data */
|
|
||||||
output_file = fopen(argv[3], "w+b");
|
|
||||||
|
|
||||||
/* actual decoding and dump the raw data */
|
|
||||||
while (ret >= 0) {
|
|
||||||
if ((ret = av_read_frame(input_ctx, &packet)) < 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (video_stream == packet.stream_index)
|
|
||||||
ret = decode_write(decoder_ctx, &packet);
|
|
||||||
|
|
||||||
av_packet_unref(&packet);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* flush the decoder */
|
|
||||||
packet.data = NULL;
|
|
||||||
packet.size = 0;
|
|
||||||
ret = decode_write(decoder_ctx, &packet);
|
|
||||||
av_packet_unref(&packet);
|
|
||||||
|
|
||||||
if (output_file)
|
|
||||||
fclose(output_file);
|
|
||||||
avcodec_free_context(&decoder_ctx);
|
|
||||||
avformat_close_input(&input_ctx);
|
|
||||||
av_buffer_unref(&hw_device_ctx);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -44,14 +44,10 @@ int main (int argc, char **argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
av_register_all();
|
||||||
if ((ret = avformat_open_input(&fmt_ctx, argv[1], NULL, NULL)))
|
if ((ret = avformat_open_input(&fmt_ctx, argv[1], NULL, NULL)))
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if ((ret = avformat_find_stream_info(fmt_ctx, NULL)) < 0) {
|
|
||||||
av_log(NULL, AV_LOG_ERROR, "Cannot find stream information\n");
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
|
while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
|
||||||
printf("%s=%s\n", tag->key, tag->value);
|
printf("%s=%s\n", tag->key, tag->value);
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include <libavutil/avassert.h>
|
|
||||||
#include <libavutil/channel_layout.h>
|
|
||||||
#include <libavutil/opt.h>
|
#include <libavutil/opt.h>
|
||||||
#include <libavutil/mathematics.h>
|
#include <libavutil/mathematics.h>
|
||||||
#include <libavutil/timestamp.h>
|
#include <libavutil/timestamp.h>
|
||||||
@@ -43,29 +41,13 @@
|
|||||||
#include <libswscale/swscale.h>
|
#include <libswscale/swscale.h>
|
||||||
#include <libswresample/swresample.h>
|
#include <libswresample/swresample.h>
|
||||||
|
|
||||||
|
static int audio_is_eof, video_is_eof;
|
||||||
|
|
||||||
#define STREAM_DURATION 10.0
|
#define STREAM_DURATION 10.0
|
||||||
#define STREAM_FRAME_RATE 25 /* 25 images/s */
|
#define STREAM_FRAME_RATE 25 /* 25 images/s */
|
||||||
#define STREAM_PIX_FMT AV_PIX_FMT_YUV420P /* default pix_fmt */
|
#define STREAM_PIX_FMT AV_PIX_FMT_YUV420P /* default pix_fmt */
|
||||||
|
|
||||||
#define SCALE_FLAGS SWS_BICUBIC
|
static int sws_flags = SWS_BICUBIC;
|
||||||
|
|
||||||
// a wrapper around a single output AVStream
|
|
||||||
typedef struct OutputStream {
|
|
||||||
AVStream *st;
|
|
||||||
AVCodecContext *enc;
|
|
||||||
|
|
||||||
/* pts of the next frame that will be generated */
|
|
||||||
int64_t next_pts;
|
|
||||||
int samples_count;
|
|
||||||
|
|
||||||
AVFrame *frame;
|
|
||||||
AVFrame *tmp_frame;
|
|
||||||
|
|
||||||
float t, tincr, tincr2;
|
|
||||||
|
|
||||||
struct SwsContext *sws_ctx;
|
|
||||||
struct SwrContext *swr_ctx;
|
|
||||||
} OutputStream;
|
|
||||||
|
|
||||||
static void log_packet(const AVFormatContext *fmt_ctx, const AVPacket *pkt)
|
static void log_packet(const AVFormatContext *fmt_ctx, const AVPacket *pkt)
|
||||||
{
|
{
|
||||||
@@ -78,54 +60,25 @@ static void log_packet(const AVFormatContext *fmt_ctx, const AVPacket *pkt)
|
|||||||
pkt->stream_index);
|
pkt->stream_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int write_frame(AVFormatContext *fmt_ctx, AVCodecContext *c,
|
static int write_frame(AVFormatContext *fmt_ctx, const AVRational *time_base, AVStream *st, AVPacket *pkt)
|
||||||
AVStream *st, AVFrame *frame)
|
|
||||||
{
|
{
|
||||||
int ret;
|
/* rescale output packet timestamp values from codec to stream timebase */
|
||||||
|
pkt->pts = av_rescale_q_rnd(pkt->pts, *time_base, st->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
|
||||||
|
pkt->dts = av_rescale_q_rnd(pkt->dts, *time_base, st->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
|
||||||
|
pkt->duration = av_rescale_q(pkt->duration, *time_base, st->time_base);
|
||||||
|
pkt->stream_index = st->index;
|
||||||
|
|
||||||
// send the frame to the encoder
|
/* Write the compressed frame to the media file. */
|
||||||
ret = avcodec_send_frame(c, frame);
|
log_packet(fmt_ctx, pkt);
|
||||||
if (ret < 0) {
|
return av_interleaved_write_frame(fmt_ctx, pkt);
|
||||||
fprintf(stderr, "Error sending a frame to the encoder: %s\n",
|
|
||||||
av_err2str(ret));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (ret >= 0) {
|
|
||||||
AVPacket pkt = { 0 };
|
|
||||||
|
|
||||||
ret = avcodec_receive_packet(c, &pkt);
|
|
||||||
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
|
|
||||||
break;
|
|
||||||
else if (ret < 0) {
|
|
||||||
fprintf(stderr, "Error encoding a frame: %s\n", av_err2str(ret));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* rescale output packet timestamp values from codec to stream timebase */
|
|
||||||
av_packet_rescale_ts(&pkt, c->time_base, st->time_base);
|
|
||||||
pkt.stream_index = st->index;
|
|
||||||
|
|
||||||
/* Write the compressed frame to the media file. */
|
|
||||||
log_packet(fmt_ctx, &pkt);
|
|
||||||
ret = av_interleaved_write_frame(fmt_ctx, &pkt);
|
|
||||||
av_packet_unref(&pkt);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Error while writing output packet: %s\n", av_err2str(ret));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret == AVERROR_EOF ? 1 : 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add an output stream. */
|
/* Add an output stream. */
|
||||||
static void add_stream(OutputStream *ost, AVFormatContext *oc,
|
static AVStream *add_stream(AVFormatContext *oc, AVCodec **codec,
|
||||||
AVCodec **codec,
|
enum AVCodecID codec_id)
|
||||||
enum AVCodecID codec_id)
|
|
||||||
{
|
{
|
||||||
AVCodecContext *c;
|
AVCodecContext *c;
|
||||||
int i;
|
AVStream *st;
|
||||||
|
|
||||||
/* find the encoder */
|
/* find the encoder */
|
||||||
*codec = avcodec_find_encoder(codec_id);
|
*codec = avcodec_find_encoder(codec_id);
|
||||||
@@ -135,18 +88,13 @@ static void add_stream(OutputStream *ost, AVFormatContext *oc,
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ost->st = avformat_new_stream(oc, NULL);
|
st = avformat_new_stream(oc, *codec);
|
||||||
if (!ost->st) {
|
if (!st) {
|
||||||
fprintf(stderr, "Could not allocate stream\n");
|
fprintf(stderr, "Could not allocate stream\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
ost->st->id = oc->nb_streams-1;
|
st->id = oc->nb_streams-1;
|
||||||
c = avcodec_alloc_context3(*codec);
|
c = st->codec;
|
||||||
if (!c) {
|
|
||||||
fprintf(stderr, "Could not alloc an encoding context\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
ost->enc = c;
|
|
||||||
|
|
||||||
switch ((*codec)->type) {
|
switch ((*codec)->type) {
|
||||||
case AVMEDIA_TYPE_AUDIO:
|
case AVMEDIA_TYPE_AUDIO:
|
||||||
@@ -154,24 +102,7 @@ static void add_stream(OutputStream *ost, AVFormatContext *oc,
|
|||||||
(*codec)->sample_fmts[0] : AV_SAMPLE_FMT_FLTP;
|
(*codec)->sample_fmts[0] : AV_SAMPLE_FMT_FLTP;
|
||||||
c->bit_rate = 64000;
|
c->bit_rate = 64000;
|
||||||
c->sample_rate = 44100;
|
c->sample_rate = 44100;
|
||||||
if ((*codec)->supported_samplerates) {
|
c->channels = 2;
|
||||||
c->sample_rate = (*codec)->supported_samplerates[0];
|
|
||||||
for (i = 0; (*codec)->supported_samplerates[i]; i++) {
|
|
||||||
if ((*codec)->supported_samplerates[i] == 44100)
|
|
||||||
c->sample_rate = 44100;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
c->channels = av_get_channel_layout_nb_channels(c->channel_layout);
|
|
||||||
c->channel_layout = AV_CH_LAYOUT_STEREO;
|
|
||||||
if ((*codec)->channel_layouts) {
|
|
||||||
c->channel_layout = (*codec)->channel_layouts[0];
|
|
||||||
for (i = 0; (*codec)->channel_layouts[i]; i++) {
|
|
||||||
if ((*codec)->channel_layouts[i] == AV_CH_LAYOUT_STEREO)
|
|
||||||
c->channel_layout = AV_CH_LAYOUT_STEREO;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
c->channels = av_get_channel_layout_nb_channels(c->channel_layout);
|
|
||||||
ost->st->time_base = (AVRational){ 1, c->sample_rate };
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AVMEDIA_TYPE_VIDEO:
|
case AVMEDIA_TYPE_VIDEO:
|
||||||
@@ -185,13 +116,12 @@ static void add_stream(OutputStream *ost, AVFormatContext *oc,
|
|||||||
* of which frame timestamps are represented. For fixed-fps content,
|
* of which frame timestamps are represented. For fixed-fps content,
|
||||||
* timebase should be 1/framerate and timestamp increments should be
|
* timebase should be 1/framerate and timestamp increments should be
|
||||||
* identical to 1. */
|
* identical to 1. */
|
||||||
ost->st->time_base = (AVRational){ 1, STREAM_FRAME_RATE };
|
c->time_base.den = STREAM_FRAME_RATE;
|
||||||
c->time_base = ost->st->time_base;
|
c->time_base.num = 1;
|
||||||
|
|
||||||
c->gop_size = 12; /* emit one intra frame every twelve frames at most */
|
c->gop_size = 12; /* emit one intra frame every twelve frames at most */
|
||||||
c->pix_fmt = STREAM_PIX_FMT;
|
c->pix_fmt = STREAM_PIX_FMT;
|
||||||
if (c->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
|
if (c->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
|
||||||
/* just for testing, we also add B-frames */
|
/* just for testing, we also add B frames */
|
||||||
c->max_b_frames = 2;
|
c->max_b_frames = 2;
|
||||||
}
|
}
|
||||||
if (c->codec_id == AV_CODEC_ID_MPEG1VIDEO) {
|
if (c->codec_id == AV_CODEC_ID_MPEG1VIDEO) {
|
||||||
@@ -200,7 +130,7 @@ static void add_stream(OutputStream *ost, AVFormatContext *oc,
|
|||||||
* the motion of the chroma plane does not match the luma plane. */
|
* the motion of the chroma plane does not match the luma plane. */
|
||||||
c->mb_decision = 2;
|
c->mb_decision = 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -208,248 +138,256 @@ static void add_stream(OutputStream *ost, AVFormatContext *oc,
|
|||||||
|
|
||||||
/* Some formats want stream headers to be separate. */
|
/* Some formats want stream headers to be separate. */
|
||||||
if (oc->oformat->flags & AVFMT_GLOBALHEADER)
|
if (oc->oformat->flags & AVFMT_GLOBALHEADER)
|
||||||
c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
|
c->flags |= CODEC_FLAG_GLOBAL_HEADER;
|
||||||
|
|
||||||
|
return st;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
/* audio output */
|
/* audio output */
|
||||||
|
|
||||||
static AVFrame *alloc_audio_frame(enum AVSampleFormat sample_fmt,
|
static float t, tincr, tincr2;
|
||||||
uint64_t channel_layout,
|
|
||||||
int sample_rate, int nb_samples)
|
AVFrame *audio_frame;
|
||||||
|
static uint8_t **src_samples_data;
|
||||||
|
static int src_samples_linesize;
|
||||||
|
static int src_nb_samples;
|
||||||
|
|
||||||
|
static int max_dst_nb_samples;
|
||||||
|
uint8_t **dst_samples_data;
|
||||||
|
int dst_samples_linesize;
|
||||||
|
int dst_samples_size;
|
||||||
|
int samples_count;
|
||||||
|
|
||||||
|
struct SwrContext *swr_ctx = NULL;
|
||||||
|
|
||||||
|
static void open_audio(AVFormatContext *oc, AVCodec *codec, AVStream *st)
|
||||||
{
|
{
|
||||||
AVFrame *frame = av_frame_alloc();
|
AVCodecContext *c;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!frame) {
|
c = st->codec;
|
||||||
fprintf(stderr, "Error allocating an audio frame\n");
|
|
||||||
|
/* allocate and init a re-usable frame */
|
||||||
|
audio_frame = av_frame_alloc();
|
||||||
|
if (!audio_frame) {
|
||||||
|
fprintf(stderr, "Could not allocate audio frame\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
frame->format = sample_fmt;
|
|
||||||
frame->channel_layout = channel_layout;
|
|
||||||
frame->sample_rate = sample_rate;
|
|
||||||
frame->nb_samples = nb_samples;
|
|
||||||
|
|
||||||
if (nb_samples) {
|
|
||||||
ret = av_frame_get_buffer(frame, 0);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Error allocating an audio buffer\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return frame;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void open_audio(AVFormatContext *oc, AVCodec *codec, OutputStream *ost, AVDictionary *opt_arg)
|
|
||||||
{
|
|
||||||
AVCodecContext *c;
|
|
||||||
int nb_samples;
|
|
||||||
int ret;
|
|
||||||
AVDictionary *opt = NULL;
|
|
||||||
|
|
||||||
c = ost->enc;
|
|
||||||
|
|
||||||
/* open it */
|
/* open it */
|
||||||
av_dict_copy(&opt, opt_arg, 0);
|
ret = avcodec_open2(c, codec, NULL);
|
||||||
ret = avcodec_open2(c, codec, &opt);
|
|
||||||
av_dict_free(&opt);
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "Could not open audio codec: %s\n", av_err2str(ret));
|
fprintf(stderr, "Could not open audio codec: %s\n", av_err2str(ret));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* init signal generator */
|
/* init signal generator */
|
||||||
ost->t = 0;
|
t = 0;
|
||||||
ost->tincr = 2 * M_PI * 110.0 / c->sample_rate;
|
tincr = 2 * M_PI * 110.0 / c->sample_rate;
|
||||||
/* increment frequency by 110 Hz per second */
|
/* increment frequency by 110 Hz per second */
|
||||||
ost->tincr2 = 2 * M_PI * 110.0 / c->sample_rate / c->sample_rate;
|
tincr2 = 2 * M_PI * 110.0 / c->sample_rate / c->sample_rate;
|
||||||
|
|
||||||
if (c->codec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE)
|
src_nb_samples = c->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE ?
|
||||||
nb_samples = 10000;
|
10000 : c->frame_size;
|
||||||
else
|
|
||||||
nb_samples = c->frame_size;
|
|
||||||
|
|
||||||
ost->frame = alloc_audio_frame(c->sample_fmt, c->channel_layout,
|
ret = av_samples_alloc_array_and_samples(&src_samples_data, &src_samples_linesize, c->channels,
|
||||||
c->sample_rate, nb_samples);
|
src_nb_samples, AV_SAMPLE_FMT_S16, 0);
|
||||||
ost->tmp_frame = alloc_audio_frame(AV_SAMPLE_FMT_S16, c->channel_layout,
|
|
||||||
c->sample_rate, nb_samples);
|
|
||||||
|
|
||||||
/* copy the stream parameters to the muxer */
|
|
||||||
ret = avcodec_parameters_from_context(ost->st->codecpar, c);
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "Could not copy the stream parameters\n");
|
fprintf(stderr, "Could not allocate source samples\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* compute the number of converted samples: buffering is avoided
|
||||||
|
* ensuring that the output buffer will contain at least all the
|
||||||
|
* converted input samples */
|
||||||
|
max_dst_nb_samples = src_nb_samples;
|
||||||
|
|
||||||
/* create resampler context */
|
/* create resampler context */
|
||||||
ost->swr_ctx = swr_alloc();
|
if (c->sample_fmt != AV_SAMPLE_FMT_S16) {
|
||||||
if (!ost->swr_ctx) {
|
swr_ctx = swr_alloc();
|
||||||
fprintf(stderr, "Could not allocate resampler context\n");
|
if (!swr_ctx) {
|
||||||
exit(1);
|
fprintf(stderr, "Could not allocate resampler context\n");
|
||||||
}
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
/* set options */
|
/* set options */
|
||||||
av_opt_set_int (ost->swr_ctx, "in_channel_count", c->channels, 0);
|
av_opt_set_int (swr_ctx, "in_channel_count", c->channels, 0);
|
||||||
av_opt_set_int (ost->swr_ctx, "in_sample_rate", c->sample_rate, 0);
|
av_opt_set_int (swr_ctx, "in_sample_rate", c->sample_rate, 0);
|
||||||
av_opt_set_sample_fmt(ost->swr_ctx, "in_sample_fmt", AV_SAMPLE_FMT_S16, 0);
|
av_opt_set_sample_fmt(swr_ctx, "in_sample_fmt", AV_SAMPLE_FMT_S16, 0);
|
||||||
av_opt_set_int (ost->swr_ctx, "out_channel_count", c->channels, 0);
|
av_opt_set_int (swr_ctx, "out_channel_count", c->channels, 0);
|
||||||
av_opt_set_int (ost->swr_ctx, "out_sample_rate", c->sample_rate, 0);
|
av_opt_set_int (swr_ctx, "out_sample_rate", c->sample_rate, 0);
|
||||||
av_opt_set_sample_fmt(ost->swr_ctx, "out_sample_fmt", c->sample_fmt, 0);
|
av_opt_set_sample_fmt(swr_ctx, "out_sample_fmt", c->sample_fmt, 0);
|
||||||
|
|
||||||
/* initialize the resampling context */
|
/* initialize the resampling context */
|
||||||
if ((ret = swr_init(ost->swr_ctx)) < 0) {
|
if ((ret = swr_init(swr_ctx)) < 0) {
|
||||||
fprintf(stderr, "Failed to initialize the resampling context\n");
|
fprintf(stderr, "Failed to initialize the resampling context\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = av_samples_alloc_array_and_samples(&dst_samples_data, &dst_samples_linesize, c->channels,
|
||||||
|
max_dst_nb_samples, c->sample_fmt, 0);
|
||||||
|
if (ret < 0) {
|
||||||
|
fprintf(stderr, "Could not allocate destination samples\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dst_samples_data = src_samples_data;
|
||||||
}
|
}
|
||||||
|
dst_samples_size = av_samples_get_buffer_size(NULL, c->channels, max_dst_nb_samples,
|
||||||
|
c->sample_fmt, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Prepare a 16 bit dummy audio frame of 'frame_size' samples and
|
/* Prepare a 16 bit dummy audio frame of 'frame_size' samples and
|
||||||
* 'nb_channels' channels. */
|
* 'nb_channels' channels. */
|
||||||
static AVFrame *get_audio_frame(OutputStream *ost)
|
static void get_audio_frame(int16_t *samples, int frame_size, int nb_channels)
|
||||||
{
|
{
|
||||||
AVFrame *frame = ost->tmp_frame;
|
|
||||||
int j, i, v;
|
int j, i, v;
|
||||||
int16_t *q = (int16_t*)frame->data[0];
|
int16_t *q;
|
||||||
|
|
||||||
/* check if we want to generate more frames */
|
q = samples;
|
||||||
if (av_compare_ts(ost->next_pts, ost->enc->time_base,
|
for (j = 0; j < frame_size; j++) {
|
||||||
STREAM_DURATION, (AVRational){ 1, 1 }) > 0)
|
v = (int)(sin(t) * 10000);
|
||||||
return NULL;
|
for (i = 0; i < nb_channels; i++)
|
||||||
|
|
||||||
for (j = 0; j <frame->nb_samples; j++) {
|
|
||||||
v = (int)(sin(ost->t) * 10000);
|
|
||||||
for (i = 0; i < ost->enc->channels; i++)
|
|
||||||
*q++ = v;
|
*q++ = v;
|
||||||
ost->t += ost->tincr;
|
t += tincr;
|
||||||
ost->tincr += ost->tincr2;
|
tincr += tincr2;
|
||||||
}
|
}
|
||||||
|
|
||||||
frame->pts = ost->next_pts;
|
|
||||||
ost->next_pts += frame->nb_samples;
|
|
||||||
|
|
||||||
return frame;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
static void write_audio_frame(AVFormatContext *oc, AVStream *st, int flush)
|
||||||
* encode one audio frame and send it to the muxer
|
|
||||||
* return 1 when encoding is finished, 0 otherwise
|
|
||||||
*/
|
|
||||||
static int write_audio_frame(AVFormatContext *oc, OutputStream *ost)
|
|
||||||
{
|
{
|
||||||
AVCodecContext *c;
|
AVCodecContext *c;
|
||||||
AVFrame *frame;
|
AVPacket pkt = { 0 }; // data and size must be 0;
|
||||||
int ret;
|
int got_packet, ret, dst_nb_samples;
|
||||||
int dst_nb_samples;
|
|
||||||
|
|
||||||
c = ost->enc;
|
av_init_packet(&pkt);
|
||||||
|
c = st->codec;
|
||||||
|
|
||||||
frame = get_audio_frame(ost);
|
if (!flush) {
|
||||||
|
get_audio_frame((int16_t *)src_samples_data[0], src_nb_samples, c->channels);
|
||||||
|
|
||||||
if (frame) {
|
|
||||||
/* convert samples from native format to destination codec format, using the resampler */
|
/* convert samples from native format to destination codec format, using the resampler */
|
||||||
/* compute destination number of samples */
|
if (swr_ctx) {
|
||||||
dst_nb_samples = av_rescale_rnd(swr_get_delay(ost->swr_ctx, c->sample_rate) + frame->nb_samples,
|
/* compute destination number of samples */
|
||||||
c->sample_rate, c->sample_rate, AV_ROUND_UP);
|
dst_nb_samples = av_rescale_rnd(swr_get_delay(swr_ctx, c->sample_rate) + src_nb_samples,
|
||||||
av_assert0(dst_nb_samples == frame->nb_samples);
|
c->sample_rate, c->sample_rate, AV_ROUND_UP);
|
||||||
|
if (dst_nb_samples > max_dst_nb_samples) {
|
||||||
|
av_free(dst_samples_data[0]);
|
||||||
|
ret = av_samples_alloc(dst_samples_data, &dst_samples_linesize, c->channels,
|
||||||
|
dst_nb_samples, c->sample_fmt, 0);
|
||||||
|
if (ret < 0)
|
||||||
|
exit(1);
|
||||||
|
max_dst_nb_samples = dst_nb_samples;
|
||||||
|
dst_samples_size = av_samples_get_buffer_size(NULL, c->channels, dst_nb_samples,
|
||||||
|
c->sample_fmt, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/* when we pass a frame to the encoder, it may keep a reference to it
|
/* convert to destination format */
|
||||||
* internally;
|
ret = swr_convert(swr_ctx,
|
||||||
* make sure we do not overwrite it here
|
dst_samples_data, dst_nb_samples,
|
||||||
*/
|
(const uint8_t **)src_samples_data, src_nb_samples);
|
||||||
ret = av_frame_make_writable(ost->frame);
|
if (ret < 0) {
|
||||||
if (ret < 0)
|
fprintf(stderr, "Error while converting\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
}
|
||||||
/* convert to destination format */
|
} else {
|
||||||
ret = swr_convert(ost->swr_ctx,
|
dst_nb_samples = src_nb_samples;
|
||||||
ost->frame->data, dst_nb_samples,
|
|
||||||
(const uint8_t **)frame->data, frame->nb_samples);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Error while converting\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
frame = ost->frame;
|
|
||||||
|
|
||||||
frame->pts = av_rescale_q(ost->samples_count, (AVRational){1, c->sample_rate}, c->time_base);
|
audio_frame->nb_samples = dst_nb_samples;
|
||||||
ost->samples_count += dst_nb_samples;
|
audio_frame->pts = av_rescale_q(samples_count, (AVRational){1, c->sample_rate}, c->time_base);
|
||||||
|
avcodec_fill_audio_frame(audio_frame, c->channels, c->sample_fmt,
|
||||||
|
dst_samples_data[0], dst_samples_size, 0);
|
||||||
|
samples_count += dst_nb_samples;
|
||||||
}
|
}
|
||||||
|
|
||||||
return write_frame(oc, c, ost->st, frame);
|
ret = avcodec_encode_audio2(c, &pkt, flush ? NULL : audio_frame, &got_packet);
|
||||||
|
if (ret < 0) {
|
||||||
|
fprintf(stderr, "Error encoding audio frame: %s\n", av_err2str(ret));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!got_packet) {
|
||||||
|
if (flush)
|
||||||
|
audio_is_eof = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = write_frame(oc, &c->time_base, st, &pkt);
|
||||||
|
if (ret < 0) {
|
||||||
|
fprintf(stderr, "Error while writing audio frame: %s\n",
|
||||||
|
av_err2str(ret));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void close_audio(AVFormatContext *oc, AVStream *st)
|
||||||
|
{
|
||||||
|
avcodec_close(st->codec);
|
||||||
|
if (dst_samples_data != src_samples_data) {
|
||||||
|
av_free(dst_samples_data[0]);
|
||||||
|
av_free(dst_samples_data);
|
||||||
|
}
|
||||||
|
av_free(src_samples_data[0]);
|
||||||
|
av_free(src_samples_data);
|
||||||
|
av_frame_free(&audio_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
/* video output */
|
/* video output */
|
||||||
|
|
||||||
static AVFrame *alloc_picture(enum AVPixelFormat pix_fmt, int width, int height)
|
static AVFrame *frame;
|
||||||
{
|
static AVPicture src_picture, dst_picture;
|
||||||
AVFrame *picture;
|
static int frame_count;
|
||||||
int ret;
|
|
||||||
|
|
||||||
picture = av_frame_alloc();
|
static void open_video(AVFormatContext *oc, AVCodec *codec, AVStream *st)
|
||||||
if (!picture)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
picture->format = pix_fmt;
|
|
||||||
picture->width = width;
|
|
||||||
picture->height = height;
|
|
||||||
|
|
||||||
/* allocate the buffers for the frame data */
|
|
||||||
ret = av_frame_get_buffer(picture, 0);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Could not allocate frame data.\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return picture;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void open_video(AVFormatContext *oc, AVCodec *codec, OutputStream *ost, AVDictionary *opt_arg)
|
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
AVCodecContext *c = ost->enc;
|
AVCodecContext *c = st->codec;
|
||||||
AVDictionary *opt = NULL;
|
|
||||||
|
|
||||||
av_dict_copy(&opt, opt_arg, 0);
|
|
||||||
|
|
||||||
/* open the codec */
|
/* open the codec */
|
||||||
ret = avcodec_open2(c, codec, &opt);
|
ret = avcodec_open2(c, codec, NULL);
|
||||||
av_dict_free(&opt);
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "Could not open video codec: %s\n", av_err2str(ret));
|
fprintf(stderr, "Could not open video codec: %s\n", av_err2str(ret));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* allocate and init a re-usable frame */
|
/* allocate and init a re-usable frame */
|
||||||
ost->frame = alloc_picture(c->pix_fmt, c->width, c->height);
|
frame = av_frame_alloc();
|
||||||
if (!ost->frame) {
|
if (!frame) {
|
||||||
fprintf(stderr, "Could not allocate video frame\n");
|
fprintf(stderr, "Could not allocate video frame\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
frame->format = c->pix_fmt;
|
||||||
|
frame->width = c->width;
|
||||||
|
frame->height = c->height;
|
||||||
|
|
||||||
|
/* Allocate the encoded raw picture. */
|
||||||
|
ret = avpicture_alloc(&dst_picture, c->pix_fmt, c->width, c->height);
|
||||||
|
if (ret < 0) {
|
||||||
|
fprintf(stderr, "Could not allocate picture: %s\n", av_err2str(ret));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
/* If the output format is not YUV420P, then a temporary YUV420P
|
/* If the output format is not YUV420P, then a temporary YUV420P
|
||||||
* picture is needed too. It is then converted to the required
|
* picture is needed too. It is then converted to the required
|
||||||
* output format. */
|
* output format. */
|
||||||
ost->tmp_frame = NULL;
|
|
||||||
if (c->pix_fmt != AV_PIX_FMT_YUV420P) {
|
if (c->pix_fmt != AV_PIX_FMT_YUV420P) {
|
||||||
ost->tmp_frame = alloc_picture(AV_PIX_FMT_YUV420P, c->width, c->height);
|
ret = avpicture_alloc(&src_picture, AV_PIX_FMT_YUV420P, c->width, c->height);
|
||||||
if (!ost->tmp_frame) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "Could not allocate temporary picture\n");
|
fprintf(stderr, "Could not allocate temporary picture: %s\n",
|
||||||
|
av_err2str(ret));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy the stream parameters to the muxer */
|
/* copy data and linesize picture pointers to frame */
|
||||||
ret = avcodec_parameters_from_context(ost->st->codecpar, c);
|
*((AVPicture *)frame) = dst_picture;
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Could not copy the stream parameters\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Prepare a dummy image. */
|
/* Prepare a dummy image. */
|
||||||
static void fill_yuv_image(AVFrame *pict, int frame_index,
|
static void fill_yuv_image(AVPicture *pict, int frame_index,
|
||||||
int width, int height)
|
int width, int height)
|
||||||
{
|
{
|
||||||
int x, y, i;
|
int x, y, i;
|
||||||
@@ -470,64 +408,82 @@ static void fill_yuv_image(AVFrame *pict, int frame_index,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static AVFrame *get_video_frame(OutputStream *ost)
|
static void write_video_frame(AVFormatContext *oc, AVStream *st, int flush)
|
||||||
{
|
{
|
||||||
AVCodecContext *c = ost->enc;
|
int ret;
|
||||||
|
static struct SwsContext *sws_ctx;
|
||||||
|
AVCodecContext *c = st->codec;
|
||||||
|
|
||||||
/* check if we want to generate more frames */
|
if (!flush) {
|
||||||
if (av_compare_ts(ost->next_pts, c->time_base,
|
if (c->pix_fmt != AV_PIX_FMT_YUV420P) {
|
||||||
STREAM_DURATION, (AVRational){ 1, 1 }) > 0)
|
/* as we only generate a YUV420P picture, we must convert it
|
||||||
return NULL;
|
* to the codec pixel format if needed */
|
||||||
|
if (!sws_ctx) {
|
||||||
/* when we pass a frame to the encoder, it may keep a reference to it
|
sws_ctx = sws_getContext(c->width, c->height, AV_PIX_FMT_YUV420P,
|
||||||
* internally; make sure we do not overwrite it here */
|
c->width, c->height, c->pix_fmt,
|
||||||
if (av_frame_make_writable(ost->frame) < 0)
|
sws_flags, NULL, NULL, NULL);
|
||||||
exit(1);
|
if (!sws_ctx) {
|
||||||
|
fprintf(stderr,
|
||||||
if (c->pix_fmt != AV_PIX_FMT_YUV420P) {
|
"Could not initialize the conversion context\n");
|
||||||
/* as we only generate a YUV420P picture, we must convert it
|
exit(1);
|
||||||
* to the codec pixel format if needed */
|
}
|
||||||
if (!ost->sws_ctx) {
|
|
||||||
ost->sws_ctx = sws_getContext(c->width, c->height,
|
|
||||||
AV_PIX_FMT_YUV420P,
|
|
||||||
c->width, c->height,
|
|
||||||
c->pix_fmt,
|
|
||||||
SCALE_FLAGS, NULL, NULL, NULL);
|
|
||||||
if (!ost->sws_ctx) {
|
|
||||||
fprintf(stderr,
|
|
||||||
"Could not initialize the conversion context\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
|
fill_yuv_image(&src_picture, frame_count, c->width, c->height);
|
||||||
|
sws_scale(sws_ctx,
|
||||||
|
(const uint8_t * const *)src_picture.data, src_picture.linesize,
|
||||||
|
0, c->height, dst_picture.data, dst_picture.linesize);
|
||||||
|
} else {
|
||||||
|
fill_yuv_image(&dst_picture, frame_count, c->width, c->height);
|
||||||
}
|
}
|
||||||
fill_yuv_image(ost->tmp_frame, ost->next_pts, c->width, c->height);
|
|
||||||
sws_scale(ost->sws_ctx, (const uint8_t * const *) ost->tmp_frame->data,
|
|
||||||
ost->tmp_frame->linesize, 0, c->height, ost->frame->data,
|
|
||||||
ost->frame->linesize);
|
|
||||||
} else {
|
|
||||||
fill_yuv_image(ost->frame, ost->next_pts, c->width, c->height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ost->frame->pts = ost->next_pts++;
|
if (oc->oformat->flags & AVFMT_RAWPICTURE && !flush) {
|
||||||
|
/* Raw video case - directly store the picture in the packet */
|
||||||
|
AVPacket pkt;
|
||||||
|
av_init_packet(&pkt);
|
||||||
|
|
||||||
return ost->frame;
|
pkt.flags |= AV_PKT_FLAG_KEY;
|
||||||
|
pkt.stream_index = st->index;
|
||||||
|
pkt.data = dst_picture.data[0];
|
||||||
|
pkt.size = sizeof(AVPicture);
|
||||||
|
|
||||||
|
ret = av_interleaved_write_frame(oc, &pkt);
|
||||||
|
} else {
|
||||||
|
AVPacket pkt = { 0 };
|
||||||
|
int got_packet;
|
||||||
|
av_init_packet(&pkt);
|
||||||
|
|
||||||
|
/* encode the image */
|
||||||
|
frame->pts = frame_count;
|
||||||
|
ret = avcodec_encode_video2(c, &pkt, flush ? NULL : frame, &got_packet);
|
||||||
|
if (ret < 0) {
|
||||||
|
fprintf(stderr, "Error encoding video frame: %s\n", av_err2str(ret));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
/* If size is zero, it means the image was buffered. */
|
||||||
|
|
||||||
|
if (got_packet) {
|
||||||
|
ret = write_frame(oc, &c->time_base, st, &pkt);
|
||||||
|
} else {
|
||||||
|
if (flush)
|
||||||
|
video_is_eof = 1;
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret < 0) {
|
||||||
|
fprintf(stderr, "Error while writing video frame: %s\n", av_err2str(ret));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
frame_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
static void close_video(AVFormatContext *oc, AVStream *st)
|
||||||
* encode one video frame and send it to the muxer
|
|
||||||
* return 1 when encoding is finished, 0 otherwise
|
|
||||||
*/
|
|
||||||
static int write_video_frame(AVFormatContext *oc, OutputStream *ost)
|
|
||||||
{
|
{
|
||||||
return write_frame(oc, ost->enc, ost->st, get_video_frame(ost));
|
avcodec_close(st->codec);
|
||||||
}
|
av_free(src_picture.data[0]);
|
||||||
|
av_free(dst_picture.data[0]);
|
||||||
static void close_stream(AVFormatContext *oc, OutputStream *ost)
|
av_frame_free(&frame);
|
||||||
{
|
|
||||||
avcodec_free_context(&ost->enc);
|
|
||||||
av_frame_free(&ost->frame);
|
|
||||||
av_frame_free(&ost->tmp_frame);
|
|
||||||
sws_freeContext(ost->sws_ctx);
|
|
||||||
swr_free(&ost->swr_ctx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
@@ -535,18 +491,18 @@ static void close_stream(AVFormatContext *oc, OutputStream *ost)
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
OutputStream video_st = { 0 }, audio_st = { 0 };
|
|
||||||
const char *filename;
|
const char *filename;
|
||||||
AVOutputFormat *fmt;
|
AVOutputFormat *fmt;
|
||||||
AVFormatContext *oc;
|
AVFormatContext *oc;
|
||||||
|
AVStream *audio_st, *video_st;
|
||||||
AVCodec *audio_codec, *video_codec;
|
AVCodec *audio_codec, *video_codec;
|
||||||
int ret;
|
double audio_time, video_time;
|
||||||
int have_video = 0, have_audio = 0;
|
int flush, ret;
|
||||||
int encode_video = 0, encode_audio = 0;
|
|
||||||
AVDictionary *opt = NULL;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (argc < 2) {
|
/* Initialize libavcodec, and register all codecs and formats. */
|
||||||
|
av_register_all();
|
||||||
|
|
||||||
|
if (argc != 2) {
|
||||||
printf("usage: %s output_file\n"
|
printf("usage: %s output_file\n"
|
||||||
"API example program to output a media file with libavformat.\n"
|
"API example program to output a media file with libavformat.\n"
|
||||||
"This program generates a synthetic audio and video stream, encodes and\n"
|
"This program generates a synthetic audio and video stream, encodes and\n"
|
||||||
@@ -558,10 +514,6 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
filename = argv[1];
|
filename = argv[1];
|
||||||
for (i = 2; i+1 < argc; i+=2) {
|
|
||||||
if (!strcmp(argv[i], "-flags") || !strcmp(argv[i], "-fflags"))
|
|
||||||
av_dict_set(&opt, argv[i]+1, argv[i+1], 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* allocate the output media context */
|
/* allocate the output media context */
|
||||||
avformat_alloc_output_context2(&oc, NULL, NULL, filename);
|
avformat_alloc_output_context2(&oc, NULL, NULL, filename);
|
||||||
@@ -576,24 +528,20 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
/* Add the audio and video streams using the default format codecs
|
/* Add the audio and video streams using the default format codecs
|
||||||
* and initialize the codecs. */
|
* and initialize the codecs. */
|
||||||
if (fmt->video_codec != AV_CODEC_ID_NONE) {
|
video_st = NULL;
|
||||||
add_stream(&video_st, oc, &video_codec, fmt->video_codec);
|
audio_st = NULL;
|
||||||
have_video = 1;
|
|
||||||
encode_video = 1;
|
if (fmt->video_codec != AV_CODEC_ID_NONE)
|
||||||
}
|
video_st = add_stream(oc, &video_codec, fmt->video_codec);
|
||||||
if (fmt->audio_codec != AV_CODEC_ID_NONE) {
|
if (fmt->audio_codec != AV_CODEC_ID_NONE)
|
||||||
add_stream(&audio_st, oc, &audio_codec, fmt->audio_codec);
|
audio_st = add_stream(oc, &audio_codec, fmt->audio_codec);
|
||||||
have_audio = 1;
|
|
||||||
encode_audio = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Now that all the parameters are set, we can open the audio and
|
/* Now that all the parameters are set, we can open the audio and
|
||||||
* video codecs and allocate the necessary encode buffers. */
|
* video codecs and allocate the necessary encode buffers. */
|
||||||
if (have_video)
|
if (video_st)
|
||||||
open_video(oc, video_codec, &video_st, opt);
|
open_video(oc, video_codec, video_st);
|
||||||
|
if (audio_st)
|
||||||
if (have_audio)
|
open_audio(oc, audio_codec, audio_st);
|
||||||
open_audio(oc, audio_codec, &audio_st, opt);
|
|
||||||
|
|
||||||
av_dump_format(oc, 0, filename, 1);
|
av_dump_format(oc, 0, filename, 1);
|
||||||
|
|
||||||
@@ -608,21 +556,30 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Write the stream header, if any. */
|
/* Write the stream header, if any. */
|
||||||
ret = avformat_write_header(oc, &opt);
|
ret = avformat_write_header(oc, NULL);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "Error occurred when opening output file: %s\n",
|
fprintf(stderr, "Error occurred when opening output file: %s\n",
|
||||||
av_err2str(ret));
|
av_err2str(ret));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (encode_video || encode_audio) {
|
flush = 0;
|
||||||
/* select the stream to encode */
|
while ((video_st && !video_is_eof) || (audio_st && !audio_is_eof)) {
|
||||||
if (encode_video &&
|
/* Compute current audio and video time. */
|
||||||
(!encode_audio || av_compare_ts(video_st.next_pts, video_st.enc->time_base,
|
audio_time = (audio_st && !audio_is_eof) ? audio_st->pts.val * av_q2d(audio_st->time_base) : INFINITY;
|
||||||
audio_st.next_pts, audio_st.enc->time_base) <= 0)) {
|
video_time = (video_st && !video_is_eof) ? video_st->pts.val * av_q2d(video_st->time_base) : INFINITY;
|
||||||
encode_video = !write_video_frame(oc, &video_st);
|
|
||||||
} else {
|
if (!flush &&
|
||||||
encode_audio = !write_audio_frame(oc, &audio_st);
|
(!audio_st || audio_time >= STREAM_DURATION) &&
|
||||||
|
(!video_st || video_time >= STREAM_DURATION)) {
|
||||||
|
flush = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* write interleaved audio and video frames */
|
||||||
|
if (audio_st && !audio_is_eof && audio_time <= video_time) {
|
||||||
|
write_audio_frame(oc, audio_st, flush);
|
||||||
|
} else if (video_st && !video_is_eof && video_time < audio_time) {
|
||||||
|
write_video_frame(oc, video_st, flush);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -633,14 +590,14 @@ int main(int argc, char **argv)
|
|||||||
av_write_trailer(oc);
|
av_write_trailer(oc);
|
||||||
|
|
||||||
/* Close each codec. */
|
/* Close each codec. */
|
||||||
if (have_video)
|
if (video_st)
|
||||||
close_stream(oc, &video_st);
|
close_video(oc, video_st);
|
||||||
if (have_audio)
|
if (audio_st)
|
||||||
close_stream(oc, &audio_st);
|
close_audio(oc, audio_st);
|
||||||
|
|
||||||
if (!(fmt->flags & AVFMT_NOFILE))
|
if (!(fmt->flags & AVFMT_NOFILE))
|
||||||
/* Close the output file. */
|
/* Close the output file. */
|
||||||
avio_closep(&oc->pb);
|
avio_close(oc->pb);
|
||||||
|
|
||||||
/* free the stream */
|
/* free the stream */
|
||||||
avformat_free_context(oc);
|
avformat_free_context(oc);
|
||||||
|
|||||||
@@ -1,271 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 Anton Khirnov
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file
|
|
||||||
* Intel QSV-accelerated H.264 decoding example.
|
|
||||||
*
|
|
||||||
* @example qsvdec.c
|
|
||||||
* This example shows how to do QSV-accelerated H.264 decoding with output
|
|
||||||
* frames in the GPU video surfaces.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "libavformat/avformat.h"
|
|
||||||
#include "libavformat/avio.h"
|
|
||||||
|
|
||||||
#include "libavcodec/avcodec.h"
|
|
||||||
|
|
||||||
#include "libavutil/buffer.h"
|
|
||||||
#include "libavutil/error.h"
|
|
||||||
#include "libavutil/hwcontext.h"
|
|
||||||
#include "libavutil/hwcontext_qsv.h"
|
|
||||||
#include "libavutil/mem.h"
|
|
||||||
|
|
||||||
typedef struct DecodeContext {
|
|
||||||
AVBufferRef *hw_device_ref;
|
|
||||||
} DecodeContext;
|
|
||||||
|
|
||||||
static int get_format(AVCodecContext *avctx, const enum AVPixelFormat *pix_fmts)
|
|
||||||
{
|
|
||||||
while (*pix_fmts != AV_PIX_FMT_NONE) {
|
|
||||||
if (*pix_fmts == AV_PIX_FMT_QSV) {
|
|
||||||
DecodeContext *decode = avctx->opaque;
|
|
||||||
AVHWFramesContext *frames_ctx;
|
|
||||||
AVQSVFramesContext *frames_hwctx;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* create a pool of surfaces to be used by the decoder */
|
|
||||||
avctx->hw_frames_ctx = av_hwframe_ctx_alloc(decode->hw_device_ref);
|
|
||||||
if (!avctx->hw_frames_ctx)
|
|
||||||
return AV_PIX_FMT_NONE;
|
|
||||||
frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;
|
|
||||||
frames_hwctx = frames_ctx->hwctx;
|
|
||||||
|
|
||||||
frames_ctx->format = AV_PIX_FMT_QSV;
|
|
||||||
frames_ctx->sw_format = avctx->sw_pix_fmt;
|
|
||||||
frames_ctx->width = FFALIGN(avctx->coded_width, 32);
|
|
||||||
frames_ctx->height = FFALIGN(avctx->coded_height, 32);
|
|
||||||
frames_ctx->initial_pool_size = 32;
|
|
||||||
|
|
||||||
frames_hwctx->frame_type = MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET;
|
|
||||||
|
|
||||||
ret = av_hwframe_ctx_init(avctx->hw_frames_ctx);
|
|
||||||
if (ret < 0)
|
|
||||||
return AV_PIX_FMT_NONE;
|
|
||||||
|
|
||||||
return AV_PIX_FMT_QSV;
|
|
||||||
}
|
|
||||||
|
|
||||||
pix_fmts++;
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(stderr, "The QSV pixel format not offered in get_format()\n");
|
|
||||||
|
|
||||||
return AV_PIX_FMT_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int decode_packet(DecodeContext *decode, AVCodecContext *decoder_ctx,
|
|
||||||
AVFrame *frame, AVFrame *sw_frame,
|
|
||||||
AVPacket *pkt, AVIOContext *output_ctx)
|
|
||||||
{
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
ret = avcodec_send_packet(decoder_ctx, pkt);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Error during decoding\n");
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (ret >= 0) {
|
|
||||||
int i, j;
|
|
||||||
|
|
||||||
ret = avcodec_receive_frame(decoder_ctx, frame);
|
|
||||||
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
|
|
||||||
break;
|
|
||||||
else if (ret < 0) {
|
|
||||||
fprintf(stderr, "Error during decoding\n");
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* A real program would do something useful with the decoded frame here.
|
|
||||||
* We just retrieve the raw data and write it to a file, which is rather
|
|
||||||
* useless but pedagogic. */
|
|
||||||
ret = av_hwframe_transfer_data(sw_frame, frame, 0);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Error transferring the data to system memory\n");
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < FF_ARRAY_ELEMS(sw_frame->data) && sw_frame->data[i]; i++)
|
|
||||||
for (j = 0; j < (sw_frame->height >> (i > 0)); j++)
|
|
||||||
avio_write(output_ctx, sw_frame->data[i] + j * sw_frame->linesize[i], sw_frame->width);
|
|
||||||
|
|
||||||
fail:
|
|
||||||
av_frame_unref(sw_frame);
|
|
||||||
av_frame_unref(frame);
|
|
||||||
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
AVFormatContext *input_ctx = NULL;
|
|
||||||
AVStream *video_st = NULL;
|
|
||||||
AVCodecContext *decoder_ctx = NULL;
|
|
||||||
const AVCodec *decoder;
|
|
||||||
|
|
||||||
AVPacket pkt = { 0 };
|
|
||||||
AVFrame *frame = NULL, *sw_frame = NULL;
|
|
||||||
|
|
||||||
DecodeContext decode = { NULL };
|
|
||||||
|
|
||||||
AVIOContext *output_ctx = NULL;
|
|
||||||
|
|
||||||
int ret, i;
|
|
||||||
|
|
||||||
if (argc < 3) {
|
|
||||||
fprintf(stderr, "Usage: %s <input file> <output file>\n", argv[0]);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* open the input file */
|
|
||||||
ret = avformat_open_input(&input_ctx, argv[1], NULL, NULL);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Cannot open input file '%s': ", argv[1]);
|
|
||||||
goto finish;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* find the first H.264 video stream */
|
|
||||||
for (i = 0; i < input_ctx->nb_streams; i++) {
|
|
||||||
AVStream *st = input_ctx->streams[i];
|
|
||||||
|
|
||||||
if (st->codecpar->codec_id == AV_CODEC_ID_H264 && !video_st)
|
|
||||||
video_st = st;
|
|
||||||
else
|
|
||||||
st->discard = AVDISCARD_ALL;
|
|
||||||
}
|
|
||||||
if (!video_st) {
|
|
||||||
fprintf(stderr, "No H.264 video stream in the input file\n");
|
|
||||||
goto finish;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* open the hardware device */
|
|
||||||
ret = av_hwdevice_ctx_create(&decode.hw_device_ref, AV_HWDEVICE_TYPE_QSV,
|
|
||||||
"auto", NULL, 0);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Cannot open the hardware device\n");
|
|
||||||
goto finish;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* initialize the decoder */
|
|
||||||
decoder = avcodec_find_decoder_by_name("h264_qsv");
|
|
||||||
if (!decoder) {
|
|
||||||
fprintf(stderr, "The QSV decoder is not present in libavcodec\n");
|
|
||||||
goto finish;
|
|
||||||
}
|
|
||||||
|
|
||||||
decoder_ctx = avcodec_alloc_context3(decoder);
|
|
||||||
if (!decoder_ctx) {
|
|
||||||
ret = AVERROR(ENOMEM);
|
|
||||||
goto finish;
|
|
||||||
}
|
|
||||||
decoder_ctx->codec_id = AV_CODEC_ID_H264;
|
|
||||||
if (video_st->codecpar->extradata_size) {
|
|
||||||
decoder_ctx->extradata = av_mallocz(video_st->codecpar->extradata_size +
|
|
||||||
AV_INPUT_BUFFER_PADDING_SIZE);
|
|
||||||
if (!decoder_ctx->extradata) {
|
|
||||||
ret = AVERROR(ENOMEM);
|
|
||||||
goto finish;
|
|
||||||
}
|
|
||||||
memcpy(decoder_ctx->extradata, video_st->codecpar->extradata,
|
|
||||||
video_st->codecpar->extradata_size);
|
|
||||||
decoder_ctx->extradata_size = video_st->codecpar->extradata_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
decoder_ctx->opaque = &decode;
|
|
||||||
decoder_ctx->get_format = get_format;
|
|
||||||
|
|
||||||
ret = avcodec_open2(decoder_ctx, NULL, NULL);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Error opening the decoder: ");
|
|
||||||
goto finish;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* open the output stream */
|
|
||||||
ret = avio_open(&output_ctx, argv[2], AVIO_FLAG_WRITE);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "Error opening the output context: ");
|
|
||||||
goto finish;
|
|
||||||
}
|
|
||||||
|
|
||||||
frame = av_frame_alloc();
|
|
||||||
sw_frame = av_frame_alloc();
|
|
||||||
if (!frame || !sw_frame) {
|
|
||||||
ret = AVERROR(ENOMEM);
|
|
||||||
goto finish;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* actual decoding */
|
|
||||||
while (ret >= 0) {
|
|
||||||
ret = av_read_frame(input_ctx, &pkt);
|
|
||||||
if (ret < 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (pkt.stream_index == video_st->index)
|
|
||||||
ret = decode_packet(&decode, decoder_ctx, frame, sw_frame, &pkt, output_ctx);
|
|
||||||
|
|
||||||
av_packet_unref(&pkt);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* flush the decoder */
|
|
||||||
pkt.data = NULL;
|
|
||||||
pkt.size = 0;
|
|
||||||
ret = decode_packet(&decode, decoder_ctx, frame, sw_frame, &pkt, output_ctx);
|
|
||||||
|
|
||||||
finish:
|
|
||||||
if (ret < 0) {
|
|
||||||
char buf[1024];
|
|
||||||
av_strerror(ret, buf, sizeof(buf));
|
|
||||||
fprintf(stderr, "%s\n", buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
avformat_close_input(&input_ctx);
|
|
||||||
|
|
||||||
av_frame_free(&frame);
|
|
||||||
av_frame_free(&sw_frame);
|
|
||||||
|
|
||||||
avcodec_free_context(&decoder_ctx);
|
|
||||||
|
|
||||||
av_buffer_unref(&decode.hw_device_ref);
|
|
||||||
|
|
||||||
avio_close(output_ctx);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
@@ -50,9 +50,6 @@ int main(int argc, char **argv)
|
|||||||
AVPacket pkt;
|
AVPacket pkt;
|
||||||
const char *in_filename, *out_filename;
|
const char *in_filename, *out_filename;
|
||||||
int ret, i;
|
int ret, i;
|
||||||
int stream_index = 0;
|
|
||||||
int *stream_mapping = NULL;
|
|
||||||
int stream_mapping_size = 0;
|
|
||||||
|
|
||||||
if (argc < 3) {
|
if (argc < 3) {
|
||||||
printf("usage: %s input output\n"
|
printf("usage: %s input output\n"
|
||||||
@@ -65,6 +62,8 @@ int main(int argc, char **argv)
|
|||||||
in_filename = argv[1];
|
in_filename = argv[1];
|
||||||
out_filename = argv[2];
|
out_filename = argv[2];
|
||||||
|
|
||||||
|
av_register_all();
|
||||||
|
|
||||||
if ((ret = avformat_open_input(&ifmt_ctx, in_filename, 0, 0)) < 0) {
|
if ((ret = avformat_open_input(&ifmt_ctx, in_filename, 0, 0)) < 0) {
|
||||||
fprintf(stderr, "Could not open input file '%s'", in_filename);
|
fprintf(stderr, "Could not open input file '%s'", in_filename);
|
||||||
goto end;
|
goto end;
|
||||||
@@ -84,42 +83,24 @@ int main(int argc, char **argv)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream_mapping_size = ifmt_ctx->nb_streams;
|
|
||||||
stream_mapping = av_mallocz_array(stream_mapping_size, sizeof(*stream_mapping));
|
|
||||||
if (!stream_mapping) {
|
|
||||||
ret = AVERROR(ENOMEM);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
ofmt = ofmt_ctx->oformat;
|
ofmt = ofmt_ctx->oformat;
|
||||||
|
|
||||||
for (i = 0; i < ifmt_ctx->nb_streams; i++) {
|
for (i = 0; i < ifmt_ctx->nb_streams; i++) {
|
||||||
AVStream *out_stream;
|
|
||||||
AVStream *in_stream = ifmt_ctx->streams[i];
|
AVStream *in_stream = ifmt_ctx->streams[i];
|
||||||
AVCodecParameters *in_codecpar = in_stream->codecpar;
|
AVStream *out_stream = avformat_new_stream(ofmt_ctx, in_stream->codec->codec);
|
||||||
|
|
||||||
if (in_codecpar->codec_type != AVMEDIA_TYPE_AUDIO &&
|
|
||||||
in_codecpar->codec_type != AVMEDIA_TYPE_VIDEO &&
|
|
||||||
in_codecpar->codec_type != AVMEDIA_TYPE_SUBTITLE) {
|
|
||||||
stream_mapping[i] = -1;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
stream_mapping[i] = stream_index++;
|
|
||||||
|
|
||||||
out_stream = avformat_new_stream(ofmt_ctx, NULL);
|
|
||||||
if (!out_stream) {
|
if (!out_stream) {
|
||||||
fprintf(stderr, "Failed allocating output stream\n");
|
fprintf(stderr, "Failed allocating output stream\n");
|
||||||
ret = AVERROR_UNKNOWN;
|
ret = AVERROR_UNKNOWN;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = avcodec_parameters_copy(out_stream->codecpar, in_codecpar);
|
ret = avcodec_copy_context(out_stream->codec, in_stream->codec);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "Failed to copy codec parameters\n");
|
fprintf(stderr, "Failed to copy context from input to output stream codec context\n");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
out_stream->codecpar->codec_tag = 0;
|
if (ofmt_ctx->oformat->flags & AVFMT_GLOBALHEADER)
|
||||||
|
out_stream->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
|
||||||
}
|
}
|
||||||
av_dump_format(ofmt_ctx, 0, out_filename, 1);
|
av_dump_format(ofmt_ctx, 0, out_filename, 1);
|
||||||
|
|
||||||
@@ -145,14 +126,8 @@ int main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
in_stream = ifmt_ctx->streams[pkt.stream_index];
|
in_stream = ifmt_ctx->streams[pkt.stream_index];
|
||||||
if (pkt.stream_index >= stream_mapping_size ||
|
|
||||||
stream_mapping[pkt.stream_index] < 0) {
|
|
||||||
av_packet_unref(&pkt);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
pkt.stream_index = stream_mapping[pkt.stream_index];
|
|
||||||
out_stream = ofmt_ctx->streams[pkt.stream_index];
|
out_stream = ofmt_ctx->streams[pkt.stream_index];
|
||||||
|
|
||||||
log_packet(ifmt_ctx, &pkt, "in");
|
log_packet(ifmt_ctx, &pkt, "in");
|
||||||
|
|
||||||
/* copy packet */
|
/* copy packet */
|
||||||
@@ -167,7 +142,7 @@ int main(int argc, char **argv)
|
|||||||
fprintf(stderr, "Error muxing packet\n");
|
fprintf(stderr, "Error muxing packet\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
av_packet_unref(&pkt);
|
av_free_packet(&pkt);
|
||||||
}
|
}
|
||||||
|
|
||||||
av_write_trailer(ofmt_ctx);
|
av_write_trailer(ofmt_ctx);
|
||||||
@@ -177,11 +152,9 @@ end:
|
|||||||
|
|
||||||
/* close output */
|
/* close output */
|
||||||
if (ofmt_ctx && !(ofmt->flags & AVFMT_NOFILE))
|
if (ofmt_ctx && !(ofmt->flags & AVFMT_NOFILE))
|
||||||
avio_closep(&ofmt_ctx->pb);
|
avio_close(ofmt_ctx->pb);
|
||||||
avformat_free_context(ofmt_ctx);
|
avformat_free_context(ofmt_ctx);
|
||||||
|
|
||||||
av_freep(&stream_mapping);
|
|
||||||
|
|
||||||
if (ret < 0 && ret != AVERROR_EOF) {
|
if (ret < 0 && ret != AVERROR_EOF) {
|
||||||
fprintf(stderr, "Error occurred: %s\n", av_err2str(ret));
|
fprintf(stderr, "Error occurred: %s\n", av_err2str(ret));
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ int main(int argc, char **argv)
|
|||||||
dst_nb_samples = av_rescale_rnd(swr_get_delay(swr_ctx, src_rate) +
|
dst_nb_samples = av_rescale_rnd(swr_get_delay(swr_ctx, src_rate) +
|
||||||
src_nb_samples, dst_rate, src_rate, AV_ROUND_UP);
|
src_nb_samples, dst_rate, src_rate, AV_ROUND_UP);
|
||||||
if (dst_nb_samples > max_dst_nb_samples) {
|
if (dst_nb_samples > max_dst_nb_samples) {
|
||||||
av_freep(&dst_data[0]);
|
av_free(dst_data[0]);
|
||||||
ret = av_samples_alloc(dst_data, &dst_linesize, dst_nb_channels,
|
ret = av_samples_alloc(dst_data, &dst_linesize, dst_nb_channels,
|
||||||
dst_nb_samples, dst_sample_fmt, 1);
|
dst_nb_samples, dst_sample_fmt, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@@ -199,7 +199,8 @@ int main(int argc, char **argv)
|
|||||||
fmt, dst_ch_layout, dst_nb_channels, dst_rate, dst_filename);
|
fmt, dst_ch_layout, dst_nb_channels, dst_rate, dst_filename);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
fclose(dst_file);
|
if (dst_file)
|
||||||
|
fclose(dst_file);
|
||||||
|
|
||||||
if (src_data)
|
if (src_data)
|
||||||
av_freep(&src_data[0]);
|
av_freep(&src_data[0]);
|
||||||
|
|||||||
@@ -132,7 +132,8 @@ int main(int argc, char **argv)
|
|||||||
av_get_pix_fmt_name(dst_pix_fmt), dst_w, dst_h, dst_filename);
|
av_get_pix_fmt_name(dst_pix_fmt), dst_w, dst_h, dst_filename);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
fclose(dst_file);
|
if (dst_file)
|
||||||
|
fclose(dst_file);
|
||||||
av_freep(&src_data[0]);
|
av_freep(&src_data[0]);
|
||||||
av_freep(&dst_data[0]);
|
av_freep(&dst_data[0]);
|
||||||
sws_freeContext(sws_ctx);
|
sws_freeContext(sws_ctx);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user