[轉(zhuǎn)] Inside DuetDisplay and Unattributed Open-Source

轉(zhuǎn)自 http://ich.deanmcnamee.com/re/2014/12/18/DuetDisplay.html

I read about Duet a few days before its release. There were some interesting claims being suggested — “ex-Apple engineer” is able to run a display over the lightning connector, with zero latency. The marketing made it sound like this Apple-insiderness allowed them to do something new, perhaps a hardware level / accelerated connection with the iOS device to run it as a “real” display at 60 FPS. So how does it work?

Overview

The Duet driver creates an additional display, a memory backed framebuffer. The pixel contents of this framebuffer display are captured and compressed (with the help of CocoaSplit) and sent to the iOS device through the iTunes TCP over USB transport mechanism implemented by PeerTalk. So in the end this is quite like a VNC over TCP over UDP, so I find the claims of “zero lag” and 60 FPS to be a bit dishonest. This is not something like a DisplayLink connection.

Open-Source Libraries

Before Duet was released for iOS, the Desktop Duet.app was available to download. Taking a look at the binary revealed code from a few open-source libraries:

Credits?

Credits? I am not a lawyer and generally not a psychopath about software licensing. However, having spent much of my life on open-source software, I feel that when someone gives you something to use, commercially, free of charge, with attribution as the only obligation, that’s a pretty good deal. You really have a responsibility to do the right (and legal) thing. As far as I’ve seen, none of the above libraries are attributed anywhere in Duet. Additionally it seems CocoaSplit is licensed under the GPL. Uh oh.

PeerTalk

PeerTalk uses the iTunes usbmux system to relay TCP connections across the iOS USB connection. I am surprised that Apple has approved this in the AppStore, as it uses a reversed engineered interface to the usbmuxd socket. The good news is that if Apple has approved Duet, it means if all is fair anyone else should be able to use usbmux also.

scheduleReadPacketWithCallback

Disassembly of “DuetUSBChannel” as compared with PTUSBChannel scheduleReadPacketWithCallback. It seems the main difference between PeerTalk and the version in Duet, is the prefix has been renamed from PT to Duet. Why?

CocoaSplit

CocoaSplit is designed for capturing and streaming a display.

420v.fgsh

420v fragement shader included in Duet.app, as compared to the shader in CocoaSplit. Now, this is quite similar to one of the examples from Apple, however notice that the variables are renamed and it matches the whitespace and naming from CocoaSplit identically.

PreviewView

Duet’s PreviewView, as compared with the same from CocoaSplit.

GPUImage

GPUImage is a general purpose library of image processing via OpenGL.

GPUImage

GPUImageFramebuffer as seen in Duet.app.

Driver

I haven’t looked very deeply at the driver, but it is implementing a virtual screen framebuffer, similar to what is done by EWProxyFramebuffer. I’m not suggesting that any of the code from EWProxyFramebuffer was used. However, if you were to try to implement something similar that would be a good starting point.

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市拼弃,隨后出現(xiàn)的幾起案子班缰,更是在濱河造成了極大的恐慌凌那,老刑警劉巖霜运,帶你破解...
    沈念sama閱讀 217,907評(píng)論 6 506
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件贮懈,死亡現(xiàn)場(chǎng)離奇詭異耻涛,居然都是意外死亡,警方通過(guò)查閱死者的電腦和手機(jī)淋昭,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,987評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)安接,“玉大人翔忽,你說(shuō)我怎么就攤上這事。” “怎么了歇式?”我有些...
    開封第一講書人閱讀 164,298評(píng)論 0 354
  • 文/不壞的土叔 我叫張陵驶悟,是天一觀的道長(zhǎng)。 經(jīng)常有香客問(wèn)我贬丛,道長(zhǎng)撩银,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,586評(píng)論 1 293
  • 正文 為了忘掉前任豺憔,我火速辦了婚禮额获,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘恭应。我一直安慰自己抄邀,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,633評(píng)論 6 392
  • 文/花漫 我一把揭開白布昼榛。 她就那樣靜靜地躺著境肾,像睡著了一般。 火紅的嫁衣襯著肌膚如雪胆屿。 梳的紋絲不亂的頭發(fā)上奥喻,一...
    開封第一講書人閱讀 51,488評(píng)論 1 302
  • 那天,我揣著相機(jī)與錄音非迹,去河邊找鬼环鲤。 笑死,一個(gè)胖子當(dāng)著我的面吹牛憎兽,可吹牛的內(nèi)容都是我干的冷离。 我是一名探鬼主播,決...
    沈念sama閱讀 40,275評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼纯命,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼西剥!你這毒婦竟也來(lái)了?” 一聲冷哼從身側(cè)響起亿汞,我...
    開封第一講書人閱讀 39,176評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤瞭空,失蹤者是張志新(化名)和其女友劉穎,沒(méi)想到半個(gè)月后留夜,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體匙铡,經(jīng)...
    沈念sama閱讀 45,619評(píng)論 1 314
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,819評(píng)論 3 336
  • 正文 我和宋清朗相戀三年碍粥,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了鳖眼。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 39,932評(píng)論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡嚼摩,死狀恐怖钦讳,靈堂內(nèi)的尸體忽然破棺而出矿瘦,到底是詐尸還是另有隱情,我是刑警寧澤愿卒,帶...
    沈念sama閱讀 35,655評(píng)論 5 346
  • 正文 年R本政府宣布缚去,位于F島的核電站,受9級(jí)特大地震影響琼开,放射性物質(zhì)發(fā)生泄漏易结。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,265評(píng)論 3 329
  • 文/蒙蒙 一柜候、第九天 我趴在偏房一處隱蔽的房頂上張望搞动。 院中可真熱鬧,春花似錦渣刷、人聲如沸鹦肿。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,871評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)箩溃。三九已至,卻和暖如春碌嘀,著一層夾襖步出監(jiān)牢的瞬間涣旨,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 32,994評(píng)論 1 269
  • 我被黑心中介騙來(lái)泰國(guó)打工股冗, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留开泽,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 48,095評(píng)論 3 370
  • 正文 我出身青樓魁瞪,卻偏偏與公主長(zhǎng)得像,于是被迫代替她去往敵國(guó)和親惠呼。 傳聞我的和親對(duì)象是個(gè)殘疾皇子导俘,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,884評(píng)論 2 354

推薦閱讀更多精彩內(nèi)容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi閱讀 7,331評(píng)論 0 10
  • PLEASE READ THE FOLLOWING APPLE DEVELOPER PROGRAM LICENSE...
    念念不忘的閱讀 13,471評(píng)論 5 6
  • 在中南半島北部的密林深處,坐落著一座神圣的巨石廟宇剔蹋。千余年前旅薄,古老高棉民族在熱帶雨林深處,用智慧建筑了世界上最...
    初見拾月閱讀 740評(píng)論 0 0
  • HunmanIK簡(jiǎn)稱HIK泣崩,它是一個(gè)全身反向運(yùn)動(dòng)學(xué)的解算器和重定位器少梁。MotionBuilder中的HIK工具提供...
    CG動(dòng)捕閱讀 2,454評(píng)論 2 4
  • 求木之長(zhǎng)者,必固其根本; 欲流之遠(yuǎn)者矫付,必浚其泉源凯沪。 (一)身世 我的爺爺名諱薛世山,祖籍山東省青洲府諸城縣逄戈莊方...
    薛順堂閱讀 1,075評(píng)論 2 6