[MPlayer-dev-eng] [PATCH] Matrox G400 TV out w/ DirectFB (resend)
Ville Syrjälä
syrjala at sci.fi
Wed Oct 30 23:21:56 CET 2002
Attachments as base64 this time...
Here's a new vo plugin that uses DirectFB. It's meant for Matrox G400
cards and TV out. It's works like DVDMax in Windows.
DirectFB TV out features:
- interlaced picture
- 720x576 50Hz PAL and 720x486 60Hz NTSC
- RGB15, RGB16, RGB32, ARGB, YUY2, UYVY, I420, YV12 pixel formats
- hardware blended sub-picure in I420 and YV12 modes
- brightness, contrast, hue, saturation adjustments
- no more tweaking sessions with fbset to get the image centered :)
The plugin supports the following sub options:
bes: output to BES
nocrtc2: no output to CRTC2
nospic: disable hardware sub-picture
These can be combined.
Instructions on how to make it work are at:
http://www.sci.fi/~syrjala/directfb/readme.txt
--
Ville Syrjälä
syrjala at sci.fi
http://www.sci.fi/~syrjala/
-------------- next part --------------
LS0tIG1haW4vY29uZmlndXJlCU1vbiBPY3QgMjggMTE6Mjc6NDIgMjAwMgorKysgbWFpbi1t
Z2EvY29uZmlndXJlCU1vbiBPY3QgMjggMTI6MTU6MDIgMjAwMgpAQCAtMjE4Myw2ICsyMTgz
LDExIEBACiAgIGZpCiAgIF92b21vZHVsZXM9ImRpcmVjdGZiICRfdm9tb2R1bGVzIgogICBf
bGRfZGlyZWN0ZmI9Jy1sZGlyZWN0ZmInCisKKyAgaWYgdGVzdCAiJF9kaXJlY3RmYl92ZXJz
aW9uIiAtZ2UgOTE0OyB0aGVuCisgICAgX3Zvc3JjPSIkX3Zvc3JjIHZvX2RmYm1nYS5jIgor
ICAgIF92b21vZHVsZXM9ImRmYm1nYSAkX3ZvbW9kdWxlcyIKKyAgZmkKIGVsc2UKICAgX2Rl
Zl9kaXJlY3RmYj0nI3VuZGVmIEhBVkVfRElSRUNURkInCiAgIF9ub3ZvbW9kdWxlcz0iZGly
ZWN0ZmIgJF9ub3ZvbW9kdWxlcyIKLS0tIG1haW4vbGlidm8vdmlkZW9fb3V0LmMJTW9uIE9j
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ICAgIHdoaWxlICgqdm9fc3ViZGV2aWNlICE9ICdc
MCcpIHsKICAgICAgICAgICAgICAgaWYgKCFzdHJuY21wKHZvX3N1YmRldmljZSwgImJlcyIs
IDMpKSB7CiAgICAgICAgICAgICAgICAgICAgdXNlX2JlcyA9IDE7CiAgICAgICAgICAgICAg
ICAgICAgdm9fc3ViZGV2aWNlICs9IDM7CiAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoIXN0
cm5jbXAodm9fc3ViZGV2aWNlLCAibm9jcnRjMiIsIDcpKSB7CiAgICAgICAgICAgICAgICAg
ICAgdXNlX2NydGMyID0gMDsKICAgICAgICAgICAgICAgICAgICB2b19zdWJkZXZpY2UgKz0g
NzsKICAgICAgICAgICAgICAgfSBlbHNlIGlmICghc3RybmNtcCh2b19zdWJkZXZpY2UsICJu
b3NwaWMiLCA2KSkgewogICAgICAgICAgICAgICAgICAgIHVzZV9zcGljID0gMDsKICAgICAg
ICAgICAgICAgICAgICB2b19zdWJkZXZpY2UgKz0gNjsKICAgICAgICAgICAgICAgfSBlbHNl
CiAgICAgICAgICAgICAgICAgICAgdm9fc3ViZGV2aWNlKys7CiAgICAgICAgICB9CiAgICAg
fQogICAgIGlmICghdXNlX2JlcyAmJiAhdXNlX2NydGMyKSB7CgkgIGZwcmludGYoIHN0ZGVy
ciwgInZvX2RmYm1nYTogTm8gb3V0cHV0IHNlbGVjdGVkXG4iICk7CiAgICAgICAgICByZXR1
cm4gLTE7CiAgICAgfQoKICAgICBpZiAoIWluaXRlZCkgewogICAgICAgICAgRGlyZWN0RkJJ
bml0KCBOVUxMLCBOVUxMICk7CgogICAgICAgICAgaWYgKCFmYl9kZXZfbmFtZSAmJiAhKGZi
X2Rldl9uYW1lID0gZ2V0ZW52KCAiRlJBTUVCVUZGRVIiICkpKQogICAgICAgICAgICAgICBm
Yl9kZXZfbmFtZSA9ICIvZGV2L2ZiMCI7CiAgICAgICAgICBEaXJlY3RGQlNldE9wdGlvbigg
ImZiZGV2IiwgZ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mVlbiwKICAgICAgICBjaGFyICp0aXRs
ZSwKCXVpbnQzMl90IGZvcm1hdCApCnsKICAgICBERkJEaXNwbGF5TGF5ZXJDb25maWcgICAg
ICBkbGM7CiAgICAgREZCRGlzcGxheUxheWVyQ29uZmlnRmxhZ3MgZmFpbGVkOwogICAgIERG
QlN1cmZhY2VEZXNjcmlwdGlvbiAgICAgIGRzYzsKICAgICBERkJSZXN1bHQgICAgICAgICAg
ICAgICAgICByZXQ7CgogICAgIHVpbnQzMl90IG91dF93aWR0aDsKICAgICB1aW50MzJfdCBv
dXRfaGVpZ2h0OwoKICAgICBpbl93aWR0aCAgPSB3aWR0aDsKICAgICBpbl9oZWlnaHQgPSBo
ZWlnaHQ7CgogICAgIGFzcGVjdF9zYXZlX29yaWcod2lkdGgsIGhlaWdodCk7CiAgICAgYXNw
ZWN0X3NhdmVfcHJlc2NhbGUoZF93aWR0aCwgZF9oZWlnaHQpOwoKICAgICBkbGMucGl4ZWxm
b3JtYXQgICA9IGltZ2ZtdF90b19waXhlbGZvcm1hdCggZm9ybWF0ICk7CgogICAgIGlmICh1
c2VfYmVzKSB7CiAgICAgICAgICAvKiBEcmF3IHRvIEJFUyBzdXJmYWNlICovCiAgICAgICAg
ICBkbGMuZmxhZ3MgICAgICAgPSBETENPTkZfV0lEVEggfCBETENPTkZfSEVJR0hUIHwgRExD
T05GX1BJWEVMRk9STUFUIHwgRExDT05GX0JVRkZFUk1PREU7CiAgICAgICAgICBkbGMud2lk
dGggICAgICAgPSBpbl93aWR0aDsKICAgICAgICAgIGRsYy5oZWlnaHQgICAgICA9IGluX2hl
aWdodDsKICAgICAgICAgIGRsYy5idWZmZXJtb2RlICA9IERMQk1fQkFDS1ZJREVPOwoKICAg
ICAgICAgIGlmIChiZXMtPlRlc3RDb25maWd1cmF0aW9uKCBiZXMsICZkbGMsICZmYWlsZWQg
KSAhPSBERkJfT0spCiAgICAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgIGJlcy0+
U2V0Q29uZmlndXJhdGlvbiggYmVzLCAmZGxjICk7CiAgICAgICAgICBiZXMtPkdldFN1cmZh
Y2UoIGJlcywgJmZyYW1lICk7CgogICAgICAgICAgYXNwZWN0X3NhdmVfc2NyZWVucmVzKCAx
MDAwMCwgMTAwMDAgKTsKICAgICAgICAgIGFzcGVjdCggJm91dF93aWR0aCwgJm91dF9oZWln
aHQsIEFfWk9PTSApOwogICAgICAgICAgYmVzLT5TZXRTY3JlZW5Mb2NhdGlvbiggYmVzLAog
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKDEuMGYgLSAoZmxvYXQpIG91dF93
aWR0aCAgLyAxMDAwMC4wZikgLyAyLjBmLAogICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgKDEuMGYgLSAoZmxvYXQpIG91dF9oZWlnaHQgLyAxMDAwMC4wZikgLyAyLjBmLAog
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGZsb2F0KSBvdXRfd2lkdGggIC8g
MTAwMDAuMGYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZmxvYXQpIG91
dF9oZWlnaHQgLyAxMDAwMC4wZiApOwogICAgIH0gZWxzZSB7CiAgICAgICAgICAvKiBEcmF3
IHRvIGEgdGVtcG9yYXJ5IHN1cmZhY2UgKi8KICAgICAgICAgIERGQlN1cmZhY2VEZXNjcmlw
dGlvbiBkc2M7CgogICAgICAgICAgZHNjLmZsYWdzICAgICAgID0gRFNERVNDX0NBUFMgfAog
ICAgICAgICAgICAgICAgICAgICAgICAgICAgRFNERVNDX1dJRFRIIHwgRFNERVNDX0hFSUdI
VCB8CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBEU0RFU0NfUElYRUxGT1JNQVQ7CiAg
ICAgICAgICBkc2MuY2FwcyAgICAgICAgPSBEU0NBUFNfVklERU9PTkxZOwogICAgICAgICAg
ZHNjLndpZHRoICAgICAgID0gaW5fd2lkdGg7CiAgICAgICAgICBkc2MuaGVpZ2h0ICAgICAg
PSBpbl9oZWlnaHQ7CiAgICAgICAgICBkc2MucGl4ZWxmb3JtYXQgPSBkbGMucGl4ZWxmb3Jt
YXQ7CgogICAgICAgICAgZGZiLT5DcmVhdGVTdXJmYWNlKCBkZmIsICZkc2MsICZmcmFtZSAp
OwogICAgIH0KCiAgICAgaWYgKHVzZV9jcnRjMikgewogICAgICAgICAgZGxjLmZsYWdzICAg
ICAgPSBETENPTkZfUElYRUxGT1JNQVQgfCBETENPTkZfQlVGRkVSTU9ERTsKICAgICAgICAg
IGRsYy5idWZmZXJtb2RlID0gRExCTV9CQUNLVklERU87CgogICAgICAgICAgc3dpdGNoIChk
bGMucGl4ZWxmb3JtYXQpIHsKICAgICAgICAgIGNhc2UgRFNQRl9JNDIwOgogICAgICAgICAg
Y2FzZSBEU1BGX1lWMTI6CiAgICAgICAgICAgICAgIC8qIHN1Yi1waWN0dXJlIHN1cHBvcnRl
ZCAqLwogICAgICAgICAgICAgICBicmVhazsKCiAgICAgICAgICBjYXNlIERTUEZfWVVZMjoK
ICAgICAgICAgIGNhc2UgRFNQRl9VWVZZOgogICAgICAgICAgICAgICAvKiBCbGl0IHRvIFlV
WTIvVVlWWSBub3Qgc3VwcG9ydGVkICovCiAgICAgICAgICAgICAgIGRsYy5waXhlbGZvcm1h
dCA9IERTUEZfQVJHQjsKCiAgICAgICAgICAgICAgIC8qIGZhbGwgdGhyb3VnaCAqLwogICAg
ICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgLyogc3ViLXBpY3R1cmUgbm90IHN1cHBv
cnRlZCAqLwogICAgICAgICAgICAgICB1c2Vfc3BpYyA9IDA7CiAgICAgICAgICB9CgogICAg
ICAgICAgaWYgKGNydGMyLT5UZXN0Q29uZmlndXJhdGlvbiggY3J0YzIsICZkbGMsICZmYWls
ZWQgKSAhPSBERkJfT0spCiAgICAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgIGNy
dGMyLT5TZXRDb25maWd1cmF0aW9uKCBjcnRjMiwgJmRsYyApOwogICAgICAgICAgY3J0YzIt
PkdldFN1cmZhY2UoIGNydGMyLCAmYzJmcmFtZSApOwoKICAgICAgICAgIGMyZnJhbWUtPkdl
dFNpemUoIGMyZnJhbWUsICZzY3JlZW5fd2lkdGgsICZzY3JlZW5faGVpZ2h0ICk7CgogICAg
ICAgICAgLyogRG9uJ3Qgc3RyZXRjaCBvbmx5IHNsaWdodGx5IHNtYWxsZXIgdmlkZW9zICov
CiAgICAgICAgICBpZiAoKGluX3dpZHRoID4gKDAuOTUgKiBzY3JlZW5fd2lkdGgpKSAmJgog
ICAgICAgICAgICAgIChpbl93aWR0aCA8IHNjcmVlbl93aWR0aCkpCiAgICAgICAgICAgICAg
IG91dF93aWR0aCA9IGluX3dpZHRoOwogICAgICAgICAgZWxzZQogICAgICAgICAgICAgICBv
dXRfd2lkdGggPSBzY3JlZW5fd2lkdGg7CiAgICAgICAgICBpZiAoKGluX2hlaWdodCA+ICgw
Ljk1ICogc2NyZWVuX2hlaWdodCkpICYmCiAgICAgICAgICAgICAgKGluX2hlaWdodCA8IHNj
cmVlbl9oZWlnaHQpKQogICAgICAgICAgICAgICBvdXRfaGVpZ2h0ID0gaW5faGVpZ2h0Owog
ICAgICAgICAgZWxzZQogICAgICAgICAgICAgICBvdXRfaGVpZ2h0ID0gc2NyZWVuX2hlaWdo
dDsKCiAgICAgICAgICBhc3BlY3Rfc2F2ZV9zY3JlZW5yZXMoIG91dF93aWR0aCwgb3V0X2hl
aWdodCApOwogICAgICAgICAgYXNwZWN0KCAmb3V0X3dpZHRoLCAmb3V0X2hlaWdodCwgKGZ1
bGxzY3JlZW4gJiAweDAxKSA/IEFfWk9PTSA6IEFfTk9aT09NICk7CgogICAgICAgICAgaWYg
KGluX3dpZHRoICE9IG91dF93aWR0aCB8fAogICAgICAgICAgICAgIGluX2hlaWdodCAhPSBv
dXRfaGVpZ2h0KQogICAgICAgICAgICAgICBzdHJldGNoID0gMTsKICAgICAgICAgIGVsc2UK
ICA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SB7CiAgICAgICAgICAvKiBEcmF3IE9TRCB0byBzdWItcGljdHVyZSBzdXJmYWNl
ICovCiAgICAgICAgICBJRGlyZWN0RkJQYWxldHRlICpwYWxldHRlOwogICAgICAgICAgREZC
Q29sb3IgICAgICAgICAgY29sb3I7CiAgICAgICAgICBpbnQgICAgICAgICAgICAgICBpOwoK
ICAgICAgICAgIGRmYi0+R2V0RGlzcGxheUxheWVyKCBkZmIsIDMsICZzcGljICk7CiAgICAg
ICAgICBzcGljLT5TZXRDb29wZXJhdGl2ZUxldmVsKCBzcGljLCBETFNDTF9FWENMVVNJVkUg
KTsKICAgICAgICAgIHNwaWMtPlNldE9wYWNpdHkoIHNwaWMsIDAgKTsKCiAgICAgICAgICBk
bGMuZmxhZ3MgICAgICAgPSBETENPTkZfUElYRUxGT1JNQVQgfCBETENPTkZfQlVGRkVSTU9E
RTsKICAgICAgICAgIGRsYy5waXhlbGZvcm1hdCA9IERTUEZfTFVUODsKICAgICAgICAgIGRs
Yy5idWZmZXJtb2RlICA9IERMQk1fQkFDS1ZJREVPOwogICAgICAgICAgaWYgKHNwaWMtPlRl
c3RDb25maWd1cmF0aW9uKCBzcGljLCAmZGxjLCAmZmFpbGVkICkgIT0gREZCX09LKQogICAg
ICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgICBzcGljLT5TZXRDb25maWd1cmF0aW9u
KCBzcGljLCAmZGxjICk7CgogICAgICAgICAgc3BpYy0+R2V0U3VyZmFjZSggc3BpYywgJnN1
YmZyYW1lICk7CgogICAgICAgICAgc3ViZnJhbWUtPkdldFBhbGV0dGUoIHN1YmZyYW1lLCAm
cGFsZXR0ZSApOwogICAgICAgICAgY29sb3IuYSA9IDA7CiAgICAgICAgICBmb3IgKGkgPSAw
OyBpIDwgMTY7IGkrKykgewogICAgICAgICAgICAgICBjb2xvci5yID0gaSAqIDE3OwogICAg
ICAgICAgICAgICBjb2xvci5nID0gaSAqIDE3OwogICAgICAgICAgICAgICBjb2xvci5iID0g
aS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AogICAgICAgICAgICAgICAgICAgICAgIFZGQ0FQ
X0hXU0NBTEVfRE9XTiB8CiAgICAgICAgICAgICAgICAgICAgICAgVkZDQVBfQ1NQX1NVUFBP
UlRFRF9CWV9IVyB8CiAgICAgICAgICAgICAgICAgICAgICAgVkZDQVBfQ1NQX1NVUFBPUlRF
RCB8CiAgICAgICAgICAgICAgICAgICAgICAgVkZDQVBfT1NEKTsKICAgICB9CgogICAgIHJl
dHVybiAwOwp9CgpzdGF0aWMgY29uc3Qgdm9faW5mb190ICpnZXRfaW5mbyggdm9pZCApCnsK
CXJldHVybiAmdm9faW5mbzsKfQoKc3RhdGljIHZvaWQgdm9fZHJhd19hbHBoYV9sdXQ4KCBp
bnQgdywgaW50IGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdW5zaWduZWQg
Y2hhciogc3JjLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVuc2lnbmVkIGNo
YXIgKnNyY2EsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHNyY3N0cmlk
ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1bnNpZ25lZCBjaGFyKiBkc3Qs
CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGRzdHN0cmlkZSApCnsKICAg
ICBpbnQgeDsKCiAgICAgd2hpbGUgKGgtLSkgewogICAgICAgICAgZm9yICh4ID0gMDsgeCA8
IHc7IHgrKykgewogICAgICAgICAgICAgICBpZiAoc3JjYVt4XSkKICAgICAgICAgICAgICAg
ICAgICBkc3RbeF0gfD0gKCgyNTUgLSBzcmNhW3hdKSAmIDB4RjApIHwgKHNyY1t4XSA+PiA0
KTsKICAgICAgICAgIH0KICAgICAgICAgIHNyYyAgKz0gc3Jjc3RyaWRlOwogICAgICAgICAg
c3JjYSArPSBzcmNzdHJpZGU7CiAgICAgICAgICBkc3QgICs9IGRzdHN0cmlkZTsKICAgICB9
Cn0KCnN0YXRpYyB2b2lkCmR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eDAsCiAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICBwaXRjaCApOwoJICBicmVhazsKICAgICBjYXNlIERTUEZf
UkdCMTY6CgkgIHZvX2RyYXdfYWxwaGFfcmdiMTYoIHcsIGgsIHNyYywgc3JjYSwgc3RyaWRl
LAoJCQkgICAgICAgKCh1aW50OF90ICopIGRzdCkgKyBwaXRjaCAqIHkwICsgc3ViZnJhbWVf
cGl4ZWxfc2l6ZSAqIHgwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGl0Y2gg
KTsKCSAgYnJlYWs7CiAgICAgY2FzZSBEU1BGX1JHQjE1OgoJICB2b19kcmF3X2FscGhhX3Jn
YjE1KCB3LCBoLCBzcmMsIHNyY2EsIHN0cmlkZSwKCQkJICAgICAgICgodWludDhfdCAqKSBk
c3QpICsgcGl0Y2ggKiB5MCArIHN1YmZyYW1lX3BpeGVsX3NpemUgKiB4MCwKICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgIHBpdGNoICk7CgkgIGJyZWFrOwogICAgIGNhc2UgRFNQ
Rl9ZVVkyOgoJICB2b19kcmF3X2FscGhhX3l1eTIoIHcsIGgsIHNyYywgc3JjYSwgc3RyaWRl
LAoJCQkgICAgICAoKHVpbnQ4X3QgKikgZHN0KSArIHBpdGNoICogeTAgKyBzdWJmcmFtZV9w
aXhlbF9zaXplICogeDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpdGNoICk7
CgkgIGJyZWFrOwogICAgIGNhc2UgRFNQRl9VWVZZOgoJICB2b19kcmF3X2FscGhhX3l1eTIo
IHcsIGgsIHNyYywgc3JjYSwgc3RyaWRlLAoJCQkgICAgICAoKHVpbnQ4X3QgKikgZHN0KSAr
IHBpdGNoICogeTAgKyBzdWJmcmFtZV9waXhlbF9zaXplICogeDAgKyAxLAogICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICBwaXRjaCApOwoJICBicmVhazsKICAgICBjYXNlIERTUEZf
STQyMDoKICAgICBjYXNlIERTUEZfWVYxMjoKCSAgdm9fZHJhd19hbHBoYV95djEyKCB3LCBo
LCBzcmMsIHNyY2EsIHN0cmlkZSwKCQkJICAgICAgKCh1aW50OF90ICopIGRzdCkgKyBwaXRj
aCAqIHkwICsgc3ViZnJhbWVfcGl4ZWxfc2l6ZSAqIHgwLAogICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICBwaXRjaCApOwoJICBicmVhazsKICAgICB9CgogICAgIHN1YmZyYW1lLT5V
bmxvY2soIHN1YmZyYW1lICk7Cn0KCnN0YXRpYyB1aW50MzJfdApkcmF3X2ZyYW1lKCB1aW50
OF90ICogc3JjW10gKQp7CiAgICAgdm9pZCAqZHN0OwogICAgIGludCBwaXRjaDsKCiAgICAg
ZnJhbWUtPkxvY2soIGZyYW1lLCBEU0xGX1dSSVRFLCAmZHN0LCAmcGl0Y2ggKTsKCiAgICAg
c3dpdGNoIChmcmFtZV9mb3JtYXQpIHsKICAgICBjYXNlIERTUEZfQVJHQjoKICAgICBjYXNl
IERTUEZfUkdCMzI6CiAgICAgY2FzZSBEU1BGX1JHQjI0OgogICAgIGNhc2UgRFNQRl9SR0Ix
NjoKICAgICBjYXNlIERTUEZfUkdCMTU6CiAgICAgY2FzZSBEU1BGX1lVWTI6CiAgICAgY2Fz
ZSBEU1BGX1VZVlk6CiAgICAgICAgICB7CiAgICAgICAgICAgICAgIGludCBpOwogICAgICAg
ICAgICAgICBmb3IgKGkgPSAwOyBpIDwgaW5faGVpZ2h0OyBpKyspIHsKICAgICAgICAgICAg
ICAgICAgICBtZW1jcHkoIGRzdCArIGkgKiBwaXRjaCwKICAgICAgICAgICAgICAgICAgICAg
ICAgICAgIHNyY1swXSArIGkgKiBpbl93aWR0aCAqIGZyYW1lX3BpeGVsX3NpemUsCiAgICAg
ICAgICAgICAgICAgICAgICAgICAgICBpbl93aWR0aCAqIGZyYW1lX3BpeGVsX3NpemUgKTsK
ICAgICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgYnJlYWs7CiAgICAgY2Fz
ZSBEU1BGX1lWMTI6CiAgICAgICAgICB7CiAgICAgICAgICAgICAgIGludCBpOwogICAgICAg
ICAgICAgICBmb3IgKGkgPSAwOyBpIDwgaW5faGVpZ2h0OyBpKyspIHsKICAgICAgICAgICAg
ICAgICAgICBtZW1jcHkoIGRzdCArIGkgKiBwaXRjaCwKICAgICAgICAgICAgICAgICAgICAg
ICAgICAgIHNyY1swXSArIGkgKiBpbl93aWR0aCwKICAgICAgICAgICAgICAgICAgICAgICAg
ICAgIGluX3dpZHRoICk7CiAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgZHN0ICs9
IHBpdGNoICogaW5faGVpZ2h0OwogICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgaW5f
aGVpZ2h0IC8gMjsgaSsrKSB7CiAgICAgICAgICAgICAgICAgICAgbWVtY3B5KCBkc3QgKyBp
ICogcGl0Y2ggLyAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjWzJdICsgaSAq
IGluX3dpZHRoIC8gMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluX3dpZHRoIC8g
MiApOwogICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgIGRzdCArPSBwaXRjaCAqIGlu
X2hlaWdodCAvIDQ7CiAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBpbl9oZWlnaHQg
LyAyOyBpKyspIHsKICAgICAgICAgICAgICAgICAgICBtZW1jcHkoIGRzdCArIGkgKiBwaXRj
aCAvIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmNbMV0gKyBpICogaW5fd2lk
dGggLyAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5fd2lkdGggLyAyICk7CiAg
ICAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGJyZWFrOwogICAgIGNhc2Ug
RFNQRl9JNDIwOgogICAgICAgICAgewogICAgICAgICAgICAgICBpbnQgaTsKICAgICAgICAg
ICAgICAgZm9yIChpID0gMDsgaSA8IGluX2hlaWdodDsgaSsrKSB7CiAgICAgICAgICAgICAg
ICAgICAgbWVtY3B5KCBkc3QgKyBpICogcGl0Y2gsCiAgICAgICAgICAgICAgICAgICAgICAg
ICAgICBzcmNbMF0gKyBpICogaW5fd2lkdGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAg
ICBpbl93aWR0aCApOwogICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgIGRzdCArPSBw
aXRjaCAqIGluX2hlaWdodDsKICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGluX2hl
aWdodCAvIDI7IGkrKykgewogICAgICAgICAgICAgICAgICAgIG1lbWNweSggZHN0ICsgaSAq
IHBpdGNoIC8gMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyY1sxXSArIGkgKiBp
bl93aWR0aCAvIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbl93aWR0aCAvIDIg
KTsKICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICBkc3QgKz0gcGl0Y2ggKiBpbl9o
ZWlnaHQgLyA0OwogICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgaW5faGVpZ2h0IC8g
MjsgaSsrKSB7CiAgICAgICAgICAgICAgICAgICAgbWVtY3B5KCBkc3QgKyBpICogcGl0Y2gg
LyAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjWzJdICsgaSAqIGluX3dpZHRo
IC8gMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluX3dpZHRoIC8gMiApOwogICAg
ICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBicmVhazsKICAgICB9CgogICAg
IGZyYW1lLT5VbmxvY2soIGZyYW1lICk7CgogICAgIHJldHVybiAwOwp9CgpzdGF0aWMgdWlu
dDMyX3QKZHJhd19zbGljZSggdWludDhfdCAqIHNyY1tdLCBpbnQgc3RyaWRlW10sIGludCB3
LCBpbnQgaCwgaW50IHgsIGludCB5ICkKewogICAgIHZvaWQgKmRzdDsKICAgICBpbnQgcGl0
Y2g7CgogICAgIGZyYW1lLT5Mb2NrKCBmcmFtZSwgRFNMRl9XUklURSwgJmRzdCwgJnBpdGNo
ICk7CgogICAgIHN3aXRjaCAoZnJhbWVfZm9ybWF0KSB7CiAgICAgY2FzZSBEU1BGX0FSR0I6
CiAgICAgY2FzZSBEU1BGX1JHQjMyOgogICAgIGNhc2UgRFNQRl9SR0IyNDoKICAgICBjYXNl
IERTUEZfUkdCMTY6CiAgICAgY2FzZSBEU1BGX1JHQjE1OgogICAgIGNhc2UgRFNQRl9ZVVky
OgogICAgIGNhc2UgRFNQRl9VWVZZOgogICAgICAgICAgewogICAgICAgICAgICAgICB2b2lk
ICpzOwogICAgICAgICAgICAgICBpbnQgaTsKCiAgICAgICAgICAgICAgIGRzdCArPSB5ICog
cGl0Y2ggKyB4ICogZnJhbWVfcGl4ZWxfc2l6ZTsKICAgICAgICAgICAgICAgcyA9IHNyY1sw
XTsKICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGg7IGkrKykgewogICAgICAgICAg
ICAgICAgICAgIG1lbWNweSggZHN0LCBzLCB3ICk7CiAgICAgICAgICAgICAgICAgICAgZHN0
ICs9IHBpdGNoOwogICAgICAgICAgICAgICAgICAgIHMgKz0gc3RyaWRlWzBdOwogICAgICAg
ICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBicmVhazsKICAgICBjYXNlIERTUEZf
WVYxMjoKICAgICAgICAgIHsKICAgICAgICAgICAgICAgdm9pZCAqZCwgKnM7CiAgICAgICAg
ICAgICAgIGludCBpOwogICAgICAgICAgICAgICBkID0gZHN0ICsgcGl0Y2ggKiB5ICsgeDsK
ICAgICAgICAgICAgICAgcyA9IHNyY1swXTsKICAgICAgICAgICAgICAgZm9yIChpID0gMDsg
aSA8IGg7IGkrKykgewogICAgICAgICAgICAgICAgICAgIG1lbWNweSggZCwgcywgdyApOwog
ICAgICAgICAgICAgICAgICAgIGQgKz0gcGl0Y2g7CiAgICAgICAgICAgICAgICAgICAgcyAr
PSBzdHJpZGVbMF07CiAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgZCA9IGRzdCAr
IHBpdGNoICogaW5faGVpZ2h0ICsgcGl0Y2ggKiB5IC8gNCArIHggLyAyOwogICAgICAgICAg
ICAgICBzID0gc3JjWzJdOwogICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgaCAvIDI7
IGkrKykgewogICAgICAgICAgICAgICAgICAgIG1lbWNweSggZCwgcywgdyAvIDIgKTsKICAg
ICAgICAgICAgICAgICAgICBkICs9IHBpdGNoIC8gMjsKICAgICAgICAgICAgICAgICAgICBz
ICs9IHN0cmlkZVsyXTsKICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICBkID0gZHN0
ICsgcGl0Y2ggKiBpbl9oZWlnaHQgKyBwaXRjaCAqIGluX2hlaWdodCAvIDQgKwogICAgICAg
ICAgICAgICAgICAgIHBpdGNoICogeSAvIDQgKyB4IC8gMjsKICAgICAgICAgICAgICAgcyA9
IHNyY1sxXTsKICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGggLyAyOyBpKyspIHsK
ICAgICAgICAgICAgICAgICAgICBtZW1jcHkoIGQsIHMsIHcgLyAyICk7CiAgICAgICAgICAg
ICAgICAgICAgZCArPSBwaXRjaCAvIDI7CiAgICAgICAgICAgICAgICAgICAgcyArPSBzdHJp
ZGVbMV07CiAgICAgICAgICAgICAgIH0KICAgICAgICAgIH0KCSAgYnJlYWs7CiAgICAgY2Fz
ZSBEU1BGX0k0MjA6CiAgICAgICAgICB7CiAgICAgICAgICAgICAgIHZvaWQgKmQsICpzOwog
ICAgICAgICAgICAgICBpbnQgaTsKICAgICAgICAgICAgICAgZCA9IGRzdCArIHBpdGNoICog
eSArIHg7CiAgICAgICAgICAgICAgIHMgPSBzcmNbMF07CiAgICAgICAgICAgICAgIGZvciAo
aSA9IDA7IGkgPCBoOyBpKyspIHsKICAgICAgICAgICAgICAgICAgICBtZW1jcHkoIGQsIHMs
IHcgKTsKICAgICAgICAgICAgICAgICAgICBkICs9IHBpdGNoOwogICAgICAgICAgICAgICAg
ICAgIHMgKz0gc3RyaWRlWzBdOwogICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgIGQg
PSBkc3QgKyBwaXRjaCAqIGluX2hlaWdodCArIHBpdGNoICogeSAvIDQgKyB4IC8gMjsKICAg
ICAgICAgICAgICAgcyA9IHNyY1sxXTsKICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8
IGggLyAyOyBpKyspIHsKICAgICAgICAgICAgICAgICAgICBtZW1jcHkoIGQsIHMsIHcgLyAy
ICk7CiAgICAgICAgICAgICAgICAgICAgZCArPSBwaXRjaCAvIDI7CiAgICAgICAgICAgICAg
ICAgICAgcyArPSBzdHJpZGVbMV07CiAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAg
ZCA9IGRzdCArIHBpdGNoICogaW5faGVpZ2h0ICsgcGl0Y2ggKiBpbl9oZWlnaHQgLyA0ICsK
ICAgICAgICAgICAgICAgICAgICBwaXRjaCAqIHkgLyA0ICsgeCAvIDI7CiAgICAgICAgICAg
ICAgIHMgPSBzcmNbMl07CiAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBoIC8gMjsg
aSsrKSB7CiAgICAgICAgICAgICAgICAgICAgbWVtY3B5KCBkLCBzLCB3IC8gMiApOwogICAg
ICAgICAgICAgICAgICAgIGQgKz0gcGl0Y2ggLyAyOwogICAgICAgICAgICAgICAgICAgIHMg
Kz0gc3RyaWRlWzJdOwogICAgICAgICAgICAgICB9CiAgICAgICAgICB9CgkgIGJyZWFrOwog
ICAgIH0KCiAgICAgZnJhbWUtPlVubG9jayggZnJhbWUgKTsKCiAgICAgcmV0dXJuIDA7Cn0K
CnN0YXRpYyB2b2lkCmRyYXdfb3NkKCB2b2lkICkKewogICAgIGlmICh1c2Vfc3BpYykKICAg
ICAgICAgIHN1YmZyYW1lLT5DbGVhciggc3ViZnJhbWUsIDAsIDAsIDAsIDAgKTsKICAgICBl
bHNlIGlmICghdXNlX2NydGMyKSB7CiAgICAgICAgICAvKiBDbGVhciBibGFjayBiYXJzIGFy
b3VuZCB0aGUgcGljdHVyZSAqLwogICAgICAgICAgYzJmcmFtZS0+U2V0Q29sb3IoIGMyZnJh
bWUsIDAsIDAsIDAsIDAgKTsKICAgICAgICAgIGMyZnJhbWUtPkZpbGxSZWN0YW5nbGUoIGMy
ZnJhbWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLCAwLAogICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgZHJlY3QueCwgZHJlY3QueSArIGRyZWN0Lmgg
KTsKICAgICAgICAgIGMyZnJhbWUtPkZpbGxSZWN0YW5nbGUoIGMyZnJhbWUsCiAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAwLCBkcmVjdC55ICsgZHJlY3QuaCwKICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRyZWN0LnggKyBkcmVjdC53LCBkcmVjdC55
ICk7CiAgICAgICAgICBjMmZyYW1lLT5GaWxsUmVjdGFuZ2xlKCBjMmZyYW1lLAogICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgZHJlY3QueCwgMCwKICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgIGRyZWN0LnggKyBkcmVjdC53LCBkcmVjdC55ICk7CiAgICAg
ICAgICBjMmZyYW1lLT5GaWxsUmVjdGFuZ2xlKCBjMmZyYW1lLAogICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgZHJlY3QueCArIGRyZWN0LncsIGRyZWN0LnksCiAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICBkcmVjdC54LCBkcmVjdC55ICsgZHJlY3QuaCAp
OwogICAgIH0KCiAgICAgdm9fZHJhd190ZXh0KCBzY3JlZW5fd2lkdGgsIHNjcmVlbl9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ICAgICAgICAgIGNydGMyLT5H
ZXRDb2xvckFkanVzdG1lbnQoIGNydGMyLCAmY2EgKTsKICAgICBlbHNlIGlmICh1c2VfYmVz
KQogICAgICAgICAgYmVzLT5HZXRDb2xvckFkanVzdG1lbnQoIGJlcywgJmNhICk7CiAgICAg
ZWxzZQogICAgICAgICAgcmV0dXJuIDA7CgogICAgIGlmIChjYS5mbGFncyAmIERDQUZfQlJJ
R0hUTkVTUykgewogICAgICAgICAgaW5mby0+Y2FwICAgICAgICB8PSBWRVFfQ0FQX0JSSUdI
VE5FU1M7CiAgICAgICAgICBpbmZvLT5icmlnaHRuZXNzICA9IChjYS5icmlnaHRuZXNzIC0g
MHg4MDAwKSAqIGZhY3RvcjsKICAgICB9CiAgICAgaWYgKGNhLmZsYWdzICYgRENBRl9DT05U
UkFTVCkgewogICAgICAgICAgaW5mby0+Y2FwICAgICAgfD0gVkVRX0NBUF9DT05UUkFTVDsK
ICAgICAgICAgIGluZm8tPmNvbnRyYXN0ICA9IChjYS5jb250cmFzdCAtIDB4ODAwMCkgKiBm
YWN0b3I7CiAgICAgfQogICAgIGlmIChjYS5mbGFncyAmIERDQUZfSFVFKSB7CiAgICAgICAg
ICBpbmZvLT5jYXAgfD0gVkVRX0NBUF9IVUU7CiAgICAgICAgICBpbmZvLT5odWUgID0gKGNh
Lmh1ZSAtIDB4ODAwMCkgKiBmYWN0b3I7CiAgICAgfQogICAgIGlmIChjYS5mbGFncyAmIERD
QUZfU0FUVVJBVElPTikgewogICAgICAgICAgaW5mby0+Y2FwICAgICAgICB8PSBWRVFfQ0FQ
X1NBVFVSQVRJT047CiAgICAgICAgICBpbmZvLT5zYXR1cmF0aW9uICA9IChjYS5zYXR1cmF0
aW9uIC0gMHg4MDAwKSAqIGZhY3RvcjsKICAgICB9CgogICAgIHJldHVybiAwOwp9CgpzdGF0
aWMgdWludDMyX3QKY29udHJvbCggdWludDMyX3QgcmVxdWVzdCwgdm9pZCAqZGF0YSwgLi4u
ICkKewogICAgIHN3aXRjaCAocmVxdWVzdCkgewogICAgIGNhc2UgVk9DVFJMX1FVRVJZX0ZP
Uk1BVDoKCSAgcmV0dXJuIHF1ZXJ5X2Zvcm1hdCggKigodWludDMyX3QgKikgZGF0YSkgKTsK
ICAgICBjYXNlIFZPQ1RSTF9TRVRfRVFVQUxJWkVSOgogICAgICAgICAgewogICAgICAgICAg
ICAgICB2YV9saXN0IGFwOwogICAgICAgICAgICAgICBpbnQgdmFsdWU7CiAgICAgICAgICAg
ICAgIHZpZGl4X3ZpZGVvX2VxX3QgaW5mbzsKCiAgICAgICAgICAgICAgIHZhX3N0YXJ0KCBh
cCwgZGF0YSApOwogICAgICAgICAgICAgICB2YWx1ZSA9IHZhX2FyZyggYXAsIGludCApOwog
ICAgICAgICAgICAgICB2YV9lbmQoIGFwICk7CgogICAgICAgICAgICAgICBpZiAoIXN0cmNh
c2VjbXAoIGRhdGEsICJicmlnaHRuZXNzIiApKSB7CiAgICAgICAgICAgICAgICAgICAgaW5m
by5jYXAgPSBWRVFfQ0FQX0JSSUdIVE5FU1M7CiAgICAgICAgICAgICAgICAgICAgaW5mby5i
cmlnaHRuZXNzID0gdmFsdWUgKiAxMDsKICAgICAgICAgICAgICAgfQogICAgICAgICAgICAg
ICBpZiAoIXN0cmNhc2VjbXAoIGRhdGEsICJjb250cmFzdCIgKSkgewogICAgICAgICAgICAg
ICAgICAgIGluZm8uY2FwID0gVkVRX0NBUF9DT05UUkFTVDsKICAgICAgICAgICAgICAgICAg
ICBpbmZvLmNvbnRyYXN0ID0gdmFsdWUgKiAxMDsKICAgICAgICAgICAgICAgfQogICAgICAg
ICAgICAgICBpZiAoIXN0cmNhc2VjbXAoIGRhdGEsICJzYXR1cmF0aW9uIiApKSB7CiAgICAg
ICAgICAgICAgICAgICAgaW5mby5jYXAgPSBWRVFfQ0FQX1NBVFVSQVRJT047CiAgICAgICAg
ICAgICAgICAgICAgaW5mby5zYXR1cmF0aW9uID0gdmFsdWUgKiAxMDsKICAgICAgICAgICAg
ICAgfQogICAgICAgICAgICAgICBpZiAoIXN0cmNhc2VjbXAoIGRhdGEsICJodWUiICkpIHsK
ICAgICAgICAgICAgICAgICAgICBpbmZvLmNhcCA9IFZFUV9DQVBfSFVFOwogICAgICAgICAg
ICAgICAgICAgIGluZm8uaHVlID0gdmFsdWUgKiAxMDsKICAgICAgICAgICAgICAgfQogICAg
ICAgICAgICAgICBpZiAoZGlyZWN0ZmJfc2V0X3ZpZGVvX2VxKCAmaW5mbyApKQogICAgICAg
ICAgICAgICAgICAgIHJldHVybiBWT19GQUxTRTsKCiAgICAgICAgICAgICAgIHJldHVybiBW
T19UUlVFOwogICAgICAgICAgfQogICAgIGNhc2UgVk9DVFJMX0dFVF9FUVVBTElaRVI6CiAg
ICAgICAgICB7CiAgICAgICAgICAgICAgIHZhX2xpc3QgYXA7CiAgICAgICAgICAgICAgIGlu
dCAqdmFsdWU7CiAgICAgICAgICAgICAgIHZpZGl4X3ZpZGVvX2VxX3QgaW5mbzsKCiAgICAg
ICAgICAgICAgIGlmIChkaXJlY3RmYl9nZXRfdmlkZW9fZXEoICZpbmZvICkpCiAgICAgICAg
ICAgICAgICAgICAgcmV0dXJuIFZPX0ZBTFNFOwoKICAgICAgICAgICAgICAgdmFfc3RhcnQo
IGFwLCBkYXRhICk7CiAgICAgICAgICAgICAgIHZhbHVlID0gdmFfYXJnKCBhcCwgaW50KiAp
OwogICAgICAgICAgICAgICB2YV9lbmQoIGFwICk7CgogICAgICAgICAgICAgICBpZiAoIXN0
cmNhc2VjbXAoIGRhdGEsICJicmlnaHRuZXNzIiApKQogICAgICAgICAgICAgICAgICAgIGlm
IChpbmZvLmNhcCAmIFZFUV9DQVBfQlJJR0hUTkVTUykKICAgICAgICAgICAgICAgICAgICAg
ICAgICp2YWx1ZSA9IGluZm8uYnJpZ2h0bmVzcyAvIDEwOwogICAgICAgICAgICAgICBpZiAo
IXN0cmNhc2VjbXAoIGRhdGEsICJjb250cmFzdCIgKSkKICAgICAgICAgICAgICAgICAgICBp
ZiAoaW5mby5jYXAgJiBWRVFfQ0FQX0NPTlRSQVNUKQogICAgICAgICAgICAgICAgICAgICAg
ICAgKnZhbHVlID0gaW5mby5jb250cmFzdCAvIDEwOwogICAgICAgICAgICAgICBpZiAoIXN0
cmNhc2VjbXAoIGRhdGEsICJzYXR1cmF0aW9uIiApKQogICAgICAgICAgICAgICAgICAgIGlm
IChpbmZvLmNhcCAmIFZFUV9DQVBfU0FUVVJBVElPTikKICAgICAgICAgICAgICAgICAgICAg
ICAgICp2YWx1ZSA9IGluZm8uc2F0dXJhdGlvbiAvIDEwOwogICAgICAgICAgICAgICBpZiAo
IXN0cmNhc2VjbXAoIGRhdGEsICJodWUiICkpCiAgICAgICAgICAgICAgICAgICAgaWYgKGlu
Zm8uY2FwICYgVkVRX0NBUF9IVUUpCiAgICAgICAgICAgICAgICAgICAgICAgICAqdmFsdWUg
PSBpbmZvLmh1ZSAvIDEwOwoKICAgICAgICAgICAgICAgcmV0dXJuIFZPX1RSVUU7CiAgICAg
ICAgICB9CiAgICAgfQoKICAgICByZXR1cm4gVk9fTk9USU1QTDsKfQoKZXh0ZXJuIHZvaWQg
bXBsYXllcl9wdXRfa2V5KCBpbnQgY29kZSApOwoKI2luY2x1ZGUgIi4uL2xpbnV4L2tleWNv
ZGVzLmgiCgpzdGF0aWMgdm9pZApjaGVja19ldmVudHMoIHZvaWQgKQp7CiAgICAgc3RhdGlj
IGludCBvcGEgPSAyNTU7CiAgICAgREZCSW5wdXRFdmVudCBldmVudDsKCiAgICAgaWYgKGJ1
ZmZlci0+R2V0RXZlbnQoIGJ1ZmZlciwgREZCX0VWRU5UKCAmZXZlbnQgKSkgPT0gREZCX09L
KSB7CiAgICAgICAgICBpZiAoZXZlbnQudHlwZSA9PSBESUVUX0tFWVBSRVNTKSB7CiAgICAg
ICAgICAgICAgIHN3aXRjaCAoZXZlbnQua2V5X3N5bWJvbCkgewogICAgICAgICAgICAgICBj
YXNlIERJS1NfRVNDQVBFOgogICAgICAgICAgICAgICAgICAgIG1wbGF5ZXJfcHV0X2tleSgg
J3EnICk7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgIGNhc2Ug
RElLU19QQUdFX1VQOgogICAgICAgICAgICAgICAgICAgIG1wbGF5ZXJfcHV0X2tleSggS0VZ
X1BBR0VfVVAgKTsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAg
Y2FzZSBESUtTX1BBR0VfRE9XTjoKICAgICAgICAgICAgICAgICAgICBtcGxheWVyX3B1dF9r
ZXkoIEtFWV9QQUdFX0RPV04gKTsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAg
ICAgICAgICAgY2FzZSBESUtTX0NVUlNPUl9VUDoKICAgICAgICAgICAgICAgICAgICBtcGxh
eWVyX3B1dF9rZXkoIEtFWV9VUCApOwogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAg
ICAgICAgICAgICBjYXNlIERJS1NfQ1VSU09SX0RPV046CiAgICAgICAgICAgICAgICAgICAg
bXBsYXllcl9wdXRfa2V5KCBLRVlfRE9XTiApOwogICAgICAgICAgICAgICAgICAgIGJyZWFr
OwogICAgICAgICAgICAgICBjYXNlIERJS1NfQ1VSU09SX0xFRlQ6CiAgICAgICAgICAgICAg
ICAgICAgbXBsYXllcl9wdXRfa2V5KCBLRVlfTEVGVCApOwogICAgICAgICAgICAgICAgICAg
IGJyZWFrOwogICAgICAgICAgICAgICBjYXNlIERJS1NfQ1VSU09SX1JJR0hUOgogICAgICAg
ICAgICAgICAgICAgIG1wbGF5ZXJfcHV0X2tleSggS0VZX1JJR0hUICk7CiAgICAgICAgICAg
ICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgIGNhc2UgRElLU19JTlNFUlQ6CiAgICAg
ICAgICAgICAgICAgICAgbXBsYXllcl9wdXRfa2V5KCBLRVlfSU5TRVJUICk7CiAgICAgICAg
ICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgIGNhc2UgRElLU19ERUxFVEU6CiAg
ICAgICAgICAgICAgICAgICAgbXBsYXllcl9wdXRfa2V5KCBLRVlfREVMRVRFICk7CiAgICAg
ICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgIGNhc2UgRElLU19IT01FOgog
ICAgICAgICAgICAgICAgICAgIG1wbGF5ZXJfcHV0X2tleSggS0VZX0hPTUUgKTsKICAgICAg
ICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgY2FzZSBESUtTX0VORDoKICAg
ICAgICAgICAgICAgICAgICBtcGxheWVyX3B1dF9rZXkoIEtFWV9FTkQgKTsKICAgICAgICAg
ICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAg
ICAgICAgICBtcGxheWVyX3B1dF9rZXkoIGV2ZW50LmtleV9zeW1ib2wgKTsKICAgICAgICAg
ICAgICAgfQogICAgICAgICAgfQogICAgIH0KCiAgICAgLyoKICAgICAgKiBlbXB0eSBidWZm
ZXIsIGJlY2F1c2Ugb2YgcmVwZWF0aW5nCiAgICAgICoga2V5Ym9hcmQgcmVwZWF0IGlzIGZh
c3RlciB0aGFuIGtleSBoYW5kbGluZyBhbmQgdGhpcyBjYXVzZXMgcHJvYmxlbXMgZHVyaW5n
IHNlZWsKICAgICAgKiB0ZW1wb3Jhcnkgd29ya2Fib3V0LiBzaG91bGQgYmUgc29sdmVkIGlu
IHRoZSBmdXR1cmUKICAgICAgKi8KICAgICBidWZmZXItPlJlc2V0KCBidWZmZXIgKTsKfQo=
More information about the MPlayer-dev-eng
mailing list