Media Transfer Protocol

Media Transfer ProtocolThe 


Media Transfer Protocol is described by Microsoft, who introduced it, as a protocol for intelligent storage devices based on and compatible with Picture Transfer Protocol(PTP).[1] Whereas PTP was designed for downloading photographs from digital cameras, Media Transfer Protocol supports the transfer of music files on digital audio players and media files on portable media players, as well as personal information on personal digital assistants. MTP is a key part of WMDRM10-PD,[1] a digital rights management (DRM) service for the Windows Media platform.

媒体传输协议又微软制定并发布,为智能存储类设备兼容图像传输协议所(PTP)用。PTP是被设计为了从数码相机下载照片,MTP支持的更多,包括数码音频播放器中传输音乐文件,便携式播放器传输媒体文件,以及在个人数码助理传输个人信息。 MTP是 WMDRM-10-PD的核心部分,为Windows Media platform提供数字版权管理。
Media Transfer Protocol (commonly referred to as MTP) is part of the "Windows Media" framework and thus closely related to Windows Media Player. Versions of the Microsoft Windows operating system from Windows XP SP2 support MTP. Windows XP requires Windows Media Player 10 or higher;[2] later Windows versions have built-in support. Microsoft have also made available an MTP Porting Kit for older versions of Windows back to Windows 98Apple Macintosh and Linux systems have software packages to support MTP.[3][4]
Windows,Linux, Mac都支持。

The USB Implementers Forum device working group standardized MTP as a fully fledged Universal Serial Bus (USB) device class in May 2008.[5] Since then MTP is an official extension to PTP and shares the same class code.[6]
USB工作组标准化了MTP做为完全成熟的类加入到USB设备类中。MTP作为PTP的官方扩展与PTP共用相同的类代码。

The main purpose of this protocol is to facilitate the transfer of media files and associated metadata to/from devices.
协议的主要目的是为了实现媒体文件和相关的媒体数据(主要是DRM相关的一些版权信息和媒体信息)从或者到 MTP设备中。



The protocol was originally implemented for use across USB but extended for use across TCP/IP and BluetoothWindows Vista supports MTP over TCP/IP. Windows 7 and Windows Vista with the Platform Update for Windows Vista also support MTP over Bluetooth.[7] The host connecting to an MTP device is called an MTP Initiator whereas the device itself is an MTP Responder.[8]
MTP协议不止局限于使用USB,也支持TCP/IP和蓝牙。
Host: MTP发起者
device: MTP回复者




A main reason for using MTP rather than, for example, the USB mass-storage device class(MSC) is that the latter operates at the granularity of a mass storage device block (usually in practice, a FAT block), rather than at the logical file level.
使用MTP而不是例如MSC的一个主要原因是, MSC操作的粒度是一个大容量存储的块(实际上是一个FAT块),而不是在一个逻辑文件上。

In other words, the USB mass storage class is designed to give a host computer undifferentiated access to bulk mass storage, such as compact flash, rather than to a file system, which might be safely shared with the target device (except for specific files which the host might be modifying/accessing). 
换句话说,MSC被设计来给主机提供一个无差别的接口来访问大容量存储,例如闪存,而不是文件系统,可能被目标设备安全的共享。

In practice, therefore, when a USB host computer has mounted an MSC partition, it assumes absolute control of the storage, which then may not be safely modified by the device without risk of data corruption until the host computer has severed the connection.
实际上,所以当主机mount上一个MSC分区时,它假定存储的决定控制权,这样可能不一定保证设备安全修改文件,而没有出现数据崩溃的危险。



Furthermore, because the host computer has full control over the connected storage device, there is a risk that the host computer may corrupt the file system, reformat it to a file system not supported by the USB device, or otherwise modify it in such a way that the USB device cannot completely understand it.
此外由于主机完全控制了存储设备,就存在主机可能损坏文件系统,格式化成USB设备不支持的文件系统,修改成USB设备无法使用的情况。


MTP and PTP specifically overcome this issue by making the unit of managed storage a local file rather than an entire (possibly very large) unit of mass storage at the block level. In this way, MTP works like a transactional file system - either the entire file is written/read or nothing. The storage media is not affected by failed transfers.
MTP和PTP使用逻辑单元而不是MSC使用的非常大的单元,就克服了上述问题。用这种方式,MTP像一个传输型文件系统一样工作,进行一个完整文件的读写。存储媒体不受失败传输的影响。


In case the device maintains a database/index of the content of the disk, MTP saves the cost of re-scanning the entire disk every time the content is modified.MTP保存一个硬盘内容的目录或是数据库,MTP发现当内容改变时进行扫描数据文件。



Additionally, the MTP allows MTP Initiators to identify the specific capabilities of device(s) with respect to file formats and functionality. In particular, MTP Initiators may have to provide passwords and other information to unlock files, or otherwise enablerestricted capabilities. Nothing specific of this nature is in the core standard but the possibility is allowed via Vendor extensions (whereas USB mass-storage does not cater for such extensions). MTPZ, the Zune Extension to MTP specifically denies access to files until authentication has been processed, which is only possible using Windows Media Player 10 or higher.
MTP允许发起者定义设备的文件格式和大小,功能。

MTP的缺点
系统支持可能需要第三方工具,文件修改比较麻烦,传输速度慢,损坏后不易恢复。



Why abandon USB Mass Storage?

As explained by Google Engineer Dan Morrill, the USB mass storage protocol was a block-level protocol. What this meant was that a partition could not be mounted on two different systems at the same time. Each partition that needs to be mounted on a computer must be unmounted from the phone first. This would be impossible on a phone with only a single partition, since if the system partition was unmounted, the phone would crash.

To work around this issue, Android phones up until now either had two partitions in the internal memory (like the Nexus S) or had a microSD slot (like the Samsung Galaxy S II). Phones with micro-SD slots would just export the microSD card partitions to the connected computer.
But the Galaxy Nexus only has a single internal partition. Other Ice Cream Sandwich phones in the future are likely to follow suit.


According to Google Engineer Dan Morrill, the advantages of the single partition approach are that “ no more staring sadly at your 5GB free on Nexus S when your internal app data partition has filled up — it’s all one big happy volume.

So Google has made the move on to MTP, to enable phones with single large partitions to connect to a computer with nearly the same results as USB mass storage. I’d personally prefer a phone with MTP rather than a phone with two tiny partitions.

推动Android MTP的原因是因为Google认为MTP能更好的使用一块大容量的存储,而不用分两个区。


MTP/PTP簡單來說就是支援多媒體傳輸的協定,同時支援一般的 UMS 功能。這兩項功能分別由兩間廠商所提出,MTP 是微軟為了搭配 Windows Media Player 所提出的、而PTP由 Kodak 為了數位照片所提出。市場上,其實 Samsung 早就在 Galaxy S 就使用 MTP 取代傳統的 UMS,而 Nokia 在 Symbian 也有 support MTP。

Google 在 Android 3.0 會採用 MTP 作為標準,其實有一大部分是為了DRM (Digital Rights Management) 而作的,因為MTP原本就是為了 DRM 所設計出來的協定。如同MS當初提出MTP的原因,Google目前面臨的也是如何處理數位內容的問題,才能替Android 取得更多的數位內容,其實更是為了解決 Android App 太容易被散佈問題鋪路。


更详细的MTP实作原理可以参考此  文件 ,概要来说

- MTP 实作分为物理层(Physical Layer)、传输层(Transport Layer)以及指令层(Command Layer)

- MTP 是基于PTP 设计出来的,两者在物理层的运作方式是相同的

MTP增加了对播放清单、PDA、日历、联络人、群组影像等功能的支援。

加入数位版权管理(DRM)属性,包括DRM状态、URL(在授权权限过期时,让DRM可以要求付费)、使用次数和其他相关属性。

- 支援超过4G的档案传输

- 基本MTP规格的使用是免费的,但只要使用MTP就必须完整支援其规格

- Enhanced Initiator (主机端?)则是要付费的

 

Google 在Android 3.0 实作的MTP 可在2.6.36 的tegra kernel 找到

-  f_mtp.c  (  History  )


下面是MTP 的一些基本资讯的参考来源:

Introduction to MTP: Media Transfer Protocol译文:  
http://shiwawa.blog.hexun.com.tw/8323038_d.html

 

MTP Function driver: 
http://www.usb-software.org/mtp_function_driver.php


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值