如题。
有例代码最好,先谢了。

解决方案 »

  1.   

    你分析一下 asf 文件的格式自然就知道是如何传输的了。
    详细的文档微软网站上有下的2. File format organization
    This section provides a high-level overview of the ASF file format organization.
    2.1 ASF object definition
    The base unit of organization for ASF files is called the ASF object. It consists of a 128-bit GUID for the object, a 64-bit integer object size, and the variable-length object data. The value of the object size field is the sum of 24 bytes plus the size of the object data in bytes. The following diagram illustrates the ASF object structure:
     All ASF objects and structures (including data packet headers) are stored in little-endian byte order (the inverse of network byte order). However, ASF files can contain digital media stream data in either byte order within the data packets.
    2.2 Top-level file structure
    ASF files are logically composed of three types of top-level objects: the Header Object, the Data Object, and the Index Object(s). The Header Object is mandatory and must be placed at the beginning of every ASF file. The Data Object is also mandatory and must follow the Header Object. The Index Object(s) are optional, but they are useful in providing time-based random access into ASF files. When present, the Index Object(s) must be the last object in the ASF file. The following diagram illustrates the top-level ASF file structure:
     
    Implementations shall ignore any standard or non-standard object that they do not know how to handle. New top-level objects should be added only between the Data Object and Index Object(s).
    2.3 ASF top-level Header Object
    The role of the Header Object is to provide a well-known byte sequence at the beginning of ASF files (the ASF_Header_Object GUID) and to contain all the information that is needed to properly interpret the information within the data object. The Header Object can optionally contain metadata such as bibliographic information.Of the three top-level ASF objects, the Header Object is the only one that contains other ASF objects. The Header Object may include a number of standard objects including, but not limited to:• File Properties Object. Contains global file attributes.
    • Stream Properties Object. Defines a digital media stream and its characteristics.
    • Header Extension Object. Allows additional functionality to be added to an ASF file while maintaining backward compatibility.
    • Content Description Object. Contains bibliographic information.
    • Script Command Object. Contains commands that can be executed on the playback timeline.
    • Marker Object. Provides named jump points within a file.Note that objects in the Header Object may appear in any order.The complete list of header objects defined by this specification can be found in sections 3 and 4. To be valid, the Header Object must contain a File Properties Object, a Header Extension Object, and at least one Stream Properties Object.
    2.4 ASF top-level Data Object
    The Data Object contains all the digital media data for an ASF file. This data is stored in the form of ASF Data Packets. For the context of this specification, Data Packets are stored with a fixed length. Each Data Packet contains data for one or several digital media streams. Data Packets are sorted within the Data Object based on the time when they should be delivered (send time). This sorting results in an interleaved data format.
    2.5 ASF top-level index objects
    There are two varieties of index objects: the Simple Index Object and the Index Object (of which there are a few varieties).The Simple Index Object contains a time-based index of the video data in an ASF file. The time interval between index entries is constant and is stored in the Simple Index Object. For each video stream in an ASF file, there should be one instance of the Simple Index Object. The order in which those instances appear in the file is significant. The order of the Simple Index Objects should be identical to the order of the video streams based on their stream numbers. As described in detail in section 8.2.12, these objects need to be the last top-level objects in the file.The category Index Object refers to the Index Object, the Media Object Index Object, and the Timecode Index Object, whose formats are all similar. The Index Object, like the Simple Index Object, indexes by time with a fixed time interval, but is not limited to video streams. The Media Object Index Object is a frame-based index that facilitates seeking by frame (or object number). The Timecode Index Object facilitates seeking by timecode in content that contains timecodes (see section 7.3.2.1).