From 96573c0d7605672d69b42ae1dcf18764ce47c71a Mon Sep 17 00:00:00 2001 From: Vitor Sessak Date: Mon, 11 Apr 2011 16:20:36 -0400 Subject: [PATCH 01/32] lavf/utils.c: Order packets with identical PTS by stream index. This allows for more reproducible results when using multi-threading. Signed-off-by: Ronald S. Bultje --- libavformat/utils.c | 5 +- tests/ref/fate/8bps | 2 +- tests/ref/fate/bethsoft-vid | 2 +- tests/ref/fate/bfi | 2 +- tests/ref/fate/corepng | 2 +- tests/ref/fate/creatureshock-avs | 2 +- tests/ref/fate/feeble-dxa | 2 +- tests/ref/fate/film-cvid-pcm-stereo-8bit | 16 +- tests/ref/fate/idroq-video-dpcm | 2 +- tests/ref/fate/interplay-mve-16bit | 2 +- tests/ref/fate/interplay-mve-8bit | 2 +- tests/ref/fate/lmlm4-demux | 2 +- tests/ref/fate/mtv | 2 +- tests/ref/fate/nuv | 2 +- tests/ref/fate/psx-str | 46 +++--- tests/ref/fate/sierra-vmd | 178 +++++++++++------------ tests/ref/fate/siff | 6 +- tests/ref/fate/tiertex-seq | 144 +++++++++--------- tests/ref/fate/truemotion1-15 | 2 +- tests/ref/fate/truemotion1-24 | 2 +- tests/ref/fate/tscc-15bit | 30 ++-- tests/ref/fate/vqa-cc | 2 +- tests/ref/fate/wmv8-drm-nodec | 2 +- tests/ref/lavf/avi | 2 +- tests/ref/lavf/gxf | 2 +- tests/ref/lavf/mpg | 2 +- tests/ref/lavf/mxf | 2 +- tests/ref/lavf/nut | 2 +- tests/ref/seek/lavf_avi | 18 +-- tests/ref/seek/lavf_nut | 32 ++-- 30 files changed, 260 insertions(+), 257 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index f93b83f5da..6b38e66bc5 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3063,7 +3063,10 @@ static int ff_interleave_compare_dts(AVFormatContext *s, AVPacket *next, AVPacke AVStream *st2= s->streams[ next->stream_index]; int64_t a= st2->time_base.num * (int64_t)st ->time_base.den; int64_t b= st ->time_base.num * (int64_t)st2->time_base.den; - return av_rescale_rnd(pkt->dts, b, a, AV_ROUND_DOWN) < next->dts; + int64_t dts1 = av_rescale_rnd(pkt->dts, b, a, AV_ROUND_DOWN); + if (dts1 == next->dts) + return pkt->stream_index < next->stream_index; + return dts1 < next->dts; } int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush){ diff --git a/tests/ref/fate/8bps b/tests/ref/fate/8bps index 6ee96177db..30ec8c5eba 100644 --- a/tests/ref/fate/8bps +++ b/tests/ref/fate/8bps @@ -1,5 +1,5 @@ -1, 0, 2048, 0x3d042426 0, 0, 259200, 0x7e91df07 +1, 0, 2048, 0x3d042426 1, 4180, 2048, 0x5bcae456 0, 7200, 259200, 0x7e91df07 1, 8359, 2048, 0xb6043655 diff --git a/tests/ref/fate/bethsoft-vid b/tests/ref/fate/bethsoft-vid index 4c252bdf10..92c694b19e 100644 --- a/tests/ref/fate/bethsoft-vid +++ b/tests/ref/fate/bethsoft-vid @@ -1,5 +1,5 @@ -1, 0, 1480, 0x00000000 0, 0, 192000, 0x00000000 +1, 0, 1480, 0x00000000 0, 1500, 192000, 0x01a6cf45 0, 3000, 192000, 0xd07d57e9 0, 4500, 192000, 0x3cb1dff5 diff --git a/tests/ref/fate/bfi b/tests/ref/fate/bfi index b0d853b98d..1471670ce3 100644 --- a/tests/ref/fate/bfi +++ b/tests/ref/fate/bfi @@ -1,5 +1,5 @@ -1, 0, 17768, 0x07df135c 0, 0, 134400, 0xc218b00c +1, 0, 17768, 0x07df135c 0, 10000, 134400, 0x114daf7c 0, 20000, 134400, 0xe14db24c 0, 30000, 134400, 0x88c71df7 diff --git a/tests/ref/fate/corepng b/tests/ref/fate/corepng index 7b01e7ab27..2b197d2709 100644 --- a/tests/ref/fate/corepng +++ b/tests/ref/fate/corepng @@ -1,5 +1,5 @@ -1, 0, 11026, 0x27ad637c 0, 0, 230400, 0x03e25ead +1, 0, 11026, 0x27ad637c 0, 6000, 230400, 0x0a520ffd 0, 12000, 230400, 0x0b11a671 0, 18000, 230400, 0x7d3fce32 diff --git a/tests/ref/fate/creatureshock-avs b/tests/ref/fate/creatureshock-avs index 54ed2f807f..bd6739f056 100644 --- a/tests/ref/fate/creatureshock-avs +++ b/tests/ref/fate/creatureshock-avs @@ -1,5 +1,5 @@ -1, 0, 16372, 0xfaaab59d 0, 0, 188892, 0xcb5be3dd +1, 0, 16372, 0xfaaab59d 0, 6000, 188892, 0x0f313ebc 0, 12000, 188892, 0xc0da25cc 0, 18000, 188892, 0xad6e1d44 diff --git a/tests/ref/fate/feeble-dxa b/tests/ref/fate/feeble-dxa index 309603233e..9013f99118 100644 --- a/tests/ref/fate/feeble-dxa +++ b/tests/ref/fate/feeble-dxa @@ -1,5 +1,5 @@ -1, 0, 1000, 0x64cd9403 0, 0, 921600, 0x0d03844f +1, 0, 1000, 0x64cd9403 1, 4082, 1000, 0xa4ef8a9d 1, 8163, 1000, 0x75c19868 0, 9000, 921600, 0x0d03844f diff --git a/tests/ref/fate/film-cvid-pcm-stereo-8bit b/tests/ref/fate/film-cvid-pcm-stereo-8bit index ebe0fc45ca..3566b0f85a 100644 --- a/tests/ref/fate/film-cvid-pcm-stereo-8bit +++ b/tests/ref/fate/film-cvid-pcm-stereo-8bit @@ -1,5 +1,5 @@ -1, 0, 88192, 0x23bb50ae 0, 0, 107520, 0xa6c9fdd2 +1, 0, 88192, 0x23bb50ae 0, 3000, 107520, 0x61eb28c1 0, 6000, 107520, 0x45e20af7 0, 9000, 107520, 0x45e20af7 @@ -31,8 +31,8 @@ 0, 81000, 107520, 0xee7324f0 0, 84000, 107520, 0xe15025b3 0, 87000, 107520, 0xe15025b3 -1, 90000, 44112, 0x18fed048 0, 90000, 107520, 0x8afa312e +1, 90000, 44112, 0x18fed048 0, 93000, 107520, 0x8afa312e 0, 96000, 107520, 0x717a7d0f 0, 99000, 107520, 0x717a7d0f @@ -65,8 +65,8 @@ 0, 171000, 107520, 0x14147bd6 0, 174000, 107520, 0x07d54bec 0, 177000, 107520, 0x07d54bec -1, 180000, 44112, 0xddc19d91 0, 180000, 107520, 0xe287a0a7 +1, 180000, 44112, 0xddc19d91 0, 183000, 107520, 0xe287a0a7 0, 186000, 107520, 0xc023a14d 0, 189000, 107520, 0xc023a14d @@ -99,8 +99,8 @@ 0, 261000, 107520, 0x3e0e4d8d 0, 264000, 107520, 0xd268865b 0, 267000, 107520, 0xd268865b -1, 270000, 44112, 0x99c8c3d9 0, 270000, 107520, 0x89a4efeb +1, 270000, 44112, 0x99c8c3d9 0, 273000, 107520, 0x89a4efeb 0, 276000, 107520, 0x70ca2478 0, 279000, 107520, 0x70ca2478 @@ -133,8 +133,8 @@ 0, 351000, 107520, 0x3a1d7571 0, 354000, 107520, 0x3a1d7571 0, 357000, 107520, 0x3a1d7571 -1, 360000, 44112, 0x9e475274 0, 360000, 107520, 0xe974733e +1, 360000, 44112, 0x9e475274 0, 363000, 107520, 0xe974733e 0, 366000, 107520, 0x999c6fbf 0, 369000, 107520, 0x999c6fbf @@ -167,8 +167,8 @@ 0, 441000, 107520, 0xfce5fd07 0, 444000, 107520, 0xd993f193 0, 447000, 107520, 0xd993f193 -1, 450000, 44112, 0xb8f86e48 0, 450000, 107520, 0x4d48e7b4 +1, 450000, 44112, 0xb8f86e48 0, 453000, 107520, 0x4d48e7b4 0, 456000, 107520, 0x61ccdf83 0, 459000, 107520, 0x61ccdf83 @@ -201,8 +201,8 @@ 0, 531000, 107520, 0xf464c343 0, 534000, 107520, 0xf464c343 0, 537000, 107520, 0xf464c343 -1, 540000, 44112, 0xe0ac619f 0, 540000, 107520, 0xf464c343 +1, 540000, 44112, 0xe0ac619f 0, 543000, 107520, 0xf464c343 0, 546000, 107520, 0xf2b2c712 0, 549000, 107520, 0xf2b2c712 @@ -235,8 +235,8 @@ 0, 621000, 107520, 0x5ecc379e 0, 624000, 107520, 0xea09432a 0, 627000, 107520, 0xea09432a -1, 630000, 44112, 0x00000000 0, 630000, 107520, 0xe01e6b73 +1, 630000, 44112, 0x00000000 0, 633000, 107520, 0xe01e6b73 0, 636000, 107520, 0x1d13bba8 0, 639000, 107520, 0x1d13bba8 diff --git a/tests/ref/fate/idroq-video-dpcm b/tests/ref/fate/idroq-video-dpcm index cad87fe324..7e0a10ee2e 100644 --- a/tests/ref/fate/idroq-video-dpcm +++ b/tests/ref/fate/idroq-video-dpcm @@ -1,5 +1,5 @@ -1, 0, 29824, 0x77e265b7 0, 0, 393216, 0x56995aac +1, 0, 29824, 0x77e265b7 0, 3000, 393216, 0xf9ed5d6c 0, 6000, 393216, 0xd3285d75 0, 9000, 393216, 0x82d15d62 diff --git a/tests/ref/fate/interplay-mve-16bit b/tests/ref/fate/interplay-mve-16bit index 2d22cca68c..74f0b350c6 100644 --- a/tests/ref/fate/interplay-mve-16bit +++ b/tests/ref/fate/interplay-mve-16bit @@ -1,5 +1,5 @@ -1, 0, 5788, 0x916d2db8 0, 0, 614400, 0x00000000 +1, 0, 5788, 0x916d2db8 1, 2953, 5888, 0xc65cb069 0, 3002, 614400, 0x00000000 1, 5957, 5888, 0xd8ec1acc diff --git a/tests/ref/fate/interplay-mve-8bit b/tests/ref/fate/interplay-mve-8bit index 0b41f352ea..13959c3cf2 100644 --- a/tests/ref/fate/interplay-mve-8bit +++ b/tests/ref/fate/interplay-mve-8bit @@ -1,5 +1,5 @@ -1, 0, 5848, 0xea04292b 0, 0, 414720, 0xa5cd50ca +1, 0, 5848, 0xea04292b 1, 5967, 5888, 0x0e59e942 0, 6006, 414720, 0x3facd321 1, 11976, 5888, 0x56d480f6 diff --git a/tests/ref/fate/lmlm4-demux b/tests/ref/fate/lmlm4-demux index 8ecf4b2db9..f322300eee 100644 --- a/tests/ref/fate/lmlm4-demux +++ b/tests/ref/fate/lmlm4-demux @@ -1,5 +1,5 @@ -1, 0, 768, 0xaebcbebb 0, 0, 5951, 0xe9118e0d +1, 0, 768, 0xaebcbebb 1, 2160, 768, 0xaebcbebb 0, 3003, 1672, 0x4b80d4ca 1, 4320, 768, 0xaebcbebb diff --git a/tests/ref/fate/mtv b/tests/ref/fate/mtv index d7dfa94a4b..6699f62b58 100644 --- a/tests/ref/fate/mtv +++ b/tests/ref/fate/mtv @@ -1,5 +1,5 @@ -1, 0, 417, 0xae1cc66a 0, 0, 18432, 0xbd7e0ac8 +1, 0, 417, 0xae1cc66a 1, 2351, 418, 0xdc3ec850 1, 4702, 418, 0x4e8ed05f 0, 5625, 18432, 0xbd7e0ac8 diff --git a/tests/ref/fate/nuv b/tests/ref/fate/nuv index 204a4112e7..b047378954 100644 --- a/tests/ref/fate/nuv +++ b/tests/ref/fate/nuv @@ -1,5 +1,5 @@ -1, 0, 4096, 0x00000000 0, 0, 460800, 0x54aedafe +1, 0, 4096, 0x00000000 1, 2090, 4096, 0x4dfae7a6 0, 3003, 460800, 0x54aedafe 1, 4180, 4096, 0x3fd9f5c6 diff --git a/tests/ref/fate/psx-str b/tests/ref/fate/psx-str index c0b990854f..3872e289e5 100644 --- a/tests/ref/fate/psx-str +++ b/tests/ref/fate/psx-str @@ -1,5 +1,5 @@ -1, 0, 8064, 0x02260037 0, 0, 115200, 0x6b106a56 +1, 0, 8064, 0x02260037 1, 4800, 8064, 0x4ee9f4e9 0, 6000, 115200, 0x53c16930 1, 9600, 8064, 0xf8fd82aa @@ -7,8 +7,8 @@ 1, 14400, 8064, 0xc100792b 0, 18000, 115200, 0xc3c18ba0 1, 19200, 8064, 0xf11a5316 -1, 24000, 8064, 0x6937f8c0 0, 24000, 115200, 0xe281b655 +1, 24000, 8064, 0x6937f8c0 1, 28800, 8064, 0xed194e42 0, 30000, 115200, 0x7b1e0536 1, 33600, 8064, 0x619ce54b @@ -16,8 +16,8 @@ 1, 38400, 8064, 0x544999ec 0, 42000, 115200, 0xfc67bf8e 1, 43200, 8064, 0x0ea877b4 -1, 48000, 8064, 0xb764d1c0 0, 48000, 115200, 0xb463151c +1, 48000, 8064, 0xb764d1c0 1, 52800, 8064, 0x7a2fd211 0, 54000, 115200, 0x6e686846 1, 57600, 8064, 0xff69f6c5 @@ -25,8 +25,8 @@ 1, 62400, 8064, 0x26c11ec7 0, 66000, 115200, 0x17b91efc 1, 67200, 8064, 0xfb4ecc0c -1, 72000, 8064, 0x111d799b 0, 72000, 115200, 0xc051a49a +1, 72000, 8064, 0x111d799b 1, 76800, 8064, 0xc704dc91 0, 78000, 115200, 0xc68c227b 1, 81600, 8064, 0xa9f372fb @@ -34,8 +34,8 @@ 1, 86400, 8064, 0xa3f0ad0f 0, 90000, 115200, 0x09d56ecc 1, 91200, 8064, 0x958719b9 -1, 96000, 8064, 0x9b011bf7 0, 96000, 115200, 0xc20e3485 +1, 96000, 8064, 0x9b011bf7 1, 100800, 8064, 0x466d96fb 0, 102000, 115200, 0xf07e2c48 1, 105600, 8064, 0x6ed4eb29 @@ -43,8 +43,8 @@ 1, 110400, 8064, 0x066966db 0, 114000, 115200, 0xed65bacd 1, 115200, 8064, 0xf60fe0bc -1, 120000, 8064, 0x2c845167 0, 120000, 115200, 0x51a23a3b +1, 120000, 8064, 0x2c845167 1, 124800, 8064, 0x7d63894f 0, 126000, 115200, 0x559ddce1 1, 129600, 8064, 0x0682ee36 @@ -52,8 +52,8 @@ 1, 134400, 8064, 0xcaeb7c70 0, 138000, 115200, 0x11b2dece 1, 139200, 8064, 0x93948697 -1, 144000, 8064, 0x5805f0d6 0, 144000, 115200, 0x851b877c +1, 144000, 8064, 0x5805f0d6 1, 148800, 8064, 0xcfb641ff 0, 150000, 115200, 0x5f9a7c99 1, 153600, 8064, 0xe3499bb1 @@ -61,8 +61,8 @@ 1, 158400, 8064, 0x689fe483 0, 162000, 115200, 0x950b0de8 1, 163200, 8064, 0x1b8f2f2d -1, 168000, 8064, 0x23852e71 0, 168000, 115200, 0x6ec4c89a +1, 168000, 8064, 0x23852e71 1, 172800, 8064, 0x15e7b298 0, 174000, 115200, 0xa9234812 1, 177600, 8064, 0x5345a9a3 @@ -70,8 +70,8 @@ 1, 182400, 8064, 0x257b6ecf 0, 186000, 115200, 0x2cc1a2aa 1, 187200, 8064, 0xaf62836c -1, 192000, 8064, 0xc3a401e3 0, 192000, 115200, 0x5df53b71 +1, 192000, 8064, 0xc3a401e3 1, 196800, 8064, 0x2b98fdf1 0, 198000, 115200, 0xe1d0cb31 1, 201600, 8064, 0x37168697 @@ -79,8 +79,8 @@ 1, 206400, 8064, 0x2d876c89 0, 210000, 115200, 0x9342d739 1, 211200, 8064, 0xc40a6ada -1, 216000, 8064, 0xcca6b829 0, 216000, 115200, 0x586bc658 +1, 216000, 8064, 0xcca6b829 1, 220800, 8064, 0x6667550a 0, 222000, 115200, 0x76902834 1, 225600, 8064, 0x99c1b5cb @@ -88,8 +88,8 @@ 1, 230400, 8064, 0xc05d3ed3 0, 234000, 115200, 0xce8c95fb 1, 235200, 8064, 0xdd641781 -1, 240000, 8064, 0xa65d49dc 0, 240000, 115200, 0xdf0d3de6 +1, 240000, 8064, 0xa65d49dc 1, 244800, 8064, 0x2a0d5df7 0, 246000, 115200, 0x120db7ae 1, 249600, 8064, 0xa6348438 @@ -97,8 +97,8 @@ 1, 254400, 8064, 0xf2e1412d 0, 258000, 115200, 0x2498d3b6 1, 259200, 8064, 0xc41c6a7a -1, 264000, 8064, 0x147edc3d 0, 264000, 115200, 0x99975ff8 +1, 264000, 8064, 0x147edc3d 1, 268800, 8064, 0x17e3cfe7 0, 270000, 115200, 0xbad65f9f 1, 273600, 8064, 0x01fe3969 @@ -106,8 +106,8 @@ 1, 278400, 8064, 0xc437ac11 0, 282000, 115200, 0x6f8a61a0 1, 283200, 8064, 0xbbf747c1 -1, 288000, 8064, 0x2a4b88c0 0, 288000, 115200, 0x80c96143 +1, 288000, 8064, 0x2a4b88c0 1, 292800, 8064, 0xcd149c80 0, 294000, 115200, 0x663c6198 1, 297600, 8064, 0xcf339dfc @@ -115,8 +115,8 @@ 1, 302400, 8064, 0xc81ff84b 0, 306000, 115200, 0xfe186346 1, 307200, 8064, 0x4d978100 -1, 312000, 8064, 0x6da6665b 0, 312000, 115200, 0x844962f8 +1, 312000, 8064, 0x6da6665b 1, 316800, 8064, 0x12fa354f 0, 318000, 115200, 0x917c672f 1, 321600, 8064, 0x6baedae6 @@ -124,8 +124,8 @@ 1, 326400, 8064, 0xddd77327 0, 330000, 115200, 0xace06816 1, 331200, 8064, 0x0a31c118 -1, 336000, 8064, 0x7652ee6e 0, 336000, 115200, 0x4ef26aa2 +1, 336000, 8064, 0x7652ee6e 1, 340800, 8064, 0x486a24cc 0, 342000, 115200, 0xf2046bb3 1, 345600, 8064, 0xf6cf01ee @@ -133,8 +133,8 @@ 1, 350400, 8064, 0x2a19e830 0, 354000, 115200, 0x8a17716d 1, 355200, 8064, 0xde675a31 -1, 360000, 8064, 0xeefcc9af 0, 360000, 115200, 0x36127568 +1, 360000, 8064, 0xeefcc9af 1, 364800, 8064, 0xaec4c989 0, 366000, 115200, 0x3e877b5c 1, 369600, 8064, 0x16b73de9 @@ -142,8 +142,8 @@ 1, 374400, 8064, 0x188a582a 0, 378000, 115200, 0x41bc8a39 1, 379200, 8064, 0xc092e73d -1, 384000, 8064, 0xf7ebca97 0, 384000, 115200, 0x6f839446 +1, 384000, 8064, 0xf7ebca97 1, 388800, 8064, 0x170ce07a 0, 390000, 115200, 0xef74a005 1, 393600, 8064, 0xa0705384 @@ -151,8 +151,8 @@ 1, 398400, 8064, 0xd0154a3c 0, 402000, 115200, 0x4607cf99 1, 403200, 8064, 0x57c73c6c -1, 408000, 8064, 0x590c9ddb 0, 408000, 115200, 0x4c18e8db +1, 408000, 8064, 0x590c9ddb 1, 412800, 8064, 0x2cbe552f 0, 414000, 115200, 0x04d71efb 1, 417600, 8064, 0x0d286932 @@ -160,8 +160,8 @@ 1, 422400, 8064, 0x5931cea3 0, 426000, 115200, 0x4dd48d01 1, 427200, 8064, 0xaf0fb80d -1, 432000, 8064, 0x7fb61e9b 0, 432000, 115200, 0x5fa9627f +1, 432000, 8064, 0x7fb61e9b 1, 436800, 8064, 0xf17134bb 0, 438000, 115200, 0x7a413f88 1, 441600, 8064, 0xd647859a @@ -169,8 +169,8 @@ 1, 446400, 8064, 0x55a60921 0, 450000, 115200, 0x3d720e05 1, 451200, 8064, 0x3811fa58 -1, 456000, 8064, 0xaceeccea 0, 456000, 115200, 0x49243fd8 +1, 456000, 8064, 0xaceeccea 1, 460800, 8064, 0x5fcedf14 0, 462000, 115200, 0x9834b697 1, 465600, 8064, 0xd8c64abf @@ -178,8 +178,8 @@ 1, 470400, 8064, 0x79495e8d 0, 474000, 115200, 0x3eaf5504 1, 475200, 8064, 0x4b7db039 -1, 480000, 8064, 0x7152f86d 0, 480000, 115200, 0x057a3701 +1, 480000, 8064, 0x7152f86d 1, 484800, 8064, 0xd92cfc1a 0, 486000, 115200, 0x6e88f21a 1, 489600, 8064, 0x75c540ef @@ -187,8 +187,8 @@ 1, 494400, 8064, 0x9c03ef5e 0, 498000, 115200, 0x92212d84 1, 499200, 8064, 0x7b2911c8 -1, 504000, 8064, 0x69d9d553 0, 504000, 115200, 0xf6b0a4ff +1, 504000, 8064, 0x69d9d553 1, 508800, 8064, 0xcb45d7c5 0, 510000, 115200, 0xb49e9b4e 1, 513600, 8064, 0x37ec8b0a @@ -196,5 +196,5 @@ 1, 518400, 8064, 0xe4354221 0, 522000, 115200, 0x65f3339a 1, 523200, 8064, 0xc0d91cdb -1, 528000, 8064, 0xea0be175 0, 528000, 115200, 0x38e40a20 +1, 528000, 8064, 0xea0be175 diff --git a/tests/ref/fate/sierra-vmd b/tests/ref/fate/sierra-vmd index 91a8e46548..8ea1570472 100644 --- a/tests/ref/fate/sierra-vmd +++ b/tests/ref/fate/sierra-vmd @@ -27,184 +27,184 @@ 0, 225000, 230400, 0x76aebdae 0, 234000, 230400, 0x81357545 0, 243000, 230400, 0x38baeebd -1, 252000, 4410, 0x109d04e0 0, 252000, 230400, 0x1c5c44d4 -1, 261000, 4410, 0x224d244f +1, 252000, 4410, 0x109d04e0 0, 261000, 230400, 0x60e189cc -1, 270000, 4410, 0xbb72413d +1, 261000, 4410, 0x224d244f 0, 270000, 230400, 0xb1f4381c -1, 279000, 4410, 0xaa5f5b86 +1, 270000, 4410, 0xbb72413d 0, 279000, 230400, 0xb5048fed -1, 288000, 4410, 0x94e7aea7 +1, 279000, 4410, 0xaa5f5b86 0, 288000, 230400, 0xc947c30e -1, 297000, 4410, 0xad497ca0 +1, 288000, 4410, 0x94e7aea7 0, 297000, 230400, 0xe8e31c07 -1, 306000, 4410, 0x1de10c9e +1, 297000, 4410, 0xad497ca0 0, 306000, 230400, 0x6d49dd02 -1, 315000, 4410, 0x9f55efa8 +1, 306000, 4410, 0x1de10c9e 0, 315000, 230400, 0x293e15d3 -1, 324000, 4410, 0x220a072a +1, 315000, 4410, 0x9f55efa8 0, 324000, 230400, 0x354d792e -1, 333000, 4410, 0xa7dafb29 +1, 324000, 4410, 0x220a072a 0, 333000, 230400, 0x35468780 -1, 342000, 4410, 0xd5e29c7a +1, 333000, 4410, 0xa7dafb29 0, 342000, 230400, 0x365d3991 -1, 351000, 4410, 0xb8465006 +1, 342000, 4410, 0xd5e29c7a 0, 351000, 230400, 0xc9debef2 -1, 360000, 4410, 0x518669c7 +1, 351000, 4410, 0xb8465006 0, 360000, 230400, 0x4c4634c2 -1, 369000, 4410, 0xb5b5efca +1, 360000, 4410, 0x518669c7 0, 369000, 230400, 0x347c2dca -1, 378000, 4410, 0x8600015d +1, 369000, 4410, 0xb5b5efca 0, 378000, 230400, 0x1efa0aaa -1, 387000, 4410, 0xe2f68fe9 +1, 378000, 4410, 0x8600015d 0, 387000, 230400, 0xa79a0b5a -1, 396000, 4410, 0x8d3458d9 +1, 387000, 4410, 0xe2f68fe9 0, 396000, 230400, 0xfdb2dcdb -1, 405000, 4410, 0xf1ff4775 +1, 396000, 4410, 0x8d3458d9 0, 405000, 230400, 0x42dbea33 -1, 414000, 4410, 0x830f67c9 +1, 405000, 4410, 0xf1ff4775 0, 414000, 230400, 0x2a207e43 -1, 423000, 4410, 0x110e0bc1 +1, 414000, 4410, 0x830f67c9 0, 423000, 230400, 0x86573783 -1, 432000, 4410, 0x71682f47 +1, 423000, 4410, 0x110e0bc1 0, 432000, 230400, 0xc3968473 -1, 441000, 4410, 0x38119095 +1, 432000, 4410, 0x71682f47 0, 441000, 230400, 0x8f62a7b4 -1, 450000, 4410, 0xd2494db6 +1, 441000, 4410, 0x38119095 0, 450000, 230400, 0x5a2e3073 -1, 459000, 4410, 0x8b552509 +1, 450000, 4410, 0xd2494db6 0, 459000, 230400, 0xd24f5e2c -1, 468000, 4410, 0x71e52909 +1, 459000, 4410, 0x8b552509 0, 468000, 230400, 0x1df3c67d -1, 477000, 4410, 0x9f0a6f4d +1, 468000, 4410, 0x71e52909 0, 477000, 230400, 0xe4fd884d -1, 486000, 4410, 0x901302f2 +1, 477000, 4410, 0x9f0a6f4d 0, 486000, 230400, 0x9a228555 -1, 495000, 4410, 0x855d5222 +1, 486000, 4410, 0x901302f2 0, 495000, 230400, 0x9eba8ed5 -1, 504000, 4410, 0x324bb2fe +1, 495000, 4410, 0x855d5222 0, 504000, 230400, 0x3d808a3d -1, 513000, 4410, 0xe85f583f +1, 504000, 4410, 0x324bb2fe 0, 513000, 230400, 0xf57e866d -1, 522000, 4410, 0x2cbc67c4 +1, 513000, 4410, 0xe85f583f 0, 522000, 230400, 0x85f594f5 -1, 531000, 4410, 0xc82e6aa1 +1, 522000, 4410, 0x2cbc67c4 0, 531000, 230400, 0xb09f99dd -1, 540000, 4410, 0xb9fc423c +1, 531000, 4410, 0xc82e6aa1 0, 540000, 230400, 0x2b368475 -1, 549000, 4410, 0x6b9b4ef9 +1, 540000, 4410, 0xb9fc423c 0, 549000, 230400, 0xa2417afd -1, 558000, 4410, 0x39290f10 +1, 549000, 4410, 0x6b9b4ef9 0, 558000, 230400, 0x590b709d -1, 567000, 4410, 0xad718eb4 +1, 558000, 4410, 0x39290f10 0, 567000, 230400, 0x5d617705 -1, 576000, 4410, 0x82f463ac +1, 567000, 4410, 0xad718eb4 0, 576000, 230400, 0xabf981ad -1, 585000, 4410, 0xfac87cac +1, 576000, 4410, 0x82f463ac 0, 585000, 230400, 0x5a8590cd -1, 594000, 4410, 0x9e8bcca7 +1, 585000, 4410, 0xfac87cac 0, 594000, 230400, 0x1bff853d -1, 603000, 4410, 0x52f79c99 +1, 594000, 4410, 0x9e8bcca7 0, 603000, 230400, 0x71d08055 -1, 612000, 4410, 0xf2d14de2 +1, 603000, 4410, 0x52f79c99 0, 612000, 230400, 0x2ebd817d -1, 621000, 4410, 0x367f95e1 +1, 612000, 4410, 0xf2d14de2 0, 621000, 230400, 0x6e838255 -1, 630000, 4410, 0x8bfac293 +1, 621000, 4410, 0x367f95e1 0, 630000, 230400, 0x043984cd -1, 639000, 4410, 0x01ea5040 +1, 630000, 4410, 0x8bfac293 0, 639000, 230400, 0x7ff18495 -1, 648000, 4410, 0x8ff5e212 +1, 639000, 4410, 0x01ea5040 0, 648000, 230400, 0xa43b8385 -1, 657000, 4410, 0x93f32824 +1, 648000, 4410, 0x8ff5e212 0, 657000, 230400, 0x72b5825d -1, 666000, 4410, 0x998f90dc +1, 657000, 4410, 0x93f32824 0, 666000, 230400, 0x3a178085 -1, 675000, 4410, 0x65231170 +1, 666000, 4410, 0x998f90dc 0, 675000, 230400, 0x67748245 -1, 684000, 4410, 0xc79039a1 +1, 675000, 4410, 0x65231170 0, 684000, 230400, 0xeddf81d5 -1, 693000, 4410, 0x0b0e58bd +1, 684000, 4410, 0xc79039a1 0, 693000, 230400, 0x8b088665 -1, 702000, 4410, 0xc24ab4fa +1, 693000, 4410, 0x0b0e58bd 0, 702000, 230400, 0x6c408e15 -1, 711000, 4410, 0xd3796a8e +1, 702000, 4410, 0xc24ab4fa 0, 711000, 230400, 0x81f196dd -1, 720000, 4410, 0xa37f8295 +1, 711000, 4410, 0xd3796a8e 0, 720000, 230400, 0xab9f953d -1, 729000, 4410, 0xb760fed7 +1, 720000, 4410, 0xa37f8295 0, 729000, 230400, 0xa5f69795 -1, 738000, 4410, 0x05495a34 +1, 729000, 4410, 0xb760fed7 0, 738000, 230400, 0xa772950d -1, 747000, 4410, 0x6f203437 +1, 738000, 4410, 0x05495a34 0, 747000, 230400, 0x6a5596d5 -1, 756000, 4410, 0x71299402 +1, 747000, 4410, 0x6f203437 0, 756000, 230400, 0x1355958d -1, 765000, 4410, 0x72e7b346 +1, 756000, 4410, 0x71299402 0, 765000, 230400, 0x4134981d -1, 774000, 4410, 0x879b0dae +1, 765000, 4410, 0x72e7b346 0, 774000, 230400, 0x8b929515 -1, 783000, 4410, 0x041aa1bd +1, 774000, 4410, 0x879b0dae 0, 783000, 230400, 0x482f95c5 -1, 792000, 4410, 0x18a962e6 +1, 783000, 4410, 0x041aa1bd 0, 792000, 230400, 0x7a9795d5 -1, 801000, 4410, 0x21d20539 +1, 792000, 4410, 0x18a962e6 0, 801000, 230400, 0x21c29abd -1, 810000, 4410, 0x8f449267 +1, 801000, 4410, 0x21d20539 0, 810000, 230400, 0x9ae6a475 -1, 819000, 4410, 0xecdc01d6 +1, 810000, 4410, 0x8f449267 0, 819000, 230400, 0x3734aee5 -1, 828000, 4410, 0x458abd5a +1, 819000, 4410, 0xecdc01d6 0, 828000, 230400, 0xa0a1b365 -1, 837000, 4410, 0xa070ea63 +1, 828000, 4410, 0x458abd5a 0, 837000, 230400, 0x2dcab1c5 -1, 846000, 4410, 0xc25b26ce +1, 837000, 4410, 0xa070ea63 0, 846000, 230400, 0x9c8b6c44 -1, 855000, 4410, 0x4d9237ca +1, 846000, 4410, 0xc25b26ce 0, 855000, 230400, 0x5da75feb -1, 864000, 4410, 0x748e1801 +1, 855000, 4410, 0x4d9237ca 0, 864000, 230400, 0x4d02f8e3 -1, 873000, 4410, 0xc96b69e6 +1, 864000, 4410, 0x748e1801 0, 873000, 230400, 0x66824f3a -1, 882000, 4410, 0x6663186c +1, 873000, 4410, 0xc96b69e6 0, 882000, 230400, 0x0c9257e2 -1, 891000, 4410, 0x7f6d3081 +1, 882000, 4410, 0x6663186c 0, 891000, 230400, 0xb2927092 -1, 900000, 4410, 0x1a0343b5 +1, 891000, 4410, 0x7f6d3081 0, 900000, 230400, 0xb5dc6e9a -1, 909000, 4410, 0xc48e338c +1, 900000, 4410, 0x1a0343b5 0, 909000, 230400, 0x6e567bc6 -1, 918000, 4410, 0x26fc03c8 +1, 909000, 4410, 0xc48e338c 0, 918000, 230400, 0xbf9e0f7a -1, 927000, 4410, 0x69be7e2d +1, 918000, 4410, 0x26fc03c8 0, 927000, 230400, 0xb16f684a -1, 936000, 4410, 0x69a74da1 +1, 927000, 4410, 0x69be7e2d 0, 936000, 230400, 0xf9e55e81 -1, 945000, 4410, 0x85bd2ab3 +1, 936000, 4410, 0x69a74da1 0, 945000, 230400, 0xd8d0bcba -1, 954000, 4410, 0xeff05426 +1, 945000, 4410, 0x85bd2ab3 0, 954000, 230400, 0x44720ac0 -1, 963000, 4410, 0x292829e0 +1, 954000, 4410, 0xeff05426 0, 963000, 230400, 0x7d4c2058 -1, 972000, 4410, 0x8f741798 +1, 963000, 4410, 0x292829e0 0, 972000, 230400, 0xb0973eb9 -1, 981000, 4410, 0x6b9337e9 +1, 972000, 4410, 0x8f741798 0, 981000, 230400, 0x405a13ce -1, 990000, 4410, 0xe4e1703f +1, 981000, 4410, 0x6b9337e9 0, 990000, 230400, 0x6422f00a -1, 999000, 4410, 0x043d6c35 +1, 990000, 4410, 0xe4e1703f 0, 999000, 230400, 0x924b6c1e -1, 1008000, 4410, 0x3a8988e7 +1, 999000, 4410, 0x043d6c35 0, 1008000, 230400, 0xcf7809c0 -1, 1017000, 4410, 0x1fa7d2a9 +1, 1008000, 4410, 0x3a8988e7 0, 1017000, 230400, 0x883a3863 -1, 1026000, 4410, 0xe28799e3 +1, 1017000, 4410, 0x1fa7d2a9 0, 1026000, 230400, 0x6adc9e03 -1, 1035000, 4410, 0xc2df4470 +1, 1026000, 4410, 0xe28799e3 0, 1035000, 230400, 0x4f5ab7a8 -1, 1044000, 4410, 0x694d0cf5 +1, 1035000, 4410, 0xc2df4470 0, 1044000, 230400, 0xdc0aab94 +1, 1044000, 4410, 0x694d0cf5 1, 1053000, 4410, 0x5aac2dcf 1, 1062000, 4410, 0x259fa2db 1, 1071000, 4410, 0xd16d6803 diff --git a/tests/ref/fate/siff b/tests/ref/fate/siff index 2f67254b5d..05c12c2088 100644 --- a/tests/ref/fate/siff +++ b/tests/ref/fate/siff @@ -1,5 +1,5 @@ -1, 0, 44100, 0xd0a49e09 0, 0, 230400, 0x3bd1d731 +1, 0, 44100, 0xd0a49e09 0, 7500, 230400, 0x9d0774c3 0, 15000, 230400, 0xa0faafe2 0, 22500, 230400, 0x38325309 @@ -11,8 +11,8 @@ 0, 67500, 230400, 0x07178dd9 0, 75000, 230400, 0xf52b8db4 0, 82500, 230400, 0x2b70c1dc -1, 90000, 44100, 0xf151af4d 0, 90000, 230400, 0x8157a6e9 +1, 90000, 44100, 0xf151af4d 0, 97500, 230400, 0xd4a3c357 0, 105000, 230400, 0x703861bb 0, 112500, 230400, 0xa13cf75e @@ -24,8 +24,8 @@ 0, 157500, 230400, 0x22050962 0, 165000, 230400, 0x0f5c8a0d 0, 172500, 230400, 0x3475df44 -1, 180000, 44100, 0xecd3cd08 0, 180000, 230400, 0x65354e06 +1, 180000, 44100, 0xecd3cd08 0, 187500, 230400, 0xb9a01978 0, 195000, 230400, 0x15207ee1 0, 202500, 230400, 0x3b214f0b diff --git a/tests/ref/fate/tiertex-seq b/tests/ref/fate/tiertex-seq index e4ebf5a207..6aa7fc7b9f 100644 --- a/tests/ref/fate/tiertex-seq +++ b/tests/ref/fate/tiertex-seq @@ -1,147 +1,147 @@ -1, 0, 1764, 0x00000000 0, 0, 98304, 0x2e5db4a4 -1, 3600, 1764, 0x80a253d9 +1, 0, 1764, 0x00000000 0, 3600, 98304, 0xb20c19d0 -1, 7200, 1764, 0x95a16721 +1, 3600, 1764, 0x80a253d9 0, 7200, 98304, 0xb20c19d0 -1, 10800, 1764, 0x0f0d4cb6 +1, 7200, 1764, 0x95a16721 0, 10800, 98304, 0xb20c19d0 -1, 14400, 1764, 0x75026779 +1, 10800, 1764, 0x0f0d4cb6 0, 14400, 98304, 0x6b8538c0 -1, 18000, 1764, 0xb4356e37 +1, 14400, 1764, 0x75026779 0, 18000, 98304, 0x6b8538c0 -1, 21600, 1764, 0xfafa64cb +1, 18000, 1764, 0xb4356e37 0, 21600, 98304, 0x6b8538c0 -1, 25200, 1764, 0xe8fd7970 +1, 21600, 1764, 0xfafa64cb 0, 25200, 98304, 0x172207e3 -1, 28800, 1764, 0x666879b7 +1, 25200, 1764, 0xe8fd7970 0, 28800, 98304, 0x172207e3 -1, 32400, 1764, 0xf2cd7770 +1, 28800, 1764, 0x666879b7 0, 32400, 98304, 0x172207e3 -1, 36000, 1764, 0x54317a1c +1, 32400, 1764, 0xf2cd7770 0, 36000, 98304, 0x172207e3 -1, 39600, 1764, 0x9c396930 +1, 36000, 1764, 0x54317a1c 0, 39600, 98304, 0x63fb7dc1 -1, 43200, 1764, 0x87115ec4 +1, 39600, 1764, 0x9c396930 0, 43200, 98304, 0x63fb7dc1 -1, 46800, 1764, 0x0c9b69b6 +1, 43200, 1764, 0x87115ec4 0, 46800, 98304, 0x63fb7dc1 -1, 50400, 1764, 0x8c3a758a +1, 46800, 1764, 0x0c9b69b6 0, 50400, 98304, 0x37cf1601 -1, 54000, 1764, 0x605d776a +1, 50400, 1764, 0x8c3a758a 0, 54000, 98304, 0x37cf1601 -1, 57600, 1764, 0x0556852d +1, 54000, 1764, 0x605d776a 0, 57600, 98304, 0x37cf1601 -1, 61200, 1764, 0x7d4363f8 +1, 57600, 1764, 0x0556852d 0, 61200, 98304, 0x37cf1601 -1, 64800, 1764, 0xc5cd75d0 +1, 61200, 1764, 0x7d4363f8 0, 64800, 98304, 0x82941990 -1, 68400, 1764, 0x3ff3646d +1, 64800, 1764, 0xc5cd75d0 0, 68400, 98304, 0x82941990 -1, 72000, 1764, 0x10136d25 +1, 68400, 1764, 0x3ff3646d 0, 72000, 98304, 0x82941990 -1, 75600, 1764, 0xeb1a6cd0 +1, 72000, 1764, 0x10136d25 0, 75600, 98304, 0x82941990 -1, 79200, 1764, 0xef937ed1 +1, 75600, 1764, 0xeb1a6cd0 0, 79200, 98304, 0xe0a5309e -1, 82800, 1764, 0x2d2b6f79 +1, 79200, 1764, 0xef937ed1 0, 82800, 98304, 0xe0a5309e -1, 86400, 1764, 0x6f457231 +1, 82800, 1764, 0x2d2b6f79 0, 86400, 98304, 0xe0a5309e -1, 90000, 1764, 0x56267c9d +1, 86400, 1764, 0x6f457231 0, 90000, 98304, 0x164cb67d -1, 93600, 1764, 0xd49e79c8 +1, 90000, 1764, 0x56267c9d 0, 93600, 98304, 0x164cb67d -1, 97200, 1764, 0xc726703d +1, 93600, 1764, 0xd49e79c8 0, 97200, 98304, 0x164cb67d -1, 100800, 1764, 0x2abf8074 +1, 97200, 1764, 0xc726703d 0, 100800, 98304, 0x164cb67d -1, 104400, 1764, 0xb50c556d +1, 100800, 1764, 0x2abf8074 0, 104400, 98304, 0xed2189f8 -1, 108000, 1764, 0xc1f2523c +1, 104400, 1764, 0xb50c556d 0, 108000, 98304, 0xed2189f8 -1, 111600, 1764, 0x850a6f93 +1, 108000, 1764, 0xc1f2523c 0, 111600, 98304, 0xed2189f8 -1, 115200, 1764, 0x8da76c31 +1, 111600, 1764, 0x850a6f93 0, 115200, 98304, 0x7215e529 -1, 118800, 1764, 0xfcccdf13 +1, 115200, 1764, 0x8da76c31 0, 118800, 98304, 0x7215e529 -1, 122400, 1764, 0x00000000 +1, 118800, 1764, 0xfcccdf13 0, 122400, 98304, 0x7215e529 -1, 126000, 1764, 0x00000000 +1, 122400, 1764, 0x00000000 0, 126000, 98304, 0x7215e529 -1, 129600, 1764, 0x00000000 +1, 126000, 1764, 0x00000000 0, 129600, 98304, 0x170c783b -1, 133200, 1764, 0x00000000 +1, 129600, 1764, 0x00000000 0, 133200, 98304, 0x170c783b -1, 136800, 1764, 0x00000000 +1, 133200, 1764, 0x00000000 0, 136800, 98304, 0x170c783b -1, 140400, 1764, 0x00000000 +1, 136800, 1764, 0x00000000 0, 140400, 98304, 0xf6bd74c7 -1, 144000, 1764, 0x00000000 +1, 140400, 1764, 0x00000000 0, 144000, 98304, 0xf6bd74c7 -1, 147600, 1764, 0x00000000 +1, 144000, 1764, 0x00000000 0, 147600, 98304, 0xf6bd74c7 -1, 151200, 1764, 0x00000000 +1, 147600, 1764, 0x00000000 0, 151200, 98304, 0xf6bd74c7 -1, 154800, 1764, 0x00000000 +1, 151200, 1764, 0x00000000 0, 154800, 98304, 0x1efd38c4 -1, 158400, 1764, 0x00000000 +1, 154800, 1764, 0x00000000 0, 158400, 98304, 0x1efd38c4 -1, 162000, 1764, 0x00000000 +1, 158400, 1764, 0x00000000 0, 162000, 98304, 0x1efd38c4 -1, 165600, 1764, 0x00000000 +1, 162000, 1764, 0x00000000 0, 165600, 98304, 0x1efd38c4 -1, 169200, 1764, 0x00000000 +1, 165600, 1764, 0x00000000 0, 169200, 98304, 0x29c26bba -1, 172800, 1764, 0x00000000 +1, 169200, 1764, 0x00000000 0, 172800, 98304, 0x29c26bba -1, 176400, 1764, 0x00000000 +1, 172800, 1764, 0x00000000 0, 176400, 98304, 0x29c26bba -1, 180000, 1764, 0x00000000 +1, 176400, 1764, 0x00000000 0, 180000, 98304, 0x880a6313 -1, 183600, 1764, 0x00000000 +1, 180000, 1764, 0x00000000 0, 183600, 98304, 0x880a6313 -1, 187200, 1764, 0x00000000 +1, 183600, 1764, 0x00000000 0, 187200, 98304, 0x880a6313 -1, 190800, 1764, 0x00000000 +1, 187200, 1764, 0x00000000 0, 190800, 98304, 0x880a6313 -1, 194400, 1764, 0x00000000 +1, 190800, 1764, 0x00000000 0, 194400, 98304, 0x73f5bb00 -1, 198000, 1764, 0x00000000 +1, 194400, 1764, 0x00000000 0, 198000, 98304, 0x73f5bb00 -1, 201600, 1764, 0x00000000 +1, 198000, 1764, 0x00000000 0, 201600, 98304, 0x73f5bb00 -1, 205200, 1764, 0x00000000 +1, 201600, 1764, 0x00000000 0, 205200, 98304, 0xc85b19ec -1, 208800, 1764, 0x00000000 +1, 205200, 1764, 0x00000000 0, 208800, 98304, 0xc85b19ec -1, 212400, 1764, 0x00000000 +1, 208800, 1764, 0x00000000 0, 212400, 98304, 0xc85b19ec -1, 216000, 1764, 0x00000000 +1, 212400, 1764, 0x00000000 0, 216000, 98304, 0xc85b19ec -1, 219600, 1764, 0x00000000 +1, 216000, 1764, 0x00000000 0, 219600, 98304, 0x00000000 -1, 223200, 1764, 0x00000000 +1, 219600, 1764, 0x00000000 0, 223200, 98304, 0x00000000 -1, 226800, 1764, 0x00000000 +1, 223200, 1764, 0x00000000 0, 226800, 98304, 0x00000000 -1, 230400, 1764, 0x00000000 +1, 226800, 1764, 0x00000000 0, 230400, 98304, 0x00000000 -1, 234000, 1764, 0x00000000 +1, 230400, 1764, 0x00000000 0, 234000, 98304, 0x00000000 -1, 237600, 1764, 0x00000000 +1, 234000, 1764, 0x00000000 0, 237600, 98304, 0x00000000 -1, 241200, 1764, 0x00000000 +1, 237600, 1764, 0x00000000 0, 241200, 98304, 0x00000000 -1, 244800, 1764, 0x00000000 +1, 241200, 1764, 0x00000000 0, 244800, 98304, 0x00000000 -1, 248400, 1764, 0x00000000 +1, 244800, 1764, 0x00000000 0, 248400, 98304, 0x00000000 -1, 252000, 1764, 0x00000000 +1, 248400, 1764, 0x00000000 0, 252000, 98304, 0x00000000 -1, 255600, 1764, 0x00000000 +1, 252000, 1764, 0x00000000 0, 255600, 98304, 0x00000000 +1, 255600, 1764, 0x00000000 1, 259200, 1764, 0x00000000 1, 262800, 1764, 0x00000000 1, 266400, 1764, 0x00000000 diff --git a/tests/ref/fate/truemotion1-15 b/tests/ref/fate/truemotion1-15 index 747fcb1551..d103f01970 100644 --- a/tests/ref/fate/truemotion1-15 +++ b/tests/ref/fate/truemotion1-15 @@ -1,5 +1,5 @@ -1, 0, 10832, 0xe1a811fa 0, 0, 161280, 0x7041748d +1, 0, 10832, 0xe1a811fa 1, 5527, 10832, 0xb47841f9 0, 6000, 161280, 0x3cc4dfb5 1, 11053, 10832, 0x839eedf1 diff --git a/tests/ref/fate/truemotion1-24 b/tests/ref/fate/truemotion1-24 index a4e1203094..b0b1c4e44e 100644 --- a/tests/ref/fate/truemotion1-24 +++ b/tests/ref/fate/truemotion1-24 @@ -1,5 +1,5 @@ -1, 0, 10832, 0x1597b4c8 0, 0, 69120, 0x68beb30f +1, 0, 10832, 0x1597b4c8 1, 5527, 10832, 0xf9479f8b 0, 6000, 69120, 0x3976f5cf 1, 11053, 10832, 0x8db50e74 diff --git a/tests/ref/fate/tscc-15bit b/tests/ref/fate/tscc-15bit index fb4d558e0c..bc55f0fc50 100644 --- a/tests/ref/fate/tscc-15bit +++ b/tests/ref/fate/tscc-15bit @@ -1,5 +1,5 @@ -1, 0, 22050, 0x1740aaec 0, 0, 657600, 0xaf456809 +1, 0, 22050, 0x1740aaec 0, 6000, 657600, 0xaf456809 0, 12000, 657600, 0xaf456809 0, 18000, 657600, 0x2dbe6889 @@ -14,8 +14,8 @@ 0, 72000, 657600, 0x2dbe6889 0, 78000, 657600, 0x2dbe6889 0, 84000, 657600, 0x2dbe6889 -1, 90000, 22050, 0x75ed6086 0, 90000, 657600, 0x2dbe6889 +1, 90000, 22050, 0x75ed6086 0, 96000, 657600, 0x2dbe6889 0, 102000, 657600, 0x2dbe6889 0, 108000, 657600, 0x2dbe6889 @@ -30,8 +30,8 @@ 0, 162000, 657600, 0x64cb6889 0, 168000, 657600, 0x64cb6889 0, 174000, 657600, 0x64cb6889 -1, 180000, 22050, 0xca52a4e9 0, 180000, 657600, 0x42036b71 +1, 180000, 22050, 0xca52a4e9 0, 186000, 657600, 0x42036b71 0, 192000, 657600, 0x42036b71 0, 198000, 657600, 0xc40a6889 @@ -46,8 +46,8 @@ 0, 252000, 657600, 0x22d10de0 0, 258000, 657600, 0xa75f0d60 0, 264000, 657600, 0x7a440be0 -1, 270000, 22050, 0xb306d419 0, 270000, 657600, 0x40095d50 +1, 270000, 22050, 0xb306d419 0, 276000, 657600, 0x40095d50 0, 282000, 657600, 0x64766320 0, 288000, 657600, 0x64766320 @@ -62,8 +62,8 @@ 0, 342000, 657600, 0xf51adc49 0, 348000, 657600, 0xf51adc49 0, 354000, 657600, 0xf51adc49 -1, 360000, 22050, 0x8cbb9625 0, 360000, 657600, 0xdd47af59 +1, 360000, 22050, 0x8cbb9625 0, 366000, 657600, 0xdd47af59 0, 372000, 657600, 0xffa8acf1 0, 378000, 657600, 0x5994b059 @@ -78,8 +78,8 @@ 0, 432000, 657600, 0xbe37b549 0, 438000, 657600, 0xbe37b549 0, 444000, 657600, 0x1d395bf9 -1, 450000, 22050, 0x34a11f66 0, 450000, 657600, 0x1d395bf9 +1, 450000, 22050, 0x34a11f66 0, 456000, 657600, 0x1d395bf9 0, 462000, 657600, 0x1d395bf9 0, 468000, 657600, 0x2ec36f37 @@ -94,8 +94,8 @@ 0, 522000, 657600, 0x70064801 0, 528000, 657600, 0x80d54519 0, 534000, 657600, 0xe8c942b1 -1, 540000, 22050, 0x1ae81230 0, 540000, 657600, 0x830d8c24 +1, 540000, 22050, 0x1ae81230 0, 546000, 657600, 0x830d8c24 0, 552000, 657600, 0x830d8c24 0, 558000, 657600, 0xf3c4707c @@ -110,8 +110,8 @@ 0, 612000, 657600, 0x221ceecf 0, 618000, 657600, 0x221ceecf 0, 624000, 657600, 0x221ceecf -1, 630000, 22050, 0x1217eeba 0, 630000, 657600, 0x221ceecf +1, 630000, 22050, 0x1217eeba 0, 636000, 657600, 0x221ceecf 0, 642000, 657600, 0x221ceecf 0, 648000, 657600, 0x3bf6f39f @@ -126,8 +126,8 @@ 0, 702000, 657600, 0x41f6218d 0, 708000, 657600, 0x41f6218d 0, 714000, 657600, 0x41f6218d -1, 720000, 22050, 0x50e70baa 0, 720000, 657600, 0xff43ec36 +1, 720000, 22050, 0x50e70baa 0, 726000, 657600, 0x0b10eb16 0, 732000, 657600, 0x0b10eb16 0, 738000, 657600, 0xbdf41aa5 @@ -142,8 +142,8 @@ 0, 792000, 657600, 0x3d4ccf06 0, 798000, 657600, 0x0897d1de 0, 804000, 657600, 0x0897d1de -1, 810000, 22050, 0xb19e89c0 0, 810000, 657600, 0x3e27e01e +1, 810000, 22050, 0xb19e89c0 0, 816000, 657600, 0x3e27e01e 0, 822000, 657600, 0x3e27e01e 0, 828000, 657600, 0x3e27e01e @@ -158,8 +158,8 @@ 0, 882000, 657600, 0xe9967a40 0, 888000, 657600, 0xe9967a40 0, 894000, 657600, 0xe9967a40 -1, 900000, 22050, 0x78526696 0, 900000, 657600, 0x726cb6b8 +1, 900000, 22050, 0x78526696 0, 906000, 657600, 0x2960b6e8 0, 912000, 657600, 0x2960b6e8 0, 918000, 657600, 0x1637d6c8 @@ -174,8 +174,8 @@ 0, 972000, 657600, 0xdfa0d6c8 0, 978000, 657600, 0xdfa0d6c8 0, 984000, 657600, 0xdfa0d6c8 -1, 990000, 22050, 0x48e3bb21 0, 990000, 657600, 0xdfa0d6c8 +1, 990000, 22050, 0x48e3bb21 0, 996000, 657600, 0xdfa0d6c8 0, 1002000, 657600, 0xdfa0d6c8 0, 1008000, 657600, 0xdfa0d6c8 @@ -190,8 +190,8 @@ 0, 1062000, 657600, 0x85e87a68 0, 1068000, 657600, 0x85e87a68 0, 1074000, 657600, 0x85e87a68 -1, 1080000, 22050, 0xbc32204a 0, 1080000, 657600, 0xb0a141a8 +1, 1080000, 22050, 0xbc32204a 0, 1086000, 657600, 0xb0a141a8 0, 1092000, 657600, 0xf3333bd8 0, 1098000, 657600, 0xea090688 @@ -206,8 +206,8 @@ 0, 1152000, 657600, 0xf1d2874a 0, 1158000, 657600, 0xf1d2874a 0, 1164000, 657600, 0xf1d2874a -1, 1170000, 22050, 0xdf6f1e46 0, 1170000, 657600, 0xa58d6742 +1, 1170000, 22050, 0xdf6f1e46 0, 1176000, 657600, 0xa58d6742 0, 1182000, 657600, 0xa58d6742 0, 1188000, 657600, 0xb0cd11bb @@ -222,8 +222,8 @@ 0, 1242000, 657600, 0x97ac10bb 0, 1248000, 657600, 0x97ac10bb 0, 1254000, 657600, 0xe8b30dd3 -1, 1260000, 22050, 0x4c91da9d 0, 1260000, 657600, 0x3d0c10bb +1, 1260000, 22050, 0x4c91da9d 0, 1266000, 657600, 0x8d2b0dd3 0, 1272000, 657600, 0x8d2b0dd3 0, 1278000, 657600, 0xa5760dd3 diff --git a/tests/ref/fate/vqa-cc b/tests/ref/fate/vqa-cc index 5ad2916711..d7d7f10e9f 100644 --- a/tests/ref/fate/vqa-cc +++ b/tests/ref/fate/vqa-cc @@ -1,5 +1,5 @@ -1, 0, 22048, 0x0665d7f4 0, 0, 192000, 0x00000000 +1, 0, 22048, 0x0665d7f4 0, 6000, 192000, 0x00000000 0, 12000, 192000, 0x00000000 0, 18000, 192000, 0x00000000 diff --git a/tests/ref/fate/wmv8-drm-nodec b/tests/ref/fate/wmv8-drm-nodec index 69bd752eb0..1a70fa5c64 100644 --- a/tests/ref/fate/wmv8-drm-nodec +++ b/tests/ref/fate/wmv8-drm-nodec @@ -1,5 +1,5 @@ -1, 0, 1088, 0x5cd379bb 0, 0, 282, 0x000d949a +1, 0, 1088, 0x5cd379bb 1, 39150, 1088, 0x8dfa1368 1, 66600, 1088, 0xc0d211be 1, 92070, 1088, 0x8238113a diff --git a/tests/ref/lavf/avi b/tests/ref/lavf/avi index cf47755ab7..bba0f6f854 100644 --- a/tests/ref/lavf/avi +++ b/tests/ref/lavf/avi @@ -1,3 +1,3 @@ -7e5e4db8c04f0acd16cff6b30e60d0e5 *./tests/data/lavf/lavf.avi +f8b3e77a1430c348dc06472571d37191 *./tests/data/lavf/lavf.avi 331032 ./tests/data/lavf/lavf.avi ./tests/data/lavf/lavf.avi CRC=0x2a83e6b0 diff --git a/tests/ref/lavf/gxf b/tests/ref/lavf/gxf index 4535d9a3ab..6b39c2f273 100644 --- a/tests/ref/lavf/gxf +++ b/tests/ref/lavf/gxf @@ -1,3 +1,3 @@ 346d38d330ab5cb0caa6b5537167bc0d *./tests/data/lavf/lavf.gxf 796392 ./tests/data/lavf/lavf.gxf -./tests/data/lavf/lavf.gxf CRC=0xad9e86eb +./tests/data/lavf/lavf.gxf CRC=0x345f86eb diff --git a/tests/ref/lavf/mpg b/tests/ref/lavf/mpg index 13f95a0f1a..b81cb8a8de 100644 --- a/tests/ref/lavf/mpg +++ b/tests/ref/lavf/mpg @@ -1,3 +1,3 @@ dd60652c2193670abffb8c2a123a820e *./tests/data/lavf/lavf.mpg 372736 ./tests/data/lavf/lavf.mpg -./tests/data/lavf/lavf.mpg CRC=0x2b39ed74 +./tests/data/lavf/lavf.mpg CRC=0xf361ed74 diff --git a/tests/ref/lavf/mxf b/tests/ref/lavf/mxf index ac556f5c5d..58e75d17cd 100644 --- a/tests/ref/lavf/mxf +++ b/tests/ref/lavf/mxf @@ -1,6 +1,6 @@ 785e38ddd2466046f30aa36399b8f8fa *./tests/data/lavf/lavf.mxf 525881 ./tests/data/lavf/lavf.mxf -./tests/data/lavf/lavf.mxf CRC=0xb6aa0849 +./tests/data/lavf/lavf.mxf CRC=0x4ace0849 b3174e2db508564c1cce0b5e3c1bc1bd *./tests/data/lavf/lavf.mxf_d10 5330989 ./tests/data/lavf/lavf.mxf_d10 ./tests/data/lavf/lavf.mxf_d10 CRC=0xc3f4f92e diff --git a/tests/ref/lavf/nut b/tests/ref/lavf/nut index 461b18587c..6bf659db5c 100644 --- a/tests/ref/lavf/nut +++ b/tests/ref/lavf/nut @@ -1,3 +1,3 @@ -16b9d2cf8effb7dae316c6b9248a49b7 *./tests/data/lavf/lavf.nut +df1eab0853a22713cf4172acbf1a6b4b *./tests/data/lavf/lavf.nut 319888 ./tests/data/lavf/lavf.nut ./tests/data/lavf/lavf.nut CRC=0x2a83e6b0 diff --git a/tests/ref/seek/lavf_avi b/tests/ref/seek/lavf_avi index 964f0b8b6f..03fa47dc71 100644 --- a/tests/ref/seek/lavf_avi +++ b/tests/ref/seek/lavf_avi @@ -2,43 +2,43 @@ ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 9908 size: 27867 ret: 0 st:-1 flags:0 ts:-1.000000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 9908 size: 27867 ret: 0 st:-1 flags:1 ts: 1.894167 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301466 size: 27864 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301248 size: 27864 ret: 0 st: 0 flags:0 ts: 0.800000 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301466 size: 27864 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301248 size: 27864 ret:-1 st: 0 flags:1 ts:-0.320000 ret:-1 st: 1 flags:0 ts: 2.586122 ret: 0 st: 1 flags:1 ts: 1.462857 ret: 0 st: 1 flags:1 dts: 1.018776 pts: 1.018776 pos: 329774 size: 209 ret: 0 st:-1 flags:0 ts: 0.365002 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 156166 size: 27955 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 155948 size: 27955 ret:-1 st:-1 flags:1 ts:-0.740831 ret:-1 st: 0 flags:0 ts: 2.160000 ret: 0 st: 0 flags:1 ts: 1.040000 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301466 size: 27864 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301248 size: 27864 ret: 0 st: 1 flags:0 ts:-0.052245 ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 37784 size: 208 ret: 0 st: 1 flags:1 ts: 2.847347 ret: 0 st: 1 flags:1 dts: 1.018776 pts: 1.018776 pos: 329774 size: 209 ret:-1 st:-1 flags:0 ts: 1.730004 ret: 0 st:-1 flags:1 ts: 0.624171 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 156166 size: 27955 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 155948 size: 27955 ret: 0 st: 0 flags:0 ts:-0.480000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 9908 size: 27867 ret: 0 st: 0 flags:1 ts: 2.400000 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301466 size: 27864 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301248 size: 27864 ret:-1 st: 1 flags:0 ts: 1.306122 ret: 0 st: 1 flags:1 ts: 0.208980 ret: 0 st: 1 flags:1 dts: 0.208980 pts: 0.208980 pos: 92800 size: 209 ret: 0 st:-1 flags:0 ts:-0.904994 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 9908 size: 27867 ret: 0 st:-1 flags:1 ts: 1.989173 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301466 size: 27864 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301248 size: 27864 ret: 0 st: 0 flags:0 ts: 0.880000 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301466 size: 27864 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301248 size: 27864 ret:-1 st: 0 flags:1 ts:-0.240000 ret:-1 st: 1 flags:0 ts: 2.664490 ret: 0 st: 1 flags:1 ts: 1.567347 ret: 0 st: 1 flags:1 dts: 1.018776 pts: 1.018776 pos: 329774 size: 209 ret: 0 st:-1 flags:0 ts: 0.460008 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 156166 size: 27955 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 155948 size: 27955 ret:-1 st:-1 flags:1 ts:-0.645825 diff --git a/tests/ref/seek/lavf_nut b/tests/ref/seek/lavf_nut index fc3ef63f1e..a0714f46c6 100644 --- a/tests/ref/seek/lavf_nut +++ b/tests/ref/seek/lavf_nut @@ -2,52 +2,52 @@ ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 279 size: 27837 ret: 0 st:-1 flags:0 ts:-1.000000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 279 size: 27837 ret: 0 st:-1 flags:1 ts: 1.894167 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146121 size: 27925 ret: 0 st: 0 flags:0 ts: 0.800000 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146121 size: 27925 ret: 0 st: 0 flags:1 ts:-0.320000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 279 size: 27837 ret: 0 st: 1 flags:0 ts: 2.586122 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146121 size: 27925 ret: 0 st: 1 flags:1 ts: 1.462857 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146121 size: 27925 ret: 0 st:-1 flags:0 ts: 0.365002 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 279 size: 27837 ret: 0 st:-1 flags:1 ts:-0.740831 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 279 size: 27837 ret: 0 st: 0 flags:0 ts: 2.160000 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146121 size: 27925 ret: 0 st: 0 flags:1 ts: 1.040000 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146121 size: 27925 ret: 0 st: 1 flags:0 ts:-0.052245 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 279 size: 27837 ret: 0 st: 1 flags:1 ts: 2.847347 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146121 size: 27925 ret: 0 st:-1 flags:0 ts: 1.730004 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146121 size: 27925 ret: 0 st:-1 flags:1 ts: 0.624171 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146121 size: 27925 ret: 0 st: 0 flags:0 ts:-0.480000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 279 size: 27837 ret: 0 st: 0 flags:1 ts: 2.400000 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146121 size: 27925 ret: 0 st: 1 flags:0 ts: 1.306122 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146121 size: 27925 ret: 0 st: 1 flags:1 ts: 0.208980 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 279 size: 27837 ret: 0 st:-1 flags:0 ts:-0.904994 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 279 size: 27837 ret: 0 st:-1 flags:1 ts: 1.989173 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146121 size: 27925 ret: 0 st: 0 flags:0 ts: 0.880000 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146121 size: 27925 ret: 0 st: 0 flags:1 ts:-0.240000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 279 size: 27837 ret: 0 st: 1 flags:0 ts: 2.664490 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146121 size: 27925 ret: 0 st: 1 flags:1 ts: 1.567347 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146121 size: 27925 ret: 0 st:-1 flags:0 ts: 0.460008 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146121 size: 27925 ret: 0 st:-1 flags:1 ts:-0.645825 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 279 size: 27837 From d2940155106c21f04d5a609db7cf655fe1d8d8b1 Mon Sep 17 00:00:00 2001 From: Alberto Delmas Date: Mon, 12 Apr 2010 23:16:12 +0200 Subject: [PATCH 02/32] Check for successful h263 init in msmpeg4 init Signed-off-by: Ronald S. Bultje --- libavcodec/msmpeg4.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c index 3b40c835b1..0dba8d9c35 100644 --- a/libavcodec/msmpeg4.c +++ b/libavcodec/msmpeg4.c @@ -1279,7 +1279,8 @@ av_cold int ff_msmpeg4_decode_init(AVCodecContext *avctx) int i; MVTable *mv; - ff_h263_decode_init(avctx); + if (ff_h263_decode_init(avctx) < 0) + return -1; common_init(s); From cbea3ac8203690dec29c473399a50f8f6bb76c47 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 13 Apr 2011 07:35:35 +0200 Subject: [PATCH 03/32] avio: left-shift AVIO_ flags on next bump Now AVIO_RDONLY is defined as 0, so it's not usable as a flag. --- libavformat/avio.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libavformat/avio.h b/libavformat/avio.h index b980d491ae..a4109a2996 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -537,9 +537,15 @@ int url_resetbuf(AVIOContext *s, int flags); * constants, optionally ORed with other flags. * @{ */ +#if LIBAVFORMAT_VERSION_MAJOR < 53 #define AVIO_RDONLY 0 /**< read-only */ #define AVIO_WRONLY 1 /**< write-only */ #define AVIO_RDWR 2 /**< read-write */ +#else +#define AVIO_RDONLY 1 /**< read-only */ +#define AVIO_WRONLY 2 /**< write-only */ +#define AVIO_RDWR 4 /**< read-write */ +#endif /** * @} */ @@ -556,7 +562,11 @@ int url_resetbuf(AVIOContext *s, int flags); * Warning: non-blocking protocols is work-in-progress; this flag may be * silently ignored. */ +#if LIBAVFORMAT_VERSION_MAJOR < 53 #define AVIO_FLAG_NONBLOCK 4 +#else +#define AVIO_FLAG_NONBLOCK 8 +#endif /** * Create and initialize a AVIOContext for accessing the From 175389c85487822f1ee180ee01cc770df896557f Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Fri, 8 Apr 2011 18:32:25 +0200 Subject: [PATCH 04/32] avio: add avio_check() The new function is more flexible than url_exist(), as it allows to specify which access flags to check, and does not require an explicit open of the checked resource. Signed-off-by: Anton Khirnov --- libavformat/avio.c | 19 +++++++++++++++++++ libavformat/avio.h | 18 ++++++++++++++++++ libavformat/url.h | 1 + 3 files changed, 38 insertions(+) diff --git a/libavformat/avio.c b/libavformat/avio.c index ad1f1b40c2..18b2ee6c22 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -374,6 +374,25 @@ int url_exist(const char *filename) return 1; } +int avio_check(const char *url, int flags) +{ + URLContext *h; + int ret = ffurl_alloc(&h, url, flags); + if (ret) + return ret; + + if (h->prot->url_check) { + ret = h->prot->url_check(h, flags); + } else { + ret = ffurl_connect(h); + if (ret >= 0) + ret = flags; + } + + ffurl_close(h); + return ret; +} + int64_t ffurl_size(URLContext *h) { int64_t pos, size; diff --git a/libavformat/avio.h b/libavformat/avio.h index a4109a2996..14aa599fe0 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -134,6 +134,7 @@ typedef struct URLProtocol { int priv_data_size; const AVClass *priv_data_class; int flags; + int (*url_check)(URLContext *h, int mask); } URLProtocol; typedef struct URLPollEntry { @@ -346,6 +347,23 @@ attribute_deprecated int url_close_buf(AVIOContext *s); */ int url_exist(const char *url); +/** + * Return AVIO_* access flags corresponding to the access permissions + * of the resource in url, or a negative value corresponding to an + * AVERROR code in case of failure. The returned access flags are + * masked by the value in flags. + * + * @note This function is intrinsically unsafe, in the sense that the + * checked resource may change its existence or permission status from + * one call to another. Thus you should not trust the returned value, + * unless you are sure that no other processes are accessing the + * checked resource. + * + * @note This function is slightly broken until next major bump + * because of AVIO_RDONLY == 0. Don't use it until then. + */ +int avio_check(const char *url, int flags); + /** * The callback is called in blocking functions to test regulary if * asynchronous interruption is needed. AVERROR_EXIT is returned diff --git a/libavformat/url.h b/libavformat/url.h index bde06d91da..c5732c64c6 100644 --- a/libavformat/url.h +++ b/libavformat/url.h @@ -59,6 +59,7 @@ typedef struct URLProtocol { int priv_data_size; const AVClass *priv_data_class; int flags; + int (*url_check)(URLContext *h, int mask); } URLProtocol; #endif From 313176565cf813a1a9cd5b8bc3f59c0b9696390e Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Thu, 30 Sep 2010 13:21:42 +0200 Subject: [PATCH 05/32] file: implement url_check() callback in the file and pipe protocols Signed-off-by: Anton Khirnov --- libavformat/file.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libavformat/file.c b/libavformat/file.c index 31067ede69..1dcb2c8ac5 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -95,6 +95,20 @@ static int file_close(URLContext *h) return close(fd); } +static int file_check(URLContext *h, int mask) +{ + struct stat st; + int ret = stat(h->filename, &st); + if (ret < 0) + return AVERROR(errno); + + ret |= st.st_mode&S_IRUSR ? mask&AVIO_RDONLY : 0; + ret |= st.st_mode&S_IWUSR ? mask&AVIO_WRONLY : 0; + ret |= st.st_mode&S_IWUSR && st.st_mode&S_IRUSR ? mask&AVIO_RDWR : 0; + + return ret; +} + URLProtocol ff_file_protocol = { .name = "file", .url_open = file_open, @@ -103,6 +117,7 @@ URLProtocol ff_file_protocol = { .url_seek = file_seek, .url_close = file_close, .url_get_file_handle = file_get_handle, + .url_check = file_check, }; #endif /* CONFIG_FILE_PROTOCOL */ @@ -137,6 +152,7 @@ URLProtocol ff_pipe_protocol = { .url_read = file_read, .url_write = file_write, .url_get_file_handle = file_get_handle, + .url_check = file_check, }; #endif /* CONFIG_PIPE_PROTOCOL */ From 4bde56d1afdeb5d8c998bb9f994b0ea829ccf753 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 12 Apr 2011 09:46:45 +0200 Subject: [PATCH 06/32] avio: deprecate url_exist in favor of avio_check. --- libavformat/avio.c | 2 ++ libavformat/avio.h | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libavformat/avio.c b/libavformat/avio.c index 18b2ee6c22..cb923a726e 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -365,6 +365,7 @@ int ffurl_close(URLContext *h) return ret; } +#if FF_API_OLD_AVIO int url_exist(const char *filename) { URLContext *h; @@ -373,6 +374,7 @@ int url_exist(const char *filename) ffurl_close(h); return 1; } +#endif int avio_check(const char *url, int flags) { diff --git a/libavformat/avio.h b/libavformat/avio.h index 14aa599fe0..f4674a43be 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -339,13 +339,14 @@ attribute_deprecated int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_siz /** return the written or read size */ attribute_deprecated int url_close_buf(AVIOContext *s); -#endif // FF_API_OLD_AVIO /** * Return a non-zero value if the resource indicated by url * exists, 0 otherwise. + * @deprecated Use avio_check instead. */ -int url_exist(const char *url); +attribute_deprecated int url_exist(const char *url); +#endif // FF_API_OLD_AVIO /** * Return AVIO_* access flags corresponding to the access permissions From 86a89ae3f2de76f09cd41942eaabde37c13342c3 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 12 Apr 2011 10:01:30 +0200 Subject: [PATCH 07/32] lavf: bump minor and add an APIChanges entry for the last avio changes --- doc/APIchanges | 32 ++++++++++++++++++++++++++++++++ libavformat/version.h | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index d65b2ddeea..11a8b51b7e 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -12,6 +12,38 @@ libavutil: 2009-03-08 API changes, most recent first: +2011-04-12 - lavf 52.107.0 - avio.h + Avio cleanup, part II - deprecate the entire URLContext API: + 175389c add avio_check as a replacement for url_exist + ff1ec0c add avio_pause and avio_seek_time as replacements + for _av_url_read_fseek/fpause + cdc6a87 deprecate av_protocol_next(), avio_enum_protocols + should be used instead. + 80c6e23 rename url_set_interrupt_cb->avio_set_interrupt_cb. + f87b1b3 rename open flags: URL_* -> AVIO_* + f8270bb add avio_enum_protocols. + 5593f03 deprecate URLProtocol. + c486dad deprecate URLContext. + 026e175 deprecate the typedef for URLInterruptCB + 8e76a19 deprecate av_register_protocol2. + b840484 deprecate URL_PROTOCOL_FLAG_NESTED_SCHEME + 1305d93 deprecate av_url_read_seek + fa104e1 deprecate av_url_read_pause + 727c7aa deprecate url_get_filename(). + 5958df3 deprecate url_max_packet_size(). + 1869ea0 deprecate url_get_file_handle(). + 32a97d4 deprecate url_filesize(). + e52a914 deprecate url_close(). + 58a48c6 deprecate url_seek(). + 925e908 deprecate url_write(). + dce3756 deprecate url_read_complete(). + bc371ac deprecate url_read(). + 0589da0 deprecate url_open(). + 62eaaea deprecate url_connect. + 5652bb9 deprecate url_alloc. + 333e894 deprecate url_open_protocol + e230705 deprecate url_poll and URLPollEntry + 2011-04-10 - lavu 50.40.0 - pixfmt.h Add PIX_FMT_BGR48LE and PIX_FMT_BGR48BE pixel formats diff --git a/libavformat/version.h b/libavformat/version.h index a29c2c6b5f..24e5757fe8 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -24,7 +24,7 @@ #include "libavutil/avutil.h" #define LIBAVFORMAT_VERSION_MAJOR 52 -#define LIBAVFORMAT_VERSION_MINOR 106 +#define LIBAVFORMAT_VERSION_MINOR 107 #define LIBAVFORMAT_VERSION_MICRO 0 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ From 4c362a5212cf16e888e0ef51c3d6b9866152ef5f Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sat, 9 Apr 2011 23:54:31 +0200 Subject: [PATCH 08/32] doc: update developer guide Refer to the current submission policy and refer to FATE in the Regression Test section. --- doc/developer.texi | 215 +++++++++++++++++++-------------------------- 1 file changed, 90 insertions(+), 125 deletions(-) diff --git a/doc/developer.texi b/doc/developer.texi index ec196d7d0e..ab736d76b2 100644 --- a/doc/developer.texi +++ b/doc/developer.texi @@ -23,16 +23,22 @@ audio or video streams. @end itemize -@section Integrating libavcodec or libavformat in your program +@section Integrating libav in your program -You can integrate all the source code of the libraries to link them -statically to avoid any version problem. All you need is to provide a -'config.mak' and a 'config.h' in the parent directory. See the defines -generated by ./configure to understand what is needed. +Shared libraries should be used whenever is possible in order to reduce +the effort distributors have to pour to support programs and to ensure +only the public api is used. -You can use libavcodec or libavformat in your commercial program, but -@emph{any patch you make must be published}. The best way to proceed is -to send your patches to the Libav mailing list. +You can use Libav in your commercial program, but you must abide to the +license, LGPL or GPL depending on the specific features used, please refer +to @url{http://libav.org/legal.html} for a quick checklist and to +@url{http://git.libav.org/?p=libav.git;a=blob;f=COPYING.GPLv2}, +@url{http://git.libav.org/?p=libav.git;a=blob;f=COPYING.GPLv3}, +@url{http://git.libav.org/?p=libav.git;a=blob;f=COPYING.LGPLv2.1}, +@url{http://git.libav.org/?p=libav.git;a=blob;f=COPYING.LGPLv3} for the +exact text of the licenses. +Any modification to the source code can be suggested for inclusion. +The best way to proceed is to send your patches to the Libav mailing list. @anchor{Coding Rules} @section Coding Rules @@ -129,17 +135,33 @@ should also be avoided if they don't make the code easier to understand. an "or any later version" clause is also acceptable, but LGPL is preferred. @item - You must not commit code which breaks Libav! (Meaning unfinished but - enabled code which breaks compilation or compiles but does not work or - breaks the regression tests) - You can commit unfinished stuff (for testing etc), but it must be disabled - (#ifdef etc) by default so it does not interfere with other developers' - work. + All the patches MUST be reviewed in the mailing list before they are + committed. @item - You do not have to over-test things. If it works for you, and you think it - should work for others, then commit. If your code has problems - (portability, triggers compiler bugs, unusual environment etc) they will be - reported and eventually fixed. + The Libav coding style should remain consistent. Changes to + conform will be suggested during the review or implemented on commit. +@item + Patches should be generated using @code{git format-patch} or directly sent + using @code{git send-email}. + Please make sure you give the proper credit by setting the correct author + in the commit. +@item + The commit message should have a short first line in the form of + @samp{topic: short description} as header, separated by a newline + from the body consting in few lines explaining the reason of the patch. + Referring to the issue on the bug tracker does not exempt to report an + excerpt of the bug. +@item + Work in progress patches should be sent to the mailing list with the [WIP] + or the [RFC] tag. +@item + Branches in public personal repos are advised as way to + work on issues collaboratively. +@item + You do not have to over-test things. If it works for you and you think it + should work for others, send it to the mailing list for review. + If you have doubt about portability please state it in the submission so + people with specific hardware could test it. @item Do not commit unrelated changes together, split them into self-contained pieces. Also do not forget that if part B depends on part A, but A does not @@ -147,70 +169,32 @@ should also be avoided if they don't make the code easier to understand. Keeping changes well split into self-contained parts makes reviewing and understanding them on the commit log mailing list easier. This also helps in case of debugging later on. - Also if you have doubts about splitting or not splitting, do not hesitate to - ask/discuss it on the developer mailing list. @item - Do not change behavior of the programs (renaming options etc) or public - API or ABI without first discussing it on the libav-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) - which change behavior, defaults etc, without asking first. The same - applies to compiler warning fixes, trivial looking fixes and to code - maintained by other developers. We usually have a reason for doing things - the way we do. Send your changes as patches to the libav-devel mailing - list, and if the code maintainers say OK, you may commit. This does not - apply to files you wrote and/or maintain. -@item - We refuse source indentation and other cosmetic changes if they are mixed - with functional changes, such commits will be rejected and removed. Every - developer has his own indentation style, you should not change it. Of course - if you (re)write something, you can use your own style, even though we would - prefer if the indentation throughout Libav was consistent (Many projects - force a given indentation style - we do not.). If you really need to make - indentation changes (try to avoid this), separate them strictly from real - changes. - - 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 - move it to the right)! or do so in a separate commit -@item - 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 - particular bug. Comments such as "fixed!" or "Changed it." are unacceptable. -@item - If you apply a patch by someone else, include the name and email address in - the log message. Since the libav-commits mailing list is publicly - archived you should add some SPAM protection to the email address. Send an - answer to libav-devel (or wherever you got the patch from) saying that - you applied the patch. + Patches that change behavior of the programs (renaming options etc) or + public API or ABI should be discussed in depth and possible few days should + pass between discussion and commit. + Changes to the build system (Makefiles, configure script) which alter + the expected behavior should be considered in the same regard. @item When applying patches that have been discussed (at length) on the mailing list, reference the thread in the log message. @item - Do NOT commit to code actively maintained by others without permission. - Send a patch to libav-devel instead. If no one answers within a reasonable - 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. - Also note, the maintainer can simply ask for more time to review! -@item - Subscribe to the libav-commits mailing list. The diffs of all commits - are sent there and reviewed by all the other developers. Bugs and possible - improvements or general questions regarding commits are discussed there. We - expect you to react if problems with your code are uncovered. + Subscribe to the libav-devel and libav-commits mailing list. + Bugs and possible improvements or general questions regarding commits + are discussed on libav-devel. We expect you to react if problems with + your code are uncovered. @item Update the documentation if you change behavior or add features. If you are - unsure how best to do this, send a patch to libav-devel, the documentation - maintainer(s) will review and commit your stuff. + unsure how best to do this, send an [RFC] patch to libav-devel. @item - Try to keep important discussions and requests (also) on the public - developer mailing list, so that all developers can benefit from them. + All discussions and decisions should be reported on the public developer + mailing list, so that there is a reference to them. + Other media (e.g. IRC) should be used for coordination and immediate + collaboration. @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. + as array index or other risky things. Always use valgrind to doublecheck. @item Remember to check if you need to bump versions for the specific libav parts (libavutil, libavcodec, libavformat) you are changing. You need @@ -223,13 +207,12 @@ should also be avoided if they don't make the code easier to understand. Incrementing the third component means a noteworthy binary compatible change (e.g. encoder bug fix that matters for the decoder). @item - 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 - be disabled, not the code changed. - Thus the remaining warnings can either be bugs or correct code. + Compiler warnings indicate potential bugs or code with bad style. 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 or obfuscates the code. + If a type of warning leads to too many false positives, that warning + should be disabled, not the code changed. @item 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. @@ -237,16 +220,15 @@ should also be avoided if they don't make the code easier to understand. We think our rules are not too hard. If you have comments, contact us. -Note, these rules are mostly borrowed from the MPlayer project. +Note, some rules were borrowed from the MPlayer project. @section Submitting patches -First, (@pxref{Coding Rules}) above if you did not yet. +First, read the (@pxref{Coding Rules}) above if you did not yet, in particular +the rules regarding patch submission. -When you submit your patch, try to send a unified diff (diff '-up' -option). We cannot read other diffs :-) - -Also please do not submit a patch which contains several unrelated changes. +As stated already, please do not submit a patch which contains several +unrelated changes. Split it into separate, self-contained pieces. This does not mean splitting file by file. Instead, make the patch as small as possible while still keeping it as a logical unit that contains an individual change, even @@ -256,8 +238,8 @@ for us and greatly increases your chances of getting your patch applied. Use the patcheck tool of Libav to check your patch. The tool is located in the tools directory. -Run the regression tests before submitting a patch so that you can -verify that there are no big problems. +Run the @pxref{Regression Tests} before submitting a patch in order to verify +it does not cause unexpected problems. Patches should be posted as base64 encoded attachments (or any other encoding which ensures that the patch will not be trashed during @@ -266,16 +248,20 @@ transmission) to the libav-devel mailing list, see It also helps quite a bit if you tell us what the patch does (for example 'replaces lrint by lrintf'), and why (for example '*BSD isn't C99 compliant -and has no lrint()') +and has no lrint()'). This kind of explanation should be the body of the +commit message. Also please if you send several patches, send each patch as a separate mail, do not attach several unrelated patches to the same mail. +Use @code{git send-email} when possible since it will properly send patches +without requiring extra care. + 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 incorporates the requests from the review. This process may go through -several iterations. Once your patch is deemed good enough, some developer -will pick it up and commit it to the official Libav tree. +several iterations. Once your patch is deemed good enough, it will be +committed to the official Libav tree. 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. @@ -301,8 +287,8 @@ send a reminder by email. Your patch should eventually be dealt with. even if it is only a decoder? @item Did you add a rule to compile the appropriate files in the Makefile? - Remember to do this even if you're just adding a format to a file that is - already being compiled by some other rule, like a raw demuxer. + Remember to do this even if you are just adding a format to a file that + is already being compiled by some other rule, like a raw demuxer. @item Did you add an entry to the table of supported formats or codecs in @file{doc/general.texi}? @@ -312,7 +298,7 @@ send a reminder by email. Your patch should eventually be dealt with. If it depends on a parser or a library, did you add that dependency in configure? @item - Did you "git add" the appropriate files before committing? + Did you @code{git add} the appropriate files before committing? @end enumerate @section patch submission checklist @@ -322,13 +308,12 @@ send a reminder by email. Your patch should eventually be dealt with. Do the regression tests pass with the patch applied? @item Does @code{make checkheaders} pass with the patch applied? -@item - Is the patch a unified diff? @item Is the patch against latest Libav git master branch? @item - Are you subscribed to ffmpeg-dev? - (the list is subscribers only due to spam) + Are you subscribed to libav-devel? + (@url{https://lists.libav.org/mailman/listinfo/libav-devel} + the list is subscribers) @item Have you checked that the changes are minimal, so that the same cannot be achieved with a smaller patch and/or simpler final code? @@ -343,9 +328,6 @@ send a reminder by email. Your patch should eventually be dealt with. Did you test your decoder or demuxer against damaged data? If no, see tools/trasher and the noise bitstream filter. Your decoder or demuxer should not crash or end in a (near) infinite loop when fed damaged data. -@item - Is the patch created from the root of the source tree, so it can be - applied with @code{patch -p0}? @item Does the patch not mix functional and cosmetic changes? @item @@ -381,8 +363,6 @@ send a reminder by email. Your patch should eventually be dealt with. @item Lines with similar content should be aligned vertically when doing so improves readability. -@item - Did you provide a suggestion for a clear commit log message? @end enumerate @section Patch review process @@ -401,37 +381,22 @@ After a patch is approved it will be committed to the repository. We will review all submitted patches, but sometimes we are quite busy so especially for large patches this can take several weeks. -When resubmitting patches, please do not make any significant changes -not related to the comments received during review. Such patches will -be rejected. Instead, submit significant changes or new features as -separate patches. +When resubmitting patches, if their size grew or during the review different +issues arisen please split the patch so each issue has a specific patch. -@section Regression tests +@anchor{Regression Tests} +@section Regression Tests -Before submitting a patch (or committing to the repository), you should at least -test that you did not break anything. +Before submitting a patch (or committing to the repository), you should at +least make sure that it does not break anything. -The regression tests build a synthetic video stream and a synthetic -audio stream. These are then encoded and decoded with all codecs or -formats. The CRC (or MD5) of each generated file is recorded in a -result file. A 'diff' is launched to compare the reference results and -the result file. The output is checked immediately after each test -has run. +If the code changed has already a test present in FATE you should run it, +otherwise it is advised to add it. -The regression tests then go on to test the FFserver code with a -limited set of streams. It is important that this step runs correctly -as well. +Improvements to codec or demuxer might change the FATE results. Make sure +to commit the update reference with the change and to explain in the comment +why the expected result changed. -Run 'make test' to test all the codecs and formats. Commands like -'make regtest-mpeg2' can be used to run a single test. By default, -make will abort if any test fails. To run all tests regardless, -use make -k. To get a more verbose output, use 'make V=1 test' or -'make V=2 test'. - -Run 'make fulltest' to test all the codecs, formats and FFserver. - -[Of course, some patches may change the results of the regression tests. In -this case, the reference results of the regression tests shall be modified -accordingly]. +Please refer to @file{doc/fate.txt}. @bye From a92a7ddc253a640aba974d859eab20d74cebb3e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 12 Apr 2011 00:19:56 +0300 Subject: [PATCH 09/32] applehttp: Only check the discard flags if v->ctx actually is initialized MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This code could be executed if the demuxer reads more than one segment before returning from av_open_input_stream. Signed-off-by: Martin Storsjö --- libavformat/applehttp.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c index 243f4a6a03..35759be3cb 100644 --- a/libavformat/applehttp.c +++ b/libavformat/applehttp.c @@ -309,10 +309,13 @@ reload: c->end_of_segment = 1; c->cur_seq_no = v->cur_seq_no; - v->needed = 0; - for (i = v->stream_offset; i < v->stream_offset + v->ctx->nb_streams; i++) { - if (v->parent->streams[i]->discard < AVDISCARD_ALL) - v->needed = 1; + if (v->ctx) { + v->needed = 0; + for (i = v->stream_offset; i < v->stream_offset + v->ctx->nb_streams; + i++) { + if (v->parent->streams[i]->discard < AVDISCARD_ALL) + v->needed = 1; + } } if (!v->needed) { av_log(v->parent, AV_LOG_INFO, "No longer receiving variant %d\n", From dbff4da91468a5079d017b99f961cb8bfc4e019c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 12 Apr 2011 23:50:51 +0300 Subject: [PATCH 10/32] libopencore-amr: Remove unused code fragments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This parts are heritage from the encoder part from the old libamr code removed in SVN rev 19365. Signed-off-by: Martin Storsjö --- libavcodec/libopencore-amr.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c index a7abe26802..c11c924cbe 100644 --- a/libavcodec/libopencore-amr.c +++ b/libavcodec/libopencore-amr.c @@ -239,20 +239,9 @@ AVCodec ff_libopencore_amrnb_encoder = { #include #include -static const char wb_bitrate_unsupported[] = - "bitrate not supported: use one of 6.6k, 8.85k, 12.65k, 14.25k, 15.85k, 18.25k, 19.85k, 23.05k, or 23.85k\n"; - -/* Common code for fixed and float version*/ -typedef struct AMRWB_bitrates { - int rate; - int mode; -} AMRWB_bitrates; - typedef struct AMRWBContext { int frameCount; void *state; - int mode; - Word16 allow_dtx; } AMRWBContext; static av_cold int amr_wb_decode_init(AVCodecContext *avctx) From 57ddffe843b17b741859f9e669433d086dcec09c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 12 Apr 2011 23:56:41 +0300 Subject: [PATCH 11/32] libopencore-amr: Make the opaque encoder pointer a void* MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavcodec/libopencore-amr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c index c11c924cbe..52dfe10e5e 100644 --- a/libavcodec/libopencore-amr.c +++ b/libavcodec/libopencore-amr.c @@ -73,7 +73,7 @@ static int getBitrateMode(int bitrate) typedef struct AMRContext { int frameCount; void *decState; - int *enstate; + void *enstate; int enc_bitrate; } AMRContext; From 587331414bfee1fc73eb9bcd1e8aaae3a56ec5ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 13 Apr 2011 00:06:29 +0300 Subject: [PATCH 12/32] libopencore-amr: Remove an old workaround for libamr header weirdness MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavcodec/libopencore-amr.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c index 52dfe10e5e..f0bfad2cdf 100644 --- a/libavcodec/libopencore-amr.c +++ b/libavcodec/libopencore-amr.c @@ -231,11 +231,6 @@ AVCodec ff_libopencore_amrnb_encoder = { /* -----------AMR wideband ------------*/ #if CONFIG_LIBOPENCORE_AMRWB -#ifdef _TYPEDEF_H -//To avoid duplicate typedefs from typedef in amr-nb -#define typedef_h -#endif - #include #include From a8ec07c933450eea929f632ee867383ebd55532a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 13 Apr 2011 00:08:14 +0300 Subject: [PATCH 13/32] libopencore-amr: Don't print carriage returns in log messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavcodec/libopencore-amr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c index f0bfad2cdf..fa72a221cf 100644 --- a/libavcodec/libopencore-amr.c +++ b/libavcodec/libopencore-amr.c @@ -84,7 +84,7 @@ static av_cold int amr_nb_decode_init(AVCodecContext *avctx) s->frameCount = 0; s->decState = Decoder_Interface_init(); if (!s->decState) { - av_log(avctx, AV_LOG_ERROR, "Decoder_Interface_init error\r\n"); + av_log(avctx, AV_LOG_ERROR, "Decoder_Interface_init error\n"); return -1; } From 900a129f4f16d4bd19a7707b51eb711382a6e42d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 13 Apr 2011 00:10:56 +0300 Subject: [PATCH 14/32] libopencore-amr, libvo-amrwbenc: Return proper error codes in most places MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavcodec/libopencore-amr.c | 16 ++++++++-------- libavcodec/libvo-amrwbenc.c | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c index fa72a221cf..a81d272a1c 100644 --- a/libavcodec/libopencore-amr.c +++ b/libavcodec/libopencore-amr.c @@ -92,7 +92,7 @@ static av_cold int amr_nb_decode_init(AVCodecContext *avctx) if (avctx->channels > 1) { av_log(avctx, AV_LOG_ERROR, "amr_nb: multichannel decoding not supported\n"); - return -1; + return AVERROR(ENOSYS); } return 0; @@ -126,7 +126,7 @@ static int amr_nb_decode_frame(AVCodecContext *avctx, void *data, if (packet_size > buf_size) { av_log(avctx, AV_LOG_ERROR, "amr frame too short (%u, should be %u)\n", buf_size, packet_size); - return -1; + return AVERROR_INVALIDDATA; } s->frameCount++; @@ -159,12 +159,12 @@ static av_cold int amr_nb_encode_init(AVCodecContext *avctx) if (avctx->sample_rate != 8000) { av_log(avctx, AV_LOG_ERROR, "Only 8000Hz sample rate supported\n"); - return -1; + return AVERROR(ENOSYS); } if (avctx->channels != 1) { av_log(avctx, AV_LOG_ERROR, "Only mono supported\n"); - return -1; + return AVERROR(ENOSYS); } avctx->frame_size = 160; @@ -178,7 +178,7 @@ static av_cold int amr_nb_encode_init(AVCodecContext *avctx) if ((s->enc_bitrate = getBitrateMode(avctx->bit_rate)) < 0) { av_log(avctx, AV_LOG_ERROR, nb_bitrate_unsupported); - return -1; + return AVERROR(ENOSYS); } return 0; @@ -202,7 +202,7 @@ static int amr_nb_encode_frame(AVCodecContext *avctx, if ((s->enc_bitrate = getBitrateMode(avctx->bit_rate)) < 0) { av_log(avctx, AV_LOG_ERROR, nb_bitrate_unsupported); - return -1; + return AVERROR(ENOSYS); } written = Encoder_Interface_Encode(s->enstate, s->enc_bitrate, data, @@ -250,7 +250,7 @@ static av_cold int amr_wb_decode_init(AVCodecContext *avctx) if (avctx->channels > 1) { av_log(avctx, AV_LOG_ERROR, "amr_wb: multichannel decoding not supported\n"); - return -1; + return AVERROR(ENOSYS); } return 0; @@ -277,7 +277,7 @@ static int amr_wb_decode_frame(AVCodecContext *avctx, void *data, if (packet_size > buf_size) { av_log(avctx, AV_LOG_ERROR, "amr frame too short (%u, should be %u)\n", buf_size, packet_size + 1); - return -1; + return AVERROR_INVALIDDATA; } s->frameCount++; diff --git a/libavcodec/libvo-amrwbenc.c b/libavcodec/libvo-amrwbenc.c index 661a15d445..a5e8f397c9 100644 --- a/libavcodec/libvo-amrwbenc.c +++ b/libavcodec/libvo-amrwbenc.c @@ -65,17 +65,17 @@ static av_cold int amr_wb_encode_init(AVCodecContext *avctx) if (avctx->sample_rate != 16000) { av_log(avctx, AV_LOG_ERROR, "Only 16000Hz sample rate supported\n"); - return -1; + return AVERROR(ENOSYS); } if (avctx->channels != 1) { av_log(avctx, AV_LOG_ERROR, "Only mono supported\n"); - return -1; + return AVERROR(ENOSYS); } if ((s->mode = getWBBitrateMode(avctx->bit_rate)) < 0) { av_log(avctx, AV_LOG_ERROR, wb_bitrate_unsupported); - return -1; + return AVERROR(ENOSYS); } avctx->frame_size = 320; @@ -105,7 +105,7 @@ static int amr_wb_encode_frame(AVCodecContext *avctx, if ((s->mode = getWBBitrateMode(avctx->bit_rate)) < 0) { av_log(avctx, AV_LOG_ERROR, wb_bitrate_unsupported); - return -1; + return AVERROR(ENOSYS); } size = E_IF_encode(s->state, s->mode, data, frame, s->allow_dtx); return size; From c48ce4eb50ff299db8f9d0289442ec655a1fb053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 13 Apr 2011 00:15:01 +0300 Subject: [PATCH 15/32] libopencore-amr, libvo-amrwbenc: Make the bitrate/mode mapping array static const MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavcodec/libopencore-amr.c | 2 +- libavcodec/libvo-amrwbenc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c index a81d272a1c..b1eb65c885 100644 --- a/libavcodec/libopencore-amr.c +++ b/libavcodec/libopencore-amr.c @@ -53,7 +53,7 @@ typedef struct AMR_bitrates { static int getBitrateMode(int bitrate) { /* make the correspondance between bitrate and mode */ - AMR_bitrates rates[] = { { 4750, MR475}, + static const AMR_bitrates rates[] = {{ 4750, MR475}, { 5150, MR515}, { 5900, MR59}, { 6700, MR67}, diff --git a/libavcodec/libvo-amrwbenc.c b/libavcodec/libvo-amrwbenc.c index a5e8f397c9..8ef4f81638 100644 --- a/libavcodec/libvo-amrwbenc.c +++ b/libavcodec/libvo-amrwbenc.c @@ -41,7 +41,7 @@ typedef struct AMRWBContext { static int getWBBitrateMode(int bitrate) { /* make the correspondance between bitrate and mode */ - AMRWB_bitrates rates[] = { { 6600, 0}, + static const AMRWB_bitrates rates[] = { { 6600, 0}, { 8850, 1}, {12650, 2}, {14250, 3}, From 0e03f94d61dbfc8b4a33eef1f0227ec791abb5fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 13 Apr 2011 00:17:48 +0300 Subject: [PATCH 16/32] libopencore-amr: Remove a useless local variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavcodec/libopencore-amr.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c index b1eb65c885..5110d056f5 100644 --- a/libavcodec/libopencore-amr.c +++ b/libavcodec/libopencore-amr.c @@ -112,7 +112,6 @@ static int amr_nb_decode_frame(AVCodecContext *avctx, void *data, const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; AMRContext *s = avctx->priv_data; - const uint8_t *amrData = buf; static const uint8_t block_size[16] = { 12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0 }; enum Mode dec_mode; int packet_size; @@ -130,10 +129,10 @@ static int amr_nb_decode_frame(AVCodecContext *avctx, void *data, } s->frameCount++; - /* av_log(NULL, AV_LOG_DEBUG, "packet_size=%d amrData= 0x%X %X %X %X\n", - packet_size, amrData[0], amrData[1], amrData[2], amrData[3]); */ + /* av_log(NULL, AV_LOG_DEBUG, "packet_size=%d buf= 0x%X %X %X %X\n", + packet_size, buf[0], buf[1], buf[2], buf[3]); */ /* call decoder */ - Decoder_Interface_Decode(s->decState, amrData, data, 0); + Decoder_Interface_Decode(s->decState, buf, data, 0); *data_size = 160 * 2; return packet_size; @@ -262,7 +261,6 @@ static int amr_wb_decode_frame(AVCodecContext *avctx, void *data, const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; AMRWBContext *s = avctx->priv_data; - const uint8_t *amrData = buf; int mode; int packet_size; static const uint8_t block_size[16] = {18, 24, 33, 37, 41, 47, 51, 59, 61, 6, 6, 0, 0, 0, 1, 1}; @@ -271,7 +269,7 @@ static int amr_wb_decode_frame(AVCodecContext *avctx, void *data, /* nothing to do */ return 0; - mode = (amrData[0] >> 3) & 0x000F; + mode = (buf[0] >> 3) & 0x000F; packet_size = block_size[mode]; if (packet_size > buf_size) { @@ -281,7 +279,7 @@ static int amr_wb_decode_frame(AVCodecContext *avctx, void *data, } s->frameCount++; - D_IF_decode(s->state, amrData, data, _good_frame); + D_IF_decode(s->state, buf, data, _good_frame); *data_size = 320 * 2; return packet_size; } From 5d211e034eebbbbb006d236d810ebf0516484b51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 13 Apr 2011 00:42:24 +0300 Subject: [PATCH 17/32] libvo-amrwbenc: Don't explicitly store bitrate modes in the bitrate table MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bitrate modes are equal to the array indices. Signed-off-by: Martin Storsjö --- libavcodec/libvo-amrwbenc.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/libavcodec/libvo-amrwbenc.c b/libavcodec/libvo-amrwbenc.c index 8ef4f81638..aa89b7fe05 100644 --- a/libavcodec/libvo-amrwbenc.c +++ b/libavcodec/libvo-amrwbenc.c @@ -27,11 +27,6 @@ static const char wb_bitrate_unsupported[] = "bitrate not supported: use one of 6.6k, 8.85k, 12.65k, 14.25k, 15.85k, " "18.25k, 19.85k, 23.05k, or 23.85k\n"; -typedef struct AMRWB_bitrates { - int rate; - int mode; -} AMRWB_bitrates; - typedef struct AMRWBContext { void *state; int mode; @@ -41,20 +36,13 @@ typedef struct AMRWBContext { static int getWBBitrateMode(int bitrate) { /* make the correspondance between bitrate and mode */ - static const AMRWB_bitrates rates[] = { { 6600, 0}, - { 8850, 1}, - {12650, 2}, - {14250, 3}, - {15850, 4}, - {18250, 5}, - {19850, 6}, - {23050, 7}, - {23850, 8}, }; + static const int rates[] = { 6600, 8850, 12650, 14250, 15850, 18250, + 19850, 23050, 23850 }; int i; for (i = 0; i < 9; i++) - if (rates[i].rate == bitrate) - return rates[i].mode; + if (rates[i] == bitrate) + return i; /* no bitrate matching, return an error */ return -1; } From 89e7e640f7a29d67b850f170f9cfc9d250a3c1b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 12 Apr 2011 23:58:45 +0300 Subject: [PATCH 18/32] libopencore-amr: Remove an unused state variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavcodec/libopencore-amr.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c index 5110d056f5..e93fb3d035 100644 --- a/libavcodec/libopencore-amr.c +++ b/libavcodec/libopencore-amr.c @@ -234,7 +234,6 @@ AVCodec ff_libopencore_amrnb_encoder = { #include typedef struct AMRWBContext { - int frameCount; void *state; } AMRWBContext; @@ -242,7 +241,6 @@ static av_cold int amr_wb_decode_init(AVCodecContext *avctx) { AMRWBContext *s = avctx->priv_data; - s->frameCount = 0; s->state = D_IF_init(); amr_decode_fix_avctx(avctx); @@ -278,7 +276,6 @@ static int amr_wb_decode_frame(AVCodecContext *avctx, void *data, return AVERROR_INVALIDDATA; } - s->frameCount++; D_IF_decode(s->state, buf, data, _good_frame); *data_size = 320 * 2; return packet_size; From 9b9c6405fd293bb7820256f474406bdb771647a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 13 Apr 2011 10:12:56 +0300 Subject: [PATCH 19/32] libopencore-amr: Convert commented out debug logging into av_dlog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also add the avctx as logging context. Signed-off-by: Martin Storsjö --- libavcodec/libopencore-amr.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c index e93fb3d035..29459051a0 100644 --- a/libavcodec/libopencore-amr.c +++ b/libavcodec/libopencore-amr.c @@ -116,8 +116,8 @@ static int amr_nb_decode_frame(AVCodecContext *avctx, void *data, enum Mode dec_mode; int packet_size; - /* av_log(NULL, AV_LOG_DEBUG, "amr_decode_frame buf=%p buf_size=%d frameCount=%d!!\n", - buf, buf_size, s->frameCount); */ + av_dlog(avctx, "amr_decode_frame buf=%p buf_size=%d frameCount=%d!!\n", + buf, buf_size, s->frameCount); dec_mode = (buf[0] >> 3) & 0x000F; packet_size = block_size[dec_mode] + 1; @@ -129,8 +129,8 @@ static int amr_nb_decode_frame(AVCodecContext *avctx, void *data, } s->frameCount++; - /* av_log(NULL, AV_LOG_DEBUG, "packet_size=%d buf= 0x%X %X %X %X\n", - packet_size, buf[0], buf[1], buf[2], buf[3]); */ + av_dlog(avctx, "packet_size=%d buf= 0x%X %X %X %X\n", + packet_size, buf[0], buf[1], buf[2], buf[3]); /* call decoder */ Decoder_Interface_Decode(s->decState, buf, data, 0); *data_size = 160 * 2; @@ -206,8 +206,8 @@ static int amr_nb_encode_frame(AVCodecContext *avctx, written = Encoder_Interface_Encode(s->enstate, s->enc_bitrate, data, frame, 0); - /* av_log(NULL, AV_LOG_DEBUG, "amr_nb_encode_frame encoded %u bytes, bitrate %u, first byte was %#02x\n", - written, s->enc_bitrate, frame[0] ); */ + av_dlog(avctx, "amr_nb_encode_frame encoded %u bytes, bitrate %u, first byte was %#02x\n", + written, s->enc_bitrate, frame[0]); return written; } From 02c63a109f33be807d59cd0659752099b62567e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 13 Apr 2011 00:20:26 +0300 Subject: [PATCH 20/32] libopencore-amr, libvo-amrbwenc: Rename variables and functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avoid camelCase names for functions and variables. Signed-off-by: Martin Storsjö --- libavcodec/libopencore-amr.c | 38 ++++++++++++++++++------------------ libavcodec/libvo-amrwbenc.c | 6 +++--- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c index 29459051a0..3feeb6ca80 100644 --- a/libavcodec/libopencore-amr.c +++ b/libavcodec/libopencore-amr.c @@ -50,7 +50,7 @@ typedef struct AMR_bitrates { } AMR_bitrates; /* Match desired bitrate */ -static int getBitrateMode(int bitrate) +static int get_bitrate_mode(int bitrate) { /* make the correspondance between bitrate and mode */ static const AMR_bitrates rates[] = {{ 4750, MR475}, @@ -71,9 +71,9 @@ static int getBitrateMode(int bitrate) } typedef struct AMRContext { - int frameCount; - void *decState; - void *enstate; + int frame_count; + void *dec_state; + void *enc_state; int enc_bitrate; } AMRContext; @@ -81,9 +81,9 @@ static av_cold int amr_nb_decode_init(AVCodecContext *avctx) { AMRContext *s = avctx->priv_data; - s->frameCount = 0; - s->decState = Decoder_Interface_init(); - if (!s->decState) { + s->frame_count = 0; + s->dec_state = Decoder_Interface_init(); + if (!s->dec_state) { av_log(avctx, AV_LOG_ERROR, "Decoder_Interface_init error\n"); return -1; } @@ -102,7 +102,7 @@ static av_cold int amr_nb_decode_close(AVCodecContext *avctx) { AMRContext *s = avctx->priv_data; - Decoder_Interface_exit(s->decState); + Decoder_Interface_exit(s->dec_state); return 0; } @@ -116,8 +116,8 @@ static int amr_nb_decode_frame(AVCodecContext *avctx, void *data, enum Mode dec_mode; int packet_size; - av_dlog(avctx, "amr_decode_frame buf=%p buf_size=%d frameCount=%d!!\n", - buf, buf_size, s->frameCount); + av_dlog(avctx, "amr_decode_frame buf=%p buf_size=%d frame_count=%d!!\n", + buf, buf_size, s->frame_count); dec_mode = (buf[0] >> 3) & 0x000F; packet_size = block_size[dec_mode] + 1; @@ -128,11 +128,11 @@ static int amr_nb_decode_frame(AVCodecContext *avctx, void *data, return AVERROR_INVALIDDATA; } - s->frameCount++; + s->frame_count++; av_dlog(avctx, "packet_size=%d buf= 0x%X %X %X %X\n", packet_size, buf[0], buf[1], buf[2], buf[3]); /* call decoder */ - Decoder_Interface_Decode(s->decState, buf, data, 0); + Decoder_Interface_Decode(s->dec_state, buf, data, 0); *data_size = 160 * 2; return packet_size; @@ -154,7 +154,7 @@ static av_cold int amr_nb_encode_init(AVCodecContext *avctx) { AMRContext *s = avctx->priv_data; - s->frameCount = 0; + s->frame_count = 0; if (avctx->sample_rate != 8000) { av_log(avctx, AV_LOG_ERROR, "Only 8000Hz sample rate supported\n"); @@ -169,13 +169,13 @@ static av_cold int amr_nb_encode_init(AVCodecContext *avctx) avctx->frame_size = 160; avctx->coded_frame = avcodec_alloc_frame(); - s->enstate=Encoder_Interface_init(0); - if (!s->enstate) { + s->enc_state = Encoder_Interface_init(0); + if (!s->enc_state) { av_log(avctx, AV_LOG_ERROR, "Encoder_Interface_init error\n"); return -1; } - if ((s->enc_bitrate = getBitrateMode(avctx->bit_rate)) < 0) { + if ((s->enc_bitrate = get_bitrate_mode(avctx->bit_rate)) < 0) { av_log(avctx, AV_LOG_ERROR, nb_bitrate_unsupported); return AVERROR(ENOSYS); } @@ -187,7 +187,7 @@ static av_cold int amr_nb_encode_close(AVCodecContext *avctx) { AMRContext *s = avctx->priv_data; - Encoder_Interface_exit(s->enstate); + Encoder_Interface_exit(s->enc_state); av_freep(&avctx->coded_frame); return 0; } @@ -199,12 +199,12 @@ static int amr_nb_encode_frame(AVCodecContext *avctx, AMRContext *s = avctx->priv_data; int written; - if ((s->enc_bitrate = getBitrateMode(avctx->bit_rate)) < 0) { + if ((s->enc_bitrate = get_bitrate_mode(avctx->bit_rate)) < 0) { av_log(avctx, AV_LOG_ERROR, nb_bitrate_unsupported); return AVERROR(ENOSYS); } - written = Encoder_Interface_Encode(s->enstate, s->enc_bitrate, data, + written = Encoder_Interface_Encode(s->enc_state, s->enc_bitrate, data, frame, 0); av_dlog(avctx, "amr_nb_encode_frame encoded %u bytes, bitrate %u, first byte was %#02x\n", written, s->enc_bitrate, frame[0]); diff --git a/libavcodec/libvo-amrwbenc.c b/libavcodec/libvo-amrwbenc.c index aa89b7fe05..e55fdc69e0 100644 --- a/libavcodec/libvo-amrwbenc.c +++ b/libavcodec/libvo-amrwbenc.c @@ -33,7 +33,7 @@ typedef struct AMRWBContext { int allow_dtx; } AMRWBContext; -static int getWBBitrateMode(int bitrate) +static int get_wb_bitrate_mode(int bitrate) { /* make the correspondance between bitrate and mode */ static const int rates[] = { 6600, 8850, 12650, 14250, 15850, 18250, @@ -61,7 +61,7 @@ static av_cold int amr_wb_encode_init(AVCodecContext *avctx) return AVERROR(ENOSYS); } - if ((s->mode = getWBBitrateMode(avctx->bit_rate)) < 0) { + if ((s->mode = get_wb_bitrate_mode(avctx->bit_rate)) < 0) { av_log(avctx, AV_LOG_ERROR, wb_bitrate_unsupported); return AVERROR(ENOSYS); } @@ -91,7 +91,7 @@ static int amr_wb_encode_frame(AVCodecContext *avctx, AMRWBContext *s = avctx->priv_data; int size; - if ((s->mode = getWBBitrateMode(avctx->bit_rate)) < 0) { + if ((s->mode = get_wb_bitrate_mode(avctx->bit_rate)) < 0) { av_log(avctx, AV_LOG_ERROR, wb_bitrate_unsupported); return AVERROR(ENOSYS); } From 882221afdee6e5f19d576927898cbcaed7237d80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 13 Apr 2011 00:25:43 +0300 Subject: [PATCH 21/32] libopencore-amr: Cosmetics: Rewrap and align MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavcodec/libopencore-amr.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c index 3feeb6ca80..4d26fc6605 100644 --- a/libavcodec/libopencore-amr.c +++ b/libavcodec/libopencore-amr.c @@ -53,14 +53,10 @@ typedef struct AMR_bitrates { static int get_bitrate_mode(int bitrate) { /* make the correspondance between bitrate and mode */ - static const AMR_bitrates rates[] = {{ 4750, MR475}, - { 5150, MR515}, - { 5900, MR59}, - { 6700, MR67}, - { 7400, MR74}, - { 7950, MR795}, - {10200, MR102}, - {12200, MR122}, }; + static const AMR_bitrates rates[] = { + { 4750, MR475 }, { 5150, MR515 }, { 5900, MR59 }, { 6700, MR67 }, + { 7400, MR74 }, { 7950, MR795 }, { 10200, MR102 }, { 12200, MR122 } + }; int i; for (i = 0; i < 8; i++) @@ -79,7 +75,7 @@ typedef struct AMRContext { static av_cold int amr_nb_decode_init(AVCodecContext *avctx) { - AMRContext *s = avctx->priv_data; + AMRContext *s = avctx->priv_data; s->frame_count = 0; s->dec_state = Decoder_Interface_init(); @@ -111,7 +107,7 @@ static int amr_nb_decode_frame(AVCodecContext *avctx, void *data, { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; - AMRContext *s = avctx->priv_data; + AMRContext *s = avctx->priv_data; static const uint8_t block_size[16] = { 12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0 }; enum Mode dec_mode; int packet_size; @@ -119,7 +115,7 @@ static int amr_nb_decode_frame(AVCodecContext *avctx, void *data, av_dlog(avctx, "amr_decode_frame buf=%p buf_size=%d frame_count=%d!!\n", buf, buf_size, s->frame_count); - dec_mode = (buf[0] >> 3) & 0x000F; + dec_mode = (buf[0] >> 3) & 0x000F; packet_size = block_size[dec_mode] + 1; if (packet_size > buf_size) { @@ -241,7 +237,7 @@ static av_cold int amr_wb_decode_init(AVCodecContext *avctx) { AMRWBContext *s = avctx->priv_data; - s->state = D_IF_init(); + s->state = D_IF_init(); amr_decode_fix_avctx(avctx); @@ -258,7 +254,7 @@ static int amr_wb_decode_frame(AVCodecContext *avctx, void *data, { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; - AMRWBContext *s = avctx->priv_data; + AMRWBContext *s = avctx->priv_data; int mode; int packet_size; static const uint8_t block_size[16] = {18, 24, 33, 37, 41, 47, 51, 59, 61, 6, 6, 0, 0, 0, 1, 1}; @@ -267,7 +263,7 @@ static int amr_wb_decode_frame(AVCodecContext *avctx, void *data, /* nothing to do */ return 0; - mode = (buf[0] >> 3) & 0x000F; + mode = (buf[0] >> 3) & 0x000F; packet_size = block_size[mode]; if (packet_size > buf_size) { From 548e62c5aedcf86a08c3c423b9367e94727ad86b Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 23 Feb 2011 07:39:59 +0100 Subject: [PATCH 22/32] lavf: postpone removal of deprecated avio functions They've been deprecated very recently. --- libavformat/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/version.h b/libavformat/version.h index 24e5757fe8..887901bc1e 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -87,7 +87,7 @@ #define FF_API_SYMVER (LIBAVFORMAT_VERSION_MAJOR < 53) #endif #ifndef FF_API_OLD_AVIO -#define FF_API_OLD_AVIO (LIBAVFORMAT_VERSION_MAJOR < 53) +#define FF_API_OLD_AVIO (LIBAVFORMAT_VERSION_MAJOR < 54) #endif #ifndef FF_API_INDEX_BUILT #define FF_API_INDEX_BUILT (LIBAVFORMAT_VERSION_MAJOR < 53) From d6ead39ee7c6b21a7e5f44defed7339673b026b6 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 6 Apr 2011 07:31:32 +0200 Subject: [PATCH 23/32] lavc: postpone removal of audioconvert and sample_fmt wrappers Those were moved to libavutil only recently. --- libavcodec/version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/version.h b/libavcodec/version.h index 78c0f7808d..ef9e560f2f 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -66,10 +66,10 @@ #define FF_API_INOFFICIAL (LIBAVCODEC_VERSION_MAJOR < 53) #endif #ifndef FF_API_OLD_SAMPLE_FMT -#define FF_API_OLD_SAMPLE_FMT (LIBAVCODEC_VERSION_MAJOR < 53) +#define FF_API_OLD_SAMPLE_FMT (LIBAVCODEC_VERSION_MAJOR < 54) #endif #ifndef FF_API_OLD_AUDIOCONVERT -#define FF_API_OLD_AUDIOCONVERT (LIBAVCODEC_VERSION_MAJOR < 53) +#define FF_API_OLD_AUDIOCONVERT (LIBAVCODEC_VERSION_MAJOR < 54) #endif #ifndef FF_API_HURRY_UP #define FF_API_HURRY_UP (LIBAVCODEC_VERSION_MAJOR < 53) From c77673271280267cc6fb77acdfb189c578df058e Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 6 Apr 2011 07:47:26 +0200 Subject: [PATCH 24/32] lavc: postpone removal of request_channels No decoder uses the supposed replacement, request_channel_layout, yet. --- libavcodec/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/version.h b/libavcodec/version.h index ef9e560f2f..bad6509a03 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -84,7 +84,7 @@ #define FF_API_ANTIALIAS_ALGO (LIBAVCODEC_VERSION_MAJOR < 54) #endif #ifndef FF_API_REQUEST_CHANNELS -#define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 53) +#define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 54) #endif #endif /* AVCODEC_VERSION_H */ From 451d566f4b51bd4d371d7125fe458bcac3869a77 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 23 Feb 2011 07:38:52 +0100 Subject: [PATCH 25/32] lavf: postpone removal of public metadata conversion API It's been deprecated only a few months ago, long after 0.6. --- libavformat/avformat.h | 8 ++++---- libavformat/metadata.c | 2 ++ libavformat/metadata.h | 2 +- libavformat/version.h | 3 +++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 24c7958111..77114e62e6 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -118,7 +118,7 @@ typedef struct { }AVMetadataTag; typedef struct AVMetadata AVMetadata; -#if FF_API_OLD_METADATA +#if FF_API_OLD_METADATA2 typedef struct AVMetadataConv AVMetadataConv; #endif @@ -159,7 +159,7 @@ attribute_deprecated int av_metadata_set(AVMetadata **pm, const char *key, const */ int av_metadata_set2(AVMetadata **pm, const char *key, const char *value, int flags); -#if FF_API_OLD_METADATA +#if FF_API_OLD_METADATA2 /** * This function is provided for compatibility reason and currently does nothing. */ @@ -317,7 +317,7 @@ typedef struct AVOutputFormat { enum CodecID subtitle_codec; /**< default subtitle codec */ -#if FF_API_OLD_METADATA +#if FF_API_OLD_METADATA2 const AVMetadataConv *metadata_conv; #endif @@ -437,7 +437,7 @@ typedef struct AVInputFormat { */ int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags); -#if FF_API_OLD_METADATA +#if FF_API_OLD_METADATA2 const AVMetadataConv *metadata_conv; #endif diff --git a/libavformat/metadata.c b/libavformat/metadata.c index 9ecc0a9191..36a9342882 100644 --- a/libavformat/metadata.c +++ b/libavformat/metadata.c @@ -91,7 +91,9 @@ int av_metadata_set(AVMetadata **pm, const char *key, const char *value) { return av_metadata_set2(pm, key, value, 0); } +#endif +#if FF_API_OLD_METADATA2 void av_metadata_conv(AVFormatContext *ctx, const AVMetadataConv *d_conv, const AVMetadataConv *s_conv) { diff --git a/libavformat/metadata.h b/libavformat/metadata.h index 0d2f1ab4a6..43eace8e39 100644 --- a/libavformat/metadata.h +++ b/libavformat/metadata.h @@ -39,7 +39,7 @@ struct AVMetadataConv{ const char *native; const char *generic; }; -#if !FF_API_OLD_METADATA +#if !FF_API_OLD_METADATA2 typedef struct AVMetadataConv AVMetadataConv; #endif diff --git a/libavformat/version.h b/libavformat/version.h index 887901bc1e..03b90c1208 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -47,6 +47,9 @@ #ifndef FF_API_OLD_METADATA #define FF_API_OLD_METADATA (LIBAVFORMAT_VERSION_MAJOR < 53) #endif +#ifndef FF_API_OLD_METADATA2 +#define FF_API_OLD_METADATA2 (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif #ifndef FF_API_URL_CLASS #define FF_API_URL_CLASS (LIBAVFORMAT_VERSION_MAJOR >= 53) #endif From 2d3267936a40c0a8db6ab76aeb0017e1959ae2fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 12 Apr 2011 10:35:23 +0300 Subject: [PATCH 26/32] libvo-aacenc: Only produce extradata if the global header flag is set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavcodec/libvo-aacenc.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/libavcodec/libvo-aacenc.c b/libavcodec/libvo-aacenc.c index 205c00e922..7006d78c42 100644 --- a/libavcodec/libvo-aacenc.c +++ b/libavcodec/libvo-aacenc.c @@ -62,12 +62,6 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) return AVERROR_UNKNOWN; } - avctx->extradata_size = 2; - avctx->extradata = av_mallocz(avctx->extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE); - if (!avctx->extradata) - return AVERROR(ENOMEM); - for (index = 0; index < 16; index++) if (avctx->sample_rate == ff_mpeg4audio_sample_rates[index]) break; @@ -76,8 +70,16 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) avctx->sample_rate); return AVERROR_NOTSUPP; } - avctx->extradata[0] = 0x02 << 3 | index >> 1; - avctx->extradata[1] = (index & 0x01) << 7 | avctx->channels << 3; + if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) { + avctx->extradata_size = 2; + avctx->extradata = av_mallocz(avctx->extradata_size + + FF_INPUT_BUFFER_PADDING_SIZE); + if (!avctx->extradata) + return AVERROR(ENOMEM); + + avctx->extradata[0] = 0x02 << 3 | index >> 1; + avctx->extradata[1] = (index & 0x01) << 7 | avctx->channels << 3; + } return 0; } From 0e1a5434e2d30d0f57770110c1e358c8eccf9f82 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Mon, 11 Apr 2011 19:48:13 +0200 Subject: [PATCH 27/32] swscale: Factorize FAST_BGR2YV12 definition. It is used only for x86 so it will eventually be moved with that code into the x86 arch subdirectory. --- libswscale/rgb2rgb.c | 2 -- libswscale/swscale.c | 2 -- libswscale/swscale_internal.h | 2 ++ 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c index bc0ed631c9..d3763cc584 100644 --- a/libswscale/rgb2rgb.c +++ b/libswscale/rgb2rgb.c @@ -30,8 +30,6 @@ #include "swscale.h" #include "swscale_internal.h" -#define FAST_BGR2YV12 // use 7-bit instead of 15-bit coefficients - void (*rgb24tobgr32)(const uint8_t *src, uint8_t *dst, long src_size); void (*rgb24tobgr16)(const uint8_t *src, uint8_t *dst, long src_size); void (*rgb24tobgr15)(const uint8_t *src, uint8_t *dst, long src_size); diff --git a/libswscale/swscale.c b/libswscale/swscale.c index ed6db72035..565743a229 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -76,8 +76,6 @@ untested special converters //#undef ARCH_X86 #define DITHER1XBPP -#define FAST_BGR2YV12 // use 7 bit coefficients instead of 15 bit - #define isPacked(x) ( \ (x)==PIX_FMT_PAL8 \ || (x)==PIX_FMT_YUYV422 \ diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 631f1e0672..4c6ad2a860 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -31,6 +31,8 @@ #define STR(s) AV_TOSTRING(s) //AV_STRINGIFY is too long +#define FAST_BGR2YV12 //use 7-bit instead of 15-bit coefficients + #define MAX_FILTER_SIZE 256 #if ARCH_X86 From 567ad0e31d94512410fd02ead1a1d6f72d369456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 13 Apr 2011 21:48:00 +0300 Subject: [PATCH 28/32] libavcodec: Mark AVCodec->priv_class const MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This avoids warnings of this kind, everywhere priv_class is initialized: warning: initialization discards qualifiers from pointer target type Signed-off-by: Martin Storsjö --- libavcodec/avcodec.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 7eb8b52c0b..109d2a4923 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2944,7 +2944,7 @@ typedef struct AVCodec { const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 const int64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0 uint8_t max_lowres; ///< maximum value for lowres supported by the decoder - AVClass *priv_class; ///< AVClass for the private context + const AVClass *priv_class; ///< AVClass for the private context const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN} /** From 957635ba1435d95209ee43c7e9fa0195dcf60152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 13 Apr 2011 22:31:20 +0300 Subject: [PATCH 29/32] libvo-*: Fix up the long codec names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Include VisualOn to clarify the codec name, but remove the actual library name from the user-friendly description. Also mention Android, to clarify which VisualOn implementation this refers to, since they do sell other variants of the same code, too. Signed-off-by: Martin Storsjö --- libavcodec/libvo-aacenc.c | 2 +- libavcodec/libvo-amrwbenc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/libvo-aacenc.c b/libavcodec/libvo-aacenc.c index 7006d78c42..f2a19a1814 100644 --- a/libavcodec/libvo-aacenc.c +++ b/libavcodec/libvo-aacenc.c @@ -125,6 +125,6 @@ AVCodec ff_libvo_aacenc_encoder = { aac_encode_close, NULL, .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, - .long_name = NULL_IF_CONFIG_SMALL("libvo-aacenc AAC"), + .long_name = NULL_IF_CONFIG_SMALL("Android VisualOn AAC"), }; diff --git a/libavcodec/libvo-amrwbenc.c b/libavcodec/libvo-amrwbenc.c index e55fdc69e0..02d775096b 100644 --- a/libavcodec/libvo-amrwbenc.c +++ b/libavcodec/libvo-amrwbenc.c @@ -109,7 +109,7 @@ AVCodec ff_libvo_amrwbenc_encoder = { amr_wb_encode_close, NULL, .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, - .long_name = NULL_IF_CONFIG_SMALL("libvo-amrwbenc Adaptive Multi-Rate " + .long_name = NULL_IF_CONFIG_SMALL("Android VisualOn Adaptive Multi-Rate " "(AMR) Wide-Band"), }; From 70739381213b087cca9570b66561dc57652b6fb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 13 Apr 2011 10:59:08 +0300 Subject: [PATCH 30/32] libopencore-amr, libvo-amrwbenc: Find the closest matching bitrate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dynamically print the supported bitrates from the local table, instead of using a hardcoded log message. Signed-off-by: Martin Storsjö --- libavcodec/libopencore-amr.c | 36 +++++++++++++++++++---------------- libavcodec/libvo-amrwbenc.c | 37 +++++++++++++++++++----------------- 2 files changed, 40 insertions(+), 33 deletions(-) diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c index 4d26fc6605..e6216c9e5e 100644 --- a/libavcodec/libopencore-amr.c +++ b/libavcodec/libopencore-amr.c @@ -20,6 +20,7 @@ */ #include "avcodec.h" +#include "libavutil/avstring.h" static void amr_decode_fix_avctx(AVCodecContext *avctx) { @@ -40,9 +41,6 @@ static void amr_decode_fix_avctx(AVCodecContext *avctx) #include #include -static const char nb_bitrate_unsupported[] = - "bitrate not supported: use one of 4.75k, 5.15k, 5.9k, 6.7k, 7.4k, 7.95k, 10.2k or 12.2k\n"; - /* Common code for fixed and float version*/ typedef struct AMR_bitrates { int rate; @@ -50,20 +48,32 @@ typedef struct AMR_bitrates { } AMR_bitrates; /* Match desired bitrate */ -static int get_bitrate_mode(int bitrate) +static int get_bitrate_mode(int bitrate, void *log_ctx) { /* make the correspondance between bitrate and mode */ static const AMR_bitrates rates[] = { { 4750, MR475 }, { 5150, MR515 }, { 5900, MR59 }, { 6700, MR67 }, { 7400, MR74 }, { 7950, MR795 }, { 10200, MR102 }, { 12200, MR122 } }; - int i; + int i, best = -1, min_diff = 0; + char log_buf[200]; - for (i = 0; i < 8; i++) + for (i = 0; i < 8; i++) { if (rates[i].rate == bitrate) return rates[i].mode; - /* no bitrate matching, return an error */ - return -1; + if (best < 0 || abs(rates[i].rate - bitrate) < min_diff) { + best = i; + min_diff = abs(rates[i].rate - bitrate); + } + } + /* no bitrate matching exactly, log a warning */ + snprintf(log_buf, sizeof(log_buf), "bitrate not supported: use one of "); + for (i = 0; i < 8; i++) + av_strlcatf(log_buf, sizeof(log_buf), "%.2fk, ", rates[i].rate / 1000.f); + av_strlcatf(log_buf, sizeof(log_buf), "using %.2fk", rates[best].rate / 1000.f); + av_log(log_ctx, AV_LOG_WARNING, "%s\n", log_buf); + + return best; } typedef struct AMRContext { @@ -171,10 +181,7 @@ static av_cold int amr_nb_encode_init(AVCodecContext *avctx) return -1; } - if ((s->enc_bitrate = get_bitrate_mode(avctx->bit_rate)) < 0) { - av_log(avctx, AV_LOG_ERROR, nb_bitrate_unsupported); - return AVERROR(ENOSYS); - } + s->enc_bitrate = get_bitrate_mode(avctx->bit_rate, avctx); return 0; } @@ -195,10 +202,7 @@ static int amr_nb_encode_frame(AVCodecContext *avctx, AMRContext *s = avctx->priv_data; int written; - if ((s->enc_bitrate = get_bitrate_mode(avctx->bit_rate)) < 0) { - av_log(avctx, AV_LOG_ERROR, nb_bitrate_unsupported); - return AVERROR(ENOSYS); - } + s->enc_bitrate = get_bitrate_mode(avctx->bit_rate, avctx); written = Encoder_Interface_Encode(s->enc_state, s->enc_bitrate, data, frame, 0); diff --git a/libavcodec/libvo-amrwbenc.c b/libavcodec/libvo-amrwbenc.c index 02d775096b..b194bf04bb 100644 --- a/libavcodec/libvo-amrwbenc.c +++ b/libavcodec/libvo-amrwbenc.c @@ -22,10 +22,7 @@ #include #include "avcodec.h" - -static const char wb_bitrate_unsupported[] = - "bitrate not supported: use one of 6.6k, 8.85k, 12.65k, 14.25k, 15.85k, " - "18.25k, 19.85k, 23.05k, or 23.85k\n"; +#include "libavutil/avstring.h" typedef struct AMRWBContext { void *state; @@ -33,18 +30,30 @@ typedef struct AMRWBContext { int allow_dtx; } AMRWBContext; -static int get_wb_bitrate_mode(int bitrate) +static int get_wb_bitrate_mode(int bitrate, void *log_ctx) { /* make the correspondance between bitrate and mode */ static const int rates[] = { 6600, 8850, 12650, 14250, 15850, 18250, 19850, 23050, 23850 }; - int i; + int i, best = -1, min_diff = 0; + char log_buf[200]; - for (i = 0; i < 9; i++) + for (i = 0; i < 9; i++) { if (rates[i] == bitrate) return i; - /* no bitrate matching, return an error */ - return -1; + if (best < 0 || abs(rates[i] - bitrate) < min_diff) { + best = i; + min_diff = abs(rates[i] - bitrate); + } + } + /* no bitrate matching exactly, log a warning */ + snprintf(log_buf, sizeof(log_buf), "bitrate not supported: use one of "); + for (i = 0; i < 9; i++) + av_strlcatf(log_buf, sizeof(log_buf), "%.2fk, ", rates[i] / 1000.f); + av_strlcatf(log_buf, sizeof(log_buf), "using %.2fk", rates[best] / 1000.f); + av_log(log_ctx, AV_LOG_WARNING, "%s\n", log_buf); + + return best; } static av_cold int amr_wb_encode_init(AVCodecContext *avctx) @@ -61,10 +70,7 @@ static av_cold int amr_wb_encode_init(AVCodecContext *avctx) return AVERROR(ENOSYS); } - if ((s->mode = get_wb_bitrate_mode(avctx->bit_rate)) < 0) { - av_log(avctx, AV_LOG_ERROR, wb_bitrate_unsupported); - return AVERROR(ENOSYS); - } + s->mode = get_wb_bitrate_mode(avctx->bit_rate, avctx); avctx->frame_size = 320; avctx->coded_frame = avcodec_alloc_frame(); @@ -91,10 +97,7 @@ static int amr_wb_encode_frame(AVCodecContext *avctx, AMRWBContext *s = avctx->priv_data; int size; - if ((s->mode = get_wb_bitrate_mode(avctx->bit_rate)) < 0) { - av_log(avctx, AV_LOG_ERROR, wb_bitrate_unsupported); - return AVERROR(ENOSYS); - } + s->mode = get_wb_bitrate_mode(avctx->bit_rate, avctx); size = E_IF_encode(s->state, s->mode, data, frame, s->allow_dtx); return size; } From 3dd82afc748df0f1c49b76e1cd4ea6e35b1001a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 13 Apr 2011 11:03:19 +0300 Subject: [PATCH 31/32] libopencore-amr, libvo-amrwbenc: Only check the bitrate when changed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also rename the incorrectly named enc_bitrate to enc_mode, use the enc_bitrate variable for storing the last chosen bitrate. This avoids continuous warning log messages if not using an exactly matching bitrate, while still allowing changing bitrate at any point. Signed-off-by: Martin Storsjö --- libavcodec/libopencore-amr.c | 13 +++++++++---- libavcodec/libvo-amrwbenc.c | 9 +++++++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c index e6216c9e5e..c8b3a2c1bc 100644 --- a/libavcodec/libopencore-amr.c +++ b/libavcodec/libopencore-amr.c @@ -81,6 +81,7 @@ typedef struct AMRContext { void *dec_state; void *enc_state; int enc_bitrate; + int enc_mode; } AMRContext; static av_cold int amr_nb_decode_init(AVCodecContext *avctx) @@ -181,7 +182,8 @@ static av_cold int amr_nb_encode_init(AVCodecContext *avctx) return -1; } - s->enc_bitrate = get_bitrate_mode(avctx->bit_rate, avctx); + s->enc_mode = get_bitrate_mode(avctx->bit_rate, avctx); + s->enc_bitrate = avctx->bit_rate; return 0; } @@ -202,12 +204,15 @@ static int amr_nb_encode_frame(AVCodecContext *avctx, AMRContext *s = avctx->priv_data; int written; - s->enc_bitrate = get_bitrate_mode(avctx->bit_rate, avctx); + if (s->enc_bitrate != avctx->bit_rate) { + s->enc_mode = get_bitrate_mode(avctx->bit_rate, avctx); + s->enc_bitrate = avctx->bit_rate; + } - written = Encoder_Interface_Encode(s->enc_state, s->enc_bitrate, data, + written = Encoder_Interface_Encode(s->enc_state, s->enc_mode, data, frame, 0); av_dlog(avctx, "amr_nb_encode_frame encoded %u bytes, bitrate %u, first byte was %#02x\n", - written, s->enc_bitrate, frame[0]); + written, s->enc_mode, frame[0]); return written; } diff --git a/libavcodec/libvo-amrwbenc.c b/libavcodec/libvo-amrwbenc.c index b194bf04bb..d3db5f847a 100644 --- a/libavcodec/libvo-amrwbenc.c +++ b/libavcodec/libvo-amrwbenc.c @@ -27,6 +27,7 @@ typedef struct AMRWBContext { void *state; int mode; + int last_bitrate; int allow_dtx; } AMRWBContext; @@ -70,7 +71,8 @@ static av_cold int amr_wb_encode_init(AVCodecContext *avctx) return AVERROR(ENOSYS); } - s->mode = get_wb_bitrate_mode(avctx->bit_rate, avctx); + s->mode = get_wb_bitrate_mode(avctx->bit_rate, avctx); + s->last_bitrate = avctx->bit_rate; avctx->frame_size = 320; avctx->coded_frame = avcodec_alloc_frame(); @@ -97,7 +99,10 @@ static int amr_wb_encode_frame(AVCodecContext *avctx, AMRWBContext *s = avctx->priv_data; int size; - s->mode = get_wb_bitrate_mode(avctx->bit_rate, avctx); + if (s->last_bitrate != avctx->bit_rate) { + s->mode = get_wb_bitrate_mode(avctx->bit_rate, avctx); + s->last_bitrate = avctx->bit_rate; + } size = E_IF_encode(s->state, s->mode, data, frame, s->allow_dtx); return size; } From 651b276ef7ad8d89e89bfc94a4232ab6c36f3a8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 13 Apr 2011 21:47:12 +0300 Subject: [PATCH 32/32] libopencore-amr, libvo-amrwbenc: Allow enabling DTX via private AVOptions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DTX, discontinuous transmission, allows emitting frames with comfort noise when no voice is detected in the input audio. Signed-off-by: Martin Storsjö --- libavcodec/libopencore-amr.c | 15 ++++++++++++++- libavcodec/libvo-amrwbenc.c | 13 ++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c index c8b3a2c1bc..cf8bdbbcb8 100644 --- a/libavcodec/libopencore-amr.c +++ b/libavcodec/libopencore-amr.c @@ -21,6 +21,7 @@ #include "avcodec.h" #include "libavutil/avstring.h" +#include "libavutil/opt.h" static void amr_decode_fix_avctx(AVCodecContext *avctx) { @@ -77,13 +78,24 @@ static int get_bitrate_mode(int bitrate, void *log_ctx) } typedef struct AMRContext { + AVClass *av_class; int frame_count; void *dec_state; void *enc_state; int enc_bitrate; int enc_mode; + int enc_dtx; } AMRContext; +static const AVOption options[] = { + { "dtx", "Allow DTX (generate comfort noise)", offsetof(AMRContext, enc_dtx), FF_OPT_TYPE_INT, 0, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, + { NULL } +}; + +static const AVClass class = { + "libopencore_amrnb", av_default_item_name, options, LIBAVUTIL_VERSION_INT +}; + static av_cold int amr_nb_decode_init(AVCodecContext *avctx) { AMRContext *s = avctx->priv_data; @@ -176,7 +188,7 @@ static av_cold int amr_nb_encode_init(AVCodecContext *avctx) avctx->frame_size = 160; avctx->coded_frame = avcodec_alloc_frame(); - s->enc_state = Encoder_Interface_init(0); + s->enc_state = Encoder_Interface_init(s->enc_dtx); if (!s->enc_state) { av_log(avctx, AV_LOG_ERROR, "Encoder_Interface_init error\n"); return -1; @@ -228,6 +240,7 @@ AVCodec ff_libopencore_amrnb_encoder = { NULL, .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("OpenCORE Adaptive Multi-Rate (AMR) Narrow-Band"), + .priv_class = &class, }; #endif diff --git a/libavcodec/libvo-amrwbenc.c b/libavcodec/libvo-amrwbenc.c index d3db5f847a..d8a6099561 100644 --- a/libavcodec/libvo-amrwbenc.c +++ b/libavcodec/libvo-amrwbenc.c @@ -23,14 +23,25 @@ #include "avcodec.h" #include "libavutil/avstring.h" +#include "libavutil/opt.h" typedef struct AMRWBContext { + AVClass *av_class; void *state; int mode; int last_bitrate; int allow_dtx; } AMRWBContext; +static const AVOption options[] = { + { "dtx", "Allow DTX (generate comfort noise)", offsetof(AMRWBContext, allow_dtx), FF_OPT_TYPE_INT, 0, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, + { NULL } +}; + +static const AVClass class = { + "libvo_amrwbenc", av_default_item_name, options, LIBAVUTIL_VERSION_INT +}; + static int get_wb_bitrate_mode(int bitrate, void *log_ctx) { /* make the correspondance between bitrate and mode */ @@ -78,7 +89,6 @@ static av_cold int amr_wb_encode_init(AVCodecContext *avctx) avctx->coded_frame = avcodec_alloc_frame(); s->state = E_IF_init(); - s->allow_dtx = 0; return 0; } @@ -119,5 +129,6 @@ AVCodec ff_libvo_amrwbenc_encoder = { .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("Android VisualOn Adaptive Multi-Rate " "(AMR) Wide-Band"), + .priv_class = &class, };